react-sync-board 1.0.0 → 1.0.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.
@@ -0,0 +1,4887 @@
1
+ var Zn = Object.defineProperty;
2
+ var Hn = (e, t, r) => t in e ? Zn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var lr = (e, t, r) => (Hn(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import * as fr from "react";
5
+ import g, { useContext as Se, useDebugValue as Kn, useRef as ke, useMemo as Dt, useEffect as ct, useCallback as qn, forwardRef as Jn, createContext as Gr, createElement as Ae, Fragment as Fr, memo as Zr } from "react";
6
+ function Qn(e) {
7
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
8
+ }
9
+ var Be = {}, es = {
10
+ get exports() {
11
+ return Be;
12
+ },
13
+ set exports(e) {
14
+ Be = e;
15
+ }
16
+ }, je = {};
17
+ /**
18
+ * @license React
19
+ * react-jsx-runtime.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+ var dr;
27
+ function ts() {
28
+ if (dr)
29
+ return je;
30
+ dr = 1;
31
+ var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, s = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
32
+ function i(a, l, d) {
33
+ var f, u = {}, E = null, S = null;
34
+ d !== void 0 && (E = "" + d), l.key !== void 0 && (E = "" + l.key), l.ref !== void 0 && (S = l.ref);
35
+ for (f in l)
36
+ n.call(l, f) && !o.hasOwnProperty(f) && (u[f] = l[f]);
37
+ if (a && a.defaultProps)
38
+ for (f in l = a.defaultProps, l)
39
+ u[f] === void 0 && (u[f] = l[f]);
40
+ return { $$typeof: t, type: a, key: E, ref: S, props: u, _owner: s.current };
41
+ }
42
+ return je.Fragment = r, je.jsx = i, je.jsxs = i, je;
43
+ }
44
+ var De = {};
45
+ /**
46
+ * @license React
47
+ * react-jsx-runtime.development.js
48
+ *
49
+ * Copyright (c) Facebook, Inc. and its affiliates.
50
+ *
51
+ * This source code is licensed under the MIT license found in the
52
+ * LICENSE file in the root directory of this source tree.
53
+ */
54
+ var pr;
55
+ function rs() {
56
+ return pr || (pr = 1, process.env.NODE_ENV !== "production" && function() {
57
+ var e = g, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), a = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), f = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), b = Symbol.iterator, p = "@@iterator";
58
+ function v(c) {
59
+ if (c === null || typeof c != "object")
60
+ return null;
61
+ var _ = b && c[b] || c[p];
62
+ return typeof _ == "function" ? _ : null;
63
+ }
64
+ var C = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
65
+ function w(c) {
66
+ {
67
+ for (var _ = arguments.length, R = new Array(_ > 1 ? _ - 1 : 0), T = 1; T < _; T++)
68
+ R[T - 1] = arguments[T];
69
+ y("error", c, R);
70
+ }
71
+ }
72
+ function y(c, _, R) {
73
+ {
74
+ var T = C.ReactDebugCurrentFrame, W = T.getStackAddendum();
75
+ W !== "" && (_ += "%s", R = R.concat([W]));
76
+ var V = R.map(function(z) {
77
+ return String(z);
78
+ });
79
+ V.unshift("Warning: " + _), Function.prototype.apply.call(console[c], console, V);
80
+ }
81
+ }
82
+ var h = !1, x = !1, m = !1, I = !1, N = !1, A;
83
+ A = Symbol.for("react.module.reference");
84
+ function M(c) {
85
+ return !!(typeof c == "string" || typeof c == "function" || c === n || c === o || N || c === s || c === d || c === f || I || c === S || h || x || m || typeof c == "object" && c !== null && (c.$$typeof === E || c.$$typeof === u || c.$$typeof === i || c.$$typeof === a || c.$$typeof === l || // This needs to include all possible module reference object
86
+ // types supported by any Flight configuration anywhere since
87
+ // we don't know which Flight build this will end up being used
88
+ // with.
89
+ c.$$typeof === A || c.getModuleId !== void 0));
90
+ }
91
+ function L(c, _, R) {
92
+ var T = c.displayName;
93
+ if (T)
94
+ return T;
95
+ var W = _.displayName || _.name || "";
96
+ return W !== "" ? R + "(" + W + ")" : R;
97
+ }
98
+ function B(c) {
99
+ return c.displayName || "Context";
100
+ }
101
+ function Z(c) {
102
+ if (c == null)
103
+ return null;
104
+ if (typeof c.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof c == "function")
105
+ return c.displayName || c.name || null;
106
+ if (typeof c == "string")
107
+ return c;
108
+ switch (c) {
109
+ case n:
110
+ return "Fragment";
111
+ case r:
112
+ return "Portal";
113
+ case o:
114
+ return "Profiler";
115
+ case s:
116
+ return "StrictMode";
117
+ case d:
118
+ return "Suspense";
119
+ case f:
120
+ return "SuspenseList";
121
+ }
122
+ if (typeof c == "object")
123
+ switch (c.$$typeof) {
124
+ case a:
125
+ var _ = c;
126
+ return B(_) + ".Consumer";
127
+ case i:
128
+ var R = c;
129
+ return B(R._context) + ".Provider";
130
+ case l:
131
+ return L(c, c.render, "ForwardRef");
132
+ case u:
133
+ var T = c.displayName || null;
134
+ return T !== null ? T : Z(c.type) || "Memo";
135
+ case E: {
136
+ var W = c, V = W._payload, z = W._init;
137
+ try {
138
+ return Z(z(V));
139
+ } catch {
140
+ return null;
141
+ }
142
+ }
143
+ }
144
+ return null;
145
+ }
146
+ var H = Object.assign, O = 0, P, j, X, Y, G, ee, ie;
147
+ function ce() {
148
+ }
149
+ ce.__reactDisabledLog = !0;
150
+ function ue() {
151
+ {
152
+ if (O === 0) {
153
+ P = console.log, j = console.info, X = console.warn, Y = console.error, G = console.group, ee = console.groupCollapsed, ie = console.groupEnd;
154
+ var c = {
155
+ configurable: !0,
156
+ enumerable: !0,
157
+ value: ce,
158
+ writable: !0
159
+ };
160
+ Object.defineProperties(console, {
161
+ info: c,
162
+ log: c,
163
+ warn: c,
164
+ error: c,
165
+ group: c,
166
+ groupCollapsed: c,
167
+ groupEnd: c
168
+ });
169
+ }
170
+ O++;
171
+ }
172
+ }
173
+ function F() {
174
+ {
175
+ if (O--, O === 0) {
176
+ var c = {
177
+ configurable: !0,
178
+ enumerable: !0,
179
+ writable: !0
180
+ };
181
+ Object.defineProperties(console, {
182
+ log: H({}, c, {
183
+ value: P
184
+ }),
185
+ info: H({}, c, {
186
+ value: j
187
+ }),
188
+ warn: H({}, c, {
189
+ value: X
190
+ }),
191
+ error: H({}, c, {
192
+ value: Y
193
+ }),
194
+ group: H({}, c, {
195
+ value: G
196
+ }),
197
+ groupCollapsed: H({}, c, {
198
+ value: ee
199
+ }),
200
+ groupEnd: H({}, c, {
201
+ value: ie
202
+ })
203
+ });
204
+ }
205
+ O < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
206
+ }
207
+ }
208
+ var se = C.ReactCurrentDispatcher, be;
209
+ function Ie(c, _, R) {
210
+ {
211
+ if (be === void 0)
212
+ try {
213
+ throw Error();
214
+ } catch (W) {
215
+ var T = W.stack.trim().match(/\n( *(at )?)/);
216
+ be = T && T[1] || "";
217
+ }
218
+ return `
219
+ ` + be + c;
220
+ }
221
+ }
222
+ var ht = !1, He;
223
+ {
224
+ var _n = typeof WeakMap == "function" ? WeakMap : Map;
225
+ He = new _n();
226
+ }
227
+ function Kt(c, _) {
228
+ if (!c || ht)
229
+ return "";
230
+ {
231
+ var R = He.get(c);
232
+ if (R !== void 0)
233
+ return R;
234
+ }
235
+ var T;
236
+ ht = !0;
237
+ var W = Error.prepareStackTrace;
238
+ Error.prepareStackTrace = void 0;
239
+ var V;
240
+ V = se.current, se.current = null, ue();
241
+ try {
242
+ if (_) {
243
+ var z = function() {
244
+ throw Error();
245
+ };
246
+ if (Object.defineProperty(z.prototype, "props", {
247
+ set: function() {
248
+ throw Error();
249
+ }
250
+ }), typeof Reflect == "object" && Reflect.construct) {
251
+ try {
252
+ Reflect.construct(z, []);
253
+ } catch (he) {
254
+ T = he;
255
+ }
256
+ Reflect.construct(c, [], z);
257
+ } else {
258
+ try {
259
+ z.call();
260
+ } catch (he) {
261
+ T = he;
262
+ }
263
+ c.call(z.prototype);
264
+ }
265
+ } else {
266
+ try {
267
+ throw Error();
268
+ } catch (he) {
269
+ T = he;
270
+ }
271
+ c();
272
+ }
273
+ } catch (he) {
274
+ if (he && T && typeof he.stack == "string") {
275
+ for (var D = he.stack.split(`
276
+ `), ne = T.stack.split(`
277
+ `), K = D.length - 1, q = ne.length - 1; K >= 1 && q >= 0 && D[K] !== ne[q]; )
278
+ q--;
279
+ for (; K >= 1 && q >= 0; K--, q--)
280
+ if (D[K] !== ne[q]) {
281
+ if (K !== 1 || q !== 1)
282
+ do
283
+ if (K--, q--, q < 0 || D[K] !== ne[q]) {
284
+ var le = `
285
+ ` + D[K].replace(" at new ", " at ");
286
+ return c.displayName && le.includes("<anonymous>") && (le = le.replace("<anonymous>", c.displayName)), typeof c == "function" && He.set(c, le), le;
287
+ }
288
+ while (K >= 1 && q >= 0);
289
+ break;
290
+ }
291
+ }
292
+ } finally {
293
+ ht = !1, se.current = V, F(), Error.prepareStackTrace = W;
294
+ }
295
+ var xe = c ? c.displayName || c.name : "", ur = xe ? Ie(xe) : "";
296
+ return typeof c == "function" && He.set(c, ur), ur;
297
+ }
298
+ function xn(c, _, R) {
299
+ return Kt(c, !1);
300
+ }
301
+ function Rn(c) {
302
+ var _ = c.prototype;
303
+ return !!(_ && _.isReactComponent);
304
+ }
305
+ function Ke(c, _, R) {
306
+ if (c == null)
307
+ return "";
308
+ if (typeof c == "function")
309
+ return Kt(c, Rn(c));
310
+ if (typeof c == "string")
311
+ return Ie(c);
312
+ switch (c) {
313
+ case d:
314
+ return Ie("Suspense");
315
+ case f:
316
+ return Ie("SuspenseList");
317
+ }
318
+ if (typeof c == "object")
319
+ switch (c.$$typeof) {
320
+ case l:
321
+ return xn(c.render);
322
+ case u:
323
+ return Ke(c.type, _, R);
324
+ case E: {
325
+ var T = c, W = T._payload, V = T._init;
326
+ try {
327
+ return Ke(V(W), _, R);
328
+ } catch {
329
+ }
330
+ }
331
+ }
332
+ return "";
333
+ }
334
+ var qe = Object.prototype.hasOwnProperty, qt = {}, Jt = C.ReactDebugCurrentFrame;
335
+ function Je(c) {
336
+ if (c) {
337
+ var _ = c._owner, R = Ke(c.type, c._source, _ ? _.type : null);
338
+ Jt.setExtraStackFrame(R);
339
+ } else
340
+ Jt.setExtraStackFrame(null);
341
+ }
342
+ function On(c, _, R, T, W) {
343
+ {
344
+ var V = Function.call.bind(qe);
345
+ for (var z in c)
346
+ if (V(c, z)) {
347
+ var D = void 0;
348
+ try {
349
+ if (typeof c[z] != "function") {
350
+ var ne = Error((T || "React class") + ": " + R + " type `" + z + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof c[z] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
351
+ throw ne.name = "Invariant Violation", ne;
352
+ }
353
+ D = c[z](_, z, T, R, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
354
+ } catch (K) {
355
+ D = K;
356
+ }
357
+ D && !(D instanceof Error) && (Je(W), 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).", T || "React class", R, z, typeof D), Je(null)), D instanceof Error && !(D.message in qt) && (qt[D.message] = !0, Je(W), w("Failed %s type: %s", R, D.message), Je(null));
358
+ }
359
+ }
360
+ }
361
+ var kn = Array.isArray;
362
+ function vt(c) {
363
+ return kn(c);
364
+ }
365
+ function An(c) {
366
+ {
367
+ var _ = typeof Symbol == "function" && Symbol.toStringTag, R = _ && c[Symbol.toStringTag] || c.constructor.name || "Object";
368
+ return R;
369
+ }
370
+ }
371
+ function Mn(c) {
372
+ try {
373
+ return Qt(c), !1;
374
+ } catch {
375
+ return !0;
376
+ }
377
+ }
378
+ function Qt(c) {
379
+ return "" + c;
380
+ }
381
+ function er(c) {
382
+ if (Mn(c))
383
+ return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", An(c)), Qt(c);
384
+ }
385
+ var Pe = C.ReactCurrentOwner, Nn = {
386
+ key: !0,
387
+ ref: !0,
388
+ __self: !0,
389
+ __source: !0
390
+ }, tr, rr, yt;
391
+ yt = {};
392
+ function Tn(c) {
393
+ if (qe.call(c, "ref")) {
394
+ var _ = Object.getOwnPropertyDescriptor(c, "ref").get;
395
+ if (_ && _.isReactWarning)
396
+ return !1;
397
+ }
398
+ return c.ref !== void 0;
399
+ }
400
+ function Ln(c) {
401
+ if (qe.call(c, "key")) {
402
+ var _ = Object.getOwnPropertyDescriptor(c, "key").get;
403
+ if (_ && _.isReactWarning)
404
+ return !1;
405
+ }
406
+ return c.key !== void 0;
407
+ }
408
+ function Pn(c, _) {
409
+ if (typeof c.ref == "string" && Pe.current && _ && Pe.current.stateNode !== _) {
410
+ var R = Z(Pe.current.type);
411
+ yt[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', Z(Pe.current.type), c.ref), yt[R] = !0);
412
+ }
413
+ }
414
+ function jn(c, _) {
415
+ {
416
+ var R = function() {
417
+ tr || (tr = !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)", _));
418
+ };
419
+ R.isReactWarning = !0, Object.defineProperty(c, "key", {
420
+ get: R,
421
+ configurable: !0
422
+ });
423
+ }
424
+ }
425
+ function Dn(c, _) {
426
+ {
427
+ var R = function() {
428
+ rr || (rr = !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)", _));
429
+ };
430
+ R.isReactWarning = !0, Object.defineProperty(c, "ref", {
431
+ get: R,
432
+ configurable: !0
433
+ });
434
+ }
435
+ }
436
+ var zn = function(c, _, R, T, W, V, z) {
437
+ var D = {
438
+ // This tag allows us to uniquely identify this as a React Element
439
+ $$typeof: t,
440
+ // Built-in properties that belong on the element
441
+ type: c,
442
+ key: _,
443
+ ref: R,
444
+ props: z,
445
+ // Record the component responsible for creating this element.
446
+ _owner: V
447
+ };
448
+ return D._store = {}, Object.defineProperty(D._store, "validated", {
449
+ configurable: !1,
450
+ enumerable: !1,
451
+ writable: !0,
452
+ value: !1
453
+ }), Object.defineProperty(D, "_self", {
454
+ configurable: !1,
455
+ enumerable: !1,
456
+ writable: !1,
457
+ value: T
458
+ }), Object.defineProperty(D, "_source", {
459
+ configurable: !1,
460
+ enumerable: !1,
461
+ writable: !1,
462
+ value: W
463
+ }), Object.freeze && (Object.freeze(D.props), Object.freeze(D)), D;
464
+ };
465
+ function Yn(c, _, R, T, W) {
466
+ {
467
+ var V, z = {}, D = null, ne = null;
468
+ R !== void 0 && (er(R), D = "" + R), Ln(_) && (er(_.key), D = "" + _.key), Tn(_) && (ne = _.ref, Pn(_, W));
469
+ for (V in _)
470
+ qe.call(_, V) && !Nn.hasOwnProperty(V) && (z[V] = _[V]);
471
+ if (c && c.defaultProps) {
472
+ var K = c.defaultProps;
473
+ for (V in K)
474
+ z[V] === void 0 && (z[V] = K[V]);
475
+ }
476
+ if (D || ne) {
477
+ var q = typeof c == "function" ? c.displayName || c.name || "Unknown" : c;
478
+ D && jn(z, q), ne && Dn(z, q);
479
+ }
480
+ return zn(c, D, ne, W, T, Pe.current, z);
481
+ }
482
+ }
483
+ var bt = C.ReactCurrentOwner, nr = C.ReactDebugCurrentFrame;
484
+ function _e(c) {
485
+ if (c) {
486
+ var _ = c._owner, R = Ke(c.type, c._source, _ ? _.type : null);
487
+ nr.setExtraStackFrame(R);
488
+ } else
489
+ nr.setExtraStackFrame(null);
490
+ }
491
+ var St;
492
+ St = !1;
493
+ function Ct(c) {
494
+ return typeof c == "object" && c !== null && c.$$typeof === t;
495
+ }
496
+ function sr() {
497
+ {
498
+ if (bt.current) {
499
+ var c = Z(bt.current.type);
500
+ if (c)
501
+ return `
502
+
503
+ Check the render method of \`` + c + "`.";
504
+ }
505
+ return "";
506
+ }
507
+ }
508
+ function Bn(c) {
509
+ {
510
+ if (c !== void 0) {
511
+ var _ = c.fileName.replace(/^.*[\\\/]/, ""), R = c.lineNumber;
512
+ return `
513
+
514
+ Check your code at ` + _ + ":" + R + ".";
515
+ }
516
+ return "";
517
+ }
518
+ }
519
+ var or = {};
520
+ function Wn(c) {
521
+ {
522
+ var _ = sr();
523
+ if (!_) {
524
+ var R = typeof c == "string" ? c : c.displayName || c.name;
525
+ R && (_ = `
526
+
527
+ Check the top-level render call using <` + R + ">.");
528
+ }
529
+ return _;
530
+ }
531
+ }
532
+ function ir(c, _) {
533
+ {
534
+ if (!c._store || c._store.validated || c.key != null)
535
+ return;
536
+ c._store.validated = !0;
537
+ var R = Wn(_);
538
+ if (or[R])
539
+ return;
540
+ or[R] = !0;
541
+ var T = "";
542
+ c && c._owner && c._owner !== bt.current && (T = " It was passed a child from " + Z(c._owner.type) + "."), _e(c), 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, T), _e(null);
543
+ }
544
+ }
545
+ function ar(c, _) {
546
+ {
547
+ if (typeof c != "object")
548
+ return;
549
+ if (vt(c))
550
+ for (var R = 0; R < c.length; R++) {
551
+ var T = c[R];
552
+ Ct(T) && ir(T, _);
553
+ }
554
+ else if (Ct(c))
555
+ c._store && (c._store.validated = !0);
556
+ else if (c) {
557
+ var W = v(c);
558
+ if (typeof W == "function" && W !== c.entries)
559
+ for (var V = W.call(c), z; !(z = V.next()).done; )
560
+ Ct(z.value) && ir(z.value, _);
561
+ }
562
+ }
563
+ }
564
+ function $n(c) {
565
+ {
566
+ var _ = c.type;
567
+ if (_ == null || typeof _ == "string")
568
+ return;
569
+ var R;
570
+ if (typeof _ == "function")
571
+ R = _.propTypes;
572
+ else if (typeof _ == "object" && (_.$$typeof === l || // Note: Memo only checks outer props here.
573
+ // Inner props are checked in the reconciler.
574
+ _.$$typeof === u))
575
+ R = _.propTypes;
576
+ else
577
+ return;
578
+ if (R) {
579
+ var T = Z(_);
580
+ On(R, c.props, "prop", T, c);
581
+ } else if (_.PropTypes !== void 0 && !St) {
582
+ St = !0;
583
+ var W = Z(_);
584
+ w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", W || "Unknown");
585
+ }
586
+ typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
587
+ }
588
+ }
589
+ function Un(c) {
590
+ {
591
+ for (var _ = Object.keys(c.props), R = 0; R < _.length; R++) {
592
+ var T = _[R];
593
+ if (T !== "children" && T !== "key") {
594
+ _e(c), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", T), _e(null);
595
+ break;
596
+ }
597
+ }
598
+ c.ref !== null && (_e(c), w("Invalid attribute `ref` supplied to `React.Fragment`."), _e(null));
599
+ }
600
+ }
601
+ function cr(c, _, R, T, W, V) {
602
+ {
603
+ var z = M(c);
604
+ if (!z) {
605
+ var D = "";
606
+ (c === void 0 || typeof c == "object" && c !== null && Object.keys(c).length === 0) && (D += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
607
+ var ne = Bn(W);
608
+ ne ? D += ne : D += sr();
609
+ var K;
610
+ c === null ? K = "null" : vt(c) ? K = "array" : c !== void 0 && c.$$typeof === t ? (K = "<" + (Z(c.type) || "Unknown") + " />", D = " Did you accidentally export a JSX literal instead of a component?") : K = typeof c, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", K, D);
611
+ }
612
+ var q = Yn(c, _, R, W, V);
613
+ if (q == null)
614
+ return q;
615
+ if (z) {
616
+ var le = _.children;
617
+ if (le !== void 0)
618
+ if (T)
619
+ if (vt(le)) {
620
+ for (var xe = 0; xe < le.length; xe++)
621
+ ar(le[xe], c);
622
+ Object.freeze && Object.freeze(le);
623
+ } else
624
+ 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.");
625
+ else
626
+ ar(le, c);
627
+ }
628
+ return c === n ? Un(q) : $n(q), q;
629
+ }
630
+ }
631
+ function Xn(c, _, R) {
632
+ return cr(c, _, R, !0);
633
+ }
634
+ function Vn(c, _, R) {
635
+ return cr(c, _, R, !1);
636
+ }
637
+ var Gn = Vn, Fn = Xn;
638
+ De.Fragment = n, De.jsx = Gn, De.jsxs = Fn;
639
+ }()), De;
640
+ }
641
+ (function(e) {
642
+ process.env.NODE_ENV === "production" ? e.exports = ts() : e.exports = rs();
643
+ })(es);
644
+ const Hr = Be.Fragment, k = Be.jsx, ve = Be.jsxs;
645
+ let ns = (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), "");
646
+ class ss {
647
+ constructor(t, r, n = null) {
648
+ this._socket = t, this.userId = n, this.room = r, this.toUnregister = [
649
+ () => {
650
+ this._socket.off(`${this.room}.isMaster`), this._socket.off(`${this.room}.roomJoined`), this._socket.off(`${this.room}._call`);
651
+ }
652
+ ], this._left = !1, this.registeredRPC = {}, this._socket.on(`${this.room}._call`, async ({ callId: s, name: o, params: i }) => {
653
+ try {
654
+ const a = await this.registeredRPC[o](i);
655
+ t.emit(`${this.room}._result.${s}`, {
656
+ ok: a || null
657
+ });
658
+ } catch (a) {
659
+ t.emit(`${this.room}._result.${s}`, {
660
+ err: `${a.message}`
661
+ });
662
+ }
663
+ });
664
+ }
665
+ /**
666
+ * Call a server procedure.
667
+ *
668
+ * @param {string} action name of the operation to call on the server.
669
+ * @param {*} params the params of the action.
670
+ * @returns the result of the call.
671
+ */
672
+ async _callServerRPC(t, r) {
673
+ const n = ns();
674
+ return new Promise((s, o) => {
675
+ this._socket.once(`${this.room}._result.${n}`, (i) => {
676
+ i.hasOwnProperty("ok") ? s(i.ok) : o(i.err);
677
+ }), this._socket.emit(`${this.room}._call`, { callId: n, name: t, params: r });
678
+ });
679
+ }
680
+ /**
681
+ * Leave current room
682
+ * @param {string} room name.
683
+ */
684
+ leave() {
685
+ this._left = !0, this.toUnregister.forEach((t) => {
686
+ t();
687
+ }), this._socket.emit(`${this.room}.leave`);
688
+ }
689
+ /**
690
+ * Send an event to all other client in room. Also to self if true.
691
+ * @param {string} name Name of event
692
+ * @param {*} params arguments of event
693
+ * @param {boolean} self if true, the publish get the event too
694
+ */
695
+ publish(t, r, n = !1) {
696
+ this._socket.emit(`${this.room}.publish`, { name: t, params: r, self: n });
697
+ }
698
+ /**
699
+ * Subscribe to an event.
700
+ * @param {string} event Name of event
701
+ * @param {function} callback Called when the event is received. First param
702
+ * of the function is the params sent with the event.
703
+ */
704
+ subscribe(t, r) {
705
+ this._socket.on(`${this.room}.${t}`, r);
706
+ const n = () => {
707
+ this._socket.off(`${this.room}.${t}`, r);
708
+ };
709
+ return this.toUnregister.push(n), n;
710
+ }
711
+ /**
712
+ * Register a new RPC function.
713
+ * @param {string} name of function
714
+ * @param {function} callback the function that handle the function result
715
+ * @param {object} params the configuration of the RPC. For now only `invoke`
716
+ * parameter is allowed with the following values:
717
+ * - 'single' for a RPC that can be registered only once.
718
+ * - 'first' The first registered client is called.
719
+ * - 'last' The last registered client is called.
720
+ * - 'random' A random RPC is called.
721
+ */
722
+ async register(t, r, { invoke: n = "single" } = {}) {
723
+ this.registeredRPC[t] = r, await this._callServerRPC("register", {
724
+ name: t,
725
+ invoke: n
726
+ });
727
+ const s = () => {
728
+ if (this.registeredRPC[t] === r)
729
+ return delete this.registeredRPC[t], this._callServerRPC("unregister", { name: t });
730
+ };
731
+ return this.toUnregister.push(s), s;
732
+ }
733
+ /**
734
+ * Call a previously registered function with `params` arguments.
735
+ * @param {string} name of function
736
+ * @param {*} params parameters of the called function.
737
+ */
738
+ async call(t, r) {
739
+ return await this._callServerRPC("call", { name: t, params: r });
740
+ }
741
+ }
742
+ const os = ({
743
+ socket: e,
744
+ room: t,
745
+ onJoined: r = () => {
746
+ },
747
+ onMaster: n = () => {
748
+ },
749
+ userId: s = null
750
+ }) => {
751
+ const o = new ss(e, t, s);
752
+ return new Promise((i) => {
753
+ let a = !0;
754
+ e.on(`${t}.isMaster`, () => {
755
+ o._left || n(t);
756
+ }), e.on(`${t}.roomJoined`, (l) => {
757
+ o._left || (o.userId = l, a = !1, r(o), i(o));
758
+ }), e.on("connect", () => {
759
+ o._left || a || e.emit("joinSuperSocket", {
760
+ room: t,
761
+ userId: o.userId
762
+ });
763
+ }), e.emit("joinSuperSocket", { room: t, userId: s });
764
+ });
765
+ }, kt = g.createContext(), is = () => /* @__PURE__ */ k(
766
+ "div",
767
+ {
768
+ style: {
769
+ position: "absolute",
770
+ top: "0",
771
+ bottom: "0",
772
+ width: "100%",
773
+ display: "flex",
774
+ justifyContent: "center",
775
+ alignItems: "center"
776
+ },
777
+ children: /* @__PURE__ */ k("h2", { children: "🌀 Loading..." })
778
+ }
779
+ ), Kr = ({
780
+ socket: e,
781
+ room: t,
782
+ channel: r = "default",
783
+ LoadingComponent: n = is,
784
+ children: s
785
+ }) => {
786
+ const [o, i] = g.useState(!1), [a, l] = g.useState(!1), [d, f] = g.useState(null), u = g.useRef(null), E = g.useRef(!1), S = Se(kt), b = g.useRef(!1);
787
+ return g.useEffect(() => (E.current = !0, () => {
788
+ E.current = !1;
789
+ }), []), g.useEffect(() => {
790
+ if (!e)
791
+ return null;
792
+ const p = () => {
793
+ console.log(`Disconnected from ${r}…`), E.current && (i(!1), l(!1));
794
+ };
795
+ return e.on("disconnect", p), () => {
796
+ e.off("disconnect", p);
797
+ };
798
+ }, [r, e]), g.useEffect(() => e ? (e.connected || e.connect(), console.log(`Try to connect to wire ${t} on channel ${r}`), b.current || (b.current = !0, os({
799
+ socket: e,
800
+ room: t,
801
+ onMaster: () => {
802
+ console.log(`Is now master on channel ${r}…`), E.current && l(!0);
803
+ },
804
+ onJoined: (p) => {
805
+ console.log(`Connected on channel ${r}…`), u.current = p, E.current && (f(p), i(!0));
806
+ }
807
+ })), () => {
808
+ var p;
809
+ (p = u.current) == null || p.leave();
810
+ }) : null, [r, t, e]), !o || !d ? /* @__PURE__ */ k(n, {}) : /* @__PURE__ */ k(
811
+ kt.Provider,
812
+ {
813
+ value: { ...S, [r]: { wire: d, joined: o, isMaster: a, room: t } },
814
+ children: s
815
+ }
816
+ );
817
+ }, ut = (e = "default") => (Se(kt) || {})[e], mr = (e) => {
818
+ let t;
819
+ const r = /* @__PURE__ */ new Set(), n = (l, d) => {
820
+ const f = typeof l == "function" ? l(t) : l;
821
+ if (!Object.is(f, t)) {
822
+ const u = t;
823
+ t = d ?? typeof f != "object" ? f : Object.assign({}, t, f), r.forEach((E) => E(t, u));
824
+ }
825
+ }, s = () => t, a = { setState: n, getState: s, subscribe: (l) => (r.add(l), () => r.delete(l)), destroy: () => {
826
+ ({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && console.warn(
827
+ "[DEPRECATED] The destroy method will be unsupported in the future version. You should use unsubscribe function returned by subscribe. Everything will be garbage collected if store is garbage collected."
828
+ ), r.clear();
829
+ } };
830
+ return t = e(n, s, a), a;
831
+ }, lt = (e) => e ? mr(e) : mr;
832
+ var At = {}, as = {
833
+ get exports() {
834
+ return At;
835
+ },
836
+ set exports(e) {
837
+ At = e;
838
+ }
839
+ }, Et = {}, ot = {}, cs = {
840
+ get exports() {
841
+ return ot;
842
+ },
843
+ set exports(e) {
844
+ ot = e;
845
+ }
846
+ }, wt = {};
847
+ /**
848
+ * @license React
849
+ * use-sync-external-store-shim.production.min.js
850
+ *
851
+ * Copyright (c) Facebook, Inc. and its affiliates.
852
+ *
853
+ * This source code is licensed under the MIT license found in the
854
+ * LICENSE file in the root directory of this source tree.
855
+ */
856
+ var gr;
857
+ function us() {
858
+ if (gr)
859
+ return wt;
860
+ gr = 1;
861
+ var e = g;
862
+ function t(u, E) {
863
+ return u === E && (u !== 0 || 1 / u === 1 / E) || u !== u && E !== E;
864
+ }
865
+ var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, s = e.useEffect, o = e.useLayoutEffect, i = e.useDebugValue;
866
+ function a(u, E) {
867
+ var S = E(), b = n({ inst: { value: S, getSnapshot: E } }), p = b[0].inst, v = b[1];
868
+ return o(function() {
869
+ p.value = S, p.getSnapshot = E, l(p) && v({ inst: p });
870
+ }, [u, S, E]), s(function() {
871
+ return l(p) && v({ inst: p }), u(function() {
872
+ l(p) && v({ inst: p });
873
+ });
874
+ }, [u]), i(S), S;
875
+ }
876
+ function l(u) {
877
+ var E = u.getSnapshot;
878
+ u = u.value;
879
+ try {
880
+ var S = E();
881
+ return !r(u, S);
882
+ } catch {
883
+ return !0;
884
+ }
885
+ }
886
+ function d(u, E) {
887
+ return E();
888
+ }
889
+ var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? d : a;
890
+ return wt.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : f, wt;
891
+ }
892
+ var It = {};
893
+ /**
894
+ * @license React
895
+ * use-sync-external-store-shim.development.js
896
+ *
897
+ * Copyright (c) Facebook, Inc. and its affiliates.
898
+ *
899
+ * This source code is licensed under the MIT license found in the
900
+ * LICENSE file in the root directory of this source tree.
901
+ */
902
+ var hr;
903
+ function ls() {
904
+ return hr || (hr = 1, process.env.NODE_ENV !== "production" && function() {
905
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
906
+ var e = g, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
907
+ function r(y) {
908
+ {
909
+ for (var h = arguments.length, x = new Array(h > 1 ? h - 1 : 0), m = 1; m < h; m++)
910
+ x[m - 1] = arguments[m];
911
+ n("error", y, x);
912
+ }
913
+ }
914
+ function n(y, h, x) {
915
+ {
916
+ var m = t.ReactDebugCurrentFrame, I = m.getStackAddendum();
917
+ I !== "" && (h += "%s", x = x.concat([I]));
918
+ var N = x.map(function(A) {
919
+ return String(A);
920
+ });
921
+ N.unshift("Warning: " + h), Function.prototype.apply.call(console[y], console, N);
922
+ }
923
+ }
924
+ function s(y, h) {
925
+ return y === h && (y !== 0 || 1 / y === 1 / h) || y !== y && h !== h;
926
+ }
927
+ var o = typeof Object.is == "function" ? Object.is : s, i = e.useState, a = e.useEffect, l = e.useLayoutEffect, d = e.useDebugValue, f = !1, u = !1;
928
+ function E(y, h, x) {
929
+ 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."));
930
+ var m = h();
931
+ if (!u) {
932
+ var I = h();
933
+ o(m, I) || (r("The result of getSnapshot should be cached to avoid an infinite loop"), u = !0);
934
+ }
935
+ var N = i({
936
+ inst: {
937
+ value: m,
938
+ getSnapshot: h
939
+ }
940
+ }), A = N[0].inst, M = N[1];
941
+ return l(function() {
942
+ A.value = m, A.getSnapshot = h, S(A) && M({
943
+ inst: A
944
+ });
945
+ }, [y, m, h]), a(function() {
946
+ S(A) && M({
947
+ inst: A
948
+ });
949
+ var L = function() {
950
+ S(A) && M({
951
+ inst: A
952
+ });
953
+ };
954
+ return y(L);
955
+ }, [y]), d(m), m;
956
+ }
957
+ function S(y) {
958
+ var h = y.getSnapshot, x = y.value;
959
+ try {
960
+ var m = h();
961
+ return !o(x, m);
962
+ } catch {
963
+ return !0;
964
+ }
965
+ }
966
+ function b(y, h, x) {
967
+ return h();
968
+ }
969
+ var p = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", v = !p, C = v ? b : E, w = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : C;
970
+ It.useSyncExternalStore = w, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
971
+ }()), It;
972
+ }
973
+ var vr;
974
+ function qr() {
975
+ return vr || (vr = 1, function(e) {
976
+ process.env.NODE_ENV === "production" ? e.exports = us() : e.exports = ls();
977
+ }(cs)), ot;
978
+ }
979
+ /**
980
+ * @license React
981
+ * use-sync-external-store-shim/with-selector.production.min.js
982
+ *
983
+ * Copyright (c) Facebook, Inc. and its affiliates.
984
+ *
985
+ * This source code is licensed under the MIT license found in the
986
+ * LICENSE file in the root directory of this source tree.
987
+ */
988
+ var yr;
989
+ function fs() {
990
+ if (yr)
991
+ return Et;
992
+ yr = 1;
993
+ var e = g, t = qr();
994
+ function r(d, f) {
995
+ return d === f && (d !== 0 || 1 / d === 1 / f) || d !== d && f !== f;
996
+ }
997
+ var n = typeof Object.is == "function" ? Object.is : r, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
998
+ return Et.useSyncExternalStoreWithSelector = function(d, f, u, E, S) {
999
+ var b = o(null);
1000
+ if (b.current === null) {
1001
+ var p = { hasValue: !1, value: null };
1002
+ b.current = p;
1003
+ } else
1004
+ p = b.current;
1005
+ b = a(function() {
1006
+ function C(m) {
1007
+ if (!w) {
1008
+ if (w = !0, y = m, m = E(m), S !== void 0 && p.hasValue) {
1009
+ var I = p.value;
1010
+ if (S(I, m))
1011
+ return h = I;
1012
+ }
1013
+ return h = m;
1014
+ }
1015
+ if (I = h, n(y, m))
1016
+ return I;
1017
+ var N = E(m);
1018
+ return S !== void 0 && S(I, N) ? I : (y = m, h = N);
1019
+ }
1020
+ var w = !1, y, h, x = u === void 0 ? null : u;
1021
+ return [function() {
1022
+ return C(f());
1023
+ }, x === null ? void 0 : function() {
1024
+ return C(x());
1025
+ }];
1026
+ }, [f, u, E, S]);
1027
+ var v = s(d, b[0], b[1]);
1028
+ return i(function() {
1029
+ p.hasValue = !0, p.value = v;
1030
+ }, [v]), l(v), v;
1031
+ }, Et;
1032
+ }
1033
+ var _t = {};
1034
+ /**
1035
+ * @license React
1036
+ * use-sync-external-store-shim/with-selector.development.js
1037
+ *
1038
+ * Copyright (c) Facebook, Inc. and its affiliates.
1039
+ *
1040
+ * This source code is licensed under the MIT license found in the
1041
+ * LICENSE file in the root directory of this source tree.
1042
+ */
1043
+ var br;
1044
+ function ds() {
1045
+ return br || (br = 1, process.env.NODE_ENV !== "production" && function() {
1046
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
1047
+ var e = g, t = qr();
1048
+ function r(f, u) {
1049
+ return f === u && (f !== 0 || 1 / f === 1 / u) || f !== f && u !== u;
1050
+ }
1051
+ var n = typeof Object.is == "function" ? Object.is : r, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
1052
+ function d(f, u, E, S, b) {
1053
+ var p = o(null), v;
1054
+ p.current === null ? (v = {
1055
+ hasValue: !1,
1056
+ value: null
1057
+ }, p.current = v) : v = p.current;
1058
+ var C = a(function() {
1059
+ var x = !1, m, I, N = function(B) {
1060
+ if (!x) {
1061
+ x = !0, m = B;
1062
+ var Z = S(B);
1063
+ if (b !== void 0 && v.hasValue) {
1064
+ var H = v.value;
1065
+ if (b(H, Z))
1066
+ return I = H, H;
1067
+ }
1068
+ return I = Z, Z;
1069
+ }
1070
+ var O = m, P = I;
1071
+ if (n(O, B))
1072
+ return P;
1073
+ var j = S(B);
1074
+ return b !== void 0 && b(P, j) ? P : (m = B, I = j, j);
1075
+ }, A = E === void 0 ? null : E, M = function() {
1076
+ return N(u());
1077
+ }, L = A === null ? void 0 : function() {
1078
+ return N(A());
1079
+ };
1080
+ return [M, L];
1081
+ }, [u, E, S, b]), w = C[0], y = C[1], h = s(f, w, y);
1082
+ return i(function() {
1083
+ v.hasValue = !0, v.value = h;
1084
+ }, [h]), l(h), h;
1085
+ }
1086
+ _t.useSyncExternalStoreWithSelector = d, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
1087
+ }()), _t;
1088
+ }
1089
+ (function(e) {
1090
+ process.env.NODE_ENV === "production" ? e.exports = fs() : e.exports = ds();
1091
+ })(as);
1092
+ const ps = /* @__PURE__ */ Qn(At), { useSyncExternalStoreWithSelector: ms } = ps;
1093
+ function ft(e, t = e.getState, r) {
1094
+ const n = ms(
1095
+ e.subscribe,
1096
+ e.getState,
1097
+ e.getServerState || e.getState,
1098
+ t,
1099
+ r
1100
+ );
1101
+ return Kn(n), n;
1102
+ }
1103
+ const Sr = (e) => {
1104
+ ({ BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0 } && "production") !== "production" && typeof e != "function" && console.warn(
1105
+ '[DEPRECATED] Passing a vanilla store will be unsupported in the future version. Please use `import { useStore } from "zustand"` to use the vanilla store in React.'
1106
+ );
1107
+ const t = typeof e == "function" ? lt(e) : e, r = (n, s) => ft(t, n, s);
1108
+ return Object.assign(r, t), r;
1109
+ }, Jr = (e) => e ? Sr(e) : Sr, Oe = (e, t) => e.classList && e.classList.contains(t), We = (e, t) => Oe(e, t) ? e : e.parentNode ? We(e.parentNode, t) : !1, Qr = (e, t) => e.x > t.left && e.x < t.left + t.width && e.y > t.top && e.y < t.top + t.height, gs = (e, t) => {
1110
+ const r = t.getBoundingClientRect();
1111
+ return Array.from(e.querySelectorAll(".corner")).every((s) => {
1112
+ const { top: o, left: i } = s.getBoundingClientRect();
1113
+ return Qr({ x: i, y: o }, r);
1114
+ });
1115
+ }, Mt = (e, t) => {
1116
+ const n = e.getElementsByClassName(`item ${t}`)[0];
1117
+ return n || console.error(`Missing item ${t}`), n;
1118
+ }, $e = (e) => {
1119
+ var r, n;
1120
+ const t = (r = e == null ? void 0 : e.dataset) == null ? void 0 : r.id;
1121
+ return t || console.error(
1122
+ "getIdFromElem call fails",
1123
+ e,
1124
+ JSON.stringify(e == null ? void 0 : e.dataset),
1125
+ (n = e == null ? void 0 : e.dataset) == null ? void 0 : n.id
1126
+ ), t;
1127
+ }, en = (e, t = document) => {
1128
+ const r = e.reduce((n, s) => {
1129
+ const o = Mt(t, s);
1130
+ if (!o)
1131
+ return null;
1132
+ const { left: i, right: a, top: l, bottom: d } = o.getBoundingClientRect();
1133
+ let f;
1134
+ return n ? f = n : f = {
1135
+ left: i,
1136
+ top: l,
1137
+ right: a,
1138
+ bottom: d
1139
+ }, f.left = Math.min(i, f.left), f.top = Math.min(l, f.top), f.right = Math.max(a, f.right), f.bottom = Math.max(d, f.bottom), f;
1140
+ }, null);
1141
+ return r && (r.width = r.right - r.left, r.height = r.bottom - r.top, r);
1142
+ }, hs = ({ x: e, y: t, width: r, height: n }, { type: s = "grid", size: o = 1, offset: i = { x: 0, y: 0 } }) => {
1143
+ const [a, l] = [
1144
+ e + r / 2 - i.x,
1145
+ t + n / 2 - i.y
1146
+ ];
1147
+ let d, f, u, E, S, b, p, v, C, w;
1148
+ const y = o / 1.1547;
1149
+ switch (s) {
1150
+ case "grid":
1151
+ d = Math.round(a / o) * o, f = Math.round(l / o) * o;
1152
+ break;
1153
+ case "hexH":
1154
+ u = 2 * y, E = 3 * o, S = Math.round(a / u) * u, p = Math.round(l / E) * E, b = S > a ? S - y : S + y, v = p > l ? p - 1.5 * o : p + 1.5 * o, C = Math.hypot(S - a, p - l), w = Math.hypot(b - a, v - l), C < w ? (d = S, f = p) : (d = b, f = v);
1155
+ break;
1156
+ case "hexV":
1157
+ u = 3 * o, E = 2 * y, S = Math.round(a / u) * u, p = Math.round(l / E) * E, b = S > a ? S - 1.5 * o : S + 1.5 * o, v = p > l ? p - y : p + y, C = Math.hypot(S - a, p - l), w = Math.hypot(b - a, v - l), C < w ? (d = S, f = p) : (d = b, f = v);
1158
+ break;
1159
+ default:
1160
+ d = e + r / 2, f = t + n / 2;
1161
+ }
1162
+ return {
1163
+ x: d + i.x - r / 2,
1164
+ y: f + i.y - n / 2
1165
+ };
1166
+ }, Cr = [
1167
+ "#037758",
1168
+ "#99092a",
1169
+ "#067070",
1170
+ "#c6650f",
1171
+ "#008726",
1172
+ "#3d7004",
1173
+ "#348402",
1174
+ "#057f58",
1175
+ "#b58612",
1176
+ "#c44c01",
1177
+ "#0a7704",
1178
+ "#0e910e",
1179
+ "#027377",
1180
+ "#c99e02",
1181
+ "#054160",
1182
+ "#157a01",
1183
+ "#b10de2",
1184
+ "#0d6289",
1185
+ "#bc5d03",
1186
+ "#ba0cd1",
1187
+ "#d39f10",
1188
+ "#0c4c7a",
1189
+ "#460782",
1190
+ "#a51f10",
1191
+ "#cecb10",
1192
+ "#9b0943",
1193
+ "#607f0c",
1194
+ "#007a4b",
1195
+ "#bf0daa",
1196
+ "#af0ad8"
1197
+ ], Er = () => Cr[Math.floor(Math.random() * Cr.length)], vs = !1, zt = ({ wire: e, storeName: t, noSync: r = [], defaultValue: n }, s) => (o, i, a) => {
1198
+ o({ ready: !1 });
1199
+ const l = [];
1200
+ (async () => {
1201
+ try {
1202
+ const S = await e.call(`${t}_getValue`);
1203
+ vs && console.log("init from peer with value", S), o((b) => ({ ...b, ...S }));
1204
+ } catch {
1205
+ n !== void 0 && o(n);
1206
+ }
1207
+ l.push(
1208
+ await e.register(
1209
+ `${t}_getValue`,
1210
+ () => Object.fromEntries(
1211
+ Object.entries(i()).filter(
1212
+ ([S, b]) => typeof b != "function" && !r.includes(S)
1213
+ )
1214
+ ),
1215
+ { invoke: "first" }
1216
+ )
1217
+ ), l.push(
1218
+ e.subscribe(`${t}_call`, ([S, b]) => {
1219
+ u[S](...b);
1220
+ })
1221
+ ), o({ ready: !0 });
1222
+ })();
1223
+ const f = s(o, i, a), u = { ...f }, E = Object.fromEntries(
1224
+ // Send the update message on all method calls
1225
+ Object.entries(f).map(([S, b]) => typeof b == "function" && !S.startsWith("get") && !r.includes(S) ? [S, (...v) => {
1226
+ const C = b(...v);
1227
+ return e.publish(`${t}_call`, [S, v]), C;
1228
+ }] : [S, b])
1229
+ );
1230
+ return E.unsub = () => {
1231
+ l.forEach((S) => S());
1232
+ }, E;
1233
+ };
1234
+ function Fe(e, t) {
1235
+ if (Object.is(e, t))
1236
+ return !0;
1237
+ if (typeof e != "object" || e === null || typeof t != "object" || t === null)
1238
+ return !1;
1239
+ if (e instanceof Map && t instanceof Map) {
1240
+ if (e.size !== t.size)
1241
+ return !1;
1242
+ for (const [n, s] of e)
1243
+ if (!Object.is(s, t.get(n)))
1244
+ return !1;
1245
+ return !0;
1246
+ }
1247
+ if (e instanceof Set && t instanceof Set) {
1248
+ if (e.size !== t.size)
1249
+ return !1;
1250
+ for (const n of e)
1251
+ if (!t.has(n))
1252
+ return !1;
1253
+ return !0;
1254
+ }
1255
+ const r = Object.keys(e);
1256
+ if (r.length !== Object.keys(t).length)
1257
+ return !1;
1258
+ for (let n = 0; n < r.length; n++)
1259
+ if (!Object.prototype.hasOwnProperty.call(t, r[n]) || !Object.is(e[r[n]], t[r[n]]))
1260
+ return !1;
1261
+ return !0;
1262
+ }
1263
+ const tn = g.createContext(), ys = (e, t) => ({
1264
+ items: {},
1265
+ getItems: () => t().items,
1266
+ setItems: (r) => e({ items: r }),
1267
+ updateItems: (r) => e((n) => ({ items: { ...n.items, ...r } })),
1268
+ moveItems: (r, n) => e(({ items: s }) => {
1269
+ const o = { ...s };
1270
+ return r.forEach((i) => {
1271
+ const a = s[i];
1272
+ a && (o[i] = {
1273
+ ...a,
1274
+ x: (a.x || 0) + n.x,
1275
+ y: (a.y || 0) + n.y,
1276
+ moving: !0
1277
+ });
1278
+ }), { items: o };
1279
+ })
1280
+ }), bs = (e, t) => ({
1281
+ itemIds: [],
1282
+ setItemIds: (r) => e({ itemIds: r }),
1283
+ getItemIds: () => t().itemIds,
1284
+ insert: (r, n) => e((s) => {
1285
+ const o = [...s.itemIds];
1286
+ return o.splice(r, 0, n), { itemIds: o };
1287
+ }),
1288
+ remove: (r) => e((n) => {
1289
+ const s = [...n.itemIds];
1290
+ return s.splice(r, 1), { itemIds: s };
1291
+ }),
1292
+ updateItemIds: (r, n) => e((s) => {
1293
+ const o = [...s.itemIds];
1294
+ return o[r] = n, { items: o };
1295
+ }),
1296
+ updateManyItemIds: (r) => e((n) => ({
1297
+ items: n.itemIds.map((s, o) => r[o] !== void 0 ? r[o] : s)
1298
+ }))
1299
+ }), Ss = (e, t) => ({
1300
+ removeItemsById: (r) => e((n) => ({
1301
+ itemIds: n.itemIds.filter((s) => !r.includes(s)),
1302
+ items: Object.fromEntries(
1303
+ Object.entries(n.items).filter(
1304
+ ([s]) => !r.includes(s)
1305
+ )
1306
+ )
1307
+ })),
1308
+ getItemList: () => {
1309
+ const r = t().items;
1310
+ return t().itemIds.map((n) => r[n]);
1311
+ },
1312
+ setItemList: (r) => e({
1313
+ items: Object.fromEntries(r.map((n) => [n.id, n])),
1314
+ itemIds: r.map(({ id: n }) => n)
1315
+ }),
1316
+ insertItems: (r, n) => e((s) => {
1317
+ let o;
1318
+ const i = r.map(({ id: a }) => a);
1319
+ if (n) {
1320
+ const a = s.itemIds.findIndex((l) => l === n);
1321
+ o = [...s.itemIds], o.splice(a, 0, ...i);
1322
+ } else
1323
+ o = [...s.itemIds, ...i];
1324
+ return {
1325
+ items: {
1326
+ ...s.items,
1327
+ ...Object.fromEntries(r.map((a) => [a.id, a]))
1328
+ },
1329
+ itemIds: o
1330
+ };
1331
+ })
1332
+ }), Cs = (e, t) => ({
1333
+ boardConfig: {},
1334
+ getBoardConfig: () => t().boardConfig,
1335
+ setBoardConfig: (r) => e({ boardConfig: r }),
1336
+ updateBoardConfig: (r) => e((n) => ({ boardConfig: { ...n.boardConfig, ...r } }))
1337
+ }), Es = (e, t) => ({
1338
+ session: {},
1339
+ getSessionInfo: () => t().session,
1340
+ setSessionInfo: (r) => e({ session: r }),
1341
+ updateSessionInfo: (r) => e((n) => ({ session: { ...n.session, ...r } }))
1342
+ }), wr = ({ storeName: e, children: t, defaultValue: r }) => {
1343
+ const { wire: n } = ut("room"), [s] = g.useState(
1344
+ () => lt(
1345
+ zt({ wire: n, storeName: e, defaultValue: r }, (...o) => ({
1346
+ ...ys(...o),
1347
+ ...bs(...o),
1348
+ ...Ss(...o),
1349
+ ...Cs(...o),
1350
+ ...Es(...o)
1351
+ }))
1352
+ )
1353
+ );
1354
+ return /* @__PURE__ */ k(tn.Provider, { value: s, children: t });
1355
+ }, de = (e, t) => {
1356
+ const r = Se(tn);
1357
+ return ft(r, e, t || Fe);
1358
+ }, Gi = () => {
1359
+ const [e, t] = de((n) => [
1360
+ n.itemIds,
1361
+ n.items
1362
+ ]);
1363
+ return g.useMemo(
1364
+ () => e.map((n) => t[n]),
1365
+ [e, t]
1366
+ );
1367
+ };
1368
+ function rn(e) {
1369
+ const t = ke(e);
1370
+ return t.current = e, Dt(() => Object.freeze({
1371
+ get current() {
1372
+ return t.current;
1373
+ }
1374
+ }), []);
1375
+ }
1376
+ function nn(e) {
1377
+ const t = rn(e);
1378
+ ct(
1379
+ () => () => {
1380
+ t.current();
1381
+ },
1382
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1383
+ []
1384
+ );
1385
+ }
1386
+ function Yt(e, t, r, n = 0) {
1387
+ const s = ke(), o = ke(), i = ke(), a = () => {
1388
+ s.current && (clearTimeout(s.current), s.current = void 0), o.current && (clearTimeout(o.current), o.current = void 0);
1389
+ };
1390
+ return nn(a), Dt(
1391
+ () => {
1392
+ const l = () => {
1393
+ if (!i.current)
1394
+ return;
1395
+ const f = i.current;
1396
+ i.current = void 0, e.apply(f.this, f.args), a();
1397
+ }, d = function(...f) {
1398
+ s.current && clearTimeout(s.current), i.current = { args: f, this: this }, s.current = setTimeout(l, r), n > 0 && !o.current && (o.current = setTimeout(l, n));
1399
+ };
1400
+ return Object.defineProperties(d, {
1401
+ length: { value: e.length },
1402
+ name: { value: `${e.name || "anonymous"}__debounced__${r}` }
1403
+ }), d;
1404
+ },
1405
+ // eslint-disable-next-line react-hooks/exhaustive-deps,@typescript-eslint/no-unsafe-assignment
1406
+ [r, n, ...t]
1407
+ );
1408
+ }
1409
+ const ws = typeof window < "u" && typeof navigator < "u" && typeof document < "u";
1410
+ function sn(e, t, r, n = !1) {
1411
+ const s = ke(), o = ke();
1412
+ return nn(() => {
1413
+ s.current && clearTimeout(s.current);
1414
+ }), Dt(() => {
1415
+ const i = (l, d) => {
1416
+ o.current = void 0, e.apply(l, d), s.current = setTimeout(() => {
1417
+ s.current = void 0, !n && o.current && (i(o.current.this, o.current.args), o.current = void 0);
1418
+ }, r);
1419
+ }, a = function(...l) {
1420
+ if (s.current) {
1421
+ o.current = { args: l, this: this };
1422
+ return;
1423
+ }
1424
+ i(this, l);
1425
+ };
1426
+ return Object.defineProperties(a, {
1427
+ length: { value: e.length },
1428
+ name: { value: `${e.name || "anonymous"}__throttled__${r}` }
1429
+ }), a;
1430
+ }, [r, n, ...t]);
1431
+ }
1432
+ function Is(e, t, r, n = 0) {
1433
+ ct(Yt(e, t, r, n), t);
1434
+ }
1435
+ function _s(e, t, r, n = !1) {
1436
+ ct(sn(e, t, r, n), t);
1437
+ }
1438
+ let Qe;
1439
+ function xs() {
1440
+ if (!ws)
1441
+ return;
1442
+ if (Qe)
1443
+ return Qe;
1444
+ const e = /* @__PURE__ */ new Map(), t = new ResizeObserver((r) => {
1445
+ r.forEach((n) => {
1446
+ var s;
1447
+ return (s = e.get(n.target)) == null ? void 0 : s.forEach((o) => setTimeout(() => o(n), 0));
1448
+ });
1449
+ });
1450
+ return Qe = {
1451
+ observer: t,
1452
+ subscribe: (r, n) => {
1453
+ let s = e.get(r);
1454
+ s || (s = /* @__PURE__ */ new Set(), e.set(r, s), t.observe(r)), s.add(n);
1455
+ },
1456
+ unsubscribe: (r, n) => {
1457
+ const s = e.get(r);
1458
+ s && (s.delete(n), s.size || (e.delete(r), t.unobserve(r)));
1459
+ }
1460
+ }, Qe;
1461
+ }
1462
+ function Rs(e, t, r = !0) {
1463
+ const n = r && xs(), s = rn(t), o = e && "current" in e ? e.current : e;
1464
+ ct(() => {
1465
+ const i = e && "current" in e ? e.current : e;
1466
+ if (!n || !i)
1467
+ return;
1468
+ let a = !0;
1469
+ const l = (...d) => {
1470
+ a && s.current(...d);
1471
+ };
1472
+ return n.subscribe(i, l), () => {
1473
+ a = !1, n.unsubscribe(i, l);
1474
+ };
1475
+ }, [o, n]);
1476
+ }
1477
+ const Fi = () => {
1478
+ const [e, t, r] = de((o) => [
1479
+ o.items,
1480
+ o.itemIds,
1481
+ o.getItemList
1482
+ ]), [n, s] = g.useState(r());
1483
+ return _s(
1484
+ () => {
1485
+ const o = r();
1486
+ s(o);
1487
+ },
1488
+ [e, t, r],
1489
+ 300
1490
+ ), n;
1491
+ }, Os = Jr((e, t) => ({
1492
+ selection: [],
1493
+ setSelection: (r) => e((n) => JSON.stringify(n.selection) !== JSON.stringify(r) ? { selection: r } : {}),
1494
+ getSelection: () => t().selection,
1495
+ select: (r) => e((n) => ({
1496
+ selection: [...n.selection, ...r]
1497
+ })),
1498
+ unselect: (r) => e((n) => ({
1499
+ selection: n.selection.filter((s) => !r.includes(s))
1500
+ })),
1501
+ clear: () => e((r) => r.selection.length > 0 ? { selection: [] } : {}),
1502
+ reverse: () => e((r) => {
1503
+ const n = [...r.selection];
1504
+ return n.reverse(), { selection: n };
1505
+ }),
1506
+ selectionBox: null,
1507
+ setSelectionBox: (r) => e((n) => {
1508
+ const s = n.selectionBox;
1509
+ return !s || !r || s.top !== r.top || s.left !== r.left || s.width !== r.width || s.height !== r.height ? { selectionBox: r } : {};
1510
+ })
1511
+ })), ye = (e, t) => Os(e, t || Fe), Zi = () => ye((e) => e.selection), on = 5e4, ks = (e, t) => ({
1512
+ config: {
1513
+ itemTemplates: {},
1514
+ actions: {},
1515
+ uid: null,
1516
+ itemExtent: {},
1517
+ boardWrapperRect: {},
1518
+ boardSize: on
1519
+ },
1520
+ // TODO optimize when same value as before
1521
+ updateConfiguration: (r) => e((n) => ({ config: { ...n.config, ...r } })),
1522
+ getConfiguration: () => t().config
1523
+ }), As = (e, t) => ({
1524
+ boardState: {
1525
+ movingItems: !1,
1526
+ selecting: !1,
1527
+ zooming: !1,
1528
+ panning: !1,
1529
+ translateX: 0,
1530
+ translateY: 0,
1531
+ scale: 1
1532
+ },
1533
+ updateBoardState: (r) => e((n) => ({ boardState: { ...n.boardState, ...r } })),
1534
+ getBoardState: () => t().boardState
1535
+ }), Ms = (e, t) => ({
1536
+ interactions: {},
1537
+ getInteractions: () => t().interactions,
1538
+ register: (r, n) => e((s) => {
1539
+ const o = [...s.interactions[r] || []];
1540
+ return o.push(n), {
1541
+ interactions: { ...s.interaction, [r]: o }
1542
+ };
1543
+ }),
1544
+ unregister: (r, n) => e((s) => {
1545
+ const o = (s.interactions[r] || []).filter(
1546
+ (i) => i !== n
1547
+ );
1548
+ return {
1549
+ interactions: { ...s.interaction, [r]: o }
1550
+ };
1551
+ }),
1552
+ callInteractions: (r, n) => {
1553
+ t().interactions[r] && t().interactions[r].forEach((s) => {
1554
+ s(n);
1555
+ });
1556
+ }
1557
+ }), Ns = Jr((...e) => ({
1558
+ ...ks(...e),
1559
+ ...As(...e),
1560
+ ...Ms(...e)
1561
+ })), Q = (e, t) => Ns(e, t || Fe), et = 100, Re = 1e3, Ts = 0.8, Ir = ({
1562
+ x: e,
1563
+ y: t,
1564
+ scale: r,
1565
+ itemExtent: { right: n, left: s, top: o, bottom: i },
1566
+ boardWrapperRect: a,
1567
+ boardSize: l
1568
+ }) => {
1569
+ const d = {
1570
+ left: -n * r + et * r,
1571
+ right: a.width - s * r - et * r,
1572
+ top: -i * r + et * r,
1573
+ bottom: a.height - o * r - et * r,
1574
+ maxRight: a.width - l * r,
1575
+ maxLeft: a.height - l * r
1576
+ }, f = Math.min(
1577
+ Math.max(e, d.left, d.maxRight),
1578
+ d.right,
1579
+ 0
1580
+ ), u = Math.min(
1581
+ Math.max(t, d.top, d.maxLeft),
1582
+ d.bottom,
1583
+ 0
1584
+ );
1585
+ return [f, u];
1586
+ }, Bt = () => {
1587
+ const [e, t] = Q((p) => [
1588
+ p.getBoardState,
1589
+ p.updateBoardState
1590
+ ]), r = g.useRef([0.1, 8]), [n, s, o] = Q((p) => [
1591
+ p.config.itemExtent,
1592
+ p.getConfiguration,
1593
+ p.updateConfiguration
1594
+ ]), i = de((p) => p.getItemIds), a = g.useCallback(() => {
1595
+ const { translateX: p, translateY: v, scale: C } = e();
1596
+ return { translateX: p, translateY: v, scale: C };
1597
+ }, [e]), l = g.useCallback(
1598
+ (p) => {
1599
+ const { itemExtent: v, boardWrapperRect: C, boardSize: w } = s(), y = e(), { translateX: h, translateY: x, scale: m } = {
1600
+ ...y,
1601
+ ...p(y)
1602
+ };
1603
+ let I = m;
1604
+ m !== y.scale && (I > r.current[1] && ([, I] = r.current), I < r.current[0] && ([I] = r.current));
1605
+ let [N, A] = [h, x];
1606
+ (h !== y.translateX || x !== y.translateY) && ([N, A] = Ir({
1607
+ x: h,
1608
+ y: x,
1609
+ scale: I,
1610
+ itemExtent: v,
1611
+ boardWrapperRect: C,
1612
+ boardSize: w
1613
+ })), t({
1614
+ translateX: N,
1615
+ translateY: A,
1616
+ scale: I
1617
+ });
1618
+ },
1619
+ [e, s, t]
1620
+ ), d = g.useCallback(
1621
+ (p, v) => {
1622
+ const { itemExtent: C, boardWrapperRect: w, boardSize: y } = s();
1623
+ let h = v;
1624
+ h || (h = {
1625
+ x: w.width / 2,
1626
+ y: w.height / 2
1627
+ });
1628
+ const x = e();
1629
+ let m = x.scale * p;
1630
+ m > r.current[1] && ([, m] = r.current), m < r.current[0] && ([m] = r.current);
1631
+ const I = h.x - w.left, N = h.y - w.top, A = I - (I - x.translateX) * m / x.scale, M = N - (N - x.translateY) * m / x.scale, [L, B] = Ir({
1632
+ x: A,
1633
+ y: M,
1634
+ scale: m,
1635
+ itemExtent: C,
1636
+ boardWrapperRect: w,
1637
+ boardSize: y
1638
+ });
1639
+ t({
1640
+ scale: m,
1641
+ translateX: L,
1642
+ translateY: B
1643
+ });
1644
+ },
1645
+ [e, s, t]
1646
+ ), f = g.useCallback(
1647
+ ({ left: p, top: v, width: C, height: w }) => {
1648
+ const { boardWrapperRect: y } = s(), h = y.width / C, x = y.height / w, I = Math.min(h, x) * Ts, N = y.width / 2 - (p + C / 2) * I, A = y.height / 2 - (v + w / 2) * I;
1649
+ t({
1650
+ translateX: N,
1651
+ translateY: A,
1652
+ scale: I
1653
+ });
1654
+ },
1655
+ [s, t]
1656
+ ), u = g.useCallback(async () => {
1657
+ const {
1658
+ itemExtent: { width: p, height: v },
1659
+ boardWrapperRect: C
1660
+ } = s(), w = C.width / p, y = C.height / v, h = Math.min(w, y);
1661
+ r.current = [
1662
+ Math.max(h * 0.5, 0.05),
1663
+ Math.max(h * 10, 10)
1664
+ ];
1665
+ }, [s]), E = g.useCallback(() => {
1666
+ const { boardWrapperRect: p, boardSize: v } = s(), { translateX: C, translateY: w, scale: y } = e();
1667
+ return {
1668
+ x: (p.width / 2 - C) / y - v / 2,
1669
+ y: (p.height / 2 - w) / y - v / 2
1670
+ };
1671
+ }, [e, s]), S = g.useCallback(() => {
1672
+ const p = i(), { boardWrapperRect: v, boardWrapper: C, boardSize: w } = s(), { scale: y, translateX: h, translateY: x } = e(), { left: m, top: I, width: N, height: A } = en(
1673
+ p,
1674
+ C
1675
+ ) || {
1676
+ left: w / 2 * y + v.left + h,
1677
+ top: w / 2 * y + v.top + x,
1678
+ width: 0,
1679
+ height: 0
1680
+ }, M = {
1681
+ left: (m - v.left - h) / y,
1682
+ top: (I - v.top - x) / y,
1683
+ width: N / y,
1684
+ height: A / y
1685
+ };
1686
+ if (M.right = M.left + M.width, M.bottom = M.top + M.height, M.width < Re) {
1687
+ const L = (Re - M.width) / 2;
1688
+ M.left -= L, M.right += L, M.width = Re;
1689
+ }
1690
+ if (M.height < Re) {
1691
+ const L = (Re - M.height) / 2;
1692
+ M.top -= L, M.bottom += L, M.height = Re;
1693
+ }
1694
+ o({ itemExtent: M });
1695
+ }, [e, s, i, o]), b = Yt(
1696
+ S,
1697
+ [],
1698
+ 300
1699
+ );
1700
+ return g.useEffect(() => {
1701
+ n.left && u();
1702
+ }, [u, n]), {
1703
+ setDim: l,
1704
+ getDim: a,
1705
+ zoomTo: d,
1706
+ zoomToCenter: d,
1707
+ zoomToExtent: f,
1708
+ getCenter: E,
1709
+ updateItemExtent: b
1710
+ };
1711
+ }, Ls = (e) => {
1712
+ const [t, r, n] = Q(
1713
+ ({ register: i, unregister: a, callInteractions: l }) => [
1714
+ i,
1715
+ a,
1716
+ l
1717
+ ]
1718
+ ), s = g.useCallback(
1719
+ (i) => (t(e, i), () => {
1720
+ r(e, i);
1721
+ }),
1722
+ [e, t, r]
1723
+ ), o = g.useCallback(
1724
+ (i) => {
1725
+ n(e, i);
1726
+ },
1727
+ [n, e]
1728
+ );
1729
+ return { register: s, call: o };
1730
+ }, Wt = () => {
1731
+ const { call: e } = Ls("place"), { getCenter: t, updateItemExtent: r } = Bt(), n = Q((O) => O.getConfiguration), {
1732
+ getItems: s,
1733
+ getItemIds: o,
1734
+ setItemIds: i,
1735
+ updateItems: a,
1736
+ moveItems: l,
1737
+ removeItemsById: d,
1738
+ getItemList: f,
1739
+ insertItems: u,
1740
+ setItemList: E
1741
+ } = de(
1742
+ ({
1743
+ getItems: O,
1744
+ getItemIds: P,
1745
+ setItemIds: j,
1746
+ updateItems: X,
1747
+ moveItems: Y,
1748
+ removeItemsById: G,
1749
+ getItemList: ee,
1750
+ insertItems: ie,
1751
+ setItemList: ce
1752
+ }) => ({
1753
+ getItems: O,
1754
+ getItemIds: P,
1755
+ setItemIds: j,
1756
+ updateItems: X,
1757
+ moveItems: Y,
1758
+ removeItemsById: G,
1759
+ getItemList: ee,
1760
+ insertItems: ie,
1761
+ setItemList: ce
1762
+ })
1763
+ ), [S, b, p] = ye((O) => [
1764
+ O.clear,
1765
+ O.reverse,
1766
+ O.unselect
1767
+ ]), v = g.useCallback(
1768
+ (O, P) => {
1769
+ let j = P;
1770
+ typeof P == "object" && (j = () => P);
1771
+ const X = o().filter((ee) => O.includes(ee)), Y = s(), G = Object.fromEntries(
1772
+ X.map((ee) => [ee, j({ ...Y[ee] })])
1773
+ );
1774
+ a(G), r();
1775
+ },
1776
+ [o, s, r, a]
1777
+ ), C = g.useCallback(
1778
+ (O) => {
1779
+ E(O), S(), r();
1780
+ },
1781
+ [S, E, r]
1782
+ ), w = g.useCallback(
1783
+ (O, P) => {
1784
+ v([O], P);
1785
+ },
1786
+ [v]
1787
+ ), y = g.useCallback(
1788
+ (O, P) => {
1789
+ l(O, P), r();
1790
+ },
1791
+ [l, r]
1792
+ ), h = g.useCallback(
1793
+ (O) => {
1794
+ const P = o(), j = P.filter((Y) => !O.includes(Y)), X = P.filter(
1795
+ (Y) => O.includes(Y)
1796
+ );
1797
+ i([...j, ...X]);
1798
+ },
1799
+ [o, i]
1800
+ ), x = g.useCallback(
1801
+ (O, { type: P, size: j } = {}) => {
1802
+ const { boardWrapper: X } = n(), Y = {}, G = s();
1803
+ O.forEach((ee) => {
1804
+ const ie = G[ee], ce = Mt(X, ee);
1805
+ if (!ce)
1806
+ return;
1807
+ const ue = {
1808
+ type: P || "grid",
1809
+ size: j || 1,
1810
+ offset: { x: 0, y: 0 },
1811
+ ...ie.grid
1812
+ }, F = hs(
1813
+ {
1814
+ x: ie.x,
1815
+ y: ie.y,
1816
+ width: ce.clientWidth,
1817
+ height: ce.clientHeight
1818
+ },
1819
+ ue
1820
+ );
1821
+ Y[ee] = { ...ie, ...F };
1822
+ }), a(Y);
1823
+ },
1824
+ [n, s, a]
1825
+ ), m = g.useCallback(
1826
+ (O, P) => {
1827
+ h(O), v(O, (j) => {
1828
+ const X = { ...j };
1829
+ return delete X.moving, X;
1830
+ }), x(O, P), e(O), r();
1831
+ },
1832
+ [
1833
+ v,
1834
+ e,
1835
+ h,
1836
+ x,
1837
+ r
1838
+ ]
1839
+ ), I = g.useCallback(
1840
+ (O) => {
1841
+ i(O);
1842
+ },
1843
+ [i]
1844
+ ), N = g.useCallback(
1845
+ (O) => {
1846
+ const P = o(), j = P.filter(
1847
+ (Y) => O.includes(Y)
1848
+ ), X = P.map((Y) => O.includes(Y) ? j.pop() : Y);
1849
+ i(X), b();
1850
+ },
1851
+ [o, b, i]
1852
+ ), A = g.useCallback(
1853
+ (O, P) => {
1854
+ const j = s(), X = O.map((F) => j[F]), Y = P.map((F) => j[F]), G = P.reduce((F, se) => (F[se] = X.shift(), F), {}), ee = Y.reduce((F, se) => {
1855
+ const be = G[se.id], Ie = {
1856
+ ...se,
1857
+ x: be.x,
1858
+ y: be.y
1859
+ };
1860
+ return F[se.id] = Ie, F;
1861
+ }, {});
1862
+ a(ee);
1863
+ const ie = O.reduce((F, se) => (F[se] = P.shift(), F), {}), ue = o().map((F) => O.includes(F) ? ie[F] : F);
1864
+ i(ue);
1865
+ },
1866
+ [s, a, o, i]
1867
+ ), M = g.useCallback(
1868
+ (O, P) => {
1869
+ const j = t(), X = O.map((Y, G) => !Y.x || !Y.y ? { ...Y, x: j.x + 2 * G, y: j.y + 2 * G } : Y);
1870
+ u(X, P), r();
1871
+ },
1872
+ [t, u, r]
1873
+ ), L = g.useCallback(
1874
+ (O, P) => {
1875
+ M([O], P);
1876
+ },
1877
+ [M]
1878
+ ), B = g.useCallback(
1879
+ (O) => {
1880
+ p(O), d(O);
1881
+ },
1882
+ [p, d]
1883
+ ), Z = g.useCallback(
1884
+ (O) => {
1885
+ const P = s();
1886
+ return O.map((j) => P[j]);
1887
+ },
1888
+ [s]
1889
+ ), H = g.useCallback(
1890
+ ({ target: O, clientX: P, clientY: j }, { returnLocked: X = !1, passLocked: Y = !1 } = {}) => {
1891
+ if (["INPUT", "TEXTAREA"].includes(O.tagName))
1892
+ return null;
1893
+ const G = We(O, "item");
1894
+ if (G) {
1895
+ if (Oe(G, "selected"))
1896
+ return G;
1897
+ if (!Y && Oe(G, "locked") && !Oe(O, "passthrough"))
1898
+ return X ? G : null;
1899
+ if (Oe(O, "passthrough")) {
1900
+ const ee = o(), { boardWrapper: ie } = n(), ce = ee.reduce((ue, F) => {
1901
+ const se = Mt(ie, F), be = se.getBoundingClientRect();
1902
+ return Qr({ x: P, y: j }, be) && ue.unshift(se), ue;
1903
+ }, []);
1904
+ for (let ue = 0; ue < ce.length; ue += 1) {
1905
+ const F = ce[ue];
1906
+ if (F !== G && (Y || !Oe(F, "locked")))
1907
+ return F;
1908
+ }
1909
+ return null;
1910
+ }
1911
+ }
1912
+ return G;
1913
+ },
1914
+ [n, o]
1915
+ );
1916
+ return {
1917
+ putItemsOnTop: h,
1918
+ batchUpdateItems: v,
1919
+ updateItemOrder: I,
1920
+ moveItems: y,
1921
+ placeItems: m,
1922
+ updateItem: w,
1923
+ swapItems: A,
1924
+ reverseItemsOrder: N,
1925
+ setItemList: C,
1926
+ pushItem: L,
1927
+ pushItems: M,
1928
+ removeItems: B,
1929
+ getItemList: f,
1930
+ findElementUnderPointer: H,
1931
+ getItems: Z
1932
+ };
1933
+ };
1934
+ var Ps = function e(t, r) {
1935
+ if (t === r)
1936
+ return !0;
1937
+ if (t && r && typeof t == "object" && typeof r == "object") {
1938
+ if (t.constructor !== r.constructor)
1939
+ return !1;
1940
+ var n, s, o;
1941
+ if (Array.isArray(t)) {
1942
+ if (n = t.length, n != r.length)
1943
+ return !1;
1944
+ for (s = n; s-- !== 0; )
1945
+ if (!e(t[s], r[s]))
1946
+ return !1;
1947
+ return !0;
1948
+ }
1949
+ if (t instanceof Map && r instanceof Map) {
1950
+ if (t.size !== r.size)
1951
+ return !1;
1952
+ for (s of t.entries())
1953
+ if (!r.has(s[0]))
1954
+ return !1;
1955
+ for (s of t.entries())
1956
+ if (!e(s[1], r.get(s[0])))
1957
+ return !1;
1958
+ return !0;
1959
+ }
1960
+ if (t instanceof Set && r instanceof Set) {
1961
+ if (t.size !== r.size)
1962
+ return !1;
1963
+ for (s of t.entries())
1964
+ if (!r.has(s[0]))
1965
+ return !1;
1966
+ return !0;
1967
+ }
1968
+ if (ArrayBuffer.isView(t) && ArrayBuffer.isView(r)) {
1969
+ if (n = t.length, n != r.length)
1970
+ return !1;
1971
+ for (s = n; s-- !== 0; )
1972
+ if (t[s] !== r[s])
1973
+ return !1;
1974
+ return !0;
1975
+ }
1976
+ if (t.constructor === RegExp)
1977
+ return t.source === r.source && t.flags === r.flags;
1978
+ if (t.valueOf !== Object.prototype.valueOf)
1979
+ return t.valueOf() === r.valueOf();
1980
+ if (t.toString !== Object.prototype.toString)
1981
+ return t.toString() === r.toString();
1982
+ if (o = Object.keys(t), n = o.length, n !== Object.keys(r).length)
1983
+ return !1;
1984
+ for (s = n; s-- !== 0; )
1985
+ if (!Object.prototype.hasOwnProperty.call(r, o[s]))
1986
+ return !1;
1987
+ for (s = n; s-- !== 0; ) {
1988
+ var i = o[s];
1989
+ if (!e(t[i], r[i]))
1990
+ return !1;
1991
+ }
1992
+ return !0;
1993
+ }
1994
+ return t !== t && r !== r;
1995
+ };
1996
+ const js = (e, t) => {
1997
+ if (e.type in t) {
1998
+ const r = t[e.type].defaultActions;
1999
+ return typeof r == "function" ? r(e) : r;
2000
+ }
2001
+ return [];
2002
+ }, _r = (e, t) => {
2003
+ const { actions: r = js(e, t) } = e;
2004
+ return r.map((n) => typeof n == "string" ? { name: n } : n);
2005
+ }, Hi = () => {
2006
+ const [e, t] = de((f) => [
2007
+ f.items,
2008
+ f.getItems
2009
+ ]), r = Q((f) => f.config.itemTemplates), [n, s] = ye((f) => [
2010
+ f.selection,
2011
+ f.getSelection
2012
+ ]), [o, i] = g.useState([]), a = g.useRef(!1);
2013
+ g.useEffect(() => (a.current = !0, () => {
2014
+ a.current = !1;
2015
+ }), []);
2016
+ const l = g.useCallback(
2017
+ (f) => {
2018
+ const u = t();
2019
+ if (f)
2020
+ return [f, f.map((S) => u[S])];
2021
+ const E = s();
2022
+ return [E, E.map((S) => u[S])];
2023
+ },
2024
+ [t, s]
2025
+ ), d = qn(() => {
2026
+ const [f, u] = l();
2027
+ if (f.length > 0) {
2028
+ if (!a.current)
2029
+ return;
2030
+ const E = u.reduce((S, b) => {
2031
+ const p = _r(b, r);
2032
+ return S.filter(
2033
+ (v) => p.some((C) => Ps(v, C))
2034
+ );
2035
+ }, _r(u[0], r));
2036
+ i(E);
2037
+ } else
2038
+ i([]);
2039
+ }, [l, r]);
2040
+ return g.useEffect(() => {
2041
+ d();
2042
+ }, [d, n]), Is(
2043
+ d,
2044
+ [e, d],
2045
+ 300
2046
+ ), {
2047
+ availableActions: o
2048
+ };
2049
+ }, Ki = () => ye((e) => e.selectionBox);
2050
+ let Ee = (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), "");
2051
+ const an = g.createContext(), Nt = (e) => {
2052
+ localStorage.setItem("user", JSON.stringify(e));
2053
+ }, Ds = () => {
2054
+ if (localStorage.user) {
2055
+ const t = {
2056
+ name: "Player",
2057
+ color: Er(),
2058
+ uid: Ee(),
2059
+ ...JSON.parse(localStorage.user)
2060
+ };
2061
+ return Nt(t), t;
2062
+ }
2063
+ const e = {
2064
+ name: "Player",
2065
+ color: Er(),
2066
+ uid: Ee()
2067
+ };
2068
+ return Nt(e), e;
2069
+ }, zs = (e) => (t, r) => ({
2070
+ isSpaceMaster: !1,
2071
+ users: {},
2072
+ getUser: () => r().users[e],
2073
+ getUsers: () => r().users,
2074
+ getUserList: () => Object.values(r().users),
2075
+ getLocalUsers: () => {
2076
+ if (!r().users[e])
2077
+ return [];
2078
+ const { space: n } = r().users[e];
2079
+ return r().getUserList().filter(({ space: s }) => s === n);
2080
+ },
2081
+ addUser: (n) => t((s) => ({ users: { ...s.users, [n.id]: n } })),
2082
+ updateUser: (n, s) => t((o) => {
2083
+ if (!o.users[n])
2084
+ return {};
2085
+ const i = {
2086
+ ...o.users[n],
2087
+ ...s,
2088
+ id: n,
2089
+ uid: o.users[n].uid
2090
+ };
2091
+ return i.id === e && Nt(i), setTimeout(() => r().electSpaceMaster(), 100), {
2092
+ users: {
2093
+ ...o.users,
2094
+ [n]: i
2095
+ }
2096
+ };
2097
+ }),
2098
+ removeUser: (n) => t((s) => {
2099
+ const o = { ...s.users };
2100
+ return delete o[n], setTimeout(() => r().electSpaceMaster(), 100), { users: o };
2101
+ }),
2102
+ // Not synchronized methods
2103
+ updateCurrentUser: (n) => r().updateUser(e, n),
2104
+ joinSpace: (n) => r().updateUser(e, { space: n, spaceJoinedTimestamp: Date.now() }),
2105
+ electSpaceMaster: () => {
2106
+ const n = r().getLocalUsers(), s = {
2107
+ uid: null,
2108
+ timestamp: Date.now()
2109
+ };
2110
+ Object.values(n).forEach(({ spaceJoinedTimestamp: o, id: i }) => {
2111
+ o < s.timestamp && (s.id = i, s.timestamp = o);
2112
+ }), t({ isSpaceMaster: s.id === e });
2113
+ }
2114
+ }), Ys = (e) => ({
2115
+ cursors: {},
2116
+ moveCursor: (t, r) => e((n) => ({ cursors: { ...n.cursors, [t]: r } })),
2117
+ removeCursor: (t) => e((r) => {
2118
+ const n = { ...r.cursors };
2119
+ return delete n[t], { cursors: n };
2120
+ })
2121
+ }), cn = ({ storeName: e, children: t }) => {
2122
+ const { wire: r, isMaster: n } = ut("room"), [s, o] = g.useState(null), [i, a] = g.useState(!1), l = g.useRef(!1);
2123
+ return g.useEffect(() => {
2124
+ let d = !0;
2125
+ const f = [];
2126
+ if (!s && !l.current)
2127
+ return l.current = !0, (() => {
2128
+ const E = lt(
2129
+ zt(
2130
+ {
2131
+ wire: r,
2132
+ storeName: e,
2133
+ noSync: [
2134
+ "updateCurrentUser",
2135
+ "joinSpace",
2136
+ "isSpaceMaster",
2137
+ "electSpaceMaster"
2138
+ ]
2139
+ },
2140
+ (...b) => ({
2141
+ ...zs(r.userId)(...b),
2142
+ ...Ys(...b)
2143
+ })
2144
+ )
2145
+ ), S = E.subscribe((b) => {
2146
+ b.ready && (S(), d && o(E));
2147
+ });
2148
+ })(), () => {
2149
+ d = !1, l.current = !1, f.forEach((E) => E());
2150
+ };
2151
+ }, [s, e, r, r.userId]), g.useEffect(() => {
2152
+ if (s)
2153
+ return s.getState().addUser({
2154
+ ...Ds(),
2155
+ id: r.userId
2156
+ }), a(!0), () => {
2157
+ s.getState().removeUser(r.userId);
2158
+ };
2159
+ }, [n, s, r]), g.useEffect(() => {
2160
+ if (s) {
2161
+ const d = r.subscribe("userLeave", (f) => {
2162
+ s.getState().removeUser(f);
2163
+ });
2164
+ return () => {
2165
+ d();
2166
+ };
2167
+ }
2168
+ }, [n, s, r]), g.useEffect(() => {
2169
+ n && s && s.getState().updateCurrentUser({ isMaster: n });
2170
+ }, [n, s, r]), i ? /* @__PURE__ */ k(an.Provider, { value: s, children: t }) : null;
2171
+ }, we = (e, t) => {
2172
+ const r = Se(an);
2173
+ return ft(r, e, t || Fe);
2174
+ }, qi = () => {
2175
+ const [e, t, r, n, s] = we((a) => [
2176
+ a.isSpaceMaster,
2177
+ a.getUser(),
2178
+ a.users,
2179
+ a.updateCurrentUser,
2180
+ a.joinSpace
2181
+ ]), o = g.useMemo(() => Object.values(r), [r]), i = g.useMemo(() => {
2182
+ const { space: a } = t;
2183
+ return o.filter(({ space: l }) => l === a);
2184
+ }, [t, o]);
2185
+ return {
2186
+ isSpaceMaster: e,
2187
+ currentUser: t,
2188
+ updateCurrentUser: n,
2189
+ users: o,
2190
+ localUsers: i,
2191
+ joinSpace: s
2192
+ };
2193
+ }, Ji = () => {
2194
+ const [e, t, r] = de(
2195
+ (s) => [s.boardConfig, s.getBoardConfig, s.setBoardConfig]
2196
+ ), n = g.useCallback(
2197
+ (s) => {
2198
+ let o = s;
2199
+ typeof s == "object" && (o = () => s);
2200
+ const i = t(), a = o(i);
2201
+ r(a);
2202
+ },
2203
+ [t, r]
2204
+ );
2205
+ return [e, n];
2206
+ }, Qi = () => Q((e) => e.boardState), ea = () => {
2207
+ const [e, t, r, n] = de((s) => [
2208
+ s.getSessionInfo,
2209
+ s.setSessionInfo,
2210
+ s.updateSessionInfo,
2211
+ s.session
2212
+ ]);
2213
+ return { getSessionInfo: e, setSessionInfo: t, sessionInfo: n, updateSessionInfo: r };
2214
+ }, un = g.createContext(), Bs = ({ user: { name: e, uid: t, color: r }, content: n }) => ({
2215
+ type: "message",
2216
+ user: { name: e, uid: t, color: r },
2217
+ content: n,
2218
+ uid: Ee(),
2219
+ timestamp: new Date().toISOString()
2220
+ }), Ws = (e, t) => ({
2221
+ messages: [],
2222
+ setMessages: (r) => e({
2223
+ messages: r.map((n) => ({
2224
+ ...n,
2225
+ timestamp: Date.parse(n.timestamp)
2226
+ }))
2227
+ }),
2228
+ addMessage: (r) => e((n) => ({
2229
+ messages: [
2230
+ ...n.messages,
2231
+ { ...r, timestamp: Date.parse(r.timestamp) }
2232
+ ]
2233
+ })),
2234
+ sendMessage: (r, n) => {
2235
+ const s = Bs({
2236
+ user: r,
2237
+ content: n
2238
+ });
2239
+ s && t().addMessage(s);
2240
+ }
2241
+ }), xr = ({
2242
+ storeName: e,
2243
+ children: t,
2244
+ defaultValue: r = []
2245
+ }) => {
2246
+ const { wire: n } = ut("room"), [s] = g.useState(
2247
+ () => lt(
2248
+ zt(
2249
+ { wire: n, storeName: e, defaultValue: r, noSync: ["sendMessage"] },
2250
+ (...o) => ({
2251
+ ...Ws(...o)
2252
+ })
2253
+ )
2254
+ )
2255
+ );
2256
+ return /* @__PURE__ */ k(un.Provider, { value: s, children: t });
2257
+ }, $s = (e, t) => {
2258
+ const r = Se(un);
2259
+ return ft(r, e, t || Fe);
2260
+ }, Us = () => {
2261
+ }, ta = (e = Us) => {
2262
+ const t = we((i) => i.getUser()), [r, n, s] = $s((i) => [
2263
+ i.messages,
2264
+ i.setMessages,
2265
+ i.sendMessage
2266
+ ]);
2267
+ g.useEffect(() => {
2268
+ e();
2269
+ }, [r, e]);
2270
+ const o = g.useCallback(
2271
+ (i) => {
2272
+ s(t, i);
2273
+ },
2274
+ [t, s]
2275
+ );
2276
+ return { messages: r, setMessages: n, sendMessage: o };
2277
+ };
2278
+ function Tt() {
2279
+ return Tt = Object.assign ? Object.assign.bind() : function(e) {
2280
+ for (var t = 1; t < arguments.length; t++) {
2281
+ var r = arguments[t];
2282
+ for (var n in r)
2283
+ Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
2284
+ }
2285
+ return e;
2286
+ }, Tt.apply(this, arguments);
2287
+ }
2288
+ function ln(e) {
2289
+ var t = /* @__PURE__ */ Object.create(null);
2290
+ return function(r) {
2291
+ return t[r] === void 0 && (t[r] = e(r)), t[r];
2292
+ };
2293
+ }
2294
+ var Xs = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, Vs = /* @__PURE__ */ ln(
2295
+ function(e) {
2296
+ return Xs.test(e) || e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) < 91;
2297
+ }
2298
+ /* Z+1 */
2299
+ );
2300
+ function Gs(e) {
2301
+ if (e.sheet)
2302
+ return e.sheet;
2303
+ for (var t = 0; t < document.styleSheets.length; t++)
2304
+ if (document.styleSheets[t].ownerNode === e)
2305
+ return document.styleSheets[t];
2306
+ }
2307
+ function Fs(e) {
2308
+ var t = document.createElement("style");
2309
+ return t.setAttribute("data-emotion", e.key), e.nonce !== void 0 && t.setAttribute("nonce", e.nonce), t.appendChild(document.createTextNode("")), t.setAttribute("data-s", ""), t;
2310
+ }
2311
+ var Zs = /* @__PURE__ */ function() {
2312
+ function e(r) {
2313
+ var n = this;
2314
+ this._insertTag = function(s) {
2315
+ var o;
2316
+ n.tags.length === 0 ? n.insertionPoint ? o = n.insertionPoint.nextSibling : n.prepend ? o = n.container.firstChild : o = n.before : o = n.tags[n.tags.length - 1].nextSibling, n.container.insertBefore(s, o), n.tags.push(s);
2317
+ }, this.isSpeedy = r.speedy === void 0 ? process.env.NODE_ENV === "production" : r.speedy, this.tags = [], this.ctr = 0, this.nonce = r.nonce, this.key = r.key, this.container = r.container, this.prepend = r.prepend, this.insertionPoint = r.insertionPoint, this.before = null;
2318
+ }
2319
+ var t = e.prototype;
2320
+ return t.hydrate = function(n) {
2321
+ n.forEach(this._insertTag);
2322
+ }, t.insert = function(n) {
2323
+ this.ctr % (this.isSpeedy ? 65e3 : 1) === 0 && this._insertTag(Fs(this));
2324
+ var s = this.tags[this.tags.length - 1];
2325
+ if (process.env.NODE_ENV !== "production") {
2326
+ var o = n.charCodeAt(0) === 64 && n.charCodeAt(1) === 105;
2327
+ o && this._alreadyInsertedOrderInsensitiveRule && console.error(`You're attempting to insert the following rule:
2328
+ ` + n + "\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules."), this._alreadyInsertedOrderInsensitiveRule = this._alreadyInsertedOrderInsensitiveRule || !o;
2329
+ }
2330
+ if (this.isSpeedy) {
2331
+ var i = Gs(s);
2332
+ try {
2333
+ i.insertRule(n, i.cssRules.length);
2334
+ } catch (a) {
2335
+ process.env.NODE_ENV !== "production" && !/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(n) && console.error('There was a problem inserting the following rule: "' + n + '"', a);
2336
+ }
2337
+ } else
2338
+ s.appendChild(document.createTextNode(n));
2339
+ this.ctr++;
2340
+ }, t.flush = function() {
2341
+ this.tags.forEach(function(n) {
2342
+ return n.parentNode && n.parentNode.removeChild(n);
2343
+ }), this.tags = [], this.ctr = 0, process.env.NODE_ENV !== "production" && (this._alreadyInsertedOrderInsensitiveRule = !1);
2344
+ }, e;
2345
+ }(), re = "-ms-", it = "-moz-", $ = "-webkit-", $t = "comm", Ut = "rule", Xt = "decl", Hs = "@import", fn = "@keyframes", Ks = Math.abs, dt = String.fromCharCode, qs = Object.assign;
2346
+ function Js(e, t) {
2347
+ return te(e, 0) ^ 45 ? (((t << 2 ^ te(e, 0)) << 2 ^ te(e, 1)) << 2 ^ te(e, 2)) << 2 ^ te(e, 3) : 0;
2348
+ }
2349
+ function dn(e) {
2350
+ return e.trim();
2351
+ }
2352
+ function Qs(e, t) {
2353
+ return (e = t.exec(e)) ? e[0] : e;
2354
+ }
2355
+ function U(e, t, r) {
2356
+ return e.replace(t, r);
2357
+ }
2358
+ function Lt(e, t) {
2359
+ return e.indexOf(t);
2360
+ }
2361
+ function te(e, t) {
2362
+ return e.charCodeAt(t) | 0;
2363
+ }
2364
+ function Ue(e, t, r) {
2365
+ return e.slice(t, r);
2366
+ }
2367
+ function me(e) {
2368
+ return e.length;
2369
+ }
2370
+ function Vt(e) {
2371
+ return e.length;
2372
+ }
2373
+ function tt(e, t) {
2374
+ return t.push(e), e;
2375
+ }
2376
+ function eo(e, t) {
2377
+ return e.map(t).join("");
2378
+ }
2379
+ var pt = 1, Ne = 1, pn = 0, oe = 0, J = 0, Le = "";
2380
+ function mt(e, t, r, n, s, o, i) {
2381
+ return { value: e, root: t, parent: r, type: n, props: s, children: o, line: pt, column: Ne, length: i, return: "" };
2382
+ }
2383
+ function ze(e, t) {
2384
+ return qs(mt("", null, null, "", null, null, 0), e, { length: -e.length }, t);
2385
+ }
2386
+ function to() {
2387
+ return J;
2388
+ }
2389
+ function ro() {
2390
+ return J = oe > 0 ? te(Le, --oe) : 0, Ne--, J === 10 && (Ne = 1, pt--), J;
2391
+ }
2392
+ function ae() {
2393
+ return J = oe < pn ? te(Le, oe++) : 0, Ne++, J === 10 && (Ne = 1, pt++), J;
2394
+ }
2395
+ function ge() {
2396
+ return te(Le, oe);
2397
+ }
2398
+ function rt() {
2399
+ return oe;
2400
+ }
2401
+ function Ze(e, t) {
2402
+ return Ue(Le, e, t);
2403
+ }
2404
+ function Xe(e) {
2405
+ switch (e) {
2406
+ case 0:
2407
+ case 9:
2408
+ case 10:
2409
+ case 13:
2410
+ case 32:
2411
+ return 5;
2412
+ case 33:
2413
+ case 43:
2414
+ case 44:
2415
+ case 47:
2416
+ case 62:
2417
+ case 64:
2418
+ case 126:
2419
+ case 59:
2420
+ case 123:
2421
+ case 125:
2422
+ return 4;
2423
+ case 58:
2424
+ return 3;
2425
+ case 34:
2426
+ case 39:
2427
+ case 40:
2428
+ case 91:
2429
+ return 2;
2430
+ case 41:
2431
+ case 93:
2432
+ return 1;
2433
+ }
2434
+ return 0;
2435
+ }
2436
+ function mn(e) {
2437
+ return pt = Ne = 1, pn = me(Le = e), oe = 0, [];
2438
+ }
2439
+ function gn(e) {
2440
+ return Le = "", e;
2441
+ }
2442
+ function nt(e) {
2443
+ return dn(Ze(oe - 1, Pt(e === 91 ? e + 2 : e === 40 ? e + 1 : e)));
2444
+ }
2445
+ function no(e) {
2446
+ for (; (J = ge()) && J < 33; )
2447
+ ae();
2448
+ return Xe(e) > 2 || Xe(J) > 3 ? "" : " ";
2449
+ }
2450
+ function so(e, t) {
2451
+ for (; --t && ae() && !(J < 48 || J > 102 || J > 57 && J < 65 || J > 70 && J < 97); )
2452
+ ;
2453
+ return Ze(e, rt() + (t < 6 && ge() == 32 && ae() == 32));
2454
+ }
2455
+ function Pt(e) {
2456
+ for (; ae(); )
2457
+ switch (J) {
2458
+ case e:
2459
+ return oe;
2460
+ case 34:
2461
+ case 39:
2462
+ e !== 34 && e !== 39 && Pt(J);
2463
+ break;
2464
+ case 40:
2465
+ e === 41 && Pt(e);
2466
+ break;
2467
+ case 92:
2468
+ ae();
2469
+ break;
2470
+ }
2471
+ return oe;
2472
+ }
2473
+ function oo(e, t) {
2474
+ for (; ae() && e + J !== 47 + 10; )
2475
+ if (e + J === 42 + 42 && ge() === 47)
2476
+ break;
2477
+ return "/*" + Ze(t, oe - 1) + "*" + dt(e === 47 ? e : ae());
2478
+ }
2479
+ function io(e) {
2480
+ for (; !Xe(ge()); )
2481
+ ae();
2482
+ return Ze(e, oe);
2483
+ }
2484
+ function ao(e) {
2485
+ return gn(st("", null, null, null, [""], e = mn(e), 0, [0], e));
2486
+ }
2487
+ function st(e, t, r, n, s, o, i, a, l) {
2488
+ for (var d = 0, f = 0, u = i, E = 0, S = 0, b = 0, p = 1, v = 1, C = 1, w = 0, y = "", h = s, x = o, m = n, I = y; v; )
2489
+ switch (b = w, w = ae()) {
2490
+ case 40:
2491
+ if (b != 108 && te(I, u - 1) == 58) {
2492
+ Lt(I += U(nt(w), "&", "&\f"), "&\f") != -1 && (C = -1);
2493
+ break;
2494
+ }
2495
+ case 34:
2496
+ case 39:
2497
+ case 91:
2498
+ I += nt(w);
2499
+ break;
2500
+ case 9:
2501
+ case 10:
2502
+ case 13:
2503
+ case 32:
2504
+ I += no(b);
2505
+ break;
2506
+ case 92:
2507
+ I += so(rt() - 1, 7);
2508
+ continue;
2509
+ case 47:
2510
+ switch (ge()) {
2511
+ case 42:
2512
+ case 47:
2513
+ tt(co(oo(ae(), rt()), t, r), l);
2514
+ break;
2515
+ default:
2516
+ I += "/";
2517
+ }
2518
+ break;
2519
+ case 123 * p:
2520
+ a[d++] = me(I) * C;
2521
+ case 125 * p:
2522
+ case 59:
2523
+ case 0:
2524
+ switch (w) {
2525
+ case 0:
2526
+ case 125:
2527
+ v = 0;
2528
+ case 59 + f:
2529
+ S > 0 && me(I) - u && tt(S > 32 ? Or(I + ";", n, r, u - 1) : Or(U(I, " ", "") + ";", n, r, u - 2), l);
2530
+ break;
2531
+ case 59:
2532
+ I += ";";
2533
+ default:
2534
+ if (tt(m = Rr(I, t, r, d, f, s, a, y, h = [], x = [], u), o), w === 123)
2535
+ if (f === 0)
2536
+ st(I, t, m, m, h, o, u, a, x);
2537
+ else
2538
+ switch (E === 99 && te(I, 3) === 110 ? 100 : E) {
2539
+ case 100:
2540
+ case 109:
2541
+ case 115:
2542
+ st(e, m, m, n && tt(Rr(e, m, m, 0, 0, s, a, y, s, h = [], u), x), s, x, u, a, n ? h : x);
2543
+ break;
2544
+ default:
2545
+ st(I, m, m, m, [""], x, 0, a, x);
2546
+ }
2547
+ }
2548
+ d = f = S = 0, p = C = 1, y = I = "", u = i;
2549
+ break;
2550
+ case 58:
2551
+ u = 1 + me(I), S = b;
2552
+ default:
2553
+ if (p < 1) {
2554
+ if (w == 123)
2555
+ --p;
2556
+ else if (w == 125 && p++ == 0 && ro() == 125)
2557
+ continue;
2558
+ }
2559
+ switch (I += dt(w), w * p) {
2560
+ case 38:
2561
+ C = f > 0 ? 1 : (I += "\f", -1);
2562
+ break;
2563
+ case 44:
2564
+ a[d++] = (me(I) - 1) * C, C = 1;
2565
+ break;
2566
+ case 64:
2567
+ ge() === 45 && (I += nt(ae())), E = ge(), f = u = me(y = I += io(rt())), w++;
2568
+ break;
2569
+ case 45:
2570
+ b === 45 && me(I) == 2 && (p = 0);
2571
+ }
2572
+ }
2573
+ return o;
2574
+ }
2575
+ function Rr(e, t, r, n, s, o, i, a, l, d, f) {
2576
+ for (var u = s - 1, E = s === 0 ? o : [""], S = Vt(E), b = 0, p = 0, v = 0; b < n; ++b)
2577
+ for (var C = 0, w = Ue(e, u + 1, u = Ks(p = i[b])), y = e; C < S; ++C)
2578
+ (y = dn(p > 0 ? E[C] + " " + w : U(w, /&\f/g, E[C]))) && (l[v++] = y);
2579
+ return mt(e, t, r, s === 0 ? Ut : a, l, d, f);
2580
+ }
2581
+ function co(e, t, r) {
2582
+ return mt(e, t, r, $t, dt(to()), Ue(e, 2, -2), 0);
2583
+ }
2584
+ function Or(e, t, r, n) {
2585
+ return mt(e, t, r, Xt, Ue(e, 0, n), Ue(e, n + 1, -1), n);
2586
+ }
2587
+ function Me(e, t) {
2588
+ for (var r = "", n = Vt(e), s = 0; s < n; s++)
2589
+ r += t(e[s], s, e, t) || "";
2590
+ return r;
2591
+ }
2592
+ function uo(e, t, r, n) {
2593
+ switch (e.type) {
2594
+ case Hs:
2595
+ case Xt:
2596
+ return e.return = e.return || e.value;
2597
+ case $t:
2598
+ return "";
2599
+ case fn:
2600
+ return e.return = e.value + "{" + Me(e.children, n) + "}";
2601
+ case Ut:
2602
+ e.value = e.props.join(",");
2603
+ }
2604
+ return me(r = Me(e.children, n)) ? e.return = e.value + "{" + r + "}" : "";
2605
+ }
2606
+ function lo(e) {
2607
+ var t = Vt(e);
2608
+ return function(r, n, s, o) {
2609
+ for (var i = "", a = 0; a < t; a++)
2610
+ i += e[a](r, n, s, o) || "";
2611
+ return i;
2612
+ };
2613
+ }
2614
+ function fo(e) {
2615
+ return function(t) {
2616
+ t.root || (t = t.return) && e(t);
2617
+ };
2618
+ }
2619
+ var po = function(t, r, n) {
2620
+ for (var s = 0, o = 0; s = o, o = ge(), s === 38 && o === 12 && (r[n] = 1), !Xe(o); )
2621
+ ae();
2622
+ return Ze(t, oe);
2623
+ }, mo = function(t, r) {
2624
+ var n = -1, s = 44;
2625
+ do
2626
+ switch (Xe(s)) {
2627
+ case 0:
2628
+ s === 38 && ge() === 12 && (r[n] = 1), t[n] += po(oe - 1, r, n);
2629
+ break;
2630
+ case 2:
2631
+ t[n] += nt(s);
2632
+ break;
2633
+ case 4:
2634
+ if (s === 44) {
2635
+ t[++n] = ge() === 58 ? "&\f" : "", r[n] = t[n].length;
2636
+ break;
2637
+ }
2638
+ default:
2639
+ t[n] += dt(s);
2640
+ }
2641
+ while (s = ae());
2642
+ return t;
2643
+ }, go = function(t, r) {
2644
+ return gn(mo(mn(t), r));
2645
+ }, kr = /* @__PURE__ */ new WeakMap(), ho = function(t) {
2646
+ if (!(t.type !== "rule" || !t.parent || // positive .length indicates that this rule contains pseudo
2647
+ // negative .length indicates that this rule has been already prefixed
2648
+ t.length < 1)) {
2649
+ for (var r = t.value, n = t.parent, s = t.column === n.column && t.line === n.line; n.type !== "rule"; )
2650
+ if (n = n.parent, !n)
2651
+ return;
2652
+ if (!(t.props.length === 1 && r.charCodeAt(0) !== 58 && !kr.get(n)) && !s) {
2653
+ kr.set(t, !0);
2654
+ for (var o = [], i = go(r, o), a = n.props, l = 0, d = 0; l < i.length; l++)
2655
+ for (var f = 0; f < a.length; f++, d++)
2656
+ t.props[d] = o[l] ? i[l].replace(/&\f/g, a[f]) : a[f] + " " + i[l];
2657
+ }
2658
+ }
2659
+ }, vo = function(t) {
2660
+ if (t.type === "decl") {
2661
+ var r = t.value;
2662
+ // charcode for l
2663
+ r.charCodeAt(0) === 108 && // charcode for b
2664
+ r.charCodeAt(2) === 98 && (t.return = "", t.value = "");
2665
+ }
2666
+ }, yo = "emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason", bo = function(t) {
2667
+ return t.type === "comm" && t.children.indexOf(yo) > -1;
2668
+ }, So = function(t) {
2669
+ return function(r, n, s) {
2670
+ if (!(r.type !== "rule" || t.compat)) {
2671
+ var o = r.value.match(/(:first|:nth|:nth-last)-child/g);
2672
+ if (o) {
2673
+ for (var i = r.parent === s[0], a = i ? s[0].children : (
2674
+ // global rule at the root level
2675
+ s
2676
+ ), l = a.length - 1; l >= 0; l--) {
2677
+ var d = a[l];
2678
+ if (d.line < r.line)
2679
+ break;
2680
+ if (d.column < r.column) {
2681
+ if (bo(d))
2682
+ return;
2683
+ break;
2684
+ }
2685
+ }
2686
+ o.forEach(function(f) {
2687
+ console.error('The pseudo class "' + f + '" is potentially unsafe when doing server-side rendering. Try changing it to "' + f.split("-child")[0] + '-of-type".');
2688
+ });
2689
+ }
2690
+ }
2691
+ };
2692
+ }, hn = function(t) {
2693
+ return t.type.charCodeAt(1) === 105 && t.type.charCodeAt(0) === 64;
2694
+ }, Co = function(t, r) {
2695
+ for (var n = t - 1; n >= 0; n--)
2696
+ if (!hn(r[n]))
2697
+ return !0;
2698
+ return !1;
2699
+ }, Ar = function(t) {
2700
+ t.type = "", t.value = "", t.return = "", t.children = "", t.props = "";
2701
+ }, Eo = function(t, r, n) {
2702
+ hn(t) && (t.parent ? (console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."), Ar(t)) : Co(r, n) && (console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."), Ar(t)));
2703
+ };
2704
+ function vn(e, t) {
2705
+ switch (Js(e, t)) {
2706
+ case 5103:
2707
+ return $ + "print-" + e + e;
2708
+ case 5737:
2709
+ case 4201:
2710
+ case 3177:
2711
+ case 3433:
2712
+ case 1641:
2713
+ case 4457:
2714
+ case 2921:
2715
+ case 5572:
2716
+ case 6356:
2717
+ case 5844:
2718
+ case 3191:
2719
+ case 6645:
2720
+ case 3005:
2721
+ case 6391:
2722
+ case 5879:
2723
+ case 5623:
2724
+ case 6135:
2725
+ case 4599:
2726
+ case 4855:
2727
+ case 4215:
2728
+ case 6389:
2729
+ case 5109:
2730
+ case 5365:
2731
+ case 5621:
2732
+ case 3829:
2733
+ return $ + e + e;
2734
+ case 5349:
2735
+ case 4246:
2736
+ case 4810:
2737
+ case 6968:
2738
+ case 2756:
2739
+ return $ + e + it + e + re + e + e;
2740
+ case 6828:
2741
+ case 4268:
2742
+ return $ + e + re + e + e;
2743
+ case 6165:
2744
+ return $ + e + re + "flex-" + e + e;
2745
+ case 5187:
2746
+ return $ + e + U(e, /(\w+).+(:[^]+)/, $ + "box-$1$2" + re + "flex-$1$2") + e;
2747
+ case 5443:
2748
+ return $ + e + re + "flex-item-" + U(e, /flex-|-self/, "") + e;
2749
+ case 4675:
2750
+ return $ + e + re + "flex-line-pack" + U(e, /align-content|flex-|-self/, "") + e;
2751
+ case 5548:
2752
+ return $ + e + re + U(e, "shrink", "negative") + e;
2753
+ case 5292:
2754
+ return $ + e + re + U(e, "basis", "preferred-size") + e;
2755
+ case 6060:
2756
+ return $ + "box-" + U(e, "-grow", "") + $ + e + re + U(e, "grow", "positive") + e;
2757
+ case 4554:
2758
+ return $ + U(e, /([^-])(transform)/g, "$1" + $ + "$2") + e;
2759
+ case 6187:
2760
+ return U(U(U(e, /(zoom-|grab)/, $ + "$1"), /(image-set)/, $ + "$1"), e, "") + e;
2761
+ case 5495:
2762
+ case 3959:
2763
+ return U(e, /(image-set\([^]*)/, $ + "$1$`$1");
2764
+ case 4968:
2765
+ return U(U(e, /(.+:)(flex-)?(.*)/, $ + "box-pack:$3" + re + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + $ + e + e;
2766
+ case 4095:
2767
+ case 3583:
2768
+ case 4068:
2769
+ case 2532:
2770
+ return U(e, /(.+)-inline(.+)/, $ + "$1$2") + e;
2771
+ case 8116:
2772
+ case 7059:
2773
+ case 5753:
2774
+ case 5535:
2775
+ case 5445:
2776
+ case 5701:
2777
+ case 4933:
2778
+ case 4677:
2779
+ case 5533:
2780
+ case 5789:
2781
+ case 5021:
2782
+ case 4765:
2783
+ if (me(e) - 1 - t > 6)
2784
+ switch (te(e, t + 1)) {
2785
+ case 109:
2786
+ if (te(e, t + 4) !== 45)
2787
+ break;
2788
+ case 102:
2789
+ return U(e, /(.+:)(.+)-([^]+)/, "$1" + $ + "$2-$3$1" + it + (te(e, t + 3) == 108 ? "$3" : "$2-$3")) + e;
2790
+ case 115:
2791
+ return ~Lt(e, "stretch") ? vn(U(e, "stretch", "fill-available"), t) + e : e;
2792
+ }
2793
+ break;
2794
+ case 4949:
2795
+ if (te(e, t + 1) !== 115)
2796
+ break;
2797
+ case 6444:
2798
+ switch (te(e, me(e) - 3 - (~Lt(e, "!important") && 10))) {
2799
+ case 107:
2800
+ return U(e, ":", ":" + $) + e;
2801
+ case 101:
2802
+ return U(e, /(.+:)([^;!]+)(;|!.+)?/, "$1" + $ + (te(e, 14) === 45 ? "inline-" : "") + "box$3$1" + $ + "$2$3$1" + re + "$2box$3") + e;
2803
+ }
2804
+ break;
2805
+ case 5936:
2806
+ switch (te(e, t + 11)) {
2807
+ case 114:
2808
+ return $ + e + re + U(e, /[svh]\w+-[tblr]{2}/, "tb") + e;
2809
+ case 108:
2810
+ return $ + e + re + U(e, /[svh]\w+-[tblr]{2}/, "tb-rl") + e;
2811
+ case 45:
2812
+ return $ + e + re + U(e, /[svh]\w+-[tblr]{2}/, "lr") + e;
2813
+ }
2814
+ return $ + e + re + e + e;
2815
+ }
2816
+ return e;
2817
+ }
2818
+ var wo = function(t, r, n, s) {
2819
+ if (t.length > -1 && !t.return)
2820
+ switch (t.type) {
2821
+ case Xt:
2822
+ t.return = vn(t.value, t.length);
2823
+ break;
2824
+ case fn:
2825
+ return Me([ze(t, {
2826
+ value: U(t.value, "@", "@" + $)
2827
+ })], s);
2828
+ case Ut:
2829
+ if (t.length)
2830
+ return eo(t.props, function(o) {
2831
+ switch (Qs(o, /(::plac\w+|:read-\w+)/)) {
2832
+ case ":read-only":
2833
+ case ":read-write":
2834
+ return Me([ze(t, {
2835
+ props: [U(o, /:(read-\w+)/, ":" + it + "$1")]
2836
+ })], s);
2837
+ case "::placeholder":
2838
+ return Me([ze(t, {
2839
+ props: [U(o, /:(plac\w+)/, ":" + $ + "input-$1")]
2840
+ }), ze(t, {
2841
+ props: [U(o, /:(plac\w+)/, ":" + it + "$1")]
2842
+ }), ze(t, {
2843
+ props: [U(o, /:(plac\w+)/, re + "input-$1")]
2844
+ })], s);
2845
+ }
2846
+ return "";
2847
+ });
2848
+ }
2849
+ }, Io = [wo], _o = function(t) {
2850
+ var r = t.key;
2851
+ if (process.env.NODE_ENV !== "production" && !r)
2852
+ throw new Error(`You have to configure \`key\` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.
2853
+ If multiple caches share the same key they might "fight" for each other's style elements.`);
2854
+ if (r === "css") {
2855
+ var n = document.querySelectorAll("style[data-emotion]:not([data-s])");
2856
+ Array.prototype.forEach.call(n, function(p) {
2857
+ var v = p.getAttribute("data-emotion");
2858
+ v.indexOf(" ") !== -1 && (document.head.appendChild(p), p.setAttribute("data-s", ""));
2859
+ });
2860
+ }
2861
+ var s = t.stylisPlugins || Io;
2862
+ if (process.env.NODE_ENV !== "production" && /[^a-z-]/.test(r))
2863
+ throw new Error('Emotion key must only contain lower case alphabetical characters and - but "' + r + '" was passed');
2864
+ var o = {}, i, a = [];
2865
+ i = t.container || document.head, Array.prototype.forEach.call(
2866
+ // this means we will ignore elements which don't have a space in them which
2867
+ // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
2868
+ document.querySelectorAll('style[data-emotion^="' + r + ' "]'),
2869
+ function(p) {
2870
+ for (var v = p.getAttribute("data-emotion").split(" "), C = 1; C < v.length; C++)
2871
+ o[v[C]] = !0;
2872
+ a.push(p);
2873
+ }
2874
+ );
2875
+ var l, d = [ho, vo];
2876
+ process.env.NODE_ENV !== "production" && d.push(So({
2877
+ get compat() {
2878
+ return b.compat;
2879
+ }
2880
+ }), Eo);
2881
+ {
2882
+ var f, u = [uo, process.env.NODE_ENV !== "production" ? function(p) {
2883
+ p.root || (p.return ? f.insert(p.return) : p.value && p.type !== $t && f.insert(p.value + "{}"));
2884
+ } : fo(function(p) {
2885
+ f.insert(p);
2886
+ })], E = lo(d.concat(s, u)), S = function(v) {
2887
+ return Me(ao(v), E);
2888
+ };
2889
+ l = function(v, C, w, y) {
2890
+ f = w, process.env.NODE_ENV !== "production" && C.map !== void 0 && (f = {
2891
+ insert: function(x) {
2892
+ w.insert(x + C.map);
2893
+ }
2894
+ }), S(v ? v + "{" + C.styles + "}" : C.styles), y && (b.inserted[C.name] = !0);
2895
+ };
2896
+ }
2897
+ var b = {
2898
+ key: r,
2899
+ sheet: new Zs({
2900
+ key: r,
2901
+ container: i,
2902
+ nonce: t.nonce,
2903
+ speedy: t.speedy,
2904
+ prepend: t.prepend,
2905
+ insertionPoint: t.insertionPoint
2906
+ }),
2907
+ nonce: t.nonce,
2908
+ inserted: o,
2909
+ registered: {},
2910
+ insert: l
2911
+ };
2912
+ return b.sheet.hydrate(a), b;
2913
+ }, xo = !0;
2914
+ function yn(e, t, r) {
2915
+ var n = "";
2916
+ return r.split(" ").forEach(function(s) {
2917
+ e[s] !== void 0 ? t.push(e[s] + ";") : n += s + " ";
2918
+ }), n;
2919
+ }
2920
+ var Gt = function(t, r, n) {
2921
+ var s = t.key + "-" + r.name;
2922
+ // we only need to add the styles to the registered cache if the
2923
+ // class name could be used further down
2924
+ // the tree but if it's a string tag, we know it won't
2925
+ // so we don't have to add it to registered cache.
2926
+ // this improves memory usage since we can avoid storing the whole style string
2927
+ (n === !1 || // we need to always store it if we're in compat mode and
2928
+ // in node since emotion-server relies on whether a style is in
2929
+ // the registered cache to know whether a style is global or not
2930
+ // also, note that this check will be dead code eliminated in the browser
2931
+ xo === !1) && t.registered[s] === void 0 && (t.registered[s] = r.styles);
2932
+ }, bn = function(t, r, n) {
2933
+ Gt(t, r, n);
2934
+ var s = t.key + "-" + r.name;
2935
+ if (t.inserted[r.name] === void 0) {
2936
+ var o = r;
2937
+ do
2938
+ t.insert(r === o ? "." + s : "", o, t.sheet, !0), o = o.next;
2939
+ while (o !== void 0);
2940
+ }
2941
+ };
2942
+ function Ro(e) {
2943
+ for (var t = 0, r, n = 0, s = e.length; s >= 4; ++n, s -= 4)
2944
+ r = e.charCodeAt(n) & 255 | (e.charCodeAt(++n) & 255) << 8 | (e.charCodeAt(++n) & 255) << 16 | (e.charCodeAt(++n) & 255) << 24, r = /* Math.imul(k, m): */
2945
+ (r & 65535) * 1540483477 + ((r >>> 16) * 59797 << 16), r ^= /* k >>> r: */
2946
+ r >>> 24, t = /* Math.imul(k, m): */
2947
+ (r & 65535) * 1540483477 + ((r >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
2948
+ (t & 65535) * 1540483477 + ((t >>> 16) * 59797 << 16);
2949
+ switch (s) {
2950
+ case 3:
2951
+ t ^= (e.charCodeAt(n + 2) & 255) << 16;
2952
+ case 2:
2953
+ t ^= (e.charCodeAt(n + 1) & 255) << 8;
2954
+ case 1:
2955
+ t ^= e.charCodeAt(n) & 255, t = /* Math.imul(h, m): */
2956
+ (t & 65535) * 1540483477 + ((t >>> 16) * 59797 << 16);
2957
+ }
2958
+ return t ^= t >>> 13, t = /* Math.imul(h, m): */
2959
+ (t & 65535) * 1540483477 + ((t >>> 16) * 59797 << 16), ((t ^ t >>> 15) >>> 0).toString(36);
2960
+ }
2961
+ var Oo = {
2962
+ animationIterationCount: 1,
2963
+ borderImageOutset: 1,
2964
+ borderImageSlice: 1,
2965
+ borderImageWidth: 1,
2966
+ boxFlex: 1,
2967
+ boxFlexGroup: 1,
2968
+ boxOrdinalGroup: 1,
2969
+ columnCount: 1,
2970
+ columns: 1,
2971
+ flex: 1,
2972
+ flexGrow: 1,
2973
+ flexPositive: 1,
2974
+ flexShrink: 1,
2975
+ flexNegative: 1,
2976
+ flexOrder: 1,
2977
+ gridRow: 1,
2978
+ gridRowEnd: 1,
2979
+ gridRowSpan: 1,
2980
+ gridRowStart: 1,
2981
+ gridColumn: 1,
2982
+ gridColumnEnd: 1,
2983
+ gridColumnSpan: 1,
2984
+ gridColumnStart: 1,
2985
+ msGridRow: 1,
2986
+ msGridRowSpan: 1,
2987
+ msGridColumn: 1,
2988
+ msGridColumnSpan: 1,
2989
+ fontWeight: 1,
2990
+ lineHeight: 1,
2991
+ opacity: 1,
2992
+ order: 1,
2993
+ orphans: 1,
2994
+ tabSize: 1,
2995
+ widows: 1,
2996
+ zIndex: 1,
2997
+ zoom: 1,
2998
+ WebkitLineClamp: 1,
2999
+ // SVG-related properties
3000
+ fillOpacity: 1,
3001
+ floodOpacity: 1,
3002
+ stopOpacity: 1,
3003
+ strokeDasharray: 1,
3004
+ strokeDashoffset: 1,
3005
+ strokeMiterlimit: 1,
3006
+ strokeOpacity: 1,
3007
+ strokeWidth: 1
3008
+ }, Mr = `You have illegal escape sequence in your template literal, most likely inside content's property value.
3009
+ Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
3010
+ You can read more about this here:
3011
+ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`, ko = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).", Ao = /[A-Z]|^ms/g, Sn = /_EMO_([^_]+?)_([^]*?)_EMO_/g, Ft = function(t) {
3012
+ return t.charCodeAt(1) === 45;
3013
+ }, Nr = function(t) {
3014
+ return t != null && typeof t != "boolean";
3015
+ }, xt = /* @__PURE__ */ ln(function(e) {
3016
+ return Ft(e) ? e : e.replace(Ao, "-$&").toLowerCase();
3017
+ }), at = function(t, r) {
3018
+ switch (t) {
3019
+ case "animation":
3020
+ case "animationName":
3021
+ if (typeof r == "string")
3022
+ return r.replace(Sn, function(n, s, o) {
3023
+ return fe = {
3024
+ name: s,
3025
+ styles: o,
3026
+ next: fe
3027
+ }, s;
3028
+ });
3029
+ }
3030
+ return Oo[t] !== 1 && !Ft(t) && typeof r == "number" && r !== 0 ? r + "px" : r;
3031
+ };
3032
+ if (process.env.NODE_ENV !== "production") {
3033
+ var Mo = /(var|attr|counters?|url|element|(((repeating-)?(linear|radial))|conic)-gradient)\(|(no-)?(open|close)-quote/, No = ["normal", "none", "initial", "inherit", "unset"], To = at, Lo = /^-ms-/, Po = /-(.)/g, Tr = {};
3034
+ at = function(t, r) {
3035
+ if (t === "content" && (typeof r != "string" || No.indexOf(r) === -1 && !Mo.test(r) && (r.charAt(0) !== r.charAt(r.length - 1) || r.charAt(0) !== '"' && r.charAt(0) !== "'")))
3036
+ throw new Error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + r + "\"'`");
3037
+ var n = To(t, r);
3038
+ return n !== "" && !Ft(t) && t.indexOf("-") !== -1 && Tr[t] === void 0 && (Tr[t] = !0, console.error("Using kebab-case for css properties in objects is not supported. Did you mean " + t.replace(Lo, "ms-").replace(Po, function(s, o) {
3039
+ return o.toUpperCase();
3040
+ }) + "?")), n;
3041
+ };
3042
+ }
3043
+ var Cn = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
3044
+ function Ve(e, t, r) {
3045
+ if (r == null)
3046
+ return "";
3047
+ if (r.__emotion_styles !== void 0) {
3048
+ if (process.env.NODE_ENV !== "production" && r.toString() === "NO_COMPONENT_SELECTOR")
3049
+ throw new Error(Cn);
3050
+ return r;
3051
+ }
3052
+ switch (typeof r) {
3053
+ case "boolean":
3054
+ return "";
3055
+ case "object": {
3056
+ if (r.anim === 1)
3057
+ return fe = {
3058
+ name: r.name,
3059
+ styles: r.styles,
3060
+ next: fe
3061
+ }, r.name;
3062
+ if (r.styles !== void 0) {
3063
+ var n = r.next;
3064
+ if (n !== void 0)
3065
+ for (; n !== void 0; )
3066
+ fe = {
3067
+ name: n.name,
3068
+ styles: n.styles,
3069
+ next: fe
3070
+ }, n = n.next;
3071
+ var s = r.styles + ";";
3072
+ return process.env.NODE_ENV !== "production" && r.map !== void 0 && (s += r.map), s;
3073
+ }
3074
+ return jo(e, t, r);
3075
+ }
3076
+ case "function": {
3077
+ if (e !== void 0) {
3078
+ var o = fe, i = r(e);
3079
+ return fe = o, Ve(e, t, i);
3080
+ } else
3081
+ process.env.NODE_ENV !== "production" && console.error("Functions that are interpolated in css calls will be stringified.\nIf you want to have a css call based on props, create a function that returns a css call like this\nlet dynamicStyle = (props) => css`color: ${props.color}`\nIt can be called directly with props or interpolated in a styled call like this\nlet SomeComponent = styled('div')`${dynamicStyle}`");
3082
+ break;
3083
+ }
3084
+ case "string":
3085
+ if (process.env.NODE_ENV !== "production") {
3086
+ var a = [], l = r.replace(Sn, function(f, u, E) {
3087
+ var S = "animation" + a.length;
3088
+ return a.push("const " + S + " = keyframes`" + E.replace(/^@keyframes animation-\w+/, "") + "`"), "${" + S + "}";
3089
+ });
3090
+ a.length && console.error("`keyframes` output got interpolated into plain string, please wrap it with `css`.\n\nInstead of doing this:\n\n" + [].concat(a, ["`" + l + "`"]).join(`
3091
+ `) + `
3092
+
3093
+ You should wrap it with \`css\` like this:
3094
+
3095
+ ` + ("css`" + l + "`"));
3096
+ }
3097
+ break;
3098
+ }
3099
+ if (t == null)
3100
+ return r;
3101
+ var d = t[r];
3102
+ return d !== void 0 ? d : r;
3103
+ }
3104
+ function jo(e, t, r) {
3105
+ var n = "";
3106
+ if (Array.isArray(r))
3107
+ for (var s = 0; s < r.length; s++)
3108
+ n += Ve(e, t, r[s]) + ";";
3109
+ else
3110
+ for (var o in r) {
3111
+ var i = r[o];
3112
+ if (typeof i != "object")
3113
+ t != null && t[i] !== void 0 ? n += o + "{" + t[i] + "}" : Nr(i) && (n += xt(o) + ":" + at(o, i) + ";");
3114
+ else {
3115
+ if (o === "NO_COMPONENT_SELECTOR" && process.env.NODE_ENV !== "production")
3116
+ throw new Error(Cn);
3117
+ if (Array.isArray(i) && typeof i[0] == "string" && (t == null || t[i[0]] === void 0))
3118
+ for (var a = 0; a < i.length; a++)
3119
+ Nr(i[a]) && (n += xt(o) + ":" + at(o, i[a]) + ";");
3120
+ else {
3121
+ var l = Ve(e, t, i);
3122
+ switch (o) {
3123
+ case "animation":
3124
+ case "animationName": {
3125
+ n += xt(o) + ":" + l + ";";
3126
+ break;
3127
+ }
3128
+ default:
3129
+ process.env.NODE_ENV !== "production" && o === "undefined" && console.error(ko), n += o + "{" + l + "}";
3130
+ }
3131
+ }
3132
+ }
3133
+ }
3134
+ return n;
3135
+ }
3136
+ var Lr = /label:\s*([^\s;\n{]+)\s*(;|$)/g, En;
3137
+ process.env.NODE_ENV !== "production" && (En = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g);
3138
+ var fe, jt = function(t, r, n) {
3139
+ if (t.length === 1 && typeof t[0] == "object" && t[0] !== null && t[0].styles !== void 0)
3140
+ return t[0];
3141
+ var s = !0, o = "";
3142
+ fe = void 0;
3143
+ var i = t[0];
3144
+ i == null || i.raw === void 0 ? (s = !1, o += Ve(n, r, i)) : (process.env.NODE_ENV !== "production" && i[0] === void 0 && console.error(Mr), o += i[0]);
3145
+ for (var a = 1; a < t.length; a++)
3146
+ o += Ve(n, r, t[a]), s && (process.env.NODE_ENV !== "production" && i[a] === void 0 && console.error(Mr), o += i[a]);
3147
+ var l;
3148
+ process.env.NODE_ENV !== "production" && (o = o.replace(En, function(E) {
3149
+ return l = E, "";
3150
+ })), Lr.lastIndex = 0;
3151
+ for (var d = "", f; (f = Lr.exec(o)) !== null; )
3152
+ d += "-" + // $FlowFixMe we know it's not null
3153
+ f[1];
3154
+ var u = Ro(o) + d;
3155
+ return process.env.NODE_ENV !== "production" ? {
3156
+ name: u,
3157
+ styles: o,
3158
+ map: l,
3159
+ next: fe,
3160
+ toString: function() {
3161
+ return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
3162
+ }
3163
+ } : {
3164
+ name: u,
3165
+ styles: o,
3166
+ next: fe
3167
+ };
3168
+ }, Do = function(t) {
3169
+ return t();
3170
+ }, zo = fr["useInsertionEffect"] ? fr["useInsertionEffect"] : !1, wn = zo || Do, Yo = {}.hasOwnProperty, Zt = /* @__PURE__ */ Gr(
3171
+ // we're doing this to avoid preconstruct's dead code elimination in this one case
3172
+ // because this module is primarily intended for the browser and node
3173
+ // but it's also required in react native and similar environments sometimes
3174
+ // and we could have a special build just for that
3175
+ // but this is much easier and the native packages
3176
+ // might use a different theme context in the future anyway
3177
+ typeof HTMLElement < "u" ? /* @__PURE__ */ _o({
3178
+ key: "css"
3179
+ }) : null
3180
+ );
3181
+ process.env.NODE_ENV !== "production" && (Zt.displayName = "EmotionCacheContext");
3182
+ Zt.Provider;
3183
+ var In = function(t) {
3184
+ return /* @__PURE__ */ Jn(function(r, n) {
3185
+ var s = Se(Zt);
3186
+ return t(r, s, n);
3187
+ });
3188
+ }, Ht = /* @__PURE__ */ Gr({});
3189
+ process.env.NODE_ENV !== "production" && (Ht.displayName = "EmotionThemeContext");
3190
+ var Pr = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__", jr = "__EMOTION_LABEL_PLEASE_DO_NOT_USE__", Bo = function(t) {
3191
+ var r = t.cache, n = t.serialized, s = t.isStringTag;
3192
+ return Gt(r, n, s), wn(function() {
3193
+ return bn(r, n, s);
3194
+ }), null;
3195
+ }, Wo = /* @__PURE__ */ In(function(e, t, r) {
3196
+ var n = e.css;
3197
+ typeof n == "string" && t.registered[n] !== void 0 && (n = t.registered[n]);
3198
+ var s = e[Pr], o = [n], i = "";
3199
+ typeof e.className == "string" ? i = yn(t.registered, o, e.className) : e.className != null && (i = e.className + " ");
3200
+ var a = jt(o, void 0, Se(Ht));
3201
+ if (process.env.NODE_ENV !== "production" && a.name.indexOf("-") === -1) {
3202
+ var l = e[jr];
3203
+ l && (a = jt([a, "label:" + l + ";"]));
3204
+ }
3205
+ i += t.key + "-" + a.name;
3206
+ var d = {};
3207
+ for (var f in e)
3208
+ Yo.call(e, f) && f !== "css" && f !== Pr && (process.env.NODE_ENV === "production" || f !== jr) && (d[f] = e[f]);
3209
+ return d.ref = r, d.className = i, /* @__PURE__ */ Ae(Fr, null, /* @__PURE__ */ Ae(Bo, {
3210
+ cache: t,
3211
+ serialized: a,
3212
+ isStringTag: typeof s == "string"
3213
+ }), /* @__PURE__ */ Ae(s, d));
3214
+ });
3215
+ process.env.NODE_ENV !== "production" && (Wo.displayName = "EmotionCssPropInternal");
3216
+ var $o = Vs, Uo = function(t) {
3217
+ return t !== "theme";
3218
+ }, Dr = function(t) {
3219
+ return typeof t == "string" && // 96 is one less than the char code
3220
+ // for "a" so this is checking that
3221
+ // it's a lowercase character
3222
+ t.charCodeAt(0) > 96 ? $o : Uo;
3223
+ }, zr = function(t, r, n) {
3224
+ var s;
3225
+ if (r) {
3226
+ var o = r.shouldForwardProp;
3227
+ s = t.__emotion_forwardProp && o ? function(i) {
3228
+ return t.__emotion_forwardProp(i) && o(i);
3229
+ } : o;
3230
+ }
3231
+ return typeof s != "function" && n && (s = t.__emotion_forwardProp), s;
3232
+ }, Yr = `You have illegal escape sequence in your template literal, most likely inside content's property value.
3233
+ Because you write your CSS inside a JavaScript string you actually have to do double escaping, so for example "content: '\\00d7';" should become "content: '\\\\00d7';".
3234
+ You can read more about this here:
3235
+ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences`, Xo = function(t) {
3236
+ var r = t.cache, n = t.serialized, s = t.isStringTag;
3237
+ return Gt(r, n, s), wn(function() {
3238
+ return bn(r, n, s);
3239
+ }), null;
3240
+ }, Vo = function e(t, r) {
3241
+ if (process.env.NODE_ENV !== "production" && t === void 0)
3242
+ throw new Error(`You are trying to create a styled element with an undefined component.
3243
+ You may have forgotten to import it.`);
3244
+ var n = t.__emotion_real === t, s = n && t.__emotion_base || t, o, i;
3245
+ r !== void 0 && (o = r.label, i = r.target);
3246
+ var a = zr(t, r, n), l = a || Dr(s), d = !l("as");
3247
+ return function() {
3248
+ var f = arguments, u = n && t.__emotion_styles !== void 0 ? t.__emotion_styles.slice(0) : [];
3249
+ if (o !== void 0 && u.push("label:" + o + ";"), f[0] == null || f[0].raw === void 0)
3250
+ u.push.apply(u, f);
3251
+ else {
3252
+ process.env.NODE_ENV !== "production" && f[0][0] === void 0 && console.error(Yr), u.push(f[0][0]);
3253
+ for (var E = f.length, S = 1; S < E; S++)
3254
+ process.env.NODE_ENV !== "production" && f[0][S] === void 0 && console.error(Yr), u.push(f[S], f[0][S]);
3255
+ }
3256
+ var b = In(function(p, v, C) {
3257
+ var w = d && p.as || s, y = "", h = [], x = p;
3258
+ if (p.theme == null) {
3259
+ x = {};
3260
+ for (var m in p)
3261
+ x[m] = p[m];
3262
+ x.theme = Se(Ht);
3263
+ }
3264
+ typeof p.className == "string" ? y = yn(v.registered, h, p.className) : p.className != null && (y = p.className + " ");
3265
+ var I = jt(u.concat(h), v.registered, x);
3266
+ y += v.key + "-" + I.name, i !== void 0 && (y += " " + i);
3267
+ var N = d && a === void 0 ? Dr(w) : l, A = {};
3268
+ for (var M in p)
3269
+ d && M === "as" || // $FlowFixMe
3270
+ N(M) && (A[M] = p[M]);
3271
+ return A.className = y, A.ref = C, /* @__PURE__ */ Ae(Fr, null, /* @__PURE__ */ Ae(Xo, {
3272
+ cache: v,
3273
+ serialized: I,
3274
+ isStringTag: typeof w == "string"
3275
+ }), /* @__PURE__ */ Ae(w, A));
3276
+ });
3277
+ return b.displayName = o !== void 0 ? o : "Styled(" + (typeof s == "string" ? s : s.displayName || s.name || "Component") + ")", b.defaultProps = t.defaultProps, b.__emotion_real = b, b.__emotion_base = s, b.__emotion_styles = u, b.__emotion_forwardProp = a, Object.defineProperty(b, "toString", {
3278
+ value: function() {
3279
+ return i === void 0 && process.env.NODE_ENV !== "production" ? "NO_COMPONENT_SELECTOR" : "." + i;
3280
+ }
3281
+ }), b.withComponent = function(p, v) {
3282
+ return e(p, Tt({}, r, v, {
3283
+ shouldForwardProp: zr(b, v, !0)
3284
+ })).apply(void 0, u);
3285
+ }, b;
3286
+ };
3287
+ }, Go = [
3288
+ "a",
3289
+ "abbr",
3290
+ "address",
3291
+ "area",
3292
+ "article",
3293
+ "aside",
3294
+ "audio",
3295
+ "b",
3296
+ "base",
3297
+ "bdi",
3298
+ "bdo",
3299
+ "big",
3300
+ "blockquote",
3301
+ "body",
3302
+ "br",
3303
+ "button",
3304
+ "canvas",
3305
+ "caption",
3306
+ "cite",
3307
+ "code",
3308
+ "col",
3309
+ "colgroup",
3310
+ "data",
3311
+ "datalist",
3312
+ "dd",
3313
+ "del",
3314
+ "details",
3315
+ "dfn",
3316
+ "dialog",
3317
+ "div",
3318
+ "dl",
3319
+ "dt",
3320
+ "em",
3321
+ "embed",
3322
+ "fieldset",
3323
+ "figcaption",
3324
+ "figure",
3325
+ "footer",
3326
+ "form",
3327
+ "h1",
3328
+ "h2",
3329
+ "h3",
3330
+ "h4",
3331
+ "h5",
3332
+ "h6",
3333
+ "head",
3334
+ "header",
3335
+ "hgroup",
3336
+ "hr",
3337
+ "html",
3338
+ "i",
3339
+ "iframe",
3340
+ "img",
3341
+ "input",
3342
+ "ins",
3343
+ "kbd",
3344
+ "keygen",
3345
+ "label",
3346
+ "legend",
3347
+ "li",
3348
+ "link",
3349
+ "main",
3350
+ "map",
3351
+ "mark",
3352
+ "marquee",
3353
+ "menu",
3354
+ "menuitem",
3355
+ "meta",
3356
+ "meter",
3357
+ "nav",
3358
+ "noscript",
3359
+ "object",
3360
+ "ol",
3361
+ "optgroup",
3362
+ "option",
3363
+ "output",
3364
+ "p",
3365
+ "param",
3366
+ "picture",
3367
+ "pre",
3368
+ "progress",
3369
+ "q",
3370
+ "rp",
3371
+ "rt",
3372
+ "ruby",
3373
+ "s",
3374
+ "samp",
3375
+ "script",
3376
+ "section",
3377
+ "select",
3378
+ "small",
3379
+ "source",
3380
+ "span",
3381
+ "strong",
3382
+ "style",
3383
+ "sub",
3384
+ "summary",
3385
+ "sup",
3386
+ "table",
3387
+ "tbody",
3388
+ "td",
3389
+ "textarea",
3390
+ "tfoot",
3391
+ "th",
3392
+ "thead",
3393
+ "time",
3394
+ "title",
3395
+ "tr",
3396
+ "track",
3397
+ "u",
3398
+ "ul",
3399
+ "var",
3400
+ "video",
3401
+ "wbr",
3402
+ // SVG
3403
+ "circle",
3404
+ "clipPath",
3405
+ "defs",
3406
+ "ellipse",
3407
+ "foreignObject",
3408
+ "g",
3409
+ "image",
3410
+ "line",
3411
+ "linearGradient",
3412
+ "mask",
3413
+ "path",
3414
+ "pattern",
3415
+ "polygon",
3416
+ "polyline",
3417
+ "radialGradient",
3418
+ "rect",
3419
+ "stop",
3420
+ "svg",
3421
+ "text",
3422
+ "tspan"
3423
+ ], Te = Vo.bind();
3424
+ Go.forEach(function(e) {
3425
+ Te[e] = Te(e);
3426
+ });
3427
+ const Fo = Te.div`
3428
+ overflow: hidden;
3429
+ position: absolute;
3430
+ inset: 0;
3431
+ `, Br = ({ children: e, session: t, style: r }) => {
3432
+ const n = g.useRef(null), s = we((a) => a.joinSpace), [o, i] = Q((a) => [
3433
+ a.config.uid,
3434
+ a.updateConfiguration
3435
+ ]);
3436
+ return g.useEffect(() => {
3437
+ const a = (l) => {
3438
+ We(l.target, "board") && l.preventDefault();
3439
+ };
3440
+ return document.body.addEventListener("wheel", a, { passive: !1 }), () => {
3441
+ document.body.removeEventListener("wheel", a);
3442
+ };
3443
+ }, []), g.useEffect(() => (s(t), () => {
3444
+ s(null);
3445
+ }), [s, t]), g.useEffect(() => {
3446
+ o || i({
3447
+ uid: Ee()
3448
+ });
3449
+ }, [o, i]), g.useEffect(() => {
3450
+ i({
3451
+ boardWrapper: n.current
3452
+ });
3453
+ }, [i]), Rs(n, () => {
3454
+ n.current && i({
3455
+ boardWrapperRect: n.current.getBoundingClientRect()
3456
+ });
3457
+ }), /* @__PURE__ */ k(
3458
+ Fo,
3459
+ {
3460
+ ref: n,
3461
+ id: o,
3462
+ className: "sync-board",
3463
+ style: r,
3464
+ children: e
3465
+ }
3466
+ );
3467
+ }, ra = ({
3468
+ socket: e,
3469
+ room: t,
3470
+ session: r,
3471
+ items: n = [],
3472
+ messages: s = [],
3473
+ LoadingComponent: o,
3474
+ ...i
3475
+ }) => {
3476
+ const [a] = g.useState(t || Ee()), [l] = g.useState(r || Ee()), [d] = g.useState(() => ({
3477
+ itemIds: n.map(({ id: u }) => u),
3478
+ items: Object.fromEntries(n.map((u) => [u.id, u]))
3479
+ }));
3480
+ return ut("room") ? /* @__PURE__ */ k(
3481
+ xr,
3482
+ {
3483
+ storeName: `${l}_messages`,
3484
+ defaultValue: s,
3485
+ children: /* @__PURE__ */ k(
3486
+ wr,
3487
+ {
3488
+ storeName: `${l}_item`,
3489
+ defaultValue: d,
3490
+ children: /* @__PURE__ */ k(Br, { ...i, session: l })
3491
+ }
3492
+ )
3493
+ }
3494
+ ) : /* @__PURE__ */ k(
3495
+ Kr,
3496
+ {
3497
+ room: a,
3498
+ channel: "room",
3499
+ socket: e,
3500
+ LoadingComponent: o,
3501
+ children: /* @__PURE__ */ k(cn, { storeName: `${a}_users`, children: /* @__PURE__ */ k(
3502
+ xr,
3503
+ {
3504
+ storeName: `${l}_messages`,
3505
+ defaultValue: s,
3506
+ children: /* @__PURE__ */ k(
3507
+ wr,
3508
+ {
3509
+ storeName: `${l}_item`,
3510
+ defaultValue: d,
3511
+ children: /* @__PURE__ */ k(Br, { ...i, session: l })
3512
+ }
3513
+ )
3514
+ }
3515
+ ) })
3516
+ }
3517
+ );
3518
+ }, na = ({ socket: e, room: t, children: r, LoadingComponent: n }) => {
3519
+ const [s] = g.useState(t || Ee());
3520
+ return /* @__PURE__ */ k(
3521
+ Kr,
3522
+ {
3523
+ room: s,
3524
+ channel: "room",
3525
+ socket: e,
3526
+ LoadingComponent: n,
3527
+ children: /* @__PURE__ */ k(cn, { storeName: `${s}_users`, children: r })
3528
+ }
3529
+ );
3530
+ }, Rt = () => {
3531
+ const e = navigator.userAgent.toLowerCase();
3532
+ return /mac os ?x 10/.test(e);
3533
+ }, Zo = () => {
3534
+ const e = document.createElement("iframe");
3535
+ e.src = "#", document.body.appendChild(e);
3536
+ const t = e.contentWindow.document;
3537
+ t.open(), t.write(
3538
+ "<!DOCTYPE html><html><head></head><body><span>a</span></body></html>"
3539
+ ), t.close();
3540
+ const r = t.body.firstElementChild.offsetHeight;
3541
+ return document.body.removeChild(e), r;
3542
+ }, Ho = Zo(), Ko = 800, Wr = (e, t) => {
3543
+ const r = Object.keys(e).map((n) => Number(n)).find((n) => n !== t);
3544
+ return e[r];
3545
+ }, $r = ([e, t], [r, n]) => {
3546
+ const s = Math.abs(e - r), o = Math.abs(t - n);
3547
+ return Math.hypot(s, o);
3548
+ }, Ce = () => {
3549
+ }, qo = (e) => (t) => {
3550
+ const { event: r } = t;
3551
+ return r.isPropagationStopped() ? null : e(t);
3552
+ }, Jo = (e) => async (...t) => {
3553
+ try {
3554
+ await e(...t);
3555
+ } catch (r) {
3556
+ console.error(r);
3557
+ }
3558
+ };
3559
+ class Qo {
3560
+ constructor() {
3561
+ lr(this, "lastPromise", Promise.resolve(!0));
3562
+ }
3563
+ add(t, ...r) {
3564
+ return new Promise((n, s) => {
3565
+ this.lastPromise = this.lastPromise.then(() => qo(Jo(t))(...r)).then(n).catch(s);
3566
+ });
3567
+ }
3568
+ }
3569
+ const pe = new Qo(), gt = ({
3570
+ children: e,
3571
+ onDrag: t = Ce,
3572
+ onDragStart: r = Ce,
3573
+ onDragEnd: n = Ce,
3574
+ onPan: s = Ce,
3575
+ onTap: o = Ce,
3576
+ onLongTap: i = Ce,
3577
+ onDoubleTap: a = Ce,
3578
+ onZoom: l,
3579
+ mainAction: d = "drag"
3580
+ }) => {
3581
+ const f = g.useRef(null), u = g.useRef({
3582
+ moving: !1,
3583
+ pointers: {},
3584
+ mainPointer: void 0
3585
+ }), E = g.useCallback(
3586
+ (C) => {
3587
+ const {
3588
+ deltaX: w,
3589
+ deltaY: y,
3590
+ clientX: h,
3591
+ clientY: x,
3592
+ deltaMode: m,
3593
+ ctrlKey: I,
3594
+ altKey: N,
3595
+ metaKey: A,
3596
+ target: M
3597
+ } = C;
3598
+ if (!(N || I && !Rt()))
3599
+ if (Rt() && !I)
3600
+ pe.add(s, {
3601
+ deltaX: -2 * w,
3602
+ deltaY: -2 * y,
3603
+ button: 1,
3604
+ ctrlKey: I,
3605
+ metaKey: A,
3606
+ target: M,
3607
+ event: C
3608
+ });
3609
+ else {
3610
+ if (l === void 0 || !y)
3611
+ return;
3612
+ let L = y;
3613
+ switch (m) {
3614
+ case 1:
3615
+ L *= Ho;
3616
+ break;
3617
+ case 2:
3618
+ L *= Ko;
3619
+ break;
3620
+ }
3621
+ Rt() && (L *= 2), pe.add(l, { scale: L, clientX: h, clientY: x, event: C });
3622
+ }
3623
+ },
3624
+ [s, l]
3625
+ ), S = g.useCallback(
3626
+ (C) => {
3627
+ const {
3628
+ target: w,
3629
+ button: y,
3630
+ clientX: h,
3631
+ clientY: x,
3632
+ pointerId: m,
3633
+ altKey: I,
3634
+ ctrlKey: N,
3635
+ metaKey: A,
3636
+ isPrimary: M
3637
+ } = C;
3638
+ if (u.current.pointers[m] = { clientX: h, clientY: x }, M && (u.current.mainPointer = void 0), u.current.mainPointer !== void 0) {
3639
+ if (u.current.mainPointer !== m)
3640
+ try {
3641
+ const { clientX: L, clientY: B } = Wr(
3642
+ u.current.pointers,
3643
+ m
3644
+ ), Z = (L + h) / 2, H = (B + x) / 2, O = $r(
3645
+ [L, B],
3646
+ [h, x]
3647
+ );
3648
+ Object.assign(u.current, {
3649
+ pressed: !0,
3650
+ moving: !1,
3651
+ gestureStart: !1,
3652
+ startX: h,
3653
+ startY: x,
3654
+ prevX: Z,
3655
+ prevY: H,
3656
+ startDistance: O,
3657
+ prevDistance: O
3658
+ });
3659
+ } catch (L) {
3660
+ console.log("Error while getting other pointer. Ignoring", L), u.current.mainPointer;
3661
+ }
3662
+ return;
3663
+ }
3664
+ u.current.mainPointer = m, Object.assign(u.current, {
3665
+ pressed: !0,
3666
+ moving: !1,
3667
+ gestureStart: !1,
3668
+ startX: h,
3669
+ startY: x,
3670
+ prevX: h,
3671
+ prevY: x,
3672
+ currentButton: y,
3673
+ pointerDownEvent: C,
3674
+ target: w,
3675
+ timeStart: Date.now(),
3676
+ longTapTimeout: setTimeout(async () => {
3677
+ u.current.noTap = !0, pe.add(i, {
3678
+ clientX: h,
3679
+ clientY: x,
3680
+ altKey: I,
3681
+ ctrlKey: N,
3682
+ metaKey: A,
3683
+ target: w,
3684
+ event: C
3685
+ });
3686
+ }, 750)
3687
+ });
3688
+ try {
3689
+ w.setPointerCapture(m);
3690
+ } catch (L) {
3691
+ console.log("Fail to capture pointer", L);
3692
+ }
3693
+ },
3694
+ [i]
3695
+ ), b = g.useCallback(
3696
+ (C) => {
3697
+ if (u.current.pressed) {
3698
+ const {
3699
+ pointerId: w,
3700
+ clientX: y,
3701
+ clientY: h,
3702
+ altKey: x,
3703
+ ctrlKey: m,
3704
+ metaKey: I,
3705
+ buttons: N,
3706
+ pointerType: A
3707
+ } = C;
3708
+ u.current.pointers[w] = {
3709
+ clientX: y,
3710
+ clientY: h
3711
+ }, u.current.moving = !0;
3712
+ const M = Object.keys(u.current.pointers).length === 2;
3713
+ let L, B, Z;
3714
+ if (M) {
3715
+ const { clientX: j, clientY: X } = Wr(
3716
+ u.current.pointers,
3717
+ w
3718
+ );
3719
+ L = (j + y) / 2, B = (X + h) / 2, Z = $r(
3720
+ [j, X],
3721
+ [y, h]
3722
+ );
3723
+ } else
3724
+ L = y, B = h;
3725
+ let H = x || m || I || N !== 1;
3726
+ d !== "drag" && (H = !H);
3727
+ const O = A !== "touch" ? !H : !M, P = A !== "touch" ? H : M;
3728
+ if (O) {
3729
+ u.current.gestureStart || (f.current.style.cursor = "move", u.current.gestureStart = !0, clearTimeout(u.current.longTapTimeout), pe.add(r, {
3730
+ deltaX: 0,
3731
+ deltaY: 0,
3732
+ startX: u.current.startX,
3733
+ startY: u.current.startY,
3734
+ clientX: u.current.startX,
3735
+ clientY: u.current.startY,
3736
+ distanceX: 0,
3737
+ distanceY: 0,
3738
+ button: u.current.currentButton,
3739
+ altKey: x,
3740
+ ctrlKey: m,
3741
+ metaKey: I,
3742
+ target: u.current.target,
3743
+ event: u.current.pointerDownEvent
3744
+ }));
3745
+ const j = L - u.current.prevX, X = B - u.current.prevY, Y = L - u.current.startX, G = B - u.current.startY;
3746
+ pe.add(t, {
3747
+ deltaX: j,
3748
+ deltaY: X,
3749
+ startX: u.current.startX,
3750
+ startY: u.current.startY,
3751
+ clientX: L,
3752
+ clientY: B,
3753
+ distanceX: Y,
3754
+ distanceY: G,
3755
+ button: u.current.currentButton,
3756
+ altKey: x,
3757
+ ctrlKey: m,
3758
+ metaKey: I,
3759
+ target: u.current.target,
3760
+ event: C
3761
+ });
3762
+ }
3763
+ if (P) {
3764
+ u.current.gestureStart || (f.current.style.cursor = "move", u.current.gestureStart = !0, clearTimeout(u.current.longTapTimeout));
3765
+ const j = L - u.current.prevX, X = B - u.current.prevY, { target: Y } = u.current;
3766
+ if (pe.add(s, {
3767
+ deltaX: j,
3768
+ deltaY: X,
3769
+ button: u.current.currentButton,
3770
+ altKey: x,
3771
+ ctrlKey: m,
3772
+ metaKey: I,
3773
+ target: Y,
3774
+ event: C
3775
+ }), Z !== u.current.prevDistance && l) {
3776
+ const G = u.current.prevDistance - Z;
3777
+ Math.abs(G) > 0 && (pe.add(l, {
3778
+ scale: G * 3,
3779
+ clientX: L,
3780
+ clientY: B,
3781
+ event: C
3782
+ }), u.current.prevDistance = Z);
3783
+ }
3784
+ }
3785
+ u.current.prevX = L, u.current.prevY = B;
3786
+ }
3787
+ },
3788
+ [d, t, r, s, l]
3789
+ ), p = g.useCallback(
3790
+ (C) => {
3791
+ const { clientX: w, clientY: y, altKey: h, ctrlKey: x, metaKey: m, target: I, pointerId: N } = C;
3792
+ if (u.current.pointers[N] && (delete u.current.pointers[N], u.current.mainPointer === N)) {
3793
+ for (; Object.keys(u.current.pointers).length > 0; ) {
3794
+ u.current.mainPointer = Number(
3795
+ Object.keys(u.current.pointers)[0]
3796
+ );
3797
+ try {
3798
+ u.current.target.setPointerCapture(
3799
+ u.current.mainPointer
3800
+ );
3801
+ return;
3802
+ } catch (A) {
3803
+ console.log("Fails to set pointer capture", A), u.current.mainPointer = void 0, delete u.current.pointers[Object.keys(u.current.pointers)[0]];
3804
+ }
3805
+ }
3806
+ if (u.current.mainPointer = void 0, u.current.pressed = !1, clearTimeout(u.current.longTapTimeout), u.current.moving)
3807
+ u.current.moving = !1, pe.add(n, {
3808
+ deltaX: w - u.current.prevX,
3809
+ deltaY: y - u.current.prevY,
3810
+ startX: u.current.startX,
3811
+ startY: u.current.startY,
3812
+ clientX: w,
3813
+ clientY: y,
3814
+ distanceX: w - u.current.startX,
3815
+ distanceY: y - u.current.startY,
3816
+ button: u.current.currentButton,
3817
+ altKey: h,
3818
+ ctrlKey: x,
3819
+ metaKey: m,
3820
+ event: C
3821
+ }), f.current.style.cursor = "auto";
3822
+ else {
3823
+ const A = Date.now();
3824
+ u.current.noTap ? u.current.noTap = !1 : u.current.timeStart - A < 300 && pe.add(o, {
3825
+ clientX: w,
3826
+ clientY: y,
3827
+ altKey: h,
3828
+ ctrlKey: x,
3829
+ metaKey: m,
3830
+ target: I,
3831
+ event: C
3832
+ });
3833
+ }
3834
+ }
3835
+ },
3836
+ [n, o]
3837
+ ), v = g.useCallback(
3838
+ (C) => {
3839
+ const { clientX: w, clientY: y, altKey: h, ctrlKey: x, metaKey: m, target: I } = C;
3840
+ pe.add(a, {
3841
+ clientX: w,
3842
+ clientY: y,
3843
+ altKey: h,
3844
+ ctrlKey: x,
3845
+ metaKey: m,
3846
+ target: I,
3847
+ event: C
3848
+ });
3849
+ },
3850
+ [a]
3851
+ );
3852
+ return /* @__PURE__ */ k(
3853
+ "div",
3854
+ {
3855
+ onWheel: E,
3856
+ onPointerDown: S,
3857
+ onPointerMove: b,
3858
+ onPointerUp: p,
3859
+ onPointerOut: p,
3860
+ onPointerLeave: p,
3861
+ onPointerCancel: p,
3862
+ onDoubleClick: v,
3863
+ style: { touchAction: "none" },
3864
+ ref: f,
3865
+ children: e
3866
+ }
3867
+ );
3868
+ }, Ot = ({ onResize: e, ...t }) => {
3869
+ const r = Q((s) => s.getBoardState), n = g.useCallback(
3870
+ async ({ deltaX: s, deltaY: o, event: i }) => {
3871
+ i.stopPropagation();
3872
+ const { scale: a } = r();
3873
+ e({
3874
+ width: s / a,
3875
+ height: o / a
3876
+ });
3877
+ },
3878
+ [r, e]
3879
+ );
3880
+ return /* @__PURE__ */ k(gt, { onDrag: n, children: /* @__PURE__ */ k("div", { ...t }) });
3881
+ }, ei = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgdmVyc2lvbj0iMS4xIgogICB4PSIwcHgiCiAgIHk9IjBweCIKICAgdmlld0JveD0iMCAwIDc1LjYwMTMxOCA5NC45IgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBpZD0ic3ZnMjYiCiAgIHNvZGlwb2RpOmRvY25hbWU9ImxvY2suc3ZnIgogICB3aWR0aD0iNzUuNjAxMzE4IgogICBoZWlnaHQ9Ijk0LjkwMDAwMiIKICAgaW5rc2NhcGU6dmVyc2lvbj0iMC45Mi41ICgyMDYwZWMxZjlmLCAyMDIwLTA0LTA4KSI+PG1ldGFkYXRhCiAgICAgaWQ9Im1ldGFkYXRhMzIiPjxyZGY6UkRGPjxjYzpXb3JrCiAgICAgICAgIHJkZjphYm91dD0iIj48ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD48ZGM6dHlwZQogICAgICAgICAgIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+PGRjOnRpdGxlPjwvZGM6dGl0bGU+PC9jYzpXb3JrPjwvcmRmOlJERj48L21ldGFkYXRhPjxkZWZzCiAgICAgaWQ9ImRlZnMzMCIgLz48c29kaXBvZGk6bmFtZWR2aWV3CiAgICAgcGFnZWNvbG9yPSIjMDAwMDAwIgogICAgIGJvcmRlcmNvbG9yPSIjNjY2NjY2IgogICAgIGJvcmRlcm9wYWNpdHk9IjEiCiAgICAgb2JqZWN0dG9sZXJhbmNlPSIxMCIKICAgICBncmlkdG9sZXJhbmNlPSIxMCIKICAgICBndWlkZXRvbGVyYW5jZT0iMTAiCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAiCiAgICAgaW5rc2NhcGU6cGFnZXNoYWRvdz0iMiIKICAgICBpbmtzY2FwZTp3aW5kb3ctd2lkdGg9IjE4NDgiCiAgICAgaW5rc2NhcGU6d2luZG93LWhlaWdodD0iMTAxNiIKICAgICBpZD0ibmFtZWR2aWV3MjgiCiAgICAgc2hvd2dyaWQ9ImZhbHNlIgogICAgIGZpdC1tYXJnaW4tdG9wPSIwIgogICAgIGZpdC1tYXJnaW4tbGVmdD0iMCIKICAgICBmaXQtbWFyZ2luLXJpZ2h0PSIwIgogICAgIGZpdC1tYXJnaW4tYm90dG9tPSIwIgogICAgIGlua3NjYXBlOnpvb209IjUuMzQwMDcwNCIKICAgICBpbmtzY2FwZTpjeD0iMy4yNjQwMDEzIgogICAgIGlua3NjYXBlOmN5PSI0NS4wNzIxNTIiCiAgICAgaW5rc2NhcGU6d2luZG93LXg9IjE1MTIiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjI3IgogICAgIGlua3NjYXBlOndpbmRvdy1tYXhpbWl6ZWQ9IjEiCiAgICAgaW5rc2NhcGU6Y3VycmVudC1sYXllcj0iZzE2IiAvPjxnCiAgICAgaWQ9ImcxNiIKICAgICB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTIuMiwtMi41KSI+PHBhdGgKICAgICAgIGQ9Ik0gNzUuNCwzNi44IEggMzQuMSBWIDI0LjYgYyAwLC04LjggNy4xLC0xNS45IDE1LjksLTE1LjkgOC44LDAgMTUuOSw3LjEgMTUuOSwxNS45IDAsMS43IDEuNCwzLjEgMy4xLDMuMSAxLjcsMCAzLjEsLTEuNCAzLjEsLTMuMSBDIDcyLjEsMTIuNCA2Mi4yLDIuNSA1MCwyLjUgMzcuOCwyLjUgMjcuOSwxMi40IDI3LjksMjQuNiB2IDEyLjIgaCAtMy4zIGMgLTYuOSwwIC0xMi40LDUuNiAtMTIuNCwxMi40IFYgODUgYyAwLDYuOSA1LjYsMTIuNCAxMi40LDEyLjQgaCA1MC44IGMgNi45LDAgMTIuNCwtNS42IDEyLjQsLTEyLjQgViA0OS4yIEMgODcuOSw0Mi4zIDgyLjMsMzYuOCA3NS40LDM2LjggWiBtIDYuMiw0OC4zIGMgMCwzLjQgLTIuOCw2LjIgLTYuMiw2LjIgSCAyNC42IGMgLTMuNCwwIC02LjIsLTIuOCAtNi4yLC02LjIgViA0OS4yIGMgMCwtMy40IDIuOCwtNi4yIDYuMiwtNi4yIGggNTAuOCBjIDMuNCwwIDYuMiwyLjggNi4yLDYuMiB6IgogICAgICAgaWQ9InBhdGgxMiIKICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxIiAvPjxwYXRoCiAgICAgICBkPSJtIDU5LjgsNTcuNiAtMTIuNSwxMi41IC03LC03IGMgLTEuMiwtMS4yIC0zLjIsLTEuMiAtNC40LDAgLTEuMiwxLjIgLTEuMiwzLjIgMCw0LjQgbCA5LjIsOS4yIGMgMC42LDAuNiAxLjQsMC45IDIuMiwwLjkgMC44LDAgMS42LC0wLjMgMi4yLC0wLjkgTCA2NC4yLDYyIGMgMS4yLC0xLjIgMS4yLC0zLjIgMCwtNC40IC0xLjIsLTEuMiAtMy4yLC0xLjIgLTQuNCwwIHoiCiAgICAgICBpZD0icGF0aDE0IgogICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgIHN0eWxlPSJmaWxsOiNmZmZmZmY7ZmlsbC1vcGFjaXR5OjEiIC8+PC9nPjwvc3ZnPg==", ti = Te.div`
3882
+ display: inline-block;
3883
+ transition: transform 150ms;
3884
+ user-select: none;
3885
+ padding: 2px;
3886
+ box-sizing: border-box;
3887
+ transform: rotate(${({ rotation: e }) => e}deg);
3888
+
3889
+ & .corner {
3890
+ position: absolute;
3891
+ width: 0px;
3892
+ height: 0px;
3893
+ }
3894
+
3895
+ & .top-left {
3896
+ top: 0;
3897
+ left: 0;
3898
+ }
3899
+ & .top-right {
3900
+ top: 0;
3901
+ right: 0;
3902
+ }
3903
+ & .bottom-left {
3904
+ bottom: 0;
3905
+ left: 0;
3906
+ }
3907
+ & .bottom-right {
3908
+ bottom: 0;
3909
+ right: 0;
3910
+ }
3911
+
3912
+ & .center {
3913
+ position: absolute;
3914
+ width: 0px;
3915
+ height: 0px;
3916
+ top: 50%;
3917
+ left: 50%;
3918
+ }
3919
+
3920
+ &.selected {
3921
+ border: 2px dashed #db5034;
3922
+ padding: 0px;
3923
+ cursor: pointer;
3924
+ }
3925
+
3926
+ &.locked::after {
3927
+ content: "";
3928
+ position: absolute;
3929
+ width: 24px;
3930
+ height: 30px;
3931
+ top: 4px;
3932
+ right: 4px;
3933
+ opacity: 0.1;
3934
+ background-image: url("${ei}");
3935
+ background-size: cover;
3936
+ user-select: none;
3937
+ }
3938
+
3939
+ &.locked:hover::after {
3940
+ opacity: 0.3;
3941
+ }
3942
+
3943
+ & .resize {
3944
+ position: absolute;
3945
+
3946
+ width: 10px;
3947
+ height: 10px;
3948
+ border: 2px solid #db5034;
3949
+ background-color: #db5034;
3950
+ cursor: move;
3951
+
3952
+ &.resize-width {
3953
+ cursor: ew-resize;
3954
+ right: -6px;
3955
+ top: calc(50% - 5px);
3956
+ }
3957
+ &.resize-height {
3958
+ cursor: ns-resize;
3959
+ bottom: -6px;
3960
+ left: calc(50% - 5px);
3961
+ }
3962
+ &.resize-ratio {
3963
+ cursor: nwse-resize;
3964
+ bottom: -6px;
3965
+ right: -6px;
3966
+ }
3967
+ }
3968
+ `, ri = (e) => e, ni = ({ onReload: e }) => /* @__PURE__ */ ve(
3969
+ "div",
3970
+ {
3971
+ style: {
3972
+ width: "100px",
3973
+ display: "flex",
3974
+ flexDirection: "column",
3975
+ justifyContent: "center",
3976
+ textAlign: "center",
3977
+ color: "red"
3978
+ },
3979
+ className: "syncboard-error-item",
3980
+ children: [
3981
+ "Sorry, this item seems broken.",
3982
+ /* @__PURE__ */ k("button", { onClick: e, children: "Reload it" })
3983
+ ]
3984
+ }
3985
+ );
3986
+ class si extends g.Component {
3987
+ constructor(t) {
3988
+ super(t), this.state = { hasError: !1, itemId: t.itemId }, this.onReload = this.onReload.bind(this);
3989
+ }
3990
+ static getDerivedStateFromError() {
3991
+ return { hasError: !0 };
3992
+ }
3993
+ componentDidCatch(t) {
3994
+ console.error(
3995
+ `Error for item ${this.state.itemId}`,
3996
+ t,
3997
+ this.props.state
3998
+ );
3999
+ }
4000
+ onReload() {
4001
+ this.setState({ hasError: !1 });
4002
+ }
4003
+ render() {
4004
+ const { ErrorComponent: t } = this.props;
4005
+ return this.state.hasError ? /* @__PURE__ */ k(t, { onReload: this.onReload }) : this.props.children;
4006
+ }
4007
+ }
4008
+ const oi = (e) => {
4009
+ e.target.className = "";
4010
+ }, ii = ({
4011
+ width: e,
4012
+ height: t,
4013
+ actualWidth: r,
4014
+ actualHeight: n,
4015
+ prevState: s,
4016
+ keepRatio: o
4017
+ }) => {
4018
+ let { width: i, height: a } = s;
4019
+ if ([i, a] = [
4020
+ parseFloat(i),
4021
+ parseFloat(a)
4022
+ ], (!i || Number.isNaN(Number(i))) && (i = r), (!a || Number.isNaN(Number(a))) && (a = n), o) {
4023
+ const l = i / a;
4024
+ return {
4025
+ ...s,
4026
+ width: (i + e).toFixed(1),
4027
+ height: (a + t / l).toFixed(1)
4028
+ };
4029
+ }
4030
+ return {
4031
+ ...s,
4032
+ width: (i + e).toFixed(1),
4033
+ height: (a + t).toFixed(1)
4034
+ };
4035
+ }, ai = {
4036
+ w: !0,
4037
+ h: !0,
4038
+ b: !0
4039
+ }, ci = ({
4040
+ setState: e,
4041
+ state: { type: t, rotation: r = 0, id: n, locked: s, layer: o, ...i } = {},
4042
+ animate: a = "hvr-pop",
4043
+ isSelected: l,
4044
+ itemMap: d,
4045
+ showResizeHandle: f = !1
4046
+ }) => {
4047
+ var x;
4048
+ const u = g.useRef(null), {
4049
+ component: E = () => null,
4050
+ resizeDirections: S = ai,
4051
+ resize: b = ii
4052
+ } = d[t], p = g.useCallback(
4053
+ (m, I = !0) => e(n, m, I),
4054
+ [e, n]
4055
+ );
4056
+ g.useEffect(() => {
4057
+ u.current.className = a;
4058
+ }, [a]);
4059
+ let v = `item ${n}`;
4060
+ s && (v += " locked"), l && (v += " selected");
4061
+ const C = g.useCallback(
4062
+ ({ width: m = 0, height: I = 0, keepRatio: N }) => {
4063
+ p((A) => {
4064
+ const { offsetWidth: M, offsetHeight: L } = u.current;
4065
+ return b({
4066
+ prevState: A,
4067
+ width: m,
4068
+ height: I,
4069
+ actualHeight: L,
4070
+ actualWidth: M,
4071
+ keepRatio: N
4072
+ });
4073
+ });
4074
+ },
4075
+ [b, p]
4076
+ ), w = g.useCallback(
4077
+ ({ width: m }) => {
4078
+ C({ width: m });
4079
+ },
4080
+ [C]
4081
+ ), y = g.useCallback(
4082
+ ({ height: m }) => {
4083
+ C({ height: m });
4084
+ },
4085
+ [C]
4086
+ ), h = g.useCallback(
4087
+ ({ width: m }) => {
4088
+ C({ height: m, width: m, keepRatio: !0 });
4089
+ },
4090
+ [C]
4091
+ );
4092
+ return /* @__PURE__ */ k(
4093
+ ti,
4094
+ {
4095
+ rotation: r,
4096
+ locked: s,
4097
+ selected: l,
4098
+ layer: o,
4099
+ "data-id": n,
4100
+ className: v,
4101
+ children: /* @__PURE__ */ ve(
4102
+ "div",
4103
+ {
4104
+ style: { display: "flex" },
4105
+ ref: u,
4106
+ onAnimationEnd: oi,
4107
+ onKeyDown: (m) => m.stopPropagation(),
4108
+ onKeyUp: (m) => m.stopPropagation(),
4109
+ children: [
4110
+ /* @__PURE__ */ k(
4111
+ si,
4112
+ {
4113
+ itemId: n,
4114
+ state: i,
4115
+ setState: p,
4116
+ ErrorComponent: ((x = d == null ? void 0 : d.error) == null ? void 0 : x.component) || ni,
4117
+ children: /* @__PURE__ */ k(E, { ...i, id: n, setState: p })
4118
+ }
4119
+ ),
4120
+ /* @__PURE__ */ k("div", { className: "corner top-left" }),
4121
+ /* @__PURE__ */ k("div", { className: "corner top-right" }),
4122
+ /* @__PURE__ */ k("div", { className: "corner bottom-right" }),
4123
+ /* @__PURE__ */ k("div", { className: "corner bottom-left" }),
4124
+ /* @__PURE__ */ k("div", { className: "center" }),
4125
+ l && f && /* @__PURE__ */ ve(Hr, { children: [
4126
+ S.b && /* @__PURE__ */ k(
4127
+ Ot,
4128
+ {
4129
+ className: "resize resize-ratio",
4130
+ onResize: h
4131
+ }
4132
+ ),
4133
+ S.h && /* @__PURE__ */ k(
4134
+ Ot,
4135
+ {
4136
+ className: "resize resize-height",
4137
+ onResize: y
4138
+ }
4139
+ ),
4140
+ S.w && /* @__PURE__ */ k(
4141
+ Ot,
4142
+ {
4143
+ className: "resize resize-width",
4144
+ onResize: w
4145
+ }
4146
+ )
4147
+ ] })
4148
+ ]
4149
+ }
4150
+ )
4151
+ }
4152
+ );
4153
+ }, ui = Zr(
4154
+ ci,
4155
+ ({
4156
+ state: e,
4157
+ setState: t,
4158
+ isSelected: r,
4159
+ showResizeHandle: n
4160
+ }, {
4161
+ state: s,
4162
+ setState: o,
4163
+ isSelected: i,
4164
+ showResizeHandle: a
4165
+ }) => r === i && n === a && t === o && JSON.stringify(e) === JSON.stringify(s)
4166
+ ), li = ({ state: e = {}, boardSize: t, currentUser: r, ...n }) => {
4167
+ if (!n.itemMap[e.type])
4168
+ return null;
4169
+ const { stateHook: s = ri } = n.itemMap[e.type], {
4170
+ x: o = 0,
4171
+ y: i = 0,
4172
+ layer: a = 0,
4173
+ moving: l,
4174
+ ...d
4175
+ } = s(e, { currentUser: r });
4176
+ return /* @__PURE__ */ k(
4177
+ "div",
4178
+ {
4179
+ style: {
4180
+ position: "absolute",
4181
+ top: `${t / 2}px`,
4182
+ left: `${t / 2}px`,
4183
+ display: "inline-block",
4184
+ transform: `translate(${o}px, ${i}px)`,
4185
+ zIndex: (a + 4) * 10 + 100 + (l ? 5 : 0)
4186
+ // Items z-index between 100 and 200
4187
+ },
4188
+ children: /* @__PURE__ */ k(
4189
+ ui,
4190
+ {
4191
+ ...n,
4192
+ showResizeHandle: n.isSelected && n.showResizeHandle,
4193
+ state: d
4194
+ }
4195
+ )
4196
+ }
4197
+ );
4198
+ }, fi = Zr(li), di = () => {
4199
+ const { updateItem: e } = Wt(), [t, r] = de((l) => [
4200
+ l.itemIds,
4201
+ l.items
4202
+ ]), n = ye((l) => l.selection), [s, o, i] = Q((l) => [
4203
+ l.config.boardSize,
4204
+ l.config.showResizeHandle,
4205
+ l.config.itemTemplates
4206
+ ]), a = we((l) => l.getUser());
4207
+ return t.map((l) => /* @__PURE__ */ k(
4208
+ fi,
4209
+ {
4210
+ state: r[l],
4211
+ setState: e,
4212
+ isSelected: n.includes(l),
4213
+ itemMap: i,
4214
+ boardSize: s,
4215
+ currentUser: a,
4216
+ showResizeHandle: o
4217
+ },
4218
+ l
4219
+ ));
4220
+ }, pi = {
4221
+ zIndex: 210,
4222
+ position: "absolute",
4223
+ backgroundColor: "hsla(0, 40%, 50%, 10%)",
4224
+ border: "2px solid hsl(0, 55%, 40%)"
4225
+ }, mi = (e, t) => {
4226
+ const r = t.getElementsByClassName("selector");
4227
+ if (!r.length)
4228
+ return [];
4229
+ const n = r[0];
4230
+ return Array.from(t.getElementsByClassName("item")).filter((s) => {
4231
+ const o = $e(s), i = e[o];
4232
+ return !i || i.locked ? !1 : gs(s, n);
4233
+ }).map((s) => $e(s));
4234
+ }, gi = ({ children: e, moveFirst: t }) => {
4235
+ const [r, n, s, o] = ye(
4236
+ (m) => [
4237
+ m.getSelection,
4238
+ m.clear,
4239
+ m.setSelection,
4240
+ m.select
4241
+ ]
4242
+ ), i = Q((m) => m.getConfiguration), [a, l] = Q((m) => [
4243
+ m.getBoardState,
4244
+ m.updateBoardState
4245
+ ]), { findElementUnderPointer: d } = Wt(), f = de((m) => m.getItems), [u, E] = g.useState({}), S = g.useRef(null), b = g.useRef({
4246
+ moving: !1
4247
+ });
4248
+ g.useEffect(() => (n(), () => {
4249
+ n();
4250
+ }), [n]);
4251
+ const p = g.useCallback(() => {
4252
+ if (b.current.moving) {
4253
+ const m = f(), { boardWrapper: I } = i(), N = mi(m, I);
4254
+ s(N);
4255
+ }
4256
+ }, [i, f, s]), v = sn(
4257
+ () => {
4258
+ p();
4259
+ },
4260
+ [u, p],
4261
+ 50
4262
+ ), C = g.useCallback(
4263
+ async (m) => {
4264
+ await d(m) || (b.current.moving = !0, l({ selection: !0 }), S.current.style.cursor = "crosshair");
4265
+ },
4266
+ [d, l]
4267
+ ), w = g.useCallback(
4268
+ ({ distanceY: m, distanceX: I, startX: N, startY: A }) => {
4269
+ if (b.current.moving) {
4270
+ const { top: M, left: L } = S.current.getBoundingClientRect(), { scale: B } = a(), Z = (N - L) / B, H = (A - M) / B, O = I / B, P = m / B;
4271
+ O > 0 ? (b.current.left = Z, b.current.width = O) : (b.current.left = Z + O, b.current.width = -O), P > 0 ? (b.current.top = H, b.current.height = P) : (b.current.top = H + P, b.current.height = -P), E({ ...b.current, moving: !0 }), v();
4272
+ }
4273
+ },
4274
+ [a, v]
4275
+ ), y = g.useCallback(() => {
4276
+ b.current.moving && (l({ selecting: !1 }), b.current.moving = !1, E({ moving: !1 }), S.current.style.cursor = "auto");
4277
+ }, [l]), h = g.useCallback(
4278
+ ({ target: m }) => {
4279
+ const I = We(m, "item");
4280
+ if (I) {
4281
+ const N = $e(I);
4282
+ s([N]);
4283
+ }
4284
+ },
4285
+ [s]
4286
+ ), x = g.useCallback(
4287
+ async (m) => {
4288
+ const { target: I, ctrlKey: N, metaKey: A } = m, M = await d(m);
4289
+ if (!M && We(I, "board"))
4290
+ n();
4291
+ else {
4292
+ const L = $e(M);
4293
+ if (!L) {
4294
+ n();
4295
+ return;
4296
+ }
4297
+ const B = r();
4298
+ M && !B.includes(L) && (N || A ? o([L]) : s([L]));
4299
+ }
4300
+ },
4301
+ [
4302
+ n,
4303
+ d,
4304
+ r,
4305
+ o,
4306
+ s
4307
+ ]
4308
+ );
4309
+ return /* @__PURE__ */ k(
4310
+ gt,
4311
+ {
4312
+ onDragStart: C,
4313
+ onDrag: w,
4314
+ onDragEnd: y,
4315
+ onTap: x,
4316
+ onLongTap: h,
4317
+ mainAction: t ? "pan" : "drag",
4318
+ children: /* @__PURE__ */ ve("div", { ref: S, children: [
4319
+ u.moving && /* @__PURE__ */ k(
4320
+ "div",
4321
+ {
4322
+ style: {
4323
+ ...pi,
4324
+ transform: `translate(${u.left}px, ${u.top}px)`,
4325
+ height: `${u.height}px`,
4326
+ width: `${u.width}px`
4327
+ },
4328
+ className: "selector"
4329
+ }
4330
+ ),
4331
+ e
4332
+ ] })
4333
+ }
4334
+ );
4335
+ }, hi = ({ children: e }) => {
4336
+ const { moveItems: t, placeItems: r, findElementUnderPointer: n } = Wt(), [s, o, i] = ye((v) => [
4337
+ v.select,
4338
+ v.setSelection,
4339
+ v.getSelection
4340
+ ]), [a, l] = Q((v) => [
4341
+ v.getBoardState,
4342
+ v.updateBoardState
4343
+ ]), d = de((v) => v.getBoardConfig), f = g.useRef({}), u = g.useRef({
4344
+ items: []
4345
+ }), E = g.useCallback(
4346
+ async (v) => {
4347
+ const { ctrlKey: C, metaKey: w, event: y } = v, h = await n(v);
4348
+ if (h) {
4349
+ y.stopPropagation();
4350
+ const x = i();
4351
+ u.current.items = x;
4352
+ const m = $e(h);
4353
+ x.includes(m) || (C || w ? (u.current.items = [...x, m], s([m])) : (u.current.items = [m], o([m]))), Object.assign(f.current, {
4354
+ moving: !0,
4355
+ remainX: 0,
4356
+ remainY: 0
4357
+ });
4358
+ }
4359
+ },
4360
+ [n, i, s, o]
4361
+ ), S = g.useCallback(
4362
+ ({ deltaX: v, deltaY: C, event: w }) => {
4363
+ if (f.current.moving) {
4364
+ w.stopPropagation();
4365
+ const { scale: y } = a(), h = f.current.remainX + v / y, x = f.current.remainY + C / y;
4366
+ t(
4367
+ u.current.items,
4368
+ {
4369
+ x: h,
4370
+ y: x
4371
+ },
4372
+ !0
4373
+ ), l({ movingItems: !0 });
4374
+ }
4375
+ },
4376
+ [a, t, l]
4377
+ ), b = g.useCallback(() => {
4378
+ if (f.current.moving) {
4379
+ const { gridSize: v = 1 } = d(), C = v || 1;
4380
+ f.current = { moving: !1 }, r(u.current.items, {
4381
+ type: "grid",
4382
+ size: C
4383
+ }), l({ movingItems: !1 });
4384
+ }
4385
+ }, [d, r, l]), p = g.useCallback(
4386
+ (v) => {
4387
+ if (["INPUT", "TEXTAREA"].includes(v.target.tagName))
4388
+ return;
4389
+ const C = i();
4390
+ if (C.length) {
4391
+ const { gridSize: w = 1 } = d();
4392
+ let y = 0, h = 0;
4393
+ switch (v.key) {
4394
+ case "ArrowLeft":
4395
+ y = -10;
4396
+ break;
4397
+ case "ArrowRight":
4398
+ y = 10;
4399
+ break;
4400
+ case "ArrowUp":
4401
+ h = -10;
4402
+ break;
4403
+ case "ArrowDown":
4404
+ h = 10;
4405
+ break;
4406
+ }
4407
+ (y || h) && (v.shiftKey && (y *= 5, h *= 5), (v.ctrlKey || v.altKey || v.metaKey) && (y /= 10, h /= 10), t(
4408
+ C,
4409
+ {
4410
+ x: y,
4411
+ y: h
4412
+ },
4413
+ !0
4414
+ ), r(C, {
4415
+ type: "grid",
4416
+ size: w || 1
4417
+ }), v.preventDefault());
4418
+ }
4419
+ },
4420
+ [d, i, t, r]
4421
+ );
4422
+ return g.useEffect(() => (document.addEventListener("keydown", p), () => {
4423
+ document.removeEventListener("keydown", p);
4424
+ }), [p]), /* @__PURE__ */ k(gt, { onDragStart: E, onDrag: S, onDragEnd: b, children: e });
4425
+ };
4426
+ function Ur(e, t, r) {
4427
+ return Math.min(Math.max(e, r), t);
4428
+ }
4429
+ class vi extends Error {
4430
+ constructor(t) {
4431
+ super(`Failed to parse color: "${t}"`);
4432
+ }
4433
+ }
4434
+ var Ye = vi;
4435
+ function yi(e) {
4436
+ if (typeof e != "string")
4437
+ throw new Ye(e);
4438
+ if (e.trim().toLowerCase() === "transparent")
4439
+ return [0, 0, 0, 0];
4440
+ let t = e.trim();
4441
+ t = xi.test(e) ? Ci(e) : e;
4442
+ const r = Ei.exec(t);
4443
+ if (r) {
4444
+ const i = Array.from(r).slice(1);
4445
+ return [...i.slice(0, 3).map((a) => parseInt(Ge(a, 2), 16)), parseInt(Ge(i[3] || "f", 2), 16) / 255];
4446
+ }
4447
+ const n = wi.exec(t);
4448
+ if (n) {
4449
+ const i = Array.from(n).slice(1);
4450
+ return [...i.slice(0, 3).map((a) => parseInt(a, 16)), parseInt(i[3] || "ff", 16) / 255];
4451
+ }
4452
+ const s = Ii.exec(t);
4453
+ if (s) {
4454
+ const i = Array.from(s).slice(1);
4455
+ return [...i.slice(0, 3).map((a) => parseInt(a, 10)), parseFloat(i[3] || "1")];
4456
+ }
4457
+ const o = _i.exec(t);
4458
+ if (o) {
4459
+ const [i, a, l, d] = Array.from(o).slice(1).map(parseFloat);
4460
+ if (Ur(0, 100, a) !== a)
4461
+ throw new Ye(e);
4462
+ if (Ur(0, 100, l) !== l)
4463
+ throw new Ye(e);
4464
+ return [...Ri(i, a, l), Number.isNaN(d) ? 1 : d];
4465
+ }
4466
+ throw new Ye(e);
4467
+ }
4468
+ function bi(e) {
4469
+ let t = 5381, r = e.length;
4470
+ for (; r; )
4471
+ t = t * 33 ^ e.charCodeAt(--r);
4472
+ return (t >>> 0) % 2341;
4473
+ }
4474
+ const Xr = (e) => parseInt(e.replace(/_/g, ""), 36), Si = "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) => {
4475
+ const r = Xr(t.substring(0, 3)), n = Xr(t.substring(3)).toString(16);
4476
+ let s = "";
4477
+ for (let o = 0; o < 6 - n.length; o++)
4478
+ s += "0";
4479
+ return e[r] = `${s}${n}`, e;
4480
+ }, {});
4481
+ function Ci(e) {
4482
+ const t = e.toLowerCase().trim(), r = Si[bi(t)];
4483
+ if (!r)
4484
+ throw new Ye(e);
4485
+ return `#${r}`;
4486
+ }
4487
+ const Ge = (e, t) => Array.from(Array(t)).map(() => e).join(""), Ei = new RegExp(`^#${Ge("([a-f0-9])", 3)}([a-f0-9])?$`, "i"), wi = new RegExp(`^#${Ge("([a-f0-9]{2})", 3)}([a-f0-9]{2})?$`, "i"), Ii = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Ge(",\\s*(\\d+)\\s*", 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, "i"), _i = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i, xi = /^[a-z]+$/i, Vr = (e) => Math.round(e * 255), Ri = (e, t, r) => {
4488
+ let n = r / 100;
4489
+ if (t === 0)
4490
+ return [n, n, n].map(Vr);
4491
+ const s = (e % 360 + 360) % 360 / 60, o = (1 - Math.abs(2 * n - 1)) * (t / 100), i = o * (1 - Math.abs(s % 2 - 1));
4492
+ let a = 0, l = 0, d = 0;
4493
+ s >= 0 && s < 1 ? (a = o, l = i) : s >= 1 && s < 2 ? (a = i, l = o) : s >= 2 && s < 3 ? (l = o, d = i) : s >= 3 && s < 4 ? (l = i, d = o) : s >= 4 && s < 5 ? (a = i, d = o) : s >= 5 && s < 6 && (a = o, d = i);
4494
+ const f = n - o / 2, u = a + f, E = l + f, S = d + f;
4495
+ return [u, E, S].map(Vr);
4496
+ };
4497
+ function Oi(e) {
4498
+ if (e === "transparent")
4499
+ return 0;
4500
+ function t(o) {
4501
+ const i = o / 255;
4502
+ return i <= 0.03928 ? i / 12.92 : Math.pow((i + 0.055) / 1.055, 2.4);
4503
+ }
4504
+ const [r, n, s] = yi(e);
4505
+ return 0.2126 * t(r) + 0.7152 * t(n) + 0.0722 * t(s);
4506
+ }
4507
+ function ki(e) {
4508
+ return Oi(e) > 0.179;
4509
+ }
4510
+ const Ai = Te.div`
4511
+ display: flex;
4512
+ flex-direction: row;
4513
+ align-items: center;
4514
+ z-index: 210;
4515
+ pointer-events: none;
4516
+ `, Mi = Te.div`
4517
+ color: ${({ textColor: e }) => e};
4518
+ font-weight: bold;
4519
+ padding: 0 0.5em;
4520
+ border-radius: 2px;
4521
+ max-width: 5em;
4522
+ overflow: hidden;
4523
+ text-overflow: ellipsis;
4524
+ margin-left: -0.5em;
4525
+ margin-top: 1.7em;
4526
+ whitespace: nowrap;
4527
+ pointer-events: none;
4528
+ background-color: ${({ color: e }) => e};
4529
+ `, Ni = ({ color: e = "#666", size: t = 40, text: r }) => {
4530
+ const n = ki(e) ? "#222" : "#EEE";
4531
+ return /* @__PURE__ */ ve(Ai, { children: [
4532
+ /* @__PURE__ */ ve(
4533
+ "svg",
4534
+ {
4535
+ version: "1.1",
4536
+ id: "Layer_1",
4537
+ xmlns: "http://www.w3.org/2000/svg",
4538
+ viewBox: "1064.7701 445.5539 419.8101 717.0565",
4539
+ width: t,
4540
+ height: t,
4541
+ children: [
4542
+ /* @__PURE__ */ k(
4543
+ "path",
4544
+ {
4545
+ 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",
4546
+ style: {
4547
+ fill: n
4548
+ }
4549
+ }
4550
+ ),
4551
+ /* @__PURE__ */ k(
4552
+ "path",
4553
+ {
4554
+ 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",
4555
+ style: {
4556
+ fill: "white",
4557
+ stroke: "#111",
4558
+ strokeWidth: 20
4559
+ }
4560
+ }
4561
+ )
4562
+ ]
4563
+ }
4564
+ ),
4565
+ /* @__PURE__ */ k(Mi, { color: e, textColor: n, children: r })
4566
+ ] });
4567
+ }, Ti = g.memo(Ni), Li = ({ pos: e, ...t }) => /* @__PURE__ */ k(
4568
+ "div",
4569
+ {
4570
+ style: {
4571
+ transform: `translate(${e.x - 5}px, ${e.y - 3}px)`,
4572
+ top: 0,
4573
+ left: 0,
4574
+ zIndex: 210,
4575
+ position: "fixed",
4576
+ pointerEvents: "none"
4577
+ },
4578
+ children: /* @__PURE__ */ k(Ti, { ...t })
4579
+ }
4580
+ ), Pi = () => {
4581
+ const [e, t, r, n] = we(
4582
+ (o) => [
4583
+ o.getUser(),
4584
+ o.getLocalUsers(),
4585
+ o.cursors,
4586
+ o.users
4587
+ ]
4588
+ ), s = t.reduce((o, i) => (i.id !== e.id && r[i.id] && (o[i.id] = r[i.id]), o), {});
4589
+ return /* @__PURE__ */ k("div", { children: Object.entries(s).map(([o, i]) => /* @__PURE__ */ k(
4590
+ Li,
4591
+ {
4592
+ pos: i,
4593
+ text: n[o].name,
4594
+ color: n[o].color
4595
+ },
4596
+ o
4597
+ )) });
4598
+ }, ji = ({ children: e }) => {
4599
+ const t = we((l) => l.getUser()), [r, n] = we((l) => [
4600
+ l.moveCursor,
4601
+ l.removeCursor
4602
+ ]), [s, o] = Q((l) => [
4603
+ l.getConfiguration,
4604
+ l.getBoardState
4605
+ ]), i = g.useCallback(
4606
+ ({ clientX: l, clientY: d }) => {
4607
+ const { scale: f, translateX: u, translateY: E } = o(), {
4608
+ boardWrapperRect: { left: S, top: b }
4609
+ } = s(), p = {
4610
+ x: (l - S - u) / f,
4611
+ y: (d - b - E) / f
4612
+ };
4613
+ r(t.id, p);
4614
+ },
4615
+ [o, s, r, t.id]
4616
+ );
4617
+ return /* @__PURE__ */ ve("div", { onPointerMove: i, onPointerLeave: () => {
4618
+ n(t.id);
4619
+ }, children: [
4620
+ e,
4621
+ /* @__PURE__ */ k(Pi, {})
4622
+ ] });
4623
+ }, Di = (e) => {
4624
+ const t = g.useRef({ hover: !1, x: 0, y: 0 }), r = g.useCallback((i) => {
4625
+ const { clientX: a, clientY: l } = i;
4626
+ t.current.x = a, t.current.y = l;
4627
+ }, []), n = g.useCallback(() => {
4628
+ t.current.hover = !0;
4629
+ }, []), s = g.useCallback(() => {
4630
+ t.current.hover = !1;
4631
+ }, []);
4632
+ return g.useEffect(() => {
4633
+ const { current: i } = e;
4634
+ return i ? (i.addEventListener("mousemove", r), i.addEventListener("mouseenter", n), i.addEventListener("mouseleave", s), () => {
4635
+ i.removeEventListener("mousemove", r), i.removeEventListener("mouseenter", n), i.addEventListener("mouseleave", s);
4636
+ }) : null;
4637
+ }, [e, e.current, r, n, s]), g.useCallback(() => t.current, []);
4638
+ }, zi = [...Array(5).keys()].map((e) => `Digit${e + 1}`), Yi = () => {
4639
+ const [e, t] = g.useState({}), [r, n] = Q((o) => [
4640
+ o.getBoardState,
4641
+ o.updateBoardState
4642
+ ]), s = g.useCallback(
4643
+ (o) => {
4644
+ if (!["INPUT", "TEXTAREA"].includes(o.target.tagName) && zi.includes(o.code)) {
4645
+ const i = o.code, { translateX: a, translateY: l, scale: d } = r();
4646
+ o.altKey || o.metaKey || o.ctrlKey ? t((f) => ({
4647
+ ...f,
4648
+ [i]: { translateX: a, translateY: l, scale: d }
4649
+ })) : e[i] && n(e[i]), o.preventDefault();
4650
+ }
4651
+ },
4652
+ [r, e, n]
4653
+ );
4654
+ return g.useEffect(() => (document.addEventListener("keydown", s), () => {
4655
+ document.removeEventListener("keydown", s);
4656
+ }), [s]), null;
4657
+ }, Bi = ({ children: e, moveFirst: t = !1 }) => {
4658
+ const r = g.useRef(null), [n, s, o, i] = Q((h) => [
4659
+ {
4660
+ translateX: h.boardState.translateX,
4661
+ translateY: h.boardState.translateY,
4662
+ scale: h.boardState.scale
4663
+ },
4664
+ h.config.itemExtent,
4665
+ h.getConfiguration,
4666
+ h.updateBoardState
4667
+ ]), { setDim: a, zoomToCenter: l, zoomToExtent: d } = Bt(), [f, u] = g.useState(!1), E = g.useRef({}), S = ye((h) => h.getSelection), b = Di(r);
4668
+ Yi();
4669
+ const p = g.useCallback(() => {
4670
+ const { itemExtent: h } = o();
4671
+ d(h);
4672
+ }, [o, d]);
4673
+ g.useEffect(() => {
4674
+ !f && s.left && (p(), u(!0));
4675
+ }, [p, f, s]);
4676
+ const v = g.useCallback(
4677
+ ({ clientX: h, clientY: x, scale: m }) => {
4678
+ l(1 - m / 500, { x: h, y: x }), clearTimeout(E.current.zoom), E.current.zoom = setTimeout(() => {
4679
+ i({ zooming: !1 });
4680
+ }, 200), i({ zooming: !0 });
4681
+ },
4682
+ [i, l]
4683
+ ), C = g.useCallback(
4684
+ async ({ deltaX: h, deltaY: x }) => {
4685
+ a((m) => ({
4686
+ ...m,
4687
+ translateX: m.translateX + h,
4688
+ translateY: m.translateY + x
4689
+ })), clearTimeout(E.current.pan), E.current.pan = setTimeout(() => {
4690
+ i({ panning: !1 });
4691
+ }, 200), i({ panning: !0 });
4692
+ },
4693
+ [a, i]
4694
+ ), w = g.useCallback(
4695
+ (h) => {
4696
+ if (["INPUT", "TEXTAREA"].includes(h.target.tagName))
4697
+ return;
4698
+ let x = 0, m = 0, I = 1;
4699
+ switch (h.key) {
4700
+ case "ArrowLeft":
4701
+ x = -10;
4702
+ break;
4703
+ case "ArrowRight":
4704
+ x = 10;
4705
+ break;
4706
+ case "ArrowUp":
4707
+ m = -10;
4708
+ break;
4709
+ case "ArrowDown":
4710
+ m = 10;
4711
+ break;
4712
+ case "PageUp":
4713
+ I = 1.2;
4714
+ break;
4715
+ case "PageDown":
4716
+ I = 0.8;
4717
+ break;
4718
+ }
4719
+ if (x || m || I !== 1) {
4720
+ const N = S();
4721
+ if (I === 1 && N.length)
4722
+ return;
4723
+ h.shiftKey && (x *= 5, m *= 5), (h.ctrlKey || h.altKey || h.metaKey) && (x /= 5, m /= 5), a((A) => ({
4724
+ ...A,
4725
+ translateY: A.translateY + m,
4726
+ translateX: A.translateX + x
4727
+ })), l(I), h.preventDefault();
4728
+ }
4729
+ h.key === " " && !h.repeat && b().hover && l(3, b());
4730
+ },
4731
+ [S, a, l, b]
4732
+ ), y = g.useCallback(
4733
+ (h) => {
4734
+ ["INPUT", "TEXTAREA"].includes(h.target.tagName) || h.key === " " && b().hover && l(1 / 3, b());
4735
+ },
4736
+ [b, l]
4737
+ );
4738
+ return g.useEffect(() => (document.addEventListener("keydown", w), document.addEventListener("keyup", y), () => {
4739
+ document.removeEventListener("keydown", w), document.removeEventListener("keyup", y);
4740
+ }), [w, y]), /* @__PURE__ */ k(
4741
+ gt,
4742
+ {
4743
+ onPan: C,
4744
+ onZoom: v,
4745
+ mainAction: t ? "pan" : "drag",
4746
+ children: /* @__PURE__ */ k(
4747
+ "div",
4748
+ {
4749
+ style: {
4750
+ display: "inline-block",
4751
+ transformOrigin: "top left",
4752
+ transform: `translate(${n.translateX}px, ${n.translateY}px) scale(${n.scale})`
4753
+ },
4754
+ className: `board-pane${n.scale < 0.5 ? " board-pane__far" : ""}`,
4755
+ ref: r,
4756
+ children: e
4757
+ }
4758
+ )
4759
+ }
4760
+ );
4761
+ }, Wi = {
4762
+ position: "absolute",
4763
+ top: 0,
4764
+ left: 0,
4765
+ zIndex: 210,
4766
+ backgroundColor: "hsla(0, 40%, 50%, 0%)",
4767
+ border: "2px dashed hsl(20, 55%, 40%)",
4768
+ pointerEvents: "none"
4769
+ }, $i = () => {
4770
+ const [e, t, r, n] = ye(
4771
+ (u) => [
4772
+ u.selection,
4773
+ u.getSelection,
4774
+ u.selectionBox,
4775
+ u.setSelectionBox
4776
+ ]
4777
+ ), s = Q((u) => u.getConfiguration), { translateX: o, translateY: i, scale: a } = Q((u) => ({
4778
+ translateX: u.boardState.translateX,
4779
+ translateY: u.boardState.translateY,
4780
+ scale: u.boardState.scale
4781
+ })), l = de((u) => u.items), d = g.useCallback(() => {
4782
+ const u = t(), { boardWrapperRect: E, boardWrapper: S } = s();
4783
+ if (u.length === 0) {
4784
+ n(null);
4785
+ return;
4786
+ }
4787
+ const b = en(u, S);
4788
+ if (!b) {
4789
+ n(null);
4790
+ return;
4791
+ }
4792
+ const { left: p, top: v, width: C, height: w } = b, y = {
4793
+ left: p - E.left,
4794
+ top: v - E.top,
4795
+ height: w,
4796
+ width: C
4797
+ };
4798
+ n(y);
4799
+ }, [s, t, n]), f = Yt(d, [d], 300);
4800
+ return g.useEffect(() => {
4801
+ d(), f();
4802
+ }, [
4803
+ e,
4804
+ l,
4805
+ o,
4806
+ i,
4807
+ a,
4808
+ d,
4809
+ f
4810
+ ]), !r || e.length < 2 ? null : /* @__PURE__ */ k(
4811
+ "div",
4812
+ {
4813
+ style: {
4814
+ ...Wi,
4815
+ transform: `translate(${r.left}px, ${r.top}px)`,
4816
+ height: `${r.height}px`,
4817
+ width: `${r.width}px`
4818
+ },
4819
+ className: "selection"
4820
+ }
4821
+ );
4822
+ }, Ui = () => Q((t) => t.boardState.movingItems) ? null : /* @__PURE__ */ k($i, {}), sa = ({
4823
+ moveFirst: e = !0,
4824
+ style: t,
4825
+ itemTemplates: r = {},
4826
+ boardSize: n = on,
4827
+ children: s,
4828
+ showResizeHandle: o = !1
4829
+ }) => {
4830
+ const i = Q(
4831
+ (d) => d.updateConfiguration
4832
+ ), { updateItemExtent: a } = Bt(), l = g.useMemo(
4833
+ () => ({
4834
+ userSelect: "none",
4835
+ width: `${n}px`,
4836
+ height: `${n}px`,
4837
+ backgroundColor: "#333",
4838
+ ...t
4839
+ }),
4840
+ [n, t]
4841
+ );
4842
+ return g.useEffect(() => {
4843
+ i({
4844
+ itemTemplates: r,
4845
+ boardSize: n,
4846
+ showResizeHandle: o
4847
+ });
4848
+ }, [r, n, o, i]), g.useEffect(() => {
4849
+ a(), setTimeout(a, 2e3);
4850
+ }, [a]), /* @__PURE__ */ ve(Hr, { children: [
4851
+ /* @__PURE__ */ k(Bi, { moveFirst: e, children: /* @__PURE__ */ k(gi, { moveFirst: e, children: /* @__PURE__ */ k(hi, { moveFirst: e, children: /* @__PURE__ */ k(ji, { children: /* @__PURE__ */ ve(
4852
+ "div",
4853
+ {
4854
+ onContextMenu: (d) => {
4855
+ d.preventDefault();
4856
+ },
4857
+ style: l,
4858
+ className: "board",
4859
+ children: [
4860
+ /* @__PURE__ */ k(di, {}),
4861
+ s
4862
+ ]
4863
+ }
4864
+ ) }) }) }) }),
4865
+ /* @__PURE__ */ k(Ui, {})
4866
+ ] });
4867
+ };
4868
+ export {
4869
+ sa as Board,
4870
+ ra as BoardWrapper,
4871
+ na as RoomWrapper,
4872
+ Hi as useAvailableActions,
4873
+ Ji as useBoardConfig,
4874
+ Bt as useBoardPosition,
4875
+ Qi as useBoardState,
4876
+ Fi as useDebouncedItems,
4877
+ Wt as useItemActions,
4878
+ Ls as useItemInteraction,
4879
+ Gi as useItems,
4880
+ ta as useMessage,
4881
+ Zi as useSelectedItems,
4882
+ Ki as useSelectionBox,
4883
+ ea as useSessionInfo,
4884
+ qi as useUsers,
4885
+ ut as useWire
4886
+ };
4887
+ //# sourceMappingURL=react-sync-board.js.map