@dogsbay/ssg-cli 0.2.0-beta.183 → 0.2.0-beta.188

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/AGENTS.md +168 -0
  2. package/README.md +3 -1
  3. package/THIRD-PARTY-NOTICES.txt +23 -17
  4. package/chunks/{build-command-QLNZ5BNK.mjs → build-command-NJATVOUY.mjs} +37 -26
  5. package/chunks/check-command-FL5O3AXB.mjs +577 -0
  6. package/chunks/chunk-2EM7IEQT.mjs +95 -0
  7. package/chunks/{chunk-JABACD5T.mjs → chunk-5A2QPRCV.mjs} +1 -30
  8. package/chunks/chunk-5NQOUB5I.mjs +4534 -0
  9. package/chunks/chunk-CYJ6GFVM.mjs +77 -0
  10. package/chunks/{chunk-KE6N5RFA.mjs → chunk-FFIXBXHD.mjs} +63 -234
  11. package/chunks/chunk-GFG5I7WI.mjs +807 -0
  12. package/chunks/chunk-GZ3E45TE.mjs +2290 -0
  13. package/chunks/chunk-IAAKV7V2.mjs +37 -0
  14. package/chunks/{chunk-IERF2DNL.mjs → chunk-VJ6AESSJ.mjs} +8072 -8555
  15. package/chunks/chunk-X3UPCLX5.mjs +503 -0
  16. package/chunks/{chunk-QDXUP47M.mjs → chunk-ZDH4JRVX.mjs} +1203 -4035
  17. package/chunks/{chunk-LNWQN7K7.mjs → chunk-ZRGJHNES.mjs} +7 -1
  18. package/chunks/compare-W4DJYVHT.mjs +239 -0
  19. package/chunks/compare-command-U36H55IE.mjs +144 -0
  20. package/chunks/{css-build-VKKTSP6P.mjs → css-build-MKIHYHCX.mjs} +2 -1
  21. package/chunks/{dev-HXLVZ7MF.mjs → dev-X3PKN4G3.mjs} +77 -25
  22. package/chunks/{menu-N2AZSZKS.mjs → menu-J3CLVADF.mjs} +9 -5
  23. package/chunks/{publish-command-UFHG6PJN.mjs → publish-command-SAPICGGM.mjs} +15 -7
  24. package/chunks/{release-diff-LFDQIFEF.mjs → release-diff-Y7X63MT3.mjs} +13 -6
  25. package/chunks/{serve-WGWRM7JQ.mjs → serve-7DR4WSYA.mjs} +3 -1
  26. package/cli.mjs +17 -10
  27. package/package.json +4 -3
  28. package/chunks/check-command-5U7VSMDO.mjs +0 -218
  29. package/chunks/chunk-KFYMG4VB.mjs +0 -45
@@ -0,0 +1,2290 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
3
+ import {
4
+ cardBodyHasLink,
5
+ followRenamedId,
6
+ headingIds,
7
+ isDetailsSheet,
8
+ isEmptyTableHead,
9
+ isSafeHref,
10
+ pageId,
11
+ parseInline,
12
+ renderAroundGroup,
13
+ stepLead,
14
+ stepTitle
15
+ } from "./chunk-VJ6AESSJ.mjs";
16
+ import {
17
+ collapseLines,
18
+ parseLineRanges,
19
+ plainHighlighter,
20
+ stripAnsi,
21
+ stripMarkersForCopy
22
+ } from "./chunk-YVSP26OS.mjs";
23
+ import {
24
+ lib_default
25
+ } from "./chunk-O3R3MASP.mjs";
26
+ import {
27
+ FOREIGN_END,
28
+ FOREIGN_START,
29
+ attrs,
30
+ esc,
31
+ passthrough,
32
+ slugify,
33
+ unesc
34
+ } from "./chunk-G6OTOD3B.mjs";
35
+
36
+ // src/core/paths.ts
37
+ function normalize(p) {
38
+ const abs = p.startsWith("/");
39
+ const out = [];
40
+ for (const seg of p.split("/")) {
41
+ if (seg === "" || seg === ".") continue;
42
+ if (seg === "..") {
43
+ if (out.length && out[out.length - 1] !== "..") out.pop();
44
+ else if (!abs) out.push("..");
45
+ continue;
46
+ }
47
+ out.push(seg);
48
+ }
49
+ return (abs ? "/" : "") + out.join("/");
50
+ }
51
+ function dirname(p) {
52
+ const i = p.lastIndexOf("/");
53
+ return i <= 0 ? p.startsWith("/") ? "/" : "" : p.slice(0, i);
54
+ }
55
+ function join(...parts) {
56
+ return normalize(parts.filter(Boolean).join("/"));
57
+ }
58
+ function relative(fromDir, to) {
59
+ const a = fromDir ? normalize(fromDir).split("/") : [];
60
+ const b = to ? normalize(to).split("/") : [];
61
+ let i = 0;
62
+ while (i < a.length && i < b.length && a[i] === b[i]) i++;
63
+ const up = a.slice(i).map(() => "..");
64
+ return [...up, ...b.slice(i)].join("/");
65
+ }
66
+ function rootPrefix(file) {
67
+ const depth = file.split("/").length - 1;
68
+ return "../".repeat(depth);
69
+ }
70
+ function isExternal(href) {
71
+ return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
72
+ }
73
+ function splitHref(href) {
74
+ const i = href.search(/[?#]/);
75
+ return i < 0 ? { path: href, suffix: "" } : { path: href.slice(0, i), suffix: href.slice(i) };
76
+ }
77
+
78
+ // node_modules/@dogsbay/render-html/dist/diff.js
79
+ var diffMarksOf = (node) => node;
80
+ function hasDiffMarks(node) {
81
+ const m = diffMarksOf(node);
82
+ return Boolean(m.diff || m.diffInline);
83
+ }
84
+ var escapeHtmlText = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\{/g, "&#123;").replace(/\}/g, "&#125;");
85
+ function inlineSegmentsToHtml(segments) {
86
+ return segments.map((s) => {
87
+ const text = escapeHtmlText(s.text);
88
+ if (s.op === "ins")
89
+ return `<ins class="db-diff-ins">${text}</ins>`;
90
+ if (s.op === "del")
91
+ return `<del class="db-diff-del">${text}</del>`;
92
+ return text;
93
+ }).join("");
94
+ }
95
+ var CODE_DIFF_MAX_LINES = 1500;
96
+ function buildMergedCodeDiff(oldCode, newCode) {
97
+ const a = oldCode.split("\n");
98
+ const b = newCode.split("\n");
99
+ if (a.length > CODE_DIFF_MAX_LINES || b.length > CODE_DIFF_MAX_LINES)
100
+ return null;
101
+ const m = a.length;
102
+ const n = b.length;
103
+ const lcs = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
104
+ for (let i2 = m - 1; i2 >= 0; i2--) {
105
+ for (let j2 = n - 1; j2 >= 0; j2--) {
106
+ lcs[i2][j2] = a[i2] === b[j2] ? lcs[i2 + 1][j2 + 1] + 1 : Math.max(lcs[i2 + 1][j2], lcs[i2][j2 + 1]);
107
+ }
108
+ }
109
+ const out = [];
110
+ const addLines = [];
111
+ const removeLines = [];
112
+ let i = 0;
113
+ let j = 0;
114
+ const emit = (text, kind) => {
115
+ out.push(text);
116
+ if (kind === "add")
117
+ addLines.push(out.length);
118
+ else if (kind === "remove")
119
+ removeLines.push(out.length);
120
+ };
121
+ while (i < m && j < n) {
122
+ if (a[i] === b[j]) {
123
+ emit(b[j]);
124
+ i++;
125
+ j++;
126
+ } else if (lcs[i + 1][j] >= lcs[i][j + 1]) {
127
+ emit(a[i], "remove");
128
+ i++;
129
+ } else {
130
+ emit(b[j], "add");
131
+ j++;
132
+ }
133
+ }
134
+ while (i < m)
135
+ emit(a[i++], "remove");
136
+ while (j < n)
137
+ emit(b[j++], "add");
138
+ return { code: out.join("\n"), addLines, removeLines };
139
+ }
140
+ var toLineSpec = (lines) => {
141
+ const parts = [];
142
+ for (let i = 0; i < lines.length; ) {
143
+ let j = i;
144
+ while (j + 1 < lines.length && lines[j + 1] === lines[j] + 1)
145
+ j++;
146
+ parts.push(i === j ? String(lines[i]) : `${lines[i]}-${lines[j]}`);
147
+ i = j + 1;
148
+ }
149
+ return parts.join(",");
150
+ };
151
+ var codeTextOf = (node) => node.props?.code ?? node.html ?? "";
152
+ var whitespaceOnly = (oldCode, newCode) => oldCode !== newCode && oldCode.replace(/\s+/g, "") === newCode.replace(/\s+/g, "");
153
+ function mergedCodeNode(node) {
154
+ const peer = diffMarksOf(node).diffPeer;
155
+ if (!peer)
156
+ return null;
157
+ const oldCode = codeTextOf(peer);
158
+ const newCode = codeTextOf(node);
159
+ const merged = buildMergedCodeDiff(oldCode, newCode);
160
+ if (merged === null)
161
+ return null;
162
+ return {
163
+ node: {
164
+ ...node,
165
+ html: void 0,
166
+ props: { ...node.props, code: merged.code, copyText: newCode, diffAdd: toLineSpec(merged.addLines), diffRemove: toLineSpec(merged.removeLines) }
167
+ },
168
+ whitespaceOnly: whitespaceOnly(oldCode, newCode)
169
+ };
170
+ }
171
+ var TAB_GLYPH = { added: "+", changed: "\u2022", removed: "\u2212", moved: "\u2192" };
172
+ function tabDiffSignal(tab) {
173
+ const own = diffMarksOf(tab).diff;
174
+ if (own)
175
+ return own;
176
+ const deep = (n) => hasDiffMarks(n) || (n.children ?? []).some(deep);
177
+ return (tab.children ?? []).some(deep) ? "changed" : void 0;
178
+ }
179
+ function injectAttrs(rendered, attrs2) {
180
+ const m = rendered.match(/<([A-Za-z][\w.-]*)((?:[^>"']|"[^"]*"|'[^']*')*?)(\/?)>/);
181
+ if (!m || m.index === void 0)
182
+ return rendered;
183
+ const insertAt = m.index + 1 + m[1].length;
184
+ return `${rendered.slice(0, insertAt)} ${attrs2}${rendered.slice(insertAt)}`;
185
+ }
186
+ var attrEsc = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
187
+ function decorateDiffHtml(node, rendered, renderPeer) {
188
+ const marks = diffMarksOf(node);
189
+ if (!marks.diff && !marks.diffInline)
190
+ return rendered;
191
+ if (marks.diff === "changed" && marks.diffPeer && node.type === "code") {
192
+ const merged = mergedCodeNode(node);
193
+ if (merged) {
194
+ return `<div data-diff="changed" class="db-diff-code${merged.whitespaceOnly ? " db-diff-code-ws" : ""}"><div class="db-diff-code-merged">${renderPeer(merged.node)}</div><div class="db-diff-code-clean">${rendered}</div></div>
195
+ `;
196
+ }
197
+ return `<div class="db-diff-pair" data-diff="changed"><div class="db-diff-pair-label">before</div>` + injectAttrs(renderPeer(marks.diffPeer), 'data-diff="removed"') + `<div class="db-diff-pair-label">after</div>${injectAttrs(rendered, 'data-diff="added"')}</div>
198
+ `;
199
+ }
200
+ const attrs2 = (marks.diff === "moved" && marks.diffMovedFrom ? `data-diff="moved" data-diff-from="${attrEsc(marks.diffMovedFrom.join(" \u203A "))}"` : `data-diff="${attrEsc(marks.diff ?? "changed")}"`) + renamedAttrs(node, marks);
201
+ if (node.type === "html") {
202
+ if (marks.diff === "changed" && marks.diffPeer) {
203
+ return `<div ${attrs2} class="db-diff-html">${rendered}<details class="db-diff-html-before"><summary>Show previous version</summary><div data-diff="removed">${renderPeer(marks.diffPeer)}</div></details></div>
204
+ `;
205
+ }
206
+ return `<div ${attrs2}>${rendered}</div>
207
+ `;
208
+ }
209
+ return injectAttrs(rendered, attrs2);
210
+ }
211
+ function renamedAttrs(node, marks = diffMarksOf(node)) {
212
+ return node.type === "heading" && typeof marks.diffRenamedFrom === "string" ? ` data-diff-renamed data-diff-was="${attrEsc(marks.diffRenamedFrom)}"` : "";
213
+ }
214
+ var DIFF_CSS = `/* tree-diff decorations \u2014 one DiffTree, rendered by the normal components.
215
+ Colours read the Tailwind theme token (--color-success) first, then the raw one (--success): a page built
216
+ with "@theme inline" (render-html's) has only the raw ones, and the pills fell back to Canvas, white in a
217
+ page that declares no color-scheme, under light text in dark mode.
218
+ Mark styling is GUARDED by html:not([data-diff-hidden]) rather than
219
+ force-reset under hidden mode: a reset like "border-left: none
220
+ !important" also clobbers a component's OWN border (an added warning
221
+ callout lost its left edge \u2014 user find, adapters/mysql). Guarded
222
+ rules simply stop applying, and component styling survives. */
223
+ [data-diff] { position: relative; }
224
+ html:not([data-diff-hidden]) [data-diff="added"] {
225
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 12%, transparent);
226
+ border-left: 3px solid var(--color-success, var(--success, oklch(0.72 0.19 150)));
227
+ padding-left: 0.75rem;
228
+ }
229
+ html:not([data-diff-hidden]) [data-diff="removed"] {
230
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 10%, transparent);
231
+ border-left: 3px solid var(--color-destructive, var(--destructive, oklch(0.64 0.21 25)));
232
+ padding-left: 0.75rem;
233
+ opacity: 0.75;
234
+ }
235
+ html:not([data-diff-hidden]) [data-diff="removed"] :is(p, li, code, pre) { text-decoration: line-through; text-decoration-thickness: 1px; }
236
+ html:not([data-diff-hidden]) [data-diff="changed"] {
237
+ border-left: 3px solid var(--color-warning, var(--warning, oklch(0.8 0.16 85)));
238
+ padding-left: 0.75rem;
239
+ }
240
+ html:not([data-diff-hidden]) [data-diff="moved"] {
241
+ border-left: 3px dashed var(--color-info, var(--info, oklch(0.7 0.14 240)));
242
+ padding-left: 0.75rem;
243
+ }
244
+ html:not([data-diff-hidden]) [data-diff="moved"][data-diff-from]::after {
245
+ content: "moved from " attr(data-diff-from);
246
+ display: block;
247
+ font-size: 0.75rem;
248
+ color: var(--color-muted-foreground, var(--muted-foreground, inherit));
249
+ opacity: 0.8;
250
+ }
251
+ html:not([data-diff-hidden]) [data-diff="changed"][data-diff-renamed][data-diff-was]::after {
252
+ content: "was: " attr(data-diff-was);
253
+ display: block;
254
+ font-size: 0.75rem;
255
+ font-weight: normal;
256
+ color: var(--color-muted-foreground, var(--muted-foreground, inherit));
257
+ opacity: 0.8;
258
+ }
259
+
260
+ /* Explicit "added"/"removed" label pills straddling the block's top
261
+ edge. Components with their own chrome (callouts, code blocks)
262
+ camouflage a tint-only mark \u2014 a green-tinted warning callout reads
263
+ as a callout variant, not as new content (user feedback,
264
+ better-auth adapters/mysql). Table rows are excluded (a pill can't
265
+ straddle a tr); nested marks defer to the outermost label. */
266
+ html:not([data-diff-hidden]) [data-diff="added"]:not(tr, th, td)::before,
267
+ html:not([data-diff-hidden]) [data-diff="removed"]:not(tr, th, td)::before {
268
+ position: absolute;
269
+ top: 0;
270
+ right: 0.6rem;
271
+ transform: translateY(-55%);
272
+ font-size: 0.65rem;
273
+ font-weight: 600;
274
+ letter-spacing: 0.04em;
275
+ line-height: 1.4;
276
+ padding: 0 0.5rem;
277
+ border-radius: 99px;
278
+ z-index: 1;
279
+ text-decoration: none;
280
+ color: var(--color-foreground, var(--foreground, CanvasText));
281
+ }
282
+ html:not([data-diff-hidden]) [data-diff="added"]:not(tr, th, td)::before {
283
+ content: "added";
284
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 25%, var(--color-background, var(--background, Canvas)));
285
+ border: 1px solid color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 45%, transparent);
286
+ }
287
+ html:not([data-diff-hidden]) [data-diff="removed"]:not(tr, th, td)::before {
288
+ content: "removed";
289
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 20%, var(--color-background, var(--background, Canvas)));
290
+ border: 1px solid color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 45%, transparent);
291
+ }
292
+ [data-diff] [data-diff]::before { content: none !important; }
293
+
294
+ /* Nav change markers (the sidebar is client-rendered from nav.json, so
295
+ the styles ship here rather than with the component). Same contract as
296
+ the tab markers: a GLYPH carries the meaning, colour reinforces it,
297
+ visually-hidden text announces it. */
298
+ .db-nav-mark {
299
+ display: inline-flex;
300
+ align-items: center;
301
+ justify-content: center;
302
+ flex-shrink: 0;
303
+ width: 1rem;
304
+ height: 1rem;
305
+ margin-left: auto;
306
+ border-radius: 99px;
307
+ font-size: 0.75rem;
308
+ font-weight: 700;
309
+ line-height: 1;
310
+ color: var(--color-muted-foreground, var(--muted-foreground, currentColor));
311
+ }
312
+ .db-nav-mark[data-nav-mark="added"] { color: var(--color-success, var(--success, oklch(0.72 0.19 150))); }
313
+ .db-nav-mark[data-nav-mark="changed"] { color: var(--color-warning, var(--warning, oklch(0.8 0.16 85))); }
314
+ .db-nav-mark[data-nav-mark="removed"] { color: var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))); }
315
+ .db-nav-mark[data-nav-mark="moved"] { color: var(--color-info, var(--info, oklch(0.7 0.14 240))); }
316
+ /* a subtree marker is a hint about descendants, not a claim about this row */
317
+ .db-nav-mark[data-nav-mark-subtree] { opacity: 0.55; }
318
+ /* removed pages get a SECOND non-colour signal */
319
+ /* Belt-and-braces: a subtree mark must never strike through its own row. */
320
+ [data-nav-mark-row="removed"]:not([data-nav-mark-subtree]) { text-decoration: line-through; opacity: 0.7; }
321
+ @media (forced-colors: active) {
322
+ .db-nav-mark { color: CanvasText; }
323
+ }
324
+
325
+ /* Which tab changed? A marked panel is invisible until opened, so its
326
+ trigger carries a marker (the group's bar says "in here", the marker
327
+ says "this one"). The marker is a GLYPH, not a colored dot: colour
328
+ alone fails WCAG 1.4.1 and background-tinted dots vanish entirely in
329
+ forced-colors mode. Colour reinforces; shape carries the meaning.
330
+ Visually-hidden text rides along (emitted by the serializer). */
331
+ .db-tab-mark {
332
+ display: inline-block;
333
+ margin-left: 0.35rem;
334
+ font-size: 0.75rem;
335
+ font-weight: 700;
336
+ line-height: 1;
337
+ vertical-align: middle;
338
+ color: var(--color-muted-foreground, var(--muted-foreground, currentColor));
339
+ }
340
+ [data-diff-hidden] .db-tab-mark { display: none; }
341
+ .db-tab-mark[data-diff-tab="changed"] { color: var(--color-warning, var(--warning, oklch(0.8 0.16 85))); }
342
+ .db-tab-mark[data-diff-tab="added"] { color: var(--color-success, var(--success, oklch(0.72 0.19 150))); }
343
+ .db-tab-mark[data-diff-tab="removed"] { color: var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))); }
344
+ .db-tab-mark[data-diff-tab="moved"] { color: var(--color-info, var(--info, oklch(0.7 0.14 240))); }
345
+ @media (forced-colors: active) {
346
+ .db-tab-mark { color: CanvasText; }
347
+ }
348
+ ins.db-diff-ins {
349
+ text-decoration: none;
350
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 22%, transparent);
351
+ border-radius: 2px;
352
+ padding: 0 1px;
353
+ }
354
+ del.db-diff-del {
355
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 18%, transparent);
356
+ border-radius: 2px;
357
+ padding: 0 1px;
358
+ }
359
+ .db-diff-pair { display: grid; gap: 0.25rem; margin-block: 1rem; }
360
+ .db-diff-pair-label {
361
+ font-size: 0.7rem;
362
+ text-transform: uppercase;
363
+ letter-spacing: 0.08em;
364
+ color: var(--color-muted-foreground, var(--muted-foreground, inherit));
365
+ opacity: 0.8;
366
+ }
367
+ tr[data-diff] { border-left-width: 3px; }
368
+
369
+ /* Folded unchanged sections are CHROME, not content callouts:
370
+ dashed, dimmed, compact \u2014 visually "collapsed context". */
371
+ .db-diff-fold {
372
+ border: 1px dashed color-mix(in oklch, currentColor 25%, transparent);
373
+ opacity: 0.7;
374
+ margin-block: 0.5rem;
375
+ }
376
+ .db-diff-fold:hover, .db-diff-fold[open] { opacity: 1; }
377
+ .db-diff-fold summary, .db-diff-fold [data-slot="trigger"] {
378
+ font-size: 0.85rem;
379
+ }
380
+
381
+ /* The comparison banner at the top of each reader page. */
382
+ .db-diff-banner-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; align-items: center; width: 100%; }
383
+ .db-diff-banner {
384
+ border: 1px solid color-mix(in oklch, currentColor 15%, transparent);
385
+ border-radius: 8px;
386
+ padding: 0.75rem 1rem;
387
+ margin-block-end: 1.5rem;
388
+ font-size: 0.85rem;
389
+ display: flex;
390
+ flex-wrap: wrap;
391
+ gap: 0.4rem 1rem;
392
+ align-items: center;
393
+ }
394
+ .db-diff-banner .db-chip {
395
+ display: inline-block;
396
+ border-radius: 99px;
397
+ padding: 0.05rem 0.6rem;
398
+ font-size: 0.75rem;
399
+ border: 1px solid transparent;
400
+ }
401
+ .db-chip-added { background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 15%, transparent); }
402
+ .db-chip-removed { background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 12%, transparent); }
403
+ .db-chip-changed { background: color-mix(in oklch, var(--color-warning, var(--warning, oklch(0.8 0.16 85))) 15%, transparent); }
404
+ .db-chip-moved { background: color-mix(in oklch, var(--color-info, var(--info, oklch(0.7 0.14 240))) 12%, transparent); }
405
+ .db-chip-muted { border-color: color-mix(in oklch, currentColor 25%, transparent); opacity: 0.8; }
406
+
407
+ /* The persistent view-switcher bar (Reader / Docs-ops / Agent):
408
+ perspectives on ONE comparison \u2014 tabs are links, verification
409
+ lives in the chrome, the Monitor CTA sits next to the value. */
410
+ .db-cmp-bar {
411
+ position: sticky;
412
+ /* BELOW the docs header, not under it: both were sticky at top:0 and
413
+ the header's higher z-index simply swallowed this bar on scroll \u2014
414
+ the chrome carrying the trust contract was the chrome that vanished.
415
+ --db-header-height is declared by DocsLayout (the header sizes itself
416
+ from the same variable, so they cannot drift). */
417
+ top: var(--db-header-height, 3.25rem);
418
+ z-index: 30;
419
+ display: flex;
420
+ flex-wrap: wrap;
421
+ gap: 0.4rem 0.9rem;
422
+ align-items: center;
423
+ padding: 0.5rem 0.9rem;
424
+ margin-block-end: 1rem;
425
+ border: 1px solid color-mix(in oklch, currentColor 15%, transparent);
426
+ border-radius: 8px;
427
+ background: var(--color-background, var(--background, Canvas));
428
+ font-size: 0.8rem;
429
+ }
430
+ .db-cmp-bar .db-chip {
431
+ display: inline-block;
432
+ border-radius: 99px;
433
+ padding: 0.05rem 0.6rem;
434
+ font-size: 0.75rem;
435
+ border: 1px solid transparent;
436
+ }
437
+ .db-cmp-bar button.db-chip { cursor: pointer; background: transparent; font: inherit; font-size: 0.75rem; color: inherit; }
438
+ .db-cmp-tabs {
439
+ display: inline-flex;
440
+ gap: 0.15rem;
441
+ border: 1px solid color-mix(in oklch, currentColor 20%, transparent);
442
+ border-radius: 99px;
443
+ padding: 0.1rem;
444
+ }
445
+ .db-cmp-tab {
446
+ padding: 0.1rem 0.7rem;
447
+ border-radius: 99px;
448
+ text-decoration: none;
449
+ color: inherit;
450
+ }
451
+ .db-cmp-tab[aria-current="page"] {
452
+ background: color-mix(in oklch, currentColor 12%, transparent);
453
+ font-weight: 600;
454
+ }
455
+ .db-cmp-pairs { position: relative; display: inline-block; }
456
+ .db-cmp-pairs summary { cursor: pointer; }
457
+ .db-cmp-pairs ul {
458
+ position: absolute;
459
+ top: 100%;
460
+ left: 0;
461
+ margin: 0.25rem 0 0;
462
+ padding: 0.35rem 0.75rem;
463
+ list-style: none;
464
+ background: var(--color-background, var(--background, Canvas));
465
+ border: 1px solid color-mix(in oklch, currentColor 20%, transparent);
466
+ border-radius: 8px;
467
+ white-space: nowrap;
468
+ z-index: 40;
469
+ }
470
+ .db-cmp-monitor { text-decoration: none; border-color: color-mix(in oklch, currentColor 30%, transparent) !important; }
471
+ .db-cmp-monitor:hover { background: color-mix(in oklch, currentColor 10%, transparent); }
472
+
473
+ /* A wholly added/removed PAGE carries one mark around all its content.
474
+ The per-block tint would be overwhelming at page scale, so page level
475
+ gets a stronger edge and a much lighter wash \u2014 legible at a glance,
476
+ still readable as prose. The "added"/"removed" pill (the ::before on
477
+ [data-diff]) rides on this wrapper, which is exactly right: it labels
478
+ the page, once. */
479
+ html:not([data-diff-hidden]) [data-diff].db-diff-page {
480
+ border-left-width: 5px;
481
+ padding-left: 1rem;
482
+ padding-block: 0.5rem;
483
+ border-radius: 0 6px 6px 0;
484
+ }
485
+ html:not([data-diff-hidden]) [data-diff="added"].db-diff-page {
486
+ background: color-mix(in oklch, var(--color-success, var(--success, oklch(0.72 0.19 150))) 5%, transparent);
487
+ }
488
+ html:not([data-diff-hidden]) [data-diff="removed"].db-diff-page {
489
+ background: color-mix(in oklch, var(--color-destructive, var(--destructive, oklch(0.64 0.21 25))) 5%, transparent);
490
+ opacity: 1; /* the page is READABLE \u2014 the mark says removed, not the dimming */
491
+ }
492
+ /* \u2026and a removed PAGE is not struck through \u2014 that is for a deleted line,
493
+ not for a document the reader still needs to read. */
494
+ [data-diff="removed"].db-diff-page :is(p, li, code, pre) { text-decoration: none; }
495
+
496
+ /* Changed raw HTML: the faithful new render, plus the previous version
497
+ one click away. Without it a deletion inside opaque markup (a dropped
498
+ table column) is simply invisible \u2014 the reader is told "something
499
+ changed" and shown no evidence. */
500
+ .db-diff-html-before {
501
+ margin-block-start: 0.5rem;
502
+ font-size: 0.8rem;
503
+ border: 1px dashed color-mix(in oklch, currentColor 25%, transparent);
504
+ border-radius: 6px;
505
+ padding: 0.25rem 0.6rem;
506
+ }
507
+ /* Full-strength text: the summary is a CONTROL \u2014 dimming it (opacity or
508
+ muted-foreground) drops it below 4.5:1 and axe rightly fails it. */
509
+ .db-diff-html-before summary { cursor: pointer; color: inherit; }
510
+ .db-diff-html-before[open] summary { margin-block-end: 0.5rem; }
511
+ [data-diff-hidden] .db-diff-html-before { display: none; }
512
+
513
+ /* Merged code diffs carry a hidden clean twin (the post-change
514
+ render); Hide highlights swaps them. */
515
+ .db-diff-code { position: relative; }
516
+ .db-diff-code-clean { display: none; }
517
+ [data-diff-hidden] .db-diff-code-clean { display: block; }
518
+ [data-diff-hidden] .db-diff-code-merged { display: none; }
519
+
520
+ /* Whitespace-only code edits are still marked (indentation is
521
+ semantic in YAML/Python/markdown) \u2014 but NAMED, so the reader
522
+ is not hunting an invisible 3-space shift. */
523
+ html:not([data-diff-hidden]) .db-diff-code-ws .db-diff-code-merged::before {
524
+ content: "whitespace only";
525
+ position: absolute;
526
+ top: 0;
527
+ right: 0.6rem;
528
+ transform: translateY(-55%);
529
+ z-index: 1;
530
+ font-size: 0.65rem;
531
+ font-weight: 600;
532
+ letter-spacing: 0.04em;
533
+ line-height: 1.4;
534
+ padding: 0 0.5rem;
535
+ border-radius: 99px;
536
+ color: var(--color-foreground, var(--foreground, CanvasText));
537
+ background: color-mix(in oklch, var(--color-warning, var(--warning, oklch(0.8 0.16 85))) 22%, var(--color-background, var(--background, Canvas)));
538
+ border: 1px solid color-mix(in oklch, var(--color-warning, var(--warning, oklch(0.8 0.16 85))) 45%, transparent);
539
+ }
540
+
541
+ /* Hide highlights \u2014 read the target version clean. One attribute on
542
+ <html>: the guarded mark rules above stop applying by themselves;
543
+ only content that does not exist in the target version (removed
544
+ blocks, del runs, the "before" code side) needs hiding, plus the
545
+ ins tint. */
546
+ [data-diff-hidden] :is([data-diff="removed"], del.db-diff-del, .db-diff-pair-label) { display: none !important; }
547
+ [data-diff-hidden] ins.db-diff-ins { background: transparent; padding: 0; }
548
+ `;
549
+
550
+ // node_modules/@dogsbay/render-html/dist/url.js
551
+ var SCHEME_REFS = /&(?:#(\d+)|#x([0-9a-f]+)|(tab|newline|colon));?/gi;
552
+ function scriptUrl(raw, kind) {
553
+ const v = raw.replace(SCHEME_REFS, (_, dec, hex, named) => {
554
+ if (named)
555
+ return { tab: " ", newline: "\n", colon: ":" }[named.toLowerCase()];
556
+ const cp = Number.parseInt(dec ?? hex, dec ? 10 : 16);
557
+ return cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : "";
558
+ });
559
+ if (kind === "image" && /^data:image\//i.test(v.replace(/[\u0000-\u0020\u007f]+/g, "")))
560
+ return false;
561
+ return !isSafeHref(v, kind);
562
+ }
563
+
564
+ // node_modules/@dogsbay/render-html/dist/icons.js
565
+ var svg = (body, cls = "db-icon") => `<svg class="${cls}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${body}</svg>`;
566
+ var PATHS = {
567
+ info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
568
+ lightbulb: '<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',
569
+ "alert-triangle": '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
570
+ "alert-octagon": '<path d="M12 16h.01"/><path d="M12 8v4"/><path d="M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"/>',
571
+ "message-square-warning": '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/><path d="M12 7v2"/><path d="M12 13h.01"/>',
572
+ "circle-check": '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
573
+ "circle-x": '<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/>',
574
+ "circle-help": '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
575
+ bug: '<path d="m8 2 1.88 1.88"/><path d="M14.12 3.88 16 2"/><path d="M9 7.13v-1a3.003 3.003 0 1 1 6 0v1"/><path d="M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6"/><path d="M12 20v-9"/>',
576
+ "file-code": '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5m-10 4.5L8 15l2 2.5m4-5l2 2.5l-2 2.5"/>',
577
+ "file-text": '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M16 13H8"/><path d="M16 17H8"/>',
578
+ quote: '<path d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/><path d="M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/>',
579
+ "flask-conical": '<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/><path d="M8.5 2h7"/><path d="M7 16h10"/>',
580
+ flame: '<path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/>',
581
+ copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
582
+ check: '<path d="M20 6 9 17l-5-5"/>',
583
+ "chevron-right": '<path d="m9 18 6-6-6-6"/>',
584
+ "chevron-left": '<path d="m15 18-6-6 6-6"/>',
585
+ "chevron-down": '<path d="m6 9 6 6 6-6"/>',
586
+ search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
587
+ menu: '<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>',
588
+ x: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
589
+ sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
590
+ moon: '<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>',
591
+ "external-link": '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
592
+ link: '<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',
593
+ rocket: '<path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"/><path d="m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"/><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"/><path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"/>',
594
+ book: '<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"/>',
595
+ globe: '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
596
+ "git-branch": '<line x1="6" x2="6" y1="3" y2="15"/><circle cx="18" cy="6" r="3"/><circle cx="6" cy="18" r="3"/><path d="M18 9a9 9 0 0 1-9 9"/>',
597
+ "list-tree": '<path d="M21 12h-8"/><path d="M21 6H8"/><path d="M21 18h-8"/><path d="M3 6v4c0 1.1.9 2 2 2h3"/><path d="M3 10v6c0 1.1.9 2 2 2h3"/>',
598
+ // dogsbay-ssg 2026-11-16: a page naming lucide:history drew nothing here, where Astro draws one
599
+ history: '<path d="M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5m4-1v5l4 2"/>',
600
+ printer: '<path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><path d="M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6"/><rect x="6" y="14" width="12" height="8" rx="1"/>',
601
+ // Lucide icons Starlight's icon names map to (format-starlight starlight-icons.ts), so a converted
602
+ // site's cards draw with no icon set loaded (the SSG, the playground)
603
+ "chevron-up": '<path d="m18 15l-6-6l-6 6"/>',
604
+ "arrow-up": '<path d="m5 12l7-7l7 7m-7 7V5"/>',
605
+ "arrow-down": '<path d="M12 5v14m7-7l-7 7l-7-7"/>',
606
+ "arrow-right": '<path d="M5 12h14m-7-7l7 7l-7 7"/>',
607
+ "arrow-left": '<path d="m12 19l-7-7l7-7m7 7H5"/>',
608
+ languages: '<path d="m5 8l6 6m-7 0l6-6l2-3M2 5h12M7 2h1m14 20l-5-10l-5 10m2-4h6"/>',
609
+ pencil: '<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4"/>',
610
+ pen: '<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/>',
611
+ "file-plus": '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5M9 15h6m-3 3v-6"/>',
612
+ settings: '<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/>',
613
+ download: '<path d="M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10l5 5l5-5"/>',
614
+ "cloud-download": '<path d="M12 13v8l-4-4m4 4l4-4"/><path d="M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284"/>',
615
+ laptop: '<path d="M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2zm2.054 10.987H3.946"/>',
616
+ "book-open": '<path d="M12 7v14m-9-3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4a4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3a3 3 0 0 0-3-3z"/>',
617
+ slash: '<path d="M22 2L2 22"/>',
618
+ "triangle-alert": '<path d="m21.73 18l-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01"/>',
619
+ star: '<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.12 2.12 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16z"/>',
620
+ puzzle: '<path d="M15.39 4.39a1 1 0 0 0 1.68-.474a2.5 2.5 0 1 1 3.014 3.015a1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474a2.5 2.5 0 1 0-3.014 3.015a1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474a2.5 2.5 0 1 1-3.014-3.015a1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474a2.5 2.5 0 1 0 3.014-3.015a1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z"/>',
621
+ list: '<path d="M3 5h.01M3 12h.01M3 19h.01M8 5h13M8 12h13M8 19h13"/>',
622
+ shuffle: '<path d="m18 14l4 4l-4 4m0-20l4 4l-4 4"/><path d="M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22M2 6h1.972a4 4 0 0 1 3.6 2.2M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45"/>',
623
+ "message-square": '<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/>',
624
+ "message-circle": '<path d="M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092a10 10 0 1 0-4.777-4.719"/>',
625
+ heart: '<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676a.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',
626
+ mail: '<path d="m22 7l-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect width="20" height="16" x="2" y="4" rx="2"/>',
627
+ phone: '<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233a14 14 0 0 0 6.392 6.384"/>',
628
+ rss: '<path d="M4 11a9 9 0 0 1 9 9M4 4a16 16 0 0 1 16 16"/><circle cx="5" cy="19" r="1"/>',
629
+ sparkles: '<path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4m2-2h-4"/><circle cx="4" cy="20" r="2"/>'
630
+ };
631
+ function icon(name, cls) {
632
+ const body = hasIcon(name) ? PATHS[name] : void 0;
633
+ return body ? svg(body, cls) : "";
634
+ }
635
+ function hasIcon(name) {
636
+ return Object.hasOwn(PATHS, name);
637
+ }
638
+ var CALLOUTS = {
639
+ note: { variant: "note", icon: "info", label: "Note" },
640
+ info: { variant: "info", icon: "info", label: "Info" },
641
+ tip: { variant: "tip", icon: "lightbulb", label: "Tip" },
642
+ hint: { variant: "tip", icon: "lightbulb", label: "Hint" },
643
+ success: { variant: "success", icon: "circle-check", label: "Success" },
644
+ important: { variant: "important", icon: "message-square-warning", label: "Important" },
645
+ warning: { variant: "warning", icon: "alert-triangle", label: "Warning" },
646
+ attention: { variant: "warning", icon: "alert-triangle", label: "Attention" },
647
+ caution: { variant: "caution", icon: "alert-octagon", label: "Caution" },
648
+ danger: { variant: "danger", icon: "flame", label: "Danger" },
649
+ error: { variant: "danger", icon: "circle-x", label: "Error" },
650
+ failure: { variant: "danger", icon: "circle-x", label: "Failure" },
651
+ question: { variant: "question", icon: "circle-help", label: "Question" },
652
+ bug: { variant: "danger", icon: "bug", label: "Bug" },
653
+ example: { variant: "example", icon: "flask-conical", label: "Example" },
654
+ abstract: { variant: "note", icon: "file-text", label: "Abstract" },
655
+ quote: { variant: "quote", icon: "quote", label: "Quote" }
656
+ };
657
+
658
+ // node_modules/@dogsbay/render-html/dist/badge-variants.js
659
+ var BADGE_BASE = "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors";
660
+ var BADGE_VARIANTS = {
661
+ default: "border-transparent bg-primary text-primary-foreground",
662
+ secondary: "border-transparent bg-secondary text-secondary-foreground",
663
+ destructive: "border-transparent bg-destructive text-destructive-foreground",
664
+ outline: "text-foreground",
665
+ // Status colours, from the callout palette (`:badge[Beta]{variant="warning"}`).
666
+ // The TEXT is the accent mixed 60% toward --foreground; the tint keeps the
667
+ // accent at full strength. The accent used raw measured 1.85-2.6:1 in light
668
+ // mode (danger 3.3-3.9:1 in dark too), from painted pixels. --foreground is
669
+ // near-black in light and near-white in dark, so one rule serves both themes
670
+ // (worst case 4.95:1); a fixed dark colour would fail dark mode. The same
671
+ // rule as the in-cell admonitions in format-astro's theme-css.ts.
672
+ // The `color:` hint is required: tailwind-merge 2.x (Badge.astro's tv())
673
+ // reads a bare text-[... 60% ...] as a FONT SIZE and drops text-xs.
674
+ // Checked per preset by @dogsbay/render-html tests/contrast.test.ts, and
675
+ // through tv() by ui tests/badge.test.ts.
676
+ info: "border-transparent bg-info/15 text-[color:color-mix(in_oklab,var(--info)_60%,var(--foreground))]",
677
+ success: "border-transparent bg-success/15 text-[color:color-mix(in_oklab,var(--success)_60%,var(--foreground))]",
678
+ warning: "border-transparent bg-warning/15 text-[color:color-mix(in_oklab,var(--warning)_60%,var(--foreground))]",
679
+ danger: "border-transparent bg-danger/15 text-[color:color-mix(in_oklab,var(--danger)_60%,var(--foreground))]"
680
+ };
681
+ function badgeClass(variant) {
682
+ const key = variant ?? "default";
683
+ const v = Object.prototype.hasOwnProperty.call(BADGE_VARIANTS, key) ? BADGE_VARIANTS[key] : void 0;
684
+ return v ? `${BADGE_BASE} ${v}` : BADGE_BASE;
685
+ }
686
+
687
+ // node_modules/@dogsbay/render-html/dist/kbd-variants.js
688
+ var KBD_CLASS = "pointer-events-none inline-flex h-5 items-center justify-center gap-1 rounded border bg-muted px-1.5 font-mono text-xs font-medium text-muted-foreground shadow-[0_1px_0_1px] shadow-muted";
689
+
690
+ // node_modules/@dogsbay/render-html/dist/tone-classes.js
691
+ var TONE_CLASSES = {
692
+ "primary": "bg-primary text-primary-foreground",
693
+ "primary-strong": "bg-primary/80 text-primary-foreground",
694
+ "primary-medium": "bg-primary/60 text-primary-foreground",
695
+ "primary-half": "bg-primary/50 text-primary-foreground",
696
+ "primary-light": "bg-primary/20 text-primary",
697
+ "primary-soft": "bg-primary/10 text-primary",
698
+ "muted": "bg-muted text-muted-foreground",
699
+ "blue": "bg-blue-500/15 text-blue-700 dark:text-blue-300",
700
+ "amber": "bg-amber-500/15 text-amber-700 dark:text-amber-300",
701
+ "green": "bg-green-500/15 text-green-700 dark:text-green-300",
702
+ "purple": "bg-purple-500/15 text-purple-700 dark:text-purple-300",
703
+ "red": "bg-red-500/15 text-red-700 dark:text-red-300"
704
+ };
705
+ var CARD_TONE_CLASSES = {
706
+ "info": "border-info/50 bg-info/5",
707
+ "success": "border-success/50 bg-success/5",
708
+ "warning": "border-warning/50 bg-warning/5",
709
+ "danger": "border-danger/50 bg-danger/5"
710
+ };
711
+ var TAB_VARIANTS = {
712
+ "pills": {
713
+ "list": "flex flex-wrap items-center gap-2 border-b-0 border-transparent bg-transparent p-0 px-3 pt-3 pb-1 text-muted-foreground",
714
+ "trigger": "inline-flex items-center justify-center whitespace-nowrap rounded-full border border-border px-4 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-selected:border-primary aria-selected:bg-primary aria-selected:text-primary-foreground aria-selected:shadow-none"
715
+ },
716
+ "underline": {
717
+ "list": "flex items-center gap-6 border-b border-border bg-transparent p-0 px-4 text-muted-foreground",
718
+ "trigger": "-mb-px inline-flex items-center justify-center whitespace-nowrap rounded-none border-b-2 border-transparent p-0 px-0.5 pt-3 pb-2 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:text-foreground aria-selected:border-primary aria-selected:bg-transparent aria-selected:text-foreground aria-selected:shadow-none"
719
+ }
720
+ };
721
+ var THEME_SCOPES = {
722
+ "dark": "dark my-6 rounded-xl border border-border bg-background p-6 text-foreground [&>:first-child]:mt-0! [&>:last-child]:mb-0!"
723
+ };
724
+ function lookup(table2, key) {
725
+ return typeof key === "string" && Object.prototype.hasOwnProperty.call(table2, key) ? table2[key] : void 0;
726
+ }
727
+
728
+ // node_modules/@dogsbay/render-html/dist/file-tree.js
729
+ var svg2 = (body) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 shrink-0 text-muted-foreground" aria-hidden="true" focusable="false">${body}</svg>`;
730
+ var FOLDER = svg2('<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>');
731
+ var FILE = svg2('<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>');
732
+ function list(items, nested2) {
733
+ const cls = nested2 ? "m-0 ml-2 list-none border-l border-border pl-4" : "m-0 list-none p-0";
734
+ return `<ul class="${cls}">${items.map((it) => `<li class="my-0.5" data-kind="${it.folder ? "folder" : "file"}"><span class="inline-flex items-center gap-1.5">${it.folder ? FOLDER : FILE}<span>${it.label}</span></span>${it.children.length ? list(it.children, true) : ""}</li>`).join("")}</ul>`;
735
+ }
736
+ function fileTreeHtml(items, extraClass = "") {
737
+ return `<div class="not-prose my-4 overflow-x-auto rounded-lg border bg-card p-3 font-mono text-sm${extraClass ? ` ${extraClass}` : ""}" data-component="files">${list(items, false)}</div>`;
738
+ }
739
+
740
+ // node_modules/@dogsbay/render-html/dist/alert-icons.js
741
+ var icons = {
742
+ note: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m3.1 5.07c.14 0 .28.05.4.16l1.27 1.27c.23.22.23.57 0 .78l-1 1-2.05-2.05 1-1c.1-.11.24-.16.38-.16m-1.97 1.74 2.06 2.06-6.06 6.06H7.07v-2.06z"/></svg>',
743
+ abstract: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M17 9H7V7h10m0 6H7v-2h10m-3 6H7v-2h7M12 3a1 1 0 0 1 1 1 1 1 0 0 1-1 1 1 1 0 0 1-1-1 1 1 0 0 1 1-1m7 0h-4.18C14.4 1.84 13.3 1 12 1s-2.4.84-2.82 2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2"/></svg>',
744
+ info: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M13 9h-2V7h2m0 10h-2v-6h2m-1-9A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2"/></svg>',
745
+ tip: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M17.66 11.2c-.23-.3-.51-.56-.77-.82-.67-.6-1.43-1.03-2.07-1.66C13.33 7.26 13 4.85 13.95 3c-.95.23-1.78.75-2.49 1.32-2.59 2.08-3.61 5.75-2.39 8.9.04.1.08.2.08.33 0 .22-.15.42-.35.5-.23.1-.47.04-.66-.12a.6.6 0 0 1-.14-.17c-1.13-1.43-1.31-3.48-.55-5.12C5.78 10 4.87 12.3 5 14.47c.06.5.12 1 .29 1.5.14.6.41 1.2.71 1.73 1.08 1.73 2.95 2.97 4.96 3.22 2.14.27 4.43-.12 6.07-1.6 1.83-1.66 2.47-4.32 1.53-6.6l-.13-.26c-.21-.46-.77-1.26-.77-1.26m-3.16 6.3c-.28.24-.74.5-1.1.6-1.12.4-2.24-.16-2.9-.82 1.19-.28 1.9-1.16 2.11-2.05.17-.8-.15-1.46-.28-2.23-.12-.74-.1-1.37.17-2.06.19.38.39.76.63 1.06.77 1 1.98 1.44 2.24 2.8.04.14.06.28.06.43.03.82-.33 1.72-.93 2.27"/></svg>',
746
+ success: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M21 7 9 19l-5.5-5.5 1.41-1.41L9 16.17 19.59 5.59z"/></svg>',
747
+ question: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m15.07 11.25-.9.92C13.45 12.89 13 13.5 13 15h-2v-.5c0-1.11.45-2.11 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41a2 2 0 0 0-2-2 2 2 0 0 0-2 2H8a4 4 0 0 1 4-4 4 4 0 0 1 4 4 3.2 3.2 0 0 1-.93 2.25M13 19h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10c0-5.53-4.5-10-10-10"/></svg>',
748
+ warning: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M13 14h-2V9h2m0 9h-2v-2h2M1 21h22L12 2z"/></svg>',
749
+ failure: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>',
750
+ danger: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m11.5 20 4.86-9.73H13V4l-5 9.73h3.5zM12 2c2.75 0 5.1 1 7.05 2.95S22 9.25 22 12s-1 5.1-2.95 7.05S14.75 22 12 22s-5.1-1-7.05-2.95S2 14.75 2 12s1-5.1 2.95-7.05S9.25 2 12 2"/></svg>',
751
+ bug: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m11 13h2v1h-2zm10-8v6c0 5.5-3.8 10.7-9 12-5.2-1.3-9-6.5-9-12V5l9-4zm-4 5h-2.2c-.2-.6-.6-1.1-1.1-1.5l1.2-1.2-.7-.7L12.8 8H12c-.2 0-.5 0-.7.1L9.9 6.6l-.8.8 1.2 1.2c-.5.3-.9.8-1.1 1.4H7v1h2v1H7v1h2v1H7v1h2.2c.4 1.2 1.5 2 2.8 2s2.4-.8 2.8-2H17v-1h-2v-1h2v-1h-2v-1h2zm-6 2h2v-1h-2z"/></svg>',
752
+ example: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M7 2v2h1v14a4 4 0 0 0 4 4 4 4 0 0 0 4-4V4h1V2zm4 14c-.6 0-1-.4-1-1s.4-1 1-1 1 .4 1 1-.4 1-1 1m2-4c-.6 0-1-.4-1-1s.4-1 1-1 1 .4 1 1-.4 1-1 1m1-5h-4V4h4z"/></svg>',
753
+ quote: '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M14 17h3l2-4V7h-6v6h3M6 17h3l2-4V7H5v6h3z"/></svg>'
754
+ };
755
+ var chevronSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>';
756
+
757
+ // node_modules/@dogsbay/render-html/dist/callout-markup.js
758
+ var VARIANT_ALIAS = { important: "info", caution: "danger", error: "failure", hint: "tip", attention: "warning" };
759
+ var ALERT_BASE = "relative w-full rounded-lg border p-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:size-4 [&>svg~div]:pl-7";
760
+ var ALERT_VARIANT = {
761
+ note: "border-note/50 bg-note/5 text-foreground [&>svg]:text-note",
762
+ abstract: "border-abstract/50 bg-abstract/5 text-foreground [&>svg]:text-abstract",
763
+ info: "border-info/50 bg-info/5 text-foreground [&>svg]:text-info",
764
+ tip: "border-tip/50 bg-tip/5 text-foreground [&>svg]:text-tip",
765
+ success: "border-success/50 bg-success/5 text-foreground [&>svg]:text-success",
766
+ question: "border-question/50 bg-question/5 text-foreground [&>svg]:text-question",
767
+ warning: "border-warning/50 bg-warning/5 text-foreground [&>svg]:text-warning",
768
+ failure: "border-failure/50 bg-failure/5 text-foreground [&>svg]:text-failure",
769
+ danger: "border-danger/50 bg-danger/5 text-foreground [&>svg]:text-danger",
770
+ bug: "border-bug/50 bg-bug/5 text-foreground [&>svg]:text-bug",
771
+ example: "border-example/50 bg-example/5 text-foreground [&>svg]:text-example",
772
+ quote: "border-quote/50 bg-quote/5 text-foreground [&>svg]:text-quote"
773
+ };
774
+ var ALERT_TITLE_CLASS = "mb-1 text-sm font-semibold leading-none tracking-tight";
775
+ var ALERT_BODY_CLASS = "text-sm [&_p]:leading-relaxed";
776
+
777
+ // node_modules/@dogsbay/render-html/dist/api-markdown.js
778
+ var md = new lib_default({ html: false, linkify: false, typographer: false });
779
+ var blockMd = new lib_default({ html: false, linkify: false, typographer: false });
780
+ blockMd.renderer.rules.heading_open = () => "<p><strong>";
781
+ blockMd.renderer.rules.heading_close = () => "</strong></p>\n";
782
+ function apiBlockHtml(text) {
783
+ return blockMd.render(text).trim();
784
+ }
785
+ function apiInlineHtml(text) {
786
+ return md.renderInline(text.replace(/\s*\n\s*/g, " ")).trim();
787
+ }
788
+ function apiPropertiesHtml(list3) {
789
+ if (!Array.isArray(list3))
790
+ return list3;
791
+ return list3.map((p) => {
792
+ if (!p || typeof p !== "object")
793
+ return p;
794
+ const o = { ...p };
795
+ if (typeof o.description === "string")
796
+ o.description = apiInlineHtml(o.description);
797
+ if (o.properties)
798
+ o.properties = apiPropertiesHtml(o.properties);
799
+ if (o.items)
800
+ o.items = apiPropertiesHtml(o.items);
801
+ return o;
802
+ });
803
+ }
804
+
805
+ // node_modules/@dogsbay/render-html/dist/api.js
806
+ var str = (v) => v == null || v === "" ? void 0 : String(v);
807
+ var list2 = (v) => Array.isArray(v) ? v.filter((x) => x && typeof x === "object") : [];
808
+ var API_NODE_TYPES = /* @__PURE__ */ new Set(["api-class", "api-member", "api-doc", "api-params", "api-source", "endpoint"]);
809
+ function renderApiNode(n, ctx) {
810
+ switch (n.type) {
811
+ case "api-class":
812
+ case "api-member":
813
+ return apiSymbol(n, ctx);
814
+ case "api-doc":
815
+ return docSegments(str(n.props?.html) ?? "", "[&>p:first-child]:mt-0 [&>p:last-child]:mb-2", ctx);
816
+ case "api-params":
817
+ return apiParams(n, ctx);
818
+ case "api-source":
819
+ return apiSource(n, ctx);
820
+ case "endpoint":
821
+ return endpoint(n, ctx);
822
+ default:
823
+ return "";
824
+ }
825
+ }
826
+ function apiSymbol(n, ctx) {
827
+ const p = n.props ?? {};
828
+ const name = str(p.name) ?? "";
829
+ const kind = str(p.kind) ?? "func";
830
+ const signature = str(p.signature);
831
+ const bases = Array.isArray(p.bases) ? p.bases.map(String) : [];
832
+ const level = Math.min(6, (ctx.apiParentLevel ?? ctx.lastHeadingLevel ?? 1) + 1);
833
+ const badgeKind = kind === "method" ? "meth" : kind;
834
+ const id = uniqueId(ctx, name.toLowerCase().replace(/[^\w]/g, "-").replace(/-+/g, "-"));
835
+ if (ctx.apiSymbolHeadings)
836
+ ctx.headings.push({ depth: level, id, text: name });
837
+ return `<div class="api-symbol" data-kind="${esc(kind)}"><div class="api-symbol-heading"><span class="api-badge api-badge-${esc(badgeKind)}">${esc(badgeKind)}</span><h${level} id="${esc(id)}" class="!mt-0 !mb-0 !border-0"><code class="text-lg font-semibold">${esc(name)}</code></h${level}></div>` + (signature ? codeHtml(signature, "python", ctx) : "") + (bases.length ? `<p class="api-symbol-bases">Bases: ${bases.map((b) => `<code>${esc(b)}</code>`).join("")}</p>` : "") + `<div class="mt-3">${nested(ctx, level, () => renderBlocks(n.children, ctx))}</div></div>
838
+ `;
839
+ }
840
+ function nested(ctx, level, f) {
841
+ const was = ctx.apiParentLevel;
842
+ ctx.apiParentLevel = level;
843
+ try {
844
+ return f();
845
+ } finally {
846
+ ctx.apiParentLevel = was;
847
+ }
848
+ }
849
+ var CODE_IN_HTML = /<pre><code(?:\s+class="language-(\w+)")?>([\s\S]*?)<\/code><\/pre>/g;
850
+ var decodeCode = (s) => s.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"');
851
+ function splitCode(html) {
852
+ const out = [];
853
+ let last = 0;
854
+ for (const m of html.matchAll(CODE_IN_HTML)) {
855
+ if (m.index > last)
856
+ out.push({ html: html.slice(last, m.index) });
857
+ out.push({ code: decodeCode(m[2]), lang: m[1] || "python" });
858
+ last = m.index + m[0].length;
859
+ }
860
+ if (last < html.length)
861
+ out.push({ html: html.slice(last) });
862
+ return out;
863
+ }
864
+ function docSegments(html, edges, ctx) {
865
+ return splitCode(html).map((s) => "code" in s ? codeHtml(s.code, s.lang, ctx) : `<div class="prose prose-sm dark:prose-invert max-w-none ${edges}">${rewriteHtml(s.html, ctx)}</div>`).join("");
866
+ }
867
+ function apiParams(n, ctx) {
868
+ const rows = list2(n.props?.params).map((p) => {
869
+ const type = str(p.type);
870
+ const dflt = str(p.default);
871
+ return `<tr class="border-b border-border/50"><td class="py-3 px-4 align-top"><code class="text-sm font-medium">${esc(str(p.name) ?? "")}</code></td><td class="py-3 px-4 align-top">${docSegments(str(p.docHtml) ?? "", "[&>p:first-child]:mt-0 [&>p:last-child]:mb-0", ctx)}<div class="flex items-center gap-4 mt-2 text-xs text-muted-foreground">` + (type ? `<span><strong>TYPE:</strong> <code class="text-xs">${esc(type)}</code></span>` : "") + (dflt ? `<span class="ml-auto"><strong>DEFAULT:</strong> <code class="text-xs">${esc(dflt)}</code></span>` : "") + `</div></td></tr>`;
872
+ }).join("");
873
+ const th = "py-3 px-4 text-left font-semibold text-muted-foreground uppercase tracking-wider text-xs";
874
+ return `<table class="api-params w-full text-sm border-collapse"><thead><tr class="border-b border-border"><th class="${th} w-[140px]">Parameter</th><th class="${th}">Description</th></tr></thead><tbody>${rows}</tbody></table>
875
+ `;
876
+ }
877
+ function apiSource(n, ctx) {
878
+ const p = n.props ?? {};
879
+ const file = str(p.file);
880
+ const line = Number(p.line) || void 0;
881
+ const label = file ? `Source code in ${file}${line ? `, line ${line}` : ""}` : "Source code";
882
+ return `<details class="api-source"><summary>${esc(label)}</summary>${codeHtml(str(p.code) ?? "", "python", ctx)}</details>
883
+ `;
884
+ }
885
+ var METHODS = ["get", "post", "put", "patch", "delete", "head"];
886
+ function methodBadge(method) {
887
+ const v = METHODS.includes(method) ? ` bg-api-${method}/20 text-api-${method}` : method === "options" ? " bg-muted/20 text-muted-foreground" : "";
888
+ return `<span class="inline-flex items-center rounded-md px-2 py-0.5 text-xs font-bold uppercase tracking-wide font-mono${v}" data-method="${esc(method)}">${esc(method)}</span>`;
889
+ }
890
+ function urlBar(method, path, baseUrl) {
891
+ const tint = METHODS.includes(method) ? `border px-4 py-3 bg-api-${method}/10 border-l-api-${method}` : method === "options" ? "border px-4 py-3 bg-muted/40 border-l-muted-foreground" : "border border-l-current px-4 py-3";
892
+ const parts = path.split(/(\{[^}]+\})/g).map((s) => s.startsWith("{") ? `<span class="text-api-put">${esc(s)}</span>` : `<span>${esc(s)}</span>`).join("");
893
+ const copy = `<db-code-block class="shrink-0" data-copy-text="${esc(baseUrl + path)}"><button type="button" data-part="copy" aria-label="Copy to clipboard" class="inline-flex h-8 w-8 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">${COPY_ICON}${CHECK_ICON}</button></db-code-block>`;
894
+ return `<div class="flex items-center gap-3 rounded-lg ${tint}">${methodBadge(method)}<code class="flex-1 truncate text-sm font-medium">${baseUrl ? `<span class="text-muted-foreground">${esc(baseUrl)}</span>` : ""}${parts}</code>${copy}</div>`;
895
+ }
896
+ var SECTION_CHEVRON = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-3.5 shrink-0 text-muted-foreground transition-transform duration-200" data-section-chevron aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>';
897
+ var PROPERTY_CHEVRON = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-3 shrink-0 text-muted-foreground transition-transform duration-200" data-property-chevron aria-hidden="true"><polyline points="9 18 15 12 9 6"></polyline></svg>';
898
+ var DEPRECATED_ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"></path><path d="M12 9v4"></path><path d="M12 17h.01"></path></svg>';
899
+ function section(title, body) {
900
+ return `<details open class="rounded-lg border bg-card"><summary class="flex cursor-pointer items-center gap-2 px-4 py-3 text-sm font-semibold list-none [&::-webkit-details-marker]:hidden hover:bg-muted/50 select-none">${SECTION_CHEVRON}<span>${esc(title)}</span></summary><div class="px-4 pb-4 pt-1">${body}</div></details>`;
901
+ }
902
+ var TYPE_TINT = {
903
+ string: "bg-api-type-string/20 text-api-type-string",
904
+ number: "bg-api-type-number/20 text-api-type-number",
905
+ integer: "bg-api-type-number/20 text-api-type-number",
906
+ boolean: "bg-api-type-boolean/20 text-api-type-boolean",
907
+ object: "bg-api-type-object/20 text-api-type-object",
908
+ array: "bg-api-type-array/20 text-api-type-array",
909
+ null: "bg-muted/20 text-muted-foreground"
910
+ };
911
+ function propertyItem(p, level, ctx) {
912
+ const name = esc(str(p.name) ?? "");
913
+ const type = str(p.type) ?? "";
914
+ const format = str(p.format);
915
+ const description = str(p.description);
916
+ const children = list2(p.properties).length ? list2(p.properties) : list2(p.items);
917
+ const indent = level * 16;
918
+ const badge = `<span class="rounded px-1.5 py-0.5 text-[10px] font-medium ${Object.hasOwn(TYPE_TINT, type) ? TYPE_TINT[type] : TYPE_TINT.string}">${esc(type)}${format ? esc(` <${format}>`) : ""}</span>` + (p.nullable === true ? '<span class="text-muted-foreground text-[10px]">nullable</span>' : "");
919
+ const required = p.required === true ? '<span class="text-[10px] font-semibold uppercase text-api-required">required</span>' : "";
920
+ const outer = `border-b border-border last:border-b-0${p.deprecated === true ? " opacity-60" : ""}`;
921
+ const pad = indent > 0 ? ` style="padding-left: ${16 + indent}px;"` : "";
922
+ const desc = (cls, style = "") => description ? `<p class="${cls}"${style}>${rewriteHtml(description, ctx)}</p>` : "";
923
+ if (children.length) {
924
+ return `<div class="${outer}"><details><summary class="flex cursor-pointer items-start justify-between gap-4 px-4 py-3 list-none [&::-webkit-details-marker]:hidden hover:bg-muted/50 rounded"${pad}><div class="flex items-center gap-2 min-w-0">${PROPERTY_CHEVRON}<code class="text-sm font-semibold">${name}</code>${badge}</div><div class="flex shrink-0 items-center gap-2">${required}</div></summary>` + desc("px-4 pb-1 text-sm text-muted-foreground", ` style="padding-left: ${32 + indent}px;"`) + `<div class="border-l border-border" style="margin-left: ${24 + indent}px;">${children.map((c) => propertyItem(c, level + 1, ctx)).join("")}</div></details></div>`;
925
+ }
926
+ const sub = level > 0 ? " pl-5" : "";
927
+ const enums = Array.isArray(p.enum) ? p.enum : void 0;
928
+ return `<div class="${outer}"><div class="flex items-start justify-between gap-4 px-4 py-3"${pad}><div class="min-w-0 flex-1"><div class="flex items-center gap-2">${level > 0 ? '<span class="size-3 shrink-0"></span>' : ""}<code class="text-sm font-semibold">${name}</code>${badge}</div>` + desc(`mt-1 text-sm text-muted-foreground${sub}`) + (enums ? `<div class="mt-1.5 flex flex-wrap items-center gap-1 text-[10px]${sub}"><span class="text-muted-foreground">Enum:</span>${enums.map((v) => `<code class="rounded bg-muted px-1.5 py-0.5">${esc(v)}</code>`).join("")}</div>` : "") + (p.example !== void 0 ? `<div class="mt-1 text-xs text-muted-foreground${sub}">Example: <code class="rounded bg-muted px-1 py-0.5">${esc(JSON.stringify(p.example))}</code></div>` : "") + (p.default !== void 0 ? `<div class="mt-1 text-xs text-muted-foreground${sub}">Default: <code class="rounded bg-muted px-1 py-0.5">${esc(JSON.stringify(p.default))}</code></div>` : "") + `</div><div class="flex shrink-0 items-center gap-2 pt-0.5">${required}</div></div></div>`;
929
+ }
930
+ var LOCATIONS = [
931
+ ["path", "Path Parameters"],
932
+ ["query", "Query Parameters"],
933
+ ["header", "Header Parameters"],
934
+ ["cookie", "Cookie Parameters"]
935
+ ];
936
+ function propertyList(params, ctx) {
937
+ const groups = LOCATIONS.map(([loc, label]) => ({ label, items: params.filter((p) => p.in === loc) })).filter((g) => g.items.length);
938
+ return `<div>` + groups.map((g) => `<div class="mb-4 last:mb-0"><p class="mb-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">${g.label}</p><div class="rounded-lg border bg-card">${g.items.map((p) => propertyItem(p, 0, ctx)).join("")}</div></div>`).join("") + `</div>`;
939
+ }
940
+ function schemaViewer(props, ctx) {
941
+ return `<div class="rounded-lg border bg-card"><div>${props.map((p) => propertyItem(p, 0, ctx)).join("")}</div></div>`;
942
+ }
943
+ var TABS_ROOT = { class: "my-4 w-full overflow-hidden rounded-lg border border-border" };
944
+ function distinct(values) {
945
+ const used = /* @__PURE__ */ new Set();
946
+ return values.map((v, i) => {
947
+ while (used.has(v))
948
+ v += ` (${i + 1})`;
949
+ used.add(v);
950
+ return v;
951
+ });
952
+ }
953
+ function statusTint(status) {
954
+ const c = status[0];
955
+ return c >= "2" && c <= "5" ? `bg-api-status-${c}xx/20 text-api-status-${c}xx` : "bg-muted/20 text-muted-foreground";
956
+ }
957
+ function responseTabs(responses, ctx) {
958
+ const values = distinct(responses.map((r) => String(r.status ?? "")));
959
+ return tabGroup(responses.map((r, i) => {
960
+ const status = String(r.status ?? "");
961
+ const description = str(r.description);
962
+ return {
963
+ value: values[i],
964
+ label: `<span class="rounded px-1.5 py-0.5 text-xs font-mono font-bold ${statusTint(status)}">${esc(status)}</span>`,
965
+ body: () => (description ? `<p class="mb-3 text-sm text-muted-foreground">${esc(description)}</p>` : "") + (Array.isArray(r.schema) ? schemaViewer(list2(r.schema), ctx) : "")
966
+ };
967
+ }), ctx, TABS_ROOT);
968
+ }
969
+ var SAMPLE_LABELS = {
970
+ curl: "cURL",
971
+ python: "Python",
972
+ typescript: "TypeScript",
973
+ javascript: "JavaScript",
974
+ go: "Go",
975
+ ruby: "Ruby",
976
+ java: "Java",
977
+ csharp: "C#",
978
+ php: "PHP",
979
+ rust: "Rust"
980
+ };
981
+ var sampleLang = (language) => language === "curl" ? "bash" : language;
982
+ function codeSamples(samples, ctx) {
983
+ const values = distinct(samples.map((s) => str(s.language) ?? ""));
984
+ return tabGroup(samples.map((s, i) => {
985
+ const language = str(s.language) ?? "";
986
+ return {
987
+ value: values[i],
988
+ label: esc(str(s.label) ?? SAMPLE_LABELS[language] ?? language),
989
+ body: () => codeHtml(str(s.code) ?? "", sampleLang(language), ctx)
990
+ };
991
+ }), ctx, TABS_ROOT);
992
+ }
993
+ var CONTENT_TYPE_LANG = {
994
+ "application/json": "json",
995
+ "application/xml": "xml",
996
+ "application/x-www-form-urlencoded": "plaintext",
997
+ "text/xml": "xml",
998
+ "text/html": "html",
999
+ "text/plain": "plaintext",
1000
+ "text/yaml": "yaml",
1001
+ "application/yaml": "yaml",
1002
+ "application/x-yaml": "yaml",
1003
+ "multipart/form-data": "plaintext"
1004
+ };
1005
+ function exampleLang(contentType) {
1006
+ if (!contentType)
1007
+ return "json";
1008
+ const base = contentType.split(";")[0].trim();
1009
+ const known = CONTENT_TYPE_LANG[contentType] ?? CONTENT_TYPE_LANG[base];
1010
+ if (known)
1011
+ return known;
1012
+ if (base.includes("json"))
1013
+ return "json";
1014
+ if (base.includes("xml"))
1015
+ return "xml";
1016
+ if (base.includes("yaml") || base.includes("yml"))
1017
+ return "yaml";
1018
+ return "json";
1019
+ }
1020
+ var PANEL_LABEL = "mb-3 text-xs font-semibold uppercase tracking-wider text-white/60";
1021
+ function codePanels(p) {
1022
+ const out = [];
1023
+ const samples = list2(p.codeSamples);
1024
+ if (samples.length)
1025
+ out.push({ title: "Code samples", samples });
1026
+ if (p.requestBodyExample !== void 0)
1027
+ out.push({ title: "Request body", code: JSON.stringify(p.requestBodyExample, null, 2), lang: "json" });
1028
+ for (const r of list2(p.responses)) {
1029
+ if (r.example === void 0)
1030
+ continue;
1031
+ out.push({ title: `Response ${String(r.status ?? "")}`, code: JSON.stringify(r.example, null, 2), lang: exampleLang(str(r.contentType)) });
1032
+ }
1033
+ return out;
1034
+ }
1035
+ function endpoint(n, ctx) {
1036
+ const p = n.props ?? {};
1037
+ const method = (str(p.method) ?? "get").toLowerCase();
1038
+ const path = str(p.path) ?? "";
1039
+ const baseUrl = str(p.baseUrl) ?? "";
1040
+ const summary = str(p.summary);
1041
+ const description = typeof p.description === "string" && p.description && p.description !== p.summary ? apiBlockHtml(p.description) : void 0;
1042
+ const deprecated = p.deprecated === true;
1043
+ const parameters = list2(apiPropertiesHtml(p.parameters));
1044
+ const requestBody = list2(apiPropertiesHtml(p.requestBody));
1045
+ const responses = list2(p.responses).map((r) => Array.isArray(r.schema) ? { ...r, schema: apiPropertiesHtml(r.schema) } : r);
1046
+ const sections = (parameters.length ? section("Parameters", propertyList(parameters, ctx)) : "") + (requestBody.length ? section("Request body", schemaViewer(requestBody, ctx)) : "") + (responses.length ? section("Responses", responseTabs(responses, ctx)) : "");
1047
+ const card2 = `<div${attrs({ class: "space-y-4", "data-component": "endpoint-card", "data-deprecated": deprecated })}>` + urlBar(method, path, baseUrl) + (deprecated ? `<div class="flex items-center gap-2 rounded-lg border border-api-deprecated/30 bg-api-deprecated/10 px-4 py-2 text-sm text-api-deprecated">${DEPRECATED_ICON}<span>This endpoint is deprecated.</span></div>` : "") + (summary ? `<p class="text-sm text-muted-foreground">${esc(summary)}</p>` : "") + (description ? `<div class="api-description text-sm text-muted-foreground">${rewriteHtml(description, ctx)}</div>` : "") + `<div class="space-y-3">${sections}</div></div>`;
1048
+ const panels = codePanels(p).map((c) => c.samples ? `<div><p class="${PANEL_LABEL}">${esc(c.title)}</p>${codeSamples(c.samples, ctx)}</div>` : `<div><p class="${PANEL_LABEL}">${esc(c.title)}</p>${codeHtml(c.code, c.lang, ctx)}</div>`).join("");
1049
+ const page = ctx.embeddedEndpoints === false;
1050
+ return `<div class="dba-api grid grid-cols-1 lg:grid-cols-2 ${page ? "lg:min-h-[calc(100vh-3rem)]" : "my-6 rounded-lg border overflow-hidden"}"><div class="${page ? "px-6 py-10" : "p-6"} lg:border-r">${card2}</div><div class="bg-[var(--api-panel-bg)] text-[var(--api-panel-fg)]"><div class="${page ? "px-6 py-10 lg:sticky lg:top-12 lg:max-h-[calc(100vh-3rem)] lg:overflow-y-auto" : "p-6"}"><div class="space-y-8">${panels}</div></div></div></div>
1051
+ `;
1052
+ }
1053
+ function apiCodeInputs(n) {
1054
+ const p = n.props ?? {};
1055
+ const fromHtml = (html) => splitCode(html ?? "").flatMap((s) => "code" in s ? [{ lang: s.lang, code: s.code }] : []);
1056
+ switch (n.type) {
1057
+ case "api-class":
1058
+ case "api-member":
1059
+ return str(p.signature) ? [{ lang: "python", code: String(p.signature) }] : [];
1060
+ case "api-source":
1061
+ return [{ lang: "python", code: str(p.code) ?? "" }];
1062
+ case "api-doc":
1063
+ return fromHtml(str(p.html));
1064
+ case "api-params":
1065
+ return list2(p.params).flatMap((x) => fromHtml(str(x.docHtml)));
1066
+ case "endpoint":
1067
+ return codePanels(p).flatMap((c) => c.samples ? c.samples.map((s) => ({ lang: sampleLang(str(s.language) ?? ""), code: str(s.code) ?? "" })) : [{ lang: c.lang, code: c.code }]);
1068
+ default:
1069
+ return [];
1070
+ }
1071
+ }
1072
+
1073
+ // node_modules/@dogsbay/render-html/dist/choice-code.js
1074
+ var NAME = /^[a-z][a-z0-9-]{0,39}$/;
1075
+ var KEY = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$/;
1076
+ var ENTITY = /&(?:#(\d+)|#x([0-9a-fA-F]+)|(amp|lt|gt|quot|apos|#39));/g;
1077
+ var NAMED = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", "#39": "'" };
1078
+ var decode = (s) => s.replace(ENTITY, (_m, dec, hex, name) => dec ? String.fromCodePoint(Number(dec)) : hex ? String.fromCodePoint(parseInt(hex, 16)) : NAMED[name] ?? _m);
1079
+ function visibleText(html) {
1080
+ return decode(html.replace(/<[^>]*>/g, ""));
1081
+ }
1082
+ function wrapChoiceRanges(html, code, ranges, seq) {
1083
+ const usable = usableRanges(ranges, code.length);
1084
+ if (!usable)
1085
+ return html;
1086
+ const shown = visibleText(html);
1087
+ const want = code.replace(/\n$/, "");
1088
+ if (shown !== want && shown.replace(/\n$/, "") !== want)
1089
+ return html;
1090
+ const ids = usable.map(() => seq());
1091
+ const pieces = usable.map(() => 0);
1092
+ let out = "";
1093
+ let at = 0;
1094
+ let r = 0;
1095
+ let open = false;
1096
+ const openTag = (i) => `<span data-choice-value="${usable[i].choice}:${usable[i].key}" data-choice-part="${ids[i]}/${pieces[i]++}">`;
1097
+ const empties = () => {
1098
+ while (!open && r < usable.length && usable[r].from === at && usable[r].to === at) {
1099
+ out += `${openTag(r)}</span>`;
1100
+ r++;
1101
+ }
1102
+ };
1103
+ for (const part of html.split(/(<[^>]*>)/)) {
1104
+ if (!part)
1105
+ continue;
1106
+ if (part.startsWith("<")) {
1107
+ if (part.startsWith("</"))
1108
+ empties();
1109
+ if (open)
1110
+ out += "</span>";
1111
+ out += part;
1112
+ if (open)
1113
+ out += openTag(r);
1114
+ continue;
1115
+ }
1116
+ for (const m of part.matchAll(/&(?:#\d+|#x[0-9a-fA-F]+|[a-z]+|#39);|[\s\S]/g)) {
1117
+ const ch = m[0];
1118
+ empties();
1119
+ if (!open && r < usable.length && at === usable[r].from) {
1120
+ out += openTag(r);
1121
+ open = true;
1122
+ }
1123
+ out += ch;
1124
+ at += ch.length > 1 && ch.startsWith("&") && ch.endsWith(";") ? decode(ch).length : ch.length;
1125
+ if (open && at === usable[r].to) {
1126
+ out += "</span>";
1127
+ open = false;
1128
+ r++;
1129
+ }
1130
+ }
1131
+ }
1132
+ if (open)
1133
+ out += "</span>";
1134
+ return out.replace(/<span data-choice-value="[^"]*" data-choice-part="\d+\/[1-9]\d*"><\/span>/g, "");
1135
+ }
1136
+ function usableRanges(ranges, length) {
1137
+ const usable = ranges.filter((r) => NAME.test(r.choice) && KEY.test(r.key) && Number.isInteger(r.from) && Number.isInteger(r.to) && r.from >= 0 && r.to >= r.from && r.to <= length).sort((a, b) => a.from - b.from || a.to - b.to);
1138
+ if (!usable.length)
1139
+ return void 0;
1140
+ for (let i = 1; i < usable.length; i++)
1141
+ if (usable[i].from < usable[i - 1].to)
1142
+ return void 0;
1143
+ return usable;
1144
+ }
1145
+ function markChoiceText(text, ranges, seq) {
1146
+ const usable = usableRanges(ranges, text.length);
1147
+ if (!usable)
1148
+ return esc2(text);
1149
+ let out = "";
1150
+ let at = 0;
1151
+ for (const r of usable) {
1152
+ out += esc2(text.slice(at, r.from));
1153
+ out += `<span data-choice-value="${r.choice}:${r.key}" data-choice-part="${seq()}/0">${esc2(text.slice(r.from, r.to))}</span>`;
1154
+ at = r.to;
1155
+ }
1156
+ return out + esc2(text.slice(at));
1157
+ }
1158
+ var esc2 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1159
+
1160
+ // node_modules/@dogsbay/render-html/dist/render.js
1161
+ function choiceSelect(p, ctx, meta) {
1162
+ const c = meta?.choice;
1163
+ const name = str2(p.name);
1164
+ if (!c || !name || !CHOICE_NAME.test(name) || !Array.isArray(c.values)) {
1165
+ ctx.unknown.add(":::choice-select");
1166
+ return "";
1167
+ }
1168
+ const id = uniqueId(ctx, `choice-${name}`);
1169
+ const options = c.values.filter((v) => CHOICE_VALUE.test(v.value)).map((v) => `<option${attrs({ value: v.value, selected: v.value === c.default || void 0 })}>${esc(v.label ?? v.value)}</option>`).join("");
1170
+ const label = str2(p.label) ?? c.label ?? name;
1171
+ return `<db-choice-select${attrs({ name, class: "my-4 flex items-center gap-2 text-sm" })}><label for="${esc(id)}" class="font-medium">${esc(label)}</label><select id="${esc(id)}" data-part="select" class="h-9 rounded-md border border-input bg-background px-2">${options}</select></db-choice-select>
1172
+ `;
1173
+ }
1174
+ var CHOICE_NAME = /^[a-z][a-z0-9-]{0,39}$/;
1175
+ var CHOICE_VALUE = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$/;
1176
+ function whenAttrs(when) {
1177
+ const out = {};
1178
+ for (const [name, raw] of Object.entries(when ?? {})) {
1179
+ if (!CHOICE_NAME.test(name) || /^(?:id|class|style|role|title|data-.*|aria-.*)$/.test(name))
1180
+ continue;
1181
+ const values = (Array.isArray(raw) ? raw : String(raw).split(/\s+/)).filter((v) => CHOICE_VALUE.test(v));
1182
+ if (values.length)
1183
+ out[`data-when-${name}`] = values.join(" ");
1184
+ }
1185
+ return out;
1186
+ }
1187
+ function linkUrl(href, ctx) {
1188
+ if (scriptUrl(href, "link")) {
1189
+ ctx.unsafeUrls?.add(href.slice(0, 80));
1190
+ return "#";
1191
+ }
1192
+ return ctx.link(followRenamedId(href));
1193
+ }
1194
+ function assetUrl(src, ctx) {
1195
+ if (scriptUrl(src, "image")) {
1196
+ ctx.unsafeUrls?.add(src.slice(0, 80));
1197
+ return "";
1198
+ }
1199
+ return ctx.asset(src);
1200
+ }
1201
+ function renderMath(latex, display, ctx) {
1202
+ if (!ctx.math)
1203
+ return void 0;
1204
+ ctx.usedMath = true;
1205
+ try {
1206
+ const html = ctx.math(latex, display);
1207
+ if (typeof html !== "string")
1208
+ throw new TypeError("math renderer returned no string");
1209
+ return `${FOREIGN_START}${html.replaceAll(FOREIGN_START, "").replaceAll(FOREIGN_END, "")}${FOREIGN_END}`;
1210
+ } catch {
1211
+ return `<code class="text-destructive">${esc(latex)}</code>`;
1212
+ }
1213
+ }
1214
+ function uniqueId(ctx, base) {
1215
+ base = pageId(base);
1216
+ let id = base || "section";
1217
+ let n = 1;
1218
+ while (ctx.ids.has(id))
1219
+ id = `${base}-${++n}`;
1220
+ ctx.ids.add(id);
1221
+ return id;
1222
+ }
1223
+ function renderInline(nodes, ctx) {
1224
+ if (!nodes)
1225
+ return "";
1226
+ let out = "";
1227
+ for (const n of nodes)
1228
+ out += inline(n, ctx);
1229
+ return out;
1230
+ }
1231
+ function withVariables(text, ranges) {
1232
+ let out = "";
1233
+ let at = 0;
1234
+ for (const r of [...ranges].sort((a, b) => a.from - b.from)) {
1235
+ if (r.from < at || r.to > text.length || r.to <= r.from)
1236
+ continue;
1237
+ out += esc(text.slice(at, r.from)) + `<span data-var="${esc(r.name)}" data-var-index="${Number(r.index) | 0}">${esc(text.slice(r.from, r.to))}</span>`;
1238
+ at = r.to;
1239
+ }
1240
+ return out + esc(text.slice(at));
1241
+ }
1242
+ function decorate(html, n) {
1243
+ if (n.strikethrough)
1244
+ html = `<del>${html}</del>`;
1245
+ if (n.italic)
1246
+ html = `<em>${html}</em>`;
1247
+ if (n.bold)
1248
+ html = `<strong>${html}</strong>`;
1249
+ return html;
1250
+ }
1251
+ function inline(n, ctx) {
1252
+ if (n.type === DIFF_RUN)
1253
+ return inlineSegmentsToHtml(n.segments ?? []);
1254
+ switch (n.type) {
1255
+ case "text":
1256
+ return decorate(n.variables?.length ? withVariables(n.text, n.variables) : esc(n.text), n);
1257
+ case "code":
1258
+ return decorate(`<code>${n.choiceValues?.length ? markChoiceText(n.text, n.choiceValues, () => ++ctx.seq) : esc(n.text)}</code>`, n);
1259
+ case "link": {
1260
+ if (ctx.inLink)
1261
+ return renderInline(n.children, ctx);
1262
+ const href = linkUrl(n.href, ctx);
1263
+ const external = /^[a-z][a-z0-9+.-]*:|^\/\//i.test(href) && !href.startsWith("mailto:");
1264
+ const variant = n.button ? buttonVariant(n.button.variant, ctx) : void 0;
1265
+ const a = {
1266
+ // Button.astro's small size, whose text-xs replaces the base text-sm (tailwind-merge in tv()).
1267
+ ...passthrough(n.attrs, variant ? `${BUTTON_BASE.split(" ").filter((c) => c !== "text-sm").join(" ")} ${lookup(BUTTON_VARIANTS, variant) ?? BUTTON_VARIANTS.default} h-9 px-3 text-xs no-underline` : void 0),
1268
+ href,
1269
+ title: n.title,
1270
+ "data-variant": variant,
1271
+ "data-size": variant ? "sm" : void 0
1272
+ };
1273
+ if (external)
1274
+ a.rel = "noopener";
1275
+ if (!variant)
1276
+ a["data-link-kind"] = external ? "external" : href.startsWith("#") ? void 0 : "internal";
1277
+ return `<a${attrs(a)}>${insideLink(true, ctx, () => renderInline(n.children, ctx))}</a>`;
1278
+ }
1279
+ case "image": {
1280
+ const at = n.attrs ?? {};
1281
+ return `<img${attrs({
1282
+ ...passthrough(at),
1283
+ src: assetUrl(n.src, ctx),
1284
+ alt: n.alt ?? "",
1285
+ title: n.title,
1286
+ width: n.width ?? at.width,
1287
+ height: n.height ?? at.height,
1288
+ loading: "lazy",
1289
+ decoding: "async",
1290
+ // As @dogsbay/plugin-image-zoom's walker: the link's own click wins over zooming. An author's
1291
+ // own data-zoomable (to opt one image out with "false") is kept.
1292
+ "data-zoomable": at["data-zoomable"] ?? (ctx.imageZoom && !(ctx.inLink && ctx.imageZoom === "outside-links") ? "true" : void 0)
1293
+ })}>`;
1294
+ }
1295
+ case "highlight":
1296
+ return `<mark class="rounded-sm bg-yellow-200/60 px-0.5 dark:bg-yellow-500/30">${renderInline(n.children, ctx)}</mark>`;
1297
+ case "choice-value": {
1298
+ if (n.text === void 0) {
1299
+ ctx.unknown.add("inline:choice-value");
1300
+ return n.form === "link" && n.children?.length ? renderInline(n.children, ctx) : "";
1301
+ }
1302
+ const mark = CHOICE_NAME.test(n.choice) && /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$/.test(n.key) ? `${n.choice}:${n.key}` : void 0;
1303
+ if (n.form === "link") {
1304
+ const link = { type: "link", href: n.text, children: n.children?.length ? n.children : [{ type: "text", text: n.text }], ...mark ? { attrs: { "data-choice-value": mark, "data-choice-href": "true" } } : {} };
1305
+ return renderInline([link], ctx);
1306
+ }
1307
+ if (n.form === "code")
1308
+ return `<code${attrs({ "data-choice-value": mark })}>${esc(n.text)}</code>`;
1309
+ return mark ? `<span${attrs({ "data-choice-value": mark })}>${esc(n.text)}</span>` : esc(n.text);
1310
+ }
1311
+ case "when":
1312
+ return `<span${attrs(whenAttrs(n.when))}>${renderInline(n.children, ctx)}</span>`;
1313
+ case "footnote-ref": {
1314
+ const label = esc(n.label);
1315
+ const refs = ctx.fnRefs ??= /* @__PURE__ */ new Map();
1316
+ const count = (refs.get(n.label) ?? 0) + 1;
1317
+ refs.set(n.label, count);
1318
+ const id = count === 1 ? `fnref-${label}` : `fnref-${label}-${count}`;
1319
+ return `<sup><a id="${id}" href="#fn-${label}" role="doc-noteref" class="text-primary hover:underline">[${label}]</a></sup>`;
1320
+ }
1321
+ case "kbd":
1322
+ return n.keys.map((k) => `<kbd class="${KBD_CLASS}">${esc(k)}</kbd>`).join("+");
1323
+ case "badge": {
1324
+ const variant = n.variant ?? "default";
1325
+ return `<span${attrs({ ...passthrough(n.attrs, badgeClass(variant)), "data-variant": variant })}>${esc(n.text)}</span>`;
1326
+ }
1327
+ case "icon":
1328
+ return namedIcon((n.library ? n.library + ":" : "") + n.name, "db-icon db-icon-inline", ctx);
1329
+ case "math":
1330
+ return renderMath(n.latex, false, ctx) ?? `<code class="db-math">${esc(n.latex)}</code>`;
1331
+ case "html-inline":
1332
+ return rewriteHtml(n.html, ctx);
1333
+ case "break":
1334
+ return "<br>";
1335
+ default:
1336
+ ctx.unknown.add(`inline:${n.type}`);
1337
+ return "";
1338
+ }
1339
+ }
1340
+ function inlineText(nodes) {
1341
+ if (!nodes)
1342
+ return "";
1343
+ let out = "";
1344
+ for (const n of nodes) {
1345
+ switch (n.type) {
1346
+ case "text":
1347
+ case "code":
1348
+ out += n.text;
1349
+ break;
1350
+ case "link":
1351
+ case "highlight":
1352
+ case "when":
1353
+ out += inlineText(n.children);
1354
+ break;
1355
+ case "choice-value":
1356
+ out += n.form === "link" && n.children?.length ? inlineText(n.children) : n.text ?? "";
1357
+ break;
1358
+ case "kbd":
1359
+ out += n.keys.join("+");
1360
+ break;
1361
+ case "badge":
1362
+ out += n.text;
1363
+ break;
1364
+ case "math":
1365
+ out += n.latex;
1366
+ break;
1367
+ case "image":
1368
+ out += n.alt ?? "";
1369
+ break;
1370
+ case "html-inline":
1371
+ out += n.html.replace(/<[^>]*>/g, "");
1372
+ break;
1373
+ }
1374
+ }
1375
+ return out;
1376
+ }
1377
+ var SCRIPT_ATTRS = /(\s)(href|src|xlink:href|action|formaction|poster|data)(\s*=\s*)("[^"]*"|'[^']*'|[^\s"'=<>`]+)/gi;
1378
+ function refuseScriptAttrs(tag, ctx) {
1379
+ return tag.replace(SCRIPT_ATTRS, (m, sp, attr, eq, raw) => {
1380
+ const quoted = raw.startsWith('"') || raw.startsWith("'");
1381
+ const lower = attr.toLowerCase();
1382
+ if (quoted && (lower === "href" || lower === "src"))
1383
+ return m;
1384
+ const v = unesc(quoted ? raw.slice(1, -1) : raw);
1385
+ if (!scriptUrl(v, lower === "src" || lower === "poster" ? "image" : "link"))
1386
+ return m;
1387
+ ctx.unsafeUrls?.add(v.slice(0, 80));
1388
+ return `${sp}${attr}${eq}"${lower === "href" ? "#" : ""}"`;
1389
+ });
1390
+ }
1391
+ function rewriteHtml(raw, ctx) {
1392
+ const html = ctx.rawHtml ? ctx.rawHtml(raw) : raw;
1393
+ const own = hostAttrNames(ctx);
1394
+ return html.replace(/<[a-zA-Z][^<>]*>/g, (found) => {
1395
+ let tag = found;
1396
+ if (own.size) {
1397
+ const name = /^<[A-Za-z][\w:-]*/.exec(tag)[0];
1398
+ const { kept, end } = dropAttrs(tag, name.length, own);
1399
+ tag = name + kept + tag.slice(end);
1400
+ }
1401
+ return refuseScriptAttrs(tag, ctx).replace(/(\s)(href|src)(\s*=\s*)("([^"]*)"|'([^']*)')/gi, (m, sp, attr, eq, _q, dq, sq) => {
1402
+ const v = unesc(dq ?? sq ?? "");
1403
+ const isHref = attr.toLowerCase() === "href";
1404
+ if (v && scriptUrl(v, isHref ? "link" : "image")) {
1405
+ ctx.unsafeUrls?.add(v.slice(0, 80));
1406
+ return `${sp}${attr}${eq}"${isHref ? "#" : ""}"`;
1407
+ }
1408
+ if (!v || v.startsWith("#") || /^[a-z][a-z0-9+.-]*:|^\/\//i.test(v))
1409
+ return m;
1410
+ const out = isHref ? ctx.link(v) : ctx.asset(v);
1411
+ return `${sp}${attr}${eq}"${esc(out)}"`;
1412
+ });
1413
+ });
1414
+ }
1415
+ function proseHeadings(html, ctx) {
1416
+ return html.replace(/<h([1-6])\b([^>]*)>([\s\S]*?)<\/h\1>/gi, (m, lvl, at, inner) => {
1417
+ const idm = /\sid="([^"]*)"/.exec(at);
1418
+ if (!idm)
1419
+ return m;
1420
+ const id = uniqueId(ctx, unesc(idm[1]));
1421
+ const depth = Number(lvl);
1422
+ if (depth === 2 || depth === 3)
1423
+ ctx.headings.push({ depth, id, text: unesc(inner.replace(/<[^>]*>/g, "")).trim() });
1424
+ return `<h${lvl}${at.replace(idm[0], ` id="${esc(id)}"`)}>${inner}</h${lvl}>`;
1425
+ });
1426
+ }
1427
+ var pageIds = /* @__PURE__ */ new WeakMap();
1428
+ function renderBlocks(nodes, ctx) {
1429
+ if (!nodes)
1430
+ return "";
1431
+ if (!pageIds.has(ctx))
1432
+ pageIds.set(ctx, headingIds(nodes, { reserved: ctx.ids }));
1433
+ let out = "";
1434
+ for (const n of nodes) {
1435
+ const html = markedBlock(n, ctx);
1436
+ out += ctx.dataLines || ctx.blockIds ? withSourceAttrs(html, n, ctx) : html;
1437
+ }
1438
+ return out;
1439
+ }
1440
+ function markedBlock(n, ctx, render = (x) => block(x, ctx)) {
1441
+ return hasDiffMarks(n) ? decorateDiffHtml(n, render(withWordRun(n)), render) : render(n);
1442
+ }
1443
+ var DIFF_RUN = "dogsbay-diff-run";
1444
+ function withWordRun(n) {
1445
+ const segments = diffMarksOf(n).diffInline;
1446
+ if (!segments || !n.inline?.length || !WORD_RUN_TYPES.has(n.type))
1447
+ return n;
1448
+ if (n.children?.length && n.type !== "step")
1449
+ return n;
1450
+ return { ...n, inline: [{ type: DIFF_RUN, segments }] };
1451
+ }
1452
+ var WORD_RUN_TYPES = /* @__PURE__ */ new Set(["paragraph", "list-item", "li", "step", "td", "th", "dt", "dd"]);
1453
+ var sourceLine = (n) => {
1454
+ const line = n.meta?.line;
1455
+ return typeof line === "number" && Number.isInteger(line) && line > 0 ? line : void 0;
1456
+ };
1457
+ var blockId = (n) => {
1458
+ const id = n.meta?.block;
1459
+ return typeof id === "string" && /^\d+(?:\.\d+)*$/.test(id) ? id : void 0;
1460
+ };
1461
+ function sourceAttrs(n, ctx) {
1462
+ const out = [];
1463
+ const line = ctx.dataLines ? sourceLine(n) : void 0;
1464
+ if (line !== void 0)
1465
+ out.push(["data-line", String(line)]);
1466
+ const id = ctx.blockIds ? blockId(n) : void 0;
1467
+ if (id !== void 0)
1468
+ out.push(["data-block", id]);
1469
+ return out;
1470
+ }
1471
+ function sourceAttrText(n, ctx) {
1472
+ return sourceAttrs(n, ctx).map(([name, value]) => ` ${name}="${value}"`).join("");
1473
+ }
1474
+ function dropAttrs(html, at, names) {
1475
+ let i = at;
1476
+ let kept = "";
1477
+ while (i < html.length) {
1478
+ const ws = /^[\s/]*/.exec(html.slice(i, i + 64))[0];
1479
+ const start = i + ws.length;
1480
+ if (start >= html.length || html[start] === ">")
1481
+ break;
1482
+ let j = start;
1483
+ while (j < html.length && !/[\s/>=]/.test(html[j]))
1484
+ j++;
1485
+ if (j === start)
1486
+ j++;
1487
+ const name = html.slice(start, j).toLowerCase();
1488
+ let k = j;
1489
+ while (k < html.length && /\s/.test(html[k]))
1490
+ k++;
1491
+ if (html[k] === "=") {
1492
+ k++;
1493
+ while (k < html.length && /\s/.test(html[k]))
1494
+ k++;
1495
+ const q = html[k];
1496
+ if (q === '"' || q === "'") {
1497
+ const close = html.indexOf(q, k + 1);
1498
+ k = close === -1 ? html.length : close + 1;
1499
+ } else
1500
+ while (k < html.length && !/[\s>]/.test(html[k]))
1501
+ k++;
1502
+ } else
1503
+ k = j;
1504
+ if (!names.has(name))
1505
+ kept += html.slice(i, k);
1506
+ i = k;
1507
+ }
1508
+ return { kept, end: i };
1509
+ }
1510
+ function hostAttrNames(ctx) {
1511
+ const names = /* @__PURE__ */ new Set();
1512
+ if (ctx.dataLines)
1513
+ names.add("data-line");
1514
+ if (ctx.blockIds)
1515
+ names.add("data-block");
1516
+ return names;
1517
+ }
1518
+ function withSourceAttrs(html, n, ctx) {
1519
+ const added = sourceAttrs(n, ctx);
1520
+ if (added.length === 0)
1521
+ return html;
1522
+ const m = /^\s*<[A-Za-z][\w:-]*(?=[\s/>])/.exec(html);
1523
+ if (!m)
1524
+ return html;
1525
+ const { kept, end } = dropAttrs(html, m[0].length, new Set(added.map(([name]) => name)));
1526
+ return `${m[0]}${added.map(([name, value]) => ` ${name}="${value}"`).join("")}${kept}${html.slice(end)}`;
1527
+ }
1528
+ function termIdAttr(n, ctx) {
1529
+ const given = str2(n.props?.id);
1530
+ const id = given ? pageId(given) : void 0;
1531
+ return id && !ctx.ids.has(id) ? (ctx.ids.add(id), ` id="${esc(id)}"`) : "";
1532
+ }
1533
+ function keyValueList(list3, ctx) {
1534
+ const parts = (list3.children ?? []).map((c) => {
1535
+ if (c.type === "dt")
1536
+ return `<dt data-part="label"${termIdAttr(c, ctx)}>${renderInline(c.inline, ctx)}</dt>`;
1537
+ if (c.type === "dd")
1538
+ return `<dd data-part="value">${itemBody(c, ctx)}</dd>`;
1539
+ return renderBlocks([c], ctx);
1540
+ }).join("");
1541
+ const html = `<dl${attrs({ ...passthrough(list3.props ?? {}), "data-part": "list" })}>${parts}</dl>
1542
+ `;
1543
+ return ctx.dataLines || ctx.blockIds ? withSourceAttrs(html, list3, ctx) : html;
1544
+ }
1545
+ var COLUMNS_STYLE = "columns:var(--db-columns) 14rem;column-gap:var(--db-column-gap)";
1546
+ var str2 = (v) => v == null || v === "" ? void 0 : String(v);
1547
+ function itemBody(n, ctx) {
1548
+ const lead = n.inline && n.inline.length ? `<p>${renderInline(n.inline, ctx)}</p>` : "";
1549
+ return lead + renderBlocks(n.children, ctx);
1550
+ }
1551
+ function listItem(n, ctx) {
1552
+ const p = n.props ?? {};
1553
+ const text = n.inline && n.inline.length ? renderInline(n.inline, ctx) : "";
1554
+ const box = (label) => `<input type="checkbox" disabled${p.checked ? " checked" : ""}${label}>`;
1555
+ const lead = typeof p.checked !== "boolean" ? text : text ? `<label>${box("")} ${text}</label>` : box(' aria-label="Task"');
1556
+ const rest = renderBlocks(n.children, ctx);
1557
+ const body = rest && lead ? `<p>${lead}</p>${rest}` : lead + rest;
1558
+ return `<li${attrs(passthrough(p))}${sourceAttrText(n, ctx)}>${body}</li>`;
1559
+ }
1560
+ function block(n, ctx) {
1561
+ const p = n.props ?? {};
1562
+ switch (n.type) {
1563
+ case "paragraph": {
1564
+ const inl = n.inline ?? [];
1565
+ const first = inl[0];
1566
+ const last = inl[inl.length - 1];
1567
+ const tag = first?.type === "html-inline" ? /^<([a-z][a-z0-9]*-[a-z0-9-]*)[\s>]/i.exec(first.html)?.[1]?.toLowerCase() : void 0;
1568
+ if (tag && last?.type === "html-inline" && last.html.trim().toLowerCase() === `</${tag}>` && closesAtEnd(inl, tag)) {
1569
+ return renderInline(inl, ctx) + "\n";
1570
+ }
1571
+ const only = inl.filter((i) => !(i.type === "text" && !i.text.trim()));
1572
+ if (ctx.imageCaptions === "title" && only.length === 1 && only[0].type === "image" && only[0].title) {
1573
+ const img = only[0];
1574
+ const { class: imgClass, ...at } = img.attrs ?? {};
1575
+ const framed = { ...img, attrs: { ...at, class: "rounded-lg border" } };
1576
+ const figClass = ["my-4", imgClass].filter(Boolean).join(" ");
1577
+ return `<figure${attrs(passthrough(p, figClass))}>${renderInline([framed], ctx)}<figcaption class="mt-2 text-center text-sm text-muted-foreground">${esc(img.title)}</figcaption></figure>
1578
+ `;
1579
+ }
1580
+ return `<p${attrs(passthrough(p))}>${renderInline(n.inline, ctx)}</p>
1581
+ `;
1582
+ }
1583
+ case "heading": {
1584
+ const level = Math.min(6, Math.max(1, Number(p.level) || 2));
1585
+ const text = inlineText(n.inline);
1586
+ const given = pageIds.get(ctx)?.get(n)?.id || str2(n.meta?.pageId);
1587
+ const id = given && !ctx.ids.has(given) ? (ctx.ids.add(given), given) : uniqueId(ctx, given ?? str2(p.id) ?? str2(p.slug) ?? slugify(text));
1588
+ const when = n.meta?.when && typeof n.meta.when === "object" ? n.meta.when : void 0;
1589
+ if (level === 2 || level === 3)
1590
+ ctx.headings.push({ depth: level, id, text, ...when ? { when } : {} });
1591
+ if (ctx.apiParentLevel === void 0)
1592
+ ctx.lastHeadingLevel = level;
1593
+ const anchor = level > 1 ? `<a href="#${esc(id)}" class="ml-2 text-muted-foreground no-underline opacity-0 group-hover:opacity-100 focus:opacity-100" aria-hidden="true" tabindex="-1">&para;</a>` : "";
1594
+ const { id: _i, ...rest } = passthrough(p, "group scroll-mt-20");
1595
+ return `<h${level}${attrs({ id, ...rest })}>${renderInline(n.inline, ctx)}${anchor}</h${level}>
1596
+ `;
1597
+ }
1598
+ case "unordered-list":
1599
+ return `<ul${attrs(passthrough(p))}>${(n.children ?? []).map((c) => markedBlock(c, ctx, (x) => listItem(x, ctx))).join("")}</ul>
1600
+ `;
1601
+ case "ordered-list":
1602
+ return `<ol${attrs({ ...passthrough(p), start: p.start != null && Number(p.start) !== 1 ? p.start : void 0 })}>${(n.children ?? []).map((c) => markedBlock(c, ctx, (x) => listItem(x, ctx))).join("")}</ol>
1603
+ `;
1604
+ case "list-item":
1605
+ return listItem(n, ctx);
1606
+ case "blockquote":
1607
+ return `<blockquote${attrs(passthrough(p, "border-l-4 border-border pl-4 italic text-muted-foreground"))}>${renderBlocks(n.children, ctx)}</blockquote>
1608
+ `;
1609
+ case "hr":
1610
+ return `<hr class="my-8 border-border">
1611
+ `;
1612
+ case "html":
1613
+ return rewriteHtml(n.html ?? "", ctx) + "\n";
1614
+ case "code":
1615
+ return codeBlock(n, ctx);
1616
+ case "table":
1617
+ return table(n, ctx);
1618
+ case "thead":
1619
+ if (isEmptyTableHead(n))
1620
+ return "";
1621
+ return `<thead class="[&_tr]:border-b">${renderBlocks(n.children, ctx)}</thead>`;
1622
+ case "tbody":
1623
+ return `<tbody class="[&_tr:last-child]:border-0">${renderBlocks(n.children, ctx)}</tbody>`;
1624
+ case "tr":
1625
+ return `<tr${attrs(passthrough(p, "border-b transition-colors hover:bg-muted/50"))}>${renderBlocks(n.children, ctx)}</tr>`;
1626
+ case "th":
1627
+ case "td": {
1628
+ const align = /^(left|center|right)$/i.test(str2(p.align) ?? "") ? str2(p.align).toLowerCase() : void 0;
1629
+ const cls = n.type === "th" ? "px-2 py-2 text-left align-bottom font-semibold text-muted-foreground" : "p-2 align-top";
1630
+ const body = `${renderInline(n.inline, ctx)}${renderBlocks(n.children, ctx)}`;
1631
+ const tag = n.type === "th" && !body.trim() ? "td" : n.type;
1632
+ return `<${tag}${attrs({ ...passthrough(p, cls), colspan: p.colspan, rowspan: p.rowspan, style: align ? `text-align:${align}` : p.style })}>${body}</${tag}>`;
1633
+ }
1634
+ case "deflist":
1635
+ return `<dl${attrs(passthrough(p, "my-4 space-y-2"))}>${renderBlocks(n.children, ctx)}</dl>
1636
+ `;
1637
+ case "dt":
1638
+ return `<dt class="font-semibold"${termIdAttr(n, ctx)}>${renderInline(n.inline, ctx)}</dt>`;
1639
+ case "dd":
1640
+ return `<dd class="ml-6 text-muted-foreground">${itemBody(n, ctx)}</dd>`;
1641
+ case "footnote-list":
1642
+ return `<section class="footnotes mt-12 border-t pt-6 text-sm text-muted-foreground" role="doc-endnotes" aria-label="Footnotes"><ol>${renderBlocks(n.children, ctx)}</ol></section>
1643
+ `;
1644
+ case "footnote-def": {
1645
+ const label = esc(str2(p.label) ?? "");
1646
+ const body = n.inline?.length ? `<p>${renderInline(n.inline, ctx)} <a href="#fnref-${label}" class="text-primary no-underline" role="doc-backlink" aria-label="${esc(ctx.t("backToContent"))}">\u21A9</a></p>` : "";
1647
+ return `<li id="fn-${label}">${body}${renderBlocks(n.children, ctx)}</li>`;
1648
+ }
1649
+ case "callout":
1650
+ return callout(n, ctx);
1651
+ case "steps":
1652
+ return steps(n, ctx);
1653
+ case "step": {
1654
+ const title = stepTitle(n);
1655
+ const split = title ? void 0 : stepLead(n.inline);
1656
+ const lead = title ? `<strong class="step-title">${esc(title)}</strong>` : split ? `<strong class="step-title">${renderInline(split.title, ctx)}</strong>` : "";
1657
+ const text = renderInline(split ? split.rest : n.inline, ctx);
1658
+ const stepId = str2(p.id) ? pageId(str2(p.id)) : void 0;
1659
+ const idAttr = stepId && !ctx.ids.has(stepId) ? (ctx.ids.add(stepId), ` id="${esc(stepId)}"`) : "";
1660
+ return `<li${idAttr}${sourceAttrText(n, ctx)}>${lead}${lead && text ? " " : ""}${text}${renderBlocks(n.children, ctx)}</li>`;
1661
+ }
1662
+ case "tabs":
1663
+ return renderAroundGroup(n, "tab", (g) => tabs(g, ctx), (c) => renderBlocks([c], ctx), "");
1664
+ case "tab":
1665
+ return renderBlocks(n.children, ctx);
1666
+ case "accordion":
1667
+ return renderAroundGroup(n, "accordion-item", (g) => accordion(g, ctx), (c) => renderBlocks([c], ctx), "");
1668
+ case "accordion-item": {
1669
+ const { line: _line, block: _block, ...meta } = n.meta ?? {};
1670
+ return accordion({ type: "accordion", children: [{ ...n, meta }] }, ctx);
1671
+ }
1672
+ case "details":
1673
+ return details(n, ctx);
1674
+ case "figure":
1675
+ return figure(n, ctx);
1676
+ case "substeps": {
1677
+ const items = (n.children ?? []).map((c) => c.type === "step" ? markedBlock(c, ctx) : `<li>${markedBlock(c, ctx)}</li>`).join("");
1678
+ return `<ol${attrs({ ...passthrough(p, "sub-steps-list"), role: "list" })}>${items}</ol>
1679
+ `;
1680
+ }
1681
+ case "annotation-list":
1682
+ return `<div${attrs(passthrough(p, "my-2 rounded-md border-l-4 border-info/50 bg-info/5 p-4"))}>${renderBlocks(n.children, ctx)}</div>
1683
+ `;
1684
+ case "avatar":
1685
+ return avatar(p, ctx);
1686
+ case "example":
1687
+ return example(n, ctx);
1688
+ case "cards": {
1689
+ const tone = str2(p.tone);
1690
+ const kids = tone ? (n.children ?? []).map((c) => c.type === "card" && !c.props?.tone ? { ...c, props: { ...c.props, tone } } : c) : n.children;
1691
+ const cols = Math.min(6, Math.max(1, Math.round(Number(String(p.cols ?? "").replace(/[[\]\s]/g, "").split(",").pop()) || 2)));
1692
+ return `<div${attrs(passthrough(p, `my-4 grid grid-cols-1 gap-4 ${GRID_COLS[cols]}`))}>${renderBlocks(kids, ctx)}</div>
1693
+ `;
1694
+ }
1695
+ // A scoped theme: `.dark` re-declares the tokens for its subtree (THEME_SCOPES)
1696
+ case "theme": {
1697
+ const scope = lookup(THEME_SCOPES, str2(p.name));
1698
+ if (!scope) {
1699
+ ctx.unknown.add(`theme "${str2(p.name) ?? ""}"`);
1700
+ return renderBlocks(n.children, ctx);
1701
+ }
1702
+ return `<div${attrs({ ...passthrough(p, scope), "data-theme": str2(p.name) })}>${renderBlocks(n.children, ctx)}</div>
1703
+ `;
1704
+ }
1705
+ case "card":
1706
+ return card(n, ctx);
1707
+ case "link-card":
1708
+ return linkCard(n, ctx);
1709
+ case "grid": {
1710
+ const cols = Math.min(6, Math.max(1, Number(p.cols) || 2));
1711
+ return `<div${attrs({ ...passthrough(p, `my-4 grid grid-cols-1 gap-4 ${GRID_COLS[cols]}`) })}>${renderBlocks(n.children, ctx)}</div>
1712
+ `;
1713
+ }
1714
+ case "grid-item": {
1715
+ const span = Number(p.span) || 0;
1716
+ const rows = Number(p.rowSpan) || 0;
1717
+ const style = [span > 1 && `grid-column:span ${span} / span ${span}`, rows > 1 && `grid-row:span ${rows} / span ${rows}`].filter(Boolean).join(";") || void 0;
1718
+ const label = str2(p.label);
1719
+ const inner = label !== void 0 ? `<div class="flex h-full min-h-16 items-center justify-center rounded-lg font-mono text-sm font-medium ${lookup(TONE_CLASSES, str2(p.tone)) ?? TONE_CLASSES["primary-light"]}">${esc(label)}</div>` : renderBlocks(n.children, ctx);
1720
+ const { label: _l, tone: _t, rowSpan: _r, ...rest } = p;
1721
+ const pass = passthrough(rest);
1722
+ const merged = [style, str2(pass.style)].filter(Boolean).join(";") || void 0;
1723
+ return `<div${attrs({ ...pass, style: merged })}>${inner}</div>`;
1724
+ }
1725
+ case "files":
1726
+ return (n.children ?? []).map((c) => c.type === "unordered-list" || c.type === "ordered-list" ? fileTreeHtml(fileTreeItems(c, ctx), str2(p.class) ?? "") + "\n" : renderBlocks([c], ctx)).join("");
1727
+ case "container": {
1728
+ const name = typeof n.meta?.name === "string" ? n.meta.name : "container";
1729
+ if (name === "columns") {
1730
+ const count = Math.min(6, Math.max(1, Math.round(Number(p.count)) || 2));
1731
+ const gap = /^(?:0|\d+(?:\.\d+)?(?:px|rem|em|pt|mm|cm|in|ch|%))$/.test(str2(p.gap) ?? "") ? str2(p.gap) : "1.5rem";
1732
+ const { count: _c, gap: _g, ...rest } = p;
1733
+ const pass = passthrough(rest, "my-4");
1734
+ const style = [`--db-columns:${count}`, `--db-column-gap:${gap}`, COLUMNS_STYLE, str2(pass.style)].filter(Boolean).join(";");
1735
+ return `<div${attrs({ ...pass, "data-directive": "columns", "data-columns": String(count), style })}>${renderBlocks(n.children, ctx)}</div>
1736
+ `;
1737
+ }
1738
+ if (name === "key-value") {
1739
+ const layout = str2(p.layout) === "across" ? "across" : "rows";
1740
+ const { layout: _l, ...rest } = p;
1741
+ const inner = (n.children ?? []).map((c) => c.type === "deflist" ? keyValueList(c, ctx) : renderBlocks([c], ctx)).join("");
1742
+ return `<div${attrs({ ...passthrough(rest, "my-4"), "data-directive": "key-value", "data-layout": layout })}>${inner}</div>
1743
+ `;
1744
+ }
1745
+ if (name === "pdf-page-break" && !n.children?.length)
1746
+ return `<div${attrs({ ...passthrough(p), "data-pdf": "page-break" })}></div>
1747
+ `;
1748
+ if (name === "pdf-keep-together")
1749
+ return `<div${attrs({ ...passthrough(p), "data-pdf": "keep-together" })}>${renderBlocks(n.children, ctx)}</div>
1750
+ `;
1751
+ if (name === "pdf-only") {
1752
+ const headings = ctx.headings.length;
1753
+ const inner = renderBlocks(n.children, ctx);
1754
+ ctx.headings.length = headings;
1755
+ return `<div${attrs({ ...passthrough(p), "data-pdf": "only", hidden: true, "data-pagefind-ignore": "all" })}>${inner}</div>
1756
+ `;
1757
+ }
1758
+ if (name === "choice-select")
1759
+ return choiceSelect(p, ctx, n.meta);
1760
+ if (name === "when") {
1761
+ return `<div${attrs({ ...typeof p.id === "string" ? { id: p.id } : {}, ...whenAttrs(p) })}>${renderBlocks(n.children, ctx)}</div>
1762
+ `;
1763
+ }
1764
+ if (name === "web-only")
1765
+ return `<div${attrs({ ...passthrough(p), "data-web-only": true })}>${renderBlocks(n.children, ctx)}</div>
1766
+ `;
1767
+ ctx.unknown.add(`:::${name}`);
1768
+ const title = typeof n.meta?.title === "string" ? `<p class="font-semibold">${esc(n.meta.title)}</p>` : "";
1769
+ const nested2 = Object.fromEntries(Object.entries(p).filter(([, v]) => v !== null && typeof v === "object"));
1770
+ return `<div${attrs({ ...passthrough(p), "data-directive": name, ...Object.keys(nested2).length ? { "data-props": JSON.stringify(nested2) } : {} })}>${title}${renderBlocks(n.children, ctx)}</div>
1771
+ `;
1772
+ }
1773
+ case "link-button": {
1774
+ const href = str2(p.href);
1775
+ const variant = buttonVariant(str2(p.variant), ctx);
1776
+ const label = insideLink(true, ctx, () => n.children?.length === 1 && n.children[0].type === "paragraph" ? renderInline(n.children[0].inline, ctx) : renderBlocks(n.children, ctx));
1777
+ return `<p><a${attrs({ ...passthrough(p, `${BUTTON_BASE} ${lookup(BUTTON_VARIANTS, variant) ?? BUTTON_VARIANTS.default} h-10 px-4 py-2 no-underline`), "data-variant": variant, "data-size": "default", href: href ? linkUrl(href, ctx) : void 0 })}>${label}</a></p>
1778
+ `;
1779
+ }
1780
+ case "youtube": {
1781
+ const id = str2(p.id) ?? "";
1782
+ const title = str2(p.title) ?? "YouTube video";
1783
+ const { id: _vid, ...ytRest } = p;
1784
+ const poster = str2(p.poster);
1785
+ const play = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true" focusable="false"><path d="M8 5v14l11-7z"/></svg>';
1786
+ return `<a${attrs({ ...passthrough(ytRest, "not-prose group my-4 flex items-center gap-4 rounded-lg border bg-card p-3 text-card-foreground no-underline shadow-sm transition-colors hover:bg-accent/50"), href: `https://www.youtube.com/watch?v=${encodeURIComponent(id)}`, rel: "noopener", "data-component": "youtube" })}>` + (poster ? `<img src="${esc(assetUrl(poster, ctx))}" alt="" class="h-16 w-28 shrink-0 rounded object-cover" loading="lazy">` : "") + `<span class="flex size-10 shrink-0 items-center justify-center rounded-full bg-red-600 text-white">${play}</span><span class="min-w-0"><span class="block font-semibold group-hover:underline">${esc(title)}</span><span class="block text-xs text-muted-foreground">YouTube</span></span></a>
1787
+ `;
1788
+ }
1789
+ case "diagram": {
1790
+ const lang = str2(p.lang) ?? "mermaid";
1791
+ const code = str2(p.code) ?? "";
1792
+ const svg3 = str2(p.svg) ?? ctx.diagram?.(lang, code);
1793
+ return svg3 ? diagramFigure(lang, svg3, str2(p.title), p) : codeBlock({ type: "code", props: { ...p, language: lang }, html: code }, ctx);
1794
+ }
1795
+ case "math-block": {
1796
+ const latex = str2(p.latex) ?? "";
1797
+ const html = renderMath(latex, true, ctx);
1798
+ return html != null ? `<div class="my-4 overflow-x-auto">${html}</div>
1799
+ ` : `<pre class="my-4 overflow-x-auto rounded-md border bg-muted p-4 text-sm"><code class="math-display">${esc(latex)}</code></pre>
1800
+ `;
1801
+ }
1802
+ case "math":
1803
+ return `<pre class="my-4 overflow-x-auto rounded-md border bg-muted p-4 text-sm"><code class="math-display">${esc(n.html ?? inlineText(n.inline))}</code></pre>
1804
+ `;
1805
+ case "related":
1806
+ return `<nav class="related-resources" aria-label="${esc(ctx.t("related"))}">${renderInline(n.inline, ctx)}${renderBlocks(n.children, ctx)}</nav>
1807
+ `;
1808
+ case "prose":
1809
+ return n.inline ? renderInline(n.inline, ctx) : typeof n.html === "string" ? proseHeadings(rewriteHtml(n.html, ctx), ctx) + "\n" : "";
1810
+ case "api-class":
1811
+ case "api-member":
1812
+ case "api-doc":
1813
+ case "api-params":
1814
+ case "api-source":
1815
+ case "endpoint":
1816
+ return renderApiNode(n, ctx);
1817
+ case "include": {
1818
+ const target = str2(p.path) ?? str2(p.src) ?? str2(p.file) ?? "";
1819
+ const remote = /https?:\/\/\S+/.exec(target)?.[0];
1820
+ if (remote) {
1821
+ ctx.unknown.add("include of a remote file (not fetched)");
1822
+ return `<p><a rel="noopener" href="${esc(remote)}">${esc(remote.split("/").pop() ?? remote)}</a></p>
1823
+ `;
1824
+ }
1825
+ ctx.unknown.add("include (unresolved)");
1826
+ return `<!-- unresolved include: ${esc(target)} -->
1827
+ `;
1828
+ }
1829
+ // Raw HTML (a one-line `<details>` body) or an importer's wrapper: known,
1830
+ // so not reported as unknown (that warned on content that rendered fine)
1831
+ case "html-container":
1832
+ if (n.html && !n.children?.length)
1833
+ return rewriteHtml(n.html, ctx);
1834
+ return `<div${attrs(passthrough(p, "db-html-container"))}>${renderBlocks(n.children, ctx)}</div>
1835
+ `;
1836
+ default: {
1837
+ ctx.unknown.add(n.type);
1838
+ if (n.html && !n.children?.length)
1839
+ return rewriteHtml(n.html, ctx);
1840
+ const inner = (n.inline?.length ? `<p>${renderInline(n.inline, ctx)}</p>` : "") + renderBlocks(n.children, ctx);
1841
+ return `<div${attrs(passthrough(p, `db-${slugify(n.type)}`))}>${inner}</div>
1842
+ `;
1843
+ }
1844
+ }
1845
+ }
1846
+ function closesAtEnd(inl, tag) {
1847
+ let depth = 0;
1848
+ for (let i = 0; i < inl.length; i++) {
1849
+ const n = inl[i];
1850
+ if (n.type !== "html-inline")
1851
+ continue;
1852
+ const h = n.html.trim().toLowerCase();
1853
+ if (new RegExp(`^<${tag}[\\s>]`).test(h))
1854
+ depth++;
1855
+ else if (h === `</${tag}>`) {
1856
+ depth--;
1857
+ if (depth === 0 && i !== inl.length - 1)
1858
+ return false;
1859
+ }
1860
+ }
1861
+ return depth === 0;
1862
+ }
1863
+ var GRID_COLS = {
1864
+ 1: "sm:grid-cols-1",
1865
+ 2: "sm:grid-cols-2",
1866
+ 3: "sm:grid-cols-2 lg:grid-cols-3",
1867
+ 4: "sm:grid-cols-2 lg:grid-cols-4",
1868
+ 5: "sm:grid-cols-3 lg:grid-cols-5",
1869
+ 6: "sm:grid-cols-3 lg:grid-cols-6"
1870
+ };
1871
+ function buttonVariant(variant, ctx) {
1872
+ if (!variant || variant === "primary")
1873
+ return "default";
1874
+ if (Object.hasOwn(BUTTON_VARIANTS, variant))
1875
+ return variant;
1876
+ (ctx.unknownVariants ??= /* @__PURE__ */ new Set()).add(variant);
1877
+ return "default";
1878
+ }
1879
+ var BUTTON_BASE = "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50";
1880
+ var BUTTON_VARIANTS = {
1881
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
1882
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
1883
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
1884
+ ghost: "hover:bg-accent hover:text-accent-foreground",
1885
+ link: "text-primary underline-offset-4 hover:underline",
1886
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90"
1887
+ };
1888
+ var COPY_ICON = '<svg data-part="copy-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>';
1889
+ var CHECK_ICON = '<svg data-part="check-icon" hidden xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M20 6 9 17l-5-5"/></svg>';
1890
+ function diagramFigure(lang, svg3, title, p) {
1891
+ return `<figure${attrs({ ...passthrough(p, "diagram not-prose my-4"), "data-lang": lang })}>` + (title ? `<figcaption class="mb-2 text-sm text-muted-foreground">${esc(title)}</figcaption>` : "") + `<div class="diagram-content overflow-x-auto [&>svg]:mx-auto [&>svg]:max-w-full dark:invert dark:[&>svg]:hue-rotate-180">${FOREIGN_START}${svg3}${FOREIGN_END}</div></figure>
1892
+ `;
1893
+ }
1894
+ function codeRequest(n) {
1895
+ const p = n.props ?? {};
1896
+ const code = n.html ?? String(p.code ?? "");
1897
+ const rawLang = str2(p.language) ?? str2(p.lang);
1898
+ const lang = rawLang === "terminal" ? "bash" : rawLang;
1899
+ const highlights = [...parseLineRanges(p.highlights ?? p.highlight ?? p.hl_lines), ...parseLineRanges(p.mark)];
1900
+ const diffAdd = [...parseLineRanges(p.diffAdd), ...parseLineRanges(p.ins)];
1901
+ const diffRemove = [...parseLineRanges(p.diffRemove), ...parseLineRanges(p.del)];
1902
+ const lineNumbers = p.lineNumbers === true || p.lineNumbers === "true" || p.linenums != null;
1903
+ return { code, lang, opts: { highlights, lineNumbers, diffAdd, diffRemove } };
1904
+ }
1905
+ function highlightInputs(tree) {
1906
+ const out = [];
1907
+ const walk = (v) => {
1908
+ if (Array.isArray(v))
1909
+ return v.forEach(walk);
1910
+ if (!v || typeof v !== "object")
1911
+ return;
1912
+ const n = v;
1913
+ if (n.type === "code") {
1914
+ const { lang, code } = codeRequest(n);
1915
+ out.push({ lang, code });
1916
+ } else if (n.type === "diagram") {
1917
+ const p = n.props ?? {};
1918
+ const { lang, code } = codeRequest({ type: "code", props: { ...p, language: str2(p.lang) ?? "mermaid" }, html: str2(p.code) ?? "" });
1919
+ out.push({ lang, code });
1920
+ } else if (API_NODE_TYPES.has(n.type)) {
1921
+ out.push(...apiCodeInputs(n));
1922
+ }
1923
+ if (n.children)
1924
+ walk(n.children);
1925
+ if (n.props) {
1926
+ for (const x of Object.values(n.props))
1927
+ if (x && typeof x === "object")
1928
+ walk(x);
1929
+ }
1930
+ };
1931
+ walk(tree);
1932
+ return out;
1933
+ }
1934
+ function codeHtml(code, lang, ctx) {
1935
+ return codeBlock({ type: "code", props: lang ? { language: lang } : {}, html: code }, ctx);
1936
+ }
1937
+ function codeBlock(n, ctx) {
1938
+ const p = n.props ?? {};
1939
+ const rawLang = str2(p.language) ?? str2(p.lang);
1940
+ const { code, lang, opts } = codeRequest(n);
1941
+ const svg3 = rawLang && ctx.diagram ? ctx.diagram(rawLang, code) : void 0;
1942
+ if (svg3)
1943
+ return diagramFigure(rawLang, svg3, str2(p.title) ?? str2(p.filename), p);
1944
+ const title = str2(p.title) ?? str2(p.filename);
1945
+ const { highlights, lineNumbers, diffAdd, diffRemove } = opts;
1946
+ const hl = ctx.highlighter ?? plainHighlighter;
1947
+ const collapse = parseLineRanges(p.collapse);
1948
+ const collapsedLabel = (count) => esc((count === 1 ? ctx.t("collapsedLine") : ctx.t("collapsedLines")).replace("{n}", String(count)));
1949
+ const highlighted = hl.code(code, lang, opts);
1950
+ const ranges = Array.isArray(n.meta?.choiceValues) ? n.meta.choiceValues : void 0;
1951
+ const copiesSource = p.copyText !== void 0 || p.lineNumbers === true || collapse.length > 0 || code.includes("[!code") || opts.diffAdd.length > 0 || opts.diffRemove.length > 0;
1952
+ const pre = collapseLines(ranges?.length && !copiesSource ? wrapChoiceRanges(highlighted, code, ranges, () => ++ctx.seq) : highlighted, collapse, collapsedLabel);
1953
+ const diffs = diffAdd.length > 0 || diffRemove.length > 0;
1954
+ const rich = lineNumbers || highlights.length > 0 || diffs || code.includes("[!code") || collapse.length > 0;
1955
+ const plain = !lang || plainHighlighter.resolve(lang) === "text";
1956
+ const ansi = !!lang && plainHighlighter.resolve(lang) === "ansi";
1957
+ const shown = ansi ? stripAnsi(code.replace(/\n$/, "")) : code.replace(/\n$/, "");
1958
+ const copyLabel = esc(ctx.t("copyCode"));
1959
+ const copyBtn = (extra = "") => `<button type="button" data-part="copy" aria-label="${copyLabel}" class="inline-flex h-7 w-7 items-center justify-center rounded-md text-code-fg/50 transition-colors hover:bg-code-fg/10 hover:text-code-fg/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring${extra}">${COPY_ICON}${CHECK_ICON}</button>`;
1960
+ let header = "";
1961
+ let floating = "";
1962
+ const mode = ctx.codeBlockTitle ?? true;
1963
+ if (mode === "auto" ? !!title : mode && (title || !plain)) {
1964
+ const left = title ? `<span class="min-w-0 font-medium text-code-fg" data-part="title">${esc(title)}</span>` : `<span class="select-none" data-part="label">${esc(lang ?? "")}</span>`;
1965
+ const langRight = title && !plain ? `<span class="select-none" data-part="language">${esc(lang ?? "")}</span>` : "";
1966
+ header = `<div data-part="header" class="flex items-center justify-between border-b border-code-fg/10 bg-code-fg/5 px-4 py-2 text-xs text-code-fg/70">${left}<span class="flex shrink-0 items-center gap-2">${langRight}${copyBtn()}</span></div>`;
1967
+ } else {
1968
+ floating = copyBtn(" absolute right-2 top-2 z-10 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100");
1969
+ }
1970
+ return `<db-code-block${attrs({
1971
+ ...passthrough(p, "not-prose group relative my-4 overflow-hidden rounded-lg border bg-code-bg text-sm"),
1972
+ // CodeRich's name for an annotated block, CodeBlock's otherwise, as the Astro pipeline renders them.
1973
+ "data-component": rich ? "code-rich" : "code-block",
1974
+ "data-lang": lang,
1975
+ "data-line-numbers": lineNumbers || void 0,
1976
+ // With a gutter or [!code …] markers the text on the page is not the code: copy the source, markers removed.
1977
+ // An `ansi` block: the text as shown, without its escape codes.
1978
+ "data-copy-text": str2(p.copyText) ?? (lineNumbers || diffs || collapse.length > 0 || code.includes("[!code") ? stripMarkersForCopy(shown) : ansi ? shown : void 0)
1979
+ })}>` + header + floating + `<div data-part="code" class="${rich ? "code-rich-body " : ""}relative overflow-x-auto [&_pre]:!m-0 [&_pre]:!rounded-none [&_pre]:!border-0 [&_pre]:px-4 [&_pre]:py-3">${pre}</div></db-code-block>
1980
+ `;
1981
+ }
1982
+ function table(n, ctx) {
1983
+ const p = n.props ?? {};
1984
+ const caption = str2(p.caption);
1985
+ const cap = caption ? `<caption class="mb-2 text-left text-sm font-medium text-foreground">${titleMarkup(caption, ctx)}</caption>` : "";
1986
+ return `<div class="relative w-full overflow-x-auto" tabindex="0"><table${attrs(passthrough(p, "my-4 w-full caption-top text-sm"))}>${cap}${renderBlocks(n.children, ctx)}</table></div>
1987
+ `;
1988
+ }
1989
+ var COLLAPSIBLE = Object.fromEntries(Object.keys(ALERT_VARIANT).map((v) => [v, { border: `border-${v}/50`, summary: `bg-${v}/10`, icon: `text-${v}`, body: `bg-${v}/3` }]));
1990
+ function calloutLabel(type, ctx) {
1991
+ return ctx.t(`callout.${type}`) || CALLOUTS[type]?.label || type.charAt(0).toUpperCase() + type.slice(1);
1992
+ }
1993
+ function callout(n, ctx) {
1994
+ const p = n.props ?? {};
1995
+ const type = (str2(p.variant) ?? str2(p.type) ?? "note").toLowerCase();
1996
+ const variant = ALERT_VARIANT[VARIANT_ALIAS[type] ?? type] ? VARIANT_ALIAS[type] ?? type : "note";
1997
+ const title = str2(p.title);
1998
+ const titleHtml = title ? titleMarkup(title, ctx) : esc(calloutLabel(type, ctx));
1999
+ const body = renderBlocks(n.children, ctx);
2000
+ if (flagOn(p.collapsible) || p.collapsed != null) {
2001
+ const open = p.collapsed === false || p.collapsed === "false" || flagOn(p.open);
2002
+ if (type === "plain")
2003
+ return plainCollapsible(titleHtml, body, open, { ...p, "data-type": p["data-type"] ?? type }, ctx);
2004
+ return collapsibleAlert(variant, titleHtml, body, open, { ...p, "data-type": p["data-type"] ?? type }, ctx);
2005
+ }
2006
+ return `<div${attrs({ ...passthrough(p, `${ALERT_BASE} ${ALERT_VARIANT[variant]} my-4`), "data-variant": variant, "data-type": type, role: "note" })}>` + alertIcon(variant, p, ctx) + `<div data-part="title" class="${ALERT_TITLE_CLASS}">${titleHtml}</div><div class="${ALERT_BODY_CLASS}">${body}</div></div>
2007
+ `;
2008
+ }
2009
+ var TITLE_TAG = /^<\/?(?:code|kbd|b|strong|i|em|s|del|mark|sub|sup|br)\s*\/?>$/i;
2010
+ function titleMarkup(title, ctx) {
2011
+ const nodes = parseInline(title);
2012
+ const kept = balancedTitleTags(nodes);
2013
+ return renderInline(nodes.map((n, i) => n.type === "html-inline" && !kept.has(i) ? { type: "text", text: n.html } : n), ctx);
2014
+ }
2015
+ function balancedTitleTags(nodes) {
2016
+ const kept = /* @__PURE__ */ new Set();
2017
+ const open = [];
2018
+ nodes.forEach((n, i) => {
2019
+ if (n.type !== "html-inline")
2020
+ return;
2021
+ const html = n.html.trim();
2022
+ if (!TITLE_TAG.test(html))
2023
+ return;
2024
+ const name = /^<\/?\s*(\w+)/.exec(html)[1].toLowerCase();
2025
+ if (name === "br")
2026
+ kept.add(i);
2027
+ else if (!html.startsWith("</"))
2028
+ open.push({ name, at: i });
2029
+ else if (open.length && open[open.length - 1].name === name) {
2030
+ kept.add(open.pop().at);
2031
+ kept.add(i);
2032
+ }
2033
+ });
2034
+ return kept;
2035
+ }
2036
+ function flagOn(v) {
2037
+ return v !== void 0 && v !== null && v !== false && v !== "false";
2038
+ }
2039
+ function alertIcon(variant, p, ctx) {
2040
+ const name = str2(p.icon);
2041
+ const custom = name ? resolveIconMarkup(name, ctx) : void 0;
2042
+ if (name && custom === void 0)
2043
+ (ctx.missingIcons ??= /* @__PURE__ */ new Set()).add(name);
2044
+ const svg3 = custom ?? icons[variant] ?? "";
2045
+ return svg3.startsWith("<svg") && !/^<svg[^>]*aria-hidden/.test(svg3) ? svg3.replace("<svg ", '<svg aria-hidden="true" focusable="false" ') : svg3;
2046
+ }
2047
+ function collapsibleAlert(variant, titleHtml, body, open, p, ctx) {
2048
+ const c = COLLAPSIBLE[variant] ?? COLLAPSIBLE.note;
2049
+ const icon2 = alertIcon(variant, p, ctx);
2050
+ return `<details${attrs({ ...passthrough(p, `group/collapsible relative my-4 w-full overflow-hidden rounded-lg border [&>summary]:list-none [&>summary::-webkit-details-marker]:hidden ${c.border}`), "data-variant": variant, open })}><summary class="flex cursor-pointer select-none items-center gap-2 px-4 py-3 text-sm font-semibold ${c.summary}"><span class="shrink-0 [&>svg]:size-4 ${c.icon}">${icon2}</span><span class="flex-1 text-foreground" data-part="title">${titleHtml}</span><span class="shrink-0 text-muted-foreground transition-transform duration-200 group-open/collapsible:rotate-180">${chevronSvg.replace("<svg ", '<svg aria-hidden="true" focusable="false" ')}</span></summary><div class="px-4 py-3 text-sm [&_p]:leading-relaxed ${c.body}">${body}</div></details>
2051
+ `;
2052
+ }
2053
+ function plainCollapsible(titleHtml, body, open, p, ctx) {
2054
+ const icon2 = str2(p.icon) ? alertIcon("plain", p, ctx) : "";
2055
+ return `<details${attrs({ ...passthrough(p, "group/collapsible relative my-4 w-full overflow-hidden rounded-lg border border-border [&>summary]:list-none [&>summary::-webkit-details-marker]:hidden"), "data-variant": "plain", open })}><summary class="flex cursor-pointer select-none items-center gap-2 px-4 py-3 text-sm font-semibold">${icon2 ? `<span class="shrink-0 [&>svg]:size-4">${icon2}</span>` : ""}<span class="flex-1 text-foreground" data-part="title">${titleHtml}</span><span class="shrink-0 text-muted-foreground transition-transform duration-200 group-open/collapsible:rotate-180">${chevronSvg.replace("<svg ", '<svg aria-hidden="true" focusable="false" ')}</span></summary><div class="px-4 py-3 text-sm [&_p]:leading-relaxed">${body}</div></details>
2056
+ `;
2057
+ }
2058
+ var AVATAR = "relative inline-flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted";
2059
+ var AVATAR_IMAGE = "absolute inset-0 aspect-square h-full w-full object-cover before:absolute before:inset-0 before:flex before:items-center before:justify-center before:rounded-full before:bg-muted before:text-sm before:font-semibold before:text-muted-foreground before:content-[attr(data-initials)]";
2060
+ var AVATAR_FALLBACK = "flex h-full w-full items-center justify-center rounded-full bg-muted text-sm font-semibold text-muted-foreground";
2061
+ function avatar(p, ctx) {
2062
+ const src = str2(p.src);
2063
+ const alt = str2(p.alt) ?? "";
2064
+ const initials = str2(p.fallback) || alt.split(" ").map((w) => w[0] ?? "").join("").slice(0, 2).toUpperCase();
2065
+ const { src: _s, alt: _a, fallback: _f, ...rest } = p;
2066
+ const inner = src ? `<span class="${AVATAR_FALLBACK}" aria-hidden="true">${esc(initials)}</span><img class="${AVATAR_IMAGE}" src="${esc(assetUrl(src, ctx))}" alt="" width="40" height="40" data-initials="${esc(initials)}">` : `<span class="${AVATAR_FALLBACK}" aria-hidden="true">${esc(initials)}</span>`;
2067
+ const label = alt ? { role: "img", "aria-label": str2(rest["aria-label"]) ?? alt } : {};
2068
+ const { "aria-label": _l, ...own } = passthrough(rest, AVATAR);
2069
+ return `<span${attrs({ ...alt ? own : { ...own, "aria-label": _l }, ...label })}>${inner}</span>`;
2070
+ }
2071
+ var CHEVRON = '<svg class="h-3 w-3 transition-transform group-open:rotate-90" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"></polyline></svg>';
2072
+ function example(n, ctx) {
2073
+ const p = n.props ?? {};
2074
+ const title = str2(p.title);
2075
+ const src = str2(p.src);
2076
+ if (src && !n.children?.length) {
2077
+ return `<p class="my-4 rounded-lg border border-dashed border-border px-4 py-3 text-sm text-muted-foreground">Example <code>${esc(src)}</code>${title ? `: ${esc(title)}` : ""}, shown when the site is built.</p>
2078
+ `;
2079
+ }
2080
+ if (p.fallback === true || p.fallback === "true")
2081
+ ctx.unknown.add("example fallback panel (not rendered)");
2082
+ return `<figure class="my-6 overflow-hidden rounded-lg border border-border bg-card">` + (title ? `<figcaption class="border-b border-border bg-muted/30 px-4 py-2 text-sm font-medium">${esc(title)}</figcaption>` : "") + `<div class="border-b border-border"><div class="border-b border-border bg-muted/10 px-4 py-1 text-[11px] uppercase tracking-wide text-muted-foreground">Rendered</div><div${attrs({ class: "markdown-preview p-6 [&>:first-child]:mt-0 [&>:last-child]:mb-0" })}>${renderBlocks(n.children, ctx)}</div></div><details class="group"><summary class="flex cursor-pointer list-none select-none items-center gap-2 px-4 py-2 text-xs text-muted-foreground hover:text-foreground">${CHEVRON}<span class="uppercase tracking-wide">Source</span></summary><pre class="m-0 overflow-auto border-t border-border bg-muted/20 p-4 text-xs"><code>${esc(String(p.source ?? ""))}</code></pre></details></figure>
2083
+ `;
2084
+ }
2085
+ function steps(n, ctx) {
2086
+ const p = n.props ?? {};
2087
+ const kids = n.children ?? [];
2088
+ const first = kids.findIndex((c) => c.type === "step");
2089
+ if (first > 0)
2090
+ return renderBlocks(kids.slice(0, first), ctx) + steps({ ...n, children: kids.slice(first) }, ctx);
2091
+ const items = kids.map((c) => c.type === "step" ? markedBlock(c, ctx) : `<li>${markedBlock(c, ctx)}</li>`).join("");
2092
+ return `<ol${attrs({ ...passthrough(p, "steps-list"), role: "list" })}>${items}</ol>
2093
+ `;
2094
+ }
2095
+ var TAB_TRIGGER = "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 aria-selected:bg-background aria-selected:text-foreground aria-selected:shadow-sm";
2096
+ var TAB_CONTENT = "px-4 py-3 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&>:first-child]:mt-0 [&>:last-child]:mb-0";
2097
+ function tabs(n, ctx) {
2098
+ const p = n.props ?? {};
2099
+ const kids = (n.children ?? []).filter((c) => c.type === "tab");
2100
+ if (!kids.length)
2101
+ return renderBlocks(n.children, ctx);
2102
+ const used = /* @__PURE__ */ new Set();
2103
+ const items = kids.map((k, i) => {
2104
+ const name = str2(k.props?.label) ?? str2(k.props?.title) ?? str2(k.props?.value);
2105
+ let v = (typeof k.meta?.choiceValue === "string" ? k.meta.choiceValue : name ?? `Tab ${i + 1}`).trim();
2106
+ while (used.has(v))
2107
+ v += ` (${i + 1})`;
2108
+ used.add(v);
2109
+ const signal = tabDiffSignal(k);
2110
+ const mark = signal ? `<span class="db-tab-mark" data-diff-tab="${esc(signal)}"><span aria-hidden="true">${TAB_GLYPH[signal] ?? "\u2022"}</span><span class="sr-only">${esc(signal)} in this comparison</span></span>` : "";
2111
+ return { value: v, label: esc(name ?? `Tab ${i + 1}`) + mark, body: () => renderBlocks(k.children, ctx), panelAttrs: sourceAttrText(k, ctx), id: str2(k.props?.id) };
2112
+ });
2113
+ const syncKey = str2(p.syncKey) ?? str2(p["sync-key"]) ?? str2(p.group) ?? str2(p.sync);
2114
+ const selected = typeof n.meta?.choiceDefault === "string" ? n.meta.choiceDefault : void 0;
2115
+ return tabGroup(items, ctx, passthrough(p, "my-4 w-full overflow-hidden rounded-lg border border-border"), syncKey, str2(p.variant), selected);
2116
+ }
2117
+ function tabGroup(items, ctx, rootAttrs, syncKey, variant, selected) {
2118
+ const first = selected !== void 0 && items.some((it) => it.value === selected) ? items.findIndex((it) => it.value === selected) : 0;
2119
+ const v = lookup(TAB_VARIANTS, variant);
2120
+ const group = ++ctx.seq;
2121
+ let list3 = "";
2122
+ let panels = "";
2123
+ items.forEach((it, i) => {
2124
+ const tid = `tab-${group}-${i + 1}`;
2125
+ const pid = it.id ?? `tabpanel-${group}-${i + 1}`;
2126
+ const sel = i === first;
2127
+ list3 += `<button data-part="trigger" data-value="${esc(it.value)}" role="tab" type="button" id="${tid}" aria-controls="${pid}" aria-selected="${sel}" tabindex="${sel ? 0 : -1}"${sel ? ' data-state="active"' : ""} class="${v?.trigger ?? TAB_TRIGGER}">${it.label}</button>`;
2128
+ panels += `<div data-part="content" data-value="${esc(it.value)}" role="tabpanel" id="${pid}" aria-labelledby="${tid}" tabindex="0"${sel ? ' data-state="active"' : " hidden"} class="${TAB_CONTENT}"${it.panelAttrs ?? ""}>${it.body()}</div>`;
2129
+ });
2130
+ return `<db-tabs${attrs({ ...rootAttrs, "default-value": items[first]?.value, "sync-key": syncKey })}><div data-part="list" role="tablist" aria-orientation="horizontal" class="${v?.list ?? "flex items-center border-b border-border bg-muted p-1 text-muted-foreground"}">${list3}</div>${panels}</db-tabs>
2131
+ `;
2132
+ }
2133
+ function accordion(n, ctx) {
2134
+ const p = n.props ?? {};
2135
+ const group = ++ctx.seq;
2136
+ const items = (n.children ?? []).filter((c) => c.type === "accordion-item");
2137
+ const chevron = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="shrink-0 transition-transform duration-200" aria-hidden="true" focusable="false"><path d="m6 9 6 6 6-6"/></svg>';
2138
+ const html = items.map((it, i) => {
2139
+ const label = str2(it.props?.label) ?? str2(it.props?.title) ?? `Item ${i + 1}`;
2140
+ const value = str2(it.props?.value) ?? `${slugify(label)}-${i + 1}`;
2141
+ const tid = `acc-${group}-${i + 1}`;
2142
+ const cid = `accpanel-${group}-${i + 1}`;
2143
+ return `<div data-part="item" data-value="${esc(value)}" class="border-b"${sourceAttrText(it, ctx)}><button data-part="trigger" type="button" id="${tid}" aria-controls="${cid}" aria-expanded="false" class="flex w-full items-center justify-between border-0 bg-transparent py-4 text-left font-medium text-foreground transition-all hover:underline disabled:pointer-events-none disabled:opacity-50 [&[aria-expanded=true]>svg]:rotate-180"><span>${esc(label)}</span>${chevron}</button><div data-part="content" id="${cid}" role="region" aria-labelledby="${tid}" hidden class="overflow-hidden pb-4 text-sm transition-all">${renderBlocks(it.children, ctx)}</div></div>`;
2144
+ }).join("");
2145
+ const dv = p.defaultValue;
2146
+ const defaultValue = Array.isArray(dv) ? dv.map(String).join(",") : str2(dv);
2147
+ const { defaultValue: _d, ...rest } = p;
2148
+ return `<db-accordion${attrs({ ...passthrough(rest, "my-4 w-full"), type: str2(p.type) ?? "single", "default-value": defaultValue })}>${html}</db-accordion>
2149
+ `;
2150
+ }
2151
+ function details(n, ctx) {
2152
+ let p = n.props ?? {};
2153
+ const sheetId = !str2(p.id) && isDetailsSheet(p) ? pageIds.get(ctx)?.get(n)?.id : void 0;
2154
+ if (sheetId) {
2155
+ ctx.ids.add(sheetId);
2156
+ p = { ...p, id: sheetId };
2157
+ }
2158
+ const title = str2(p.title) ?? str2(p.summary) ?? ctx.t("details");
2159
+ const type = (str2(p.variant) ?? str2(p.type) ?? "").toLowerCase();
2160
+ const variant = ALERT_VARIANT[VARIANT_ALIAS[type] ?? type] ? VARIANT_ALIAS[type] ?? type : "note";
2161
+ const html = type === "plain" ? plainCollapsible(titleMarkup(title, ctx), renderBlocks(n.children, ctx), flagOn(p.open), p, ctx) : collapsibleAlert(variant, titleMarkup(title, ctx), renderBlocks(n.children, ctx), flagOn(p.open), p, ctx);
2162
+ if (!isDetailsSheet(p))
2163
+ return html;
2164
+ return `<db-details-sheet${attrs({ "close-label": ctx.t("close") || "Close" })}>${html.trimEnd()}</db-details-sheet>
2165
+ `;
2166
+ }
2167
+ function figure(n, ctx) {
2168
+ const p = n.props ?? {};
2169
+ const caption = str2(p.caption);
2170
+ const kids = n.children ?? [];
2171
+ const body = kids.length === 1 && kids[0].type === "paragraph" && kids[0].inline?.every((i) => i.type === "image" || i.type === "text" && !i.text.trim()) ? renderInline(kids[0].inline, ctx) : renderBlocks(kids, ctx);
2172
+ return `<figure${attrs(passthrough(p, "my-4"))}>${body}${caption ? `<figcaption class="mt-2 text-center text-sm text-muted-foreground">${titleMarkup(caption, ctx)}</figcaption>` : ""}</figure>
2173
+ `;
2174
+ }
2175
+ function insideLink(yes, ctx, fn) {
2176
+ if (!yes)
2177
+ return fn();
2178
+ const was = ctx.inLink;
2179
+ ctx.inLink = true;
2180
+ try {
2181
+ return fn();
2182
+ } finally {
2183
+ ctx.inLink = was;
2184
+ }
2185
+ }
2186
+ function resolveIconMarkup(name, ctx) {
2187
+ const resolved = ctx.icons?.(name);
2188
+ if (resolved)
2189
+ return resolved.startsWith("<") ? resolved : `<span aria-hidden="true" class="inline-block w-[1em] text-center leading-none">${esc(resolved)}</span>`;
2190
+ const builtin = name.replace(/^lucide:/, "");
2191
+ return hasIcon(builtin) ? icon(builtin) : void 0;
2192
+ }
2193
+ function namedIcon(name, cls, ctx) {
2194
+ const resolved = ctx.icons?.(name);
2195
+ if (resolved)
2196
+ return `<span class="inline-flex shrink-0 ${cls}" aria-hidden="true" data-icon="${esc(name)}">${resolved.startsWith("<") ? resolved : esc(resolved)}</span>`;
2197
+ const builtin = name.replace(/^lucide:/, "");
2198
+ if (hasIcon(builtin))
2199
+ return icon(builtin, cls);
2200
+ (ctx.missingIcons ??= /* @__PURE__ */ new Set()).add(name);
2201
+ return `<span class="db-icon-missing" data-icon="${esc(name)}"></span>`;
2202
+ }
2203
+ function fileTreeItems(list3, ctx) {
2204
+ return (list3?.children ?? []).filter((li) => li.type === "list-item").map((li) => {
2205
+ const inline2 = li.inline ?? (li.children ?? []).find((c) => c.type === "paragraph")?.inline ?? [];
2206
+ const sub = (li.children ?? []).find((c) => c.type === "unordered-list" || c.type === "ordered-list");
2207
+ const name = inline2.map((n) => n.type === "text" || n.type === "code" ? n.text : "").join("");
2208
+ return { label: renderInline(inline2, ctx), folder: !!sub || /\/\s*$/.test(name), children: fileTreeItems(sub, ctx) };
2209
+ });
2210
+ }
2211
+ function card(n, ctx) {
2212
+ const p = n.props ?? {};
2213
+ const title = str2(p.title);
2214
+ const href = str2(p.href);
2215
+ const desc = str2(p.description);
2216
+ const ic = str2(p.icon);
2217
+ const iconHtml = !ic ? "" : /\.(svg|png|jpe?g|webp|avif)$/i.test(ic) ? `<img src="${esc(assetUrl(ic, ctx))}" alt="" class="size-5 mb-2" loading="lazy">` : namedIcon(ic, "mb-2 size-5 text-muted-foreground", ctx);
2218
+ const before = ctx.lastHeadingLevel;
2219
+ const whole = !!href && (!title || !cardBodyHasLink(n.children));
2220
+ const titleText = title && href && !whole ? `<a href="${esc(linkUrl(href, ctx))}">${esc(title)}</a>` : esc(title ?? "");
2221
+ const inner = insideLink(whole, ctx, () => iconHtml + // The parts are named (`data-part`), and the card and its tone below (`data-component`,
2222
+ // `data-tone`): what a print theme may rely on, where the classes are the site's own business
2223
+ // (docs/pdf-directives.md, "What a print theme can rely on"). `data-card-title` is the older name.
2224
+ (title ? `<div class="not-prose m-0 border-0 p-0 text-base font-semibold" data-part="title" data-card-title>${titleText}</div>` : "") + (desc ? `<p class="m-0 mt-1 text-sm text-muted-foreground [text-decoration:none]" data-part="description">${esc(desc)}</p>` : "") + // Body blocks in the same description wrapper as the Astro pipeline's card (a <div>: they carry their own <p>).
2225
+ (n.children?.length ? `<div class="text-sm text-muted-foreground mt-1 [text-decoration:none]" data-part="body">${renderBlocks(n.children, ctx)}</div>` : ""));
2226
+ ctx.lastHeadingLevel = before;
2227
+ const toned = lookup(CARD_TONE_CLASSES, str2(p.tone));
2228
+ const cls = `rounded-lg border ${toned ?? "bg-card"} p-4 text-card-foreground shadow-sm${whole ? ` transition-colors ${toned ? "hover:shadow-md" : "hover:border-foreground/20"}` : ""}`;
2229
+ const root = { ...passthrough(p, cls), "data-component": "card", "data-tone": toned ? str2(p.tone) : void 0 };
2230
+ return whole ? `<div${attrs(root)}><div class="p-0"><a href="${esc(linkUrl(href, ctx))}" data-variant="card" class="block text-foreground [text-decoration:none]">${inner}</a></div></div>` : `<div${attrs(root)}><div class="p-0">${inner}</div></div>`;
2231
+ }
2232
+ function linkCard(n, ctx) {
2233
+ if (n.children?.length)
2234
+ return card(n, ctx);
2235
+ const p = n.props ?? {};
2236
+ const title = str2(p.title) ?? "";
2237
+ const href = str2(p.href) ?? "#";
2238
+ const desc = str2(p.description);
2239
+ const chevron = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5" aria-hidden="true" focusable="false"><path d="m9 18 6-6-6-6"/></svg>';
2240
+ const ic = str2(p.icon);
2241
+ const iconHtml = ic ? namedIcon(ic, "size-4 shrink-0 text-muted-foreground", ctx) : "";
2242
+ return `<a${attrs({ ...passthrough(p, "group not-prose my-4 flex flex-col gap-1 rounded-lg border bg-card p-4 text-card-foreground no-underline shadow-sm transition-colors hover:bg-accent/50"), href: linkUrl(href, ctx) })}><div class="flex items-center justify-between"><span class="flex min-w-0 items-center gap-2">${iconHtml}<span class="text-sm font-semibold group-hover:underline">${esc(title)}</span></span>${chevron}</div>${desc ? `<p class="m-0 text-sm text-muted-foreground">${esc(desc)}</p>` : ""}</a>`;
2243
+ }
2244
+
2245
+ // node_modules/@dogsbay/render-html/dist/context.js
2246
+ var UI_STRINGS = {
2247
+ backToContent: "Back to content",
2248
+ close: "Close",
2249
+ /** A `collapse` fence's toggle; `{n}` is the number of lines it hides (`collapsedLine` for one). */
2250
+ collapsedLine: "1 collapsed line",
2251
+ collapsedLines: "{n} collapsed lines",
2252
+ copyCode: "Copy code",
2253
+ details: "Details",
2254
+ related: "Related links"
2255
+ };
2256
+ function createRenderContext(options = {}) {
2257
+ const { t, reservedIds, ...chosen } = options;
2258
+ return {
2259
+ ...chosen,
2260
+ // An explicit `link: undefined` must not remove the default
2261
+ link: chosen.link ?? ((href) => href),
2262
+ asset: chosen.asset ?? ((src) => src),
2263
+ headings: [],
2264
+ ids: new Set(reservedIds ?? []),
2265
+ unknown: /* @__PURE__ */ new Set(),
2266
+ missingIcons: /* @__PURE__ */ new Set(),
2267
+ unknownVariants: /* @__PURE__ */ new Set(),
2268
+ unsafeUrls: /* @__PURE__ */ new Set(),
2269
+ seq: 0,
2270
+ t: (key) => t?.(key) || UI_STRINGS[key] || ""
2271
+ };
2272
+ }
2273
+
2274
+ export {
2275
+ DIFF_CSS,
2276
+ scriptUrl,
2277
+ whenAttrs,
2278
+ inlineText,
2279
+ renderBlocks,
2280
+ codeRequest,
2281
+ highlightInputs,
2282
+ createRenderContext,
2283
+ normalize,
2284
+ dirname,
2285
+ join,
2286
+ relative,
2287
+ rootPrefix,
2288
+ isExternal,
2289
+ splitHref
2290
+ };