react-sync-board 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-sync-board.js +1059 -1032
- package/dist/react-sync-board.js.map +1 -1
- package/dist/react-sync-board.umd.cjs +26 -26
- package/dist/react-sync-board.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/react-sync-board.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var kt = (e, t, r) => (
|
|
4
|
-
import g, { useContext as _e, useDebugValue as
|
|
5
|
-
function
|
|
1
|
+
var Lr = Object.defineProperty;
|
|
2
|
+
var zr = (e, t, r) => t in e ? Lr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var kt = (e, t, r) => (zr(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import g, { useContext as _e, useDebugValue as Yr, useRef as Re, useMemo as lt, useEffect as Pe, useCallback as tr, memo as rr } from "react";
|
|
5
|
+
function Br(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var Ie = {},
|
|
8
|
+
var Ie = {}, Nr = {
|
|
9
9
|
get exports() {
|
|
10
10
|
return Ie;
|
|
11
11
|
},
|
|
@@ -23,24 +23,24 @@ var Ie = {}, Yr = {
|
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
24
|
*/
|
|
25
25
|
var Pt;
|
|
26
|
-
function
|
|
26
|
+
function Xr() {
|
|
27
27
|
if (Pt)
|
|
28
28
|
return Ee;
|
|
29
29
|
Pt = 1;
|
|
30
30
|
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
31
|
-
function
|
|
32
|
-
var f,
|
|
31
|
+
function a(u, l, d) {
|
|
32
|
+
var f, c = {}, h = null, _ = null;
|
|
33
33
|
d !== void 0 && (h = "" + d), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (_ = l.ref);
|
|
34
34
|
for (f in l)
|
|
35
|
-
n.call(l, f) && !s.hasOwnProperty(f) && (
|
|
35
|
+
n.call(l, f) && !s.hasOwnProperty(f) && (c[f] = l[f]);
|
|
36
36
|
if (u && u.defaultProps)
|
|
37
37
|
for (f in l = u.defaultProps, l)
|
|
38
|
-
|
|
39
|
-
return { $$typeof: t, type: u, key: h, ref: _, props:
|
|
38
|
+
c[f] === void 0 && (c[f] = l[f]);
|
|
39
|
+
return { $$typeof: t, type: u, key: h, ref: _, props: c, _owner: o.current };
|
|
40
40
|
}
|
|
41
|
-
return Ee.Fragment = r, Ee.jsx =
|
|
41
|
+
return Ee.Fragment = r, Ee.jsx = a, Ee.jsxs = a, Ee;
|
|
42
42
|
}
|
|
43
|
-
var
|
|
43
|
+
var we = {};
|
|
44
44
|
/**
|
|
45
45
|
* @license React
|
|
46
46
|
* react-jsx-runtime.development.js
|
|
@@ -51,9 +51,9 @@ var Ce = {};
|
|
|
51
51
|
* LICENSE file in the root directory of this source tree.
|
|
52
52
|
*/
|
|
53
53
|
var Mt;
|
|
54
|
-
function
|
|
54
|
+
function Ur() {
|
|
55
55
|
return Mt || (Mt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
56
|
-
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"),
|
|
56
|
+
var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), u = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), c = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), v = Symbol.iterator, E = "@@iterator";
|
|
57
57
|
function I(i) {
|
|
58
58
|
if (i === null || typeof i != "object")
|
|
59
59
|
return null;
|
|
@@ -61,36 +61,36 @@ function Nr() {
|
|
|
61
61
|
return typeof b == "function" ? b : null;
|
|
62
62
|
}
|
|
63
63
|
var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
64
|
-
function
|
|
64
|
+
function C(i) {
|
|
65
65
|
{
|
|
66
|
-
for (var b = arguments.length, R = new Array(b > 1 ? b - 1 : 0),
|
|
67
|
-
R[
|
|
66
|
+
for (var b = arguments.length, R = new Array(b > 1 ? b - 1 : 0), D = 1; D < b; D++)
|
|
67
|
+
R[D - 1] = arguments[D];
|
|
68
68
|
x("error", i, R);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
function x(i, b, R) {
|
|
72
72
|
{
|
|
73
|
-
var
|
|
73
|
+
var D = y.ReactDebugCurrentFrame, X = D.getStackAddendum();
|
|
74
74
|
X !== "" && (b += "%s", R = R.concat([X]));
|
|
75
|
-
var
|
|
76
|
-
return String(
|
|
75
|
+
var W = R.map(function(B) {
|
|
76
|
+
return String(B);
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
W.unshift("Warning: " + b), Function.prototype.apply.call(console[i], console, W);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var p = !1,
|
|
81
|
+
var p = !1, w = !1, m = !1, S = !1, O = !1, k;
|
|
82
82
|
k = Symbol.for("react.module.reference");
|
|
83
|
-
function
|
|
84
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || O || i === o || i === d || i === f || S || i === _ || p ||
|
|
83
|
+
function j(i) {
|
|
84
|
+
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || O || i === o || i === d || i === f || S || i === _ || p || w || m || typeof i == "object" && i !== null && (i.$$typeof === h || i.$$typeof === c || i.$$typeof === a || i.$$typeof === u || i.$$typeof === l || // This needs to include all possible module reference object
|
|
85
85
|
// types supported by any Flight configuration anywhere since
|
|
86
86
|
// we don't know which Flight build this will end up being used
|
|
87
87
|
// with.
|
|
88
88
|
i.$$typeof === k || i.getModuleId !== void 0));
|
|
89
89
|
}
|
|
90
90
|
function M(i, b, R) {
|
|
91
|
-
var
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
91
|
+
var D = i.displayName;
|
|
92
|
+
if (D)
|
|
93
|
+
return D;
|
|
94
94
|
var X = b.displayName || b.name || "";
|
|
95
95
|
return X !== "" ? R + "(" + X + ")" : R;
|
|
96
96
|
}
|
|
@@ -100,7 +100,7 @@ function Nr() {
|
|
|
100
100
|
function N(i) {
|
|
101
101
|
if (i == null)
|
|
102
102
|
return null;
|
|
103
|
-
if (typeof i.tag == "number" &&
|
|
103
|
+
if (typeof i.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
|
104
104
|
return i.displayName || i.name || null;
|
|
105
105
|
if (typeof i == "string")
|
|
106
106
|
return i;
|
|
@@ -123,18 +123,18 @@ function Nr() {
|
|
|
123
123
|
case u:
|
|
124
124
|
var b = i;
|
|
125
125
|
return L(b) + ".Consumer";
|
|
126
|
-
case
|
|
126
|
+
case a:
|
|
127
127
|
var R = i;
|
|
128
128
|
return L(R._context) + ".Provider";
|
|
129
129
|
case l:
|
|
130
130
|
return M(i, i.render, "ForwardRef");
|
|
131
|
-
case
|
|
132
|
-
var
|
|
133
|
-
return
|
|
131
|
+
case c:
|
|
132
|
+
var D = i.displayName || null;
|
|
133
|
+
return D !== null ? D : N(i.type) || "Memo";
|
|
134
134
|
case h: {
|
|
135
|
-
var X = i,
|
|
135
|
+
var X = i, W = X._payload, B = X._init;
|
|
136
136
|
try {
|
|
137
|
-
return N(
|
|
137
|
+
return N(B(W));
|
|
138
138
|
} catch {
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
@@ -142,18 +142,18 @@ function Nr() {
|
|
|
142
142
|
}
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
|
-
var
|
|
146
|
-
function
|
|
145
|
+
var U = Object.assign, J = 0, P, $, Y, V, A, F, H;
|
|
146
|
+
function Z() {
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
function
|
|
148
|
+
Z.__reactDisabledLog = !0;
|
|
149
|
+
function te() {
|
|
150
150
|
{
|
|
151
151
|
if (J === 0) {
|
|
152
|
-
P = console.log, $ = console.info,
|
|
152
|
+
P = console.log, $ = console.info, Y = console.warn, V = console.error, A = console.group, F = console.groupCollapsed, H = console.groupEnd;
|
|
153
153
|
var i = {
|
|
154
154
|
configurable: !0,
|
|
155
155
|
enumerable: !0,
|
|
156
|
-
value:
|
|
156
|
+
value: Z,
|
|
157
157
|
writable: !0
|
|
158
158
|
};
|
|
159
159
|
Object.defineProperties(console, {
|
|
@@ -178,30 +178,30 @@ function Nr() {
|
|
|
178
178
|
writable: !0
|
|
179
179
|
};
|
|
180
180
|
Object.defineProperties(console, {
|
|
181
|
-
log:
|
|
181
|
+
log: U({}, i, {
|
|
182
182
|
value: P
|
|
183
183
|
}),
|
|
184
|
-
info:
|
|
184
|
+
info: U({}, i, {
|
|
185
185
|
value: $
|
|
186
186
|
}),
|
|
187
|
-
warn:
|
|
188
|
-
value:
|
|
187
|
+
warn: U({}, i, {
|
|
188
|
+
value: Y
|
|
189
189
|
}),
|
|
190
|
-
error:
|
|
191
|
-
value:
|
|
190
|
+
error: U({}, i, {
|
|
191
|
+
value: V
|
|
192
192
|
}),
|
|
193
|
-
group:
|
|
193
|
+
group: U({}, i, {
|
|
194
194
|
value: A
|
|
195
195
|
}),
|
|
196
|
-
groupCollapsed:
|
|
196
|
+
groupCollapsed: U({}, i, {
|
|
197
197
|
value: F
|
|
198
198
|
}),
|
|
199
|
-
groupEnd:
|
|
200
|
-
value:
|
|
199
|
+
groupEnd: U({}, i, {
|
|
200
|
+
value: H
|
|
201
201
|
})
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
J < 0 &&
|
|
204
|
+
J < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
var se = y.ReactCurrentDispatcher, me;
|
|
@@ -211,101 +211,101 @@ function Nr() {
|
|
|
211
211
|
try {
|
|
212
212
|
throw Error();
|
|
213
213
|
} catch (X) {
|
|
214
|
-
var
|
|
215
|
-
me =
|
|
214
|
+
var D = X.stack.trim().match(/\n( *(at )?)/);
|
|
215
|
+
me = D && D[1] || "";
|
|
216
216
|
}
|
|
217
217
|
return `
|
|
218
218
|
` + me + i;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
var Ke = !1,
|
|
221
|
+
var Ke = !1, je;
|
|
222
222
|
{
|
|
223
|
-
var
|
|
224
|
-
|
|
223
|
+
var mr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
224
|
+
je = new mr();
|
|
225
225
|
}
|
|
226
226
|
function ht(i, b) {
|
|
227
227
|
if (!i || Ke)
|
|
228
228
|
return "";
|
|
229
229
|
{
|
|
230
|
-
var R =
|
|
230
|
+
var R = je.get(i);
|
|
231
231
|
if (R !== void 0)
|
|
232
232
|
return R;
|
|
233
233
|
}
|
|
234
|
-
var
|
|
234
|
+
var D;
|
|
235
235
|
Ke = !0;
|
|
236
236
|
var X = Error.prepareStackTrace;
|
|
237
237
|
Error.prepareStackTrace = void 0;
|
|
238
|
-
var
|
|
239
|
-
|
|
238
|
+
var W;
|
|
239
|
+
W = se.current, se.current = null, te();
|
|
240
240
|
try {
|
|
241
241
|
if (b) {
|
|
242
|
-
var
|
|
242
|
+
var B = function() {
|
|
243
243
|
throw Error();
|
|
244
244
|
};
|
|
245
|
-
if (Object.defineProperty(
|
|
245
|
+
if (Object.defineProperty(B.prototype, "props", {
|
|
246
246
|
set: function() {
|
|
247
247
|
throw Error();
|
|
248
248
|
}
|
|
249
249
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
250
250
|
try {
|
|
251
|
-
Reflect.construct(
|
|
251
|
+
Reflect.construct(B, []);
|
|
252
252
|
} catch (ie) {
|
|
253
|
-
|
|
253
|
+
D = ie;
|
|
254
254
|
}
|
|
255
|
-
Reflect.construct(i, [],
|
|
255
|
+
Reflect.construct(i, [], B);
|
|
256
256
|
} else {
|
|
257
257
|
try {
|
|
258
|
-
|
|
258
|
+
B.call();
|
|
259
259
|
} catch (ie) {
|
|
260
|
-
|
|
260
|
+
D = ie;
|
|
261
261
|
}
|
|
262
|
-
i.call(
|
|
262
|
+
i.call(B.prototype);
|
|
263
263
|
}
|
|
264
264
|
} else {
|
|
265
265
|
try {
|
|
266
266
|
throw Error();
|
|
267
267
|
} catch (ie) {
|
|
268
|
-
|
|
268
|
+
D = ie;
|
|
269
269
|
}
|
|
270
270
|
i();
|
|
271
271
|
}
|
|
272
272
|
} catch (ie) {
|
|
273
|
-
if (ie &&
|
|
273
|
+
if (ie && D && typeof ie.stack == "string") {
|
|
274
274
|
for (var z = ie.stack.split(`
|
|
275
|
-
`),
|
|
276
|
-
`), q = z.length - 1, G =
|
|
275
|
+
`), ee = D.stack.split(`
|
|
276
|
+
`), q = z.length - 1, G = ee.length - 1; q >= 1 && G >= 0 && z[q] !== ee[G]; )
|
|
277
277
|
G--;
|
|
278
278
|
for (; q >= 1 && G >= 0; q--, G--)
|
|
279
|
-
if (z[q] !==
|
|
279
|
+
if (z[q] !== ee[G]) {
|
|
280
280
|
if (q !== 1 || G !== 1)
|
|
281
281
|
do
|
|
282
|
-
if (q--, G--, G < 0 || z[q] !==
|
|
283
|
-
var
|
|
282
|
+
if (q--, G--, G < 0 || z[q] !== ee[G]) {
|
|
283
|
+
var re = `
|
|
284
284
|
` + z[q].replace(" at new ", " at ");
|
|
285
|
-
return i.displayName &&
|
|
285
|
+
return i.displayName && re.includes("<anonymous>") && (re = re.replace("<anonymous>", i.displayName)), typeof i == "function" && je.set(i, re), re;
|
|
286
286
|
}
|
|
287
287
|
while (q >= 1 && G >= 0);
|
|
288
288
|
break;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
} finally {
|
|
292
|
-
Ke = !1, se.current =
|
|
292
|
+
Ke = !1, se.current = W, le(), Error.prepareStackTrace = X;
|
|
293
293
|
}
|
|
294
294
|
var ve = i ? i.displayName || i.name : "", Tt = ve ? ge(ve) : "";
|
|
295
|
-
return typeof i == "function" &&
|
|
295
|
+
return typeof i == "function" && je.set(i, Tt), Tt;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function gr(i, b, R) {
|
|
298
298
|
return ht(i, !1);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function hr(i) {
|
|
301
301
|
var b = i.prototype;
|
|
302
302
|
return !!(b && b.isReactComponent);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function De(i, b, R) {
|
|
305
305
|
if (i == null)
|
|
306
306
|
return "";
|
|
307
307
|
if (typeof i == "function")
|
|
308
|
-
return ht(i,
|
|
308
|
+
return ht(i, hr(i));
|
|
309
309
|
if (typeof i == "string")
|
|
310
310
|
return ge(i);
|
|
311
311
|
switch (i) {
|
|
@@ -317,13 +317,13 @@ function Nr() {
|
|
|
317
317
|
if (typeof i == "object")
|
|
318
318
|
switch (i.$$typeof) {
|
|
319
319
|
case l:
|
|
320
|
-
return
|
|
321
|
-
case
|
|
322
|
-
return
|
|
320
|
+
return gr(i.render);
|
|
321
|
+
case c:
|
|
322
|
+
return De(i.type, b, R);
|
|
323
323
|
case h: {
|
|
324
|
-
var
|
|
324
|
+
var D = i, X = D._payload, W = D._init;
|
|
325
325
|
try {
|
|
326
|
-
return
|
|
326
|
+
return De(W(X), b, R);
|
|
327
327
|
} catch {
|
|
328
328
|
}
|
|
329
329
|
}
|
|
@@ -333,41 +333,41 @@ function Nr() {
|
|
|
333
333
|
var $e = Object.prototype.hasOwnProperty, vt = {}, yt = y.ReactDebugCurrentFrame;
|
|
334
334
|
function Ae(i) {
|
|
335
335
|
if (i) {
|
|
336
|
-
var b = i._owner, R =
|
|
336
|
+
var b = i._owner, R = De(i.type, i._source, b ? b.type : null);
|
|
337
337
|
yt.setExtraStackFrame(R);
|
|
338
338
|
} else
|
|
339
339
|
yt.setExtraStackFrame(null);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function vr(i, b, R, D, X) {
|
|
342
342
|
{
|
|
343
|
-
var
|
|
344
|
-
for (var
|
|
345
|
-
if (
|
|
343
|
+
var W = Function.call.bind($e);
|
|
344
|
+
for (var B in i)
|
|
345
|
+
if (W(i, B)) {
|
|
346
346
|
var z = void 0;
|
|
347
347
|
try {
|
|
348
|
-
if (typeof i[
|
|
349
|
-
var
|
|
350
|
-
throw
|
|
348
|
+
if (typeof i[B] != "function") {
|
|
349
|
+
var ee = Error((D || "React class") + ": " + R + " type `" + B + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[B] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
350
|
+
throw ee.name = "Invariant Violation", ee;
|
|
351
351
|
}
|
|
352
|
-
z = i[
|
|
352
|
+
z = i[B](b, B, D, R, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
353
353
|
} catch (q) {
|
|
354
354
|
z = q;
|
|
355
355
|
}
|
|
356
|
-
z && !(z instanceof Error) && (Ae(X),
|
|
356
|
+
z && !(z instanceof Error) && (Ae(X), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", D || "React class", R, B, typeof z), Ae(null)), z instanceof Error && !(z.message in vt) && (vt[z.message] = !0, Ae(X), C("Failed %s type: %s", R, z.message), Ae(null));
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
var
|
|
360
|
+
var yr = Array.isArray;
|
|
361
361
|
function He(i) {
|
|
362
|
-
return
|
|
362
|
+
return yr(i);
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function Sr(i) {
|
|
365
365
|
{
|
|
366
366
|
var b = typeof Symbol == "function" && Symbol.toStringTag, R = b && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
|
367
367
|
return R;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function _r(i) {
|
|
371
371
|
try {
|
|
372
372
|
return St(i), !1;
|
|
373
373
|
} catch {
|
|
@@ -378,17 +378,17 @@ function Nr() {
|
|
|
378
378
|
return "" + i;
|
|
379
379
|
}
|
|
380
380
|
function _t(i) {
|
|
381
|
-
if (
|
|
382
|
-
return
|
|
381
|
+
if (_r(i))
|
|
382
|
+
return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Sr(i)), St(i);
|
|
383
383
|
}
|
|
384
|
-
var be = y.ReactCurrentOwner,
|
|
384
|
+
var be = y.ReactCurrentOwner, br = {
|
|
385
385
|
key: !0,
|
|
386
386
|
ref: !0,
|
|
387
387
|
__self: !0,
|
|
388
388
|
__source: !0
|
|
389
389
|
}, bt, Et, qe;
|
|
390
390
|
qe = {};
|
|
391
|
-
function
|
|
391
|
+
function Er(i) {
|
|
392
392
|
if ($e.call(i, "ref")) {
|
|
393
393
|
var b = Object.getOwnPropertyDescriptor(i, "ref").get;
|
|
394
394
|
if (b && b.isReactWarning)
|
|
@@ -396,7 +396,7 @@ function Nr() {
|
|
|
396
396
|
}
|
|
397
397
|
return i.ref !== void 0;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function wr(i) {
|
|
400
400
|
if ($e.call(i, "key")) {
|
|
401
401
|
var b = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
402
402
|
if (b && b.isReactWarning)
|
|
@@ -404,16 +404,16 @@ function Nr() {
|
|
|
404
404
|
}
|
|
405
405
|
return i.key !== void 0;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Cr(i, b) {
|
|
408
408
|
if (typeof i.ref == "string" && be.current && b && be.current.stateNode !== b) {
|
|
409
409
|
var R = N(be.current.type);
|
|
410
|
-
qe[R] || (
|
|
410
|
+
qe[R] || (C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', N(be.current.type), i.ref), qe[R] = !0);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function xr(i, b) {
|
|
414
414
|
{
|
|
415
415
|
var R = function() {
|
|
416
|
-
bt || (bt = !0,
|
|
416
|
+
bt || (bt = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
417
417
|
};
|
|
418
418
|
R.isReactWarning = !0, Object.defineProperty(i, "key", {
|
|
419
419
|
get: R,
|
|
@@ -421,10 +421,10 @@ function Nr() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Rr(i, b) {
|
|
425
425
|
{
|
|
426
426
|
var R = function() {
|
|
427
|
-
Et || (Et = !0,
|
|
427
|
+
Et || (Et = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", b));
|
|
428
428
|
};
|
|
429
429
|
R.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
|
430
430
|
get: R,
|
|
@@ -432,7 +432,7 @@ function Nr() {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
var
|
|
435
|
+
var Ir = function(i, b, R, D, X, W, B) {
|
|
436
436
|
var z = {
|
|
437
437
|
// This tag allows us to uniquely identify this as a React Element
|
|
438
438
|
$$typeof: t,
|
|
@@ -440,9 +440,9 @@ function Nr() {
|
|
|
440
440
|
type: i,
|
|
441
441
|
key: b,
|
|
442
442
|
ref: R,
|
|
443
|
-
props:
|
|
443
|
+
props: B,
|
|
444
444
|
// Record the component responsible for creating this element.
|
|
445
|
-
_owner:
|
|
445
|
+
_owner: W
|
|
446
446
|
};
|
|
447
447
|
return z._store = {}, Object.defineProperty(z._store, "validated", {
|
|
448
448
|
configurable: !1,
|
|
@@ -453,7 +453,7 @@ function Nr() {
|
|
|
453
453
|
configurable: !1,
|
|
454
454
|
enumerable: !1,
|
|
455
455
|
writable: !1,
|
|
456
|
-
value:
|
|
456
|
+
value: D
|
|
457
457
|
}), Object.defineProperty(z, "_source", {
|
|
458
458
|
configurable: !1,
|
|
459
459
|
enumerable: !1,
|
|
@@ -461,38 +461,38 @@ function Nr() {
|
|
|
461
461
|
value: X
|
|
462
462
|
}), Object.freeze && (Object.freeze(z.props), Object.freeze(z)), z;
|
|
463
463
|
};
|
|
464
|
-
function
|
|
464
|
+
function Or(i, b, R, D, X) {
|
|
465
465
|
{
|
|
466
|
-
var
|
|
467
|
-
R !== void 0 && (_t(R), z = "" + R),
|
|
468
|
-
for (
|
|
469
|
-
$e.call(b,
|
|
466
|
+
var W, B = {}, z = null, ee = null;
|
|
467
|
+
R !== void 0 && (_t(R), z = "" + R), wr(b) && (_t(b.key), z = "" + b.key), Er(b) && (ee = b.ref, Cr(b, X));
|
|
468
|
+
for (W in b)
|
|
469
|
+
$e.call(b, W) && !br.hasOwnProperty(W) && (B[W] = b[W]);
|
|
470
470
|
if (i && i.defaultProps) {
|
|
471
471
|
var q = i.defaultProps;
|
|
472
|
-
for (
|
|
473
|
-
|
|
472
|
+
for (W in q)
|
|
473
|
+
B[W] === void 0 && (B[W] = q[W]);
|
|
474
474
|
}
|
|
475
|
-
if (z ||
|
|
475
|
+
if (z || ee) {
|
|
476
476
|
var G = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
477
|
-
z &&
|
|
477
|
+
z && xr(B, G), ee && Rr(B, G);
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return Ir(i, z, ee, X, D, be.current, B);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
var Ge = y.ReactCurrentOwner,
|
|
482
|
+
var Ge = y.ReactCurrentOwner, wt = y.ReactDebugCurrentFrame;
|
|
483
483
|
function he(i) {
|
|
484
484
|
if (i) {
|
|
485
|
-
var b = i._owner, R =
|
|
486
|
-
|
|
485
|
+
var b = i._owner, R = De(i.type, i._source, b ? b.type : null);
|
|
486
|
+
wt.setExtraStackFrame(R);
|
|
487
487
|
} else
|
|
488
|
-
|
|
488
|
+
wt.setExtraStackFrame(null);
|
|
489
489
|
}
|
|
490
490
|
var Je;
|
|
491
491
|
Je = !1;
|
|
492
492
|
function Ze(i) {
|
|
493
493
|
return typeof i == "object" && i !== null && i.$$typeof === t;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function Ct() {
|
|
496
496
|
{
|
|
497
497
|
if (Ge.current) {
|
|
498
498
|
var i = N(Ge.current.type);
|
|
@@ -504,7 +504,7 @@ Check the render method of \`` + i + "`.";
|
|
|
504
504
|
return "";
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Tr(i) {
|
|
508
508
|
{
|
|
509
509
|
if (i !== void 0) {
|
|
510
510
|
var b = i.fileName.replace(/^.*[\\\/]/, ""), R = i.lineNumber;
|
|
@@ -516,9 +516,9 @@ Check your code at ` + b + ":" + R + ".";
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
var xt = {};
|
|
519
|
-
function
|
|
519
|
+
function kr(i) {
|
|
520
520
|
{
|
|
521
|
-
var b =
|
|
521
|
+
var b = Ct();
|
|
522
522
|
if (!b) {
|
|
523
523
|
var R = typeof i == "string" ? i : i.displayName || i.name;
|
|
524
524
|
R && (b = `
|
|
@@ -533,12 +533,12 @@ Check the top-level render call using <` + R + ">.");
|
|
|
533
533
|
if (!i._store || i._store.validated || i.key != null)
|
|
534
534
|
return;
|
|
535
535
|
i._store.validated = !0;
|
|
536
|
-
var R =
|
|
536
|
+
var R = kr(b);
|
|
537
537
|
if (xt[R])
|
|
538
538
|
return;
|
|
539
539
|
xt[R] = !0;
|
|
540
|
-
var
|
|
541
|
-
i && i._owner && i._owner !== Ge.current && (
|
|
540
|
+
var D = "";
|
|
541
|
+
i && i._owner && i._owner !== Ge.current && (D = " It was passed a child from " + N(i._owner.type) + "."), he(i), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', R, D), he(null);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
function It(i, b) {
|
|
@@ -547,20 +547,20 @@ Check the top-level render call using <` + R + ">.");
|
|
|
547
547
|
return;
|
|
548
548
|
if (He(i))
|
|
549
549
|
for (var R = 0; R < i.length; R++) {
|
|
550
|
-
var
|
|
551
|
-
Ze(
|
|
550
|
+
var D = i[R];
|
|
551
|
+
Ze(D) && Rt(D, b);
|
|
552
552
|
}
|
|
553
553
|
else if (Ze(i))
|
|
554
554
|
i._store && (i._store.validated = !0);
|
|
555
555
|
else if (i) {
|
|
556
556
|
var X = I(i);
|
|
557
557
|
if (typeof X == "function" && X !== i.entries)
|
|
558
|
-
for (var
|
|
559
|
-
Ze(
|
|
558
|
+
for (var W = X.call(i), B; !(B = W.next()).done; )
|
|
559
|
+
Ze(B.value) && Rt(B.value, b);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Pr(i) {
|
|
564
564
|
{
|
|
565
565
|
var b = i.type;
|
|
566
566
|
if (b == null || typeof b == "string")
|
|
@@ -570,87 +570,87 @@ Check the top-level render call using <` + R + ">.");
|
|
|
570
570
|
R = b.propTypes;
|
|
571
571
|
else if (typeof b == "object" && (b.$$typeof === l || // Note: Memo only checks outer props here.
|
|
572
572
|
// Inner props are checked in the reconciler.
|
|
573
|
-
b.$$typeof ===
|
|
573
|
+
b.$$typeof === c))
|
|
574
574
|
R = b.propTypes;
|
|
575
575
|
else
|
|
576
576
|
return;
|
|
577
577
|
if (R) {
|
|
578
|
-
var
|
|
579
|
-
|
|
578
|
+
var D = N(b);
|
|
579
|
+
vr(R, i.props, "prop", D, i);
|
|
580
580
|
} else if (b.PropTypes !== void 0 && !Je) {
|
|
581
581
|
Je = !0;
|
|
582
582
|
var X = N(b);
|
|
583
|
-
|
|
583
|
+
C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", X || "Unknown");
|
|
584
584
|
}
|
|
585
|
-
typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved &&
|
|
585
|
+
typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function Mr(i) {
|
|
589
589
|
{
|
|
590
590
|
for (var b = Object.keys(i.props), R = 0; R < b.length; R++) {
|
|
591
|
-
var
|
|
592
|
-
if (
|
|
593
|
-
he(i),
|
|
591
|
+
var D = b[R];
|
|
592
|
+
if (D !== "children" && D !== "key") {
|
|
593
|
+
he(i), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", D), he(null);
|
|
594
594
|
break;
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
i.ref !== null && (he(i),
|
|
597
|
+
i.ref !== null && (he(i), C("Invalid attribute `ref` supplied to `React.Fragment`."), he(null));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function Ot(i, b, R,
|
|
600
|
+
function Ot(i, b, R, D, X, W) {
|
|
601
601
|
{
|
|
602
|
-
var
|
|
603
|
-
if (!
|
|
602
|
+
var B = j(i);
|
|
603
|
+
if (!B) {
|
|
604
604
|
var z = "";
|
|
605
605
|
(i === void 0 || typeof i == "object" && i !== null && Object.keys(i).length === 0) && (z += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
606
|
-
var
|
|
607
|
-
|
|
606
|
+
var ee = Tr(X);
|
|
607
|
+
ee ? z += ee : z += Ct();
|
|
608
608
|
var q;
|
|
609
|
-
i === null ? q = "null" : He(i) ? q = "array" : i !== void 0 && i.$$typeof === t ? (q = "<" + (N(i.type) || "Unknown") + " />", z = " Did you accidentally export a JSX literal instead of a component?") : q = typeof i,
|
|
609
|
+
i === null ? q = "null" : He(i) ? q = "array" : i !== void 0 && i.$$typeof === t ? (q = "<" + (N(i.type) || "Unknown") + " />", z = " Did you accidentally export a JSX literal instead of a component?") : q = typeof i, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, z);
|
|
610
610
|
}
|
|
611
|
-
var G =
|
|
611
|
+
var G = Or(i, b, R, X, W);
|
|
612
612
|
if (G == null)
|
|
613
613
|
return G;
|
|
614
|
-
if (
|
|
615
|
-
var
|
|
616
|
-
if (
|
|
617
|
-
if (
|
|
618
|
-
if (He(
|
|
619
|
-
for (var ve = 0; ve <
|
|
620
|
-
It(
|
|
621
|
-
Object.freeze && Object.freeze(
|
|
614
|
+
if (B) {
|
|
615
|
+
var re = b.children;
|
|
616
|
+
if (re !== void 0)
|
|
617
|
+
if (D)
|
|
618
|
+
if (He(re)) {
|
|
619
|
+
for (var ve = 0; ve < re.length; ve++)
|
|
620
|
+
It(re[ve], i);
|
|
621
|
+
Object.freeze && Object.freeze(re);
|
|
622
622
|
} else
|
|
623
|
-
|
|
623
|
+
C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
624
624
|
else
|
|
625
|
-
It(
|
|
625
|
+
It(re, i);
|
|
626
626
|
}
|
|
627
|
-
return i === n ?
|
|
627
|
+
return i === n ? Mr(G) : Pr(G), G;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function
|
|
630
|
+
function jr(i, b, R) {
|
|
631
631
|
return Ot(i, b, R, !0);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function Dr(i, b, R) {
|
|
634
634
|
return Ot(i, b, R, !1);
|
|
635
635
|
}
|
|
636
|
-
var
|
|
637
|
-
|
|
638
|
-
}()),
|
|
636
|
+
var $r = Dr, Ar = jr;
|
|
637
|
+
we.Fragment = n, we.jsx = $r, we.jsxs = Ar;
|
|
638
|
+
}()), we;
|
|
639
639
|
}
|
|
640
640
|
(function(e) {
|
|
641
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
642
|
-
})(
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
class
|
|
641
|
+
process.env.NODE_ENV === "production" ? e.exports = Xr() : e.exports = Ur();
|
|
642
|
+
})(Nr);
|
|
643
|
+
const Wr = Ie.Fragment, T = Ie.jsx, ue = Ie.jsxs;
|
|
644
|
+
let Vr = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, r) => (r &= 63, r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r > 62 ? t += "-" : t += "_", t), "");
|
|
645
|
+
class Fr {
|
|
646
646
|
constructor(t, r, n = null) {
|
|
647
647
|
this._socket = t, this.userId = n, this.room = r, this.toUnregister = [
|
|
648
648
|
() => {
|
|
649
649
|
this._socket.off(`${this.room}.isMaster`), this._socket.off(`${this.room}.roomJoined`), this._socket.off(`${this.room}._call`);
|
|
650
650
|
}
|
|
651
|
-
], this._left = !1, this.registeredRPC = {}, this._socket.on(`${this.room}._call`, async ({ callId: o, name: s, params:
|
|
651
|
+
], this._left = !1, this.registeredRPC = {}, this._socket.on(`${this.room}._call`, async ({ callId: o, name: s, params: a }) => {
|
|
652
652
|
try {
|
|
653
|
-
const u = await this.registeredRPC[s](
|
|
653
|
+
const u = await this.registeredRPC[s](a);
|
|
654
654
|
t.emit(`${this.room}._result.${o}`, {
|
|
655
655
|
ok: u || null
|
|
656
656
|
});
|
|
@@ -669,10 +669,10 @@ class Wr {
|
|
|
669
669
|
* @returns the result of the call.
|
|
670
670
|
*/
|
|
671
671
|
async _callServerRPC(t, r) {
|
|
672
|
-
const n =
|
|
672
|
+
const n = Vr();
|
|
673
673
|
return new Promise((o, s) => {
|
|
674
|
-
this._socket.once(`${this.room}._result.${n}`, (
|
|
675
|
-
|
|
674
|
+
this._socket.once(`${this.room}._result.${n}`, (a) => {
|
|
675
|
+
a.hasOwnProperty("ok") ? o(a.ok) : s(a.err);
|
|
676
676
|
}), this._socket.emit(`${this.room}._call`, { callId: n, name: t, params: r });
|
|
677
677
|
});
|
|
678
678
|
}
|
|
@@ -738,7 +738,7 @@ class Wr {
|
|
|
738
738
|
return await this._callServerRPC("call", { name: t, params: r });
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
const
|
|
741
|
+
const Kr = ({
|
|
742
742
|
socket: e,
|
|
743
743
|
room: t,
|
|
744
744
|
onJoined: r = () => {
|
|
@@ -747,13 +747,13 @@ const Vr = ({
|
|
|
747
747
|
},
|
|
748
748
|
userId: o = null
|
|
749
749
|
}) => {
|
|
750
|
-
const s = new
|
|
751
|
-
return new Promise((
|
|
750
|
+
const s = new Fr(e, t, o);
|
|
751
|
+
return new Promise((a) => {
|
|
752
752
|
let u = !0;
|
|
753
753
|
e.on(`${t}.isMaster`, () => {
|
|
754
754
|
s._left || n(t);
|
|
755
755
|
}), e.on(`${t}.roomJoined`, (l) => {
|
|
756
|
-
s._left || (s.userId = l, u = !1, r(s),
|
|
756
|
+
s._left || (s.userId = l, u = !1, r(s), a(s));
|
|
757
757
|
}), e.on("connect", () => {
|
|
758
758
|
s._left || u || e.emit("joinSuperSocket", {
|
|
759
759
|
room: t,
|
|
@@ -761,7 +761,7 @@ const Vr = ({
|
|
|
761
761
|
});
|
|
762
762
|
}), e.emit("joinSuperSocket", { room: t, userId: o });
|
|
763
763
|
});
|
|
764
|
-
}, it = g.createContext(),
|
|
764
|
+
}, it = g.createContext(), Hr = () => /* @__PURE__ */ T(
|
|
765
765
|
"div",
|
|
766
766
|
{
|
|
767
767
|
style: {
|
|
@@ -775,37 +775,37 @@ const Vr = ({
|
|
|
775
775
|
},
|
|
776
776
|
children: /* @__PURE__ */ T("h2", { children: "🌀 Loading..." })
|
|
777
777
|
}
|
|
778
|
-
),
|
|
778
|
+
), nr = ({
|
|
779
779
|
socket: e,
|
|
780
780
|
room: t,
|
|
781
781
|
channel: r = "default",
|
|
782
|
-
LoadingComponent: n =
|
|
782
|
+
LoadingComponent: n = Hr,
|
|
783
783
|
children: o
|
|
784
784
|
}) => {
|
|
785
|
-
const [s,
|
|
785
|
+
const [s, a] = g.useState(!1), [u, l] = g.useState(!1), [d, f] = g.useState(null), c = g.useRef(null), h = g.useRef(!1), _ = _e(it), v = g.useRef(!1);
|
|
786
786
|
return g.useEffect(() => (h.current = !0, () => {
|
|
787
787
|
h.current = !1;
|
|
788
788
|
}), []), g.useEffect(() => {
|
|
789
789
|
if (!e)
|
|
790
790
|
return null;
|
|
791
791
|
const E = () => {
|
|
792
|
-
console.log(`Disconnected from ${r}…`), h.current && (
|
|
792
|
+
console.log(`Disconnected from ${r}…`), h.current && (a(!1), l(!1));
|
|
793
793
|
};
|
|
794
794
|
return e.on("disconnect", E), () => {
|
|
795
795
|
e.off("disconnect", E);
|
|
796
796
|
};
|
|
797
|
-
}, [r, e]), g.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), v.current || (v.current = !0,
|
|
797
|
+
}, [r, e]), g.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), v.current || (v.current = !0, Kr({
|
|
798
798
|
socket: e,
|
|
799
799
|
room: t,
|
|
800
800
|
onMaster: () => {
|
|
801
801
|
console.log(`Is now master on channel ${r}…`), h.current && l(!0);
|
|
802
802
|
},
|
|
803
803
|
onJoined: (E) => {
|
|
804
|
-
console.log(`Connected on channel ${r}…`),
|
|
804
|
+
console.log(`Connected on channel ${r}…`), c.current = E, h.current && (f(E), a(!0));
|
|
805
805
|
}
|
|
806
806
|
})), () => {
|
|
807
807
|
var E;
|
|
808
|
-
(E =
|
|
808
|
+
(E = c.current) == null || E.leave();
|
|
809
809
|
}) : null, [r, t, e]), !s || !d ? /* @__PURE__ */ T(n, {}) : /* @__PURE__ */ T(
|
|
810
810
|
it.Provider,
|
|
811
811
|
{
|
|
@@ -813,13 +813,13 @@ const Vr = ({
|
|
|
813
813
|
children: o
|
|
814
814
|
}
|
|
815
815
|
);
|
|
816
|
-
}, Xe = (e = "default") => (_e(it) || {})[e],
|
|
816
|
+
}, Xe = (e = "default") => (_e(it) || {})[e], jt = (e) => {
|
|
817
817
|
let t;
|
|
818
818
|
const r = /* @__PURE__ */ new Set(), n = (l, d) => {
|
|
819
819
|
const f = typeof l == "function" ? l(t) : l;
|
|
820
820
|
if (!Object.is(f, t)) {
|
|
821
|
-
const
|
|
822
|
-
t = d ?? typeof f != "object" ? f : Object.assign({}, t, f), r.forEach((h) => h(t,
|
|
821
|
+
const c = t;
|
|
822
|
+
t = d ?? typeof f != "object" ? f : Object.assign({}, t, f), r.forEach((h) => h(t, c));
|
|
823
823
|
}
|
|
824
824
|
}, o = () => t, u = { setState: n, getState: o, subscribe: (l) => (r.add(l), () => r.delete(l)), destroy: () => {
|
|
825
825
|
({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && console.warn(
|
|
@@ -827,15 +827,15 @@ const Vr = ({
|
|
|
827
827
|
), r.clear();
|
|
828
828
|
} };
|
|
829
829
|
return t = e(n, o, u), u;
|
|
830
|
-
}, Ue = (e) => e ?
|
|
831
|
-
var at = {},
|
|
830
|
+
}, Ue = (e) => e ? jt(e) : jt;
|
|
831
|
+
var at = {}, qr = {
|
|
832
832
|
get exports() {
|
|
833
833
|
return at;
|
|
834
834
|
},
|
|
835
835
|
set exports(e) {
|
|
836
836
|
at = e;
|
|
837
837
|
}
|
|
838
|
-
}, Qe = {}, Ye = {},
|
|
838
|
+
}, Qe = {}, Ye = {}, Gr = {
|
|
839
839
|
get exports() {
|
|
840
840
|
return Ye;
|
|
841
841
|
},
|
|
@@ -852,37 +852,37 @@ var at = {}, Kr = {
|
|
|
852
852
|
* This source code is licensed under the MIT license found in the
|
|
853
853
|
* LICENSE file in the root directory of this source tree.
|
|
854
854
|
*/
|
|
855
|
-
var
|
|
856
|
-
function
|
|
857
|
-
if (
|
|
855
|
+
var Dt;
|
|
856
|
+
function Jr() {
|
|
857
|
+
if (Dt)
|
|
858
858
|
return et;
|
|
859
|
-
|
|
859
|
+
Dt = 1;
|
|
860
860
|
var e = g;
|
|
861
|
-
function t(
|
|
862
|
-
return
|
|
861
|
+
function t(c, h) {
|
|
862
|
+
return c === h && (c !== 0 || 1 / c === 1 / h) || c !== c && h !== h;
|
|
863
863
|
}
|
|
864
|
-
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect,
|
|
865
|
-
function u(
|
|
864
|
+
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect, a = e.useDebugValue;
|
|
865
|
+
function u(c, h) {
|
|
866
866
|
var _ = h(), v = n({ inst: { value: _, getSnapshot: h } }), E = v[0].inst, I = v[1];
|
|
867
867
|
return s(function() {
|
|
868
868
|
E.value = _, E.getSnapshot = h, l(E) && I({ inst: E });
|
|
869
|
-
}, [
|
|
870
|
-
return l(E) && I({ inst: E }),
|
|
869
|
+
}, [c, _, h]), o(function() {
|
|
870
|
+
return l(E) && I({ inst: E }), c(function() {
|
|
871
871
|
l(E) && I({ inst: E });
|
|
872
872
|
});
|
|
873
|
-
}, [
|
|
873
|
+
}, [c]), a(_), _;
|
|
874
874
|
}
|
|
875
|
-
function l(
|
|
876
|
-
var h =
|
|
877
|
-
|
|
875
|
+
function l(c) {
|
|
876
|
+
var h = c.getSnapshot;
|
|
877
|
+
c = c.value;
|
|
878
878
|
try {
|
|
879
879
|
var _ = h();
|
|
880
|
-
return !r(
|
|
880
|
+
return !r(c, _);
|
|
881
881
|
} catch {
|
|
882
882
|
return !0;
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function d(
|
|
885
|
+
function d(c, h) {
|
|
886
886
|
return h();
|
|
887
887
|
}
|
|
888
888
|
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : u;
|
|
@@ -899,22 +899,22 @@ var tt = {};
|
|
|
899
899
|
* LICENSE file in the root directory of this source tree.
|
|
900
900
|
*/
|
|
901
901
|
var $t;
|
|
902
|
-
function
|
|
902
|
+
function Zr() {
|
|
903
903
|
return $t || ($t = 1, process.env.NODE_ENV !== "production" && function() {
|
|
904
904
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
905
905
|
var e = g, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
906
906
|
function r(x) {
|
|
907
907
|
{
|
|
908
|
-
for (var p = arguments.length,
|
|
909
|
-
|
|
910
|
-
n("error", x,
|
|
908
|
+
for (var p = arguments.length, w = new Array(p > 1 ? p - 1 : 0), m = 1; m < p; m++)
|
|
909
|
+
w[m - 1] = arguments[m];
|
|
910
|
+
n("error", x, w);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
function n(x, p,
|
|
913
|
+
function n(x, p, w) {
|
|
914
914
|
{
|
|
915
915
|
var m = t.ReactDebugCurrentFrame, S = m.getStackAddendum();
|
|
916
|
-
S !== "" && (p += "%s",
|
|
917
|
-
var O =
|
|
916
|
+
S !== "" && (p += "%s", w = w.concat([S]));
|
|
917
|
+
var O = w.map(function(k) {
|
|
918
918
|
return String(k);
|
|
919
919
|
});
|
|
920
920
|
O.unshift("Warning: " + p), Function.prototype.apply.call(console[x], console, O);
|
|
@@ -923,30 +923,30 @@ function Gr() {
|
|
|
923
923
|
function o(x, p) {
|
|
924
924
|
return x === p && (x !== 0 || 1 / x === 1 / p) || x !== x && p !== p;
|
|
925
925
|
}
|
|
926
|
-
var s = typeof Object.is == "function" ? Object.is : o,
|
|
927
|
-
function h(x, p,
|
|
926
|
+
var s = typeof Object.is == "function" ? Object.is : o, a = e.useState, u = e.useEffect, l = e.useLayoutEffect, d = e.useDebugValue, f = !1, c = !1;
|
|
927
|
+
function h(x, p, w) {
|
|
928
928
|
f || e.startTransition !== void 0 && (f = !0, r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
929
929
|
var m = p();
|
|
930
|
-
if (!
|
|
930
|
+
if (!c) {
|
|
931
931
|
var S = p();
|
|
932
|
-
s(m, S) || (r("The result of getSnapshot should be cached to avoid an infinite loop"),
|
|
932
|
+
s(m, S) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), c = !0);
|
|
933
933
|
}
|
|
934
|
-
var O =
|
|
934
|
+
var O = a({
|
|
935
935
|
inst: {
|
|
936
936
|
value: m,
|
|
937
937
|
getSnapshot: p
|
|
938
938
|
}
|
|
939
|
-
}), k = O[0].inst,
|
|
939
|
+
}), k = O[0].inst, j = O[1];
|
|
940
940
|
return l(function() {
|
|
941
|
-
k.value = m, k.getSnapshot = p, _(k) &&
|
|
941
|
+
k.value = m, k.getSnapshot = p, _(k) && j({
|
|
942
942
|
inst: k
|
|
943
943
|
});
|
|
944
944
|
}, [x, m, p]), u(function() {
|
|
945
|
-
_(k) &&
|
|
945
|
+
_(k) && j({
|
|
946
946
|
inst: k
|
|
947
947
|
});
|
|
948
948
|
var M = function() {
|
|
949
|
-
_(k) &&
|
|
949
|
+
_(k) && j({
|
|
950
950
|
inst: k
|
|
951
951
|
});
|
|
952
952
|
};
|
|
@@ -954,26 +954,26 @@ function Gr() {
|
|
|
954
954
|
}, [x]), d(m), m;
|
|
955
955
|
}
|
|
956
956
|
function _(x) {
|
|
957
|
-
var p = x.getSnapshot,
|
|
957
|
+
var p = x.getSnapshot, w = x.value;
|
|
958
958
|
try {
|
|
959
959
|
var m = p();
|
|
960
|
-
return !s(
|
|
960
|
+
return !s(w, m);
|
|
961
961
|
} catch {
|
|
962
962
|
return !0;
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
function v(x, p,
|
|
965
|
+
function v(x, p, w) {
|
|
966
966
|
return p();
|
|
967
967
|
}
|
|
968
|
-
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", I = !E, y = I ? v : h,
|
|
969
|
-
tt.useSyncExternalStore =
|
|
968
|
+
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", I = !E, y = I ? v : h, C = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
|
|
969
|
+
tt.useSyncExternalStore = C, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
970
970
|
}()), tt;
|
|
971
971
|
}
|
|
972
972
|
var At;
|
|
973
|
-
function
|
|
973
|
+
function or() {
|
|
974
974
|
return At || (At = 1, function(e) {
|
|
975
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
976
|
-
}(
|
|
975
|
+
process.env.NODE_ENV === "production" ? e.exports = Jr() : e.exports = Zr();
|
|
976
|
+
}(Gr)), Ye;
|
|
977
977
|
}
|
|
978
978
|
/**
|
|
979
979
|
* @license React
|
|
@@ -985,16 +985,16 @@ function nr() {
|
|
|
985
985
|
* LICENSE file in the root directory of this source tree.
|
|
986
986
|
*/
|
|
987
987
|
var Lt;
|
|
988
|
-
function
|
|
988
|
+
function Qr() {
|
|
989
989
|
if (Lt)
|
|
990
990
|
return Qe;
|
|
991
991
|
Lt = 1;
|
|
992
|
-
var e = g, t =
|
|
992
|
+
var e = g, t = or();
|
|
993
993
|
function r(d, f) {
|
|
994
994
|
return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
|
|
995
995
|
}
|
|
996
|
-
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef,
|
|
997
|
-
return Qe.useSyncExternalStoreWithSelector = function(d, f,
|
|
996
|
+
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
997
|
+
return Qe.useSyncExternalStoreWithSelector = function(d, f, c, h, _) {
|
|
998
998
|
var v = s(null);
|
|
999
999
|
if (v.current === null) {
|
|
1000
1000
|
var E = { hasValue: !1, value: null };
|
|
@@ -1003,8 +1003,8 @@ function Jr() {
|
|
|
1003
1003
|
E = v.current;
|
|
1004
1004
|
v = u(function() {
|
|
1005
1005
|
function y(m) {
|
|
1006
|
-
if (!
|
|
1007
|
-
if (
|
|
1006
|
+
if (!C) {
|
|
1007
|
+
if (C = !0, x = m, m = h(m), _ !== void 0 && E.hasValue) {
|
|
1008
1008
|
var S = E.value;
|
|
1009
1009
|
if (_(S, m))
|
|
1010
1010
|
return p = S;
|
|
@@ -1016,15 +1016,15 @@ function Jr() {
|
|
|
1016
1016
|
var O = h(m);
|
|
1017
1017
|
return _ !== void 0 && _(S, O) ? S : (x = m, p = O);
|
|
1018
1018
|
}
|
|
1019
|
-
var
|
|
1019
|
+
var C = !1, x, p, w = c === void 0 ? null : c;
|
|
1020
1020
|
return [function() {
|
|
1021
1021
|
return y(f());
|
|
1022
|
-
},
|
|
1023
|
-
return y(
|
|
1022
|
+
}, w === null ? void 0 : function() {
|
|
1023
|
+
return y(w());
|
|
1024
1024
|
}];
|
|
1025
|
-
}, [f,
|
|
1025
|
+
}, [f, c, h, _]);
|
|
1026
1026
|
var I = o(d, v[0], v[1]);
|
|
1027
|
-
return
|
|
1027
|
+
return a(function() {
|
|
1028
1028
|
E.hasValue = !0, E.value = I;
|
|
1029
1029
|
}, [I]), l(I), I;
|
|
1030
1030
|
}, Qe;
|
|
@@ -1040,29 +1040,29 @@ var rt = {};
|
|
|
1040
1040
|
* LICENSE file in the root directory of this source tree.
|
|
1041
1041
|
*/
|
|
1042
1042
|
var zt;
|
|
1043
|
-
function
|
|
1043
|
+
function en() {
|
|
1044
1044
|
return zt || (zt = 1, process.env.NODE_ENV !== "production" && function() {
|
|
1045
1045
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
1046
|
-
var e = g, t =
|
|
1047
|
-
function r(f,
|
|
1048
|
-
return f ===
|
|
1046
|
+
var e = g, t = or();
|
|
1047
|
+
function r(f, c) {
|
|
1048
|
+
return f === c && (f !== 0 || 1 / f === 1 / c) || f !== f && c !== c;
|
|
1049
1049
|
}
|
|
1050
|
-
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef,
|
|
1051
|
-
function d(f,
|
|
1050
|
+
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
1051
|
+
function d(f, c, h, _, v) {
|
|
1052
1052
|
var E = s(null), I;
|
|
1053
1053
|
E.current === null ? (I = {
|
|
1054
1054
|
hasValue: !1,
|
|
1055
1055
|
value: null
|
|
1056
1056
|
}, E.current = I) : I = E.current;
|
|
1057
1057
|
var y = u(function() {
|
|
1058
|
-
var
|
|
1059
|
-
if (!
|
|
1060
|
-
|
|
1058
|
+
var w = !1, m, S, O = function(L) {
|
|
1059
|
+
if (!w) {
|
|
1060
|
+
w = !0, m = L;
|
|
1061
1061
|
var N = _(L);
|
|
1062
1062
|
if (v !== void 0 && I.hasValue) {
|
|
1063
|
-
var
|
|
1064
|
-
if (v(
|
|
1065
|
-
return S =
|
|
1063
|
+
var U = I.value;
|
|
1064
|
+
if (v(U, N))
|
|
1065
|
+
return S = U, U;
|
|
1066
1066
|
}
|
|
1067
1067
|
return S = N, N;
|
|
1068
1068
|
}
|
|
@@ -1071,14 +1071,14 @@ function Zr() {
|
|
|
1071
1071
|
return P;
|
|
1072
1072
|
var $ = _(L);
|
|
1073
1073
|
return v !== void 0 && v(P, $) ? P : (m = L, S = $, $);
|
|
1074
|
-
}, k = h === void 0 ? null : h,
|
|
1075
|
-
return O(
|
|
1074
|
+
}, k = h === void 0 ? null : h, j = function() {
|
|
1075
|
+
return O(c());
|
|
1076
1076
|
}, M = k === null ? void 0 : function() {
|
|
1077
1077
|
return O(k());
|
|
1078
1078
|
};
|
|
1079
|
-
return [
|
|
1080
|
-
}, [
|
|
1081
|
-
return
|
|
1079
|
+
return [j, M];
|
|
1080
|
+
}, [c, h, _, v]), C = y[0], x = y[1], p = o(f, C, x);
|
|
1081
|
+
return a(function() {
|
|
1082
1082
|
I.hasValue = !0, I.value = p;
|
|
1083
1083
|
}, [p]), l(p), p;
|
|
1084
1084
|
}
|
|
@@ -1086,43 +1086,43 @@ function Zr() {
|
|
|
1086
1086
|
}()), rt;
|
|
1087
1087
|
}
|
|
1088
1088
|
(function(e) {
|
|
1089
|
-
process.env.NODE_ENV === "production" ? e.exports =
|
|
1090
|
-
})(
|
|
1091
|
-
const
|
|
1089
|
+
process.env.NODE_ENV === "production" ? e.exports = Qr() : e.exports = en();
|
|
1090
|
+
})(qr);
|
|
1091
|
+
const tn = /* @__PURE__ */ Br(at), { useSyncExternalStoreWithSelector: rn } = tn;
|
|
1092
1092
|
function We(e, t = e.getState, r) {
|
|
1093
|
-
const n =
|
|
1093
|
+
const n = rn(
|
|
1094
1094
|
e.subscribe,
|
|
1095
1095
|
e.getState,
|
|
1096
1096
|
e.getServerState || e.getState,
|
|
1097
1097
|
t,
|
|
1098
1098
|
r
|
|
1099
1099
|
);
|
|
1100
|
-
return
|
|
1100
|
+
return Yr(n), n;
|
|
1101
1101
|
}
|
|
1102
1102
|
const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e, t) ? e : e.parentNode ? Oe(e.parentNode, t) : !1, ze = ([e, t], [r, n]) => {
|
|
1103
1103
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
1104
1104
|
return Math.hypot(o, s);
|
|
1105
|
-
},
|
|
1105
|
+
}, sr = (e, t, r) => {
|
|
1106
1106
|
const n = r * Math.PI / 180, o = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n);
|
|
1107
1107
|
return [o, s];
|
|
1108
1108
|
}, ct = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1109
|
-
const
|
|
1110
|
-
return
|
|
1109
|
+
const a = (e - o) / r, u = (t - s) / r;
|
|
1110
|
+
return sr(a, u, -n);
|
|
1111
1111
|
}, Be = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1112
|
-
const [
|
|
1113
|
-
return [
|
|
1112
|
+
const [a, u] = sr(e, t, n);
|
|
1113
|
+
return [a * r + o, u * r + s];
|
|
1114
1114
|
}, Yt = (e, t, r, n) => {
|
|
1115
|
-
const o = e.x, s = e.y,
|
|
1115
|
+
const o = e.x, s = e.y, a = t.x, u = t.y, l = r.x, d = r.y, f = a - o, c = u - s, h = o - l, _ = s - d, v = f * f + c * c, E = 2 * (h * f + _ * c), I = h * h + _ * _ - n * n, y = E * E - 4 * v * I;
|
|
1116
1116
|
if (y < 0)
|
|
1117
1117
|
return [];
|
|
1118
|
-
const
|
|
1119
|
-
return
|
|
1120
|
-
}, ft = (e, t) => e.x > t.left && e.x < t.left + t.width && e.y > t.top && e.y < t.top + t.height,
|
|
1118
|
+
const C = (-E + Math.sqrt(y)) / (2 * v), x = (-E - Math.sqrt(y)) / (2 * v), p = [];
|
|
1119
|
+
return C >= 0 && C <= 1 && p.push({ x: o + C * f, y: s + C * c }), x >= 0 && x <= 1 && p.push({ x: o + x * f, y: s + x * c }), p;
|
|
1120
|
+
}, ft = (e, t) => e.x > t.left && e.x < t.left + t.width && e.y > t.top && e.y < t.top + t.height, nn = (e, t) => Array.from(e.querySelectorAll(".corner")).every((n) => {
|
|
1121
1121
|
const { top: o, left: s } = n.getBoundingClientRect();
|
|
1122
1122
|
return ft({ x: s, y: o }, t);
|
|
1123
|
-
}),
|
|
1123
|
+
}), on = (e, t) => {
|
|
1124
1124
|
const r = t.getBoundingClientRect();
|
|
1125
|
-
return
|
|
1125
|
+
return nn(e, r);
|
|
1126
1126
|
}, Ne = (e, t) => {
|
|
1127
1127
|
const n = e.getElementsByClassName(`item ${t}`)[0];
|
|
1128
1128
|
return n || console.error(`Missing item ${t}`), n;
|
|
@@ -1135,46 +1135,56 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1135
1135
|
JSON.stringify(e == null ? void 0 : e.dataset),
|
|
1136
1136
|
(n = e == null ? void 0 : e.dataset) == null ? void 0 : n.id
|
|
1137
1137
|
), t;
|
|
1138
|
-
},
|
|
1138
|
+
}, sn = (e, t = document) => {
|
|
1139
1139
|
const r = e.reduce((n, o) => {
|
|
1140
1140
|
const s = Ne(t, o);
|
|
1141
1141
|
if (!s)
|
|
1142
1142
|
return n || null;
|
|
1143
|
-
const { left:
|
|
1143
|
+
const { left: a, right: u, top: l, bottom: d } = s.getBoundingClientRect();
|
|
1144
1144
|
let f;
|
|
1145
1145
|
return n ? f = n : f = {
|
|
1146
|
-
left:
|
|
1146
|
+
left: a,
|
|
1147
1147
|
top: l,
|
|
1148
1148
|
right: u,
|
|
1149
1149
|
bottom: d
|
|
1150
|
-
}, f.left = Math.min(
|
|
1150
|
+
}, f.left = Math.min(a, f.left), f.top = Math.min(l, f.top), f.right = Math.max(u, f.right), f.bottom = Math.max(d, f.bottom), f;
|
|
1151
1151
|
}, null);
|
|
1152
1152
|
return r && (r.width = r.right - r.left, r.height = r.bottom - r.top, r);
|
|
1153
|
-
},
|
|
1153
|
+
}, ir = (e, t, r = null) => (r === null && (r = /* @__PURE__ */ new Set()), !Array.isArray(t) || t.length === 0 ? [] : t.map((n) => r.has(n) ? [] : (r.add(n), [
|
|
1154
|
+
n,
|
|
1155
|
+
...ir(
|
|
1156
|
+
e,
|
|
1157
|
+
e[n].linkedItems,
|
|
1158
|
+
r
|
|
1159
|
+
)
|
|
1160
|
+
])).flat()), Bt = (e, t, r) => {
|
|
1161
|
+
const n = new Set(ir(e, r));
|
|
1162
|
+
return t.filter((o) => n.has(o));
|
|
1163
|
+
}, an = ({ x: e, y: t, width: r, height: n }, { type: o = "grid", size: s = 1, offset: a = { x: 0, y: 0 } }) => {
|
|
1154
1164
|
const [u, l] = [
|
|
1155
|
-
e + r / 2 -
|
|
1156
|
-
t + n / 2 -
|
|
1165
|
+
e + r / 2 - a.x,
|
|
1166
|
+
t + n / 2 - a.y
|
|
1157
1167
|
];
|
|
1158
|
-
let d, f,
|
|
1168
|
+
let d, f, c, h, _, v, E, I, y, C;
|
|
1159
1169
|
const x = s / 1.1547;
|
|
1160
1170
|
switch (o) {
|
|
1161
1171
|
case "grid":
|
|
1162
1172
|
d = Math.round(u / s) * s, f = Math.round(l / s) * s;
|
|
1163
1173
|
break;
|
|
1164
1174
|
case "hexH":
|
|
1165
|
-
|
|
1175
|
+
c = 2 * x, h = 3 * s, _ = Math.round(u / c) * c, E = Math.round(l / h) * h, v = _ > u ? _ - x : _ + x, I = E > l ? E - 1.5 * s : E + 1.5 * s, y = Math.hypot(_ - u, E - l), C = Math.hypot(v - u, I - l), y < C ? (d = _, f = E) : (d = v, f = I);
|
|
1166
1176
|
break;
|
|
1167
1177
|
case "hexV":
|
|
1168
|
-
|
|
1178
|
+
c = 3 * s, h = 2 * x, _ = Math.round(u / c) * c, E = Math.round(l / h) * h, v = _ > u ? _ - 1.5 * s : _ + 1.5 * s, I = E > l ? E - x : E + x, y = Math.hypot(_ - u, E - l), C = Math.hypot(v - u, I - l), y < C ? (d = _, f = E) : (d = v, f = I);
|
|
1169
1179
|
break;
|
|
1170
1180
|
default:
|
|
1171
1181
|
d = e + r / 2, f = t + n / 2;
|
|
1172
1182
|
}
|
|
1173
1183
|
return {
|
|
1174
|
-
x: d +
|
|
1175
|
-
y: f +
|
|
1184
|
+
x: d + a.x - r / 2,
|
|
1185
|
+
y: f + a.y - n / 2
|
|
1176
1186
|
};
|
|
1177
|
-
},
|
|
1187
|
+
}, Nt = [
|
|
1178
1188
|
"#037758",
|
|
1179
1189
|
"#99092a",
|
|
1180
1190
|
"#067070",
|
|
@@ -1205,13 +1215,13 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1205
1215
|
"#007a4b",
|
|
1206
1216
|
"#bf0daa",
|
|
1207
1217
|
"#af0ad8"
|
|
1208
|
-
],
|
|
1218
|
+
], Xt = () => Nt[Math.floor(Math.random() * Nt.length)], cn = !1, dt = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, o) => (s, a, u) => {
|
|
1209
1219
|
s({ ready: !1 });
|
|
1210
1220
|
const l = [];
|
|
1211
1221
|
(async () => {
|
|
1212
1222
|
try {
|
|
1213
1223
|
const _ = await e.call(`${t}_getValue`);
|
|
1214
|
-
|
|
1224
|
+
cn && console.log("init from peer with value", _), s((v) => ({ ...v, ..._ }));
|
|
1215
1225
|
} catch {
|
|
1216
1226
|
n !== void 0 && s(n);
|
|
1217
1227
|
}
|
|
@@ -1219,7 +1229,7 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1219
1229
|
await e.register(
|
|
1220
1230
|
`${t}_getValue`,
|
|
1221
1231
|
() => Object.fromEntries(
|
|
1222
|
-
Object.entries(
|
|
1232
|
+
Object.entries(a()).filter(
|
|
1223
1233
|
([_, v]) => typeof v != "function" && !r.includes(_)
|
|
1224
1234
|
)
|
|
1225
1235
|
),
|
|
@@ -1227,11 +1237,11 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1227
1237
|
)
|
|
1228
1238
|
), l.push(
|
|
1229
1239
|
e.subscribe(`${t}_call`, ([_, v]) => {
|
|
1230
|
-
|
|
1240
|
+
c[_](...v);
|
|
1231
1241
|
})
|
|
1232
1242
|
), s({ ready: !0 });
|
|
1233
1243
|
})();
|
|
1234
|
-
const f = o(s,
|
|
1244
|
+
const f = o(s, a, u), c = { ...f }, h = Object.fromEntries(
|
|
1235
1245
|
// Send the update message on all method calls
|
|
1236
1246
|
Object.entries(f).map(([_, v]) => typeof v == "function" && !_.startsWith("get") && !r.includes(_) ? [_, (...I) => {
|
|
1237
1247
|
const y = v(...I);
|
|
@@ -1271,16 +1281,18 @@ function Ve(e, t) {
|
|
|
1271
1281
|
return !1;
|
|
1272
1282
|
return !0;
|
|
1273
1283
|
}
|
|
1274
|
-
const
|
|
1284
|
+
const ar = g.createContext(), un = (e, t) => ({
|
|
1275
1285
|
items: {},
|
|
1276
1286
|
getItems: () => t().items,
|
|
1277
1287
|
setItems: (r) => e({ items: r }),
|
|
1278
|
-
updateItems: (r) => e((
|
|
1288
|
+
updateItems: (r, n = !1) => e((o) => n ? { items: Object.fromEntries(
|
|
1289
|
+
Object.entries(o.items).map(([a, u]) => r[a] ? [a, { ...u, ...r[a] }] : [a, u])
|
|
1290
|
+
) } : { items: { ...o.items, ...r } }),
|
|
1279
1291
|
moveItems: (r, n) => e(({ items: o }) => {
|
|
1280
1292
|
const s = { ...o };
|
|
1281
|
-
return r.forEach((
|
|
1282
|
-
const u = o[
|
|
1283
|
-
u && (s[
|
|
1293
|
+
return r.forEach((a) => {
|
|
1294
|
+
const u = o[a];
|
|
1295
|
+
u && (s[a] = {
|
|
1284
1296
|
...u,
|
|
1285
1297
|
x: (u.x || 0) + n.x,
|
|
1286
1298
|
y: (u.y || 0) + n.y,
|
|
@@ -1288,7 +1300,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1288
1300
|
});
|
|
1289
1301
|
}), { items: s };
|
|
1290
1302
|
})
|
|
1291
|
-
}),
|
|
1303
|
+
}), ln = (e, t) => ({
|
|
1292
1304
|
itemIds: [],
|
|
1293
1305
|
setItemIds: (r) => e({ itemIds: r }),
|
|
1294
1306
|
getItemIds: () => t().itemIds,
|
|
@@ -1307,7 +1319,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1307
1319
|
updateManyItemIds: (r) => e((n) => ({
|
|
1308
1320
|
items: n.itemIds.map((o, s) => r[s] !== void 0 ? r[s] : o)
|
|
1309
1321
|
}))
|
|
1310
|
-
}),
|
|
1322
|
+
}), fn = (e, t) => ({
|
|
1311
1323
|
removeItemsById: (r) => e((n) => ({
|
|
1312
1324
|
itemIds: n.itemIds.filter((o) => !r.includes(o)),
|
|
1313
1325
|
items: Object.fromEntries(
|
|
@@ -1326,12 +1338,12 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1326
1338
|
}),
|
|
1327
1339
|
insertItems: (r, n) => e((o) => {
|
|
1328
1340
|
let s;
|
|
1329
|
-
const
|
|
1341
|
+
const a = r.map(({ id: u }) => u);
|
|
1330
1342
|
if (n) {
|
|
1331
1343
|
const u = o.itemIds.findIndex((l) => l === n);
|
|
1332
|
-
s = [...o.itemIds], s.splice(u, 0, ...
|
|
1344
|
+
s = [...o.itemIds], s.splice(u, 0, ...a);
|
|
1333
1345
|
} else
|
|
1334
|
-
s = [...o.itemIds, ...
|
|
1346
|
+
s = [...o.itemIds, ...a];
|
|
1335
1347
|
return {
|
|
1336
1348
|
items: {
|
|
1337
1349
|
...o.items,
|
|
@@ -1340,38 +1352,38 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1340
1352
|
itemIds: s
|
|
1341
1353
|
};
|
|
1342
1354
|
})
|
|
1343
|
-
}),
|
|
1355
|
+
}), dn = (e, t) => ({
|
|
1344
1356
|
boardConfig: {},
|
|
1345
1357
|
getBoardConfig: () => t().boardConfig,
|
|
1346
1358
|
setBoardConfig: (r) => e({ boardConfig: r }),
|
|
1347
1359
|
updateBoardConfig: (r) => e((n) => ({ boardConfig: { ...n.boardConfig, ...r } }))
|
|
1348
|
-
}),
|
|
1360
|
+
}), pn = (e, t) => ({
|
|
1349
1361
|
session: {},
|
|
1350
1362
|
getSessionInfo: () => t().session,
|
|
1351
1363
|
setSessionInfo: (r) => e({ session: r }),
|
|
1352
1364
|
updateSessionInfo: (r) => e((n) => ({ session: { ...n.session, ...r } }))
|
|
1353
|
-
}),
|
|
1354
|
-
const { wire: n } = Xe("room"), [o, s] = g.useState(!1), [
|
|
1365
|
+
}), Ut = ({ storeName: e, children: t, defaultValue: r }) => {
|
|
1366
|
+
const { wire: n } = Xe("room"), [o, s] = g.useState(!1), [a] = g.useState(
|
|
1355
1367
|
() => Ue(
|
|
1356
1368
|
dt({ wire: n, storeName: e, defaultValue: r }, (...u) => ({
|
|
1357
|
-
...an(...u),
|
|
1358
|
-
...cn(...u),
|
|
1359
1369
|
...un(...u),
|
|
1360
1370
|
...ln(...u),
|
|
1361
|
-
...fn(...u)
|
|
1371
|
+
...fn(...u),
|
|
1372
|
+
...dn(...u),
|
|
1373
|
+
...pn(...u)
|
|
1362
1374
|
}))
|
|
1363
1375
|
)
|
|
1364
1376
|
);
|
|
1365
1377
|
return g.useEffect(() => {
|
|
1366
|
-
const u =
|
|
1378
|
+
const u = a.subscribe((l) => {
|
|
1367
1379
|
l.ready && (u(), s(!0));
|
|
1368
1380
|
});
|
|
1369
|
-
}, [
|
|
1370
|
-
},
|
|
1371
|
-
const r = _e(
|
|
1381
|
+
}, [a]), o ? /* @__PURE__ */ T(ar.Provider, { value: a, children: t }) : null;
|
|
1382
|
+
}, ne = (e, t) => {
|
|
1383
|
+
const r = _e(ar);
|
|
1372
1384
|
return We(r, e, t || Ve);
|
|
1373
|
-
},
|
|
1374
|
-
const [e, t] =
|
|
1385
|
+
}, ns = () => {
|
|
1386
|
+
const [e, t] = ne((n) => [
|
|
1375
1387
|
n.itemIds,
|
|
1376
1388
|
n.items
|
|
1377
1389
|
]);
|
|
@@ -1379,31 +1391,31 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1379
1391
|
() => e.map((n) => t[n]),
|
|
1380
1392
|
[e, t]
|
|
1381
1393
|
);
|
|
1382
|
-
},
|
|
1383
|
-
const [e, t, r] =
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1394
|
+
}, os = () => {
|
|
1395
|
+
const [e, t, r] = ne((a) => [
|
|
1396
|
+
a.items,
|
|
1397
|
+
a.itemIds,
|
|
1398
|
+
a.getItemList
|
|
1387
1399
|
]), [n, o] = g.useState(r()), [, s] = g.useTransition();
|
|
1388
1400
|
return g.useEffect(() => {
|
|
1389
|
-
const
|
|
1401
|
+
const a = r();
|
|
1390
1402
|
s(() => {
|
|
1391
|
-
o(
|
|
1403
|
+
o(a);
|
|
1392
1404
|
});
|
|
1393
1405
|
}, [e, t, r]), n;
|
|
1394
|
-
},
|
|
1406
|
+
}, cr = 5e4, ur = g.createContext(), mn = (e, t) => ({
|
|
1395
1407
|
config: {
|
|
1396
1408
|
itemTemplates: {},
|
|
1397
1409
|
actions: {},
|
|
1398
1410
|
uid: null,
|
|
1399
1411
|
itemExtent: { x: 0, y: 0, radius: 0 },
|
|
1400
1412
|
boardWrapperRect: {},
|
|
1401
|
-
boardSize:
|
|
1413
|
+
boardSize: cr
|
|
1402
1414
|
},
|
|
1403
1415
|
// TODO optimize when same values as before
|
|
1404
1416
|
updateConfiguration: (r) => e((n) => ({ config: { ...n.config, ...r } })),
|
|
1405
1417
|
getConfiguration: () => t().config
|
|
1406
|
-
}),
|
|
1418
|
+
}), gn = (e, t) => ({
|
|
1407
1419
|
boardState: {
|
|
1408
1420
|
movingItems: !1,
|
|
1409
1421
|
selecting: !1,
|
|
@@ -1417,7 +1429,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1417
1429
|
// TODO optimize when same values as before
|
|
1418
1430
|
updateBoardState: (r) => e((n) => ({ boardState: { ...n.boardState, ...r } })),
|
|
1419
1431
|
getBoardState: () => t().boardState
|
|
1420
|
-
}),
|
|
1432
|
+
}), hn = (e, t) => ({
|
|
1421
1433
|
interactions: {},
|
|
1422
1434
|
getInteractions: () => t().interactions,
|
|
1423
1435
|
register: (r, n) => e((o) => {
|
|
@@ -1428,7 +1440,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1428
1440
|
}),
|
|
1429
1441
|
unregister: (r, n) => e((o) => {
|
|
1430
1442
|
const s = (o.interactions[r] || []).filter(
|
|
1431
|
-
(
|
|
1443
|
+
(a) => a !== n
|
|
1432
1444
|
);
|
|
1433
1445
|
return {
|
|
1434
1446
|
interactions: { ...o.interactions, [r]: s }
|
|
@@ -1439,7 +1451,7 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1439
1451
|
o(n);
|
|
1440
1452
|
});
|
|
1441
1453
|
}
|
|
1442
|
-
}),
|
|
1454
|
+
}), vn = (e, t) => ({
|
|
1443
1455
|
selection: [],
|
|
1444
1456
|
setSelection: (r) => e((n) => JSON.stringify(n.selection) !== JSON.stringify(r) ? { selection: r } : {}),
|
|
1445
1457
|
getSelection: () => t().selection,
|
|
@@ -1459,21 +1471,21 @@ const sr = g.createContext(), an = (e, t) => ({
|
|
|
1459
1471
|
const o = n.selectionBox;
|
|
1460
1472
|
return !o || !r || o.top !== r.top || o.left !== r.left || o.width !== r.width || o.height !== r.height ? { selectionBox: r } : {};
|
|
1461
1473
|
})
|
|
1462
|
-
}),
|
|
1474
|
+
}), Wt = ({ children: e }) => {
|
|
1463
1475
|
const [t] = g.useState(
|
|
1464
1476
|
() => Ue((...r) => ({
|
|
1465
|
-
...dn(...r),
|
|
1466
|
-
...pn(...r),
|
|
1467
1477
|
...mn(...r),
|
|
1468
|
-
...gn(...r)
|
|
1478
|
+
...gn(...r),
|
|
1479
|
+
...hn(...r),
|
|
1480
|
+
...vn(...r)
|
|
1469
1481
|
}))
|
|
1470
1482
|
);
|
|
1471
|
-
return /* @__PURE__ */ T(
|
|
1472
|
-
},
|
|
1473
|
-
const r = _e(
|
|
1483
|
+
return /* @__PURE__ */ T(ur.Provider, { value: t, children: e });
|
|
1484
|
+
}, Q = (e, t) => {
|
|
1485
|
+
const r = _e(ur);
|
|
1474
1486
|
return We(r, e, t || Ve);
|
|
1475
|
-
},
|
|
1476
|
-
const [e] =
|
|
1487
|
+
}, ss = () => {
|
|
1488
|
+
const [e] = Q((t) => [t.selection]);
|
|
1477
1489
|
return e;
|
|
1478
1490
|
};
|
|
1479
1491
|
function pt(e) {
|
|
@@ -1484,7 +1496,7 @@ function pt(e) {
|
|
|
1484
1496
|
}
|
|
1485
1497
|
}), []);
|
|
1486
1498
|
}
|
|
1487
|
-
function
|
|
1499
|
+
function yn(e) {
|
|
1488
1500
|
const t = pt(e);
|
|
1489
1501
|
Pe(
|
|
1490
1502
|
() => () => {
|
|
@@ -1495,18 +1507,18 @@ function hn(e) {
|
|
|
1495
1507
|
);
|
|
1496
1508
|
}
|
|
1497
1509
|
function mt(e, t, r, n = 0) {
|
|
1498
|
-
const o = Re(), s = Re(),
|
|
1510
|
+
const o = Re(), s = Re(), a = Re(), u = () => {
|
|
1499
1511
|
o.current && (clearTimeout(o.current), o.current = void 0), s.current && (clearTimeout(s.current), s.current = void 0);
|
|
1500
1512
|
};
|
|
1501
|
-
return
|
|
1513
|
+
return yn(u), lt(
|
|
1502
1514
|
() => {
|
|
1503
1515
|
const l = () => {
|
|
1504
|
-
if (!
|
|
1516
|
+
if (!a.current)
|
|
1505
1517
|
return;
|
|
1506
|
-
const f =
|
|
1507
|
-
|
|
1518
|
+
const f = a.current;
|
|
1519
|
+
a.current = void 0, e.apply(f.this, f.args), u();
|
|
1508
1520
|
}, d = function(...f) {
|
|
1509
|
-
o.current && clearTimeout(o.current),
|
|
1521
|
+
o.current && clearTimeout(o.current), a.current = { args: f, this: this }, o.current = setTimeout(l, r), n > 0 && !s.current && (s.current = setTimeout(l, n));
|
|
1510
1522
|
};
|
|
1511
1523
|
return Object.defineProperties(d, {
|
|
1512
1524
|
length: { value: e.length },
|
|
@@ -1517,56 +1529,56 @@ function mt(e, t, r, n = 0) {
|
|
|
1517
1529
|
[r, n, ...t]
|
|
1518
1530
|
);
|
|
1519
1531
|
}
|
|
1520
|
-
const
|
|
1532
|
+
const Sn = 100, _n = 1e3, bn = 0.8, En = ({
|
|
1521
1533
|
x: e,
|
|
1522
1534
|
y: t,
|
|
1523
1535
|
scale: r,
|
|
1524
1536
|
rotate: n,
|
|
1525
1537
|
itemExtent: o,
|
|
1526
1538
|
boardWrapperRect: s,
|
|
1527
|
-
boardSize:
|
|
1539
|
+
boardSize: a
|
|
1528
1540
|
}) => {
|
|
1529
1541
|
let [u, l] = [e, t];
|
|
1530
1542
|
const d = ct(
|
|
1531
1543
|
[s.width / 2, s.height / 2],
|
|
1532
1544
|
{ translateX: u, translateY: l, scale: r, rotate: n }
|
|
1533
1545
|
), f = {
|
|
1534
|
-
x: o.x +
|
|
1535
|
-
y: o.y +
|
|
1536
|
-
},
|
|
1537
|
-
x:
|
|
1538
|
-
y:
|
|
1539
|
-
}, h = ze(d, [f.x, f.y]), _ = Math.min(s.width, s.height), v = o.radius + _ / 2 / r -
|
|
1546
|
+
x: o.x + a / 2,
|
|
1547
|
+
y: o.y + a / 2
|
|
1548
|
+
}, c = {
|
|
1549
|
+
x: a / 2,
|
|
1550
|
+
y: a / 2
|
|
1551
|
+
}, h = ze(d, [f.x, f.y]), _ = Math.min(s.width, s.height), v = o.radius + _ / 2 / r - Sn / r;
|
|
1540
1552
|
if (h > v) {
|
|
1541
1553
|
const y = Yt(
|
|
1542
1554
|
{ x: d[0], y: d[1] },
|
|
1543
1555
|
f,
|
|
1544
1556
|
f,
|
|
1545
1557
|
v - 1 / r
|
|
1546
|
-
)[0], [
|
|
1558
|
+
)[0], [C, x] = Be([-y.x, -y.y], {
|
|
1547
1559
|
translateX: s.width / 2,
|
|
1548
1560
|
translateY: s.height / 2,
|
|
1549
1561
|
scale: r,
|
|
1550
1562
|
rotate: n
|
|
1551
1563
|
});
|
|
1552
|
-
u =
|
|
1564
|
+
u = C, l = x;
|
|
1553
1565
|
}
|
|
1554
|
-
const E = ze(d, [
|
|
1566
|
+
const E = ze(d, [c.x, c.y]), I = a / 2 - ze([0, 0], [s.width, s.height]) / r;
|
|
1555
1567
|
if (E > I) {
|
|
1556
1568
|
const y = Yt(
|
|
1557
1569
|
{ x: d[0], y: d[1] },
|
|
1558
|
-
|
|
1559
|
-
|
|
1570
|
+
c,
|
|
1571
|
+
c,
|
|
1560
1572
|
I - 1 / r
|
|
1561
1573
|
)[0];
|
|
1562
1574
|
if (y) {
|
|
1563
|
-
const [
|
|
1575
|
+
const [C, x] = Be([-y.x, -y.y], {
|
|
1564
1576
|
translateX: s.width / 2,
|
|
1565
1577
|
translateY: s.height / 2,
|
|
1566
1578
|
scale: r,
|
|
1567
1579
|
rotate: n
|
|
1568
1580
|
});
|
|
1569
|
-
u =
|
|
1581
|
+
u = C, l = x;
|
|
1570
1582
|
}
|
|
1571
1583
|
}
|
|
1572
1584
|
return [u, l];
|
|
@@ -1577,25 +1589,25 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1577
1589
|
r,
|
|
1578
1590
|
n,
|
|
1579
1591
|
o
|
|
1580
|
-
] =
|
|
1592
|
+
] = Q((p) => [
|
|
1581
1593
|
p.getBoardState,
|
|
1582
1594
|
p.updateBoardState,
|
|
1583
1595
|
p.config.itemExtent,
|
|
1584
1596
|
p.getConfiguration,
|
|
1585
1597
|
p.updateConfiguration
|
|
1586
|
-
]), s = g.useRef([0.15, 5]), [
|
|
1587
|
-
const { translateX: p, translateY:
|
|
1588
|
-
return { translateX: p, translateY:
|
|
1598
|
+
]), s = g.useRef([0.15, 5]), [a] = ne((p) => [p.getItemList]), u = g.useCallback(() => {
|
|
1599
|
+
const { translateX: p, translateY: w, scale: m, rotate: S } = e();
|
|
1600
|
+
return { translateX: p, translateY: w, scale: m, rotate: S };
|
|
1589
1601
|
}, [e]), l = g.useCallback(
|
|
1590
|
-
(p,
|
|
1602
|
+
(p, w) => ct([p, w], e()),
|
|
1591
1603
|
[e]
|
|
1592
1604
|
), d = g.useCallback(
|
|
1593
|
-
(p,
|
|
1605
|
+
(p, w) => Be([p, w], e()),
|
|
1594
1606
|
[e]
|
|
1595
1607
|
), f = g.useCallback(
|
|
1596
|
-
(p,
|
|
1608
|
+
(p, w) => {
|
|
1597
1609
|
const { scale: m, rotate: S } = e();
|
|
1598
|
-
return ct([p,
|
|
1610
|
+
return ct([p, w], {
|
|
1599
1611
|
translateX: 0,
|
|
1600
1612
|
translateY: 0,
|
|
1601
1613
|
rotate: S,
|
|
@@ -1603,40 +1615,40 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1603
1615
|
});
|
|
1604
1616
|
},
|
|
1605
1617
|
[e]
|
|
1606
|
-
),
|
|
1618
|
+
), c = g.useCallback((p) => p > s.current[1] ? s.current[1] : p < s.current[0] ? s.current[0] : p, []), h = g.useCallback(
|
|
1607
1619
|
(p) => {
|
|
1608
|
-
const { itemExtent:
|
|
1620
|
+
const { itemExtent: w, boardWrapperRect: m, boardSize: S } = n(), O = e(), {
|
|
1609
1621
|
translateX: k,
|
|
1610
|
-
translateY:
|
|
1622
|
+
translateY: j,
|
|
1611
1623
|
scale: M,
|
|
1612
1624
|
rotate: L
|
|
1613
1625
|
} = {
|
|
1614
1626
|
...O,
|
|
1615
1627
|
...p(O)
|
|
1616
|
-
}, N =
|
|
1617
|
-
let [
|
|
1618
|
-
(k !== O.translateX ||
|
|
1628
|
+
}, N = c(M);
|
|
1629
|
+
let [U, J] = [k, j];
|
|
1630
|
+
(k !== O.translateX || j !== O.translateY) && ([U, J] = En({
|
|
1619
1631
|
x: k,
|
|
1620
|
-
y:
|
|
1632
|
+
y: j,
|
|
1621
1633
|
scale: N,
|
|
1622
1634
|
rotate: L,
|
|
1623
|
-
itemExtent:
|
|
1635
|
+
itemExtent: w,
|
|
1624
1636
|
boardWrapperRect: m,
|
|
1625
1637
|
boardSize: S
|
|
1626
1638
|
})), t({
|
|
1627
|
-
translateX:
|
|
1639
|
+
translateX: U,
|
|
1628
1640
|
translateY: J,
|
|
1629
1641
|
scale: N,
|
|
1630
1642
|
rotate: L
|
|
1631
1643
|
});
|
|
1632
1644
|
},
|
|
1633
|
-
[
|
|
1645
|
+
[c, e, n, t]
|
|
1634
1646
|
), _ = g.useCallback(
|
|
1635
1647
|
(p) => {
|
|
1636
|
-
let
|
|
1637
|
-
typeof p == "function" && (
|
|
1648
|
+
let w = (m) => ({ ...m, ...p });
|
|
1649
|
+
typeof p == "function" && (w = p), h((m) => ({
|
|
1638
1650
|
...m,
|
|
1639
|
-
...
|
|
1651
|
+
...w({
|
|
1640
1652
|
translateX: m.translateX,
|
|
1641
1653
|
translateY: m.translateY
|
|
1642
1654
|
})
|
|
@@ -1644,26 +1656,26 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1644
1656
|
},
|
|
1645
1657
|
[h]
|
|
1646
1658
|
), v = g.useCallback(
|
|
1647
|
-
({ to: p, factor:
|
|
1659
|
+
({ to: p, factor: w }) => {
|
|
1648
1660
|
const { boardWrapperRect: m } = n();
|
|
1649
1661
|
let S = p;
|
|
1650
1662
|
S || (S = {
|
|
1651
1663
|
x: m.left + m.width / 2,
|
|
1652
1664
|
y: m.top + m.height / 2
|
|
1653
1665
|
});
|
|
1654
|
-
const O = e(), k =
|
|
1655
|
-
h((
|
|
1656
|
-
...
|
|
1666
|
+
const O = e(), k = c(O.scale * w), j = S.x - m.left, M = S.y - m.top, L = j - (j - O.translateX) * k / O.scale, N = M - (M - O.translateY) * k / O.scale;
|
|
1667
|
+
h((U) => ({
|
|
1668
|
+
...U,
|
|
1657
1669
|
translateX: L,
|
|
1658
1670
|
translateY: N,
|
|
1659
1671
|
scale: k
|
|
1660
1672
|
}));
|
|
1661
1673
|
},
|
|
1662
|
-
[
|
|
1674
|
+
[c, e, n, h]
|
|
1663
1675
|
), E = g.useCallback(
|
|
1664
|
-
({ x: p, y:
|
|
1665
|
-
const { rotate: S } = e(), { boardWrapperRect: O, boardSize: k } = n(),
|
|
1666
|
-
[-k / 2 - p, -k / 2 -
|
|
1676
|
+
({ x: p, y: w, radius: m }) => {
|
|
1677
|
+
const { rotate: S } = e(), { boardWrapperRect: O, boardSize: k } = n(), j = O.width / (m * 2), M = O.height / (m * 2), L = c(Math.min(j, M) * bn), [N, U] = Be(
|
|
1678
|
+
[-k / 2 - p, -k / 2 - w],
|
|
1667
1679
|
{
|
|
1668
1680
|
translateX: O.width / 2,
|
|
1669
1681
|
translateY: O.height / 2,
|
|
@@ -1671,27 +1683,27 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1671
1683
|
rotate: S
|
|
1672
1684
|
}
|
|
1673
1685
|
);
|
|
1674
|
-
h((J) => ({ ...J, translateX: N, translateY:
|
|
1686
|
+
h((J) => ({ ...J, translateX: N, translateY: U, scale: L }));
|
|
1675
1687
|
},
|
|
1676
|
-
[
|
|
1688
|
+
[c, e, n, h]
|
|
1677
1689
|
), I = g.useCallback(() => {
|
|
1678
|
-
const { boardWrapperRect: p, boardSize:
|
|
1690
|
+
const { boardWrapperRect: p, boardSize: w } = n(), [m, S] = l(
|
|
1679
1691
|
p.width / 2,
|
|
1680
1692
|
p.height / 2
|
|
1681
1693
|
);
|
|
1682
1694
|
return {
|
|
1683
|
-
x: m -
|
|
1684
|
-
y: S -
|
|
1695
|
+
x: m - w / 2,
|
|
1696
|
+
y: S - w / 2
|
|
1685
1697
|
};
|
|
1686
1698
|
}, [l, n]), y = g.useCallback(() => {
|
|
1687
|
-
const p =
|
|
1688
|
-
(k,
|
|
1689
|
-
const M = Ne(
|
|
1690
|
-
return k.left = Math.min(
|
|
1691
|
-
|
|
1699
|
+
const p = a(), { boardWrapper: w, boardSize: m } = n(), S = p.reduce(
|
|
1700
|
+
(k, j) => {
|
|
1701
|
+
const M = Ne(w, j.id);
|
|
1702
|
+
return k.left = Math.min(j.x, k.left), k.top = Math.min(j.y, k.top), k.right = Math.max(
|
|
1703
|
+
j.x + M.offsetWidth,
|
|
1692
1704
|
k.right
|
|
1693
1705
|
), k.bottom = Math.max(
|
|
1694
|
-
|
|
1706
|
+
j.y + M.offsetHeight,
|
|
1695
1707
|
k.bottom
|
|
1696
1708
|
), k;
|
|
1697
1709
|
},
|
|
@@ -1707,12 +1719,12 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1707
1719
|
};
|
|
1708
1720
|
O.radius = Math.max(
|
|
1709
1721
|
ze([O.x, O.y], [S.left, S.top]),
|
|
1710
|
-
|
|
1722
|
+
_n
|
|
1711
1723
|
), o({ itemExtent: O });
|
|
1712
|
-
}, [n,
|
|
1724
|
+
}, [n, a, o]), C = g.useCallback(
|
|
1713
1725
|
(p) => {
|
|
1714
|
-
let
|
|
1715
|
-
typeof p == "function" && (
|
|
1726
|
+
let w = () => p;
|
|
1727
|
+
typeof p == "function" && (w = p), h((m) => ({ ...m, rotate: w(m.rotate) })), y(), E(r);
|
|
1716
1728
|
},
|
|
1717
1729
|
[r, h, y, E]
|
|
1718
1730
|
), x = mt(
|
|
@@ -1722,7 +1734,7 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1722
1734
|
);
|
|
1723
1735
|
return {
|
|
1724
1736
|
setDim: h,
|
|
1725
|
-
rotateBoard:
|
|
1737
|
+
rotateBoard: C,
|
|
1726
1738
|
moveBoard: _,
|
|
1727
1739
|
getDim: u,
|
|
1728
1740
|
zoomTo: v,
|
|
@@ -1734,27 +1746,27 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1734
1746
|
fromWrapperToBoard: l,
|
|
1735
1747
|
fromBoardToWrapper: d
|
|
1736
1748
|
};
|
|
1737
|
-
},
|
|
1738
|
-
const [t, r, n] =
|
|
1739
|
-
({ register:
|
|
1740
|
-
|
|
1749
|
+
}, Vt = (e) => {
|
|
1750
|
+
const [t, r, n] = Q(
|
|
1751
|
+
({ register: a, unregister: u, callInteractions: l }) => [
|
|
1752
|
+
a,
|
|
1741
1753
|
u,
|
|
1742
1754
|
l
|
|
1743
1755
|
]
|
|
1744
1756
|
), o = g.useCallback(
|
|
1745
|
-
(
|
|
1746
|
-
r(e,
|
|
1757
|
+
(a) => (t(e, a), () => {
|
|
1758
|
+
r(e, a);
|
|
1747
1759
|
}),
|
|
1748
1760
|
[e, t, r]
|
|
1749
1761
|
), s = g.useCallback(
|
|
1750
|
-
(
|
|
1751
|
-
n(e,
|
|
1762
|
+
(a) => {
|
|
1763
|
+
n(e, a);
|
|
1752
1764
|
},
|
|
1753
1765
|
[n, e]
|
|
1754
1766
|
);
|
|
1755
1767
|
return { register: o, call: s };
|
|
1756
1768
|
}, gt = () => {
|
|
1757
|
-
const { call: e } =
|
|
1769
|
+
const { call: e } = Vt("place"), { call: t } = Vt("delete"), { getCenter: r, updateItemExtent: n } = Me(), [o, s, a, u] = Q((P) => [
|
|
1758
1770
|
P.clear,
|
|
1759
1771
|
P.reverse,
|
|
1760
1772
|
P.unselect,
|
|
@@ -1763,106 +1775,120 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1763
1775
|
getItems: l,
|
|
1764
1776
|
getItemIds: d,
|
|
1765
1777
|
setItemIds: f,
|
|
1766
|
-
updateItems:
|
|
1778
|
+
updateItems: c,
|
|
1767
1779
|
moveItems: h,
|
|
1768
1780
|
removeItemsById: _,
|
|
1769
1781
|
getItemList: v,
|
|
1770
1782
|
insertItems: E,
|
|
1771
1783
|
setItemList: I
|
|
1772
|
-
} =
|
|
1784
|
+
} = ne(
|
|
1773
1785
|
({
|
|
1774
1786
|
getItems: P,
|
|
1775
1787
|
getItemIds: $,
|
|
1776
|
-
setItemIds:
|
|
1777
|
-
updateItems:
|
|
1788
|
+
setItemIds: Y,
|
|
1789
|
+
updateItems: V,
|
|
1778
1790
|
moveItems: A,
|
|
1779
1791
|
removeItemsById: F,
|
|
1780
|
-
getItemList:
|
|
1781
|
-
insertItems:
|
|
1782
|
-
setItemList:
|
|
1792
|
+
getItemList: H,
|
|
1793
|
+
insertItems: Z,
|
|
1794
|
+
setItemList: te
|
|
1783
1795
|
}) => ({
|
|
1784
1796
|
getItems: P,
|
|
1785
1797
|
getItemIds: $,
|
|
1786
|
-
setItemIds:
|
|
1787
|
-
updateItems:
|
|
1798
|
+
setItemIds: Y,
|
|
1799
|
+
updateItems: V,
|
|
1788
1800
|
moveItems: A,
|
|
1789
1801
|
removeItemsById: F,
|
|
1790
|
-
getItemList:
|
|
1791
|
-
insertItems:
|
|
1792
|
-
setItemList:
|
|
1802
|
+
getItemList: H,
|
|
1803
|
+
insertItems: Z,
|
|
1804
|
+
setItemList: te
|
|
1793
1805
|
})
|
|
1794
1806
|
), y = g.useCallback(
|
|
1795
|
-
(P,
|
|
1796
|
-
let
|
|
1797
|
-
typeof $ == "object" && (
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1807
|
+
(P, $, Y = !1) => {
|
|
1808
|
+
let V = $;
|
|
1809
|
+
typeof $ == "object" && (V = () => $);
|
|
1810
|
+
const A = d().filter((Z) => P.includes(Z)), F = l(), H = Object.fromEntries(
|
|
1811
|
+
A.map((Z) => {
|
|
1812
|
+
const te = F[Z];
|
|
1813
|
+
return Y ? [Z, V(te)] : [Z, V({ ...te })];
|
|
1814
|
+
})
|
|
1800
1815
|
);
|
|
1801
|
-
|
|
1816
|
+
c(H, Y), n();
|
|
1802
1817
|
},
|
|
1803
|
-
[d, l, n,
|
|
1804
|
-
),
|
|
1818
|
+
[d, l, n, c]
|
|
1819
|
+
), C = g.useCallback(
|
|
1805
1820
|
(P) => {
|
|
1806
1821
|
I(P), o(), n();
|
|
1807
1822
|
},
|
|
1808
1823
|
[o, I, n]
|
|
1809
1824
|
), x = g.useCallback(
|
|
1810
|
-
(P,
|
|
1811
|
-
y([P],
|
|
1825
|
+
(P, $, Y = !1) => {
|
|
1826
|
+
y([P], $, Y);
|
|
1812
1827
|
},
|
|
1813
1828
|
[y]
|
|
1814
1829
|
), p = g.useCallback(
|
|
1815
1830
|
(P, $) => {
|
|
1816
|
-
|
|
1817
|
-
|
|
1831
|
+
h(
|
|
1832
|
+
Bt(l(), d(), P),
|
|
1833
|
+
$
|
|
1834
|
+
), n();
|
|
1818
1835
|
},
|
|
1819
|
-
[l, h, n]
|
|
1820
|
-
),
|
|
1836
|
+
[d, l, h, n]
|
|
1837
|
+
), w = g.useCallback(
|
|
1821
1838
|
(P) => {
|
|
1822
|
-
const $ = d(),
|
|
1839
|
+
const $ = d(), Y = $.filter((A) => !P.includes(A)), V = $.filter(
|
|
1823
1840
|
(A) => P.includes(A)
|
|
1824
1841
|
);
|
|
1825
|
-
f([...
|
|
1842
|
+
f([...Y, ...V]);
|
|
1826
1843
|
},
|
|
1827
1844
|
[d, f]
|
|
1828
1845
|
), m = g.useCallback(
|
|
1829
|
-
(P, { type: $, size:
|
|
1830
|
-
const { boardWrapper:
|
|
1831
|
-
y(
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1846
|
+
(P, { type: $, size: Y } = {}) => {
|
|
1847
|
+
const { boardWrapper: V } = u();
|
|
1848
|
+
y(
|
|
1849
|
+
P,
|
|
1850
|
+
(A) => {
|
|
1851
|
+
const F = Ne(V, A.id);
|
|
1852
|
+
if (!F)
|
|
1853
|
+
return;
|
|
1854
|
+
const H = {
|
|
1855
|
+
type: $ || "grid",
|
|
1856
|
+
size: Y || 1,
|
|
1857
|
+
offset: { x: 0, y: 0 },
|
|
1858
|
+
...A.grid
|
|
1859
|
+
};
|
|
1860
|
+
return an(
|
|
1861
|
+
{
|
|
1862
|
+
x: A.x,
|
|
1863
|
+
y: A.y,
|
|
1864
|
+
width: F.clientWidth,
|
|
1865
|
+
height: F.clientHeight
|
|
1866
|
+
},
|
|
1867
|
+
H
|
|
1868
|
+
);
|
|
1869
|
+
},
|
|
1870
|
+
!0
|
|
1871
|
+
);
|
|
1851
1872
|
},
|
|
1852
1873
|
[u, y]
|
|
1853
1874
|
), S = g.useCallback(
|
|
1854
1875
|
(P, $) => {
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1876
|
+
const Y = Bt(
|
|
1877
|
+
l(),
|
|
1878
|
+
d(),
|
|
1879
|
+
P
|
|
1880
|
+
);
|
|
1881
|
+
w(Y), y(Y, (V) => {
|
|
1882
|
+
const A = { ...V };
|
|
1883
|
+
return delete A.moving, A;
|
|
1884
|
+
}), m(Y, $), e(P), n();
|
|
1860
1885
|
},
|
|
1861
1886
|
[
|
|
1862
1887
|
y,
|
|
1863
1888
|
e,
|
|
1889
|
+
d,
|
|
1864
1890
|
l,
|
|
1865
|
-
|
|
1891
|
+
w,
|
|
1866
1892
|
m,
|
|
1867
1893
|
n
|
|
1868
1894
|
]
|
|
@@ -1873,37 +1899,37 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1873
1899
|
[f]
|
|
1874
1900
|
), k = g.useCallback(
|
|
1875
1901
|
(P) => {
|
|
1876
|
-
const $ = d(),
|
|
1902
|
+
const $ = d(), Y = $.filter(
|
|
1877
1903
|
(A) => P.includes(A)
|
|
1878
|
-
),
|
|
1879
|
-
f(
|
|
1904
|
+
), V = $.map((A) => P.includes(A) ? Y.pop() : A);
|
|
1905
|
+
f(V), s();
|
|
1880
1906
|
},
|
|
1881
1907
|
[d, s, f]
|
|
1882
|
-
),
|
|
1908
|
+
), j = g.useCallback(
|
|
1883
1909
|
(P, $) => {
|
|
1884
|
-
const
|
|
1885
|
-
$.map((
|
|
1886
|
-
const
|
|
1910
|
+
const Y = l(), V = Object.fromEntries(
|
|
1911
|
+
$.map((H, Z) => {
|
|
1912
|
+
const te = Y[P[Z]];
|
|
1887
1913
|
return [
|
|
1888
|
-
|
|
1914
|
+
H,
|
|
1889
1915
|
{
|
|
1890
|
-
x:
|
|
1891
|
-
y:
|
|
1916
|
+
x: te.x,
|
|
1917
|
+
y: te.y
|
|
1892
1918
|
}
|
|
1893
1919
|
];
|
|
1894
1920
|
})
|
|
1895
1921
|
);
|
|
1896
|
-
y(P, (
|
|
1922
|
+
y(P, (H) => ({ ...H, ...V[H.id] }));
|
|
1897
1923
|
const A = Object.fromEntries(
|
|
1898
|
-
P.map((
|
|
1899
|
-
), F = d().map((
|
|
1924
|
+
P.map((H, Z) => [H, $[Z]])
|
|
1925
|
+
), F = d().map((H) => P.includes(H) ? A[H] : H);
|
|
1900
1926
|
f(F);
|
|
1901
1927
|
},
|
|
1902
1928
|
[l, y, d, f]
|
|
1903
1929
|
), M = g.useCallback(
|
|
1904
1930
|
(P, $) => {
|
|
1905
|
-
const
|
|
1906
|
-
E(
|
|
1931
|
+
const Y = r(), V = P.map((A, F) => !A.x || !A.y ? { ...A, x: Y.x + 2 * F, y: Y.y + 2 * F } : A);
|
|
1932
|
+
E(V, $), n();
|
|
1907
1933
|
},
|
|
1908
1934
|
[r, E, n]
|
|
1909
1935
|
), L = g.useCallback(
|
|
@@ -1913,17 +1939,17 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1913
1939
|
[M]
|
|
1914
1940
|
), N = g.useCallback(
|
|
1915
1941
|
(P) => {
|
|
1916
|
-
|
|
1942
|
+
a(P), _(P), t(P);
|
|
1917
1943
|
},
|
|
1918
|
-
[
|
|
1919
|
-
),
|
|
1944
|
+
[a, _, t]
|
|
1945
|
+
), U = g.useCallback(
|
|
1920
1946
|
(P) => {
|
|
1921
1947
|
const $ = l();
|
|
1922
|
-
return P.map((
|
|
1948
|
+
return P.map((Y) => $[Y]);
|
|
1923
1949
|
},
|
|
1924
1950
|
[l]
|
|
1925
1951
|
), J = g.useCallback(
|
|
1926
|
-
({ target: P, clientX: $, clientY:
|
|
1952
|
+
({ target: P, clientX: $, clientY: Y }, { returnLocked: V = !1, passLocked: A = !1 } = {}) => {
|
|
1927
1953
|
if (["INPUT", "TEXTAREA"].includes(P.tagName))
|
|
1928
1954
|
return null;
|
|
1929
1955
|
const F = Oe(P, "item");
|
|
@@ -1931,14 +1957,14 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1931
1957
|
if (ye(F, "selected"))
|
|
1932
1958
|
return F;
|
|
1933
1959
|
if (!A && ye(F, "locked") && !ye(P, "passthrough"))
|
|
1934
|
-
return
|
|
1960
|
+
return V ? F : null;
|
|
1935
1961
|
if (ye(P, "passthrough")) {
|
|
1936
|
-
const
|
|
1937
|
-
const me = Ne(
|
|
1938
|
-
return ft({ x: $, y:
|
|
1962
|
+
const H = d(), { boardWrapper: Z } = u(), te = H.reduce((le, se) => {
|
|
1963
|
+
const me = Ne(Z, se), ge = me.getBoundingClientRect();
|
|
1964
|
+
return ft({ x: $, y: Y }, ge) && le.unshift(me), le;
|
|
1939
1965
|
}, []);
|
|
1940
|
-
for (let le = 0; le <
|
|
1941
|
-
const se =
|
|
1966
|
+
for (let le = 0; le < te.length; le += 1) {
|
|
1967
|
+
const se = te[le];
|
|
1942
1968
|
if (se !== F && (A || !ye(se, "locked")))
|
|
1943
1969
|
return se;
|
|
1944
1970
|
}
|
|
@@ -1950,24 +1976,24 @@ const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
|
1950
1976
|
[u, d]
|
|
1951
1977
|
);
|
|
1952
1978
|
return {
|
|
1953
|
-
putItemsOnTop:
|
|
1979
|
+
putItemsOnTop: w,
|
|
1954
1980
|
batchUpdateItems: y,
|
|
1955
1981
|
updateItemOrder: O,
|
|
1956
1982
|
moveItems: p,
|
|
1957
1983
|
placeItems: S,
|
|
1958
1984
|
updateItem: x,
|
|
1959
|
-
swapItems:
|
|
1985
|
+
swapItems: j,
|
|
1960
1986
|
reverseItemsOrder: k,
|
|
1961
|
-
setItemList:
|
|
1987
|
+
setItemList: C,
|
|
1962
1988
|
pushItem: L,
|
|
1963
1989
|
pushItems: M,
|
|
1964
1990
|
removeItems: N,
|
|
1965
1991
|
getItemList: v,
|
|
1966
1992
|
findElementUnderPointer: J,
|
|
1967
|
-
getItems:
|
|
1993
|
+
getItems: U
|
|
1968
1994
|
};
|
|
1969
1995
|
};
|
|
1970
|
-
var
|
|
1996
|
+
var wn = function e(t, r) {
|
|
1971
1997
|
if (t === r)
|
|
1972
1998
|
return !0;
|
|
1973
1999
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
@@ -2021,85 +2047,85 @@ var bn = function e(t, r) {
|
|
|
2021
2047
|
if (!Object.prototype.hasOwnProperty.call(r, s[o]))
|
|
2022
2048
|
return !1;
|
|
2023
2049
|
for (o = n; o-- !== 0; ) {
|
|
2024
|
-
var
|
|
2025
|
-
if (!e(t[
|
|
2050
|
+
var a = s[o];
|
|
2051
|
+
if (!e(t[a], r[a]))
|
|
2026
2052
|
return !1;
|
|
2027
2053
|
}
|
|
2028
2054
|
return !0;
|
|
2029
2055
|
}
|
|
2030
2056
|
return t !== t && r !== r;
|
|
2031
2057
|
};
|
|
2032
|
-
function
|
|
2058
|
+
function Cn(e, t, r, n = 0) {
|
|
2033
2059
|
Pe(mt(e, t, r, n), t);
|
|
2034
2060
|
}
|
|
2035
|
-
const
|
|
2061
|
+
const xn = (e, t) => {
|
|
2036
2062
|
if (e.type in t) {
|
|
2037
2063
|
const r = t[e.type].defaultActions;
|
|
2038
2064
|
return typeof r == "function" ? r(e) : r;
|
|
2039
2065
|
}
|
|
2040
2066
|
return [];
|
|
2041
|
-
},
|
|
2042
|
-
const { actions: r =
|
|
2067
|
+
}, Ft = (e, t) => {
|
|
2068
|
+
const { actions: r = xn(e, t) } = e;
|
|
2043
2069
|
return r.map((n) => typeof n == "string" ? { name: n } : n);
|
|
2044
|
-
},
|
|
2045
|
-
const [e, t] =
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
]), [r, n, o] =
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
]), [s,
|
|
2070
|
+
}, is = () => {
|
|
2071
|
+
const [e, t] = ne((c) => [
|
|
2072
|
+
c.items,
|
|
2073
|
+
c.getItems
|
|
2074
|
+
]), [r, n, o] = Q((c) => [
|
|
2075
|
+
c.config.itemTemplates,
|
|
2076
|
+
c.selection,
|
|
2077
|
+
c.getSelection
|
|
2078
|
+
]), [s, a] = g.useState([]), u = g.useRef(!1), [, l] = g.useTransition();
|
|
2053
2079
|
g.useEffect(() => (u.current = !0, () => {
|
|
2054
2080
|
u.current = !1;
|
|
2055
2081
|
}), []);
|
|
2056
2082
|
const d = g.useCallback(
|
|
2057
|
-
(
|
|
2083
|
+
(c) => {
|
|
2058
2084
|
const h = t();
|
|
2059
|
-
if (
|
|
2060
|
-
return [
|
|
2085
|
+
if (c)
|
|
2086
|
+
return [c, c.map((v) => h[v])];
|
|
2061
2087
|
const _ = o();
|
|
2062
2088
|
return [_, _.map((v) => h[v])];
|
|
2063
2089
|
},
|
|
2064
2090
|
[t, o]
|
|
2065
|
-
), f =
|
|
2066
|
-
const [
|
|
2067
|
-
if (
|
|
2091
|
+
), f = tr(() => {
|
|
2092
|
+
const [c, h] = d();
|
|
2093
|
+
if (c.length > 0) {
|
|
2068
2094
|
if (!u.current)
|
|
2069
2095
|
return;
|
|
2070
2096
|
const _ = h.reduce((v, E) => {
|
|
2071
|
-
const I =
|
|
2097
|
+
const I = Ft(E, r);
|
|
2072
2098
|
return v.filter(
|
|
2073
|
-
(y) => I.some((
|
|
2099
|
+
(y) => I.some((C) => wn(y, C))
|
|
2074
2100
|
);
|
|
2075
|
-
},
|
|
2101
|
+
}, Ft(h[0], r));
|
|
2076
2102
|
l(() => {
|
|
2077
|
-
|
|
2103
|
+
a(_);
|
|
2078
2104
|
});
|
|
2079
2105
|
} else
|
|
2080
2106
|
l(() => {
|
|
2081
|
-
|
|
2107
|
+
a([]);
|
|
2082
2108
|
});
|
|
2083
2109
|
}, [d, r]);
|
|
2084
|
-
return
|
|
2110
|
+
return Cn(
|
|
2085
2111
|
() => f(),
|
|
2086
2112
|
[e, n, f],
|
|
2087
2113
|
100
|
|
2088
2114
|
), {
|
|
2089
2115
|
availableActions: s
|
|
2090
2116
|
};
|
|
2091
|
-
},
|
|
2092
|
-
const [e] =
|
|
2117
|
+
}, as = () => {
|
|
2118
|
+
const [e] = Q((t) => [t.selectionBox]);
|
|
2093
2119
|
return e;
|
|
2094
2120
|
};
|
|
2095
2121
|
let pe = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, r) => (r &= 63, r < 36 ? t += r.toString(36) : r < 62 ? t += (r - 26).toString(36).toUpperCase() : r > 62 ? t += "-" : t += "_", t), "");
|
|
2096
|
-
const
|
|
2122
|
+
const lr = g.createContext(), ut = (e) => {
|
|
2097
2123
|
localStorage.setItem("user", JSON.stringify(e));
|
|
2098
|
-
},
|
|
2124
|
+
}, Rn = () => {
|
|
2099
2125
|
if (localStorage.user) {
|
|
2100
2126
|
const t = {
|
|
2101
2127
|
name: "Player",
|
|
2102
|
-
color:
|
|
2128
|
+
color: Xt(),
|
|
2103
2129
|
uid: pe(),
|
|
2104
2130
|
...JSON.parse(localStorage.user)
|
|
2105
2131
|
};
|
|
@@ -2107,11 +2133,11 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2107
2133
|
}
|
|
2108
2134
|
const e = {
|
|
2109
2135
|
name: "Player",
|
|
2110
|
-
color:
|
|
2136
|
+
color: Xt(),
|
|
2111
2137
|
uid: pe()
|
|
2112
2138
|
};
|
|
2113
2139
|
return ut(e), e;
|
|
2114
|
-
},
|
|
2140
|
+
}, In = (e) => (t, r) => ({
|
|
2115
2141
|
isSpaceMaster: !1,
|
|
2116
2142
|
users: {},
|
|
2117
2143
|
getUser: () => r().users[e],
|
|
@@ -2127,16 +2153,16 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2127
2153
|
updateUser: (n, o) => t((s) => {
|
|
2128
2154
|
if (!s.users[n])
|
|
2129
2155
|
return {};
|
|
2130
|
-
const
|
|
2156
|
+
const a = {
|
|
2131
2157
|
...s.users[n],
|
|
2132
2158
|
...o,
|
|
2133
2159
|
id: n,
|
|
2134
2160
|
uid: s.users[n].uid
|
|
2135
2161
|
};
|
|
2136
|
-
return
|
|
2162
|
+
return a.id === e && ut(a), setTimeout(() => r().electSpaceMaster(), 100), {
|
|
2137
2163
|
users: {
|
|
2138
2164
|
...s.users,
|
|
2139
|
-
[n]:
|
|
2165
|
+
[n]: a
|
|
2140
2166
|
}
|
|
2141
2167
|
};
|
|
2142
2168
|
}),
|
|
@@ -2152,19 +2178,19 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2152
2178
|
uid: null,
|
|
2153
2179
|
timestamp: Date.now()
|
|
2154
2180
|
};
|
|
2155
|
-
Object.values(n).forEach(({ spaceJoinedTimestamp: s, id:
|
|
2156
|
-
s < o.timestamp && (o.id =
|
|
2181
|
+
Object.values(n).forEach(({ spaceJoinedTimestamp: s, id: a }) => {
|
|
2182
|
+
s < o.timestamp && (o.id = a, o.timestamp = s);
|
|
2157
2183
|
}), t({ isSpaceMaster: o.id === e });
|
|
2158
2184
|
}
|
|
2159
|
-
}),
|
|
2185
|
+
}), On = (e) => ({
|
|
2160
2186
|
cursors: {},
|
|
2161
2187
|
moveCursor: (t, r) => e((n) => ({ cursors: { ...n.cursors, [t]: r } })),
|
|
2162
2188
|
removeCursor: (t) => e((r) => {
|
|
2163
2189
|
const n = { ...r.cursors };
|
|
2164
2190
|
return delete n[t], { cursors: n };
|
|
2165
2191
|
})
|
|
2166
|
-
}),
|
|
2167
|
-
const { wire: r, isMaster: n } = Xe("room"), [o, s] = g.useState(null), [
|
|
2192
|
+
}), fr = ({ storeName: e, children: t }) => {
|
|
2193
|
+
const { wire: r, isMaster: n } = Xe("room"), [o, s] = g.useState(null), [a, u] = g.useState(!1), l = g.useRef(!1);
|
|
2168
2194
|
return g.useEffect(() => {
|
|
2169
2195
|
let d = !0;
|
|
2170
2196
|
const f = [];
|
|
@@ -2183,8 +2209,8 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2183
2209
|
]
|
|
2184
2210
|
},
|
|
2185
2211
|
(...v) => ({
|
|
2186
|
-
...
|
|
2187
|
-
...
|
|
2212
|
+
...In(r.userId)(...v),
|
|
2213
|
+
...On(...v)
|
|
2188
2214
|
})
|
|
2189
2215
|
)
|
|
2190
2216
|
), _ = h.subscribe((v) => {
|
|
@@ -2196,7 +2222,7 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2196
2222
|
}, [o, e, r, r.userId]), g.useEffect(() => {
|
|
2197
2223
|
if (o)
|
|
2198
2224
|
return o.getState().addUser({
|
|
2199
|
-
...
|
|
2225
|
+
...Rn(),
|
|
2200
2226
|
id: r.userId
|
|
2201
2227
|
}), u(!0), () => {
|
|
2202
2228
|
o.getState().removeUser(r.userId);
|
|
@@ -2212,18 +2238,18 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2212
2238
|
}
|
|
2213
2239
|
}, [n, o, r]), g.useEffect(() => {
|
|
2214
2240
|
n && o && o.getState().updateCurrentUser({ isMaster: n });
|
|
2215
|
-
}, [n, o, r]),
|
|
2241
|
+
}, [n, o, r]), a ? /* @__PURE__ */ T(lr.Provider, { value: o, children: t }) : null;
|
|
2216
2242
|
}, Se = (e, t) => {
|
|
2217
|
-
const r = _e(
|
|
2243
|
+
const r = _e(lr);
|
|
2218
2244
|
return We(r, e, t || Ve);
|
|
2219
|
-
},
|
|
2245
|
+
}, cs = () => {
|
|
2220
2246
|
const [e, t, r, n, o] = Se((u) => [
|
|
2221
2247
|
u.isSpaceMaster,
|
|
2222
2248
|
u.getUser(),
|
|
2223
2249
|
u.users,
|
|
2224
2250
|
u.updateCurrentUser,
|
|
2225
2251
|
u.joinSpace
|
|
2226
|
-
]), s = g.useMemo(() => Object.values(r), [r]),
|
|
2252
|
+
]), s = g.useMemo(() => Object.values(r), [r]), a = g.useMemo(() => {
|
|
2227
2253
|
const { space: u } = t;
|
|
2228
2254
|
return s.filter(({ space: l }) => l === u);
|
|
2229
2255
|
}, [t, s]);
|
|
@@ -2232,40 +2258,40 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2232
2258
|
currentUser: t,
|
|
2233
2259
|
updateCurrentUser: n,
|
|
2234
2260
|
users: s,
|
|
2235
|
-
localUsers:
|
|
2261
|
+
localUsers: a,
|
|
2236
2262
|
joinSpace: o
|
|
2237
2263
|
};
|
|
2238
|
-
},
|
|
2239
|
-
const [e, t, r] =
|
|
2264
|
+
}, us = () => {
|
|
2265
|
+
const [e, t, r] = ne(
|
|
2240
2266
|
(o) => [o.boardConfig, o.getBoardConfig, o.setBoardConfig]
|
|
2241
2267
|
), n = g.useCallback(
|
|
2242
2268
|
(o) => {
|
|
2243
2269
|
let s = o;
|
|
2244
2270
|
typeof o == "object" && (s = () => o);
|
|
2245
|
-
const
|
|
2271
|
+
const a = t(), u = s(a);
|
|
2246
2272
|
r(u);
|
|
2247
2273
|
},
|
|
2248
2274
|
[t, r]
|
|
2249
2275
|
);
|
|
2250
2276
|
return [e, n];
|
|
2251
|
-
},
|
|
2252
|
-
const [e] =
|
|
2277
|
+
}, ls = () => {
|
|
2278
|
+
const [e] = Q((t) => [t.boardState]);
|
|
2253
2279
|
return e;
|
|
2254
|
-
},
|
|
2255
|
-
const [e, t, r, n] =
|
|
2280
|
+
}, fs = () => {
|
|
2281
|
+
const [e, t, r, n] = ne((o) => [
|
|
2256
2282
|
o.getSessionInfo,
|
|
2257
2283
|
o.setSessionInfo,
|
|
2258
2284
|
o.updateSessionInfo,
|
|
2259
2285
|
o.session
|
|
2260
2286
|
]);
|
|
2261
2287
|
return { getSessionInfo: e, setSessionInfo: t, sessionInfo: n, updateSessionInfo: r };
|
|
2262
|
-
},
|
|
2288
|
+
}, dr = g.createContext(), Tn = ({ user: { name: e, uid: t, color: r }, content: n }) => ({
|
|
2263
2289
|
type: "message",
|
|
2264
2290
|
user: { name: e, uid: t, color: r },
|
|
2265
2291
|
content: n,
|
|
2266
2292
|
uid: pe(),
|
|
2267
2293
|
timestamp: new Date().toISOString()
|
|
2268
|
-
}),
|
|
2294
|
+
}), kn = (e, t) => ({
|
|
2269
2295
|
messages: [],
|
|
2270
2296
|
setMessages: (r) => e({
|
|
2271
2297
|
messages: r.map((n) => ({
|
|
@@ -2280,13 +2306,13 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2280
2306
|
]
|
|
2281
2307
|
})),
|
|
2282
2308
|
sendMessage: (r, n) => {
|
|
2283
|
-
const o =
|
|
2309
|
+
const o = Tn({
|
|
2284
2310
|
user: r,
|
|
2285
2311
|
content: n
|
|
2286
2312
|
});
|
|
2287
2313
|
o && t().addMessage(o);
|
|
2288
2314
|
}
|
|
2289
|
-
}),
|
|
2315
|
+
}), Kt = ({
|
|
2290
2316
|
storeName: e,
|
|
2291
2317
|
children: t,
|
|
2292
2318
|
defaultValue: r = []
|
|
@@ -2296,104 +2322,104 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2296
2322
|
dt(
|
|
2297
2323
|
{ wire: n, storeName: e, defaultValue: r, noSync: ["sendMessage"] },
|
|
2298
2324
|
(...s) => ({
|
|
2299
|
-
...
|
|
2325
|
+
...kn(...s)
|
|
2300
2326
|
})
|
|
2301
2327
|
)
|
|
2302
2328
|
)
|
|
2303
2329
|
);
|
|
2304
|
-
return /* @__PURE__ */ T(
|
|
2305
|
-
},
|
|
2306
|
-
const r = _e(
|
|
2330
|
+
return /* @__PURE__ */ T(dr.Provider, { value: o, children: t });
|
|
2331
|
+
}, Pn = (e, t) => {
|
|
2332
|
+
const r = _e(dr);
|
|
2307
2333
|
return We(r, e, t || Ve);
|
|
2308
|
-
},
|
|
2309
|
-
},
|
|
2310
|
-
const t = Se((
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2334
|
+
}, Mn = () => {
|
|
2335
|
+
}, ds = (e = Mn) => {
|
|
2336
|
+
const t = Se((a) => a.getUser()), [r, n, o] = Pn((a) => [
|
|
2337
|
+
a.messages,
|
|
2338
|
+
a.setMessages,
|
|
2339
|
+
a.sendMessage
|
|
2314
2340
|
]);
|
|
2315
2341
|
g.useEffect(() => {
|
|
2316
2342
|
r.length && e();
|
|
2317
2343
|
}, [r, e]);
|
|
2318
2344
|
const s = g.useCallback(
|
|
2319
|
-
(
|
|
2320
|
-
o(t,
|
|
2345
|
+
(a) => {
|
|
2346
|
+
o(t, a);
|
|
2321
2347
|
},
|
|
2322
2348
|
[t, o]
|
|
2323
2349
|
);
|
|
2324
2350
|
return { messages: r, setMessages: n, sendMessage: s };
|
|
2325
|
-
},
|
|
2351
|
+
}, Ht = ({ children: e, session: t }) => {
|
|
2326
2352
|
const r = Se((n) => n.joinSpace);
|
|
2327
2353
|
return g.useEffect(() => (r(t), () => {
|
|
2328
2354
|
r(null);
|
|
2329
2355
|
}), [r, t]), e;
|
|
2330
|
-
},
|
|
2356
|
+
}, ps = ({
|
|
2331
2357
|
socket: e,
|
|
2332
2358
|
room: t,
|
|
2333
2359
|
session: r,
|
|
2334
2360
|
items: n = [],
|
|
2335
2361
|
messages: o = [],
|
|
2336
2362
|
LoadingComponent: s,
|
|
2337
|
-
...
|
|
2363
|
+
...a
|
|
2338
2364
|
}) => {
|
|
2339
2365
|
const [u] = g.useState(t || pe()), [l] = g.useState(r || pe()), [d] = g.useState(() => ({
|
|
2340
|
-
itemIds: n.map(({ id:
|
|
2341
|
-
items: Object.fromEntries(n.map((
|
|
2366
|
+
itemIds: n.map(({ id: c }) => c),
|
|
2367
|
+
items: Object.fromEntries(n.map((c) => [c.id, c]))
|
|
2342
2368
|
}));
|
|
2343
2369
|
return Xe("room") ? /* @__PURE__ */ T(
|
|
2344
|
-
|
|
2370
|
+
Kt,
|
|
2345
2371
|
{
|
|
2346
2372
|
storeName: `${l}_messages`,
|
|
2347
2373
|
defaultValue: o,
|
|
2348
|
-
children: /* @__PURE__ */ T(
|
|
2349
|
-
|
|
2374
|
+
children: /* @__PURE__ */ T(Wt, { children: /* @__PURE__ */ T(
|
|
2375
|
+
Ut,
|
|
2350
2376
|
{
|
|
2351
2377
|
storeName: `${l}_item`,
|
|
2352
2378
|
defaultValue: d,
|
|
2353
|
-
children: /* @__PURE__ */ T(
|
|
2379
|
+
children: /* @__PURE__ */ T(Ht, { ...a, session: l })
|
|
2354
2380
|
}
|
|
2355
2381
|
) })
|
|
2356
2382
|
}
|
|
2357
2383
|
) : /* @__PURE__ */ T(
|
|
2358
|
-
|
|
2384
|
+
nr,
|
|
2359
2385
|
{
|
|
2360
2386
|
room: u,
|
|
2361
2387
|
channel: "room",
|
|
2362
2388
|
socket: e,
|
|
2363
2389
|
LoadingComponent: s,
|
|
2364
|
-
children: /* @__PURE__ */ T(
|
|
2365
|
-
|
|
2390
|
+
children: /* @__PURE__ */ T(fr, { storeName: `${u}_users`, children: /* @__PURE__ */ T(
|
|
2391
|
+
Kt,
|
|
2366
2392
|
{
|
|
2367
2393
|
storeName: `${l}_messages`,
|
|
2368
2394
|
defaultValue: o,
|
|
2369
|
-
children: /* @__PURE__ */ T(
|
|
2370
|
-
|
|
2395
|
+
children: /* @__PURE__ */ T(Wt, { children: /* @__PURE__ */ T(
|
|
2396
|
+
Ut,
|
|
2371
2397
|
{
|
|
2372
2398
|
storeName: `${l}_item`,
|
|
2373
2399
|
defaultValue: d,
|
|
2374
|
-
children: /* @__PURE__ */ T(
|
|
2400
|
+
children: /* @__PURE__ */ T(Ht, { ...a, session: l })
|
|
2375
2401
|
}
|
|
2376
2402
|
) })
|
|
2377
2403
|
}
|
|
2378
2404
|
) })
|
|
2379
2405
|
}
|
|
2380
2406
|
);
|
|
2381
|
-
},
|
|
2407
|
+
}, ms = ({ socket: e, room: t, children: r, LoadingComponent: n }) => {
|
|
2382
2408
|
const [o] = g.useState(t || pe());
|
|
2383
2409
|
return /* @__PURE__ */ T(
|
|
2384
|
-
|
|
2410
|
+
nr,
|
|
2385
2411
|
{
|
|
2386
2412
|
room: o,
|
|
2387
2413
|
channel: "room",
|
|
2388
2414
|
socket: e,
|
|
2389
2415
|
LoadingComponent: n,
|
|
2390
|
-
children: /* @__PURE__ */ T(
|
|
2416
|
+
children: /* @__PURE__ */ T(fr, { storeName: `${o}_users`, children: r })
|
|
2391
2417
|
}
|
|
2392
2418
|
);
|
|
2393
2419
|
}, nt = () => {
|
|
2394
2420
|
const e = navigator.userAgent.toLowerCase();
|
|
2395
2421
|
return /mac os ?x 10/.test(e);
|
|
2396
|
-
},
|
|
2422
|
+
}, jn = () => {
|
|
2397
2423
|
const e = document.createElement("iframe");
|
|
2398
2424
|
e.src = "#", document.body.appendChild(e);
|
|
2399
2425
|
const t = e.contentWindow.document;
|
|
@@ -2402,70 +2428,70 @@ const cr = g.createContext(), ut = (e) => {
|
|
|
2402
2428
|
), t.close();
|
|
2403
2429
|
const r = t.body.firstElementChild.offsetHeight;
|
|
2404
2430
|
return document.body.removeChild(e), r;
|
|
2405
|
-
},
|
|
2431
|
+
}, Dn = jn(), $n = 800, qt = (e, t) => {
|
|
2406
2432
|
const r = Object.keys(e).map((n) => Number(n)).find((n) => n !== t);
|
|
2407
2433
|
return e[r];
|
|
2408
|
-
},
|
|
2434
|
+
}, Gt = ([e, t], [r, n]) => {
|
|
2409
2435
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
2410
2436
|
return Math.hypot(o, s);
|
|
2411
2437
|
}, de = () => {
|
|
2412
|
-
},
|
|
2438
|
+
}, An = (e) => (t) => {
|
|
2413
2439
|
const { event: r } = t;
|
|
2414
2440
|
return r.isPropagationStopped() ? null : e(t);
|
|
2415
|
-
},
|
|
2441
|
+
}, Ln = (e) => async (...t) => {
|
|
2416
2442
|
try {
|
|
2417
2443
|
await e(...t);
|
|
2418
2444
|
} catch (r) {
|
|
2419
2445
|
console.error(r);
|
|
2420
2446
|
}
|
|
2421
2447
|
};
|
|
2422
|
-
class
|
|
2448
|
+
class zn {
|
|
2423
2449
|
constructor() {
|
|
2424
2450
|
kt(this, "lastPromise", Promise.resolve(!0));
|
|
2425
2451
|
}
|
|
2426
2452
|
add(t, ...r) {
|
|
2427
2453
|
return new Promise((n, o) => {
|
|
2428
|
-
this.lastPromise = this.lastPromise.then(() =>
|
|
2454
|
+
this.lastPromise = this.lastPromise.then(() => An(Ln(t))(...r)).then(n).catch(o);
|
|
2429
2455
|
});
|
|
2430
2456
|
}
|
|
2431
2457
|
}
|
|
2432
|
-
const
|
|
2458
|
+
const oe = new zn(), Fe = ({
|
|
2433
2459
|
children: e,
|
|
2434
2460
|
onDrag: t = de,
|
|
2435
2461
|
onDragStart: r = de,
|
|
2436
2462
|
onDragEnd: n = de,
|
|
2437
2463
|
onPan: o = de,
|
|
2438
2464
|
onTap: s = de,
|
|
2439
|
-
onLongTap:
|
|
2465
|
+
onLongTap: a = de,
|
|
2440
2466
|
onDoubleTap: u = de,
|
|
2441
2467
|
onZoom: l,
|
|
2442
2468
|
mainAction: d = "drag"
|
|
2443
2469
|
}) => {
|
|
2444
|
-
const f = g.useRef(null),
|
|
2470
|
+
const f = g.useRef(null), c = g.useRef({
|
|
2445
2471
|
moving: !1,
|
|
2446
2472
|
pointers: {},
|
|
2447
2473
|
mainPointer: void 0
|
|
2448
2474
|
}), h = (y) => {
|
|
2449
2475
|
const {
|
|
2450
|
-
deltaX:
|
|
2476
|
+
deltaX: C,
|
|
2451
2477
|
deltaY: x,
|
|
2452
2478
|
clientX: p,
|
|
2453
|
-
clientY:
|
|
2479
|
+
clientY: w,
|
|
2454
2480
|
deltaMode: m,
|
|
2455
2481
|
ctrlKey: S,
|
|
2456
2482
|
altKey: O,
|
|
2457
2483
|
metaKey: k,
|
|
2458
|
-
target:
|
|
2484
|
+
target: j
|
|
2459
2485
|
} = y;
|
|
2460
2486
|
if (!(O || S && !nt()))
|
|
2461
2487
|
if (nt() && !S)
|
|
2462
|
-
|
|
2463
|
-
deltaX: -2 *
|
|
2488
|
+
oe.add(o, {
|
|
2489
|
+
deltaX: -2 * C,
|
|
2464
2490
|
deltaY: -2 * x,
|
|
2465
2491
|
button: 1,
|
|
2466
2492
|
ctrlKey: S,
|
|
2467
2493
|
metaKey: k,
|
|
2468
|
-
target:
|
|
2494
|
+
target: j,
|
|
2469
2495
|
event: y
|
|
2470
2496
|
});
|
|
2471
2497
|
else {
|
|
@@ -2474,241 +2500,241 @@ const ne = new An(), Fe = ({
|
|
|
2474
2500
|
let M = x;
|
|
2475
2501
|
switch (m) {
|
|
2476
2502
|
case 1:
|
|
2477
|
-
M *=
|
|
2503
|
+
M *= Dn;
|
|
2478
2504
|
break;
|
|
2479
2505
|
case 2:
|
|
2480
|
-
M *=
|
|
2506
|
+
M *= $n;
|
|
2481
2507
|
break;
|
|
2482
2508
|
}
|
|
2483
|
-
nt() && (M *= 2),
|
|
2509
|
+
nt() && (M *= 2), oe.add(l, { scale: M, clientX: p, clientY: w, event: y });
|
|
2484
2510
|
}
|
|
2485
2511
|
}, _ = (y) => {
|
|
2486
2512
|
const {
|
|
2487
|
-
target:
|
|
2513
|
+
target: C,
|
|
2488
2514
|
button: x,
|
|
2489
2515
|
clientX: p,
|
|
2490
|
-
clientY:
|
|
2516
|
+
clientY: w,
|
|
2491
2517
|
pointerId: m,
|
|
2492
2518
|
altKey: S,
|
|
2493
2519
|
ctrlKey: O,
|
|
2494
2520
|
metaKey: k,
|
|
2495
|
-
isPrimary:
|
|
2521
|
+
isPrimary: j
|
|
2496
2522
|
} = y;
|
|
2497
|
-
if (
|
|
2498
|
-
if (
|
|
2523
|
+
if (c.current.pointers[m] = { clientX: p, clientY: w }, j && (c.current.mainPointer = void 0), c.current.mainPointer !== void 0) {
|
|
2524
|
+
if (c.current.mainPointer !== m)
|
|
2499
2525
|
try {
|
|
2500
|
-
const { clientX: M, clientY: L } =
|
|
2501
|
-
|
|
2526
|
+
const { clientX: M, clientY: L } = qt(
|
|
2527
|
+
c.current.pointers,
|
|
2502
2528
|
m
|
|
2503
|
-
), N = (M + p) / 2,
|
|
2529
|
+
), N = (M + p) / 2, U = (L + w) / 2, J = Gt(
|
|
2504
2530
|
[M, L],
|
|
2505
|
-
[p,
|
|
2531
|
+
[p, w]
|
|
2506
2532
|
);
|
|
2507
|
-
Object.assign(
|
|
2533
|
+
Object.assign(c.current, {
|
|
2508
2534
|
pressed: !0,
|
|
2509
2535
|
moving: !1,
|
|
2510
2536
|
gestureStart: !1,
|
|
2511
2537
|
startX: p,
|
|
2512
|
-
startY:
|
|
2538
|
+
startY: w,
|
|
2513
2539
|
prevX: N,
|
|
2514
|
-
prevY:
|
|
2540
|
+
prevY: U,
|
|
2515
2541
|
startDistance: J,
|
|
2516
2542
|
prevDistance: J
|
|
2517
2543
|
});
|
|
2518
2544
|
} catch (M) {
|
|
2519
|
-
console.log("Error while getting other pointer. Ignoring", M),
|
|
2545
|
+
console.log("Error while getting other pointer. Ignoring", M), c.current.mainPointer;
|
|
2520
2546
|
}
|
|
2521
2547
|
return;
|
|
2522
2548
|
}
|
|
2523
|
-
|
|
2549
|
+
c.current.mainPointer = m, Object.assign(c.current, {
|
|
2524
2550
|
pressed: !0,
|
|
2525
2551
|
moving: !1,
|
|
2526
2552
|
gestureStart: !1,
|
|
2527
2553
|
startX: p,
|
|
2528
|
-
startY:
|
|
2554
|
+
startY: w,
|
|
2529
2555
|
prevX: p,
|
|
2530
|
-
prevY:
|
|
2556
|
+
prevY: w,
|
|
2531
2557
|
currentButton: x,
|
|
2532
2558
|
pointerDownEvent: y,
|
|
2533
2559
|
startDistance: 0,
|
|
2534
2560
|
prevDistance: 0,
|
|
2535
|
-
target:
|
|
2561
|
+
target: C,
|
|
2536
2562
|
timeStart: Date.now(),
|
|
2537
2563
|
longTapTimeout: setTimeout(async () => {
|
|
2538
|
-
|
|
2564
|
+
c.current.noTap = !0, oe.add(a, {
|
|
2539
2565
|
clientX: p,
|
|
2540
|
-
clientY:
|
|
2566
|
+
clientY: w,
|
|
2541
2567
|
altKey: S,
|
|
2542
2568
|
ctrlKey: O,
|
|
2543
2569
|
metaKey: k,
|
|
2544
|
-
target:
|
|
2570
|
+
target: C,
|
|
2545
2571
|
event: y
|
|
2546
2572
|
});
|
|
2547
2573
|
}, 750)
|
|
2548
2574
|
});
|
|
2549
2575
|
try {
|
|
2550
|
-
|
|
2576
|
+
C.setPointerCapture(m);
|
|
2551
2577
|
} catch (M) {
|
|
2552
2578
|
console.log("Fail to capture pointer", M);
|
|
2553
2579
|
}
|
|
2554
2580
|
}, v = (y) => {
|
|
2555
|
-
if (
|
|
2581
|
+
if (c.current.pressed) {
|
|
2556
2582
|
const {
|
|
2557
|
-
pointerId:
|
|
2583
|
+
pointerId: C,
|
|
2558
2584
|
clientX: x,
|
|
2559
2585
|
clientY: p,
|
|
2560
|
-
altKey:
|
|
2586
|
+
altKey: w,
|
|
2561
2587
|
shiftKey: m,
|
|
2562
2588
|
ctrlKey: S,
|
|
2563
2589
|
metaKey: O,
|
|
2564
2590
|
buttons: k
|
|
2565
2591
|
} = y;
|
|
2566
|
-
|
|
2592
|
+
c.current.pointers[C] = {
|
|
2567
2593
|
clientX: x,
|
|
2568
2594
|
clientY: p
|
|
2569
|
-
},
|
|
2570
|
-
const
|
|
2595
|
+
}, c.current.moving = !0;
|
|
2596
|
+
const j = Object.keys(c.current.pointers).length === 2;
|
|
2571
2597
|
let M, L, N = 0;
|
|
2572
|
-
if (
|
|
2573
|
-
const { clientX: $, clientY:
|
|
2574
|
-
|
|
2575
|
-
|
|
2598
|
+
if (j) {
|
|
2599
|
+
const { clientX: $, clientY: Y } = qt(
|
|
2600
|
+
c.current.pointers,
|
|
2601
|
+
C
|
|
2576
2602
|
);
|
|
2577
|
-
M = ($ + x) / 2, L = (
|
|
2578
|
-
[$,
|
|
2603
|
+
M = ($ + x) / 2, L = (Y + p) / 2, N = Gt(
|
|
2604
|
+
[$, Y],
|
|
2579
2605
|
[x, p]
|
|
2580
2606
|
);
|
|
2581
2607
|
} else
|
|
2582
2608
|
M = x, L = p;
|
|
2583
|
-
let
|
|
2584
|
-
d !== "drag" && (
|
|
2585
|
-
const J = !
|
|
2609
|
+
let U = m || w || S || O || k !== 1;
|
|
2610
|
+
d !== "drag" && (U = !U);
|
|
2611
|
+
const J = !U, P = U;
|
|
2586
2612
|
if (J) {
|
|
2587
|
-
|
|
2613
|
+
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout), oe.add(r, {
|
|
2588
2614
|
deltaX: 0,
|
|
2589
2615
|
deltaY: 0,
|
|
2590
|
-
startX:
|
|
2591
|
-
startY:
|
|
2592
|
-
clientX:
|
|
2593
|
-
clientY:
|
|
2616
|
+
startX: c.current.startX,
|
|
2617
|
+
startY: c.current.startY,
|
|
2618
|
+
clientX: c.current.startX,
|
|
2619
|
+
clientY: c.current.startY,
|
|
2594
2620
|
distanceX: 0,
|
|
2595
2621
|
distanceY: 0,
|
|
2596
|
-
button:
|
|
2597
|
-
altKey:
|
|
2622
|
+
button: c.current.currentButton,
|
|
2623
|
+
altKey: w,
|
|
2598
2624
|
shiftKey: m,
|
|
2599
2625
|
ctrlKey: S,
|
|
2600
2626
|
metaKey: O,
|
|
2601
|
-
target:
|
|
2602
|
-
event:
|
|
2627
|
+
target: c.current.target,
|
|
2628
|
+
event: c.current.pointerDownEvent
|
|
2603
2629
|
}));
|
|
2604
|
-
const $ = M -
|
|
2605
|
-
|
|
2630
|
+
const $ = M - c.current.prevX, Y = L - c.current.prevY, V = M - c.current.startX, A = L - c.current.startY;
|
|
2631
|
+
oe.add(t, {
|
|
2606
2632
|
deltaX: $,
|
|
2607
|
-
deltaY:
|
|
2608
|
-
startX:
|
|
2609
|
-
startY:
|
|
2633
|
+
deltaY: Y,
|
|
2634
|
+
startX: c.current.startX,
|
|
2635
|
+
startY: c.current.startY,
|
|
2610
2636
|
clientX: M,
|
|
2611
2637
|
clientY: L,
|
|
2612
|
-
distanceX:
|
|
2638
|
+
distanceX: V,
|
|
2613
2639
|
distanceY: A,
|
|
2614
|
-
button:
|
|
2615
|
-
altKey:
|
|
2640
|
+
button: c.current.currentButton,
|
|
2641
|
+
altKey: w,
|
|
2616
2642
|
shiftKey: m,
|
|
2617
2643
|
ctrlKey: S,
|
|
2618
2644
|
metaKey: O,
|
|
2619
|
-
target:
|
|
2645
|
+
target: c.current.target,
|
|
2620
2646
|
event: y
|
|
2621
2647
|
});
|
|
2622
2648
|
}
|
|
2623
2649
|
if (P) {
|
|
2624
|
-
|
|
2625
|
-
const $ = M -
|
|
2626
|
-
if (
|
|
2650
|
+
c.current.gestureStart || (f.current.style.cursor = "move", c.current.gestureStart = !0, clearTimeout(c.current.longTapTimeout));
|
|
2651
|
+
const $ = M - c.current.prevX, Y = L - c.current.prevY, { target: V } = c.current;
|
|
2652
|
+
if (oe.add(o, {
|
|
2627
2653
|
deltaX: $,
|
|
2628
|
-
deltaY:
|
|
2629
|
-
button:
|
|
2630
|
-
altKey:
|
|
2654
|
+
deltaY: Y,
|
|
2655
|
+
button: c.current.currentButton,
|
|
2656
|
+
altKey: w,
|
|
2631
2657
|
shiftKey: m,
|
|
2632
2658
|
ctrlKey: S,
|
|
2633
2659
|
metaKey: O,
|
|
2634
|
-
target:
|
|
2660
|
+
target: V,
|
|
2635
2661
|
event: y
|
|
2636
|
-
}), N !==
|
|
2637
|
-
const A =
|
|
2638
|
-
Math.abs(A) > 0 && (
|
|
2662
|
+
}), N !== c.current.prevDistance && l) {
|
|
2663
|
+
const A = c.current.prevDistance - N;
|
|
2664
|
+
Math.abs(A) > 0 && (oe.add(l, {
|
|
2639
2665
|
scale: A * 3,
|
|
2640
2666
|
clientX: M,
|
|
2641
2667
|
clientY: L,
|
|
2642
2668
|
event: y
|
|
2643
|
-
}),
|
|
2669
|
+
}), c.current.prevDistance = N);
|
|
2644
2670
|
}
|
|
2645
2671
|
}
|
|
2646
|
-
|
|
2672
|
+
c.current.prevX = M, c.current.prevY = L;
|
|
2647
2673
|
}
|
|
2648
2674
|
}, E = (y) => {
|
|
2649
2675
|
const {
|
|
2650
|
-
clientX:
|
|
2676
|
+
clientX: C,
|
|
2651
2677
|
clientY: x,
|
|
2652
2678
|
altKey: p,
|
|
2653
|
-
shiftKey:
|
|
2679
|
+
shiftKey: w,
|
|
2654
2680
|
ctrlKey: m,
|
|
2655
2681
|
metaKey: S,
|
|
2656
2682
|
target: O,
|
|
2657
2683
|
pointerId: k
|
|
2658
2684
|
} = y;
|
|
2659
|
-
if (
|
|
2660
|
-
if (delete
|
|
2661
|
-
const { clientX:
|
|
2662
|
-
Object.assign(
|
|
2663
|
-
prevX:
|
|
2685
|
+
if (c.current.pointers[k]) {
|
|
2686
|
+
if (delete c.current.pointers[k], c.current.mainPointer !== k) {
|
|
2687
|
+
const { clientX: j, clientY: M } = c.current.pointers[c.current.mainPointer];
|
|
2688
|
+
Object.assign(c.current, {
|
|
2689
|
+
prevX: j,
|
|
2664
2690
|
prevY: M,
|
|
2665
2691
|
prevDistance: 0,
|
|
2666
2692
|
startDistance: 0
|
|
2667
2693
|
});
|
|
2668
2694
|
return;
|
|
2669
2695
|
}
|
|
2670
|
-
for (; Object.keys(
|
|
2671
|
-
|
|
2672
|
-
Object.keys(
|
|
2696
|
+
for (; Object.keys(c.current.pointers).length > 0; ) {
|
|
2697
|
+
c.current.mainPointer = Number(
|
|
2698
|
+
Object.keys(c.current.pointers)[0]
|
|
2673
2699
|
);
|
|
2674
2700
|
try {
|
|
2675
|
-
|
|
2676
|
-
const { clientX:
|
|
2677
|
-
Object.assign(
|
|
2678
|
-
prevX:
|
|
2701
|
+
c.current.target.setPointerCapture(c.current.mainPointer);
|
|
2702
|
+
const { clientX: j, clientY: M } = c.current.pointers[c.current.mainPointer];
|
|
2703
|
+
Object.assign(c.current, {
|
|
2704
|
+
prevX: j,
|
|
2679
2705
|
prevY: M,
|
|
2680
2706
|
prevDistance: 0,
|
|
2681
2707
|
startDistance: 0
|
|
2682
2708
|
});
|
|
2683
2709
|
return;
|
|
2684
|
-
} catch (
|
|
2685
|
-
console.log("Fails to set pointer capture",
|
|
2710
|
+
} catch (j) {
|
|
2711
|
+
console.log("Fails to set pointer capture", j), c.current.mainPointer = void 0, delete c.current.pointers[Object.keys(c.current.pointers)[0]];
|
|
2686
2712
|
}
|
|
2687
2713
|
}
|
|
2688
|
-
if (
|
|
2689
|
-
|
|
2690
|
-
deltaX:
|
|
2691
|
-
deltaY: x -
|
|
2692
|
-
startX:
|
|
2693
|
-
startY:
|
|
2694
|
-
clientX:
|
|
2714
|
+
if (c.current.mainPointer = void 0, c.current.pressed = !1, clearTimeout(c.current.longTapTimeout), c.current.moving)
|
|
2715
|
+
c.current.moving = !1, oe.add(n, {
|
|
2716
|
+
deltaX: C - c.current.prevX,
|
|
2717
|
+
deltaY: x - c.current.prevY,
|
|
2718
|
+
startX: c.current.startX,
|
|
2719
|
+
startY: c.current.startY,
|
|
2720
|
+
clientX: C,
|
|
2695
2721
|
clientY: x,
|
|
2696
|
-
distanceX:
|
|
2697
|
-
distanceY: x -
|
|
2698
|
-
button:
|
|
2722
|
+
distanceX: C - c.current.startX,
|
|
2723
|
+
distanceY: x - c.current.startY,
|
|
2724
|
+
button: c.current.currentButton,
|
|
2699
2725
|
altKey: p,
|
|
2700
|
-
shiftKey:
|
|
2726
|
+
shiftKey: w,
|
|
2701
2727
|
ctrlKey: m,
|
|
2702
2728
|
metaKey: S,
|
|
2703
2729
|
event: y
|
|
2704
2730
|
}), f.current.style.cursor = "auto";
|
|
2705
2731
|
else {
|
|
2706
|
-
const
|
|
2707
|
-
|
|
2708
|
-
clientX:
|
|
2732
|
+
const j = Date.now();
|
|
2733
|
+
c.current.noTap ? c.current.noTap = !1 : c.current.timeStart - j < 300 && oe.add(s, {
|
|
2734
|
+
clientX: C,
|
|
2709
2735
|
clientY: x,
|
|
2710
2736
|
altKey: p,
|
|
2711
|
-
shiftKey:
|
|
2737
|
+
shiftKey: w,
|
|
2712
2738
|
ctrlKey: m,
|
|
2713
2739
|
metaKey: S,
|
|
2714
2740
|
target: O,
|
|
@@ -2728,12 +2754,12 @@ const ne = new An(), Fe = ({
|
|
|
2728
2754
|
onPointerLeave: E,
|
|
2729
2755
|
onPointerCancel: E,
|
|
2730
2756
|
onDoubleClick: (y) => {
|
|
2731
|
-
const { clientX:
|
|
2732
|
-
|
|
2733
|
-
clientX:
|
|
2757
|
+
const { clientX: C, clientY: x, altKey: p, shiftKey: w, ctrlKey: m, metaKey: S, target: O } = y;
|
|
2758
|
+
oe.add(u, {
|
|
2759
|
+
clientX: C,
|
|
2734
2760
|
clientY: x,
|
|
2735
2761
|
altKey: p,
|
|
2736
|
-
shiftKey:
|
|
2762
|
+
shiftKey: w,
|
|
2737
2763
|
ctrlKey: m,
|
|
2738
2764
|
metaKey: S,
|
|
2739
2765
|
target: O,
|
|
@@ -2746,9 +2772,9 @@ const ne = new An(), Fe = ({
|
|
|
2746
2772
|
}
|
|
2747
2773
|
);
|
|
2748
2774
|
}, ot = ({ onResize: e, ...t }) => {
|
|
2749
|
-
const [r] =
|
|
2750
|
-
return /* @__PURE__ */ T(Fe, { onDrag: ({ deltaX: o, deltaY: s, event:
|
|
2751
|
-
|
|
2775
|
+
const [r] = Q((o) => [o.getBoardState]);
|
|
2776
|
+
return /* @__PURE__ */ T(Fe, { onDrag: ({ deltaX: o, deltaY: s, event: a }) => {
|
|
2777
|
+
a.stopPropagation();
|
|
2752
2778
|
const { scale: u } = r();
|
|
2753
2779
|
e({
|
|
2754
2780
|
width: o / u,
|
|
@@ -2756,59 +2782,59 @@ const ne = new An(), Fe = ({
|
|
|
2756
2782
|
});
|
|
2757
2783
|
}, children: /* @__PURE__ */ T("div", { ...t }) });
|
|
2758
2784
|
};
|
|
2759
|
-
let
|
|
2785
|
+
let Yn = { data: "" }, Bn = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || Yn, Nn = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Xn = /\/\*[^]*?\*\/| +/g, Jt = /\n+/g, fe = (e, t) => {
|
|
2760
2786
|
let r = "", n = "", o = "";
|
|
2761
2787
|
for (let s in e) {
|
|
2762
|
-
let
|
|
2763
|
-
s[0] == "@" ? s[1] == "i" ? r = s + " " +
|
|
2788
|
+
let a = e[s];
|
|
2789
|
+
s[0] == "@" ? s[1] == "i" ? r = s + " " + a + ";" : n += s[1] == "f" ? fe(a, s) : s + "{" + fe(a, s[1] == "k" ? "" : t) + "}" : typeof a == "object" ? n += fe(a, t ? t.replace(/([^,])+/g, (u) => s.replace(/(^:.*)|([^,])+/g, (l) => /&/.test(l) ? l.replace(/&/g, u) : u ? u + " " + l : l)) : s) : a != null && (s = /^--/.test(s) ? s : s.replace(/[A-Z]/g, "-$&").toLowerCase(), o += fe.p ? fe.p(s, a) : s + ":" + a + ";");
|
|
2764
2790
|
}
|
|
2765
2791
|
return r + (t && o ? t + "{" + o + "}" : o) + n;
|
|
2766
|
-
}, ae = {},
|
|
2792
|
+
}, ae = {}, pr = (e) => {
|
|
2767
2793
|
if (typeof e == "object") {
|
|
2768
2794
|
let t = "";
|
|
2769
2795
|
for (let r in e)
|
|
2770
|
-
t += r +
|
|
2796
|
+
t += r + pr(e[r]);
|
|
2771
2797
|
return t;
|
|
2772
2798
|
}
|
|
2773
2799
|
return e;
|
|
2774
|
-
},
|
|
2775
|
-
let s =
|
|
2800
|
+
}, Un = (e, t, r, n, o) => {
|
|
2801
|
+
let s = pr(e), a = ae[s] || (ae[s] = ((l) => {
|
|
2776
2802
|
let d = 0, f = 11;
|
|
2777
2803
|
for (; d < l.length; )
|
|
2778
2804
|
f = 101 * f + l.charCodeAt(d++) >>> 0;
|
|
2779
2805
|
return "go" + f;
|
|
2780
2806
|
})(s));
|
|
2781
|
-
if (!ae[
|
|
2807
|
+
if (!ae[a]) {
|
|
2782
2808
|
let l = s !== e ? e : ((d) => {
|
|
2783
|
-
let f,
|
|
2784
|
-
for (; f =
|
|
2785
|
-
f[4] ? h.shift() : f[3] ? (
|
|
2809
|
+
let f, c, h = [{}];
|
|
2810
|
+
for (; f = Nn.exec(d.replace(Xn, "")); )
|
|
2811
|
+
f[4] ? h.shift() : f[3] ? (c = f[3].replace(Jt, " ").trim(), h.unshift(h[0][c] = h[0][c] || {})) : h[0][f[1]] = f[2].replace(Jt, " ").trim();
|
|
2786
2812
|
return h[0];
|
|
2787
2813
|
})(e);
|
|
2788
|
-
ae[
|
|
2814
|
+
ae[a] = fe(o ? { ["@keyframes " + a]: l } : l, r ? "" : "." + a);
|
|
2789
2815
|
}
|
|
2790
2816
|
let u = r && ae.g ? ae.g : null;
|
|
2791
|
-
return r && (ae.g = ae[
|
|
2792
|
-
|
|
2793
|
-
})(ae[
|
|
2794
|
-
},
|
|
2795
|
-
let
|
|
2796
|
-
if (
|
|
2797
|
-
let u =
|
|
2798
|
-
|
|
2817
|
+
return r && (ae.g = ae[a]), ((l, d, f, c) => {
|
|
2818
|
+
c ? d.data = d.data.replace(c, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2819
|
+
})(ae[a], t, n, u), a;
|
|
2820
|
+
}, Wn = (e, t, r) => e.reduce((n, o, s) => {
|
|
2821
|
+
let a = t[s];
|
|
2822
|
+
if (a && a.call) {
|
|
2823
|
+
let u = a(r), l = u && u.props && u.props.className || /^go/.test(u) && u;
|
|
2824
|
+
a = l ? "." + l : u && typeof u == "object" ? u.props ? "" : fe(u, "") : u === !1 ? "" : u;
|
|
2799
2825
|
}
|
|
2800
|
-
return n + o + (
|
|
2826
|
+
return n + o + (a ?? "");
|
|
2801
2827
|
}, "");
|
|
2802
|
-
function
|
|
2828
|
+
function K(e) {
|
|
2803
2829
|
let t = this || {}, r = e.call ? e(t.p) : e;
|
|
2804
|
-
return
|
|
2830
|
+
return Un(r.unshift ? r.raw ? Wn(r, [].slice.call(arguments, 1), t.p) : r.reduce((n, o) => Object.assign(n, o && o.call ? o(t.p) : o), {}) : r, Bn(t.target), t.g, t.o, t.k);
|
|
2805
2831
|
}
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
function
|
|
2832
|
+
K.bind({ g: 1 });
|
|
2833
|
+
K.bind({ k: 1 });
|
|
2834
|
+
function Vn(e, t, r, n) {
|
|
2809
2835
|
fe.p = t;
|
|
2810
2836
|
}
|
|
2811
|
-
var
|
|
2837
|
+
var Fn = function e(t, r) {
|
|
2812
2838
|
if (t === r)
|
|
2813
2839
|
return !0;
|
|
2814
2840
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
@@ -2835,44 +2861,44 @@ var Wn = function e(t, r) {
|
|
|
2835
2861
|
if (!Object.prototype.hasOwnProperty.call(r, s[o]))
|
|
2836
2862
|
return !1;
|
|
2837
2863
|
for (o = n; o-- !== 0; ) {
|
|
2838
|
-
var
|
|
2839
|
-
if (!e(t[
|
|
2864
|
+
var a = s[o];
|
|
2865
|
+
if (!e(t[a], r[a]))
|
|
2840
2866
|
return !1;
|
|
2841
2867
|
}
|
|
2842
2868
|
return !0;
|
|
2843
2869
|
}
|
|
2844
2870
|
return t !== t && r !== r;
|
|
2845
2871
|
};
|
|
2846
|
-
const
|
|
2872
|
+
const Kn = K`
|
|
2847
2873
|
display: inline-block;
|
|
2848
2874
|
transition: transform 150ms;
|
|
2849
2875
|
user-select: none;
|
|
2850
2876
|
padding: 2px;
|
|
2851
2877
|
box-sizing: border-box;
|
|
2852
|
-
`,
|
|
2878
|
+
`, Hn = K`
|
|
2853
2879
|
border: 2px dashed #db5034;
|
|
2854
2880
|
padding: 0px;
|
|
2855
2881
|
cursor: pointer;
|
|
2856
|
-
`,
|
|
2882
|
+
`, Ce = K`
|
|
2857
2883
|
position: absolute;
|
|
2858
2884
|
width: 0px;
|
|
2859
2885
|
height: 0px;
|
|
2860
|
-
`,
|
|
2886
|
+
`, qn = K`
|
|
2861
2887
|
top: 0;
|
|
2862
2888
|
left: 0;
|
|
2863
|
-
`,
|
|
2889
|
+
`, Gn = K`
|
|
2864
2890
|
top: 0;
|
|
2865
2891
|
right: 0;
|
|
2866
|
-
`,
|
|
2892
|
+
`, Jn = K`
|
|
2867
2893
|
bottom: 0;
|
|
2868
2894
|
left: 0;
|
|
2869
|
-
`,
|
|
2895
|
+
`, Zn = K`
|
|
2870
2896
|
bottom: 0;
|
|
2871
2897
|
right: 0;
|
|
2872
|
-
`,
|
|
2898
|
+
`, Qn = K`
|
|
2873
2899
|
top: 50%;
|
|
2874
2900
|
left: 50%;
|
|
2875
|
-
`, st =
|
|
2901
|
+
`, st = K`
|
|
2876
2902
|
position: absolute;
|
|
2877
2903
|
|
|
2878
2904
|
width: 10px;
|
|
@@ -2880,22 +2906,22 @@ const Vn = H`
|
|
|
2880
2906
|
border: 2px solid #db5034;
|
|
2881
2907
|
background-color: #db5034;
|
|
2882
2908
|
cursor: move;
|
|
2883
|
-
`,
|
|
2909
|
+
`, eo = K`
|
|
2884
2910
|
cursor: ew-resize;
|
|
2885
2911
|
right: -6px;
|
|
2886
2912
|
top: calc(50% - 5px);
|
|
2887
|
-
`,
|
|
2913
|
+
`, to = K`
|
|
2888
2914
|
cursor: ns-resize;
|
|
2889
2915
|
bottom: -6px;
|
|
2890
2916
|
left: calc(50% - 5px);
|
|
2891
|
-
`,
|
|
2917
|
+
`, ro = K`
|
|
2892
2918
|
cursor: nwse-resize;
|
|
2893
2919
|
bottom: -6px;
|
|
2894
2920
|
right: -6px;
|
|
2895
|
-
`,
|
|
2921
|
+
`, no = ({ onReload: e }) => /* @__PURE__ */ ue(
|
|
2896
2922
|
"div",
|
|
2897
2923
|
{
|
|
2898
|
-
className: `syncboard-error-item ${
|
|
2924
|
+
className: `syncboard-error-item ${K({
|
|
2899
2925
|
width: "100px",
|
|
2900
2926
|
display: "flex",
|
|
2901
2927
|
flexDirection: "column",
|
|
@@ -2909,7 +2935,7 @@ const Vn = H`
|
|
|
2909
2935
|
]
|
|
2910
2936
|
}
|
|
2911
2937
|
);
|
|
2912
|
-
class
|
|
2938
|
+
class oo extends g.Component {
|
|
2913
2939
|
constructor(t) {
|
|
2914
2940
|
super(t), this.state = { hasError: !1, itemId: t.itemId }, this.onReload = this.onReload.bind(this);
|
|
2915
2941
|
}
|
|
@@ -2931,9 +2957,9 @@ class ro extends g.Component {
|
|
|
2931
2957
|
return this.state.hasError ? /* @__PURE__ */ T(t, { onReload: this.onReload }) : this.props.children;
|
|
2932
2958
|
}
|
|
2933
2959
|
}
|
|
2934
|
-
const
|
|
2960
|
+
const so = (e) => {
|
|
2935
2961
|
e.target.className = "";
|
|
2936
|
-
},
|
|
2962
|
+
}, io = ({
|
|
2937
2963
|
width: e,
|
|
2938
2964
|
height: t,
|
|
2939
2965
|
actualWidth: r,
|
|
@@ -2941,54 +2967,54 @@ const no = (e) => {
|
|
|
2941
2967
|
prevState: o,
|
|
2942
2968
|
keepRatio: s
|
|
2943
2969
|
}) => {
|
|
2944
|
-
let { width:
|
|
2945
|
-
if ([
|
|
2946
|
-
parseFloat(
|
|
2970
|
+
let { width: a, height: u } = o;
|
|
2971
|
+
if ([a, u] = [
|
|
2972
|
+
parseFloat(a),
|
|
2947
2973
|
parseFloat(u)
|
|
2948
|
-
], (!
|
|
2949
|
-
const l =
|
|
2974
|
+
], (!a || Number.isNaN(Number(a))) && (a = r), (!u || Number.isNaN(Number(u))) && (u = n), s) {
|
|
2975
|
+
const l = a / u;
|
|
2950
2976
|
return {
|
|
2951
2977
|
...o,
|
|
2952
|
-
width: (
|
|
2978
|
+
width: (a + e).toFixed(1),
|
|
2953
2979
|
height: (u + t / l).toFixed(1)
|
|
2954
2980
|
};
|
|
2955
2981
|
}
|
|
2956
2982
|
return {
|
|
2957
2983
|
...o,
|
|
2958
|
-
width: (
|
|
2984
|
+
width: (a + e).toFixed(1),
|
|
2959
2985
|
height: (u + t).toFixed(1)
|
|
2960
2986
|
};
|
|
2961
|
-
},
|
|
2987
|
+
}, ao = {
|
|
2962
2988
|
w: !0,
|
|
2963
2989
|
h: !0,
|
|
2964
2990
|
b: !0
|
|
2965
|
-
},
|
|
2991
|
+
}, co = ({
|
|
2966
2992
|
setState: e,
|
|
2967
|
-
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...
|
|
2993
|
+
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...a } = {},
|
|
2968
2994
|
animate: u = "hvr-pop",
|
|
2969
2995
|
isSelected: l,
|
|
2970
2996
|
itemMap: d,
|
|
2971
2997
|
showResizeHandle: f = !0
|
|
2972
2998
|
}) => {
|
|
2973
2999
|
var m;
|
|
2974
|
-
const
|
|
3000
|
+
const c = g.useRef(null), {
|
|
2975
3001
|
component: h = () => null,
|
|
2976
|
-
resizeDirections: _ =
|
|
2977
|
-
resize: v =
|
|
3002
|
+
resizeDirections: _ = ao,
|
|
3003
|
+
resize: v = io
|
|
2978
3004
|
} = d[t], E = g.useCallback(
|
|
2979
|
-
(S) => e(n, S),
|
|
3005
|
+
(S, O = !1) => e(n, S, O),
|
|
2980
3006
|
[e, n]
|
|
2981
3007
|
);
|
|
2982
3008
|
g.useEffect(() => {
|
|
2983
|
-
|
|
3009
|
+
c.current.className = u;
|
|
2984
3010
|
}, [u]);
|
|
2985
|
-
const I = ["item", n,
|
|
2986
|
-
o && I.push("locked"), l && (I.push("selected"), I.push(
|
|
2987
|
-
const y = I.join(" "),
|
|
2988
|
-
E((
|
|
2989
|
-
const { offsetWidth: M, offsetHeight: L } =
|
|
3011
|
+
const I = ["item", n, Kn];
|
|
3012
|
+
o && I.push("locked"), l && (I.push("selected"), I.push(Hn));
|
|
3013
|
+
const y = I.join(" "), C = ({ width: S = 0, height: O = 0, keepRatio: k }) => {
|
|
3014
|
+
E((j) => {
|
|
3015
|
+
const { offsetWidth: M, offsetHeight: L } = c.current;
|
|
2990
3016
|
return v({
|
|
2991
|
-
prevState:
|
|
3017
|
+
prevState: j,
|
|
2992
3018
|
width: S,
|
|
2993
3019
|
height: O,
|
|
2994
3020
|
actualHeight: L,
|
|
@@ -2997,11 +3023,11 @@ const no = (e) => {
|
|
|
2997
3023
|
});
|
|
2998
3024
|
});
|
|
2999
3025
|
}, x = ({ width: S }) => {
|
|
3000
|
-
|
|
3026
|
+
C({ width: S });
|
|
3001
3027
|
}, p = ({ height: S }) => {
|
|
3002
|
-
|
|
3003
|
-
},
|
|
3004
|
-
|
|
3028
|
+
C({ height: S });
|
|
3029
|
+
}, w = ({ width: S }) => {
|
|
3030
|
+
C({ height: S, width: S, keepRatio: !0 });
|
|
3005
3031
|
};
|
|
3006
3032
|
return /* @__PURE__ */ T(
|
|
3007
3033
|
"div",
|
|
@@ -3013,44 +3039,44 @@ const no = (e) => {
|
|
|
3013
3039
|
"div",
|
|
3014
3040
|
{
|
|
3015
3041
|
style: { display: "flex" },
|
|
3016
|
-
ref:
|
|
3017
|
-
onAnimationEnd:
|
|
3042
|
+
ref: c,
|
|
3043
|
+
onAnimationEnd: so,
|
|
3018
3044
|
onKeyDown: (S) => S.stopPropagation(),
|
|
3019
3045
|
onKeyUp: (S) => S.stopPropagation(),
|
|
3020
3046
|
children: [
|
|
3021
3047
|
/* @__PURE__ */ T(
|
|
3022
|
-
|
|
3048
|
+
oo,
|
|
3023
3049
|
{
|
|
3024
3050
|
itemId: n,
|
|
3025
|
-
state:
|
|
3026
|
-
ErrorComponent: ((m = d == null ? void 0 : d.error) == null ? void 0 : m.component) ||
|
|
3027
|
-
children: /* @__PURE__ */ T(h, { ...
|
|
3051
|
+
state: a,
|
|
3052
|
+
ErrorComponent: ((m = d == null ? void 0 : d.error) == null ? void 0 : m.component) || no,
|
|
3053
|
+
children: /* @__PURE__ */ T(h, { ...a, id: n, setState: E })
|
|
3028
3054
|
}
|
|
3029
3055
|
),
|
|
3030
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3031
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3032
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3033
|
-
/* @__PURE__ */ T("div", { className: `corner ${
|
|
3034
|
-
/* @__PURE__ */ T("div", { className: `center ${
|
|
3035
|
-
f && /* @__PURE__ */ ue(
|
|
3056
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${qn}` }),
|
|
3057
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${Gn}` }),
|
|
3058
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${Zn}` }),
|
|
3059
|
+
/* @__PURE__ */ T("div", { className: `corner ${Ce} ${Jn}` }),
|
|
3060
|
+
/* @__PURE__ */ T("div", { className: `center ${Ce} ${Qn}` }),
|
|
3061
|
+
f && /* @__PURE__ */ ue(Wr, { children: [
|
|
3036
3062
|
_.b && /* @__PURE__ */ T(
|
|
3037
3063
|
ot,
|
|
3038
3064
|
{
|
|
3039
|
-
className: `${st} ${
|
|
3040
|
-
onResize:
|
|
3065
|
+
className: `${st} ${ro}`,
|
|
3066
|
+
onResize: w
|
|
3041
3067
|
}
|
|
3042
3068
|
),
|
|
3043
3069
|
_.h && /* @__PURE__ */ T(
|
|
3044
3070
|
ot,
|
|
3045
3071
|
{
|
|
3046
|
-
className: `${st} ${
|
|
3072
|
+
className: `${st} ${to}`,
|
|
3047
3073
|
onResize: p
|
|
3048
3074
|
}
|
|
3049
3075
|
),
|
|
3050
3076
|
_.w && /* @__PURE__ */ T(
|
|
3051
3077
|
ot,
|
|
3052
3078
|
{
|
|
3053
|
-
className: `${st} ${
|
|
3079
|
+
className: `${st} ${eo}`,
|
|
3054
3080
|
onResize: x
|
|
3055
3081
|
}
|
|
3056
3082
|
)
|
|
@@ -3060,8 +3086,8 @@ const no = (e) => {
|
|
|
3060
3086
|
)
|
|
3061
3087
|
}
|
|
3062
3088
|
);
|
|
3063
|
-
},
|
|
3064
|
-
|
|
3089
|
+
}, uo = rr(
|
|
3090
|
+
co,
|
|
3065
3091
|
({
|
|
3066
3092
|
state: e,
|
|
3067
3093
|
setState: t,
|
|
@@ -3070,15 +3096,15 @@ const no = (e) => {
|
|
|
3070
3096
|
}, {
|
|
3071
3097
|
state: o,
|
|
3072
3098
|
setState: s,
|
|
3073
|
-
isSelected:
|
|
3099
|
+
isSelected: a,
|
|
3074
3100
|
showResizeHandle: u
|
|
3075
|
-
}) => r ===
|
|
3076
|
-
),
|
|
3101
|
+
}) => r === a && n === u && t === s && Fn(e, o)
|
|
3102
|
+
), lo = (e) => e, fo = ({ state: e = {}, getCurrentUser: t, className: r, ...n }) => {
|
|
3077
3103
|
if (!n.itemMap[e.type])
|
|
3078
3104
|
return null;
|
|
3079
|
-
const { stateHook: o =
|
|
3105
|
+
const { stateHook: o = lo } = n.itemMap[e.type], {
|
|
3080
3106
|
x: s = 0,
|
|
3081
|
-
y:
|
|
3107
|
+
y: a = 0,
|
|
3082
3108
|
layer: u = 0,
|
|
3083
3109
|
moving: l,
|
|
3084
3110
|
...d
|
|
@@ -3088,11 +3114,11 @@ const no = (e) => {
|
|
|
3088
3114
|
{
|
|
3089
3115
|
className: r,
|
|
3090
3116
|
style: {
|
|
3091
|
-
transform: `translate(${s}px, ${
|
|
3117
|
+
transform: `translate(${s}px, ${a}px)`,
|
|
3092
3118
|
zIndex: f
|
|
3093
3119
|
},
|
|
3094
3120
|
children: /* @__PURE__ */ T(
|
|
3095
|
-
|
|
3121
|
+
uo,
|
|
3096
3122
|
{
|
|
3097
3123
|
...n,
|
|
3098
3124
|
showResizeHandle: n.isSelected && n.showResizeHandle,
|
|
@@ -3101,29 +3127,30 @@ const no = (e) => {
|
|
|
3101
3127
|
)
|
|
3102
3128
|
}
|
|
3103
3129
|
);
|
|
3104
|
-
},
|
|
3105
|
-
const { updateItem: e } = gt(), [t, r] =
|
|
3130
|
+
}, po = rr(fo), mo = () => {
|
|
3131
|
+
const { updateItem: e } = gt(), [t, r] = ne((d) => [
|
|
3106
3132
|
d.itemIds,
|
|
3107
3133
|
d.items
|
|
3108
|
-
]), [n, o, s,
|
|
3134
|
+
]), [n, o, s, a] = Q(
|
|
3109
3135
|
(d) => [
|
|
3110
3136
|
d.config.boardSize,
|
|
3111
3137
|
d.config.showResizeHandle,
|
|
3112
3138
|
d.config.itemTemplates,
|
|
3113
3139
|
d.selection
|
|
3114
3140
|
]
|
|
3115
|
-
), [u] = Se((d) => [d.getUser]), l =
|
|
3141
|
+
), [u] = Se((d) => [d.getUser]), l = K({
|
|
3116
3142
|
position: "absolute",
|
|
3117
3143
|
top: `${n / 2}px`,
|
|
3118
3144
|
left: `${n / 2}px`,
|
|
3119
|
-
display: "inline-block"
|
|
3145
|
+
display: "inline-block",
|
|
3146
|
+
lineHeight: 0
|
|
3120
3147
|
});
|
|
3121
3148
|
return t.map((d) => /* @__PURE__ */ T(
|
|
3122
|
-
|
|
3149
|
+
po,
|
|
3123
3150
|
{
|
|
3124
3151
|
state: r[d],
|
|
3125
3152
|
setState: e,
|
|
3126
|
-
isSelected:
|
|
3153
|
+
isSelected: a.includes(d),
|
|
3127
3154
|
itemMap: s,
|
|
3128
3155
|
boardSize: n,
|
|
3129
3156
|
getCurrentUser: u,
|
|
@@ -3133,21 +3160,21 @@ const no = (e) => {
|
|
|
3133
3160
|
d
|
|
3134
3161
|
));
|
|
3135
3162
|
};
|
|
3136
|
-
function
|
|
3137
|
-
const t = Re(e), r =
|
|
3163
|
+
function go(e = !1) {
|
|
3164
|
+
const t = Re(e), r = tr(() => t.current, []);
|
|
3138
3165
|
return Pe(() => (t.current = !0, () => {
|
|
3139
3166
|
t.current = !1;
|
|
3140
3167
|
}), []), r;
|
|
3141
3168
|
}
|
|
3142
|
-
function
|
|
3169
|
+
function ho(e, ...t) {
|
|
3143
3170
|
e && e.addEventListener && e.addEventListener(...t);
|
|
3144
3171
|
}
|
|
3145
|
-
function
|
|
3172
|
+
function vo(e, ...t) {
|
|
3146
3173
|
e && e.removeEventListener && e.removeEventListener(...t);
|
|
3147
3174
|
}
|
|
3148
|
-
const
|
|
3175
|
+
const yo = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
3149
3176
|
function ce(e, ...t) {
|
|
3150
|
-
const r =
|
|
3177
|
+
const r = go(), n = pt(t[1]), o = lt(
|
|
3151
3178
|
() => (
|
|
3152
3179
|
// as some event listeners designed to be used through `this`
|
|
3153
3180
|
// it is better to make listener a conventional function as it
|
|
@@ -3161,36 +3188,36 @@ function ce(e, ...t) {
|
|
|
3161
3188
|
[]
|
|
3162
3189
|
);
|
|
3163
3190
|
Pe(() => {
|
|
3164
|
-
const s = e &&
|
|
3191
|
+
const s = e && yo(e, "current") ? e.current : e;
|
|
3165
3192
|
if (!s)
|
|
3166
3193
|
return;
|
|
3167
|
-
const
|
|
3168
|
-
return
|
|
3194
|
+
const a = t.slice(2);
|
|
3195
|
+
return ho(s, t[0], o, ...a), () => vo(s, t[0], o, ...a);
|
|
3169
3196
|
}, [e, t[0]]);
|
|
3170
3197
|
}
|
|
3171
|
-
const
|
|
3198
|
+
const So = K({
|
|
3172
3199
|
zIndex: 210,
|
|
3173
3200
|
position: "absolute",
|
|
3174
3201
|
backgroundColor: "hsla(0, 40%, 50%, 10%)",
|
|
3175
3202
|
border: "2px solid hsl(0, 55%, 40%)"
|
|
3176
|
-
}),
|
|
3203
|
+
}), _o = (e, t, r = !1) => {
|
|
3177
3204
|
const n = t.getElementsByClassName("selector");
|
|
3178
3205
|
if (!n.length)
|
|
3179
3206
|
return [];
|
|
3180
3207
|
const o = n[0];
|
|
3181
3208
|
return Array.from(t.getElementsByClassName("item")).filter((s) => {
|
|
3182
|
-
const
|
|
3183
|
-
return !u || !r && u.locked ? !1 :
|
|
3209
|
+
const a = Te(s), u = e[a];
|
|
3210
|
+
return !u || !r && u.locked ? !1 : on(s, o);
|
|
3184
3211
|
}).map((s) => Te(s));
|
|
3185
|
-
},
|
|
3212
|
+
}, bo = ({ children: e, moveFirst: t }) => {
|
|
3186
3213
|
const [
|
|
3187
3214
|
r,
|
|
3188
3215
|
n,
|
|
3189
3216
|
o,
|
|
3190
3217
|
s,
|
|
3191
|
-
|
|
3218
|
+
a,
|
|
3192
3219
|
u
|
|
3193
|
-
] =
|
|
3220
|
+
] = Q((m) => [
|
|
3194
3221
|
m.getSelection,
|
|
3195
3222
|
m.clear,
|
|
3196
3223
|
m.setSelection,
|
|
@@ -3198,7 +3225,7 @@ const vo = H({
|
|
|
3198
3225
|
m.getConfiguration,
|
|
3199
3226
|
m.getBoardState,
|
|
3200
3227
|
m.updateBoardState
|
|
3201
|
-
]), { findElementUnderPointer: l } = gt(), [d] =
|
|
3228
|
+
]), { findElementUnderPointer: l } = gt(), [d] = ne((m) => [m.getItems]), [f, c] = g.useState({}), [, h] = g.useTransition(), [_, v] = g.useState(!1), E = g.useRef(null), I = g.useRef({
|
|
3202
3229
|
moving: !1
|
|
3203
3230
|
});
|
|
3204
3231
|
return ce(document, "keydown", (m) => {
|
|
@@ -3209,12 +3236,12 @@ const vo = H({
|
|
|
3209
3236
|
n();
|
|
3210
3237
|
}), [n]), g.useEffect(() => {
|
|
3211
3238
|
if (I.current.moving) {
|
|
3212
|
-
const m = d(), { boardWrapper: S } =
|
|
3239
|
+
const m = d(), { boardWrapper: S } = a(), O = _o(m, S, _);
|
|
3213
3240
|
h(() => {
|
|
3214
3241
|
o(O);
|
|
3215
3242
|
});
|
|
3216
3243
|
}
|
|
3217
|
-
}, [
|
|
3244
|
+
}, [a, d, f, o, _]), /* @__PURE__ */ T(
|
|
3218
3245
|
Fe,
|
|
3219
3246
|
{
|
|
3220
3247
|
onDragStart: async (m) => {
|
|
@@ -3224,27 +3251,27 @@ const vo = H({
|
|
|
3224
3251
|
},
|
|
3225
3252
|
onDrag: ({ distanceY: m, distanceX: S, startX: O, startY: k }) => {
|
|
3226
3253
|
if (I.current.moving) {
|
|
3227
|
-
const { top:
|
|
3228
|
-
S > 0 ? (I.current.left = L, I.current.width = S) : (I.current.left = L + S, I.current.width = -S), m > 0 ? (I.current.top = N, I.current.height = m) : (I.current.top = N + m, I.current.height = -m),
|
|
3254
|
+
const { top: j, left: M } = E.current.getBoundingClientRect(), L = O - M, N = k - j;
|
|
3255
|
+
S > 0 ? (I.current.left = L, I.current.width = S) : (I.current.left = L + S, I.current.width = -S), m > 0 ? (I.current.top = N, I.current.height = m) : (I.current.top = N + m, I.current.height = -m), c({ ...I.current, moving: !0 });
|
|
3229
3256
|
}
|
|
3230
3257
|
},
|
|
3231
3258
|
onDragEnd: () => {
|
|
3232
3259
|
I.current.moving && (h(() => {
|
|
3233
3260
|
u({ selecting: !1 });
|
|
3234
|
-
}), I.current.moving = !1,
|
|
3261
|
+
}), I.current.moving = !1, c({ moving: !1 }), E.current.style.cursor = "auto");
|
|
3235
3262
|
},
|
|
3236
3263
|
onTap: (m) => {
|
|
3237
|
-
const { target: S, ctrlKey: O, metaKey: k } = m,
|
|
3238
|
-
if (!
|
|
3264
|
+
const { target: S, ctrlKey: O, metaKey: k } = m, j = l(m);
|
|
3265
|
+
if (!j && Oe(S, "board"))
|
|
3239
3266
|
n();
|
|
3240
3267
|
else {
|
|
3241
|
-
const M = Te(
|
|
3268
|
+
const M = Te(j);
|
|
3242
3269
|
if (!M) {
|
|
3243
3270
|
n();
|
|
3244
3271
|
return;
|
|
3245
3272
|
}
|
|
3246
3273
|
const L = r();
|
|
3247
|
-
|
|
3274
|
+
j && !L.includes(M) && (O || k ? s([M]) : o([M]));
|
|
3248
3275
|
}
|
|
3249
3276
|
},
|
|
3250
3277
|
onLongTap: ({ target: m }) => {
|
|
@@ -3264,62 +3291,62 @@ const vo = H({
|
|
|
3264
3291
|
height: `${f.height}px`,
|
|
3265
3292
|
width: `${f.width}px`
|
|
3266
3293
|
},
|
|
3267
|
-
className: `selector ${
|
|
3294
|
+
className: `selector ${So}`
|
|
3268
3295
|
}
|
|
3269
3296
|
),
|
|
3270
3297
|
e
|
|
3271
3298
|
] })
|
|
3272
3299
|
}
|
|
3273
3300
|
);
|
|
3274
|
-
},
|
|
3275
|
-
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = gt(), { vectorFromWrapperToBoard: o } = Me(), [s,
|
|
3301
|
+
}, Eo = ({ children: e }) => {
|
|
3302
|
+
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = gt(), { vectorFromWrapperToBoard: o } = Me(), [s, a, u, l, d] = Q((y) => [
|
|
3276
3303
|
y.select,
|
|
3277
3304
|
y.setSelection,
|
|
3278
3305
|
y.getSelection,
|
|
3279
3306
|
y.getBoardState,
|
|
3280
3307
|
y.updateBoardState
|
|
3281
|
-
]), [f] =
|
|
3308
|
+
]), [f] = ne((y) => [y.getBoardConfig]), c = g.useRef({}), h = g.useRef({
|
|
3282
3309
|
items: []
|
|
3283
3310
|
}), _ = (y) => {
|
|
3284
|
-
const { ctrlKey:
|
|
3285
|
-
if (
|
|
3311
|
+
const { ctrlKey: C, metaKey: x, event: p } = y, w = n(y);
|
|
3312
|
+
if (w) {
|
|
3286
3313
|
p.stopPropagation();
|
|
3287
3314
|
const m = u();
|
|
3288
3315
|
h.current.items = m;
|
|
3289
|
-
const S = Te(
|
|
3290
|
-
m.includes(S) || (
|
|
3316
|
+
const S = Te(w);
|
|
3317
|
+
m.includes(S) || (C || x ? (h.current.items = [...m, S], s([S])) : (h.current.items = [S], a([S]))), Object.assign(c.current, {
|
|
3291
3318
|
moving: !0
|
|
3292
3319
|
});
|
|
3293
3320
|
}
|
|
3294
|
-
}, v = ({ deltaX: y, deltaY:
|
|
3295
|
-
if (
|
|
3321
|
+
}, v = ({ deltaX: y, deltaY: C, event: x }) => {
|
|
3322
|
+
if (c.current.moving) {
|
|
3296
3323
|
x.stopPropagation();
|
|
3297
|
-
const { movingItems: p } = l(), [
|
|
3324
|
+
const { movingItems: p } = l(), [w, m] = o(y, C);
|
|
3298
3325
|
t(
|
|
3299
3326
|
h.current.items,
|
|
3300
3327
|
{
|
|
3301
|
-
x:
|
|
3328
|
+
x: w,
|
|
3302
3329
|
y: m
|
|
3303
3330
|
},
|
|
3304
3331
|
!0
|
|
3305
3332
|
), p || d({ movingItems: !0 });
|
|
3306
3333
|
}
|
|
3307
3334
|
}, E = () => {
|
|
3308
|
-
if (
|
|
3309
|
-
const { gridSize: y = 1 } = f(),
|
|
3310
|
-
|
|
3335
|
+
if (c.current.moving) {
|
|
3336
|
+
const { gridSize: y = 1 } = f(), C = y || 1;
|
|
3337
|
+
c.current = { moving: !1 }, r(h.current.items, {
|
|
3311
3338
|
type: "grid",
|
|
3312
|
-
size:
|
|
3339
|
+
size: C
|
|
3313
3340
|
}), d({ movingItems: !1 });
|
|
3314
3341
|
}
|
|
3315
3342
|
};
|
|
3316
3343
|
return ce(document, "keydown", (y) => {
|
|
3317
3344
|
if (["INPUT", "TEXTAREA"].includes(y.target.tagName))
|
|
3318
3345
|
return;
|
|
3319
|
-
const
|
|
3320
|
-
if (
|
|
3346
|
+
const C = u();
|
|
3347
|
+
if (C.length) {
|
|
3321
3348
|
const { gridSize: x = 1 } = f();
|
|
3322
|
-
let p = 0,
|
|
3349
|
+
let p = 0, w = 0;
|
|
3323
3350
|
switch (y.key) {
|
|
3324
3351
|
case "ArrowLeft":
|
|
3325
3352
|
p = -10;
|
|
@@ -3328,30 +3355,30 @@ const vo = H({
|
|
|
3328
3355
|
p = 10;
|
|
3329
3356
|
break;
|
|
3330
3357
|
case "ArrowUp":
|
|
3331
|
-
|
|
3358
|
+
w = -10;
|
|
3332
3359
|
break;
|
|
3333
3360
|
case "ArrowDown":
|
|
3334
|
-
|
|
3361
|
+
w = 10;
|
|
3335
3362
|
break;
|
|
3336
3363
|
}
|
|
3337
|
-
if (p ||
|
|
3338
|
-
y.shiftKey && (p *= 5,
|
|
3339
|
-
const [m, S] = o(p,
|
|
3364
|
+
if (p || w) {
|
|
3365
|
+
y.shiftKey && (p *= 5, w *= 5), (y.ctrlKey || y.altKey || y.metaKey) && (p /= 10, w /= 10);
|
|
3366
|
+
const [m, S] = o(p, w);
|
|
3340
3367
|
t(
|
|
3341
|
-
|
|
3368
|
+
C,
|
|
3342
3369
|
{
|
|
3343
3370
|
x: m,
|
|
3344
3371
|
y: S
|
|
3345
3372
|
},
|
|
3346
3373
|
!0
|
|
3347
|
-
), r(
|
|
3374
|
+
), r(C, {
|
|
3348
3375
|
type: "grid",
|
|
3349
3376
|
size: x || 1
|
|
3350
3377
|
}), y.preventDefault();
|
|
3351
3378
|
}
|
|
3352
3379
|
}
|
|
3353
3380
|
}), /* @__PURE__ */ T(Fe, { onDragStart: _, onDrag: v, onDragEnd: E, children: e });
|
|
3354
|
-
},
|
|
3381
|
+
}, wo = (e) => {
|
|
3355
3382
|
const t = g.useRef({ hover: !1, x: 0, y: 0 });
|
|
3356
3383
|
return ce(e.current, "mousemove", (n) => {
|
|
3357
3384
|
const { clientX: o, clientY: s } = n;
|
|
@@ -3361,28 +3388,28 @@ const vo = H({
|
|
|
3361
3388
|
}), ce(e.current, "mouseleave", () => {
|
|
3362
3389
|
t.current.hover = !1;
|
|
3363
3390
|
}), g.useCallback(() => t.current, []);
|
|
3364
|
-
},
|
|
3365
|
-
const [e, t] = g.useState({}), [r, n] =
|
|
3391
|
+
}, Co = [...Array(5).keys()].map((e) => `Digit${e + 1}`), xo = () => {
|
|
3392
|
+
const [e, t] = g.useState({}), [r, n] = Q((o) => [
|
|
3366
3393
|
o.getBoardState,
|
|
3367
3394
|
o.updateBoardState
|
|
3368
3395
|
]);
|
|
3369
3396
|
return ce(document, "keydown", (o) => {
|
|
3370
|
-
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) &&
|
|
3371
|
-
const s = o.code, { translateX:
|
|
3397
|
+
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) && Co.includes(o.code)) {
|
|
3398
|
+
const s = o.code, { translateX: a, translateY: u, scale: l } = r();
|
|
3372
3399
|
o.altKey || o.metaKey || o.ctrlKey || o.shiftKey ? t((d) => ({
|
|
3373
3400
|
...d,
|
|
3374
|
-
[s]: { translateX:
|
|
3401
|
+
[s]: { translateX: a, translateY: u, scale: l }
|
|
3375
3402
|
})) : e[s] && n(e[s]), o.preventDefault();
|
|
3376
3403
|
}
|
|
3377
3404
|
}), null;
|
|
3378
|
-
},
|
|
3405
|
+
}, Ro = ({ children: e, moveFirst: t = !1 }) => {
|
|
3379
3406
|
const r = g.useRef(null), [
|
|
3380
3407
|
n,
|
|
3381
3408
|
o,
|
|
3382
3409
|
s,
|
|
3383
|
-
|
|
3410
|
+
a,
|
|
3384
3411
|
u
|
|
3385
|
-
] =
|
|
3412
|
+
] = Q((p) => [
|
|
3386
3413
|
{
|
|
3387
3414
|
translateX: p.boardState.translateX,
|
|
3388
3415
|
translateY: p.boardState.translateY,
|
|
@@ -3393,36 +3420,36 @@ const vo = H({
|
|
|
3393
3420
|
p.getConfiguration,
|
|
3394
3421
|
p.updateBoardState,
|
|
3395
3422
|
p.getSelection
|
|
3396
|
-
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [
|
|
3397
|
-
|
|
3423
|
+
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [c, h] = g.useState(!1), _ = g.useRef({}), v = wo(r);
|
|
3424
|
+
xo();
|
|
3398
3425
|
const E = g.useCallback(() => {
|
|
3399
3426
|
const { itemExtent: p } = s();
|
|
3400
3427
|
d(p);
|
|
3401
3428
|
}, [s, d]);
|
|
3402
3429
|
g.useEffect(() => {
|
|
3403
|
-
!
|
|
3404
|
-
}, [E,
|
|
3405
|
-
const I = ({ clientX: p, clientY:
|
|
3406
|
-
l({ to: { x: p, y:
|
|
3407
|
-
|
|
3408
|
-
}, 200),
|
|
3409
|
-
}, y = ({ deltaX: p, deltaY:
|
|
3430
|
+
!c && o.radius && (E(), h(!0));
|
|
3431
|
+
}, [E, c, o]);
|
|
3432
|
+
const I = ({ clientX: p, clientY: w, scale: m }) => {
|
|
3433
|
+
l({ to: { x: p, y: w }, factor: 1 - m / 500 }), clearTimeout(_.current.zoom), _.current.zoom = setTimeout(() => {
|
|
3434
|
+
a({ zooming: !1 });
|
|
3435
|
+
}, 200), a({ zooming: !0 });
|
|
3436
|
+
}, y = ({ deltaX: p, deltaY: w }) => {
|
|
3410
3437
|
f(({ translateX: m, translateY: S }) => ({
|
|
3411
3438
|
translateX: m + p,
|
|
3412
|
-
translateY: S +
|
|
3439
|
+
translateY: S + w
|
|
3413
3440
|
})), clearTimeout(_.current.pan), _.current.pan = setTimeout(() => {
|
|
3414
|
-
|
|
3415
|
-
}, 200),
|
|
3416
|
-
},
|
|
3441
|
+
a({ panning: !1 });
|
|
3442
|
+
}, 200), a({ panning: !0 });
|
|
3443
|
+
}, C = (p) => {
|
|
3417
3444
|
if (["INPUT", "TEXTAREA"].includes(p.target.tagName))
|
|
3418
3445
|
return;
|
|
3419
|
-
let
|
|
3446
|
+
let w = 0, m = 0, S = 1;
|
|
3420
3447
|
switch (p.key) {
|
|
3421
3448
|
case "ArrowLeft":
|
|
3422
|
-
|
|
3449
|
+
w = -10;
|
|
3423
3450
|
break;
|
|
3424
3451
|
case "ArrowRight":
|
|
3425
|
-
|
|
3452
|
+
w = 10;
|
|
3426
3453
|
break;
|
|
3427
3454
|
case "ArrowUp":
|
|
3428
3455
|
m = -10;
|
|
@@ -3437,20 +3464,20 @@ const vo = H({
|
|
|
3437
3464
|
S = 0.8;
|
|
3438
3465
|
break;
|
|
3439
3466
|
}
|
|
3440
|
-
if (
|
|
3467
|
+
if (w || m || S !== 1) {
|
|
3441
3468
|
const O = u();
|
|
3442
3469
|
if (S === 1 && O.length)
|
|
3443
3470
|
return;
|
|
3444
|
-
p.shiftKey && (
|
|
3445
|
-
translateX: k +
|
|
3446
|
-
translateY:
|
|
3471
|
+
p.shiftKey && (w *= 5, m *= 5), (p.ctrlKey || p.altKey || p.metaKey) && (w /= 5, m /= 5), f(({ translateX: k, translateY: j }) => ({
|
|
3472
|
+
translateX: k + w,
|
|
3473
|
+
translateY: j + m
|
|
3447
3474
|
})), l({ factor: S }), p.preventDefault();
|
|
3448
3475
|
}
|
|
3449
3476
|
p.key === " " && !p.repeat && v().hover && l({ factor: 3, to: v() });
|
|
3450
3477
|
}, x = (p) => {
|
|
3451
3478
|
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " && v().hover && l({ factor: 1 / 3, to: v() });
|
|
3452
3479
|
};
|
|
3453
|
-
return ce(document, "keydown",
|
|
3480
|
+
return ce(document, "keydown", C), ce(document, "keyup", x), /* @__PURE__ */ T(
|
|
3454
3481
|
Fe,
|
|
3455
3482
|
{
|
|
3456
3483
|
onPan: y,
|
|
@@ -3471,7 +3498,7 @@ const vo = H({
|
|
|
3471
3498
|
)
|
|
3472
3499
|
}
|
|
3473
3500
|
);
|
|
3474
|
-
},
|
|
3501
|
+
}, Io = K({
|
|
3475
3502
|
position: "absolute",
|
|
3476
3503
|
top: 0,
|
|
3477
3504
|
left: 0,
|
|
@@ -3479,40 +3506,40 @@ const vo = H({
|
|
|
3479
3506
|
backgroundColor: "hsla(0, 40%, 50%, 0%)",
|
|
3480
3507
|
border: "2px dashed hsl(20, 55%, 40%)",
|
|
3481
3508
|
pointerEvents: "none"
|
|
3482
|
-
}),
|
|
3509
|
+
}), Oo = () => {
|
|
3483
3510
|
const [
|
|
3484
3511
|
e,
|
|
3485
3512
|
t,
|
|
3486
3513
|
r,
|
|
3487
3514
|
n,
|
|
3488
3515
|
o,
|
|
3489
|
-
{ translateX: s, translateY:
|
|
3490
|
-
] =
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3516
|
+
{ translateX: s, translateY: a, scale: u }
|
|
3517
|
+
] = Q((c) => [
|
|
3518
|
+
c.selection,
|
|
3519
|
+
c.getSelection,
|
|
3520
|
+
c.selectionBox,
|
|
3521
|
+
c.setSelectionBox,
|
|
3522
|
+
c.getConfiguration,
|
|
3496
3523
|
{
|
|
3497
|
-
translateX:
|
|
3498
|
-
translateY:
|
|
3499
|
-
scale:
|
|
3524
|
+
translateX: c.boardState.translateX,
|
|
3525
|
+
translateY: c.boardState.translateY,
|
|
3526
|
+
scale: c.boardState.scale
|
|
3500
3527
|
}
|
|
3501
|
-
]), [l] =
|
|
3502
|
-
const
|
|
3503
|
-
if (
|
|
3528
|
+
]), [l] = ne((c) => [c.items]), d = g.useCallback(() => {
|
|
3529
|
+
const c = t(), { boardWrapperRect: h, boardWrapper: _ } = o();
|
|
3530
|
+
if (c.length === 0) {
|
|
3504
3531
|
n(null);
|
|
3505
3532
|
return;
|
|
3506
3533
|
}
|
|
3507
|
-
const v =
|
|
3534
|
+
const v = sn(c, _);
|
|
3508
3535
|
if (!v) {
|
|
3509
3536
|
n(null);
|
|
3510
3537
|
return;
|
|
3511
3538
|
}
|
|
3512
|
-
const { left: E, top: I, width: y, height:
|
|
3539
|
+
const { left: E, top: I, width: y, height: C } = v, x = {
|
|
3513
3540
|
left: E - h.left,
|
|
3514
3541
|
top: I - h.top,
|
|
3515
|
-
height:
|
|
3542
|
+
height: C,
|
|
3516
3543
|
width: y
|
|
3517
3544
|
};
|
|
3518
3545
|
n(x);
|
|
@@ -3523,7 +3550,7 @@ const vo = H({
|
|
|
3523
3550
|
e,
|
|
3524
3551
|
l,
|
|
3525
3552
|
s,
|
|
3526
|
-
|
|
3553
|
+
a,
|
|
3527
3554
|
u,
|
|
3528
3555
|
d,
|
|
3529
3556
|
f
|
|
@@ -3535,16 +3562,16 @@ const vo = H({
|
|
|
3535
3562
|
height: `${r.height}px`,
|
|
3536
3563
|
width: `${r.width}px`
|
|
3537
3564
|
},
|
|
3538
|
-
className: `selection ${
|
|
3565
|
+
className: `selection ${Io}`
|
|
3539
3566
|
}
|
|
3540
3567
|
);
|
|
3541
|
-
},
|
|
3542
|
-
const [e] =
|
|
3543
|
-
return e ? null : /* @__PURE__ */ T(
|
|
3544
|
-
},
|
|
3568
|
+
}, To = () => {
|
|
3569
|
+
const [e] = Q((t) => [t.boardState.movingItems]);
|
|
3570
|
+
return e ? null : /* @__PURE__ */ T(Oo, {});
|
|
3571
|
+
}, ko = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
|
|
3545
3572
|
let Le;
|
|
3546
|
-
function
|
|
3547
|
-
if (!
|
|
3573
|
+
function Po() {
|
|
3574
|
+
if (!ko)
|
|
3548
3575
|
return;
|
|
3549
3576
|
if (Le)
|
|
3550
3577
|
return Le;
|
|
@@ -3566,112 +3593,112 @@ function To() {
|
|
|
3566
3593
|
}
|
|
3567
3594
|
}, Le;
|
|
3568
3595
|
}
|
|
3569
|
-
function
|
|
3570
|
-
const n = r &&
|
|
3596
|
+
function Mo(e, t, r = !0) {
|
|
3597
|
+
const n = r && Po(), o = pt(t), s = e && "current" in e ? e.current : e;
|
|
3571
3598
|
Pe(() => {
|
|
3572
|
-
const
|
|
3573
|
-
if (!n || !
|
|
3599
|
+
const a = e && "current" in e ? e.current : e;
|
|
3600
|
+
if (!n || !a)
|
|
3574
3601
|
return;
|
|
3575
3602
|
let u = !0;
|
|
3576
3603
|
const l = (...d) => {
|
|
3577
3604
|
u && o.current(...d);
|
|
3578
3605
|
};
|
|
3579
|
-
return n.subscribe(
|
|
3580
|
-
u = !1, n.unsubscribe(
|
|
3606
|
+
return n.subscribe(a, l), () => {
|
|
3607
|
+
u = !1, n.unsubscribe(a, l);
|
|
3581
3608
|
};
|
|
3582
3609
|
}, [s, n]);
|
|
3583
3610
|
}
|
|
3584
|
-
function
|
|
3611
|
+
function Zt(e, t, r) {
|
|
3585
3612
|
return Math.min(Math.max(e, r), t);
|
|
3586
3613
|
}
|
|
3587
|
-
class
|
|
3614
|
+
class jo extends Error {
|
|
3588
3615
|
constructor(t) {
|
|
3589
3616
|
super(`Failed to parse color: "${t}"`);
|
|
3590
3617
|
}
|
|
3591
3618
|
}
|
|
3592
|
-
var xe =
|
|
3593
|
-
function
|
|
3619
|
+
var xe = jo;
|
|
3620
|
+
function Do(e) {
|
|
3594
3621
|
if (typeof e != "string")
|
|
3595
3622
|
throw new xe(e);
|
|
3596
3623
|
if (e.trim().toLowerCase() === "transparent")
|
|
3597
3624
|
return [0, 0, 0, 0];
|
|
3598
3625
|
let t = e.trim();
|
|
3599
|
-
t =
|
|
3600
|
-
const r =
|
|
3626
|
+
t = Xo.test(e) ? Lo(e) : e;
|
|
3627
|
+
const r = zo.exec(t);
|
|
3601
3628
|
if (r) {
|
|
3602
|
-
const
|
|
3603
|
-
return [...
|
|
3629
|
+
const a = Array.from(r).slice(1);
|
|
3630
|
+
return [...a.slice(0, 3).map((u) => parseInt(ke(u, 2), 16)), parseInt(ke(a[3] || "f", 2), 16) / 255];
|
|
3604
3631
|
}
|
|
3605
|
-
const n =
|
|
3632
|
+
const n = Yo.exec(t);
|
|
3606
3633
|
if (n) {
|
|
3607
|
-
const
|
|
3608
|
-
return [...
|
|
3634
|
+
const a = Array.from(n).slice(1);
|
|
3635
|
+
return [...a.slice(0, 3).map((u) => parseInt(u, 16)), parseInt(a[3] || "ff", 16) / 255];
|
|
3609
3636
|
}
|
|
3610
|
-
const o =
|
|
3637
|
+
const o = Bo.exec(t);
|
|
3611
3638
|
if (o) {
|
|
3612
|
-
const
|
|
3613
|
-
return [...
|
|
3639
|
+
const a = Array.from(o).slice(1);
|
|
3640
|
+
return [...a.slice(0, 3).map((u) => parseInt(u, 10)), parseFloat(a[3] || "1")];
|
|
3614
3641
|
}
|
|
3615
|
-
const s =
|
|
3642
|
+
const s = No.exec(t);
|
|
3616
3643
|
if (s) {
|
|
3617
|
-
const [
|
|
3618
|
-
if (
|
|
3644
|
+
const [a, u, l, d] = Array.from(s).slice(1).map(parseFloat);
|
|
3645
|
+
if (Zt(0, 100, u) !== u)
|
|
3619
3646
|
throw new xe(e);
|
|
3620
|
-
if (
|
|
3647
|
+
if (Zt(0, 100, l) !== l)
|
|
3621
3648
|
throw new xe(e);
|
|
3622
|
-
return [...
|
|
3649
|
+
return [...Uo(a, u, l), Number.isNaN(d) ? 1 : d];
|
|
3623
3650
|
}
|
|
3624
3651
|
throw new xe(e);
|
|
3625
3652
|
}
|
|
3626
|
-
function
|
|
3653
|
+
function $o(e) {
|
|
3627
3654
|
let t = 5381, r = e.length;
|
|
3628
3655
|
for (; r; )
|
|
3629
3656
|
t = t * 33 ^ e.charCodeAt(--r);
|
|
3630
3657
|
return (t >>> 0) % 2341;
|
|
3631
3658
|
}
|
|
3632
|
-
const
|
|
3633
|
-
const r =
|
|
3659
|
+
const Qt = (e) => parseInt(e.replace(/_/g, ""), 36), Ao = "1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e, t) => {
|
|
3660
|
+
const r = Qt(t.substring(0, 3)), n = Qt(t.substring(3)).toString(16);
|
|
3634
3661
|
let o = "";
|
|
3635
3662
|
for (let s = 0; s < 6 - n.length; s++)
|
|
3636
3663
|
o += "0";
|
|
3637
3664
|
return e[r] = `${o}${n}`, e;
|
|
3638
3665
|
}, {});
|
|
3639
|
-
function
|
|
3640
|
-
const t = e.toLowerCase().trim(), r =
|
|
3666
|
+
function Lo(e) {
|
|
3667
|
+
const t = e.toLowerCase().trim(), r = Ao[$o(t)];
|
|
3641
3668
|
if (!r)
|
|
3642
3669
|
throw new xe(e);
|
|
3643
3670
|
return `#${r}`;
|
|
3644
3671
|
}
|
|
3645
|
-
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""),
|
|
3672
|
+
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""), zo = new RegExp(`^#${ke("([a-f0-9])", 3)}([a-f0-9])?$`, "i"), Yo = new RegExp(`^#${ke("([a-f0-9]{2})", 3)}([a-f0-9]{2})?$`, "i"), Bo = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ke(",\\s*(\\d+)\\s*", 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, "i"), No = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i, Xo = /^[a-z]+$/i, er = (e) => Math.round(e * 255), Uo = (e, t, r) => {
|
|
3646
3673
|
let n = r / 100;
|
|
3647
3674
|
if (t === 0)
|
|
3648
|
-
return [n, n, n].map(
|
|
3649
|
-
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100),
|
|
3675
|
+
return [n, n, n].map(er);
|
|
3676
|
+
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100), a = s * (1 - Math.abs(o % 2 - 1));
|
|
3650
3677
|
let u = 0, l = 0, d = 0;
|
|
3651
|
-
o >= 0 && o < 1 ? (u = s, l =
|
|
3652
|
-
const f = n - s / 2,
|
|
3653
|
-
return [
|
|
3678
|
+
o >= 0 && o < 1 ? (u = s, l = a) : o >= 1 && o < 2 ? (u = a, l = s) : o >= 2 && o < 3 ? (l = s, d = a) : o >= 3 && o < 4 ? (l = a, d = s) : o >= 4 && o < 5 ? (u = a, d = s) : o >= 5 && o < 6 && (u = s, d = a);
|
|
3679
|
+
const f = n - s / 2, c = u + f, h = l + f, _ = d + f;
|
|
3680
|
+
return [c, h, _].map(er);
|
|
3654
3681
|
};
|
|
3655
|
-
function
|
|
3682
|
+
function Wo(e) {
|
|
3656
3683
|
if (e === "transparent")
|
|
3657
3684
|
return 0;
|
|
3658
3685
|
function t(s) {
|
|
3659
|
-
const
|
|
3660
|
-
return
|
|
3686
|
+
const a = s / 255;
|
|
3687
|
+
return a <= 0.03928 ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
|
|
3661
3688
|
}
|
|
3662
|
-
const [r, n, o] =
|
|
3689
|
+
const [r, n, o] = Do(e);
|
|
3663
3690
|
return 0.2126 * t(r) + 0.7152 * t(n) + 0.0722 * t(o);
|
|
3664
3691
|
}
|
|
3665
|
-
function
|
|
3666
|
-
return
|
|
3692
|
+
function Vo(e) {
|
|
3693
|
+
return Wo(e) > 0.179;
|
|
3667
3694
|
}
|
|
3668
|
-
const
|
|
3695
|
+
const Fo = K({
|
|
3669
3696
|
display: "flex",
|
|
3670
3697
|
flexDirection: "row",
|
|
3671
3698
|
alignItems: "center",
|
|
3672
3699
|
zIndex: 210,
|
|
3673
3700
|
pointerEvents: "none"
|
|
3674
|
-
}),
|
|
3701
|
+
}), Ko = K({
|
|
3675
3702
|
fontWeight: "bold",
|
|
3676
3703
|
padding: "0 0.5em",
|
|
3677
3704
|
borderRadius: "2px",
|
|
@@ -3682,9 +3709,9 @@ const Wo = H({
|
|
|
3682
3709
|
marginTop: "1.7em",
|
|
3683
3710
|
whitespace: "nowrap",
|
|
3684
3711
|
pointerEvents: "none"
|
|
3685
|
-
}),
|
|
3686
|
-
const n =
|
|
3687
|
-
return /* @__PURE__ */ ue("div", { className:
|
|
3712
|
+
}), Ho = ({ color: e = "#666", size: t = 40, text: r }) => {
|
|
3713
|
+
const n = Vo(e) ? "#222" : "#EEE";
|
|
3714
|
+
return /* @__PURE__ */ ue("div", { className: Fo, children: [
|
|
3688
3715
|
/* @__PURE__ */ ue(
|
|
3689
3716
|
"svg",
|
|
3690
3717
|
{
|
|
@@ -3724,32 +3751,32 @@ const Wo = H({
|
|
|
3724
3751
|
color: n,
|
|
3725
3752
|
backgroundColor: e
|
|
3726
3753
|
},
|
|
3727
|
-
className:
|
|
3754
|
+
className: Ko,
|
|
3728
3755
|
children: r
|
|
3729
3756
|
}
|
|
3730
3757
|
)
|
|
3731
3758
|
] });
|
|
3732
|
-
},
|
|
3759
|
+
}, qo = g.memo(Ho), Go = K({
|
|
3733
3760
|
top: 0,
|
|
3734
3761
|
left: 0,
|
|
3735
3762
|
zIndex: 210,
|
|
3736
3763
|
position: "fixed",
|
|
3737
3764
|
pointerEvents: "none"
|
|
3738
|
-
}),
|
|
3765
|
+
}), Jo = ({ pos: e, ...t }) => /* @__PURE__ */ T(
|
|
3739
3766
|
"div",
|
|
3740
3767
|
{
|
|
3741
|
-
className:
|
|
3768
|
+
className: Go,
|
|
3742
3769
|
style: {
|
|
3743
3770
|
transform: `translate(${e.x - 6}px, ${e.y - 15}px)`
|
|
3744
3771
|
},
|
|
3745
|
-
children: /* @__PURE__ */ T(
|
|
3772
|
+
children: /* @__PURE__ */ T(qo, { ...t })
|
|
3746
3773
|
}
|
|
3747
|
-
),
|
|
3748
|
-
const [t] =
|
|
3774
|
+
), Zo = ({ children: e }) => {
|
|
3775
|
+
const [t] = Q((v) => [
|
|
3749
3776
|
v.getConfiguration,
|
|
3750
3777
|
v.boardState.scale
|
|
3751
3778
|
// We want to update this component when the scale changes
|
|
3752
|
-
]), { fromWrapperToBoard: r, fromBoardToWrapper: n } = Me(), [o, s,
|
|
3779
|
+
]), { fromWrapperToBoard: r, fromBoardToWrapper: n } = Me(), [o, s, a, u] = Se(
|
|
3753
3780
|
(v) => [
|
|
3754
3781
|
v.getUser(),
|
|
3755
3782
|
v.getLocalUsers(),
|
|
@@ -3759,7 +3786,7 @@ const Wo = H({
|
|
|
3759
3786
|
), [l, d] = Se((v) => [
|
|
3760
3787
|
v.moveCursor,
|
|
3761
3788
|
v.removeCursor
|
|
3762
|
-
]), { boardWrapperRect: f } = t(),
|
|
3789
|
+
]), { boardWrapperRect: f } = t(), c = ({ clientX: v, clientY: E }) => {
|
|
3763
3790
|
const [I, y] = r(
|
|
3764
3791
|
v - f.left,
|
|
3765
3792
|
E - f.top
|
|
@@ -3767,18 +3794,18 @@ const Wo = H({
|
|
|
3767
3794
|
l(o.id, { x: I, y });
|
|
3768
3795
|
}, h = () => {
|
|
3769
3796
|
d(o.id);
|
|
3770
|
-
}, _ = s.reduce((v, E) => (E.id !== o.id &&
|
|
3771
|
-
return /* @__PURE__ */ ue("div", { onPointerMove:
|
|
3797
|
+
}, _ = s.reduce((v, E) => (E.id !== o.id && a[E.id] && (v[E.id] = a[E.id]), v), {});
|
|
3798
|
+
return /* @__PURE__ */ ue("div", { onPointerMove: c, onPointerLeave: h, children: [
|
|
3772
3799
|
e,
|
|
3773
3800
|
Object.entries(_).map(([v, E]) => {
|
|
3774
|
-
const [I, y] = n(E.x, E.y),
|
|
3801
|
+
const [I, y] = n(E.x, E.y), C = {
|
|
3775
3802
|
x: I + f.left,
|
|
3776
3803
|
y: y + f.top
|
|
3777
3804
|
};
|
|
3778
|
-
return ft(
|
|
3779
|
-
|
|
3805
|
+
return ft(C, f) ? /* @__PURE__ */ T(
|
|
3806
|
+
Jo,
|
|
3780
3807
|
{
|
|
3781
|
-
pos:
|
|
3808
|
+
pos: C,
|
|
3782
3809
|
text: u[v].name,
|
|
3783
3810
|
color: u[v].color
|
|
3784
3811
|
},
|
|
@@ -3786,24 +3813,24 @@ const Wo = H({
|
|
|
3786
3813
|
) : null;
|
|
3787
3814
|
})
|
|
3788
3815
|
] });
|
|
3789
|
-
},
|
|
3816
|
+
}, Qo = ({ children: e }) => e, es = {
|
|
3790
3817
|
overflow: "hidden",
|
|
3791
3818
|
position: "absolute",
|
|
3792
3819
|
inset: 0
|
|
3793
|
-
},
|
|
3820
|
+
}, gs = ({
|
|
3794
3821
|
moveFirst: e = !0,
|
|
3795
3822
|
style: t,
|
|
3796
3823
|
wrapperStyle: r,
|
|
3797
3824
|
itemTemplates: n = {},
|
|
3798
|
-
boardSize: o =
|
|
3825
|
+
boardSize: o = cr,
|
|
3799
3826
|
children: s,
|
|
3800
|
-
showResizeHandle:
|
|
3801
|
-
Wrapper: u =
|
|
3827
|
+
showResizeHandle: a = !1,
|
|
3828
|
+
Wrapper: u = Qo
|
|
3802
3829
|
}) => {
|
|
3803
|
-
const l = g.useRef(null), [d, f] =
|
|
3830
|
+
const l = g.useRef(null), [d, f] = Q((v) => [
|
|
3804
3831
|
v.config.uid,
|
|
3805
3832
|
v.updateConfiguration
|
|
3806
|
-
]), { updateItemExtent:
|
|
3833
|
+
]), { updateItemExtent: c } = Me(), h = {
|
|
3807
3834
|
userSelect: "none",
|
|
3808
3835
|
width: `${o}px`,
|
|
3809
3836
|
height: `${o}px`,
|
|
@@ -3829,18 +3856,18 @@ const Wo = H({
|
|
|
3829
3856
|
f({
|
|
3830
3857
|
itemTemplates: n,
|
|
3831
3858
|
boardSize: o,
|
|
3832
|
-
showResizeHandle:
|
|
3859
|
+
showResizeHandle: a
|
|
3833
3860
|
});
|
|
3834
|
-
}, [n, o,
|
|
3861
|
+
}, [n, o, a, f]), g.useEffect(() => {
|
|
3835
3862
|
f({
|
|
3836
3863
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3837
|
-
}),
|
|
3838
|
-
}, [f,
|
|
3864
|
+
}), c(), setTimeout(c, 2e3);
|
|
3865
|
+
}, [f, c]), Mo(l, () => {
|
|
3839
3866
|
l.current && f({
|
|
3840
3867
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3841
3868
|
});
|
|
3842
3869
|
});
|
|
3843
|
-
const _ =
|
|
3870
|
+
const _ = K({ ...es, ...r });
|
|
3844
3871
|
return /* @__PURE__ */ ue(
|
|
3845
3872
|
"div",
|
|
3846
3873
|
{
|
|
@@ -3848,7 +3875,7 @@ const Wo = H({
|
|
|
3848
3875
|
id: d,
|
|
3849
3876
|
className: `sync-board ${_}`,
|
|
3850
3877
|
children: [
|
|
3851
|
-
/* @__PURE__ */ T(
|
|
3878
|
+
/* @__PURE__ */ T(Zo, { children: /* @__PURE__ */ T(bo, { moveFirst: e, children: /* @__PURE__ */ T(Ro, { moveFirst: e, children: /* @__PURE__ */ T(Eo, { moveFirst: e, children: /* @__PURE__ */ T(u, { children: /* @__PURE__ */ ue(
|
|
3852
3879
|
"div",
|
|
3853
3880
|
{
|
|
3854
3881
|
onContextMenu: (v) => {
|
|
@@ -3857,34 +3884,34 @@ const Wo = H({
|
|
|
3857
3884
|
style: h,
|
|
3858
3885
|
className: "board",
|
|
3859
3886
|
children: [
|
|
3860
|
-
/* @__PURE__ */ T(
|
|
3887
|
+
/* @__PURE__ */ T(mo, {}),
|
|
3861
3888
|
s
|
|
3862
3889
|
]
|
|
3863
3890
|
}
|
|
3864
3891
|
) }) }) }) }) }),
|
|
3865
|
-
/* @__PURE__ */ T(
|
|
3892
|
+
/* @__PURE__ */ T(To, {})
|
|
3866
3893
|
]
|
|
3867
3894
|
}
|
|
3868
3895
|
);
|
|
3869
3896
|
};
|
|
3870
|
-
|
|
3897
|
+
Vn(g.createElement);
|
|
3871
3898
|
export {
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3899
|
+
gs as Board,
|
|
3900
|
+
ps as BoardWrapper,
|
|
3901
|
+
ms as RoomWrapper,
|
|
3902
|
+
is as useAvailableActions,
|
|
3903
|
+
us as useBoardConfig,
|
|
3877
3904
|
Me as useBoardPosition,
|
|
3878
|
-
|
|
3879
|
-
|
|
3905
|
+
ls as useBoardState,
|
|
3906
|
+
os as useDebouncedItems,
|
|
3880
3907
|
gt as useItemActions,
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3908
|
+
Vt as useItemInteraction,
|
|
3909
|
+
ns as useItems,
|
|
3910
|
+
ds as useMessage,
|
|
3911
|
+
ss as useSelectedItems,
|
|
3912
|
+
as as useSelectionBox,
|
|
3913
|
+
fs as useSessionInfo,
|
|
3914
|
+
cs as useUsers,
|
|
3888
3915
|
Xe as useWire
|
|
3889
3916
|
};
|
|
3890
3917
|
//# sourceMappingURL=react-sync-board.js.map
|