react-sync-board 1.2.0 → 1.2.1
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 +1071 -1062
- package/dist/react-sync-board.js.map +1 -1
- package/dist/react-sync-board.umd.cjs +17 -17
- 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 $r = Object.defineProperty;
|
|
2
|
+
var Ar = (e, t, r) => t in e ? $r(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var kt = (e, t, r) => (Ar(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import g, { useContext as _e, useDebugValue as Lr, useRef as Re, useMemo as lt, useEffect as Pe, useCallback as er, memo as tr } from "react";
|
|
5
|
+
function zr(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var Ie = {},
|
|
8
|
+
var Ie = {}, Yr = {
|
|
9
9
|
get exports() {
|
|
10
10
|
return Ie;
|
|
11
11
|
},
|
|
@@ -23,20 +23,20 @@ var Ie = {}, zr = {
|
|
|
23
23
|
* LICENSE file in the root directory of this source tree.
|
|
24
24
|
*/
|
|
25
25
|
var Pt;
|
|
26
|
-
function
|
|
26
|
+
function Br() {
|
|
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 c(u, l,
|
|
32
|
-
var f, a = {}, h = null,
|
|
33
|
-
|
|
31
|
+
function c(u, l, d) {
|
|
32
|
+
var f, a = {}, h = null, _ = null;
|
|
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
35
|
n.call(l, f) && !s.hasOwnProperty(f) && (a[f] = l[f]);
|
|
36
36
|
if (u && u.defaultProps)
|
|
37
37
|
for (f in l = u.defaultProps, l)
|
|
38
38
|
a[f] === void 0 && (a[f] = l[f]);
|
|
39
|
-
return { $$typeof: t, type: u, key: h, ref:
|
|
39
|
+
return { $$typeof: t, type: u, key: h, ref: _, props: a, _owner: o.current };
|
|
40
40
|
}
|
|
41
41
|
return Ee.Fragment = r, Ee.jsx = c, Ee.jsxs = c, Ee;
|
|
42
42
|
}
|
|
@@ -51,53 +51,53 @@ var Ce = {};
|
|
|
51
51
|
* LICENSE file in the root directory of this source tree.
|
|
52
52
|
*/
|
|
53
53
|
var Mt;
|
|
54
|
-
function
|
|
54
|
+
function Nr() {
|
|
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"), c = Symbol.for("react.provider"), u = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"),
|
|
57
|
-
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"), c = 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"), a = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), v = Symbol.iterator, E = "@@iterator";
|
|
57
|
+
function I(i) {
|
|
58
58
|
if (i === null || typeof i != "object")
|
|
59
59
|
return null;
|
|
60
|
-
var
|
|
61
|
-
return typeof
|
|
60
|
+
var b = v && i[v] || i[E];
|
|
61
|
+
return typeof b == "function" ? b : null;
|
|
62
62
|
}
|
|
63
|
-
var
|
|
63
|
+
var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
64
64
|
function w(i) {
|
|
65
65
|
{
|
|
66
|
-
for (var
|
|
67
|
-
|
|
68
|
-
x("error", i,
|
|
66
|
+
for (var b = arguments.length, R = new Array(b > 1 ? b - 1 : 0), j = 1; j < b; j++)
|
|
67
|
+
R[j - 1] = arguments[j];
|
|
68
|
+
x("error", i, R);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
function x(i,
|
|
71
|
+
function x(i, b, R) {
|
|
72
72
|
{
|
|
73
|
-
var j =
|
|
74
|
-
X !== "" && (
|
|
75
|
-
var V =
|
|
73
|
+
var j = y.ReactDebugCurrentFrame, X = j.getStackAddendum();
|
|
74
|
+
X !== "" && (b += "%s", R = R.concat([X]));
|
|
75
|
+
var V = R.map(function(Y) {
|
|
76
76
|
return String(Y);
|
|
77
77
|
});
|
|
78
|
-
V.unshift("Warning: " +
|
|
78
|
+
V.unshift("Warning: " + b), Function.prototype.apply.call(console[i], console, V);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
var
|
|
82
|
-
|
|
81
|
+
var p = !1, C = !1, m = !1, S = !1, O = !1, k;
|
|
82
|
+
k = Symbol.for("react.module.reference");
|
|
83
83
|
function D(i) {
|
|
84
|
-
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s ||
|
|
84
|
+
return !!(typeof i == "string" || typeof i == "function" || i === n || i === s || O || i === o || i === d || i === f || S || i === _ || p || C || m || typeof i == "object" && i !== null && (i.$$typeof === h || i.$$typeof === a || i.$$typeof === c || 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
|
-
i.$$typeof ===
|
|
88
|
+
i.$$typeof === k || i.getModuleId !== void 0));
|
|
89
89
|
}
|
|
90
|
-
function M(i,
|
|
90
|
+
function M(i, b, R) {
|
|
91
91
|
var j = i.displayName;
|
|
92
92
|
if (j)
|
|
93
93
|
return j;
|
|
94
|
-
var X =
|
|
95
|
-
return X !== "" ?
|
|
94
|
+
var X = b.displayName || b.name || "";
|
|
95
|
+
return X !== "" ? R + "(" + X + ")" : R;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function L(i) {
|
|
98
98
|
return i.displayName || "Context";
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function N(i) {
|
|
101
101
|
if (i == null)
|
|
102
102
|
return null;
|
|
103
103
|
if (typeof i.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof i == "function")
|
|
@@ -113,7 +113,7 @@ function Br() {
|
|
|
113
113
|
return "Profiler";
|
|
114
114
|
case o:
|
|
115
115
|
return "StrictMode";
|
|
116
|
-
case
|
|
116
|
+
case d:
|
|
117
117
|
return "Suspense";
|
|
118
118
|
case f:
|
|
119
119
|
return "SuspenseList";
|
|
@@ -121,20 +121,20 @@ function Br() {
|
|
|
121
121
|
if (typeof i == "object")
|
|
122
122
|
switch (i.$$typeof) {
|
|
123
123
|
case u:
|
|
124
|
-
var
|
|
125
|
-
return
|
|
124
|
+
var b = i;
|
|
125
|
+
return L(b) + ".Consumer";
|
|
126
126
|
case c:
|
|
127
|
-
var
|
|
128
|
-
return
|
|
127
|
+
var R = i;
|
|
128
|
+
return L(R._context) + ".Provider";
|
|
129
129
|
case l:
|
|
130
130
|
return M(i, i.render, "ForwardRef");
|
|
131
131
|
case a:
|
|
132
132
|
var j = i.displayName || null;
|
|
133
|
-
return j !== null ? j :
|
|
133
|
+
return j !== null ? j : N(i.type) || "Memo";
|
|
134
134
|
case h: {
|
|
135
135
|
var X = i, V = X._payload, Y = X._init;
|
|
136
136
|
try {
|
|
137
|
-
return
|
|
137
|
+
return N(Y(V));
|
|
138
138
|
} catch {
|
|
139
139
|
return null;
|
|
140
140
|
}
|
|
@@ -142,18 +142,18 @@ function Br() {
|
|
|
142
142
|
}
|
|
143
143
|
return null;
|
|
144
144
|
}
|
|
145
|
-
var W = Object.assign,
|
|
146
|
-
function
|
|
145
|
+
var W = Object.assign, J = 0, P, $, B, U, A, F, K;
|
|
146
|
+
function ee() {
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
function
|
|
148
|
+
ee.__reactDisabledLog = !0;
|
|
149
|
+
function oe() {
|
|
150
150
|
{
|
|
151
|
-
if (
|
|
152
|
-
|
|
151
|
+
if (J === 0) {
|
|
152
|
+
P = console.log, $ = console.info, B = console.warn, U = console.error, A = console.group, F = console.groupCollapsed, K = console.groupEnd;
|
|
153
153
|
var i = {
|
|
154
154
|
configurable: !0,
|
|
155
155
|
enumerable: !0,
|
|
156
|
-
value:
|
|
156
|
+
value: ee,
|
|
157
157
|
writable: !0
|
|
158
158
|
};
|
|
159
159
|
Object.defineProperties(console, {
|
|
@@ -166,12 +166,12 @@ function Br() {
|
|
|
166
166
|
groupEnd: i
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
J++;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function le() {
|
|
173
173
|
{
|
|
174
|
-
if (
|
|
174
|
+
if (J--, J === 0) {
|
|
175
175
|
var i = {
|
|
176
176
|
configurable: !0,
|
|
177
177
|
enumerable: !0,
|
|
@@ -179,66 +179,66 @@ function Br() {
|
|
|
179
179
|
};
|
|
180
180
|
Object.defineProperties(console, {
|
|
181
181
|
log: W({}, i, {
|
|
182
|
-
value:
|
|
182
|
+
value: P
|
|
183
183
|
}),
|
|
184
184
|
info: W({}, i, {
|
|
185
|
-
value:
|
|
185
|
+
value: $
|
|
186
186
|
}),
|
|
187
187
|
warn: W({}, i, {
|
|
188
|
-
value:
|
|
188
|
+
value: B
|
|
189
189
|
}),
|
|
190
190
|
error: W({}, i, {
|
|
191
|
-
value:
|
|
191
|
+
value: U
|
|
192
192
|
}),
|
|
193
193
|
group: W({}, i, {
|
|
194
|
-
value:
|
|
194
|
+
value: A
|
|
195
195
|
}),
|
|
196
196
|
groupCollapsed: W({}, i, {
|
|
197
|
-
value:
|
|
197
|
+
value: F
|
|
198
198
|
}),
|
|
199
199
|
groupEnd: W({}, i, {
|
|
200
|
-
value:
|
|
200
|
+
value: K
|
|
201
201
|
})
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
J < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
var
|
|
208
|
-
function ge(i,
|
|
207
|
+
var se = y.ReactCurrentDispatcher, me;
|
|
208
|
+
function ge(i, b, R) {
|
|
209
209
|
{
|
|
210
|
-
if (
|
|
210
|
+
if (me === void 0)
|
|
211
211
|
try {
|
|
212
212
|
throw Error();
|
|
213
213
|
} catch (X) {
|
|
214
214
|
var j = X.stack.trim().match(/\n( *(at )?)/);
|
|
215
|
-
|
|
215
|
+
me = j && j[1] || "";
|
|
216
216
|
}
|
|
217
217
|
return `
|
|
218
|
-
` +
|
|
218
|
+
` + me + i;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
var Ke = !1, De;
|
|
222
222
|
{
|
|
223
|
-
var
|
|
224
|
-
De = new
|
|
223
|
+
var dr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
224
|
+
De = new dr();
|
|
225
225
|
}
|
|
226
|
-
function ht(i,
|
|
226
|
+
function ht(i, b) {
|
|
227
227
|
if (!i || Ke)
|
|
228
228
|
return "";
|
|
229
229
|
{
|
|
230
|
-
var
|
|
231
|
-
if (
|
|
232
|
-
return
|
|
230
|
+
var R = De.get(i);
|
|
231
|
+
if (R !== void 0)
|
|
232
|
+
return R;
|
|
233
233
|
}
|
|
234
234
|
var j;
|
|
235
235
|
Ke = !0;
|
|
236
236
|
var X = Error.prepareStackTrace;
|
|
237
237
|
Error.prepareStackTrace = void 0;
|
|
238
238
|
var V;
|
|
239
|
-
V =
|
|
239
|
+
V = se.current, se.current = null, oe();
|
|
240
240
|
try {
|
|
241
|
-
if (
|
|
241
|
+
if (b) {
|
|
242
242
|
var Y = function() {
|
|
243
243
|
throw Error();
|
|
244
244
|
};
|
|
@@ -249,29 +249,29 @@ function Br() {
|
|
|
249
249
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
250
250
|
try {
|
|
251
251
|
Reflect.construct(Y, []);
|
|
252
|
-
} catch (
|
|
253
|
-
j =
|
|
252
|
+
} catch (ie) {
|
|
253
|
+
j = ie;
|
|
254
254
|
}
|
|
255
255
|
Reflect.construct(i, [], Y);
|
|
256
256
|
} else {
|
|
257
257
|
try {
|
|
258
258
|
Y.call();
|
|
259
|
-
} catch (
|
|
260
|
-
j =
|
|
259
|
+
} catch (ie) {
|
|
260
|
+
j = ie;
|
|
261
261
|
}
|
|
262
262
|
i.call(Y.prototype);
|
|
263
263
|
}
|
|
264
264
|
} else {
|
|
265
265
|
try {
|
|
266
266
|
throw Error();
|
|
267
|
-
} catch (
|
|
268
|
-
j =
|
|
267
|
+
} catch (ie) {
|
|
268
|
+
j = ie;
|
|
269
269
|
}
|
|
270
270
|
i();
|
|
271
271
|
}
|
|
272
|
-
} catch (
|
|
273
|
-
if (
|
|
274
|
-
for (var z =
|
|
272
|
+
} catch (ie) {
|
|
273
|
+
if (ie && j && typeof ie.stack == "string") {
|
|
274
|
+
for (var z = ie.stack.split(`
|
|
275
275
|
`), Q = j.stack.split(`
|
|
276
276
|
`), q = z.length - 1, G = Q.length - 1; q >= 1 && G >= 0 && z[q] !== Q[G]; )
|
|
277
277
|
G--;
|
|
@@ -280,36 +280,36 @@ function Br() {
|
|
|
280
280
|
if (q !== 1 || G !== 1)
|
|
281
281
|
do
|
|
282
282
|
if (q--, G--, G < 0 || z[q] !== Q[G]) {
|
|
283
|
-
var
|
|
283
|
+
var te = `
|
|
284
284
|
` + z[q].replace(" at new ", " at ");
|
|
285
|
-
return i.displayName &&
|
|
285
|
+
return i.displayName && te.includes("<anonymous>") && (te = te.replace("<anonymous>", i.displayName)), typeof i == "function" && De.set(i, te), te;
|
|
286
286
|
}
|
|
287
287
|
while (q >= 1 && G >= 0);
|
|
288
288
|
break;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
} finally {
|
|
292
|
-
Ke = !1,
|
|
292
|
+
Ke = !1, se.current = V, le(), Error.prepareStackTrace = X;
|
|
293
293
|
}
|
|
294
294
|
var ve = i ? i.displayName || i.name : "", Tt = ve ? ge(ve) : "";
|
|
295
295
|
return typeof i == "function" && De.set(i, Tt), Tt;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function pr(i, b, R) {
|
|
298
298
|
return ht(i, !1);
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
var
|
|
302
|
-
return !!(
|
|
300
|
+
function mr(i) {
|
|
301
|
+
var b = i.prototype;
|
|
302
|
+
return !!(b && b.isReactComponent);
|
|
303
303
|
}
|
|
304
|
-
function je(i,
|
|
304
|
+
function je(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, mr(i));
|
|
309
309
|
if (typeof i == "string")
|
|
310
310
|
return ge(i);
|
|
311
311
|
switch (i) {
|
|
312
|
-
case
|
|
312
|
+
case d:
|
|
313
313
|
return ge("Suspense");
|
|
314
314
|
case f:
|
|
315
315
|
return ge("SuspenseList");
|
|
@@ -317,28 +317,28 @@ function Br() {
|
|
|
317
317
|
if (typeof i == "object")
|
|
318
318
|
switch (i.$$typeof) {
|
|
319
319
|
case l:
|
|
320
|
-
return
|
|
320
|
+
return pr(i.render);
|
|
321
321
|
case a:
|
|
322
|
-
return je(i.type,
|
|
322
|
+
return je(i.type, b, R);
|
|
323
323
|
case h: {
|
|
324
324
|
var j = i, X = j._payload, V = j._init;
|
|
325
325
|
try {
|
|
326
|
-
return je(V(X),
|
|
326
|
+
return je(V(X), b, R);
|
|
327
327
|
} catch {
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
return "";
|
|
332
332
|
}
|
|
333
|
-
var $e = Object.prototype.hasOwnProperty, vt = {}, yt =
|
|
333
|
+
var $e = Object.prototype.hasOwnProperty, vt = {}, yt = y.ReactDebugCurrentFrame;
|
|
334
334
|
function Ae(i) {
|
|
335
335
|
if (i) {
|
|
336
|
-
var
|
|
337
|
-
yt.setExtraStackFrame(
|
|
336
|
+
var b = i._owner, R = je(i.type, i._source, b ? b.type : null);
|
|
337
|
+
yt.setExtraStackFrame(R);
|
|
338
338
|
} else
|
|
339
339
|
yt.setExtraStackFrame(null);
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function gr(i, b, R, j, X) {
|
|
342
342
|
{
|
|
343
343
|
var V = Function.call.bind($e);
|
|
344
344
|
for (var Y in i)
|
|
@@ -346,28 +346,28 @@ function Br() {
|
|
|
346
346
|
var z = void 0;
|
|
347
347
|
try {
|
|
348
348
|
if (typeof i[Y] != "function") {
|
|
349
|
-
var Q = Error((j || "React class") + ": " +
|
|
349
|
+
var Q = Error((j || "React class") + ": " + R + " type `" + Y + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof i[Y] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
350
350
|
throw Q.name = "Invariant Violation", Q;
|
|
351
351
|
}
|
|
352
|
-
z = i[Y](
|
|
352
|
+
z = i[Y](b, Y, j, 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), w("%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).", j || "React class",
|
|
356
|
+
z && !(z instanceof Error) && (Ae(X), w("%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).", j || "React class", R, Y, typeof z), Ae(null)), z instanceof Error && !(z.message in vt) && (vt[z.message] = !0, Ae(X), w("Failed %s type: %s", R, z.message), Ae(null));
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
var
|
|
360
|
+
var hr = Array.isArray;
|
|
361
361
|
function He(i) {
|
|
362
|
-
return
|
|
362
|
+
return hr(i);
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function vr(i) {
|
|
365
365
|
{
|
|
366
|
-
var
|
|
367
|
-
return
|
|
366
|
+
var b = typeof Symbol == "function" && Symbol.toStringTag, R = b && i[Symbol.toStringTag] || i.constructor.name || "Object";
|
|
367
|
+
return R;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function yr(i) {
|
|
371
371
|
try {
|
|
372
372
|
return St(i), !1;
|
|
373
373
|
} catch {
|
|
@@ -378,68 +378,68 @@ function Br() {
|
|
|
378
378
|
return "" + i;
|
|
379
379
|
}
|
|
380
380
|
function _t(i) {
|
|
381
|
-
if (
|
|
382
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
381
|
+
if (yr(i))
|
|
382
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", vr(i)), St(i);
|
|
383
383
|
}
|
|
384
|
-
var be =
|
|
384
|
+
var be = y.ReactCurrentOwner, Sr = {
|
|
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 _r(i) {
|
|
392
392
|
if ($e.call(i, "ref")) {
|
|
393
|
-
var
|
|
394
|
-
if (
|
|
393
|
+
var b = Object.getOwnPropertyDescriptor(i, "ref").get;
|
|
394
|
+
if (b && b.isReactWarning)
|
|
395
395
|
return !1;
|
|
396
396
|
}
|
|
397
397
|
return i.ref !== void 0;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function br(i) {
|
|
400
400
|
if ($e.call(i, "key")) {
|
|
401
|
-
var
|
|
402
|
-
if (
|
|
401
|
+
var b = Object.getOwnPropertyDescriptor(i, "key").get;
|
|
402
|
+
if (b && b.isReactWarning)
|
|
403
403
|
return !1;
|
|
404
404
|
}
|
|
405
405
|
return i.key !== void 0;
|
|
406
406
|
}
|
|
407
|
-
function
|
|
408
|
-
if (typeof i.ref == "string" && be.current &&
|
|
409
|
-
var
|
|
410
|
-
qe[
|
|
407
|
+
function Er(i, b) {
|
|
408
|
+
if (typeof i.ref == "string" && be.current && b && be.current.stateNode !== b) {
|
|
409
|
+
var R = N(be.current.type);
|
|
410
|
+
qe[R] || (w('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 Cr(i, b) {
|
|
414
414
|
{
|
|
415
|
-
var
|
|
416
|
-
bt || (bt = !0, w("%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)",
|
|
415
|
+
var R = function() {
|
|
416
|
+
bt || (bt = !0, w("%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
|
-
|
|
419
|
-
get:
|
|
418
|
+
R.isReactWarning = !0, Object.defineProperty(i, "key", {
|
|
419
|
+
get: R,
|
|
420
420
|
configurable: !0
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function wr(i, b) {
|
|
425
425
|
{
|
|
426
|
-
var
|
|
427
|
-
Et || (Et = !0, w("%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)",
|
|
426
|
+
var R = function() {
|
|
427
|
+
Et || (Et = !0, w("%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
|
-
|
|
430
|
-
get:
|
|
429
|
+
R.isReactWarning = !0, Object.defineProperty(i, "ref", {
|
|
430
|
+
get: R,
|
|
431
431
|
configurable: !0
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
var
|
|
435
|
+
var xr = function(i, b, R, j, X, V, Y) {
|
|
436
436
|
var z = {
|
|
437
437
|
// This tag allows us to uniquely identify this as a React Element
|
|
438
438
|
$$typeof: t,
|
|
439
439
|
// Built-in properties that belong on the element
|
|
440
440
|
type: i,
|
|
441
|
-
key:
|
|
442
|
-
ref:
|
|
441
|
+
key: b,
|
|
442
|
+
ref: R,
|
|
443
443
|
props: Y,
|
|
444
444
|
// Record the component responsible for creating this element.
|
|
445
445
|
_owner: V
|
|
@@ -461,12 +461,12 @@ function Br() {
|
|
|
461
461
|
value: X
|
|
462
462
|
}), Object.freeze && (Object.freeze(z.props), Object.freeze(z)), z;
|
|
463
463
|
};
|
|
464
|
-
function
|
|
464
|
+
function Rr(i, b, R, j, X) {
|
|
465
465
|
{
|
|
466
466
|
var V, Y = {}, z = null, Q = null;
|
|
467
|
-
|
|
468
|
-
for (V in
|
|
469
|
-
$e.call(
|
|
467
|
+
R !== void 0 && (_t(R), z = "" + R), br(b) && (_t(b.key), z = "" + b.key), _r(b) && (Q = b.ref, Er(b, X));
|
|
468
|
+
for (V in b)
|
|
469
|
+
$e.call(b, V) && !Sr.hasOwnProperty(V) && (Y[V] = b[V]);
|
|
470
470
|
if (i && i.defaultProps) {
|
|
471
471
|
var q = i.defaultProps;
|
|
472
472
|
for (V in q)
|
|
@@ -474,16 +474,16 @@ function Br() {
|
|
|
474
474
|
}
|
|
475
475
|
if (z || Q) {
|
|
476
476
|
var G = typeof i == "function" ? i.displayName || i.name || "Unknown" : i;
|
|
477
|
-
z &&
|
|
477
|
+
z && Cr(Y, G), Q && wr(Y, G);
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return xr(i, z, Q, X, j, be.current, Y);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
var Ge =
|
|
482
|
+
var Ge = y.ReactCurrentOwner, Ct = y.ReactDebugCurrentFrame;
|
|
483
483
|
function he(i) {
|
|
484
484
|
if (i) {
|
|
485
|
-
var
|
|
486
|
-
Ct.setExtraStackFrame(
|
|
485
|
+
var b = i._owner, R = je(i.type, i._source, b ? b.type : null);
|
|
486
|
+
Ct.setExtraStackFrame(R);
|
|
487
487
|
} else
|
|
488
488
|
Ct.setExtraStackFrame(null);
|
|
489
489
|
}
|
|
@@ -495,7 +495,7 @@ function Br() {
|
|
|
495
495
|
function wt() {
|
|
496
496
|
{
|
|
497
497
|
if (Ge.current) {
|
|
498
|
-
var i =
|
|
498
|
+
var i = N(Ge.current.type);
|
|
499
499
|
if (i)
|
|
500
500
|
return `
|
|
501
501
|
|
|
@@ -504,91 +504,91 @@ Check the render method of \`` + i + "`.";
|
|
|
504
504
|
return "";
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function Ir(i) {
|
|
508
508
|
{
|
|
509
509
|
if (i !== void 0) {
|
|
510
|
-
var
|
|
510
|
+
var b = i.fileName.replace(/^.*[\\\/]/, ""), R = i.lineNumber;
|
|
511
511
|
return `
|
|
512
512
|
|
|
513
|
-
Check your code at ` +
|
|
513
|
+
Check your code at ` + b + ":" + R + ".";
|
|
514
514
|
}
|
|
515
515
|
return "";
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
var xt = {};
|
|
519
|
-
function
|
|
519
|
+
function Or(i) {
|
|
520
520
|
{
|
|
521
|
-
var
|
|
522
|
-
if (!
|
|
523
|
-
var
|
|
524
|
-
|
|
521
|
+
var b = wt();
|
|
522
|
+
if (!b) {
|
|
523
|
+
var R = typeof i == "string" ? i : i.displayName || i.name;
|
|
524
|
+
R && (b = `
|
|
525
525
|
|
|
526
|
-
Check the top-level render call using <` +
|
|
526
|
+
Check the top-level render call using <` + R + ">.");
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return b;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
function Rt(i,
|
|
531
|
+
function Rt(i, b) {
|
|
532
532
|
{
|
|
533
533
|
if (!i._store || i._store.validated || i.key != null)
|
|
534
534
|
return;
|
|
535
535
|
i._store.validated = !0;
|
|
536
|
-
var
|
|
537
|
-
if (xt[
|
|
536
|
+
var R = Or(b);
|
|
537
|
+
if (xt[R])
|
|
538
538
|
return;
|
|
539
|
-
xt[
|
|
539
|
+
xt[R] = !0;
|
|
540
540
|
var j = "";
|
|
541
|
-
i && i._owner && i._owner !== Ge.current && (j = " It was passed a child from " +
|
|
541
|
+
i && i._owner && i._owner !== Ge.current && (j = " It was passed a child from " + N(i._owner.type) + "."), he(i), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', R, j), he(null);
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
function It(i,
|
|
544
|
+
function It(i, b) {
|
|
545
545
|
{
|
|
546
546
|
if (typeof i != "object")
|
|
547
547
|
return;
|
|
548
548
|
if (He(i))
|
|
549
|
-
for (var
|
|
550
|
-
var j = i[
|
|
551
|
-
Ze(j) && Rt(j,
|
|
549
|
+
for (var R = 0; R < i.length; R++) {
|
|
550
|
+
var j = i[R];
|
|
551
|
+
Ze(j) && Rt(j, b);
|
|
552
552
|
}
|
|
553
553
|
else if (Ze(i))
|
|
554
554
|
i._store && (i._store.validated = !0);
|
|
555
555
|
else if (i) {
|
|
556
|
-
var X =
|
|
556
|
+
var X = I(i);
|
|
557
557
|
if (typeof X == "function" && X !== i.entries)
|
|
558
558
|
for (var V = X.call(i), Y; !(Y = V.next()).done; )
|
|
559
|
-
Ze(Y.value) && Rt(Y.value,
|
|
559
|
+
Ze(Y.value) && Rt(Y.value, b);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Tr(i) {
|
|
564
564
|
{
|
|
565
|
-
var
|
|
566
|
-
if (
|
|
565
|
+
var b = i.type;
|
|
566
|
+
if (b == null || typeof b == "string")
|
|
567
567
|
return;
|
|
568
|
-
var
|
|
569
|
-
if (typeof
|
|
570
|
-
|
|
571
|
-
else if (typeof
|
|
568
|
+
var R;
|
|
569
|
+
if (typeof b == "function")
|
|
570
|
+
R = b.propTypes;
|
|
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
|
-
|
|
574
|
-
|
|
573
|
+
b.$$typeof === a))
|
|
574
|
+
R = b.propTypes;
|
|
575
575
|
else
|
|
576
576
|
return;
|
|
577
|
-
if (
|
|
578
|
-
var j =
|
|
579
|
-
|
|
580
|
-
} else if (
|
|
577
|
+
if (R) {
|
|
578
|
+
var j = N(b);
|
|
579
|
+
gr(R, i.props, "prop", j, i);
|
|
580
|
+
} else if (b.PropTypes !== void 0 && !Je) {
|
|
581
581
|
Je = !0;
|
|
582
|
-
var X =
|
|
582
|
+
var X = N(b);
|
|
583
583
|
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", X || "Unknown");
|
|
584
584
|
}
|
|
585
|
-
typeof
|
|
585
|
+
typeof b.getDefaultProps == "function" && !b.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function kr(i) {
|
|
589
589
|
{
|
|
590
|
-
for (var
|
|
591
|
-
var j =
|
|
590
|
+
for (var b = Object.keys(i.props), R = 0; R < b.length; R++) {
|
|
591
|
+
var j = b[R];
|
|
592
592
|
if (j !== "children" && j !== "key") {
|
|
593
593
|
he(i), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", j), he(null);
|
|
594
594
|
break;
|
|
@@ -597,52 +597,52 @@ Check the top-level render call using <` + I + ">.");
|
|
|
597
597
|
i.ref !== null && (he(i), w("Invalid attribute `ref` supplied to `React.Fragment`."), he(null));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function Ot(i,
|
|
600
|
+
function Ot(i, b, R, j, X, V) {
|
|
601
601
|
{
|
|
602
602
|
var Y = D(i);
|
|
603
603
|
if (!Y) {
|
|
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 Q =
|
|
606
|
+
var Q = Ir(X);
|
|
607
607
|
Q ? z += Q : z += wt();
|
|
608
608
|
var q;
|
|
609
|
-
i === null ? q = "null" : He(i) ? q = "array" : i !== void 0 && i.$$typeof === t ? (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, w("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 = Rr(i, b, R, X, V);
|
|
612
612
|
if (G == null)
|
|
613
613
|
return G;
|
|
614
614
|
if (Y) {
|
|
615
|
-
var
|
|
616
|
-
if (
|
|
615
|
+
var te = b.children;
|
|
616
|
+
if (te !== void 0)
|
|
617
617
|
if (j)
|
|
618
|
-
if (He(
|
|
619
|
-
for (var ve = 0; ve <
|
|
620
|
-
It(
|
|
621
|
-
Object.freeze && Object.freeze(
|
|
618
|
+
if (He(te)) {
|
|
619
|
+
for (var ve = 0; ve < te.length; ve++)
|
|
620
|
+
It(te[ve], i);
|
|
621
|
+
Object.freeze && Object.freeze(te);
|
|
622
622
|
} else
|
|
623
623
|
w("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(te, i);
|
|
626
626
|
}
|
|
627
|
-
return i === n ?
|
|
627
|
+
return i === n ? kr(G) : Tr(G), G;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
|
-
function
|
|
631
|
-
return Ot(i,
|
|
630
|
+
function Pr(i, b, R) {
|
|
631
|
+
return Ot(i, b, R, !0);
|
|
632
632
|
}
|
|
633
|
-
function
|
|
634
|
-
return Ot(i,
|
|
633
|
+
function Mr(i, b, R) {
|
|
634
|
+
return Ot(i, b, R, !1);
|
|
635
635
|
}
|
|
636
|
-
var
|
|
637
|
-
Ce.Fragment = n, Ce.jsx =
|
|
636
|
+
var Dr = Mr, jr = Pr;
|
|
637
|
+
Ce.Fragment = n, Ce.jsx = Dr, Ce.jsxs = jr;
|
|
638
638
|
}()), Ce;
|
|
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 = Br() : e.exports = Nr();
|
|
642
|
+
})(Yr);
|
|
643
|
+
const Xr = Ie.Fragment, T = Ie.jsx, ue = Ie.jsxs;
|
|
644
|
+
let Ur = (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 Wr {
|
|
646
646
|
constructor(t, r, n = null) {
|
|
647
647
|
this._socket = t, this.userId = n, this.room = r, this.toUnregister = [
|
|
648
648
|
() => {
|
|
@@ -669,7 +669,7 @@ class Ur {
|
|
|
669
669
|
* @returns the result of the call.
|
|
670
670
|
*/
|
|
671
671
|
async _callServerRPC(t, r) {
|
|
672
|
-
const n =
|
|
672
|
+
const n = Ur();
|
|
673
673
|
return new Promise((o, s) => {
|
|
674
674
|
this._socket.once(`${this.room}._result.${n}`, (c) => {
|
|
675
675
|
c.hasOwnProperty("ok") ? o(c.ok) : s(c.err);
|
|
@@ -738,7 +738,7 @@ class Ur {
|
|
|
738
738
|
return await this._callServerRPC("call", { name: t, params: r });
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
const
|
|
741
|
+
const Vr = ({
|
|
742
742
|
socket: e,
|
|
743
743
|
room: t,
|
|
744
744
|
onJoined: r = () => {
|
|
@@ -747,7 +747,7 @@ const Wr = ({
|
|
|
747
747
|
},
|
|
748
748
|
userId: o = null
|
|
749
749
|
}) => {
|
|
750
|
-
const s = new
|
|
750
|
+
const s = new Wr(e, t, o);
|
|
751
751
|
return new Promise((c) => {
|
|
752
752
|
let u = !0;
|
|
753
753
|
e.on(`${t}.isMaster`, () => {
|
|
@@ -761,7 +761,7 @@ const Wr = ({
|
|
|
761
761
|
});
|
|
762
762
|
}), e.emit("joinSuperSocket", { room: t, userId: o });
|
|
763
763
|
});
|
|
764
|
-
}, it = g.createContext(),
|
|
764
|
+
}, it = g.createContext(), Fr = () => /* @__PURE__ */ T(
|
|
765
765
|
"div",
|
|
766
766
|
{
|
|
767
767
|
style: {
|
|
@@ -773,53 +773,53 @@ const Wr = ({
|
|
|
773
773
|
justifyContent: "center",
|
|
774
774
|
alignItems: "center"
|
|
775
775
|
},
|
|
776
|
-
children: /* @__PURE__ */
|
|
776
|
+
children: /* @__PURE__ */ T("h2", { children: "🌀 Loading..." })
|
|
777
777
|
}
|
|
778
|
-
),
|
|
778
|
+
), rr = ({
|
|
779
779
|
socket: e,
|
|
780
780
|
room: t,
|
|
781
781
|
channel: r = "default",
|
|
782
|
-
LoadingComponent: n =
|
|
782
|
+
LoadingComponent: n = Fr,
|
|
783
783
|
children: o
|
|
784
784
|
}) => {
|
|
785
|
-
const [s, c] = g.useState(!1), [u, l] = g.useState(!1), [
|
|
785
|
+
const [s, c] = g.useState(!1), [u, l] = g.useState(!1), [d, f] = g.useState(null), a = 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
|
-
const
|
|
791
|
+
const E = () => {
|
|
792
792
|
console.log(`Disconnected from ${r}…`), h.current && (c(!1), l(!1));
|
|
793
793
|
};
|
|
794
|
-
return e.on("disconnect",
|
|
795
|
-
e.off("disconnect",
|
|
794
|
+
return e.on("disconnect", E), () => {
|
|
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, Vr({
|
|
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
|
-
onJoined: (
|
|
804
|
-
console.log(`Connected on channel ${r}…`), a.current =
|
|
803
|
+
onJoined: (E) => {
|
|
804
|
+
console.log(`Connected on channel ${r}…`), a.current = E, h.current && (f(E), c(!0));
|
|
805
805
|
}
|
|
806
806
|
})), () => {
|
|
807
|
-
var
|
|
808
|
-
(
|
|
809
|
-
}) : null, [r, t, e]), !s || !
|
|
807
|
+
var E;
|
|
808
|
+
(E = a.current) == null || E.leave();
|
|
809
|
+
}) : null, [r, t, e]), !s || !d ? /* @__PURE__ */ T(n, {}) : /* @__PURE__ */ T(
|
|
810
810
|
it.Provider,
|
|
811
811
|
{
|
|
812
|
-
value: { ...
|
|
812
|
+
value: { ..._, [r]: { wire: d, joined: s, isMaster: u, room: t } },
|
|
813
813
|
children: o
|
|
814
814
|
}
|
|
815
815
|
);
|
|
816
816
|
}, Xe = (e = "default") => (_e(it) || {})[e], Dt = (e) => {
|
|
817
817
|
let t;
|
|
818
|
-
const r = /* @__PURE__ */ new Set(), n = (l,
|
|
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
821
|
const a = t;
|
|
822
|
-
t =
|
|
822
|
+
t = d ?? typeof f != "object" ? f : Object.assign({}, t, f), r.forEach((h) => h(t, a));
|
|
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(
|
|
@@ -828,14 +828,14 @@ const Wr = ({
|
|
|
828
828
|
} };
|
|
829
829
|
return t = e(n, o, u), u;
|
|
830
830
|
}, Ue = (e) => e ? Dt(e) : Dt;
|
|
831
|
-
var at = {},
|
|
831
|
+
var at = {}, Kr = {
|
|
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 = {}, Hr = {
|
|
839
839
|
get exports() {
|
|
840
840
|
return Ye;
|
|
841
841
|
},
|
|
@@ -853,7 +853,7 @@ var at = {}, Fr = {
|
|
|
853
853
|
* LICENSE file in the root directory of this source tree.
|
|
854
854
|
*/
|
|
855
855
|
var jt;
|
|
856
|
-
function
|
|
856
|
+
function qr() {
|
|
857
857
|
if (jt)
|
|
858
858
|
return et;
|
|
859
859
|
jt = 1;
|
|
@@ -863,29 +863,29 @@ function Hr() {
|
|
|
863
863
|
}
|
|
864
864
|
var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, o = e.useEffect, s = e.useLayoutEffect, c = e.useDebugValue;
|
|
865
865
|
function u(a, h) {
|
|
866
|
-
var
|
|
866
|
+
var _ = h(), v = n({ inst: { value: _, getSnapshot: h } }), E = v[0].inst, I = v[1];
|
|
867
867
|
return s(function() {
|
|
868
|
-
|
|
869
|
-
}, [a,
|
|
870
|
-
return l(
|
|
871
|
-
l(
|
|
868
|
+
E.value = _, E.getSnapshot = h, l(E) && I({ inst: E });
|
|
869
|
+
}, [a, _, h]), o(function() {
|
|
870
|
+
return l(E) && I({ inst: E }), a(function() {
|
|
871
|
+
l(E) && I({ inst: E });
|
|
872
872
|
});
|
|
873
|
-
}, [a]), c(
|
|
873
|
+
}, [a]), c(_), _;
|
|
874
874
|
}
|
|
875
875
|
function l(a) {
|
|
876
876
|
var h = a.getSnapshot;
|
|
877
877
|
a = a.value;
|
|
878
878
|
try {
|
|
879
|
-
var
|
|
880
|
-
return !r(a,
|
|
879
|
+
var _ = h();
|
|
880
|
+
return !r(a, _);
|
|
881
881
|
} catch {
|
|
882
882
|
return !0;
|
|
883
883
|
}
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function d(a, h) {
|
|
886
886
|
return h();
|
|
887
887
|
}
|
|
888
|
-
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ?
|
|
888
|
+
var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : u;
|
|
889
889
|
return et.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : f, et;
|
|
890
890
|
}
|
|
891
891
|
var tt = {};
|
|
@@ -899,81 +899,81 @@ var tt = {};
|
|
|
899
899
|
* LICENSE file in the root directory of this source tree.
|
|
900
900
|
*/
|
|
901
901
|
var $t;
|
|
902
|
-
function
|
|
902
|
+
function Gr() {
|
|
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
|
|
908
|
+
for (var p = arguments.length, C = new Array(p > 1 ? p - 1 : 0), m = 1; m < p; m++)
|
|
909
909
|
C[m - 1] = arguments[m];
|
|
910
910
|
n("error", x, C);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
function n(x,
|
|
913
|
+
function n(x, p, C) {
|
|
914
914
|
{
|
|
915
|
-
var m = t.ReactDebugCurrentFrame,
|
|
916
|
-
|
|
917
|
-
var
|
|
918
|
-
return String(
|
|
915
|
+
var m = t.ReactDebugCurrentFrame, S = m.getStackAddendum();
|
|
916
|
+
S !== "" && (p += "%s", C = C.concat([S]));
|
|
917
|
+
var O = C.map(function(k) {
|
|
918
|
+
return String(k);
|
|
919
919
|
});
|
|
920
|
-
|
|
920
|
+
O.unshift("Warning: " + p), Function.prototype.apply.call(console[x], console, O);
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
function o(x,
|
|
924
|
-
return x ===
|
|
923
|
+
function o(x, p) {
|
|
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, c = e.useState, u = e.useEffect, l = e.useLayoutEffect,
|
|
927
|
-
function h(x,
|
|
926
|
+
var s = typeof Object.is == "function" ? Object.is : o, c = e.useState, u = e.useEffect, l = e.useLayoutEffect, d = e.useDebugValue, f = !1, a = !1;
|
|
927
|
+
function h(x, p, C) {
|
|
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
|
-
var m =
|
|
929
|
+
var m = p();
|
|
930
930
|
if (!a) {
|
|
931
|
-
var
|
|
932
|
-
s(m,
|
|
931
|
+
var S = p();
|
|
932
|
+
s(m, S) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), a = !0);
|
|
933
933
|
}
|
|
934
|
-
var
|
|
934
|
+
var O = c({
|
|
935
935
|
inst: {
|
|
936
936
|
value: m,
|
|
937
|
-
getSnapshot:
|
|
937
|
+
getSnapshot: p
|
|
938
938
|
}
|
|
939
|
-
}),
|
|
939
|
+
}), k = O[0].inst, D = O[1];
|
|
940
940
|
return l(function() {
|
|
941
|
-
|
|
942
|
-
inst:
|
|
941
|
+
k.value = m, k.getSnapshot = p, _(k) && D({
|
|
942
|
+
inst: k
|
|
943
943
|
});
|
|
944
|
-
}, [x, m,
|
|
945
|
-
|
|
946
|
-
inst:
|
|
944
|
+
}, [x, m, p]), u(function() {
|
|
945
|
+
_(k) && D({
|
|
946
|
+
inst: k
|
|
947
947
|
});
|
|
948
948
|
var M = function() {
|
|
949
|
-
|
|
950
|
-
inst:
|
|
949
|
+
_(k) && D({
|
|
950
|
+
inst: k
|
|
951
951
|
});
|
|
952
952
|
};
|
|
953
953
|
return x(M);
|
|
954
|
-
}, [x]),
|
|
954
|
+
}, [x]), d(m), m;
|
|
955
955
|
}
|
|
956
|
-
function
|
|
957
|
-
var
|
|
956
|
+
function _(x) {
|
|
957
|
+
var p = x.getSnapshot, C = x.value;
|
|
958
958
|
try {
|
|
959
|
-
var m =
|
|
959
|
+
var m = p();
|
|
960
960
|
return !s(C, m);
|
|
961
961
|
} catch {
|
|
962
962
|
return !0;
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
|
-
function v(x,
|
|
966
|
-
return
|
|
965
|
+
function v(x, p, C) {
|
|
966
|
+
return p();
|
|
967
967
|
}
|
|
968
|
-
var
|
|
968
|
+
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", I = !E, y = I ? v : h, w = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
|
|
969
969
|
tt.useSyncExternalStore = w, 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 nr() {
|
|
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 = qr() : e.exports = Gr();
|
|
976
|
+
}(Hr)), Ye;
|
|
977
977
|
}
|
|
978
978
|
/**
|
|
979
979
|
* @license React
|
|
@@ -985,48 +985,48 @@ function rr() {
|
|
|
985
985
|
* LICENSE file in the root directory of this source tree.
|
|
986
986
|
*/
|
|
987
987
|
var Lt;
|
|
988
|
-
function
|
|
988
|
+
function Jr() {
|
|
989
989
|
if (Lt)
|
|
990
990
|
return Qe;
|
|
991
991
|
Lt = 1;
|
|
992
|
-
var e = g, t =
|
|
993
|
-
function r(
|
|
994
|
-
return
|
|
992
|
+
var e = g, t = nr();
|
|
993
|
+
function r(d, f) {
|
|
994
|
+
return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
|
|
995
995
|
}
|
|
996
996
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, c = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
997
|
-
return Qe.useSyncExternalStoreWithSelector = function(
|
|
997
|
+
return Qe.useSyncExternalStoreWithSelector = function(d, f, a, h, _) {
|
|
998
998
|
var v = s(null);
|
|
999
999
|
if (v.current === null) {
|
|
1000
|
-
var
|
|
1001
|
-
v.current =
|
|
1000
|
+
var E = { hasValue: !1, value: null };
|
|
1001
|
+
v.current = E;
|
|
1002
1002
|
} else
|
|
1003
|
-
|
|
1003
|
+
E = v.current;
|
|
1004
1004
|
v = u(function() {
|
|
1005
|
-
function
|
|
1005
|
+
function y(m) {
|
|
1006
1006
|
if (!w) {
|
|
1007
|
-
if (w = !0, x = m, m = h(m),
|
|
1008
|
-
var
|
|
1009
|
-
if (S
|
|
1010
|
-
return
|
|
1007
|
+
if (w = !0, x = m, m = h(m), _ !== void 0 && E.hasValue) {
|
|
1008
|
+
var S = E.value;
|
|
1009
|
+
if (_(S, m))
|
|
1010
|
+
return p = S;
|
|
1011
1011
|
}
|
|
1012
|
-
return
|
|
1012
|
+
return p = m;
|
|
1013
1013
|
}
|
|
1014
|
-
if (
|
|
1015
|
-
return
|
|
1016
|
-
var
|
|
1017
|
-
return
|
|
1014
|
+
if (S = p, n(x, m))
|
|
1015
|
+
return S;
|
|
1016
|
+
var O = h(m);
|
|
1017
|
+
return _ !== void 0 && _(S, O) ? S : (x = m, p = O);
|
|
1018
1018
|
}
|
|
1019
|
-
var w = !1, x,
|
|
1019
|
+
var w = !1, x, p, C = a === void 0 ? null : a;
|
|
1020
1020
|
return [function() {
|
|
1021
|
-
return
|
|
1021
|
+
return y(f());
|
|
1022
1022
|
}, C === null ? void 0 : function() {
|
|
1023
|
-
return
|
|
1023
|
+
return y(C());
|
|
1024
1024
|
}];
|
|
1025
|
-
}, [f, a, h,
|
|
1026
|
-
var
|
|
1025
|
+
}, [f, a, h, _]);
|
|
1026
|
+
var I = o(d, v[0], v[1]);
|
|
1027
1027
|
return c(function() {
|
|
1028
|
-
|
|
1029
|
-
}, [
|
|
1028
|
+
E.hasValue = !0, E.value = I;
|
|
1029
|
+
}, [I]), l(I), I;
|
|
1030
1030
|
}, Qe;
|
|
1031
1031
|
}
|
|
1032
1032
|
var rt = {};
|
|
@@ -1040,89 +1040,89 @@ var rt = {};
|
|
|
1040
1040
|
* LICENSE file in the root directory of this source tree.
|
|
1041
1041
|
*/
|
|
1042
1042
|
var zt;
|
|
1043
|
-
function
|
|
1043
|
+
function Zr() {
|
|
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 =
|
|
1046
|
+
var e = g, t = nr();
|
|
1047
1047
|
function r(f, a) {
|
|
1048
1048
|
return f === a && (f !== 0 || 1 / f === 1 / a) || f !== f && a !== a;
|
|
1049
1049
|
}
|
|
1050
1050
|
var n = typeof Object.is == "function" ? Object.is : r, o = t.useSyncExternalStore, s = e.useRef, c = e.useEffect, u = e.useMemo, l = e.useDebugValue;
|
|
1051
|
-
function
|
|
1052
|
-
var
|
|
1053
|
-
|
|
1051
|
+
function d(f, a, h, _, v) {
|
|
1052
|
+
var E = s(null), I;
|
|
1053
|
+
E.current === null ? (I = {
|
|
1054
1054
|
hasValue: !1,
|
|
1055
1055
|
value: null
|
|
1056
|
-
},
|
|
1057
|
-
var
|
|
1058
|
-
var C = !1, m,
|
|
1056
|
+
}, E.current = I) : I = E.current;
|
|
1057
|
+
var y = u(function() {
|
|
1058
|
+
var C = !1, m, S, O = function(L) {
|
|
1059
1059
|
if (!C) {
|
|
1060
|
-
C = !0, m =
|
|
1061
|
-
var
|
|
1062
|
-
if (v !== void 0 &&
|
|
1063
|
-
var W =
|
|
1064
|
-
if (v(W,
|
|
1065
|
-
return
|
|
1060
|
+
C = !0, m = L;
|
|
1061
|
+
var N = _(L);
|
|
1062
|
+
if (v !== void 0 && I.hasValue) {
|
|
1063
|
+
var W = I.value;
|
|
1064
|
+
if (v(W, N))
|
|
1065
|
+
return S = W, W;
|
|
1066
1066
|
}
|
|
1067
|
-
return
|
|
1067
|
+
return S = N, N;
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
if (n(
|
|
1071
|
-
return
|
|
1072
|
-
var
|
|
1073
|
-
return v !== void 0 && v(
|
|
1074
|
-
},
|
|
1075
|
-
return
|
|
1076
|
-
}, M =
|
|
1077
|
-
return
|
|
1069
|
+
var J = m, P = S;
|
|
1070
|
+
if (n(J, L))
|
|
1071
|
+
return P;
|
|
1072
|
+
var $ = _(L);
|
|
1073
|
+
return v !== void 0 && v(P, $) ? P : (m = L, S = $, $);
|
|
1074
|
+
}, k = h === void 0 ? null : h, D = function() {
|
|
1075
|
+
return O(a());
|
|
1076
|
+
}, M = k === null ? void 0 : function() {
|
|
1077
|
+
return O(k());
|
|
1078
1078
|
};
|
|
1079
1079
|
return [D, M];
|
|
1080
|
-
}, [a, h,
|
|
1080
|
+
}, [a, h, _, v]), w = y[0], x = y[1], p = o(f, w, x);
|
|
1081
1081
|
return c(function() {
|
|
1082
|
-
|
|
1083
|
-
}, [
|
|
1082
|
+
I.hasValue = !0, I.value = p;
|
|
1083
|
+
}, [p]), l(p), p;
|
|
1084
1084
|
}
|
|
1085
|
-
rt.useSyncExternalStoreWithSelector =
|
|
1085
|
+
rt.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
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 = Jr() : e.exports = Zr();
|
|
1090
|
+
})(Kr);
|
|
1091
|
+
const Qr = /* @__PURE__ */ zr(at), { useSyncExternalStoreWithSelector: en } = Qr;
|
|
1092
1092
|
function We(e, t = e.getState, r) {
|
|
1093
|
-
const n =
|
|
1093
|
+
const n = en(
|
|
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 Lr(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
|
+
}, or = (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
1109
|
const c = (e - o) / r, u = (t - s) / r;
|
|
1110
|
-
return
|
|
1110
|
+
return or(c, u, -n);
|
|
1111
1111
|
}, Be = ([e, t], { scale: r, rotate: n, translateX: o, translateY: s }) => {
|
|
1112
|
-
const [c, u] =
|
|
1112
|
+
const [c, u] = or(e, t, n);
|
|
1113
1113
|
return [c * r + o, u * r + s];
|
|
1114
1114
|
}, Yt = (e, t, r, n) => {
|
|
1115
|
-
const o = e.x, s = e.y, c = t.x, u = t.y, l = r.x,
|
|
1116
|
-
if (
|
|
1115
|
+
const o = e.x, s = e.y, c = t.x, u = t.y, l = r.x, d = r.y, f = c - o, a = u - s, h = o - l, _ = s - d, v = f * f + a * a, E = 2 * (h * f + _ * a), I = h * h + _ * _ - n * n, y = E * E - 4 * v * I;
|
|
1116
|
+
if (y < 0)
|
|
1117
1117
|
return [];
|
|
1118
|
-
const w = (-
|
|
1119
|
-
return w >= 0 && w <= 1 &&
|
|
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 w = (-E + Math.sqrt(y)) / (2 * v), x = (-E - Math.sqrt(y)) / (2 * v), p = [];
|
|
1119
|
+
return w >= 0 && w <= 1 && p.push({ x: o + w * f, y: s + w * a }), x >= 0 && x <= 1 && p.push({ x: o + x * f, y: s + x * a }), 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, tn = (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
|
+
}), rn = (e, t) => {
|
|
1124
1124
|
const r = t.getBoundingClientRect();
|
|
1125
|
-
return
|
|
1125
|
+
return tn(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,43 +1135,43 @@ 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
|
+
}, nn = (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: c, right: u, top: l, bottom:
|
|
1143
|
+
const { left: c, right: u, top: l, bottom: d } = s.getBoundingClientRect();
|
|
1144
1144
|
let f;
|
|
1145
1145
|
return n ? f = n : f = {
|
|
1146
1146
|
left: c,
|
|
1147
1147
|
top: l,
|
|
1148
1148
|
right: u,
|
|
1149
|
-
bottom:
|
|
1150
|
-
}, f.left = Math.min(c, f.left), f.top = Math.min(l, f.top), f.right = Math.max(u, f.right), f.bottom = Math.max(
|
|
1149
|
+
bottom: d
|
|
1150
|
+
}, f.left = Math.min(c, 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
|
+
}, on = ({ x: e, y: t, width: r, height: n }, { type: o = "grid", size: s = 1, offset: c = { x: 0, y: 0 } }) => {
|
|
1154
1154
|
const [u, l] = [
|
|
1155
1155
|
e + r / 2 - c.x,
|
|
1156
1156
|
t + n / 2 - c.y
|
|
1157
1157
|
];
|
|
1158
|
-
let
|
|
1158
|
+
let d, f, a, h, _, v, E, I, y, w;
|
|
1159
1159
|
const x = s / 1.1547;
|
|
1160
1160
|
switch (o) {
|
|
1161
1161
|
case "grid":
|
|
1162
|
-
|
|
1162
|
+
d = Math.round(u / s) * s, f = Math.round(l / s) * s;
|
|
1163
1163
|
break;
|
|
1164
1164
|
case "hexH":
|
|
1165
|
-
a = 2 * x, h = 3 * s,
|
|
1165
|
+
a = 2 * x, h = 3 * s, _ = Math.round(u / a) * a, 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), w = Math.hypot(v - u, I - l), y < w ? (d = _, f = E) : (d = v, f = I);
|
|
1166
1166
|
break;
|
|
1167
1167
|
case "hexV":
|
|
1168
|
-
a = 3 * s, h = 2 * x,
|
|
1168
|
+
a = 3 * s, h = 2 * x, _ = Math.round(u / a) * a, 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), w = Math.hypot(v - u, I - l), y < w ? (d = _, f = E) : (d = v, f = I);
|
|
1169
1169
|
break;
|
|
1170
1170
|
default:
|
|
1171
|
-
|
|
1171
|
+
d = e + r / 2, f = t + n / 2;
|
|
1172
1172
|
}
|
|
1173
1173
|
return {
|
|
1174
|
-
x:
|
|
1174
|
+
x: d + c.x - r / 2,
|
|
1175
1175
|
y: f + c.y - n / 2
|
|
1176
1176
|
};
|
|
1177
1177
|
}, Bt = [
|
|
@@ -1205,13 +1205,13 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1205
1205
|
"#007a4b",
|
|
1206
1206
|
"#bf0daa",
|
|
1207
1207
|
"#af0ad8"
|
|
1208
|
-
], Nt = () => Bt[Math.floor(Math.random() * Bt.length)],
|
|
1208
|
+
], Nt = () => Bt[Math.floor(Math.random() * Bt.length)], sn = !1, dt = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, o) => (s, c, u) => {
|
|
1209
1209
|
s({ ready: !1 });
|
|
1210
1210
|
const l = [];
|
|
1211
1211
|
(async () => {
|
|
1212
1212
|
try {
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1213
|
+
const _ = await e.call(`${t}_getValue`);
|
|
1214
|
+
sn && console.log("init from peer with value", _), s((v) => ({ ...v, ..._ }));
|
|
1215
1215
|
} catch {
|
|
1216
1216
|
n !== void 0 && s(n);
|
|
1217
1217
|
}
|
|
@@ -1220,26 +1220,26 @@ const ye = (e, t) => e.classList && e.classList.contains(t), Oe = (e, t) => ye(e
|
|
|
1220
1220
|
`${t}_getValue`,
|
|
1221
1221
|
() => Object.fromEntries(
|
|
1222
1222
|
Object.entries(c()).filter(
|
|
1223
|
-
([
|
|
1223
|
+
([_, v]) => typeof v != "function" && !r.includes(_)
|
|
1224
1224
|
)
|
|
1225
1225
|
),
|
|
1226
1226
|
{ invoke: "first" }
|
|
1227
1227
|
)
|
|
1228
1228
|
), l.push(
|
|
1229
|
-
e.subscribe(`${t}_call`, ([
|
|
1230
|
-
a[
|
|
1229
|
+
e.subscribe(`${t}_call`, ([_, v]) => {
|
|
1230
|
+
a[_](...v);
|
|
1231
1231
|
})
|
|
1232
1232
|
), s({ ready: !0 });
|
|
1233
1233
|
})();
|
|
1234
1234
|
const f = o(s, c, u), a = { ...f }, h = Object.fromEntries(
|
|
1235
1235
|
// Send the update message on all method calls
|
|
1236
|
-
Object.entries(f).map(([
|
|
1237
|
-
const
|
|
1238
|
-
return e.publish(`${t}_call`, [
|
|
1239
|
-
}] : [
|
|
1236
|
+
Object.entries(f).map(([_, v]) => typeof v == "function" && !_.startsWith("get") && !r.includes(_) ? [_, (...I) => {
|
|
1237
|
+
const y = v(...I);
|
|
1238
|
+
return e.publish(`${t}_call`, [_, I]), y;
|
|
1239
|
+
}] : [_, v])
|
|
1240
1240
|
);
|
|
1241
1241
|
return h.unsub = () => {
|
|
1242
|
-
l.forEach((
|
|
1242
|
+
l.forEach((_) => _());
|
|
1243
1243
|
}, h;
|
|
1244
1244
|
};
|
|
1245
1245
|
function Ve(e, t) {
|
|
@@ -1271,7 +1271,7 @@ function Ve(e, t) {
|
|
|
1271
1271
|
return !1;
|
|
1272
1272
|
return !0;
|
|
1273
1273
|
}
|
|
1274
|
-
const
|
|
1274
|
+
const sr = g.createContext(), an = (e, t) => ({
|
|
1275
1275
|
items: {},
|
|
1276
1276
|
getItems: () => t().items,
|
|
1277
1277
|
setItems: (r) => e({ items: r }),
|
|
@@ -1288,7 +1288,7 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1288
1288
|
});
|
|
1289
1289
|
}), { items: s };
|
|
1290
1290
|
})
|
|
1291
|
-
}),
|
|
1291
|
+
}), cn = (e, t) => ({
|
|
1292
1292
|
itemIds: [],
|
|
1293
1293
|
setItemIds: (r) => e({ itemIds: r }),
|
|
1294
1294
|
getItemIds: () => t().itemIds,
|
|
@@ -1307,7 +1307,7 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1307
1307
|
updateManyItemIds: (r) => e((n) => ({
|
|
1308
1308
|
items: n.itemIds.map((o, s) => r[s] !== void 0 ? r[s] : o)
|
|
1309
1309
|
}))
|
|
1310
|
-
}),
|
|
1310
|
+
}), un = (e, t) => ({
|
|
1311
1311
|
removeItemsById: (r) => e((n) => ({
|
|
1312
1312
|
itemIds: n.itemIds.filter((o) => !r.includes(o)),
|
|
1313
1313
|
items: Object.fromEntries(
|
|
@@ -1340,12 +1340,12 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1340
1340
|
itemIds: s
|
|
1341
1341
|
};
|
|
1342
1342
|
})
|
|
1343
|
-
}),
|
|
1343
|
+
}), ln = (e, t) => ({
|
|
1344
1344
|
boardConfig: {},
|
|
1345
1345
|
getBoardConfig: () => t().boardConfig,
|
|
1346
1346
|
setBoardConfig: (r) => e({ boardConfig: r }),
|
|
1347
1347
|
updateBoardConfig: (r) => e((n) => ({ boardConfig: { ...n.boardConfig, ...r } }))
|
|
1348
|
-
}),
|
|
1348
|
+
}), fn = (e, t) => ({
|
|
1349
1349
|
session: {},
|
|
1350
1350
|
getSessionInfo: () => t().session,
|
|
1351
1351
|
setSessionInfo: (r) => e({ session: r }),
|
|
@@ -1354,11 +1354,11 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1354
1354
|
const { wire: n } = Xe("room"), [o, s] = g.useState(!1), [c] = g.useState(
|
|
1355
1355
|
() => Ue(
|
|
1356
1356
|
dt({ wire: n, storeName: e, defaultValue: r }, (...u) => ({
|
|
1357
|
-
...sn(...u),
|
|
1358
1357
|
...an(...u),
|
|
1359
1358
|
...cn(...u),
|
|
1360
1359
|
...un(...u),
|
|
1361
|
-
...ln(...u)
|
|
1360
|
+
...ln(...u),
|
|
1361
|
+
...fn(...u)
|
|
1362
1362
|
}))
|
|
1363
1363
|
)
|
|
1364
1364
|
);
|
|
@@ -1366,12 +1366,12 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1366
1366
|
const u = c.subscribe((l) => {
|
|
1367
1367
|
l.ready && (u(), s(!0));
|
|
1368
1368
|
});
|
|
1369
|
-
}, [c]), o ? /* @__PURE__ */
|
|
1370
|
-
},
|
|
1371
|
-
const r = _e(
|
|
1369
|
+
}, [c]), o ? /* @__PURE__ */ T(sr.Provider, { value: c, children: t }) : null;
|
|
1370
|
+
}, re = (e, t) => {
|
|
1371
|
+
const r = _e(sr);
|
|
1372
1372
|
return We(r, e, t || Ve);
|
|
1373
1373
|
}, ts = () => {
|
|
1374
|
-
const [e, t] =
|
|
1374
|
+
const [e, t] = re((n) => [
|
|
1375
1375
|
n.itemIds,
|
|
1376
1376
|
n.items
|
|
1377
1377
|
]);
|
|
@@ -1380,7 +1380,7 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1380
1380
|
[e, t]
|
|
1381
1381
|
);
|
|
1382
1382
|
}, rs = () => {
|
|
1383
|
-
const [e, t, r] =
|
|
1383
|
+
const [e, t, r] = re((c) => [
|
|
1384
1384
|
c.items,
|
|
1385
1385
|
c.itemIds,
|
|
1386
1386
|
c.getItemList
|
|
@@ -1391,19 +1391,19 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1391
1391
|
o(c);
|
|
1392
1392
|
});
|
|
1393
1393
|
}, [e, t, r]), n;
|
|
1394
|
-
},
|
|
1394
|
+
}, ir = 5e4, ar = g.createContext(), dn = (e, t) => ({
|
|
1395
1395
|
config: {
|
|
1396
1396
|
itemTemplates: {},
|
|
1397
1397
|
actions: {},
|
|
1398
1398
|
uid: null,
|
|
1399
1399
|
itemExtent: { x: 0, y: 0, radius: 0 },
|
|
1400
1400
|
boardWrapperRect: {},
|
|
1401
|
-
boardSize:
|
|
1401
|
+
boardSize: ir
|
|
1402
1402
|
},
|
|
1403
1403
|
// TODO optimize when same values as before
|
|
1404
1404
|
updateConfiguration: (r) => e((n) => ({ config: { ...n.config, ...r } })),
|
|
1405
1405
|
getConfiguration: () => t().config
|
|
1406
|
-
}),
|
|
1406
|
+
}), pn = (e, t) => ({
|
|
1407
1407
|
boardState: {
|
|
1408
1408
|
movingItems: !1,
|
|
1409
1409
|
selecting: !1,
|
|
@@ -1417,13 +1417,13 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1417
1417
|
// TODO optimize when same values as before
|
|
1418
1418
|
updateBoardState: (r) => e((n) => ({ boardState: { ...n.boardState, ...r } })),
|
|
1419
1419
|
getBoardState: () => t().boardState
|
|
1420
|
-
}),
|
|
1420
|
+
}), mn = (e, t) => ({
|
|
1421
1421
|
interactions: {},
|
|
1422
1422
|
getInteractions: () => t().interactions,
|
|
1423
1423
|
register: (r, n) => e((o) => {
|
|
1424
1424
|
const s = [...o.interactions[r] || []];
|
|
1425
1425
|
return s.push(n), {
|
|
1426
|
-
interactions: { ...o.
|
|
1426
|
+
interactions: { ...o.interactions, [r]: s }
|
|
1427
1427
|
};
|
|
1428
1428
|
}),
|
|
1429
1429
|
unregister: (r, n) => e((o) => {
|
|
@@ -1431,7 +1431,7 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1431
1431
|
(c) => c !== n
|
|
1432
1432
|
);
|
|
1433
1433
|
return {
|
|
1434
|
-
interactions: { ...o.
|
|
1434
|
+
interactions: { ...o.interactions, [r]: s }
|
|
1435
1435
|
};
|
|
1436
1436
|
}),
|
|
1437
1437
|
callInteractions: (r, n) => {
|
|
@@ -1439,7 +1439,7 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1439
1439
|
o(n);
|
|
1440
1440
|
});
|
|
1441
1441
|
}
|
|
1442
|
-
}),
|
|
1442
|
+
}), gn = (e, t) => ({
|
|
1443
1443
|
selection: [],
|
|
1444
1444
|
setSelection: (r) => e((n) => JSON.stringify(n.selection) !== JSON.stringify(r) ? { selection: r } : {}),
|
|
1445
1445
|
getSelection: () => t().selection,
|
|
@@ -1462,15 +1462,15 @@ const or = g.createContext(), sn = (e, t) => ({
|
|
|
1462
1462
|
}), Ut = ({ children: e }) => {
|
|
1463
1463
|
const [t] = g.useState(
|
|
1464
1464
|
() => Ue((...r) => ({
|
|
1465
|
-
...fn(...r),
|
|
1466
1465
|
...dn(...r),
|
|
1467
1466
|
...pn(...r),
|
|
1468
|
-
...mn(...r)
|
|
1467
|
+
...mn(...r),
|
|
1468
|
+
...gn(...r)
|
|
1469
1469
|
}))
|
|
1470
1470
|
);
|
|
1471
|
-
return /* @__PURE__ */
|
|
1471
|
+
return /* @__PURE__ */ T(ar.Provider, { value: t, children: e });
|
|
1472
1472
|
}, Z = (e, t) => {
|
|
1473
|
-
const r = _e(
|
|
1473
|
+
const r = _e(ar);
|
|
1474
1474
|
return We(r, e, t || Ve);
|
|
1475
1475
|
}, ns = () => {
|
|
1476
1476
|
const [e] = Z((t) => [t.selection]);
|
|
@@ -1484,7 +1484,7 @@ function pt(e) {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
}), []);
|
|
1486
1486
|
}
|
|
1487
|
-
function
|
|
1487
|
+
function hn(e) {
|
|
1488
1488
|
const t = pt(e);
|
|
1489
1489
|
Pe(
|
|
1490
1490
|
() => () => {
|
|
@@ -1498,26 +1498,26 @@ function mt(e, t, r, n = 0) {
|
|
|
1498
1498
|
const o = Re(), s = Re(), c = Re(), u = () => {
|
|
1499
1499
|
o.current && (clearTimeout(o.current), o.current = void 0), s.current && (clearTimeout(s.current), s.current = void 0);
|
|
1500
1500
|
};
|
|
1501
|
-
return
|
|
1501
|
+
return hn(u), lt(
|
|
1502
1502
|
() => {
|
|
1503
1503
|
const l = () => {
|
|
1504
1504
|
if (!c.current)
|
|
1505
1505
|
return;
|
|
1506
1506
|
const f = c.current;
|
|
1507
1507
|
c.current = void 0, e.apply(f.this, f.args), u();
|
|
1508
|
-
},
|
|
1508
|
+
}, d = function(...f) {
|
|
1509
1509
|
o.current && clearTimeout(o.current), c.current = { args: f, this: this }, o.current = setTimeout(l, r), n > 0 && !s.current && (s.current = setTimeout(l, n));
|
|
1510
1510
|
};
|
|
1511
|
-
return Object.defineProperties(
|
|
1511
|
+
return Object.defineProperties(d, {
|
|
1512
1512
|
length: { value: e.length },
|
|
1513
1513
|
name: { value: `${e.name || "anonymous"}__debounced__${r}` }
|
|
1514
|
-
}),
|
|
1514
|
+
}), d;
|
|
1515
1515
|
},
|
|
1516
1516
|
// eslint-disable-next-line react-hooks/exhaustive-deps,@typescript-eslint/no-unsafe-assignment
|
|
1517
1517
|
[r, n, ...t]
|
|
1518
1518
|
);
|
|
1519
1519
|
}
|
|
1520
|
-
const
|
|
1520
|
+
const vn = 100, yn = 1e3, Sn = 0.8, _n = ({
|
|
1521
1521
|
x: e,
|
|
1522
1522
|
y: t,
|
|
1523
1523
|
scale: r,
|
|
@@ -1527,7 +1527,7 @@ const hn = 100, vn = 1e3, yn = 0.8, Sn = ({
|
|
|
1527
1527
|
boardSize: c
|
|
1528
1528
|
}) => {
|
|
1529
1529
|
let [u, l] = [e, t];
|
|
1530
|
-
const
|
|
1530
|
+
const d = ct(
|
|
1531
1531
|
[s.width / 2, s.height / 2],
|
|
1532
1532
|
{ translateX: u, translateY: l, scale: r, rotate: n }
|
|
1533
1533
|
), f = {
|
|
@@ -1536,14 +1536,14 @@ const hn = 100, vn = 1e3, yn = 0.8, Sn = ({
|
|
|
1536
1536
|
}, a = {
|
|
1537
1537
|
x: c / 2,
|
|
1538
1538
|
y: c / 2
|
|
1539
|
-
}, h = ze(
|
|
1539
|
+
}, h = ze(d, [f.x, f.y]), _ = Math.min(s.width, s.height), v = o.radius + _ / 2 / r - vn / r;
|
|
1540
1540
|
if (h > v) {
|
|
1541
|
-
const
|
|
1542
|
-
{ x:
|
|
1541
|
+
const y = Yt(
|
|
1542
|
+
{ x: d[0], y: d[1] },
|
|
1543
1543
|
f,
|
|
1544
1544
|
f,
|
|
1545
1545
|
v - 1 / r
|
|
1546
|
-
)[0], [w, x] = Be([-
|
|
1546
|
+
)[0], [w, x] = Be([-y.x, -y.y], {
|
|
1547
1547
|
translateX: s.width / 2,
|
|
1548
1548
|
translateY: s.height / 2,
|
|
1549
1549
|
scale: r,
|
|
@@ -1551,16 +1551,16 @@ const hn = 100, vn = 1e3, yn = 0.8, Sn = ({
|
|
|
1551
1551
|
});
|
|
1552
1552
|
u = w, l = x;
|
|
1553
1553
|
}
|
|
1554
|
-
const
|
|
1555
|
-
if (
|
|
1556
|
-
const
|
|
1557
|
-
{ x:
|
|
1554
|
+
const E = ze(d, [a.x, a.y]), I = c / 2 - ze([0, 0], [s.width, s.height]) / r;
|
|
1555
|
+
if (E > I) {
|
|
1556
|
+
const y = Yt(
|
|
1557
|
+
{ x: d[0], y: d[1] },
|
|
1558
1558
|
a,
|
|
1559
1559
|
a,
|
|
1560
|
-
|
|
1560
|
+
I - 1 / r
|
|
1561
1561
|
)[0];
|
|
1562
|
-
if (
|
|
1563
|
-
const [w, x] = Be([-
|
|
1562
|
+
if (y) {
|
|
1563
|
+
const [w, x] = Be([-y.x, -y.y], {
|
|
1564
1564
|
translateX: s.width / 2,
|
|
1565
1565
|
translateY: s.height / 2,
|
|
1566
1566
|
scale: r,
|
|
@@ -1577,64 +1577,64 @@ const hn = 100, vn = 1e3, yn = 0.8, Sn = ({
|
|
|
1577
1577
|
r,
|
|
1578
1578
|
n,
|
|
1579
1579
|
o
|
|
1580
|
-
] = Z((
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
]), s = g.useRef([0.15, 5]), [c] =
|
|
1587
|
-
const { translateX:
|
|
1588
|
-
return { translateX:
|
|
1580
|
+
] = Z((p) => [
|
|
1581
|
+
p.getBoardState,
|
|
1582
|
+
p.updateBoardState,
|
|
1583
|
+
p.config.itemExtent,
|
|
1584
|
+
p.getConfiguration,
|
|
1585
|
+
p.updateConfiguration
|
|
1586
|
+
]), s = g.useRef([0.15, 5]), [c] = re((p) => [p.getItemList]), u = g.useCallback(() => {
|
|
1587
|
+
const { translateX: p, translateY: C, scale: m, rotate: S } = e();
|
|
1588
|
+
return { translateX: p, translateY: C, scale: m, rotate: S };
|
|
1589
1589
|
}, [e]), l = g.useCallback(
|
|
1590
|
-
(
|
|
1590
|
+
(p, C) => ct([p, C], e()),
|
|
1591
1591
|
[e]
|
|
1592
|
-
),
|
|
1593
|
-
(
|
|
1592
|
+
), d = g.useCallback(
|
|
1593
|
+
(p, C) => Be([p, C], e()),
|
|
1594
1594
|
[e]
|
|
1595
1595
|
), f = g.useCallback(
|
|
1596
|
-
(
|
|
1597
|
-
const { scale: m, rotate:
|
|
1598
|
-
return ct([
|
|
1596
|
+
(p, C) => {
|
|
1597
|
+
const { scale: m, rotate: S } = e();
|
|
1598
|
+
return ct([p, C], {
|
|
1599
1599
|
translateX: 0,
|
|
1600
1600
|
translateY: 0,
|
|
1601
|
-
rotate:
|
|
1601
|
+
rotate: S,
|
|
1602
1602
|
scale: m
|
|
1603
1603
|
});
|
|
1604
1604
|
},
|
|
1605
1605
|
[e]
|
|
1606
|
-
), a = g.useCallback((
|
|
1607
|
-
(
|
|
1608
|
-
const { itemExtent: C, boardWrapperRect: m, boardSize:
|
|
1609
|
-
translateX:
|
|
1606
|
+
), a = g.useCallback((p) => p > s.current[1] ? s.current[1] : p < s.current[0] ? s.current[0] : p, []), h = g.useCallback(
|
|
1607
|
+
(p) => {
|
|
1608
|
+
const { itemExtent: C, boardWrapperRect: m, boardSize: S } = n(), O = e(), {
|
|
1609
|
+
translateX: k,
|
|
1610
1610
|
translateY: D,
|
|
1611
1611
|
scale: M,
|
|
1612
|
-
rotate:
|
|
1612
|
+
rotate: L
|
|
1613
1613
|
} = {
|
|
1614
|
-
...
|
|
1615
|
-
...
|
|
1616
|
-
},
|
|
1617
|
-
let [W,
|
|
1618
|
-
(
|
|
1619
|
-
x:
|
|
1614
|
+
...O,
|
|
1615
|
+
...p(O)
|
|
1616
|
+
}, N = a(M);
|
|
1617
|
+
let [W, J] = [k, D];
|
|
1618
|
+
(k !== O.translateX || D !== O.translateY) && ([W, J] = _n({
|
|
1619
|
+
x: k,
|
|
1620
1620
|
y: D,
|
|
1621
|
-
scale:
|
|
1622
|
-
rotate:
|
|
1621
|
+
scale: N,
|
|
1622
|
+
rotate: L,
|
|
1623
1623
|
itemExtent: C,
|
|
1624
1624
|
boardWrapperRect: m,
|
|
1625
|
-
boardSize:
|
|
1625
|
+
boardSize: S
|
|
1626
1626
|
})), t({
|
|
1627
1627
|
translateX: W,
|
|
1628
|
-
translateY:
|
|
1629
|
-
scale:
|
|
1630
|
-
rotate:
|
|
1628
|
+
translateY: J,
|
|
1629
|
+
scale: N,
|
|
1630
|
+
rotate: L
|
|
1631
1631
|
});
|
|
1632
1632
|
},
|
|
1633
1633
|
[a, e, n, t]
|
|
1634
|
-
),
|
|
1635
|
-
(
|
|
1636
|
-
let C = (m) => ({ ...m, ...
|
|
1637
|
-
typeof
|
|
1634
|
+
), _ = g.useCallback(
|
|
1635
|
+
(p) => {
|
|
1636
|
+
let C = (m) => ({ ...m, ...p });
|
|
1637
|
+
typeof p == "function" && (C = p), h((m) => ({
|
|
1638
1638
|
...m,
|
|
1639
1639
|
...C({
|
|
1640
1640
|
translateX: m.translateX,
|
|
@@ -1644,56 +1644,56 @@ const hn = 100, vn = 1e3, yn = 0.8, Sn = ({
|
|
|
1644
1644
|
},
|
|
1645
1645
|
[h]
|
|
1646
1646
|
), v = g.useCallback(
|
|
1647
|
-
({ to:
|
|
1647
|
+
({ to: p, factor: C }) => {
|
|
1648
1648
|
const { boardWrapperRect: m } = n();
|
|
1649
|
-
let
|
|
1650
|
-
|
|
1649
|
+
let S = p;
|
|
1650
|
+
S || (S = {
|
|
1651
1651
|
x: m.left + m.width / 2,
|
|
1652
1652
|
y: m.top + m.height / 2
|
|
1653
1653
|
});
|
|
1654
|
-
const
|
|
1654
|
+
const O = e(), k = a(O.scale * C), D = S.x - m.left, M = S.y - m.top, L = D - (D - O.translateX) * k / O.scale, N = M - (M - O.translateY) * k / O.scale;
|
|
1655
1655
|
h((W) => ({
|
|
1656
1656
|
...W,
|
|
1657
|
-
translateX:
|
|
1658
|
-
translateY:
|
|
1659
|
-
scale:
|
|
1657
|
+
translateX: L,
|
|
1658
|
+
translateY: N,
|
|
1659
|
+
scale: k
|
|
1660
1660
|
}));
|
|
1661
1661
|
},
|
|
1662
1662
|
[a, e, n, h]
|
|
1663
|
-
),
|
|
1664
|
-
({ x:
|
|
1665
|
-
const { rotate:
|
|
1666
|
-
[-
|
|
1663
|
+
), E = g.useCallback(
|
|
1664
|
+
({ x: p, y: C, radius: m }) => {
|
|
1665
|
+
const { rotate: S } = e(), { boardWrapperRect: O, boardSize: k } = n(), D = O.width / (m * 2), M = O.height / (m * 2), L = a(Math.min(D, M) * Sn), [N, W] = Be(
|
|
1666
|
+
[-k / 2 - p, -k / 2 - C],
|
|
1667
1667
|
{
|
|
1668
|
-
translateX:
|
|
1669
|
-
translateY:
|
|
1670
|
-
scale:
|
|
1671
|
-
rotate:
|
|
1668
|
+
translateX: O.width / 2,
|
|
1669
|
+
translateY: O.height / 2,
|
|
1670
|
+
scale: L,
|
|
1671
|
+
rotate: S
|
|
1672
1672
|
}
|
|
1673
1673
|
);
|
|
1674
|
-
h((
|
|
1674
|
+
h((J) => ({ ...J, translateX: N, translateY: W, scale: L }));
|
|
1675
1675
|
},
|
|
1676
1676
|
[a, e, n, h]
|
|
1677
|
-
),
|
|
1678
|
-
const { boardWrapperRect:
|
|
1679
|
-
|
|
1680
|
-
|
|
1677
|
+
), I = g.useCallback(() => {
|
|
1678
|
+
const { boardWrapperRect: p, boardSize: C } = n(), [m, S] = l(
|
|
1679
|
+
p.width / 2,
|
|
1680
|
+
p.height / 2
|
|
1681
1681
|
);
|
|
1682
1682
|
return {
|
|
1683
1683
|
x: m - C / 2,
|
|
1684
|
-
y:
|
|
1684
|
+
y: S - C / 2
|
|
1685
1685
|
};
|
|
1686
|
-
}, [l, n]),
|
|
1687
|
-
const
|
|
1688
|
-
(
|
|
1686
|
+
}, [l, n]), y = g.useCallback(() => {
|
|
1687
|
+
const p = c(), { boardWrapper: C, boardSize: m } = n(), S = p.reduce(
|
|
1688
|
+
(k, D) => {
|
|
1689
1689
|
const M = Ne(C, D.id);
|
|
1690
|
-
return
|
|
1690
|
+
return k.left = Math.min(D.x, k.left), k.top = Math.min(D.y, k.top), k.right = Math.max(
|
|
1691
1691
|
D.x + M.offsetWidth,
|
|
1692
|
-
|
|
1693
|
-
),
|
|
1692
|
+
k.right
|
|
1693
|
+
), k.bottom = Math.max(
|
|
1694
1694
|
D.y + M.offsetHeight,
|
|
1695
|
-
|
|
1696
|
-
),
|
|
1695
|
+
k.bottom
|
|
1696
|
+
), k;
|
|
1697
1697
|
},
|
|
1698
1698
|
{
|
|
1699
1699
|
left: m / 2,
|
|
@@ -1701,40 +1701,40 @@ const hn = 100, vn = 1e3, yn = 0.8, Sn = ({
|
|
|
1701
1701
|
right: -m / 2,
|
|
1702
1702
|
bottom: -m / 2
|
|
1703
1703
|
}
|
|
1704
|
-
),
|
|
1705
|
-
x: (
|
|
1706
|
-
y: (
|
|
1704
|
+
), O = {
|
|
1705
|
+
x: (S.right + S.left) / 2,
|
|
1706
|
+
y: (S.bottom + S.top) / 2
|
|
1707
1707
|
};
|
|
1708
|
-
|
|
1709
|
-
ze([
|
|
1710
|
-
|
|
1711
|
-
), o({ itemExtent:
|
|
1708
|
+
O.radius = Math.max(
|
|
1709
|
+
ze([O.x, O.y], [S.left, S.top]),
|
|
1710
|
+
yn
|
|
1711
|
+
), o({ itemExtent: O });
|
|
1712
1712
|
}, [n, c, o]), w = g.useCallback(
|
|
1713
|
-
(
|
|
1714
|
-
let C = () =>
|
|
1715
|
-
typeof
|
|
1713
|
+
(p) => {
|
|
1714
|
+
let C = () => p;
|
|
1715
|
+
typeof p == "function" && (C = p), h((m) => ({ ...m, rotate: C(m.rotate) })), y(), E(r);
|
|
1716
1716
|
},
|
|
1717
|
-
[r, h,
|
|
1717
|
+
[r, h, y, E]
|
|
1718
1718
|
), x = mt(
|
|
1719
|
-
() =>
|
|
1720
|
-
[
|
|
1719
|
+
() => y(),
|
|
1720
|
+
[y],
|
|
1721
1721
|
200
|
|
1722
1722
|
);
|
|
1723
1723
|
return {
|
|
1724
1724
|
setDim: h,
|
|
1725
1725
|
rotateBoard: w,
|
|
1726
|
-
moveBoard:
|
|
1726
|
+
moveBoard: _,
|
|
1727
1727
|
getDim: u,
|
|
1728
1728
|
zoomTo: v,
|
|
1729
1729
|
zoomToCenter: v,
|
|
1730
|
-
zoomToExtent:
|
|
1731
|
-
getCenter:
|
|
1730
|
+
zoomToExtent: E,
|
|
1731
|
+
getCenter: I,
|
|
1732
1732
|
updateItemExtent: x,
|
|
1733
1733
|
vectorFromWrapperToBoard: f,
|
|
1734
1734
|
fromWrapperToBoard: l,
|
|
1735
|
-
fromBoardToWrapper:
|
|
1735
|
+
fromBoardToWrapper: d
|
|
1736
1736
|
};
|
|
1737
|
-
},
|
|
1737
|
+
}, Wt = (e) => {
|
|
1738
1738
|
const [t, r, n] = Z(
|
|
1739
1739
|
({ register: c, unregister: u, callInteractions: l }) => [
|
|
1740
1740
|
c,
|
|
@@ -1754,208 +1754,217 @@ const hn = 100, vn = 1e3, yn = 0.8, Sn = ({
|
|
|
1754
1754
|
);
|
|
1755
1755
|
return { register: o, call: s };
|
|
1756
1756
|
}, gt = () => {
|
|
1757
|
-
const { call: e } =
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1757
|
+
const { call: e } = Wt("place"), { call: t } = Wt("delete"), { getCenter: r, updateItemExtent: n } = Me(), [o, s, c, u] = Z((P) => [
|
|
1758
|
+
P.clear,
|
|
1759
|
+
P.reverse,
|
|
1760
|
+
P.unselect,
|
|
1761
|
+
P.getConfiguration
|
|
1762
1762
|
]), {
|
|
1763
|
-
getItems:
|
|
1764
|
-
getItemIds:
|
|
1765
|
-
setItemIds:
|
|
1766
|
-
updateItems:
|
|
1767
|
-
moveItems:
|
|
1768
|
-
removeItemsById:
|
|
1769
|
-
getItemList:
|
|
1770
|
-
insertItems:
|
|
1771
|
-
setItemList:
|
|
1772
|
-
} =
|
|
1763
|
+
getItems: l,
|
|
1764
|
+
getItemIds: d,
|
|
1765
|
+
setItemIds: f,
|
|
1766
|
+
updateItems: a,
|
|
1767
|
+
moveItems: h,
|
|
1768
|
+
removeItemsById: _,
|
|
1769
|
+
getItemList: v,
|
|
1770
|
+
insertItems: E,
|
|
1771
|
+
setItemList: I
|
|
1772
|
+
} = re(
|
|
1773
1773
|
({
|
|
1774
|
-
getItems:
|
|
1774
|
+
getItems: P,
|
|
1775
1775
|
getItemIds: $,
|
|
1776
|
-
setItemIds:
|
|
1776
|
+
setItemIds: B,
|
|
1777
1777
|
updateItems: U,
|
|
1778
|
-
moveItems:
|
|
1778
|
+
moveItems: A,
|
|
1779
1779
|
removeItemsById: F,
|
|
1780
|
-
getItemList:
|
|
1781
|
-
insertItems:
|
|
1782
|
-
setItemList:
|
|
1780
|
+
getItemList: K,
|
|
1781
|
+
insertItems: ee,
|
|
1782
|
+
setItemList: oe
|
|
1783
1783
|
}) => ({
|
|
1784
|
-
getItems:
|
|
1784
|
+
getItems: P,
|
|
1785
1785
|
getItemIds: $,
|
|
1786
|
-
setItemIds:
|
|
1786
|
+
setItemIds: B,
|
|
1787
1787
|
updateItems: U,
|
|
1788
|
-
moveItems:
|
|
1788
|
+
moveItems: A,
|
|
1789
1789
|
removeItemsById: F,
|
|
1790
|
-
getItemList:
|
|
1791
|
-
insertItems:
|
|
1792
|
-
setItemList:
|
|
1790
|
+
getItemList: K,
|
|
1791
|
+
insertItems: ee,
|
|
1792
|
+
setItemList: oe
|
|
1793
1793
|
})
|
|
1794
|
-
),
|
|
1795
|
-
(
|
|
1796
|
-
let
|
|
1797
|
-
typeof $ == "object" && (
|
|
1798
|
-
const U =
|
|
1799
|
-
U.map((
|
|
1794
|
+
), y = g.useCallback(
|
|
1795
|
+
(P, $) => {
|
|
1796
|
+
let B = $;
|
|
1797
|
+
typeof $ == "object" && (B = () => $);
|
|
1798
|
+
const U = d().filter((K) => P.includes(K)), A = l(), F = Object.fromEntries(
|
|
1799
|
+
U.map((K) => [K, B({ ...A[K] })])
|
|
1800
1800
|
);
|
|
1801
|
-
|
|
1802
|
-
},
|
|
1803
|
-
[l, u, r, f]
|
|
1804
|
-
), E = g.useCallback(
|
|
1805
|
-
(O) => {
|
|
1806
|
-
b(O), n(), r();
|
|
1801
|
+
a(F), n();
|
|
1807
1802
|
},
|
|
1808
|
-
[
|
|
1803
|
+
[d, l, n, a]
|
|
1809
1804
|
), w = g.useCallback(
|
|
1810
|
-
(
|
|
1811
|
-
|
|
1805
|
+
(P) => {
|
|
1806
|
+
I(P), o(), n();
|
|
1812
1807
|
},
|
|
1813
|
-
[
|
|
1808
|
+
[o, I, n]
|
|
1814
1809
|
), x = g.useCallback(
|
|
1815
|
-
(
|
|
1816
|
-
|
|
1810
|
+
(P, $) => {
|
|
1811
|
+
y([P], $);
|
|
1817
1812
|
},
|
|
1818
|
-
[
|
|
1819
|
-
),
|
|
1820
|
-
(
|
|
1821
|
-
const
|
|
1822
|
-
|
|
1823
|
-
);
|
|
1824
|
-
p([...L, ...U]);
|
|
1813
|
+
[y]
|
|
1814
|
+
), p = g.useCallback(
|
|
1815
|
+
(P, $) => {
|
|
1816
|
+
const B = l(), U = P.map((A) => [A, ...B[A].linkedItems || []]).flat();
|
|
1817
|
+
h(U, $), n();
|
|
1825
1818
|
},
|
|
1826
|
-
[l,
|
|
1819
|
+
[l, h, n]
|
|
1827
1820
|
), C = g.useCallback(
|
|
1828
|
-
(
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1821
|
+
(P) => {
|
|
1822
|
+
const $ = d(), B = $.filter((A) => !P.includes(A)), U = $.filter(
|
|
1823
|
+
(A) => P.includes(A)
|
|
1824
|
+
);
|
|
1825
|
+
f([...B, ...U]);
|
|
1826
|
+
},
|
|
1827
|
+
[d, f]
|
|
1828
|
+
), m = g.useCallback(
|
|
1829
|
+
(P, { type: $, size: B } = {}) => {
|
|
1830
|
+
const { boardWrapper: U } = u();
|
|
1831
|
+
y(P, (A) => {
|
|
1832
|
+
const F = Ne(U, A.id);
|
|
1833
|
+
if (!F)
|
|
1833
1834
|
return;
|
|
1834
|
-
const
|
|
1835
|
+
const K = {
|
|
1835
1836
|
type: $ || "grid",
|
|
1836
|
-
size:
|
|
1837
|
+
size: B || 1,
|
|
1837
1838
|
offset: { x: 0, y: 0 },
|
|
1838
|
-
...
|
|
1839
|
-
},
|
|
1839
|
+
...A.grid
|
|
1840
|
+
}, ee = on(
|
|
1840
1841
|
{
|
|
1841
|
-
x:
|
|
1842
|
-
y:
|
|
1843
|
-
width:
|
|
1844
|
-
height:
|
|
1842
|
+
x: A.x,
|
|
1843
|
+
y: A.y,
|
|
1844
|
+
width: F.clientWidth,
|
|
1845
|
+
height: F.clientHeight
|
|
1845
1846
|
},
|
|
1846
|
-
|
|
1847
|
+
K
|
|
1847
1848
|
);
|
|
1848
|
-
|
|
1849
|
-
})
|
|
1849
|
+
return { ...A, ...ee };
|
|
1850
|
+
});
|
|
1850
1851
|
},
|
|
1851
|
-
[
|
|
1852
|
-
),
|
|
1853
|
-
(
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1852
|
+
[u, y]
|
|
1853
|
+
), S = g.useCallback(
|
|
1854
|
+
(P, $) => {
|
|
1855
|
+
const B = l(), U = P.map((A) => [A, ...B[A].linkedItems || []]).flat();
|
|
1856
|
+
C(U), y(U, (A) => {
|
|
1857
|
+
const F = { ...A };
|
|
1858
|
+
return delete F.moving, F;
|
|
1859
|
+
}), m(U, $), e(P), n();
|
|
1858
1860
|
},
|
|
1859
1861
|
[
|
|
1860
|
-
|
|
1862
|
+
y,
|
|
1861
1863
|
e,
|
|
1862
|
-
|
|
1864
|
+
l,
|
|
1863
1865
|
C,
|
|
1864
|
-
|
|
1866
|
+
m,
|
|
1867
|
+
n
|
|
1865
1868
|
]
|
|
1866
|
-
),
|
|
1867
|
-
(
|
|
1868
|
-
|
|
1869
|
+
), O = g.useCallback(
|
|
1870
|
+
(P) => {
|
|
1871
|
+
f(P);
|
|
1869
1872
|
},
|
|
1870
|
-
[
|
|
1871
|
-
),
|
|
1872
|
-
(
|
|
1873
|
-
const $ =
|
|
1874
|
-
(
|
|
1875
|
-
), U = $.map((
|
|
1876
|
-
|
|
1873
|
+
[f]
|
|
1874
|
+
), k = g.useCallback(
|
|
1875
|
+
(P) => {
|
|
1876
|
+
const $ = d(), B = $.filter(
|
|
1877
|
+
(A) => P.includes(A)
|
|
1878
|
+
), U = $.map((A) => P.includes(A) ? B.pop() : A);
|
|
1879
|
+
f(U), s();
|
|
1877
1880
|
},
|
|
1878
|
-
[
|
|
1879
|
-
), P = g.useCallback(
|
|
1880
|
-
(O, $) => {
|
|
1881
|
-
const L = u(), U = O.map((K) => L[K]), N = $.map((K) => L[K]), F = $.reduce((K, ee) => (K[ee] = U.shift(), K), {}), J = N.reduce((K, ee) => {
|
|
1882
|
-
const fe = F[ee.id], ge = {
|
|
1883
|
-
...ee,
|
|
1884
|
-
x: fe.x,
|
|
1885
|
-
y: fe.y
|
|
1886
|
-
};
|
|
1887
|
-
return K[ee.id] = ge, K;
|
|
1888
|
-
}, {});
|
|
1889
|
-
f(J);
|
|
1890
|
-
const te = O.reduce((K, ee) => (K[ee] = $.shift(), K), {}), ne = l().map((K) => O.includes(K) ? te[K] : K);
|
|
1891
|
-
p(ne);
|
|
1892
|
-
},
|
|
1893
|
-
[u, f, l, p]
|
|
1881
|
+
[d, s, f]
|
|
1894
1882
|
), D = g.useCallback(
|
|
1895
|
-
(
|
|
1896
|
-
const
|
|
1897
|
-
|
|
1883
|
+
(P, $) => {
|
|
1884
|
+
const B = l(), U = Object.fromEntries(
|
|
1885
|
+
$.map((K, ee) => {
|
|
1886
|
+
const oe = B[P[ee]];
|
|
1887
|
+
return [
|
|
1888
|
+
K,
|
|
1889
|
+
{
|
|
1890
|
+
x: oe.x,
|
|
1891
|
+
y: oe.y
|
|
1892
|
+
}
|
|
1893
|
+
];
|
|
1894
|
+
})
|
|
1895
|
+
);
|
|
1896
|
+
y(P, (K) => ({ ...K, ...U[K.id] }));
|
|
1897
|
+
const A = Object.fromEntries(
|
|
1898
|
+
P.map((K, ee) => [K, $[ee]])
|
|
1899
|
+
), F = d().map((K) => P.includes(K) ? A[K] : K);
|
|
1900
|
+
f(F);
|
|
1898
1901
|
},
|
|
1899
|
-
[
|
|
1902
|
+
[l, y, d, f]
|
|
1900
1903
|
), M = g.useCallback(
|
|
1901
|
-
(
|
|
1902
|
-
|
|
1904
|
+
(P, $) => {
|
|
1905
|
+
const B = r(), U = P.map((A, F) => !A.x || !A.y ? { ...A, x: B.x + 2 * F, y: B.y + 2 * F } : A);
|
|
1906
|
+
E(U, $), n();
|
|
1903
1907
|
},
|
|
1904
|
-
[
|
|
1905
|
-
),
|
|
1906
|
-
(
|
|
1907
|
-
|
|
1908
|
+
[r, E, n]
|
|
1909
|
+
), L = g.useCallback(
|
|
1910
|
+
(P, $) => {
|
|
1911
|
+
M([P], $);
|
|
1908
1912
|
},
|
|
1909
|
-
[
|
|
1910
|
-
),
|
|
1911
|
-
(
|
|
1912
|
-
|
|
1913
|
-
return O.map((L) => $[L]);
|
|
1913
|
+
[M]
|
|
1914
|
+
), N = g.useCallback(
|
|
1915
|
+
(P) => {
|
|
1916
|
+
c(P), _(P), t(P);
|
|
1914
1917
|
},
|
|
1915
|
-
[
|
|
1918
|
+
[c, _, t]
|
|
1916
1919
|
), W = g.useCallback(
|
|
1917
|
-
(
|
|
1918
|
-
|
|
1920
|
+
(P) => {
|
|
1921
|
+
const $ = l();
|
|
1922
|
+
return P.map((B) => $[B]);
|
|
1923
|
+
},
|
|
1924
|
+
[l]
|
|
1925
|
+
), J = g.useCallback(
|
|
1926
|
+
({ target: P, clientX: $, clientY: B }, { returnLocked: U = !1, passLocked: A = !1 } = {}) => {
|
|
1927
|
+
if (["INPUT", "TEXTAREA"].includes(P.tagName))
|
|
1919
1928
|
return null;
|
|
1920
|
-
const F = Oe(
|
|
1929
|
+
const F = Oe(P, "item");
|
|
1921
1930
|
if (F) {
|
|
1922
1931
|
if (ye(F, "selected"))
|
|
1923
1932
|
return F;
|
|
1924
|
-
if (!
|
|
1933
|
+
if (!A && ye(F, "locked") && !ye(P, "passthrough"))
|
|
1925
1934
|
return U ? F : null;
|
|
1926
|
-
if (ye(
|
|
1927
|
-
const
|
|
1928
|
-
const
|
|
1929
|
-
return ft({ x: $, y:
|
|
1935
|
+
if (ye(P, "passthrough")) {
|
|
1936
|
+
const K = d(), { boardWrapper: ee } = u(), oe = K.reduce((le, se) => {
|
|
1937
|
+
const me = Ne(ee, se), ge = me.getBoundingClientRect();
|
|
1938
|
+
return ft({ x: $, y: B }, ge) && le.unshift(me), le;
|
|
1930
1939
|
}, []);
|
|
1931
|
-
for (let
|
|
1932
|
-
const
|
|
1933
|
-
if (
|
|
1934
|
-
return
|
|
1940
|
+
for (let le = 0; le < oe.length; le += 1) {
|
|
1941
|
+
const se = oe[le];
|
|
1942
|
+
if (se !== F && (A || !ye(se, "locked")))
|
|
1943
|
+
return se;
|
|
1935
1944
|
}
|
|
1936
1945
|
return null;
|
|
1937
1946
|
}
|
|
1938
1947
|
}
|
|
1939
1948
|
return F;
|
|
1940
1949
|
},
|
|
1941
|
-
[
|
|
1950
|
+
[u, d]
|
|
1942
1951
|
);
|
|
1943
1952
|
return {
|
|
1944
|
-
putItemsOnTop:
|
|
1945
|
-
batchUpdateItems:
|
|
1946
|
-
updateItemOrder:
|
|
1947
|
-
moveItems:
|
|
1948
|
-
placeItems:
|
|
1949
|
-
updateItem:
|
|
1950
|
-
swapItems:
|
|
1951
|
-
reverseItemsOrder:
|
|
1952
|
-
setItemList:
|
|
1953
|
-
pushItem:
|
|
1954
|
-
pushItems:
|
|
1955
|
-
removeItems:
|
|
1956
|
-
getItemList:
|
|
1957
|
-
findElementUnderPointer:
|
|
1958
|
-
getItems:
|
|
1953
|
+
putItemsOnTop: C,
|
|
1954
|
+
batchUpdateItems: y,
|
|
1955
|
+
updateItemOrder: O,
|
|
1956
|
+
moveItems: p,
|
|
1957
|
+
placeItems: S,
|
|
1958
|
+
updateItem: x,
|
|
1959
|
+
swapItems: D,
|
|
1960
|
+
reverseItemsOrder: k,
|
|
1961
|
+
setItemList: w,
|
|
1962
|
+
pushItem: L,
|
|
1963
|
+
pushItems: M,
|
|
1964
|
+
removeItems: N,
|
|
1965
|
+
getItemList: v,
|
|
1966
|
+
findElementUnderPointer: J,
|
|
1967
|
+
getItems: W
|
|
1959
1968
|
};
|
|
1960
1969
|
};
|
|
1961
1970
|
var bn = function e(t, r) {
|
|
@@ -2029,11 +2038,11 @@ const Cn = (e, t) => {
|
|
|
2029
2038
|
return typeof r == "function" ? r(e) : r;
|
|
2030
2039
|
}
|
|
2031
2040
|
return [];
|
|
2032
|
-
},
|
|
2041
|
+
}, Vt = (e, t) => {
|
|
2033
2042
|
const { actions: r = Cn(e, t) } = e;
|
|
2034
2043
|
return r.map((n) => typeof n == "string" ? { name: n } : n);
|
|
2035
2044
|
}, os = () => {
|
|
2036
|
-
const [e, t] =
|
|
2045
|
+
const [e, t] = re((a) => [
|
|
2037
2046
|
a.items,
|
|
2038
2047
|
a.getItems
|
|
2039
2048
|
]), [r, n, o] = Z((a) => [
|
|
@@ -2044,34 +2053,34 @@ const Cn = (e, t) => {
|
|
|
2044
2053
|
g.useEffect(() => (u.current = !0, () => {
|
|
2045
2054
|
u.current = !1;
|
|
2046
2055
|
}), []);
|
|
2047
|
-
const
|
|
2056
|
+
const d = g.useCallback(
|
|
2048
2057
|
(a) => {
|
|
2049
2058
|
const h = t();
|
|
2050
2059
|
if (a)
|
|
2051
2060
|
return [a, a.map((v) => h[v])];
|
|
2052
|
-
const
|
|
2053
|
-
return [
|
|
2061
|
+
const _ = o();
|
|
2062
|
+
return [_, _.map((v) => h[v])];
|
|
2054
2063
|
},
|
|
2055
2064
|
[t, o]
|
|
2056
|
-
), f =
|
|
2057
|
-
const [a, h] =
|
|
2065
|
+
), f = er(() => {
|
|
2066
|
+
const [a, h] = d();
|
|
2058
2067
|
if (a.length > 0) {
|
|
2059
2068
|
if (!u.current)
|
|
2060
2069
|
return;
|
|
2061
|
-
const
|
|
2062
|
-
const
|
|
2070
|
+
const _ = h.reduce((v, E) => {
|
|
2071
|
+
const I = Vt(E, r);
|
|
2063
2072
|
return v.filter(
|
|
2064
|
-
(
|
|
2073
|
+
(y) => I.some((w) => bn(y, w))
|
|
2065
2074
|
);
|
|
2066
|
-
},
|
|
2075
|
+
}, Vt(h[0], r));
|
|
2067
2076
|
l(() => {
|
|
2068
|
-
c(
|
|
2077
|
+
c(_);
|
|
2069
2078
|
});
|
|
2070
2079
|
} else
|
|
2071
2080
|
l(() => {
|
|
2072
2081
|
c([]);
|
|
2073
2082
|
});
|
|
2074
|
-
}, [
|
|
2083
|
+
}, [d, r]);
|
|
2075
2084
|
return En(
|
|
2076
2085
|
() => f(),
|
|
2077
2086
|
[e, n, f],
|
|
@@ -2083,15 +2092,15 @@ const Cn = (e, t) => {
|
|
|
2083
2092
|
const [e] = Z((t) => [t.selectionBox]);
|
|
2084
2093
|
return e;
|
|
2085
2094
|
};
|
|
2086
|
-
let
|
|
2087
|
-
const
|
|
2095
|
+
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 cr = g.createContext(), ut = (e) => {
|
|
2088
2097
|
localStorage.setItem("user", JSON.stringify(e));
|
|
2089
2098
|
}, wn = () => {
|
|
2090
2099
|
if (localStorage.user) {
|
|
2091
2100
|
const t = {
|
|
2092
2101
|
name: "Player",
|
|
2093
2102
|
color: Nt(),
|
|
2094
|
-
uid:
|
|
2103
|
+
uid: pe(),
|
|
2095
2104
|
...JSON.parse(localStorage.user)
|
|
2096
2105
|
};
|
|
2097
2106
|
return ut(t), t;
|
|
@@ -2099,7 +2108,7 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2099
2108
|
const e = {
|
|
2100
2109
|
name: "Player",
|
|
2101
2110
|
color: Nt(),
|
|
2102
|
-
uid:
|
|
2111
|
+
uid: pe()
|
|
2103
2112
|
};
|
|
2104
2113
|
return ut(e), e;
|
|
2105
2114
|
}, xn = (e) => (t, r) => ({
|
|
@@ -2154,10 +2163,10 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2154
2163
|
const n = { ...r.cursors };
|
|
2155
2164
|
return delete n[t], { cursors: n };
|
|
2156
2165
|
})
|
|
2157
|
-
}),
|
|
2166
|
+
}), ur = ({ storeName: e, children: t }) => {
|
|
2158
2167
|
const { wire: r, isMaster: n } = Xe("room"), [o, s] = g.useState(null), [c, u] = g.useState(!1), l = g.useRef(!1);
|
|
2159
2168
|
return g.useEffect(() => {
|
|
2160
|
-
let
|
|
2169
|
+
let d = !0;
|
|
2161
2170
|
const f = [];
|
|
2162
2171
|
if (!o && !l.current)
|
|
2163
2172
|
return l.current = !0, (() => {
|
|
@@ -2178,11 +2187,11 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2178
2187
|
...Rn(...v)
|
|
2179
2188
|
})
|
|
2180
2189
|
)
|
|
2181
|
-
),
|
|
2182
|
-
v.ready && (
|
|
2190
|
+
), _ = h.subscribe((v) => {
|
|
2191
|
+
v.ready && (_(), d && s(h));
|
|
2183
2192
|
});
|
|
2184
2193
|
})(), () => {
|
|
2185
|
-
|
|
2194
|
+
d = !1, l.current = !1, f.forEach((h) => h());
|
|
2186
2195
|
};
|
|
2187
2196
|
}, [o, e, r, r.userId]), g.useEffect(() => {
|
|
2188
2197
|
if (o)
|
|
@@ -2194,18 +2203,18 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2194
2203
|
};
|
|
2195
2204
|
}, [n, o, r]), g.useEffect(() => {
|
|
2196
2205
|
if (o) {
|
|
2197
|
-
const
|
|
2206
|
+
const d = r.subscribe("userLeave", (f) => {
|
|
2198
2207
|
o.getState().removeUser(f);
|
|
2199
2208
|
});
|
|
2200
2209
|
return () => {
|
|
2201
|
-
|
|
2210
|
+
d();
|
|
2202
2211
|
};
|
|
2203
2212
|
}
|
|
2204
2213
|
}, [n, o, r]), g.useEffect(() => {
|
|
2205
2214
|
n && o && o.getState().updateCurrentUser({ isMaster: n });
|
|
2206
|
-
}, [n, o, r]), c ? /* @__PURE__ */
|
|
2215
|
+
}, [n, o, r]), c ? /* @__PURE__ */ T(cr.Provider, { value: o, children: t }) : null;
|
|
2207
2216
|
}, Se = (e, t) => {
|
|
2208
|
-
const r = _e(
|
|
2217
|
+
const r = _e(cr);
|
|
2209
2218
|
return We(r, e, t || Ve);
|
|
2210
2219
|
}, is = () => {
|
|
2211
2220
|
const [e, t, r, n, o] = Se((u) => [
|
|
@@ -2227,7 +2236,7 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2227
2236
|
joinSpace: o
|
|
2228
2237
|
};
|
|
2229
2238
|
}, as = () => {
|
|
2230
|
-
const [e, t, r] =
|
|
2239
|
+
const [e, t, r] = re(
|
|
2231
2240
|
(o) => [o.boardConfig, o.getBoardConfig, o.setBoardConfig]
|
|
2232
2241
|
), n = g.useCallback(
|
|
2233
2242
|
(o) => {
|
|
@@ -2243,18 +2252,18 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2243
2252
|
const [e] = Z((t) => [t.boardState]);
|
|
2244
2253
|
return e;
|
|
2245
2254
|
}, us = () => {
|
|
2246
|
-
const [e, t, r, n] =
|
|
2255
|
+
const [e, t, r, n] = re((o) => [
|
|
2247
2256
|
o.getSessionInfo,
|
|
2248
2257
|
o.setSessionInfo,
|
|
2249
2258
|
o.updateSessionInfo,
|
|
2250
2259
|
o.session
|
|
2251
2260
|
]);
|
|
2252
2261
|
return { getSessionInfo: e, setSessionInfo: t, sessionInfo: n, updateSessionInfo: r };
|
|
2253
|
-
},
|
|
2262
|
+
}, lr = g.createContext(), In = ({ user: { name: e, uid: t, color: r }, content: n }) => ({
|
|
2254
2263
|
type: "message",
|
|
2255
2264
|
user: { name: e, uid: t, color: r },
|
|
2256
2265
|
content: n,
|
|
2257
|
-
uid:
|
|
2266
|
+
uid: pe(),
|
|
2258
2267
|
timestamp: new Date().toISOString()
|
|
2259
2268
|
}), On = (e, t) => ({
|
|
2260
2269
|
messages: [],
|
|
@@ -2277,7 +2286,7 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2277
2286
|
});
|
|
2278
2287
|
o && t().addMessage(o);
|
|
2279
2288
|
}
|
|
2280
|
-
}),
|
|
2289
|
+
}), Ft = ({
|
|
2281
2290
|
storeName: e,
|
|
2282
2291
|
children: t,
|
|
2283
2292
|
defaultValue: r = []
|
|
@@ -2292,9 +2301,9 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2292
2301
|
)
|
|
2293
2302
|
)
|
|
2294
2303
|
);
|
|
2295
|
-
return /* @__PURE__ */
|
|
2304
|
+
return /* @__PURE__ */ T(lr.Provider, { value: o, children: t });
|
|
2296
2305
|
}, Tn = (e, t) => {
|
|
2297
|
-
const r = _e(
|
|
2306
|
+
const r = _e(lr);
|
|
2298
2307
|
return We(r, e, t || Ve);
|
|
2299
2308
|
}, kn = () => {
|
|
2300
2309
|
}, ls = (e = kn) => {
|
|
@@ -2313,7 +2322,7 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2313
2322
|
[t, o]
|
|
2314
2323
|
);
|
|
2315
2324
|
return { messages: r, setMessages: n, sendMessage: s };
|
|
2316
|
-
},
|
|
2325
|
+
}, Kt = ({ children: e, session: t }) => {
|
|
2317
2326
|
const r = Se((n) => n.joinSpace);
|
|
2318
2327
|
return g.useEffect(() => (r(t), () => {
|
|
2319
2328
|
r(null);
|
|
@@ -2327,42 +2336,42 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2327
2336
|
LoadingComponent: s,
|
|
2328
2337
|
...c
|
|
2329
2338
|
}) => {
|
|
2330
|
-
const [u] = g.useState(t ||
|
|
2339
|
+
const [u] = g.useState(t || pe()), [l] = g.useState(r || pe()), [d] = g.useState(() => ({
|
|
2331
2340
|
itemIds: n.map(({ id: a }) => a),
|
|
2332
2341
|
items: Object.fromEntries(n.map((a) => [a.id, a]))
|
|
2333
2342
|
}));
|
|
2334
|
-
return Xe("room") ? /* @__PURE__ */
|
|
2335
|
-
|
|
2343
|
+
return Xe("room") ? /* @__PURE__ */ T(
|
|
2344
|
+
Ft,
|
|
2336
2345
|
{
|
|
2337
2346
|
storeName: `${l}_messages`,
|
|
2338
2347
|
defaultValue: o,
|
|
2339
|
-
children: /* @__PURE__ */
|
|
2348
|
+
children: /* @__PURE__ */ T(Ut, { children: /* @__PURE__ */ T(
|
|
2340
2349
|
Xt,
|
|
2341
2350
|
{
|
|
2342
2351
|
storeName: `${l}_item`,
|
|
2343
|
-
defaultValue:
|
|
2344
|
-
children: /* @__PURE__ */
|
|
2352
|
+
defaultValue: d,
|
|
2353
|
+
children: /* @__PURE__ */ T(Kt, { ...c, session: l })
|
|
2345
2354
|
}
|
|
2346
2355
|
) })
|
|
2347
2356
|
}
|
|
2348
|
-
) : /* @__PURE__ */
|
|
2349
|
-
|
|
2357
|
+
) : /* @__PURE__ */ T(
|
|
2358
|
+
rr,
|
|
2350
2359
|
{
|
|
2351
2360
|
room: u,
|
|
2352
2361
|
channel: "room",
|
|
2353
2362
|
socket: e,
|
|
2354
2363
|
LoadingComponent: s,
|
|
2355
|
-
children: /* @__PURE__ */
|
|
2356
|
-
|
|
2364
|
+
children: /* @__PURE__ */ T(ur, { storeName: `${u}_users`, children: /* @__PURE__ */ T(
|
|
2365
|
+
Ft,
|
|
2357
2366
|
{
|
|
2358
2367
|
storeName: `${l}_messages`,
|
|
2359
2368
|
defaultValue: o,
|
|
2360
|
-
children: /* @__PURE__ */
|
|
2369
|
+
children: /* @__PURE__ */ T(Ut, { children: /* @__PURE__ */ T(
|
|
2361
2370
|
Xt,
|
|
2362
2371
|
{
|
|
2363
2372
|
storeName: `${l}_item`,
|
|
2364
|
-
defaultValue:
|
|
2365
|
-
children: /* @__PURE__ */
|
|
2373
|
+
defaultValue: d,
|
|
2374
|
+
children: /* @__PURE__ */ T(Kt, { ...c, session: l })
|
|
2366
2375
|
}
|
|
2367
2376
|
) })
|
|
2368
2377
|
}
|
|
@@ -2370,15 +2379,15 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2370
2379
|
}
|
|
2371
2380
|
);
|
|
2372
2381
|
}, ds = ({ socket: e, room: t, children: r, LoadingComponent: n }) => {
|
|
2373
|
-
const [o] = g.useState(t ||
|
|
2374
|
-
return /* @__PURE__ */
|
|
2375
|
-
|
|
2382
|
+
const [o] = g.useState(t || pe());
|
|
2383
|
+
return /* @__PURE__ */ T(
|
|
2384
|
+
rr,
|
|
2376
2385
|
{
|
|
2377
2386
|
room: o,
|
|
2378
2387
|
channel: "room",
|
|
2379
2388
|
socket: e,
|
|
2380
2389
|
LoadingComponent: n,
|
|
2381
|
-
children: /* @__PURE__ */
|
|
2390
|
+
children: /* @__PURE__ */ T(ur, { storeName: `${o}_users`, children: r })
|
|
2382
2391
|
}
|
|
2383
2392
|
);
|
|
2384
2393
|
}, nt = () => {
|
|
@@ -2393,13 +2402,13 @@ const ar = g.createContext(), ut = (e) => {
|
|
|
2393
2402
|
), t.close();
|
|
2394
2403
|
const r = t.body.firstElementChild.offsetHeight;
|
|
2395
2404
|
return document.body.removeChild(e), r;
|
|
2396
|
-
}, Mn = Pn(), Dn = 800,
|
|
2405
|
+
}, Mn = Pn(), Dn = 800, Ht = (e, t) => {
|
|
2397
2406
|
const r = Object.keys(e).map((n) => Number(n)).find((n) => n !== t);
|
|
2398
2407
|
return e[r];
|
|
2399
|
-
},
|
|
2408
|
+
}, qt = ([e, t], [r, n]) => {
|
|
2400
2409
|
const o = Math.abs(e - r), s = Math.abs(t - n);
|
|
2401
2410
|
return Math.hypot(o, s);
|
|
2402
|
-
},
|
|
2411
|
+
}, de = () => {
|
|
2403
2412
|
}, jn = (e) => (t) => {
|
|
2404
2413
|
const { event: r } = t;
|
|
2405
2414
|
return r.isPropagationStopped() ? null : e(t);
|
|
@@ -2420,44 +2429,44 @@ class An {
|
|
|
2420
2429
|
});
|
|
2421
2430
|
}
|
|
2422
2431
|
}
|
|
2423
|
-
const
|
|
2432
|
+
const ne = new An(), Fe = ({
|
|
2424
2433
|
children: e,
|
|
2425
|
-
onDrag: t =
|
|
2426
|
-
onDragStart: r =
|
|
2427
|
-
onDragEnd: n =
|
|
2428
|
-
onPan: o =
|
|
2429
|
-
onTap: s =
|
|
2430
|
-
onLongTap: c =
|
|
2431
|
-
onDoubleTap: u =
|
|
2434
|
+
onDrag: t = de,
|
|
2435
|
+
onDragStart: r = de,
|
|
2436
|
+
onDragEnd: n = de,
|
|
2437
|
+
onPan: o = de,
|
|
2438
|
+
onTap: s = de,
|
|
2439
|
+
onLongTap: c = de,
|
|
2440
|
+
onDoubleTap: u = de,
|
|
2432
2441
|
onZoom: l,
|
|
2433
|
-
mainAction:
|
|
2442
|
+
mainAction: d = "drag"
|
|
2434
2443
|
}) => {
|
|
2435
2444
|
const f = g.useRef(null), a = g.useRef({
|
|
2436
2445
|
moving: !1,
|
|
2437
2446
|
pointers: {},
|
|
2438
2447
|
mainPointer: void 0
|
|
2439
|
-
}), h = (
|
|
2448
|
+
}), h = (y) => {
|
|
2440
2449
|
const {
|
|
2441
2450
|
deltaX: w,
|
|
2442
2451
|
deltaY: x,
|
|
2443
|
-
clientX:
|
|
2452
|
+
clientX: p,
|
|
2444
2453
|
clientY: C,
|
|
2445
2454
|
deltaMode: m,
|
|
2446
|
-
ctrlKey:
|
|
2447
|
-
altKey:
|
|
2448
|
-
metaKey:
|
|
2455
|
+
ctrlKey: S,
|
|
2456
|
+
altKey: O,
|
|
2457
|
+
metaKey: k,
|
|
2449
2458
|
target: D
|
|
2450
|
-
} =
|
|
2451
|
-
if (!(
|
|
2452
|
-
if (nt() && !
|
|
2453
|
-
|
|
2459
|
+
} = y;
|
|
2460
|
+
if (!(O || S && !nt()))
|
|
2461
|
+
if (nt() && !S)
|
|
2462
|
+
ne.add(o, {
|
|
2454
2463
|
deltaX: -2 * w,
|
|
2455
2464
|
deltaY: -2 * x,
|
|
2456
2465
|
button: 1,
|
|
2457
|
-
ctrlKey:
|
|
2458
|
-
metaKey:
|
|
2466
|
+
ctrlKey: S,
|
|
2467
|
+
metaKey: k,
|
|
2459
2468
|
target: D,
|
|
2460
|
-
event:
|
|
2469
|
+
event: y
|
|
2461
2470
|
});
|
|
2462
2471
|
else {
|
|
2463
2472
|
if (l === void 0 || !x)
|
|
@@ -2471,40 +2480,40 @@ const ie = new An(), Fe = ({
|
|
|
2471
2480
|
M *= Dn;
|
|
2472
2481
|
break;
|
|
2473
2482
|
}
|
|
2474
|
-
nt() && (M *= 2),
|
|
2483
|
+
nt() && (M *= 2), ne.add(l, { scale: M, clientX: p, clientY: C, event: y });
|
|
2475
2484
|
}
|
|
2476
|
-
},
|
|
2485
|
+
}, _ = (y) => {
|
|
2477
2486
|
const {
|
|
2478
2487
|
target: w,
|
|
2479
2488
|
button: x,
|
|
2480
|
-
clientX:
|
|
2489
|
+
clientX: p,
|
|
2481
2490
|
clientY: C,
|
|
2482
2491
|
pointerId: m,
|
|
2483
|
-
altKey:
|
|
2484
|
-
ctrlKey:
|
|
2485
|
-
metaKey:
|
|
2492
|
+
altKey: S,
|
|
2493
|
+
ctrlKey: O,
|
|
2494
|
+
metaKey: k,
|
|
2486
2495
|
isPrimary: D
|
|
2487
|
-
} =
|
|
2488
|
-
if (a.current.pointers[m] = { clientX:
|
|
2496
|
+
} = y;
|
|
2497
|
+
if (a.current.pointers[m] = { clientX: p, clientY: C }, D && (a.current.mainPointer = void 0), a.current.mainPointer !== void 0) {
|
|
2489
2498
|
if (a.current.mainPointer !== m)
|
|
2490
2499
|
try {
|
|
2491
|
-
const { clientX: M, clientY:
|
|
2500
|
+
const { clientX: M, clientY: L } = Ht(
|
|
2492
2501
|
a.current.pointers,
|
|
2493
2502
|
m
|
|
2494
|
-
),
|
|
2495
|
-
[M,
|
|
2496
|
-
[
|
|
2503
|
+
), N = (M + p) / 2, W = (L + C) / 2, J = qt(
|
|
2504
|
+
[M, L],
|
|
2505
|
+
[p, C]
|
|
2497
2506
|
);
|
|
2498
2507
|
Object.assign(a.current, {
|
|
2499
2508
|
pressed: !0,
|
|
2500
2509
|
moving: !1,
|
|
2501
2510
|
gestureStart: !1,
|
|
2502
|
-
startX:
|
|
2511
|
+
startX: p,
|
|
2503
2512
|
startY: C,
|
|
2504
|
-
prevX:
|
|
2513
|
+
prevX: N,
|
|
2505
2514
|
prevY: W,
|
|
2506
|
-
startDistance:
|
|
2507
|
-
prevDistance:
|
|
2515
|
+
startDistance: J,
|
|
2516
|
+
prevDistance: J
|
|
2508
2517
|
});
|
|
2509
2518
|
} catch (M) {
|
|
2510
2519
|
console.log("Error while getting other pointer. Ignoring", M), a.current.mainPointer;
|
|
@@ -2515,25 +2524,25 @@ const ie = new An(), Fe = ({
|
|
|
2515
2524
|
pressed: !0,
|
|
2516
2525
|
moving: !1,
|
|
2517
2526
|
gestureStart: !1,
|
|
2518
|
-
startX:
|
|
2527
|
+
startX: p,
|
|
2519
2528
|
startY: C,
|
|
2520
|
-
prevX:
|
|
2529
|
+
prevX: p,
|
|
2521
2530
|
prevY: C,
|
|
2522
2531
|
currentButton: x,
|
|
2523
|
-
pointerDownEvent:
|
|
2532
|
+
pointerDownEvent: y,
|
|
2524
2533
|
startDistance: 0,
|
|
2525
2534
|
prevDistance: 0,
|
|
2526
2535
|
target: w,
|
|
2527
2536
|
timeStart: Date.now(),
|
|
2528
2537
|
longTapTimeout: setTimeout(async () => {
|
|
2529
|
-
a.current.noTap = !0,
|
|
2530
|
-
clientX:
|
|
2538
|
+
a.current.noTap = !0, ne.add(c, {
|
|
2539
|
+
clientX: p,
|
|
2531
2540
|
clientY: C,
|
|
2532
|
-
altKey:
|
|
2533
|
-
ctrlKey:
|
|
2534
|
-
metaKey:
|
|
2541
|
+
altKey: S,
|
|
2542
|
+
ctrlKey: O,
|
|
2543
|
+
metaKey: k,
|
|
2535
2544
|
target: w,
|
|
2536
|
-
event:
|
|
2545
|
+
event: y
|
|
2537
2546
|
});
|
|
2538
2547
|
}, 750)
|
|
2539
2548
|
});
|
|
@@ -2542,40 +2551,40 @@ const ie = new An(), Fe = ({
|
|
|
2542
2551
|
} catch (M) {
|
|
2543
2552
|
console.log("Fail to capture pointer", M);
|
|
2544
2553
|
}
|
|
2545
|
-
}, v = (
|
|
2554
|
+
}, v = (y) => {
|
|
2546
2555
|
if (a.current.pressed) {
|
|
2547
2556
|
const {
|
|
2548
2557
|
pointerId: w,
|
|
2549
2558
|
clientX: x,
|
|
2550
|
-
clientY:
|
|
2559
|
+
clientY: p,
|
|
2551
2560
|
altKey: C,
|
|
2552
2561
|
shiftKey: m,
|
|
2553
|
-
ctrlKey:
|
|
2554
|
-
metaKey:
|
|
2555
|
-
buttons:
|
|
2556
|
-
} =
|
|
2562
|
+
ctrlKey: S,
|
|
2563
|
+
metaKey: O,
|
|
2564
|
+
buttons: k
|
|
2565
|
+
} = y;
|
|
2557
2566
|
a.current.pointers[w] = {
|
|
2558
2567
|
clientX: x,
|
|
2559
|
-
clientY:
|
|
2568
|
+
clientY: p
|
|
2560
2569
|
}, a.current.moving = !0;
|
|
2561
2570
|
const D = Object.keys(a.current.pointers).length === 2;
|
|
2562
|
-
let M,
|
|
2571
|
+
let M, L, N = 0;
|
|
2563
2572
|
if (D) {
|
|
2564
|
-
const { clientX:
|
|
2573
|
+
const { clientX: $, clientY: B } = Ht(
|
|
2565
2574
|
a.current.pointers,
|
|
2566
2575
|
w
|
|
2567
2576
|
);
|
|
2568
|
-
M = (
|
|
2569
|
-
[
|
|
2570
|
-
[x,
|
|
2577
|
+
M = ($ + x) / 2, L = (B + p) / 2, N = qt(
|
|
2578
|
+
[$, B],
|
|
2579
|
+
[x, p]
|
|
2571
2580
|
);
|
|
2572
2581
|
} else
|
|
2573
|
-
M = x,
|
|
2574
|
-
let W = m || C ||
|
|
2575
|
-
|
|
2576
|
-
const
|
|
2577
|
-
if (
|
|
2578
|
-
a.current.gestureStart || (f.current.style.cursor = "move", a.current.gestureStart = !0, clearTimeout(a.current.longTapTimeout),
|
|
2582
|
+
M = x, L = p;
|
|
2583
|
+
let W = m || C || S || O || k !== 1;
|
|
2584
|
+
d !== "drag" && (W = !W);
|
|
2585
|
+
const J = !W, P = W;
|
|
2586
|
+
if (J) {
|
|
2587
|
+
a.current.gestureStart || (f.current.style.cursor = "move", a.current.gestureStart = !0, clearTimeout(a.current.longTapTimeout), ne.add(r, {
|
|
2579
2588
|
deltaX: 0,
|
|
2580
2589
|
deltaY: 0,
|
|
2581
2590
|
startX: a.current.startX,
|
|
@@ -2587,68 +2596,68 @@ const ie = new An(), Fe = ({
|
|
|
2587
2596
|
button: a.current.currentButton,
|
|
2588
2597
|
altKey: C,
|
|
2589
2598
|
shiftKey: m,
|
|
2590
|
-
ctrlKey:
|
|
2591
|
-
metaKey:
|
|
2599
|
+
ctrlKey: S,
|
|
2600
|
+
metaKey: O,
|
|
2592
2601
|
target: a.current.target,
|
|
2593
2602
|
event: a.current.pointerDownEvent
|
|
2594
2603
|
}));
|
|
2595
|
-
const
|
|
2596
|
-
|
|
2597
|
-
deltaX:
|
|
2598
|
-
deltaY:
|
|
2604
|
+
const $ = M - a.current.prevX, B = L - a.current.prevY, U = M - a.current.startX, A = L - a.current.startY;
|
|
2605
|
+
ne.add(t, {
|
|
2606
|
+
deltaX: $,
|
|
2607
|
+
deltaY: B,
|
|
2599
2608
|
startX: a.current.startX,
|
|
2600
2609
|
startY: a.current.startY,
|
|
2601
2610
|
clientX: M,
|
|
2602
|
-
clientY:
|
|
2603
|
-
distanceX:
|
|
2604
|
-
distanceY:
|
|
2611
|
+
clientY: L,
|
|
2612
|
+
distanceX: U,
|
|
2613
|
+
distanceY: A,
|
|
2605
2614
|
button: a.current.currentButton,
|
|
2606
2615
|
altKey: C,
|
|
2607
2616
|
shiftKey: m,
|
|
2608
|
-
ctrlKey:
|
|
2609
|
-
metaKey:
|
|
2617
|
+
ctrlKey: S,
|
|
2618
|
+
metaKey: O,
|
|
2610
2619
|
target: a.current.target,
|
|
2611
|
-
event:
|
|
2620
|
+
event: y
|
|
2612
2621
|
});
|
|
2613
2622
|
}
|
|
2614
|
-
if (
|
|
2623
|
+
if (P) {
|
|
2615
2624
|
a.current.gestureStart || (f.current.style.cursor = "move", a.current.gestureStart = !0, clearTimeout(a.current.longTapTimeout));
|
|
2616
|
-
const
|
|
2617
|
-
if (
|
|
2618
|
-
deltaX:
|
|
2619
|
-
deltaY:
|
|
2625
|
+
const $ = M - a.current.prevX, B = L - a.current.prevY, { target: U } = a.current;
|
|
2626
|
+
if (ne.add(o, {
|
|
2627
|
+
deltaX: $,
|
|
2628
|
+
deltaY: B,
|
|
2620
2629
|
button: a.current.currentButton,
|
|
2621
2630
|
altKey: C,
|
|
2622
2631
|
shiftKey: m,
|
|
2623
|
-
ctrlKey:
|
|
2624
|
-
metaKey:
|
|
2625
|
-
target:
|
|
2626
|
-
event:
|
|
2627
|
-
}),
|
|
2628
|
-
const
|
|
2629
|
-
Math.abs(
|
|
2630
|
-
scale:
|
|
2632
|
+
ctrlKey: S,
|
|
2633
|
+
metaKey: O,
|
|
2634
|
+
target: U,
|
|
2635
|
+
event: y
|
|
2636
|
+
}), N !== a.current.prevDistance && l) {
|
|
2637
|
+
const A = a.current.prevDistance - N;
|
|
2638
|
+
Math.abs(A) > 0 && (ne.add(l, {
|
|
2639
|
+
scale: A * 3,
|
|
2631
2640
|
clientX: M,
|
|
2632
|
-
clientY:
|
|
2633
|
-
event:
|
|
2634
|
-
}), a.current.prevDistance =
|
|
2641
|
+
clientY: L,
|
|
2642
|
+
event: y
|
|
2643
|
+
}), a.current.prevDistance = N);
|
|
2635
2644
|
}
|
|
2636
2645
|
}
|
|
2637
|
-
a.current.prevX = M, a.current.prevY =
|
|
2646
|
+
a.current.prevX = M, a.current.prevY = L;
|
|
2638
2647
|
}
|
|
2639
|
-
},
|
|
2648
|
+
}, E = (y) => {
|
|
2640
2649
|
const {
|
|
2641
2650
|
clientX: w,
|
|
2642
2651
|
clientY: x,
|
|
2643
|
-
altKey:
|
|
2652
|
+
altKey: p,
|
|
2644
2653
|
shiftKey: C,
|
|
2645
2654
|
ctrlKey: m,
|
|
2646
|
-
metaKey:
|
|
2647
|
-
target:
|
|
2648
|
-
pointerId:
|
|
2649
|
-
} =
|
|
2650
|
-
if (a.current.pointers[
|
|
2651
|
-
if (delete a.current.pointers[
|
|
2655
|
+
metaKey: S,
|
|
2656
|
+
target: O,
|
|
2657
|
+
pointerId: k
|
|
2658
|
+
} = y;
|
|
2659
|
+
if (a.current.pointers[k]) {
|
|
2660
|
+
if (delete a.current.pointers[k], a.current.mainPointer !== k) {
|
|
2652
2661
|
const { clientX: D, clientY: M } = a.current.pointers[a.current.mainPointer];
|
|
2653
2662
|
Object.assign(a.current, {
|
|
2654
2663
|
prevX: D,
|
|
@@ -2677,7 +2686,7 @@ const ie = new An(), Fe = ({
|
|
|
2677
2686
|
}
|
|
2678
2687
|
}
|
|
2679
2688
|
if (a.current.mainPointer = void 0, a.current.pressed = !1, clearTimeout(a.current.longTapTimeout), a.current.moving)
|
|
2680
|
-
a.current.moving = !1,
|
|
2689
|
+
a.current.moving = !1, ne.add(n, {
|
|
2681
2690
|
deltaX: w - a.current.prevX,
|
|
2682
2691
|
deltaY: x - a.current.prevY,
|
|
2683
2692
|
startX: a.current.startX,
|
|
@@ -2687,48 +2696,48 @@ const ie = new An(), Fe = ({
|
|
|
2687
2696
|
distanceX: w - a.current.startX,
|
|
2688
2697
|
distanceY: x - a.current.startY,
|
|
2689
2698
|
button: a.current.currentButton,
|
|
2690
|
-
altKey:
|
|
2699
|
+
altKey: p,
|
|
2691
2700
|
shiftKey: C,
|
|
2692
2701
|
ctrlKey: m,
|
|
2693
|
-
metaKey:
|
|
2694
|
-
event:
|
|
2702
|
+
metaKey: S,
|
|
2703
|
+
event: y
|
|
2695
2704
|
}), f.current.style.cursor = "auto";
|
|
2696
2705
|
else {
|
|
2697
2706
|
const D = Date.now();
|
|
2698
|
-
a.current.noTap ? a.current.noTap = !1 : a.current.timeStart - D < 300 &&
|
|
2707
|
+
a.current.noTap ? a.current.noTap = !1 : a.current.timeStart - D < 300 && ne.add(s, {
|
|
2699
2708
|
clientX: w,
|
|
2700
2709
|
clientY: x,
|
|
2701
|
-
altKey:
|
|
2710
|
+
altKey: p,
|
|
2702
2711
|
shiftKey: C,
|
|
2703
2712
|
ctrlKey: m,
|
|
2704
|
-
metaKey:
|
|
2705
|
-
target:
|
|
2706
|
-
event:
|
|
2713
|
+
metaKey: S,
|
|
2714
|
+
target: O,
|
|
2715
|
+
event: y
|
|
2707
2716
|
});
|
|
2708
2717
|
}
|
|
2709
2718
|
}
|
|
2710
2719
|
};
|
|
2711
|
-
return /* @__PURE__ */
|
|
2720
|
+
return /* @__PURE__ */ T(
|
|
2712
2721
|
"div",
|
|
2713
2722
|
{
|
|
2714
2723
|
onWheel: h,
|
|
2715
|
-
onPointerDown:
|
|
2724
|
+
onPointerDown: _,
|
|
2716
2725
|
onPointerMove: v,
|
|
2717
|
-
onPointerUp:
|
|
2718
|
-
onPointerOut:
|
|
2719
|
-
onPointerLeave:
|
|
2720
|
-
onPointerCancel:
|
|
2721
|
-
onDoubleClick: (
|
|
2722
|
-
const { clientX: w, clientY: x, altKey:
|
|
2723
|
-
|
|
2726
|
+
onPointerUp: E,
|
|
2727
|
+
onPointerOut: E,
|
|
2728
|
+
onPointerLeave: E,
|
|
2729
|
+
onPointerCancel: E,
|
|
2730
|
+
onDoubleClick: (y) => {
|
|
2731
|
+
const { clientX: w, clientY: x, altKey: p, shiftKey: C, ctrlKey: m, metaKey: S, target: O } = y;
|
|
2732
|
+
ne.add(u, {
|
|
2724
2733
|
clientX: w,
|
|
2725
2734
|
clientY: x,
|
|
2726
|
-
altKey:
|
|
2735
|
+
altKey: p,
|
|
2727
2736
|
shiftKey: C,
|
|
2728
2737
|
ctrlKey: m,
|
|
2729
|
-
metaKey:
|
|
2730
|
-
target:
|
|
2731
|
-
event:
|
|
2738
|
+
metaKey: S,
|
|
2739
|
+
target: O,
|
|
2740
|
+
event: y
|
|
2732
2741
|
});
|
|
2733
2742
|
},
|
|
2734
2743
|
style: { touchAction: "none" },
|
|
@@ -2738,55 +2747,55 @@ const ie = new An(), Fe = ({
|
|
|
2738
2747
|
);
|
|
2739
2748
|
}, ot = ({ onResize: e, ...t }) => {
|
|
2740
2749
|
const [r] = Z((o) => [o.getBoardState]);
|
|
2741
|
-
return /* @__PURE__ */
|
|
2750
|
+
return /* @__PURE__ */ T(Fe, { onDrag: ({ deltaX: o, deltaY: s, event: c }) => {
|
|
2742
2751
|
c.stopPropagation();
|
|
2743
2752
|
const { scale: u } = r();
|
|
2744
2753
|
e({
|
|
2745
2754
|
width: o / u,
|
|
2746
2755
|
height: s / u
|
|
2747
2756
|
});
|
|
2748
|
-
}, children: /* @__PURE__ */
|
|
2757
|
+
}, children: /* @__PURE__ */ T("div", { ...t }) });
|
|
2749
2758
|
};
|
|
2750
|
-
let Ln = { data: "" }, zn = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || Ln, Yn = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Bn = /\/\*[^]*?\*\/| +/g,
|
|
2759
|
+
let Ln = { data: "" }, zn = (e) => typeof window == "object" ? ((e ? e.querySelector("#_goober") : window._goober) || Object.assign((e || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : e || Ln, Yn = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, Bn = /\/\*[^]*?\*\/| +/g, Gt = /\n+/g, fe = (e, t) => {
|
|
2751
2760
|
let r = "", n = "", o = "";
|
|
2752
2761
|
for (let s in e) {
|
|
2753
2762
|
let c = e[s];
|
|
2754
|
-
s[0] == "@" ? s[1] == "i" ? r = s + " " + c + ";" : n += s[1] == "f" ?
|
|
2763
|
+
s[0] == "@" ? s[1] == "i" ? r = s + " " + c + ";" : n += s[1] == "f" ? fe(c, s) : s + "{" + fe(c, s[1] == "k" ? "" : t) + "}" : typeof c == "object" ? n += fe(c, t ? t.replace(/([^,])+/g, (u) => s.replace(/(^:.*)|([^,])+/g, (l) => /&/.test(l) ? l.replace(/&/g, u) : u ? u + " " + l : l)) : s) : c != null && (s = /^--/.test(s) ? s : s.replace(/[A-Z]/g, "-$&").toLowerCase(), o += fe.p ? fe.p(s, c) : s + ":" + c + ";");
|
|
2755
2764
|
}
|
|
2756
2765
|
return r + (t && o ? t + "{" + o + "}" : o) + n;
|
|
2757
|
-
},
|
|
2766
|
+
}, ae = {}, fr = (e) => {
|
|
2758
2767
|
if (typeof e == "object") {
|
|
2759
2768
|
let t = "";
|
|
2760
2769
|
for (let r in e)
|
|
2761
|
-
t += r +
|
|
2770
|
+
t += r + fr(e[r]);
|
|
2762
2771
|
return t;
|
|
2763
2772
|
}
|
|
2764
2773
|
return e;
|
|
2765
2774
|
}, Nn = (e, t, r, n, o) => {
|
|
2766
|
-
let s =
|
|
2767
|
-
let
|
|
2768
|
-
for (;
|
|
2769
|
-
f = 101 * f + l.charCodeAt(
|
|
2775
|
+
let s = fr(e), c = ae[s] || (ae[s] = ((l) => {
|
|
2776
|
+
let d = 0, f = 11;
|
|
2777
|
+
for (; d < l.length; )
|
|
2778
|
+
f = 101 * f + l.charCodeAt(d++) >>> 0;
|
|
2770
2779
|
return "go" + f;
|
|
2771
2780
|
})(s));
|
|
2772
|
-
if (!
|
|
2773
|
-
let l = s !== e ? e : ((
|
|
2781
|
+
if (!ae[c]) {
|
|
2782
|
+
let l = s !== e ? e : ((d) => {
|
|
2774
2783
|
let f, a, h = [{}];
|
|
2775
|
-
for (; f = Yn.exec(
|
|
2776
|
-
f[4] ? h.shift() : f[3] ? (a = f[3].replace(
|
|
2784
|
+
for (; f = Yn.exec(d.replace(Bn, "")); )
|
|
2785
|
+
f[4] ? h.shift() : f[3] ? (a = f[3].replace(Gt, " ").trim(), h.unshift(h[0][a] = h[0][a] || {})) : h[0][f[1]] = f[2].replace(Gt, " ").trim();
|
|
2777
2786
|
return h[0];
|
|
2778
2787
|
})(e);
|
|
2779
|
-
|
|
2788
|
+
ae[c] = fe(o ? { ["@keyframes " + c]: l } : l, r ? "" : "." + c);
|
|
2780
2789
|
}
|
|
2781
|
-
let u = r &&
|
|
2782
|
-
return r && (
|
|
2783
|
-
a ?
|
|
2784
|
-
})(
|
|
2790
|
+
let u = r && ae.g ? ae.g : null;
|
|
2791
|
+
return r && (ae.g = ae[c]), ((l, d, f, a) => {
|
|
2792
|
+
a ? d.data = d.data.replace(a, l) : d.data.indexOf(l) === -1 && (d.data = f ? l + d.data : d.data + l);
|
|
2793
|
+
})(ae[c], t, n, u), c;
|
|
2785
2794
|
}, Xn = (e, t, r) => e.reduce((n, o, s) => {
|
|
2786
2795
|
let c = t[s];
|
|
2787
2796
|
if (c && c.call) {
|
|
2788
2797
|
let u = c(r), l = u && u.props && u.props.className || /^go/.test(u) && u;
|
|
2789
|
-
c = l ? "." + l : u && typeof u == "object" ? u.props ? "" :
|
|
2798
|
+
c = l ? "." + l : u && typeof u == "object" ? u.props ? "" : fe(u, "") : u === !1 ? "" : u;
|
|
2790
2799
|
}
|
|
2791
2800
|
return n + o + (c ?? "");
|
|
2792
2801
|
}, "");
|
|
@@ -2797,7 +2806,7 @@ function H(e) {
|
|
|
2797
2806
|
H.bind({ g: 1 });
|
|
2798
2807
|
H.bind({ k: 1 });
|
|
2799
2808
|
function Un(e, t, r, n) {
|
|
2800
|
-
|
|
2809
|
+
fe.p = t;
|
|
2801
2810
|
}
|
|
2802
2811
|
var Wn = function e(t, r) {
|
|
2803
2812
|
if (t === r)
|
|
@@ -2883,7 +2892,7 @@ const Vn = H`
|
|
|
2883
2892
|
cursor: nwse-resize;
|
|
2884
2893
|
bottom: -6px;
|
|
2885
2894
|
right: -6px;
|
|
2886
|
-
`, to = ({ onReload: e }) => /* @__PURE__ */
|
|
2895
|
+
`, to = ({ onReload: e }) => /* @__PURE__ */ ue(
|
|
2887
2896
|
"div",
|
|
2888
2897
|
{
|
|
2889
2898
|
className: `syncboard-error-item ${H({
|
|
@@ -2896,7 +2905,7 @@ const Vn = H`
|
|
|
2896
2905
|
})}`,
|
|
2897
2906
|
children: [
|
|
2898
2907
|
"Sorry, this item seems broken.",
|
|
2899
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ T("button", { onClick: e, children: "Reload it" })
|
|
2900
2909
|
]
|
|
2901
2910
|
}
|
|
2902
2911
|
);
|
|
@@ -2919,7 +2928,7 @@ class ro extends g.Component {
|
|
|
2919
2928
|
}
|
|
2920
2929
|
render() {
|
|
2921
2930
|
const { ErrorComponent: t } = this.props;
|
|
2922
|
-
return this.state.hasError ? /* @__PURE__ */
|
|
2931
|
+
return this.state.hasError ? /* @__PURE__ */ T(t, { onReload: this.onReload }) : this.props.children;
|
|
2923
2932
|
}
|
|
2924
2933
|
}
|
|
2925
2934
|
const no = (e) => {
|
|
@@ -2958,87 +2967,87 @@ const no = (e) => {
|
|
|
2958
2967
|
state: { type: t, rotation: r = 0, id: n, locked: o, extraClasses: s, ...c } = {},
|
|
2959
2968
|
animate: u = "hvr-pop",
|
|
2960
2969
|
isSelected: l,
|
|
2961
|
-
itemMap:
|
|
2970
|
+
itemMap: d,
|
|
2962
2971
|
showResizeHandle: f = !0
|
|
2963
2972
|
}) => {
|
|
2964
2973
|
var m;
|
|
2965
2974
|
const a = g.useRef(null), {
|
|
2966
2975
|
component: h = () => null,
|
|
2967
|
-
resizeDirections:
|
|
2976
|
+
resizeDirections: _ = so,
|
|
2968
2977
|
resize: v = oo
|
|
2969
|
-
} =
|
|
2970
|
-
(
|
|
2978
|
+
} = d[t], E = g.useCallback(
|
|
2979
|
+
(S) => e(n, S),
|
|
2971
2980
|
[e, n]
|
|
2972
2981
|
);
|
|
2973
2982
|
g.useEffect(() => {
|
|
2974
2983
|
a.current.className = u;
|
|
2975
2984
|
}, [u]);
|
|
2976
|
-
const
|
|
2977
|
-
o &&
|
|
2978
|
-
const
|
|
2979
|
-
|
|
2980
|
-
const { offsetWidth: M, offsetHeight:
|
|
2985
|
+
const I = ["item", n, Vn];
|
|
2986
|
+
o && I.push("locked"), l && (I.push("selected"), I.push(Fn));
|
|
2987
|
+
const y = I.join(" "), w = ({ width: S = 0, height: O = 0, keepRatio: k }) => {
|
|
2988
|
+
E((D) => {
|
|
2989
|
+
const { offsetWidth: M, offsetHeight: L } = a.current;
|
|
2981
2990
|
return v({
|
|
2982
2991
|
prevState: D,
|
|
2983
|
-
width:
|
|
2984
|
-
height:
|
|
2985
|
-
actualHeight:
|
|
2992
|
+
width: S,
|
|
2993
|
+
height: O,
|
|
2994
|
+
actualHeight: L,
|
|
2986
2995
|
actualWidth: M,
|
|
2987
|
-
keepRatio:
|
|
2996
|
+
keepRatio: k
|
|
2988
2997
|
});
|
|
2989
2998
|
});
|
|
2990
|
-
}, x = ({ width:
|
|
2991
|
-
w({ width:
|
|
2992
|
-
},
|
|
2993
|
-
w({ height:
|
|
2994
|
-
}, C = ({ width:
|
|
2995
|
-
w({ height:
|
|
2999
|
+
}, x = ({ width: S }) => {
|
|
3000
|
+
w({ width: S });
|
|
3001
|
+
}, p = ({ height: S }) => {
|
|
3002
|
+
w({ height: S });
|
|
3003
|
+
}, C = ({ width: S }) => {
|
|
3004
|
+
w({ height: S, width: S, keepRatio: !0 });
|
|
2996
3005
|
};
|
|
2997
|
-
return /* @__PURE__ */
|
|
3006
|
+
return /* @__PURE__ */ T(
|
|
2998
3007
|
"div",
|
|
2999
3008
|
{
|
|
3000
3009
|
style: { transform: `rotate(${r}deg` },
|
|
3001
3010
|
"data-id": n,
|
|
3002
|
-
className:
|
|
3003
|
-
children: /* @__PURE__ */
|
|
3011
|
+
className: y,
|
|
3012
|
+
children: /* @__PURE__ */ ue(
|
|
3004
3013
|
"div",
|
|
3005
3014
|
{
|
|
3006
3015
|
style: { display: "flex" },
|
|
3007
3016
|
ref: a,
|
|
3008
3017
|
onAnimationEnd: no,
|
|
3009
|
-
onKeyDown: (
|
|
3010
|
-
onKeyUp: (
|
|
3018
|
+
onKeyDown: (S) => S.stopPropagation(),
|
|
3019
|
+
onKeyUp: (S) => S.stopPropagation(),
|
|
3011
3020
|
children: [
|
|
3012
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ T(
|
|
3013
3022
|
ro,
|
|
3014
3023
|
{
|
|
3015
3024
|
itemId: n,
|
|
3016
3025
|
state: c,
|
|
3017
|
-
ErrorComponent: ((m =
|
|
3018
|
-
children: /* @__PURE__ */
|
|
3026
|
+
ErrorComponent: ((m = d == null ? void 0 : d.error) == null ? void 0 : m.component) || to,
|
|
3027
|
+
children: /* @__PURE__ */ T(h, { ...c, id: n, setState: E })
|
|
3019
3028
|
}
|
|
3020
3029
|
),
|
|
3021
|
-
/* @__PURE__ */
|
|
3022
|
-
/* @__PURE__ */
|
|
3023
|
-
/* @__PURE__ */
|
|
3024
|
-
/* @__PURE__ */
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
f && /* @__PURE__ */
|
|
3027
|
-
|
|
3030
|
+
/* @__PURE__ */ T("div", { className: `corner ${we} ${Kn}` }),
|
|
3031
|
+
/* @__PURE__ */ T("div", { className: `corner ${we} ${Hn}` }),
|
|
3032
|
+
/* @__PURE__ */ T("div", { className: `corner ${we} ${Gn}` }),
|
|
3033
|
+
/* @__PURE__ */ T("div", { className: `corner ${we} ${qn}` }),
|
|
3034
|
+
/* @__PURE__ */ T("div", { className: `center ${we} ${Jn}` }),
|
|
3035
|
+
f && /* @__PURE__ */ ue(Xr, { children: [
|
|
3036
|
+
_.b && /* @__PURE__ */ T(
|
|
3028
3037
|
ot,
|
|
3029
3038
|
{
|
|
3030
3039
|
className: `${st} ${eo}`,
|
|
3031
3040
|
onResize: C
|
|
3032
3041
|
}
|
|
3033
3042
|
),
|
|
3034
|
-
|
|
3043
|
+
_.h && /* @__PURE__ */ T(
|
|
3035
3044
|
ot,
|
|
3036
3045
|
{
|
|
3037
3046
|
className: `${st} ${Qn}`,
|
|
3038
|
-
onResize:
|
|
3047
|
+
onResize: p
|
|
3039
3048
|
}
|
|
3040
3049
|
),
|
|
3041
|
-
|
|
3050
|
+
_.w && /* @__PURE__ */ T(
|
|
3042
3051
|
ot,
|
|
3043
3052
|
{
|
|
3044
3053
|
className: `${st} ${Zn}`,
|
|
@@ -3051,7 +3060,7 @@ const no = (e) => {
|
|
|
3051
3060
|
)
|
|
3052
3061
|
}
|
|
3053
3062
|
);
|
|
3054
|
-
}, ao =
|
|
3063
|
+
}, ao = tr(
|
|
3055
3064
|
io,
|
|
3056
3065
|
({
|
|
3057
3066
|
state: e,
|
|
@@ -3072,9 +3081,9 @@ const no = (e) => {
|
|
|
3072
3081
|
y: c = 0,
|
|
3073
3082
|
layer: u = 0,
|
|
3074
3083
|
moving: l,
|
|
3075
|
-
...
|
|
3084
|
+
...d
|
|
3076
3085
|
} = o(e, { getCurrentUser: t }), f = (u + 4) * 10 + 100 + (l ? 5 : 0);
|
|
3077
|
-
return /* @__PURE__ */
|
|
3086
|
+
return /* @__PURE__ */ T(
|
|
3078
3087
|
"div",
|
|
3079
3088
|
{
|
|
3080
3089
|
className: r,
|
|
@@ -3082,50 +3091,50 @@ const no = (e) => {
|
|
|
3082
3091
|
transform: `translate(${s}px, ${c}px)`,
|
|
3083
3092
|
zIndex: f
|
|
3084
3093
|
},
|
|
3085
|
-
children: /* @__PURE__ */
|
|
3094
|
+
children: /* @__PURE__ */ T(
|
|
3086
3095
|
ao,
|
|
3087
3096
|
{
|
|
3088
3097
|
...n,
|
|
3089
3098
|
showResizeHandle: n.isSelected && n.showResizeHandle,
|
|
3090
|
-
state:
|
|
3099
|
+
state: d
|
|
3091
3100
|
}
|
|
3092
3101
|
)
|
|
3093
3102
|
}
|
|
3094
3103
|
);
|
|
3095
|
-
}, lo =
|
|
3096
|
-
const { updateItem: e } = gt(), [t, r] =
|
|
3097
|
-
|
|
3098
|
-
|
|
3104
|
+
}, lo = tr(uo), fo = () => {
|
|
3105
|
+
const { updateItem: e } = gt(), [t, r] = re((d) => [
|
|
3106
|
+
d.itemIds,
|
|
3107
|
+
d.items
|
|
3099
3108
|
]), [n, o, s, c] = Z(
|
|
3100
|
-
(
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3109
|
+
(d) => [
|
|
3110
|
+
d.config.boardSize,
|
|
3111
|
+
d.config.showResizeHandle,
|
|
3112
|
+
d.config.itemTemplates,
|
|
3113
|
+
d.selection
|
|
3105
3114
|
]
|
|
3106
|
-
), [u] = Se((
|
|
3115
|
+
), [u] = Se((d) => [d.getUser]), l = H({
|
|
3107
3116
|
position: "absolute",
|
|
3108
3117
|
top: `${n / 2}px`,
|
|
3109
3118
|
left: `${n / 2}px`,
|
|
3110
3119
|
display: "inline-block"
|
|
3111
3120
|
});
|
|
3112
|
-
return t.map((
|
|
3121
|
+
return t.map((d) => /* @__PURE__ */ T(
|
|
3113
3122
|
lo,
|
|
3114
3123
|
{
|
|
3115
|
-
state: r[
|
|
3124
|
+
state: r[d],
|
|
3116
3125
|
setState: e,
|
|
3117
|
-
isSelected: c.includes(
|
|
3126
|
+
isSelected: c.includes(d),
|
|
3118
3127
|
itemMap: s,
|
|
3119
3128
|
boardSize: n,
|
|
3120
3129
|
getCurrentUser: u,
|
|
3121
3130
|
showResizeHandle: o,
|
|
3122
3131
|
className: l
|
|
3123
3132
|
},
|
|
3124
|
-
|
|
3133
|
+
d
|
|
3125
3134
|
));
|
|
3126
3135
|
};
|
|
3127
3136
|
function po(e = !1) {
|
|
3128
|
-
const t = Re(e), r =
|
|
3137
|
+
const t = Re(e), r = er(() => t.current, []);
|
|
3129
3138
|
return Pe(() => (t.current = !0, () => {
|
|
3130
3139
|
t.current = !1;
|
|
3131
3140
|
}), []), r;
|
|
@@ -3137,7 +3146,7 @@ function go(e, ...t) {
|
|
|
3137
3146
|
e && e.removeEventListener && e.removeEventListener(...t);
|
|
3138
3147
|
}
|
|
3139
3148
|
const ho = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
3140
|
-
function
|
|
3149
|
+
function ce(e, ...t) {
|
|
3141
3150
|
const r = po(), n = pt(t[1]), o = lt(
|
|
3142
3151
|
() => (
|
|
3143
3152
|
// as some event listeners designed to be used through `this`
|
|
@@ -3171,7 +3180,7 @@ const vo = H({
|
|
|
3171
3180
|
const o = n[0];
|
|
3172
3181
|
return Array.from(t.getElementsByClassName("item")).filter((s) => {
|
|
3173
3182
|
const c = Te(s), u = e[c];
|
|
3174
|
-
return !u || !r && u.locked ? !1 :
|
|
3183
|
+
return !u || !r && u.locked ? !1 : rn(s, o);
|
|
3175
3184
|
}).map((s) => Te(s));
|
|
3176
3185
|
}, So = ({ children: e, moveFirst: t }) => {
|
|
3177
3186
|
const [
|
|
@@ -3189,44 +3198,44 @@ const vo = H({
|
|
|
3189
3198
|
m.getConfiguration,
|
|
3190
3199
|
m.getBoardState,
|
|
3191
3200
|
m.updateBoardState
|
|
3192
|
-
]), { findElementUnderPointer: l } = gt(), [
|
|
3201
|
+
]), { findElementUnderPointer: l } = gt(), [d] = re((m) => [m.getItems]), [f, a] = g.useState({}), [, h] = g.useTransition(), [_, v] = g.useState(!1), E = g.useRef(null), I = g.useRef({
|
|
3193
3202
|
moving: !1
|
|
3194
3203
|
});
|
|
3195
|
-
return
|
|
3204
|
+
return ce(document, "keydown", (m) => {
|
|
3196
3205
|
m.key === "l" && v(!0);
|
|
3197
|
-
}),
|
|
3206
|
+
}), ce(document, "keyup", (m) => {
|
|
3198
3207
|
m.key === "l" && v(!1);
|
|
3199
3208
|
}), g.useEffect(() => (n(), () => {
|
|
3200
3209
|
n();
|
|
3201
3210
|
}), [n]), g.useEffect(() => {
|
|
3202
|
-
if (
|
|
3203
|
-
const m =
|
|
3211
|
+
if (I.current.moving) {
|
|
3212
|
+
const m = d(), { boardWrapper: S } = c(), O = yo(m, S, _);
|
|
3204
3213
|
h(() => {
|
|
3205
|
-
o(
|
|
3214
|
+
o(O);
|
|
3206
3215
|
});
|
|
3207
3216
|
}
|
|
3208
|
-
}, [c,
|
|
3217
|
+
}, [c, d, f, o, _]), /* @__PURE__ */ T(
|
|
3209
3218
|
Fe,
|
|
3210
3219
|
{
|
|
3211
3220
|
onDragStart: async (m) => {
|
|
3212
|
-
await l(m) || (
|
|
3221
|
+
await l(m) || (I.current.moving = !0, h(() => {
|
|
3213
3222
|
u({ selecting: !0 });
|
|
3214
|
-
}),
|
|
3223
|
+
}), E.current.style.cursor = "crosshair");
|
|
3215
3224
|
},
|
|
3216
|
-
onDrag: ({ distanceY: m, distanceX:
|
|
3217
|
-
if (
|
|
3218
|
-
const { top: D, left: M } =
|
|
3219
|
-
|
|
3225
|
+
onDrag: ({ distanceY: m, distanceX: S, startX: O, startY: k }) => {
|
|
3226
|
+
if (I.current.moving) {
|
|
3227
|
+
const { top: D, left: M } = E.current.getBoundingClientRect(), L = O - M, N = k - D;
|
|
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), a({ ...I.current, moving: !0 });
|
|
3220
3229
|
}
|
|
3221
3230
|
},
|
|
3222
3231
|
onDragEnd: () => {
|
|
3223
|
-
|
|
3232
|
+
I.current.moving && (h(() => {
|
|
3224
3233
|
u({ selecting: !1 });
|
|
3225
|
-
}),
|
|
3234
|
+
}), I.current.moving = !1, a({ moving: !1 }), E.current.style.cursor = "auto");
|
|
3226
3235
|
},
|
|
3227
3236
|
onTap: (m) => {
|
|
3228
|
-
const { target:
|
|
3229
|
-
if (!D && Oe(
|
|
3237
|
+
const { target: S, ctrlKey: O, metaKey: k } = m, D = l(m);
|
|
3238
|
+
if (!D && Oe(S, "board"))
|
|
3230
3239
|
n();
|
|
3231
3240
|
else {
|
|
3232
3241
|
const M = Te(D);
|
|
@@ -3234,20 +3243,20 @@ const vo = H({
|
|
|
3234
3243
|
n();
|
|
3235
3244
|
return;
|
|
3236
3245
|
}
|
|
3237
|
-
const
|
|
3238
|
-
D && !
|
|
3246
|
+
const L = r();
|
|
3247
|
+
D && !L.includes(M) && (O || k ? s([M]) : o([M]));
|
|
3239
3248
|
}
|
|
3240
3249
|
},
|
|
3241
3250
|
onLongTap: ({ target: m }) => {
|
|
3242
|
-
const
|
|
3243
|
-
if (
|
|
3244
|
-
const
|
|
3245
|
-
o([
|
|
3251
|
+
const S = Oe(m, "item");
|
|
3252
|
+
if (S) {
|
|
3253
|
+
const O = Te(S);
|
|
3254
|
+
o([O]);
|
|
3246
3255
|
}
|
|
3247
3256
|
},
|
|
3248
3257
|
mainAction: t ? "pan" : "drag",
|
|
3249
|
-
children: /* @__PURE__ */
|
|
3250
|
-
f.moving && /* @__PURE__ */
|
|
3258
|
+
children: /* @__PURE__ */ ue("div", { ref: E, children: [
|
|
3259
|
+
f.moving && /* @__PURE__ */ T(
|
|
3251
3260
|
"div",
|
|
3252
3261
|
{
|
|
3253
3262
|
style: {
|
|
@@ -3263,29 +3272,29 @@ const vo = H({
|
|
|
3263
3272
|
}
|
|
3264
3273
|
);
|
|
3265
3274
|
}, _o = ({ children: e }) => {
|
|
3266
|
-
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = gt(), { vectorFromWrapperToBoard: o } = Me(), [s, c, u, l,
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
]), [f] =
|
|
3275
|
+
const { moveItems: t, placeItems: r, findElementUnderPointer: n } = gt(), { vectorFromWrapperToBoard: o } = Me(), [s, c, u, l, d] = Z((y) => [
|
|
3276
|
+
y.select,
|
|
3277
|
+
y.setSelection,
|
|
3278
|
+
y.getSelection,
|
|
3279
|
+
y.getBoardState,
|
|
3280
|
+
y.updateBoardState
|
|
3281
|
+
]), [f] = re((y) => [y.getBoardConfig]), a = g.useRef({}), h = g.useRef({
|
|
3273
3282
|
items: []
|
|
3274
|
-
}),
|
|
3275
|
-
const { ctrlKey: w, metaKey: x, event:
|
|
3283
|
+
}), _ = (y) => {
|
|
3284
|
+
const { ctrlKey: w, metaKey: x, event: p } = y, C = n(y);
|
|
3276
3285
|
if (C) {
|
|
3277
|
-
|
|
3286
|
+
p.stopPropagation();
|
|
3278
3287
|
const m = u();
|
|
3279
3288
|
h.current.items = m;
|
|
3280
|
-
const
|
|
3281
|
-
m.includes(
|
|
3289
|
+
const S = Te(C);
|
|
3290
|
+
m.includes(S) || (w || x ? (h.current.items = [...m, S], s([S])) : (h.current.items = [S], c([S]))), Object.assign(a.current, {
|
|
3282
3291
|
moving: !0
|
|
3283
3292
|
});
|
|
3284
3293
|
}
|
|
3285
|
-
}, v = ({ deltaX:
|
|
3294
|
+
}, v = ({ deltaX: y, deltaY: w, event: x }) => {
|
|
3286
3295
|
if (a.current.moving) {
|
|
3287
3296
|
x.stopPropagation();
|
|
3288
|
-
const { movingItems:
|
|
3297
|
+
const { movingItems: p } = l(), [C, m] = o(y, w);
|
|
3289
3298
|
t(
|
|
3290
3299
|
h.current.items,
|
|
3291
3300
|
{
|
|
@@ -3293,30 +3302,30 @@ const vo = H({
|
|
|
3293
3302
|
y: m
|
|
3294
3303
|
},
|
|
3295
3304
|
!0
|
|
3296
|
-
),
|
|
3305
|
+
), p || d({ movingItems: !0 });
|
|
3297
3306
|
}
|
|
3298
|
-
},
|
|
3307
|
+
}, E = () => {
|
|
3299
3308
|
if (a.current.moving) {
|
|
3300
|
-
const { gridSize:
|
|
3309
|
+
const { gridSize: y = 1 } = f(), w = y || 1;
|
|
3301
3310
|
a.current = { moving: !1 }, r(h.current.items, {
|
|
3302
3311
|
type: "grid",
|
|
3303
3312
|
size: w
|
|
3304
|
-
}),
|
|
3313
|
+
}), d({ movingItems: !1 });
|
|
3305
3314
|
}
|
|
3306
3315
|
};
|
|
3307
|
-
return
|
|
3308
|
-
if (["INPUT", "TEXTAREA"].includes(
|
|
3316
|
+
return ce(document, "keydown", (y) => {
|
|
3317
|
+
if (["INPUT", "TEXTAREA"].includes(y.target.tagName))
|
|
3309
3318
|
return;
|
|
3310
3319
|
const w = u();
|
|
3311
3320
|
if (w.length) {
|
|
3312
3321
|
const { gridSize: x = 1 } = f();
|
|
3313
|
-
let
|
|
3314
|
-
switch (
|
|
3322
|
+
let p = 0, C = 0;
|
|
3323
|
+
switch (y.key) {
|
|
3315
3324
|
case "ArrowLeft":
|
|
3316
|
-
|
|
3325
|
+
p = -10;
|
|
3317
3326
|
break;
|
|
3318
3327
|
case "ArrowRight":
|
|
3319
|
-
|
|
3328
|
+
p = 10;
|
|
3320
3329
|
break;
|
|
3321
3330
|
case "ArrowUp":
|
|
3322
3331
|
C = -10;
|
|
@@ -3325,31 +3334,31 @@ const vo = H({
|
|
|
3325
3334
|
C = 10;
|
|
3326
3335
|
break;
|
|
3327
3336
|
}
|
|
3328
|
-
if (
|
|
3329
|
-
|
|
3330
|
-
const [m,
|
|
3337
|
+
if (p || C) {
|
|
3338
|
+
y.shiftKey && (p *= 5, C *= 5), (y.ctrlKey || y.altKey || y.metaKey) && (p /= 10, C /= 10);
|
|
3339
|
+
const [m, S] = o(p, C);
|
|
3331
3340
|
t(
|
|
3332
3341
|
w,
|
|
3333
3342
|
{
|
|
3334
3343
|
x: m,
|
|
3335
|
-
y
|
|
3344
|
+
y: S
|
|
3336
3345
|
},
|
|
3337
3346
|
!0
|
|
3338
3347
|
), r(w, {
|
|
3339
3348
|
type: "grid",
|
|
3340
3349
|
size: x || 1
|
|
3341
|
-
}),
|
|
3350
|
+
}), y.preventDefault();
|
|
3342
3351
|
}
|
|
3343
3352
|
}
|
|
3344
|
-
}), /* @__PURE__ */
|
|
3353
|
+
}), /* @__PURE__ */ T(Fe, { onDragStart: _, onDrag: v, onDragEnd: E, children: e });
|
|
3345
3354
|
}, bo = (e) => {
|
|
3346
3355
|
const t = g.useRef({ hover: !1, x: 0, y: 0 });
|
|
3347
|
-
return
|
|
3356
|
+
return ce(e.current, "mousemove", (n) => {
|
|
3348
3357
|
const { clientX: o, clientY: s } = n;
|
|
3349
3358
|
t.current.x = o, t.current.y = s;
|
|
3350
|
-
}),
|
|
3359
|
+
}), ce(e.current, "mouseenter", () => {
|
|
3351
3360
|
t.current.hover = !0;
|
|
3352
|
-
}),
|
|
3361
|
+
}), ce(e.current, "mouseleave", () => {
|
|
3353
3362
|
t.current.hover = !1;
|
|
3354
3363
|
}), g.useCallback(() => t.current, []);
|
|
3355
3364
|
}, Eo = [...Array(5).keys()].map((e) => `Digit${e + 1}`), Co = () => {
|
|
@@ -3357,11 +3366,11 @@ const vo = H({
|
|
|
3357
3366
|
o.getBoardState,
|
|
3358
3367
|
o.updateBoardState
|
|
3359
3368
|
]);
|
|
3360
|
-
return
|
|
3369
|
+
return ce(document, "keydown", (o) => {
|
|
3361
3370
|
if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) && Eo.includes(o.code)) {
|
|
3362
3371
|
const s = o.code, { translateX: c, translateY: u, scale: l } = r();
|
|
3363
|
-
o.altKey || o.metaKey || o.ctrlKey || o.shiftKey ? t((
|
|
3364
|
-
...
|
|
3372
|
+
o.altKey || o.metaKey || o.ctrlKey || o.shiftKey ? t((d) => ({
|
|
3373
|
+
...d,
|
|
3365
3374
|
[s]: { translateX: c, translateY: u, scale: l }
|
|
3366
3375
|
})) : e[s] && n(e[s]), o.preventDefault();
|
|
3367
3376
|
}
|
|
@@ -3373,42 +3382,42 @@ const vo = H({
|
|
|
3373
3382
|
s,
|
|
3374
3383
|
c,
|
|
3375
3384
|
u
|
|
3376
|
-
] = Z((
|
|
3385
|
+
] = Z((p) => [
|
|
3377
3386
|
{
|
|
3378
|
-
translateX:
|
|
3379
|
-
translateY:
|
|
3380
|
-
scale:
|
|
3381
|
-
rotate:
|
|
3387
|
+
translateX: p.boardState.translateX,
|
|
3388
|
+
translateY: p.boardState.translateY,
|
|
3389
|
+
scale: p.boardState.scale,
|
|
3390
|
+
rotate: p.boardState.rotate
|
|
3382
3391
|
},
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
]), { zoomToCenter: l, zoomToExtent:
|
|
3392
|
+
p.config.itemExtent,
|
|
3393
|
+
p.getConfiguration,
|
|
3394
|
+
p.updateBoardState,
|
|
3395
|
+
p.getSelection
|
|
3396
|
+
]), { zoomToCenter: l, zoomToExtent: d, moveBoard: f } = Me(), [a, h] = g.useState(!1), _ = g.useRef({}), v = bo(r);
|
|
3388
3397
|
Co();
|
|
3389
|
-
const
|
|
3390
|
-
const { itemExtent:
|
|
3391
|
-
p
|
|
3392
|
-
}, [s,
|
|
3398
|
+
const E = g.useCallback(() => {
|
|
3399
|
+
const { itemExtent: p } = s();
|
|
3400
|
+
d(p);
|
|
3401
|
+
}, [s, d]);
|
|
3393
3402
|
g.useEffect(() => {
|
|
3394
|
-
!a && o.radius && (
|
|
3395
|
-
}, [
|
|
3396
|
-
const
|
|
3397
|
-
l({ to: { x:
|
|
3403
|
+
!a && o.radius && (E(), h(!0));
|
|
3404
|
+
}, [E, a, o]);
|
|
3405
|
+
const I = ({ clientX: p, clientY: C, scale: m }) => {
|
|
3406
|
+
l({ to: { x: p, y: C }, factor: 1 - m / 500 }), clearTimeout(_.current.zoom), _.current.zoom = setTimeout(() => {
|
|
3398
3407
|
c({ zooming: !1 });
|
|
3399
3408
|
}, 200), c({ zooming: !0 });
|
|
3400
|
-
},
|
|
3401
|
-
f(({ translateX: m, translateY:
|
|
3402
|
-
translateX: m +
|
|
3403
|
-
translateY:
|
|
3404
|
-
})), clearTimeout(
|
|
3409
|
+
}, y = ({ deltaX: p, deltaY: C }) => {
|
|
3410
|
+
f(({ translateX: m, translateY: S }) => ({
|
|
3411
|
+
translateX: m + p,
|
|
3412
|
+
translateY: S + C
|
|
3413
|
+
})), clearTimeout(_.current.pan), _.current.pan = setTimeout(() => {
|
|
3405
3414
|
c({ panning: !1 });
|
|
3406
3415
|
}, 200), c({ panning: !0 });
|
|
3407
|
-
}, w = (
|
|
3408
|
-
if (["INPUT", "TEXTAREA"].includes(
|
|
3416
|
+
}, w = (p) => {
|
|
3417
|
+
if (["INPUT", "TEXTAREA"].includes(p.target.tagName))
|
|
3409
3418
|
return;
|
|
3410
|
-
let C = 0, m = 0,
|
|
3411
|
-
switch (
|
|
3419
|
+
let C = 0, m = 0, S = 1;
|
|
3420
|
+
switch (p.key) {
|
|
3412
3421
|
case "ArrowLeft":
|
|
3413
3422
|
C = -10;
|
|
3414
3423
|
break;
|
|
@@ -3422,32 +3431,32 @@ const vo = H({
|
|
|
3422
3431
|
m = 10;
|
|
3423
3432
|
break;
|
|
3424
3433
|
case "PageUp":
|
|
3425
|
-
|
|
3434
|
+
S = 1.2;
|
|
3426
3435
|
break;
|
|
3427
3436
|
case "PageDown":
|
|
3428
|
-
|
|
3437
|
+
S = 0.8;
|
|
3429
3438
|
break;
|
|
3430
3439
|
}
|
|
3431
|
-
if (C || m ||
|
|
3432
|
-
const
|
|
3433
|
-
if (
|
|
3440
|
+
if (C || m || S !== 1) {
|
|
3441
|
+
const O = u();
|
|
3442
|
+
if (S === 1 && O.length)
|
|
3434
3443
|
return;
|
|
3435
|
-
|
|
3436
|
-
translateX:
|
|
3444
|
+
p.shiftKey && (C *= 5, m *= 5), (p.ctrlKey || p.altKey || p.metaKey) && (C /= 5, m /= 5), f(({ translateX: k, translateY: D }) => ({
|
|
3445
|
+
translateX: k + C,
|
|
3437
3446
|
translateY: D + m
|
|
3438
|
-
})), l({ factor:
|
|
3447
|
+
})), l({ factor: S }), p.preventDefault();
|
|
3439
3448
|
}
|
|
3440
|
-
|
|
3441
|
-
}, x = (
|
|
3442
|
-
["INPUT", "TEXTAREA"].includes(
|
|
3449
|
+
p.key === " " && !p.repeat && v().hover && l({ factor: 3, to: v() });
|
|
3450
|
+
}, x = (p) => {
|
|
3451
|
+
["INPUT", "TEXTAREA"].includes(p.target.tagName) || p.key === " " && v().hover && l({ factor: 1 / 3, to: v() });
|
|
3443
3452
|
};
|
|
3444
|
-
return
|
|
3453
|
+
return ce(document, "keydown", w), ce(document, "keyup", x), /* @__PURE__ */ T(
|
|
3445
3454
|
Fe,
|
|
3446
3455
|
{
|
|
3447
|
-
onPan:
|
|
3448
|
-
onZoom:
|
|
3456
|
+
onPan: y,
|
|
3457
|
+
onZoom: I,
|
|
3449
3458
|
mainAction: t ? "pan" : "drag",
|
|
3450
|
-
children: /* @__PURE__ */
|
|
3459
|
+
children: /* @__PURE__ */ T(
|
|
3451
3460
|
"div",
|
|
3452
3461
|
{
|
|
3453
3462
|
style: {
|
|
@@ -3489,36 +3498,36 @@ const vo = H({
|
|
|
3489
3498
|
translateY: a.boardState.translateY,
|
|
3490
3499
|
scale: a.boardState.scale
|
|
3491
3500
|
}
|
|
3492
|
-
]), [l] =
|
|
3493
|
-
const a = t(), { boardWrapperRect: h, boardWrapper:
|
|
3501
|
+
]), [l] = re((a) => [a.items]), d = g.useCallback(() => {
|
|
3502
|
+
const a = t(), { boardWrapperRect: h, boardWrapper: _ } = o();
|
|
3494
3503
|
if (a.length === 0) {
|
|
3495
3504
|
n(null);
|
|
3496
3505
|
return;
|
|
3497
3506
|
}
|
|
3498
|
-
const v =
|
|
3507
|
+
const v = nn(a, _);
|
|
3499
3508
|
if (!v) {
|
|
3500
3509
|
n(null);
|
|
3501
3510
|
return;
|
|
3502
3511
|
}
|
|
3503
|
-
const { left:
|
|
3504
|
-
left:
|
|
3505
|
-
top:
|
|
3512
|
+
const { left: E, top: I, width: y, height: w } = v, x = {
|
|
3513
|
+
left: E - h.left,
|
|
3514
|
+
top: I - h.top,
|
|
3506
3515
|
height: w,
|
|
3507
|
-
width:
|
|
3516
|
+
width: y
|
|
3508
3517
|
};
|
|
3509
3518
|
n(x);
|
|
3510
|
-
}, [o, t, n]), f = mt(
|
|
3519
|
+
}, [o, t, n]), f = mt(d, [d], 300);
|
|
3511
3520
|
return g.useEffect(() => {
|
|
3512
|
-
|
|
3521
|
+
d(), f();
|
|
3513
3522
|
}, [
|
|
3514
3523
|
e,
|
|
3515
3524
|
l,
|
|
3516
3525
|
s,
|
|
3517
3526
|
c,
|
|
3518
3527
|
u,
|
|
3519
|
-
|
|
3528
|
+
d,
|
|
3520
3529
|
f
|
|
3521
|
-
]), !r || e.length < 2 ? null : /* @__PURE__ */
|
|
3530
|
+
]), !r || e.length < 2 ? null : /* @__PURE__ */ T(
|
|
3522
3531
|
"div",
|
|
3523
3532
|
{
|
|
3524
3533
|
style: {
|
|
@@ -3531,7 +3540,7 @@ const vo = H({
|
|
|
3531
3540
|
);
|
|
3532
3541
|
}, Io = () => {
|
|
3533
3542
|
const [e] = Z((t) => [t.boardState.movingItems]);
|
|
3534
|
-
return e ? null : /* @__PURE__ */
|
|
3543
|
+
return e ? null : /* @__PURE__ */ T(Ro, {});
|
|
3535
3544
|
}, Oo = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
|
|
3536
3545
|
let Le;
|
|
3537
3546
|
function To() {
|
|
@@ -3564,15 +3573,15 @@ function ko(e, t, r = !0) {
|
|
|
3564
3573
|
if (!n || !c)
|
|
3565
3574
|
return;
|
|
3566
3575
|
let u = !0;
|
|
3567
|
-
const l = (...
|
|
3568
|
-
u && o.current(...
|
|
3576
|
+
const l = (...d) => {
|
|
3577
|
+
u && o.current(...d);
|
|
3569
3578
|
};
|
|
3570
3579
|
return n.subscribe(c, l), () => {
|
|
3571
3580
|
u = !1, n.unsubscribe(c, l);
|
|
3572
3581
|
};
|
|
3573
3582
|
}, [s, n]);
|
|
3574
3583
|
}
|
|
3575
|
-
function
|
|
3584
|
+
function Jt(e, t, r) {
|
|
3576
3585
|
return Math.min(Math.max(e, r), t);
|
|
3577
3586
|
}
|
|
3578
3587
|
class Po extends Error {
|
|
@@ -3605,12 +3614,12 @@ function Mo(e) {
|
|
|
3605
3614
|
}
|
|
3606
3615
|
const s = Yo.exec(t);
|
|
3607
3616
|
if (s) {
|
|
3608
|
-
const [c, u, l,
|
|
3609
|
-
if (
|
|
3617
|
+
const [c, u, l, d] = Array.from(s).slice(1).map(parseFloat);
|
|
3618
|
+
if (Jt(0, 100, u) !== u)
|
|
3610
3619
|
throw new xe(e);
|
|
3611
|
-
if (
|
|
3620
|
+
if (Jt(0, 100, l) !== l)
|
|
3612
3621
|
throw new xe(e);
|
|
3613
|
-
return [...No(c, u, l), Number.isNaN(
|
|
3622
|
+
return [...No(c, u, l), Number.isNaN(d) ? 1 : d];
|
|
3614
3623
|
}
|
|
3615
3624
|
throw new xe(e);
|
|
3616
3625
|
}
|
|
@@ -3620,8 +3629,8 @@ function Do(e) {
|
|
|
3620
3629
|
t = t * 33 ^ e.charCodeAt(--r);
|
|
3621
3630
|
return (t >>> 0) % 2341;
|
|
3622
3631
|
}
|
|
3623
|
-
const
|
|
3624
|
-
const r =
|
|
3632
|
+
const Zt = (e) => parseInt(e.replace(/_/g, ""), 36), jo = "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) => {
|
|
3633
|
+
const r = Zt(t.substring(0, 3)), n = Zt(t.substring(3)).toString(16);
|
|
3625
3634
|
let o = "";
|
|
3626
3635
|
for (let s = 0; s < 6 - n.length; s++)
|
|
3627
3636
|
o += "0";
|
|
@@ -3633,15 +3642,15 @@ function $o(e) {
|
|
|
3633
3642
|
throw new xe(e);
|
|
3634
3643
|
return `#${r}`;
|
|
3635
3644
|
}
|
|
3636
|
-
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""), Ao = new RegExp(`^#${ke("([a-f0-9])", 3)}([a-f0-9])?$`, "i"), Lo = new RegExp(`^#${ke("([a-f0-9]{2})", 3)}([a-f0-9]{2})?$`, "i"), zo = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ke(",\\s*(\\d+)\\s*", 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, "i"), Yo = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i, Bo = /^[a-z]+$/i,
|
|
3645
|
+
const ke = (e, t) => Array.from(Array(t)).map(() => e).join(""), Ao = new RegExp(`^#${ke("([a-f0-9])", 3)}([a-f0-9])?$`, "i"), Lo = new RegExp(`^#${ke("([a-f0-9]{2})", 3)}([a-f0-9]{2})?$`, "i"), zo = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${ke(",\\s*(\\d+)\\s*", 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, "i"), Yo = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i, Bo = /^[a-z]+$/i, Qt = (e) => Math.round(e * 255), No = (e, t, r) => {
|
|
3637
3646
|
let n = r / 100;
|
|
3638
3647
|
if (t === 0)
|
|
3639
|
-
return [n, n, n].map(
|
|
3648
|
+
return [n, n, n].map(Qt);
|
|
3640
3649
|
const o = (e % 360 + 360) % 360 / 60, s = (1 - Math.abs(2 * n - 1)) * (t / 100), c = s * (1 - Math.abs(o % 2 - 1));
|
|
3641
|
-
let u = 0, l = 0,
|
|
3642
|
-
o >= 0 && o < 1 ? (u = s, l = c) : o >= 1 && o < 2 ? (u = c, l = s) : o >= 2 && o < 3 ? (l = s,
|
|
3643
|
-
const f = n - s / 2, a = u + f, h = l + f,
|
|
3644
|
-
return [a, h,
|
|
3650
|
+
let u = 0, l = 0, d = 0;
|
|
3651
|
+
o >= 0 && o < 1 ? (u = s, l = c) : o >= 1 && o < 2 ? (u = c, l = s) : o >= 2 && o < 3 ? (l = s, d = c) : o >= 3 && o < 4 ? (l = c, d = s) : o >= 4 && o < 5 ? (u = c, d = s) : o >= 5 && o < 6 && (u = s, d = c);
|
|
3652
|
+
const f = n - s / 2, a = u + f, h = l + f, _ = d + f;
|
|
3653
|
+
return [a, h, _].map(Qt);
|
|
3645
3654
|
};
|
|
3646
3655
|
function Xo(e) {
|
|
3647
3656
|
if (e === "transparent")
|
|
@@ -3675,8 +3684,8 @@ const Wo = H({
|
|
|
3675
3684
|
pointerEvents: "none"
|
|
3676
3685
|
}), Fo = ({ color: e = "#666", size: t = 40, text: r }) => {
|
|
3677
3686
|
const n = Uo(e) ? "#222" : "#EEE";
|
|
3678
|
-
return /* @__PURE__ */
|
|
3679
|
-
/* @__PURE__ */
|
|
3687
|
+
return /* @__PURE__ */ ue("div", { className: Wo, children: [
|
|
3688
|
+
/* @__PURE__ */ ue(
|
|
3680
3689
|
"svg",
|
|
3681
3690
|
{
|
|
3682
3691
|
version: "1.1",
|
|
@@ -3685,7 +3694,7 @@ const Wo = H({
|
|
|
3685
3694
|
width: t,
|
|
3686
3695
|
height: t,
|
|
3687
3696
|
children: [
|
|
3688
|
-
/* @__PURE__ */
|
|
3697
|
+
/* @__PURE__ */ T(
|
|
3689
3698
|
"path",
|
|
3690
3699
|
{
|
|
3691
3700
|
d: "m 1197.1015,869.718 -62.2719,-154.49286 133.3276,-9.05842 -257.6915,-253.12748 1.2392,356.98609 88.2465,-79.47087 61.702,152.78366 z",
|
|
@@ -3694,7 +3703,7 @@ const Wo = H({
|
|
|
3694
3703
|
}
|
|
3695
3704
|
}
|
|
3696
3705
|
),
|
|
3697
|
-
/* @__PURE__ */
|
|
3706
|
+
/* @__PURE__ */ T(
|
|
3698
3707
|
"path",
|
|
3699
3708
|
{
|
|
3700
3709
|
d: "m 1193.0939,861.12419 -62.2719,-154.49286 133.3276,-9.05842 -257.6915,-253.12748 1.2392,356.98609 88.2465,-79.47087 61.702,152.78366 z",
|
|
@@ -3708,7 +3717,7 @@ const Wo = H({
|
|
|
3708
3717
|
]
|
|
3709
3718
|
}
|
|
3710
3719
|
),
|
|
3711
|
-
/* @__PURE__ */
|
|
3720
|
+
/* @__PURE__ */ T(
|
|
3712
3721
|
"div",
|
|
3713
3722
|
{
|
|
3714
3723
|
style: {
|
|
@@ -3726,14 +3735,14 @@ const Wo = H({
|
|
|
3726
3735
|
zIndex: 210,
|
|
3727
3736
|
position: "fixed",
|
|
3728
3737
|
pointerEvents: "none"
|
|
3729
|
-
}), qo = ({ pos: e, ...t }) => /* @__PURE__ */
|
|
3738
|
+
}), qo = ({ pos: e, ...t }) => /* @__PURE__ */ T(
|
|
3730
3739
|
"div",
|
|
3731
3740
|
{
|
|
3732
3741
|
className: Ho,
|
|
3733
3742
|
style: {
|
|
3734
3743
|
transform: `translate(${e.x - 6}px, ${e.y - 15}px)`
|
|
3735
3744
|
},
|
|
3736
|
-
children: /* @__PURE__ */
|
|
3745
|
+
children: /* @__PURE__ */ T(Ko, { ...t })
|
|
3737
3746
|
}
|
|
3738
3747
|
), Go = ({ children: e }) => {
|
|
3739
3748
|
const [t] = Z((v) => [v.getConfiguration]), { fromWrapperToBoard: r, fromBoardToWrapper: n } = Me(), [o, s, c, u] = Se(
|
|
@@ -3743,26 +3752,26 @@ const Wo = H({
|
|
|
3743
3752
|
v.cursors,
|
|
3744
3753
|
v.users
|
|
3745
3754
|
]
|
|
3746
|
-
), [l,
|
|
3755
|
+
), [l, d] = Se((v) => [
|
|
3747
3756
|
v.moveCursor,
|
|
3748
3757
|
v.removeCursor
|
|
3749
|
-
]), { boardWrapperRect: f } = t(), a = ({ clientX: v, clientY:
|
|
3750
|
-
const [
|
|
3758
|
+
]), { boardWrapperRect: f } = t(), a = ({ clientX: v, clientY: E }) => {
|
|
3759
|
+
const [I, y] = r(
|
|
3751
3760
|
v - f.left,
|
|
3752
|
-
|
|
3761
|
+
E - f.top
|
|
3753
3762
|
);
|
|
3754
|
-
l(o.id, { x:
|
|
3763
|
+
l(o.id, { x: I, y });
|
|
3755
3764
|
}, h = () => {
|
|
3756
|
-
|
|
3757
|
-
},
|
|
3758
|
-
return /* @__PURE__ */
|
|
3765
|
+
d(o.id);
|
|
3766
|
+
}, _ = s.reduce((v, E) => (E.id !== o.id && c[E.id] && (v[E.id] = c[E.id]), v), {});
|
|
3767
|
+
return /* @__PURE__ */ ue("div", { onPointerMove: a, onPointerLeave: h, children: [
|
|
3759
3768
|
e,
|
|
3760
|
-
Object.entries(
|
|
3761
|
-
const [
|
|
3762
|
-
x:
|
|
3763
|
-
y:
|
|
3769
|
+
Object.entries(_).map(([v, E]) => {
|
|
3770
|
+
const [I, y] = n(E.x, E.y), w = {
|
|
3771
|
+
x: I + f.left,
|
|
3772
|
+
y: y + f.top
|
|
3764
3773
|
};
|
|
3765
|
-
return ft(w, f) ? /* @__PURE__ */
|
|
3774
|
+
return ft(w, f) ? /* @__PURE__ */ T(
|
|
3766
3775
|
qo,
|
|
3767
3776
|
{
|
|
3768
3777
|
pos: w,
|
|
@@ -3782,12 +3791,12 @@ const Wo = H({
|
|
|
3782
3791
|
style: t,
|
|
3783
3792
|
wrapperStyle: r,
|
|
3784
3793
|
itemTemplates: n = {},
|
|
3785
|
-
boardSize: o =
|
|
3794
|
+
boardSize: o = ir,
|
|
3786
3795
|
children: s,
|
|
3787
3796
|
showResizeHandle: c = !1,
|
|
3788
3797
|
Wrapper: u = Jo
|
|
3789
3798
|
}) => {
|
|
3790
|
-
const l = g.useRef(null), [
|
|
3799
|
+
const l = g.useRef(null), [d, f] = Z((v) => [
|
|
3791
3800
|
v.config.uid,
|
|
3792
3801
|
v.updateConfiguration
|
|
3793
3802
|
]), { updateItemExtent: a } = Me(), h = {
|
|
@@ -3798,8 +3807,8 @@ const Wo = H({
|
|
|
3798
3807
|
...t
|
|
3799
3808
|
};
|
|
3800
3809
|
g.useEffect(() => {
|
|
3801
|
-
const v = (
|
|
3802
|
-
Oe(
|
|
3810
|
+
const v = (E) => {
|
|
3811
|
+
Oe(E.target, "board") && E.preventDefault();
|
|
3803
3812
|
};
|
|
3804
3813
|
return document.body.addEventListener("wheel", v, { passive: !1 }), () => {
|
|
3805
3814
|
document.body.removeEventListener("wheel", v);
|
|
@@ -3809,10 +3818,10 @@ const Wo = H({
|
|
|
3809
3818
|
boardWrapper: l.current
|
|
3810
3819
|
});
|
|
3811
3820
|
}, [f]), g.useEffect(() => {
|
|
3812
|
-
|
|
3813
|
-
uid:
|
|
3821
|
+
d || f({
|
|
3822
|
+
uid: pe()
|
|
3814
3823
|
});
|
|
3815
|
-
}, [
|
|
3824
|
+
}, [d, f]), g.useEffect(() => {
|
|
3816
3825
|
f({
|
|
3817
3826
|
itemTemplates: n,
|
|
3818
3827
|
boardSize: o,
|
|
@@ -3827,15 +3836,15 @@ const Wo = H({
|
|
|
3827
3836
|
boardWrapperRect: l.current.getBoundingClientRect()
|
|
3828
3837
|
});
|
|
3829
3838
|
});
|
|
3830
|
-
const
|
|
3831
|
-
return /* @__PURE__ */
|
|
3839
|
+
const _ = H({ ...Zo, ...r });
|
|
3840
|
+
return /* @__PURE__ */ ue(
|
|
3832
3841
|
"div",
|
|
3833
3842
|
{
|
|
3834
3843
|
ref: l,
|
|
3835
|
-
id:
|
|
3836
|
-
className: `sync-board ${
|
|
3844
|
+
id: d,
|
|
3845
|
+
className: `sync-board ${_}`,
|
|
3837
3846
|
children: [
|
|
3838
|
-
/* @__PURE__ */
|
|
3847
|
+
/* @__PURE__ */ T(Go, { children: /* @__PURE__ */ T(So, { moveFirst: e, children: /* @__PURE__ */ T(wo, { moveFirst: e, children: /* @__PURE__ */ T(_o, { moveFirst: e, children: /* @__PURE__ */ T(u, { children: /* @__PURE__ */ ue(
|
|
3839
3848
|
"div",
|
|
3840
3849
|
{
|
|
3841
3850
|
onContextMenu: (v) => {
|
|
@@ -3844,12 +3853,12 @@ const Wo = H({
|
|
|
3844
3853
|
style: h,
|
|
3845
3854
|
className: "board",
|
|
3846
3855
|
children: [
|
|
3847
|
-
/* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ T(fo, {}),
|
|
3848
3857
|
s
|
|
3849
3858
|
]
|
|
3850
3859
|
}
|
|
3851
3860
|
) }) }) }) }) }),
|
|
3852
|
-
/* @__PURE__ */
|
|
3861
|
+
/* @__PURE__ */ T(Io, {})
|
|
3853
3862
|
]
|
|
3854
3863
|
}
|
|
3855
3864
|
);
|
|
@@ -3865,7 +3874,7 @@ export {
|
|
|
3865
3874
|
cs as useBoardState,
|
|
3866
3875
|
rs as useDebouncedItems,
|
|
3867
3876
|
gt as useItemActions,
|
|
3868
|
-
|
|
3877
|
+
Wt as useItemInteraction,
|
|
3869
3878
|
ts as useItems,
|
|
3870
3879
|
ls as useMessage,
|
|
3871
3880
|
ns as useSelectedItems,
|