@ai-matrx/design-system 0.18.22 → 0.19.1

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 (78) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/content-transfer/alchemy.svg +1 -1
  3. package/dist/content-transfer/copy-transform.svg +1 -0
  4. package/dist/content-transfer/icon.cjs +8 -2
  5. package/dist/content-transfer/icon.cjs.map +1 -1
  6. package/dist/content-transfer/icon.d.cts +5 -3
  7. package/dist/content-transfer/icon.d.ts +5 -3
  8. package/dist/content-transfer/icon.js +8 -2
  9. package/dist/content-transfer/icon.js.map +1 -1
  10. package/dist/content-transfer/portal.svg +1 -0
  11. package/dist/content-transfer.cjs +923 -304
  12. package/dist/content-transfer.cjs.map +1 -1
  13. package/dist/content-transfer.css +17 -74
  14. package/dist/content-transfer.d.cts +14 -3
  15. package/dist/content-transfer.d.ts +14 -3
  16. package/dist/content-transfer.js +929 -305
  17. package/dist/content-transfer.js.map +1 -1
  18. package/dist/data-table/copy-helpers.d.cts +1 -1
  19. package/dist/data-table/copy-helpers.d.ts +1 -1
  20. package/dist/data-table/data-row-inspector.cjs +990 -397
  21. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  22. package/dist/data-table/data-row-inspector.js +988 -390
  23. package/dist/data-table/data-row-inspector.js.map +1 -1
  24. package/dist/data-table/data-row-window.cjs +989 -396
  25. package/dist/data-table/data-row-window.cjs.map +1 -1
  26. package/dist/data-table/data-row-window.js +987 -389
  27. package/dist/data-table/data-row-window.js.map +1 -1
  28. package/dist/data-table/filter-engine.d.cts +1 -1
  29. package/dist/data-table/filter-engine.d.ts +1 -1
  30. package/dist/data-table/host.d.cts +1 -1
  31. package/dist/data-table/host.d.ts +1 -1
  32. package/dist/data-table/index.cjs +1665 -1012
  33. package/dist/data-table/index.cjs.map +1 -1
  34. package/dist/data-table/index.d.cts +2 -2
  35. package/dist/data-table/index.d.ts +2 -2
  36. package/dist/data-table/index.js +1517 -859
  37. package/dist/data-table/index.js.map +1 -1
  38. package/dist/data-table/infer-filter.d.cts +1 -1
  39. package/dist/data-table/infer-filter.d.ts +1 -1
  40. package/dist/data-table/layered-filters.d.cts +1 -1
  41. package/dist/data-table/layered-filters.d.ts +1 -1
  42. package/dist/data-table/pagination.cjs +1 -1
  43. package/dist/data-table/pagination.cjs.map +1 -1
  44. package/dist/data-table/pagination.js +1 -1
  45. package/dist/data-table/pagination.js.map +1 -1
  46. package/dist/data-table/query-control.d.cts +1 -1
  47. package/dist/data-table/query-control.d.ts +1 -1
  48. package/dist/data-table/scroll-pagination.cjs +85 -54
  49. package/dist/data-table/scroll-pagination.cjs.map +1 -1
  50. package/dist/data-table/scroll-pagination.js +85 -54
  51. package/dist/data-table/scroll-pagination.js.map +1 -1
  52. package/dist/data-table/types.cjs.map +1 -1
  53. package/dist/data-table/types.d.cts +1 -1
  54. package/dist/data-table/types.d.ts +1 -1
  55. package/dist/data-table/url-state.d.cts +1 -1
  56. package/dist/data-table/url-state.d.ts +1 -1
  57. package/dist/data-table/uuid-cell.cjs +1 -1
  58. package/dist/data-table/uuid-cell.cjs.map +1 -1
  59. package/dist/data-table/uuid-cell.js +1 -1
  60. package/dist/data-table/uuid-cell.js.map +1 -1
  61. package/dist/data-table/xlsx.d.cts +1 -1
  62. package/dist/data-table/xlsx.d.ts +1 -1
  63. package/dist/index.cjs +527 -0
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.d.cts +1 -0
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.js +531 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/tap-target.cjs +636 -0
  70. package/dist/tap-target.cjs.map +1 -0
  71. package/dist/tap-target.css +151 -0
  72. package/dist/tap-target.d.cts +131 -0
  73. package/dist/tap-target.d.ts +131 -0
  74. package/dist/tap-target.js +608 -0
  75. package/dist/tap-target.js.map +1 -0
  76. package/dist/{types-CWW4Tur-.d.cts → types-BcIcmIxd.d.cts} +6 -1
  77. package/dist/{types-Cbnj1Qlm.d.ts → types-xTXSqmR7.d.ts} +6 -1
  78. package/package.json +14 -1
@@ -345,7 +345,7 @@ function DefaultTableWindow({ title, onClose, width = 720, height = 560, actions
345
345
  // src/data-table/icons.tsx
346
346
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
347
347
  function Icon({ children, ...props }) {
348
- return /* @__PURE__ */ jsx6("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", ...props, children });
348
+ return /* @__PURE__ */ jsx6("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children });
349
349
  }
350
350
  var Check = (p) => /* @__PURE__ */ jsx6(Icon, { ...p, children: /* @__PURE__ */ jsx6("path", { d: "m5 12 4 4L19 6" }) });
351
351
  var Pencil = (p) => /* @__PURE__ */ jsx6(Icon, { ...p, children: /* @__PURE__ */ jsx6("path", { d: "m4 20 4-1 11-11-3-3L5 16l-1 4z" }) });
@@ -376,9 +376,9 @@ function useMatrxDataTableHost() {
376
376
  }
377
377
 
378
378
  // src/content-transfer/matrx-copy.tsx
379
- import * as React8 from "react";
379
+ import * as React9 from "react";
380
380
  import {
381
- buildAgentPayload,
381
+ buildAgentPayload as buildAgentPayload2,
382
382
  createBrowserTransport as createBrowserTransport2,
383
383
  directSource as directSource2,
384
384
  normalizeTransferJson,
@@ -386,12 +386,13 @@ import {
386
386
  } from "@ai-matrx/kit/content-transfer";
387
387
 
388
388
  // src/content-transfer/index.tsx
389
- import * as React7 from "react";
390
- import { createPortal } from "react-dom";
389
+ import * as React8 from "react";
390
+ import { createPortal, flushSync } from "react-dom";
391
391
  import {
392
392
  applySectionSelection,
393
393
  applyTransferLimits,
394
394
  capture,
395
+ buildAgentPayload,
395
396
  collectAllMatching,
396
397
  createBrowserTransport,
397
398
  createDraft,
@@ -521,81 +522,624 @@ var PopoverContent = React6.forwardRef(
521
522
  );
522
523
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
523
524
 
525
+ // src/tap-target/tap-target-button.tsx
526
+ import {
527
+ cloneElement,
528
+ forwardRef as forwardRef5,
529
+ isValidElement
530
+ } from "react";
531
+
532
+ // src/tooltip.tsx
533
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
534
+ import * as React7 from "react";
535
+ import { jsx as jsx10 } from "react/jsx-runtime";
536
+ var TooltipProvider = TooltipPrimitive.Provider;
537
+ var Tooltip = TooltipPrimitive.Root;
538
+ var TooltipTrigger = TooltipPrimitive.Trigger;
539
+ var TooltipContent = React7.forwardRef(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {
540
+ const resolved = usePortalContainer(container);
541
+ return /* @__PURE__ */ jsx10(TooltipPrimitive.Portal, { container: resolved ?? null, children: /* @__PURE__ */ jsx10(
542
+ TooltipPrimitive.Content,
543
+ {
544
+ ref,
545
+ "data-slot": "tooltip-content",
546
+ sideOffset,
547
+ className: cn(
548
+ "z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md",
549
+ animated && MOTION_POPPER,
550
+ className
551
+ ),
552
+ ...props
553
+ }
554
+ ) });
555
+ });
556
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
557
+
558
+ // src/tap-target/cn.ts
559
+ function cn2(...values) {
560
+ return values.filter(Boolean).join(" ").trim();
561
+ }
562
+
563
+ // src/tap-target/link.ts
564
+ var LINK_SLOT = /* @__PURE__ */ Symbol.for("@ai-matrx/tap-target:link-component");
565
+ function getTapTargetLinkComponent() {
566
+ return globalThis[LINK_SLOT] ?? null;
567
+ }
568
+
569
+ // src/tap-target/tap-target-button.tsx
570
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
571
+ var EXTERNAL_RE = /^(https?:|mailto:|tel:)/i;
572
+ var TAP_OUTER_CLASS = "matrx-tap-target group";
573
+ var TAP_GROUP_OUTER_CLASS = "matrx-tap-target matrx-tap-target-sm group";
574
+ function IconContent({
575
+ icon,
576
+ children,
577
+ strokeWidth = 2,
578
+ className
579
+ }) {
580
+ if (icon) {
581
+ if (isValidElement(icon)) {
582
+ return cloneElement(icon, {
583
+ className: cn2(className, icon.props.className)
584
+ });
585
+ }
586
+ return /* @__PURE__ */ jsx11("span", { className, children: icon });
587
+ }
588
+ return /* @__PURE__ */ jsx11(
589
+ "svg",
590
+ {
591
+ className,
592
+ fill: "none",
593
+ viewBox: "0 0 24 24",
594
+ stroke: "currentColor",
595
+ strokeWidth,
596
+ children
597
+ }
598
+ );
599
+ }
600
+ function resolveTapGeometry(label, size, mobileIconOnly) {
601
+ const inline = Boolean(label);
602
+ if (size === "sm") {
603
+ return {
604
+ outerClassName: inline && mobileIconOnly ? "matrx-tap-target matrx-tap-target-sm matrx-tap-target-mobile-icon-only-sm group" : inline ? "matrx-tap-target matrx-tap-target-sm matrx-tap-target-inline-sm group" : TAP_GROUP_OUTER_CLASS,
605
+ inlineModifier: mobileIconOnly ? "matrx-tap-pill-mobile-icon-only-sm" : "matrx-tap-pill-inline-sm"
606
+ };
607
+ }
608
+ return {
609
+ outerClassName: inline && mobileIconOnly ? `${TAP_OUTER_CLASS} matrx-tap-target-mobile-icon-only` : inline ? `${TAP_OUTER_CLASS} matrx-tap-target-inline` : TAP_OUTER_CLASS,
610
+ inlineModifier: mobileIconOnly ? "matrx-tap-pill-mobile-icon-only" : "matrx-tap-pill-inline"
611
+ };
612
+ }
613
+ function buildTapInner({
614
+ label,
615
+ pillClassName,
616
+ iconClassName,
617
+ labelClassName,
618
+ inlineModifier,
619
+ icon,
620
+ children,
621
+ strokeWidth = 2
622
+ }) {
623
+ const iconEl = /* @__PURE__ */ jsx11(
624
+ IconContent,
625
+ {
626
+ icon,
627
+ strokeWidth,
628
+ className: iconClassName,
629
+ children
630
+ }
631
+ );
632
+ const pillClasses = label ? `${pillClassName} ${inlineModifier}`.trim() : pillClassName;
633
+ if (!label) {
634
+ return /* @__PURE__ */ jsx11("div", { className: pillClasses, children: iconEl });
635
+ }
636
+ return /* @__PURE__ */ jsxs5("div", { className: pillClasses, children: [
637
+ iconEl,
638
+ /* @__PURE__ */ jsx11("span", { className: labelClassName ?? "matrx-tap-label", children: label })
639
+ ] });
640
+ }
641
+ function renderTapTarget({
642
+ size = "default",
643
+ pillClassName,
644
+ iconClassName,
645
+ labelClassName,
646
+ icon,
647
+ children,
648
+ strokeWidth,
649
+ label,
650
+ mobileIconOnly = false,
651
+ onClick,
652
+ as,
653
+ htmlFor,
654
+ ariaLabel,
655
+ disabled,
656
+ href,
657
+ target,
658
+ rel,
659
+ prefetch,
660
+ linkComponent,
661
+ tooltip,
662
+ tooltipSide,
663
+ tooltipAlign,
664
+ rest,
665
+ buttonRef
666
+ }) {
667
+ const { outerClassName, inlineModifier } = resolveTapGeometry(
668
+ label,
669
+ size,
670
+ mobileIconOnly
671
+ );
672
+ const responsiveLabelClassName = mobileIconOnly ? `${labelClassName ?? "matrx-tap-label"} matrx-tap-label-mobile-icon-only` : labelClassName;
673
+ const inner = buildTapInner({
674
+ label,
675
+ pillClassName,
676
+ iconClassName,
677
+ labelClassName: responsiveLabelClassName,
678
+ inlineModifier: label ? inlineModifier : "",
679
+ icon,
680
+ children,
681
+ strokeWidth
682
+ });
683
+ const resolvedTooltip = tooltip !== void 0 ? tooltip : label ? false : void 0;
684
+ const triggerAriaLabel = label && !mobileIconOnly ? void 0 : ariaLabel ?? label;
685
+ const trigger = renderTrigger({
686
+ href,
687
+ target,
688
+ rel,
689
+ prefetch,
690
+ linkComponent,
691
+ as,
692
+ htmlFor,
693
+ onClick,
694
+ ariaLabel: triggerAriaLabel,
695
+ disabled,
696
+ outerClassName,
697
+ children: inner,
698
+ rest,
699
+ buttonRef
700
+ });
701
+ return withTooltip(trigger, {
702
+ tooltip: resolvedTooltip,
703
+ ariaLabel: triggerAriaLabel,
704
+ disabled,
705
+ tooltipSide,
706
+ tooltipAlign
707
+ });
708
+ }
709
+ function renderTrigger({
710
+ href,
711
+ target,
712
+ rel,
713
+ prefetch,
714
+ linkComponent,
715
+ as,
716
+ htmlFor,
717
+ onClick,
718
+ ariaLabel,
719
+ disabled,
720
+ outerClassName,
721
+ children,
722
+ rest,
723
+ buttonRef
724
+ }) {
725
+ if (disabled && href) {
726
+ return /* @__PURE__ */ jsx11(
727
+ "span",
728
+ {
729
+ "aria-disabled": "true",
730
+ "aria-label": ariaLabel,
731
+ className: `${outerClassName} opacity-40 pointer-events-none`,
732
+ children
733
+ }
734
+ );
735
+ }
736
+ if (href) {
737
+ const isExternal = EXTERNAL_RE.test(href);
738
+ if (isExternal) {
739
+ return /* @__PURE__ */ jsx11(
740
+ "a",
741
+ {
742
+ href,
743
+ target: target ?? "_blank",
744
+ rel: rel ?? "noopener noreferrer",
745
+ "aria-label": ariaLabel,
746
+ className: outerClassName,
747
+ children
748
+ }
749
+ );
750
+ }
751
+ const Link = linkComponent ?? getTapTargetLinkComponent();
752
+ if (Link) {
753
+ return /* @__PURE__ */ jsx11(
754
+ Link,
755
+ {
756
+ href,
757
+ target,
758
+ rel,
759
+ prefetch,
760
+ "aria-label": ariaLabel,
761
+ className: outerClassName,
762
+ children
763
+ }
764
+ );
765
+ }
766
+ return /* @__PURE__ */ jsx11(
767
+ "a",
768
+ {
769
+ href,
770
+ target,
771
+ rel,
772
+ "aria-label": ariaLabel,
773
+ className: outerClassName,
774
+ children
775
+ }
776
+ );
777
+ }
778
+ if (as === "label") {
779
+ return /* @__PURE__ */ jsx11(
780
+ "label",
781
+ {
782
+ htmlFor,
783
+ "aria-label": ariaLabel,
784
+ className: outerClassName,
785
+ children
786
+ }
787
+ );
788
+ }
789
+ return /* @__PURE__ */ jsx11(
790
+ "button",
791
+ {
792
+ ref: buttonRef,
793
+ type: "button",
794
+ onClick,
795
+ "aria-label": ariaLabel,
796
+ disabled,
797
+ ...rest,
798
+ className: outerClassName,
799
+ children
800
+ }
801
+ );
802
+ }
803
+ function withTooltip(trigger, {
804
+ tooltip,
805
+ ariaLabel,
806
+ disabled,
807
+ tooltipSide = "top",
808
+ tooltipAlign = "center"
809
+ }) {
810
+ if (tooltip === false) return trigger;
811
+ const label = typeof tooltip === "string" && tooltip.length > 0 ? tooltip : ariaLabel;
812
+ if (!label) return trigger;
813
+ return /* @__PURE__ */ jsxs5(Tooltip, { children: [
814
+ /* @__PURE__ */ jsx11(TooltipTrigger, { asChild: true, children: disabled ? (
815
+ // Radix Tooltip triggers need a hoverable element; a disabled button
816
+ // does not dispatch pointer events, so we wrap in a span for the
817
+ // trigger target while keeping the disabled visual state.
818
+ /* @__PURE__ */ jsx11("span", { className: "inline-flex", children: trigger })
819
+ ) : trigger }),
820
+ /* @__PURE__ */ jsx11(TooltipContent, { side: tooltipSide, align: tooltipAlign, children: label })
821
+ ] });
822
+ }
823
+ var TapTargetButton = forwardRef5(function TapTargetButton2({
824
+ icon,
825
+ children,
826
+ strokeWidth = 2,
827
+ onClick,
828
+ className,
829
+ as,
830
+ htmlFor,
831
+ ariaLabel,
832
+ disabled,
833
+ href,
834
+ target,
835
+ rel,
836
+ prefetch,
837
+ linkComponent,
838
+ tooltip,
839
+ tooltipSide,
840
+ tooltipAlign,
841
+ label,
842
+ mobileIconOnly,
843
+ ...rest
844
+ }, ref) {
845
+ const color = className ?? "text-foreground";
846
+ return renderTapTarget({
847
+ icon,
848
+ children,
849
+ strokeWidth,
850
+ onClick,
851
+ as,
852
+ htmlFor,
853
+ ariaLabel,
854
+ disabled,
855
+ href,
856
+ target,
857
+ rel,
858
+ prefetch,
859
+ linkComponent,
860
+ tooltip,
861
+ tooltipSide,
862
+ tooltipAlign,
863
+ label,
864
+ mobileIconOnly,
865
+ pillClassName: "matrx-tap-pill matrx-glass-thin-border",
866
+ iconClassName: `matrx-tap-icon ${color}`,
867
+ rest,
868
+ buttonRef: ref
869
+ });
870
+ });
871
+ var TapTargetButtonTransparent = forwardRef5(function TapTargetButtonTransparent2({
872
+ icon,
873
+ children,
874
+ strokeWidth = 2,
875
+ onClick,
876
+ className,
877
+ as,
878
+ htmlFor,
879
+ ariaLabel,
880
+ disabled,
881
+ href,
882
+ target,
883
+ rel,
884
+ prefetch,
885
+ linkComponent,
886
+ tooltip,
887
+ tooltipSide,
888
+ tooltipAlign,
889
+ label,
890
+ mobileIconOnly,
891
+ ...rest
892
+ }, ref) {
893
+ const color = className ?? "text-foreground";
894
+ return renderTapTarget({
895
+ icon,
896
+ children,
897
+ strokeWidth,
898
+ onClick,
899
+ as,
900
+ htmlFor,
901
+ ariaLabel,
902
+ disabled,
903
+ href,
904
+ target,
905
+ rel,
906
+ prefetch,
907
+ linkComponent,
908
+ tooltip,
909
+ tooltipSide,
910
+ tooltipAlign,
911
+ label,
912
+ mobileIconOnly,
913
+ pillClassName: "matrx-tap-pill hover:bg-muted active:bg-muted-foreground/15",
914
+ iconClassName: `matrx-tap-icon ${color}`,
915
+ rest,
916
+ buttonRef: ref
917
+ });
918
+ });
919
+ var TapTargetButtonSolid = forwardRef5(function TapTargetButtonSolid2({
920
+ icon,
921
+ children,
922
+ strokeWidth = 2,
923
+ onClick,
924
+ as,
925
+ htmlFor,
926
+ ariaLabel,
927
+ disabled,
928
+ href,
929
+ target,
930
+ rel,
931
+ prefetch,
932
+ linkComponent,
933
+ bgColor = "bg-primary",
934
+ iconColor = "text-primary-foreground",
935
+ hoverBgColor = "hover:bg-primary/80",
936
+ activeBgColor = "active:brightness-90",
937
+ tooltip,
938
+ tooltipSide,
939
+ tooltipAlign,
940
+ label,
941
+ mobileIconOnly,
942
+ ...rest
943
+ }, ref) {
944
+ return renderTapTarget({
945
+ icon,
946
+ children,
947
+ strokeWidth,
948
+ onClick,
949
+ as,
950
+ htmlFor,
951
+ ariaLabel,
952
+ disabled,
953
+ href,
954
+ target,
955
+ rel,
956
+ prefetch,
957
+ linkComponent,
958
+ tooltip,
959
+ tooltipSide,
960
+ tooltipAlign,
961
+ label,
962
+ mobileIconOnly,
963
+ pillClassName: `matrx-tap-pill ${bgColor} ${iconColor} ${hoverBgColor} ${activeBgColor}`,
964
+ iconClassName: `matrx-tap-icon ${iconColor}`,
965
+ labelClassName: `matrx-tap-label ${iconColor}`,
966
+ rest,
967
+ buttonRef: ref
968
+ });
969
+ });
970
+ var TapTargetButtonDestructive = forwardRef5(function TapTargetButtonDestructive2({
971
+ bgColor = "bg-destructive",
972
+ iconColor = "text-destructive-foreground",
973
+ hoverBgColor = "hover:bg-destructive/90",
974
+ ...rest
975
+ }, ref) {
976
+ return /* @__PURE__ */ jsx11(
977
+ TapTargetButtonSolid,
978
+ {
979
+ ref,
980
+ bgColor,
981
+ iconColor,
982
+ hoverBgColor,
983
+ ...rest
984
+ }
985
+ );
986
+ });
987
+ var TapTargetButtonForGroup = forwardRef5(function TapTargetButtonForGroup2({
988
+ icon,
989
+ children,
990
+ strokeWidth = 2,
991
+ onClick,
992
+ className,
993
+ as,
994
+ htmlFor,
995
+ ariaLabel,
996
+ disabled,
997
+ href,
998
+ target,
999
+ rel,
1000
+ prefetch,
1001
+ linkComponent,
1002
+ tooltip,
1003
+ tooltipSide,
1004
+ tooltipAlign,
1005
+ label,
1006
+ mobileIconOnly,
1007
+ ...rest
1008
+ }, ref) {
1009
+ const color = className ?? "text-foreground";
1010
+ return renderTapTarget({
1011
+ size: "sm",
1012
+ icon,
1013
+ children,
1014
+ strokeWidth,
1015
+ onClick,
1016
+ as,
1017
+ htmlFor,
1018
+ ariaLabel,
1019
+ disabled,
1020
+ href,
1021
+ target,
1022
+ rel,
1023
+ prefetch,
1024
+ linkComponent,
1025
+ tooltip,
1026
+ tooltipSide,
1027
+ tooltipAlign,
1028
+ label,
1029
+ mobileIconOnly,
1030
+ pillClassName: "matrx-tap-pill matrx-tap-pill-sm matrx-glass-interactive",
1031
+ iconClassName: `matrx-tap-icon ${color}`,
1032
+ labelClassName: `matrx-tap-label ${color}`,
1033
+ rest,
1034
+ buttonRef: ref
1035
+ });
1036
+ });
1037
+
524
1038
  // src/content-transfer/icon.ts
525
- 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"];
526
- 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>`;
1039
+ var ALCHEMY_GLYPH_PATHS = {
1040
+ portal: ["M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4M14 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4M8 12h8m-3-3 3 3-3 3"],
1041
+ "copy-transform": ["M8 7V5a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v8M13 21H5a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v3m-5 4h11m-3-3 3 3-3 3"]
1042
+ };
1043
+ var svg = (paths) => `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${paths.map((d) => `<path d="${d}"/>`).join("")}</svg>`;
1044
+ var ALCHEMY_GLYPH_SVG = svg(ALCHEMY_GLYPH_PATHS.portal);
1045
+ var ALCHEMY_COPY_TRANSFORM_SVG = svg(ALCHEMY_GLYPH_PATHS["copy-transform"]);
527
1046
 
528
1047
  // src/content-transfer/index.tsx
529
- import { Fragment, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
530
- function AlchemyGlyph(props) {
531
- return /* @__PURE__ */ jsx10("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__ */ jsx10("path", { d }, d)) });
1048
+ import { Fragment, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1049
+ function AlchemyGlyph({ icon = "portal", ...props }) {
1050
+ return /* @__PURE__ */ jsx12("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[icon].map((d) => /* @__PURE__ */ jsx12("path", { d }, d)) });
532
1051
  }
533
- var CapabilityContext = React7.createContext({});
534
- var useContentTransferCapabilities = () => React7.useContext(CapabilityContext);
535
- var SurfaceContext = React7.createContext(null);
1052
+ var CapabilityContext = React8.createContext({});
1053
+ var useContentTransferCapabilities = () => React8.useContext(CapabilityContext);
1054
+ var SurfaceContext = React8.createContext(null);
536
1055
  function MenuPresentation({ label, hint, icon: Icon2 }) {
537
- return /* @__PURE__ */ jsxs5(Fragment, { children: [
538
- Icon2 ? /* @__PURE__ */ jsx10(Icon2, { className: "matrx-alchemy-menu-icon" }) : null,
539
- /* @__PURE__ */ jsxs5("span", { children: [
1056
+ return /* @__PURE__ */ jsxs6(Fragment, { children: [
1057
+ Icon2 ? /* @__PURE__ */ jsx12(Icon2, { className: "matrx-alchemy-menu-icon" }) : null,
1058
+ /* @__PURE__ */ jsxs6("span", { children: [
540
1059
  label,
541
- hint ? /* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
1060
+ hint ? /* @__PURE__ */ jsx12("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
542
1061
  ] })
543
1062
  ] });
544
1063
  }
1064
+ function DestinationPresentation({ action }) {
1065
+ const paths = {
1066
+ notes: "M5 3h14v18H5zM8 8h8M8 12h8M8 16h5",
1067
+ scratch: "M5 3h14v18H5zM9 12h6M12 9v6",
1068
+ document: "M6 3h8l4 4v14H6zM14 3v5h4M9 12h6M9 16h6",
1069
+ workbook: "M3 4h18v16H3zM3 9h18M9 4v16M15 9v11M3 15h18",
1070
+ task: "M9 6h11M9 12h11M9 18h11M3 6l1 1 2-2M3 12l1 1 2-2M3 18l1 1 2-2",
1071
+ attach: "m9 12 5-5a3 3 0 0 1 4 4l-7 7a5 5 0 0 1-7-7l8-8M7 14l7-7",
1072
+ code: "m8 6-6 6 6 6m8-12 6 6-6 6m-3-14-2 16",
1073
+ chat: "M4 4h16v13H9l-5 4zM8 9h8M8 13h5",
1074
+ assistant: "M3 4h18v16H3zM15 4v16M6 9h6M6 13h4",
1075
+ tools: "m14 4 3 3 4-1a6 6 0 0 1-8 7l-7 7-3-3 7-7a6 6 0 0 1 4-6z"
1076
+ };
1077
+ const path = paths[action.id.replace(/^matrx:/, "")];
1078
+ return /* @__PURE__ */ jsxs6(Fragment, { children: [
1079
+ !action.icon ? path ? /* @__PURE__ */ jsx12("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: /* @__PURE__ */ jsx12("path", { d: path }) }) : /* @__PURE__ */ jsx12(PaletteGlyph, { file: true }) : null,
1080
+ /* @__PURE__ */ jsx12(MenuPresentation, { ...action })
1081
+ ] });
1082
+ }
1083
+ function ReceiptLink({ target }) {
1084
+ return target?.href && /^(\/(?!\/)|https?:\/\/)/.test(target.href) ? /* @__PURE__ */ jsxs6("a", { className: "matrx-alchemy-receipt-link", href: target.href, children: [
1085
+ "Open ",
1086
+ target.kind
1087
+ ] }) : null;
1088
+ }
545
1089
  function PaletteGlyph({ format, ai = false, file = false, kind }) {
546
- if (kind === "ai-copy") return /* @__PURE__ */ jsxs5("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: [
547
- /* @__PURE__ */ jsx10("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
548
- /* @__PURE__ */ jsx10("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
549
- /* @__PURE__ */ jsx10("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
1090
+ if (kind === "ai-copy") return /* @__PURE__ */ jsxs6("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: [
1091
+ /* @__PURE__ */ jsx12("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
1092
+ /* @__PURE__ */ jsx12("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
1093
+ /* @__PURE__ */ jsx12("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
550
1094
  ] });
551
- if (kind === "sliders") return /* @__PURE__ */ jsxs5("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: [
552
- /* @__PURE__ */ jsx10("path", { d: "M4 6h16M4 12h16M4 18h16" }),
553
- /* @__PURE__ */ jsx10("path", { d: "M8 3v6M16 9v6M10 15v6" })
1095
+ if (kind === "sliders") return /* @__PURE__ */ jsxs6("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: [
1096
+ /* @__PURE__ */ jsx12("path", { d: "M4 6h16M4 12h16M4 18h16" }),
1097
+ /* @__PURE__ */ jsx12("path", { d: "M8 3v6M16 9v6M10 15v6" })
554
1098
  ] });
555
- if (ai) return /* @__PURE__ */ jsxs5("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: [
556
- /* @__PURE__ */ jsx10("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" }),
557
- /* @__PURE__ */ jsx10("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" }),
558
- /* @__PURE__ */ jsx10("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
1099
+ if (ai) return /* @__PURE__ */ jsxs6("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: [
1100
+ /* @__PURE__ */ jsx12("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" }),
1101
+ /* @__PURE__ */ jsx12("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" }),
1102
+ /* @__PURE__ */ jsx12("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
559
1103
  ] });
560
- if (file) return /* @__PURE__ */ jsxs5("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: [
561
- /* @__PURE__ */ jsx10("path", { d: "M6 3h8l4 4v14H6z" }),
562
- /* @__PURE__ */ jsx10("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
1104
+ if (file) return /* @__PURE__ */ jsxs6("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: [
1105
+ /* @__PURE__ */ jsx12("path", { d: "M6 3h8l4 4v14H6z" }),
1106
+ /* @__PURE__ */ jsx12("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
563
1107
  ] });
564
- const path = format === "json" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
565
- /* @__PURE__ */ jsx10("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
566
- /* @__PURE__ */ jsx10("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
567
- ] }) : format === "compact-json" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
568
- /* @__PURE__ */ jsx10("path", { d: "m14 10 7-7" }),
569
- /* @__PURE__ */ jsx10("path", { d: "M20 10h-6V4" }),
570
- /* @__PURE__ */ jsx10("path", { d: "m3 21 7-7" }),
571
- /* @__PURE__ */ jsx10("path", { d: "M4 14h6v6" })
572
- ] }) : format === "csv" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
573
- /* @__PURE__ */ jsx10("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
574
- /* @__PURE__ */ jsx10("path", { d: "M4 10h16M10 4v16" })
575
- ] }) : format === "tsv" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
576
- /* @__PURE__ */ jsx10("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
577
- /* @__PURE__ */ jsx10("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
578
- ] }) : format === "xlsx" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
579
- /* @__PURE__ */ jsx10("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
580
- /* @__PURE__ */ jsx10("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
581
- ] }) : format === "markdown" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
582
- /* @__PURE__ */ jsx10("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
583
- /* @__PURE__ */ jsx10("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
584
- ] }) : format === "html" ? /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsx10("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsx10("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
585
- return /* @__PURE__ */ jsx10("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 });
1108
+ const path = format === "json" ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1109
+ /* @__PURE__ */ jsx12("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
1110
+ /* @__PURE__ */ jsx12("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
1111
+ ] }) : format === "compact-json" ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1112
+ /* @__PURE__ */ jsx12("path", { d: "m14 10 7-7" }),
1113
+ /* @__PURE__ */ jsx12("path", { d: "M20 10h-6V4" }),
1114
+ /* @__PURE__ */ jsx12("path", { d: "m3 21 7-7" }),
1115
+ /* @__PURE__ */ jsx12("path", { d: "M4 14h6v6" })
1116
+ ] }) : format === "csv" ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1117
+ /* @__PURE__ */ jsx12("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
1118
+ /* @__PURE__ */ jsx12("path", { d: "M4 10h16M10 4v16" })
1119
+ ] }) : format === "tsv" ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1120
+ /* @__PURE__ */ jsx12("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1121
+ /* @__PURE__ */ jsx12("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
1122
+ ] }) : format === "xlsx" ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1123
+ /* @__PURE__ */ jsx12("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1124
+ /* @__PURE__ */ jsx12("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
1125
+ ] }) : format === "markdown" ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1126
+ /* @__PURE__ */ jsx12("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
1127
+ /* @__PURE__ */ jsx12("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
1128
+ ] }) : format === "html" ? /* @__PURE__ */ jsx12(Fragment, { children: /* @__PURE__ */ jsx12("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ jsx12(Fragment, { children: /* @__PURE__ */ jsx12("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
1129
+ return /* @__PURE__ */ jsx12("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 });
586
1130
  }
587
1131
  function PaletteRows({ title, items, onRun, extra, ai = false, glyphKind, fallbackHint }) {
588
1132
  if (!items.length && !extra) return null;
589
- return /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-palette-section", children: [
590
- /* @__PURE__ */ jsx10("h3", { children: title }),
1133
+ return /* @__PURE__ */ jsxs6("section", { className: "matrx-alchemy-palette-section", children: [
1134
+ /* @__PURE__ */ jsx12("h3", { children: title }),
591
1135
  items.map((item) => {
592
1136
  const label = item.copyLabel ?? item.label;
593
1137
  const hint = item.hint ?? fallbackHint;
594
- return /* @__PURE__ */ jsxs5("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel ?? `${label}${hint ? ` ${hint}` : ""}`, onClick: () => onRun?.(item), children: [
595
- item.icon ? /* @__PURE__ */ jsx10(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx10(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
596
- /* @__PURE__ */ jsxs5("span", { children: [
1138
+ return /* @__PURE__ */ jsxs6("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel ?? `${label}${hint ? ` ${hint}` : ""}`, onClick: () => onRun?.(item), children: [
1139
+ item.icon ? /* @__PURE__ */ jsx12(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx12(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
1140
+ /* @__PURE__ */ jsxs6("span", { children: [
597
1141
  label,
598
- hint ? /* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
1142
+ hint ? /* @__PURE__ */ jsx12("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
599
1143
  ] })
600
1144
  ] }, item.id);
601
1145
  }),
@@ -638,10 +1182,10 @@ function snapshotContent(snapshot) {
638
1182
  return JSON.stringify({ sourceId, label, payload, coverage, unsavedChanges, omissions, sections, limits });
639
1183
  }
640
1184
  function useFence() {
641
- const mounted = React7.useRef(true);
642
- const nextId = React7.useRef(0);
643
- const active = React7.useRef(/* @__PURE__ */ new Set());
644
- React7.useEffect(() => {
1185
+ const mounted = React8.useRef(true);
1186
+ const nextId = React8.useRef(0);
1187
+ const active = React8.useRef(/* @__PURE__ */ new Set());
1188
+ React8.useEffect(() => {
645
1189
  mounted.current = true;
646
1190
  return () => {
647
1191
  mounted.current = false;
@@ -650,14 +1194,14 @@ function useFence() {
650
1194
  active.current.clear();
651
1195
  };
652
1196
  }, []);
653
- const begin = React7.useCallback(() => {
1197
+ const begin = React8.useCallback(() => {
654
1198
  const controller = new AbortController();
655
1199
  active.current.add(controller);
656
1200
  return { controller, id: ++nextId.current };
657
1201
  }, []);
658
- const finish = React7.useCallback((controller) => active.current.delete(controller), []);
659
- const valid = React7.useCallback((id, controller) => mounted.current && !controller.signal.aborted && nextId.current === id, []);
660
- const abortAll = React7.useCallback(() => {
1202
+ const finish = React8.useCallback((controller) => active.current.delete(controller), []);
1203
+ const valid = React8.useCallback((id, controller) => mounted.current && !controller.signal.aborted && nextId.current === id, []);
1204
+ const abortAll = React8.useCallback(() => {
661
1205
  nextId.current += 1;
662
1206
  active.current.forEach((c) => c.abort());
663
1207
  active.current.clear();
@@ -686,45 +1230,47 @@ async function buildArtifact(draft, format, label) {
686
1230
  return serialize(draft, format, { spreadsheetSafe: format === "csv" || format === "tsv", filename: `${filenameFor(label)}.${extension}` });
687
1231
  }
688
1232
  function ContentTransferMenu(props) {
689
- const inherited = React7.useContext(CapabilityContext);
1233
+ const inherited = React8.useContext(CapabilityContext);
690
1234
  const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
691
- return /* @__PURE__ */ jsx10(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
1235
+ return /* @__PURE__ */ jsx12(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
692
1236
  }
693
- 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 }) {
694
- const triggerRef = React7.useRef(null);
695
- const inherited = React7.useContext(CapabilityContext);
696
- const nearestSurface = React7.useContext(SurfaceContext);
1237
+ 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, icon = "portal", triggerVariant = "transparent" }) {
1238
+ const triggerRef = React8.useRef(null);
1239
+ const inherited = React8.useContext(CapabilityContext);
1240
+ const nearestSurface = React8.useContext(SurfaceContext);
697
1241
  const fence = useFence();
698
- const [menuCapture, setMenuCapture] = React7.useState(null);
699
- const [menuStatus, setMenuStatus] = React7.useState("idle");
700
- const [workspaces, setWorkspaces] = React7.useState({});
701
- const [workspaceKey, setWorkspaceKey] = React7.useState(null);
702
- const [workspaceOpen, setWorkspaceOpen] = React7.useState(false);
703
- const workspaceCaptures = React7.useRef(/* @__PURE__ */ new Map());
704
- const externalWorkspaceKeys = React7.useRef(/* @__PURE__ */ new Set());
705
- const [notice, setNotice] = React7.useState(null);
706
- const [paletteOpen, setPaletteOpen] = React7.useState(false);
707
- const [mode, setMode] = React7.useState("copy");
708
- const scopes = React7.useMemo(() => table?.availableScopes ?? ["target"], [table]);
1242
+ const [menuCapture, setMenuCapture] = React8.useState(null);
1243
+ const [menuStatus, setMenuStatus] = React8.useState("idle");
1244
+ const [workspaces, setWorkspaces] = React8.useState({});
1245
+ const [workspaceKey, setWorkspaceKey] = React8.useState(null);
1246
+ const [workspaceOpen, setWorkspaceOpen] = React8.useState(false);
1247
+ const workspaceCaptures = React8.useRef(/* @__PURE__ */ new Map());
1248
+ const externalWorkspaceKeys = React8.useRef(/* @__PURE__ */ new Set());
1249
+ const [notice, setNotice] = React8.useState(null);
1250
+ const [receiptTarget, setReceiptTarget] = React8.useState();
1251
+ const [paletteOpen, setPaletteOpen] = React8.useState(false);
1252
+ const [mode, setMode] = React8.useState("copy");
1253
+ const scopes = React8.useMemo(() => table?.availableScopes ?? ["target"], [table]);
709
1254
  const initialScope = table?.initialScope ?? "target";
710
1255
  if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
711
1256
  const primary = surface ?? source ?? nearestSurface;
712
1257
  const sourceLabel = label ?? (surface?.surfaceName ?? (source && "label" in source ? source.label : nearestSurface?.surfaceName) ?? "content");
713
1258
  const primaryWorkspaceKey = `primary:${materialIdentity(primary)}`;
714
1259
  const nearestWorkspaceKey = source && !surface && nearestSurface ? `surface:${materialIdentity(nearestSurface)}` : null;
715
- const variantWorkspaceKeys = React7.useMemo(() => new Map(variants.map((variant) => [variant.id, `variant:${variant.id}:${materialIdentity(variant.source)}`])), [variants]);
1260
+ const variantWorkspaceKeys = React8.useMemo(() => new Map(variants.map((variant) => [variant.id, `variant:${variant.id}:${materialIdentity(variant.source)}`])), [variants]);
716
1261
  const transport = local?.transport ?? inherited.transport ?? createBrowserTransport();
717
1262
  const ai = local?.ai ?? inherited.ai;
718
- const providerPreferences = React7.useMemo(() => resolveTransferPreferences(inherited.preferences, local?.preferences), [inherited.preferences, local?.preferences]);
719
- const adapters = React7.useMemo(() => resolveTransferRegistry(BUILT_INS, inherited.formats ?? [], local?.formats ?? []).filter((x) => "build" in x), [inherited.formats, local?.formats]);
720
- const registeredActions = React7.useMemo(() => resolveTransferRegistry(inherited.actions ?? [], local?.actions ?? [], actions), [actions, inherited.actions, local?.actions]);
721
- React7.useMemo(() => resolveTransferRegistry(variants), [variants]);
722
- const report = React7.useCallback((result) => {
1263
+ const providerPreferences = React8.useMemo(() => resolveTransferPreferences(inherited.preferences, local?.preferences), [inherited.preferences, local?.preferences]);
1264
+ const adapters = React8.useMemo(() => resolveTransferRegistry(BUILT_INS, inherited.formats ?? [], local?.formats ?? []).filter((x) => "build" in x), [inherited.formats, local?.formats]);
1265
+ const registeredActions = React8.useMemo(() => resolveTransferRegistry(inherited.actions ?? [], local?.actions ?? [], actions), [actions, inherited.actions, local?.actions]);
1266
+ React8.useMemo(() => resolveTransferRegistry(variants), [variants]);
1267
+ const report = React8.useCallback((result) => {
723
1268
  inherited.onOutcome?.(result);
724
1269
  local?.onOutcome?.(result);
725
1270
  setNotice(outcomeMessage(result));
1271
+ setReceiptTarget("target" in result ? result.target : void 0);
726
1272
  }, [inherited, local]);
727
- React7.useEffect(() => {
1273
+ React8.useEffect(() => {
728
1274
  const valid = /* @__PURE__ */ new Set([primaryWorkspaceKey, ...nearestWorkspaceKey ? [nearestWorkspaceKey] : [], ...variantWorkspaceKeys.values(), ...externalWorkspaceKeys.current]);
729
1275
  setWorkspaces((current) => Object.fromEntries(Object.entries(current).filter(([key]) => valid.has(key))));
730
1276
  for (const key of workspaceCaptures.current.keys()) if (!valid.has(key)) workspaceCaptures.current.delete(key);
@@ -733,7 +1279,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
733
1279
  setWorkspaceOpen(false);
734
1280
  }
735
1281
  }, [nearestWorkspaceKey, primaryWorkspaceKey, variantWorkspaceKeys, workspaceKey]);
736
- const captureOne = React7.useCallback(async (material, scope, signal, applyMenuProjection = false, collectPages = true) => {
1282
+ const captureOne = React8.useCallback(async (material, scope, signal, applyMenuProjection = false, collectPages = true) => {
737
1283
  if (!material) throw new Error("Alchemy needs a source or a mounted transfer surface.");
738
1284
  let sourceMaterial;
739
1285
  if ("instanceId" in material) {
@@ -767,14 +1313,14 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
767
1313
  if (result.snapshot.payload.kind !== "rows") throw new Error("All-matching export requires tabular content.");
768
1314
  return { snapshot: projectSnapshot({ ...result.snapshot, payload: { kind: "rows", rows: collected.rows, columns: result.snapshot.payload.columns }, coverage: collected.coverage, omissions: [...collected.omissions] }, { rules: [] }), allMatching: result.allMatching, ...collected.error ? { collectionError: collected.error.message } : {} };
769
1315
  }, [preferences, projection, providerPreferences, sections, sourceLabel]);
770
- const capturePrimary = React7.useCallback((scope, signal) => captureOne(primary, scope, signal, true), [captureOne, primary]);
1316
+ const capturePrimary = React8.useCallback((scope, signal) => captureOne(primary, scope, signal, true), [captureOne, primary]);
771
1317
  workspaceCaptures.current.set(primaryWorkspaceKey, capturePrimary);
772
1318
  if (nearestWorkspaceKey && nearestSurface) workspaceCaptures.current.set(nearestWorkspaceKey, (scope, signal) => captureOne(nearestSurface, scope, signal, true));
773
1319
  for (const variant of variants) {
774
1320
  const key = variantWorkspaceKeys.get(variant.id);
775
1321
  workspaceCaptures.current.set(key, (scope, signal) => captureOne(variant.source, scope, signal, true));
776
1322
  }
777
- const preflight = React7.useCallback(async () => {
1323
+ const preflight = React8.useCallback(async () => {
778
1324
  const { controller, id } = fence.begin();
779
1325
  setMenuCapture(null);
780
1326
  setMenuStatus("loading");
@@ -793,7 +1339,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
793
1339
  fence.finish(controller);
794
1340
  }
795
1341
  }, [captureOne, fence, initialScope, primary]);
796
- const transfer = React7.useCallback(async (format, download, alternate) => {
1342
+ const transfer = React8.useCallback(async (format, download, alternate) => {
797
1343
  const { controller, id } = fence.begin();
798
1344
  try {
799
1345
  const explicit = alternate?.source ?? (typeof format === "string" && format !== "xlsx" ? formatSources?.[format] : void 0);
@@ -818,7 +1364,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
818
1364
  fence.finish(controller);
819
1365
  }
820
1366
  }, [captureOne, capturePrimary, fence, formatSources, initialScope, preferences, providerPreferences, report, transport]);
821
- const openWorkspace = React7.useCallback(
1367
+ const openWorkspace = React8.useCallback(
822
1368
  async (key = primaryWorkspaceKey, variant) => {
823
1369
  const variantMaterial = variant && "kind" in variant.source ? {
824
1370
  id: `variant:${key}`,
@@ -912,7 +1458,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
912
1458
  setWorkspaceOpen(true);
913
1459
  } catch (error) {
914
1460
  if (fence.valid(id, controller))
915
- setNotice(errorMessage(error, "Could not capture content"));
1461
+ setReceiptTarget(void 0);
1462
+ setNotice(errorMessage(error, "Could not capture content"));
916
1463
  } finally {
917
1464
  fence.finish(controller);
918
1465
  }
@@ -929,7 +1476,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
929
1476
  workspaces
930
1477
  ]
931
1478
  );
932
- React7.useImperativeHandle(controllerRef, () => ({
1479
+ React8.useImperativeHandle(controllerRef, () => ({
933
1480
  focusTrigger: () => triggerRef.current?.focus(),
934
1481
  prepare: async (requestedSource, options) => {
935
1482
  const requestedLabel = options?.label ?? ("label" in requestedSource ? requestedSource.label : "content");
@@ -938,14 +1485,15 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
938
1485
  await openWorkspace(requestedKey, { source: requestedSource, label: requestedLabel });
939
1486
  }
940
1487
  }), [openWorkspace]);
941
- const runAction = React7.useCallback(async (action) => {
1488
+ const runAction = React8.useCallback(async (action) => {
942
1489
  const { controller, id } = fence.begin();
943
1490
  try {
944
1491
  const actionSource = action.source;
945
1492
  const { snapshot } = actionSource ? await captureOne(actionSource, initialScope, controller.signal, true) : await capturePrimary(initialScope, controller.signal);
946
1493
  const resolved = resolveTransferPreferences(providerPreferences, preferences, snapshot.limits);
947
1494
  const draft = applyTransferLimits(createDraft(snapshot), resolved.limits);
948
- if (!action.supports(snapshot)) throw new Error(`${action.label} is unavailable for this content.`);
1495
+ if (snapshot.coverage.status !== "complete" || draft.omissions.length) throw new Error("This content is partial or requires reductions. Open Prepare for AI to review it before sending it to a destination.");
1496
+ if (!action.supports(snapshot, draft)) throw new Error(`${action.label} is unavailable for this content.`);
949
1497
  const result = await action.run({ snapshot, draft, signal: controller.signal });
950
1498
  if (fence.valid(id, controller) && draft.snapshotId === snapshot.id) report(result);
951
1499
  } catch (error) {
@@ -960,99 +1508,128 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
960
1508
  const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
961
1509
  const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
962
1510
  const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
963
- const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
1511
+ const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot, applyTransferLimits(createDraft(menuCapture.snapshot), resolveTransferPreferences(providerPreferences, preferences, menuCapture.snapshot.limits).limits))) : [];
964
1512
  const downloadActions = visibleActions.filter((action) => action.placement === "download");
965
1513
  const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
1514
+ const preparedActions = registeredActions.filter((action) => action.prepared && !action.source);
966
1515
  const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
967
1516
  const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
968
1517
  const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
969
1518
  const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
1519
+ const nativeAiFormat = {
1520
+ id: "ai-context",
1521
+ label: "AI context",
1522
+ supports: () => true,
1523
+ build: async (draft) => {
1524
+ const json = serialize(draft, "json");
1525
+ return sealTransferArtifact({ snapshotId: draft.snapshotId, draftRevision: draft.revision, format: "ai-context", plainText: buildAgentPayload({ kind: "matrx_content", location: sourceLabel, description: "Captured content for an assistant", data: JSON.parse(json.plainText), attributes: { source: draft.sourceId } }), omissions: [...json.omissions] });
1526
+ }
1527
+ };
970
1528
  const closePalette = () => setPaletteOpen(false);
971
1529
  const tile = (id, label2, onClick, options = {}) => {
972
1530
  const presentation = options.action;
973
1531
  const Icon2 = presentation?.icon;
974
1532
  const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
975
- return /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
1533
+ return /* @__PURE__ */ jsxs6("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
976
1534
  closePalette();
977
1535
  onClick();
978
1536
  }, children: [
979
- Icon2 ? /* @__PURE__ */ jsx10(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx10(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
980
- /* @__PURE__ */ jsxs5("span", { children: [
1537
+ Icon2 ? /* @__PURE__ */ jsx12(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx12(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
1538
+ /* @__PURE__ */ jsxs6("span", { children: [
981
1539
  label2,
982
- presentation?.hint ? /* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
1540
+ presentation?.hint ? /* @__PURE__ */ jsx12("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
983
1541
  ] })
984
1542
  ] }, id);
985
1543
  };
986
- return /* @__PURE__ */ jsxs5("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
987
- /* @__PURE__ */ jsxs5(Popover, { open: paletteOpen, onOpenChange: (open) => {
1544
+ return /* @__PURE__ */ jsxs6("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
1545
+ /* @__PURE__ */ jsxs6(Popover, { open: paletteOpen, onOpenChange: (open) => {
988
1546
  setPaletteOpen(open);
989
1547
  if (open) {
990
1548
  setMode("copy");
991
1549
  void preflight();
992
1550
  }
993
1551
  }, children: [
994
- /* @__PURE__ */ jsx10(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx10("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__ */ jsx10(AlchemyGlyph, {}) }) }),
995
- /* @__PURE__ */ jsxs5(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
996
- menuStatus === "loading" ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
997
- copyAvailable || downloadAvailable ? /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-output", children: [
998
- /* @__PURE__ */ jsx10("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
999
- copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
1000
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
1001
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
1552
+ /* @__PURE__ */ jsx12(PopoverTrigger, { asChild: true, children: triggerVariant === "glass" ? /* @__PURE__ */ jsx12(TapTargetButton, { ref: triggerRef, icon: /* @__PURE__ */ jsx12(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "glass" }) : /* @__PURE__ */ jsx12(TapTargetButtonTransparent, { ref: triggerRef, icon: /* @__PURE__ */ jsx12(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "transparent" }) }),
1553
+ /* @__PURE__ */ jsxs6(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
1554
+ menuStatus === "loading" ? /* @__PURE__ */ jsx12("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx12("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
1555
+ copyAvailable || downloadAvailable ? /* @__PURE__ */ jsxs6("section", { className: "matrx-alchemy-output", children: [
1556
+ /* @__PURE__ */ jsx12("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
1557
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
1558
+ /* @__PURE__ */ jsx12("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
1559
+ /* @__PURE__ */ jsx12("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
1002
1560
  ] }) : null,
1003
- resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1004
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
1561
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1562
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-palette-grid", children: [
1005
1563
  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]}` })),
1006
1564
  visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
1007
1565
  ] }),
1008
- quickVariants("copy").length ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
1566
+ quickVariants("copy").length ? /* @__PURE__ */ jsx12(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
1009
1567
  closePalette();
1010
1568
  void transfer("markdown", false, variant);
1011
1569
  } }) : null
1012
1570
  ] }) : null,
1013
- resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
1571
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx12(Fragment, { children: /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-palette-grid", children: [
1014
1572
  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]}` })),
1015
1573
  visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
1016
1574
  downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
1017
1575
  ] }) }) : null
1018
1576
  ] }) : null,
1019
- prepareAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1020
- /* @__PURE__ */ jsx10(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", items: quickVariants("ai"), onRun: (variant) => {
1577
+ prepareAvailable ? /* @__PURE__ */ jsxs6(Fragment, { children: [
1578
+ /* @__PURE__ */ jsx12(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ jsxs6("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1579
+ closePalette();
1580
+ void transfer(nativeAiFormat, false);
1581
+ }, children: [
1582
+ /* @__PURE__ */ jsx12(PaletteGlyph, { kind: "ai-copy" }),
1583
+ /* @__PURE__ */ jsxs6("span", { children: [
1584
+ "Copy with AI context",
1585
+ /* @__PURE__ */ jsx12("small", { className: "matrx-alchemy-menu-hint", children: "Content, source and capture details" })
1586
+ ] })
1587
+ ] }) : null, items: quickVariants("ai"), onRun: (variant) => {
1021
1588
  closePalette();
1022
1589
  void transfer("markdown", false, variant);
1023
1590
  } }),
1024
- /* @__PURE__ */ jsx10(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
1591
+ /* @__PURE__ */ jsx12(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ jsxs6("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
1025
1592
  closePalette();
1026
1593
  void openWorkspace();
1027
1594
  }, children: [
1028
- /* @__PURE__ */ jsx10(PaletteGlyph, { kind: "sliders" }),
1029
- /* @__PURE__ */ jsxs5("span", { children: [
1595
+ /* @__PURE__ */ jsx12(PaletteGlyph, { kind: "sliders" }),
1596
+ /* @__PURE__ */ jsxs6("span", { children: [
1030
1597
  "Prepare for AI",
1031
- /* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
1598
+ /* @__PURE__ */ jsx12("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
1032
1599
  ] })
1033
1600
  ] }) })
1034
1601
  ] }) : null,
1035
- prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs5(Fragment, { children: [
1036
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1602
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx12(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs6(Fragment, { children: [
1603
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx12("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1037
1604
  closePalette();
1038
1605
  void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
1039
- }, children: /* @__PURE__ */ jsx10("span", { children: "Prepare this surface" }) }) : null,
1040
- variants.map((variant) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
1606
+ }, children: /* @__PURE__ */ jsx12("span", { children: "Prepare this surface" }) }) : null,
1607
+ variants.map((variant) => /* @__PURE__ */ jsx12("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
1041
1608
  closePalette();
1042
1609
  void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
1043
- }, children: /* @__PURE__ */ jsx10(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
1610
+ }, children: /* @__PURE__ */ jsx12(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
1044
1611
  ] }) }) : null,
1045
- ordinaryActions.length ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
1046
- closePalette();
1047
- void runAction(action);
1048
- }, children: /* @__PURE__ */ jsx10(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
1612
+ ["save", "chat", "other"].map((group) => {
1613
+ const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
1614
+ return entries.length ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-palette-destinations", children: [
1615
+ /* @__PURE__ */ jsxs6("summary", { children: [
1616
+ group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : "Actions",
1617
+ /* @__PURE__ */ jsx12("span", { children: entries.length })
1618
+ ] }),
1619
+ /* @__PURE__ */ jsx12("div", { children: entries.map((action) => /* @__PURE__ */ jsx12("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
1620
+ closePalette();
1621
+ void runAction(action);
1622
+ }, children: /* @__PURE__ */ jsx12(DestinationPresentation, { action }) }, action.id)) })
1623
+ ] }, group) : null;
1624
+ })
1049
1625
  ] })
1050
1626
  ] }),
1051
- notice && triggerRef.current ? createPortal(/* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-feedback", children: [
1052
- /* @__PURE__ */ jsx10("span", { role: "status", children: notice }),
1053
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
1627
+ notice && triggerRef.current ? createPortal(/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-feedback", children: [
1628
+ /* @__PURE__ */ jsx12("span", { role: "status", children: notice }),
1629
+ /* @__PURE__ */ jsx12(ReceiptLink, { target: receiptTarget }),
1630
+ /* @__PURE__ */ jsx12("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
1054
1631
  ] }), triggerRef.current.ownerDocument.body) : null,
1055
- Object.values(workspaces).map((saved) => /* @__PURE__ */ jsx10(PreparationWorkspace, { restoreFocus: () => triggerRef.current?.focus(), open: workspaceOpen && workspaceKey === saved.key, state: saved, scopes, onClose: () => setWorkspaceOpen(false), onChange: (next) => setWorkspaces((current) => ({ ...current, [saved.key]: next })), transport, adapters, captureScope: workspaceCaptures.current.get(saved.key) ?? capturePrimary, ...ai ? { ai } : {}, onOutcome: report }, saved.key))
1632
+ Object.values(workspaces).map((saved) => /* @__PURE__ */ jsx12(PreparationWorkspace, { restoreFocus: () => triggerRef.current?.focus(), open: workspaceOpen && workspaceKey === saved.key, state: saved, scopes, onClose: () => setWorkspaceOpen(false), onChange: (next) => setWorkspaces((current) => ({ ...current, [saved.key]: next })), transport, adapters, actions: preparedActions, captureScope: workspaceCaptures.current.get(saved.key) ?? capturePrimary, ...ai ? { ai } : {}, onOutcome: report }, saved.key))
1056
1633
  ] });
1057
1634
  }
1058
1635
  function initialControls(state) {
@@ -1104,30 +1681,34 @@ function preview(draft, format) {
1104
1681
  const resolved = isBuiltInFormat(format) ? format : "plain";
1105
1682
  return serialize(draft, resolved === "xlsx" ? "tsv" : resolved, { spreadsheetSafe: resolved === "csv" || resolved === "tsv" || resolved === "xlsx" }).plainText;
1106
1683
  }
1107
- function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onChange, transport, ai, adapters, onOutcome, captureScope }) {
1684
+ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onChange, transport, ai, adapters, actions, onOutcome, captureScope }) {
1108
1685
  const fence = useFence();
1109
- const latest = React7.useRef(state);
1686
+ const latest = React8.useRef(state);
1110
1687
  latest.current = state;
1111
- const aiSession = React7.useRef(void 0);
1688
+ const aiSession = React8.useRef(void 0);
1112
1689
  if (!aiSession.current && ai) aiSession.current = ai.fork?.() ?? ai;
1113
- const [controls, setControls] = React7.useState(() => initialControls(state));
1114
- const [controlsHistory, setControlsHistory] = React7.useState([]);
1115
- const [pendingControls, setPendingControls] = React7.useState(null);
1690
+ const [controls, setControls] = React8.useState(() => initialControls(state));
1691
+ const [controlsHistory, setControlsHistory] = React8.useState([]);
1692
+ const [pendingControls, setPendingControls] = React8.useState(null);
1116
1693
  const requestedFormat = state.preferences.initialFormat;
1117
- const [format, setFormat] = React7.useState(() => isBuiltInFormat(requestedFormat) ? supportsBuiltIn(requestedFormat, state.draft.payload) ? requestedFormat : "plain" : adapters.some((adapter) => adapter.id === requestedFormat && adapter.supports(state.draft.payload)) ? requestedFormat : "plain");
1118
- const [buffer, setBuffer] = React7.useState(() => isBuiltInFormat(format) ? preview(state.draft, format) : "Preparing format preview\u2026");
1119
- const [bufferError, setBufferError] = React7.useState(null);
1120
- const [formatError, setFormatError] = React7.useState(null);
1121
- const [preparedArtifact, setPreparedArtifact] = React7.useState(null);
1122
- const [instruction, setInstruction] = React7.useState("");
1123
- const [busy, setBusy] = React7.useState(null);
1124
- const [aiFailed, setAiFailed] = React7.useState(false);
1125
- React7.useEffect(() => {
1694
+ const [format, setFormat] = React8.useState(() => isBuiltInFormat(requestedFormat) ? supportsBuiltIn(requestedFormat, state.draft.payload) ? requestedFormat : "plain" : adapters.some((adapter) => adapter.id === requestedFormat && adapter.supports(state.draft.payload)) ? requestedFormat : "plain");
1695
+ const [buffer, setBuffer] = React8.useState(() => isBuiltInFormat(format) ? preview(state.draft, format) : "Preparing format preview\u2026");
1696
+ const [bufferError, setBufferError] = React8.useState(null);
1697
+ const [formatError, setFormatError] = React8.useState(null);
1698
+ const [preparedArtifact, setPreparedArtifact] = React8.useState(null);
1699
+ const [instruction, setInstruction] = React8.useState("");
1700
+ const [busy, setBusy] = React8.useState(null);
1701
+ const [aiFailed, setAiFailed] = React8.useState(false);
1702
+ React8.useEffect(() => {
1126
1703
  setAiFailed(false);
1127
1704
  }, [state.snapshot.id, state.draft.revision]);
1128
- const activeAi = React7.useRef(null);
1129
- const activeCapture = React7.useRef(null);
1130
- React7.useEffect(() => {
1705
+ const handingOff = React8.useRef(false);
1706
+ React8.useEffect(() => {
1707
+ if (open) handingOff.current = false;
1708
+ }, [open]);
1709
+ const activeAi = React8.useRef(null);
1710
+ const activeCapture = React8.useRef(null);
1711
+ React8.useEffect(() => {
1131
1712
  if (bufferError) return;
1132
1713
  const adapter = adapters.find((candidate) => candidate.id === format);
1133
1714
  const controller = new AbortController();
@@ -1147,7 +1728,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1147
1728
  });
1148
1729
  return () => controller.abort();
1149
1730
  }, [adapters, bufferError, format, state.draft, state.snapshot.id]);
1150
- const close = React7.useCallback(() => {
1731
+ const close = React8.useCallback(() => {
1151
1732
  activeAi.current?.abort();
1152
1733
  activeCapture.current?.abort();
1153
1734
  activeAi.current = null;
@@ -1276,8 +1857,8 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1276
1857
  if (fence.valid(id, controller)) setBusy(null);
1277
1858
  }
1278
1859
  };
1279
- const [deliveryNotice, setDeliveryNotice] = React7.useState(null);
1280
- React7.useEffect(() => {
1860
+ const [deliveryNotice, setDeliveryNotice] = React8.useState(null);
1861
+ React8.useEffect(() => {
1281
1862
  setDeliveryNotice(null);
1282
1863
  }, [state.draft.revision]);
1283
1864
  const reportDelivery = (outcome) => {
@@ -1304,45 +1885,64 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1304
1885
  if (fence.valid(id, controller)) setBusy(null);
1305
1886
  }
1306
1887
  };
1888
+ const deliverAction = async (action) => {
1889
+ if (busy || bufferError || formatError || !preparedArtifact) return;
1890
+ const { controller, id } = fence.begin();
1891
+ const current = latest.current;
1892
+ setBusy("action");
1893
+ try {
1894
+ if (!action.supports(current.snapshot, current.draft)) throw new Error(`${action.label} is unavailable for this prepared content.`);
1895
+ handingOff.current = true;
1896
+ flushSync(() => onClose());
1897
+ const result = await action.run({ snapshot: current.snapshot, draft: current.draft, signal: controller.signal });
1898
+ if (fence.valid(id, controller)) reportDelivery(result);
1899
+ } catch (error) {
1900
+ if (fence.valid(id, controller)) reportDelivery({ status: "error", code: "destination-failed", message: errorMessage(error, "Could not deliver prepared content"), retryable: false });
1901
+ } finally {
1902
+ fence.finish(controller);
1903
+ if (fence.valid(id, controller)) setBusy(null);
1904
+ }
1905
+ };
1906
+ const eligibleActions = actions.filter((action) => action.supports(state.snapshot, state.draft));
1307
1907
  const rows = state.original.payload.kind === "rows" ? state.original.payload : null;
1308
1908
  const formats = COPIES.filter((f) => supportsBuiltIn(f, state.draft.payload));
1309
1909
  const workspaceAdapters = adapters.filter((adapter) => adapter.supports(state.draft.payload));
1310
1910
  const displayedOmissions = preparedArtifact?.omissions ?? state.draft.omissions;
1311
1911
  const limitText = Object.entries(state.preferences.limits).filter(([, value]) => value != null).map(([key, value]) => `${key.replace(/^max/, "max ")} ${Number(value).toLocaleString()}`).join(" \xB7 ");
1312
- return /* @__PURE__ */ jsx10(Dialog, { open, onOpenChange: (next) => {
1912
+ return /* @__PURE__ */ jsx12(Dialog, { open, onOpenChange: (next) => {
1313
1913
  if (!next) close();
1314
- }, children: /* @__PURE__ */ jsxs5(DialogContent, { onCloseAutoFocus: (event) => {
1914
+ }, children: /* @__PURE__ */ jsxs6(DialogContent, { onCloseAutoFocus: (event) => {
1315
1915
  event.preventDefault();
1316
- restoreFocus();
1916
+ if (!handingOff.current) restoreFocus();
1317
1917
  }, className: "matrx-alchemy-workspace max-w-5xl", "aria-busy": busy !== null, children: [
1318
- /* @__PURE__ */ jsxs5(DialogHeader, { children: [
1319
- /* @__PURE__ */ jsxs5(DialogTitle, { children: [
1918
+ /* @__PURE__ */ jsxs6(DialogHeader, { children: [
1919
+ /* @__PURE__ */ jsxs6(DialogTitle, { children: [
1320
1920
  "Prepare ",
1321
1921
  state.snapshot.label
1322
1922
  ] }),
1323
- /* @__PURE__ */ jsxs5(DialogDescription, { children: [
1923
+ /* @__PURE__ */ jsxs6(DialogDescription, { children: [
1324
1924
  state.snapshot.unsavedChanges ? "Includes your unsaved changes. " : "",
1325
1925
  "Review and edit this copy. Your original stays unchanged."
1326
1926
  ] })
1327
1927
  ] }),
1328
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-workspace-body", children: [
1329
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-workspace-grid", children: [
1330
- /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-main", children: [
1331
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-toolbar", children: [
1332
- scopes.length > 1 ? /* @__PURE__ */ jsxs5("label", { children: [
1928
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-workspace-body", children: [
1929
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-workspace-grid", children: [
1930
+ /* @__PURE__ */ jsxs6("section", { className: "matrx-alchemy-main", children: [
1931
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-toolbar", children: [
1932
+ scopes.length > 1 ? /* @__PURE__ */ jsxs6("label", { children: [
1333
1933
  "Scope",
1334
- /* @__PURE__ */ jsx10("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx10("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1934
+ /* @__PURE__ */ jsx12("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx12("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1335
1935
  ] }) : null,
1336
- /* @__PURE__ */ jsxs5("label", { children: [
1936
+ /* @__PURE__ */ jsxs6("label", { children: [
1337
1937
  "Detail",
1338
- /* @__PURE__ */ jsxs5("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1339
- /* @__PURE__ */ jsx10("option", { value: "full", children: "Full" }),
1340
- /* @__PURE__ */ jsx10("option", { value: "compact", children: "Compact" }),
1341
- /* @__PURE__ */ jsx10("option", { value: "brief", children: "Brief" }),
1342
- /* @__PURE__ */ jsx10("option", { value: "custom", children: "Custom" })
1938
+ /* @__PURE__ */ jsxs6("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1939
+ /* @__PURE__ */ jsx12("option", { value: "full", children: "Full" }),
1940
+ /* @__PURE__ */ jsx12("option", { value: "compact", children: "Compact" }),
1941
+ /* @__PURE__ */ jsx12("option", { value: "brief", children: "Brief" }),
1942
+ /* @__PURE__ */ jsx12("option", { value: "custom", children: "Custom" })
1343
1943
  ] })
1344
1944
  ] }),
1345
- /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1945
+ /* @__PURE__ */ jsx12(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1346
1946
  setBufferError(null);
1347
1947
  if (controlsHistory.length) {
1348
1948
  const next = controlsHistory[controlsHistory.length - 1];
@@ -1351,7 +1951,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1351
1951
  onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1352
1952
  } else onChange({ ...state, draft: undoDraft(state.draft), error: void 0 });
1353
1953
  }, children: "Undo" }),
1354
- /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
1954
+ /* @__PURE__ */ jsx12(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
1355
1955
  const next = initialControls(state);
1356
1956
  setControls(next);
1357
1957
  setControlsHistory([]);
@@ -1359,64 +1959,64 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1359
1959
  setBufferError(null);
1360
1960
  onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1361
1961
  }, children: "Reset" }),
1362
- /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1962
+ /* @__PURE__ */ jsx12(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1363
1963
  ] }),
1364
- controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs5("fieldset", { className: "matrx-alchemy-options", children: [
1365
- /* @__PURE__ */ jsx10("legend", { children: "JSON limits" }),
1366
- [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs5("label", { children: [
1964
+ controls.preset === "custom" ? /* @__PURE__ */ jsxs6("fieldset", { className: "matrx-alchemy-options", children: [
1965
+ /* @__PURE__ */ jsx12("legend", { children: state.draft.payload.kind === "json" || state.draft.payload.kind === "registered" ? "JSON limits" : "Content limits" }),
1966
+ [["maxDepth", "Maximum depth"], ["maxStringChars", state.draft.payload.kind === "rows" ? "Maximum characters per cell" : "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].filter(([key]) => key === "maxStringChars" || state.draft.payload.kind === "json" || state.draft.payload.kind === "registered").map(([key, text]) => /* @__PURE__ */ jsxs6("label", { children: [
1367
1967
  text,
1368
- /* @__PURE__ */ jsx10("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1968
+ /* @__PURE__ */ jsx12("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1369
1969
  ] }, key))
1370
1970
  ] }) : null,
1371
- rows ? /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options matrx-alchemy-data-controls", children: [
1372
- /* @__PURE__ */ jsxs5("summary", { children: [
1971
+ rows ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options matrx-alchemy-data-controls", children: [
1972
+ /* @__PURE__ */ jsxs6("summary", { children: [
1373
1973
  "Data selection \xB7 ",
1374
1974
  controls.visibleColumns.length,
1375
1975
  " columns",
1376
1976
  controls.search || controls.sort || controls.top != null || controls.selectedOnly || Object.values(controls.filters).some(Boolean) ? " \xB7 customized" : " \xB7 all rows"
1377
1977
  ] }),
1378
- /* @__PURE__ */ jsx10("div", { className: "matrx-alchemy-data-controls-body", children: /* @__PURE__ */ jsx10(RowControls, { rows, controls, change: changeControls }) })
1978
+ /* @__PURE__ */ jsx12("div", { className: "matrx-alchemy-data-controls-body", children: /* @__PURE__ */ jsx12(RowControls, { rows, controls, change: changeControls }) })
1379
1979
  ] }) : null,
1380
- state.snapshot.sections.length ? /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1381
- /* @__PURE__ */ jsxs5("summary", { children: [
1980
+ state.snapshot.sections.length ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options", children: [
1981
+ /* @__PURE__ */ jsxs6("summary", { children: [
1382
1982
  "Sections \xB7 ",
1383
1983
  controls.sections.length,
1384
1984
  " included"
1385
1985
  ] }),
1386
- /* @__PURE__ */ jsx10("fieldset", { "aria-label": "Included sections", children: state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs5("label", { children: [
1387
- /* @__PURE__ */ jsx10("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) }) }),
1986
+ /* @__PURE__ */ jsx12("fieldset", { "aria-label": "Included sections", children: state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs6("label", { children: [
1987
+ /* @__PURE__ */ jsx12("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) }) }),
1388
1988
  " ",
1389
1989
  section.label
1390
1990
  ] }, section.id)) })
1391
1991
  ] }) : null,
1392
- /* @__PURE__ */ jsxs5("label", { className: "matrx-alchemy-preview-label", children: [
1992
+ /* @__PURE__ */ jsxs6("label", { className: "matrx-alchemy-preview-label", children: [
1393
1993
  "Output format",
1394
- /* @__PURE__ */ jsxs5("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1395
- formats.map((f) => /* @__PURE__ */ jsx10("option", { value: f, children: LABEL[f] }, f)),
1396
- state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx10("option", { value: "xlsx", children: "Excel workbook" }) : null,
1397
- workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx10("option", { value: adapter.id, children: adapter.label }, adapter.id))
1994
+ /* @__PURE__ */ jsxs6("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1995
+ formats.map((f) => /* @__PURE__ */ jsx12("option", { value: f, children: LABEL[f] }, f)),
1996
+ state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx12("option", { value: "xlsx", children: "Excel workbook" }) : null,
1997
+ workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx12("option", { value: adapter.id, children: adapter.label }, adapter.id))
1398
1998
  ] })
1399
1999
  ] }),
1400
- /* @__PURE__ */ jsx10("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) }),
1401
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-coverage", children: [
1402
- /* @__PURE__ */ jsxs5("span", { children: [
2000
+ /* @__PURE__ */ jsx12("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) }),
2001
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-coverage", children: [
2002
+ /* @__PURE__ */ jsxs6("span", { children: [
1403
2003
  state.snapshot.coverage.included.toLocaleString(),
1404
2004
  " included",
1405
2005
  state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1406
2006
  " \xB7 ",
1407
2007
  state.snapshot.coverage.status
1408
2008
  ] }),
1409
- state.snapshot.coverage.reason ? /* @__PURE__ */ jsx10("span", { children: state.snapshot.coverage.reason }) : null,
1410
- limitText ? /* @__PURE__ */ jsxs5("span", { children: [
2009
+ state.snapshot.coverage.reason ? /* @__PURE__ */ jsx12("span", { children: state.snapshot.coverage.reason }) : null,
2010
+ limitText ? /* @__PURE__ */ jsxs6("span", { children: [
1411
2011
  "Limits: ",
1412
2012
  limitText
1413
2013
  ] }) : null,
1414
- displayedOmissions.length ? /* @__PURE__ */ jsxs5("details", { children: [
1415
- /* @__PURE__ */ jsxs5("summary", { children: [
2014
+ displayedOmissions.length ? /* @__PURE__ */ jsxs6("details", { children: [
2015
+ /* @__PURE__ */ jsxs6("summary", { children: [
1416
2016
  displayedOmissions.length,
1417
2017
  " omissions or adjustments"
1418
2018
  ] }),
1419
- /* @__PURE__ */ jsx10("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs5("li", { children: [
2019
+ /* @__PURE__ */ jsx12("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs6("li", { children: [
1420
2020
  o.path || "/",
1421
2021
  ": ",
1422
2022
  o.reason,
@@ -1424,57 +2024,79 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1424
2024
  ] }, `${o.path}-${o.reason}-${i}`)) })
1425
2025
  ] }) : null
1426
2026
  ] }),
1427
- bufferError ? /* @__PURE__ */ jsx10("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1428
- formatError ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1429
- bufferError ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
2027
+ bufferError ? /* @__PURE__ */ jsx12("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
2028
+ formatError ? /* @__PURE__ */ jsx12("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
2029
+ bufferError ? /* @__PURE__ */ jsx12(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1430
2030
  const fallback = editDraft(state.draft, { kind: "text", text: buffer });
1431
2031
  setBufferError(null);
1432
2032
  onChange({ ...state, draft: fallback, error: void 0 });
1433
2033
  setFormat("plain");
1434
2034
  }, children: "Use invalid JSON as plain text" }) : null
1435
2035
  ] }),
1436
- ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs5("aside", { children: [
1437
- ai ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1438
- /* @__PURE__ */ jsxs5("label", { children: [
2036
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs6("aside", { children: [
2037
+ ai ? /* @__PURE__ */ jsxs6(Fragment, { children: [
2038
+ /* @__PURE__ */ jsxs6("label", { children: [
2039
+ "Start with",
2040
+ /* @__PURE__ */ jsxs6("select", { "aria-label": "AI preparation recipe", defaultValue: "", onChange: (event) => {
2041
+ if (event.target.value) setInstruction(event.target.value);
2042
+ }, children: [
2043
+ /* @__PURE__ */ jsx12("option", { value: "", children: "Choose an instruction" }),
2044
+ /* @__PURE__ */ jsx12("option", { value: "Summarize this content concisely. Preserve important facts, names, decisions, and source references.", children: "Summarize" }),
2045
+ /* @__PURE__ */ jsx12("option", { value: "Extract decisions, action items, owners, and due dates. Mark missing details as unspecified.", children: "Extract action items" }),
2046
+ /* @__PURE__ */ jsx12("option", { value: "Prepare a complete handoff for another assistant. Include the objective, relevant facts, constraints, decisions, and unresolved questions.", children: "Assistant handoff" }),
2047
+ /* @__PURE__ */ jsx12("option", { value: "Condense this content by removing repetition and formatting noise. Preserve every unique fact and all identifiers.", children: "Condense without losing facts" }),
2048
+ /* @__PURE__ */ jsx12("option", { value: "Turn this content into a clear structured outline. Keep the original meaning and explicitly flag uncertainty.", children: "Create an outline" }),
2049
+ /* @__PURE__ */ jsx12("option", { value: "Analyze this data. Identify patterns, anomalies, and useful comparisons. Distinguish observations from inferences.", children: "Analyze the data" })
2050
+ ] })
2051
+ ] }),
2052
+ /* @__PURE__ */ jsxs6("label", { children: [
1439
2053
  "AI instruction",
1440
- /* @__PURE__ */ jsx10("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
2054
+ /* @__PURE__ */ jsx12("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1441
2055
  ] }),
1442
- /* @__PURE__ */ jsx10(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" }),
1443
- busy === "ai" ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
2056
+ /* @__PURE__ */ jsx12(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" }),
2057
+ busy === "ai" ? /* @__PURE__ */ jsx12(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1444
2058
  ] }) : null,
1445
- busy === "capture" ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
2059
+ busy === "capture" ? /* @__PURE__ */ jsx12(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
1446
2060
  activeCapture.current?.abort();
1447
2061
  activeCapture.current = null;
1448
2062
  setBusy(null);
1449
2063
  }, children: "Stop loading rows" }) : null,
1450
- ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ jsx10(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,
1451
- ai ? /* @__PURE__ */ jsx10("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,
1452
- state.error ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
2064
+ ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ jsx12(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,
2065
+ ai ? /* @__PURE__ */ jsx12("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,
2066
+ state.error ? /* @__PURE__ */ jsx12("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1453
2067
  ] }) : null
1454
2068
  ] }),
1455
- pendingControls ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1456
- /* @__PURE__ */ jsx10("p", { children: "This control would replace your manual edit." }),
1457
- /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1458
- /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
2069
+ pendingControls ? /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-decision", role: "alert", children: [
2070
+ /* @__PURE__ */ jsx12("p", { children: "This control would replace your manual edit." }),
2071
+ /* @__PURE__ */ jsx12(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
2072
+ /* @__PURE__ */ jsx12(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1459
2073
  ] }) : null,
1460
- state.sourceStale ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1461
- state.pending ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1462
- /* @__PURE__ */ jsx10("p", { children: "A fresh source snapshot is ready." }),
1463
- /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1464
- /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
2074
+ state.sourceStale ? /* @__PURE__ */ jsx12("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
2075
+ state.pending ? /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-decision", role: "alert", children: [
2076
+ /* @__PURE__ */ jsx12("p", { children: "A fresh source snapshot is ready." }),
2077
+ /* @__PURE__ */ jsx12(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
2078
+ /* @__PURE__ */ jsx12(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
2079
+ ] }) : null,
2080
+ eligibleActions.length ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options matrx-alchemy-destinations", children: [
2081
+ /* @__PURE__ */ jsxs6("summary", { children: [
2082
+ "Use prepared content \xB7 ",
2083
+ eligibleActions.length,
2084
+ " destinations"
2085
+ ] }),
2086
+ /* @__PURE__ */ jsx12("div", { className: "matrx-alchemy-destination-grid", children: eligibleActions.map((action) => /* @__PURE__ */ jsx12("button", { type: "button", className: "matrx-alchemy-palette-row", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliverAction(action), children: /* @__PURE__ */ jsx12(DestinationPresentation, { action }) }, action.id)) })
1465
2087
  ] }) : null,
1466
- deliveryNotice ? /* @__PURE__ */ jsx10("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
2088
+ deliveryNotice ? /* @__PURE__ */ jsx12("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
1467
2089
  ] }),
1468
- /* @__PURE__ */ jsxs5(DialogFooter, { children: [
1469
- /* @__PURE__ */ jsxs5("span", { className: "matrx-alchemy-meta", children: [
2090
+ /* @__PURE__ */ jsxs6(DialogFooter, { children: [
2091
+ /* @__PURE__ */ jsxs6("span", { className: "matrx-alchemy-meta", children: [
1470
2092
  buffer.length.toLocaleString(),
1471
2093
  " characters \xB7 ~",
1472
2094
  estimateTokens(buffer).toLocaleString(),
1473
2095
  " tokens"
1474
2096
  ] }),
1475
- /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
1476
- /* @__PURE__ */ jsx10(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" }),
1477
- /* @__PURE__ */ jsx10(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" })
2097
+ /* @__PURE__ */ jsx12(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
2098
+ /* @__PURE__ */ jsx12(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" }),
2099
+ /* @__PURE__ */ jsx12(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" })
1478
2100
  ] })
1479
2101
  ] }) });
1480
2102
  }
@@ -1482,59 +2104,59 @@ function RowControls({ rows, controls, change }) {
1482
2104
  const filterCount = Object.values(controls.filters).filter(Boolean).length;
1483
2105
  const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
1484
2106
  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 ");
1485
- return /* @__PURE__ */ jsxs5(Fragment, { children: [
1486
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-toolbar", children: [
1487
- /* @__PURE__ */ jsxs5("label", { children: [
2107
+ return /* @__PURE__ */ jsxs6(Fragment, { children: [
2108
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-toolbar", children: [
2109
+ /* @__PURE__ */ jsxs6("label", { children: [
1488
2110
  "Search",
1489
- /* @__PURE__ */ jsx10("input", { value: controls.search, onChange: (e) => change({ ...controls, search: e.target.value }) })
2111
+ /* @__PURE__ */ jsx12("input", { value: controls.search, onChange: (e) => change({ ...controls, search: e.target.value }) })
1490
2112
  ] }),
1491
- /* @__PURE__ */ jsxs5("label", { children: [
2113
+ /* @__PURE__ */ jsxs6("label", { children: [
1492
2114
  "Sort",
1493
- /* @__PURE__ */ jsxs5("select", { value: controls.sort, onChange: (e) => change({ ...controls, sort: e.target.value }), children: [
1494
- /* @__PURE__ */ jsx10("option", { value: "", children: "None" }),
1495
- rows.columns.map((column) => /* @__PURE__ */ jsx10("option", { value: column.id, children: column.label }, column.id))
2115
+ /* @__PURE__ */ jsxs6("select", { value: controls.sort, onChange: (e) => change({ ...controls, sort: e.target.value }), children: [
2116
+ /* @__PURE__ */ jsx12("option", { value: "", children: "None" }),
2117
+ rows.columns.map((column) => /* @__PURE__ */ jsx12("option", { value: column.id, children: column.label }, column.id))
1496
2118
  ] })
1497
2119
  ] }),
1498
- /* @__PURE__ */ jsxs5("label", { children: [
2120
+ /* @__PURE__ */ jsxs6("label", { children: [
1499
2121
  "Direction",
1500
- /* @__PURE__ */ jsxs5("select", { value: controls.direction, disabled: !controls.sort, onChange: (e) => change({ ...controls, direction: e.target.value }), children: [
1501
- /* @__PURE__ */ jsx10("option", { value: "asc", children: "Ascending" }),
1502
- /* @__PURE__ */ jsx10("option", { value: "desc", children: "Descending" })
2122
+ /* @__PURE__ */ jsxs6("select", { value: controls.direction, disabled: !controls.sort, onChange: (e) => change({ ...controls, direction: e.target.value }), children: [
2123
+ /* @__PURE__ */ jsx12("option", { value: "asc", children: "Ascending" }),
2124
+ /* @__PURE__ */ jsx12("option", { value: "desc", children: "Descending" })
1503
2125
  ] })
1504
2126
  ] }),
1505
- /* @__PURE__ */ jsxs5("label", { children: [
2127
+ /* @__PURE__ */ jsxs6("label", { children: [
1506
2128
  "Top rows",
1507
- /* @__PURE__ */ jsx10("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
2129
+ /* @__PURE__ */ jsx12("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1508
2130
  ] })
1509
2131
  ] }),
1510
- /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1511
- /* @__PURE__ */ jsxs5("summary", { children: [
2132
+ /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options", children: [
2133
+ /* @__PURE__ */ jsxs6("summary", { children: [
1512
2134
  "Columns and filters",
1513
2135
  dataSummary ? ` \u2014 ${dataSummary}` : ""
1514
2136
  ] }),
1515
- /* @__PURE__ */ jsx10("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-column", children: [
1516
- /* @__PURE__ */ jsxs5("label", { children: [
1517
- /* @__PURE__ */ jsx10("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) }) }),
2137
+ /* @__PURE__ */ jsx12("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-column", children: [
2138
+ /* @__PURE__ */ jsxs6("label", { children: [
2139
+ /* @__PURE__ */ jsx12("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) }) }),
1518
2140
  " ",
1519
2141
  column.label
1520
2142
  ] }),
1521
- /* @__PURE__ */ jsx10("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 } }) })
2143
+ /* @__PURE__ */ jsx12("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 } }) })
1522
2144
  ] }, column.id)) })
1523
2145
  ] }),
1524
- /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1525
- /* @__PURE__ */ jsxs5("summary", { children: [
2146
+ /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options", children: [
2147
+ /* @__PURE__ */ jsxs6("summary", { children: [
1526
2148
  "Rows \u2014 ",
1527
2149
  selectionSummary
1528
2150
  ] }),
1529
- /* @__PURE__ */ jsxs5("fieldset", { "aria-label": "Row selection", children: [
1530
- /* @__PURE__ */ jsxs5("label", { children: [
1531
- /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
2151
+ /* @__PURE__ */ jsxs6("fieldset", { "aria-label": "Row selection", children: [
2152
+ /* @__PURE__ */ jsxs6("label", { children: [
2153
+ /* @__PURE__ */ jsx12("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1532
2154
  " Only selected rows"
1533
2155
  ] }),
1534
- /* @__PURE__ */ jsx10("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
2156
+ /* @__PURE__ */ jsx12("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1535
2157
  const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1536
- return /* @__PURE__ */ jsxs5("label", { children: [
1537
- /* @__PURE__ */ jsx10("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) }) }),
2158
+ return /* @__PURE__ */ jsxs6("label", { children: [
2159
+ /* @__PURE__ */ jsx12("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) }) }),
1538
2160
  " Row ",
1539
2161
  index + 1,
1540
2162
  summary ? ` \u2014 ${summary}` : ""
@@ -1546,11 +2168,11 @@ function RowControls({ rows, controls, change }) {
1546
2168
  }
1547
2169
 
1548
2170
  // src/content-transfer/matrx-copy.tsx
1549
- import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
2171
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1550
2172
  var resolve = (value) => typeof value === "function" ? value() : value;
1551
2173
  var asPayload = (value) => ({
1552
2174
  kind: "markdown",
1553
- text: typeof value === "string" ? value : buildAgentPayload(value)
2175
+ text: typeof value === "string" ? value : buildAgentPayload2(value)
1554
2176
  });
1555
2177
  var structuredPayload = (value) => {
1556
2178
  if (typeof value === "string") return { kind: "markdown", text: value };
@@ -1592,7 +2214,7 @@ var sourceFor = (id, label, build) => ({
1592
2214
  });
1593
2215
  function MatrxCopyMenu(props) {
1594
2216
  const inherited = useContentTransferCapabilities();
1595
- return /* @__PURE__ */ jsx11(
2217
+ return /* @__PURE__ */ jsx13(
1596
2218
  MatrxCopyMenuSession,
1597
2219
  {
1598
2220
  ...props
@@ -1604,12 +2226,12 @@ function MatrxCopyMenu(props) {
1604
2226
  );
1605
2227
  }
1606
2228
  function MatrxCopyMenuSession(props) {
1607
- const instance = React8.useId();
1608
- const controller = React8.useRef(null);
2229
+ const instance = React9.useId();
2230
+ const controller = React9.useRef(null);
1609
2231
  const capabilities = useContentTransferCapabilities();
1610
2232
  const transport = capabilities.transport ?? createBrowserTransport2();
1611
- const [modal, setModal] = React8.useState(null);
1612
- const [configuration, setConfiguration] = React8.useState(null);
2233
+ const [modal, setModal] = React9.useState(null);
2234
+ const [configuration, setConfiguration] = React9.useState(null);
1613
2235
  const copyVisible = !props.hide?.includes("copy");
1614
2236
  const aiVisible = !props.hide?.includes("ai");
1615
2237
  const exportVisible = !props.hide?.includes("export");
@@ -1796,11 +2418,13 @@ function MatrxCopyMenuSession(props) {
1796
2418
  const source = (props.primarySource === "table" ? table : void 0) ?? json ?? table ?? structuredAgent ?? human ?? builderVariants[0]?.source;
1797
2419
  if (!source && !actions.length) return null;
1798
2420
  const target = source ?? make("actions", () => ({ kind: "text", text: props.label }));
1799
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
1800
- /* @__PURE__ */ jsx11(
2421
+ return /* @__PURE__ */ jsxs7(Fragment2, { children: [
2422
+ /* @__PURE__ */ jsx13(
1801
2423
  ContentTransferMenu,
1802
2424
  {
1803
2425
  source: target,
2426
+ ...props.icon !== void 0 ? { icon: props.icon } : {},
2427
+ ...props.triggerVariant !== void 0 ? { triggerVariant: props.triggerVariant } : {},
1804
2428
  controllerRef: controller,
1805
2429
  label: props.label,
1806
2430
  variants,
@@ -1832,7 +2456,7 @@ function MatrxCopyMenuSession(props) {
1832
2456
  if (!open) setModal(null);
1833
2457
  }
1834
2458
  }),
1835
- configuration ? /* @__PURE__ */ jsx11(
2459
+ configuration ? /* @__PURE__ */ jsx13(
1836
2460
  SourceConfiguration,
1837
2461
  {
1838
2462
  restoreFocus: () => controller.current?.focusTrigger(),
@@ -1859,14 +2483,14 @@ function SourceConfiguration({
1859
2483
  onPrepare
1860
2484
  }) {
1861
2485
  const custom = configuration.custom;
1862
- const handingOff = React8.useRef(false);
2486
+ const handingOff = React9.useRef(false);
1863
2487
  const groomer = configuration.groomer;
1864
- const [values, setValues] = React8.useState(
2488
+ const [values, setValues] = React9.useState(
1865
2489
  () => Object.fromEntries(
1866
2490
  custom?.options.map((option) => [option.key, option.default]) ?? []
1867
2491
  )
1868
2492
  );
1869
- const [sections, setSections] = React8.useState(
2493
+ const [sections, setSections] = React9.useState(
1870
2494
  () => Object.fromEntries(
1871
2495
  groomer?.sections.map((section) => [
1872
2496
  section.id,
@@ -1874,8 +2498,8 @@ function SourceConfiguration({
1874
2498
  ]) ?? []
1875
2499
  )
1876
2500
  );
1877
- const [error, setError] = React8.useState(null);
1878
- const [busy, setBusy] = React8.useState(false);
2501
+ const [error, setError] = React9.useState(null);
2502
+ const [busy, setBusy] = React9.useState(false);
1879
2503
  const title = custom?.dialogTitle ?? groomer?.label ?? "Customize source";
1880
2504
  let prepared = null;
1881
2505
  let buildError = null;
@@ -1908,18 +2532,18 @@ function SourceConfiguration({
1908
2532
  ...groomer.context ? { context: groomer.context } : {}
1909
2533
  };
1910
2534
  }
1911
- text = prepared ? buildAgentPayload(prepared) : "";
2535
+ text = prepared ? buildAgentPayload2(prepared) : "";
1912
2536
  } catch (cause) {
1913
2537
  buildError = cause instanceof Error ? cause.message : "Could not prepare this source.";
1914
2538
  }
1915
- return /* @__PURE__ */ jsx11(
2539
+ return /* @__PURE__ */ jsx13(
1916
2540
  Dialog,
1917
2541
  {
1918
2542
  open: true,
1919
2543
  onOpenChange: (open) => {
1920
2544
  if (!open && !busy) onClose();
1921
2545
  },
1922
- children: /* @__PURE__ */ jsxs6(
2546
+ children: /* @__PURE__ */ jsxs7(
1923
2547
  DialogContent,
1924
2548
  {
1925
2549
  onCloseAutoFocus: (event) => {
@@ -1928,23 +2552,23 @@ function SourceConfiguration({
1928
2552
  },
1929
2553
  className: "matrx-alchemy-workspace matrx-alchemy-configuration",
1930
2554
  children: [
1931
- /* @__PURE__ */ jsxs6(DialogHeader, { children: [
1932
- /* @__PURE__ */ jsx11(DialogTitle, { children: title }),
1933
- /* @__PURE__ */ jsx11(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
2555
+ /* @__PURE__ */ jsxs7(DialogHeader, { children: [
2556
+ /* @__PURE__ */ jsx13(DialogTitle, { children: title }),
2557
+ /* @__PURE__ */ jsx13(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
1934
2558
  ] }),
1935
- /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-workspace-body", children: [
1936
- /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1937
- custom?.options.map((option) => /* @__PURE__ */ jsxs6("label", { children: [
2559
+ /* @__PURE__ */ jsxs7("div", { className: "matrx-alchemy-workspace-body", children: [
2560
+ /* @__PURE__ */ jsxs7("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
2561
+ custom?.options.map((option) => /* @__PURE__ */ jsxs7("label", { children: [
1938
2562
  option.label,
1939
- "hint" in option && option.hint ? /* @__PURE__ */ jsx11("small", { children: option.hint }) : null,
1940
- option.kind === "toggle" ? /* @__PURE__ */ jsx11(
2563
+ "hint" in option && option.hint ? /* @__PURE__ */ jsx13("small", { children: option.hint }) : null,
2564
+ option.kind === "toggle" ? /* @__PURE__ */ jsx13(
1941
2565
  "input",
1942
2566
  {
1943
2567
  type: "checkbox",
1944
2568
  checked: Boolean(values[option.key]),
1945
2569
  onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1946
2570
  }
1947
- ) : option.kind === "preset" ? /* @__PURE__ */ jsx11(
2571
+ ) : option.kind === "preset" ? /* @__PURE__ */ jsx13(
1948
2572
  "select",
1949
2573
  {
1950
2574
  value: Number(values[option.key]),
@@ -1952,10 +2576,10 @@ function SourceConfiguration({
1952
2576
  ...values,
1953
2577
  [option.key]: Number(event.target.value)
1954
2578
  }),
1955
- children: option.options.map((choice) => /* @__PURE__ */ jsx11("option", { value: choice.value, children: choice.label }, choice.value))
2579
+ children: option.options.map((choice) => /* @__PURE__ */ jsx13("option", { value: choice.value, children: choice.label }, choice.value))
1956
2580
  }
1957
- ) : option.kind === "slider" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1958
- /* @__PURE__ */ jsx11(
2581
+ ) : option.kind === "slider" ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
2582
+ /* @__PURE__ */ jsx13(
1959
2583
  "input",
1960
2584
  {
1961
2585
  type: "range",
@@ -1969,9 +2593,9 @@ function SourceConfiguration({
1969
2593
  })
1970
2594
  }
1971
2595
  ),
1972
- /* @__PURE__ */ jsx11("span", { children: option.formatValue(Number(values[option.key])) })
1973
- ] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
1974
- /* @__PURE__ */ jsx11(
2596
+ /* @__PURE__ */ jsx13("span", { children: option.formatValue(Number(values[option.key])) })
2597
+ ] }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
2598
+ /* @__PURE__ */ jsx13(
1975
2599
  "input",
1976
2600
  {
1977
2601
  type: "number",
@@ -1984,7 +2608,7 @@ function SourceConfiguration({
1984
2608
  })
1985
2609
  }
1986
2610
  ),
1987
- option.presets?.map((preset) => /* @__PURE__ */ jsx11(
2611
+ option.presets?.map((preset) => /* @__PURE__ */ jsx13(
1988
2612
  Button,
1989
2613
  {
1990
2614
  type: "button",
@@ -1997,8 +2621,8 @@ function SourceConfiguration({
1997
2621
  ))
1998
2622
  ] })
1999
2623
  ] }, option.key)),
2000
- groomer ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
2001
- /* @__PURE__ */ jsx11("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11(
2624
+ groomer ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
2625
+ /* @__PURE__ */ jsx13("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx13(
2002
2626
  Button,
2003
2627
  {
2004
2628
  type: "button",
@@ -2016,9 +2640,9 @@ function SourceConfiguration({
2016
2640
  },
2017
2641
  level
2018
2642
  )) }),
2019
- groomer.sections.map((section) => /* @__PURE__ */ jsxs6("label", { children: [
2643
+ groomer.sections.map((section) => /* @__PURE__ */ jsxs7("label", { children: [
2020
2644
  section.title,
2021
- /* @__PURE__ */ jsxs6(
2645
+ /* @__PURE__ */ jsxs7(
2022
2646
  "select",
2023
2647
  {
2024
2648
  value: sections[section.id],
@@ -2027,26 +2651,26 @@ function SourceConfiguration({
2027
2651
  [section.id]: event.target.value
2028
2652
  }),
2029
2653
  children: [
2030
- ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
2031
- section.cuttable ? /* @__PURE__ */ jsx11("option", { value: "off", children: "Exclude" }) : null
2654
+ ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx13("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
2655
+ section.cuttable ? /* @__PURE__ */ jsx13("option", { value: "off", children: "Exclude" }) : null
2032
2656
  ]
2033
2657
  }
2034
2658
  ),
2035
- section.description ? /* @__PURE__ */ jsx11("span", { children: section.description }) : null
2659
+ section.description ? /* @__PURE__ */ jsx13("span", { children: section.description }) : null
2036
2660
  ] }, section.id))
2037
2661
  ] }) : null
2038
2662
  ] }),
2039
- /* @__PURE__ */ jsxs6("p", { children: [
2663
+ /* @__PURE__ */ jsxs7("p", { children: [
2040
2664
  text.length.toLocaleString(),
2041
2665
  " characters \xB7 approximately",
2042
2666
  " ",
2043
2667
  Math.ceil(text.length / 4).toLocaleString(),
2044
2668
  " tokens"
2045
2669
  ] }),
2046
- error || buildError ? /* @__PURE__ */ jsx11("p", { role: "alert", children: error ?? buildError }) : null
2670
+ error || buildError ? /* @__PURE__ */ jsx13("p", { role: "alert", children: error ?? buildError }) : null
2047
2671
  ] }),
2048
- /* @__PURE__ */ jsxs6(DialogFooter, { children: [
2049
- /* @__PURE__ */ jsx11(
2672
+ /* @__PURE__ */ jsxs7(DialogFooter, { children: [
2673
+ /* @__PURE__ */ jsx13(
2050
2674
  Button,
2051
2675
  {
2052
2676
  type: "button",
@@ -2057,7 +2681,7 @@ function SourceConfiguration({
2057
2681
  children: "Cancel"
2058
2682
  }
2059
2683
  ),
2060
- /* @__PURE__ */ jsx11(
2684
+ /* @__PURE__ */ jsx13(
2061
2685
  Button,
2062
2686
  {
2063
2687
  type: "button",
@@ -2091,12 +2715,12 @@ function SourceConfiguration({
2091
2715
  }
2092
2716
 
2093
2717
  // src/data-table/copy.tsx
2094
- import { jsx as jsx12 } from "react/jsx-runtime";
2718
+ import { jsx as jsx14 } from "react/jsx-runtime";
2095
2719
  function CopyButtons(props) {
2096
2720
  const { CopyControls } = useMatrxDataTableHost();
2097
2721
  const copyProps = props.export?.sheetRows ? { ...props, primarySource: "table" } : props;
2098
- if (CopyControls) return /* @__PURE__ */ jsx12(CopyControls, { ...copyProps });
2099
- return /* @__PURE__ */ jsx12(MatrxCopyMenu, { ...copyProps });
2722
+ if (CopyControls) return /* @__PURE__ */ jsx14(CopyControls, { ...copyProps });
2723
+ return /* @__PURE__ */ jsx14(MatrxCopyMenu, { ...copyProps });
2100
2724
  }
2101
2725
 
2102
2726
  // src/data-table/MatrxUuidCell.tsx
@@ -2108,7 +2732,7 @@ import {
2108
2732
 
2109
2733
  // src/data-table/useTableNotice.tsx
2110
2734
  import { useState as useState5 } from "react";
2111
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
2735
+ import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
2112
2736
  function useTableNotice() {
2113
2737
  const host = useMatrxDataTableHost();
2114
2738
  const [message, setMessage] = useState5(null);
@@ -2122,41 +2746,15 @@ function useTableNotice() {
2122
2746
  else setMessage({ text, error: true });
2123
2747
  }
2124
2748
  };
2125
- const notice = message ? /* @__PURE__ */ jsxs7("span", { role: message.error ? "alert" : "status", className: message.error ? "text-xs text-destructive" : "text-xs text-muted-foreground", children: [
2749
+ const notice = message ? /* @__PURE__ */ jsxs8("span", { role: message.error ? "alert" : "status", className: message.error ? "text-xs text-destructive" : "text-xs text-muted-foreground", children: [
2126
2750
  message.text,
2127
- /* @__PURE__ */ jsx13("button", { type: "button", "aria-label": "Dismiss notification", className: "ml-2 underline", onClick: () => setMessage(null), children: "Dismiss" })
2751
+ /* @__PURE__ */ jsx15("button", { type: "button", "aria-label": "Dismiss notification", className: "ml-2 underline", onClick: () => setMessage(null), children: "Dismiss" })
2128
2752
  ] }) : null;
2129
2753
  return { notify, notice };
2130
2754
  }
2131
2755
 
2132
- // src/tooltip.tsx
2133
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
2134
- import * as React9 from "react";
2135
- import { jsx as jsx14 } from "react/jsx-runtime";
2136
- var TooltipProvider = TooltipPrimitive.Provider;
2137
- var Tooltip = TooltipPrimitive.Root;
2138
- var TooltipTrigger = TooltipPrimitive.Trigger;
2139
- var TooltipContent = React9.forwardRef(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {
2140
- const resolved = usePortalContainer(container);
2141
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Portal, { container: resolved ?? null, children: /* @__PURE__ */ jsx14(
2142
- TooltipPrimitive.Content,
2143
- {
2144
- ref,
2145
- "data-slot": "tooltip-content",
2146
- sideOffset,
2147
- className: cn(
2148
- "z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md",
2149
- animated && MOTION_POPPER,
2150
- className
2151
- ),
2152
- ...props
2153
- }
2154
- ) });
2155
- });
2156
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
2157
-
2158
2756
  // src/data-table/MatrxUuidCell.tsx
2159
- import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
2757
+ import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
2160
2758
  var SHORT_LEN = 8;
2161
2759
  function shortUuid(id, len = SHORT_LEN) {
2162
2760
  return id.slice(0, len);
@@ -2206,7 +2804,7 @@ function MatrxUuidCell({
2206
2804
  []
2207
2805
  );
2208
2806
  if (!value) {
2209
- return /* @__PURE__ */ jsx15("span", { className: "text-muted-foreground/40", children: "\u2014" });
2807
+ return /* @__PURE__ */ jsx16("span", { className: "text-muted-foreground/40", children: "\u2014" });
2210
2808
  }
2211
2809
  const doors = token ? resolveEntityDoors?.(token, value, href) ?? null : null;
2212
2810
  const resolvedHref = doors?.href ?? href ?? null;
@@ -2249,13 +2847,13 @@ function MatrxUuidCell({
2249
2847
  };
2250
2848
  const idNode = (() => {
2251
2849
  if (forbidden) {
2252
- return /* @__PURE__ */ jsxs8("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums", children: [
2253
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate", children: display }),
2254
- /* @__PURE__ */ jsx15(ShieldOff, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": true })
2850
+ return /* @__PURE__ */ jsxs9("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums", children: [
2851
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate", children: display }),
2852
+ /* @__PURE__ */ jsx16(ShieldOff, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": true })
2255
2853
  ] });
2256
2854
  }
2257
2855
  if (onOpen) {
2258
- return /* @__PURE__ */ jsxs8(
2856
+ return /* @__PURE__ */ jsxs9(
2259
2857
  "button",
2260
2858
  {
2261
2859
  type: "button",
@@ -2264,14 +2862,14 @@ function MatrxUuidCell({
2264
2862
  disabled: opening,
2265
2863
  className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400 disabled:opacity-60",
2266
2864
  children: [
2267
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate tabular-nums", children: display }),
2268
- /* @__PURE__ */ jsx15(PanelRight, { className: "h-3 w-3 shrink-0 opacity-50" })
2865
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate tabular-nums", children: display }),
2866
+ /* @__PURE__ */ jsx16(PanelRight, { className: "h-3 w-3 shrink-0 opacity-50" })
2269
2867
  ]
2270
2868
  }
2271
2869
  );
2272
2870
  }
2273
2871
  if (resolvedHref) {
2274
- return /* @__PURE__ */ jsxs8(
2872
+ return /* @__PURE__ */ jsxs9(
2275
2873
  "a",
2276
2874
  {
2277
2875
  href: resolvedHref,
@@ -2281,15 +2879,15 @@ function MatrxUuidCell({
2281
2879
  onClick: stop,
2282
2880
  className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400",
2283
2881
  children: [
2284
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate tabular-nums", children: display }),
2285
- /* @__PURE__ */ jsx15(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
2882
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate tabular-nums", children: display }),
2883
+ /* @__PURE__ */ jsx16(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
2286
2884
  ]
2287
2885
  }
2288
2886
  );
2289
2887
  }
2290
- return /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
2888
+ return /* @__PURE__ */ jsx16("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
2291
2889
  })();
2292
- return /* @__PURE__ */ jsx15(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs8(
2890
+ return /* @__PURE__ */ jsx16(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs9(
2293
2891
  "span",
2294
2892
  {
2295
2893
  "data-matrx-cell-control": true,
@@ -2299,12 +2897,12 @@ function MatrxUuidCell({
2299
2897
  ),
2300
2898
  onClick: stop,
2301
2899
  children: [
2302
- /* @__PURE__ */ jsxs8(Tooltip, { children: [
2303
- /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
2304
- /* @__PURE__ */ jsx15(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
2900
+ /* @__PURE__ */ jsxs9(Tooltip, { children: [
2901
+ /* @__PURE__ */ jsx16(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx16("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
2902
+ /* @__PURE__ */ jsx16(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
2305
2903
  ] }),
2306
- /* @__PURE__ */ jsxs8(Tooltip, { children: [
2307
- /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
2904
+ /* @__PURE__ */ jsxs9(Tooltip, { children: [
2905
+ /* @__PURE__ */ jsx16(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx16(
2308
2906
  "button",
2309
2907
  {
2310
2908
  type: "button",
@@ -2314,13 +2912,13 @@ function MatrxUuidCell({
2314
2912
  "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2315
2913
  copied && "text-primary"
2316
2914
  ),
2317
- children: copied ? /* @__PURE__ */ jsx15(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx15(Copy, { className: "h-3 w-3" })
2915
+ children: copied ? /* @__PURE__ */ jsx16(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx16(Copy, { className: "h-3 w-3" })
2318
2916
  }
2319
2917
  ) }),
2320
- /* @__PURE__ */ jsx15(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
2918
+ /* @__PURE__ */ jsx16(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
2321
2919
  ] }),
2322
- canPeek ? /* @__PURE__ */ jsxs8(Tooltip, { children: [
2323
- /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
2920
+ canPeek ? /* @__PURE__ */ jsxs9(Tooltip, { children: [
2921
+ /* @__PURE__ */ jsx16(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx16(
2324
2922
  "button",
2325
2923
  {
2326
2924
  type: "button",
@@ -2330,16 +2928,16 @@ function MatrxUuidCell({
2330
2928
  },
2331
2929
  "aria-label": `Quick look at ${label ?? "record"}`,
2332
2930
  className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2333
- children: /* @__PURE__ */ jsx15(Lightbulb, { className: "h-3 w-3" })
2931
+ children: /* @__PURE__ */ jsx16(Lightbulb, { className: "h-3 w-3" })
2334
2932
  }
2335
2933
  ) }),
2336
- /* @__PURE__ */ jsxs8(TooltipContent, { side: "top", children: [
2934
+ /* @__PURE__ */ jsxs9(TooltipContent, { side: "top", children: [
2337
2935
  "Quick look at ",
2338
2936
  label ?? "record"
2339
2937
  ] })
2340
2938
  ] }) : null,
2341
- onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsxs8(Tooltip, { children: [
2342
- /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
2939
+ onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsxs9(Tooltip, { children: [
2940
+ /* @__PURE__ */ jsx16(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx16(
2343
2941
  "a",
2344
2942
  {
2345
2943
  href: resolvedHref,
@@ -2348,10 +2946,10 @@ function MatrxUuidCell({
2348
2946
  onClick: stop,
2349
2947
  "aria-label": `Open ${label ?? "record"} in a new tab`,
2350
2948
  className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2351
- children: /* @__PURE__ */ jsx15(ExternalLink, { className: "h-3 w-3" })
2949
+ children: /* @__PURE__ */ jsx16(ExternalLink, { className: "h-3 w-3" })
2352
2950
  }
2353
2951
  ) }),
2354
- /* @__PURE__ */ jsxs8(TooltipContent, { side: "top", children: [
2952
+ /* @__PURE__ */ jsxs9(TooltipContent, { side: "top", children: [
2355
2953
  "Open ",
2356
2954
  label ?? "record",
2357
2955
  " in a new tab"
@@ -2359,7 +2957,7 @@ function MatrxUuidCell({
2359
2957
  ] }) : null,
2360
2958
  trailing,
2361
2959
  notice,
2362
- canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ jsx15(
2960
+ canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ jsx16(
2363
2961
  ResourcePeek,
2364
2962
  {
2365
2963
  kind: doors?.peekKind ?? token ?? "record",
@@ -2379,7 +2977,7 @@ function isUuidValue(value) {
2379
2977
  }
2380
2978
 
2381
2979
  // src/data-table/DataRowInspector.tsx
2382
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
2980
+ import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
2383
2981
  var noFieldToken = () => null;
2384
2982
  function formatValue(value) {
2385
2983
  if (value == null) return "\u2014";
@@ -2408,7 +3006,7 @@ function DataRowInspector({
2408
3006
  tokenForField = noFieldToken
2409
3007
  }) {
2410
3008
  const entries = isPlainObject(row) ? Object.entries(row) : [["value", row]];
2411
- const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ jsx16("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ jsx16(
3009
+ const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ jsx17("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ jsx17(
2412
3010
  CopyButtons,
2413
3011
  {
2414
3012
  size: "xs",
@@ -2423,21 +3021,21 @@ function DataRowInspector({
2423
3021
  })
2424
3022
  }
2425
3023
  ) }) : null;
2426
- return /* @__PURE__ */ jsxs9(
3024
+ return /* @__PURE__ */ jsxs10(
2427
3025
  "div",
2428
3026
  {
2429
3027
  className: cn("flex h-full min-h-0 flex-col overflow-hidden", className),
2430
3028
  children: [
2431
- title ? /* @__PURE__ */ jsx16("div", { className: "shrink-0 border-b border-border px-3 py-2 text-sm font-medium", children: title }) : null,
2432
- /* @__PURE__ */ jsx16("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ jsx16("dl", { className: "space-y-2", children: entries.map(([key, value]) => {
3029
+ title ? /* @__PURE__ */ jsx17("div", { className: "shrink-0 border-b border-border px-3 py-2 text-sm font-medium", children: title }) : null,
3030
+ /* @__PURE__ */ jsx17("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ jsx17("dl", { className: "space-y-2", children: entries.map(([key, value]) => {
2433
3031
  if (isUuidValue(value)) {
2434
- return /* @__PURE__ */ jsxs9(
3032
+ return /* @__PURE__ */ jsxs10(
2435
3033
  "div",
2436
3034
  {
2437
3035
  className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2",
2438
3036
  children: [
2439
- /* @__PURE__ */ jsx16("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
2440
- /* @__PURE__ */ jsx16("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx16(
3037
+ /* @__PURE__ */ jsx17("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
3038
+ /* @__PURE__ */ jsx17("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx17(
2441
3039
  MatrxUuidCell,
2442
3040
  {
2443
3041
  value,
@@ -2452,13 +3050,13 @@ function DataRowInspector({
2452
3050
  }
2453
3051
  const formatted = formatValue(value);
2454
3052
  const multiline = formatted.includes("\n") || formatted.length > 80;
2455
- return /* @__PURE__ */ jsxs9(
3053
+ return /* @__PURE__ */ jsxs10(
2456
3054
  "div",
2457
3055
  {
2458
3056
  className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 py-2 pl-2.5 pr-12",
2459
3057
  children: [
2460
- /* @__PURE__ */ jsx16("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
2461
- /* @__PURE__ */ jsx16(
3058
+ /* @__PURE__ */ jsx17("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
3059
+ /* @__PURE__ */ jsx17(
2462
3060
  "dd",
2463
3061
  {
2464
3062
  className: cn(
@@ -2480,7 +3078,7 @@ function DataRowInspector({
2480
3078
  }
2481
3079
 
2482
3080
  // src/data-table/DataRowWindow.tsx
2483
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
3081
+ import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
2484
3082
  function DataRowWindow({
2485
3083
  isOpen,
2486
3084
  onClose,
@@ -2506,9 +3104,9 @@ function DataRowWindow({
2506
3104
  setTab(defaultTab ?? (hasEdit ? "edit" : "view"));
2507
3105
  }, [isOpen, windowId, hasEdit, defaultTab]);
2508
3106
  if (!isOpen) return null;
2509
- const viewBody = viewContent ?? /* @__PURE__ */ jsx17(DataRowInspector, { row });
2510
- const body = children ?? /* @__PURE__ */ jsx17("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden", children: hasTabs ? tab === "edit" ? /* @__PURE__ */ jsx17("div", { className: "min-h-0 flex-1 overflow-y-auto", children: editContent }) : /* @__PURE__ */ jsx17("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) : /* @__PURE__ */ jsx17("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) });
2511
- return /* @__PURE__ */ jsx17(
3107
+ const viewBody = viewContent ?? /* @__PURE__ */ jsx18(DataRowInspector, { row });
3108
+ const body = children ?? /* @__PURE__ */ jsx18("div", { className: "flex h-full min-h-0 flex-1 flex-col overflow-hidden", children: hasTabs ? tab === "edit" ? /* @__PURE__ */ jsx18("div", { className: "min-h-0 flex-1 overflow-y-auto", children: editContent }) : /* @__PURE__ */ jsx18("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) : /* @__PURE__ */ jsx18("div", { className: "min-h-0 flex-1 overflow-y-auto", children: viewBody }) });
3109
+ return /* @__PURE__ */ jsx18(
2512
3110
  WindowPanel,
2513
3111
  {
2514
3112
  id: windowId,
@@ -2522,26 +3120,26 @@ function DataRowWindow({
2522
3120
  bodyClassName: "flex min-h-0 flex-1 flex-col overflow-hidden p-0",
2523
3121
  sidebarDefaultSize: 140,
2524
3122
  sidebarMinSize: 110,
2525
- sidebar: hasTabs ? /* @__PURE__ */ jsxs10(
3123
+ sidebar: hasTabs ? /* @__PURE__ */ jsxs11(
2526
3124
  "nav",
2527
3125
  {
2528
3126
  "aria-label": "Row window tabs",
2529
3127
  className: "flex h-full flex-col gap-0.5 overflow-y-auto p-1.5",
2530
3128
  children: [
2531
- /* @__PURE__ */ jsx17(
3129
+ /* @__PURE__ */ jsx18(
2532
3130
  TabButton,
2533
3131
  {
2534
3132
  active: tab === "view",
2535
- icon: /* @__PURE__ */ jsx17(Eye, { className: "h-4 w-4 shrink-0" }),
3133
+ icon: /* @__PURE__ */ jsx18(Eye, { className: "h-4 w-4 shrink-0" }),
2536
3134
  label: "View",
2537
3135
  onClick: () => setTab("view")
2538
3136
  }
2539
3137
  ),
2540
- /* @__PURE__ */ jsx17(
3138
+ /* @__PURE__ */ jsx18(
2541
3139
  TabButton,
2542
3140
  {
2543
3141
  active: tab === "edit",
2544
- icon: /* @__PURE__ */ jsx17(Pencil, { className: "h-4 w-4 shrink-0" }),
3142
+ icon: /* @__PURE__ */ jsx18(Pencil, { className: "h-4 w-4 shrink-0" }),
2545
3143
  label: "Edit",
2546
3144
  onClick: () => setTab("edit")
2547
3145
  }
@@ -2559,7 +3157,7 @@ function TabButton({
2559
3157
  label,
2560
3158
  onClick
2561
3159
  }) {
2562
- return /* @__PURE__ */ jsxs10(
3160
+ return /* @__PURE__ */ jsxs11(
2563
3161
  "button",
2564
3162
  {
2565
3163
  type: "button",
@@ -2572,7 +3170,7 @@ function TabButton({
2572
3170
  ),
2573
3171
  children: [
2574
3172
  icon,
2575
- /* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate", children: label })
3173
+ /* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 truncate", children: label })
2576
3174
  ]
2577
3175
  }
2578
3176
  );