@reffy/infinite-canvas 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@ var Zo = (t) => {
2
2
  throw TypeError(t);
3
3
  };
4
4
  var Fo = (t, e, r) => e.has(t) || Zo("Cannot " + r);
5
- var v = (t, e, r) => (Fo(t, e, "read from private field"), r ? r.call(t) : e.get(t)), V = (t, e, r) => e.has(t) ? Zo("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), Z = (t, e, r, i) => (Fo(t, e, "write to private field"), i ? i.call(t, r) : e.set(t, r), r);
6
- import { makeObservable as Oa, computed as ot, action as A, observable as ee, reaction as Xh } from "mobx";
5
+ var v = (t, e, r) => (Fo(t, e, "read from private field"), r ? r.call(t) : e.get(t)), V = (t, e, r) => e.has(t) ? Zo("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), B = (t, e, r, i) => (Fo(t, e, "write to private field"), i ? i.call(t, r) : e.set(t, r), r);
6
+ import { makeObservable as Oa, computed as at, action as M, observable as ee, reaction as Xh } from "mobx";
7
7
  import { css as Jh, LitElement as Vh } from "lit";
8
8
  import Oe from "dexie";
9
9
  import { v4 as Yh } from "uuid";
@@ -17,7 +17,7 @@ const Nt = ["TOP", "BOTTOM", "LEFT", "RIGHT"], yn = ["TOPLEFT", "TOPRIGHT", "BOT
17
17
  function Wo(t) {
18
18
  return Bo[t] ? Bo[t] : t;
19
19
  }
20
- const Ea = 8, Yr = 2, L = {
20
+ const Ea = 8, Yr = 2, F = {
21
21
  identity: function() {
22
22
  return [1, 0, 0, 0, 1, 0, 0, 0, 1];
23
23
  },
@@ -32,7 +32,7 @@ const Ea = 8, Yr = 2, L = {
32
32
  return [t, 0, 0, 0, e, 0, 0, 0, 1];
33
33
  },
34
34
  multiply: function(t, e) {
35
- var r = t[0], i = t[1], n = t[2], o = t[3], a = t[4], s = t[5], u = t[6], c = t[7], l = t[8], d = e[0], m = e[1], f = e[2], $ = e[3], w = e[4], P = e[5], R = e[6], C = e[7], E = e[8];
35
+ var r = t[0], i = t[1], n = t[2], o = t[3], a = t[4], s = t[5], u = t[6], c = t[7], l = t[8], d = e[0], m = e[1], f = e[2], $ = e[3], w = e[4], P = e[5], L = e[6], A = e[7], E = e[8];
36
36
  return [
37
37
  d * r + m * o + f * u,
38
38
  d * i + m * a + f * c,
@@ -40,9 +40,9 @@ const Ea = 8, Yr = 2, L = {
40
40
  $ * r + w * o + P * u,
41
41
  $ * i + w * a + P * c,
42
42
  $ * n + w * s + P * l,
43
- R * r + C * o + E * u,
44
- R * i + C * a + E * c,
45
- R * n + C * s + E * l
43
+ L * r + A * o + E * u,
44
+ L * i + A * a + E * c,
45
+ L * n + A * s + E * l
46
46
  ];
47
47
  },
48
48
  inverse(t) {
@@ -76,10 +76,10 @@ function Go(t, e, r) {
76
76
  throw t.deleteShader(i), new Error("Shader was not created.");
77
77
  }
78
78
  function Kh(t, e, r, i, n, o) {
79
- const a = n.getBoundingClientRect(), s = window.devicePixelRatio || 1, u = (t - a.left) * s, c = (e - a.top) * s, l = u / r * 2 - 1, d = c / i * -2 + 1, m = L.projection(r, i), f = L.multiply(m, o), $ = L.inverse(f), [w, P] = L.transformPoint($, [l, d]);
79
+ const a = n.getBoundingClientRect(), s = window.devicePixelRatio || 1, u = (t - a.left) * s, c = (e - a.top) * s, l = u / r * 2 - 1, d = c / i * -2 + 1, m = F.projection(r, i), f = F.multiply(m, o), $ = F.inverse(f), [w, P] = F.transformPoint($, [l, d]);
80
80
  return [w, P];
81
81
  }
82
- function Fe(t, e, r) {
82
+ function We(t, e, r) {
83
83
  const { gl: i, canvas: n } = r;
84
84
  return Kh(
85
85
  t,
@@ -103,7 +103,7 @@ function qh(t) {
103
103
  function Qh(t) {
104
104
  return Math.hypot(t[3], t[4]);
105
105
  }
106
- function Je(t) {
106
+ function Ye(t) {
107
107
  return [qh(t), Qh(t)];
108
108
  }
109
109
  function Xo(t) {
@@ -179,7 +179,7 @@ function Ta(t, e = 1) {
179
179
  }, n.onerror = i, n.src = t;
180
180
  });
181
181
  }
182
- const at = [0.33, 0.6, 0.95, 1], hn = [
182
+ const st = [0.33, 0.6, 0.95, 1], hn = [
183
183
  0.33,
184
184
  0.6,
185
185
  0.95,
@@ -280,7 +280,7 @@ function h(t, e, r) {
280
280
  }), Object.defineProperty(a, "name", { value: t }), a;
281
281
  }
282
282
  const Ua = Symbol("zod_brand");
283
- class Ve extends Error {
283
+ class He extends Error {
284
284
  constructor() {
285
285
  super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
286
286
  }
@@ -327,7 +327,7 @@ function Zt(t) {
327
327
  }
328
328
  };
329
329
  }
330
- function Qe(t) {
330
+ function tt(t) {
331
331
  return t == null;
332
332
  }
333
333
  function Zn(t) {
@@ -364,7 +364,7 @@ function O(t, e, r) {
364
364
  function mm(t) {
365
365
  return Object.create(Object.getPrototypeOf(t), Object.getOwnPropertyDescriptors(t));
366
366
  }
367
- function Le(t, e, r) {
367
+ function Ze(t, e, r) {
368
368
  Object.defineProperty(t, e, {
369
369
  value: r,
370
370
  writable: !0,
@@ -410,7 +410,7 @@ function Ca(t) {
410
410
  }
411
411
  const qr = "captureStackTrace" in Error ? Error.captureStackTrace : (...t) => {
412
412
  };
413
- function lt(t) {
413
+ function dt(t) {
414
414
  return typeof t == "object" && t !== null && !Array.isArray(t);
415
415
  }
416
416
  const Da = Zt(() => {
@@ -423,17 +423,17 @@ const Da = Zt(() => {
423
423
  return !1;
424
424
  }
425
425
  });
426
- function Ye(t) {
427
- if (lt(t) === !1)
426
+ function Ke(t) {
427
+ if (dt(t) === !1)
428
428
  return !1;
429
429
  const e = t.constructor;
430
430
  if (e === void 0 || typeof e != "function")
431
431
  return !0;
432
432
  const r = e.prototype;
433
- return !(lt(r) === !1 || Object.prototype.hasOwnProperty.call(r, "isPrototypeOf") === !1);
433
+ return !(dt(r) === !1 || Object.prototype.hasOwnProperty.call(r, "isPrototypeOf") === !1);
434
434
  }
435
435
  function Fn(t) {
436
- return Ye(t) ? { ...t } : Array.isArray(t) ? [...t] : t;
436
+ return Ke(t) ? { ...t } : Array.isArray(t) ? [...t] : t;
437
437
  }
438
438
  function ym(t) {
439
439
  let e = 0;
@@ -535,7 +535,7 @@ function Za(t, e) {
535
535
  throw new Error(`Unrecognized key: "${o}"`);
536
536
  e[o] && (n[o] = r.shape[o]);
537
537
  }
538
- return Le(this, "shape", n), n;
538
+ return Ze(this, "shape", n), n;
539
539
  },
540
540
  checks: []
541
541
  });
@@ -550,14 +550,14 @@ function Fa(t, e) {
550
550
  throw new Error(`Unrecognized key: "${o}"`);
551
551
  e[o] && delete n[o];
552
552
  }
553
- return Le(this, "shape", n), n;
553
+ return Ze(this, "shape", n), n;
554
554
  },
555
555
  checks: []
556
556
  });
557
557
  return ae(t, i);
558
558
  }
559
559
  function Ba(t, e) {
560
- if (!Ye(e))
560
+ if (!Ke(e))
561
561
  throw new Error("Invalid input to extend: expected a plain object");
562
562
  const r = t._zod.def.checks;
563
563
  if (r && r.length > 0)
@@ -565,20 +565,20 @@ function Ba(t, e) {
565
565
  const n = Te(t._zod.def, {
566
566
  get shape() {
567
567
  const o = { ...t._zod.def.shape, ...e };
568
- return Le(this, "shape", o), o;
568
+ return Ze(this, "shape", o), o;
569
569
  },
570
570
  checks: []
571
571
  });
572
572
  return ae(t, n);
573
573
  }
574
574
  function Wa(t, e) {
575
- if (!Ye(e))
575
+ if (!Ke(e))
576
576
  throw new Error("Invalid input to safeExtend: expected a plain object");
577
577
  const r = {
578
578
  ...t._zod.def,
579
579
  get shape() {
580
580
  const i = { ...t._zod.def.shape, ...e };
581
- return Le(this, "shape", i), i;
581
+ return Ze(this, "shape", i), i;
582
582
  },
583
583
  checks: t._zod.def.checks
584
584
  };
@@ -588,7 +588,7 @@ function Ga(t, e) {
588
588
  const r = Te(t._zod.def, {
589
589
  get shape() {
590
590
  const i = { ...t._zod.def.shape, ...e._zod.def.shape };
591
- return Le(this, "shape", i), i;
591
+ return Ze(this, "shape", i), i;
592
592
  },
593
593
  get catchall() {
594
594
  return e._zod.def.catchall;
@@ -617,7 +617,7 @@ function Xa(t, e, r) {
617
617
  type: "optional",
618
618
  innerType: n[a]
619
619
  }) : n[a];
620
- return Le(this, "shape", o), o;
620
+ return Ze(this, "shape", o), o;
621
621
  },
622
622
  checks: []
623
623
  });
@@ -642,13 +642,13 @@ function Ja(t, e, r) {
642
642
  type: "nonoptional",
643
643
  innerType: n[a]
644
644
  });
645
- return Le(this, "shape", o), o;
645
+ return Ze(this, "shape", o), o;
646
646
  },
647
647
  checks: []
648
648
  });
649
649
  return ae(e, i);
650
650
  }
651
- function Be(t, e = 0) {
651
+ function Ge(t, e = 0) {
652
652
  if (t.aborted === !0)
653
653
  return !0;
654
654
  for (let r = e; r < t.issues.length; r++)
@@ -679,7 +679,7 @@ function Bn(t) {
679
679
  function Wn(t) {
680
680
  return Array.isArray(t) ? "array" : typeof t == "string" ? "string" : "unknown";
681
681
  }
682
- function dt(...t) {
682
+ function ht(...t) {
683
683
  const [e, r, i] = t;
684
684
  return typeof e == "string" ? {
685
685
  message: e,
@@ -731,14 +731,14 @@ const Ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
731
731
  BIGINT_FORMAT_RANGES: La,
732
732
  Class: km,
733
733
  NUMBER_FORMAT_RANGES: Ra,
734
- aborted: Be,
734
+ aborted: Ge,
735
735
  allowsEval: Da,
736
736
  assert: hm,
737
737
  assertEqual: cm,
738
738
  assertIs: lm,
739
739
  assertNever: dm,
740
740
  assertNotEqual: um,
741
- assignProp: Le,
741
+ assignProp: Ze,
742
742
  base64ToUint8Array: Va,
743
743
  base64urlToUint8Array: wm,
744
744
  cached: Zt,
@@ -760,15 +760,15 @@ const Ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
760
760
  getParsedType: bm,
761
761
  getSizableOrigin: Bn,
762
762
  hexToUint8Array: xm,
763
- isObject: lt,
764
- isPlainObject: Ye,
765
- issue: dt,
763
+ isObject: dt,
764
+ isPlainObject: Ke,
765
+ issue: ht,
766
766
  joinValues: y,
767
767
  jsonStringifyReplacer: Tn,
768
768
  merge: Ga,
769
769
  mergeDefs: Te,
770
770
  normalizeParams: p,
771
- nullish: Qe,
771
+ nullish: tt,
772
772
  numKeys: ym,
773
773
  objectClone: mm,
774
774
  omit: Fa,
@@ -869,7 +869,7 @@ function es(t) {
869
869
  const Ft = (t) => (e, r, i, n) => {
870
870
  const o = i ? Object.assign(i, { async: !1 }) : { async: !1 }, a = e._zod.run({ value: r, issues: [] }, o);
871
871
  if (a instanceof Promise)
872
- throw new Ve();
872
+ throw new He();
873
873
  if (a.issues.length) {
874
874
  const s = new (n?.Err ?? t)(a.issues.map((u) => oe(u, o, H())));
875
875
  throw qr(s, n?.callee), s;
@@ -886,7 +886,7 @@ const Ft = (t) => (e, r, i, n) => {
886
886
  }, Fr = /* @__PURE__ */ Bt(ne), Wt = (t) => (e, r, i) => {
887
887
  const n = i ? { ...i, async: !1 } : { async: !1 }, o = e._zod.run({ value: r, issues: [] }, n);
888
888
  if (o instanceof Promise)
889
- throw new Ve();
889
+ throw new He();
890
890
  return o.issues.length ? {
891
891
  success: !1,
892
892
  error: new (t ?? Qr)(o.issues.map((a) => oe(a, n, H())))
@@ -910,7 +910,7 @@ const Ft = (t) => (e, r, i, n) => {
910
910
  }, Pm = /* @__PURE__ */ ai(ne), si = (t) => (e, r, i) => Wt(t)(e, r, i), jm = /* @__PURE__ */ si(ne), ci = (t) => async (e, r, i) => {
911
911
  const n = i ? Object.assign(i, { direction: "backward" }) : { direction: "backward" };
912
912
  return Gt(t)(e, r, n);
913
- }, Um = /* @__PURE__ */ ci(ne), ui = (t) => async (e, r, i) => Gt(t)(e, r, i), Nm = /* @__PURE__ */ ui(ne), rs = /^[cC][^\s-]{8,}$/, is = /^[0-9a-z]+$/, os = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, as = /^[0-9a-vA-V]{20}$/, ss = /^[A-Za-z0-9]{27}$/, cs = /^[a-zA-Z0-9_-]{21}$/, us = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Cm = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, ls = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, ht = (t) => t ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Dm = /* @__PURE__ */ ht(4), Am = /* @__PURE__ */ ht(6), Mm = /* @__PURE__ */ ht(7), ds = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Rm = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, Lm = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, hs = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u, Zm = hs, Fm = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, Bm = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
913
+ }, Um = /* @__PURE__ */ ci(ne), ui = (t) => async (e, r, i) => Gt(t)(e, r, i), Nm = /* @__PURE__ */ ui(ne), rs = /^[cC][^\s-]{8,}$/, is = /^[0-9a-z]+$/, os = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, as = /^[0-9a-vA-V]{20}$/, ss = /^[A-Za-z0-9]{27}$/, cs = /^[a-zA-Z0-9_-]{21}$/, us = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Cm = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, ls = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, mt = (t) => t ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Dm = /* @__PURE__ */ mt(4), Am = /* @__PURE__ */ mt(6), Mm = /* @__PURE__ */ mt(7), ds = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Rm = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, Lm = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, hs = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u, Zm = hs, Fm = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, Bm = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
914
914
  function ms() {
915
915
  return new RegExp(Bm, "u");
916
916
  }
@@ -996,12 +996,12 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
996
996
  undefined: Ns,
997
997
  unicodeEmail: hs,
998
998
  uppercase: Ds,
999
- uuid: ht,
999
+ uuid: mt,
1000
1000
  uuid4: Dm,
1001
1001
  uuid6: Am,
1002
1002
  uuid7: Mm,
1003
1003
  xid: as
1004
- }, Symbol.toStringTag, { value: "Module" })), M = /* @__PURE__ */ h("$ZodCheck", (t, e) => {
1004
+ }, Symbol.toStringTag, { value: "Module" })), R = /* @__PURE__ */ h("$ZodCheck", (t, e) => {
1005
1005
  var r;
1006
1006
  t._zod ?? (t._zod = {}), t._zod.def = e, (r = t._zod).onattach ?? (r.onattach = []);
1007
1007
  }), Ms = {
@@ -1009,7 +1009,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1009
1009
  bigint: "bigint",
1010
1010
  object: "date"
1011
1011
  }, hi = /* @__PURE__ */ h("$ZodCheckLessThan", (t, e) => {
1012
- M.init(t, e);
1012
+ R.init(t, e);
1013
1013
  const r = Ms[typeof e.value];
1014
1014
  t._zod.onattach.push((i) => {
1015
1015
  const n = i._zod.bag, o = (e.inclusive ? n.maximum : n.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
@@ -1026,7 +1026,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1026
1026
  });
1027
1027
  };
1028
1028
  }), mi = /* @__PURE__ */ h("$ZodCheckGreaterThan", (t, e) => {
1029
- M.init(t, e);
1029
+ R.init(t, e);
1030
1030
  const r = Ms[typeof e.value];
1031
1031
  t._zod.onattach.push((i) => {
1032
1032
  const n = i._zod.bag, o = (e.inclusive ? n.minimum : n.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
@@ -1043,7 +1043,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1043
1043
  });
1044
1044
  };
1045
1045
  }), Rs = /* @__PURE__ */ h("$ZodCheckMultipleOf", (t, e) => {
1046
- M.init(t, e), t._zod.onattach.push((r) => {
1046
+ R.init(t, e), t._zod.onattach.push((r) => {
1047
1047
  var i;
1048
1048
  (i = r._zod.bag).multipleOf ?? (i.multipleOf = e.value);
1049
1049
  }), t._zod.check = (r) => {
@@ -1059,7 +1059,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1059
1059
  });
1060
1060
  };
1061
1061
  }), Ls = /* @__PURE__ */ h("$ZodCheckNumberFormat", (t, e) => {
1062
- M.init(t, e), e.format = e.format || "float64";
1062
+ R.init(t, e), e.format = e.format || "float64";
1063
1063
  const r = e.format?.includes("int"), i = r ? "int" : "number", [n, o] = Ra[e.format];
1064
1064
  t._zod.onattach.push((a) => {
1065
1065
  const s = a._zod.bag;
@@ -1116,7 +1116,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1116
1116
  });
1117
1117
  };
1118
1118
  }), Zs = /* @__PURE__ */ h("$ZodCheckBigIntFormat", (t, e) => {
1119
- M.init(t, e);
1119
+ R.init(t, e);
1120
1120
  const [r, i] = La[e.format];
1121
1121
  t._zod.onattach.push((n) => {
1122
1122
  const o = n._zod.bag;
@@ -1141,9 +1141,9 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1141
1141
  };
1142
1142
  }), Fs = /* @__PURE__ */ h("$ZodCheckMaxSize", (t, e) => {
1143
1143
  var r;
1144
- M.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1144
+ R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1145
1145
  const n = i.value;
1146
- return !Qe(n) && n.size !== void 0;
1146
+ return !tt(n) && n.size !== void 0;
1147
1147
  }), t._zod.onattach.push((i) => {
1148
1148
  const n = i._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1149
1149
  e.maximum < n && (i._zod.bag.maximum = e.maximum);
@@ -1161,9 +1161,9 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1161
1161
  };
1162
1162
  }), Bs = /* @__PURE__ */ h("$ZodCheckMinSize", (t, e) => {
1163
1163
  var r;
1164
- M.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1164
+ R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1165
1165
  const n = i.value;
1166
- return !Qe(n) && n.size !== void 0;
1166
+ return !tt(n) && n.size !== void 0;
1167
1167
  }), t._zod.onattach.push((i) => {
1168
1168
  const n = i._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1169
1169
  e.minimum > n && (i._zod.bag.minimum = e.minimum);
@@ -1181,9 +1181,9 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1181
1181
  };
1182
1182
  }), Ws = /* @__PURE__ */ h("$ZodCheckSizeEquals", (t, e) => {
1183
1183
  var r;
1184
- M.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1184
+ R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1185
1185
  const n = i.value;
1186
- return !Qe(n) && n.size !== void 0;
1186
+ return !tt(n) && n.size !== void 0;
1187
1187
  }), t._zod.onattach.push((i) => {
1188
1188
  const n = i._zod.bag;
1189
1189
  n.minimum = e.size, n.maximum = e.size, n.size = e.size;
@@ -1204,9 +1204,9 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1204
1204
  };
1205
1205
  }), Gs = /* @__PURE__ */ h("$ZodCheckMaxLength", (t, e) => {
1206
1206
  var r;
1207
- M.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1207
+ R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1208
1208
  const n = i.value;
1209
- return !Qe(n) && n.length !== void 0;
1209
+ return !tt(n) && n.length !== void 0;
1210
1210
  }), t._zod.onattach.push((i) => {
1211
1211
  const n = i._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1212
1212
  e.maximum < n && (i._zod.bag.maximum = e.maximum);
@@ -1227,9 +1227,9 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1227
1227
  };
1228
1228
  }), Xs = /* @__PURE__ */ h("$ZodCheckMinLength", (t, e) => {
1229
1229
  var r;
1230
- M.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1230
+ R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1231
1231
  const n = i.value;
1232
- return !Qe(n) && n.length !== void 0;
1232
+ return !tt(n) && n.length !== void 0;
1233
1233
  }), t._zod.onattach.push((i) => {
1234
1234
  const n = i._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1235
1235
  e.minimum > n && (i._zod.bag.minimum = e.minimum);
@@ -1250,9 +1250,9 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1250
1250
  };
1251
1251
  }), Js = /* @__PURE__ */ h("$ZodCheckLengthEquals", (t, e) => {
1252
1252
  var r;
1253
- M.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1253
+ R.init(t, e), (r = t._zod.def).when ?? (r.when = (i) => {
1254
1254
  const n = i.value;
1255
- return !Qe(n) && n.length !== void 0;
1255
+ return !tt(n) && n.length !== void 0;
1256
1256
  }), t._zod.onattach.push((i) => {
1257
1257
  const n = i._zod.bag;
1258
1258
  n.minimum = e.length, n.maximum = e.length, n.length = e.length;
@@ -1273,7 +1273,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1273
1273
  };
1274
1274
  }), Vt = /* @__PURE__ */ h("$ZodCheckStringFormat", (t, e) => {
1275
1275
  var r, i;
1276
- M.init(t, e), t._zod.onattach.push((n) => {
1276
+ R.init(t, e), t._zod.onattach.push((n) => {
1277
1277
  const o = n._zod.bag;
1278
1278
  o.format = e.format, e.pattern && (o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(e.pattern));
1279
1279
  }), e.pattern ? (r = t._zod).check ?? (r.check = (n) => {
@@ -1305,7 +1305,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1305
1305
  }), Hs = /* @__PURE__ */ h("$ZodCheckUpperCase", (t, e) => {
1306
1306
  e.pattern ?? (e.pattern = Ds), Vt.init(t, e);
1307
1307
  }), Ks = /* @__PURE__ */ h("$ZodCheckIncludes", (t, e) => {
1308
- M.init(t, e);
1308
+ R.init(t, e);
1309
1309
  const r = Ee(e.includes), i = new RegExp(typeof e.position == "number" ? `^.{${e.position}}${r}` : r);
1310
1310
  e.pattern = i, t._zod.onattach.push((n) => {
1311
1311
  const o = n._zod.bag;
@@ -1322,7 +1322,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1322
1322
  });
1323
1323
  };
1324
1324
  }), qs = /* @__PURE__ */ h("$ZodCheckStartsWith", (t, e) => {
1325
- M.init(t, e);
1325
+ R.init(t, e);
1326
1326
  const r = new RegExp(`^${Ee(e.prefix)}.*`);
1327
1327
  e.pattern ?? (e.pattern = r), t._zod.onattach.push((i) => {
1328
1328
  const n = i._zod.bag;
@@ -1339,7 +1339,7 @@ const Wm = /^[0-9a-fA-F]{32}$/, Gm = /* @__PURE__ */ Xt(22, "=="), Xm = /* @__PU
1339
1339
  });
1340
1340
  };
1341
1341
  }), Qs = /* @__PURE__ */ h("$ZodCheckEndsWith", (t, e) => {
1342
- M.init(t, e);
1342
+ R.init(t, e);
1343
1343
  const r = new RegExp(`.*${Ee(e.suffix)}$`);
1344
1344
  e.pattern ?? (e.pattern = r), t._zod.onattach.push((i) => {
1345
1345
  const n = i._zod.bag;
@@ -1360,7 +1360,7 @@ function Vo(t, e, r) {
1360
1360
  t.issues.length && e.issues.push(...de(r, t.issues));
1361
1361
  }
1362
1362
  const ec = /* @__PURE__ */ h("$ZodCheckProperty", (t, e) => {
1363
- M.init(t, e), t._zod.check = (r) => {
1363
+ R.init(t, e), t._zod.check = (r) => {
1364
1364
  const i = e.schema._zod.run({
1365
1365
  value: r.value[e.property],
1366
1366
  issues: []
@@ -1370,7 +1370,7 @@ const ec = /* @__PURE__ */ h("$ZodCheckProperty", (t, e) => {
1370
1370
  Vo(i, r, e.property);
1371
1371
  };
1372
1372
  }), tc = /* @__PURE__ */ h("$ZodCheckMimeType", (t, e) => {
1373
- M.init(t, e);
1373
+ R.init(t, e);
1374
1374
  const r = new Set(e.mime);
1375
1375
  t._zod.onattach.push((i) => {
1376
1376
  i._zod.bag.mime = e.mime;
@@ -1384,7 +1384,7 @@ const ec = /* @__PURE__ */ h("$ZodCheckProperty", (t, e) => {
1384
1384
  });
1385
1385
  };
1386
1386
  }), nc = /* @__PURE__ */ h("$ZodCheckOverwrite", (t, e) => {
1387
- M.init(t, e), t._zod.check = (r) => {
1387
+ R.init(t, e), t._zod.check = (r) => {
1388
1388
  r.value = e.tx(r.value);
1389
1389
  };
1390
1390
  });
@@ -1429,7 +1429,7 @@ const ic = {
1429
1429
  });
1430
1430
  else {
1431
1431
  const n = (a, s, u) => {
1432
- let c = Be(a), l;
1432
+ let c = Ge(a), l;
1433
1433
  for (const d of s) {
1434
1434
  if (d._zod.def.when) {
1435
1435
  if (!d._zod.def.when(a))
@@ -1438,25 +1438,25 @@ const ic = {
1438
1438
  continue;
1439
1439
  const m = a.issues.length, f = d._zod.check(a);
1440
1440
  if (f instanceof Promise && u?.async === !1)
1441
- throw new Ve();
1441
+ throw new He();
1442
1442
  if (l || f instanceof Promise)
1443
1443
  l = (l ?? Promise.resolve()).then(async () => {
1444
- await f, a.issues.length !== m && (c || (c = Be(a, m)));
1444
+ await f, a.issues.length !== m && (c || (c = Ge(a, m)));
1445
1445
  });
1446
1446
  else {
1447
1447
  if (a.issues.length === m)
1448
1448
  continue;
1449
- c || (c = Be(a, m));
1449
+ c || (c = Ge(a, m));
1450
1450
  }
1451
1451
  }
1452
1452
  return l ? l.then(() => a) : a;
1453
1453
  }, o = (a, s, u) => {
1454
- if (Be(a))
1454
+ if (Ge(a))
1455
1455
  return a.aborted = !0, a;
1456
1456
  const c = n(s, i, u);
1457
1457
  if (c instanceof Promise) {
1458
1458
  if (u.async === !1)
1459
- throw new Ve();
1459
+ throw new He();
1460
1460
  return c.then((l) => t._zod.parse(l, u));
1461
1461
  }
1462
1462
  return t._zod.parse(c, u);
@@ -1471,7 +1471,7 @@ const ic = {
1471
1471
  const u = t._zod.parse(a, s);
1472
1472
  if (u instanceof Promise) {
1473
1473
  if (s.async === !1)
1474
- throw new Ve();
1474
+ throw new He();
1475
1475
  return u.then((c) => n(c, i, s));
1476
1476
  }
1477
1477
  return n(u, i, s);
@@ -1521,9 +1521,9 @@ const ic = {
1521
1521
  }[e.version];
1522
1522
  if (i === void 0)
1523
1523
  throw new Error(`Invalid UUID version: "${e.version}"`);
1524
- e.pattern ?? (e.pattern = ht(i));
1524
+ e.pattern ?? (e.pattern = mt(i));
1525
1525
  } else
1526
- e.pattern ?? (e.pattern = ht());
1526
+ e.pattern ?? (e.pattern = mt());
1527
1527
  U.init(t, e);
1528
1528
  }), sc = /* @__PURE__ */ h("$ZodEmail", (t, e) => {
1529
1529
  e.pattern ?? (e.pattern = ds), U.init(t, e);
@@ -1908,7 +1908,7 @@ const Gc = /* @__PURE__ */ h("$ZodObject", (t, e) => {
1908
1908
  }
1909
1909
  return u;
1910
1910
  });
1911
- const n = lt, o = e.catchall;
1911
+ const n = dt, o = e.catchall;
1912
1912
  let a;
1913
1913
  t._zod.parse = (s, u) => {
1914
1914
  a ?? (a = i.value);
@@ -1937,9 +1937,9 @@ const Gc = /* @__PURE__ */ h("$ZodObject", (t, e) => {
1937
1937
  };
1938
1938
  f.write("const input = payload.value;");
1939
1939
  const P = /* @__PURE__ */ Object.create(null);
1940
- let R = 0;
1940
+ let L = 0;
1941
1941
  for (const E of $.keys)
1942
- P[E] = `key_${R++}`;
1942
+ P[E] = `key_${L++}`;
1943
1943
  f.write("const newResult = {};");
1944
1944
  for (const E of $.keys) {
1945
1945
  const S = P[E], se = Lr(E);
@@ -1963,11 +1963,11 @@ const Gc = /* @__PURE__ */ h("$ZodObject", (t, e) => {
1963
1963
  `);
1964
1964
  }
1965
1965
  f.write("payload.value = newResult;"), f.write("return payload;");
1966
- const C = f.compile();
1967
- return (E, S) => C(m, E, S);
1966
+ const A = f.compile();
1967
+ return (E, S) => A(m, E, S);
1968
1968
  };
1969
1969
  let o;
1970
- const a = lt, s = !En.jitless, c = s && Da.value, l = e.catchall;
1970
+ const a = dt, s = !En.jitless, c = s && Da.value, l = e.catchall;
1971
1971
  let d;
1972
1972
  t._zod.parse = (m, f) => {
1973
1973
  d ?? (d = i.value);
@@ -1984,7 +1984,7 @@ function Ho(t, e, r, i) {
1984
1984
  for (const o of t)
1985
1985
  if (o.issues.length === 0)
1986
1986
  return e.value = o.value, e;
1987
- const n = t.filter((o) => !Be(o));
1987
+ const n = t.filter((o) => !Ge(o));
1988
1988
  return n.length === 1 ? (e.value = n[0].value, n[0]) : (e.issues.push({
1989
1989
  code: "invalid_union",
1990
1990
  input: e.value,
@@ -2089,7 +2089,7 @@ const Jc = /* @__PURE__ */ h("$ZodXor", (t, e) => {
2089
2089
  });
2090
2090
  t._zod.parse = (n, o) => {
2091
2091
  const a = n.value;
2092
- if (!lt(a))
2092
+ if (!dt(a))
2093
2093
  return n.issues.push({
2094
2094
  code: "invalid_type",
2095
2095
  expected: "object",
@@ -2118,7 +2118,7 @@ function Br(t, e) {
2118
2118
  return { valid: !0, data: t };
2119
2119
  if (t instanceof Date && e instanceof Date && +t == +e)
2120
2120
  return { valid: !0, data: t };
2121
- if (Ye(t) && Ye(e)) {
2121
+ if (Ke(t) && Ke(e)) {
2122
2122
  const r = Object.keys(e), i = Object.keys(t).filter((o) => r.indexOf(o) !== -1), n = { ...t, ...e };
2123
2123
  for (const o of i) {
2124
2124
  const a = Br(t[o], e[o]);
@@ -2149,7 +2149,7 @@ function Br(t, e) {
2149
2149
  return { valid: !1, mergeErrorPath: [] };
2150
2150
  }
2151
2151
  function qo(t, e, r) {
2152
- if (e.issues.length && t.issues.push(...e.issues), r.issues.length && t.issues.push(...r.issues), Be(t))
2152
+ if (e.issues.length && t.issues.push(...e.issues), r.issues.length && t.issues.push(...r.issues), Ge(t))
2153
2153
  return t;
2154
2154
  const i = Br(e.value, r.value);
2155
2155
  if (!i.valid)
@@ -2210,7 +2210,7 @@ function mn(t, e, r) {
2210
2210
  const Hc = /* @__PURE__ */ h("$ZodRecord", (t, e) => {
2211
2211
  I.init(t, e), t._zod.parse = (r, i) => {
2212
2212
  const n = r.value;
2213
- if (!Ye(n))
2213
+ if (!Ke(n))
2214
2214
  return r.issues.push({
2215
2215
  expected: "record",
2216
2216
  code: "invalid_type",
@@ -2367,7 +2367,7 @@ const Qc = /* @__PURE__ */ h("$ZodEnum", (t, e) => {
2367
2367
  if (i.async)
2368
2368
  return (n instanceof Promise ? n : Promise.resolve(n)).then((a) => (r.value = a, r));
2369
2369
  if (n instanceof Promise)
2370
- throw new Ve();
2370
+ throw new He();
2371
2371
  return r.value = n, r;
2372
2372
  };
2373
2373
  });
@@ -2578,7 +2578,7 @@ const mu = /* @__PURE__ */ h("$ZodTemplateLiteral", (t, e) => {
2578
2578
  }), pu = /* @__PURE__ */ h("$ZodLazy", (t, e) => {
2579
2579
  I.init(t, e), O(t._zod, "innerType", () => e.getter()), O(t._zod, "pattern", () => t._zod.innerType?._zod?.pattern), O(t._zod, "propValues", () => t._zod.innerType?._zod?.propValues), O(t._zod, "optin", () => t._zod.innerType?._zod?.optin ?? void 0), O(t._zod, "optout", () => t._zod.innerType?._zod?.optout ?? void 0), t._zod.parse = (r, i) => t._zod.innerType._zod.run(r, i);
2580
2580
  }), vu = /* @__PURE__ */ h("$ZodCustom", (t, e) => {
2581
- M.init(t, e), I.init(t, e), t._zod.parse = (r, i) => r, t._zod.check = (r) => {
2581
+ R.init(t, e), I.init(t, e), t._zod.parse = (r, i) => r, t._zod.check = (r) => {
2582
2582
  const i = r.value, n = e.fn(i);
2583
2583
  if (n instanceof Promise)
2584
2584
  return n.then((o) => oa(o, r, i, t));
@@ -2597,7 +2597,7 @@ function oa(t, e, r, i) {
2597
2597
  continue: !i._zod.def.abort
2598
2598
  // params: inst._zod.def.params,
2599
2599
  };
2600
- i._zod.def.params && (n.params = i._zod.def.params), e.issues.push(dt(n));
2600
+ i._zod.def.params && (n.params = i._zod.def.params), e.issues.push(ht(n));
2601
2601
  }
2602
2602
  }
2603
2603
  const af = () => {
@@ -5026,7 +5026,7 @@ const ig = (t) => Ot(typeof t, t), Ot = (t, e = void 0) => {
5026
5026
  return "nulinė reikšmė";
5027
5027
  }
5028
5028
  return t;
5029
- }, St = (t) => t.charAt(0).toUpperCase() + t.slice(1);
5029
+ }, xt = (t) => t.charAt(0).toUpperCase() + t.slice(1);
5030
5030
  function sa(t) {
5031
5031
  const e = Math.abs(t), r = e % 10, i = e % 100;
5032
5032
  return i >= 11 && i <= 19 || r === 0 ? "many" : r === 1 ? "one" : "few";
@@ -5148,16 +5148,16 @@ const og = () => {
5148
5148
  case "too_big": {
5149
5149
  const n = Ot(i.origin), o = e(i.origin, sa(Number(i.maximum)), i.inclusive ?? !1, "smaller");
5150
5150
  if (o?.verb)
5151
- return `${St(n ?? i.origin ?? "reikšmė")} ${o.verb} ${i.maximum.toString()} ${o.unit ?? "elementų"}`;
5151
+ return `${xt(n ?? i.origin ?? "reikšmė")} ${o.verb} ${i.maximum.toString()} ${o.unit ?? "elementų"}`;
5152
5152
  const a = i.inclusive ? "ne didesnis kaip" : "mažesnis kaip";
5153
- return `${St(n ?? i.origin ?? "reikšmė")} turi būti ${a} ${i.maximum.toString()} ${o?.unit}`;
5153
+ return `${xt(n ?? i.origin ?? "reikšmė")} turi būti ${a} ${i.maximum.toString()} ${o?.unit}`;
5154
5154
  }
5155
5155
  case "too_small": {
5156
5156
  const n = Ot(i.origin), o = e(i.origin, sa(Number(i.minimum)), i.inclusive ?? !1, "bigger");
5157
5157
  if (o?.verb)
5158
- return `${St(n ?? i.origin ?? "reikšmė")} ${o.verb} ${i.minimum.toString()} ${o.unit ?? "elementų"}`;
5158
+ return `${xt(n ?? i.origin ?? "reikšmė")} ${o.verb} ${i.minimum.toString()} ${o.unit ?? "elementų"}`;
5159
5159
  const a = i.inclusive ? "ne mažesnis kaip" : "didesnis kaip";
5160
- return `${St(n ?? i.origin ?? "reikšmė")} turi būti ${a} ${i.minimum.toString()} ${o?.unit}`;
5160
+ return `${xt(n ?? i.origin ?? "reikšmė")} turi būti ${a} ${i.minimum.toString()} ${o?.unit}`;
5161
5161
  }
5162
5162
  case "invalid_format": {
5163
5163
  const n = i;
@@ -5173,7 +5173,7 @@ const og = () => {
5173
5173
  return "Klaidinga įvestis";
5174
5174
  case "invalid_element": {
5175
5175
  const n = Ot(i.origin);
5176
- return `${St(n ?? i.origin ?? "reikšmė")} turi klaidingą įvestį`;
5176
+ return `${xt(n ?? i.origin ?? "reikšmė")} turi klaidingą įvestį`;
5177
5177
  }
5178
5178
  default:
5179
5179
  return "Klaidinga įvestis";
@@ -7611,7 +7611,7 @@ function tl(t, e) {
7611
7611
  ...p(e)
7612
7612
  });
7613
7613
  }
7614
- function Me(t, e) {
7614
+ function Re(t, e) {
7615
7615
  return new hi({
7616
7616
  check: "less_than",
7617
7617
  ...p(e),
@@ -7627,7 +7627,7 @@ function ie(t, e) {
7627
7627
  inclusive: !0
7628
7628
  });
7629
7629
  }
7630
- function Re(t, e) {
7630
+ function Le(t, e) {
7631
7631
  return new mi({
7632
7632
  check: "greater_than",
7633
7633
  ...p(e),
@@ -7644,10 +7644,10 @@ function te(t, e) {
7644
7644
  });
7645
7645
  }
7646
7646
  function Zi(t) {
7647
- return Re(0, t);
7647
+ return Le(0, t);
7648
7648
  }
7649
7649
  function Fi(t) {
7650
- return Me(0, t);
7650
+ return Re(0, t);
7651
7651
  }
7652
7652
  function Bi(t) {
7653
7653
  return ie(0, t);
@@ -7655,7 +7655,7 @@ function Bi(t) {
7655
7655
  function Wi(t) {
7656
7656
  return te(0, t);
7657
7657
  }
7658
- function mt(t, e) {
7658
+ function ft(t, e) {
7659
7659
  return new Rs({
7660
7660
  check: "multiple_of",
7661
7661
  ...p(e),
@@ -7669,7 +7669,7 @@ function Ht(t, e) {
7669
7669
  maximum: t
7670
7670
  });
7671
7671
  }
7672
- function ft(t, e) {
7672
+ function gt(t, e) {
7673
7673
  return new Bs({
7674
7674
  check: "min_size",
7675
7675
  ...p(e),
@@ -7690,7 +7690,7 @@ function Kt(t, e) {
7690
7690
  maximum: t
7691
7691
  });
7692
7692
  }
7693
- function He(t, e) {
7693
+ function qe(t, e) {
7694
7694
  return new Xs({
7695
7695
  check: "min_length",
7696
7696
  ...p(e),
@@ -7985,23 +7985,23 @@ function ol(t, e, r) {
7985
7985
  function al(t) {
7986
7986
  const e = sl((r) => (r.addIssue = (i) => {
7987
7987
  if (typeof i == "string")
7988
- r.issues.push(dt(i, r.value, e._zod.def));
7988
+ r.issues.push(ht(i, r.value, e._zod.def));
7989
7989
  else {
7990
7990
  const n = i;
7991
- n.fatal && (n.continue = !1), n.code ?? (n.code = "custom"), n.input ?? (n.input = r.value), n.inst ?? (n.inst = e), n.continue ?? (n.continue = !e._zod.def.abort), r.issues.push(dt(n));
7991
+ n.fatal && (n.continue = !1), n.code ?? (n.code = "custom"), n.input ?? (n.input = r.value), n.inst ?? (n.inst = e), n.continue ?? (n.continue = !e._zod.def.abort), r.issues.push(ht(n));
7992
7992
  }
7993
7993
  }, t(r.value, r)));
7994
7994
  return e;
7995
7995
  }
7996
7996
  function sl(t, e) {
7997
- const r = new M({
7997
+ const r = new R({
7998
7998
  check: "custom",
7999
7999
  ...p(e)
8000
8000
  });
8001
8001
  return r._zod.check = t, r;
8002
8002
  }
8003
8003
  function cl(t) {
8004
- const e = new M({ check: "describe" });
8004
+ const e = new R({ check: "describe" });
8005
8005
  return e._zod.onattach = [
8006
8006
  (r) => {
8007
8007
  const i = he.get(r) ?? {};
@@ -8011,7 +8011,7 @@ function cl(t) {
8011
8011
  }, e;
8012
8012
  }
8013
8013
  function ul(t) {
8014
- const e = new M({ check: "meta" });
8014
+ const e = new R({ check: "meta" });
8015
8015
  return e._zod.onattach = [
8016
8016
  (r) => {
8017
8017
  const i = he.get(r) ?? {};
@@ -8055,7 +8055,7 @@ function Qt(t, e, r, i = {}) {
8055
8055
  };
8056
8056
  return r instanceof RegExp && (o.pattern = r), new t(o);
8057
8057
  }
8058
- function gt(t) {
8058
+ function pt(t) {
8059
8059
  let e = t?.target ?? "draft-2020-12";
8060
8060
  return e === "draft-4" && (e = "draft-04"), e === "draft-7" && (e = "draft-07"), {
8061
8061
  processors: t.processors ?? {},
@@ -8102,7 +8102,7 @@ function j(t, e, r = { path: [], schemaPath: [] }) {
8102
8102
  const u = e.metadataRegistry.get(t);
8103
8103
  return u && Object.assign(a.schema, u), e.io === "input" && q(t) && (delete a.schema.examples, delete a.schema.default), e.io === "input" && a.schema._prefault && ((i = a.schema).default ?? (i.default = a.schema._prefault)), delete a.schema._prefault, e.seen.get(t).schema;
8104
8104
  }
8105
- function pt(t, e) {
8105
+ function vt(t, e) {
8106
8106
  const r = t.seen.get(e);
8107
8107
  if (!r)
8108
8108
  throw new Error("Unprocessed schema. This is a bug in Zod.");
@@ -8164,7 +8164,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8164
8164
  }
8165
8165
  }
8166
8166
  }
8167
- function vt(t, e) {
8167
+ function yt(t, e) {
8168
8168
  const r = t.seen.get(e);
8169
8169
  if (!r)
8170
8170
  throw new Error("Unprocessed schema. This is a bug in Zod.");
@@ -8260,11 +8260,11 @@ function q(t, e) {
8260
8260
  return !1;
8261
8261
  }
8262
8262
  const dl = (t, e = {}) => (r) => {
8263
- const i = gt({ ...r, processors: e });
8264
- return j(t, i), pt(i, t), vt(i, t);
8263
+ const i = pt({ ...r, processors: e });
8264
+ return j(t, i), vt(i, t), yt(i, t);
8265
8265
  }, Dt = (t, e) => (r) => {
8266
- const { libraryOptions: i, target: n } = r ?? {}, o = gt({ ...i ?? {}, target: n, io: e, processors: {} });
8267
- return j(t, o), pt(o, t), vt(o, t);
8266
+ const { libraryOptions: i, target: n } = r ?? {}, o = pt({ ...i ?? {}, target: n, io: e, processors: {} });
8267
+ return j(t, o), vt(o, t), yt(o, t);
8268
8268
  }, vp = {
8269
8269
  guid: "uuid",
8270
8270
  url: "uri",
@@ -8523,7 +8523,7 @@ const dl = (t, e = {}) => (r) => {
8523
8523
  };
8524
8524
  function Hl(t, e) {
8525
8525
  if ("_idmap" in t) {
8526
- const i = t, n = gt({ ...e, processors: Wr }), o = {};
8526
+ const i = t, n = pt({ ...e, processors: Wr }), o = {};
8527
8527
  for (const u of i._idmap.entries()) {
8528
8528
  const [c, l] = u;
8529
8529
  j(l, n);
@@ -8536,7 +8536,7 @@ function Hl(t, e) {
8536
8536
  n.external = s;
8537
8537
  for (const u of i._idmap.entries()) {
8538
8538
  const [c, l] = u;
8539
- pt(n, l), a[c] = vt(n, l);
8539
+ vt(n, l), a[c] = yt(n, l);
8540
8540
  }
8541
8541
  if (Object.keys(o).length > 0) {
8542
8542
  const u = n.target === "draft-2020-12" ? "$defs" : "definitions";
@@ -8546,8 +8546,8 @@ function Hl(t, e) {
8546
8546
  }
8547
8547
  return { schemas: a };
8548
8548
  }
8549
- const r = gt({ ...e, processors: Wr });
8550
- return j(t, r), pt(r, t), vt(r, t);
8549
+ const r = pt({ ...e, processors: Wr });
8550
+ return j(t, r), vt(r, t), yt(r, t);
8551
8551
  }
8552
8552
  class yp {
8553
8553
  /** @deprecated Access via ctx instead */
@@ -8583,7 +8583,7 @@ class yp {
8583
8583
  }
8584
8584
  constructor(e) {
8585
8585
  let r = e?.target ?? "draft-2020-12";
8586
- r === "draft-4" && (r = "draft-04"), r === "draft-7" && (r = "draft-07"), this.ctx = gt({
8586
+ r === "draft-4" && (r = "draft-04"), r === "draft-7" && (r = "draft-07"), this.ctx = pt({
8587
8587
  processors: Wr,
8588
8588
  target: r,
8589
8589
  ...e?.metadata && { metadata: e.metadata },
@@ -8604,8 +8604,8 @@ class yp {
8604
8604
  * Must call process() first.
8605
8605
  */
8606
8606
  emit(e, r) {
8607
- r && (r.cycles && (this.ctx.cycles = r.cycles), r.reused && (this.ctx.reused = r.reused), r.external && (this.ctx.external = r.external)), pt(this.ctx, e);
8608
- const i = vt(this.ctx, e), { "~standard": n, ...o } = i;
8607
+ r && (r.cycles && (this.ctx.cycles = r.cycles), r.reused && (this.ctx.reused = r.reused), r.external && (this.ctx.external = r.external)), vt(this.ctx, e);
8608
+ const i = yt(this.ctx, e), { "~standard": n, ...o } = i;
8609
8609
  return o;
8610
8610
  }
8611
8611
  }
@@ -8615,7 +8615,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8615
8615
  __proto__: null,
8616
8616
  $ZodAny: Ac,
8617
8617
  $ZodArray: Fc,
8618
- $ZodAsyncError: Ve,
8618
+ $ZodAsyncError: He,
8619
8619
  $ZodBase64: Ic,
8620
8620
  $ZodBase64URL: zc,
8621
8621
  $ZodBigInt: vi,
@@ -8626,7 +8626,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8626
8626
  $ZodCUID: dc,
8627
8627
  $ZodCUID2: hc,
8628
8628
  $ZodCatch: uu,
8629
- $ZodCheck: M,
8629
+ $ZodCheck: R,
8630
8630
  $ZodCheckBigIntFormat: Zs,
8631
8631
  $ZodCheckEndsWith: Qs,
8632
8632
  $ZodCheckGreaterThan: mi,
@@ -8754,7 +8754,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8754
8754
  _file: rl,
8755
8755
  _float32: Du,
8756
8756
  _float64: Au,
8757
- _gt: Re,
8757
+ _gt: Le,
8758
8758
  _gte: te,
8759
8759
  _guid: Un,
8760
8760
  _includes: Kn,
@@ -8774,7 +8774,7 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8774
8774
  _length: qt,
8775
8775
  _literal: ip,
8776
8776
  _lowercase: Yn,
8777
- _lt: Me,
8777
+ _lt: Re,
8778
8778
  _lte: ie,
8779
8779
  _mac: zu,
8780
8780
  _map: ep,
@@ -8783,9 +8783,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8783
8783
  _maxSize: Ht,
8784
8784
  _mime: er,
8785
8785
  _min: te,
8786
- _minLength: He,
8787
- _minSize: ft,
8788
- _multipleOf: mt,
8786
+ _minLength: qe,
8787
+ _minSize: gt,
8788
+ _multipleOf: ft,
8789
8789
  _nan: tl,
8790
8790
  _nanoid: zi,
8791
8791
  _nativeEnum: rp,
@@ -8856,13 +8856,13 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8856
8856
  describe: cl,
8857
8857
  encode: zm,
8858
8858
  encodeAsync: Em,
8859
- extractDefs: pt,
8860
- finalize: vt,
8859
+ extractDefs: vt,
8860
+ finalize: yt,
8861
8861
  flattenError: ei,
8862
8862
  formatError: ti,
8863
8863
  globalConfig: En,
8864
8864
  globalRegistry: he,
8865
- initializeContext: gt,
8865
+ initializeContext: pt,
8866
8866
  isValidBase64: fi,
8867
8867
  isValidBase64URL: kc,
8868
8868
  isValidJWT: Ec,
@@ -8888,19 +8888,19 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8888
8888
  }, Symbol.toStringTag, { value: "Module" })), $p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8889
8889
  __proto__: null,
8890
8890
  endsWith: Qn,
8891
- gt: Re,
8891
+ gt: Le,
8892
8892
  gte: te,
8893
8893
  includes: Kn,
8894
8894
  length: qt,
8895
8895
  lowercase: Yn,
8896
- lt: Me,
8896
+ lt: Re,
8897
8897
  lte: ie,
8898
8898
  maxLength: Kt,
8899
8899
  maxSize: Ht,
8900
8900
  mime: er,
8901
- minLength: He,
8902
- minSize: ft,
8903
- multipleOf: mt,
8901
+ minLength: qe,
8902
+ minSize: gt,
8903
+ multipleOf: ft,
8904
8904
  negative: Fi,
8905
8905
  nonnegative: Wi,
8906
8906
  nonpositive: Bi,
@@ -8991,7 +8991,7 @@ const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8991
8991
  ...e.checks ?? [],
8992
8992
  ...r.map((i) => typeof i == "function" ? { _zod: { check: i, def: { check: "custom" }, onattach: [] } } : i)
8993
8993
  ]
8994
- })), t.clone = (r, i) => ae(t, r, i), t.brand = () => t, t.register = ((r, i) => (r.add(t, i), t)), t.parse = (r, i) => rd(t, r, i, { callee: t.parse }), t.safeParse = (r, i) => od(t, r, i), t.parseAsync = async (r, i) => id(t, r, i, { callee: t.parseAsync }), t.safeParseAsync = async (r, i) => ad(t, r, i), t.spa = t.safeParseAsync, t.encode = (r, i) => sd(t, r, i), t.decode = (r, i) => cd(t, r, i), t.encodeAsync = async (r, i) => ud(t, r, i), t.decodeAsync = async (r, i) => ld(t, r, i), t.safeEncode = (r, i) => dd(t, r, i), t.safeDecode = (r, i) => hd(t, r, i), t.safeEncodeAsync = async (r, i) => md(t, r, i), t.safeDecodeAsync = async (r, i) => fd(t, r, i), t.refine = (r, i) => t.check(Ao(r, i)), t.superRefine = (r) => t.check(Mo(r)), t.overwrite = (r) => t.check(Pe(r)), t.optional = () => Mt(t), t.nullable = () => Rt(t), t.nullish = () => Mt(Rt(t)), t.nonoptional = (r) => ko(t, r), t.array = () => ve(t), t.or = (r) => $t([t, r]), t.and = (r) => mo(t, r), t.transform = (r) => Lt(t, Or(r)), t.default = (r) => So(t, r), t.prefault = (r) => Io(t, r), t.catch = (r) => Eo(t, r), t.pipe = (r) => Lt(t, r), t.readonly = () => jo(t), t.describe = (r) => {
8994
+ })), t.clone = (r, i) => ae(t, r, i), t.brand = () => t, t.register = ((r, i) => (r.add(t, i), t)), t.parse = (r, i) => rd(t, r, i, { callee: t.parse }), t.safeParse = (r, i) => od(t, r, i), t.parseAsync = async (r, i) => id(t, r, i, { callee: t.parseAsync }), t.safeParseAsync = async (r, i) => ad(t, r, i), t.spa = t.safeParseAsync, t.encode = (r, i) => sd(t, r, i), t.decode = (r, i) => cd(t, r, i), t.encodeAsync = async (r, i) => ud(t, r, i), t.decodeAsync = async (r, i) => ld(t, r, i), t.safeEncode = (r, i) => dd(t, r, i), t.safeDecode = (r, i) => hd(t, r, i), t.safeEncodeAsync = async (r, i) => md(t, r, i), t.safeDecodeAsync = async (r, i) => fd(t, r, i), t.refine = (r, i) => t.check(Ao(r, i)), t.superRefine = (r) => t.check(Mo(r)), t.overwrite = (r) => t.check(Pe(r)), t.optional = () => Mt(t), t.nullable = () => Rt(t), t.nullish = () => Mt(Rt(t)), t.nonoptional = (r) => ko(t, r), t.array = () => ve(t), t.or = (r) => wt([t, r]), t.and = (r) => mo(t, r), t.transform = (r) => Lt(t, Or(r)), t.default = (r) => So(t, r), t.prefault = (r) => Io(t, r), t.catch = (r) => Eo(t, r), t.pipe = (r) => Lt(t, r), t.readonly = () => jo(t), t.describe = (r) => {
8995
8995
  const i = t.clone();
8996
8996
  return he.add(i, { description: r }), i;
8997
8997
  }, Object.defineProperty(t, "description", {
@@ -9007,11 +9007,11 @@ const td = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9007
9007
  }, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)), ar = /* @__PURE__ */ h("_ZodString", (t, e) => {
9008
9008
  Yt.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => hl(t, i, n);
9009
9009
  const r = t._zod.bag;
9010
- t.format = r.format ?? null, t.minLength = r.minimum ?? null, t.maxLength = r.maximum ?? null, t.regex = (...i) => t.check(Vn(...i)), t.includes = (...i) => t.check(Kn(...i)), t.startsWith = (...i) => t.check(qn(...i)), t.endsWith = (...i) => t.check(Qn(...i)), t.min = (...i) => t.check(He(...i)), t.max = (...i) => t.check(Kt(...i)), t.length = (...i) => t.check(qt(...i)), t.nonempty = (...i) => t.check(He(1, ...i)), t.lowercase = (i) => t.check(Yn(i)), t.uppercase = (i) => t.check(Hn(i)), t.trim = () => t.check(nr()), t.normalize = (...i) => t.check(tr(...i)), t.toLowerCase = () => t.check(rr()), t.toUpperCase = () => t.check(ir()), t.slugify = () => t.check(or());
9010
+ t.format = r.format ?? null, t.minLength = r.minimum ?? null, t.maxLength = r.maximum ?? null, t.regex = (...i) => t.check(Vn(...i)), t.includes = (...i) => t.check(Kn(...i)), t.startsWith = (...i) => t.check(qn(...i)), t.endsWith = (...i) => t.check(Qn(...i)), t.min = (...i) => t.check(qe(...i)), t.max = (...i) => t.check(Kt(...i)), t.length = (...i) => t.check(qt(...i)), t.nonempty = (...i) => t.check(qe(1, ...i)), t.lowercase = (i) => t.check(Yn(i)), t.uppercase = (i) => t.check(Hn(i)), t.trim = () => t.check(nr()), t.normalize = (...i) => t.check(tr(...i)), t.toLowerCase = () => t.check(rr()), t.toUpperCase = () => t.check(ir()), t.slugify = () => t.check(or());
9011
9011
  }), en = /* @__PURE__ */ h("ZodString", (t, e) => {
9012
9012
  Yt.init(t, e), ar.init(t, e), t.email = (r) => t.check($i(sr, r)), t.url = (r) => t.check(Xn(tn, r)), t.jwt = (r) => t.check(Li(wr, r)), t.emoji = (r) => t.check(ki(cr, r)), t.guid = (r) => t.check(Un(At, r)), t.uuid = (r) => t.check(wi(pe, r)), t.uuidv4 = (r) => t.check(Si(pe, r)), t.uuidv6 = (r) => t.check(xi(pe, r)), t.uuidv7 = (r) => t.check(Ii(pe, r)), t.nanoid = (r) => t.check(zi(ur, r)), t.guid = (r) => t.check(Un(At, r)), t.cuid = (r) => t.check(Oi(lr, r)), t.cuid2 = (r) => t.check(Ei(dr, r)), t.ulid = (r) => t.check(Ti(hr, r)), t.base64 = (r) => t.check(Ai(br, r)), t.base64url = (r) => t.check(Mi(_r, r)), t.xid = (r) => t.check(Pi(mr, r)), t.ksuid = (r) => t.check(ji(fr, r)), t.ipv4 = (r) => t.check(Ui(gr, r)), t.ipv6 = (r) => t.check(Ni(pr, r)), t.cidrv4 = (r) => t.check(Ci(vr, r)), t.cidrv6 = (r) => t.check(Di(yr, r)), t.e164 = (r) => t.check(Ri($r, r)), t.datetime = (r) => t.check(Kl(r)), t.date = (r) => t.check(ql(r)), t.time = (r) => t.check(Ql(r)), t.duration = (r) => t.check(ed(r));
9013
9013
  });
9014
- function De(t) {
9014
+ function Ae(t) {
9015
9015
  return Iu(en, t);
9016
9016
  }
9017
9017
  const N = /* @__PURE__ */ h("ZodStringFormat", (t, e) => {
@@ -9152,49 +9152,49 @@ const wr = /* @__PURE__ */ h("ZodJWT", (t, e) => {
9152
9152
  function Md(t) {
9153
9153
  return Li(wr, t);
9154
9154
  }
9155
- const _t = /* @__PURE__ */ h("ZodCustomStringFormat", (t, e) => {
9155
+ const $t = /* @__PURE__ */ h("ZodCustomStringFormat", (t, e) => {
9156
9156
  Pc.init(t, e), N.init(t, e);
9157
9157
  });
9158
9158
  function Rd(t, e, r = {}) {
9159
- return Qt(_t, t, e, r);
9159
+ return Qt($t, t, e, r);
9160
9160
  }
9161
9161
  function Ld(t) {
9162
- return Qt(_t, "hostname", _s, t);
9162
+ return Qt($t, "hostname", _s, t);
9163
9163
  }
9164
9164
  function Zd(t) {
9165
- return Qt(_t, "hex", As, t);
9165
+ return Qt($t, "hex", As, t);
9166
9166
  }
9167
9167
  function Fd(t, e) {
9168
9168
  const r = e?.enc ?? "hex", i = `${t}_${r}`, n = di[i];
9169
9169
  if (!n)
9170
9170
  throw new Error(`Unrecognized hash format: ${i}`);
9171
- return Qt(_t, i, n, e);
9171
+ return Qt($t, i, n, e);
9172
9172
  }
9173
9173
  const nn = /* @__PURE__ */ h("ZodNumber", (t, e) => {
9174
- gi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => ml(t, i, n), t.gt = (i, n) => t.check(Re(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Me(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.int = (i) => t.check(Nn(i)), t.safe = (i) => t.check(Nn(i)), t.positive = (i) => t.check(Re(0, i)), t.nonnegative = (i) => t.check(te(0, i)), t.negative = (i) => t.check(Me(0, i)), t.nonpositive = (i) => t.check(ie(0, i)), t.multipleOf = (i, n) => t.check(mt(i, n)), t.step = (i, n) => t.check(mt(i, n)), t.finite = () => t;
9174
+ gi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => ml(t, i, n), t.gt = (i, n) => t.check(Le(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Re(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.int = (i) => t.check(Nn(i)), t.safe = (i) => t.check(Nn(i)), t.positive = (i) => t.check(Le(0, i)), t.nonnegative = (i) => t.check(te(0, i)), t.negative = (i) => t.check(Re(0, i)), t.nonpositive = (i) => t.check(ie(0, i)), t.multipleOf = (i, n) => t.check(ft(i, n)), t.step = (i, n) => t.check(ft(i, n)), t.finite = () => t;
9175
9175
  const r = t._zod.bag;
9176
9176
  t.minValue = Math.max(r.minimum ?? Number.NEGATIVE_INFINITY, r.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, t.maxValue = Math.min(r.maximum ?? Number.POSITIVE_INFINITY, r.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, t.isInt = (r.format ?? "").includes("int") || Number.isSafeInteger(r.multipleOf ?? 0.5), t.isFinite = !0, t.format = r.format ?? null;
9177
9177
  });
9178
9178
  function z(t) {
9179
9179
  return Uu(nn, t);
9180
9180
  }
9181
- const et = /* @__PURE__ */ h("ZodNumberFormat", (t, e) => {
9181
+ const nt = /* @__PURE__ */ h("ZodNumberFormat", (t, e) => {
9182
9182
  jc.init(t, e), nn.init(t, e);
9183
9183
  });
9184
9184
  function Nn(t) {
9185
- return Cu(et, t);
9185
+ return Cu(nt, t);
9186
9186
  }
9187
9187
  function Bd(t) {
9188
- return Du(et, t);
9188
+ return Du(nt, t);
9189
9189
  }
9190
9190
  function Wd(t) {
9191
- return Au(et, t);
9191
+ return Au(nt, t);
9192
9192
  }
9193
9193
  function Gd(t) {
9194
- return Mu(et, t);
9194
+ return Mu(nt, t);
9195
9195
  }
9196
9196
  function Xd(t) {
9197
- return Ru(et, t);
9197
+ return Ru(nt, t);
9198
9198
  }
9199
9199
  const rn = /* @__PURE__ */ h("ZodBoolean", (t, e) => {
9200
9200
  pi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => fl(t, r, i);
@@ -9203,7 +9203,7 @@ function qi(t) {
9203
9203
  return Lu(rn, t);
9204
9204
  }
9205
9205
  const on = /* @__PURE__ */ h("ZodBigInt", (t, e) => {
9206
- vi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => gl(t, i), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.gt = (i, n) => t.check(Re(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Me(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.positive = (i) => t.check(Re(BigInt(0), i)), t.negative = (i) => t.check(Me(BigInt(0), i)), t.nonpositive = (i) => t.check(ie(BigInt(0), i)), t.nonnegative = (i) => t.check(te(BigInt(0), i)), t.multipleOf = (i, n) => t.check(mt(i, n));
9206
+ vi.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => gl(t, i), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.gt = (i, n) => t.check(Le(i, n)), t.gte = (i, n) => t.check(te(i, n)), t.min = (i, n) => t.check(te(i, n)), t.lt = (i, n) => t.check(Re(i, n)), t.lte = (i, n) => t.check(ie(i, n)), t.max = (i, n) => t.check(ie(i, n)), t.positive = (i) => t.check(Le(BigInt(0), i)), t.negative = (i) => t.check(Re(BigInt(0), i)), t.nonpositive = (i) => t.check(ie(BigInt(0), i)), t.nonnegative = (i) => t.check(te(BigInt(0), i)), t.multipleOf = (i, n) => t.check(ft(i, n));
9207
9207
  const r = t._zod.bag;
9208
9208
  t.minValue = r.minimum ?? null, t.maxValue = r.maximum ?? null, t.format = r.format ?? null;
9209
9209
  });
@@ -9246,7 +9246,7 @@ function qd() {
9246
9246
  const io = /* @__PURE__ */ h("ZodUnknown", (t, e) => {
9247
9247
  Mc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => wl();
9248
9248
  });
9249
- function Ke() {
9249
+ function Qe() {
9250
9250
  return Hu(io);
9251
9251
  }
9252
9252
  const oo = /* @__PURE__ */ h("ZodNever", (t, e) => {
@@ -9270,7 +9270,7 @@ function eh(t) {
9270
9270
  return Qu(Ir, t);
9271
9271
  }
9272
9272
  const so = /* @__PURE__ */ h("ZodArray", (t, e) => {
9273
- Fc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Cl(t, r, i, n), t.element = e.element, t.min = (r, i) => t.check(He(r, i)), t.nonempty = (r) => t.check(He(1, r)), t.max = (r, i) => t.check(Kt(r, i)), t.length = (r, i) => t.check(qt(r, i)), t.unwrap = () => t.element;
9273
+ Fc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Cl(t, r, i, n), t.element = e.element, t.min = (r, i) => t.check(qe(r, i)), t.nonempty = (r) => t.check(qe(1, r)), t.max = (r, i) => t.check(Kt(r, i)), t.length = (r, i) => t.check(qt(r, i)), t.unwrap = () => t.element;
9274
9274
  });
9275
9275
  function ve(t, e) {
9276
9276
  return nl(so, t, e);
@@ -9280,7 +9280,7 @@ function th(t) {
9280
9280
  return zr(Object.keys(e));
9281
9281
  }
9282
9282
  const an = /* @__PURE__ */ h("ZodObject", (t, e) => {
9283
- Xc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Dl(t, r, i, n), O(t, "shape", () => e.shape), t.keyof = () => zr(Object.keys(t._zod.def.shape)), t.catchall = (r) => t.clone({ ...t._zod.def, catchall: r }), t.passthrough = () => t.clone({ ...t._zod.def, catchall: Ke() }), t.loose = () => t.clone({ ...t._zod.def, catchall: Ke() }), t.strict = () => t.clone({ ...t._zod.def, catchall: xr() }), t.strip = () => t.clone({ ...t._zod.def, catchall: void 0 }), t.extend = (r) => Ba(t, r), t.safeExtend = (r) => Wa(t, r), t.merge = (r) => Ga(t, r), t.pick = (r) => Za(t, r), t.omit = (r) => Fa(t, r), t.partial = (...r) => Xa(Er, t, r[0]), t.required = (...r) => Ja(Tr, t, r[0]);
9283
+ Xc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Dl(t, r, i, n), O(t, "shape", () => e.shape), t.keyof = () => zr(Object.keys(t._zod.def.shape)), t.catchall = (r) => t.clone({ ...t._zod.def, catchall: r }), t.passthrough = () => t.clone({ ...t._zod.def, catchall: Qe() }), t.loose = () => t.clone({ ...t._zod.def, catchall: Qe() }), t.strict = () => t.clone({ ...t._zod.def, catchall: xr() }), t.strip = () => t.clone({ ...t._zod.def, catchall: void 0 }), t.extend = (r) => Ba(t, r), t.safeExtend = (r) => Wa(t, r), t.merge = (r) => Ga(t, r), t.pick = (r) => Za(t, r), t.omit = (r) => Fa(t, r), t.partial = (...r) => Xa(Er, t, r[0]), t.required = (...r) => Ja(Tr, t, r[0]);
9284
9284
  });
9285
9285
  function me(t, e) {
9286
9286
  const r = {
@@ -9302,14 +9302,14 @@ function rh(t, e) {
9302
9302
  return new an({
9303
9303
  type: "object",
9304
9304
  shape: t,
9305
- catchall: Ke(),
9305
+ catchall: Qe(),
9306
9306
  ...p(e)
9307
9307
  });
9308
9308
  }
9309
9309
  const sn = /* @__PURE__ */ h("ZodUnion", (t, e) => {
9310
9310
  Gn.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Xi(t, r, i, n), t.options = e.options;
9311
9311
  });
9312
- function $t(t, e) {
9312
+ function wt(t, e) {
9313
9313
  return new sn({
9314
9314
  type: "union",
9315
9315
  options: t,
@@ -9404,7 +9404,7 @@ function sh(t, e, r) {
9404
9404
  });
9405
9405
  }
9406
9406
  const vo = /* @__PURE__ */ h("ZodSet", (t, e) => {
9407
- qc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Nl(t, r), t.min = (...r) => t.check(ft(...r)), t.nonempty = (r) => t.check(ft(1, r)), t.max = (...r) => t.check(Ht(...r)), t.size = (...r) => t.check(Jn(...r));
9407
+ qc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Nl(t, r), t.min = (...r) => t.check(gt(...r)), t.nonempty = (r) => t.check(gt(1, r)), t.max = (...r) => t.check(Ht(...r)), t.size = (...r) => t.check(Jn(...r));
9408
9408
  });
9409
9409
  function ch(t, e) {
9410
9410
  return new vo({
@@ -9413,7 +9413,7 @@ function ch(t, e) {
9413
9413
  ...p(e)
9414
9414
  });
9415
9415
  }
9416
- const yt = /* @__PURE__ */ h("ZodEnum", (t, e) => {
9416
+ const bt = /* @__PURE__ */ h("ZodEnum", (t, e) => {
9417
9417
  Qc.init(t, e), k.init(t, e), t._zod.processJSONSchema = (i, n, o) => xl(t, i, n), t.enum = e.entries, t.options = Object.values(e.entries);
9418
9418
  const r = new Set(Object.keys(e.entries));
9419
9419
  t.extract = (i, n) => {
@@ -9423,7 +9423,7 @@ const yt = /* @__PURE__ */ h("ZodEnum", (t, e) => {
9423
9423
  o[a] = e.entries[a];
9424
9424
  else
9425
9425
  throw new Error(`Key ${a} not found in enum`);
9426
- return new yt({
9426
+ return new bt({
9427
9427
  ...e,
9428
9428
  checks: [],
9429
9429
  ...p(n),
@@ -9436,7 +9436,7 @@ const yt = /* @__PURE__ */ h("ZodEnum", (t, e) => {
9436
9436
  delete o[a];
9437
9437
  else
9438
9438
  throw new Error(`Key ${a} not found in enum`);
9439
- return new yt({
9439
+ return new bt({
9440
9440
  ...e,
9441
9441
  checks: [],
9442
9442
  ...p(n),
@@ -9446,14 +9446,14 @@ const yt = /* @__PURE__ */ h("ZodEnum", (t, e) => {
9446
9446
  });
9447
9447
  function zr(t, e) {
9448
9448
  const r = Array.isArray(t) ? Object.fromEntries(t.map((i) => [i, i])) : t;
9449
- return new yt({
9449
+ return new bt({
9450
9450
  type: "enum",
9451
9451
  entries: r,
9452
9452
  ...p(e)
9453
9453
  });
9454
9454
  }
9455
9455
  function uh(t, e) {
9456
- return new yt({
9456
+ return new bt({
9457
9457
  type: "enum",
9458
9458
  entries: t,
9459
9459
  ...p(e)
@@ -9468,7 +9468,7 @@ const yo = /* @__PURE__ */ h("ZodLiteral", (t, e) => {
9468
9468
  }
9469
9469
  });
9470
9470
  });
9471
- function We(t, e) {
9471
+ function Xe(t, e) {
9472
9472
  return new yo({
9473
9473
  type: "literal",
9474
9474
  values: Array.isArray(t) ? t : [t],
@@ -9476,7 +9476,7 @@ function We(t, e) {
9476
9476
  });
9477
9477
  }
9478
9478
  const bo = /* @__PURE__ */ h("ZodFile", (t, e) => {
9479
- tu.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Ol(t, r, i), t.min = (r, i) => t.check(ft(r, i)), t.max = (r, i) => t.check(Ht(r, i)), t.mime = (r, i) => t.check(er(Array.isArray(r) ? r : [r], i));
9479
+ tu.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Ol(t, r, i), t.min = (r, i) => t.check(gt(r, i)), t.max = (r, i) => t.check(Ht(r, i)), t.mime = (r, i) => t.check(er(Array.isArray(r) ? r : [r], i));
9480
9480
  });
9481
9481
  function lh(t) {
9482
9482
  return rl(bo, t);
@@ -9487,10 +9487,10 @@ const _o = /* @__PURE__ */ h("ZodTransform", (t, e) => {
9487
9487
  throw new Ln(t.constructor.name);
9488
9488
  r.addIssue = (o) => {
9489
9489
  if (typeof o == "string")
9490
- r.issues.push(dt(o, r.value, e));
9490
+ r.issues.push(ht(o, r.value, e));
9491
9491
  else {
9492
9492
  const a = o;
9493
- a.fatal && (a.continue = !1), a.code ?? (a.code = "custom"), a.input ?? (a.input = r.value), a.inst ?? (a.inst = t), r.issues.push(dt(a));
9493
+ a.fatal && (a.continue = !1), a.code ?? (a.code = "custom"), a.input ?? (a.input = r.value), a.inst ?? (a.inst = t), r.issues.push(ht(a));
9494
9494
  }
9495
9495
  };
9496
9496
  const n = e.transform(r.value, r);
@@ -9649,15 +9649,15 @@ const Do = /* @__PURE__ */ h("ZodFunction", (t, e) => {
9649
9649
  function Cn(t) {
9650
9650
  return new Do({
9651
9651
  type: "function",
9652
- input: Array.isArray(t?.input) ? kr(t?.input) : t?.input ?? ve(Ke()),
9653
- output: t?.output ?? Ke()
9652
+ input: Array.isArray(t?.input) ? kr(t?.input) : t?.input ?? ve(Qe()),
9653
+ output: t?.output ?? Qe()
9654
9654
  });
9655
9655
  }
9656
9656
  const un = /* @__PURE__ */ h("ZodCustom", (t, e) => {
9657
9657
  vu.init(t, e), k.init(t, e), t._zod.processJSONSchema = (r, i, n) => Tl(t, r);
9658
9658
  });
9659
9659
  function vh(t) {
9660
- const e = new M({
9660
+ const e = new R({
9661
9661
  check: "custom"
9662
9662
  // ...util.normalizeParams(params),
9663
9663
  });
@@ -9691,7 +9691,7 @@ const wh = (...t) => ll({
9691
9691
  String: en
9692
9692
  }, ...t);
9693
9693
  function Sh(t) {
9694
- const e = Ur(() => $t([De(t), z(), qi(), no(), ve(e), go(De(), e)]));
9694
+ const e = Ur(() => wt([Ae(t), z(), qi(), no(), ve(e), go(Ae(), e)]));
9695
9695
  return e;
9696
9696
  }
9697
9697
  function xh(t, e) {
@@ -9713,14 +9713,14 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9713
9713
  ZodCatch: Oo,
9714
9714
  ZodCodec: jr,
9715
9715
  ZodCustom: un,
9716
- ZodCustomStringFormat: _t,
9716
+ ZodCustomStringFormat: $t,
9717
9717
  ZodDate: Ir,
9718
9718
  ZodDefault: wo,
9719
9719
  ZodDiscriminatedUnion: uo,
9720
9720
  ZodE164: $r,
9721
9721
  ZodEmail: sr,
9722
9722
  ZodEmoji: cr,
9723
- ZodEnum: yt,
9723
+ ZodEnum: bt,
9724
9724
  ZodFile: bo,
9725
9725
  ZodFunction: Do,
9726
9726
  ZodGUID: At,
@@ -9740,7 +9740,7 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9740
9740
  ZodNull: to,
9741
9741
  ZodNullable: $o,
9742
9742
  ZodNumber: nn,
9743
- ZodNumberFormat: et,
9743
+ ZodNumberFormat: nt,
9744
9744
  ZodObject: an,
9745
9745
  ZodOptional: Er,
9746
9746
  ZodPipe: Pr,
@@ -9811,7 +9811,7 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9811
9811
  keyof: th,
9812
9812
  ksuid: Ed,
9813
9813
  lazy: Ur,
9814
- literal: We,
9814
+ literal: Xe,
9815
9815
  looseObject: rh,
9816
9816
  looseRecord: ah,
9817
9817
  mac: Pd,
@@ -9838,7 +9838,7 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9838
9838
  refine: Ao,
9839
9839
  set: ch,
9840
9840
  strictObject: nh,
9841
- string: De,
9841
+ string: Ae,
9842
9842
  stringFormat: Rd,
9843
9843
  stringbool: wh,
9844
9844
  success: hh,
@@ -9851,8 +9851,8 @@ const Sp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9851
9851
  uint64: Yd,
9852
9852
  ulid: zd,
9853
9853
  undefined: Kd,
9854
- union: $t,
9855
- unknown: Ke,
9854
+ union: wt,
9855
+ unknown: Qe,
9856
9856
  url: $d,
9857
9857
  uuid: vd,
9858
9858
  uuidv4: yd,
@@ -10128,14 +10128,14 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10128
10128
  ZodCatch: Oo,
10129
10129
  ZodCodec: jr,
10130
10130
  ZodCustom: un,
10131
- ZodCustomStringFormat: _t,
10131
+ ZodCustomStringFormat: $t,
10132
10132
  ZodDate: Ir,
10133
10133
  ZodDefault: wo,
10134
10134
  ZodDiscriminatedUnion: uo,
10135
10135
  ZodE164: $r,
10136
10136
  ZodEmail: sr,
10137
10137
  ZodEmoji: cr,
10138
- ZodEnum: yt,
10138
+ ZodEnum: bt,
10139
10139
  ZodError: wp,
10140
10140
  ZodFile: bo,
10141
10141
  get ZodFirstPartyTypeKind() {
@@ -10164,7 +10164,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10164
10164
  ZodNull: to,
10165
10165
  ZodNullable: $o,
10166
10166
  ZodNumber: nn,
10167
- ZodNumberFormat: et,
10167
+ ZodNumberFormat: nt,
10168
10168
  ZodObject: an,
10169
10169
  ZodOptional: Er,
10170
10170
  ZodPipe: Pr,
@@ -10233,7 +10233,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10233
10233
  function: Cn,
10234
10234
  getErrorMap: kp,
10235
10235
  globalRegistry: he,
10236
- gt: Re,
10236
+ gt: Le,
10237
10237
  gte: te,
10238
10238
  guid: pd,
10239
10239
  hash: Fd,
@@ -10255,12 +10255,12 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10255
10255
  ksuid: Ed,
10256
10256
  lazy: Ur,
10257
10257
  length: qt,
10258
- literal: We,
10258
+ literal: Xe,
10259
10259
  locales: $u,
10260
10260
  looseObject: rh,
10261
10261
  looseRecord: ah,
10262
10262
  lowercase: Yn,
10263
- lt: Me,
10263
+ lt: Re,
10264
10264
  lte: ie,
10265
10265
  mac: Pd,
10266
10266
  map: sh,
@@ -10268,9 +10268,9 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10268
10268
  maxSize: Ht,
10269
10269
  meta: _h,
10270
10270
  mime: er,
10271
- minLength: He,
10272
- minSize: ft,
10273
- multipleOf: mt,
10271
+ minLength: qe,
10272
+ minSize: gt,
10273
+ multipleOf: ft,
10274
10274
  nan: mh,
10275
10275
  nanoid: xd,
10276
10276
  nativeEnum: uh,
@@ -10315,7 +10315,7 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10315
10315
  slugify: or,
10316
10316
  startsWith: qn,
10317
10317
  strictObject: nh,
10318
- string: De,
10318
+ string: Ae,
10319
10319
  stringFormat: Rd,
10320
10320
  stringbool: wh,
10321
10321
  success: hh,
@@ -10333,8 +10333,8 @@ const we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10333
10333
  uint64: Yd,
10334
10334
  ulid: zd,
10335
10335
  undefined: Kd,
10336
- union: $t,
10337
- unknown: Ke,
10336
+ union: wt,
10337
+ unknown: Qe,
10338
10338
  uppercase: Hn,
10339
10339
  url: $d,
10340
10340
  util: Ha,
@@ -10396,7 +10396,7 @@ function Lp(t) {
10396
10396
  return r.remove(), n;
10397
10397
  }
10398
10398
  async function zh(t, e, r, i, n = !0) {
10399
- const o = await navigator.clipboard.read(), a = o[0].types, [s, u] = n ? [t, e] : Fe(t, e, r);
10399
+ const o = await navigator.clipboard.read(), a = o[0].types, [s, u] = n ? [t, e] : We(t, e, r);
10400
10400
  for (const c of a) {
10401
10401
  if (!Mp.find(
10402
10402
  (f) => f.endsWith("/") ? c.startsWith(f) : c === f
@@ -10418,15 +10418,15 @@ async function zh(t, e, r, i, n = !0) {
10418
10418
  }
10419
10419
  const P = w.data;
10420
10420
  if (P.elements.length === 0) return;
10421
- let R = 1 / 0, C = 1 / 0;
10421
+ let L = 1 / 0, A = 1 / 0;
10422
10422
  for (const S of P.elements)
10423
- S.x < R && (R = S.x), S.y < C && (C = S.y);
10423
+ S.x < L && (L = S.x), S.y < A && (A = S.y);
10424
10424
  const E = await Promise.all(
10425
10425
  P.elements.map(
10426
10426
  (S) => r.addImageToCanvas(
10427
10427
  S.src,
10428
- s + S.x - R,
10429
- u + S.y - C,
10428
+ s + S.x - L,
10429
+ u + S.y - A,
10430
10430
  S.sx,
10431
10431
  S.sy
10432
10432
  )
@@ -10476,10 +10476,10 @@ const ke = {
10476
10476
  }, ze = {
10477
10477
  Save: "save",
10478
10478
  Change: "statechange"
10479
- }, nt = {
10479
+ }, Ue = {
10480
10480
  start: "startloading",
10481
10481
  done: "completeloading"
10482
- }, rt = {
10482
+ }, it = {
10483
10483
  Save: "save",
10484
10484
  SaveCompleted: "savecompleted",
10485
10485
  SaveFailed: "savefailed"
@@ -10646,7 +10646,7 @@ class la {
10646
10646
  this.width = (n - i) / this.target.sx * e, this.height = (a - o) / this.target.sy * r;
10647
10647
  }
10648
10648
  getSidesInScreenSpace(e, r) {
10649
- const [i, n] = r ? Je(r) : [1, 1], { width: o, height: a, borderSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10649
+ const [i, n] = r ? Ye(r) : [1, 1], { width: o, height: a, borderSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10650
10650
  return {
10651
10651
  TOP: {
10652
10652
  x: l > 0 ? u : u - o * i,
@@ -10675,7 +10675,7 @@ class la {
10675
10675
  }[e];
10676
10676
  }
10677
10677
  getCornersInScreenSpace(e, r) {
10678
- const [i, n] = r ? Je(r) : [1, 1], { width: o, height: a, boxSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10678
+ const [i, n] = r ? Ye(r) : [1, 1], { width: o, height: a, boxSize: s } = this, [u, c] = le(r), [l, d] = kt(r);
10679
10679
  return {
10680
10680
  TOPLEFT: {
10681
10681
  x: u - s,
@@ -10717,7 +10717,7 @@ class la {
10717
10717
  */
10718
10718
  hitTest(e, r, i) {
10719
10719
  if (this.mode === ce.PASSIVE) return;
10720
- const [n, o] = Je(this.target.worldMatrix), [a, s] = kt(this.target.worldMatrix), [u, c] = le(i, e, r), l = 4;
10720
+ const [n, o] = Ye(this.target.worldMatrix), [a, s] = kt(this.target.worldMatrix), [u, c] = le(i, e, r), l = 4;
10721
10721
  for (const E of yn) {
10722
10722
  const S = this.getCornersInScreenSpace(
10723
10723
  E,
@@ -10731,8 +10731,8 @@ class la {
10731
10731
  if (u >= S.x - l && u <= S.x + S.width + l && c >= S.y - l && c <= S.y + S.height + l)
10732
10732
  return E;
10733
10733
  }
10734
- const [d, m] = le(this.target.worldMatrix), f = this.width * n * a, $ = this.height * o * s, w = Math.min(d, d + f), P = Math.max(d, d + f), R = Math.min(m, m + $), C = Math.max(m, m + $);
10735
- if (u >= w && u <= P && c >= R && c <= C)
10734
+ const [d, m] = le(this.target.worldMatrix), f = this.width * n * a, $ = this.height * o * s, w = Math.min(d, d + f), P = Math.max(d, d + f), L = Math.min(m, m + $), A = Math.max(m, m + $);
10735
+ if (u >= w && u <= P && c >= L && c <= A)
10736
10736
  return "CENTER";
10737
10737
  }
10738
10738
  update() {
@@ -10755,23 +10755,23 @@ class la {
10755
10755
  this.target.updateTranslation(e, r);
10756
10756
  }
10757
10757
  resize(e, r, i) {
10758
- if (this.target instanceof Ae) {
10758
+ if (this.target instanceof Me) {
10759
10759
  const n = Math.abs(this.width), o = Math.abs(this.height), a = n / o, s = this.target.sx, u = this.target.sy, c = 1e-6, l = Math.abs(n * s) < c ? c * kn(n * s || 1, c) : n * s, d = Math.abs(o * u) < c ? c * kn(o * u || 1, c) : o * u, m = e / l, f = r / d, $ = c, w = i === "LEFT" || i === "BOTTOMLEFT" || i === "TOPLEFT" ? 1 - m : i === "RIGHT" || i === "BOTTOMRIGHT" || i === "TOPRIGHT" ? 1 + m : i === "TOP" ? 1 - f : 1 + f;
10760
10760
  if (zn(s, w, $) || zn(u, w, $)) return;
10761
- const P = n * s * w, R = o * u * w;
10762
- if (Math.abs(P) < $ || Math.abs(R) < $) return;
10761
+ const P = n * s * w, L = o * u * w;
10762
+ if (Math.abs(P) < $ || Math.abs(L) < $) return;
10763
10763
  if (this.target.updateScale(w, w), i === "LEFT") {
10764
- const C = o * u, E = o * this.target.sy;
10765
- this.target.updateTranslation(e, (C - E) / 2);
10764
+ const A = o * u, E = o * this.target.sy;
10765
+ this.target.updateTranslation(e, (A - E) / 2);
10766
10766
  } else if (i === "RIGHT") {
10767
- const C = o * u, E = o * this.target.sy;
10768
- this.target.updateTranslation(0, (C - E) / 2);
10767
+ const A = o * u, E = o * this.target.sy;
10768
+ this.target.updateTranslation(0, (A - E) / 2);
10769
10769
  } else if (i === "TOP") {
10770
- const C = n * s, E = n * this.target.sx;
10771
- this.target.updateTranslation((C - E) / 2, r);
10770
+ const A = n * s, E = n * this.target.sx;
10771
+ this.target.updateTranslation((A - E) / 2, r);
10772
10772
  } else if (i === "BOTTOM") {
10773
- const C = n * s, E = n * this.target.sx;
10774
- this.target.updateTranslation((C - E) / 2, 0);
10773
+ const A = n * s, E = n * this.target.sx;
10774
+ this.target.updateTranslation((A - E) / 2, 0);
10775
10775
  } else i === "BOTTOMLEFT" ? this.target.updateTranslation(e, 0) : i === "TOPLEFT" ? this.target.updateTranslation(
10776
10776
  e,
10777
10777
  e / a * Math.sign(this.target.sx)
@@ -10800,10 +10800,10 @@ class la {
10800
10800
  }
10801
10801
  addCorners() {
10802
10802
  for (const e of yn) {
10803
- const r = new Ae(
10803
+ const r = new Me(
10804
10804
  this.getCornersInScreenSpace(e, this.target.worldMatrix)
10805
10805
  );
10806
- r.color = this.mode === ce.ACTIVE ? at : hn, this.corners.set(e, r);
10806
+ r.color = this.mode === ce.ACTIVE ? st : hn, this.corners.set(e, r);
10807
10807
  }
10808
10808
  }
10809
10809
  removeCorners() {
@@ -10815,21 +10815,21 @@ class la {
10815
10815
  e,
10816
10816
  this.target.worldMatrix
10817
10817
  ), i = this.corners.get(e);
10818
- i && (i.setTranslation(r.x, r.y), i.width = r.width, i.height = r.height, i.color = this.mode === ce.ACTIVE ? at : hn);
10818
+ i && (i.setTranslation(r.x, r.y), i.width = r.width, i.height = r.height, i.color = this.mode === ce.ACTIVE ? st : hn);
10819
10819
  }
10820
10820
  }
10821
10821
  addSides() {
10822
10822
  for (const e of Nt) {
10823
- const r = new Ae(
10823
+ const r = new Me(
10824
10824
  this.getSidesInScreenSpace(e, this.target.worldMatrix)
10825
10825
  );
10826
- r.color = this.mode === ce.ACTIVE ? at : hn, this.sides.set(e, r);
10826
+ r.color = this.mode === ce.ACTIVE ? st : hn, this.sides.set(e, r);
10827
10827
  }
10828
10828
  }
10829
10829
  updateSides() {
10830
10830
  for (const e of Nt) {
10831
10831
  const r = this.getSidesInScreenSpace(e, this.target.worldMatrix), i = this.sides.get(e);
10832
- i && (i.setTranslation(r.x, r.y), i.width = r.width, i.height = r.height, i.color = this.mode === ce.ACTIVE ? at : hn);
10832
+ i && (i.setTranslation(r.x, r.y), i.width = r.width, i.height = r.height, i.color = this.mode === ce.ACTIVE ? st : hn);
10833
10833
  }
10834
10834
  }
10835
10835
  }
@@ -10866,18 +10866,18 @@ class Jp {
10866
10866
  }
10867
10867
  // dx and dy are in world units
10868
10868
  resize(e, r, i, n) {
10869
- const o = this.width, a = this.height, s = i.includes("TOP"), u = i.includes("BOTTOM"), c = i.includes("LEFT"), l = i.includes("RIGHT"), d = c ? this.x + o : l ? this.x : this.x + o / 2, m = s ? this.y + a : u ? this.y : this.y + a / 2, f = 1e-6, $ = Math.abs(o) < f ? o < 0 ? -f : f : o, w = Math.abs(a) < f ? a < 0 ? -f : f : a, [P, R] = Je(n), C = e * P / $, E = r * R / w, S = i.includes("LEFT") ? 1 - C : i.includes("RIGHT") ? 1 + C : i === "TOP" ? 1 - E : 1 + E;
10869
+ const o = this.width, a = this.height, s = i.includes("TOP"), u = i.includes("BOTTOM"), c = i.includes("LEFT"), l = i.includes("RIGHT"), d = c ? this.x + o : l ? this.x : this.x + o / 2, m = s ? this.y + a : u ? this.y : this.y + a / 2, f = 1e-6, $ = Math.abs(o) < f ? o < 0 ? -f : f : o, w = Math.abs(a) < f ? a < 0 ? -f : f : a, [P, L] = Ye(n), A = e * P / $, E = r * L / w, S = i.includes("LEFT") ? 1 - A : i.includes("RIGHT") ? 1 + A : i === "TOP" ? 1 - E : 1 + E;
10870
10870
  if (zn(this.scale[0], S, f) || zn(this.scale[1], S, f))
10871
10871
  return;
10872
- const se = o * S, wt = a * S;
10873
- if (!(Math.abs(se) < f || Math.abs(wt) < f))
10872
+ const se = o * S, St = a * S;
10873
+ if (!(Math.abs(se) < f || Math.abs(St) < f))
10874
10874
  for (const J of this.targets) {
10875
- const je = J.x, Ze = J.y, [ln, dn] = le(n, je, Ze), tt = d + (ln - d) * S, Rh = m + (dn - m) * S, Lh = tt - ln, Zh = Rh - dn, Fh = Math.abs(P) < f ? P < 0 ? -f : f : P, Bh = Math.abs(R) < f ? R < 0 ? -f : f : R, Wh = Lh / Fh, Gh = Zh / Bh;
10875
+ const je = J.x, Fe = J.y, [ln, dn] = le(n, je, Fe), rt = d + (ln - d) * S, Rh = m + (dn - m) * S, Lh = rt - ln, Zh = Rh - dn, Fh = Math.abs(P) < f ? P < 0 ? -f : f : P, Bh = Math.abs(L) < f ? L < 0 ? -f : f : L, Wh = Lh / Fh, Gh = Zh / Bh;
10876
10876
  J.updateScale(S, S), J.updateTranslation(Wh, Gh);
10877
10877
  }
10878
10878
  }
10879
10879
  flip(e, r, i) {
10880
- Je(e);
10880
+ Ye(e);
10881
10881
  const n = [], [o, a] = i(this.x, this.y), [s, u] = i(
10882
10882
  this.x + this.width,
10883
10883
  this.y + this.height
@@ -11019,8 +11019,8 @@ class Jp {
11019
11019
  }
11020
11020
  addHandles() {
11021
11021
  for (const e of Ar) {
11022
- const r = this.getHandleConfig(e), i = new Ae(r);
11023
- i.color = at, this.handles.set(e, i);
11022
+ const r = this.getHandleConfig(e), i = new Me(r);
11023
+ i.color = st, this.handles.set(e, i);
11024
11024
  }
11025
11025
  }
11026
11026
  updateHandles() {
@@ -11083,7 +11083,7 @@ class Jp {
11083
11083
  }[e];
11084
11084
  }
11085
11085
  }
11086
- class qe {
11086
+ class et {
11087
11087
  // matrix: number[];
11088
11088
  constructor(e, r, i, n) {
11089
11089
  this.minX = e, this.minY = r, this.maxX = i, this.maxY = n;
@@ -11155,16 +11155,16 @@ class Vp {
11155
11155
  */
11156
11156
  getBoundingBox(e) {
11157
11157
  const [r, i] = e(this.x, this.y), [n, o] = e(this.x + this.width, this.y + this.height), a = Math.min(r, n), s = Math.max(r, n), u = Math.min(i, o), c = Math.max(i, o);
11158
- return new qe(a, u, s, c);
11158
+ return new et(a, u, s, c);
11159
11159
  }
11160
11160
  resize(e, r, i) {
11161
- const [n, o] = Je(i);
11161
+ const [n, o] = Ye(i);
11162
11162
  this.width += e * n, this.height += r * o;
11163
11163
  }
11164
11164
  addRects() {
11165
11165
  for (const e of da) {
11166
- const r = this.getRectConfig(e), i = new Ae(r);
11167
- i.color = at, this.rects.set(e, i);
11166
+ const r = this.getRectConfig(e), i = new Me(r);
11167
+ i.color = st, this.rects.set(e, i);
11168
11168
  }
11169
11169
  }
11170
11170
  updateRects() {
@@ -11191,16 +11191,16 @@ class Yp {
11191
11191
  height: ee,
11192
11192
  rotation: ee,
11193
11193
  zoom: ee,
11194
- setX: A,
11195
- setY: A,
11196
- setPosition: A,
11197
- incrementPosition: A,
11198
- setWidth: A,
11199
- setHeight: A,
11200
- setSize: A,
11201
- setZoom: A,
11202
- setRotation: A,
11203
- stateVector: ot
11194
+ setX: M,
11195
+ setY: M,
11196
+ setPosition: M,
11197
+ incrementPosition: M,
11198
+ setWidth: M,
11199
+ setHeight: M,
11200
+ setSize: M,
11201
+ setZoom: M,
11202
+ setRotation: M,
11203
+ stateVector: at
11204
11204
  });
11205
11205
  }
11206
11206
  // Actions
@@ -11241,20 +11241,20 @@ class Yp {
11241
11241
  return [this.x, this.y, this.width, this.height, this.rotation, this.zoom];
11242
11242
  }
11243
11243
  get translationMatrix() {
11244
- return L.translation(this.x, this.y);
11244
+ return F.translation(this.x, this.y);
11245
11245
  }
11246
11246
  get rotationMatrix() {
11247
- return L.rotation(this.rotation);
11247
+ return F.rotation(this.rotation);
11248
11248
  }
11249
11249
  get scaleMatrix() {
11250
- return L.scaling(this.zoom, this.zoom);
11250
+ return F.scaling(this.zoom, this.zoom);
11251
11251
  }
11252
11252
  get cameraMatrix() {
11253
- const e = L.multiply(this.translationMatrix, this.rotationMatrix);
11254
- return L.multiply(e, this.scaleMatrix);
11253
+ const e = F.multiply(this.translationMatrix, this.rotationMatrix);
11254
+ return F.multiply(e, this.scaleMatrix);
11255
11255
  }
11256
11256
  get canvasMatrix() {
11257
- return L.inverse(this.cameraMatrix);
11257
+ return F.inverse(this.cameraMatrix);
11258
11258
  }
11259
11259
  }
11260
11260
  function ha(t, e) {
@@ -11470,7 +11470,7 @@ class Hp {
11470
11470
  const c = this.getCanvasChildren(), l = this.marqueeBox.getBoundingBox(this.getMarqueeCoords);
11471
11471
  for (const d of c) {
11472
11472
  const m = d.getBoundingBox();
11473
- qe.isColliding(m, l) && !this.#n.has(d) ? this.add([d]) : !qe.isColliding(m, l) && this.#n.has(d) && this.remove([d]);
11473
+ et.isColliding(m, l) && !this.#n.has(d) ? this.add([d]) : !et.isColliding(m, l) && this.#n.has(d) && this.remove([d]);
11474
11474
  }
11475
11475
  } else
11476
11476
  this.move(i, n);
@@ -11606,7 +11606,7 @@ class qp {
11606
11606
  const i = this.getChildren();
11607
11607
  for (let n = i.length - 1; n >= 0; n--) {
11608
11608
  const o = i[n];
11609
- if (o instanceof bt && o.hitTest && o.hitTest(e, r))
11609
+ if (o instanceof _t && o.hitTest && o.hitTest(e, r))
11610
11610
  return o;
11611
11611
  }
11612
11612
  return null;
@@ -11719,7 +11719,7 @@ class nv {
11719
11719
  class rv {
11720
11720
  // reduces constant work to re-render if there are no changes
11721
11721
  constructor() {
11722
- this.translation = [0, 0], this.angleRadians = 0, this.scale = [1, 1], this.localMatrix = L.identity(), this.worldMatrix = L.identity(), this.children = [], this.parent = null, this.renderDirtyFlag = !0, Oa(this, {
11722
+ this.translation = [0, 0], this.angleRadians = 0, this.scale = [1, 1], this.localMatrix = F.identity(), this.worldMatrix = F.identity(), this.children = [], this.parent = null, this.renderDirtyFlag = !0, Oa(this, {
11723
11723
  translation: ee.struct,
11724
11724
  angleRadians: ee,
11725
11725
  scale: ee.struct,
@@ -11728,26 +11728,26 @@ class rv {
11728
11728
  children: ee.shallow,
11729
11729
  parent: ee.ref,
11730
11730
  renderDirtyFlag: ee,
11731
- x: ot,
11732
- y: ot,
11733
- scaleX: ot,
11734
- scaleY: ot,
11735
- dirty: ot,
11736
- setTranslation: A,
11737
- setScale: A,
11738
- flipVertical: A,
11739
- setAngle: A,
11740
- getChild: A,
11741
- appendChild: A,
11742
- appendChildren: A,
11743
- removeChild: A,
11744
- clearChildren: A,
11745
- setParent: A,
11746
- markDirty: A,
11747
- clearDirty: A,
11748
- updateLocalMatrix: A,
11749
- updateWorldMatrix: A,
11750
- setWorldMatrix: A
11731
+ x: at,
11732
+ y: at,
11733
+ scaleX: at,
11734
+ scaleY: at,
11735
+ dirty: at,
11736
+ setTranslation: M,
11737
+ setScale: M,
11738
+ flipVertical: M,
11739
+ setAngle: M,
11740
+ getChild: M,
11741
+ appendChild: M,
11742
+ appendChildren: M,
11743
+ removeChild: M,
11744
+ clearChildren: M,
11745
+ setParent: M,
11746
+ markDirty: M,
11747
+ clearDirty: M,
11748
+ updateLocalMatrix: M,
11749
+ updateWorldMatrix: M,
11750
+ setWorldMatrix: M
11751
11751
  }), this.updateLocalMatrix(), this.updateWorldMatrix();
11752
11752
  }
11753
11753
  // Computed
@@ -11825,11 +11825,11 @@ class rv {
11825
11825
  this.renderDirtyFlag && (this.renderDirtyFlag = !1, this.updateLocalMatrix());
11826
11826
  }
11827
11827
  updateLocalMatrix() {
11828
- const e = L.translation(this.translation[0], this.translation[1]), r = L.rotation(this.angleRadians), i = L.scaling(this.scale[0], this.scale[1]);
11829
- this.localMatrix = L.multiply(L.multiply(e, r), i);
11828
+ const e = F.translation(this.translation[0], this.translation[1]), r = F.rotation(this.angleRadians), i = F.scaling(this.scale[0], this.scale[1]);
11829
+ this.localMatrix = F.multiply(F.multiply(e, r), i);
11830
11830
  }
11831
11831
  updateWorldMatrix(e) {
11832
- this.worldMatrix = e ? L.multiply(e, this.localMatrix) : this.localMatrix.slice();
11832
+ this.worldMatrix = e ? F.multiply(e, this.localMatrix) : this.localMatrix.slice();
11833
11833
  const r = this.worldMatrix;
11834
11834
  this.children.forEach((i) => {
11835
11835
  i.updateWorldMatrix(r);
@@ -11995,8 +11995,8 @@ const Mn = class Mn extends Eh {
11995
11995
  }
11996
11996
  };
11997
11997
  Mn._seqCounter = 0;
11998
- let bt = Mn;
11999
- class Ae extends bt {
11998
+ let _t = Mn;
11999
+ class Me extends _t {
12000
12000
  constructor(e) {
12001
12001
  super(e.x, e.y, e.sx, e.sy), this._width = e.width ?? 100, this._height = e.height ?? 100;
12002
12002
  }
@@ -12044,7 +12044,7 @@ class Ae extends bt {
12044
12044
  */
12045
12045
  getBoundingBox() {
12046
12046
  const e = this.state.translation[0], r = e + this.width * this.state.scaleX, i = this.state.translation[1], n = i + this.height * this.state.scaleY, o = Math.min(e, r), a = Math.max(e, r), s = Math.min(i, n), u = Math.max(i, n);
12047
- return this.AABB = new qe(o, s, a, u), this.AABB;
12047
+ return this.AABB = new et(o, s, a, u), this.AABB;
12048
12048
  }
12049
12049
  /**
12050
12050
  * edges are unaffected by world zoom factor
@@ -12060,11 +12060,11 @@ class Ae extends bt {
12060
12060
  };
12061
12061
  }
12062
12062
  hitTest(e, r) {
12063
- const [i, n] = Je(this.worldMatrix), [o, a] = kt(this.worldMatrix), [s, u] = le(this.parent.worldMatrix, e, r), [c, l] = le(this.worldMatrix), d = this.width * i * o, m = this.height * n * a, f = Math.min(c, c + d), $ = Math.max(c, c + d), w = Math.min(l, l + m), P = Math.max(l, l + m);
12063
+ const [i, n] = Ye(this.worldMatrix), [o, a] = kt(this.worldMatrix), [s, u] = le(this.parent.worldMatrix, e, r), [c, l] = le(this.worldMatrix), d = this.width * i * o, m = this.height * n * a, f = Math.min(c, c + d), $ = Math.max(c, c + d), w = Math.min(l, l + m), P = Math.max(l, l + m);
12064
12064
  return s >= f && s <= $ && u >= w && u <= P;
12065
12065
  }
12066
12066
  }
12067
- class Ne extends Ae {
12067
+ class Ce extends Me {
12068
12068
  constructor(e) {
12069
12069
  super(e), this.texCoordArray = new Float32Array([
12070
12070
  0,
@@ -12300,7 +12300,7 @@ class Th extends Eh {
12300
12300
  this.vertexCount = c.length / 2, e.bindBuffer(e.ARRAY_BUFFER, this.buffer), e.bufferData(e.ARRAY_BUFFER, c, e.STATIC_DRAW);
12301
12301
  }
12302
12302
  this.initialized || (this.setUpVertexData(e, r), this.setUpUniforms(e, r), this.initialized = !0);
12303
- const i = e.drawingBufferWidth, n = e.drawingBufferHeight, o = L.inverse(L.projection(i, n)), a = L.inverse(this.worldMatrix), s = L.multiply(a, o);
12303
+ const i = e.drawingBufferWidth, n = e.drawingBufferHeight, o = F.inverse(F.projection(i, n)), a = F.inverse(this.worldMatrix), s = F.multiply(a, o);
12304
12304
  this.viewProjectionInvLocation && e.uniformMatrix3fv(
12305
12305
  this.viewProjectionInvLocation,
12306
12306
  !1,
@@ -12350,7 +12350,7 @@ class av {
12350
12350
  this.state.width + this.viewportX,
12351
12351
  this.state.height + this.viewportY
12352
12352
  );
12353
- return new qe(e, r, i, n);
12353
+ return new et(e, r, i, n);
12354
12354
  }
12355
12355
  onWheel(e) {
12356
12356
  e.preventDefault();
@@ -12382,7 +12382,7 @@ class av {
12382
12382
  this.updateReaction && (this.updateReaction(), this.updateReaction = void 0);
12383
12383
  }
12384
12384
  }
12385
- const pa = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSIjYjNiM2IzIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xLjUgNmEyLjI1IDIuMjUgMCAwIDEgMi4yNS0yLjI1aDE2LjVBMi4yNSAyLjI1IDAgMCAxIDIyLjUgNnYxMmEyLjI1IDIuMjUgMCAwIDEtMi4yNSAyLjI1SDMuNzVBMi4yNSAyLjI1IDAgMCAxIDEuNSAxOHpNMyAxNi4wNlYxOGMwIC40MTQuMzM2Ljc1Ljc1Ljc1aDE2LjVBLjc1Ljc1IDAgMCAwIDIxIDE4di0xLjk0bC0yLjY5LTIuNjg5YTEuNSAxLjUgMCAwIDAtMi4xMiAwbC0uODguODc5bC45Ny45N2EuNzUuNzUgMCAxIDEtMS4wNiAxLjA2bC01LjE2LTUuMTU5YTEuNSAxLjUgMCAwIDAtMi4xMiAwem0xMC4xMjUtNy44MWExLjEyNSAxLjEyNSAwIDEgMSAyLjI1IDBhMS4xMjUgMS4xMjUgMCAwIDEtMi4yNSAwIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", it = 240;
12385
+ const pa = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSIjYjNiM2IzIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xLjUgNmEyLjI1IDIuMjUgMCAwIDEgMi4yNS0yLjI1aDE2LjVBMi4yNSAyLjI1IDAgMCAxIDIyLjUgNnYxMmEyLjI1IDIuMjUgMCAwIDEtMi4yNSAyLjI1SDMuNzVBMi4yNSAyLjI1IDAgMCAxIDEuNSAxOHpNMyAxNi4wNlYxOGMwIC40MTQuMzM2Ljc1Ljc1Ljc1aDE2LjVBLjc1Ljc1IDAgMCAwIDIxIDE4di0xLjk0bC0yLjY5LTIuNjg5YTEuNSAxLjUgMCAwIDAtMi4xMiAwbC0uODguODc5bC45Ny45N2EuNzUuNzUgMCAxIDEtMS4wNiAxLjA2bC01LjE2LTUuMTU5YTEuNSAxLjUgMCAwIDAtMi4xMiAwem0xMC4xMjUtNy44MWExLjEyNSAxLjEyNSAwIDEgMSAyLjI1IDBhMS4xMjUgMS4xMjUgMCAwIDEtMi4yNSAwIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=", ot = 240;
12386
12386
  function va(t) {
12387
12387
  return {
12388
12388
  x: t.x ?? 0,
@@ -12395,7 +12395,7 @@ function Mr(t) {
12395
12395
  return t.children.map(Ph);
12396
12396
  }
12397
12397
  function Ph(t) {
12398
- return t instanceof Ne ? {
12398
+ return t instanceof Ce ? {
12399
12399
  type: "Img",
12400
12400
  id: t.seq,
12401
12401
  renderOrder: t.renderOrder,
@@ -12404,7 +12404,7 @@ function Ph(t) {
12404
12404
  height: t.height,
12405
12405
  fileId: t.fileId,
12406
12406
  children: t.children?.length ? Mr(t) : void 0
12407
- } : t instanceof Ae ? {
12407
+ } : t instanceof Me ? {
12408
12408
  type: "Rect",
12409
12409
  id: t.seq,
12410
12410
  renderOrder: t.renderOrder,
@@ -12446,7 +12446,7 @@ async function ya(t, e, r, i) {
12446
12446
  let s;
12447
12447
  switch (o.type) {
12448
12448
  case "Rect":
12449
- s = new Ae({
12449
+ s = new Me({
12450
12450
  x: o.transform.x,
12451
12451
  y: o.transform.y,
12452
12452
  width: o.width,
@@ -12464,7 +12464,7 @@ async function ya(t, e, r, i) {
12464
12464
  c * o.transform.sx,
12465
12465
  l * o.transform.sy
12466
12466
  );
12467
- if (s = new Ne({
12467
+ if (s = new Ce({
12468
12468
  x: o.transform.x,
12469
12469
  y: o.transform.y,
12470
12470
  src: d,
@@ -12474,7 +12474,11 @@ async function ya(t, e, r, i) {
12474
12474
  const m = t.files.find(
12475
12475
  (f) => f.id === o.fileId
12476
12476
  );
12477
- s.src = m.dataURL;
12477
+ s.src = m.dataURL, r(o.fileId).then((f) => {
12478
+ f || i(m.dataURL);
12479
+ }).catch(
12480
+ (f) => console.error("Failed to write the image to storage", f)
12481
+ );
12478
12482
  } else
12479
12483
  r(o.fileId).then((m) => {
12480
12484
  s.src = m.dataURL;
@@ -12509,7 +12513,7 @@ async function cv(t, e, r, i = "#d6d6d6ff") {
12509
12513
  a = await sv(o);
12510
12514
  } catch {
12511
12515
  }
12512
- const s = e && e > 0 ? e : a?.naturalWidth ?? it, u = r && r > 0 ? r : a?.naturalHeight ?? it, c = document.createElement("canvas");
12516
+ const s = e && e > 0 ? e : a?.naturalWidth ?? ot, u = r && r > 0 ? r : a?.naturalHeight ?? ot, c = document.createElement("canvas");
12513
12517
  c.width = s, c.height = u;
12514
12518
  const l = c.getContext("2d");
12515
12519
  if (l.fillStyle = i, l.fillRect(0, 0, s, u), a) {
@@ -12517,9 +12521,9 @@ async function cv(t, e, r, i = "#d6d6d6ff") {
12517
12521
  s / a.naturalWidth,
12518
12522
  u / a.naturalHeight
12519
12523
  ), m = a.naturalHeight * d, f = a.naturalWidth * d;
12520
- let $ = it, w = it;
12521
- (it > m || it > f) && ($ = f, w = m);
12522
- const P = Math.round((s - $) / 2), R = Math.round((u - w) / 2);
12524
+ let $ = ot, w = ot;
12525
+ (ot > m || ot > f) && ($ = f, w = m);
12526
+ const P = Math.round((s - $) / 2), L = Math.round((u - w) / 2);
12523
12527
  l.drawImage(
12524
12528
  a,
12525
12529
  0,
@@ -12527,7 +12531,7 @@ async function cv(t, e, r, i = "#d6d6d6ff") {
12527
12531
  a.naturalWidth,
12528
12532
  a.naturalHeight,
12529
12533
  P,
12530
- R,
12534
+ L,
12531
12535
  $,
12532
12536
  w
12533
12537
  );
@@ -12543,18 +12547,18 @@ const Rr = me({
12543
12547
  sx: z(),
12544
12548
  sy: z()
12545
12549
  }).strict(), uv = me({
12546
- id: $t([De(), z()]),
12547
- dataURL: De().regex(
12550
+ id: wt([Ae(), z()]),
12551
+ dataURL: Ae().regex(
12548
12552
  /^data:image\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=\s]+$/,
12549
12553
  "Invalid image data URL"
12550
12554
  ),
12551
- mimetype: De().regex(/^image\/[a-z0-9.+-]+$/i, "Invalid image MIME type"),
12555
+ mimetype: Ae().regex(/^image\/[a-z0-9.+-]+$/i, "Invalid image MIME type"),
12552
12556
  created: z(),
12553
12557
  lastRetrieved: z()
12554
12558
  }).strict(), Tt = Ur(
12555
12559
  () => lo("type", [
12556
12560
  me({
12557
- type: We("Rect"),
12561
+ type: Xe("Rect"),
12558
12562
  id: z().int().optional(),
12559
12563
  transform: Rr,
12560
12564
  children: ve(Tt).optional(),
@@ -12565,7 +12569,7 @@ const Rr = me({
12565
12569
  color: kr([z(), z(), z(), z()])
12566
12570
  }).strict(),
12567
12571
  me({
12568
- type: We("Img"),
12572
+ type: Xe("Img"),
12569
12573
  id: z().int().optional(),
12570
12574
  transform: Rr,
12571
12575
  children: ve(Tt).optional(),
@@ -12573,16 +12577,16 @@ const Rr = me({
12573
12577
  renderOrder: z().int().optional(),
12574
12578
  width: z().positive(),
12575
12579
  height: z().positive(),
12576
- fileId: $t([De(), z()]).optional()
12580
+ fileId: wt([Ae(), z()]).optional()
12577
12581
  }).strict(),
12578
12582
  me({
12579
- type: We("Grid"),
12583
+ type: Xe("Grid"),
12580
12584
  id: z().int().optional(),
12581
12585
  style: z().int().optional(),
12582
12586
  children: ve(Tt).optional()
12583
12587
  }).strict(),
12584
12588
  me({
12585
- type: We("Renderable"),
12589
+ type: Xe("Renderable"),
12586
12590
  id: z().int().optional(),
12587
12591
  transform: Rr.optional(),
12588
12592
  children: ve(Tt).optional(),
@@ -12595,7 +12599,7 @@ const Rr = me({
12595
12599
  x: z(),
12596
12600
  y: z()
12597
12601
  }).strict(), dv = me({
12598
- version: We(1),
12602
+ version: Xe(1),
12599
12603
  canvas: me({
12600
12604
  width: z().positive(),
12601
12605
  height: z().positive(),
@@ -12612,35 +12616,35 @@ function ba(t) {
12612
12616
  throw new Error(`Invalid canvas data: ${e.error.message}`);
12613
12617
  return e.data;
12614
12618
  }
12615
- var fe, Se, Ge, ge, T, xe, st, Xe, Ie, Q, Ce, X, ct, Rn, ut;
12616
- const B = class B extends Oh {
12619
+ var fe, Se, Je, ge, T, xe, ct, Ve, Ie, Q, De, X, ut, Rn, lt;
12620
+ const W = class W extends Oh {
12617
12621
  constructor(r, i, n, o, a, s) {
12618
12622
  super();
12619
12623
  V(this, fe);
12620
12624
  V(this, Se);
12621
- V(this, Ge);
12625
+ V(this, Je);
12622
12626
  V(this, ge);
12623
12627
  V(this, T);
12624
12628
  V(this, xe);
12625
- V(this, st);
12626
- V(this, Xe);
12629
+ V(this, ct);
12630
+ V(this, Ve);
12627
12631
  V(this, Ie);
12628
12632
  V(this, Q);
12629
- V(this, Ce);
12633
+ V(this, De);
12630
12634
  V(this, X);
12631
- V(this, ct);
12632
- V(this, Rn);
12633
12635
  V(this, ut);
12634
- Z(this, Q, null), Z(this, Ce, !0), this.orderDirty = !0, this.renderList = [], Z(this, fe, r), Z(this, Se, n), Z(this, Ge, i), Z(this, Ie, new Th()), Z(this, T, r.getContext("webgl", {
12636
+ V(this, Rn);
12637
+ V(this, lt);
12638
+ B(this, Q, null), B(this, De, !0), this.orderDirty = !0, this.renderList = [], B(this, fe, r), B(this, Se, n), B(this, Je, i), B(this, Ie, new Th()), B(this, T, r.getContext("webgl", {
12635
12639
  alpha: !0,
12636
12640
  premultipliedAlpha: !1
12637
- })), v(this, T).enable(v(this, T).BLEND), v(this, T).blendFunc(v(this, T).SRC_ALPHA, v(this, T).ONE_MINUS_SRC_ALPHA), v(this, T).getExtension("OES_standard_derivatives"), v(this, T).enable(v(this, T).DEPTH_TEST), v(this, T).depthFunc(v(this, T).LEQUAL), Z(this, xe, Dr(v(this, T), Zp, Fp)), Z(this, st, Dr(v(this, T), Gp, Xp)), Z(this, Xe, Dr(v(this, T), Bp, Wp)), this.writeToStorage = o, this.saveImgFileToStorage = a, this.getContainerDimension = s, this.engine = this.engine.bind(this), this.getBoundingClientRect = this.getBoundingClientRect.bind(this), this.appendChild = this.appendChild.bind(this), this.addImageToCanvas = this.addImageToCanvas.bind(this), this.setShapeZOrder = this.setShapeZOrder.bind(this), this.toggleGrid = this.toggleGrid.bind(this), this.changeMode = this.changeMode.bind(this), this.getSelected = this.getSelected.bind(this), this.updateZoomByFixedAmount = this.updateZoomByFixedAmount.bind(this), this.getCenterPoint = this.getCenterPoint.bind(this), this.assignEventListener = this.assignEventListener.bind(this), this.getWorldsCoordsFromCanvas = (m, f) => Fe(m, f, this);
12638
- const u = (m, f) => Fe(
12641
+ })), v(this, T).enable(v(this, T).BLEND), v(this, T).blendFunc(v(this, T).SRC_ALPHA, v(this, T).ONE_MINUS_SRC_ALPHA), v(this, T).getExtension("OES_standard_derivatives"), v(this, T).enable(v(this, T).DEPTH_TEST), v(this, T).depthFunc(v(this, T).LEQUAL), B(this, xe, Dr(v(this, T), Zp, Fp)), B(this, ct, Dr(v(this, T), Gp, Xp)), B(this, Ve, Dr(v(this, T), Bp, Wp)), this.writeToStorage = o, this.saveImgFileToStorage = a, this.getContainerDimension = s, this.engine = this.engine.bind(this), this.getBoundingClientRect = this.getBoundingClientRect.bind(this), this.appendChild = this.appendChild.bind(this), this.addImageToCanvas = this.addImageToCanvas.bind(this), this.setShapeZOrder = this.setShapeZOrder.bind(this), this.toggleGrid = this.toggleGrid.bind(this), this.changeMode = this.changeMode.bind(this), this.getSelected = this.getSelected.bind(this), this.updateZoomByFixedAmount = this.updateZoomByFixedAmount.bind(this), this.getCenterPoint = this.getCenterPoint.bind(this), this.assignEventListener = this.assignEventListener.bind(this), this.getWorldsCoordsFromCanvas = (m, f) => We(m, f, this);
12642
+ const u = (m, f) => We(
12639
12643
  m + this.camera.viewportX,
12640
12644
  f + this.camera.viewportY,
12641
12645
  this
12642
12646
  );
12643
- this.exportState = this.exportState.bind(this), this.clearChildren = this.clearChildren.bind(this), Z(this, X, new Hp(
12647
+ this.exportState = this.exportState.bind(this), this.clearChildren = this.clearChildren.bind(this), B(this, X, new Hp(
12644
12648
  i,
12645
12649
  n,
12646
12650
  this.gl,
@@ -12651,17 +12655,17 @@ const B = class B extends Oh {
12651
12655
  u
12652
12656
  ));
12653
12657
  const c = new Yp({});
12654
- Z(this, ge, new av(
12658
+ B(this, ge, new av(
12655
12659
  c,
12656
12660
  this.setWorldMatrix,
12657
12661
  this.updateWorldMatrix,
12658
12662
  this.getWorldsCoordsFromCanvas
12659
- )), Z(this, Rn, new Qp(
12663
+ )), B(this, Rn, new Qp(
12660
12664
  i,
12661
12665
  n,
12662
12666
  () => this.selectionManager.deleteSelected(this),
12663
12667
  this.assignEventListener
12664
- )), Z(this, ut, new ev(
12668
+ )), B(this, lt, new ev(
12665
12669
  n,
12666
12670
  this.selectionManager.isMultiBoundingBoxHit,
12667
12671
  this.selectionManager.isBoundingBoxHit,
@@ -12672,7 +12676,7 @@ const B = class B extends Oh {
12672
12676
  history: i,
12673
12677
  eventHub: n,
12674
12678
  state: l,
12675
- isContextMenuActive: () => v(this, ut).isActive,
12679
+ isContextMenuActive: () => v(this, lt).isActive,
12676
12680
  getSelected: () => v(this, X).selected,
12677
12681
  getChildren: () => this.children,
12678
12682
  getWorldMatrix: () => this.worldMatrix,
@@ -12702,7 +12706,7 @@ const B = class B extends Oh {
12702
12706
  isSelection: this.selectionManager.isRectSelected,
12703
12707
  hitTestAdjustedCorner: this.selectionManager.hitTestAdjustedCorner
12704
12708
  };
12705
- Z(this, ct, new qp(d)), v(this, Se).on("save", this.writeToStorage);
12709
+ B(this, ut, new qp(d)), v(this, Se).on("save", this.writeToStorage);
12706
12710
  }
12707
12711
  // Call this whenever children/layers/z-order change
12708
12712
  markOrderDirty() {
@@ -12715,19 +12719,19 @@ const B = class B extends Oh {
12715
12719
  return v(this, Ie);
12716
12720
  }
12717
12721
  get history() {
12718
- return v(this, Ge);
12722
+ return v(this, Je);
12719
12723
  }
12720
12724
  get eventHub() {
12721
12725
  return v(this, Se);
12722
12726
  }
12723
12727
  get pointerEventManager() {
12724
- return v(this, ct);
12728
+ return v(this, ut);
12725
12729
  }
12726
12730
  get selectionManager() {
12727
12731
  return v(this, X);
12728
12732
  }
12729
12733
  get contextMenuManager() {
12730
- return v(this, ut);
12734
+ return v(this, lt);
12731
12735
  }
12732
12736
  get canvas() {
12733
12737
  return v(this, fe);
@@ -12736,10 +12740,10 @@ const B = class B extends Oh {
12736
12740
  return v(this, ge);
12737
12741
  }
12738
12742
  get isGlobalClick() {
12739
- return v(this, Ce);
12743
+ return v(this, De);
12740
12744
  }
12741
12745
  set isGlobalClick(r) {
12742
- Z(this, Ce, r);
12746
+ B(this, De, r);
12743
12747
  }
12744
12748
  get basicShapeProgram() {
12745
12749
  return v(this, xe);
@@ -12754,7 +12758,7 @@ const B = class B extends Oh {
12754
12758
  return this.renderList.length;
12755
12759
  }
12756
12760
  appendChild(r) {
12757
- if (super.appendChild(r), r instanceof bt) {
12761
+ if (super.appendChild(r), r instanceof _t) {
12758
12762
  const i = this.children.map((o) => o.renderOrder), n = i.length ? Math.max(...i) : 0;
12759
12763
  r.renderOrder = n + 1;
12760
12764
  }
@@ -12789,20 +12793,20 @@ const B = class B extends Oh {
12789
12793
  c.height
12790
12794
  );
12791
12795
  }
12792
- v(this, T).useProgram(v(this, Xe));
12793
- const r = v(this, T).getUniformLocation(v(this, Xe), "u_z");
12794
- v(this, T).uniform1f(r, 0), v(this, Ie).render(v(this, T), v(this, Xe));
12796
+ v(this, T).useProgram(v(this, Ve));
12797
+ const r = v(this, T).getUniformLocation(v(this, Ve), "u_z");
12798
+ v(this, T).uniform1f(r, 0), v(this, Ie).render(v(this, T), v(this, Ve));
12795
12799
  const i = this.camera.getBoundingBox();
12796
12800
  this.renderList = [];
12797
12801
  for (const c of this.children)
12798
- !v(this, Q) && !qe.isColliding(i, c.getBoundingBox()) ? c.culled = !0 : (this.renderList.push(c), c.culled = !1);
12799
- const [n, o] = Fe(0, 0, this), [a, s] = Fe(
12802
+ !v(this, Q) && !et.isColliding(i, c.getBoundingBox()) ? c.culled = !0 : (this.renderList.push(c), c.culled = !1);
12803
+ const [n, o] = We(0, 0, this), [a, s] = We(
12800
12804
  window.screen.width,
12801
12805
  window.screen.height,
12802
12806
  this
12803
- ), u = new qe(n, o, a, s);
12807
+ ), u = new et(n, o, a, s);
12804
12808
  this.renderList.forEach((c) => {
12805
- if (c instanceof Ne) {
12809
+ if (c instanceof Ce) {
12806
12810
  const l = c.determineIfLowRes(
12807
12811
  u,
12808
12812
  this.camera.state.zoom
@@ -12815,14 +12819,14 @@ const B = class B extends Oh {
12815
12819
  });
12816
12820
  for (const c of this.renderList) {
12817
12821
  let l;
12818
- c instanceof Ne ? l = v(this, st) : c instanceof bt && (l = v(this, xe)), v(this, T).useProgram(l);
12822
+ c instanceof Ce ? l = v(this, ct) : c instanceof _t && (l = v(this, xe)), v(this, T).useProgram(l);
12819
12823
  const d = v(this, T).getUniformLocation(l, "u_z");
12820
12824
  v(this, T).uniform1f(d, c.getZ()), c.render(v(this, T), l);
12821
12825
  }
12822
12826
  v(this, X).render(v(this, xe));
12823
12827
  }
12824
12828
  destroy() {
12825
- v(this, T).deleteProgram(v(this, xe)), v(this, T).deleteProgram(v(this, st)), this.children.forEach((r) => {
12829
+ v(this, T).deleteProgram(v(this, xe)), v(this, T).deleteProgram(v(this, ct)), this.children.forEach((r) => {
12826
12830
  "destroy" in r && r.destroy();
12827
12831
  }), this.clearChildren();
12828
12832
  }
@@ -12833,10 +12837,10 @@ const B = class B extends Oh {
12833
12837
  v(this, fe).addEventListener(r, i, n);
12834
12838
  }
12835
12839
  hitTest(r, i) {
12836
- return Z(this, Ce, !0), v(this, Ce);
12840
+ return B(this, De, !0), v(this, De);
12837
12841
  }
12838
12842
  async addImageToCanvas(r, i, n, o = 1, a = 1, s = !1) {
12839
- const u = new Ne({ x: i, y: n, src: r, sx: o, sy: a });
12843
+ const u = new Ce({ x: i, y: n, src: r, sx: o, sy: a });
12840
12844
  if (this.saveImgFileToStorage(r).then((c) => u.fileId = c), s) {
12841
12845
  const c = new Image();
12842
12846
  c.src = r.startsWith("data:image/png") ? r : await Ta(r), c.onload = () => {
@@ -12850,7 +12854,7 @@ const B = class B extends Oh {
12850
12854
  return Jr(this);
12851
12855
  }
12852
12856
  clearChildren() {
12853
- this.selectionManager.clear(), this.state.clearChildren(), v(this, Ge).clear();
12857
+ this.selectionManager.clear(), this.state.clearChildren(), v(this, Je).clear();
12854
12858
  }
12855
12859
  toggleGrid() {
12856
12860
  v(this, Ie).changeGridType(
@@ -12874,10 +12878,10 @@ const B = class B extends Oh {
12874
12878
  const a = Math.max(...o), s = Math.min(...o);
12875
12879
  i.renderOrder = r ? a + 1 : s - 1, n.end = {
12876
12880
  renderOrder: i.renderOrder
12877
- }, this.markOrderDirty(), v(this, Ge).push(tv([n])), v(this, Se).emit(ze.Change);
12881
+ }, this.markOrderDirty(), v(this, Je).push(tv([n])), v(this, Se).emit(ze.Change);
12878
12882
  }
12879
12883
  changeMode() {
12880
- v(this, ct).changeMode(), v(this, X).clear();
12884
+ v(this, ut).changeMode(), v(this, X).clear();
12881
12885
  }
12882
12886
  updateZoomByFixedAmount(r = 1) {
12883
12887
  v(this, ge).updateZoom(
@@ -12947,39 +12951,39 @@ const B = class B extends Oh {
12947
12951
  return i.bindFramebuffer(i.FRAMEBUFFER, null), i.deleteTexture(s), i.deleteFramebuffer(a), this.getViewportThumbnail(n, o);
12948
12952
  const { scale: l, canvasHeight: d, canvasWidth: m, contentHeight: f, contentWidth: $ } = this.calculateScaleForThumbnail(c, n, o), w = Math.max(1e-4, l);
12949
12953
  this.camera.state.setZoom(w);
12950
- const P = this.getCenterPoint(), R = P[0] - this.canvas.width * w / 2, C = P[1] - this.canvas.height * w / 2;
12951
- v(this, ge).setCameraPos(R, C), Z(this, Q, {
12954
+ const P = this.getCenterPoint(), L = P[0] - this.canvas.width * w / 2, A = P[1] - this.canvas.height * w / 2;
12955
+ v(this, ge).setCameraPos(L, A), B(this, Q, {
12952
12956
  x: (n - m) / 2,
12953
12957
  y: (o - d) / 2,
12954
12958
  // ensure that the image stays proportioned - the passed in values of height and width must match the AR of the canvas you're using
12955
12959
  height: d,
12956
12960
  width: m
12957
- }), this.grid.gridType = 0, this.render(), Z(this, Q, null);
12961
+ }), this.grid.gridType = 0, this.render(), B(this, Q, null);
12958
12962
  const E = new Uint8Array(n * o * 4);
12959
12963
  i.readPixels(0, 0, n, o, i.RGBA, i.UNSIGNED_BYTE, E);
12960
12964
  const S = n * 4, se = new Uint8ClampedArray(E.length);
12961
12965
  for (let J = 0; J < o; J++) {
12962
- const je = J * S, Ze = (o - 1 - J) * S;
12963
- se.set(E.subarray(je, je + S), Ze);
12966
+ const je = J * S, Fe = (o - 1 - J) * S;
12967
+ se.set(E.subarray(je, je + S), Fe);
12964
12968
  }
12965
12969
  this.camera.state.setZoom(u.zoom), this.camera.setCameraPos(u.x, u.y), this.grid.gridType = u.gridType, this.selectionManager.selected = u.selected, i.bindFramebuffer(i.FRAMEBUFFER, null), i.viewport(0, 0, i.canvas.width, i.canvas.height), i.deleteTexture(s), i.deleteFramebuffer(a);
12966
- const wt = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(n, o) : null;
12967
- if (wt) {
12968
- const J = wt.getContext("2d"), je = new ImageData(se, n, o);
12970
+ const St = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(n, o) : null;
12971
+ if (St) {
12972
+ const J = St.getContext("2d"), je = new ImageData(se, n, o);
12969
12973
  J.putImageData(je, 0, 0);
12970
- const Ze = await wt.convertToBlob({
12974
+ const Fe = await St.convertToBlob({
12971
12975
  type: "image/jpeg",
12972
12976
  quality: 0.92
12973
12977
  });
12974
12978
  return await new Promise((ln, dn) => {
12975
- const tt = new FileReader();
12976
- tt.onloadend = () => ln(tt.result), tt.onerror = dn, tt.readAsDataURL(Ze);
12979
+ const rt = new FileReader();
12980
+ rt.onloadend = () => ln(rt.result), rt.onerror = dn, rt.readAsDataURL(Fe);
12977
12981
  });
12978
12982
  } else {
12979
12983
  const J = document.createElement("canvas");
12980
12984
  J.width = n, J.height = o;
12981
- const je = J.getContext("2d"), Ze = new ImageData(se, n, o);
12982
- return je.putImageData(Ze, 0, 0), J.toDataURL("image/jpeg");
12985
+ const je = J.getContext("2d"), Fe = new ImageData(se, n, o);
12986
+ return je.putImageData(Fe, 0, 0), J.toDataURL("image/jpeg");
12983
12987
  }
12984
12988
  }
12985
12989
  /**
@@ -13005,7 +13009,7 @@ const B = class B extends Oh {
13005
13009
  getContentBound() {
13006
13010
  let r = 1 / 0, i = 1 / 0, n = -1 / 0, o = -1 / 0, a = !1;
13007
13011
  for (const s of this.children) {
13008
- if (!(s instanceof Ne)) continue;
13012
+ if (!(s instanceof Ce)) continue;
13009
13013
  const u = s.getEdge();
13010
13014
  !isFinite(u.minX) || !isFinite(u.minY) || !isFinite(u.maxX) || !isFinite(u.maxY) || (a = !0, r = Math.min(r, u.minX), n = Math.max(n, u.maxX), i = Math.min(i, u.minY), o = Math.max(o, u.maxY));
13011
13015
  }
@@ -13014,7 +13018,7 @@ const B = class B extends Oh {
13014
13018
  getCenterPoint() {
13015
13019
  let r = Number.MAX_SAFE_INTEGER, i = Number.MAX_SAFE_INTEGER, n = Number.MIN_SAFE_INTEGER, o = Number.MIN_SAFE_INTEGER;
13016
13020
  for (const a of this.children) {
13017
- if (!(a instanceof Ne)) continue;
13021
+ if (!(a instanceof Ce)) continue;
13018
13022
  const s = a.getEdge();
13019
13023
  r = Math.min(r, s.minX), n = Math.max(n, s.maxX), i = Math.min(i, s.minY), o = Math.max(o, s.maxY);
13020
13024
  }
@@ -13022,25 +13026,25 @@ const B = class B extends Oh {
13022
13026
  }
13023
13027
  wrapWebGLContext(r) {
13024
13028
  const i = r.createTexture.bind(r);
13025
- r.createTexture = () => (B.webglStats.texturesCreated++, console.log(`Textures created: ${B.webglStats.texturesCreated}`), i());
13029
+ r.createTexture = () => (W.webglStats.texturesCreated++, console.log(`Textures created: ${W.webglStats.texturesCreated}`), i());
13026
13030
  const n = r.deleteTexture.bind(r);
13027
- r.deleteTexture = (s) => (s && (B.webglStats.texturesDeleted++, console.log(`Textures deleted: ${B.webglStats.texturesDeleted}`)), n(s));
13031
+ r.deleteTexture = (s) => (s && (W.webglStats.texturesDeleted++, console.log(`Textures deleted: ${W.webglStats.texturesDeleted}`)), n(s));
13028
13032
  const o = r.createShader.bind(r);
13029
- r.createShader = (s) => (B.webglStats.shadersCreated++, console.log(`Shaders created: ${B.webglStats.shadersCreated}`), o(s));
13033
+ r.createShader = (s) => (W.webglStats.shadersCreated++, console.log(`Shaders created: ${W.webglStats.shadersCreated}`), o(s));
13030
13034
  const a = r.deleteShader.bind(r);
13031
- return r.deleteShader = (s) => (s && (B.webglStats.shadersDeleted++, console.log(`Shaders deleted: ${B.webglStats.shadersDeleted}`)), a(s)), r;
13035
+ return r.deleteShader = (s) => (s && (W.webglStats.shadersDeleted++, console.log(`Shaders deleted: ${W.webglStats.shadersDeleted}`)), a(s)), r;
13032
13036
  }
13033
13037
  static getWebGLStats() {
13034
13038
  return {
13035
- ...B.webglStats,
13036
- buffersLeaked: B.webglStats.buffersCreated - B.webglStats.buffersDeleted,
13037
- programsLeaked: B.webglStats.programsCreated - B.webglStats.programsDeleted,
13038
- texturesLeaked: B.webglStats.texturesCreated - B.webglStats.texturesDeleted,
13039
- shadersLeaked: B.webglStats.shadersCreated - B.webglStats.shadersDeleted
13039
+ ...W.webglStats,
13040
+ buffersLeaked: W.webglStats.buffersCreated - W.webglStats.buffersDeleted,
13041
+ programsLeaked: W.webglStats.programsCreated - W.webglStats.programsDeleted,
13042
+ texturesLeaked: W.webglStats.texturesCreated - W.webglStats.texturesDeleted,
13043
+ shadersLeaked: W.webglStats.shadersCreated - W.webglStats.shadersDeleted
13040
13044
  };
13041
13045
  }
13042
13046
  };
13043
- fe = new WeakMap(), Se = new WeakMap(), Ge = new WeakMap(), ge = new WeakMap(), T = new WeakMap(), xe = new WeakMap(), st = new WeakMap(), Xe = new WeakMap(), Ie = new WeakMap(), Q = new WeakMap(), Ce = new WeakMap(), X = new WeakMap(), ct = new WeakMap(), Rn = new WeakMap(), ut = new WeakMap(), B.webglStats = {
13047
+ fe = new WeakMap(), Se = new WeakMap(), Je = new WeakMap(), ge = new WeakMap(), T = new WeakMap(), xe = new WeakMap(), ct = new WeakMap(), Ve = new WeakMap(), Ie = new WeakMap(), Q = new WeakMap(), De = new WeakMap(), X = new WeakMap(), ut = new WeakMap(), Rn = new WeakMap(), lt = new WeakMap(), W.webglStats = {
13044
13048
  buffersCreated: 0,
13045
13049
  buffersDeleted: 0,
13046
13050
  programsCreated: 0,
@@ -13050,7 +13054,7 @@ fe = new WeakMap(), Se = new WeakMap(), Ge = new WeakMap(), ge = new WeakMap(),
13050
13054
  shadersCreated: 0,
13051
13055
  shadersDeleted: 0
13052
13056
  };
13053
- let Dn = B;
13057
+ let Dn = W;
13054
13058
  const _a = 25;
13055
13059
  class hv {
13056
13060
  constructor() {
@@ -13173,7 +13177,7 @@ const { is: vv, defineProperty: yv, getOwnPropertyDescriptor: bv, getOwnProperty
13173
13177
  return r;
13174
13178
  } }, Uh = (t, e) => !vv(t, e), xa = { attribute: !0, type: String, converter: Vr, reflect: !1, useDefault: !1, hasChanged: Uh };
13175
13179
  Symbol.metadata ??= Symbol("metadata"), Nr.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
13176
- class xt extends HTMLElement {
13180
+ class It extends HTMLElement {
13177
13181
  static addInitializer(e) {
13178
13182
  this._$Ei(), (this.l ??= []).push(e);
13179
13183
  }
@@ -13354,7 +13358,7 @@ class xt extends HTMLElement {
13354
13358
  firstUpdated(e) {
13355
13359
  }
13356
13360
  }
13357
- xt.elementStyles = [], xt.shadowRootOptions = { mode: "open" }, xt[Ct("elementProperties")] = /* @__PURE__ */ new Map(), xt[Ct("finalized")] = /* @__PURE__ */ new Map(), xv?.({ ReactiveElement: xt }), (Nr.reactiveElementVersions ??= []).push("2.1.1");
13361
+ It.elementStyles = [], It.shadowRootOptions = { mode: "open" }, It[Ct("elementProperties")] = /* @__PURE__ */ new Map(), It[Ct("finalized")] = /* @__PURE__ */ new Map(), xv?.({ ReactiveElement: It }), (Nr.reactiveElementVersions ??= []).push("2.1.1");
13358
13362
  class Nh {
13359
13363
  constructor(e, r) {
13360
13364
  this.options = [], this.rootNode = r, this._el = document.createElement("div"), this._el.classList.add("context-menu"), e.options.forEach((i, n) => {
@@ -13749,7 +13753,7 @@ const Lv = {
13749
13753
  }, Ia = {
13750
13754
  MAX_IMAGE_ENTRIES: 1e3
13751
13755
  };
13752
- class It extends Cv {
13756
+ class Be extends Cv {
13753
13757
  constructor() {
13754
13758
  super(), this.dbQueue = new za(), this.cache = /* @__PURE__ */ new Map(), this.CACHE_LIMIT = 500, this.dbQueue = new za(), this.dbPromise = this.initDb();
13755
13759
  }
@@ -14031,10 +14035,10 @@ var Jv = Object.getOwnPropertyDescriptor, Dh = (t) => {
14031
14035
  for (var n = i > 1 ? void 0 : i ? Jv(e, r) : e, o = t.length - 1, a; o >= 0; o--)
14032
14036
  (a = t[o]) && (n = a(n) || n);
14033
14037
  return n;
14034
- }, Ah = (t, e, r) => e.has(t) || Dh("Cannot " + r), g = (t, e, r) => (Ah(t, e, "read from private field"), r ? r.call(t) : e.get(t)), K = (t, e, r) => e.has(t) ? Dh("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), D = (t, e, r, i) => (Ah(t, e, "write to private field"), e.set(t, r), r), _, F, $n, be, W, G, Pt, wn, jt, Ut, _e, Ue, Sn, xn, In;
14038
+ }, Ah = (t, e, r) => e.has(t) || Dh("Cannot " + r), g = (t, e, r) => (Ah(t, e, "read from private field"), r ? r.call(t) : e.get(t)), K = (t, e, r) => e.has(t) ? Dh("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), C = (t, e, r, i) => (Ah(t, e, "write to private field"), e.set(t, r), r), _, Z, $n, be, D, G, Pt, wn, jt, Ut, _e, Ne, Sn, xn, In;
14035
14039
  let An = class extends Vh {
14036
14040
  constructor() {
14037
- super(...arguments), this.name = "Reffy", this.displayMode = "fullscreen", K(this, _), K(this, F), K(this, $n), K(this, be), K(this, W), K(this, G), K(this, Pt, 3e5), K(this, wn), K(this, jt), K(this, Ut), K(this, _e), K(this, Ue, /* @__PURE__ */ new Set()), K(this, Sn), K(this, xn), K(this, In), this.handleGlobalPointerDown = (t) => {
14041
+ super(...arguments), this.name = "Reffy", this.displayMode = "fullscreen", K(this, _), K(this, Z), K(this, $n), K(this, be), K(this, D), K(this, G), K(this, Pt, 3e5), K(this, wn), K(this, jt), K(this, Ut), K(this, _e), K(this, Ne, /* @__PURE__ */ new Set()), K(this, Sn), K(this, xn), K(this, In), this.handleGlobalPointerDown = (t) => {
14038
14042
  !this.contains(t.target) && !this.renderRoot.contains(t.target) && this.clearContextMenu();
14039
14043
  };
14040
14044
  }
@@ -14053,19 +14057,19 @@ let An = class extends Vh {
14053
14057
  * Setting this will replace all registered handlers with the provided one.
14054
14058
  */
14055
14059
  get onCanvasChange() {
14056
- return g(this, Ue).values().next().value;
14060
+ return g(this, Ne).values().next().value;
14057
14061
  }
14058
14062
  set onCanvasChange(t) {
14059
- g(this, Ue).clear(), t && g(this, Ue).add(t);
14063
+ g(this, Ne).clear(), t && g(this, Ne).add(t);
14060
14064
  }
14061
14065
  registerOnCanvasChange(t) {
14062
- typeof t == "function" && g(this, Ue).add(t);
14066
+ typeof t == "function" && g(this, Ne).add(t);
14063
14067
  }
14064
14068
  deregisterOnCanvasChange(t) {
14065
- g(this, Ue).delete(t);
14069
+ g(this, Ne).delete(t);
14066
14070
  }
14067
14071
  get eventHub() {
14068
- return g(this, F);
14072
+ return g(this, Z);
14069
14073
  }
14070
14074
  get rootDiv() {
14071
14075
  return g(this, _e);
@@ -14083,7 +14087,7 @@ let An = class extends Vh {
14083
14087
  "pointerdown",
14084
14088
  this.handleGlobalPointerDown,
14085
14089
  !0
14086
- ), window.removeEventListener("resize", g(this, Ut)), g(this, $n)?.disconnect(), D(this, $n, void 0), g(this, _).destroy(), super.disconnectedCallback();
14090
+ ), window.removeEventListener("resize", g(this, Ut)), g(this, $n)?.disconnect(), C(this, $n, void 0), g(this, _).destroy(), super.disconnectedCallback();
14087
14091
  }
14088
14092
  firstUpdated(t) {
14089
14093
  try {
@@ -14100,14 +14104,14 @@ let An = class extends Vh {
14100
14104
  r && i && this.resizeCanvas(r, i);
14101
14105
  }
14102
14106
  async initCanvas() {
14103
- await this.warmUpStorage(), D(this, be, new hv()), D(this, F, new Hh());
14107
+ await this.warmUpStorage(), C(this, be, new hv()), C(this, Z, new Hh());
14104
14108
  const t = document.createElement("div");
14105
- t.style.overflow = "hidden", this.renderRoot.appendChild(t), D(this, _e, t);
14109
+ t.style.overflow = "hidden", this.renderRoot.appendChild(t), C(this, _e, t);
14106
14110
  const e = document.createElement("canvas");
14107
- this.assignFileStorage = this.assignFileStorage.bind(this), this.getImageFileMetadata = this.getImageFileMetadata.bind(this), this.getAllImageFileMetdata = this.getAllImageFileMetdata.bind(this), this.saveImageFileMetadata = this.saveImageFileMetadata.bind(this), this.restoreStateFromCanvasStorage = this.restoreStateFromCanvasStorage.bind(this), this.assignCanvasStorage = this.assignCanvasStorage.bind(this), this.saveToCanvasStorage = this.saveToCanvasStorage.bind(this), this.debounceSaveToCanvasStorage = this.debounceSaveToCanvasStorage.bind(this), this.importCanvas = this.importCanvas.bind(this), this.exportCanvas = this.exportCanvas.bind(this), this.addContextMenu = Ov.bind(this), this.clearContextMenu = Ev.bind(this), this.isContextMenuActive = Tv.bind(this), this.getContainerSize = this.getContainerSize.bind(this), t.contains(e) || t.appendChild(e), this.registerSignal(), D(this, _, new Dn(
14111
+ this.assignFileStorage = this.assignFileStorage.bind(this), this.getImageFileMetadata = this.getImageFileMetadata.bind(this), this.getAllImageFileMetdata = this.getAllImageFileMetdata.bind(this), this.saveImageFileMetadata = this.saveImageFileMetadata.bind(this), this.restoreStateFromCanvasStorage = this.restoreStateFromCanvasStorage.bind(this), this.assignCanvasStorage = this.assignCanvasStorage.bind(this), this.saveToCanvasStorage = this.saveToCanvasStorage.bind(this), this.debounceSaveToCanvasStorage = this.debounceSaveToCanvasStorage.bind(this), this.importCanvas = this.importCanvas.bind(this), this.exportCanvas = this.exportCanvas.bind(this), this.addContextMenu = Ov.bind(this), this.clearContextMenu = Ev.bind(this), this.isContextMenuActive = Tv.bind(this), this.getContainerSize = this.getContainerSize.bind(this), t.contains(e) || t.appendChild(e), this.registerSignal(), C(this, _, new Dn(
14108
14112
  e,
14109
14113
  g(this, be),
14110
- g(this, F),
14114
+ g(this, Z),
14111
14115
  this.debounceSaveToCanvasStorage,
14112
14116
  this.saveImageFileMetadata,
14113
14117
  this.getContainerSize
@@ -14117,11 +14121,11 @@ let An = class extends Vh {
14117
14121
  } catch {
14118
14122
  console.error("Failed to restore canvas");
14119
14123
  }
14120
- this.resizeCanvas(t, e), D(this, Ut, () => this.resizeCanvas(t, e)), window.addEventListener("resize", g(this, Ut));
14124
+ this.resizeCanvas(t, e), C(this, Ut, () => this.resizeCanvas(t, e)), window.addEventListener("resize", g(this, Ut));
14121
14125
  const r = Pv.bind(this)();
14122
- D(this, Sn, jv.bind(this)(
14126
+ C(this, Sn, jv.bind(this)(
14123
14127
  r.options
14124
- )), D(this, In, Nv.bind(this)()), D(this, xn, Uv.bind(this)(
14128
+ )), C(this, In, Nv.bind(this)()), C(this, xn, Uv.bind(this)(
14125
14129
  r.options
14126
14130
  )), this.dispatchEvent(new Event("load"));
14127
14131
  const i = async () => {
@@ -14143,24 +14147,24 @@ let An = class extends Vh {
14143
14147
  }
14144
14148
  // Register signal
14145
14149
  registerSignal() {
14146
- g(this, F).on(nt.start, Gv.bind(this), "spinner"), g(this, F).on(nt.done, Xv.bind(this)), g(this, F).on(ke.Open, this.addContextMenu), g(this, F).on(ke.Close, this.clearContextMenu), g(this, F).on(ze.Change, () => {
14147
- for (const t of g(this, Ue))
14150
+ g(this, Z).on(Ue.start, Gv.bind(this), "spinner"), g(this, Z).on(Ue.done, Xv.bind(this)), g(this, Z).on(ke.Open, this.addContextMenu), g(this, Z).on(ke.Close, this.clearContextMenu), g(this, Z).on(ze.Change, () => {
14151
+ for (const t of g(this, Ne))
14148
14152
  try {
14149
14153
  t();
14150
14154
  } catch (e) {
14151
14155
  console.error("onCanvasChange handler failed", e);
14152
14156
  }
14153
- }), g(this, F).on(rt.Save, this.saveToCanvasStorage), g(this, F).on(rt.SaveCompleted, () => {
14154
- }), g(this, F).on(
14155
- rt.SaveFailed,
14157
+ }), g(this, Z).on(it.Save, this.saveToCanvasStorage), g(this, Z).on(it.SaveCompleted, () => {
14158
+ }), g(this, Z).on(
14159
+ it.SaveFailed,
14156
14160
  () => console.error("Failed to Save!")
14157
14161
  );
14158
14162
  }
14159
14163
  // need to check if this is good practice
14160
14164
  async warmUpStorage() {
14161
- g(this, W) || D(this, W, new It());
14165
+ g(this, D) || C(this, D, new Be());
14162
14166
  try {
14163
- await g(this, W).readAll();
14167
+ await g(this, D).readAll();
14164
14168
  } catch (t) {
14165
14169
  console.error("Storage warm-up failed", t);
14166
14170
  }
@@ -14182,7 +14186,7 @@ let An = class extends Vh {
14182
14186
  * @param saveFrequency How often should auto save execute
14183
14187
  */
14184
14188
  assignCanvasStorage(t, e = g(this, Pt)) {
14185
- D(this, G, t), D(this, Pt, e), g(this, jt) && clearInterval(g(this, jt)), D(this, jt, setInterval(
14189
+ C(this, G, t), C(this, Pt, e), g(this, jt) && clearInterval(g(this, jt)), C(this, jt, setInterval(
14186
14190
  this.saveToCanvasStorage,
14187
14191
  g(this, Pt)
14188
14192
  ));
@@ -14191,7 +14195,7 @@ let An = class extends Vh {
14191
14195
  * @param storage File storage captures the information about the image data that has previously been added. Made more efficient by using SHA of the image data for storage.
14192
14196
  */
14193
14197
  assignFileStorage(t) {
14194
- D(this, W, t);
14198
+ C(this, D, t);
14195
14199
  }
14196
14200
  /**
14197
14201
  * Duplicate images will not be written to the database
@@ -14199,10 +14203,10 @@ let An = class extends Vh {
14199
14203
  * @returns The unique ID that the image has been logged with. This is a hashed version of the image data URL
14200
14204
  */
14201
14205
  async saveImageFileMetadata(t) {
14202
- g(this, W) || D(this, W, new It());
14206
+ g(this, D) || C(this, D, new Be());
14203
14207
  try {
14204
14208
  const e = await Hr(t);
14205
- return await g(this, W).checkIfImageStored(e) ? e : await g(this, W).write(t);
14209
+ return await g(this, D).checkIfImageStored(e) ? e : await g(this, D).write(t);
14206
14210
  } catch (e) {
14207
14211
  console.error(e);
14208
14212
  }
@@ -14212,9 +14216,9 @@ let An = class extends Vh {
14212
14216
  * @returns
14213
14217
  */
14214
14218
  async getImageFileMetadata(t) {
14215
- g(this, W) || D(this, W, new It());
14219
+ g(this, D) || C(this, D, new Be());
14216
14220
  try {
14217
- return await g(this, W).read(t);
14221
+ return await g(this, D).read(t);
14218
14222
  } catch (e) {
14219
14223
  console.error(e);
14220
14224
  }
@@ -14223,17 +14227,17 @@ let An = class extends Vh {
14223
14227
  * @returns All file metadata saved in connected storage
14224
14228
  */
14225
14229
  async getAllImageFileMetdata() {
14226
- g(this, W) || D(this, W, new It());
14230
+ g(this, D) || C(this, D, new Be());
14227
14231
  try {
14228
- return await g(this, W).readAll();
14232
+ return await g(this, D).readAll();
14229
14233
  } catch (t) {
14230
14234
  console.error(t);
14231
14235
  }
14232
14236
  }
14233
14237
  async deleteAllImageFileMetadata() {
14234
- g(this, W) || D(this, W, new It());
14238
+ g(this, D) || C(this, D, new Be());
14235
14239
  try {
14236
- await g(this, W).deleteAll();
14240
+ await g(this, D).deleteAll();
14237
14241
  } catch (t) {
14238
14242
  console.error(t);
14239
14243
  }
@@ -14254,13 +14258,13 @@ let An = class extends Vh {
14254
14258
  * Schedule the auto save to the canvas storage based on timer
14255
14259
  */
14256
14260
  debounceSaveToCanvasStorage(t = 1e3) {
14257
- g(this, G) || D(this, G, new $e(this.name)), clearTimeout(g(this, wn)), D(this, wn, setTimeout(this.saveToCanvasStorage, t));
14261
+ g(this, G) || C(this, G, new $e(this.name)), clearTimeout(g(this, wn)), C(this, wn, setTimeout(this.saveToCanvasStorage, t));
14258
14262
  }
14259
14263
  async saveToCanvasStorage() {
14260
- g(this, G) || D(this, G, new $e(this.name)), g(this, G).write(Jr(g(this, _))).then(() => g(this, F).emit(rt.SaveCompleted)).catch(() => g(this, F).emit(rt.SaveFailed));
14264
+ g(this, G) || C(this, G, new $e(this.name)), g(this, G).write(Jr(g(this, _))).then(() => g(this, Z).emit(it.SaveCompleted)).catch(() => g(this, Z).emit(it.SaveFailed));
14261
14265
  }
14262
14266
  async restoreStateFromCanvasStorage() {
14263
- g(this, G) || D(this, G, new $e(this.name));
14267
+ g(this, G) || C(this, G, new $e(this.name)), g(this, D) || C(this, D, new Be()), g(this, Z).emit(Ue.start, "spinner");
14264
14268
  const t = await g(this, G).read();
14265
14269
  if (!t) {
14266
14270
  const r = localStorage.getItem(this.name);
@@ -14282,13 +14286,20 @@ let An = class extends Vh {
14282
14286
  }
14283
14287
  try {
14284
14288
  const r = ba(e);
14285
- await ya(r, g(this, _), this.getImageFileMetadata);
14289
+ await ya(
14290
+ r,
14291
+ g(this, _),
14292
+ this.getImageFileMetadata,
14293
+ g(this, D).write
14294
+ );
14286
14295
  } catch (r) {
14287
14296
  console.warn("Saved canvas failed schema validation; ignoring.", r);
14297
+ } finally {
14298
+ g(this, Z).emit(Ue.done);
14288
14299
  }
14289
14300
  }
14290
14301
  async deleteStateFromCanvasStorage() {
14291
- g(this, G) || D(this, G, new $e(this.name));
14302
+ g(this, G) || C(this, G, new $e(this.name));
14292
14303
  try {
14293
14304
  g(this, G).delete();
14294
14305
  } catch (t) {
@@ -14296,7 +14307,7 @@ let An = class extends Vh {
14296
14307
  }
14297
14308
  }
14298
14309
  async renameCanvasInStorage(t) {
14299
- g(this, G) || D(this, G, new $e(this.name));
14310
+ g(this, G) || C(this, G, new $e(this.name));
14300
14311
  try {
14301
14312
  g(this, G).changeCanvasKey(this.name, t);
14302
14313
  } catch (e) {
@@ -14321,7 +14332,7 @@ let An = class extends Vh {
14321
14332
  }
14322
14333
  async addImages(t) {
14323
14334
  if (!g(this, _)) return;
14324
- const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = Fe(r, i, g(this, _)), a = await im(
14335
+ const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = We(r, i, g(this, _)), a = await im(
14325
14336
  t,
14326
14337
  (s) => g(this, _).addImageToCanvas(s, n, o, 1, 1, !0)
14327
14338
  );
@@ -14335,7 +14346,7 @@ let An = class extends Vh {
14335
14346
  removeAllImages() {
14336
14347
  if (!g(this, _)) return;
14337
14348
  const t = Array.from(g(this, _).children).filter(
14338
- (e) => e instanceof Ne
14349
+ (e) => e instanceof Ce
14339
14350
  );
14340
14351
  for (const e of t) g(this, _).removeChild(e);
14341
14352
  g(this, be).push(Pa(g(this, _), t));
@@ -14345,7 +14356,7 @@ let An = class extends Vh {
14345
14356
  */
14346
14357
  async addImageFromUrl(t) {
14347
14358
  if (!g(this, _)) return;
14348
- const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = Fe(r, i, g(this, _)), a = await g(this, _).addImageToCanvas(t, n, o, 1, 1, !0);
14359
+ const e = g(this, _e).getBoundingClientRect(), r = e.left + e.width / 2, i = e.top + e.height / 2, [n, o] = We(r, i, g(this, _)), a = await g(this, _).addImageToCanvas(t, n, o, 1, 1, !0);
14349
14360
  g(this, be).push(On(g(this, _), [a]));
14350
14361
  }
14351
14362
  async copyImage() {
@@ -14379,12 +14390,12 @@ let An = class extends Vh {
14379
14390
  }
14380
14391
  async exportCanvas(t = "infinite-canvas.json") {
14381
14392
  if (!g(this, _)) return;
14382
- g(this, F).emit(nt.start, "spinner");
14393
+ g(this, Z).emit(Ue.start, "spinner");
14383
14394
  const e = await this.getAllImageFileMetdata(), r = Jr(g(this, _), e);
14384
- om(t, r), g(this, F).emit(nt.done);
14395
+ om(t, r), g(this, Z).emit(Ue.done);
14385
14396
  }
14386
14397
  async importCanvas(t) {
14387
- if (g(this, F).emit(nt.start, "spinner"), !g(this, _) || !t || t.length !== 1) return;
14398
+ if (g(this, D) || C(this, D, new Be()), g(this, Z).emit(Ue.start, "spinner"), !g(this, _) || !t || t.length !== 1) return;
14388
14399
  const e = t[0];
14389
14400
  if (!e.type || !e.type.includes("json") && !e.name.toLowerCase().endsWith(".json"))
14390
14401
  return;
@@ -14398,11 +14409,16 @@ let An = class extends Vh {
14398
14409
  }
14399
14410
  try {
14400
14411
  const n = ba(i);
14401
- g(this, _).selectionManager.clear(), await ya(n, g(this, _), this.getImageFileMetadata), g(this, F).emit(rt.Save);
14412
+ g(this, _).selectionManager.clear(), await ya(
14413
+ n,
14414
+ g(this, _),
14415
+ this.getImageFileMetadata,
14416
+ g(this, D).write
14417
+ ), g(this, Z).emit(it.Save);
14402
14418
  } catch (n) {
14403
14419
  console.warn("Saved canvas failed schema validation; ignoring.", n);
14404
14420
  } finally {
14405
- g(this, F).emit(nt.done);
14421
+ g(this, Z).emit(Ue.done);
14406
14422
  }
14407
14423
  }
14408
14424
  clearCanvas() {
@@ -14424,17 +14440,17 @@ let An = class extends Vh {
14424
14440
  }
14425
14441
  };
14426
14442
  _ = /* @__PURE__ */ new WeakMap();
14427
- F = /* @__PURE__ */ new WeakMap();
14443
+ Z = /* @__PURE__ */ new WeakMap();
14428
14444
  $n = /* @__PURE__ */ new WeakMap();
14429
14445
  be = /* @__PURE__ */ new WeakMap();
14430
- W = /* @__PURE__ */ new WeakMap();
14446
+ D = /* @__PURE__ */ new WeakMap();
14431
14447
  G = /* @__PURE__ */ new WeakMap();
14432
14448
  Pt = /* @__PURE__ */ new WeakMap();
14433
14449
  wn = /* @__PURE__ */ new WeakMap();
14434
14450
  jt = /* @__PURE__ */ new WeakMap();
14435
14451
  Ut = /* @__PURE__ */ new WeakMap();
14436
14452
  _e = /* @__PURE__ */ new WeakMap();
14437
- Ue = /* @__PURE__ */ new WeakMap();
14453
+ Ne = /* @__PURE__ */ new WeakMap();
14438
14454
  Sn = /* @__PURE__ */ new WeakMap();
14439
14455
  xn = /* @__PURE__ */ new WeakMap();
14440
14456
  In = /* @__PURE__ */ new WeakMap();