PageSourceSearch

https://goldcare.com/support.js

js goldcare.com collected 2026-09-28 10:16:24 UTC 69,150 bytes, 1,911 lines download raw bytes

1// GENERATED from dc-runtime/src/*.ts — do not edit. Rebuild with `cd dc-runtime && bun run build`.
2"use strict";
3(() => {
4  var __defProp = Object.defineProperty;
5  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
8  
8// src/react.ts
9  function getReact() {
10    const R = window.React;
11    if (!R) throw new Error("dc-runtime: window.React is not available yet");
12    return R;
13  }
14  function getReactDOM() {
15    const RD = window.ReactDOM;
16    if (!RD) throw new Error("dc-runtime: window.ReactDOM is not available yet");
17    return RD;
18  }
19  var h = ((...args) => getReact().createElement(
20    ...args
21  ));
22
23  
23// src/parse.ts
24  function parseDcDocument(doc) {
25    const dc = doc.querySelector("x-dc");
26    if (!dc) return null;
27    const scriptEl = doc.querySelector("script[data-dc-script]");
28    const { props, preview } = parseDataProps(
29      scriptEl?.getAttribute("data-props") ?? null
30    );
31    return {
32      template: dc.innerHTML,
33      js: scriptEl ? scriptEl.textContent || "" : "",
34      props,
35      preview
36    };
37  }
38  function parseDcText(src) {
39    const openMatch = /<x-dc(?:\s[^>]*)?>/.exec(src);
40    if (!openMatch) return null;
41    const close = src.lastIndexOf("</x-dc>");
42    if (close === -1 || close < openMatch.index) return null;
43    const template = src.slice(openMatch.index + openMatch[0].length, close);
44    const doc = new DOMParser().parseFromString(src, "text/html");
45    const scriptEl = doc.querySelector("script[data-dc-script]");
46    const { props, preview } = parseDataProps(
47      scriptEl?.getAttribute("data-props") ?? null
48    );
49    return {
50      template,
51      js: scriptEl ? scriptEl.textContent || "" : "",
52      props,
53      preview
54    };
55  }
56  function parseDataProps(raw) {
57    if (!raw) return { props: null, preview: null };
58    let parsed;
59    try {
60      parsed = JSON.parse(raw);
61    } catch {
62      return { props: null, preview: null };
63    }
64    if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
65      return { props: null, preview: null };
66    }
67    const obj = parsed;
68    const preview = obj.$preview && typeof obj.$preview === "object" ? obj.$preview : null;
69    const rest = {};
70    for (const k of Object.keys(obj)) {
71      if (k[0] !== "$") rest[k] = obj[k];
72    }
73    return { props: Object.keys(rest).length ? rest : null, preview };
74  }
75  function dcNameFromPath(pathname) {
76    let p = pathname || "";
77    try {
78      p = decodeURIComponent(p);
79    } catch {
80    }
81    const base = p.split("/").pop() || "Root";
82    return base.replace(/\.dc\.html$/, "").replace(/\.html?$/, "") || "Root";
83  }
84
85  
85// src/boot.ts
86  var BASE_CSS = `
87    .sc-placeholder{background:color-mix(in srgb,currentColor 8%,transparent);
88      border:1px solid color-mix(in srgb,currentColor 50%,transparent);
89      border-radius:2px;box-sizing:border-box;overflow:hidden}
90    @keyframes sc-shine{0%{background-position:100% 50%}100%{background-position:0% 50%}}
91    html.sc-dc-streaming .sc-placeholder,
92    html.sc-dc-streaming .sc-interp.sc-missing{position:relative;
93      background:color-mix(in srgb,currentColor 5%,transparent);
94      border-color:transparent}
95    html.sc-dc-streaming .sc-placeholder::before,
96    html.sc-dc-streaming .sc-interp.sc-missing::before{content:'';
97      position:absolute;inset:0;pointer-events:none;
98      background:linear-gradient(90deg,rgba(217,119,87,0) 25%,rgba(247,225,211,.95) 37%,rgba(217,119,87,0) 63%);
99      background-size:400% 100%;animation:sc-shine 1.4s ease infinite}
100    html.sc-dc-streaming .sc-placeholder:nth-child(n+9 of .sc-placeholder)::before,
101    html.sc-dc-streaming .sc-interp.sc-missing:nth-child(n+9 of .sc-interp.sc-missing)::before{animation:none;
102      background:color-mix(in srgb,currentColor 8%,transparent)}
103    .sc-placeholder-error{padding:4px 8px;font:11px/1.4 ui-monospace,monospace;
104      color:color-mix(in srgb,currentColor 70%,transparent);word-break:break-word}
105    .sc-interp.sc-missing{display:inline-block;width:2em;height:1em;overflow:hidden;
106      vertical-align:text-bottom;background:rgba(255,255,255,.3);border:1px solid rgba(0,0,0,.5);
107      border-radius:2px;box-sizing:border-box;color:transparent;
108      user-select:none}
109    .sc-interp.sc-unresolved{font-family:ui-monospace,monospace;font-size:.85em;
110      color:color-mix(in srgb,currentColor 50%,transparent);
111      background:color-mix(in srgb,currentColor 10%,transparent);border-radius:3px;
112      padding:0 3px}
113    .sc-host.sc-has-error{position:relative}
114    .sc-logic-error{position:absolute;top:8px;left:8px;z-index:2147483647;max-width:60ch;
115      padding:6px 10px;background:#b00020;color:#fff;font:12px/1.4 ui-monospace,monospace;
116      border-radius:4px;white-space:pre-wrap;pointer-events:none}
117    /* Mirrors PRINT_BASELINE_CSS in apps/web deck-stage-export.ts \u2014 keep both
118       in sync until dc-runtime regains a build step. */
119    @media print {
120      @page { margin: 0.5cm; }
121      figure, table { break-inside: avoid; }
122      #dc-root, #dc-root > .sc-host { height: auto; }
123      *, *::before, *::after {
124        print-color-adjust: exact; -webkit-print-color-adjust: exact;
125        backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
126        animation-delay: -99s !important; animation-duration: .001s !important;
127        animation-iteration-count: 1 !important; animation-fill-mode: both !important;
128        animation-play-state: running !important; transition-duration: 0s !important;
129      }
130    }
131  `;
132  var FULL_PAGE_CSS = "html,body{height:100%;margin:0}#dc-root,#dc-root>.sc-host{height:100%}";
133  function rootNameForDocument(doc, loc) {
134    let bootPath = loc.pathname || "";
135    if (!/\.dc\.html?$/i.test(safeDecode(bootPath))) {
136      try {
137        bootPath = new URL(doc.baseURI || "/").pathname;
138      } catch {
139      }
140    }
141    return dcNameFromPath(bootPath);
142  }
143  function safeDecode(s) {
144    try {
145      return decodeURIComponent(s);
146    } catch {
147      return s;
148    }
149  }
150  function boot(runtime, doc = document) {
151    const parsed = parseDcDocument(doc);
152    if (!parsed) return null;
153    const React = getReact();
154    const rootName = rootNameForDocument(doc, location);
155    runtime.markFetched(rootName);
156    runtime.setRootName(rootName);
157    runtime.adoptParsed(rootName, parsed);
158    if (!window.__resources) {
159      fetch(location.href).then((res) => res.ok ? res.text() : "").then((t) => {
160        const raw = t ? parseDcText(t) : null;
161        if (raw?.template) runtime.updateHtml(rootName, raw.template);
162      }).catch(() => {
163      });
164    }
165    const dc = doc.querySelector("x-dc");
166    const hostEl = doc.createElement("div");
167    hostEl.id = "dc-root";
168    dc.replaceWith(hostEl);
169    if (!parsed.preview) {
170      const s = doc.createElement("style");
171      s.textContent = FULL_PAGE_CSS;
172      doc.head.appendChild(s);
173    }
174    const Root = runtime.getDC(rootName);
175    const entry = runtime.registry.get(rootName);
176    function StandaloneRoot() {
177      const [, setTick] = React.useState(0);
178      React.useEffect(() => {
179        const sub = () => setTick((n) => n + 1);
180        entry.subs.add(sub);
181        return () => {
182          entry.subs.delete(sub);
183        };
184      }, []);
185      const defaults = React.useMemo(() => {
186        const d = {};
187        for (const k in entry.propsMeta || {}) {
188          const v = entry.propsMeta?.[k]?.default;
189          if (v !== void 0) d[k] = v;
190        }
191        return d;
192      }, [entry.propsMeta]);
193      return h(Root, { ...defaults, ...entry.propOverrides || {} });
194    }
195    const ReactDOM = getReactDOM();
196    if (ReactDOM.createRoot)
197      ReactDOM.createRoot(hostEl).render(h(StandaloneRoot));
198    else ReactDOM.render(h(StandaloneRoot), hostEl);
199    return rootName;
200  }
201
202  
202// src/expr.ts
203  var IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*/;
204  var NUMBER_RE = /^-?\d+(\.\d+)?$/;
205  function resolve(vals, src) {
206    const expr = String(src).trim();
207    if (!expr) return void 0;
208    if (expr[0] === "(" && expr[expr.length - 1] === ")" && parensWrapWhole(expr)) {
209      return resolve(vals, expr.slice(1, -1));
210    }
211    const eq = findTopLevelEquality(expr);
212    if (eq) {
213      const lv = resolve(vals, expr.slice(0, eq.index));
214      const rv = resolve(vals, expr.slice(eq.index + eq.op.length));
215      switch (eq.op) {
216        case "===":
217          return lv === rv;
218        case "!==":
219          return lv !== rv;
220        case "==":
221          return lv == rv;
222        default:
223          return lv != rv;
224      }
225    }
226    if (expr[0] === "!") return !resolve(vals, expr.slice(1));
227    if (expr === "true") return true;
228    if (expr === "false") return false;
229    if (expr === "null") return null;
230    if (expr === "undefined") return void 0;
231    if (NUMBER_RE.test(expr)) return Number(expr);
232    if (expr.length >= 2 && (expr[0] === '"' || expr[0] === "'") && expr[expr.length - 1] === expr[0]) {
233      return expr.slice(1, -1);
234    }
235    return resolvePath(vals, expr);
236  }
237  function parensWrapWhole(expr) {
238    let depth = 0;
239    for (let i = 0; i < expr.length - 1; i++) {
240      if (expr[i] === "(") depth++;
241      else if (expr[i] === ")") {
242        depth--;
243        if (depth === 0) return false;
244      }
245    }
246    return true;
247  }
248  function findTopLevelEquality(expr) {
249    let depth = 0;
250    for (let i = 0; i < expr.length; i++) {
251      const c = expr[i];
252      if (c === "[" || c === "(") depth++;
253      else if (c === "]" || c === ")") depth--;
254      else if (depth === 0 && (c === "=" || c === "!") && expr[i + 1] === "=") {
255        if (i > 0 && (expr[i - 1] === "=" || expr[i - 1] === "!")) continue;
256        if (!expr.slice(0, i).trim()) continue;
257        const op = expr[i + 2] === "=" ? c + "==" : c + "=";
258        return { index: i, op };
259      }
260    }
261    return null;
262  }
263  function resolvePath(vals, expr) {
264    const head = expr.match(IDENT_RE);
265    if (!head) return void 0;
266    let cur = vals == null ? void 0 : vals[head[0]];
267    let i = head[0].length;
268    while (i < expr.length) {
269      if (expr[i] === ".") {
270        const m = expr.slice(i + 1).match(IDENT_RE) || expr.slice(i + 1).match(/^\d+/);
271        if (!m) return void 0;
272        cur = cur == null ? void 0 : cur[m[0]];
273        i += 1 + m[0].length;
274      } else if (expr[i] === "[") {
275        let depth = 1;
276        let j = i + 1;
277        while (j < expr.length && depth > 0) {
278          if (expr[j] === "[") depth++;
279          else if (expr[j] === "]") {
280            depth--;
281            if (depth === 0) break;
282          }
283          j++;
284        }
285        if (depth !== 0) return void 0;
286        const key = resolve(vals, expr.slice(i + 1, j));
287        cur = cur == null ? void 0 : cur[key];
288        i = j + 1;
289      } else {
290        return void 0;
291      }
292    }
293    return cur;
294  }
295
296  
296// src/encode.ts
297  var CAMEL_ATTR = "sc-camel-";
298  var INLINE_TEXT_TAGS = new Set(
299    "a abbr b bdi bdo br cite code del dfn em i ins kbd mark q s samp small span strike strong sub sup u var wbr".split(
300      " "
301    )
302  );
303  var RAW_WRAP = {
304    select: "sc-raw-select",
305    table: "sc-raw-table",
306    tbody: "sc-raw-tbody",
307    thead: "sc-raw-thead",
308    tfoot: "sc-raw-tfoot",
309    tr: "sc-raw-tr",
310    td: "sc-raw-td",
311    th: "sc-raw-th",
312    caption: "sc-raw-caption"
313  };
314  var RAW_UNWRAP = Object.fromEntries(
315    Object.entries(RAW_WRAP).map(([k, v]) => [v, k])
316  );
317  var EVENT_MAP = {
318    onclick: "onClick",
319    onchange: "onChange",
320    oninput: "onInput",
321    onsubmit: "onSubmit",
322    onkeydown: "onKeyDown",
323    onkeyup: "onKeyUp",
324    onkeypress: "onKeyPress",
325    onmousedown: "onMouseDown",
326    onmouseup: "onMouseUp",
327    onmouseenter: "onMouseEnter",
328    onmouseleave: "onMouseLeave",
329    onfocus: "onFocus",
330    onblur: "onBlur",
331    ondoubleclick: "onDoubleClick",
332    oncontextmenu: "onContextMenu",
333    onmousemove: "onMouseMove",
334    onmouseover: "onMouseOver",
335    onmouseout: "onMouseOut",
336    onpointerdown: "onPointerDown",
337    onpointerup: "onPointerUp",
338    onpointermove: "onPointerMove",
339    onpointerenter: "onPointerEnter",
340    onpointerleave: "onPointerLeave",
341    onpointercancel: "onPointerCancel",
342    onpointerover: "onPointerOver",
343    onpointerout: "onPointerOut",
344    ongotpointercapture: "onGotPointerCapture",
345    onlostpointercapture: "onLostPointerCapture",
346    ontouchstart: "onTouchStart",
347    ontouchend: "onTouchEnd",
348    ontouchmove: "onTouchMove",
349    ontouchcancel: "onTouchCancel",
350    ondragstart: "onDragStart",
351    ondragend: "onDragEnd",
352    ondragenter: "onDragEnter",
353    ondragleave: "onDragLeave",
354    ondragover: "onDragOver",
355    onanimationstart: "onAnimationStart",
356    onanimationend: "onAnimationEnd",
357    onanimationiteration: "onAnimationIteration",
358    ontransitionend: "onTransitionEnd"
359  };
360  var ATTRS = `(?:[^>"']|"[^"]*"|'[^']*')*`;
361  var IMPORT_SELF_CLOSE_RE = new RegExp(
362    "<(x-import|dc-import)(" + ATTRS + ")/>",
363    "gi"
364  );
365  var CAMEL_ATTR_RE = /(\s)([a-z]+[A-Z][A-Za-z0-9]*)(\s*=)/g;
366  function encodeCamelAttrs(html) {
367    return html.replace(
368      CAMEL_ATTR_RE,
369      (_, sp, name, eq) => sp + CAMEL_ATTR + name.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase()) + eq
370    );
371  }
372  function encodeCase(html) {
373    html = html.replace(
374      IMPORT_SELF_CLOSE_RE,
375      (_, t, a) => "<" + t + a + "></" + t + ">"
376    );
377    html = html.replace(/<helmet(\s|>)/gi, "<sc-helmet$1");
378    html = html.replace(/<\/helmet\s*>/gi, "</sc-helmet>");
379    html = encodeCamelAttrs(html);
380    for (const [real, alias] of Object.entries(RAW_WRAP)) {
381      html = html.replace(
382        new RegExp("(</?)" + real + "(?=[\\s>])", "gi"),
383        "$1" + alias
384      );
385    }
386    return html;
387  }
388  function kebabToCamel(s) {
389    return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
390  }
391  function cssToObj(css) {
392    const o = {};
393    for (const decl of css.split(";")) {
394      const i = decl.indexOf(":");
395      if (i < 0) continue;
396      const prop = decl.slice(0, i).trim();
397      o[prop.startsWith("--") ? prop : kebabToCamel(prop)] = decl.slice(i + 1).trim();
398    }
399    return o;
400  }
401  function compileAttr(raw) {
402    const whole = raw.match(/^\s*\{\{([\s\S]+?)\}\}\s*$/);
403    if (whole) {
404      const path = whole[1];
405      return (vals) => resolve(vals, path);
406    }
407    if (raw.includes("{{")) {
408      const parts = raw.split(/\{\{([\s\S]+?)\}\}/g);
409      return (vals) => parts.map((s, i) => i & 1 ? resolve(vals, s) ?? "" : s).join("");
410    }
411    return () => raw;
412  }
413
414  
414// src/compile.ts
415  function collectProps(node, kind, host) {
416    const propGetters = [];
417    const pseudoClasses = [];
418    let hintSize = null;
419    for (const { name, value } of [...node.attributes]) {
420      if (name === "sc-name" || name === "data-dc-tpl") continue;
421      let key = name;
422      if (key.startsWith(CAMEL_ATTR))
423        key = kebabToCamel(key.slice(CAMEL_ATTR.length));
424      if (key === "hint-size") {
425        hintSize = value;
426        continue;
427      }
428      if (key.startsWith("style-")) {
429        pseudoClasses.push(host.pseudoClass(key.slice(6), value));
430        continue;
431      }
432      if (kind !== "dom") {
433        if (key.includes("-") && !(kind === "x-import" && (key.startsWith("aria-") || key.startsWith("data-"))))
434          key = kebabToCamel(key);
435      } else {
436        if (key === "class") key = "className";
437        else if (key === "for") key = "htmlFor";
438        else if (key.startsWith("on"))
439          key = EVENT_MAP[key] || "on" + key[2].toUpperCase() + key.slice(3);
440      }
441      propGetters.push([key, compileAttr(value)]);
442    }
443    return { propGetters, pseudoClasses, hintSize };
444  }
445  var HOST_STYLE_PROPS = /* @__PURE__ */ new Set([
446    "position",
447    "left",
448    "right",
449    "top",
450    "bottom",
451    "inset",
452    "width",
453    "height",
454    "z-index",
455    "transform"
456  ]);
457  function hostPositionStyle(style) {
458    const all = typeof style === "string" ? cssToObj(style) : style != null && typeof style === "object" ? style : null;
459    if (!all) return void 0;
460    const out = {};
461    for (const [k, v] of Object.entries(all)) {
462      const kebab = k.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase());
463      if (HOST_STYLE_PROPS.has(kebab)) out[k] = v;
464    }
465    return Object.keys(out).length ? out : void 0;
466  }
467  function compileTemplate(html, host) {
468    const tpl = document.createElement("template");
469    //! nosemgrep: direct-inner-html-assignment
470    tpl.innerHTML = encodeCase(html);
471    let tplN = 0;
472    (function stamp(node) {
473      if (node.nodeType === Node.ELEMENT_NODE) {
474        node.setAttribute("data-dc-tpl", String(tplN++));
475      }
476      for (const c of node.childNodes) stamp(c);
477    })(tpl.content);
478    const builders = walkChildren(tpl.content, host);
479    const render = ((vals, ctx) => builders.map((b, i) => b(vals || {}, ctx, i)));
480    render.__annotated = tpl.innerHTML;
481    return render;
482  }
483  function walkChildren(node, host) {
484    return [...node.childNodes].map((c) => walk(c, host)).filter((b) => b != null);
485  }
486  var SLIDE_ID_VALUE_RE = /^[0-9a-f]{8}$/;
487  var DECK_CONTROL_FLOW_RE = /^(sc-if|sc-for|sc-else|dc-import|x-import)$/;
488  var DECK_AUX_RE = /^(template|script|style|sc-helmet|helmet)$/;
489  function isDeckMountTag(el) {
490    if (el.localName === "deck-stage") return true;
491    return el.localName === "x-import" && (el.getAttribute("component-from-global-scope") || "") === "deck-stage";
492  }
493  function walkDeckChildren(el, host) {
494    const pairs = [...el.childNodes].map((c) => ({ c, b: walk(c, host) })).filter((p) => p.b !== null);
495    const kids = pairs.map((p) => p.b);
496    const seen = /* @__PURE__ */ new Set();
497    const wsSeen = /* @__PURE__ */ new Map();
498    const keys = [];
499    const nextSlideId = new Array(pairs.length);
500    {
501      let upcoming = null;
502      for (let j = pairs.length - 1; j >= 0; j--) {
503        const n = pairs[j].c;
504        if (n.nodeType === Node.ELEMENT_NODE) {
505          const t = n.localName;
506          upcoming = !DECK_AUX_RE.test(t) && !DECK_CONTROL_FLOW_RE.test(t) ? n.getAttribute("data-om-slide-id") : null;
507        }
508        nextSlideId[j] = upcoming;
509      }
510    }
511    for (let j = 0; j < pairs.length; j++) {
512      const { c } = pairs[j];
513      if (c.nodeType === Node.TEXT_NODE) {
514        if ((c.nodeValue ?? "").trim() === "") {
515          const base = nextSlideId[j] ? "omid-ws:" + nextSlideId[j] : "omid-ws:aux";
516          const n = wsSeen.get(base) ?? 0;
517          wsSeen.set(base, n + 1);
518          keys.push(n === 0 ? base : base + ":" + n);
519          continue;
520        }
521        return { kids, keys: null };
522      }
523      if (c.nodeType !== Node.ELEMENT_NODE) {
524        keys.push(j);
525        continue;
526      }
527      const child = c;
528      const tag = child.localName;
529      if (DECK_AUX_RE.test(tag)) {
530        keys.push(j);
531        continue;
532      }
533      if (DECK_CONTROL_FLOW_RE.test(tag)) return { kids, keys: null };
534      const v = child.getAttribute("data-om-slide-id");
535      if (!v || !SLIDE_ID_VALUE_RE.test(v) || seen.has(v)) {
536        return { kids, keys: null };
537      }
538      seen.add(v);
539      keys.push("omid:" + v);
540    }
541    return { kids, keys };
542  }
543  function renderDeckKids(kids, kidKeys, vals, ctx) {
544    return kids.map((b, j) => {
545      const k = kidKeys ? kidKeys[j] : j;
546      const out = b(vals, ctx, k);
547      return kidKeys != null && typeof out === "string" ? h(getReact().Fragment, { key: k }, out) : out;
548    });
549  }
550  function walk(node, host) {
551    if (node.nodeType === Node.TEXT_NODE) return walkText(node);
552    if (node.nodeType !== Node.ELEMENT_NODE) return null;
553    const el = node;
554    const tag = el.tagName.toLowerCase();
555    if (tag === "sc-for") return walkFor(el, host);
556    if (tag === "sc-if") return walkIf(el, host);
557    if (tag === "x-import") return walkXImport(el, host);
558    if (tag === "sc-helmet") return host.helmet(el);
559    if (tag === "dc-import") return walkComponent(el, host);
560    return walkElement(el, host);
561  }
562  var warnedHoles = /* @__PURE__ */ new Set();
563  function warnUnresolved(ctx, what) {
564    const key = (ctx?.__name || "?") + "\0" + what;
565    if (warnedHoles.has(key)) return;
566    warnedHoles.add(key);
567    console.warn("[dc-runtime] " + (ctx?.__name || "template") + ": " + what);
568  }
569  function walkText(node) {
570    const txt = node.nodeValue ?? "";
571    if (!txt.includes("{{")) {
572      if (!txt.trim() && !txt.includes(" ")) return null;
573      return () => txt;
574    }
575    const parts = txt.split(/\{\{([\s\S]+?)\}\}/g);
576    return (vals, ctx, key) => h(
577      getReact().Fragment,
578      { key },
579      ...parts.map((p, i) => {
580        if (!(i & 1)) return p;
581        const v = resolve(vals, p);
582        if (v === void 0) {
583          if (!ctx?.__streamingNow) {
584            if (document.body?.hasAttribute("data-dc-editor-on")) {
585              return h(
586                "span",
587                { key: i, className: "sc-interp sc-unresolved" },
588                "{{ " + p.trim() + " }}"
589              );
590            }
591            warnUnresolved(
592              ctx,
593              "{{ " + p.trim() + " }} never resolved \u2014 rendered as empty"
594            );
595            return null;
596          }
597          return h(
598            "span",
599            { key: i, className: "sc-interp sc-missing" },
600            p.trim()
601          );
602        }
603        if (getReact().isValidElement(v) || Array.isArray(v)) {
604          return h(getReact().Fragment, { key: i }, v);
605        }
606        if (v === null || typeof v === "boolean") return null;
607        return h("span", { key: i, className: "sc-interp" }, String(v));
608      })
609    );
610  }
611  function walkFor(el, host) {
612    const listGet = compileAttr(el.getAttribute("list") || "");
613    const asName = el.getAttribute("as") || "item";
614    const hintN = parseInt(el.getAttribute("hint-placeholder-count") || "0", 10);
615    const kids = walkChildren(el, host);
616    const listSrc = el.getAttribute("list") || "";
617    return (vals, ctx, key) => {
618      let list = listGet(vals);
619      if (!Array.isArray(list)) {
620        if (!ctx?.__streamingNow) {
621          if (list !== void 0 && list !== null) {
622            warnUnresolved(
623              ctx,
624              'sc-for list="' + listSrc + '" is not an array (' + typeof list + ")"
625            );
626          }
627          list = [];
628        } else {
629          list = hintN > 0 ? Array(hintN).fill(void 0) : [];
630        }
631      }
632      return h(
633        getReact().Fragment,
634        { key },
635        list.map((item, i) => {
636          const sub = { ...vals, [asName]: item, $index: i };
637          return h(
638            getReact().Fragment,
639            { key: i },
640            kids.map((b, j) => b(sub, ctx, j))
641          );
642        })
643      );
644    };
645  }
646  function walkIf(el, host) {
647    const valGet = compileAttr(el.getAttribute("value") || "");
648    const hintRaw = el.getAttribute("hint-placeholder-val");
649    const hintGet = hintRaw != null ? compileAttr(hintRaw) : null;
650    const kids = walkChildren(el, host);
651    return (vals, ctx, key) => {
652      let v = valGet(vals);
653      if (v === void 0 && hintGet && ctx?.__streamingNow) v = hintGet(vals);
654      return v ? h(
655        getReact().Fragment,
656        { key },
657        kids.map((b, j) => b(vals, ctx, j))
658      ) : null;
659    };
660  }
661  function walkComponent(el, host) {
662    const name = el.getAttribute("name") || el.getAttribute("component") || "";
663    el.removeAttribute("name");
664    el.removeAttribute("component");
665    const tplId = el.getAttribute("data-dc-tpl");
666    const styleRaw = el.getAttribute("style");
667    el.removeAttribute("style");
668    const styleGet = styleRaw != null ? compileAttr(styleRaw) : null;
669    const { propGetters, hintSize } = collectProps(el, "dc-import", host);
670    const kids = walkChildren(el, host);
671    return (vals, ctx, key) => {
672      const props = {
673        key,
674        __hintSize: hintSize,
675        __tplId: tplId,
676        __hostStyle: styleGet ? hostPositionStyle(styleGet(vals)) : void 0
677      };
678      for (const [k, g] of propGetters) {
679        const v = g(vals);
680        if (k === "dcProps") {
681          if (v && typeof v === "object") Object.assign(props, v);
682          continue;
683        }
684        props[k] = v;
685      }
686      if (kids.length) props.children = kids.map((b, j) => b(vals, ctx, j));
687      return h(host.component(name), props);
688    };
689  }
690  function walkXImport(el, host) {
691    const globalNameGet = compileAttr(
692      el.getAttribute("component-from-global-scope") || ""
693    );
694    const exportNameGet = compileAttr(
695      el.getAttribute("component") || el.getAttribute("name") || ""
696    );
697    const fromRaw = el.getAttribute("from") || (el.getAttribute("component-from-global-scope") ? "" : el.getAttribute("src") || el.getAttribute("import") || "");
698    const urls = fromRaw.trim() ? fromRaw.trim().split(/\s+/) : [];
699    const url = urls.length ? urls[urls.length - 1] : "";
700    const kindOf = (u) => /\.(jsx|tsx)(\?|#|$)/i.test(u) ? "jsx" : "js";
701    const tplId = el.getAttribute("data-dc-tpl");
702    const styleRaw = el.getAttribute("style");
703    el.removeAttribute("style");
704    const styleGet = styleRaw != null ? compileAttr(styleRaw) : null;
705    const wrap = tplId != null || styleGet != null;
706    const { propGetters, hintSize } = collectProps(el, "x-import", host);
707    const hasContent = el.children.length > 0 || !!(el.textContent || "").trim();
708    const deckKeyed = hasContent && isDeckMountTag(el) ? walkDeckChildren(el, host) : null;
709    const kids = deckKeyed ? deckKeyed.kids : hasContent ? walkChildren(el, host) : [];
710    const kidKeys = deckKeyed?.keys ?? null;
711    const urlBindable = fromRaw.includes("{{");
712    if (urls.length && !urlBindable) {
713      let prev;
714      for (const u of urls) prev = host.loadExternal(kindOf(u), u, prev);
715    }
716    const evalName = (g, vals) => {
717      const v = g(vals);
718      const s = v == null ? "" : String(v);
719      return s.includes("{{") ? "" : s;
720    };
721    return (vals, ctx, key) => {
722      const globalName = evalName(globalNameGet, vals);
723      const name = globalName || evalName(exportNameGet, vals);
724      const C = !name || urlBindable ? null : globalName ? host.resolveExternalGlobal(url, globalName) : host.resolveExternal(url, name);
725      const hostStyle = styleGet ? hostPositionStyle(styleGet(vals)) : void 0;
726      const wrapper = wrap ? {
727        key,
728        className: "sc-host-x",
729        "data-dc-tpl": tplId,
730        style: hostStyle || { display: "contents" }
731      } : null;
732      if (!C) {
733        const error = urlBindable ? "x-import `from` cannot contain {{ \u2026 }} \u2014 module URLs are resolved at parse time; use a literal URL" : host.resolveExternalError(url, name);
734        const ph = host.placeholder({
735          key: wrapper ? void 0 : key,
736          name,
737          hintSize,
738          error
739        });
740        return wrapper ? h("div", wrapper, ph) : ph;
741      }
742      const props = wrapper ? {} : { key };
743      let unresolvedHole = false;
744      for (const [k, g] of propGetters) {
745        if (k === "component" || k === "componentFromGlobalScope" || k === "from") {
746          continue;
747        }
748        const v = g(vals);
749        if (v === void 0) unresolvedHole = true;
750        if (k === "dcProps") {
751          if (v && typeof v === "object") Object.assign(props, v);
752          continue;
753        }
754        props[k] = v;
755      }
756      if (unresolvedHole && ctx?.__htmlStreamingNow) {
757        const ph = host.placeholder({
758          key: wrapper ? void 0 : key,
759          name,
760          hintSize,
761          error: null
762        });
763        return wrapper ? h("div", wrapper, ph) : ph;
764      }
765      if (kids.length) {
766        props.children = renderDeckKids(kids, kidKeys, vals, ctx);
767      }
768      return wrapper ? h("div", wrapper, h(C, props)) : h(C, props);
769    };
770  }
771  function contentKey(el) {
772    const clone = el.cloneNode(true);
773    for (const d of clone.querySelectorAll("*")) {
774      while (d.attributes.length) d.removeAttribute(d.attributes[0].name);
775    }
776    const s = clone.innerHTML;
777    let h2 = 5381;
778    for (let i = 0; i < s.length;
778 i++) h2 = (h2 << 5) + h2 + s.charCodeAt(i) | 0;
779    return s.length + "." + (h2 >>> 0).toString(36);
780  }
781  var NEVER_CONTENT_KEYED = new Set(
782    "script style textarea option title select canvas iframe video audio".split(
783      " "
784    )
785  );
786  var NOT_INLINE_SELECTOR = ":not(" + [...INLINE_TEXT_TAGS].join(",") + ")";
787  function walkElement(el, host) {
788    const realTag = RAW_UNWRAP[el.localName] || el.localName;
789    const tplId = el.getAttribute("data-dc-tpl");
790    const inlineOnly = el.childNodes.length > 0 && !NEVER_CONTENT_KEYED.has(realTag) && el.querySelector(NOT_INLINE_SELECTOR) === null;
791    const keySuffix = inlineOnly ? "|" + contentKey(el) : "";
792    const { propGetters, pseudoClasses } = collectProps(el, "dom", host);
793    const deckKeyed = isDeckMountTag(el) ? walkDeckChildren(el, host) : null;
794    const kids = deckKeyed ? deckKeyed.kids : walkChildren(el, host);
795    const kidKeys = deckKeyed?.keys ?? null;
796    return (vals, ctx, key) => {
797      const props = {
798        key: key + keySuffix,
799        "data-dc-tpl": tplId
800      };
801      for (const [k, g] of propGetters) {
802        let v = g(vals);
803        if (k === "style" && typeof v === "string") v = cssToObj(v);
804        if ((k === "value" || k === "checked") && v === void 0) {
805          v = k === "checked" ? false : "";
806        }
807        props[k] = v;
808      }
809      if (pseudoClasses.length) {
810        props.className = [props.className, ...pseudoClasses].filter(Boolean).join(" ");
811      }
812      return h(realTag, props, ...renderDeckKids(kids, kidKeys, vals, ctx));
813    };
814  }
815
816  
816// src/logic.ts
817  var StreamableLogic = class {
818    constructor(props) {
819      __publicField(this, "props");
820      __publicField(this, "state", {});
821      /** Back-pointer to the wrapper component, installed after construction. */
822      __publicField(this, "__host");
823      this.props = props || {};
824    }
825    setState(update, cb) {
826      this.__host && this.__host.__setLogicState(update, cb);
827    }
828    forceUpdate() {
829      this.__host && this.__host.forceUpdate();
830    }
831    componentDidMount() {
832    }
833    componentDidUpdate(_prevProps) {
834    }
835    componentWillUnmount() {
836    }
837    /** The flat object the template renders against (merged over props). */
838    renderVals() {
839      return {};
840    }
841  };
842  function evalDcLogic(src) {
843    //! nosemgrep: eval-and-function-constructor
844    const fn = new Function(
845      "DCLogic",
846      "StreamableLogic",
847      "React",
848      src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
849    );
850    return fn(StreamableLogic, StreamableLogic, getReact());
851  }
852
853  
853// src/component.ts
854  function shallowEqual(a, b) {
855    if (!b) return false;
856    const ak = Object.keys(a).filter((k) => k !== "children");
857    const bk = Object.keys(b).filter((k) => k !== "children");
858    if (ak.length !== bk.length) return false;
859    for (const k of ak) if (a[k] !== b[k]) return false;
860    return true;
861  }
862  function Placeholder({
863    name,
864    hintSize,
865    streaming,
866    error
867  }) {
868    const [w, hgt] = (hintSize || "100%,60px").split(",");
869    return h(
870      "div",
871      {
872        className: "sc-placeholder" + (streaming ? " sc-streaming" : ""),
873        style: { width: w.trim(), height: hgt && hgt.trim() },
874        title: name
875      },
876      error ? h(
877        "div",
878        { className: "sc-placeholder-error" },
879        (name ? name + ": " : "") + error
880      ) : null
881    );
882  }
883  function hintToMin(hint) {
884    if (!hint) return void 0;
885    const [w, hgt] = hint.split(",");
886    return { minWidth: w.trim(), minHeight: hgt && hgt.trim() };
887  }
888  function createComponentFactory(registry, ensureFetched) {
889    const React = getReact();
890    const AncestorContext = React.createContext([]);
891    class StreamableComponent extends React.Component {
892      constructor(props) {
893        super(props);
894        __publicField(this, "__name");
895        __publicField(this, "__sub");
896        __publicField(this, "__needsDidMount", false);
897        /** Snapshot of the registry's streaming flags taken at render time —
898         *  builders read it off the RenderCtx (this) to pick placeholder vs
899         *  render-nothing for unresolved values. */
900        __publicField(this, "__streamingNow", false);
901        __publicField(this, "__htmlStreamingNow", false);
902        /** When a construct throws, remember the (class, registry.ver, props)
903         *  triple so render-time reconcile doesn't re-attempt it on every parent
904         *  re-render. A registry bump (new class, template, external module
905         *  resolving via bumpAll) changes `ver` and breaks the memo so an
906         *  env-dependent constructor can self-heal. */
907        __publicField(this, "__failedLogic", null);
908        __publicField(this, "__failedUserProps", null);
909        __publicField(this, "__failedVer", -1);
910        /** Per-instance constructor error — kept here (not on the registry entry)
911         *  so one instance's successful construct can't hide a sibling's failure,
912         *  and a construct can never wipe an eval error `updateJs` recorded on
913         *  `r.logicError`. */
914        __publicField(this, "__ctorError", null);
915        __publicField(this, "logic");
916        this.__name = props.__name;
917        this.state = { __v: 0, __err: null };
918        this.__sub = () => {
919          if (this.state.__err) this.setState({ __err: null });
920          this.forceUpdate();
921        };
922        this.__makeLogic(registry.get(this.__name).Logic, null);
923        ensureFetched(this.__name);
924      }
925      /** Error-boundary hook: a render crash anywhere in this DC's subtree
926       *  (its own template, an x-import'd component, a child DC without its
927       *  own deeper boundary) lands here instead of unmounting the page. */
928      static getDerivedStateFromError(e) {
929        return { __err: e instanceof Error && e.message ? e.message : String(e) };
930      }
931      componentDidCatch(e, info) {
932        console.error(
933          "[dc-runtime] render error in <" + this.__name + ">:",
934          e,
935          info?.componentStack || ""
936        );
937      }
938      /** Instantiate the logic class (or the no-op base) and adopt `prevState`
939       *  over its initial state — used both at mount and on hot-swap. */
940      __makeLogic(Logic, prevState) {
941        const L = Logic || StreamableLogic;
942        try {
943          this.logic = new L(this.__userProps());
944          this.__failedLogic = null;
945          this.__failedUserProps = null;
946          this.__ctorError = null;
947        } catch (e) {
948          console.error(e);
949          this.__failedLogic = Logic;
950          this.__failedUserProps = this.__userProps();
951          this.__failedVer = registry.get(this.__name).ver;
952          this.__ctorError = this.__name + ": " + (e instanceof Error && e.message ? e.message : 
952String(e));
953          this.logic = new StreamableLogic(
954            this.__userProps()
955          );
956        }
957        this.logic.__host = this;
958        if (prevState)
959          this.logic.state = { ...this.logic.state || {}, ...prevState };
960      }
961      /** The props the author's logic + template see — internal __-prefixed
962       *  wiring stripped. */
963      __userProps() {
964        const { __name, __hintSize, __tplId, __hostStyle, ...rest } = this.props;
965        return rest;
966      }
967      __setLogicState(update, cb) {
968        const prev = this.logic.state;
969        const patch = typeof update === "function" ? update(prev) : update;
970        this.logic.state = { ...prev, ...patch };
971        this.setState((s) => ({ __v: s.__v + 1 }), cb);
972      }
973      /** Swap the logic instance when the registry's Logic class changed
974       *  (streaming completion, hot reload). State carries over; didMount
975       *  re-fires after the swap commits so refs exist. */
976      __reconcileLogic() {
977        const r = registry.get(this.__name);
978        const Next = r.Logic;
979        const Cur = this.logic.constructor;
980        if (Next === Cur || !Next && Cur === StreamableLogic || Next === this.__failedLogic && r.ver === this.__failedVer && shallowEqual(this.__userProps(), this.__failedUserProps)) {
981          return;
982        }
983        if (!this.__needsDidMount) {
984          try {
985            this.logic.componentWillUnmount();
986          } catch (e) {
987            console.error(e);
988          }
989        }
990        this.__makeLogic(Next, this.logic.state);
991        this.__needsDidMount = true;
992      }
993      componentDidMount() {
994        registry.get(this.__name).subs.add(this.__sub);
995        try {
996          this.logic.componentDidMount();
997        } catch (e) {
998          console.error(e);
999        }
1000      }
1001      componentDidUpdate(prevProps) {
1002        this.logic.props = this.__userProps();
1003        if (this.__needsDidMount) {
1004          if (this.state.__err || !registry.get(this.__name).tpl) return;
1005          this.__needsDidMount = false;
1006          try {
1007            this.logic.componentDidMount();
1008          } catch (e) {
1009            console.error(e);
1010          }
1011        } else {
1012          try {
1013            this.logic.componentDidUpdate(prevProps);
1014          } catch (e) {
1015            console.error(e);
1016          }
1017        }
1018      }
1019      componentWillUnmount() {
1020        registry.get(this.__name).subs.delete(this.__sub);
1021        if (!this.__needsDidMount) {
1022          try {
1023            this.logic.componentWillUnmount();
1024          } catch (e) {
1025            console.error(e);
1026          }
1027        }
1028      }
1029      render() {
1030        const r = registry.get(this.__name);
1031        const cls = "sc-host" + (r.htmlStreaming ? " sc-streaming-html" : "") + (r.jsStreaming ? " sc-streaming-js" : "");
1032        const hintStyle = r.htmlStreaming ? hintToMin(this.props.__hintSize) : void 0;
1033        const hostStyle = this.props.__hostStyle || hintStyle ? { ...hintStyle || {}, ...this.props.__hostStyle || {} } : void 0;
1034        const hostBase = {
1035          className: cls,
1036          style: hostStyle,
1037          "data-sc-name": this.__name,
1038          "data-dc-tpl": this.props.__tplId
1039        };
1040        const chain = Array.isArray(this.context) ? this.context : [];
1041        if (chain.includes(this.__name)) {
1042          const cycle = [
1043            ...chain.slice(chain.indexOf(this.__name)),
1044            this.__name
1045          ].join(" \u2192 ");
1046          return h(
1047            "div",
1048            { ...hostBase, className: cls + " sc-has-error" },
1049            h(Placeholder, {
1050              name: this.__name,
1051              hintSize: this.props.__hintSize,
1052              error: "circular import: " + cycle
1053            })
1054          );
1055        }
1056        if (this.state.__err) {
1057          return h(
1058            "div",
1059            { ...hostBase, className: cls + " sc-has-error" },
1060            h(
1061              "div",
1062              { className: "sc-logic-error", "data-omelette-chrome": "" },
1063              this.__name + ": " + this.state.__err
1064            ),
1065            h(Placeholder, {
1066              name: this.__name,
1067              hintSize: this.props.__hintSize,
1068              error: this.state.__err
1069            })
1070          );
1071        }
1072        this.__reconcileLogic();
1073        if (!r.tpl) {
1074          return h(
1075            "div",
1076            hostBase,
1077            h(Placeholder, { name: this.__name, hintSize: this.props.__hintSize })
1078          );
1079        }
1080        const userProps = this.__userProps();
1081        this.logic.props = userProps;
1082        let vals = userProps;
1083        let renderErr = r.logicError || this.__ctorError;
1084        try {
1085          vals = { ...userProps, ...this.logic.renderVals() || {} };
1086        } catch (e) {
1087          console.error(e);
1088          renderErr = this.__name + ".renderVals(): " + (e instanceof Error && e.message ? e.message : 
1088String(e));
1089        }
1090        this.__streamingNow = !!(r.htmlStreaming || r.jsStreaming);
1091        this.__htmlStreamingNow = !!r.htmlStreaming;
1092        return h(
1093          "div",
1094          { ...hostBase, className: cls + (renderErr ? " sc-has-error" : "") },
1095          renderErr && h(
1096            "div",
1097            { className: "sc-logic-error", "data-omelette-chrome": "" },
1098            renderErr
1099          ),
1100          h(
1101            AncestorContext.Provider,
1102            { value: [...chain, this.__name] },
1103            r.tpl(vals, this)
1104          )
1105        );
1106      }
1107    }
1108    __publicField(StreamableComponent, "contextType", AncestorContext);
1109    const named = /* @__PURE__ */ new Map();
1110    function getDC(name) {
1111      const hit = named.get(name);
1112      if (hit) return hit;
1113      function Dispatcher(p) {
1114        const [, setTick] = React.useState(0);
1115        React.useEffect(() => {
1116          const sub = () => setTick((n) => n + 1);
1117          registry.get(name).subs.add(sub);
1118          return () => {
1119            registry.get(name).subs.delete(sub);
1120          };
1121        }, []);
1122        ensureFetched(name);
1123        return h(StreamableComponent, { ...p, __name: name });
1124      }
1125      Dispatcher.displayName = name;
1126      named.set(name, Dispatcher);
1127      return Dispatcher;
1128    }
1129    return {
1130      getDC,
1131      StreamableComponent
1132    };
1133  }
1134
1135  
1135// src/bundled.ts
1136  function bundledBlob(url) {
1137    const blobs = window.__resourceBlobs;
1138    const b = blobs ? blobs[url.split("#")[0]] : void 0;
1139    return b instanceof Blob ? b : null;
1140  }
1141
1142  
1142// src/cdn.ts
1143  var REACT_URL = "https://unpkg.com/[email protected]/umd/react.production.min.js";
1144  var REACT_SRI = "sha384-DGyLxAyjq0f9SPpVevD6IgztCFlnMF6oW/XQGmfe+IsZ8TqEiDrcHkMLKI6fiB/Z";
1145  var REACT_DOM_URL = "https://unpkg.com/[email protected]/umd/react-dom.production.min.js";
1146  var REACT_DOM_SRI = "sha384-gTGxhz21lVGYNMcdJOyq01Edg0jhn/c22nsx0kyqP0TxaV5WVdsSH1fSDUf5YJj1";
1147  var BABEL_URL = "https://unpkg.com/@babel/[email protected]/babel.min.js";
1148  var BABEL_SRI = "sha384-m08KidiNqLdpJqLq95G/LEi8Qvjl/xUYll3QILypMoQ65QorJ9Lvtp2RXYGBFj1y";
1149  function cdnScriptFor(url, sri) {
1150    const res = window.__resources;
1151    const v = res ? res[url] : void 0;
1152    return typeof v === "string" && v ? { src: v } : { src: url, integrity: sri };
1153  }
1154
1155  
1155// src/external.ts
1156  var isCustomElementName = (n) => !n.includes(".") && n.includes("-");
1157  function isRenderableType(g) {
1158    if (typeof g === "function") return !isElementClass(g);
1159    return typeof g === "object" && g !== null && typeof g.$$typeof === "symbol";
1160  }
1161  function resolveDottedPath(root, name) {
1162    let cur = root;
1163    for (const seg of name.split(".")) {
1164      if (cur == null) return void 0;
1165      cur = cur[seg];
1166    }
1167    return cur;
1168  }
1169  var GLOBAL_POLL_INTERVAL_MS = 50;
1170  var GLOBAL_POLL_TIMEOUT_MS = 3e4;
1171  function createExternalModules(onResolved) {
1172    const cache = /* @__PURE__ */ new Map();
1173    let babelLoading = null;
1174    const reportedMissing = /* @__PURE__ */ new Map();
1175    const polling = /* @__PURE__ */ new Set();
1176    function ensureBabel() {
1177      if (window.Babel) return Promise.resolve();
1178      if (babelLoading) return babelLoading;
1179      const babel = cdnScriptFor(BABEL_URL, BABEL_SRI);
1180      babelLoading = new Promise((res, rej) => {
1181        const s = document.createElement("script");
1182        s.src = babel.src;
1183        if (babel.integrity) {
1184          s.integrity = babel.integrity;
1185          s.crossOrigin = "anonymous";
1186        }
1187        s.onload = () => res();
1188        s.onerror = rej;
1189        document.head.appendChild(s);
1190      });
1191      return babelLoading;
1192    }
1193    const pending = /* @__PURE__ */ new Map();
1194    function load(kind, url, after) {
1195      const existing = pending.get(url);
1196      if (existing) return existing;
1197      cache.set(url, null);
1198      console.info("[dc-runtime] x-import: loading", url, "(" + kind + ")");
1199      const ready = Promise.all([
1200        kind === "jsx" ? ensureBabel() : Promise.resolve(),
1201        after ?? Promise.resolve()
1202      ]);
1203      const p = ready.then(() => {
1204        const pre = bundledBlob(url);
1205        if (pre) return pre.text();
1206        return fetch(url).then((r) => {
1207          if (!r.ok) throw new Error("HTTP " + r.status);
1208          return r.text();
1209        });
1210      }).then((src) => {
1211        const code = kind === "jsx" ? window.Babel.transform(src, {
1212          filename: url,
1213          presets: ["react", "typescript"]
1214        }).code : src;
1215        const module = { exports: {} };
1216        const before = new Set(Object.keys(window));
1217        //! nosemgrep: eval-and-function-constructor
1218        new Function("React", "module", "exports", "require", code)(
1219          getReact(),
1220          module,
1221          module.exports,
1222          () => ({})
1223        );
1224        const globals = {};
1225        for (const k of Object.keys(window)) {
1226          if (!before.has(k) && typeof window[k] === "function") {
1227            globals[k] = window[k];
1228          }
1229        }
1230        cache.set(url, { mod: module.exports, globals });
1231        console.info(
1232          "[dc-runtime] x-import: loaded",
1233          url,
1234          "\u2014 exports:",
1235          Object.keys(module.exports),
1236          "window globals:",
1237          Object.keys(globals)
1238        );
1239        onResolved();
1240      }).catch((e) => {
1241        cache.set(url, {
1242          mod: {},
1243          globals: {},
1244          error: "failed to load: " + (e instanceof Error && e.message ? e.message : String(e))
1245        });
1246        console.error(
1247          "[dc-runtime] x-import: FAILED to load",
1248          url,
1249          "(" + kind + ")",
1250          e
1251        );
1252        onResolved();
1253      });
1254      pending.set(url, p);
1255      return p;
1256    }
1257    function resolve2(url, name) {
1258      const entry = cache.get(url);
1259      if (!entry) return null;
1260      const { mod, globals } = entry;
1261      const C = mod && mod[name] || globals && globals[name] || typeof window !== "undefined" && window[name] || mod && mod.default;
1262      if (typeof C === "function") return C;
1263      const key = url + "\0" + name;
1264      if (!reportedMissing.has(key)) {
1265        reportedMissing.set(
1266          key,
1267          entry.error || 'no export named "' + name + '" (has: ' + Object.keys(mod).join(", ") + ")"
1268        );
1269        console.error(
1270          "[dc-runtime] x-import: module",
1271          url,
1272          "loaded but has no component named",
1273          JSON.stringify(name),
1274          "\u2014 available exports:",
1275          Object.keys(mod),
1276          "window globals:",
1277          Object.keys(globals),
1278          ". The module must `module.exports = {" + name + "}` or set `window." + name + "`."
1279        );
1280      }
1281      return null;
1282    }
1283    function waitForGlobal(name) {
1284      if (polling.has(name)) return;
1285      polling.add(name);
1286      const started = Date.now();
1287      const isCE = isCustomElementName(name);
1288      const tick = () => {
1289        const found = isCE ? customElements.get(name) : isRenderableType(resolveDottedPath(window, name));
1290        if (found) {
1291          polling.delete(name);
1292          onResolved();
1293          return;
1294        }
1295        if (Date.now() - started >= GLOBAL_POLL_TIMEOUT_MS) {
1296          console.warn(
1297            "[dc-runtime] x-import: global",
1298            JSON.stringify(name),
1299            "never appeared on window after " + GLOBAL_POLL_TIMEOUT_MS + "ms"
1300          );
1301          return;
1302        }
1303        setTimeout(tick, GLOBAL_POLL_INTERVAL_MS);
1304      };
1305      setTimeout(tick, GLOBAL_POLL_INTERVAL_MS);
1306    }
1307    function resolveGlobal(url, name) {
1308      const isCE = isCustomElementName(name);
1309      if (!url) {
1310        if (isCE) {
1311          if (customElements.get(name)) return name;
1312          waitForGlobal(name);
1313          return null;
1314        }
1315        const g2 = resolveDottedPath(window, name);
1316        if (isRenderableType(g2)) return g2;
1317        waitForGlobal(name);
1318        return null;
1319      }
1320      const entry = cache.get(url);
1321      if (!entry) return null;
1322      if (isCE && customElements.get(name)) return name;
1323      const g = entry.globals[name] ?? resolveDottedPath(window, name);
1324      if (isRenderableType(g)) return g;
1325      if (name.includes(".")) return null;
1326      const key = url + "\0global\0" + name;
1327      if (!reportedMissing.has(key)) {
1328        reportedMissing.set(key, null);
1329        if (isCE && !customElements.get(name)) {
1330          console.warn(
1331            "[dc-runtime] x-import:",
1332            url,
1333            "loaded but no custom element",
1334            JSON.stringify(name),
1335            "is registered and window." + name + " is not a function \u2014 rendering <" + name + "> as an unknown element."
1336          );
1337        }
1338      }
1339      return name;
1340    }
1341    function getError(url, name) {
1342      const entry = cache.get(url);
1343      if (entry?.error) return entry.error;
1344      return reportedMissing.get(url + "\0" + name) || null;
1345    }
1346    return { load, resolve: resolve2, resolveGlobal, getError };
1347  }
1348  function isElementClass(g) {
1349    try {
1350      return typeof g === "function" && typeof HTMLElement !== "undefined" && g.prototype instanceof HTMLElement;
1351    } catch {
1352      return false;
1353    }
1354  }
1355
1356  
1356// src/atomics.ts
1357  var ATOMIC_CSS = (
1358    // layout
1359    ".fx{display:flex}.col{display:flex;flex-direction:column}.grid{display:grid}.ac{align-items:center}.jc{justify-content:center}.jb{justify-content:space-between}.f1{flex:1}.noshrink{flex-shrink:0}.wrap{flex-wrap:wrap}.fw5{font-weight:500}.fw6{font-weight:600}.fw7{font-weight:700}.fw8{font-weight:800}.fs11{font-size:11px}.fs12{font-size:12px}.fs13{font-size:13px}.fs14{font-size:14px}.fs15{font-size:15px}.fs16{font-size:16px}.fs20{font-size:20px}.fs22{font-size:22px}.upper{text-transform:uppercase}.tc{text-align:center}.nowrap{white-space:nowrap}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap16{gap:16px}.gap24{gap:24px}.m0{margin:0}.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}.mb16{margin-bottom:16px}.posrel{position:relative}.posabs{position:absolute}.round{border-radius:50%}.ohide{overflow:hidden}.bbox{box-sizing:border-box}.pointer{cursor:pointer}.w100{width:100%}.b0{border:none}"
1360  );
1361
1362  
1362// src/helmet.ts
1363  var DESIGN_DOC_MODE_RE = /<meta\b[^>]*\bname\s*=\s*["']design_doc_mode["'][^>]*\b(?:content|value)\s*=\s*["'](\w+)["']/i;
1364  var CANVAS_BG_LIGHT = "#f0eee6";
1365  var CANVAS_BG_DARK = "#2e2c26";
1366  function createHelmetManager(doc, isStreaming) {
1367    const mounted = /* @__PURE__ */ new Set();
1368    const live = /* @__PURE__ */ new Map();
1369    let designDocMode = null;
1370    let canvasStyleEl = null;
1371    let appTheme = "light";
1372    try {
1373      const ds = doc.documentElement.dataset.theme;
1374      appTheme = ds === "dark" || ds === "light" ? ds : new URLSearchParams(doc.defaultView?.location.search ?? "").get(
1375        "theme"
1376      ) === "dark" ? "dark" : "light";
1377    } catch {
1378    }
1379    function applyCanvasBg() {
1380      if (!canvasStyleEl) return;
1381      const bg = appTheme === "dark" ? CANVAS_BG_DARK : CANVAS_BG_LIGHT;
1382      canvasStyleEl.textContent = `html,body{background:${bg}}#dc-root>.sc-host{position:relative}`;
1383    }
1384    function postDesignMode(mode) {
1385      if (window.parent === window) return;
1386      try {
1387        window.parent.postMessage({ type: "__dc_design_mode", mode }, "*");
1388      } catch {
1389      }
1390    }
1391    function setDesignDocMode(mode) {
1392      if (mode === designDocMode) return;
1393      designDocMode = mode;
1394      postDesignMode(mode);
1395      if (mode === "canvas") {
1396        doc.documentElement.setAttribute("data-dc-canvas", "");
1397        canvasStyleEl = doc.createElement("style");
1398        canvasStyleEl.setAttribute("data-dc-canvas", "");
1399        applyCanvasBg();
1400        doc.head.appendChild(canvasStyleEl);
1401      } else {
1402        doc.documentElement.removeAttribute("data-dc-canvas");
1403        canvasStyleEl?.remove();
1404        canvasStyleEl = null;
1405      }
1406    }
1407    window.addEventListener("message", (e) => {
1408      const type = e.data && e.data.type;
1409      if (type === "__dc_theme") {
1410        const t = e.data.theme;
1411        if (t === "light" || t === "dark") {
1412          appTheme = t;
1413          applyCanvasBg();
1414        }
1415        return;
1416      }
1417      if (!designDocMode || type !== "__dc_probe") return;
1418      postDesignMode(designDocMode);
1419    });
1420    function compile(node) {
1421      const raw = [...node.children];
1422      const helmetClosed = node.nextSibling != null || node.parentNode?.nextSibling != null;
1423      if (node.hasAttribute("data-dc-atomics") && !mounted.has("__dc-atomics")) {
1424        mounted.add("__dc-atomics");
1425        const el = doc.createElement("style");
1426        el.id = "__dc-atomics";
1427        el.textContent = ATOMIC_CSS;
1428        doc.head.appendChild(el);
1429      }
1430      return (_vals, ctx) => {
1431        const name = ctx && ctx.__name || "";
1432        const streaming = !!(name && isStreaming(name));
1433        for (let i = 0; i < raw.length; i++) {
1434          const child = raw[i];
1435          const tag = child.tagName;
1436          const mayBePartial = streaming && !helmetClosed && i === raw.length - 1;
1437          if (tag === "SCRIPT") {
1438            if (mayBePartial) continue;
1439            const key = "SCRIPT|" + (child.getAttribute("src") || child.textContent || "");
1440            if (mounted.has(key)) continue;
1441            mounted.add(key);
1442            const el = doc.createElement("script");
1443            for (const { name: an, value } of [...child.attributes])
1444              el.setAttribute(an, value);
1445            if (child.textContent) el.textContent = child.textContent;
1446            doc.head.appendChild(el);
1447          } else if (tag === "LINK" || tag === "META") {
1448            if (mayBePartial) continue;
1449            const key = tag + "|" + (child.getAttribute("href") || child.getAttribute("src") || child.outerHTML);
1450            if (mounted.has(key)) continue;
1451            mounted.add(key);
1452            if (tag === "LINK") {
1453              const rel = (child.getAttribute("rel") || "").toLowerCase().split(/\s+/);
1454              const href = (child.getAttribute("href") || "").trim();
1455              const res = window.__resources;
1456              const pre = res && rel.includes("stylesheet") && !rel.includes("alternate") ? res[href] : void 0;
1457              const blob = typeof pre === "string" && pre ? bundledBlob(pre) : null;
1458              if (blob) {
1459                const el = doc.createElement("style");
1460                if (child.hasAttribute("disabled")) {
1461                  el.setAttribute("media", "not all");
1462                } else if (child.getAttribute("media")) {
1463                  el.setAttribute("media", child.getAttribute("media"));
1464                }
1465                if (child.getAttribute("title"))
1466                  el.setAttribute("title", child.getAttribute("title"));
1467                void blob.text().then((css) => {
1468                  el.textContent = css;
1469                });
1470                doc.head.appendChild(el);
1471                continue;
1472              }
1473            }
1474            doc.head.appendChild(child.cloneNode(true));
1475          } else {
1476            const key = name + "|" + i;
1477            let el = live.get(key);
1478            if (!el || el.tagName !== tag) {
1479              if (el) el.remove();
1480              el = doc.createElement(tag.toLowerCase());
1481              live.set(key, el);
1482              doc.head.appendChild(el);
1483            }
1484            for (const { name: an, value } of [...child.attributes]) {
1485              if (el.getAttribute(an) !== value) el.setAttribute(an, value);
1486            }
1487            if (el.textContent !== child.textContent)
1488              el.textContent = child.textContent;
1489          }
1490        }
1491        return null;
1492      };
1493    }
1494    return { compile, setDesignDocMode };
1495  }
1496
1497  
1497// src/pseudo.ts
1498  function scanUnquotedUrl(css, i) {
1499    if (css[i] !== "u" && css[i] !== "U" || css.slice(i, i + 4).toLowerCase() !== "url(" || /[a-z0-9_-]/i.test(css[i - 1] ?? "")) {
1500      return -1;
1501    }
1502    let j = i + 4;
1503    while (j < css.length && /\s/.test(css[j])) j++;
1504    if (css[j] === '"' || css[j] === "'") return -1;
1505    while (j < css.length && css[j] !== ")") {
1506      if (css[j] === "\\") j++;
1507      j++;
1508    }
1509    return j < css.length ? j + 1 : css.length;
1510  }
1511  function stripComments(css) {
1512    let out = "";
1513    let quote = "";
1514    for (let i = 0; i < css.length; i++) {
1515      const c = css[i];
1516      if (quote) {
1517        if (c === "\\") {
1518          out += c + (css[i + 1] ?? "");
1519          i++;
1520          continue;
1521        }
1522        if (c === quote) quote = "";
1523        out += c;
1524      } else if (c === "'" || c === '"') {
1525        quote = c;
1526        out += c;
1527      } else if (c === "/" && css[i + 1] === "*") {
1528        const end = css.indexOf("*/", i + 2);
1529        i = end === -1 ? css.length : end + 1;
1530        out += " ";
1531      } else {
1532        const end = scanUnquotedUrl(css, i);
1533        if (end === -1) out += c;
1534        else {
1535          out += css.slice(i, end);
1536          i = end - 1;
1537        }
1538      }
1539    }
1540    return out;
1541  }
1542  function importantify(css) {
1543    css = stripComments(css);
1544    const decls = [];
1545    let start = 0;
1546    let depth = 0;
1547    let quote = "";
1548    for (let i = 0; i < css.length; i++) {
1549      const c = css[i];
1550      if (quote) {
1551        if (c === "\\") i++;
1552        else if (c === quote) quote = "";
1553      } else if (c === "'" || c === '"') quote = c;
1554      else if (c === "(") depth++;
1555      else if (c === ")") depth = Math.max(0, depth - 1);
1556      else if (c === ";" && depth === 0) {
1557        decls.push(css.slice(start, i));
1558        start = i + 1;
1559      } else {
1560        const end = scanUnquotedUrl(css, i);
1561        if (end !== -1) i = end - 1;
1562      }
1563    }
1564    decls.push(css.slice(start));
1565    return decls.map((d) => d.trim()).filter(Boolean).map((d) => /!\s*important$/i.test(d) ? d : d + " !important").join(";");
1566  }
1567  function createPseudoSheet(doc) {
1568    let el = null;
1569    const cache = /* @__PURE__ */ new Map();
1570    let n = 0;
1571    return (pseudo, css) => {
1572      const k = pseudo + "|" + css;
1573      const hit = cache.get(k);
1574      if (hit) return hit;
1575      if (!el) {
1576        el = doc.createElement("style");
1577        doc.head.appendChild(el);
1578      }
1579      const cls = "scp" + (n++).toString(36);
1580      const isPseudoElement = pseudo === "before" || pseudo === "after";
1581      const sel = isPseudoElement ? "." + cls + "::" + pseudo : "." + cls + ":" + pseudo;
1582      el.sheet.insertRule(
1583        sel + "{" + (isPseudoElement ? css : importantify(css)) + "}",
1584        el.sheet.cssRules.length
1585      );
1586      cache.set(k, cls);
1587      return cls;
1588    };
1589  }
1590
1591  
1591// src/registry.ts
1592  function createRegistry() {
1593    const entries = /* @__PURE__ */ Object.create(null);
1594    function get(name) {
1595      return entries[name] || (entries[name] = {
1596        html: "",
1597        tpl: null,
1598        Logic: null,
1599        jsStreaming: false,
1600        htmlStreaming: false,
1601        ver: 0,
1602        subs: /* @__PURE__ */ new Set(),
1603        fetched: false
1604      });
1605    }
1606    function bump(name) {
1607      const r = get(name);
1608      r.ver++;
1609      for (const fn of r.subs) fn();
1610    }
1611    return {
1612      entries,
1613      get,
1614      bump,
1615      bumpAll() {
1616        for (const n in entries) bump(n);
1617      }
1618    };
1619  }
1620
1621  
1621// src/runtime.ts
1622  var COMPONENT_DIR = ".";
1623  function createRuntime(doc = document) {
1624    const registry = createRegistry();
1625    const pseudoClass = createPseudoSheet(doc);
1626    const helmet = createHelmetManager(
1627      doc,
1628      (name) => registry.get(name).htmlStreaming
1629    );
1630    const external = createExternalModules(() => registry.bumpAll());
1631    const factory = createComponentFactory(registry, ensureFetched);
1632    const host = {
1633      component: (name) => factory.getDC(name),
1634      placeholder: (props) => h(Placeholder, props),
1635      helmet: (node) => helmet.compile(node),
1636      loadExternal: (kind, url, after) => external.load(kind, url, after),
1637      resolveExternal: (url, name) => external.resolve(url, name),
1638      resolveExternalGlobal: (url, name) => external.resolveGlobal(url, name),
1639      resolveExternalError: (url, name) => external.getError(url, name),
1640      pseudoClass
1641    };
1642    function ensureFetched(name) {
1643      const r = registry.get(name);
1644      if (r.fetched) return;
1645      r.fetched = true;
1646      const url = COMPONENT_DIR + "/" + encodeURIComponent(name) + ".dc.html";
1647      const res = window.__resources;
1648      const pre = res ? res[url] : void 0;
1649      const target = typeof pre === "string" && pre ? pre : url;
1650      const blob = bundledBlob(target);
1651      (blob ? blob.text() : fetch(target).then((res2) => {
1652        if (!res2.ok) {
1653          console.error(
1654            '[dc-runtime] sibling fetch for "' + name + '" failed:',
1655            url,
1656            "returned",
1657            res2.status,
1658            "\u2014 the reference renders as an empty placeholder."
1659          );
1660          return "";
1661        }
1662        return res2.text();
1663      })).then((t) => {
1664        if (!t) return;
1665        const parsed = parseDcText(t);
1666        if (!parsed) {
1667          console.error(
1668            '[dc-runtime] sibling fetch for "' + name + '":',
1669            url,
1670            "has no <x-dc> block \u2014 not a Design Component."
1671          );
1672          return;
1673        }
1674        if (parsed.props) r.propsMeta = parsed.props;
1675        if (parsed.preview) r.preview = parsed.preview;
1676        if (parsed.template && !r.html) updateHtml(name, parsed.template);
1677        if (parsed.js && !r.Logic) updateJs(name, parsed.js);
1678      }).catch(
1679        (e) => console.error(
1680          '[dc-runtime] sibling fetch for "' + name + '" threw:',
1681          url,
1682          e
1683        )
1684      );
1685    }
1686    let rootName = null;
1687    function updateHtml(name, html) {
1688      const r = registry.get(name);
1689      r.html = html;
1690      if (name === rootName) {
1691        const mode = DESIGN_DOC_MODE_RE.exec(html)?.[1] ?? null;
1692        if (mode || !r.htmlStreaming) helmet.setDesignDocMode(mode);
1693      }
1694      try {
1695        r.tpl = compileTemplate(html, host);
1696      } catch (e) {
1697        console.error("[dc-runtime] template compile FAILED for", name, e);
1698      }
1699      registry.bump(name);
1700    }
1701    function updateJs(name, src) {
1702      const r = registry.get(name);
1703      const seq = r.jsSeq = (r.jsSeq || 0) + 1;
1704      try {
1705        const Cls = evalDcLogic(src);
1706        if (r.jsSeq !== seq) return;
1707        if (typeof Cls !== "function") {
1708          r.logicError = name + ".dc.html: <script data-dc-script> must define `class Component extends DCLogic`";
1709        } else {
1710          r.logicError = null;
1711          r.Logic = Cls;
1712        }
1713      } catch (e) {
1714        if (r.jsSeq !== seq) return;
1715        console.error(
1716          "[dc-runtime] logic class eval FAILED for",
1717          name,
1718          "\u2014 the template renders with props only.",
1719          e
1720        );
1721        r.logicError = name + ": " + (e instanceof Error && e.message ? e.message : String(e));
1722      }
1723      registry.bump(name);
1724    }
1725    function setStreaming(name, kind, on) {
1726      const r = registry.get(name);
1727      if (kind === "html") r.htmlStreaming = !!on;
1728      else r.jsStreaming = !!on;
1729      let any = false;
1730      for (const n in registry.entries) {
1731        const e = registry.entries[n];
1732        if (e && (e.htmlStreaming || e.jsStreaming)) {
1733          any = true;
1734          break;
1735        }
1736      }
1737      doc.documentElement.classList.toggle("sc-dc-streaming", any);
1738      registry.bump(name);
1739    }
1740    function dcUpdate(name, kind, content, streaming) {
1741      if (streaming) registry.get(name).fetched = true;
1742      if (kind === "html") {
1743        setStreaming(name, "html", !!streaming);
1744        updateHtml(name, content);
1745      }
1745 else if (kind === "js") {
1746        setStreaming(name, "js", !!streaming);
1747        if (!streaming) updateJs(name, content);
1748      } else if (kind === "props") {
1749        const { props, preview } = parseDataProps(content);
1750        const r = registry.get(name);
1751        r.propsMeta = props ?? void 0;
1752        r.preview = preview;
1753        registry.bump(name);
1754      }
1755    }
1756    function setProps(name, overrides) {
1757      registry.get(name).propOverrides = overrides && typeof overrides === "object" ? { ...overrides } : null;
1758      registry.bump(name);
1759    }
1760    function adoptParsed(name, parsed) {
1761      if (!parsed) return;
1762      const r = registry.get(name);
1763      if (parsed.props) r.propsMeta = parsed.props;
1764      if (parsed.preview) r.preview = parsed.preview;
1765      if (parsed.template) updateHtml(name, parsed.template);
1766      if (parsed.js) updateJs(name, parsed.js);
1767    }
1768    return {
1769      registry,
1770      getDC: factory.getDC,
1771      updateHtml,
1772      updateJs,
1773      dcUpdate,
1774      setProps,
1775      adoptParsed,
1776      setRootName: (name) => {
1777        rootName = name;
1778      },
1779      markFetched: (name) => {
1780        registry.get(name).fetched = true;
1781      },
1782      annotatedTemplate: (name) => {
1783        const r = registry.get(name);
1784        return r.tpl && r.tpl.__annotated || null;
1785      },
1786      templateSource: (name) => registry.get(name).html || null,
1787      StreamableLogic
1788    };
1789  }
1790
1791  
1791// src/stream-state.ts
1792  function createStreamTracker(staleMs = 6e4, now = Date.now) {
1793    const since = /* @__PURE__ */ new Map();
1794    const liveOne = (n) => {
1795      const t = since.get(n);
1796      if (t === void 0) return false;
1797      if (now() - t > staleMs) {
1798        since.delete(n);
1799        return false;
1800      }
1801      return true;
1802    };
1803    return {
1804      push(name, streaming, viewportKey) {
1805        if (viewportKey === "dc-model") return;
1806        if (streaming) since.set(name, now());
1807        else since.delete(name);
1808      },
1809      live(name) {
1810        if (name !== void 0) return liveOne(name);
1811        for (const n of [...since.keys()]) if (liveOne(n)) return true;
1812        return false;
1813      }
1814    };
1815  }
1816
1817  
1817// src/index.ts
1818  function hideRawTemplate() {
1819    const s = document.createElement("style");
1820    s.textContent = "x-dc{display:none!important}";
1821    document.head.appendChild(s);
1822  }
1823  function loadScript(src, integrity) {
1824    return new Promise((resolve2, reject) => {
1825      //! nosemgrep: create-script-element
1826      const s = document.createElement("script");
1827      s.src = src;
1828      if (integrity) {
1829        s.integrity = integrity;
1830        s.crossOrigin = "anonymous";
1831      }
1832      s.async = false;
1833      s.onload = () => resolve2();
1834      s.onerror = () => reject(new Error(`failed to load ${src}`));
1835      document.head.appendChild(s);
1836    });
1837  }
1838  function loadReactUmd() {
1839    const w = window;
1840    if (w.React && w.ReactDOM) return Promise.resolve();
1841    const react = cdnScriptFor(REACT_URL, REACT_SRI);
1842    const reactDom = cdnScriptFor(REACT_DOM_URL, REACT_DOM_SRI);
1843    return Promise.all([
1844      loadScript(react.src, react.integrity),
1845      loadScript(reactDom.src, reactDom.integrity)
1846    ]).then(() => void 0);
1847  }
1848  function init() {
1849    const runtime = createRuntime(document);
1850    let rootName = "Root";
1851    const baseCss = document.createElement("style");
1852    baseCss.textContent = BASE_CSS;
1853    document.head.prepend(baseCss);
1854    const notifyHost = () => {
1855      if (window.parent === window) return;
1856      const r = runtime.registry.entries[rootName];
1857      try {
1858        window.parent.postMessage(
1859          {
1860            type: "__dc_booted",
1861            rootName,
1862            propsMeta: r && r.propsMeta || null,
1863            preview: r && r.preview || null
1864          },
1865          "*"
1866        );
1867      } catch {
1868      }
1869    };
1870    const streams = createStreamTracker();
1871    const api = {
1872      __dcUpdate: (name, kind, content, streaming, viewportKey) => {
1873        streams.push(name, streaming, viewportKey);
1874        runtime.dcUpdate(name, kind, content, streaming);
1875        if (name === rootName && !streaming && kind === "props") notifyHost();
1876      },
1877      __dcStreaming: (name) => streams.live(name),
1878      __dcSetProps: (name, overrides) => runtime.setProps(name, overrides),
1879      /** Name of the component currently mounted as the page root — DC tools
1880       *  push their template-stream here when targeting "the open page". */
1881      __dcRootName: () => rootName,
1882      /** Editor bridge — the encoded, `data-dc-tpl`-annotated template source.
1883       *  The host editor parses this into its own template DOM so it can map a
1884       *  rendered node (carrying the same `data-dc-tpl`) back to the source
1885       *  node that emitted it. Returns the encoded form (`sc-camel-*` attrs,
1886       *  `<sc-raw-*>`/`<sc-helmet>` tags); the editor decodes on serialize. */
1887      __dcAnnotatedTemplate: (name) => runtime.annotatedTemplate(name),
1888      /** Editor bridge — the *original* (decoded) template source. */
1889      __dcTemplateSource: (name) => runtime.templateSource(name),
1890      __dcBoot: () => {
1891        rootName = boot(runtime, document) ?? rootName;
1892        notifyHost();
1893      },
1894      __dcRegistry: runtime.registry.entries,
1895      getDC: (name) => runtime.getDC(name),
1896      // `DCLogic` is the documented base class name; `StreamableLogic` is the
1897      // implementation alias kept for any project that already references it.
1898      DCLogic: runtime.StreamableLogic,
1899      StreamableLogic: runtime.StreamableLogic
1900    };
1901    Object.assign(window, api);
1902    window.__dcContentKeyed = true;
1903    if (document.readyState !== "loading") api.__dcBoot();
1904    else document.addEventListener("DOMContentLoaded", () => api.__dcBoot());
1905  }
1906  hideRawTemplate();
1907  loadReactUmd().then(init).catch((err) => {
1908    console.error("[dc] failed to load React or boot:", err);
1909    throw err;
1910  });
1911})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.