@verajs/renderer 0.1.3 → 0.1.4

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.
@@ -473,7 +473,54 @@ class AttrPart {
473
473
  this._element.setAttribute(this._name, value);
474
474
  }
475
475
  else if (kind === PROPERTY) {
476
- this._element[this._name] = value;
476
+ const target = this._element;
477
+ const name = this._name;
478
+ target[name] = value;
479
+ /**
480
+ * Detection only, and deliberately not repair.
481
+ *
482
+ * A property set on a custom element that has not upgraded yet lands as an own property on
483
+ * the instance. When the definition arrives — lazily imported, code-split, or a module that
484
+ * simply had not run — `customElements.define` upgrades synchronously and the class's field
485
+ * initializers execute. At target ES2022 a field declaration is a `[[Define]]`, so
486
+ * `item?: T` emits `item;` and overwrites the bound value with `undefined`. Nothing throws;
487
+ * it reads as broken reactivity.
488
+ *
489
+ * Repairing it was tried and removed. Re-applying when the slot came back `undefined`
490
+ * covered `item?: T` but not `item = someDefault`, which overwrites with the default and
491
+ * never looks clobbered — so the repair was silently partial, and made the bug intermittent
492
+ * across two spellings of the same mistake. It also cost 74 B in every app while leaving
493
+ * `declare` mandatory anyway, because a property assigned imperatively is unrecoverable:
494
+ * the renderer never saw it, and by the time `init()` runs the value is already gone.
495
+ *
496
+ * So this is `true`-only and production pays nothing — no check, no message, no
497
+ * `whenDefined` subscription. Lit reached the same place from the other direction and
498
+ * throws (`lit.dev/msg/class-field-shadowing`); a warning suffices here because Vera has no
499
+ * prototype accessors to shadow permanently — the damage is one lost value, not a property
500
+ * that never updates again.
501
+ */
502
+ if (true) {
503
+ const tag = this._element.localName;
504
+ if (tag.indexOf('-') > 0 && !customElements.get(tag)) {
505
+ customElements.whenDefined(tag).then(() => {
506
+ /**
507
+ * States what was observed rather than diagnosing it. A class field is the usual
508
+ * cause by a wide margin, but a component that assigns the property itself during
509
+ * upgrade produces the same observation, and that is a legitimate — if confusing —
510
+ * thing to do, since the renderer's dirty check will not re-apply the bound value on
511
+ * the next render either.
512
+ */
513
+ if (target[name] !== value)
514
+ console.warn(`@verajs/renderer: the value bound by \`.${name}=\${…}\` on <${tag}> was replaced ` +
515
+ `while the element upgraded. A class field is the usual cause: at ES2022 ` +
516
+ `\`${name}?: …\` emits \`${name};\`, which runs during upgrade and overwrites ` +
517
+ `whatever was set beforehand — write it \`declare ${name}?: …\` instead, which ` +
518
+ `emits nothing. A plain field also wipes properties assigned imperatively, ` +
519
+ `which cannot be detected at all. Ignore this if the component replaced the ` +
520
+ `value on purpose.`);
521
+ });
522
+ }
523
+ }
477
524
  }
478
525
  else if (kind === BOOLEAN) {
479
526
  if (!isFirst || value)
@@ -617,14 +664,25 @@ class ChildPart {
617
664
  }
618
665
  _clear() {
619
666
  const parent = this._start.parentNode;
667
+ const end = this._end;
620
668
  /**
621
669
  * When this part owns its parent's entire contents, one `textContent = ''` replaces removing
622
670
  * every node individually. For a 1 000-row table body that is the difference between ~22 ms
623
671
  * (lit-html's per-node teardown) and ~5 ms.
672
+ *
673
+ * A part owns the whole parent when nothing precedes its start AND nothing follows its end —
674
+ * `_end === null` (a root part, which runs to the end by definition) or `_end` is the last
675
+ * child. The second case is the common one and used to miss this path entirely: every list
676
+ * written as `<tbody>${rows}</tbody>` sits inside a template, and since 0.1.2 a nested part
677
+ * always owns an end marker, so `_end === null` alone never held for it.
678
+ *
679
+ * Re-appending both anchors in order restores the part's boundary exactly as it was.
624
680
  */
625
- if (this._start.previousSibling === null && this._end === null) {
681
+ if (this._start.previousSibling === null && (end === null || end.nextSibling === null)) {
626
682
  parent.textContent = '';
627
683
  parent.appendChild(this._start);
684
+ if (end !== null)
685
+ parent.appendChild(end);
628
686
  }
629
687
  else {
630
688
  let node = this._start.nextSibling;
@@ -1 +1 @@
1
- {"version":3,"file":"vera-renderer.js","sources":["../../../../../../src/renderer.ts"],"sourcesContent":["/**\n * @verajs/renderer — a ground-up, keyed, template-identity renderer.\n *\n * Replaces the Reef-derived renderer, which flattened every template to an HTML string and\n * re-parsed it on each change — O(whole template) work for a one-row edit, measured at 85 ms for a\n * two-row swap that lit-html does in 3.5 ms.\n *\n * The architecture here is the one that wins that benchmark:\n *\n * 1. A tagged template literal's `strings` array is frozen and IDENTICAL for every call from the\n * same call site, so it is a cache key for the template's static shape. The shape is parsed\n * ONCE into a `<template>` element with markers where the expressions go.\n * 2. Rendering clones that template and binds \"parts\" to the marker positions. Every later render\n * of the same shape only compares and commits the dynamic values — static content is never\n * touched again.\n * 3. Arrays reconcile KEYED (see `keyed()`), with head/tail fast paths and map-based moves, so a\n * reorder moves nodes instead of rebuilding them.\n *\n * Built in, where lit-html requires directive imports: keyed list reconciliation (`keyed`),\n * element refs (element-position expressions), toggled-DOM preservation (`hold`), and a\n * whole-range fast clear — one `textContent = ''` where lit removes thousands of nodes one at a\n * time. Like-for-like (lit-html + repeat + ref + cache: 5 021 B gzip), this file is ~28% smaller.\n *\n * What it deliberately does NOT have, which is why it is smaller than lit-html: no directive\n * protocol, no `noChange`/`nothing` sentinels (in a single-expression attribute, `null`/`undefined`\n * REMOVE the attribute; in a child, they clear it), no sanitizer indirection, no async parts, no\n * dev-mode branches.\n *\n * Known limits, deliberate and shared with lit-html's envelope: no bindings inside comments (the\n * value is consumed and ignored), no dynamic tag names, and nested `<template>` elements' contents\n * are not traversed.\n *\n * CONTRACTS THE SPEED PAYS FOR — these are the trade, documented rather than discovered:\n *\n * - **The renderer owns its container below the mount point.** The whole-range fast clear wipes\n * everything in a parent the part fully owns, including nodes user code appended there by hand\n * (lit-html would preserve them). Same contract as mounting Vue or React into a container.\n * - **Do not call `Node.normalize()` on rendered content.** Child anchors are text nodes, and\n * normalize merges adjacent text — lit-html's comment anchors are immune to this; ours are not.\n * - **A plain string renders as text, never as HTML.** The Reef renderer parsed strings as markup;\n * this one has no innerHTML sink at all (an XSS class removed). The deliberate escape hatch for\n * trusted markup is a property binding: `.innerHTML=${trusted}`.\n * - **Hydration is automatic and markerless.** The first render into a container that already has\n * children adopts them as server output of the same template (statics matched byte-for-byte,\n * anchors installed by splitting live text at known value positions), falling back to a clean\n * render on any mismatch. Requires the initial client render to match server state — same\n * contract as React/Vue hydration.\n * - **No directive protocol.** The template language itself is closed to extension — Vera extends\n * at the framework layer (inserts) and through element refs, not inside the renderer's value\n * handling.\n * - Event handlers are invoked with `this` bound to the ELEMENT (lit binds its host).\n *\n * NAMING NOTE: internal class fields and methods are `_`-prefixed because the production build\n * mangles properties matching /^_[a-z]/ (see defaultRollupConfig). That is what lets this file use\n * full descriptive names while still shipping one-letter properties — locals and top-level names\n * are mangled by default anyway, but property names are not. `_$litType$` and `handleEvent`\n * deliberately do not match the pattern: the first is an interop wire format, the second is called\n * by the DOM itself.\n */\n\nexport type TemplateResult = {\n /** 1 = html, 2 = svg, 3 = mathml — the markers core's built-in tags produce. */\n _$litType$?: number;\n strings: TemplateStringsArray;\n values: unknown[];\n /** Set by `keyed()`; drives keyed list reconciliation. */\n key?: unknown;\n};\n\n/**\n * Marks a template result with a stable key so list reconciliation moves it instead of rewriting\n * it. Key all items in a list or none — mixing is undefined behaviour, as are duplicate keys.\n *\n * ```js\n * rows.map((r) => keyed(r.id, html`<tr>...</tr>`))\n * ```\n */\nexport const keyed = <T>(key: unknown, result: T): T => {\n (result as TemplateResult).key = key;\n return result;\n};\n\n/**\n * Preserves the DOM of templates a child position toggles away from, instead of destroying it —\n * form values, scroll positions and media playback survive the round trip (lit-html calls this\n * `cache`). Stashed DOM is parked in its instance's own fragment and re-adopted on return.\n *\n * ```js\n * html`<div>${hold(editing ? editor() : viewer())}</div>`\n * ```\n */\nexport const hold = (result: TemplateResult): { $h: TemplateResult } => ({ $h: result });\n\n/**\n * Unique per module load, so user text can never collide with it. Randomness here cannot break\n * template caching — the marker only ever pairs a scan with its own Template construction.\n */\nconst MARKER = '$v' + ((Math.random() * 1e9) >>> 0).toString(36) + '$';\n/** `<?xyz>` parses as a bogus comment whose data is `?xyz`. */\nconst MARKER_COMMENT_DATA = '?' + MARKER;\n\nconst doc = document;\nconst comment = (data = '') => doc.createComment(data);\n\n/**\n * One walker for every template construction, re-aimed by assigning `currentNode`. Traversal of a\n * detached fragment cannot escape it — ascent stops at a null parent — and no walk is ever\n * re-entered mid-flight: an inner instantiation only begins after the outer walk has finished\n * collecting its parts.\n */\nconst markerWalker = doc.createTreeWalker(doc, 129 /* ELEMENT | COMMENT */);\n/**\n * Second shared walker for indexing and instantiation. Templates ship with NO marker comments —\n * every child slot's anchor is its primed text node — so instances index over elements and texts.\n * Marker comments exist only transiently during template construction, and are created lazily at\n * runtime only if a slot upgrades from text to template/array content. Sharing the walker saves a\n * TreeWalker allocation per instance, which is 10 000 allocations in a 10 000-row create.\n */\nconst instanceWalker = doc.createTreeWalker(doc, 5 /* ELEMENT | TEXT */);\n\nconst RAW_TEXT_TAGS = /^(?:script|style|textarea|title)$/i;\nconst ATTR_NAME_DELIMITER = /[\\s\"'>=/]/;\n\n/** What an expression position turned out to be. */\nconst CHILD = 0;\nconst ATTRIBUTE = 1;\nconst IGNORED = 2; // value consumed, nothing rendered (bindings inside comments, junk positions)\n\ntype Spec = { _type: 0 } | { _type: 1; _name: string } | { _type: 2 };\n\n/** Scanner states. */\nconst IN_TEXT = 0;\nconst IN_TAG = 1;\nconst IN_QUOTED_VALUE = 2; // a static quoted attribute value (no binding seen yet)\nconst IN_COMMENT = 3;\nconst IN_RAW_TEXT = 4; // inside <script>/<style>/<textarea>/<title>\nconst IN_BOUND_VALUE = 5; // collecting a bound attribute's statics\n\n/**\n * One pass over the template strings, producing parseable HTML with markers plus an ordered spec\n * list. Runs once per template shape, so clarity beats micro-optimisation here.\n *\n * A small state machine rather than tail regexes, because `>` inside quoted attribute values and\n * inside comments must not terminate a tag, and raw-text elements swallow markup.\n */\nconst scan = (strings: TemplateStringsArray) => {\n const specs: Spec[] = [];\n let markup = '';\n let state = IN_TEXT;\n let quote = '';\n let quoteStart = 0; // markup index of the opening quote while IN_QUOTED_VALUE\n let rawTag = ''; // which raw-text element we are inside\n let tagNameStart = 0; // markup index where the current tag's name begins\n let isClosing = false;\n let attrName = '';\n let statics: string[] = [];\n let pending = ''; // the static chunk currently being collected IN_BOUND_VALUE\n\n /** Backscan an attribute name that ends at `end` (exclusive); '' when malformed. */\n const attrNameBefore = (end: number) => {\n let at = end;\n while (at > 0 && !ATTR_NAME_DELIMITER.test(markup[at - 1])) at--;\n return markup.slice(at, end);\n };\n\n for (let i = 0; i < strings.length; i++) {\n const segment = strings[i];\n let pos = 0;\n while (pos < segment.length) {\n const ch = segment[pos];\n if (state === IN_BOUND_VALUE) {\n if (\n ch === quote ||\n (quote === '' && (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r' || ch === '>' || ch === '/'))\n ) {\n /**\n * The bound attribute closes. Emit a marker attribute whose VALUE carries the statics\n * joined by the marker — reading them back from the parsed attribute means entities\n * arrive decoded, exactly as a static attribute would.\n */\n statics.push(pending);\n const quoteChar = quote || '\"';\n markup += ` ${specs.length}${MARKER}=${quoteChar}${statics.join(MARKER)}${quoteChar}`;\n specs.push({ _type: ATTRIBUTE, _name: attrName });\n state = IN_TAG;\n if (quote !== '') pos++; // consume the closing quote; unquoted terminators reprocess IN_TAG\n continue;\n }\n pending += ch;\n pos++;\n } else if (state === IN_TEXT) {\n if (ch === '<') {\n if (segment.startsWith('!--', pos + 1)) {\n state = IN_COMMENT;\n markup += '<!--';\n pos += 4;\n continue;\n }\n isClosing = segment[pos + 1] === '/';\n tagNameStart = markup.length + (isClosing ? 2 : 1);\n state = IN_TAG;\n }\n markup += ch;\n pos++;\n } else if (state === IN_TAG) {\n if (ch === '\"' || ch === \"'\") {\n quote = ch;\n quoteStart = markup.length;\n state = IN_QUOTED_VALUE;\n } else if (ch === '>') {\n const tagName = markup.slice(tagNameStart).match(/^[a-zA-Z][^\\s/>]*/)?.[0] ?? '';\n if (!isClosing && RAW_TEXT_TAGS.test(tagName) && !markup.endsWith('/')) {\n rawTag = tagName.toLowerCase();\n state = IN_RAW_TEXT;\n } else {\n state = IN_TEXT;\n }\n }\n markup += ch;\n pos++;\n } else if (state === IN_QUOTED_VALUE) {\n if (ch === quote) state = IN_TAG;\n markup += ch;\n pos++;\n } else if (state === IN_COMMENT) {\n if (ch === '-' && segment.startsWith('->', pos + 1)) {\n markup += '-->';\n pos += 3;\n state = IN_TEXT;\n continue;\n }\n markup += ch;\n pos++;\n } else {\n // IN_RAW_TEXT\n if (\n ch === '<' &&\n segment.slice(pos + 1, pos + 2 + rawTag.length).toLowerCase() === '/' + rawTag &&\n (pos + 2 + rawTag.length >= segment.length || /[\\s/>]/.test(segment[pos + 2 + rawTag.length]))\n ) {\n isClosing = true;\n tagNameStart = markup.length + 2;\n state = IN_TAG;\n }\n markup += ch;\n pos++;\n }\n }\n\n // ── expression boundary ──────────────────────────────────────────────────\n if (i === strings.length - 1) break;\n if (state === IN_TEXT) {\n markup += `<?${MARKER}>`;\n specs.push({ _type: CHILD });\n } else if (state === IN_RAW_TEXT) {\n markup += MARKER; // a text marker; comments cannot be parsed inside raw-text elements\n specs.push({ _type: CHILD });\n } else if (state === IN_COMMENT) {\n specs.push({ _type: IGNORED }); // binding inside a comment: consumed, ignored\n } else if (state === IN_BOUND_VALUE) {\n statics.push(pending); // this attribute spans another expression\n pending = '';\n } else if (state === IN_QUOTED_VALUE) {\n // expression inside a quoted attribute value -> becomes a bound attribute\n const name = markup[quoteStart - 1] === '=' ? attrNameBefore(quoteStart - 1) : '';\n if (name) {\n attrName = name;\n statics = [markup.slice(quoteStart + 1)]; // the static prefix already inside the quotes\n pending = '';\n markup = markup.slice(0, quoteStart - 1 - name.length); // cut `name=\"` back out\n state = IN_BOUND_VALUE;\n } else {\n specs.push({ _type: IGNORED });\n }\n } else {\n // IN_TAG: `name=${x}` unquoted, or an element-position expression\n const name = markup.endsWith('=') ? attrNameBefore(markup.length - 1) : '';\n if (name) {\n attrName = name;\n statics = [''];\n pending = '';\n quote = '';\n markup = markup.slice(0, markup.length - 1 - name.length);\n state = IN_BOUND_VALUE;\n } else {\n /**\n * Element-position expression — an element REF, not a no-op. Marked exactly like a bound\n * attribute ('&' cannot begin a real attribute binding), so no new machinery exists for it.\n */\n markup += ` ${specs.length}${MARKER}=\"${MARKER}\"`;\n specs.push({ _type: ATTRIBUTE, _name: '&' });\n }\n }\n }\n return { markup, specs };\n};\n\n/** A part's position and shape inside a Template, resolved to a node index for instantiation. */\ntype TemplatePart = {\n _type: 0 | 1 | 2;\n _index: number;\n _name?: string;\n _statics?: string[];\n _node?: Node; // only during construction, carrying identity between the two passes\n};\n\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\nclass Template {\n _element: HTMLTemplateElement;\n _parts: TemplatePart[] = [];\n\n constructor(result: TemplateResult) {\n const type = result._$litType$ ?? 1;\n const { markup, specs } = scan(result.strings);\n this._element = doc.createElement('template');\n /** svg/mathml fragments only parse inside their root; wrap, then unwrap below. */\n this._element.innerHTML = type === 2 ? `<svg>${markup}</svg>` : type === 3 ? `<math>${markup}</math>` : markup;\n const content = this._element.content;\n if (type !== 1) {\n const wrapper = content.firstChild!;\n while (wrapper.firstChild) content.insertBefore(wrapper.firstChild, wrapper);\n content.removeChild(wrapper);\n }\n\n /**\n * Pass 1 — DISCOVER over ELEMENT | COMMENT: pair scan specs with parsed nodes in document\n * order (which is expression order), and swap every marker comment for a primed empty text\n * node. The shipped template then contains no comments at all: each clone is three nodes\n * lighter per typical row, and the primed text doubles as both anchor and first-commit target.\n */\n markerWalker.currentNode = content;\n let specIndex = 0;\n let node: Node | null;\n const parts = this._parts;\n const consumeIgnored = () => {\n while (specIndex < specs.length && specs[specIndex]._type === IGNORED) {\n parts.push({ _type: IGNORED, _index: -1 });\n specIndex++;\n }\n };\n consumeIgnored();\n while (specIndex < specs.length && (node = markerWalker.nextNode()) !== null) {\n if (node.nodeType === 1) {\n const element = node as Element;\n if (element.hasAttributes()) {\n for (const attributeName of element.getAttributeNames()) {\n if (attributeName.endsWith(MARKER)) {\n /**\n * The marker attribute's value carries the statics; the REAL (case-preserved) name\n * comes from the spec — the HTML parser lowercases attribute names, which would\n * corrupt `.someProp`.\n */\n const spec = specs[specIndex++] as { _type: 1; _name: string };\n parts.push({\n _type: ATTRIBUTE,\n _index: -1,\n _name: spec._name,\n _statics: element.getAttribute(attributeName)!.split(MARKER),\n _node: element,\n });\n element.removeAttribute(attributeName);\n consumeIgnored();\n }\n }\n }\n if (RAW_TEXT_TAGS.test(element.tagName) && element.textContent!.includes(MARKER)) {\n /**\n * Comments cannot be PARSED inside raw-text elements, but they are legal DOM once\n * created — so the scan left text markers, and here they become real marker comments.\n * The walker visits them next and they pair as ordinary child parts.\n */\n const pieces = element.textContent!.split(MARKER);\n element.textContent = '';\n for (let p = 0; p < pieces.length - 1; p++) {\n if (pieces[p]) element.append(pieces[p]);\n element.append(comment(MARKER_COMMENT_DATA));\n }\n if (pieces[pieces.length - 1]) element.append(pieces[pieces.length - 1]);\n }\n } else if ((node as Comment).data === MARKER_COMMENT_DATA) {\n specIndex++;\n const primedText = doc.createTextNode('');\n node.parentNode!.insertBefore(primedText, node);\n /** Re-aim the walker before removing the node it stands on. */\n markerWalker.currentNode = primedText;\n (node as Comment).remove();\n parts.push({ _type: CHILD, _index: -1, _node: primedText });\n consumeIgnored();\n }\n }\n\n /** Pass 2 — INDEX over ELEMENT | TEXT, the mask instances walk with. */\n instanceWalker.currentNode = content;\n let nodeIndex = -1;\n let partIndex = 0;\n while (partIndex < parts.length && parts[partIndex]._type === IGNORED) partIndex++;\n while (partIndex < parts.length && (node = instanceWalker.nextNode()) !== null) {\n nodeIndex++;\n while (partIndex < parts.length && parts[partIndex]._node === node) {\n parts[partIndex]._index = nodeIndex;\n partIndex++;\n while (partIndex < parts.length && parts[partIndex]._type === IGNORED) partIndex++;\n }\n }\n for (const part of parts) part._node = undefined;\n }\n}\n\nconst getTemplate = (result: TemplateResult) => {\n let template = templateCache.get(result.strings);\n if (template === undefined) templateCache.set(result.strings, (template = new Template(result)));\n return template;\n};\n\n/** Anything bound to a live position: commits values[index..], returns the next value index. */\ninterface Part {\n _commit(values: unknown[], index: number): number;\n}\n\nconst IGNORED_PART: Part = { _commit: (_values, index) => index + 1 };\n\n/** Never equal to any user value, so the first commit always runs. */\nconst UNSET = {};\n\n/** Removal target: nodes moved here are dropped when it is emptied. */\nconst SCRATCH = doc.createDocumentFragment();\n\n/** A fresh markered part: two comments inserted before `ref` in `parent`. */\nconst createMarkeredPart = (parent: Node, ref: Node | null) => {\n const start = comment();\n const end = comment();\n parent.insertBefore(start, ref);\n parent.insertBefore(end, ref);\n return new ChildPart(start, end);\n};\n\nconst toText = (value: unknown) => (value == null ? '' : String(value));\n\n/** Binding kinds, resolved once from the attribute name's first character. */\nconst ATTR = 0; // plain attribute\nconst PROPERTY = 1; // .name\nconst BOOLEAN = 2; // ?name\nconst EVENT = 3; // @name\nconst REF = 4; // element-position expression\n\nclass AttrPart implements Part {\n _element: Element;\n _name: string;\n _statics: string[];\n _slots: number; // how many expression values this binding consumes\n _kind: number;\n _isFullValue: boolean; // exactly one expression with no static text around it\n _committed: unknown = UNSET;\n _handler: EventListener | null = null;\n\n constructor(element: Element, name: string, statics: string[]) {\n const first = name[0];\n let kind = first === '.' ? PROPERTY : first === '?' ? BOOLEAN : first === '@' ? EVENT : first === '&' ? REF : ATTR;\n let realName = kind ? name.slice(1) : name;\n /** React muscle-memory, buildless: `onClick=${fn}` ≡ `@click=${fn}`. Strictly `on` + a\n * capital — all-lowercase `onclick` stays a plain attribute (legal inline-handler HTML). */\n if (kind === ATTR && first === 'o' && name.charCodeAt(1) === 110 && name.charCodeAt(2) > 64 && name.charCodeAt(2) < 91) {\n kind = EVENT;\n realName = name.slice(2).toLowerCase();\n }\n this._kind = kind;\n this._name = realName;\n this._element = element;\n this._statics = statics;\n this._slots = statics.length - 1;\n this._isFullValue = this._slots === 1 && statics[0] === '' && statics[1] === '';\n }\n\n /** Stable listener registered once; swapping the handler never touches the DOM. */\n handleEvent(event: Event) {\n if (this._handler) this._handler.call(this._element as never, event);\n }\n\n _commit(values: unknown[], index: number): number {\n const kind = this._kind;\n let value: unknown;\n if (this._isFullValue || kind >= EVENT) {\n value = values[index]; // raw and uncoerced — events and refs receive the actual value\n } else {\n const statics = this._statics;\n let joined = statics[0];\n for (let i = 0; i < this._slots; i++) joined += toText(values[index + i]) + statics[i + 1];\n value = joined;\n }\n if (value !== this._committed) {\n /** On the very first commit the attribute does not exist, so a null needs no DOM call. */\n const isFirst = this._committed === UNSET;\n this._committed = value;\n if (kind === ATTR) {\n if (value == null) {\n if (!isFirst) this._element.removeAttribute(this._name);\n } else this._element.setAttribute(this._name, value as string);\n } else if (kind === PROPERTY) {\n (this._element as unknown as Record<string, unknown>)[this._name] = value;\n } else if (kind === BOOLEAN) {\n if (!isFirst || (value as boolean)) this._element.toggleAttribute(this._name, !!value);\n } else if (kind === EVENT) {\n if (this._handler === null && value != null) this._element.addEventListener(this._name, this);\n this._handler = (value as EventListener) ?? null;\n } else if (value != null) {\n /**\n * Element ref: `<input ${myRef} />`. A function is called with the element; an object gets\n * the element assigned to `.value` — which makes core's own `ref()` double as an element\n * ref, reactively. Runs once per distinct value, not once per render.\n */\n if (typeof value === 'function') (value as (el: Element) => void)(this._element);\n else if (typeof value === 'object') (value as { value: unknown }).value = this._element;\n // any other value type at element position is consumed and ignored\n }\n }\n return index + this._slots;\n }\n}\n\n/**\n * A list item is either ELEMENT-MODE — a single-root template instance whose one element IS the\n * item's boundary (`_element`/`_instance`/`_shape` set, `_part` null) — or a general markered\n * ChildPart. Rows are single-root in virtually every real list, and element mode drops both marker\n * comments and both marker inserts per item, which is exactly the per-row overhead a vdom does not\n * pay on create.\n */\ntype Item = {\n _key: unknown;\n _element: Element | null;\n _instance: Instance | null;\n _shape: TemplateStringsArray | null;\n _part: ChildPart | null;\n};\n\nclass Instance {\n _parts: Part[] = [];\n _fragment: DocumentFragment;\n\n constructor(template: Template) {\n /** cloneNode over importNode: same document, and it measures slightly cheaper. */\n this._fragment = template._element.content.cloneNode(true) as DocumentFragment;\n const templateParts = template._parts;\n /** Shared walker, ELEMENT | TEXT — child anchors are the primed text nodes themselves. */\n instanceWalker.currentNode = this._fragment;\n let nodeIndex = -1;\n let node: Node | null = null;\n for (let i = 0; i < templateParts.length; i++) {\n const templatePart = templateParts[i];\n if (templatePart._type === IGNORED) {\n this._parts.push(IGNORED_PART);\n continue;\n }\n while (nodeIndex < templatePart._index) {\n node = instanceWalker.nextNode();\n nodeIndex++;\n }\n this._parts.push(\n templatePart._type === CHILD\n ? new TextPart(node as Text)\n : new AttrPart(node as Element, templatePart._name!, templatePart._statics!)\n );\n }\n }\n\n _update(values: unknown[]) {\n let valueIndex = 0;\n const parts = this._parts;\n for (let i = 0; i < parts.length; i++) valueIndex = parts[i]._commit(values, valueIndex);\n }\n}\n\n/** A single property read — this runs once per list item per render, so it must be minimal. */\nconst isTemplateResult = (value: object): value is TemplateResult =>\n (value as TemplateResult).strings !== undefined;\n\n/**\n * The common case of a child expression is plain text, and the template primes every child slot\n * with a text node — so the steady state is compare-and-assign on `.data`. This part carries only\n * that, upgrading itself to a full ChildPart the first time it sees null, a template, or an array.\n */\nclass TextPart implements Part {\n _text: Text;\n _value: unknown = '';\n _upgraded: ChildPart | null = null;\n\n constructor(text: Text) {\n this._text = text;\n }\n\n _commit(values: unknown[], index: number): number {\n const value = values[index];\n if (this._upgraded !== null) {\n this._upgraded._set(value);\n return index + 1;\n }\n if (value == null || typeof value === 'object') {\n /**\n * Upgrade in place: marker comments come into existence only now, anchored around the text\n * node, and the full part inherits the committed text state and delegates forever.\n *\n * BOTH markers are ours. Borrowing `this._text.nextSibling` as the end instead would hand\n * this part a boundary owned by the NEXT part — and the next part removes that very node\n * when it upgrades and clears its own text. The stale reference then makes `_clear()` walk\n * past the end of the child list. Owning both anchors also makes `_end === null` mean\n * exactly one thing: the root part, which really does own its container.\n */\n const start = comment();\n const end = comment();\n const parent = this._text.parentNode!;\n parent.insertBefore(start, this._text);\n parent.insertBefore(end, this._text.nextSibling);\n const part = new ChildPart(start, end);\n part._mode = TEXT;\n part._text = this._text;\n part._value = this._value;\n this._upgraded = part;\n part._set(value);\n return index + 1;\n }\n if (value !== this._value) {\n this._value = value;\n this._text.data = value as string;\n }\n return index + 1;\n }\n}\n\n/** What a ChildPart currently contains. */\nconst EMPTY = 0;\nconst TEXT = 1;\nconst TEMPLATE = 2;\nconst LIST = 3;\n\n/**\n * Development-only profiling hook, armed by `@verajs/renderer/profiler`. Null until something\n * arms it, so an unprofiled development render pays one null check per template commit.\n *\n * Every reference sits behind `__DEV__`, which `defineDev()` folds to `false` before terser runs —\n * so the declaration, the constants and every call site are removed from the production bundle.\n * Verified by byte comparison, not assumed.\n */\nconst PROFILE_UPDATE = 0; // same template identity — values committed in place\nconst PROFILE_CREATE = 1; // first template into an empty part\nconst PROFILE_REBUILD = 2; // template identity CHANGED — subtree torn down and rebuilt\nconst PROFILE_FRAME_START = 3;\nconst PROFILE_FRAME_END = 4;\n\ntype ProfileHook = (kind: number, subject: unknown, shape: TemplateStringsArray | null) => void;\nlet _profileHook: ProfileHook | null = null;\n/** @internal */\nconst _setProfileHook = (fn: ProfileHook | null) => {\n _profileHook = fn;\n};\n\nclass ChildPart implements Part {\n _start: Comment;\n /** Exclusive end of this part's range; null means \"to the end of the parent\". */\n _end: Node | null;\n _mode = EMPTY;\n _value: unknown;\n _text: Text | null = null;\n _instance: Instance | null = null;\n /** The committed template's strings identity — the same-template fast path in `_set`. */\n _shape: TemplateStringsArray | null = null;\n _items: Item[] | null = null;\n _keyedList = false;\n /** Held instances by template identity; survives clears so state outlives interim content. */\n _held: Map<TemplateStringsArray, Instance> | null = null;\n\n constructor(start: Comment, end: Node | null) {\n this._start = start;\n this._end = end;\n }\n\n _commit(values: unknown[], index: number): number {\n this._set(values[index]);\n return index + 1;\n }\n\n _insert(node: Node) {\n this._start.parentNode!.insertBefore(node, this._end);\n }\n\n _clear() {\n const parent = this._start.parentNode!;\n /**\n * When this part owns its parent's entire contents, one `textContent = ''` replaces removing\n * every node individually. For a 1 000-row table body that is the difference between ~22 ms\n * (lit-html's per-node teardown) and ~5 ms.\n */\n if (this._start.previousSibling === null && this._end === null) {\n parent.textContent = '';\n parent.appendChild(this._start);\n } else {\n let node = this._start.nextSibling;\n /**\n * `node !== null` is a backstop, not an expected exit. Reaching the end of the child list\n * without meeting `_end` means something detached this part's boundary; stopping leaves\n * nodes behind, which beats throwing out of the middle of a render pass.\n */\n while (node !== null && node !== this._end) {\n const next = node.nextSibling;\n parent.removeChild(node);\n node = next;\n }\n }\n this._mode = EMPTY;\n this._text = null;\n this._instance = null;\n this._items = null;\n this._shape = null;\n }\n\n _set(value: unknown) {\n if (value == null) {\n if (this._mode !== EMPTY) this._clear();\n return;\n }\n if (typeof value !== 'object') {\n if (this._mode === TEXT) {\n if (this._value !== value) {\n this._value = value;\n this._text!.data = value as string; // the DOM coerces numbers etc.\n }\n } else {\n if (this._mode !== EMPTY) this._clear();\n this._text = doc.createTextNode(value as string);\n this._insert(this._text);\n this._value = value;\n this._mode = TEXT;\n }\n return;\n }\n const heldResult = (value as { $h?: TemplateResult }).$h;\n if (heldResult !== undefined) {\n this._commitHeld(heldResult);\n return;\n }\n if (isTemplateResult(value)) {\n /**\n * Same-shape fast path on `strings` identity alone — no template-cache lookup. This is the\n * hottest line in a keyed list update: for every row whose shape did not change (all of\n * them, in practice), commit costs one identity compare before touching the values.\n */\n if (this._shape === value.strings) {\n if (__DEV__ && _profileHook) _profileHook(PROFILE_UPDATE, this, value.strings);\n this._instance!._update(value.values);\n return;\n }\n /**\n * Reaching here with a template already committed means the identity changed, so the\n * subtree below is about to be destroyed and rebuilt rather than updated. That is what\n * `?hidden=${…}` over a swapped subtree exists to avoid, and it is otherwise invisible.\n */\n if (__DEV__ && _profileHook) {\n _profileHook(this._mode === TEMPLATE ? PROFILE_REBUILD : PROFILE_CREATE, this, value.strings);\n }\n const template = getTemplate(value);\n if (this._mode !== EMPTY) this._clear();\n const instance = new Instance(template);\n instance._update(value.values);\n this._insert(instance._fragment);\n this._instance = instance;\n this._shape = value.strings;\n this._mode = TEMPLATE;\n return;\n }\n if (Array.isArray(value)) {\n this._commitList(value);\n return;\n }\n if (typeof (value as Iterable<unknown>)[Symbol.iterator] === 'function') {\n this._commitList([...(value as Iterable<unknown>)]);\n return;\n }\n // any other object: render as text\n this._set(String(value));\n }\n\n /** Commits a template while stashing whatever it replaces — see the `hold()` export. */\n _commitHeld(result: TemplateResult) {\n if (this._mode === TEMPLATE && this._shape === result.strings) {\n this._instance!._update(result.values);\n return;\n }\n const held = (this._held ??= new Map());\n if (this._mode === TEMPLATE) {\n /** Park the live nodes back in their instance's own (empty) fragment. */\n const fragment = this._instance!._fragment;\n let node = this._start.nextSibling;\n while (node !== this._end) {\n const next = node!.nextSibling;\n fragment.appendChild(node!);\n node = next;\n }\n held.set(this._shape!, this._instance!);\n } else if (this._mode !== EMPTY) {\n this._clear();\n }\n const instance = held.get(result.strings) ?? new Instance(getTemplate(result));\n instance._update(result.values);\n this._insert(instance._fragment);\n this._instance = instance;\n this._shape = result.strings;\n this._mode = TEMPLATE;\n }\n\n /**\n * Creates one list item. A single-root template instance becomes an element-mode item with no\n * markers at all; anything else gets its own start/end marker pair so moves can never dangle.\n */\n _createItem(value: unknown, parent: Node, ref: Node | null): Item {\n if (value !== null && typeof value === 'object' && (value as TemplateResult).strings !== undefined) {\n const result = value as TemplateResult;\n const template = getTemplate(result);\n const instance = new Instance(template);\n instance._update(result.values);\n const rootNode = instance._fragment.firstChild;\n if (rootNode !== null && rootNode.nodeType === 1 && rootNode.nextSibling === null) {\n parent.insertBefore(rootNode, ref);\n return {\n _key: result.key,\n _element: rootNode as Element,\n _instance: instance,\n _shape: result.strings,\n _part: null,\n };\n }\n /** Multi-root template: markered part, content already instantiated. */\n const part = createMarkeredPart(parent, ref);\n part._instance = instance;\n part._shape = result.strings;\n part._mode = TEMPLATE;\n part._start.parentNode!.insertBefore(instance._fragment, part._end);\n return { _key: result.key, _element: null, _instance: null, _shape: null, _part: part };\n }\n const part = createMarkeredPart(parent, ref);\n part._set(value);\n return { _key: (value as TemplateResult)?.key, _element: null, _instance: null, _shape: null, _part: part };\n }\n\n /** Commits a new value into an existing item, demoting element mode if the shape changed. */\n _updateItem(item: Item, value: unknown) {\n if (item._element !== null) {\n if (value !== null && typeof value === 'object' && (value as TemplateResult).strings === item._shape) {\n item._instance!._update((value as TemplateResult).values);\n return;\n }\n /** Shape changed: swap the bare element for a markered part in its place. */\n const part = createMarkeredPart(item._element.parentNode!, item._element);\n item._element.remove();\n item._element = null;\n item._instance = null;\n item._shape = null;\n (item._part = part)._set(value);\n return;\n }\n item._part!._set(value);\n }\n\n /** The item's first node — its move/removal handle and the insertion reference before it. */\n _firstNode(item: Item): Node {\n return item._element ?? item._part!._start;\n }\n\n _moveItem(item: Item, ref: Node | null, parent: Node = this._start.parentNode!) {\n if (item._element !== null) {\n parent.insertBefore(item._element, ref);\n return;\n }\n let node: Node | null = item._part!._start;\n const stop = item._part!._end!.nextSibling;\n while (node !== stop) {\n const next: Node | null = node!.nextSibling;\n parent.insertBefore(node!, ref);\n node = next;\n }\n }\n\n /** Removal is a move into a scratch fragment that is immediately emptied. */\n _dropItem(item: Item) {\n this._moveItem(item, null, SCRATCH);\n SCRATCH.textContent = '';\n }\n\n _commitList(newValues: unknown[]) {\n if (this._mode !== LIST) {\n if (this._mode !== EMPTY) this._clear();\n this._items = [];\n this._keyedList = false;\n this._mode = LIST;\n }\n const count = newValues.length;\n if (count === 0) {\n if (this._items!.length) {\n this._clear();\n this._items = [];\n this._mode = LIST;\n }\n return;\n }\n const isKeyed = newValues[0] != null && (newValues[0] as TemplateResult).key !== undefined;\n if (isKeyed !== this._keyedList && this._items!.length) {\n this._clear();\n this._items = [];\n this._mode = LIST;\n }\n this._keyedList = isKeyed;\n const items = this._items!;\n const parent = this._start.parentNode!;\n\n if (items.length === 0) {\n /** Initial fill builds off-document and lands in one insert. */\n const fragment = doc.createDocumentFragment();\n for (let i = 0; i < count; i++) items.push(this._createItem(newValues[i], fragment, null));\n this._insert(fragment);\n return;\n }\n\n if (!isKeyed) {\n // index mode: update in place, grow at the end, shrink from the end\n const shared = items.length < count ? items.length : count;\n for (let i = 0; i < shared; i++) this._updateItem(items[i], newValues[i]);\n if (count > items.length) {\n const fragment = doc.createDocumentFragment();\n for (let i = items.length; i < count; i++) items.push(this._createItem(newValues[i], fragment, null));\n this._insert(fragment);\n } else if (count < items.length) {\n const last = items[items.length - 1];\n let node: Node | null = this._firstNode(items[count]);\n const stop = last._element !== null ? last._element.nextSibling : last._part!._end!.nextSibling;\n while (node !== stop) {\n const next: Node | null = node!.nextSibling;\n parent.removeChild(node!);\n node = next;\n }\n items.length = count;\n }\n return;\n }\n\n /**\n * Zero-allocation fast path for the dominant case: same length, same key order — a pure\n * in-place update (a selection change, a field edit). No key array, no output array, no null\n * checks. Falls through to the full algorithm on the first mismatch; the items already updated\n * re-verify there as cheap no-op compares.\n */\n if (items.length === count) {\n let i = 0;\n while (i < count && items[i]._key === (newValues[i] as TemplateResult).key) {\n this._updateItem(items[i], newValues[i]);\n i++;\n }\n if (i === count) return;\n }\n\n /**\n * Keyed reconciliation — the standard head/tail algorithm (as in lit's `repeat` and Vue):\n * skip matching prefixes and suffixes, detect the two swap shapes directly, and fall back to\n * key maps for arbitrary moves, removals and insertions.\n */\n const oldItems: (Item | null)[] = items;\n const newKeys: unknown[] = new Array(count);\n for (let i = 0; i < count; i++) newKeys[i] = (newValues[i] as TemplateResult).key;\n const newItems: Item[] = new Array(count);\n let oldHead = 0;\n let oldTail = oldItems.length - 1;\n let newHead = 0;\n let newTail = count - 1;\n let newKeyToIndex: Map<unknown, number> | undefined;\n let oldKeyToIndex: Map<unknown, number> | undefined;\n const refAt = (i: number): Node | null =>\n i < count && newItems[i] !== undefined ? this._firstNode(newItems[i]) : this._end;\n\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldItems[oldHead] === null) oldHead++;\n else if (oldItems[oldTail] === null) oldTail--;\n else if (oldItems[oldHead]!._key === newKeys[newHead]) {\n this._updateItem((newItems[newHead] = oldItems[oldHead]!), newValues[newHead]);\n oldHead++;\n newHead++;\n } else if (oldItems[oldTail]!._key === newKeys[newTail]) {\n this._updateItem((newItems[newTail] = oldItems[oldTail]!), newValues[newTail]);\n oldTail--;\n newTail--;\n } else if (oldItems[oldHead]!._key === newKeys[newTail]) {\n const item = oldItems[oldHead]!;\n this._moveItem(item, refAt(newTail + 1));\n this._updateItem(item, newValues[newTail]);\n newItems[newTail] = item;\n oldHead++;\n newTail--;\n } else if (oldItems[oldTail]!._key === newKeys[newHead]) {\n const item = oldItems[oldTail]!;\n this._moveItem(item, this._firstNode(oldItems[oldHead]!));\n this._updateItem(item, newValues[newHead]);\n newItems[newHead] = item;\n oldTail--;\n newHead++;\n } else {\n if (newKeyToIndex === undefined) {\n newKeyToIndex = new Map();\n for (let i = newHead; i <= newTail; i++) newKeyToIndex.set(newKeys[i], i);\n oldKeyToIndex = new Map();\n for (let i = oldHead; i <= oldTail; i++) {\n if (oldItems[i] !== null) oldKeyToIndex.set(oldItems[i]!._key, i);\n }\n }\n if (!newKeyToIndex.has(oldItems[oldHead]!._key)) {\n this._dropItem(oldItems[oldHead]!);\n oldHead++;\n } else if (!newKeyToIndex.has(oldItems[oldTail]!._key)) {\n this._dropItem(oldItems[oldTail]!);\n oldTail--;\n } else {\n const oldIndex = oldKeyToIndex!.get(newKeys[newHead]);\n if (oldIndex === undefined) {\n newItems[newHead] = this._createItem(newValues[newHead], parent, this._firstNode(oldItems[oldHead]!));\n } else {\n const item = oldItems[oldIndex]!;\n this._moveItem(item, this._firstNode(oldItems[oldHead]!));\n this._updateItem(item, newValues[newHead]);\n newItems[newHead] = item;\n oldItems[oldIndex] = null;\n }\n newHead++;\n }\n }\n }\n while (newHead <= newTail) {\n newItems[newHead] = this._createItem(newValues[newHead], parent, refAt(newTail + 1));\n newHead++;\n }\n while (oldHead <= oldTail) {\n const item = oldItems[oldHead++];\n if (item !== null) this._dropItem(item);\n }\n this._items = newItems;\n }\n}\n\nconst rootParts = new WeakMap<Node, ChildPart>();\n\n/**\n * Renders a template result into a container. Slots into Vera via `setRenderer(render)`; core's\n * built-in `html` tag already produces the accepted shape, so no `setHtml` call is required —\n * though lit-html's `html` also works, its results being structurally identical.\n *\n * HYDRATION lives in `@verajs/renderer/hydrate` — a drop-in superset entry whose `render` adopts\n * existing server-rendered children on first render. SSR apps import from there instead of here;\n * this entry carries zero hydration code.\n */\nexport const render = (result: unknown, container: Node) => {\n if (__DEV__ && _profileHook) _profileHook(PROFILE_FRAME_START, container, null);\n let part = rootParts.get(container);\n if (part === undefined) {\n const marker = comment();\n container.appendChild(marker);\n rootParts.set(container, (part = new ChildPart(marker, null)));\n }\n part._set(result);\n if (__DEV__ && _profileHook) _profileHook(PROFILE_FRAME_END, container, null);\n};\n\n// ── INTERNAL SURFACE — imported by ./hydrate.ts, never re-exported by src/index.ts ─────────────\n// The public d.ts comes from src/index.ts, and the base bundles tree-shake all of this away, so\n// nothing here reaches consumers of the base entry. The hydrate entry compiles against this exact\n// source into its own self-contained bundle, so mangled property names always agree within it.\n\n/** @internal */\nexport {\n getTemplate,\n Template,\n Instance,\n TextPart,\n ChildPart,\n AttrPart,\n IGNORED_PART,\n IGNORED,\n TEMPLATE,\n LIST,\n comment,\n doc,\n toText,\n isTemplateResult,\n instanceWalker,\n rootParts,\n _setProfileHook,\n PROFILE_UPDATE,\n PROFILE_CREATE,\n PROFILE_REBUILD,\n PROFILE_FRAME_START,\n PROFILE_FRAME_END,\n};\n/** @internal */\nexport type { Part, Item, TemplatePart };\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DG;AAWH;;;;;;;AAOG;MACU,KAAK,GAAG,CAAI,GAAY,EAAE,MAAS,KAAO;AACpD,IAAA,MAAyB,CAAC,GAAG,GAAG,GAAG;AACpC,IAAA,OAAO,MAAM;AACf;AAEA;;;;;;;;AAQG;AACI,MAAM,IAAI,GAAG,CAAC,M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@verajs/renderer — a ground-up, keyed, template-identity renderer.\n *\n * Replaces the Reef-derived renderer, which flattened every template to an HTML string and\n * re-parsed it on each change — O(whole template) work for a one-row edit, measured at 85 ms for a\n * two-row swap that lit-html does in 3.5 ms.\n *\n * The architecture here is the one that wins that benchmark:\n *\n * 1. A tagged template literal's `strings` array is frozen and IDENTICAL for every call from the\n * same call site, so it is a cache key for the template's static shape. The shape is parsed\n * ONCE into a `<template>` element with markers where the expressions go.\n * 2. Rendering clones that template and binds \"parts\" to the marker positions. Every later render\n * of the same shape only compares and commits the dynamic values — static content is never\n * touched again.\n * 3. Arrays reconcile KEYED (see `keyed()`), with head/tail fast paths and map-based moves, so a\n * reorder moves nodes instead of rebuilding them.\n *\n * Built in, where lit-html requires directive imports: keyed list reconciliation (`keyed`),\n * element refs (element-position expressions), toggled-DOM preservation (`hold`), and a\n * whole-range fast clear — one `textContent = ''` where lit removes thousands of nodes one at a\n * time. Like-for-like (lit-html + repeat + ref + cache: 5 021 B gzip), this file is ~28% smaller.\n *\n * What it deliberately does NOT have, which is why it is smaller than lit-html: no directive\n * protocol, no `noChange`/`nothing` sentinels (in a single-expression attribute, `null`/`undefined`\n * REMOVE the attribute; in a child, they clear it), no sanitizer indirection, no async parts, no\n * dev-mode branches.\n *\n * Known limits, deliberate and shared with lit-html's envelope: no bindings inside comments (the\n * value is consumed and ignored), no dynamic tag names, and nested `<template>` elements' contents\n * are not traversed.\n *\n * CONTRACTS THE SPEED PAYS FOR — these are the trade, documented rather than discovered:\n *\n * - **The renderer owns its container below the mount point.** The whole-range fast clear wipes\n * everything in a parent the part fully owns, including nodes user code appended there by hand\n * (lit-html would preserve them). Same contract as mounting Vue or React into a container.\n * - **Do not call `Node.normalize()` on rendered content.** Child anchors are text nodes, and\n * normalize merges adjacent text — lit-html's comment anchors are immune to this; ours are not.\n * - **A plain string renders as text, never as HTML.** The Reef renderer parsed strings as markup;\n * this one has no innerHTML sink at all (an XSS class removed). The deliberate escape hatch for\n * trusted markup is a property binding: `.innerHTML=${trusted}`.\n * - **Hydration is automatic and markerless.** The first render into a container that already has\n * children adopts them as server output of the same template (statics matched byte-for-byte,\n * anchors installed by splitting live text at known value positions), falling back to a clean\n * render on any mismatch. Requires the initial client render to match server state — same\n * contract as React/Vue hydration.\n * - **No directive protocol.** The template language itself is closed to extension — Vera extends\n * at the framework layer (inserts) and through element refs, not inside the renderer's value\n * handling.\n * - Event handlers are invoked with `this` bound to the ELEMENT (lit binds its host).\n *\n * NAMING NOTE: internal class fields and methods are `_`-prefixed because the production build\n * mangles properties matching /^_[a-z]/ (see defaultRollupConfig). That is what lets this file use\n * full descriptive names while still shipping one-letter properties — locals and top-level names\n * are mangled by default anyway, but property names are not. `_$litType$` and `handleEvent`\n * deliberately do not match the pattern: the first is an interop wire format, the second is called\n * by the DOM itself.\n */\n\nexport type TemplateResult = {\n /** 1 = html, 2 = svg, 3 = mathml — the markers core's built-in tags produce. */\n _$litType$?: number;\n strings: TemplateStringsArray;\n values: unknown[];\n /** Set by `keyed()`; drives keyed list reconciliation. */\n key?: unknown;\n};\n\n/**\n * Marks a template result with a stable key so list reconciliation moves it instead of rewriting\n * it. Key all items in a list or none — mixing is undefined behaviour, as are duplicate keys.\n *\n * ```js\n * rows.map((r) => keyed(r.id, html`<tr>...</tr>`))\n * ```\n */\nexport const keyed = <T>(key: unknown, result: T): T => {\n (result as TemplateResult).key = key;\n return result;\n};\n\n/**\n * Preserves the DOM of templates a child position toggles away from, instead of destroying it —\n * form values, scroll positions and media playback survive the round trip (lit-html calls this\n * `cache`). Stashed DOM is parked in its instance's own fragment and re-adopted on return.\n *\n * ```js\n * html`<div>${hold(editing ? editor() : viewer())}</div>`\n * ```\n */\nexport const hold = (result: TemplateResult): { $h: TemplateResult } => ({ $h: result });\n\n/**\n * Unique per module load, so user text can never collide with it. Randomness here cannot break\n * template caching — the marker only ever pairs a scan with its own Template construction.\n */\nconst MARKER = '$v' + ((Math.random() * 1e9) >>> 0).toString(36) + '$';\n/** `<?xyz>` parses as a bogus comment whose data is `?xyz`. */\nconst MARKER_COMMENT_DATA = '?' + MARKER;\n\nconst doc = document;\nconst comment = (data = '') => doc.createComment(data);\n\n/**\n * One walker for every template construction, re-aimed by assigning `currentNode`. Traversal of a\n * detached fragment cannot escape it — ascent stops at a null parent — and no walk is ever\n * re-entered mid-flight: an inner instantiation only begins after the outer walk has finished\n * collecting its parts.\n */\nconst markerWalker = doc.createTreeWalker(doc, 129 /* ELEMENT | COMMENT */);\n/**\n * Second shared walker for indexing and instantiation. Templates ship with NO marker comments —\n * every child slot's anchor is its primed text node — so instances index over elements and texts.\n * Marker comments exist only transiently during template construction, and are created lazily at\n * runtime only if a slot upgrades from text to template/array content. Sharing the walker saves a\n * TreeWalker allocation per instance, which is 10 000 allocations in a 10 000-row create.\n */\nconst instanceWalker = doc.createTreeWalker(doc, 5 /* ELEMENT | TEXT */);\n\nconst RAW_TEXT_TAGS = /^(?:script|style|textarea|title)$/i;\nconst ATTR_NAME_DELIMITER = /[\\s\"'>=/]/;\n\n/** What an expression position turned out to be. */\nconst CHILD = 0;\nconst ATTRIBUTE = 1;\nconst IGNORED = 2; // value consumed, nothing rendered (bindings inside comments, junk positions)\n\ntype Spec = { _type: 0 } | { _type: 1; _name: string } | { _type: 2 };\n\n/** Scanner states. */\nconst IN_TEXT = 0;\nconst IN_TAG = 1;\nconst IN_QUOTED_VALUE = 2; // a static quoted attribute value (no binding seen yet)\nconst IN_COMMENT = 3;\nconst IN_RAW_TEXT = 4; // inside <script>/<style>/<textarea>/<title>\nconst IN_BOUND_VALUE = 5; // collecting a bound attribute's statics\n\n/**\n * One pass over the template strings, producing parseable HTML with markers plus an ordered spec\n * list. Runs once per template shape, so clarity beats micro-optimisation here.\n *\n * A small state machine rather than tail regexes, because `>` inside quoted attribute values and\n * inside comments must not terminate a tag, and raw-text elements swallow markup.\n */\nconst scan = (strings: TemplateStringsArray) => {\n const specs: Spec[] = [];\n let markup = '';\n let state = IN_TEXT;\n let quote = '';\n let quoteStart = 0; // markup index of the opening quote while IN_QUOTED_VALUE\n let rawTag = ''; // which raw-text element we are inside\n let tagNameStart = 0; // markup index where the current tag's name begins\n let isClosing = false;\n let attrName = '';\n let statics: string[] = [];\n let pending = ''; // the static chunk currently being collected IN_BOUND_VALUE\n\n /** Backscan an attribute name that ends at `end` (exclusive); '' when malformed. */\n const attrNameBefore = (end: number) => {\n let at = end;\n while (at > 0 && !ATTR_NAME_DELIMITER.test(markup[at - 1])) at--;\n return markup.slice(at, end);\n };\n\n for (let i = 0; i < strings.length; i++) {\n const segment = strings[i];\n let pos = 0;\n while (pos < segment.length) {\n const ch = segment[pos];\n if (state === IN_BOUND_VALUE) {\n if (\n ch === quote ||\n (quote === '' && (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r' || ch === '>' || ch === '/'))\n ) {\n /**\n * The bound attribute closes. Emit a marker attribute whose VALUE carries the statics\n * joined by the marker — reading them back from the parsed attribute means entities\n * arrive decoded, exactly as a static attribute would.\n */\n statics.push(pending);\n const quoteChar = quote || '\"';\n markup += ` ${specs.length}${MARKER}=${quoteChar}${statics.join(MARKER)}${quoteChar}`;\n specs.push({ _type: ATTRIBUTE, _name: attrName });\n state = IN_TAG;\n if (quote !== '') pos++; // consume the closing quote; unquoted terminators reprocess IN_TAG\n continue;\n }\n pending += ch;\n pos++;\n } else if (state === IN_TEXT) {\n if (ch === '<') {\n if (segment.startsWith('!--', pos + 1)) {\n state = IN_COMMENT;\n markup += '<!--';\n pos += 4;\n continue;\n }\n isClosing = segment[pos + 1] === '/';\n tagNameStart = markup.length + (isClosing ? 2 : 1);\n state = IN_TAG;\n }\n markup += ch;\n pos++;\n } else if (state === IN_TAG) {\n if (ch === '\"' || ch === \"'\") {\n quote = ch;\n quoteStart = markup.length;\n state = IN_QUOTED_VALUE;\n } else if (ch === '>') {\n const tagName = markup.slice(tagNameStart).match(/^[a-zA-Z][^\\s/>]*/)?.[0] ?? '';\n if (!isClosing && RAW_TEXT_TAGS.test(tagName) && !markup.endsWith('/')) {\n rawTag = tagName.toLowerCase();\n state = IN_RAW_TEXT;\n } else {\n state = IN_TEXT;\n }\n }\n markup += ch;\n pos++;\n } else if (state === IN_QUOTED_VALUE) {\n if (ch === quote) state = IN_TAG;\n markup += ch;\n pos++;\n } else if (state === IN_COMMENT) {\n if (ch === '-' && segment.startsWith('->', pos + 1)) {\n markup += '-->';\n pos += 3;\n state = IN_TEXT;\n continue;\n }\n markup += ch;\n pos++;\n } else {\n // IN_RAW_TEXT\n if (\n ch === '<' &&\n segment.slice(pos + 1, pos + 2 + rawTag.length).toLowerCase() === '/' + rawTag &&\n (pos + 2 + rawTag.length >= segment.length || /[\\s/>]/.test(segment[pos + 2 + rawTag.length]))\n ) {\n isClosing = true;\n tagNameStart = markup.length + 2;\n state = IN_TAG;\n }\n markup += ch;\n pos++;\n }\n }\n\n // ── expression boundary ──────────────────────────────────────────────────\n if (i === strings.length - 1) break;\n if (state === IN_TEXT) {\n markup += `<?${MARKER}>`;\n specs.push({ _type: CHILD });\n } else if (state === IN_RAW_TEXT) {\n markup += MARKER; // a text marker; comments cannot be parsed inside raw-text elements\n specs.push({ _type: CHILD });\n } else if (state === IN_COMMENT) {\n specs.push({ _type: IGNORED }); // binding inside a comment: consumed, ignored\n } else if (state === IN_BOUND_VALUE) {\n statics.push(pending); // this attribute spans another expression\n pending = '';\n } else if (state === IN_QUOTED_VALUE) {\n // expression inside a quoted attribute value -> becomes a bound attribute\n const name = markup[quoteStart - 1] === '=' ? attrNameBefore(quoteStart - 1) : '';\n if (name) {\n attrName = name;\n statics = [markup.slice(quoteStart + 1)]; // the static prefix already inside the quotes\n pending = '';\n markup = markup.slice(0, quoteStart - 1 - name.length); // cut `name=\"` back out\n state = IN_BOUND_VALUE;\n } else {\n specs.push({ _type: IGNORED });\n }\n } else {\n // IN_TAG: `name=${x}` unquoted, or an element-position expression\n const name = markup.endsWith('=') ? attrNameBefore(markup.length - 1) : '';\n if (name) {\n attrName = name;\n statics = [''];\n pending = '';\n quote = '';\n markup = markup.slice(0, markup.length - 1 - name.length);\n state = IN_BOUND_VALUE;\n } else {\n /**\n * Element-position expression — an element REF, not a no-op. Marked exactly like a bound\n * attribute ('&' cannot begin a real attribute binding), so no new machinery exists for it.\n */\n markup += ` ${specs.length}${MARKER}=\"${MARKER}\"`;\n specs.push({ _type: ATTRIBUTE, _name: '&' });\n }\n }\n }\n return { markup, specs };\n};\n\n/** A part's position and shape inside a Template, resolved to a node index for instantiation. */\ntype TemplatePart = {\n _type: 0 | 1 | 2;\n _index: number;\n _name?: string;\n _statics?: string[];\n _node?: Node; // only during construction, carrying identity between the two passes\n};\n\nconst templateCache = new WeakMap<TemplateStringsArray, Template>();\n\nclass Template {\n _element: HTMLTemplateElement;\n _parts: TemplatePart[] = [];\n\n constructor(result: TemplateResult) {\n const type = result._$litType$ ?? 1;\n const { markup, specs } = scan(result.strings);\n this._element = doc.createElement('template');\n /** svg/mathml fragments only parse inside their root; wrap, then unwrap below. */\n this._element.innerHTML = type === 2 ? `<svg>${markup}</svg>` : type === 3 ? `<math>${markup}</math>` : markup;\n const content = this._element.content;\n if (type !== 1) {\n const wrapper = content.firstChild!;\n while (wrapper.firstChild) content.insertBefore(wrapper.firstChild, wrapper);\n content.removeChild(wrapper);\n }\n\n /**\n * Pass 1 — DISCOVER over ELEMENT | COMMENT: pair scan specs with parsed nodes in document\n * order (which is expression order), and swap every marker comment for a primed empty text\n * node. The shipped template then contains no comments at all: each clone is three nodes\n * lighter per typical row, and the primed text doubles as both anchor and first-commit target.\n */\n markerWalker.currentNode = content;\n let specIndex = 0;\n let node: Node | null;\n const parts = this._parts;\n const consumeIgnored = () => {\n while (specIndex < specs.length && specs[specIndex]._type === IGNORED) {\n parts.push({ _type: IGNORED, _index: -1 });\n specIndex++;\n }\n };\n consumeIgnored();\n while (specIndex < specs.length && (node = markerWalker.nextNode()) !== null) {\n if (node.nodeType === 1) {\n const element = node as Element;\n if (element.hasAttributes()) {\n for (const attributeName of element.getAttributeNames()) {\n if (attributeName.endsWith(MARKER)) {\n /**\n * The marker attribute's value carries the statics; the REAL (case-preserved) name\n * comes from the spec — the HTML parser lowercases attribute names, which would\n * corrupt `.someProp`.\n */\n const spec = specs[specIndex++] as { _type: 1; _name: string };\n parts.push({\n _type: ATTRIBUTE,\n _index: -1,\n _name: spec._name,\n _statics: element.getAttribute(attributeName)!.split(MARKER),\n _node: element,\n });\n element.removeAttribute(attributeName);\n consumeIgnored();\n }\n }\n }\n if (RAW_TEXT_TAGS.test(element.tagName) && element.textContent!.includes(MARKER)) {\n /**\n * Comments cannot be PARSED inside raw-text elements, but they are legal DOM once\n * created — so the scan left text markers, and here they become real marker comments.\n * The walker visits them next and they pair as ordinary child parts.\n */\n const pieces = element.textContent!.split(MARKER);\n element.textContent = '';\n for (let p = 0; p < pieces.length - 1; p++) {\n if (pieces[p]) element.append(pieces[p]);\n element.append(comment(MARKER_COMMENT_DATA));\n }\n if (pieces[pieces.length - 1]) element.append(pieces[pieces.length - 1]);\n }\n } else if ((node as Comment).data === MARKER_COMMENT_DATA) {\n specIndex++;\n const primedText = doc.createTextNode('');\n node.parentNode!.insertBefore(primedText, node);\n /** Re-aim the walker before removing the node it stands on. */\n markerWalker.currentNode = primedText;\n (node as Comment).remove();\n parts.push({ _type: CHILD, _index: -1, _node: primedText });\n consumeIgnored();\n }\n }\n\n /** Pass 2 — INDEX over ELEMENT | TEXT, the mask instances walk with. */\n instanceWalker.currentNode = content;\n let nodeIndex = -1;\n let partIndex = 0;\n while (partIndex < parts.length && parts[partIndex]._type === IGNORED) partIndex++;\n while (partIndex < parts.length && (node = instanceWalker.nextNode()) !== null) {\n nodeIndex++;\n while (partIndex < parts.length && parts[partIndex]._node === node) {\n parts[partIndex]._index = nodeIndex;\n partIndex++;\n while (partIndex < parts.length && parts[partIndex]._type === IGNORED) partIndex++;\n }\n }\n for (const part of parts) part._node = undefined;\n }\n}\n\nconst getTemplate = (result: TemplateResult) => {\n let template = templateCache.get(result.strings);\n if (template === undefined) templateCache.set(result.strings, (template = new Template(result)));\n return template;\n};\n\n/** Anything bound to a live position: commits values[index..], returns the next value index. */\ninterface Part {\n _commit(values: unknown[], index: number): number;\n}\n\nconst IGNORED_PART: Part = { _commit: (_values, index) => index + 1 };\n\n/** Never equal to any user value, so the first commit always runs. */\nconst UNSET = {};\n\n/** Removal target: nodes moved here are dropped when it is emptied. */\nconst SCRATCH = doc.createDocumentFragment();\n\n/** A fresh markered part: two comments inserted before `ref` in `parent`. */\nconst createMarkeredPart = (parent: Node, ref: Node | null) => {\n const start = comment();\n const end = comment();\n parent.insertBefore(start, ref);\n parent.insertBefore(end, ref);\n return new ChildPart(start, end);\n};\n\nconst toText = (value: unknown) => (value == null ? '' : String(value));\n\n/** Binding kinds, resolved once from the attribute name's first character. */\nconst ATTR = 0; // plain attribute\nconst PROPERTY = 1; // .name\nconst BOOLEAN = 2; // ?name\nconst EVENT = 3; // @name\nconst REF = 4; // element-position expression\n\nclass AttrPart implements Part {\n _element: Element;\n _name: string;\n _statics: string[];\n _slots: number; // how many expression values this binding consumes\n _kind: number;\n _isFullValue: boolean; // exactly one expression with no static text around it\n _committed: unknown = UNSET;\n _handler: EventListener | null = null;\n\n constructor(element: Element, name: string, statics: string[]) {\n const first = name[0];\n let kind = first === '.' ? PROPERTY : first === '?' ? BOOLEAN : first === '@' ? EVENT : first === '&' ? REF : ATTR;\n let realName = kind ? name.slice(1) : name;\n /** React muscle-memory, buildless: `onClick=${fn}` ≡ `@click=${fn}`. Strictly `on` + a\n * capital — all-lowercase `onclick` stays a plain attribute (legal inline-handler HTML). */\n if (kind === ATTR && first === 'o' && name.charCodeAt(1) === 110 && name.charCodeAt(2) > 64 && name.charCodeAt(2) < 91) {\n kind = EVENT;\n realName = name.slice(2).toLowerCase();\n }\n this._kind = kind;\n this._name = realName;\n this._element = element;\n this._statics = statics;\n this._slots = statics.length - 1;\n this._isFullValue = this._slots === 1 && statics[0] === '' && statics[1] === '';\n }\n\n /** Stable listener registered once; swapping the handler never touches the DOM. */\n handleEvent(event: Event) {\n if (this._handler) this._handler.call(this._element as never, event);\n }\n\n _commit(values: unknown[], index: number): number {\n const kind = this._kind;\n let value: unknown;\n if (this._isFullValue || kind >= EVENT) {\n value = values[index]; // raw and uncoerced — events and refs receive the actual value\n } else {\n const statics = this._statics;\n let joined = statics[0];\n for (let i = 0; i < this._slots; i++) joined += toText(values[index + i]) + statics[i + 1];\n value = joined;\n }\n if (value !== this._committed) {\n /** On the very first commit the attribute does not exist, so a null needs no DOM call. */\n const isFirst = this._committed === UNSET;\n this._committed = value;\n if (kind === ATTR) {\n if (value == null) {\n if (!isFirst) this._element.removeAttribute(this._name);\n } else this._element.setAttribute(this._name, value as string);\n } else if (kind === PROPERTY) {\n const target = this._element as unknown as Record<string, unknown>;\n const name = this._name;\n target[name] = value;\n /**\n * Detection only, and deliberately not repair.\n *\n * A property set on a custom element that has not upgraded yet lands as an own property on\n * the instance. When the definition arrives — lazily imported, code-split, or a module that\n * simply had not run — `customElements.define` upgrades synchronously and the class's field\n * initializers execute. At target ES2022 a field declaration is a `[[Define]]`, so\n * `item?: T` emits `item;` and overwrites the bound value with `undefined`. Nothing throws;\n * it reads as broken reactivity.\n *\n * Repairing it was tried and removed. Re-applying when the slot came back `undefined`\n * covered `item?: T` but not `item = someDefault`, which overwrites with the default and\n * never looks clobbered — so the repair was silently partial, and made the bug intermittent\n * across two spellings of the same mistake. It also cost 74 B in every app while leaving\n * `declare` mandatory anyway, because a property assigned imperatively is unrecoverable:\n * the renderer never saw it, and by the time `init()` runs the value is already gone.\n *\n * So this is `__DEV__`-only and production pays nothing — no check, no message, no\n * `whenDefined` subscription. Lit reached the same place from the other direction and\n * throws (`lit.dev/msg/class-field-shadowing`); a warning suffices here because Vera has no\n * prototype accessors to shadow permanently — the damage is one lost value, not a property\n * that never updates again.\n */\n if (__DEV__) {\n const tag = this._element.localName;\n if (tag.indexOf('-') > 0 && !customElements.get(tag)) {\n customElements.whenDefined(tag).then(() => {\n /**\n * States what was observed rather than diagnosing it. A class field is the usual\n * cause by a wide margin, but a component that assigns the property itself during\n * upgrade produces the same observation, and that is a legitimate — if confusing —\n * thing to do, since the renderer's dirty check will not re-apply the bound value on\n * the next render either.\n */\n if (target[name] !== value)\n console.warn(\n `@verajs/renderer: the value bound by \\`.${name}=\\${…}\\` on <${tag}> was replaced ` +\n `while the element upgraded. A class field is the usual cause: at ES2022 ` +\n `\\`${name}?: …\\` emits \\`${name};\\`, which runs during upgrade and overwrites ` +\n `whatever was set beforehand — write it \\`declare ${name}?: …\\` instead, which ` +\n `emits nothing. A plain field also wipes properties assigned imperatively, ` +\n `which cannot be detected at all. Ignore this if the component replaced the ` +\n `value on purpose.`\n );\n });\n }\n }\n } else if (kind === BOOLEAN) {\n if (!isFirst || (value as boolean)) this._element.toggleAttribute(this._name, !!value);\n } else if (kind === EVENT) {\n if (this._handler === null && value != null) this._element.addEventListener(this._name, this);\n this._handler = (value as EventListener) ?? null;\n } else if (value != null) {\n /**\n * Element ref: `<input ${myRef} />`. A function is called with the element; an object gets\n * the element assigned to `.value` — which makes core's own `ref()` double as an element\n * ref, reactively. Runs once per distinct value, not once per render.\n */\n if (typeof value === 'function') (value as (el: Element) => void)(this._element);\n else if (typeof value === 'object') (value as { value: unknown }).value = this._element;\n // any other value type at element position is consumed and ignored\n }\n }\n return index + this._slots;\n }\n}\n\n/**\n * A list item is either ELEMENT-MODE — a single-root template instance whose one element IS the\n * item's boundary (`_element`/`_instance`/`_shape` set, `_part` null) — or a general markered\n * ChildPart. Rows are single-root in virtually every real list, and element mode drops both marker\n * comments and both marker inserts per item, which is exactly the per-row overhead a vdom does not\n * pay on create.\n */\ntype Item = {\n _key: unknown;\n _element: Element | null;\n _instance: Instance | null;\n _shape: TemplateStringsArray | null;\n _part: ChildPart | null;\n};\n\nclass Instance {\n _parts: Part[] = [];\n _fragment: DocumentFragment;\n\n constructor(template: Template) {\n /** cloneNode over importNode: same document, and it measures slightly cheaper. */\n this._fragment = template._element.content.cloneNode(true) as DocumentFragment;\n const templateParts = template._parts;\n /** Shared walker, ELEMENT | TEXT — child anchors are the primed text nodes themselves. */\n instanceWalker.currentNode = this._fragment;\n let nodeIndex = -1;\n let node: Node | null = null;\n for (let i = 0; i < templateParts.length; i++) {\n const templatePart = templateParts[i];\n if (templatePart._type === IGNORED) {\n this._parts.push(IGNORED_PART);\n continue;\n }\n while (nodeIndex < templatePart._index) {\n node = instanceWalker.nextNode();\n nodeIndex++;\n }\n this._parts.push(\n templatePart._type === CHILD\n ? new TextPart(node as Text)\n : new AttrPart(node as Element, templatePart._name!, templatePart._statics!)\n );\n }\n }\n\n _update(values: unknown[]) {\n let valueIndex = 0;\n const parts = this._parts;\n for (let i = 0; i < parts.length; i++) valueIndex = parts[i]._commit(values, valueIndex);\n }\n}\n\n/** A single property read — this runs once per list item per render, so it must be minimal. */\nconst isTemplateResult = (value: object): value is TemplateResult =>\n (value as TemplateResult).strings !== undefined;\n\n/**\n * The common case of a child expression is plain text, and the template primes every child slot\n * with a text node — so the steady state is compare-and-assign on `.data`. This part carries only\n * that, upgrading itself to a full ChildPart the first time it sees null, a template, or an array.\n */\nclass TextPart implements Part {\n _text: Text;\n _value: unknown = '';\n _upgraded: ChildPart | null = null;\n\n constructor(text: Text) {\n this._text = text;\n }\n\n _commit(values: unknown[], index: number): number {\n const value = values[index];\n if (this._upgraded !== null) {\n this._upgraded._set(value);\n return index + 1;\n }\n if (value == null || typeof value === 'object') {\n /**\n * Upgrade in place: marker comments come into existence only now, anchored around the text\n * node, and the full part inherits the committed text state and delegates forever.\n *\n * BOTH markers are ours. Borrowing `this._text.nextSibling` as the end instead would hand\n * this part a boundary owned by the NEXT part — and the next part removes that very node\n * when it upgrades and clears its own text. The stale reference then makes `_clear()` walk\n * past the end of the child list. Owning both anchors also makes `_end === null` mean\n * exactly one thing: the root part, which really does own its container.\n */\n const start = comment();\n const end = comment();\n const parent = this._text.parentNode!;\n parent.insertBefore(start, this._text);\n parent.insertBefore(end, this._text.nextSibling);\n const part = new ChildPart(start, end);\n part._mode = TEXT;\n part._text = this._text;\n part._value = this._value;\n this._upgraded = part;\n part._set(value);\n return index + 1;\n }\n if (value !== this._value) {\n this._value = value;\n this._text.data = value as string;\n }\n return index + 1;\n }\n}\n\n/** What a ChildPart currently contains. */\nconst EMPTY = 0;\nconst TEXT = 1;\nconst TEMPLATE = 2;\nconst LIST = 3;\n\n/**\n * Development-only profiling hook, armed by `@verajs/renderer/profiler`. Null until something\n * arms it, so an unprofiled development render pays one null check per template commit.\n *\n * Every reference sits behind `__DEV__`, which `defineDev()` folds to `false` before terser runs —\n * so the declaration, the constants and every call site are removed from the production bundle.\n * Verified by byte comparison, not assumed.\n */\nconst PROFILE_UPDATE = 0; // same template identity — values committed in place\nconst PROFILE_CREATE = 1; // first template into an empty part\nconst PROFILE_REBUILD = 2; // template identity CHANGED — subtree torn down and rebuilt\nconst PROFILE_FRAME_START = 3;\nconst PROFILE_FRAME_END = 4;\n\ntype ProfileHook = (kind: number, subject: unknown, shape: TemplateStringsArray | null) => void;\nlet _profileHook: ProfileHook | null = null;\n/** @internal */\nconst _setProfileHook = (fn: ProfileHook | null) => {\n _profileHook = fn;\n};\n\nclass ChildPart implements Part {\n _start: Comment;\n /** Exclusive end of this part's range; null means \"to the end of the parent\". */\n _end: Node | null;\n _mode = EMPTY;\n _value: unknown;\n _text: Text | null = null;\n _instance: Instance | null = null;\n /** The committed template's strings identity — the same-template fast path in `_set`. */\n _shape: TemplateStringsArray | null = null;\n _items: Item[] | null = null;\n _keyedList = false;\n /** Held instances by template identity; survives clears so state outlives interim content. */\n _held: Map<TemplateStringsArray, Instance> | null = null;\n\n constructor(start: Comment, end: Node | null) {\n this._start = start;\n this._end = end;\n }\n\n _commit(values: unknown[], index: number): number {\n this._set(values[index]);\n return index + 1;\n }\n\n _insert(node: Node) {\n this._start.parentNode!.insertBefore(node, this._end);\n }\n\n _clear() {\n const parent = this._start.parentNode!;\n const end = this._end;\n /**\n * When this part owns its parent's entire contents, one `textContent = ''` replaces removing\n * every node individually. For a 1 000-row table body that is the difference between ~22 ms\n * (lit-html's per-node teardown) and ~5 ms.\n *\n * A part owns the whole parent when nothing precedes its start AND nothing follows its end —\n * `_end === null` (a root part, which runs to the end by definition) or `_end` is the last\n * child. The second case is the common one and used to miss this path entirely: every list\n * written as `<tbody>${rows}</tbody>` sits inside a template, and since 0.1.2 a nested part\n * always owns an end marker, so `_end === null` alone never held for it.\n *\n * Re-appending both anchors in order restores the part's boundary exactly as it was.\n */\n if (this._start.previousSibling === null && (end === null || end.nextSibling === null)) {\n parent.textContent = '';\n parent.appendChild(this._start);\n if (end !== null) parent.appendChild(end);\n } else {\n let node = this._start.nextSibling;\n /**\n * `node !== null` is a backstop, not an expected exit. Reaching the end of the child list\n * without meeting `_end` means something detached this part's boundary; stopping leaves\n * nodes behind, which beats throwing out of the middle of a render pass.\n */\n while (node !== null && node !== this._end) {\n const next = node.nextSibling;\n parent.removeChild(node);\n node = next;\n }\n }\n this._mode = EMPTY;\n this._text = null;\n this._instance = null;\n this._items = null;\n this._shape = null;\n }\n\n _set(value: unknown) {\n if (value == null) {\n if (this._mode !== EMPTY) this._clear();\n return;\n }\n if (typeof value !== 'object') {\n if (this._mode === TEXT) {\n if (this._value !== value) {\n this._value = value;\n this._text!.data = value as string; // the DOM coerces numbers etc.\n }\n } else {\n if (this._mode !== EMPTY) this._clear();\n this._text = doc.createTextNode(value as string);\n this._insert(this._text);\n this._value = value;\n this._mode = TEXT;\n }\n return;\n }\n const heldResult = (value as { $h?: TemplateResult }).$h;\n if (heldResult !== undefined) {\n this._commitHeld(heldResult);\n return;\n }\n if (isTemplateResult(value)) {\n /**\n * Same-shape fast path on `strings` identity alone — no template-cache lookup. This is the\n * hottest line in a keyed list update: for every row whose shape did not change (all of\n * them, in practice), commit costs one identity compare before touching the values.\n */\n if (this._shape === value.strings) {\n if (__DEV__ && _profileHook) _profileHook(PROFILE_UPDATE, this, value.strings);\n this._instance!._update(value.values);\n return;\n }\n /**\n * Reaching here with a template already committed means the identity changed, so the\n * subtree below is about to be destroyed and rebuilt rather than updated. That is what\n * `?hidden=${…}` over a swapped subtree exists to avoid, and it is otherwise invisible.\n */\n if (__DEV__ && _profileHook) {\n _profileHook(this._mode === TEMPLATE ? PROFILE_REBUILD : PROFILE_CREATE, this, value.strings);\n }\n const template = getTemplate(value);\n if (this._mode !== EMPTY) this._clear();\n const instance = new Instance(template);\n instance._update(value.values);\n this._insert(instance._fragment);\n this._instance = instance;\n this._shape = value.strings;\n this._mode = TEMPLATE;\n return;\n }\n if (Array.isArray(value)) {\n this._commitList(value);\n return;\n }\n if (typeof (value as Iterable<unknown>)[Symbol.iterator] === 'function') {\n this._commitList([...(value as Iterable<unknown>)]);\n return;\n }\n // any other object: render as text\n this._set(String(value));\n }\n\n /** Commits a template while stashing whatever it replaces — see the `hold()` export. */\n _commitHeld(result: TemplateResult) {\n if (this._mode === TEMPLATE && this._shape === result.strings) {\n this._instance!._update(result.values);\n return;\n }\n const held = (this._held ??= new Map());\n if (this._mode === TEMPLATE) {\n /** Park the live nodes back in their instance's own (empty) fragment. */\n const fragment = this._instance!._fragment;\n let node = this._start.nextSibling;\n while (node !== this._end) {\n const next = node!.nextSibling;\n fragment.appendChild(node!);\n node = next;\n }\n held.set(this._shape!, this._instance!);\n } else if (this._mode !== EMPTY) {\n this._clear();\n }\n const instance = held.get(result.strings) ?? new Instance(getTemplate(result));\n instance._update(result.values);\n this._insert(instance._fragment);\n this._instance = instance;\n this._shape = result.strings;\n this._mode = TEMPLATE;\n }\n\n /**\n * Creates one list item. A single-root template instance becomes an element-mode item with no\n * markers at all; anything else gets its own start/end marker pair so moves can never dangle.\n */\n _createItem(value: unknown, parent: Node, ref: Node | null): Item {\n if (value !== null && typeof value === 'object' && (value as TemplateResult).strings !== undefined) {\n const result = value as TemplateResult;\n const template = getTemplate(result);\n const instance = new Instance(template);\n instance._update(result.values);\n const rootNode = instance._fragment.firstChild;\n if (rootNode !== null && rootNode.nodeType === 1 && rootNode.nextSibling === null) {\n parent.insertBefore(rootNode, ref);\n return {\n _key: result.key,\n _element: rootNode as Element,\n _instance: instance,\n _shape: result.strings,\n _part: null,\n };\n }\n /** Multi-root template: markered part, content already instantiated. */\n const part = createMarkeredPart(parent, ref);\n part._instance = instance;\n part._shape = result.strings;\n part._mode = TEMPLATE;\n part._start.parentNode!.insertBefore(instance._fragment, part._end);\n return { _key: result.key, _element: null, _instance: null, _shape: null, _part: part };\n }\n const part = createMarkeredPart(parent, ref);\n part._set(value);\n return { _key: (value as TemplateResult)?.key, _element: null, _instance: null, _shape: null, _part: part };\n }\n\n /** Commits a new value into an existing item, demoting element mode if the shape changed. */\n _updateItem(item: Item, value: unknown) {\n if (item._element !== null) {\n if (value !== null && typeof value === 'object' && (value as TemplateResult).strings === item._shape) {\n item._instance!._update((value as TemplateResult).values);\n return;\n }\n /** Shape changed: swap the bare element for a markered part in its place. */\n const part = createMarkeredPart(item._element.parentNode!, item._element);\n item._element.remove();\n item._element = null;\n item._instance = null;\n item._shape = null;\n (item._part = part)._set(value);\n return;\n }\n item._part!._set(value);\n }\n\n /** The item's first node — its move/removal handle and the insertion reference before it. */\n _firstNode(item: Item): Node {\n return item._element ?? item._part!._start;\n }\n\n _moveItem(item: Item, ref: Node | null, parent: Node = this._start.parentNode!) {\n if (item._element !== null) {\n parent.insertBefore(item._element, ref);\n return;\n }\n let node: Node | null = item._part!._start;\n const stop = item._part!._end!.nextSibling;\n while (node !== stop) {\n const next: Node | null = node!.nextSibling;\n parent.insertBefore(node!, ref);\n node = next;\n }\n }\n\n /** Removal is a move into a scratch fragment that is immediately emptied. */\n _dropItem(item: Item) {\n this._moveItem(item, null, SCRATCH);\n SCRATCH.textContent = '';\n }\n\n _commitList(newValues: unknown[]) {\n if (this._mode !== LIST) {\n if (this._mode !== EMPTY) this._clear();\n this._items = [];\n this._keyedList = false;\n this._mode = LIST;\n }\n const count = newValues.length;\n if (count === 0) {\n if (this._items!.length) {\n this._clear();\n this._items = [];\n this._mode = LIST;\n }\n return;\n }\n const isKeyed = newValues[0] != null && (newValues[0] as TemplateResult).key !== undefined;\n if (isKeyed !== this._keyedList && this._items!.length) {\n this._clear();\n this._items = [];\n this._mode = LIST;\n }\n this._keyedList = isKeyed;\n const items = this._items!;\n const parent = this._start.parentNode!;\n\n if (items.length === 0) {\n /** Initial fill builds off-document and lands in one insert. */\n const fragment = doc.createDocumentFragment();\n for (let i = 0; i < count; i++) items.push(this._createItem(newValues[i], fragment, null));\n this._insert(fragment);\n return;\n }\n\n if (!isKeyed) {\n // index mode: update in place, grow at the end, shrink from the end\n const shared = items.length < count ? items.length : count;\n for (let i = 0; i < shared; i++) this._updateItem(items[i], newValues[i]);\n if (count > items.length) {\n const fragment = doc.createDocumentFragment();\n for (let i = items.length; i < count; i++) items.push(this._createItem(newValues[i], fragment, null));\n this._insert(fragment);\n } else if (count < items.length) {\n const last = items[items.length - 1];\n let node: Node | null = this._firstNode(items[count]);\n const stop = last._element !== null ? last._element.nextSibling : last._part!._end!.nextSibling;\n while (node !== stop) {\n const next: Node | null = node!.nextSibling;\n parent.removeChild(node!);\n node = next;\n }\n items.length = count;\n }\n return;\n }\n\n /**\n * Zero-allocation fast path for the dominant case: same length, same key order — a pure\n * in-place update (a selection change, a field edit). No key array, no output array, no null\n * checks. Falls through to the full algorithm on the first mismatch; the items already updated\n * re-verify there as cheap no-op compares.\n */\n if (items.length === count) {\n let i = 0;\n while (i < count && items[i]._key === (newValues[i] as TemplateResult).key) {\n this._updateItem(items[i], newValues[i]);\n i++;\n }\n if (i === count) return;\n }\n\n /**\n * Keyed reconciliation — the standard head/tail algorithm (as in lit's `repeat` and Vue):\n * skip matching prefixes and suffixes, detect the two swap shapes directly, and fall back to\n * key maps for arbitrary moves, removals and insertions.\n */\n const oldItems: (Item | null)[] = items;\n const newKeys: unknown[] = new Array(count);\n for (let i = 0; i < count; i++) newKeys[i] = (newValues[i] as TemplateResult).key;\n const newItems: Item[] = new Array(count);\n let oldHead = 0;\n let oldTail = oldItems.length - 1;\n let newHead = 0;\n let newTail = count - 1;\n let newKeyToIndex: Map<unknown, number> | undefined;\n let oldKeyToIndex: Map<unknown, number> | undefined;\n const refAt = (i: number): Node | null =>\n i < count && newItems[i] !== undefined ? this._firstNode(newItems[i]) : this._end;\n\n while (oldHead <= oldTail && newHead <= newTail) {\n if (oldItems[oldHead] === null) oldHead++;\n else if (oldItems[oldTail] === null) oldTail--;\n else if (oldItems[oldHead]!._key === newKeys[newHead]) {\n this._updateItem((newItems[newHead] = oldItems[oldHead]!), newValues[newHead]);\n oldHead++;\n newHead++;\n } else if (oldItems[oldTail]!._key === newKeys[newTail]) {\n this._updateItem((newItems[newTail] = oldItems[oldTail]!), newValues[newTail]);\n oldTail--;\n newTail--;\n } else if (oldItems[oldHead]!._key === newKeys[newTail]) {\n const item = oldItems[oldHead]!;\n this._moveItem(item, refAt(newTail + 1));\n this._updateItem(item, newValues[newTail]);\n newItems[newTail] = item;\n oldHead++;\n newTail--;\n } else if (oldItems[oldTail]!._key === newKeys[newHead]) {\n const item = oldItems[oldTail]!;\n this._moveItem(item, this._firstNode(oldItems[oldHead]!));\n this._updateItem(item, newValues[newHead]);\n newItems[newHead] = item;\n oldTail--;\n newHead++;\n } else {\n if (newKeyToIndex === undefined) {\n newKeyToIndex = new Map();\n for (let i = newHead; i <= newTail; i++) newKeyToIndex.set(newKeys[i], i);\n oldKeyToIndex = new Map();\n for (let i = oldHead; i <= oldTail; i++) {\n if (oldItems[i] !== null) oldKeyToIndex.set(oldItems[i]!._key, i);\n }\n }\n if (!newKeyToIndex.has(oldItems[oldHead]!._key)) {\n this._dropItem(oldItems[oldHead]!);\n oldHead++;\n } else if (!newKeyToIndex.has(oldItems[oldTail]!._key)) {\n this._dropItem(oldItems[oldTail]!);\n oldTail--;\n } else {\n const oldIndex = oldKeyToIndex!.get(newKeys[newHead]);\n if (oldIndex === undefined) {\n newItems[newHead] = this._createItem(newValues[newHead], parent, this._firstNode(oldItems[oldHead]!));\n } else {\n const item = oldItems[oldIndex]!;\n this._moveItem(item, this._firstNode(oldItems[oldHead]!));\n this._updateItem(item, newValues[newHead]);\n newItems[newHead] = item;\n oldItems[oldIndex] = null;\n }\n newHead++;\n }\n }\n }\n while (newHead <= newTail) {\n newItems[newHead] = this._createItem(newValues[newHead], parent, refAt(newTail + 1));\n newHead++;\n }\n while (oldHead <= oldTail) {\n const item = oldItems[oldHead++];\n if (item !== null) this._dropItem(item);\n }\n this._items = newItems;\n }\n}\n\nconst rootParts = new WeakMap<Node, ChildPart>();\n\n/**\n * Renders a template result into a container. Slots into Vera via `setRenderer(render)`; core's\n * built-in `html` tag already produces the accepted shape, so no `setHtml` call is required —\n * though lit-html's `html` also works, its results being structurally identical.\n *\n * HYDRATION lives in `@verajs/renderer/hydrate` — a drop-in superset entry whose `render` adopts\n * existing server-rendered children on first render. SSR apps import from there instead of here;\n * this entry carries zero hydration code.\n */\nexport const render = (result: unknown, container: Node) => {\n if (__DEV__ && _profileHook) _profileHook(PROFILE_FRAME_START, container, null);\n let part = rootParts.get(container);\n if (part === undefined) {\n const marker = comment();\n container.appendChild(marker);\n rootParts.set(container, (part = new ChildPart(marker, null)));\n }\n part._set(result);\n if (__DEV__ && _profileHook) _profileHook(PROFILE_FRAME_END, container, null);\n};\n\n// ── INTERNAL SURFACE — imported by ./hydrate.ts, never re-exported by src/index.ts ─────────────\n// The public d.ts comes from src/index.ts, and the base bundles tree-shake all of this away, so\n// nothing here reaches consumers of the base entry. The hydrate entry compiles against this exact\n// source into its own self-contained bundle, so mangled property names always agree within it.\n\n/** @internal */\nexport {\n getTemplate,\n Template,\n Instance,\n TextPart,\n ChildPart,\n AttrPart,\n IGNORED_PART,\n IGNORED,\n TEMPLATE,\n LIST,\n comment,\n doc,\n toText,\n isTemplateResult,\n instanceWalker,\n rootParts,\n _setProfileHook,\n PROFILE_UPDATE,\n PROFILE_CREATE,\n PROFILE_REBUILD,\n PROFILE_FRAME_START,\n PROFILE_FRAME_END,\n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OAAO,IAAI,YAAY;AAAE,QAAA;AAC/B;;;;"}
@@ -1,2 +1,2 @@
1
- const t=(t,s)=>(s.key=t,s),s=t=>({$h:t}),n="$v"+(1e9*Math.random()>>>0).toString(36)+"$",e="?"+n,i=document,l=(t="")=>i.createComment(t),o=i.createTreeWalker(i,129),h=i.createTreeWalker(i,5),r=/^(?:script|style|textarea|title)$/i,c=/[\s"'>=/]/,f=new WeakMap;class u{t;i=[];constructor(t){const s=t._$litType$??1,{markup:f,specs:u}=(t=>{const s=[];let e="",i=0,l="",o=0,h="",f=0,u=!1,_="",a=[],p="";const d=t=>{let s=t;for(;s>0&&!c.test(e[s-1]);)s--;return e.slice(s,t)};for(let c=0;c<t.length;c++){const m=t[c];let v=0;for(;v<m.length;){const t=m[v];if(5===i){if(t===l||""===l&&(" "===t||"\t"===t||"\n"===t||"\r"===t||">"===t||"/"===t)){a.push(p);const t=l||'"';e+=` ${s.length}${n}=${t}${a.join(n)}${t}`,s.push({l:1,o:_}),i=1,""!==l&&v++;continue}p+=t,v++}else if(0===i){if("<"===t){if(m.startsWith("!--",v+1)){i=3,e+="\x3c!--",v+=4;continue}u="/"===m[v+1],f=e.length+(u?2:1),i=1}e+=t,v++}else if(1===i){if('"'===t||"'"===t)l=t,o=e.length,i=2;else if(">"===t){const t=e.slice(f).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";u||!r.test(t)||e.endsWith("/")?i=0:(h=t.toLowerCase(),i=4)}e+=t,v++}else if(2===i)t===l&&(i=1),e+=t,v++;else if(3===i){if("-"===t&&m.startsWith("->",v+1)){e+="--\x3e",v+=3,i=0;continue}e+=t,v++}else"<"===t&&m.slice(v+1,v+2+h.length).toLowerCase()==="/"+h&&(v+2+h.length>=m.length||/[\s/>]/.test(m[v+2+h.length]))&&(u=!0,f=e.length+2,i=1),e+=t,v++}if(c===t.length-1)break;if(0===i)e+=`<?${n}>`,s.push({l:0});else if(4===i)e+=n,s.push({l:0});else if(3===i)s.push({l:2});else if(5===i)a.push(p),p="";else if(2===i){const t="="===e[o-1]?d(o-1):"";t?(_=t,a=[e.slice(o+1)],p="",e=e.slice(0,o-1-t.length),i=5):s.push({l:2})}else{const t=e.endsWith("=")?d(e.length-1):"";t?(_=t,a=[""],p="",l="",e=e.slice(0,e.length-1-t.length),i=5):(e+=` ${s.length}${n}="${n}"`,s.push({l:1,o:"&"}))}}return{markup:e,specs:s}})(t.strings);this.t=i.createElement("template"),this.t.innerHTML=2===s?`<svg>${f}</svg>`:3===s?`<math>${f}</math>`:f;const _=this.t.content;if(1!==s){const t=_.firstChild;for(;t.firstChild;)_.insertBefore(t.firstChild,t);_.removeChild(t)}o.currentNode=_;let a,p=0;const d=this.i,m=()=>{for(;p<u.length&&2===u[p].l;)d.push({l:2,h:-1}),p++};for(m();p<u.length&&null!==(a=o.nextNode());)if(1===a.nodeType){const t=a;if(t.hasAttributes())for(const s of t.getAttributeNames())if(s.endsWith(n)){const e=u[p++];d.push({l:1,h:-1,o:e.o,u:t.getAttribute(s).split(n),_:t}),t.removeAttribute(s),m()}if(r.test(t.tagName)&&t.textContent.includes(n)){const s=t.textContent.split(n);t.textContent="";for(let n=0;n<s.length-1;n++)s[n]&&t.append(s[n]),t.append(l(e));s[s.length-1]&&t.append(s[s.length-1])}}else if(a.data===e){p++;const t=i.createTextNode("");a.parentNode.insertBefore(t,a),o.currentNode=t,a.remove(),d.push({l:0,h:-1,_:t}),m()}h.currentNode=_;let v=-1,y=0;for(;y<d.length&&2===d[y].l;)y++;for(;y<d.length&&null!==(a=h.nextNode());)for(v++;y<d.length&&d[y]._===a;)for(d[y].h=v,y++;y<d.length&&2===d[y].l;)y++;for(const t of d)t._=void 0}}const _=t=>{let s=f.get(t.strings);return void 0===s&&f.set(t.strings,s=new u(t)),s},a={p:(t,s)=>s+1},p={},d=i.createDocumentFragment(),m=(t,s)=>{const n=l(),e=l();return t.insertBefore(n,s),t.insertBefore(e,s),new b(n,e)},v=t=>null==t?"":String(t);class y{t;o;u;m;v;$;k=p;j=null;constructor(t,s,n){const e=s[0];let i="."===e?1:"?"===e?2:"@"===e?3:"&"===e?4:0,l=i?s.slice(1):s;0===i&&"o"===e&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(i=3,l=s.slice(2).toLowerCase()),this.v=i,this.o=l,this.t=t,this.u=n,this.m=n.length-1,this.$=1===this.m&&""===n[0]&&""===n[1]}handleEvent(t){this.j&&this.j.call(this.t,t)}p(t,s){const n=this.v;let e;if(this.$||n>=3)e=t[s];else{const n=this.u;let i=n[0];for(let e=0;e<this.m;e++)i+=v(t[s+e])+n[e+1];e=i}if(e!==this.k){const t=this.k===p;this.k=e,0===n?null==e?t||this.t.removeAttribute(this.o):this.t.setAttribute(this.o,e):1===n?this.t[this.o]=e:2===n?t&&!e||this.t.toggleAttribute(this.o,!!e):3===n?(null===this.j&&null!=e&&this.t.addEventListener(this.o,this),this.j=e??null):null!=e&&("function"==typeof e?e(this.t):"object"==typeof e&&(e.value=this.t))}return s+this.m}}class w{i=[];I;constructor(t){this.I=t.t.content.cloneNode(!0);const s=t.i;h.currentNode=this.I;let n=-1,e=null;for(let t=0;t<s.length;t++){const i=s[t];if(2!==i.l){for(;n<i.h;)e=h.nextNode(),n++;this.i.push(0===i.l?new k(e):new y(e,i.o,i.u))}else this.i.push(a)}}M(t){let s=0;const n=this.i;for(let e=0;e<n.length;e++)s=n[e].p(t,s)}}const $=t=>void 0!==t.strings;class k{A;S="";W=null;constructor(t){this.A=t}p(t,s){const n=t[s];if(null!==this.W)return this.W.L(n),s+1;if(null==n||"object"==typeof n){const t=l(),e=l(),i=this.A.parentNode;i.insertBefore(t,this.A),i.insertBefore(e,this.A.nextSibling);const o=new b(t,e);return o.F=x,o.A=this.A,o.S=this.S,this.W=o,o.L(n),s+1}return n!==this.S&&(this.S=n,this.A.data=n),s+1}}const x=1;class b{H;N;F=0;S;A=null;O=null;V=null;Z=null;q=!1;B=null;constructor(t,s){this.H=t,this.N=s}p(t,s){return this.L(t[s]),s+1}C(t){this.H.parentNode.insertBefore(t,this.N)}D(){const t=this.H.parentNode;if(null===this.H.previousSibling&&null===this.N)t.textContent="",t.appendChild(this.H);else{let s=this.H.nextSibling;for(;null!==s&&s!==this.N;){const n=s.nextSibling;t.removeChild(s),s=n}}this.F=0,this.A=null,this.O=null,this.Z=null,this.V=null}L(t){if(null==t)return void(0!==this.F&&this.D());if("object"!=typeof t)return void(this.F===x?this.S!==t&&(this.S=t,this.A.data=t):(0!==this.F&&this.D(),this.A=i.createTextNode(t),this.C(this.A),this.S=t,this.F=x));const s=t.$h;if(void 0===s){if($(t)){if(this.V===t.strings)return void this.O.M(t.values);const s=_(t);0!==this.F&&this.D();const n=new w(s);return n.M(t.values),this.C(n.I),this.O=n,this.V=t.strings,void(this.F=2)}Array.isArray(t)?this.G(t):"function"!=typeof t[Symbol.iterator]?this.L(String(t)):this.G([...t])}else this.J(s)}J(t){if(2===this.F&&this.V===t.strings)return void this.O.M(t.values);const s=this.B??=new Map;if(2===this.F){const t=this.O.I;let n=this.H.nextSibling;for(;n!==this.N;){const s=n.nextSibling;t.appendChild(n),n=s}s.set(this.V,this.O)}else 0!==this.F&&this.D();const n=s.get(t.strings)??new w(_(t));n.M(t.values),this.C(n.I),this.O=n,this.V=t.strings,this.F=2}K(t,s,n){if(null!==t&&"object"==typeof t&&void 0!==t.strings){const e=t,i=_(e),l=new w(i);l.M(e.values);const o=l.I.firstChild;if(null!==o&&1===o.nodeType&&null===o.nextSibling)return s.insertBefore(o,n),{P:e.key,t:o,O:l,V:e.strings,R:null};const h=m(s,n);return h.O=l,h.V=e.strings,h.F=2,h.H.parentNode.insertBefore(l.I,h.N),{P:e.key,t:null,O:null,V:null,R:h}}const e=m(s,n);return e.L(t),{P:t?.key,t:null,O:null,V:null,R:e}}T(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.V)return void t.O.M(s.values);const n=m(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.O=null,t.V=null,void(t.R=n).L(s)}t.R.L(s)}U(t){return t.t??t.R.H}X(t,s,n=this.H.parentNode){if(null!==t.t)return void n.insertBefore(t.t,s);let e=t.R.H;const i=t.R.N.nextSibling;for(;e!==i;){const t=e.nextSibling;n.insertBefore(e,s),e=t}}Y(t){this.X(t,null,d),d.textContent=""}G(t){3!==this.F&&(0!==this.F&&this.D(),this.Z=[],this.q=!1,this.F=3);const s=t.length;if(0===s)return void(this.Z.length&&(this.D(),this.Z=[],this.F=3));const n=null!=t[0]&&void 0!==t[0].key;n!==this.q&&this.Z.length&&(this.D(),this.Z=[],this.F=3),this.q=n;const e=this.Z,l=this.H.parentNode;if(0===e.length){const n=i.createDocumentFragment();for(let i=0;i<s;i++)e.push(this.K(t[i],n,null));return void this.C(n)}if(!n){const n=e.length<s?e.length:s;for(let s=0;s<n;s++)this.T(e[s],t[s]);if(s>e.length){const n=i.createDocumentFragment();for(let i=e.length;i<s;i++)e.push(this.K(t[i],n,null));this.C(n)}else if(s<e.length){const t=e[e.length-1];let n=this.U(e[s]);const i=null!==t.t?t.t.nextSibling:t.R.N.nextSibling;for(;n!==i;){const t=n.nextSibling;l.removeChild(n),n=t}e.length=s}return}if(e.length===s){let n=0;for(;n<s&&e[n].P===t[n].key;)this.T(e[n],t[n]),n++;if(n===s)return}const o=e,h=new Array(s);for(let n=0;n<s;n++)h[n]=t[n].key;const r=new Array(s);let c,f,u=0,_=o.length-1,a=0,p=s-1;const d=t=>t<s&&void 0!==r[t]?this.U(r[t]):this.N;for(;u<=_&&a<=p;)if(null===o[u])u++;else if(null===o[_])_--;else if(o[u].P===h[a])this.T(r[a]=o[u],t[a]),u++,a++;else if(o[_].P===h[p])this.T(r[p]=o[_],t[p]),_--,p--;else if(o[u].P===h[p]){const s=o[u];this.X(s,d(p+1)),this.T(s,t[p]),r[p]=s,u++,p--}else if(o[_].P===h[a]){const s=o[_];this.X(s,this.U(o[u])),this.T(s,t[a]),r[a]=s,_--,a++}else{if(void 0===c){c=new Map;for(let t=a;t<=p;t++)c.set(h[t],t);f=new Map;for(let t=u;t<=_;t++)null!==o[t]&&f.set(o[t].P,t)}if(c.has(o[u].P))if(c.has(o[_].P)){const s=f.get(h[a]);if(void 0===s)r[a]=this.K(t[a],l,this.U(o[u]));else{const n=o[s];this.X(n,this.U(o[u])),this.T(n,t[a]),r[a]=n,o[s]=null}a++}else this.Y(o[_]),_--;else this.Y(o[u]),u++}for(;a<=p;)r[a]=this.K(t[a],l,d(p+1)),a++;for(;u<=_;){const t=o[u++];null!==t&&this.Y(t)}this.Z=r}}const j=new WeakMap,I={},M=t=>(t.offset>0&&(t.node=t.node.splitText(t.offset),t.offset=0),t.node),g=new WeakMap,A=(t,s,n)=>{n.tt++;const e=n.st.i;if(3===t.nodeType){let i=!1;for(;n.nt<e.length&&e[n.nt].h===n.tt;)i=!0,n.nt++,W(s,n.et[n.it++],n.lt),S(n);return void(i||((t,s)=>{let n=s;for(;n.length>0;){const s=t.node;if(null===s||3!==s.nodeType)throw I;const e=s.data,i=e.length-t.offset;if(0===i){t.node=s.nextSibling,t.offset=0;continue}const l=i<n.length?i:n.length;if(e.slice(t.offset,t.offset+l)!==n.slice(0,l))throw I;n=n.slice(l),t.offset+=l,t.offset===e.length&&(t.node=s.nextSibling,t.offset=0)}})(s,t.data))}const i=M(s);if(null===i||1!==i.nodeType)throw I;if(i.localName!==t.localName)throw I;for(;n.nt<e.length&&e[n.nt].h===n.tt;){const t=e[n.nt++],s=new y(i,t.o,t.u);n.lt.push(s),n.it=s.p(n.et,n.it),S(n)}const l={parent:i,node:i.firstChild,offset:0};let o=t.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,l,n),o=o.nextSibling;if(null!==l.node&&(3!==l.node.nodeType||""!==l.node.data||null!==l.node.nextSibling))throw I;s.node=i.nextSibling,s.offset=0},S=t=>{const s=t.st.i;for(;t.nt<s.length&&2===s[t.nt].l;)t.lt.push(a),t.it++,t.nt++},W=(t,s,n)=>{const e=s?.$h,o=void 0!==e?e:s;if(null!=o&&"object"!=typeof o){const s=new k(((t,s)=>{const n=M(t);if(""===s){const s=i.createTextNode("");return t.parent.insertBefore(s,n),s}if(null===n||3!==n.nodeType)throw I;const e=n;if(e.data.length>s.length&&e.splitText(s.length),e.data!==s)throw I;return t.node=e.nextSibling,t.offset=0,e})(t,v(o)));return s.S=o,void n.push(s)}const h=l();t.parent.insertBefore(h,M(t));const r=new b(h,null);if(null==o);else if($(o))r.O=z(_(o),o.values,t),r.V=o.strings,r.F=2;else{const s=Array.isArray(o)?o:[...o],n=[];for(const e of s)n.push(L(t,e));r.Z=n,r.q=s.length>0&&void 0!==s[0]?.key,r.F=3}const c=l();t.parent.insertBefore(c,M(t)),r.N=c,n.push(r)},L=(t,s)=>{if(null!==s&&"object"==typeof s&&void 0!==s.strings){const n=s,e=_(n),i=e.t.content.firstChild;if(null!==i&&1===i.nodeType&&null===i.nextSibling){const s=M(t),i=z(e,n.values,t);return{P:n.key,t:s,O:i,V:n.strings,R:null}}const o=l();t.parent.insertBefore(o,M(t));const h=z(e,n.values,t),r=l();t.parent.insertBefore(r,M(t));const c=new b(o,r);return c.O=h,c.V=n.strings,c.F=2,{P:n.key,t:null,O:null,V:null,R:c}}const n=[];return W(t,s,n),{P:s?.key,t:null,O:null,V:null,R:n[0]}},z=(t,s,n)=>{const e=Object.create(w.prototype);e.i=[],e.I=i.createDocumentFragment();const l={st:t,et:s,it:0,nt:0,tt:-1,lt:e.i};S(l),(t=>{let s=g.get(t);if(void 0===s){let n;for(s=[],h.currentNode=t.t.content;null!==(n=h.nextNode());)s.push(n);g.set(t,s)}})(t);let o=t.t.content.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,n,l),o=o.nextSibling;if(S(l),l.nt!==t.i.length)throw I;return e},E=(t,s)=>{if(!j.has(s)&&null!==s.firstChild&&null!==t&&"object"==typeof t&&$(t)){const n=((t,s)=>{let n=s.firstChild;for(;null!==n&&1===n.nodeType&&n.hasAttribute("vera-styles");)n=n.nextSibling;const e=l();s.insertBefore(e,n);try{const n={parent:s,node:e.nextSibling,offset:0},i=z(_(t),t.values,n);if(null!==n.node)throw I;const l=new b(e,null);return l.O=i,l.V=t.strings,l.F=2,l}catch(t){if(t!==I)throw t;return e.remove(),null}})(t,s);if(null!==n)return void j.set(s,n);(t=>{let s=t.firstChild;for(;null!==s;){const n=s.nextSibling;1===s.nodeType&&s.hasAttribute("vera-styles")||t.removeChild(s),s=n}})(s)}((t,s)=>{let n=j.get(s);if(void 0===n){const t=l();s.appendChild(t),j.set(s,n=new b(t,null))}n.L(t)})(t,s)};export{s as hold,t as keyed,E as render};
1
+ const t=(t,s)=>(s.key=t,s),s=t=>({$h:t}),n="$v"+(1e9*Math.random()>>>0).toString(36)+"$",e="?"+n,i=document,l=(t="")=>i.createComment(t),o=i.createTreeWalker(i,129),h=i.createTreeWalker(i,5),r=/^(?:script|style|textarea|title)$/i,c=/[\s"'>=/]/,u=new WeakMap;class f{t;i=[];constructor(t){const s=t._$litType$??1,{markup:u,specs:f}=(t=>{const s=[];let e="",i=0,l="",o=0,h="",u=0,f=!1,_="",a=[],p="";const d=t=>{let s=t;for(;s>0&&!c.test(e[s-1]);)s--;return e.slice(s,t)};for(let c=0;c<t.length;c++){const m=t[c];let v=0;for(;v<m.length;){const t=m[v];if(5===i){if(t===l||""===l&&(" "===t||"\t"===t||"\n"===t||"\r"===t||">"===t||"/"===t)){a.push(p);const t=l||'"';e+=` ${s.length}${n}=${t}${a.join(n)}${t}`,s.push({l:1,o:_}),i=1,""!==l&&v++;continue}p+=t,v++}else if(0===i){if("<"===t){if(m.startsWith("!--",v+1)){i=3,e+="\x3c!--",v+=4;continue}f="/"===m[v+1],u=e.length+(f?2:1),i=1}e+=t,v++}else if(1===i){if('"'===t||"'"===t)l=t,o=e.length,i=2;else if(">"===t){const t=e.slice(u).match(/^[a-zA-Z][^\s/>]*/)?.[0]??"";f||!r.test(t)||e.endsWith("/")?i=0:(h=t.toLowerCase(),i=4)}e+=t,v++}else if(2===i)t===l&&(i=1),e+=t,v++;else if(3===i){if("-"===t&&m.startsWith("->",v+1)){e+="--\x3e",v+=3,i=0;continue}e+=t,v++}else"<"===t&&m.slice(v+1,v+2+h.length).toLowerCase()==="/"+h&&(v+2+h.length>=m.length||/[\s/>]/.test(m[v+2+h.length]))&&(f=!0,u=e.length+2,i=1),e+=t,v++}if(c===t.length-1)break;if(0===i)e+=`<?${n}>`,s.push({l:0});else if(4===i)e+=n,s.push({l:0});else if(3===i)s.push({l:2});else if(5===i)a.push(p),p="";else if(2===i){const t="="===e[o-1]?d(o-1):"";t?(_=t,a=[e.slice(o+1)],p="",e=e.slice(0,o-1-t.length),i=5):s.push({l:2})}else{const t=e.endsWith("=")?d(e.length-1):"";t?(_=t,a=[""],p="",l="",e=e.slice(0,e.length-1-t.length),i=5):(e+=` ${s.length}${n}="${n}"`,s.push({l:1,o:"&"}))}}return{markup:e,specs:s}})(t.strings);this.t=i.createElement("template"),this.t.innerHTML=2===s?`<svg>${u}</svg>`:3===s?`<math>${u}</math>`:u;const _=this.t.content;if(1!==s){const t=_.firstChild;for(;t.firstChild;)_.insertBefore(t.firstChild,t);_.removeChild(t)}o.currentNode=_;let a,p=0;const d=this.i,m=()=>{for(;p<f.length&&2===f[p].l;)d.push({l:2,h:-1}),p++};for(m();p<f.length&&null!==(a=o.nextNode());)if(1===a.nodeType){const t=a;if(t.hasAttributes())for(const s of t.getAttributeNames())if(s.endsWith(n)){const e=f[p++];d.push({l:1,h:-1,o:e.o,u:t.getAttribute(s).split(n),_:t}),t.removeAttribute(s),m()}if(r.test(t.tagName)&&t.textContent.includes(n)){const s=t.textContent.split(n);t.textContent="";for(let n=0;n<s.length-1;n++)s[n]&&t.append(s[n]),t.append(l(e));s[s.length-1]&&t.append(s[s.length-1])}}else if(a.data===e){p++;const t=i.createTextNode("");a.parentNode.insertBefore(t,a),o.currentNode=t,a.remove(),d.push({l:0,h:-1,_:t}),m()}h.currentNode=_;let v=-1,y=0;for(;y<d.length&&2===d[y].l;)y++;for(;y<d.length&&null!==(a=h.nextNode());)for(v++;y<d.length&&d[y]._===a;)for(d[y].h=v,y++;y<d.length&&2===d[y].l;)y++;for(const t of d)t._=void 0}}const _=t=>{let s=u.get(t.strings);return void 0===s&&u.set(t.strings,s=new f(t)),s},a={p:(t,s)=>s+1},p={},d=i.createDocumentFragment(),m=(t,s)=>{const n=l(),e=l();return t.insertBefore(n,s),t.insertBefore(e,s),new b(n,e)},v=t=>null==t?"":String(t);class y{t;o;u;m;v;$;k=p;j=null;constructor(t,s,n){const e=s[0];let i="."===e?1:"?"===e?2:"@"===e?3:"&"===e?4:0,l=i?s.slice(1):s;0===i&&"o"===e&&110===s.charCodeAt(1)&&s.charCodeAt(2)>64&&s.charCodeAt(2)<91&&(i=3,l=s.slice(2).toLowerCase()),this.v=i,this.o=l,this.t=t,this.u=n,this.m=n.length-1,this.$=1===this.m&&""===n[0]&&""===n[1]}handleEvent(t){this.j&&this.j.call(this.t,t)}p(t,s){const n=this.v;let e;if(this.$||n>=3)e=t[s];else{const n=this.u;let i=n[0];for(let e=0;e<this.m;e++)i+=v(t[s+e])+n[e+1];e=i}if(e!==this.k){const t=this.k===p;this.k=e,0===n?null==e?t||this.t.removeAttribute(this.o):this.t.setAttribute(this.o,e):1===n?this.t[this.o]=e:2===n?t&&!e||this.t.toggleAttribute(this.o,!!e):3===n?(null===this.j&&null!=e&&this.t.addEventListener(this.o,this),this.j=e??null):null!=e&&("function"==typeof e?e(this.t):"object"==typeof e&&(e.value=this.t))}return s+this.m}}class w{i=[];I;constructor(t){this.I=t.t.content.cloneNode(!0);const s=t.i;h.currentNode=this.I;let n=-1,e=null;for(let t=0;t<s.length;t++){const i=s[t];if(2!==i.l){for(;n<i.h;)e=h.nextNode(),n++;this.i.push(0===i.l?new k(e):new y(e,i.o,i.u))}else this.i.push(a)}}M(t){let s=0;const n=this.i;for(let e=0;e<n.length;e++)s=n[e].p(t,s)}}const $=t=>void 0!==t.strings;class k{A;S="";W=null;constructor(t){this.A=t}p(t,s){const n=t[s];if(null!==this.W)return this.W.L(n),s+1;if(null==n||"object"==typeof n){const t=l(),e=l(),i=this.A.parentNode;i.insertBefore(t,this.A),i.insertBefore(e,this.A.nextSibling);const o=new b(t,e);return o.F=x,o.A=this.A,o.S=this.S,this.W=o,o.L(n),s+1}return n!==this.S&&(this.S=n,this.A.data=n),s+1}}const x=1;class b{H;N;F=0;S;A=null;O=null;V=null;Z=null;q=!1;B=null;constructor(t,s){this.H=t,this.N=s}p(t,s){return this.L(t[s]),s+1}C(t){this.H.parentNode.insertBefore(t,this.N)}D(){const t=this.H.parentNode,s=this.N;if(null!==this.H.previousSibling||null!==s&&null!==s.nextSibling){let s=this.H.nextSibling;for(;null!==s&&s!==this.N;){const n=s.nextSibling;t.removeChild(s),s=n}}else t.textContent="",t.appendChild(this.H),null!==s&&t.appendChild(s);this.F=0,this.A=null,this.O=null,this.Z=null,this.V=null}L(t){if(null==t)return void(0!==this.F&&this.D());if("object"!=typeof t)return void(this.F===x?this.S!==t&&(this.S=t,this.A.data=t):(0!==this.F&&this.D(),this.A=i.createTextNode(t),this.C(this.A),this.S=t,this.F=x));const s=t.$h;if(void 0===s){if($(t)){if(this.V===t.strings)return void this.O.M(t.values);const s=_(t);0!==this.F&&this.D();const n=new w(s);return n.M(t.values),this.C(n.I),this.O=n,this.V=t.strings,void(this.F=2)}Array.isArray(t)?this.G(t):"function"!=typeof t[Symbol.iterator]?this.L(String(t)):this.G([...t])}else this.J(s)}J(t){if(2===this.F&&this.V===t.strings)return void this.O.M(t.values);const s=this.B??=new Map;if(2===this.F){const t=this.O.I;let n=this.H.nextSibling;for(;n!==this.N;){const s=n.nextSibling;t.appendChild(n),n=s}s.set(this.V,this.O)}else 0!==this.F&&this.D();const n=s.get(t.strings)??new w(_(t));n.M(t.values),this.C(n.I),this.O=n,this.V=t.strings,this.F=2}K(t,s,n){if(null!==t&&"object"==typeof t&&void 0!==t.strings){const e=t,i=_(e),l=new w(i);l.M(e.values);const o=l.I.firstChild;if(null!==o&&1===o.nodeType&&null===o.nextSibling)return s.insertBefore(o,n),{P:e.key,t:o,O:l,V:e.strings,R:null};const h=m(s,n);return h.O=l,h.V=e.strings,h.F=2,h.H.parentNode.insertBefore(l.I,h.N),{P:e.key,t:null,O:null,V:null,R:h}}const e=m(s,n);return e.L(t),{P:t?.key,t:null,O:null,V:null,R:e}}T(t,s){if(null!==t.t){if(null!==s&&"object"==typeof s&&s.strings===t.V)return void t.O.M(s.values);const n=m(t.t.parentNode,t.t);return t.t.remove(),t.t=null,t.O=null,t.V=null,void(t.R=n).L(s)}t.R.L(s)}U(t){return t.t??t.R.H}X(t,s,n=this.H.parentNode){if(null!==t.t)return void n.insertBefore(t.t,s);let e=t.R.H;const i=t.R.N.nextSibling;for(;e!==i;){const t=e.nextSibling;n.insertBefore(e,s),e=t}}Y(t){this.X(t,null,d),d.textContent=""}G(t){3!==this.F&&(0!==this.F&&this.D(),this.Z=[],this.q=!1,this.F=3);const s=t.length;if(0===s)return void(this.Z.length&&(this.D(),this.Z=[],this.F=3));const n=null!=t[0]&&void 0!==t[0].key;n!==this.q&&this.Z.length&&(this.D(),this.Z=[],this.F=3),this.q=n;const e=this.Z,l=this.H.parentNode;if(0===e.length){const n=i.createDocumentFragment();for(let i=0;i<s;i++)e.push(this.K(t[i],n,null));return void this.C(n)}if(!n){const n=e.length<s?e.length:s;for(let s=0;s<n;s++)this.T(e[s],t[s]);if(s>e.length){const n=i.createDocumentFragment();for(let i=e.length;i<s;i++)e.push(this.K(t[i],n,null));this.C(n)}else if(s<e.length){const t=e[e.length-1];let n=this.U(e[s]);const i=null!==t.t?t.t.nextSibling:t.R.N.nextSibling;for(;n!==i;){const t=n.nextSibling;l.removeChild(n),n=t}e.length=s}return}if(e.length===s){let n=0;for(;n<s&&e[n].P===t[n].key;)this.T(e[n],t[n]),n++;if(n===s)return}const o=e,h=new Array(s);for(let n=0;n<s;n++)h[n]=t[n].key;const r=new Array(s);let c,u,f=0,_=o.length-1,a=0,p=s-1;const d=t=>t<s&&void 0!==r[t]?this.U(r[t]):this.N;for(;f<=_&&a<=p;)if(null===o[f])f++;else if(null===o[_])_--;else if(o[f].P===h[a])this.T(r[a]=o[f],t[a]),f++,a++;else if(o[_].P===h[p])this.T(r[p]=o[_],t[p]),_--,p--;else if(o[f].P===h[p]){const s=o[f];this.X(s,d(p+1)),this.T(s,t[p]),r[p]=s,f++,p--}else if(o[_].P===h[a]){const s=o[_];this.X(s,this.U(o[f])),this.T(s,t[a]),r[a]=s,_--,a++}else{if(void 0===c){c=new Map;for(let t=a;t<=p;t++)c.set(h[t],t);u=new Map;for(let t=f;t<=_;t++)null!==o[t]&&u.set(o[t].P,t)}if(c.has(o[f].P))if(c.has(o[_].P)){const s=u.get(h[a]);if(void 0===s)r[a]=this.K(t[a],l,this.U(o[f]));else{const n=o[s];this.X(n,this.U(o[f])),this.T(n,t[a]),r[a]=n,o[s]=null}a++}else this.Y(o[_]),_--;else this.Y(o[f]),f++}for(;a<=p;)r[a]=this.K(t[a],l,d(p+1)),a++;for(;f<=_;){const t=o[f++];null!==t&&this.Y(t)}this.Z=r}}const j=new WeakMap,I={},M=t=>(t.offset>0&&(t.node=t.node.splitText(t.offset),t.offset=0),t.node),g=new WeakMap,A=(t,s,n)=>{n.tt++;const e=n.st.i;if(3===t.nodeType){let i=!1;for(;n.nt<e.length&&e[n.nt].h===n.tt;)i=!0,n.nt++,W(s,n.et[n.it++],n.lt),S(n);return void(i||((t,s)=>{let n=s;for(;n.length>0;){const s=t.node;if(null===s||3!==s.nodeType)throw I;const e=s.data,i=e.length-t.offset;if(0===i){t.node=s.nextSibling,t.offset=0;continue}const l=i<n.length?i:n.length;if(e.slice(t.offset,t.offset+l)!==n.slice(0,l))throw I;n=n.slice(l),t.offset+=l,t.offset===e.length&&(t.node=s.nextSibling,t.offset=0)}})(s,t.data))}const i=M(s);if(null===i||1!==i.nodeType)throw I;if(i.localName!==t.localName)throw I;for(;n.nt<e.length&&e[n.nt].h===n.tt;){const t=e[n.nt++],s=new y(i,t.o,t.u);n.lt.push(s),n.it=s.p(n.et,n.it),S(n)}const l={parent:i,node:i.firstChild,offset:0};let o=t.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,l,n),o=o.nextSibling;if(null!==l.node&&(3!==l.node.nodeType||""!==l.node.data||null!==l.node.nextSibling))throw I;s.node=i.nextSibling,s.offset=0},S=t=>{const s=t.st.i;for(;t.nt<s.length&&2===s[t.nt].l;)t.lt.push(a),t.it++,t.nt++},W=(t,s,n)=>{const e=s?.$h,o=void 0!==e?e:s;if(null!=o&&"object"!=typeof o){const s=new k(((t,s)=>{const n=M(t);if(""===s){const s=i.createTextNode("");return t.parent.insertBefore(s,n),s}if(null===n||3!==n.nodeType)throw I;const e=n;if(e.data.length>s.length&&e.splitText(s.length),e.data!==s)throw I;return t.node=e.nextSibling,t.offset=0,e})(t,v(o)));return s.S=o,void n.push(s)}const h=l();t.parent.insertBefore(h,M(t));const r=new b(h,null);if(null==o);else if($(o))r.O=z(_(o),o.values,t),r.V=o.strings,r.F=2;else{const s=Array.isArray(o)?o:[...o],n=[];for(const e of s)n.push(L(t,e));r.Z=n,r.q=s.length>0&&void 0!==s[0]?.key,r.F=3}const c=l();t.parent.insertBefore(c,M(t)),r.N=c,n.push(r)},L=(t,s)=>{if(null!==s&&"object"==typeof s&&void 0!==s.strings){const n=s,e=_(n),i=e.t.content.firstChild;if(null!==i&&1===i.nodeType&&null===i.nextSibling){const s=M(t),i=z(e,n.values,t);return{P:n.key,t:s,O:i,V:n.strings,R:null}}const o=l();t.parent.insertBefore(o,M(t));const h=z(e,n.values,t),r=l();t.parent.insertBefore(r,M(t));const c=new b(o,r);return c.O=h,c.V=n.strings,c.F=2,{P:n.key,t:null,O:null,V:null,R:c}}const n=[];return W(t,s,n),{P:s?.key,t:null,O:null,V:null,R:n[0]}},z=(t,s,n)=>{const e=Object.create(w.prototype);e.i=[],e.I=i.createDocumentFragment();const l={st:t,et:s,it:0,nt:0,tt:-1,lt:e.i};S(l),(t=>{let s=g.get(t);if(void 0===s){let n;for(s=[],h.currentNode=t.t.content;null!==(n=h.nextNode());)s.push(n);g.set(t,s)}})(t);let o=t.t.content.firstChild;for(;null!==o;)1!==o.nodeType&&3!==o.nodeType||A(o,n,l),o=o.nextSibling;if(S(l),l.nt!==t.i.length)throw I;return e},E=(t,s)=>{if(!j.has(s)&&null!==s.firstChild&&null!==t&&"object"==typeof t&&$(t)){const n=((t,s)=>{let n=s.firstChild;for(;null!==n&&1===n.nodeType&&n.hasAttribute("vera-styles");)n=n.nextSibling;const e=l();s.insertBefore(e,n);try{const n={parent:s,node:e.nextSibling,offset:0},i=z(_(t),t.values,n);if(null!==n.node)throw I;const l=new b(e,null);return l.O=i,l.V=t.strings,l.F=2,l}catch(t){if(t!==I)throw t;return e.remove(),null}})(t,s);if(null!==n)return void j.set(s,n);(t=>{let s=t.firstChild;for(;null!==s;){const n=s.nextSibling;1===s.nodeType&&s.hasAttribute("vera-styles")||t.removeChild(s),s=n}})(s)}((t,s)=>{let n=j.get(s);if(void 0===n){const t=l();s.appendChild(t),j.set(s,n=new b(t,null))}n.L(t)})(t,s)};export{s as hold,t as keyed,E as render};
2
2
  //# sourceMappingURL=vera-renderer-hydrate.min.js.map