react-img-cutout 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import Ct, { useState as O, useRef as N, useCallback as M, useMemo as V, useEffect as W, useContext as Y, createContext as lt } from "react";
1
+ import Ct, { useState as L, useRef as V, useCallback as M, useMemo as B, useEffect as W, useContext as N, createContext as lt } from "react";
2
2
  var st = { exports: {} }, tt = {};
3
3
  var ut;
4
4
  function Mt() {
5
5
  if (ut) return tt;
6
6
  ut = 1;
7
7
  var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
8
- function n(e, c, i) {
9
- var s = null;
10
- if (i !== void 0 && (s = "" + i), c.key !== void 0 && (s = "" + c.key), "key" in c) {
11
- i = {};
12
- for (var o in c)
13
- o !== "key" && (i[o] = c[o]);
14
- } else i = c;
15
- return c = i.ref, {
8
+ function n(e, l, s) {
9
+ var i = null;
10
+ if (s !== void 0 && (i = "" + s), l.key !== void 0 && (i = "" + l.key), "key" in l) {
11
+ s = {};
12
+ for (var o in l)
13
+ o !== "key" && (s[o] = l[o]);
14
+ } else s = l;
15
+ return l = s.ref, {
16
16
  $$typeof: t,
17
17
  type: e,
18
- key: s,
19
- ref: c !== void 0 ? c : null,
20
- props: i
18
+ key: i,
19
+ ref: l !== void 0 ? l : null,
20
+ props: s
21
21
  };
22
22
  }
23
23
  return tt.Fragment = r, tt.jsx = n, tt.jsxs = n, tt;
@@ -32,17 +32,17 @@ function It() {
32
32
  return a.$$typeof === Q ? null : a.displayName || a.name || null;
33
33
  if (typeof a == "string") return a;
34
34
  switch (a) {
35
- case d:
35
+ case g:
36
36
  return "Fragment";
37
- case f:
37
+ case d:
38
38
  return "Profiler";
39
39
  case h:
40
40
  return "StrictMode";
41
- case A:
41
+ case R:
42
42
  return "Suspense";
43
- case _:
43
+ case P:
44
44
  return "SuspenseList";
45
- case U:
45
+ case H:
46
46
  return "Activity";
47
47
  }
48
48
  if (typeof a == "object")
@@ -51,19 +51,19 @@ function It() {
51
51
  ), a.$$typeof) {
52
52
  case y:
53
53
  return "Portal";
54
- case k:
54
+ case C:
55
55
  return a.displayName || "Context";
56
56
  case w:
57
57
  return (a._context.displayName || "Context") + ".Consumer";
58
58
  case b:
59
- var E = a.render;
60
- return a = a.displayName, a || (a = E.displayName || E.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
61
- case X:
62
- return E = a.displayName || null, E !== null ? E : t(a.type) || "Memo";
59
+ var k = a.render;
60
+ return a = a.displayName, a || (a = k.displayName || k.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
61
+ case U:
62
+ return k = a.displayName || null, k !== null ? k : t(a.type) || "Memo";
63
63
  case D:
64
- E = a._payload, a = a._init;
64
+ k = a._payload, a = a._init;
65
65
  try {
66
- return t(a(E));
66
+ return t(a(k));
67
67
  } catch {
68
68
  }
69
69
  }
@@ -75,74 +75,74 @@ function It() {
75
75
  function n(a) {
76
76
  try {
77
77
  r(a);
78
- var E = !1;
78
+ var k = !1;
79
79
  } catch {
80
- E = !0;
80
+ k = !0;
81
81
  }
82
- if (E) {
83
- E = console;
84
- var j = E.error, $ = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
85
- return j.call(
86
- E,
82
+ if (k) {
83
+ k = console;
84
+ var _ = k.error, $ = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
85
+ return _.call(
86
+ k,
87
87
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
88
  $
89
89
  ), r(a);
90
90
  }
91
91
  }
92
92
  function e(a) {
93
- if (a === d) return "<>";
93
+ if (a === g) return "<>";
94
94
  if (typeof a == "object" && a !== null && a.$$typeof === D)
95
95
  return "<...>";
96
96
  try {
97
- var E = t(a);
98
- return E ? "<" + E + ">" : "<...>";
97
+ var k = t(a);
98
+ return k ? "<" + k + ">" : "<...>";
99
99
  } catch {
100
100
  return "<...>";
101
101
  }
102
102
  }
103
- function c() {
104
- var a = B.A;
103
+ function l() {
104
+ var a = q.A;
105
105
  return a === null ? null : a.getOwner();
106
106
  }
107
- function i() {
107
+ function s() {
108
108
  return Error("react-stack-top-frame");
109
109
  }
110
- function s(a) {
111
- if (q.call(a, "key")) {
112
- var E = Object.getOwnPropertyDescriptor(a, "key").get;
113
- if (E && E.isReactWarning) return !1;
110
+ function i(a) {
111
+ if (G.call(a, "key")) {
112
+ var k = Object.getOwnPropertyDescriptor(a, "key").get;
113
+ if (k && k.isReactWarning) return !1;
114
114
  }
115
115
  return a.key !== void 0;
116
116
  }
117
- function o(a, E) {
118
- function j() {
119
- P || (P = !0, console.error(
117
+ function o(a, k) {
118
+ function _() {
119
+ I || (I = !0, console.error(
120
120
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
121
- E
121
+ k
122
122
  ));
123
123
  }
124
- j.isReactWarning = !0, Object.defineProperty(a, "key", {
125
- get: j,
124
+ _.isReactWarning = !0, Object.defineProperty(a, "key", {
125
+ get: _,
126
126
  configurable: !0
127
127
  });
128
128
  }
129
- function l() {
129
+ function c() {
130
130
  var a = t(this.type);
131
- return I[a] || (I[a] = !0, console.error(
131
+ return S[a] || (S[a] = !0, console.error(
132
132
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
133
133
  )), a = this.props.ref, a !== void 0 ? a : null;
134
134
  }
135
- function u(a, E, j, $, ot, it) {
136
- var T = j.ref;
135
+ function u(a, k, _, $, ot, it) {
136
+ var T = _.ref;
137
137
  return a = {
138
- $$typeof: g,
138
+ $$typeof: f,
139
139
  type: a,
140
- key: E,
141
- props: j,
140
+ key: k,
141
+ props: _,
142
142
  _owner: $
143
143
  }, (T !== void 0 ? T : null) !== null ? Object.defineProperty(a, "ref", {
144
144
  enumerable: !1,
145
- get: l
145
+ get: c
146
146
  }) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
147
147
  configurable: !1,
148
148
  enumerable: !1,
@@ -165,11 +165,11 @@ function It() {
165
165
  value: it
166
166
  }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
167
167
  }
168
- function p(a, E, j, $, ot, it) {
169
- var T = E.children;
168
+ function p(a, k, _, $, ot, it) {
169
+ var T = k.children;
170
170
  if (T !== void 0)
171
171
  if ($)
172
- if (S(T)) {
172
+ if (j(T)) {
173
173
  for ($ = 0; $ < T.length; $++)
174
174
  m(T[$]);
175
175
  Object.freeze && Object.freeze(T);
@@ -178,12 +178,12 @@ function It() {
178
178
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
179
  );
180
180
  else m(T);
181
- if (q.call(E, "key")) {
181
+ if (G.call(k, "key")) {
182
182
  T = t(a);
183
- var K = Object.keys(E).filter(function(Et) {
183
+ var K = Object.keys(k).filter(function(Et) {
184
184
  return Et !== "key";
185
185
  });
186
- $ = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", G[T + $] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
186
+ $ = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", Y[T + $] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
187
187
  `A props object containing a "key" prop is being spread into JSX:
188
188
  let props = %s;
189
189
  <%s {...props} />
@@ -194,21 +194,21 @@ React keys must be passed directly to JSX without using spread:
194
194
  T,
195
195
  K,
196
196
  T
197
- ), G[T + $] = !0);
197
+ ), Y[T + $] = !0);
198
198
  }
199
- if (T = null, j !== void 0 && (n(j), T = "" + j), s(E) && (n(E.key), T = "" + E.key), "key" in E) {
200
- j = {};
201
- for (var at in E)
202
- at !== "key" && (j[at] = E[at]);
203
- } else j = E;
199
+ if (T = null, _ !== void 0 && (n(_), T = "" + _), i(k) && (n(k.key), T = "" + k.key), "key" in k) {
200
+ _ = {};
201
+ for (var at in k)
202
+ at !== "key" && (_[at] = k[at]);
203
+ } else _ = k;
204
204
  return T && o(
205
- j,
205
+ _,
206
206
  typeof a == "function" ? a.displayName || a.name || "Unknown" : a
207
207
  ), u(
208
208
  a,
209
209
  T,
210
- j,
211
- c(),
210
+ _,
211
+ l(),
212
212
  ot,
213
213
  it
214
214
  );
@@ -217,9 +217,9 @@ React keys must be passed directly to JSX without using spread:
217
217
  v(a) ? a._store && (a._store.validated = 1) : typeof a == "object" && a !== null && a.$$typeof === D && (a._payload.status === "fulfilled" ? v(a._payload.value) && a._payload.value._store && (a._payload.value._store.validated = 1) : a._store && (a._store.validated = 1));
218
218
  }
219
219
  function v(a) {
220
- return typeof a == "object" && a !== null && a.$$typeof === g;
220
+ return typeof a == "object" && a !== null && a.$$typeof === f;
221
221
  }
222
- var x = Ct, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), y = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), h = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), w = /* @__PURE__ */ Symbol.for("react.consumer"), k = /* @__PURE__ */ Symbol.for("react.context"), b = /* @__PURE__ */ Symbol.for("react.forward_ref"), A = /* @__PURE__ */ Symbol.for("react.suspense"), _ = /* @__PURE__ */ Symbol.for("react.suspense_list"), X = /* @__PURE__ */ Symbol.for("react.memo"), D = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), B = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, q = Object.prototype.hasOwnProperty, S = Array.isArray, R = console.createTask ? console.createTask : function() {
222
+ var x = Ct, f = /* @__PURE__ */ Symbol.for("react.transitional.element"), y = /* @__PURE__ */ Symbol.for("react.portal"), g = /* @__PURE__ */ Symbol.for("react.fragment"), h = /* @__PURE__ */ Symbol.for("react.strict_mode"), d = /* @__PURE__ */ Symbol.for("react.profiler"), w = /* @__PURE__ */ Symbol.for("react.consumer"), C = /* @__PURE__ */ Symbol.for("react.context"), b = /* @__PURE__ */ Symbol.for("react.forward_ref"), R = /* @__PURE__ */ Symbol.for("react.suspense"), P = /* @__PURE__ */ Symbol.for("react.suspense_list"), U = /* @__PURE__ */ Symbol.for("react.memo"), D = /* @__PURE__ */ Symbol.for("react.lazy"), H = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), q = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, j = Array.isArray, A = console.createTask ? console.createTask : function() {
223
223
  return null;
224
224
  };
225
225
  x = {
@@ -227,29 +227,29 @@ React keys must be passed directly to JSX without using spread:
227
227
  return a();
228
228
  }
229
229
  };
230
- var P, I = {}, z = x.react_stack_bottom_frame.bind(
230
+ var I, S = {}, O = x.react_stack_bottom_frame.bind(
231
231
  x,
232
- i
233
- )(), L = R(e(i)), G = {};
234
- et.Fragment = d, et.jsx = function(a, E, j) {
235
- var $ = 1e4 > B.recentlyCreatedOwnerStacks++;
232
+ s
233
+ )(), z = A(e(s)), Y = {};
234
+ et.Fragment = g, et.jsx = function(a, k, _) {
235
+ var $ = 1e4 > q.recentlyCreatedOwnerStacks++;
236
236
  return p(
237
237
  a,
238
- E,
239
- j,
238
+ k,
239
+ _,
240
240
  !1,
241
- $ ? Error("react-stack-top-frame") : z,
242
- $ ? R(e(a)) : L
241
+ $ ? Error("react-stack-top-frame") : O,
242
+ $ ? A(e(a)) : z
243
243
  );
244
- }, et.jsxs = function(a, E, j) {
245
- var $ = 1e4 > B.recentlyCreatedOwnerStacks++;
244
+ }, et.jsxs = function(a, k, _) {
245
+ var $ = 1e4 > q.recentlyCreatedOwnerStacks++;
246
246
  return p(
247
247
  a,
248
- E,
249
- j,
248
+ k,
249
+ _,
250
250
  !0,
251
- $ ? Error("react-stack-top-frame") : z,
252
- $ ? R(e(a)) : L
251
+ $ ? Error("react-stack-top-frame") : O,
252
+ $ ? A(e(a)) : z
253
253
  );
254
254
  };
255
255
  })()), et;
@@ -258,36 +258,36 @@ var ft;
258
258
  function Rt() {
259
259
  return ft || (ft = 1, process.env.NODE_ENV === "production" ? st.exports = Mt() : st.exports = It()), st.exports;
260
260
  }
261
- var C = Rt();
261
+ var E = Rt();
262
262
  const At = 400;
263
263
  function Pt(t, r, n) {
264
- const e = n[0] - r[0], c = n[1] - r[1], i = e * e + c * c;
265
- if (i === 0) {
266
- const o = t[0] - r[0], l = t[1] - r[1];
267
- return Math.sqrt(o * o + l * l);
264
+ const e = n[0] - r[0], l = n[1] - r[1], s = e * e + l * l;
265
+ if (s === 0) {
266
+ const o = t[0] - r[0], c = t[1] - r[1];
267
+ return Math.sqrt(o * o + c * c);
268
268
  }
269
- return Math.abs(e * (r[1] - t[1]) - c * (r[0] - t[0])) / Math.sqrt(i);
269
+ return Math.abs(e * (r[1] - t[1]) - l * (r[0] - t[0])) / Math.sqrt(s);
270
270
  }
271
271
  function ct(t, r) {
272
272
  if (t.length <= 2) return t;
273
273
  let n = 0, e = 0;
274
- const c = t[0], i = t[t.length - 1];
275
- for (let s = 1; s < t.length - 1; s++) {
276
- const o = Pt(t[s], c, i);
277
- o > n && (n = o, e = s);
274
+ const l = t[0], s = t[t.length - 1];
275
+ for (let i = 1; i < t.length - 1; i++) {
276
+ const o = Pt(t[i], l, s);
277
+ o > n && (n = o, e = i);
278
278
  }
279
279
  if (n > r) {
280
- const s = ct(t.slice(0, e + 1), r), o = ct(t.slice(e), r);
281
- return s.slice(0, -1).concat(o);
280
+ const i = ct(t.slice(0, e + 1), r), o = ct(t.slice(e), r);
281
+ return i.slice(0, -1).concat(o);
282
282
  }
283
- return [c, i];
283
+ return [l, s];
284
284
  }
285
285
  function dt(t) {
286
286
  let r = 0;
287
287
  const n = t.length;
288
288
  for (let e = 0; e < n; e++) {
289
- const [c, i] = t[e], [s, o] = t[(e + 1) % n];
290
- r += c * o - s * i;
289
+ const [l, s] = t[e], [i, o] = t[(e + 1) % n];
290
+ r += l * o - i * s;
291
291
  }
292
292
  return r * 0.5;
293
293
  }
@@ -331,98 +331,98 @@ const jt = [
331
331
  // 15 (1111)
332
332
  ];
333
333
  function _t(t, r, n, e) {
334
- const c = [];
335
- for (let i = 0; i < n - 1; i++)
336
- for (let s = 0; s < r - 1; s++) {
337
- const o = t[i * r + s], l = t[i * r + s + 1], u = t[(i + 1) * r + s + 1], p = t[(i + 1) * r + s];
334
+ const l = [];
335
+ for (let s = 0; s < n - 1; s++)
336
+ for (let i = 0; i < r - 1; i++) {
337
+ const o = t[s * r + i], c = t[s * r + i + 1], u = t[(s + 1) * r + i + 1], p = t[(s + 1) * r + i];
338
338
  let m = 0;
339
- if (o >= e && (m |= 1), l >= e && (m |= 2), u >= e && (m |= 4), p >= e && (m |= 8), m === 0 || m === 15) continue;
339
+ if (o >= e && (m |= 1), c >= e && (m |= 2), u >= e && (m |= 4), p >= e && (m |= 8), m === 0 || m === 15) continue;
340
340
  const v = (x) => {
341
341
  switch (x) {
342
342
  case 0: {
343
- const g = l - o, y = Math.abs(g) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - o) / g));
344
- return [s + y, i];
343
+ const f = c - o, y = Math.abs(f) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - o) / f));
344
+ return [i + y, s];
345
345
  }
346
346
  case 1: {
347
- const g = u - l, y = Math.abs(g) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - l) / g));
348
- return [s + 1, i + y];
347
+ const f = u - c, y = Math.abs(f) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - c) / f));
348
+ return [i + 1, s + y];
349
349
  }
350
350
  case 2: {
351
- const g = u - p, y = Math.abs(g) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - p) / g));
352
- return [s + y, i + 1];
351
+ const f = u - p, y = Math.abs(f) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - p) / f));
352
+ return [i + y, s + 1];
353
353
  }
354
354
  case 3: {
355
- const g = p - o, y = Math.abs(g) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - o) / g));
356
- return [s, i + y];
355
+ const f = p - o, y = Math.abs(f) < 1e-10 ? 0.5 : Math.max(0, Math.min(1, (e - o) / f));
356
+ return [i, s + y];
357
357
  }
358
358
  default:
359
- return [s + 0.5, i + 0.5];
359
+ return [i + 0.5, s + 0.5];
360
360
  }
361
361
  };
362
- for (const [x, g] of jt[m])
363
- c.push([v(x), v(g)]);
362
+ for (const [x, f] of jt[m])
363
+ l.push([v(x), v(f)]);
364
364
  }
365
- return c;
365
+ return l;
366
366
  }
367
367
  function $t(t) {
368
368
  if (t.length === 0) return [];
369
- const r = (i) => `${Math.round(i[0] * 1e4)},${Math.round(i[1] * 1e4)}`, n = /* @__PURE__ */ new Map();
370
- for (let i = 0; i < t.length; i++)
371
- for (const s of [0, 1]) {
372
- const o = r(t[i][s]);
373
- let l = n.get(o);
374
- l || (l = [], n.set(o, l)), l.push({ idx: i, end: s });
369
+ const r = (s) => `${Math.round(s[0] * 1e4)},${Math.round(s[1] * 1e4)}`, n = /* @__PURE__ */ new Map();
370
+ for (let s = 0; s < t.length; s++)
371
+ for (const i of [0, 1]) {
372
+ const o = r(t[s][i]);
373
+ let c = n.get(o);
374
+ c || (c = [], n.set(o, c)), c.push({ idx: s, end: i });
375
375
  }
376
- const e = new Uint8Array(t.length), c = [];
377
- for (let i = 0; i < t.length; i++) {
378
- if (e[i]) continue;
379
- const s = [];
380
- let o = i, l = 1, u = 0;
376
+ const e = new Uint8Array(t.length), l = [];
377
+ for (let s = 0; s < t.length; s++) {
378
+ if (e[s]) continue;
379
+ const i = [];
380
+ let o = s, c = 1, u = 0;
381
381
  const p = t.length + 1;
382
382
  for (; u++ < p && !e[o]; ) {
383
383
  e[o] = 1;
384
- const m = l === 1 ? 0 : 1;
385
- s.push(t[o][m]);
386
- const v = t[o][l], x = r(v), g = n.get(x);
387
- if (!g) break;
388
- const y = g.find((d) => !e[d.idx]);
384
+ const m = c === 1 ? 0 : 1;
385
+ i.push(t[o][m]);
386
+ const v = t[o][c], x = r(v), f = n.get(x);
387
+ if (!f) break;
388
+ const y = f.find((g) => !e[g.idx]);
389
389
  if (!y) break;
390
- o = y.idx, l = y.end === 0 ? 1 : 0;
390
+ o = y.idx, c = y.end === 0 ? 1 : 0;
391
391
  }
392
- s.length >= 3 && c.push(s);
392
+ i.length >= 3 && l.push(i);
393
393
  }
394
- return c;
394
+ return l;
395
395
  }
396
- function Tt(t, r, n, e = 30, c = 2e-3) {
396
+ function Tt(t, r, n, e = 30, l = 2e-3) {
397
397
  if (r <= 0 || n <= 0 || t.length === 0) return [];
398
- const i = Math.min(1, At / Math.max(r, n)), s = Math.max(1, Math.round(r * i)), o = Math.max(1, Math.round(n * i)), l = s + 2, u = o + 2, p = new Float32Array(l * u);
398
+ const s = Math.min(1, At / Math.max(r, n)), i = Math.max(1, Math.round(r * s)), o = Math.max(1, Math.round(n * s)), c = i + 2, u = o + 2, p = new Float32Array(c * u);
399
399
  for (let h = 0; h < o; h++) {
400
- const f = Math.min(n - 1, Math.floor(h / i));
401
- for (let w = 0; w < s; w++) {
402
- const k = Math.min(r - 1, Math.floor(w / i));
403
- p[(h + 1) * l + (w + 1)] = t[f * r + k];
400
+ const d = Math.min(n - 1, Math.floor(h / s));
401
+ for (let w = 0; w < i; w++) {
402
+ const C = Math.min(r - 1, Math.floor(w / s));
403
+ p[(h + 1) * c + (w + 1)] = t[d * r + C];
404
404
  }
405
405
  }
406
- const m = _t(p, l, u, e), v = $t(m);
406
+ const m = _t(p, c, u, e), v = $t(m);
407
407
  if (v.length === 0) return [];
408
- let x = v[0], g = Math.abs(dt(x));
408
+ let x = v[0], f = Math.abs(dt(x));
409
409
  for (let h = 1; h < v.length; h++) {
410
- const f = Math.abs(dt(v[h]));
411
- f > g && (x = v[h], g = f);
410
+ const d = Math.abs(dt(v[h]));
411
+ d > f && (x = v[h], f = d);
412
412
  }
413
- const y = x.map(([h, f]) => [
414
- (h - 1) / s,
415
- (f - 1) / o
416
- ]), d = St(y, c);
417
- return d.length >= 3 ? d : y;
413
+ const y = x.map(([h, d]) => [
414
+ (h - 1) / i,
415
+ (d - 1) / o
416
+ ]), g = St(y, l);
417
+ return g.length >= 3 ? g : y;
418
418
  }
419
419
  function Dt(t) {
420
420
  const r = t.length;
421
421
  if (r < 3) return "";
422
422
  const n = [`M${t[0][0]},${t[0][1]}`];
423
423
  for (let e = 0; e < r; e++) {
424
- const c = t[(e - 1 + r) % r], i = t[e], s = t[(e + 1) % r], o = t[(e + 2) % r], l = i[0] + (s[0] - c[0]) / 6, u = i[1] + (s[1] - c[1]) / 6, p = s[0] - (o[0] - i[0]) / 6, m = s[1] - (o[1] - i[1]) / 6;
425
- n.push(`C${l},${u} ${p},${m} ${s[0]},${s[1]}`);
424
+ const l = t[(e - 1 + r) % r], s = t[e], i = t[(e + 1) % r], o = t[(e + 2) % r], c = s[0] + (i[0] - l[0]) / 6, u = s[1] + (i[1] - l[1]) / 6, p = i[0] - (o[0] - s[0]) / 6, m = i[1] - (o[1] - s[1]) / 6;
425
+ n.push(`C${c},${u} ${p},${m} ${i[0]},${i[1]}`);
426
426
  }
427
427
  return n.push("Z"), n.join("");
428
428
  }
@@ -432,20 +432,20 @@ function Wt(t, r) {
432
432
  n[e] = t[e * 4 + 3];
433
433
  return n;
434
434
  }
435
- function zt(t, r, n, e) {
435
+ function Ot(t, r, n, e) {
436
436
  if (r <= 0 || n <= 0) return { x: 0, y: 0, w: 1, h: 1 };
437
- let c = r, i = n, s = 0, o = 0, l = !1;
437
+ let l = r, s = n, i = 0, o = 0, c = !1;
438
438
  for (let u = 0; u < n; u++)
439
439
  for (let p = 0; p < r; p++)
440
- t[u * r + p] > e && (p < c && (c = p), p > s && (s = p), u < i && (i = u), u > o && (o = u), l = !0);
441
- return l ? {
442
- x: c / r,
443
- y: i / n,
444
- w: (s - c + 1) / r,
445
- h: (o - i + 1) / n
440
+ t[u * r + p] > e && (p < l && (l = p), p > i && (i = p), u < s && (s = u), u > o && (o = u), c = !0);
441
+ return c ? {
442
+ x: l / r,
443
+ y: s / n,
444
+ w: (i - l + 1) / r,
445
+ h: (o - s + 1) / n
446
446
  } : { x: 0, y: 0, w: 1, h: 1 };
447
447
  }
448
- class Ot {
448
+ class zt {
449
449
  id;
450
450
  bounds = { x: 0, y: 0, w: 1, h: 1 };
451
451
  contour = [];
@@ -477,19 +477,19 @@ class Ot {
477
477
  */
478
478
  async prepare() {
479
479
  const r = new Image();
480
- r.crossOrigin = "anonymous", r.src = this.src, await new Promise((s) => {
481
- r.onload = () => s(), r.onerror = () => s();
480
+ r.crossOrigin = "anonymous", r.src = this.src, await new Promise((i) => {
481
+ r.onload = () => i(), r.onerror = () => i();
482
482
  });
483
483
  const n = r.naturalWidth, e = r.naturalHeight;
484
484
  if (n <= 0 || e <= 0) return;
485
- const c = document.createElement("canvas");
486
- c.width = n, c.height = e;
487
- const i = c.getContext("2d", { willReadFrequently: !0 });
488
- if (i)
485
+ const l = document.createElement("canvas");
486
+ l.width = n, l.height = e;
487
+ const s = l.getContext("2d", { willReadFrequently: !0 });
488
+ if (s)
489
489
  try {
490
- i.drawImage(r, 0, 0);
491
- const s = i.getImageData(0, 0, n, e);
492
- this.alpha = Wt(s.data, n * e), this.width = n, this.height = e, this.bounds = zt(this.alpha, n, e, this.threshold), this.contour = Tt(this.alpha, n, e, this.threshold);
490
+ s.drawImage(r, 0, 0);
491
+ const i = s.getImageData(0, 0, n, e);
492
+ this.alpha = Wt(i.data, n * e), this.width = n, this.height = e, this.bounds = Ot(this.alpha, n, e, this.threshold), this.contour = Tt(this.alpha, n, e, this.threshold);
493
493
  } catch {
494
494
  this.alpha = new Uint8Array(0);
495
495
  }
@@ -513,11 +513,11 @@ class Ot {
513
513
  if (this.alpha.length === 0) return !1;
514
514
  const e = this.bounds;
515
515
  if (r < e.x || r > e.x + e.w || n < e.y || n > e.y + e.h) return !1;
516
- const c = Math.min(this.width - 1, Math.max(0, Math.floor(r * this.width))), i = Math.min(
516
+ const l = Math.min(this.width - 1, Math.max(0, Math.floor(r * this.width))), s = Math.min(
517
517
  this.height - 1,
518
518
  Math.max(0, Math.floor(n * this.height))
519
519
  );
520
- return this.alpha[i * this.width + c] > this.threshold;
520
+ return this.alpha[s * this.width + l] > this.threshold;
521
521
  }
522
522
  }
523
523
  class Lt {
@@ -533,9 +533,9 @@ class Lt {
533
533
  }
534
534
  function Yt(t, r, n) {
535
535
  let e = !1;
536
- for (let c = 0, i = n.length - 1; c < n.length; i = c++) {
537
- const s = n[c][0], o = n[c][1], l = n[i][0], u = n[i][1];
538
- o > r != u > r && t < (l - s) * (r - o) / (u - o) + s && (e = !e);
536
+ for (let l = 0, s = n.length - 1; l < n.length; s = l++) {
537
+ const i = n[l][0], o = n[l][1], c = n[s][0], u = n[s][1];
538
+ o > r != u > r && t < (c - i) * (r - o) / (u - o) + i && (e = !e);
539
539
  }
540
540
  return e;
541
541
  }
@@ -545,14 +545,14 @@ class Nt {
545
545
  points;
546
546
  constructor(r) {
547
547
  this.id = r.id, this.points = r.points;
548
- let n = 1 / 0, e = 1 / 0, c = -1 / 0, i = -1 / 0;
549
- for (const [s, o] of r.points)
550
- s < n && (n = s), s > c && (c = s), o < e && (e = o), o > i && (i = o);
548
+ let n = 1 / 0, e = 1 / 0, l = -1 / 0, s = -1 / 0;
549
+ for (const [i, o] of r.points)
550
+ i < n && (n = i), i > l && (l = i), o < e && (e = o), o > s && (s = o);
551
551
  this.bounds = {
552
552
  x: n,
553
553
  y: e,
554
- w: c - n,
555
- h: i - e
554
+ w: l - n,
555
+ h: s - e
556
556
  };
557
557
  }
558
558
  /**
@@ -581,8 +581,8 @@ class Vt {
581
581
  ry;
582
582
  constructor(r, n = 1, e = 1) {
583
583
  this.id = r.id, this.cx = r.center.x, this.cy = r.center.y;
584
- const c = Math.max(1, n), i = Math.max(1, e), s = Math.min(c, i);
585
- this.rx = r.radius * s / c, this.ry = r.radius * s / i, this.bounds = {
584
+ const l = Math.max(1, n), s = Math.max(1, e), i = Math.min(l, s);
585
+ this.rx = r.radius * i / l, this.ry = r.radius * i / s, this.bounds = {
586
586
  x: r.center.x - this.rx,
587
587
  y: r.center.y - this.ry,
588
588
  w: this.rx * 2,
@@ -591,14 +591,14 @@ class Vt {
591
591
  }
592
592
  hitTest(r, n) {
593
593
  if (this.rx <= 0 || this.ry <= 0) return !1;
594
- const e = (r - this.cx) / this.rx, c = (n - this.cy) / this.ry;
595
- return e * e + c * c <= 1;
594
+ const e = (r - this.cx) / this.rx, l = (n - this.cy) / this.ry;
595
+ return e * e + l * l <= 1;
596
596
  }
597
597
  }
598
598
  function Bt(t, r, n) {
599
599
  switch (t.type) {
600
600
  case "image":
601
- return new Ot(t, r);
601
+ return new zt(t, r);
602
602
  case "bbox":
603
603
  return new Lt(t);
604
604
  case "polygon":
@@ -620,116 +620,116 @@ function Ht(t) {
620
620
  }
621
621
  }
622
622
  function Ft(t, r = !0, n = 30, e = 150) {
623
- const [c, i] = O(null), [s, o] = O(null), l = N(null), u = N([]), [p, m] = O({}), [v, x] = O({ width: 1, height: 1 }), [g, y] = O({}), d = Math.min(255, Math.max(0, n)), h = N(null), f = M(() => {
623
+ const [l, s] = L(null), [i, o] = L(null), c = V(null), u = V([]), [p, m] = L({}), [v, x] = L({ width: 1, height: 1 }), [f, y] = L({}), g = Math.min(255, Math.max(0, n)), h = V(null), d = M(() => {
624
624
  h.current === null && (h.current = setTimeout(() => {
625
- h.current = null, i(null);
625
+ h.current = null, s(null);
626
626
  }, e));
627
627
  }, [e]), w = M(() => {
628
628
  h.current !== null && (clearTimeout(h.current), h.current = null);
629
- }, []), k = t.map(Ht).join("|"), b = V(() => t, [k]);
629
+ }, []), C = t.map(Ht).join("|"), b = B(() => t, [C]);
630
630
  W(() => {
631
- const S = l.current;
632
- if (!S) return;
633
- const R = () => {
634
- const I = S.getBoundingClientRect();
631
+ const j = c.current;
632
+ if (!j) return;
633
+ const A = () => {
634
+ const S = j.getBoundingClientRect();
635
635
  x({
636
- width: Math.max(1, I.width),
637
- height: Math.max(1, I.height)
636
+ width: Math.max(1, S.width),
637
+ height: Math.max(1, S.height)
638
638
  });
639
639
  };
640
- R();
641
- const P = new ResizeObserver(R);
642
- return P.observe(S), () => P.disconnect();
640
+ A();
641
+ const I = new ResizeObserver(A);
642
+ return I.observe(j), () => I.disconnect();
643
643
  }, []), W(() => {
644
644
  if (!r) {
645
645
  u.current = [];
646
646
  return;
647
647
  }
648
- let S = !1, R = [];
649
- async function P() {
650
- const I = [], z = {}, L = {};
651
- for (const G of b) {
652
- const a = Bt(G, d, {
648
+ let j = !1, A = [];
649
+ async function I() {
650
+ const S = [], O = {}, z = {};
651
+ for (const Y of b) {
652
+ const a = Bt(Y, g, {
653
653
  viewportWidth: v.width,
654
654
  viewportHeight: v.height
655
655
  });
656
- if (a.prepare && await a.prepare(), S) return;
657
- I.push(a), z[a.id] = a.bounds, a.contour && a.contour.length >= 3 && (L[a.id] = a.contour);
656
+ if (a.prepare && await a.prepare(), j) return;
657
+ S.push(a), O[a.id] = a.bounds, a.contour && a.contour.length >= 3 && (z[a.id] = a.contour);
658
658
  }
659
- S || (R = I, u.current = I, m(z), y(L));
659
+ j || (A = S, u.current = S, m(O), y(z));
660
660
  }
661
- return P(), () => {
662
- S = !0;
663
- for (const I of R)
664
- I.dispose?.();
661
+ return I(), () => {
662
+ j = !0;
663
+ for (const S of A)
664
+ S.dispose?.();
665
665
  };
666
- }, [b, r, d, v.width, v.height]);
667
- const A = M(
668
- (S, R) => {
669
- const P = u.current;
670
- for (let I = P.length - 1; I >= 0; I--)
671
- if (P[I].hitTest(S, R))
672
- return P[I].id;
666
+ }, [b, r, g, v.width, v.height]);
667
+ const R = M(
668
+ (j, A) => {
669
+ const I = u.current;
670
+ for (let S = I.length - 1; S >= 0; S--)
671
+ if (I[S].hitTest(j, A))
672
+ return I[S].id;
673
673
  return null;
674
674
  },
675
675
  []
676
- ), _ = M(
677
- (S) => {
678
- const R = l.current;
679
- if (!R) return null;
680
- const P = R.getBoundingClientRect(), I = (S.clientX - P.left) / P.width, z = (S.clientY - P.top) / P.height;
681
- return I < 0 || I > 1 || z < 0 || z > 1 ? null : { nx: I, ny: z };
676
+ ), P = M(
677
+ (j) => {
678
+ const A = c.current;
679
+ if (!A) return null;
680
+ const I = A.getBoundingClientRect(), S = (j.clientX - I.left) / I.width, O = (j.clientY - I.top) / I.height;
681
+ return S < 0 || S > 1 || O < 0 || O > 1 ? null : { nx: S, ny: O };
682
682
  },
683
683
  []
684
- ), X = M(
685
- (S) => {
684
+ ), U = M(
685
+ (j) => {
686
686
  if (!r) return;
687
- const R = _(S);
688
- if (!R) {
689
- f();
687
+ const A = P(j);
688
+ if (!A) {
689
+ d();
690
690
  return;
691
691
  }
692
- const P = A(R.nx, R.ny);
693
- if (P === null) {
694
- if (S.target?.closest('[data-cutout-overlay="true"]')) {
692
+ const I = R(A.nx, A.ny);
693
+ if (I === null) {
694
+ if (j.target?.closest('[data-cutout-overlay="true"]')) {
695
695
  w();
696
696
  return;
697
697
  }
698
- f();
698
+ d();
699
699
  return;
700
700
  }
701
- w(), i(P);
701
+ w(), s(I);
702
702
  },
703
- [r, _, A, f, w]
703
+ [r, P, R, d, w]
704
704
  ), D = M(() => {
705
- f();
706
- }, [f]), U = M(
707
- (S) => {
705
+ d();
706
+ }, [d]), H = M(
707
+ (j) => {
708
708
  if (!r) return;
709
- const R = _(S);
710
- if (!R) {
709
+ const A = P(j);
710
+ if (!A) {
711
711
  o(null);
712
712
  return;
713
713
  }
714
- const P = A(R.nx, R.ny);
715
- o(P === s || P === null ? null : P);
714
+ const I = R(A.nx, A.ny);
715
+ o(I === i || I === null ? null : I);
716
716
  },
717
- [r, _, A, s]
718
- ), Q = s ?? c, B = r ? p : {}, q = r ? g : {};
717
+ [r, P, R, i]
718
+ ), Q = i ?? l, q = r ? p : {}, G = r ? f : {};
719
719
  return W(() => () => {
720
720
  w();
721
721
  }, [w]), {
722
- hoveredId: c,
723
- selectedId: s,
722
+ hoveredId: l,
723
+ selectedId: i,
724
724
  activeId: Q,
725
725
  viewportSize: v,
726
- boundsMap: B,
727
- contourMap: q,
728
- containerRef: l,
726
+ boundsMap: q,
727
+ contourMap: G,
728
+ containerRef: c,
729
729
  containerProps: {
730
- onPointerMove: X,
730
+ onPointerMove: U,
731
731
  onPointerLeave: D,
732
- onClick: U
732
+ onClick: H
733
733
  }
734
734
  };
735
735
  }
@@ -1022,32 +1022,32 @@ const rt = "all 0.5s cubic-bezier(0.22, 1, 0.36, 1)", Ut = {
1022
1022
  subtle: Kt,
1023
1023
  trace: Jt,
1024
1024
  shimmer: Zt
1025
- }, H = lt(null), kt = lt(null);
1025
+ }, F = lt(null), kt = lt(null);
1026
1026
  function nt() {
1027
- const t = Y(kt);
1027
+ const t = N(kt);
1028
1028
  if (!t) throw new Error("Must be used inside <CutoutViewer>");
1029
1029
  return t;
1030
1030
  }
1031
1031
  const Z = lt(null);
1032
1032
  function de() {
1033
- const t = Y(Z);
1033
+ const t = N(Z);
1034
1034
  if (!t)
1035
1035
  throw new Error("useCutout must be used inside <CutoutViewer.Cutout>");
1036
1036
  return t;
1037
1037
  }
1038
- function Qt({ id: t, src: r, label: n, effect: e, children: c, renderLayer: i }) {
1039
- const s = Y(H), o = nt();
1040
- if (!s)
1038
+ function Qt({ id: t, src: r, label: n, effect: e, children: l, renderLayer: s }) {
1039
+ const i = N(F), o = nt();
1040
+ if (!i)
1041
1041
  throw new Error("<CutoutViewer.Cutout> must be used inside <CutoutViewer>");
1042
- W(() => (s.registerCutout({ type: "image", id: t, src: r, label: n }), () => s.unregisterCutout(t)), [t, r, n, s]);
1043
- const l = e ? typeof e == "string" ? J[e] ?? o.effect : e : o.effect, u = o.contourMap[t] ?? null, p = V(() => {
1042
+ W(() => (i.registerCutout({ type: "image", id: t, src: r, label: n }), () => i.unregisterCutout(t)), [t, r, n, i]);
1043
+ const c = e ? typeof e == "string" ? J[e] ?? o.effect : e : o.effect, u = o.contourMap[t] ?? null, p = B(() => {
1044
1044
  if (!u) return null;
1045
- const w = o.viewportSize.width || 1, k = o.viewportSize.height || 1, b = u.map(([A, _]) => [A * w, _ * k]);
1045
+ const w = o.viewportSize.width || 1, C = o.viewportSize.height || 1, b = u.map(([R, P]) => [R * w, P * C]);
1046
1046
  return Dt(b);
1047
- }, [u, o.viewportSize.width, o.viewportSize.height]), m = o.activeId === t, v = o.hoveredId === t, x = o.selectedId === t, g = { x: 0, y: 0, w: 1, h: 1 }, y = o.boundsMap[t] ?? g;
1048
- let d, h;
1049
- !o.enabled || !o.isAnyActive && !o.showAll ? (d = l.cutoutIdle, h = l.geometryIdle) : o.showAll || m ? (d = l.cutoutActive, h = l.geometryActive) : (d = l.cutoutInactive, h = l.geometryInactive);
1050
- const f = V(
1047
+ }, [u, o.viewportSize.width, o.viewportSize.height]), m = o.activeId === t, v = o.hoveredId === t, x = o.selectedId === t, f = { x: 0, y: 0, w: 1, h: 1 }, y = o.boundsMap[t] ?? f;
1048
+ let g, h;
1049
+ !o.enabled || !o.isAnyActive && !o.showAll ? (g = c.cutoutIdle, h = c.geometryIdle) : o.showAll || m ? (g = c.cutoutActive, h = c.geometryActive) : (g = c.cutoutInactive, h = c.geometryInactive);
1050
+ const d = B(
1051
1051
  () => ({
1052
1052
  id: t,
1053
1053
  label: n,
@@ -1055,12 +1055,12 @@ function Qt({ id: t, src: r, label: n, effect: e, children: c, renderLayer: i })
1055
1055
  isActive: m,
1056
1056
  isHovered: v,
1057
1057
  isSelected: x,
1058
- effect: l
1058
+ effect: c
1059
1059
  }),
1060
- [t, n, y, m, v, x, l]
1060
+ [t, n, y, m, v, x, c]
1061
1061
  );
1062
- return /* @__PURE__ */ C.jsxs(Z.Provider, { value: f, children: [
1063
- /* @__PURE__ */ C.jsxs(
1062
+ return /* @__PURE__ */ E.jsxs(Z.Provider, { value: d, children: [
1063
+ /* @__PURE__ */ E.jsxs(
1064
1064
  "div",
1065
1065
  {
1066
1066
  "data-cutout-id": t,
@@ -1069,11 +1069,11 @@ function Qt({ id: t, src: r, label: n, effect: e, children: c, renderLayer: i })
1069
1069
  position: "absolute",
1070
1070
  inset: 0,
1071
1071
  zIndex: m ? 20 : 10,
1072
- transition: l.transition,
1073
- ...d
1072
+ transition: c.transition,
1073
+ ...g
1074
1074
  },
1075
1075
  children: [
1076
- i ? i({ isActive: m, isHovered: v, isSelected: x, bounds: y, effect: l }) : /* @__PURE__ */ C.jsx(
1076
+ s ? s({ isActive: m, isHovered: v, isSelected: x, bounds: y, effect: c }) : /* @__PURE__ */ E.jsx(
1077
1077
  "img",
1078
1078
  {
1079
1079
  src: r,
@@ -1087,7 +1087,7 @@ function Qt({ id: t, src: r, label: n, effect: e, children: c, renderLayer: i })
1087
1087
  }
1088
1088
  }
1089
1089
  ),
1090
- p && h && /* @__PURE__ */ C.jsx(
1090
+ p && h && /* @__PURE__ */ E.jsx(
1091
1091
  "svg",
1092
1092
  {
1093
1093
  viewBox: `0 0 ${o.viewportSize.width || 1} ${o.viewportSize.height || 1}`,
@@ -1100,7 +1100,7 @@ function Qt({ id: t, src: r, label: n, effect: e, children: c, renderLayer: i })
1100
1100
  overflow: "visible",
1101
1101
  filter: h.glow ? `drop-shadow(${h.glow.split(",")[0]?.trim() ?? ""})` : "none"
1102
1102
  },
1103
- children: /* @__PURE__ */ C.jsx(
1103
+ children: /* @__PURE__ */ E.jsx(
1104
1104
  "path",
1105
1105
  {
1106
1106
  d: p,
@@ -1112,7 +1112,7 @@ function Qt({ id: t, src: r, label: n, effect: e, children: c, renderLayer: i })
1112
1112
  strokeDasharray: h.strokeDasharray,
1113
1113
  pathLength: h.strokeDasharray ? 1 : void 0,
1114
1114
  style: {
1115
- transition: l.transition,
1115
+ transition: c.transition,
1116
1116
  animation: h.animation
1117
1117
  }
1118
1118
  }
@@ -1122,7 +1122,7 @@ function Qt({ id: t, src: r, label: n, effect: e, children: c, renderLayer: i })
1122
1122
  ]
1123
1123
  }
1124
1124
  ),
1125
- c
1125
+ l
1126
1126
  ] });
1127
1127
  }
1128
1128
  function mt(t) {
@@ -1134,37 +1134,37 @@ function te({
1134
1134
  bounds: r,
1135
1135
  label: n,
1136
1136
  effect: e,
1137
- children: c,
1138
- renderLayer: i
1137
+ children: l,
1138
+ renderLayer: s
1139
1139
  }) {
1140
- const s = Y(H), o = nt();
1141
- if (!s)
1140
+ const i = N(F), o = nt();
1141
+ if (!i)
1142
1142
  throw new Error(
1143
1143
  "<CutoutViewer.BBoxCutout> must be used inside <CutoutViewer>"
1144
1144
  );
1145
- const { x: l, y: u, w: p, h: m } = r;
1146
- W(() => (s.registerCutout({ type: "bbox", id: t, bounds: { x: l, y: u, w: p, h: m }, label: n }), () => s.unregisterCutout(t)), [t, l, u, p, m, n, s]);
1147
- const v = e ? typeof e == "string" ? J[e] ?? o.effect : e : o.effect, x = o.activeId === t, g = o.hoveredId === t, y = o.selectedId === t, d = { x: 0, y: 0, w: 1, h: 1 }, h = o.boundsMap[t] ?? d;
1148
- let f, w;
1149
- !o.enabled || !o.isAnyActive && !o.showAll ? (w = { ...v.cutoutIdle, filter: "none", opacity: 0 }, f = v.geometryIdle) : o.showAll || x ? (w = mt(v.cutoutActive), f = v.geometryActive) : (w = mt(v.cutoutInactive), f = v.geometryInactive);
1150
- const b = f ?? {
1145
+ const { x: c, y: u, w: p, h: m } = r;
1146
+ W(() => (i.registerCutout({ type: "bbox", id: t, bounds: { x: c, y: u, w: p, h: m }, label: n }), () => i.unregisterCutout(t)), [t, c, u, p, m, n, i]);
1147
+ const v = e ? typeof e == "string" ? J[e] ?? o.effect : e : o.effect, x = o.activeId === t, f = o.hoveredId === t, y = o.selectedId === t, g = { x: 0, y: 0, w: 1, h: 1 }, h = o.boundsMap[t] ?? g;
1148
+ let d, w;
1149
+ !o.enabled || !o.isAnyActive && !o.showAll ? (w = { ...v.cutoutIdle, filter: "none", opacity: 0 }, d = v.geometryIdle) : o.showAll || x ? (w = mt(v.cutoutActive), d = v.geometryActive) : (w = mt(v.cutoutInactive), d = v.geometryInactive);
1150
+ const b = d ?? {
1151
1151
  fill: "rgba(37, 99, 235, 0.15)",
1152
1152
  stroke: "rgba(37, 99, 235, 0.6)",
1153
1153
  strokeWidth: 2
1154
- }, A = V(
1154
+ }, R = B(
1155
1155
  () => ({
1156
1156
  id: t,
1157
1157
  label: n,
1158
1158
  bounds: h,
1159
1159
  isActive: x,
1160
- isHovered: g,
1160
+ isHovered: f,
1161
1161
  isSelected: y,
1162
1162
  effect: v
1163
1163
  }),
1164
- [t, n, h, x, g, y, v]
1164
+ [t, n, h, x, f, y, v]
1165
1165
  );
1166
- return /* @__PURE__ */ C.jsxs(Z.Provider, { value: A, children: [
1167
- /* @__PURE__ */ C.jsx(
1166
+ return /* @__PURE__ */ E.jsxs(Z.Provider, { value: R, children: [
1167
+ /* @__PURE__ */ E.jsx(
1168
1168
  "div",
1169
1169
  {
1170
1170
  "data-cutout-id": t,
@@ -1176,7 +1176,7 @@ function te({
1176
1176
  transition: v.transition,
1177
1177
  ...w
1178
1178
  },
1179
- children: i ? i({ isActive: x, isHovered: g, isSelected: y, bounds: h, effect: v }) : /* @__PURE__ */ C.jsx(
1179
+ children: s ? s({ isActive: x, isHovered: f, isSelected: y, bounds: h, effect: v }) : /* @__PURE__ */ E.jsx(
1180
1180
  "svg",
1181
1181
  {
1182
1182
  viewBox: "0 0 1 1",
@@ -1189,7 +1189,7 @@ function te({
1189
1189
  overflow: "visible",
1190
1190
  filter: b.glow ? `drop-shadow(${b.glow.split(",")[0]?.trim() ?? ""})` : "none"
1191
1191
  },
1192
- children: /* @__PURE__ */ C.jsx(
1192
+ children: /* @__PURE__ */ E.jsx(
1193
1193
  "rect",
1194
1194
  {
1195
1195
  x: h.x,
@@ -1213,7 +1213,7 @@ function te({
1213
1213
  )
1214
1214
  }
1215
1215
  ),
1216
- c
1216
+ l
1217
1217
  ] });
1218
1218
  }
1219
1219
  function vt(t) {
@@ -1225,37 +1225,37 @@ function ee({
1225
1225
  points: r,
1226
1226
  label: n,
1227
1227
  effect: e,
1228
- children: c,
1229
- renderLayer: i
1228
+ children: l,
1229
+ renderLayer: s
1230
1230
  }) {
1231
- const s = Y(H), o = nt();
1232
- if (!s)
1231
+ const i = N(F), o = nt();
1232
+ if (!i)
1233
1233
  throw new Error(
1234
1234
  "<CutoutViewer.PolygonCutout> must be used inside <CutoutViewer>"
1235
1235
  );
1236
- const l = r.flat().join(",");
1237
- W(() => (s.registerCutout({ type: "polygon", id: t, points: r, label: n }), () => s.unregisterCutout(t)), [t, l, n, s]);
1238
- const u = e ? typeof e == "string" ? J[e] ?? o.effect : e : o.effect, p = o.activeId === t, m = o.hoveredId === t, v = o.selectedId === t, x = { x: 0, y: 0, w: 1, h: 1 }, g = o.boundsMap[t] ?? x;
1239
- let y, d;
1240
- !o.enabled || !o.isAnyActive && !o.showAll ? (d = { ...u.cutoutIdle, filter: "none", opacity: 0 }, y = u.geometryIdle) : o.showAll || p ? (d = vt(u.cutoutActive), y = u.geometryActive) : (d = vt(u.cutoutInactive), y = u.geometryInactive);
1241
- const f = y ?? {
1236
+ const c = r.flat().join(",");
1237
+ W(() => (i.registerCutout({ type: "polygon", id: t, points: r, label: n }), () => i.unregisterCutout(t)), [t, c, n, i]);
1238
+ const u = e ? typeof e == "string" ? J[e] ?? o.effect : e : o.effect, p = o.activeId === t, m = o.hoveredId === t, v = o.selectedId === t, x = { x: 0, y: 0, w: 1, h: 1 }, f = o.boundsMap[t] ?? x;
1239
+ let y, g;
1240
+ !o.enabled || !o.isAnyActive && !o.showAll ? (g = { ...u.cutoutIdle, filter: "none", opacity: 0 }, y = u.geometryIdle) : o.showAll || p ? (g = vt(u.cutoutActive), y = u.geometryActive) : (g = vt(u.cutoutInactive), y = u.geometryInactive);
1241
+ const d = y ?? {
1242
1242
  fill: "rgba(37, 99, 235, 0.15)",
1243
1243
  stroke: "rgba(37, 99, 235, 0.6)",
1244
1244
  strokeWidth: 2
1245
- }, w = V(
1245
+ }, w = B(
1246
1246
  () => ({
1247
1247
  id: t,
1248
1248
  label: n,
1249
- bounds: g,
1249
+ bounds: f,
1250
1250
  isActive: p,
1251
1251
  isHovered: m,
1252
1252
  isSelected: v,
1253
1253
  effect: u
1254
1254
  }),
1255
- [t, n, g, p, m, v, u]
1255
+ [t, n, f, p, m, v, u]
1256
1256
  );
1257
- return /* @__PURE__ */ C.jsxs(Z.Provider, { value: w, children: [
1258
- /* @__PURE__ */ C.jsx(
1257
+ return /* @__PURE__ */ E.jsxs(Z.Provider, { value: w, children: [
1258
+ /* @__PURE__ */ E.jsx(
1259
1259
  "div",
1260
1260
  {
1261
1261
  "data-cutout-id": t,
@@ -1265,9 +1265,9 @@ function ee({
1265
1265
  inset: 0,
1266
1266
  zIndex: p ? 20 : 10,
1267
1267
  transition: u.transition,
1268
- ...d
1268
+ ...g
1269
1269
  },
1270
- children: i ? i({ isActive: p, isHovered: m, isSelected: v, bounds: g, effect: u }) : /* @__PURE__ */ C.jsx(
1270
+ children: s ? s({ isActive: p, isHovered: m, isSelected: v, bounds: f, effect: u }) : /* @__PURE__ */ E.jsx(
1271
1271
  "svg",
1272
1272
  {
1273
1273
  viewBox: "0 0 1 1",
@@ -1278,22 +1278,22 @@ function ee({
1278
1278
  width: "100%",
1279
1279
  height: "100%",
1280
1280
  overflow: "visible",
1281
- filter: f.glow ? `drop-shadow(${f.glow.split(",")[0]?.trim() ?? ""})` : "none"
1281
+ filter: d.glow ? `drop-shadow(${d.glow.split(",")[0]?.trim() ?? ""})` : "none"
1282
1282
  },
1283
- children: /* @__PURE__ */ C.jsx(
1283
+ children: /* @__PURE__ */ E.jsx(
1284
1284
  "polygon",
1285
1285
  {
1286
- points: r.map(([k, b]) => `${k},${b}`).join(" "),
1287
- fill: f.fill,
1288
- stroke: f.stroke,
1289
- strokeWidth: (f.strokeWidth ?? 2) * 15e-4,
1286
+ points: r.map(([C, b]) => `${C},${b}`).join(" "),
1287
+ fill: d.fill,
1288
+ stroke: d.stroke,
1289
+ strokeWidth: (d.strokeWidth ?? 2) * 15e-4,
1290
1290
  strokeLinejoin: "round",
1291
- strokeLinecap: f.strokeDasharray ? "round" : void 0,
1292
- strokeDasharray: f.strokeDasharray,
1293
- pathLength: f.strokeDasharray ? 1 : void 0,
1291
+ strokeLinecap: d.strokeDasharray ? "round" : void 0,
1292
+ strokeDasharray: d.strokeDasharray,
1293
+ pathLength: d.strokeDasharray ? 1 : void 0,
1294
1294
  style: {
1295
1295
  transition: u.transition,
1296
- animation: f.animation
1296
+ animation: d.animation
1297
1297
  }
1298
1298
  }
1299
1299
  )
@@ -1301,7 +1301,7 @@ function ee({
1301
1301
  )
1302
1302
  }
1303
1303
  ),
1304
- c
1304
+ l
1305
1305
  ] });
1306
1306
  }
1307
1307
  function wt(t) {
@@ -1313,38 +1313,38 @@ function re({
1313
1313
  center: r,
1314
1314
  radius: n,
1315
1315
  label: e,
1316
- effect: c,
1317
- children: i,
1318
- renderLayer: s
1316
+ effect: l,
1317
+ children: s,
1318
+ renderLayer: i
1319
1319
  }) {
1320
- const o = Y(H), l = nt();
1320
+ const o = N(F), c = nt();
1321
1321
  if (!o)
1322
1322
  throw new Error(
1323
1323
  "<CutoutViewer.CircleCutout> must be used inside <CutoutViewer>"
1324
1324
  );
1325
1325
  const { x: u, y: p } = r;
1326
1326
  W(() => (o.registerCutout({ type: "circle", id: t, center: { x: u, y: p }, radius: n, label: e }), () => o.unregisterCutout(t)), [t, u, p, n, e, o]);
1327
- const m = c ? typeof c == "string" ? J[c] ?? l.effect : c : l.effect, v = l.activeId === t, x = l.hoveredId === t, g = l.selectedId === t, y = { x: 0, y: 0, w: 1, h: 1 }, d = l.boundsMap[t] ?? y, h = Math.max(1, l.viewportSize.width), f = Math.max(1, l.viewportSize.height), w = Math.min(h, f), k = n * w / h, b = n * w / f;
1328
- let A, _;
1329
- !l.enabled || !l.isAnyActive && !l.showAll ? (_ = { ...m.cutoutIdle, filter: "none", opacity: 0 }, A = m.geometryIdle) : l.showAll || v ? (_ = wt(m.cutoutActive), A = m.geometryActive) : (_ = wt(m.cutoutInactive), A = m.geometryInactive);
1330
- const D = A ?? {
1327
+ const m = l ? typeof l == "string" ? J[l] ?? c.effect : l : c.effect, v = c.activeId === t, x = c.hoveredId === t, f = c.selectedId === t, y = { x: 0, y: 0, w: 1, h: 1 }, g = c.boundsMap[t] ?? y, h = Math.max(1, c.viewportSize.width), d = Math.max(1, c.viewportSize.height), w = Math.min(h, d), C = n * w / h, b = n * w / d;
1328
+ let R, P;
1329
+ !c.enabled || !c.isAnyActive && !c.showAll ? (P = { ...m.cutoutIdle, filter: "none", opacity: 0 }, R = m.geometryIdle) : c.showAll || v ? (P = wt(m.cutoutActive), R = m.geometryActive) : (P = wt(m.cutoutInactive), R = m.geometryInactive);
1330
+ const D = R ?? {
1331
1331
  fill: "rgba(37, 99, 235, 0.15)",
1332
1332
  stroke: "rgba(37, 99, 235, 0.6)",
1333
1333
  strokeWidth: 2
1334
- }, U = V(
1334
+ }, H = B(
1335
1335
  () => ({
1336
1336
  id: t,
1337
1337
  label: e,
1338
- bounds: d,
1338
+ bounds: g,
1339
1339
  isActive: v,
1340
1340
  isHovered: x,
1341
- isSelected: g,
1341
+ isSelected: f,
1342
1342
  effect: m
1343
1343
  }),
1344
- [t, e, d, v, x, g, m]
1344
+ [t, e, g, v, x, f, m]
1345
1345
  );
1346
- return /* @__PURE__ */ C.jsxs(Z.Provider, { value: U, children: [
1347
- /* @__PURE__ */ C.jsx(
1346
+ return /* @__PURE__ */ E.jsxs(Z.Provider, { value: H, children: [
1347
+ /* @__PURE__ */ E.jsx(
1348
1348
  "div",
1349
1349
  {
1350
1350
  "data-cutout-id": t,
@@ -1354,9 +1354,9 @@ function re({
1354
1354
  inset: 0,
1355
1355
  zIndex: v ? 20 : 10,
1356
1356
  transition: m.transition,
1357
- ..._
1357
+ ...P
1358
1358
  },
1359
- children: s ? s({ isActive: v, isHovered: x, isSelected: g, bounds: d, effect: m }) : /* @__PURE__ */ C.jsx(
1359
+ children: i ? i({ isActive: v, isHovered: x, isSelected: f, bounds: g, effect: m }) : /* @__PURE__ */ E.jsx(
1360
1360
  "svg",
1361
1361
  {
1362
1362
  viewBox: "0 0 1 1",
@@ -1369,12 +1369,12 @@ function re({
1369
1369
  overflow: "visible",
1370
1370
  filter: D.glow ? `drop-shadow(${D.glow.split(",")[0]?.trim() ?? ""})` : "none"
1371
1371
  },
1372
- children: /* @__PURE__ */ C.jsx(
1372
+ children: /* @__PURE__ */ E.jsx(
1373
1373
  "ellipse",
1374
1374
  {
1375
1375
  cx: r.x,
1376
1376
  cy: r.y,
1377
- rx: k,
1377
+ rx: C,
1378
1378
  ry: b,
1379
1379
  fill: D.fill,
1380
1380
  stroke: D.stroke,
@@ -1392,18 +1392,18 @@ function re({
1392
1392
  )
1393
1393
  }
1394
1394
  ),
1395
- i
1395
+ s
1396
1396
  ] });
1397
1397
  }
1398
1398
  function ne(t, r) {
1399
- const { x: n, y: e, w: c, h: i } = r;
1400
- let s, o;
1401
- t.includes("left") ? (s = `${n * 100}%`, o = "0") : t.includes("right") ? (s = `${(n + c) * 100}%`, o = "-100%") : (s = `${(n + c / 2) * 100}%`, o = "-50%");
1402
- let l, u;
1403
- return t.startsWith("top") ? (l = `${e * 100}%`, u = "-100%") : t.startsWith("bottom") ? (l = `${(e + i) * 100}%`, u = "0") : (l = `${(e + i / 2) * 100}%`, u = "-50%"), {
1399
+ const { x: n, y: e, w: l, h: s } = r;
1400
+ let i, o;
1401
+ t.includes("left") ? (i = `${n * 100}%`, o = "0") : t.includes("right") ? (i = `${(n + l) * 100}%`, o = "-100%") : (i = `${(n + l / 2) * 100}%`, o = "-50%");
1402
+ let c, u;
1403
+ return t.startsWith("top") ? (c = `${e * 100}%`, u = "-100%") : t.startsWith("bottom") ? (c = `${(e + s) * 100}%`, u = "0") : (c = `${(e + s / 2) * 100}%`, u = "-50%"), {
1404
1404
  position: "absolute",
1405
- left: s,
1406
- top: l,
1405
+ left: i,
1406
+ top: c,
1407
1407
  transform: `translate(${o}, ${u})`
1408
1408
  };
1409
1409
  }
@@ -1411,25 +1411,26 @@ function oe({
1411
1411
  placement: t = "top-center",
1412
1412
  children: r,
1413
1413
  className: n = "",
1414
- style: e
1414
+ style: e,
1415
+ showOverlay: l = void 0
1415
1416
  }) {
1416
- const c = Y(Z), i = nt();
1417
- if (!c)
1417
+ const s = N(Z), i = nt();
1418
+ if (!s)
1418
1419
  throw new Error(
1419
1420
  "<CutoutViewer.Overlay> must be used inside <CutoutViewer.Cutout>"
1420
1421
  );
1421
- const s = i.enabled && (i.showAll || c.isActive), o = ne(t, c.bounds);
1422
- return /* @__PURE__ */ C.jsx(
1422
+ const o = l ?? i.showOverlays, c = i.enabled && (i.showAll || o || s.isActive), u = ne(t, s.bounds);
1423
+ return /* @__PURE__ */ E.jsx(
1423
1424
  "div",
1424
1425
  {
1425
1426
  "data-cutout-overlay": "true",
1426
1427
  className: n,
1427
1428
  style: {
1428
1429
  zIndex: 30,
1429
- transition: c.effect.transition,
1430
- opacity: s ? 1 : 0,
1431
- pointerEvents: s ? "auto" : "none",
1432
- ...o,
1430
+ transition: s.effect.transition,
1431
+ opacity: c ? 1 : 0,
1432
+ pointerEvents: c ? "auto" : "none",
1433
+ ...u,
1433
1434
  ...e
1434
1435
  },
1435
1436
  children: r
@@ -1441,68 +1442,68 @@ function se({
1441
1442
  minPoints: r = 3,
1442
1443
  closeThreshold: n = 0.03
1443
1444
  }) {
1444
- const [e, c] = O([]), [i, s] = O(null), o = N(null), l = M(
1445
- (f, w) => {
1446
- const k = o.current;
1447
- if (!k) return null;
1448
- const b = k.getBoundingClientRect(), A = (f - b.left) / b.width, _ = (w - b.top) / b.height;
1449
- return A < 0 || A > 1 || _ < 0 || _ > 1 ? null : [A, _];
1445
+ const [e, l] = L([]), [s, i] = L(null), o = V(null), c = M(
1446
+ (d, w) => {
1447
+ const C = o.current;
1448
+ if (!C) return null;
1449
+ const b = C.getBoundingClientRect(), R = (d - b.left) / b.width, P = (w - b.top) / b.height;
1450
+ return R < 0 || R > 1 || P < 0 || P > 1 ? null : [R, P];
1450
1451
  },
1451
1452
  []
1452
1453
  ), u = M(
1453
- (f, w) => {
1454
+ (d, w) => {
1454
1455
  if (w.length < r) return !1;
1455
- const k = f[0] - w[0][0], b = f[1] - w[0][1];
1456
- return Math.sqrt(k * k + b * b) < n;
1456
+ const C = d[0] - w[0][0], b = d[1] - w[0][1];
1457
+ return Math.sqrt(C * C + b * b) < n;
1457
1458
  },
1458
1459
  [r, n]
1459
1460
  ), p = M(
1460
- (f) => {
1461
- f.length < r || (t(f), c([]), s(null));
1461
+ (d) => {
1462
+ d.length < r || (t(d), l([]), i(null));
1462
1463
  },
1463
1464
  [t, r]
1464
1465
  ), m = M(() => {
1465
- c([]), s(null);
1466
+ l([]), i(null);
1466
1467
  }, []), v = M(
1467
- (f) => {
1468
- s(l(f.clientX, f.clientY));
1468
+ (d) => {
1469
+ i(c(d.clientX, d.clientY));
1469
1470
  },
1470
- [l]
1471
+ [c]
1471
1472
  ), x = M(() => {
1472
- s(null);
1473
- }, []), g = M(
1474
- (f) => {
1475
- f.stopPropagation();
1476
- const w = l(f.clientX, f.clientY);
1477
- w && c((k) => u(w, k) ? (p(k), []) : [...k, w]);
1473
+ i(null);
1474
+ }, []), f = M(
1475
+ (d) => {
1476
+ d.stopPropagation();
1477
+ const w = c(d.clientX, d.clientY);
1478
+ w && l((C) => u(w, C) ? (p(C), []) : [...C, w]);
1478
1479
  },
1479
- [l, u, p]
1480
+ [c, u, p]
1480
1481
  ), y = M(
1481
- (f) => {
1482
- f.stopPropagation(), c((w) => {
1483
- const k = w.slice(0, -1);
1484
- return k.length >= r ? (p(k), []) : k;
1482
+ (d) => {
1483
+ d.stopPropagation(), l((w) => {
1484
+ const C = w.slice(0, -1);
1485
+ return C.length >= r ? (p(C), []) : C;
1485
1486
  });
1486
1487
  },
1487
1488
  [r, p]
1488
- ), d = M(
1489
- (f) => {
1490
- f.preventDefault(), c((w) => w.slice(0, -1));
1489
+ ), g = M(
1490
+ (d) => {
1491
+ d.preventDefault(), l((w) => w.slice(0, -1));
1491
1492
  },
1492
1493
  []
1493
- ), h = i !== null && u(i, e);
1494
+ ), h = s !== null && u(s, e);
1494
1495
  return {
1495
1496
  points: e,
1496
- previewPoint: i,
1497
+ previewPoint: s,
1497
1498
  willClose: h,
1498
1499
  reset: m,
1499
1500
  containerRef: o,
1500
1501
  containerProps: {
1501
1502
  onPointerMove: v,
1502
1503
  onPointerLeave: x,
1503
- onClick: g,
1504
+ onClick: f,
1504
1505
  onDoubleClick: y,
1505
- onContextMenu: d
1506
+ onContextMenu: g
1506
1507
  }
1507
1508
  };
1508
1509
  }
@@ -1511,16 +1512,16 @@ function ie({
1511
1512
  minPoints: r = 3,
1512
1513
  closeThreshold: n = 0.03,
1513
1514
  strokeColor: e = "#3b82f6",
1514
- enabled: c = !0,
1515
- style: i,
1516
- className: s = ""
1515
+ enabled: l = !0,
1516
+ style: s,
1517
+ className: i = ""
1517
1518
  }) {
1518
- if (!Y(H))
1519
+ if (!N(F))
1519
1520
  throw new Error(
1520
1521
  "<CutoutViewer.DrawPolygon> must be used inside <CutoutViewer>"
1521
1522
  );
1522
1523
  const {
1523
- points: l,
1524
+ points: c,
1524
1525
  previewPoint: u,
1525
1526
  willClose: p,
1526
1527
  reset: m,
@@ -1528,30 +1529,30 @@ function ie({
1528
1529
  containerProps: x
1529
1530
  } = se({ onComplete: t, minPoints: r, closeThreshold: n });
1530
1531
  W(() => {
1531
- function d(h) {
1532
+ function g(h) {
1532
1533
  h.key === "Escape" && m();
1533
1534
  }
1534
- return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
1535
+ return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
1535
1536
  }, [m]), W(() => {
1536
- c || m();
1537
- }, [c, m]);
1538
- const g = u ? [...l, u] : l, y = g.map(([d, h]) => `${d},${h}`).join(" ");
1539
- return /* @__PURE__ */ C.jsx(
1537
+ l || m();
1538
+ }, [l, m]);
1539
+ const f = u ? [...c, u] : c, y = f.map(([g, h]) => `${g},${h}`).join(" ");
1540
+ return /* @__PURE__ */ E.jsx(
1540
1541
  "div",
1541
1542
  {
1542
1543
  ref: v,
1543
1544
  "data-draw-polygon": "true",
1544
- className: s,
1545
+ className: i,
1545
1546
  style: {
1546
1547
  position: "absolute",
1547
1548
  inset: 0,
1548
- cursor: c ? p ? "cell" : "crosshair" : "default",
1549
+ cursor: l ? p ? "cell" : "crosshair" : "default",
1549
1550
  zIndex: 30,
1550
- pointerEvents: c ? "auto" : "none",
1551
- ...i
1551
+ pointerEvents: l ? "auto" : "none",
1552
+ ...s
1552
1553
  },
1553
- ...c ? x : {},
1554
- children: l.length > 0 && /* @__PURE__ */ C.jsxs(
1554
+ ...l ? x : {},
1555
+ children: c.length > 0 && /* @__PURE__ */ E.jsxs(
1555
1556
  "svg",
1556
1557
  {
1557
1558
  viewBox: "0 0 1 1",
@@ -1565,16 +1566,16 @@ function ie({
1565
1566
  pointerEvents: "none"
1566
1567
  },
1567
1568
  children: [
1568
- l.length >= 3 && /* @__PURE__ */ C.jsx(
1569
+ c.length >= 3 && /* @__PURE__ */ E.jsx(
1569
1570
  "polygon",
1570
1571
  {
1571
- points: l.map(([d, h]) => `${d},${h}`).join(" "),
1572
+ points: c.map(([g, h]) => `${g},${h}`).join(" "),
1572
1573
  fill: e,
1573
1574
  fillOpacity: 0.15,
1574
1575
  stroke: "none"
1575
1576
  }
1576
1577
  ),
1577
- g.length >= 2 && /* @__PURE__ */ C.jsx(
1578
+ f.length >= 2 && /* @__PURE__ */ E.jsx(
1578
1579
  "polyline",
1579
1580
  {
1580
1581
  points: y,
@@ -1586,13 +1587,13 @@ function ie({
1586
1587
  strokeDasharray: u ? "0.015 0.008" : void 0
1587
1588
  }
1588
1589
  ),
1589
- u && l.length >= 1 && /* @__PURE__ */ C.jsx(
1590
+ u && c.length >= 1 && /* @__PURE__ */ E.jsx(
1590
1591
  "line",
1591
1592
  {
1592
1593
  x1: u[0],
1593
1594
  y1: u[1],
1594
- x2: l[0][0],
1595
- y2: l[0][1],
1595
+ x2: c[0][0],
1596
+ y2: c[0][1],
1596
1597
  stroke: e,
1597
1598
  strokeWidth: 2e-3,
1598
1599
  strokeDasharray: "0.015 0.008",
@@ -1600,19 +1601,19 @@ function ie({
1600
1601
  opacity: p ? 0.9 : 0.35
1601
1602
  }
1602
1603
  ),
1603
- l.map(([d, h], f) => /* @__PURE__ */ C.jsx(
1604
+ c.map(([g, h], d) => /* @__PURE__ */ E.jsx(
1604
1605
  "circle",
1605
1606
  {
1606
- cx: d,
1607
+ cx: g,
1607
1608
  cy: h,
1608
- r: f === 0 ? 0.012 : 7e-3,
1609
- fill: f === 0 && p ? e : "white",
1609
+ r: d === 0 ? 0.012 : 7e-3,
1610
+ fill: d === 0 && p ? e : "white",
1610
1611
  stroke: e,
1611
1612
  strokeWidth: 2e-3
1612
1613
  },
1613
- f
1614
+ d
1614
1615
  )),
1615
- u && /* @__PURE__ */ C.jsx(
1616
+ u && /* @__PURE__ */ E.jsx(
1616
1617
  "circle",
1617
1618
  {
1618
1619
  cx: u[0],
@@ -1634,64 +1635,64 @@ function ae({
1634
1635
  onComplete: t,
1635
1636
  minSize: r = 0.01
1636
1637
  }) {
1637
- const [n, e] = O(null), [c, i] = O(null), s = N(null), o = M(
1638
- (g, y) => {
1639
- const d = s.current;
1640
- if (!d) return null;
1641
- const h = d.getBoundingClientRect(), f = (g - h.left) / h.width, w = (y - h.top) / h.height;
1638
+ const [n, e] = L(null), [l, s] = L(null), i = V(null), o = M(
1639
+ (f, y) => {
1640
+ const g = i.current;
1641
+ if (!g) return null;
1642
+ const h = g.getBoundingClientRect(), d = (f - h.left) / h.width, w = (y - h.top) / h.height;
1642
1643
  return {
1643
- x: Math.max(0, Math.min(1, f)),
1644
+ x: Math.max(0, Math.min(1, d)),
1644
1645
  y: Math.max(0, Math.min(1, w))
1645
1646
  };
1646
1647
  },
1647
1648
  []
1648
- ), l = M(
1649
- (g, y) => {
1650
- const d = Math.min(g.x, y.x), h = Math.min(g.y, y.y), f = Math.abs(y.x - g.x), w = Math.abs(y.y - g.y);
1651
- return { x: d, y: h, w: f, h: w };
1649
+ ), c = M(
1650
+ (f, y) => {
1651
+ const g = Math.min(f.x, y.x), h = Math.min(f.y, y.y), d = Math.abs(y.x - f.x), w = Math.abs(y.y - f.y);
1652
+ return { x: g, y: h, w: d, h: w };
1652
1653
  },
1653
1654
  []
1654
1655
  ), u = M(() => {
1655
- e(null), i(null);
1656
+ e(null), s(null);
1656
1657
  }, []);
1657
1658
  W(() => {
1658
- function g(y) {
1659
+ function f(y) {
1659
1660
  y.key === "Escape" && u();
1660
1661
  }
1661
- return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
1662
+ return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
1662
1663
  }, [u]);
1663
1664
  const p = M(
1664
- (g) => {
1665
- g.currentTarget.setPointerCapture(g.pointerId);
1666
- const y = o(g.clientX, g.clientY);
1667
- y && (e(y), i({ x: y.x, y: y.y, w: 0, h: 0 }));
1665
+ (f) => {
1666
+ f.currentTarget.setPointerCapture(f.pointerId);
1667
+ const y = o(f.clientX, f.clientY);
1668
+ y && (e(y), s({ x: y.x, y: y.y, w: 0, h: 0 }));
1668
1669
  },
1669
1670
  [o]
1670
1671
  ), m = M(
1671
- (g) => {
1672
+ (f) => {
1672
1673
  if (!n) return;
1673
- const y = o(g.clientX, g.clientY);
1674
- y && i(l(n, y));
1674
+ const y = o(f.clientX, f.clientY);
1675
+ y && s(c(n, y));
1675
1676
  },
1676
- [n, o, l]
1677
+ [n, o, c]
1677
1678
  ), v = M(
1678
- (g) => {
1679
+ (f) => {
1679
1680
  if (!n) return;
1680
- const y = o(g.clientX, g.clientY);
1681
+ const y = o(f.clientX, f.clientY);
1681
1682
  if (y) {
1682
- const d = l(n, y);
1683
- d.w >= r && d.h >= r && t(d);
1683
+ const g = c(n, y);
1684
+ g.w >= r && g.h >= r && t(g);
1684
1685
  }
1685
- e(null), i(null);
1686
+ e(null), s(null);
1686
1687
  },
1687
- [n, o, l, r, t]
1688
+ [n, o, c, r, t]
1688
1689
  ), x = M(() => {
1689
1690
  }, []);
1690
1691
  return {
1691
- rect: c,
1692
+ rect: l,
1692
1693
  isDragging: n !== null,
1693
1694
  reset: u,
1694
- containerRef: s,
1695
+ containerRef: i,
1695
1696
  containerProps: {
1696
1697
  onPointerDown: p,
1697
1698
  onPointerMove: m,
@@ -1705,35 +1706,35 @@ function ce({
1705
1706
  minSize: r,
1706
1707
  strokeColor: n = "#3b82f6",
1707
1708
  enabled: e = !0,
1708
- style: c,
1709
- className: i = ""
1709
+ style: l,
1710
+ className: s = ""
1710
1711
  }) {
1711
- if (!Y(H))
1712
+ if (!N(F))
1712
1713
  throw new Error(
1713
1714
  "<CutoutViewer.DrawRectangle> must be used inside <CutoutViewer>"
1714
1715
  );
1715
- const { rect: o, reset: l, containerRef: u, containerProps: p } = ae({
1716
+ const { rect: o, reset: c, containerRef: u, containerProps: p } = ae({
1716
1717
  onComplete: t,
1717
1718
  minSize: r
1718
1719
  });
1719
1720
  return W(() => {
1720
- e || l();
1721
- }, [e, l]), /* @__PURE__ */ C.jsx(
1721
+ e || c();
1722
+ }, [e, c]), /* @__PURE__ */ E.jsx(
1722
1723
  "div",
1723
1724
  {
1724
1725
  ref: u,
1725
1726
  "data-draw-rectangle": "true",
1726
- className: i,
1727
+ className: s,
1727
1728
  style: {
1728
1729
  position: "absolute",
1729
1730
  inset: 0,
1730
1731
  cursor: e ? "crosshair" : "default",
1731
1732
  zIndex: 30,
1732
1733
  pointerEvents: e ? "auto" : "none",
1733
- ...c
1734
+ ...l
1734
1735
  },
1735
1736
  ...e ? p : {},
1736
- children: o && o.w > 0 && o.h > 0 && /* @__PURE__ */ C.jsx(
1737
+ children: o && o.w > 0 && o.h > 0 && /* @__PURE__ */ E.jsx(
1737
1738
  "svg",
1738
1739
  {
1739
1740
  viewBox: "0 0 1 1",
@@ -1746,7 +1747,7 @@ function ce({
1746
1747
  overflow: "visible",
1747
1748
  pointerEvents: "none"
1748
1749
  },
1749
- children: /* @__PURE__ */ C.jsx(
1750
+ children: /* @__PURE__ */ E.jsx(
1750
1751
  "rect",
1751
1752
  {
1752
1753
  x: o.x,
@@ -1771,86 +1772,86 @@ function le({
1771
1772
  onComplete: t,
1772
1773
  minRadius: r = 0.01
1773
1774
  }) {
1774
- const [n, e] = O(null), [c, i] = O(null), [s, o] = O({ width: 1, height: 1 }), l = N(null);
1775
+ const [n, e] = L(null), [l, s] = L(null), [i, o] = L({ width: 1, height: 1 }), c = V(null);
1775
1776
  W(() => {
1776
- const d = l.current;
1777
- if (!d) return;
1777
+ const g = c.current;
1778
+ if (!g) return;
1778
1779
  const h = () => {
1779
- const w = d.getBoundingClientRect();
1780
+ const w = g.getBoundingClientRect();
1780
1781
  o({
1781
1782
  width: Math.max(1, w.width),
1782
1783
  height: Math.max(1, w.height)
1783
1784
  });
1784
1785
  };
1785
1786
  h();
1786
- const f = new ResizeObserver(h);
1787
- return f.observe(d), () => f.disconnect();
1787
+ const d = new ResizeObserver(h);
1788
+ return d.observe(g), () => d.disconnect();
1788
1789
  }, []);
1789
1790
  const u = M(
1790
- (d, h) => {
1791
- const f = l.current;
1792
- if (!f) return null;
1793
- const w = f.getBoundingClientRect(), k = (d - w.left) / w.width, b = (h - w.top) / w.height;
1791
+ (g, h) => {
1792
+ const d = c.current;
1793
+ if (!d) return null;
1794
+ const w = d.getBoundingClientRect(), C = (g - w.left) / w.width, b = (h - w.top) / w.height;
1794
1795
  return {
1795
- x: Math.max(0, Math.min(1, k)),
1796
+ x: Math.max(0, Math.min(1, C)),
1796
1797
  y: Math.max(0, Math.min(1, b))
1797
1798
  };
1798
1799
  },
1799
1800
  []
1800
1801
  ), p = M(
1801
- (d, h) => {
1802
- const f = (d.x - h.x) * s.width, w = (d.y - h.y) * s.height, k = Math.sqrt(f * f + w * w), b = Math.min(s.width, s.height);
1803
- return k / b;
1802
+ (g, h) => {
1803
+ const d = (g.x - h.x) * i.width, w = (g.y - h.y) * i.height, C = Math.sqrt(d * d + w * w), b = Math.min(i.width, i.height);
1804
+ return C / b;
1804
1805
  },
1805
- [s.height, s.width]
1806
+ [i.height, i.width]
1806
1807
  ), m = M(() => {
1807
- e(null), i(null);
1808
+ e(null), s(null);
1808
1809
  }, []);
1809
1810
  W(() => {
1810
- function d(h) {
1811
+ function g(h) {
1811
1812
  h.key === "Escape" && m();
1812
1813
  }
1813
- return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
1814
+ return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
1814
1815
  }, [m]);
1815
1816
  const v = M(
1816
- (d) => {
1817
- d.currentTarget.setPointerCapture(d.pointerId);
1818
- const h = u(d.clientX, d.clientY);
1819
- h && (e(h), i({ center: h, radius: 0 }));
1817
+ (g) => {
1818
+ g.currentTarget.setPointerCapture(g.pointerId);
1819
+ const h = u(g.clientX, g.clientY);
1820
+ h && (e(h), s({ center: h, radius: 0 }));
1820
1821
  },
1821
1822
  [u]
1822
1823
  ), x = M(
1823
- (d) => {
1824
+ (g) => {
1824
1825
  if (!n) return;
1825
- const h = u(d.clientX, d.clientY);
1826
+ const h = u(g.clientX, g.clientY);
1826
1827
  if (!h) return;
1827
- const f = p(h, n);
1828
- i({ center: n, radius: f });
1828
+ const d = p(h, n);
1829
+ s({ center: n, radius: d });
1829
1830
  },
1830
1831
  [n, u, p]
1831
- ), g = M(
1832
- (d) => {
1832
+ ), f = M(
1833
+ (g) => {
1833
1834
  if (!n) return;
1834
- const h = u(d.clientX, d.clientY);
1835
+ const h = u(g.clientX, g.clientY);
1835
1836
  if (h) {
1836
- const f = p(h, n);
1837
- f >= r && t({ center: n, radius: f });
1837
+ const d = p(h, n);
1838
+ d >= r && t({ center: n, radius: d });
1838
1839
  }
1839
- e(null), i(null);
1840
+ e(null), s(null);
1840
1841
  },
1841
1842
  [n, u, p, r, t]
1842
1843
  ), y = M(() => {
1843
1844
  }, []);
1844
1845
  return {
1845
- circle: c,
1846
- viewportSize: s,
1846
+ circle: l,
1847
+ viewportSize: i,
1847
1848
  isDragging: n !== null,
1848
1849
  reset: m,
1849
- containerRef: l,
1850
+ containerRef: c,
1850
1851
  containerProps: {
1851
1852
  onPointerDown: v,
1852
1853
  onPointerMove: x,
1853
- onPointerUp: g,
1854
+ onPointerUp: f,
1854
1855
  onPointerLeave: y
1855
1856
  }
1856
1857
  };
@@ -1860,35 +1861,35 @@ function ue({
1860
1861
  minRadius: r,
1861
1862
  strokeColor: n = "#3b82f6",
1862
1863
  enabled: e = !0,
1863
- style: c,
1864
- className: i = ""
1864
+ style: l,
1865
+ className: s = ""
1865
1866
  }) {
1866
- if (!Y(H))
1867
+ if (!N(F))
1867
1868
  throw new Error(
1868
1869
  "<CutoutViewer.DrawCircle> must be used inside <CutoutViewer>"
1869
1870
  );
1870
- const { circle: o, viewportSize: l, reset: u, containerRef: p, containerProps: m } = le({
1871
+ const { circle: o, viewportSize: c, reset: u, containerRef: p, containerProps: m } = le({
1871
1872
  onComplete: t,
1872
1873
  minRadius: r
1873
- }), v = Math.max(1, l.width), x = Math.max(1, l.height), g = Math.min(v, x);
1874
+ }), v = Math.max(1, c.width), x = Math.max(1, c.height), f = Math.min(v, x);
1874
1875
  return W(() => {
1875
1876
  e || u();
1876
- }, [e, u]), /* @__PURE__ */ C.jsx(
1877
+ }, [e, u]), /* @__PURE__ */ E.jsx(
1877
1878
  "div",
1878
1879
  {
1879
1880
  ref: p,
1880
1881
  "data-draw-circle": "true",
1881
- className: i,
1882
+ className: s,
1882
1883
  style: {
1883
1884
  position: "absolute",
1884
1885
  inset: 0,
1885
1886
  cursor: e ? "crosshair" : "default",
1886
1887
  zIndex: 30,
1887
1888
  pointerEvents: e ? "auto" : "none",
1888
- ...c
1889
+ ...l
1889
1890
  },
1890
1891
  ...e ? m : {},
1891
- children: o && o.radius > 0 && /* @__PURE__ */ C.jsx(
1892
+ children: o && o.radius > 0 && /* @__PURE__ */ E.jsx(
1892
1893
  "svg",
1893
1894
  {
1894
1895
  viewBox: "0 0 1 1",
@@ -1901,13 +1902,13 @@ function ue({
1901
1902
  overflow: "visible",
1902
1903
  pointerEvents: "none"
1903
1904
  },
1904
- children: /* @__PURE__ */ C.jsx(
1905
+ children: /* @__PURE__ */ E.jsx(
1905
1906
  "ellipse",
1906
1907
  {
1907
1908
  cx: o.center.x,
1908
1909
  cy: o.center.y,
1909
- rx: o.radius * g / v,
1910
- ry: o.radius * g / x,
1910
+ rx: o.radius * f / v,
1911
+ ry: o.radius * f / x,
1911
1912
  fill: n,
1912
1913
  fillOpacity: 0.15,
1913
1914
  stroke: n,
@@ -1938,78 +1939,80 @@ function he({
1938
1939
  mainImageAlt: r = "Main image",
1939
1940
  effect: n = "elevate",
1940
1941
  enabled: e = !0,
1941
- showAll: c = !1,
1942
+ showAll: l = !1,
1943
+ showOverlays: s = !1,
1942
1944
  alphaThreshold: i = 30,
1943
- hoverLeaveDelay: s = 150,
1944
- children: o,
1945
- className: l = "",
1946
- style: u,
1947
- onHover: p,
1948
- onActiveChange: m,
1949
- onSelect: v
1945
+ hoverLeaveDelay: o = 150,
1946
+ children: c,
1947
+ className: u = "",
1948
+ style: p,
1949
+ onHover: m,
1950
+ onActiveChange: v,
1951
+ onSelect: x
1950
1952
  }) {
1951
- const x = typeof n == "string" ? J[n] ?? J.elevate : n;
1953
+ const f = typeof n == "string" ? J[n] ?? J.elevate : n;
1952
1954
  W(() => {
1953
- Xt(x);
1954
- }, [x]);
1955
- const [g, y] = O(() => /* @__PURE__ */ new Map()), d = M(
1956
- (I) => {
1957
- y((z) => {
1958
- const L = z.get(I.id);
1959
- if (L && xt(L) === xt(I))
1955
+ Xt(f);
1956
+ }, [f]);
1957
+ const [y, g] = L(() => /* @__PURE__ */ new Map()), h = M(
1958
+ (O) => {
1959
+ g((z) => {
1960
+ const Y = z.get(O.id);
1961
+ if (Y && xt(Y) === xt(O))
1960
1962
  return z;
1961
- const G = new Map(z);
1962
- return G.set(I.id, I), G;
1963
+ const a = new Map(z);
1964
+ return a.set(O.id, O), a;
1963
1965
  });
1964
1966
  },
1965
1967
  []
1966
- ), h = M((I) => {
1967
- y((z) => {
1968
- if (!z.has(I)) return z;
1969
- const L = new Map(z);
1970
- return L.delete(I), L;
1968
+ ), d = M((O) => {
1969
+ g((z) => {
1970
+ if (!z.has(O)) return z;
1971
+ const Y = new Map(z);
1972
+ return Y.delete(O), Y;
1971
1973
  });
1972
- }, []), f = V(
1973
- () => ({ registerCutout: d, unregisterCutout: h }),
1974
- [d, h]
1975
- ), w = V(() => Array.from(g.values()), [g]), { activeId: k, selectedId: b, hoveredId: A, viewportSize: _, boundsMap: X, contourMap: D, containerRef: U, containerProps: Q } = Ft(w, e, i, s), B = N(null), q = N(null), S = N(null);
1974
+ }, []), w = B(
1975
+ () => ({ registerCutout: h, unregisterCutout: d }),
1976
+ [h, d]
1977
+ ), C = B(() => Array.from(y.values()), [y]), { activeId: b, selectedId: R, hoveredId: P, viewportSize: U, boundsMap: D, contourMap: H, containerRef: Q, containerProps: q } = Ft(C, e, i, o), G = V(null), j = V(null), A = V(null);
1976
1978
  W(() => {
1977
- A !== B.current && (B.current = A, p?.(A));
1978
- }, [A, p]), W(() => {
1979
- k !== q.current && (q.current = k, m?.(k));
1980
- }, [k, m]), W(() => {
1981
- b !== S.current && (S.current = b, v?.(b));
1982
- }, [b, v]);
1983
- const R = c || k !== null, P = V(
1979
+ P !== G.current && (G.current = P, m?.(P));
1980
+ }, [P, m]), W(() => {
1981
+ b !== j.current && (j.current = b, v?.(b));
1982
+ }, [b, v]), W(() => {
1983
+ R !== A.current && (A.current = R, x?.(R));
1984
+ }, [R, x]);
1985
+ const I = l || b !== null, S = B(
1984
1986
  () => ({
1985
- activeId: k,
1986
- selectedId: b,
1987
- hoveredId: A,
1988
- viewportSize: _,
1989
- effect: x,
1987
+ activeId: b,
1988
+ selectedId: R,
1989
+ hoveredId: P,
1990
+ viewportSize: U,
1991
+ effect: f,
1990
1992
  enabled: e,
1991
- showAll: c,
1992
- boundsMap: X,
1993
- contourMap: D,
1994
- isAnyActive: R
1993
+ showAll: l,
1994
+ showOverlays: s,
1995
+ boundsMap: D,
1996
+ contourMap: H,
1997
+ isAnyActive: I
1995
1998
  }),
1996
- [k, b, A, _, x, e, c, X, D, R]
1999
+ [b, R, P, U, f, e, l, s, D, H, I]
1997
2000
  );
1998
- return /* @__PURE__ */ C.jsx(H.Provider, { value: f, children: /* @__PURE__ */ C.jsx(kt.Provider, { value: P, children: /* @__PURE__ */ C.jsxs(
2001
+ return /* @__PURE__ */ E.jsx(F.Provider, { value: w, children: /* @__PURE__ */ E.jsx(kt.Provider, { value: S, children: /* @__PURE__ */ E.jsxs(
1999
2002
  "div",
2000
2003
  {
2001
- ref: U,
2002
- className: l,
2004
+ ref: Q,
2005
+ className: u,
2003
2006
  style: {
2004
2007
  position: "relative",
2005
2008
  width: "100%",
2006
2009
  overflow: "hidden",
2007
- cursor: R && e ? "pointer" : "default",
2008
- ...u
2010
+ cursor: I && e ? "pointer" : "default",
2011
+ ...p
2009
2012
  },
2010
- ...Q,
2013
+ ...q,
2011
2014
  children: [
2012
- /* @__PURE__ */ C.jsx(
2015
+ /* @__PURE__ */ E.jsx(
2013
2016
  "img",
2014
2017
  {
2015
2018
  src: t,
@@ -2020,46 +2023,46 @@ function he({
2020
2023
  width: "100%",
2021
2024
  height: "auto",
2022
2025
  userSelect: "none",
2023
- transition: x.transition,
2024
- ...R && e ? x.mainImageHovered : {}
2026
+ transition: f.transition,
2027
+ ...I && e ? f.mainImageHovered : {}
2025
2028
  }
2026
2029
  }
2027
2030
  ),
2028
- /* @__PURE__ */ C.jsx(
2031
+ /* @__PURE__ */ E.jsx(
2029
2032
  "div",
2030
2033
  {
2031
2034
  style: {
2032
2035
  pointerEvents: "none",
2033
2036
  position: "absolute",
2034
2037
  inset: 0,
2035
- transition: x.transition,
2036
- opacity: R && e ? 1 : 0,
2037
- ...x.vignetteStyle
2038
+ transition: f.transition,
2039
+ opacity: I && e ? 1 : 0,
2040
+ ...f.vignetteStyle
2038
2041
  }
2039
2042
  }
2040
2043
  ),
2041
- o
2044
+ c
2042
2045
  ]
2043
2046
  }
2044
2047
  ) }) });
2045
2048
  }
2046
- const F = he;
2047
- F.Cutout = Qt;
2048
- F.BBoxCutout = te;
2049
- F.PolygonCutout = ee;
2050
- F.CircleCutout = re;
2051
- F.Overlay = oe;
2052
- F.DrawPolygon = ie;
2053
- F.DrawRectangle = ce;
2054
- F.DrawCircle = ue;
2049
+ const X = he;
2050
+ X.Cutout = Qt;
2051
+ X.BBoxCutout = te;
2052
+ X.PolygonCutout = ee;
2053
+ X.CircleCutout = re;
2054
+ X.Overlay = oe;
2055
+ X.DrawPolygon = ie;
2056
+ X.DrawRectangle = ce;
2057
+ X.DrawCircle = ue;
2055
2058
  export {
2056
2059
  Vt as CircleHitTestStrategy,
2057
2060
  oe as CutoutOverlay,
2058
- F as CutoutViewer,
2061
+ X as CutoutViewer,
2059
2062
  ue as DrawCircle,
2060
2063
  ie as DrawPolygon,
2061
2064
  ce as DrawRectangle,
2062
- Ot as ImageHitTestStrategy,
2065
+ zt as ImageHitTestStrategy,
2063
2066
  Nt as PolygonHitTestStrategy,
2064
2067
  Lt as RectHitTestStrategy,
2065
2068
  Bt as createHitTestStrategy,