@camstack/addon-training 0.1.47 → 0.1.48

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 (40) hide show
  1. package/dist/{MaskShapeCanvas-Kfg9dl6B.mjs → MaskShapeCanvas-HNL0xNpy.mjs} +229 -228
  2. package/dist/MotionZonesSettings-B1g6IUfQ.mjs +291 -0
  3. package/dist/PrivacyMaskSettings-D4WRZZeD.mjs +339 -0
  4. package/dist/{ReactKonva-DGuYUN0L.mjs → ReactKonva-DzGysLZQ.mjs} +28 -28
  5. package/dist/SceneMonitorEditor-pYZfyXtn.mjs +825 -0
  6. package/dist/_stub.js +11561 -10220
  7. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-cOIklMU6.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-BclY1R96.mjs} +4 -4
  8. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BVsoOuTM.mjs +26 -0
  9. package/dist/{_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs → _virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-CEvdvp1T.mjs} +1 -1
  10. package/dist/addon-training.css +1 -1
  11. package/dist/{chevron-right-D3StkdcR.mjs → chevron-right-cA8Hucbi.mjs} +1 -1
  12. package/dist/{createLucideIcon-CPP1Jzoz.mjs → createLucideIcon-C0bBNRpC.mjs} +8 -8
  13. package/dist/{dist-BUzSmOA3.js → dist-DxTjO9kC.js} +173 -4
  14. package/dist/{dist-CCnnaqt1.mjs → dist-GI2KEl-e.mjs} +173 -4
  15. package/dist/{grid-2x2-Yngdckwo.mjs → grid-2x2-CHuMzRxF.mjs} +1 -1
  16. package/dist/{hostInit-v495uwvg.mjs → hostInit-BHX8oN7K.mjs} +3 -3
  17. package/dist/{icons-C4_Ji5S0.mjs → icons-BwkaMam3.mjs} +9 -9
  18. package/dist/index.js +1 -1
  19. package/dist/{mic-off-DPNSd6G7.mjs → mic-off-2uHAsVtR.mjs} +1 -1
  20. package/dist/orchestrator/training.addon.js +1 -1
  21. package/dist/orchestrator/training.addon.mjs +1 -1
  22. package/dist/{player-overlays-DXTsKpgo.mjs → player-overlays-B4V_uIvb.mjs} +25 -25
  23. package/dist/providers/modal/training-modal.addon.js +1 -1
  24. package/dist/providers/modal/training-modal.addon.mjs +1 -1
  25. package/dist/remoteEntry.js +1 -1
  26. package/dist/{responsive-Cfmds8tw.mjs → responsive-1iwc-rj2.mjs} +26 -26
  27. package/dist/{rotate-ccw-Dak-lXgZ.mjs → rotate-ccw-Cu6tGrgG.mjs} +1 -1
  28. package/dist/scene-monitor-copy-Cqfs4Vng.mjs +176 -0
  29. package/dist/{settings-2-Cgiv3kQb.mjs → settings-2-xV0I5Y5U.mjs} +1 -1
  30. package/dist/{square-B_679zIX.mjs → square-ZPUterXM.mjs} +1 -1
  31. package/dist/{trash-2-DC8LDYlI.mjs → trash-2-BKfuhsgY.mjs} +1 -1
  32. package/dist/ui-text-CqJgUCKX.mjs +34 -0
  33. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-CdlOqgkp.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-D5OhZIRm.mjs} +1 -1
  34. package/dist/{zoom-out-BJoVDYa3.mjs → zoom-out-DDZCsqkQ.mjs} +1 -1
  35. package/package.json +1 -1
  36. package/dist/MotionZonesSettings-15Lfyz9l.mjs +0 -292
  37. package/dist/PrivacyMaskSettings-CAyzlGjl.mjs +0 -348
  38. package/dist/SceneMonitorEditor-D49_o83T.mjs +0 -810
  39. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Cn2OEGrR.mjs +0 -26
  40. package/dist/scene-monitor-copy-DX2u-htD.mjs +0 -136
@@ -1,36 +1,37 @@
1
- import { S as e, _ as t, a as n, c as r, g as i, u as a } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs";
1
+ import { d as e, l as t, o as n, v as r, w as i, y as a } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-CEvdvp1T.mjs";
2
2
  import { n as o, r as s } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs";
3
- import { a as c, c as l, i as u, l as d, n as f, o as p, r as m, s as h } from "./ReactKonva-DGuYUN0L.mjs";
3
+ import { r as c } from "./ui-text-CqJgUCKX.mjs";
4
+ import { a as l, c as u, i as d, l as f, n as p, o as m, r as h, s as g } from "./ReactKonva-DzGysLZQ.mjs";
4
5
  //#region ../ui-library/src/composites/cap-settings/MaskShapeCanvas.tsx
5
- e();
6
- var g = {
6
+ i();
7
+ var _ = {
7
8
  rect: "#ef4444",
8
9
  polygon: "#3b82f6",
9
10
  grid: "#6366f1",
10
11
  line: "#f59e0b"
11
- }, _ = "33", v = "66", y = "#6366f1", b = 3, x = 2, S = 12, C = 16, w = 9;
12
- function T(e, t, n) {
12
+ }, v = "33", y = "66", b = "#6366f1", x = 3, S = 2, C = 12, w = 16, T = 9;
13
+ function E(e, t, n) {
13
14
  return {
14
15
  x: e.x * t,
15
16
  y: e.y * n
16
17
  };
17
18
  }
18
- function E(e, t, n) {
19
+ function D(e, t, n) {
19
20
  return {
20
21
  x: e.x / t,
21
22
  y: e.y / n
22
23
  };
23
24
  }
24
- function D(e, t, n) {
25
+ function O(e, t, n) {
25
26
  return e.flatMap((e) => [e.x * t, e.y * n]);
26
27
  }
27
- function O(e) {
28
+ function k(e) {
28
29
  return !Number.isFinite(e) || e < 0 ? 0 : e > 1 ? 1 : e;
29
30
  }
30
- function k(e) {
31
- return e.color ?? g[e.shape.kind];
31
+ function A(e) {
32
+ return e.color ?? _[e.shape.kind];
32
33
  }
33
- function A(e, t) {
34
+ function j(e, t) {
34
35
  let n = e[t], r = e[(t + 1) % e.length];
35
36
  if (!n || !r) return [...e];
36
37
  let i = {
@@ -43,36 +44,36 @@ function A(e, t) {
43
44
  ...e.slice(t + 1)
44
45
  ];
45
46
  }
46
- function j(e, t) {
47
+ function M(e, t) {
47
48
  return e.length === t.length ? e.every((e, n) => {
48
49
  let r = t[n];
49
50
  return Math.abs(e.x - r.x) < 1e-6 && Math.abs(e.y - r.y) < 1e-6;
50
51
  }) : !1;
51
52
  }
52
- function M(e) {
53
+ function N(e) {
53
54
  return e.kind === "polygon" || e.kind === "line";
54
55
  }
55
- function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawComplete: f, drawingKind: m, supportedShapes: h, transparent: _ = !1, backdrop: v, polygonVertices: A, grid: N }) {
56
- let P = i(null), [F, z] = t({
56
+ function P({ items: n, selectedId: i, onSelect: d, onShapeChange: f, onDrawComplete: p, drawingKind: h, supportedShapes: g, transparent: v = !1, backdrop: y, polygonVertices: j, grid: P }) {
57
+ let F = c(), I = r(null), [B, V] = a({
57
58
  w: 800,
58
59
  h: 450
59
- }), [B, V] = t([]), [H, U] = t(null), [W, G] = t(null), [K, q] = t(null), J = m !== null && h.includes(m);
60
- a(() => {
61
- if (!K) return;
62
- let t = e.find((e) => e.id === K.itemId);
63
- if (!t || !M(t.shape)) {
64
- q(null);
60
+ }), [H, U] = a([]), [W, G] = a(null), [K, ee] = a(null), [q, J] = a(null), Y = h !== null && g.includes(h);
61
+ e(() => {
62
+ if (!q) return;
63
+ let e = n.find((e) => e.id === q.itemId);
64
+ if (!e || !N(e.shape)) {
65
+ J(null);
65
66
  return;
66
67
  }
67
- j(t.shape.points, K.points) && q(null);
68
- }, [e, K]), a(() => {
69
- let e = P.current;
68
+ M(e.shape.points, q.points) && J(null);
69
+ }, [n, q]), e(() => {
70
+ let e = I.current;
70
71
  if (!e) return;
71
72
  let t = new ResizeObserver((e) => {
72
73
  let t = e[0];
73
74
  if (!t) return;
74
75
  let { width: n, height: r } = t.contentRect;
75
- z(_ ? {
76
+ V(v ? {
76
77
  w: n,
77
78
  h: r
78
79
  } : {
@@ -81,24 +82,24 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
81
82
  });
82
83
  });
83
84
  return t.observe(e), () => t.disconnect();
84
- }, [_]), a(() => {
85
- !J && H !== null && U(null);
86
- }, [J, H]);
87
- let Y = r((e) => {
88
- f(e), V([]);
89
- }, [f]), X = r((e) => {
90
- if (!J || m === null) {
91
- u(null);
85
+ }, [v]), e(() => {
86
+ !Y && W !== null && G(null);
87
+ }, [Y, W]);
88
+ let X = t((e) => {
89
+ p(e), U([]);
90
+ }, [p]), te = t((e) => {
91
+ if (!Y || h === null) {
92
+ d(null);
92
93
  return;
93
94
  }
94
95
  let t = e.target.getStage();
95
96
  if (!t) return;
96
97
  let n = t.getPointerPosition();
97
98
  if (!n) return;
98
- let r = E(n, F.w, F.h);
99
- if (m === "rect") {
100
- let e = O(r.x), t = O(r.y);
101
- Y({
99
+ let r = D(n, B.w, B.h);
100
+ if (h === "rect") {
101
+ let e = k(r.x), t = k(r.y);
102
+ X({
102
103
  kind: "rect",
103
104
  x: e,
104
105
  y: t,
@@ -107,9 +108,9 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
107
108
  });
108
109
  return;
109
110
  }
110
- if (m === "grid") {
111
- let e = N?.width ?? C, t = N?.height ?? w;
112
- Y({
111
+ if (h === "grid") {
112
+ let e = P?.width ?? w, t = P?.height ?? T;
113
+ X({
113
114
  kind: "grid",
114
115
  gridWidth: e,
115
116
  gridHeight: t,
@@ -117,94 +118,94 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
117
118
  });
118
119
  return;
119
120
  }
120
- if (m === "line") {
121
- if (B.length === 0) {
122
- V([r]);
121
+ if (h === "line") {
122
+ if (H.length === 0) {
123
+ U([r]);
123
124
  return;
124
125
  }
125
- Y({
126
+ X({
126
127
  kind: "line",
127
- points: [...B, r]
128
+ points: [...H, r]
128
129
  });
129
130
  return;
130
131
  }
131
- if (m === "polygon") {
132
- if (B.length === 0) {
133
- V([r]);
132
+ if (h === "polygon") {
133
+ if (H.length === 0) {
134
+ U([r]);
134
135
  return;
135
136
  }
136
- if (B.length >= b) {
137
- let e = T(B[0], F.w, F.h);
138
- if (Math.hypot(n.x - e.x, n.y - e.y) < S) {
139
- Y({
137
+ if (H.length >= x) {
138
+ let e = E(H[0], B.w, B.h);
139
+ if (Math.hypot(n.x - e.x, n.y - e.y) < C) {
140
+ X({
140
141
  kind: "polygon",
141
- points: B
142
+ points: H
142
143
  });
143
144
  return;
144
145
  }
145
146
  }
146
- V((e) => [...e, r]);
147
+ U((e) => [...e, r]);
147
148
  }
148
149
  }, [
149
- J,
150
- m,
151
- B,
152
- F,
153
- N,
154
150
  Y,
155
- u
156
- ]), ee = r((e) => {
157
- !J || m !== "polygon" || B.length < b || (e.cancelBubble = !0, Y({
151
+ h,
152
+ H,
153
+ B,
154
+ P,
155
+ X,
156
+ d
157
+ ]), ne = t((e) => {
158
+ !Y || h !== "polygon" || H.length < x || (e.cancelBubble = !0, X({
158
159
  kind: "polygon",
159
- points: B
160
+ points: H
160
161
  }));
161
162
  }, [
162
- J,
163
- m,
164
- B,
165
- Y
166
- ]), Z = i(null), Q = i(null);
167
- a(() => () => {
163
+ Y,
164
+ h,
165
+ H,
166
+ X
167
+ ]), Z = r(null), Q = r(null);
168
+ e(() => () => {
168
169
  Z.current !== null && cancelAnimationFrame(Z.current);
169
170
  }, []);
170
- let te = r((e) => {
171
- if (!J) return;
171
+ let re = t((e) => {
172
+ if (!Y) return;
172
173
  let t = e.target.getStage();
173
174
  t && (Q.current = t.getPointerPosition() ?? null, Z.current === null && (Z.current = requestAnimationFrame(() => {
174
- Z.current = null, U(Q.current);
175
+ Z.current = null, G(Q.current);
175
176
  })));
176
- }, [J]), ne = i(!1), re = i(!0), ie = i(/* @__PURE__ */ new Set()), ae = r((e, t, n, r) => {
177
+ }, [Y]), ie = r(!1), ae = r(!0), oe = r(/* @__PURE__ */ new Set()), se = t((e, t, n, r) => {
177
178
  let i = t.gridWidth * t.gridHeight;
178
179
  if (n < 0 || n >= i || t.cells[n] === r) return;
179
180
  let a = [...t.cells];
180
181
  for (; a.length < i;) a.push(!1);
181
- a.length = i, a[n] = r, d(e, {
182
+ a.length = i, a[n] = r, f(e, {
182
183
  ...t,
183
184
  cells: a
184
185
  });
185
- }, [d]), $ = [];
186
- if (!_) {
187
- for (let e = 1; e < C; e++) {
188
- let t = F.w / C * e;
189
- $.push(/* @__PURE__ */ o(p, {
186
+ }, [f]), $ = [];
187
+ if (!v) {
188
+ for (let e = 1; e < w; e++) {
189
+ let t = B.w / w * e;
190
+ $.push(/* @__PURE__ */ o(m, {
190
191
  points: [
191
192
  t,
192
193
  0,
193
194
  t,
194
- F.h
195
+ B.h
195
196
  ],
196
197
  stroke: "#ffffff",
197
198
  strokeWidth: .5,
198
199
  opacity: .08
199
200
  }, `gv-${e}`));
200
201
  }
201
- for (let e = 1; e < w; e++) {
202
- let t = F.h / w * e;
203
- $.push(/* @__PURE__ */ o(p, {
202
+ for (let e = 1; e < T; e++) {
203
+ let t = B.h / T * e;
204
+ $.push(/* @__PURE__ */ o(m, {
204
205
  points: [
205
206
  0,
206
207
  t,
207
- F.w,
208
+ B.w,
208
209
  t
209
210
  ],
210
211
  stroke: "#ffffff",
@@ -214,37 +215,37 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
214
215
  }
215
216
  }
216
217
  return /* @__PURE__ */ s("div", {
217
- ref: P,
218
- className: _ ? "absolute inset-0" : "relative w-full bg-zinc-900 rounded-lg overflow-hidden",
219
- style: { cursor: J ? "crosshair" : "default" },
218
+ ref: I,
219
+ className: v ? "absolute inset-0" : "relative w-full bg-zinc-900 rounded-lg overflow-hidden",
220
+ style: { cursor: Y ? "crosshair" : "default" },
220
221
  children: [
221
- v && !_ ? /* @__PURE__ */ o("div", {
222
+ y && !v ? /* @__PURE__ */ o("div", {
222
223
  className: "absolute inset-0 pointer-events-none [&>*]:w-full [&>*]:h-full [&>img]:object-cover [&>video]:object-cover",
223
224
  style: {
224
- width: F.w,
225
- height: F.h
225
+ width: B.w,
226
+ height: B.h
226
227
  },
227
- children: v
228
+ children: y
228
229
  }) : null,
229
- /* @__PURE__ */ s(l, {
230
- width: F.w,
231
- height: F.h,
232
- onClick: X,
233
- onDblClick: ee,
234
- onMouseMove: te,
230
+ /* @__PURE__ */ s(u, {
231
+ width: B.w,
232
+ height: B.h,
233
+ onClick: te,
234
+ onDblClick: ne,
235
+ onMouseMove: re,
235
236
  children: [
236
- /* @__PURE__ */ s(c, {
237
+ /* @__PURE__ */ s(l, {
237
238
  listening: !1,
238
- children: [/* @__PURE__ */ o(p, {
239
+ children: [/* @__PURE__ */ o(m, {
239
240
  points: [
240
241
  0,
241
242
  0,
242
- F.w,
243
+ B.w,
243
244
  0,
244
- F.w,
245
- F.h,
245
+ B.w,
246
+ B.h,
246
247
  0,
247
- F.h,
248
+ B.h,
248
249
  0,
249
250
  0
250
251
  ],
@@ -252,96 +253,96 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
252
253
  strokeWidth: 0
253
254
  }), $]
254
255
  }),
255
- /* @__PURE__ */ o(c, { children: e.map((e) => {
256
- let t = e.id === n, r = e.enabled === !1, i = k(e), a = t && !J && !r;
257
- if (e.shape.kind === "rect") return /* @__PURE__ */ o(I, {
256
+ /* @__PURE__ */ o(l, { children: n.map((e) => {
257
+ let t = e.id === i, n = e.enabled === !1, r = A(e), a = t && !Y && !n;
258
+ if (e.shape.kind === "rect") return /* @__PURE__ */ o(L, {
258
259
  item: e,
259
260
  shape: e.shape,
260
- color: i,
261
+ color: r,
261
262
  selected: t,
262
- dimmed: r,
263
+ dimmed: n,
263
264
  editable: a,
264
- isDrawing: J,
265
- size: F,
266
- onSelect: u,
267
- onShapeChange: d
265
+ isDrawing: Y,
266
+ size: B,
267
+ onSelect: d,
268
+ onShapeChange: f
268
269
  }, e.id);
269
- if (e.shape.kind === "grid") return /* @__PURE__ */ o(L, {
270
+ if (e.shape.kind === "grid") return /* @__PURE__ */ o(R, {
270
271
  item: e,
271
272
  shape: e.shape,
272
- color: i,
273
- dimmed: r,
273
+ color: r,
274
+ dimmed: n,
274
275
  editable: a,
275
- size: F,
276
- onSelect: u,
277
- paintingRef: ne,
278
- paintValueRef: re,
279
- paintedRef: ie,
280
- paintCell: ae
276
+ size: B,
277
+ onSelect: d,
278
+ paintingRef: ie,
279
+ paintValueRef: ae,
280
+ paintedRef: oe,
281
+ paintCell: se
281
282
  }, e.id);
282
- let s = e.shape.kind === "line", c = s ? x : Math.max(b, A?.min ?? b), l = s ? x : A?.max, f = K && K.itemId === e.id ? K.points : e.shape.points;
283
- return /* @__PURE__ */ o(R, {
283
+ let s = e.shape.kind === "line", c = s ? S : Math.max(x, j?.min ?? x), l = s ? S : j?.max, u = q && q.itemId === e.id ? q.points : e.shape.points;
284
+ return /* @__PURE__ */ o(z, {
284
285
  item: e,
285
286
  shape: e.shape,
286
- color: i,
287
+ color: r,
287
288
  selected: t,
288
- dimmed: r,
289
+ dimmed: n,
289
290
  editable: a,
290
291
  isLine: s,
291
- isDrawing: J,
292
- size: F,
293
- effectivePoints: f,
292
+ isDrawing: Y,
293
+ size: B,
294
+ effectivePoints: u,
294
295
  minVertices: c,
295
296
  maxVertices: l,
296
- isDragging: W === e.id,
297
- onSelect: u,
298
- onShapeChange: d,
299
- setDragOverride: q,
300
- setDraggingItemId: G
297
+ isDragging: K === e.id,
298
+ onSelect: d,
299
+ onShapeChange: f,
300
+ setDragOverride: J,
301
+ setDraggingItemId: ee
301
302
  }, e.id);
302
303
  }) }),
303
- /* @__PURE__ */ o(c, {
304
+ /* @__PURE__ */ o(l, {
304
305
  listening: !1,
305
- children: J && B.length > 0 && /* @__PURE__ */ s("Group", { children: [
306
- m === "polygon" && B.length >= 2 && /* @__PURE__ */ o("Line", {
307
- points: D(B, F.w, F.h),
308
- stroke: y,
306
+ children: Y && H.length > 0 && /* @__PURE__ */ s("Group", { children: [
307
+ h === "polygon" && H.length >= 2 && /* @__PURE__ */ o("Line", {
308
+ points: O(H, B.w, B.h),
309
+ stroke: b,
309
310
  strokeWidth: 1.5,
310
311
  dash: [6, 3],
311
312
  opacity: .8
312
313
  }),
313
- m === "line" && B.length === 1 && H && /* @__PURE__ */ o("Line", {
314
+ h === "line" && H.length === 1 && W && /* @__PURE__ */ o("Line", {
314
315
  points: [
315
- B[0].x * F.w,
316
- B[0].y * F.h,
317
- H.x,
318
- H.y
316
+ H[0].x * B.w,
317
+ H[0].y * B.h,
318
+ W.x,
319
+ W.y
319
320
  ],
320
- stroke: g.line,
321
+ stroke: _.line,
321
322
  strokeWidth: 1.5,
322
323
  dash: [6, 3],
323
324
  opacity: .7
324
325
  }),
325
- m === "polygon" && H && B.length >= 1 && /* @__PURE__ */ o("Line", {
326
+ h === "polygon" && W && H.length >= 1 && /* @__PURE__ */ o("Line", {
326
327
  points: [
327
- B[B.length - 1].x * F.w,
328
- B[B.length - 1].y * F.h,
329
- H.x,
330
- H.y
328
+ H[H.length - 1].x * B.w,
329
+ H[H.length - 1].y * B.h,
330
+ W.x,
331
+ W.y
331
332
  ],
332
- stroke: y,
333
+ stroke: b,
333
334
  strokeWidth: 1,
334
335
  dash: [4, 4],
335
336
  opacity: .5
336
337
  }),
337
- B.map((e, t) => {
338
- let n = T(e, F.w, F.h), r = t === 0 && m === "polygon" && B.length >= b;
338
+ H.map((e, t) => {
339
+ let n = E(e, B.w, B.h), r = t === 0 && h === "polygon" && H.length >= x;
339
340
  return /* @__PURE__ */ o("Circle", {
340
341
  x: n.x,
341
342
  y: n.y,
342
343
  radius: r ? 7 : 4,
343
- fill: r ? y : "#ffffff",
344
- stroke: y,
344
+ fill: r ? b : "#ffffff",
345
+ stroke: b,
345
346
  strokeWidth: 1.5,
346
347
  opacity: .9
347
348
  }, t);
@@ -350,26 +351,26 @@ function N({ items: e, selectedId: n, onSelect: u, onShapeChange: d, onDrawCompl
350
351
  })
351
352
  ]
352
353
  }),
353
- J ? /* @__PURE__ */ o("div", {
354
+ Y ? /* @__PURE__ */ o("div", {
354
355
  className: "px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700",
355
- children: m === "line" ? "Click to set the start point, click again to complete the line" : m === "rect" ? "Click to drop a rectangle, then drag the corner to resize" : m === "grid" ? "Click to add the grid, then paint cells" : B.length < b ? "Click to add points (min 3). Double-click or click the first point to close." : "Continue adding points. Double-click or click the first point to close."
356
+ children: h === "line" ? F("uiLibrary.maskShapeCanvas.hintLine", "Click to set the start point, click again to complete the line") : h === "rect" ? F("uiLibrary.maskShapeCanvas.hintRect", "Click to drop a rectangle, then drag the corner to resize") : h === "grid" ? F("uiLibrary.maskShapeCanvas.hintGrid", "Click to add the grid, then paint cells") : H.length < x ? F("uiLibrary.maskShapeCanvas.hintPoints", "Click to add points (min 3). Double-click or click the first point to close.") : F("uiLibrary.maskShapeCanvas.hintMore", "Continue adding points. Double-click or click the first point to close.")
356
357
  }) : null
357
358
  ]
358
359
  });
359
360
  }
360
- var P = .02;
361
- function F(e, t) {
361
+ var F = .02;
362
+ function I(e, t) {
362
363
  return Math.abs(e.x - t.x) < 1e-6 && Math.abs(e.y - t.y) < 1e-6 && Math.abs(e.width - t.width) < 1e-6 && Math.abs(e.height - t.height) < 1e-6;
363
364
  }
364
- function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, isDrawing: f, size: p, onSelect: g, onShapeChange: y }) {
365
- let [b, x] = t(null), S = {
365
+ function L({ item: t, shape: n, color: r, selected: i, dimmed: c, editable: l, isDrawing: u, size: p, onSelect: m, onShapeChange: _ }) {
366
+ let [b, x] = a(null), S = {
366
367
  x: n.x,
367
368
  y: n.y,
368
369
  width: n.width,
369
370
  height: n.height
370
371
  };
371
- a(() => {
372
- b && F(S, b) && x(null);
372
+ e(() => {
373
+ b && I(S, b) && x(null);
373
374
  }, [
374
375
  n.x,
375
376
  n.y,
@@ -377,20 +378,20 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
377
378
  n.height,
378
379
  b
379
380
  ]);
380
- let C = b ?? S, w = C.x * p.w, T = C.y * p.h, E = C.width * p.w, D = C.height * p.h, k = c ? .35 : i ? 1 : .85, A = (t) => {
381
- x(t), y(e.id, {
381
+ let C = b ?? S, w = C.x * p.w, T = C.y * p.h, E = C.width * p.w, D = C.height * p.h, O = c ? .35 : i ? 1 : .85, A = (e) => {
382
+ x(e), _(t.id, {
382
383
  kind: "rect",
383
- x: t.x,
384
- y: t.y,
385
- width: t.width,
386
- height: t.height
384
+ x: e.x,
385
+ y: e.y,
386
+ width: e.width,
387
+ height: e.height
387
388
  });
388
389
  };
389
- return /* @__PURE__ */ o(u, {
390
- onClick: (t) => {
391
- t.cancelBubble = !0, f || g(e.id);
390
+ return /* @__PURE__ */ o(d, {
391
+ onClick: (e) => {
392
+ e.cancelBubble = !0, u || m(t.id);
392
393
  },
393
- children: /* @__PURE__ */ s(u, {
394
+ children: /* @__PURE__ */ s(d, {
394
395
  draggable: l,
395
396
  dragBoundFunc: l ? (e) => ({
396
397
  x: Math.max(-w, Math.min(p.w - (w + E), e.x)),
@@ -417,23 +418,23 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
417
418
  onMouseLeave: (e) => {
418
419
  if (!l) return;
419
420
  let t = e.target.getStage();
420
- t && (t.container().style.cursor = f ? "crosshair" : "default");
421
+ t && (t.container().style.cursor = u ? "crosshair" : "default");
421
422
  },
422
423
  children: [
423
- /* @__PURE__ */ o(h, {
424
+ /* @__PURE__ */ o(g, {
424
425
  x: w,
425
426
  y: T,
426
427
  width: E,
427
428
  height: D,
428
- fill: r + (i ? v : _),
429
+ fill: r + (i ? y : v),
429
430
  stroke: r,
430
431
  strokeWidth: i ? 2.5 : 1.5,
431
- opacity: k
432
+ opacity: O
432
433
  }),
433
- e.label ? /* @__PURE__ */ o(d, {
434
+ t.label ? /* @__PURE__ */ o(f, {
434
435
  x: w,
435
436
  y: T - 16,
436
- text: e.label,
437
+ text: t.label,
437
438
  fontSize: 12,
438
439
  fill: r,
439
440
  stroke: "#000000",
@@ -442,7 +443,7 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
442
443
  fontStyle: "bold",
443
444
  listening: !1
444
445
  }) : null,
445
- l ? /* @__PURE__ */ o(m, {
446
+ l ? /* @__PURE__ */ o(h, {
446
447
  x: w + E,
447
448
  y: T + D,
448
449
  radius: 6,
@@ -458,19 +459,19 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
458
459
  e.cancelBubble = !0;
459
460
  },
460
461
  onDragMove: (e) => {
461
- let t = e.target, n = O(t.x() / p.w - C.x), r = O(t.y() / p.h - C.y);
462
+ let t = e.target, n = k(t.x() / p.w - C.x), r = k(t.y() / p.h - C.y);
462
463
  x({
463
464
  ...C,
464
- width: Math.max(P, Math.min(n, 1 - C.x)),
465
- height: Math.max(P, Math.min(r, 1 - C.y))
465
+ width: Math.max(F, Math.min(n, 1 - C.x)),
466
+ height: Math.max(F, Math.min(r, 1 - C.y))
466
467
  });
467
468
  },
468
469
  onDragEnd: (e) => {
469
- let t = e.target, n = O(t.x() / p.w - C.x), r = O(t.y() / p.h - C.y);
470
+ let t = e.target, n = k(t.x() / p.w - C.x), r = k(t.y() / p.h - C.y);
470
471
  A({
471
472
  ...C,
472
- width: Math.max(P, Math.min(n, 1 - C.x)),
473
- height: Math.max(P, Math.min(r, 1 - C.y))
473
+ width: Math.max(F, Math.min(n, 1 - C.x)),
474
+ height: Math.max(F, Math.min(r, 1 - C.y))
474
475
  });
475
476
  },
476
477
  onMouseEnter: (e) => {
@@ -486,31 +487,31 @@ function I({ item: e, shape: n, color: r, selected: i, dimmed: c, editable: l, i
486
487
  })
487
488
  });
488
489
  }
489
- function L({ item: e, shape: t, color: n, dimmed: r, editable: i, size: a, onSelect: s, paintingRef: c, paintValueRef: l, paintedRef: d, paintCell: f }) {
490
- let { gridWidth: p, gridHeight: m, cells: g } = t, _ = a.w / p, y = a.h / m, b = p * m, x = r ? .3 : 1, S = (n) => {
490
+ function R({ item: e, shape: t, color: n, dimmed: r, editable: i, size: a, onSelect: s, paintingRef: c, paintValueRef: l, paintedRef: u, paintCell: f }) {
491
+ let { gridWidth: p, gridHeight: m, cells: h } = t, _ = a.w / p, v = a.h / m, b = p * m, x = r ? .3 : 1, S = (n) => {
491
492
  if (!i) {
492
493
  s(e.id);
493
494
  return;
494
495
  }
495
- let r = g[n] !== !0;
496
- c.current = !0, l.current = r, d.current = new Set([n]), f(e.id, t, n, r);
496
+ let r = h[n] !== !0;
497
+ c.current = !0, l.current = r, u.current = new Set([n]), f(e.id, t, n, r);
497
498
  }, C = (n) => {
498
- !c.current || !i || d.current.has(n) || (d.current.add(n), f(e.id, t, n, l.current));
499
+ !c.current || !i || u.current.has(n) || (u.current.add(n), f(e.id, t, n, l.current));
499
500
  }, w = () => {
500
- c.current && (c.current = !1, d.current = /* @__PURE__ */ new Set());
501
+ c.current && (c.current = !1, u.current = /* @__PURE__ */ new Set());
501
502
  };
502
- return /* @__PURE__ */ o(u, {
503
+ return /* @__PURE__ */ o(d, {
503
504
  opacity: x,
504
505
  onMouseUp: w,
505
506
  onMouseLeave: w,
506
507
  children: Array.from({ length: b }, (e, t) => {
507
- let r = t % p, i = Math.floor(t / p), a = g[t] === !0;
508
- return /* @__PURE__ */ o(h, {
508
+ let r = t % p, i = Math.floor(t / p), a = h[t] === !0;
509
+ return /* @__PURE__ */ o(g, {
509
510
  x: r * _,
510
- y: i * y,
511
+ y: i * v,
511
512
  width: _,
512
- height: y,
513
- fill: a ? n + v : "#ffffff10",
513
+ height: v,
514
+ fill: a ? n + y : "#ffffff10",
514
515
  stroke: a ? n : "#ffffff40",
515
516
  strokeWidth: .5,
516
517
  onMouseDown: (e) => {
@@ -521,18 +522,18 @@ function L({ item: e, shape: t, color: n, dimmed: r, editable: i, size: a, onSel
521
522
  })
522
523
  });
523
524
  }
524
- function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, isLine: c, isDrawing: l, size: m, effectivePoints: h, minVertices: g, maxVertices: y, isDragging: b, onSelect: x, onShapeChange: S, setDragOverride: C, setDraggingItemId: w }) {
525
- let O = D(h, m.w, m.h), k = i ? .35 : r ? 1 : c ? .8 : .85, j = (e) => c ? {
525
+ function z({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, isLine: c, isDrawing: l, size: u, effectivePoints: h, minVertices: g, maxVertices: _, isDragging: b, onSelect: x, onShapeChange: S, setDragOverride: C, setDraggingItemId: w }) {
526
+ let T = O(h, u.w, u.h), k = i ? .35 : r ? 1 : c ? .8 : .85, A = (e) => c ? {
526
527
  kind: "line",
527
528
  points: [...e]
528
529
  } : {
529
530
  kind: "polygon",
530
531
  points: [...e]
531
- }, M = h.map((e) => e.x * m.w), N = h.map((e) => e.y * m.h), P = M.length > 0 ? Math.min(...M) : 0, F = M.length > 0 ? Math.max(...M) : 0, I = N.length > 0 ? Math.min(...N) : 0, L = N.length > 0 ? Math.max(...N) : 0, R = (e) => ({
532
- x: Math.max(-P, Math.min(m.w - F, e.x)),
533
- y: Math.max(-I, Math.min(m.h - L, e.y))
532
+ }, M = h.map((e) => e.x * u.w), N = h.map((e) => e.y * u.h), P = M.length > 0 ? Math.min(...M) : 0, F = M.length > 0 ? Math.max(...M) : 0, I = N.length > 0 ? Math.min(...N) : 0, L = N.length > 0 ? Math.max(...N) : 0, R = (e) => ({
533
+ x: Math.max(-P, Math.min(u.w - F, e.x)),
534
+ y: Math.max(-I, Math.min(u.h - L, e.y))
534
535
  }), z = (n) => {
535
- let r = n.target, i = r.x() / m.w, a = r.y() / m.h;
536
+ let r = n.target, i = r.x() / u.w, a = r.y() / u.h;
536
537
  if (r.position({
537
538
  x: 0,
538
539
  y: 0
@@ -544,14 +545,14 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
544
545
  C({
545
546
  itemId: e.id,
546
547
  points: o
547
- }), S(e.id, j(o));
548
- }, B = !c && h.length > g, V = !c && (y === void 0 || h.length < y);
549
- return /* @__PURE__ */ s(u, {
548
+ }), S(e.id, A(o));
549
+ }, B = !c && h.length > g, V = !c && (_ === void 0 || h.length < _);
550
+ return /* @__PURE__ */ s(d, {
550
551
  onClick: (t) => {
551
552
  t.cancelBubble = !0, l || x(e.id);
552
553
  },
553
554
  children: [
554
- /* @__PURE__ */ s(u, {
555
+ /* @__PURE__ */ s(d, {
555
556
  draggable: a,
556
557
  dragBoundFunc: a ? R : void 0,
557
558
  onDragStart: a ? () => w(e.id) : void 0,
@@ -566,27 +567,27 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
566
567
  let t = e.target.getStage();
567
568
  t && (t.container().style.cursor = l ? "crosshair" : "default");
568
569
  },
569
- children: [c ? /* @__PURE__ */ o(f, {
570
- points: O,
570
+ children: [c ? /* @__PURE__ */ o(p, {
571
+ points: T,
571
572
  stroke: n,
572
573
  strokeWidth: r ? 3 : 2,
573
574
  fill: n,
574
575
  pointerLength: 10,
575
576
  pointerWidth: 8,
576
577
  opacity: k
577
- }) : /* @__PURE__ */ o(p, {
578
- points: O,
578
+ }) : /* @__PURE__ */ o(m, {
579
+ points: T,
579
580
  closed: !0,
580
- fill: n + (r ? v : _),
581
+ fill: n + (r ? y : v),
581
582
  stroke: n,
582
583
  strokeWidth: r ? 2.5 : 1.5,
583
584
  opacity: k
584
585
  }), e.label && h.length > 0 ? (() => {
585
- let t = T({
586
+ let t = E({
586
587
  x: h.reduce((e, t) => e + t.x, 0) / h.length,
587
588
  y: h.reduce((e, t) => e + t.y, 0) / h.length
588
- }, m.w, m.h), r = Math.max(40, e.label.length * 11 * .62);
589
- return /* @__PURE__ */ o(d, {
589
+ }, u.w, u.h), r = Math.max(40, e.label.length * 11 * .62);
590
+ return /* @__PURE__ */ o(f, {
590
591
  x: t.x - r / 2,
591
592
  y: t.y - 7,
592
593
  width: r,
@@ -603,7 +604,7 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
603
604
  })() : null]
604
605
  }),
605
606
  a && !b && h.map((r, i) => {
606
- let a = T(r, m.w, m.h);
607
+ let a = E(r, u.w, u.h);
607
608
  return /* @__PURE__ */ o("Circle", {
608
609
  x: a.x,
609
610
  y: a.y,
@@ -613,10 +614,10 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
613
614
  strokeWidth: 1.5,
614
615
  draggable: !0,
615
616
  onDragMove: (n) => {
616
- let r = E({
617
+ let r = D({
617
618
  x: n.target.x(),
618
619
  y: n.target.y()
619
- }, m.w, m.h);
620
+ }, u.w, u.h);
620
621
  C((n) => {
621
622
  let a = n && n.itemId === e.id ? n.points : t.points;
622
623
  return {
@@ -626,25 +627,25 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
626
627
  });
627
628
  },
628
629
  onDragEnd: (n) => {
629
- let r = E({
630
+ let r = D({
630
631
  x: n.target.x(),
631
632
  y: n.target.y()
632
- }, m.w, m.h), a = t.points.map((e, t) => t === i ? r : e);
633
+ }, u.w, u.h), a = t.points.map((e, t) => t === i ? r : e);
633
634
  C({
634
635
  itemId: e.id,
635
636
  points: a
636
- }), S(e.id, j(a));
637
+ }), S(e.id, A(a));
637
638
  },
638
639
  onContextMenu: (n) => {
639
- n.evt.preventDefault(), n.cancelBubble = !0, B && S(e.id, j(t.points.filter((e, t) => t !== i)));
640
+ n.evt.preventDefault(), n.cancelBubble = !0, B && S(e.id, A(t.points.filter((e, t) => t !== i)));
640
641
  }
641
642
  }, `pt-${i}`);
642
643
  }),
643
644
  a && !b && V && h.length >= 2 && h.map((r, i) => {
644
- let a = h[(i + 1) % h.length], s = T({
645
+ let a = h[(i + 1) % h.length], s = E({
645
646
  x: (r.x + a.x) / 2,
646
647
  y: (r.y + a.y) / 2
647
- }, m.w, m.h);
648
+ }, u.w, u.h);
648
649
  return /* @__PURE__ */ o("Circle", {
649
650
  x: s.x,
650
651
  y: s.y,
@@ -674,13 +675,13 @@ function R({ item: e, shape: t, color: n, selected: r, dimmed: i, editable: a, i
674
675
  n && (n.container().style.cursor = l ? "crosshair" : "default");
675
676
  },
676
677
  onClick: (n) => {
677
- n.cancelBubble = !0, S(e.id, j(A(t.points, i)));
678
+ n.cancelBubble = !0, S(e.id, A(j(t.points, i)));
678
679
  }
679
680
  }, `mid-${i}`);
680
681
  })
681
682
  ]
682
683
  });
683
684
  }
684
- var z = n(N);
685
+ var B = n(P);
685
686
  //#endregion
686
- export { z as MaskShapeCanvas };
687
+ export { B as MaskShapeCanvas };