@frigate-nvr/image-annotator 1.0.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/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/_commonjsHelpers-DjF3Plf2.js +27 -0
- package/dist/_commonjsHelpers-DjF3Plf2.js.map +1 -0
- package/dist/assets/Button.css +1 -0
- package/dist/assets/FormElement.css +1 -0
- package/dist/assets/FormElementBox.css +1 -0
- package/dist/components/BoundingBox.js +2553 -0
- package/dist/components/BoundingBox.js.map +1 -0
- package/dist/components/Button.js +45 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Crosshairs.js +58 -0
- package/dist/components/Crosshairs.js.map +1 -0
- package/dist/components/FormElement.js +13 -0
- package/dist/components/FormElement.js.map +1 -0
- package/dist/components/FormElementBox.js +18 -0
- package/dist/components/FormElementBox.js.map +1 -0
- package/dist/components/ImageAnnotator.js +642 -0
- package/dist/components/ImageAnnotator.js.map +1 -0
- package/dist/components/InfoDialog.js +25 -0
- package/dist/components/InfoDialog.js.map +1 -0
- package/dist/components/LabelDialog.js +27 -0
- package/dist/components/LabelDialog.js.map +1 -0
- package/dist/components/VerifyDialog.js +34 -0
- package/dist/components/VerifyDialog.js.map +1 -0
- package/dist/components/index.js +22 -0
- package/dist/components/index.js.map +1 -0
- package/dist/dialog-DrJOKYL3.js +1128 -0
- package/dist/dialog-DrJOKYL3.js.map +1 -0
- package/dist/index-sN46tOW-.js +43 -0
- package/dist/index-sN46tOW-.js.map +1 -0
- package/dist/index.d.ts +176 -0
- package/dist/index.esm-FeyXGhGs.js +916 -0
- package/dist/index.esm-FeyXGhGs.js.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,2553 @@
|
|
|
1
|
+
import { jsxs as Xe, jsx as he } from "react/jsx-runtime";
|
|
2
|
+
import * as pe from "react";
|
|
3
|
+
import ft, { createElement as qe, PureComponent as Pt, useState as Rt } from "react";
|
|
4
|
+
import { a as _t, g as Dt } from "../_commonjsHelpers-DjF3Plf2.js";
|
|
5
|
+
import ct, { flushSync as Tt } from "react-dom";
|
|
6
|
+
import { u as Ct } from "../index.esm-FeyXGhGs.js";
|
|
7
|
+
var Pe = { exports: {} }, ht = {}, je = { exports: {} }, be = { exports: {} }, N = {};
|
|
8
|
+
/** @license React v16.13.1
|
|
9
|
+
* react-is.production.min.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
var Ge;
|
|
17
|
+
function Ot() {
|
|
18
|
+
if (Ge) return N;
|
|
19
|
+
Ge = 1;
|
|
20
|
+
var e = typeof Symbol == "function" && Symbol.for, i = e ? Symbol.for("react.element") : 60103, t = e ? Symbol.for("react.portal") : 60106, r = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, o = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, s = e ? Symbol.for("react.context") : 60110, f = e ? Symbol.for("react.async_mode") : 60111, u = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, g = e ? Symbol.for("react.suspense") : 60113, b = e ? Symbol.for("react.suspense_list") : 60120, S = e ? Symbol.for("react.memo") : 60115, z = e ? Symbol.for("react.lazy") : 60116, w = e ? Symbol.for("react.block") : 60121, E = e ? Symbol.for("react.fundamental") : 60117, D = e ? Symbol.for("react.responder") : 60118, y = e ? Symbol.for("react.scope") : 60119;
|
|
21
|
+
function h(l) {
|
|
22
|
+
if (typeof l == "object" && l !== null) {
|
|
23
|
+
var R = l.$$typeof;
|
|
24
|
+
switch (R) {
|
|
25
|
+
case i:
|
|
26
|
+
switch (l = l.type, l) {
|
|
27
|
+
case f:
|
|
28
|
+
case u:
|
|
29
|
+
case r:
|
|
30
|
+
case o:
|
|
31
|
+
case n:
|
|
32
|
+
case g:
|
|
33
|
+
return l;
|
|
34
|
+
default:
|
|
35
|
+
switch (l = l && l.$$typeof, l) {
|
|
36
|
+
case s:
|
|
37
|
+
case p:
|
|
38
|
+
case z:
|
|
39
|
+
case S:
|
|
40
|
+
case a:
|
|
41
|
+
return l;
|
|
42
|
+
default:
|
|
43
|
+
return R;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
case t:
|
|
47
|
+
return R;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function d(l) {
|
|
52
|
+
return h(l) === u;
|
|
53
|
+
}
|
|
54
|
+
return N.AsyncMode = f, N.ConcurrentMode = u, N.ContextConsumer = s, N.ContextProvider = a, N.Element = i, N.ForwardRef = p, N.Fragment = r, N.Lazy = z, N.Memo = S, N.Portal = t, N.Profiler = o, N.StrictMode = n, N.Suspense = g, N.isAsyncMode = function(l) {
|
|
55
|
+
return d(l) || h(l) === f;
|
|
56
|
+
}, N.isConcurrentMode = d, N.isContextConsumer = function(l) {
|
|
57
|
+
return h(l) === s;
|
|
58
|
+
}, N.isContextProvider = function(l) {
|
|
59
|
+
return h(l) === a;
|
|
60
|
+
}, N.isElement = function(l) {
|
|
61
|
+
return typeof l == "object" && l !== null && l.$$typeof === i;
|
|
62
|
+
}, N.isForwardRef = function(l) {
|
|
63
|
+
return h(l) === p;
|
|
64
|
+
}, N.isFragment = function(l) {
|
|
65
|
+
return h(l) === r;
|
|
66
|
+
}, N.isLazy = function(l) {
|
|
67
|
+
return h(l) === z;
|
|
68
|
+
}, N.isMemo = function(l) {
|
|
69
|
+
return h(l) === S;
|
|
70
|
+
}, N.isPortal = function(l) {
|
|
71
|
+
return h(l) === t;
|
|
72
|
+
}, N.isProfiler = function(l) {
|
|
73
|
+
return h(l) === o;
|
|
74
|
+
}, N.isStrictMode = function(l) {
|
|
75
|
+
return h(l) === n;
|
|
76
|
+
}, N.isSuspense = function(l) {
|
|
77
|
+
return h(l) === g;
|
|
78
|
+
}, N.isValidElementType = function(l) {
|
|
79
|
+
return typeof l == "string" || typeof l == "function" || l === r || l === u || l === o || l === n || l === g || l === b || typeof l == "object" && l !== null && (l.$$typeof === z || l.$$typeof === S || l.$$typeof === a || l.$$typeof === s || l.$$typeof === p || l.$$typeof === E || l.$$typeof === D || l.$$typeof === y || l.$$typeof === w);
|
|
80
|
+
}, N.typeOf = h, N;
|
|
81
|
+
}
|
|
82
|
+
var H = {};
|
|
83
|
+
/** @license React v16.13.1
|
|
84
|
+
* react-is.development.js
|
|
85
|
+
*
|
|
86
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
87
|
+
*
|
|
88
|
+
* This source code is licensed under the MIT license found in the
|
|
89
|
+
* LICENSE file in the root directory of this source tree.
|
|
90
|
+
*/
|
|
91
|
+
var Ve;
|
|
92
|
+
function Mt() {
|
|
93
|
+
return Ve || (Ve = 1, process.env.NODE_ENV !== "production" && function() {
|
|
94
|
+
var e = typeof Symbol == "function" && Symbol.for, i = e ? Symbol.for("react.element") : 60103, t = e ? Symbol.for("react.portal") : 60106, r = e ? Symbol.for("react.fragment") : 60107, n = e ? Symbol.for("react.strict_mode") : 60108, o = e ? Symbol.for("react.profiler") : 60114, a = e ? Symbol.for("react.provider") : 60109, s = e ? Symbol.for("react.context") : 60110, f = e ? Symbol.for("react.async_mode") : 60111, u = e ? Symbol.for("react.concurrent_mode") : 60111, p = e ? Symbol.for("react.forward_ref") : 60112, g = e ? Symbol.for("react.suspense") : 60113, b = e ? Symbol.for("react.suspense_list") : 60120, S = e ? Symbol.for("react.memo") : 60115, z = e ? Symbol.for("react.lazy") : 60116, w = e ? Symbol.for("react.block") : 60121, E = e ? Symbol.for("react.fundamental") : 60117, D = e ? Symbol.for("react.responder") : 60118, y = e ? Symbol.for("react.scope") : 60119;
|
|
95
|
+
function h(v) {
|
|
96
|
+
return typeof v == "string" || typeof v == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
97
|
+
v === r || v === u || v === o || v === n || v === g || v === b || typeof v == "object" && v !== null && (v.$$typeof === z || v.$$typeof === S || v.$$typeof === a || v.$$typeof === s || v.$$typeof === p || v.$$typeof === E || v.$$typeof === D || v.$$typeof === y || v.$$typeof === w);
|
|
98
|
+
}
|
|
99
|
+
function d(v) {
|
|
100
|
+
if (typeof v == "object" && v !== null) {
|
|
101
|
+
var se = v.$$typeof;
|
|
102
|
+
switch (se) {
|
|
103
|
+
case i:
|
|
104
|
+
var me = v.type;
|
|
105
|
+
switch (me) {
|
|
106
|
+
case f:
|
|
107
|
+
case u:
|
|
108
|
+
case r:
|
|
109
|
+
case o:
|
|
110
|
+
case n:
|
|
111
|
+
case g:
|
|
112
|
+
return me;
|
|
113
|
+
default:
|
|
114
|
+
var Ue = me && me.$$typeof;
|
|
115
|
+
switch (Ue) {
|
|
116
|
+
case s:
|
|
117
|
+
case p:
|
|
118
|
+
case z:
|
|
119
|
+
case S:
|
|
120
|
+
case a:
|
|
121
|
+
return Ue;
|
|
122
|
+
default:
|
|
123
|
+
return se;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
case t:
|
|
127
|
+
return se;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
var l = f, R = u, x = s, k = a, B = i, Y = p, X = r, j = z, q = S, V = t, ie = o, I = n, Z = g, ne = !1;
|
|
132
|
+
function K(v) {
|
|
133
|
+
return ne || (ne = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), c(v) || d(v) === f;
|
|
134
|
+
}
|
|
135
|
+
function c(v) {
|
|
136
|
+
return d(v) === u;
|
|
137
|
+
}
|
|
138
|
+
function m(v) {
|
|
139
|
+
return d(v) === s;
|
|
140
|
+
}
|
|
141
|
+
function O(v) {
|
|
142
|
+
return d(v) === a;
|
|
143
|
+
}
|
|
144
|
+
function T(v) {
|
|
145
|
+
return typeof v == "object" && v !== null && v.$$typeof === i;
|
|
146
|
+
}
|
|
147
|
+
function P(v) {
|
|
148
|
+
return d(v) === p;
|
|
149
|
+
}
|
|
150
|
+
function M(v) {
|
|
151
|
+
return d(v) === r;
|
|
152
|
+
}
|
|
153
|
+
function _(v) {
|
|
154
|
+
return d(v) === z;
|
|
155
|
+
}
|
|
156
|
+
function C(v) {
|
|
157
|
+
return d(v) === S;
|
|
158
|
+
}
|
|
159
|
+
function W(v) {
|
|
160
|
+
return d(v) === t;
|
|
161
|
+
}
|
|
162
|
+
function L(v) {
|
|
163
|
+
return d(v) === o;
|
|
164
|
+
}
|
|
165
|
+
function A(v) {
|
|
166
|
+
return d(v) === n;
|
|
167
|
+
}
|
|
168
|
+
function Q(v) {
|
|
169
|
+
return d(v) === g;
|
|
170
|
+
}
|
|
171
|
+
H.AsyncMode = l, H.ConcurrentMode = R, H.ContextConsumer = x, H.ContextProvider = k, H.Element = B, H.ForwardRef = Y, H.Fragment = X, H.Lazy = j, H.Memo = q, H.Portal = V, H.Profiler = ie, H.StrictMode = I, H.Suspense = Z, H.isAsyncMode = K, H.isConcurrentMode = c, H.isContextConsumer = m, H.isContextProvider = O, H.isElement = T, H.isForwardRef = P, H.isFragment = M, H.isLazy = _, H.isMemo = C, H.isPortal = W, H.isProfiler = L, H.isStrictMode = A, H.isSuspense = Q, H.isValidElementType = h, H.typeOf = d;
|
|
172
|
+
}()), H;
|
|
173
|
+
}
|
|
174
|
+
var Ke;
|
|
175
|
+
function pt() {
|
|
176
|
+
return Ke || (Ke = 1, process.env.NODE_ENV === "production" ? be.exports = Ot() : be.exports = Mt()), be.exports;
|
|
177
|
+
}
|
|
178
|
+
/*
|
|
179
|
+
object-assign
|
|
180
|
+
(c) Sindre Sorhus
|
|
181
|
+
@license MIT
|
|
182
|
+
*/
|
|
183
|
+
var Te, Je;
|
|
184
|
+
function Wt() {
|
|
185
|
+
if (Je) return Te;
|
|
186
|
+
Je = 1;
|
|
187
|
+
var e = Object.getOwnPropertySymbols, i = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
|
|
188
|
+
function r(o) {
|
|
189
|
+
if (o == null)
|
|
190
|
+
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
191
|
+
return Object(o);
|
|
192
|
+
}
|
|
193
|
+
function n() {
|
|
194
|
+
try {
|
|
195
|
+
if (!Object.assign)
|
|
196
|
+
return !1;
|
|
197
|
+
var o = new String("abc");
|
|
198
|
+
if (o[5] = "de", Object.getOwnPropertyNames(o)[0] === "5")
|
|
199
|
+
return !1;
|
|
200
|
+
for (var a = {}, s = 0; s < 10; s++)
|
|
201
|
+
a["_" + String.fromCharCode(s)] = s;
|
|
202
|
+
var f = Object.getOwnPropertyNames(a).map(function(p) {
|
|
203
|
+
return a[p];
|
|
204
|
+
});
|
|
205
|
+
if (f.join("") !== "0123456789")
|
|
206
|
+
return !1;
|
|
207
|
+
var u = {};
|
|
208
|
+
return "abcdefghijklmnopqrst".split("").forEach(function(p) {
|
|
209
|
+
u[p] = p;
|
|
210
|
+
}), Object.keys(Object.assign({}, u)).join("") === "abcdefghijklmnopqrst";
|
|
211
|
+
} catch {
|
|
212
|
+
return !1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return Te = n() ? Object.assign : function(o, a) {
|
|
216
|
+
for (var s, f = r(o), u, p = 1; p < arguments.length; p++) {
|
|
217
|
+
s = Object(arguments[p]);
|
|
218
|
+
for (var g in s)
|
|
219
|
+
i.call(s, g) && (f[g] = s[g]);
|
|
220
|
+
if (e) {
|
|
221
|
+
u = e(s);
|
|
222
|
+
for (var b = 0; b < u.length; b++)
|
|
223
|
+
t.call(s, u[b]) && (f[u[b]] = s[u[b]]);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return f;
|
|
227
|
+
}, Te;
|
|
228
|
+
}
|
|
229
|
+
var Ce, Ze;
|
|
230
|
+
function Ye() {
|
|
231
|
+
if (Ze) return Ce;
|
|
232
|
+
Ze = 1;
|
|
233
|
+
var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
234
|
+
return Ce = e, Ce;
|
|
235
|
+
}
|
|
236
|
+
var Oe, Qe;
|
|
237
|
+
function dt() {
|
|
238
|
+
return Qe || (Qe = 1, Oe = Function.call.bind(Object.prototype.hasOwnProperty)), Oe;
|
|
239
|
+
}
|
|
240
|
+
var Me, et;
|
|
241
|
+
function At() {
|
|
242
|
+
if (et) return Me;
|
|
243
|
+
et = 1;
|
|
244
|
+
var e = function() {
|
|
245
|
+
};
|
|
246
|
+
if (process.env.NODE_ENV !== "production") {
|
|
247
|
+
var i = Ye(), t = {}, r = dt();
|
|
248
|
+
e = function(o) {
|
|
249
|
+
var a = "Warning: " + o;
|
|
250
|
+
typeof console < "u" && console.error(a);
|
|
251
|
+
try {
|
|
252
|
+
throw new Error(a);
|
|
253
|
+
} catch {
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function n(o, a, s, f, u) {
|
|
258
|
+
if (process.env.NODE_ENV !== "production") {
|
|
259
|
+
for (var p in o)
|
|
260
|
+
if (r(o, p)) {
|
|
261
|
+
var g;
|
|
262
|
+
try {
|
|
263
|
+
if (typeof o[p] != "function") {
|
|
264
|
+
var b = Error(
|
|
265
|
+
(f || "React class") + ": " + s + " type `" + p + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof o[p] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
|
|
266
|
+
);
|
|
267
|
+
throw b.name = "Invariant Violation", b;
|
|
268
|
+
}
|
|
269
|
+
g = o[p](a, p, f, s, null, i);
|
|
270
|
+
} catch (z) {
|
|
271
|
+
g = z;
|
|
272
|
+
}
|
|
273
|
+
if (g && !(g instanceof Error) && e(
|
|
274
|
+
(f || "React class") + ": type specification of " + s + " `" + p + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof g + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
|
|
275
|
+
), g instanceof Error && !(g.message in t)) {
|
|
276
|
+
t[g.message] = !0;
|
|
277
|
+
var S = u ? u() : "";
|
|
278
|
+
e(
|
|
279
|
+
"Failed " + s + " type: " + g.message + (S ?? "")
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return n.resetWarningCache = function() {
|
|
286
|
+
process.env.NODE_ENV !== "production" && (t = {});
|
|
287
|
+
}, Me = n, Me;
|
|
288
|
+
}
|
|
289
|
+
var We, tt;
|
|
290
|
+
function Nt() {
|
|
291
|
+
if (tt) return We;
|
|
292
|
+
tt = 1;
|
|
293
|
+
var e = pt(), i = Wt(), t = Ye(), r = dt(), n = At(), o = function() {
|
|
294
|
+
};
|
|
295
|
+
process.env.NODE_ENV !== "production" && (o = function(s) {
|
|
296
|
+
var f = "Warning: " + s;
|
|
297
|
+
typeof console < "u" && console.error(f);
|
|
298
|
+
try {
|
|
299
|
+
throw new Error(f);
|
|
300
|
+
} catch {
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
function a() {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
return We = function(s, f) {
|
|
307
|
+
var u = typeof Symbol == "function" && Symbol.iterator, p = "@@iterator";
|
|
308
|
+
function g(c) {
|
|
309
|
+
var m = c && (u && c[u] || c[p]);
|
|
310
|
+
if (typeof m == "function")
|
|
311
|
+
return m;
|
|
312
|
+
}
|
|
313
|
+
var b = "<<anonymous>>", S = {
|
|
314
|
+
array: D("array"),
|
|
315
|
+
bigint: D("bigint"),
|
|
316
|
+
bool: D("boolean"),
|
|
317
|
+
func: D("function"),
|
|
318
|
+
number: D("number"),
|
|
319
|
+
object: D("object"),
|
|
320
|
+
string: D("string"),
|
|
321
|
+
symbol: D("symbol"),
|
|
322
|
+
any: y(),
|
|
323
|
+
arrayOf: h,
|
|
324
|
+
element: d(),
|
|
325
|
+
elementType: l(),
|
|
326
|
+
instanceOf: R,
|
|
327
|
+
node: Y(),
|
|
328
|
+
objectOf: k,
|
|
329
|
+
oneOf: x,
|
|
330
|
+
oneOfType: B,
|
|
331
|
+
shape: j,
|
|
332
|
+
exact: q
|
|
333
|
+
};
|
|
334
|
+
function z(c, m) {
|
|
335
|
+
return c === m ? c !== 0 || 1 / c === 1 / m : c !== c && m !== m;
|
|
336
|
+
}
|
|
337
|
+
function w(c, m) {
|
|
338
|
+
this.message = c, this.data = m && typeof m == "object" ? m : {}, this.stack = "";
|
|
339
|
+
}
|
|
340
|
+
w.prototype = Error.prototype;
|
|
341
|
+
function E(c) {
|
|
342
|
+
if (process.env.NODE_ENV !== "production")
|
|
343
|
+
var m = {}, O = 0;
|
|
344
|
+
function T(M, _, C, W, L, A, Q) {
|
|
345
|
+
if (W = W || b, A = A || C, Q !== t) {
|
|
346
|
+
if (f) {
|
|
347
|
+
var v = new Error(
|
|
348
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
|
|
349
|
+
);
|
|
350
|
+
throw v.name = "Invariant Violation", v;
|
|
351
|
+
} else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
|
|
352
|
+
var se = W + ":" + C;
|
|
353
|
+
!m[se] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
354
|
+
O < 3 && (o(
|
|
355
|
+
"You are manually calling a React.PropTypes validation function for the `" + A + "` prop on `" + W + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
|
|
356
|
+
), m[se] = !0, O++);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return _[C] == null ? M ? _[C] === null ? new w("The " + L + " `" + A + "` is marked as required " + ("in `" + W + "`, but its value is `null`.")) : new w("The " + L + " `" + A + "` is marked as required in " + ("`" + W + "`, but its value is `undefined`.")) : null : c(_, C, W, L, A);
|
|
360
|
+
}
|
|
361
|
+
var P = T.bind(null, !1);
|
|
362
|
+
return P.isRequired = T.bind(null, !0), P;
|
|
363
|
+
}
|
|
364
|
+
function D(c) {
|
|
365
|
+
function m(O, T, P, M, _, C) {
|
|
366
|
+
var W = O[T], L = I(W);
|
|
367
|
+
if (L !== c) {
|
|
368
|
+
var A = Z(W);
|
|
369
|
+
return new w(
|
|
370
|
+
"Invalid " + M + " `" + _ + "` of type " + ("`" + A + "` supplied to `" + P + "`, expected ") + ("`" + c + "`."),
|
|
371
|
+
{ expectedType: c }
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
return E(m);
|
|
377
|
+
}
|
|
378
|
+
function y() {
|
|
379
|
+
return E(a);
|
|
380
|
+
}
|
|
381
|
+
function h(c) {
|
|
382
|
+
function m(O, T, P, M, _) {
|
|
383
|
+
if (typeof c != "function")
|
|
384
|
+
return new w("Property `" + _ + "` of component `" + P + "` has invalid PropType notation inside arrayOf.");
|
|
385
|
+
var C = O[T];
|
|
386
|
+
if (!Array.isArray(C)) {
|
|
387
|
+
var W = I(C);
|
|
388
|
+
return new w("Invalid " + M + " `" + _ + "` of type " + ("`" + W + "` supplied to `" + P + "`, expected an array."));
|
|
389
|
+
}
|
|
390
|
+
for (var L = 0; L < C.length; L++) {
|
|
391
|
+
var A = c(C, L, P, M, _ + "[" + L + "]", t);
|
|
392
|
+
if (A instanceof Error)
|
|
393
|
+
return A;
|
|
394
|
+
}
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
return E(m);
|
|
398
|
+
}
|
|
399
|
+
function d() {
|
|
400
|
+
function c(m, O, T, P, M) {
|
|
401
|
+
var _ = m[O];
|
|
402
|
+
if (!s(_)) {
|
|
403
|
+
var C = I(_);
|
|
404
|
+
return new w("Invalid " + P + " `" + M + "` of type " + ("`" + C + "` supplied to `" + T + "`, expected a single ReactElement."));
|
|
405
|
+
}
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
return E(c);
|
|
409
|
+
}
|
|
410
|
+
function l() {
|
|
411
|
+
function c(m, O, T, P, M) {
|
|
412
|
+
var _ = m[O];
|
|
413
|
+
if (!e.isValidElementType(_)) {
|
|
414
|
+
var C = I(_);
|
|
415
|
+
return new w("Invalid " + P + " `" + M + "` of type " + ("`" + C + "` supplied to `" + T + "`, expected a single ReactElement type."));
|
|
416
|
+
}
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
return E(c);
|
|
420
|
+
}
|
|
421
|
+
function R(c) {
|
|
422
|
+
function m(O, T, P, M, _) {
|
|
423
|
+
if (!(O[T] instanceof c)) {
|
|
424
|
+
var C = c.name || b, W = K(O[T]);
|
|
425
|
+
return new w("Invalid " + M + " `" + _ + "` of type " + ("`" + W + "` supplied to `" + P + "`, expected ") + ("instance of `" + C + "`."));
|
|
426
|
+
}
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
return E(m);
|
|
430
|
+
}
|
|
431
|
+
function x(c) {
|
|
432
|
+
if (!Array.isArray(c))
|
|
433
|
+
return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? o(
|
|
434
|
+
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
435
|
+
) : o("Invalid argument supplied to oneOf, expected an array.")), a;
|
|
436
|
+
function m(O, T, P, M, _) {
|
|
437
|
+
for (var C = O[T], W = 0; W < c.length; W++)
|
|
438
|
+
if (z(C, c[W]))
|
|
439
|
+
return null;
|
|
440
|
+
var L = JSON.stringify(c, function(Q, v) {
|
|
441
|
+
var se = Z(v);
|
|
442
|
+
return se === "symbol" ? String(v) : v;
|
|
443
|
+
});
|
|
444
|
+
return new w("Invalid " + M + " `" + _ + "` of value `" + String(C) + "` " + ("supplied to `" + P + "`, expected one of " + L + "."));
|
|
445
|
+
}
|
|
446
|
+
return E(m);
|
|
447
|
+
}
|
|
448
|
+
function k(c) {
|
|
449
|
+
function m(O, T, P, M, _) {
|
|
450
|
+
if (typeof c != "function")
|
|
451
|
+
return new w("Property `" + _ + "` of component `" + P + "` has invalid PropType notation inside objectOf.");
|
|
452
|
+
var C = O[T], W = I(C);
|
|
453
|
+
if (W !== "object")
|
|
454
|
+
return new w("Invalid " + M + " `" + _ + "` of type " + ("`" + W + "` supplied to `" + P + "`, expected an object."));
|
|
455
|
+
for (var L in C)
|
|
456
|
+
if (r(C, L)) {
|
|
457
|
+
var A = c(C, L, P, M, _ + "." + L, t);
|
|
458
|
+
if (A instanceof Error)
|
|
459
|
+
return A;
|
|
460
|
+
}
|
|
461
|
+
return null;
|
|
462
|
+
}
|
|
463
|
+
return E(m);
|
|
464
|
+
}
|
|
465
|
+
function B(c) {
|
|
466
|
+
if (!Array.isArray(c))
|
|
467
|
+
return process.env.NODE_ENV !== "production" && o("Invalid argument supplied to oneOfType, expected an instance of array."), a;
|
|
468
|
+
for (var m = 0; m < c.length; m++) {
|
|
469
|
+
var O = c[m];
|
|
470
|
+
if (typeof O != "function")
|
|
471
|
+
return o(
|
|
472
|
+
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + ne(O) + " at index " + m + "."
|
|
473
|
+
), a;
|
|
474
|
+
}
|
|
475
|
+
function T(P, M, _, C, W) {
|
|
476
|
+
for (var L = [], A = 0; A < c.length; A++) {
|
|
477
|
+
var Q = c[A], v = Q(P, M, _, C, W, t);
|
|
478
|
+
if (v == null)
|
|
479
|
+
return null;
|
|
480
|
+
v.data && r(v.data, "expectedType") && L.push(v.data.expectedType);
|
|
481
|
+
}
|
|
482
|
+
var se = L.length > 0 ? ", expected one of type [" + L.join(", ") + "]" : "";
|
|
483
|
+
return new w("Invalid " + C + " `" + W + "` supplied to " + ("`" + _ + "`" + se + "."));
|
|
484
|
+
}
|
|
485
|
+
return E(T);
|
|
486
|
+
}
|
|
487
|
+
function Y() {
|
|
488
|
+
function c(m, O, T, P, M) {
|
|
489
|
+
return V(m[O]) ? null : new w("Invalid " + P + " `" + M + "` supplied to " + ("`" + T + "`, expected a ReactNode."));
|
|
490
|
+
}
|
|
491
|
+
return E(c);
|
|
492
|
+
}
|
|
493
|
+
function X(c, m, O, T, P) {
|
|
494
|
+
return new w(
|
|
495
|
+
(c || "React class") + ": " + m + " type `" + O + "." + T + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + P + "`."
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
function j(c) {
|
|
499
|
+
function m(O, T, P, M, _) {
|
|
500
|
+
var C = O[T], W = I(C);
|
|
501
|
+
if (W !== "object")
|
|
502
|
+
return new w("Invalid " + M + " `" + _ + "` of type `" + W + "` " + ("supplied to `" + P + "`, expected `object`."));
|
|
503
|
+
for (var L in c) {
|
|
504
|
+
var A = c[L];
|
|
505
|
+
if (typeof A != "function")
|
|
506
|
+
return X(P, M, _, L, Z(A));
|
|
507
|
+
var Q = A(C, L, P, M, _ + "." + L, t);
|
|
508
|
+
if (Q)
|
|
509
|
+
return Q;
|
|
510
|
+
}
|
|
511
|
+
return null;
|
|
512
|
+
}
|
|
513
|
+
return E(m);
|
|
514
|
+
}
|
|
515
|
+
function q(c) {
|
|
516
|
+
function m(O, T, P, M, _) {
|
|
517
|
+
var C = O[T], W = I(C);
|
|
518
|
+
if (W !== "object")
|
|
519
|
+
return new w("Invalid " + M + " `" + _ + "` of type `" + W + "` " + ("supplied to `" + P + "`, expected `object`."));
|
|
520
|
+
var L = i({}, O[T], c);
|
|
521
|
+
for (var A in L) {
|
|
522
|
+
var Q = c[A];
|
|
523
|
+
if (r(c, A) && typeof Q != "function")
|
|
524
|
+
return X(P, M, _, A, Z(Q));
|
|
525
|
+
if (!Q)
|
|
526
|
+
return new w(
|
|
527
|
+
"Invalid " + M + " `" + _ + "` key `" + A + "` supplied to `" + P + "`.\nBad object: " + JSON.stringify(O[T], null, " ") + `
|
|
528
|
+
Valid keys: ` + JSON.stringify(Object.keys(c), null, " ")
|
|
529
|
+
);
|
|
530
|
+
var v = Q(C, A, P, M, _ + "." + A, t);
|
|
531
|
+
if (v)
|
|
532
|
+
return v;
|
|
533
|
+
}
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
return E(m);
|
|
537
|
+
}
|
|
538
|
+
function V(c) {
|
|
539
|
+
switch (typeof c) {
|
|
540
|
+
case "number":
|
|
541
|
+
case "string":
|
|
542
|
+
case "undefined":
|
|
543
|
+
return !0;
|
|
544
|
+
case "boolean":
|
|
545
|
+
return !c;
|
|
546
|
+
case "object":
|
|
547
|
+
if (Array.isArray(c))
|
|
548
|
+
return c.every(V);
|
|
549
|
+
if (c === null || s(c))
|
|
550
|
+
return !0;
|
|
551
|
+
var m = g(c);
|
|
552
|
+
if (m) {
|
|
553
|
+
var O = m.call(c), T;
|
|
554
|
+
if (m !== c.entries) {
|
|
555
|
+
for (; !(T = O.next()).done; )
|
|
556
|
+
if (!V(T.value))
|
|
557
|
+
return !1;
|
|
558
|
+
} else
|
|
559
|
+
for (; !(T = O.next()).done; ) {
|
|
560
|
+
var P = T.value;
|
|
561
|
+
if (P && !V(P[1]))
|
|
562
|
+
return !1;
|
|
563
|
+
}
|
|
564
|
+
} else
|
|
565
|
+
return !1;
|
|
566
|
+
return !0;
|
|
567
|
+
default:
|
|
568
|
+
return !1;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
function ie(c, m) {
|
|
572
|
+
return c === "symbol" ? !0 : m ? m["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && m instanceof Symbol : !1;
|
|
573
|
+
}
|
|
574
|
+
function I(c) {
|
|
575
|
+
var m = typeof c;
|
|
576
|
+
return Array.isArray(c) ? "array" : c instanceof RegExp ? "object" : ie(m, c) ? "symbol" : m;
|
|
577
|
+
}
|
|
578
|
+
function Z(c) {
|
|
579
|
+
if (typeof c > "u" || c === null)
|
|
580
|
+
return "" + c;
|
|
581
|
+
var m = I(c);
|
|
582
|
+
if (m === "object") {
|
|
583
|
+
if (c instanceof Date)
|
|
584
|
+
return "date";
|
|
585
|
+
if (c instanceof RegExp)
|
|
586
|
+
return "regexp";
|
|
587
|
+
}
|
|
588
|
+
return m;
|
|
589
|
+
}
|
|
590
|
+
function ne(c) {
|
|
591
|
+
var m = Z(c);
|
|
592
|
+
switch (m) {
|
|
593
|
+
case "array":
|
|
594
|
+
case "object":
|
|
595
|
+
return "an " + m;
|
|
596
|
+
case "boolean":
|
|
597
|
+
case "date":
|
|
598
|
+
case "regexp":
|
|
599
|
+
return "a " + m;
|
|
600
|
+
default:
|
|
601
|
+
return m;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function K(c) {
|
|
605
|
+
return !c.constructor || !c.constructor.name ? b : c.constructor.name;
|
|
606
|
+
}
|
|
607
|
+
return S.checkPropTypes = n, S.resetWarningCache = n.resetWarningCache, S.PropTypes = S, S;
|
|
608
|
+
}, We;
|
|
609
|
+
}
|
|
610
|
+
var Ae, rt;
|
|
611
|
+
function Ht() {
|
|
612
|
+
if (rt) return Ae;
|
|
613
|
+
rt = 1;
|
|
614
|
+
var e = Ye();
|
|
615
|
+
function i() {
|
|
616
|
+
}
|
|
617
|
+
function t() {
|
|
618
|
+
}
|
|
619
|
+
return t.resetWarningCache = i, Ae = function() {
|
|
620
|
+
function r(a, s, f, u, p, g) {
|
|
621
|
+
if (g !== e) {
|
|
622
|
+
var b = new Error(
|
|
623
|
+
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
624
|
+
);
|
|
625
|
+
throw b.name = "Invariant Violation", b;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
r.isRequired = r;
|
|
629
|
+
function n() {
|
|
630
|
+
return r;
|
|
631
|
+
}
|
|
632
|
+
var o = {
|
|
633
|
+
array: r,
|
|
634
|
+
bigint: r,
|
|
635
|
+
bool: r,
|
|
636
|
+
func: r,
|
|
637
|
+
number: r,
|
|
638
|
+
object: r,
|
|
639
|
+
string: r,
|
|
640
|
+
symbol: r,
|
|
641
|
+
any: r,
|
|
642
|
+
arrayOf: n,
|
|
643
|
+
element: r,
|
|
644
|
+
elementType: r,
|
|
645
|
+
instanceOf: n,
|
|
646
|
+
node: r,
|
|
647
|
+
objectOf: n,
|
|
648
|
+
oneOf: n,
|
|
649
|
+
oneOfType: n,
|
|
650
|
+
shape: n,
|
|
651
|
+
exact: n,
|
|
652
|
+
checkPropTypes: t,
|
|
653
|
+
resetWarningCache: i
|
|
654
|
+
};
|
|
655
|
+
return o.PropTypes = o, o;
|
|
656
|
+
}, Ae;
|
|
657
|
+
}
|
|
658
|
+
if (process.env.NODE_ENV !== "production") {
|
|
659
|
+
var Lt = pt(), kt = !0;
|
|
660
|
+
je.exports = Nt()(Lt.isElement, kt);
|
|
661
|
+
} else
|
|
662
|
+
je.exports = Ht()();
|
|
663
|
+
var gt = je.exports;
|
|
664
|
+
function vt(e) {
|
|
665
|
+
var i, t, r = "";
|
|
666
|
+
if (typeof e == "string" || typeof e == "number") r += e;
|
|
667
|
+
else if (typeof e == "object") if (Array.isArray(e)) for (i = 0; i < e.length; i++) e[i] && (t = vt(e[i])) && (r && (r += " "), r += t);
|
|
668
|
+
else for (i in e) e[i] && (r && (r += " "), r += i);
|
|
669
|
+
return r;
|
|
670
|
+
}
|
|
671
|
+
function it() {
|
|
672
|
+
for (var e, i, t = 0, r = ""; t < arguments.length; ) (e = arguments[t++]) && (i = vt(e)) && (r && (r += " "), r += i);
|
|
673
|
+
return r;
|
|
674
|
+
}
|
|
675
|
+
const jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
676
|
+
__proto__: null,
|
|
677
|
+
clsx: it,
|
|
678
|
+
default: it
|
|
679
|
+
}, Symbol.toStringTag, { value: "Module" })), It = /* @__PURE__ */ _t(jt);
|
|
680
|
+
var $ = {}, le = {};
|
|
681
|
+
Object.defineProperty(le, "__esModule", {
|
|
682
|
+
value: !0
|
|
683
|
+
});
|
|
684
|
+
le.dontSetMe = Ut;
|
|
685
|
+
le.findInArray = Yt;
|
|
686
|
+
le.int = Ft;
|
|
687
|
+
le.isFunction = $t;
|
|
688
|
+
le.isNum = Bt;
|
|
689
|
+
function Yt(e, i) {
|
|
690
|
+
for (let t = 0, r = e.length; t < r; t++)
|
|
691
|
+
if (i.apply(i, [e[t], t, e])) return e[t];
|
|
692
|
+
}
|
|
693
|
+
function $t(e) {
|
|
694
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Function]";
|
|
695
|
+
}
|
|
696
|
+
function Bt(e) {
|
|
697
|
+
return typeof e == "number" && !isNaN(e);
|
|
698
|
+
}
|
|
699
|
+
function Ft(e) {
|
|
700
|
+
return parseInt(e, 10);
|
|
701
|
+
}
|
|
702
|
+
function Ut(e, i, t) {
|
|
703
|
+
if (e[i])
|
|
704
|
+
return new Error("Invalid prop ".concat(i, " passed to ").concat(t, " - do not set this, set it on the child."));
|
|
705
|
+
}
|
|
706
|
+
var de = {};
|
|
707
|
+
Object.defineProperty(de, "__esModule", {
|
|
708
|
+
value: !0
|
|
709
|
+
});
|
|
710
|
+
de.browserPrefixToKey = mt;
|
|
711
|
+
de.browserPrefixToStyle = Xt;
|
|
712
|
+
de.default = void 0;
|
|
713
|
+
de.getPrefix = yt;
|
|
714
|
+
const Ne = ["Moz", "Webkit", "O", "ms"];
|
|
715
|
+
function yt() {
|
|
716
|
+
var e;
|
|
717
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
|
|
718
|
+
if (typeof window > "u") return "";
|
|
719
|
+
const t = (e = window.document) === null || e === void 0 || (e = e.documentElement) === null || e === void 0 ? void 0 : e.style;
|
|
720
|
+
if (!t || i in t) return "";
|
|
721
|
+
for (let r = 0; r < Ne.length; r++)
|
|
722
|
+
if (mt(i, Ne[r]) in t) return Ne[r];
|
|
723
|
+
return "";
|
|
724
|
+
}
|
|
725
|
+
function mt(e, i) {
|
|
726
|
+
return i ? "".concat(i).concat(qt(e)) : e;
|
|
727
|
+
}
|
|
728
|
+
function Xt(e, i) {
|
|
729
|
+
return i ? "-".concat(i.toLowerCase(), "-").concat(e) : e;
|
|
730
|
+
}
|
|
731
|
+
function qt(e) {
|
|
732
|
+
let i = "", t = !0;
|
|
733
|
+
for (let r = 0; r < e.length; r++)
|
|
734
|
+
t ? (i += e[r].toUpperCase(), t = !1) : e[r] === "-" ? t = !0 : i += e[r];
|
|
735
|
+
return i;
|
|
736
|
+
}
|
|
737
|
+
de.default = yt();
|
|
738
|
+
Object.defineProperty($, "__esModule", {
|
|
739
|
+
value: !0
|
|
740
|
+
});
|
|
741
|
+
$.addClassName = St;
|
|
742
|
+
$.addEvent = Kt;
|
|
743
|
+
$.addUserSelectStyles = ar;
|
|
744
|
+
$.createCSSTransform = ir;
|
|
745
|
+
$.createSVGTransform = nr;
|
|
746
|
+
$.getTouch = or;
|
|
747
|
+
$.getTouchIdentifier = sr;
|
|
748
|
+
$.getTranslation = $e;
|
|
749
|
+
$.innerHeight = er;
|
|
750
|
+
$.innerWidth = tr;
|
|
751
|
+
$.matchesSelector = wt;
|
|
752
|
+
$.matchesSelectorAndParentsTo = Vt;
|
|
753
|
+
$.offsetXYFromParent = rr;
|
|
754
|
+
$.outerHeight = Zt;
|
|
755
|
+
$.outerWidth = Qt;
|
|
756
|
+
$.removeClassName = xt;
|
|
757
|
+
$.removeEvent = Jt;
|
|
758
|
+
$.removeUserSelectStyles = lr;
|
|
759
|
+
var re = le, nt = Gt(de);
|
|
760
|
+
function bt(e) {
|
|
761
|
+
if (typeof WeakMap != "function") return null;
|
|
762
|
+
var i = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
763
|
+
return (bt = function(r) {
|
|
764
|
+
return r ? t : i;
|
|
765
|
+
})(e);
|
|
766
|
+
}
|
|
767
|
+
function Gt(e, i) {
|
|
768
|
+
if (e && e.__esModule)
|
|
769
|
+
return e;
|
|
770
|
+
if (e === null || typeof e != "object" && typeof e != "function")
|
|
771
|
+
return { default: e };
|
|
772
|
+
var t = bt(i);
|
|
773
|
+
if (t && t.has(e))
|
|
774
|
+
return t.get(e);
|
|
775
|
+
var r = {}, n = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
776
|
+
for (var o in e)
|
|
777
|
+
if (o !== "default" && Object.prototype.hasOwnProperty.call(e, o)) {
|
|
778
|
+
var a = n ? Object.getOwnPropertyDescriptor(e, o) : null;
|
|
779
|
+
a && (a.get || a.set) ? Object.defineProperty(r, o, a) : r[o] = e[o];
|
|
780
|
+
}
|
|
781
|
+
return r.default = e, t && t.set(e, r), r;
|
|
782
|
+
}
|
|
783
|
+
let we = "";
|
|
784
|
+
function wt(e, i) {
|
|
785
|
+
return we || (we = (0, re.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(t) {
|
|
786
|
+
return (0, re.isFunction)(e[t]);
|
|
787
|
+
})), (0, re.isFunction)(e[we]) ? e[we](i) : !1;
|
|
788
|
+
}
|
|
789
|
+
function Vt(e, i, t) {
|
|
790
|
+
let r = e;
|
|
791
|
+
do {
|
|
792
|
+
if (wt(r, i)) return !0;
|
|
793
|
+
if (r === t) return !1;
|
|
794
|
+
r = r.parentNode;
|
|
795
|
+
} while (r);
|
|
796
|
+
return !1;
|
|
797
|
+
}
|
|
798
|
+
function Kt(e, i, t, r) {
|
|
799
|
+
if (!e) return;
|
|
800
|
+
const n = {
|
|
801
|
+
capture: !0,
|
|
802
|
+
...r
|
|
803
|
+
};
|
|
804
|
+
e.addEventListener ? e.addEventListener(i, t, n) : e.attachEvent ? e.attachEvent("on" + i, t) : e["on" + i] = t;
|
|
805
|
+
}
|
|
806
|
+
function Jt(e, i, t, r) {
|
|
807
|
+
if (!e) return;
|
|
808
|
+
const n = {
|
|
809
|
+
capture: !0,
|
|
810
|
+
...r
|
|
811
|
+
};
|
|
812
|
+
e.removeEventListener ? e.removeEventListener(i, t, n) : e.detachEvent ? e.detachEvent("on" + i, t) : e["on" + i] = null;
|
|
813
|
+
}
|
|
814
|
+
function Zt(e) {
|
|
815
|
+
let i = e.clientHeight;
|
|
816
|
+
const t = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
817
|
+
return i += (0, re.int)(t.borderTopWidth), i += (0, re.int)(t.borderBottomWidth), i;
|
|
818
|
+
}
|
|
819
|
+
function Qt(e) {
|
|
820
|
+
let i = e.clientWidth;
|
|
821
|
+
const t = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
822
|
+
return i += (0, re.int)(t.borderLeftWidth), i += (0, re.int)(t.borderRightWidth), i;
|
|
823
|
+
}
|
|
824
|
+
function er(e) {
|
|
825
|
+
let i = e.clientHeight;
|
|
826
|
+
const t = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
827
|
+
return i -= (0, re.int)(t.paddingTop), i -= (0, re.int)(t.paddingBottom), i;
|
|
828
|
+
}
|
|
829
|
+
function tr(e) {
|
|
830
|
+
let i = e.clientWidth;
|
|
831
|
+
const t = e.ownerDocument.defaultView.getComputedStyle(e);
|
|
832
|
+
return i -= (0, re.int)(t.paddingLeft), i -= (0, re.int)(t.paddingRight), i;
|
|
833
|
+
}
|
|
834
|
+
function rr(e, i, t) {
|
|
835
|
+
const n = i === i.ownerDocument.body ? {
|
|
836
|
+
left: 0,
|
|
837
|
+
top: 0
|
|
838
|
+
} : i.getBoundingClientRect(), o = (e.clientX + i.scrollLeft - n.left) / t, a = (e.clientY + i.scrollTop - n.top) / t;
|
|
839
|
+
return {
|
|
840
|
+
x: o,
|
|
841
|
+
y: a
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
function ir(e, i) {
|
|
845
|
+
const t = $e(e, i, "px");
|
|
846
|
+
return {
|
|
847
|
+
[(0, nt.browserPrefixToKey)("transform", nt.default)]: t
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
function nr(e, i) {
|
|
851
|
+
return $e(e, i, "");
|
|
852
|
+
}
|
|
853
|
+
function $e(e, i, t) {
|
|
854
|
+
let {
|
|
855
|
+
x: r,
|
|
856
|
+
y: n
|
|
857
|
+
} = e, o = "translate(".concat(r).concat(t, ",").concat(n).concat(t, ")");
|
|
858
|
+
if (i) {
|
|
859
|
+
const a = "".concat(typeof i.x == "string" ? i.x : i.x + t), s = "".concat(typeof i.y == "string" ? i.y : i.y + t);
|
|
860
|
+
o = "translate(".concat(a, ", ").concat(s, ")") + o;
|
|
861
|
+
}
|
|
862
|
+
return o;
|
|
863
|
+
}
|
|
864
|
+
function or(e, i) {
|
|
865
|
+
return e.targetTouches && (0, re.findInArray)(e.targetTouches, (t) => i === t.identifier) || e.changedTouches && (0, re.findInArray)(e.changedTouches, (t) => i === t.identifier);
|
|
866
|
+
}
|
|
867
|
+
function sr(e) {
|
|
868
|
+
if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
|
|
869
|
+
if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
|
|
870
|
+
}
|
|
871
|
+
function ar(e) {
|
|
872
|
+
if (!e) return;
|
|
873
|
+
let i = e.getElementById("react-draggable-style-el");
|
|
874
|
+
i || (i = e.createElement("style"), i.type = "text/css", i.id = "react-draggable-style-el", i.innerHTML = `.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
|
|
875
|
+
`, i.innerHTML += `.react-draggable-transparent-selection *::selection {all: inherit;}
|
|
876
|
+
`, e.getElementsByTagName("head")[0].appendChild(i)), e.body && St(e.body, "react-draggable-transparent-selection");
|
|
877
|
+
}
|
|
878
|
+
function lr(e) {
|
|
879
|
+
if (e)
|
|
880
|
+
try {
|
|
881
|
+
if (e.body && xt(e.body, "react-draggable-transparent-selection"), e.selection)
|
|
882
|
+
e.selection.empty();
|
|
883
|
+
else {
|
|
884
|
+
const i = (e.defaultView || window).getSelection();
|
|
885
|
+
i && i.type !== "Caret" && i.removeAllRanges();
|
|
886
|
+
}
|
|
887
|
+
} catch {
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
function St(e, i) {
|
|
891
|
+
e.classList ? e.classList.add(i) : e.className.match(new RegExp("(?:^|\\s)".concat(i, "(?!\\S)"))) || (e.className += " ".concat(i));
|
|
892
|
+
}
|
|
893
|
+
function xt(e, i) {
|
|
894
|
+
e.classList ? e.classList.remove(i) : e.className = e.className.replace(new RegExp("(?:^|\\s)".concat(i, "(?!\\S)"), "g"), "");
|
|
895
|
+
}
|
|
896
|
+
var ue = {};
|
|
897
|
+
Object.defineProperty(ue, "__esModule", {
|
|
898
|
+
value: !0
|
|
899
|
+
});
|
|
900
|
+
ue.canDragX = cr;
|
|
901
|
+
ue.canDragY = hr;
|
|
902
|
+
ue.createCoreData = dr;
|
|
903
|
+
ue.createDraggableData = gr;
|
|
904
|
+
ue.getBoundPosition = ur;
|
|
905
|
+
ue.getControlPosition = pr;
|
|
906
|
+
ue.snapToGrid = fr;
|
|
907
|
+
var te = le, ve = $;
|
|
908
|
+
function ur(e, i, t) {
|
|
909
|
+
if (!e.props.bounds) return [i, t];
|
|
910
|
+
let {
|
|
911
|
+
bounds: r
|
|
912
|
+
} = e.props;
|
|
913
|
+
r = typeof r == "string" ? r : vr(r);
|
|
914
|
+
const n = Be(e);
|
|
915
|
+
if (typeof r == "string") {
|
|
916
|
+
const {
|
|
917
|
+
ownerDocument: o
|
|
918
|
+
} = n, a = o.defaultView;
|
|
919
|
+
let s;
|
|
920
|
+
if (r === "parent" ? s = n.parentNode : s = o.querySelector(r), !(s instanceof a.HTMLElement))
|
|
921
|
+
throw new Error('Bounds selector "' + r + '" could not find an element.');
|
|
922
|
+
const f = s, u = a.getComputedStyle(n), p = a.getComputedStyle(f);
|
|
923
|
+
r = {
|
|
924
|
+
left: -n.offsetLeft + (0, te.int)(p.paddingLeft) + (0, te.int)(u.marginLeft),
|
|
925
|
+
top: -n.offsetTop + (0, te.int)(p.paddingTop) + (0, te.int)(u.marginTop),
|
|
926
|
+
right: (0, ve.innerWidth)(f) - (0, ve.outerWidth)(n) - n.offsetLeft + (0, te.int)(p.paddingRight) - (0, te.int)(u.marginRight),
|
|
927
|
+
bottom: (0, ve.innerHeight)(f) - (0, ve.outerHeight)(n) - n.offsetTop + (0, te.int)(p.paddingBottom) - (0, te.int)(u.marginBottom)
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
return (0, te.isNum)(r.right) && (i = Math.min(i, r.right)), (0, te.isNum)(r.bottom) && (t = Math.min(t, r.bottom)), (0, te.isNum)(r.left) && (i = Math.max(i, r.left)), (0, te.isNum)(r.top) && (t = Math.max(t, r.top)), [i, t];
|
|
931
|
+
}
|
|
932
|
+
function fr(e, i, t) {
|
|
933
|
+
const r = Math.round(i / e[0]) * e[0], n = Math.round(t / e[1]) * e[1];
|
|
934
|
+
return [r, n];
|
|
935
|
+
}
|
|
936
|
+
function cr(e) {
|
|
937
|
+
return e.props.axis === "both" || e.props.axis === "x";
|
|
938
|
+
}
|
|
939
|
+
function hr(e) {
|
|
940
|
+
return e.props.axis === "both" || e.props.axis === "y";
|
|
941
|
+
}
|
|
942
|
+
function pr(e, i, t) {
|
|
943
|
+
const r = typeof i == "number" ? (0, ve.getTouch)(e, i) : null;
|
|
944
|
+
if (typeof i == "number" && !r) return null;
|
|
945
|
+
const n = Be(t), o = t.props.offsetParent || n.offsetParent || n.ownerDocument.body;
|
|
946
|
+
return (0, ve.offsetXYFromParent)(r || e, o, t.props.scale);
|
|
947
|
+
}
|
|
948
|
+
function dr(e, i, t) {
|
|
949
|
+
const r = !(0, te.isNum)(e.lastX), n = Be(e);
|
|
950
|
+
return r ? {
|
|
951
|
+
node: n,
|
|
952
|
+
deltaX: 0,
|
|
953
|
+
deltaY: 0,
|
|
954
|
+
lastX: i,
|
|
955
|
+
lastY: t,
|
|
956
|
+
x: i,
|
|
957
|
+
y: t
|
|
958
|
+
} : {
|
|
959
|
+
node: n,
|
|
960
|
+
deltaX: i - e.lastX,
|
|
961
|
+
deltaY: t - e.lastY,
|
|
962
|
+
lastX: e.lastX,
|
|
963
|
+
lastY: e.lastY,
|
|
964
|
+
x: i,
|
|
965
|
+
y: t
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
function gr(e, i) {
|
|
969
|
+
const t = e.props.scale;
|
|
970
|
+
return {
|
|
971
|
+
node: i.node,
|
|
972
|
+
x: e.state.x + i.deltaX / t,
|
|
973
|
+
y: e.state.y + i.deltaY / t,
|
|
974
|
+
deltaX: i.deltaX / t,
|
|
975
|
+
deltaY: i.deltaY / t,
|
|
976
|
+
lastX: e.state.x,
|
|
977
|
+
lastY: e.state.y
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
function vr(e) {
|
|
981
|
+
return {
|
|
982
|
+
left: e.left,
|
|
983
|
+
top: e.top,
|
|
984
|
+
right: e.right,
|
|
985
|
+
bottom: e.bottom
|
|
986
|
+
};
|
|
987
|
+
}
|
|
988
|
+
function Be(e) {
|
|
989
|
+
const i = e.findDOMNode();
|
|
990
|
+
if (!i)
|
|
991
|
+
throw new Error("<DraggableCore>: Unmounted during event!");
|
|
992
|
+
return i;
|
|
993
|
+
}
|
|
994
|
+
var Re = {}, _e = {};
|
|
995
|
+
Object.defineProperty(_e, "__esModule", {
|
|
996
|
+
value: !0
|
|
997
|
+
});
|
|
998
|
+
_e.default = yr;
|
|
999
|
+
function yr() {
|
|
1000
|
+
}
|
|
1001
|
+
Object.defineProperty(Re, "__esModule", {
|
|
1002
|
+
value: !0
|
|
1003
|
+
});
|
|
1004
|
+
Re.default = void 0;
|
|
1005
|
+
var He = br(ft), ee = Fe(gt), mr = Fe(ct), G = $, fe = ue, Le = le, ye = Fe(_e);
|
|
1006
|
+
function Fe(e) {
|
|
1007
|
+
return e && e.__esModule ? e : { default: e };
|
|
1008
|
+
}
|
|
1009
|
+
function zt(e) {
|
|
1010
|
+
if (typeof WeakMap != "function") return null;
|
|
1011
|
+
var i = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
1012
|
+
return (zt = function(r) {
|
|
1013
|
+
return r ? t : i;
|
|
1014
|
+
})(e);
|
|
1015
|
+
}
|
|
1016
|
+
function br(e, i) {
|
|
1017
|
+
if (e && e.__esModule)
|
|
1018
|
+
return e;
|
|
1019
|
+
if (e === null || typeof e != "object" && typeof e != "function")
|
|
1020
|
+
return { default: e };
|
|
1021
|
+
var t = zt(i);
|
|
1022
|
+
if (t && t.has(e))
|
|
1023
|
+
return t.get(e);
|
|
1024
|
+
var r = {}, n = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
1025
|
+
for (var o in e)
|
|
1026
|
+
if (o !== "default" && Object.prototype.hasOwnProperty.call(e, o)) {
|
|
1027
|
+
var a = n ? Object.getOwnPropertyDescriptor(e, o) : null;
|
|
1028
|
+
a && (a.get || a.set) ? Object.defineProperty(r, o, a) : r[o] = e[o];
|
|
1029
|
+
}
|
|
1030
|
+
return r.default = e, t && t.set(e, r), r;
|
|
1031
|
+
}
|
|
1032
|
+
function J(e, i, t) {
|
|
1033
|
+
return i = wr(i), i in e ? Object.defineProperty(e, i, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[i] = t, e;
|
|
1034
|
+
}
|
|
1035
|
+
function wr(e) {
|
|
1036
|
+
var i = Sr(e, "string");
|
|
1037
|
+
return typeof i == "symbol" ? i : String(i);
|
|
1038
|
+
}
|
|
1039
|
+
function Sr(e, i) {
|
|
1040
|
+
if (typeof e != "object" || e === null) return e;
|
|
1041
|
+
var t = e[Symbol.toPrimitive];
|
|
1042
|
+
if (t !== void 0) {
|
|
1043
|
+
var r = t.call(e, i || "default");
|
|
1044
|
+
if (typeof r != "object") return r;
|
|
1045
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1046
|
+
}
|
|
1047
|
+
return (i === "string" ? String : Number)(e);
|
|
1048
|
+
}
|
|
1049
|
+
const oe = {
|
|
1050
|
+
touch: {
|
|
1051
|
+
start: "touchstart",
|
|
1052
|
+
move: "touchmove",
|
|
1053
|
+
stop: "touchend"
|
|
1054
|
+
},
|
|
1055
|
+
mouse: {
|
|
1056
|
+
start: "mousedown",
|
|
1057
|
+
move: "mousemove",
|
|
1058
|
+
stop: "mouseup"
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
let ce = oe.mouse, De = class extends He.Component {
|
|
1062
|
+
constructor() {
|
|
1063
|
+
super(...arguments), J(this, "dragging", !1), J(this, "lastX", NaN), J(this, "lastY", NaN), J(this, "touchIdentifier", null), J(this, "mounted", !1), J(this, "handleDragStart", (i) => {
|
|
1064
|
+
if (this.props.onMouseDown(i), !this.props.allowAnyClick && typeof i.button == "number" && i.button !== 0) return !1;
|
|
1065
|
+
const t = this.findDOMNode();
|
|
1066
|
+
if (!t || !t.ownerDocument || !t.ownerDocument.body)
|
|
1067
|
+
throw new Error("<DraggableCore> not mounted on DragStart!");
|
|
1068
|
+
const {
|
|
1069
|
+
ownerDocument: r
|
|
1070
|
+
} = t;
|
|
1071
|
+
if (this.props.disabled || !(i.target instanceof r.defaultView.Node) || this.props.handle && !(0, G.matchesSelectorAndParentsTo)(i.target, this.props.handle, t) || this.props.cancel && (0, G.matchesSelectorAndParentsTo)(i.target, this.props.cancel, t))
|
|
1072
|
+
return;
|
|
1073
|
+
i.type === "touchstart" && i.preventDefault();
|
|
1074
|
+
const n = (0, G.getTouchIdentifier)(i);
|
|
1075
|
+
this.touchIdentifier = n;
|
|
1076
|
+
const o = (0, fe.getControlPosition)(i, n, this);
|
|
1077
|
+
if (o == null) return;
|
|
1078
|
+
const {
|
|
1079
|
+
x: a,
|
|
1080
|
+
y: s
|
|
1081
|
+
} = o, f = (0, fe.createCoreData)(this, a, s);
|
|
1082
|
+
(0, ye.default)("DraggableCore: handleDragStart: %j", f), (0, ye.default)("calling", this.props.onStart), !(this.props.onStart(i, f) === !1 || this.mounted === !1) && (this.props.enableUserSelectHack && (0, G.addUserSelectStyles)(r), this.dragging = !0, this.lastX = a, this.lastY = s, (0, G.addEvent)(r, ce.move, this.handleDrag), (0, G.addEvent)(r, ce.stop, this.handleDragStop));
|
|
1083
|
+
}), J(this, "handleDrag", (i) => {
|
|
1084
|
+
const t = (0, fe.getControlPosition)(i, this.touchIdentifier, this);
|
|
1085
|
+
if (t == null) return;
|
|
1086
|
+
let {
|
|
1087
|
+
x: r,
|
|
1088
|
+
y: n
|
|
1089
|
+
} = t;
|
|
1090
|
+
if (Array.isArray(this.props.grid)) {
|
|
1091
|
+
let s = r - this.lastX, f = n - this.lastY;
|
|
1092
|
+
if ([s, f] = (0, fe.snapToGrid)(this.props.grid, s, f), !s && !f) return;
|
|
1093
|
+
r = this.lastX + s, n = this.lastY + f;
|
|
1094
|
+
}
|
|
1095
|
+
const o = (0, fe.createCoreData)(this, r, n);
|
|
1096
|
+
if ((0, ye.default)("DraggableCore: handleDrag: %j", o), this.props.onDrag(i, o) === !1 || this.mounted === !1) {
|
|
1097
|
+
try {
|
|
1098
|
+
this.handleDragStop(new MouseEvent("mouseup"));
|
|
1099
|
+
} catch {
|
|
1100
|
+
const f = document.createEvent("MouseEvents");
|
|
1101
|
+
f.initMouseEvent("mouseup", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), this.handleDragStop(f);
|
|
1102
|
+
}
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
this.lastX = r, this.lastY = n;
|
|
1106
|
+
}), J(this, "handleDragStop", (i) => {
|
|
1107
|
+
if (!this.dragging) return;
|
|
1108
|
+
const t = (0, fe.getControlPosition)(i, this.touchIdentifier, this);
|
|
1109
|
+
if (t == null) return;
|
|
1110
|
+
let {
|
|
1111
|
+
x: r,
|
|
1112
|
+
y: n
|
|
1113
|
+
} = t;
|
|
1114
|
+
if (Array.isArray(this.props.grid)) {
|
|
1115
|
+
let f = r - this.lastX || 0, u = n - this.lastY || 0;
|
|
1116
|
+
[f, u] = (0, fe.snapToGrid)(this.props.grid, f, u), r = this.lastX + f, n = this.lastY + u;
|
|
1117
|
+
}
|
|
1118
|
+
const o = (0, fe.createCoreData)(this, r, n);
|
|
1119
|
+
if (this.props.onStop(i, o) === !1 || this.mounted === !1) return !1;
|
|
1120
|
+
const s = this.findDOMNode();
|
|
1121
|
+
s && this.props.enableUserSelectHack && (0, G.removeUserSelectStyles)(s.ownerDocument), (0, ye.default)("DraggableCore: handleDragStop: %j", o), this.dragging = !1, this.lastX = NaN, this.lastY = NaN, s && ((0, ye.default)("DraggableCore: Removing handlers"), (0, G.removeEvent)(s.ownerDocument, ce.move, this.handleDrag), (0, G.removeEvent)(s.ownerDocument, ce.stop, this.handleDragStop));
|
|
1122
|
+
}), J(this, "onMouseDown", (i) => (ce = oe.mouse, this.handleDragStart(i))), J(this, "onMouseUp", (i) => (ce = oe.mouse, this.handleDragStop(i))), J(this, "onTouchStart", (i) => (ce = oe.touch, this.handleDragStart(i))), J(this, "onTouchEnd", (i) => (ce = oe.touch, this.handleDragStop(i)));
|
|
1123
|
+
}
|
|
1124
|
+
componentDidMount() {
|
|
1125
|
+
this.mounted = !0;
|
|
1126
|
+
const i = this.findDOMNode();
|
|
1127
|
+
i && (0, G.addEvent)(i, oe.touch.start, this.onTouchStart, {
|
|
1128
|
+
passive: !1
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
componentWillUnmount() {
|
|
1132
|
+
this.mounted = !1;
|
|
1133
|
+
const i = this.findDOMNode();
|
|
1134
|
+
if (i) {
|
|
1135
|
+
const {
|
|
1136
|
+
ownerDocument: t
|
|
1137
|
+
} = i;
|
|
1138
|
+
(0, G.removeEvent)(t, oe.mouse.move, this.handleDrag), (0, G.removeEvent)(t, oe.touch.move, this.handleDrag), (0, G.removeEvent)(t, oe.mouse.stop, this.handleDragStop), (0, G.removeEvent)(t, oe.touch.stop, this.handleDragStop), (0, G.removeEvent)(i, oe.touch.start, this.onTouchStart, {
|
|
1139
|
+
passive: !1
|
|
1140
|
+
}), this.props.enableUserSelectHack && (0, G.removeUserSelectStyles)(t);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
// React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
|
|
1144
|
+
// the underlying DOM node ourselves. See the README for more information.
|
|
1145
|
+
findDOMNode() {
|
|
1146
|
+
var i, t;
|
|
1147
|
+
return (i = this.props) !== null && i !== void 0 && i.nodeRef ? (t = this.props) === null || t === void 0 || (t = t.nodeRef) === null || t === void 0 ? void 0 : t.current : mr.default.findDOMNode(this);
|
|
1148
|
+
}
|
|
1149
|
+
render() {
|
|
1150
|
+
return /* @__PURE__ */ He.cloneElement(He.Children.only(this.props.children), {
|
|
1151
|
+
// Note: mouseMove handler is attached to document so it will still function
|
|
1152
|
+
// when the user drags quickly and leaves the bounds of the element.
|
|
1153
|
+
onMouseDown: this.onMouseDown,
|
|
1154
|
+
onMouseUp: this.onMouseUp,
|
|
1155
|
+
// onTouchStart is added on `componentDidMount` so they can be added with
|
|
1156
|
+
// {passive: false}, which allows it to cancel. See
|
|
1157
|
+
// https://developers.google.com/web/updates/2017/01/scrolling-intervention
|
|
1158
|
+
onTouchEnd: this.onTouchEnd
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
Re.default = De;
|
|
1163
|
+
J(De, "displayName", "DraggableCore");
|
|
1164
|
+
J(De, "propTypes", {
|
|
1165
|
+
/**
|
|
1166
|
+
* `allowAnyClick` allows dragging using any mouse button.
|
|
1167
|
+
* By default, we only accept the left button.
|
|
1168
|
+
*
|
|
1169
|
+
* Defaults to `false`.
|
|
1170
|
+
*/
|
|
1171
|
+
allowAnyClick: ee.default.bool,
|
|
1172
|
+
children: ee.default.node.isRequired,
|
|
1173
|
+
/**
|
|
1174
|
+
* `disabled`, if true, stops the <Draggable> from dragging. All handlers,
|
|
1175
|
+
* with the exception of `onMouseDown`, will not fire.
|
|
1176
|
+
*/
|
|
1177
|
+
disabled: ee.default.bool,
|
|
1178
|
+
/**
|
|
1179
|
+
* By default, we add 'user-select:none' attributes to the document body
|
|
1180
|
+
* to prevent ugly text selection during drag. If this is causing problems
|
|
1181
|
+
* for your app, set this to `false`.
|
|
1182
|
+
*/
|
|
1183
|
+
enableUserSelectHack: ee.default.bool,
|
|
1184
|
+
/**
|
|
1185
|
+
* `offsetParent`, if set, uses the passed DOM node to compute drag offsets
|
|
1186
|
+
* instead of using the parent node.
|
|
1187
|
+
*/
|
|
1188
|
+
offsetParent: function(e, i) {
|
|
1189
|
+
if (e[i] && e[i].nodeType !== 1)
|
|
1190
|
+
throw new Error("Draggable's offsetParent must be a DOM Node.");
|
|
1191
|
+
},
|
|
1192
|
+
/**
|
|
1193
|
+
* `grid` specifies the x and y that dragging should snap to.
|
|
1194
|
+
*/
|
|
1195
|
+
grid: ee.default.arrayOf(ee.default.number),
|
|
1196
|
+
/**
|
|
1197
|
+
* `handle` specifies a selector to be used as the handle that initiates drag.
|
|
1198
|
+
*
|
|
1199
|
+
* Example:
|
|
1200
|
+
*
|
|
1201
|
+
* ```jsx
|
|
1202
|
+
* let App = React.createClass({
|
|
1203
|
+
* render: function () {
|
|
1204
|
+
* return (
|
|
1205
|
+
* <Draggable handle=".handle">
|
|
1206
|
+
* <div>
|
|
1207
|
+
* <div className="handle">Click me to drag</div>
|
|
1208
|
+
* <div>This is some other content</div>
|
|
1209
|
+
* </div>
|
|
1210
|
+
* </Draggable>
|
|
1211
|
+
* );
|
|
1212
|
+
* }
|
|
1213
|
+
* });
|
|
1214
|
+
* ```
|
|
1215
|
+
*/
|
|
1216
|
+
handle: ee.default.string,
|
|
1217
|
+
/**
|
|
1218
|
+
* `cancel` specifies a selector to be used to prevent drag initialization.
|
|
1219
|
+
*
|
|
1220
|
+
* Example:
|
|
1221
|
+
*
|
|
1222
|
+
* ```jsx
|
|
1223
|
+
* let App = React.createClass({
|
|
1224
|
+
* render: function () {
|
|
1225
|
+
* return(
|
|
1226
|
+
* <Draggable cancel=".cancel">
|
|
1227
|
+
* <div>
|
|
1228
|
+
* <div className="cancel">You can't drag from here</div>
|
|
1229
|
+
* <div>Dragging here works fine</div>
|
|
1230
|
+
* </div>
|
|
1231
|
+
* </Draggable>
|
|
1232
|
+
* );
|
|
1233
|
+
* }
|
|
1234
|
+
* });
|
|
1235
|
+
* ```
|
|
1236
|
+
*/
|
|
1237
|
+
cancel: ee.default.string,
|
|
1238
|
+
/* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
|
|
1239
|
+
* Unfortunately, in order for <Draggable> to work properly, we need raw access
|
|
1240
|
+
* to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
|
|
1241
|
+
* as in this example:
|
|
1242
|
+
*
|
|
1243
|
+
* function MyComponent() {
|
|
1244
|
+
* const nodeRef = React.useRef(null);
|
|
1245
|
+
* return (
|
|
1246
|
+
* <Draggable nodeRef={nodeRef}>
|
|
1247
|
+
* <div ref={nodeRef}>Example Target</div>
|
|
1248
|
+
* </Draggable>
|
|
1249
|
+
* );
|
|
1250
|
+
* }
|
|
1251
|
+
*
|
|
1252
|
+
* This can be used for arbitrarily nested components, so long as the ref ends up
|
|
1253
|
+
* pointing to the actual child DOM node and not a custom component.
|
|
1254
|
+
*/
|
|
1255
|
+
nodeRef: ee.default.object,
|
|
1256
|
+
/**
|
|
1257
|
+
* Called when dragging starts.
|
|
1258
|
+
* If this function returns the boolean false, dragging will be canceled.
|
|
1259
|
+
*/
|
|
1260
|
+
onStart: ee.default.func,
|
|
1261
|
+
/**
|
|
1262
|
+
* Called while dragging.
|
|
1263
|
+
* If this function returns the boolean false, dragging will be canceled.
|
|
1264
|
+
*/
|
|
1265
|
+
onDrag: ee.default.func,
|
|
1266
|
+
/**
|
|
1267
|
+
* Called when dragging stops.
|
|
1268
|
+
* If this function returns the boolean false, the drag will remain active.
|
|
1269
|
+
*/
|
|
1270
|
+
onStop: ee.default.func,
|
|
1271
|
+
/**
|
|
1272
|
+
* A workaround option which can be passed if onMouseDown needs to be accessed,
|
|
1273
|
+
* since it'll always be blocked (as there is internal use of onMouseDown)
|
|
1274
|
+
*/
|
|
1275
|
+
onMouseDown: ee.default.func,
|
|
1276
|
+
/**
|
|
1277
|
+
* `scale`, if set, applies scaling while dragging an element
|
|
1278
|
+
*/
|
|
1279
|
+
scale: ee.default.number,
|
|
1280
|
+
/**
|
|
1281
|
+
* These properties should be defined on the child, not here.
|
|
1282
|
+
*/
|
|
1283
|
+
className: Le.dontSetMe,
|
|
1284
|
+
style: Le.dontSetMe,
|
|
1285
|
+
transform: Le.dontSetMe
|
|
1286
|
+
});
|
|
1287
|
+
J(De, "defaultProps", {
|
|
1288
|
+
allowAnyClick: !1,
|
|
1289
|
+
// by default only accept left click
|
|
1290
|
+
disabled: !1,
|
|
1291
|
+
enableUserSelectHack: !0,
|
|
1292
|
+
onStart: function() {
|
|
1293
|
+
},
|
|
1294
|
+
onDrag: function() {
|
|
1295
|
+
},
|
|
1296
|
+
onStop: function() {
|
|
1297
|
+
},
|
|
1298
|
+
onMouseDown: function() {
|
|
1299
|
+
},
|
|
1300
|
+
scale: 1
|
|
1301
|
+
});
|
|
1302
|
+
(function(e) {
|
|
1303
|
+
Object.defineProperty(e, "__esModule", {
|
|
1304
|
+
value: !0
|
|
1305
|
+
}), Object.defineProperty(e, "DraggableCore", {
|
|
1306
|
+
enumerable: !0,
|
|
1307
|
+
get: function() {
|
|
1308
|
+
return f.default;
|
|
1309
|
+
}
|
|
1310
|
+
}), e.default = void 0;
|
|
1311
|
+
var i = b(ft), t = p(gt), r = p(ct), n = p(It), o = $, a = ue, s = le, f = p(Re), u = p(_e);
|
|
1312
|
+
function p(y) {
|
|
1313
|
+
return y && y.__esModule ? y : { default: y };
|
|
1314
|
+
}
|
|
1315
|
+
function g(y) {
|
|
1316
|
+
if (typeof WeakMap != "function") return null;
|
|
1317
|
+
var h = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
|
|
1318
|
+
return (g = function(l) {
|
|
1319
|
+
return l ? d : h;
|
|
1320
|
+
})(y);
|
|
1321
|
+
}
|
|
1322
|
+
function b(y, h) {
|
|
1323
|
+
if (y && y.__esModule)
|
|
1324
|
+
return y;
|
|
1325
|
+
if (y === null || typeof y != "object" && typeof y != "function")
|
|
1326
|
+
return { default: y };
|
|
1327
|
+
var d = g(h);
|
|
1328
|
+
if (d && d.has(y))
|
|
1329
|
+
return d.get(y);
|
|
1330
|
+
var l = {}, R = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
1331
|
+
for (var x in y)
|
|
1332
|
+
if (x !== "default" && Object.prototype.hasOwnProperty.call(y, x)) {
|
|
1333
|
+
var k = R ? Object.getOwnPropertyDescriptor(y, x) : null;
|
|
1334
|
+
k && (k.get || k.set) ? Object.defineProperty(l, x, k) : l[x] = y[x];
|
|
1335
|
+
}
|
|
1336
|
+
return l.default = y, d && d.set(y, l), l;
|
|
1337
|
+
}
|
|
1338
|
+
function S() {
|
|
1339
|
+
return S = Object.assign ? Object.assign.bind() : function(y) {
|
|
1340
|
+
for (var h = 1; h < arguments.length; h++) {
|
|
1341
|
+
var d = arguments[h];
|
|
1342
|
+
for (var l in d)
|
|
1343
|
+
Object.prototype.hasOwnProperty.call(d, l) && (y[l] = d[l]);
|
|
1344
|
+
}
|
|
1345
|
+
return y;
|
|
1346
|
+
}, S.apply(this, arguments);
|
|
1347
|
+
}
|
|
1348
|
+
function z(y, h, d) {
|
|
1349
|
+
return h = w(h), h in y ? Object.defineProperty(y, h, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : y[h] = d, y;
|
|
1350
|
+
}
|
|
1351
|
+
function w(y) {
|
|
1352
|
+
var h = E(y, "string");
|
|
1353
|
+
return typeof h == "symbol" ? h : String(h);
|
|
1354
|
+
}
|
|
1355
|
+
function E(y, h) {
|
|
1356
|
+
if (typeof y != "object" || y === null) return y;
|
|
1357
|
+
var d = y[Symbol.toPrimitive];
|
|
1358
|
+
if (d !== void 0) {
|
|
1359
|
+
var l = d.call(y, h || "default");
|
|
1360
|
+
if (typeof l != "object") return l;
|
|
1361
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1362
|
+
}
|
|
1363
|
+
return (h === "string" ? String : Number)(y);
|
|
1364
|
+
}
|
|
1365
|
+
class D extends i.Component {
|
|
1366
|
+
// React 16.3+
|
|
1367
|
+
// Arity (props, state)
|
|
1368
|
+
static getDerivedStateFromProps(h, d) {
|
|
1369
|
+
let {
|
|
1370
|
+
position: l
|
|
1371
|
+
} = h, {
|
|
1372
|
+
prevPropsPosition: R
|
|
1373
|
+
} = d;
|
|
1374
|
+
return l && (!R || l.x !== R.x || l.y !== R.y) ? ((0, u.default)("Draggable: getDerivedStateFromProps %j", {
|
|
1375
|
+
position: l,
|
|
1376
|
+
prevPropsPosition: R
|
|
1377
|
+
}), {
|
|
1378
|
+
x: l.x,
|
|
1379
|
+
y: l.y,
|
|
1380
|
+
prevPropsPosition: {
|
|
1381
|
+
...l
|
|
1382
|
+
}
|
|
1383
|
+
}) : null;
|
|
1384
|
+
}
|
|
1385
|
+
constructor(h) {
|
|
1386
|
+
super(h), z(this, "onDragStart", (d, l) => {
|
|
1387
|
+
if ((0, u.default)("Draggable: onDragStart: %j", l), this.props.onStart(d, (0, a.createDraggableData)(this, l)) === !1) return !1;
|
|
1388
|
+
this.setState({
|
|
1389
|
+
dragging: !0,
|
|
1390
|
+
dragged: !0
|
|
1391
|
+
});
|
|
1392
|
+
}), z(this, "onDrag", (d, l) => {
|
|
1393
|
+
if (!this.state.dragging) return !1;
|
|
1394
|
+
(0, u.default)("Draggable: onDrag: %j", l);
|
|
1395
|
+
const R = (0, a.createDraggableData)(this, l), x = {
|
|
1396
|
+
x: R.x,
|
|
1397
|
+
y: R.y,
|
|
1398
|
+
slackX: 0,
|
|
1399
|
+
slackY: 0
|
|
1400
|
+
};
|
|
1401
|
+
if (this.props.bounds) {
|
|
1402
|
+
const {
|
|
1403
|
+
x: B,
|
|
1404
|
+
y: Y
|
|
1405
|
+
} = x;
|
|
1406
|
+
x.x += this.state.slackX, x.y += this.state.slackY;
|
|
1407
|
+
const [X, j] = (0, a.getBoundPosition)(this, x.x, x.y);
|
|
1408
|
+
x.x = X, x.y = j, x.slackX = this.state.slackX + (B - x.x), x.slackY = this.state.slackY + (Y - x.y), R.x = x.x, R.y = x.y, R.deltaX = x.x - this.state.x, R.deltaY = x.y - this.state.y;
|
|
1409
|
+
}
|
|
1410
|
+
if (this.props.onDrag(d, R) === !1) return !1;
|
|
1411
|
+
this.setState(x);
|
|
1412
|
+
}), z(this, "onDragStop", (d, l) => {
|
|
1413
|
+
if (!this.state.dragging || this.props.onStop(d, (0, a.createDraggableData)(this, l)) === !1) return !1;
|
|
1414
|
+
(0, u.default)("Draggable: onDragStop: %j", l);
|
|
1415
|
+
const x = {
|
|
1416
|
+
dragging: !1,
|
|
1417
|
+
slackX: 0,
|
|
1418
|
+
slackY: 0
|
|
1419
|
+
};
|
|
1420
|
+
if (!!this.props.position) {
|
|
1421
|
+
const {
|
|
1422
|
+
x: B,
|
|
1423
|
+
y: Y
|
|
1424
|
+
} = this.props.position;
|
|
1425
|
+
x.x = B, x.y = Y;
|
|
1426
|
+
}
|
|
1427
|
+
this.setState(x);
|
|
1428
|
+
}), this.state = {
|
|
1429
|
+
// Whether or not we are currently dragging.
|
|
1430
|
+
dragging: !1,
|
|
1431
|
+
// Whether or not we have been dragged before.
|
|
1432
|
+
dragged: !1,
|
|
1433
|
+
// Current transform x and y.
|
|
1434
|
+
x: h.position ? h.position.x : h.defaultPosition.x,
|
|
1435
|
+
y: h.position ? h.position.y : h.defaultPosition.y,
|
|
1436
|
+
prevPropsPosition: {
|
|
1437
|
+
...h.position
|
|
1438
|
+
},
|
|
1439
|
+
// Used for compensating for out-of-bounds drags
|
|
1440
|
+
slackX: 0,
|
|
1441
|
+
slackY: 0,
|
|
1442
|
+
// Can only determine if SVG after mounting
|
|
1443
|
+
isElementSVG: !1
|
|
1444
|
+
}, h.position && !(h.onDrag || h.onStop) && console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
|
|
1445
|
+
}
|
|
1446
|
+
componentDidMount() {
|
|
1447
|
+
typeof window.SVGElement < "u" && this.findDOMNode() instanceof window.SVGElement && this.setState({
|
|
1448
|
+
isElementSVG: !0
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
componentWillUnmount() {
|
|
1452
|
+
this.setState({
|
|
1453
|
+
dragging: !1
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
// React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
|
|
1457
|
+
// the underlying DOM node ourselves. See the README for more information.
|
|
1458
|
+
findDOMNode() {
|
|
1459
|
+
var h, d;
|
|
1460
|
+
return (h = (d = this.props) === null || d === void 0 || (d = d.nodeRef) === null || d === void 0 ? void 0 : d.current) !== null && h !== void 0 ? h : r.default.findDOMNode(this);
|
|
1461
|
+
}
|
|
1462
|
+
render() {
|
|
1463
|
+
const {
|
|
1464
|
+
axis: h,
|
|
1465
|
+
bounds: d,
|
|
1466
|
+
children: l,
|
|
1467
|
+
defaultPosition: R,
|
|
1468
|
+
defaultClassName: x,
|
|
1469
|
+
defaultClassNameDragging: k,
|
|
1470
|
+
defaultClassNameDragged: B,
|
|
1471
|
+
position: Y,
|
|
1472
|
+
positionOffset: X,
|
|
1473
|
+
scale: j,
|
|
1474
|
+
...q
|
|
1475
|
+
} = this.props;
|
|
1476
|
+
let V = {}, ie = null;
|
|
1477
|
+
const Z = !!!Y || this.state.dragging, ne = Y || R, K = {
|
|
1478
|
+
// Set left if horizontal drag is enabled
|
|
1479
|
+
x: (0, a.canDragX)(this) && Z ? this.state.x : ne.x,
|
|
1480
|
+
// Set top if vertical drag is enabled
|
|
1481
|
+
y: (0, a.canDragY)(this) && Z ? this.state.y : ne.y
|
|
1482
|
+
};
|
|
1483
|
+
this.state.isElementSVG ? ie = (0, o.createSVGTransform)(K, X) : V = (0, o.createCSSTransform)(K, X);
|
|
1484
|
+
const c = (0, n.default)(l.props.className || "", x, {
|
|
1485
|
+
[k]: this.state.dragging,
|
|
1486
|
+
[B]: this.state.dragged
|
|
1487
|
+
});
|
|
1488
|
+
return /* @__PURE__ */ i.createElement(f.default, S({}, q, {
|
|
1489
|
+
onStart: this.onDragStart,
|
|
1490
|
+
onDrag: this.onDrag,
|
|
1491
|
+
onStop: this.onDragStop
|
|
1492
|
+
}), /* @__PURE__ */ i.cloneElement(i.Children.only(l), {
|
|
1493
|
+
className: c,
|
|
1494
|
+
style: {
|
|
1495
|
+
...l.props.style,
|
|
1496
|
+
...V
|
|
1497
|
+
},
|
|
1498
|
+
transform: ie
|
|
1499
|
+
}));
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
e.default = D, z(D, "displayName", "Draggable"), z(D, "propTypes", {
|
|
1503
|
+
// Accepts all props <DraggableCore> accepts.
|
|
1504
|
+
...f.default.propTypes,
|
|
1505
|
+
/**
|
|
1506
|
+
* `axis` determines which axis the draggable can move.
|
|
1507
|
+
*
|
|
1508
|
+
* Note that all callbacks will still return data as normal. This only
|
|
1509
|
+
* controls flushing to the DOM.
|
|
1510
|
+
*
|
|
1511
|
+
* 'both' allows movement horizontally and vertically.
|
|
1512
|
+
* 'x' limits movement to horizontal axis.
|
|
1513
|
+
* 'y' limits movement to vertical axis.
|
|
1514
|
+
* 'none' limits all movement.
|
|
1515
|
+
*
|
|
1516
|
+
* Defaults to 'both'.
|
|
1517
|
+
*/
|
|
1518
|
+
axis: t.default.oneOf(["both", "x", "y", "none"]),
|
|
1519
|
+
/**
|
|
1520
|
+
* `bounds` determines the range of movement available to the element.
|
|
1521
|
+
* Available values are:
|
|
1522
|
+
*
|
|
1523
|
+
* 'parent' restricts movement within the Draggable's parent node.
|
|
1524
|
+
*
|
|
1525
|
+
* Alternatively, pass an object with the following properties, all of which are optional:
|
|
1526
|
+
*
|
|
1527
|
+
* {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
|
|
1528
|
+
*
|
|
1529
|
+
* All values are in px.
|
|
1530
|
+
*
|
|
1531
|
+
* Example:
|
|
1532
|
+
*
|
|
1533
|
+
* ```jsx
|
|
1534
|
+
* let App = React.createClass({
|
|
1535
|
+
* render: function () {
|
|
1536
|
+
* return (
|
|
1537
|
+
* <Draggable bounds={{right: 300, bottom: 300}}>
|
|
1538
|
+
* <div>Content</div>
|
|
1539
|
+
* </Draggable>
|
|
1540
|
+
* );
|
|
1541
|
+
* }
|
|
1542
|
+
* });
|
|
1543
|
+
* ```
|
|
1544
|
+
*/
|
|
1545
|
+
bounds: t.default.oneOfType([t.default.shape({
|
|
1546
|
+
left: t.default.number,
|
|
1547
|
+
right: t.default.number,
|
|
1548
|
+
top: t.default.number,
|
|
1549
|
+
bottom: t.default.number
|
|
1550
|
+
}), t.default.string, t.default.oneOf([!1])]),
|
|
1551
|
+
defaultClassName: t.default.string,
|
|
1552
|
+
defaultClassNameDragging: t.default.string,
|
|
1553
|
+
defaultClassNameDragged: t.default.string,
|
|
1554
|
+
/**
|
|
1555
|
+
* `defaultPosition` specifies the x and y that the dragged item should start at
|
|
1556
|
+
*
|
|
1557
|
+
* Example:
|
|
1558
|
+
*
|
|
1559
|
+
* ```jsx
|
|
1560
|
+
* let App = React.createClass({
|
|
1561
|
+
* render: function () {
|
|
1562
|
+
* return (
|
|
1563
|
+
* <Draggable defaultPosition={{x: 25, y: 25}}>
|
|
1564
|
+
* <div>I start with transformX: 25px and transformY: 25px;</div>
|
|
1565
|
+
* </Draggable>
|
|
1566
|
+
* );
|
|
1567
|
+
* }
|
|
1568
|
+
* });
|
|
1569
|
+
* ```
|
|
1570
|
+
*/
|
|
1571
|
+
defaultPosition: t.default.shape({
|
|
1572
|
+
x: t.default.number,
|
|
1573
|
+
y: t.default.number
|
|
1574
|
+
}),
|
|
1575
|
+
positionOffset: t.default.shape({
|
|
1576
|
+
x: t.default.oneOfType([t.default.number, t.default.string]),
|
|
1577
|
+
y: t.default.oneOfType([t.default.number, t.default.string])
|
|
1578
|
+
}),
|
|
1579
|
+
/**
|
|
1580
|
+
* `position`, if present, defines the current position of the element.
|
|
1581
|
+
*
|
|
1582
|
+
* This is similar to how form elements in React work - if no `position` is supplied, the component
|
|
1583
|
+
* is uncontrolled.
|
|
1584
|
+
*
|
|
1585
|
+
* Example:
|
|
1586
|
+
*
|
|
1587
|
+
* ```jsx
|
|
1588
|
+
* let App = React.createClass({
|
|
1589
|
+
* render: function () {
|
|
1590
|
+
* return (
|
|
1591
|
+
* <Draggable position={{x: 25, y: 25}}>
|
|
1592
|
+
* <div>I start with transformX: 25px and transformY: 25px;</div>
|
|
1593
|
+
* </Draggable>
|
|
1594
|
+
* );
|
|
1595
|
+
* }
|
|
1596
|
+
* });
|
|
1597
|
+
* ```
|
|
1598
|
+
*/
|
|
1599
|
+
position: t.default.shape({
|
|
1600
|
+
x: t.default.number,
|
|
1601
|
+
y: t.default.number
|
|
1602
|
+
}),
|
|
1603
|
+
/**
|
|
1604
|
+
* These properties should be defined on the child, not here.
|
|
1605
|
+
*/
|
|
1606
|
+
className: s.dontSetMe,
|
|
1607
|
+
style: s.dontSetMe,
|
|
1608
|
+
transform: s.dontSetMe
|
|
1609
|
+
}), z(D, "defaultProps", {
|
|
1610
|
+
...f.default.defaultProps,
|
|
1611
|
+
axis: "both",
|
|
1612
|
+
bounds: !1,
|
|
1613
|
+
defaultClassName: "react-draggable",
|
|
1614
|
+
defaultClassNameDragging: "react-draggable-dragging",
|
|
1615
|
+
defaultClassNameDragged: "react-draggable-dragged",
|
|
1616
|
+
defaultPosition: {
|
|
1617
|
+
x: 0,
|
|
1618
|
+
y: 0
|
|
1619
|
+
},
|
|
1620
|
+
scale: 1
|
|
1621
|
+
});
|
|
1622
|
+
})(ht);
|
|
1623
|
+
const {
|
|
1624
|
+
default: Et,
|
|
1625
|
+
DraggableCore: xr
|
|
1626
|
+
} = ht;
|
|
1627
|
+
Pe.exports = Et;
|
|
1628
|
+
Pe.exports.default = Et;
|
|
1629
|
+
Pe.exports.DraggableCore = xr;
|
|
1630
|
+
var zr = Pe.exports;
|
|
1631
|
+
const Er = /* @__PURE__ */ Dt(zr);
|
|
1632
|
+
var Pr = /* @__PURE__ */ function() {
|
|
1633
|
+
var e = function(i, t) {
|
|
1634
|
+
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
|
|
1635
|
+
r.__proto__ = n;
|
|
1636
|
+
} || function(r, n) {
|
|
1637
|
+
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (r[o] = n[o]);
|
|
1638
|
+
}, e(i, t);
|
|
1639
|
+
};
|
|
1640
|
+
return function(i, t) {
|
|
1641
|
+
e(i, t);
|
|
1642
|
+
function r() {
|
|
1643
|
+
this.constructor = i;
|
|
1644
|
+
}
|
|
1645
|
+
i.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
1646
|
+
};
|
|
1647
|
+
}(), F = function() {
|
|
1648
|
+
return F = Object.assign || function(e) {
|
|
1649
|
+
for (var i, t = 1, r = arguments.length; t < r; t++) {
|
|
1650
|
+
i = arguments[t];
|
|
1651
|
+
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]);
|
|
1652
|
+
}
|
|
1653
|
+
return e;
|
|
1654
|
+
}, F.apply(this, arguments);
|
|
1655
|
+
}, ot = {
|
|
1656
|
+
width: "100%",
|
|
1657
|
+
height: "10px",
|
|
1658
|
+
top: "0px",
|
|
1659
|
+
left: "0px",
|
|
1660
|
+
cursor: "row-resize"
|
|
1661
|
+
}, st = {
|
|
1662
|
+
width: "10px",
|
|
1663
|
+
height: "100%",
|
|
1664
|
+
top: "0px",
|
|
1665
|
+
left: "0px",
|
|
1666
|
+
cursor: "col-resize"
|
|
1667
|
+
}, Se = {
|
|
1668
|
+
width: "20px",
|
|
1669
|
+
height: "20px",
|
|
1670
|
+
position: "absolute"
|
|
1671
|
+
}, Rr = {
|
|
1672
|
+
top: F(F({}, ot), { top: "-5px" }),
|
|
1673
|
+
right: F(F({}, st), { left: void 0, right: "-5px" }),
|
|
1674
|
+
bottom: F(F({}, ot), { top: void 0, bottom: "-5px" }),
|
|
1675
|
+
left: F(F({}, st), { left: "-5px" }),
|
|
1676
|
+
topRight: F(F({}, Se), { right: "-10px", top: "-10px", cursor: "ne-resize" }),
|
|
1677
|
+
bottomRight: F(F({}, Se), { right: "-10px", bottom: "-10px", cursor: "se-resize" }),
|
|
1678
|
+
bottomLeft: F(F({}, Se), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }),
|
|
1679
|
+
topLeft: F(F({}, Se), { left: "-10px", top: "-10px", cursor: "nw-resize" })
|
|
1680
|
+
}, _r = (
|
|
1681
|
+
/** @class */
|
|
1682
|
+
function(e) {
|
|
1683
|
+
Pr(i, e);
|
|
1684
|
+
function i() {
|
|
1685
|
+
var t = e !== null && e.apply(this, arguments) || this;
|
|
1686
|
+
return t.onMouseDown = function(r) {
|
|
1687
|
+
t.props.onResizeStart(r, t.props.direction);
|
|
1688
|
+
}, t.onTouchStart = function(r) {
|
|
1689
|
+
t.props.onResizeStart(r, t.props.direction);
|
|
1690
|
+
}, t;
|
|
1691
|
+
}
|
|
1692
|
+
return i.prototype.render = function() {
|
|
1693
|
+
return pe.createElement("div", { className: this.props.className || "", style: F(F({ position: "absolute", userSelect: "none" }, Rr[this.props.direction]), this.props.replaceStyles || {}), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children);
|
|
1694
|
+
}, i;
|
|
1695
|
+
}(pe.PureComponent)
|
|
1696
|
+
), Dr = /* @__PURE__ */ function() {
|
|
1697
|
+
var e = function(i, t) {
|
|
1698
|
+
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, n) {
|
|
1699
|
+
r.__proto__ = n;
|
|
1700
|
+
} || function(r, n) {
|
|
1701
|
+
for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (r[o] = n[o]);
|
|
1702
|
+
}, e(i, t);
|
|
1703
|
+
};
|
|
1704
|
+
return function(i, t) {
|
|
1705
|
+
e(i, t);
|
|
1706
|
+
function r() {
|
|
1707
|
+
this.constructor = i;
|
|
1708
|
+
}
|
|
1709
|
+
i.prototype = t === null ? Object.create(t) : (r.prototype = t.prototype, new r());
|
|
1710
|
+
};
|
|
1711
|
+
}(), ae = function() {
|
|
1712
|
+
return ae = Object.assign || function(e) {
|
|
1713
|
+
for (var i, t = 1, r = arguments.length; t < r; t++) {
|
|
1714
|
+
i = arguments[t];
|
|
1715
|
+
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]);
|
|
1716
|
+
}
|
|
1717
|
+
return e;
|
|
1718
|
+
}, ae.apply(this, arguments);
|
|
1719
|
+
}, Tr = {
|
|
1720
|
+
width: "auto",
|
|
1721
|
+
height: "auto"
|
|
1722
|
+
}, xe = function(e, i, t) {
|
|
1723
|
+
return Math.max(Math.min(e, t), i);
|
|
1724
|
+
}, at = function(e, i) {
|
|
1725
|
+
return Math.round(e / i) * i;
|
|
1726
|
+
}, ge = function(e, i) {
|
|
1727
|
+
return new RegExp(e, "i").test(i);
|
|
1728
|
+
}, ze = function(e) {
|
|
1729
|
+
return !!(e.touches && e.touches.length);
|
|
1730
|
+
}, Cr = function(e) {
|
|
1731
|
+
return !!((e.clientX || e.clientX === 0) && (e.clientY || e.clientY === 0));
|
|
1732
|
+
}, lt = function(e, i, t) {
|
|
1733
|
+
t === void 0 && (t = 0);
|
|
1734
|
+
var r = i.reduce(function(o, a, s) {
|
|
1735
|
+
return Math.abs(a - e) < Math.abs(i[o] - e) ? s : o;
|
|
1736
|
+
}, 0), n = Math.abs(i[r] - e);
|
|
1737
|
+
return t === 0 || n < t ? i[r] : e;
|
|
1738
|
+
}, ke = function(e) {
|
|
1739
|
+
return e = e.toString(), e === "auto" || e.endsWith("px") || e.endsWith("%") || e.endsWith("vh") || e.endsWith("vw") || e.endsWith("vmax") || e.endsWith("vmin") ? e : e + "px";
|
|
1740
|
+
}, Ee = function(e, i, t, r) {
|
|
1741
|
+
if (e && typeof e == "string") {
|
|
1742
|
+
if (e.endsWith("px"))
|
|
1743
|
+
return Number(e.replace("px", ""));
|
|
1744
|
+
if (e.endsWith("%")) {
|
|
1745
|
+
var n = Number(e.replace("%", "")) / 100;
|
|
1746
|
+
return i * n;
|
|
1747
|
+
}
|
|
1748
|
+
if (e.endsWith("vw")) {
|
|
1749
|
+
var n = Number(e.replace("vw", "")) / 100;
|
|
1750
|
+
return t * n;
|
|
1751
|
+
}
|
|
1752
|
+
if (e.endsWith("vh")) {
|
|
1753
|
+
var n = Number(e.replace("vh", "")) / 100;
|
|
1754
|
+
return r * n;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
return e;
|
|
1758
|
+
}, Or = function(e, i, t, r, n, o, a) {
|
|
1759
|
+
return r = Ee(r, e.width, i, t), n = Ee(n, e.height, i, t), o = Ee(o, e.width, i, t), a = Ee(a, e.height, i, t), {
|
|
1760
|
+
maxWidth: typeof r > "u" ? void 0 : Number(r),
|
|
1761
|
+
maxHeight: typeof n > "u" ? void 0 : Number(n),
|
|
1762
|
+
minWidth: typeof o > "u" ? void 0 : Number(o),
|
|
1763
|
+
minHeight: typeof a > "u" ? void 0 : Number(a)
|
|
1764
|
+
};
|
|
1765
|
+
}, Mr = function(e) {
|
|
1766
|
+
return Array.isArray(e) ? e : [e, e];
|
|
1767
|
+
}, Wr = [
|
|
1768
|
+
"as",
|
|
1769
|
+
"ref",
|
|
1770
|
+
"style",
|
|
1771
|
+
"className",
|
|
1772
|
+
"grid",
|
|
1773
|
+
"snap",
|
|
1774
|
+
"bounds",
|
|
1775
|
+
"boundsByDirection",
|
|
1776
|
+
"size",
|
|
1777
|
+
"defaultSize",
|
|
1778
|
+
"minWidth",
|
|
1779
|
+
"minHeight",
|
|
1780
|
+
"maxWidth",
|
|
1781
|
+
"maxHeight",
|
|
1782
|
+
"lockAspectRatio",
|
|
1783
|
+
"lockAspectRatioExtraWidth",
|
|
1784
|
+
"lockAspectRatioExtraHeight",
|
|
1785
|
+
"enable",
|
|
1786
|
+
"handleStyles",
|
|
1787
|
+
"handleClasses",
|
|
1788
|
+
"handleWrapperStyle",
|
|
1789
|
+
"handleWrapperClass",
|
|
1790
|
+
"children",
|
|
1791
|
+
"onResizeStart",
|
|
1792
|
+
"onResize",
|
|
1793
|
+
"onResizeStop",
|
|
1794
|
+
"handleComponent",
|
|
1795
|
+
"scale",
|
|
1796
|
+
"resizeRatio",
|
|
1797
|
+
"snapGap"
|
|
1798
|
+
], ut = "__resizable_base__", Ar = (
|
|
1799
|
+
/** @class */
|
|
1800
|
+
function(e) {
|
|
1801
|
+
Dr(i, e);
|
|
1802
|
+
function i(t) {
|
|
1803
|
+
var r, n, o, a, s = e.call(this, t) || this;
|
|
1804
|
+
return s.ratio = 1, s.resizable = null, s.parentLeft = 0, s.parentTop = 0, s.resizableLeft = 0, s.resizableRight = 0, s.resizableTop = 0, s.resizableBottom = 0, s.targetLeft = 0, s.targetTop = 0, s.appendBase = function() {
|
|
1805
|
+
if (!s.resizable || !s.window)
|
|
1806
|
+
return null;
|
|
1807
|
+
var f = s.parentNode;
|
|
1808
|
+
if (!f)
|
|
1809
|
+
return null;
|
|
1810
|
+
var u = s.window.document.createElement("div");
|
|
1811
|
+
return u.style.width = "100%", u.style.height = "100%", u.style.position = "absolute", u.style.transform = "scale(0, 0)", u.style.left = "0", u.style.flex = "0 0 100%", u.classList ? u.classList.add(ut) : u.className += ut, f.appendChild(u), u;
|
|
1812
|
+
}, s.removeBase = function(f) {
|
|
1813
|
+
var u = s.parentNode;
|
|
1814
|
+
u && u.removeChild(f);
|
|
1815
|
+
}, s.state = {
|
|
1816
|
+
isResizing: !1,
|
|
1817
|
+
width: (n = (r = s.propsSize) === null || r === void 0 ? void 0 : r.width) !== null && n !== void 0 ? n : "auto",
|
|
1818
|
+
height: (a = (o = s.propsSize) === null || o === void 0 ? void 0 : o.height) !== null && a !== void 0 ? a : "auto",
|
|
1819
|
+
direction: "right",
|
|
1820
|
+
original: {
|
|
1821
|
+
x: 0,
|
|
1822
|
+
y: 0,
|
|
1823
|
+
width: 0,
|
|
1824
|
+
height: 0
|
|
1825
|
+
},
|
|
1826
|
+
backgroundStyle: {
|
|
1827
|
+
height: "100%",
|
|
1828
|
+
width: "100%",
|
|
1829
|
+
backgroundColor: "rgba(0,0,0,0)",
|
|
1830
|
+
cursor: "auto",
|
|
1831
|
+
opacity: 0,
|
|
1832
|
+
position: "fixed",
|
|
1833
|
+
zIndex: 9999,
|
|
1834
|
+
top: "0",
|
|
1835
|
+
left: "0",
|
|
1836
|
+
bottom: "0",
|
|
1837
|
+
right: "0"
|
|
1838
|
+
},
|
|
1839
|
+
flexBasis: void 0
|
|
1840
|
+
}, s.onResizeStart = s.onResizeStart.bind(s), s.onMouseMove = s.onMouseMove.bind(s), s.onMouseUp = s.onMouseUp.bind(s), s;
|
|
1841
|
+
}
|
|
1842
|
+
return Object.defineProperty(i.prototype, "parentNode", {
|
|
1843
|
+
get: function() {
|
|
1844
|
+
return this.resizable ? this.resizable.parentNode : null;
|
|
1845
|
+
},
|
|
1846
|
+
enumerable: !1,
|
|
1847
|
+
configurable: !0
|
|
1848
|
+
}), Object.defineProperty(i.prototype, "window", {
|
|
1849
|
+
get: function() {
|
|
1850
|
+
return !this.resizable || !this.resizable.ownerDocument ? null : this.resizable.ownerDocument.defaultView;
|
|
1851
|
+
},
|
|
1852
|
+
enumerable: !1,
|
|
1853
|
+
configurable: !0
|
|
1854
|
+
}), Object.defineProperty(i.prototype, "propsSize", {
|
|
1855
|
+
get: function() {
|
|
1856
|
+
return this.props.size || this.props.defaultSize || Tr;
|
|
1857
|
+
},
|
|
1858
|
+
enumerable: !1,
|
|
1859
|
+
configurable: !0
|
|
1860
|
+
}), Object.defineProperty(i.prototype, "size", {
|
|
1861
|
+
get: function() {
|
|
1862
|
+
var t = 0, r = 0;
|
|
1863
|
+
if (this.resizable && this.window) {
|
|
1864
|
+
var n = this.resizable.offsetWidth, o = this.resizable.offsetHeight, a = this.resizable.style.position;
|
|
1865
|
+
a !== "relative" && (this.resizable.style.position = "relative"), t = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : n, r = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : o, this.resizable.style.position = a;
|
|
1866
|
+
}
|
|
1867
|
+
return { width: t, height: r };
|
|
1868
|
+
},
|
|
1869
|
+
enumerable: !1,
|
|
1870
|
+
configurable: !0
|
|
1871
|
+
}), Object.defineProperty(i.prototype, "sizeStyle", {
|
|
1872
|
+
get: function() {
|
|
1873
|
+
var t = this, r = this.props.size, n = function(s) {
|
|
1874
|
+
var f;
|
|
1875
|
+
if (typeof t.state[s] > "u" || t.state[s] === "auto")
|
|
1876
|
+
return "auto";
|
|
1877
|
+
if (t.propsSize && t.propsSize[s] && (!((f = t.propsSize[s]) === null || f === void 0) && f.toString().endsWith("%"))) {
|
|
1878
|
+
if (t.state[s].toString().endsWith("%"))
|
|
1879
|
+
return t.state[s].toString();
|
|
1880
|
+
var u = t.getParentSize(), p = Number(t.state[s].toString().replace("px", "")), g = p / u[s] * 100;
|
|
1881
|
+
return g + "%";
|
|
1882
|
+
}
|
|
1883
|
+
return ke(t.state[s]);
|
|
1884
|
+
}, o = r && typeof r.width < "u" && !this.state.isResizing ? ke(r.width) : n("width"), a = r && typeof r.height < "u" && !this.state.isResizing ? ke(r.height) : n("height");
|
|
1885
|
+
return { width: o, height: a };
|
|
1886
|
+
},
|
|
1887
|
+
enumerable: !1,
|
|
1888
|
+
configurable: !0
|
|
1889
|
+
}), i.prototype.getParentSize = function() {
|
|
1890
|
+
if (!this.parentNode)
|
|
1891
|
+
return this.window ? { width: this.window.innerWidth, height: this.window.innerHeight } : { width: 0, height: 0 };
|
|
1892
|
+
var t = this.appendBase();
|
|
1893
|
+
if (!t)
|
|
1894
|
+
return { width: 0, height: 0 };
|
|
1895
|
+
var r = !1, n = this.parentNode.style.flexWrap;
|
|
1896
|
+
n !== "wrap" && (r = !0, this.parentNode.style.flexWrap = "wrap"), t.style.position = "relative", t.style.minWidth = "100%", t.style.minHeight = "100%";
|
|
1897
|
+
var o = {
|
|
1898
|
+
width: t.offsetWidth,
|
|
1899
|
+
height: t.offsetHeight
|
|
1900
|
+
};
|
|
1901
|
+
return r && (this.parentNode.style.flexWrap = n), this.removeBase(t), o;
|
|
1902
|
+
}, i.prototype.bindEvents = function() {
|
|
1903
|
+
this.window && (this.window.addEventListener("mouseup", this.onMouseUp), this.window.addEventListener("mousemove", this.onMouseMove), this.window.addEventListener("mouseleave", this.onMouseUp), this.window.addEventListener("touchmove", this.onMouseMove, {
|
|
1904
|
+
capture: !0,
|
|
1905
|
+
passive: !1
|
|
1906
|
+
}), this.window.addEventListener("touchend", this.onMouseUp));
|
|
1907
|
+
}, i.prototype.unbindEvents = function() {
|
|
1908
|
+
this.window && (this.window.removeEventListener("mouseup", this.onMouseUp), this.window.removeEventListener("mousemove", this.onMouseMove), this.window.removeEventListener("mouseleave", this.onMouseUp), this.window.removeEventListener("touchmove", this.onMouseMove, !0), this.window.removeEventListener("touchend", this.onMouseUp));
|
|
1909
|
+
}, i.prototype.componentDidMount = function() {
|
|
1910
|
+
if (!(!this.resizable || !this.window)) {
|
|
1911
|
+
var t = this.window.getComputedStyle(this.resizable);
|
|
1912
|
+
this.setState({
|
|
1913
|
+
width: this.state.width || this.size.width,
|
|
1914
|
+
height: this.state.height || this.size.height,
|
|
1915
|
+
flexBasis: t.flexBasis !== "auto" ? t.flexBasis : void 0
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
}, i.prototype.componentWillUnmount = function() {
|
|
1919
|
+
this.window && this.unbindEvents();
|
|
1920
|
+
}, i.prototype.createSizeForCssProperty = function(t, r) {
|
|
1921
|
+
var n = this.propsSize && this.propsSize[r];
|
|
1922
|
+
return this.state[r] === "auto" && this.state.original[r] === t && (typeof n > "u" || n === "auto") ? "auto" : t;
|
|
1923
|
+
}, i.prototype.calculateNewMaxFromBoundary = function(t, r) {
|
|
1924
|
+
var n = this.props.boundsByDirection, o = this.state.direction, a = n && ge("left", o), s = n && ge("top", o), f, u;
|
|
1925
|
+
if (this.props.bounds === "parent") {
|
|
1926
|
+
var p = this.parentNode;
|
|
1927
|
+
p && (f = a ? this.resizableRight - this.parentLeft : p.offsetWidth + (this.parentLeft - this.resizableLeft), u = s ? this.resizableBottom - this.parentTop : p.offsetHeight + (this.parentTop - this.resizableTop));
|
|
1928
|
+
} else this.props.bounds === "window" ? this.window && (f = a ? this.resizableRight : this.window.innerWidth - this.resizableLeft, u = s ? this.resizableBottom : this.window.innerHeight - this.resizableTop) : this.props.bounds && (f = a ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft), u = s ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop));
|
|
1929
|
+
return f && Number.isFinite(f) && (t = t && t < f ? t : f), u && Number.isFinite(u) && (r = r && r < u ? r : u), { maxWidth: t, maxHeight: r };
|
|
1930
|
+
}, i.prototype.calculateNewSizeFromDirection = function(t, r) {
|
|
1931
|
+
var n = this.props.scale || 1, o = Mr(this.props.resizeRatio || 1), a = o[0], s = o[1], f = this.state, u = f.direction, p = f.original, g = this.props, b = g.lockAspectRatio, S = g.lockAspectRatioExtraHeight, z = g.lockAspectRatioExtraWidth, w = p.width, E = p.height, D = S || 0, y = z || 0;
|
|
1932
|
+
return ge("right", u) && (w = p.width + (t - p.x) * a / n, b && (E = (w - y) / this.ratio + D)), ge("left", u) && (w = p.width - (t - p.x) * a / n, b && (E = (w - y) / this.ratio + D)), ge("bottom", u) && (E = p.height + (r - p.y) * s / n, b && (w = (E - D) * this.ratio + y)), ge("top", u) && (E = p.height - (r - p.y) * s / n, b && (w = (E - D) * this.ratio + y)), { newWidth: w, newHeight: E };
|
|
1933
|
+
}, i.prototype.calculateNewSizeFromAspectRatio = function(t, r, n, o) {
|
|
1934
|
+
var a = this.props, s = a.lockAspectRatio, f = a.lockAspectRatioExtraHeight, u = a.lockAspectRatioExtraWidth, p = typeof o.width > "u" ? 10 : o.width, g = typeof n.width > "u" || n.width < 0 ? t : n.width, b = typeof o.height > "u" ? 10 : o.height, S = typeof n.height > "u" || n.height < 0 ? r : n.height, z = f || 0, w = u || 0;
|
|
1935
|
+
if (s) {
|
|
1936
|
+
var E = (b - z) * this.ratio + w, D = (S - z) * this.ratio + w, y = (p - w) / this.ratio + z, h = (g - w) / this.ratio + z, d = Math.max(p, E), l = Math.min(g, D), R = Math.max(b, y), x = Math.min(S, h);
|
|
1937
|
+
t = xe(t, d, l), r = xe(r, R, x);
|
|
1938
|
+
} else
|
|
1939
|
+
t = xe(t, p, g), r = xe(r, b, S);
|
|
1940
|
+
return { newWidth: t, newHeight: r };
|
|
1941
|
+
}, i.prototype.setBoundingClientRect = function() {
|
|
1942
|
+
if (this.props.bounds === "parent") {
|
|
1943
|
+
var t = this.parentNode;
|
|
1944
|
+
if (t) {
|
|
1945
|
+
var r = t.getBoundingClientRect();
|
|
1946
|
+
this.parentLeft = r.left, this.parentTop = r.top;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
if (this.props.bounds && typeof this.props.bounds != "string") {
|
|
1950
|
+
var n = this.props.bounds.getBoundingClientRect();
|
|
1951
|
+
this.targetLeft = n.left, this.targetTop = n.top;
|
|
1952
|
+
}
|
|
1953
|
+
if (this.resizable) {
|
|
1954
|
+
var o = this.resizable.getBoundingClientRect(), a = o.left, s = o.top, f = o.right, u = o.bottom;
|
|
1955
|
+
this.resizableLeft = a, this.resizableRight = f, this.resizableTop = s, this.resizableBottom = u;
|
|
1956
|
+
}
|
|
1957
|
+
}, i.prototype.onResizeStart = function(t, r) {
|
|
1958
|
+
if (!(!this.resizable || !this.window)) {
|
|
1959
|
+
var n = 0, o = 0;
|
|
1960
|
+
if (t.nativeEvent && Cr(t.nativeEvent) ? (n = t.nativeEvent.clientX, o = t.nativeEvent.clientY) : t.nativeEvent && ze(t.nativeEvent) && (n = t.nativeEvent.touches[0].clientX, o = t.nativeEvent.touches[0].clientY), this.props.onResizeStart && this.resizable) {
|
|
1961
|
+
var a = this.props.onResizeStart(t, r, this.resizable);
|
|
1962
|
+
if (a === !1)
|
|
1963
|
+
return;
|
|
1964
|
+
}
|
|
1965
|
+
this.props.size && (typeof this.props.size.height < "u" && this.props.size.height !== this.state.height && this.setState({ height: this.props.size.height }), typeof this.props.size.width < "u" && this.props.size.width !== this.state.width && this.setState({ width: this.props.size.width })), this.ratio = typeof this.props.lockAspectRatio == "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
|
|
1966
|
+
var s, f = this.window.getComputedStyle(this.resizable);
|
|
1967
|
+
if (f.flexBasis !== "auto") {
|
|
1968
|
+
var u = this.parentNode;
|
|
1969
|
+
if (u) {
|
|
1970
|
+
var p = this.window.getComputedStyle(u).flexDirection;
|
|
1971
|
+
this.flexDir = p.startsWith("row") ? "row" : "column", s = f.flexBasis;
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
this.setBoundingClientRect(), this.bindEvents();
|
|
1975
|
+
var g = {
|
|
1976
|
+
original: {
|
|
1977
|
+
x: n,
|
|
1978
|
+
y: o,
|
|
1979
|
+
width: this.size.width,
|
|
1980
|
+
height: this.size.height
|
|
1981
|
+
},
|
|
1982
|
+
isResizing: !0,
|
|
1983
|
+
backgroundStyle: ae(ae({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(t.target).cursor || "auto" }),
|
|
1984
|
+
direction: r,
|
|
1985
|
+
flexBasis: s
|
|
1986
|
+
};
|
|
1987
|
+
this.setState(g);
|
|
1988
|
+
}
|
|
1989
|
+
}, i.prototype.onMouseMove = function(t) {
|
|
1990
|
+
var r = this;
|
|
1991
|
+
if (!(!this.state.isResizing || !this.resizable || !this.window)) {
|
|
1992
|
+
if (this.window.TouchEvent && ze(t))
|
|
1993
|
+
try {
|
|
1994
|
+
t.preventDefault(), t.stopPropagation();
|
|
1995
|
+
} catch {
|
|
1996
|
+
}
|
|
1997
|
+
var n = this.props, o = n.maxWidth, a = n.maxHeight, s = n.minWidth, f = n.minHeight, u = ze(t) ? t.touches[0].clientX : t.clientX, p = ze(t) ? t.touches[0].clientY : t.clientY, g = this.state, b = g.direction, S = g.original, z = g.width, w = g.height, E = this.getParentSize(), D = Or(E, this.window.innerWidth, this.window.innerHeight, o, a, s, f);
|
|
1998
|
+
o = D.maxWidth, a = D.maxHeight, s = D.minWidth, f = D.minHeight;
|
|
1999
|
+
var y = this.calculateNewSizeFromDirection(u, p), h = y.newHeight, d = y.newWidth, l = this.calculateNewMaxFromBoundary(o, a);
|
|
2000
|
+
this.props.snap && this.props.snap.x && (d = lt(d, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (h = lt(h, this.props.snap.y, this.props.snapGap));
|
|
2001
|
+
var R = this.calculateNewSizeFromAspectRatio(d, h, { width: l.maxWidth, height: l.maxHeight }, { width: s, height: f });
|
|
2002
|
+
if (d = R.newWidth, h = R.newHeight, this.props.grid) {
|
|
2003
|
+
var x = at(d, this.props.grid[0]), k = at(h, this.props.grid[1]), B = this.props.snapGap || 0, Y = B === 0 || Math.abs(x - d) <= B ? x : d, X = B === 0 || Math.abs(k - h) <= B ? k : h;
|
|
2004
|
+
d = Y, h = X;
|
|
2005
|
+
}
|
|
2006
|
+
var j = {
|
|
2007
|
+
width: d - S.width,
|
|
2008
|
+
height: h - S.height
|
|
2009
|
+
};
|
|
2010
|
+
if (z && typeof z == "string") {
|
|
2011
|
+
if (z.endsWith("%")) {
|
|
2012
|
+
var q = d / E.width * 100;
|
|
2013
|
+
d = q + "%";
|
|
2014
|
+
} else if (z.endsWith("vw")) {
|
|
2015
|
+
var V = d / this.window.innerWidth * 100;
|
|
2016
|
+
d = V + "vw";
|
|
2017
|
+
} else if (z.endsWith("vh")) {
|
|
2018
|
+
var ie = d / this.window.innerHeight * 100;
|
|
2019
|
+
d = ie + "vh";
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
if (w && typeof w == "string") {
|
|
2023
|
+
if (w.endsWith("%")) {
|
|
2024
|
+
var q = h / E.height * 100;
|
|
2025
|
+
h = q + "%";
|
|
2026
|
+
} else if (w.endsWith("vw")) {
|
|
2027
|
+
var V = h / this.window.innerWidth * 100;
|
|
2028
|
+
h = V + "vw";
|
|
2029
|
+
} else if (w.endsWith("vh")) {
|
|
2030
|
+
var ie = h / this.window.innerHeight * 100;
|
|
2031
|
+
h = ie + "vh";
|
|
2032
|
+
}
|
|
2033
|
+
}
|
|
2034
|
+
var I = {
|
|
2035
|
+
width: this.createSizeForCssProperty(d, "width"),
|
|
2036
|
+
height: this.createSizeForCssProperty(h, "height")
|
|
2037
|
+
};
|
|
2038
|
+
this.flexDir === "row" ? I.flexBasis = I.width : this.flexDir === "column" && (I.flexBasis = I.height);
|
|
2039
|
+
var Z = this.state.width !== I.width, ne = this.state.height !== I.height, K = this.state.flexBasis !== I.flexBasis, c = Z || ne || K;
|
|
2040
|
+
c && Tt(function() {
|
|
2041
|
+
r.setState(I);
|
|
2042
|
+
}), this.props.onResize && c && this.props.onResize(t, b, this.resizable, j);
|
|
2043
|
+
}
|
|
2044
|
+
}, i.prototype.onMouseUp = function(t) {
|
|
2045
|
+
var r, n, o = this.state, a = o.isResizing, s = o.direction, f = o.original;
|
|
2046
|
+
if (!(!a || !this.resizable)) {
|
|
2047
|
+
var u = {
|
|
2048
|
+
width: this.size.width - f.width,
|
|
2049
|
+
height: this.size.height - f.height
|
|
2050
|
+
};
|
|
2051
|
+
this.props.onResizeStop && this.props.onResizeStop(t, s, this.resizable, u), this.props.size && this.setState({ width: (r = this.props.size.width) !== null && r !== void 0 ? r : "auto", height: (n = this.props.size.height) !== null && n !== void 0 ? n : "auto" }), this.unbindEvents(), this.setState({
|
|
2052
|
+
isResizing: !1,
|
|
2053
|
+
backgroundStyle: ae(ae({}, this.state.backgroundStyle), { cursor: "auto" })
|
|
2054
|
+
});
|
|
2055
|
+
}
|
|
2056
|
+
}, i.prototype.updateSize = function(t) {
|
|
2057
|
+
var r, n;
|
|
2058
|
+
this.setState({ width: (r = t.width) !== null && r !== void 0 ? r : "auto", height: (n = t.height) !== null && n !== void 0 ? n : "auto" });
|
|
2059
|
+
}, i.prototype.renderResizer = function() {
|
|
2060
|
+
var t = this, r = this.props, n = r.enable, o = r.handleStyles, a = r.handleClasses, s = r.handleWrapperStyle, f = r.handleWrapperClass, u = r.handleComponent;
|
|
2061
|
+
if (!n)
|
|
2062
|
+
return null;
|
|
2063
|
+
var p = Object.keys(n).map(function(g) {
|
|
2064
|
+
return n[g] !== !1 ? pe.createElement(_r, { key: g, direction: g, onResizeStart: t.onResizeStart, replaceStyles: o && o[g], className: a && a[g] }, u && u[g] ? u[g] : null) : null;
|
|
2065
|
+
});
|
|
2066
|
+
return pe.createElement("div", { className: f, style: s }, p);
|
|
2067
|
+
}, i.prototype.render = function() {
|
|
2068
|
+
var t = this, r = Object.keys(this.props).reduce(function(a, s) {
|
|
2069
|
+
return Wr.indexOf(s) !== -1 || (a[s] = t.props[s]), a;
|
|
2070
|
+
}, {}), n = ae(ae(ae({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 });
|
|
2071
|
+
this.state.flexBasis && (n.flexBasis = this.state.flexBasis);
|
|
2072
|
+
var o = this.props.as || "div";
|
|
2073
|
+
return pe.createElement(
|
|
2074
|
+
o,
|
|
2075
|
+
ae({ style: n, className: this.props.className }, r, {
|
|
2076
|
+
// `ref` is after `extendsProps` to ensure this one wins over a version
|
|
2077
|
+
// passed in
|
|
2078
|
+
ref: function(a) {
|
|
2079
|
+
a && (t.resizable = a);
|
|
2080
|
+
}
|
|
2081
|
+
}),
|
|
2082
|
+
this.state.isResizing && pe.createElement("div", { style: this.state.backgroundStyle }),
|
|
2083
|
+
this.props.children,
|
|
2084
|
+
this.renderResizer()
|
|
2085
|
+
);
|
|
2086
|
+
}, i.defaultProps = {
|
|
2087
|
+
as: "div",
|
|
2088
|
+
onResizeStart: function() {
|
|
2089
|
+
},
|
|
2090
|
+
onResize: function() {
|
|
2091
|
+
},
|
|
2092
|
+
onResizeStop: function() {
|
|
2093
|
+
},
|
|
2094
|
+
enable: {
|
|
2095
|
+
top: !0,
|
|
2096
|
+
right: !0,
|
|
2097
|
+
bottom: !0,
|
|
2098
|
+
left: !0,
|
|
2099
|
+
topRight: !0,
|
|
2100
|
+
bottomRight: !0,
|
|
2101
|
+
bottomLeft: !0,
|
|
2102
|
+
topLeft: !0
|
|
2103
|
+
},
|
|
2104
|
+
style: {},
|
|
2105
|
+
grid: [1, 1],
|
|
2106
|
+
lockAspectRatio: !1,
|
|
2107
|
+
lockAspectRatioExtraWidth: 0,
|
|
2108
|
+
lockAspectRatioExtraHeight: 0,
|
|
2109
|
+
scale: 1,
|
|
2110
|
+
resizeRatio: 1,
|
|
2111
|
+
snapGap: 0
|
|
2112
|
+
}, i;
|
|
2113
|
+
}(pe.PureComponent)
|
|
2114
|
+
);
|
|
2115
|
+
/*! *****************************************************************************
|
|
2116
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2117
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
2118
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
2119
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2120
|
+
|
|
2121
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
2122
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
2123
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
2124
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
2125
|
+
|
|
2126
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
2127
|
+
and limitations under the License.
|
|
2128
|
+
***************************************************************************** */
|
|
2129
|
+
var Ie = function(e, i) {
|
|
2130
|
+
return Ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, r) {
|
|
2131
|
+
t.__proto__ = r;
|
|
2132
|
+
} || function(t, r) {
|
|
2133
|
+
for (var n in r) r.hasOwnProperty(n) && (t[n] = r[n]);
|
|
2134
|
+
}, Ie(e, i);
|
|
2135
|
+
};
|
|
2136
|
+
function Nr(e, i) {
|
|
2137
|
+
Ie(e, i);
|
|
2138
|
+
function t() {
|
|
2139
|
+
this.constructor = e;
|
|
2140
|
+
}
|
|
2141
|
+
e.prototype = i === null ? Object.create(i) : (t.prototype = i.prototype, new t());
|
|
2142
|
+
}
|
|
2143
|
+
var U = function() {
|
|
2144
|
+
return U = Object.assign || function(i) {
|
|
2145
|
+
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
2146
|
+
t = arguments[r];
|
|
2147
|
+
for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (i[o] = t[o]);
|
|
2148
|
+
}
|
|
2149
|
+
return i;
|
|
2150
|
+
}, U.apply(this, arguments);
|
|
2151
|
+
};
|
|
2152
|
+
function Hr(e, i) {
|
|
2153
|
+
var t = {};
|
|
2154
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && i.indexOf(r) < 0 && (t[r] = e[r]);
|
|
2155
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
2156
|
+
for (var n = 0, r = Object.getOwnPropertySymbols(e); n < r.length; n++)
|
|
2157
|
+
i.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[n]) && (t[r[n]] = e[r[n]]);
|
|
2158
|
+
return t;
|
|
2159
|
+
}
|
|
2160
|
+
var Lr = {
|
|
2161
|
+
width: "auto",
|
|
2162
|
+
height: "auto",
|
|
2163
|
+
display: "inline-block",
|
|
2164
|
+
position: "absolute",
|
|
2165
|
+
top: 0,
|
|
2166
|
+
left: 0
|
|
2167
|
+
}, kr = function(e) {
|
|
2168
|
+
return {
|
|
2169
|
+
bottom: e,
|
|
2170
|
+
bottomLeft: e,
|
|
2171
|
+
bottomRight: e,
|
|
2172
|
+
left: e,
|
|
2173
|
+
right: e,
|
|
2174
|
+
top: e,
|
|
2175
|
+
topLeft: e,
|
|
2176
|
+
topRight: e
|
|
2177
|
+
};
|
|
2178
|
+
}, jr = (
|
|
2179
|
+
/** @class */
|
|
2180
|
+
function(e) {
|
|
2181
|
+
Nr(i, e);
|
|
2182
|
+
function i(t) {
|
|
2183
|
+
var r = e.call(this, t) || this;
|
|
2184
|
+
return r.resizingPosition = { x: 0, y: 0 }, r.offsetFromParent = { left: 0, top: 0 }, r.resizableElement = { current: null }, r.originalPosition = { x: 0, y: 0 }, r.state = {
|
|
2185
|
+
resizing: !1,
|
|
2186
|
+
bounds: {
|
|
2187
|
+
top: 0,
|
|
2188
|
+
right: 0,
|
|
2189
|
+
bottom: 0,
|
|
2190
|
+
left: 0
|
|
2191
|
+
},
|
|
2192
|
+
maxWidth: t.maxWidth,
|
|
2193
|
+
maxHeight: t.maxHeight
|
|
2194
|
+
}, r.onResizeStart = r.onResizeStart.bind(r), r.onResize = r.onResize.bind(r), r.onResizeStop = r.onResizeStop.bind(r), r.onDragStart = r.onDragStart.bind(r), r.onDrag = r.onDrag.bind(r), r.onDragStop = r.onDragStop.bind(r), r.getMaxSizesFromProps = r.getMaxSizesFromProps.bind(r), r;
|
|
2195
|
+
}
|
|
2196
|
+
return i.prototype.componentDidMount = function() {
|
|
2197
|
+
this.updateOffsetFromParent();
|
|
2198
|
+
var t = this.offsetFromParent, r = t.left, n = t.top, o = this.getDraggablePosition(), a = o.x, s = o.y;
|
|
2199
|
+
this.draggable.setState({
|
|
2200
|
+
x: a - r,
|
|
2201
|
+
y: s - n
|
|
2202
|
+
}), this.forceUpdate();
|
|
2203
|
+
}, i.prototype.getDraggablePosition = function() {
|
|
2204
|
+
var t = this.draggable.state, r = t.x, n = t.y;
|
|
2205
|
+
return { x: r, y: n };
|
|
2206
|
+
}, i.prototype.getParent = function() {
|
|
2207
|
+
return this.resizable && this.resizable.parentNode;
|
|
2208
|
+
}, i.prototype.getParentSize = function() {
|
|
2209
|
+
return this.resizable.getParentSize();
|
|
2210
|
+
}, i.prototype.getMaxSizesFromProps = function() {
|
|
2211
|
+
var t = typeof this.props.maxWidth > "u" ? Number.MAX_SAFE_INTEGER : this.props.maxWidth, r = typeof this.props.maxHeight > "u" ? Number.MAX_SAFE_INTEGER : this.props.maxHeight;
|
|
2212
|
+
return { maxWidth: t, maxHeight: r };
|
|
2213
|
+
}, i.prototype.getSelfElement = function() {
|
|
2214
|
+
return this.resizable && this.resizable.resizable;
|
|
2215
|
+
}, i.prototype.getOffsetHeight = function(t) {
|
|
2216
|
+
var r = this.props.scale;
|
|
2217
|
+
switch (this.props.bounds) {
|
|
2218
|
+
case "window":
|
|
2219
|
+
return window.innerHeight / r;
|
|
2220
|
+
case "body":
|
|
2221
|
+
return document.body.offsetHeight / r;
|
|
2222
|
+
default:
|
|
2223
|
+
return t.offsetHeight;
|
|
2224
|
+
}
|
|
2225
|
+
}, i.prototype.getOffsetWidth = function(t) {
|
|
2226
|
+
var r = this.props.scale;
|
|
2227
|
+
switch (this.props.bounds) {
|
|
2228
|
+
case "window":
|
|
2229
|
+
return window.innerWidth / r;
|
|
2230
|
+
case "body":
|
|
2231
|
+
return document.body.offsetWidth / r;
|
|
2232
|
+
default:
|
|
2233
|
+
return t.offsetWidth;
|
|
2234
|
+
}
|
|
2235
|
+
}, i.prototype.onDragStart = function(t, r) {
|
|
2236
|
+
this.props.onDragStart && this.props.onDragStart(t, r);
|
|
2237
|
+
var n = this.getDraggablePosition();
|
|
2238
|
+
if (this.originalPosition = n, !!this.props.bounds) {
|
|
2239
|
+
var o = this.getParent(), a = this.props.scale, s;
|
|
2240
|
+
if (this.props.bounds === "parent")
|
|
2241
|
+
s = o;
|
|
2242
|
+
else if (this.props.bounds === "body") {
|
|
2243
|
+
var f = o.getBoundingClientRect(), u = f.left, p = f.top, g = document.body.getBoundingClientRect(), b = -(u - o.offsetLeft * a - g.left) / a, S = -(p - o.offsetTop * a - g.top) / a, z = (document.body.offsetWidth - this.resizable.size.width * a) / a + b, w = (document.body.offsetHeight - this.resizable.size.height * a) / a + S;
|
|
2244
|
+
return this.setState({ bounds: { top: S, right: z, bottom: w, left: b } });
|
|
2245
|
+
} else if (this.props.bounds === "window") {
|
|
2246
|
+
if (!this.resizable)
|
|
2247
|
+
return;
|
|
2248
|
+
var E = o.getBoundingClientRect(), D = E.left, y = E.top, h = -(D - o.offsetLeft * a) / a, d = -(y - o.offsetTop * a) / a, z = (window.innerWidth - this.resizable.size.width * a) / a + h, w = (window.innerHeight - this.resizable.size.height * a) / a + d;
|
|
2249
|
+
return this.setState({ bounds: { top: d, right: z, bottom: w, left: h } });
|
|
2250
|
+
} else typeof this.props.bounds == "string" ? s = document.querySelector(this.props.bounds) : this.props.bounds instanceof HTMLElement && (s = this.props.bounds);
|
|
2251
|
+
if (!(!(s instanceof HTMLElement) || !(o instanceof HTMLElement))) {
|
|
2252
|
+
var l = s.getBoundingClientRect(), R = l.left, x = l.top, k = o.getBoundingClientRect(), B = k.left, Y = k.top, X = (R - B) / a, j = x - Y;
|
|
2253
|
+
if (this.resizable) {
|
|
2254
|
+
this.updateOffsetFromParent();
|
|
2255
|
+
var q = this.offsetFromParent;
|
|
2256
|
+
this.setState({
|
|
2257
|
+
bounds: {
|
|
2258
|
+
top: j - q.top,
|
|
2259
|
+
right: X + (s.offsetWidth - this.resizable.size.width) - q.left / a,
|
|
2260
|
+
bottom: j + (s.offsetHeight - this.resizable.size.height) - q.top,
|
|
2261
|
+
left: X - q.left / a
|
|
2262
|
+
}
|
|
2263
|
+
});
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
}, i.prototype.onDrag = function(t, r) {
|
|
2268
|
+
if (this.props.onDrag) {
|
|
2269
|
+
var n = this.offsetFromParent, o = n.left, a = n.top;
|
|
2270
|
+
if (!this.props.dragAxis || this.props.dragAxis === "both")
|
|
2271
|
+
return this.props.onDrag(t, U(U({}, r), { x: r.x + o, y: r.y + a }));
|
|
2272
|
+
if (this.props.dragAxis === "x")
|
|
2273
|
+
return this.props.onDrag(t, U(U({}, r), { x: r.x + o, y: this.originalPosition.y + a, deltaY: 0 }));
|
|
2274
|
+
if (this.props.dragAxis === "y")
|
|
2275
|
+
return this.props.onDrag(t, U(U({}, r), { x: this.originalPosition.x + o, y: r.y + a, deltaX: 0 }));
|
|
2276
|
+
}
|
|
2277
|
+
}, i.prototype.onDragStop = function(t, r) {
|
|
2278
|
+
if (this.props.onDragStop) {
|
|
2279
|
+
var n = this.offsetFromParent, o = n.left, a = n.top;
|
|
2280
|
+
if (!this.props.dragAxis || this.props.dragAxis === "both")
|
|
2281
|
+
return this.props.onDragStop(t, U(U({}, r), { x: r.x + o, y: r.y + a }));
|
|
2282
|
+
if (this.props.dragAxis === "x")
|
|
2283
|
+
return this.props.onDragStop(t, U(U({}, r), { x: r.x + o, y: this.originalPosition.y + a, deltaY: 0 }));
|
|
2284
|
+
if (this.props.dragAxis === "y")
|
|
2285
|
+
return this.props.onDragStop(t, U(U({}, r), { x: this.originalPosition.x + o, y: r.y + a, deltaX: 0 }));
|
|
2286
|
+
}
|
|
2287
|
+
}, i.prototype.onResizeStart = function(t, r, n) {
|
|
2288
|
+
t.stopPropagation(), this.setState({
|
|
2289
|
+
resizing: !0
|
|
2290
|
+
});
|
|
2291
|
+
var o = this.props.scale, a = this.offsetFromParent, s = this.getDraggablePosition();
|
|
2292
|
+
if (this.resizingPosition = { x: s.x + a.left, y: s.y + a.top }, this.originalPosition = s, this.props.bounds) {
|
|
2293
|
+
var f = this.getParent(), u = void 0;
|
|
2294
|
+
this.props.bounds === "parent" ? u = f : this.props.bounds === "body" ? u = document.body : this.props.bounds === "window" ? u = window : typeof this.props.bounds == "string" ? u = document.querySelector(this.props.bounds) : this.props.bounds instanceof HTMLElement && (u = this.props.bounds);
|
|
2295
|
+
var p = this.getSelfElement();
|
|
2296
|
+
if (p instanceof Element && (u instanceof HTMLElement || u === window) && f instanceof HTMLElement) {
|
|
2297
|
+
var g = this.getMaxSizesFromProps(), b = g.maxWidth, S = g.maxHeight, z = this.getParentSize();
|
|
2298
|
+
if (b && typeof b == "string")
|
|
2299
|
+
if (b.endsWith("%")) {
|
|
2300
|
+
var w = Number(b.replace("%", "")) / 100;
|
|
2301
|
+
b = z.width * w;
|
|
2302
|
+
} else b.endsWith("px") && (b = Number(b.replace("px", "")));
|
|
2303
|
+
if (S && typeof S == "string")
|
|
2304
|
+
if (S.endsWith("%")) {
|
|
2305
|
+
var w = Number(S.replace("%", "")) / 100;
|
|
2306
|
+
S = z.height * w;
|
|
2307
|
+
} else S.endsWith("px") && (S = Number(S.replace("px", "")));
|
|
2308
|
+
var E = p.getBoundingClientRect(), D = E.left, y = E.top, h = this.props.bounds === "window" ? { left: 0, top: 0 } : u.getBoundingClientRect(), d = h.left, l = h.top, R = this.getOffsetWidth(u), x = this.getOffsetHeight(u), k = r.toLowerCase().endsWith("left"), B = r.toLowerCase().endsWith("right"), Y = r.startsWith("top"), X = r.startsWith("bottom");
|
|
2309
|
+
if ((k || Y) && this.resizable) {
|
|
2310
|
+
var j = (D - d) / o + this.resizable.size.width;
|
|
2311
|
+
this.setState({ maxWidth: j > Number(b) ? b : j });
|
|
2312
|
+
}
|
|
2313
|
+
if (B || this.props.lockAspectRatio && !k && !Y) {
|
|
2314
|
+
var j = R + (d - D) / o;
|
|
2315
|
+
this.setState({ maxWidth: j > Number(b) ? b : j });
|
|
2316
|
+
}
|
|
2317
|
+
if ((Y || k) && this.resizable) {
|
|
2318
|
+
var j = (y - l) / o + this.resizable.size.height;
|
|
2319
|
+
this.setState({
|
|
2320
|
+
maxHeight: j > Number(S) ? S : j
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
if (X || this.props.lockAspectRatio && !Y && !k) {
|
|
2324
|
+
var j = x + (l - y) / o;
|
|
2325
|
+
this.setState({
|
|
2326
|
+
maxHeight: j > Number(S) ? S : j
|
|
2327
|
+
});
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
} else
|
|
2331
|
+
this.setState({
|
|
2332
|
+
maxWidth: this.props.maxWidth,
|
|
2333
|
+
maxHeight: this.props.maxHeight
|
|
2334
|
+
});
|
|
2335
|
+
this.props.onResizeStart && this.props.onResizeStart(t, r, n);
|
|
2336
|
+
}, i.prototype.onResize = function(t, r, n, o) {
|
|
2337
|
+
var a = { x: this.originalPosition.x, y: this.originalPosition.y }, s = -o.width, f = -o.height, u = ["top", "left", "topLeft", "bottomLeft", "topRight"];
|
|
2338
|
+
u.includes(r) && (r === "bottomLeft" ? a.x += s : (r === "topRight" || (a.x += s), a.y += f));
|
|
2339
|
+
var p = this.draggable.state;
|
|
2340
|
+
(a.x !== p.x || a.y !== p.y) && this.draggable.setState(a), this.updateOffsetFromParent();
|
|
2341
|
+
var g = this.offsetFromParent, b = this.getDraggablePosition().x + g.left, S = this.getDraggablePosition().y + g.top;
|
|
2342
|
+
this.resizingPosition = { x: b, y: S }, this.props.onResize && this.props.onResize(t, r, n, o, {
|
|
2343
|
+
x: b,
|
|
2344
|
+
y: S
|
|
2345
|
+
});
|
|
2346
|
+
}, i.prototype.onResizeStop = function(t, r, n, o) {
|
|
2347
|
+
this.setState({
|
|
2348
|
+
resizing: !1
|
|
2349
|
+
});
|
|
2350
|
+
var a = this.getMaxSizesFromProps(), s = a.maxWidth, f = a.maxHeight;
|
|
2351
|
+
this.setState({ maxWidth: s, maxHeight: f }), this.props.onResizeStop && this.props.onResizeStop(t, r, n, o, this.resizingPosition);
|
|
2352
|
+
}, i.prototype.updateSize = function(t) {
|
|
2353
|
+
this.resizable && this.resizable.updateSize({ width: t.width, height: t.height });
|
|
2354
|
+
}, i.prototype.updatePosition = function(t) {
|
|
2355
|
+
this.draggable.setState(t);
|
|
2356
|
+
}, i.prototype.updateOffsetFromParent = function() {
|
|
2357
|
+
var t = this.props.scale, r = this.getParent(), n = this.getSelfElement();
|
|
2358
|
+
if (!r || n === null)
|
|
2359
|
+
return {
|
|
2360
|
+
top: 0,
|
|
2361
|
+
left: 0
|
|
2362
|
+
};
|
|
2363
|
+
var o = r.getBoundingClientRect(), a = o.left, s = o.top, f = n.getBoundingClientRect(), u = this.getDraggablePosition(), p = r.scrollLeft, g = r.scrollTop;
|
|
2364
|
+
this.offsetFromParent = {
|
|
2365
|
+
left: f.left - a + p - u.x * t,
|
|
2366
|
+
top: f.top - s + g - u.y * t
|
|
2367
|
+
};
|
|
2368
|
+
}, i.prototype.render = function() {
|
|
2369
|
+
var t = this, r = this.props, n = r.disableDragging, o = r.style, a = r.dragHandleClassName, s = r.position, f = r.onMouseDown, u = r.onMouseUp, p = r.dragAxis, g = r.dragGrid, b = r.bounds, S = r.enableUserSelectHack, z = r.cancel, w = r.children;
|
|
2370
|
+
r.onResizeStart, r.onResize, r.onResizeStop, r.onDragStart, r.onDrag, r.onDragStop;
|
|
2371
|
+
var E = r.resizeHandleStyles, D = r.resizeHandleClasses, y = r.resizeHandleComponent, h = r.enableResizing, d = r.resizeGrid, l = r.resizeHandleWrapperClass, R = r.resizeHandleWrapperStyle, x = r.scale, k = r.allowAnyClick, B = Hr(r, ["disableDragging", "style", "dragHandleClassName", "position", "onMouseDown", "onMouseUp", "dragAxis", "dragGrid", "bounds", "enableUserSelectHack", "cancel", "children", "onResizeStart", "onResize", "onResizeStop", "onDragStart", "onDrag", "onDragStop", "resizeHandleStyles", "resizeHandleClasses", "resizeHandleComponent", "enableResizing", "resizeGrid", "resizeHandleWrapperClass", "resizeHandleWrapperStyle", "scale", "allowAnyClick"]), Y = this.props.default ? U({}, this.props.default) : void 0;
|
|
2372
|
+
delete B.default;
|
|
2373
|
+
var X = n || a ? { cursor: "auto" } : { cursor: "move" }, j = U(U(U({}, Lr), X), o), q = this.offsetFromParent, V = q.left, ie = q.top, I;
|
|
2374
|
+
s && (I = {
|
|
2375
|
+
x: s.x - V,
|
|
2376
|
+
y: s.y - ie
|
|
2377
|
+
});
|
|
2378
|
+
var Z = this.state.resizing ? void 0 : I, ne = this.state.resizing ? "both" : p;
|
|
2379
|
+
return qe(
|
|
2380
|
+
Er,
|
|
2381
|
+
{
|
|
2382
|
+
ref: function(K) {
|
|
2383
|
+
K && (t.draggable = K);
|
|
2384
|
+
},
|
|
2385
|
+
handle: a ? ".".concat(a) : void 0,
|
|
2386
|
+
defaultPosition: Y,
|
|
2387
|
+
onMouseDown: f,
|
|
2388
|
+
// @ts-expect-error
|
|
2389
|
+
onMouseUp: u,
|
|
2390
|
+
onStart: this.onDragStart,
|
|
2391
|
+
onDrag: this.onDrag,
|
|
2392
|
+
onStop: this.onDragStop,
|
|
2393
|
+
axis: ne,
|
|
2394
|
+
disabled: n,
|
|
2395
|
+
grid: g,
|
|
2396
|
+
bounds: b ? this.state.bounds : void 0,
|
|
2397
|
+
position: Z,
|
|
2398
|
+
enableUserSelectHack: S,
|
|
2399
|
+
cancel: z,
|
|
2400
|
+
scale: x,
|
|
2401
|
+
allowAnyClick: k,
|
|
2402
|
+
nodeRef: this.resizableElement
|
|
2403
|
+
},
|
|
2404
|
+
qe(Ar, U({}, B, { ref: function(K) {
|
|
2405
|
+
K && (t.resizable = K, t.resizableElement.current = K.resizable);
|
|
2406
|
+
}, defaultSize: Y, size: this.props.size, enable: typeof h == "boolean" ? kr(h) : h, onResizeStart: this.onResizeStart, onResize: this.onResize, onResizeStop: this.onResizeStop, style: j, minWidth: this.props.minWidth, minHeight: this.props.minHeight, maxWidth: this.state.resizing ? this.state.maxWidth : this.props.maxWidth, maxHeight: this.state.resizing ? this.state.maxHeight : this.props.maxHeight, grid: d, handleWrapperClass: l, handleWrapperStyle: R, lockAspectRatio: this.props.lockAspectRatio, lockAspectRatioExtraWidth: this.props.lockAspectRatioExtraWidth, lockAspectRatioExtraHeight: this.props.lockAspectRatioExtraHeight, handleStyles: E, handleClasses: D, handleComponent: y, scale: this.props.scale }), w)
|
|
2407
|
+
);
|
|
2408
|
+
}, i.defaultProps = {
|
|
2409
|
+
maxWidth: Number.MAX_SAFE_INTEGER,
|
|
2410
|
+
maxHeight: Number.MAX_SAFE_INTEGER,
|
|
2411
|
+
scale: 1,
|
|
2412
|
+
onResizeStart: function() {
|
|
2413
|
+
},
|
|
2414
|
+
onResize: function() {
|
|
2415
|
+
},
|
|
2416
|
+
onResizeStop: function() {
|
|
2417
|
+
},
|
|
2418
|
+
onDragStart: function() {
|
|
2419
|
+
},
|
|
2420
|
+
onDrag: function() {
|
|
2421
|
+
},
|
|
2422
|
+
onDragStop: function() {
|
|
2423
|
+
}
|
|
2424
|
+
}, i;
|
|
2425
|
+
}(Pt)
|
|
2426
|
+
), Ir = /* @__PURE__ */ ((e) => (e[e.truePositive = 0] = "truePositive", e[e.falsePositive = 1] = "falsePositive", e[e.suggestion = 2] = "suggestion", e))(Ir || {});
|
|
2427
|
+
const Yr = {
|
|
2428
|
+
0: "#84cc16",
|
|
2429
|
+
1: "#cc2216",
|
|
2430
|
+
2: "#84cc16"
|
|
2431
|
+
}, $r = {
|
|
2432
|
+
0: "#ffffff",
|
|
2433
|
+
1: "#c95d55",
|
|
2434
|
+
2: "#3dd8ff"
|
|
2435
|
+
}, Vr = (e) => {
|
|
2436
|
+
const [i, t] = Rt(e.initialScale ?? 1);
|
|
2437
|
+
Ct(({ state: o }) => {
|
|
2438
|
+
t(o.scale);
|
|
2439
|
+
});
|
|
2440
|
+
let r = e.selected ? Yr[e.type] : $r[e.type];
|
|
2441
|
+
const n = e.type !== 1;
|
|
2442
|
+
return e.difficult && (r = e.selected ? "#fae352" : "#ad9e3d"), /* @__PURE__ */ Xe(
|
|
2443
|
+
jr,
|
|
2444
|
+
{
|
|
2445
|
+
className: `${e.className ?? ""} border-solid`,
|
|
2446
|
+
style: {
|
|
2447
|
+
zIndex: e.zIndex,
|
|
2448
|
+
borderColor: r,
|
|
2449
|
+
borderWidth: 2 * (1 / i)
|
|
2450
|
+
},
|
|
2451
|
+
bounds: "parent",
|
|
2452
|
+
scale: i,
|
|
2453
|
+
position: {
|
|
2454
|
+
x: e.x,
|
|
2455
|
+
y: e.y
|
|
2456
|
+
},
|
|
2457
|
+
size: {
|
|
2458
|
+
width: e.w,
|
|
2459
|
+
height: e.h
|
|
2460
|
+
},
|
|
2461
|
+
onDragStop: e.onDragStop,
|
|
2462
|
+
onResizeStop: e.onResizeStop,
|
|
2463
|
+
disableDragging: !n,
|
|
2464
|
+
enableResizing: n,
|
|
2465
|
+
onMouseDown: e.onMouseDown,
|
|
2466
|
+
children: [
|
|
2467
|
+
/* @__PURE__ */ he(
|
|
2468
|
+
"mark",
|
|
2469
|
+
{
|
|
2470
|
+
className: `absolute bottom-[-25px] right-[-2px] ${e.type === 1 ? "line-through" : ""} decoration-2`,
|
|
2471
|
+
style: {
|
|
2472
|
+
backgroundColor: r,
|
|
2473
|
+
transform: `scale(${(1 / i).toString()})`,
|
|
2474
|
+
transformOrigin: "top right"
|
|
2475
|
+
},
|
|
2476
|
+
children: e.label
|
|
2477
|
+
}
|
|
2478
|
+
),
|
|
2479
|
+
/* @__PURE__ */ Xe(
|
|
2480
|
+
"div",
|
|
2481
|
+
{
|
|
2482
|
+
className: "absolute right-[-27px] z-20 grid grid-rows-1",
|
|
2483
|
+
style: {
|
|
2484
|
+
visibility: e.selected ? "visible" : "hidden",
|
|
2485
|
+
transform: `scale(${(1 / i).toString()})`,
|
|
2486
|
+
transformOrigin: "top left",
|
|
2487
|
+
top: -13 * (1 / i)
|
|
2488
|
+
},
|
|
2489
|
+
children: [
|
|
2490
|
+
/* @__PURE__ */ he(
|
|
2491
|
+
"div",
|
|
2492
|
+
{
|
|
2493
|
+
className: "flex h-6 w-6 flex-shrink-0 cursor-pointer items-center justify-center rounded-full bg-red-400",
|
|
2494
|
+
onClick: e.onClickDelete,
|
|
2495
|
+
children: /* @__PURE__ */ he(
|
|
2496
|
+
"svg",
|
|
2497
|
+
{
|
|
2498
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2499
|
+
className: "h-6 w-6",
|
|
2500
|
+
fill: "none",
|
|
2501
|
+
viewBox: "0 0 24 24",
|
|
2502
|
+
stroke: "currentColor",
|
|
2503
|
+
children: /* @__PURE__ */ he(
|
|
2504
|
+
"path",
|
|
2505
|
+
{
|
|
2506
|
+
strokeLinecap: "round",
|
|
2507
|
+
strokeLinejoin: "round",
|
|
2508
|
+
strokeWidth: "2",
|
|
2509
|
+
d: "M18 12H6"
|
|
2510
|
+
}
|
|
2511
|
+
)
|
|
2512
|
+
}
|
|
2513
|
+
)
|
|
2514
|
+
}
|
|
2515
|
+
),
|
|
2516
|
+
n && /* @__PURE__ */ he(
|
|
2517
|
+
"div",
|
|
2518
|
+
{
|
|
2519
|
+
className: "flex h-6 w-6 flex-shrink-0 cursor-pointer items-center justify-center rounded-full bg-blue-400",
|
|
2520
|
+
onClick: e.onClickEdit,
|
|
2521
|
+
children: /* @__PURE__ */ he(
|
|
2522
|
+
"svg",
|
|
2523
|
+
{
|
|
2524
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2525
|
+
className: "h-4 w-4",
|
|
2526
|
+
fill: "none",
|
|
2527
|
+
viewBox: "0 0 24 24",
|
|
2528
|
+
stroke: "currentColor",
|
|
2529
|
+
children: /* @__PURE__ */ he(
|
|
2530
|
+
"path",
|
|
2531
|
+
{
|
|
2532
|
+
strokeLinecap: "round",
|
|
2533
|
+
strokeLinejoin: "round",
|
|
2534
|
+
strokeWidth: "2",
|
|
2535
|
+
d: "M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"
|
|
2536
|
+
}
|
|
2537
|
+
)
|
|
2538
|
+
}
|
|
2539
|
+
)
|
|
2540
|
+
}
|
|
2541
|
+
)
|
|
2542
|
+
]
|
|
2543
|
+
}
|
|
2544
|
+
)
|
|
2545
|
+
]
|
|
2546
|
+
}
|
|
2547
|
+
);
|
|
2548
|
+
};
|
|
2549
|
+
export {
|
|
2550
|
+
Vr as BoundingBox,
|
|
2551
|
+
Ir as BoundingBoxType
|
|
2552
|
+
};
|
|
2553
|
+
//# sourceMappingURL=BoundingBox.js.map
|