reifyui 0.11.0 → 0.12.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
@@ -410,15 +410,22 @@ function ToolRow(props) {
410
410
  import React3 from "react";
411
411
  import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
412
412
  var DEFAULT_STATUS_LABELS = {
413
- failed: "\u2715 Failed \u2014 see the output above for the reason",
413
+ failed: "\u2715 Failed. See the output above for the reason",
414
414
  cancelled: "\u25FC Stopped by you",
415
- incomplete: "\u25D4 Hit its step or time limit \u2014 Continue to resume"
415
+ // Claims only what is true of every cause: an incomplete turn may have hit its step or time
416
+ // budget, or been cut mid-flight (a replica restart under a live turn settles as incomplete).
417
+ // Asserting "step or time limit" for all of them sent an operator debugging a limit that was
418
+ // never reached. A host that knows the actual cause says so in its own chrome (statusLabels /
419
+ // assistantFooter).
420
+ incomplete: "\u25D4 Stopped before finishing. Continue to resume"
416
421
  };
417
422
  var defaultMarkdown = (text) => /* @__PURE__ */ jsx3("div", { style: { whiteSpace: "pre-wrap" }, children: text });
423
+ var REDUCED_MOTION = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
418
424
  var REVEAL_SEC = 3;
419
425
  var MIN_CPS = 10;
420
426
  function TypewriterText(props) {
421
- const { text, active, render } = props;
427
+ const { text, render } = props;
428
+ const active = props.active && !REDUCED_MOTION;
422
429
  const [n, setN] = React3.useState(() => text ? text.length : 0);
423
430
  const textRef = React3.useRef(text);
424
431
  textRef.current = text;
@@ -450,11 +457,15 @@ function TypewriterText(props) {
450
457
  return render(shown);
451
458
  }
452
459
  function UserTurn(props) {
453
- const { msg, children } = props;
454
- return /* @__PURE__ */ jsx3("div", { className: "wbx-turn user", children: /* @__PURE__ */ jsxs3("div", { className: "wbx-bubble-user", children: [
460
+ const { msg, children, label } = props;
461
+ const bubble = /* @__PURE__ */ jsxs3("div", { className: "wbx-bubble-user", children: [
455
462
  children,
456
463
  msg.text && /* @__PURE__ */ jsx3("div", { className: "wbx-bubble-text", children: msg.text })
457
- ] }) });
464
+ ] });
465
+ return /* @__PURE__ */ jsx3("div", { className: "wbx-turn user", children: label ? /* @__PURE__ */ jsxs3("div", { className: "wbx-turn-body", children: [
466
+ /* @__PURE__ */ jsx3("div", { className: "wbx-role", children: label }),
467
+ bubble
468
+ ] }) : bubble });
458
469
  }
459
470
  function AssistantTurn(props) {
460
471
  const {
@@ -465,9 +476,11 @@ function AssistantTurn(props) {
465
476
  statusLabels = DEFAULT_STATUS_LABELS,
466
477
  renderStep,
467
478
  toolLabels,
468
- footer
479
+ footer,
480
+ label
469
481
  } = props;
470
482
  return /* @__PURE__ */ jsxs3("div", { className: "wbx-turn asst", children: [
483
+ label ? /* @__PURE__ */ jsx3("div", { className: "wbx-role", children: label }) : null,
471
484
  msg.blocks.map((b, bi) => b.kind === "tools" ? /* @__PURE__ */ jsx3(
472
485
  ToolGroup,
473
486
  {
@@ -520,14 +533,15 @@ function ChatMessages(props) {
520
533
  statusLabels,
521
534
  renderStep,
522
535
  workingLabel,
523
- toolLabels
536
+ toolLabels,
537
+ roleLabel
524
538
  } = props;
525
539
  return /* @__PURE__ */ jsx3(Fragment, { children: messages.map((m, i) => {
526
540
  if (renderMessage) {
527
541
  const el = renderMessage(m, i);
528
542
  if (el !== void 0) return /* @__PURE__ */ jsx3(React3.Fragment, { children: el }, i);
529
543
  }
530
- return m.role === "user" ? /* @__PURE__ */ jsx3(UserTurn, { msg: m, children: userExtras?.(m, i) }, i) : /* @__PURE__ */ jsx3(
544
+ return m.role === "user" ? /* @__PURE__ */ jsx3(UserTurn, { msg: m, label: roleLabel?.(m, i), children: userExtras?.(m, i) }, i) : /* @__PURE__ */ jsx3(
531
545
  AssistantTurn,
532
546
  {
533
547
  msg: m,
@@ -537,6 +551,7 @@ function ChatMessages(props) {
537
551
  statusLabels,
538
552
  renderStep,
539
553
  toolLabels,
554
+ label: roleLabel?.(m, i),
540
555
  footer: assistantFooter?.(m, i)
541
556
  },
542
557
  i
@@ -557,6 +572,7 @@ function Composer(props) {
557
572
  placeholder,
558
573
  rows = 1,
559
574
  autoGrow = true,
575
+ inline = false,
560
576
  maxRows = 15,
561
577
  autoFocus,
562
578
  // The composer on a landing page often has an ANIMATING placeholder (a typewriter cycling
@@ -564,6 +580,7 @@ function Composer(props) {
564
580
  // one is given — so the field announces a different name every few seconds.
565
581
  inputAriaLabel,
566
582
  attachments,
583
+ tray,
567
584
  accessoriesLeft,
568
585
  accessoriesRight,
569
586
  renderSend,
@@ -583,6 +600,38 @@ function Composer(props) {
583
600
  el.style.height = Math.min(el.scrollHeight, max) + "px";
584
601
  el.style.overflowY = el.scrollHeight > max ? "auto" : "hidden";
585
602
  }, [value, autoGrow, maxRows, taRef]);
603
+ const sendEl = renderSend ? renderSend() : /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ jsx4(IcSend, {}) });
604
+ if (inline) {
605
+ return /* @__PURE__ */ jsxs4("div", { className: classNames.root ?? "wbx-composer", children: [
606
+ attachments,
607
+ /* @__PURE__ */ jsxs4("div", { className: "uic-composer-line", children: [
608
+ accessoriesLeft,
609
+ /* @__PURE__ */ jsx4(
610
+ "textarea",
611
+ {
612
+ ref: taRef,
613
+ className: classNames.input ?? "wbx-composer-input",
614
+ rows,
615
+ value,
616
+ placeholder,
617
+ "aria-label": inputAriaLabel || placeholder,
618
+ disabled,
619
+ autoFocus,
620
+ onChange: (e) => onChange(e.target.value),
621
+ onKeyDown: (e) => {
622
+ if (e.key === "Enter" && !e.shiftKey) {
623
+ e.preventDefault();
624
+ onSend();
625
+ }
626
+ }
627
+ }
628
+ ),
629
+ accessoriesRight,
630
+ sendEl
631
+ ] }),
632
+ tray ? /* @__PURE__ */ jsx4("div", { className: "uic-composer-tray", children: tray }) : null
633
+ ] });
634
+ }
586
635
  return /* @__PURE__ */ jsxs4("div", { className: classNames.root ?? "wbx-composer", children: [
587
636
  attachments,
588
637
  /* @__PURE__ */ jsx4(
@@ -609,7 +658,8 @@ function Composer(props) {
609
658
  /* @__PURE__ */ jsx4("span", { style: { flex: 1 } }),
610
659
  accessoriesRight,
611
660
  renderSend ? renderSend() : /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ jsx4(IcSend, {}) })
612
- ] })
661
+ ] }),
662
+ tray ? /* @__PURE__ */ jsx4("div", { className: "uic-composer-tray", children: tray }) : null
613
663
  ] });
614
664
  }
615
665
 
@@ -617,34 +667,56 @@ function Composer(props) {
617
667
  import React6, { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
618
668
 
619
669
  // src/components/Chip.jsx
620
- import React5 from "react";
670
+ import React5, { forwardRef } from "react";
621
671
  import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
622
- function Chip(props) {
623
- const { label, icon, title, selected = false, onClick, onRemove, removeLabel, className } = props;
672
+ var Chip = forwardRef(function Chip2(props, ref) {
673
+ const {
674
+ label,
675
+ icon,
676
+ title,
677
+ selected = false,
678
+ onClick,
679
+ onRemove,
680
+ removeLabel,
681
+ trailing,
682
+ className,
683
+ slot,
684
+ ...rest
685
+ } = props;
686
+ const isSlot = slot ?? (Boolean(onClick) && !selected);
624
687
  const cls = [
625
688
  "uic-chip",
626
689
  selected ? "is-selected" : "",
627
- onClick && !selected ? "is-open" : "",
690
+ isSlot ? "is-open" : "",
628
691
  className || ""
629
692
  ].filter(Boolean).join(" ");
630
693
  const body = /* @__PURE__ */ jsxs5(Fragment2, { children: [
631
694
  icon ? /* @__PURE__ */ jsx5("span", { className: "uic-chip-ic", "aria-hidden": "true", children: icon }) : null,
632
695
  /* @__PURE__ */ jsx5("span", { className: "uic-chip-l", children: label })
633
696
  ] });
697
+ const trail = trailing ? /* @__PURE__ */ jsx5("span", { className: "uic-chip-tr", children: trailing }) : null;
634
698
  if (onClick && onRemove) {
635
- return /* @__PURE__ */ jsxs5("span", { className: cls, title, children: [
636
- /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-press", onClick, children: body }),
699
+ return /* @__PURE__ */ jsxs5("span", { ref, className: cls, title, children: [
700
+ /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
701
+ trail,
637
702
  /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx5(IcX, { size: 12 }) })
638
703
  ] });
639
704
  }
640
705
  if (onClick) {
641
- return /* @__PURE__ */ jsx5("button", { type: "button", className: cls, title, onClick, children: body });
706
+ if (trailing) {
707
+ return /* @__PURE__ */ jsxs5("span", { ref, className: cls, title, children: [
708
+ /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
709
+ trail
710
+ ] });
711
+ }
712
+ return /* @__PURE__ */ jsx5("button", { ref, type: "button", className: cls, title, onClick, ...rest, children: body });
642
713
  }
643
- return /* @__PURE__ */ jsxs5("span", { className: cls, title, children: [
714
+ return /* @__PURE__ */ jsxs5("span", { ref, className: cls, title, ...rest, children: [
644
715
  body,
716
+ trail,
645
717
  onRemove ? /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx5(IcX, { size: 12 }) }) : null
646
718
  ] });
647
- }
719
+ });
648
720
 
649
721
  // src/format.js
650
722
  function bytesLabel(n) {
@@ -2068,9 +2140,12 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
2068
2140
  }
2069
2141
 
2070
2142
  // src/sheet/SheetGrid.jsx
2071
- import { useEffect as useEffect8, useRef as useRef7, useState as useState8 } from "react";
2143
+ import { useEffect as useEffect8, useLayoutEffect, useRef as useRef7, useState as useState8 } from "react";
2072
2144
  import { createPortal as createPortal2 } from "react-dom";
2073
2145
  import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2146
+ var CLAMP_LINE = 18;
2147
+ var CLAMP_PAD = 10;
2148
+ var CLAMP_TEXT_SEL = "[data-shg-clamp-text]";
2074
2149
  var cellKey = (rowId, colId) => `${rowId}:${colId}`;
2075
2150
  var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
2076
2151
  var DEFAULT_COLUMN_TYPES = [
@@ -2239,6 +2314,7 @@ function SheetGrid({
2239
2314
  const [dropAt, setDropAt] = useState8(null);
2240
2315
  const inputRef = useRef7(null);
2241
2316
  const dragRef = useRef7(null);
2317
+ const gridRef = useRef7(null);
2242
2318
  const descOf = (type) => columnTypes.find((t) => t.type === type) || { type, label: type };
2243
2319
  const isComputed = (col) => !!descOf(col?.type).computed;
2244
2320
  const isEditable = (col) => {
@@ -2342,6 +2418,31 @@ function SheetGrid({
2342
2418
  useEffect8(() => {
2343
2419
  if (editing && inputRef.current) inputRef.current.focus();
2344
2420
  }, [editing]);
2421
+ useLayoutEffect(() => {
2422
+ const rowsEl = gridRef.current?.querySelectorAll("tbody tr[data-row-id]");
2423
+ if (!rowsEl || !rowsEl.length) return;
2424
+ const trs = Array.from(rowsEl);
2425
+ for (const tr of trs) {
2426
+ tr.style.removeProperty("--shg-clamp");
2427
+ for (const td of tr.children) td.style.setProperty("--shg-clamp", "1");
2428
+ }
2429
+ const plan = trs.map((tr) => ({
2430
+ base: tr.offsetHeight,
2431
+ cells: Array.from(tr.children).map((td) => {
2432
+ const txt = td.querySelector(CLAMP_TEXT_SEL);
2433
+ const box = txt && txt.parentElement;
2434
+ return { td, extra: box ? Math.max(0, box.scrollHeight - txt.offsetHeight) : 0 };
2435
+ })
2436
+ }));
2437
+ for (const { base, cells: cells2 } of plan) {
2438
+ const floorLines = Math.max(1, Math.floor((base - CLAMP_PAD) / CLAMP_LINE));
2439
+ const need = Math.max(...cells2.map((c) => c.extra)) + floorLines * CLAMP_LINE + CLAMP_PAD;
2440
+ for (const { td, extra } of cells2) {
2441
+ const lines = Math.max(floorLines, Math.floor((need - extra - CLAMP_PAD) / CLAMP_LINE));
2442
+ td.style.setProperty("--shg-clamp", String(lines));
2443
+ }
2444
+ }
2445
+ });
2345
2446
  const mutate = (fn) => {
2346
2447
  if (readOnly || !onChange) return;
2347
2448
  const next = JSON.parse(JSON.stringify(sheet));
@@ -2498,7 +2599,7 @@ function SheetGrid({
2498
2599
  }
2499
2600
  );
2500
2601
  };
2501
- return /* @__PURE__ */ jsx13("div", { className: "shg", children: /* @__PURE__ */ jsx13("div", { className: "shg-scroll", children: /* @__PURE__ */ jsxs12("table", { className: "shg-table", children: [
2602
+ return /* @__PURE__ */ jsx13("div", { className: "shg", ref: gridRef, children: /* @__PURE__ */ jsx13("div", { className: "shg-scroll", children: /* @__PURE__ */ jsxs12("table", { className: "shg-table", children: [
2502
2603
  /* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsxs12("tr", { children: [
2503
2604
  /* @__PURE__ */ jsx13("th", { className: "shg-corner", style: numStyle }),
2504
2605
  columns.map((col) => /* @__PURE__ */ jsxs12(
@@ -2542,10 +2643,7 @@ function SheetGrid({
2542
2643
  "tr",
2543
2644
  {
2544
2645
  "data-row-id": row.id,
2545
- style: {
2546
- ...rowHeight(row) ? { height: rowHeight(row) } : null,
2547
- "--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
2548
- },
2646
+ style: rowHeight(row) ? { height: rowHeight(row) } : void 0,
2549
2647
  children: [
2550
2648
  /* @__PURE__ */ jsxs12(
2551
2649
  "td",
@@ -3464,10 +3562,206 @@ function Popover(props) {
3464
3562
  );
3465
3563
  }
3466
3564
 
3565
+ // src/components/CascadeMenu.jsx
3566
+ import React13, { Fragment as Fragment9, useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo3, useRef as useRef10, useState as useState13 } from "react";
3567
+ import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
3568
+ var Tick = () => /* @__PURE__ */ jsx22(Svg, { s: 14, children: /* @__PURE__ */ jsx22("path", { d: "M20 6 9 17l-5-5" }) });
3569
+ var FILTER_PAST = 8;
3570
+ var itemsOf = (groups) => groups.flatMap((g) => g.items);
3571
+ function CascadeMenu(props) {
3572
+ const {
3573
+ open,
3574
+ anchorRef,
3575
+ onClose,
3576
+ label,
3577
+ groups = [],
3578
+ optionsOf,
3579
+ onPick,
3580
+ filter = "auto",
3581
+ filterPlaceholder = "Filter",
3582
+ emptyText = "Nothing matches.",
3583
+ noOptionsText = "Nothing to choose here.",
3584
+ optionsLabel = "Options",
3585
+ backLabel = "Back",
3586
+ width = 520,
3587
+ stackBelow = 560,
3588
+ className,
3589
+ value
3590
+ } = props;
3591
+ const rootRef = useRef10(null);
3592
+ const [q, setQ] = useState13("");
3593
+ const [activeId, setActiveId] = useState13(null);
3594
+ const [stage, setStage] = useState13("items");
3595
+ const [stacked, setStacked] = useState13(false);
3596
+ const visible = useMemo3(() => {
3597
+ const needle = q.trim().toLowerCase();
3598
+ if (!needle) return groups.filter((g) => g.items.length > 0);
3599
+ return groups.map((g) => ({ ...g, items: g.items.filter((it) => String(it.label).toLowerCase().includes(needle)) })).filter((g) => g.items.length > 0);
3600
+ }, [groups, q]);
3601
+ const flat = useMemo3(() => itemsOf(visible), [visible]);
3602
+ const active = flat.find((it) => it.id === activeId) || flat[0] || null;
3603
+ const options = useMemo3(() => active && optionsOf ? optionsOf(active) : [], [active, optionsOf]);
3604
+ const showFilter = filter === true || filter === "auto" && itemsOf(groups).length > FILTER_PAST;
3605
+ useEffect13(() => {
3606
+ if (!open) return void 0;
3607
+ setQ("");
3608
+ setActiveId(value?.item ?? null);
3609
+ setStage("items");
3610
+ const measure = () => setStacked(window.innerWidth < stackBelow);
3611
+ measure();
3612
+ window.addEventListener("resize", measure);
3613
+ const raf = requestAnimationFrame(() => {
3614
+ const first = rootRef.current?.querySelector("input, button:not(:disabled)");
3615
+ first?.focus({ preventScroll: true });
3616
+ });
3617
+ const anchor = anchorRef?.current;
3618
+ return () => {
3619
+ window.removeEventListener("resize", measure);
3620
+ cancelAnimationFrame(raf);
3621
+ anchor?.focus?.({ preventScroll: true });
3622
+ };
3623
+ }, [open, stackBelow]);
3624
+ const focusIn = useCallback7((col, index = 0) => {
3625
+ const list = rootRef.current?.querySelectorAll(`.uic-cascade-${col} .uic-pop-item:not(:disabled)`);
3626
+ if (!list || !list.length) return false;
3627
+ const i = Math.max(0, Math.min(index, list.length - 1));
3628
+ list[i].focus({ preventScroll: true });
3629
+ return true;
3630
+ }, []);
3631
+ const enterOptions = useCallback7(() => {
3632
+ if (stacked) {
3633
+ setStage("options");
3634
+ requestAnimationFrame(() => focusIn("options"));
3635
+ } else focusIn("options");
3636
+ }, [stacked, focusIn]);
3637
+ const onKey2 = (e) => {
3638
+ const el = document.activeElement;
3639
+ const col = el?.closest?.(".uic-cascade-col");
3640
+ const inItems = col?.classList.contains("uic-cascade-items");
3641
+ const inOptions = col?.classList.contains("uic-cascade-options");
3642
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
3643
+ if (!col) return;
3644
+ const list = Array.from(col.querySelectorAll(".uic-pop-item:not(:disabled)"));
3645
+ const i = list.indexOf(el);
3646
+ const next = i < 0 ? 0 : i + (e.key === "ArrowDown" ? 1 : -1);
3647
+ if (next < 0) {
3648
+ col.querySelector("input")?.focus();
3649
+ e.preventDefault();
3650
+ return;
3651
+ }
3652
+ if (next >= list.length) return;
3653
+ e.preventDefault();
3654
+ list[next].focus({ preventScroll: true });
3655
+ } else if (e.key === "ArrowRight" && inItems) {
3656
+ e.preventDefault();
3657
+ enterOptions();
3658
+ } else if (e.key === "ArrowLeft" && inOptions) {
3659
+ e.preventDefault();
3660
+ if (stacked) {
3661
+ setStage("items");
3662
+ requestAnimationFrame(() => focusIn("items", flat.indexOf(active)));
3663
+ } else focusIn("items", flat.indexOf(active));
3664
+ } else if (e.key === "Enter" && el?.tagName === "INPUT") {
3665
+ e.preventDefault();
3666
+ enterOptions();
3667
+ }
3668
+ };
3669
+ const showItems = !stacked || stage === "items";
3670
+ const showOptions = !stacked || stage === "options";
3671
+ return /* @__PURE__ */ jsx22(
3672
+ Popover,
3673
+ {
3674
+ open,
3675
+ anchorRef,
3676
+ onClose,
3677
+ label,
3678
+ width: stacked ? 320 : width,
3679
+ minHeight: 260,
3680
+ className: ["uic-cascade-pop", className || ""].filter(Boolean).join(" "),
3681
+ children: /* @__PURE__ */ jsxs19("div", { ref: rootRef, className: "uic-cascade" + (stacked ? " is-stacked" : ""), onKeyDown: onKey2, children: [
3682
+ showItems && /* @__PURE__ */ jsxs19("div", { className: "uic-cascade-col uic-cascade-items", children: [
3683
+ showFilter ? /* @__PURE__ */ jsx22(SearchField, { className: "uic-cascade-filter", value: q, onChange: setQ, placeholder: filterPlaceholder }) : null,
3684
+ /* @__PURE__ */ jsxs19("div", { className: "uic-pop-list", children: [
3685
+ visible.map((g, gi) => /* @__PURE__ */ jsxs19(Fragment9, { children: [
3686
+ g.label ? /* @__PURE__ */ jsx22("div", { className: "uic-cascade-group", children: g.label }) : null,
3687
+ g.items.map((it) => {
3688
+ const on = active?.id === it.id;
3689
+ return /* @__PURE__ */ jsxs19(
3690
+ "button",
3691
+ {
3692
+ type: "button",
3693
+ className: "uic-pop-item uic-cascade-item" + (on ? " is-active" : ""),
3694
+ "aria-expanded": on,
3695
+ "aria-haspopup": "true",
3696
+ onFocus: () => setActiveId(it.id),
3697
+ onClick: () => {
3698
+ setActiveId(it.id);
3699
+ enterOptions();
3700
+ },
3701
+ children: [
3702
+ it.icon ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: it.icon }) : null,
3703
+ /* @__PURE__ */ jsx22("span", { className: "uic-chip-t", children: it.label }),
3704
+ it.note ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-note", children: it.note }) : null,
3705
+ /* @__PURE__ */ jsx22("span", { className: "uic-cascade-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx22(Chevron, { dir: "right", size: 14 }) })
3706
+ ]
3707
+ },
3708
+ it.id
3709
+ );
3710
+ })
3711
+ ] }, g.label || gi)),
3712
+ flat.length === 0 ? /* @__PURE__ */ jsx22("div", { className: "uic-pop-note", children: emptyText }) : null
3713
+ ] })
3714
+ ] }),
3715
+ showOptions && /* @__PURE__ */ jsxs19("div", { className: "uic-cascade-col uic-cascade-options", role: "group", "aria-label": optionsLabel, children: [
3716
+ /* @__PURE__ */ jsxs19("div", { className: "uic-cascade-head", children: [
3717
+ stacked ? /* @__PURE__ */ jsx22(
3718
+ "button",
3719
+ {
3720
+ type: "button",
3721
+ className: "uic-cascade-back",
3722
+ "aria-label": backLabel,
3723
+ onClick: () => {
3724
+ setStage("items");
3725
+ requestAnimationFrame(() => focusIn("items", flat.indexOf(active)));
3726
+ },
3727
+ children: /* @__PURE__ */ jsx22(Chevron, { dir: "left", size: 14 })
3728
+ }
3729
+ ) : null,
3730
+ active?.icon ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: active.icon }) : null,
3731
+ /* @__PURE__ */ jsx22("span", { className: "uic-chip-t", children: active ? active.label : "" })
3732
+ ] }),
3733
+ /* @__PURE__ */ jsxs19("div", { className: "uic-pop-list", children: [
3734
+ options.map((o) => {
3735
+ const on = !!value && active?.id === value.item && o.id === value.option;
3736
+ return /* @__PURE__ */ jsxs19(
3737
+ "button",
3738
+ {
3739
+ type: "button",
3740
+ className: "uic-pop-item uic-cascade-opt" + (on ? " is-on" : ""),
3741
+ "aria-current": on ? "true" : void 0,
3742
+ disabled: !!o.disabled,
3743
+ onClick: () => onPick?.(active, o),
3744
+ children: [
3745
+ value ? /* @__PURE__ */ jsx22("span", { className: "uic-pop-check", "aria-hidden": "true", children: on ? /* @__PURE__ */ jsx22(Tick, {}) : null }) : null,
3746
+ /* @__PURE__ */ jsx22("span", { className: "uic-chip-t", children: o.label }),
3747
+ o.note ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-note", children: o.note }) : null
3748
+ ]
3749
+ },
3750
+ o.id
3751
+ );
3752
+ }),
3753
+ active && options.length === 0 ? /* @__PURE__ */ jsx22("div", { className: "uic-pop-note", children: noOptionsText }) : null
3754
+ ] })
3755
+ ] })
3756
+ ] })
3757
+ }
3758
+ );
3759
+ }
3760
+
3467
3761
  // src/components/Modal.jsx
3468
- import React13, { useCallback as useCallback7, useEffect as useEffect13, useId as useId3 } from "react";
3762
+ import React14, { useCallback as useCallback8, useEffect as useEffect14, useId as useId3 } from "react";
3469
3763
  import { createPortal as createPortal4 } from "react-dom";
3470
- import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
3764
+ import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
3471
3765
  function Modal(props) {
3472
3766
  const {
3473
3767
  open,
@@ -3482,9 +3776,9 @@ function Modal(props) {
3482
3776
  classNames = {}
3483
3777
  } = props;
3484
3778
  const titleId = useId3();
3485
- const escape = useCallback7(() => onClose?.(), [onClose]);
3779
+ const escape = useCallback8(() => onClose?.(), [onClose]);
3486
3780
  useOverlayEscape(open, escape);
3487
- useEffect13(() => {
3781
+ useEffect14(() => {
3488
3782
  if (!open || typeof document === "undefined") return void 0;
3489
3783
  const prev = document.body.style.overflow;
3490
3784
  document.body.style.overflow = "hidden";
@@ -3497,12 +3791,12 @@ function Modal(props) {
3497
3791
  if (e.target === e.currentTarget) onClose?.();
3498
3792
  };
3499
3793
  return createPortal4(
3500
- /* @__PURE__ */ jsx22(
3794
+ /* @__PURE__ */ jsx23(
3501
3795
  "div",
3502
3796
  {
3503
3797
  className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
3504
3798
  onMouseDown: onBackdrop,
3505
- children: /* @__PURE__ */ jsxs19(
3799
+ children: /* @__PURE__ */ jsxs20(
3506
3800
  "div",
3507
3801
  {
3508
3802
  className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
@@ -3511,15 +3805,15 @@ function Modal(props) {
3511
3805
  "aria-modal": "true",
3512
3806
  "aria-labelledby": labelledBy || (title ? titleId : void 0),
3513
3807
  children: [
3514
- title || actions ? /* @__PURE__ */ jsxs19("div", { className: "uic-modal-h", children: [
3515
- /* @__PURE__ */ jsxs19("div", { className: "uic-modal-title", children: [
3516
- title ? /* @__PURE__ */ jsx22("h3", { id: titleId, children: title }) : null,
3517
- description ? /* @__PURE__ */ jsx22("p", { children: description }) : null
3808
+ title || actions ? /* @__PURE__ */ jsxs20("div", { className: "uic-modal-h", children: [
3809
+ /* @__PURE__ */ jsxs20("div", { className: "uic-modal-title", children: [
3810
+ title ? /* @__PURE__ */ jsx23("h3", { id: titleId, children: title }) : null,
3811
+ description ? /* @__PURE__ */ jsx23("p", { children: description }) : null
3518
3812
  ] }),
3519
3813
  actions,
3520
- /* @__PURE__ */ jsx22("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx22(IcX, { size: 18 }) })
3814
+ /* @__PURE__ */ jsx23("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx23(IcX, { size: 18 }) })
3521
3815
  ] }) : null,
3522
- /* @__PURE__ */ jsx22("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
3816
+ /* @__PURE__ */ jsx23("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
3523
3817
  ]
3524
3818
  }
3525
3819
  )
@@ -3530,15 +3824,15 @@ function Modal(props) {
3530
3824
  }
3531
3825
 
3532
3826
  // src/hooks/useTypewriter.js
3533
- import { useEffect as useEffect14, useRef as useRef10, useState as useState13 } from "react";
3827
+ import { useEffect as useEffect15, useRef as useRef11, useState as useState14 } from "react";
3534
3828
  var CHAR_MS = 26;
3535
3829
  var HOLD_MS = 2600;
3536
3830
  function useTypewriter(phrases, { active = true } = {}) {
3537
3831
  const list = phrases && phrases.length ? phrases : [""];
3538
- const [text, setText] = useState13(list[0]);
3539
- const listRef = useRef10(list);
3832
+ const [text, setText] = useState14(list[0]);
3833
+ const listRef = useRef11(list);
3540
3834
  listRef.current = list;
3541
- useEffect14(() => {
3835
+ useEffect15(() => {
3542
3836
  if (!active) return void 0;
3543
3837
  if (typeof window === "undefined") return void 0;
3544
3838
  if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
@@ -3569,7 +3863,7 @@ function useTypewriter(phrases, { active = true } = {}) {
3569
3863
  }
3570
3864
 
3571
3865
  // src/components/Panel.jsx
3572
- import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
3866
+ import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
3573
3867
  function Panel(props) {
3574
3868
  const {
3575
3869
  title,
@@ -3591,43 +3885,43 @@ function Panel(props) {
3591
3885
  classNames = {},
3592
3886
  children
3593
3887
  } = props;
3594
- const body = loading ? /* @__PURE__ */ jsxs20("div", { className: "uic-panel-load", children: [
3595
- /* @__PURE__ */ jsx23("span", { className: "uic-panel-load-bar" }),
3596
- /* @__PURE__ */ jsx23("span", { className: "uic-panel-load-bar" }),
3597
- /* @__PURE__ */ jsx23("span", { className: "uic-panel-load-bar" }),
3598
- /* @__PURE__ */ jsx23("span", { className: "uic-sr", children: loadingLabel })
3599
- ] }) : error ? /* @__PURE__ */ jsxs20("div", { className: "uic-panel-fail", children: [
3600
- /* @__PURE__ */ jsx23("p", { className: "uic-panel-fail-t", children: errorTitle }),
3601
- /* @__PURE__ */ jsx23("pre", { className: "uic-panel-fail-m", children: error }),
3602
- errorDetail ? /* @__PURE__ */ jsxs20("details", { className: "uic-panel-fail-d", children: [
3603
- /* @__PURE__ */ jsx23("summary", { children: detailLabel }),
3604
- /* @__PURE__ */ jsx23("div", { className: "uic-panel-fail-dd", children: errorDetail })
3888
+ const body = loading ? /* @__PURE__ */ jsxs21("div", { className: "uic-panel-load", children: [
3889
+ /* @__PURE__ */ jsx24("span", { className: "uic-panel-load-bar" }),
3890
+ /* @__PURE__ */ jsx24("span", { className: "uic-panel-load-bar" }),
3891
+ /* @__PURE__ */ jsx24("span", { className: "uic-panel-load-bar" }),
3892
+ /* @__PURE__ */ jsx24("span", { className: "uic-sr", children: loadingLabel })
3893
+ ] }) : error ? /* @__PURE__ */ jsxs21("div", { className: "uic-panel-fail", children: [
3894
+ /* @__PURE__ */ jsx24("p", { className: "uic-panel-fail-t", children: errorTitle }),
3895
+ /* @__PURE__ */ jsx24("pre", { className: "uic-panel-fail-m", children: error }),
3896
+ errorDetail ? /* @__PURE__ */ jsxs21("details", { className: "uic-panel-fail-d", children: [
3897
+ /* @__PURE__ */ jsx24("summary", { children: detailLabel }),
3898
+ /* @__PURE__ */ jsx24("div", { className: "uic-panel-fail-dd", children: errorDetail })
3605
3899
  ] }) : null,
3606
- onRetry ? /* @__PURE__ */ jsx23("div", { className: "uic-panel-fail-act", children: /* @__PURE__ */ jsx23(Button, { size: "sm", onClick: onRetry, children: retryLabel }) }) : null
3900
+ onRetry ? /* @__PURE__ */ jsx24("div", { className: "uic-panel-fail-act", children: /* @__PURE__ */ jsx24(Button, { size: "sm", onClick: onRetry, children: retryLabel }) }) : null
3607
3901
  ] }) : children;
3608
- return /* @__PURE__ */ jsxs20(
3902
+ return /* @__PURE__ */ jsxs21(
3609
3903
  "section",
3610
3904
  {
3611
3905
  className: ["uic-panel", className, classNames.root || ""].filter(Boolean).join(" "),
3612
3906
  "aria-busy": loading || busy || void 0,
3613
3907
  children: [
3614
- /* @__PURE__ */ jsxs20("header", { className: ["uic-panel-head", classNames.head || ""].filter(Boolean).join(" "), children: [
3615
- /* @__PURE__ */ jsxs20("div", { className: "uic-panel-titles", children: [
3616
- title ? /* @__PURE__ */ jsx23(Heading, { className: "uic-panel-title", children: title }) : null,
3617
- meta ? /* @__PURE__ */ jsx23("p", { className: "uic-panel-meta", children: meta }) : null
3908
+ /* @__PURE__ */ jsxs21("header", { className: ["uic-panel-head", classNames.head || ""].filter(Boolean).join(" "), children: [
3909
+ /* @__PURE__ */ jsxs21("div", { className: "uic-panel-titles", children: [
3910
+ title ? /* @__PURE__ */ jsx24(Heading, { className: "uic-panel-title", children: title }) : null,
3911
+ meta ? /* @__PURE__ */ jsx24("p", { className: "uic-panel-meta", children: meta }) : null
3618
3912
  ] }),
3619
- actions ? /* @__PURE__ */ jsx23("div", { className: "uic-panel-acts", children: actions }) : null
3913
+ actions ? /* @__PURE__ */ jsx24("div", { className: "uic-panel-acts", children: actions }) : null
3620
3914
  ] }),
3621
- busy ? /* @__PURE__ */ jsx23("div", { className: "uic-panel-busy", role: "status", "aria-label": busyLabel }) : null,
3622
- /* @__PURE__ */ jsx23("div", { className: ["uic-panel-body", classNames.body || ""].filter(Boolean).join(" "), children: body }),
3623
- footer ? /* @__PURE__ */ jsx23("footer", { className: "uic-panel-foot", children: footer }) : null
3915
+ busy ? /* @__PURE__ */ jsx24("div", { className: "uic-panel-busy", role: "status", "aria-label": busyLabel }) : null,
3916
+ /* @__PURE__ */ jsx24("div", { className: ["uic-panel-body", classNames.body || ""].filter(Boolean).join(" "), children: body }),
3917
+ footer ? /* @__PURE__ */ jsx24("footer", { className: "uic-panel-foot", children: footer }) : null
3624
3918
  ]
3625
3919
  }
3626
3920
  );
3627
3921
  }
3628
3922
 
3629
3923
  // src/grid/PanelGrid.jsx
3630
- import React14, { useCallback as useCallback8, useEffect as useEffect15, useLayoutEffect, useMemo as useMemo3, useRef as useRef11, useState as useState14 } from "react";
3924
+ import React15, { useCallback as useCallback9, useEffect as useEffect16, useLayoutEffect as useLayoutEffect2, useMemo as useMemo4, useRef as useRef12, useState as useState15 } from "react";
3631
3925
 
3632
3926
  // src/grid/layout.js
3633
3927
  function sortLayout(layout2) {
@@ -3700,11 +3994,11 @@ function sameLayout(a, b) {
3700
3994
  }
3701
3995
 
3702
3996
  // src/grid/PanelGrid.jsx
3703
- import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
3997
+ import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
3704
3998
  function useMeasuredWidth() {
3705
- const ref = useRef11(null);
3706
- const [width, setWidth] = useState14(0);
3707
- useLayoutEffect(() => {
3999
+ const ref = useRef12(null);
4000
+ const [width, setWidth] = useState15(0);
4001
+ useLayoutEffect2(() => {
3708
4002
  const el = ref.current;
3709
4003
  if (!el) return void 0;
3710
4004
  const measure = () => setWidth(el.clientWidth);
@@ -3731,9 +4025,9 @@ function PanelGrid(props) {
3731
4025
  className = ""
3732
4026
  } = props;
3733
4027
  const [wrapRef, width] = useMeasuredWidth();
3734
- const [drag, setDrag] = useState14(null);
3735
- const dragRef = useRef11(null);
3736
- const swallowClick = useRef11(false);
4028
+ const [drag, setDrag] = useState15(null);
4029
+ const dragRef = useRef12(null);
4030
+ const swallowClick = useRef12(false);
3737
4031
  const stacked = width > 0 && width < stackAt;
3738
4032
  const arrangeable = editable && !stacked;
3739
4033
  const live = drag ? drag.preview : layout2;
@@ -3741,7 +4035,7 @@ function PanelGrid(props) {
3741
4035
  const cellW = colW + gap;
3742
4036
  const cellH = rowHeight + gap;
3743
4037
  const rowsToPx = (h) => h * rowHeight + (h - 1) * gap;
3744
- const stack2 = useMemo3(() => {
4038
+ const stack2 = useMemo4(() => {
3745
4039
  if (!stacked) return null;
3746
4040
  const tops = /* @__PURE__ */ new Map();
3747
4041
  let y = 0;
@@ -3753,11 +4047,11 @@ function PanelGrid(props) {
3753
4047
  }, [stacked, live, rowHeight, gap]);
3754
4048
  const rows = layoutRows(live);
3755
4049
  const height = stacked ? stack2.height : rows ? rowsToPx(rows) : 0;
3756
- const commit = useCallback8((next) => {
4050
+ const commit = useCallback9((next) => {
3757
4051
  if (onLayoutChange && !sameLayout(next, layout2)) onLayoutChange(next);
3758
4052
  }, [onLayoutChange, layout2]);
3759
- const detach = useRef11(null);
3760
- useEffect15(() => () => detach.current?.(), []);
4053
+ const detach = useRef12(null);
4054
+ useEffect16(() => () => detach.current?.(), []);
3761
4055
  const start = (id, mode) => (e) => {
3762
4056
  if (!arrangeable || e.button !== 0) return;
3763
4057
  const item = layout2.find((it) => it.i === id);
@@ -3822,7 +4116,7 @@ function PanelGrid(props) {
3822
4116
  const byId = new Map(live.map((it) => [it.i, it]));
3823
4117
  const ghost = drag && drag.mode === "move" && byId.has(drag.id) ? boxOf(byId.get(drag.id)) : null;
3824
4118
  const cls = ["uic-pg", arrangeable ? "is-editable" : "", stacked ? "is-stacked" : "", className].filter(Boolean).join(" ");
3825
- return /* @__PURE__ */ jsxs21(
4119
+ return /* @__PURE__ */ jsxs22(
3826
4120
  "div",
3827
4121
  {
3828
4122
  ref: wrapRef,
@@ -3833,15 +4127,15 @@ function PanelGrid(props) {
3833
4127
  swallowClick.current = false;
3834
4128
  },
3835
4129
  children: [
3836
- ghost ? /* @__PURE__ */ jsx24("div", { className: "uic-pg-ghost", "aria-hidden": "true", style: ghost }) : null,
3837
- width > 0 && React14.Children.map(children, (child) => {
3838
- if (!React14.isValidElement(child) || child.key == null) return null;
4130
+ ghost ? /* @__PURE__ */ jsx25("div", { className: "uic-pg-ghost", "aria-hidden": "true", style: ghost }) : null,
4131
+ width > 0 && React15.Children.map(children, (child) => {
4132
+ if (!React15.isValidElement(child) || child.key == null) return null;
3839
4133
  const id = String(child.key).replace(/^\.\$/, "");
3840
4134
  const it = byId.get(id);
3841
4135
  if (!it) return null;
3842
4136
  const moving = drag && drag.id === id;
3843
4137
  const offset = moving && drag.mode === "move" ? { transform: `translate(${drag.dx}px, ${drag.dy}px)` } : null;
3844
- return /* @__PURE__ */ jsxs21(
4138
+ return /* @__PURE__ */ jsxs22(
3845
4139
  "div",
3846
4140
  {
3847
4141
  className: "uic-pg-item" + (moving ? " is-moving" : ""),
@@ -3849,7 +4143,7 @@ function PanelGrid(props) {
3849
4143
  onPointerDown: arrangeable ? start(id, "move") : void 0,
3850
4144
  children: [
3851
4145
  child,
3852
- arrangeable && !it.static ? /* @__PURE__ */ jsx24(
4146
+ arrangeable && !it.static ? /* @__PURE__ */ jsx25(
3853
4147
  "button",
3854
4148
  {
3855
4149
  type: "button",
@@ -3857,7 +4151,7 @@ function PanelGrid(props) {
3857
4151
  "aria-label": resizeLabel ? resizeLabel(id) : "Resize panel. Arrow keys resize it; shift with arrow keys moves it past its neighbours.",
3858
4152
  onPointerDown: start(id, "resize"),
3859
4153
  onKeyDown: onHandleKey(id),
3860
- children: /* @__PURE__ */ jsx24("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ jsx24("path", { d: "M9 1v8H1", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
4154
+ children: /* @__PURE__ */ jsx25("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ jsx25("path", { d: "M9 1v8H1", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
3861
4155
  }
3862
4156
  ) : null
3863
4157
  ]
@@ -3874,8 +4168,8 @@ function packLayout(layout2, cols = 12) {
3874
4168
  }
3875
4169
 
3876
4170
  // src/timeline/Timeline.jsx
3877
- import { useCallback as useCallback9, useEffect as useEffect16, useLayoutEffect as useLayoutEffect2, useMemo as useMemo4, useRef as useRef12, useState as useState15 } from "react";
3878
- import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
4171
+ import { useCallback as useCallback10, useEffect as useEffect17, useLayoutEffect as useLayoutEffect3, useMemo as useMemo5, useRef as useRef13, useState as useState16 } from "react";
4172
+ import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
3879
4173
  var TL_MIN_PPS = 4;
3880
4174
  var TL_MAX_PPS = 400;
3881
4175
  var TL_DEFAULT_PPS = 26;
@@ -3964,21 +4258,21 @@ function Timeline({
3964
4258
  emptyLabel = "Nothing here yet.",
3965
4259
  className = ""
3966
4260
  }) {
3967
- const scroller = useRef12(null);
3968
- const innerRef = useRef12(null);
3969
- const [pps, setPps] = useState15(() => {
4261
+ const scroller = useRef13(null);
4262
+ const innerRef = useRef13(null);
4263
+ const [pps, setPps] = useState16(() => {
3970
4264
  if (zoomStorageKey && typeof window !== "undefined") {
3971
4265
  const n = parseFloat(window.localStorage.getItem(zoomStorageKey) || "");
3972
4266
  if (Number.isFinite(n)) return clamp(n, TL_MIN_PPS, TL_MAX_PPS);
3973
4267
  }
3974
4268
  return TL_DEFAULT_PPS;
3975
4269
  });
3976
- const [snapping, setSnapping] = useState15(() => snapStorageKey && typeof window !== "undefined" ? window.localStorage.getItem(snapStorageKey) !== "0" : true);
3977
- const gesture = useRef12(null);
3978
- const [drag, setDrag] = useState15(null);
3979
- const anchor = useRef12(null);
3980
- const [dropAt, setDropAt] = useState15(null);
3981
- const rows = useMemo4(
4270
+ const [snapping, setSnapping] = useState16(() => snapStorageKey && typeof window !== "undefined" ? window.localStorage.getItem(snapStorageKey) !== "0" : true);
4271
+ const gesture = useRef13(null);
4272
+ const [drag, setDrag] = useState16(null);
4273
+ const anchor = useRef13(null);
4274
+ const [dropAt, setDropAt] = useState16(null);
4275
+ const rows = useMemo5(
3982
4276
  () => tracks.map((t) => ({
3983
4277
  ...t,
3984
4278
  sequential: t.sequential !== false,
@@ -3986,12 +4280,12 @@ function Timeline({
3986
4280
  })),
3987
4281
  [tracks, pps]
3988
4282
  );
3989
- const contentSeconds = useMemo4(() => {
4283
+ const contentSeconds = useMemo5(() => {
3990
4284
  let end = 0;
3991
4285
  for (const t of rows) for (const l of t.laid) end = Math.max(end, l.t0 + l.w / pps);
3992
4286
  return end;
3993
4287
  }, [rows, pps]);
3994
- const snapTimes = useMemo4(() => {
4288
+ const snapTimes = useMemo5(() => {
3995
4289
  const out = [0, currentTime];
3996
4290
  for (const t of rows) for (const l of t.laid) {
3997
4291
  out.push(l.t0);
@@ -3999,7 +4293,7 @@ function Timeline({
3999
4293
  }
4000
4294
  return out;
4001
4295
  }, [rows, pps, currentTime]);
4002
- const setZoom = useCallback9((next, clientX) => {
4296
+ const setZoom = useCallback10((next, clientX) => {
4003
4297
  const v = clamp(next, TL_MIN_PPS, TL_MAX_PPS);
4004
4298
  const el = scroller.current;
4005
4299
  if (el) {
@@ -4015,21 +4309,21 @@ function Timeline({
4015
4309
  }
4016
4310
  }
4017
4311
  }, [pps, zoomStorageKey]);
4018
- const fitPps = useCallback9((seconds) => {
4312
+ const fitPps = useCallback10((seconds) => {
4019
4313
  const el = scroller.current;
4020
4314
  if (!el || !(seconds > 0)) return null;
4021
4315
  const room = el.clientWidth - TL_HEAD_W - 56;
4022
4316
  return room > 0 ? clamp(room / seconds, TL_MIN_PPS, TL_MAX_PPS) : null;
4023
4317
  }, []);
4024
- const fit = useCallback9(() => {
4318
+ const fit = useCallback10(() => {
4025
4319
  const v = fitPps(contentSeconds);
4026
4320
  if (v !== null) {
4027
4321
  setPps(v);
4028
4322
  if (scroller.current) scroller.current.scrollLeft = 0;
4029
4323
  }
4030
4324
  }, [fitPps, contentSeconds]);
4031
- const fitted = useRef12(false);
4032
- useLayoutEffect2(() => {
4325
+ const fitted = useRef13(false);
4326
+ useLayoutEffect3(() => {
4033
4327
  if (fitted.current || !(contentSeconds > 0)) return;
4034
4328
  if (zoomStorageKey && typeof window !== "undefined" && window.localStorage.getItem(zoomStorageKey)) {
4035
4329
  fitted.current = true;
@@ -4041,13 +4335,13 @@ function Timeline({
4041
4335
  setPps(v);
4042
4336
  }
4043
4337
  }, [contentSeconds, fitPps, zoomStorageKey]);
4044
- useLayoutEffect2(() => {
4338
+ useLayoutEffect3(() => {
4045
4339
  const a = anchor.current;
4046
4340
  if (!a || !scroller.current) return;
4047
4341
  anchor.current = null;
4048
4342
  scroller.current.scrollLeft = Math.max(0, TL_HEAD_W + a.t * pps - a.vx);
4049
4343
  }, [pps]);
4050
- useEffect16(() => {
4344
+ useEffect17(() => {
4051
4345
  const el = scroller.current;
4052
4346
  if (!el) return void 0;
4053
4347
  const onWheel = (e) => {
@@ -4058,12 +4352,12 @@ function Timeline({
4058
4352
  el.addEventListener("wheel", onWheel, { passive: false });
4059
4353
  return () => el.removeEventListener("wheel", onWheel);
4060
4354
  }, [pps, setZoom]);
4061
- const timeAt = useCallback9((clientX) => {
4355
+ const timeAt = useCallback10((clientX) => {
4062
4356
  const el = innerRef.current;
4063
4357
  if (!el) return 0;
4064
4358
  return Math.max(0, (clientX - el.getBoundingClientRect().left - TL_HEAD_W) / pps);
4065
4359
  }, [pps]);
4066
- const beginGesture = useCallback9((e, spec) => {
4360
+ const beginGesture = useCallback10((e, spec) => {
4067
4361
  e.preventDefault();
4068
4362
  e.stopPropagation();
4069
4363
  gesture.current = { ...spec, startX: e.clientX, active: false, value: null };
@@ -4097,12 +4391,12 @@ function Timeline({
4097
4391
  window.addEventListener("pointermove", move);
4098
4392
  window.addEventListener("pointerup", up);
4099
4393
  }, [timeAt, snapping, snapTimes, pps, onSeek]);
4100
- const onScrub = useCallback9((e) => {
4394
+ const onScrub = useCallback10((e) => {
4101
4395
  if (!onSeek) return;
4102
4396
  onSeek(timeAt(e.clientX));
4103
4397
  beginGesture(e, { kind: "scrub" });
4104
4398
  }, [onSeek, timeAt, beginGesture]);
4105
- const splitTarget = useMemo4(() => {
4399
+ const splitTarget = useMemo5(() => {
4106
4400
  if (!onSplit) return null;
4107
4401
  for (const track of rows) {
4108
4402
  for (const l of track.laid) {
@@ -4114,17 +4408,17 @@ function Timeline({
4114
4408
  }
4115
4409
  return null;
4116
4410
  }, [rows, currentTime, onSplit]);
4117
- const doSplit = useCallback9(() => {
4411
+ const doSplit = useCallback10(() => {
4118
4412
  if (!splitTarget) return;
4119
4413
  onSplit(splitTarget.l.clip, currentTime - splitTarget.l.t0, splitTarget.track);
4120
4414
  }, [splitTarget, currentTime, onSplit]);
4121
- const selected = useMemo4(() => {
4415
+ const selected = useMemo5(() => {
4122
4416
  for (const track of rows) for (const l of track.laid) {
4123
4417
  if (l.clip.id === selectedClipId) return { track, l };
4124
4418
  }
4125
4419
  return null;
4126
4420
  }, [rows, selectedClipId]);
4127
- const onKeyDown = useCallback9((e) => {
4421
+ const onKeyDown = useCallback10((e) => {
4128
4422
  const tag = e.target?.tagName;
4129
4423
  if (tag === "INPUT" || tag === "TEXTAREA" || e.target?.isContentEditable) return;
4130
4424
  if (e.key === "+" || e.key === "=") {
@@ -4141,7 +4435,7 @@ function Timeline({
4141
4435
  onDeleteClip(selected.l.clip, selected.track);
4142
4436
  }
4143
4437
  }, [pps, setZoom, doSplit, selected, onDeleteClip]);
4144
- const toggleSnap = useCallback9(() => {
4438
+ const toggleSnap = useCallback10(() => {
4145
4439
  setSnapping((v) => {
4146
4440
  const next = !v;
4147
4441
  if (snapStorageKey && typeof window !== "undefined") {
@@ -4158,9 +4452,9 @@ function Timeline({
4158
4452
  const laneW = Math.max(contentSeconds * pps + 140, 320);
4159
4453
  const ticks = [];
4160
4454
  for (let t = 0; t <= contentSeconds + major; t += major) ticks.push(t);
4161
- return /* @__PURE__ */ jsxs22("div", { className: `rui-tl ${className}`, onKeyDown, tabIndex: 0, children: [
4162
- /* @__PURE__ */ jsxs22("div", { className: "rui-tl-bar", children: [
4163
- onSplit && /* @__PURE__ */ jsxs22(
4455
+ return /* @__PURE__ */ jsxs23("div", { className: `rui-tl ${className}`, onKeyDown, tabIndex: 0, children: [
4456
+ /* @__PURE__ */ jsxs23("div", { className: "rui-tl-bar", children: [
4457
+ onSplit && /* @__PURE__ */ jsxs23(
4164
4458
  "button",
4165
4459
  {
4166
4460
  type: "button",
@@ -4169,7 +4463,7 @@ function Timeline({
4169
4463
  disabled: !splitTarget,
4170
4464
  title: splitTarget ? "Split at the playhead (B)" : "Move the playhead inside a clip to split it",
4171
4465
  children: [
4172
- /* @__PURE__ */ jsxs22(
4466
+ /* @__PURE__ */ jsxs23(
4173
4467
  "svg",
4174
4468
  {
4175
4469
  width: "13",
@@ -4181,19 +4475,19 @@ function Timeline({
4181
4475
  strokeLinecap: "round",
4182
4476
  "aria-hidden": "true",
4183
4477
  children: [
4184
- /* @__PURE__ */ jsx25("circle", { cx: "6", cy: "6", r: "3" }),
4185
- /* @__PURE__ */ jsx25("circle", { cx: "6", cy: "18", r: "3" }),
4186
- /* @__PURE__ */ jsx25("line", { x1: "20", y1: "4", x2: "8.12", y2: "15.88" }),
4187
- /* @__PURE__ */ jsx25("line", { x1: "14.47", y1: "14.48", x2: "20", y2: "20" }),
4188
- /* @__PURE__ */ jsx25("line", { x1: "8.12", y1: "8.12", x2: "12", y2: "12" })
4478
+ /* @__PURE__ */ jsx26("circle", { cx: "6", cy: "6", r: "3" }),
4479
+ /* @__PURE__ */ jsx26("circle", { cx: "6", cy: "18", r: "3" }),
4480
+ /* @__PURE__ */ jsx26("line", { x1: "20", y1: "4", x2: "8.12", y2: "15.88" }),
4481
+ /* @__PURE__ */ jsx26("line", { x1: "14.47", y1: "14.48", x2: "20", y2: "20" }),
4482
+ /* @__PURE__ */ jsx26("line", { x1: "8.12", y1: "8.12", x2: "12", y2: "12" })
4189
4483
  ]
4190
4484
  }
4191
4485
  ),
4192
- /* @__PURE__ */ jsx25("span", { children: "Split" })
4486
+ /* @__PURE__ */ jsx26("span", { children: "Split" })
4193
4487
  ]
4194
4488
  }
4195
4489
  ),
4196
- onDeleteClip && /* @__PURE__ */ jsx25(
4490
+ onDeleteClip && /* @__PURE__ */ jsx26(
4197
4491
  "button",
4198
4492
  {
4199
4493
  type: "button",
@@ -4204,7 +4498,7 @@ function Timeline({
4204
4498
  children: "Remove"
4205
4499
  }
4206
4500
  ),
4207
- /* @__PURE__ */ jsx25(
4501
+ /* @__PURE__ */ jsx26(
4208
4502
  "button",
4209
4503
  {
4210
4504
  type: "button",
@@ -4215,9 +4509,9 @@ function Timeline({
4215
4509
  children: "Snap"
4216
4510
  }
4217
4511
  ),
4218
- /* @__PURE__ */ jsx25("span", { className: "rui-tl-time", "aria-label": "Playhead position", children: exactLabel(currentTime) }),
4219
- /* @__PURE__ */ jsx25("span", { className: "rui-tl-spacer" }),
4220
- /* @__PURE__ */ jsx25(
4512
+ /* @__PURE__ */ jsx26("span", { className: "rui-tl-time", "aria-label": "Playhead position", children: exactLabel(currentTime) }),
4513
+ /* @__PURE__ */ jsx26("span", { className: "rui-tl-spacer" }),
4514
+ /* @__PURE__ */ jsx26(
4221
4515
  "button",
4222
4516
  {
4223
4517
  type: "button",
@@ -4229,7 +4523,7 @@ function Timeline({
4229
4523
  children: "\u2212"
4230
4524
  }
4231
4525
  ),
4232
- /* @__PURE__ */ jsx25(
4526
+ /* @__PURE__ */ jsx26(
4233
4527
  "button",
4234
4528
  {
4235
4529
  type: "button",
@@ -4241,7 +4535,7 @@ function Timeline({
4241
4535
  children: "+"
4242
4536
  }
4243
4537
  ),
4244
- /* @__PURE__ */ jsx25(
4538
+ /* @__PURE__ */ jsx26(
4245
4539
  "button",
4246
4540
  {
4247
4541
  type: "button",
@@ -4253,10 +4547,10 @@ function Timeline({
4253
4547
  }
4254
4548
  )
4255
4549
  ] }),
4256
- /* @__PURE__ */ jsx25("div", { className: "rui-tl-scroll", ref: scroller, children: /* @__PURE__ */ jsxs22("div", { className: "rui-tl-inner", ref: innerRef, style: { width: TL_HEAD_W + laneW }, children: [
4257
- /* @__PURE__ */ jsxs22("div", { className: "rui-tl-row rui-tl-rulerrow", children: [
4258
- /* @__PURE__ */ jsx25("div", { className: "rui-tl-head rui-tl-rulerhead", "aria-hidden": "true" }),
4259
- /* @__PURE__ */ jsx25(
4550
+ /* @__PURE__ */ jsx26("div", { className: "rui-tl-scroll", ref: scroller, children: /* @__PURE__ */ jsxs23("div", { className: "rui-tl-inner", ref: innerRef, style: { width: TL_HEAD_W + laneW }, children: [
4551
+ /* @__PURE__ */ jsxs23("div", { className: "rui-tl-row rui-tl-rulerrow", children: [
4552
+ /* @__PURE__ */ jsx26("div", { className: "rui-tl-head rui-tl-rulerhead", "aria-hidden": "true" }),
4553
+ /* @__PURE__ */ jsx26(
4260
4554
  "div",
4261
4555
  {
4262
4556
  className: "rui-tl-ruler",
@@ -4285,17 +4579,17 @@ function Timeline({
4285
4579
  onSeek(currentTime + step);
4286
4580
  }
4287
4581
  } : void 0,
4288
- children: ticks.map((t) => /* @__PURE__ */ jsx25("span", { className: "rui-tl-ticklbl", style: { left: t * pps }, children: tickLabel(t, major) }, t))
4582
+ children: ticks.map((t) => /* @__PURE__ */ jsx26("span", { className: "rui-tl-ticklbl", style: { left: t * pps }, children: tickLabel(t, major) }, t))
4289
4583
  }
4290
4584
  )
4291
4585
  ] }),
4292
- rows.length === 0 && /* @__PURE__ */ jsx25("p", { className: "rui-tl-empty", children: emptyLabel }),
4293
- rows.map((track) => /* @__PURE__ */ jsxs22("div", { className: "rui-tl-row", children: [
4294
- /* @__PURE__ */ jsxs22("div", { className: "rui-tl-head", title: track.label, children: [
4586
+ rows.length === 0 && /* @__PURE__ */ jsx26("p", { className: "rui-tl-empty", children: emptyLabel }),
4587
+ rows.map((track) => /* @__PURE__ */ jsxs23("div", { className: "rui-tl-row", children: [
4588
+ /* @__PURE__ */ jsxs23("div", { className: "rui-tl-head", title: track.title || track.label, children: [
4295
4589
  track.icon,
4296
- /* @__PURE__ */ jsx25("span", { className: "rui-tl-headlbl", children: track.label })
4590
+ /* @__PURE__ */ jsx26("span", { className: "rui-tl-headlbl", children: track.label })
4297
4591
  ] }),
4298
- /* @__PURE__ */ jsxs22(
4592
+ /* @__PURE__ */ jsxs23(
4299
4593
  "div",
4300
4594
  {
4301
4595
  className: "rui-tl-lane" + (dropAt?.trackId === track.id ? " is-dropping" : ""),
@@ -4326,8 +4620,8 @@ function Timeline({
4326
4620
  onDropClip(payload, { trackId: track.id, seconds: t, index });
4327
4621
  } : void 0,
4328
4622
  children: [
4329
- track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ jsx25("p", { className: "rui-tl-laneempty", children: track.emptyLabel }),
4330
- track.laid.map((l) => /* @__PURE__ */ jsx25(
4623
+ track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ jsx26("p", { className: "rui-tl-laneempty", children: track.emptyLabel }),
4624
+ track.laid.map((l) => /* @__PURE__ */ jsx26(
4331
4625
  Clip,
4332
4626
  {
4333
4627
  l,
@@ -4343,7 +4637,7 @@ function Timeline({
4343
4637
  },
4344
4638
  l.clip.id ?? l.i
4345
4639
  )),
4346
- dropAt?.trackId === track.id && /* @__PURE__ */ jsx25(
4640
+ dropAt?.trackId === track.id && /* @__PURE__ */ jsx26(
4347
4641
  "span",
4348
4642
  {
4349
4643
  className: "rui-tl-dropmark",
@@ -4351,7 +4645,7 @@ function Timeline({
4351
4645
  "aria-hidden": "true"
4352
4646
  }
4353
4647
  ),
4354
- laneAppend && /* @__PURE__ */ jsx25(
4648
+ laneAppend && /* @__PURE__ */ jsx26(
4355
4649
  "span",
4356
4650
  {
4357
4651
  className: "rui-tl-append",
@@ -4363,9 +4657,9 @@ function Timeline({
4363
4657
  }
4364
4658
  )
4365
4659
  ] }, track.id)),
4366
- onDropClip && newLaneLabel && /* @__PURE__ */ jsxs22("div", { className: "rui-tl-row", children: [
4367
- /* @__PURE__ */ jsx25("div", { className: "rui-tl-head rui-tl-newhead", "aria-hidden": "true" }),
4368
- /* @__PURE__ */ jsx25(
4660
+ onDropClip && newLaneLabel && /* @__PURE__ */ jsxs23("div", { className: "rui-tl-row", children: [
4661
+ /* @__PURE__ */ jsx26("div", { className: "rui-tl-head rui-tl-newhead", "aria-hidden": "true" }),
4662
+ /* @__PURE__ */ jsx26(
4369
4663
  "div",
4370
4664
  {
4371
4665
  className: "rui-tl-newlane" + (dropAt?.trackId === null ? " is-dropping" : ""),
@@ -4387,11 +4681,11 @@ function Timeline({
4387
4681
  e.preventDefault();
4388
4682
  onDropClip(payload, { trackId: null, seconds: timeAt(e.clientX), index: 0 });
4389
4683
  },
4390
- children: /* @__PURE__ */ jsx25("span", { className: "rui-tl-newlbl", children: newLaneLabel })
4684
+ children: /* @__PURE__ */ jsx26("span", { className: "rui-tl-newlbl", children: newLaneLabel })
4391
4685
  }
4392
4686
  )
4393
4687
  ] }),
4394
- drag?.guide != null && /* @__PURE__ */ jsx25(
4688
+ drag?.guide != null && /* @__PURE__ */ jsx26(
4395
4689
  "div",
4396
4690
  {
4397
4691
  className: "rui-tl-guide",
@@ -4399,16 +4693,16 @@ function Timeline({
4399
4693
  "aria-hidden": "true"
4400
4694
  }
4401
4695
  ),
4402
- Number.isFinite(currentTime) && /* @__PURE__ */ jsx25(
4696
+ Number.isFinite(currentTime) && /* @__PURE__ */ jsx26(
4403
4697
  "div",
4404
4698
  {
4405
4699
  className: "rui-tl-playhead",
4406
4700
  style: { left: TL_HEAD_W + currentTime * pps },
4407
4701
  "aria-hidden": "true",
4408
- children: /* @__PURE__ */ jsx25("span", { className: "rui-tl-playhead-grip" })
4702
+ children: /* @__PURE__ */ jsx26("span", { className: "rui-tl-playhead-grip" })
4409
4703
  }
4410
4704
  ),
4411
- drag?.annotation && /* @__PURE__ */ jsx25("div", { className: "rui-tl-annot", style: { left: TL_HEAD_W + (drag.annotAt || 0) * pps }, children: drag.annotation })
4705
+ drag?.annotation && /* @__PURE__ */ jsx26("div", { className: "rui-tl-annot", style: { left: TL_HEAD_W + (drag.annotAt || 0) * pps }, children: drag.annotation })
4412
4706
  ] }) })
4413
4707
  ] });
4414
4708
  }
@@ -4484,7 +4778,7 @@ function Clip({
4484
4778
  click: onSelect
4485
4779
  });
4486
4780
  };
4487
- return /* @__PURE__ */ jsxs22(
4781
+ return /* @__PURE__ */ jsxs23(
4488
4782
  "article",
4489
4783
  {
4490
4784
  className: "rui-tl-clip" + (clip.state ? ` is-${clip.state}` : "") + (known ? "" : " is-unmeasured") + (selected ? " is-selected" : "") + (live ? " is-live" : ""),
@@ -4499,10 +4793,10 @@ function Clip({
4499
4793
  }
4500
4794
  },
4501
4795
  children: [
4502
- clip.poster ? /* @__PURE__ */ jsx25("span", { className: "rui-tl-strip", style: {
4796
+ clip.poster ? /* @__PURE__ */ jsx26("span", { className: "rui-tl-strip", style: {
4503
4797
  backgroundImage: `url("${String(clip.poster).replace(/"/g, '\\"')}")`,
4504
4798
  backgroundSize: `${tileW}px 100%`
4505
- } }) : clip.video ? /* @__PURE__ */ jsx25(
4799
+ } }) : clip.video ? /* @__PURE__ */ jsx26(
4506
4800
  "video",
4507
4801
  {
4508
4802
  className: "rui-tl-frame",
@@ -4513,12 +4807,12 @@ function Clip({
4513
4807
  tabIndex: -1,
4514
4808
  "aria-hidden": "true"
4515
4809
  }
4516
- ) : /* @__PURE__ */ jsx25("span", { className: "rui-tl-blank", "aria-hidden": "true", children: clip.glyph }),
4517
- clip.badge && /* @__PURE__ */ jsx25("span", { className: "rui-tl-badge", children: clip.badge }),
4518
- known && width > 46 && /* @__PURE__ */ jsx25("span", { className: "rui-tl-dur", children: durationLabel(clip.duration) }),
4519
- clip.label && width > 104 && /* @__PURE__ */ jsx25("span", { className: "rui-tl-name", children: clip.label }),
4520
- onTrim && known && /* @__PURE__ */ jsxs22(Fragment9, { children: [
4521
- /* @__PURE__ */ jsx25(
4810
+ ) : /* @__PURE__ */ jsx26("span", { className: "rui-tl-blank", "aria-hidden": "true", children: clip.glyph }),
4811
+ clip.badge && /* @__PURE__ */ jsx26("span", { className: "rui-tl-badge", children: clip.badge }),
4812
+ known && width > 46 && /* @__PURE__ */ jsx26("span", { className: "rui-tl-dur", children: durationLabel(clip.duration) }),
4813
+ clip.label && width > 104 && /* @__PURE__ */ jsx26("span", { className: "rui-tl-name", children: clip.label }),
4814
+ onTrim && known && /* @__PURE__ */ jsxs23(Fragment10, { children: [
4815
+ /* @__PURE__ */ jsx26(
4522
4816
  "span",
4523
4817
  {
4524
4818
  className: "rui-tl-trim l",
@@ -4527,7 +4821,7 @@ function Clip({
4527
4821
  "aria-label": `Trim the start of ${clip.label || "this clip"}`
4528
4822
  }
4529
4823
  ),
4530
- /* @__PURE__ */ jsx25(
4824
+ /* @__PURE__ */ jsx26(
4531
4825
  "span",
4532
4826
  {
4533
4827
  className: "rui-tl-trim r",
@@ -4547,6 +4841,7 @@ export {
4547
4841
  Button,
4548
4842
  Card,
4549
4843
  Carousel,
4844
+ CascadeMenu,
4550
4845
  ChatMessages,
4551
4846
  ChatMessagesSkeleton,
4552
4847
  ChatPanel,