react-sync-board 1.2.2 → 1.2.4

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