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/README.md +1 -0
- package/dist/components/cutout-viewer/cutout-viewer.d.ts +2 -0
- package/dist/components/cutout-viewer/cutouts/cutout-overlay.d.ts +3 -1
- package/dist/components/cutout-viewer/viewer-context.d.ts +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +578 -575
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import Ct, { useState as
|
|
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,
|
|
9
|
-
var
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
for (var o in
|
|
13
|
-
o !== "key" && (
|
|
14
|
-
} else
|
|
15
|
-
return
|
|
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:
|
|
19
|
-
ref:
|
|
20
|
-
props:
|
|
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
|
|
35
|
+
case g:
|
|
36
36
|
return "Fragment";
|
|
37
|
-
case
|
|
37
|
+
case d:
|
|
38
38
|
return "Profiler";
|
|
39
39
|
case h:
|
|
40
40
|
return "StrictMode";
|
|
41
|
-
case
|
|
41
|
+
case R:
|
|
42
42
|
return "Suspense";
|
|
43
|
-
case
|
|
43
|
+
case P:
|
|
44
44
|
return "SuspenseList";
|
|
45
|
-
case
|
|
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
|
|
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
|
|
60
|
-
return a = a.displayName, a || (a =
|
|
61
|
-
case
|
|
62
|
-
return
|
|
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
|
-
|
|
64
|
+
k = a._payload, a = a._init;
|
|
65
65
|
try {
|
|
66
|
-
return t(a(
|
|
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
|
|
78
|
+
var k = !1;
|
|
79
79
|
} catch {
|
|
80
|
-
|
|
80
|
+
k = !0;
|
|
81
81
|
}
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
return
|
|
86
|
-
|
|
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 ===
|
|
93
|
+
if (a === g) return "<>";
|
|
94
94
|
if (typeof a == "object" && a !== null && a.$$typeof === D)
|
|
95
95
|
return "<...>";
|
|
96
96
|
try {
|
|
97
|
-
var
|
|
98
|
-
return
|
|
97
|
+
var k = t(a);
|
|
98
|
+
return k ? "<" + k + ">" : "<...>";
|
|
99
99
|
} catch {
|
|
100
100
|
return "<...>";
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
var a =
|
|
103
|
+
function l() {
|
|
104
|
+
var a = q.A;
|
|
105
105
|
return a === null ? null : a.getOwner();
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function s() {
|
|
108
108
|
return Error("react-stack-top-frame");
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (
|
|
112
|
-
var
|
|
113
|
-
if (
|
|
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,
|
|
118
|
-
function
|
|
119
|
-
|
|
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
|
-
|
|
121
|
+
k
|
|
122
122
|
));
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
get:
|
|
124
|
+
_.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
125
|
+
get: _,
|
|
126
126
|
configurable: !0
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function c() {
|
|
130
130
|
var a = t(this.type);
|
|
131
|
-
return
|
|
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,
|
|
136
|
-
var T =
|
|
135
|
+
function u(a, k, _, $, ot, it) {
|
|
136
|
+
var T = _.ref;
|
|
137
137
|
return a = {
|
|
138
|
-
$$typeof:
|
|
138
|
+
$$typeof: f,
|
|
139
139
|
type: a,
|
|
140
|
-
key:
|
|
141
|
-
props:
|
|
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:
|
|
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,
|
|
169
|
-
var T =
|
|
168
|
+
function p(a, k, _, $, ot, it) {
|
|
169
|
+
var T = k.children;
|
|
170
170
|
if (T !== void 0)
|
|
171
171
|
if ($)
|
|
172
|
-
if (
|
|
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 (
|
|
181
|
+
if (G.call(k, "key")) {
|
|
182
182
|
T = t(a);
|
|
183
|
-
var K = Object.keys(
|
|
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}",
|
|
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
|
-
),
|
|
197
|
+
), Y[T + $] = !0);
|
|
198
198
|
}
|
|
199
|
-
if (T = null,
|
|
200
|
-
|
|
201
|
-
for (var at in
|
|
202
|
-
at !== "key" && (
|
|
203
|
-
} else
|
|
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
|
-
|
|
205
|
+
_,
|
|
206
206
|
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
207
207
|
), u(
|
|
208
208
|
a,
|
|
209
209
|
T,
|
|
210
|
-
|
|
211
|
-
|
|
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 ===
|
|
220
|
+
return typeof a == "object" && a !== null && a.$$typeof === f;
|
|
221
221
|
}
|
|
222
|
-
var x = Ct,
|
|
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
|
|
230
|
+
var I, S = {}, O = x.react_stack_bottom_frame.bind(
|
|
231
231
|
x,
|
|
232
|
-
|
|
233
|
-
)(),
|
|
234
|
-
et.Fragment =
|
|
235
|
-
var $ = 1e4 >
|
|
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
|
-
|
|
239
|
-
|
|
238
|
+
k,
|
|
239
|
+
_,
|
|
240
240
|
!1,
|
|
241
|
-
$ ? Error("react-stack-top-frame") :
|
|
242
|
-
$ ?
|
|
241
|
+
$ ? Error("react-stack-top-frame") : O,
|
|
242
|
+
$ ? A(e(a)) : z
|
|
243
243
|
);
|
|
244
|
-
}, et.jsxs = function(a,
|
|
245
|
-
var $ = 1e4 >
|
|
244
|
+
}, et.jsxs = function(a, k, _) {
|
|
245
|
+
var $ = 1e4 > q.recentlyCreatedOwnerStacks++;
|
|
246
246
|
return p(
|
|
247
247
|
a,
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
k,
|
|
249
|
+
_,
|
|
250
250
|
!0,
|
|
251
|
-
$ ? Error("react-stack-top-frame") :
|
|
252
|
-
$ ?
|
|
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
|
|
261
|
+
var E = Rt();
|
|
262
262
|
const At = 400;
|
|
263
263
|
function Pt(t, r, n) {
|
|
264
|
-
const e = n[0] - r[0],
|
|
265
|
-
if (
|
|
266
|
-
const o = t[0] - r[0],
|
|
267
|
-
return Math.sqrt(o * o +
|
|
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]) -
|
|
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
|
|
275
|
-
for (let
|
|
276
|
-
const o = Pt(t[
|
|
277
|
-
o > n && (n = o, e =
|
|
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
|
|
281
|
-
return
|
|
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 [
|
|
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 [
|
|
290
|
-
r +=
|
|
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
|
|
335
|
-
for (let
|
|
336
|
-
for (let
|
|
337
|
-
const o = t[
|
|
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),
|
|
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
|
|
344
|
-
return [
|
|
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
|
|
348
|
-
return [
|
|
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
|
|
352
|
-
return [
|
|
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
|
|
356
|
-
return [
|
|
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 [
|
|
359
|
+
return [i + 0.5, s + 0.5];
|
|
360
360
|
}
|
|
361
361
|
};
|
|
362
|
-
for (const [x,
|
|
363
|
-
|
|
362
|
+
for (const [x, f] of jt[m])
|
|
363
|
+
l.push([v(x), v(f)]);
|
|
364
364
|
}
|
|
365
|
-
return
|
|
365
|
+
return l;
|
|
366
366
|
}
|
|
367
367
|
function $t(t) {
|
|
368
368
|
if (t.length === 0) return [];
|
|
369
|
-
const r = (
|
|
370
|
-
for (let
|
|
371
|
-
for (const
|
|
372
|
-
const o = r(t[
|
|
373
|
-
let
|
|
374
|
-
|
|
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),
|
|
377
|
-
for (let
|
|
378
|
-
if (e[
|
|
379
|
-
const
|
|
380
|
-
let o =
|
|
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 =
|
|
385
|
-
|
|
386
|
-
const v = t[o][
|
|
387
|
-
if (!
|
|
388
|
-
const y =
|
|
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,
|
|
390
|
+
o = y.idx, c = y.end === 0 ? 1 : 0;
|
|
391
391
|
}
|
|
392
|
-
|
|
392
|
+
i.length >= 3 && l.push(i);
|
|
393
393
|
}
|
|
394
|
-
return
|
|
394
|
+
return l;
|
|
395
395
|
}
|
|
396
|
-
function Tt(t, r, n, e = 30,
|
|
396
|
+
function Tt(t, r, n, e = 30, l = 2e-3) {
|
|
397
397
|
if (r <= 0 || n <= 0 || t.length === 0) return [];
|
|
398
|
-
const
|
|
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
|
|
401
|
-
for (let w = 0; w <
|
|
402
|
-
const
|
|
403
|
-
p[(h + 1) *
|
|
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,
|
|
406
|
+
const m = _t(p, c, u, e), v = $t(m);
|
|
407
407
|
if (v.length === 0) return [];
|
|
408
|
-
let x = v[0],
|
|
408
|
+
let x = v[0], f = Math.abs(dt(x));
|
|
409
409
|
for (let h = 1; h < v.length; h++) {
|
|
410
|
-
const
|
|
411
|
-
|
|
410
|
+
const d = Math.abs(dt(v[h]));
|
|
411
|
+
d > f && (x = v[h], f = d);
|
|
412
412
|
}
|
|
413
|
-
const y = x.map(([h,
|
|
414
|
-
(h - 1) /
|
|
415
|
-
(
|
|
416
|
-
]),
|
|
417
|
-
return
|
|
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
|
|
425
|
-
n.push(`C${
|
|
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
|
|
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
|
|
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 <
|
|
441
|
-
return
|
|
442
|
-
x:
|
|
443
|
-
y:
|
|
444
|
-
w: (
|
|
445
|
-
h: (o -
|
|
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
|
|
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((
|
|
481
|
-
r.onload = () =>
|
|
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
|
|
486
|
-
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
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
|
-
|
|
491
|
-
const
|
|
492
|
-
this.alpha = Wt(
|
|
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
|
|
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[
|
|
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
|
|
537
|
-
const
|
|
538
|
-
o > r != u > r && t < (
|
|
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,
|
|
549
|
-
for (const [
|
|
550
|
-
|
|
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:
|
|
555
|
-
h:
|
|
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
|
|
585
|
-
this.rx = r.radius *
|
|
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,
|
|
595
|
-
return e * e +
|
|
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
|
|
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 [
|
|
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,
|
|
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
|
-
}, []),
|
|
629
|
+
}, []), C = t.map(Ht).join("|"), b = B(() => t, [C]);
|
|
630
630
|
W(() => {
|
|
631
|
-
const
|
|
632
|
-
if (!
|
|
633
|
-
const
|
|
634
|
-
const
|
|
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,
|
|
637
|
-
height: Math.max(1,
|
|
636
|
+
width: Math.max(1, S.width),
|
|
637
|
+
height: Math.max(1, S.height)
|
|
638
638
|
});
|
|
639
639
|
};
|
|
640
|
-
|
|
641
|
-
const
|
|
642
|
-
return
|
|
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
|
|
649
|
-
async function
|
|
650
|
-
const
|
|
651
|
-
for (const
|
|
652
|
-
const a = Bt(
|
|
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(),
|
|
657
|
-
|
|
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
|
-
|
|
659
|
+
j || (A = S, u.current = S, m(O), y(z));
|
|
660
660
|
}
|
|
661
|
-
return
|
|
662
|
-
|
|
663
|
-
for (const
|
|
664
|
-
|
|
661
|
+
return I(), () => {
|
|
662
|
+
j = !0;
|
|
663
|
+
for (const S of A)
|
|
664
|
+
S.dispose?.();
|
|
665
665
|
};
|
|
666
|
-
}, [b, r,
|
|
667
|
-
const
|
|
668
|
-
(
|
|
669
|
-
const
|
|
670
|
-
for (let
|
|
671
|
-
if (
|
|
672
|
-
return
|
|
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
|
-
),
|
|
677
|
-
(
|
|
678
|
-
const
|
|
679
|
-
if (!
|
|
680
|
-
const
|
|
681
|
-
return
|
|
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
|
-
),
|
|
685
|
-
(
|
|
684
|
+
), U = M(
|
|
685
|
+
(j) => {
|
|
686
686
|
if (!r) return;
|
|
687
|
-
const
|
|
688
|
-
if (!
|
|
689
|
-
|
|
687
|
+
const A = P(j);
|
|
688
|
+
if (!A) {
|
|
689
|
+
d();
|
|
690
690
|
return;
|
|
691
691
|
}
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
694
|
-
if (
|
|
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
|
-
|
|
698
|
+
d();
|
|
699
699
|
return;
|
|
700
700
|
}
|
|
701
|
-
w(),
|
|
701
|
+
w(), s(I);
|
|
702
702
|
},
|
|
703
|
-
[r,
|
|
703
|
+
[r, P, R, d, w]
|
|
704
704
|
), D = M(() => {
|
|
705
|
-
|
|
706
|
-
}, [
|
|
707
|
-
(
|
|
705
|
+
d();
|
|
706
|
+
}, [d]), H = M(
|
|
707
|
+
(j) => {
|
|
708
708
|
if (!r) return;
|
|
709
|
-
const
|
|
710
|
-
if (!
|
|
709
|
+
const A = P(j);
|
|
710
|
+
if (!A) {
|
|
711
711
|
o(null);
|
|
712
712
|
return;
|
|
713
713
|
}
|
|
714
|
-
const
|
|
715
|
-
o(
|
|
714
|
+
const I = R(A.nx, A.ny);
|
|
715
|
+
o(I === i || I === null ? null : I);
|
|
716
716
|
},
|
|
717
|
-
[r,
|
|
718
|
-
), Q =
|
|
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:
|
|
723
|
-
selectedId:
|
|
722
|
+
hoveredId: l,
|
|
723
|
+
selectedId: i,
|
|
724
724
|
activeId: Q,
|
|
725
725
|
viewportSize: v,
|
|
726
|
-
boundsMap:
|
|
727
|
-
contourMap:
|
|
728
|
-
containerRef:
|
|
726
|
+
boundsMap: q,
|
|
727
|
+
contourMap: G,
|
|
728
|
+
containerRef: c,
|
|
729
729
|
containerProps: {
|
|
730
|
-
onPointerMove:
|
|
730
|
+
onPointerMove: U,
|
|
731
731
|
onPointerLeave: D,
|
|
732
|
-
onClick:
|
|
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
|
-
},
|
|
1025
|
+
}, F = lt(null), kt = lt(null);
|
|
1026
1026
|
function nt() {
|
|
1027
|
-
const t =
|
|
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 =
|
|
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:
|
|
1039
|
-
const
|
|
1040
|
-
if (!
|
|
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(() => (
|
|
1043
|
-
const
|
|
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,
|
|
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,
|
|
1048
|
-
let
|
|
1049
|
-
!o.enabled || !o.isAnyActive && !o.showAll ? (
|
|
1050
|
-
const
|
|
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:
|
|
1058
|
+
effect: c
|
|
1059
1059
|
}),
|
|
1060
|
-
[t, n, y, m, v, x,
|
|
1060
|
+
[t, n, y, m, v, x, c]
|
|
1061
1061
|
);
|
|
1062
|
-
return /* @__PURE__ */
|
|
1063
|
-
/* @__PURE__ */
|
|
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:
|
|
1073
|
-
...
|
|
1072
|
+
transition: c.transition,
|
|
1073
|
+
...g
|
|
1074
1074
|
},
|
|
1075
1075
|
children: [
|
|
1076
|
-
|
|
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__ */
|
|
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__ */
|
|
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:
|
|
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
|
-
|
|
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:
|
|
1138
|
-
renderLayer:
|
|
1137
|
+
children: l,
|
|
1138
|
+
renderLayer: s
|
|
1139
1139
|
}) {
|
|
1140
|
-
const
|
|
1141
|
-
if (!
|
|
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:
|
|
1146
|
-
W(() => (
|
|
1147
|
-
const v = e ? typeof e == "string" ? J[e] ?? o.effect : e : o.effect, x = o.activeId === t,
|
|
1148
|
-
let
|
|
1149
|
-
!o.enabled || !o.isAnyActive && !o.showAll ? (w = { ...v.cutoutIdle, filter: "none", opacity: 0 },
|
|
1150
|
-
const b =
|
|
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
|
-
},
|
|
1154
|
+
}, R = B(
|
|
1155
1155
|
() => ({
|
|
1156
1156
|
id: t,
|
|
1157
1157
|
label: n,
|
|
1158
1158
|
bounds: h,
|
|
1159
1159
|
isActive: x,
|
|
1160
|
-
isHovered:
|
|
1160
|
+
isHovered: f,
|
|
1161
1161
|
isSelected: y,
|
|
1162
1162
|
effect: v
|
|
1163
1163
|
}),
|
|
1164
|
-
[t, n, h, x,
|
|
1164
|
+
[t, n, h, x, f, y, v]
|
|
1165
1165
|
);
|
|
1166
|
-
return /* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
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
|
-
|
|
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:
|
|
1229
|
-
renderLayer:
|
|
1228
|
+
children: l,
|
|
1229
|
+
renderLayer: s
|
|
1230
1230
|
}) {
|
|
1231
|
-
const
|
|
1232
|
-
if (!
|
|
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
|
|
1237
|
-
W(() => (
|
|
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 },
|
|
1239
|
-
let y,
|
|
1240
|
-
!o.enabled || !o.isAnyActive && !o.showAll ? (
|
|
1241
|
-
const
|
|
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 =
|
|
1245
|
+
}, w = B(
|
|
1246
1246
|
() => ({
|
|
1247
1247
|
id: t,
|
|
1248
1248
|
label: n,
|
|
1249
|
-
bounds:
|
|
1249
|
+
bounds: f,
|
|
1250
1250
|
isActive: p,
|
|
1251
1251
|
isHovered: m,
|
|
1252
1252
|
isSelected: v,
|
|
1253
1253
|
effect: u
|
|
1254
1254
|
}),
|
|
1255
|
-
[t, n,
|
|
1255
|
+
[t, n, f, p, m, v, u]
|
|
1256
1256
|
);
|
|
1257
|
-
return /* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
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
|
-
...
|
|
1268
|
+
...g
|
|
1269
1269
|
},
|
|
1270
|
-
children:
|
|
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:
|
|
1281
|
+
filter: d.glow ? `drop-shadow(${d.glow.split(",")[0]?.trim() ?? ""})` : "none"
|
|
1282
1282
|
},
|
|
1283
|
-
children: /* @__PURE__ */
|
|
1283
|
+
children: /* @__PURE__ */ E.jsx(
|
|
1284
1284
|
"polygon",
|
|
1285
1285
|
{
|
|
1286
|
-
points: r.map(([
|
|
1287
|
-
fill:
|
|
1288
|
-
stroke:
|
|
1289
|
-
strokeWidth: (
|
|
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:
|
|
1292
|
-
strokeDasharray:
|
|
1293
|
-
pathLength:
|
|
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:
|
|
1296
|
+
animation: d.animation
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
1299
|
)
|
|
@@ -1301,7 +1301,7 @@ function ee({
|
|
|
1301
1301
|
)
|
|
1302
1302
|
}
|
|
1303
1303
|
),
|
|
1304
|
-
|
|
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:
|
|
1317
|
-
children:
|
|
1318
|
-
renderLayer:
|
|
1316
|
+
effect: l,
|
|
1317
|
+
children: s,
|
|
1318
|
+
renderLayer: i
|
|
1319
1319
|
}) {
|
|
1320
|
-
const o =
|
|
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 =
|
|
1328
|
-
let
|
|
1329
|
-
!
|
|
1330
|
-
const D =
|
|
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
|
-
},
|
|
1334
|
+
}, H = B(
|
|
1335
1335
|
() => ({
|
|
1336
1336
|
id: t,
|
|
1337
1337
|
label: e,
|
|
1338
|
-
bounds:
|
|
1338
|
+
bounds: g,
|
|
1339
1339
|
isActive: v,
|
|
1340
1340
|
isHovered: x,
|
|
1341
|
-
isSelected:
|
|
1341
|
+
isSelected: f,
|
|
1342
1342
|
effect: m
|
|
1343
1343
|
}),
|
|
1344
|
-
[t, e,
|
|
1344
|
+
[t, e, g, v, x, f, m]
|
|
1345
1345
|
);
|
|
1346
|
-
return /* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
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:
|
|
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__ */
|
|
1372
|
+
children: /* @__PURE__ */ E.jsx(
|
|
1373
1373
|
"ellipse",
|
|
1374
1374
|
{
|
|
1375
1375
|
cx: r.x,
|
|
1376
1376
|
cy: r.y,
|
|
1377
|
-
rx:
|
|
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
|
-
|
|
1395
|
+
s
|
|
1396
1396
|
] });
|
|
1397
1397
|
}
|
|
1398
1398
|
function ne(t, r) {
|
|
1399
|
-
const { x: n, y: e, w:
|
|
1400
|
-
let
|
|
1401
|
-
t.includes("left") ? (
|
|
1402
|
-
let
|
|
1403
|
-
return t.startsWith("top") ? (
|
|
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:
|
|
1406
|
-
top:
|
|
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
|
|
1417
|
-
if (!
|
|
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
|
|
1422
|
-
return /* @__PURE__ */
|
|
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:
|
|
1430
|
-
opacity:
|
|
1431
|
-
pointerEvents:
|
|
1432
|
-
...
|
|
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,
|
|
1445
|
-
(
|
|
1446
|
-
const
|
|
1447
|
-
if (!
|
|
1448
|
-
const b =
|
|
1449
|
-
return
|
|
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
|
-
(
|
|
1454
|
+
(d, w) => {
|
|
1454
1455
|
if (w.length < r) return !1;
|
|
1455
|
-
const
|
|
1456
|
-
return Math.sqrt(
|
|
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
|
-
(
|
|
1461
|
-
|
|
1461
|
+
(d) => {
|
|
1462
|
+
d.length < r || (t(d), l([]), i(null));
|
|
1462
1463
|
},
|
|
1463
1464
|
[t, r]
|
|
1464
1465
|
), m = M(() => {
|
|
1465
|
-
|
|
1466
|
+
l([]), i(null);
|
|
1466
1467
|
}, []), v = M(
|
|
1467
|
-
(
|
|
1468
|
-
|
|
1468
|
+
(d) => {
|
|
1469
|
+
i(c(d.clientX, d.clientY));
|
|
1469
1470
|
},
|
|
1470
|
-
[
|
|
1471
|
+
[c]
|
|
1471
1472
|
), x = M(() => {
|
|
1472
|
-
|
|
1473
|
-
}, []),
|
|
1474
|
-
(
|
|
1475
|
-
|
|
1476
|
-
const w =
|
|
1477
|
-
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
|
-
[
|
|
1480
|
+
[c, u, p]
|
|
1480
1481
|
), y = M(
|
|
1481
|
-
(
|
|
1482
|
-
|
|
1483
|
-
const
|
|
1484
|
-
return
|
|
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
|
-
),
|
|
1489
|
-
(
|
|
1490
|
-
|
|
1489
|
+
), g = M(
|
|
1490
|
+
(d) => {
|
|
1491
|
+
d.preventDefault(), l((w) => w.slice(0, -1));
|
|
1491
1492
|
},
|
|
1492
1493
|
[]
|
|
1493
|
-
), h =
|
|
1494
|
+
), h = s !== null && u(s, e);
|
|
1494
1495
|
return {
|
|
1495
1496
|
points: e,
|
|
1496
|
-
previewPoint:
|
|
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:
|
|
1504
|
+
onClick: f,
|
|
1504
1505
|
onDoubleClick: y,
|
|
1505
|
-
onContextMenu:
|
|
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:
|
|
1515
|
-
style:
|
|
1516
|
-
className:
|
|
1515
|
+
enabled: l = !0,
|
|
1516
|
+
style: s,
|
|
1517
|
+
className: i = ""
|
|
1517
1518
|
}) {
|
|
1518
|
-
if (!
|
|
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:
|
|
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
|
|
1532
|
+
function g(h) {
|
|
1532
1533
|
h.key === "Escape" && m();
|
|
1533
1534
|
}
|
|
1534
|
-
return document.addEventListener("keydown",
|
|
1535
|
+
return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
|
|
1535
1536
|
}, [m]), W(() => {
|
|
1536
|
-
|
|
1537
|
-
}, [
|
|
1538
|
-
const
|
|
1539
|
-
return /* @__PURE__ */
|
|
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:
|
|
1545
|
+
className: i,
|
|
1545
1546
|
style: {
|
|
1546
1547
|
position: "absolute",
|
|
1547
1548
|
inset: 0,
|
|
1548
|
-
cursor:
|
|
1549
|
+
cursor: l ? p ? "cell" : "crosshair" : "default",
|
|
1549
1550
|
zIndex: 30,
|
|
1550
|
-
pointerEvents:
|
|
1551
|
-
...
|
|
1551
|
+
pointerEvents: l ? "auto" : "none",
|
|
1552
|
+
...s
|
|
1552
1553
|
},
|
|
1553
|
-
...
|
|
1554
|
-
children:
|
|
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
|
-
|
|
1569
|
+
c.length >= 3 && /* @__PURE__ */ E.jsx(
|
|
1569
1570
|
"polygon",
|
|
1570
1571
|
{
|
|
1571
|
-
points:
|
|
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
|
-
|
|
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 &&
|
|
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:
|
|
1595
|
-
y2:
|
|
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
|
-
|
|
1604
|
+
c.map(([g, h], d) => /* @__PURE__ */ E.jsx(
|
|
1604
1605
|
"circle",
|
|
1605
1606
|
{
|
|
1606
|
-
cx:
|
|
1607
|
+
cx: g,
|
|
1607
1608
|
cy: h,
|
|
1608
|
-
r:
|
|
1609
|
-
fill:
|
|
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
|
-
|
|
1614
|
+
d
|
|
1614
1615
|
)),
|
|
1615
|
-
u && /* @__PURE__ */
|
|
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] =
|
|
1638
|
-
(
|
|
1639
|
-
const
|
|
1640
|
-
if (!
|
|
1641
|
-
const h =
|
|
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,
|
|
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
|
-
),
|
|
1649
|
-
(
|
|
1650
|
-
const
|
|
1651
|
-
return { x:
|
|
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),
|
|
1656
|
+
e(null), s(null);
|
|
1656
1657
|
}, []);
|
|
1657
1658
|
W(() => {
|
|
1658
|
-
function
|
|
1659
|
+
function f(y) {
|
|
1659
1660
|
y.key === "Escape" && u();
|
|
1660
1661
|
}
|
|
1661
|
-
return document.addEventListener("keydown",
|
|
1662
|
+
return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
|
|
1662
1663
|
}, [u]);
|
|
1663
1664
|
const p = M(
|
|
1664
|
-
(
|
|
1665
|
-
|
|
1666
|
-
const y = o(
|
|
1667
|
-
y && (e(y),
|
|
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
|
-
(
|
|
1672
|
+
(f) => {
|
|
1672
1673
|
if (!n) return;
|
|
1673
|
-
const y = o(
|
|
1674
|
-
y &&
|
|
1674
|
+
const y = o(f.clientX, f.clientY);
|
|
1675
|
+
y && s(c(n, y));
|
|
1675
1676
|
},
|
|
1676
|
-
[n, o,
|
|
1677
|
+
[n, o, c]
|
|
1677
1678
|
), v = M(
|
|
1678
|
-
(
|
|
1679
|
+
(f) => {
|
|
1679
1680
|
if (!n) return;
|
|
1680
|
-
const y = o(
|
|
1681
|
+
const y = o(f.clientX, f.clientY);
|
|
1681
1682
|
if (y) {
|
|
1682
|
-
const
|
|
1683
|
-
|
|
1683
|
+
const g = c(n, y);
|
|
1684
|
+
g.w >= r && g.h >= r && t(g);
|
|
1684
1685
|
}
|
|
1685
|
-
e(null),
|
|
1686
|
+
e(null), s(null);
|
|
1686
1687
|
},
|
|
1687
|
-
[n, o,
|
|
1688
|
+
[n, o, c, r, t]
|
|
1688
1689
|
), x = M(() => {
|
|
1689
1690
|
}, []);
|
|
1690
1691
|
return {
|
|
1691
|
-
rect:
|
|
1692
|
+
rect: l,
|
|
1692
1693
|
isDragging: n !== null,
|
|
1693
1694
|
reset: u,
|
|
1694
|
-
containerRef:
|
|
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:
|
|
1709
|
-
className:
|
|
1709
|
+
style: l,
|
|
1710
|
+
className: s = ""
|
|
1710
1711
|
}) {
|
|
1711
|
-
if (!
|
|
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:
|
|
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 ||
|
|
1721
|
-
}, [e,
|
|
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:
|
|
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
|
-
...
|
|
1734
|
+
...l
|
|
1734
1735
|
},
|
|
1735
1736
|
...e ? p : {},
|
|
1736
|
-
children: o && o.w > 0 && o.h > 0 && /* @__PURE__ */
|
|
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__ */
|
|
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] =
|
|
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
|
|
1777
|
-
if (!
|
|
1777
|
+
const g = c.current;
|
|
1778
|
+
if (!g) return;
|
|
1778
1779
|
const h = () => {
|
|
1779
|
-
const w =
|
|
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
|
|
1787
|
-
return
|
|
1787
|
+
const d = new ResizeObserver(h);
|
|
1788
|
+
return d.observe(g), () => d.disconnect();
|
|
1788
1789
|
}, []);
|
|
1789
1790
|
const u = M(
|
|
1790
|
-
(
|
|
1791
|
-
const
|
|
1792
|
-
if (!
|
|
1793
|
-
const w =
|
|
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,
|
|
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
|
-
(
|
|
1802
|
-
const
|
|
1803
|
-
return
|
|
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
|
-
[
|
|
1806
|
+
[i.height, i.width]
|
|
1806
1807
|
), m = M(() => {
|
|
1807
|
-
e(null),
|
|
1808
|
+
e(null), s(null);
|
|
1808
1809
|
}, []);
|
|
1809
1810
|
W(() => {
|
|
1810
|
-
function
|
|
1811
|
+
function g(h) {
|
|
1811
1812
|
h.key === "Escape" && m();
|
|
1812
1813
|
}
|
|
1813
|
-
return document.addEventListener("keydown",
|
|
1814
|
+
return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
|
|
1814
1815
|
}, [m]);
|
|
1815
1816
|
const v = M(
|
|
1816
|
-
(
|
|
1817
|
-
|
|
1818
|
-
const h = u(
|
|
1819
|
-
h && (e(h),
|
|
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
|
-
(
|
|
1824
|
+
(g) => {
|
|
1824
1825
|
if (!n) return;
|
|
1825
|
-
const h = u(
|
|
1826
|
+
const h = u(g.clientX, g.clientY);
|
|
1826
1827
|
if (!h) return;
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1828
|
+
const d = p(h, n);
|
|
1829
|
+
s({ center: n, radius: d });
|
|
1829
1830
|
},
|
|
1830
1831
|
[n, u, p]
|
|
1831
|
-
),
|
|
1832
|
-
(
|
|
1832
|
+
), f = M(
|
|
1833
|
+
(g) => {
|
|
1833
1834
|
if (!n) return;
|
|
1834
|
-
const h = u(
|
|
1835
|
+
const h = u(g.clientX, g.clientY);
|
|
1835
1836
|
if (h) {
|
|
1836
|
-
const
|
|
1837
|
-
|
|
1837
|
+
const d = p(h, n);
|
|
1838
|
+
d >= r && t({ center: n, radius: d });
|
|
1838
1839
|
}
|
|
1839
|
-
e(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:
|
|
1846
|
-
viewportSize:
|
|
1846
|
+
circle: l,
|
|
1847
|
+
viewportSize: i,
|
|
1847
1848
|
isDragging: n !== null,
|
|
1848
1849
|
reset: m,
|
|
1849
|
-
containerRef:
|
|
1850
|
+
containerRef: c,
|
|
1850
1851
|
containerProps: {
|
|
1851
1852
|
onPointerDown: v,
|
|
1852
1853
|
onPointerMove: x,
|
|
1853
|
-
onPointerUp:
|
|
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:
|
|
1864
|
-
className:
|
|
1864
|
+
style: l,
|
|
1865
|
+
className: s = ""
|
|
1865
1866
|
}) {
|
|
1866
|
-
if (!
|
|
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:
|
|
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,
|
|
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__ */
|
|
1877
|
+
}, [e, u]), /* @__PURE__ */ E.jsx(
|
|
1877
1878
|
"div",
|
|
1878
1879
|
{
|
|
1879
1880
|
ref: p,
|
|
1880
1881
|
"data-draw-circle": "true",
|
|
1881
|
-
className:
|
|
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
|
-
...
|
|
1889
|
+
...l
|
|
1889
1890
|
},
|
|
1890
1891
|
...e ? m : {},
|
|
1891
|
-
children: o && o.radius > 0 && /* @__PURE__ */
|
|
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__ */
|
|
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 *
|
|
1910
|
-
ry: o.radius *
|
|
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:
|
|
1942
|
+
showAll: l = !1,
|
|
1943
|
+
showOverlays: s = !1,
|
|
1942
1944
|
alphaThreshold: i = 30,
|
|
1943
|
-
hoverLeaveDelay:
|
|
1944
|
-
children:
|
|
1945
|
-
className:
|
|
1946
|
-
style:
|
|
1947
|
-
onHover:
|
|
1948
|
-
onActiveChange:
|
|
1949
|
-
onSelect:
|
|
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
|
|
1953
|
+
const f = typeof n == "string" ? J[n] ?? J.elevate : n;
|
|
1952
1954
|
W(() => {
|
|
1953
|
-
Xt(
|
|
1954
|
-
}, [
|
|
1955
|
-
const [
|
|
1956
|
-
(
|
|
1957
|
-
|
|
1958
|
-
const
|
|
1959
|
-
if (
|
|
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
|
|
1962
|
-
return
|
|
1963
|
+
const a = new Map(z);
|
|
1964
|
+
return a.set(O.id, O), a;
|
|
1963
1965
|
});
|
|
1964
1966
|
},
|
|
1965
1967
|
[]
|
|
1966
|
-
),
|
|
1967
|
-
|
|
1968
|
-
if (!z.has(
|
|
1969
|
-
const
|
|
1970
|
-
return
|
|
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
|
-
}, []),
|
|
1973
|
-
() => ({ registerCutout:
|
|
1974
|
-
[
|
|
1975
|
-
),
|
|
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
|
-
|
|
1978
|
-
}, [
|
|
1979
|
-
|
|
1980
|
-
}, [
|
|
1981
|
-
|
|
1982
|
-
}, [
|
|
1983
|
-
const
|
|
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:
|
|
1986
|
-
selectedId:
|
|
1987
|
-
hoveredId:
|
|
1988
|
-
viewportSize:
|
|
1989
|
-
effect:
|
|
1987
|
+
activeId: b,
|
|
1988
|
+
selectedId: R,
|
|
1989
|
+
hoveredId: P,
|
|
1990
|
+
viewportSize: U,
|
|
1991
|
+
effect: f,
|
|
1990
1992
|
enabled: e,
|
|
1991
|
-
showAll:
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1993
|
+
showAll: l,
|
|
1994
|
+
showOverlays: s,
|
|
1995
|
+
boundsMap: D,
|
|
1996
|
+
contourMap: H,
|
|
1997
|
+
isAnyActive: I
|
|
1995
1998
|
}),
|
|
1996
|
-
[
|
|
1999
|
+
[b, R, P, U, f, e, l, s, D, H, I]
|
|
1997
2000
|
);
|
|
1998
|
-
return /* @__PURE__ */
|
|
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:
|
|
2002
|
-
className:
|
|
2004
|
+
ref: Q,
|
|
2005
|
+
className: u,
|
|
2003
2006
|
style: {
|
|
2004
2007
|
position: "relative",
|
|
2005
2008
|
width: "100%",
|
|
2006
2009
|
overflow: "hidden",
|
|
2007
|
-
cursor:
|
|
2008
|
-
...
|
|
2010
|
+
cursor: I && e ? "pointer" : "default",
|
|
2011
|
+
...p
|
|
2009
2012
|
},
|
|
2010
|
-
...
|
|
2013
|
+
...q,
|
|
2011
2014
|
children: [
|
|
2012
|
-
/* @__PURE__ */
|
|
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:
|
|
2024
|
-
...
|
|
2026
|
+
transition: f.transition,
|
|
2027
|
+
...I && e ? f.mainImageHovered : {}
|
|
2025
2028
|
}
|
|
2026
2029
|
}
|
|
2027
2030
|
),
|
|
2028
|
-
/* @__PURE__ */
|
|
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:
|
|
2036
|
-
opacity:
|
|
2037
|
-
...
|
|
2038
|
+
transition: f.transition,
|
|
2039
|
+
opacity: I && e ? 1 : 0,
|
|
2040
|
+
...f.vignetteStyle
|
|
2038
2041
|
}
|
|
2039
2042
|
}
|
|
2040
2043
|
),
|
|
2041
|
-
|
|
2044
|
+
c
|
|
2042
2045
|
]
|
|
2043
2046
|
}
|
|
2044
2047
|
) }) });
|
|
2045
2048
|
}
|
|
2046
|
-
const
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
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
|
-
|
|
2061
|
+
X as CutoutViewer,
|
|
2059
2062
|
ue as DrawCircle,
|
|
2060
2063
|
ie as DrawPolygon,
|
|
2061
2064
|
ce as DrawRectangle,
|
|
2062
|
-
|
|
2065
|
+
zt as ImageHitTestStrategy,
|
|
2063
2066
|
Nt as PolygonHitTestStrategy,
|
|
2064
2067
|
Lt as RectHitTestStrategy,
|
|
2065
2068
|
Bt as createHitTestStrategy,
|