@ai-matrx/design-system 0.18.9 → 0.18.12

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 (68) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/content-transfer/alchemy.svg +1 -1
  3. package/dist/content-transfer/icon.cjs +3 -1
  4. package/dist/content-transfer/icon.cjs.map +1 -1
  5. package/dist/content-transfer/icon.d.cts +3 -2
  6. package/dist/content-transfer/icon.d.ts +3 -2
  7. package/dist/content-transfer/icon.js +3 -1
  8. package/dist/content-transfer/icon.js.map +1 -1
  9. package/dist/content-transfer.cjs +442 -447
  10. package/dist/content-transfer.cjs.map +1 -1
  11. package/dist/content-transfer.css +130 -54
  12. package/dist/content-transfer.d.cts +5 -1
  13. package/dist/content-transfer.d.ts +5 -1
  14. package/dist/content-transfer.js +467 -472
  15. package/dist/content-transfer.js.map +1 -1
  16. package/dist/data-table/copy-helpers.d.cts +1 -1
  17. package/dist/data-table/copy-helpers.d.ts +1 -1
  18. package/dist/data-table/copy-types.cjs.map +1 -1
  19. package/dist/data-table/copy-types.d.cts +1 -1
  20. package/dist/data-table/copy-types.d.ts +1 -1
  21. package/dist/data-table/data-row-inspector.cjs +444 -446
  22. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  23. package/dist/data-table/data-row-inspector.js +489 -491
  24. package/dist/data-table/data-row-inspector.js.map +1 -1
  25. package/dist/data-table/data-row-window.cjs +444 -446
  26. package/dist/data-table/data-row-window.cjs.map +1 -1
  27. package/dist/data-table/data-row-window.js +489 -491
  28. package/dist/data-table/data-row-window.js.map +1 -1
  29. package/dist/data-table/filter-engine.d.cts +1 -1
  30. package/dist/data-table/filter-engine.d.ts +1 -1
  31. package/dist/data-table/host.cjs.map +1 -1
  32. package/dist/data-table/host.d.cts +17 -1
  33. package/dist/data-table/host.d.ts +17 -1
  34. package/dist/data-table/host.js.map +1 -1
  35. package/dist/data-table/index.cjs +1524 -1011
  36. package/dist/data-table/index.cjs.map +1 -1
  37. package/dist/data-table/index.d.cts +25 -4
  38. package/dist/data-table/index.d.ts +25 -4
  39. package/dist/data-table/index.js +1560 -1047
  40. package/dist/data-table/index.js.map +1 -1
  41. package/dist/data-table/infer-filter.d.cts +1 -1
  42. package/dist/data-table/infer-filter.d.ts +1 -1
  43. package/dist/data-table/layered-filters.d.cts +1 -1
  44. package/dist/data-table/layered-filters.d.ts +1 -1
  45. package/dist/data-table/pagination.cjs +5 -5
  46. package/dist/data-table/pagination.cjs.map +1 -1
  47. package/dist/data-table/pagination.js +5 -5
  48. package/dist/data-table/pagination.js.map +1 -1
  49. package/dist/data-table/query-control.d.cts +1 -1
  50. package/dist/data-table/query-control.d.ts +1 -1
  51. package/dist/data-table/types.cjs.map +1 -1
  52. package/dist/data-table/types.d.cts +1 -1
  53. package/dist/data-table/types.d.ts +1 -1
  54. package/dist/data-table/url-state.d.cts +1 -1
  55. package/dist/data-table/url-state.d.ts +1 -1
  56. package/dist/data-table/uuid-cell.cjs.map +1 -1
  57. package/dist/data-table/uuid-cell.js.map +1 -1
  58. package/dist/data-table/xlsx.d.cts +1 -1
  59. package/dist/data-table/xlsx.d.ts +1 -1
  60. package/dist/index.cjs +5 -5
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.js +5 -5
  63. package/dist/index.js.map +1 -1
  64. package/dist/styles.css +4 -0
  65. package/dist/tokens.css +2 -0
  66. package/dist/{types-cH8oLqUx.d.ts → types-BuDKVpeF.d.ts} +47 -3
  67. package/dist/{types-0CNCWvdK.d.cts → types-Dqcb7jXO.d.cts} +47 -3
  68. package/package.json +2 -2
@@ -95,48 +95,6 @@ function XIcon(props) {
95
95
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })
96
96
  ] });
97
97
  }
98
- function radixProps(props) {
99
- return {
100
- xmlns: "http://www.w3.org/2000/svg",
101
- viewBox: "0 0 15 15",
102
- width: 15,
103
- height: 15,
104
- fill: "none",
105
- "aria-hidden": true,
106
- ...props
107
- };
108
- }
109
- function CheckIcon(props) {
110
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
- "path",
112
- {
113
- d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
114
- fill: "currentColor",
115
- fillRule: "evenodd",
116
- clipRule: "evenodd"
117
- }
118
- ) });
119
- }
120
- function DotFilledIcon(props) {
121
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
- "path",
123
- {
124
- d: "M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",
125
- fill: "currentColor"
126
- }
127
- ) });
128
- }
129
- function RadixChevronRightIcon(props) {
130
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
131
- "path",
132
- {
133
- d: "M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",
134
- fill: "currentColor",
135
- fillRule: "evenodd",
136
- clipRule: "evenodd"
137
- }
138
- ) });
139
- }
140
98
 
141
99
  // src/portal-container.tsx
142
100
  var React = __toESM(require("react"), 1);
@@ -529,141 +487,54 @@ var Button = React5.forwardRef(
529
487
  );
530
488
  Button.displayName = "Button";
531
489
 
532
- // src/dropdown-menu.tsx
533
- var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
490
+ // src/popover.tsx
491
+ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
534
492
  var React6 = __toESM(require("react"), 1);
535
493
  var import_jsx_runtime9 = require("react/jsx-runtime");
536
- var DropdownMenu = DropdownMenuPrimitive.Root;
537
- var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
538
- var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
539
- var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
540
- var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
541
- var DropdownMenuSubTrigger = React6.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
542
- DropdownMenuPrimitive.SubTrigger,
543
- {
544
- ref,
545
- "data-slot": "dropdown-menu-sub-trigger",
546
- className: cn(
547
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
548
- inset && "pl-8",
549
- className
550
- ),
551
- ...props,
552
- children: [
553
- children,
554
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
555
- ]
556
- }
557
- ));
558
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
559
- var DropdownMenuSubContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
560
- DropdownMenuPrimitive.SubContent,
561
- {
562
- ref,
563
- "data-slot": "dropdown-menu-sub-content",
564
- className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
565
- ...props
566
- }
567
- ));
568
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
569
- var DropdownMenuContent = React6.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
570
- const portalContainer = usePortalContainer(container);
571
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
572
- DropdownMenuPrimitive.Content,
573
- {
574
- ref,
575
- "data-slot": "dropdown-menu-content",
576
- sideOffset,
577
- className: cn(
578
- MENU_SURFACE_CLASS,
579
- "shadow-md",
580
- MOTION_POPPER,
581
- className
582
- ),
583
- ...props
584
- }
585
- ) });
586
- });
587
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
588
- var DropdownMenuItem = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
589
- DropdownMenuPrimitive.Item,
590
- {
591
- ref,
592
- "data-slot": "dropdown-menu-item",
593
- className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
594
- ...props
595
- }
596
- ));
597
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
598
- var DropdownMenuCheckboxItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
599
- DropdownMenuPrimitive.CheckboxItem,
600
- {
601
- ref,
602
- "data-slot": "dropdown-menu-checkbox-item",
603
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
604
- ...props,
605
- children: [
606
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
607
- children
608
- ]
609
- }
610
- ));
611
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
612
- var DropdownMenuRadioItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
613
- DropdownMenuPrimitive.RadioItem,
614
- {
615
- ref,
616
- "data-slot": "dropdown-menu-radio-item",
617
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
618
- ...props,
619
- children: [
620
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
621
- children
622
- ]
623
- }
624
- ));
625
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
626
- var DropdownMenuLabel = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
627
- DropdownMenuPrimitive.Label,
628
- {
629
- ref,
630
- "data-slot": "dropdown-menu-label",
631
- className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
632
- ...props
633
- }
634
- ));
635
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
636
- var DropdownMenuSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
637
- DropdownMenuPrimitive.Separator,
638
- {
639
- ref,
640
- "data-slot": "dropdown-menu-separator",
641
- className: cn("-mx-1 my-1 h-px bg-muted", className),
642
- ...props
643
- }
644
- ));
645
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
646
- var DropdownMenuShortcut = ({
647
- className,
648
- ...props
649
- }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
650
- "span",
651
- {
652
- "data-slot": "dropdown-menu-shortcut",
653
- className: cn("ml-auto text-xs tracking-widest opacity-60", className),
494
+ var Popover = PopoverPrimitive.Root;
495
+ var PopoverTrigger = PopoverPrimitive.Trigger;
496
+ var PopoverContent = React6.forwardRef(
497
+ ({
498
+ className,
499
+ align = "center",
500
+ sideOffset = 4,
501
+ container,
502
+ animated = true,
654
503
  ...props
504
+ }, ref) => {
505
+ const portalContainer = usePortalContainer(container);
506
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
507
+ PopoverPrimitive.Content,
508
+ {
509
+ ref,
510
+ align,
511
+ sideOffset,
512
+ className: cn(
513
+ // Cap to the viewport space Radix measured and scroll — a popover taller
514
+ // than the screen must never trap the user with unreachable content.
515
+ // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
516
+ // z, DOM portal order decides, so a dialog opened FROM a popover stacks
517
+ // above it, and a popover opened from a dialog still stacks above the
518
+ // dialog. z-[10001] buried dialogs behind fullscreen popovers.
519
+ "z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
520
+ animated && MOTION_POPPER,
521
+ className
522
+ ),
523
+ ...props
524
+ }
525
+ ) });
655
526
  }
656
527
  );
657
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
528
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
529
+
530
+ // src/content-transfer/icon.ts
531
+ var ALCHEMY_GLYPH_PATHS = ["M9 3h6", "M10 3v6l-5.2 8.7A2 2 0 0 0 6.5 21h11a2 2 0 0 0 1.7-3.3L14 9V3", "M8 15h8"];
532
+ var ALCHEMY_GLYPH_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${ALCHEMY_GLYPH_PATHS.map((d) => `<path d="${d}"/>`).join("")}</svg>`;
658
533
 
659
534
  // src/content-transfer/index.tsx
660
535
  var import_jsx_runtime10 = require("react/jsx-runtime");
661
536
  function AlchemyGlyph(props) {
662
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: [
663
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4.5 5.5h8v11h-8z" }),
664
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M8.5 9.5h8v9h-8z" }),
665
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m18.5 3 .65 1.85L21 5.5l-1.85.65L18.5 8l-.65-1.85L16 5.5l1.85-.65z" })
666
- ] });
537
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: ALCHEMY_GLYPH_PATHS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d }, d)) });
667
538
  }
668
539
  var CapabilityContext = React7.createContext({});
669
540
  var useContentTransferCapabilities = () => React7.useContext(CapabilityContext);
@@ -677,6 +548,62 @@ function MenuPresentation({ label, hint, icon: Icon2 }) {
677
548
  ] })
678
549
  ] });
679
550
  }
551
+ function PaletteGlyph({ format, ai = false, file = false, kind }) {
552
+ if (kind === "ai-copy") return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
553
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
554
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
556
+ ] });
557
+ if (kind === "sliders") return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
558
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 6h16M4 12h16M4 18h16" }),
559
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M8 3v6M16 9v6M10 15v6" })
560
+ ] });
561
+ if (ai) return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
562
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 5a3 3 0 1 0-5.997.125A4 4 0 0 0 3.5 10.9a4 4 0 0 0 .556 6.588A4 4 0 0 0 12 19" }),
563
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.503 5.775 4 4 0 0 1-.556 6.588A4 4 0 0 1 12 19" }),
564
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
565
+ ] });
566
+ if (file) return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
567
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 3h8l4 4v14H6z" }),
568
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
569
+ ] });
570
+ const path = format === "json" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
571
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
572
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
573
+ ] }) : format === "compact-json" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
574
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m14 10 7-7" }),
575
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M20 10h-6V4" }),
576
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m3 21 7-7" }),
577
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 14h6v6" })
578
+ ] }) : format === "csv" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
579
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
580
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 10h16M10 4v16" })
581
+ ] }) : format === "tsv" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
582
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
583
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
584
+ ] }) : format === "xlsx" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
585
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
586
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
587
+ ] }) : format === "markdown" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
588
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
589
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
590
+ ] }) : format === "html" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
591
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: path });
592
+ }
593
+ function PaletteRows({ title, items, onRun, extra, ai = false, glyphKind, fallbackHint }) {
594
+ if (!items.length && !extra) return null;
595
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
596
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { children: title }),
597
+ items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
598
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
599
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
600
+ item.copyLabel ?? item.label,
601
+ item.hint ?? fallbackHint ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: item.hint ?? fallbackHint }) : null
602
+ ] })
603
+ ] }, item.id)),
604
+ extra
605
+ ] });
606
+ }
680
607
  var LABEL = { plain: "Plain text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact JSON", csv: "CSV", tsv: "Google Sheets", xlsx: "Excel workbook" };
681
608
  var BUILT_INS = Object.freeze(Object.keys(LABEL).map((id) => ({ id })));
682
609
  var COPIES = ["plain", "markdown", "html", "json", "compact-json", "csv", "tsv"];
@@ -765,7 +692,7 @@ function ContentTransferMenu(props) {
765
692
  const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
766
693
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
767
694
  }
768
- function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
695
+ function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, sourceFormats = true, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
769
696
  const triggerRef = React7.useRef(null);
770
697
  const inherited = React7.useContext(CapabilityContext);
771
698
  const nearestSurface = React7.useContext(SurfaceContext);
@@ -778,6 +705,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
778
705
  const workspaceCaptures = React7.useRef(/* @__PURE__ */ new Map());
779
706
  const externalWorkspaceKeys = React7.useRef(/* @__PURE__ */ new Set());
780
707
  const [notice, setNotice] = React7.useState(null);
708
+ const [paletteOpen, setPaletteOpen] = React7.useState(false);
709
+ const [mode, setMode] = React7.useState("copy");
781
710
  const scopes = React7.useMemo(() => table?.availableScopes ?? ["target"], [table]);
782
711
  const initialScope = table?.initialScope ?? "target";
783
712
  if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
@@ -1029,48 +958,96 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
1029
958
  }, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
1030
959
  if (!enabled) return null;
1031
960
  const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
1032
- const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section).map((v) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { "aria-label": v.ariaLabel, onSelect: () => void transfer("markdown", false, v), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...v, label: v.copyLabel }) }, `copy:${v.id}`));
1033
- const visibleCopies = COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows");
1034
- const visibleDownloads = DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows");
1035
- const visibleAdapters = menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
961
+ const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
962
+ const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
963
+ const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
964
+ const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
1036
965
  const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
966
+ const downloadActions = visibleActions.filter((action) => action.placement === "download");
967
+ const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
968
+ const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
969
+ const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
970
+ const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
971
+ const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
972
+ const closePalette = () => setPaletteOpen(false);
973
+ const tile = (id, label2, onClick, options = {}) => {
974
+ const presentation = options.action;
975
+ const Icon2 = presentation?.icon;
976
+ const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
977
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
978
+ closePalette();
979
+ onClick();
980
+ }, children: [
981
+ Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
982
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
983
+ label2,
984
+ presentation?.hint ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
985
+ ] })
986
+ ] }, id);
987
+ };
1037
988
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
1038
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenu, { onOpenChange: (open) => {
1039
- if (open) void preflight();
989
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
990
+ setPaletteOpen(open);
991
+ if (open) {
992
+ setMode("copy");
993
+ void preflight();
994
+ }
1040
995
  }, children: [
1041
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlchemyGlyph, {}) }) }),
1042
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuContent, { align: "end", className: "matrx-alchemy-menu", children: [
1043
- menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { disabled: true, children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { disabled: true, children: menuStatus }) : null,
1044
- !hide.includes("copy") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1045
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuLabel, { children: "Copy" }),
1046
- quickVariants("copy"),
1047
- visibleCopies.map((format) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void transfer(format, false), children: format === "plain" ? "Copy" : `Copy ${LABEL[format]}` }, format)),
1048
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, false), children: [
1049
- "Copy ",
1050
- adapter.label
1051
- ] }, adapter.id))
1052
- ] }) : null,
1053
- !hide.includes("prepare") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1054
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuSeparator, {}),
1055
- quickVariants("ai"),
1056
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(), children: "Prepare for AI\u2026" }),
1057
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName }), children: "Prepare this surface\u2026" }) : null,
1058
- variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(variantWorkspaceKeys.get(variant.id), variant), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
996
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlchemyGlyph, {}) }) }),
997
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
998
+ menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
999
+ copyAvailable || downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: "matrx-alchemy-output", children: [
1000
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
1001
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
1002
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
1003
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
1004
+ ] }) : null,
1005
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1006
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
1007
+ visibleCopies.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets" }[format], () => void transfer(format, false), { ariaLabel: `Copy ${LABEL[format]}` })),
1008
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
1009
+ ] }),
1010
+ quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
1011
+ closePalette();
1012
+ void transfer("markdown", false, variant);
1013
+ } }) : null
1014
+ ] }) : null,
1015
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
1016
+ visibleDownloads.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets", xlsx: "Excel" }[format], () => void transfer(format, true), { ariaLabel: `Download ${LABEL[format]}` })),
1017
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
1018
+ downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
1019
+ ] }) }) : null
1059
1020
  ] }) : null,
1060
- !hide.includes("download") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1061
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuSeparator, {}),
1062
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuLabel, { children: "Download" }),
1063
- visibleDownloads.map((format) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(format, true), children: [
1064
- "Download ",
1065
- LABEL[format]
1066
- ] }, format)),
1067
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, true), children: [
1068
- "Download ",
1069
- adapter.label
1070
- ] }, `download:${adapter.id}`))
1021
+ prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1022
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", items: quickVariants("ai"), onRun: (variant) => {
1023
+ closePalette();
1024
+ void transfer("markdown", false, variant);
1025
+ } }),
1026
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
1027
+ closePalette();
1028
+ void openWorkspace();
1029
+ }, children: [
1030
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { kind: "sliders" }),
1031
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1032
+ "Prepare for AI",
1033
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
1034
+ ] })
1035
+ ] }) })
1071
1036
  ] }) : null,
1072
- visibleActions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuSeparator, {}) : null,
1073
- visibleActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { "aria-label": action.ariaLabel, onSelect: () => void runAction(action), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id))
1037
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1038
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1039
+ closePalette();
1040
+ void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
1041
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Prepare this surface" }) }) : null,
1042
+ variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
1043
+ closePalette();
1044
+ void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
1045
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
1046
+ ] }) }) : null,
1047
+ ordinaryActions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
1048
+ closePalette();
1049
+ void runAction(action);
1050
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
1074
1051
  ] })
1075
1052
  ] }),
1076
1053
  notice ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "matrx-alchemy-notice", role: "status", children: notice }) : null,
@@ -1343,137 +1320,138 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1343
1320
  state.snapshot.label
1344
1321
  ] }),
1345
1322
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogDescription, { children: [
1346
- "Captured ",
1347
- state.snapshot.unsavedChanges ? "from your unsaved draft" : "as an immutable snapshot",
1348
- ". Your source is never edited."
1323
+ state.snapshot.unsavedChanges ? "Includes your unsaved changes. " : "",
1324
+ "Review and edit this copy. Your original stays unchanged."
1349
1325
  ] })
1350
1326
  ] }),
1351
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-workspace-grid", children: [
1352
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: "matrx-alchemy-main", children: [
1353
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
1354
- scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1355
- "Scope",
1356
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1357
- ] }) : null,
1358
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1359
- "Detail",
1360
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1361
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "full", children: "Full" }),
1362
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "compact", children: "Compact" }),
1363
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "brief", children: "Brief" }),
1364
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "custom", children: "Custom" })
1365
- ] })
1366
- ] }),
1367
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", size: "sm", variant: "outline", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1368
- setBufferError(null);
1369
- if (controlsHistory.length) {
1370
- const next = controlsHistory[controlsHistory.length - 1];
1327
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-workspace-body", children: [
1328
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-workspace-grid", children: [
1329
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: "matrx-alchemy-main", children: [
1330
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
1331
+ scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1332
+ "Scope",
1333
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1334
+ ] }) : null,
1335
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1336
+ "Detail",
1337
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1338
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "full", children: "Full" }),
1339
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "compact", children: "Compact" }),
1340
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "brief", children: "Brief" }),
1341
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "custom", children: "Custom" })
1342
+ ] })
1343
+ ] }),
1344
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1345
+ setBufferError(null);
1346
+ if (controlsHistory.length) {
1347
+ const next = controlsHistory[controlsHistory.length - 1];
1348
+ setControls(next);
1349
+ setControlsHistory((history) => history.slice(0, -1));
1350
+ onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1351
+ } else onChange({ ...state, draft: (0, import_content_transfer.undoDraft)(state.draft), error: void 0 });
1352
+ }, children: "Undo" }),
1353
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
1354
+ const next = initialControls(state);
1371
1355
  setControls(next);
1372
- setControlsHistory((history) => history.slice(0, -1));
1356
+ setControlsHistory([]);
1357
+ setPendingControls(null);
1358
+ setBufferError(null);
1373
1359
  onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1374
- } else onChange({ ...state, draft: (0, import_content_transfer.undoDraft)(state.draft), error: void 0 });
1375
- }, children: "Undo" }),
1376
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => {
1377
- const next = initialControls(state);
1378
- setControls(next);
1379
- setControlsHistory([]);
1380
- setPendingControls(null);
1381
- setBufferError(null);
1382
- onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1383
- }, children: "Reset" }),
1384
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1385
- ] }),
1386
- controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1387
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: "JSON limits" }),
1388
- [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1389
- text,
1390
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1391
- ] }, key))
1392
- ] }) : null,
1393
- rows ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RowControls, { rows, controls, change: changeControls }) : null,
1394
- state.snapshot.sections.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1395
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: "Sections" }),
1396
- state.snapshot.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1397
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: controls.sections.includes(section.id), onChange: (e) => changeControls({ ...controls, sections: e.target.checked ? [...controls.sections, section.id] : controls.sections.filter((id) => id !== section.id) }) }),
1398
- " ",
1399
- section.label
1400
- ] }, section.id))
1401
- ] }) : null,
1402
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-coverage", children: [
1403
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1404
- state.snapshot.coverage.included.toLocaleString(),
1405
- " included",
1406
- state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1407
- " \xB7 ",
1408
- state.snapshot.coverage.status
1360
+ }, children: "Reset" }),
1361
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1409
1362
  ] }),
1410
- state.snapshot.coverage.reason ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: state.snapshot.coverage.reason }) : null,
1411
- limitText ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1412
- "Limits: ",
1413
- limitText
1363
+ controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1364
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: "JSON limits" }),
1365
+ [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1366
+ text,
1367
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1368
+ ] }, key))
1414
1369
  ] }) : null,
1415
- displayedOmissions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { children: [
1416
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("summary", { children: [
1417
- displayedOmissions.length,
1418
- " omissions or adjustments"
1370
+ rows ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RowControls, { rows, controls, change: changeControls }) : null,
1371
+ state.snapshot.sections.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1372
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: "Sections" }),
1373
+ state.snapshot.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: controls.sections.includes(section.id), onChange: (e) => changeControls({ ...controls, sections: e.target.checked ? [...controls.sections, section.id] : controls.sections.filter((id) => id !== section.id) }) }),
1375
+ " ",
1376
+ section.label
1377
+ ] }, section.id))
1378
+ ] }) : null,
1379
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-coverage", children: [
1380
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1381
+ state.snapshot.coverage.included.toLocaleString(),
1382
+ " included",
1383
+ state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1384
+ " \xB7 ",
1385
+ state.snapshot.coverage.status
1419
1386
  ] }),
1420
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { children: [
1421
- o.path || "/",
1422
- ": ",
1423
- o.reason,
1424
- o.count == null ? "" : ` (${o.count})`
1425
- ] }, `${o.path}-${o.reason}-${i}`)) })
1426
- ] }) : null
1427
- ] }),
1428
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "matrx-alchemy-preview-label", children: [
1429
- "Output format",
1430
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1431
- formats.map((f) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: f, children: LABEL[f] }, f)),
1432
- state.draft.payload.kind === "rows" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "xlsx", children: "Excel workbook" }) : null,
1433
- workspaceAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: adapter.id, children: adapter.label }, adapter.id))
1434
- ] })
1387
+ state.snapshot.coverage.reason ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: state.snapshot.coverage.reason }) : null,
1388
+ limitText ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
1389
+ "Limits: ",
1390
+ limitText
1391
+ ] }) : null,
1392
+ displayedOmissions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { children: [
1393
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("summary", { children: [
1394
+ displayedOmissions.length,
1395
+ " omissions or adjustments"
1396
+ ] }),
1397
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { children: [
1398
+ o.path || "/",
1399
+ ": ",
1400
+ o.reason,
1401
+ o.count == null ? "" : ` (${o.count})`
1402
+ ] }, `${o.path}-${o.reason}-${i}`)) })
1403
+ ] }) : null
1404
+ ] }),
1405
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "matrx-alchemy-preview-label", children: [
1406
+ "Output format",
1407
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1408
+ formats.map((f) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: f, children: LABEL[f] }, f)),
1409
+ state.draft.payload.kind === "rows" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "xlsx", children: "Excel workbook" }) : null,
1410
+ workspaceAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: adapter.id, children: adapter.label }, adapter.id))
1411
+ ] })
1412
+ ] }),
1413
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("textarea", { className: "matrx-alchemy-preview", "aria-label": "Prepared output", "aria-invalid": bufferError ? true : void 0, "aria-describedby": bufferError ? "alchemy-buffer-error" : void 0, value: buffer, onChange: (e) => editBuffer(e.target.value) }),
1414
+ bufferError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1415
+ formatError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1416
+ bufferError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1417
+ const fallback = (0, import_content_transfer.editDraft)(state.draft, { kind: "text", text: buffer });
1418
+ setBufferError(null);
1419
+ onChange({ ...state, draft: fallback, error: void 0 });
1420
+ setFormat("plain");
1421
+ }, children: "Use invalid JSON as plain text" }) : null
1435
1422
  ] }),
1436
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("textarea", { className: "matrx-alchemy-preview", "aria-label": "Prepared output", "aria-invalid": bufferError ? true : void 0, "aria-describedby": bufferError ? "alchemy-buffer-error" : void 0, value: buffer, onChange: (e) => editBuffer(e.target.value) }),
1437
- bufferError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1438
- formatError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1439
- bufferError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1440
- const fallback = (0, import_content_transfer.editDraft)(state.draft, { kind: "text", text: buffer });
1441
- setBufferError(null);
1442
- onChange({ ...state, draft: fallback, error: void 0 });
1443
- setFormat("plain");
1444
- }, children: "Use invalid JSON as plain text" }) : null
1423
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("aside", { children: [
1424
+ ai ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1425
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1426
+ "AI instruction",
1427
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1428
+ ] }),
1429
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: !aiSession.current || !instruction.trim() || busy !== null || !aiSession.current.supports(state.snapshot), onClick: () => void runAi(false), children: "Generate preview" }),
1430
+ busy === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1431
+ ] }) : null,
1432
+ busy === "capture" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
1433
+ activeCapture.current?.abort();
1434
+ activeCapture.current = null;
1435
+ setBusy(null);
1436
+ }, children: "Stop loading rows" }) : null,
1437
+ ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
1438
+ ai ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "matrx-alchemy-meta", children: "AI updates the preview; copy it when you are ready. Closing this window lets the AI run continue." }) : null,
1439
+ state.error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1440
+ ] }) : null
1445
1441
  ] }),
1446
- ai || busy === "capture" || state.error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("aside", { children: [
1447
- ai ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1448
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1449
- "AI instruction",
1450
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1451
- ] }),
1452
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", disabled: !aiSession.current || !instruction.trim() || busy !== null || !aiSession.current.supports(state.snapshot), onClick: () => void runAi(false), children: "Generate preview" }),
1453
- busy === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1454
- ] }) : null,
1455
- busy === "capture" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", onClick: () => {
1456
- activeCapture.current?.abort();
1457
- activeCapture.current = null;
1458
- setBusy(null);
1459
- }, children: "Stop loading rows" }) : null,
1460
- ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
1461
- ai ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "matrx-alchemy-meta", children: "AI creates a preview. It never copies automatically. Closing detaches this view without cancelling server work." }) : null,
1462
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1463
- ] }) : null
1442
+ pendingControls ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1443
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "This control would replace your manual edit." }),
1444
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1445
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1446
+ ] }) : null,
1447
+ state.sourceStale ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1448
+ state.pending ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1449
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "A fresh source snapshot is ready." }),
1450
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1451
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1452
+ ] }) : null,
1453
+ deliveryNotice ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
1464
1454
  ] }),
1465
- pendingControls ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1466
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "This control would replace your manual edit." }),
1467
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1468
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1469
- ] }) : null,
1470
- state.sourceStale ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1471
- state.pending ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1472
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: "A fresh source snapshot is ready." }),
1473
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1474
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1475
- ] }) : null,
1476
- deliveryNotice ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null,
1477
1455
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogFooter, { children: [
1478
1456
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "matrx-alchemy-meta", children: [
1479
1457
  buffer.length.toLocaleString(),
@@ -1481,13 +1459,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1481
1459
  estimateTokens(buffer).toLocaleString(),
1482
1460
  " tokens"
1483
1461
  ] }),
1484
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", onClick: close, children: "Close" }),
1485
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(true), children: "Download prepared output" }),
1486
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(false), children: "Copy prepared output" })
1462
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
1463
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", "aria-label": "Download prepared output", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(true), children: "Download" }),
1464
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { type: "button", className: "matrx-alchemy-workspace-primary", "aria-label": "Copy prepared output", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(false), children: "Copy" })
1487
1465
  ] })
1488
1466
  ] }) });
1489
1467
  }
1490
1468
  function RowControls({ rows, controls, change }) {
1469
+ const filterCount = Object.values(controls.filters).filter(Boolean).length;
1470
+ const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
1471
+ const dataSummary = [controls.search ? "search active" : "", controls.sort ? `sorted by ${rows.columns.find((column) => column.id === controls.sort)?.label ?? controls.sort}` : "", filterCount ? `${filterCount} filter${filterCount === 1 ? "" : "s"}` : ""].filter(Boolean).join(" \xB7 ");
1491
1472
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1492
1473
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
1493
1474
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
@@ -1513,32 +1494,40 @@ function RowControls({ rows, controls, change }) {
1513
1494
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1514
1495
  ] })
1515
1496
  ] }),
1516
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1517
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: "Columns and filters" }),
1518
- rows.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-column", children: [
1497
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { className: "matrx-alchemy-options", children: [
1498
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("summary", { children: [
1499
+ "Columns and filters",
1500
+ dataSummary ? ` \u2014 ${dataSummary}` : ""
1501
+ ] }),
1502
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-column", children: [
1519
1503
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1520
1504
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: controls.visibleColumns.includes(column.id), onChange: (e) => change({ ...controls, visibleColumns: e.target.checked ? [...controls.visibleColumns, column.id] : controls.visibleColumns.filter((id) => id !== column.id) }) }),
1521
1505
  " ",
1522
1506
  column.label
1523
1507
  ] }),
1524
1508
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { "aria-label": `Filter ${column.label}`, placeholder: "Filter", value: controls.filters[column.id] ?? "", onChange: (e) => change({ ...controls, filters: { ...controls.filters, [column.id]: e.target.value } }) })
1525
- ] }, column.id))
1509
+ ] }, column.id)) })
1526
1510
  ] }),
1527
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
1528
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("legend", { children: "Rows" }),
1529
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1530
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1531
- " Only selected rows"
1511
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("details", { className: "matrx-alchemy-options", children: [
1512
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("summary", { children: [
1513
+ "Rows \u2014 ",
1514
+ selectionSummary
1532
1515
  ] }),
1533
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1534
- const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String((0, import_content_transfer.readTransferCell)(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1535
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1536
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: controls.selectedIndices.includes(index), onChange: (e) => change({ ...controls, selectedIndices: e.target.checked ? [...controls.selectedIndices, index] : controls.selectedIndices.filter((value) => value !== index) }) }),
1537
- " Row ",
1538
- index + 1,
1539
- summary ? ` \u2014 ${summary}` : ""
1540
- ] }, index);
1541
- }) })
1516
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("fieldset", { "aria-label": "Row selection", children: [
1517
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1518
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1519
+ " Only selected rows"
1520
+ ] }),
1521
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1522
+ const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String((0, import_content_transfer.readTransferCell)(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1523
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
1524
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { type: "checkbox", checked: controls.selectedIndices.includes(index), onChange: (e) => change({ ...controls, selectedIndices: e.target.checked ? [...controls.selectedIndices, index] : controls.selectedIndices.filter((value) => value !== index) }) }),
1525
+ " Row ",
1526
+ index + 1,
1527
+ summary ? ` \u2014 ${summary}` : ""
1528
+ ] }, index);
1529
+ }) })
1530
+ ] })
1542
1531
  ] })
1543
1532
  ] });
1544
1533
  }
@@ -1690,7 +1679,7 @@ function MatrxCopyMenuSession(props) {
1690
1679
  if (aiVisible && props.aiCustom)
1691
1680
  actions.push({
1692
1681
  id: "configure-source",
1693
- label: props.aiCustom.label ?? "Customize source\u2026",
1682
+ label: props.aiCustom.label ?? "Customize source",
1694
1683
  ...props.aiCustom.hint ? { hint: props.aiCustom.hint } : {},
1695
1684
  supports: () => true,
1696
1685
  run: async () => {
@@ -1701,7 +1690,7 @@ function MatrxCopyMenuSession(props) {
1701
1690
  if (aiVisible && props.groomer)
1702
1691
  actions.push({
1703
1692
  id: "groom-source",
1704
- label: "Customize sections\u2026",
1693
+ label: "Customize sections",
1705
1694
  supports: () => true,
1706
1695
  run: async () => {
1707
1696
  setConfiguration({ groomer: props.groomer() });
@@ -1715,6 +1704,7 @@ function MatrxCopyMenuSession(props) {
1715
1704
  label: item.label,
1716
1705
  supports: () => true,
1717
1706
  ...item.build && !item.onSelect ? {
1707
+ placement: "download",
1718
1708
  source: make(
1719
1709
  `export:${item.id}`,
1720
1710
  async () => {
@@ -1795,10 +1785,11 @@ function MatrxCopyMenuSession(props) {
1795
1785
  label: props.label,
1796
1786
  variants,
1797
1787
  actions,
1788
+ sourceFormats: Boolean(source),
1798
1789
  hide: [
1799
1790
  ...!copyVisible || !source ? ["copy"] : [],
1800
1791
  ...!aiVisible || !source ? ["prepare"] : [],
1801
- ...!exportVisible || !source ? ["download"] : []
1792
+ ...!exportVisible ? ["download"] : []
1802
1793
  ],
1803
1794
  formatSources: {
1804
1795
  ...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},
@@ -1809,7 +1800,8 @@ function MatrxCopyMenuSession(props) {
1809
1800
  className: cn(
1810
1801
  props.className,
1811
1802
  props.size === "xs" && "matrx-alchemy-xs",
1812
- props.size === "sm" && "matrx-alchemy-sm"
1803
+ props.size === "sm" && "matrx-alchemy-sm",
1804
+ props.size === "toolbar" && "matrx-alchemy-toolbar-target"
1813
1805
  ),
1814
1806
  ...props.stopPropagation !== void 0 ? { stopPropagation: props.stopPropagation } : {}
1815
1807
  }
@@ -1914,127 +1906,132 @@ function SourceConfiguration({
1914
1906
  event.preventDefault();
1915
1907
  if (!handingOff.current) restoreFocus();
1916
1908
  },
1917
- className: "matrx-alchemy-workspace",
1909
+ className: "matrx-alchemy-workspace matrx-alchemy-configuration",
1918
1910
  children: [
1919
1911
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DialogHeader, { children: [
1920
1912
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogTitle, { children: title }),
1921
1913
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
1922
1914
  ] }),
1923
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1924
- custom?.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { children: [
1925
- option.label,
1926
- "hint" in option && option.hint ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: option.hint }) : null,
1927
- option.kind === "toggle" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1928
- "input",
1929
- {
1930
- type: "checkbox",
1931
- checked: Boolean(values[option.key]),
1932
- onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1933
- }
1934
- ) : option.kind === "preset" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1935
- "select",
1936
- {
1937
- value: Number(values[option.key]),
1938
- onChange: (event) => setValues({
1939
- ...values,
1940
- [option.key]: Number(event.target.value)
1941
- }),
1942
- children: option.options.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: choice.value, children: choice.label }, choice.value))
1943
- }
1944
- ) : option.kind === "slider" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1945
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1915
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-workspace-body", children: [
1916
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1917
+ custom?.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { children: [
1918
+ option.label,
1919
+ "hint" in option && option.hint ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { children: option.hint }) : null,
1920
+ option.kind === "toggle" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1946
1921
  "input",
1947
1922
  {
1948
- type: "range",
1949
- min: 0,
1950
- max: Math.max(0, option.stops.length - 1),
1951
- step: 1,
1952
- value: option.stops.indexOf(Number(values[option.key])),
1953
- onChange: (event) => setValues({
1954
- ...values,
1955
- [option.key]: option.stops[Number(event.target.value)]
1956
- })
1923
+ type: "checkbox",
1924
+ checked: Boolean(values[option.key]),
1925
+ onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1957
1926
  }
1958
- ),
1959
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: option.formatValue(Number(values[option.key])) })
1960
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1961
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1962
- "input",
1927
+ ) : option.kind === "preset" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1928
+ "select",
1963
1929
  {
1964
- type: "number",
1965
- min: option.min,
1966
- step: option.step,
1967
1930
  value: Number(values[option.key]),
1968
1931
  onChange: (event) => setValues({
1969
1932
  ...values,
1970
1933
  [option.key]: Number(event.target.value)
1971
- })
1934
+ }),
1935
+ children: option.options.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: choice.value, children: choice.label }, choice.value))
1972
1936
  }
1973
- ),
1974
- option.presets?.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1937
+ ) : option.kind === "slider" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1938
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1939
+ "input",
1940
+ {
1941
+ type: "range",
1942
+ min: 0,
1943
+ max: Math.max(0, option.stops.length - 1),
1944
+ step: 1,
1945
+ value: option.stops.indexOf(Number(values[option.key])),
1946
+ onChange: (event) => setValues({
1947
+ ...values,
1948
+ [option.key]: option.stops[Number(event.target.value)]
1949
+ })
1950
+ }
1951
+ ),
1952
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: option.formatValue(Number(values[option.key])) })
1953
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1954
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1955
+ "input",
1956
+ {
1957
+ type: "number",
1958
+ min: option.min,
1959
+ step: option.step,
1960
+ value: Number(values[option.key]),
1961
+ onChange: (event) => setValues({
1962
+ ...values,
1963
+ [option.key]: Number(event.target.value)
1964
+ })
1965
+ }
1966
+ ),
1967
+ option.presets?.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1968
+ Button,
1969
+ {
1970
+ type: "button",
1971
+ variant: "ghost",
1972
+ className: "matrx-alchemy-workspace-secondary",
1973
+ onClick: () => setValues({ ...values, [option.key]: preset.value }),
1974
+ children: preset.label
1975
+ },
1976
+ preset.value
1977
+ ))
1978
+ ] })
1979
+ ] }, option.key)),
1980
+ groomer ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1981
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1975
1982
  Button,
1976
1983
  {
1977
1984
  type: "button",
1978
1985
  variant: "ghost",
1979
- onClick: () => setValues({ ...values, [option.key]: preset.value }),
1980
- children: preset.label
1986
+ className: "matrx-alchemy-workspace-secondary",
1987
+ onClick: () => setSections(
1988
+ Object.fromEntries(
1989
+ groomer.sections.map((section) => [
1990
+ section.id,
1991
+ level === "brief" && section.cuttable ? "off" : level
1992
+ ])
1993
+ )
1994
+ ),
1995
+ children: level
1981
1996
  },
1982
- preset.value
1983
- ))
1984
- ] })
1985
- ] }, option.key)),
1986
- groomer ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1987
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1988
- Button,
1989
- {
1990
- type: "button",
1991
- variant: "ghost",
1992
- onClick: () => setSections(
1993
- Object.fromEntries(
1994
- groomer.sections.map((section) => [
1995
- section.id,
1996
- level === "brief" && section.cuttable ? "off" : level
1997
- ])
1998
- )
1997
+ level
1998
+ )) }),
1999
+ groomer.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { children: [
2000
+ section.title,
2001
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2002
+ "select",
2003
+ {
2004
+ value: sections[section.id],
2005
+ onChange: (event) => setSections({
2006
+ ...sections,
2007
+ [section.id]: event.target.value
2008
+ }),
2009
+ children: [
2010
+ ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
2011
+ section.cuttable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "off", children: "Exclude" }) : null
2012
+ ]
2013
+ }
1999
2014
  ),
2000
- children: level
2001
- },
2002
- level
2003
- )) }),
2004
- groomer.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { children: [
2005
- section.title,
2006
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2007
- "select",
2008
- {
2009
- value: sections[section.id],
2010
- onChange: (event) => setSections({
2011
- ...sections,
2012
- [section.id]: event.target.value
2013
- }),
2014
- children: [
2015
- ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
2016
- section.cuttable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "off", children: "Exclude" }) : null
2017
- ]
2018
- }
2019
- ),
2020
- section.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: section.description }) : null
2021
- ] }, section.id))
2022
- ] }) : null
2023
- ] }),
2024
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { children: [
2025
- text.length.toLocaleString(),
2026
- " characters \xB7 approximately",
2027
- " ",
2028
- Math.ceil(text.length / 4).toLocaleString(),
2029
- " tokens"
2015
+ section.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: section.description }) : null
2016
+ ] }, section.id))
2017
+ ] }) : null
2018
+ ] }),
2019
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { children: [
2020
+ text.length.toLocaleString(),
2021
+ " characters \xB7 approximately",
2022
+ " ",
2023
+ Math.ceil(text.length / 4).toLocaleString(),
2024
+ " tokens"
2025
+ ] }),
2026
+ error || buildError ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", children: error ?? buildError }) : null
2030
2027
  ] }),
2031
- error || buildError ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { role: "alert", children: error ?? buildError }) : null,
2032
2028
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DialogFooter, { children: [
2033
2029
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2034
2030
  Button,
2035
2031
  {
2036
2032
  type: "button",
2037
2033
  variant: "ghost",
2034
+ className: "matrx-alchemy-workspace-secondary",
2038
2035
  disabled: busy,
2039
2036
  onClick: onClose,
2040
2037
  children: "Cancel"
@@ -2044,6 +2041,7 @@ function SourceConfiguration({
2044
2041
  Button,
2045
2042
  {
2046
2043
  type: "button",
2044
+ className: "matrx-alchemy-workspace-primary",
2047
2045
  disabled: busy || !prepared || Boolean(buildError),
2048
2046
  onClick: async () => {
2049
2047
  if (!prepared) return;