@verajs/renderer 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +729 -226
  2. package/dist/development/vera-renderer-elements.d.ts +39 -0
  3. package/dist/development/vera-renderer-elements.d.ts.map +1 -0
  4. package/dist/development/vera-renderer-elements.js +193 -0
  5. package/dist/development/vera-renderer-elements.js.map +1 -0
  6. package/dist/development/vera-renderer-hydrate-slots.d.ts +94 -0
  7. package/dist/development/vera-renderer-hydrate-slots.d.ts.map +1 -0
  8. package/dist/development/vera-renderer-hydrate-slots.js +325 -0
  9. package/dist/development/vera-renderer-hydrate-slots.js.map +1 -0
  10. package/dist/development/vera-renderer-hydration.d.ts +332 -0
  11. package/dist/development/vera-renderer-hydration.d.ts.map +1 -0
  12. package/dist/development/vera-renderer-hydration.js +864 -0
  13. package/dist/development/vera-renderer-hydration.js.map +1 -0
  14. package/dist/development/vera-renderer-keyed.d.ts +25 -8
  15. package/dist/development/vera-renderer-keyed.d.ts.map +1 -1
  16. package/dist/development/vera-renderer-keyed.js +843 -268
  17. package/dist/development/vera-renderer-keyed.js.map +1 -1
  18. package/dist/development/vera-renderer-multi-window.d.ts +5 -0
  19. package/dist/development/vera-renderer-multi-window.d.ts.map +1 -0
  20. package/dist/development/vera-renderer-multi-window.js +40 -0
  21. package/dist/development/vera-renderer-multi-window.js.map +1 -0
  22. package/dist/development/vera-renderer-namespaces.d.ts +64 -0
  23. package/dist/development/vera-renderer-namespaces.d.ts.map +1 -0
  24. package/dist/development/vera-renderer-namespaces.js +94 -0
  25. package/dist/development/vera-renderer-namespaces.js.map +1 -0
  26. package/dist/development/vera-renderer-native-elements.d.ts +13 -0
  27. package/dist/development/vera-renderer-native-elements.d.ts.map +1 -0
  28. package/dist/development/vera-renderer-native-elements.js +231 -0
  29. package/dist/development/vera-renderer-native-elements.js.map +1 -0
  30. package/dist/development/vera-renderer-portal.d.ts +29 -0
  31. package/dist/development/vera-renderer-portal.d.ts.map +1 -0
  32. package/dist/development/vera-renderer-portal.js +167 -0
  33. package/dist/development/vera-renderer-portal.js.map +1 -0
  34. package/dist/development/vera-renderer-profiler.d.ts +113 -138
  35. package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
  36. package/dist/development/vera-renderer-profiler.js +2428 -2101
  37. package/dist/development/vera-renderer-profiler.js.map +1 -1
  38. package/dist/development/vera-renderer-slots.d.ts +88 -92
  39. package/dist/development/vera-renderer-slots.d.ts.map +1 -1
  40. package/dist/development/vera-renderer-slots.js +1834 -1237
  41. package/dist/development/vera-renderer-slots.js.map +1 -1
  42. package/dist/development/vera-renderer-spread.d.ts +8 -29
  43. package/dist/development/vera-renderer-spread.d.ts.map +1 -1
  44. package/dist/development/vera-renderer-spread.js +542 -461
  45. package/dist/development/vera-renderer-spread.js.map +1 -1
  46. package/dist/development/vera-renderer-tag.d.ts +12 -3
  47. package/dist/development/vera-renderer-tag.d.ts.map +1 -1
  48. package/dist/development/vera-renderer-tag.js +671 -494
  49. package/dist/development/vera-renderer-tag.js.map +1 -1
  50. package/dist/development/vera-renderer-until.d.ts +24 -0
  51. package/dist/development/vera-renderer-until.d.ts.map +1 -0
  52. package/dist/development/vera-renderer-until.js +83 -0
  53. package/dist/development/vera-renderer-until.js.map +1 -0
  54. package/dist/development/vera-renderer.d.ts +77 -96
  55. package/dist/development/vera-renderer.d.ts.map +1 -1
  56. package/dist/development/vera-renderer.js +2401 -2061
  57. package/dist/development/vera-renderer.js.map +1 -1
  58. package/dist/vera-renderer-elements.min.js +2 -0
  59. package/dist/vera-renderer-elements.min.js.map +1 -0
  60. package/dist/vera-renderer-hydrate-slots.min.js +2 -0
  61. package/dist/vera-renderer-hydrate-slots.min.js.map +1 -0
  62. package/dist/vera-renderer-hydration.min.js +3 -0
  63. package/dist/vera-renderer-hydration.min.js.map +1 -0
  64. package/dist/vera-renderer-keyed.min.js +1 -1
  65. package/dist/vera-renderer-keyed.min.js.map +1 -1
  66. package/dist/vera-renderer-multi-window.min.js +2 -0
  67. package/dist/vera-renderer-multi-window.min.js.map +1 -0
  68. package/dist/vera-renderer-namespaces.min.js +2 -0
  69. package/dist/vera-renderer-namespaces.min.js.map +1 -0
  70. package/dist/vera-renderer-native-elements.min.js +2 -0
  71. package/dist/vera-renderer-native-elements.min.js.map +1 -0
  72. package/dist/vera-renderer-portal.min.js +2 -0
  73. package/dist/vera-renderer-portal.min.js.map +1 -0
  74. package/dist/vera-renderer-slots.min.js +1 -1
  75. package/dist/vera-renderer-slots.min.js.map +1 -1
  76. package/dist/vera-renderer-spread.min.js +1 -1
  77. package/dist/vera-renderer-spread.min.js.map +1 -1
  78. package/dist/vera-renderer-tag.min.js +1 -1
  79. package/dist/vera-renderer-tag.min.js.map +1 -1
  80. package/dist/vera-renderer-until.min.js +2 -0
  81. package/dist/vera-renderer-until.min.js.map +1 -0
  82. package/dist/vera-renderer.min.js +1 -1
  83. package/dist/vera-renderer.min.js.map +1 -1
  84. package/package.json +52 -9
  85. package/dist/development/vera-renderer-hydrate.d.ts +0 -118
  86. package/dist/development/vera-renderer-hydrate.d.ts.map +0 -1
  87. package/dist/development/vera-renderer-hydrate.js +0 -3092
  88. package/dist/development/vera-renderer-hydrate.js.map +0 -1
  89. package/dist/vera-renderer-hydrate.min.js +0 -2
  90. package/dist/vera-renderer-hydrate.min.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ let r=null;const t=(t,e,o)=>((r,t,e,o)=>{if(r?.length)for(const o of r)o(t,e);else((r,t)=>{"function"!=typeof reportError?console.error(t,r):reportError(r)})(t,o)})(r?.get("error"),t,(r=>null==r?void 0:11===r.nodeType?r.host:r)(e),o),e=r=>1===r.nodeType?r:r.firstElementChild,o=(r,t)=>{if(null!==r.firstElementChild)return r.firstElementChild;for(let e=r;null!==e&&e!==t;e=e.parentElement)if(null!==e.nextElementSibling)return e.nextElementSibling;return null},n=[t=>{r=t},{name:"@verajs/renderer/elements",on:"template",fn:(n,l,c,i)=>{const f=r?.get("element");if(void 0===f||0===f.length)return;const u=n,s=[],a=[];let d=0;for(let r=e(i);null!==r;r=o(r,i),d++)for(let t=0;t<f.length;t++){const e=f[t](r);void 0!==e&&(s.push(d),a.push(e))}s.length>0&&(u._$inst$=((r,n)=>({$c:(l,c,i)=>{const f=[],u=Array.isArray(l);let s=u?null:e(l),a=0;for(let e=0;e<r.length;e++){if(u)s=l[r[e]];else for(;a<r[e];a++)s=o(s,l);try{n[e].create?.(s,i)}catch(r){t(r,c,"[vera] claim-threw");continue}f.push(s,n[e])}return{f:f,r:c,a:i,k:void 0,d:!1}},$m:r=>{const e=r;if(e.d)return;const o=e.f,n={root:e.r,adopted:e.a};e.f=null;for(let r=0;r<o.length;r+=2){const l=o[r+1];let c;try{c=l.mount?.(o[r],n)}catch(r){t(r,e.r,"[vera] claim-threw");continue}void 0!==c&&void 0!==l.unmount&&(e.k??=[]).push(o[r],l,c)}},$q:r=>{const e=r;e.d=!0;const o=e.k;if(void 0!==o)for(let r=0;r<o.length;r+=3)try{o[r+1].unmount(o[r+2],o[r])}catch(r){t(r,e.r,"[vera] claim-threw")}}}))(s,a))},priority:10}];export{n as elements};
2
+ //# sourceMappingURL=vera-renderer-elements.min.js.map
@@ -0,0 +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,kBACjD,IAAK,IAAIG,EAAqBD,EAAa,OAAPC,GAAeA,IAAOnB,EAAMmB,EAAKA,EAAGC,cACtE,GAA8B,OAA1BD,EAAGE,mBAA6B,OAAOF,EAAGE,mBAChD,OAAO,IAAI,EAkGAC,EAAW,CACrBC,IACC1B,EAAa0B,CAAQ,EAEvB,CAAEC,KAAM,4BAA6BC,GAAI,WAAqBC,GAzB1C,CAACC,EAAeC,EAAkBC,EAAqB7B,KAC3E,MAAM8B,EAASjC,GAAYa,IAAI,WAC/B,QAAeC,IAAXmB,GAA0C,IAAlBA,EAAO1B,OAAc,OACjD,MAAM2B,EAAWJ,EAGXK,EAAsB,GACtBC,EAA+B,GACrC,IAAId,EAAK,EACT,IAAK,IAAID,EAAOH,EAAQf,G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+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"}
@@ -0,0 +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};
2
+ //# sourceMappingURL=vera-renderer-hydrate-slots.min.js.map
@@ -0,0 +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,I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rB,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"}
@@ -0,0 +1,3 @@
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};
3
+ //# sourceMappingURL=vera-renderer-hydration.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vera-renderer-hydration.min.js","sources":["../../shared-utils/src/diagnostic.ts","../../shared-utils/src/markup-grammar.ts","../src/hydration.ts","../src/kinds.ts"],"sourcesContent":["/**\n * **Where every diagnostic code is explained.** The URL is permanent: a released bundle is immutable, so every version\n * published points here for ever — the domain cannot lapse and `/e/` cannot be reorganized without breaking links in\n * code nobody can edit; the docs site redirects instead. `scripts/sync-diagnostics.mjs` imports this constant, so the\n * pages and the bundles can never disagree about where they are.\n */\nexport const DOCS = 'https://verajs.dev/e/';\n\n/**\n * **What this copy of the framework has already said** (Brian's ruling, 2026-11-12): the ONE memory behind `warnOnce`, `errorOnce`\n * and `hasWarned`, for DEVELOPMENT-ONLY warnings. It replaced the hand-written once-flags every package kept\n * (`saidLists`, `warnedDrop`, per-element WeakSets, per-key Sets: two naming styles, Brian: no names). **A warning that\n * ships to production keeps its memory at its site** (bytes, measured 2026-11-12: the shared memory costs +80–145 B gz\n * per bundle); development-only warnings use warnOnce. Module state by necessity, since \"once\" spans every call on the\n * page. One per BUNDLE COPY, exactly the scope each flag had, because this package is inlined into every bundle.\n * A code, or `code key` for a string key, in a Set. An object key (an element, a setup function) in a WeakMap, so its\n * entry goes with the object. Marked pure, so a bundle that never prints once drops both.\n */\nconst printed = /* @__PURE__ */ new Set<string>();\nconst printedOn = /* @__PURE__ */ new WeakMap<object, Map<string, Set<unknown>>>();\n/**\n * A once's KEY: none (once per page), a string (once per that string), an object (once per that object: an element, a\n * class, a setup function), or the PAIR `[object, value]`, a value key on that object (a store write: the object and its\n * property; a keyed list: the list and the duplicate key, compared as the list compares them, by value, so `1` and `'1'`\n * stay apart). A pair is the only array a key may be.\n */\ntype OnceKey = string | object | readonly [object, unknown];\n/** Where an object key's (code, value) lives: the value set for that code on that object, made on demand. */\nconst valuesOn = (on: object, code: string, make: boolean): Set<unknown> | undefined => {\n let codes = printedOn.get(on);\n if (codes === undefined) {\n if (!make) return undefined;\n printedOn.set(on, (codes = new Map()));\n }\n let values = codes.get(code);\n if (values === undefined && make) codes.set(code, (values = new Set()));\n return values;\n};\n/** The object and value of an object or pair key. */\nconst split = (key: object): readonly [object, unknown] => (Array.isArray(key) ? (key as unknown as readonly [object, unknown]) : [key, undefined]);\n/** Whether (code, key) is new, recording it if so. */\nconst firstTime = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') {\n const entry = key === undefined ? code : `${code} ${key}`;\n if (printed.has(entry)) return false;\n printed.add(entry);\n return true;\n }\n const [on, sub] = split(key);\n const values = valuesOn(on, code, true)!;\n if (values.has(sub)) return false;\n values.add(sub);\n return true;\n};\n\n/**\n * **One shape for every diagnostic the framework prints** — the short line production keeps, the whole sentence\n * development adds — so a package converting its messages writes a table and a call, never its own format.\n *\n * production `[vera] hydration: element: found <i> — https://verajs.dev/e/hydration-fallback`\n * development `[vera] hydration: element: found <i> — fell back to a client render: … (hydration-fallback)`\n *\n * `subject` is the free information — what the code already has at hand, naming the problem area — the same in both\n * builds. `prose` is development only: the package's table entry (`Prose`), called behind `__DEV__` at the call site so\n * the table goes unreferenced in production and rollup drops it whole. Production prints the code inside the link, so\n * the reader is one click from the explanation, which `scripts/sync-diagnostics.mjs` publishes from the same tables.\n *\n * **Every production message is coded** (Brian, 2026-11-11; this supersedes \"convert where smaller\", 2026-10-02):\n * consistency over a few bytes, so no package keeps a hand-written production line beside its table.\n */\n/*\n * The parameter names are deliberately unlike anything a caller holds: terser will not inline a function whose\n * parameter shadows a name at the call site (measured 2026-10-02 — directives passes its own `code`, and a parameter\n * called `code` left `((e,t,n)=>`…`)(0,t,n)` in its bundle, +8 B; renamed, the call folds to the bare template).\n */\n/**\n * **A misused API, named by its function** — the thrown-error twin of `diagnostic()`: `untrack: expected a function …\n * (untrack-not-function)`, function-first because a stack already names the source and the sweep reads that shape. The\n * prose comes from a package's table, behind `__DEV__`, so a development-only guard costs production nothing.\n */\nexport const misuse = (forName: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${DOCS}${withCode}`;\n\n/**\n * **A misused API and what it was misused ABOUT** — `misuse()` with a subject, in `diagnostic()`'s ` — ` separator:\n * `parseFrontmatter: line 3 — https://verajs.dev/e/cms-frontmatter-unsupported`. The subject is the free information\n * (a line, a URL and its status) and prints in both builds. A sibling rather than an optional parameter on `misuse()`,\n * because `misuse()` is inlined into every bundle that throws and a conditional subject would tax all of them for a\n * shape few need; a sibling is tree-shaken where unused.\n */\nexport const misuseAbout = (forName: string, aboutSubject: string, withCode: string, andProse?: false | readonly [string, string?]) =>\n __DEV__ && andProse\n ? `${forName}: ${aboutSubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `${forName}: ${aboutSubject} — ${DOCS}${withCode}`;\n\nexport const diagnostic = (\n inArea: string,\n bySubject: string,\n withCode: string,\n andProse?: false | readonly [string, string?]\n) =>\n /** `__DEV__` HERE as well as at the call: production folds this to the one-line form, branch and all. */\n __DEV__ && andProse\n ? `[vera] ${inArea}: ${bySubject} — ${andProse[0]}${andProse[1] ? ` ${andProse[1]}` : ''} (${withCode})`\n : `[vera] ${inArea}: ${bySubject} — ${DOCS}${withCode}`;\n\n/**\n * **Text from outside — a file path, a YAML key, a URL, an error's message — quoted before it reaches a line.** A log is a\n * pipeline, and such text can be shaped by an author or a request: a newline in it forges a line, an ESC sequence hides\n * one (log injection). `JSON.stringify` escapes both; cut to 80 characters so one value cannot fill the log. @verajs/ssr\n * keeps a twin (it cannot import this), held equal by tests/ssr-coded-diagnostics.\n */\n/**\n * `max` caps the length (80 by default); `Infinity` keeps the whole text for a value worth reading in full — a site\n * owner's own path — which is still ESCAPED: truncation and escaping are separate jobs, and a path is not free of control\n * characters just because its owner wrote it (2026-10-09).\n */\nexport const quoted = (text: string, max = 80): string => JSON.stringify(text.length > max ? `${text.slice(0, max)}…` : text);\n\n/**\n * **The errors a package constructs, marked as its own** — so a wrapper that reports an inner refusal (cms's\n * `generateManifest` around a frontmatter line) carries it as it is: already formatted, its outside text already\n * quoted. Anything else is foreign, and quoted. Identity, never a shape test: a message can imitate ours, an identity\n * cannot. @verajs/ssr keeps a twin (it cannot import this).\n */\nconst ours = /* @__PURE__ */ new WeakSet<object>();\nexport const own = <E extends Error>(error: E): E => {\n ours.add(error);\n return error;\n};\nexport const isOwn = (error: unknown): boolean => typeof error === 'object' && error !== null && ours.has(error);\n\n/**\n * **Whether this copy has already said `code` (for `key`)**: for a GUARD only, where deciding to warn costs work worth\n * skipping once the warning is out (development's whole-tree walk for unwired directive attributes, an event-name\n * guess over every property of an element). A site that only prints calls `warnOnce`. Asks, never records.\n */\nexport const hasWarned = (code: string, key?: OnceKey): boolean => {\n if (key === undefined || typeof key === 'string') return printed.has(key === undefined ? code : `${code} ${key}`);\n const [on, sub] = split(key);\n return valuesOn(on, code, false)?.has(sub) === true;\n};\n\ntype Detail = false | readonly [string, string?] | (() => readonly [string, string?] | undefined);\n/**\n * The printer behind both, on one level. `andDetail` is `diagnostic()`'s prose, or a function returning it where building\n * the sentence costs something: it is called only the first time. `...andMore` rides beside the line behind '%s' (an\n * element, a thrown error), never inside it, so text from outside cannot forge a line. The console method is read at the\n * call, so a test that replaces `console.warn` sees it.\n */\nconst sayOnce =\n (level: 'warn' | 'error') =>\n (inArea: string, bySubject: string, withCode: string, andDetail?: Detail, forKey?: OnceKey, ...andMore: unknown[]): void => {\n if (!firstTime(withCode, forKey)) return;\n const line = diagnostic(inArea, bySubject, withCode, typeof andDetail === 'function' ? andDetail() : andDetail);\n if (andMore.length) console[level]('%s', line, ...andMore);\n else console[level](line);\n };\n/**\n * **A diagnostic said once per page** (per key, where one is given: a string, or an object such as the element it is\n * about): `diagnostic()`'s arguments, then the key, then what rides beside the line. Coded in production exactly as\n * `diagnostic()` is, because it IS `diagnostic()`. `errorOnce` is its twin on `console.error`, for a refusal a page should\n * not miss.\n */\nexport const warnOnce = /* @__PURE__ */ sayOnce('warn');\nexport const errorOnce = /* @__PURE__ */ sayOnce('error');\n","import { misuse } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n/**\n * HTML's own element grammar — the facts about tags that every package emitting or reading markup\n * has to agree on.\n *\n * These are not this framework's rules; they are the parser's, and a package that guesses at them\n * produces markup whose *parse* differs from what its author wrote. That failure is silent by\n * nature: nothing throws, the page renders, and the DOM simply has a different shape than the\n * source said. See `VOID_ELEMENTS` below for the two measured instances.\n *\n * **Why here.** These sets had grown copies in `@verajs/ssr`, `@verajs/cms` and (as a regex) the\n * renderer, all agreeing by luck rather than by construction. This file is the one source for\n * every package that can take a build-time import — `@verajs/shared-utils` is private and inlined,\n * so importing it costs a consumer nothing at runtime and adds no published dependency.\n *\n * **`@verajs/ssr` cannot import it** and keeps its own copies: that package publishes its `src`\n * with no dependencies at all, so an import of a package that is never published would break the\n * published tarball. The same constraint already forced a twin of `escapeStyleText` there. A copy\n * is acceptable; a copy nothing checks is not, so `tests/markup-grammar-homes.test.mjs` drives\n * every copy against this file source-to-source rather than trusting they get edited together.\n *\n * **A consumer may keep a different SHAPE for the same fact** where a hot path needs one — the\n * renderer matches raw-text tags with a case-insensitive regex rather than lowercasing a string to\n * probe a `Set`. The rule is agreement, not representation, and the homes test asserts agreement\n * across whatever shape each home uses.\n */\n\n/**\n * Elements with no end tag, and therefore no children.\n *\n * Both directions of getting this wrong are silent, and both were live in this repo until the\n * audit of 2026-09-12 measured them:\n *\n * - **A non-void element written self-closing swallows what follows it.** HTML has no\n * self-closing syntax outside foreign content, so `<div/><span>after</span>` parses as\n * `<div><span>after</span></div>` — the sibling becomes a child. Every JSX toolchain treats\n * `<div/>` as an empty element, which is exactly why authors write it.\n * - **A void element written with an end tag is duplicated.** A parser reads `</br>` as *another*\n * `<br>`, so `<br></br>` renders two line breaks where the author wrote one.\n *\n * Inside `<svg>` and `<math>` the parser switches to foreign content, where XML self-closing *is*\n * honored — so neither rule applies there, and a consumer that checks must know where it is.\n */\nexport const VOID_ELEMENTS = new Set([\n 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',\n 'link', 'meta', 'param', 'source', 'track', 'wbr',\n]);\n\n/**\n * Elements a parser reads the children of as text rather than as markup.\n *\n * Two pieces of measured lore travel with this list and are the reason it is not read off a spec:\n *\n * - `iframe` and `noscript` were once absent from the SSR copy, which built a tree no browser\n * builds — `<noscript><img src=\"x\"></noscript>` produced an element, so\n * `querySelectorAll('noscript img')` answered 1 where every engine answers 0.\n * - `noscript` is raw text only when scripting is ENABLED. Fragment parsing disables it, and\n * Chromium and WebKit then parse the content as markup while Firefox parses it as text — so a\n * binding inside `<noscript>` worked in two engines and painted the renderer's internal marker\n * onto the page in the third. Listing it is safe in both parses.\n *\n * jsdom is not the oracle for either: it parses with scripting disabled and agrees with the old,\n * wrong list.\n */\nexport const RAW_TEXT_ELEMENTS = new Set(['style', 'script', 'textarea', 'title', 'iframe', 'noscript']);\n\n/**\n * The hyphenated names SVG and MathML already define, which the custom-elements spec reserves — so a\n * dash in one of these does NOT make it a custom element.\n *\n * Measured, the one that matters: JSX treats a dash-named tag as a custom element and compiles its\n * attributes to PROPERTIES, which turned `<annotation-xml encoding=\"text/html\">` into\n * `.encoding=${…}`. The HTML parser decides that element is an integration point from the\n * ATTRIBUTE on its start tag, so HTML content inside was moved out of the `<math>` entirely, and a\n * custom element there was built MathML-namespaced and never upgraded — silent on the server and\n * the client alike. That is also the exact spelling the renderer's own warning recommends.\n */\nexport const RESERVED_ELEMENT_NAMES = new Set([\n 'annotation-xml', 'color-profile', 'font-face', 'font-face-src',\n 'font-face-uri', 'font-face-format', 'font-face-name', 'missing-glyph',\n]);\n\n/**\n * **A custom element, by its name:** a dash, except the eight names SVG and MathML already own (above). One\n * definition for every package that asks — `@verajs/jsx` compiles such a tag's attributes to properties, and\n * `@verajs/renderer/slots` captures such a host's children. (The renderer's own property paths ask a narrower\n * question, the bare dash, on its hot path; a reserved name never carries a property binding.)\n */\nexport const isCustomElementName = (tag: string): boolean =>\n tag.includes('-') && !RESERVED_ELEMENT_NAMES.has(tag.toLowerCase());\n\n/**\n * A URL whose scheme a browser reads as `javascript:` — navigating to one runs it, so a BOUND value\n * that parses this way is code arriving as data, never a link.\n *\n * Matched the way the URL Standard's parser reads a scheme, because that is the only reading that\n * matters: leading C0 controls and spaces are stripped, ASCII tab, LF and CR are removed anywhere, and\n * the scheme is case-insensitive. A check that only lowercases is bypassed by `\" jAvA\\tscript:\"`,\n * which every engine navigates to. React's blocking pattern is the same rule.\n *\n * `@verajs/ssr` keeps a twin (it cannot import this package), held to this one by\n * `tests/url-sinks.test.mjs`, so a server never emits a link the client refuses.\n */\n// eslint-disable-next-line no-control-regex\nexport const SCRIPT_URL = /^[\\u0000- ]*j[\\t\\n\\r]*a[\\t\\n\\r]*v[\\t\\n\\r]*a[\\t\\n\\r]*s[\\t\\n\\r]*c[\\t\\n\\r]*r[\\t\\n\\r]*i[\\t\\n\\r]*p[\\t\\n\\r]*t[\\t\\n\\r]*:/i;\n\n/**\n * **Every bound name whose value is checked for a `javascript:` URL — and how.** One test answers both.\n *\n * Captured, checked from the start: the attributes (and their reflecting properties) whose value a browser\n * NAVIGATES to or loads as a document — links and areas (`href`, SVG's `xlink:href`), forms (`action`,\n * `formaction`), frames (`src`), and `<object data>`. `src` is matched on every element — refusing one on an `<img>`\n * costs nothing, since an image never runs it. Resource-only attributes (`poster`, `srcset`) are fetched, never run,\n * so they are not listed.\n *\n * Not captured, checked ITEM BY ITEM (`SCRIPT_URL_ITEM`): an SVG animation's values — `to`, `from`, `by`, `values`.\n * `<animate attributeName=\"href\" to=\"javascript:…\">` (or `<set>`, or `values`) writes its value onto the link it\n * animates, and clicking the link then RUNS it: measured 2026-09-30 in Chromium, Firefox and WebKit, through `href`\n * and `xlink:href` alike. Refused on EVERY element and whatever `attributeName` says, because `attributeName` can\n * itself be bound or spread, a server spread has no element to ask, and no legitimate value of any attribute by these\n * names starts with `javascript:` (a component's `to`, a router link's, is a URL too). **Only these names are checked\n * item by item**: an unanchored test scans the whole value for `;`, which on a bound `src` holding a data URI costs\n * ~0.45 ms per MB per update in Chromium and Firefox (measured 2026-09-30), where the anchored `SCRIPT_URL` stops at\n * the first character.\n *\n * Case-insensitive, because property spellings (`formAction`) and attribute spellings meet here. `@verajs/ssr` keeps\n * a twin, held to this one by `tests/url-sinks.test.mjs`.\n */\nexport const URL_SINK = /^(?:(href|src|action|formaction|xlink:href|data)|to|from|by|values)$/i;\n\n/**\n * `SCRIPT_URL` at the start of the value OR of any `;`-separated item of it — an animation's `values` list\n * (`\"#a;javascript:…\"`) applies every item in turn. Only for an animation's values (`URL_SINK`'s uncaptured names): a `;` inside an `href` is a path\n * character, and `/p;javascript:x` is a working link, never a script. Written out rather than derived from\n * `SCRIPT_URL`: the repeated text costs less gzipped than the code that would build it.\n */\n// eslint-disable-next-line no-control-regex\nexport const SCRIPT_URL_ITEM = /(?:^|;)[\\u0000- ]*j[\\t\\n\\r]*a[\\t\\n\\r]*v[\\t\\n\\r]*a[\\t\\n\\r]*s[\\t\\n\\r]*c[\\t\\n\\r]*r[\\t\\n\\r]*i[\\t\\n\\r]*p[\\t\\n\\r]*t[\\t\\n\\r]*:/i;\n\n/**\n * **An inline event-handler attribute** — `on` and a letter, any case (`onclick`, `onLoad`, `onbeforeinput`): its\n * value is run as CODE, so a BOUND one is code arriving as data, refused by the template scanner, `spread` and the\n * server alike (a static `onclick=\"save()\"` is the author's own and untouched). Broad on purpose — it also refuses a\n * bound `once=`/`online=` attribute; the precise rule would need the platform's list of handler names. `@verajs/ssr`\n * keeps a twin, held to this one by `tests/inline-handlers.test.mjs`.\n */\nexport const INLINE_HANDLER = /^on./i;\n\n/**\n * **The properties that replace an element's whole content** — a binding to one owns the element's children, so it\n * cannot share the element with content of its own (markup, or a child binding the write would strand: a later commit\n * into it then throws on a missing parent). Development refuses the pair in the template scanner and in `spread` alike.\n */\nexport const CONTENT_PROPERTY = /^(?:textContent|innerHTML|innerText|outerHTML|outerText)$/;\n/**\n * Whether an element has content of its own that a content-replacing write would strand or lose: a child that is not\n * whitespace-only text (formatting whitespace loses nothing), or — `$content`, set in development by the renderer — a\n * child binding that owns the element whole and leaves no node behind until it commits. The element-specific `.text`\n * setters (`<a>`, `<option>`, `<title>`, `<script>`) are deliberately not in the list: a custom element's own `text`\n * prop is common, and would be refused for nothing.\n */\nexport const ownsContent = (element: Element): boolean => {\n if ((element as Element & { $content?: boolean }).$content === true) return true;\n for (let node = element.firstChild; node !== null; node = node.nextSibling)\n /**\n * An EMPTY text node is a child binding's anchor, not formatting: formatting whitespace is never empty. And\n * formatting is HTML's whitespace, `[ \\t\\n\\f\\r]` — not JS's `trim()`, which would let an `&nbsp;` be overwritten.\n */\n if (node.nodeType !== 3 || (node as Text).data === '' || /[^ \\t\\n\\f\\r]/.test((node as Text).data)) return true;\n return false;\n};\n/** `side` is the module the user wired — `renderer` for a template, `spread` for a spread. */\nexport const contentClash = (side: string, tag: string, name: string): never => {\n throw new Error(misuse(side, 'content-clash', __DEV__ && SHARED.contentClash(tag, name, side === 'spread' ? `<${tag} \\${spread({ '.${name}': … })}></${tag}>` : `<${tag} .${name}=\\${…}></${tag}>`)));\n};\n\n/**\n * **An expression in TAG-name position** (`<${x}>`, `</${x}>`, `<my-${x}>`) without `@verajs/renderer/tag`: no\n * element can be made from it — the parser reads a tag name before any value exists. Refused by the client in\n * development and by the server in every build, with one message. The tag entry splices a tag VALUE into the\n * statics before the renderer sees it, so only a non-tag ever reaches here.\n */\nexport const TAG_NAME_HOLE = /<\\/?[^\\s>]*$/;\nexport const tagHole = (side: string): never => {\n throw new Error(misuse(side, 'tag-hole', __DEV__ && SHARED.tagHole()));\n};\n","/**\n * **`@verajs/renderer/hydration` — adopt server-rendered DOM.** `wire([renderer, hydration])`.\n *\n * One renderer: this module plugs into it through the hand-off the renderer sets at `connect` (`$H` — a separately\n * bundled module cannot import the renderer's internals, and production mangles their names), and asks to be told of\n * every container's FIRST render that finds children already there. It adopts them as the server's output of the same\n * template: node identity kept, listeners attached, updates mutating the adopted nodes. Server HTML carries no framework\n * comments; the client puts in the anchors it needs.\n *\n * **Queue, then run.** ONE walk matches the container — statics byte for byte, element names, text boundaries, nested\n * templates and lists — doing only what runs no user code as it goes: splitting text and putting in the renderer's\n * comment anchors. Everything that runs user code — a binding's commit (a setter, a listener, an attribute write a\n * component observes), an instance hook, an applier, a `'value'` handler, a node placed into the page — is QUEUED, in\n * walk order, which is client order. Only when the whole container matches does the queue run. So a container that does\n * not match is rendered fresh with NOTHING of the client's run against the server's nodes: no setter, no `create`, no\n * ref, no listener, no applier. Two notes: each text value is converted once, during the walk, as a client render\n * converts it (an object's `toString` is the one user code that runs before the decision); and a user's own\n * MutationObserver on a container that then mismatches sees text splits and comments put in, then the clear. (The one\n * exception is the platform's: a server custom element already defined upgrades on parse and runs its own setup before\n * any hydration starts — `tests/hydration-walk.test.mjs` pins it.)\n *\n * User code that THROWS while the queue runs leaves the container partly committed — exactly as a client render that\n * throws midway does; it is the render's error, not a hydration one.\n *\n * **The renderer's commit never asks \"am I hydrating?\".** Where the server's attribute already says what the client\n * would write, the walk SEEDS the binding's committed value and calls the base commit — which runs every sink check as\n * always (a `javascript:` URL is refused and removed exactly as on a fresh render) and then skips the write on its own\n * `value === committed` fast path. Form state is recorded, never written: the server's default, and anything the user\n * typed before the script arrived, stand.\n *\n * A mismatch — or a renderer speaking another hand-off protocol — never breaks the page: the container renders fresh,\n * and the console says so once per cause.\n */\nimport { CONTENT_PROPERTY, diagnostic } from '@verajs/shared-utils';\n/** Development only — behind `__DEV__` at every use, so production drops the table whole. */\nimport { PROSE } from './hydration-diagnostics.js';\nimport {\n ADOPT,\n ATTR,\n BOOLEAN,\n EVENT,\n IGNORED,\n LIST,\n LIVE,\n NODE,\n PROPERTY,\n REF,\n SELECT,\n SELECT_INDEX,\n SELECT_REF,\n SOLE,\n TEMPLATE,\n TEXT,\n HANDOFF_ADOPTER,\n HANDOFF_CHILD_PART,\n HANDOFF_COMMIT,\n HANDOFF_COMMIT_AS,\n HANDOFF_GET_TEMPLATE,\n HANDOFF_HOOK_UP,\n HANDOFF_INSTANCE,\n HANDOFF_PROTOCOL,\n HANDOFF_REMOVAL_WORK,\n PROTOCOL,\n HANDOFF_RESOLVE,\n HANDOFF_ROOTS,\n HANDOFF_SLOT,\n HANDOFF_TO_TEXT,\n HANDOFF_UNSET,\n HANDOFF_UPGRADED,\n} from './kinds.js';\nimport type { ChildPart, Instance, Item, KeyedResult, Slot, Template } from './renderer.js';\nimport type { HydrateSlots, HydrationCursor, ServedHost, TemplateResult } from './types.js';\n\n/** What the renderer hands over (`renderer.ts`, `connect`), by the `HANDOFF_*` positions in `kinds.ts`. */\ntype Handoff = [\n protocol: number,\n adopter: (adopt: (result: unknown, container: Node) => boolean) => void,\n getTemplate: (result: TemplateResult) => Template,\n ChildPart: new (start: Comment | null, end: Node | null) => ChildPart,\n Instance: new (template: Template, strings: TemplateStringsArray, root: Node, bindings: unknown[]) => Instance,\n Slot: new (element: Element) => Slot,\n unset: object,\n upgraded: object,\n commit: (template: Template, bindings: unknown[], i: number, kind: number, values: unknown[]) => void,\n commitAs: (root: Node | null, part: ChildPart, value: unknown, home?: Node | null) => void,\n hookUp: (instance: Instance, root: Node | readonly Element[], adopted: boolean) => void,\n resolve: (template: Template, parent: Node) => Template,\n roots: { set(node: Node, part: ChildPart): void },\n toText: (value: unknown) => string,\n removalWork: () => void,\n];\n/**\n * **Light-DOM slots' seam** (`@verajs/renderer/slots` installs it, off-chain like `_$done$`): its own `capture`, stamped\n * with this package's seam protocol — a served host's light children, in light order, captured where the server put\n * them, the server's carrier as their holding. Everything about the SERVER's format is read here; slots knows none of it.\n */\ntype Registry = {\n get(name: string): unknown[] | undefined;\n $H?: Handoff;\n $t?: Untracked;\n _$hydrateSlots$?: HydrateSlots;\n _$hydrating$?: boolean;\n /** Slots' seam: present when slots is wired — read here only to know that. */\n _$capture$?: unknown;\n};\ntype Untracked = <A extends unknown[], R>(fn: (...args: A) => R, ...args: A) => R;\ntype Applies = { _$apply$: (element: Element, key: object, run: Untracked, adopting?: boolean) => void };\n/**\n * A `'value'` handler: `true` claims the value (it commits into the emptied part; the server span goes). During hydration\n * a THIRD argument is passed — the part as the base adopted it — and a handler may return `ADOPTED` (2) to keep those\n * nodes, taking ownership of what was adopted. **The third argument is OPTIONAL and absent = build** (2026-10-22): an\n * older handler ignores it and claims as before; a newer handler under an older base, which passes two, builds.\n */\ntype ValueHandler = (part: object, value: unknown, adopted?: object) => boolean | number | void;\n/** What a handler returns to keep the adopted nodes instead of claiming (`claimed`). */\nconst ADOPTED = 2;\n\nlet H: Handoff;\nlet registry: Registry;\n/** The piece, read per adoption (it may be wired after this module); the served host being adopted, else `null`. */\nlet piece: HydrateSlots | undefined;\nlet served: ServedHost | null = null;\n/**\n * Walking a FILLED slot's element: a detached copy of the canonical one, as the client keeps it — the server never wrote\n * it, so its fallback's values are committed fresh into the copy rather than claimed (see `fresh*`).\n */\nlet fresh = false;\nlet untracked: Untracked;\n\n/* ── the warning: the only signal a fallback gives, once per cause ───────────────────────────────── */\n\n/**\n * Said once per KIND of cause per hydration pass, in every build — keyed by the kind (`text`, `element`…), not the\n * detail: a page of 500 containers that each differ in their text says it once, naming the first. The record clears at\n * the next microtask, so a later pass that meets the kind again says it. Not `warnOnce` (Brian's ruling, 2026-11-12): that memory\n * is once per page and never forgets, and this one is once per PASS.\n */\nconst causesThisPass = new Set<string>();\nconst warn = (cause: string, message: string, container?: Node) => {\n if (causesThisPass.has(cause)) return;\n if (causesThisPass.size === 0) queueMicrotask(() => causesThisPass.clear());\n causesThisPass.add(cause);\n /** The container itself rides along: a live element in devtools — hover to highlight it, click to reveal it. */\n if (container === undefined) console.warn(message);\n else console.warn('%s', message, container);\n};\n\n/* ── the walk's state, per hydration ─────────────────────────────────────────────────────────────── */\n\n/**\n * **The work that runs user code, held until the whole container matches** — flat tuples of six, in walk order (client\n * order): `[op, a, b, c, d, e]`. ONE array for every adoption, reused — allocating one per adoption cost a measured\n * share of hydration in collection alone. Each adoption owns the range from where the queue stood when it began, and\n * truncates back to that when it ends: a nested adoption (a queued setter rendering into its own element) pushes past\n * the outer's range and is gone again before the outer goes on.\n */\nconst queue: unknown[] = [];\nconst COMMIT = 0;\nconst APPLY = 1;\nconst HOOK = 2;\nconst CHILD = 3;\nconst HANDLE = 4;\nconst INSERT = 5;\nconst later = (op: number, a: unknown, b?: unknown, c?: unknown, d?: unknown, e?: unknown) => {\n queue.push(op, a, b, c, d, e);\n};\n/** The first place the two renders disagreed — for the warning. */\nlet why = '';\n\n/** Why adoption stops: thrown, caught at the container, never escapes. */\nconst MISMATCH = {};\n/** The KIND of the first disagreement — what the warning is said once per: `text`, `value`, `element`, `extra`. */\nlet kind = '';\nconst mismatch = (cause: string, at: Node | null, reason: false | (() => string)): never => {\n kind = cause;\n why = reason ? reason() : `${cause}: found ${describe(at)}`;\n throw MISMATCH;\n};\n\n/** A live node as a person would name it. */\nconst describe = (node: Node | null) =>\n node === null\n ? 'nothing'\n : node.nodeType === 1\n ? `<${(node as Element).localName}>`\n : node.nodeType === 3\n ? `the text ${JSON.stringify((node as Text).data.slice(0, 30))}`\n : node.nodeType === 8\n ? 'a comment'\n : `a ${node.nodeName} node`;\n\n/** A value's text — the base's own conversion, once, as a client render converts it. */\nconst textOf = (value: unknown) => H[HANDOFF_TO_TEXT](value);\n\nconst isTemplateResult = (value: object): value is TemplateResult => (value as TemplateResult).strings !== undefined;\n\n/** A template's opening markup, as its author wrote it — something to search the code for (development only). */\nconst opening = (result: TemplateResult) => {\n const text = result.strings.join('${…}').replace(/\\s+/g, ' ').trim();\n return `\\`${text.length > 60 ? `${text.slice(0, 60)}…` : text}\\``;\n};\n\n/* ── where the walk stands ───────────────────────────────────────────────────────────────────────── */\n\n/**\n * **Which bindings each canonical node carries**, built once per template the first time one is adopted: every\n * binding's node located through its path on the pristine canonical content, as `instantiate` locates it on a clone.\n */\nconst plans = new WeakMap<Template, Map<Node, number[]>>();\nconst planOf = (template: Template) => {\n let plan = plans.get(template);\n if (plan === undefined) {\n plans.set(template, (plan = new Map()));\n const kinds = template.$K;\n for (let i = 0; i < kinds.length; i++) {\n if (kinds[i] === IGNORED) continue;\n let node = template.$R;\n for (const step of template.$P[i]) {\n node = node.firstChild!;\n for (let hops = step; hops > 0; hops--) node = node.nextSibling!;\n }\n const owned = plan.get(node);\n if (owned === undefined) plan.set(node, [i]);\n else owned.push(i);\n }\n }\n return plan;\n};\n\n/** Where the walk stands (`types.ts`: `hydrate-slots` moves it too). */\ntype Cursor = HydrationCursor;\n\n/** A comment carries no content: adoption neither matches nor requires one, at a node boundary. */\n/**\n * **The node after `node` on this walk** — its next sibling, until `hydrate-slots` is wired: then the piece's own step,\n * which on a light host's walk gives the next light child. Only then can a light cursor exist, so a page without the\n * piece walks exactly as before it (a light check on every step cost Chrome's hydrate phase ~2%, measured 2026-10-07,\n * on pages with no light hosts at all) and carries none of its code.\n */\nlet next = (_cursor: Cursor, node: Node): Node | null => node.nextSibling;\n\nconst passComments = (cursor: Cursor) => {\n while (cursor.offset === 0 && cursor.node !== null && cursor.node.nodeType === 8) cursor.node = next(cursor, cursor.node);\n};\n\n/** Puts the cursor on a node boundary (splitting the text it stands in) and returns the node there. */\nconst boundary = (cursor: Cursor) => {\n if (cursor.offset > 0) {\n cursor.node = (cursor.node as Text).splitText(cursor.offset);\n cursor.offset = 0;\n }\n return cursor.node;\n};\n\n/** Inserts at the cursor — the walk inserts only text and the renderer's comment anchors, which run no user code. */\nconst plainInsert = (cursor: Cursor, node: Node) => cursor.parent.insertBefore(node, boundary(cursor));\n/** Like `next`: the plain insert until `hydrate-slots` is wired, then light-aware — a run's anchors go to the piece. */\nlet insertHere: (cursor: Cursor, node: Node) => unknown = plainInsert;\nconst lightInsert = (cursor: Cursor, node: Node) => (cursor.light === undefined ? plainInsert(cursor, node) : piece![7](cursor, node));\n\n/** Consumes exactly `text`, a static; anything else is a mismatch. Reads only. */\nconst expectText = (cursor: Cursor, text: string) => {\n while (text !== '') {\n passComments(cursor);\n const node = cursor.node;\n if (node === null || node.nodeType !== 3) return mismatch('text', node, __DEV__ && (() => `expected the text ${JSON.stringify(text)} and found ${describe(node)}`));\n const data = (node as Text).data;\n const take = Math.min(data.length - cursor.offset, text.length);\n if (data.slice(cursor.offset, cursor.offset + take) !== text.slice(0, take))\n return mismatch('text', node, __DEV__ && (() => `expected the text ${JSON.stringify(text)} and found ${JSON.stringify(data.slice(cursor.offset, cursor.offset + 30))}`));\n text = text.slice(take);\n cursor.offset += take;\n if (cursor.offset === data.length) {\n cursor.node = next(cursor, node);\n cursor.offset = 0;\n }\n }\n};\n\n/**\n * Claims a text node holding exactly `text`, a value — split out of the run it arrived in. `''` has no server\n * counterpart: a fresh empty text node is put in as its anchor.\n */\nconst claimText = (cursor: Cursor, text: string): Text => {\n if (text === '') {\n const anchor = cursor.parent.ownerDocument!.createTextNode('');\n insertHere(cursor, anchor);\n return anchor;\n }\n passComments(cursor);\n /** Split first: a text split runs no user code, so the walk may make it before the container is decided. */\n const node = boundary(cursor);\n if (node === null || node.nodeType !== 3)\n return mismatch('value', node, __DEV__ && (() => `expected a text node holding an interpolated value and found ${describe(node)}`));\n const data = (node as Text).data;\n if (!data.startsWith(text))\n return mismatch(\n 'value',\n node,\n __DEV__ && (() =>\n `an interpolated value reads ${JSON.stringify(text)} here and the markup says ${JSON.stringify(data.slice(0, text.length))} ` +\n `— a value that stringifies differently on the server (a Date? locale formatting?) disagrees here`\n ));\n /** The rest of a split run is the same light child's, so it stands next; otherwise the walk moves on. */\n cursor.node = data.length > text.length ? (node as Text).splitText(text.length) : next(cursor, node);\n return node as Text;\n};\n\n/** Claims the element named `name` at the cursor. Reads only. */\nconst claimElement = (cursor: Cursor, name: string): Element => {\n passComments(cursor);\n const node = cursor.offset > 0 ? null : cursor.node;\n if (node === null || node.nodeType !== 1 || (node as Element).localName !== name)\n return mismatch('element', cursor.offset > 0 ? cursor.node : node, __DEV__ && (() => `expected <${name}> and found ${cursor.offset > 0 ? describe(cursor.node) : describe(node)}`));\n cursor.node = next(cursor, node);\n return node as Element;\n};\n\n/** The walk has consumed everything the template describes here: whatever is left is a mismatch. */\nconst finish = (cursor: Cursor, top = false) => {\n passComments(cursor);\n if (cursor.offset > 0 || (cursor.node !== null && (cursor.light === undefined || cursor.at! < cursor.end!)))\n mismatch('extra', cursor.node, __DEV__ && (() =>\n !top && cursor.parent.nodeType === 1\n ? `<${(cursor.parent as Element).localName}> contains ${describe(cursor.node)}, which the template does not describe`\n : `${describe(cursor.node)} follows everything the template describes`\n ));\n};\n\n/* ── the walk ────────────────────────────────────────────────────────────────────────────────────── */\n\n/** One instance being adopted. */\n/**\n * One instance being adopted. `found`: for a template with an instance hook, its live elements in TEMPLATE pre-order —\n * the walk pairs each canonical element with its live one, the only place that knows both orders.\n */\ntype Adoption = { template: Template; bindings: unknown[]; values: unknown[]; plan: Map<Node, number[]>; found: Element[] | null };\n\n/** A filled slot's detached copy, from the piece — or `null`, and the element is claimed live. */\nconst copyAt = (canonical: Element, cursor: Cursor) => (served === null || fresh ? null : piece![2](canonical, cursor, served));\n\n/** A filled slot's copy, adopted: everything inside it is committed fresh, as the client renders a slot it keeps. */\nconst adoptCopy = (canonical: Element, copy: Element, into: Adoption, owned: number[] | undefined) => {\n fresh = true;\n try {\n adoptElement(canonical, copy, into, owned);\n } finally {\n fresh = false;\n }\n};\n\n/**\n * **A binding the server never wrote** (inside a filled slot's detached copy): set up exactly as a client render's clone\n * sets it — its node, and `''` for a child position (the empty text the template parsed it as) or UNSET — and queued, so\n * the renderer's own first commit does the rest, text or template alike.\n */\nconst freshCommit = (into: Adoption, i: number, node: Node) => {\n into.bindings[i * 2] = node;\n into.bindings[i * 2 + 1] = into.template.$K[i] === SOLE ? H[HANDOFF_UNSET] : '';\n later(COMMIT, into.template, into.bindings, i, into.template.$K[i], into.values);\n};\n\n/** Adopts the canonical siblings from `canonical` on, against the live cursor. */\nconst walk = (canonical: Node | null, cursor: Cursor, into: Adoption) => {\n for (let node = canonical; node !== null; node = node.nextSibling) {\n const type = node.nodeType;\n if (type === 8) continue;\n const owned = into.plan.get(node);\n if (type === 3) {\n if (owned !== undefined) adoptChild(into, owned[0], cursor);\n else expectText(cursor, (node as Text).data);\n } else {\n const copy = copyAt(node as Element, cursor);\n if (copy === null) adoptElement(node as Element, claimElement(cursor, (node as Element).localName), into, owned);\n else adoptCopy(node as Element, copy, into, owned);\n }\n }\n};\n\n/**\n * A control's state the user may have changed before the script arrived: recorded, never written — through `.name` or\n * `!name` alike. Only this: any other `!name` on a plain element is the client's to write (`!indeterminate` has no\n * markup at all), and on a COMPONENT `!name` is never recorded — it is delivered (the commit's `adoptProperty`). No\n * first-party component holds such state before its script runs (`vera-select`'s value lives in its internals and its\n * template has no native control); a choice made between a child's hydration and its parent's commit is overruled by\n * the parent's `!name`, which is what `!` means on every client render.\n */\nconst FORM_STATE = /^(?:value|checked|selected|open)$/;\n/** A value whose conversion to text runs no user code. */\nconst primitive = (value: unknown) => value === null || (typeof value !== 'object' && typeof value !== 'function');\n\n/**\n * **One element binding, adopted** — seeded now (DOM reads only), its commit QUEUED. The seedable kinds are ATTR and BOOLEAN — ONLY those: their server DOM can\n * be compared to the client value without running user code, and seeding anything else (an EVENT's handler, a\n * setter) would skip work the client must do. Seeded with the CLIENT value, and only on exact equality.\n */\nconst commitBinding = (into: Adoption, i: number, kind: number, live: Element) => {\n const { template, bindings, values } = into;\n const slot = i * 2;\n const name = template.$N[i];\n bindings[slot] = kind >= EVENT && kind <= ADOPT ? new H[HANDOFF_SLOT](live) : live;\n bindings[slot + 1] = H[HANDOFF_UNSET];\n const raw = values[i];\n /** Recorded, never written: a selection, a `!name`, a form control's value. */\n if (kind === SELECT || kind === SELECT_INDEX || ((kind === LIVE || kind === PROPERTY) && FORM_STATE.test(name))) {\n bindings[slot + 1] = raw;\n return;\n }\n /** An element-position value applying itself is told it is adopting — a form control the user typed in stands. */\n if ((kind === REF || kind === SELECT_REF) && raw != null && typeof (raw as Applies)._$apply$ === 'function') {\n bindings[slot + 1] = raw;\n later(APPLY, raw, live, bindings[slot]);\n return;\n }\n if (kind === ATTR) {\n const parts = template.$J[i];\n let text: string | null;\n if (parts === null) text = primitive(raw) ? (raw == null ? null : H[HANDOFF_TO_TEXT](raw)) : undefined!;\n else {\n text = parts[0];\n for (let p = 1; p < parts.length; p++) {\n const v = values[i + p - 1];\n if (!primitive(v)) {\n text = undefined!;\n break;\n }\n text += H[HANDOFF_TO_TEXT](v) + parts[p];\n }\n }\n if (text !== undefined) {\n const server = live.getAttribute(name);\n /**\n * Equal — both texts, or both absent: the client value itself is seeded, exactly what the base's commit would\n * have stored. A binding naming no URL then has NOTHING to commit (its commit would return at `value ===\n * committed`), so nothing is queued; a URL-bearing one always commits, so a `javascript:` value the server wrote\n * is refused through the base, as on a fresh render.\n */\n if (server === text) {\n bindings[slot + 1] = parts === null ? raw : text;\n if (template.$L[i] === 0) return;\n } else if (text === null) bindings[slot + 1] = server;\n /** ↑ The client writes nothing and the server wrote something: a non-UNSET seed so the base REMOVES it. */\n }\n } else if (kind === BOOLEAN && live.hasAttribute(name) === !!raw) {\n bindings[slot + 1] = raw;\n if (template.$L[i] === 0) return;\n }\n later(COMMIT, template, bindings, i, kind, values);\n};\n\n/**\n * An element's own bindings commit when the walk reaches it — before its content, in document pre-order, as a client\n * render commits them (queued) — then its content is adopted: as one SOLE value, or as canonical children.\n */\nconst adoptElement = (canonical: Element, live: Element, into: Adoption, owned: number[] | undefined) => {\n if (into.found !== null) into.found.push(live);\n let sole = -1;\n /** A content property (`.innerHTML`, `.textContent`…) writes this element's children itself — see below. */\n let content = false;\n if (owned !== undefined)\n for (const i of owned) {\n const kind = into.template.$K[i];\n if (kind === SOLE) sole = i;\n else {\n if ((kind === PROPERTY || kind === LIVE) && CONTENT_PROPERTY.test(into.template.$N[i])) content = true;\n commitBinding(into, i, kind, live);\n }\n }\n /**\n * A light host the template places content into: walked in light order (`hydrate-slots`), not as its DOM stands —\n * unless a binding writes a RUN directly among those children (a value that is not text): its anchors would have to\n * span the host's slots, so that host falls back as before until runs are adopted in the client's own shape.\n */\n const inner: Cursor = piece?.[5](live, canonical, into.plan, into.values) ?? { parent: live, node: live.firstChild, offset: 0 };\n if (sole >= 0) adoptSole(into, sole, live, inner);\n /**\n * Content the template does not describe that is not the template's to describe: a `<textarea>`'s server content is\n * its default value, a custom element's children — when the template writes none — are that component's OWN render,\n * which it adopts itself, and a content property's element holds what that binding writes.\n */ else if (\n canonical.firstChild === null &&\n (content || live.localName === 'textarea' || live.localName.includes('-') || live.hasAttribute('is'))\n )\n return;\n else walk(canonical.firstChild, inner, into);\n finish(inner);\n};\n\n/** A value is TEXT at a child position when the base would write it as text. */\nconst isText = (value: unknown) => value != null && typeof value !== 'object';\n\n\n/** A CHILD binding: text split to the value, or a part between two markers put in around what it adopts. */\nconst adoptChild = (into: Adoption, i: number, cursor: Cursor) => {\n if (fresh) {\n const placeholder = cursor.node!;\n cursor.node = placeholder.nextSibling;\n return freshCommit(into, i, placeholder);\n }\n const value = into.values[i];\n if (isText(value)) {\n into.bindings[i * 2] = claimText(cursor, textOf(value));\n into.bindings[i * 2 + 1] = value;\n return;\n }\n const part = new H[HANDOFF_CHILD_PART](cursor.parent.ownerDocument!.createComment(''), cursor.parent.ownerDocument!.createComment(''));\n insertHere(cursor, part.$s!);\n adoptValue(part, value, cursor);\n if (part.$e!.parentNode === null) insertHere(cursor, part.$e!);\n into.bindings[i * 2] = part;\n into.bindings[i * 2 + 1] = H[HANDOFF_UPGRADED];\n};\n\n/** A SOLE binding: its element's one text node, or a part that owns the element (no markers). */\nconst adoptSole = (into: Adoption, i: number, live: Element, inner: Cursor) => {\n const value = into.values[i];\n if (fresh) return freshCommit(into, i, live);\n if (isText(value)) {\n into.bindings[i * 2] = claimText(inner, textOf(value));\n into.bindings[i * 2 + 1] = value;\n return;\n }\n const part = new H[HANDOFF_CHILD_PART](null, null);\n part.$w = live;\n adoptValue(part, value, inner);\n into.bindings[i * 2] = part;\n into.bindings[i * 2 + 1] = H[HANDOFF_UPGRADED];\n};\n\n/** Adopts a template's instance at the cursor. */\nconst adoptInstance = (result: TemplateResult, cursor: Cursor): Instance => {\n let template = H[HANDOFF_GET_TEMPLATE](result);\n /** Adoption is in place: an extension resolving the template (namespaces) is asked with the LIVE parent. */\n if (template.$X) template = H[HANDOFF_RESOLVE](template, cursor.parent);\n const into: Adoption = {\n template,\n bindings: new Array(template.$K.length * 2 + (template.$X ? 1 : 0)),\n values: result.values,\n plan: planOf(template),\n found: template._$inst$ === undefined ? null : [],\n };\n const root = template.$R;\n const single = root.nodeType === 1;\n /** A single root is claimed here, not by the walk — so a `<slot>` at a template's root is asked here too. */\n const copy = single ? copyAt(root as Element, cursor) : null;\n const adopted = copy ?? (single ? claimElement(cursor, (root as Element).localName) : cursor.parent.ownerDocument!.createDocumentFragment());\n const instance = new H[HANDOFF_INSTANCE](template, result.strings, adopted, into.bindings);\n /**\n * **Its instance hook meets it before its bindings commit**, as a client instance does — told it was adopted, and\n * handed its elements in template order rather than a root to count from: an adopted root already holds what its\n * nested parts rendered, so counting would land on the wrong element (or, for a fragment, on none). Queued first;\n * the list is complete by the time the queue runs.\n */\n if (into.found !== null) later(HOOK, instance, into.found);\n if (copy !== null) adoptCopy(root as Element, copy, into, into.plan.get(root));\n else if (single) adoptElement(root as Element, adopted as Element, into, into.plan.get(root));\n else walk(root.firstChild, cursor, into);\n return instance;\n};\n\n\n/**\n * Adopts `value` into `part` — the same decisions, in the same order, as the server's serializer made them (templates,\n * lists, appliers, nodes, and every other object as its text), so a position adopts as exactly what was written.\n */\nconst adoptValue = (part: ChildPart, value: unknown, cursor: Cursor): void => {\n if (value == null) return;\n if (typeof value !== 'object') {\n part.$l = claimText(cursor, textOf(value));\n part.$v = value;\n part.$o = TEXT;\n return;\n }\n const held = (value as { $h?: TemplateResult }).$h;\n if (held !== undefined || isTemplateResult(value)) {\n part.$n = adoptInstance(held ?? (value as TemplateResult), cursor);\n part.$o = TEMPLATE;\n return;\n }\n /**\n * **A `'value'` handler is asked when the queue runs, with base precedence** (templates first, then the handlers).\n * The server never asks handlers — it wrote the value as the renderer's own types, or as its text — so the walk adopts\n * it as written; a handler that then claims it commits over the part, which clears what was adopted, and everything\n * queued for that content is skipped (`end`). Nothing claims: it stays adopted.\n */\n const handlers = registry.get('value') as ValueHandler[] | undefined;\n const at = handlers === undefined ? -1 : queue.length;\n if (handlers !== undefined) later(HANDLE, part, value, handlers, 0);\n adoptObject(part, value, cursor);\n if (at >= 0) queue[at + 4] = queue.length;\n};\n\n/** An object value that is not a template: a list, an applier, a node, or its text. */\nconst adoptObject = (part: ChildPart, value: object, cursor: Cursor) => {\n /** What a LIST is, as the renderer's `$p` decides it: `tests/renderer-list-twins.test.mjs` keeps the two equal. */\n if (Array.isArray(value) || (typeof (value as Iterable<unknown>)[Symbol.iterator] === 'function' && (value as Node).nodeType === undefined)) {\n /** Read once: a generator iterates once. */\n const list = Array.isArray(value) ? value : [...(value as Iterable<unknown>)];\n const items: Item[] = [];\n for (let i = 0; i < list.length; i++) items.push(adoptItem(list[i], cursor));\n part.$i = items;\n part.$o = LIST;\n return;\n }\n const applyChild = (value as { _$child$?: (part: ChildPart, previous: unknown, adopting: boolean) => unknown })._$child$;\n if (applyChild !== undefined) {\n /** What the server wrote for an applier cannot be delimited except as a SOLE element's whole content. */\n if (part.$w != null && cursor.node !== null) {\n part.$o = NODE;\n cursor.node = null;\n cursor.offset = 0;\n }\n if (part.$e !== null && part.$e.parentNode === null) insertHere(cursor, part.$e);\n part.$a = applyChild;\n part.$R = cursor.parent;\n later(CHILD, applyChild, value, part);\n return;\n }\n /**\n * A node the server could not have rendered: it goes where it belongs — QUEUED, since placing an element runs its\n * connected callback. A comment holds its place until then: inserted later at a captured `null`, it would land after\n * the anchors the walk appends meanwhile.\n */\n if ((value as Node).nodeType !== undefined) {\n const place = cursor.parent.ownerDocument!.createComment('');\n insertHere(cursor, place);\n later(INSERT, cursor.parent, value, place);\n part.$v = value;\n part.$o = NODE;\n return;\n }\n /** Every other object, as the server wrote it: its text, converted once. */\n part.$l = claimText(cursor, textOf(value));\n part.$v = value;\n part.$o = TEXT;\n};\n\n/** The root the template at this position will build — after an extension resolves it, as the base asks. */\nconst rootOf = (result: TemplateResult, cursor: Cursor) => {\n const template = H[HANDOFF_GET_TEMPLATE](result);\n return (template.$X ? H[HANDOFF_RESOLVE](template, cursor.parent) : template).$R;\n};\n\n/** Adopts one list item — the same shapes the base builds. */\nconst adoptItem = (value: unknown, cursor: Cursor): Item => {\n if (value !== null && typeof value === 'object' && isTemplateResult(value) && rootOf(value, cursor).nodeType === 1) {\n const instance = adoptInstance(value, cursor);\n instance.$k = (value as KeyedResult).key;\n return instance;\n }\n const part = new H[HANDOFF_CHILD_PART](cursor.parent.ownerDocument!.createComment(''), cursor.parent.ownerDocument!.createComment(''));\n insertHere(cursor, part.$s!);\n adoptValue(part, value, cursor);\n if (part.$e!.parentNode === null) insertHere(cursor, part.$e!);\n part.$k = (value as TemplateResult | null)?.key;\n return part;\n};\n\n/**\n * **A handler is asked with the part as a client render would hand it over — empty** — and the server's span stays\n * where it is meanwhile: a claim commits into the empty part and the span is removed after; no claim puts the adopted\n * state back. Copied whole (`{ ...part }`), so no field of the renderer's needs naming here — and so a handler that\n * declines must not write to the part (a field it ADDED would stay).\n */\nconst claimed = (part: ChildPart, value: unknown, handlers: ValueHandler[]) => {\n const was = { ...part };\n const span: Node[] = [];\n for (let node = part.$s === null ? part.$w!.firstChild : part.$s.nextSibling; node !== null && node !== part.$e; node = node.nextSibling)\n span.push(node);\n Object.assign(part, new H[HANDOFF_CHILD_PART](part.$s, part.$e), { $w: was.$w, $k: was.$k });\n for (let i = 0; i < handlers.length; i++) {\n const claim = handlers[i](part, value, was);\n /** Kept: the handler took ownership of what the base adopted — the adopted state comes back, its queue still runs. */\n if (claim === ADOPTED) break;\n if (claim) {\n for (const node of span) node.parentNode?.removeChild(node);\n return true;\n }\n }\n Object.assign(part, was);\n return false;\n};\n\n/**\n * **The queue runs** — once the whole container matched, inside the renderer's render bracket, in walk order. A handler\n * that claims its value skips everything queued for the content it replaced.\n */\nconst run = (from: number, to: number) => {\n const q = queue;\n for (let k = from; k < to; k += 6) {\n const op = q[k];\n if (op === COMMIT) H[HANDOFF_COMMIT](q[k + 1] as Template, q[k + 2] as unknown[], q[k + 3] as number, q[k + 4] as number, q[k + 5] as unknown[]);\n else if (op === APPLY) {\n H[HANDOFF_REMOVAL_WORK]();\n (q[k + 1] as Applies)._$apply$(q[k + 2] as Element, q[k + 3] as Slot, untracked, true);\n } else if (op === HOOK) H[HANDOFF_HOOK_UP](q[k + 1] as Instance, q[k + 2] as Element[], true);\n else if (op === CHILD) {\n const applyChild = q[k + 1] as (part: ChildPart, previous: unknown, adopting: boolean) => unknown;\n const part = q[k + 3] as ChildPart;\n if ((applyChild as { _$detach$?: unknown })._$detach$ !== undefined) H[HANDOFF_REMOVAL_WORK]();\n part.$z = applyChild.call(q[k + 2], part, undefined, true);\n } else if (op === HANDLE) {\n if (claimed(q[k + 1] as ChildPart, q[k + 2], q[k + 3] as ValueHandler[])) k = (q[k + 4] as number) - 6;\n } else {\n (q[k + 1] as Node).insertBefore(q[k + 2] as Node, q[k + 3] as Node);\n (q[k + 3] as ChildNode).remove();\n }\n }\n};\n\n/** A served light host — the piece reads the rest. */\nconst LIGHT_ATTR = 'data-vm-light';\n\n/* ── the container ───────────────────────────────────────────────────────────────────────────────── */\n\n/** A container's own SSR stylesheets lead its content and are not part of any template. */\nconst isSheet = (node: Node | null) => node !== null && node.nodeType === 1 && (node as Element).hasAttribute('data-vm-sheet');\n\n/** Clears a container after a mismatch — every child but its SSR stylesheets. */\nconst clearPreservingStyles = (container: Node) => {\n for (let node = container.firstChild; node !== null; ) {\n const next: ChildNode | null = node.nextSibling;\n if (!isSheet(node)) container.removeChild(node);\n node = next;\n }\n};\n\n/**\n * **A container's first render, with children already there** — the renderer asks (the hook set at `HANDOFF_ADOPTER`). Adopts them and answers\n * true, or answers false having cleared them, and the renderer renders fresh.\n */\nconst adopt = (result: unknown, container: Node): boolean => {\n if (result === null || typeof result !== 'object' || !isTemplateResult(result as object)) return false;\n /**\n * **One walk's state per adoption.** The queue runs user code — a setter that renders into its own element, a component\n * set up synchronously — and that can adopt ANOTHER container in the middle of this one: its walk gets its own state,\n * and this one's is restored when it returns. Shared, a nested walk reset this one's state underneath it.\n */\n const from = queue.length;\n const saved = [why, kind, served] as const;\n piece = registry._$hydrateSlots$;\n if (piece !== undefined) {\n next = piece[6];\n insertHere = lightInsert;\n }\n try {\n return adoptContainer(result as TemplateResult, container, from);\n } finally {\n /** Run or dropped, this adoption's range goes — a throw included. */\n queue.length = from;\n [why, kind, served] = saved;\n }\n};\n\nconst adoptContainer = (result: TemplateResult, container: Node, from: number): boolean => {\n const doc = container.ownerDocument ?? (container as Document);\n served = null;\n /** The root range is bounded before the walk: an insert at the root during it (a client-only node) needs the end. */\n let start: Comment | null = null;\n let end: Comment | null = null;\n let part: ChildPart;\n const host = container.nodeType === 1 ? (container as Element) : null;\n const spec = host === null ? null : host.getAttribute(LIGHT_ATTR);\n /**\n * **A light component the server did not render is rendered, not hydrated** — and keeps its children. With slots\n * wired, the server states the light tree on EVERY component host it renders, so a custom element without that\n * statement is client-made (by a template, or `createElement`): its children are light content, not server output, so\n * the walk declines without clearing them, and slots distributes them. (So slots must be wired on both sides: a host a\n * server rendered without it carries no statement, and is rendered on the client.)\n */\n if (spec === null && registry._$capture$ !== undefined && host?.localName.includes('-')) return false;\n try {\n /** A statement with runs needs the piece; one with none (`N:`) states no light content — its slots walk as elements. */\n if (spec?.endsWith(':') && piece === undefined) host!.removeAttribute(LIGHT_ATTR);\n else if (spec !== null) {\n /** No piece to read it: thrown before anything is touched, so the server's markup stands exactly as served. */\n if (piece === undefined) throw new Error(diagnostic('hydration', 'no hydrateSlots', 'hydration-slots', __DEV__ && PROSE['hydration-slots']()));\n if (piece[0] !== PROTOCOL) mismatch('protocol', container, () => `hydrateSlots protocol ${piece![0]}, expected ${PROTOCOL}`);\n served = piece[1](container as Element, mismatch);\n }\n let first: Node | null = container.firstChild;\n while (isSheet(first) || (first !== null && first === served?.carrier)) first = first!.nextSibling;\n /**\n * **Stylesheets alone are not server output** — a client-made shadow root holds one before its first render whenever\n * `styles` writes a `<style>` (string styles, or no `adoptedStyleSheets`). Nothing to adopt: rendered fresh after\n * them, without a fallback warning that would blame the server for a page it never rendered.\n */\n if (first === null && served === null) return false;\n start = doc.createComment('');\n container.insertBefore(start, first);\n end = container.appendChild(doc.createComment(''));\n part = new H[HANDOFF_CHILD_PART](start, end);\n const cursor: Cursor = { parent: container, node: first, offset: 0 };\n adoptValue(part, result, cursor);\n finish(cursor, true);\n piece?.[3](served);\n } catch (error) {\n start?.remove();\n end?.remove();\n if (error !== MISMATCH) throw error;\n /** A served host keeps its light content: captured into holding before the clear, distributed by the fresh render. */\n piece?.[4](served);\n /** Every build names the kind and the first node that disagreed; development adds the whole story, production the link. */\n warn(kind, diagnostic('hydration', why, 'hydration-fallback', __DEV__ && PROSE['hydration-fallback'](opening(result))), container);\n /** The queue is dropped unrun; the clear takes the walk's text splits and comments with the server's nodes. */\n clearPreservingStyles(container);\n return false;\n }\n /** Matched: the queue runs, inside the renderer's own render bracket (a stand-in part) — refs at its end, as always. */\n const to = queue.length;\n H[HANDOFF_COMMIT_AS](container, { $p: () => run(from, to) } as unknown as ChildPart, undefined, container);\n H[HANDOFF_ROOTS].set(container, part);\n return true;\n};\n\n/** `wire([renderer, hydration])` — after the renderer, whose `connect` sets the hand-off. */\nexport const hydration = (given: Registry) => {\n const handoff = given.$H;\n if (handoff === undefined) {\n console.warn(diagnostic('hydration', 'no renderer', 'hydration-no-renderer', __DEV__ && PROSE['hydration-no-renderer']()));\n return;\n }\n /**\n * **Another release's renderer: the page still works, rendered fresh** (Brian, 2026-10-02). The protocol and adopter\n * positions are the hand-off's FROZEN pair — the same in every protocol — so even a mismatched renderer can be asked to clear a\n * container's server markup before its first render; nothing else of the hand-off is read. Without that, the base\n * renderer keeps what a container holds and the server's markup would stand beside the client's.\n */\n if (handoff[HANDOFF_PROTOCOL] !== PROTOCOL) {\n const subject = `protocol ${handoff[HANDOFF_PROTOCOL]}, expected ${PROTOCOL}`;\n warn('protocol', diagnostic('hydration', subject, 'hydration-protocol', __DEV__ && PROSE['hydration-protocol']()));\n handoff[HANDOFF_ADOPTER]((_result, container) => {\n clearPreservingStyles(container);\n return false;\n });\n return;\n }\n H = handoff;\n registry = given;\n /** Slots, wired after or before this module, defers a served host's capture to the adoption (`_$capture$`). */\n given._$hydrating$ = true;\n untracked = given.$t ?? (((fn: (...args: unknown[]) => unknown, ...args: unknown[]) => fn(...args)) as Untracked);\n handoff[HANDOFF_ADOPTER](adopt);\n};\n","/**\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"],"names":["diagnostic","inArea","bySubject","withCode","andProse","CONTENT_PROPERTY","H","registry","piece","untracked","served","fresh","causesThisPass","Set","warn","cause","message","container","has","size","queueMicrotask","clear","add","undefined","console","queue","later","op","a","b","c","d","e","push","why","MISMATCH","kind","mismatch","at","reason","describe","node","nodeType","localName","JSON","stringify","data","slice","nodeName","textOf","value","isTemplateResult","strings","plans","WeakMap","planOf","template","plan","get","set","Map","kinds","$K","i","length","$R","step","$P","firstChild","hops","nextSibling","owned","next","_cursor","passComments","cursor","offset","boundary","splitText","plainInsert","parent","insertBefore","insertHere","lightInsert","light","expectText","text","take","Math","min","claimText","anchor","ownerDocument","createTextNode","startsWith","claimElement","name","finish","top","end","copyAt","canonical","adoptCopy","copy","into","adoptElement","freshCommit","bindings","values","walk","type","adoptChild","FORM_STATE","primitive","commitBinding","live","slot","$N","raw","test","_$apply$","parts","$J","p","v","server","getAttribute","$L","hasAttribute","found","sole","content","inner","adoptSole","includes","isText","placeholder","part","createComment","$s","adoptValue","$e","parentNode","$w","adoptInstance","result","$X","Array","_$inst$","root","single","adopted","createDocumentFragment","instance","$l","$v","$o","held","$h","$n","handlers","adoptObject","isArray","Symbol","iterator","list","items","adoptItem","$i","applyChild","_$child$","$a","place","rootOf","$k","key","claimed","was","span","Object","assign","claim","removeChild","LIGHT_ATTR","isSheet","clearPreservingStyles","adopt","from","saved","_$hydrateSlots$","adoptContainer","doc","start","host","spec","_$capture$","endsWith","removeAttribute","Error","first","carrier","appendChild","error","remove","to","$p","q","k","_$detach$","$z","call","run","hydration","given","handoff","$H","_result","_$hydrating$","$t","fn","args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c,CACrB,MAAM8I,EAAaqC,EAAEC,EAAI,GACnBtE,EAAOqE,EAAEC,EAAI,QACuCxL,IAArDkJ,EAAuCuC,WAAyB1M,ECnnBvC,MDonB9BmI,EAAKwE,GAAKxC,EAAWyC,KAAKJ,EAAEC,EAAI,GAAItE,OAAMlH,GAAW,EACvD,MA5hBW,IA4hBAI,EACLqJ,EAAQ8B,EAAEC,EAAI,GAAiBD,EAAEC,EAAI,GAAID,EAAEC,EAAI,MAAuBA,EAAKD,EAAEC,EAAI,GAAgB,IAEpGD,EAAEC,EAAI,GAAY9H,aAAa6H,EAAEC,EAAI,GAAYD,EAAEC,EAAI,IACvDD,EAAEC,EAAI,GAAiBJ,SAE5B,GAuG4CQ,CAAIxB,EAAMiB,SAA+BrL,EAAWN,GAChGX,ECruB2B,IDquBVqD,IAAI1C,EAAWwH,IACzB,CAAI,EAIA2E,EAAaC,IACxB,MAAMC,EAAUD,EAAME,GACtB,QAAgBhM,IAAZ+L,EAAJ,CAUA,GCrwBsB,IDqwBlBA,ECnwB0B,GD0wB5B,OALAxM,EAAK,WAAYd,EAAW,YADZ,YAAYsN,ECpwBA,iBDqwBsB,4BAClDA,ECpwB2B,IDowBF,CAACE,EAASvM,KACjCwK,EAAsBxK,IACf,KAIXX,EAAIgN,EACJ/M,EAAW8M,EAEXA,EAAMI,cAAe,EACrBhN,EAAY4M,EAAMK,MAASC,KAAwCC,IAAoBD,KAAMC,IAC7FN,EC/wB6B,GD+wBJ5B,EArBzB,MAFElK,QAAQV,KAAKd,EAAW,YAAa,cAAe,yBAuBvB"}
@@ -1,2 +1,2 @@
1
- const n=(n,o,e,l,t)=>{const f=o.length,s=new Map;for(const n of e)null!==n&&s.set(n.$k,n);const i=new Array(f);for(let e=0;e<f;e++){const l=s.get(o[e].key);void 0!==l&&(n.$u(l,o[e]),i[e]=l,s.delete(o[e].key))}for(const o of s.values())n.$d(o);const r=new Map;for(let o=f-1;o>=0;o--){const e=i[o];if(void 0===e)continue;const l=n.$f(e).parentNode;if(null===l)continue;const t=r.get(l);void 0!==t&&n.$m(e,t,l),r.set(l,n.$f(e))}for(let e=0;e<f;e++){if(void 0!==i[e])continue;const s=n.$c(o[e],l,t),r=e+1<f?i[e+1]:void 0;if(void 0!==r){const o=n.$f(r);null!==o.parentNode&&o.parentNode!==l&&n.$m(s,o,o.parentNode)}i[e]=s}return i},o=(o,e,l,t,f)=>{const s=e.length;if(l.length===s){let n=0;for(;n<s&&l[n].$k===e[n].key;)o.$u(l[n],e[n]),n++;if(n===s)return l}for(let s=0;s<l.length;s++)if(o.$f(l[s]).parentNode!==t)return n(o,e,l,t,f);const i=l,r=new Array(s);for(let n=0;n<s;n++)r[n]=e[n].key;const c=new Array(s);let u,d,v=0,a=i.length-1,w=0,p=s-1;const M=n=>n<s&&void 0!==c[n]?o.$f(c[n]):f;for(;v<=a&&w<=p;)if(null===i[v])v++;else if(null===i[a])a--;else if(i[v].$k===r[w])o.$u(c[w]=i[v],e[w]),v++,w++;else if(i[a].$k===r[p])o.$u(c[p]=i[a],e[p]),a--,p--;else if(i[v].$k===r[p]){const n=i[v];o.$m(n,M(p+1),t),o.$u(n,e[p]),c[p]=n,v++,p--}else if(i[a].$k===r[w]){const n=i[a];o.$m(n,o.$f(i[v]),t),o.$u(n,e[w]),c[w]=n,a--,w++}else{if(void 0===u){u=new Map;for(let n=w;n<=p;n++)u.set(r[n],n);d=new Map;for(let n=v;n<=a;n++)null!==i[n]&&d.set(i[n].$k,n)}if(u.has(i[v].$k))if(u.has(i[a].$k)){const n=d.get(r[w]),l=void 0===n||n<v||n>a?null:i[n];if(null===l)c[w]=o.$c(e[w],t,o.$f(i[v]));else{const f=l;o.$m(f,o.$f(i[v]),t),o.$u(f,e[w]),c[w]=f,i[n]=null}w++}else o.$d(i[a]),a--;else o.$d(i[v]),v++}if(w<p){const n=M(p+1),l=t.ownerDocument.createDocumentFragment();for(;w<=p;)c[w]=o.$c(e[w],l,null),w++;t.insertBefore(l,n)}else w===p&&(c[w]=o.$c(e[w],t,M(p+1)),w++);for(;v<=a;){const n=i[v++];null!==n&&o.$d(n)}return c},e=(n,e)=>(e.key=n,e.$r=o,e);export{e as keyed};
1
+ const t=(t,i,o,s,n)=>{const e=i.length,r=t=>i[t]?.key;let h=0,c=o.length-1,f=e-1;for(;h<=c&&h<=f&&o[h].$k===r(h);){const s=i[h];void 0!==s&&s===o[h].$j||(o[h]=t.$u(o[h],s)),h++}for(;h<=c&&h<=f&&o[c].$k===r(f);){const s=i[f];void 0!==s&&s===o[c].$j||(o[c]=t.$u(o[c],s)),c--,f--}if(h>f){for(let i=h;i<=c;i++)t.$d(o[i]);return o.splice(h,c-h+1),o}const l=h<o.length?t.$f(o[h]):n,d=[];if(h>c){for(let o=h;o<=f;o++)d.push(t.$c(i[o],s,l));return o.slice(0,h).concat(d,o.slice(h))}const u=o,v=o.slice(0,h).concat(new Array(f-h+1),o.slice(c+1)),a=i=>i<e?t.$f(v[i]):n;let w,y,p=h,b=h;for(;p<=c&&b<=f;){const o=u[p],n=u[c];if(null===o)p++;else if(null===n)c--;else if(o.$k===r(b))v[b]=t.$u(o,i[b]),p++,b++;else if(n.$k===r(f))v[f]=t.$u(n,i[f]),c--,f--;else if(o.$k===r(f))t.$m(o,a(f+1),s),v[f]=t.$u(o,i[f]),p++,f--;else if(n.$k===r(b))t.$m(n,t.$f(o),s),v[b]=t.$u(n,i[b]),c--,b++;else{if(void 0===w){w=new Map;for(let t=p;t<=c;t++)null!==u[t]&&w.set(u[t].$k,t);y=new Set;for(let t=b;t<=f;t++)y.add(r(t))}if(!y.has(o.$k)){t.$d(o),u[p++]=null;continue}if(!y.has(n.$k)){t.$d(n),u[c--]=null;continue}const e=w.get(r(b)),h=void 0===e||e<p||e>c?null:u[e];null===h?v[b]=t.$c(i[b],s,t.$f(o)):(t.$m(h,t.$f(o),s),v[b]=t.$u(h,i[b]),u[e]=null),b++}}const j=a(f+1);for(;b<=f;b++)v[b]=t.$c(i[b],s,j);for(;p<=c;p++)null!==u[p]&&t.$d(u[p]);return v},i=(i,o)=>(o.key=i,o.$r=t,o);let o,s,n,e,r,h,c,f,l,d=0;function u(t,i){y.call(e(this),t,i)}let v=0;const a=i=>{const o=i.row(i.item);return null===o||"object"!=typeof o||(o.key=i.key,o.$r=t,o._$same$=1),o};class w{constructor(t,i,o,s,n,e,r){this._$g$=1,this._$x$=!1,this._$h$=void 0,this.localName="each-row",this.h=void 0,this.part=t,this.list=e,this.result=null,this.inst=void 0,this.key=i,this.item=o,this.src=r,this.row=s,this.seen=n}get isConnected(){const t=this.inst?.$R;return void 0===t||t.isConnected}get ownerDocument(){return this.inst?.$R?.ownerDocument??document}}function y(t,i){const o=this.list;if(!i&&void 0!==o&&o.mapped!==o.parent.$runs)return k(o);const s=a(this);if(this.result=s,0!==d&&h(this.h),!i){if(void 0!==o&&o.committed!==o.parent.$runs)return o.parent.$n();if(void 0!==this.inst){const t=this.part,i=t.$u(this.inst,s);if(i!==this.inst){const o=t.$i;o[o.indexOf(this.inst)]=i,this.inst=i}}}}const p=(t,i,o,n,e,r)=>{const h=new w(t,i,o,n,v,e,r);return h.h=s(h,u),h.h.$n(void 0,!0),h},b=t=>{t._$g$++,n(t.h),0!==d&&h(t.h,!0),void 0!==t._$h$&&c(t)};class j{constructor(t,i){this._$g$=1,this._$x$=!1,this._$h$=void 0,this.localName="each-list",this.h=void 0,this.parent=t,this.owner=i,this.fn=void 0,this.items=[],this.cache=new Map,this.recs=[],this.values=[],this.part=void 0,this.mapped=0,this.committed=-1,this.all=!0,this.ident=!1,this.dead=!1,this.raw=void 0,this.$r=-1,this.$h=void 0}$d(){k(this)}get isConnected(){return!1!==this.owner.isConnected}get ownerDocument(){return this.owner.ownerDocument??document}}const m=Symbol();let M;const g=new WeakMap;let A;const k=t=>{if(!t.dead){t.dead=!0,e(t.parent)instanceof w&&d--;for(let i=0;i<t.recs.length;i++)b(t.recs[i]);t.recs=[],t.cache.clear(),t.values=[],t.fn=void 0,t.items=[],t.part=void 0,t._$g$++,c(t)}},S=(t,i)=>{const o=M;M=t.values;try{i.$p(t.values)}finally{M=o}t.part=i,t.committed=t.parent.$runs;const s=i.$i,n=t.recs;if(void 0!==s)for(let t=0;t<n.length;t++)n[t].inst=s[t],n[t].part=i},C=(t,i)=>t.src===i&&(t.key===i||null!==i&&"object"==typeof i&&i.id===t.key);function D(){const t=this.all;if(this.all=!1,!t&&this.mapped!==this.parent.$runs)return k(this);const i=++v,o=this.fn,s=this.cache,n=this.recs,e=this.items.length,r=new Array(e),h=new Array(e);let c=0,d=!1,u=0,a=0;const w=t?void 0:l?.(this.items);if(void 0!==w){const t=n.length,o=e<t?e:t;for(;u<o&&C(n[u],w[u]);)u++;for(;a<o-u&&C(n[t-1-a],w[e-1-a]);)a++;for(let t=0;t<u;t++){const o=n[t];o.seen=i,r[t]=o,h[t]=o.result}for(let o=1;o<=a;o++){const s=n[t-o];s.seen=i,r[e-o]=s,h[e-o]=s.result}c=u}const y=(e,f)=>{if(d)return;const l=void 0===w?void 0:n[c];let u,v;if(void 0!==l&&l.seen!==i&&C(l,e)?(u=l,v=l.key):(v=this.ident||!Object.hasOwn(e,"id")?e:e.id,u=s.get(v)),void 0!==u&&u.seen===i){if(!this.ident)return this.ident=!0,void(d=!0);u=p(void 0,{},f,o,this,e)}else void 0===u?(u=p(void 0,v,f,o,this,e),s.set(v,u)):(t||u.item!==f)&&(u.item=f,u.row=o,u.h.$n(void 0,!0));u.seen=i,u.src=e,r[c]=u,h[c++]=u.result};if(!f(this.items,y,u,e-a))for(let t=0;t<e;t++){const i=this.items[t];y(i,i)}if(d){for(const t of s.values())b(t);if(s.clear(),this.recs=[],this.all=!0,D.call(this),t)return;this.committed===this.parent.$runs&&void 0!==this.part?S(this,this.part):this.parent.$n()}else{for(let t=u;t<n.length-a;t++){const o=n[t];o.seen!==i&&(s.get(o.key)===o&&s.delete(o.key),b(o))}this.recs=r,h[m]=this,this.values=h,t||(this.committed===this.parent.$runs&&void 0!==this.part?S(this,this.part):this.parent.$n())}}const W=(t,i,s,n,h,c)=>{let f=g.get(n);if(void 0===f?g.set(n,f={v:n.$runs,n:0,lists:[],occ:new Map,byRaw:new WeakMap}):f.v!==n.$runs&&(f.v=n.$runs,f.n=0,f.occ.clear()),"function"!=typeof s||s.length>1)return f.n++,c.call(t,s);const l=f.occ.get(i)??0;f.occ.set(i,l+1);const u=f.byRaw.get(i);let v=u?.[l];if(void 0===v||0===v||!v.dead&&v.mapped!==n.$runs||(v=void 0),void 0===v&&void 0===u){const t=f.lists[f.n];void 0===t||0===t||t.dead||t.mapped===n.$runs||f.occ.has(t.raw)||(v=t)}const a=f,y=t=>{a.lists[a.n]=t;let o=a.byRaw.get(i);void 0===o&&a.byRaw.set(i,o=[]),o[l]=t,0!==t&&(t.raw=i)};if(0===v)return f.n++,c.call(t,s);if(void 0===v||v.dead){if(0===i.length)return f.n++,c.call(t,s);if(null===i[0]||"object"!=typeof i[0])return y(0),f.n++,c.call(t,s)}if(void 0===v){const i=A((()=>s(t[0])));if(null===i||"object"!=typeof i||void 0===i.strings)return y(0),f.n++,c.call(t,s)}if(void 0===v||v.dead){const t=new j(n,h);t.h=o(t,(()=>D.call(t))),e(n)instanceof w&&d++,v=t}return y(v),f.n++,r(n,v),v.fn=s,v.items=t,v.mapped=n.$runs,v.all=!0,v.h.$n(void 0,!0),v.values},x=(t,i,o)=>{if(null===i||"object"!=typeof i)return!1;if(Array.isArray(i)){const s=i[m];if(void 0===s||i===M)return!1;const n=o?.$i;if(void 0!==n&&n.length===s.recs.length){s.part=t,s.committed=s.parent.$runs;for(let i=0;i<n.length;i++)s.recs[i].inst=n[i],s.recs[i].part=t;return 2}return S(s,t),!0}return!1};let E,O;const R=t=>{if(void 0===E||void 0===O)throw new Error("createSelector: https://verajs.dev/e/selector-not-wired");const i={},o=E;let s=i;const n=O({callback:()=>{const n=t();if(n===s)return;const e=s;s=n,e!==i&&o.trigger(i,e,!1,!0),o.trigger(i,n,!0,!1)},priority:0});return n?.(void 0,!0),t=>(o.track(i,t),s===t)},$=(t,i)=>{o=t.$q,s=t.$qb,n=t.$zh,e=t.$ow,r=t.$own,h=t.$so,t.$M=W,c=t.$z,A=t.$t,E=t.$k,O=t.$s?.[2],f=t.$w,l=t.$wr,i({on:"value",fn:x,priority:50})};export{R as createSelector,i as keyed,$ as lists};
2
2
  //# sourceMappingURL=vera-renderer-keyed.min.js.map