@verajs/renderer 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -6
- package/dist/development/vera-renderer-elements.js.map +1 -1
- package/dist/development/vera-renderer-hydrate-slots.js +1 -1
- package/dist/development/vera-renderer-hydrate-slots.js.map +1 -1
- package/dist/development/vera-renderer-hydration.d.ts.map +1 -1
- package/dist/development/vera-renderer-hydration.js +42 -4
- package/dist/development/vera-renderer-hydration.js.map +1 -1
- package/dist/development/vera-renderer-portal.js +1 -1
- package/dist/development/vera-renderer-portal.js.map +1 -1
- package/dist/development/vera-renderer-profiler.d.ts.map +1 -1
- package/dist/development/vera-renderer-profiler.js +304 -97
- package/dist/development/vera-renderer-profiler.js.map +1 -1
- package/dist/development/vera-renderer-slots.js +1 -1
- package/dist/development/vera-renderer-slots.js.map +1 -1
- package/dist/development/vera-renderer-spread.js.map +1 -1
- package/dist/development/vera-renderer-tag.js.map +1 -1
- package/dist/development/vera-renderer.d.ts.map +1 -1
- package/dist/development/vera-renderer.js +304 -97
- package/dist/development/vera-renderer.js.map +1 -1
- package/dist/vera-renderer-elements.min.js.map +1 -1
- package/dist/vera-renderer-hydrate-slots.min.js +1 -1
- package/dist/vera-renderer-hydrate-slots.min.js.map +1 -1
- package/dist/vera-renderer-hydration.min.js +1 -1
- package/dist/vera-renderer-hydration.min.js.map +1 -1
- package/dist/vera-renderer-portal.min.js +1 -1
- package/dist/vera-renderer-portal.min.js.map +1 -1
- package/dist/vera-renderer-slots.min.js +1 -1
- package/dist/vera-renderer-slots.min.js.map +1 -1
- package/dist/vera-renderer-spread.min.js.map +1 -1
- package/dist/vera-renderer-tag.min.js.map +1 -1
- package/dist/vera-renderer.min.js +1 -1
- package/dist/vera-renderer.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vera-renderer.min.js","sources":["../../shared-utils/src/adopt-property.ts","../../shared-utils/src/markup-grammar.ts","../../shared-utils/src/utils.ts","../src/kinds.ts","../src/renderer.ts"],"sourcesContent":["import type { PropertyHost } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * **Delivering a bound property to a custom element that may not receive it yet** — the one home of the\n * rule `@verajs/renderer` (a `.prop` template binding) and `@verajs/renderer/spread` (a `.prop` bag key)\n * both apply. They ship as separate bundles that cannot import each other, so this package, inlined into\n * each, is where the rule lives once; before, each carried a full copy and a fix had to visit both.\n *\n * Returns where the binding stands after this write:\n * - `0` — still adopting: nothing received the value, so it was recorded in the element-carried\n * `_$props$`, which core's `init()` drains over whatever the class's field initializers wrote at\n * upgrade. Call again on the next write.\n * - `1` — received (a setter anywhere on the chain, an initialized component's `_$adopt$`, or an element\n * that is already upgraded): later writes are plain property writes.\n * - `2` — refused: a getter with no setter, where the plain write would throw. Later writes do nothing.\n *\n * `_$props$` and `_$adopt$` are `$`-named because they cross bundle boundaries (renderer, spread, core)\n * and must survive property mangling.\n *\n * **`_$adopt$` is a BRAND, not just a slot:** present means \"core has initialized this component\", which is what routes\n * a delivery to the live accessor (`1`) instead of the `_$props$` record. Do not move it to a class's PROTOTYPE\n * (2026-10-10): every instance would carry it BEFORE `init`, and a delivery to an upgraded-but-uninitialized element\n * would be adopted into a store that does not exist yet. It is ONE shared function written onto each element at `init`,\n * called with the element as `this` (`adopt.call(element, …)`) — 2026-10-11: the closure it replaced was free in\n * optimized code (measured) but cost Chrome's interpreted first render one allocation per component.\n */\n\n/** Development only: getter-only names already reported, per element — a `!name` re-asserts on every render. */\nlet refused: WeakMap<PropertyHost, Set<string>> | undefined;\n\nexport const adoptProperty = (element: PropertyHost, name: string, value: unknown): 0 | 1 | 2 => {\n /**\n * **`__proto__` is refused HERE, at the receiver** (2026-11-10): `element.__proto__ = v` replaces the element's\n * prototype, and an own `__proto__` key reaches a bag through `JSON.parse`. This is the choke point every delivery\n * passes; the renderer's template binding and spread's bag key refuse it first, with a development warning naming\n * where it was written (their second addresses: renderer.ts `proto-binding`, spread.ts refusal 3).\n */\n if (name === '__proto__') return 2;\n const adopt = element._$adopt$ as ((key: string, value: unknown) => void) | undefined;\n /** The walk comes first: what it finds decides whether writing is even legal. */\n for (let carrier: object | null = element; carrier !== null; carrier = Object.getPrototypeOf(carrier)) {\n const desc = Object.getOwnPropertyDescriptor(carrier, name);\n if (desc === undefined) continue;\n if (desc.set !== undefined) {\n element[name] = value;\n return 1;\n }\n if (desc.get !== undefined) {\n if (adopt !== undefined) adopt.call(element, name, value);\n else if (__DEV__) {\n const names = (refused ??= new WeakMap()).get(element) ?? new Set<string>();\n refused.set(element, names);\n if (!names.has(name)) {\n names.add(name);\n console.warn(diagnostic('renderer', `<${element.localName}>`, 'getter-only-prop', __DEV__ && SHARED.getterOnlyProp(name)));\n }\n }\n return 2;\n }\n break; // a data property: an own field, or an inherited default — nothing receives it\n }\n element[name] = value;\n if (adopt !== undefined) {\n adopt.call(element, name, value);\n return 1;\n }\n const record = (element._$props$ ??= {}) as Record<string, unknown>;\n const first = __DEV__ && !Object.hasOwn(record, name);\n record[name] = value;\n /** Upgrade is read off the PROTOTYPE — a bag key named `constructor` can shadow `el.constructor`. The realm is the element's. */\n const view = element.ownerDocument.defaultView as unknown as {\n HTMLElement: { prototype: object };\n customElements: CustomElementRegistry;\n } | null;\n const upgraded = view === null || Object.getPrototypeOf(element) !== view.HTMLElement.prototype;\n /** Development only: an element that never drains still loses the value at upgrade — told apart by ownership. */\n if (__DEV__ && view !== null && !upgraded && first) {\n const tag = element.localName;\n view.customElements.whenDefined(tag).then(() => {\n let owned = false;\n for (let carrier: object | null = element; carrier !== null; carrier = Object.getPrototypeOf(carrier)) {\n const desc = Object.getOwnPropertyDescriptor(carrier, name);\n if (desc === undefined) continue;\n owned = desc.get !== undefined || desc.set !== undefined;\n break;\n }\n if (!owned && element[name] !== record[name])\n console.warn(diagnostic('renderer', `<${tag}>`, 'upgrade-clobber', __DEV__ && SHARED.upgradeClobber(name)));\n });\n }\n return upgraded ? 1 : 0;\n};\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 ` ` 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","import type { HandlerHolder, Untracked } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * Get an object's type.\n *\n * @param obj The object\n * @return The type\n */\nexport const getType = (obj: unknown) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();\n\n/**\n * Weak collections need their per-key dependencies stored weakly, or tracking `weakMap.get(obj)`\n * holds `obj` and defeats the whole point of the type. Checked by type string rather than\n * `instanceof`, which fails across realms (iframes, `vm`).\n */\n/**\n * A WeakMap or WeakSet (or WeakRef) — read from `Symbol.toStringTag`, the tag `Object.prototype.toString` itself reads, so\n * the answer is the same (another realm's collections included) without building and lower-casing a string on every first\n * tracked read of every object.\n */\nexport const isWeakCollection = (item: unknown) => {\n const tag = (item as { [Symbol.toStringTag]?: unknown } | null)?.[Symbol.toStringTag];\n return typeof tag === 'string' && (tag[0] === 'W' || tag[0] === 'w');\n};\n\n/**\n * Remove a trailing slash from an url if its not root url (`/`).\n *\n * @param str String to remove trailing slash from\n */\nexport const stripTrailingSlash = (str: string) => (str !== '/' && str.endsWith('/') ? str.slice(0, -1) : str);\n\n/**\n * **Reports an error nothing else handled, the way the platform reports one.** `reportError` fires\n * the window's `error` event — what `window.onerror`, error trackers and test runners listen for —\n * without unwinding the caller, so one failing hook or ref never stops its siblings. A bare\n * `console.error` reached none of those: a component could stop updating while every page-error\n * listener stayed silent. Off-browser (Node has no `reportError`) the console is all there is.\n * `line` is the framework's own line, printed beside the error — a CODED one (2026-10-09):\n * each caller passes `'[vera] <code>'` in production and its table's `diagnostic()` sentence in development, both\n * literal codes at the call site, so the static checks read them. The subject is fixed wording too (`a hook`, `an\n * element ref`), never a tag name: this line is the console's FORMAT (no `'%s'`, which measured +2–3 B on the renderer\n * bundles), so nothing from outside may reach it — the element goes to the `'error'` handlers instead. Production prints it only where the platform has no\n * `reportError` (Node); in a browser, `reportError` alone reports.\n *\n * Shared by core (a hook threw) and the renderer (a ref threw) so the fallback is one rule.\n */\nexport const reportUncaught = (error: unknown, line: string) => {\n if (typeof reportError !== 'function') console.error(line, error);\n else {\n if (__DEV__) console.error(line, error);\n reportError(error);\n }\n};\n\n/**\n * **Reports what user code a render called threw — to the app's `'error'` chain, else as uncaught.** One rule for\n * every callback the framework runs on the user's behalf and survives: a hook (core), an element ref, and an element\n * claim's `create`/`mount`/`unmount` (the renderer). The caller catches at the call site and carries on, so one\n * failing callback never stops its siblings or leaves a commit half applied. `element` is the component the error\n * belongs to, handed to each handler. Every throw is reported — nothing is deduped, as a hook's never was.\n * **Core keeps a deliberate twin** (`reportHookError`, the same rule as a `forEach`): routed through here it measured\n * +11 B gzip on `vera.min.js` (2026-10-09). A change to the rule changes both.\n */\nexport const reportTo = (handlers: readonly unknown[] | undefined, error: unknown, element: Element | undefined, line: string) => {\n if (handlers?.length) for (const handler of handlers) (handler as (error: unknown, element?: Element) => void)(error, element);\n else reportUncaught(error, line);\n};\n\n/** The component a render root belongs to: a shadow root's host, or a light root itself. */\nexport const hostOf = (root: Node | null | undefined): Element | undefined =>\n root == null ? undefined : root.nodeType === 11 ? (root as ShadowRoot).host : (root as Element);\n\n/** `fn(a, b, c)`, tracked as the caller is — the stand-in for core's `untracked` when no core was wired. */\nexport const call: Untracked = (fn, a, b, c) => fn(a!, b!, c!);\n\n/**\n * **Runs a bound handler, and its callers run it UNTRACKED**: the renderer's template `@event` and spread's event key,\n * each through `untracked(dispatch, holder, event)` (2026-10-09). An effect that fires an event synchronously\n * (`el.click()`, `focus()`, `dispatchEvent`) runs the handler INSIDE itself, and the handler's reads subscribed the\n * effect: a handler doing `state.n++` made the effect re-run on every click, a self-feeding loop held to one round per\n * frame, forever (measured). A handler's reads are event-time decisions, never a hook's inputs. The directives engine's\n * delegated `listen` makes the same choice its own way. A function is called with the element as `this`; an object\n * through its `handleEvent`. One function for both callers (Brian's size-audit ruling, 2026-11-13): it was two\n * identical copies, so a fix had two addresses; each bundle still inlines its own.\n */\nexport const dispatch = (holder: HandlerHolder, event: Event) => {\n const handler = holder._handler as EventListener | EventListenerObject | null;\n if (typeof handler === 'function') handler.call(holder._element as never, event);\n else if (typeof handler?.handleEvent === 'function') handler.handleEvent(event);\n};\n\n/**\n * **Whether a property binding is a `<select>`'s SELECTION** — `value` or `selectedIndex` — which the renderer and\n * `spread` both treat as live: re-asserted every render and compared against the live value (as `!value` is), because\n * a select's options can be replaced under an unchanged value, which drops the selection. One rule, asked once per\n * binding by both, so a template and a spread key cannot disagree about it.\n *\n * In development it names the one shape it cannot serve: on a `<select multiple>` both properties read and set a\n * SINGLE selection, so a selection the user adds is kept rather than controlled. Always writing there was measured\n * 2–3% slower on every table with a select per row, to serve an API that does not fit — hence a warning, not a cost.\n */\nexport const isSelection = (element: Element, name: unknown) => {\n if ((name !== 'value' && name !== 'selectedIndex') || element.localName !== 'select') return false;\n return true;\n};\n\n/**\n * Development: the one shape a selection binding cannot serve, named by the module the user wired (`side`). Called only\n * behind `__DEV__` at each call site, so production keeps `isSelection` exactly as small as it was (a `side` argument on\n * it measured +1 B, a default +9 B on vera-renderer.min.js — 2026-10-09).\n */\nexport const saySelectMultiple = (element: Element, name: unknown, side: string) => {\n if (element.hasAttribute('multiple'))\n console.warn(diagnostic(side, '<select multiple>', 'select-multiple', __DEV__ && SHARED.selectMultiple(String(name))));\n};\n\n/**\n * `target[key]`, as a function — how a component's GETTER is read through `untracked`. Not `Reflect.get`: `untracked`\n * passes three arguments, and `Reflect.get`'s third is the RECEIVER — `undefined` there runs the getter with no `this`.\n */\nexport const read = (target: object, key: string) => (target as Record<string, unknown>)[key];\n\n/**\n * **What a thrown value says, whatever was thrown — and it never throws itself.** A caught value comes from author\n * code (a `resolve` option, a motion tick or vocabulary function), and JavaScript can throw anything: `null`, an object\n * with no prototype (`String()` finds no `toString`), one whose `toString` or `message` getter throws, a Proxy whose\n * traps throw. Formatting it naively replaced the real failure with an unrelated TypeError from inside the framework.\n * Anything unreadable becomes a fixed phrase; `Object.prototype.toString` is no fallback, since it reads\n * `Symbol.toStringTag` through a Proxy's trap too.\n *\n * **A deliberate duplicate of `thrownMessage` in `packages/ssr/src/vera/escaping.ts` — fix both copies.** `@verajs/ssr`\n * is compiled per file with no bundling, so it cannot import this private, unpublished package at run time;\n * `tests/thrown-message-copies.test.mjs` runs one table of thrown values against both, so they cannot drift.\n */\nexport const thrownMessage = (error: unknown): string => {\n try {\n if (error instanceof Error) return String(error.message);\n const message = (error as { message?: unknown } | null)?.message;\n return typeof message === 'string' ? message : String(error);\n } catch {\n return '[unprintable value thrown]';\n }\n};\n","/**\n * **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 — a template-identity renderer.\n *\n * A tagged template's `strings` array is interned per call site, so it keys a parsed `<template>`.\n * An instance clones it and binds the expression positions; every later render of the same shape\n * commits only the values that changed. Lists reconcile by index here, by key through\n * `@verajs/renderer/keyed`.\n *\n * Contracts the speed pays for:\n * - The renderer owns its container below the mount point: a part that owns a whole parent clears it\n * with one `textContent = ''`.\n * - Do not `normalize()` rendered content — child anchors are text nodes.\n * - A string renders as text, never as markup. There is no `innerHTML` sink.\n *\n * Internal members are `_`-prefixed because the production build mangles `/^_[a-z]/`. `$`-named\n * members cross bundle boundaries (keyed, spread, slots) and survive mangling by not matching it.\n */\n\nimport {\n adoptProperty,\n call,\n CONTENT_PROPERTY,\n contentClash,\n ownsContent,\n TAG_NAME_HOLE,\n tagHole,\n INLINE_HANDLER,\n isSelection,\n saySelectMultiple,\n read,\n reportTo,\n hostOf,\n SCRIPT_URL,\n SCRIPT_URL_ITEM,\n URL_SINK,\n diagnostic,\n dispatch,\n hasWarned,\n misuse,\n SHARED,\n warnOnce,\n} from '@verajs/shared-utils';\nimport { attributeValueKind, eventKey, eventNameGuess } from './dev-values.js';\nimport { PROSE } from './renderer-diagnostics.js';\nimport type { Untracked, PropertyHost } from '@verajs/shared-utils';\n\nimport type { InstanceHook, TemplateResult } from './types.js';\nimport { PROTOCOL, IGNORED, CHILD, SOLE, ATTR, PROPERTY, BOOLEAN, EVENT, REF, SELECT_REF, ADOPT, LIVE, SELECT, LIVE_CUSTOM, REFUSED, SELECT_INDEX, EMPTY, TEXT, TEMPLATE, LIST, NODE } from './kinds.js';\n\nexport type { TemplateResult } from './types.js';\n\n/**\n * The marker the one parse per template writes into each hole — into an attribute name (`0\\uFFFF`), a bogus\n * comment (`<?\\uFFFF0>`) and raw text (`\\uFFFF0\\uFFFF`). U+FFFF is a Unicode noncharacter: real text never contains\n * it, so an author's statics cannot collide with it, and the HTML preprocessor keeps it (a parse error, never a\n * rewrite) — in every engine, `tests/browser/template-marker.test.js`. Data never reaches the parsed string at all:\n * values are committed through the DOM, and the one path that builds strings at runtime (`tag`) refuses any name\n * outside `[a-zA-Z0-9._-]`. Fixed rather than random, so the parse is deterministic.\n */\nconst MARKER = '\\uFFFF';\n/** Every marker as a nested `<template>` serializes it: an addressed attribute, a child comment, a raw-text pair. */\nconst INERT_MARKERS = / \\d+\\uFFFF(?:=\"[^\"]*\")?|<!--\\?\\uFFFF\\d+-->|\\uFFFF\\d+\\uFFFF/g;\n\nconst doc = document;\nconst comment = () => doc.createComment('');\n\n/**\n * The scanner — one regex per state, each finding the next thing that matters (lit-html's design). It\n * decides only what each expression position IS; the browser's parser builds the tree. Every marker\n * carries its binding's index, so pairing is ADDRESSED: an element the parser drops takes only its own\n * binding with it and never shifts a later value onto another element (a security property —\n * `tests/dropped-element-bindings.test.mjs`).\n */\n/** `<!-->` and `<!--->` are not opened at all: they close themselves (the tokenizer's abrupt close), so they stay text. */\nconst TEXT_END = /<(?:(!--(?!-?>)|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\n/**\n * A comment ends at `-->` or `--!>` — read as a comment past either, a value after one was dropped while the browser\n * rendered it. The abrupt `<!-->`/`<!--->` never open one (`TEXT_END`'s lookahead; a lookBEHIND would not even parse\n * in an older Safari).\n */\nconst COMMENT_END = /--!?>/g;\nconst COMMENT2_END = />/g;\n/** `>`, or whitespace then an attribute name (with `=` and the start of its value), or the string's end. */\nconst TAG_END = />|[ \\t\\n\\f\\r](?:([^\\s\"'>=/]+)([ \\t\\n\\f\\r]*=[ \\t\\n\\f\\r]*(?:[^ \\t\\n\\f\\r\"'`<>=]|(\"|')|))|$)/g;\nconst DOUBLE_QUOTE_END = /\"/g;\n\n\n/**\n * **An expression inside an attribute NAME is refused in development** (`<p data-${k}=\"1\">`, `<b ${name}=\"x\">`,\n * `<p ${k}-x>`): the parser sees the marker before the value exists, so no position can hold it, and the server\n * refuses the same template in every build. Development only, by Brian's call (2026-09-30): a template is fixed\n * source, so its first render in development finds it, and production pays nothing (the check cost 101 B). A name known only at runtime is a one-key spread, which applies the\n * refusals a runtime name needs (handlers, `srcdoc`, URL values); development shows the rewrite. A hole is in a name\n * when, inside a tag and outside a value, a name character touches it on either side — never a ref (whitespace or\n * `>`/`/>` around it) and never the TAG name (`<${tag}>`, the tag entry's).\n */\n/** A name character ends the static, after a space or quote since the tag's `<` — so never a TAG-name hole (`<my-${x}`). */\nconst NAME_BEFORE = /[\\s\"'][^\\s<>]*[^\\s\"'>=/<]$/;\nconst NAME_AFTER = /^(?:[^\\s\"'>=/]|[ \\t\\n\\f\\r]*=)/;\nconst nameHole = (before: string, after: string): never => {\n const prefix = /[^\\s\"'>=/]*$/.exec(before)![0];\n const suffix = /^[^\\s\"'>=/]*/.exec(after)![0];\n const value = /^[ \\t\\n\\f\\r]*=[ \\t\\n\\f\\r]*(?:\"([^\"]*)(\"?)|'([^']*)('?)|([^\\s>]*))/.exec(after.slice(suffix.length));\n /** The value as spread takes it: a closed static is that string, an open one (or none written) is a binding. */\n const given =\n value === null ? \"''\" : value[2] === '\"' ? JSON.stringify(value[1]) : value[4] === \"'\" ? JSON.stringify(value[3]) : value[5] ? JSON.stringify(value[5]) : '…';\n throw new Error(misuse('renderer', 'name-expression', __DEV__ && SHARED.nameExpression(`${prefix}\\${…}${suffix}`, given)));\n};\nconst SINGLE_QUOTE_END = /'/g;\n/**\n * Elements whose content the parser reads as TEXT, so a comment marker cannot live there: the scan\n * writes a text marker and construction turns it into an anchor. `noscript` because Firefox parses it\n * as raw text in a template while Chromium and WebKit do not — listed, it is right in both.\n */\nconst RAW_TEXT_TAGS = /^(?:script|style|textarea|title|iframe|noscript)$/i;\n/**\n * The 14 void elements — a start tag with no content and no end tag. Read only by the development tag-shape pass\n * (`<div />` is an open tag; `</br>` is another `<br>`), so production drops it. A regex rather than shared-utils'\n * Set, as `RAW_TEXT_TAGS` is: an imported `new Set` measured 62 B in production.\n */\nconst VOID_TAGS = /^(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr|param)$/i;\n\n/** A binding slot's value before its first commit — never equal to a user value. */\nconst UNSET = {};\n/** The value slot of a child binding whose node slot holds a `ChildPart`. */\nconst UPGRADED = {};\n\n/**\n * A template's bindings are indexed by VALUE position: a multi-part attribute sits at its first value\n * and the positions of its other values are `IGNORED`, so the commit loop needs no bookkeeping.\n */\n/**\n * **Tag-shape mistakes, development only** — a self-closed non-void element (`<div />` is an OPEN tag: what follows\n * becomes its child) and an end tag on a void one (`</br>` is ANOTHER `<br>`), in HTML content only (`<svg>`/`<math>`\n * keep self-closing). A separate pass over ALL the statics, the last one too — the production scan never reads it,\n * and a template with no expressions is never scanned — and it only READS: a development-only counter once changed\n * the SCAN, so development and production parsed one template differently.\n */\nconst SHAPE = /<!--(?:-?>|[\\s\\S]*?(?:--!?>|$))|<(\\/?)([a-zA-Z][^\\s/>]*)((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/g;\n/** The obsolete elements a parser reads as text whole, which the scanner does not list (production pays nothing for them). */\nconst OBSOLETE_RAW = /^(?:xmp|noembed|noframes|plaintext)$/i;\nconst tagShape = (strings: TemplateStringsArray, type: number): [string, string][] | undefined => {\n const markup = strings.join('');\n /** Where each binding sits in `markup`, so a refusal can ask whether one falls inside an element's content. */\n const holes: number[] = [];\n for (let i = 0, at = 0; i < strings.length - 1; i++) holes.push((at += strings[i].length));\n const bound = (from: number, to: number) => holes.some((at) => at >= from && at <= to);\n let foreign = type === 1 ? 0 : 1;\n /** `[code, tag]` — printed through the table by `sayShape` when the template first renders. */\n let found: [string, string][] | undefined;\n SHAPE.lastIndex = 0;\n for (let m: RegExpExecArray | null; (m = SHAPE.exec(markup)) !== null; ) {\n if (m[2] === undefined) continue;\n const tag = m[2].toLowerCase();\n const closing = m[1] === '/';\n const selfClosed = !closing && m[3].trimEnd().endsWith('/');\n if (tag === 'svg' || tag === 'math') {\n if (closing) foreign--;\n else if (!selfClosed) foreign++;\n continue;\n }\n if (!closing && (RAW_TEXT_TAGS.test(tag) || OBSOLETE_RAW.test(tag))) {\n const end = markup.toLowerCase().indexOf(`</${tag}`, SHAPE.lastIndex);\n const stop = end === -1 ? markup.length : end;\n /**\n * Two shapes that silently lose a binding, refused. Inside `<svg>`/`<math>` a `<title>` or `<style>` is a\n * foreign element whose content the browser reads as MARKUP, while the renderer reads it as raw text and\n * rebuilds that text around its bindings — destroying any element inside it. And the obsolete raw-text\n * elements are text to the parser whole, which the scanner does not know, so a binding there never renders.\n */\n if (foreign > 0 && RAW_TEXT_TAGS.test(tag) && bound(SHAPE.lastIndex, stop) && /<[a-zA-Z]/.test(markup.slice(SHAPE.lastIndex, stop)))\n throw new Error(misuse('renderer', 'foreign-raw-text', __DEV__ && PROSE['foreign-raw-text'](tag)));\n if (foreign === 0 && OBSOLETE_RAW.test(tag) && bound(SHAPE.lastIndex, stop))\n throw new Error(misuse('renderer', 'obsolete-raw-text', __DEV__ && PROSE['obsolete-raw-text'](tag)));\n SHAPE.lastIndex = stop;\n }\n if (foreign > 0) continue;\n if (selfClosed && !VOID_TAGS.test(tag))\n (found ??= []).push(['self-closed-tag', tag]);\n else if (closing && VOID_TAGS.test(tag))\n (found ??= []).push(['void-end-tag', tag]);\n }\n return found;\n};\n/**\n * Said at the template's FIRST instance, not at construction: `namespaces` constructs an HTML build of a template it\n * then only ever instantiates in SVG, and that build's shape is not a mistake anyone wrote.\n */\n/**\n * **A `<slot>` rendered into LIGHT DOM that nothing will distribute** — slots not wired, or wired after this template\n * was built. Said once per host tag and case; a shadow root is never warned about, the platform slots there.\n */\nconst saySlotless = () => {\n const host = renderRoot;\n if (host === null || host.nodeType !== 1) return;\n const tag = (host as Element).localName;\n /** Slots wired = its protocol entry (`_$capture$`, set at wire); `_$done$` is installed only at slots' first need. */\n const late = (registry as { _$capture$?: unknown } | null)?._$capture$ !== undefined;\n /** Late: the same fact core says at wire time (`late-template-module`), seen here at the host it bit. Once per tag. */\n if (late) warnOnce('renderer', `<${tag}>`, 'late-template-module', __DEV__ && (() => SHARED.lateTemplateModule()), tag);\n else warnOnce('renderer', `<${tag}>`, 'slots-unwired', __DEV__ && (() => PROSE['slots-unwired']()), tag);\n};\nexport const sayShape = (template: Template) => {\n const shape = template._shape;\n if (shape !== undefined) {\n template._shape = undefined;\n /** Each code written out, so the manifest (`diagnostics-tables`) reads every raise from the source. */\n for (const [code, tag] of shape)\n if (code === 'self-closed-tag') console.warn(diagnostic('renderer', `<${tag}>`, 'self-closed-tag', __DEV__ && PROSE['self-closed-tag'](tag)));\n else console.warn(diagnostic('renderer', `<${tag}>`, 'void-end-tag', __DEV__ && PROSE['void-end-tag'](tag)));\n }\n};\n\nclass Template {\n /** What an instance clones: the single root element, or the whole content fragment. */\n $R: Node;\n /** No element in it can be custom — see `instantiate`. */\n _plain = true;\n $K: number[];\n $N: string[];\n /** The statics around a bound attribute's values; `null` for one full-value expression. */\n $J: (string[] | null)[];\n /** Child-index hops from `$R` to each binding's node. */\n $P: number[][] = [];\n /** The template statically writes the attribute too, so a first nullish commit must still remove it. */\n _present: boolean[];\n /**\n * Per binding, whether it names a URL a browser navigates to (a `javascript:` value is refused, see `SCRIPT_URL`):\n * 0 not one; 1 converted once, and that string checked and written; 2 a custom element's property — strings only.\n */\n $L: number[];\n /**\n * **An extension marked this template** (`'template'` insert): namespaces' resolver, an instance hook. False for\n * every template of an app that wires none — ONE read per instance created, never a per-row cost otherwise.\n */\n $X = false;\n /** Namespaces' resolver: which template to build at a position, given its parent. */\n declare _$at$?: (parent: Node) => Template;\n /** The namespace this template was parsed in, for a resolver asked about a detached fragment. */\n declare _$ns$?: string | null;\n /** The instance hook — elements (and slots): claim at creation, mount at the render's end, unmount at teardown. */\n declare _$inst$?: InstanceHook;\n /** Development only: tag-shape mistakes found at construction, said at the template's FIRST instance (`sayShape`). */\n declare _shape?: [string, string][];\n /**\n * Development only: element positions on an element a SOLE binding owns — see `ownsContent`. Marked per instance in\n * `instantiate`; hydration needs no mark, because the server's output carries the content or its empty anchor.\n */\n declare _owned?: number[];\n /** Development only: the template holds a `<slot>` and was built while light-DOM slots was not wired (`saySlotless`). */\n declare _slotless?: boolean;\n\n constructor(result: TemplateResult) {\n const strings = result.strings;\n const count = strings.length - 1;\n const kinds = (this.$K = new Array(count).fill(IGNORED));\n const names = (this.$N = new Array(count).fill(''));\n const statics = (this.$J = new Array(count).fill(null));\n const present = (this._present = new Array(count).fill(false));\n const urls = (this.$L = new Array(count).fill(0));\n const nodes: (Node | null)[] = new Array(count).fill(null);\n /**\n * Development bookkeeping for a binding whose marker never arrives: the tag it was written in, whether it is an\n * element position (a ref has no name), and which bindings sat in a nested `<template>`'s inert content — so a\n * DROPPED element is told apart from inert markup. Read only; production never builds them.\n */\n let tags: string[] | undefined;\n let refs: boolean[] | undefined;\n let inert: Set<number> | undefined;\n if (__DEV__) {\n tags = [];\n refs = [];\n inert = new Set();\n this._shape = tagShape(strings, result._$litType$ ?? 1);\n }\n\n // ── scan ──\n let markup = '';\n let regex = TEXT_END;\n let rawEnd: RegExp | undefined;\n /** The previous binding opened an UNQUOTED value, so a string that matches nothing continues it (`a=${x}${y}`). */\n let open: boolean = false;\n /** Development also scans the LAST static, so a template that ends inside a tag is refused (below); production does not. */\n for (let i = 0; __DEV__ ? i <= count : i < count; i++) {\n const s = strings[i];\n if (__DEV__ && i > 0) tags![i] = tags![i - 1];\n /** Where this string's bound attribute name ends (≥ 0), -1 for none, -2 for an element position. */\n let nameEnd = -1;\n let continues: boolean = open;\n let name = '';\n let at = 0;\n let match: RegExpExecArray | null;\n while (at < s.length) {\n regex.lastIndex = at;\n if ((match = regex.exec(s)) === null) break;\n at = regex.lastIndex;\n if (regex === TEXT_END) {\n if (match[1] === '!--') regex = COMMENT_END;\n else if (match[1] !== undefined) regex = COMMENT2_END;\n else {\n if (match[2] !== undefined && RAW_TEXT_TAGS.test(match[2])) rawEnd = new RegExp(`</${match[2]}`, 'gi');\n if (__DEV__) tags![i] = match[2] ?? '';\n regex = TAG_END;\n }\n } else if (regex === TAG_END) {\n continues = false;\n if (match[0] === '>') {\n regex = rawEnd ?? TEXT_END;\n nameEnd = -1;\n } else if (match[1] === undefined) nameEnd = -2;\n else {\n name = match[1];\n nameEnd = at - match[2].length;\n regex = match[3] === undefined ? TAG_END : match[3] === '\"' ? DOUBLE_QUOTE_END : SINGLE_QUOTE_END;\n }\n } else if (regex === DOUBLE_QUOTE_END || regex === SINGLE_QUOTE_END) {\n regex = TAG_END;\n /** A value that closes with nothing after it before the expression: the expression is an element position. */\n nameEnd = -2;\n } else if (regex === COMMENT_END || regex === COMMENT2_END) regex = TEXT_END;\n else {\n regex = TAG_END;\n rawEnd = undefined;\n }\n }\n /**\n * A template that ends INSIDE a tag (`<b title=\"${x}`) renders nothing of it: the parser drops an unfinished tag\n * whole. Refused, as the server refuses it in every build — there, left open, the tag swallowed the markup after\n * the template into its attributes.\n */\n if (__DEV__ && i === count) {\n if (regex !== TEXT_END && regex !== rawEnd && regex !== COMMENT_END && regex !== COMMENT2_END)\n throw new Error(misuse('renderer', 'unfinished-tag', __DEV__ && PROSE['unfinished-tag']()));\n break;\n }\n if (regex === TEXT_END) {\n markup += `${s}<?${MARKER}${i}>`;\n kinds[i] = CHILD;\n } else if (regex === rawEnd) {\n markup += `${s}${MARKER}${i}${MARKER}`;\n kinds[i] = CHILD;\n } else if (regex === COMMENT_END || regex === COMMENT2_END) markup += s;\n else if (nameEnd >= 0) {\n /** The attribute is renamed to its binding's address; the value keeps its statics, split by the marker. */\n names[i] = name;\n markup += `${s.slice(0, nameEnd - name.length)}${i}${MARKER}${s.slice(nameEnd)}${MARKER}`;\n /** An unquoted value followed by `/>` would absorb the slash. */\n if (regex === TAG_END && strings[i + 1].startsWith('/>')) markup += ' ';\n } else if (nameEnd === -2) {\n if (__DEV__ && NAME_AFTER.test(strings[i + 1])) nameHole(s, strings[i + 1]);\n if (__DEV__) refs![i] = true;\n markup += `${s} ${i}${MARKER}`;\n }\n else if (continues || regex !== TAG_END) markup += s + MARKER; // another value of the attribute a previous binding opened\n /**\n * A tag-name position (`<${x}>`, `</${x}>`, `<my-${x}>` — no whitespace since the `<`): refused in development.\n * Production keeps no marker, consumes the value and stays aligned.\n */\n else {\n if (__DEV__ && TAG_NAME_HOLE.test(s)) tagHole('renderer');\n /** Nothing before it at all (`${ref}${n}=\"x\"`): only what follows can say it is a name. */\n if (__DEV__ && (NAME_BEFORE.test(s) || (s === '' && NAME_AFTER.test(strings[i + 1])))) nameHole(s, strings[i + 1]);\n markup += s;\n }\n open = regex === TAG_END && (nameEnd >= 0 || continues);\n }\n markup += strings[count];\n\n // ── parse, then one walk ──\n const type = result._$litType$ ?? 1;\n const element = doc.createElement('template');\n /** svg/mathml fragments only parse inside their root: wrap, then unwrap. */\n element.innerHTML = type === 2 ? `<svg>${markup}</svg>` : type === 3 ? `<math>${markup}</math>` : markup;\n const content = element.content;\n /**\n * Unwrapped by removing the wrapper and keeping EVERYTHING the parser made: an HTML element in foreign content\n * (`<div>` inside `<svg>`) breaks out, and the parser places it AFTER the wrapper — keeping only the wrapper's\n * children dropped it, and everything it held, silently.\n */\n if (type !== 1) (content.firstChild as Element).replaceWith(...content.firstChild!.childNodes);\n const walker = doc.createTreeWalker(content, 129 /* ELEMENT | COMMENT */);\n let node: Node | null;\n while ((node = walker.nextNode()) !== null) {\n if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (!data.startsWith('?' + MARKER)) continue;\n const anchor = doc.createTextNode('');\n (node as Comment).replaceWith(anchor);\n walker.currentNode = anchor;\n nodes[+data.slice(MARKER.length + 1)] = anchor;\n continue;\n }\n const el = node as Element;\n /**\n * A nested `<template>`'s content is inert markup the walk never enters, so its bindings can never be\n * reached — they are ignored, as the server ignores them. Their markers are scrubbed from its markup,\n * every depth at once, or they would sit in the live page.\n */\n if (el.localName === 'template') {\n const held = (el as HTMLTemplateElement).innerHTML;\n if (__DEV__) for (const m of held.matchAll(/(\\d+)\\uFFFF|\\uFFFF(\\d+)/g)) inert!.add(+(m[1] ?? m[2]));\n (el as HTMLTemplateElement).innerHTML = held.replace(INERT_MARKERS, '');\n }\n if (el.localName.includes('-') || el.hasAttribute('is')) this._plain = false;\n for (const attribute of el.getAttributeNames()) {\n if (!attribute.endsWith(MARKER)) continue;\n const i = parseInt(attribute, 10);\n const value = el.getAttribute(attribute)!.split(MARKER);\n el.removeAttribute(attribute);\n nodes[i] = el;\n const written = names[i];\n const first = written[0];\n /** An element position (`<p ${ref}>`) arrives with no value; `&=${ref}` is its explicit spelling. */\n if (value.length === 1 || first === '&') {\n /** Decided here, once: `localName` is a DOM accessor, too dear to read on every commit. */\n kinds[i] = el.localName === 'select' ? SELECT_REF : REF;\n continue;\n }\n let kind =\n first === '.' ? PROPERTY : first === '?' ? BOOLEAN : first === '@' ? EVENT : first === '!' ? LIVE : ATTR;\n /** The parser lowercases attribute names; the scan kept the author's case (`.someProp`). */\n let real = kind === ATTR ? written : written.slice(1);\n /** React muscle memory, buildless: `onClick=${fn}` is `@click`. Strictly `on` + a capital — `onclick` stays an attribute. */\n if (kind === ATTR && /^on[A-Z]/.test(written)) {\n kind = EVENT;\n real = written.slice(2).toLowerCase();\n }\n /**\n * A `<select>`'s selection is re-asserted every render and compared against the LIVE value (as `!value` is):\n * its options can be replaced under an unchanged value, which drops the selection. It is written when the\n * pass ends, once its options exist — see `flush`.\n */\n if ((kind === PROPERTY || kind === LIVE) && isSelection(el, real)) {\n if (__DEV__) saySelectMultiple(el, real, 'renderer');\n kind = real === 'value' ? SELECT : SELECT_INDEX;\n }\n /**\n * `el.__proto__ = v` is not a property write: it replaces the element's prototype and destroys it.\n * No use is legitimate, so the binding is refused — the deliberate twin of spread's `refusedSink`\n * (`tests/dangerous-binding-matrix.test.mjs` holds the two together).\n */\n if ((kind === PROPERTY || kind === LIVE) && real === '__proto__') {\n kind = REFUSED;\n if (__DEV__)\n console.warn(diagnostic('renderer', `<${el.localName}>`, 'proto-binding', __DEV__ && SHARED.protoBinding(written)));\n } else if (kind === ATTR && real.toLowerCase() === 'srcdoc') {\n /** A bound `srcdoc` ATTRIBUTE renders its value as an HTML document: markup injection by construction. */\n kind = REFUSED;\n if (__DEV__)\n console.warn(diagnostic('renderer', `<${el.localName}>`, 'srcdoc-attribute', __DEV__ && SHARED.srcdocAttribute('.srcdoc=${…}')));\n } else if (kind === ATTR && INLINE_HANDLER.test(real)) {\n /** A bound inline handler runs its value as code: refused, as spread and the server refuse it. */\n kind = REFUSED;\n if (__DEV__)\n console.warn(\n diagnostic('renderer', `<${el.localName}>`, 'handler-attribute',\n __DEV__ && SHARED.handlerAttribute(real, `\\`@${real.slice(2).toLowerCase()}=\\${…}\\` (or \\`on${real[2].toUpperCase()}${real.slice(3)}=\\${…}\\`)`))\n );\n } else if (kind === PROPERTY && el.localName.includes('-')) kind = ADOPT;\n else if (kind === LIVE && el.localName.includes('-')) kind = LIVE_CUSTOM;\n /**\n * A property that REPLACES an element's content (`.textContent`, `.innerHTML`…) on an element that also has\n * content of its own — markup, or a child binding whose anchor is in it: the write strands the binding, and a\n * later commit into it throws on a missing parent. Cannot work as written, so development throws.\n */\n if (__DEV__ && kind !== ATTR && kind !== EVENT && kind !== BOOLEAN && CONTENT_PROPERTY.test(real) && ownsContent(el))\n contentClash('renderer', el.localName, real);\n kinds[i] = kind;\n names[i] = real;\n statics[i] = value.length === 2 && value[0] === '' && value[1] === '' ? null : value;\n present[i] = kind === ATTR && el.hasAttribute(real);\n /**\n * A custom element's `src` or `data` PROPERTY is its own business — often an object (`.data=${rows}`) —\n * so only a string is checked there (1), and nothing else is converted; everywhere else the value is converted\n * once (2) — and an animation's value (`to`, `values`…) is checked item by item (3).\n */\n const sink = URL_SINK.exec(real);\n urls[i] =\n kind === REFUSED || kind === BOOLEAN || kind === EVENT || sink === null\n ? 0\n : kind !== ATTR && el.localName.includes('-')\n ? 1\n : sink[1]\n ? 2\n : 3;\n }\n /** A raw-text element's markers arrived as characters: rebuild its content with anchors in their place. */\n if (RAW_TEXT_TAGS.test(el.localName) && el.textContent!.includes(MARKER)) {\n const pieces = el.textContent!.split(MARKER);\n el.textContent = '';\n for (let p = 0; p < pieces.length; p++) {\n if (p % 2 === 0) {\n if (pieces[p]) el.append(pieces[p]);\n } else el.append((nodes[+pieces[p]] = doc.createTextNode('')));\n }\n }\n }\n\n /**\n * A child binding that is its element's only content needs no anchor in the template — except inside\n * a raw-text element, whose content is never markup. Then each binding's path from the root.\n */\n const first = content.firstChild;\n const root = (this.$R = first !== null && first.nodeType === 1 && first.nextSibling === null ? first : content);\n for (let i = 0; i < count; i++) {\n let at = nodes[i];\n if (at === null) {\n if (__DEV__ && (kinds[i] === CHILD || names[i] !== '' || refs![i])) {\n if (inert!.has(i))\n console.warn(diagnostic('renderer', 'a nested <template>', 'inert-binding', __DEV__ && PROSE['inert-binding'](String(i))));\n /** A run of consecutive casualties is one dropped element: said once, naming the first. */\n else if (i === 0 || nodes[i - 1] !== null || inert!.has(i - 1) || !(kinds[i - 1] === CHILD || names[i - 1] !== '' || refs![i - 1])) {\n let lost = 1;\n while (i + lost < count && nodes[i + lost] === null && !inert!.has(i + lost)) lost++;\n const where = tags![i] ? `\\`${names[i] !== '' ? `${names[i]}=` : refs![i] ? '&=' : ''}\\` on <${tags![i]}>` : 'a binding';\n console.warn(diagnostic('renderer', 'a dropped element', 'dropped-binding', __DEV__ && PROSE['dropped-binding'](where, String(lost))));\n }\n }\n kinds[i] = IGNORED;\n } else if (kinds[i] === CHILD) {\n const parent = at!.parentNode!;\n if (__DEV__ && (parent as Element).localName === 'table')\n console.warn(diagnostic('renderer', '<table>', 'table-binding', __DEV__ && PROSE['table-binding']()));\n /**\n * Only on a PLAIN element (no dash, no `is`): a light-DOM component renders into its own children, and the part\n * this position may become owns its element's whole content — so there it keeps its anchor, bounded by markers.\n */\n const host = parent as Element;\n if (\n parent.nodeType === 1 &&\n parent.childNodes.length === 1 &&\n !RAW_TEXT_TAGS.test(host.localName) &&\n !host.localName.includes('-') &&\n !host.hasAttribute('is')\n ) {\n parent.removeChild(at!);\n nodes[i] = at = parent;\n kinds[i] = SOLE;\n }\n }\n const path: number[] = [];\n for (; at != null && at !== root; at = at.parentNode) {\n let index = 0;\n for (let sibling = at.previousSibling; sibling !== null; sibling = sibling.previousSibling) index++;\n path.unshift(index);\n }\n this.$P.push(path);\n }\n /**\n * Development: an element position (a spread) on an element whose whole content is a SOLE binding — the content is\n * invisible until that binding commits, so the spread's content-property check is told by a mark per instance.\n */\n if (__DEV__) {\n for (let i = 0; i < count; i++)\n if ((kinds[i] === REF || kinds[i] === SELECT_REF) && nodes.some((n, j) => kinds[j] === SOLE && n === nodes[i]))\n (this._owned ??= []).push(i);\n }\n /**\n * **The `'template'` insert** — asked once, as each template is built (cold): a hook may set `_$at$`/`_$inst$`.\n * A module wired AFTER a template was built never hears about it; development says so at `wire` (core reads the\n * mark below).\n */\n if (__DEV__ && registry !== null) (registry as unknown as { $b?: boolean }).$b = true;\n const hooks = registry?.get('template') as TemplateHook[] | undefined;\n /**\n * **Marked by what the hooks LEFT, never by their existing**: a resolver (`_$at$`), an instance hook (`_$inst$`), or a\n * variant's namespace (`_$ns$` — its instances must set the create scope, or a position at their top level cannot\n * be resolved). The fields are the truth, so the mark cannot disagree with them, and the public `'template'` insert\n * keeps its contract (a hook returns nothing). Marking whenever a hook merely existed put every template of an app\n * wiring `elements` — every slots app — on the marked instance path, claimed or not.\n */\n if (hooks !== undefined) for (let i = 0; i < hooks.length; i++) hooks[i](this, result, readScope, root);\n this.$X = !!(this._$at$ || this._$inst$ || this._$ns$);\n /** Light-DOM slots claims a `<slot>` as the template is built — so a template built before it is wired never will. */\n if (__DEV__ && (root as ParentNode).querySelector?.('slot') && (registry as { _$capture$?: unknown } | null)?._$capture$ === undefined)\n this._slotless = true;\n }\n}\n\n/** A `'template'` insert: called once as each template is built. */\ntype TemplateHook = (template: Template, result: TemplateResult, readScope: () => unknown, root: Node) => void;\n\n/**\n * **The create scope**: the template whose instance is being built, while its first update runs — how a resolver\n * answers for a position whose parent is still the instance's detached FRAGMENT (a fragment-rooted template's top\n * level). Set only by a marked template's instantiation.\n */\nlet scope: unknown = null;\nconst readScope = () => scope;\n\n/** The template to build at a position — the same one, unless an extension resolves it by `parent` (namespaces). */\nconst resolved = (template: Template, parent: Node) => (template._$at$ !== undefined ? template._$at$(parent) : template);\n\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n/**\n * **Only a tagged template literal is a template.** Detection is by shape (`strings`), so a value from `JSON.parse` —\n * a request body, an API field an attacker can turn into an object — that looked like a template was rendered as\n * MARKUP. A literal's strings array owns `raw`, which JSON cannot give an array (and an object owning one is not an\n * array): the check Lit makes. It runs here, on the cache's miss, which a forged array always is, so a cached\n * template pays nothing. A forgery is the text any object renders as, `[object Object]` — one shared template, never\n * cached under the forger's own `strings` (a WeakMap throws on a primitive key) — and never a throw: the value is\n * attacker-controlled, and a throw would hand over the subtree.\n */\nlet forged: Template | undefined;\nconst getTemplate = (result: TemplateResult) => {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n const strings = result.strings;\n if (!(Array.isArray(strings) && Object.hasOwn(strings, 'raw'))) {\n if (__DEV__) console.warn(diagnostic('renderer', 'a child value', 'forged-template', __DEV__ && SHARED.forgedTemplate()));\n return (forged ??= new Template({ strings: [`${{}}`] } as unknown as TemplateResult));\n }\n templateCache.set(strings, (template = new Template(result)));\n }\n return template;\n};\n\n/** `${value}` rather than `String(value)`: a symbol throws here as it does at every other sink. */\nconst toText = (value: unknown) => (value == null ? '' : `${value}`);\n\n/**\n * The record an `@event`, element-position or custom-element `.prop` binding holds in its node slot.\n * For an event it is the LISTENER — a stable object, so swapping handlers never touches the DOM and a\n * re-add through `null` is deduped by the platform; for a ref it is the key an `_$apply$` value keeps\n * its ownership by; for `.prop` on a custom element, `_state` is where adoption stands (`adoptProperty`:\n * 0 still adopting, 1 received, 2 refused).\n */\nclass Slot {\n _element: Element;\n _handler: unknown = null;\n _state = 0;\n constructor(element: Element) {\n this._element = element;\n }\n /** Runs the handler UNTRACKED — see shared-utils' `dispatch`. */\n handleEvent(event: Event) {\n untracked(dispatch, this, event);\n }\n}\n\n/**\n * Calls an element ref, and survives one that throws — it runs mid-commit, and an unguarded throw left\n * the render half applied. Reported where a hook's error is: the app's `'error'` chain, handed the\n * component being rendered, else `reportError`.\n */\nconst applyRef = (callback: (element: Element | null) => void, element: Element | null) => {\n try {\n callback(element);\n } catch (error) {\n reportTo(registry?.get('error'), error, hostOf(renderRoot), __DEV__ ? diagnostic('renderer', 'an element ref', 'ref-threw', __DEV__ && PROSE['ref-threw']()) : '[vera] ref-threw');\n }\n};\n\n/**\n * A rendered template. Its bindings live in ONE array of `[node, committed value]` pairs rather than a\n * part object each — a row allocates the instance and that array, nothing else. The instance is also\n * its own list item: `$k` is the key a keyed list reads.\n */\nclass Instance {\n $k: unknown = undefined;\n /**\n * The result last committed into this instance as a list item, recorded ONLY for a result marked `_$same$` (what\n * `each` stamps). Always-on, the skip changed two contracts (a live `!value` binding re-syncing after typing; a result\n * mutated in place re-rendering), so it is opt-in: an unmarked result never takes it (2026-10-18).\n */\n $j: unknown = undefined;\n _template: Template;\n /** The strings this instance was built from — the same-shape identity. */\n _strings: TemplateStringsArray;\n /** The cloned root: the element for a single-root template, else the (soon emptied) fragment. */\n $R: Node;\n _bindings: unknown[];\n constructor(template: Template, strings: TemplateStringsArray, root: Node, bindings: unknown[]) {\n this._template = template;\n this._strings = strings;\n this.$R = root;\n this._bindings = bindings;\n }\n}\n\n/**\n * Builds an instance and commits its first values.\n *\n * **The clone.** Creating an element in a document WITH a custom-element registry costs a definition\n * lookup per element; the template's inert document has none. So a template that cannot contain a\n * custom element is cloned with `cloneNode` — its nodes adopt into the page on insertion — and one that\n * can is imported into `owner`, which upgrades defined elements at clone time in the owner's own\n * registry, so a `.prop` commit reaches the class's setter rather than shadowing it. A container in another\n * window is never the `owner`: its registry does not define this realm's components (Firefox and WebKit leave them\n * un-upgraded there), so `commitAs` hands this renderer's own document instead.\n *\n * **Every node is located before anything commits.** The paths index the pristine clone; an upgrading\n * child position inserts markers and content, which would shift the siblings a later path counts.\n */\nconst instantiate = (template: Template, result: TemplateResult, owner: Document): Instance => {\n if (__DEV__) sayShape(template);\n if (__DEV__ && template._slotless) saySlotless();\n const source = template.$R;\n const root = template._plain && owner === doc ? source.cloneNode(true) : owner.importNode(source, true);\n const kinds = template.$K;\n const paths = template.$P;\n const marked = template.$X;\n /** A marked template's instance keeps its hook's state in ONE slot after its bindings — the hook's own object. */\n const bindings = new Array(kinds.length * 2 + (marked ? 1 : 0));\n for (let i = 0; i < kinds.length; i++) {\n const kind = kinds[i];\n if (kind === IGNORED) continue;\n let node = root;\n const path = paths[i];\n for (let step = 0; step < path.length; step++) {\n node = node.firstChild!;\n for (let hops = path[step]; hops > 0; hops--) node = node.nextSibling!;\n }\n bindings[i * 2] = kind >= EVENT && kind <= ADOPT ? new Slot(node as Element) : node;\n bindings[i * 2 + 1] = kind === CHILD ? '' : UNSET;\n }\n if (__DEV__ && template._owned !== undefined)\n for (const i of template._owned) ((bindings[i * 2] as Slot)._element as Element & { $content?: boolean }).$content = true;\n const instance = new Instance(template, result.strings, root, bindings);\n if (marked) {\n hookUp(instance, root, false);\n const outer = scope;\n scope = template;\n update(instance, result.values);\n scope = outer;\n } else update(instance, result.values);\n return instance;\n};\n\n/**\n * **An instance of a marked template meets its instance hook** — before its first update (claims see the inert\n * clone), with its mount queued for when the render that created it finishes. Arms removal work, so an instance\n * discarded before then is walked at teardown and never mounts. Also how hydration hooks an adopted instance.\n */\nexport const hookUp = (instance: Instance, root: Node | readonly Element[], adopted: boolean) => {\n const hook = instance._template._$inst$;\n if (hook === undefined) return;\n /** The hook's own state — what to mount, and later what to unmount — or nothing to take part. */\n const state = hook.$c(root, renderRoot, adopted);\n if (state === undefined) return;\n instance._bindings[instance._template.$K.length * 2] = state;\n /** Mounted by the ref flush: a record whose second half is not a slot number is a mount. */\n (pendingRefs ??= []).push(hook, state);\n notifyOnRemoval = true;\n};\n\n/**\n * Commits new values into an instance of the same shape. An unchanged single-value binding — nearly\n * every binding of nearly every row on a list update — is skipped here, before any call.\n */\nconst update = (instance: Instance, values: unknown[]) => {\n const template = instance._template;\n const kinds = template.$K;\n const statics = template.$J;\n const bindings = instance._bindings;\n for (let i = 0; i < kinds.length; i++) {\n const kind = kinds[i];\n if (kind !== IGNORED && (kind >= LIVE || statics[i] !== null || values[i] !== bindings[i * 2 + 1]))\n commit(template, bindings, i, kind, values);\n }\n};\n\n/** Commits the binding at value position `i`. */\n/**\n * **A boolean at a child position renders as the WORD** — `${cond && …}` with a false `cond` shows \"false\". Said in\n * development on each CHANGE to a boolean (the dirty check already skips a repeat), so a binding that keeps\n * producing `false` speaks once, and one that flips to `true` speaks again.\n */\nconst warnBooleanChild = (value: boolean) =>\n console.warn(diagnostic('renderer', 'a child position', 'boolean-child', __DEV__ && PROSE['boolean-child'](String(value))));\n\n/**\n * **Content in the wrong namespace does not render** — `` html`<path/>` `` handed into an `<svg>` builds an HTML\n * `<path>`, which draws nothing and says nothing. Development only, at each insert: the host is read from where the\n * content LANDS, and a mismatch is named once per host and content (a toggled subtree would otherwise warn every\n * frame). Silent where HTML is correct — integration points (`<foreignObject>`, `<desc>`, `<title>`, MathML's token\n * elements, an HTML-encoded `<annotation-xml>`) and `<style>`/`<script>`, which never draw.\n */\nconst SVG_NS = 'http://www.w3.org/2000/svg';\nconst MATHML_NS = 'http://www.w3.org/1998/Math/MathML';\nconst foreignHost = (parent: Node): string | null => {\n const element = parent as Element;\n const namespace = element.namespaceURI;\n const svg = namespace === SVG_NS;\n if (!svg && namespace !== MATHML_NS) return null;\n const name = element.localName;\n if (svg) return name === 'foreignObject' || name === 'desc' || name === 'title' ? null : name;\n if (name === 'mi' || name === 'mo' || name === 'mn' || name === 'ms' || name === 'mtext') return null;\n if (name === 'annotation-xml') {\n /** The ATTRIBUTE — what the parser reads; `image/svg+xml` is MathML's own spelling for an SVG annotation. */\n const encoding = element.getAttribute('encoding')?.toLowerCase();\n return encoding === 'text/html' || encoding === 'application/xhtml+xml' || encoding === 'image/svg+xml' ? null : name;\n }\n return name;\n};\n/** The nodes an insert is about to place — a fragment empties as it is inserted, so they are read first. */\nconst landing = (node: Node): Node[] => (node.nodeType === 11 ? [...node.childNodes] : [node]);\nconst checkForeign = (parent: Node, nodes: Node[]) => {\n const host = foreignHost(parent);\n if (host === null) return;\n const hostNamespace = (parent as Element).namespaceURI;\n for (const node of nodes) {\n if (node.nodeType !== 1) continue;\n const element = node as Element;\n if (element.namespaceURI === hostNamespace) continue;\n const tag = element.localName;\n if (tag === 'style' || tag === 'script') continue;\n /** The parser itself opens SVG content for an `<svg>` inside `<annotation-xml>`, whatever the encoding. */\n if (host === 'annotation-xml' && tag === 'svg' && element.namespaceURI === SVG_NS) continue;\n const built = element.namespaceURI === MATHML_NS ? 'MathML' : element.namespaceURI === SVG_NS ? 'SVG' : 'HTML';\n /** The island and its placement are chosen by the HOST's namespace; the encoding follows the CONTENT. */\n const island =\n hostNamespace === MATHML_NS\n ? `<mtext>, or <annotation-xml encoding=\"${built === 'SVG' ? 'image/svg+xml' : 'text/html'}\">, ` +\n 'inside a MathML container such as <mrow> or <math> rather than inside a token element'\n : 'a <foreignObject>, which has to sit in an element whose content model accepts one — a container such as ' +\n '<g> or <svg>, not a text, clipping, gradient or filter element';\n /** Keyed by host namespace AND content namespace: `<a>` is a real element in all three. */\n const seen = `${hostNamespace}${host}>${element.namespaceURI}${tag}`;\n /** `hasWarned` first: the advice below is built only for a case not yet said. */\n if (hasWarned('wrong-namespace', seen)) continue;\n const advice =\n built === 'HTML'\n ? `If it is meant to be an SVG or MathML element, the template holding it needs the svg\\`…\\` or mathml\\`…\\` tag ` +\n `at the call site — or wire @verajs/renderer/namespaces, which parses a template where it lands (compiled JSX ` +\n `wires it itself). A template built before it was wired keeps the namespace it was first built in. If it is ` +\n `genuinely HTML (a <div>, a custom element), it belongs in ${island}: tagging it will not help, and a custom ` +\n `element only upgrades in the HTML namespace.`\n : `The template's tag is already right — these two namespaces cannot nest directly. Put the ` +\n `${built === 'SVG' ? '<svg>' : '<math>'} root inside ${island}.`;\n warnOnce('renderer', `<${tag}>`, 'wrong-namespace', __DEV__ && (() => PROSE['wrong-namespace'](tag, built, host, advice)), seen);\n }\n};\n\n/**\n * **The profiler's hook** (`@verajs/renderer/profiler`, a development-only entry): told of each same-shape update, each\n * first template, each REBUILD (the template identity changed, so the subtree is torn down) and each `renderInto`\n * frame. Every call site is `if (__DEV__ && profileHook !== null)`, so production carries neither the hook nor a call.\n */\ntype ProfileHook = (kind: number, subject: unknown, shape: TemplateStringsArray | null) => void;\nconst PROFILE_UPDATE = 0;\nconst PROFILE_CREATE = 1;\nconst PROFILE_REBUILD = 2;\nconst PROFILE_FRAME_START = 3;\nconst PROFILE_FRAME_END = 4;\nlet profileHook: ProfileHook | null = null;\nconst setProfileHook = (hook: ProfileHook | null) => {\n profileHook = hook;\n};\n\n/** How many times a part's child applier changed identity — development only; `@__PURE__` keeps it out of production. */\nconst applierSwaps = /* @__PURE__ */ new WeakMap<object, number>();\n\n/** `commit`'s scratch for a component's `_$raw$` — module-level, so the read stays one expression. */\nlet raw: Record<string, unknown> | undefined;\nconst commit = (template: Template, bindings: unknown[], i: number, kind: number, values: unknown[]) => {\n const slot = i * 2;\n const committed = bindings[slot + 1];\n const node = bindings[slot];\n if (kind <= SOLE) {\n const value = values[i];\n if (committed === UPGRADED) (node as ChildPart).$p(value);\n else if (value == null || typeof value === 'object') {\n /** A template, list, node or nothing: the position becomes a full part, anchored where its text was. */\n let part: ChildPart;\n if (kind === SOLE) {\n /** Its plain element's whole content is this binding's: the element is the range, and no comment is added. */\n part = new ChildPart(null, null);\n if (committed === UNSET) part.$w = node as Element;\n else {\n part.$w = (node as Text).parentNode;\n part.$o = TEXT;\n part.$l = node as Text;\n part.$v = committed;\n }\n } else {\n part = markered((node as Text).parentNode!, node as Text);\n (node as Text).parentNode!.insertBefore(node as Text, part.$e);\n part.$o = TEXT;\n part.$l = node as Text;\n part.$v = committed;\n }\n bindings[slot] = part;\n bindings[slot + 1] = UPGRADED;\n part.$p(value);\n } else if (value !== committed) {\n if (__DEV__ && typeof value === 'boolean') warnBooleanChild(value);\n if (committed === UNSET) {\n /** SOLE's first text: created holding its value. `''` creates no node, so that one is appended. */\n if (value === '') (node as Element).append('');\n else (node as Element).textContent = value as string;\n bindings[slot] = (node as Element).firstChild;\n } else (node as Text).data = value as string;\n bindings[slot + 1] = value;\n }\n return;\n }\n /**\n * One test for the kinds decided before anything is computed — the same one comparison `REFUSED` alone cost. A\n * `selectedIndex` has no statics and no URL: queued, as a select's value is. (Hydration never commits a selection:\n * the server marked the option, and whatever the user chose before the script arrived stands.)\n */\n if (kind >= REFUSED) {\n if (kind === SELECT_INDEX) {\n bindings[slot + 1] = values[i];\n (pendingSelects ??= []).push(LATER, [node, values[i]]);\n }\n return;\n }\n const parts = template.$J[i];\n let value = values[i];\n if (parts !== null && kind !== EVENT && kind !== REF) {\n value = parts[0];\n for (let p = 1; p < parts.length; p++) value += toText(values[i + p - 1]) + parts[p];\n }\n const name = template.$N[i];\n const element = (kind >= EVENT && kind <= ADOPT ? (node as Slot)._element : node) as PropertyHost;\n /**\n * A `javascript:` URL bound where a browser navigates is code arriving as data: refused, and the\n * attribute removed, on the JOINED value (so `href=\"java${x}\"` is caught too). Statics are the author's\n * and never checked alone; only bindings the template marked as URL-bearing pay for the test.\n *\n * **Converted ONCE, and the string checked is the string written.** Testing the value and then handing it\n * to `setAttribute` converted it twice, so an object whose `toString` answered differently each time\n * passed the check as `https:` and was written as `javascript:`.\n */\n const url = template.$L[i];\n if (url > 1 && value != null && typeof value !== 'string') value = `${value}`;\n if (url !== 0 && typeof value === 'string' && (url === 3 ? SCRIPT_URL_ITEM : SCRIPT_URL).test(value)) {\n if (__DEV__ && value !== committed)\n console.warn(diagnostic('renderer', `<${element.localName}>`, 'script-url', __DEV__ && SHARED.scriptUrl(name)));\n bindings[slot + 1] = value;\n element.removeAttribute(name);\n return;\n }\n /** The kinds that re-assert every render sit from `LIVE` up (`REFUSED` returned above): ONE test routes them all. */\n if (kind >= LIVE) {\n if (kind === SELECT) (pendingSelects ??= []).push(element, value);\n /**\n * A COMPONENT is compared against its CURRENT value and RECEIVES a difference — through `adoptProperty`, as `.name`\n * does — or a running one never hears it: a plain write landed beside its render, which went on showing the old\n * value (released through 0.2.x). The current value of a name it received is the RAW one its store holds (core's\n * `_$raw$`): through the accessor it cost a store read every render and handed an object back as its proxy, never\n * `===` the object bound, so it was delivered again every render; any other name is read through `untracked`.\n * **Inline, not a shared helper — and spread's `!name` key has the same lines (keep them equal):** a call here cost\n * WebKit +3–4% on an unchanged `!name` (5 sessions, 0 faster), inlined −1.1% (5/5 faster than before the fix).\n */\n else if (\n (kind === LIVE\n ? element[name]\n : (raw = element._$raw$ as Record<string, unknown> | undefined) !== undefined && name in raw\n ? raw[name]\n : untracked(read, element, name)) !== value\n ) {\n if (kind === LIVE) element[name] = value;\n else adoptProperty(element, name, value);\n }\n } else if (value === committed) return;\n bindings[slot + 1] = value;\n if (kind === ATTR) {\n /**\n * A value that is not text becomes something nobody meant — a function's source, an array joined by commas, a\n * Date in the machine's timezone. Asked of the RAW value: a URL-bearing name was converted above. Said once per\n * element, name and kind of value (`dev-values`), so fixing one mistake never hides the next.\n */\n if (__DEV__ && value != null) {\n const kind = attributeValueKind(element.localName, name, parts === null ? values[i] : value);\n if (kind !== null) console.warn(diagnostic('renderer', `<${element.localName}>`, 'attribute-value', __DEV__ && SHARED.attributeValue(name, kind, `.${name}=\\${value}`)));\n }\n if (value != null) element.setAttribute(name, value as string);\n /** A fresh clone carries no attribute to remove unless the template itself wrote one. */\n else if (committed !== UNSET || template._present[i]) element.removeAttribute(name);\n } else if (kind === PROPERTY) element[name] = value;\n else if (kind === BOOLEAN) element.toggleAttribute(name, !!value);\n else if (kind === EVENT) {\n const listener = node as Slot;\n if (__DEV__ && value != null && value !== false) {\n /** Something that cannot listen does nothing, silently — `false`/`undefined` are the deliberate \"no handler\". */\n if (typeof value !== 'function' && typeof (value as EventListenerObject).handleEvent !== 'function')\n console.warn(diagnostic('renderer', `<${element.localName}>`, 'not-a-listener', __DEV__ && SHARED.notAListener(name, typeof value)));\n /** A misspelled event name (`@clik`), asked at the first attachment, once per tag and name. */\n if (listener._handler === null) {\n const best = eventNameGuess(element, name);\n if (best !== null)\n warnOnce('renderer', `<${element.localName}>`, 'event-name-typo', __DEV__ && (() => PROSE['event-name-typo'](name, element.localName, best)), eventKey(element, name));\n }\n }\n /** Registered once, as the listener OBJECT: the platform dedupes it, so toggling through null never stacks. */\n if (listener._handler === null && value != null) element.addEventListener(name, listener);\n listener._handler = value ?? null;\n } else if (kind === ADOPT) {\n const adopting = node as Slot;\n if (adopting._state === 1) element[name] = value;\n else if (adopting._state === 0) adopting._state = adoptProperty(element, name, value);\n } else if (kind === REF || kind === SELECT_REF) {\n /**\n * The ref this binding held was handed its element (it is not still queued), and it is being replaced or\n * removed: it is told now, before its successor is handed the element after the pass.\n */\n if (committed !== UNSET && (node as Slot)._state === 0) release(committed);\n if (value == null) return;\n notifyOnRemoval = true;\n /**\n * A value with `_$apply$` applies itself NOW, mid-commit, keyed by this binding — spread delivers\n * properties through it, and they must arrive before the element is inserted and upgraded.\n */\n /** A FUNCTION, not merely present: parsed JSON can carry the key, never a function — data stays data. */\n if (typeof (value as { _$apply$?: unknown })._$apply$ === 'function') {\n /** On a `<select>` it may set the selection (a spread's `.value`), so it waits for the options too — see `flush`. */\n if (kind === SELECT_REF) (pendingSelects ??= []).push(LATER, [value, element, node]);\n else (value as Applies)._$apply$(element, node as Slot, untracked);\n }\n /**\n * A ref — a function, or an object taking `.value` (core's `ref()`) — is handed its element once the pass's\n * DOM exists: inserted, upgraded, in its own document. Queued at most once per pass (`_state`), and the\n * flush reads whatever the binding holds THEN, so a ref replaced, removed or torn down in the meantime is\n * never handed a stale element.\n */\n else if ((typeof value === 'function' || typeof value === 'object') && (node as Slot)._state === 0) {\n (node as Slot)._state = 1;\n (pendingRefs ??= []).push(bindings, slot);\n }\n }\n};\n\n/**\n * Tells what an instance holds that it is going away: a ref is released (`null`, so a component reading\n * it after a subtree was replaced does not get a detached element back), and a child position that\n * became a part passes the news down. Reached only when `notifyOnRemoval` is set.\n */\nconst teardown = (instance: Instance) => {\n const kinds = instance._template.$K;\n const bindings = instance._bindings;\n /** An instance hook is told, with its state: it unmounts what it mounted, and one not yet mounted never mounts. */\n if (instance._template.$X) {\n const at = kinds.length * 2;\n const state = bindings[at];\n if (state !== undefined) {\n bindings[at] = undefined;\n instance._template._$inst$!.$q(state);\n }\n }\n for (let i = 0; i < kinds.length; i++) {\n const value = bindings[i * 2 + 1];\n if (kinds[i] === REF || kinds[i] === SELECT_REF) {\n /** A ref still queued was never handed its element, so it is not told it is gone. */\n if ((bindings[i * 2] as Slot)._state !== 1) release(value);\n bindings[i * 2 + 1] = UNSET;\n } else if (value === UPGRADED) (bindings[i * 2] as ChildPart)._destroy();\n }\n};\n/** A list item is going away for good. */\nconst detachItem = (item: Item) => (item instanceof ChildPart ? item._destroy() : teardown(item));\n\n/**\n * Tells a ref its element is no longer its: a function is called with `null`, an object's `.value` becomes\n * `null` (core's `ref()` — \"deliberately nothing\"). A value with `_$apply$` owns its own lifecycle.\n */\nconst release = (value: unknown) => {\n if (typeof value === 'function') applyRef(value as (element: Element | null) => void, null);\n else if (value !== null && typeof value === 'object' && value !== UNSET && (value as { _$apply$?: unknown })._$apply$ === undefined)\n (value as { value: unknown }).value = null;\n};\n\n/** A single property read — it runs once per list item per render. */\nconst isTemplateResult = (value: object): value is TemplateResult =>\n (value as TemplateResult).strings !== undefined;\n\n/** What a ChildPart holds. */\n\n\n/** Removal is a move into this fragment, then one clear. */\nconst SCRATCH = doc.createDocumentFragment();\n\n/**\n * Internals the hydrate entry adopts through. The base entry (`index.ts`) re-exports none of them, so its bundle\n * tree-shakes them away; the hydrate bundle inlines this module and reaches them.\n */\nexport {\n setProfileHook,\n PROFILE_UPDATE,\n PROFILE_CREATE,\n PROFILE_REBUILD,\n PROFILE_FRAME_START,\n PROFILE_FRAME_END,\n getTemplate,\n resolved,\n Instance,\n ChildPart,\n Slot,\n comment,\n toText,\n isTemplateResult,\n rootParts,\n registry,\n renderRoot,\n UNSET,\n UPGRADED,\n IGNORED,\n CHILD,\n SOLE,\n EVENT,\n ADOPT,\n TEXT,\n TEMPLATE,\n LIST,\n NODE,\n PROPERTY,\n LIVE,\n};\nexport type { Template };\n\n/** A list item: an instance of a single-root template (its element is its whole range), or a markered part. */\nexport type Item = Instance | ChildPart;\n\n/**\n * A value that names the strategy able to reconcile a list of its kind — `keyed()` is the producer.\n * It lives here rather than in `types.ts` because it names `ChildPart`, a runtime class of this file.\n */\nexport type ListStrategy = (part: ChildPart, values: unknown[], items: Item[], parent: Node, end: Node | null) => Item[];\n\n/** A `TemplateResult` that `keyed()` marked with its strategy. */\nexport interface KeyedResult extends TemplateResult {\n $r?: ListStrategy;\n}\n\n/**\n * A child position that holds anything but plain text: a template, a list, a node, or nothing — or\n * text it took over from an upgraded binding. It owns the range between two comment markers\n * — the root part's too, so content before and after a render stays — or, for a SOLE position, its element's whole\n * content (`$w`, no markers at all).\n *\n * **The ownership invariant — whoever writes an element's content owns it, and owns its verification.** Two cases:\n * a PLAIN element whose whole content is one binding belongs to that binding (the part is its range, and hydration\n * adopts it with no markers); a CUSTOM element's children belong to the component (a binding inside it keeps its\n * markers, and hydration compares them only when the template itself writes content inside the tag). Slots\n * inherit both.\n */\nclass ChildPart {\n $s: Comment | null;\n $e: Node | null;\n /** The element this part owns entirely (a SOLE position), or `null` for a part between markers. */\n $w: Node | null = null;\n $o = EMPTY;\n $v: unknown = undefined;\n $l: Text | null = null;\n $n: Instance | null = null;\n $i: Item[] | null = null;\n /** The key a keyed list reads when this part is one of its items. */\n $k: unknown = undefined;\n /** Instances `hold()` parked here, by template identity — they outlive interim content. */\n _held: Map<TemplateStringsArray, Instance> | null = null;\n /** Whatever the last `_$child$` applier returned here (its continuity), and which applier that was. */\n $z: unknown = undefined;\n $a: unknown = undefined;\n /** Released: its component was removed, and every user value it held dropped (see `releaseRoot`). */\n $x = false;\n /** The container whose render attached the applier — a later `_$commit$` runs as a render of it. */\n declare $R?: Node | null;\n\n constructor(start: Comment | null, end: Node | null) {\n this.$s = start;\n this.$e = end;\n }\n\n _insert(node: Node) {\n const placed = __DEV__ ? landing(node) : undefined;\n (this.$w ?? this.$s!.parentNode!).insertBefore(node, this.$e);\n if (__DEV__) checkForeign(this.$w ?? this.$s!.parentNode!, placed!);\n }\n\n /**\n * Tells the CURRENT content that it is going away — the part itself stays, so what `hold()` parked here stays\n * parked and can still come back. Reached only when `notifyOnRemoval` is set.\n */\n _detach() {\n if (this.$a !== undefined) (this.$a as Applier)._$detach$?.(this.$z);\n if (this.$n !== null) teardown(this.$n);\n const items = this.$i;\n if (items !== null) for (let i = 0; i < items.length; i++) detachItem(items[i]);\n }\n\n /** The part itself is going away: its current content, and everything `hold()` parked here (then collectable). */\n _destroy() {\n this._detach();\n const held = this._held;\n if (held !== null) {\n for (const instance of held.values()) teardown(instance);\n this._held = null;\n }\n }\n\n _clear() {\n if (notifyOnRemoval) this._detach();\n const owner = this.$w;\n const start = this.$s;\n const end = this.$e;\n /** Owning the parent's whole content, one `textContent = ''` replaces a removal per node. */\n if (owner !== null) {\n if (__DEV__ && ownedRoots!.has(owner)) checkDropped(owner);\n owner.textContent = '';\n }\n else if (start!.previousSibling === null && end!.nextSibling === null) {\n const parent = start!.parentNode!;\n parent.textContent = '';\n parent.appendChild(start!);\n parent.appendChild(end!);\n } else {\n const parent = start!.parentNode!;\n let node = start!.nextSibling;\n /** `node !== null` is a backstop: a detached boundary leaves nodes behind rather than throwing mid-render. */\n while (node !== null && node !== end) {\n const next = node.nextSibling;\n parent.removeChild(node);\n node = next;\n }\n }\n this.$o = EMPTY;\n this.$l = null;\n this.$n = null;\n this.$i = null;\n this.$z = undefined;\n this.$a = undefined;\n }\n\n /**\n * How a `_$child$` applier renders — `_$`-named so it survives mangling, because third parties call\n * it. Its own state survives its own commit. A commit that arrives outside its container's render (an\n * applier resolving later) runs as a render of that container, while it still contains the part.\n */\n _$commit$(value: unknown) {\n const applierState = this.$z;\n const applier = this.$a;\n if (renderRoot !== this.$R || renderRoot === null)\n commitAs(this.$R != null && this.$R.contains(this.$w ?? this.$s) ? this.$R : null, this, value, this.$R ?? null);\n else this.$p(value);\n this.$z = applierState;\n this.$a = applier;\n }\n\n $p(value: unknown) {\n if (value == null) {\n if (this.$o !== EMPTY) this._clear();\n return;\n }\n if (typeof value !== 'object') {\n if (__DEV__ && typeof value === 'boolean' && (this.$o !== TEXT || this.$v !== value)) warnBooleanChild(value);\n if (this.$o === TEXT) {\n if (this.$v !== value) this.$l!.data = value as string;\n } else {\n if (this.$o !== EMPTY) this._clear();\n this._insert((this.$l = doc.createTextNode(value as string)));\n this.$o = TEXT;\n }\n this.$v = value;\n return;\n }\n /** `hold()` wraps a template as `{ $h }`: the one it replaces is parked by template identity, not destroyed. */\n const held = (value as { $h?: TemplateResult }).$h;\n if (held !== undefined || isTemplateResult(value)) {\n const result = held ?? (value as TemplateResult);\n /** The hottest line of a list update: same strings, commit the values and nothing else. */\n if (this.$o === TEMPLATE && this.$n!._strings === result.strings) {\n if (__DEV__ && profileHook !== null) profileHook(PROFILE_UPDATE, this, result.strings);\n update(this.$n!, result.values);\n return;\n }\n if (__DEV__ && profileHook !== null) profileHook(this.$o === TEMPLATE ? PROFILE_REBUILD : PROFILE_CREATE, this, result.strings);\n let instance: Instance | undefined;\n if (held !== undefined) {\n const parked = (this._held ??= new Map());\n if (this.$o === TEMPLATE) {\n const current = this.$n!;\n const root = current.$R;\n /** A fragment root takes its nodes back; an element root IS the range. */\n if (root.nodeType === 11) {\n let node = this.$w !== null ? this.$w.firstChild : this.$s!.nextSibling;\n while (node !== this.$e) {\n const next = node!.nextSibling;\n root.appendChild(node!);\n node = next;\n }\n } else root.parentNode?.removeChild(root);\n /**\n * Off the page now: slots watches what a parked branch's slots hold (`_$parked$`, off-chain like `_$done$`), told\n * WHOSE render parked it — the branch has left that host's subtree, where its one registration cannot see it.\n */\n (registry as { _$parked$?: (root: Node, owner: Node | null) => void } | null)?._$parked$?.(root, renderRoot);\n parked.set(current._strings, current);\n this.$o = EMPTY;\n }\n /** The map holds exactly what is PARKED: an instance coming back leaves it, so a later clear cannot strand it there. */\n instance = parked.get(result.strings);\n if (instance !== undefined) parked.delete(result.strings);\n }\n if (this.$o !== EMPTY) this._clear();\n if (instance === undefined) {\n let template = getTemplate(result);\n if (template.$X) template = resolved(template, this.$w ?? this.$s!.parentNode!);\n instance = instantiate(template, result, passDoc);\n this._insert(instance.$R);\n } else {\n /** Inserted first, then updated, as every update is: its nodes are live when its values commit. */\n this._insert(instance.$R);\n update(instance, result.values);\n }\n this.$n = instance;\n this.$o = TEMPLATE;\n return;\n }\n /** A value kind a module handles (`'value'` insert) — how a kind becomes a package, not a branch here. */\n const handlers = registry?.get('value') as ValueHandler[] | undefined;\n if (handlers !== undefined) for (let i = 0; i < handlers.length; i++) if (handlers[i](this, value)) return;\n if (Array.isArray(value)) return this._commitList(value);\n /**\n * Any other iterable is a list — but a node is placed, not iterated (a `<select>`, a `<form>`). Hydration's\n * `adoptObject` decides the same with its own lines: `tests/renderer-list-twins.test.mjs` keeps the two equal.\n */\n if (typeof (value as Iterable<unknown>)[Symbol.iterator] === 'function' && (value as Node).nodeType === undefined)\n return this._commitList([...(value as Iterable<unknown>)]);\n /**\n * A value that applies itself at a child position: `_$child$(part, previous)` renders through\n * `part._$commit$` and returns its continuity, handed back next time — to THIS applier only.\n */\n const applyChild = (value as { _$child$?: Applier })._$child$;\n if (applyChild !== undefined) {\n const previous = this.$a === applyChild ? this.$z : undefined;\n /**\n * An applier written as an object-literal method is a new function every call, so `previous` is always\n * undefined and it restarts every render. Said on the third swap at one part — once or twice is a real change.\n */\n if (__DEV__ && this.$a !== undefined && this.$a !== applyChild) {\n const swaps = (applierSwaps.get(this) ?? 0) + 1;\n applierSwaps.set(this, swaps);\n if (swaps === 3)\n console.warn(diagnostic('renderer', 'a child applier', 'applier-identity', __DEV__ && PROSE['applier-identity'](String(swaps))));\n }\n this.$a = applyChild;\n this.$R = renderRoot;\n if (applyChild._$detach$ !== undefined) notifyOnRemoval = true;\n this.$z = applyChild.call(value, this, previous);\n return;\n }\n if ((value as Node).nodeType !== undefined) {\n if (this.$o !== NODE || this.$v !== value) {\n if (this.$o !== EMPTY) this._clear();\n this._insert(value as Node);\n this.$v = value;\n this.$o = NODE;\n }\n return;\n }\n this.$p(String(value));\n }\n\n /** Creates one list item before `ref`. */\n $c(value: unknown, parent: Node, ref: Node | null): Item {\n if (value !== null && typeof value === 'object' && isTemplateResult(value)) {\n let template = getTemplate(value);\n if (template.$X) template = resolved(template, parent);\n if (template.$R.nodeType === 1) {\n const instance = instantiate(template, value, passDoc);\n into(parent, ref).insertBefore(instance.$R, ref);\n if (__DEV__) checkForeign(parent, [instance.$R]);\n instance.$k = value.key;\n /** Only a result marked `_$same$` (the keyed module marks its rows') records its identity. */\n if ((value as { _$same$?: unknown })._$same$ === 1) instance.$j = value;\n return instance;\n }\n }\n const part = markered(parent, ref);\n part.$p(value);\n part.$k = (value as TemplateResult | null)?.key;\n return part;\n }\n\n /** Commits `value` into an item; returns the item now standing there (an instance whose shape changed becomes a part). */\n $u(item: Item, value: unknown): Item {\n /**\n * The very result committed last time, and marked `_$same$`: nothing to do. Asked FIRST: it is the\n * common case of a keyed list's unchanged rows, and a part never records one (`$j` stays undefined).\n */\n if (value === (item as { $j?: unknown }).$j && value !== undefined) return item;\n if (item instanceof ChildPart) {\n item.$p(value);\n return item;\n }\n if (value !== null && typeof value === 'object' && (value as TemplateResult).strings === item._strings) {\n update(item, (value as TemplateResult).values);\n if ((value as { _$same$?: unknown })._$same$ === 1) item.$j = value;\n else if (item.$j !== undefined) item.$j = undefined;\n return item;\n }\n const element = item.$R as Element;\n const part = markered(element.parentNode!, element);\n /** The row's shape changed: the instance is gone for good, so what it holds is told. */\n if (notifyOnRemoval) teardown(item);\n /** `removeChild`, never `remove()`: the element may be a light slot, whose own `remove()` is the user's (slots). */\n element.parentNode?.removeChild(element);\n part.$k = item.$k;\n part.$p(value);\n return part;\n }\n\n /** The item's first node — its move handle and the insertion reference before it. */\n $f(item: Item): Node {\n return item instanceof ChildPart ? item.$s! : item.$R;\n }\n\n /** Moves an item before `ref`. */\n $m(item: Item, ref: Node | null, parent: Node = this.$w ?? this.$s!.parentNode!) {\n const at = into(parent, ref);\n if (!(item instanceof ChildPart)) {\n at.insertBefore(item.$R, ref);\n return;\n }\n let node: Node | null = item.$s!;\n const stop = item.$e!.nextSibling;\n while (node !== stop) {\n const next: Node | null = node!.nextSibling;\n at.insertBefore(node!, ref);\n node = next;\n }\n }\n\n /** Removes an item. */\n $d(item: Item) {\n if (notifyOnRemoval) detachItem(item);\n this.$m(item, null, SCRATCH);\n SCRATCH.textContent = '';\n }\n\n _commitList(values: unknown[]) {\n const count = values.length;\n /**\n * A keyed list names its own strategy (`keyed()` stamps `$r`). Keyed and index items are the same\n * kind of item — an unkeyed one carries `$k === undefined`, which a keyed pass treats as not found —\n * so a list can change between the two without being rebuilt.\n */\n const strategy = count ? (values[0] as KeyedResult | null)?.$r : undefined;\n if (this.$o !== LIST) {\n if (this.$o !== EMPTY) this._clear();\n this.$i = [];\n this.$o = LIST;\n }\n const items = this.$i!;\n if (count === 0) {\n if (items.length) {\n this._clear();\n this.$i = [];\n this.$o = LIST;\n }\n return;\n }\n const parent = this.$w ?? this.$s!.parentNode!;\n const end = this.$e;\n if (strategy !== undefined) {\n this.$i = strategy(this, values, items, parent, end);\n return;\n }\n /** Index mode: update in place, grow at the end, shrink from the end. Rows go straight into the parent. */\n const shared = items.length < count ? items.length : count;\n for (let i = 0; i < shared; i++) items[i] = this.$u(items[i], values[i]);\n for (let i = items.length; i < count; i++) items.push(this.$c(values[i], parent, end));\n if (count < items.length) {\n if (notifyOnRemoval) for (let i = count; i < items.length; i++) detachItem(items[i]);\n for (let i = count; i < items.length; i++) this.$m(items[i], null, SCRATCH);\n SCRATCH.textContent = '';\n items.length = count;\n }\n }\n}\n\n/** A value at a child position a module claims — the `'value'` insert. Return `true` to take it. */\ntype ValueHandler = (part: object, value: unknown) => boolean | void;\n/** An element-position value that applies itself — a spread. */\ntype Applies = { _$apply$: (element: Element, key: object, run: Untracked, adopting?: boolean) => void };\n\n/** A child-position applier: renders through `part._$commit$`, keeps continuity in its return value. */\ntype Applier = ((part: { _$commit$(value: unknown): void }, previous: unknown) => unknown) & {\n /** Told, with its last state, when its position goes away. */\n _$detach$?: (previous: unknown) => void;\n};\n\n/**\n * The registry `renderer.connect` was handed — the app's own, so a CDN page with separate bundles still\n * meets one `'value'`/`'error'` chain. Never imported: a production bundle inlines `@verajs/inserts`.\n */\nlet registry: { get(name: string): unknown[] | undefined } | null = null;\n\n/**\n * Core's `untracked`, taken off that registry at `connect` (`call` without core): what the renderer runs someone\n * else's code through during a render — a ref, and a component's getter it reads on the parent's behalf — so that\n * code's reads subscribe nothing. What the renderer reads ITSELF stays tracked: a store array handed to a template\n * is walked here, and that walk is what subscribes the parent to its length and items.\n */\nlet untracked: Untracked = call;\n\n/** The container of the `renderInto` in progress — a ref's error names its component through it. */\nlet renderRoot: Node | null = null;\n\n/**\n * Whether anything asked to be told when a subtree goes away: a ref to release, an applier with\n * `_$detach$`. Process-wide — an app with neither walks nothing, and a clear stays one `textContent = ''`.\n */\nlet notifyOnRemoval = false;\n\n/** Something adopted must be told when it goes away — an applier with `_$detach$` that hydration adopts. */\nexport const needRemovalWork = () => {\n notifyOnRemoval = true;\n};\n\n\n/**\n * Refs held until the pass's DOM exists, as flat `(bindings, slot)` pairs: each is handed its element once that\n * element is inserted, upgraded and in its own document. A render flushes only what it queued, so a nested render\n * cannot apply its caller's early. Refs run in commit order, which is document PRE-order — `<div ${a}>${child}</div><p\n * ${b}>` runs a, then the child's refs, then b — not all parents first.\n */\nlet pendingRefs: unknown[] | null = null;\n/**\n * **A `<select>`'s selection is written when the pass ends**, once its options exist. In document order a binding ON\n * the select comes before the options inside it, so a selection written in place — `.value`, `!value`,\n * `.selectedIndex`, or a spread's key — found no options and fell back to the first. Every source of options is\n * content inside the select (a list, a nested template, a keyed list: the content model allows only `<option>`,\n * `<optgroup>` and `<hr>`), so all of it exists when the pass ends. Options a user's code appends later are out of\n * scope.\n *\n * Flat PAIRS, one queue, in commit order. The common record is `(select, value)` for a `value` binding — compared\n * against the live value and written only on a difference (the write resets every option). The rare ones are\n * `(LATER, [select, index])` for `selectedIndex` and `(LATER, [applier, element, slot])` for a value applying itself\n * on a select, a spread. Flushed first, so a ref on the select sees its selection. A render flushes only what it\n * queued, however it ends, so nothing it held can land on a later, unrelated render.\n *\n * The shape is measured, on a table with a bound select per row: committing\n * each instance's selects after its own bindings, 2–4% slower; deferring the whole binding to a second commit,\n * 8–13%; records of three with the name in them, 3–6%. Pairs whose common case is exactly `(select, value)` tie.\n */\nconst LATER = {};\nlet pendingSelects: unknown[] | null = null;\nconst flush = (selectsFrom: number, refsFrom: number) => {\n const selects = pendingSelects;\n if (selects !== null && selects.length > selectsFrom) {\n const mine = selects.splice(selectsFrom);\n if (selects.length === 0) pendingSelects = null;\n for (let i = 0; i < mine.length; i += 2) {\n const a = mine[i];\n const b = mine[i + 1];\n if (a === LATER) {\n const r = b as unknown[];\n /** Read and written BY NAME: a computed `select[name]` on a DOM accessor measured 5% slower. */\n if (r.length === 2) {\n if ((r[0] as HTMLSelectElement).selectedIndex !== r[1]) (r[0] as HTMLSelectElement).selectedIndex = r[1] as number;\n } else (r[0] as Applies)._$apply$(r[1] as Element, r[2] as Slot, untracked);\n } else if ((a as HTMLSelectElement).value !== b) (a as HTMLSelectElement).value = b as string;\n }\n }\n /** Taken off first: a ref can render again. */\n const refs = pendingRefs;\n if (refs === null || refs.length <= refsFrom) return;\n const mine = refs.splice(refsFrom);\n if (refs.length === 0) pendingRefs = null;\n /** A ref is someone else's code: what it reads must not subscribe the render that handed it the element. */\n untracked(applyRefs, mine);\n};\n\n/**\n * Refs, and instance mounts, in commit order — once the pass's DOM exists, so a claim sees the finished tree. (A\n * claim that RELOCATES a node — elements', slots' — may run after refs inside it, so such a ref saw its element before\n * the move: the same element, but pre-claim geometry. Measure in a mount, or after the render, not in a ref.)\n */\nconst applyRefs = (mine: unknown[]) => {\n for (let i = 0; i < mine.length; i += 2) {\n const bindings = mine[i] as unknown[];\n const at = mine[i + 1] as number;\n if (typeof at !== 'number') {\n (mine[i] as InstanceHook).$m(at);\n continue;\n }\n const record = bindings[at] as Slot;\n const value = bindings[at + 1];\n record._state = 0;\n if (typeof value === 'function') applyRef(value as (element: Element | null) => void, record._element);\n else if (value !== null && typeof value === 'object' && value !== UNSET) (value as { value: unknown }).value = record._element;\n }\n};\n\n/**\n * The document the pass renders into — the container's own (a popped-out window's, an iframe's), so every\n * instance is built in its realm. Read off the container once per pass, never off a node that may still sit\n * in the inert template document.\n */\nlet passDoc: Document = doc;\n\n/**\n * Preserves the DOM of a template a position toggles away from, instead of destroying it — form values\n * and media state survive the round trip. Anything that is not a template passes straight through, so\n * `hold(editing && editor())` is fine.\n *\n * ```js\n * html`<div>${hold(editing ? editor() : viewer())}</div>`\n * ```\n */\nexport const hold = <T>(result: T): T | { $h: TemplateResult } =>\n result != null && typeof result === 'object' && isTemplateResult(result) ? { $h: result as TemplateResult } : result;\n\n/**\n * **Where an insert before `ref` goes** — the parent given, unless light-DOM slots moved `ref` (it marks what it moves,\n * `_$slotted$`, sigiled so both bundles read it): then `ref`'s own, which is where the light child now lives. A node\n * anything ELSE moved is not followed — the insert throws as it always has, rather than land in a stranger's container.\n */\nconst into = (parent: Node, ref: Node | null): Node =>\n ref !== null && (ref as { _$slotted$?: boolean })._$slotted$ ? ref.parentNode! : parent;\n\n/** A fresh part whose two markers sit before `ref` in `parent`. */\nconst markered = (parent: Node, ref: Node | null) => {\n const end = comment();\n const part = new ChildPart(comment(), end);\n const at = into(parent, ref);\n at.insertBefore(part.$s!, ref);\n at.insertBefore(end, ref);\n return part;\n};\n\n/**\n * Commits `value` into `part` as a render of `root`: the root and its document are set and restored (a render\n * can run inside another's commit), and the work this pass queued is flushed however it ends — before the\n * restore, so a ref's error still names its own component and a ref that renders renders into this document.\n * `home` is where the document comes from when `root` is not the render being attributed: the container an\n * applier was attached under, even after the part has moved out of it (a parked `hold` fragment belongs to the\n * inert template document, and must never become the document a render builds in).\n */\nconst commitAs = (root: Node | null, part: ChildPart, value: unknown, home: Node | null = root) => {\n const outer = renderRoot;\n const outerDoc = passDoc;\n const selectsMark = pendingSelects?.length ?? 0;\n const refsMark = pendingRefs?.length ?? 0;\n const outerScope = scope;\n scope = null;\n renderRoot = root;\n /** A document's own `ownerDocument` is null — so a document container is its own. */\n if (home !== null) {\n const owner = home.ownerDocument ?? (home as Document);\n /**\n * **Content builds in the realm of the element it renders into** (2026-10-22). A component of THIS realm moved\n * into a pop-out or an iframe keeps building here: made through that window's document, its children would be looked\n * up in THAT window's registry — Chromium upgrades them anyway, Firefox and WebKit leave them inert; cloned through\n * this renderer's own document they upgrade at the clone on all three and keep their class once inserted there\n * (adoption; BROWSER-LEDGER 2026-10-22). An element of the OTHER realm — a plain container that window made, or a\n * component its own registry defined — builds in its own document, with that window's classes\n * (`tests/browser/realm.test.js`). Checked only for a container in another window (\"not ours, and has a window\" — a\n * document with a window is that window's only one); a windowless document (a server's, a template's) is used as is.\n */\n passDoc =\n owner !== doc && owner.defaultView !== null && ((root as ShadowRoot | null)?.host ?? root) instanceof (doc.defaultView as typeof globalThis).HTMLElement\n ? doc\n : owner;\n }\n /** Development: a commit into an owned root is that root's own work (see `strays`). */\n const marking = __DEV__ && root !== null && ownedRoots!.has(root) && !rendering!.has(root);\n if (marking) {\n sweepStrays();\n rendering!.add(root!);\n }\n try {\n part.$p(value);\n } finally {\n flush(selectsMark, refsMark);\n if (marking) {\n sweepStrays();\n rendering!.delete(root!);\n }\n renderRoot = outer;\n passDoc = outerDoc;\n scope = outerScope;\n }\n};\n\n\n/**\n * **Each root's part, kept ON the root** — under this renderer copy's own `Symbol` (2026-10-17). It was a WeakMap keyed\n * by DOM nodes, and that cost every component's creation and removal in both engines' collectors: fresh-browser races\n * of shadow components put it at ~11% in Firefox and ~9% in Chrome (Firefox's sweep and mark phases, per entry). A field\n * is an ordinary property, freed with its root. **A Symbol, never a string:** a page can hold two renderer copies (a CDN\n * bundle beside an app's, two versions), and a string-named field — lit's `_$litPart$` — would hand one copy the\n * other's part; per-copy, each sees only its own, as with the WeakMap. Root → part → root is a DOM↔JS cycle only\n * Firefox's cycle collector frees, so a released root's part lets go of its root (`releaseRoot`).\n */\nconst PART = Symbol();\ntype Rooted = Node & { [PART]?: ChildPart };\nconst rootParts = {\n get: (node: Node) => (node as Rooted)[PART],\n set: (node: Node, part: ChildPart) => {\n (node as Rooted)[PART] = part;\n },\n};\n\n/**\n * **A root the template OWNS** (`foreignNodes: 'drop'`, 2026-10-16: shadow component roots). Core's render hook\n * says so with its third argument — a container handed to `renderInto` directly never does — and it is taken only for a\n * SHADOW root EMPTY at its first render: a declarative (server) root and one holding styles' text fallback are not empty,\n * and keep their markers. No marker comments: the part owns the root's whole content (`$w`, as a sole binding owns its\n * element), so a template change clears it with one `textContent = ''` — foreign nodes included — and an ordinary\n * re-render touches nothing it did not render. Where new content lands relative to a foreign node is not promised.\n */\nconst owned = (container: Node) => {\n const part = new ChildPart(null, null);\n part.$w = container;\n if (__DEV__) watchOwned(container);\n return part;\n};\n\n/**\n * **Development: what an owned root's clear drops.** Nodes the RENDER placed are its own; anything placed while no render\n * of that root was running is foreign. One observer (built from the first owned root's own window) watches every owned\n * root's direct children; its records are sorted at each commit's start and end — so whatever arrives between renders is\n * foreign, and whatever a render inserts is not — and once more at a clear, which then names a foreign node it is about to\n * remove. Production keeps none of it: the clear is the same in both builds, only the line is development's.\n * **Best-effort across windows:** ONE observer serves every window, so a root that moves to another window stays on the\n * observer that sweeps it (one per window would sweep the new window's while the records sat in the old one's, and call\n * the root's own renders foreign). Should the window it was built from go away and take the observer with it, the\n * warning goes quiet; what a clear removes never depends on it.\n */\nconst strays = __DEV__ ? new WeakSet<Node>() : null;\nconst ownedRoots = __DEV__ ? new WeakSet<Node>() : null;\nconst rendering = __DEV__ ? new Set<Node>() : null;\nlet strayWatch: MutationObserver | null | undefined;\nconst sortStrays = (records: MutationRecord[]) => {\n for (const record of records) {\n const own = rendering!.has(record.target);\n for (const node of record.addedNodes)\n if (own) strays!.delete(node);\n else strays!.add(node);\n }\n};\nconst sweepStrays = () => {\n if (strayWatch) sortStrays(strayWatch.takeRecords());\n};\nconst watchOwned = (container: Node) => {\n ownedRoots!.add(container);\n if (strayWatch === undefined) {\n const View = (container.ownerDocument?.defaultView as (typeof globalThis) | null | undefined)?.MutationObserver;\n strayWatch = View ? new View(sortStrays) : null;\n }\n strayWatch?.observe(container, { childList: true });\n};\n/** Development: whether a clear is dropping a node the template did not make, said once per page. */\nconst checkDropped = (owner: Node) => {\n sweepStrays();\n if (hasWarned('foreign-dropped')) return;\n for (let node = owner.firstChild; node !== null; node = node.nextSibling)\n if (strays!.has(node)) {\n const host = (owner as ShadowRoot).host;\n warnOnce('renderer', host ? `<${host.localName}>` : 'renderInto', 'foreign-dropped', __DEV__ && (() => PROSE['foreign-dropped'](describe(node))));\n return;\n }\n};\n/** Development: a node named in the drop warning — its tag, or its kind. */\nconst describe = (node: Node) => (node.nodeType === 1 ? `<${(node as Element).localName}>` : node.nodeType === 3 ? 'a text node' : 'a comment');\n\n/** `hydration`'s adoption, installed through the hand-off (`$Y`): true when it adopted the container. */\nlet adopt: ((result: unknown, container: Node) => boolean) | undefined;\n\n/**\n * The container is the argument people forget, and forgetting it failed with `Cannot read properties of undefined`\n * — a message about the internals of a function the caller never named. Development only; the hydrate entry calls\n * it too, since it reads the container before it reaches the base render.\n */\nexport const expectContainer = (container: unknown) => {\n if (!container || typeof (container as Node).appendChild !== 'function')\n throw new TypeError(misuse('renderInto', 'no-container', __DEV__ && PROSE['no-container'](String(container))));\n};\n\n/**\n * Writes a template result into a container — the renderer's imperative draw: no reactivity, no\n * lifecycle. The first call appends two markers and anchors a root part between them; later calls reuse it\n * and commit only the values. Content already in the container stays, and so does content other code adds\n * after it — the render owns its range, never the container. lit-html's argument order. The third argument, `owns`, is\n * core's: its render hook passes a component's `foreignNodes: 'drop'` with every render, and a shadow root that is empty\n * at its first render is then the template's whole (`owned`). A direct call is a container's, and keeps its markers.\n */\n/**\n * **A removed component's root part, RELEASED** (2026-10-11). Core's teardown calls `$x(container)` (the\n * registry sigil this renderer publishes at connect): every user value the part's tree holds is dropped — each event\n * `Slot`'s handler, each binding's committed value, nested parts, keyed items, `hold()`-parked instances — so the\n * removed DOM keeps no path back into the component's JS (its handlers close over the whole setup scope, and the DOM's\n * own listener lists hold the Slots). That cycle was Firefox's CYCLE collector's to free: with host-capturing handlers,\n * 20 s of CC on a churn page against vanilla `addEventListener`'s 1 s. The DOM itself is LEFT as it is (code holding a\n * removed element still sees its content); the stripped part stays in `rootParts`, flagged, so a RE-ADD finds it,\n * clears its range and renders fresh — never a second copy, and never taken for a server page by hydration.\n */\nconst releaseItem = (item: Item): void => {\n if (item instanceof ChildPart) {\n if (item.$n !== null) releaseItem(item.$n);\n const items = item.$i;\n if (items !== null) for (let i = 0; i < items.length; i++) releaseItem(items[i]!);\n item._held?.forEach(releaseItem);\n item.$v = item.$z = item.$a = undefined;\n item.$n = null;\n item.$i = null;\n item._held = null;\n return;\n }\n const bindings = item._bindings;\n for (let i = 0; i < bindings.length; i += 2) {\n const target = bindings[i];\n if (target instanceof Slot) target._handler = null;\n else if (target instanceof ChildPart) releaseItem(target);\n bindings[i + 1] = undefined;\n }\n};\n/**\n * Called with the removed ELEMENT: a light component's part is keyed by the element itself (a hit); a shadow one's by its\n * root. The part STAYS in `rootParts`, stripped and flagged (`$x`) — no map work per removal; a re-add finds the flag.\n */\nconst releaseRoot = (element: Node) => {\n const part = rootParts.get(element) ?? rootParts.get((element as Element).shadowRoot ?? element);\n if (part === undefined || part.$x) return;\n releaseItem(part);\n part.$x = true;\n /**\n * An OWNED root's part lets go of its root, so the removed root and its part are no cycle for Firefox's cycle collector\n * (−113 ms of incremental CC on a churn page, 2026-10-17); `reviveRoot` gives it back. A markered part keeps its two\n * markers: a re-add clears between them.\n */\n if (part.$s === null) part.$w = part.$l = part.$R = null;\n};\n/**\n * **A released component is coming back** — core calls `$y(element)` as a re-init starts, BEFORE its `'init'` inserts:\n * an OWNED released root is cleared now, so what those inserts put in the root (styles' `<style>` fallback in a window that\n * cannot adopt the sheet) is never in the way of the clear. An owned root has no markers to bound it, so this is the\n * only moment its own content and theirs are told apart without holding a node (a part holding the removed root's\n * nodes cost Firefox's churn 2.3%, 2026-10-16). The first render then draws into an empty part.\n */\nconst reviveRoot = (element: Node) => {\n const container = rootParts.get(element) !== undefined ? element : (element as Element).shadowRoot ?? element;\n const part = rootParts.get(container);\n /**\n * OWNED roots only (no markers): a markered root's own clear stops at its marker, so it waits for the next render as it\n * always did — and a re-init that renders nothing (`init(this)` with no setup, its content drawn by someone else) keeps it.\n */\n if (part === undefined || !part.$x || part.$s !== null) return;\n part.$w = container;\n part.$x = false;\n part._clear();\n};\n\nexport const renderInto = (result: unknown, container: Node, owns?: boolean) => {\n if (__DEV__) expectContainer(container);\n if (__DEV__ && profileHook !== null) profileHook(PROFILE_FRAME_START, container, null);\n let part = rootParts.get(container);\n /** A RE-ADDED component: its released part's old range is cleared, and it renders fresh into it. */\n if (part?.$x) {\n /** An owned part let go of its root at the release; it is this container. */\n if (part.$s === null) part.$w = container;\n part.$x = false;\n part._clear();\n }\n /**\n * A container's FIRST render, with something already in it: `hydration` (when wired) may adopt that as server output\n * of this template — then it is committed, and the render is done. Asked only on a first render, never on the hot\n * path; without hydration it is one undefined read.\n */\n if (part === undefined && adopt !== undefined && container.firstChild !== null && adopt(result, container))\n part = rootParts.get(container)!;\n else {\n if (part === undefined) {\n /**\n * Nothing adopts: whatever recognizes server markup is told before this render would append beside it (light slots)\n * — only a container that HAS something in it; an empty one (every plain component's first render) holds no\n * server markup, and asking it cost Firefox a call per component (2026-10-17 profile).\n */\n if (adopt === undefined && container.firstChild !== null) (registry as { _$unadopted$?: (container: Node) => void } | null)?._$unadopted$?.(container);\n rootParts.set(container, (part = owns === true && container.nodeType === 11 && container.firstChild === null ? owned(container) : markered(container, null)));\n }\n commitAs(container, part, result);\n }\n /**\n * **A render has finished** — said to whatever asked (light-DOM slots, which re-distributes what this render did to\n * a host's light children before anything reads them, and at a container's first render takes what was there before\n * the render's own range — `start` — as its light children). Off-chain and sigiled, like `$t`: not an extension point.\n */\n (registry as { _$done$?: (container: Node, start: Node) => void } | null)?._$done$?.(container, part.$s!);\n if (__DEV__ && profileHook !== null) profileHook(PROFILE_FRAME_END, container, null);\n};\n\n/**\n * Marks the raw function so `wire(renderInto)` — wiring the draw instead of the module — is caught by name in\n * development: the inserts registry reads `$module` and says `did you mean \\`renderer\\``. Production carries neither.\n */\nif (__DEV__) (renderInto as unknown as { $module?: string }).$module = 'renderer';\n\n/** Everything this renderer needs, in one entry: `wire([renderer])`. */\n/** The renderer's connect: core's registry, its untracked primitive, and the hydration hand-off. */\nconst connectTo = (given: { get(name: never): unknown }) => {\n /**\n * **One renderer serves one core** (2026-10-21). Two apps sharing one renderer bundle (two cores, the\n * micro-frontend shape) leave it following the LAST core's seams — `untracked` among them — so the first app's\n * tracking silently breaks. It stays last-wins, and says so once in EVERY build — production as a short line with\n * the code's docs link (the hazard exists ONLY in production: development's core copies share one registry). The same registry wired again\n * (`wire([renderer({ shadow })])` after `wire([renderer])`) is not a second core.\n */\n if (registry !== null && registry !== given) {\n console.warn(__DEV__ ? diagnostic('renderer', 'renderer', 'renderer-two-cores', __DEV__ && PROSE['renderer-two-cores']()) : '[vera] renderer-two-cores');\n }\n registry = given as { get(name: string): unknown[] | undefined };\n untracked = (given as { $t?: Untracked }).$t ?? call;\n /**\n * Development: \"the full renderer is connected\" (Brian's ruling, 2026-11-12). Automatic lists (`lists`) commit their rows through\n * this renderer's 'value' insert; wired beside only a bare render descriptor (`{ on: 'render', fn: renderInto }`),\n * which never connects, each row's change re-renders its parent instead, and core's `mapped` says so once.\n */\n if (__DEV__) (given as { $rn?: true }).$rn = true;\n /** Defined up front, so every render's `_$done$` read is a HIT on a page without slots — not a miss down the Map's chain. */\n (given as { _$done$?: unknown })._$done$ ??= undefined;\n /** The release core's teardown calls with a removed component (see `releaseRoot`). */\n (given as { $x?: (container: Node) => void }).$x = releaseRoot;\n /** …and the revival core's re-init calls before its `'init'` inserts (see `reviveRoot`). */\n (given as { $y?: (container: Node) => void }).$y = reviveRoot;\n /**\n * **The hydration hand-off** — the one door `hydration` reaches this renderer's internals through (a separately\n * bundled module cannot import them, and production mangles their names): only values the renderer already holds,\n * so it pulls no code in. An ARRAY, read by the `HANDOFF_*` positions in `kinds.ts` (names would cost every app\n * bytes). Position 0 is its protocol number; on a mismatch hydration declines and the page renders fresh, with a\n * warning. Positions 0 and 1 are FROZEN — the same in every protocol — so a mismatched hydration can still clear\n * server markup.\n */\n (given as { $H?: unknown }).$H = [\n PROTOCOL, // HANDOFF_PROTOCOL\n (fn: typeof adopt) => (adopt = fn), // HANDOFF_ADOPTER\n getTemplate, // HANDOFF_GET_TEMPLATE\n ChildPart, // HANDOFF_CHILD_PART\n Instance, // HANDOFF_INSTANCE\n Slot, // HANDOFF_SLOT\n UNSET, // HANDOFF_UNSET\n UPGRADED, // HANDOFF_UPGRADED\n commit, // HANDOFF_COMMIT\n commitAs, // HANDOFF_COMMIT_AS\n hookUp, // HANDOFF_HOOK_UP\n resolved, // HANDOFF_RESOLVE\n rootParts, // HANDOFF_ROOTS\n toText, // HANDOFF_TO_TEXT\n needRemovalWork, // HANDOFF_REMOVAL_WORK\n ];\n};\n\n/**\n * Whether this process is a SERVER: `@verajs/ssr` sets this public flag at import. Read ONCE, as this module loads — a\n * server always imports ssr first, because this module reads `document` as it loads and only ssr's DOM provides one.\n */\nconst onServer = (globalThis as { __veraSsrShimmed?: boolean }).__veraSsrShimmed === true;\n\ntype Registry = { get(name: never): unknown; $S?: unknown; $F?: unknown };\n/**\n * What a consumer's TypeScript sees — the shape `wire` accepts (`Wireable`, structurally: this package imports no\n * types from `@verajs/inserts`): a DESCRIPTOR, `on: 'render'`, callable with options to give `[renderer, a connector]`.\n * On a server `on` is in fact `undefined` (decided at load, below) — a runtime decision the type does not carry, as\n * the previous `on: 'render' | undefined` did: that matched neither a descriptor nor a connector, so `wire([renderer])`\n * stopped compiling in a consumer's project (tests/consumer, 2026-10-10).\n */\ntype RendererModule = ((options?: { shadow?: 'open' | 'closed' | false | ShadowRootInit; foreignNodes?: 'preserve' | 'drop' }) => readonly [RendererModule, (registry: Registry) => void]) & {\n readonly on: 'render';\n fn: never;\n priority: number;\n connect: (given: Registry) => void;\n};\n\n/**\n * **`renderer` is a DUAL** — `wire([renderer])` as it always was, or `wire([renderer({ shadow: 'open' })])` to set the\n * app's default root: every component whose own `shadow` option says nothing gets it (core's `init` reads it after the\n * component's own and before light DOM). `renderer({ foreignNodes: 'preserve' })` is the same for `foreignNodes`, and sets\n * COMPONENT roots only — a container handed to `renderInto` (`document.body`, `#app`) always keeps foreign nodes. Called, it returns `[renderer, a connector setting the default]` — `wire`\n * takes nested arrays — so the module is one function with its descriptor fields on it, and nothing is made per call\n * but that connector.\n *\n * **On a server it declines its render insert** (Brian's (b′), 2026-10-10): `@verajs/ssr` renders with its own renderer,\n * and a client one wired in shared app code used to DISPLACE it, breaking every server render. There `on` is undefined,\n * which makes `wire` hand this function the registry as a CONNECTOR: it still CONNECTS — the registry, `untracked`, the\n * hydration hand-off: a process that loaded ssr may install a client DOM and call renderInto directly (tests/spread-ssr\n * does) — and only the render INSERT is declined, so one shared `wire([renderer({ shadow })])` carries the same default\n * to both sides. Development says so once per process.\n */\nexport const renderer = Object.assign(\n (given?: { shadow?: unknown } | Registry) => {\n if ((given as Registry | undefined)?.get) {\n connectTo(given as Registry);\n /** Development: the decline is said once per process. */\n if (__DEV__) warnOnce('renderer', 'wire([renderer])', 'renderer-on-server', __DEV__ && (() => PROSE['renderer-on-server']()));\n return;\n }\n if (__DEV__ && given != null && typeof given !== 'object') {\n console.warn(diagnostic('renderer', 'renderer()', 'renderer-options', __DEV__ && PROSE['renderer-options'](typeof given === 'string' ? `'${given}'` : String(given))));\n return [renderer];\n }\n if (__DEV__)\n for (const key in given as object)\n if (key !== 'shadow' && key !== 'foreignNodes')\n console.warn(diagnostic('renderer', 'renderer()', 'unknown-option', __DEV__ && SHARED.unknownOption(key, 'foreignNodes, shadow')));\n const shadow = (given as { shadow?: unknown } | undefined)?.shadow;\n const foreignNodes = (given as { foreignNodes?: unknown } | undefined)?.foreignNodes;\n return [\n renderer,\n (registry: Registry) => {\n if (shadow !== undefined) registry.$S = shadow;\n if (foreignNodes !== undefined) registry.$F = foreignNodes;\n },\n ];\n },\n { on: onServer ? undefined : ('render' as const), fn: renderInto as never, priority: 50, connect: connectTo }\n) as unknown as RendererModule;\n/** Development: the name the collision warning reports (`wire`'s name bookkeeping is development-only). */\nif (__DEV__) Object.defineProperty(renderer, 'name', { value: '@verajs/renderer' });\n\n/**\n * Development: `renderInto` is the draw, not the module — `wire([renderInto])` would be taken as a connector and\n * register nothing, silently. `wire` reads this mark and names `renderer` instead. Production carries\n * neither.\n */\nif (__DEV__) (renderInto as unknown as { $module?: string }).$module = 'renderer';\n"],"names":["adoptProperty","element","name","value","adopt","_$adopt$","carrier","Object","getPrototypeOf","desc","getOwnPropertyDescriptor","undefined","set","get","call","_$props$","view","ownerDocument","defaultView","HTMLElement","prototype","SCRIPT_URL","URL_SINK","SCRIPT_URL_ITEM","INLINE_HANDLER","fn","a","b","c","dispatch","holder","event","handler","_handler","_element","handleEvent","isSelection","localName","read","target","key","LIVE","MARKER","INERT_MARKERS","doc","document","comment","createComment","TEXT_END","COMMENT_END","COMMENT2_END","TAG_END","DOUBLE_QUOTE_END","SINGLE_QUOTE_END","RAW_TEXT_TAGS","UNSET","UPGRADED","Template","$R","_plain","$K","$N","$J","$P","_present","$L","$X","constructor","result","strings","count","length","kinds","this","Array","fill","names","statics","present","urls","nodes","rawEnd","markup","regex","open","i","s","match","nameEnd","continues","at","lastIndex","exec","test","RegExp","slice","startsWith","type","_$litType$","createElement","innerHTML","content","firstChild","replaceWith","childNodes","walker","createTreeWalker","node","nextNode","nodeType","data","anchor","createTextNode","currentNode","el","replace","includes","hasAttribute","attribute","getAttributeNames","endsWith","parseInt","getAttribute","split","removeAttribute","written","first","kind","real","toLowerCase","sink","textContent","pieces","p","append","root","nextSibling","parent","parentNode","host","removeChild","path","index","sibling","previousSibling","unshift","push","hooks","registry","readScope","_$at$","_$inst$","_$ns$","scope","resolved","template","templateCache","WeakMap","forged","getTemplate","isArray","hasOwn","toText","Slot","_state","untracked","applyRef","callback","error","handlers","line","reportError","console","reportUncaught","reportTo","renderRoot","Instance","$k","$j","_template","_strings","_bindings","bindings","instantiate","owner","source","cloneNode","importNode","paths","marked","step","hops","instance","hookUp","outer","update","values","adopted","hook","state","$c","pendingRefs","notifyOnRemoval","commit","raw","slot","committed","$p","part","ChildPart","$w","$o","$l","$v","markered","insertBefore","$e","pendingSelects","LATER","parts","url","_$raw$","setAttribute","toggleAttribute","listener","addEventListener","adopting","release","_$apply$","teardown","$q","_destroy","detachItem","item","isTemplateResult","SCRATCH","createDocumentFragment","$s","$n","$i","_held","$z","$a","$x","start","end","_insert","_detach","_$detach$","items","held","_clear","appendChild","next","_$commit$","applierState","applier","commitAs","contains","$h","parked","Map","current","_$parked$","delete","passDoc","_commitList","Symbol","iterator","applyChild","_$child$","previous","String","ref","into","_$same$","$u","$f","$m","stop","$d","strategy","$r","shared","needRemovalWork","applyRefs","mine","record","hold","_$slotted$","home","outerDoc","selectsMark","refsMark","outerScope","selectsFrom","refsFrom","selects","splice","r","selectedIndex","refs","flush","PART","rootParts","releaseItem","forEach","releaseRoot","shadowRoot","reviveRoot","container","renderInto","owns","_$unadopted$","owned","_$done$","connectTo","given","warn","$t","$y","$H","onServer","globalThis","__veraSsrShimmed","renderer","assign","shadow","foreignNodes","$S","$F","on","priority","connect"],"mappings":"AAgCO,MAAMA,EAAgB,CAACC,EAAuBC,EAAcC,KAOjE,GAAa,cAATD,EAAsB,OAAO,EACjC,MAAME,EAAQH,EAAQI,SAEtB,IAAK,IAAIC,EAAyBL,EAAqB,OAAZK,EAAkBA,EAAUC,OAAOC,eAAeF,GAAU,CACrG,MAAMG,EAAOF,OAAOG,yBAAyBJ,EAASJ,GACtD,QAAaS,IAATF,EAAJ,CACA,QAAiBE,IA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gCnDC,GAAW9T,OAAO+T,QAC5BT,IACC,GAAKA,GAAgChT,IAInC,YAHA+S,GAAUC,GAaZ,MAAMU,EAAUV,GAA4CU,OACtDC,EAAgBX,GAAkDW,aACxE,MAAO,CACLH,GACCjL,SACgBzI,IAAX4T,IAAsBnL,EAASqL,GAAKF,QACnB5T,IAAjB6T,IAA4BpL,EAASsL,GAAKF,EAAY,EAE7D,GAEH,CAAEG,GAAIT,QAAWvT,EAAa,SAAoBc,GAAI8R,GAAqBqB,SAAU,GAAIC,QAASjB"}
|
|
1
|
+
{"version":3,"file":"vera-renderer.min.js","sources":["../../shared-utils/src/diagnostic.ts","../../shared-utils/src/adopt-property.ts","../../shared-utils/src/markup-grammar.ts","../../shared-utils/src/utils.ts","../src/kinds.ts","../src/renderer.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 type { PropertyHost } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * **Delivering a bound property to a custom element that may not receive it yet** — the one home of the\n * rule `@verajs/renderer` (a `.prop` template binding) and `@verajs/renderer/spread` (a `.prop` bag key)\n * both apply. They ship as separate bundles that cannot import each other, so this package, inlined into\n * each, is where the rule lives once; before, each carried a full copy and a fix had to visit both.\n *\n * Returns where the binding stands after this write:\n * - `0` — still adopting: nothing received the value, so it was recorded in the element-carried\n * `_$props$`, which core's `init()` drains over whatever the class's field initializers wrote at\n * upgrade. Call again on the next write.\n * - `1` — received (a setter anywhere on the chain, an initialized component's `_$adopt$`, or an element\n * that is already upgraded): later writes are plain property writes.\n * - `2` — refused: a getter with no setter, where the plain write would throw. Later writes do nothing.\n *\n * `_$props$` and `_$adopt$` are `$`-named because they cross bundle boundaries (renderer, spread, core)\n * and must survive property mangling.\n *\n * **`_$adopt$` is a BRAND, not just a slot:** present means \"core has initialized this component\", which is what routes\n * a delivery to the live accessor (`1`) instead of the `_$props$` record. Do not move it to a class's PROTOTYPE\n * (2026-10-10): every instance would carry it BEFORE `init`, and a delivery to an upgraded-but-uninitialized element\n * would be adopted into a store that does not exist yet. It is ONE shared function written onto each element at `init`,\n * called with the element as `this` (`adopt.call(element, …)`) — 2026-10-11: the closure it replaced was free in\n * optimized code (measured) but cost Chrome's interpreted first render one allocation per component.\n */\n\n/** Development only: getter-only names already reported, per element — a `!name` re-asserts on every render. */\nlet refused: WeakMap<PropertyHost, Set<string>> | undefined;\n\nexport const adoptProperty = (element: PropertyHost, name: string, value: unknown): 0 | 1 | 2 => {\n /**\n * **`__proto__` is refused HERE, at the receiver** (2026-11-10): `element.__proto__ = v` replaces the element's\n * prototype, and an own `__proto__` key reaches a bag through `JSON.parse`. This is the choke point every delivery\n * passes; the renderer's template binding and spread's bag key refuse it first, with a development warning naming\n * where it was written (their second addresses: renderer.ts `proto-binding`, spread.ts refusal 3).\n */\n if (name === '__proto__') return 2;\n const adopt = element._$adopt$ as ((key: string, value: unknown) => void) | undefined;\n /** The walk comes first: what it finds decides whether writing is even legal. */\n for (let carrier: object | null = element; carrier !== null; carrier = Object.getPrototypeOf(carrier)) {\n const desc = Object.getOwnPropertyDescriptor(carrier, name);\n if (desc === undefined) continue;\n if (desc.set !== undefined) {\n element[name] = value;\n return 1;\n }\n if (desc.get !== undefined) {\n if (adopt !== undefined) adopt.call(element, name, value);\n else if (__DEV__) {\n const names = (refused ??= new WeakMap()).get(element) ?? new Set<string>();\n refused.set(element, names);\n if (!names.has(name)) {\n names.add(name);\n console.warn(diagnostic('renderer', `<${element.localName}>`, 'getter-only-prop', __DEV__ && SHARED.getterOnlyProp(name)));\n }\n }\n return 2;\n }\n break; // a data property: an own field, or an inherited default — nothing receives it\n }\n element[name] = value;\n if (adopt !== undefined) {\n adopt.call(element, name, value);\n return 1;\n }\n const record = (element._$props$ ??= {}) as Record<string, unknown>;\n const first = __DEV__ && !Object.hasOwn(record, name);\n record[name] = value;\n /** Upgrade is read off the PROTOTYPE — a bag key named `constructor` can shadow `el.constructor`. The realm is the element's. */\n const view = element.ownerDocument.defaultView as unknown as {\n HTMLElement: { prototype: object };\n customElements: CustomElementRegistry;\n } | null;\n const upgraded = view === null || Object.getPrototypeOf(element) !== view.HTMLElement.prototype;\n /** Development only: an element that never drains still loses the value at upgrade — told apart by ownership. */\n if (__DEV__ && view !== null && !upgraded && first) {\n const tag = element.localName;\n view.customElements.whenDefined(tag).then(() => {\n let owned = false;\n for (let carrier: object | null = element; carrier !== null; carrier = Object.getPrototypeOf(carrier)) {\n const desc = Object.getOwnPropertyDescriptor(carrier, name);\n if (desc === undefined) continue;\n owned = desc.get !== undefined || desc.set !== undefined;\n break;\n }\n if (!owned && element[name] !== record[name])\n console.warn(diagnostic('renderer', `<${tag}>`, 'upgrade-clobber', __DEV__ && SHARED.upgradeClobber(name)));\n });\n }\n return upgraded ? 1 : 0;\n};\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 * **Never `exec` a shared `/g` regex in a loop whose body can re-enter it** (a nested render, a recursive compose or\n * serialize, a callback): the inner use resets `lastIndex`, and the outer loop restarts or skips. Setting `lastIndex`\n * before every `exec` is not enough. Measured 2026-11-17: the static tier's composer re-entered its marker regex through\n * a nested template and composed forever; split once, or use a fresh regex per walk.\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 * **A `<script>` that is a JSON data block, by its `type`** (Brian, 2026-11-17): the only script a value may enter (state\n * handoff, JSON-LD); every other script hole is refused (`script-hole`), since a value there is code — run on a page the\n * server rendered. \"The type ends in `json`\" never names a script that runs — measured on Chromium, Firefox and WebKit,\n * parameters included (`text/javascript; x=json` is inert), as the spec reads a type (a JavaScript MIME essence match on\n * the whole string); `type=\"\"` and a `language` attribute alone do run, and end in no `json`.\n */\nexport const JSON_BLOCK = /json\\s*$/i;\n\n/**\n * Whether a script START TAG, as written, opens a JSON data block: its attributes read IN ORDER (so a `type=` inside\n * another attribute's quoted value is never taken for the type), the first `type` as the parser keeps it, and that value\n * holding no `&` (a character reference is refused rather than decoded — a decoder slightly off would make the server\n * and the client disagree) and ending in `json` (`JSON_BLOCK`). Every side applies it to the start tag that OPENED the\n * script a hole sits in — recorded where the scanner enters raw text, never found by searching back (a `<script…>`\n * inside a script's own text is no start tag). `@verajs/ssr` holds a twin, held equal by a test.\n */\nexport const dataBlock = (openTag: string) => {\n for (const [, name, double, single, bare] of openTag.slice(7).matchAll(/[\\s/]*([^\\s\"'>/=]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]*)))?/g))\n if (name!.toLowerCase() === 'type') {\n const type = double ?? single ?? bare ?? '';\n return !type.includes('&') && JSON_BLOCK.test(type);\n }\n return false;\n};\n\n/**\n * **A raw-text element's composed text, unable to end its element** — the rule every side writes, byte for byte (the\n * server's `styleHole` and JSON rule, the renderer, hydration's comparison, lite, static): in a style each `</style`\n * (any case) as `<\\/style` (the same CSS), in a JSON data block every `<` as `\\u003c` (the same JSON). A style's or a\n * JSON block's text is serialized VERBATIM (BROWSER-LEDGER), so written as composed, a value became markup once the page\n * was saved from the DOM and parsed again. Applied to the COMPOSED text: a closer can form across a hole. Idempotent —\n * neither form leaves what it replaces.\n */\nexport const closedRawText = (text: string, json: boolean) =>\n json ? text.replace(/</g, '\\\\u003c') : text.replace(/<\\/(style)/gi, '<\\\\/$1');\n\n/**\n * **A value as inert text in ANY position** — every ASCII non-word character as a character reference (`<` `<`,\n * a space ` `, `=` `=`), everything else as it is: the encoding `@verajs/static` writes every value with, and the\n * renderer writes a never-shown element's values with. Read as raw text it holds no `<`; read as markup it decodes to\n * the same characters and cannot end a tag, a quoted or unquoted attribute value, or the element.\n */\nexport const encodeText = (text: string) => text.replace(/[^\\w\\u0080-\\uffff]/g, (c) => `&#${c.charCodeAt(0)};`);\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 ` ` 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","import type { HandlerHolder, Untracked } from './types.js';\nimport { diagnostic } from './diagnostic.js';\nimport * as SHARED from './diagnostics.js';\n\n/**\n * Get an object's type.\n *\n * @param obj The object\n * @return The type\n */\nexport const getType = (obj: unknown) => Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();\n\n/**\n * Weak collections need their per-key dependencies stored weakly, or tracking `weakMap.get(obj)`\n * holds `obj` and defeats the whole point of the type. Checked by type string rather than\n * `instanceof`, which fails across realms (iframes, `vm`).\n */\n/**\n * A WeakMap or WeakSet (or WeakRef) — read from `Symbol.toStringTag`, the tag `Object.prototype.toString` itself reads, so\n * the answer is the same (another realm's collections included) without building and lower-casing a string on every first\n * tracked read of every object.\n */\nexport const isWeakCollection = (item: unknown) => {\n const tag = (item as { [Symbol.toStringTag]?: unknown } | null)?.[Symbol.toStringTag];\n return typeof tag === 'string' && (tag[0] === 'W' || tag[0] === 'w');\n};\n\n/**\n * Remove a trailing slash from an url if its not root url (`/`).\n *\n * @param str String to remove trailing slash from\n */\nexport const stripTrailingSlash = (str: string) => (str !== '/' && str.endsWith('/') ? str.slice(0, -1) : str);\n\n/**\n * **Reports an error nothing else handled, the way the platform reports one.** `reportError` fires\n * the window's `error` event — what `window.onerror`, error trackers and test runners listen for —\n * without unwinding the caller, so one failing hook or ref never stops its siblings. A bare\n * `console.error` reached none of those: a component could stop updating while every page-error\n * listener stayed silent. Off-browser (Node has no `reportError`) the console is all there is.\n * `line` is the framework's own line, printed beside the error — a CODED one (2026-10-09):\n * each caller passes `'[vera] <code>'` in production and its table's `diagnostic()` sentence in development, both\n * literal codes at the call site, so the static checks read them. The subject is fixed wording too (`a hook`, `an\n * element ref`), never a tag name: this line is the console's FORMAT (no `'%s'`, which measured +2–3 B on the renderer\n * bundles), so nothing from outside may reach it — the element goes to the `'error'` handlers instead. Production prints it only where the platform has no\n * `reportError` (Node); in a browser, `reportError` alone reports.\n *\n * Shared by core (a hook threw) and the renderer (a ref threw) so the fallback is one rule.\n */\nexport const reportUncaught = (error: unknown, line: string) => {\n if (typeof reportError !== 'function') console.error(line, error);\n else {\n if (__DEV__) console.error(line, error);\n reportError(error);\n }\n};\n\n/**\n * **Reports what user code a render called threw — to the app's `'error'` chain, else as uncaught.** One rule for\n * every callback the framework runs on the user's behalf and survives: a hook (core), an element ref, and an element\n * claim's `create`/`mount`/`unmount` (the renderer). The caller catches at the call site and carries on, so one\n * failing callback never stops its siblings or leaves a commit half applied. `element` is the component the error\n * belongs to, handed to each handler. Every throw is reported — nothing is deduped, as a hook's never was.\n * **Core keeps a deliberate twin** (`reportHookError`, the same rule as a `forEach`): routed through here it measured\n * +11 B gzip on `vera.min.js` (2026-10-09). A change to the rule changes both.\n */\nexport const reportTo = (handlers: readonly unknown[] | undefined, error: unknown, element: Element | undefined, line: string) => {\n if (handlers?.length) for (const handler of handlers) (handler as (error: unknown, element?: Element) => void)(error, element);\n else reportUncaught(error, line);\n};\n\n/** The component a render root belongs to: a shadow root's host, or a light root itself. */\nexport const hostOf = (root: Node | null | undefined): Element | undefined =>\n root == null ? undefined : root.nodeType === 11 ? (root as ShadowRoot).host : (root as Element);\n\n/** `fn(a, b, c)`, tracked as the caller is — the stand-in for core's `untracked` when no core was wired. */\nexport const call: Untracked = (fn, a, b, c) => fn(a!, b!, c!);\n\n/**\n * **Runs a bound handler, and its callers run it UNTRACKED**: the renderer's template `@event` and spread's event key,\n * each through `untracked(dispatch, holder, event)` (2026-10-09). An effect that fires an event synchronously\n * (`el.click()`, `focus()`, `dispatchEvent`) runs the handler INSIDE itself, and the handler's reads subscribed the\n * effect: a handler doing `state.n++` made the effect re-run on every click, a self-feeding loop held to one round per\n * frame, forever (measured). A handler's reads are event-time decisions, never a hook's inputs. The directives engine's\n * delegated `listen` makes the same choice its own way. A function is called with the element as `this`; an object\n * through its `handleEvent`. One function for both callers (Brian's size-audit ruling, 2026-11-13): it was two\n * identical copies, so a fix had two addresses; each bundle still inlines its own.\n */\nexport const dispatch = (holder: HandlerHolder, event: Event) => {\n const handler = holder._handler as EventListener | EventListenerObject | null;\n if (typeof handler === 'function') handler.call(holder._element as never, event);\n else if (typeof handler?.handleEvent === 'function') handler.handleEvent(event);\n};\n\n/**\n * **Whether a property binding is a `<select>`'s SELECTION** — `value` or `selectedIndex` — which the renderer and\n * `spread` both treat as live: re-asserted every render and compared against the live value (as `!value` is), because\n * a select's options can be replaced under an unchanged value, which drops the selection. One rule, asked once per\n * binding by both, so a template and a spread key cannot disagree about it.\n *\n * In development it names the one shape it cannot serve: on a `<select multiple>` both properties read and set a\n * SINGLE selection, so a selection the user adds is kept rather than controlled. Always writing there was measured\n * 2–3% slower on every table with a select per row, to serve an API that does not fit — hence a warning, not a cost.\n */\nexport const isSelection = (element: Element, name: unknown) => {\n if ((name !== 'value' && name !== 'selectedIndex') || element.localName !== 'select') return false;\n return true;\n};\n\n/**\n * Development: the one shape a selection binding cannot serve, named by the module the user wired (`side`). Called only\n * behind `__DEV__` at each call site, so production keeps `isSelection` exactly as small as it was (a `side` argument on\n * it measured +1 B, a default +9 B on vera-renderer.min.js — 2026-10-09).\n */\nexport const saySelectMultiple = (element: Element, name: unknown, side: string) => {\n if (element.hasAttribute('multiple'))\n console.warn(diagnostic(side, '<select multiple>', 'select-multiple', __DEV__ && SHARED.selectMultiple(String(name))));\n};\n\n/**\n * `target[key]`, as a function — how a component's GETTER is read through `untracked`. Not `Reflect.get`: `untracked`\n * passes three arguments, and `Reflect.get`'s third is the RECEIVER — `undefined` there runs the getter with no `this`.\n */\nexport const read = (target: object, key: string) => (target as Record<string, unknown>)[key];\n\n/**\n * **What a thrown value says, whatever was thrown — and it never throws itself.** A caught value comes from author\n * code (a `resolve` option, a motion tick or vocabulary function), and JavaScript can throw anything: `null`, an object\n * with no prototype (`String()` finds no `toString`), one whose `toString` or `message` getter throws, a Proxy whose\n * traps throw. Formatting it naively replaced the real failure with an unrelated TypeError from inside the framework.\n * Anything unreadable becomes a fixed phrase; `Object.prototype.toString` is no fallback, since it reads\n * `Symbol.toStringTag` through a Proxy's trap too.\n *\n * **A deliberate duplicate of `thrownMessage` in `packages/ssr/src/vera/escaping.ts` — fix both copies.** `@verajs/ssr`\n * is compiled per file with no bundling, so it cannot import this private, unpublished package at run time;\n * `tests/thrown-message-copies.test.mjs` runs one table of thrown values against both, so they cannot drift.\n */\nexport const thrownMessage = (error: unknown): string => {\n try {\n if (error instanceof Error) return String(error.message);\n const message = (error as { message?: unknown } | null)?.message;\n return typeof message === 'string' ? message : String(error);\n } catch {\n return '[unprintable value thrown]';\n }\n};\n\n/** `data-tone` → `dataTone`: the prop an observed attribute arrives as, in every package that defines components (`@verajs/core`'s `define`, its checks, `@verajs/lite`). */\nexport const camel = (name: string) => name.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());\n","/**\n * **The renderer's binding kinds and child-part modes** — numbers both `renderer.ts` and the separately bundled\n * `hydration.ts` read, from ONE source (each bundle inlines them; they are literals in the output). A change here\n * changes the hand-off's protocol: bump `$V` in `renderer.ts`.\n */\n/** A binding's kind, resolved once per template. */\nexport const IGNORED = 0; // consumed, nothing rendered: inside a comment, the later values of a multi-part attribute\nexport const CHILD = 1; // anchored on a primed empty text node the template carries\nexport const SOLE = 2; // its element's only content: no anchor in the template, the first commit writes `textContent`\nexport const ATTR = 3;\nexport const PROPERTY = 4;\nexport const BOOLEAN = 5;\n/** `EVENT` through `ADOPT` hold a `Slot` record in their node slot — one range test, in `instantiate` and `commit`. */\nexport const EVENT = 6;\n/** An element-position expression: a ref, or a value that applies itself (`_$apply$`). */\nexport const REF = 7;\n/** An element-position expression ON a `<select>`: a value applying itself there (a spread) waits for `flush`. */\nexport const SELECT_REF = 8;\n/** `.name` on a custom element — see `adoptProperty` in shared-utils. */\nexport const ADOPT = 9;\n/**\n * Kinds from here on re-assert on EVERY render, so the update loop never skips them as unchanged:\n * `!name` writes from the live DOM's point of view (a sibling radio's click unchecks this one with no\n * event on it), and a `<select>`'s selection is re-applied after its options exist — see `flush`.\n */\nexport const LIVE = 10;\n/** A `<select>`'s selection — `value` or `selectedIndex` (`isSelection`) — written when the pass ends: see `flush`. */\nexport const SELECT = 11;\n/** `!name` on a custom element: compared against the LIVE value — read through `untracked`, it is the component's getter. */\nexport const LIVE_CUSTOM = 12;\n/** A binding that must never write — and, from here on, the kinds `commit` handles before anything is computed. */\nexport const REFUSED = 13;\n/** A `<select>`'s `selectedIndex` — the rare spelling of its selection, queued as `SELECT` is (see `flush`). */\nexport const SELECT_INDEX = 14;\n/**\n * **An HTML `<style>`'s or JSON data block's whole text** — ONE binding (the element's first value; the others are\n * consumed, as a multi-part attribute's are) composes the statics and values and writes the element's text when it\n * changed. Its text is serialized VERBATIM (BROWSER-LEDGER), so it is written unable to end its element, as the server\n * writes it: in a style each `</style` as `<\\/style`, in a JSON block every `<` as `\\u003c` — on the COMPOSED text, since\n * a closer can form across a hole. Committed in `commit`'s cold branch: the hot text line is untouched.\n */\nexport const RAW_STYLE = 15;\nexport const RAW_JSON = 16;\n/**\n * **An element whose content is never shown** (`<iframe>`, `<noscript>`, `<xmp>`, `<noembed>`, `<noframes>`,\n * `<plaintext>`): its statics and its values composed as text, each VALUE fully encoded (every ASCII non-word character\n * as a character reference), so a page saved from the DOM and parsed again — with scripting on (raw text) or off\n * (markup) — holds no value that can end the element or add an attribute.\n */\nexport const RAW_ENCODED = 17;\n\n\n/** A child part's mode: what its range currently holds. */\nexport const EMPTY = 0;\nexport const TEXT = 1;\nexport const TEMPLATE = 2;\nexport const LIST = 3;\nexport const NODE = 4;\n\n/**\n * **The hydration hand-off's positions** — the renderer sets `$H` to an array at `connect`, and `hydration.ts` reads\n * it by these. An array, not an object of named fields: the names cost every app bytes (−35 B gzipped measured,\n * 2026-10-02), and these constants inline to literals in both bundles. The first two are FROZEN across protocols — a\n * hydration from another release reads the protocol at 0 and, on a mismatch, can still install its clearing hook at 1.\n * Any other change here is a protocol change: bump `PROTOCOL`.\n */\n/**\n * **The protocol of this package's first-party seams** — the renderer's hand-off (`$H`, at `HANDOFF_PROTOCOL`) and slots'\n * capture (`_$capture$`), both read by hydration. One number for both: the three ship in one package, and a change to\n * either seam bumps it. A hydration that meets another number declines (the page renders fresh) and says so.\n */\nexport const PROTOCOL = 2;\n/** The protocol number — FROZEN at 0. */\nexport const HANDOFF_PROTOCOL = 0;\n/** The first-render hook's setter — FROZEN at 1. */\nexport const HANDOFF_ADOPTER = 1;\nexport const HANDOFF_GET_TEMPLATE = 2;\nexport const HANDOFF_CHILD_PART = 3;\nexport const HANDOFF_INSTANCE = 4;\nexport const HANDOFF_SLOT = 5;\nexport const HANDOFF_UNSET = 6;\nexport const HANDOFF_UPGRADED = 7;\nexport const HANDOFF_COMMIT = 8;\nexport const HANDOFF_COMMIT_AS = 9;\nexport const HANDOFF_HOOK_UP = 10;\nexport const HANDOFF_RESOLVE = 11;\nexport const HANDOFF_ROOTS = 12;\nexport const HANDOFF_TO_TEXT = 13;\nexport const HANDOFF_REMOVAL_WORK = 14;\n","/**\n * @verajs/renderer — a template-identity renderer.\n *\n * A tagged template's `strings` array is interned per call site, so it keys a parsed `<template>`.\n * An instance clones it and binds the expression positions; every later render of the same shape\n * commits only the values that changed. Lists reconcile by index here, by key through\n * `@verajs/renderer/keyed`.\n *\n * Contracts the speed pays for:\n * - The renderer owns its container below the mount point: a part that owns a whole parent clears it\n * with one `textContent = ''`.\n * - Do not `normalize()` rendered content — child anchors are text nodes.\n * - A string renders as text, never as markup. There is no `innerHTML` sink.\n *\n * Internal members are `_`-prefixed because the production build mangles `/^_[a-z]/`. `$`-named\n * members cross bundle boundaries (keyed, spread, slots) and survive mangling by not matching it.\n */\n\nimport {\n adoptProperty,\n call,\n CONTENT_PROPERTY,\n contentClash,\n ownsContent,\n TAG_NAME_HOLE,\n tagHole,\n INLINE_HANDLER,\n isSelection,\n saySelectMultiple,\n read,\n reportTo,\n hostOf,\n SCRIPT_URL,\n SCRIPT_URL_ITEM,\n URL_SINK,\n dataBlock,\n JSON_BLOCK,\n closedRawText,\n encodeText,\n diagnostic,\n dispatch,\n hasWarned,\n checkForeign,\n landing,\n misuse,\n SHARED,\n warnOnce,\n} from '@verajs/shared-utils';\nimport { attributeValueKind, eventKey, eventNameGuess } from './dev-values.js';\nimport { PROSE } from './renderer-diagnostics.js';\nimport type { Untracked, PropertyHost } from '@verajs/shared-utils';\n\nimport type { InstanceHook, TemplateResult } from './types.js';\nimport { PROTOCOL, IGNORED, CHILD, SOLE, ATTR, PROPERTY, BOOLEAN, EVENT, REF, SELECT_REF, ADOPT, LIVE, SELECT, LIVE_CUSTOM, REFUSED, SELECT_INDEX, RAW_STYLE, RAW_JSON, RAW_ENCODED, EMPTY, TEXT, TEMPLATE, LIST, NODE } from './kinds.js';\n\nexport type { TemplateResult } from './types.js';\n\n/**\n * The marker the one parse per template writes into each hole — into an attribute name (`0\\uFFFF`), a bogus\n * comment (`<?\\uFFFF0>`) and raw text (`\\uFFFF0\\uFFFF`). U+FFFF is a Unicode noncharacter: real text never contains\n * it, so an author's statics cannot collide with it, and the HTML preprocessor keeps it (a parse error, never a\n * rewrite) — in every engine, `tests/browser/template-marker.test.js`. Data never reaches the parsed string at all:\n * values are committed through the DOM, and the one path that builds strings at runtime (`tag`) refuses any name\n * outside `[a-zA-Z0-9._-]`. Fixed rather than random, so the parse is deterministic.\n */\nconst MARKER = '\\uFFFF';\n/** Every marker as a nested `<template>` serializes it: an addressed attribute, a child comment, a raw-text pair. */\nconst INERT_MARKERS = / \\d+\\uFFFF(?:=\"[^\"]*\")?|<!--\\?\\uFFFF\\d+-->|\\uFFFF\\d+\\uFFFF/g;\n\nconst doc = document;\nconst comment = () => doc.createComment('');\n\n/**\n * The scanner — one regex per state, each finding the next thing that matters (lit-html's design). It\n * decides only what each expression position IS; the browser's parser builds the tree. Every marker\n * carries its binding's index, so pairing is ADDRESSED: an element the parser drops takes only its own\n * binding with it and never shifts a later value onto another element (a security property —\n * `tests/dropped-element-bindings.test.mjs`).\n */\n/** `<!-->` and `<!--->` are not opened at all: they close themselves (the tokenizer's abrupt close), so they stay text. */\nconst TEXT_END = /<(?:(!--(?!-?>)|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\n/**\n * A comment ends at `-->` or `--!>` — read as a comment past either, a value after one was dropped while the browser\n * rendered it. The abrupt `<!-->`/`<!--->` never open one (`TEXT_END`'s lookahead; a lookBEHIND would not even parse\n * in an older Safari).\n */\nconst COMMENT_END = /--!?>/g;\nconst COMMENT2_END = />/g;\n/** `>`, or whitespace then an attribute name (with `=` and the start of its value), or the string's end. */\nconst TAG_END = />|[ \\t\\n\\f\\r](?:([^\\s\"'>=/]+)([ \\t\\n\\f\\r]*=[ \\t\\n\\f\\r]*(?:[^ \\t\\n\\f\\r\"'`<>=]|(\"|')|))|$)/g;\nconst DOUBLE_QUOTE_END = /\"/g;\n\n\n/**\n * **An expression inside an attribute NAME is refused in development** (`<p data-${k}=\"1\">`, `<b ${name}=\"x\">`,\n * `<p ${k}-x>`): the parser sees the marker before the value exists, so no position can hold it, and the server\n * refuses the same template in every build. Development only, by Brian's call (2026-09-30): a template is fixed\n * source, so its first render in development finds it, and production pays nothing (the check cost 101 B). A name known only at runtime is a one-key spread, which applies the\n * refusals a runtime name needs (handlers, `srcdoc`, URL values); development shows the rewrite. A hole is in a name\n * when, inside a tag and outside a value, a name character touches it on either side — never a ref (whitespace or\n * `>`/`/>` around it) and never the TAG name (`<${tag}>`, the tag entry's).\n */\n/** A name character ends the static, after a space or quote since the tag's `<` — so never a TAG-name hole (`<my-${x}`). */\nconst NAME_BEFORE = /[\\s\"'][^\\s<>]*[^\\s\"'>=/<]$/;\nconst NAME_AFTER = /^(?:[^\\s\"'>=/]|[ \\t\\n\\f\\r]*=)/;\nconst nameHole = (before: string, after: string): never => {\n const prefix = /[^\\s\"'>=/]*$/.exec(before)![0];\n const suffix = /^[^\\s\"'>=/]*/.exec(after)![0];\n const value = /^[ \\t\\n\\f\\r]*=[ \\t\\n\\f\\r]*(?:\"([^\"]*)(\"?)|'([^']*)('?)|([^\\s>]*))/.exec(after.slice(suffix.length));\n /** The value as spread takes it: a closed static is that string, an open one (or none written) is a binding. */\n const given =\n value === null ? \"''\" : value[2] === '\"' ? JSON.stringify(value[1]) : value[4] === \"'\" ? JSON.stringify(value[3]) : value[5] ? JSON.stringify(value[5]) : '…';\n throw new Error(misuse('renderer', 'name-expression', __DEV__ && SHARED.nameExpression(`${prefix}\\${…}${suffix}`, given)));\n};\nconst SINGLE_QUOTE_END = /'/g;\n/**\n * Elements whose content the parser reads as TEXT, so a comment marker cannot live there: the scan\n * writes a text marker and construction turns it into an anchor. `noscript` because Firefox parses it\n * as raw text in a template while Chromium and WebKit do not — listed, it is right in both.\n */\nconst RAW_TEXT_TAGS = /^(?:script|style|textarea|title|iframe|noscript|xmp|noembed|noframes|plaintext)$/i;\n/**\n * The HTML elements whose content is never shown — their holes render as encoded text (`RAW_ENCODED`). `tagName` is\n * upper case exactly for an HTML element. (`xmp` shows its text, as text: encoded, a value reads the same.)\n */\nconst NEVER_SHOWN = /^(?:IFRAME|NOSCRIPT|XMP|NOEMBED|NOFRAMES|PLAINTEXT)$/;\n/**\n * The 14 void elements — a start tag with no content and no end tag. Read only by the development tag-shape pass\n * (`<div />` is an open tag; `</br>` is another `<br>`), so production drops it. A regex rather than shared-utils'\n * Set, as `RAW_TEXT_TAGS` is: an imported `new Set` measured 62 B in production.\n */\nconst VOID_TAGS = /^(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr|param)$/i;\n\n/** A binding slot's value before its first commit — never equal to a user value. */\nconst UNSET = {};\n/** The value slot of a child binding whose node slot holds a `ChildPart`. */\nconst UPGRADED = {};\n\n/**\n * A template's bindings are indexed by VALUE position: a multi-part attribute sits at its first value\n * and the positions of its other values are `IGNORED`, so the commit loop needs no bookkeeping.\n */\n/**\n * **Tag-shape mistakes, development only** — a self-closed non-void element (`<div />` is an OPEN tag: what follows\n * becomes its child) and an end tag on a void one (`</br>` is ANOTHER `<br>`), in HTML content only (`<svg>`/`<math>`\n * keep self-closing). A separate pass over ALL the statics, the last one too — the production scan never reads it,\n * and a template with no expressions is never scanned — and it only READS: a development-only counter once changed\n * the SCAN, so development and production parsed one template differently.\n */\nconst SHAPE = /<!--(?:-?>|[\\s\\S]*?(?:--!?>|$))|<(\\/?)([a-zA-Z][^\\s/>]*)((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/g;\nconst tagShape = (strings: TemplateStringsArray, type: number): [string, string][] | undefined => {\n const markup = strings.join('');\n /** Where each binding sits in `markup`, so a refusal can ask whether one falls inside an element's content. */\n const holes: number[] = [];\n for (let i = 0, at = 0; i < strings.length - 1; i++) holes.push((at += strings[i].length));\n const bound = (from: number, to: number) => holes.some((at) => at >= from && at <= to);\n let foreign = type === 1 ? 0 : 1;\n /** `[code, tag]` — printed through the table by `sayShape` when the template first renders. */\n let found: [string, string][] | undefined;\n SHAPE.lastIndex = 0;\n for (let m: RegExpExecArray | null; (m = SHAPE.exec(markup)) !== null; ) {\n if (m[2] === undefined) continue;\n const tag = m[2].toLowerCase();\n const closing = m[1] === '/';\n const selfClosed = !closing && m[3].trimEnd().endsWith('/');\n if (tag === 'svg' || tag === 'math') {\n if (closing) foreign--;\n else if (!selfClosed) foreign++;\n continue;\n }\n if (!closing && RAW_TEXT_TAGS.test(tag)) {\n const end = markup.toLowerCase().indexOf(`</${tag}`, SHAPE.lastIndex);\n const stop = end === -1 ? markup.length : end;\n /**\n * A shape that silently loses a binding, refused: inside `<svg>`/`<math>` a `<title>` or `<style>` is a foreign\n * element whose content the browser reads as MARKUP, while the renderer reads it as raw text and rebuilds that\n * text around its bindings — destroying any element inside it.\n */\n if (foreign > 0 && RAW_TEXT_TAGS.test(tag) && bound(SHAPE.lastIndex, stop) && /<[a-zA-Z]/.test(markup.slice(SHAPE.lastIndex, stop)))\n throw new Error(misuse('renderer', 'foreign-raw-text', __DEV__ && PROSE['foreign-raw-text'](tag)));\n SHAPE.lastIndex = stop;\n }\n if (foreign > 0) continue;\n if (selfClosed && !VOID_TAGS.test(tag))\n (found ??= []).push(['self-closed-tag', tag]);\n else if (closing && VOID_TAGS.test(tag))\n (found ??= []).push(['void-end-tag', tag]);\n }\n return found;\n};\n/**\n * Said at the template's FIRST instance, not at construction: `namespaces` constructs an HTML build of a template it\n * then only ever instantiates in SVG, and that build's shape is not a mistake anyone wrote.\n */\n/**\n * **A `<slot>` rendered into LIGHT DOM that nothing will distribute** — slots not wired, or wired after this template\n * was built. Said once per host tag and case; a shadow root is never warned about, the platform slots there.\n */\nconst saySlotless = () => {\n const host = renderRoot;\n if (host === null || host.nodeType !== 1) return;\n const tag = (host as Element).localName;\n /** Slots wired = its protocol entry (`_$capture$`, set at wire); `_$done$` is installed only at slots' first need. */\n const late = (registry as { _$capture$?: unknown } | null)?._$capture$ !== undefined;\n /** Late: the same fact core says at wire time (`late-template-module`), seen here at the host it bit. Once per tag. */\n if (late) warnOnce('renderer', `<${tag}>`, 'late-template-module', __DEV__ && (() => SHARED.lateTemplateModule()), tag);\n else warnOnce('renderer', `<${tag}>`, 'slots-unwired', __DEV__ && (() => PROSE['slots-unwired']()), tag);\n};\nexport const sayShape = (template: Template) => {\n const shape = template._shape;\n if (shape !== undefined) {\n template._shape = undefined;\n /** Each code written out, so the manifest (`diagnostics-tables`) reads every raise from the source. */\n for (const [code, tag] of shape)\n if (code === 'self-closed-tag') console.warn(diagnostic('renderer', `<${tag}>`, 'self-closed-tag', __DEV__ && PROSE['self-closed-tag'](tag)));\n else console.warn(diagnostic('renderer', `<${tag}>`, 'void-end-tag', __DEV__ && PROSE['void-end-tag'](tag)));\n }\n};\n\nclass Template {\n /** What an instance clones: the single root element, or the whole content fragment. */\n $R: Node;\n /** No element in it can be custom — see `instantiate`. */\n _plain = true;\n $K: number[];\n $N: string[];\n /** The statics around a bound attribute's values; `null` for one full-value expression. */\n $J: (string[] | null)[];\n /** Child-index hops from `$R` to each binding's node. */\n $P: number[][] = [];\n /** The template statically writes the attribute too, so a first nullish commit must still remove it. */\n _present: boolean[];\n /**\n * Per binding, whether it names a URL a browser navigates to (a `javascript:` value is refused, see `SCRIPT_URL`):\n * 0 not one; 1 converted once, and that string checked and written; 2 a custom element's property — strings only.\n */\n $L: number[];\n /**\n * **An extension marked this template** (`'template'` insert): namespaces' resolver, an instance hook. False for\n * every template of an app that wires none — ONE read per instance created, never a per-row cost otherwise.\n */\n $X = false;\n /** Namespaces' resolver: which template to build at a position, given its parent. */\n declare _$at$?: (parent: Node) => Template;\n /** The namespace this template was parsed in, for a resolver asked about a detached fragment. */\n declare _$ns$?: string | null;\n /** The instance hook — elements (and slots): claim at creation, mount at the render's end, unmount at teardown. */\n declare _$inst$?: InstanceHook;\n /** Development only: tag-shape mistakes found at construction, said at the template's FIRST instance (`sayShape`). */\n declare _shape?: [string, string][];\n /**\n * Development only: element positions on an element a SOLE binding owns — see `ownsContent`. Marked per instance in\n * `instantiate`; hydration needs no mark, because the server's output carries the content or its empty anchor.\n */\n declare _owned?: number[];\n /** Development only: the template holds a `<slot>` and was built while light-DOM slots was not wired (`saySlotless`). */\n declare _slotless?: boolean;\n\n constructor(result: TemplateResult) {\n const strings = result.strings;\n const count = strings.length - 1;\n const kinds = (this.$K = new Array(count).fill(IGNORED));\n const names = (this.$N = new Array(count).fill(''));\n const statics = (this.$J = new Array(count).fill(null));\n const present = (this._present = new Array(count).fill(false));\n const urls = (this.$L = new Array(count).fill(0));\n const nodes: (Node | null)[] = new Array(count).fill(null);\n /**\n * Development bookkeeping for a binding whose marker never arrives: the tag it was written in, whether it is an\n * element position (a ref has no name), and which bindings sat in a nested `<template>`'s inert content — so a\n * DROPPED element is told apart from inert markup. Read only; production never builds them.\n */\n let tags: string[] | undefined;\n let refs: boolean[] | undefined;\n let inert: Set<number> | undefined;\n if (__DEV__) {\n tags = [];\n refs = [];\n inert = new Set();\n this._shape = tagShape(strings, result._$litType$ ?? 1);\n }\n\n // ── scan ──\n let markup = '';\n let regex = TEXT_END;\n let rawEnd: RegExp | undefined;\n /**\n * Where the start tag of the raw-text element being opened begins (its string, its offset), its name, and, once its\n * `>` enters raw text, that start tag as written — in every build, since a script hole is refused in every build (`MARKER` where a hole sat in it) — the tag that OPENED\n * the raw text a hole sits in, never one found by searching back (a `<script…>` inside a script's text is no tag).\n */\n let rawOpen: [number, number] | undefined;\n let rawName = '';\n let rawTag = '';\n /** The previous binding opened an UNQUOTED value, so a string that matches nothing continues it (`a=${x}${y}`). */\n let open: boolean = false;\n /** Development also scans the LAST static, so a template that ends inside a tag is refused (below); production does not. */\n for (let i = 0; __DEV__ ? i <= count : i < count; i++) {\n const s = strings[i];\n if (__DEV__ && i > 0) tags![i] = tags![i - 1];\n /** Where this string's bound attribute name ends (≥ 0), -1 for none, -2 for an element position. */\n let nameEnd = -1;\n let continues: boolean = open;\n let name = '';\n let at = 0;\n let match: RegExpExecArray | null;\n while (at < s.length) {\n regex.lastIndex = at;\n if ((match = regex.exec(s)) === null) break;\n at = regex.lastIndex;\n if (regex === TEXT_END) {\n if (match[1] === '!--') regex = COMMENT_END;\n else if (match[1] !== undefined) regex = COMMENT2_END;\n else {\n if (match[2] !== undefined && RAW_TEXT_TAGS.test(match[2])) {\n /**\n * The end tag needs the tokenizer's boundary after its name (whitespace, `/`, `>`): `</stylex>` ends\n * nothing. Or the string's end: `</style${x}` is a tag-name position (refused in development).\n * `<plaintext>` never ends: everything after it is its text, as the parser reads it.\n */\n rawEnd = /^plaintext$/i.test(match[2]) ? /(?!)/g : new RegExp(`</${match[2]}(?=[\\\\t\\\\n\\\\f\\\\r />]|$)`, 'gi');\n if (__DEV__) {\n rawOpen = [i, match.index];\n rawName = match[2].toLowerCase();\n }\n }\n if (__DEV__) tags![i] = match[2] ?? '';\n regex = TAG_END;\n }\n } else if (regex === TAG_END) {\n continues = false;\n if (match[0] === '>') {\n regex = rawEnd ?? TEXT_END;\n nameEnd = -1;\n if (__DEV__ && rawOpen !== undefined) {\n const [from, offset] = rawOpen;\n rawTag =\n from === i ? s.slice(offset, at)\n : strings[from]!.slice(offset) + MARKER + strings.slice(from + 1, i).map((t) => t + MARKER).join('') + s.slice(0, at);\n rawOpen = undefined;\n }\n } else if (match[1] === undefined) nameEnd = -2;\n else {\n name = match[1];\n nameEnd = at - match[2].length;\n regex = match[3] === undefined ? TAG_END : match[3] === '\"' ? DOUBLE_QUOTE_END : SINGLE_QUOTE_END;\n }\n } else if (regex === DOUBLE_QUOTE_END || regex === SINGLE_QUOTE_END) {\n regex = TAG_END;\n /** A value that closes with nothing after it before the expression: the expression is an element position. */\n nameEnd = -2;\n } else if (regex === COMMENT_END || regex === COMMENT2_END) regex = TEXT_END;\n else {\n regex = TAG_END;\n rawEnd = undefined;\n }\n }\n /**\n * A template that ends INSIDE a tag (`<b title=\"${x}`) renders nothing of it: the parser drops an unfinished tag\n * whole. Refused, as the server refuses it in every build — there, left open, the tag swallowed the markup after\n * the template into its attributes.\n */\n if (__DEV__ && i === count) {\n if (regex !== TEXT_END && regex !== rawEnd && regex !== COMMENT_END && regex !== COMMENT2_END)\n throw new Error(misuse('renderer', 'unfinished-tag', __DEV__ && SHARED.unfinishedTag()));\n break;\n }\n /**\n * Development: a script hole is refused unless the script is a JSON data block, judged exactly as the server judges\n * it (`dataBlock`, on the start tag as written that opened it). PRODUCTION refuses the same holes after the parse,\n * below — cheaper (+35 B against +261 B for this scan's tracking), reading the type the parser decoded.\n */\n if (__DEV__ && regex === rawEnd && rawName === 'script' && (!dataBlock(rawTag) || rawTag.includes(MARKER)))\n throw new Error(misuse('renderer', 'script-hole', __DEV__ && PROSE['script-hole']()));\n if (regex === TEXT_END) {\n markup += `${s}<?${MARKER}${i}>`;\n kinds[i] = CHILD;\n } else if (regex === rawEnd) {\n markup += `${s}${MARKER}${i}${MARKER}`;\n kinds[i] = CHILD;\n } else if (regex === COMMENT_END || regex === COMMENT2_END) markup += s;\n else if (nameEnd >= 0) {\n /** The attribute is renamed to its binding's address; the value keeps its statics, split by the marker. */\n names[i] = name;\n markup += `${s.slice(0, nameEnd - name.length)}${i}${MARKER}${s.slice(nameEnd)}${MARKER}`;\n /** An unquoted value followed by `/>` would absorb the slash. */\n if (regex === TAG_END && strings[i + 1].startsWith('/>')) markup += ' ';\n } else if (nameEnd === -2) {\n if (__DEV__ && NAME_AFTER.test(strings[i + 1])) nameHole(s, strings[i + 1]);\n if (__DEV__) refs![i] = true;\n markup += `${s} ${i}${MARKER}`;\n }\n else if (continues || regex !== TAG_END) markup += s + MARKER; // another value of the attribute a previous binding opened\n /**\n * A tag-name position (`<${x}>`, `</${x}>`, `<my-${x}>` — no whitespace since the `<`): refused in development.\n * Production keeps no marker, consumes the value and stays aligned.\n */\n else {\n if (__DEV__ && TAG_NAME_HOLE.test(s)) tagHole('renderer');\n /** Nothing before it at all (`${ref}${n}=\"x\"`): only what follows can say it is a name. */\n if (__DEV__ && (NAME_BEFORE.test(s) || (s === '' && NAME_AFTER.test(strings[i + 1])))) nameHole(s, strings[i + 1]);\n markup += s;\n }\n open = regex === TAG_END && (nameEnd >= 0 || continues);\n }\n markup += strings[count];\n\n // ── parse, then one walk ──\n const type = result._$litType$ ?? 1;\n const element = doc.createElement('template');\n /** svg/mathml fragments only parse inside their root: wrap, then unwrap. */\n element.innerHTML = type === 2 ? `<svg>${markup}</svg>` : type === 3 ? `<math>${markup}</math>` : markup;\n const content = element.content;\n /**\n * Unwrapped by removing the wrapper and keeping EVERYTHING the parser made: an HTML element in foreign content\n * (`<div>` inside `<svg>`) breaks out, and the parser places it AFTER the wrapper — keeping only the wrapper's\n * children dropped it, and everything it held, silently.\n */\n if (type !== 1) (content.firstChild as Element).replaceWith(...content.firstChild!.childNodes);\n const walker = doc.createTreeWalker(content, 129 /* ELEMENT | COMMENT */);\n let node: Node | null;\n while ((node = walker.nextNode()) !== null) {\n if (node.nodeType === 8) {\n const data = (node as Comment).data;\n if (!data.startsWith('?' + MARKER)) continue;\n const anchor = doc.createTextNode('');\n (node as Comment).replaceWith(anchor);\n walker.currentNode = anchor;\n nodes[+data.slice(MARKER.length + 1)] = anchor;\n continue;\n }\n const el = node as Element;\n /**\n * A nested `<template>`'s content is inert markup the walk never enters, so its bindings can never be\n * reached — they are ignored, as the server ignores them. Their markers are scrubbed from its markup,\n * every depth at once, or they would sit in the live page.\n */\n if (el.localName === 'template') {\n const held = (el as HTMLTemplateElement).innerHTML;\n if (__DEV__) for (const m of held.matchAll(/(\\d+)\\uFFFF|\\uFFFF(\\d+)/g)) inert!.add(+(m[1] ?? m[2]));\n (el as HTMLTemplateElement).innerHTML = held.replace(INERT_MARKERS, '');\n }\n if (el.localName.includes('-') || el.hasAttribute('is')) this._plain = false;\n for (const attribute of el.getAttributeNames()) {\n if (!attribute.endsWith(MARKER)) continue;\n const i = parseInt(attribute, 10);\n const value = el.getAttribute(attribute)!.split(MARKER);\n el.removeAttribute(attribute);\n nodes[i] = el;\n const written = names[i];\n const first = written[0];\n /** An element position (`<p ${ref}>`) arrives with no value; `&=${ref}` is its explicit spelling. */\n if (value.length === 1 || first === '&') {\n /** Decided here, once: `localName` is a DOM accessor, too dear to read on every commit. */\n kinds[i] = el.localName === 'select' ? SELECT_REF : REF;\n continue;\n }\n let kind =\n first === '.' ? PROPERTY : first === '?' ? BOOLEAN : first === '@' ? EVENT : first === '!' ? LIVE : ATTR;\n /** The parser lowercases attribute names; the scan kept the author's case (`.someProp`). */\n let real = kind === ATTR ? written : written.slice(1);\n /** React muscle memory, buildless: `onClick=${fn}` is `@click`. Strictly `on` + a capital — `onclick` stays an attribute. */\n if (kind === ATTR && /^on[A-Z]/.test(written)) {\n kind = EVENT;\n real = written.slice(2).toLowerCase();\n }\n /**\n * A `<select>`'s selection is re-asserted every render and compared against the LIVE value (as `!value` is):\n * its options can be replaced under an unchanged value, which drops the selection. It is written when the\n * pass ends, once its options exist — see `flush`.\n */\n if ((kind === PROPERTY || kind === LIVE) && isSelection(el, real)) {\n if (__DEV__) saySelectMultiple(el, real, 'renderer');\n kind = real === 'value' ? SELECT : SELECT_INDEX;\n }\n /**\n * `el.__proto__ = v` is not a property write: it replaces the element's prototype and destroys it.\n * No use is legitimate, so the binding is refused — the deliberate twin of spread's `refusedSink`\n * (`tests/dangerous-binding-matrix.test.mjs` holds the two together).\n */\n if ((kind === PROPERTY || kind === LIVE) && real === '__proto__') {\n kind = REFUSED;\n if (__DEV__)\n console.warn(diagnostic('renderer', `<${el.localName}>`, 'proto-binding', __DEV__ && SHARED.protoBinding(written)));\n } else if (kind === ATTR && real.toLowerCase() === 'srcdoc') {\n /** A bound `srcdoc` ATTRIBUTE renders its value as an HTML document: markup injection by construction. */\n kind = REFUSED;\n if (__DEV__)\n console.warn(diagnostic('renderer', `<${el.localName}>`, 'srcdoc-attribute', __DEV__ && SHARED.srcdocAttribute('.srcdoc=${…}')));\n } else if (kind === ATTR && INLINE_HANDLER.test(real)) {\n /** A bound inline handler runs its value as code: refused, as spread and the server refuse it. */\n kind = REFUSED;\n if (__DEV__)\n console.warn(\n diagnostic('renderer', `<${el.localName}>`, 'handler-attribute',\n __DEV__ && SHARED.handlerAttribute(real, `\\`@${real.slice(2).toLowerCase()}=\\${…}\\` (or \\`on${real[2].toUpperCase()}${real.slice(3)}=\\${…}\\`)`))\n );\n } else if (kind === PROPERTY && el.localName.includes('-')) kind = ADOPT;\n else if (kind === LIVE && el.localName.includes('-')) kind = LIVE_CUSTOM;\n /**\n * A property that REPLACES an element's content (`.textContent`, `.innerHTML`…) on an element that also has\n * content of its own — markup, or a child binding whose anchor is in it: the write strands the binding, and a\n * later commit into it throws on a missing parent. Cannot work as written, so development throws.\n */\n if (__DEV__ && kind !== ATTR && kind !== EVENT && kind !== BOOLEAN && CONTENT_PROPERTY.test(real) && ownsContent(el))\n contentClash('renderer', el.localName, real);\n kinds[i] = kind;\n names[i] = real;\n statics[i] = value.length === 2 && value[0] === '' && value[1] === '' ? null : value;\n present[i] = kind === ATTR && el.hasAttribute(real);\n /**\n * A custom element's `src` or `data` PROPERTY is its own business — often an object (`.data=${rows}`) —\n * so only a string is checked there (1), and nothing else is converted; everywhere else the value is converted\n * once (2) — and an animation's value (`to`, `values`…) is checked item by item (3).\n */\n const sink = URL_SINK.exec(real);\n urls[i] =\n kind === REFUSED || kind === BOOLEAN || kind === EVENT || sink === null\n ? 0\n : kind !== ATTR && el.localName.includes('-')\n ? 1\n : sink[1]\n ? 2\n : 3;\n }\n /**\n * A raw-text element's markers arrived as characters: rebuild its content with anchors in their place. A\n * never-shown element is read as its MARKUP when the parser built elements in it (Chromium and WebKit parse a\n * template's `<noscript>` as markup, so a value written in an attribute there sits in a real attribute) and as\n * its text otherwise — the same source either way, written back as text.\n */\n const source = RAW_TEXT_TAGS.test(el.localName) ? (NEVER_SHOWN.test(el.tagName) && el.firstElementChild !== null ? el.innerHTML : el.textContent!) : '';\n if (source.includes(MARKER)) {\n /**\n * **A script hole is refused in EVERY build unless the script is an HTML JSON data block** (Brian, 2026-11-18).\n * A template's HTML script never runs on the live page, but a page saved from the DOM and served again (an\n * editor's publish) runs it; an SVG `<script>` from a template runs in Chromium and WebKit (BROWSER-LEDGER), so\n * it is refused even with a JSON type. `tagName` is upper case exactly for an HTML element (in an HTML document).\n * The type is read as the parser decoded it, so `application/json` passes here where the server (and the\n * development scan, above) refuses it: a genuine JSON block, which never runs — the one recorded difference. A\n * script carrying any binding of its own (`nodes` holds it: `?type`, `.type`, a spread) is refused too: it could\n * change the type after this judged it, and a saved page would carry the value as code.\n */\n if (el.tagName === 'script' || (el.tagName === 'SCRIPT' && (!JSON_BLOCK.test(el.getAttribute('type') ?? '') || nodes.includes(el))))\n throw new Error(misuse('renderer', 'script-hole', __DEV__ && PROSE['script-hole']()));\n const pieces = source.split(MARKER);\n el.textContent = '';\n /**\n * An HTML style, JSON block (the script check above let only that script through) or never-shown element: its first\n * value owns the element's whole text (`RAW_*`), its statics the even pieces; the values after it are consumed.\n */\n const raw = el.tagName === 'STYLE' ? RAW_STYLE : el.tagName === 'SCRIPT' ? RAW_JSON : NEVER_SHOWN.test(el.tagName) ? RAW_ENCODED : 0;\n if (raw !== 0) {\n const first = +pieces[1]!;\n nodes[first] = el;\n kinds[first] = raw;\n /** One value and no static text (`<style>${css}</style>`): no statics, so an unchanged value returns at once. */\n statics[first] = pieces.length === 3 && pieces[0] === '' && pieces[2] === '' ? null : pieces.filter((_, p) => p % 2 === 0);\n for (let p = 3; p < pieces.length; p += 2) kinds[+pieces[p]!] = IGNORED;\n continue;\n }\n for (let p = 0; p < pieces.length; p++) {\n if (p % 2 === 0) {\n if (pieces[p]) el.append(pieces[p]);\n } else el.append((nodes[+pieces[p]] = doc.createTextNode('')));\n }\n }\n }\n\n /**\n * A child binding that is its element's only content needs no anchor in the template — except inside\n * a raw-text element, whose content is never markup. Then each binding's path from the root.\n */\n const first = content.firstChild;\n const root = (this.$R = first !== null && first.nodeType === 1 && first.nextSibling === null ? first : content);\n for (let i = 0; i < count; i++) {\n let at = nodes[i];\n if (at === null) {\n if (__DEV__ && (kinds[i] === CHILD || names[i] !== '' || refs![i])) {\n if (inert!.has(i))\n console.warn(diagnostic('renderer', 'a nested <template>', 'inert-binding', __DEV__ && PROSE['inert-binding'](String(i))));\n /** A run of consecutive casualties is one dropped element: said once, naming the first. */\n else if (i === 0 || nodes[i - 1] !== null || inert!.has(i - 1) || !(kinds[i - 1] === CHILD || names[i - 1] !== '' || refs![i - 1])) {\n let lost = 1;\n while (i + lost < count && nodes[i + lost] === null && !inert!.has(i + lost)) lost++;\n const where = tags![i] ? `\\`${names[i] !== '' ? `${names[i]}=` : refs![i] ? '&=' : ''}\\` on <${tags![i]}>` : 'a binding';\n console.warn(diagnostic('renderer', 'a dropped element', 'dropped-binding', __DEV__ && PROSE['dropped-binding'](where, String(lost))));\n }\n }\n kinds[i] = IGNORED;\n } else if (kinds[i] === CHILD) {\n const parent = at!.parentNode!;\n if (__DEV__ && (parent as Element).localName === 'table')\n console.warn(diagnostic('renderer', '<table>', 'table-binding', __DEV__ && PROSE['table-binding']()));\n /**\n * Only on a PLAIN element (no dash, no `is`): a light-DOM component renders into its own children, and the part\n * this position may become owns its element's whole content — so there it keeps its anchor, bounded by markers.\n */\n const host = parent as Element;\n if (\n parent.nodeType === 1 &&\n parent.childNodes.length === 1 &&\n !RAW_TEXT_TAGS.test(host.localName) &&\n !host.localName.includes('-') &&\n !host.hasAttribute('is')\n ) {\n parent.removeChild(at!);\n nodes[i] = at = parent;\n kinds[i] = SOLE;\n }\n }\n const path: number[] = [];\n for (; at != null && at !== root; at = at.parentNode) {\n let index = 0;\n for (let sibling = at.previousSibling; sibling !== null; sibling = sibling.previousSibling) index++;\n path.unshift(index);\n }\n this.$P.push(path);\n }\n /**\n * Development: an element position (a spread) on an element whose whole content is a SOLE binding — the content is\n * invisible until that binding commits, so the spread's content-property check is told by a mark per instance.\n */\n if (__DEV__) {\n for (let i = 0; i < count; i++)\n if ((kinds[i] === REF || kinds[i] === SELECT_REF) && nodes.some((n, j) => kinds[j] === SOLE && n === nodes[i]))\n (this._owned ??= []).push(i);\n }\n /**\n * **The `'template'` insert** — asked once, as each template is built (cold): a hook may set `_$at$`/`_$inst$`.\n * A module wired AFTER a template was built never hears about it; development says so at `wire` (core reads the\n * mark below).\n */\n if (__DEV__ && registry !== null) (registry as unknown as { $b?: boolean }).$b = true;\n const hooks = registry?.get('template') as TemplateHook[] | undefined;\n /**\n * **Marked by what the hooks LEFT, never by their existing**: a resolver (`_$at$`), an instance hook (`_$inst$`), or a\n * variant's namespace (`_$ns$` — its instances must set the create scope, or a position at their top level cannot\n * be resolved). The fields are the truth, so the mark cannot disagree with them, and the public `'template'` insert\n * keeps its contract (a hook returns nothing). Marking whenever a hook merely existed put every template of an app\n * wiring `elements` — every slots app — on the marked instance path, claimed or not.\n */\n if (hooks !== undefined) for (let i = 0; i < hooks.length; i++) hooks[i](this, result, readScope, root);\n this.$X = !!(this._$at$ || this._$inst$ || this._$ns$);\n /** Light-DOM slots claims a `<slot>` as the template is built — so a template built before it is wired never will. */\n if (__DEV__ && (root as ParentNode).querySelector?.('slot') && (registry as { _$capture$?: unknown } | null)?._$capture$ === undefined)\n this._slotless = true;\n }\n}\n\n/** A `'template'` insert: called once as each template is built. */\ntype TemplateHook = (template: Template, result: TemplateResult, readScope: () => unknown, root: Node) => void;\n\n/**\n * **The create scope**: the template whose instance is being built, while its first update runs — how a resolver\n * answers for a position whose parent is still the instance's detached FRAGMENT (a fragment-rooted template's top\n * level). Set only by a marked template's instantiation.\n */\nlet scope: unknown = null;\nconst readScope = () => scope;\n\n/** The template to build at a position — the same one, unless an extension resolves it by `parent` (namespaces). */\nconst resolved = (template: Template, parent: Node) => (template._$at$ !== undefined ? template._$at$(parent) : template);\n\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n/**\n * **Only a tagged template literal is a template.** Detection is by shape (`strings`), so a value from `JSON.parse` —\n * a request body, an API field an attacker can turn into an object — that looked like a template was rendered as\n * MARKUP. A literal's strings array owns `raw`, which JSON cannot give an array (and an object owning one is not an\n * array): the check Lit makes. It runs here, on the cache's miss, which a forged array always is, so a cached\n * template pays nothing. A forgery is the text any object renders as, `[object Object]` — one shared template, never\n * cached under the forger's own `strings` (a WeakMap throws on a primitive key) — and never a throw: the value is\n * attacker-controlled, and a throw would hand over the subtree.\n */\nlet forged: Template | undefined;\nconst getTemplate = (result: TemplateResult) => {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n const strings = result.strings;\n if (!(Array.isArray(strings) && Object.hasOwn(strings, 'raw'))) {\n if (__DEV__) console.warn(diagnostic('renderer', 'a child value', 'forged-template', __DEV__ && SHARED.forgedTemplate()));\n return (forged ??= new Template({ strings: [`${{}}`] } as unknown as TemplateResult));\n }\n templateCache.set(strings, (template = new Template(result)));\n }\n return template;\n};\n\n/** `${value}` rather than `String(value)`: a symbol throws here as it does at every other sink. */\nconst toText = (value: unknown) => (value == null ? '' : `${value}`);\n\n/**\n * **A value in a `<style>`, JSON block or never-shown element, as text** — the server's rule: nothing for `null`/`undefined`, a list its items'\n * text (nested lists flattened by the same rule), a template refused, anything else `String`. Cold: reached only when\n * such a text changes. One function, nothing single-use beside it (the minifier would paste it in as an IIFE).\n */\nconst textOf = (value: unknown): string => {\n if (Array.isArray(value)) {\n let text = '';\n for (let i = 0; i < value.length; i++) text += textOf(value[i]);\n return text;\n }\n /** A tagged literal's template (strings owning `raw`; a JSON-shaped forgery is not one) is refused, as the server refuses it. */\n const strings = typeof value === 'object' && value !== null ? (value as TemplateResult).strings : undefined;\n if (Array.isArray(strings) && Object.hasOwn(strings, 'raw'))\n throw new Error(misuse('renderer', 'template-in-text', __DEV__ && SHARED.templateInText()));\n return toText(value);\n};\n\n/**\n * **A template placed in an HTML `<title>` or `<textarea>` is said, in development only** (Brian, 2026-11-18). Its elements\n * are never shown there (the element shows its text), and a page saved from the DOM reads them back as text. Nothing\n * unsafe happens, so production carries nothing: the renderer places it, as it always has. (The server refuses it —\n * `ssr-template-in-text` — because there a template's markup could END the element; an SVG `title` is markup.)\n */\nconst TEXT_ONLY = /^(?:TITLE|TEXTAREA)$/;\n/** Said once per element name — a list of templates in one `<textarea>` speaks once, not per item. */\nconst sayTemplateInText = (host: Node) =>\n warnOnce('renderer', `<${(host as Element).localName}>`, 'template-in-text', __DEV__ && (() => SHARED.templateInText()), (host as Element).localName);\n\n/**\n * The record an `@event`, element-position or custom-element `.prop` binding holds in its node slot.\n * For an event it is the LISTENER — a stable object, so swapping handlers never touches the DOM and a\n * re-add through `null` is deduped by the platform; for a ref it is the key an `_$apply$` value keeps\n * its ownership by; for `.prop` on a custom element, `_state` is where adoption stands (`adoptProperty`:\n * 0 still adopting, 1 received, 2 refused).\n */\nclass Slot {\n _element: Element;\n _handler: unknown = null;\n _state = 0;\n constructor(element: Element) {\n this._element = element;\n }\n /** Runs the handler UNTRACKED — see shared-utils' `dispatch`. */\n handleEvent(event: Event) {\n untracked(dispatch, this, event);\n }\n}\n\n/**\n * Calls an element ref, and survives one that throws — it runs mid-commit, and an unguarded throw left\n * the render half applied. Reported where a hook's error is: the app's `'error'` chain, handed the\n * component being rendered, else `reportError`.\n */\nconst applyRef = (callback: (element: Element | null) => void, element: Element | null) => {\n try {\n callback(element);\n } catch (error) {\n reportTo(registry?.get('error'), error, hostOf(renderRoot), __DEV__ ? diagnostic('renderer', 'an element ref', 'ref-threw', __DEV__ && PROSE['ref-threw']()) : '[vera] ref-threw');\n }\n};\n\n/**\n * A rendered template. Its bindings live in ONE array of `[node, committed value]` pairs rather than a\n * part object each — a row allocates the instance and that array, nothing else. The instance is also\n * its own list item: `$k` is the key a keyed list reads.\n */\nclass Instance {\n $k: unknown = undefined;\n /**\n * The result last committed into this instance as a list item, recorded ONLY for a result marked `_$same$` (what\n * `each` stamps). Always-on, the skip changed two contracts (a live `!value` binding re-syncing after typing; a result\n * mutated in place re-rendering), so it is opt-in: an unmarked result never takes it (2026-10-18).\n */\n $j: unknown = undefined;\n _template: Template;\n /** The strings this instance was built from — the same-shape identity. */\n _strings: TemplateStringsArray;\n /** The cloned root: the element for a single-root template, else the (soon emptied) fragment. */\n $R: Node;\n _bindings: unknown[];\n constructor(template: Template, strings: TemplateStringsArray, root: Node, bindings: unknown[]) {\n this._template = template;\n this._strings = strings;\n this.$R = root;\n this._bindings = bindings;\n }\n}\n\n/**\n * Builds an instance and commits its first values.\n *\n * **The clone.** Creating an element in a document WITH a custom-element registry costs a definition\n * lookup per element; the template's inert document has none. So a template that cannot contain a\n * custom element is cloned with `cloneNode` — its nodes adopt into the page on insertion — and one that\n * can is imported into `owner`, which upgrades defined elements at clone time in the owner's own\n * registry, so a `.prop` commit reaches the class's setter rather than shadowing it. A container in another\n * window is never the `owner`: its registry does not define this realm's components (Firefox and WebKit leave them\n * un-upgraded there), so `commitAs` hands this renderer's own document instead.\n *\n * **Every node is located before anything commits.** The paths index the pristine clone; an upgrading\n * child position inserts markers and content, which would shift the siblings a later path counts.\n */\nconst instantiate = (template: Template, result: TemplateResult, owner: Document): Instance => {\n if (__DEV__) sayShape(template);\n if (__DEV__ && template._slotless) saySlotless();\n const source = template.$R;\n const root = template._plain && owner === doc ? source.cloneNode(true) : owner.importNode(source, true);\n const kinds = template.$K;\n const paths = template.$P;\n const marked = template.$X;\n /** A marked template's instance keeps its hook's state in ONE slot after its bindings — the hook's own object. */\n const bindings = new Array(kinds.length * 2 + (marked ? 1 : 0));\n for (let i = 0; i < kinds.length; i++) {\n const kind = kinds[i];\n if (kind === IGNORED) continue;\n let node = root;\n const path = paths[i];\n for (let step = 0; step < path.length; step++) {\n node = node.firstChild!;\n for (let hops = path[step]; hops > 0; hops--) node = node.nextSibling!;\n }\n bindings[i * 2] = kind >= EVENT && kind <= ADOPT ? new Slot(node as Element) : node;\n bindings[i * 2 + 1] = kind === CHILD ? '' : UNSET;\n }\n if (__DEV__ && template._owned !== undefined)\n for (const i of template._owned) ((bindings[i * 2] as Slot)._element as Element & { $content?: boolean }).$content = true;\n const instance = new Instance(template, result.strings, root, bindings);\n if (marked) {\n hookUp(instance, root, false);\n const outer = scope;\n scope = template;\n update(instance, result.values);\n scope = outer;\n } else update(instance, result.values);\n return instance;\n};\n\n/**\n * **An instance of a marked template meets its instance hook** — before its first update (claims see the inert\n * clone), with its mount queued for when the render that created it finishes. Arms removal work, so an instance\n * discarded before then is walked at teardown and never mounts. Also how hydration hooks an adopted instance.\n */\nexport const hookUp = (instance: Instance, root: Node | readonly Element[], adopted: boolean) => {\n const hook = instance._template._$inst$;\n if (hook === undefined) return;\n /** The hook's own state — what to mount, and later what to unmount — or nothing to take part. */\n const state = hook.$c(root, renderRoot, adopted);\n if (state === undefined) return;\n instance._bindings[instance._template.$K.length * 2] = state;\n /** Mounted by the ref flush: a record whose second half is not a slot number is a mount. */\n (pendingRefs ??= []).push(hook, state);\n notifyOnRemoval = true;\n};\n\n/**\n * Commits new values into an instance of the same shape. An unchanged single-value binding — nearly\n * every binding of nearly every row on a list update — is skipped here, before any call.\n */\nconst update = (instance: Instance, values: unknown[]) => {\n const template = instance._template;\n const kinds = template.$K;\n const statics = template.$J;\n const bindings = instance._bindings;\n for (let i = 0; i < kinds.length; i++) {\n const kind = kinds[i];\n if (kind !== IGNORED && (kind >= LIVE || statics[i] !== null || values[i] !== bindings[i * 2 + 1]))\n commit(template, bindings, i, kind, values);\n }\n};\n\n/** Commits the binding at value position `i`. */\n/**\n * **A boolean at a child position renders as the WORD** — `${cond && …}` with a false `cond` shows \"false\". Said in\n * development on each CHANGE to a boolean (the dirty check already skips a repeat), so a binding that keeps\n * producing `false` speaks once, and one that flips to `true` speaks again.\n */\nconst warnBooleanChild = (value: boolean) =>\n console.warn(diagnostic('renderer', 'a child position', 'boolean-child', __DEV__ && PROSE['boolean-child'](String(value))));\n\n/**\n * **Content in the wrong namespace does not render**: development names it at each insert (shared-utils'\n * `checkForeign`, which `@verajs/lite` says too); this renderer's other way to the right namespace is the namespaces\n * module, so it is the renderer's `retag` sentence.\n */\nconst RETAG =\n ` — or wire @verajs/renderer/namespaces, which parses a template where it lands (compiled JSX ` +\n `wires it itself). A template built before it was wired keeps the namespace it was first built in`;\n\n/**\n * **The profiler's hook** (`@verajs/renderer/profiler`, a development-only entry): told of each same-shape update, each\n * first template, each REBUILD (the template identity changed, so the subtree is torn down) and each `renderInto`\n * frame. Every call site is `if (__DEV__ && profileHook !== null)`, so production carries neither the hook nor a call.\n */\ntype ProfileHook = (kind: number, subject: unknown, shape: TemplateStringsArray | null) => void;\nconst PROFILE_UPDATE = 0;\nconst PROFILE_CREATE = 1;\nconst PROFILE_REBUILD = 2;\nconst PROFILE_FRAME_START = 3;\nconst PROFILE_FRAME_END = 4;\nlet profileHook: ProfileHook | null = null;\nconst setProfileHook = (hook: ProfileHook | null) => {\n profileHook = hook;\n};\n\n/** How many times a part's child applier changed identity — development only; `@__PURE__` keeps it out of production. */\nconst applierSwaps = /* @__PURE__ */ new WeakMap<object, number>();\n\n/** `commit`'s scratch for a component's `_$raw$` — module-level, so the read stays one expression. */\nlet raw: Record<string, unknown> | undefined;\nconst commit = (template: Template, bindings: unknown[], i: number, kind: number, values: unknown[]) => {\n const slot = i * 2;\n const committed = bindings[slot + 1];\n const node = bindings[slot];\n if (kind <= SOLE) {\n const value = values[i];\n if (committed === UPGRADED) (node as ChildPart).$p(value);\n else if (value == null || typeof value === 'object') {\n /** A template, list, node or nothing: the position becomes a full part, anchored where its text was. */\n let part: ChildPart;\n if (kind === SOLE) {\n /** Its plain element's whole content is this binding's: the element is the range, and no comment is added. */\n part = new ChildPart(null, null);\n if (committed === UNSET) part.$w = node as Element;\n else {\n part.$w = (node as Text).parentNode;\n part.$o = TEXT;\n part.$l = node as Text;\n part.$v = committed;\n }\n } else {\n part = markered((node as Text).parentNode!, node as Text);\n (node as Text).parentNode!.insertBefore(node as Text, part.$e);\n part.$o = TEXT;\n part.$l = node as Text;\n part.$v = committed;\n }\n bindings[slot] = part;\n bindings[slot + 1] = UPGRADED;\n part.$p(value);\n } else if (value !== committed) {\n if (__DEV__ && typeof value === 'boolean') warnBooleanChild(value);\n if (committed === UNSET) {\n /** SOLE's first text: created holding its value. `''` creates no node, so that one is appended. */\n if (value === '') (node as Element).append('');\n else (node as Element).textContent = value as string;\n bindings[slot] = (node as Element).firstChild;\n } else (node as Text).data = value as string;\n bindings[slot + 1] = value;\n }\n return;\n }\n /**\n * One test for the kinds decided before anything is computed — the same one comparison `REFUSED` alone cost. A\n * `selectedIndex` has no statics and no URL: queued, as a select's value is. (Hydration never commits a selection:\n * the server marked the option, and whatever the user chose before the script arrived stands.)\n *\n * A style's or JSON block's text (`RAW_STYLE`/`RAW_JSON`): composed, compared with the text last composed, and only\n * when it changed escaped and written whole — the server's bytes (`@verajs/ssr`'s `styleHole` and JSON rule).\n */\n if (kind >= REFUSED) {\n if (kind === SELECT_INDEX) {\n bindings[slot + 1] = values[i];\n (pendingSelects ??= []).push(LATER, [node, values[i]]);\n } else if (kind !== REFUSED) {\n const parts = template.$J[i];\n let text: string;\n /**\n * Every render reaches here (these kinds sit past `LIVE`), so an unchanged text returns before any write: a lone\n * value by identity, as a plain text hole is skipped; statics and values by the composed text.\n */\n if (parts === null) {\n if (values[i] === committed) return;\n text = textOf((bindings[slot + 1] = values[i]));\n if (kind === RAW_ENCODED) text = encodeText(text);\n } else {\n text = parts[0]!;\n for (let p = 1; p < parts.length; p++) text += (kind === RAW_ENCODED ? encodeText(textOf(values[i + p - 1])) : textOf(values[i + p - 1])) + parts[p];\n if (text === committed) return;\n bindings[slot + 1] = text;\n }\n (node as Element).textContent = kind === RAW_ENCODED ? text : /*@__NOINLINE__*/ closedRawText(text, kind === RAW_JSON);\n }\n return;\n }\n const parts = template.$J[i];\n let value = values[i];\n if (parts !== null && kind !== EVENT && kind !== REF) {\n value = parts[0];\n for (let p = 1; p < parts.length; p++) value += toText(values[i + p - 1]) + parts[p];\n }\n const name = template.$N[i];\n const element = (kind >= EVENT && kind <= ADOPT ? (node as Slot)._element : node) as PropertyHost;\n /**\n * A `javascript:` URL bound where a browser navigates is code arriving as data: refused, and the\n * attribute removed, on the JOINED value (so `href=\"java${x}\"` is caught too). Statics are the author's\n * and never checked alone; only bindings the template marked as URL-bearing pay for the test.\n *\n * **Converted ONCE, and the string checked is the string written.** Testing the value and then handing it\n * to `setAttribute` converted it twice, so an object whose `toString` answered differently each time\n * passed the check as `https:` and was written as `javascript:`.\n */\n const url = template.$L[i];\n if (url > 1 && value != null && typeof value !== 'string') value = `${value}`;\n if (url !== 0 && typeof value === 'string' && (url === 3 ? SCRIPT_URL_ITEM : SCRIPT_URL).test(value)) {\n if (__DEV__ && value !== committed)\n console.warn(diagnostic('renderer', `<${element.localName}>`, 'script-url', __DEV__ && SHARED.scriptUrl(name)));\n bindings[slot + 1] = value;\n element.removeAttribute(name);\n return;\n }\n /** The kinds that re-assert every render sit from `LIVE` up (`REFUSED` returned above): ONE test routes them all. */\n if (kind >= LIVE) {\n if (kind === SELECT) (pendingSelects ??= []).push(element, value);\n /**\n * A COMPONENT is compared against its CURRENT value and RECEIVES a difference — through `adoptProperty`, as `.name`\n * does — or a running one never hears it: a plain write landed beside its render, which went on showing the old\n * value (released through 0.2.x). The current value of a name it received is the RAW one its store holds (core's\n * `_$raw$`): through the accessor it cost a store read every render and handed an object back as its proxy, never\n * `===` the object bound, so it was delivered again every render; any other name is read through `untracked`.\n * **Inline, not a shared helper — and spread's `!name` key has the same lines (keep them equal):** a call here cost\n * WebKit +3–4% on an unchanged `!name` (5 sessions, 0 faster), inlined −1.1% (5/5 faster than before the fix).\n */\n else if (\n (kind === LIVE\n ? element[name]\n : (raw = element._$raw$ as Record<string, unknown> | undefined) !== undefined && name in raw\n ? raw[name]\n : untracked(read, element, name)) !== value\n ) {\n if (kind === LIVE) element[name] = value;\n else adoptProperty(element, name, value);\n }\n } else if (value === committed) return;\n bindings[slot + 1] = value;\n if (kind === ATTR) {\n /**\n * A value that is not text becomes something nobody meant — a function's source, an array joined by commas, a\n * Date in the machine's timezone. Asked of the RAW value: a URL-bearing name was converted above. Said once per\n * element, name and kind of value (`dev-values`), so fixing one mistake never hides the next.\n */\n if (__DEV__ && value != null) {\n const kind = attributeValueKind(element.localName, name, parts === null ? values[i] : value);\n if (kind !== null) console.warn(diagnostic('renderer', `<${element.localName}>`, 'attribute-value', __DEV__ && SHARED.attributeValue(name, kind, `.${name}=\\${value}`)));\n }\n if (value != null) element.setAttribute(name, value as string);\n /** A fresh clone carries no attribute to remove unless the template itself wrote one. */\n else if (committed !== UNSET || template._present[i]) element.removeAttribute(name);\n } else if (kind === PROPERTY) element[name] = value;\n else if (kind === BOOLEAN) element.toggleAttribute(name, !!value);\n else if (kind === EVENT) {\n const listener = node as Slot;\n if (__DEV__ && value != null && value !== false) {\n /** Something that cannot listen does nothing, silently — `false`/`undefined` are the deliberate \"no handler\". */\n if (typeof value !== 'function' && typeof (value as EventListenerObject).handleEvent !== 'function')\n console.warn(diagnostic('renderer', `<${element.localName}>`, 'not-a-listener', __DEV__ && SHARED.notAListener(name, typeof value)));\n /** A misspelled event name (`@clik`), asked at the first attachment, once per tag and name. */\n if (listener._handler === null) {\n const best = eventNameGuess(element, name);\n if (best !== null)\n warnOnce('renderer', `<${element.localName}>`, 'event-name-typo', __DEV__ && (() => PROSE['event-name-typo'](name, element.localName, best)), eventKey(element, name));\n }\n }\n /** Registered once, as the listener OBJECT: the platform dedupes it, so toggling through null never stacks. */\n if (listener._handler === null && value != null) element.addEventListener(name, listener);\n listener._handler = value ?? null;\n } else if (kind === ADOPT) {\n const adopting = node as Slot;\n if (adopting._state === 1) element[name] = value;\n else if (adopting._state === 0) adopting._state = adoptProperty(element, name, value);\n } else if (kind === REF || kind === SELECT_REF) {\n /**\n * The ref this binding held was handed its element (it is not still queued), and it is being replaced or\n * removed: it is told now, before its successor is handed the element after the pass.\n */\n if (committed !== UNSET && (node as Slot)._state === 0) release(committed);\n if (value == null) return;\n notifyOnRemoval = true;\n /**\n * A value with `_$apply$` applies itself NOW, mid-commit, keyed by this binding — spread delivers\n * properties through it, and they must arrive before the element is inserted and upgraded.\n */\n /** A FUNCTION, not merely present: parsed JSON can carry the key, never a function — data stays data. */\n if (typeof (value as { _$apply$?: unknown })._$apply$ === 'function') {\n /** On a `<select>` it may set the selection (a spread's `.value`), so it waits for the options too — see `flush`. */\n if (kind === SELECT_REF) (pendingSelects ??= []).push(LATER, [value, element, node]);\n else (value as Applies)._$apply$(element, node as Slot, untracked);\n }\n /**\n * A ref — a function, or an object taking `.value` (core's `ref()`) — is handed its element once the pass's\n * DOM exists: inserted, upgraded, in its own document. Queued at most once per pass (`_state`), and the\n * flush reads whatever the binding holds THEN, so a ref replaced, removed or torn down in the meantime is\n * never handed a stale element.\n */\n else if ((typeof value === 'function' || typeof value === 'object') && (node as Slot)._state === 0) {\n (node as Slot)._state = 1;\n (pendingRefs ??= []).push(bindings, slot);\n }\n }\n};\n\n/**\n * Tells what an instance holds that it is going away: a ref is released (`null`, so a component reading\n * it after a subtree was replaced does not get a detached element back), and a child position that\n * became a part passes the news down. Reached only when `notifyOnRemoval` is set.\n */\nconst teardown = (instance: Instance) => {\n const kinds = instance._template.$K;\n const bindings = instance._bindings;\n /** An instance hook is told, with its state: it unmounts what it mounted, and one not yet mounted never mounts. */\n if (instance._template.$X) {\n const at = kinds.length * 2;\n const state = bindings[at];\n if (state !== undefined) {\n bindings[at] = undefined;\n instance._template._$inst$!.$q(state);\n }\n }\n for (let i = 0; i < kinds.length; i++) {\n const value = bindings[i * 2 + 1];\n if (kinds[i] === REF || kinds[i] === SELECT_REF) {\n /** A ref still queued was never handed its element, so it is not told it is gone. */\n if ((bindings[i * 2] as Slot)._state !== 1) release(value);\n bindings[i * 2 + 1] = UNSET;\n } else if (value === UPGRADED) (bindings[i * 2] as ChildPart)._destroy();\n }\n};\n/** A list item is going away for good. */\nconst detachItem = (item: Item) => (item instanceof ChildPart ? item._destroy() : teardown(item));\n\n/**\n * Tells a ref its element is no longer its: a function is called with `null`, an object's `.value` becomes\n * `null` (core's `ref()` — \"deliberately nothing\"). A value with `_$apply$` owns its own lifecycle.\n */\nconst release = (value: unknown) => {\n if (typeof value === 'function') applyRef(value as (element: Element | null) => void, null);\n else if (value !== null && typeof value === 'object' && value !== UNSET && (value as { _$apply$?: unknown })._$apply$ === undefined)\n (value as { value: unknown }).value = null;\n};\n\n/** A single property read — it runs once per list item per render. */\nconst isTemplateResult = (value: object): value is TemplateResult =>\n (value as TemplateResult).strings !== undefined;\n\n/** What a ChildPart holds. */\n\n\n/** Removal is a move into this fragment, then one clear. */\nconst SCRATCH = doc.createDocumentFragment();\n\n/**\n * Internals the hydrate entry adopts through. The base entry (`index.ts`) re-exports none of them, so its bundle\n * tree-shakes them away; the hydrate bundle inlines this module and reaches them.\n */\nexport {\n setProfileHook,\n PROFILE_UPDATE,\n PROFILE_CREATE,\n PROFILE_REBUILD,\n PROFILE_FRAME_START,\n PROFILE_FRAME_END,\n getTemplate,\n resolved,\n Instance,\n ChildPart,\n Slot,\n comment,\n toText,\n isTemplateResult,\n rootParts,\n registry,\n renderRoot,\n UNSET,\n UPGRADED,\n IGNORED,\n CHILD,\n SOLE,\n EVENT,\n ADOPT,\n TEXT,\n TEMPLATE,\n LIST,\n NODE,\n PROPERTY,\n LIVE,\n};\nexport type { Template };\n\n/** A list item: an instance of a single-root template (its element is its whole range), or a markered part. */\nexport type Item = Instance | ChildPart;\n\n/**\n * A value that names the strategy able to reconcile a list of its kind — `keyed()` is the producer.\n * It lives here rather than in `types.ts` because it names `ChildPart`, a runtime class of this file.\n */\nexport type ListStrategy = (part: ChildPart, values: unknown[], items: Item[], parent: Node, end: Node | null) => Item[];\n\n/** A `TemplateResult` that `keyed()` marked with its strategy. */\nexport interface KeyedResult extends TemplateResult {\n $r?: ListStrategy;\n}\n\n/**\n * A child position that holds anything but plain text: a template, a list, a node, or nothing — or\n * text it took over from an upgraded binding. It owns the range between two comment markers\n * — the root part's too, so content before and after a render stays — or, for a SOLE position, its element's whole\n * content (`$w`, no markers at all).\n *\n * **The ownership invariant — whoever writes an element's content owns it, and owns its verification.** Two cases:\n * a PLAIN element whose whole content is one binding belongs to that binding (the part is its range, and hydration\n * adopts it with no markers); a CUSTOM element's children belong to the component (a binding inside it keeps its\n * markers, and hydration compares them only when the template itself writes content inside the tag). Slots\n * inherit both.\n */\nclass ChildPart {\n $s: Comment | null;\n $e: Node | null;\n /** The element this part owns entirely (a SOLE position), or `null` for a part between markers. */\n $w: Node | null = null;\n $o = EMPTY;\n $v: unknown = undefined;\n $l: Text | null = null;\n $n: Instance | null = null;\n $i: Item[] | null = null;\n /** The key a keyed list reads when this part is one of its items. */\n $k: unknown = undefined;\n /** Instances `hold()` parked here, by template identity — they outlive interim content. */\n _held: Map<TemplateStringsArray, Instance> | null = null;\n /** Whatever the last `_$child$` applier returned here (its continuity), and which applier that was. */\n $z: unknown = undefined;\n $a: unknown = undefined;\n /** Released: its component was removed, and every user value it held dropped (see `releaseRoot`). */\n $x = false;\n /** The container whose render attached the applier — a later `_$commit$` runs as a render of it. */\n declare $R?: Node | null;\n\n constructor(start: Comment | null, end: Node | null) {\n this.$s = start;\n this.$e = end;\n }\n\n _insert(node: Node) {\n const placed = __DEV__ ? landing(node) : undefined;\n (this.$w ?? this.$s!.parentNode!).insertBefore(node, this.$e);\n if (__DEV__) checkForeign('renderer', this.$w ?? this.$s!.parentNode!, placed!, RETAG);\n }\n\n /**\n * Tells the CURRENT content that it is going away — the part itself stays, so what `hold()` parked here stays\n * parked and can still come back. Reached only when `notifyOnRemoval` is set.\n */\n _detach() {\n if (this.$a !== undefined) (this.$a as Applier)._$detach$?.(this.$z);\n if (this.$n !== null) teardown(this.$n);\n const items = this.$i;\n if (items !== null) for (let i = 0; i < items.length; i++) detachItem(items[i]);\n }\n\n /** The part itself is going away: its current content, and everything `hold()` parked here (then collectable). */\n _destroy() {\n this._detach();\n const held = this._held;\n if (held !== null) {\n for (const instance of held.values()) teardown(instance);\n this._held = null;\n }\n }\n\n _clear() {\n if (notifyOnRemoval) this._detach();\n const owner = this.$w;\n const start = this.$s;\n const end = this.$e;\n /** Owning the parent's whole content, one `textContent = ''` replaces a removal per node. */\n if (owner !== null) {\n if (__DEV__ && ownedRoots!.has(owner)) checkDropped(owner);\n owner.textContent = '';\n }\n else if (start!.previousSibling === null && end!.nextSibling === null) {\n const parent = start!.parentNode!;\n parent.textContent = '';\n parent.appendChild(start!);\n parent.appendChild(end!);\n } else {\n const parent = start!.parentNode!;\n let node = start!.nextSibling;\n /** `node !== null` is a backstop: a detached boundary leaves nodes behind rather than throwing mid-render. */\n while (node !== null && node !== end) {\n const next = node.nextSibling;\n parent.removeChild(node);\n node = next;\n }\n }\n this.$o = EMPTY;\n this.$l = null;\n this.$n = null;\n this.$i = null;\n this.$z = undefined;\n this.$a = undefined;\n }\n\n /**\n * How a `_$child$` applier renders — `_$`-named so it survives mangling, because third parties call\n * it. Its own state survives its own commit. A commit that arrives outside its container's render (an\n * applier resolving later) runs as a render of that container, while it still contains the part.\n */\n _$commit$(value: unknown) {\n const applierState = this.$z;\n const applier = this.$a;\n if (renderRoot !== this.$R || renderRoot === null)\n commitAs(this.$R != null && this.$R.contains(this.$w ?? this.$s) ? this.$R : null, this, value, this.$R ?? null);\n else this.$p(value);\n this.$z = applierState;\n this.$a = applier;\n }\n\n $p(value: unknown) {\n if (value == null) {\n if (this.$o !== EMPTY) this._clear();\n return;\n }\n if (typeof value !== 'object') {\n if (__DEV__ && typeof value === 'boolean' && (this.$o !== TEXT || this.$v !== value)) warnBooleanChild(value);\n if (this.$o === TEXT) {\n if (this.$v !== value) this.$l!.data = value as string;\n } else {\n if (this.$o !== EMPTY) this._clear();\n this._insert((this.$l = doc.createTextNode(value as string)));\n this.$o = TEXT;\n }\n this.$v = value;\n return;\n }\n /** `hold()` wraps a template as `{ $h }`: the one it replaces is parked by template identity, not destroyed. */\n const held = (value as { $h?: TemplateResult }).$h;\n if (held !== undefined || isTemplateResult(value)) {\n const result = held ?? (value as TemplateResult);\n /** The hottest line of a list update: same strings, commit the values and nothing else. */\n if (this.$o === TEMPLATE && this.$n!._strings === result.strings) {\n if (__DEV__ && profileHook !== null) profileHook(PROFILE_UPDATE, this, result.strings);\n update(this.$n!, result.values);\n return;\n }\n if (__DEV__ && profileHook !== null) profileHook(this.$o === TEMPLATE ? PROFILE_REBUILD : PROFILE_CREATE, this, result.strings);\n let instance: Instance | undefined;\n if (held !== undefined) {\n const parked = (this._held ??= new Map());\n if (this.$o === TEMPLATE) {\n const current = this.$n!;\n const root = current.$R;\n /** A fragment root takes its nodes back; an element root IS the range. */\n if (root.nodeType === 11) {\n let node = this.$w !== null ? this.$w.firstChild : this.$s!.nextSibling;\n while (node !== this.$e) {\n const next = node!.nextSibling;\n root.appendChild(node!);\n node = next;\n }\n } else root.parentNode?.removeChild(root);\n /**\n * Off the page now: slots watches what a parked branch's slots hold (`_$parked$`, off-chain like `_$done$`), told\n * WHOSE render parked it — the branch has left that host's subtree, where its one registration cannot see it.\n */\n (registry as { _$parked$?: (root: Node, owner: Node | null) => void } | null)?._$parked$?.(root, renderRoot);\n parked.set(current._strings, current);\n this.$o = EMPTY;\n }\n /** The map holds exactly what is PARKED: an instance coming back leaves it, so a later clear cannot strand it there. */\n instance = parked.get(result.strings);\n if (instance !== undefined) parked.delete(result.strings);\n }\n if (this.$o !== EMPTY) this._clear();\n if (instance === undefined) {\n if (__DEV__ && TEXT_ONLY.test(((this.$w ?? this.$s!.parentNode!) as Element).tagName)) sayTemplateInText(this.$w ?? this.$s!.parentNode!);\n let template = getTemplate(result);\n if (template.$X) template = resolved(template, this.$w ?? this.$s!.parentNode!);\n instance = instantiate(template, result, passDoc);\n this._insert(instance.$R);\n } else {\n /** Inserted first, then updated, as every update is: its nodes are live when its values commit. */\n this._insert(instance.$R);\n update(instance, result.values);\n }\n this.$n = instance;\n this.$o = TEMPLATE;\n return;\n }\n /** A value kind a module handles (`'value'` insert) — how a kind becomes a package, not a branch here. */\n const handlers = registry?.get('value') as ValueHandler[] | undefined;\n if (handlers !== undefined) for (let i = 0; i < handlers.length; i++) if (handlers[i](this, value)) return;\n if (Array.isArray(value)) return this._commitList(value);\n /**\n * Any other iterable is a list — but a node is placed, not iterated (a `<select>`, a `<form>`). Hydration's\n * `adoptObject` decides the same with its own lines: `tests/renderer-list-twins.test.mjs` keeps the two equal.\n */\n if (typeof (value as Iterable<unknown>)[Symbol.iterator] === 'function' && (value as Node).nodeType === undefined)\n return this._commitList([...(value as Iterable<unknown>)]);\n /**\n * A value that applies itself at a child position: `_$child$(part, previous)` renders through\n * `part._$commit$` and returns its continuity, handed back next time — to THIS applier only.\n */\n const applyChild = (value as { _$child$?: Applier })._$child$;\n if (applyChild !== undefined) {\n const previous = this.$a === applyChild ? this.$z : undefined;\n /**\n * An applier written as an object-literal method is a new function every call, so `previous` is always\n * undefined and it restarts every render. Said on the third swap at one part — once or twice is a real change.\n */\n if (__DEV__ && this.$a !== undefined && this.$a !== applyChild) {\n const swaps = (applierSwaps.get(this) ?? 0) + 1;\n applierSwaps.set(this, swaps);\n if (swaps === 3)\n console.warn(diagnostic('renderer', 'a child applier', 'applier-identity', __DEV__ && PROSE['applier-identity'](String(swaps))));\n }\n this.$a = applyChild;\n this.$R = renderRoot;\n if (applyChild._$detach$ !== undefined) notifyOnRemoval = true;\n this.$z = applyChild.call(value, this, previous);\n return;\n }\n if ((value as Node).nodeType !== undefined) {\n if (this.$o !== NODE || this.$v !== value) {\n if (this.$o !== EMPTY) this._clear();\n this._insert(value as Node);\n this.$v = value;\n this.$o = NODE;\n }\n return;\n }\n this.$p(String(value));\n }\n\n /** Creates one list item before `ref`. */\n $c(value: unknown, parent: Node, ref: Node | null): Item {\n if (value !== null && typeof value === 'object' && isTemplateResult(value)) {\n if (__DEV__ && TEXT_ONLY.test((parent as Element).tagName)) sayTemplateInText(parent);\n let template = getTemplate(value);\n if (template.$X) template = resolved(template, parent);\n if (template.$R.nodeType === 1) {\n const instance = instantiate(template, value, passDoc);\n into(parent, ref).insertBefore(instance.$R, ref);\n if (__DEV__) checkForeign('renderer', parent, [instance.$R], RETAG);\n instance.$k = value.key;\n /** Only a result marked `_$same$` (the keyed module marks its rows') records its identity. */\n if ((value as { _$same$?: unknown })._$same$ === 1) instance.$j = value;\n return instance;\n }\n }\n const part = markered(parent, ref);\n part.$p(value);\n part.$k = (value as TemplateResult | null)?.key;\n return part;\n }\n\n /** Commits `value` into an item; returns the item now standing there (an instance whose shape changed becomes a part). */\n $u(item: Item, value: unknown): Item {\n /**\n * The very result committed last time, and marked `_$same$`: nothing to do. Asked FIRST: it is the\n * common case of a keyed list's unchanged rows, and a part never records one (`$j` stays undefined).\n */\n if (value === (item as { $j?: unknown }).$j && value !== undefined) return item;\n if (item instanceof ChildPart) {\n item.$p(value);\n return item;\n }\n if (value !== null && typeof value === 'object' && (value as TemplateResult).strings === item._strings) {\n update(item, (value as TemplateResult).values);\n if ((value as { _$same$?: unknown })._$same$ === 1) item.$j = value;\n else if (item.$j !== undefined) item.$j = undefined;\n return item;\n }\n const element = item.$R as Element;\n const part = markered(element.parentNode!, element);\n /** The row's shape changed: the instance is gone for good, so what it holds is told. */\n if (notifyOnRemoval) teardown(item);\n /** `removeChild`, never `remove()`: the element may be a light slot, whose own `remove()` is the user's (slots). */\n element.parentNode?.removeChild(element);\n part.$k = item.$k;\n part.$p(value);\n return part;\n }\n\n /** The item's first node — its move handle and the insertion reference before it. */\n $f(item: Item): Node {\n return item instanceof ChildPart ? item.$s! : item.$R;\n }\n\n /** Moves an item before `ref`. */\n $m(item: Item, ref: Node | null, parent: Node = this.$w ?? this.$s!.parentNode!) {\n const at = into(parent, ref);\n if (!(item instanceof ChildPart)) {\n at.insertBefore(item.$R, ref);\n return;\n }\n let node: Node | null = item.$s!;\n const stop = item.$e!.nextSibling;\n while (node !== stop) {\n const next: Node | null = node!.nextSibling;\n at.insertBefore(node!, ref);\n node = next;\n }\n }\n\n /** Removes an item. */\n $d(item: Item) {\n if (notifyOnRemoval) detachItem(item);\n this.$m(item, null, SCRATCH);\n SCRATCH.textContent = '';\n }\n\n _commitList(values: unknown[]) {\n const count = values.length;\n /**\n * A keyed list names its own strategy (`keyed()` stamps `$r`). Keyed and index items are the same\n * kind of item — an unkeyed one carries `$k === undefined`, which a keyed pass treats as not found —\n * so a list can change between the two without being rebuilt.\n */\n const strategy = count ? (values[0] as KeyedResult | null)?.$r : undefined;\n if (this.$o !== LIST) {\n if (this.$o !== EMPTY) this._clear();\n this.$i = [];\n this.$o = LIST;\n }\n const items = this.$i!;\n if (count === 0) {\n if (items.length) {\n this._clear();\n this.$i = [];\n this.$o = LIST;\n }\n return;\n }\n const parent = this.$w ?? this.$s!.parentNode!;\n const end = this.$e;\n if (strategy !== undefined) {\n this.$i = strategy(this, values, items, parent, end);\n return;\n }\n /** Index mode: update in place, grow at the end, shrink from the end. Rows go straight into the parent. */\n const shared = items.length < count ? items.length : count;\n for (let i = 0; i < shared; i++) items[i] = this.$u(items[i], values[i]);\n for (let i = items.length; i < count; i++) items.push(this.$c(values[i], parent, end));\n if (count < items.length) {\n if (notifyOnRemoval) for (let i = count; i < items.length; i++) detachItem(items[i]);\n for (let i = count; i < items.length; i++) this.$m(items[i], null, SCRATCH);\n SCRATCH.textContent = '';\n items.length = count;\n }\n }\n}\n\n/** A value at a child position a module claims — the `'value'` insert. Return `true` to take it. */\ntype ValueHandler = (part: object, value: unknown) => boolean | void;\n/** An element-position value that applies itself — a spread. */\ntype Applies = { _$apply$: (element: Element, key: object, run: Untracked, adopting?: boolean) => void };\n\n/** A child-position applier: renders through `part._$commit$`, keeps continuity in its return value. */\ntype Applier = ((part: { _$commit$(value: unknown): void }, previous: unknown) => unknown) & {\n /** Told, with its last state, when its position goes away. */\n _$detach$?: (previous: unknown) => void;\n};\n\n/**\n * The registry `renderer.connect` was handed — the app's own, so a CDN page with separate bundles still\n * meets one `'value'`/`'error'` chain. Never imported: a production bundle inlines `@verajs/inserts`.\n */\nlet registry: { get(name: string): unknown[] | undefined } | null = null;\n\n/**\n * Core's `untracked`, taken off that registry at `connect` (`call` without core): what the renderer runs someone\n * else's code through during a render — a ref, and a component's getter it reads on the parent's behalf — so that\n * code's reads subscribe nothing. What the renderer reads ITSELF stays tracked: a store array handed to a template\n * is walked here, and that walk is what subscribes the parent to its length and items.\n */\nlet untracked: Untracked = call;\n\n/** The container of the `renderInto` in progress — a ref's error names its component through it. */\nlet renderRoot: Node | null = null;\n\n/**\n * Whether anything asked to be told when a subtree goes away: a ref to release, an applier with\n * `_$detach$`. Process-wide — an app with neither walks nothing, and a clear stays one `textContent = ''`.\n */\nlet notifyOnRemoval = false;\n\n/** Something adopted must be told when it goes away — an applier with `_$detach$` that hydration adopts. */\nexport const needRemovalWork = () => {\n notifyOnRemoval = true;\n};\n\n\n/**\n * Refs held until the pass's DOM exists, as flat `(bindings, slot)` pairs: each is handed its element once that\n * element is inserted, upgraded and in its own document. A render flushes only what it queued, so a nested render\n * cannot apply its caller's early. Refs run in commit order, which is document PRE-order — `<div ${a}>${child}</div><p\n * ${b}>` runs a, then the child's refs, then b — not all parents first.\n */\nlet pendingRefs: unknown[] | null = null;\n/**\n * **A `<select>`'s selection is written when the pass ends**, once its options exist. In document order a binding ON\n * the select comes before the options inside it, so a selection written in place — `.value`, `!value`,\n * `.selectedIndex`, or a spread's key — found no options and fell back to the first. Every source of options is\n * content inside the select (a list, a nested template, a keyed list: the content model allows only `<option>`,\n * `<optgroup>` and `<hr>`), so all of it exists when the pass ends. Options a user's code appends later are out of\n * scope.\n *\n * Flat PAIRS, one queue, in commit order. The common record is `(select, value)` for a `value` binding — compared\n * against the live value and written only on a difference (the write resets every option). The rare ones are\n * `(LATER, [select, index])` for `selectedIndex` and `(LATER, [applier, element, slot])` for a value applying itself\n * on a select, a spread. Flushed first, so a ref on the select sees its selection. A render flushes only what it\n * queued, however it ends, so nothing it held can land on a later, unrelated render.\n *\n * The shape is measured, on a table with a bound select per row: committing\n * each instance's selects after its own bindings, 2–4% slower; deferring the whole binding to a second commit,\n * 8–13%; records of three with the name in them, 3–6%. Pairs whose common case is exactly `(select, value)` tie.\n */\nconst LATER = {};\nlet pendingSelects: unknown[] | null = null;\nconst flush = (selectsFrom: number, refsFrom: number) => {\n const selects = pendingSelects;\n if (selects !== null && selects.length > selectsFrom) {\n const mine = selects.splice(selectsFrom);\n if (selects.length === 0) pendingSelects = null;\n for (let i = 0; i < mine.length; i += 2) {\n const a = mine[i];\n const b = mine[i + 1];\n if (a === LATER) {\n const r = b as unknown[];\n /** Read and written BY NAME: a computed `select[name]` on a DOM accessor measured 5% slower. */\n if (r.length === 2) {\n if ((r[0] as HTMLSelectElement).selectedIndex !== r[1]) (r[0] as HTMLSelectElement).selectedIndex = r[1] as number;\n } else (r[0] as Applies)._$apply$(r[1] as Element, r[2] as Slot, untracked);\n } else if ((a as HTMLSelectElement).value !== b) (a as HTMLSelectElement).value = b as string;\n }\n }\n /** Taken off first: a ref can render again. */\n const refs = pendingRefs;\n if (refs === null || refs.length <= refsFrom) return;\n const mine = refs.splice(refsFrom);\n if (refs.length === 0) pendingRefs = null;\n /** A ref is someone else's code: what it reads must not subscribe the render that handed it the element. */\n untracked(applyRefs, mine);\n};\n\n/**\n * Refs, and instance mounts, in commit order — once the pass's DOM exists, so a claim sees the finished tree. (A\n * claim that RELOCATES a node — elements', slots' — may run after refs inside it, so such a ref saw its element before\n * the move: the same element, but pre-claim geometry. Measure in a mount, or after the render, not in a ref.)\n */\nconst applyRefs = (mine: unknown[]) => {\n for (let i = 0; i < mine.length; i += 2) {\n const bindings = mine[i] as unknown[];\n const at = mine[i + 1] as number;\n if (typeof at !== 'number') {\n (mine[i] as InstanceHook).$m(at);\n continue;\n }\n const record = bindings[at] as Slot;\n const value = bindings[at + 1];\n record._state = 0;\n if (typeof value === 'function') applyRef(value as (element: Element | null) => void, record._element);\n else if (value !== null && typeof value === 'object' && value !== UNSET) (value as { value: unknown }).value = record._element;\n }\n};\n\n/**\n * The document the pass renders into — the container's own (a popped-out window's, an iframe's), so every\n * instance is built in its realm. Read off the container once per pass, never off a node that may still sit\n * in the inert template document.\n */\nlet passDoc: Document = doc;\n\n/**\n * Preserves the DOM of a template a position toggles away from, instead of destroying it — form values\n * and media state survive the round trip. Anything that is not a template passes straight through, so\n * `hold(editing && editor())` is fine.\n *\n * ```js\n * html`<div>${hold(editing ? editor() : viewer())}</div>`\n * ```\n */\nexport const hold = <T>(result: T): T | { $h: TemplateResult } =>\n result != null && typeof result === 'object' && isTemplateResult(result) ? { $h: result as TemplateResult } : result;\n\n/**\n * **Where an insert before `ref` goes** — the parent given, unless light-DOM slots moved `ref` (it marks what it moves,\n * `_$slotted$`, sigiled so both bundles read it): then `ref`'s own, which is where the light child now lives. A node\n * anything ELSE moved is not followed — the insert throws as it always has, rather than land in a stranger's container.\n */\nconst into = (parent: Node, ref: Node | null): Node =>\n ref !== null && (ref as { _$slotted$?: boolean })._$slotted$ ? ref.parentNode! : parent;\n\n/** A fresh part whose two markers sit before `ref` in `parent`. */\nconst markered = (parent: Node, ref: Node | null) => {\n const end = comment();\n const part = new ChildPart(comment(), end);\n const at = into(parent, ref);\n at.insertBefore(part.$s!, ref);\n at.insertBefore(end, ref);\n return part;\n};\n\n/**\n * Commits `value` into `part` as a render of `root`: the root and its document are set and restored (a render\n * can run inside another's commit), and the work this pass queued is flushed however it ends — before the\n * restore, so a ref's error still names its own component and a ref that renders renders into this document.\n * `home` is where the document comes from when `root` is not the render being attributed: the container an\n * applier was attached under, even after the part has moved out of it (a parked `hold` fragment belongs to the\n * inert template document, and must never become the document a render builds in).\n */\nconst commitAs = (root: Node | null, part: ChildPart, value: unknown, home: Node | null = root) => {\n const outer = renderRoot;\n const outerDoc = passDoc;\n const selectsMark = pendingSelects?.length ?? 0;\n const refsMark = pendingRefs?.length ?? 0;\n const outerScope = scope;\n scope = null;\n renderRoot = root;\n /** A document's own `ownerDocument` is null — so a document container is its own. */\n if (home !== null) {\n const owner = home.ownerDocument ?? (home as Document);\n /**\n * **Content builds in the realm of the element it renders into** (2026-10-22). A component of THIS realm moved\n * into a pop-out or an iframe keeps building here: made through that window's document, its children would be looked\n * up in THAT window's registry — Chromium upgrades them anyway, Firefox and WebKit leave them inert; cloned through\n * this renderer's own document they upgrade at the clone on all three and keep their class once inserted there\n * (adoption; BROWSER-LEDGER 2026-10-22). An element of the OTHER realm — a plain container that window made, or a\n * component its own registry defined — builds in its own document, with that window's classes\n * (`tests/browser/realm.test.js`). Checked only for a container in another window (\"not ours, and has a window\" — a\n * document with a window is that window's only one); a windowless document (a server's, a template's) is used as is.\n */\n passDoc =\n owner !== doc && owner.defaultView !== null && ((root as ShadowRoot | null)?.host ?? root) instanceof (doc.defaultView as typeof globalThis).HTMLElement\n ? doc\n : owner;\n }\n /** Development: a commit into an owned root is that root's own work (see `strays`). */\n const marking = __DEV__ && root !== null && ownedRoots!.has(root) && !rendering!.has(root);\n if (marking) {\n sweepStrays();\n rendering!.add(root!);\n }\n try {\n part.$p(value);\n } finally {\n flush(selectsMark, refsMark);\n if (marking) {\n sweepStrays();\n rendering!.delete(root!);\n }\n renderRoot = outer;\n passDoc = outerDoc;\n scope = outerScope;\n }\n};\n\n\n/**\n * **Each root's part, kept ON the root** — under this renderer copy's own `Symbol` (2026-10-17). It was a WeakMap keyed\n * by DOM nodes, and that cost every component's creation and removal in both engines' collectors: fresh-browser races\n * of shadow components put it at ~11% in Firefox and ~9% in Chrome (Firefox's sweep and mark phases, per entry). A field\n * is an ordinary property, freed with its root. **A Symbol, never a string:** a page can hold two renderer copies (a CDN\n * bundle beside an app's, two versions), and a string-named field — lit's `_$litPart$` — would hand one copy the\n * other's part; per-copy, each sees only its own, as with the WeakMap. Root → part → root is a DOM↔JS cycle only\n * Firefox's cycle collector frees, so a released root's part lets go of its root (`releaseRoot`).\n */\nconst PART = Symbol();\ntype Rooted = Node & { [PART]?: ChildPart };\nconst rootParts = {\n get: (node: Node) => (node as Rooted)[PART],\n set: (node: Node, part: ChildPart) => {\n (node as Rooted)[PART] = part;\n },\n};\n\n/**\n * **A root the template OWNS** (`foreignNodes: 'drop'`, 2026-10-16: shadow component roots). Core's render hook\n * says so with its third argument — a container handed to `renderInto` directly never does — and it is taken only for a\n * SHADOW root EMPTY at its first render: a declarative (server) root and one holding styles' text fallback are not empty,\n * and keep their markers. No marker comments: the part owns the root's whole content (`$w`, as a sole binding owns its\n * element), so a template change clears it with one `textContent = ''` — foreign nodes included — and an ordinary\n * re-render touches nothing it did not render. Where new content lands relative to a foreign node is not promised.\n */\nconst owned = (container: Node) => {\n const part = new ChildPart(null, null);\n part.$w = container;\n if (__DEV__) watchOwned(container);\n return part;\n};\n\n/**\n * **Development: what an owned root's clear drops.** Nodes the RENDER placed are its own; anything placed while no render\n * of that root was running is foreign. One observer (built from the first owned root's own window) watches every owned\n * root's direct children; its records are sorted at each commit's start and end — so whatever arrives between renders is\n * foreign, and whatever a render inserts is not — and once more at a clear, which then names a foreign node it is about to\n * remove. Production keeps none of it: the clear is the same in both builds, only the line is development's.\n * **Best-effort across windows:** ONE observer serves every window, so a root that moves to another window stays on the\n * observer that sweeps it (one per window would sweep the new window's while the records sat in the old one's, and call\n * the root's own renders foreign). Should the window it was built from go away and take the observer with it, the\n * warning goes quiet; what a clear removes never depends on it.\n */\nconst strays = __DEV__ ? new WeakSet<Node>() : null;\nconst ownedRoots = __DEV__ ? new WeakSet<Node>() : null;\nconst rendering = __DEV__ ? new Set<Node>() : null;\nlet strayWatch: MutationObserver | null | undefined;\nconst sortStrays = (records: MutationRecord[]) => {\n for (const record of records) {\n const own = rendering!.has(record.target);\n for (const node of record.addedNodes)\n if (own) strays!.delete(node);\n else strays!.add(node);\n }\n};\nconst sweepStrays = () => {\n if (strayWatch) sortStrays(strayWatch.takeRecords());\n};\nconst watchOwned = (container: Node) => {\n ownedRoots!.add(container);\n if (strayWatch === undefined) {\n const View = (container.ownerDocument?.defaultView as (typeof globalThis) | null | undefined)?.MutationObserver;\n strayWatch = View ? new View(sortStrays) : null;\n }\n strayWatch?.observe(container, { childList: true });\n};\n/** Development: whether a clear is dropping a node the template did not make, said once per page. */\nconst checkDropped = (owner: Node) => {\n sweepStrays();\n if (hasWarned('foreign-dropped')) return;\n for (let node = owner.firstChild; node !== null; node = node.nextSibling)\n if (strays!.has(node)) {\n const host = (owner as ShadowRoot).host;\n warnOnce('renderer', host ? `<${host.localName}>` : 'renderInto', 'foreign-dropped', __DEV__ && (() => PROSE['foreign-dropped'](describe(node))));\n return;\n }\n};\n/** Development: a node named in the drop warning — its tag, or its kind. */\nconst describe = (node: Node) => (node.nodeType === 1 ? `<${(node as Element).localName}>` : node.nodeType === 3 ? 'a text node' : 'a comment');\n\n/** `hydration`'s adoption, installed through the hand-off (`$Y`): true when it adopted the container. */\nlet adopt: ((result: unknown, container: Node) => boolean) | undefined;\n\n/**\n * The container is the argument people forget, and forgetting it failed with `Cannot read properties of undefined`\n * — a message about the internals of a function the caller never named. Development only; the hydrate entry calls\n * it too, since it reads the container before it reaches the base render.\n */\nexport const expectContainer = (container: unknown) => {\n if (!container || typeof (container as Node).appendChild !== 'function')\n throw new TypeError(misuse('renderInto', 'no-container', __DEV__ && PROSE['no-container'](String(container))));\n};\n\n/**\n * Writes a template result into a container — the renderer's imperative draw: no reactivity, no\n * lifecycle. The first call appends two markers and anchors a root part between them; later calls reuse it\n * and commit only the values. Content already in the container stays, and so does content other code adds\n * after it — the render owns its range, never the container. lit-html's argument order. The third argument, `owns`, is\n * core's: its render hook passes a component's `foreignNodes: 'drop'` with every render, and a shadow root that is empty\n * at its first render is then the template's whole (`owned`). A direct call is a container's, and keeps its markers.\n */\n/**\n * **A removed component's root part, RELEASED** (2026-10-11). Core's teardown calls `$x(container)` (the\n * registry sigil this renderer publishes at connect): every user value the part's tree holds is dropped — each event\n * `Slot`'s handler, each binding's committed value, nested parts, keyed items, `hold()`-parked instances — so the\n * removed DOM keeps no path back into the component's JS (its handlers close over the whole setup scope, and the DOM's\n * own listener lists hold the Slots). That cycle was Firefox's CYCLE collector's to free: with host-capturing handlers,\n * 20 s of CC on a churn page against vanilla `addEventListener`'s 1 s. The DOM itself is LEFT as it is (code holding a\n * removed element still sees its content); the stripped part stays in `rootParts`, flagged, so a RE-ADD finds it,\n * clears its range and renders fresh — never a second copy, and never taken for a server page by hydration.\n */\nconst releaseItem = (item: Item): void => {\n if (item instanceof ChildPart) {\n if (item.$n !== null) releaseItem(item.$n);\n const items = item.$i;\n if (items !== null) for (let i = 0; i < items.length; i++) releaseItem(items[i]!);\n item._held?.forEach(releaseItem);\n item.$v = item.$z = item.$a = undefined;\n item.$n = null;\n item.$i = null;\n item._held = null;\n return;\n }\n const bindings = item._bindings;\n for (let i = 0; i < bindings.length; i += 2) {\n const target = bindings[i];\n if (target instanceof Slot) target._handler = null;\n else if (target instanceof ChildPart) releaseItem(target);\n bindings[i + 1] = undefined;\n }\n};\n/**\n * Called with the removed ELEMENT: a light component's part is keyed by the element itself (a hit); a shadow one's by its\n * root. The part STAYS in `rootParts`, stripped and flagged (`$x`) — no map work per removal; a re-add finds the flag.\n */\nconst releaseRoot = (element: Node) => {\n const part = rootParts.get(element) ?? rootParts.get((element as Element).shadowRoot ?? element);\n if (part === undefined || part.$x) return;\n releaseItem(part);\n part.$x = true;\n /**\n * An OWNED root's part lets go of its root, so the removed root and its part are no cycle for Firefox's cycle collector\n * (−113 ms of incremental CC on a churn page, 2026-10-17); `reviveRoot` gives it back. A markered part keeps its two\n * markers: a re-add clears between them.\n */\n if (part.$s === null) part.$w = part.$l = part.$R = null;\n};\n/**\n * **A released component is coming back** — core calls `$y(element)` as a re-init starts, BEFORE its `'init'` inserts:\n * an OWNED released root is cleared now, so what those inserts put in the root (styles' `<style>` fallback in a window that\n * cannot adopt the sheet) is never in the way of the clear. An owned root has no markers to bound it, so this is the\n * only moment its own content and theirs are told apart without holding a node (a part holding the removed root's\n * nodes cost Firefox's churn 2.3%, 2026-10-16). The first render then draws into an empty part.\n */\nconst reviveRoot = (element: Node) => {\n const container = rootParts.get(element) !== undefined ? element : (element as Element).shadowRoot ?? element;\n const part = rootParts.get(container);\n /**\n * OWNED roots only (no markers): a markered root's own clear stops at its marker, so it waits for the next render as it\n * always did — and a re-init that renders nothing (`init(this)` with no setup, its content drawn by someone else) keeps it.\n */\n if (part === undefined || !part.$x || part.$s !== null) return;\n part.$w = container;\n part.$x = false;\n part._clear();\n};\n\nexport const renderInto = (result: unknown, container: Node, owns?: boolean) => {\n if (__DEV__) expectContainer(container);\n if (__DEV__ && profileHook !== null) profileHook(PROFILE_FRAME_START, container, null);\n let part = rootParts.get(container);\n /** A RE-ADDED component: its released part's old range is cleared, and it renders fresh into it. */\n if (part?.$x) {\n /** An owned part let go of its root at the release; it is this container. */\n if (part.$s === null) part.$w = container;\n part.$x = false;\n part._clear();\n }\n /**\n * A container's FIRST render, with something already in it: `hydration` (when wired) may adopt that as server output\n * of this template — then it is committed, and the render is done. Asked only on a first render, never on the hot\n * path; without hydration it is one undefined read.\n */\n if (part === undefined && adopt !== undefined && container.firstChild !== null && adopt(result, container))\n part = rootParts.get(container)!;\n else {\n if (part === undefined) {\n /**\n * Nothing adopts: whatever recognizes server markup is told before this render would append beside it (light slots)\n * — only a container that HAS something in it; an empty one (every plain component's first render) holds no\n * server markup, and asking it cost Firefox a call per component (2026-10-17 profile).\n */\n if (adopt === undefined && container.firstChild !== null) (registry as { _$unadopted$?: (container: Node) => void } | null)?._$unadopted$?.(container);\n rootParts.set(container, (part = owns === true && container.nodeType === 11 && container.firstChild === null ? owned(container) : markered(container, null)));\n }\n commitAs(container, part, result);\n }\n /**\n * **A render has finished** — said to whatever asked (light-DOM slots, which re-distributes what this render did to\n * a host's light children before anything reads them, and at a container's first render takes what was there before\n * the render's own range — `start` — as its light children). Off-chain and sigiled, like `$t`: not an extension point.\n */\n (registry as { _$done$?: (container: Node, start: Node) => void } | null)?._$done$?.(container, part.$s!);\n if (__DEV__ && profileHook !== null) profileHook(PROFILE_FRAME_END, container, null);\n};\n\n/**\n * Marks the raw function so `wire(renderInto)` — wiring the draw instead of the module — is caught by name in\n * development: the inserts registry reads `$module` and says `did you mean \\`renderer\\``. Production carries neither.\n */\nif (__DEV__) (renderInto as unknown as { $module?: string }).$module = 'renderer';\n\n/** Everything this renderer needs, in one entry: `wire([renderer])`. */\n/** The renderer's connect: core's registry, its untracked primitive, and the hydration hand-off. */\nconst connectTo = (given: { get(name: never): unknown }) => {\n /**\n * **One renderer serves one core** (2026-10-21). Two apps sharing one renderer bundle (two cores, the\n * micro-frontend shape) leave it following the LAST core's seams — `untracked` among them — so the first app's\n * tracking silently breaks. It stays last-wins, and says so once in EVERY build — production as a short line with\n * the code's docs link (the hazard exists ONLY in production: development's core copies share one registry). The same registry wired again\n * (`wire([renderer({ shadow })])` after `wire([renderer])`) is not a second core.\n */\n if (registry !== null && registry !== given) {\n console.warn(__DEV__ ? diagnostic('renderer', 'renderer', 'renderer-two-cores', __DEV__ && PROSE['renderer-two-cores']()) : '[vera] renderer-two-cores');\n }\n registry = given as { get(name: string): unknown[] | undefined };\n untracked = (given as { $t?: Untracked }).$t ?? call;\n /**\n * Development: \"the full renderer is connected\" (Brian's ruling, 2026-11-12). Automatic lists (`lists`) commit their rows through\n * this renderer's 'value' insert; wired beside only a bare render descriptor (`{ on: 'render', fn: renderInto }`),\n * which never connects, each row's change re-renders its parent instead, and core's `mapped` says so once.\n */\n if (__DEV__) (given as { $rn?: true }).$rn = true;\n /** Defined up front, so every render's `_$done$` read is a HIT on a page without slots — not a miss down the Map's chain. */\n (given as { _$done$?: unknown })._$done$ ??= undefined;\n /** The release core's teardown calls with a removed component (see `releaseRoot`). */\n (given as { $x?: (container: Node) => void }).$x = releaseRoot;\n /** …and the revival core's re-init calls before its `'init'` inserts (see `reviveRoot`). */\n (given as { $y?: (container: Node) => void }).$y = reviveRoot;\n /**\n * **The hydration hand-off** — the one door `hydration` reaches this renderer's internals through (a separately\n * bundled module cannot import them, and production mangles their names): only values the renderer already holds,\n * so it pulls no code in. An ARRAY, read by the `HANDOFF_*` positions in `kinds.ts` (names would cost every app\n * bytes). Position 0 is its protocol number; on a mismatch hydration declines and the page renders fresh, with a\n * warning. Positions 0 and 1 are FROZEN — the same in every protocol — so a mismatched hydration can still clear\n * server markup.\n */\n (given as { $H?: unknown }).$H = [\n PROTOCOL, // HANDOFF_PROTOCOL\n (fn: typeof adopt) => (adopt = fn), // HANDOFF_ADOPTER\n getTemplate, // HANDOFF_GET_TEMPLATE\n ChildPart, // HANDOFF_CHILD_PART\n Instance, // HANDOFF_INSTANCE\n Slot, // HANDOFF_SLOT\n UNSET, // HANDOFF_UNSET\n UPGRADED, // HANDOFF_UPGRADED\n commit, // HANDOFF_COMMIT\n commitAs, // HANDOFF_COMMIT_AS\n hookUp, // HANDOFF_HOOK_UP\n resolved, // HANDOFF_RESOLVE\n rootParts, // HANDOFF_ROOTS\n toText, // HANDOFF_TO_TEXT\n needRemovalWork, // HANDOFF_REMOVAL_WORK\n ];\n};\n\n/**\n * Whether this process is a SERVER: `@verajs/ssr` sets this public flag at import. Read ONCE, as this module loads — a\n * server always imports ssr first, because this module reads `document` as it loads and only ssr's DOM provides one.\n */\nconst onServer = (globalThis as { __veraSsrShimmed?: boolean }).__veraSsrShimmed === true;\n\ntype Registry = { get(name: never): unknown; $S?: unknown; $F?: unknown };\n/**\n * What a consumer's TypeScript sees — the shape `wire` accepts (`Wireable`, structurally: this package imports no\n * types from `@verajs/inserts`): a DESCRIPTOR, `on: 'render'`, callable with options to give `[renderer, a connector]`.\n * On a server `on` is in fact `undefined` (decided at load, below) — a runtime decision the type does not carry, as\n * the previous `on: 'render' | undefined` did: that matched neither a descriptor nor a connector, so `wire([renderer])`\n * stopped compiling in a consumer's project (tests/consumer, 2026-10-10).\n */\ntype RendererModule = ((options?: { shadow?: 'open' | 'closed' | false | ShadowRootInit; foreignNodes?: 'preserve' | 'drop' }) => readonly [RendererModule, (registry: Registry) => void]) & {\n readonly on: 'render';\n fn: never;\n priority: number;\n connect: (given: Registry) => void;\n};\n\n/**\n * **`renderer` is a DUAL** — `wire([renderer])` as it always was, or `wire([renderer({ shadow: 'open' })])` to set the\n * app's default root: every component whose own `shadow` option says nothing gets it (core's `init` reads it after the\n * component's own and before light DOM). `renderer({ foreignNodes: 'preserve' })` is the same for `foreignNodes`, and sets\n * COMPONENT roots only — a container handed to `renderInto` (`document.body`, `#app`) always keeps foreign nodes. Called, it returns `[renderer, a connector setting the default]` — `wire`\n * takes nested arrays — so the module is one function with its descriptor fields on it, and nothing is made per call\n * but that connector.\n *\n * **On a server it declines its render insert** (Brian's (b′), 2026-10-10): `@verajs/ssr` renders with its own renderer,\n * and a client one wired in shared app code used to DISPLACE it, breaking every server render. There `on` is undefined,\n * which makes `wire` hand this function the registry as a CONNECTOR: it still CONNECTS — the registry, `untracked`, the\n * hydration hand-off: a process that loaded ssr may install a client DOM and call renderInto directly (tests/spread-ssr\n * does) — and only the render INSERT is declined, so one shared `wire([renderer({ shadow })])` carries the same default\n * to both sides. Development says so once per process.\n */\nexport const renderer = Object.assign(\n (given?: { shadow?: unknown } | Registry) => {\n if ((given as Registry | undefined)?.get) {\n connectTo(given as Registry);\n /** Development: the decline is said once per process. */\n if (__DEV__) warnOnce('renderer', 'wire([renderer])', 'renderer-on-server', __DEV__ && (() => PROSE['renderer-on-server']()));\n return;\n }\n if (__DEV__ && given != null && typeof given !== 'object') {\n console.warn(diagnostic('renderer', 'renderer()', 'renderer-options', __DEV__ && PROSE['renderer-options'](typeof given === 'string' ? `'${given}'` : String(given))));\n return [renderer];\n }\n if (__DEV__)\n for (const key in given as object)\n if (key !== 'shadow' && key !== 'foreignNodes')\n console.warn(diagnostic('renderer', 'renderer()', 'unknown-option', __DEV__ && SHARED.unknownOption(key, 'foreignNodes, shadow')));\n const shadow = (given as { shadow?: unknown } | undefined)?.shadow;\n const foreignNodes = (given as { foreignNodes?: unknown } | undefined)?.foreignNodes;\n return [\n renderer,\n (registry: Registry) => {\n if (shadow !== undefined) registry.$S = shadow;\n if (foreignNodes !== undefined) registry.$F = foreignNodes;\n },\n ];\n },\n { on: onServer ? undefined : ('render' as const), fn: renderInto as never, priority: 50, connect: connectTo }\n) as unknown as RendererModule;\n/** Development: the name the collision warning reports (`wire`'s name bookkeeping is development-only). */\nif (__DEV__) Object.defineProperty(renderer, 'name', { value: '@verajs/renderer' });\n\n/**\n * Development: `renderInto` is the draw, not the module — `wire([renderInto])` would be taken as a connector and\n * register nothing, silently. `wire` reads this mark and names `renderer` instead. Production carries\n * neither.\n */\nif (__DEV__) (renderInto as unknown as { $module?: string }).$module = 'renderer';\n"],"names":["misuse","forName","withCode","andProse","adoptProperty","element","name","value","adopt","_$adopt$","carrier","Object","getPrototypeOf","desc","getOwnPropertyDescriptor","undefined","set","get","call","_$props$","view","ownerDocument","defaultView","HTMLElement","prototype","SCRIPT_URL","URL_SINK","SCRIPT_URL_ITEM","INLINE_HANDLER","JSON_BLOCK","closedRawText","text","json","replace","encodeText","c","charCodeAt","fn","a","b","dispatch","holder","event","handler","_handler","_element","handleEvent","isSelection","localName","read","target","key","LIVE","MARKER","INERT_MARKERS","doc","document","comment","createComment","TEXT_END","COMMENT_END","COMMENT2_END","TAG_END","DOUBLE_QUOTE_END","SINGLE_QUOTE_END","RAW_TEXT_TAGS","NEVER_SHOWN","UNSET","UPGRADED","Template","$R","_plain","$K","$N","$J","$P","_present","$L","$X","constructor","result","strings","count","length","kinds","this","Array","fill","names","statics","present","urls","nodes","rawEnd","markup","regex","open","i","s","match","nameEnd","continues","at","lastIndex","exec","test","RegExp","slice","startsWith","type","_$litType$","createElement","innerHTML","content","firstChild","replaceWith","childNodes","walker","createTreeWalker","node","nextNode","nodeType","data","anchor","createTextNode","currentNode","el","includes","hasAttribute","attribute","getAttributeNames","endsWith","parseInt","getAttribute","split","removeAttribute","written","first","kind","real","toLowerCase","sink","source","tagName","firstElementChild","textContent","Error","pieces","raw","filter","_","p","append","root","nextSibling","parent","parentNode","host","removeChild","path","index","sibling","previousSibling","unshift","push","hooks","registry","readScope","_$at$","_$inst$","_$ns$","scope","resolved","template","templateCache","WeakMap","forged","getTemplate","isArray","hasOwn","toText","textOf","Slot","_state","untracked","applyRef","callback","error","handlers","line","reportError","console","reportUncaught","reportTo","renderRoot","Instance","$k","$j","_template","_strings","_bindings","bindings","instantiate","owner","cloneNode","importNode","paths","marked","step","hops","instance","hookUp","outer","update","values","adopted","hook","state","$c","pendingRefs","notifyOnRemoval","commit","slot","committed","$p","part","ChildPart","$w","$o","$l","$v","markered","insertBefore","$e","pendingSelects","LATER","parts","url","_$raw$","setAttribute","toggleAttribute","listener","addEventListener","adopting","release","_$apply$","teardown","$q","_destroy","detachItem","item","isTemplateResult","SCRATCH","createDocumentFragment","$s","$n","$i","_held","$z","$a","$x","start","end","_insert","_detach","_$detach$","items","held","_clear","appendChild","next","_$commit$","applierState","applier","commitAs","contains","$h","parked","Map","current","_$parked$","delete","passDoc","_commitList","Symbol","iterator","applyChild","_$child$","previous","String","ref","into","_$same$","$u","$f","$m","stop","$d","strategy","$r","shared","needRemovalWork","applyRefs","mine","record","hold","_$slotted$","home","outerDoc","selectsMark","refsMark","outerScope","selectsFrom","refsFrom","selects","splice","r","selectedIndex","refs","flush","PART","rootParts","releaseItem","forEach","releaseRoot","shadowRoot","reviveRoot","container","renderInto","owns","_$unadopted$","owned","_$done$","connectTo","given","warn","$t","$y","$H","onServer","globalThis","__veraSsrShimmed","renderer","assign","shadow","foreignNodes","$S","$F","on","priority","connect"],"mappings":"AAMO,MA0EMA,EAAS,CAACC,EAAiBC,EAAkBC,IAGpD,GAAGF,2BAAmBC,ICnDfE,EAAgB,CAACC,EAAuBC,EAAcC,KAOjE,GAAa,cAATD,EAAsB,OAAO,EACjC,MAAME,EAAQH,EAAQI,SAEtB,IAAK,IAAIC,EAAyBL,EAAqB,OAAZK,EAAkBA,EAAUC,OAAOC,eAAeF,GAAU,CACrG,MAAMG,EAAOF,OAAOG,yBAAyBJ,EAASJ,GACtD,QAAaS,IAATF,EAAJ,CACA,QAAiBE,IAAbF,EAAKG,IAEP,OADAX,EAAQC,GAAQC,EACT,EAET,QAAiBQ,IAAbF,EAAKI,IAUP,YATcF,IAAVP,GAAqBA,EAAMU,KAAKb,EAASC,EAAMC,GAS5C,EAET,KAjBwB,CAkB1B,CAEA,GADAF,EAAQC,GAAQC,OACFQ,IAAVP,EAEF,OADAA,E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