@synnaxlabs/x 0.55.0 → 0.56.0

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.
Files changed (140) hide show
  1. package/.turbo/turbo-build.log +10 -13
  2. package/dist/src/array/nullable.d.ts +1 -1
  3. package/dist/src/array/nullable.d.ts.map +1 -1
  4. package/dist/src/caseconv/caseconv.d.ts.map +1 -1
  5. package/dist/src/compare/compare.d.ts +14 -0
  6. package/dist/src/compare/compare.d.ts.map +1 -1
  7. package/dist/src/debounce/debounce.d.ts +7 -2
  8. package/dist/src/debounce/debounce.d.ts.map +1 -1
  9. package/dist/src/destructor/destructor.d.ts +1 -0
  10. package/dist/src/destructor/destructor.d.ts.map +1 -1
  11. package/dist/src/errors/errors.d.ts +6 -10
  12. package/dist/src/errors/errors.d.ts.map +1 -1
  13. package/dist/src/index.d.ts +4 -1
  14. package/dist/src/index.d.ts.map +1 -1
  15. package/dist/src/notation/external.d.ts +3 -0
  16. package/dist/src/notation/external.d.ts.map +1 -0
  17. package/dist/src/notation/index.d.ts +1 -1
  18. package/dist/src/notation/notation.d.ts +5 -9
  19. package/dist/src/notation/notation.d.ts.map +1 -1
  20. package/dist/src/notation/types.gen.d.ts +9 -0
  21. package/dist/src/notation/types.gen.d.ts.map +1 -0
  22. package/dist/src/primitive/primitive.d.ts +16 -0
  23. package/dist/src/primitive/primitive.d.ts.map +1 -1
  24. package/dist/src/record/record.d.ts +8 -1
  25. package/dist/src/record/record.d.ts.map +1 -1
  26. package/dist/src/require/index.d.ts +2 -0
  27. package/dist/src/require/index.d.ts.map +1 -0
  28. package/dist/src/require/require.d.ts +2 -0
  29. package/dist/src/require/require.d.ts.map +1 -0
  30. package/dist/src/spatial/base.d.ts +1 -103
  31. package/dist/src/spatial/base.d.ts.map +1 -1
  32. package/dist/src/spatial/bounds/bounds.d.ts +3 -3
  33. package/dist/src/spatial/bounds/bounds.d.ts.map +1 -1
  34. package/dist/src/spatial/box/box.d.ts +7 -13
  35. package/dist/src/spatial/box/box.d.ts.map +1 -1
  36. package/dist/src/spatial/direction/direction.d.ts +17 -16
  37. package/dist/src/spatial/direction/direction.d.ts.map +1 -1
  38. package/dist/src/spatial/external.d.ts +1 -2
  39. package/dist/src/spatial/external.d.ts.map +1 -1
  40. package/dist/src/spatial/location/location.d.ts +28 -28
  41. package/dist/src/spatial/location/location.d.ts.map +1 -1
  42. package/dist/src/spatial/scale/scale.d.ts +2 -2
  43. package/dist/src/spatial/scale/scale.d.ts.map +1 -1
  44. package/dist/src/spatial/sticky/sticky.d.ts +15 -15
  45. package/dist/src/spatial/sticky/sticky.d.ts.map +1 -1
  46. package/dist/src/spatial/types.gen.d.ts +179 -2
  47. package/dist/src/spatial/types.gen.d.ts.map +1 -1
  48. package/dist/src/spatial/xy/xy.d.ts +4 -4
  49. package/dist/src/spatial/xy/xy.d.ts.map +1 -1
  50. package/dist/src/status/status.d.ts +11 -0
  51. package/dist/src/status/status.d.ts.map +1 -1
  52. package/dist/src/telem/external.d.ts +1 -0
  53. package/dist/src/telem/external.d.ts.map +1 -1
  54. package/dist/src/telem/series.d.ts +5 -2
  55. package/dist/src/telem/series.d.ts.map +1 -1
  56. package/dist/src/telem/telem.d.ts +42 -34
  57. package/dist/src/telem/telem.d.ts.map +1 -1
  58. package/dist/src/telem/types.gen.d.ts +19 -0
  59. package/dist/src/telem/types.gen.d.ts.map +1 -0
  60. package/dist/src/text/external.d.ts +3 -0
  61. package/dist/src/text/external.d.ts.map +1 -0
  62. package/dist/src/text/index.d.ts +2 -0
  63. package/dist/src/text/index.d.ts.map +1 -0
  64. package/dist/src/text/types.d.ts +21 -0
  65. package/dist/src/text/types.d.ts.map +1 -0
  66. package/dist/src/text/types.gen.d.ts +13 -0
  67. package/dist/src/text/types.gen.d.ts.map +1 -0
  68. package/dist/src/throttle/index.d.ts +2 -0
  69. package/dist/src/throttle/index.d.ts.map +1 -0
  70. package/dist/src/throttle/throttle.d.ts +3 -0
  71. package/dist/src/throttle/throttle.d.ts.map +1 -0
  72. package/dist/src/throttle/throttle.spec.d.ts +2 -0
  73. package/dist/src/throttle/throttle.spec.d.ts.map +1 -0
  74. package/dist/src/zod/parse.d.ts.map +1 -1
  75. package/dist/x.cjs +9 -9
  76. package/dist/x.js +1469 -1346
  77. package/package.json +11 -11
  78. package/src/array/nullable.ts +1 -4
  79. package/src/caseconv/caseconv.spec.ts +71 -0
  80. package/src/caseconv/caseconv.ts +15 -2
  81. package/src/compare/compare.spec.ts +115 -0
  82. package/src/compare/compare.ts +29 -0
  83. package/src/debounce/debounce.spec.ts +258 -24
  84. package/src/debounce/debounce.ts +49 -30
  85. package/src/deep/copy.spec.ts +13 -0
  86. package/src/deep/difference.ts +1 -1
  87. package/src/destructor/destructor.ts +2 -0
  88. package/src/errors/errors.spec.ts +30 -0
  89. package/src/errors/errors.ts +29 -17
  90. package/src/index.ts +4 -1
  91. package/src/notation/external.ts +11 -0
  92. package/src/notation/index.ts +1 -1
  93. package/src/notation/notation.spec.ts +260 -2
  94. package/src/notation/notation.ts +25 -7
  95. package/src/notation/types.gen.ts +16 -0
  96. package/src/primitive/primitive.spec.ts +58 -5
  97. package/src/primitive/primitive.ts +22 -0
  98. package/src/record/record.spec.ts +26 -0
  99. package/src/record/record.ts +20 -5
  100. package/src/require/index.ts +10 -0
  101. package/src/require/require.ts +10 -0
  102. package/src/spatial/base.ts +1 -93
  103. package/src/spatial/bounds/bounds.ts +10 -10
  104. package/src/spatial/box/box.ts +5 -5
  105. package/src/spatial/direction/direction.ts +16 -17
  106. package/src/spatial/external.ts +1 -2
  107. package/src/spatial/location/location.ts +19 -17
  108. package/src/spatial/scale/scale.ts +2 -2
  109. package/src/spatial/sticky/sticky.spec.ts +2 -2
  110. package/src/spatial/sticky/sticky.ts +6 -13
  111. package/src/spatial/types.gen.ts +140 -0
  112. package/src/spatial/xy/xy.ts +7 -7
  113. package/src/status/status.spec.ts +65 -0
  114. package/src/status/status.ts +20 -0
  115. package/src/telem/external.ts +8 -0
  116. package/src/telem/series.spec.ts +183 -0
  117. package/src/telem/series.ts +54 -16
  118. package/src/telem/telem.spec.ts +128 -9
  119. package/src/telem/telem.ts +91 -79
  120. package/src/telem/types.gen.ts +28 -0
  121. package/src/text/external.ts +11 -0
  122. package/src/text/index.ts +10 -0
  123. package/src/text/types.gen.ts +16 -0
  124. package/src/text/types.ts +37 -0
  125. package/src/{worker → throttle}/index.ts +1 -1
  126. package/src/throttle/throttle.spec.ts +147 -0
  127. package/src/throttle/throttle.ts +44 -0
  128. package/src/zod/parse.ts +2 -3
  129. package/tsconfig.tsbuildinfo +1 -1
  130. package/dist/src/spatial/spatial.d.ts +0 -3
  131. package/dist/src/spatial/spatial.d.ts.map +0 -1
  132. package/dist/src/worker/index.d.ts +0 -2
  133. package/dist/src/worker/index.d.ts.map +0 -1
  134. package/dist/src/worker/worker.d.ts +0 -33
  135. package/dist/src/worker/worker.d.ts.map +0 -1
  136. package/dist/src/worker/worker.spec.d.ts +0 -2
  137. package/dist/src/worker/worker.spec.d.ts.map +0 -1
  138. package/src/spatial/spatial.ts +0 -44
  139. package/src/worker/worker.spec.ts +0 -41
  140. package/src/worker/worker.ts +0 -86
package/dist/x.js CHANGED
@@ -7,7 +7,7 @@ var n = Object.defineProperty, r = (e, t) => {
7
7
  enumerable: !0
8
8
  });
9
9
  return t || n(r, Symbol.toStringTag, { value: "Module" }), r;
10
- }, i = (t) => e.union([e.union([e.null(), e.undefined()]).transform(() => []), t.array()]), a = (e) => Array.isArray(e) ? e : e == null ? [] : [e], o = (e, t) => {
10
+ }, i = (t) => e.union([e.null().transform(() => []), t.array()]).default(() => []), a = (e) => Array.isArray(e) ? e : e == null ? [] : [e], o = (e, t) => {
11
11
  if (Array.isArray(t)) return t.reduce((e, t) => o(e, t), e ?? []);
12
12
  if (e == null) return [t];
13
13
  let n = e.findIndex((e) => e == t), r = [...e];
@@ -29,26 +29,27 @@ var n = Object.defineProperty, r = (e, t) => {
29
29
  upsert: () => o,
30
30
  upsertKeyed: () => c
31
31
  }), d = /* @__PURE__ */ r({
32
- camelToSnake: () => ie,
33
- capitalize: () => ae,
32
+ camelToSnake: () => re,
33
+ capitalize: () => ie,
34
34
  preserveCase: () => p,
35
- snakeToCamel: () => re,
36
- toKebab: () => le,
37
- toProperNoun: () => ue
35
+ snakeToCamel: () => ne,
36
+ toKebab: () => ce,
37
+ toProperNoun: () => le
38
38
  }), f = "synnax.caseconv.preserveCase", p = (e) => (e[f] = !0, e), m = (e) => {
39
39
  if (typeof e != "object" || !e) return !1;
40
40
  if (f in e) return !0;
41
41
  let t = e._zod?.def;
42
42
  return t == null ? !1 : t.innerType && m(t.innerType) ? !0 : t.type === "union" && Array.isArray(t.options) ? t.options.some(m) : t.type === "pipe" ? m(t.in) || m(t.out) : !1;
43
- }, ee = (e) => {
43
+ }, h = (e) => {
44
44
  if (e == null) return;
45
45
  let t = e._zod?.def;
46
46
  if (t?.type === "array" && t.element != null) return t.element;
47
+ if (t?.innerType != null) return h(t.innerType);
47
48
  if (t?.type === "union" && Array.isArray(t.options)) for (let e of t.options) {
48
- let t = ee(e);
49
+ let t = h(e);
49
50
  if (t != null) return t;
50
51
  }
51
- }, h = (e) => {
52
+ }, g = (e) => {
52
53
  if (e == null) return null;
53
54
  let t = e;
54
55
  if (t.shape != null) return t.shape;
@@ -58,40 +59,45 @@ var n = Object.defineProperty, r = (e, t) => {
58
59
  }
59
60
  let n = t._zod?.def;
60
61
  if (n == null) return null;
61
- if (n.innerType != null) return h(n.innerType);
62
- if (n.type === "union" && Array.isArray(n.options)) for (let e of n.options) {
63
- let t = h(e);
64
- if (t != null) return t;
62
+ if (n.innerType != null) return g(n.innerType);
63
+ if (n.type === "union" && Array.isArray(n.options)) {
64
+ let e = null;
65
+ for (let t of n.options) {
66
+ let n = g(t);
67
+ if (n != null) if (e == null) e = { ...n };
68
+ else for (let t in n) t in e || (e[t] = n[t]);
69
+ }
70
+ return e;
65
71
  }
66
- return n.type === "pipe" ? h(n.in) ?? h(n.out) : null;
67
- }, te = (e) => {
72
+ return n.type === "pipe" ? g(n.in) ?? g(n.out) : null;
73
+ }, ee = (e) => {
68
74
  if (e.length === 0) return e;
69
75
  let t = e.indexOf("_") === -1 ? e : e.replace(/_[a-z]/g, (e) => e[1].toUpperCase()), n = t.charCodeAt(0);
70
76
  return n < 65 || n > 90 || t.length > 1 && t.charCodeAt(1) >= 65 && t.charCodeAt(1) <= 90 ? t : String.fromCharCode(n + 32) + t.slice(1);
71
- }, ne = (e) => {
72
- let t = (n, r = oe) => {
77
+ }, te = (e) => {
78
+ let t = (n, r = ae) => {
73
79
  if (typeof n == "string") return e(n);
74
80
  if (Array.isArray(n)) {
75
- let e = ee(r.schema), i = {
81
+ let e = h(r.schema), i = {
76
82
  recursive: r.recursive,
77
83
  recursiveInArray: r.recursiveInArray,
78
84
  schema: e
79
85
  };
80
86
  return n.map((e) => t(e, i));
81
87
  }
82
- if (!se(n) || r.schema != null && m(r.schema)) return n;
88
+ if (!oe(n) || r.schema != null && m(r.schema)) return n;
83
89
  let i = r.recursive ?? !0, a = r.recursiveInArray ?? i, o = r.schema, s = {}, c = n;
84
90
  if ("toJSON" in c && typeof c.toJSON == "function") return t(c.toJSON(), r);
85
- let l = h(o), u = {
91
+ let l = g(o), u = {
86
92
  recursive: i,
87
93
  recursiveInArray: a,
88
94
  schema: void 0
89
95
  }, d = Object.keys(c);
90
96
  for (let n = 0; n < d.length; n++) {
91
97
  let r = d[n], o = c[r], f = e(r), p = l == null ? void 0 : l[r] ?? l[f] ?? void 0;
92
- i && (se(o) ? ce(o) || (u.schema = p, o = t(o, u)) : a && Array.isArray(o) && (u.schema = ee(p), o = o.map((e) => {
93
- if (se(e)) {
94
- if (!ce(e)) return t(e, u);
98
+ i && (oe(o) ? se(o) || (u.schema = p, o = t(o, u)) : a && Array.isArray(o) && (u.schema = h(p), o = o.map((e) => {
99
+ if (oe(e)) {
100
+ if (!se(e)) return t(e, u);
95
101
  } else if (Array.isArray(e)) return t({ key: e }, u).key;
96
102
  return e;
97
103
  }))), s[f] = o;
@@ -99,22 +105,22 @@ var n = Object.defineProperty, r = (e, t) => {
99
105
  return s;
100
106
  };
101
107
  return t;
102
- }, re = ne(te), ie = ne((e) => e.replace(/([a-z0-9])([A-Z])/g, (e, t, n) => `${t}_${n.toLowerCase()}`)), ae = (e) => e.length === 0 ? e : e[0].toUpperCase() + e.slice(1), oe = {
108
+ }, ne = te(ee), re = te((e) => e.replace(/([a-z0-9])([A-Z])/g, (e, t, n) => `${t}_${n.toLowerCase()}`)), ie = (e) => e.length === 0 ? e : e[0].toUpperCase() + e.slice(1), ae = {
103
109
  recursive: !0,
104
110
  recursiveInArray: !0,
105
111
  schema: void 0
106
- }, se = (e) => typeof e == "object" && !!e && !Array.isArray(e), ce = (e) => e instanceof Uint8Array || e instanceof Number || e instanceof String, le = ne((e) => e.replace(/[\s_]+/g, "-").replace(/([a-z0-9])([A-Z])/g, (e, t, n) => `${t}-${n.toLowerCase()}`).toLowerCase()), ue = ne((e) => {
112
+ }, oe = (e) => typeof e == "object" && !!e && !Array.isArray(e), se = (e) => e instanceof Uint8Array || e instanceof Number || e instanceof String, ce = te((e) => e.replace(/[\s_]+/g, "-").replace(/([a-z0-9])([A-Z])/g, (e, t, n) => `${t}-${n.toLowerCase()}`).toLowerCase()), le = te((e) => {
107
113
  if (e.length === 0) return e;
108
114
  let t = e.replace(/[_-]/g, " ");
109
115
  return t = t.replace(/([a-z0-9])([A-Z])/g, (e, t, n) => `${t} ${n}`), t = t.replace(/([A-Z]+)([A-Z][a-z])/g, (e, t, n) => `${t} ${n}`), t = t.replace(/\s+/g, " ").trim(), t = t.replace(/\b\w/g, (e) => e.toUpperCase()), t;
110
- }), de = /* @__PURE__ */ r({
111
- isObject: () => g,
112
- isPlainObject: () => fe
113
- }), g = (e) => typeof e == "object" && !!e && !Array.isArray(e), fe = (e) => {
116
+ }), ue = /* @__PURE__ */ r({
117
+ isObject: () => _,
118
+ isPlainObject: () => de
119
+ }), _ = (e) => typeof e == "object" && !!e && !Array.isArray(e), de = (e) => {
114
120
  if (typeof e != "object" || !e || Array.isArray(e)) return !1;
115
121
  let t = Object.getPrototypeOf(e);
116
122
  return t === Object.prototype || t === null;
117
- }, pe = (e) => e.nullable().transform((e) => e === null ? void 0 : e).optional(), me = (e, t) => {
123
+ }, fe = (e) => e.nullable().transform((e) => e === null ? void 0 : e).optional(), pe = (e, t) => {
118
124
  let n = e;
119
125
  for (let e of t) {
120
126
  if (typeof n != "object" || !n) return {
@@ -132,13 +138,13 @@ var n = Object.defineProperty, r = (e, t) => {
132
138
  present: !0,
133
139
  value: n
134
140
  };
135
- }, he = (e) => {
141
+ }, me = (e) => {
136
142
  try {
137
143
  return structuredClone(e);
138
144
  } catch {
139
145
  return console.warn("Failed to deep copy object, falling back to JSON.parse(JSON.stringify)", e), console.trace(), JSON.parse(JSON.stringify(e));
140
146
  }
141
- }, ge = (e, t, n = "") => {
147
+ }, he = (e, t, n = "") => {
142
148
  let r = {}, i = (e, t, n) => {
143
149
  if (typeof e != typeof t || e === null || t === null) {
144
150
  r[n] = [e, t];
@@ -156,13 +162,13 @@ var n = Object.defineProperty, r = (e, t) => {
156
162
  else e !== t && (r[n] = [e, t]);
157
163
  };
158
164
  return i(e, t, n), r;
159
- }, _e = (e, t) => {
165
+ }, ge = (e, t) => {
160
166
  let n = Array.isArray(e), r = Array.isArray(t);
161
167
  if (n !== r) return !1;
162
168
  if (n && r) {
163
169
  let n = e, r = t;
164
170
  if (n.length !== r.length) return !1;
165
- for (let e = 0; e < n.length; e++) if (!_e(n[e], r[e])) return !1;
171
+ for (let e = 0; e < n.length; e++) if (!ge(n[e], r[e])) return !1;
166
172
  return !0;
167
173
  }
168
174
  if (e == null || t == null || typeof e != "object" || typeof t != "object") return e === t;
@@ -172,42 +178,42 @@ var n = Object.defineProperty, r = (e, t) => {
172
178
  for (let n of i) {
173
179
  let r = e[n], i = t[n];
174
180
  if (typeof r == "object" && typeof i == "object") {
175
- if (!_e(r, i)) return !1;
181
+ if (!ge(r, i)) return !1;
176
182
  } else if (r !== i) return !1;
177
183
  }
178
184
  return !0;
179
- }, ve = (e, t) => {
185
+ }, _e = (e, t) => {
180
186
  if (typeof e != "object" || !e) return e === t;
181
187
  let n = Object.keys(e), r = Object.keys(t);
182
188
  if (r.length > n.length) return !1;
183
189
  for (let n of r) {
184
190
  let r = e[n], i = t[n];
185
191
  if (typeof r == "object" && typeof i == "object") {
186
- if (!ve(r, i)) return !1;
192
+ if (!_e(r, i)) return !1;
187
193
  } else if (r !== i) return !1;
188
194
  }
189
195
  return !0;
190
- }, ye = (e, t, n = ".") => {
196
+ }, ve = (e, t, n = ".") => {
191
197
  let r = e.split(n);
192
198
  return r.map((e, i) => {
193
199
  let a = t(e, i, r);
194
200
  return a == null ? null : typeof a == "string" ? a : a.join(n);
195
201
  }).filter((e) => e != null).join(n);
196
- }, be = (e, t) => {
202
+ }, v = (e, t) => {
197
203
  if (!Array.isArray(e)) return e[t];
198
204
  let n = e[t];
199
205
  if (n != null || e.length == 0) return n;
200
206
  let r = e[0];
201
207
  if (typeof r == "object" && "key" in r) return e.find((e) => e.key === t);
202
- }, xe = (e, t) => {
208
+ }, ye = (e, t) => {
203
209
  let n = e.split(".");
204
210
  return n.forEach((e, r) => {
205
- t = be(t, e), typeof t == "object" && t && "key" in t && (n[r] = t.key);
211
+ t = v(t, e), typeof t == "object" && t && "key" in t && (n[r] = t.key);
206
212
  }), n.join(".");
207
- }, Se = (e, t) => {
213
+ }, be = (e, t) => {
208
214
  let n = e.split(".");
209
215
  return t < 0 ? n[n.length + t] : n[t];
210
- }, Ce = (e, t) => {
216
+ }, xe = (e, t) => {
211
217
  if (t.length === 0) return !0;
212
218
  let n = e.split("."), r = t.split(".");
213
219
  if (r.length > n.length) return !1;
@@ -216,17 +222,17 @@ var n = Object.defineProperty, r = (e, t) => {
216
222
  if (i !== "*" && t !== i) return !1;
217
223
  }
218
224
  return !0;
219
- }, we = (e) => {
225
+ }, y = (e) => {
220
226
  let t = parseInt(e, 10);
221
227
  return isNaN(t) || t < 0 || t.toString() !== e ? null : t;
222
- }, Te = (e, t) => {
228
+ }, Se = (e, t) => {
223
229
  for (let n = 1; n <= t.length; n++) {
224
230
  let r = t.slice(0, n).join(".");
225
- if (be(e, r) != null) return [r, n];
231
+ if (v(e, r) != null) return [r, n];
226
232
  }
227
233
  return null;
228
- }, Ee = ((e, t, n = { optional: !1 }) => {
229
- let { optional: r, getter: i = be } = n;
234
+ }, Ce = ((e, t, n = { optional: !1 }) => {
235
+ let { optional: r, getter: i = v } = n;
230
236
  if (t === "") return e;
231
237
  let a = t.split(".");
232
238
  if (a.length === 1) {
@@ -254,16 +260,16 @@ var n = Object.defineProperty, r = (e, t) => {
254
260
  throw Error(`Path ${t} does not exist. ${a[n]} is undefined`);
255
261
  };
256
262
  return o(e, 0);
257
- }), De = (e, t) => Ee(e, t, { optional: !0 }) !== null, Oe = (e, ...t) => {
263
+ }), we = (e, t) => Ce(e, t, { optional: !0 }) !== null, Te = (e, ...t) => {
258
264
  if (t.length === 0) return e;
259
265
  let n = t.shift();
260
- if (g(e) && g(n)) for (let t in n) try {
261
- g(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), Oe(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
266
+ if (_(e) && _(n)) for (let t in n) try {
267
+ _(n[t]) ? (t in e || Object.assign(e, { [t]: {} }), Te(e[t], n[t])) : Object.assign(e, { [t]: n[t] });
262
268
  } catch (e) {
263
269
  throw e instanceof TypeError ? TypeError(`.${t}: ${e.message}`, { cause: e }) : e;
264
270
  }
265
- return Oe(e, ...t);
266
- }, ke = (e, t, n) => {
271
+ return Te(e, ...t);
272
+ }, Ee = (e, t, n) => {
267
273
  let r = (e, t, n) => {
268
274
  if (n.def?.type === "union") return n.def.options.reduce((e, n) => r(e, t, n), e);
269
275
  if (n.def?.type === "intersection") return r(r(e, t, n.def.left), t, n.def.right);
@@ -284,7 +290,7 @@ var n = Object.defineProperty, r = (e, t) => {
284
290
  return e;
285
291
  };
286
292
  return r({ ...e }, t, n);
287
- }, Ae = (e, t) => {
293
+ }, De = (e, t) => {
288
294
  let n = t.split("."), r = e, i = 0;
289
295
  for (; i < n.length;) {
290
296
  if (i === n.length - 1) {
@@ -336,35 +342,35 @@ var n = Object.defineProperty, r = (e, t) => {
336
342
  }
337
343
  }
338
344
  if (!e) {
339
- let e = be(r, n[i]);
345
+ let e = v(r, n[i]);
340
346
  if (e == null) return;
341
347
  r = e, i++;
342
348
  }
343
349
  }
344
- }, je = (e, t, n) => {
350
+ }, Oe = (e, t, n) => {
345
351
  let r = t.split("."), i = e, a = 0;
346
352
  for (; a < r.length - 1;) {
347
- let e = Te(i, r.slice(a, r.length - 1)), t;
353
+ let e = Se(i, r.slice(a, r.length - 1)), t;
348
354
  e == null ? (t = r[a], a++) : [t, a] = [e[0], a + e[1]];
349
- let n = be(i, t);
355
+ let n = v(i, t);
350
356
  if (n == null) {
351
- let e = r[a], o = we(e);
352
- o == null && e.startsWith("-") && we(e.substring(1)) != null && (o = 0), n = o == null ? {} : [], i[t] = n;
357
+ let e = r[a], o = y(e);
358
+ o == null && e.startsWith("-") && y(e.substring(1)) != null && (o = 0), n = o == null ? {} : [], i[t] = n;
353
359
  }
354
360
  i = n;
355
361
  }
356
362
  try {
357
363
  let e = r[r.length - 1];
358
364
  if (Array.isArray(i)) {
359
- let t = we(e);
365
+ let t = y(e);
360
366
  if (t == null) {
361
367
  if (e.startsWith("-")) {
362
- let n = we(e.substring(1));
368
+ let n = y(e.substring(1));
363
369
  n != null && (t = i.length - n);
364
370
  }
365
371
  if (t == null) {
366
372
  if (i.length === 0) {
367
- let t = we(e);
373
+ let t = y(e);
368
374
  if (t != null) {
369
375
  i[t] = n;
370
376
  return;
@@ -384,7 +390,7 @@ var n = Object.defineProperty, r = (e, t) => {
384
390
  i[t] = n;
385
391
  return;
386
392
  }
387
- let t = Te(i, [e]);
393
+ let t = Se(i, [e]);
388
394
  if (t != null) {
389
395
  i[t[0]] = n;
390
396
  return;
@@ -393,65 +399,69 @@ var n = Object.defineProperty, r = (e, t) => {
393
399
  } catch (r) {
394
400
  throw console.error("failed to set value", n, "at path", t, "on object", e), r;
395
401
  }
396
- }, Me = /* @__PURE__ */ r({
402
+ }, ke = /* @__PURE__ */ r({
397
403
  SEPARATOR: () => ".",
398
- atKeys: () => me,
399
- copy: () => he,
400
- defaultGetter: () => be,
401
- difference: () => ge,
402
- element: () => Se,
403
- equal: () => _e,
404
- findBestKey: () => Te,
405
- get: () => Ee,
406
- getIndex: () => we,
407
- has: () => De,
408
- override: () => Oe,
409
- overrideValidItems: () => ke,
410
- partialEqual: () => ve,
411
- pathsMatch: () => Ce,
412
- remove: () => Ae,
413
- resolvePath: () => xe,
414
- set: () => je,
415
- transformPath: () => ye
416
- }), Ne = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), Pe = (e, t) => {
404
+ atKeys: () => pe,
405
+ copy: () => me,
406
+ defaultGetter: () => v,
407
+ difference: () => he,
408
+ element: () => be,
409
+ equal: () => ge,
410
+ findBestKey: () => Se,
411
+ get: () => Ce,
412
+ getIndex: () => y,
413
+ has: () => we,
414
+ override: () => Te,
415
+ overrideValidItems: () => Ee,
416
+ partialEqual: () => _e,
417
+ pathsMatch: () => xe,
418
+ remove: () => De,
419
+ resolvePath: () => ye,
420
+ set: () => Oe,
421
+ transformPath: () => ve
422
+ }), Ae = (e) => Object.getOwnPropertySymbols(globalThis).includes(e), je = (e, t) => {
417
423
  let n = Symbol.for(e);
418
- if (!Ne(n)) {
424
+ if (!Ae(n)) {
419
425
  let e = t();
420
426
  Object.defineProperty(globalThis, n, { value: e });
421
427
  }
422
428
  return () => globalThis[n];
423
- }, Fe = /* @__PURE__ */ r({
424
- Canceled: () => Je,
429
+ }, Me = /* @__PURE__ */ r({
430
+ Canceled: () => qe,
425
431
  NONE: () => "nil",
426
- NotImplemented: () => Ye,
427
- UNKNOWN: () => Be,
428
- Unknown: () => Ke,
429
- createTyped: () => Re,
430
- decode: () => Ge,
431
- encode: () => We,
432
- isTyped: () => ze,
433
- payloadZ: () => qe,
434
- register: () => Ue
435
- }), Ie = "sy_x_error", Le = (e) => (t) => typeof t == "object" && t && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t == "string" ? t.startsWith(e) : !1, Re = (e) => class t extends Error {
436
- static discriminator = Ie;
432
+ NotImplemented: () => Je,
433
+ UNKNOWN: () => Le,
434
+ Unknown: () => Ge,
435
+ createTyped: () => Fe,
436
+ decode: () => We,
437
+ encode: () => Ue,
438
+ isTyped: () => Ie,
439
+ payloadZ: () => Ke,
440
+ register: () => He
441
+ }), Ne = "sy_x_error", Pe = (e) => (t) => typeof t == "object" && t && "type" in t && typeof t.type == "string" ? t.type.startsWith(e) : t instanceof Error ? t.message.startsWith(e) : typeof t == "string" ? t.startsWith(e) : !1, Fe = (e) => class t extends Error {
442
+ static discriminator = Ne;
437
443
  discriminator = t.discriminator;
438
444
  static TYPE = e;
439
445
  type = t.TYPE;
440
- static matches = Le(e);
446
+ static matches = Pe(e);
441
447
  matches = t.matches;
442
448
  constructor(e, n) {
443
449
  super(e, n), this.name = t.TYPE;
444
450
  }
445
451
  static sub(t) {
446
- return Re(`${e}.${t}`);
452
+ return Fe(`${e}.${t}`);
447
453
  }
448
- }, ze = (e) => {
454
+ }, Ie = (e) => {
449
455
  if (typeof e != "object" || !e) return !1;
450
456
  let t = e;
451
- if (t.discriminator !== Ie) return !1;
457
+ if (t.discriminator !== Ne) return !1;
452
458
  if (!("type" in t)) throw Error(`X Error is missing its type property: ${JSON.stringify(t)}`);
453
459
  return !0;
454
- }, Be = "unknown", Ve = class {
460
+ }, Le = "unknown", Re = (e, t) => ({
461
+ ...e,
462
+ name: t.name,
463
+ stack: t.stack
464
+ }), ze = (e, t) => (t.name != null && (e.name = t.name), t.stack != null && (e.stack = t.stack), e), Be = class {
455
465
  providers = [];
456
466
  register(e) {
457
467
  this.providers.push(e);
@@ -461,53 +471,55 @@ var n = Object.defineProperty, r = (e, t) => {
461
471
  type: "nil",
462
472
  data: ""
463
473
  };
464
- if (ze(e)) for (let t of this.providers) {
474
+ if (Ie(e)) for (let t of this.providers) {
465
475
  let n = t.encode(e);
466
- if (n != null) return n;
476
+ if (n != null) return Re(n, e);
467
477
  }
468
- if (e instanceof Error) return {
469
- type: Be,
478
+ if (e instanceof Error) return Re({
479
+ type: Le,
470
480
  data: e.message
471
- };
481
+ }, e);
472
482
  if (typeof e == "string") return {
473
- type: Be,
483
+ type: Le,
474
484
  data: e
475
485
  };
476
486
  try {
477
487
  return {
478
- type: Be,
488
+ type: Le,
479
489
  data: JSON.stringify(e)
480
490
  };
481
491
  } catch {
482
492
  return {
483
- type: Be,
493
+ type: Le,
484
494
  data: "unable to encode error information"
485
495
  };
486
496
  }
487
497
  }
488
498
  decode(e) {
489
499
  if (e == null || e.type === "nil") return null;
490
- if (e.type === "unknown") return new Ke(e.data);
500
+ if (e.type === "unknown") return ze(new Ge(e.data), e);
491
501
  for (let t of this.providers) {
492
502
  let n = t.decode(e);
493
- if (n != null) return n;
503
+ if (n != null) return ze(n, e);
494
504
  }
495
- return new Ke(e.data);
505
+ return ze(new Ge(e.data), e);
496
506
  }
497
- }, He = Pe("synnax-error-registry", () => new Ve()), Ue = ({ encode: e, decode: t }) => He().register({
507
+ }, Ve = je("synnax-error-registry", () => new Be()), He = ({ encode: e, decode: t }) => Ve().register({
498
508
  encode: e,
499
509
  decode: t
500
- }), We = (e) => He().encode(e), Ge = (e) => e == null ? null : He().decode(e), Ke = class extends Re("unknown") {}, qe = t.object({
510
+ }), Ue = (e) => Ve().encode(e), We = (e) => e == null ? null : Ve().decode(e), Ge = class extends Fe("unknown") {}, Ke = t.object({
501
511
  type: t.string(),
502
- data: t.string()
503
- }), Je = class extends Re("canceled") {}, Ye = class extends Re("not_implemented") {}, Xe = (e) => {
512
+ data: t.string(),
513
+ name: t.string().optional(),
514
+ stack: t.string().optional()
515
+ }), qe = class extends Fe("canceled") {}, Je = class extends Fe("not_implemented") {}, Ye = (e) => {
504
516
  if (e.length === 0) return "<root>";
505
517
  let t = "";
506
518
  return e.forEach((e, n) => {
507
519
  typeof e == "number" ? t += `[${e}]` : n === 0 ? t += String(e) : t += `.${String(e)}`;
508
520
  }), t;
509
- }, Ze = 200, Qe = 10, $e = 8, _ = (e, t = {}) => {
510
- let n = t.maxStringLength ?? Ze, r = t.maxArrayLength ?? Qe, i = t.maxDepth ?? $e, a = (e, t) => {
521
+ }, Xe = 200, Ze = 10, Qe = 8, $e = (e, t = {}) => {
522
+ let n = t.maxStringLength ?? Xe, r = t.maxArrayLength ?? Ze, i = t.maxDepth ?? Qe, a = (e, t) => {
511
523
  if (e === null) return null;
512
524
  if (e === void 0) return "[undefined]";
513
525
  let o = typeof e;
@@ -523,7 +535,7 @@ var n = Object.defineProperty, r = (e, t) => {
523
535
  let n = e.slice(0, r).map((e) => a(e, t + 1));
524
536
  return e.length > r && n.push(`…(+${e.length - r} more)`), n;
525
537
  }
526
- if (fe(e)) {
538
+ if (de(e)) {
527
539
  if (t >= i) return "[Object]";
528
540
  let n = {};
529
541
  for (let [r, i] of Object.entries(e)) n[r] = a(i, t + 1);
@@ -538,18 +550,19 @@ var n = Object.defineProperty, r = (e, t) => {
538
550
  }
539
551
  };
540
552
  return a(e, 0);
541
- }, et = (e, t = {}) => JSON.stringify(_(e, t), null, 2), tt = /* @__PURE__ */ r({
542
- path: () => Xe,
553
+ }, et = (e, t = {}) => JSON.stringify($e(e, t), null, 2), tt = /* @__PURE__ */ r({
554
+ path: () => Ye,
543
555
  stringify: () => et,
544
- value: () => _
556
+ value: () => $e
545
557
  }), nt = /* @__PURE__ */ r({
546
- ValueExtension: () => y,
547
- is: () => ot,
548
- isCrudeValueExtension: () => v,
549
- isNonZero: () => at,
558
+ ValueExtension: () => x,
559
+ is: () => st,
560
+ isCrudeValueExtension: () => b,
561
+ isHashable: () => it,
562
+ isNonZero: () => ot,
550
563
  isStringer: () => rt,
551
- isZero: () => it
552
- }), v = (e) => typeof e == "object" && !!e && "value" in e, y = class {
564
+ isZero: () => at
565
+ }), b = (e) => typeof e == "object" && !!e && "value" in e, x = class {
553
566
  value;
554
567
  constructor(e) {
555
568
  this.value = e;
@@ -563,7 +576,7 @@ var n = Object.defineProperty, r = (e, t) => {
563
576
  toString() {
564
577
  return this.value.toString();
565
578
  }
566
- }, rt = (e) => typeof e == "object" && !!e && "toString" in e, it = (e) => {
579
+ }, rt = (e) => typeof e == "object" && !!e && "toString" in e, it = (e) => typeof e == "object" && !!e && "hash" in e && typeof e.hash == "function", at = (e) => {
567
580
  if (rt(e)) return e?.toString().length === 0;
568
581
  switch (typeof e) {
569
582
  case "string": return e.length === 0;
@@ -574,11 +587,11 @@ var n = Object.defineProperty, r = (e, t) => {
574
587
  case "object": return e == null;
575
588
  default: return !1;
576
589
  }
577
- }, at = (e) => !it(e), ot = (e) => e == null || typeof e != "object" && typeof e != "function", st = "value", ct = "zod.parse", lt = "✗", ut = 60, dt = {
590
+ }, ot = (e) => !at(e), st = (e) => e == null || typeof e != "object" && typeof e != "function", ct = "value", lt = "zod.parse", ut = "✗", dt = 60, ft = {
578
591
  maxStringLength: 60,
579
592
  maxArrayLength: 3,
580
593
  maxDepth: 3
581
- }, ft = (e) => e.slice(0, -1), pt = (e) => {
594
+ }, pt = (e) => e.slice(0, -1), mt = (e) => {
582
595
  switch (e.code) {
583
596
  case "invalid_type": return `expected ${e.expected}`;
584
597
  case "invalid_value": return `expected one of ${JSON.stringify(e.values)}`;
@@ -596,41 +609,41 @@ var n = Object.defineProperty, r = (e, t) => {
596
609
  case "custom": return e.message || "custom validation failed";
597
610
  default: return e.message;
598
611
  }
599
- }, mt = (e, t, n) => {
600
- let r = JSON.stringify(_(t, n));
601
- return `${pt(e)}, received ${r}`;
602
- }, ht = (e) => {
612
+ }, ht = (e, t, n) => {
613
+ let r = JSON.stringify($e(t, n));
614
+ return `${mt(e)}, received ${r}`;
615
+ }, gt = (e) => {
603
616
  let t = 0;
604
617
  for (let n of e) {
605
618
  if (n.path.length > t && (t = n.path.length), n.code === "invalid_union" && "errors" in n) for (let e of n.errors) {
606
- let n = ht(e);
619
+ let n = gt(e);
607
620
  n > t && (t = n);
608
621
  }
609
622
  if ((n.code === "invalid_key" || n.code === "invalid_element") && "issues" in n) {
610
- let e = ht(n.issues);
623
+ let e = gt(n.issues);
611
624
  e > t && (t = e);
612
625
  }
613
626
  }
614
627
  return t;
615
- }, gt = (e, t = []) => {
628
+ }, _t = (e, t = []) => {
616
629
  let n = [];
617
630
  for (let r of e) {
618
631
  let e = [...t, ...r.path];
619
632
  if (r.code === "invalid_union" && "errors" in r && r.errors.length > 0) {
620
- let t = r.errors[0], i = ht(t);
633
+ let t = r.errors[0], i = gt(t);
621
634
  for (let e = 1; e < r.errors.length; e++) {
622
- let n = ht(r.errors[e]);
635
+ let n = gt(r.errors[e]);
623
636
  n > i && (t = r.errors[e], i = n);
624
637
  }
625
- n.push(...gt(t, e));
638
+ n.push(..._t(t, e));
626
639
  continue;
627
640
  }
628
641
  if (r.code === "invalid_element" && "issues" in r && "key" in r && (typeof r.key == "string" || typeof r.key == "number")) {
629
- n.push(...gt(r.issues, [...e, r.key]));
642
+ n.push(..._t(r.issues, [...e, r.key]));
630
643
  continue;
631
644
  }
632
645
  if (r.code === "invalid_key" && "issues" in r) {
633
- n.push(...gt(r.issues, e));
646
+ n.push(..._t(r.issues, e));
634
647
  continue;
635
648
  }
636
649
  n.push({
@@ -639,7 +652,7 @@ var n = Object.defineProperty, r = (e, t) => {
639
652
  });
640
653
  }
641
654
  return n;
642
- }, _t = (e) => {
655
+ }, vt = (e) => {
643
656
  let t = [];
644
657
  for (let n of e) {
645
658
  if (n.code === "unrecognized_keys" && "keys" in n && Array.isArray(n.keys)) {
@@ -652,9 +665,9 @@ var n = Object.defineProperty, r = (e, t) => {
652
665
  t.push(n);
653
666
  }
654
667
  return t;
655
- }, vt = (e, t, n, r) => {
656
- let i = `${n} `, a = `${n + lt} `, o = {
657
- ...dt,
668
+ }, yt = (e, t, n, r) => {
669
+ let i = `${n} `, a = `${n + ut} `, o = {
670
+ ...ft,
658
671
  ...r
659
672
  };
660
673
  if (Array.isArray(e)) {
@@ -669,7 +682,7 @@ var n = Object.defineProperty, r = (e, t) => {
669
682
  maxArrayLength: e + 2
670
683
  });
671
684
  }
672
- let s = _(e, o);
685
+ let s = $e(e, o);
673
686
  if (typeof s != "object" || !s) {
674
687
  let e = JSON.stringify(s), n = t.values().next().value;
675
688
  return [`${a}${e}${n ? ` × ${n.reason}` : ""}`];
@@ -704,7 +717,7 @@ var n = Object.defineProperty, r = (e, t) => {
704
717
  return u.forEach((e, t) => {
705
718
  if (e.mark == null) return;
706
719
  let n = +(t < u.length - 1), r = e.content.length + n;
707
- r > d && r <= ut && (d = r);
720
+ r > d && r <= dt && (d = r);
708
721
  }), u.forEach((e, t) => {
709
722
  let n = t < u.length - 1 ? "," : "", r = e.content + n;
710
723
  if (e.mark != null) {
@@ -712,48 +725,48 @@ var n = Object.defineProperty, r = (e, t) => {
712
725
  c.push(`${a}${r}${t}× ${e.mark.reason}`);
713
726
  } else c.push(`${i}${r}`);
714
727
  }), c.push(n + (l ? "]" : "}")), c;
715
- }, yt = "__root__", bt = (e, t, n) => {
728
+ }, bt = "__root__", xt = (e, t, n) => {
716
729
  let r = /* @__PURE__ */ new Map();
717
730
  for (let t of e) {
718
- let e = t.path.length === 0 ? yt : `::${Xe(ft(t.path))}`, n = r.get(e);
731
+ let e = t.path.length === 0 ? bt : `::${Ye(pt(t.path))}`, n = r.get(e);
719
732
  n == null ? r.set(e, [t]) : n.push(t);
720
733
  }
721
734
  let i = [];
722
735
  for (let [e, a] of r) {
723
- if (e === yt) {
724
- i.push(a.map((e) => ` × ${mt(e, t, n)}`).join("\n"));
736
+ if (e === bt) {
737
+ i.push(a.map((e) => ` × ${ht(e, t, n)}`).join("\n"));
725
738
  continue;
726
739
  }
727
- let r = ft(a[0].path), { present: o, value: s } = me(t, r);
740
+ let r = pt(a[0].path), { present: o, value: s } = pe(t, r);
728
741
  if (!o) {
729
- i.push(a.map((e) => ` at ${Xe(e.path)}\n × ${mt(e, t, n)}`).join("\n"));
742
+ i.push(a.map((e) => ` at ${Ye(e.path)}\n × ${ht(e, t, n)}`).join("\n"));
730
743
  continue;
731
744
  }
732
745
  let c = /* @__PURE__ */ new Map();
733
746
  for (let e of a) {
734
- let n = String(e.path[e.path.length - 1]), r = me(t, e.path);
747
+ let n = String(e.path[e.path.length - 1]), r = pe(t, e.path);
735
748
  c.set(n, {
736
- reason: pt(e),
749
+ reason: mt(e),
737
750
  missing: !r.present
738
751
  });
739
752
  }
740
- let l = r.length === 0, u = vt(s, c, l ? " " : " ", n);
741
- l ? i.push(u.join("\n")) : i.push([` at ${Xe(r)}`, ...u].join("\n"));
753
+ let l = r.length === 0, u = yt(s, c, l ? " " : " ", n);
754
+ l ? i.push(u.join("\n")) : i.push([` at ${Ye(r)}`, ...u].join("\n"));
742
755
  }
743
756
  return i.join("\n\n");
744
- }, xt = (e, t) => {
757
+ }, St = (e, t) => {
745
758
  let n = Object.entries(e);
746
- return n.every(([, e]) => ot(e)) ? n.map(([e, t]) => `${e}=${typeof t == "string" ? t : String(t)}`).join(", ") : et(e, t);
747
- }, St = ({ issues: e, input: t, label: n, context: r, formatOptions: i }) => {
748
- let a = i ?? {}, o = _t(gt(e)), s = [`Failed to parse ${n} (${o.length === 1 ? "1 issue" : `${o.length} issues`})`];
749
- return s.push(bt(o, t, a)), r != null && Object.keys(r).length > 0 && s.push(` context: ${xt(r, a)}`), s.join("\n\n");
750
- }, Ct = class extends Re(ct) {
759
+ return n.every(([, e]) => st(e)) ? n.map(([e, t]) => `${e}=${typeof t == "string" ? t : String(t)}`).join(", ") : et(e, t);
760
+ }, Ct = ({ issues: e, input: t, label: n, context: r, formatOptions: i }) => {
761
+ let a = i ?? {}, o = vt(_t(e)), s = [`Failed to parse ${n} (${o.length === 1 ? "1 issue" : `${o.length} issues`})`];
762
+ return s.push(xt(o, t, a)), r != null && Object.keys(r).length > 0 && s.push(` context: ${St(r, a)}`), s.join("\n\n");
763
+ }, wt = class extends Fe(lt) {
751
764
  issues;
752
765
  input;
753
766
  label;
754
767
  context;
755
768
  constructor({ issues: e, input: t, label: n, context: r, cause: i, formatOptions: a }) {
756
- super(St({
769
+ super(Ct({
757
770
  issues: e,
758
771
  input: t,
759
772
  label: n,
@@ -763,7 +776,7 @@ var n = Object.defineProperty, r = (e, t) => {
763
776
  }
764
777
  toStatus() {
765
778
  let e = {
766
- input: _(this.input),
779
+ input: $e(this.input),
767
780
  issues: this.issues
768
781
  };
769
782
  return this.context != null && (e.context = this.context), {
@@ -773,24 +786,24 @@ var n = Object.defineProperty, r = (e, t) => {
773
786
  };
774
787
  }
775
788
  };
776
- Ue({
789
+ He({
777
790
  encode: (e) => {
778
- if (!Ct.matches(e)) return null;
791
+ if (!wt.matches(e)) return null;
779
792
  let t = e, n = {
780
793
  label: t.label,
781
794
  context: t.context,
782
795
  issues: t.issues,
783
- input: _(t.input)
796
+ input: $e(t.input)
784
797
  };
785
798
  return {
786
- type: ct,
799
+ type: lt,
787
800
  data: JSON.stringify(n)
788
801
  };
789
802
  },
790
803
  decode: (e) => {
791
- if (e.type !== ct) return null;
804
+ if (e.type !== lt) return null;
792
805
  let t = JSON.parse(e.data);
793
- return new Ct({
806
+ return new wt({
794
807
  issues: t.issues,
795
808
  input: t.input,
796
809
  label: t.label,
@@ -798,90 +811,132 @@ Ue({
798
811
  });
799
812
  }
800
813
  });
801
- var wt = (e, t, n = {}) => {
814
+ var Tt = (e, t, n = {}) => {
802
815
  let r = e.safeParse(t);
803
816
  if (r.success) return r.data;
804
- throw new Ct({
817
+ throw new wt({
805
818
  issues: r.error.issues,
806
819
  input: t,
807
- label: n.label ?? st,
820
+ label: n.label ?? ct,
808
821
  context: n.context,
809
822
  cause: r.error
810
823
  });
811
- }, Tt = 2 ** 12 - 1, Et = 2 ** 16 - 1, Dt = 2 ** 20 - 1, Ot = 2 ** 32 - 1, kt = 2n ** 64n - 1n, At = 2 ** 64 - 1, jt = -128, Mt = -(2 ** 15), Nt = 2 ** 15 - 1, Pt = -(2 ** 31), Ft = 2 ** 31 - 1, It = -(2n ** 63n), Lt = 2n ** 63n - 1n, Rt = -(2 ** 63), zt = 2 ** 63 - 1, b = (e) => (t, n) => {
824
+ }, Et = 2 ** 12 - 1, Dt = 2 ** 16 - 1, Ot = 2 ** 20 - 1, kt = 2 ** 32 - 1, At = 2n ** 64n - 1n, jt = 2 ** 64 - 1, Mt = -128, Nt = -(2 ** 15), Pt = 2 ** 15 - 1, Ft = -(2 ** 31), It = 2 ** 31 - 1, Lt = -(2n ** 63n), Rt = 2n ** 63n - 1n, zt = -(2 ** 63), Bt = 2 ** 63 - 1, Vt = (e) => (t, n) => {
812
825
  if (typeof t == "bigint") {
813
- if (Wt(n)) return e(t, BigInt(n));
826
+ if (Kt(n)) return e(t, BigInt(n));
814
827
  let r = e(Number(t), Number(n));
815
828
  return typeof r == "number" ? BigInt(Math.round(r)) : r;
816
829
  }
817
830
  return e(Number(t), Number(n));
818
- }, x = b((e, t) => e - t), S = b((e, t) => e + t), Bt = (e, t, n = 1e-4) => Math.abs(e - t) < n, Vt = (e, t) => {
831
+ }, S = Vt((e, t) => e - t), C = Vt((e, t) => e + t), Ht = (e, t, n = 1e-4) => Math.abs(e - t) < n, Ut = (e, t) => {
819
832
  let n = typeof e == "bigint", r = typeof t == "bigint";
820
- return n && r ? e === t : n && Wt(t) ? e === BigInt(t) : r && Wt(e) ? t === BigInt(e) : e === t;
821
- }, Ht = (e) => {
833
+ return n && r ? e === t : n && Kt(t) ? e === BigInt(t) : r && Kt(e) ? t === BigInt(e) : e === t;
834
+ }, Wt = (e) => {
822
835
  let t = 10 ** Math.floor(Math.log10(e));
823
836
  return Math.round(e / t) * t;
824
- }, Ut = b((e, t) => e <= t ? e : t), Wt = (e) => typeof e == "bigint" ? !0 : Number.isInteger(e), Gt = b((e, t) => e >= t ? e : t), Kt = (e) => typeof e == "bigint" ? e < 0n ? -e : e : e < 0 ? -e : e, C = b((e, t) => e * t), qt = b((e, t) => e / t), Jt = t.tuple([t.number(), t.number()]), Yt = ["x", "y"], Xt = t.enum(Yt), Zt = [
837
+ }, Gt = Vt((e, t) => e <= t ? e : t), Kt = (e) => typeof e == "bigint" ? !0 : Number.isInteger(e), qt = Vt((e, t) => e >= t ? e : t), Jt = (e) => typeof e == "bigint" ? e < 0n ? -e : e : e < 0 ? -e : e, w = Vt((e, t) => e * t), Yt = Vt((e, t) => e / t), Xt = /* @__PURE__ */ r({
838
+ ALIGNMENTS: () => mn,
839
+ ANGULAR_DIRECTIONS: () => cn,
840
+ CENTER_LOCATIONS: () => un,
841
+ DIMENSIONS: () => vn,
842
+ DIRECTIONS: () => on,
843
+ LOCATIONS: () => fn,
844
+ ORDERS: () => gn,
845
+ OUTER_LOCATIONS: () => rn,
846
+ SIGNED_DIMENSIONS: () => bn,
847
+ STICKY_UNITS: () => tn,
848
+ X_LOCATIONS: () => Zt,
849
+ Y_LOCATIONS: () => $t,
850
+ alignmentZ: () => hn,
851
+ angularDirectionZ: () => ln,
852
+ boundsZ: () => Dn,
853
+ centerLocationZ: () => dn,
854
+ clientXYZ: () => En,
855
+ cornerLocationZ: () => Sn,
856
+ dimensionZ: () => yn,
857
+ dimensionsZ: () => wn,
858
+ directionZ: () => sn,
859
+ locationZ: () => pn,
860
+ orderZ: () => _n,
861
+ outerLocationZ: () => an,
862
+ signedDimensionZ: () => xn,
863
+ signedDimensionsZ: () => Tn,
864
+ stickyUnitZ: () => nn,
865
+ stickyUnitsZ: () => Cn,
866
+ stickyXYZ: () => kn,
867
+ viewportZ: () => On,
868
+ xLocationZ: () => Qt,
869
+ xyZ: () => T,
870
+ yLocationZ: () => en
871
+ }), Zt = ["left", "right"], Qt = t.enum(Zt), $t = ["top", "bottom"], en = t.enum($t), tn = ["px", "decimal"], nn = t.enum(tn), rn = [
825
872
  "top",
826
873
  "right",
827
874
  "bottom",
828
875
  "left"
829
- ], Qt = t.enum(Zt), $t = ["left", "right"], en = t.enum($t), tn = ["top", "bottom"], nn = t.enum(tn), rn = ["center"], an = t.enum(rn), on = [
876
+ ], an = t.enum(rn), on = ["x", "y"], sn = t.enum(on), cn = ["clockwise", "counterclockwise"], ln = t.enum(cn), un = ["center"], dn = t.enum(un), fn = [
830
877
  "top",
831
878
  "right",
832
879
  "bottom",
833
880
  "left",
834
881
  "center"
835
- ], sn = t.enum(on), cn = [
882
+ ], pn = t.enum(fn), mn = [
836
883
  "start",
837
884
  "center",
838
885
  "end"
839
- ], ln = t.enum(cn), un = ["first", "last"], dn = t.enum(un), fn = t.object({
840
- clientX: t.number(),
841
- clientY: t.number()
842
- }), pn = t.object({
886
+ ], hn = t.enum(mn), gn = ["first", "last"], _n = t.enum(gn), vn = ["width", "height"], yn = t.enum(vn), bn = ["signedWidth", "signedHeight"], xn = t.enum(bn), T = t.object({
887
+ x: t.number(),
888
+ y: t.number()
889
+ }), Sn = t.object({
890
+ x: Qt,
891
+ y: en
892
+ }), Cn = t.object({
893
+ x: nn,
894
+ y: nn
895
+ }), wn = t.object({
843
896
  width: t.number(),
844
897
  height: t.number()
845
- }), mn = t.object({
898
+ }), Tn = t.object({
846
899
  signedWidth: t.number(),
847
900
  signedHeight: t.number()
848
- }), hn = t.object({
849
- lower: t.number(),
850
- upper: t.number()
851
- }), gn = t.enum([
852
- "x",
853
- "y",
854
- ...Zt,
855
- ...rn
856
- ]), _n = t.union([
857
- Xt,
858
- t.enum([...Zt, ...rn]),
859
- t.instanceof(String)
860
- ]), vn = /* @__PURE__ */ r({
861
- CLIP: () => Sn,
862
- DECIMAL: () => xn,
863
- INFINITE: () => bn,
864
- ZERO: () => yn,
865
- boundsZ: () => hn,
866
- buildInsertionPlan: () => Ln,
867
- clamp: () => Tn,
868
- construct: () => w,
869
- contains: () => T,
870
- distance: () => zn,
871
- equals: () => Cn,
872
- findInsertPosition: () => Fn,
873
- isFinite: () => An,
874
- isZero: () => On,
875
- linspace: () => Pn,
876
- makeValid: () => wn,
877
- max: () => Mn,
878
- mean: () => jn,
879
- min: () => Nn,
880
- overlapsWith: () => En,
881
- span: () => Dn,
882
- spanIsZero: () => kn,
883
- traverse: () => Rn
884
- }), w = (e, t, n) => {
901
+ }), En = t.object({
902
+ clientX: t.number(),
903
+ clientY: t.number()
904
+ }), Dn = (e) => t.object({
905
+ lower: e ?? t.number(),
906
+ upper: e ?? t.number()
907
+ }), On = t.object({
908
+ zoom: t.number().default(1),
909
+ position: T
910
+ }), kn = t.object({
911
+ x: t.number(),
912
+ y: t.number(),
913
+ root: Sn.optional(),
914
+ units: Cn.optional()
915
+ }), An = t.tuple([t.number(), t.number()]), jn = /* @__PURE__ */ r({
916
+ CLIP: () => Fn,
917
+ DECIMAL: () => Pn,
918
+ INFINITE: () => Nn,
919
+ ZERO: () => Mn,
920
+ boundsZ: () => Dn,
921
+ buildInsertionPlan: () => Xn,
922
+ clamp: () => Rn,
923
+ construct: () => E,
924
+ contains: () => D,
925
+ distance: () => Qn,
926
+ equals: () => In,
927
+ findInsertPosition: () => Jn,
928
+ isFinite: () => Un,
929
+ isZero: () => Vn,
930
+ linspace: () => qn,
931
+ makeValid: () => Ln,
932
+ max: () => Gn,
933
+ mean: () => Wn,
934
+ min: () => Kn,
935
+ overlapsWith: () => zn,
936
+ span: () => Bn,
937
+ spanIsZero: () => Hn,
938
+ traverse: () => Zn
939
+ }), E = (e, t, n) => {
885
940
  let r = {};
886
941
  if (typeof t == "object" && (n = t, t = void 0), n = {
887
942
  makeValid: !0,
@@ -891,91 +946,91 @@ var wt = (e, t, n = {}) => {
891
946
  if (e.length !== 2) throw Error("bounds: expected array of length 2");
892
947
  [r.lower, r.upper] = e;
893
948
  } else r.lower = e.lower, r.upper = e.upper;
894
- return n?.makeValid ? wn(r) : r;
895
- }, yn = Object.freeze({
949
+ return n?.makeValid ? Ln(r) : r;
950
+ }, Mn = Object.freeze({
896
951
  lower: 0,
897
952
  upper: 0
898
- }), bn = Object.freeze({
953
+ }), Nn = Object.freeze({
899
954
  lower: -Infinity,
900
955
  upper: Infinity
901
- }), xn = Object.freeze({
956
+ }), Pn = Object.freeze({
902
957
  lower: 0,
903
958
  upper: 1
904
- }), Sn = Object.freeze({
959
+ }), Fn = Object.freeze({
905
960
  lower: -1,
906
961
  upper: 1
907
- }), Cn = (e, t) => {
962
+ }), In = (e, t) => {
908
963
  if (e == null && t == null) return !0;
909
964
  if (e == null || t == null) return !1;
910
- let n = w(e), r = w(t);
965
+ let n = E(e), r = E(t);
911
966
  return n?.lower === r?.lower && n?.upper === r?.upper;
912
- }, wn = (e) => e.lower > e.upper ? {
967
+ }, Ln = (e) => e.lower > e.upper ? {
913
968
  lower: e.upper,
914
969
  upper: e.lower
915
- } : e, Tn = (e, t) => {
916
- let n = w(e);
970
+ } : e, Rn = (e, t) => {
971
+ let n = E(e);
917
972
  return t < n.lower ? n.lower : t >= n.upper ? n.upper - (typeof n.upper == "number" ? 1 : 1n) : t;
918
- }, T = (e, t) => {
919
- let n = w(e);
973
+ }, D = (e, t) => {
974
+ let n = E(e);
920
975
  if (typeof t == "number" || typeof t == "bigint") return t >= n.lower && t < n.upper;
921
- let r = w(t);
976
+ let r = E(t);
922
977
  return r.lower >= n.lower && r.upper <= n.upper;
923
- }, En = (e, t) => {
924
- let n = w(e), r = w(t);
925
- return n.lower === r.lower ? !0 : r.upper === n.lower || r.lower === n.upper ? !1 : T(n, r.upper) || T(n, r.lower) || T(r, n.upper) || T(r, n.lower);
926
- }, Dn = (e) => {
927
- let t = w(e);
978
+ }, zn = (e, t) => {
979
+ let n = E(e), r = E(t);
980
+ return n.lower === r.lower ? !0 : r.upper === n.lower || r.lower === n.upper ? !1 : D(n, r.upper) || D(n, r.lower) || D(r, n.upper) || D(r, n.lower);
981
+ }, Bn = (e) => {
982
+ let t = E(e);
928
983
  return t.upper - t.lower;
929
- }, On = (e) => {
930
- let t = w(e);
984
+ }, Vn = (e) => {
985
+ let t = E(e);
931
986
  return typeof t.lower == "bigint" ? t.lower === 0n && t.upper === 0n : t.lower === 0 && t.upper === 0;
932
- }, kn = (e) => {
933
- let t = Dn(e);
987
+ }, Hn = (e) => {
988
+ let t = Bn(e);
934
989
  return typeof t == "number" ? t === 0 : t === 0n;
935
- }, An = (e) => {
936
- let t = w(e);
990
+ }, Un = (e) => {
991
+ let t = E(e);
937
992
  return typeof t.lower == "bigint" ? !0 : Number.isFinite(t.lower) && Number.isFinite(t.upper);
938
- }, jn = (e) => {
939
- let t = w(e);
993
+ }, Wn = (e) => {
994
+ let t = E(e);
940
995
  return (t.upper + t.lower) / 2;
941
- }, Mn = (e) => ({
942
- lower: Math.min(...e.map((e) => w(e).lower)),
943
- upper: Math.max(...e.map((e) => w(e).upper))
944
- }), Nn = (e) => ({
945
- lower: Math.max(...e.map((e) => w(e).lower)),
946
- upper: Math.min(...e.map((e) => w(e).upper))
947
- }), Pn = (e) => {
948
- let t = w(e), n = typeof t.lower == "bigint";
949
- return Array.from({ length: Number(Dn(e)) }, (e, r) => n ? t.lower + BigInt(r) : t.lower + r);
950
- }, Fn = (e, t) => {
951
- let n = e.map((e) => w(e)), r = n.findIndex((e) => T(e, t) || t < e.lower);
996
+ }, Gn = (e) => ({
997
+ lower: Math.min(...e.map((e) => E(e).lower)),
998
+ upper: Math.max(...e.map((e) => E(e).upper))
999
+ }), Kn = (e) => ({
1000
+ lower: Math.max(...e.map((e) => E(e).lower)),
1001
+ upper: Math.min(...e.map((e) => E(e).upper))
1002
+ }), qn = (e) => {
1003
+ let t = E(e), n = typeof t.lower == "bigint";
1004
+ return Array.from({ length: Number(Bn(e)) }, (e, r) => n ? t.lower + BigInt(r) : t.lower + r);
1005
+ }, Jn = (e, t) => {
1006
+ let n = e.map((e) => E(e)), r = n.findIndex((e) => D(e, t) || t < e.lower);
952
1007
  if (r === -1) return {
953
1008
  index: e.length,
954
1009
  position: 0
955
1010
  };
956
1011
  let i = n[r];
957
- return T(i, t) ? {
1012
+ return D(i, t) ? {
958
1013
  index: r,
959
1014
  position: Number(t - i.lower)
960
1015
  } : {
961
1016
  index: r,
962
1017
  position: 0
963
1018
  };
964
- }, In = {
1019
+ }, Yn = {
965
1020
  removeBefore: 0,
966
1021
  removeAfter: 0,
967
1022
  insertInto: 0,
968
1023
  deleteInBetween: 0
969
- }, Ln = (e, t) => {
970
- let n = e.map((e) => w(e)), r = w(t);
971
- if (n.length === 0) return In;
972
- let i = Fn(n, r.lower), a = Fn(n, r.upper);
1024
+ }, Xn = (e, t) => {
1025
+ let n = e.map((e) => E(e)), r = E(t);
1026
+ if (n.length === 0) return Yn;
1027
+ let i = Jn(n, r.lower), a = Jn(n, r.upper);
973
1028
  if (i.index === e.length) return {
974
- ...In,
1029
+ ...Yn,
975
1030
  insertInto: e.length
976
1031
  };
977
1032
  if (a.index === 0) return {
978
- ...In,
1033
+ ...Yn,
979
1034
  removeAfter: a.position
980
1035
  };
981
1036
  if (i.index === a.index) return i.position !== 0 && a.position !== 0 ? null : {
@@ -984,24 +1039,24 @@ var wt = (e, t, n = {}) => {
984
1039
  insertInto: i.index,
985
1040
  deleteInBetween: 0
986
1041
  };
987
- let o = a.index - i.index, s = i.index, c = x(Number(Dn(n[i.index])), i.position);
1042
+ let o = a.index - i.index, s = i.index, c = S(Number(Bn(n[i.index])), i.position);
988
1043
  return i.position === 0 ? c = 0 : (--o, s += 1), {
989
1044
  removeBefore: c,
990
1045
  removeAfter: a.position,
991
1046
  insertInto: s,
992
1047
  deleteInBetween: o
993
1048
  };
994
- }, Rn = (e, t, n) => {
995
- let r = e.map((e) => w(e)), i = n > 0 ? 1 : n < 0 ? -1 : 0;
1049
+ }, Zn = (e, t, n) => {
1050
+ let r = e.map((e) => E(e)), i = n > 0 ? 1 : n < 0 ? -1 : 0;
996
1051
  if (i === 0) return t;
997
1052
  let a = n, o = t;
998
- for (; Vt(a, 0) === !1;) {
1053
+ for (; Ut(a, 0) === !1;) {
999
1054
  let e = r.findIndex((e) => i > 0 ? o >= e.lower && o < e.upper : o > e.lower && o <= e.upper);
1000
1055
  if (e !== -1) {
1001
1056
  let t = r[e], n;
1002
- if (n = i > 0 ? x(t.upper, o) : x(o, t.lower), n > 0) {
1003
- let e = Ut(Kt(a), n);
1004
- if (o = S(o, i > 0 ? e : -e), a = x(a, i > 0 ? e : -e), Vt(a, 0)) return o;
1057
+ if (n = i > 0 ? S(t.upper, o) : S(o, t.lower), n > 0) {
1058
+ let e = Gt(Jt(a), n);
1059
+ if (o = C(o, i > 0 ? e : -e), a = S(a, i > 0 ? e : -e), Ut(a, 0)) return o;
1005
1060
  continue;
1006
1061
  }
1007
1062
  }
@@ -1016,10 +1071,10 @@ var wt = (e, t, n = {}) => {
1016
1071
  }
1017
1072
  }
1018
1073
  return o;
1019
- }, zn = (e, t, n) => {
1020
- let r = e.map((e) => w(e));
1074
+ }, Qn = (e, t, n) => {
1075
+ let r = e.map((e) => E(e));
1021
1076
  if (t === n) return typeof t == "bigint" ? 0n : 0;
1022
- let i = w(t < n ? [t, n] : [n, t]), a = typeof t == "bigint" ? 0n : 0;
1077
+ let i = E(t < n ? [t, n] : [n, t]), a = typeof t == "bigint" ? 0n : 0;
1023
1078
  for (let e of r) {
1024
1079
  let t = e.lower > i.lower ? e.lower : i.lower, n = e.upper < i.upper ? e.upper : i.upper;
1025
1080
  if (t < n) {
@@ -1028,96 +1083,96 @@ var wt = (e, t, n = {}) => {
1028
1083
  }
1029
1084
  }
1030
1085
  return a;
1031
- }, Bn = 2, Vn = 3, Hn = 2, Un = 5, Wn = 1e-10, Gn = (e, t) => {
1086
+ }, $n = 2, er = 3, tr = 2, nr = 5, rr = 1e-10, ir = (e, t) => {
1032
1087
  if (Number.isNaN(e) || !Number.isFinite(e)) return e;
1033
1088
  let n = Math.abs(e);
1034
1089
  if (n === 0) return 0;
1035
1090
  let r = !1, i = 0;
1036
1091
  if (t != null) {
1037
- i = Dn(t);
1092
+ i = Bn(t);
1038
1093
  let e = i / n;
1039
- r = i > 0 && e > Wn;
1094
+ r = i > 0 && e > rr;
1040
1095
  }
1041
1096
  if (r) {
1042
1097
  let t;
1043
- t = i >= 1e3 ? Bn : i >= 1 ? Vn : Math.ceil(-Math.log10(i)) + Hn;
1098
+ t = i >= 1e3 ? $n : i >= 1 ? er : Math.ceil(-Math.log10(i)) + tr;
1044
1099
  let n = 10 ** t;
1045
1100
  return Math.round(e * n) / n;
1046
1101
  }
1047
1102
  if (n >= 1e3) {
1048
- let t = 10 ** Bn;
1103
+ let t = 10 ** $n;
1049
1104
  return Math.round(e * t) / t;
1050
1105
  }
1051
1106
  if (n >= 1) {
1052
- let t = 10 ** Vn;
1107
+ let t = 10 ** er;
1053
1108
  return Math.round(e * t) / t;
1054
1109
  }
1055
- let a = 10 ** (Un - Math.floor(Math.log10(n)) - 1);
1110
+ let a = 10 ** (nr - Math.floor(Math.log10(n)) - 1);
1056
1111
  return Math.round(e * a) / a;
1057
- }, Kn = /* @__PURE__ */ r({
1058
- MAX_INT16: () => Nt,
1059
- MAX_INT32: () => Ft,
1060
- MAX_INT64: () => Lt,
1061
- MAX_INT64_NUMBER: () => zt,
1112
+ }, ar = /* @__PURE__ */ r({
1113
+ MAX_INT16: () => Pt,
1114
+ MAX_INT32: () => It,
1115
+ MAX_INT64: () => Rt,
1116
+ MAX_INT64_NUMBER: () => Bt,
1062
1117
  MAX_INT8: () => 127,
1063
- MAX_UINT12: () => Tt,
1064
- MAX_UINT16: () => Et,
1065
- MAX_UINT20: () => Dt,
1066
- MAX_UINT32: () => Ot,
1067
- MAX_UINT64: () => kt,
1068
- MAX_UINT64_NUMBER: () => At,
1118
+ MAX_UINT12: () => Et,
1119
+ MAX_UINT16: () => Dt,
1120
+ MAX_UINT20: () => Ot,
1121
+ MAX_UINT32: () => kt,
1122
+ MAX_UINT64: () => At,
1123
+ MAX_UINT64_NUMBER: () => jt,
1069
1124
  MAX_UINT8: () => 255,
1070
- MIN_INT16: () => Mt,
1071
- MIN_INT32: () => Pt,
1072
- MIN_INT64: () => It,
1073
- MIN_INT64_NUMBER: () => Rt,
1074
- MIN_INT8: () => jt,
1075
- abs: () => Kt,
1076
- add: () => S,
1077
- closeTo: () => Bt,
1078
- div: () => qt,
1079
- equal: () => Vt,
1080
- isInteger: () => Wt,
1081
- max: () => Gt,
1082
- min: () => Ut,
1083
- mult: () => C,
1084
- roundToNearestMagnitude: () => Ht,
1085
- smartRound: () => Gn,
1086
- sub: () => x
1087
- }), qn = t.int().min(jt).max(127), Jn = t.int().min(Mt).max(Nt), Yn = t.int().min(Rt).max(zt), Xn = t.int().min(0).max(255), Zn = t.int().min(0).max(Tt), Qn = t.int().min(0).max(Et), $n = t.int().min(0).max(Dt), er = (t) => e.array(t).or(t.transform((e) => [e])), tr = (e) => e._zod.def.output, nr = (e) => ye(e, (e, t, n) => {
1125
+ MIN_INT16: () => Nt,
1126
+ MIN_INT32: () => Ft,
1127
+ MIN_INT64: () => Lt,
1128
+ MIN_INT64_NUMBER: () => zt,
1129
+ MIN_INT8: () => Mt,
1130
+ abs: () => Jt,
1131
+ add: () => C,
1132
+ closeTo: () => Ht,
1133
+ div: () => Yt,
1134
+ equal: () => Ut,
1135
+ isInteger: () => Kt,
1136
+ max: () => qt,
1137
+ min: () => Gt,
1138
+ mult: () => w,
1139
+ roundToNearestMagnitude: () => Wt,
1140
+ smartRound: () => ir,
1141
+ sub: () => S
1142
+ }), or = t.int().min(Mt).max(127), sr = t.int().min(Nt).max(Pt), cr = t.int().min(zt).max(Bt), lr = t.int().min(0).max(255), ur = t.int().min(0).max(Et), dr = t.int().min(0).max(Dt), fr = t.int().min(0).max(Ot), pr = (t) => e.array(t).or(t.transform((e) => [e])), mr = (e) => e._zod.def.output, hr = (e) => ve(e, (e, t, n) => {
1088
1143
  let r = t === n.length - 1, i = !isNaN(parseInt(e, 10)), a = !isNaN(parseInt(n[t + 1], 10));
1089
1144
  return i && (e = "element"), r || a ? e : [e, "shape"];
1090
- }), rr = (e, t) => {
1145
+ }), gr = (e, t) => {
1091
1146
  if (e == null) return null;
1092
1147
  let n = e[t];
1093
1148
  return n == null && typeof e == "object" && "sourceType" in e ? e.sourceType()[t] : n;
1094
- }, ir = ((e, t, n) => t === "" ? e : Ee(rr(e, "shape"), nr(t), {
1149
+ }, _r = ((e, t, n) => t === "" ? e : Ce(gr(e, "shape"), hr(t), {
1095
1150
  ...n,
1096
- getter: rr
1097
- })), ar = /* @__PURE__ */ r({
1098
- ParseError: () => Ct,
1099
- functionOutput: () => tr,
1100
- getFieldSchema: () => ir,
1101
- getFieldSchemaPath: () => nr,
1102
- int16: () => Jn,
1103
- int64: () => Yn,
1104
- int8: () => qn,
1105
- nullToUndefined: () => pe,
1106
- parse: () => wt,
1107
- toArray: () => er,
1108
- uint12: () => Zn,
1109
- uint16: () => Qn,
1110
- uint20: () => $n,
1111
- uint8: () => Xn
1112
- }), or = /* @__PURE__ */ r({
1113
- CSVCodec: () => cr,
1114
- CSV_CODEC: () => dr,
1115
- ENCODERS: () => pr,
1116
- JSONCodec: () => sr,
1117
- JSON_CODEC: () => ur,
1118
- TEXT_CODEC: () => fr,
1119
- TextCodec: () => lr
1120
- }), sr = class {
1151
+ getter: gr
1152
+ })), vr = /* @__PURE__ */ r({
1153
+ ParseError: () => wt,
1154
+ functionOutput: () => mr,
1155
+ getFieldSchema: () => _r,
1156
+ getFieldSchemaPath: () => hr,
1157
+ int16: () => sr,
1158
+ int64: () => cr,
1159
+ int8: () => or,
1160
+ nullToUndefined: () => fe,
1161
+ parse: () => Tt,
1162
+ toArray: () => pr,
1163
+ uint12: () => ur,
1164
+ uint16: () => dr,
1165
+ uint20: () => fr,
1166
+ uint8: () => lr
1167
+ }), yr = /* @__PURE__ */ r({
1168
+ CSVCodec: () => xr,
1169
+ CSV_CODEC: () => wr,
1170
+ ENCODERS: () => Er,
1171
+ JSONCodec: () => br,
1172
+ JSON_CODEC: () => Cr,
1173
+ TEXT_CODEC: () => Tr,
1174
+ TextCodec: () => Sr
1175
+ }), br = class {
1121
1176
  contentType = "application/json";
1122
1177
  decoder;
1123
1178
  encoder;
@@ -1131,14 +1186,14 @@ var wt = (e, t, n = {}) => {
1131
1186
  return this.decodeString(this.decoder.decode(e), t);
1132
1187
  }
1133
1188
  decodeString(e, t) {
1134
- let n = re(JSON.parse(e), { schema: t });
1135
- return t == null ? n : wt(t, n);
1189
+ let n = ne(JSON.parse(e), { schema: t });
1190
+ return t == null ? n : Tt(t, n);
1136
1191
  }
1137
1192
  encodeString(e, t) {
1138
- let n = ie((t == null ? e : wt(t, e)) ?? {}, { schema: t });
1193
+ let n = re((t == null ? e : Tt(t, e)) ?? {}, { schema: t });
1139
1194
  return JSON.stringify(n, (e, t) => ArrayBuffer.isView(t) ? Array.from(t) : typeof t == "bigint" ? t.toString() : t);
1140
1195
  }
1141
- }, cr = class {
1196
+ }, xr = class {
1142
1197
  contentType = "text/csv";
1143
1198
  encode(e) {
1144
1199
  let t = this.encodeString(e);
@@ -1149,7 +1204,7 @@ var wt = (e, t, n = {}) => {
1149
1204
  return this.decodeString(n, t);
1150
1205
  }
1151
1206
  encodeString(e) {
1152
- if (!Array.isArray(e) || e.length === 0 || !g(e[0])) throw Error("Payload must be an array of objects");
1207
+ if (!Array.isArray(e) || e.length === 0 || !_(e[0])) throw Error("Payload must be an array of objects");
1153
1208
  let t = Object.keys(e[0]), n = [t.join(",")];
1154
1209
  return e.forEach((e) => {
1155
1210
  let r = t.map((t) => JSON.stringify(e[t] ?? ""));
@@ -1175,7 +1230,7 @@ var wt = (e, t, n = {}) => {
1175
1230
  let t = Number(e);
1176
1231
  return isNaN(t) ? e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e : t;
1177
1232
  }
1178
- }, lr = class {
1233
+ }, Sr = class {
1179
1234
  contentType = "text/plain";
1180
1235
  encode(e) {
1181
1236
  if (typeof e != "string") throw Error("TextCodec.encode payload must be a string");
@@ -1185,7 +1240,7 @@ var wt = (e, t, n = {}) => {
1185
1240
  let n = new TextDecoder().decode(e);
1186
1241
  return t == null ? n : t.parse(n);
1187
1242
  }
1188
- }, ur = new sr(), dr = new cr(), fr = new lr(), pr = [ur], mr = 365, hr = 30, gr = t.union([
1243
+ }, Cr = new br(), wr = new xr(), Tr = new Sr(), Er = [Cr], Dr = 365, Or = 30, kr = t.union([
1189
1244
  t.tuple([t.int()]),
1190
1245
  t.tuple([t.int(), t.int().min(1).max(12)]),
1191
1246
  t.tuple([
@@ -1193,20 +1248,23 @@ var wt = (e, t, n = {}) => {
1193
1248
  t.int().min(1).max(12),
1194
1249
  t.int().min(1).max(31)
1195
1250
  ])
1196
- ]), _r = (e, t) => {
1197
- let n = new E(t);
1251
+ ]), Ar = (e, t) => {
1252
+ let n = new O(t);
1198
1253
  if (![
1199
- D.DAY,
1200
- D.HOUR,
1201
- D.MINUTE,
1202
- D.SECOND,
1203
- D.MILLISECOND,
1204
- D.MICROSECOND,
1205
- D.NANOSECOND
1254
+ k.DAY,
1255
+ k.HOUR,
1256
+ k.MINUTE,
1257
+ k.SECOND,
1258
+ k.MILLISECOND,
1259
+ k.MICROSECOND,
1260
+ k.NANOSECOND
1206
1261
  ].some((e) => e.equals(n))) throw Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");
1207
1262
  let r = e.valueOf() % n.valueOf();
1208
- return e instanceof E ? new E(r) : new D(r);
1209
- }, E = class e extends y {
1263
+ return e instanceof O ? new O(r) : new k(r);
1264
+ }, O = class e extends x {
1265
+ hash() {
1266
+ return this.value.toString();
1267
+ }
1210
1268
  constructor(t, n = "UTC") {
1211
1269
  if (t == null) super(e.now().valueOf());
1212
1270
  else if (t instanceof Date) super(BigInt(t.getTime()) * e.MILLISECOND.valueOf());
@@ -1214,7 +1272,7 @@ var wt = (e, t, n = {}) => {
1214
1272
  else if (Array.isArray(t)) super(e.parseDate(t));
1215
1273
  else {
1216
1274
  let r = 0n;
1217
- t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === zt ? Lt : Math.trunc(t) : (isNaN(t) && (t = 0), t = t === Infinity ? e.MAX : e.MIN)), v(t) && (t = t.value), super(BigInt(t.valueOf()) + r);
1275
+ t instanceof Number && (t = t.valueOf()), n === "local" && (r = e.utcOffset.valueOf()), typeof t == "number" && (isFinite(t) ? t = t === Bt ? Rt : Math.trunc(t) : (isNaN(t) && (t = 0), t = t === Infinity ? e.MAX : e.MIN)), b(t) && (t = t.value), super(BigInt(t.valueOf()) + r);
1218
1276
  }
1219
1277
  }
1220
1278
  static parseDate([t = 1970, n = 1, r = 1]) {
@@ -1248,7 +1306,7 @@ var wt = (e, t, n = {}) => {
1248
1306
  }
1249
1307
  toISOString(t = "UTC") {
1250
1308
  if (t === "UTC") return this.date().toISOString();
1251
- let n = this.date(), r = new D(BigInt(n.getTimezoneOffset()) * e.MINUTE.valueOf());
1309
+ let n = this.date(), r = new k(BigInt(n.getTimezoneOffset()) * e.MINUTE.valueOf());
1252
1310
  return this.sub(r).date().toISOString();
1253
1311
  }
1254
1312
  timeString(e = !1, t = "UTC") {
@@ -1260,7 +1318,7 @@ var wt = (e, t, n = {}) => {
1260
1318
  return `${e.toLocaleString("default", { month: "short" })} ${e.toLocaleString("default", { day: "numeric" })}`;
1261
1319
  }
1262
1320
  static get utcOffset() {
1263
- return new D(BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * e.MINUTE.valueOf());
1321
+ return new k(BigInt((/* @__PURE__ */ new Date()).getTimezoneOffset()) * e.MINUTE.valueOf());
1264
1322
  }
1265
1323
  static since(t) {
1266
1324
  return new e().span(t);
@@ -1275,7 +1333,7 @@ var wt = (e, t, n = {}) => {
1275
1333
  return this.range(e).span;
1276
1334
  }
1277
1335
  range(e) {
1278
- return new A(this, e).makeValid();
1336
+ return new M(this, e).makeValid();
1279
1337
  }
1280
1338
  spanRange(e) {
1281
1339
  return this.range(this.add(e)).makeValid();
@@ -1296,22 +1354,22 @@ var wt = (e, t, n = {}) => {
1296
1354
  return this.valueOf() <= new e(t).valueOf();
1297
1355
  }
1298
1356
  add(t) {
1299
- return new e(S(this.valueOf(), new D(t).valueOf()));
1357
+ return new e(C(this.valueOf(), new k(t).valueOf()));
1300
1358
  }
1301
1359
  sub(t) {
1302
- return new e(x(this.valueOf(), new D(t).valueOf()));
1360
+ return new e(S(this.valueOf(), new k(t).valueOf()));
1303
1361
  }
1304
1362
  get hours() {
1305
- return Number(this.valueOf()) / Number(D.HOUR.valueOf());
1363
+ return Number(this.valueOf()) / Number(k.HOUR.valueOf());
1306
1364
  }
1307
1365
  get minutes() {
1308
- return Number(this.valueOf()) / Number(D.MINUTE.valueOf());
1366
+ return Number(this.valueOf()) / Number(k.MINUTE.valueOf());
1309
1367
  }
1310
1368
  get days() {
1311
- return Number(this.valueOf()) / Number(D.DAY.valueOf());
1369
+ return Number(this.valueOf()) / Number(k.DAY.valueOf());
1312
1370
  }
1313
1371
  get seconds() {
1314
- return Number(this.valueOf()) / Number(D.SECOND.valueOf());
1372
+ return Number(this.valueOf()) / Number(k.SECOND.valueOf());
1315
1373
  }
1316
1374
  get milliseconds() {
1317
1375
  return Number(this.valueOf()) / Number(e.MILLISECOND.valueOf());
@@ -1423,7 +1481,6 @@ var wt = (e, t, n = {}) => {
1423
1481
  toString(e = "ISO", t = "UTC") {
1424
1482
  switch (e) {
1425
1483
  case "ISODate": return this.toISOString(t).slice(0, 10);
1426
- case "ISOTime": return this.toISOString(t).slice(11, 23);
1427
1484
  case "time": return this.timeString(!1, t);
1428
1485
  case "preciseTime": return this.timeString(!0, t);
1429
1486
  case "date": return this.dateString();
@@ -1433,16 +1490,16 @@ var wt = (e, t, n = {}) => {
1433
1490
  }
1434
1491
  }
1435
1492
  remainder(e) {
1436
- return _r(this, e);
1493
+ return Ar(this, e);
1437
1494
  }
1438
1495
  get isToday() {
1439
- return this.truncate(D.DAY).equals(e.now().truncate(D.DAY));
1496
+ return this.truncate(k.DAY).equals(e.now().truncate(k.DAY));
1440
1497
  }
1441
1498
  truncate(e) {
1442
1499
  return this.sub(this.remainder(e));
1443
1500
  }
1444
1501
  formatBySpan(e) {
1445
- return e.greaterThanOrEqual(D.days(30)) ? "shortDate" : e.greaterThanOrEqual(D.DAY) ? "dateTime" : e.greaterThanOrEqual(D.HOUR) ? "time" : e.greaterThanOrEqual(D.SECOND) ? "preciseTime" : "ISOTime";
1502
+ return e.greaterThanOrEqual(k.days(30)) ? "date" : e.greaterThanOrEqual(k.DAY) ? "dateTime" : e.greaterThanOrEqual(k.HOUR) ? "time" : "preciseTime";
1446
1503
  }
1447
1504
  static now() {
1448
1505
  return new e(/* @__PURE__ */ new Date());
@@ -1491,7 +1548,7 @@ var wt = (e, t, n = {}) => {
1491
1548
  return e.hours(t * 24, n);
1492
1549
  }
1493
1550
  static DAY = e.days(1);
1494
- static MAX = new e(Lt);
1551
+ static MAX = new e(Rt);
1495
1552
  static MIN = new e(0);
1496
1553
  static ZERO = new e(0);
1497
1554
  static z = t.union([
@@ -1501,25 +1558,28 @@ var wt = (e, t, n = {}) => {
1501
1558
  t.number().transform((t) => new e(t)),
1502
1559
  t.bigint().transform((t) => new e(t)),
1503
1560
  t.date().transform((t) => new e(t)),
1504
- t.custom((e) => e instanceof D).transform((t) => new e(t)),
1505
- gr.transform((t) => new e(t))
1561
+ t.custom((e) => e instanceof k).transform((t) => new e(t)),
1562
+ kr.transform((t) => new e(t))
1506
1563
  ]);
1507
1564
  static sort(e, t) {
1508
1565
  return Number(e.valueOf() - t.valueOf());
1509
1566
  }
1510
- }, D = class e extends y {
1567
+ }, k = class e extends x {
1511
1568
  constructor(e) {
1512
- typeof e == "number" && (e = Math.trunc(e.valueOf())), v(e) && (e = e.value), super(BigInt(e.valueOf()));
1569
+ typeof e == "number" && (e = Math.trunc(e.valueOf())), b(e) && (e = e.value), super(BigInt(e.valueOf()));
1513
1570
  }
1514
1571
  static fromSeconds(t) {
1515
- return t instanceof e ? t : t instanceof O ? t.period : t instanceof E ? new e(t) : (v(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.seconds(t) : new e(t));
1572
+ return t instanceof e ? t : t instanceof A ? t.period : t instanceof O ? new e(t) : (b(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.seconds(t) : new e(t));
1516
1573
  }
1517
1574
  static fromMilliseconds(t) {
1518
- return t instanceof e ? t : t instanceof O ? t.period : t instanceof E ? new e(t) : (v(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.milliseconds(t) : new e(t));
1575
+ return t instanceof e ? t : t instanceof A ? t.period : t instanceof O ? new e(t) : (b(t) && (t = t.value), ["number", "bigint"].includes(typeof t) ? e.milliseconds(t) : new e(t));
1519
1576
  }
1520
1577
  valueOf() {
1521
1578
  return this.value;
1522
1579
  }
1580
+ hash() {
1581
+ return this.value.toString();
1582
+ }
1523
1583
  lessThan(t) {
1524
1584
  return this.valueOf() < new e(t).valueOf();
1525
1585
  }
@@ -1533,37 +1593,37 @@ var wt = (e, t, n = {}) => {
1533
1593
  return this.valueOf() >= new e(t).valueOf();
1534
1594
  }
1535
1595
  remainder(e) {
1536
- return _r(this, e);
1596
+ return Ar(this, e);
1537
1597
  }
1538
1598
  truncate(t) {
1539
1599
  return new e(BigInt(Math.trunc(Number(this.valueOf() / t.valueOf()))) * t.valueOf());
1540
1600
  }
1541
1601
  toString(t = "full") {
1542
1602
  if (t === "semantic") return this.toSemanticString();
1543
- let n = this.truncate(e.DAY), r = this.truncate(e.HOUR), i = this.truncate(e.MINUTE), a = this.truncate(e.SECOND), o = this.truncate(e.MILLISECOND), s = this.truncate(e.MICROSECOND), c = this.truncate(e.NANOSECOND), l = n, u = r.sub(n), d = i.sub(r), f = a.sub(i), p = o.sub(a), m = s.sub(o), ee = c.sub(s), h = "";
1544
- return l.isZero || (h += `${l.days}d `), u.isZero || (h += `${u.hours}h `), d.isZero || (h += `${d.minutes}m `), f.isZero || (h += `${f.seconds}s `), p.isZero || (h += `${p.milliseconds}ms `), m.isZero || (h += `${m.microseconds}µs `), ee.isZero || (h += `${ee.nanoseconds}ns`), h.trim();
1603
+ let n = this.truncate(e.DAY), r = this.truncate(e.HOUR), i = this.truncate(e.MINUTE), a = this.truncate(e.SECOND), o = this.truncate(e.MILLISECOND), s = this.truncate(e.MICROSECOND), c = this.truncate(e.NANOSECOND), l = n, u = r.sub(n), d = i.sub(r), f = a.sub(i), p = o.sub(a), m = s.sub(o), h = c.sub(s), g = "";
1604
+ return l.isZero || (g += `${l.days}d `), u.isZero || (g += `${u.hours}h `), d.isZero || (g += `${d.minutes}m `), f.isZero || (g += `${f.seconds}s `), p.isZero || (g += `${p.milliseconds}ms `), m.isZero || (g += `${m.microseconds}µs `), h.isZero || (g += `${h.nanoseconds}ns`), g.trim();
1545
1605
  }
1546
1606
  toSemanticString() {
1547
1607
  let t = new e(this.valueOf() < 0n ? -this.valueOf() : this.valueOf()), n = this.valueOf() < 0n;
1548
1608
  if (t.valueOf() === 0n) return "0s";
1549
1609
  if (t.lessThan(e.SECOND)) return "< 1s";
1550
- let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r / mr), c = Math.floor(r / hr), l = Math.floor(r / 7), u = Math.floor(r), d = Math.floor(i), f = Math.floor(a), p = Math.floor(o), m = n ? "-" : "";
1610
+ let r = t.days, i = t.hours, a = t.minutes, o = t.seconds, s = Math.floor(r / Dr), c = Math.floor(r / Or), l = Math.floor(r / 7), u = Math.floor(r), d = Math.floor(i), f = Math.floor(a), p = Math.floor(o), m = n ? "-" : "";
1551
1611
  if (s >= 1) {
1552
1612
  let e = `${s}y`;
1553
1613
  if (s < 2) {
1554
- let t = Math.floor(r % mr / hr);
1614
+ let t = Math.floor(r % Dr / Or);
1555
1615
  t > 0 && (e += ` ${t}mo`);
1556
1616
  }
1557
1617
  return m + e;
1558
1618
  }
1559
- if (l >= 1 && r < hr && r % 7 == 0) {
1619
+ if (l >= 1 && r < Or && r % 7 == 0) {
1560
1620
  let e = `${l}w`, t = Math.floor(r % 7), n = Math.floor(i - l * 7 * 24);
1561
1621
  return l < 2 && (t > 0 ? e += ` ${t}d` : n > 0 && n < 24 && (e += ` ${n}h`)), m + e;
1562
1622
  }
1563
1623
  if (c >= 1) {
1564
1624
  let e = `${c}mo`;
1565
1625
  if (c < 3) {
1566
- let t = Math.floor(r % hr);
1626
+ let t = Math.floor(r % Or);
1567
1627
  t > 0 && (e += ` ${t}d`);
1568
1628
  }
1569
1629
  return m + e;
@@ -1595,10 +1655,10 @@ var wt = (e, t, n = {}) => {
1595
1655
  return `${m}${p}s`;
1596
1656
  }
1597
1657
  mult(t) {
1598
- return new e(C(this.valueOf(), t));
1658
+ return new e(w(this.valueOf(), t));
1599
1659
  }
1600
1660
  div(t) {
1601
- return new e(qt(this.valueOf(), t));
1661
+ return new e(Yt(this.valueOf(), t));
1602
1662
  }
1603
1663
  get days() {
1604
1664
  return Number(this.valueOf()) / Number(e.DAY.valueOf());
@@ -1642,30 +1702,30 @@ var wt = (e, t, n = {}) => {
1642
1702
  }
1643
1703
  static NANOSECOND = e.nanoseconds(1);
1644
1704
  static microseconds(t = 1) {
1645
- return e.nanoseconds(C(t, 1e3));
1705
+ return e.nanoseconds(w(t, 1e3));
1646
1706
  }
1647
1707
  static MICROSECOND = e.microseconds(1);
1648
1708
  static milliseconds(t = 1) {
1649
- return e.microseconds(C(t, 1e3));
1709
+ return e.microseconds(w(t, 1e3));
1650
1710
  }
1651
1711
  static MILLISECOND = e.milliseconds(1);
1652
1712
  static seconds(t = 1) {
1653
- return e.milliseconds(C(t, 1e3));
1713
+ return e.milliseconds(w(t, 1e3));
1654
1714
  }
1655
1715
  static SECOND = e.seconds(1);
1656
1716
  static minutes(t = 1) {
1657
- return e.seconds(C(t, 60));
1717
+ return e.seconds(w(t, 60));
1658
1718
  }
1659
1719
  static MINUTE = e.minutes(1);
1660
1720
  static hours(t) {
1661
- return e.minutes(C(t, 60));
1721
+ return e.minutes(w(t, 60));
1662
1722
  }
1663
1723
  static HOUR = e.hours(1);
1664
1724
  static days(t) {
1665
- return e.hours(C(t, 24));
1725
+ return e.hours(w(t, 24));
1666
1726
  }
1667
1727
  static DAY = e.days(1);
1668
- static MAX = new e(Lt);
1728
+ static MAX = new e(Rt);
1669
1729
  static MIN = new e(0);
1670
1730
  static ZERO = new e(0);
1671
1731
  static z = t.union([
@@ -1674,12 +1734,15 @@ var wt = (e, t, n = {}) => {
1674
1734
  t.number().transform((t) => new e(t)),
1675
1735
  t.bigint().transform((t) => new e(t)),
1676
1736
  t.instanceof(e),
1677
- t.instanceof(E).transform((t) => new e(t)),
1678
- t.custom((e) => e instanceof O).transform((t) => new e(t))
1737
+ t.instanceof(O).transform((t) => new e(t)),
1738
+ t.custom((e) => e instanceof A).transform((t) => new e(t))
1679
1739
  ]);
1680
- }, O = class e extends y {
1740
+ }, A = class e extends x {
1681
1741
  constructor(e) {
1682
- v(e) && (e = e.value), super(e.valueOf());
1742
+ b(e) && (e = e.value), super(e.valueOf());
1743
+ }
1744
+ hash() {
1745
+ return this.value.toString();
1683
1746
  }
1684
1747
  toString() {
1685
1748
  return `${this.valueOf()} Hz`;
@@ -1688,31 +1751,31 @@ var wt = (e, t, n = {}) => {
1688
1751
  return this.valueOf() === new e(t).valueOf();
1689
1752
  }
1690
1753
  get period() {
1691
- return D.seconds(1 / this.valueOf());
1754
+ return k.seconds(1 / this.valueOf());
1692
1755
  }
1693
1756
  sampleCount(e) {
1694
- return new D(e).seconds * this.valueOf();
1757
+ return new k(e).seconds * this.valueOf();
1695
1758
  }
1696
1759
  byteCount(e, t) {
1697
- return this.sampleCount(e) * new k(t).valueOf();
1760
+ return this.sampleCount(e) * new j(t).valueOf();
1698
1761
  }
1699
1762
  span(e) {
1700
- return D.seconds(e / this.valueOf());
1763
+ return k.seconds(e / this.valueOf());
1701
1764
  }
1702
1765
  byteSpan(e, t) {
1703
- return this.span(e.valueOf() / new k(t).valueOf());
1766
+ return this.span(e.valueOf() / new j(t).valueOf());
1704
1767
  }
1705
1768
  add(t) {
1706
- return new e(S(this.valueOf(), new e(t).valueOf()));
1769
+ return new e(C(this.valueOf(), new e(t).valueOf()));
1707
1770
  }
1708
1771
  sub(t) {
1709
- return new e(x(this.valueOf(), new e(t).valueOf()));
1772
+ return new e(S(this.valueOf(), new e(t).valueOf()));
1710
1773
  }
1711
1774
  mult(t) {
1712
- return new e(C(this.valueOf(), t));
1775
+ return new e(w(this.valueOf(), t));
1713
1776
  }
1714
1777
  div(t) {
1715
- return new e(qt(this.valueOf(), t));
1778
+ return new e(Yt(this.valueOf(), t));
1716
1779
  }
1717
1780
  static hz(t) {
1718
1781
  return new e(t);
@@ -1721,27 +1784,27 @@ var wt = (e, t, n = {}) => {
1721
1784
  return e.hz(t * 1e3);
1722
1785
  }
1723
1786
  static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
1724
- }, k = class e extends y {
1787
+ }, j = class e extends x {
1725
1788
  constructor(e) {
1726
- v(e) && (e = e.value), super(e.valueOf());
1789
+ b(e) && (e = e.value), super(e.valueOf());
1727
1790
  }
1728
1791
  length(e) {
1729
1792
  return e.valueOf() / this.valueOf();
1730
1793
  }
1731
1794
  size(e) {
1732
- return new M(e * this.valueOf());
1795
+ return new P(e * this.valueOf());
1733
1796
  }
1734
1797
  add(t) {
1735
- return new e(S(this.valueOf(), new e(t).valueOf()));
1798
+ return new e(C(this.valueOf(), new e(t).valueOf()));
1736
1799
  }
1737
1800
  sub(t) {
1738
- return new e(x(this.valueOf(), new e(t).valueOf()));
1801
+ return new e(S(this.valueOf(), new e(t).valueOf()));
1739
1802
  }
1740
1803
  mult(t) {
1741
- return new e(C(this.valueOf(), t));
1804
+ return new e(w(this.valueOf(), t));
1742
1805
  }
1743
1806
  div(t) {
1744
- return new e(qt(this.valueOf(), t));
1807
+ return new e(Yt(this.valueOf(), t));
1745
1808
  }
1746
1809
  static UNKNOWN = new e(0);
1747
1810
  static BIT128 = new e(16);
@@ -1750,14 +1813,17 @@ var wt = (e, t, n = {}) => {
1750
1813
  static BIT16 = new e(2);
1751
1814
  static BIT8 = new e(1);
1752
1815
  static z = t.union([t.number().transform((t) => new e(t)), t.instanceof(e)]);
1753
- }, A = class e {
1816
+ }, M = class e {
1817
+ hash() {
1818
+ return `${this.start.hash()}-${this.end.hash()}`;
1819
+ }
1754
1820
  start;
1755
1821
  end;
1756
1822
  constructor(e, t) {
1757
- typeof e == "object" && "start" in e ? (this.start = new E(e.start), this.end = new E(e.end)) : (this.start = new E(e), this.end = new E(t));
1823
+ typeof e == "object" && "start" in e ? (this.start = new O(e.start), this.end = new O(e.end)) : (this.start = new O(e), this.end = new O(t));
1758
1824
  }
1759
1825
  get span() {
1760
- return new D(this.end.valueOf() - this.start.valueOf());
1826
+ return new k(this.end.valueOf() - this.start.valueOf());
1761
1827
  }
1762
1828
  get isValid() {
1763
1829
  return this.start.valueOf() <= this.end.valueOf();
@@ -1783,7 +1849,7 @@ var wt = (e, t, n = {}) => {
1783
1849
  upper: Number(this.end.valueOf())
1784
1850
  };
1785
1851
  }
1786
- equals(e, t = D.ZERO) {
1852
+ equals(e, t = k.ZERO) {
1787
1853
  if (t.isZero) return this.start.equals(e.start) && this.end.equals(e.end);
1788
1854
  let n = this.start.sub(e.start).valueOf(), r = this.end.sub(e.end).valueOf();
1789
1855
  return n < 0 && (n = -n), r < 0 && (r = -r), n <= t.valueOf() && r <= t.valueOf();
@@ -1794,13 +1860,13 @@ var wt = (e, t, n = {}) => {
1794
1860
  toPrettyString() {
1795
1861
  return `${this.start.toString("preciseDate")} - ${this.span.toString()}`;
1796
1862
  }
1797
- overlapsWith(e, t = D.ZERO) {
1863
+ overlapsWith(e, t = k.ZERO) {
1798
1864
  e = e.makeValid();
1799
1865
  let n = this.makeValid();
1800
1866
  if (this.equals(e)) return !0;
1801
1867
  if (e.end.equals(n.start) || n.end.equals(e.start)) return !1;
1802
- let r = E.max(n.start, e.start), i = E.min(n.end, e.end);
1803
- return i.before(r) ? !1 : new D(i.sub(r)).greaterThanOrEqual(t);
1868
+ let r = O.max(n.start, e.start), i = O.min(n.end, e.end);
1869
+ return i.before(r) ? !1 : new k(i.sub(r)).greaterThanOrEqual(t);
1804
1870
  }
1805
1871
  contains(t) {
1806
1872
  return t instanceof e ? this.contains(t.start) && this.contains(t.end) : this.start.beforeEq(t) && this.end.after(t);
@@ -1810,24 +1876,27 @@ var wt = (e, t, n = {}) => {
1810
1876
  return t.start.after(this.start) && (n.start = t.start), t.start.after(this.end) && (n.end = t.start), t.end.before(this.end) && (n.end = t.end), t.end.before(this.start) && (n.start = t.end), n;
1811
1877
  }
1812
1878
  static max(...t) {
1813
- return new e(E.min(...t.map((e) => e.start)), E.max(...t.map((e) => e.end)));
1879
+ return new e(O.min(...t.map((e) => e.start)), O.max(...t.map((e) => e.end)));
1814
1880
  }
1815
- static MAX = new e(E.MIN, E.MAX);
1816
- static ZERO = new e(E.ZERO, E.ZERO);
1881
+ static MAX = new e(O.MIN, O.MAX);
1882
+ static ZERO = new e(O.ZERO, O.ZERO);
1817
1883
  static z = t.union([t.object({
1818
- start: E.z,
1819
- end: E.z
1884
+ start: O.z,
1885
+ end: O.z
1820
1886
  }).transform((t) => new e(t.start, t.end)), t.instanceof(e)]);
1821
- static boundedZ = e.z.refine(({ isValid: e }) => e, { message: "Time range start time must be before or equal to time range end time" }).refine(({ end: e }) => e.valueOf() <= Lt, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >= It, { message: "Time range start time must be greater than or equal to the minimum value of an int64" });
1887
+ static boundedZ = e.z.refine(({ isValid: e }) => e, { message: "Time range start time must be before or equal to time range end time" }).refine(({ end: e }) => e.valueOf() <= Rt, { message: "Time range end time must be less than or equal to the maximum value of an int64" }).refine(({ start: e }) => e.valueOf() >= Lt, { message: "Time range start time must be greater than or equal to the minimum value of an int64" });
1822
1888
  static sort(e, t) {
1823
- return E.sort(e.start, t.start) || E.sort(e.end, t.end);
1889
+ return O.sort(e.start, t.start) || O.sort(e.end, t.end);
1824
1890
  }
1825
1891
  static merge(...t) {
1826
1892
  return e.max(...t.map((t) => new e(t).makeValid()));
1827
1893
  }
1828
- }, j = class e extends y {
1894
+ }, N = class e extends x {
1895
+ hash() {
1896
+ return this.value;
1897
+ }
1829
1898
  constructor(t) {
1830
- if (v(t) && (t = t.value), t instanceof e || typeof t == "string" || typeof t.valueOf() == "string") super(t.valueOf());
1899
+ if (b(t) && (t = t.value), t instanceof e || typeof t == "string" || typeof t.valueOf() == "string") super(t.valueOf());
1831
1900
  else {
1832
1901
  let n = e.ARRAY_CONSTRUCTOR_DATA_TYPES.get(t.constructor.name);
1833
1902
  if (n == null) throw Error(`unable to find data type for ${t.toString()}`);
@@ -1930,21 +1999,21 @@ var wt = (e, t, n = {}) => {
1930
1999
  [BigInt64Array.name, e.INT64]
1931
2000
  ]);
1932
2001
  static DENSITIES = new Map([
1933
- [e.UINT8.toString(), k.BIT8],
1934
- [e.UINT16.toString(), k.BIT16],
1935
- [e.UINT32.toString(), k.BIT32],
1936
- [e.UINT64.toString(), k.BIT64],
1937
- [e.FLOAT32.toString(), k.BIT32],
1938
- [e.FLOAT64.toString(), k.BIT64],
1939
- [e.INT8.toString(), k.BIT8],
1940
- [e.INT16.toString(), k.BIT16],
1941
- [e.INT32.toString(), k.BIT32],
1942
- [e.INT64.toString(), k.BIT64],
1943
- [e.TIMESTAMP.toString(), k.BIT64],
1944
- [e.STRING.toString(), k.UNKNOWN],
1945
- [e.JSON.toString(), k.UNKNOWN],
1946
- [e.UUID.toString(), k.BIT128],
1947
- [e.BYTES.toString(), k.UNKNOWN]
2002
+ [e.UINT8.toString(), j.BIT8],
2003
+ [e.UINT16.toString(), j.BIT16],
2004
+ [e.UINT32.toString(), j.BIT32],
2005
+ [e.UINT64.toString(), j.BIT64],
2006
+ [e.FLOAT32.toString(), j.BIT32],
2007
+ [e.FLOAT64.toString(), j.BIT64],
2008
+ [e.INT8.toString(), j.BIT8],
2009
+ [e.INT16.toString(), j.BIT16],
2010
+ [e.INT32.toString(), j.BIT32],
2011
+ [e.INT64.toString(), j.BIT64],
2012
+ [e.TIMESTAMP.toString(), j.BIT64],
2013
+ [e.STRING.toString(), j.UNKNOWN],
2014
+ [e.JSON.toString(), j.UNKNOWN],
2015
+ [e.UUID.toString(), j.BIT128],
2016
+ [e.BYTES.toString(), j.UNKNOWN]
1948
2017
  ]);
1949
2018
  static ALL = [
1950
2019
  e.UNKNOWN,
@@ -1987,27 +2056,27 @@ var wt = (e, t, n = {}) => {
1987
2056
  e.TIMESTAMP
1988
2057
  ];
1989
2058
  static z = t.union([t.string().transform((t) => new e(t)), t.instanceof(e)]);
1990
- }, M = class e extends y {
2059
+ }, P = class e extends x {
1991
2060
  constructor(e) {
1992
- v(e) && (e = e.value), super(e.valueOf());
2061
+ b(e) && (e = e.value), super(e.valueOf());
1993
2062
  }
1994
2063
  largerThan(e) {
1995
- return v(e) && (e = e.value), this.valueOf() > e.valueOf();
2064
+ return b(e) && (e = e.value), this.valueOf() > e.valueOf();
1996
2065
  }
1997
2066
  smallerThan(e) {
1998
- return v(e) && (e = e.value), this.valueOf() < e.valueOf();
2067
+ return b(e) && (e = e.value), this.valueOf() < e.valueOf();
1999
2068
  }
2000
2069
  add(t) {
2001
- return v(t) && (t = t.value), new e(S(this.valueOf(), t.valueOf()));
2070
+ return b(t) && (t = t.value), new e(C(this.valueOf(), t.valueOf()));
2002
2071
  }
2003
2072
  sub(t) {
2004
- return v(t) && (t = t.value), new e(x(this.valueOf(), t.valueOf()));
2073
+ return b(t) && (t = t.value), new e(S(this.valueOf(), t.valueOf()));
2005
2074
  }
2006
2075
  mult(t) {
2007
- return new e(C(this.valueOf(), t));
2076
+ return new e(w(this.valueOf(), t));
2008
2077
  }
2009
2078
  div(t) {
2010
- return new e(qt(this.valueOf(), t));
2079
+ return new e(Yt(this.valueOf(), t));
2011
2080
  }
2012
2081
  truncate(t) {
2013
2082
  return new e(Math.trunc(this.valueOf() / new e(t).valueOf()) * new e(t).valueOf());
@@ -2056,10 +2125,10 @@ var wt = (e, t, n = {}) => {
2056
2125
  get isZero() {
2057
2126
  return this.valueOf() === 0;
2058
2127
  }
2059
- }, vr = t.object({
2128
+ }, jr = t.object({
2060
2129
  start: t.number(),
2061
2130
  end: t.number()
2062
- }), yr = t.union([
2131
+ }), Mr = t.union([
2063
2132
  t.instanceof(Uint8Array),
2064
2133
  t.instanceof(Uint16Array),
2065
2134
  t.instanceof(Uint32Array),
@@ -2070,34 +2139,34 @@ var wt = (e, t, n = {}) => {
2070
2139
  t.instanceof(Int16Array),
2071
2140
  t.instanceof(Int32Array),
2072
2141
  t.instanceof(BigInt64Array)
2073
- ]), br = (e) => {
2142
+ ]), Nr = (e) => {
2074
2143
  let t = typeof e;
2075
- return t === "string" || t === "number" || t === "boolean" || t === "bigint" || e instanceof E || e instanceof D || e instanceof Date;
2076
- }, xr = (e, t, n, r = 0) => e.usesBigInt && !t.usesBigInt ? Number(n) - Number(r) : !e.usesBigInt && t.usesBigInt ? BigInt(n.valueOf()) - BigInt(r.valueOf()) : x(n, r), Sr = A.z, Cr = E.z, wr = D.z, Tr = O.z, Er = M.z, Dr = j.z, Or = A.boundedZ, kr = class {
2144
+ return t === "string" || t === "number" || t === "boolean" || t === "bigint" || e instanceof O || e instanceof k || e instanceof Date;
2145
+ }, Pr = (e, t, n, r = 0) => e.usesBigInt && !t.usesBigInt ? Number(BigInt(n.valueOf()) - BigInt(r.valueOf())) : !e.usesBigInt && t.usesBigInt ? BigInt(n.valueOf()) - BigInt(r.valueOf()) : S(n, r), Fr = M.z, Ir = O.z, Lr = k.z, Rr = A.z, zr = P.z, Br = N.z, Vr = M.boundedZ, Hr = class {
2077
2146
  now;
2078
- localStartT = new E(0);
2079
- lastSkew = D.ZERO;
2080
- constructor(e = () => E.now()) {
2147
+ localStartT = new O(0);
2148
+ lastSkew = k.ZERO;
2149
+ constructor(e = () => O.now()) {
2081
2150
  this.now = e;
2082
2151
  }
2083
2152
  start() {
2084
2153
  this.localStartT = this.now();
2085
2154
  }
2086
2155
  end(e) {
2087
- let t = this.now().span(this.localStartT).valueOf() / 2n;
2088
- this.lastSkew = new D(this.localStartT.add(t).valueOf() - e.valueOf());
2156
+ let t = this.now().span(this.localStartT).valueOf() / 2n, n = this.localStartT.add(t);
2157
+ this.lastSkew = new k(n.valueOf() - e.valueOf());
2089
2158
  }
2090
2159
  get skew() {
2091
2160
  return this.lastSkew;
2092
2161
  }
2093
2162
  exceeds(e) {
2094
2163
  let t = this.skew.valueOf();
2095
- return (t < 0n ? -t : t) > new D(e).valueOf();
2164
+ return (t < 0n ? -t : t) > new k(e).valueOf();
2096
2165
  }
2097
- }, Ar = /* @__PURE__ */ r({
2098
- by: () => Mr,
2099
- unique: () => jr
2100
- }), jr = (e) => [...new Set(e)], Mr = (e, t, n = !0) => {
2166
+ }, Ur = /* @__PURE__ */ r({
2167
+ by: () => Gr,
2168
+ unique: () => Wr
2169
+ }), Wr = (e) => [...new Set(e)], Gr = (e, t, n = !0) => {
2101
2170
  let r = /* @__PURE__ */ new Map();
2102
2171
  return e.forEach((e) => {
2103
2172
  let i = t(e);
@@ -2107,7 +2176,7 @@ var wt = (e, t, n = {}) => {
2107
2176
  }
2108
2177
  r.set(i, e);
2109
2178
  }), Array.from(r.values());
2110
- }, Nr = (e, t = !1) => {
2179
+ }, Kr = (e, t = !1) => {
2111
2180
  let n = rt(e) ? "stringer" : typeof e, r;
2112
2181
  switch (n) {
2113
2182
  case "string":
@@ -2130,16 +2199,26 @@ var wt = (e, t, n = {}) => {
2130
2199
  break;
2131
2200
  default: return console.warn(`sortFunc: unknown type ${n}`), () => -1;
2132
2201
  }
2133
- return t ? zr(r) : r;
2134
- }, Pr = (e, t, n) => {
2135
- let r = Nr(t[e], n);
2202
+ return t ? ei(r) : r;
2203
+ }, qr = (e, t, n) => {
2204
+ let r = Kr(t[e], n);
2136
2205
  return (t, n) => r(t[e], n[e]);
2137
- }, Fr = (e, t) => e.length === t.length ? e.every((e, n) => e === t[n]) ? 0 : -1 : e.length - t.length, Ir = (e, t) => {
2206
+ }, Jr = (e, t) => e.length === t.length ? e.every((e, n) => e === t[n]) ? 0 : -1 : e.length - t.length, Yr = (e, t) => {
2138
2207
  if (e.length !== t.length) return e.length - t.length;
2139
2208
  if (e.length === 0) return 0;
2140
- let n = Nr(e[0]), r = [...e].sort(n), i = [...t].sort(n);
2209
+ let n = Kr(e[0]), r = [...e].sort(n), i = [...t].sort(n);
2141
2210
  return r.every((e, t) => e === i[t]) ? 0 : -1;
2142
- }, Lr = (e, t) => Ir(jr(e), jr(t)), Rr = (e, t) => e === t ? 0 : e === "first" && t === "last" ? 1 : -1, zr = (e) => (t, n) => e(n, t), Br = (e) => e < 0, Vr = (e) => e > 0, Hr = (e) => e >= 0, Ur = (e) => e === 0, Wr = (e, t) => {
2211
+ }, Xr = (e, t) => Yr(Wr(e), Wr(t)), Zr = (e, t) => {
2212
+ if (e === t) return !0;
2213
+ if (e.size !== t.size) return !1;
2214
+ for (let [n, r] of e) if (!t.has(n) || t.get(n) !== r) return !1;
2215
+ return !0;
2216
+ }, Qr = (e, t) => {
2217
+ if (e === t) return !0;
2218
+ if (e.length !== t.length) return !1;
2219
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
2220
+ return !0;
2221
+ }, $r = (e, t) => e === t ? 0 : e === "first" && t === "last" ? 1 : -1, ei = (e) => (t, n) => e(n, t), ti = (e) => e < 0, ni = (e) => e > 0, ri = (e) => e >= 0, ii = (e) => e === 0, ai = (e, t) => {
2143
2222
  let n = /([a-zA-Z]+)|(\d+)/g, r = e.replace(/[\s_.-]+/g, "").match(n), i = t.replace(/[\s_.-]+/g, "").match(n);
2144
2223
  if (!r || !i) return 0;
2145
2224
  for (let e = 0; e < Math.min(r.length, i.length); e++) {
@@ -2153,96 +2232,103 @@ var wt = (e, t, n = {}) => {
2153
2232
  } else return isNaN(Number(t)) ? -1 : 1;
2154
2233
  }
2155
2234
  return r.length - i.length;
2156
- }, Gr = (e, t, n) => {
2157
- let r = 0, i = e.length, a = n ?? Nr(t);
2235
+ }, oi = (e, t, n) => {
2236
+ let r = 0, i = e.length, a = n ?? Kr(t);
2158
2237
  for (; r < i;) {
2159
2238
  let n = Math.floor((r + i) / 2), o = a(e[n], t);
2160
2239
  if (o === 0) return n;
2161
2240
  o < 0 ? r = n + 1 : i = n;
2162
2241
  }
2163
2242
  return r;
2164
- }, Kr = (e, t, n) => {
2165
- let r = Gr(e, t, n);
2243
+ }, si = (e, t, n) => {
2244
+ let r = oi(e, t, n);
2166
2245
  e.splice(r, 0, t);
2167
- }, qr = /* @__PURE__ */ r({
2246
+ }, ci = /* @__PURE__ */ r({
2168
2247
  EQUAL: () => 0,
2169
2248
  GREATER_THAN: () => 1,
2170
2249
  LESS_THAN: () => -1,
2171
- insert: () => Kr,
2172
- isEqualTo: () => Ur,
2173
- isGreaterThan: () => Vr,
2174
- isGreaterThanEqual: () => Hr,
2175
- isLessThan: () => Br,
2176
- newF: () => Nr,
2177
- newFieldF: () => Pr,
2178
- order: () => Rr,
2179
- primitiveArrays: () => Fr,
2180
- reverseF: () => zr,
2181
- search: () => Gr,
2182
- stringsWithNumbers: () => Wr,
2183
- uniqueUnorderedPrimitiveArrays: () => Lr,
2184
- unorderedPrimitiveArrays: () => Ir
2185
- }), Jr = (e, t = 21) => (n = t) => {
2250
+ arraysEqual: () => Qr,
2251
+ insert: () => si,
2252
+ isEqualTo: () => ii,
2253
+ isGreaterThan: () => ni,
2254
+ isGreaterThanEqual: () => ri,
2255
+ isLessThan: () => ti,
2256
+ mapsEqual: () => Zr,
2257
+ newF: () => Kr,
2258
+ newFieldF: () => qr,
2259
+ order: () => $r,
2260
+ primitiveArrays: () => Jr,
2261
+ reverseF: () => ei,
2262
+ search: () => oi,
2263
+ stringsWithNumbers: () => ai,
2264
+ uniqueUnorderedPrimitiveArrays: () => Xr,
2265
+ unorderedPrimitiveArrays: () => Yr
2266
+ }), li = (e, t = 21) => (n = t) => {
2186
2267
  let r = "", i = n | 0;
2187
2268
  for (; i--;) r += e[Math.random() * e.length | 0];
2188
2269
  return r;
2189
- }, Yr = /* @__PURE__ */ r({
2270
+ }, ui = /* @__PURE__ */ r({
2190
2271
  LENGTH: () => 11,
2191
- create: () => ei
2192
- }), Xr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", Zr = `0123456789${Xr}`, Qr = Jr(Xr, 1), $r = Jr(Zr, 10), ei = () => `${Qr()}${$r()}`, ti = /* @__PURE__ */ r({ createMatcher: () => ni }), ni = (e, t) => (n) => n instanceof t || typeof n == "object" && !!n && "discriminator" in n && n.discriminator === e, ri = /* @__PURE__ */ r({
2193
- DIRECTIONS: () => Yt,
2194
- construct: () => N,
2195
- crude: () => ii,
2196
- dimension: () => oi,
2197
- directionZ: () => Xt,
2198
- isDirection: () => ci,
2199
- isX: () => ui,
2200
- isY: () => di,
2201
- location: () => si,
2202
- signedDimension: () => li,
2203
- swap: () => ai
2204
- }), ii = gn, N = (e) => Yt.includes(e) ? e : tn.includes(e) ? "y" : "x", ai = (e) => N(e) === "x" ? "y" : "x", oi = (e) => N(e) === "x" ? "width" : "height", si = (e) => N(e) === "x" ? "left" : "top", ci = (e) => ii.safeParse(e).success, li = (e) => N(e) === "x" ? "signedWidth" : "signedHeight", ui = (e) => e === "center" ? !1 : N(e) === "x", di = (e) => N(e) === "y", fi = /* @__PURE__ */ r({
2205
- BOTTOM_CENTER: () => Ai,
2206
- BOTTOM_LEFT: () => Ei,
2207
- BOTTOM_RIGHT: () => Di,
2208
- CENTER: () => Oi,
2209
- CENTER_LEFT: () => Mi,
2210
- CENTER_LOCATIONS: () => rn,
2211
- CENTER_RIGHT: () => ji,
2212
- LOCATIONS: () => on,
2213
- OUTER_LOCATIONS: () => Zt,
2214
- TOP_CENTER: () => ki,
2215
- TOP_LEFT: () => F,
2216
- TOP_RIGHT: () => Ti,
2217
- XY_LOCATIONS: () => Ni,
2218
- X_LOCATIONS: () => $t,
2219
- Y_LOCATIONS: () => tn,
2220
- center: () => hi,
2221
- construct: () => P,
2222
- constructXY: () => Bi,
2223
- corner: () => wi,
2224
- crude: () => yi,
2225
- direction: () => Si,
2226
- isX: () => Li,
2227
- isY: () => Ri,
2228
- locationZ: () => sn,
2229
- outerZ: () => gi,
2230
- rotate: () => xi,
2231
- swap: () => bi,
2232
- x: () => pi,
2233
- xy: () => Ci,
2234
- xyCouple: () => Ii,
2235
- xyEquals: () => Pi,
2236
- xyMatches: () => Fi,
2237
- xyToString: () => zi,
2238
- y: () => mi
2239
- }), pi = en, mi = nn, hi = an, gi = Qt, _i = {
2272
+ create: () => hi
2273
+ }), di = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", fi = `0123456789${di}`, pi = li(di, 1), mi = li(fi, 10), hi = () => `${pi()}${mi()}`, gi = /* @__PURE__ */ r({ createMatcher: () => _i }), _i = (e, t) => (n) => n instanceof t || typeof n == "object" && !!n && "discriminator" in n && n.discriminator === e, vi = /* @__PURE__ */ r({
2274
+ DIRECTIONS: () => on,
2275
+ construct: () => F,
2276
+ crudeZ: () => yi,
2277
+ dimension: () => xi,
2278
+ directionZ: () => sn,
2279
+ isDirection: () => Ci,
2280
+ isX: () => Ti,
2281
+ isY: () => Ei,
2282
+ location: () => Si,
2283
+ signedDimension: () => wi,
2284
+ swap: () => bi
2285
+ }), yi = e.enum([
2286
+ "x",
2287
+ "y",
2288
+ ...rn,
2289
+ ...un
2290
+ ]), F = (e) => on.includes(e) ? e : $t.includes(e) ? "y" : "x", bi = (e) => F(e) === "x" ? "y" : "x", xi = (e) => F(e) === "x" ? "width" : "height", Si = (e) => F(e) === "x" ? "left" : "top", Ci = (e) => yi.safeParse(e).success, wi = (e) => F(e) === "x" ? "signedWidth" : "signedHeight", Ti = (e) => e === "center" ? !1 : F(e) === "x", Ei = (e) => F(e) === "y", Di = /* @__PURE__ */ r({
2291
+ BOTTOM_CENTER: () => Ki,
2292
+ BOTTOM_LEFT: () => Hi,
2293
+ BOTTOM_RIGHT: () => Ui,
2294
+ CENTER: () => Wi,
2295
+ CENTER_LEFT: () => Ji,
2296
+ CENTER_LOCATIONS: () => un,
2297
+ CENTER_RIGHT: () => qi,
2298
+ LOCATIONS: () => fn,
2299
+ OUTER_LOCATIONS: () => rn,
2300
+ TOP_CENTER: () => Gi,
2301
+ TOP_LEFT: () => Bi,
2302
+ TOP_RIGHT: () => Vi,
2303
+ XY_LOCATIONS: () => Yi,
2304
+ X_LOCATIONS: () => Zt,
2305
+ Y_LOCATIONS: () => $t,
2306
+ centerZ: () => Ai,
2307
+ construct: () => I,
2308
+ constructXY: () => na,
2309
+ cornerZ: () => Mi,
2310
+ crudeZ: () => Fi,
2311
+ direction: () => Ri,
2312
+ isX: () => $i,
2313
+ isY: () => ea,
2314
+ locationZ: () => pn,
2315
+ outerZ: () => ji,
2316
+ rotate: () => Li,
2317
+ swap: () => Ii,
2318
+ xZ: () => Oi,
2319
+ xy: () => zi,
2320
+ xyCouple: () => Qi,
2321
+ xyEquals: () => Xi,
2322
+ xyMatches: () => Zi,
2323
+ xyToString: () => ta,
2324
+ yZ: () => ki
2325
+ }), Oi = Qt, ki = en, Ai = dn, ji = an, Mi = Sn, Ni = {
2240
2326
  top: "bottom",
2241
2327
  right: "left",
2242
2328
  bottom: "top",
2243
2329
  left: "right",
2244
2330
  center: "center"
2245
- }, vi = {
2331
+ }, Pi = {
2246
2332
  top: {
2247
2333
  clockwise: "left",
2248
2334
  counterclockwise: "right"
@@ -2259,110 +2345,103 @@ var wt = (e, t, n = {}) => {
2259
2345
  clockwise: "bottom",
2260
2346
  counterclockwise: "top"
2261
2347
  }
2262
- }, yi = _n, P = (e) => e instanceof String || !Yt.includes(e) ? e : e === "x" ? "left" : "top", bi = (e) => _i[P(e)], xi = (e, t) => vi[e][t], Si = (e) => {
2263
- let t = P(e);
2348
+ }, Fi = t.union([
2349
+ sn,
2350
+ t.enum([...rn, ...un]),
2351
+ t.instanceof(String)
2352
+ ]), I = (e) => e instanceof String || !on.includes(e) ? e : e === "x" ? "left" : "top", Ii = (e) => Ni[I(e)], Li = (e, t) => Pi[e][t], Ri = (e) => {
2353
+ let t = I(e);
2264
2354
  return t === "top" || t === "bottom" ? "y" : "x";
2265
- }, Ci = t.object({
2266
- x: en.or(an),
2267
- y: nn.or(an)
2268
- }), wi = t.object({
2269
- x: en,
2270
- y: nn
2271
- }), F = Object.freeze({
2355
+ }, zi = t.object({
2356
+ x: Qt.or(dn),
2357
+ y: en.or(dn)
2358
+ }), Bi = Object.freeze({
2272
2359
  x: "left",
2273
2360
  y: "top"
2274
- }), Ti = Object.freeze({
2361
+ }), Vi = Object.freeze({
2275
2362
  x: "right",
2276
2363
  y: "top"
2277
- }), Ei = Object.freeze({
2364
+ }), Hi = Object.freeze({
2278
2365
  x: "left",
2279
2366
  y: "bottom"
2280
- }), Di = Object.freeze({
2367
+ }), Ui = Object.freeze({
2281
2368
  x: "right",
2282
2369
  y: "bottom"
2283
- }), Oi = Object.freeze({
2370
+ }), Wi = Object.freeze({
2284
2371
  x: "center",
2285
2372
  y: "center"
2286
- }), ki = Object.freeze({
2373
+ }), Gi = Object.freeze({
2287
2374
  x: "center",
2288
2375
  y: "top"
2289
- }), Ai = Object.freeze({
2376
+ }), Ki = Object.freeze({
2290
2377
  x: "center",
2291
2378
  y: "bottom"
2292
- }), ji = Object.freeze({
2379
+ }), qi = Object.freeze({
2293
2380
  x: "right",
2294
2381
  y: "center"
2295
- }), Mi = Object.freeze({
2382
+ }), Ji = Object.freeze({
2296
2383
  x: "left",
2297
2384
  y: "center"
2298
- }), Ni = Object.freeze([
2299
- Mi,
2300
- ji,
2301
- ki,
2302
- Ai,
2303
- F,
2304
- Ti,
2305
- Ei,
2306
- Di,
2307
- Oi
2308
- ]), Pi = (e, t) => e.x === t.x && e.y === t.y, Fi = (e, t) => {
2385
+ }), Yi = Object.freeze([
2386
+ Ji,
2387
+ qi,
2388
+ Gi,
2389
+ Ki,
2390
+ Bi,
2391
+ Vi,
2392
+ Hi,
2393
+ Ui,
2394
+ Wi
2395
+ ]), Xi = (e, t) => e.x === t.x && e.y === t.y, Zi = (e, t) => {
2309
2396
  if (typeof t == "object") {
2310
2397
  let n = !0;
2311
2398
  return "x" in t && e.x !== t.x && (n = !1), "y" in t && e.y !== t.y && (n = !1), n;
2312
2399
  }
2313
2400
  return e.x === t || e.y === t;
2314
- }, Ii = (e) => [e.x, e.y], Li = (e) => Si(P(e)) === "x", Ri = (e) => Si(P(e)) === "y", zi = (e) => `${e.x}${ae(e.y)}`, Bi = (e, t) => {
2401
+ }, Qi = (e) => [e.x, e.y], $i = (e) => Ri(I(e)) === "x", ea = (e) => Ri(I(e)) === "y", ta = (e) => `${e.x}${ie(e.y)}`, na = (e, t) => {
2315
2402
  let n, r;
2316
- if (typeof e == "object" && "x" in e ? (n = e.x, r = e.y) : (n = P(e), r = P(t ?? e)), Si(n) === Si(r) && n !== "center" && r !== "center") throw Error(`[XYLocation] - encountered two locations with the same direction: ${n.toString()} - ${r.toString()}`);
2317
- let i = { ...Oi };
2318
- return n === "center" ? Li(r) ? [i.x, i.y] = [r, n] : [i.x, i.y] = [n, r] : Li(n) ? [i.x, i.y] = [n, r] : [i.x, i.y] = [r, n], i;
2319
- }, Vi = [
2320
- "top",
2321
- "right",
2322
- "bottom",
2323
- "left"
2324
- ], Hi = t.enum(Vi), I = t.object({
2325
- x: t.number(),
2326
- y: t.number()
2327
- }), Ui = /* @__PURE__ */ r({
2328
- INFINITY: () => Ki,
2329
- NAN: () => qi,
2330
- ONE: () => Gi,
2403
+ if (typeof e == "object" && "x" in e ? (n = e.x, r = e.y) : (n = I(e), r = I(t ?? e)), Ri(n) === Ri(r) && n !== "center" && r !== "center") throw Error(`[XYLocation] - encountered two locations with the same direction: ${n.toString()} - ${r.toString()}`);
2404
+ let i = { ...Wi };
2405
+ return n === "center" ? $i(r) ? [i.x, i.y] = [r, n] : [i.x, i.y] = [n, r] : $i(n) ? [i.x, i.y] = [n, r] : [i.x, i.y] = [r, n], i;
2406
+ }, ra = /* @__PURE__ */ r({
2407
+ INFINITY: () => oa,
2408
+ NAN: () => sa,
2409
+ ONE: () => aa,
2331
2410
  ZERO: () => R,
2332
- average: () => da,
2333
- calculateMiters: () => fa,
2334
- clientXyZ: () => fn,
2411
+ average: () => Ta,
2412
+ calculateMiters: () => Ea,
2413
+ clientXYZ: () => En,
2335
2414
  construct: () => L,
2336
- couple: () => aa,
2337
- crudeZ: () => Wi,
2338
- css: () => oa,
2339
- distance: () => ta,
2340
- equals: () => Ji,
2341
- isFinite: () => ia,
2342
- isNan: () => ra,
2343
- isZero: () => Yi,
2344
- normal: () => la,
2345
- normalize: () => ua,
2346
- reciprocal: () => ha,
2347
- rotate: () => ga,
2348
- round: () => ma,
2349
- scale: () => Xi,
2350
- set: () => ea,
2351
- sub: () => ca,
2352
- swap: () => pa,
2353
- translate: () => $i,
2354
- translateX: () => Zi,
2355
- translateY: () => Qi,
2356
- translation: () => na,
2357
- truncate: () => sa,
2358
- xyZ: () => I
2359
- }), Wi = t.union([
2415
+ couple: () => ya,
2416
+ crudeZ: () => ia,
2417
+ css: () => ba,
2418
+ distance: () => ha,
2419
+ equals: () => ca,
2420
+ isFinite: () => va,
2421
+ isNan: () => _a,
2422
+ isZero: () => la,
2423
+ normal: () => Ca,
2424
+ normalize: () => wa,
2425
+ reciprocal: () => ka,
2426
+ rotate: () => Aa,
2427
+ round: () => Oa,
2428
+ scale: () => ua,
2429
+ set: () => ma,
2430
+ sub: () => Sa,
2431
+ swap: () => Da,
2432
+ translate: () => pa,
2433
+ translateX: () => da,
2434
+ translateY: () => fa,
2435
+ translation: () => ga,
2436
+ truncate: () => xa,
2437
+ xyZ: () => T
2438
+ }), ia = t.union([
2360
2439
  t.number(),
2361
- I,
2362
- Jt,
2363
- pn,
2364
- mn,
2365
- fn
2440
+ T,
2441
+ An,
2442
+ wn,
2443
+ Tn,
2444
+ En
2366
2445
  ]), L = (e, t) => {
2367
2446
  if (typeof e == "string") {
2368
2447
  if (t === void 0) throw Error("The y coordinate must be given.");
@@ -2396,40 +2475,40 @@ var wt = (e, t, n = {}) => {
2396
2475
  }, R = Object.freeze({
2397
2476
  x: 0,
2398
2477
  y: 0
2399
- }), Gi = Object.freeze({
2478
+ }), aa = Object.freeze({
2400
2479
  x: 1,
2401
2480
  y: 1
2402
- }), Ki = Object.freeze({
2481
+ }), oa = Object.freeze({
2403
2482
  x: Infinity,
2404
2483
  y: Infinity
2405
- }), qi = Object.freeze({
2484
+ }), sa = Object.freeze({
2406
2485
  x: NaN,
2407
2486
  y: NaN
2408
- }), Ji = (e, t, n = 0) => {
2487
+ }), ca = (e, t, n = 0) => {
2409
2488
  let r = L(e), i = L(t);
2410
2489
  return n === 0 ? r.x === i.x && r.y === i.y : Math.abs(r.x - i.x) <= n && Math.abs(r.y - i.y) <= n;
2411
- }, Yi = (e) => Ji(e, R), Xi = (e, t, n) => {
2490
+ }, la = (e) => ca(e, R), ua = (e, t, n) => {
2412
2491
  let r = L(e), i = L(t, n);
2413
2492
  return {
2414
2493
  x: r.x * i.x,
2415
2494
  y: r.y * i.y
2416
2495
  };
2417
- }, Zi = (e, t) => {
2496
+ }, da = (e, t) => {
2418
2497
  let n = L(e);
2419
2498
  return {
2420
2499
  x: n.x + t,
2421
2500
  y: n.y
2422
2501
  };
2423
- }, Qi = (e, t) => {
2502
+ }, fa = (e, t) => {
2424
2503
  let n = L(e);
2425
2504
  return {
2426
2505
  x: n.x,
2427
2506
  y: n.y + t
2428
2507
  };
2429
- }, $i = (e, t, n, ...r) => {
2508
+ }, pa = (e, t, n, ...r) => {
2430
2509
  if (typeof t == "string") {
2431
2510
  if (typeof n != "number") throw Error("The value must be a number.");
2432
- return t === "x" ? Zi(e, n) : Qi(e, n);
2511
+ return t === "x" ? da(e, n) : fa(e, n);
2433
2512
  }
2434
2513
  if (typeof t == "object" && "x" in t && typeof t.x == "string") {
2435
2514
  let r = L(n), i = L(e);
@@ -2450,52 +2529,52 @@ var wt = (e, t, n = {}) => {
2450
2529
  y: e.y + n.y
2451
2530
  };
2452
2531
  }, R);
2453
- }, ea = (e, t, n) => {
2532
+ }, ma = (e, t, n) => {
2454
2533
  let r = L(e);
2455
- return N(t) === "x" ? {
2534
+ return F(t) === "x" ? {
2456
2535
  x: n,
2457
2536
  y: r.y
2458
2537
  } : {
2459
2538
  x: r.x,
2460
2539
  y: n
2461
2540
  };
2462
- }, ta = (e, t) => {
2541
+ }, ha = (e, t) => {
2463
2542
  let n = L(e), r = L(t);
2464
2543
  return Math.sqrt((n.x - r.x) ** 2 + (n.y - r.y) ** 2);
2465
- }, na = (e, t) => {
2544
+ }, ga = (e, t) => {
2466
2545
  let n = L(e), r = L(t);
2467
2546
  return {
2468
2547
  x: r.x - n.x,
2469
2548
  y: r.y - n.y
2470
2549
  };
2471
- }, ra = (e) => {
2550
+ }, _a = (e) => {
2472
2551
  let t = L(e);
2473
2552
  return Number.isNaN(t.x) || Number.isNaN(t.y);
2474
- }, ia = (e) => {
2553
+ }, va = (e) => {
2475
2554
  let t = L(e);
2476
2555
  return Number.isFinite(t.x) && Number.isFinite(t.y);
2477
- }, aa = (e) => {
2556
+ }, ya = (e) => {
2478
2557
  let t = L(e);
2479
2558
  return [t.x, t.y];
2480
- }, oa = (e) => {
2559
+ }, ba = (e) => {
2481
2560
  let t = L(e);
2482
2561
  return {
2483
2562
  left: t.x,
2484
2563
  top: t.y
2485
2564
  };
2486
- }, sa = (e, t = 0) => {
2565
+ }, xa = (e, t = 0) => {
2487
2566
  let n = L(e);
2488
2567
  return {
2489
2568
  x: Number(n.x.toFixed(t)),
2490
2569
  y: Number(n.y.toFixed(t))
2491
2570
  };
2492
- }, ca = (e, t) => {
2571
+ }, Sa = (e, t) => {
2493
2572
  let n = L(e), r = L(t);
2494
2573
  return {
2495
2574
  x: n.x - r.x,
2496
2575
  y: n.y - r.y
2497
2576
  };
2498
- }, la = (e) => {
2577
+ }, Ca = (e) => {
2499
2578
  let t = L(e), n = Math.hypot(t.x, t.y);
2500
2579
  return n === 0 ? {
2501
2580
  x: 0,
@@ -2504,7 +2583,7 @@ var wt = (e, t, n = {}) => {
2504
2583
  x: -t.y / n,
2505
2584
  y: t.x / n
2506
2585
  };
2507
- }, ua = (e) => {
2586
+ }, wa = (e) => {
2508
2587
  let t = L(e), n = Math.hypot(t.x, t.y);
2509
2588
  return n === 0 ? {
2510
2589
  x: 0,
@@ -2513,123 +2592,123 @@ var wt = (e, t, n = {}) => {
2513
2592
  x: t.x / n,
2514
2593
  y: t.y / n
2515
2594
  };
2516
- }, da = (...e) => Xi(e.reduce((e, t) => $i(e, t), R), 1 / e.length), fa = (e, t) => {
2595
+ }, Ta = (...e) => ua(e.reduce((e, t) => pa(e, t), R), 1 / e.length), Ea = (e, t) => {
2517
2596
  let n = [];
2518
2597
  for (let r = 0; r < e.length; r++) {
2519
2598
  let i = e[r], a, o, s, c;
2520
2599
  if (r === 0) {
2521
2600
  let n = e[r + 1];
2522
- o = la(ca(n, i)), s = o, c = t;
2601
+ o = Ca(Sa(n, i)), s = o, c = t;
2523
2602
  } else if (r === e.length - 1) {
2524
2603
  let n = e[r - 1];
2525
- a = la(ca(i, n)), s = a, c = t;
2604
+ a = Ca(Sa(i, n)), s = a, c = t;
2526
2605
  } else {
2527
- let n = e[r - 1], l = e[r + 1], u = ca(i, n), d = ca(l, i);
2528
- a = la(u), o = la(d);
2606
+ let n = e[r - 1], l = e[r + 1], u = Sa(i, n), d = Sa(l, i);
2607
+ a = Ca(u), o = Ca(d);
2529
2608
  let f = Math.acos((u.x * d.x + u.y * d.y) / (Math.hypot(u.x, u.y) * Math.hypot(d.x, d.y))), p = Math.sin(f / 2);
2530
- c = p === 0 ? t : t / p, s = ua(da(a, o));
2609
+ c = p === 0 ? t : t / p, s = wa(Ta(a, o));
2531
2610
  }
2532
- n.push(Xi(s, c));
2611
+ n.push(ua(s, c));
2533
2612
  }
2534
2613
  return n;
2535
- }, pa = (e) => {
2614
+ }, Da = (e) => {
2536
2615
  let t = L(e);
2537
2616
  return {
2538
2617
  x: t.y,
2539
2618
  y: t.x
2540
2619
  };
2541
- }, ma = (e) => {
2620
+ }, Oa = (e) => {
2542
2621
  let t = L(e);
2543
2622
  return {
2544
2623
  x: Math.round(t.x),
2545
2624
  y: Math.round(t.y)
2546
2625
  };
2547
- }, ha = (e) => {
2626
+ }, ka = (e) => {
2548
2627
  let t = L(e);
2549
2628
  return {
2550
2629
  x: 1 / t.x,
2551
2630
  y: 1 / t.y
2552
2631
  };
2553
- }, ga = (e, t, n) => {
2632
+ }, Aa = (e, t, n) => {
2554
2633
  let r = L(e), i = L(t), a = n === "clockwise" ? Math.PI / 2 : -Math.PI / 2, o = r.x - i.x, s = r.y - i.y, c = o * Math.cos(a) - s * Math.sin(a), l = o * Math.sin(a) + s * Math.cos(a);
2555
2634
  return {
2556
2635
  x: c + i.x,
2557
2636
  y: l + i.y
2558
2637
  };
2559
- }, _a = /* @__PURE__ */ r({
2560
- DECIMAL: () => Ca,
2561
- ZERO: () => Sa,
2562
- area: () => no,
2563
- areaIsZero: () => Ma,
2564
- aspect: () => $a,
2638
+ }, ja = /* @__PURE__ */ r({
2639
+ DECIMAL: () => La,
2640
+ ZERO: () => Ia,
2641
+ area: () => _o,
2642
+ areaIsZero: () => Ka,
2643
+ aspect: () => mo,
2565
2644
  bottom: () => G,
2566
- bottomCenter: () => za,
2567
- bottomLeft: () => Ra,
2568
- bottomRight: () => Ba,
2569
- box: () => xa,
2570
- center: () => Ua,
2571
- centerLeft: () => Va,
2572
- centerRight: () => Ha,
2645
+ bottomCenter: () => $a,
2646
+ bottomLeft: () => Qa,
2647
+ bottomRight: () => eo,
2648
+ box: () => Fa,
2649
+ center: () => ro,
2650
+ centerLeft: () => to,
2651
+ centerRight: () => no,
2573
2652
  construct: () => z,
2574
- constructWithAlternateRoot: () => io,
2575
- contains: () => Ea,
2576
- copy: () => wa,
2577
- css: () => Aa,
2578
- cssBox: () => ya,
2579
- dim: () => ja,
2580
- dims: () => Oa,
2581
- domRect: () => ba,
2582
- edgePoints: () => Xa,
2583
- equals: () => Da,
2653
+ constructWithAlternateRoot: () => yo,
2654
+ contains: () => Ba,
2655
+ copy: () => Ra,
2656
+ css: () => Wa,
2657
+ cssBox: () => Na,
2658
+ dim: () => Ga,
2659
+ dims: () => Ha,
2660
+ domRect: () => Pa,
2661
+ edgePoints: () => uo,
2662
+ equals: () => Va,
2584
2663
  height: () => U,
2585
- intersection: () => to,
2586
- isBox: () => Qa,
2664
+ intersection: () => go,
2665
+ isBox: () => po,
2587
2666
  left: () => K,
2588
2667
  loc: () => V,
2589
- positionInCenter: () => Za,
2590
- reRoot: () => Ya,
2591
- resize: () => Ta,
2668
+ positionInCenter: () => fo,
2669
+ reRoot: () => lo,
2670
+ resize: () => za,
2592
2671
  right: () => W,
2593
- root: () => Ka,
2594
- round: () => ao,
2595
- signedDims: () => ka,
2596
- signedHeight: () => Pa,
2597
- signedWidth: () => Na,
2672
+ root: () => oo,
2673
+ round: () => bo,
2674
+ signedDims: () => Ua,
2675
+ signedHeight: () => Ja,
2676
+ signedWidth: () => qa,
2598
2677
  top: () => q,
2599
- topCenter: () => Ia,
2600
- topLeft: () => Fa,
2601
- topRight: () => La,
2602
- translate: () => eo,
2603
- truncate: () => ro,
2678
+ topCenter: () => Xa,
2679
+ topLeft: () => Ya,
2680
+ topRight: () => Za,
2681
+ translate: () => ho,
2682
+ truncate: () => vo,
2604
2683
  width: () => H,
2605
- x: () => Wa,
2606
- xBounds: () => qa,
2684
+ x: () => io,
2685
+ xBounds: () => so,
2607
2686
  xyLoc: () => B,
2608
- y: () => Ga,
2609
- yBounds: () => Ja
2610
- }), va = t.union([t.number(), t.string()]), ya = t.object({
2611
- top: va,
2612
- left: va,
2613
- width: va,
2614
- height: va
2615
- }), ba = t.object({
2687
+ y: () => ao,
2688
+ yBounds: () => co
2689
+ }), Ma = t.union([t.number(), t.string()]), Na = t.object({
2690
+ top: Ma,
2691
+ left: Ma,
2692
+ width: Ma,
2693
+ height: Ma
2694
+ }), Pa = t.object({
2616
2695
  left: t.number(),
2617
2696
  top: t.number(),
2618
2697
  right: t.number(),
2619
2698
  bottom: t.number()
2620
- }), xa = t.object({
2621
- one: I,
2622
- two: I,
2623
- root: wi
2624
- }), Sa = {
2699
+ }), Fa = t.object({
2700
+ one: T,
2701
+ two: T,
2702
+ root: Mi
2703
+ }), Ia = {
2625
2704
  one: R,
2626
2705
  two: R,
2627
- root: F
2628
- }, Ca = {
2706
+ root: Bi
2707
+ }, La = {
2629
2708
  one: R,
2630
- two: Gi,
2631
- root: Ei
2632
- }, wa = (e, t) => ({
2709
+ two: aa,
2710
+ root: Hi
2711
+ }, Ra = (e, t) => ({
2633
2712
  one: e.one,
2634
2713
  two: e.two,
2635
2714
  root: t ?? e.root
@@ -2637,7 +2716,7 @@ var wt = (e, t, n = {}) => {
2637
2716
  let a = {
2638
2717
  one: { ...R },
2639
2718
  two: { ...R },
2640
- root: i ?? F
2719
+ root: i ?? Bi
2641
2720
  };
2642
2721
  if (typeof e == "number") {
2643
2722
  if (typeof t != "number") throw Error("Box constructor called with invalid arguments");
@@ -2671,101 +2750,101 @@ var wt = (e, t, n = {}) => {
2671
2750
  x: a.one.x + t.signedWidth,
2672
2751
  y: a.one.y + t.signedHeight
2673
2752
  } : a.two = t, a));
2674
- }, Ta = (e, t, n) => {
2753
+ }, za = (e, t, n) => {
2675
2754
  let r = z(e);
2676
2755
  if (typeof t == "string") {
2677
2756
  if (n == null) throw Error("Invalid arguments for resize");
2678
- let e = N(t);
2757
+ let e = F(t);
2679
2758
  return z(r.one, void 0, e === "x" ? n : H(r), e === "y" ? n : U(r), r.root);
2680
2759
  }
2681
2760
  return z(r.one, t, void 0, void 0, r.root);
2682
- }, Ea = (e, t, n = !0) => {
2761
+ }, Ba = (e, t, n = !0) => {
2683
2762
  let r = z(e), i = (e, t) => e < t;
2684
2763
  return n && (i = (e, t) => e <= t), "one" in t ? i(K(r), K(t)) && i(W(t), W(r)) && i(q(r), q(t)) && i(G(t), G(r)) : i(K(r), t.x) && i(t.x, W(r)) && i(q(r), t.y) && i(t.y, G(r));
2685
- }, Da = (e, t) => Ji(e.one, t.one) && Ji(e.two, t.two) && Pi(e.root, t.root), Oa = (e) => ({
2764
+ }, Va = (e, t) => ca(e.one, t.one) && ca(e.two, t.two) && Xi(e.root, t.root), Ha = (e) => ({
2686
2765
  width: H(e),
2687
2766
  height: U(e)
2688
- }), ka = (e) => ({
2689
- signedWidth: Na(e),
2690
- signedHeight: Pa(e)
2691
- }), Aa = (e) => ({
2767
+ }), Ua = (e) => ({
2768
+ signedWidth: qa(e),
2769
+ signedHeight: Ja(e)
2770
+ }), Wa = (e) => ({
2692
2771
  top: q(e),
2693
2772
  left: K(e),
2694
2773
  width: H(e),
2695
2774
  height: U(e)
2696
- }), ja = (e, t, n = !1) => {
2697
- let r = N(t) === "y" ? Pa(e) : Na(e);
2775
+ }), Ga = (e, t, n = !1) => {
2776
+ let r = F(t) === "y" ? Ja(e) : qa(e);
2698
2777
  return n ? r : Math.abs(r);
2699
2778
  }, B = (e, t) => {
2700
2779
  let n = z(e);
2701
2780
  return {
2702
- x: t.x === "center" ? Ua(n).x : V(n, t.x),
2703
- y: t.y === "center" ? Ua(n).y : V(n, t.y)
2781
+ x: t.x === "center" ? ro(n).x : V(n, t.x),
2782
+ y: t.y === "center" ? ro(n).y : V(n, t.y)
2704
2783
  };
2705
2784
  }, V = (e, t) => {
2706
- let n = z(e), r = Ii(n.root).includes(t) ? Math.min : Math.max;
2707
- return $t.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
2708
- }, Ma = (e) => no(e) === 0, H = (e) => ja(e, "x"), U = (e) => ja(e, "y"), Na = (e) => {
2785
+ let n = z(e), r = Qi(n.root).includes(t) ? Math.min : Math.max;
2786
+ return Zt.includes(t) ? r(n.one.x, n.two.x) : r(n.one.y, n.two.y);
2787
+ }, Ka = (e) => _o(e) === 0, H = (e) => Ga(e, "x"), U = (e) => Ga(e, "y"), qa = (e) => {
2709
2788
  let t = z(e);
2710
2789
  return t.two.x - t.one.x;
2711
- }, Pa = (e) => {
2790
+ }, Ja = (e) => {
2712
2791
  let t = z(e);
2713
2792
  return t.two.y - t.one.y;
2714
- }, Fa = (e) => B(e, F), Ia = (e) => B(e, ki), La = (e) => B(e, Ti), Ra = (e) => B(e, Ei), za = (e) => B(e, Ai), Ba = (e) => B(e, Di), Va = (e) => B(e, Mi), Ha = (e) => B(e, ji), W = (e) => V(e, "right"), G = (e) => V(e, "bottom"), K = (e) => V(e, "left"), q = (e) => V(e, "top"), Ua = (e) => $i(Fa(e), {
2715
- x: Na(e) / 2,
2716
- y: Pa(e) / 2
2717
- }), Wa = (e) => {
2793
+ }, Ya = (e) => B(e, Bi), Xa = (e) => B(e, Gi), Za = (e) => B(e, Vi), Qa = (e) => B(e, Hi), $a = (e) => B(e, Ki), eo = (e) => B(e, Ui), to = (e) => B(e, Ji), no = (e) => B(e, qi), W = (e) => V(e, "right"), G = (e) => V(e, "bottom"), K = (e) => V(e, "left"), q = (e) => V(e, "top"), ro = (e) => pa(Ya(e), {
2794
+ x: qa(e) / 2,
2795
+ y: Ja(e) / 2
2796
+ }), io = (e) => {
2718
2797
  let t = z(e);
2719
2798
  return t.root.x === "left" ? K(t) : W(t);
2720
- }, Ga = (e) => {
2799
+ }, ao = (e) => {
2721
2800
  let t = z(e);
2722
2801
  return t.root.y === "top" ? q(t) : G(t);
2723
- }, Ka = (e) => ({
2724
- x: Wa(e),
2725
- y: Ga(e)
2726
- }), qa = (e) => {
2802
+ }, oo = (e) => ({
2803
+ x: io(e),
2804
+ y: ao(e)
2805
+ }), so = (e) => {
2727
2806
  let t = z(e);
2728
2807
  return {
2729
2808
  lower: t.one.x,
2730
2809
  upper: t.two.x
2731
2810
  };
2732
- }, Ja = (e) => {
2811
+ }, co = (e) => {
2733
2812
  let t = z(e);
2734
2813
  return {
2735
2814
  lower: t.one.y,
2736
2815
  upper: t.two.y
2737
2816
  };
2738
- }, Ya = (e, t) => wa(e, t), Xa = (e, t) => {
2739
- let n = z(e), r = $t.includes(t) ? "x" : tn.includes(t) ? "y" : null;
2817
+ }, lo = (e, t) => Ra(e, t), uo = (e, t) => {
2818
+ let n = z(e), r = Zt.includes(t) ? "x" : $t.includes(t) ? "y" : null;
2740
2819
  if (r === null) throw Error(`Invalid location: ${t}`);
2741
2820
  let i = t === "top" || t === "left" ? Math.min : Math.max, a = { ...n.one }, o = { ...n.two };
2742
2821
  return a[r] = i(n.one[r], n.two[r]), o[r] = i(n.one[r], n.two[r]), [a, o];
2743
- }, Za = (e, t) => {
2822
+ }, fo = (e, t) => {
2744
2823
  let n = z(e), r = z(t);
2745
2824
  return z({
2746
- x: Wa(r) + (H(r) - H(n)) / 2,
2747
- y: Ga(r) + (U(r) - U(n)) / 2
2748
- }, Oa(n));
2749
- }, Qa = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e, $a = (e) => H(e) / U(e), eo = (e, t, n) => {
2825
+ x: io(r) + (H(r) - H(n)) / 2,
2826
+ y: ao(r) + (U(r) - U(n)) / 2
2827
+ }, Ha(n));
2828
+ }, po = (e) => typeof e != "object" || !e ? !1 : "one" in e && "two" in e && "root" in e, mo = (e) => H(e) / U(e), ho = (e, t, n) => {
2750
2829
  if (typeof t == "string") {
2751
2830
  if (n == null) throw Error("Undefined amount passed into box.translate");
2752
- t = L(N(t), n);
2831
+ t = L(F(t), n);
2753
2832
  }
2754
2833
  let r = z(e);
2755
- return z($i(r.one, t), $i(r.two, t), void 0, void 0, r.root);
2756
- }, to = (e, t) => {
2834
+ return z(pa(r.one, t), pa(r.two, t), void 0, void 0, r.root);
2835
+ }, go = (e, t) => {
2757
2836
  let n = Math.max(K(e), K(t)), r = Math.max(q(e), q(t)), i = Math.min(W(e), W(t)), a = Math.min(G(e), G(t));
2758
- return n > i || r > a ? Sa : z({
2837
+ return n > i || r > a ? Ia : z({
2759
2838
  x: n,
2760
2839
  y: r
2761
2840
  }, {
2762
2841
  x: i,
2763
2842
  y: a
2764
2843
  }, void 0, void 0, e.root);
2765
- }, no = (e) => H(e) * U(e), ro = (e, t) => {
2844
+ }, _o = (e) => H(e) * U(e), vo = (e, t) => {
2766
2845
  let n = z(e);
2767
- return z(sa(n.one, t), sa(n.two, t), void 0, void 0, n.root);
2768
- }, io = (e, t, n, r, i, a) => {
2846
+ return z(xa(n.one, t), xa(n.two, t), void 0, void 0, n.root);
2847
+ }, yo = (e, t, n, r, i, a) => {
2769
2848
  let o = {
2770
2849
  x: e,
2771
2850
  y: t
@@ -2774,32 +2853,32 @@ var wt = (e, t, n = {}) => {
2774
2853
  y: t + r
2775
2854
  };
2776
2855
  return i.x !== a.x && (i.x === "center" ? (o.x -= n / 2, s.x -= n / 2) : (o.x -= n, s.x -= n)), i.y !== a.y && (i.y === "center" ? (o.y -= r / 2, s.y -= r / 2) : (o.y -= r, s.y -= r)), z(o, s, void 0, void 0, a);
2777
- }, ao = (e) => {
2856
+ }, bo = (e) => {
2778
2857
  let t = z(e);
2779
- return z(ma(t.one), ma(t.two), void 0, void 0, t.root);
2780
- }, oo = /* @__PURE__ */ r({
2781
- DECIMAL: () => lo,
2782
- ZERO: () => co,
2858
+ return z(Oa(t.one), Oa(t.two), void 0, void 0, t.root);
2859
+ }, xo = /* @__PURE__ */ r({
2860
+ DECIMAL: () => wo,
2861
+ ZERO: () => Co,
2783
2862
  construct: () => J,
2784
- couple: () => mo,
2785
- crude: () => so,
2786
- dimensionsZ: () => pn,
2787
- equals: () => uo,
2788
- max: () => ho,
2789
- min: () => go,
2790
- scale: () => _o,
2791
- signedDimensionsZ: () => mn,
2792
- svgViewBox: () => po,
2793
- swap: () => fo
2794
- }), so = t.union([
2795
- pn,
2796
- mn,
2797
- I,
2798
- Jt
2799
- ]), co = {
2863
+ couple: () => Oo,
2864
+ crude: () => So,
2865
+ dimensionsZ: () => wn,
2866
+ equals: () => To,
2867
+ max: () => ko,
2868
+ min: () => Ao,
2869
+ scale: () => jo,
2870
+ signedDimensionsZ: () => Tn,
2871
+ svgViewBox: () => Do,
2872
+ swap: () => Eo
2873
+ }), So = t.union([
2874
+ wn,
2875
+ Tn,
2876
+ T,
2877
+ An
2878
+ ]), Co = {
2800
2879
  width: 0,
2801
2880
  height: 0
2802
- }, lo = {
2881
+ }, wo = {
2803
2882
  width: 1,
2804
2883
  height: 1
2805
2884
  }, J = (e, t) => typeof e == "number" ? {
@@ -2814,58 +2893,58 @@ var wt = (e, t, n = {}) => {
2814
2893
  } : "signedWidth" in e ? {
2815
2894
  width: e.signedWidth,
2816
2895
  height: e.signedHeight
2817
- } : { ...e }, uo = (e, t) => {
2896
+ } : { ...e }, To = (e, t) => {
2818
2897
  if (t == null) return !1;
2819
2898
  let n = J(e), r = J(t);
2820
2899
  return n.width === r.width && n.height === r.height;
2821
- }, fo = (e) => {
2900
+ }, Eo = (e) => {
2822
2901
  let t = J(e);
2823
2902
  return {
2824
2903
  width: t.height,
2825
2904
  height: t.width
2826
2905
  };
2827
- }, po = (e) => {
2906
+ }, Do = (e) => {
2828
2907
  let t = J(e);
2829
2908
  return `0 0 ${t.width} ${t.height}`;
2830
- }, mo = (e) => {
2909
+ }, Oo = (e) => {
2831
2910
  let t = J(e);
2832
2911
  return [t.width, t.height];
2833
- }, ho = (e) => ({
2912
+ }, ko = (e) => ({
2834
2913
  width: Math.max(...e.map((e) => J(e).width)),
2835
2914
  height: Math.max(...e.map((e) => J(e).height))
2836
- }), go = (e) => ({
2915
+ }), Ao = (e) => ({
2837
2916
  width: Math.min(...e.map((e) => J(e).width)),
2838
2917
  height: Math.min(...e.map((e) => J(e).height))
2839
- }), _o = (e, t) => {
2918
+ }), jo = (e, t) => {
2840
2919
  let n = J(e);
2841
2920
  return {
2842
2921
  width: n.width * t,
2843
2922
  height: n.height * t
2844
2923
  };
2845
- }, vo = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e, yo = /* @__PURE__ */ r({
2846
- Scale: () => Oo,
2847
- XY: () => ko,
2848
- crudeXYTransform: () => bo,
2849
- transform: () => xo
2850
- }), bo = t.object({
2851
- offset: Wi,
2852
- scale: Wi
2853
- }), xo = t.object({
2924
+ }, Mo = (e, t, n) => t !== void 0 && e < t ? t : n !== void 0 && e > n ? n : e, No = /* @__PURE__ */ r({
2925
+ Scale: () => Ho,
2926
+ XY: () => Uo,
2927
+ crudeXYTransform: () => Po,
2928
+ transform: () => Fo
2929
+ }), Po = t.object({
2930
+ offset: ia,
2931
+ scale: ia
2932
+ }), Fo = t.object({
2854
2933
  offset: t.number(),
2855
2934
  scale: t.number()
2856
- }), So = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], Co = (e) => (t, n, r, i) => [t, i ? r / e : r * e], wo = (e) => (t, n, r) => {
2935
+ }), Io = (e) => (t, n, r, i) => n === "dimension" ? [t, r] : [t, i ? r - e : r + e], Lo = (e) => (t, n, r, i) => [t, i ? r / e : r * e], Ro = (e) => (t, n, r) => {
2857
2936
  if (t === null) return [e, r];
2858
2937
  let { lower: i, upper: a } = t, { lower: o, upper: s } = e, c = a - i, l = s - o;
2859
2938
  return n === "dimension" ? [e, l / c * r] : [e, (r - i) * (l / c) + o];
2860
- }, To = (e) => (t, n, r) => [e, r], Eo = () => (e, t, n) => {
2939
+ }, zo = (e) => (t, n, r) => [e, r], Bo = () => (e, t, n) => {
2861
2940
  if (e === null) throw Error("cannot invert without bounds");
2862
2941
  if (t === "dimension") return [e, n];
2863
2942
  let { lower: r, upper: i } = e;
2864
2943
  return [e, i - (n - r)];
2865
- }, Do = (e) => (t, n, r) => {
2944
+ }, Vo = (e) => (t, n, r) => {
2866
2945
  let { lower: i, upper: a } = e;
2867
- return r = vo(r, i, a), [t, r];
2868
- }, Oo = class e {
2946
+ return r = Mo(r, i, a), [t, r];
2947
+ }, Ho = class e {
2869
2948
  ops = [];
2870
2949
  currBounds = null;
2871
2950
  currType = null;
@@ -2883,27 +2962,27 @@ var wt = (e, t, n = {}) => {
2883
2962
  return new e().scale(t, n);
2884
2963
  }
2885
2964
  translate(e) {
2886
- let t = this.new(), n = So(e);
2965
+ let t = this.new(), n = Io(e);
2887
2966
  return n.type = "translate", t.ops.push(n), t;
2888
2967
  }
2889
2968
  magnify(e) {
2890
- let t = this.new(), n = Co(e);
2969
+ let t = this.new(), n = Lo(e);
2891
2970
  return n.type = "magnify", t.ops.push(n), t;
2892
2971
  }
2893
2972
  scale(e, t) {
2894
- let n = w(e, t), r = this.new(), i = wo(n);
2973
+ let n = E(e, t), r = this.new(), i = Ro(n);
2895
2974
  return i.type = "scale", r.ops.push(i), r;
2896
2975
  }
2897
2976
  clamp(e, t) {
2898
- let n = w(e, t), r = this.new(), i = Do(n);
2977
+ let n = E(e, t), r = this.new(), i = Vo(n);
2899
2978
  return i.type = "clamp", r.ops.push(i), r;
2900
2979
  }
2901
2980
  reBound(e, t) {
2902
- let n = w(e, t), r = this.new(), i = To(n);
2981
+ let n = E(e, t), r = this.new(), i = zo(n);
2903
2982
  return i.type = "re-bound", r.ops.push(i), r;
2904
2983
  }
2905
2984
  invert() {
2906
- let e = Eo();
2985
+ let e = Bo();
2907
2986
  e.type = "invert";
2908
2987
  let t = this.new();
2909
2988
  return t.ops.push(e), t;
@@ -2941,11 +3020,11 @@ var wt = (e, t, n = {}) => {
2941
3020
  };
2942
3021
  }
2943
3022
  static IDENTITY = new e();
2944
- }, ko = class e {
3023
+ }, Uo = class e {
2945
3024
  x;
2946
3025
  y;
2947
3026
  currRoot;
2948
- constructor(e = new Oo(), t = new Oo(), n = null) {
3027
+ constructor(e = new Ho(), t = new Ho(), n = null) {
2949
3028
  this.x = e, this.y = t, this.currRoot = n;
2950
3029
  }
2951
3030
  static translate(t, n) {
@@ -2987,19 +3066,19 @@ var wt = (e, t, n = {}) => {
2987
3066
  }
2988
3067
  scale(e) {
2989
3068
  let t = this.copy();
2990
- if (Qa(e)) {
3069
+ if (po(e)) {
2991
3070
  let n = this.currRoot;
2992
- return t.currRoot = e.root, n != null && !Pi(n, e.root) && (n.x !== e.root.x && (t.x = t.x.invert()), n.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(qa(e)), t.y = t.y.scale(Ja(e)), t;
3071
+ return t.currRoot = e.root, n != null && !Xi(n, e.root) && (n.x !== e.root.x && (t.x = t.x.invert()), n.y !== e.root.y && (t.y = t.y.invert())), t.x = t.x.scale(so(e)), t.y = t.y.scale(co(e)), t;
2993
3072
  }
2994
3073
  return t.x = t.x.scale(e.width), t.y = t.y.scale(e.height), t;
2995
3074
  }
2996
3075
  reBound(e) {
2997
3076
  let t = this.copy();
2998
- return t.x = this.x.reBound(qa(e)), t.y = this.y.reBound(Ja(e)), t;
3077
+ return t.x = this.x.reBound(so(e)), t.y = this.y.reBound(co(e)), t;
2999
3078
  }
3000
3079
  clamp(e) {
3001
3080
  let t = this.copy();
3002
- return t.x = this.x.clamp(qa(e)), t.y = this.y.clamp(Ja(e)), t;
3081
+ return t.x = this.x.clamp(so(e)), t.y = this.y.clamp(co(e)), t;
3003
3082
  }
3004
3083
  copy() {
3005
3084
  let t = new e();
@@ -3037,57 +3116,29 @@ var wt = (e, t, n = {}) => {
3037
3116
  };
3038
3117
  }
3039
3118
  static IDENTITY = new e();
3040
- }, Ao = /* @__PURE__ */ r({
3041
- ALIGNMENTS: () => cn,
3042
- CENTER_LOCATIONS: () => rn,
3043
- DIRECTIONS: () => Yt,
3044
- LOCATIONS: () => on,
3045
- ORDERS: () => un,
3046
- OUTER_LOCATIONS: () => Zt,
3047
- X_LOCATIONS: () => $t,
3048
- Y_LOCATIONS: () => tn,
3049
- alignmentZ: () => ln,
3050
- boundsZ: () => hn,
3051
- centerLocationZ: () => an,
3052
- clientXyZ: () => fn,
3053
- dimensionsZ: () => pn,
3054
- directionZ: () => Xt,
3055
- locationZ: () => sn,
3056
- orderZ: () => dn,
3057
- outerLocationZ: () => Qt,
3058
- signedDimensionsZ: () => mn,
3059
- xLocationZ: () => en,
3060
- xyZ: () => I,
3061
- yLocationZ: () => nn
3062
- }), jo = /* @__PURE__ */ r({
3063
- calculate: () => Io,
3064
- completeXY: () => Mo,
3065
- toCSS: () => Po,
3066
- toDecimal: () => Fo,
3067
- xy: () => No
3068
- }), Mo = I.extend({
3069
- root: wi,
3070
- units: e.object({
3071
- x: e.enum(["px", "decimal"]),
3072
- y: e.enum(["px", "decimal"])
3073
- })
3074
- }), No = Mo.partial({
3119
+ }, Wo = /* @__PURE__ */ r({
3120
+ calculate: () => Yo,
3121
+ completeXYZ: () => Ko,
3122
+ toCSS: () => qo,
3123
+ toDecimal: () => Jo,
3124
+ xyZ: () => Go
3125
+ }), Go = kn, Ko = kn.required({
3075
3126
  root: !0,
3076
3127
  units: !0
3077
- }), Po = (e) => {
3128
+ }), qo = (e) => {
3078
3129
  let t = {};
3079
3130
  return t[e.root?.x ?? "left"] = e?.units?.x === "px" ? `${e.x}px` : `${e.x * 100}%`, t[e.root?.y ?? "top"] = e?.units?.y === "px" ? `${e.y}px` : `${e.y * 100}%`, t;
3080
- }, Fo = ({ position: e, element: t, container: n }) => {
3131
+ }, Jo = ({ position: e, element: t, container: n }) => {
3081
3132
  let r = {
3082
3133
  x: e.x,
3083
3134
  y: e.y
3084
3135
  };
3085
3136
  return e.units?.x === "decimal" ? e.root?.x === "right" && (r.x = 1 - e.x) : e.root?.x === "right" ? r.x = 1 - (e.x + H(t)) / H(n) : r.x /= H(n), e.units?.y === "decimal" ? e.root?.y === "bottom" && (r.y = 1 - e.y) : e.root?.y === "bottom" ? r.y = 1 - (e.y + U(t)) / U(n) : r.y /= U(n), r;
3086
- }, Io = ({ position: e, element: t, container: n, lowerThreshold: r = .2, upperThreshold: i = .8 }) => {
3137
+ }, Yo = ({ position: e, element: t, container: n, lowerThreshold: r = .2, upperThreshold: i = .8 }) => {
3087
3138
  let a = {
3088
3139
  x: e.x,
3089
3140
  y: e.y,
3090
- root: { ...F },
3141
+ root: { ...Bi },
3091
3142
  units: {
3092
3143
  x: "px",
3093
3144
  y: "px"
@@ -3095,76 +3146,79 @@ var wt = (e, t, n = {}) => {
3095
3146
  };
3096
3147
  return e.x > i ? (a.x = (1 - e.x) * H(n) - H(t), a.root.x = "right") : e.x < r ? a.x = e.x * H(n) : a.units.x = "decimal", e.y > i ? (a.y = (1 - e.y) * U(n) - U(t), a.root.y = "bottom") : e.y < r ? a.y = e.y * U(n) : a.units.y = "decimal", a.x = Math.round(a.x * 100) / 100, {
3097
3148
  ...a,
3098
- ...sa(a, 3)
3149
+ ...xa(a, 3)
3099
3150
  };
3100
- }, Lo = t.enum(["static", "dynamic"]), Ro = "00000000-0000-0000-0000-000000000000", zo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
3151
+ }, Xo = t.enum(["static", "dynamic"]), Zo = "00000000-0000-0000-0000-000000000000", Qo = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
3101
3152
  //#endregion
3102
- //#region ../../node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist/validate.js
3103
- function Bo(e) {
3104
- return typeof e == "string" && zo.test(e);
3153
+ //#region ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/validate.js
3154
+ function $o(e) {
3155
+ return typeof e == "string" && Qo.test(e);
3105
3156
  }
3106
3157
  //#endregion
3107
- //#region ../../node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist/stringify.js
3158
+ //#region ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/stringify.js
3108
3159
  var Y = [];
3109
3160
  for (let e = 0; e < 256; ++e) Y.push((e + 256).toString(16).slice(1));
3110
- function Vo(e, t = 0) {
3161
+ function es(e, t = 0) {
3111
3162
  return (Y[e[t + 0]] + Y[e[t + 1]] + Y[e[t + 2]] + Y[e[t + 3]] + "-" + Y[e[t + 4]] + Y[e[t + 5]] + "-" + Y[e[t + 6]] + Y[e[t + 7]] + "-" + Y[e[t + 8]] + Y[e[t + 9]] + "-" + Y[e[t + 10]] + Y[e[t + 11]] + Y[e[t + 12]] + Y[e[t + 13]] + Y[e[t + 14]] + Y[e[t + 15]]).toLowerCase();
3112
3163
  }
3113
- function Ho(e, t = 0) {
3114
- let n = Vo(e, t);
3115
- if (!Bo(n)) throw TypeError("Stringified UUID is invalid");
3164
+ function ts(e, t = 0) {
3165
+ let n = es(e, t);
3166
+ if (!$o(n)) throw TypeError("Stringified UUID is invalid");
3116
3167
  return n;
3117
3168
  }
3118
3169
  //#endregion
3119
- //#region ../../node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist/rng.js
3120
- var Uo, Wo = new Uint8Array(16);
3121
- function Go() {
3122
- if (!Uo) {
3123
- if (typeof crypto > "u" || !crypto.getRandomValues) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
3124
- Uo = crypto.getRandomValues.bind(crypto);
3125
- }
3126
- return Uo(Wo);
3170
+ //#region ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/rng.js
3171
+ var ns = new Uint8Array(16);
3172
+ function rs() {
3173
+ return crypto.getRandomValues(ns);
3127
3174
  }
3128
- var Ko = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
3129
3175
  //#endregion
3130
- //#region ../../node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist/v4.js
3131
- function qo(e, t, n) {
3176
+ //#region ../../node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/v4.js
3177
+ function is(e, t, n) {
3178
+ return !t && !e && crypto.randomUUID ? crypto.randomUUID() : as(e, t, n);
3179
+ }
3180
+ function as(e, t, n) {
3132
3181
  e ||= {};
3133
- let r = e.random ?? e.rng?.() ?? Go();
3182
+ let r = e.random ?? e.rng?.() ?? rs();
3134
3183
  if (r.length < 16) throw Error("Random bytes length must be >= 16");
3135
3184
  if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
3136
3185
  if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
3137
3186
  for (let e = 0; e < 16; ++e) t[n + e] = r[e];
3138
3187
  return t;
3139
3188
  }
3140
- return Vo(r);
3141
- }
3142
- function Jo(e, t, n) {
3143
- return Ko.randomUUID && !t && !e ? Ko.randomUUID() : qo(e, t, n);
3189
+ return es(r);
3144
3190
  }
3145
3191
  //#endregion
3146
3192
  //#region src/uuid/uuid.ts
3147
- var Yo = /* @__PURE__ */ r({
3148
- ZERO: () => Qo,
3149
- create: () => Xo,
3150
- parse: () => Zo
3151
- }), Xo = () => Jo(), Zo = (e, t) => Ho(e, t), Qo = Ro, X = -1, $o = {
3152
- [Symbol.iterator]: () => $o,
3193
+ var os = /* @__PURE__ */ r({
3194
+ ZERO: () => ls,
3195
+ create: () => ss,
3196
+ parse: () => cs
3197
+ }), ss = () => is(), cs = (e, t) => ts(e, t), ls = Zo, us = (e) => {
3198
+ let t = Math.fround(e);
3199
+ if (!Number.isFinite(t)) return t.toString();
3200
+ for (let e = 1; e <= 9; e++) {
3201
+ let n = parseFloat(t.toPrecision(e));
3202
+ if (Math.fround(n) === t) return n.toString();
3203
+ }
3204
+ return t.toString();
3205
+ }, X = -1, ds = {
3206
+ [Symbol.iterator]: () => ds,
3153
3207
  next: () => ({
3154
3208
  done: !0,
3155
3209
  value: void 0
3156
3210
  })
3157
- }, es = t.string().transform((e) => new Uint8Array(atob(e).split("").map((e) => e.charCodeAt(0))).buffer), ts = t.union([t.null(), t.undefined()]).transform(() => new Uint8Array().buffer), Z = 4, ns = (e, t) => {
3211
+ }, fs = t.string().transform((e) => new Uint8Array(atob(e).split("").map((e) => e.charCodeAt(0))).buffer), ps = t.union([t.null(), t.undefined()]).transform(() => new Uint8Array().buffer), Z = 4, ms = (e, t) => {
3158
3212
  if (e === "number" && !t.isNumeric) throw Error(`cannot convert series of type ${t.toString()} to number`);
3159
3213
  if (e === "bigint" && !t.usesBigInt) throw Error(`cannot convert series of type ${t.toString()} to bigint`);
3160
- }, rs = "sy_x_telem_series", is = class e {
3214
+ }, hs = "sy_x_telem_series", gs = class e {
3161
3215
  key;
3162
- discriminator = rs;
3216
+ discriminator = hs;
3163
3217
  dataType;
3164
3218
  sampleOffset;
3165
3219
  gl;
3166
3220
  _data;
3167
- timeRange = A.ZERO;
3221
+ timeRange = M.ZERO;
3168
3222
  alignment = 0n;
3169
3223
  alignmentMultiple = 1n;
3170
3224
  cachedMin;
@@ -3174,28 +3228,28 @@ var Yo = /* @__PURE__ */ r({
3174
3228
  cachedLength;
3175
3229
  _cachedIndexes;
3176
3230
  static crudeZ = t.object({
3177
- timeRange: A.z.optional(),
3178
- dataType: j.z,
3231
+ timeRange: M.z.optional(),
3232
+ dataType: N.z,
3179
3233
  alignment: t.coerce.bigint().optional(),
3180
3234
  data: t.union([
3181
- es,
3182
- ts,
3235
+ fs,
3236
+ ps,
3183
3237
  t.instanceof(ArrayBuffer),
3184
3238
  t.instanceof(Uint8Array)
3185
- ]),
3186
- glBufferUsage: Lo.default("static").optional()
3239
+ ]).default(() => new Uint8Array().buffer),
3240
+ glBufferUsage: Xo.default("static").optional()
3187
3241
  });
3188
3242
  static z = e.crudeZ.transform((t) => new e(t));
3189
3243
  constructor(e) {
3190
- as(e) && (e = { data: e }), e.data ??= [];
3191
- let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s = ei(), data: c } = e;
3192
- if (os(c)) {
3244
+ _s(e) && (e = { data: e }), e.data ??= [];
3245
+ let { dataType: t, timeRange: n, sampleOffset: r = 0, glBufferUsage: i = "static", alignment: a = 0n, alignmentMultiple: o = 1n, key: s = hi(), data: c } = e;
3246
+ if (vs(c)) {
3193
3247
  let e = c;
3194
3248
  this.key = e.key, this.dataType = e.dataType, this.sampleOffset = e.sampleOffset, this.gl = e.gl, this._data = e._data, this.timeRange = e.timeRange, this.alignment = e.alignment, this.alignmentMultiple = e.alignmentMultiple, this.cachedMin = e.cachedMin, this.cachedMax = e.cachedMax, this.writePos = e.writePos, this._refCount = e._refCount, this.cachedLength = e.cachedLength;
3195
3249
  return;
3196
3250
  }
3197
- let l = br(c), u = Array.isArray(c);
3198
- if (t != null) this.dataType = new j(t);
3251
+ let l = Nr(c), u = Array.isArray(c);
3252
+ if (t != null) this.dataType = new N(t);
3199
3253
  else if (c instanceof ArrayBuffer) throw Error("cannot infer data type from an ArrayBuffer instance when constructing a Series. Please provide a data type.");
3200
3254
  else if (u || l) {
3201
3255
  let e = c;
@@ -3203,31 +3257,31 @@ var Yo = /* @__PURE__ */ r({
3203
3257
  if (c.length === 0) throw Error("cannot infer data type from a zero length JS array when constructing a Series. Please provide a data type.");
3204
3258
  e = c[0];
3205
3259
  }
3206
- if (typeof e == "string") this.dataType = j.STRING;
3207
- else if (typeof e == "number") this.dataType = j.FLOAT64;
3208
- else if (typeof e == "bigint") this.dataType = j.INT64;
3209
- else if (typeof e == "boolean") this.dataType = j.UINT8;
3210
- else if (e instanceof E || e instanceof Date || e instanceof E) this.dataType = j.TIMESTAMP;
3211
- else if (typeof e == "object") this.dataType = j.JSON;
3260
+ if (typeof e == "string") this.dataType = N.STRING;
3261
+ else if (typeof e == "number") this.dataType = N.FLOAT64;
3262
+ else if (typeof e == "bigint") this.dataType = N.INT64;
3263
+ else if (typeof e == "boolean") this.dataType = N.UINT8;
3264
+ else if (e instanceof O || e instanceof Date || e instanceof O) this.dataType = N.TIMESTAMP;
3265
+ else if (typeof e == "object") this.dataType = N.JSON;
3212
3266
  else throw Error(`cannot infer data type of ${typeof e} when constructing a Series from a JS array`);
3213
- } else this.dataType = new j(c);
3267
+ } else this.dataType = new N(c);
3214
3268
  if (!u && !l) this._data = c;
3215
3269
  else if (u && c.length === 0) this._data = new this.dataType.Array([]).buffer;
3216
3270
  else {
3217
3271
  let e = l ? [c] : c, t = e[0];
3218
- if ((t instanceof E || t instanceof Date || t instanceof D) && (e = e.map((e) => new E(e).valueOf())), this.dataType.equals(j.STRING)) {
3272
+ if ((t instanceof O || t instanceof Date || t instanceof k) && (e = e.map((e) => new O(e).valueOf())), this.dataType.equals(N.STRING)) {
3219
3273
  this.cachedLength = e.length;
3220
3274
  let t = e.map((e) => new TextEncoder().encode(e)), n = t.reduce((e, t) => e + Z + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
3221
3275
  for (let e of t) i.setUint32(o, e.byteLength, !0), o += Z, a.set(e, o), o += e.byteLength;
3222
3276
  this._data = r;
3223
- } else if (this.dataType.equals(j.JSON)) {
3277
+ } else if (this.dataType.equals(N.JSON)) {
3224
3278
  this.cachedLength = e.length;
3225
- let t = e.map((e) => new TextEncoder().encode(ur.encodeString(e))), n = t.reduce((e, t) => e + Z + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
3279
+ let t = e.map((e) => new TextEncoder().encode(Cr.encodeString(e))), n = t.reduce((e, t) => e + Z + t.byteLength, 0), r = new ArrayBuffer(n), i = new DataView(r), a = new Uint8Array(r), o = 0;
3226
3280
  for (let e of t) i.setUint32(o, e.byteLength, !0), o += Z, a.set(e, o), o += e.byteLength;
3227
3281
  this._data = r;
3228
3282
  } else this.dataType.usesBigInt && typeof t == "number" ? this._data = new this.dataType.Array(e.map((e) => BigInt(Math.round(e)))).buffer : !this.dataType.usesBigInt && typeof t == "bigint" ? this._data = new this.dataType.Array(e.map(Number)).buffer : this._data = new this.dataType.Array(e).buffer;
3229
3283
  }
3230
- this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ?? A.ZERO, this.gl = {
3284
+ this.key = s, this.alignment = a, this.alignmentMultiple = o, this.sampleOffset = r ?? 0, this.timeRange = n ?? M.ZERO, this.gl = {
3231
3285
  control: null,
3232
3286
  buffer: null,
3233
3287
  prevBuffer: 0,
@@ -3237,7 +3291,7 @@ var Yo = /* @__PURE__ */ r({
3237
3291
  static alloc({ capacity: t, dataType: n, ...r }) {
3238
3292
  if (t === 0) throw Error("[Series] - cannot allocate an array of length 0");
3239
3293
  let i = new e({
3240
- data: new new j(n).Array(t).buffer,
3294
+ data: new new N(n).Array(t).buffer,
3241
3295
  dataType: n,
3242
3296
  ...r
3243
3297
  });
@@ -3297,17 +3351,17 @@ var Yo = /* @__PURE__ */ r({
3297
3351
  return Array.from(this).map((e) => e.toString());
3298
3352
  }
3299
3353
  parseJSON(e) {
3300
- if (!this.dataType.equals(j.JSON)) throw Error("cannot parse non-JSON series as JSON");
3301
- return this.toStrings().map((t) => e.parse(ur.decodeString(t)));
3354
+ if (!this.dataType.equals(N.JSON)) throw Error("cannot parse non-JSON series as JSON");
3355
+ return this.toStrings().map((t) => e.parse(Cr.decodeString(t)));
3302
3356
  }
3303
3357
  get byteCapacity() {
3304
- return new M(this.underlyingData.byteLength);
3358
+ return new P(this.underlyingData.byteLength);
3305
3359
  }
3306
3360
  get capacity() {
3307
3361
  return this.dataType.isVariable ? this.byteCapacity.valueOf() : this.dataType.density.length(this.byteCapacity);
3308
3362
  }
3309
3363
  get byteLength() {
3310
- return this.writePos === X ? this.byteCapacity : this.dataType.isVariable ? new M(this.writePos) : this.dataType.density.size(this.writePos);
3364
+ return this.writePos === X ? this.byteCapacity : this.dataType.isVariable ? new P(this.writePos) : this.dataType.density.size(this.writePos);
3311
3365
  }
3312
3366
  get length() {
3313
3367
  return this.cachedLength == null ? this.dataType.isVariable ? this.calculateCachedLength() : this.writePos === X ? this.byteCapacity.valueOf() / this.dataType.density.valueOf() : this.writePos : this.cachedLength;
@@ -3324,7 +3378,7 @@ var Yo = /* @__PURE__ */ r({
3324
3378
  convert(t, n = 0) {
3325
3379
  if (this.dataType.equals(t)) return this;
3326
3380
  let r = new t.Array(this.length);
3327
- for (let e = 0; e < this.length; e++) r[e] = xr(this.dataType, t, this.data[e], n);
3381
+ for (let e = 0; e < this.length; e++) r[e] = Pr(this.dataType, t, this.data[e], n);
3328
3382
  return new e({
3329
3383
  data: r.buffer,
3330
3384
  dataType: t,
@@ -3335,27 +3389,45 @@ var Yo = /* @__PURE__ */ r({
3335
3389
  });
3336
3390
  }
3337
3391
  calcRawMax() {
3338
- return this.length === 0 ? -Infinity : (this.dataType.equals(j.TIMESTAMP) ? this.cachedMax = this.data[this.data.length - 1] : (this.dataType.usesBigInt, this.cachedMax = this.data.reduce((e, t) => e > t ? e : t)), this.cachedMax);
3392
+ if (this.length === 0) return -Infinity;
3393
+ if (this.dataType.equals(N.TIMESTAMP)) this.cachedMax = this.data[this.data.length - 1];
3394
+ else if (this.dataType.usesBigInt) {
3395
+ let e = this.data;
3396
+ this.cachedMax = e.reduce((e, t) => e > t ? e : t);
3397
+ } else {
3398
+ let e = this.data;
3399
+ this.cachedMax = e.reduce((e, t) => e > t ? e : t);
3400
+ }
3401
+ return this.cachedMax;
3339
3402
  }
3340
3403
  get max() {
3341
3404
  return this.calcMax();
3342
3405
  }
3343
3406
  calcMax() {
3344
3407
  if (this.dataType.isVariable) throw Error("cannot calculate maximum on a variable length data type");
3345
- return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(), S(this.cachedMax, this.sampleOffset));
3408
+ return this.writePos === 0 ? -Infinity : (this.cachedMax ??= this.calcRawMax(), this.applyOffset(this.cachedMax));
3346
3409
  }
3347
3410
  calcRawMin() {
3348
- return this.length === 0 ? Infinity : (this.dataType.equals(j.TIMESTAMP) ? this.cachedMin = this.data[0] : (this.dataType.usesBigInt, this.cachedMin = this.data.reduce((e, t) => e < t ? e : t)), this.cachedMin);
3411
+ if (this.length === 0) return Infinity;
3412
+ if (this.dataType.equals(N.TIMESTAMP)) this.cachedMin = this.data[0];
3413
+ else if (this.dataType.usesBigInt) {
3414
+ let e = this.data;
3415
+ this.cachedMin = e.reduce((e, t) => e < t ? e : t);
3416
+ } else {
3417
+ let e = this.data;
3418
+ this.cachedMin = e.reduce((e, t) => e < t ? e : t);
3419
+ }
3420
+ return this.cachedMin;
3349
3421
  }
3350
3422
  get min() {
3351
3423
  return this.calcMin();
3352
3424
  }
3353
3425
  calcMin() {
3354
3426
  if (this.dataType.isVariable) throw Error("cannot calculate minimum on a variable length data type");
3355
- return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(), S(this.cachedMin, this.sampleOffset));
3427
+ return this.writePos === 0 ? Infinity : (this.cachedMin ??= this.calcRawMin(), this.applyOffset(this.cachedMin));
3356
3428
  }
3357
3429
  get bounds() {
3358
- return w(Number(this.min), Number(this.max), { makeValid: !1 });
3430
+ return E(Number(this.min), Number(this.max), { makeValid: !1 });
3359
3431
  }
3360
3432
  maybeRecomputeMinMax(e) {
3361
3433
  if (this.cachedMin != null) {
@@ -3376,25 +3448,37 @@ var Yo = /* @__PURE__ */ r({
3376
3448
  return this.at(n, t);
3377
3449
  }
3378
3450
  at(e, t = !1) {
3379
- if (this.dataType.isVariable) return this.atVariable(e, t ?? !1);
3380
- if (this.dataType.equals(j.UUID)) return this.atUUID(e, t);
3451
+ if (this.dataType.isVariable) {
3452
+ let n = this.atVariable(e, t);
3453
+ return n == null ? void 0 : this.dataType.equals(N.STRING) ? n : ne(JSON.parse(n));
3454
+ }
3455
+ if (this.dataType.equals(N.UUID)) return this.atUUID(e, t);
3381
3456
  e < 0 && (e = this.length + e);
3382
3457
  let n = this.data[e];
3383
3458
  if (n == null) {
3384
3459
  if (t === !0) throw Error(`[series] - no value at index ${e}`);
3385
3460
  return;
3386
3461
  }
3387
- return S(n, this.sampleOffset);
3462
+ return this.applyOffset(n);
3463
+ }
3464
+ applyOffset(e) {
3465
+ return typeof this.sampleOffset == "bigint" && typeof e == "number" ? BigInt(Math.round(e)) + this.sampleOffset : C(e, this.sampleOffset);
3388
3466
  }
3389
3467
  atUUID(e, t) {
3390
3468
  e < 0 && (e = this.length + e);
3391
- let n = Zo(new Uint8Array(this.buffer, e * this.dataType.density.valueOf()));
3469
+ let n = cs(new Uint8Array(this.buffer, e * this.dataType.density.valueOf()));
3392
3470
  if (n == null) {
3393
3471
  if (t) throw Error(`[series] - no value at index ${e}`);
3394
3472
  return;
3395
3473
  }
3396
3474
  return n;
3397
3475
  }
3476
+ asString(e, t = !1) {
3477
+ if (this.dataType.isVariable) return this.atVariable(e, t);
3478
+ if (this.dataType.equals(N.UUID)) return this.atUUID(e, t);
3479
+ let n = this.at(e, t);
3480
+ if (n != null) return this.dataType.equals(N.FLOAT32) ? us(n) : String(n);
3481
+ }
3398
3482
  atVariable(e, t) {
3399
3483
  let n = 0, r = 0, i = this.buffer, a = new DataView(i);
3400
3484
  if (this._cachedIndexes != null) {
@@ -3420,10 +3504,10 @@ var Yo = /* @__PURE__ */ r({
3420
3504
  }
3421
3505
  }
3422
3506
  let o = new Uint8Array(i, n, r);
3423
- return this.dataType.equals(j.STRING) ? new TextDecoder().decode(o) : re(JSON.parse(new TextDecoder().decode(o)));
3507
+ return new TextDecoder().decode(o);
3424
3508
  }
3425
3509
  binarySearch(e) {
3426
- let t = 0, n = this.length - 1, r = Nr(e);
3510
+ let t = 0, n = this.length - 1, r = Kr(e);
3427
3511
  for (; t <= n;) {
3428
3512
  let i = Math.floor((t + n) / 2), a = r(this.at(i, !0), e);
3429
3513
  if (a === 0) return i;
@@ -3432,7 +3516,7 @@ var Yo = /* @__PURE__ */ r({
3432
3516
  return t;
3433
3517
  }
3434
3518
  updateGLBuffer(e) {
3435
- if (this.gl.control = e, !this.dataType.equals(j.FLOAT32) && !this.dataType.equals(j.UINT8)) throw Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
3519
+ if (this.gl.control = e, !this.dataType.equals(N.FLOAT32) && !this.dataType.equals(N.UINT8)) throw Error("Only FLOAT32 and UINT8 arrays can be used in WebGL");
3436
3520
  let { buffer: t, bufferUsage: n, prevBuffer: r } = this.gl;
3437
3521
  if (t ?? (this.gl.buffer = e.createBuffer()), this.writePos !== r) if (e.bindBuffer(e.ARRAY_BUFFER, this.gl.buffer), this.writePos !== X) {
3438
3522
  r === 0 && e.bufferData(e.ARRAY_BUFFER, this.byteCapacity.valueOf(), e.STATIC_DRAW);
@@ -3441,7 +3525,7 @@ var Yo = /* @__PURE__ */ r({
3441
3525
  } else e.bufferData(e.ARRAY_BUFFER, this.buffer, n === "static" ? e.STATIC_DRAW : e.DYNAMIC_DRAW), this.gl.prevBuffer = X;
3442
3526
  }
3443
3527
  as(e) {
3444
- return ns(e, this.dataType), this;
3528
+ return ms(e, this.dataType), this;
3445
3529
  }
3446
3530
  get digest() {
3447
3531
  return {
@@ -3449,8 +3533,8 @@ var Yo = /* @__PURE__ */ r({
3449
3533
  dataType: this.dataType.toString(),
3450
3534
  sampleOffset: this.sampleOffset,
3451
3535
  alignment: {
3452
- lower: hs(this.alignmentBounds.lower),
3453
- upper: hs(this.alignmentBounds.upper),
3536
+ lower: Ds(this.alignmentBounds.lower),
3537
+ upper: Ds(this.alignmentBounds.upper),
3454
3538
  multiple: this.alignmentMultiple
3455
3539
  },
3456
3540
  timeRange: this.timeRange.toString(),
@@ -3459,7 +3543,7 @@ var Yo = /* @__PURE__ */ r({
3459
3543
  };
3460
3544
  }
3461
3545
  get alignmentBounds() {
3462
- return w(this.alignment, this.alignment + BigInt(this.length) * this.alignmentMultiple);
3546
+ return E(this.alignment, this.alignment + BigInt(this.length) * this.alignmentMultiple);
3463
3547
  }
3464
3548
  maybeGarbageCollectGLBuffer(e) {
3465
3549
  this.gl.buffer != null && (e.deleteBuffer(this.gl.buffer), this.gl.buffer = null, this.gl.prevBuffer = 0, this.gl.control = null);
@@ -3470,10 +3554,10 @@ var Yo = /* @__PURE__ */ r({
3470
3554
  }
3471
3555
  [Symbol.iterator]() {
3472
3556
  if (this.dataType.isVariable) {
3473
- let e = new cs(this);
3474
- return this.dataType.equals(j.JSON) ? new ls(e) : e;
3557
+ let e = new bs(this);
3558
+ return this.dataType.equals(N.JSON) ? new xs(e) : e;
3475
3559
  }
3476
- return this.dataType.equals(j.UUID) ? new us(this) : new ds(this);
3560
+ return this.dataType.equals(N.UUID) ? new Ss(this) : new Cs(this);
3477
3561
  }
3478
3562
  slice(e, t) {
3479
3563
  return this.sliceSub(!1, e, t);
@@ -3482,11 +3566,11 @@ var Yo = /* @__PURE__ */ r({
3482
3566
  return this.sliceSub(!0, e, t);
3483
3567
  }
3484
3568
  subIterator(e, t) {
3485
- return new ss(this, e, t ?? this.length);
3569
+ return new ys(this, e, t ?? this.length);
3486
3570
  }
3487
3571
  subAlignmentIterator(e, t) {
3488
3572
  let n = Math.ceil(Number(e - this.alignment) / Number(this.alignmentMultiple)), r = Math.ceil(Number(t - this.alignment) / Number(this.alignmentMultiple));
3489
- return new ss(this, n, r);
3573
+ return new ys(this, n, r);
3490
3574
  }
3491
3575
  subBytes(t, n) {
3492
3576
  return t >= 0 && (n == null || n >= this.byteLength.valueOf()) ? this : new e({
@@ -3514,7 +3598,7 @@ var Yo = /* @__PURE__ */ r({
3514
3598
  return new e({
3515
3599
  data: this.buffer,
3516
3600
  dataType: this.dataType,
3517
- timeRange: A.ZERO,
3601
+ timeRange: M.ZERO,
3518
3602
  sampleOffset: this.sampleOffset,
3519
3603
  glBufferUsage: "static",
3520
3604
  alignment: t
@@ -3530,14 +3614,14 @@ var Yo = /* @__PURE__ */ r({
3530
3614
  }
3531
3615
  return e += "])", e;
3532
3616
  }
3533
- }, as = (e) => e == null ? !1 : Array.isArray(e) || e instanceof ArrayBuffer || ArrayBuffer.isView(e) && !(e instanceof DataView) || e instanceof is ? !0 : br(e), os = ni(rs, is), ss = class {
3617
+ }, _s = (e) => e == null ? !1 : Array.isArray(e) || e instanceof ArrayBuffer || ArrayBuffer.isView(e) && !(e instanceof DataView) || e instanceof gs ? !0 : Nr(e), vs = _i(hs, gs), ys = class {
3534
3618
  series;
3535
3619
  end;
3536
3620
  index;
3537
3621
  constructor(e, t, n) {
3538
3622
  this.series = e;
3539
- let r = w(0, e.length + 1);
3540
- this.end = Tn(r, n), this.index = Tn(r, t);
3623
+ let r = E(0, e.length + 1);
3624
+ this.end = Rn(r, n), this.index = Rn(r, t);
3541
3625
  }
3542
3626
  next() {
3543
3627
  return this.index >= this.end ? {
@@ -3548,7 +3632,7 @@ var Yo = /* @__PURE__ */ r({
3548
3632
  value: this.series.at(this.index++, !0)
3549
3633
  };
3550
3634
  }
3551
- }, cs = class {
3635
+ }, bs = class {
3552
3636
  series;
3553
3637
  byteOffset;
3554
3638
  decoder;
@@ -3571,7 +3655,7 @@ var Yo = /* @__PURE__ */ r({
3571
3655
  value: n
3572
3656
  };
3573
3657
  }
3574
- }, ls = class e {
3658
+ }, xs = class e {
3575
3659
  wrapped;
3576
3660
  static schema = t.record(t.string(), t.unknown());
3577
3661
  constructor(e) {
@@ -3584,30 +3668,30 @@ var Yo = /* @__PURE__ */ r({
3584
3668
  value: void 0
3585
3669
  } : {
3586
3670
  done: !1,
3587
- value: ur.decodeString(t.value, e.schema)
3671
+ value: Cr.decodeString(t.value, e.schema)
3588
3672
  };
3589
3673
  }
3590
- }, us = class {
3674
+ }, Ss = class {
3591
3675
  series;
3592
3676
  index;
3593
3677
  data;
3594
3678
  density;
3595
3679
  constructor(e) {
3596
- if (!e.dataType.equals(j.UUID)) throw Error("cannot create a UUID series iterator for a non-UUID series");
3597
- this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density = j.UUID.density.valueOf();
3680
+ if (!e.dataType.equals(N.UUID)) throw Error("cannot create a UUID series iterator for a non-UUID series");
3681
+ this.series = e, this.index = 0, this.data = new Uint8Array(e.buffer), this.density = N.UUID.density.valueOf();
3598
3682
  }
3599
3683
  next() {
3600
3684
  if (this.index >= this.series.length) return {
3601
3685
  done: !0,
3602
3686
  value: void 0
3603
3687
  };
3604
- let e = Zo(this.data, this.index * this.density);
3688
+ let e = cs(this.data, this.index * this.density);
3605
3689
  return this.index++, {
3606
3690
  done: !1,
3607
3691
  value: e
3608
3692
  };
3609
3693
  }
3610
- }, ds = class {
3694
+ }, Cs = class {
3611
3695
  series;
3612
3696
  index;
3613
3697
  constructor(e) {
@@ -3622,7 +3706,7 @@ var Yo = /* @__PURE__ */ r({
3622
3706
  value: this.series.at(this.index++, !0)
3623
3707
  };
3624
3708
  }
3625
- }, fs = class {
3709
+ }, ws = class {
3626
3710
  series;
3627
3711
  constructor(e = []) {
3628
3712
  if (e.length !== 0) {
@@ -3632,23 +3716,23 @@ var Yo = /* @__PURE__ */ r({
3632
3716
  this.series = e;
3633
3717
  }
3634
3718
  as(e) {
3635
- return ns(e, this.dataType), this;
3719
+ return ms(e, this.dataType), this;
3636
3720
  }
3637
3721
  get dataType() {
3638
- return this.series.length === 0 ? j.UNKNOWN : this.series[0].dataType;
3722
+ return this.series.length === 0 ? N.UNKNOWN : this.series[0].dataType;
3639
3723
  }
3640
3724
  get timeRange() {
3641
- return this.series.length === 0 ? A.ZERO : new A(this.series[0].timeRange.start, this.series[this.series.length - 1].timeRange.end);
3725
+ return this.series.length === 0 ? M.ZERO : new M(this.series[0].timeRange.start, this.series[this.series.length - 1].timeRange.end);
3642
3726
  }
3643
3727
  get alignment() {
3644
3728
  return this.series.length === 0 ? 0n : this.series[0].alignment;
3645
3729
  }
3646
3730
  get alignmentBounds() {
3647
- return this.series.length === 0 ? w(0n, 0n) : w(this.series[0].alignmentBounds.lower, this.series[this.series.length - 1].alignmentBounds.upper);
3731
+ return this.series.length === 0 ? E(0n, 0n) : E(this.series[0].alignmentBounds.lower, this.series[this.series.length - 1].alignmentBounds.upper);
3648
3732
  }
3649
3733
  push(e) {
3650
3734
  let t = () => /* @__PURE__ */ Error(`cannot push a ${e.dataType.toString()} series to a ${this.dataType.toString()} multi-series`), n = e.dataType.equals(this.dataType);
3651
- if (os(e)) {
3735
+ if (vs(e)) {
3652
3736
  if (this.series.length !== 0 && !n) throw t();
3653
3737
  this.series.push(e);
3654
3738
  } else {
@@ -3660,7 +3744,7 @@ var Yo = /* @__PURE__ */ r({
3660
3744
  return this.series.reduce((e, t) => e + t.length, 0);
3661
3745
  }
3662
3746
  atAlignment(e, t) {
3663
- for (let n of this.series) if (T(n.alignmentBounds, e)) return n.atAlignment(e, t);
3747
+ for (let n of this.series) if (D(n.alignmentBounds, e)) return n.atAlignment(e, t);
3664
3748
  if (t) throw Error(`[series] - no value at alignment ${e}`);
3665
3749
  }
3666
3750
  at(e, t = !1) {
@@ -3672,16 +3756,16 @@ var Yo = /* @__PURE__ */ r({
3672
3756
  if (t) throw Error(`[series] - no value at index ${e}`);
3673
3757
  }
3674
3758
  subIterator(e, t) {
3675
- return new ms(this, e, t ?? this.length);
3759
+ return new Es(this, e, t ?? this.length);
3676
3760
  }
3677
3761
  subAlignmentIterator(e, t) {
3678
- if (e >= this.alignmentBounds.upper || t <= this.alignmentBounds.lower) return $o;
3762
+ if (e >= this.alignmentBounds.upper || t <= this.alignmentBounds.lower) return ds;
3679
3763
  let n = 0;
3680
3764
  for (let t = 0; t < this.series.length; t++) {
3681
3765
  let r = this.series[t];
3682
3766
  if (e < r.alignment) break;
3683
3767
  if (e >= r.alignmentBounds.upper) n += r.length;
3684
- else if (T(r.alignmentBounds, e)) {
3768
+ else if (D(r.alignmentBounds, e)) {
3685
3769
  n += Math.ceil(Number(e - r.alignment) / Number(r.alignmentMultiple));
3686
3770
  break;
3687
3771
  }
@@ -3691,36 +3775,36 @@ var Yo = /* @__PURE__ */ r({
3691
3775
  let n = this.series[e];
3692
3776
  if (t < n.alignment) break;
3693
3777
  if (t >= n.alignmentBounds.upper) r += n.length;
3694
- else if (T(n.alignmentBounds, t)) {
3778
+ else if (D(n.alignmentBounds, t)) {
3695
3779
  r += Math.ceil(Number(t - n.alignment) / Number(n.alignmentMultiple));
3696
3780
  break;
3697
3781
  }
3698
3782
  }
3699
- return new ms(this, n, r);
3783
+ return new Es(this, n, r);
3700
3784
  }
3701
3785
  subAlignmentSpanIterator(e, t) {
3702
- if (e >= this.alignmentBounds.upper) return $o;
3786
+ if (e >= this.alignmentBounds.upper) return ds;
3703
3787
  t = Math.min(t, Number(this.distance(e, this.alignmentBounds.upper)));
3704
3788
  let n = 0;
3705
3789
  for (let t = 0; t < this.series.length; t++) {
3706
3790
  let r = this.series[t];
3707
3791
  if (e < r.alignment) break;
3708
3792
  if (e >= r.alignmentBounds.upper) n += r.length;
3709
- else if (T(r.alignmentBounds, e)) {
3793
+ else if (D(r.alignmentBounds, e)) {
3710
3794
  n += Number(e - r.alignment);
3711
3795
  break;
3712
3796
  }
3713
3797
  }
3714
- return new ms(this, n, n + t);
3798
+ return new Es(this, n, n + t);
3715
3799
  }
3716
3800
  updateGLBuffer(e) {
3717
3801
  this.series.forEach((t) => t.updateGLBuffer(e));
3718
3802
  }
3719
3803
  get bounds() {
3720
- return Mn(this.series.map((e) => e.bounds));
3804
+ return Gn(this.series.map((e) => e.bounds));
3721
3805
  }
3722
3806
  get byteLength() {
3723
- return new M(this.series.reduce((e, t) => e + t.byteLength.valueOf(), 0));
3807
+ return new P(this.series.reduce((e, t) => e + t.byteLength.valueOf(), 0));
3724
3808
  }
3725
3809
  get data() {
3726
3810
  let e = new this.dataType.Array(this.length), t = 0;
@@ -3728,7 +3812,7 @@ var Yo = /* @__PURE__ */ r({
3728
3812
  return new this.dataType.Array(e.buffer);
3729
3813
  }
3730
3814
  traverseAlignment(e, t) {
3731
- return Rn(this.series.map((e) => e.alignmentBounds), e, t);
3815
+ return Zn(this.series.map((e) => e.alignmentBounds), e, t);
3732
3816
  }
3733
3817
  acquire(e) {
3734
3818
  this.series.forEach((t) => t.acquire(e));
@@ -3737,10 +3821,10 @@ var Yo = /* @__PURE__ */ r({
3737
3821
  this.series.forEach((e) => e.release());
3738
3822
  }
3739
3823
  distance(e, t) {
3740
- return zn(this.series.map((e) => e.alignmentBounds), e, t);
3824
+ return Qn(this.series.map((e) => e.alignmentBounds), e, t);
3741
3825
  }
3742
3826
  parseJSON(e) {
3743
- if (!this.dataType.equals(j.JSON)) throw Error("cannot parse non-JSON series as JSON");
3827
+ if (!this.dataType.equals(N.JSON)) throw Error("cannot parse non-JSON series as JSON");
3744
3828
  return this.series.flatMap((t) => t.parseJSON(e));
3745
3829
  }
3746
3830
  [Symbol.iterator]() {
@@ -3749,12 +3833,12 @@ var Yo = /* @__PURE__ */ r({
3749
3833
  done: !0,
3750
3834
  value: void 0
3751
3835
  };
3752
- } } : new ps(this.series);
3836
+ } } : new Ts(this.series);
3753
3837
  }
3754
3838
  toStrings() {
3755
3839
  return this.series.flatMap((e) => e.toStrings());
3756
3840
  }
3757
- }, ps = class {
3841
+ }, Ts = class {
3758
3842
  series;
3759
3843
  seriesIndex;
3760
3844
  internal;
@@ -3771,7 +3855,7 @@ var Yo = /* @__PURE__ */ r({
3771
3855
  [Symbol.iterator]() {
3772
3856
  return this;
3773
3857
  }
3774
- }, ms = class {
3858
+ }, Es = class {
3775
3859
  series;
3776
3860
  index;
3777
3861
  end;
@@ -3790,46 +3874,58 @@ var Yo = /* @__PURE__ */ r({
3790
3874
  [Symbol.iterator]() {
3791
3875
  return this;
3792
3876
  }
3793
- }, hs = (e) => ({
3877
+ }, Ds = (e) => ({
3794
3878
  domain: e >> 32n,
3795
3879
  sample: e & 4294967295n
3796
- }), gs = /* @__PURE__ */ r({
3797
- ClockSkewCalculator: () => kr,
3798
- DataType: () => j,
3799
- Density: () => k,
3800
- MultiSeries: () => fs,
3801
- Rate: () => O,
3802
- Series: () => is,
3803
- Size: () => M,
3804
- TimeRange: () => A,
3805
- TimeSpan: () => D,
3806
- TimeStamp: () => E,
3807
- convertDataType: () => xr,
3808
- dataTypeZ: () => Dr,
3809
- isCrudeSeries: () => as,
3810
- isTelemValue: () => br,
3811
- numericTimeRangeZ: () => vr,
3812
- rateZ: () => Tr,
3813
- sizeZ: () => Er,
3814
- timeRangeBoundedZ: () => Or,
3815
- timeRangeZ: () => Sr,
3816
- timeSpanZ: () => wr,
3817
- timeStampZ: () => Cr,
3818
- typedArrayZ: () => yr
3819
- }), _s = /* @__PURE__ */ r({ sleep: () => vs }), vs = async (e) => await new Promise((t) => setTimeout(t, D.fromMilliseconds(e).milliseconds)), ys = /* @__PURE__ */ r({
3820
- Breaker: () => bs,
3821
- breakerConfigZ: () => xs
3822
- }), bs = class {
3880
+ }), Os = [
3881
+ "ISO",
3882
+ "ISODate",
3883
+ "time",
3884
+ "preciseTime",
3885
+ "date",
3886
+ "preciseDate",
3887
+ "dateTime"
3888
+ ], ks = t.enum(Os), As = ["local", "UTC"], js = t.enum(As), Ms = /* @__PURE__ */ r({
3889
+ ClockSkewCalculator: () => Hr,
3890
+ DataType: () => N,
3891
+ Density: () => j,
3892
+ MultiSeries: () => ws,
3893
+ Rate: () => A,
3894
+ Series: () => gs,
3895
+ Size: () => P,
3896
+ TIMESTAMP_FORMATS: () => Os,
3897
+ TIME_ZONES: () => As,
3898
+ TimeRange: () => M,
3899
+ TimeSpan: () => k,
3900
+ TimeStamp: () => O,
3901
+ convertDataType: () => Pr,
3902
+ dataTypeZ: () => Br,
3903
+ isCrudeSeries: () => _s,
3904
+ isTelemValue: () => Nr,
3905
+ numericTimeRangeZ: () => jr,
3906
+ rateZ: () => Rr,
3907
+ sizeZ: () => zr,
3908
+ timeRangeBoundedZ: () => Vr,
3909
+ timeRangeZ: () => Fr,
3910
+ timeSpanZ: () => Lr,
3911
+ timeStampZ: () => Ir,
3912
+ timeZoneZ: () => js,
3913
+ timestampFormatZ: () => ks,
3914
+ typedArrayZ: () => Mr
3915
+ }), Ns = /* @__PURE__ */ r({ sleep: () => Ps }), Ps = async (e) => await new Promise((t) => setTimeout(t, k.fromMilliseconds(e).milliseconds)), Fs = /* @__PURE__ */ r({
3916
+ Breaker: () => Is,
3917
+ breakerConfigZ: () => Ls
3918
+ }), Is = class {
3823
3919
  config;
3824
3920
  retries;
3825
3921
  interval;
3826
3922
  constructor(e) {
3827
3923
  this.config = {
3828
- baseInterval: new D(e?.baseInterval ?? D.seconds(1)),
3924
+ baseInterval: new k(e?.baseInterval ?? k.seconds(1)),
3829
3925
  maxRetries: e?.maxRetries ?? 5,
3830
3926
  scale: e?.scale ?? 1,
3831
- sleepFn: e?.sleepFn ?? vs
3832
- }, this.retries = 0, this.interval = new D(this.config.baseInterval);
3927
+ sleepFn: e?.sleepFn ?? Ps
3928
+ }, this.retries = 0, this.interval = new k(this.config.baseInterval);
3833
3929
  }
3834
3930
  async wait() {
3835
3931
  let { maxRetries: e, scale: t, sleepFn: n } = this.config;
@@ -3841,48 +3937,48 @@ var Yo = /* @__PURE__ */ r({
3841
3937
  reset() {
3842
3938
  this.retries = 0, this.interval = this.config.baseInterval;
3843
3939
  }
3844
- }, xs = t.object({
3845
- baseInterval: D.z.optional(),
3940
+ }, Ls = t.object({
3941
+ baseInterval: k.z.optional(),
3846
3942
  maxRetries: t.number().optional(),
3847
3943
  scale: t.number().optional()
3848
- }), Ss = /* @__PURE__ */ r({ Z: () => Cs }), Cs = (e) => t.object({
3944
+ }), Rs = /* @__PURE__ */ r({ Z: () => zs }), zs = (e) => t.object({
3849
3945
  variant: t.enum(["set", "delete"]),
3850
3946
  key: t.string(),
3851
3947
  value: e
3852
- }), ws = t.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), Q = Xn, Ts = t.number().min(0).max(1), Es = t.tuple([
3948
+ }), Bs = t.string().regex(/^#?([0-9a-f]{6}|[0-9a-f]{8})$/i), Q = lr, Vs = t.number().min(0).max(1), Hs = t.tuple([
3853
3949
  Q,
3854
3950
  Q,
3855
3951
  Q,
3856
- Ts
3857
- ]), Ds = t.tuple([
3952
+ Vs
3953
+ ]), Us = t.tuple([
3858
3954
  Q,
3859
3955
  Q,
3860
3956
  Q
3861
- ]), Os = t.object({ rgba255: Es }), ks = t.object({
3957
+ ]), Ws = t.object({ rgba255: Hs }), Gs = t.object({
3862
3958
  r: Q,
3863
3959
  g: Q,
3864
3960
  b: Q,
3865
- a: Ts
3866
- }), As = t.number().min(0).max(360), js = t.number().min(0).max(100), Ms = t.number().min(0).max(100), Ns = t.tuple([
3867
- As,
3868
- js,
3869
- Ms,
3870
- Ts
3871
- ]), Ps = t.union([
3872
- ws,
3873
- Ds,
3874
- Es,
3875
- Ns,
3876
- Os,
3877
- ks
3878
- ]), Fs = Ps.transform((e) => $(e)), Is = (e) => Fs.safeParse(e).success, Ls = (e) => Es.safeParse(e).success, Rs = ((e) => {
3961
+ a: Vs
3962
+ }), Ks = t.number().min(0).max(360), qs = t.number().min(0).max(100), Js = t.number().min(0).max(100), Ys = t.tuple([
3963
+ Ks,
3964
+ qs,
3965
+ Js,
3966
+ Vs
3967
+ ]), Xs = t.union([
3968
+ Bs,
3969
+ Us,
3970
+ Hs,
3971
+ Ys,
3972
+ Ws,
3973
+ Gs
3974
+ ]), Zs = Xs.transform((e) => $(e)), Qs = (e) => Zs.safeParse(e).success, $s = (e) => Hs.safeParse(e).success, ec = ((e) => {
3879
3975
  if (e == null) return;
3880
- let t = Fs.safeParse(e);
3881
- if (t.success) return Vs(t.data);
3976
+ let t = Zs.safeParse(e);
3977
+ if (t.success) return rc(t.data);
3882
3978
  if (typeof e == "string") return e;
3883
3979
  throw t.error;
3884
3980
  }), $ = (e, t = 1) => {
3885
- if (e = Ps.parse(e), typeof e == "string") return ac(e, t);
3981
+ if (e = Xs.parse(e), typeof e == "string") return xc(e, t);
3886
3982
  if (Array.isArray(e)) {
3887
3983
  if (e.length < 3 || e.length > 4) throw Error(`Invalid color: [${e.join(", ")}]`);
3888
3984
  return e.length === 3 ? [...e, t] : e;
@@ -3893,25 +3989,25 @@ var Yo = /* @__PURE__ */ r({
3893
3989
  e.b,
3894
3990
  e.a
3895
3991
  ] : e.rgba255;
3896
- }, zs = (e, t) => {
3992
+ }, tc = (e, t) => {
3897
3993
  if (e == null || t == null) return e == t;
3898
3994
  let n = $(e), r = $(t);
3899
3995
  return n.every((e, t) => e === r[t]);
3900
- }, Bs = ((e) => {
3996
+ }, nc = ((e) => {
3901
3997
  if (e == null) return;
3902
3998
  let [t, n, r, i] = $(e), a = Math.round(i * 255);
3903
- return `#${sc(t)}${sc(n)}${sc(r)}${a === 255 ? "" : sc(a)}`;
3904
- }), Vs = (e) => {
3999
+ return `#${Cc(t)}${Cc(n)}${Cc(r)}${a === 255 ? "" : Cc(a)}`;
4000
+ }), rc = (e) => {
3905
4001
  let [t, n, r, i] = $(e);
3906
4002
  return `rgba(${t}, ${n}, ${r}, ${i})`;
3907
- }, Hs = (e) => `rgb(${Us(e)})`, Us = (e) => {
4003
+ }, ic = (e) => `rgb(${ac(e)})`, ac = (e) => {
3908
4004
  let [t, n, r] = $(e);
3909
4005
  return `${t}, ${n}, ${r}`;
3910
- }, Ws = (e) => [...Gs(e), Ys(e)], Gs = (e) => [
3911
- Ks(e) / 255,
3912
- qs(e) / 255,
3913
- Js(e) / 255
3914
- ], Ks = (e) => $(e)[0], qs = (e) => $(e)[1], Js = (e) => $(e)[2], Ys = (e) => $(e)[3], Xs = (e) => zs(oc, e), Zs = (e) => mc($(e)), Qs = (e, t) => {
4006
+ }, oc = (e) => [...sc(e), dc(e)], sc = (e) => [
4007
+ cc(e) / 255,
4008
+ lc(e) / 255,
4009
+ uc(e) / 255
4010
+ ], cc = (e) => $(e)[0], lc = (e) => $(e)[1], uc = (e) => $(e)[2], dc = (e) => $(e)[3], fc = (e) => tc(Sc, e), pc = (e) => Ac($(e)), mc = (e, t) => {
3915
4011
  let [n, r, i] = $(e);
3916
4012
  if (t > 100) throw Error(`Color opacity must be between 0 and 100, got ${t}`);
3917
4013
  return t > 1 && (t /= 100), [
@@ -3920,30 +4016,30 @@ var Yo = /* @__PURE__ */ r({
3920
4016
  i,
3921
4017
  t
3922
4018
  ];
3923
- }, $s = (e) => {
3924
- let [t, n, r] = Gs(e).map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
4019
+ }, hc = (e) => {
4020
+ let [t, n, r] = sc(e).map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
3925
4021
  return Number((.2126 * t + .7152 * n + .0722 * r).toFixed(3));
3926
- }, ec = (e) => {
3927
- let [t, n, r] = Gs(e);
4022
+ }, gc = (e) => {
4023
+ let [t, n, r] = sc(e);
3928
4024
  return 1 - (Math.max(t, n, r) - Math.min(t, n, r));
3929
- }, tc = (e, t) => {
3930
- let n = $(e), r = $(t), i = $s(n), a = $s(r);
4025
+ }, _c = (e, t) => {
4026
+ let n = $(e), r = $(t), i = hc(n), a = hc(r);
3931
4027
  return (Math.max(i, a) + .5) / (Math.min(i, a) + .5);
3932
- }, nc = (e, ...t) => {
4028
+ }, vc = (e, ...t) => {
3933
4029
  if (t.length === 0) throw Error("[Color.pickByContrast] - must provide at least one color");
3934
- let n = $(e), [r] = t.sort((e, t) => tc(n, t) - tc(n, e));
4030
+ let n = $(e), [r] = t.sort((e, t) => _c(n, t) - _c(n, e));
3935
4031
  return $(r);
3936
- }, rc = (e) => $s(e) < .5, ic = (e) => $s(e) > .5, ac = (e, t = 1) => (e = ws.parse(e), e = lc(e), [
3937
- cc(e, 0),
3938
- cc(e, 2),
3939
- cc(e, 4),
3940
- e.length === 8 ? cc(e, 6) / 255 : t
3941
- ]), oc = [
4032
+ }, yc = (e) => hc(e) < .5, bc = (e) => hc(e) > .5, xc = (e, t = 1) => (e = Bs.parse(e), e = Tc(e), [
4033
+ wc(e, 0),
4034
+ wc(e, 2),
4035
+ wc(e, 4),
4036
+ e.length === 8 ? wc(e, 6) / 255 : t
4037
+ ]), Sc = [
3942
4038
  0,
3943
4039
  0,
3944
4040
  0,
3945
4041
  0
3946
- ], sc = (e) => Math.floor(e).toString(16).padStart(2, "0"), cc = (e, t) => parseInt(e.slice(t, t + 2), 16), lc = (e) => e.startsWith("#") ? e.slice(1) : e, uc = {
4042
+ ], Cc = (e) => Math.floor(e).toString(16).padStart(2, "0"), wc = (e, t) => parseInt(e.slice(t, t + 2), 16), Tc = (e) => e.startsWith("#") ? e.slice(1) : e, Ec = {
3947
4043
  black: "#000000",
3948
4044
  white: "#ffffff",
3949
4045
  red: "#ff0000",
@@ -3975,16 +4071,16 @@ var Yo = /* @__PURE__ */ r({
3975
4071
  khaki: "#f0e68c",
3976
4072
  crimson: "#dc143c",
3977
4073
  transparent: "transparent"
3978
- }, dc = (e) => {
4074
+ }, Dc = (e) => {
3979
4075
  if (!e) return;
3980
4076
  let t = e.trim().toLowerCase();
3981
4077
  if (!(t === "transparent" || t === "none")) {
3982
4078
  if (t.startsWith("#")) {
3983
4079
  if (t.length === 4) {
3984
4080
  let e = t[1], n = t[2], r = t[3], i = `#${e}${e}${n}${n}${r}${r}`;
3985
- if (ws.safeParse(i).success) return ac(i);
4081
+ if (Bs.safeParse(i).success) return xc(i);
3986
4082
  }
3987
- return (t.length === 7 || t.length === 9) && ws.safeParse(t).success ? ac(t) : void 0;
4083
+ return (t.length === 7 || t.length === 9) && Bs.safeParse(t).success ? xc(t) : void 0;
3988
4084
  }
3989
4085
  if (t.startsWith("rgb")) {
3990
4086
  let e = t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/);
@@ -3998,17 +4094,17 @@ var Yo = /* @__PURE__ */ r({
3998
4094
  ];
3999
4095
  }
4000
4096
  }
4001
- if (uc[t]) return ac(uc[t]);
4097
+ if (Ec[t]) return xc(Ec[t]);
4002
4098
  }
4003
- }, fc = (e) => {
4004
- e = Ns.parse(e);
4099
+ }, Oc = (e) => {
4100
+ e = Ys.parse(e);
4005
4101
  let [t, n, r] = e, i = e[3];
4006
4102
  t /= 360, n /= 100, r /= 100;
4007
4103
  let a, o, s;
4008
4104
  if (n === 0) a = o = s = r;
4009
4105
  else {
4010
4106
  let e = r < .5 ? r * (1 + n) : r + n - r * n, i = 2 * r - e;
4011
- a = pc(i, e, t + 1 / 3), o = pc(i, e, t), s = pc(i, e, t - 1 / 3);
4107
+ a = kc(i, e, t + 1 / 3), o = kc(i, e, t), s = kc(i, e, t - 1 / 3);
4012
4108
  }
4013
4109
  return [
4014
4110
  Math.round(a * 255),
@@ -4016,8 +4112,8 @@ var Yo = /* @__PURE__ */ r({
4016
4112
  Math.round(s * 255),
4017
4113
  i
4018
4114
  ];
4019
- }, pc = (e, t, n) => (n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e), mc = (e) => {
4020
- e = Es.parse(e);
4115
+ }, kc = (e, t, n) => (n < 0 && (n += 1), n > 1 && --n, n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e), Ac = (e) => {
4116
+ e = Hs.parse(e);
4021
4117
  let [t, n, r] = e, i = e[3];
4022
4118
  t /= 255, n /= 255, r /= 255;
4023
4119
  let a = Math.max(t, n, r), o = Math.min(t, n, r), s, c, l = (a + o) / 2;
@@ -4032,13 +4128,13 @@ var Yo = /* @__PURE__ */ r({
4032
4128
  Math.round(l),
4033
4129
  i
4034
4130
  ];
4035
- }, hc = $("#000000"), gc = $("#ffffff"), _c = t.object({
4131
+ }, jc = $("#000000"), Mc = $("#ffffff"), Nc = t.object({
4036
4132
  key: t.string(),
4037
- color: Ps,
4133
+ color: Xs,
4038
4134
  position: t.number(),
4039
4135
  switched: t.boolean().optional()
4040
- }), vc = t.array(_c), yc = (e, t) => {
4041
- if (e.length === 0) return oc;
4136
+ }), Pc = t.array(Nc), Fc = (e, t) => {
4137
+ if (e.length === 0) return Sc;
4042
4138
  if (e = e.slice().sort((e, t) => e.position - t.position), t <= e[0].position) return $(e[0].color);
4043
4139
  if (t >= e[e.length - 1].position) return $(e[e.length - 1].color);
4044
4140
  for (let n = 0; n < e.length - 1; n++) {
@@ -4048,99 +4144,99 @@ var Yo = /* @__PURE__ */ r({
4048
4144
  if (t === i.position) return $(i.color);
4049
4145
  let a = (t - r.position) / (i.position - r.position), o = $(r.color), s = $(i.color);
4050
4146
  return $([
4051
- Math.round(Ks(o) + a * (Ks(s) - Ks(o))),
4052
- Math.round(qs(o) + a * (qs(s) - qs(o))),
4053
- Math.round(Js(o) + a * (Js(s) - Js(o))),
4054
- Ys(o) + a * (Ys(s) - Ys(o))
4147
+ Math.round(cc(o) + a * (cc(s) - cc(o))),
4148
+ Math.round(lc(o) + a * (lc(s) - lc(o))),
4149
+ Math.round(uc(o) + a * (uc(s) - uc(o))),
4150
+ dc(o) + a * (dc(s) - dc(o))
4055
4151
  ]);
4056
4152
  }
4057
4153
  return $(e[e.length - 1].color);
4058
- }, bc = t.object({
4154
+ }, Ic = t.object({
4059
4155
  key: t.string(),
4060
4156
  name: t.string(),
4061
- color: Fs
4062
- }), xc = t.object({
4157
+ color: Zs
4158
+ }), Lc = t.object({
4063
4159
  key: t.string(),
4064
4160
  name: t.string(),
4065
- swatches: t.array(bc)
4066
- }), Sc = /* @__PURE__ */ r({
4067
- BLACK: () => hc,
4068
- WHITE: () => gc,
4069
- ZERO: () => oc,
4070
- aValue: () => Ys,
4071
- bValue: () => Js,
4072
- colorZ: () => Fs,
4161
+ swatches: t.array(Ic)
4162
+ }), Rc = /* @__PURE__ */ r({
4163
+ BLACK: () => jc,
4164
+ WHITE: () => Mc,
4165
+ ZERO: () => Sc,
4166
+ aValue: () => dc,
4167
+ bValue: () => uc,
4168
+ colorZ: () => Zs,
4073
4169
  construct: () => $,
4074
- contrast: () => tc,
4075
- crudeZ: () => Ps,
4076
- cssString: () => Rs,
4077
- equals: () => zs,
4078
- fromCSS: () => dc,
4079
- fromGradient: () => yc,
4080
- fromHSLA: () => fc,
4081
- gValue: () => qs,
4082
- gradientZ: () => vc,
4083
- grayness: () => ec,
4084
- hex: () => Bs,
4085
- hsla: () => Zs,
4086
- isColor: () => Ls,
4087
- isCrude: () => Is,
4088
- isDark: () => rc,
4089
- isLight: () => ic,
4090
- isZero: () => Xs,
4091
- luminance: () => $s,
4092
- paletteZ: () => xc,
4093
- pickByContrast: () => nc,
4094
- rValue: () => Ks,
4095
- rgbCSS: () => Hs,
4096
- rgbString: () => Us,
4097
- rgba1: () => Ws,
4098
- rgbaCSS: () => Vs,
4099
- setAlpha: () => Qs,
4100
- stopZ: () => _c
4101
- }), Cc = Xn, wc = /* @__PURE__ */ function(e) {
4170
+ contrast: () => _c,
4171
+ crudeZ: () => Xs,
4172
+ cssString: () => ec,
4173
+ equals: () => tc,
4174
+ fromCSS: () => Dc,
4175
+ fromGradient: () => Fc,
4176
+ fromHSLA: () => Oc,
4177
+ gValue: () => lc,
4178
+ gradientZ: () => Pc,
4179
+ grayness: () => gc,
4180
+ hex: () => nc,
4181
+ hsla: () => pc,
4182
+ isColor: () => $s,
4183
+ isCrude: () => Qs,
4184
+ isDark: () => yc,
4185
+ isLight: () => bc,
4186
+ isZero: () => fc,
4187
+ luminance: () => hc,
4188
+ paletteZ: () => Lc,
4189
+ pickByContrast: () => vc,
4190
+ rValue: () => cc,
4191
+ rgbCSS: () => ic,
4192
+ rgbString: () => ac,
4193
+ rgba1: () => oc,
4194
+ rgbaCSS: () => rc,
4195
+ setAlpha: () => mc,
4196
+ stopZ: () => Nc
4197
+ }), zc = lr, Bc = /* @__PURE__ */ function(e) {
4102
4198
  return e[e.exclusive = 0] = "exclusive", e[e.shared = 1] = "shared", e;
4103
- }({}), Tc = t.enum(wc), Ec = t.object({
4199
+ }({}), Vc = t.enum(Bc), Hc = t.object({
4104
4200
  key: t.string(),
4105
4201
  name: t.string(),
4106
4202
  group: t.uint32().optional()
4107
- }), Dc = (e) => t.object({
4108
- subject: Ec,
4203
+ }), Uc = (e) => t.object({
4204
+ subject: Hc,
4109
4205
  resource: e,
4110
- authority: Cc
4111
- }), Oc = {
4206
+ authority: zc
4207
+ }), Wc = {
4112
4208
  lower: 0,
4113
4209
  upper: 256
4114
- }, kc = (...e) => (t) => t.filter((t) => {
4210
+ }, Gc = (...e) => (t) => t.filter((t) => {
4115
4211
  let n = !1;
4116
4212
  return t.to != null && (n = e.includes(t.to.resource)), t.from != null && !n && (n = e.includes(t.from.resource)), n;
4117
- }), Ac = (e) => t.object({
4118
- from: Dc(e),
4213
+ }), Kc = (e) => t.object({
4214
+ from: Uc(e),
4119
4215
  to: t.null().optional()
4120
- }), jc = (e) => t.object({
4216
+ }), qc = (e) => t.object({
4121
4217
  from: t.null().optional(),
4122
- to: Dc(e)
4123
- }), Mc = (e) => t.union([
4124
- Ac(e),
4125
- jc(e),
4218
+ to: Uc(e)
4219
+ }), Jc = (e) => t.union([
4220
+ Kc(e),
4221
+ qc(e),
4126
4222
  t.object({
4127
- from: Dc(e),
4128
- to: Dc(e)
4223
+ from: Uc(e),
4224
+ to: Uc(e)
4129
4225
  })
4130
- ]), Nc = /* @__PURE__ */ r({
4226
+ ]), Yc = /* @__PURE__ */ r({
4131
4227
  ABSOLUTE_AUTHORITY: () => 255,
4132
- AUTHORITY_BOUNDS: () => Oc,
4133
- Concurrency: () => wc,
4228
+ AUTHORITY_BOUNDS: () => Wc,
4229
+ Concurrency: () => Bc,
4134
4230
  ZERO_AUTHORITY: () => 0,
4135
- acquireZ: () => jc,
4136
- authorityZ: () => Cc,
4137
- concurrencyZ: () => Tc,
4138
- filterTransfersByChannelKey: () => kc,
4139
- releaseZ: () => Ac,
4140
- stateZ: () => Dc,
4141
- subjectZ: () => Ec,
4142
- transferZ: () => Mc
4143
- }), Pc = /* @__PURE__ */ r({ formatValue: () => Fc }), Fc = (e) => {
4231
+ acquireZ: () => qc,
4232
+ authorityZ: () => zc,
4233
+ concurrencyZ: () => Vc,
4234
+ filterTransfersByChannelKey: () => Gc,
4235
+ releaseZ: () => Kc,
4236
+ stateZ: () => Uc,
4237
+ subjectZ: () => Hc,
4238
+ transferZ: () => Jc
4239
+ }), Xc = /* @__PURE__ */ r({ formatValue: () => Zc }), Zc = (e) => {
4144
4240
  switch (typeof e) {
4145
4241
  case "bigint":
4146
4242
  case "number": return e.toString();
@@ -4148,42 +4244,50 @@ var Yo = /* @__PURE__ */ r({
4148
4244
  case "undefined": return "";
4149
4245
  case "string":
4150
4246
  case "symbol":
4151
- case "function": return Lc(e.toString());
4152
- case "object": return e == null ? "" : Lc(JSON.stringify(e));
4153
- }
4154
- }, Ic = /[",\n]/, Lc = (e) => Ic.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, Rc = (e, t) => {
4155
- let n = null;
4156
- return t === 0 ? e : (...r) => {
4157
- n !== null && (clearTimeout(n), n = null), n = setTimeout(() => e(...r), t);
4158
- };
4159
- }, zc = (e, t) => {
4160
- let n = null;
4161
- return t === 0 ? e : (...r) => {
4162
- n === null && (n = setTimeout(() => {
4163
- e(...r), n = null;
4164
- }, t));
4165
- };
4166
- }, Bc = /* @__PURE__ */ r({}), Vc = /* @__PURE__ */ r({
4167
- ZERO_PRIMITIVES: () => Gc,
4168
- pointerZ: () => Hc,
4169
- primitiveTypeZ: () => Wc,
4170
- primitiveZ: () => Uc
4171
- }), Hc = t.string().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/, "must be a valid JSON pointer (RFC 6901)"), Uc = t.union([
4247
+ case "function": return $c(e.toString());
4248
+ case "object": return e == null ? "" : $c(JSON.stringify(e));
4249
+ }
4250
+ }, Qc = /[",\n]/, $c = (e) => Qc.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e, el = () => {}, tl = (e, t) => {
4251
+ let n = new k(t);
4252
+ if (n.valueOf() <= 0) {
4253
+ let t = ((...t) => e(...t));
4254
+ return t.cancel = el, t.flush = el, t;
4255
+ }
4256
+ let r, i = null, a = () => {
4257
+ if (i === null) return;
4258
+ let t = i;
4259
+ i = null, e(...t);
4260
+ }, o = ((...e) => {
4261
+ i = e, clearTimeout(r), r = setTimeout(() => {
4262
+ r = void 0, a();
4263
+ }, n.milliseconds);
4264
+ });
4265
+ return o.cancel = () => {
4266
+ clearTimeout(r), r = void 0, i = null;
4267
+ }, o.flush = () => {
4268
+ r !== void 0 && (clearTimeout(r), r = void 0, a());
4269
+ }, o;
4270
+ }, nl = /* @__PURE__ */ r({ NOOP: () => rl }), rl = () => {}, il = /* @__PURE__ */ r({
4271
+ ZERO_PRIMITIVES: () => cl,
4272
+ pointerZ: () => al,
4273
+ primitiveTypeZ: () => sl,
4274
+ primitiveZ: () => ol
4275
+ }), al = t.string().regex(/^(?:$|(?:\/(?:[^~/]|~0|~1)*)+)$/, "must be a valid JSON pointer (RFC 6901)"), ol = t.union([
4172
4276
  t.string(),
4173
4277
  t.number(),
4174
4278
  t.boolean(),
4175
4279
  t.null()
4176
- ]), Wc = t.enum([
4280
+ ]), sl = t.enum([
4177
4281
  "string",
4178
4282
  "number",
4179
4283
  "boolean",
4180
4284
  "null"
4181
- ]), Gc = {
4285
+ ]), cl = {
4182
4286
  string: "",
4183
4287
  number: 0,
4184
4288
  boolean: !1,
4185
4289
  null: null
4186
- }, Kc = class {
4290
+ }, ll = class {
4187
4291
  store = /* @__PURE__ */ new Map();
4188
4292
  async get(e) {
4189
4293
  return this.store.get(e) ?? null;
@@ -4200,7 +4304,7 @@ var Yo = /* @__PURE__ */ r({
4200
4304
  async clear() {
4201
4305
  this.store.clear();
4202
4306
  }
4203
- }, qc = class {
4307
+ }, ul = class {
4204
4308
  store = /* @__PURE__ */ new Map();
4205
4309
  get(e) {
4206
4310
  return this.store.get(e) ?? null;
@@ -4211,33 +4315,33 @@ var Yo = /* @__PURE__ */ r({
4211
4315
  delete(e) {
4212
4316
  this.store.delete(e);
4213
4317
  }
4214
- }, Jc = t.object({
4318
+ }, dl = t.object({
4215
4319
  key: t.string(),
4216
4320
  value: t.string()
4217
- }), Yc = /* @__PURE__ */ r({
4218
- MockAsync: () => Kc,
4219
- MockSync: () => qc,
4220
- stringPairZ: () => Jc
4221
- }), Xc = /* @__PURE__ */ r({
4222
- keyZ: () => Zc,
4223
- labelZ: () => Qc,
4224
- newZ: () => $c
4225
- }), Zc = t.uuid(), Qc = t.object({
4226
- key: Zc,
4321
+ }), fl = /* @__PURE__ */ r({
4322
+ MockAsync: () => ll,
4323
+ MockSync: () => ul,
4324
+ stringPairZ: () => dl
4325
+ }), pl = /* @__PURE__ */ r({
4326
+ keyZ: () => ml,
4327
+ labelZ: () => hl,
4328
+ newZ: () => gl
4329
+ }), ml = t.uuid(), hl = t.object({
4330
+ key: ml,
4227
4331
  name: t.string().min(1),
4228
- color: Fs
4229
- }), $c = Qc.partial({ key: !0 }), el = /* @__PURE__ */ r({ is: () => nl }), tl = /* @__PURE__ */ RegExp("^(https?:\\/\\/)?((([a-zA-Z0-9][a-zA-Z0-9-]*\\.)+[a-zA-Z]{2,})|localhost|(\\d{1,3}\\.){3}\\d{1,3})(\\:\\d+)?(\\/[-a-zA-Z0-9@:%._\\+~#=]*)*(\\?[;&a-zA-Z0-9%_.,~+=-]*)?(#[-a-zA-Z0-9_]*)?$"), nl = (e) => tl.test(e), rl = /* @__PURE__ */ r({ getOrSetDefault: () => il }), il = (e, t, n) => {
4332
+ color: Zs
4333
+ }), gl = hl.partial({ key: !0 }), _l = /* @__PURE__ */ r({ is: () => yl }), vl = /* @__PURE__ */ RegExp("^(https?:\\/\\/)?((([a-zA-Z0-9][a-zA-Z0-9-]*\\.)+[a-zA-Z]{2,})|localhost|(\\d{1,3}\\.){3}\\d{1,3})(\\:\\d+)?(\\/[-a-zA-Z0-9@:%._\\+~#=]*)*(\\?[;&a-zA-Z0-9%_.,~+=-]*)?(#[-a-zA-Z0-9_]*)?$"), yl = (e) => vl.test(e), bl = /* @__PURE__ */ r({ getOrSetDefault: () => xl }), xl = (e, t, n) => {
4230
4334
  let r = e.get(t);
4231
4335
  return r === void 0 ? (e.set(t, n), n) : r;
4232
- }, al = /* @__PURE__ */ r({
4233
- compareSemVer: () => cl,
4234
- createMigration: () => fl,
4235
- migrator: () => pl,
4236
- semVerNewer: () => ul,
4237
- semVerOlder: () => dl,
4238
- semVerZ: () => ol,
4239
- versionsEqual: () => ll
4240
- }), ol = t.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/), sl = (e, t) => {
4336
+ }, Sl = /* @__PURE__ */ r({
4337
+ compareSemVer: () => Tl,
4338
+ createMigration: () => kl,
4339
+ migrator: () => Al,
4340
+ semVerNewer: () => Dl,
4341
+ semVerOlder: () => Ol,
4342
+ semVerZ: () => Cl,
4343
+ versionsEqual: () => El
4344
+ }), Cl = t.string().regex(/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/), wl = (e, t) => {
4241
4345
  let n = e.split("."), r = t.split("."), i = Math.max(n.length, r.length);
4242
4346
  for (let e = 0; e < i; e++) {
4243
4347
  let t = n[e], i = r[e];
@@ -4256,9 +4360,9 @@ var Yo = /* @__PURE__ */ r({
4256
4360
  }
4257
4361
  }
4258
4362
  return 0;
4259
- }, cl = ((e, t, n = {}) => {
4363
+ }, Tl = ((e, t, n = {}) => {
4260
4364
  n.checkMajor ??= !0, n.checkMinor ??= !0, n.checkPatch ??= !0;
4261
- let r = ol.parse(e), i = ol.parse(t), [a, o] = r.split("-"), [s, c] = i.split("-"), [l, u, d] = a.split(".").map(Number), [f, p, m] = s.split(".").map(Number);
4365
+ let r = Cl.parse(e), i = Cl.parse(t), [a, o] = r.split("-"), [s, c] = i.split("-"), [l, u, d] = a.split(".").map(Number), [f, p, m] = s.split(".").map(Number);
4262
4366
  if (n.checkMajor) {
4263
4367
  if (l < f) return -1;
4264
4368
  if (l > f) return 1;
@@ -4271,16 +4375,16 @@ var Yo = /* @__PURE__ */ r({
4271
4375
  if (d < m) return -1;
4272
4376
  if (d > m) return 1;
4273
4377
  }
4274
- return o === void 0 && c === void 0 ? 0 : o === void 0 ? 1 : c === void 0 ? -1 : sl(o, c);
4275
- }), ll = (e, t, n = {}) => Ur(cl(e, t, n)), ul = (e, t, n = {}) => Vr(cl(e, t, n)), dl = (e, t, n = {}) => Br(cl(e, t, n)), fl = ({ name: e, migrate: t }) => (n) => {
4378
+ return o === void 0 && c === void 0 ? 0 : o === void 0 ? 1 : c === void 0 ? -1 : wl(o, c);
4379
+ }), El = (e, t, n = {}) => ii(Tl(e, t, n)), Dl = (e, t, n = {}) => ni(Tl(e, t, n)), Ol = (e, t, n = {}) => ti(Tl(e, t, n)), kl = ({ name: e, migrate: t }) => (n) => {
4276
4380
  try {
4277
4381
  let r = t(n);
4278
4382
  return console.log(`${e} migrated: ${n.version} -> ${r.version}`), r;
4279
4383
  } catch (t) {
4280
4384
  throw console.log(`${e} failed to migrate from ${n.version}`), console.error(t), t;
4281
4385
  }
4282
- }, pl = ({ name: e, migrations: t, targetSchema: n, defaultVersion: r, def: i }) => {
4283
- let a = Object.keys(t).sort(cl).pop();
4386
+ }, Al = ({ name: e, migrations: t, targetSchema: n, defaultVersion: r, def: i }) => {
4387
+ let a = Object.keys(t).sort(Tl).pop();
4284
4388
  if (a == null) return (t) => {
4285
4389
  if (t.version ??= r, t.version !== i.version) return console.log(`${e} version ${t.version} is newer than latest version of ${i.version}.
4286
4390
  Returning default instead.
@@ -4293,7 +4397,7 @@ var Yo = /* @__PURE__ */ r({
4293
4397
  };
4294
4398
  let o = Object.keys(t).length, s = !1, c = (n) => {
4295
4399
  try {
4296
- if (o === 0 || ul(n.version, a)) return console.log(s ? `${e} ${n.version} now up to date` : `${e} version ${n.version} is up to date with target version ${i.version}`), n;
4400
+ if (o === 0 || Dl(n.version, a)) return console.log(s ? `${e} ${n.version} now up to date` : `${e} version ${n.version} is up to date with target version ${i.version}`), n;
4297
4401
  let r = t[n.version], l = r(n);
4298
4402
  return s = !0, c(l);
4299
4403
  } catch (t) {
@@ -4309,26 +4413,29 @@ var Yo = /* @__PURE__ */ r({
4309
4413
  return console.log(`${e} failed to parse final result. Exiting with default`), console.error(t), i;
4310
4414
  }
4311
4415
  };
4312
- }, ml = /* @__PURE__ */ r({
4313
- NOTATIONS: () => hl,
4314
- notationZ: () => gl,
4315
- stringifyNumber: () => _l
4316
- }), hl = [
4317
- "standard",
4318
- "scientific",
4319
- "engineering"
4320
- ], gl = t.enum(hl), _l = (e, t, n) => {
4321
- if (Number.isNaN(e)) return "NaN";
4416
+ }, jl = (e, t, n) => {
4417
+ if (typeof e == "bigint" && n === "standard") return t === 0 ? e.toString() : `${e}.${"0".repeat(t)}`;
4418
+ if (typeof e == "bigint" && (e = Number(e)), Number.isNaN(e)) return "NaN";
4322
4419
  if (e === Infinity) return "∞";
4323
4420
  if (e === -Infinity) return "-∞";
4324
4421
  if (n === "standard") return e.toFixed(t);
4325
4422
  if (e === 0) return t === 0 ? "0ᴇ0" : `0.${"0".repeat(t)}ᴇ0`;
4326
4423
  let r;
4327
- return r = n === "scientific" ? Math.floor(Math.log10(Math.abs(e))) : Math.floor(Math.log10(Math.abs(e)) / 3) * 3, `${(e / 10 ** r).toFixed(t)}ᴇ${r}`;
4328
- }, vl = /* @__PURE__ */ r({
4329
- BaseObserver: () => bl,
4330
- Observer: () => yl
4331
- }), yl = class {
4424
+ r = n === "scientific" ? Math.floor(Math.log10(Math.abs(e))) : Math.floor(Math.log10(Math.abs(e)) / 3) * 3;
4425
+ let i = e / 10 ** r, a = n === "scientific" ? 10 : 1e3, o = 10 ** t;
4426
+ return Math.round(Math.abs(i) * o) / o >= a && (r += n === "scientific" ? 1 : 3, i = e / 10 ** r), `${i.toFixed(t)}ᴇ${r}`;
4427
+ }, Ml = [
4428
+ "standard",
4429
+ "scientific",
4430
+ "engineering"
4431
+ ], Nl = t.enum(Ml), Pl = /* @__PURE__ */ r({
4432
+ NOTATIONS: () => Ml,
4433
+ notationZ: () => Nl,
4434
+ stringifyNumber: () => jl
4435
+ }), Fl = /* @__PURE__ */ r({}), Il = /* @__PURE__ */ r({
4436
+ BaseObserver: () => Rl,
4437
+ Observer: () => Ll
4438
+ }), Ll = class {
4332
4439
  handlers;
4333
4440
  transform;
4334
4441
  closer;
@@ -4353,7 +4460,7 @@ var Yo = /* @__PURE__ */ r({
4353
4460
  async close() {
4354
4461
  return await this.closer?.();
4355
4462
  }
4356
- }, bl = class {
4463
+ }, Rl = class {
4357
4464
  handlers;
4358
4465
  constructor(e) {
4359
4466
  this.handlers = e ?? /* @__PURE__ */ new Map();
@@ -4364,66 +4471,66 @@ var Yo = /* @__PURE__ */ r({
4364
4471
  notify(e) {
4365
4472
  this.handlers.forEach((t, n) => n(e));
4366
4473
  }
4367
- }, xl = /* @__PURE__ */ r({}), Sl = /* @__PURE__ */ r({
4368
- entries: () => Tl,
4369
- keyZ: () => Cl,
4370
- map: () => El,
4371
- nullishToEmpty: () => kl,
4372
- omit: () => Ol,
4373
- purgeUndefined: () => Dl,
4374
- unknownZ: () => wl
4375
- }), Cl = t.union([t.string(), t.number()]), wl = () => t.record(Cl, t.unknown()), Tl = (e) => Object.entries(e), El = (e, t) => Object.fromEntries(Tl(e).map(([e, n]) => [e, t(n, e)])), Dl = (e) => Object.fromEntries(Tl(e).filter(([e, t]) => t !== void 0)), Ol = (e, ...t) => {
4474
+ }, zl = /* @__PURE__ */ r({}), Bl = /* @__PURE__ */ r({
4475
+ entries: () => Ul,
4476
+ keyZ: () => Vl,
4477
+ map: () => Wl,
4478
+ nullishToEmpty: () => ql,
4479
+ omit: () => Kl,
4480
+ purgeUndefined: () => Gl,
4481
+ unknownZ: () => Hl
4482
+ }), Vl = t.union([t.string(), t.number()]), Hl = () => t.record(Vl, t.unknown()), Ul = (e) => Object.entries(e), Wl = (e, t) => Object.fromEntries(Ul(e).map(([e, n]) => [e, t(n, e)])), Gl = (e) => Object.fromEntries(Ul(e).filter(([e, t]) => t !== void 0)), Kl = (e, ...t) => {
4376
4483
  let n = { ...e };
4377
4484
  for (let e of t) delete n[e];
4378
4485
  return n;
4379
- }, kl = () => t.union([t.union([t.null(), t.undefined()]).transform(() => ({})), wl()]), Al = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", jl = Al(), Ml = [
4486
+ }, ql = ((e, n) => e === void 0 || n === void 0 ? t.union([t.null().transform(() => ({})), Hl()]).default(() => ({})) : t.union([t.null().transform(() => ({})), t.record(e, n)]).default(() => ({}))), Jl = /* @__PURE__ */ r({}), Yl = () => typeof process < "u" && process.versions != null && process.versions.node != null ? "node" : typeof window > "u" || window.document === void 0 ? "webworker" : "browser", Xl = Yl(), Zl = [
4380
4487
  "macOS",
4381
4488
  "Windows",
4382
4489
  "Linux"
4383
- ], Nl = [
4490
+ ], Ql = [
4384
4491
  "macos",
4385
4492
  "windows",
4386
4493
  "linux"
4387
- ], Pl = {
4494
+ ], $l = {
4388
4495
  macos: "macOS",
4389
4496
  windows: "Windows",
4390
4497
  linux: "Linux"
4391
- }, Fl = t.enum(Ml).or(t.enum(Nl).transform((e) => Pl[e])), Il = () => {
4498
+ }, eu = t.enum(Zl).or(t.enum(Ql).transform((e) => $l[e])), tu = () => {
4392
4499
  if (typeof window > "u") return;
4393
4500
  let e = window.navigator.userAgent.toLowerCase();
4394
4501
  if (e.includes("mac")) return "macOS";
4395
4502
  if (e.includes("win")) return "Windows";
4396
4503
  if (e.includes("linux")) return "Linux";
4397
- }, Ll, Rl = ((e = {}) => {
4504
+ }, nu, ru = ((e = {}) => {
4398
4505
  let { force: t, default: n } = e;
4399
- return t ?? Ll ?? (Ll = Il(), Ll ?? n);
4400
- }), zl = /* @__PURE__ */ r({
4401
- OPERATING_SYSTEMS: () => Ml,
4402
- RUNTIME: () => jl,
4403
- detect: () => Al,
4404
- getOS: () => Rl,
4405
- osZ: () => Fl
4406
- }), Bl = /* @__PURE__ */ r({
4407
- flushMicrotasks: () => Vl,
4408
- flushTaskQueue: () => Hl
4409
- }), Vl = () => Promise.resolve(), Hl = () => new Promise((e) => setTimeout(e, 0)), Ul = /* @__PURE__ */ r({ copy: () => Wl }), Wl = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e ? { ...e } : e, Gl = t.object({
4506
+ return t ?? nu ?? (nu = tu(), nu ?? n);
4507
+ }), iu = /* @__PURE__ */ r({
4508
+ OPERATING_SYSTEMS: () => Zl,
4509
+ RUNTIME: () => Xl,
4510
+ detect: () => Yl,
4511
+ getOS: () => ru,
4512
+ osZ: () => eu
4513
+ }), au = /* @__PURE__ */ r({
4514
+ flushMicrotasks: () => ou,
4515
+ flushTaskQueue: () => su
4516
+ }), ou = () => Promise.resolve(), su = () => new Promise((e) => setTimeout(e, 0)), cu = /* @__PURE__ */ r({ copy: () => lu }), lu = (e) => Array.isArray(e) ? [...e] : typeof e == "object" && e ? { ...e } : e, uu = t.object({
4410
4517
  message: t.string().optional(),
4411
4518
  description: t.string().optional(),
4412
- details: wl().optional()
4413
- }), Kl = (e) => "toStatus" in e && typeof e.toStatus == "function", ql = (e) => {
4414
- if (!Kl(e)) return;
4519
+ details: Hl().optional()
4520
+ }), du = (e) => "toStatus" in e && typeof e.toStatus == "function", fu = (e) => {
4521
+ if (!du(e)) return;
4415
4522
  let t;
4416
4523
  try {
4417
4524
  t = e.toStatus();
4418
4525
  } catch {
4419
4526
  return;
4420
4527
  }
4421
- let n = Gl.safeParse(t);
4528
+ let n = uu.safeParse(t);
4422
4529
  return n.success ? n.data : void 0;
4423
- }, Jl = t.object({
4530
+ }, pu = t.object({
4424
4531
  stack: t.string(),
4425
4532
  error: t.instanceof(Error)
4426
- }).and(wl()), Yl = (e, t) => {
4533
+ }).and(Hl()), mu = (e, t) => {
4427
4534
  if (!(e instanceof Error)) throw e;
4428
4535
  let n = {
4429
4536
  variant: "error",
@@ -4433,24 +4540,27 @@ var Yo = /* @__PURE__ */ r({
4433
4540
  stack: e.stack ?? "",
4434
4541
  error: e
4435
4542
  }
4436
- }, r = ql(e);
4543
+ }, r = fu(e);
4437
4544
  return r != null && (t != null && r.message != null ? n.message = `${t}: ${r.message}` : r.message != null && (n.message = r.message), r.description != null && (n.description = r.description), r.details != null && n.details != null && (n.details = {
4438
4545
  ...n.details,
4439
4546
  ...r.details
4440
- })), Xl(n);
4441
- }, Xl = (e) => ({
4442
- key: ei(),
4443
- time: E.now(),
4547
+ })), gu(n);
4548
+ }, hu = (e) => {
4549
+ let t = e.details.error, n = Error(e.message, { cause: e });
4550
+ return n.name = t.name, n.stack = t.stack, n;
4551
+ }, gu = (e) => ({
4552
+ key: hi(),
4553
+ time: O.now(),
4444
4554
  name: "",
4445
4555
  ...e
4446
- }), Zl = (e, t = []) => {
4556
+ }), _u = (e, t = []) => {
4447
4557
  if (e != null) return Array.isArray(t) ? t.includes(e) ? e : void 0 : t === e ? e : void 0;
4448
- }, Ql = (e, t = []) => {
4558
+ }, vu = (e, t = []) => {
4449
4559
  if (e != null) return Array.isArray(t) ? t.includes(e) ? void 0 : e : t === e ? void 0 : e;
4450
- }, $l = {
4560
+ }, yu = {
4451
4561
  includeTimestamp: !1,
4452
4562
  includeName: !0
4453
- }, eu = (e) => {
4563
+ }, bu = (e) => {
4454
4564
  if (e.includes("\n")) return `Description:\n${e}`;
4455
4565
  try {
4456
4566
  let t = JSON.parse(e);
@@ -4458,71 +4568,72 @@ var Yo = /* @__PURE__ */ r({
4458
4568
  } catch {
4459
4569
  return `Description: ${e}`;
4460
4570
  }
4461
- }, tu = (e, t = {}) => {
4571
+ }, xu = (e, t = {}) => {
4462
4572
  let n = {
4463
- ...$l,
4573
+ ...yu,
4464
4574
  ...t
4465
4575
  }, r = [], i = e.variant.toUpperCase();
4466
- if (n.includeName && at(e.name) && (i += ` [${e.name}]`), i += `: ${e.message}`, n.includeTimestamp && (i += ` (${e.time.toString("dateTime", "local")})`), r.push(i), e.description != null && r.push(eu(e.description)), "details" in e && g(e.details)) {
4576
+ if (n.includeName && ot(e.name) && (i += ` [${e.name}]`), i += `: ${e.message}`, n.includeTimestamp && (i += ` (${e.time.toString("dateTime", "local")})`), r.push(i), e.description != null && r.push(bu(e.description)), "details" in e && _(e.details)) {
4467
4577
  let t = e.details;
4468
4578
  "stack" in t && typeof t.stack == "string" && t.stack !== "" && r.push(`Stack Trace:\n${t.stack}`);
4469
4579
  let n = Object.fromEntries(Object.entries(t).filter(([e]) => e !== "stack" && e !== "error"));
4470
4580
  Object.keys(n).length > 0 && r.push(`Details:\n${JSON.stringify(n, null, 2)}`);
4471
4581
  }
4472
4582
  return r.join("\n\n");
4473
- }, nu = [
4583
+ }, Su = [
4474
4584
  "success",
4475
4585
  "info",
4476
4586
  "warning",
4477
4587
  "error",
4478
4588
  "loading",
4479
4589
  "disabled"
4480
- ], ru = t.enum(nu), iu = t.literal("success"), au = t.literal("info"), ou = t.literal("warning"), su = t.literal("error"), cu = t.literal("loading"), lu = t.literal("disabled"), uu = ({ details: e, v: n } = {}) => t.object({
4481
- key: t.string().default(() => ei()),
4590
+ ], Cu = t.enum(Su), wu = t.literal("success"), Tu = t.literal("info"), Eu = t.literal("warning"), Du = t.literal("error"), Ou = t.literal("loading"), ku = t.literal("disabled"), Au = ({ details: e, v: n } = {}) => t.object({
4591
+ key: t.string().default(() => hi()),
4482
4592
  name: t.string().default(""),
4483
- variant: n ?? ru,
4593
+ variant: n ?? Cu,
4484
4594
  message: t.string(),
4485
4595
  description: t.string().optional(),
4486
- time: Cr.default(() => E.now()),
4596
+ time: Ir.default(() => O.now()),
4487
4597
  details: e ?? t.unknown().optional(),
4488
- labels: pe(Qc.array())
4489
- }), du = ({ details: e, v: t } = {}) => uu({
4598
+ labels: fe(hl.array())
4599
+ }), ju = ({ details: e, v: t } = {}) => Au({
4490
4600
  details: e,
4491
4601
  v: t
4492
4602
  }).partial({
4493
4603
  key: !0,
4494
4604
  name: !0,
4495
4605
  time: !0
4496
- }), fu = /* @__PURE__ */ r({
4497
- VARIANTS: () => nu,
4498
- create: () => Xl,
4499
- disabledVariantZ: () => lu,
4500
- errorVariantZ: () => su,
4501
- exceptionDetailsSchema: () => Jl,
4502
- fromException: () => Yl,
4503
- infoVariantZ: () => au,
4504
- keepVariants: () => Zl,
4505
- loadingVariantZ: () => cu,
4506
- newZ: () => du,
4507
- removeVariants: () => Ql,
4508
- statusZ: () => uu,
4509
- successVariantZ: () => iu,
4510
- toString: () => tu,
4511
- variantZ: () => ru,
4512
- warningVariantZ: () => ou
4513
- }), pu = (e, t) => {
4606
+ }), Mu = /* @__PURE__ */ r({
4607
+ VARIANTS: () => Su,
4608
+ create: () => gu,
4609
+ disabledVariantZ: () => ku,
4610
+ errorVariantZ: () => Du,
4611
+ exceptionDetailsSchema: () => pu,
4612
+ fromException: () => mu,
4613
+ infoVariantZ: () => Tu,
4614
+ keepVariants: () => _u,
4615
+ loadingVariantZ: () => Ou,
4616
+ newZ: () => ju,
4617
+ removeVariants: () => vu,
4618
+ statusZ: () => Au,
4619
+ successVariantZ: () => wu,
4620
+ toError: () => hu,
4621
+ toString: () => xu,
4622
+ variantZ: () => Cu,
4623
+ warningVariantZ: () => Eu
4624
+ }), Nu = (e, t) => {
4514
4625
  if (!t.has(e)) return e;
4515
4626
  let n, r, i = e;
4516
4627
  for (; t.has(i);) {
4517
- let e = i.match(mu);
4628
+ let e = i.match(Pu);
4518
4629
  e ? (n = i.slice(0, e.index).trim(), r = parseInt(e[1], 10) + 1) : (n = i, r = 1), i = `${n} (${r})`;
4519
4630
  }
4520
4631
  return i;
4521
- }, mu = /\((\d+)\)$/, hu = (e, t = "") => {
4632
+ }, Pu = /\((\d+)\)$/, Fu = (e, t = "") => {
4522
4633
  if (typeof e == "string") return e;
4523
4634
  let n = e.length;
4524
4635
  return n === 0 ? t : n === 1 ? e[0] : n === 2 ? `${e[0]} and ${e[1]}` : `${e.slice(0, -1).join(", ")}, and ${e[n - 1]}`;
4525
- }, gu = (e) => {
4636
+ }, Iu = (e) => {
4526
4637
  let t = e.split(" "), n = /* @__PURE__ */ new Set(), r = t.map((e) => e.charAt(0).toLowerCase()).join("");
4527
4638
  n.add(r.replace(/-/g, "_")), n.add(r.replace(/(.)(.)/g, "$1_$2").replace(/-/g, "_"));
4528
4639
  let i = /\d+/g;
@@ -4534,13 +4645,13 @@ var Yo = /* @__PURE__ */ r({
4534
4645
  });
4535
4646
  let a = t.map((e) => (e.length > 3 ? e.substring(0, 3) : e).toLowerCase());
4536
4647
  return n.add(a.join("").replace(/-/g, "_")), n.add(a.join("_").replace(/-/g, "_")), Array.from(n).filter((e) => e.length >= 2 && e.length <= 12 && !/^\d/.test(e));
4537
- }, _u = (e, t) => e.startsWith(t) ? e.slice(t.length) : e, vu = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), yu = /* @__PURE__ */ r({
4538
- createShortIdentifiers: () => gu,
4539
- deduplicateFileName: () => pu,
4540
- escapeHTML: () => vu,
4541
- naturalLanguageJoin: () => hu,
4542
- trimPrefix: () => _u
4543
- }), bu = /* @__PURE__ */ Error("request for lock canceled"), xu = function(e, t, n, r) {
4648
+ }, Lu = (e, t) => e.startsWith(t) ? e.slice(t.length) : e, Ru = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), zu = /* @__PURE__ */ r({
4649
+ createShortIdentifiers: () => Iu,
4650
+ deduplicateFileName: () => Nu,
4651
+ escapeHTML: () => Ru,
4652
+ naturalLanguageJoin: () => Fu,
4653
+ trimPrefix: () => Lu
4654
+ }), Bu = /* @__PURE__ */ Error("request for lock canceled"), Vu = function(e, t, n, r) {
4544
4655
  function i(e) {
4545
4656
  return e instanceof n ? e : new n(function(t) {
4546
4657
  t(e);
@@ -4566,8 +4677,8 @@ var Yo = /* @__PURE__ */ r({
4566
4677
  }
4567
4678
  c((r = r.apply(e, t || [])).next());
4568
4679
  });
4569
- }, Su = class {
4570
- constructor(e, t = bu) {
4680
+ }, Hu = class {
4681
+ constructor(e, t = Bu) {
4571
4682
  this._value = e, this._cancelError = t, this._queue = [], this._weightedWaiters = [];
4572
4683
  }
4573
4684
  acquire(e = 1, t = 0) {
@@ -4578,12 +4689,12 @@ var Yo = /* @__PURE__ */ r({
4578
4689
  reject: r,
4579
4690
  weight: e,
4580
4691
  priority: t
4581
- }, a = wu(this._queue, (e) => t <= e.priority);
4692
+ }, a = Wu(this._queue, (e) => t <= e.priority);
4582
4693
  a === -1 && e <= this._value ? this._dispatchItem(i) : this._queue.splice(a + 1, 0, i);
4583
4694
  });
4584
4695
  }
4585
4696
  runExclusive(e) {
4586
- return xu(this, arguments, void 0, function* (e, t = 1, n = 0) {
4697
+ return Vu(this, arguments, void 0, function* (e, t = 1, n = 0) {
4587
4698
  let [r, i] = yield this.acquire(t, n);
4588
4699
  try {
4589
4700
  return yield e(r);
@@ -4595,7 +4706,7 @@ var Yo = /* @__PURE__ */ r({
4595
4706
  waitForUnlock(e = 1, t = 0) {
4596
4707
  if (e <= 0) throw Error(`invalid weight ${e}: must be positive`);
4597
4708
  return this._couldLockImmediately(e, t) ? Promise.resolve() : new Promise((n) => {
4598
- this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), Cu(this._weightedWaiters[e - 1], {
4709
+ this._weightedWaiters[e - 1] || (this._weightedWaiters[e - 1] = []), Uu(this._weightedWaiters[e - 1], {
4599
4710
  resolve: n,
4600
4711
  priority: t
4601
4712
  });
@@ -4649,15 +4760,15 @@ var Yo = /* @__PURE__ */ r({
4649
4760
  return (this._queue.length === 0 || this._queue[0].priority < t) && e <= this._value;
4650
4761
  }
4651
4762
  };
4652
- function Cu(e, t) {
4653
- let n = wu(e, (e) => t.priority <= e.priority);
4763
+ function Uu(e, t) {
4764
+ let n = Wu(e, (e) => t.priority <= e.priority);
4654
4765
  e.splice(n + 1, 0, t);
4655
4766
  }
4656
- function wu(e, t) {
4767
+ function Wu(e, t) {
4657
4768
  for (let n = e.length - 1; n >= 0; n--) if (t(e[n])) return n;
4658
4769
  return -1;
4659
4770
  }
4660
- var Tu = function(e, t, n, r) {
4771
+ var Gu = function(e, t, n, r) {
4661
4772
  function i(e) {
4662
4773
  return e instanceof n ? e : new n(function(t) {
4663
4774
  t(e);
@@ -4683,12 +4794,12 @@ var Tu = function(e, t, n, r) {
4683
4794
  }
4684
4795
  c((r = r.apply(e, t || [])).next());
4685
4796
  });
4686
- }, Eu = class {
4797
+ }, Ku = class {
4687
4798
  constructor(e) {
4688
- this._semaphore = new Su(1, e);
4799
+ this._semaphore = new Hu(1, e);
4689
4800
  }
4690
4801
  acquire() {
4691
- return Tu(this, arguments, void 0, function* (e = 0) {
4802
+ return Gu(this, arguments, void 0, function* (e = 0) {
4692
4803
  let [, t] = yield this._semaphore.acquire(1, e);
4693
4804
  return t;
4694
4805
  });
@@ -4708,26 +4819,74 @@ var Tu = function(e, t, n, r) {
4708
4819
  cancel() {
4709
4820
  return this._semaphore.cancel();
4710
4821
  }
4711
- }, Du = /* @__PURE__ */ r({
4712
- mutex: () => Ou,
4713
- newMutex: () => ku
4714
- }), Ou = class extends Eu {
4822
+ }, qu = /* @__PURE__ */ r({
4823
+ mutex: () => Ju,
4824
+ newMutex: () => Yu
4825
+ }), Ju = class extends Ku {
4715
4826
  constructor(e) {
4716
4827
  super(), Object.assign(this, e);
4717
4828
  }
4718
- }, ku = (e) => new Ou(e), Au = /* @__PURE__ */ r({
4719
- expectAlways: () => Mu,
4720
- toString: () => ju
4721
- }), ju = (e) => JSON.stringify(e, (e, t) => typeof t == "bigint" ? t.toString() : t), Mu = async (e, t = 200, n = 20) => {
4829
+ }, Yu = (e) => new Ju(e), Xu = /* @__PURE__ */ r({
4830
+ expectAlways: () => Qu,
4831
+ toString: () => Zu
4832
+ }), Zu = (e) => JSON.stringify(e, (e, t) => typeof t == "bigint" ? t.toString() : t), Qu = async (e, t = 200, n = 20) => {
4722
4833
  let r = Date.now();
4723
4834
  for (; Date.now() - r < t;) await e(), await new Promise((e) => setTimeout(e, n));
4724
- }, Nu = (...e) => e.map(Pu).join(""), Pu = (e) => (e.endsWith("/") || (e += "/"), e.startsWith("/") && (e = e.slice(1)), e), Fu = (e) => e.endsWith("/") ? e.slice(0, -1) : e, Iu = (e, t = "") => e === null ? "" : `?${Object.entries(e).filter(([, e]) => e == null ? !1 : Array.isArray(e) ? e.length > 0 : !0).map(([e, n]) => `${t}${e}=${n}`).join("&")}`, Lu = class e {
4835
+ }, $u = [
4836
+ "h1",
4837
+ "h2",
4838
+ "h3",
4839
+ "h4",
4840
+ "h5",
4841
+ "p",
4842
+ "small"
4843
+ ], ed = t.enum($u), td = (e) => {
4844
+ let t = $u.indexOf(e);
4845
+ return t === -1 || t === $u.length - 1 ? e : $u[t + 1];
4846
+ }, nd = t.union([t.number(), t.enum([
4847
+ "normal",
4848
+ "bold",
4849
+ "bolder",
4850
+ "lighter"
4851
+ ])]), rd = t.object({
4852
+ size: t.number(),
4853
+ weight: t.union([t.number(), t.string()]),
4854
+ lineHeight: t.number(),
4855
+ textTransform: t.string().optional()
4856
+ }), id = /* @__PURE__ */ r({
4857
+ LEVELS: () => $u,
4858
+ downLevel: () => td,
4859
+ levelZ: () => ed,
4860
+ specZ: () => rd,
4861
+ weightZ: () => nd
4862
+ }), ad = (e, t) => {
4863
+ let n = new k(t);
4864
+ if (n.valueOf() <= 0) return e;
4865
+ let r, i = O.MIN, a = null, o = () => {
4866
+ if (a === null) return;
4867
+ i = O.now();
4868
+ let t = a;
4869
+ a = null, e(...t);
4870
+ };
4871
+ return (...e) => {
4872
+ let t = O.since(i);
4873
+ a = e;
4874
+ let s = n.sub(t);
4875
+ if (s.valueOf() <= 0 || s.greaterThan(n)) {
4876
+ clearTimeout(r), r = void 0, o();
4877
+ return;
4878
+ }
4879
+ r ??= setTimeout(() => {
4880
+ r = void 0, o();
4881
+ }, s.milliseconds);
4882
+ };
4883
+ }, od = (...e) => e.map(sd).join(""), sd = (e) => (e.endsWith("/") || (e += "/"), e.startsWith("/") && (e = e.slice(1)), e), cd = (e) => e.endsWith("/") ? e.slice(0, -1) : e, ld = (e, t = "") => e === null ? "" : `?${Object.entries(e).filter(([, e]) => e == null ? !1 : Array.isArray(e) ? e.length > 0 : !0).map(([e, n]) => `${t}${e}=${n}`).join("&")}`, ud = class e {
4725
4884
  protocol;
4726
4885
  host;
4727
4886
  port;
4728
4887
  path;
4729
4888
  constructor({ host: e, port: t, protocol: n = "", pathPrefix: r = "" }) {
4730
- this.protocol = n, this.host = e, this.port = t, this.path = Pu(r);
4889
+ this.protocol = n, this.host = e, this.port = t, this.path = sd(r);
4731
4890
  }
4732
4891
  replace(t) {
4733
4892
  return new e({
@@ -4740,52 +4899,16 @@ var Tu = function(e, t, n, r) {
4740
4899
  child(t) {
4741
4900
  return new e({
4742
4901
  ...this,
4743
- pathPrefix: Nu(this.path, t)
4902
+ pathPrefix: od(this.path, t)
4744
4903
  });
4745
4904
  }
4746
4905
  toString() {
4747
- return Fu(`${this.protocol}://${this.host}:${this.port}/${this.path}`);
4906
+ return cd(`${this.protocol}://${this.host}:${this.port}/${this.path}`);
4748
4907
  }
4749
4908
  static UNKNOWN = new e({
4750
4909
  host: "unknown",
4751
4910
  port: 0
4752
4911
  });
4753
- }, Ru = class {
4754
- sender;
4755
- handlers;
4756
- constructor(e) {
4757
- this.sender = e, this.handlers = /* @__PURE__ */ new Map();
4758
- }
4759
- handle({ data: e }) {
4760
- let t = this.handlers.get(e.type)?.handler;
4761
- t == null ? console.warn(`No handler for ${e.type}`) : t(e.payload);
4762
- }
4763
- route(e) {
4764
- let t = new Bu(zu(e, this.sender));
4765
- return this.handlers.set(e, t), t;
4766
- }
4767
- }, zu = (e, t) => (n, r) => t({
4768
- type: e,
4769
- payload: n
4770
- }, r), Bu = class {
4771
- _send;
4772
- handler;
4773
- constructor(e) {
4774
- this._send = e, this.handler = null;
4775
- }
4776
- send(e, t = []) {
4777
- this._send(e, t);
4778
- }
4779
- handle(e) {
4780
- this.handler = e;
4781
- }
4782
- }, Vu = () => {
4783
- let e, t;
4784
- return e = new Ru((e) => {
4785
- t.handle({ data: e });
4786
- }), t = new Ru((t) => {
4787
- e.handle({ data: t });
4788
- }), [e, t];
4789
4912
  };
4790
4913
  //#endregion
4791
- export { kr as ClockSkewCalculator, j as DataType, k as Density, fs as MultiSeries, Vi as OUTER_LOCATIONS, O as Rate, Ru as RoutedWorker, is as Series, M as Size, A as TimeRange, D as TimeSpan, E as TimeStamp, Bu as TypedWorker, Lu as URL, u as array, or as binary, vn as bounds, _a as box, ys as breaker, Iu as buildQueryString, d as caseconv, Ss as change, vo as clamp, Sc as color, qr as compare, Nc as control, xr as convertDataType, Vu as createMockWorkers, Pc as csv, Dr as dataTypeZ, Rc as debounce, Me as deep, Bc as destructor, oo as dimensions, ri as direction, Fe as errors, tt as fmt, Yr as id, ti as instance, as as isCrudeSeries, br as isTelemValue, Vc as json, Yc as kv, Xc as label, el as link, fi as location, rl as map, Kn as math, al as migrate, de as narrow, ml as notation, vr as numericTimeRangeZ, vl as observe, xl as optional, Hi as outerLocationZ, nt as primitive, Tr as rateZ, Sl as record, zl as runtime, yo as scale, Bl as scheduler, Ul as shallow, Er as sizeZ, _s as sleep, Ao as spatial, fu as status, jo as sticky, yu as strings, Du as sync, gs as telem, Au as testutil, zc as throttle, Or as timeRangeBoundedZ, Sr as timeRangeZ, wr as timeSpanZ, Cr as timeStampZ, yr as typedArrayZ, Ar as unique, Yo as uuid, Ui as xy, I as xyZ, ar as zod };
4914
+ export { Hr as ClockSkewCalculator, N as DataType, j as Density, ws as MultiSeries, A as Rate, gs as Series, P as Size, Os as TIMESTAMP_FORMATS, As as TIME_ZONES, M as TimeRange, k as TimeSpan, O as TimeStamp, ud as URL, u as array, yr as binary, jn as bounds, ja as box, Fs as breaker, ld as buildQueryString, d as caseconv, Rs as change, Mo as clamp, Rc as color, ci as compare, Yc as control, Pr as convertDataType, Xc as csv, Br as dataTypeZ, tl as debounce, ke as deep, nl as destructor, xo as dimensions, vi as direction, Me as errors, tt as fmt, ui as id, gi as instance, _s as isCrudeSeries, Nr as isTelemValue, il as json, fl as kv, pl as label, _l as link, Di as location, bl as map, ar as math, Sl as migrate, ue as narrow, Pl as notation, Fl as numeric, jr as numericTimeRangeZ, Il as observe, zl as optional, nt as primitive, Rr as rateZ, Bl as record, Jl as require, iu as runtime, No as scale, au as scheduler, cu as shallow, zr as sizeZ, Ns as sleep, Xt as spatial, Mu as status, Wo as sticky, zu as strings, qu as sync, Ms as telem, Xu as testutil, id as text, ad as throttle, Vr as timeRangeBoundedZ, Fr as timeRangeZ, Lr as timeSpanZ, Ir as timeStampZ, js as timeZoneZ, ks as timestampFormatZ, Mr as typedArrayZ, Ur as unique, os as uuid, ra as xy, vr as zod };