reifyui 0.5.0 → 0.6.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.
Files changed (44) hide show
  1. package/README.md +40 -3
  2. package/dist/{chunk-2LYV4PIX.js → chunk-NTIWFHR4.js} +26 -2
  3. package/dist/chunk-NTIWFHR4.js.map +1 -0
  4. package/dist/harness.cjs +72 -21
  5. package/dist/harness.cjs.map +1 -1
  6. package/dist/harness.d.ts +23 -0
  7. package/dist/harness.js +52 -23
  8. package/dist/harness.js.map +1 -1
  9. package/dist/index.cjs +1166 -326
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +263 -1
  12. package/dist/index.js +1141 -323
  13. package/dist/index.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/components/Card.jsx +49 -0
  16. package/src/components/Carousel.jsx +73 -0
  17. package/src/components/ChatPanel.jsx +461 -0
  18. package/src/components/Chip.jsx +61 -0
  19. package/src/components/Composer.jsx +20 -1
  20. package/src/components/Dialog.jsx +5 -10
  21. package/src/components/Modal.jsx +75 -0
  22. package/src/components/Popover.jsx +86 -0
  23. package/src/components/SearchField.jsx +30 -0
  24. package/src/components/icons.jsx +9 -0
  25. package/src/components/overlay.js +63 -0
  26. package/src/format.js +10 -0
  27. package/src/harness/attach.js +63 -0
  28. package/src/harness/index.d.ts +23 -0
  29. package/src/harness/index.js +6 -18
  30. package/src/hooks/useTypewriter.js +53 -0
  31. package/src/index.d.ts +263 -1
  32. package/src/index.js +27 -1
  33. package/src/input/dictate.js +60 -0
  34. package/src/sheet/SheetGrid.jsx +5 -1
  35. package/src/state/turns.js +30 -0
  36. package/styles/chat.css +127 -1
  37. package/styles/chip.css +53 -0
  38. package/styles/dialog.css +42 -37
  39. package/styles/library.css +205 -0
  40. package/styles/preview.css +73 -0
  41. package/styles/sheet.css +16 -14
  42. package/styles/themes/dark.css +20 -0
  43. package/styles/themes/light.css +23 -0
  44. package/dist/chunk-2LYV4PIX.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  createResponsesDispatcher,
3
3
  pumpResponsesStream,
4
- readSSEStream
5
- } from "./chunk-2LYV4PIX.js";
4
+ readSSEStream,
5
+ turnsToMessages
6
+ } from "./chunk-NTIWFHR4.js";
6
7
 
7
8
  // src/state/blocks.js
8
9
  function withText(blocks, d) {
@@ -171,6 +172,16 @@ var IcSend = () => /* @__PURE__ */ jsxs(Svg, { s: 16, children: [
171
172
  /* @__PURE__ */ jsx("path", { d: "M12 19V5" }),
172
173
  /* @__PURE__ */ jsx("path", { d: "M5 12l7-7 7 7" })
173
174
  ] });
175
+ var IcX = ({ size = 14 }) => /* @__PURE__ */ jsx(Svg, { s: size, children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
176
+ var IcMic = ({ size = 15 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
177
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "2", width: "6", height: "12", rx: "3" }),
178
+ /* @__PURE__ */ jsx("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v4M8 22h8" })
179
+ ] });
180
+ var IcPaperclip = ({ size = 16 }) => /* @__PURE__ */ jsx(Svg, { s: size, children: /* @__PURE__ */ jsx("path", { d: "M21.4 11.1 12.2 20.3a5.5 5.5 0 0 1-7.8-7.8l9.2-9.2a3.7 3.7 0 0 1 5.2 5.2l-9.2 9.2a1.8 1.8 0 0 1-2.6-2.6l8.5-8.5" }) });
181
+ var IcPanelRight = ({ size = 17 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
182
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
183
+ /* @__PURE__ */ jsx("path", { d: "M15 4v16" })
184
+ ] });
174
185
 
175
186
  // src/components/toolMeta.js
176
187
  function humanize(s) {
@@ -538,6 +549,11 @@ function Composer(props) {
538
549
  rows = 1,
539
550
  autoGrow = true,
540
551
  maxRows = 15,
552
+ autoFocus,
553
+ // The composer on a landing page often has an ANIMATING placeholder (a typewriter cycling
554
+ // through example prompts), and a placeholder is the textarea's only accessible name unless
555
+ // one is given — so the field announces a different name every few seconds.
556
+ inputAriaLabel,
541
557
  attachments,
542
558
  accessoriesLeft,
543
559
  accessoriesRight,
@@ -569,12 +585,13 @@ function Composer(props) {
569
585
  value,
570
586
  disabled,
571
587
  rows,
588
+ autoFocus,
589
+ "aria-label": inputAriaLabel,
572
590
  onChange: (e) => onChange(e.target.value),
573
591
  onKeyDown: (e) => {
574
- if (e.key === "Enter" && !e.shiftKey) {
575
- e.preventDefault();
576
- onSend();
577
- }
592
+ if (e.key !== "Enter" || e.shiftKey) return;
593
+ e.preventDefault();
594
+ if (!sendDisabled) onSend();
578
595
  }
579
596
  }
580
597
  ),
@@ -587,9 +604,462 @@ function Composer(props) {
587
604
  ] });
588
605
  }
589
606
 
590
- // src/components/CodeBlock.jsx
607
+ // src/components/ChatPanel.jsx
608
+ import React6, { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
609
+
610
+ // src/components/Chip.jsx
591
611
  import React5 from "react";
592
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
612
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
613
+ function Chip(props) {
614
+ const { label, icon, title, selected = false, onClick, onRemove, removeLabel, className } = props;
615
+ const cls = [
616
+ "uic-chip",
617
+ selected ? "is-selected" : "",
618
+ onClick && !selected ? "is-open" : "",
619
+ className || ""
620
+ ].filter(Boolean).join(" ");
621
+ const body = /* @__PURE__ */ jsxs5(Fragment2, { children: [
622
+ icon ? /* @__PURE__ */ jsx5("span", { className: "uic-chip-ic", "aria-hidden": "true", children: icon }) : null,
623
+ /* @__PURE__ */ jsx5("span", { className: "uic-chip-l", children: label })
624
+ ] });
625
+ if (onClick && onRemove) {
626
+ return /* @__PURE__ */ jsxs5("span", { className: cls, title, children: [
627
+ /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-press", onClick, children: body }),
628
+ /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx5(IcX, { size: 12 }) })
629
+ ] });
630
+ }
631
+ if (onClick) {
632
+ return /* @__PURE__ */ jsx5("button", { type: "button", className: cls, title, onClick, children: body });
633
+ }
634
+ return /* @__PURE__ */ jsxs5("span", { className: cls, title, children: [
635
+ body,
636
+ onRemove ? /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx5(IcX, { size: 12 }) }) : null
637
+ ] });
638
+ }
639
+
640
+ // src/format.js
641
+ function bytesLabel(n) {
642
+ if (n == null) return "";
643
+ if (n < 1024) return `${n} B`;
644
+ if (n < 1048576) return `${Math.round(n / 1024)} KB`;
645
+ return `${(n / 1048576).toFixed(1)} MB`;
646
+ }
647
+
648
+ // src/components/ChatPanel.jsx
649
+ import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
650
+ var POLL_MS = 3e3;
651
+ var RETRY_MS = 2e4;
652
+ var PIN_PX = 80;
653
+ var PANEL_STATUS_LABELS = {
654
+ failed: "This turn failed. Please try again.",
655
+ cancelled: "Stopped",
656
+ incomplete: "The turn hit its limit. Send a follow up to continue."
657
+ };
658
+ function ChatPanel(props) {
659
+ const {
660
+ sessionId,
661
+ runTurn,
662
+ loadHistory,
663
+ onSessionStarted,
664
+ onChanged,
665
+ seed = "",
666
+ onSeedConsumed,
667
+ externalBusy = false,
668
+ attachments = null,
669
+ dictation = null,
670
+ title = "",
671
+ headerRight = null,
672
+ collapsed = false,
673
+ onToggleCollapse,
674
+ width,
675
+ placeholder = "Message",
676
+ emptyState = null,
677
+ busyState,
678
+ connectingLabel = "connecting",
679
+ connectingNote = "Still connecting. Your message will be sent as soon as it is online.",
680
+ workingLabel = "Working\u2026",
681
+ statusLabels = PANEL_STATUS_LABELS,
682
+ renderMarkdown,
683
+ userExtras,
684
+ toolLabels,
685
+ classNames = {}
686
+ } = props;
687
+ const [messages, setMessages] = useState2([]);
688
+ const [draft, setDraft] = useState2("");
689
+ const [busy, setBusy] = useState2(false);
690
+ const [connecting, setConnecting] = useState2(false);
691
+ const [histLoading, setHistLoading] = useState2(true);
692
+ const [staged, setStaged] = useState2([]);
693
+ const [attachErr, setAttachErr] = useState2("");
694
+ const [listening2, setListening] = useState2(false);
695
+ const pendingRef = useRef2(null);
696
+ const seededRef = useRef2(false);
697
+ const adoptedRef = useRef2(null);
698
+ const bodyRef = useRef2(null);
699
+ const fileRef = useRef2(null);
700
+ const pinnedRef = useRef2(true);
701
+ const prevExternalBusyRef = useRef2(false);
702
+ const prevIdRef = useRef2(sessionId);
703
+ const api = useRef2(null);
704
+ api.current = { runTurn, loadHistory, onSessionStarted, onChanged, onSeedConsumed };
705
+ useEffect3(() => () => dictation?.stop(), [dictation]);
706
+ function updateLastAsst(fn) {
707
+ setMessages((m) => {
708
+ const out = m.slice();
709
+ for (let i = out.length - 1; i >= 0; i -= 1) {
710
+ if (out[i].role === "assistant") {
711
+ out[i] = fn({ ...out[i] });
712
+ break;
713
+ }
714
+ }
715
+ return out;
716
+ });
717
+ }
718
+ function dropRunningAsst() {
719
+ setMessages((m) => m.length && m[m.length - 1].role === "assistant" && m[m.length - 1].status === "running" ? m.slice(0, -1) : m);
720
+ }
721
+ const onBodyScroll = () => {
722
+ const el = bodyRef.current;
723
+ if (el) pinnedRef.current = el.scrollHeight - el.scrollTop - el.clientHeight <= PIN_PX;
724
+ };
725
+ useEffect3(() => {
726
+ const el = bodyRef.current;
727
+ if (el && pinnedRef.current) el.scrollTo({ top: el.scrollHeight });
728
+ }, [messages, connecting, histLoading]);
729
+ const deliver = useCallback(async (text, files = []) => {
730
+ setBusy(true);
731
+ setMessages((m) => [...m, { role: "assistant", blocks: [], status: "running" }]);
732
+ try {
733
+ const out = await api.current.runTurn({
734
+ sessionId,
735
+ text,
736
+ attachments: files,
737
+ handlers: {
738
+ onSession: (sid) => {
739
+ if (sid && sid !== sessionId) adoptedRef.current = sid;
740
+ api.current.onSessionStarted?.(sid);
741
+ },
742
+ onReasoningDelta: (d) => updateLastAsst((a) => ({ ...a, blocks: withReasoning(a.blocks, d) })),
743
+ onToolCall: (name, args, callId) => updateLastAsst((a) => ({ ...a, blocks: withStep(a.blocks, { name, args, callId }) })),
744
+ onToolResult: (callId, output) => updateLastAsst((a) => ({ ...a, blocks: withResult(a.blocks, callId, output) })),
745
+ onTextDelta: (d) => updateLastAsst((a) => ({ ...a, blocks: withText(a.blocks, d) })),
746
+ onDone: (status) => updateLastAsst((a) => ({ ...a, status: status === "completed" ? "done" : status })),
747
+ onError: () => updateLastAsst((a) => ({
748
+ ...a,
749
+ blocks: a.blocks.length ? a.blocks : withText([], "Something went wrong. Please try again."),
750
+ status: "failed"
751
+ }))
752
+ }
753
+ }) || {};
754
+ if (out.connecting) {
755
+ dropRunningAsst();
756
+ pendingRef.current = { text, files };
757
+ setConnecting(true);
758
+ return;
759
+ }
760
+ pendingRef.current = null;
761
+ setConnecting(false);
762
+ updateLastAsst((a) => a.status === "running" ? { ...a, status: "done" } : a);
763
+ api.current.onChanged?.();
764
+ } catch {
765
+ dropRunningAsst();
766
+ pendingRef.current = { text, files };
767
+ setConnecting(true);
768
+ } finally {
769
+ setBusy(false);
770
+ }
771
+ }, [sessionId]);
772
+ const preparing = staged.some((f) => f.pending);
773
+ const sendBlocked = busy || histLoading || preparing;
774
+ function send() {
775
+ const t = draft.trim();
776
+ if (!t || sendBlocked) return;
777
+ if (listening2) {
778
+ dictation?.stop();
779
+ setListening(false);
780
+ }
781
+ const files = staged;
782
+ setMessages((m) => [...m, { role: "user", text: t, files: files.map((f) => f.name) }]);
783
+ setDraft("");
784
+ setStaged([]);
785
+ setAttachErr("");
786
+ deliver(t, files);
787
+ }
788
+ useEffect3(() => {
789
+ const adopted = adoptedRef.current;
790
+ adoptedRef.current = null;
791
+ if (adopted && adopted === sessionId) {
792
+ prevIdRef.current = sessionId;
793
+ return void 0;
794
+ }
795
+ if (prevIdRef.current !== sessionId) {
796
+ prevIdRef.current = sessionId;
797
+ setMessages([]);
798
+ setHistLoading(true);
799
+ setStaged([]);
800
+ setAttachErr("");
801
+ seededRef.current = false;
802
+ }
803
+ if (seed) api.current.onSeedConsumed?.();
804
+ let dead = false;
805
+ Promise.resolve(api.current.loadHistory(sessionId)).then((hist) => {
806
+ if (dead) return;
807
+ if (hist?.length) setMessages(hist);
808
+ setHistLoading(false);
809
+ if (seed && !seededRef.current && !hist?.length) {
810
+ seededRef.current = true;
811
+ setMessages([{ role: "user", text: seed }]);
812
+ deliver(seed);
813
+ }
814
+ }).catch(() => {
815
+ if (!dead) setHistLoading(false);
816
+ });
817
+ return () => {
818
+ dead = true;
819
+ };
820
+ }, [sessionId]);
821
+ useEffect3(() => {
822
+ if (!connecting) return void 0;
823
+ const iv = window.setInterval(() => {
824
+ const p = pendingRef.current;
825
+ if (p && !busy) deliver(p.text, p.files);
826
+ }, RETRY_MS);
827
+ return () => window.clearInterval(iv);
828
+ }, [connecting, busy, deliver]);
829
+ useEffect3(() => {
830
+ let dead = false;
831
+ let poll;
832
+ const reload = () => Promise.resolve(api.current.loadHistory(sessionId)).then((hist) => {
833
+ if (!dead && hist?.length && !busy && !pendingRef.current) setMessages(hist);
834
+ }).catch(() => {
835
+ });
836
+ if (externalBusy && messages.length === 0 && !busy) poll = window.setInterval(reload, POLL_MS);
837
+ if (prevExternalBusyRef.current && !externalBusy) {
838
+ reload();
839
+ api.current.onChanged?.();
840
+ }
841
+ prevExternalBusyRef.current = externalBusy;
842
+ return () => {
843
+ dead = true;
844
+ if (poll) window.clearInterval(poll);
845
+ };
846
+ }, [externalBusy, messages.length, busy, sessionId]);
847
+ function pick(list) {
848
+ if (!attachments?.prepare) return;
849
+ setAttachErr("");
850
+ for (const file of list) {
851
+ const entry = { name: file.name, size: file.size, pending: true };
852
+ setStaged((cur) => [...cur, entry]);
853
+ Promise.resolve(attachments.prepare(file)).then((ready) => {
854
+ setStaged((cur) => cur.map((s) => s === entry ? { name: entry.name, size: entry.size, ...ready } : s));
855
+ }).catch((e) => {
856
+ setStaged((cur) => cur.filter((s) => s !== entry));
857
+ setAttachErr(e?.message || `${file.name} could not be attached.`);
858
+ });
859
+ }
860
+ }
861
+ function toggleDictation() {
862
+ if (!dictation) return;
863
+ if (listening2) {
864
+ dictation.stop();
865
+ setListening(false);
866
+ return;
867
+ }
868
+ setListening(true);
869
+ dictation.start({
870
+ onText: (text) => setDraft((cur) => cur ? `${cur.replace(/\s+$/, "")} ${text}` : text),
871
+ onEnd: () => setListening(false),
872
+ onError: () => setListening(false)
873
+ });
874
+ }
875
+ const rootCls = ["uic-chat", collapsed ? "is-collapsed" : "", classNames.root || ""].filter(Boolean).join(" ");
876
+ const toggle = onToggleCollapse ? /* @__PURE__ */ jsx6(
877
+ "button",
878
+ {
879
+ type: "button",
880
+ className: "uic-panel-toggle",
881
+ onClick: onToggleCollapse,
882
+ title: collapsed ? "Show the conversation" : "Hide the conversation",
883
+ "aria-label": collapsed ? "Show the conversation" : "Hide the conversation",
884
+ "aria-expanded": !collapsed,
885
+ children: /* @__PURE__ */ jsx6(IcPanelRight, {})
886
+ }
887
+ ) : null;
888
+ if (collapsed) {
889
+ return /* @__PURE__ */ jsx6("aside", { className: rootCls, children: /* @__PURE__ */ jsx6("div", { className: "uic-chat-h", children: toggle }) });
890
+ }
891
+ const empty = messages.length === 0;
892
+ const attachControl = attachments ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
893
+ /* @__PURE__ */ jsx6(
894
+ "input",
895
+ {
896
+ ref: fileRef,
897
+ type: "file",
898
+ hidden: true,
899
+ accept: attachments.accept,
900
+ multiple: attachments.multiple !== false,
901
+ onChange: (e) => {
902
+ pick([...e.target.files]);
903
+ e.target.value = "";
904
+ }
905
+ }
906
+ ),
907
+ /* @__PURE__ */ jsx6(
908
+ "button",
909
+ {
910
+ type: "button",
911
+ className: "uic-chat-icon",
912
+ "aria-label": "Attach a file",
913
+ disabled: busy,
914
+ onClick: () => fileRef.current?.click(),
915
+ children: /* @__PURE__ */ jsx6(IcPaperclip, {})
916
+ }
917
+ )
918
+ ] }) : null;
919
+ const micControl = dictation ? /* @__PURE__ */ jsx6(
920
+ "button",
921
+ {
922
+ type: "button",
923
+ className: "uic-chat-icon" + (listening2 ? " is-on" : ""),
924
+ "aria-label": listening2 ? "Stop dictating" : "Dictate",
925
+ "aria-pressed": listening2,
926
+ disabled: busy,
927
+ onClick: toggleDictation,
928
+ children: /* @__PURE__ */ jsx6(IcMic, {})
929
+ }
930
+ ) : null;
931
+ const defaultBusyState = /* @__PURE__ */ jsxs6("div", { className: "uic-chat-empty", children: [
932
+ /* @__PURE__ */ jsx6("span", { className: "uic-chat-pulse", "aria-hidden": "true" }),
933
+ /* @__PURE__ */ jsx6("div", { className: "uic-chat-empty-t", children: workingLabel })
934
+ ] });
935
+ return /* @__PURE__ */ jsxs6("aside", { className: rootCls, style: width ? { flex: `0 0 ${width}px` } : void 0, children: [
936
+ /* @__PURE__ */ jsxs6("div", { className: "uic-chat-h", children: [
937
+ toggle,
938
+ title ? /* @__PURE__ */ jsx6("span", { className: "uic-chat-title", title, children: title }) : null,
939
+ headerRight,
940
+ connecting ? /* @__PURE__ */ jsx6("span", { className: "uic-chat-conn", children: connectingLabel }) : null
941
+ ] }),
942
+ /* @__PURE__ */ jsxs6("div", { className: "uic-chat-body", ref: bodyRef, onScroll: onBodyScroll, role: "log", "aria-live": "polite", children: [
943
+ histLoading ? /* @__PURE__ */ jsx6(ChatMessagesSkeleton, {}) : empty && externalBusy ? busyState === void 0 ? defaultBusyState : busyState : empty ? emptyState : /* @__PURE__ */ jsx6(
944
+ ChatMessages,
945
+ {
946
+ messages,
947
+ renderMarkdown,
948
+ userExtras: (m, i) => {
949
+ const own = userExtras?.(m, i);
950
+ if (own !== void 0) return own;
951
+ if (!m.files?.length) return void 0;
952
+ return /* @__PURE__ */ jsx6("span", { className: "uic-chat-msg-files", children: m.files.map((n) => /* @__PURE__ */ jsx6(Chip, { icon: /* @__PURE__ */ jsx6(IcPaperclip, { size: 11 }), label: n, title: n }, n)) });
953
+ },
954
+ workingLabel,
955
+ toolLabels: { workingLabel, ...toolLabels || {} },
956
+ statusLabels
957
+ }
958
+ ),
959
+ connecting ? /* @__PURE__ */ jsxs6("div", { className: "uic-chat-note", role: "status", children: [
960
+ /* @__PURE__ */ jsx6("span", { className: "uic-chat-dot", "aria-hidden": "true" }),
961
+ connectingNote
962
+ ] }) : null
963
+ ] }),
964
+ /* @__PURE__ */ jsx6(
965
+ Composer,
966
+ {
967
+ value: draft,
968
+ onChange: setDraft,
969
+ onSend: send,
970
+ disabled: histLoading,
971
+ sendDisabled: sendBlocked || !draft.trim(),
972
+ placeholder,
973
+ rows: 2,
974
+ autoGrow: false,
975
+ classNames: { root: "uic-chat-cmp", input: "uic-chat-cmp-input", row: "uic-chat-cmp-row" },
976
+ attachments: staged.length > 0 || attachErr ? /* @__PURE__ */ jsxs6("div", { className: "uic-chat-files", children: [
977
+ staged.map((f, i) => /* @__PURE__ */ jsx6(
978
+ Chip,
979
+ {
980
+ icon: /* @__PURE__ */ jsx6(IcPaperclip, { size: 11 }),
981
+ title: f.name,
982
+ label: /* @__PURE__ */ jsxs6(Fragment3, { children: [
983
+ /* @__PURE__ */ jsx6("span", { className: "uic-chip-t", children: f.name }),
984
+ /* @__PURE__ */ jsx6("span", { className: "uic-chip-meta", children: f.pending ? "\u2026" : bytesLabel(f.size) })
985
+ ] }),
986
+ onRemove: () => setStaged((c) => c.filter((_, j) => j !== i)),
987
+ removeLabel: `Remove ${f.name}`
988
+ },
989
+ `${f.name}-${i}`
990
+ )),
991
+ attachErr ? /* @__PURE__ */ jsx6("span", { className: "uic-chat-file-err", children: attachErr }) : null
992
+ ] }) : null,
993
+ accessoriesLeft: attachControl,
994
+ accessoriesRight: micControl,
995
+ renderSend: () => /* @__PURE__ */ jsx6(
996
+ "button",
997
+ {
998
+ type: "button",
999
+ className: "uic-chat-send",
1000
+ onClick: send,
1001
+ disabled: sendBlocked || !draft.trim(),
1002
+ "aria-label": "Send message",
1003
+ children: /* @__PURE__ */ jsx6(IcSend, {})
1004
+ }
1005
+ )
1006
+ }
1007
+ )
1008
+ ] });
1009
+ }
1010
+
1011
+ // src/input/dictate.js
1012
+ var Impl = typeof window !== "undefined" ? window.SpeechRecognition || window.webkitSpeechRecognition : null;
1013
+ function createDictation({ lang } = {}) {
1014
+ if (!Impl) return null;
1015
+ let rec = null;
1016
+ return {
1017
+ /** onText fires once per finished phrase, so the draft grows as you speak rather than being
1018
+ * rewritten from scratch on every interim guess. */
1019
+ start({ onText, onEnd, onError }) {
1020
+ this.stop();
1021
+ rec = new Impl();
1022
+ rec.lang = lang || navigator.language || "en-US";
1023
+ rec.continuous = true;
1024
+ rec.interimResults = false;
1025
+ rec.onresult = (e) => {
1026
+ for (let i = e.resultIndex; i < e.results.length; i += 1) {
1027
+ if (!e.results[i].isFinal) continue;
1028
+ const text = String(e.results[i][0]?.transcript || "").trim();
1029
+ if (text) onText?.(text);
1030
+ }
1031
+ };
1032
+ rec.onerror = (e) => {
1033
+ rec = null;
1034
+ if (e.error === "no-speech" || e.error === "aborted") onEnd?.();
1035
+ else onError?.(e.error || "Dictation stopped.");
1036
+ };
1037
+ rec.onend = () => {
1038
+ rec = null;
1039
+ onEnd?.();
1040
+ };
1041
+ try {
1042
+ rec.start();
1043
+ } catch (e) {
1044
+ rec = null;
1045
+ onError?.(e?.message || "Dictation could not start.");
1046
+ }
1047
+ },
1048
+ stop() {
1049
+ if (!rec) return;
1050
+ const r = rec;
1051
+ rec = null;
1052
+ try {
1053
+ r.stop();
1054
+ } catch {
1055
+ }
1056
+ }
1057
+ };
1058
+ }
1059
+
1060
+ // src/components/CodeBlock.jsx
1061
+ import React7 from "react";
1062
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
593
1063
  var _hljsPromise = null;
594
1064
  function loadHljs() {
595
1065
  if (!_hljsPromise) {
@@ -660,8 +1130,8 @@ function CodeBlock(props) {
660
1130
  const { code, language, className } = props;
661
1131
  const src = String(code || "");
662
1132
  const lang = canonicalLang(language);
663
- const [hl, setHl] = React5.useState(null);
664
- React5.useEffect(() => {
1133
+ const [hl, setHl] = React7.useState(null);
1134
+ React7.useEffect(() => {
665
1135
  if (!lang || !src) return void 0;
666
1136
  let cancelled = false;
667
1137
  const timer = setTimeout(() => {
@@ -681,15 +1151,15 @@ function CodeBlock(props) {
681
1151
  }, [src, lang]);
682
1152
  const html = hl && hl.src === src ? hl.html : null;
683
1153
  const label = String(language || "").toLowerCase();
684
- return /* @__PURE__ */ jsxs5("pre", { className: "wbx-code" + (className ? " " + className : ""), children: [
685
- label ? /* @__PURE__ */ jsx5("span", { className: "wbx-code-lang", "aria-hidden": "true", children: label }) : null,
686
- html != null ? /* @__PURE__ */ jsx5("code", { className: "hljs language-" + label, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx5("code", { className: label ? "language-" + label : void 0, children: src })
1154
+ return /* @__PURE__ */ jsxs7("pre", { className: "wbx-code" + (className ? " " + className : ""), children: [
1155
+ label ? /* @__PURE__ */ jsx7("span", { className: "wbx-code-lang", "aria-hidden": "true", children: label }) : null,
1156
+ html != null ? /* @__PURE__ */ jsx7("code", { className: "hljs language-" + label, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx7("code", { className: label ? "language-" + label : void 0, children: src })
687
1157
  ] });
688
1158
  }
689
1159
 
690
1160
  // src/components/resizable.jsx
691
- import React6, { useCallback, useRef as useRef2, useState as useState2 } from "react";
692
- import { jsx as jsx6 } from "react/jsx-runtime";
1161
+ import React8, { useCallback as useCallback2, useRef as useRef3, useState as useState3 } from "react";
1162
+ import { jsx as jsx8 } from "react/jsx-runtime";
693
1163
  function useResizablePane(opts = {}) {
694
1164
  const {
695
1165
  initial = 380,
@@ -703,12 +1173,12 @@ function useResizablePane(opts = {}) {
703
1173
  storageKey = null
704
1174
  // persist the chosen width per user (localStorage)
705
1175
  } = opts;
706
- const clamp = useCallback((x) => {
1176
+ const clamp = useCallback2((x) => {
707
1177
  let hi = max ?? Infinity;
708
1178
  if (maxFraction && typeof window !== "undefined") hi = Math.min(hi, Math.round(window.innerWidth * maxFraction));
709
1179
  return Math.min(hi, Math.max(min, x));
710
1180
  }, [min, max, maxFraction]);
711
- const [width, setWidth] = useState2(() => {
1181
+ const [width, setWidth] = useState3(() => {
712
1182
  if (storageKey && typeof window !== "undefined") {
713
1183
  try {
714
1184
  const n = parseInt(window.localStorage.getItem(storageKey) || "", 10);
@@ -718,16 +1188,16 @@ function useResizablePane(opts = {}) {
718
1188
  }
719
1189
  return initial;
720
1190
  });
721
- const widthRef = useRef2(width);
1191
+ const widthRef = useRef3(width);
722
1192
  widthRef.current = width;
723
- const persist = useCallback((w) => {
1193
+ const persist = useCallback2((w) => {
724
1194
  if (!storageKey) return;
725
1195
  try {
726
1196
  window.localStorage.setItem(storageKey, String(w));
727
1197
  } catch {
728
1198
  }
729
1199
  }, [storageKey]);
730
- const onMouseDown = useCallback((e) => {
1200
+ const onMouseDown = useCallback2((e) => {
731
1201
  e.preventDefault();
732
1202
  const sx = e.clientX, base = widthRef.current, dir = fromRight ? -1 : 1;
733
1203
  document.body.classList.add("uic-resizing");
@@ -743,7 +1213,7 @@ function useResizablePane(opts = {}) {
743
1213
  window.addEventListener("mouseup", up);
744
1214
  document.body.style.cursor = "col-resize";
745
1215
  }, [clamp, fromRight, persist]);
746
- const reset = useCallback(() => {
1216
+ const reset = useCallback2(() => {
747
1217
  setWidth(initial);
748
1218
  if (storageKey) {
749
1219
  try {
@@ -756,7 +1226,7 @@ function useResizablePane(opts = {}) {
756
1226
  }
757
1227
  function PaneResizer(props) {
758
1228
  const { pane, className, title = "Drag to resize (double-click to reset)" } = props;
759
- return /* @__PURE__ */ jsx6(
1229
+ return /* @__PURE__ */ jsx8(
760
1230
  "div",
761
1231
  {
762
1232
  className: className ?? "uic-vresize",
@@ -770,8 +1240,8 @@ function PaneResizer(props) {
770
1240
  }
771
1241
 
772
1242
  // src/components/TaskList.jsx
773
- import { useCallback as useCallback2, useEffect as useEffect3, useMemo, useRef as useRef3, useState as useState3 } from "react";
774
- import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1243
+ import { useCallback as useCallback3, useEffect as useEffect4, useMemo, useRef as useRef4, useState as useState4 } from "react";
1244
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
775
1245
  var STATUS_GROUPS = {
776
1246
  all: () => true,
777
1247
  working: (s) => ["running", "starting", "queued", "in_progress"].includes(s),
@@ -809,17 +1279,17 @@ function TaskList({
809
1279
  statusKey = "status",
810
1280
  timeKey = "updated_at"
811
1281
  }) {
812
- const [head, setHead] = useState3(null);
813
- const [tail, setTail] = useState3([]);
814
- const [cursor, setCursor] = useState3("");
815
- const [loadingMore, setLoadingMore] = useState3(false);
816
- const [q, setQ] = useState3("");
817
- const [statusFilter, setStatusFilter] = useState3("all");
818
- const alive = useRef3(true);
819
- useEffect3(() => () => {
1282
+ const [head, setHead] = useState4(null);
1283
+ const [tail, setTail] = useState4([]);
1284
+ const [cursor, setCursor] = useState4("");
1285
+ const [loadingMore, setLoadingMore] = useState4(false);
1286
+ const [q, setQ] = useState4("");
1287
+ const [statusFilter, setStatusFilter] = useState4("all");
1288
+ const alive = useRef4(true);
1289
+ useEffect4(() => () => {
820
1290
  alive.current = false;
821
1291
  }, []);
822
- useEffect3(() => {
1292
+ useEffect4(() => {
823
1293
  let ok = true;
824
1294
  Promise.resolve(fetchPage("")).then((r) => {
825
1295
  if (!ok) return;
@@ -832,7 +1302,7 @@ function TaskList({
832
1302
  ok = false;
833
1303
  };
834
1304
  }, [fetchPage, refreshNonce]);
835
- const loadMore = useCallback2(() => {
1305
+ const loadMore = useCallback3(() => {
836
1306
  if (!cursor || loadingMore) return;
837
1307
  setLoadingMore(true);
838
1308
  Promise.resolve(fetchPage(cursor)).then((r) => {
@@ -862,14 +1332,14 @@ function TaskList({
862
1332
  const el = e.currentTarget;
863
1333
  if (el.scrollTop + el.clientHeight > el.scrollHeight - 140) loadMore();
864
1334
  };
865
- return /* @__PURE__ */ jsxs6("div", { className: "rui-tasks", children: [
866
- header ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-header", children: header }) : null,
867
- onNew ? /* @__PURE__ */ jsxs6("button", { type: "button", className: "rui-tasks-new", onClick: onNew, children: [
1335
+ return /* @__PURE__ */ jsxs8("div", { className: "rui-tasks", children: [
1336
+ header ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-header", children: header }) : null,
1337
+ onNew ? /* @__PURE__ */ jsxs8("button", { type: "button", className: "rui-tasks-new", onClick: onNew, children: [
868
1338
  "+ ",
869
1339
  newLabel
870
1340
  ] }) : null,
871
- /* @__PURE__ */ jsxs6("div", { className: "rui-tasks-filters", children: [
872
- /* @__PURE__ */ jsx7(
1341
+ /* @__PURE__ */ jsxs8("div", { className: "rui-tasks-filters", children: [
1342
+ /* @__PURE__ */ jsx9(
873
1343
  "input",
874
1344
  {
875
1345
  className: "rui-tasks-search",
@@ -879,7 +1349,7 @@ function TaskList({
879
1349
  "aria-label": "Filter tasks"
880
1350
  }
881
1351
  ),
882
- /* @__PURE__ */ jsxs6(
1352
+ /* @__PURE__ */ jsxs8(
883
1353
  "select",
884
1354
  {
885
1355
  className: "rui-tasks-status",
@@ -887,19 +1357,19 @@ function TaskList({
887
1357
  onChange: (e) => setStatusFilter(e.target.value),
888
1358
  "aria-label": "Filter by status",
889
1359
  children: [
890
- /* @__PURE__ */ jsx7("option", { value: "all", children: "All" }),
891
- /* @__PURE__ */ jsx7("option", { value: "working", children: "Working" }),
892
- /* @__PURE__ */ jsx7("option", { value: "done", children: "Done" }),
893
- /* @__PURE__ */ jsx7("option", { value: "failed", children: "Failed" })
1360
+ /* @__PURE__ */ jsx9("option", { value: "all", children: "All" }),
1361
+ /* @__PURE__ */ jsx9("option", { value: "working", children: "Working" }),
1362
+ /* @__PURE__ */ jsx9("option", { value: "done", children: "Done" }),
1363
+ /* @__PURE__ */ jsx9("option", { value: "failed", children: "Failed" })
894
1364
  ]
895
1365
  }
896
1366
  )
897
1367
  ] }),
898
- /* @__PURE__ */ jsxs6("div", { className: "rui-tasks-list", onScroll, children: [
899
- head === null ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: "Loading\u2026" }) : shown.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: items.length ? "No matching tasks" : emptyLabel }) : shown.map((it) => {
1368
+ /* @__PURE__ */ jsxs8("div", { className: "rui-tasks-list", onScroll, children: [
1369
+ head === null ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-empty", children: "Loading\u2026" }) : shown.length === 0 ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-empty", children: items.length ? "No matching tasks" : emptyLabel }) : shown.map((it) => {
900
1370
  const id = it?.[idKey];
901
1371
  const group = taskStatusGroup(it?.[statusKey]);
902
- return /* @__PURE__ */ jsxs6(
1372
+ return /* @__PURE__ */ jsxs8(
903
1373
  "div",
904
1374
  {
905
1375
  className: `rui-task${id === selected ? " is-selected" : ""}`,
@@ -910,15 +1380,15 @@ function TaskList({
910
1380
  if (e.key === "Enter" || e.key === " ") onSelect?.(id);
911
1381
  },
912
1382
  children: [
913
- /* @__PURE__ */ jsxs6("div", { className: "rui-task-main", children: [
914
- /* @__PURE__ */ jsx7("div", { className: "rui-task-title", children: it?.[titleKey] || "Untitled task" }),
915
- /* @__PURE__ */ jsx7("div", { className: "rui-task-meta", children: renderMeta ? renderMeta(it) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
916
- /* @__PURE__ */ jsx7("span", { className: `rui-task-dot is-${group}` }),
917
- /* @__PURE__ */ jsx7("span", { className: "rui-task-status", children: it?.[statusKey] || "" }),
918
- it?.[timeKey] ? /* @__PURE__ */ jsx7("span", { className: "rui-task-time", children: relTime(it[timeKey]) }) : null
1383
+ /* @__PURE__ */ jsxs8("div", { className: "rui-task-main", children: [
1384
+ /* @__PURE__ */ jsx9("div", { className: "rui-task-title", children: it?.[titleKey] || "Untitled task" }),
1385
+ /* @__PURE__ */ jsx9("div", { className: "rui-task-meta", children: renderMeta ? renderMeta(it) : /* @__PURE__ */ jsxs8(Fragment4, { children: [
1386
+ /* @__PURE__ */ jsx9("span", { className: `rui-task-dot is-${group}` }),
1387
+ /* @__PURE__ */ jsx9("span", { className: "rui-task-status", children: it?.[statusKey] || "" }),
1388
+ it?.[timeKey] ? /* @__PURE__ */ jsx9("span", { className: "rui-task-time", children: relTime(it[timeKey]) }) : null
919
1389
  ] }) })
920
1390
  ] }),
921
- onDelete ? /* @__PURE__ */ jsx7(
1391
+ onDelete ? /* @__PURE__ */ jsx9(
922
1392
  "button",
923
1393
  {
924
1394
  type: "button",
@@ -936,7 +1406,7 @@ function TaskList({
936
1406
  id
937
1407
  );
938
1408
  }),
939
- loadingMore ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: "Loading more\u2026" }) : null
1409
+ loadingMore ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-empty", children: "Loading more\u2026" }) : null
940
1410
  ] })
941
1411
  ] });
942
1412
  }
@@ -944,16 +1414,55 @@ function TaskList({
944
1414
  // src/components/Dialog.jsx
945
1415
  import {
946
1416
  createContext,
947
- useCallback as useCallback3,
1417
+ useCallback as useCallback4,
948
1418
  useContext,
949
- useEffect as useEffect4,
1419
+ useEffect as useEffect6,
950
1420
  useId,
951
1421
  useMemo as useMemo2,
952
- useRef as useRef4,
953
- useState as useState4
1422
+ useRef as useRef5,
1423
+ useState as useState5
954
1424
  } from "react";
955
1425
  import { createPortal } from "react-dom";
956
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1426
+
1427
+ // src/components/overlay.js
1428
+ import { useEffect as useEffect5 } from "react";
1429
+ var stack = [];
1430
+ var listening = false;
1431
+ function onKey(e) {
1432
+ if (e.key !== "Escape") return;
1433
+ const top = stack[stack.length - 1];
1434
+ if (!top) return;
1435
+ e.preventDefault();
1436
+ top.onEscape?.();
1437
+ }
1438
+ function listen() {
1439
+ if (listening || typeof document === "undefined") return;
1440
+ document.addEventListener("keydown", onKey);
1441
+ listening = true;
1442
+ }
1443
+ function unlisten() {
1444
+ if (!listening || stack.length) return;
1445
+ document.removeEventListener("keydown", onKey);
1446
+ listening = false;
1447
+ }
1448
+ function pushOverlay(entry) {
1449
+ stack.push(entry);
1450
+ listen();
1451
+ return () => {
1452
+ const i = stack.indexOf(entry);
1453
+ if (i >= 0) stack.splice(i, 1);
1454
+ unlisten();
1455
+ };
1456
+ }
1457
+ function useOverlayEscape(active, onEscape) {
1458
+ useEffect5(() => {
1459
+ if (!active) return void 0;
1460
+ return pushOverlay({ onEscape });
1461
+ }, [active, onEscape]);
1462
+ }
1463
+
1464
+ // src/components/Dialog.jsx
1465
+ import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
957
1466
  var DialogCtx = createContext(null);
958
1467
  var LABELS = {
959
1468
  en: { confirm: "Confirm", cancel: "Cancel", ok: "OK", create: "Create", required: "Please enter a value" },
@@ -961,15 +1470,15 @@ var LABELS = {
961
1470
  };
962
1471
  var _idSeq = 0;
963
1472
  function DialogHost({ children, locale = "en", labels }) {
964
- const [stack, setStack] = useState4([]);
1473
+ const [stack2, setStack] = useState5([]);
965
1474
  const t = useMemo2(
966
1475
  () => ({ ...LABELS[locale] || LABELS.en, ...labels || {} }),
967
1476
  [locale, labels]
968
1477
  );
969
- const open = useCallback3((spec) => new Promise((resolve) => {
1478
+ const open = useCallback4((spec) => new Promise((resolve) => {
970
1479
  setStack((s) => [...s, { id: `dlg_${++_idSeq}`, spec, resolve }]);
971
1480
  }), []);
972
- const close = useCallback3((id, value) => {
1481
+ const close = useCallback4((id, value) => {
973
1482
  setStack((s) => {
974
1483
  const target = s.find((d) => d.id === id);
975
1484
  if (target) target.resolve(value);
@@ -983,10 +1492,10 @@ function DialogHost({ children, locale = "en", labels }) {
983
1492
  create: (opts) => open({ kind: "create", ...opts }),
984
1493
  labels: t
985
1494
  }), [open, t]);
986
- return /* @__PURE__ */ jsxs7(DialogCtx.Provider, { value: ctx, children: [
1495
+ return /* @__PURE__ */ jsxs9(DialogCtx.Provider, { value: ctx, children: [
987
1496
  children,
988
- stack.length > 0 && typeof document !== "undefined" && createPortal(
989
- /* @__PURE__ */ jsx8("div", { className: "rui-dlg-root", role: "presentation", children: stack.map((d, i) => /* @__PURE__ */ jsx8(DialogShell, { dialog: d, isTop: i === stack.length - 1, onClose: close, t }, d.id)) }),
1497
+ stack2.length > 0 && typeof document !== "undefined" && createPortal(
1498
+ /* @__PURE__ */ jsx10("div", { className: "rui-dlg-root", role: "presentation", children: stack2.map((d, i) => /* @__PURE__ */ jsx10(DialogShell, { dialog: d, isTop: i === stack2.length - 1, onClose: close, t }, d.id)) }),
990
1499
  document.body
991
1500
  )
992
1501
  ] });
@@ -999,19 +1508,11 @@ function useDialog() {
999
1508
  var cancelValue = (kind) => kind === "prompt" || kind === "create" ? null : false;
1000
1509
  function DialogShell({ dialog, isTop, onClose, t }) {
1001
1510
  const { id, spec } = dialog;
1002
- const ref = useRef4(null);
1511
+ const ref = useRef5(null);
1003
1512
  const titleId = useId();
1004
- useEffect4(() => {
1005
- if (!isTop) return void 0;
1006
- const onKey = (e) => {
1007
- if (e.key !== "Escape") return;
1008
- e.preventDefault();
1009
- onClose(id, cancelValue(spec.kind));
1010
- };
1011
- document.addEventListener("keydown", onKey);
1012
- return () => document.removeEventListener("keydown", onKey);
1013
- }, [id, isTop, onClose, spec.kind]);
1014
- useEffect4(() => {
1513
+ const escape = useCallback4(() => onClose(id, cancelValue(spec.kind)), [id, onClose, spec.kind]);
1514
+ useOverlayEscape(isTop, escape);
1515
+ useEffect6(() => {
1015
1516
  if (!isTop || !ref.current) return;
1016
1517
  const el = ref.current.querySelector("input, textarea") || ref.current.querySelector(".rui-dlg-primary") || ref.current.querySelector("button");
1017
1518
  el?.focus();
@@ -1020,7 +1521,7 @@ function DialogShell({ dialog, isTop, onClose, t }) {
1020
1521
  if (e.target === e.currentTarget && isTop) onClose(id, cancelValue(spec.kind));
1021
1522
  };
1022
1523
  const done = (v) => onClose(id, v);
1023
- return /* @__PURE__ */ jsx8("div", { className: "rui-dlg-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ jsxs7(
1524
+ return /* @__PURE__ */ jsx10("div", { className: "rui-dlg-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ jsxs9(
1024
1525
  "div",
1025
1526
  {
1026
1527
  ref,
@@ -1029,34 +1530,34 @@ function DialogShell({ dialog, isTop, onClose, t }) {
1029
1530
  "aria-labelledby": spec.title ? titleId : void 0,
1030
1531
  className: `rui-dlg-card${spec.kind === "create" ? " is-wide" : ""}`,
1031
1532
  children: [
1032
- spec.kind === "alert" && /* @__PURE__ */ jsx8(AlertBody, { spec, onClose: done, t, titleId }),
1033
- spec.kind === "confirm" && /* @__PURE__ */ jsx8(ConfirmBody, { spec, onClose: done, t, titleId }),
1034
- spec.kind === "prompt" && /* @__PURE__ */ jsx8(PromptBody, { spec, onClose: done, t, titleId }),
1035
- spec.kind === "create" && /* @__PURE__ */ jsx8(CreateBody, { spec, onClose: done, t, titleId })
1533
+ spec.kind === "alert" && /* @__PURE__ */ jsx10(AlertBody, { spec, onClose: done, t, titleId }),
1534
+ spec.kind === "confirm" && /* @__PURE__ */ jsx10(ConfirmBody, { spec, onClose: done, t, titleId }),
1535
+ spec.kind === "prompt" && /* @__PURE__ */ jsx10(PromptBody, { spec, onClose: done, t, titleId }),
1536
+ spec.kind === "create" && /* @__PURE__ */ jsx10(CreateBody, { spec, onClose: done, t, titleId })
1036
1537
  ]
1037
1538
  }
1038
1539
  ) });
1039
1540
  }
1040
1541
  function Header({ title, variant, titleId }) {
1041
1542
  if (!title) return null;
1042
- return /* @__PURE__ */ jsx8("div", { className: `rui-dlg-h${variant ? ` is-${variant}` : ""}`, children: /* @__PURE__ */ jsx8("div", { className: "rui-dlg-title", id: titleId, children: title }) });
1543
+ return /* @__PURE__ */ jsx10("div", { className: `rui-dlg-h${variant ? ` is-${variant}` : ""}`, children: /* @__PURE__ */ jsx10("div", { className: "rui-dlg-title", id: titleId, children: title }) });
1043
1544
  }
1044
- var Footer = ({ children }) => /* @__PURE__ */ jsx8("div", { className: "rui-dlg-f", children });
1545
+ var Footer = ({ children }) => /* @__PURE__ */ jsx10("div", { className: "rui-dlg-f", children });
1045
1546
  function AlertBody({ spec, onClose, t, titleId }) {
1046
- return /* @__PURE__ */ jsxs7(Fragment3, { children: [
1047
- /* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
1048
- /* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1049
- /* @__PURE__ */ jsx8(Footer, { children: /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: () => onClose(true), children: spec.confirmLabel || t.ok }) })
1547
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1548
+ /* @__PURE__ */ jsx10(Header, { title: spec.title, variant: spec.variant, titleId }),
1549
+ /* @__PURE__ */ jsx10("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1550
+ /* @__PURE__ */ jsx10(Footer, { children: /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: () => onClose(true), children: spec.confirmLabel || t.ok }) })
1050
1551
  ] });
1051
1552
  }
1052
1553
  function ConfirmBody({ spec, onClose, t, titleId }) {
1053
1554
  const destructive = !!spec.destructive;
1054
- return /* @__PURE__ */ jsxs7(Fragment3, { children: [
1055
- /* @__PURE__ */ jsx8(Header, { title: spec.title, variant: destructive ? "destructive" : spec.variant, titleId }),
1056
- /* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1057
- /* @__PURE__ */ jsxs7(Footer, { children: [
1058
- /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(false), children: spec.cancelLabel || t.cancel }),
1059
- /* @__PURE__ */ jsx8(
1555
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1556
+ /* @__PURE__ */ jsx10(Header, { title: spec.title, variant: destructive ? "destructive" : spec.variant, titleId }),
1557
+ /* @__PURE__ */ jsx10("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1558
+ /* @__PURE__ */ jsxs9(Footer, { children: [
1559
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(false), children: spec.cancelLabel || t.cancel }),
1560
+ /* @__PURE__ */ jsx10(
1060
1561
  "button",
1061
1562
  {
1062
1563
  type: "button",
@@ -1069,8 +1570,8 @@ function ConfirmBody({ spec, onClose, t, titleId }) {
1069
1570
  ] });
1070
1571
  }
1071
1572
  function PromptBody({ spec, onClose, t, titleId }) {
1072
- const [value, setValue] = useState4(spec.defaultValue ?? "");
1073
- const [err, setErr] = useState4(null);
1573
+ const [value, setValue] = useState5(spec.defaultValue ?? "");
1574
+ const [err, setErr] = useState5(null);
1074
1575
  const inputId = useId();
1075
1576
  const Field = spec.multiline ? "textarea" : "input";
1076
1577
  const submit = () => {
@@ -1085,12 +1586,12 @@ function PromptBody({ spec, onClose, t, titleId }) {
1085
1586
  }
1086
1587
  onClose(String(value));
1087
1588
  };
1088
- return /* @__PURE__ */ jsxs7(Fragment3, { children: [
1089
- /* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
1090
- /* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
1091
- spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null,
1092
- spec.label ? /* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
1093
- /* @__PURE__ */ jsx8(
1589
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1590
+ /* @__PURE__ */ jsx10(Header, { title: spec.title, variant: spec.variant, titleId }),
1591
+ /* @__PURE__ */ jsxs9("div", { className: "rui-dlg-b", children: [
1592
+ spec.message ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-msg", children: spec.message }) : null,
1593
+ spec.label ? /* @__PURE__ */ jsx10("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
1594
+ /* @__PURE__ */ jsx10(
1094
1595
  Field,
1095
1596
  {
1096
1597
  id: inputId,
@@ -1113,20 +1614,20 @@ function PromptBody({ spec, onClose, t, titleId }) {
1113
1614
  spellCheck: "false"
1114
1615
  }
1115
1616
  ),
1116
- err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null,
1117
- !err && spec.help ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-help", children: spec.help }) : null
1617
+ err ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-err", children: err }) : null,
1618
+ !err && spec.help ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-help", children: spec.help }) : null
1118
1619
  ] }),
1119
- /* @__PURE__ */ jsxs7(Footer, { children: [
1120
- /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1121
- /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.confirm })
1620
+ /* @__PURE__ */ jsxs9(Footer, { children: [
1621
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1622
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.confirm })
1122
1623
  ] })
1123
1624
  ] });
1124
1625
  }
1125
1626
  function CreateBody({ spec, onClose, t, titleId }) {
1126
1627
  const types = spec.types || [];
1127
- const [kind, setKind] = useState4(spec.defaultKind || types[0]?.kind || "");
1128
- const [value, setValue] = useState4(spec.defaultValue ?? "");
1129
- const [err, setErr] = useState4(null);
1628
+ const [kind, setKind] = useState5(spec.defaultKind || types[0]?.kind || "");
1629
+ const [value, setValue] = useState5(spec.defaultValue ?? "");
1630
+ const [err, setErr] = useState5(null);
1130
1631
  const inputId = useId();
1131
1632
  const sel = types.find((x) => x.kind === kind) || types[0] || {};
1132
1633
  const submit = () => {
@@ -1136,24 +1637,24 @@ function CreateBody({ spec, onClose, t, titleId }) {
1136
1637
  }
1137
1638
  onClose({ kind, name: String(value).trim() });
1138
1639
  };
1139
- return /* @__PURE__ */ jsxs7(Fragment3, { children: [
1140
- /* @__PURE__ */ jsx8(Header, { title: spec.title, titleId }),
1141
- /* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
1142
- types.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-typegrid", children: types.map((ty) => /* @__PURE__ */ jsxs7(
1640
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1641
+ /* @__PURE__ */ jsx10(Header, { title: spec.title, titleId }),
1642
+ /* @__PURE__ */ jsxs9("div", { className: "rui-dlg-b", children: [
1643
+ types.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-typegrid", children: types.map((ty) => /* @__PURE__ */ jsxs9(
1143
1644
  "button",
1144
1645
  {
1145
1646
  type: "button",
1146
1647
  className: `rui-dlg-type${ty.kind === kind ? " is-on" : ""}`,
1147
1648
  onClick: () => setKind(ty.kind),
1148
1649
  children: [
1149
- ty.icon ? /* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-ic", style: ty.color ? { color: ty.color, background: `${ty.color}1f` } : void 0, children: ty.icon }) : null,
1150
- /* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-lbl", children: ty.label })
1650
+ ty.icon ? /* @__PURE__ */ jsx10("span", { className: "rui-dlg-type-ic", style: ty.color ? { color: ty.color, background: `${ty.color}1f` } : void 0, children: ty.icon }) : null,
1651
+ /* @__PURE__ */ jsx10("span", { className: "rui-dlg-type-lbl", children: ty.label })
1151
1652
  ]
1152
1653
  },
1153
1654
  ty.kind
1154
1655
  )) }) : null,
1155
- /* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label || `${sel.label || "Item"} name` }),
1156
- /* @__PURE__ */ jsx8(
1656
+ /* @__PURE__ */ jsx10("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label || `${sel.label || "Item"} name` }),
1657
+ /* @__PURE__ */ jsx10(
1157
1658
  "input",
1158
1659
  {
1159
1660
  id: inputId,
@@ -1174,11 +1675,11 @@ function CreateBody({ spec, onClose, t, titleId }) {
1174
1675
  spellCheck: "false"
1175
1676
  }
1176
1677
  ),
1177
- err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null
1678
+ err ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-err", children: err }) : null
1178
1679
  ] }),
1179
- /* @__PURE__ */ jsxs7(Footer, { children: [
1180
- /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1181
- /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.create })
1680
+ /* @__PURE__ */ jsxs9(Footer, { children: [
1681
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1682
+ /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.create })
1182
1683
  ] })
1183
1684
  ] });
1184
1685
  }
@@ -1332,18 +1833,18 @@ async function fetchBalance() {
1332
1833
  }
1333
1834
 
1334
1835
  // src/auth/AuthForm.jsx
1335
- import { useState as useState6 } from "react";
1836
+ import { useState as useState7 } from "react";
1336
1837
 
1337
1838
  // src/auth/GoogleButton.jsx
1338
- import { useEffect as useEffect5, useRef as useRef5, useState as useState5 } from "react";
1339
- import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1839
+ import { useEffect as useEffect7, useRef as useRef6, useState as useState6 } from "react";
1840
+ import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1340
1841
  var CLIENT_ID = "247853836408-ojk91u8901hdlbkevid4fohmrfdot17l.apps.googleusercontent.com";
1341
1842
  function GoogleButton({ onCredential, onError }) {
1342
- const ref = useRef5(null);
1343
- const [failed, setFailed] = useState5(false);
1344
- const cb = useRef5({ onCredential, onError });
1843
+ const ref = useRef6(null);
1844
+ const [failed, setFailed] = useState6(false);
1845
+ const cb = useRef6({ onCredential, onError });
1345
1846
  cb.current = { onCredential, onError };
1346
- useEffect5(() => {
1847
+ useEffect7(() => {
1347
1848
  if (!CLIENT_ID || !ref.current) return void 0;
1348
1849
  const SRC = "https://accounts.google.com/gsi/client";
1349
1850
  let done = false;
@@ -1394,24 +1895,24 @@ function GoogleButton({ onCredential, onError }) {
1394
1895
  };
1395
1896
  }, []);
1396
1897
  if (!CLIENT_ID || failed) return null;
1397
- return /* @__PURE__ */ jsxs8(Fragment4, { children: [
1398
- /* @__PURE__ */ jsx9("div", { className: "auth-or", children: /* @__PURE__ */ jsx9("span", { children: "or" }) }),
1399
- /* @__PURE__ */ jsx9("div", { ref, className: "auth-gwrap" })
1898
+ return /* @__PURE__ */ jsxs10(Fragment6, { children: [
1899
+ /* @__PURE__ */ jsx11("div", { className: "auth-or", children: /* @__PURE__ */ jsx11("span", { children: "or" }) }),
1900
+ /* @__PURE__ */ jsx11("div", { ref, className: "auth-gwrap" })
1400
1901
  ] });
1401
1902
  }
1402
1903
  var GOOGLE_ENABLED = !!CLIENT_ID;
1403
1904
 
1404
1905
  // src/auth/AuthForm.jsx
1405
- import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1906
+ import { Fragment as Fragment7, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1406
1907
  function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
1407
- const [mode, setMode] = useState6("signin");
1408
- const [email, setEmail] = useState6("");
1409
- const [password, setPassword] = useState6("");
1410
- const [name, setName] = useState6("");
1411
- const [err, setErr] = useState6("");
1412
- const [busy, setBusy] = useState6(false);
1413
- const [choices, setChoices] = useState6(null);
1414
- const [resetSent, setResetSent] = useState6(false);
1908
+ const [mode, setMode] = useState7("signin");
1909
+ const [email, setEmail] = useState7("");
1910
+ const [password, setPassword] = useState7("");
1911
+ const [name, setName] = useState7("");
1912
+ const [err, setErr] = useState7("");
1913
+ const [busy, setBusy] = useState7(false);
1914
+ const [choices, setChoices] = useState7(null);
1915
+ const [resetSent, setResetSent] = useState7(false);
1415
1916
  async function enter(orgId) {
1416
1917
  const session = await switchOrg(orgId);
1417
1918
  onDone(session);
@@ -1452,10 +1953,10 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
1452
1953
  }
1453
1954
  }
1454
1955
  if (choices) {
1455
- return /* @__PURE__ */ jsxs9("div", { children: [
1456
- /* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
1457
- /* @__PURE__ */ jsx10("h1", { children: "Choose workspace" }),
1458
- /* @__PURE__ */ jsx10("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ jsx10(
1956
+ return /* @__PURE__ */ jsxs11("div", { children: [
1957
+ /* @__PURE__ */ jsx12("div", { className: "logo", children: brand }),
1958
+ /* @__PURE__ */ jsx12("h1", { children: "Choose workspace" }),
1959
+ /* @__PURE__ */ jsx12("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ jsx12(
1459
1960
  "button",
1460
1961
  {
1461
1962
  type: "button",
@@ -1473,20 +1974,20 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
1473
1974
  },
1474
1975
  o.id
1475
1976
  )) }),
1476
- err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err })
1977
+ err && /* @__PURE__ */ jsx12("div", { className: "auth-err", children: err })
1477
1978
  ] });
1478
1979
  }
1479
- return /* @__PURE__ */ jsxs9("form", { onSubmit: submit, children: [
1480
- /* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
1481
- /* @__PURE__ */ jsx10("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
1482
- /* @__PURE__ */ jsx10("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle || "Welcome back." }),
1483
- mode === "forgot" ? resetSent ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
1484
- /* @__PURE__ */ jsxs9("div", { className: "auth-note", children: [
1980
+ return /* @__PURE__ */ jsxs11("form", { onSubmit: submit, children: [
1981
+ /* @__PURE__ */ jsx12("div", { className: "logo", children: brand }),
1982
+ /* @__PURE__ */ jsx12("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
1983
+ /* @__PURE__ */ jsx12("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle || "Welcome back." }),
1984
+ mode === "forgot" ? resetSent ? /* @__PURE__ */ jsxs11(Fragment7, { children: [
1985
+ /* @__PURE__ */ jsxs11("div", { className: "auth-note", children: [
1485
1986
  "If an account exists for ",
1486
- /* @__PURE__ */ jsx10("b", { children: email.trim() }),
1987
+ /* @__PURE__ */ jsx12("b", { children: email.trim() }),
1487
1988
  ", a password reset link is on its way. It is valid for 1 hour."
1488
1989
  ] }),
1489
- /* @__PURE__ */ jsx10(
1990
+ /* @__PURE__ */ jsx12(
1490
1991
  "button",
1491
1992
  {
1492
1993
  type: "button",
@@ -1500,36 +2001,36 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
1500
2001
  children: "Back to sign in"
1501
2002
  }
1502
2003
  )
1503
- ] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
1504
- /* @__PURE__ */ jsxs9("div", { className: "field", children: [
1505
- /* @__PURE__ */ jsx10("label", { children: "Email" }),
1506
- /* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
2004
+ ] }) : /* @__PURE__ */ jsxs11(Fragment7, { children: [
2005
+ /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2006
+ /* @__PURE__ */ jsx12("label", { children: "Email" }),
2007
+ /* @__PURE__ */ jsx12("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
1507
2008
  ] }),
1508
- err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
1509
- /* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
1510
- /* @__PURE__ */ jsx10("p", { className: "auth-switch", children: /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
2009
+ err && /* @__PURE__ */ jsx12("div", { className: "auth-err", children: err }),
2010
+ /* @__PURE__ */ jsx12("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
2011
+ /* @__PURE__ */ jsx12("p", { className: "auth-switch", children: /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => {
1511
2012
  setErr("");
1512
2013
  setMode("signin");
1513
2014
  }, children: "Back to sign in" }) })
1514
- ] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
1515
- mode === "register" && /* @__PURE__ */ jsxs9("div", { className: "field", children: [
1516
- /* @__PURE__ */ jsx10("label", { children: "Name" }),
1517
- /* @__PURE__ */ jsx10("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
2015
+ ] }) : /* @__PURE__ */ jsxs11(Fragment7, { children: [
2016
+ mode === "register" && /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2017
+ /* @__PURE__ */ jsx12("label", { children: "Name" }),
2018
+ /* @__PURE__ */ jsx12("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
1518
2019
  ] }),
1519
- /* @__PURE__ */ jsxs9("div", { className: "field", children: [
1520
- /* @__PURE__ */ jsx10("label", { children: "Email" }),
1521
- /* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
2020
+ /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2021
+ /* @__PURE__ */ jsx12("label", { children: "Email" }),
2022
+ /* @__PURE__ */ jsx12("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
1522
2023
  ] }),
1523
- /* @__PURE__ */ jsxs9("div", { className: "field", children: [
1524
- /* @__PURE__ */ jsxs9("div", { className: "field-row", children: [
1525
- /* @__PURE__ */ jsx10("label", { children: "Password" }),
1526
- mode === "signin" && /* @__PURE__ */ jsx10("button", { type: "button", className: "link-sm", onClick: () => {
2024
+ /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2025
+ /* @__PURE__ */ jsxs11("div", { className: "field-row", children: [
2026
+ /* @__PURE__ */ jsx12("label", { children: "Password" }),
2027
+ mode === "signin" && /* @__PURE__ */ jsx12("button", { type: "button", className: "link-sm", onClick: () => {
1527
2028
  setErr("");
1528
2029
  setResetSent(false);
1529
2030
  setMode("forgot");
1530
2031
  }, children: "Forgot password?" })
1531
2032
  ] }),
1532
- /* @__PURE__ */ jsx10(
2033
+ /* @__PURE__ */ jsx12(
1533
2034
  "input",
1534
2035
  {
1535
2036
  className: "input",
@@ -1542,13 +2043,13 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
1542
2043
  }
1543
2044
  )
1544
2045
  ] }),
1545
- err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
1546
- /* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
1547
- GOOGLE_ENABLED && /* @__PURE__ */ jsx10(GoogleButton, { onCredential: onGoogle, onError: setErr }),
1548
- /* @__PURE__ */ jsxs9("p", { className: "auth-switch", children: [
2046
+ err && /* @__PURE__ */ jsx12("div", { className: "auth-err", children: err }),
2047
+ /* @__PURE__ */ jsx12("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
2048
+ GOOGLE_ENABLED && /* @__PURE__ */ jsx12(GoogleButton, { onCredential: onGoogle, onError: setErr }),
2049
+ /* @__PURE__ */ jsxs11("p", { className: "auth-switch", children: [
1549
2050
  mode === "register" ? "Already have an account?" : `New to ${productName || "the product"}?`,
1550
2051
  " ",
1551
- /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
2052
+ /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => {
1552
2053
  setErr("");
1553
2054
  setMode(mode === "register" ? "signin" : "register");
1554
2055
  }, children: mode === "register" ? "Sign in" : "Create one" })
@@ -1558,9 +2059,9 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
1558
2059
  }
1559
2060
 
1560
2061
  // src/sheet/SheetGrid.jsx
1561
- import { useEffect as useEffect6, useRef as useRef6, useState as useState7 } from "react";
2062
+ import { useEffect as useEffect8, useRef as useRef7, useState as useState8 } from "react";
1562
2063
  import { createPortal as createPortal2 } from "react-dom";
1563
- import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2064
+ import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1564
2065
  var cellKey = (rowId, colId) => `${rowId}:${colId}`;
1565
2066
  var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
1566
2067
  var DEFAULT_COLUMN_TYPES = [
@@ -1589,8 +2090,8 @@ var COMPUTE_KINDS = [
1589
2090
  var RESOURCE_KINDS = ["image", "sheet", "slides", "workflow", "graph"];
1590
2091
  var RESOURCE_ICON = { image: "\u{1F5BC}", sheet: "\u25A6", slides: "\u25A4", workflow: "\u2699", graph: "\u25C9" };
1591
2092
  function PopPortal({ anchor, width = 250, estHeight = 300, className, children, onClose }) {
1592
- const boxRef = useRef6(null);
1593
- useEffect6(() => {
2093
+ const boxRef = useRef7(null);
2094
+ useEffect8(() => {
1594
2095
  if (!onClose) return void 0;
1595
2096
  const close = () => onClose();
1596
2097
  const onDown = (e) => {
@@ -1612,7 +2113,7 @@ function PopPortal({ anchor, width = 250, estHeight = 300, className, children,
1612
2113
  let top = anchor.bottom + 6;
1613
2114
  if (top + estHeight > window.innerHeight - 8) top = Math.max(8, anchor.top - estHeight - 6);
1614
2115
  return createPortal2(
1615
- /* @__PURE__ */ jsx11("div", { ref: boxRef, className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
2116
+ /* @__PURE__ */ jsx13("div", { ref: boxRef, className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
1616
2117
  document.body
1617
2118
  );
1618
2119
  }
@@ -1632,8 +2133,8 @@ function pillColor(label, options) {
1632
2133
  return PILL_FALLBACKS[h % PILL_FALLBACKS.length];
1633
2134
  }
1634
2135
  function RefImage({ refVal, fetchBlobUrl }) {
1635
- const [src, setSrc] = useState7(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
1636
- useEffect6(() => {
2136
+ const [src, setSrc] = useState8(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
2137
+ useEffect8(() => {
1637
2138
  let dead = false;
1638
2139
  let obj = null;
1639
2140
  if (!src && refVal.url && fetchBlobUrl) {
@@ -1649,16 +2150,16 @@ function RefImage({ refVal, fetchBlobUrl }) {
1649
2150
  if (obj) URL.revokeObjectURL(obj);
1650
2151
  };
1651
2152
  }, [refVal.url]);
1652
- if (!src) return /* @__PURE__ */ jsxs10("span", { className: "shg-refchip", children: [
2153
+ if (!src) return /* @__PURE__ */ jsxs12("span", { className: "shg-refchip", children: [
1653
2154
  RESOURCE_ICON.image,
1654
2155
  " ",
1655
2156
  refVal.name || "image"
1656
2157
  ] });
1657
- return /* @__PURE__ */ jsx11("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
2158
+ return /* @__PURE__ */ jsx13("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
1658
2159
  }
1659
2160
  function ResourceChip({ refVal, onOpen }) {
1660
2161
  const icon = RESOURCE_ICON[refVal.kind] || "\u25C7";
1661
- return /* @__PURE__ */ jsxs10(
2162
+ return /* @__PURE__ */ jsxs12(
1662
2163
  "button",
1663
2164
  {
1664
2165
  className: "shg-refchip shg-refchip-btn",
@@ -1668,40 +2169,40 @@ function ResourceChip({ refVal, onOpen }) {
1668
2169
  onOpen && onOpen(refVal);
1669
2170
  },
1670
2171
  children: [
1671
- /* @__PURE__ */ jsx11("span", { className: "shg-refchip-ic", children: icon }),
1672
- /* @__PURE__ */ jsx11("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
2172
+ /* @__PURE__ */ jsx13("span", { className: "shg-refchip-ic", children: icon }),
2173
+ /* @__PURE__ */ jsx13("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
1673
2174
  ]
1674
2175
  }
1675
2176
  );
1676
2177
  }
1677
2178
  function StatusDot({ status }) {
1678
2179
  if (!status || status === "empty") return null;
1679
- return /* @__PURE__ */ jsx11("span", { className: `shg-dot shg-dot-${status}`, title: status });
2180
+ return /* @__PURE__ */ jsx13("span", { className: `shg-dot shg-dot-${status}`, title: status });
1680
2181
  }
1681
2182
  function CellValue({ cell, col, fetchBlobUrl, onOpenResource }) {
1682
2183
  const v = cell?.value;
1683
- if (v === void 0 || v === null || v === "") return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt" });
2184
+ if (v === void 0 || v === null || v === "") return /* @__PURE__ */ jsx13("span", { className: "shg-val-txt" });
1684
2185
  if (v && typeof v === "object" && !Array.isArray(v) && v.kind) {
1685
- if (v.kind === "image") return /* @__PURE__ */ jsx11(RefImage, { refVal: v, fetchBlobUrl });
1686
- return /* @__PURE__ */ jsx11(ResourceChip, { refVal: v, onOpen: onOpenResource });
2186
+ if (v.kind === "image") return /* @__PURE__ */ jsx13(RefImage, { refVal: v, fetchBlobUrl });
2187
+ return /* @__PURE__ */ jsx13(ResourceChip, { refVal: v, onOpen: onOpenResource });
1687
2188
  }
1688
2189
  switch (col.type) {
1689
2190
  case "select":
1690
- return /* @__PURE__ */ jsx11("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
2191
+ return /* @__PURE__ */ jsx13("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
1691
2192
  case "tags": {
1692
2193
  const tags = Array.isArray(v) ? v : String(v).split(",").map((s) => s.trim()).filter(Boolean);
1693
- return /* @__PURE__ */ jsx11("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ jsx11("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
2194
+ return /* @__PURE__ */ jsx13("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ jsx13("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
1694
2195
  }
1695
2196
  case "checkbox":
1696
- return /* @__PURE__ */ jsx11("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
2197
+ return /* @__PURE__ */ jsx13("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
1697
2198
  case "url": {
1698
2199
  const href = /^https?:\/\//i.test(String(v)) ? String(v) : `https://${v}`;
1699
- return /* @__PURE__ */ jsx11("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
2200
+ return /* @__PURE__ */ jsx13("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
1700
2201
  }
1701
2202
  case "number":
1702
- return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt shg-num", children: String(v) });
2203
+ return /* @__PURE__ */ jsx13("span", { className: "shg-val-txt shg-num", children: String(v) });
1703
2204
  default:
1704
- return /* @__PURE__ */ jsx11("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
2205
+ return /* @__PURE__ */ jsx13("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
1705
2206
  }
1706
2207
  }
1707
2208
  function SheetGrid({
@@ -1721,14 +2222,14 @@ function SheetGrid({
1721
2222
  const columns = sheet?.columns || [];
1722
2223
  const rows = sheet?.rows || [];
1723
2224
  const cells = sheet?.cells || {};
1724
- const [editing, setEditing] = useState7(null);
1725
- const [draft, setDraft] = useState7("");
1726
- const [menuCol, setMenuCol] = useState7(null);
1727
- const [sizeDraft, setSizeDraft] = useState7({});
1728
- const [dnd, setDnd] = useState7(null);
1729
- const [dropAt, setDropAt] = useState7(null);
1730
- const inputRef = useRef6(null);
1731
- const dragRef = useRef6(null);
2225
+ const [editing, setEditing] = useState8(null);
2226
+ const [draft, setDraft] = useState8("");
2227
+ const [menuCol, setMenuCol] = useState8(null);
2228
+ const [sizeDraft, setSizeDraft] = useState8({});
2229
+ const [dnd, setDnd] = useState8(null);
2230
+ const [dropAt, setDropAt] = useState8(null);
2231
+ const inputRef = useRef7(null);
2232
+ const dragRef = useRef7(null);
1732
2233
  const descOf = (type) => columnTypes.find((t) => t.type === type) || { type, label: type };
1733
2234
  const isComputed = (col) => !!descOf(col?.type).computed;
1734
2235
  const isEditable = (col) => {
@@ -1829,7 +2330,7 @@ function SheetGrid({
1829
2330
  const numW = Math.max(40, 24 + String(rows.length || 1).length * 9);
1830
2331
  const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
1831
2332
  const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
1832
- useEffect6(() => {
2333
+ useEffect8(() => {
1833
2334
  if (editing && inputRef.current) inputRef.current.focus();
1834
2335
  }, [editing]);
1835
2336
  const mutate = (fn) => {
@@ -1901,7 +2402,7 @@ function SheetGrid({
1901
2402
  if (col.type === "resource") {
1902
2403
  const d = typeof draft === "object" && draft ? draft : { kind: "sheet" };
1903
2404
  const set = (k, v) => setDraft({ ...d, [k]: v });
1904
- return /* @__PURE__ */ jsx11(
2405
+ return /* @__PURE__ */ jsx13(
1905
2406
  PopPortal,
1906
2407
  {
1907
2408
  anchor: editing.rect,
@@ -1909,17 +2410,17 @@ function SheetGrid({
1909
2410
  estHeight: 230,
1910
2411
  className: "shg-select-pop shg-ref-pop",
1911
2412
  onClose: () => setEditing(null),
1912
- children: /* @__PURE__ */ jsxs10("div", { onClick: (e) => e.stopPropagation(), children: [
1913
- /* @__PURE__ */ jsx11("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k, children: k }, k)) }),
1914
- /* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
1915
- /* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
1916
- /* @__PURE__ */ jsx11("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
1917
- /* @__PURE__ */ jsxs10("div", { className: "shg-menu-actions", children: [
1918
- /* @__PURE__ */ jsx11("button", { className: "shg-pop-clear", onClick: () => {
2413
+ children: /* @__PURE__ */ jsxs12("div", { onClick: (e) => e.stopPropagation(), children: [
2414
+ /* @__PURE__ */ jsx13("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ jsx13("option", { value: k, children: k }, k)) }),
2415
+ /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
2416
+ /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
2417
+ /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
2418
+ /* @__PURE__ */ jsxs12("div", { className: "shg-menu-actions", children: [
2419
+ /* @__PURE__ */ jsx13("button", { className: "shg-pop-clear", onClick: () => {
1919
2420
  setCell(editing.rowId, editing.colId, null);
1920
2421
  setEditing(null);
1921
2422
  }, children: "Clear" }),
1922
- /* @__PURE__ */ jsx11("button", { className: "shg-menu-apply", onClick: () => {
2423
+ /* @__PURE__ */ jsx13("button", { className: "shg-menu-apply", onClick: () => {
1923
2424
  setCell(editing.rowId, editing.colId, d);
1924
2425
  setEditing(null);
1925
2426
  }, children: "Set" })
@@ -1930,7 +2431,7 @@ function SheetGrid({
1930
2431
  }
1931
2432
  if (col.type === "select") {
1932
2433
  const opts = normOptions(col.options);
1933
- return /* @__PURE__ */ jsxs10(
2434
+ return /* @__PURE__ */ jsxs12(
1934
2435
  PopPortal,
1935
2436
  {
1936
2437
  anchor: editing.rect,
@@ -1939,8 +2440,8 @@ function SheetGrid({
1939
2440
  className: "shg-select-pop",
1940
2441
  onClose: () => setEditing(null),
1941
2442
  children: [
1942
- opts.length === 0 && /* @__PURE__ */ jsx11("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
1943
- opts.map((o) => /* @__PURE__ */ jsx11(
2443
+ opts.length === 0 && /* @__PURE__ */ jsx13("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
2444
+ opts.map((o) => /* @__PURE__ */ jsx13(
1944
2445
  "button",
1945
2446
  {
1946
2447
  className: "shg-pill shg-pill-btn",
@@ -1954,7 +2455,7 @@ function SheetGrid({
1954
2455
  },
1955
2456
  o.label
1956
2457
  )),
1957
- /* @__PURE__ */ jsx11(
2458
+ /* @__PURE__ */ jsx13(
1958
2459
  "button",
1959
2460
  {
1960
2461
  className: "shg-pop-clear",
@@ -1971,7 +2472,7 @@ function SheetGrid({
1971
2472
  );
1972
2473
  }
1973
2474
  const inputType = col.type === "date" ? "date" : col.type === "number" ? "number" : "text";
1974
- return /* @__PURE__ */ jsx11(
2475
+ return /* @__PURE__ */ jsx13(
1975
2476
  "input",
1976
2477
  {
1977
2478
  ref: inputRef,
@@ -1988,18 +2489,18 @@ function SheetGrid({
1988
2489
  }
1989
2490
  );
1990
2491
  };
1991
- return /* @__PURE__ */ jsx11("div", { className: "shg", children: /* @__PURE__ */ jsx11("div", { className: "shg-scroll", children: /* @__PURE__ */ jsxs10("table", { className: "shg-table", children: [
1992
- /* @__PURE__ */ jsx11("thead", { children: /* @__PURE__ */ jsxs10("tr", { children: [
1993
- /* @__PURE__ */ jsx11("th", { className: "shg-corner", style: numStyle }),
1994
- columns.map((col) => /* @__PURE__ */ jsxs10(
2492
+ return /* @__PURE__ */ jsx13("div", { className: "shg", children: /* @__PURE__ */ jsx13("div", { className: "shg-scroll", children: /* @__PURE__ */ jsxs12("table", { className: "shg-table", children: [
2493
+ /* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsxs12("tr", { children: [
2494
+ /* @__PURE__ */ jsx13("th", { className: "shg-corner", style: numStyle }),
2495
+ columns.map((col) => /* @__PURE__ */ jsxs12(
1995
2496
  "th",
1996
2497
  {
1997
2498
  className: "shg-col" + (isComputed(col) ? " shg-col-compute" : "") + dndClass("col", col.id),
1998
2499
  style: colWidth(col) ? { width: colWidth(col), minWidth: colWidth(col), maxWidth: colWidth(col) } : void 0,
1999
2500
  ...dndProps("col", col.id),
2000
2501
  children: [
2001
- !readOnly && /* @__PURE__ */ jsx11("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
2002
- /* @__PURE__ */ jsx11("div", { className: "shg-col-h", children: /* @__PURE__ */ jsx11(
2502
+ !readOnly && /* @__PURE__ */ jsx13("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
2503
+ /* @__PURE__ */ jsx13("div", { className: "shg-col-h", children: /* @__PURE__ */ jsx13(
2003
2504
  ColumnHeader,
2004
2505
  {
2005
2506
  col,
@@ -2025,10 +2526,10 @@ function SheetGrid({
2025
2526
  },
2026
2527
  col.id
2027
2528
  )),
2028
- !readOnly && /* @__PURE__ */ jsx11("th", { className: "shg-add-col", children: /* @__PURE__ */ jsx11("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
2529
+ !readOnly && /* @__PURE__ */ jsx13("th", { className: "shg-add-col", children: /* @__PURE__ */ jsx13("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
2029
2530
  ] }) }),
2030
- /* @__PURE__ */ jsxs10("tbody", { children: [
2031
- rows.map((row, ri) => /* @__PURE__ */ jsxs10(
2531
+ /* @__PURE__ */ jsxs12("tbody", { children: [
2532
+ rows.map((row, ri) => /* @__PURE__ */ jsxs12(
2032
2533
  "tr",
2033
2534
  {
2034
2535
  style: {
@@ -2036,7 +2537,7 @@ function SheetGrid({
2036
2537
  "--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
2037
2538
  },
2038
2539
  children: [
2039
- /* @__PURE__ */ jsxs10(
2540
+ /* @__PURE__ */ jsxs12(
2040
2541
  "td",
2041
2542
  {
2042
2543
  className: "shg-rownum" + dndClass("row", row.id),
@@ -2044,9 +2545,9 @@ function SheetGrid({
2044
2545
  title: "Drag to reorder",
2045
2546
  ...dndProps("row", row.id),
2046
2547
  children: [
2047
- /* @__PURE__ */ jsx11("span", { children: ri + 1 }),
2048
- !readOnly && /* @__PURE__ */ jsx11("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
2049
- !readOnly && /* @__PURE__ */ jsx11("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
2548
+ /* @__PURE__ */ jsx13("span", { children: ri + 1 }),
2549
+ !readOnly && /* @__PURE__ */ jsx13("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
2550
+ !readOnly && /* @__PURE__ */ jsx13("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
2050
2551
  ]
2051
2552
  }
2052
2553
  ),
@@ -2069,7 +2570,7 @@ function SheetGrid({
2069
2570
  setCell: (v) => setCell(row.id, col.id, v),
2070
2571
  runCell: onRunCell && !readOnly ? () => onRunCell(row.id, col.id) : null
2071
2572
  });
2072
- return /* @__PURE__ */ jsxs10(
2573
+ return /* @__PURE__ */ jsxs12(
2073
2574
  "td",
2074
2575
  {
2075
2576
  className: "shg-cell" + (computed ? " shg-cell-compute" : "") + (c.status && computed ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
@@ -2079,16 +2580,16 @@ function SheetGrid({
2079
2580
  },
2080
2581
  title: c.error || "",
2081
2582
  children: [
2082
- peer && /* @__PURE__ */ jsx11("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
2083
- isEditing ? renderEditor(col) : /* @__PURE__ */ jsx11(
2583
+ peer && /* @__PURE__ */ jsx13("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
2584
+ isEditing ? renderEditor(col) : /* @__PURE__ */ jsx13(
2084
2585
  "div",
2085
2586
  {
2086
2587
  className: "shg-val",
2087
2588
  style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
2088
- children: custom !== void 0 ? custom : /* @__PURE__ */ jsxs10(Fragment6, { children: [
2089
- computed && /* @__PURE__ */ jsx11(StatusDot, { status: c.status }),
2090
- /* @__PURE__ */ jsx11(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
2091
- computed && !readOnly && onRunCell && /* @__PURE__ */ jsx11(
2589
+ children: custom !== void 0 ? custom : /* @__PURE__ */ jsxs12(Fragment8, { children: [
2590
+ computed && /* @__PURE__ */ jsx13(StatusDot, { status: c.status }),
2591
+ /* @__PURE__ */ jsx13(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
2592
+ computed && !readOnly && onRunCell && /* @__PURE__ */ jsx13(
2092
2593
  "button",
2093
2594
  {
2094
2595
  className: "shg-runcell",
@@ -2108,14 +2609,14 @@ function SheetGrid({
2108
2609
  col.id
2109
2610
  );
2110
2611
  }),
2111
- !readOnly && /* @__PURE__ */ jsx11("td", { className: "shg-pad" })
2612
+ !readOnly && /* @__PURE__ */ jsx13("td", { className: "shg-pad" })
2112
2613
  ]
2113
2614
  },
2114
2615
  row.id
2115
2616
  )),
2116
- !readOnly && /* @__PURE__ */ jsxs10("tr", { className: "shg-ghost-row", onClick: addRow, children: [
2117
- /* @__PURE__ */ jsx11("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
2118
- /* @__PURE__ */ jsx11("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
2617
+ !readOnly && /* @__PURE__ */ jsxs12("tr", { className: "shg-ghost-row", onClick: addRow, children: [
2618
+ /* @__PURE__ */ jsx13("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
2619
+ /* @__PURE__ */ jsx13("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
2119
2620
  ] })
2120
2621
  ] })
2121
2622
  ] }) }) });
@@ -2136,13 +2637,13 @@ function ColumnHeader({
2136
2637
  onDelete,
2137
2638
  onRun
2138
2639
  }) {
2139
- const [editing, setEditing] = useState7(false);
2140
- const [name, setName] = useState7(col.name);
2141
- useEffect6(() => setName(col.name), [col.name]);
2640
+ const [editing, setEditing] = useState8(false);
2641
+ const [name, setName] = useState8(col.name);
2642
+ useEffect8(() => setName(col.name), [col.name]);
2142
2643
  const badge = desc.badge ? desc.badge(col) : void 0;
2143
- return /* @__PURE__ */ jsxs10("div", { className: "shg-colhdr", children: [
2144
- /* @__PURE__ */ jsxs10("div", { className: "shg-colhdr-main", children: [
2145
- editing && !readOnly ? /* @__PURE__ */ jsx11(
2644
+ return /* @__PURE__ */ jsxs12("div", { className: "shg-colhdr", children: [
2645
+ /* @__PURE__ */ jsxs12("div", { className: "shg-colhdr-main", children: [
2646
+ editing && !readOnly ? /* @__PURE__ */ jsx13(
2146
2647
  "input",
2147
2648
  {
2148
2649
  className: "shg-colname-input",
@@ -2157,17 +2658,17 @@ function ColumnHeader({
2157
2658
  if (e.key === "Enter") e.target.blur();
2158
2659
  }
2159
2660
  }
2160
- ) : /* @__PURE__ */ jsx11("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
2161
- /* @__PURE__ */ jsxs10("span", { className: "shg-coltype" + (desc.computed ? " compute" : ""), children: [
2661
+ ) : /* @__PURE__ */ jsx13("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
2662
+ /* @__PURE__ */ jsxs12("span", { className: "shg-coltype" + (desc.computed ? " compute" : ""), children: [
2162
2663
  desc.label || col.type,
2163
2664
  badge ? ` \xB7 ${badge}` : ""
2164
2665
  ] })
2165
2666
  ] }),
2166
- !readOnly && /* @__PURE__ */ jsxs10("div", { className: "shg-colhdr-tools", children: [
2167
- onRun && /* @__PURE__ */ jsx11("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", children: "\u25B6 Run" }),
2168
- /* @__PURE__ */ jsx11("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
2667
+ !readOnly && /* @__PURE__ */ jsxs12("div", { className: "shg-colhdr-tools", children: [
2668
+ onRun && /* @__PURE__ */ jsx13("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", children: "\u25B6 Run" }),
2669
+ /* @__PURE__ */ jsx13("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
2169
2670
  ] }),
2170
- menuOpen && !readOnly && /* @__PURE__ */ jsx11(
2671
+ menuOpen && !readOnly && /* @__PURE__ */ jsx13(
2171
2672
  ColumnMenu,
2172
2673
  {
2173
2674
  col,
@@ -2186,17 +2687,17 @@ function ColumnHeader({
2186
2687
  ] });
2187
2688
  }
2188
2689
  function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onApply, onDelete, onClose }) {
2189
- const [type, setType] = useState7(col.type || "text");
2190
- const [optText, setOptText] = useState7(
2690
+ const [type, setType] = useState8(col.type || "text");
2691
+ const [optText, setOptText] = useState8(
2191
2692
  normOptions(col.options).map((o) => o.label).join("\n")
2192
2693
  );
2193
2694
  const comp = col.compute || {};
2194
- const [kind, setKind] = useState7(comp.kind || "prompt");
2195
- const [prompt, setPrompt] = useState7(comp.prompt || "");
2196
- const [harnessId, setHarnessId] = useState7(comp.harness_id || "");
2197
- const [wfSlug, setWfSlug] = useState7(comp.workflow_slug || "");
2198
- const [outKey, setOutKey] = useState7(comp.output_key || "");
2199
- const [deps, setDeps] = useState7(new Set(comp.deps || []));
2695
+ const [kind, setKind] = useState8(comp.kind || "prompt");
2696
+ const [prompt, setPrompt] = useState8(comp.prompt || "");
2697
+ const [harnessId, setHarnessId] = useState8(comp.harness_id || "");
2698
+ const [wfSlug, setWfSlug] = useState8(comp.workflow_slug || "");
2699
+ const [outKey, setOutKey] = useState8(comp.output_key || "");
2700
+ const [deps, setDeps] = useState8(new Set(comp.deps || []));
2200
2701
  const others = columns.filter((c) => c.id !== col.id);
2201
2702
  const toggleDep = (id) => setDeps((s) => {
2202
2703
  const n = new Set(s);
@@ -2232,73 +2733,84 @@ function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onA
2232
2733
  deleteColumn: onDelete,
2233
2734
  close: onClose
2234
2735
  });
2235
- return /* @__PURE__ */ jsx11(PopPortal, { anchor, width: 250, estHeight: 340, className: "shg-menu", onClose, children: /* @__PURE__ */ jsxs10("div", { onClick: (e) => e.stopPropagation(), children: [
2236
- /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
2237
- "Type",
2238
- /* @__PURE__ */ jsx11("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: columnTypes.map((t) => /* @__PURE__ */ jsx11("option", { value: t.type, children: t.label }, t.type)) })
2239
- ] }),
2240
- (type === "select" || type === "tags") && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
2241
- "Options (one per line)",
2242
- /* @__PURE__ */ jsx11(
2243
- "textarea",
2244
- {
2245
- className: "shg-menu-input",
2246
- rows: 3,
2247
- value: optText,
2248
- onChange: (e) => setOptText(e.target.value),
2249
- placeholder: "Todo\nDoing\nDone"
2250
- }
2251
- )
2252
- ] }),
2253
- custom !== void 0 ? custom : /* @__PURE__ */ jsxs10(Fragment6, { children: [
2254
- type === "compute" && /* @__PURE__ */ jsxs10(Fragment6, { children: [
2255
- /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
2256
- "Runs",
2257
- /* @__PURE__ */ jsx11("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ jsx11("option", { value: k.kind, children: k.label }, k.kind)) })
2736
+ const desc = columnTypes.find((t) => t.type === type) || {};
2737
+ return /* @__PURE__ */ jsx13(
2738
+ PopPortal,
2739
+ {
2740
+ anchor,
2741
+ width: desc.configWidth || 250,
2742
+ estHeight: desc.configHeight || 340,
2743
+ className: "shg-menu",
2744
+ onClose,
2745
+ children: /* @__PURE__ */ jsxs12("div", { onClick: (e) => e.stopPropagation(), children: [
2746
+ /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2747
+ "Type",
2748
+ /* @__PURE__ */ jsx13("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: columnTypes.map((t) => /* @__PURE__ */ jsx13("option", { value: t.type, children: t.label }, t.type)) })
2258
2749
  ] }),
2259
- (kind === "prompt" || kind === "harness") && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
2260
- "Prompt \u2014 reference columns as ",
2261
- "{{Name}}",
2262
- /* @__PURE__ */ jsx11(
2750
+ (type === "select" || type === "tags") && /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2751
+ "Options (one per line)",
2752
+ /* @__PURE__ */ jsx13(
2263
2753
  "textarea",
2264
2754
  {
2265
2755
  className: "shg-menu-input",
2266
2756
  rows: 3,
2267
- value: prompt,
2268
- onChange: (e) => setPrompt(e.target.value),
2269
- placeholder: "Summarize {{Company}} in one line"
2757
+ value: optText,
2758
+ onChange: (e) => setOptText(e.target.value),
2759
+ placeholder: "Todo\nDoing\nDone"
2270
2760
  }
2271
2761
  )
2272
2762
  ] }),
2273
- kind === "harness" && /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
2274
- "Agent id",
2275
- /* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
2276
- ] }),
2277
- kind === "workflow" && /* @__PURE__ */ jsxs10(Fragment6, { children: [
2278
- /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
2279
- "Workflow id",
2280
- /* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
2763
+ custom !== void 0 ? custom : /* @__PURE__ */ jsxs12(Fragment8, { children: [
2764
+ type === "compute" && /* @__PURE__ */ jsxs12(Fragment8, { children: [
2765
+ /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2766
+ "Runs",
2767
+ /* @__PURE__ */ jsx13("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ jsx13("option", { value: k.kind, children: k.label }, k.kind)) })
2768
+ ] }),
2769
+ (kind === "prompt" || kind === "harness") && /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2770
+ "Prompt \u2014 reference columns as ",
2771
+ "{{Name}}",
2772
+ /* @__PURE__ */ jsx13(
2773
+ "textarea",
2774
+ {
2775
+ className: "shg-menu-input",
2776
+ rows: 3,
2777
+ value: prompt,
2778
+ onChange: (e) => setPrompt(e.target.value),
2779
+ placeholder: "Summarize {{Company}} in one line"
2780
+ }
2781
+ )
2782
+ ] }),
2783
+ kind === "harness" && /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2784
+ "Agent id",
2785
+ /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
2786
+ ] }),
2787
+ kind === "workflow" && /* @__PURE__ */ jsxs12(Fragment8, { children: [
2788
+ /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2789
+ "Workflow id",
2790
+ /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
2791
+ ] }),
2792
+ /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2793
+ "Output key (optional)",
2794
+ /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
2795
+ ] })
2796
+ ] }),
2797
+ others.length > 0 && /* @__PURE__ */ jsxs12("div", { className: "shg-menu-lbl", children: [
2798
+ "Reads columns",
2799
+ /* @__PURE__ */ jsx13("div", { className: "shg-menu-deps", children: others.map((c) => /* @__PURE__ */ jsxs12("label", { className: "shg-menu-dep", children: [
2800
+ /* @__PURE__ */ jsx13("input", { type: "checkbox", checked: deps.has(c.id), onChange: () => toggleDep(c.id) }),
2801
+ " ",
2802
+ c.name
2803
+ ] }, c.id)) })
2804
+ ] })
2281
2805
  ] }),
2282
- /* @__PURE__ */ jsxs10("label", { className: "shg-menu-lbl", children: [
2283
- "Output key (optional)",
2284
- /* @__PURE__ */ jsx11("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
2806
+ /* @__PURE__ */ jsxs12("div", { className: "shg-menu-actions", children: [
2807
+ /* @__PURE__ */ jsx13("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
2808
+ /* @__PURE__ */ jsx13("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
2285
2809
  ] })
2286
- ] }),
2287
- others.length > 0 && /* @__PURE__ */ jsxs10("div", { className: "shg-menu-lbl", children: [
2288
- "Reads columns",
2289
- /* @__PURE__ */ jsx11("div", { className: "shg-menu-deps", children: others.map((c) => /* @__PURE__ */ jsxs10("label", { className: "shg-menu-dep", children: [
2290
- /* @__PURE__ */ jsx11("input", { type: "checkbox", checked: deps.has(c.id), onChange: () => toggleDep(c.id) }),
2291
- " ",
2292
- c.name
2293
- ] }, c.id)) })
2294
2810
  ] })
2295
- ] }),
2296
- /* @__PURE__ */ jsxs10("div", { className: "shg-menu-actions", children: [
2297
- /* @__PURE__ */ jsx11("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
2298
- /* @__PURE__ */ jsx11("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
2299
2811
  ] })
2300
- ] })
2301
- ] }) });
2812
+ }
2813
+ );
2302
2814
  }
2303
2815
  function defaultCellText(cell) {
2304
2816
  const v = cell?.value;
@@ -2335,12 +2847,307 @@ function sheetToAoA(sheet, { cellText = defaultCellValue } = {}) {
2335
2847
  ...rows.map((r) => cols.map((c) => cellText(cells[cellKey(r.id, c.id)], c) ?? ""))
2336
2848
  ];
2337
2849
  }
2850
+
2851
+ // src/components/Carousel.jsx
2852
+ import React9, { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef8, useState as useState9 } from "react";
2853
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
2854
+ function Carousel(props) {
2855
+ const { label, step, children, classNames = {} } = props;
2856
+ const ref = useRef8(null);
2857
+ const [edges, setEdges] = useState9({ start: true, end: true, overflow: false });
2858
+ const measure = useCallback5(() => {
2859
+ const el = ref.current;
2860
+ if (!el) return;
2861
+ const overflow = el.scrollWidth - el.clientWidth > 1;
2862
+ setEdges({
2863
+ overflow,
2864
+ start: el.scrollLeft <= 1,
2865
+ end: el.scrollLeft >= el.scrollWidth - el.clientWidth - 1
2866
+ });
2867
+ }, []);
2868
+ useEffect9(() => {
2869
+ const el = ref.current;
2870
+ if (!el) return void 0;
2871
+ measure();
2872
+ const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : null;
2873
+ ro?.observe(el);
2874
+ for (const child of el.children) ro?.observe(child);
2875
+ return () => ro?.disconnect();
2876
+ }, [measure, children]);
2877
+ const scroll = (dir) => {
2878
+ const el = ref.current;
2879
+ if (!el) return;
2880
+ el.scrollBy({ left: dir * (step || Math.round(el.clientWidth * 0.9)), behavior: "smooth" });
2881
+ };
2882
+ return /* @__PURE__ */ jsxs13("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
2883
+ edges.overflow ? /* @__PURE__ */ jsx14(
2884
+ "button",
2885
+ {
2886
+ type: "button",
2887
+ className: ["uic-carousel-nav is-left", classNames.button || ""].filter(Boolean).join(" "),
2888
+ onClick: () => scroll(-1),
2889
+ disabled: edges.start,
2890
+ "aria-label": `Scroll ${label} left`,
2891
+ children: /* @__PURE__ */ jsx14(Chevron, { dir: "left" })
2892
+ }
2893
+ ) : null,
2894
+ /* @__PURE__ */ jsx14(
2895
+ "div",
2896
+ {
2897
+ className: ["uic-carousel", classNames.viewport || ""].filter(Boolean).join(" "),
2898
+ ref,
2899
+ onScroll: measure,
2900
+ role: "group",
2901
+ "aria-label": label,
2902
+ children
2903
+ }
2904
+ ),
2905
+ edges.overflow ? /* @__PURE__ */ jsx14(
2906
+ "button",
2907
+ {
2908
+ type: "button",
2909
+ className: ["uic-carousel-nav is-right", classNames.button || ""].filter(Boolean).join(" "),
2910
+ onClick: () => scroll(1),
2911
+ disabled: edges.end,
2912
+ "aria-label": `Scroll ${label} right`,
2913
+ children: /* @__PURE__ */ jsx14(Chevron, { dir: "right" })
2914
+ }
2915
+ ) : null
2916
+ ] });
2917
+ }
2918
+
2919
+ // src/components/Card.jsx
2920
+ import React10 from "react";
2921
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
2922
+ function Card(props) {
2923
+ const { art, title, subtitle, onClick, selected = false, overlay, actions, classNames = {} } = props;
2924
+ const foot = /* @__PURE__ */ jsxs14("span", { className: "uic-card-foot", children: [
2925
+ /* @__PURE__ */ jsx15("span", { className: "uic-card-name", children: title }),
2926
+ subtitle ? /* @__PURE__ */ jsx15("span", { className: "uic-card-sub", children: subtitle }) : null
2927
+ ] });
2928
+ return /* @__PURE__ */ jsxs14("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
2929
+ onClick ? /* @__PURE__ */ jsxs14("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
2930
+ /* @__PURE__ */ jsx15("span", { className: "uic-card-art", children: art }),
2931
+ foot
2932
+ ] }) : /* @__PURE__ */ jsxs14("div", { className: "uic-card-main", children: [
2933
+ /* @__PURE__ */ jsx15("span", { className: "uic-card-art", children: art }),
2934
+ foot
2935
+ ] }),
2936
+ overlay ? /* @__PURE__ */ jsx15("div", { className: "uic-card-overlay", children: overlay }) : null,
2937
+ actions ? /* @__PURE__ */ jsx15("div", { className: "uic-card-actions", children: actions }) : null
2938
+ ] });
2939
+ }
2940
+
2941
+ // src/components/SearchField.jsx
2942
+ import React11 from "react";
2943
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
2944
+ function SearchField(props) {
2945
+ const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
2946
+ return /* @__PURE__ */ jsxs15("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
2947
+ /* @__PURE__ */ jsx16("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(IcSearch, {}) }),
2948
+ /* @__PURE__ */ jsx16(
2949
+ "input",
2950
+ {
2951
+ type: "search",
2952
+ value,
2953
+ placeholder,
2954
+ "aria-label": placeholder,
2955
+ onChange: (e) => onChange(e.target.value)
2956
+ }
2957
+ ),
2958
+ value ? /* @__PURE__ */ jsx16("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ jsx16(IcX, { size: 12 }) }) : null
2959
+ ] });
2960
+ }
2961
+
2962
+ // src/components/Popover.jsx
2963
+ import React12, { useCallback as useCallback6, useEffect as useEffect10, useRef as useRef9, useState as useState10 } from "react";
2964
+ import { createPortal as createPortal3 } from "react-dom";
2965
+ import { jsx as jsx17 } from "react/jsx-runtime";
2966
+ var GAP = 6;
2967
+ var MARGIN = 8;
2968
+ function Popover(props) {
2969
+ const {
2970
+ open,
2971
+ anchorRef,
2972
+ onClose,
2973
+ width = 280,
2974
+ minHeight = 140,
2975
+ placement = "auto",
2976
+ children,
2977
+ className,
2978
+ label
2979
+ } = props;
2980
+ const popRef = useRef9(null);
2981
+ const [pos, setPos] = useState10(null);
2982
+ useEffect10(() => {
2983
+ if (!open) {
2984
+ setPos(null);
2985
+ return void 0;
2986
+ }
2987
+ const place = () => {
2988
+ const el = anchorRef?.current;
2989
+ if (!el) return;
2990
+ const r = el.getBoundingClientRect();
2991
+ const vw = window.innerWidth;
2992
+ const vh = window.innerHeight;
2993
+ const w = Math.min(width, vw - MARGIN * 2);
2994
+ const below = vh - r.bottom - GAP - MARGIN;
2995
+ const above = r.top - GAP - MARGIN;
2996
+ const up = placement === "above" || placement === "auto" && below < minHeight && above > below;
2997
+ const maxHeight = Math.max(minHeight, Math.floor(up ? above : below));
2998
+ const left = Math.max(MARGIN, Math.min(r.left, vw - w - MARGIN));
2999
+ setPos(up ? { left, bottom: Math.round(vh - r.top + GAP), width: w, maxHeight } : { left, top: Math.round(r.bottom + GAP), width: w, maxHeight });
3000
+ };
3001
+ place();
3002
+ window.addEventListener("resize", place);
3003
+ window.addEventListener("scroll", place, true);
3004
+ return () => {
3005
+ window.removeEventListener("resize", place);
3006
+ window.removeEventListener("scroll", place, true);
3007
+ };
3008
+ }, [open, anchorRef, width, minHeight, placement]);
3009
+ useEffect10(() => {
3010
+ if (!open) return void 0;
3011
+ const onDown = (e) => {
3012
+ if (popRef.current?.contains(e.target)) return;
3013
+ if (anchorRef?.current?.contains(e.target)) return;
3014
+ onClose?.();
3015
+ };
3016
+ document.addEventListener("pointerdown", onDown);
3017
+ return () => document.removeEventListener("pointerdown", onDown);
3018
+ }, [open, anchorRef, onClose]);
3019
+ const escape = useCallback6(() => onClose?.(), [onClose]);
3020
+ useOverlayEscape(open, escape);
3021
+ if (!open || !pos || typeof document === "undefined") return null;
3022
+ return createPortal3(
3023
+ /* @__PURE__ */ jsx17(
3024
+ "div",
3025
+ {
3026
+ ref: popRef,
3027
+ className: ["uic-pop", className || ""].filter(Boolean).join(" "),
3028
+ style: pos,
3029
+ role: "dialog",
3030
+ "aria-label": label,
3031
+ children
3032
+ }
3033
+ ),
3034
+ document.body
3035
+ );
3036
+ }
3037
+
3038
+ // src/components/Modal.jsx
3039
+ import React13, { useCallback as useCallback7, useEffect as useEffect11, useId as useId2 } from "react";
3040
+ import { createPortal as createPortal4 } from "react-dom";
3041
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
3042
+ function Modal(props) {
3043
+ const {
3044
+ open,
3045
+ onClose,
3046
+ title,
3047
+ description,
3048
+ actions,
3049
+ size = "md",
3050
+ width,
3051
+ labelledBy,
3052
+ children,
3053
+ classNames = {}
3054
+ } = props;
3055
+ const titleId = useId2();
3056
+ const escape = useCallback7(() => onClose?.(), [onClose]);
3057
+ useOverlayEscape(open, escape);
3058
+ useEffect11(() => {
3059
+ if (!open || typeof document === "undefined") return void 0;
3060
+ const prev = document.body.style.overflow;
3061
+ document.body.style.overflow = "hidden";
3062
+ return () => {
3063
+ document.body.style.overflow = prev;
3064
+ };
3065
+ }, [open]);
3066
+ if (!open || typeof document === "undefined") return null;
3067
+ const onBackdrop = (e) => {
3068
+ if (e.target === e.currentTarget) onClose?.();
3069
+ };
3070
+ return createPortal4(
3071
+ /* @__PURE__ */ jsx18(
3072
+ "div",
3073
+ {
3074
+ className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
3075
+ onMouseDown: onBackdrop,
3076
+ children: /* @__PURE__ */ jsxs16(
3077
+ "div",
3078
+ {
3079
+ className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
3080
+ style: width ? { width } : void 0,
3081
+ role: "dialog",
3082
+ "aria-modal": "true",
3083
+ "aria-labelledby": labelledBy || (title ? titleId : void 0),
3084
+ children: [
3085
+ title || actions ? /* @__PURE__ */ jsxs16("div", { className: "uic-modal-h", children: [
3086
+ /* @__PURE__ */ jsxs16("div", { className: "uic-modal-title", children: [
3087
+ title ? /* @__PURE__ */ jsx18("h3", { id: titleId, children: title }) : null,
3088
+ description ? /* @__PURE__ */ jsx18("p", { children: description }) : null
3089
+ ] }),
3090
+ actions,
3091
+ /* @__PURE__ */ jsx18("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx18(IcX, { size: 18 }) })
3092
+ ] }) : null,
3093
+ /* @__PURE__ */ jsx18("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
3094
+ ]
3095
+ }
3096
+ )
3097
+ }
3098
+ ),
3099
+ document.body
3100
+ );
3101
+ }
3102
+
3103
+ // src/hooks/useTypewriter.js
3104
+ import { useEffect as useEffect12, useRef as useRef10, useState as useState11 } from "react";
3105
+ var CHAR_MS = 26;
3106
+ var HOLD_MS = 2600;
3107
+ function useTypewriter(phrases, { active = true } = {}) {
3108
+ const list = phrases && phrases.length ? phrases : [""];
3109
+ const [text, setText] = useState11(list[0]);
3110
+ const listRef = useRef10(list);
3111
+ listRef.current = list;
3112
+ useEffect12(() => {
3113
+ if (!active) return void 0;
3114
+ if (typeof window === "undefined") return void 0;
3115
+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
3116
+ setText(listRef.current[0]);
3117
+ return void 0;
3118
+ }
3119
+ let i = 0;
3120
+ let pos = 0;
3121
+ let timer;
3122
+ const tick = () => {
3123
+ const cur = listRef.current[i % listRef.current.length];
3124
+ if (pos <= cur.length) {
3125
+ setText(cur.slice(0, pos));
3126
+ pos += 1;
3127
+ timer = window.setTimeout(tick, CHAR_MS);
3128
+ } else {
3129
+ timer = window.setTimeout(() => {
3130
+ i += 1;
3131
+ pos = 0;
3132
+ tick();
3133
+ }, HOLD_MS);
3134
+ }
3135
+ };
3136
+ tick();
3137
+ return () => window.clearTimeout(timer);
3138
+ }, [active]);
3139
+ return text;
3140
+ }
2338
3141
  export {
2339
3142
  AssistantTurn,
2340
3143
  AuthForm,
3144
+ Card,
3145
+ Carousel,
2341
3146
  ChatMessages,
2342
3147
  ChatMessagesSkeleton,
3148
+ ChatPanel,
2343
3149
  Chevron,
3150
+ Chip,
2344
3151
  CodeBlock,
2345
3152
  Composer,
2346
3153
  DEFAULT_STATUS_LABELS,
@@ -2351,6 +3158,9 @@ export {
2351
3158
  IcDoc,
2352
3159
  IcGlobe,
2353
3160
  IcList,
3161
+ IcMic,
3162
+ IcPanelRight,
3163
+ IcPaperclip,
2354
3164
  IcPlug,
2355
3165
  IcScroll,
2356
3166
  IcSearch,
@@ -2360,8 +3170,12 @@ export {
2360
3170
  IcTerminal,
2361
3171
  IcThink,
2362
3172
  IcTool,
3173
+ IcX,
3174
+ Modal,
2363
3175
  PaneResizer,
3176
+ Popover,
2364
3177
  SESSION_EVENT,
3178
+ SearchField,
2365
3179
  SheetGrid,
2366
3180
  Svg,
2367
3181
  TaskList,
@@ -2372,9 +3186,11 @@ export {
2372
3186
  authConfig,
2373
3187
  authFetch,
2374
3188
  baseName,
3189
+ bytesLabel,
2375
3190
  clearSession,
2376
3191
  configureAuth,
2377
3192
  createConversationStore,
3193
+ createDictation,
2378
3194
  createResponsesDispatcher,
2379
3195
  fetchBalance,
2380
3196
  getSession,
@@ -2398,8 +3214,10 @@ export {
2398
3214
  switchOrg,
2399
3215
  taskStatusGroup,
2400
3216
  toolMeta,
3217
+ turnsToMessages,
2401
3218
  useDialog,
2402
3219
  useResizablePane,
3220
+ useTypewriter,
2403
3221
  withReasoning,
2404
3222
  withResult,
2405
3223
  withStep,