@aivex/ui 1.2.0-dev.49 → 1.2.0-dev.50

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 (63) hide show
  1. package/dist/components/Avatar/Avatar.cjs +1 -1
  2. package/dist/components/Avatar/Avatar.cjs.map +1 -1
  3. package/dist/components/Avatar/Avatar.d.ts +2 -4
  4. package/dist/components/Avatar/Avatar.js +31 -29
  5. package/dist/components/Avatar/Avatar.js.map +1 -1
  6. package/dist/components/Calendar/Calendar.cjs +1 -1
  7. package/dist/components/Calendar/Calendar.js +25 -25
  8. package/dist/components/Checkbox/Checkbox.cjs +1 -1
  9. package/dist/components/Checkbox/Checkbox.js +10 -10
  10. package/dist/components/Comment/MentionInput.cjs +1 -1
  11. package/dist/components/Comment/MentionInput.js +8 -8
  12. package/dist/components/Comment/MentionList.cjs +1 -1
  13. package/dist/components/Comment/MentionList.js +36 -36
  14. package/dist/components/DataGrid/DataGrid.cjs +1 -1
  15. package/dist/components/DataGrid/DataGrid.js +108 -108
  16. package/dist/components/DataGrid/DataGrid.js.map +1 -1
  17. package/dist/components/DataGrid/DataGridColumnSettings.cjs +1 -1
  18. package/dist/components/DataGrid/DataGridColumnSettings.js +36 -36
  19. package/dist/components/DataGrid/DataGridPrimitives.cjs +1 -1
  20. package/dist/components/DataGrid/DataGridPrimitives.js +48 -48
  21. package/dist/components/DataGrid/DataGridRows.cjs +1 -1
  22. package/dist/components/DataGrid/DataGridRows.js +24 -24
  23. package/dist/components/DraggableScroll/DraggableScroll.cjs +1 -1
  24. package/dist/components/DraggableScroll/DraggableScroll.js +5 -5
  25. package/dist/components/Field/Field.cjs +1 -1
  26. package/dist/components/Field/Field.js +34 -34
  27. package/dist/components/FilterModal/FilterModal.cjs +1 -1
  28. package/dist/components/FilterModal/FilterModal.js +24 -24
  29. package/dist/components/Modal/Modal.cjs +1 -1
  30. package/dist/components/Modal/Modal.js +51 -51
  31. package/dist/components/Pagination/Pagination.cjs +1 -1
  32. package/dist/components/Pagination/Pagination.js +24 -24
  33. package/dist/components/Radio/Radio.cjs +1 -1
  34. package/dist/components/Radio/Radio.js +9 -9
  35. package/dist/components/Segmented/Segmented.cjs +1 -1
  36. package/dist/components/Segmented/Segmented.js +12 -12
  37. package/dist/components/SelectBox/SelectBox.cjs +1 -1
  38. package/dist/components/SelectBox/SelectBox.js +12 -12
  39. package/dist/components/ShapeEditor/ShapeEditor.cjs +1 -1
  40. package/dist/components/ShapeEditor/ShapeEditor.js +367 -367
  41. package/dist/components/ShapeEditor/ShapeEditor.js.map +1 -1
  42. package/dist/components/ShapeEditor/ShapeViewer.cjs +1 -1
  43. package/dist/components/ShapeEditor/ShapeViewer.js +17 -17
  44. package/dist/components/ShapeEditor/_components/CursorGuide.cjs +1 -1
  45. package/dist/components/ShapeEditor/_components/CursorGuide.js +7 -7
  46. package/dist/components/ShapeEditor/_components/Minimap.cjs +1 -1
  47. package/dist/components/ShapeEditor/_components/Minimap.js +29 -29
  48. package/dist/components/ShapeEditor/_components/MinimapShape.cjs +1 -1
  49. package/dist/components/ShapeEditor/_components/MinimapShape.cjs.map +1 -1
  50. package/dist/components/ShapeEditor/_components/MinimapShape.js +9 -9
  51. package/dist/components/Slider/Slider.cjs +1 -1
  52. package/dist/components/Slider/Slider.js +10 -10
  53. package/dist/components/Switch/Switch.cjs +1 -1
  54. package/dist/components/Switch/Switch.js +7 -7
  55. package/dist/components/Tagbox/Tagbox.cjs +1 -1
  56. package/dist/components/Tagbox/Tagbox.js +7 -7
  57. package/dist/components/Textarea/Textarea.cjs +1 -1
  58. package/dist/components/Textarea/Textarea.js +9 -9
  59. package/dist/components/Textbox/Textbox.cjs +1 -1
  60. package/dist/components/Textbox/Textbox.js +7 -7
  61. package/dist/components/UploadArea/UploadArea.cjs +1 -1
  62. package/dist/components/UploadArea/UploadArea.js +19 -19
  63. package/package.json +1 -1
@@ -4,35 +4,35 @@ import { cn as e } from "../../utils.js";
4
4
  import { InteractionLayer as t } from "../InteractionLayer/InteractionLayer.js";
5
5
  import { DirectionDoubleLeftIcon as n, DirectionDoubleRightIcon as r, DirectionLeftIcon as i, DirectionRightIcon as a } from "../Icon/index.js";
6
6
  import { SelectBox as o } from "../SelectBox/SelectBox.js";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
- import { useRef as l } from "react";
7
+ import { useRef as s } from "react";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
9
  //#region src/components/Pagination/Pagination.tsx
10
10
  function u({ onClick: e, disabled: n, "aria-label": r, children: i }) {
11
- return /* @__PURE__ */ c("button", {
11
+ return /* @__PURE__ */ l("button", {
12
12
  type: "button",
13
13
  "aria-label": r,
14
14
  disabled: n,
15
15
  onClick: e,
16
16
  className: "aivex:relative aivex:overflow-hidden aivex:group aivex:flex aivex:h-8 aivex:w-8 aivex:items-center aivex:justify-center aivex:rounded-sm aivex:text-text-secondary aivex:disabled:opacity-disable aivex:disabled:pointer-events-none aivex:transition-colors",
17
- children: [/* @__PURE__ */ s(t, { variant: "default" }), i]
17
+ children: [/* @__PURE__ */ c(t, { variant: "default" }), i]
18
18
  });
19
19
  }
20
20
  function d({ page: n, isActive: r, disabled: i, onClick: a }) {
21
- return /* @__PURE__ */ c("button", {
21
+ return /* @__PURE__ */ l("button", {
22
22
  type: "button",
23
23
  "aria-label": `Page ${n}`,
24
24
  "aria-current": r ? "page" : void 0,
25
25
  disabled: i,
26
26
  onClick: a,
27
27
  className: e("aivex:relative aivex:overflow-hidden aivex:group aivex:flex aivex:h-8 aivex:px-xs aivex:items-center aivex:justify-center aivex:rounded-full aivex:transition-colors aivex:disabled:opacity-disable aivex:disabled:pointer-events-none", r ? "aivex:bg-bg-brand-subtle aivex:text-text-brand" : "aivex:text-text-secondary"),
28
- children: [/* @__PURE__ */ s(t, { variant: r ? "strong" : "default" }), /* @__PURE__ */ s("span", {
28
+ children: [/* @__PURE__ */ c(t, { variant: r ? "strong" : "default" }), /* @__PURE__ */ c("span", {
29
29
  className: "aivex:relative aivex:min-w-6 aivex:text-center aivex:text-label-lg",
30
30
  children: n
31
31
  })]
32
32
  });
33
33
  }
34
34
  function f({ className: t, totalPages: f, page: p, pageSize: m, disabled: h, pageSizeOptions: g, onPageChange: _, onPageSizeChange: v, ref: y, ...b }) {
35
- let x = l(void 0);
35
+ let x = s(void 0);
36
36
  f != null && (x.current = f);
37
37
  let S = f ?? x.current;
38
38
  if (S == null) return null;
@@ -41,58 +41,58 @@ function f({ className: t, totalPages: f, page: p, pageSize: m, disabled: h, pag
41
41
  }, M = (e) => {
42
42
  v?.(Number(e));
43
43
  };
44
- return /* @__PURE__ */ c("nav", {
44
+ return /* @__PURE__ */ l("nav", {
45
45
  ref: y,
46
46
  "aria-label": "Pagination",
47
47
  className: e("aivex:flex aivex:items-center", t),
48
48
  ...b,
49
49
  children: [
50
- /* @__PURE__ */ s("div", { className: "aivex:flex-1" }),
51
- /* @__PURE__ */ c("div", {
50
+ /* @__PURE__ */ c("div", { className: "aivex:flex-1" }),
51
+ /* @__PURE__ */ l("div", {
52
52
  className: "aivex:flex aivex:items-center aivex:gap-6 aivex:shrink-0",
53
53
  children: [
54
- /* @__PURE__ */ c("div", {
54
+ /* @__PURE__ */ l("div", {
55
55
  className: "aivex:flex aivex:gap-2",
56
- children: [/* @__PURE__ */ s(u, {
56
+ children: [/* @__PURE__ */ c(u, {
57
57
  "aria-label": "First page",
58
58
  disabled: h || k,
59
59
  onClick: () => j(1),
60
- children: /* @__PURE__ */ s(n, { size: 16 })
61
- }), /* @__PURE__ */ s(u, {
60
+ children: /* @__PURE__ */ c(n, { size: 16 })
61
+ }), /* @__PURE__ */ c(u, {
62
62
  "aria-label": "Previous page group",
63
63
  disabled: h || k,
64
64
  onClick: () => j(E - 10),
65
- children: /* @__PURE__ */ s(i, { size: 16 })
65
+ children: /* @__PURE__ */ c(i, { size: 16 })
66
66
  })]
67
67
  }),
68
- /* @__PURE__ */ s("div", {
68
+ /* @__PURE__ */ c("div", {
69
69
  className: "aivex:flex aivex:gap-2",
70
- children: O.map((e) => /* @__PURE__ */ s(d, {
70
+ children: O.map((e) => /* @__PURE__ */ c(d, {
71
71
  page: e,
72
72
  isActive: e === w,
73
73
  disabled: h,
74
74
  onClick: () => j(e)
75
75
  }, e))
76
76
  }),
77
- /* @__PURE__ */ c("div", {
77
+ /* @__PURE__ */ l("div", {
78
78
  className: "aivex:flex aivex:gap-2",
79
- children: [/* @__PURE__ */ s(u, {
79
+ children: [/* @__PURE__ */ c(u, {
80
80
  "aria-label": "Next page group",
81
81
  disabled: h || A,
82
82
  onClick: () => j(D + 1),
83
- children: /* @__PURE__ */ s(a, { size: 16 })
84
- }), /* @__PURE__ */ s(u, {
83
+ children: /* @__PURE__ */ c(a, { size: 16 })
84
+ }), /* @__PURE__ */ c(u, {
85
85
  "aria-label": "Last page",
86
86
  disabled: h || A,
87
87
  onClick: () => j(C),
88
- children: /* @__PURE__ */ s(r, { size: 16 })
88
+ children: /* @__PURE__ */ c(r, { size: 16 })
89
89
  })]
90
90
  })
91
91
  ]
92
92
  }),
93
- /* @__PURE__ */ s("div", {
93
+ /* @__PURE__ */ c("div", {
94
94
  className: "aivex:flex-1 aivex:flex aivex:items-center aivex:justify-end",
95
- children: g && /* @__PURE__ */ s(o, {
95
+ children: g && /* @__PURE__ */ c(o, {
96
96
  size: "sm",
97
97
  className: "aivex:w-[116px] aivex:shrink-0",
98
98
  value: String(m),
@@ -1,2 +1,2 @@
1
- "use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`);let t=require(`class-variance-authority`),n=require(`react/jsx-runtime`),r=require(`react`);var i=(0,t.cva)(`aivex:peer aivex:relative aivex:m-0 aivex:shrink-0 aivex:rounded-full aivex:border aivex:border-border-default aivex:bg-bg-primary aivex:appearance-none aivex:cursor-pointer aivex:transition-colors aivex:checked:border-transparent aivex:checked:bg-bg-brand`,{variants:{size:{sm:`aivex:w-4 aivex:h-4`,md:`aivex:w-[18px] aivex:h-[18px]`}},defaultVariants:{size:`md`}}),a={sm:`aivex:w-5 aivex:h-5`,md:`aivex:w-6 aivex:h-6`},o={sm:`aivex:h-5`,md:`aivex:h-6`};function s({className:t,label:s,size:c=`md`,disabled:l,checked:u,id:d,ref:f,...p}){let m=c??`md`,h={sm:`aivex:w-2 aivex:h-2`,md:`aivex:w-2.5 aivex:h-2.5`}[m],g=(0,r.useId)(),_=d??g;return(0,n.jsxs)(`span`,{className:e.cn(`aivex:inline-flex aivex:items-center aivex:gap-md`,l&&`aivex:opacity-disable aivex:pointer-events-none`),children:[(0,n.jsxs)(`span`,{className:e.cn(`aivex:relative aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:group`,a[m]),children:[(0,n.jsx)(`span`,{className:`aivex:absolute aivex:-inset-1 aivex:rounded-full aivex:bg-bg-inverse-strong aivex:opacity-0 aivex:group-hover:opacity-4 aivex:group-active:opacity-8 aivex:pointer-events-none aivex:transition-opacity`}),(0,n.jsx)(`input`,{ref:f,id:_,type:`radio`,disabled:l,checked:u,className:e.cn(i({size:m}),t),...p}),(0,n.jsx)(`span`,{className:e.cn(`aivex:pointer-events-none aivex:absolute aivex:rounded-full aivex:bg-static-white aivex:opacity-0 aivex:transition-opacity aivex:peer-checked:opacity-100`,h)})]}),s&&(0,n.jsx)(`label`,{htmlFor:_,className:e.cn(`aivex:inline-flex aivex:items-center aivex:cursor-pointer aivex:select-none aivex:text-label-lg aivex:text-text-primary`,l&&`aivex:cursor-not-allowed`,o[m]),children:s})]})}exports.Radio=s,exports.radioVariants=i;
1
+ "use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`);let t=require(`class-variance-authority`),n=require(`react`),r=require(`react/jsx-runtime`);var i=(0,t.cva)(`aivex:peer aivex:relative aivex:m-0 aivex:shrink-0 aivex:rounded-full aivex:border aivex:border-border-default aivex:bg-bg-primary aivex:appearance-none aivex:cursor-pointer aivex:transition-colors aivex:checked:border-transparent aivex:checked:bg-bg-brand`,{variants:{size:{sm:`aivex:w-4 aivex:h-4`,md:`aivex:w-[18px] aivex:h-[18px]`}},defaultVariants:{size:`md`}}),a={sm:`aivex:w-5 aivex:h-5`,md:`aivex:w-6 aivex:h-6`},o={sm:`aivex:h-5`,md:`aivex:h-6`};function s({className:t,label:s,size:c=`md`,disabled:l,checked:u,id:d,ref:f,...p}){let m=c??`md`,h={sm:`aivex:w-2 aivex:h-2`,md:`aivex:w-2.5 aivex:h-2.5`}[m],g=(0,n.useId)(),_=d??g;return(0,r.jsxs)(`span`,{className:e.cn(`aivex:inline-flex aivex:items-center aivex:gap-md`,l&&`aivex:opacity-disable aivex:pointer-events-none`),children:[(0,r.jsxs)(`span`,{className:e.cn(`aivex:relative aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:group`,a[m]),children:[(0,r.jsx)(`span`,{className:`aivex:absolute aivex:-inset-1 aivex:rounded-full aivex:bg-bg-inverse-strong aivex:opacity-0 aivex:group-hover:opacity-4 aivex:group-active:opacity-8 aivex:pointer-events-none aivex:transition-opacity`}),(0,r.jsx)(`input`,{ref:f,id:_,type:`radio`,disabled:l,checked:u,className:e.cn(i({size:m}),t),...p}),(0,r.jsx)(`span`,{className:e.cn(`aivex:pointer-events-none aivex:absolute aivex:rounded-full aivex:bg-static-white aivex:opacity-0 aivex:transition-opacity aivex:peer-checked:opacity-100`,h)})]}),s&&(0,r.jsx)(`label`,{htmlFor:_,className:e.cn(`aivex:inline-flex aivex:items-center aivex:cursor-pointer aivex:select-none aivex:text-label-lg aivex:text-text-primary`,l&&`aivex:cursor-not-allowed`,o[m]),children:s})]})}exports.Radio=s,exports.radioVariants=i;
2
2
  //# sourceMappingURL=Radio.cjs.map
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { cn as e } from "../../utils.js";
3
3
  import { cva as t } from "class-variance-authority";
4
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
- import { useId as i } from "react";
4
+ import { useId as n } from "react";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
6
  //#region src/components/Radio/Radio.tsx
7
7
  var a = t("aivex:peer aivex:relative aivex:m-0 aivex:shrink-0 aivex:rounded-full aivex:border aivex:border-border-default aivex:bg-bg-primary aivex:appearance-none aivex:cursor-pointer aivex:transition-colors aivex:checked:border-transparent aivex:checked:bg-bg-brand", {
8
8
  variants: { size: {
@@ -21,14 +21,14 @@ function c({ className: t, label: c, size: l = "md", disabled: u, checked: d, id
21
21
  let h = l ?? "md", g = {
22
22
  sm: "aivex:w-2 aivex:h-2",
23
23
  md: "aivex:w-2.5 aivex:h-2.5"
24
- }[h], _ = i(), v = f ?? _;
25
- return /* @__PURE__ */ r("span", {
24
+ }[h], _ = n(), v = f ?? _;
25
+ return /* @__PURE__ */ i("span", {
26
26
  className: e("aivex:inline-flex aivex:items-center aivex:gap-md", u && "aivex:opacity-disable aivex:pointer-events-none"),
27
- children: [/* @__PURE__ */ r("span", {
27
+ children: [/* @__PURE__ */ i("span", {
28
28
  className: e("aivex:relative aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:group", o[h]),
29
29
  children: [
30
- /* @__PURE__ */ n("span", { className: "aivex:absolute aivex:-inset-1 aivex:rounded-full aivex:bg-bg-inverse-strong aivex:opacity-0 aivex:group-hover:opacity-4 aivex:group-active:opacity-8 aivex:pointer-events-none aivex:transition-opacity" }),
31
- /* @__PURE__ */ n("input", {
30
+ /* @__PURE__ */ r("span", { className: "aivex:absolute aivex:-inset-1 aivex:rounded-full aivex:bg-bg-inverse-strong aivex:opacity-0 aivex:group-hover:opacity-4 aivex:group-active:opacity-8 aivex:pointer-events-none aivex:transition-opacity" }),
31
+ /* @__PURE__ */ r("input", {
32
32
  ref: p,
33
33
  id: v,
34
34
  type: "radio",
@@ -37,9 +37,9 @@ function c({ className: t, label: c, size: l = "md", disabled: u, checked: d, id
37
37
  className: e(a({ size: h }), t),
38
38
  ...m
39
39
  }),
40
- /* @__PURE__ */ n("span", { className: e("aivex:pointer-events-none aivex:absolute aivex:rounded-full aivex:bg-static-white aivex:opacity-0 aivex:transition-opacity aivex:peer-checked:opacity-100", g) })
40
+ /* @__PURE__ */ r("span", { className: e("aivex:pointer-events-none aivex:absolute aivex:rounded-full aivex:bg-static-white aivex:opacity-0 aivex:transition-opacity aivex:peer-checked:opacity-100", g) })
41
41
  ]
42
- }), c && /* @__PURE__ */ n("label", {
42
+ }), c && /* @__PURE__ */ r("label", {
43
43
  htmlFor: v,
44
44
  className: e("aivex:inline-flex aivex:items-center aivex:cursor-pointer aivex:select-none aivex:text-label-lg aivex:text-text-primary", u && "aivex:cursor-not-allowed", s[h]),
45
45
  children: c
@@ -1,2 +1,2 @@
1
- "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils.cjs`),n=require(`../../utils/useControllableState.cjs`);let r=require(`react/jsx-runtime`),i=require(`react`),a=require(`@radix-ui/react-toggle-group`);a=e.__toESM(a,1);var o=(0,i.createContext)({size:`md`}),s={sm:`aivex:h-7`,md:`aivex:h-8`,lg:`aivex:h-10 aivex:rounded-md`,"icon-sm":`aivex:h-7`,"icon-md":`aivex:h-8`,"icon-lg":`aivex:h-10 aivex:rounded-md`};function c({className:e,size:i=`md`,value:c,defaultValue:l,onValueChange:u,fullWidth:d,children:f,ref:p,...m}){let[h,g]=n.useControllableState({value:c,defaultValue:l??c??``,onChange:u});return(0,r.jsx)(o.Provider,{value:{size:i,fullWidth:d},children:(0,r.jsx)(a.Root,{ref:p,type:`single`,value:h,onValueChange:e=>{e&&g(e)},className:t.cn(`aivex:inline-flex aivex:items-center aivex:justify-center aivex:rounded-sm aivex:bg-bg-tertiary aivex:p-2xs`,d?`aivex:w-full`:`aivex:w-fit`,s[i],e),...m,children:f})})}var l={sm:`aivex:h-6 aivex:px-md aivex:text-label-sm aivex:[&>svg]:size-4`,md:`aivex:h-7 aivex:px-md aivex:text-label-lg aivex:[&>svg]:size-4`,lg:`aivex:h-9 aivex:px-lg aivex:text-label-xl aivex:rounded-sm aivex:[&>svg]:size-5`,"icon-sm":`aivex:h-6 aivex:w-6 aivex:px-xs aivex:[&>svg]:size-4`,"icon-md":`aivex:h-7 aivex:w-7 aivex:px-xs aivex:[&>svg]:size-5`,"icon-lg":`aivex:h-9 aivex:w-9 aivex:px-sm aivex:rounded-sm aivex:[&>svg]:size-6`};function u({className:e,children:n,ref:s,...c}){let{size:u,fullWidth:d}=(0,i.useContext)(o);return(0,r.jsx)(a.Item,{ref:s,className:t.cn(`aivex:inline-flex aivex:min-w-px aivex:shrink-0 aivex:items-center aivex:justify-center aivex:gap-xs aivex:rounded-xs aivex:text-text-secondary aivex:transition-colors aivex:duration-150 aivex:cursor-pointer aivex:select-none aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand aivex:data-[state=on]:bg-bg-float aivex:data-[state=on]:text-text-primary aivex:data-[state=on]:shadow-sm aivex:hover:text-text-primary aivex:data-[disabled]:pointer-events-none aivex:data-[disabled]:cursor-not-allowed aivex:data-[disabled]:!text-text-disabled`,l[u],d&&`aivex:flex-1`,e),...c,children:n})}exports.SegmentedItem=u,exports.SegmentedRoot=c;
1
+ "use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils.cjs`),n=require(`../../utils/useControllableState.cjs`);let r=require(`react`),i=require(`react/jsx-runtime`),a=require(`@radix-ui/react-toggle-group`);a=e.__toESM(a,1);var o=(0,r.createContext)({size:`md`}),s={sm:`aivex:h-7`,md:`aivex:h-8`,lg:`aivex:h-10 aivex:rounded-md`,"icon-sm":`aivex:h-7`,"icon-md":`aivex:h-8`,"icon-lg":`aivex:h-10 aivex:rounded-md`};function c({className:e,size:r=`md`,value:c,defaultValue:l,onValueChange:u,fullWidth:d,children:f,ref:p,...m}){let[h,g]=n.useControllableState({value:c,defaultValue:l??c??``,onChange:u});return(0,i.jsx)(o.Provider,{value:{size:r,fullWidth:d},children:(0,i.jsx)(a.Root,{ref:p,type:`single`,value:h,onValueChange:e=>{e&&g(e)},className:t.cn(`aivex:inline-flex aivex:items-center aivex:justify-center aivex:rounded-sm aivex:bg-bg-tertiary aivex:p-2xs`,d?`aivex:w-full`:`aivex:w-fit`,s[r],e),...m,children:f})})}var l={sm:`aivex:h-6 aivex:px-md aivex:text-label-sm aivex:[&>svg]:size-4`,md:`aivex:h-7 aivex:px-md aivex:text-label-lg aivex:[&>svg]:size-4`,lg:`aivex:h-9 aivex:px-lg aivex:text-label-xl aivex:rounded-sm aivex:[&>svg]:size-5`,"icon-sm":`aivex:h-6 aivex:w-6 aivex:px-xs aivex:[&>svg]:size-4`,"icon-md":`aivex:h-7 aivex:w-7 aivex:px-xs aivex:[&>svg]:size-5`,"icon-lg":`aivex:h-9 aivex:w-9 aivex:px-sm aivex:rounded-sm aivex:[&>svg]:size-6`};function u({className:e,children:n,ref:s,...c}){let{size:u,fullWidth:d}=(0,r.useContext)(o);return(0,i.jsx)(a.Item,{ref:s,className:t.cn(`aivex:inline-flex aivex:min-w-px aivex:shrink-0 aivex:items-center aivex:justify-center aivex:gap-xs aivex:rounded-xs aivex:text-text-secondary aivex:transition-colors aivex:duration-150 aivex:cursor-pointer aivex:select-none aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand aivex:data-[state=on]:bg-bg-float aivex:data-[state=on]:text-text-primary aivex:data-[state=on]:shadow-sm aivex:hover:text-text-primary aivex:data-[disabled]:pointer-events-none aivex:data-[disabled]:cursor-not-allowed aivex:data-[disabled]:!text-text-disabled`,l[u],d&&`aivex:flex-1`,e),...c,children:n})}exports.SegmentedItem=u,exports.SegmentedRoot=c;
2
2
  //# sourceMappingURL=Segmented.cjs.map
@@ -2,11 +2,11 @@
2
2
  "use client";
3
3
  import { cn as e } from "../../utils.js";
4
4
  import { useControllableState as t } from "../../utils/useControllableState.js";
5
- import { jsx as n } from "react/jsx-runtime";
6
- import { createContext as r, useContext as i } from "react";
5
+ import { createContext as n, useContext as r } from "react";
6
+ import { jsx as i } from "react/jsx-runtime";
7
7
  import * as a from "@radix-ui/react-toggle-group";
8
8
  //#region src/components/Segmented/Segmented.tsx
9
- var o = r({ size: "md" }), s = {
9
+ var o = n({ size: "md" }), s = {
10
10
  sm: "aivex:h-7",
11
11
  md: "aivex:h-8",
12
12
  lg: "aivex:h-10 aivex:rounded-md",
@@ -14,25 +14,25 @@ var o = r({ size: "md" }), s = {
14
14
  "icon-md": "aivex:h-8",
15
15
  "icon-lg": "aivex:h-10 aivex:rounded-md"
16
16
  };
17
- function c({ className: r, size: i = "md", value: c, defaultValue: l, onValueChange: u, fullWidth: d, children: f, ref: p, ...m }) {
17
+ function c({ className: n, size: r = "md", value: c, defaultValue: l, onValueChange: u, fullWidth: d, children: f, ref: p, ...m }) {
18
18
  let [h, g] = t({
19
19
  value: c,
20
20
  defaultValue: l ?? c ?? "",
21
21
  onChange: u
22
22
  });
23
- return /* @__PURE__ */ n(o.Provider, {
23
+ return /* @__PURE__ */ i(o.Provider, {
24
24
  value: {
25
- size: i,
25
+ size: r,
26
26
  fullWidth: d
27
27
  },
28
- children: /* @__PURE__ */ n(a.Root, {
28
+ children: /* @__PURE__ */ i(a.Root, {
29
29
  ref: p,
30
30
  type: "single",
31
31
  value: h,
32
32
  onValueChange: (e) => {
33
33
  e && g(e);
34
34
  },
35
- className: e("aivex:inline-flex aivex:items-center aivex:justify-center aivex:rounded-sm aivex:bg-bg-tertiary aivex:p-2xs", d ? "aivex:w-full" : "aivex:w-fit", s[i], r),
35
+ className: e("aivex:inline-flex aivex:items-center aivex:justify-center aivex:rounded-sm aivex:bg-bg-tertiary aivex:p-2xs", d ? "aivex:w-full" : "aivex:w-fit", s[r], n),
36
36
  ...m,
37
37
  children: f
38
38
  })
@@ -46,13 +46,13 @@ var l = {
46
46
  "icon-md": "aivex:h-7 aivex:w-7 aivex:px-xs aivex:[&>svg]:size-5",
47
47
  "icon-lg": "aivex:h-9 aivex:w-9 aivex:px-sm aivex:rounded-sm aivex:[&>svg]:size-6"
48
48
  };
49
- function u({ className: t, children: r, ref: s, ...c }) {
50
- let { size: u, fullWidth: d } = i(o);
51
- return /* @__PURE__ */ n(a.Item, {
49
+ function u({ className: t, children: n, ref: s, ...c }) {
50
+ let { size: u, fullWidth: d } = r(o);
51
+ return /* @__PURE__ */ i(a.Item, {
52
52
  ref: s,
53
53
  className: e("aivex:inline-flex aivex:min-w-px aivex:shrink-0 aivex:items-center aivex:justify-center aivex:gap-xs aivex:rounded-xs aivex:text-text-secondary aivex:transition-colors aivex:duration-150 aivex:cursor-pointer aivex:select-none aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand aivex:data-[state=on]:bg-bg-float aivex:data-[state=on]:text-text-primary aivex:data-[state=on]:shadow-sm aivex:hover:text-text-primary aivex:data-[disabled]:pointer-events-none aivex:data-[disabled]:cursor-not-allowed aivex:data-[disabled]:!text-text-disabled", l[u], d && "aivex:flex-1", t),
54
54
  ...c,
55
- children: r
55
+ children: n
56
56
  });
57
57
  }
58
58
  //#endregion
@@ -1,2 +1,2 @@
1
- "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils.cjs`),n=require(`../InputBase/useInputState.cjs`),r=require(`../../utils/useControllableState.cjs`),i=require(`../ScrollArea/ScrollArea.cjs`),a=require(`../SelectButton/SelectButton.cjs`);let o=require(`react/jsx-runtime`),s=require(`react`),c=require(`@radix-ui/react-select`);c=e.__toESM(c,1);function l({groups:e,value:l,defaultValue:u,placeholder:d=``,disabled:f=!1,size:p=`md`,onValueChange:m,renderValue:h,className:g,error:_,id:v,"aria-describedby":y,"aria-invalid":b}){let[x,S]=(0,s.useState)(!1),[C,w]=r.useControllableState({value:l,defaultValue:u??``,onChange:m}),T=n.resolveInputError(_,b),E=(()=>{for(let t of e){let e=t.options.find(e=>e.value===C);if(e)return h?h(e,t):e.label}})();return(0,o.jsxs)(c.Root,{value:C||void 0,onValueChange:w,disabled:f,open:x,onOpenChange:S,children:[(0,o.jsx)(c.Trigger,{asChild:!0,"aria-invalid":T||void 0,children:(0,o.jsx)(a.SelectButton,{id:v,"aria-describedby":y,value:E,placeholder:d,size:p,error:T,open:x,disabled:f,className:g})}),(0,o.jsx)(c.Portal,{children:(0,o.jsx)(c.Content,{position:`popper`,sideOffset:4,className:t.cn(`aivex:z-50 aivex:min-w-[var(--radix-select-trigger-width)] aivex:max-w-[var(--radix-select-trigger-width)]`,`aivex:rounded-md aivex:bg-bg-primary aivex:shadow-md aivex:border aivex:border-border-subtle`,`aivex:overflow-hidden`,`aivex:data-[state=open]:animate-in aivex:data-[state=open]:fade-in-0 aivex:data-[state=open]:zoom-in-95`,`aivex:data-[state=closed]:animate-out aivex:data-[state=closed]:fade-out-0 aivex:data-[state=closed]:zoom-out-95`),children:(0,o.jsx)(c.Viewport,{style:{overflow:`visible`},children:(0,o.jsx)(i.ScrollArea,{type:`auto`,className:`aivex:w-full`,viewportClassName:`aivex:max-h-[312px] aivex:p-xs`,children:e.map((e,n)=>(0,o.jsxs)(s.Fragment,{children:[n>0&&(0,o.jsx)(c.Separator,{className:`aivex:my-xs aivex:border-t aivex:border-border-default`}),(0,o.jsxs)(c.Group,{children:[e.title&&(0,o.jsx)(c.Label,{className:`aivex:px-lg aivex:py-xs aivex:text-caption-md aivex:text-text-tertiary aivex:select-none`,children:e.title}),e.options.map(e=>(0,o.jsxs)(c.Item,{value:e.value,disabled:e.disabled,className:t.cn(`aivex:relative aivex:overflow-hidden aivex:group`,`aivex:flex aivex:h-8 aivex:w-full aivex:items-center`,`aivex:px-lg aivex:rounded-sm aivex:transition-colors`,`aivex:cursor-pointer aivex:select-none aivex:outline-none`,`aivex:data-[disabled]:cursor-not-allowed aivex:data-[disabled]:opacity-disable`,p===`sm`?`aivex:text-body-md-regular`:`aivex:text-body-lg-regular`,e.danger?`aivex:text-text-danger`:`aivex:text-text-primary`),children:[(0,o.jsx)(`span`,{className:t.cn(`aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:opacity-0 aivex:transition-opacity`,e.danger?`aivex:bg-bg-danger aivex:group-data-[highlighted]:opacity-8 aivex:group-active:opacity-16`:`aivex:bg-bg-inverse-strong aivex:group-data-[highlighted]:opacity-4 aivex:group-active:opacity-8`)}),(0,o.jsx)(c.ItemText,{children:(0,o.jsx)(`span`,{className:`aivex:truncate`,children:e.label})})]},e.key??e.value))]})]},e.title??`group-${n}`))})})})})]})}exports.SelectBox=l;
1
+ "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../utils.cjs`),n=require(`../InputBase/useInputState.cjs`),r=require(`../../utils/useControllableState.cjs`),i=require(`../ScrollArea/ScrollArea.cjs`),a=require(`../SelectButton/SelectButton.cjs`);let o=require(`react`),s=require(`react/jsx-runtime`),c=require(`@radix-ui/react-select`);c=e.__toESM(c,1);function l({groups:e,value:l,defaultValue:u,placeholder:d=``,disabled:f=!1,size:p=`md`,onValueChange:m,renderValue:h,className:g,error:_,id:v,"aria-describedby":y,"aria-invalid":b}){let[x,S]=(0,o.useState)(!1),[C,w]=r.useControllableState({value:l,defaultValue:u??``,onChange:m}),T=n.resolveInputError(_,b),E=(()=>{for(let t of e){let e=t.options.find(e=>e.value===C);if(e)return h?h(e,t):e.label}})();return(0,s.jsxs)(c.Root,{value:C||void 0,onValueChange:w,disabled:f,open:x,onOpenChange:S,children:[(0,s.jsx)(c.Trigger,{asChild:!0,"aria-invalid":T||void 0,children:(0,s.jsx)(a.SelectButton,{id:v,"aria-describedby":y,value:E,placeholder:d,size:p,error:T,open:x,disabled:f,className:g})}),(0,s.jsx)(c.Portal,{children:(0,s.jsx)(c.Content,{position:`popper`,sideOffset:4,className:t.cn(`aivex:z-50 aivex:min-w-[var(--radix-select-trigger-width)] aivex:max-w-[var(--radix-select-trigger-width)]`,`aivex:rounded-md aivex:bg-bg-primary aivex:shadow-md aivex:border aivex:border-border-subtle`,`aivex:overflow-hidden`,`aivex:data-[state=open]:animate-in aivex:data-[state=open]:fade-in-0 aivex:data-[state=open]:zoom-in-95`,`aivex:data-[state=closed]:animate-out aivex:data-[state=closed]:fade-out-0 aivex:data-[state=closed]:zoom-out-95`),children:(0,s.jsx)(c.Viewport,{style:{overflow:`visible`},children:(0,s.jsx)(i.ScrollArea,{type:`auto`,className:`aivex:w-full`,viewportClassName:`aivex:max-h-[312px] aivex:p-xs`,children:e.map((e,n)=>(0,s.jsxs)(o.Fragment,{children:[n>0&&(0,s.jsx)(c.Separator,{className:`aivex:my-xs aivex:border-t aivex:border-border-default`}),(0,s.jsxs)(c.Group,{children:[e.title&&(0,s.jsx)(c.Label,{className:`aivex:px-lg aivex:py-xs aivex:text-caption-md aivex:text-text-tertiary aivex:select-none`,children:e.title}),e.options.map(e=>(0,s.jsxs)(c.Item,{value:e.value,disabled:e.disabled,className:t.cn(`aivex:relative aivex:overflow-hidden aivex:group`,`aivex:flex aivex:h-8 aivex:w-full aivex:items-center`,`aivex:px-lg aivex:rounded-sm aivex:transition-colors`,`aivex:cursor-pointer aivex:select-none aivex:outline-none`,`aivex:data-[disabled]:cursor-not-allowed aivex:data-[disabled]:opacity-disable`,p===`sm`?`aivex:text-body-md-regular`:`aivex:text-body-lg-regular`,e.danger?`aivex:text-text-danger`:`aivex:text-text-primary`),children:[(0,s.jsx)(`span`,{className:t.cn(`aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:opacity-0 aivex:transition-opacity`,e.danger?`aivex:bg-bg-danger aivex:group-data-[highlighted]:opacity-8 aivex:group-active:opacity-16`:`aivex:bg-bg-inverse-strong aivex:group-data-[highlighted]:opacity-4 aivex:group-active:opacity-8`)}),(0,s.jsx)(c.ItemText,{children:(0,s.jsx)(`span`,{className:`aivex:truncate`,children:e.label})})]},e.key??e.value))]})]},e.title??`group-${n}`))})})})})]})}exports.SelectBox=l;
2
2
  //# sourceMappingURL=SelectBox.cjs.map
@@ -4,12 +4,12 @@ import { resolveInputError as t } from "../InputBase/useInputState.js";
4
4
  import { useControllableState as n } from "../../utils/useControllableState.js";
5
5
  import { ScrollArea as r } from "../ScrollArea/ScrollArea.js";
6
6
  import { SelectButton as i } from "../SelectButton/SelectButton.js";
7
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
- import { Fragment as s, useState as c } from "react";
7
+ import { Fragment as a, useState as o } from "react";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
9
  import * as l from "@radix-ui/react-select";
10
10
  //#region src/components/SelectBox/SelectBox.tsx
11
11
  function u({ groups: u, value: d, defaultValue: f, placeholder: p = "", disabled: m = !1, size: h = "md", onValueChange: g, renderValue: _, className: v, error: y, id: b, "aria-describedby": x, "aria-invalid": S }) {
12
- let [C, w] = c(!1), [T, E] = n({
12
+ let [C, w] = o(!1), [T, E] = n({
13
13
  value: d,
14
14
  defaultValue: f ?? "",
15
15
  onChange: g
@@ -19,16 +19,16 @@ function u({ groups: u, value: d, defaultValue: f, placeholder: p = "", disabled
19
19
  if (t) return _ ? _(t, e) : t.label;
20
20
  }
21
21
  })();
22
- return /* @__PURE__ */ o(l.Root, {
22
+ return /* @__PURE__ */ c(l.Root, {
23
23
  value: T || void 0,
24
24
  onValueChange: E,
25
25
  disabled: m,
26
26
  open: C,
27
27
  onOpenChange: w,
28
- children: [/* @__PURE__ */ a(l.Trigger, {
28
+ children: [/* @__PURE__ */ s(l.Trigger, {
29
29
  asChild: !0,
30
30
  "aria-invalid": D || void 0,
31
- children: /* @__PURE__ */ a(i, {
31
+ children: /* @__PURE__ */ s(i, {
32
32
  id: b,
33
33
  "aria-describedby": x,
34
34
  value: O,
@@ -39,24 +39,24 @@ function u({ groups: u, value: d, defaultValue: f, placeholder: p = "", disabled
39
39
  disabled: m,
40
40
  className: v
41
41
  })
42
- }), /* @__PURE__ */ a(l.Portal, { children: /* @__PURE__ */ a(l.Content, {
42
+ }), /* @__PURE__ */ s(l.Portal, { children: /* @__PURE__ */ s(l.Content, {
43
43
  position: "popper",
44
44
  sideOffset: 4,
45
45
  className: e("aivex:z-50 aivex:min-w-[var(--radix-select-trigger-width)] aivex:max-w-[var(--radix-select-trigger-width)]", "aivex:rounded-md aivex:bg-bg-primary aivex:shadow-md aivex:border aivex:border-border-subtle", "aivex:overflow-hidden", "aivex:data-[state=open]:animate-in aivex:data-[state=open]:fade-in-0 aivex:data-[state=open]:zoom-in-95", "aivex:data-[state=closed]:animate-out aivex:data-[state=closed]:fade-out-0 aivex:data-[state=closed]:zoom-out-95"),
46
- children: /* @__PURE__ */ a(l.Viewport, {
46
+ children: /* @__PURE__ */ s(l.Viewport, {
47
47
  style: { overflow: "visible" },
48
- children: /* @__PURE__ */ a(r, {
48
+ children: /* @__PURE__ */ s(r, {
49
49
  type: "auto",
50
50
  className: "aivex:w-full",
51
51
  viewportClassName: "aivex:max-h-[312px] aivex:p-xs",
52
- children: u.map((t, n) => /* @__PURE__ */ o(s, { children: [n > 0 && /* @__PURE__ */ a(l.Separator, { className: "aivex:my-xs aivex:border-t aivex:border-border-default" }), /* @__PURE__ */ o(l.Group, { children: [t.title && /* @__PURE__ */ a(l.Label, {
52
+ children: u.map((t, n) => /* @__PURE__ */ c(a, { children: [n > 0 && /* @__PURE__ */ s(l.Separator, { className: "aivex:my-xs aivex:border-t aivex:border-border-default" }), /* @__PURE__ */ c(l.Group, { children: [t.title && /* @__PURE__ */ s(l.Label, {
53
53
  className: "aivex:px-lg aivex:py-xs aivex:text-caption-md aivex:text-text-tertiary aivex:select-none",
54
54
  children: t.title
55
- }), t.options.map((t) => /* @__PURE__ */ o(l.Item, {
55
+ }), t.options.map((t) => /* @__PURE__ */ c(l.Item, {
56
56
  value: t.value,
57
57
  disabled: t.disabled,
58
58
  className: e("aivex:relative aivex:overflow-hidden aivex:group", "aivex:flex aivex:h-8 aivex:w-full aivex:items-center", "aivex:px-lg aivex:rounded-sm aivex:transition-colors", "aivex:cursor-pointer aivex:select-none aivex:outline-none", "aivex:data-[disabled]:cursor-not-allowed aivex:data-[disabled]:opacity-disable", h === "sm" ? "aivex:text-body-md-regular" : "aivex:text-body-lg-regular", t.danger ? "aivex:text-text-danger" : "aivex:text-text-primary"),
59
- children: [/* @__PURE__ */ a("span", { className: e("aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:opacity-0 aivex:transition-opacity", t.danger ? "aivex:bg-bg-danger aivex:group-data-[highlighted]:opacity-8 aivex:group-active:opacity-16" : "aivex:bg-bg-inverse-strong aivex:group-data-[highlighted]:opacity-4 aivex:group-active:opacity-8") }), /* @__PURE__ */ a(l.ItemText, { children: /* @__PURE__ */ a("span", {
59
+ children: [/* @__PURE__ */ s("span", { className: e("aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:opacity-0 aivex:transition-opacity", t.danger ? "aivex:bg-bg-danger aivex:group-data-[highlighted]:opacity-8 aivex:group-active:opacity-16" : "aivex:bg-bg-inverse-strong aivex:group-data-[highlighted]:opacity-4 aivex:group-active:opacity-8") }), /* @__PURE__ */ s(l.ItemText, { children: /* @__PURE__ */ s("span", {
60
60
  className: "aivex:truncate",
61
61
  children: t.label
62
62
  }) })]
@@ -1,2 +1,2 @@
1
- "use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`./_model/geometry.cjs`),t=require(`./_model/strings.cjs`),n=require(`./_model/tools.cjs`),r=require(`./_components/AssistantOverlay.cjs`),i=require(`./_components/ContextMenu.cjs`),a=require(`./_components/CursorGuide.cjs`),ee=require(`./_components/ImageStateOverlay.cjs`),te=require(`./_components/Minimap.cjs`),ne=require(`./_components/SelectionInfo.cjs`),re=require(`./_model/clipboard.cjs`),ie=require(`./_model/cursors.cjs`),ae=require(`./_model/overlays.cjs`),oe=require(`./_state/buildContextMenuItems.cjs`),se=require(`./_state/buildHotkeyActions.cjs`),ce=require(`./_state/createInteractionController.cjs`),le=require(`./_state/useAssistant.cjs`),o=require(`./_state/useLatestRef.cjs`),ue=require(`./_state/useDrawSession.cjs`),de=require(`./_state/useEditorDocument.cjs`),fe=require(`./_state/useEditorHandle.cjs`),pe=require(`./_state/useEditorHotkeys.cjs`),me=require(`./_state/useEditorView.cjs`),he=require(`./_state/useEngineLifecycle.cjs`),ge=require(`./_state/useMinimapNavigation.cjs`),_e=require(`./_state/useMinimapSync.cjs`),ve=require(`./_state/useSelectionActions.cjs`),ye=require(`./_state/useSelectionInfoOverlay.cjs`),be=require(`./_state/useSelectionModel.cjs`),xe=require(`./_state/useViewportControls.cjs`);let s=require(`react/jsx-runtime`),c=require(`react`);function l({document:l,clipboardScope:Se,renderImageState:Ce,dimmed:u=!1,selectedIds:we,activeTool:d,draftStyle:Te,draftMeta:f,readOnly:p,disableMarquee:Ee,locked:m,onLockedInteraction:De,onDrawAttemptWithoutDraft:Oe,onIdleEscape:ke,overrideShapeInteraction:h,defaultViewSettings:Ae,viewSettings:je,onViewSettingsChange:Me,showMinimap:Ne=!0,minimapPosition:Pe=`bottom-left`,showViewSettings:Fe=!0,getContextMenuItems:Ie,strings:Le,viewSettingItems:Re,canMergeSelection:ze,brushSize:Be=20,zoomBound:Ve,zoomAnimationDuration:He=300,decorationShapes:Ue,regionMask:g,overlayMarkers:We,renderOverlayMarker:Ge,onOverlayMarkerClick:Ke,renderImageOverlay:qe,getSelectionLabel:Je,hideSelectionLabelDot:Ye,formatSelectionInfo:Xe,externalTools:Ze,assistant:_,keymap:Qe,handleRef:$e,onActiveToolChange:et,onSelectionChange:tt,onEditingChange:nt,onShapesCreated:rt,onShapesUpdated:it,onShapesDeleted:at,onDrawSessionChange:ot,onDraftShapeChange:st,onViewportChange:ct,onShapesTransformPreview:lt}){let v=(0,c.useRef)(null),y=(0,c.useRef)(null),ut=(0,c.useRef)(null),dt=(0,c.useRef)(null),ft=(0,c.useRef)(null),pt=`${(0,c.useId)()}-minimap`,[b,mt]=(0,c.useState)(null),[ht,gt]=(0,c.useState)(!1),[x,_t]=(0,c.useState)(!1),[S,vt]=(0,c.useState)(null),[yt,bt]=(0,c.useState)({active:!1,kind:`none`,canUndo:!1,canRedo:!1}),[xt,St]=(0,c.useState)(!0),[Ct,wt]=(0,c.useState)(!1),C=l?.id??``,Tt=l?.imageUrl??``,Et=l?.displayImageUrl,Dt=l?.coordinateSize,Ot=l?.initialShapes,kt=l?.initialSelectedIds,At=Et??Tt,[jt,Mt]=(0,c.useState)(`loading`),Nt=jt===`loading`&&l!==null&&!At?`missing`:jt,[Pt,Ft]=(0,c.useState)(null),It=(0,c.useCallback)((e,t)=>{Mt(e),Ft(e===`error`?t??null:null)},[]),w=de.useEditorDocument({onShapesCreated:rt,onShapesUpdated:it,onShapesDeleted:at}),T=(0,c.useMemo)(()=>new Map((Ze??[]).map(e=>[e.id,e])),[Ze]),E=(0,c.useRef)(T);(0,c.useLayoutEffect)(()=>{E.current=T},[T]);let Lt=o.useLatestRef(yt),D=(0,c.useMemo)(()=>t.mergeEditorStrings(Le),[Le]),{seededDefaults:Rt,view:O,setView:zt,updateView:Bt}=me.useEditorView({defaultViewSettings:Ae,viewSettings:je,onViewSettingsChange:Me}),k=(0,c.useMemo)(()=>!b||!g?null:ae.buildRegionOverlayData(g,b.w,b.h),[b,g]),Vt=o.useLatestRef(k),Ht=o.useLatestRef(u),Ut=o.useLatestRef(b),Wt=o.useLatestRef(Dt),Gt=o.useLatestRef(Dt?.imageSize),A=o.useLatestRef(d),j=o.useLatestRef(Te),Kt=o.useLatestRef(f),qt=o.useLatestRef(Be),Jt=o.useLatestRef(O.simplifyStrength),M=!!p||!!m,N=o.useLatestRef(M),Yt=o.useLatestRef(Ee),Xt=o.useLatestRef(m),Zt=o.useLatestRef(De),Qt=o.useLatestRef(p),P=(0,c.useCallback)((e=!0)=>Qt.current||!Xt.current||!e?!1:(Zt.current?.(),!0),[]),$t=o.useLatestRef(Oe),en=o.useLatestRef(h),F=o.useLatestRef(w),I=(0,c.useRef)(null),{selectedIds:L,selRef:R,changeSelection:z}=be.useSelectionModel({controlledSelectedIds:we,onSelectionChange:tt,docShapes:w.shapes,docRef:F,overrideInteractionRef:en,interactionControllerRef:I,engineRef:y}),B=(0,c.useRef)(!1),V=(0,c.useRef)(`idle`),H=(0,c.useRef)(null),U=(0,c.useCallback)(()=>{let e=y.current;if(!e)return;let t=A.current,n=E.current.get(t),r=Lt.current;e.setCursor(ie.resolveEditorCursor({tool:t,externalToolCursor:n?.cursor,isSpacePressed:B.current,interactionMode:V.current,rendererCursorHint:H.current,isPolygonDrawing:r.kind===`polygon`&&r.active}))},[]),tn=(0,c.useCallback)(e=>{V.current!==e&&(V.current=e,U())},[U]),nn=(0,c.useCallback)(e=>{H.current!==e&&(H.current=e,U())},[U]),rn=o.useLatestRef(z),[W,G]=(0,c.useState)(null),an=o.useLatestRef((0,c.useCallback)(e=>G(e),[])),on=o.useLatestRef(W),sn=o.useLatestRef(ct),cn=(0,c.useRef)(null),{registerMinimapShape:ln,applyMinimapPreview:un,syncMinimap:K}=_e.useMinimapSync({engineRef:y,docRef:F,overlayRef:dt,zoomLabelRef:ft,minimapRectRef:ut,minimapSize:204,onViewportChangeRef:sn,onScreenOverlaySyncRef:cn}),q=ye.useSelectionInfoOverlay({engineRef:y,docRef:F,draftRef:j,draftMetaRef:Kt,screenOverlaySyncRef:cn,formatSelectionInfo:Xe,onDraftShapeChange:st}),dn=q.applyPreview,fn=o.useLatestRef((0,c.useCallback)(e=>{un(e),dn(e),lt?.(e)},[un,dn,lt])),pn=o.useLatestRef(q.onDrawPreview),mn=(0,c.useCallback)((t,n)=>{let r=j.current;if(!r||N.current)return;let i=e.generateId();F.current.create({id:i,type:t,points:n,style:r,meta:f}),rn.current([i])},[f]),hn=o.useLatestRef(mn),J=ue.useDrawSession({toolRef:A,selRef:R,docRef:F,readOnlyRef:N,draftRef:j,brushSizeRef:qt,simplifyEpsilonRef:Jt,draftMeta:f,engineRef:y,onDrawSessionChange:(0,c.useCallback)(e=>{bt(e),ot?.(e)},[ot]),onDraftShapeChange:st,changeSelection:z,createShape:mn}),gn=o.useLatestRef(J),{reset:_n,undoSession:vn,redoSession:yn,canUndoSession:bn,canRedoSession:xn,handleToolChange:Sn,handleBrushSelectionChange:Cn}=J,Y=le.useAssistant({docRef:F,draftRef:j,draftMeta:f,changeSelection:z,assistantRef:o.useLatestRef(_)}),wn=o.useLatestRef(Y),Tn=(0,c.useMemo)(()=>re.createClipboardDocumentId(C),[C]),X=ve.useSelectionActions({doc:w,selRef:R,effectiveReadOnly:M,changeSelection:z,canMergeSelection:ze,clipboardDocumentId:Tn,clipboardScope:Se??Tn}),En=(0,c.useMemo)(()=>({undo:()=>{N.current||vn()||w.undo()},redo:()=>{N.current||yn()||w.redo()},canUndo:()=>bn()||w.canUndo(),canRedo:()=>xn()||w.canRedo()}),[w,vn,yn,bn,xn]),{zoomToBounds:Dn,zoomToShapes:On,zoomToSelection:kn,zoomAtCenter:An}=xe.useViewportControls({engineRef:y,doc:w,selRef:R,zoomAnimationDuration:He,zoomBound:Ve,ready:x}),jn=o.useLatestRef(O);fe.useEditorHandle({handleRef:$e,engineRef:y,loadedImageRef:Ut,regionOverlayRef:Vt,viewRef:jn,doc:w,history:En,drawSession:J,selection:X,changeSelection:z,rejectLockedEdit:P,viewport:{zoomToBounds:Dn,zoomToShapes:On,zoomToSelection:kn,zoomAtCenter:An}});let Mn=o.useLatestRef({strokeWidth:O.strokeSize}),Nn=(0,c.useCallback)(()=>{let e=ce.createInteractionController({engineRef:y,toolRef:A,externalToolMapRef:E,spaceRef:B,docRef:F,renderShapesRef:Pn,renderDefaultsRef:Mn,selRef:R,draftRef:j,readOnlyRef:N,disableMarqueeRef:Yt,lockedRef:Xt,onLockedInteraction:()=>Zt.current?.(),onDrawAttemptWithoutDraft:()=>$t.current?.(),createRef:hn,selectRef:rn,enterEditRef:an,editingIdRef:on,drawSessionRef:gn,assistantRef:wn,setCursorHint:nn,setInteractionMode:tn,syncMinimap:K,onTransformPreview:e=>fn.current(e),onDrawPreview:e=>pn.current(e)});return I.current=e,e},[R,nn,tn,K]);(0,c.useEffect)(()=>()=>{I.current=null},[]);let Z=(0,c.useMemo)(()=>{let e=h?w.shapes.map(e=>{let t=h(e);return t?{...e,interaction:{...e.interaction,...t}}:e}):w.shapes;return Ue?.length?[...Ue.map(e=>({...e,interaction:{...e.interaction,selectable:!1,draggable:!1,editable:!1,hitTestDisabled:!0}})),...e]:e},[w.shapes,h,Ue]),Pn=o.useLatestRef(Z);he.useEngineLifecycle({hostRef:v,engineRef:y,documentId:C,renderedImageUrl:At,makeCallbacks:Nn,viewRef:jn,readOnlyRef:N,toolRef:A,renderShapesRef:Pn,coordinateSizeRef:Wt,imageSizeRef:Gt,selRef:R,regionOverlayRef:Vt,dimmedRef:Ht,syncMinimap:K,setImage:mt,setImageVisible:gt,setReady:_t,setImageStatus:It,onContextMenuRequest:vt}),(0,c.useEffect)(()=>{y.current?.setShapes(Z,R.current),K()},[Z,R,K]),(0,c.useEffect)(()=>{y.current?.setSelection(L)},[L]),(0,c.useEffect)(()=>{y.current?.setEditing(W)},[W,x]);let Fn=o.useLatestRef(nt);(0,c.useEffect)(()=>{Fn.current?.(W)},[W]),(0,c.useLayoutEffect)(()=>{I.current?.cancelGesture(),G(null)},[d,C]),(0,c.useEffect)(()=>{W&&(L.length!==1||L[0]!==W)&&G(null)},[L,W]),(0,c.useEffect)(()=>{let e=y.current;e&&(e.setFilter(O.brightness,O.contrast),e.setRenderDefaults({strokeWidth:O.strokeSize}),e.setImageSmoothing(O.imageSmoothing),K())},[O.brightness,O.contrast,O.strokeSize,O.imageSmoothing,K]),(0,c.useLayoutEffect)(()=>{x&&y.current?.setOverlays(O.showRegionMask?k:null,u)},[x,k,O.showRegionMask,u]),(0,c.useEffect)(()=>{!x||!b||K()},[x,b,O.showRegionMask,g,K]),(0,c.useEffect)(()=>{x&&y.current?.setTransformEnabled(!M&&d!==n.TOOL.BRUSH)},[M,x,d]),(0,c.useEffect)(()=>{m&&G(null)},[m]),(0,c.useEffect)(()=>{Sn(d,E.current.has(d))},[d,Sn]);let Q=Y.finalize;(0,c.useEffect)(()=>{Q()},[d,Q]),(0,c.useEffect)(()=>{V.current=`idle`,H.current=null,U()},[d,U]),(0,c.useEffect)(()=>{Cn(L,M)},[L,d,M,Cn]),(0,c.useEffect)(()=>{x&&U()},[d,yt,T,x,U]);let In=o.useLatestRef(kt),$=l!==null,Ln=(0,c.useRef)(null);(0,c.useEffect)(()=>{let e=$?C:null;Ln.current!==e&&(Ln.current=e,vt(null),G(null),V.current=`idle`,H.current=null,w.reset($?Ot??[]:[]),z($?In.current??[]:[]),_n(),Q(),U())},[$,C,Ot,w.reset,z,_n,Q,U]),pe.useEditorHotkeys({keymap:Qe,hostRef:v,actions:se.buildHotkeyActions({history:En,selection:X,drawSession:J,assistant:Y,controller:()=>I.current,externalTool:()=>E.current.get(A.current),hasSelection:()=>R.current.length>0,rejectLockedEdit:P,editLocked:M,editingId:W,setEditingId:G,vertexEditTarget:()=>{let t=R.current;if(t.length!==1)return null;let n=F.current.getShapes().find(e=>e.id===t[0]);return n&&e.canEditVertices(n)?n.id:null},deleteEditingVertices:(0,c.useCallback)(()=>{let t=on.current;if(!t||M)return!1;let n=y.current,r=new Set(n?.getVertexSelection()??[]);if(!r.size)return!1;let i=F.current.getShapes().find(e=>e.id===t);if(!i)return!1;let a=i.points.filter((e,t)=>!r.has(t)),ee=i.type===e.SHAPE_TYPE.LINE?2:3;return a.length<ee?!1:(F.current.update([{...i,points:a}]),n?.setVertexSelection([]),!0)},[M]),zoomAtCenter:An,zoom100:()=>y.current?.zoom100(),zoomFit:()=>y.current?.fit(),toggleMinimap:()=>St(e=>!e),toggleCursorGuide:()=>zt(e=>({...e,showCursorGuide:!e.showCursorGuide})),togglePixelation:()=>zt(e=>({...e,imageSmoothing:!e.imageSmoothing})),selectTool:e=>et?.(e),onIdleEscape:ke}),spaceRef:B,onSpaceDown:()=>{y.current?.setPanMode(!0),U()},onSpaceUp:()=>{y.current?.setPanMode(!1),V.current===`panning`?tn(`idle`):U()},nudge:(e,t)=>P(X.getEditableSelection().length>0)||X.nudgeSelection(e,t)});let Rn=(0,c.useMemo)(()=>Z.filter(t=>L.includes(t.id)&&e.isShapeVisible(t)),[Z,L]),zn=(0,c.useMemo)(()=>q.drawPreviewShape?[...Rn,q.drawPreviewShape]:Rn,[Rn,q.drawPreviewShape]),Bn=S?oe.buildContextMenuItems({strings:D.contextMenu,point:S.img,shapes:w.shapes,selectedIds:L,hostReadOnly:!!p,editLocked:M,selection:X,canMergeSelection:ze,history:En,enterVertexEdit:G,zoomToSelection:kn,refineShape:_?Y.refineShape:void 0}):[],Vn=S&&Ie?Ie(Bn,{selectedIds:L,readOnly:M}):Bn,Hn=ge.useMinimapNavigation({engineRef:y,image:b,wheelZoom:O.wheelZoom,minimapSize:204}),Un=(0,c.useCallback)(()=>{y.current?.zoom100()},[]),Wn=(0,c.useCallback)(()=>{St(e=>!e)},[]),Gn=(0,c.useCallback)(()=>{wt(e=>!e)},[]),Kn=(0,c.useCallback)(()=>{wt(!1)},[]);return(0,s.jsxs)(`div`,{className:`aivex:relative aivex:h-full aivex:w-full aivex:overflow-hidden aivex:bg-black`,children:[(0,s.jsx)(`div`,{ref:v,role:`application`,"aria-label":D.canvasLabel,tabIndex:0,onPointerDownCapture:e=>e.currentTarget.focus({preventScroll:!0}),className:`aivex:h-full aivex:w-full`,style:{opacity:+!!ht,transition:ht?`opacity 0.3s ease`:`none`}}),Nt!==`ready`&&(0,s.jsx)(ee.ImageStateOverlay,{status:Nt,error:Pt,render:Ce,loadingLabel:D.imageLoading,missingLabel:D.imageMissing,errorLabel:D.imageLoadError,errorHints:D.imageErrorHints}),x&&b&&(0,s.jsxs)(`div`,{className:`aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:overflow-hidden`,children:[zn.length>0&&(0,s.jsx)(`div`,{className:`aivex:absolute aivex:inset-0`,children:(0,s.jsx)(ne.SelectionInfo,{shapes:zn,getLabel:Je,hideDot:Ye,formatInfo:Xe,register:q.register,viewport:y.current?.viewport??{scale:1,x:0,y:0}})}),(0,s.jsxs)(`div`,{ref:dt,style:{position:`absolute`,top:0,left:0,width:b.w,height:b.h,transformOrigin:`0 0`},children:[!!We?.length&&Ge&&(0,s.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,width:b.w,height:b.h,pointerEvents:`none`},children:We.map(e=>(0,s.jsx)(`div`,{role:e.disabled?void 0:`button`,tabIndex:e.disabled?void 0:0,"aria-pressed":e.selected||void 0,onClick:t=>{t.stopPropagation(),e.disabled||Ke?.(e)},onKeyDown:t=>{e.disabled||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),t.stopPropagation(),Ke?.(e))},style:{position:`absolute`,left:e.point.x,top:e.point.y,transform:e.anchor===`topLeft`?`scale(var(--editor-overlay-inverse-scale, 1))`:`translate(-50%, -50%) scale(var(--editor-overlay-inverse-scale, 1))`,transformOrigin:e.anchor===`topLeft`?`0 0`:`center`,zIndex:e.selected?1:void 0,pointerEvents:e.disabled?`none`:`auto`,cursor:e.disabled?`default`:`pointer`},children:Ge(e)},e.id))}),qe?.({image:b,viewport:y.current?.viewport??{scale:1,x:0,y:0}}),_&&(Y.status===`loading`||Y.boxes.length>0)&&(0,s.jsx)(r.AssistantOverlay,{image:b,points:Y.points,boxes:Y.boxes,status:Y.status})]})]}),x&&O.showCursorGuide&&(0,s.jsx)(a.CursorGuide,{color:`#1e88e5`}),b&&Ne&&(0,s.jsx)(te.Minimap,{image:b,imageUrl:At,imageVisible:ht,loading:!x,region:k,roiMaskId:pt,shapes:Z,view:O,viewDefaults:Rt,onChangeView:Bt,nav:Hn,registerShape:ln,rectRef:ut,zoomLabelRef:ft,onZoom100:Un,open:xt,onToggleOpen:Wn,position:Pe,labels:D.minimap,settingsLabels:D.viewSettings,settingsItems:Re,showSettings:Fe,settingsOpen:Ct,onToggleSettings:Gn,onCloseSettings:Kn}),S&&(0,s.jsx)(i.ContextMenu,{x:S.x,y:S.y,items:Vn,onClose:()=>vt(null)})]})}exports.default=l;
1
+ "use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`./_model/geometry.cjs`),t=require(`./_model/strings.cjs`),n=require(`./_model/tools.cjs`),r=require(`./_components/AssistantOverlay.cjs`),i=require(`./_components/ContextMenu.cjs`),a=require(`./_components/CursorGuide.cjs`),ee=require(`./_components/ImageStateOverlay.cjs`),te=require(`./_components/Minimap.cjs`),ne=require(`./_components/SelectionInfo.cjs`),re=require(`./_model/clipboard.cjs`),ie=require(`./_model/cursors.cjs`),ae=require(`./_model/overlays.cjs`),oe=require(`./_state/buildContextMenuItems.cjs`),se=require(`./_state/buildHotkeyActions.cjs`),ce=require(`./_state/createInteractionController.cjs`),le=require(`./_state/useAssistant.cjs`),o=require(`./_state/useLatestRef.cjs`),ue=require(`./_state/useDrawSession.cjs`),de=require(`./_state/useEditorDocument.cjs`),fe=require(`./_state/useEditorHandle.cjs`),pe=require(`./_state/useEditorHotkeys.cjs`),me=require(`./_state/useEditorView.cjs`),he=require(`./_state/useEngineLifecycle.cjs`),ge=require(`./_state/useMinimapNavigation.cjs`),_e=require(`./_state/useMinimapSync.cjs`),ve=require(`./_state/useSelectionActions.cjs`),ye=require(`./_state/useSelectionInfoOverlay.cjs`),be=require(`./_state/useSelectionModel.cjs`),xe=require(`./_state/useViewportControls.cjs`);let s=require(`react`),c=require(`react/jsx-runtime`);function l({document:l,clipboardScope:Se,renderImageState:Ce,dimmed:u=!1,selectedIds:we,activeTool:d,draftStyle:Te,draftMeta:f,readOnly:p,disableMarquee:Ee,locked:m,onLockedInteraction:De,onDrawAttemptWithoutDraft:Oe,onIdleEscape:ke,overrideShapeInteraction:h,defaultViewSettings:Ae,viewSettings:je,onViewSettingsChange:Me,showMinimap:Ne=!0,minimapPosition:Pe=`bottom-left`,showViewSettings:Fe=!0,getContextMenuItems:Ie,strings:Le,viewSettingItems:Re,canMergeSelection:ze,brushSize:Be=20,zoomBound:Ve,zoomAnimationDuration:He=300,decorationShapes:Ue,regionMask:g,overlayMarkers:We,renderOverlayMarker:Ge,onOverlayMarkerClick:Ke,renderImageOverlay:qe,getSelectionLabel:Je,hideSelectionLabelDot:Ye,formatSelectionInfo:Xe,externalTools:Ze,assistant:_,keymap:Qe,handleRef:$e,onActiveToolChange:et,onSelectionChange:tt,onEditingChange:nt,onShapesCreated:rt,onShapesUpdated:it,onShapesDeleted:at,onDrawSessionChange:ot,onDraftShapeChange:st,onViewportChange:ct,onShapesTransformPreview:lt}){let v=(0,s.useRef)(null),y=(0,s.useRef)(null),ut=(0,s.useRef)(null),dt=(0,s.useRef)(null),ft=(0,s.useRef)(null),pt=`${(0,s.useId)()}-minimap`,[b,mt]=(0,s.useState)(null),[ht,gt]=(0,s.useState)(!1),[x,_t]=(0,s.useState)(!1),[S,vt]=(0,s.useState)(null),[yt,bt]=(0,s.useState)({active:!1,kind:`none`,canUndo:!1,canRedo:!1}),[xt,St]=(0,s.useState)(!0),[Ct,wt]=(0,s.useState)(!1),C=l?.id??``,Tt=l?.imageUrl??``,Et=l?.displayImageUrl,Dt=l?.coordinateSize,Ot=l?.initialShapes,kt=l?.initialSelectedIds,At=Et??Tt,[jt,Mt]=(0,s.useState)(`loading`),Nt=jt===`loading`&&l!==null&&!At?`missing`:jt,[Pt,Ft]=(0,s.useState)(null),It=(0,s.useCallback)((e,t)=>{Mt(e),Ft(e===`error`?t??null:null)},[]),w=de.useEditorDocument({onShapesCreated:rt,onShapesUpdated:it,onShapesDeleted:at}),T=(0,s.useMemo)(()=>new Map((Ze??[]).map(e=>[e.id,e])),[Ze]),E=(0,s.useRef)(T);(0,s.useLayoutEffect)(()=>{E.current=T},[T]);let Lt=o.useLatestRef(yt),D=(0,s.useMemo)(()=>t.mergeEditorStrings(Le),[Le]),{seededDefaults:Rt,view:O,setView:zt,updateView:Bt}=me.useEditorView({defaultViewSettings:Ae,viewSettings:je,onViewSettingsChange:Me}),k=(0,s.useMemo)(()=>!b||!g?null:ae.buildRegionOverlayData(g,b.w,b.h),[b,g]),Vt=o.useLatestRef(k),Ht=o.useLatestRef(u),Ut=o.useLatestRef(b),Wt=o.useLatestRef(Dt),Gt=o.useLatestRef(Dt?.imageSize),A=o.useLatestRef(d),j=o.useLatestRef(Te),Kt=o.useLatestRef(f),qt=o.useLatestRef(Be),Jt=o.useLatestRef(O.simplifyStrength),M=!!p||!!m,N=o.useLatestRef(M),Yt=o.useLatestRef(Ee),Xt=o.useLatestRef(m),Zt=o.useLatestRef(De),Qt=o.useLatestRef(p),P=(0,s.useCallback)((e=!0)=>Qt.current||!Xt.current||!e?!1:(Zt.current?.(),!0),[]),$t=o.useLatestRef(Oe),en=o.useLatestRef(h),F=o.useLatestRef(w),I=(0,s.useRef)(null),{selectedIds:L,selRef:R,changeSelection:z}=be.useSelectionModel({controlledSelectedIds:we,onSelectionChange:tt,docShapes:w.shapes,docRef:F,overrideInteractionRef:en,interactionControllerRef:I,engineRef:y}),B=(0,s.useRef)(!1),V=(0,s.useRef)(`idle`),H=(0,s.useRef)(null),U=(0,s.useCallback)(()=>{let e=y.current;if(!e)return;let t=A.current,n=E.current.get(t),r=Lt.current;e.setCursor(ie.resolveEditorCursor({tool:t,externalToolCursor:n?.cursor,isSpacePressed:B.current,interactionMode:V.current,rendererCursorHint:H.current,isPolygonDrawing:r.kind===`polygon`&&r.active}))},[]),tn=(0,s.useCallback)(e=>{V.current!==e&&(V.current=e,U())},[U]),nn=(0,s.useCallback)(e=>{H.current!==e&&(H.current=e,U())},[U]),rn=o.useLatestRef(z),[W,G]=(0,s.useState)(null),an=o.useLatestRef((0,s.useCallback)(e=>G(e),[])),on=o.useLatestRef(W),sn=o.useLatestRef(ct),cn=(0,s.useRef)(null),{registerMinimapShape:ln,applyMinimapPreview:un,syncMinimap:K}=_e.useMinimapSync({engineRef:y,docRef:F,overlayRef:dt,zoomLabelRef:ft,minimapRectRef:ut,minimapSize:204,onViewportChangeRef:sn,onScreenOverlaySyncRef:cn}),q=ye.useSelectionInfoOverlay({engineRef:y,docRef:F,draftRef:j,draftMetaRef:Kt,screenOverlaySyncRef:cn,formatSelectionInfo:Xe,onDraftShapeChange:st}),dn=q.applyPreview,fn=o.useLatestRef((0,s.useCallback)(e=>{un(e),dn(e),lt?.(e)},[un,dn,lt])),pn=o.useLatestRef(q.onDrawPreview),mn=(0,s.useCallback)((t,n)=>{let r=j.current;if(!r||N.current)return;let i=e.generateId();F.current.create({id:i,type:t,points:n,style:r,meta:f}),rn.current([i])},[f]),hn=o.useLatestRef(mn),J=ue.useDrawSession({toolRef:A,selRef:R,docRef:F,readOnlyRef:N,draftRef:j,brushSizeRef:qt,simplifyEpsilonRef:Jt,draftMeta:f,engineRef:y,onDrawSessionChange:(0,s.useCallback)(e=>{bt(e),ot?.(e)},[ot]),onDraftShapeChange:st,changeSelection:z,createShape:mn}),gn=o.useLatestRef(J),{reset:_n,undoSession:vn,redoSession:yn,canUndoSession:bn,canRedoSession:xn,handleToolChange:Sn,handleBrushSelectionChange:Cn}=J,Y=le.useAssistant({docRef:F,draftRef:j,draftMeta:f,changeSelection:z,assistantRef:o.useLatestRef(_)}),wn=o.useLatestRef(Y),Tn=(0,s.useMemo)(()=>re.createClipboardDocumentId(C),[C]),X=ve.useSelectionActions({doc:w,selRef:R,effectiveReadOnly:M,changeSelection:z,canMergeSelection:ze,clipboardDocumentId:Tn,clipboardScope:Se??Tn}),En=(0,s.useMemo)(()=>({undo:()=>{N.current||vn()||w.undo()},redo:()=>{N.current||yn()||w.redo()},canUndo:()=>bn()||w.canUndo(),canRedo:()=>xn()||w.canRedo()}),[w,vn,yn,bn,xn]),{zoomToBounds:Dn,zoomToShapes:On,zoomToSelection:kn,zoomAtCenter:An}=xe.useViewportControls({engineRef:y,doc:w,selRef:R,zoomAnimationDuration:He,zoomBound:Ve,ready:x}),jn=o.useLatestRef(O);fe.useEditorHandle({handleRef:$e,engineRef:y,loadedImageRef:Ut,regionOverlayRef:Vt,viewRef:jn,doc:w,history:En,drawSession:J,selection:X,changeSelection:z,rejectLockedEdit:P,viewport:{zoomToBounds:Dn,zoomToShapes:On,zoomToSelection:kn,zoomAtCenter:An}});let Mn=o.useLatestRef({strokeWidth:O.strokeSize}),Nn=(0,s.useCallback)(()=>{let e=ce.createInteractionController({engineRef:y,toolRef:A,externalToolMapRef:E,spaceRef:B,docRef:F,renderShapesRef:Pn,renderDefaultsRef:Mn,selRef:R,draftRef:j,readOnlyRef:N,disableMarqueeRef:Yt,lockedRef:Xt,onLockedInteraction:()=>Zt.current?.(),onDrawAttemptWithoutDraft:()=>$t.current?.(),createRef:hn,selectRef:rn,enterEditRef:an,editingIdRef:on,drawSessionRef:gn,assistantRef:wn,setCursorHint:nn,setInteractionMode:tn,syncMinimap:K,onTransformPreview:e=>fn.current(e),onDrawPreview:e=>pn.current(e)});return I.current=e,e},[R,nn,tn,K]);(0,s.useEffect)(()=>()=>{I.current=null},[]);let Z=(0,s.useMemo)(()=>{let e=h?w.shapes.map(e=>{let t=h(e);return t?{...e,interaction:{...e.interaction,...t}}:e}):w.shapes;return Ue?.length?[...Ue.map(e=>({...e,interaction:{...e.interaction,selectable:!1,draggable:!1,editable:!1,hitTestDisabled:!0}})),...e]:e},[w.shapes,h,Ue]),Pn=o.useLatestRef(Z);he.useEngineLifecycle({hostRef:v,engineRef:y,documentId:C,renderedImageUrl:At,makeCallbacks:Nn,viewRef:jn,readOnlyRef:N,toolRef:A,renderShapesRef:Pn,coordinateSizeRef:Wt,imageSizeRef:Gt,selRef:R,regionOverlayRef:Vt,dimmedRef:Ht,syncMinimap:K,setImage:mt,setImageVisible:gt,setReady:_t,setImageStatus:It,onContextMenuRequest:vt}),(0,s.useEffect)(()=>{y.current?.setShapes(Z,R.current),K()},[Z,R,K]),(0,s.useEffect)(()=>{y.current?.setSelection(L)},[L]),(0,s.useEffect)(()=>{y.current?.setEditing(W)},[W,x]);let Fn=o.useLatestRef(nt);(0,s.useEffect)(()=>{Fn.current?.(W)},[W]),(0,s.useLayoutEffect)(()=>{I.current?.cancelGesture(),G(null)},[d,C]),(0,s.useEffect)(()=>{W&&(L.length!==1||L[0]!==W)&&G(null)},[L,W]),(0,s.useEffect)(()=>{let e=y.current;e&&(e.setFilter(O.brightness,O.contrast),e.setRenderDefaults({strokeWidth:O.strokeSize}),e.setImageSmoothing(O.imageSmoothing),K())},[O.brightness,O.contrast,O.strokeSize,O.imageSmoothing,K]),(0,s.useLayoutEffect)(()=>{x&&y.current?.setOverlays(O.showRegionMask?k:null,u)},[x,k,O.showRegionMask,u]),(0,s.useEffect)(()=>{!x||!b||K()},[x,b,O.showRegionMask,g,K]),(0,s.useEffect)(()=>{x&&y.current?.setTransformEnabled(!M&&d!==n.TOOL.BRUSH)},[M,x,d]),(0,s.useEffect)(()=>{m&&G(null)},[m]),(0,s.useEffect)(()=>{Sn(d,E.current.has(d))},[d,Sn]);let Q=Y.finalize;(0,s.useEffect)(()=>{Q()},[d,Q]),(0,s.useEffect)(()=>{V.current=`idle`,H.current=null,U()},[d,U]),(0,s.useEffect)(()=>{Cn(L,M)},[L,d,M,Cn]),(0,s.useEffect)(()=>{x&&U()},[d,yt,T,x,U]);let In=o.useLatestRef(kt),$=l!==null,Ln=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=$?C:null;Ln.current!==e&&(Ln.current=e,vt(null),G(null),V.current=`idle`,H.current=null,w.reset($?Ot??[]:[]),z($?In.current??[]:[]),_n(),Q(),U())},[$,C,Ot,w.reset,z,_n,Q,U]),pe.useEditorHotkeys({keymap:Qe,hostRef:v,actions:se.buildHotkeyActions({history:En,selection:X,drawSession:J,assistant:Y,controller:()=>I.current,externalTool:()=>E.current.get(A.current),hasSelection:()=>R.current.length>0,rejectLockedEdit:P,editLocked:M,editingId:W,setEditingId:G,vertexEditTarget:()=>{let t=R.current;if(t.length!==1)return null;let n=F.current.getShapes().find(e=>e.id===t[0]);return n&&e.canEditVertices(n)?n.id:null},deleteEditingVertices:(0,s.useCallback)(()=>{let t=on.current;if(!t||M)return!1;let n=y.current,r=new Set(n?.getVertexSelection()??[]);if(!r.size)return!1;let i=F.current.getShapes().find(e=>e.id===t);if(!i)return!1;let a=i.points.filter((e,t)=>!r.has(t)),ee=i.type===e.SHAPE_TYPE.LINE?2:3;return a.length<ee?!1:(F.current.update([{...i,points:a}]),n?.setVertexSelection([]),!0)},[M]),zoomAtCenter:An,zoom100:()=>y.current?.zoom100(),zoomFit:()=>y.current?.fit(),toggleMinimap:()=>St(e=>!e),toggleCursorGuide:()=>zt(e=>({...e,showCursorGuide:!e.showCursorGuide})),togglePixelation:()=>zt(e=>({...e,imageSmoothing:!e.imageSmoothing})),selectTool:e=>et?.(e),onIdleEscape:ke}),spaceRef:B,onSpaceDown:()=>{y.current?.setPanMode(!0),U()},onSpaceUp:()=>{y.current?.setPanMode(!1),V.current===`panning`?tn(`idle`):U()},nudge:(e,t)=>P(X.getEditableSelection().length>0)||X.nudgeSelection(e,t)});let Rn=(0,s.useMemo)(()=>Z.filter(t=>L.includes(t.id)&&e.isShapeVisible(t)),[Z,L]),zn=(0,s.useMemo)(()=>q.drawPreviewShape?[...Rn,q.drawPreviewShape]:Rn,[Rn,q.drawPreviewShape]),Bn=S?oe.buildContextMenuItems({strings:D.contextMenu,point:S.img,shapes:w.shapes,selectedIds:L,hostReadOnly:!!p,editLocked:M,selection:X,canMergeSelection:ze,history:En,enterVertexEdit:G,zoomToSelection:kn,refineShape:_?Y.refineShape:void 0}):[],Vn=S&&Ie?Ie(Bn,{selectedIds:L,readOnly:M}):Bn,Hn=ge.useMinimapNavigation({engineRef:y,image:b,wheelZoom:O.wheelZoom,minimapSize:204}),Un=(0,s.useCallback)(()=>{y.current?.zoom100()},[]),Wn=(0,s.useCallback)(()=>{St(e=>!e)},[]),Gn=(0,s.useCallback)(()=>{wt(e=>!e)},[]),Kn=(0,s.useCallback)(()=>{wt(!1)},[]);return(0,c.jsxs)(`div`,{className:`aivex:relative aivex:h-full aivex:w-full aivex:overflow-hidden aivex:bg-black`,children:[(0,c.jsx)(`div`,{ref:v,role:`application`,"aria-label":D.canvasLabel,tabIndex:0,onPointerDownCapture:e=>e.currentTarget.focus({preventScroll:!0}),className:`aivex:h-full aivex:w-full`,style:{opacity:+!!ht,transition:ht?`opacity 0.3s ease`:`none`}}),Nt!==`ready`&&(0,c.jsx)(ee.ImageStateOverlay,{status:Nt,error:Pt,render:Ce,loadingLabel:D.imageLoading,missingLabel:D.imageMissing,errorLabel:D.imageLoadError,errorHints:D.imageErrorHints}),x&&b&&(0,c.jsxs)(`div`,{className:`aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:overflow-hidden`,children:[zn.length>0&&(0,c.jsx)(`div`,{className:`aivex:absolute aivex:inset-0`,children:(0,c.jsx)(ne.SelectionInfo,{shapes:zn,getLabel:Je,hideDot:Ye,formatInfo:Xe,register:q.register,viewport:y.current?.viewport??{scale:1,x:0,y:0}})}),(0,c.jsxs)(`div`,{ref:dt,style:{position:`absolute`,top:0,left:0,width:b.w,height:b.h,transformOrigin:`0 0`},children:[!!We?.length&&Ge&&(0,c.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,width:b.w,height:b.h,pointerEvents:`none`},children:We.map(e=>(0,c.jsx)(`div`,{role:e.disabled?void 0:`button`,tabIndex:e.disabled?void 0:0,"aria-pressed":e.selected||void 0,onClick:t=>{t.stopPropagation(),e.disabled||Ke?.(e)},onKeyDown:t=>{e.disabled||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),t.stopPropagation(),Ke?.(e))},style:{position:`absolute`,left:e.point.x,top:e.point.y,transform:e.anchor===`topLeft`?`scale(var(--editor-overlay-inverse-scale, 1))`:`translate(-50%, -50%) scale(var(--editor-overlay-inverse-scale, 1))`,transformOrigin:e.anchor===`topLeft`?`0 0`:`center`,zIndex:e.selected?1:void 0,pointerEvents:e.disabled?`none`:`auto`,cursor:e.disabled?`default`:`pointer`},children:Ge(e)},e.id))}),qe?.({image:b,viewport:y.current?.viewport??{scale:1,x:0,y:0}}),_&&(Y.status===`loading`||Y.boxes.length>0)&&(0,c.jsx)(r.AssistantOverlay,{image:b,points:Y.points,boxes:Y.boxes,status:Y.status})]})]}),x&&O.showCursorGuide&&(0,c.jsx)(a.CursorGuide,{color:`#1e88e5`}),b&&Ne&&(0,c.jsx)(te.Minimap,{image:b,imageUrl:At,imageVisible:ht,loading:!x,region:k,roiMaskId:pt,shapes:Z,view:O,viewDefaults:Rt,onChangeView:Bt,nav:Hn,registerShape:ln,rectRef:ut,zoomLabelRef:ft,onZoom100:Un,open:xt,onToggleOpen:Wn,position:Pe,labels:D.minimap,settingsLabels:D.viewSettings,settingsItems:Re,showSettings:Fe,settingsOpen:Ct,onToggleSettings:Gn,onCloseSettings:Kn}),S&&(0,c.jsx)(i.ContextMenu,{x:S.x,y:S.y,items:Vn,onClose:()=>vt(null)})]})}exports.default=l;
2
2
  //# sourceMappingURL=ShapeEditor.cjs.map