lldlab-ui 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -94,13 +94,23 @@ var SURFACE_TONE = {
94
94
  var RADIUS = { none: "", sm: "rounded", md: "rounded-lg", lg: "rounded-xl" };
95
95
  var BORDER = { none: "", subtle: "border border-border-subtle", strong: "border border-border-strong" };
96
96
  var SHADOW = { none: "", sm: "shadow-sm", md: "shadow-md" };
97
- function Box({ as, padding, radius = "none", tone, border = "none", shadow = "none", ...rest }) {
97
+ function Box({ as, padding, radius = "none", tone, border = "none", shadow = "none", dimmed, ...rest }) {
98
98
  const C = as ?? "div";
99
99
  return /* @__PURE__ */ jsx2(
100
100
  C,
101
101
  {
102
102
  ...rest,
103
- className: cx("min-w-0 max-w-full", tone && SURFACE_TONE[tone], responsive(PADDING, padding), RADIUS[radius], BORDER[border], SHADOW[shadow])
103
+ "data-theme": tone === "inverse" ? "dark" : void 0,
104
+ inert: dimmed || void 0,
105
+ className: cx(
106
+ "min-w-0 max-w-full",
107
+ tone && SURFACE_TONE[tone],
108
+ responsive(PADDING, padding),
109
+ RADIUS[radius],
110
+ BORDER[border],
111
+ SHADOW[shadow],
112
+ dimmed && "pointer-events-none select-none opacity-40"
113
+ )
104
114
  }
105
115
  );
106
116
  }
@@ -147,17 +157,32 @@ var PADDING2 = { md: "py-section-md", lg: "py-section-lg", xl: "py-section-xl" }
147
157
  var PATTERN = { none: "", dots: "bg-pattern-dots", grid: "bg-pattern-grid" };
148
158
  function Section({ as, tone, padding = "lg", pattern = "none", ...rest }) {
149
159
  const C = as ?? "section";
150
- return /* @__PURE__ */ jsx6(C, { ...rest, className: cx("w-full min-w-0", tone && SURFACE_TONE[tone], PADDING2[padding], PATTERN[pattern]) });
160
+ return /* @__PURE__ */ jsx6(C, { ...rest, "data-theme": tone === "inverse" ? "dark" : void 0, className: cx("w-full min-w-0", tone && SURFACE_TONE[tone], PADDING2[padding], PATTERN[pattern]) });
151
161
  }
152
162
 
153
163
  // src/primitives/Split.tsx
154
164
  import { jsx as jsx7, jsxs } from "react/jsx-runtime";
155
165
  var MAIN = { "8/4": "xl:col-span-8", "1/1": "xl:col-span-6", "9/3": "xl:col-span-9" };
156
166
  var ASIDE = { "8/4": "xl:col-span-4", "1/1": "xl:col-span-6", "9/3": "xl:col-span-3" };
157
- function Split({ ratio = "8/4", aside, sticky, gap = "lg", children, ...rest }) {
167
+ var STICKY_ASIDE = {
168
+ none: "xl:sticky xl:top-space-lg xl:self-start",
169
+ appbar: "xl:sticky xl:top-[calc(var(--spacing-appbar)+1rem)] xl:self-start"
170
+ };
171
+ var STICKY_START = {
172
+ none: "lg:sticky lg:top-space-lg lg:self-start",
173
+ appbar: "lg:sticky lg:top-[calc(var(--spacing-appbar)+1rem)] lg:self-start"
174
+ };
175
+ function Split({ ratio = "8/4", aside, start, sticky, stickyOffset = "none", gap = "lg", children, ...rest }) {
176
+ if (start) {
177
+ return /* @__PURE__ */ jsxs("div", { ...rest, className: cx("grid min-w-0 grid-cols-1 lg:grid-cols-12", responsive(GAP, gap)), children: [
178
+ /* @__PURE__ */ jsx7("div", { className: cx("hidden min-w-0 lg:col-span-3 lg:block xl:col-span-2", sticky && STICKY_START[stickyOffset]), children: start }),
179
+ /* @__PURE__ */ jsx7("div", { className: "min-w-0 lg:col-span-9 xl:col-span-7", children }),
180
+ /* @__PURE__ */ jsx7("aside", { className: cx("min-w-0 lg:col-span-9 lg:col-start-4 xl:col-span-3 xl:col-start-auto", sticky && STICKY_ASIDE[stickyOffset]), children: aside })
181
+ ] });
182
+ }
158
183
  return /* @__PURE__ */ jsxs("div", { ...rest, className: cx("grid min-w-0 grid-cols-1 xl:grid-cols-12", responsive(GAP, gap)), children: [
159
184
  /* @__PURE__ */ jsx7("div", { className: cx("min-w-0", MAIN[ratio]), children }),
160
- /* @__PURE__ */ jsx7("aside", { className: cx("min-w-0", ASIDE[ratio], sticky && "xl:sticky xl:top-space-lg xl:self-start"), children: aside })
185
+ /* @__PURE__ */ jsx7("aside", { className: cx("min-w-0", ASIDE[ratio], sticky && STICKY_ASIDE[stickyOffset]), children: aside })
161
186
  ] });
162
187
  }
163
188
 
@@ -182,7 +207,7 @@ var DOT_TONE = {
182
207
 
183
208
  // src/components/Icon.tsx
184
209
  import { jsx as jsx8 } from "react/jsx-runtime";
185
- var SIZE2 = { sm: "text-[16px]", md: "text-[20px]", lg: "text-[24px]" };
210
+ var SIZE2 = { sm: "text-[16px]", md: "text-[20px]", lg: "text-[24px]", xl: "text-[32px]" };
186
211
  function Icon({ name, size = "md", tone = "inherit", filled, spin, label, ...rest }) {
187
212
  return /* @__PURE__ */ jsx8(
188
213
  "span",
@@ -216,18 +241,43 @@ var VARIANT = {
216
241
  "body-lead": "font-body-lead text-body-lead",
217
242
  "body-md": "font-body-md text-body-md",
218
243
  "body-sm": "font-body-sm text-body-sm",
219
- label: "font-label-mono text-label-mono uppercase",
220
- code: "font-code-inline text-code-inline"
244
+ label: "font-label-mono text-label-mono",
245
+ code: "font-code-inline text-code-inline",
246
+ /** Inherits font and size from the parent (inline highlights inside a Heading). */
247
+ inherit: ""
221
248
  };
222
249
  var WEIGHT = { regular: "", medium: "font-medium", semibold: "font-semibold" };
223
250
  var CLAMP = { 1: "line-clamp-1", 2: "line-clamp-2", 3: "line-clamp-3", 4: "line-clamp-4" };
224
- function Text({ as, variant = "body-md", tone = "default", weight = "regular", truncate, clamp: clamp2, ...rest }) {
251
+ var ALIGN2 = { start: "text-start", center: "text-center", end: "text-end" };
252
+ function Text({
253
+ as,
254
+ variant = "body-md",
255
+ tone = "default",
256
+ weight = "regular",
257
+ truncate,
258
+ clamp: clamp2,
259
+ align,
260
+ measure,
261
+ uppercase,
262
+ ...rest
263
+ }) {
225
264
  const C = as ?? "p";
265
+ const upper = uppercase ?? variant === "label";
226
266
  return /* @__PURE__ */ jsx10(
227
267
  C,
228
268
  {
229
269
  ...rest,
230
- className: cx("min-w-0 wrap-break-word", VARIANT[variant], TEXT_TONE[tone], WEIGHT[weight], truncate && "truncate", clamp2 && CLAMP[clamp2])
270
+ className: cx(
271
+ "min-w-0 wrap-break-word",
272
+ VARIANT[variant],
273
+ TEXT_TONE[tone],
274
+ WEIGHT[weight],
275
+ truncate && "truncate",
276
+ clamp2 && CLAMP[clamp2],
277
+ align && ALIGN2[align],
278
+ measure && "max-w-prose",
279
+ upper && "uppercase"
280
+ )
231
281
  }
232
282
  );
233
283
  }
@@ -236,17 +286,36 @@ function Text({ as, variant = "body-md", tone = "default", weight = "regular", t
236
286
  import { jsx as jsx11 } from "react/jsx-runtime";
237
287
  var TAG = { 1: "h1", 2: "h2", 3: "h3", 4: "h4" };
238
288
  var DEFAULT_SIZE = { 1: "xl", 2: "lg", 3: "md", 4: "sm" };
239
- var TONE = { default: "text-ink", muted: "text-on-surface-variant", brand: "text-fg-brand", inverse: "text-on-primary" };
240
- function Heading({ level, size, tone = "default", ...rest }) {
289
+ var TONE = {
290
+ default: "text-ink",
291
+ muted: "text-on-surface-variant",
292
+ brand: "text-fg-brand",
293
+ inverse: "text-on-primary",
294
+ success: "text-fg-success",
295
+ danger: "text-fg-danger",
296
+ warning: "text-fg-warning"
297
+ };
298
+ var ALIGN3 = { start: "", center: "text-center" };
299
+ function Heading({ level, size, tone = "default", truncate, align = "start", ...rest }) {
241
300
  const C = TAG[level];
242
- return /* @__PURE__ */ jsx11(C, { ...rest, className: cx("min-w-0 font-display text-balance wrap-break-word", responsive(HEADING_SIZE, size ?? DEFAULT_SIZE[level]), TONE[tone]) });
301
+ return /* @__PURE__ */ jsx11(
302
+ C,
303
+ {
304
+ ...rest,
305
+ className: cx("min-w-0 font-display", truncate ? "truncate" : "text-balance wrap-break-word", responsive(HEADING_SIZE, size ?? DEFAULT_SIZE[level]), TONE[tone], ALIGN3[align])
306
+ }
307
+ );
243
308
  }
244
309
 
245
310
  // src/primitives/Eyebrow.tsx
246
311
  import { jsx as jsx12, jsxs as jsxs2 } from "react/jsx-runtime";
247
- function Eyebrow({ tone = "brand", children, ...rest }) {
248
- return /* @__PURE__ */ jsxs2("span", { ...rest, className: "inline-flex max-w-full items-center gap-space-xs rounded-full border border-border-subtle bg-surface-elevated px-space-sm py-space-2xs font-label-mono text-label-mono uppercase text-on-surface-variant", children: [
249
- /* @__PURE__ */ jsx12(Dot, { tone }),
312
+ var VARIANT2 = {
313
+ pill: "rounded-full border border-border-subtle bg-surface-elevated px-space-sm py-space-2xs",
314
+ plain: ""
315
+ };
316
+ function Eyebrow({ tone = "brand", pulse, variant = "pill", children, ...rest }) {
317
+ return /* @__PURE__ */ jsxs2("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-xs font-label-mono text-label-mono uppercase text-on-surface-variant", VARIANT2[variant]), children: [
318
+ /* @__PURE__ */ jsx12(Dot, { tone, pulse }),
250
319
  /* @__PURE__ */ jsx12("span", { className: "truncate", children })
251
320
  ] });
252
321
  }
@@ -258,11 +327,124 @@ function Code({ children, ...rest }) {
258
327
  }
259
328
 
260
329
  // src/primitives/CodeBlock.tsx
261
- import { jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
262
- function CodeBlock({ language, children, ...rest }) {
263
- return /* @__PURE__ */ jsxs3("figure", { ...rest, className: "min-w-0 max-w-full overflow-hidden rounded-xl bg-brand-obsidian", children: [
264
- language && /* @__PURE__ */ jsx14("figcaption", { className: "border-b border-white/10 px-space-md py-space-xs font-label-mono text-label-mono uppercase text-slate-300", children: language }),
265
- /* @__PURE__ */ jsx14("pre", { tabIndex: 0, className: "overflow-x-auto p-space-md font-code-inline text-code-inline text-slate-100 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt", children: /* @__PURE__ */ jsx14("code", { children }) })
330
+ import { useTokenize } from "prism-react-renderer";
331
+
332
+ // src/internal/highlight.ts
333
+ import { Prism } from "prism-react-renderer";
334
+ if (!Prism.languages.java) {
335
+ Prism.languages.java = Prism.languages.extend("clike", {
336
+ keyword: /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|record|return|sealed|short|static|super|switch|synchronized|this|throw|throws|transient|try|var|void|volatile|while|yield)\b/,
337
+ "class-name": /\b[A-Z]\w*\b/,
338
+ number: /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?[dfl]?/i
339
+ });
340
+ Prism.languages.insertBefore("java", "keyword", { annotation: { pattern: /@\w+/, alias: "punctuation" } });
341
+ }
342
+ if (!Prism.languages.bash) {
343
+ Prism.languages.bash = {
344
+ comment: { pattern: /(^|\s)#.*/, lookbehind: true },
345
+ string: [/"(?:\\.|[^"\\])*"/, /'[^']*'/],
346
+ variable: /\$(?:\w+|\{[^}]+\})/,
347
+ function: /\b(?:cd|echo|export|go|npm|npx|node|python3?|pip|git|ls|cat|curl|make)\b/,
348
+ operator: /&&|\|\||[|;<>]/,
349
+ punctuation: /[{}()[\]]/
350
+ };
351
+ }
352
+ var ALIAS = {
353
+ ts: "typescript",
354
+ typescript: "typescript",
355
+ tsx: "tsx",
356
+ js: "javascript",
357
+ javascript: "javascript",
358
+ jsx: "jsx",
359
+ py: "python",
360
+ python: "python",
361
+ go: "go",
362
+ golang: "go",
363
+ java: "java",
364
+ json: "json",
365
+ bash: "bash",
366
+ sh: "bash",
367
+ shell: "bash"
368
+ };
369
+ function resolveLanguage(lang) {
370
+ const id = lang ? ALIAS[lang.toLowerCase()] : void 0;
371
+ return id && Prism.languages[id] ? id : void 0;
372
+ }
373
+ var TOKEN_CLASS = {
374
+ keyword: "text-code-keyword",
375
+ builtin: "text-code-keyword",
376
+ tag: "text-code-keyword",
377
+ important: "text-code-keyword",
378
+ boolean: "text-code-number",
379
+ number: "text-code-number",
380
+ constant: "text-code-number",
381
+ string: "text-code-string",
382
+ char: "text-code-string",
383
+ "template-string": "text-code-string",
384
+ "attr-value": "text-code-string",
385
+ regex: "text-code-string",
386
+ comment: "text-code-comment italic",
387
+ prolog: "text-code-comment italic",
388
+ doctype: "text-code-comment italic",
389
+ function: "text-code-function",
390
+ "function-variable": "text-code-function",
391
+ variable: "text-code-function",
392
+ "class-name": "text-code-type",
393
+ "maybe-class-name": "text-code-type",
394
+ "attr-name": "text-code-type",
395
+ property: "text-code-type",
396
+ operator: "text-code-punctuation",
397
+ punctuation: "text-code-punctuation"
398
+ };
399
+ function tokenClass(types) {
400
+ for (let i = types.length - 1; i >= 0; i--) {
401
+ const c = TOKEN_CLASS[types[i]];
402
+ if (c) return c;
403
+ }
404
+ return "";
405
+ }
406
+
407
+ // src/primitives/CodeBlock.tsx
408
+ import { Fragment, jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
409
+ var TONE2 = {
410
+ dark: { root: "bg-brand-obsidian", header: "border-white/10 text-slate-300" },
411
+ subtle: { root: "code-subtle border border-border-subtle bg-code-bg-subtle", header: "border-border-subtle text-on-surface-variant" }
412
+ };
413
+ function Lines({ lines, numbered }) {
414
+ return /* @__PURE__ */ jsx14(Fragment, { children: lines.map((line, i) => /* @__PURE__ */ jsxs3("span", { className: "table-row", children: [
415
+ numbered && /* @__PURE__ */ jsx14("span", { "aria-hidden": "true", className: "table-cell select-none pr-space-md text-right text-code-comment", children: i + 1 }),
416
+ /* @__PURE__ */ jsxs3("span", { className: "table-cell", children: [
417
+ line.map((t, j) => /* @__PURE__ */ jsx14("span", { className: t.className || void 0, children: t.content }, j)),
418
+ "\n"
419
+ ] })
420
+ ] }, i)) });
421
+ }
422
+ function Highlighted({ code, language, numbered }) {
423
+ const tokens = useTokenize({ prism: Prism, code, grammar: Prism.languages[language], language });
424
+ return /* @__PURE__ */ jsx14(Lines, { numbered, lines: tokens.map((line) => line.map((t) => ({ content: t.content, className: tokenClass(t.types) }))) });
425
+ }
426
+ function CodeBlock({ language, highlight, title, meta, actions, lineNumbers, tone = "dark", children, ...rest }) {
427
+ const t = TONE2[tone];
428
+ const code = typeof children === "string" ? children.replace(/\n$/, "") : null;
429
+ const lang = highlight && code !== null ? resolveLanguage(language) : void 0;
430
+ const heading = title ?? language;
431
+ let body = children;
432
+ if (code !== null && lang) body = /* @__PURE__ */ jsx14(Highlighted, { code, language: lang, numbered: lineNumbers });
433
+ else if (code !== null && lineNumbers) body = /* @__PURE__ */ jsx14(Lines, { numbered: true, lines: code.split("\n").map((l) => [{ content: l, className: "" }]) });
434
+ return /* @__PURE__ */ jsxs3("figure", { ...rest, className: cx("min-w-0 max-w-full overflow-hidden rounded-xl", t.root), children: [
435
+ (heading || meta || actions) && /* @__PURE__ */ jsxs3("figcaption", { className: cx("flex min-w-0 flex-wrap items-center gap-space-sm border-b px-space-md py-space-xs font-label-mono text-label-mono", t.header), children: [
436
+ heading && /* @__PURE__ */ jsx14("span", { className: cx("min-w-0 truncate", !title && "uppercase"), children: heading }),
437
+ meta,
438
+ actions && /* @__PURE__ */ jsx14("span", { className: "ml-auto flex shrink-0 items-center gap-space-xs", children: actions })
439
+ ] }),
440
+ /* @__PURE__ */ jsx14(
441
+ "pre",
442
+ {
443
+ tabIndex: 0,
444
+ className: "overflow-x-auto p-space-md font-code-inline text-code-inline text-code-plain focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt",
445
+ children: /* @__PURE__ */ jsx14("code", { className: lineNumbers ? "table" : void 0, children: body })
446
+ }
447
+ )
266
448
  ] });
267
449
  }
268
450
 
@@ -279,7 +461,7 @@ var components = {
279
461
  h6: ({ children }) => /* @__PURE__ */ jsx15(Heading, { level: 4, size: "sm", children }),
280
462
  p: ({ children }) => /* @__PURE__ */ jsx15("p", { className: "font-body-md text-body-md text-on-surface wrap-break-word", children }),
281
463
  strong: ({ children }) => /* @__PURE__ */ jsx15("strong", { className: "font-semibold text-ink", children }),
282
- a: ({ href, children }) => /* @__PURE__ */ jsx15("a", { href, className: "text-fg-brand underline underline-offset-2 hover:text-brand-cobalt-hover wrap-break-word", children }),
464
+ a: ({ href, children }) => /* @__PURE__ */ jsx15("a", { href, className: "text-fg-brand underline underline-offset-2 hover:text-fg-brand-hover wrap-break-word", children }),
283
465
  ul: ({ className, children }) => /* @__PURE__ */ jsx15("ul", { className: cx("flex flex-col gap-space-xs", className === "contains-task-list" ? "pl-0" : "list-disc pl-space-lg"), children }),
284
466
  ol: ({ children }) => /* @__PURE__ */ jsx15("ol", { className: "flex list-decimal flex-col gap-space-xs pl-space-lg", children }),
285
467
  li: ({ className, children }) => /* @__PURE__ */ jsx15("li", { className: cx("font-body-md text-body-md text-on-surface", className === "task-list-item" ? "flex list-none items-start gap-space-xs wrap-anywhere" : "wrap-break-word"), children }),
@@ -304,8 +486,8 @@ function Markdown({ children, ...rest }) {
304
486
  }
305
487
 
306
488
  // src/components/Badge.tsx
307
- import { jsx as jsx16 } from "react/jsx-runtime";
308
- var TONE2 = {
489
+ import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
490
+ var TONE3 = {
309
491
  neutral: "bg-surface-muted text-on-surface-variant",
310
492
  brand: "bg-ink text-on-ink",
311
493
  success: "bg-badge-beginner-bg text-badge-beginner-text",
@@ -314,15 +496,28 @@ var TONE2 = {
314
496
  info: "bg-badge-intermediate-bg text-badge-intermediate-text"
315
497
  };
316
498
  var SIZE4 = { sm: "px-space-xs py-space-2xs", md: "px-space-sm py-space-xs" };
317
- function Badge({ tone = "neutral", uppercase, size = "sm", children, ...rest }) {
318
- return /* @__PURE__ */ jsx16("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-2xs whitespace-nowrap rounded font-label-mono text-label-mono", TONE2[tone], SIZE4[size], uppercase && "uppercase tracking-wider"), children: /* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate", children }) });
499
+ function Badge({ tone = "neutral", uppercase, size = "sm", icon, dot, pulse, children, ...rest }) {
500
+ return /* @__PURE__ */ jsxs4("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-2xs whitespace-nowrap rounded font-label-mono text-label-mono", TONE3[tone], SIZE4[size], uppercase && "uppercase tracking-wider"), children: [
501
+ dot && /* @__PURE__ */ jsx16(Dot, { tone: dot, pulse }),
502
+ icon && /* @__PURE__ */ jsx16(Icon, { name: icon, size: "sm" }),
503
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate", children })
504
+ ] });
319
505
  }
320
506
 
321
507
  // src/components/Chip.tsx
322
- import { jsx as jsx17, jsxs as jsxs4 } from "react/jsx-runtime";
323
- var TONE3 = { neutral: "border-border-subtle text-on-surface", brand: "border-brand-cobalt/40 text-fg-brand" };
324
- function Chip({ tone = "neutral", icon, onRemove, children, ...rest }) {
325
- return /* @__PURE__ */ jsxs4("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-2xs rounded-full border bg-surface-elevated px-space-sm py-space-2xs font-body-sm text-body-sm", TONE3[tone]), children: [
508
+ import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
509
+ var TONE4 = {
510
+ neutral: "border-border-subtle text-on-surface",
511
+ brand: "border-brand-cobalt/40 text-fg-brand",
512
+ info: "border-brand-cobalt/40 text-fg-brand",
513
+ success: "border-fg-success/40 text-fg-success",
514
+ warning: "border-fg-warning/40 text-fg-warning",
515
+ danger: "border-fg-danger/40 text-fg-danger"
516
+ };
517
+ var isStatusTone = (d) => d in DOT_TONE;
518
+ function Chip({ tone = "neutral", icon, dot, onRemove, children, ...rest }) {
519
+ return /* @__PURE__ */ jsxs5("span", { ...rest, className: cx("inline-flex max-w-full items-center gap-space-2xs rounded-full border bg-surface-elevated px-space-sm py-space-2xs font-body-sm text-body-sm", TONE4[tone]), children: [
520
+ dot && (isStatusTone(dot) ? /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", className: cx("inline-block size-1.5 shrink-0 rounded-full", DOT_TONE[dot]) }) : /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", className: "inline-block size-1.5 shrink-0 rounded-full", style: { backgroundColor: dot } })),
326
521
  icon && /* @__PURE__ */ jsx17(Icon, { name: icon, size: "sm" }),
327
522
  /* @__PURE__ */ jsx17("span", { className: "truncate", children }),
328
523
  onRemove && /* @__PURE__ */ jsx17(
@@ -339,11 +534,11 @@ function Chip({ tone = "neutral", icon, onRemove, children, ...rest }) {
339
534
  }
340
535
 
341
536
  // src/components/Stat.tsx
342
- import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
537
+ import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
343
538
  function Stat({ icon, label, value, ...rest }) {
344
- return /* @__PURE__ */ jsxs5("div", { ...rest, className: "flex min-w-0 items-center gap-space-sm", children: [
539
+ return /* @__PURE__ */ jsxs6("div", { ...rest, className: "flex min-w-0 items-center gap-space-sm", children: [
345
540
  /* @__PURE__ */ jsx18(Icon, { name: icon, tone: "muted" }),
346
- /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
541
+ /* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
347
542
  /* @__PURE__ */ jsx18("p", { className: "truncate font-label-mono text-label-mono uppercase text-on-surface-variant", children: label }),
348
543
  /* @__PURE__ */ jsx18("p", { className: "truncate font-display text-headline-sm text-ink", children: value })
349
544
  ] })
@@ -352,20 +547,18 @@ function Stat({ icon, label, value, ...rest }) {
352
547
 
353
548
  // src/components/ProgressBar.tsx
354
549
  import { useId } from "react";
355
- import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
356
- var TONE4 = { brand: "bg-brand-cobalt", success: "bg-brand-emerald", warning: "bg-brand-amber", danger: "bg-brand-crimson" };
357
- function ProgressBar({ value, max = 100, tone = "brand", label, hideLabel, ...rest }) {
550
+ import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
551
+ var TONE5 = { brand: "bg-brand-cobalt", success: "bg-brand-emerald", warning: "bg-brand-amber", danger: "bg-brand-crimson" };
552
+ var SIZE5 = { sm: "h-1", md: "h-1.5" };
553
+ function ProgressBar({ value, max = 100, tone = "brand", label, hideLabel, valueLabel, caption, size = "md", ...rest }) {
358
554
  const id = useId();
359
555
  const safeMax = max > 0 ? max : 0;
360
556
  const clamped = safeMax ? Math.min(safeMax, Math.max(0, value)) : 0;
361
557
  const pct = safeMax ? Math.round(clamped / safeMax * 100) : 0;
362
- return /* @__PURE__ */ jsxs6("div", { ...rest, className: "flex min-w-0 flex-col gap-space-2xs", children: [
363
- /* @__PURE__ */ jsxs6("div", { className: cx("flex justify-between gap-space-sm font-body-sm text-body-sm text-on-surface-variant", hideLabel && "sr-only"), children: [
364
- /* @__PURE__ */ jsx19("span", { id, className: "truncate", children: label }),
365
- /* @__PURE__ */ jsxs6("span", { className: "shrink-0 tabular-nums", children: [
366
- pct,
367
- "%"
368
- ] })
558
+ return /* @__PURE__ */ jsxs7("div", { ...rest, className: "flex min-w-0 flex-col gap-space-2xs", children: [
559
+ /* @__PURE__ */ jsxs7("div", { className: cx("flex justify-between gap-space-sm font-body-sm text-body-sm text-on-surface-variant", hideLabel && "sr-only"), children: [
560
+ /* @__PURE__ */ jsx19("span", { id, className: "min-w-0 truncate", children: label }),
561
+ /* @__PURE__ */ jsx19("span", { className: "shrink-0 tabular-nums", children: valueLabel ?? `${pct}%` })
369
562
  ] }),
370
563
  /* @__PURE__ */ jsx19(
371
564
  "div",
@@ -375,143 +568,226 @@ function ProgressBar({ value, max = 100, tone = "brand", label, hideLabel, ...re
375
568
  "aria-valuemin": 0,
376
569
  "aria-valuemax": safeMax,
377
570
  "aria-valuenow": clamped,
378
- className: "h-1.5 w-full overflow-hidden rounded-full bg-surface-muted",
379
- children: /* @__PURE__ */ jsx19("div", { className: cx("h-full rounded-full transition-[width]", TONE4[tone]), style: { width: `${pct}%` } })
571
+ className: cx("w-full overflow-hidden rounded-full bg-surface-muted", SIZE5[size]),
572
+ children: /* @__PURE__ */ jsx19("div", { className: cx("h-full rounded-full transition-[width]", TONE5[tone]), style: { width: `${pct}%` } })
380
573
  }
381
- )
574
+ ),
575
+ caption && /* @__PURE__ */ jsx19("p", { className: "font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: caption })
382
576
  ] });
383
577
  }
384
578
 
579
+ // src/components/IconTile.tsx
580
+ import { jsx as jsx20 } from "react/jsx-runtime";
581
+ var TONE6 = {
582
+ neutral: "bg-surface-muted text-on-surface-variant",
583
+ brand: "bg-badge-intermediate-bg text-badge-intermediate-text",
584
+ success: "bg-badge-beginner-bg text-badge-beginner-text",
585
+ warning: "bg-badge-amber-bg text-badge-amber-text",
586
+ danger: "bg-badge-advanced-bg text-badge-advanced-text"
587
+ };
588
+ var FILLED = {
589
+ neutral: "bg-ink text-on-ink",
590
+ brand: "bg-badge-intermediate-text text-badge-intermediate-bg",
591
+ success: "bg-badge-beginner-text text-badge-beginner-bg",
592
+ warning: "bg-badge-amber-text text-badge-amber-bg",
593
+ danger: "bg-badge-advanced-text text-badge-advanced-bg"
594
+ };
595
+ var SIZE6 = { sm: "size-8", md: "size-10", lg: "size-12", xl: "size-14" };
596
+ var ICON_SIZE = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
597
+ var SHAPE = { square: "rounded-lg", circle: "rounded-full" };
598
+ function IconTile({ icon, tone = "neutral", size = "md", shape = "square", filled, label, ...rest }) {
599
+ return /* @__PURE__ */ jsx20(
600
+ "span",
601
+ {
602
+ ...rest,
603
+ role: label ? "img" : void 0,
604
+ "aria-label": label,
605
+ "aria-hidden": label ? void 0 : true,
606
+ className: cx("inline-flex shrink-0 items-center justify-center", filled ? FILLED[tone] : TONE6[tone], SIZE6[size], SHAPE[shape]),
607
+ children: /* @__PURE__ */ jsx20(Icon, { name: icon, size: ICON_SIZE[size], filled })
608
+ }
609
+ );
610
+ }
611
+
385
612
  // src/components/SectionHeader.tsx
386
- import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
387
- function SectionHeader({ title, level = 2, dot, tag, meta, ...rest }) {
388
- return /* @__PURE__ */ jsxs7("div", { ...rest, className: "flex min-w-0 flex-wrap items-center gap-x-space-sm gap-y-space-xs border-b border-border-subtle pb-space-sm", children: [
389
- dot && /* @__PURE__ */ jsx20(Dot, { tone: dot, size: "md" }),
390
- /* @__PURE__ */ jsx20(Heading, { level, size: "sm", children: title }),
391
- tag && /* @__PURE__ */ jsx20(Badge, { uppercase: true, children: tag }),
392
- meta && /* @__PURE__ */ jsx20("span", { className: "ml-auto min-w-0 truncate font-label-mono text-label-mono uppercase text-on-surface-variant", children: meta })
613
+ import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
614
+ var ACCENT = {
615
+ neutral: "border-b-2 border-b-border-strong",
616
+ brand: "border-b-2 border-b-brand-cobalt",
617
+ success: "border-b-2 border-b-brand-emerald",
618
+ warning: "border-b-2 border-b-brand-amber",
619
+ danger: "border-b-2 border-b-brand-crimson"
620
+ };
621
+ function SectionHeader({ title, level = 2, dot, tag, tagTone = "neutral", meta, description, icon, accent, size = "sm", ...rest }) {
622
+ return /* @__PURE__ */ jsxs8("div", { ...rest, className: cx("flex min-w-0 flex-wrap items-center gap-x-space-sm gap-y-space-xs pb-space-sm", accent ? ACCENT[accent] : "border-b border-border-subtle"), children: [
623
+ icon && /* @__PURE__ */ jsx21(IconTile, { icon, size: "sm", tone: accent ?? "neutral" }),
624
+ dot && /* @__PURE__ */ jsx21(Dot, { tone: dot, size: "md" }),
625
+ /* @__PURE__ */ jsx21(Heading, { level, size, children: title }),
626
+ tag && /* @__PURE__ */ jsx21(Badge, { tone: tagTone, uppercase: true, children: tag }),
627
+ meta && /* @__PURE__ */ jsx21("span", { className: "ml-auto min-w-0 max-w-full truncate font-label-mono text-label-mono uppercase text-on-surface-variant", children: meta }),
628
+ description && /* @__PURE__ */ jsx21("p", { className: "basis-full font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: description })
393
629
  ] });
394
630
  }
395
631
 
396
632
  // src/components/Callout.tsx
397
- import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
398
- var TONE5 = {
633
+ import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
634
+ var TONE7 = {
399
635
  danger: "bg-badge-advanced-bg text-badge-advanced-text",
400
636
  info: "bg-badge-intermediate-bg text-badge-intermediate-text",
401
637
  success: "bg-badge-beginner-bg text-badge-beginner-text",
402
638
  warning: "bg-badge-amber-bg text-badge-amber-text"
403
639
  };
404
640
  var ICON = { danger: "error", info: "info", success: "check_circle", warning: "warning" };
405
- function Callout({ tone = "info", title, action, children, ...rest }) {
406
- return /* @__PURE__ */ jsxs8("div", { ...rest, role: tone === "danger" ? "alert" : "status", className: cx("flex min-w-0 flex-wrap items-start gap-space-sm rounded-xl border border-current/20 p-space-md", TONE5[tone]), children: [
407
- /* @__PURE__ */ jsx21(Icon, { name: ICON[tone] }),
408
- /* @__PURE__ */ jsxs8("div", { className: "min-w-0 flex-1", children: [
409
- title && /* @__PURE__ */ jsx21("p", { className: "font-display text-headline-sm wrap-break-word", children: title }),
410
- /* @__PURE__ */ jsx21("div", { className: "font-body-sm text-body-sm wrap-break-word", children })
641
+ var SIZE7 = { sm: "gap-space-xs rounded-lg p-space-sm", md: "gap-space-sm rounded-xl p-space-md" };
642
+ function Callout({ tone = "info", title, action, live = true, icon, size = "md", accent, children, ...rest }) {
643
+ const role = live ? tone === "danger" ? "alert" : "status" : void 0;
644
+ return /* @__PURE__ */ jsxs9("div", { ...rest, role, className: cx("flex min-w-0 flex-wrap items-start border border-current/20", TONE7[tone], SIZE7[size], accent && "border-l-4"), children: [
645
+ /* @__PURE__ */ jsx22(Icon, { name: icon ?? ICON[tone], size: size === "sm" ? "sm" : "md" }),
646
+ /* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
647
+ title && /* @__PURE__ */ jsx22("p", { className: cx("font-display wrap-break-word", size === "sm" ? "text-body-md font-semibold" : "text-headline-sm"), children: title }),
648
+ /* @__PURE__ */ jsx22("div", { className: "font-body-sm text-body-sm wrap-break-word", children })
411
649
  ] }),
412
- action && /* @__PURE__ */ jsx21("div", { className: "shrink-0", children: action })
650
+ action && /* @__PURE__ */ jsx22("div", { className: "shrink-0", children: action })
413
651
  ] });
414
652
  }
415
653
 
416
654
  // src/components/ResultRow.tsx
417
- import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
655
+ import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
418
656
  var STATUS = {
419
657
  pass: { icon: "check_circle", tone: "success", label: "Passed" },
420
658
  fail: { icon: "cancel", tone: "danger", label: "Failed" },
659
+ warning: { icon: "warning", tone: "warning", label: "Warning" },
421
660
  pending: { icon: "schedule", tone: "muted", label: "Pending" }
422
661
  };
423
- function ResultRow({ status, title, detail, meta, ...rest }) {
662
+ var VARIANT3 = { plain: "py-space-sm", boxed: "rounded-lg border border-border-subtle bg-surface-subtle p-space-sm" };
663
+ function ResultRow({ status, title, detail, meta, badge, variant = "plain", selected, titleMono, ...rest }) {
424
664
  const s = STATUS[status];
425
- return /* @__PURE__ */ jsxs9("div", { ...rest, className: "flex min-w-0 items-start gap-space-sm py-space-sm", children: [
426
- /* @__PURE__ */ jsx22(Icon, { name: s.icon, tone: s.tone, filled: true, label: s.label }),
427
- /* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
428
- /* @__PURE__ */ jsx22("p", { className: "font-body-md text-body-md text-on-surface wrap-break-word", children: title }),
429
- detail && /* @__PURE__ */ jsx22("p", { className: "whitespace-pre-wrap font-code-inline text-code-inline text-on-surface-variant wrap-break-word", children: detail })
665
+ return /* @__PURE__ */ jsxs10("div", { ...rest, className: cx("flex min-w-0 items-start gap-space-sm", VARIANT3[variant], selected && "border-l-4 border-l-brand-cobalt pl-space-sm"), children: [
666
+ /* @__PURE__ */ jsx23(Icon, { name: s.icon, tone: s.tone, filled: true, label: s.label }),
667
+ /* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1", children: [
668
+ /* @__PURE__ */ jsx23("p", { className: cx("text-on-surface wrap-break-word", titleMono ? "font-code-inline text-code-inline" : "font-body-md text-body-md"), children: title }),
669
+ detail && /* @__PURE__ */ jsx23("p", { className: "whitespace-pre-wrap font-code-inline text-code-inline text-on-surface-variant wrap-break-word", children: detail })
430
670
  ] }),
431
- meta && /* @__PURE__ */ jsx22("span", { className: "shrink-0 font-label-mono text-label-mono text-on-surface-variant", children: meta })
671
+ (meta || badge) && /* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center gap-space-xs", children: [
672
+ meta && /* @__PURE__ */ jsx23("span", { className: "font-label-mono text-label-mono text-on-surface-variant", children: meta }),
673
+ badge
674
+ ] })
432
675
  ] });
433
676
  }
434
677
 
435
678
  // src/components/Message.tsx
436
- import { jsx as jsx23 } from "react/jsx-runtime";
679
+ import { jsx as jsx24 } from "react/jsx-runtime";
437
680
  function Message({ tone = "default", children, ...rest }) {
438
- return /* @__PURE__ */ jsx23("p", { ...rest, role: tone === "danger" ? "alert" : "status", className: cx("min-w-0 font-body-md text-body-md wrap-break-word", tone === "danger" ? "text-fg-danger" : "text-on-surface-variant"), children });
681
+ return /* @__PURE__ */ jsx24("p", { ...rest, role: tone === "danger" ? "alert" : "status", className: cx("min-w-0 font-body-md text-body-md wrap-break-word", tone === "danger" ? "text-fg-danger" : "text-on-surface-variant"), children });
439
682
  }
440
683
 
441
684
  // src/components/EmptyState.tsx
442
- import { jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
443
- function EmptyState({ icon = "inbox", title, description, action, ...rest }) {
444
- return /* @__PURE__ */ jsxs10("div", { ...rest, className: "flex min-w-0 flex-col items-center gap-space-sm px-space-md py-space-xl text-center", children: [
445
- /* @__PURE__ */ jsx24("span", { className: "inline-flex size-12 items-center justify-center rounded-full bg-surface-muted text-on-surface-variant", children: /* @__PURE__ */ jsx24(Icon, { name: icon, size: "lg" }) }),
446
- /* @__PURE__ */ jsx24("div", { className: "w-full", children: /* @__PURE__ */ jsx24(Heading, { level: 3, size: "sm", children: title }) }),
447
- description && /* @__PURE__ */ jsx24("p", { className: "w-full max-w-prose font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: description }),
685
+ import { jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
686
+ var TONE8 = {
687
+ default: { tile: "bg-surface-muted text-on-surface-variant", text: "text-on-surface-variant" },
688
+ danger: { tile: "bg-badge-advanced-bg text-badge-advanced-text", text: "text-fg-danger" }
689
+ };
690
+ function EmptyState({ icon = "inbox", title, description, action, media, code, tone = "default", ...rest }) {
691
+ const t = TONE8[tone];
692
+ return /* @__PURE__ */ jsxs11("div", { ...rest, className: "flex min-w-0 flex-col items-center gap-space-sm px-space-md py-space-xl text-center", children: [
693
+ media ? /* @__PURE__ */ jsx25("div", { className: "w-full min-w-0", children: media }) : code ? /* @__PURE__ */ jsx25("p", { className: "font-label-mono text-6xl font-semibold text-ink", children: code }) : /* @__PURE__ */ jsx25("span", { className: cx("inline-flex size-12 items-center justify-center rounded-full", t.tile), children: /* @__PURE__ */ jsx25(Icon, { name: icon, size: "lg" }) }),
694
+ /* @__PURE__ */ jsx25("div", { className: "w-full min-w-0", children: /* @__PURE__ */ jsx25(Heading, { level: 3, size: "sm", children: title }) }),
695
+ description && /* @__PURE__ */ jsx25("p", { className: cx("w-full min-w-0 max-w-prose font-body-sm text-body-sm wrap-break-word", t.text), children: description }),
448
696
  action
449
697
  ] });
450
698
  }
451
699
 
452
700
  // src/components/CheckList.tsx
453
- import { jsx as jsx25, jsxs as jsxs11 } from "react/jsx-runtime";
454
- function CheckList({ items, ...rest }) {
455
- return /* @__PURE__ */ jsx25("ul", { ...rest, className: "flex min-w-0 flex-col gap-space-xs", children: items.map((item, i) => /* @__PURE__ */ jsxs11("li", { className: "flex items-start gap-space-xs font-body-md text-body-md text-on-surface", children: [
456
- /* @__PURE__ */ jsx25(Icon, { name: "check", size: "sm", tone: "success" }),
457
- /* @__PURE__ */ jsx25("span", { className: "min-w-0 wrap-break-word", children: item })
701
+ import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
702
+ function CheckList({ items, icon = "check", tone = "success", ...rest }) {
703
+ return /* @__PURE__ */ jsx26("ul", { ...rest, className: "flex min-w-0 flex-col gap-space-xs", children: items.map((item, i) => /* @__PURE__ */ jsxs12("li", { className: "flex items-start gap-space-xs font-body-md text-body-md text-on-surface", children: [
704
+ /* @__PURE__ */ jsx26(Icon, { name: icon, size: "sm", tone }),
705
+ /* @__PURE__ */ jsx26("span", { className: "min-w-0 wrap-break-word", children: item })
458
706
  ] }, i)) });
459
707
  }
460
708
 
461
709
  // src/components/Card.tsx
462
710
  import { Children, isValidElement } from "react";
463
- import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
464
- var TONE6 = {
711
+ import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
712
+ var TONE9 = {
465
713
  default: "bg-surface-elevated border border-border-subtle text-on-surface",
714
+ subtle: "bg-surface-subtle border border-border-subtle text-on-surface",
466
715
  inverse: "bg-brand-obsidian border border-brand-slate text-on-primary"
467
716
  };
468
717
  var PATTERN2 = { none: "", dots: "bg-pattern-dots", grid: "bg-pattern-grid" };
469
718
  var ASPECT = { video: "aspect-video", wide: "aspect-[21/9]", square: "aspect-square" };
470
- function CardMedia({ pattern = "dots", aspect = "video", children, ...rest }) {
471
- return /* @__PURE__ */ jsx26("div", { ...rest, className: cx("relative flex min-w-0 items-center justify-center border-b border-border-subtle bg-surface-subtle group-data-[tone=inverse]/card:border-white/10 group-data-[tone=inverse]/card:bg-white/5", PATTERN2[pattern], ASPECT[aspect]), children });
719
+ var HEIGHT = { sm: "h-30", md: "h-35" };
720
+ var INVERSE_BAR = "group-data-[tone=inverse]/card:border-white/10 group-data-[tone=inverse]/card:bg-white/5";
721
+ function CardHeader({ start, end, children, ...rest }) {
722
+ return /* @__PURE__ */ jsxs13("div", { ...rest, className: cx("flex min-w-0 flex-wrap items-center justify-between gap-space-sm border-b border-border-subtle bg-surface-subtle px-space-lg py-space-sm", INVERSE_BAR), children: [
723
+ /* @__PURE__ */ jsx27("div", { className: "flex min-w-0 items-center gap-space-sm", children: start ?? children }),
724
+ end && /* @__PURE__ */ jsx27("div", { className: "flex shrink-0 flex-wrap items-center gap-space-sm", children: end })
725
+ ] });
726
+ }
727
+ function CardMedia({ pattern = "dots", aspect = "video", height, caption, children, ...rest }) {
728
+ return /* @__PURE__ */ jsxs13(
729
+ "div",
730
+ {
731
+ ...rest,
732
+ className: cx("relative flex min-w-0 items-center justify-center border-b border-border-subtle bg-surface-subtle", INVERSE_BAR, PATTERN2[pattern], height ? HEIGHT[height] : ASPECT[aspect]),
733
+ children: [
734
+ caption && /* @__PURE__ */ jsx27("span", { className: "absolute left-space-sm top-space-sm font-label-mono text-[10px] uppercase tracking-wider text-on-surface-variant", children: caption }),
735
+ children
736
+ ]
737
+ }
738
+ );
472
739
  }
473
740
  function CardFooter({ children, ...rest }) {
474
- return /* @__PURE__ */ jsx26("div", { ...rest, className: "flex min-w-0 flex-wrap items-center justify-between gap-space-sm border-t border-border-subtle bg-surface-subtle px-space-lg py-space-sm group-data-[tone=inverse]/card:border-white/10 group-data-[tone=inverse]/card:bg-white/5", children });
741
+ return /* @__PURE__ */ jsx27("div", { ...rest, className: cx("flex min-w-0 flex-wrap items-center justify-between gap-space-sm border-t border-border-subtle bg-surface-subtle px-space-lg py-space-sm", INVERSE_BAR), children });
475
742
  }
476
- function CardRoot({ as, padding = "lg", interactive, tone = "default", children, ...rest }) {
743
+ function CardRoot({ as, padding = "lg", interactive, tone = "default", pattern = "none", children, ...rest }) {
477
744
  const C = as ?? "div";
478
745
  const parts = Children.toArray(children);
479
746
  const isType = (t) => (p) => isValidElement(p) && p.type === t;
747
+ const header = parts.filter(isType(CardHeader));
480
748
  const media = parts.filter(isType(CardMedia));
481
749
  const footer = parts.filter(isType(CardFooter));
482
- const body = parts.filter((p) => !media.includes(p) && !footer.includes(p));
483
- return /* @__PURE__ */ jsxs12(
750
+ const body = parts.filter((p) => !header.includes(p) && !media.includes(p) && !footer.includes(p));
751
+ return /* @__PURE__ */ jsxs13(
484
752
  C,
485
753
  {
486
754
  ...rest,
487
755
  "data-tone": tone,
488
- className: cx("group/card flex min-w-0 flex-col overflow-hidden rounded-xl", TONE6[tone], interactive && cx("transition-shadow hover:shadow-md", FOCUS_RING)),
756
+ "data-theme": tone === "inverse" ? "dark" : void 0,
757
+ className: cx("group/card flex min-w-0 flex-col overflow-hidden rounded-xl", TONE9[tone], PATTERN2[pattern], interactive && cx("transition-shadow hover:shadow-md", FOCUS_RING)),
489
758
  children: [
759
+ header,
490
760
  media,
491
- /* @__PURE__ */ jsx26("div", { className: cx("flex min-w-0 flex-1 flex-col gap-space-sm", responsive(PADDING, padding)), children: body }),
761
+ /* @__PURE__ */ jsx27("div", { className: cx("flex min-w-0 flex-1 flex-col gap-space-sm", responsive(PADDING, padding)), children: body }),
492
762
  footer
493
763
  ]
494
764
  }
495
765
  );
496
766
  }
497
- var Card = Object.assign(CardRoot, { Media: CardMedia, Footer: CardFooter });
767
+ var Card = Object.assign(CardRoot, { Header: CardHeader, Media: CardMedia, Footer: CardFooter });
498
768
 
499
769
  // src/components/Button.tsx
500
- import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
501
- var VARIANT2 = {
770
+ import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
771
+ var VARIANT4 = {
502
772
  primary: "bg-ink text-on-ink shadow-sm hover:bg-ink-hover",
503
773
  secondary: "border border-border-subtle bg-surface-elevated text-ink shadow-sm hover:bg-surface-muted",
504
774
  subtle: "bg-surface-subtle text-on-surface hover:bg-surface-muted",
505
775
  ghost: "bg-transparent text-on-surface hover:bg-surface-muted",
506
- danger: "bg-danger text-white shadow-sm hover:bg-danger-hover"
776
+ danger: "bg-danger text-white shadow-sm hover:bg-danger-hover",
777
+ brand: "bg-brand-cobalt text-white shadow-sm hover:bg-brand-cobalt-hover",
778
+ // Crimson call to action (not destructive): #DC2626 keeps white text at AA.
779
+ accent: "bg-brand-crimson-hover text-white shadow-sm hover:bg-danger"
507
780
  };
508
- var SIZE5 = { sm: "h-8 px-space-md", md: "h-10 px-space-lg", lg: "h-12 px-space-lg" };
781
+ var SIZE8 = { sm: "h-8 px-space-md", md: "h-10 px-space-lg", lg: "h-12 px-space-lg" };
509
782
  function Button({
510
783
  as,
511
784
  variant = "primary",
512
785
  size = "md",
513
786
  icon,
514
787
  iconRight,
788
+ iconTone,
789
+ iconFilled,
790
+ leading,
515
791
  fullWidth,
516
792
  loading,
517
793
  disabled,
@@ -522,7 +798,8 @@ function Button({
522
798
  const native = C === "button";
523
799
  const off = Boolean(disabled || loading);
524
800
  const state = native ? { type: rest.type ?? "button", disabled: off } : { "aria-disabled": off || void 0 };
525
- return /* @__PURE__ */ jsxs13(
801
+ const start = loading ? /* @__PURE__ */ jsx28(Icon, { name: "progress_activity", size: "sm", spin: true }) : leading ? /* @__PURE__ */ jsx28("span", { className: "inline-flex shrink-0 items-center", children: leading }) : icon && /* @__PURE__ */ jsx28(Icon, { name: icon, size: "sm", tone: iconTone, filled: iconFilled });
802
+ return /* @__PURE__ */ jsxs14(
526
803
  C,
527
804
  {
528
805
  ...rest,
@@ -531,105 +808,128 @@ function Button({
531
808
  className: cx(
532
809
  "inline-flex max-w-full items-center justify-center gap-space-xs whitespace-nowrap rounded-lg font-button-text text-button-text transition-colors",
533
810
  "disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50",
534
- VARIANT2[variant],
535
- SIZE5[size],
811
+ VARIANT4[variant],
812
+ SIZE8[size],
536
813
  FOCUS_RING,
537
814
  TOUCH,
538
815
  fullWidth && "w-full"
539
816
  ),
540
817
  children: [
541
- loading ? /* @__PURE__ */ jsx27(Icon, { name: "progress_activity", size: "sm", spin: true }) : icon && /* @__PURE__ */ jsx27(Icon, { name: icon, size: "sm" }),
542
- /* @__PURE__ */ jsx27("span", { className: "truncate", children }),
543
- iconRight && /* @__PURE__ */ jsx27(Icon, { name: iconRight, size: "sm" })
818
+ start,
819
+ /* @__PURE__ */ jsx28("span", { className: "inline-flex min-w-0 items-center gap-space-xs truncate", children }),
820
+ iconRight && /* @__PURE__ */ jsx28(Icon, { name: iconRight, size: "sm" })
544
821
  ]
545
822
  }
546
823
  );
547
824
  }
548
825
 
549
826
  // src/components/IconButton.tsx
550
- import { jsx as jsx28 } from "react/jsx-runtime";
551
- var VARIANT3 = {
827
+ import { jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
828
+ var VARIANT5 = {
552
829
  ghost: "text-on-surface-variant hover:bg-surface-muted hover:text-on-surface",
553
830
  subtle: "bg-surface-subtle text-on-surface hover:bg-surface-muted",
831
+ secondary: "border border-border-subtle bg-surface-elevated text-on-surface hover:bg-surface-muted",
554
832
  primary: "bg-ink text-on-ink hover:bg-ink-hover"
555
833
  };
556
- var SIZE6 = { sm: "size-8", md: "size-10" };
557
- function IconButton({ icon, label, variant = "ghost", size = "md", type = "button", ...rest }) {
558
- return /* @__PURE__ */ jsx28(
559
- "button",
834
+ var SIZE9 = { xs: "size-6", sm: "size-8", md: "size-10" };
835
+ function IconButton({ as, icon, label, variant = "ghost", size = "md", dot, badge, ...rest }) {
836
+ const C = as ?? "button";
837
+ const native = C === "button";
838
+ const typeProp = native ? { type: rest.type ?? "button" } : {};
839
+ return /* @__PURE__ */ jsxs15(
840
+ C,
560
841
  {
561
842
  ...rest,
562
- type,
843
+ ...typeProp,
563
844
  "aria-label": label,
564
845
  title: label,
565
- className: cx("inline-flex shrink-0 items-center justify-center rounded-lg transition-colors disabled:pointer-events-none disabled:opacity-50", VARIANT3[variant], SIZE6[size], FOCUS_RING, TOUCH_ICON),
566
- children: /* @__PURE__ */ jsx28(Icon, { name: icon, size: size === "sm" ? "sm" : "md" })
846
+ className: cx(
847
+ "relative inline-flex shrink-0 items-center justify-center rounded-lg transition-colors disabled:pointer-events-none disabled:opacity-50",
848
+ VARIANT5[variant],
849
+ SIZE9[size],
850
+ FOCUS_RING,
851
+ TOUCH_ICON
852
+ ),
853
+ children: [
854
+ /* @__PURE__ */ jsx29(Icon, { name: icon, size: size === "md" ? "md" : "sm" }),
855
+ dot && /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: cx("absolute right-1.5 top-1.5 size-2 rounded-full ring-2 ring-surface-elevated", DOT_TONE[dot]) }),
856
+ badge && /* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: "absolute -right-1 -top-1 min-w-4 rounded-full bg-brand-crimson-hover px-1 text-center font-label-mono text-[10px] leading-4 text-white", children: badge })
857
+ ]
567
858
  }
568
859
  );
569
860
  }
570
861
 
571
862
  // src/components/Kbd.tsx
572
- import { jsx as jsx29 } from "react/jsx-runtime";
863
+ import { jsx as jsx30 } from "react/jsx-runtime";
573
864
  function Kbd({ children, ...rest }) {
574
- return /* @__PURE__ */ jsx29("kbd", { ...rest, className: "inline-flex items-center rounded border border-border-subtle bg-surface-subtle px-space-xs font-label-mono text-[11px] leading-5 text-on-surface-variant", children });
865
+ return /* @__PURE__ */ jsx30("kbd", { ...rest, className: "inline-flex items-center rounded border border-border-subtle bg-surface-subtle px-space-xs font-label-mono text-[11px] leading-5 text-on-surface-variant", children });
575
866
  }
576
867
 
577
868
  // src/components/TextField.tsx
578
- import { useId as useId2 } from "react";
579
- import { jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
580
- function TextField({ label, hideLabel, icon, hint, error, id, ...rest }) {
869
+ import { useId as useId2, useState } from "react";
870
+ import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
871
+ var SIZE10 = { sm: "h-8", md: "h-10" };
872
+ var TEXT = { sm: "font-body-sm text-body-sm", md: "font-body-md text-body-md" };
873
+ function TextField({ label, hideLabel, icon, hint, error, labelEnd, revealable, size = "md", id, type, ...rest }) {
581
874
  const generated = useId2();
582
875
  const inputId = id ?? generated;
583
876
  const errorId = `${inputId}-error`;
584
- return /* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 flex-col gap-space-2xs", children: [
585
- /* @__PURE__ */ jsx30("label", { htmlFor: inputId, className: cx("font-body-sm text-body-sm font-medium text-on-surface", hideLabel && "sr-only"), children: label }),
586
- /* @__PURE__ */ jsxs14(
877
+ const [shown, setShown] = useState(false);
878
+ return /* @__PURE__ */ jsxs16("div", { className: "flex min-w-0 flex-col gap-space-2xs", children: [
879
+ /* @__PURE__ */ jsxs16("div", { className: cx("flex min-w-0 items-center justify-between gap-space-sm", hideLabel && !labelEnd && "sr-only"), children: [
880
+ /* @__PURE__ */ jsx31("label", { htmlFor: inputId, className: cx("font-body-sm text-body-sm font-medium text-on-surface", hideLabel && "sr-only"), children: label }),
881
+ labelEnd
882
+ ] }),
883
+ /* @__PURE__ */ jsxs16(
587
884
  "div",
588
885
  {
589
886
  className: cx(
590
- "flex h-10 min-w-0 items-center gap-space-xs rounded-lg border bg-surface-subtle px-space-sm focus-within:ring-2 focus-within:ring-brand-cobalt",
887
+ "flex min-w-0 items-center gap-space-xs rounded-lg border bg-surface-subtle px-space-sm focus-within:ring-2 focus-within:ring-brand-cobalt",
888
+ SIZE10[size],
591
889
  error ? "border-fg-danger" : "border-border-subtle",
592
890
  TOUCH
593
891
  ),
594
892
  children: [
595
- icon && /* @__PURE__ */ jsx30(Icon, { name: icon, size: "sm", tone: "muted" }),
596
- /* @__PURE__ */ jsx30(
893
+ icon && /* @__PURE__ */ jsx31(Icon, { name: icon, size: "sm", tone: "muted" }),
894
+ /* @__PURE__ */ jsx31(
597
895
  "input",
598
896
  {
599
897
  ...rest,
600
898
  id: inputId,
899
+ type: revealable ? shown ? "text" : "password" : type,
601
900
  "aria-invalid": error ? true : rest["aria-invalid"],
602
901
  "aria-describedby": cx(rest["aria-describedby"], error && errorId) || void 0,
603
- className: "h-full min-w-0 flex-1 bg-transparent font-body-md text-body-md text-on-surface outline-none placeholder:text-on-surface-variant"
902
+ className: cx("h-full min-w-0 flex-1 bg-transparent text-on-surface outline-none placeholder:text-on-surface-variant", TEXT[size])
604
903
  }
605
904
  ),
606
- hint && /* @__PURE__ */ jsx30("span", { className: "shrink-0", children: hint })
905
+ hint && /* @__PURE__ */ jsx31("span", { className: "shrink-0", children: hint }),
906
+ revealable && /* @__PURE__ */ jsx31(IconButton, { icon: shown ? "visibility_off" : "visibility", label: "Show password", "aria-pressed": shown, size: "xs", onClick: () => setShown((s) => !s) })
607
907
  ]
608
908
  }
609
909
  ),
610
- error && /* @__PURE__ */ jsx30("p", { id: errorId, className: "font-body-sm text-body-sm text-fg-danger", children: error })
910
+ error && /* @__PURE__ */ jsx31("p", { id: errorId, className: "font-body-sm text-body-sm text-fg-danger", children: error })
611
911
  ] });
612
912
  }
613
913
 
614
914
  // src/components/Select.tsx
615
915
  import { useId as useId3 } from "react";
616
- import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
916
+ import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
617
917
  function Select({ label, hideLabel, options, id, ...rest }) {
618
918
  const generated = useId3();
619
919
  const selectId = id ?? generated;
620
- return /* @__PURE__ */ jsxs15("div", { className: "flex min-w-0 flex-col gap-space-2xs", children: [
621
- /* @__PURE__ */ jsx31("label", { htmlFor: selectId, className: cx("font-body-sm text-body-sm font-medium text-on-surface", hideLabel && "sr-only"), children: label }),
622
- /* @__PURE__ */ jsxs15("div", { className: "relative min-w-0", children: [
623
- /* @__PURE__ */ jsx31(
920
+ return /* @__PURE__ */ jsxs17("div", { className: "flex min-w-0 flex-col gap-space-2xs", children: [
921
+ /* @__PURE__ */ jsx32("label", { htmlFor: selectId, className: cx("font-body-sm text-body-sm font-medium text-on-surface", hideLabel && "sr-only"), children: label }),
922
+ /* @__PURE__ */ jsxs17("div", { className: "relative min-w-0", children: [
923
+ /* @__PURE__ */ jsx32(
624
924
  "select",
625
925
  {
626
926
  ...rest,
627
927
  id: selectId,
628
928
  className: cx("h-10 w-full min-w-0 appearance-none rounded-lg border border-border-subtle bg-surface-subtle pl-space-sm pr-space-xl font-body-md text-body-md text-on-surface", FOCUS_RING, TOUCH),
629
- children: options.map((o) => /* @__PURE__ */ jsx31("option", { value: o.value, children: o.label }, o.value))
929
+ children: options.map((o) => /* @__PURE__ */ jsx32("option", { value: o.value, children: o.label }, o.value))
630
930
  }
631
931
  ),
632
- /* @__PURE__ */ jsx31("span", { className: "pointer-events-none absolute inset-y-0 right-space-sm flex items-center text-on-surface-variant", children: /* @__PURE__ */ jsx31(Icon, { name: "expand_more", size: "sm" }) })
932
+ /* @__PURE__ */ jsx32("span", { className: "pointer-events-none absolute inset-y-0 right-space-sm flex items-center text-on-surface-variant", children: /* @__PURE__ */ jsx32(Icon, { name: "expand_more", size: "sm" }) })
633
933
  ] })
634
934
  ] });
635
935
  }
@@ -656,8 +956,8 @@ function rovingIndex(key, index, count) {
656
956
  }
657
957
 
658
958
  // src/components/Tabs.tsx
659
- import { Fragment, jsx as jsx32, jsxs as jsxs16 } from "react/jsx-runtime";
660
- var VARIANT4 = {
959
+ import { Fragment as Fragment2, jsx as jsx33, jsxs as jsxs18 } from "react/jsx-runtime";
960
+ var VARIANT6 = {
661
961
  underline: {
662
962
  list: "flex min-w-0 max-w-full gap-space-lg overflow-x-auto border-b border-border-subtle [scrollbar-width:none]",
663
963
  tab: "inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap border-b-2 py-space-sm font-button-text text-button-text transition-colors",
@@ -672,22 +972,23 @@ var VARIANT4 = {
672
972
  }
673
973
  };
674
974
  function TabBody({ item }) {
675
- return /* @__PURE__ */ jsxs16(Fragment, { children: [
975
+ return /* @__PURE__ */ jsxs18(Fragment2, { children: [
676
976
  item.label,
677
- item.count !== void 0 && /* @__PURE__ */ jsx32(Badge, { children: item.count }),
678
- item.dot && /* @__PURE__ */ jsx32(Dot, { tone: item.dot })
977
+ item.count !== void 0 && /* @__PURE__ */ jsx33(Badge, { children: item.count }),
978
+ item.badge,
979
+ item.dot && /* @__PURE__ */ jsx33(Dot, { tone: item.dot })
679
980
  ] });
680
981
  }
681
982
  function Tabs({ items, value, onChange, variant = "underline", label, ...rest }) {
682
983
  const baseId = useId4();
683
984
  const refs = useRef([]);
684
985
  if (!items.length) return null;
685
- const v = VARIANT4[variant];
986
+ const v = VARIANT6[variant];
686
987
  if (items.some((i) => i.href)) {
687
- return /* @__PURE__ */ jsx32("nav", { ...rest, "aria-label": label, className: "min-w-0 max-w-full", children: /* @__PURE__ */ jsx32("ul", { className: v.list, children: items.map((item) => {
988
+ return /* @__PURE__ */ jsx33("nav", { ...rest, "aria-label": label, className: "min-w-0 max-w-full", children: /* @__PURE__ */ jsx33("ul", { className: v.list, children: items.map((item) => {
688
989
  const C = item.as ?? "a";
689
990
  const active = item.id === value;
690
- return /* @__PURE__ */ jsx32("li", { className: "flex shrink-0", children: /* @__PURE__ */ jsx32(C, { href: item.href, "aria-current": active ? "page" : void 0, className: cx(v.tab, active ? v.active : v.idle, FOCUS_RING, TOUCH), children: /* @__PURE__ */ jsx32(TabBody, { item }) }) }, item.id);
991
+ return /* @__PURE__ */ jsx33("li", { className: "flex shrink-0", children: /* @__PURE__ */ jsx33(C, { href: item.href, "aria-current": active ? "page" : void 0, className: cx(v.tab, active ? v.active : v.idle, FOCUS_RING, TOUCH), children: /* @__PURE__ */ jsx33(TabBody, { item }) }) }, item.id);
691
992
  }) }) });
692
993
  }
693
994
  const activeIndex = Math.max(0, items.findIndex((i) => i.id === value));
@@ -698,9 +999,9 @@ function Tabs({ items, value, onChange, variant = "underline", label, ...rest })
698
999
  refs.current[next]?.focus();
699
1000
  onChange?.(items[next].id);
700
1001
  };
701
- return /* @__PURE__ */ jsx32("div", { ...rest, role: "tablist", "aria-label": label, className: v.list, children: items.map((item, i) => {
1002
+ return /* @__PURE__ */ jsx33("div", { ...rest, role: "tablist", "aria-label": label, className: v.list, children: items.map((item, i) => {
702
1003
  const active = i === activeIndex;
703
- return /* @__PURE__ */ jsx32(
1004
+ return /* @__PURE__ */ jsx33(
704
1005
  "button",
705
1006
  {
706
1007
  ref: (el) => {
@@ -715,19 +1016,19 @@ function Tabs({ items, value, onChange, variant = "underline", label, ...rest })
715
1016
  onClick: () => onChange?.(item.id),
716
1017
  onKeyDown: (e) => onKeyDown(e, i),
717
1018
  className: cx(v.tab, active ? v.active : v.idle, FOCUS_RING, TOUCH),
718
- children: /* @__PURE__ */ jsx32(TabBody, { item })
1019
+ children: /* @__PURE__ */ jsx33(TabBody, { item })
719
1020
  },
720
1021
  item.id
721
1022
  );
722
1023
  }) });
723
1024
  }
724
1025
  function TabPanel({ id, active, children, ...rest }) {
725
- return /* @__PURE__ */ jsx32("div", { ...rest, role: "tabpanel", id, "aria-labelledby": `${id}-tab`, hidden: !active, tabIndex: 0, className: cx("min-w-0 outline-none", FOCUS_RING), children });
1026
+ return /* @__PURE__ */ jsx33("div", { ...rest, role: "tabpanel", id, "aria-labelledby": `${id}-tab`, hidden: !active, tabIndex: 0, className: cx("min-w-0 outline-none", FOCUS_RING), children });
726
1027
  }
727
1028
 
728
1029
  // src/components/SegmentedControl.tsx
729
1030
  import { useRef as useRef2 } from "react";
730
- import { jsx as jsx33, jsxs as jsxs17 } from "react/jsx-runtime";
1031
+ import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
731
1032
  function SegmentedControl({ label, options, value, onChange, ...rest }) {
732
1033
  const refs = useRef2([]);
733
1034
  const checkedIndex = options.findIndex((o) => o.value === value);
@@ -739,9 +1040,9 @@ function SegmentedControl({ label, options, value, onChange, ...rest }) {
739
1040
  refs.current[next]?.focus();
740
1041
  onChange(options[next].value);
741
1042
  };
742
- return /* @__PURE__ */ jsx33("div", { ...rest, role: "radiogroup", "aria-label": label, className: "inline-flex min-w-0 max-w-full gap-space-2xs overflow-x-auto rounded-lg border border-border-subtle bg-surface-subtle p-space-2xs [scrollbar-width:none]", children: options.map((o, i) => {
1043
+ return /* @__PURE__ */ jsx34("div", { ...rest, role: "radiogroup", "aria-label": label, className: "inline-flex min-w-0 max-w-full gap-space-2xs overflow-x-auto rounded-lg border border-border-subtle bg-surface-subtle p-space-2xs [scrollbar-width:none]", children: options.map((o, i) => {
743
1044
  const checked = i === checkedIndex;
744
- return /* @__PURE__ */ jsxs17(
1045
+ return /* @__PURE__ */ jsxs19(
745
1046
  "button",
746
1047
  {
747
1048
  ref: (el) => {
@@ -750,18 +1051,22 @@ function SegmentedControl({ label, options, value, onChange, ...rest }) {
750
1051
  type: "button",
751
1052
  role: "radio",
752
1053
  "aria-checked": checked,
1054
+ "aria-label": o.hideLabel ? o.label : void 0,
1055
+ title: o.hideLabel ? o.label : void 0,
753
1056
  tabIndex: i === tabbable ? 0 : -1,
754
1057
  onClick: () => onChange(o.value),
755
1058
  onKeyDown: (e) => onKeyDown(e, i),
756
1059
  className: cx(
757
- "inline-flex shrink-0 items-center gap-space-xs whitespace-nowrap rounded-md px-space-sm py-space-xs font-button-text text-button-text transition-colors",
1060
+ "inline-flex shrink-0 items-center justify-center gap-space-xs whitespace-nowrap rounded-md py-space-xs font-button-text text-button-text transition-colors",
1061
+ o.hideLabel ? "px-space-xs" : "px-space-sm",
758
1062
  checked ? "bg-surface-elevated text-ink shadow-sm" : "text-on-surface-variant hover:text-on-surface",
759
1063
  FOCUS_RING,
760
- TOUCH
1064
+ o.hideLabel ? TOUCH_ICON : TOUCH
761
1065
  ),
762
1066
  children: [
763
- o.icon && /* @__PURE__ */ jsx33(Icon, { name: o.icon, size: "sm" }),
764
- o.label
1067
+ o.dot && /* @__PURE__ */ jsx34(Dot, { tone: o.dot }),
1068
+ o.icon && /* @__PURE__ */ jsx34(Icon, { name: o.icon, size: "sm" }),
1069
+ !o.hideLabel && o.label
765
1070
  ]
766
1071
  },
767
1072
  o.value
@@ -770,31 +1075,43 @@ function SegmentedControl({ label, options, value, onChange, ...rest }) {
770
1075
  }
771
1076
 
772
1077
  // src/components/Dialog.tsx
773
- import { useEffect, useId as useId5, useRef as useRef3 } from "react";
1078
+ import { useId as useId5, useRef as useRef4 } from "react";
774
1079
  import { createPortal } from "react-dom";
775
- import { jsx as jsx34, jsxs as jsxs18 } from "react/jsx-runtime";
776
- var SIZE7 = { sm: "max-w-sm", md: "max-w-md", lg: "max-w-2xl" };
1080
+
1081
+ // src/internal/useModal.ts
1082
+ import { useEffect, useRef as useRef3 } from "react";
777
1083
  var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
778
- function Dialog({ open, onClose, title, description, footer, size = "md", children, ...rest }) {
779
- const titleId = useId5();
780
- const descId = useId5();
781
- const panelRef = useRef3(null);
782
- const contentRef = useRef3(null);
1084
+ var openPanels = [];
1085
+ var locks = 0;
1086
+ var savedOverflow = "";
1087
+ function lockScroll() {
1088
+ if (locks++ === 0) {
1089
+ savedOverflow = document.body.style.overflow;
1090
+ document.body.style.overflow = "hidden";
1091
+ }
1092
+ }
1093
+ function unlockScroll() {
1094
+ if (--locks === 0) document.body.style.overflow = savedOverflow;
1095
+ }
1096
+ function useModal({ open, onClose, panelRef, initialFocusRef }) {
783
1097
  const onCloseRef = useRef3(onClose);
784
- const theme = useThemeTone();
785
1098
  useEffect(() => {
786
1099
  onCloseRef.current = onClose;
787
1100
  });
788
1101
  useEffect(() => {
789
1102
  if (!open) return;
790
1103
  const opener = document.activeElement;
791
- const previousOverflow = document.body.style.overflow;
792
- document.body.style.overflow = "hidden";
793
1104
  const panel = panelRef.current;
1105
+ openPanels.push(panel);
1106
+ lockScroll();
794
1107
  const focusables = () => [...panel.querySelectorAll(FOCUSABLE)];
795
- (contentRef.current?.querySelector(FOCUSABLE) ?? focusables()[0] ?? panel).focus();
1108
+ const initial = initialFocusRef?.current;
1109
+ const target = initial?.matches(FOCUSABLE) ? initial : initial?.querySelector(FOCUSABLE);
1110
+ (target ?? focusables()[0] ?? panel).focus();
796
1111
  const onKey = (e) => {
797
1112
  if (e.defaultPrevented) return;
1113
+ const owner = openPanels.find((p) => p.contains(document.activeElement));
1114
+ if (owner ? owner !== panel : openPanels[openPanels.length - 1] !== panel) return;
798
1115
  if (e.key === "Escape") {
799
1116
  e.preventDefault();
800
1117
  onCloseRef.current();
@@ -818,7 +1135,8 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
818
1135
  document.addEventListener("keydown", onKey);
819
1136
  return () => {
820
1137
  document.removeEventListener("keydown", onKey);
821
- document.body.style.overflow = previousOverflow;
1138
+ openPanels.splice(openPanels.indexOf(panel), 1);
1139
+ unlockScroll();
822
1140
  if (opener?.isConnected) opener.focus();
823
1141
  else {
824
1142
  document.activeElement?.blur();
@@ -826,17 +1144,29 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
826
1144
  }
827
1145
  };
828
1146
  }, [open]);
1147
+ }
1148
+
1149
+ // src/components/Dialog.tsx
1150
+ import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
1151
+ var SIZE11 = { sm: "max-w-sm", md: "max-w-md", lg: "max-w-2xl" };
1152
+ function Dialog({ open, onClose, title, description, footer, size = "md", children, ...rest }) {
1153
+ const titleId = useId5();
1154
+ const descId = useId5();
1155
+ const panelRef = useRef4(null);
1156
+ const contentRef = useRef4(null);
1157
+ const theme = useThemeTone();
1158
+ useModal({ open, onClose, panelRef, initialFocusRef: contentRef });
829
1159
  if (!open || typeof document === "undefined") return null;
830
1160
  return createPortal(
831
- /* @__PURE__ */ jsx34(
1161
+ /* @__PURE__ */ jsx35(
832
1162
  "div",
833
1163
  {
834
1164
  "data-theme": theme,
835
1165
  className: "fixed inset-0 z-50 flex items-end justify-center bg-brand-obsidian/40 p-space-md backdrop-blur-sm sm:items-center",
836
1166
  onMouseDown: (e) => {
837
- if (e.target === e.currentTarget) onCloseRef.current();
1167
+ if (e.target === e.currentTarget) onClose();
838
1168
  },
839
- children: /* @__PURE__ */ jsxs18(
1169
+ children: /* @__PURE__ */ jsxs20(
840
1170
  "div",
841
1171
  {
842
1172
  ...rest,
@@ -846,15 +1176,15 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
846
1176
  "aria-labelledby": titleId,
847
1177
  "aria-describedby": description ? descId : void 0,
848
1178
  tabIndex: -1,
849
- className: cx("relative flex max-h-[calc(100dvh-2rem)] w-full min-w-0 flex-col gap-space-md overflow-y-auto rounded-xl bg-surface-elevated p-space-lg text-on-surface shadow-md outline-none", SIZE7[size]),
1179
+ className: cx("relative flex max-h-[calc(100dvh-2rem)] w-full min-w-0 flex-col gap-space-md overflow-y-auto rounded-xl bg-surface-elevated p-space-lg text-on-surface shadow-md outline-none", SIZE11[size]),
850
1180
  children: [
851
- /* @__PURE__ */ jsxs18("div", { className: "min-w-0 pr-space-xl", children: [
852
- /* @__PURE__ */ jsx34("h2", { id: titleId, className: "font-display text-headline-md text-ink wrap-break-word", children: title }),
853
- description && /* @__PURE__ */ jsx34("p", { id: descId, className: "font-body-sm text-body-sm text-on-surface-variant", children: description })
1181
+ /* @__PURE__ */ jsxs20("div", { className: "min-w-0 pr-space-xl", children: [
1182
+ /* @__PURE__ */ jsx35("h2", { id: titleId, className: "font-display text-headline-md text-ink wrap-break-word", children: title }),
1183
+ description && /* @__PURE__ */ jsx35("p", { id: descId, className: "font-body-sm text-body-sm text-on-surface-variant", children: description })
854
1184
  ] }),
855
- /* @__PURE__ */ jsx34("div", { ref: contentRef, className: "flex min-w-0 flex-col gap-space-sm", children }),
856
- footer && /* @__PURE__ */ jsx34("div", { className: "flex flex-wrap justify-end gap-space-sm", children: footer }),
857
- /* @__PURE__ */ jsx34("div", { className: "absolute right-space-md top-space-md", children: /* @__PURE__ */ jsx34(IconButton, { icon: "close", label: "Close", onClick: () => onCloseRef.current() }) })
1185
+ /* @__PURE__ */ jsx35("div", { ref: contentRef, className: "flex min-w-0 flex-col gap-space-sm", children }),
1186
+ footer && /* @__PURE__ */ jsx35("div", { className: "flex flex-wrap justify-end gap-space-sm", children: footer }),
1187
+ /* @__PURE__ */ jsx35("div", { className: "absolute right-space-md top-space-md", children: /* @__PURE__ */ jsx35(IconButton, { icon: "close", label: "Close", onClick: onClose }) })
858
1188
  ]
859
1189
  }
860
1190
  )
@@ -865,16 +1195,18 @@ function Dialog({ open, onClose, title, description, footer, size = "md", childr
865
1195
  }
866
1196
 
867
1197
  // src/components/Menu.tsx
868
- import { useEffect as useEffect2, useId as useId6, useRef as useRef4, useState } from "react";
869
- import { jsx as jsx35, jsxs as jsxs19 } from "react/jsx-runtime";
870
- function Menu({ label, trigger, items, align = "end", ...rest }) {
871
- const [open, setOpen] = useState(false);
1198
+ import { useEffect as useEffect2, useId as useId6, useRef as useRef5, useState as useState2 } from "react";
1199
+ import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
1200
+ var isItem = (e) => !("type" in e);
1201
+ function Menu({ label, trigger, items, align = "end", header, footer, ...rest }) {
1202
+ const [open, setOpen] = useState2(false);
872
1203
  const triggerId = useId6();
873
1204
  const menuId = useId6();
874
- const rootRef = useRef4(null);
875
- const triggerRef = useRef4(null);
876
- const itemRefs = useRef4([]);
877
- const pendingFocus = useRef4(null);
1205
+ const rootRef = useRef5(null);
1206
+ const triggerRef = useRef5(null);
1207
+ const itemRefs = useRef5([]);
1208
+ const pendingFocus = useRef5(null);
1209
+ const actions = items.filter(isItem);
878
1210
  const openAt = (index) => {
879
1211
  pendingFocus.current = index;
880
1212
  setOpen(true);
@@ -900,7 +1232,7 @@ function Menu({ label, trigger, items, align = "end", ...rest }) {
900
1232
  focusItem(0);
901
1233
  } else if (e.key === "ArrowUp") {
902
1234
  e.preventDefault();
903
- focusItem(items.length - 1);
1235
+ focusItem(actions.length - 1);
904
1236
  } else if (e.key === "Escape" && open) {
905
1237
  e.preventDefault();
906
1238
  close(true);
@@ -917,12 +1249,13 @@ function Menu({ label, trigger, items, align = "end", ...rest }) {
917
1249
  return;
918
1250
  }
919
1251
  const current = itemRefs.current.indexOf(document.activeElement);
920
- const next = rovingIndex(e.key, Math.max(0, current), items.length);
1252
+ const next = rovingIndex(e.key, Math.max(0, current), actions.length);
921
1253
  if (next === null) return;
922
1254
  e.preventDefault();
923
1255
  itemRefs.current[next]?.focus();
924
1256
  };
925
- return /* @__PURE__ */ jsxs19("div", { ...rest, ref: rootRef, className: "relative inline-flex", children: [
1257
+ let actionIndex = 0;
1258
+ return /* @__PURE__ */ jsxs21("div", { ...rest, ref: rootRef, className: "relative inline-flex", children: [
926
1259
  trigger({
927
1260
  ref: triggerRef,
928
1261
  id: triggerId,
@@ -932,123 +1265,138 @@ function Menu({ label, trigger, items, align = "end", ...rest }) {
932
1265
  onClick: () => open ? close(false) : openAt(0),
933
1266
  onKeyDown: onTriggerKeyDown
934
1267
  }),
935
- open && /* @__PURE__ */ jsx35(
1268
+ open && /* @__PURE__ */ jsxs21(
936
1269
  "div",
937
1270
  {
938
- id: menuId,
939
- role: "menu",
940
- "aria-label": label,
941
- onKeyDown: onMenuKeyDown,
942
1271
  className: cx(
943
- "absolute top-full z-40 mt-space-xs flex min-w-48 max-w-[calc(100vw-2rem)] flex-col rounded-xl border border-border-subtle bg-surface-elevated p-space-2xs shadow-md",
1272
+ "absolute top-full z-40 mt-space-xs flex min-w-48 max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border border-border-subtle bg-surface-elevated shadow-md",
944
1273
  align === "end" ? "right-0" : "left-0"
945
1274
  ),
946
- children: items.map((item, i) => {
947
- const C = item.href ? item.as ?? "a" : "button";
948
- return /* @__PURE__ */ jsxs19(
949
- C,
950
- {
951
- ref: (el) => {
952
- itemRefs.current[i] = el;
953
- },
954
- role: "menuitem",
955
- tabIndex: -1,
956
- ...item.href ? { href: item.href } : { type: "button" },
957
- onClick: () => {
958
- item.onSelect?.();
959
- close(!item.href);
1275
+ children: [
1276
+ header && /* @__PURE__ */ jsx36("div", { className: "border-b border-border-subtle px-space-sm py-space-sm", children: header }),
1277
+ /* @__PURE__ */ jsx36("div", { id: menuId, role: "menu", "aria-label": label, onKeyDown: onMenuKeyDown, className: "flex flex-col p-space-2xs", children: items.map((entry, i) => {
1278
+ if (!isItem(entry)) return /* @__PURE__ */ jsx36("div", { role: "separator", className: "my-space-2xs h-px bg-border-subtle" }, `sep-${i}`);
1279
+ const index = actionIndex++;
1280
+ const C = entry.href ? entry.as ?? "a" : "button";
1281
+ return /* @__PURE__ */ jsxs21(
1282
+ C,
1283
+ {
1284
+ ref: (el) => {
1285
+ itemRefs.current[index] = el;
1286
+ },
1287
+ role: "menuitem",
1288
+ tabIndex: -1,
1289
+ ...entry.href ? { href: entry.href } : { type: "button" },
1290
+ onClick: () => {
1291
+ entry.onSelect?.();
1292
+ close(!entry.href);
1293
+ },
1294
+ className: cx(
1295
+ "flex w-full items-center gap-space-sm rounded-lg px-space-sm py-space-xs text-left font-body-md text-body-md outline-none hover:bg-surface-muted focus:bg-surface-muted",
1296
+ entry.tone === "danger" ? "text-fg-danger" : "text-on-surface",
1297
+ TOUCH
1298
+ ),
1299
+ children: [
1300
+ entry.icon && /* @__PURE__ */ jsx36(Icon, { name: entry.icon, size: "sm" }),
1301
+ /* @__PURE__ */ jsx36("span", { className: "min-w-0 flex-1 truncate", children: entry.label }),
1302
+ entry.meta !== void 0 && /* @__PURE__ */ jsx36("span", { className: "shrink-0 font-label-mono text-label-mono text-on-surface-variant", children: entry.meta }),
1303
+ entry.shortcut && /* @__PURE__ */ jsx36(Kbd, { children: entry.shortcut })
1304
+ ]
960
1305
  },
961
- className: cx(
962
- "flex w-full items-center gap-space-sm rounded-lg px-space-sm py-space-xs text-left font-body-md text-body-md outline-none hover:bg-surface-muted focus:bg-surface-muted",
963
- item.tone === "danger" ? "text-fg-danger" : "text-on-surface",
964
- TOUCH
965
- ),
966
- children: [
967
- item.icon && /* @__PURE__ */ jsx35(Icon, { name: item.icon, size: "sm" }),
968
- /* @__PURE__ */ jsx35("span", { className: "truncate", children: item.label })
969
- ]
970
- },
971
- item.label
972
- );
973
- })
1306
+ i
1307
+ );
1308
+ }) }),
1309
+ footer && /* @__PURE__ */ jsx36("div", { className: "border-t border-border-subtle bg-surface-subtle px-space-sm py-space-xs", children: footer })
1310
+ ]
974
1311
  }
975
1312
  )
976
1313
  ] });
977
1314
  }
978
1315
 
979
1316
  // src/ide/Breadcrumbs.tsx
980
- import { jsx as jsx36, jsxs as jsxs20 } from "react/jsx-runtime";
1317
+ import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
981
1318
  function Breadcrumbs({ items, label = "Breadcrumb", ...rest }) {
982
1319
  const collapse = items.length > 2;
983
- return /* @__PURE__ */ jsx36("nav", { ...rest, "aria-label": label, className: "min-w-0", children: /* @__PURE__ */ jsx36("ol", { className: "flex min-w-0 items-center gap-space-xs font-body-sm text-body-sm text-on-surface-variant", children: items.map((c, i) => {
1320
+ return /* @__PURE__ */ jsx37("nav", { ...rest, "aria-label": label, className: "min-w-0", children: /* @__PURE__ */ jsx37("ol", { className: "flex min-w-0 items-center gap-space-xs font-body-sm text-body-sm text-on-surface-variant", children: items.map((c, i) => {
984
1321
  const last = i === items.length - 1;
985
1322
  const middle = i > 0 && !last;
986
1323
  const C = c.as ?? "a";
987
1324
  return [
988
- /* @__PURE__ */ jsxs20("li", { className: cx("flex min-w-0 items-center gap-space-xs", middle && collapse && "max-md:hidden", last && "min-w-0"), children: [
989
- i > 0 && /* @__PURE__ */ jsx36(Icon, { name: "chevron_right", size: "sm" }),
990
- last ? /* @__PURE__ */ jsx36("span", { "aria-current": "page", className: "truncate font-medium text-on-surface", children: c.label }) : c.href ? /* @__PURE__ */ jsx36(C, { href: c.href, className: cx("truncate rounded hover:text-on-surface", FOCUS_RING), children: c.label }) : /* @__PURE__ */ jsx36("span", { className: "truncate", children: c.label })
1325
+ /* @__PURE__ */ jsxs22("li", { className: cx("flex min-w-0 items-center gap-space-xs", middle && collapse && "max-md:hidden", last && "min-w-0"), children: [
1326
+ i > 0 && /* @__PURE__ */ jsx37(Icon, { name: "chevron_right", size: "sm" }),
1327
+ last ? /* @__PURE__ */ jsx37("span", { "aria-current": "page", className: "truncate font-medium text-on-surface", children: c.label }) : c.href ? /* @__PURE__ */ jsx37(C, { href: c.href, className: cx("truncate rounded hover:text-on-surface", FOCUS_RING), children: c.label }) : /* @__PURE__ */ jsx37("span", { className: "truncate", children: c.label })
991
1328
  ] }, c.label + i),
992
- i === 0 && collapse && /* @__PURE__ */ jsxs20("li", { "aria-hidden": "true", className: "flex items-center gap-space-xs md:hidden", children: [
993
- /* @__PURE__ */ jsx36(Icon, { name: "chevron_right", size: "sm" }),
994
- /* @__PURE__ */ jsx36("span", { children: "\u2026" })
1329
+ i === 0 && collapse && /* @__PURE__ */ jsxs22("li", { "aria-hidden": "true", className: "flex items-center gap-space-xs md:hidden", children: [
1330
+ /* @__PURE__ */ jsx37(Icon, { name: "chevron_right", size: "sm" }),
1331
+ /* @__PURE__ */ jsx37("span", { children: "\u2026" })
995
1332
  ] }, "ellipsis")
996
1333
  ];
997
1334
  }) }) });
998
1335
  }
999
1336
 
1000
1337
  // src/ide/StatusBar.tsx
1001
- import { jsx as jsx37, jsxs as jsxs21 } from "react/jsx-runtime";
1002
- var TONE7 = { default: "", success: TEXT_TONE.success, danger: TEXT_TONE.danger, warning: TEXT_TONE.warning, brand: TEXT_TONE.brand };
1338
+ import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
1339
+ var TONE10 = { default: "", success: TEXT_TONE.success, danger: TEXT_TONE.danger, warning: TEXT_TONE.warning, brand: TEXT_TONE.brand };
1003
1340
  function StatusItem({ icon, tone = "default", children, ...rest }) {
1004
- return /* @__PURE__ */ jsxs21("span", { ...rest, className: cx("inline-flex shrink-0 items-center gap-space-2xs", TONE7[tone]), children: [
1005
- icon && /* @__PURE__ */ jsx37(Icon, { name: icon, size: "sm" }),
1341
+ return /* @__PURE__ */ jsxs23("span", { ...rest, className: cx("inline-flex shrink-0 items-center gap-space-2xs", TONE10[tone]), children: [
1342
+ icon && /* @__PURE__ */ jsx38(Icon, { name: icon, size: "sm" }),
1006
1343
  children
1007
1344
  ] });
1008
1345
  }
1009
1346
  function StatusBarRoot({ start, end, label = "Status", ...rest }) {
1010
- return /* @__PURE__ */ jsxs21("footer", { ...rest, "aria-label": label, className: "flex h-7 min-w-0 shrink-0 items-center justify-between gap-space-md overflow-hidden border-t border-border-subtle bg-surface-subtle px-space-sm font-label-mono text-[11px] text-on-surface-variant", children: [
1011
- /* @__PURE__ */ jsx37("div", { className: "flex min-w-0 items-center gap-space-md overflow-hidden", children: start }),
1012
- /* @__PURE__ */ jsx37("div", { className: "flex min-w-0 items-center gap-space-md overflow-hidden", children: end })
1347
+ return /* @__PURE__ */ jsxs23("footer", { ...rest, "aria-label": label, className: "flex h-7 min-w-0 shrink-0 items-center justify-between gap-space-md overflow-hidden border-t border-border-subtle bg-surface-subtle px-space-sm font-label-mono text-[11px] text-on-surface-variant", children: [
1348
+ /* @__PURE__ */ jsx38("div", { className: "flex min-w-0 items-center gap-space-md overflow-hidden", children: start }),
1349
+ /* @__PURE__ */ jsx38("div", { className: "flex min-w-0 items-center gap-space-md overflow-hidden", children: end })
1013
1350
  ] });
1014
1351
  }
1015
1352
  var StatusBar = Object.assign(StatusBarRoot, { Item: StatusItem });
1016
1353
 
1017
1354
  // src/ide/MetricTile.tsx
1018
- import { jsx as jsx38, jsxs as jsxs22 } from "react/jsx-runtime";
1019
- var TONE8 = { success: "text-fg-success", danger: "text-fg-danger", neutral: "text-ink" };
1020
- function MetricTile({ label, value, tone = "neutral", icon, ...rest }) {
1021
- return /* @__PURE__ */ jsxs22("div", { ...rest, className: "flex min-w-0 flex-col gap-space-2xs rounded-lg border border-border-subtle bg-surface-subtle p-space-sm", children: [
1022
- /* @__PURE__ */ jsxs22("span", { className: "flex min-w-0 items-center gap-space-2xs font-label-mono text-label-mono uppercase text-on-surface-variant", children: [
1023
- icon && /* @__PURE__ */ jsx38(Icon, { name: icon, size: "sm" }),
1024
- /* @__PURE__ */ jsx38("span", { className: "truncate", children: label })
1355
+ import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
1356
+ var TONE11 = { success: "text-fg-success", danger: "text-fg-danger", warning: "text-fg-warning", brand: "text-fg-brand", neutral: "text-ink" };
1357
+ function MetricTile({ label, value, tone = "neutral", icon, hint, hintTone = "muted", ...rest }) {
1358
+ return /* @__PURE__ */ jsxs24("div", { ...rest, className: "flex min-w-0 flex-col gap-space-2xs rounded-lg border border-border-subtle bg-surface-subtle p-space-sm", children: [
1359
+ /* @__PURE__ */ jsxs24("span", { className: "flex min-w-0 items-center gap-space-2xs font-label-mono text-label-mono uppercase text-on-surface-variant", children: [
1360
+ icon && /* @__PURE__ */ jsx39(Icon, { name: icon, size: "sm" }),
1361
+ /* @__PURE__ */ jsx39("span", { className: "truncate", children: label })
1025
1362
  ] }),
1026
- /* @__PURE__ */ jsx38("span", { className: cx("truncate font-display text-headline-sm", TONE8[tone]), children: value })
1363
+ /* @__PURE__ */ jsx39("span", { className: cx("truncate font-display text-headline-sm", TONE11[tone]), children: value }),
1364
+ hint && /* @__PURE__ */ jsx39("span", { className: cx("truncate font-body-sm text-body-sm", TEXT_TONE[hintTone]), children: hint })
1027
1365
  ] });
1028
1366
  }
1029
1367
 
1030
1368
  // src/ide/Avatar.tsx
1031
- import { useState as useState2 } from "react";
1032
- import { jsx as jsx39, jsxs as jsxs23 } from "react/jsx-runtime";
1033
- var SIZE8 = { sm: "size-7 text-[11px]", md: "size-9 text-xs", lg: "size-12 text-sm" };
1369
+ import { useState as useState3 } from "react";
1370
+ import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
1371
+ var AVATAR_SIZE = { sm: "size-7 text-[11px]", md: "size-9 text-xs", lg: "size-12 text-sm" };
1372
+ var SHAPE2 = { circle: "rounded-full", square: "rounded-lg" };
1373
+ var TONE12 = {
1374
+ ink: "bg-ink text-on-ink",
1375
+ brand: "bg-brand-cobalt text-white",
1376
+ success: "bg-badge-beginner-text text-badge-beginner-bg",
1377
+ warning: "bg-badge-amber-text text-badge-amber-bg",
1378
+ danger: "bg-badge-advanced-text text-badge-advanced-bg"
1379
+ };
1034
1380
  function initials(name) {
1035
1381
  return name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
1036
1382
  }
1037
- function Avatar({ name, src, size = "md", badge, ...rest }) {
1038
- const [failed, setFailed] = useState2(false);
1039
- return /* @__PURE__ */ jsxs23("span", { ...rest, className: "relative inline-flex shrink-0", children: [
1040
- src && !failed ? /* @__PURE__ */ jsx39("img", { src, alt: name, onError: () => setFailed(true), className: cx("rounded-full object-cover", SIZE8[size]) }) : /* @__PURE__ */ jsx39("span", { role: "img", "aria-label": name, className: cx("inline-flex items-center justify-center rounded-full bg-ink font-label-mono text-on-ink", SIZE8[size]), children: initials(name) }),
1041
- badge && /* @__PURE__ */ jsx39("span", { className: "absolute -bottom-1 -right-1 rounded-full border-2 border-surface-elevated bg-brand-cobalt px-1 font-label-mono text-[10px] leading-4 text-white", children: badge })
1383
+ function Avatar({ name, src, size = "md", shape = "circle", tone = "ink", badge, status, statusLabel, ...rest }) {
1384
+ const [failedSrc, setFailedSrc] = useState3(void 0);
1385
+ const accessibleName = statusLabel ? `${name}, ${statusLabel}` : name;
1386
+ return /* @__PURE__ */ jsxs25("span", { ...rest, className: "relative inline-flex shrink-0", children: [
1387
+ src && failedSrc !== src ? /* @__PURE__ */ jsx40("img", { src, alt: accessibleName, onError: () => setFailedSrc(src), className: cx("object-cover", SHAPE2[shape], AVATAR_SIZE[size]) }) : /* @__PURE__ */ jsx40("span", { role: "img", "aria-label": accessibleName, className: cx("inline-flex items-center justify-center font-label-mono", SHAPE2[shape], TONE12[tone], AVATAR_SIZE[size]), children: initials(name) }),
1388
+ status && /* @__PURE__ */ jsx40("span", { "aria-hidden": "true", className: cx("absolute bottom-0 right-0 size-2.5 rounded-full ring-2 ring-surface-elevated", DOT_TONE[status]) }),
1389
+ badge && /* @__PURE__ */ jsx40("span", { className: "absolute -bottom-1 -right-1 rounded-full border-2 border-surface-elevated bg-brand-cobalt px-1 font-label-mono text-[10px] leading-4 text-white", children: badge })
1042
1390
  ] });
1043
1391
  }
1044
1392
 
1045
1393
  // src/ide/EditorTabs.tsx
1046
- import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs24 } from "react/jsx-runtime";
1394
+ import { Fragment as Fragment3, jsx as jsx41, jsxs as jsxs26 } from "react/jsx-runtime";
1047
1395
  function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", ...rest }) {
1048
1396
  if (!tabs.length) return null;
1049
- return /* @__PURE__ */ jsx40("nav", { ...rest, "aria-label": label, className: "min-w-0 max-w-full border-b border-border-subtle bg-surface-subtle", children: /* @__PURE__ */ jsx40("ul", { className: "flex min-w-0 overflow-x-auto [scrollbar-width:none]", children: tabs.map((t) => {
1397
+ return /* @__PURE__ */ jsx41("nav", { ...rest, "aria-label": label, className: "min-w-0 max-w-full border-b border-border-subtle bg-surface-subtle", children: /* @__PURE__ */ jsx41("ul", { className: "flex min-w-0 overflow-x-auto [scrollbar-width:none]", children: tabs.map((t) => {
1050
1398
  const active = t.id === activeId;
1051
- return /* @__PURE__ */ jsxs24(
1399
+ return /* @__PURE__ */ jsxs26(
1052
1400
  "li",
1053
1401
  {
1054
1402
  className: cx(
@@ -1056,7 +1404,7 @@ function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", .
1056
1404
  active ? "bg-surface-elevated text-ink shadow-[inset_0_-2px_0_var(--color-brand-cobalt)]" : "text-on-surface-variant hover:text-on-surface"
1057
1405
  ),
1058
1406
  children: [
1059
- /* @__PURE__ */ jsxs24(
1407
+ /* @__PURE__ */ jsxs26(
1060
1408
  "button",
1061
1409
  {
1062
1410
  type: "button",
@@ -1070,25 +1418,25 @@ function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", .
1070
1418
  },
1071
1419
  className: cx("flex items-center gap-space-xs whitespace-nowrap px-space-md py-space-xs font-code-inline text-code-inline", FOCUS_RING, TOUCH),
1072
1420
  children: [
1073
- t.readOnly && /* @__PURE__ */ jsx40(Icon, { name: "lock", size: "sm", label: "Read-only" }),
1421
+ t.readOnly && /* @__PURE__ */ jsx41(Icon, { name: "lock", size: "sm", label: "Read-only" }),
1074
1422
  t.readOnly && " ",
1075
1423
  t.label,
1076
- t.modified && /* @__PURE__ */ jsxs24(Fragment2, { children: [
1424
+ t.modified && /* @__PURE__ */ jsxs26(Fragment3, { children: [
1077
1425
  " ",
1078
- /* @__PURE__ */ jsx40(Dot, { tone: "brand" }),
1079
- /* @__PURE__ */ jsx40("span", { className: "sr-only", children: "(modified)" })
1426
+ /* @__PURE__ */ jsx41(Dot, { tone: "brand" }),
1427
+ /* @__PURE__ */ jsx41("span", { className: "sr-only", children: "(modified)" })
1080
1428
  ] })
1081
1429
  ]
1082
1430
  }
1083
1431
  ),
1084
- onClose && /* @__PURE__ */ jsx40(
1432
+ onClose && /* @__PURE__ */ jsx41(
1085
1433
  "button",
1086
1434
  {
1087
1435
  type: "button",
1088
1436
  "aria-label": `Close ${t.label}`,
1089
1437
  onClick: () => onClose(t.id),
1090
1438
  className: cx("mr-space-2xs inline-flex size-6 items-center justify-center rounded text-on-surface-variant hover:bg-surface-muted hover:text-on-surface", FOCUS_RING, TOUCH_ICON),
1091
- children: /* @__PURE__ */ jsx40(Icon, { name: "close", size: "sm" })
1439
+ children: /* @__PURE__ */ jsx41(Icon, { name: "close", size: "sm" })
1092
1440
  }
1093
1441
  )
1094
1442
  ]
@@ -1099,8 +1447,8 @@ function EditorTabs({ tabs, activeId, onSelect, onClose, label = "Open files", .
1099
1447
  }
1100
1448
 
1101
1449
  // src/ide/Countdown.tsx
1102
- import { useEffect as useEffect3, useRef as useRef5, useState as useState3 } from "react";
1103
- import { jsx as jsx41, jsxs as jsxs25 } from "react/jsx-runtime";
1450
+ import { useEffect as useEffect3, useRef as useRef6, useState as useState4 } from "react";
1451
+ import { jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
1104
1452
  var pad = (n) => String(n).padStart(2, "0");
1105
1453
  function formatClock(totalSeconds) {
1106
1454
  const s = Math.max(0, Math.floor(totalSeconds));
@@ -1109,10 +1457,10 @@ function formatClock(totalSeconds) {
1109
1457
  return h > 0 ? `${h}:${pad(m)}:${pad(s % 60)}` : `${pad(m)}:${pad(s % 60)}`;
1110
1458
  }
1111
1459
  function Countdown({ seconds, until, direction = "down", warnAt, onExpire, label = "Time remaining", ...rest }) {
1112
- const [start] = useState3(() => Date.now());
1113
- const [now, setNow] = useState3(() => until ? null : start);
1114
- const onExpireRef = useRef5(onExpire);
1115
- const fired = useRef5(false);
1460
+ const [start] = useState4(() => Date.now());
1461
+ const [now, setNow] = useState4(() => until ? null : start);
1462
+ const onExpireRef = useRef6(onExpire);
1463
+ const fired = useRef6(false);
1116
1464
  useEffect3(() => {
1117
1465
  onExpireRef.current = onExpire;
1118
1466
  });
@@ -1136,14 +1484,14 @@ function Countdown({ seconds, until, direction = "down", warnAt, onExpire, label
1136
1484
  }
1137
1485
  }, [expired]);
1138
1486
  const warn = direction === "down" && warnAt !== void 0 && value !== null && value <= warnAt;
1139
- return /* @__PURE__ */ jsxs25("span", { ...rest, role: "timer", "aria-label": label, className: cx("inline-flex items-center gap-space-2xs font-code-inline text-code-inline tabular-nums", warn ? "text-fg-danger" : "text-on-surface"), children: [
1140
- /* @__PURE__ */ jsx41(Icon, { name: "timer", size: "sm" }),
1487
+ return /* @__PURE__ */ jsxs27("span", { ...rest, role: "timer", "aria-label": label, className: cx("inline-flex items-center gap-space-2xs font-code-inline text-code-inline tabular-nums", warn ? "text-fg-danger" : "text-on-surface"), children: [
1488
+ /* @__PURE__ */ jsx42(Icon, { name: "timer", size: "sm" }),
1141
1489
  value === null ? "--:--" : formatClock(value)
1142
1490
  ] });
1143
1491
  }
1144
1492
 
1145
1493
  // src/ide/FileTree.tsx
1146
- import { useId as useId7, useMemo, useRef as useRef6, useState as useState4 } from "react";
1494
+ import { useId as useId7, useMemo, useRef as useRef7, useState as useState5 } from "react";
1147
1495
 
1148
1496
  // src/ide/tree.ts
1149
1497
  function buildTree(nodes) {
@@ -1161,6 +1509,9 @@ function buildTree(nodes) {
1161
1509
  kind,
1162
1510
  readOnly: extra?.readOnly,
1163
1511
  modified: extra?.modified,
1512
+ icon: extra?.icon,
1513
+ status: extra?.status,
1514
+ meta: extra?.meta,
1164
1515
  level: parts.length,
1165
1516
  parent: parentPath,
1166
1517
  children: []
@@ -1199,7 +1550,7 @@ function allDirs(roots) {
1199
1550
  }
1200
1551
 
1201
1552
  // src/ide/FileTree.tsx
1202
- import { Fragment as Fragment3, jsx as jsx42, jsxs as jsxs26 } from "react/jsx-runtime";
1553
+ import { Fragment as Fragment4, jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
1203
1554
  var EXT_ICON = {
1204
1555
  ts: "code",
1205
1556
  tsx: "code",
@@ -1214,13 +1565,19 @@ function fileIcon(name) {
1214
1565
  const ext = name.includes(".") ? name.split(".").pop().toLowerCase() : "";
1215
1566
  return EXT_ICON[ext] ?? "description";
1216
1567
  }
1568
+ var STATUS_ICON = {
1569
+ success: { name: "check_circle", tone: "success", label: "Passing" },
1570
+ warning: { name: "warning", tone: "warning", label: "Warning" },
1571
+ danger: { name: "error", tone: "danger", label: "Failing" },
1572
+ info: { name: "info", tone: "brand", label: "Info" }
1573
+ };
1217
1574
  function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, ...rest }) {
1218
1575
  const baseId = useId7();
1219
1576
  const roots = useMemo(() => buildTree(nodes), [nodes]);
1220
1577
  const allOpen = defaultExpanded === "all";
1221
- const [toggled, setToggled] = useState4(() => new Set(allOpen ? [] : defaultExpanded));
1222
- const [focused, setFocused] = useState4(activePath);
1223
- const refs = useRef6(/* @__PURE__ */ new Map());
1578
+ const [toggled, setToggled] = useState5(() => new Set(allOpen ? [] : defaultExpanded));
1579
+ const [focused, setFocused] = useState5(activePath);
1580
+ const refs = useRef7(/* @__PURE__ */ new Map());
1224
1581
  if (!roots.length) return null;
1225
1582
  const expanded = new Set(allDirs(roots).filter((d) => toggled.has(d) !== allOpen));
1226
1583
  const visible = flattenVisible(roots, expanded);
@@ -1279,7 +1636,7 @@ function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, .
1279
1636
  const isDir = item.kind === "dir";
1280
1637
  const isOpen = isDir && expanded.has(item.path);
1281
1638
  const rowId = `${baseId}-${encodeURIComponent(item.path)}`;
1282
- return /* @__PURE__ */ jsxs26(
1639
+ return /* @__PURE__ */ jsxs28(
1283
1640
  "li",
1284
1641
  {
1285
1642
  ref: (el) => {
@@ -1298,7 +1655,7 @@ function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, .
1298
1655
  },
1299
1656
  className: "outline-none [&:focus-visible>div]:ring-2 [&:focus-visible>div]:ring-inset [&:focus-visible>div]:ring-brand-cobalt",
1300
1657
  children: [
1301
- /* @__PURE__ */ jsxs26(
1658
+ /* @__PURE__ */ jsxs28(
1302
1659
  "div",
1303
1660
  {
1304
1661
  id: rowId,
@@ -1312,26 +1669,31 @@ function FileTree({ nodes, activePath, onOpen, defaultExpanded = "all", label, .
1312
1669
  item.path === activePath ? "bg-surface-muted text-ink" : "text-on-surface-variant hover:bg-surface-muted hover:text-on-surface"
1313
1670
  ),
1314
1671
  children: [
1315
- isDir ? /* @__PURE__ */ jsx42(Icon, { name: isOpen ? "expand_more" : "chevron_right", size: "sm" }) : /* @__PURE__ */ jsx42("span", { className: "inline-block w-4 shrink-0" }),
1316
- /* @__PURE__ */ jsx42(Icon, { name: isDir ? isOpen ? "folder_open" : "folder" : fileIcon(item.name), size: "sm", tone: isDir ? "brand" : "inherit" }),
1317
- /* @__PURE__ */ jsx42("span", { className: "truncate", children: item.name }),
1672
+ isDir ? /* @__PURE__ */ jsx43(Icon, { name: isOpen ? "expand_more" : "chevron_right", size: "sm" }) : /* @__PURE__ */ jsx43("span", { className: "inline-block w-4 shrink-0" }),
1673
+ /* @__PURE__ */ jsx43(Icon, { name: isDir ? isOpen ? "folder_open" : "folder" : item.icon ?? fileIcon(item.name), size: "sm", tone: isDir ? "brand" : "inherit" }),
1674
+ /* @__PURE__ */ jsx43("span", { className: "truncate", children: item.name }),
1318
1675
  item.readOnly && " ",
1319
- item.readOnly && /* @__PURE__ */ jsx42(Icon, { name: "lock", size: "sm", label: "Read-only" }),
1320
- item.modified && /* @__PURE__ */ jsxs26(Fragment3, { children: [
1676
+ item.readOnly && /* @__PURE__ */ jsx43(Icon, { name: "lock", size: "sm", label: "Read-only" }),
1677
+ item.modified && /* @__PURE__ */ jsxs28(Fragment4, { children: [
1321
1678
  " ",
1322
- /* @__PURE__ */ jsx42(Dot, { tone: "brand" }),
1323
- /* @__PURE__ */ jsx42("span", { className: "sr-only", children: "(modified)" })
1324
- ] })
1679
+ /* @__PURE__ */ jsx43(Dot, { tone: "brand" }),
1680
+ /* @__PURE__ */ jsx43("span", { className: "sr-only", children: "(modified)" })
1681
+ ] }),
1682
+ item.status && /* @__PURE__ */ jsxs28(Fragment4, { children: [
1683
+ " ",
1684
+ /* @__PURE__ */ jsx43(Icon, { name: STATUS_ICON[item.status].name, size: "sm", tone: STATUS_ICON[item.status].tone, label: STATUS_ICON[item.status].label })
1685
+ ] }),
1686
+ item.meta !== void 0 && /* @__PURE__ */ jsx43("span", { className: "ml-auto shrink-0 font-label-mono text-[11px] text-on-surface-variant", children: item.meta })
1325
1687
  ]
1326
1688
  }
1327
1689
  ),
1328
- isDir && isOpen && item.children.length > 0 && /* @__PURE__ */ jsx42("ul", { role: "group", children: renderItems(item.children) })
1690
+ isDir && isOpen && item.children.length > 0 && /* @__PURE__ */ jsx43("ul", { role: "group", children: renderItems(item.children) })
1329
1691
  ]
1330
1692
  },
1331
1693
  item.path
1332
1694
  );
1333
1695
  });
1334
- return /* @__PURE__ */ jsx42("ul", { ...rest, role: "tree", "aria-label": label, className: "min-w-0 overflow-auto py-space-xs", children: renderItems(roots) });
1696
+ return /* @__PURE__ */ jsx43("ul", { ...rest, role: "tree", "aria-label": label, className: "min-w-0 overflow-auto py-space-xs", children: renderItems(roots) });
1335
1697
  }
1336
1698
 
1337
1699
  // src/ide/Workbench.tsx
@@ -1340,10 +1702,10 @@ import {
1340
1702
  useContext as useContext2,
1341
1703
  useEffect as useEffect4,
1342
1704
  useId as useId8,
1343
- useRef as useRef7,
1344
- useState as useState5
1705
+ useRef as useRef8,
1706
+ useState as useState6
1345
1707
  } from "react";
1346
- import { Fragment as Fragment4, jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
1708
+ import { Fragment as Fragment5, jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
1347
1709
  var DEFAULT_SIZES = { left: 240, right: 380, bottom: 30 };
1348
1710
  var DEFAULT_LIMITS = { left: [160, 480], right: [260, 640], bottom: [15, 70] };
1349
1711
  var DEFAULT_LABELS = { left: "Explorer", main: "Editor", right: "Details", bottom: "Panel" };
@@ -1357,7 +1719,7 @@ var COLUMNS = {
1357
1719
  };
1358
1720
  var clamp = (v, [min, max]) => Math.min(max, Math.max(min, v));
1359
1721
  function readSizes(raw, defaults, limits) {
1360
- let parsed;
1722
+ let parsed = null;
1361
1723
  try {
1362
1724
  parsed = raw ? JSON.parse(raw) : null;
1363
1725
  } catch {
@@ -1377,7 +1739,7 @@ function Toggle({ panel }) {
1377
1739
  const ctx = useContext2(WorkbenchContext);
1378
1740
  if (!ctx) return null;
1379
1741
  const open = ctx.drawer === panel;
1380
- return /* @__PURE__ */ jsx43("span", { className: "lg:hidden", children: /* @__PURE__ */ jsx43(
1742
+ return /* @__PURE__ */ jsx44("span", { className: "lg:hidden", children: /* @__PURE__ */ jsx44(
1381
1743
  IconButton,
1382
1744
  {
1383
1745
  icon: panel === "left" ? "left_panel_open" : "right_panel_open",
@@ -1389,7 +1751,7 @@ function Toggle({ panel }) {
1389
1751
  ) });
1390
1752
  }
1391
1753
  function Separator({ panel, value, limits, label, controls, onChange, centerHeight }) {
1392
- const drag = useRef7(null);
1754
+ const drag = useRef8(null);
1393
1755
  const vertical = panel !== "bottom";
1394
1756
  const grow = panel === "left" ? "ArrowRight" : panel === "right" ? "ArrowLeft" : "ArrowUp";
1395
1757
  const shrink = panel === "left" ? "ArrowLeft" : panel === "right" ? "ArrowRight" : "ArrowDown";
@@ -1419,7 +1781,7 @@ function Separator({ panel, value, limits, label, controls, onChange, centerHeig
1419
1781
  const end = () => {
1420
1782
  drag.current = null;
1421
1783
  };
1422
- return /* @__PURE__ */ jsx43(
1784
+ return /* @__PURE__ */ jsx44(
1423
1785
  "div",
1424
1786
  {
1425
1787
  role: "separator",
@@ -1446,15 +1808,15 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
1446
1808
  const labels = { ...DEFAULT_LABELS, ...labelsProp };
1447
1809
  const limits = { ...DEFAULT_LIMITS, ...limitsProp };
1448
1810
  const defaults = { ...DEFAULT_SIZES, ...defaultSizes };
1449
- const [sizes, setSizes] = useState5(defaults);
1450
- const [drawer, setDrawer] = useState5(null);
1451
- const [mobileView, setMobileView] = useState5("main");
1811
+ const [sizes, setSizes] = useState6(defaults);
1812
+ const [drawer, setDrawer] = useState6(null);
1813
+ const [mobileView, setMobileView] = useState6("main");
1452
1814
  const baseId = useId8();
1453
1815
  const ids = { left: `${baseId}-left`, main: `${baseId}-main`, right: `${baseId}-right`, bottom: `${baseId}-bottom` };
1454
- const centerRef = useRef7(null);
1816
+ const centerRef = useRef8(null);
1455
1817
  useEffect4(() => {
1456
1818
  if (!persistKey) return;
1457
- let raw;
1819
+ let raw = null;
1458
1820
  try {
1459
1821
  raw = window.localStorage.getItem(persistKey);
1460
1822
  } catch {
@@ -1489,15 +1851,15 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
1489
1851
  side === "left" ? "border-r border-border-subtle max-lg:left-0" : "border-l border-border-subtle max-lg:right-0",
1490
1852
  drawer !== side && "max-lg:hidden"
1491
1853
  );
1492
- return /* @__PURE__ */ jsx43(WorkbenchContext.Provider, { value: { drawer, setDrawer, ids, labels }, children: /* @__PURE__ */ jsxs27("div", { ...rest, className: "flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface text-on-surface", children: [
1493
- header && /* @__PURE__ */ jsx43("div", { className: "flex min-w-0 shrink-0 items-center gap-space-sm border-b border-border-subtle px-space-sm py-space-xs", children: header }),
1494
- /* @__PURE__ */ jsxs27("div", { style: vars, className: cx("relative grid min-h-0 min-w-0 flex-1 grid-cols-1 grid-rows-[minmax(0,1fr)]", columns), children: [
1495
- left && /* @__PURE__ */ jsxs27(Fragment4, { children: [
1496
- /* @__PURE__ */ jsx43("section", { id: ids.left, "aria-label": labels.left, className: drawerClass("left"), children: left }),
1497
- /* @__PURE__ */ jsx43(Separator, { panel: "left", value: sizes.left, limits: limits.left, label: `Resize ${labels.left}`, controls: ids.left, onChange: resize("left"), centerHeight })
1854
+ return /* @__PURE__ */ jsx44(WorkbenchContext.Provider, { value: { drawer, setDrawer, ids, labels }, children: /* @__PURE__ */ jsxs29("div", { ...rest, className: "flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden bg-surface text-on-surface", children: [
1855
+ header && /* @__PURE__ */ jsx44("div", { className: "flex min-w-0 shrink-0 items-center gap-space-sm border-b border-border-subtle px-space-sm py-space-xs", children: header }),
1856
+ /* @__PURE__ */ jsxs29("div", { style: vars, className: cx("relative grid min-h-0 min-w-0 flex-1 grid-cols-1 grid-rows-[minmax(0,1fr)]", columns), children: [
1857
+ left && /* @__PURE__ */ jsxs29(Fragment5, { children: [
1858
+ /* @__PURE__ */ jsx44("section", { id: ids.left, "aria-label": labels.left, className: drawerClass("left"), children: left }),
1859
+ /* @__PURE__ */ jsx44(Separator, { panel: "left", value: sizes.left, limits: limits.left, label: `Resize ${labels.left}`, controls: ids.left, onChange: resize("left"), centerHeight })
1498
1860
  ] }),
1499
- /* @__PURE__ */ jsxs27("div", { ref: centerRef, className: "flex min-h-0 min-w-0 flex-col", children: [
1500
- bottom && /* @__PURE__ */ jsx43("div", { className: "flex shrink-0 border-b border-border-subtle p-space-2xs md:hidden", children: /* @__PURE__ */ jsx43(
1861
+ /* @__PURE__ */ jsxs29("div", { ref: centerRef, className: "flex min-h-0 min-w-0 flex-col", children: [
1862
+ bottom && /* @__PURE__ */ jsx44("div", { className: "flex shrink-0 border-b border-border-subtle p-space-2xs md:hidden", children: /* @__PURE__ */ jsx44(
1501
1863
  SegmentedControl,
1502
1864
  {
1503
1865
  label: "View",
@@ -1509,10 +1871,10 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
1509
1871
  onChange: (v) => setMobileView(v === "bottom" ? "bottom" : "main")
1510
1872
  }
1511
1873
  ) }),
1512
- /* @__PURE__ */ jsx43("section", { id: ids.main, "aria-label": labels.main, className: cx("min-h-0 min-w-0 flex-1 overflow-auto", Boolean(bottom) && mobileView === "bottom" && "max-md:hidden"), children: main }),
1513
- bottom && /* @__PURE__ */ jsxs27(Fragment4, { children: [
1514
- /* @__PURE__ */ jsx43(Separator, { panel: "bottom", value: sizes.bottom, limits: limits.bottom, label: `Resize ${labels.bottom}`, controls: ids.bottom, onChange: resize("bottom"), centerHeight }),
1515
- /* @__PURE__ */ jsx43(
1874
+ /* @__PURE__ */ jsx44("section", { id: ids.main, "aria-label": labels.main, className: cx("min-h-0 min-w-0 flex-1 overflow-auto", Boolean(bottom) && mobileView === "bottom" && "max-md:hidden"), children: main }),
1875
+ bottom && /* @__PURE__ */ jsxs29(Fragment5, { children: [
1876
+ /* @__PURE__ */ jsx44(Separator, { panel: "bottom", value: sizes.bottom, limits: limits.bottom, label: `Resize ${labels.bottom}`, controls: ids.bottom, onChange: resize("bottom"), centerHeight }),
1877
+ /* @__PURE__ */ jsx44(
1516
1878
  "section",
1517
1879
  {
1518
1880
  id: ids.bottom,
@@ -1523,33 +1885,1150 @@ function WorkbenchRoot({ header, left, main, right, bottom, labels: labelsProp,
1523
1885
  )
1524
1886
  ] })
1525
1887
  ] }),
1526
- right && /* @__PURE__ */ jsxs27(Fragment4, { children: [
1527
- /* @__PURE__ */ jsx43(Separator, { panel: "right", value: sizes.right, limits: limits.right, label: `Resize ${labels.right}`, controls: ids.right, onChange: resize("right"), centerHeight }),
1528
- /* @__PURE__ */ jsx43("section", { id: ids.right, "aria-label": labels.right, className: drawerClass("right"), children: right })
1888
+ right && /* @__PURE__ */ jsxs29(Fragment5, { children: [
1889
+ /* @__PURE__ */ jsx44(Separator, { panel: "right", value: sizes.right, limits: limits.right, label: `Resize ${labels.right}`, controls: ids.right, onChange: resize("right"), centerHeight }),
1890
+ /* @__PURE__ */ jsx44("section", { id: ids.right, "aria-label": labels.right, className: drawerClass("right"), children: right })
1529
1891
  ] }),
1530
- drawer && /* @__PURE__ */ jsx43("button", { type: "button", "aria-label": "Close panel", tabIndex: -1, onClick: () => setDrawer(null), className: "fixed inset-0 z-30 bg-brand-obsidian/40 lg:hidden" })
1892
+ drawer && /* @__PURE__ */ jsx44("button", { type: "button", "aria-label": "Close panel", tabIndex: -1, onClick: () => setDrawer(null), className: "fixed inset-0 z-30 bg-brand-obsidian/40 lg:hidden" })
1531
1893
  ] })
1532
1894
  ] }) });
1533
1895
  }
1534
1896
  var Workbench = Object.assign(WorkbenchRoot, { Toggle });
1897
+
1898
+ // src/components/Drawer.tsx
1899
+ import { useId as useId9, useRef as useRef9 } from "react";
1900
+ import { createPortal as createPortal2 } from "react-dom";
1901
+ import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
1902
+ var SIDE = { left: "left-0 border-r", right: "right-0 border-l" };
1903
+ var SIZE12 = { sm: "w-[min(85vw,20rem)]", md: "w-[min(90vw,28rem)]" };
1904
+ function Drawer({ open, onClose, title, side = "left", size = "sm", children, ...rest }) {
1905
+ const titleId = useId9();
1906
+ const panelRef = useRef9(null);
1907
+ const bodyRef = useRef9(null);
1908
+ const theme = useThemeTone();
1909
+ useModal({ open, onClose, panelRef, initialFocusRef: bodyRef });
1910
+ if (!open || typeof document === "undefined") return null;
1911
+ return createPortal2(
1912
+ /* @__PURE__ */ jsx45(
1913
+ "div",
1914
+ {
1915
+ "data-theme": theme,
1916
+ className: "fixed inset-0 z-50 bg-brand-obsidian/40 backdrop-blur-sm",
1917
+ onMouseDown: (e) => {
1918
+ if (e.target === e.currentTarget) onClose();
1919
+ },
1920
+ children: /* @__PURE__ */ jsxs30(
1921
+ "div",
1922
+ {
1923
+ ...rest,
1924
+ ref: panelRef,
1925
+ role: "dialog",
1926
+ "aria-modal": "true",
1927
+ "aria-labelledby": titleId,
1928
+ tabIndex: -1,
1929
+ className: cx("fixed inset-y-0 flex flex-col border-border-subtle bg-surface-elevated text-on-surface shadow-md outline-none", SIDE[side], SIZE12[size]),
1930
+ children: [
1931
+ /* @__PURE__ */ jsxs30("div", { className: "flex min-w-0 items-center justify-between gap-space-sm border-b border-border-subtle px-space-md py-space-sm", children: [
1932
+ /* @__PURE__ */ jsx45("h2", { id: titleId, className: "min-w-0 truncate font-display text-headline-sm text-ink", children: title }),
1933
+ /* @__PURE__ */ jsx45(IconButton, { icon: "close", label: "Close", onClick: onClose })
1934
+ ] }),
1935
+ /* @__PURE__ */ jsx45("div", { ref: bodyRef, className: "min-h-0 flex-1 overflow-y-auto p-space-md", children })
1936
+ ]
1937
+ }
1938
+ )
1939
+ }
1940
+ ),
1941
+ document.body
1942
+ );
1943
+ }
1944
+
1945
+ // src/components/TextLink.tsx
1946
+ import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
1947
+ var TONE13 = {
1948
+ brand: "text-fg-brand hover:text-fg-brand-hover",
1949
+ default: "text-on-surface hover:text-ink",
1950
+ muted: "text-on-surface-variant hover:text-on-surface",
1951
+ danger: "text-fg-danger",
1952
+ success: "text-fg-success",
1953
+ warning: "text-fg-warning"
1954
+ };
1955
+ var SIZE13 = { sm: "font-body-sm text-body-sm", md: "font-body-md text-body-md" };
1956
+ var UNDERLINE = { hover: "underline-offset-2 hover:underline", always: "underline underline-offset-2", none: "" };
1957
+ function TextLink({ as, tone = "brand", size = "md", icon, iconRight, underline = "hover", children, ...rest }) {
1958
+ const C = as ?? "a";
1959
+ return /* @__PURE__ */ jsxs31(
1960
+ C,
1961
+ {
1962
+ ...rest,
1963
+ className: cx("inline-flex max-w-full items-center gap-space-2xs rounded font-medium wrap-break-word transition-colors", TONE13[tone], SIZE13[size], UNDERLINE[underline], FOCUS_RING),
1964
+ children: [
1965
+ icon && /* @__PURE__ */ jsx46(Icon, { name: icon, size: "sm" }),
1966
+ /* @__PURE__ */ jsx46("span", { className: "min-w-0", children }),
1967
+ iconRight && /* @__PURE__ */ jsx46(Icon, { name: iconRight, size: "sm" })
1968
+ ]
1969
+ }
1970
+ );
1971
+ }
1972
+
1973
+ // src/components/Divider.tsx
1974
+ import { jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
1975
+ var SPACE_Y = {
1976
+ none: "",
1977
+ "2xs": "my-space-2xs",
1978
+ xs: "my-space-xs",
1979
+ sm: "my-space-sm",
1980
+ md: "my-space-md",
1981
+ lg: "my-space-lg",
1982
+ xl: "my-space-xl",
1983
+ "2xl": "my-space-2xl"
1984
+ };
1985
+ var SPACE_X = {
1986
+ none: "",
1987
+ "2xs": "mx-space-2xs",
1988
+ xs: "mx-space-xs",
1989
+ sm: "mx-space-sm",
1990
+ md: "mx-space-md",
1991
+ lg: "mx-space-lg",
1992
+ xl: "mx-space-xl",
1993
+ "2xl": "mx-space-2xl"
1994
+ };
1995
+ function Divider({ orientation = "horizontal", label, spacing = "none", ...rest }) {
1996
+ if (orientation === "vertical") {
1997
+ return /* @__PURE__ */ jsx47("div", { ...rest, role: "separator", "aria-orientation": "vertical", className: cx("min-h-4 w-px shrink-0 self-stretch bg-border-subtle", SPACE_X[spacing]) });
1998
+ }
1999
+ if (label) {
2000
+ return /* @__PURE__ */ jsxs32("div", { ...rest, role: "separator", "aria-orientation": "horizontal", className: cx("flex w-full min-w-0 items-center gap-space-sm", SPACE_Y[spacing]), children: [
2001
+ /* @__PURE__ */ jsx47("span", { className: "h-px flex-1 bg-border-subtle" }),
2002
+ /* @__PURE__ */ jsx47("span", { className: "shrink-0 font-label-mono text-label-mono uppercase text-on-surface-variant", children: label }),
2003
+ /* @__PURE__ */ jsx47("span", { className: "h-px flex-1 bg-border-subtle" })
2004
+ ] });
2005
+ }
2006
+ return /* @__PURE__ */ jsx47("div", { ...rest, role: "separator", "aria-orientation": "horizontal", className: cx("h-px w-full shrink-0 bg-border-subtle", SPACE_Y[spacing]) });
2007
+ }
2008
+
2009
+ // src/ide/AvatarGroup.tsx
2010
+ import { Children as Children2, cloneElement, isValidElement as isValidElement2 } from "react";
2011
+ import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
2012
+ function AvatarGroup({ children, max, size = "md", label, ...rest }) {
2013
+ const all = Children2.toArray(children);
2014
+ const shown = max !== void 0 ? all.slice(0, Math.max(0, max)) : all;
2015
+ const extra = all.length - shown.length;
2016
+ return /* @__PURE__ */ jsxs33("div", { ...rest, role: "group", "aria-label": label, className: "flex items-center -space-x-2", children: [
2017
+ shown.map((child, i) => /* @__PURE__ */ jsx48("span", { className: "inline-flex rounded-full ring-2 ring-surface-elevated", children: isValidElement2(child) ? cloneElement(child, { size }) : child }, i)),
2018
+ extra > 0 && /* @__PURE__ */ jsxs33("span", { className: cx("inline-flex items-center justify-center rounded-full bg-surface-muted font-label-mono text-on-surface-variant ring-2 ring-surface-elevated", AVATAR_SIZE[size]), children: [
2019
+ "+",
2020
+ extra
2021
+ ] })
2022
+ ] });
2023
+ }
2024
+
2025
+ // src/primitives/AppBar.tsx
2026
+ import { jsx as jsx49, jsxs as jsxs34 } from "react/jsx-runtime";
2027
+ var POSITION = { sticky: "sticky top-0", fixed: "fixed inset-x-0 top-0", static: "relative" };
2028
+ var HEIGHT2 = { sm: "h-12", md: "h-16" };
2029
+ function AppBar({ position = "sticky", start, center, end, blur = true, height = "md", contained = true, ...rest }) {
2030
+ return /* @__PURE__ */ jsx49("header", { ...rest, className: cx("z-40 w-full min-w-0 border-b border-border-subtle", POSITION[position], blur ? "bg-surface-elevated/95 backdrop-blur-md" : "bg-surface-elevated"), children: /* @__PURE__ */ jsxs34("div", { className: cx("flex min-w-0 items-center gap-space-md px-gutter-fluid", HEIGHT2[height], contained && "mx-auto max-w-7xl"), children: [
2031
+ /* @__PURE__ */ jsx49("div", { className: "flex min-w-0 shrink-0 items-center gap-space-sm", children: start }),
2032
+ /* @__PURE__ */ jsx49("div", { className: "flex min-w-0 flex-1 items-center justify-center", children: center }),
2033
+ /* @__PURE__ */ jsx49("div", { className: "flex shrink-0 items-center gap-space-xs", children: end })
2034
+ ] }) });
2035
+ }
2036
+
2037
+ // src/components/NavList.tsx
2038
+ import { jsx as jsx50, jsxs as jsxs35 } from "react/jsx-runtime";
2039
+ var VARIANT7 = {
2040
+ sidebar: {
2041
+ item: "rounded-lg px-space-sm py-space-xs font-body-md text-body-md",
2042
+ active: "bg-surface-container-high font-medium text-ink",
2043
+ idle: "text-on-surface-variant hover:bg-surface-muted hover:text-on-surface"
2044
+ },
2045
+ toc: {
2046
+ item: "border-l-2 px-space-sm py-space-2xs font-body-sm text-body-sm",
2047
+ active: "border-brand-cobalt bg-badge-intermediate-bg font-medium text-badge-intermediate-text",
2048
+ idle: "border-transparent text-on-surface-variant hover:border-border-strong hover:text-on-surface"
2049
+ }
2050
+ };
2051
+ function NavList({ label, items, current, heading, variant = "sidebar", ...rest }) {
2052
+ const v = VARIANT7[variant];
2053
+ return /* @__PURE__ */ jsxs35("nav", { ...rest, "aria-label": label, className: "min-w-0", children: [
2054
+ heading && /* @__PURE__ */ jsx50("p", { className: "px-space-sm pb-space-xs font-label-mono text-label-mono uppercase text-on-surface-variant", children: heading }),
2055
+ /* @__PURE__ */ jsx50("ul", { className: "flex min-w-0 flex-col gap-space-2xs", children: items.map((item) => {
2056
+ const active = item.id === current;
2057
+ const C = item.href ? item.as ?? "a" : "button";
2058
+ return /* @__PURE__ */ jsx50("li", { className: "min-w-0", children: /* @__PURE__ */ jsxs35(
2059
+ C,
2060
+ {
2061
+ ...item.href ? { href: item.href } : { type: "button" },
2062
+ "aria-current": active ? item.href ? "page" : "true" : void 0,
2063
+ onClick: item.onSelect,
2064
+ className: cx("flex w-full min-w-0 items-center gap-space-sm text-left transition-colors", v.item, active ? v.active : v.idle, FOCUS_RING, TOUCH),
2065
+ children: [
2066
+ item.icon && /* @__PURE__ */ jsx50(Icon, { name: item.icon, size: "sm" }),
2067
+ /* @__PURE__ */ jsx50("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
2068
+ item.count !== void 0 && /* @__PURE__ */ jsx50("span", { className: cx("shrink-0 font-label-mono text-label-mono", active ? "text-ink" : "text-on-surface-variant"), children: item.count })
2069
+ ]
2070
+ }
2071
+ ) }, item.id);
2072
+ }) })
2073
+ ] });
2074
+ }
2075
+
2076
+ // src/components/Pagination.tsx
2077
+ import { jsx as jsx51, jsxs as jsxs36 } from "react/jsx-runtime";
2078
+ var range = (a, b) => Array.from({ length: Math.max(0, b - a + 1) }, (_, i) => a + i);
2079
+ function pageRange(page, pageCount, siblingCount = 1) {
2080
+ if (pageCount <= 0) return [];
2081
+ const p = Math.min(Math.max(1, Math.trunc(page)), pageCount);
2082
+ if (pageCount <= 2 * siblingCount + 5) return range(1, pageCount);
2083
+ const left = Math.max(p - siblingCount, 2);
2084
+ const right = Math.min(p + siblingCount, pageCount - 1);
2085
+ const out = [1];
2086
+ if (left > 2) out.push("gap");
2087
+ out.push(...range(left, right));
2088
+ if (right < pageCount - 1) out.push("gap");
2089
+ out.push(pageCount);
2090
+ return out;
2091
+ }
2092
+ function Pagination({ page, pageCount, onChange, siblingCount = 1, summary, label = "Pagination", ...rest }) {
2093
+ if (pageCount <= 1) return null;
2094
+ const p = Math.min(Math.max(1, Math.trunc(page)), pageCount);
2095
+ return /* @__PURE__ */ jsxs36("nav", { ...rest, "aria-label": label, className: "flex min-w-0 flex-wrap items-center justify-between gap-space-sm", children: [
2096
+ summary && /* @__PURE__ */ jsx51("p", { className: "font-body-sm text-body-sm text-on-surface-variant", children: summary }),
2097
+ /* @__PURE__ */ jsxs36("ul", { className: "flex items-center gap-space-2xs", children: [
2098
+ /* @__PURE__ */ jsx51("li", { children: /* @__PURE__ */ jsx51(IconButton, { icon: "chevron_left", label: "Previous page", variant: "secondary", size: "sm", disabled: p <= 1, onClick: () => onChange(p - 1) }) }),
2099
+ pageRange(p, pageCount, siblingCount).map(
2100
+ (item, i) => item === "gap" ? /* @__PURE__ */ jsx51("li", { "aria-hidden": "true", className: "px-space-2xs text-on-surface-variant max-md:hidden", children: "\u2026" }, `gap-${i}`) : /* @__PURE__ */ jsx51("li", { className: item === p ? "" : "max-md:hidden", children: /* @__PURE__ */ jsx51(
2101
+ "button",
2102
+ {
2103
+ type: "button",
2104
+ "aria-label": `Page ${item}`,
2105
+ "aria-current": item === p ? "page" : void 0,
2106
+ onClick: () => onChange(item),
2107
+ className: cx(
2108
+ "inline-flex size-8 items-center justify-center rounded-lg font-label-mono text-label-mono transition-colors",
2109
+ item === p ? "bg-ink text-on-ink" : "text-on-surface hover:bg-surface-muted",
2110
+ FOCUS_RING,
2111
+ TOUCH_ICON
2112
+ ),
2113
+ children: item
2114
+ }
2115
+ ) }, item)
2116
+ ),
2117
+ /* @__PURE__ */ jsxs36("li", { "aria-hidden": "true", className: "font-label-mono text-label-mono text-on-surface-variant md:hidden", children: [
2118
+ "/ ",
2119
+ pageCount
2120
+ ] }),
2121
+ /* @__PURE__ */ jsx51("li", { children: /* @__PURE__ */ jsx51(IconButton, { icon: "chevron_right", label: "Next page", variant: "secondary", size: "sm", disabled: p >= pageCount, onClick: () => onChange(p + 1) }) })
2122
+ ] })
2123
+ ] });
2124
+ }
2125
+
2126
+ // src/components/Table.tsx
2127
+ import { jsx as jsx52, jsxs as jsxs37 } from "react/jsx-runtime";
2128
+ var PAD = { compact: "px-space-sm py-space-xs", normal: "px-space-md py-space-sm" };
2129
+ var ALIGN4 = { start: "text-start", end: "text-end" };
2130
+ var WIDTH = { auto: "", min: "w-px whitespace-nowrap" };
2131
+ function Table({ caption, showCaption, columns, rows, rowKey, density = "normal", empty, ...rest }) {
2132
+ return /* @__PURE__ */ jsx52(
2133
+ "div",
2134
+ {
2135
+ ...rest,
2136
+ role: "region",
2137
+ "aria-label": caption,
2138
+ tabIndex: 0,
2139
+ className: "min-w-0 max-w-full overflow-x-auto rounded-xl border border-border-subtle focus-visible:outline-2 focus-visible:outline-brand-cobalt",
2140
+ children: /* @__PURE__ */ jsxs37("table", { className: "w-full border-collapse font-body-sm text-body-sm text-on-surface", children: [
2141
+ /* @__PURE__ */ jsx52("caption", { className: showCaption ? "caption-top px-space-md py-space-sm text-start font-label-mono text-label-mono uppercase text-on-surface-variant" : "sr-only", children: caption }),
2142
+ /* @__PURE__ */ jsx52("thead", { className: "bg-surface-subtle", children: /* @__PURE__ */ jsx52("tr", { children: columns.map((c) => /* @__PURE__ */ jsx52("th", { scope: "col", className: cx("border-b border-border-subtle font-label-mono text-label-mono uppercase text-on-surface-variant", PAD[density], ALIGN4[c.align ?? "start"], WIDTH[c.width ?? "auto"]), children: c.header }, c.key)) }) }),
2143
+ /* @__PURE__ */ jsx52("tbody", { className: "divide-y divide-border-subtle", children: rows.length ? rows.map((row, i) => /* @__PURE__ */ jsx52("tr", { children: columns.map((c) => /* @__PURE__ */ jsx52("td", { className: cx("align-top wrap-break-word", PAD[density], ALIGN4[c.align ?? "start"], WIDTH[c.width ?? "auto"], c.mono && "font-code-inline text-code-inline"), children: row[c.key] }, c.key)) }, rowKey ? rowKey(row, i) : i)) : /* @__PURE__ */ jsx52("tr", { children: /* @__PURE__ */ jsx52("td", { colSpan: columns.length, className: "px-space-md py-space-lg text-center text-on-surface-variant", children: empty ?? "No rows" }) }) })
2144
+ ] })
2145
+ }
2146
+ );
2147
+ }
2148
+
2149
+ // src/components/DescriptionList.tsx
2150
+ import { jsx as jsx53, jsxs as jsxs38 } from "react/jsx-runtime";
2151
+ var LAYOUT = {
2152
+ stacked: "flex flex-col gap-space-sm",
2153
+ inline: "grid grid-cols-1 gap-x-space-md gap-y-space-xs sm:grid-cols-[minmax(0,auto)_minmax(0,1fr)]"
2154
+ };
2155
+ function DescriptionList({ items, layout = "stacked", mono, ...rest }) {
2156
+ return /* @__PURE__ */ jsx53("dl", { ...rest, className: cx("min-w-0", LAYOUT[layout]), children: items.map((item, i) => /* @__PURE__ */ jsxs38("div", { className: cx("min-w-0", layout === "inline" && "sm:contents"), children: [
2157
+ /* @__PURE__ */ jsx53("dt", { className: "font-label-mono text-label-mono uppercase text-on-surface-variant", children: item.term }),
2158
+ /* @__PURE__ */ jsx53("dd", { className: cx("min-w-0 text-on-surface wrap-break-word", mono ? "font-code-inline text-code-inline" : "font-body-md text-body-md"), children: item.detail })
2159
+ ] }, i)) });
2160
+ }
2161
+
2162
+ // src/components/Timeline.tsx
2163
+ import { jsx as jsx54, jsxs as jsxs39 } from "react/jsx-runtime";
2164
+ var STATUS2 = {
2165
+ done: { icon: "check", marker: "bg-badge-beginner-text text-badge-beginner-bg", text: "Completed" },
2166
+ current: { icon: "radio_button_checked", marker: "bg-badge-intermediate-text text-badge-intermediate-bg ring-4 ring-badge-intermediate-bg", text: "Current" },
2167
+ locked: { icon: "lock", marker: "bg-surface-muted text-on-surface-variant", text: "Locked" },
2168
+ success: { icon: "check_circle", marker: "bg-badge-beginner-text text-badge-beginner-bg", text: "Passed" },
2169
+ warning: { icon: "warning", marker: "bg-badge-amber-text text-badge-amber-bg", text: "Warning" },
2170
+ danger: { icon: "close", marker: "bg-badge-advanced-text text-badge-advanced-bg", text: "Failed" },
2171
+ pending: { icon: "schedule", marker: "bg-surface-muted text-on-surface-variant", text: "Pending" }
2172
+ };
2173
+ function Timeline({ label, items, ...rest }) {
2174
+ return /* @__PURE__ */ jsx54("ol", { ...rest, "aria-label": label, className: "flex min-w-0 flex-col", children: items.map((item, i) => {
2175
+ const s = STATUS2[item.status];
2176
+ return /* @__PURE__ */ jsxs39("li", { "aria-current": item.status === "current" ? "step" : void 0, className: "relative flex min-w-0 gap-space-sm pb-space-md last:pb-0", children: [
2177
+ i < items.length - 1 && /* @__PURE__ */ jsx54("span", { "aria-hidden": "true", className: "absolute bottom-0 left-3 top-7 w-px -translate-x-1/2 bg-border-subtle" }),
2178
+ /* @__PURE__ */ jsx54("span", { "aria-hidden": "true", className: cx("relative inline-flex size-6 shrink-0 items-center justify-center rounded-full", s.marker), children: /* @__PURE__ */ jsx54(Icon, { name: s.icon, size: "sm" }) }),
2179
+ /* @__PURE__ */ jsxs39("div", { className: "min-w-0 flex-1 pt-0.5", children: [
2180
+ /* @__PURE__ */ jsxs39("div", { className: "flex min-w-0 flex-wrap items-center gap-space-xs", children: [
2181
+ /* @__PURE__ */ jsxs39("p", { className: "font-body-md text-body-md font-medium text-on-surface wrap-break-word", children: [
2182
+ /* @__PURE__ */ jsxs39("span", { className: "sr-only", children: [
2183
+ s.text,
2184
+ ": "
2185
+ ] }),
2186
+ item.title
2187
+ ] }),
2188
+ item.badge
2189
+ ] }),
2190
+ item.description && /* @__PURE__ */ jsx54("p", { className: "font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: item.description }),
2191
+ item.meta && /* @__PURE__ */ jsx54("p", { className: "font-label-mono text-label-mono text-on-surface-variant", children: item.meta })
2192
+ ] })
2193
+ ] }, item.id);
2194
+ }) });
2195
+ }
2196
+
2197
+ // src/components/Disclosure.tsx
2198
+ import { useId as useId10, useState as useState7 } from "react";
2199
+ import { jsx as jsx55, jsxs as jsxs40 } from "react/jsx-runtime";
2200
+ function Disclosure({ summary, children, open, defaultOpen = false, onOpenChange, selected, variant = "plain", ...rest }) {
2201
+ const id = useId10();
2202
+ const [inner, setInner] = useState7(defaultOpen);
2203
+ const isOpen = open ?? inner;
2204
+ const toggle = () => {
2205
+ const next = !isOpen;
2206
+ if (open === void 0) setInner(next);
2207
+ onOpenChange?.(next);
2208
+ };
2209
+ const row = variant === "row";
2210
+ return /* @__PURE__ */ jsxs40("div", { ...rest, className: cx("min-w-0", row && "border-b border-border-subtle", selected && "border-l-4 border-l-brand-cobalt"), children: [
2211
+ /* @__PURE__ */ jsxs40(
2212
+ "button",
2213
+ {
2214
+ type: "button",
2215
+ id: `${id}-button`,
2216
+ "aria-expanded": isOpen,
2217
+ "aria-controls": `${id}-panel`,
2218
+ onClick: toggle,
2219
+ className: cx("flex w-full min-w-0 items-center gap-space-sm text-left", row ? "px-space-sm py-space-sm hover:bg-surface-subtle" : "py-space-xs", FOCUS_RING, TOUCH),
2220
+ children: [
2221
+ /* @__PURE__ */ jsx55("span", { className: "min-w-0 flex-1", children: summary }),
2222
+ /* @__PURE__ */ jsx55(Icon, { name: isOpen ? "expand_less" : "expand_more", size: "sm", tone: "muted" })
2223
+ ]
2224
+ }
2225
+ ),
2226
+ /* @__PURE__ */ jsx55("div", { id: `${id}-panel`, role: "region", "aria-labelledby": `${id}-button`, hidden: !isOpen, className: cx("min-w-0", row ? "px-space-sm pb-space-sm" : "pb-space-xs"), children })
2227
+ ] });
2228
+ }
2229
+
2230
+ // src/components/Skeleton.tsx
2231
+ import { jsx as jsx56 } from "react/jsx-runtime";
2232
+ var SHAPE3 = { line: "rounded", pill: "rounded-full", rect: "rounded-xl", circle: "rounded-full aspect-square" };
2233
+ var WIDTH2 = { full: "w-full", "3/4": "w-3/4", "1/2": "w-1/2", "1/3": "w-1/3", "1/4": "w-1/4" };
2234
+ var HEIGHT3 = { xs: "h-2", sm: "h-3", md: "h-4", lg: "h-8", xl: "h-24" };
2235
+ var DEFAULT_HEIGHT = { line: "sm", pill: "lg", rect: "xl", circle: "lg" };
2236
+ function Skeleton({ shape = "line", width = "full", height, lines, ...rest }) {
2237
+ const h = HEIGHT3[height ?? DEFAULT_HEIGHT[shape]];
2238
+ if (lines && lines > 1) {
2239
+ return /* @__PURE__ */ jsx56("div", { ...rest, "aria-hidden": "true", className: "flex w-full min-w-0 flex-col gap-space-xs", children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx56("div", { className: cx("skeleton-shimmer rounded", h, i === lines - 1 ? "w-3/4" : "w-full") }, i)) });
2240
+ }
2241
+ return /* @__PURE__ */ jsx56("div", { ...rest, "aria-hidden": "true", className: cx("skeleton-shimmer shrink-0", SHAPE3[shape], h, shape !== "circle" && WIDTH2[width]) });
2242
+ }
2243
+
2244
+ // src/components/TerminalOutput.tsx
2245
+ import { jsx as jsx57, jsxs as jsxs41 } from "react/jsx-runtime";
2246
+ var KIND = {
2247
+ command: "text-slate-100",
2248
+ plain: "text-slate-300",
2249
+ error: "border-l-2 border-red-400 bg-red-500/10 pl-space-sm text-red-300",
2250
+ warning: "text-amber-300",
2251
+ hint: "text-sky-300",
2252
+ success: "text-emerald-300"
2253
+ };
2254
+ var MAX = { sm: "max-h-40", md: "max-h-72", lg: "max-h-[32rem]", none: "" };
2255
+ function TerminalOutput({ lines, title, status, maxHeight = "md", ...rest }) {
2256
+ return /* @__PURE__ */ jsxs41("figure", { ...rest, className: "min-w-0 max-w-full overflow-hidden rounded-xl bg-brand-obsidian", children: [
2257
+ (title || status) && /* @__PURE__ */ jsxs41("figcaption", { className: "flex min-w-0 items-center justify-between gap-space-sm border-b border-white/10 px-space-md py-space-xs font-label-mono text-label-mono uppercase text-slate-300", children: [
2258
+ /* @__PURE__ */ jsx57("span", { className: "truncate", children: title }),
2259
+ status
2260
+ ] }),
2261
+ /* @__PURE__ */ jsx57(
2262
+ "div",
2263
+ {
2264
+ role: "log",
2265
+ "aria-label": typeof title === "string" ? title : "Output",
2266
+ tabIndex: 0,
2267
+ className: cx("overflow-auto p-space-md font-code-inline text-code-inline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt", MAX[maxHeight]),
2268
+ children: lines.map((line, i) => /* @__PURE__ */ jsxs41("div", { className: cx("whitespace-pre-wrap wrap-break-word", KIND[line.kind]), children: [
2269
+ line.kind === "command" && /* @__PURE__ */ jsxs41("span", { "aria-hidden": "true", className: "select-none text-slate-400", children: [
2270
+ "$",
2271
+ " "
2272
+ ] }),
2273
+ /* @__PURE__ */ jsx57("span", { children: line.text })
2274
+ ] }, i))
2275
+ }
2276
+ )
2277
+ ] });
2278
+ }
2279
+
2280
+ // src/components/VerdictBanner.tsx
2281
+ import { jsx as jsx58, jsxs as jsxs42 } from "react/jsx-runtime";
2282
+ var TITLE = { success: "text-fg-success", danger: "text-fg-danger", warning: "text-fg-warning" };
2283
+ function VerdictBanner({ tone, icon, title, badge, meta, actions, ...rest }) {
2284
+ return /* @__PURE__ */ jsxs42("section", { ...rest, className: "flex min-w-0 flex-col gap-space-md rounded-xl border border-border-subtle bg-surface-elevated p-space-lg md:flex-row md:items-center", children: [
2285
+ /* @__PURE__ */ jsx58(IconTile, { icon, tone, size: "xl", shape: "circle", filled: true }),
2286
+ /* @__PURE__ */ jsxs42("div", { className: "min-w-0 flex-1", children: [
2287
+ /* @__PURE__ */ jsxs42("div", { className: "flex min-w-0 flex-wrap items-center gap-space-sm", children: [
2288
+ /* @__PURE__ */ jsx58("h2", { className: cx("min-w-0 font-display text-headline-xl wrap-break-word", TITLE[tone]), children: title }),
2289
+ badge
2290
+ ] }),
2291
+ meta && meta.length > 0 && /* @__PURE__ */ jsx58("ul", { className: "mt-space-xs flex min-w-0 flex-wrap items-center gap-x-space-sm gap-y-space-2xs font-body-sm text-body-sm text-on-surface-variant", children: meta.map((m, i) => /* @__PURE__ */ jsxs42("li", { className: "flex items-center gap-space-sm", children: [
2292
+ i > 0 && /* @__PURE__ */ jsx58("span", { "aria-hidden": "true", className: "h-3 w-px bg-border-strong" }),
2293
+ m
2294
+ ] }, i)) })
2295
+ ] }),
2296
+ actions && /* @__PURE__ */ jsx58("div", { className: "flex shrink-0 flex-wrap items-center gap-space-sm", children: actions })
2297
+ ] });
2298
+ }
2299
+
2300
+ // src/components/Checkbox.tsx
2301
+ import { useEffect as useEffect5, useId as useId11, useRef as useRef10 } from "react";
2302
+ import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
2303
+ function Checkbox({ label, description, strikeWhenChecked, indeterminate, id, ...rest }) {
2304
+ const generated = useId11();
2305
+ const inputId = id ?? generated;
2306
+ const descId = `${inputId}-desc`;
2307
+ const ref = useRef10(null);
2308
+ useEffect5(() => {
2309
+ if (ref.current) ref.current.indeterminate = Boolean(indeterminate);
2310
+ }, [indeterminate]);
2311
+ return /* @__PURE__ */ jsxs43("div", { className: "min-w-0", children: [
2312
+ /* @__PURE__ */ jsxs43("label", { htmlFor: inputId, className: cx("group flex min-w-0 cursor-pointer items-start gap-space-sm", TOUCH), children: [
2313
+ /* @__PURE__ */ jsxs43("span", { className: "relative mt-0.5 inline-flex size-4 shrink-0", children: [
2314
+ /* @__PURE__ */ jsx59(
2315
+ "input",
2316
+ {
2317
+ ...rest,
2318
+ ref,
2319
+ id: inputId,
2320
+ type: "checkbox",
2321
+ "aria-describedby": cx(rest["aria-describedby"], description ? descId : void 0) || void 0,
2322
+ className: cx(
2323
+ "peer size-4 cursor-pointer appearance-none rounded border border-border-strong bg-surface-elevated checked:border-brand-cobalt checked:bg-brand-cobalt indeterminate:border-brand-cobalt indeterminate:bg-brand-cobalt disabled:cursor-not-allowed disabled:opacity-50",
2324
+ FOCUS_RING
2325
+ )
2326
+ }
2327
+ ),
2328
+ /* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 hidden items-center justify-center text-white peer-checked:flex", children: /* @__PURE__ */ jsx59(Icon, { name: "check", size: "sm" }) }),
2329
+ /* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 hidden items-center justify-center text-white peer-indeterminate:flex", children: /* @__PURE__ */ jsx59(Icon, { name: "remove", size: "sm" }) })
2330
+ ] }),
2331
+ /* @__PURE__ */ jsx59("span", { className: cx("min-w-0 font-body-md text-body-md text-on-surface wrap-break-word", strikeWhenChecked && "group-has-checked:text-on-surface-variant group-has-checked:line-through"), children: label })
2332
+ ] }),
2333
+ description && /* @__PURE__ */ jsx59("p", { id: descId, className: "pl-6 font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: description })
2334
+ ] });
2335
+ }
2336
+
2337
+ // src/components/Switch.tsx
2338
+ import { useId as useId12 } from "react";
2339
+ import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
2340
+ function Switch({ label, checked, onChange, description, ...rest }) {
2341
+ const id = useId12();
2342
+ const buttonId = rest.id ?? `${id}-switch`;
2343
+ return (
2344
+ // The row is a <label> for the button, so tapping the text toggles it and the target is the full row.
2345
+ /* @__PURE__ */ jsxs44("label", { htmlFor: buttonId, className: cx("flex min-w-0 cursor-pointer items-start justify-between gap-space-md", TOUCH), children: [
2346
+ /* @__PURE__ */ jsxs44("span", { className: "min-w-0", children: [
2347
+ /* @__PURE__ */ jsx60("span", { id: `${id}-label`, className: "font-body-md text-body-md text-on-surface", children: label }),
2348
+ description && /* @__PURE__ */ jsx60("span", { id: `${id}-desc`, className: "block font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: description })
2349
+ ] }),
2350
+ /* @__PURE__ */ jsx60(
2351
+ "button",
2352
+ {
2353
+ ...rest,
2354
+ id: buttonId,
2355
+ type: "button",
2356
+ role: "switch",
2357
+ "aria-checked": checked,
2358
+ "aria-labelledby": `${id}-label`,
2359
+ "aria-describedby": description ? `${id}-desc` : void 0,
2360
+ onClick: () => onChange(!checked),
2361
+ className: cx("relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors disabled:pointer-events-none disabled:opacity-50", checked ? "bg-brand-cobalt" : "bg-border-strong", FOCUS_RING),
2362
+ children: /* @__PURE__ */ jsx60("span", { "aria-hidden": "true", className: cx("inline-block size-5 rounded-full bg-white shadow-sm transition-transform", checked ? "translate-x-5.5" : "translate-x-0.5") })
2363
+ }
2364
+ )
2365
+ ] })
2366
+ );
2367
+ }
2368
+
2369
+ // src/components/Overlay.tsx
2370
+ import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
2371
+ function Overlay({ children, overlay, blur = true, ...rest }) {
2372
+ return /* @__PURE__ */ jsxs45("div", { ...rest, className: "relative min-w-0 overflow-hidden rounded-xl", children: [
2373
+ /* @__PURE__ */ jsx61("div", { inert: true, "aria-hidden": "true", className: cx("pointer-events-none select-none", blur && "blur-sm"), children }),
2374
+ /* @__PURE__ */ jsx61("div", { className: "absolute inset-0 flex items-center justify-center bg-surface/70 p-space-md", children: overlay })
2375
+ ] });
2376
+ }
2377
+
2378
+ // src/components/CopyButton.tsx
2379
+ import { useEffect as useEffect6, useState as useState8 } from "react";
2380
+ import { jsx as jsx62 } from "react/jsx-runtime";
2381
+ function CopyButton({ value, label = "Copy", copiedLabel = "Copied", size = "sm", variant = "secondary", ...rest }) {
2382
+ const [state, setState] = useState8("idle");
2383
+ useEffect6(() => {
2384
+ if (state === "idle") return;
2385
+ const t = setTimeout(() => setState("idle"), 2e3);
2386
+ return () => clearTimeout(t);
2387
+ }, [state]);
2388
+ const copy = async () => {
2389
+ try {
2390
+ await navigator.clipboard.writeText(value);
2391
+ setState("copied");
2392
+ } catch {
2393
+ setState("failed");
2394
+ }
2395
+ };
2396
+ return /* @__PURE__ */ jsx62(Button, { ...rest, variant, size, icon: state === "copied" ? "check" : state === "failed" ? "error" : "content_copy", onClick: copy, "aria-live": "polite", children: state === "copied" ? copiedLabel : state === "failed" ? "Copy failed" : label });
2397
+ }
2398
+
2399
+ // src/internal/diff.ts
2400
+ var toLines = (s) => {
2401
+ const t = s.endsWith("\n") ? s.slice(0, -1) : s;
2402
+ return t === "" && s.length <= 1 ? [] : t.split("\n");
2403
+ };
2404
+ function diffLines(a, b) {
2405
+ const x = toLines(a);
2406
+ const y = toLines(b);
2407
+ const n = x.length;
2408
+ const m = y.length;
2409
+ const dp = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
2410
+ for (let i2 = n - 1; i2 >= 0; i2--) {
2411
+ for (let j2 = m - 1; j2 >= 0; j2--) dp[i2][j2] = x[i2] === y[j2] ? dp[i2 + 1][j2 + 1] + 1 : Math.max(dp[i2 + 1][j2], dp[i2][j2 + 1]);
2412
+ }
2413
+ const out = [];
2414
+ let i = 0;
2415
+ let j = 0;
2416
+ while (i < n && j < m) {
2417
+ if (x[i] === y[j]) out.push({ kind: "same", text: x[i], oldNo: ++i, newNo: ++j });
2418
+ else if (dp[i + 1][j] >= dp[i][j + 1]) out.push({ kind: "del", text: x[i], oldNo: ++i });
2419
+ else out.push({ kind: "add", text: y[j], newNo: ++j });
2420
+ }
2421
+ while (i < n) out.push({ kind: "del", text: x[i], oldNo: ++i });
2422
+ while (j < m) out.push({ kind: "add", text: y[j], newNo: ++j });
2423
+ return out;
2424
+ }
2425
+ function splitRows(lines) {
2426
+ const rows = [];
2427
+ let k = 0;
2428
+ while (k < lines.length) {
2429
+ if (lines[k].kind === "same") {
2430
+ rows.push({ left: lines[k], right: lines[k] });
2431
+ k++;
2432
+ continue;
2433
+ }
2434
+ const dels = [];
2435
+ const adds = [];
2436
+ while (k < lines.length && lines[k].kind === "del") dels.push(lines[k++]);
2437
+ while (k < lines.length && lines[k].kind === "add") adds.push(lines[k++]);
2438
+ for (let t = 0; t < Math.max(dels.length, adds.length); t++) rows.push({ left: dels[t], right: adds[t] });
2439
+ }
2440
+ return rows;
2441
+ }
2442
+
2443
+ // src/components/DiffViewer.tsx
2444
+ import { jsx as jsx63, jsxs as jsxs46 } from "react/jsx-runtime";
2445
+ var KIND2 = { same: "text-code-plain", add: "bg-diff-add-bg text-diff-add-fg", del: "bg-diff-del-bg text-diff-del-fg" };
2446
+ var SIGN = { same: " ", add: "+", del: "\u2212" };
2447
+ var SPOKEN = { same: "", add: "added:", del: "removed:" };
2448
+ var PRE = "overflow-x-auto py-space-sm font-code-inline text-code-inline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt";
2449
+ function Row({ line, gutters }) {
2450
+ if (!line) return /* @__PURE__ */ jsx63("div", { className: "min-h-5 bg-white/5" });
2451
+ return /* @__PURE__ */ jsxs46("div", { className: cx("flex min-w-0 px-space-sm", KIND2[line.kind]), children: [
2452
+ gutters !== "new" && /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", className: "w-8 shrink-0 select-none pr-space-xs text-right text-code-comment", children: line.oldNo ?? "" }),
2453
+ gutters !== "old" && /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", className: "w-8 shrink-0 select-none pr-space-xs text-right text-code-comment", children: line.newNo ?? "" }),
2454
+ /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", className: "w-4 shrink-0 select-none", children: SIGN[line.kind] }),
2455
+ SPOKEN[line.kind] && /* @__PURE__ */ jsx63("span", { className: "sr-only", children: SPOKEN[line.kind] }),
2456
+ /* @__PURE__ */ jsx63("span", { className: "min-w-0 whitespace-pre-wrap wrap-break-word", children: line.text || " " })
2457
+ ] });
2458
+ }
2459
+ function DiffViewer({ oldValue, newValue, oldTitle, newTitle, mode = "unified", ...rest }) {
2460
+ const lines = diffLines(oldValue, newValue);
2461
+ const unified = /* @__PURE__ */ jsx63("pre", { tabIndex: 0, className: cx(PRE, mode === "split" && "lg:hidden"), children: lines.map((l, i) => /* @__PURE__ */ jsx63(Row, { line: l, gutters: "both" }, i)) });
2462
+ return /* @__PURE__ */ jsxs46("figure", { ...rest, className: "min-w-0 max-w-full overflow-hidden rounded-xl bg-brand-obsidian", children: [
2463
+ (oldTitle || newTitle) && /* @__PURE__ */ jsxs46("figcaption", { className: "flex min-w-0 flex-wrap items-center gap-space-xs border-b border-white/10 px-space-md py-space-xs font-label-mono text-label-mono text-slate-300", children: [
2464
+ oldTitle && /* @__PURE__ */ jsx63("span", { className: "truncate", children: oldTitle }),
2465
+ oldTitle && newTitle && /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", children: "\u2192" }),
2466
+ newTitle && /* @__PURE__ */ jsx63("span", { className: "truncate", children: newTitle })
2467
+ ] }),
2468
+ unified,
2469
+ mode === "split" && /* @__PURE__ */ jsx63("pre", { tabIndex: 0, className: cx(PRE, "hidden grid-cols-2 lg:grid"), children: splitRows(lines).map((r, i) => /* @__PURE__ */ jsxs46("div", { className: "contents", children: [
2470
+ /* @__PURE__ */ jsx63(Row, { line: r.left, gutters: "old" }),
2471
+ /* @__PURE__ */ jsx63(Row, { line: r.right, gutters: "new" })
2472
+ ] }, i)) })
2473
+ ] });
2474
+ }
2475
+
2476
+ // src/components/BarChart.tsx
2477
+ import { jsx as jsx64, jsxs as jsxs47 } from "react/jsx-runtime";
2478
+ var HEIGHT4 = { sm: "h-16", md: "h-28" };
2479
+ var TONE14 = { brand: "bg-brand-cobalt", success: "bg-brand-emerald" };
2480
+ function BarChart({ label, bars, highlight, highlightLabel, axis, height = "md", tone = "brand", ...rest }) {
2481
+ const max = Math.max(0, ...bars.map((b) => b.value));
2482
+ const name = (i) => bars[i].label ?? `Bar ${i + 1}`;
2483
+ const hl = highlight !== void 0 && bars[highlight] ? `; highlighted ${name(highlight)} = ${bars[highlight].value}` : "";
2484
+ const summary = `${label}: ${bars.length} bars, highest ${max}${hl}`;
2485
+ return /* @__PURE__ */ jsxs47("figure", { ...rest, className: "flex min-w-0 flex-col gap-space-xs", children: [
2486
+ /* @__PURE__ */ jsx64("div", { role: "img", "aria-label": summary, className: cx("flex items-end gap-1", HEIGHT4[height], highlightLabel && "pt-space-lg"), children: bars.map((b, i) => {
2487
+ const pct = max > 0 ? Math.max(2, Math.round(Math.max(0, b.value) / max * 100)) : 2;
2488
+ const strong = highlight === void 0 || i === highlight;
2489
+ return /* @__PURE__ */ jsxs47("div", { className: "relative flex h-full min-w-0 flex-1 items-end", children: [
2490
+ i === highlight && highlightLabel && /* @__PURE__ */ jsx64("span", { className: "absolute -top-space-lg left-1/2 -translate-x-1/2 whitespace-nowrap font-label-mono text-[10px] text-fg-brand", children: highlightLabel }),
2491
+ /* @__PURE__ */ jsx64("div", { "data-bar": "", className: cx("w-full rounded-t", strong ? TONE14[tone] : "bg-surface-container-high"), style: { height: `${pct}%` } })
2492
+ ] }, i);
2493
+ }) }),
2494
+ axis && /* @__PURE__ */ jsxs47("div", { "aria-hidden": "true", className: "flex justify-between font-label-mono text-[10px] text-on-surface-variant", children: [
2495
+ /* @__PURE__ */ jsx64("span", { children: axis[0] }),
2496
+ /* @__PURE__ */ jsx64("span", { children: axis[1] }),
2497
+ /* @__PURE__ */ jsx64("span", { children: axis[2] })
2498
+ ] }),
2499
+ /* @__PURE__ */ jsxs47("table", { className: "sr-only", children: [
2500
+ /* @__PURE__ */ jsx64("caption", { children: label }),
2501
+ /* @__PURE__ */ jsx64("tbody", { children: bars.map((b, i) => /* @__PURE__ */ jsxs47("tr", { children: [
2502
+ /* @__PURE__ */ jsx64("th", { scope: "row", children: name(i) }),
2503
+ /* @__PURE__ */ jsx64("td", { children: b.value })
2504
+ ] }, i)) })
2505
+ ] })
2506
+ ] });
2507
+ }
2508
+
2509
+ // src/ide/UmlClass.tsx
2510
+ import { jsx as jsx65, jsxs as jsxs48 } from "react/jsx-runtime";
2511
+ var EMPHASIS = { default: "border border-border-strong", brand: "border-2 border-brand-cobalt", strong: "border-2 border-ink" };
2512
+ var SIZE14 = { sm: { text: "text-[11px] leading-4", pad: "px-space-xs py-space-2xs" }, md: { text: "text-code-inline", pad: "px-space-sm py-space-xs" } };
2513
+ function UmlClass({ name, stereotype, attributes = [], methods = [], tag, emphasis = "default", size = "md", dashed, ...rest }) {
2514
+ const s = SIZE14[size];
2515
+ return /* @__PURE__ */ jsxs48("div", { ...rest, className: cx("inline-flex min-w-0 max-w-full flex-col overflow-hidden rounded-lg bg-surface-elevated font-code-inline text-on-surface shadow-sm", EMPHASIS[emphasis], dashed && "border-dashed", s.text), children: [
2516
+ /* @__PURE__ */ jsxs48("div", { className: cx("flex flex-col items-center text-center", s.pad), children: [
2517
+ stereotype && /* @__PURE__ */ jsxs48("span", { className: "text-on-surface-variant", children: [
2518
+ "\xAB",
2519
+ stereotype,
2520
+ "\xBB"
2521
+ ] }),
2522
+ /* @__PURE__ */ jsx65("span", { className: "font-semibold text-ink", children: name }),
2523
+ tag
2524
+ ] }),
2525
+ attributes.length > 0 && /* @__PURE__ */ jsx65("ul", { className: cx("border-t border-border-subtle", s.pad), children: attributes.map((a, i) => /* @__PURE__ */ jsx65("li", { className: "whitespace-nowrap", children: a }, i)) }),
2526
+ methods.length > 0 && /* @__PURE__ */ jsx65("ul", { className: cx("border-t border-border-subtle", s.pad), children: methods.map((m, i) => /* @__PURE__ */ jsx65("li", { className: "whitespace-nowrap", children: m }, i)) })
2527
+ ] });
2528
+ }
2529
+
2530
+ // src/ide/UmlDiagram.tsx
2531
+ import { useEffect as useEffect7, useId as useId13, useRef as useRef11, useState as useState9 } from "react";
2532
+ import { jsx as jsx66, jsxs as jsxs49 } from "react/jsx-runtime";
2533
+ var VERB = {
2534
+ association: "is associated with",
2535
+ dependency: "depends on",
2536
+ realization: "implements",
2537
+ inheritance: "extends",
2538
+ aggregation: "aggregates",
2539
+ composition: "composes"
2540
+ };
2541
+ var ZOOM_MIN = 0.5;
2542
+ var ZOOM_MAX = 2;
2543
+ var ZOOM_STEP = 0.25;
2544
+ function describeDiagram(label, nodes, edges) {
2545
+ const byId = new Map(nodes.map((n) => [n.id, n.name]));
2546
+ const classes = nodes.map((n) => n.stereotype ? `${n.name} (${n.stereotype})` : n.name).join(", ");
2547
+ const rels = edges.filter((e) => byId.has(e.from) && byId.has(e.to)).map((e) => {
2548
+ const mult = e.fromMultiplicity || e.toMultiplicity ? ` (${e.fromMultiplicity ?? ""} to ${e.toMultiplicity ?? ""})` : "";
2549
+ return `${byId.get(e.from)} ${VERB[e.kind]} ${byId.get(e.to)}${mult}${e.label ? `, ${e.label}` : ""}`;
2550
+ }).join("; ");
2551
+ return `${label}. Classes: ${classes}.${rels ? ` Relationships: ${rels}.` : ""}`;
2552
+ }
2553
+ function edgeStyle(kind, id) {
2554
+ const dashed = kind === "dependency" || kind === "realization";
2555
+ const end = kind === "association" || kind === "dependency" ? `url(#${id}-arrow)` : kind === "realization" || kind === "inheritance" ? `url(#${id}-triangle)` : void 0;
2556
+ const start = kind === "aggregation" ? `url(#${id}-diamond-hollow)` : kind === "composition" ? `url(#${id}-diamond-filled)` : void 0;
2557
+ return { dashed, end, start };
2558
+ }
2559
+ function UmlDiagram({ label, nodes, edges, direction = "TB", zoomable = true, compact, pattern = "dots", ...rest }) {
2560
+ const id = useId13().replace(/[^a-zA-Z0-9_-]/g, "");
2561
+ const nodeRefs = useRef11(/* @__PURE__ */ new Map());
2562
+ const viewportRef = useRef11(null);
2563
+ const [layout, setLayout] = useState9(null);
2564
+ const [zoom, setZoom] = useState9(1);
2565
+ const [fit, setFit] = useState9(1);
2566
+ const contentKey = JSON.stringify({ n: nodes.map((n) => [n.id, n.name, n.stereotype, n.attributes, n.methods]), e: edges.map((e) => [e.from, e.to, e.kind]), direction, compact });
2567
+ const [sizeTick, setSizeTick] = useState9(0);
2568
+ const sizes = useRef11(/* @__PURE__ */ new Map());
2569
+ const key = `${contentKey}#${sizeTick}`;
2570
+ useEffect7(() => {
2571
+ if (typeof ResizeObserver === "undefined") return;
2572
+ const ro = new ResizeObserver(() => {
2573
+ let changed = false;
2574
+ nodeRefs.current.forEach((el, nodeId) => {
2575
+ const size = `${el.offsetWidth}x${el.offsetHeight}`;
2576
+ if (sizes.current.get(nodeId) !== size) {
2577
+ sizes.current.set(nodeId, size);
2578
+ changed = true;
2579
+ }
2580
+ });
2581
+ if (changed) setSizeTick((t) => t + 1);
2582
+ });
2583
+ nodeRefs.current.forEach((el) => ro.observe(el));
2584
+ return () => ro.disconnect();
2585
+ }, [contentKey]);
2586
+ useEffect7(() => {
2587
+ let cancelled = false;
2588
+ void (async () => {
2589
+ const { Graph, layout: runLayout } = await import("@dagrejs/dagre");
2590
+ const g = new Graph({ multigraph: true });
2591
+ g.setGraph({ rankdir: direction, nodesep: 48, ranksep: 64, marginx: 16, marginy: 16 });
2592
+ g.setDefaultEdgeLabel(() => ({}));
2593
+ for (const n of nodes) {
2594
+ const el = nodeRefs.current.get(n.id);
2595
+ g.setNode(n.id, { width: el?.offsetWidth || 160, height: el?.offsetHeight || 80 });
2596
+ }
2597
+ edges.forEach((e, i) => {
2598
+ if (g.hasNode(e.from) && g.hasNode(e.to)) g.setEdge(e.from, e.to, {}, `e${i}`);
2599
+ });
2600
+ runLayout(g);
2601
+ if (cancelled) return;
2602
+ const graph = g.graph();
2603
+ const positioned = {};
2604
+ for (const n of nodes) {
2605
+ const v = g.node(n.id);
2606
+ if (v) positioned[n.id] = { x: v.x - v.width / 2, y: v.y - v.height / 2 };
2607
+ }
2608
+ setLayout({
2609
+ width: graph.width ?? 0,
2610
+ height: graph.height ?? 0,
2611
+ nodes: positioned,
2612
+ edges: edges.map((e, i) => g.edge({ v: e.from, w: e.to, name: `e${i}` })?.points ?? null)
2613
+ });
2614
+ })();
2615
+ return () => {
2616
+ cancelled = true;
2617
+ };
2618
+ }, [key]);
2619
+ useEffect7(() => {
2620
+ const vp = viewportRef.current;
2621
+ if (!layout || !vp || layout.width === 0) return;
2622
+ const measure = () => setFit(Math.min(1, vp.clientWidth / layout.width || 1));
2623
+ measure();
2624
+ if (typeof ResizeObserver === "undefined") return;
2625
+ const ro = new ResizeObserver(measure);
2626
+ ro.observe(vp);
2627
+ return () => ro.disconnect();
2628
+ }, [layout]);
2629
+ const scale = compact ? fit : zoom;
2630
+ const descId = `${id}-desc`;
2631
+ return /* @__PURE__ */ jsxs49("figure", { ...rest, className: "relative min-w-0 max-w-full overflow-hidden rounded-xl border border-border-subtle bg-surface-subtle", children: [
2632
+ /* @__PURE__ */ jsx66("figcaption", { id: descId, className: "sr-only", children: describeDiagram(label, nodes, edges) }),
2633
+ zoomable && !compact && /* @__PURE__ */ jsxs49("div", { className: "absolute right-space-sm top-space-sm z-10 flex items-center gap-space-2xs rounded-lg bg-surface-elevated/90 p-space-2xs shadow-sm", children: [
2634
+ /* @__PURE__ */ jsx66(IconButton, { icon: "zoom_out", label: "Zoom out", size: "xs", variant: "secondary", disabled: zoom <= ZOOM_MIN, onClick: () => setZoom((z) => Math.max(ZOOM_MIN, z - ZOOM_STEP)) }),
2635
+ /* @__PURE__ */ jsxs49("span", { "aria-live": "polite", className: "w-10 text-center font-label-mono text-[11px] text-on-surface-variant", children: [
2636
+ Math.round(zoom * 100),
2637
+ "%"
2638
+ ] }),
2639
+ /* @__PURE__ */ jsx66(IconButton, { icon: "zoom_in", label: "Zoom in", size: "xs", variant: "secondary", disabled: zoom >= ZOOM_MAX, onClick: () => setZoom((z) => Math.min(ZOOM_MAX, z + ZOOM_STEP)) }),
2640
+ /* @__PURE__ */ jsx66(IconButton, { icon: "fit_screen", label: "Reset zoom", size: "xs", variant: "secondary", onClick: () => setZoom(1) })
2641
+ ] }),
2642
+ /* @__PURE__ */ jsx66(
2643
+ "div",
2644
+ {
2645
+ ref: viewportRef,
2646
+ role: "region",
2647
+ "aria-label": `${label} diagram`,
2648
+ tabIndex: 0,
2649
+ className: cx("min-h-40 overflow-auto focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-brand-cobalt", pattern === "dots" && "bg-pattern-dots", compact ? "max-h-64" : "max-h-[36rem]", zoomable && !compact && "pt-space-2xl"),
2650
+ children: /* @__PURE__ */ jsxs49(
2651
+ "div",
2652
+ {
2653
+ role: "img",
2654
+ "aria-label": label,
2655
+ "aria-describedby": descId,
2656
+ className: layout ? "relative origin-top-left" : "flex flex-wrap gap-space-md p-space-md",
2657
+ style: layout ? { width: layout.width, height: layout.height, transform: `scale(${scale})` } : void 0,
2658
+ children: [
2659
+ layout && /* @__PURE__ */ jsxs49("svg", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 overflow-visible text-on-surface-variant", width: layout.width, height: layout.height, children: [
2660
+ /* @__PURE__ */ jsxs49("defs", { children: [
2661
+ /* @__PURE__ */ jsx66("marker", { id: `${id}-arrow`, viewBox: "0 0 10 10", refX: "10", refY: "5", markerWidth: "10", markerHeight: "10", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,0 L10,5 L0,10", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }) }),
2662
+ /* @__PURE__ */ jsx66("marker", { id: `${id}-triangle`, viewBox: "0 0 12 12", refX: "12", refY: "6", markerWidth: "12", markerHeight: "12", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,0 L12,6 L0,12 z", fill: "var(--color-surface-elevated)", stroke: "currentColor", strokeWidth: "1.5" }) }),
2663
+ /* @__PURE__ */ jsx66("marker", { id: `${id}-diamond-hollow`, viewBox: "0 0 14 8", refX: "14", refY: "4", markerWidth: "14", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,4 L7,0 L14,4 L7,8 z", fill: "var(--color-surface-elevated)", stroke: "currentColor", strokeWidth: "1.5" }) }),
2664
+ /* @__PURE__ */ jsx66("marker", { id: `${id}-diamond-filled`, viewBox: "0 0 14 8", refX: "14", refY: "4", markerWidth: "14", markerHeight: "8", orient: "auto-start-reverse", children: /* @__PURE__ */ jsx66("path", { d: "M0,4 L7,0 L14,4 L7,8 z", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.5" }) })
2665
+ ] }),
2666
+ edges.map((e, i) => {
2667
+ const pts = layout.edges[i];
2668
+ if (!pts || pts.length < 2) return null;
2669
+ const s = edgeStyle(e.kind, id);
2670
+ const d = pts.map((p, k) => `${k === 0 ? "M" : "L"}${p.x},${p.y}`).join(" ");
2671
+ const mid = pts[Math.floor(pts.length / 2)];
2672
+ return /* @__PURE__ */ jsxs49("g", { children: [
2673
+ /* @__PURE__ */ jsx66(
2674
+ "path",
2675
+ {
2676
+ "data-edge": "",
2677
+ d,
2678
+ fill: "none",
2679
+ stroke: "currentColor",
2680
+ strokeWidth: "1.5",
2681
+ strokeDasharray: s.dashed ? "6 4" : void 0,
2682
+ markerEnd: s.end,
2683
+ markerStart: s.start
2684
+ }
2685
+ ),
2686
+ e.label && /* @__PURE__ */ jsx66("text", { x: mid.x + 6, y: mid.y - 6, className: "fill-on-surface-variant font-code-inline text-[10px]", children: e.label }),
2687
+ e.fromMultiplicity && /* @__PURE__ */ jsx66("text", { x: pts[0].x + 6, y: pts[0].y + 14, className: "fill-on-surface-variant font-code-inline text-[10px]", children: e.fromMultiplicity }),
2688
+ e.toMultiplicity && /* @__PURE__ */ jsx66("text", { x: pts[pts.length - 1].x + 6, y: pts[pts.length - 1].y - 6, className: "fill-on-surface-variant font-code-inline text-[10px]", children: e.toMultiplicity })
2689
+ ] }, i);
2690
+ })
2691
+ ] }),
2692
+ nodes.map((n) => /* @__PURE__ */ jsx66(
2693
+ "div",
2694
+ {
2695
+ "data-node": "",
2696
+ ref: (el) => {
2697
+ if (el) nodeRefs.current.set(n.id, el);
2698
+ else nodeRefs.current.delete(n.id);
2699
+ },
2700
+ className: layout ? "absolute" : void 0,
2701
+ style: layout?.nodes[n.id] ? { left: layout.nodes[n.id].x, top: layout.nodes[n.id].y } : void 0,
2702
+ children: /* @__PURE__ */ jsx66(UmlClass, { name: n.name, stereotype: n.stereotype, attributes: n.attributes, methods: n.methods, tag: n.tag, emphasis: n.emphasis, dashed: n.dashed, size: compact ? "sm" : "md" })
2703
+ },
2704
+ n.id
2705
+ ))
2706
+ ]
2707
+ }
2708
+ )
2709
+ }
2710
+ )
2711
+ ] });
2712
+ }
2713
+
2714
+ // src/components/Tooltip.tsx
2715
+ import {
2716
+ cloneElement as cloneElement2,
2717
+ useEffect as useEffect8,
2718
+ useId as useId14,
2719
+ useLayoutEffect,
2720
+ useRef as useRef12,
2721
+ useState as useState10
2722
+ } from "react";
2723
+ import { createPortal as createPortal3 } from "react-dom";
2724
+ import { Fragment as Fragment6, jsx as jsx67, jsxs as jsxs50 } from "react/jsx-runtime";
2725
+ var GAP2 = 8;
2726
+ function Tooltip({ content, children, side = "top", delay = 400 }) {
2727
+ const id = useId14();
2728
+ const theme = useThemeTone();
2729
+ const [open, setOpen] = useState10(false);
2730
+ const [pos, setPos] = useState10(null);
2731
+ const triggerRef = useRef12(null);
2732
+ const tipRef = useRef12(null);
2733
+ const timer = useRef12(void 0);
2734
+ const show = () => {
2735
+ clearTimeout(timer.current);
2736
+ timer.current = setTimeout(() => setOpen(true), delay);
2737
+ };
2738
+ const hide = () => {
2739
+ clearTimeout(timer.current);
2740
+ setOpen(false);
2741
+ setPos(null);
2742
+ };
2743
+ useEffect8(() => () => clearTimeout(timer.current), []);
2744
+ useEffect8(() => {
2745
+ if (!open) return;
2746
+ const onKey = (e) => {
2747
+ if (e.key === "Escape") hide();
2748
+ };
2749
+ document.addEventListener("keydown", onKey);
2750
+ return () => document.removeEventListener("keydown", onKey);
2751
+ }, [open]);
2752
+ useLayoutEffect(() => {
2753
+ if (!open || !triggerRef.current || !tipRef.current) return;
2754
+ const r = triggerRef.current.getBoundingClientRect();
2755
+ const t = tipRef.current.getBoundingClientRect();
2756
+ const vw = window.innerWidth;
2757
+ const vh = window.innerHeight;
2758
+ let s = side;
2759
+ if (s === "top" && r.top - t.height - GAP2 < 0) s = "bottom";
2760
+ else if (s === "bottom" && r.bottom + t.height + GAP2 > vh) s = "top";
2761
+ else if (s === "left" && r.left - t.width - GAP2 < 0) s = "right";
2762
+ else if (s === "right" && r.right + t.width + GAP2 > vw) s = "left";
2763
+ let top = s === "top" ? r.top - t.height - GAP2 : s === "bottom" ? r.bottom + GAP2 : r.top + r.height / 2 - t.height / 2;
2764
+ let left = s === "left" ? r.left - t.width - GAP2 : s === "right" ? r.right + GAP2 : r.left + r.width / 2 - t.width / 2;
2765
+ left = Math.min(Math.max(GAP2, left), Math.max(GAP2, vw - t.width - GAP2));
2766
+ top = Math.min(Math.max(GAP2, top), Math.max(GAP2, vh - t.height - GAP2));
2767
+ setPos({ top, left });
2768
+ }, [open, side]);
2769
+ const own = children.props;
2770
+ const trigger = cloneElement2(children, {
2771
+ ref: (el) => {
2772
+ triggerRef.current = el;
2773
+ const r = own.ref;
2774
+ if (typeof r === "function") r(el);
2775
+ else if (r && typeof r === "object") r.current = el;
2776
+ },
2777
+ "aria-describedby": open ? [own["aria-describedby"], id].filter(Boolean).join(" ") : own["aria-describedby"],
2778
+ onMouseEnter: (e) => {
2779
+ own.onMouseEnter?.(e);
2780
+ show();
2781
+ },
2782
+ onMouseLeave: (e) => {
2783
+ own.onMouseLeave?.(e);
2784
+ hide();
2785
+ },
2786
+ onFocus: (e) => {
2787
+ own.onFocus?.(e);
2788
+ show();
2789
+ },
2790
+ onBlur: (e) => {
2791
+ own.onBlur?.(e);
2792
+ hide();
2793
+ }
2794
+ });
2795
+ return /* @__PURE__ */ jsxs50(Fragment6, { children: [
2796
+ trigger,
2797
+ open && typeof document !== "undefined" && createPortal3(
2798
+ /* @__PURE__ */ jsx67(
2799
+ "div",
2800
+ {
2801
+ ref: tipRef,
2802
+ id,
2803
+ role: "tooltip",
2804
+ "data-theme": theme,
2805
+ className: "pointer-events-none fixed z-50 max-w-[min(20rem,calc(100vw-1rem))] rounded-lg bg-ink px-space-sm py-space-xs font-body-sm text-body-sm text-on-ink shadow-md wrap-break-word",
2806
+ style: pos ? { top: pos.top, left: pos.left } : { top: 0, left: 0, visibility: "hidden" },
2807
+ children: content
2808
+ }
2809
+ ),
2810
+ document.body
2811
+ )
2812
+ ] });
2813
+ }
2814
+
2815
+ // src/components/Toast.tsx
2816
+ import { useEffect as useEffect9, useState as useState11, useSyncExternalStore } from "react";
2817
+ import { jsx as jsx68, jsxs as jsxs51 } from "react/jsx-runtime";
2818
+ var toasts = [];
2819
+ var nextId = 1;
2820
+ var listeners = /* @__PURE__ */ new Set();
2821
+ var EMPTY = [];
2822
+ var emit = () => listeners.forEach((l) => l());
2823
+ var toastStore = {
2824
+ show(options) {
2825
+ const toast = { ...options, tone: options.tone ?? "default", duration: options.duration ?? 4e3, id: nextId++ };
2826
+ toasts = [...toasts, toast];
2827
+ emit();
2828
+ return toast.id;
2829
+ },
2830
+ dismiss(id) {
2831
+ toasts = toasts.filter((t) => t.id !== id);
2832
+ emit();
2833
+ },
2834
+ clear() {
2835
+ toasts = [];
2836
+ emit();
2837
+ },
2838
+ subscribe(listener) {
2839
+ listeners.add(listener);
2840
+ return () => {
2841
+ listeners.delete(listener);
2842
+ };
2843
+ },
2844
+ get: () => toasts
2845
+ };
2846
+ function useToast() {
2847
+ return { show: toastStore.show, dismiss: toastStore.dismiss };
2848
+ }
2849
+ var TONE15 = { default: "border-l-ink", success: "border-l-brand-emerald", danger: "border-l-brand-crimson" };
2850
+ function ToastItem({ toast }) {
2851
+ const [paused, setPaused] = useState11(false);
2852
+ useEffect9(() => {
2853
+ if (paused || !Number.isFinite(toast.duration)) return;
2854
+ const t = setTimeout(() => toastStore.dismiss(toast.id), toast.duration);
2855
+ return () => clearTimeout(t);
2856
+ }, [paused, toast]);
2857
+ return /* @__PURE__ */ jsxs51(
2858
+ "li",
2859
+ {
2860
+ onMouseEnter: () => setPaused(true),
2861
+ onMouseLeave: () => setPaused(false),
2862
+ onFocus: () => setPaused(true),
2863
+ onBlur: () => setPaused(false),
2864
+ className: cx("pointer-events-auto flex min-w-0 items-start gap-space-sm rounded-lg border border-l-4 border-border-subtle bg-surface-elevated p-space-sm text-on-surface shadow-md", TONE15[toast.tone]),
2865
+ children: [
2866
+ /* @__PURE__ */ jsxs51("div", { className: "min-w-0 flex-1", children: [
2867
+ /* @__PURE__ */ jsx68("p", { className: "font-body-md text-body-md font-semibold wrap-break-word", children: toast.title }),
2868
+ toast.description && /* @__PURE__ */ jsx68("p", { className: "font-body-sm text-body-sm text-on-surface-variant wrap-break-word", children: toast.description }),
2869
+ toast.action && /* @__PURE__ */ jsx68("div", { className: "mt-space-xs", children: toast.action })
2870
+ ] }),
2871
+ /* @__PURE__ */ jsx68(IconButton, { icon: "close", label: "Dismiss notification", size: "xs", onClick: () => toastStore.dismiss(toast.id) })
2872
+ ]
2873
+ }
2874
+ );
2875
+ }
2876
+ function Toaster({ label = "Notifications" }) {
2877
+ const list = useSyncExternalStore(toastStore.subscribe, toastStore.get, () => EMPTY);
2878
+ return /* @__PURE__ */ jsx68("section", { "aria-label": label, className: "pointer-events-none fixed inset-x-0 bottom-0 z-50 p-space-md md:inset-x-auto md:right-0 md:w-96", children: /* @__PURE__ */ jsx68("div", { "aria-live": "polite", "aria-relevant": "additions", children: /* @__PURE__ */ jsx68("ol", { className: "flex flex-col gap-space-xs", children: list.map((t) => /* @__PURE__ */ jsx68(ToastItem, { toast: t }, t.id)) }) }) });
2879
+ }
2880
+
2881
+ // src/components/CommandPalette.tsx
2882
+ import { useEffect as useEffect10, useId as useId15, useRef as useRef13, useState as useState12 } from "react";
2883
+ import { createPortal as createPortal4 } from "react-dom";
2884
+ import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
2885
+ function CommandPalette({ open, onClose, query, onQueryChange, groups, placeholder = "Search\u2026", emptyText = "No results", label = "Command palette", ...rest }) {
2886
+ const base = useId15();
2887
+ const theme = useThemeTone();
2888
+ const panelRef = useRef13(null);
2889
+ const inputRef = useRef13(null);
2890
+ const [activeId, setActiveId] = useState12(null);
2891
+ useModal({ open, onClose, panelRef, initialFocusRef: inputRef });
2892
+ const flat = groups.flatMap((g) => g.items);
2893
+ const active = flat.find((i) => i.id === activeId) ?? flat[0];
2894
+ const optionId = (id) => `${base}-opt-${id}`;
2895
+ useEffect10(() => {
2896
+ if (active) document.getElementById(optionId(active.id))?.scrollIntoView?.({ block: "nearest" });
2897
+ }, [active?.id]);
2898
+ const select = (item) => {
2899
+ item.onSelect();
2900
+ onClose();
2901
+ };
2902
+ const onKeyDown = (e) => {
2903
+ if (!flat.length) return;
2904
+ const i = active ? flat.indexOf(active) : 0;
2905
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
2906
+ e.preventDefault();
2907
+ const next = (i + (e.key === "ArrowDown" ? 1 : -1) + flat.length) % flat.length;
2908
+ setActiveId(flat[next].id);
2909
+ } else if (e.key === "Enter" && active) {
2910
+ e.preventDefault();
2911
+ select(active);
2912
+ }
2913
+ };
2914
+ if (!open || typeof document === "undefined") return null;
2915
+ const listId = `${base}-list`;
2916
+ return createPortal4(
2917
+ /* @__PURE__ */ jsx69(
2918
+ "div",
2919
+ {
2920
+ "data-theme": theme,
2921
+ className: "fixed inset-0 z-50 flex items-start justify-center bg-brand-obsidian/40 p-space-md pt-[10vh] backdrop-blur-sm",
2922
+ onMouseDown: (e) => {
2923
+ if (e.target === e.currentTarget) onClose();
2924
+ },
2925
+ children: /* @__PURE__ */ jsxs52(
2926
+ "div",
2927
+ {
2928
+ ...rest,
2929
+ ref: panelRef,
2930
+ role: "dialog",
2931
+ "aria-modal": "true",
2932
+ "aria-label": label,
2933
+ tabIndex: -1,
2934
+ className: "flex max-h-[80vh] w-full min-w-0 max-w-xl flex-col overflow-hidden rounded-xl border border-border-subtle bg-surface-elevated text-on-surface shadow-md outline-none",
2935
+ children: [
2936
+ /* @__PURE__ */ jsxs52("div", { className: "flex items-center gap-space-sm border-b border-border-subtle px-space-md", children: [
2937
+ /* @__PURE__ */ jsx69(Icon, { name: "search", tone: "muted" }),
2938
+ /* @__PURE__ */ jsx69(
2939
+ "input",
2940
+ {
2941
+ ref: inputRef,
2942
+ role: "combobox",
2943
+ "aria-label": label,
2944
+ "aria-expanded": "true",
2945
+ "aria-controls": listId,
2946
+ "aria-autocomplete": "list",
2947
+ "aria-activedescendant": active ? optionId(active.id) : void 0,
2948
+ value: query,
2949
+ placeholder,
2950
+ onChange: (e) => {
2951
+ onQueryChange(e.target.value);
2952
+ setActiveId(null);
2953
+ },
2954
+ onKeyDown,
2955
+ className: "h-12 min-w-0 flex-1 bg-transparent font-body-md text-body-md text-on-surface outline-none placeholder:text-on-surface-variant"
2956
+ }
2957
+ )
2958
+ ] }),
2959
+ /* @__PURE__ */ jsxs52("div", { id: listId, role: "listbox", "aria-label": label, className: "min-h-0 flex-1 overflow-y-auto p-space-2xs", children: [
2960
+ flat.length === 0 && /* @__PURE__ */ jsx69("p", { className: "px-space-sm py-space-md text-center font-body-sm text-body-sm text-on-surface-variant", children: emptyText }),
2961
+ groups.map((g, gi) => /* @__PURE__ */ jsxs52("div", { role: "group", "aria-labelledby": `${base}-g${gi}`, children: [
2962
+ /* @__PURE__ */ jsx69("p", { id: `${base}-g${gi}`, className: "px-space-sm pb-space-2xs pt-space-sm font-label-mono text-label-mono uppercase text-on-surface-variant", children: g.label }),
2963
+ g.items.map((item) => {
2964
+ const isActive = item === active;
2965
+ return /* @__PURE__ */ jsxs52(
2966
+ "div",
2967
+ {
2968
+ id: optionId(item.id),
2969
+ role: "option",
2970
+ "aria-selected": isActive,
2971
+ onMouseMove: () => setActiveId(item.id),
2972
+ onMouseDown: (e) => e.preventDefault(),
2973
+ onClick: () => select(item),
2974
+ className: cx("flex min-w-0 cursor-pointer items-center gap-space-sm rounded-lg px-space-sm py-space-xs font-body-md text-body-md max-md:min-h-11", isActive ? "bg-surface-muted text-ink" : "text-on-surface"),
2975
+ children: [
2976
+ item.icon && /* @__PURE__ */ jsx69(Icon, { name: item.icon, size: "sm", tone: "muted" }),
2977
+ /* @__PURE__ */ jsx69("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
2978
+ item.meta && /* @__PURE__ */ jsx69("span", { className: "shrink-0 font-label-mono text-label-mono text-on-surface-variant", children: item.meta })
2979
+ ]
2980
+ },
2981
+ item.id
2982
+ );
2983
+ })
2984
+ ] }, g.label))
2985
+ ] })
2986
+ ]
2987
+ }
2988
+ )
2989
+ }
2990
+ ),
2991
+ document.body
2992
+ );
2993
+ }
2994
+
2995
+ // src/primitives/Show.tsx
2996
+ import { jsx as jsx70 } from "react/jsx-runtime";
2997
+ var ABOVE = { sm: "hidden sm:contents", md: "hidden md:contents", lg: "hidden lg:contents", xl: "hidden xl:contents" };
2998
+ var BELOW = { sm: "contents sm:hidden", md: "contents md:hidden", lg: "contents lg:hidden", xl: "contents xl:hidden" };
2999
+ function Show({ above, below, children, ...rest }) {
3000
+ return /* @__PURE__ */ jsx70("div", { ...rest, className: cx(above && ABOVE[above], below && BELOW[below]), children });
3001
+ }
1535
3002
  export {
3003
+ AppBar,
1536
3004
  Avatar,
3005
+ AvatarGroup,
1537
3006
  Badge,
3007
+ BarChart,
1538
3008
  Box,
1539
3009
  Breadcrumbs,
1540
3010
  Button,
1541
3011
  Callout,
1542
3012
  Card,
1543
3013
  CardFooter,
3014
+ CardHeader,
1544
3015
  CardMedia,
1545
3016
  CheckList,
3017
+ Checkbox,
1546
3018
  Chip,
1547
3019
  Code,
1548
3020
  CodeBlock,
3021
+ CommandPalette,
1549
3022
  Container,
3023
+ CopyButton,
1550
3024
  Countdown,
3025
+ DescriptionList,
1551
3026
  Dialog,
3027
+ DiffViewer,
3028
+ Disclosure,
3029
+ Divider,
1552
3030
  Dot,
3031
+ Drawer,
1553
3032
  EditorTabs,
1554
3033
  EmptyState,
1555
3034
  Eyebrow,
@@ -1558,27 +3037,46 @@ export {
1558
3037
  Heading,
1559
3038
  Icon,
1560
3039
  IconButton,
3040
+ IconTile,
1561
3041
  Kbd,
1562
3042
  Markdown,
1563
3043
  Menu,
1564
3044
  Message,
1565
3045
  MetricTile,
3046
+ NavList,
3047
+ Overlay,
3048
+ Pagination,
1566
3049
  ProgressBar,
1567
3050
  ResultRow,
1568
3051
  Section,
1569
3052
  SectionHeader,
1570
3053
  SegmentedControl,
1571
3054
  Select,
3055
+ Show,
3056
+ Skeleton,
1572
3057
  Split,
1573
3058
  Stack,
1574
3059
  Stat,
1575
3060
  StatusBar,
3061
+ Switch,
1576
3062
  TabPanel,
3063
+ Table,
1577
3064
  Tabs,
3065
+ TerminalOutput,
1578
3066
  Text,
1579
3067
  TextField,
3068
+ TextLink,
1580
3069
  Theme,
3070
+ Timeline,
3071
+ Toaster,
3072
+ Tooltip,
3073
+ UmlClass,
3074
+ UmlDiagram,
3075
+ VerdictBanner,
1581
3076
  Workbench,
1582
- useThemeTone
3077
+ describeDiagram,
3078
+ pageRange,
3079
+ useThemeTone,
3080
+ useToast
1583
3081
  };
1584
3082
  //# sourceMappingURL=index.js.map