@solarpunkltd/swarm-chat-js 6.2.2 → 6.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -109,7 +109,7 @@ var di = {};
109
109
  }
110
110
  async function u(e, t = 1) {
111
111
  const n = As(e, t), s = [], o = n.map(async (d) => {
112
- for (const f of d) s.push(await f());
112
+ for (const h of d) s.push(await h());
113
113
  });
114
114
  return await Promise.all(o), s;
115
115
  }
@@ -120,7 +120,7 @@ var di = {};
120
120
  }, e)
121
121
  );
122
122
  }
123
- function h(e, t = Math.random) {
123
+ function f(e, t = Math.random) {
124
124
  for (let n = e.length - 1; n > 0; n--) {
125
125
  const s = Math.floor(t() * (n + 1)), o = e[n];
126
126
  e[n] = e[s], e[s] = o;
@@ -169,7 +169,7 @@ var di = {};
169
169
  return !0;
170
170
  }
171
171
  function Oe(e, t, n = Math.random) {
172
- return h(Jn(0, e.length - 1), n).slice(0, t);
172
+ return f(Jn(0, e.length - 1), n).slice(0, t);
173
173
  }
174
174
  function Jt(e, t) {
175
175
  return e.map((n) => n[t]);
@@ -218,17 +218,17 @@ var di = {};
218
218
  const o = [];
219
219
  for (; o.length < t; ) {
220
220
  const d = Yt(e, s);
221
- o.some((f) => n(f, d)) || o.push(d);
221
+ o.some((h) => n(h, d)) || o.push(d);
222
222
  }
223
223
  return o;
224
224
  }
225
225
  function Ri(e, t, n, s, o, d = Math.random) {
226
- const f = e.filter((m) => m !== t && m !== n), v = [];
227
- for (t !== null && v.push(t); f.length && v.length < s; ) {
228
- const m = a.Random.intBetween(0, f.length - 1, d);
229
- o(f[m], v) && v.push(f[m]), f.splice(m, 1);
226
+ const h = e.filter((m) => m !== t && m !== n), v = [];
227
+ for (t !== null && v.push(t); h.length && v.length < s; ) {
228
+ const m = a.Random.intBetween(0, h.length - 1, d);
229
+ o(h[m], v) && v.push(h[m]), h.splice(m, 1);
230
230
  }
231
- return h(v, d), { values: v, indexOfGuaranteed: t !== null ? v.indexOf(t) : -1 };
231
+ return f(v, d), { values: v, indexOfGuaranteed: t !== null ? v.indexOf(t) : -1 };
232
232
  }
233
233
  function qe(e) {
234
234
  if (!e.length) throw Error("Received empty array");
@@ -242,7 +242,7 @@ var di = {};
242
242
  }
243
243
  function Ni(e, t, n) {
244
244
  if (n === void 0 && (n = Math.random()), e.length !== t.length) throw new Error("Array length mismatch");
245
- let s = t.reduce((d, f) => d + f, 0);
245
+ let s = t.reduce((d, h) => d + h, 0);
246
246
  const o = n * s;
247
247
  for (let d = 0; d < e.length - 1; d++) if (s -= t[d], o >= s) return e[d];
248
248
  return qe(e);
@@ -250,7 +250,7 @@ var di = {};
250
250
  function ji(e, t, n = Math.random) {
251
251
  const s = t.map((d) => n() * d), o = [];
252
252
  for (let d = 0; d < e.length; d++) o.push([e[d], s[d]]);
253
- return o.sort((d, f) => f[1] - d[1]).map((d) => d[0]);
253
+ return o.sort((d, h) => h[1] - d[1]).map((d) => d[0]);
254
254
  }
255
255
  function ye(e, t) {
256
256
  if (e == null) return null;
@@ -266,7 +266,7 @@ var di = {};
266
266
  const s = t.split(/\.|\[/);
267
267
  let o = e;
268
268
  for (let d = 0; d < s.length; d++) {
269
- const f = s[d], v = d < s.length - 1 && s[d + 1].includes("]"), m = f.includes("]") ? f.replace(/\[|\]/g, "") : f;
269
+ const h = s[d], v = d < s.length - 1 && s[d + 1].includes("]"), m = h.includes("]") ? h.replace(/\[|\]/g, "") : h;
270
270
  if (d === s.length - 1) return o[m] = n, n;
271
271
  ce(o[m]) || (v ? o[m] = [] : o[m] = {}), o = o[m];
272
272
  }
@@ -333,7 +333,7 @@ var di = {};
333
333
  return "#" + e.map((t) => t.toString(16).padStart(2, "0")).join("");
334
334
  }
335
335
  function qi(e, t, n, s) {
336
- const o = e * Math.PI / 180, d = n * Math.PI / 180, f = (n - e) * Math.PI / 180, v = (s - t) * Math.PI / 180, m = Math.sin(f / 2) * Math.sin(f / 2) + Math.cos(o) * Math.cos(d) * Math.sin(v / 2) * Math.sin(v / 2);
336
+ const o = e * Math.PI / 180, d = n * Math.PI / 180, h = (n - e) * Math.PI / 180, v = (s - t) * Math.PI / 180, m = Math.sin(h / 2) * Math.sin(h / 2) + Math.cos(o) * Math.cos(d) * Math.sin(v / 2) * Math.sin(v / 2);
337
337
  return 6371e3 * (2 * Math.atan2(Math.sqrt(m), Math.sqrt(1 - m)));
338
338
  }
339
339
  function St(e, t) {
@@ -810,12 +810,12 @@ var di = {};
810
810
  const t = /\{(.+?)\}/, n = e.match(t);
811
811
  if (!n || !n.index) return [e];
812
812
  const s = n[1].split(","), o = e.slice(0, n.index), d = e.slice(n.index + n[0].length);
813
- let f = [];
813
+ let h = [];
814
814
  for (const v of s) {
815
815
  const m = Xn(o + v + d);
816
- f = f.concat(m);
816
+ h = h.concat(m);
817
817
  }
818
- return f;
818
+ return h;
819
819
  }
820
820
  function Je(e) {
821
821
  return e.split(
@@ -1039,21 +1039,21 @@ var di = {};
1039
1039
  function ls(e, t) {
1040
1040
  const n = "=", s = t.length;
1041
1041
  let o = 0, d = 0;
1042
- const f = [];
1042
+ const h = [];
1043
1043
  for (let v = 0; v < e.length; v++) {
1044
1044
  const m = e[v];
1045
1045
  if (m === n) break;
1046
1046
  const x = t.indexOf(m);
1047
1047
  if (x === -1) throw new Error(`Invalid character: ${m}`);
1048
- d = d << Math.log2(s) | x, o += Math.log2(s), o >= 8 && (o -= 8, f.push(d >> o & 255));
1048
+ d = d << Math.log2(s) | x, o += Math.log2(s), o >= 8 && (o -= 8, h.push(d >> o & 255));
1049
1049
  }
1050
- return new Uint8Array(f);
1050
+ return new Uint8Array(h);
1051
1051
  }
1052
1052
  function ds(e, t) {
1053
1053
  const n = t.length;
1054
1054
  let s = 0, o = 0, d = "";
1055
- for (let f = 0; f < e.length; f++)
1056
- for (o = o << 8 | e[f], s += 8; s >= Math.log2(n); ) s -= Math.log2(n), d += t[o >> s & n - 1];
1055
+ for (let h = 0; h < e.length; h++)
1056
+ for (o = o << 8 | e[h], s += 8; s >= Math.log2(n); ) s -= Math.log2(n), d += t[o >> s & n - 1];
1057
1057
  return s > 0 && (d += t[o << Math.log2(n) - s & n - 1]), d.length % 4 !== 0 && (d += "=".repeat(4 - d.length % 4)), d;
1058
1058
  }
1059
1059
  function Co(e) {
@@ -1073,9 +1073,9 @@ var di = {};
1073
1073
  if (n.length !== s.length) return null;
1074
1074
  const o = {};
1075
1075
  for (let d = 0; d < n.length; d++) {
1076
- const f = n[d];
1077
- if (f.startsWith(":")) o[f.slice(1)] = s[d];
1078
- else if (f !== s[d]) return null;
1076
+ const h = n[d];
1077
+ if (h.startsWith(":")) o[h.slice(1)] = s[d];
1078
+ else if (h !== s[d]) return null;
1079
1079
  }
1080
1080
  return o;
1081
1081
  }
@@ -1086,23 +1086,23 @@ var di = {};
1086
1086
  }
1087
1087
  function Do(e, t, n, s = Math.random) {
1088
1088
  const o = a.Arrays.shuffle(
1089
- t.map((f) => ({
1089
+ t.map((h) => ({
1090
1090
  variants: a.Arrays.shuffle(
1091
- f.variants.map((v) => v),
1091
+ h.variants.map((v) => v),
1092
1092
  s
1093
1093
  ),
1094
- avoid: f.avoid
1094
+ avoid: h.avoid
1095
1095
  })),
1096
1096
  s
1097
1097
  ), d = [];
1098
- for (const f of o) {
1099
- const v = f.variants.filter((x) => x !== f.avoid), m = v.find((x) => e.includes(x));
1098
+ for (const h of o) {
1099
+ const v = h.variants.filter((x) => x !== h.avoid), m = v.find((x) => e.includes(x));
1100
1100
  if (m && (It(d, lr(e, m, v)), d.length >= n)) break;
1101
1101
  }
1102
1102
  if (d.length < n)
1103
- for (const f of o) {
1104
- const v = f.variants.find((m) => e.includes(m));
1105
- if (v && (It(d, lr(e, v, f.variants)), d.length >= n)) break;
1103
+ for (const h of o) {
1104
+ const v = h.variants.find((m) => e.includes(m));
1105
+ if (v && (It(d, lr(e, v, h.variants)), d.length >= n)) break;
1106
1106
  }
1107
1107
  return d.slice(0, n);
1108
1108
  }
@@ -1129,8 +1129,8 @@ var di = {};
1129
1129
  function Lo(e, t, n = {}) {
1130
1130
  const s = [];
1131
1131
  let o = "", d = 0;
1132
- for (let f = 0; f < e.length; f++) {
1133
- const v = e[f], m = n[v] || 1;
1132
+ for (let h = 0; h < e.length; h++) {
1133
+ const v = e[h], m = n[v] || 1;
1134
1134
  if (o += v, d += m, d > t) {
1135
1135
  const { line: x, rest: M } = fs(o);
1136
1136
  s.push(x), o = M, d = M.split("").map((U) => n[U] || 1).reduce((U, je) => U + je, 0);
@@ -1180,8 +1180,8 @@ var di = {};
1180
1180
  if (e[d + t.length + 1] === o)
1181
1181
  if (e[d + t.length + 2] === o) e = e.replace(`${s}${t}${o}${o}`, n);
1182
1182
  else {
1183
- const f = Rt(e, d + t.length + 2, ["_"]);
1184
- e = e.replace(`${s}${t}${o}${f}`, n);
1183
+ const h = Rt(e, d + t.length + 2, ["_"]);
1184
+ e = e.replace(`${s}${t}${o}${h}`, n);
1185
1185
  }
1186
1186
  else e = e.replace(`${s}${t}`, n);
1187
1187
  d = e.indexOf(`${s}${t}`, d + n.length);
@@ -1207,7 +1207,7 @@ var di = {};
1207
1207
  for (; n !== -1; ) {
1208
1208
  const s = is(e, "[", n), o = e.indexOf(")", n);
1209
1209
  if (s !== -1 && o !== -1) {
1210
- const [d, f] = e.slice(s + 1, o).split("]("), v = t(d, f);
1210
+ const [d, h] = e.slice(s + 1, o).split("]("), v = t(d, h);
1211
1211
  e = e.slice(0, s) + v + e.slice(o + 1);
1212
1212
  }
1213
1213
  n = e.indexOf("](", n + 1);
@@ -1232,14 +1232,14 @@ var di = {};
1232
1232
  function Jo(e, t) {
1233
1233
  let n = null, s = -1 / 0;
1234
1234
  for (const [o, d] of Object.entries(e)) {
1235
- const f = t(d);
1236
- f > s && (s = f, n = o);
1235
+ const h = t(d);
1236
+ h > s && (s = h, n = o);
1237
1237
  }
1238
1238
  return n ? [n, e[n]] : null;
1239
1239
  }
1240
1240
  function Ko(e, t, n, s) {
1241
- const o = e.find((f) => f[t] === n), d = e.find((f) => f[t] === n + s);
1242
- o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((f, v) => At(f[t]) - At(v[t])), e.forEach((f, v) => f[t] = v + 1);
1241
+ const o = e.find((h) => h[t] === n), d = e.find((h) => h[t] === n + s);
1242
+ o && d ? (o[t] = n + s, d[t] = n) : o && (o[t] = n + s), e.sort((h, v) => At(h[t]) - At(v[t])), e.forEach((h, v) => h[t] = v + 1);
1243
1243
  }
1244
1244
  function Yo(e) {
1245
1245
  const t = Object.keys(e);
@@ -1257,8 +1257,8 @@ var di = {};
1257
1257
  function ec(e, t = ",", n = '"') {
1258
1258
  const s = [];
1259
1259
  let o = "", d = !1;
1260
- const f = e.split("");
1261
- for (const v of f) v === t && !d ? (s.push(o), o = "") : v === n && (!o && !d || d) ? d = !d : o += v;
1260
+ const h = e.split("");
1261
+ for (const v of h) v === t && !d ? (s.push(o), o = "") : v === n && (!o && !d || d) ? d = !d : o += v;
1262
1262
  return s.push(o), s;
1263
1263
  }
1264
1264
  function tc(e) {
@@ -1369,8 +1369,8 @@ var di = {};
1369
1369
  }
1370
1370
  function vc(e, t, n, s) {
1371
1371
  s || (s = Date.now());
1372
- const o = t / n, d = s - e, f = d / t, v = f * n, m = v - d;
1373
- return { deltaMs: d, progress: o, baseTimeMs: f, totalTimeMs: v, remainingTimeMs: m };
1372
+ const o = t / n, d = s - e, h = d / t, v = h * n, m = v - d;
1373
+ return { deltaMs: d, progress: o, baseTimeMs: h, totalTimeMs: v, remainingTimeMs: m };
1374
1374
  }
1375
1375
  const wc = {
1376
1376
  0: "sunday",
@@ -1469,8 +1469,8 @@ var di = {};
1469
1469
  async function Mc(e, t, n) {
1470
1470
  const s = Date.now(), o = pr[e];
1471
1471
  if (o && o.validUntil > s) return o.value;
1472
- const d = await n(), f = s + t;
1473
- return pr[e] = { value: d, validUntil: f }, d;
1472
+ const d = await n(), h = s + t;
1473
+ return pr[e] = { value: d, validUntil: h }, d;
1474
1474
  }
1475
1475
  function $c(e) {
1476
1476
  delete pr[e];
@@ -1479,9 +1479,9 @@ var di = {};
1479
1479
  return e.filter((t) => t).join("/").replace(new RegExp("(?<!:)\\/+", "g"), "/");
1480
1480
  }
1481
1481
  function Rc(e, t, n, s, o = !0) {
1482
- const d = e.indexOf(t), f = e.indexOf(n, d + t.length);
1483
- if (d === -1 || f === -1) throw Error("Start or end not found");
1484
- return o ? e.substring(0, d + t.length) + s + e.substring(f) : e.substring(0, d) + s + e.substring(f + n.length);
1482
+ const d = e.indexOf(t), h = e.indexOf(n, d + t.length);
1483
+ if (d === -1 || h === -1) throw Error("Start or end not found");
1484
+ return o ? e.substring(0, d + t.length) + s + e.substring(h) : e.substring(0, d) + s + e.substring(h + n.length);
1485
1485
  }
1486
1486
  function Cc(e) {
1487
1487
  let t = "p";
@@ -1545,11 +1545,11 @@ var di = {};
1545
1545
  }
1546
1546
  function Lc(e, t, n, s, o) {
1547
1547
  const d = {};
1548
- for (const f of Object.keys(t)) d[f] = [];
1548
+ for (const h of Object.keys(t)) d[h] = [];
1549
1549
  d[s] = [], o && (e = e.sort(o));
1550
- for (const f of e) {
1551
- const v = f[n], m = t[v] ? v : s;
1552
- d[m].length >= t[m] ? d[s].push(f) : d[m].push(f);
1550
+ for (const h of e) {
1551
+ const v = h[n], m = t[v] ? v : s;
1552
+ d[m].length >= t[m] ? d[s].push(h) : d[m].push(h);
1553
1553
  }
1554
1554
  return d;
1555
1555
  }
@@ -1599,8 +1599,8 @@ var di = {};
1599
1599
  function qc(e, t) {
1600
1600
  const n = (t == null ? void 0 : t.longForm) ?? !1, s = t != null && t.unit ? ` ${t.unit}` : "", o = n ? Wc : Es, d = (t == null ? void 0 : t.precision) ?? 1;
1601
1601
  if (e < le[0]) return `${e}${s}`;
1602
- for (let f = 0; f < le.length - 1; f++)
1603
- if (e < le[f + 1]) return `${(e / le[f]).toFixed(d)}${n ? " " : ""}${o[f]}${s}`;
1602
+ for (let h = 0; h < le.length - 1; h++)
1603
+ if (e < le[h + 1]) return `${(e / le[h]).toFixed(d)}${n ? " " : ""}${o[h]}${s}`;
1604
1604
  return `${(e / le[le.length - 1]).toFixed(d)}${n ? " " : ""}${o[le.length - 1]}${s}`;
1605
1605
  }
1606
1606
  function mr(e) {
@@ -1688,16 +1688,16 @@ var di = {};
1688
1688
  let o = 1;
1689
1689
  const d = [1];
1690
1690
  for (let v = 0; v < n.length - 1; v++) o *= n[v], d.push(o);
1691
- const f = [];
1691
+ const h = [];
1692
1692
  for (let v = 0; v < s; v++) {
1693
1693
  const m = {};
1694
1694
  for (let x = 0; x < t.length; x++) {
1695
1695
  const M = e[t[x]], U = Math.floor(v / d[x]) % M.length;
1696
1696
  m[t[x]] = M[U];
1697
1697
  }
1698
- f.push(m);
1698
+ h.push(m);
1699
1699
  }
1700
- return f;
1700
+ return h;
1701
1701
  }
1702
1702
  function du(e) {
1703
1703
  return Object.values(e).filter((t) => t).length;
@@ -1707,9 +1707,9 @@ var di = {};
1707
1707
  }
1708
1708
  function Nt(e, t, n, s, o) {
1709
1709
  if (!ce(t)) return t;
1710
- for (const [d, f] of Object.entries(t)) {
1710
+ for (const [d, h] of Object.entries(t)) {
1711
1711
  const v = fu(n, d, s);
1712
- Array.isArray(f) ? o ? Nt(e, f, v, !0, o) : e[v] = f.map((m) => Nt(Array.isArray(m) ? [] : {}, m, "", !1, o)) : ce(f) ? Nt(e, f, v, !1, o) : e[v] = f;
1712
+ Array.isArray(h) ? o ? Nt(e, h, v, !0, o) : e[v] = h.map((m) => Nt(Array.isArray(m) ? [] : {}, m, "", !1, o)) : ce(h) ? Nt(e, h, v, !1, o) : e[v] = h;
1713
1713
  }
1714
1714
  return e;
1715
1715
  }
@@ -1769,9 +1769,9 @@ var di = {};
1769
1769
  return Object.values(Ts(e, t));
1770
1770
  }
1771
1771
  function wu(e, t, n, s, o) {
1772
- const d = t ? e.map(t) : e, f = {};
1773
- for (const m of d) f[m] = (f[m] || 0) + 1;
1774
- const v = s ? Is(f, o ? (m, x) => m[1] - x[1] : (m, x) => x[1] - m[1]) : f;
1772
+ const d = t ? e.map(t) : e, h = {};
1773
+ for (const m of d) h[m] = (h[m] || 0) + 1;
1774
+ const v = s ? Is(h, o ? (m, x) => m[1] - x[1] : (m, x) => x[1] - m[1]) : h;
1775
1775
  return n ? Object.keys(v) : v;
1776
1776
  }
1777
1777
  function Is(e, t) {
@@ -1781,7 +1781,7 @@ var di = {};
1781
1781
  const t = [], n = Object.keys(e), s = e[n[0]].length;
1782
1782
  for (let o = 0; o < s; o++) {
1783
1783
  const d = {};
1784
- for (const f of n) d[f] = e[f][o];
1784
+ for (const h of n) d[h] = e[h][o];
1785
1785
  t.push(d);
1786
1786
  }
1787
1787
  return t;
@@ -1917,7 +1917,7 @@ var di = {};
1917
1917
  }
1918
1918
  }
1919
1919
  function Uu(e, t, n, s, o = !1) {
1920
- const d = /* @__PURE__ */ new Map(), f = [];
1920
+ const d = /* @__PURE__ */ new Map(), h = [];
1921
1921
  e.forEach((m) => {
1922
1922
  const x = new Du(m);
1923
1923
  d.set(m[t], x);
@@ -1928,7 +1928,7 @@ var di = {};
1928
1928
  if (M) {
1929
1929
  const U = d.get(M);
1930
1930
  U && U.children.push(x);
1931
- } else f.push(x);
1931
+ } else h.push(x);
1932
1932
  });
1933
1933
  const v = (m) => {
1934
1934
  m.children.sort((x, M) => {
@@ -1936,7 +1936,7 @@ var di = {};
1936
1936
  return o ? je - U : U - je;
1937
1937
  }), m.children.forEach(v);
1938
1938
  };
1939
- return f.forEach(v), f;
1939
+ return h.forEach(v), h;
1940
1940
  }
1941
1941
  function $s(e, t) {
1942
1942
  if (Math.log2(e.length) % 1 !== 0) throw new Error("Array length must be a power of 2");
@@ -2079,7 +2079,7 @@ var di = {};
2079
2079
  ];
2080
2080
  function qu(e) {
2081
2081
  for (let t = 0; t < 24; t++) {
2082
- const n = e[0] ^ e[10] ^ e[20] ^ e[30] ^ e[40], s = e[1] ^ e[11] ^ e[21] ^ e[31] ^ e[41], o = e[2] ^ e[12] ^ e[22] ^ e[32] ^ e[42], d = e[3] ^ e[13] ^ e[23] ^ e[33] ^ e[43], f = e[4] ^ e[14] ^ e[24] ^ e[34] ^ e[44], v = e[5] ^ e[15] ^ e[25] ^ e[35] ^ e[45], m = e[6] ^ e[16] ^ e[26] ^ e[36] ^ e[46], x = e[7] ^ e[17] ^ e[27] ^ e[37] ^ e[47], M = e[8] ^ e[18] ^ e[28] ^ e[38] ^ e[48], U = e[9] ^ e[19] ^ e[29] ^ e[39] ^ e[49], je = o << 1 | d >>> 31, Il = d << 1 | o >>> 31, Xe = M ^ je, et = U ^ Il, Ml = f << 1 | v >>> 31, $l = v << 1 | f >>> 31, tt = n ^ Ml, rt = s ^ $l, Rl = m << 1 | x >>> 31, Cl = x << 1 | m >>> 31, nt = o ^ Rl, st = d ^ Cl, Nl = M << 1 | U >>> 31, jl = U << 1 | M >>> 31, it = f ^ Nl, at = v ^ jl, Dl = n << 1 | s >>> 31, Ul = s << 1 | n >>> 31, ot = m ^ Dl, ct = x ^ Ul;
2082
+ const n = e[0] ^ e[10] ^ e[20] ^ e[30] ^ e[40], s = e[1] ^ e[11] ^ e[21] ^ e[31] ^ e[41], o = e[2] ^ e[12] ^ e[22] ^ e[32] ^ e[42], d = e[3] ^ e[13] ^ e[23] ^ e[33] ^ e[43], h = e[4] ^ e[14] ^ e[24] ^ e[34] ^ e[44], v = e[5] ^ e[15] ^ e[25] ^ e[35] ^ e[45], m = e[6] ^ e[16] ^ e[26] ^ e[36] ^ e[46], x = e[7] ^ e[17] ^ e[27] ^ e[37] ^ e[47], M = e[8] ^ e[18] ^ e[28] ^ e[38] ^ e[48], U = e[9] ^ e[19] ^ e[29] ^ e[39] ^ e[49], je = o << 1 | d >>> 31, Il = d << 1 | o >>> 31, Xe = M ^ je, et = U ^ Il, Ml = h << 1 | v >>> 31, $l = v << 1 | h >>> 31, tt = n ^ Ml, rt = s ^ $l, Rl = m << 1 | x >>> 31, Cl = x << 1 | m >>> 31, nt = o ^ Rl, st = d ^ Cl, Nl = M << 1 | U >>> 31, jl = U << 1 | M >>> 31, it = h ^ Nl, at = v ^ jl, Dl = n << 1 | s >>> 31, Ul = s << 1 | n >>> 31, ot = m ^ Dl, ct = x ^ Ul;
2083
2083
  e[0] ^= Xe, e[1] ^= et, e[2] ^= tt, e[3] ^= rt, e[4] ^= nt, e[5] ^= st, e[6] ^= it, e[7] ^= at, e[8] ^= ot, e[9] ^= ct, e[10] ^= Xe, e[11] ^= et, e[12] ^= tt, e[13] ^= rt, e[14] ^= nt, e[15] ^= st, e[16] ^= it, e[17] ^= at, e[18] ^= ot, e[19] ^= ct, e[20] ^= Xe, e[21] ^= et, e[22] ^= tt, e[23] ^= rt, e[24] ^= nt, e[25] ^= st, e[26] ^= it, e[27] ^= at, e[28] ^= ot, e[29] ^= ct, e[30] ^= Xe, e[31] ^= et, e[32] ^= tt, e[33] ^= rt, e[34] ^= nt, e[35] ^= st, e[36] ^= it, e[37] ^= at, e[38] ^= ot, e[39] ^= ct, e[40] ^= Xe, e[41] ^= et, e[42] ^= tt, e[43] ^= rt, e[44] ^= nt, e[45] ^= st, e[46] ^= it, e[47] ^= at, e[48] ^= ot, e[49] ^= ct;
2084
2084
  const Sr = e[0], Tr = e[1], Ar = e[2] << 1 | e[3] >>> 31, Or = e[3] << 1 | e[2] >>> 31, Ir = e[5] << 30 | e[4] >>> 2, Mr = e[4] << 30 | e[5] >>> 2, $r = e[6] << 28 | e[7] >>> 4, Rr = e[7] << 28 | e[6] >>> 4, Cr = e[8] << 27 | e[9] >>> 5, Nr = e[9] << 27 | e[8] >>> 5, jr = e[11] << 4 | e[10] >>> 28, Dr = e[10] << 4 | e[11] >>> 28, Ur = e[13] << 12 | e[12] >>> 20, Pr = e[12] << 12 | e[13] >>> 20, Zr = e[14] << 6 | e[15] >>> 26, Br = e[15] << 6 | e[14] >>> 26, Lr = e[17] << 23 | e[16] >>> 9, zr = e[16] << 23 | e[17] >>> 9, Vr = e[18] << 20 | e[19] >>> 12, Fr = e[19] << 20 | e[18] >>> 12, Wr = e[20] << 3 | e[21] >>> 29, Hr = e[21] << 3 | e[20] >>> 29, qr = e[22] << 10 | e[23] >>> 22, Gr = e[23] << 10 | e[22] >>> 22, Jr = e[25] << 11 | e[24] >>> 21, Kr = e[24] << 11 | e[25] >>> 21, Yr = e[26] << 25 | e[27] >>> 7, Qr = e[27] << 25 | e[26] >>> 7, Xr = e[29] << 7 | e[28] >>> 25, en = e[28] << 7 | e[29] >>> 25, tn = e[31] << 9 | e[30] >>> 23, rn = e[30] << 9 | e[31] >>> 23, nn = e[33] << 13 | e[32] >>> 19, sn = e[32] << 13 | e[33] >>> 19, an = e[34] << 15 | e[35] >>> 17, on = e[35] << 15 | e[34] >>> 17, cn = e[36] << 21 | e[37] >>> 11, un = e[37] << 21 | e[36] >>> 11, ln = e[38] << 8 | e[39] >>> 24, dn = e[39] << 8 | e[38] >>> 24, fn = e[40] << 18 | e[41] >>> 14, hn = e[41] << 18 | e[40] >>> 14, pn = e[42] << 2 | e[43] >>> 30, mn = e[43] << 2 | e[42] >>> 30, gn = e[45] << 29 | e[44] >>> 3, yn = e[44] << 29 | e[45] >>> 3, vn = e[47] << 24 | e[46] >>> 8, wn = e[46] << 24 | e[47] >>> 8, bn = e[48] << 14 | e[49] >>> 18, _n = e[49] << 14 | e[48] >>> 18;
2085
2085
  e[0] = Sr ^ ~Ur & Jr, e[1] = Tr ^ ~Pr & Kr, e[2] = Ur ^ ~Jr & cn, e[3] = Pr ^ ~Kr & un, e[4] = Jr ^ ~cn & bn, e[5] = Kr ^ ~un & _n, e[6] = cn ^ ~bn & Sr, e[7] = un ^ ~_n & Tr, e[8] = bn ^ ~Sr & Ur, e[9] = _n ^ ~Tr & Pr, e[10] = $r ^ ~Vr & Wr, e[11] = Rr ^ ~Fr & Hr, e[12] = Vr ^ ~Wr & nn, e[13] = Fr ^ ~Hr & sn, e[14] = Wr ^ ~nn & gn, e[15] = Hr ^ ~sn & yn, e[16] = nn ^ ~gn & $r, e[17] = sn ^ ~yn & Rr, e[18] = gn ^ ~$r & Vr, e[19] = yn ^ ~Rr & Fr, e[20] = Ar ^ ~Zr & Yr, e[21] = Or ^ ~Br & Qr, e[22] = Zr ^ ~Yr & ln, e[23] = Br ^ ~Qr & dn, e[24] = Yr ^ ~ln & fn, e[25] = Qr ^ ~dn & hn, e[26] = ln ^ ~fn & Ar, e[27] = dn ^ ~hn & Or, e[28] = fn ^ ~Ar & Zr, e[29] = hn ^ ~Or & Br, e[30] = Cr ^ ~jr & qr, e[31] = Nr ^ ~Dr & Gr, e[32] = jr ^ ~qr & an, e[33] = Dr ^ ~Gr & on, e[34] = qr ^ ~an & vn, e[35] = Gr ^ ~on & wn, e[36] = an ^ ~vn & Cr, e[37] = on ^ ~wn & Nr, e[38] = vn ^ ~Cr & jr, e[39] = wn ^ ~Nr & Dr, e[40] = Ir ^ ~Lr & Xr, e[41] = Mr ^ ~zr & en, e[42] = Lr ^ ~Xr & tn, e[43] = zr ^ ~en & rn, e[44] = Xr ^ ~tn & pn, e[45] = en ^ ~rn & mn, e[46] = tn ^ ~pn & Ir, e[47] = rn ^ ~mn & Mr, e[48] = pn ^ ~Ir & Lr, e[49] = mn ^ ~Mr & zr, e[0] ^= js[t * 2], e[1] ^= js[t * 2 + 1];
@@ -2159,7 +2159,7 @@ var di = {};
2159
2159
  const s = Math.min(e.length, t.length, n / 8 + 1);
2160
2160
  for (let o = 0; o < s; o++) {
2161
2161
  const d = e[o] ^ t[o];
2162
- for (let f = 0; f < 8; f++) if (d >> 7 - f & 1) return o * 8 + f;
2162
+ for (let h = 0; h < 8; h++) if (d >> 7 - h & 1) return o * 8 + h;
2163
2163
  }
2164
2164
  return n;
2165
2165
  }
@@ -2216,8 +2216,8 @@ var di = {};
2216
2216
  e = $(e, t);
2217
2217
  let [n, s] = [0n, 1n], [o, d] = [t, e];
2218
2218
  for (; d !== 0n; ) {
2219
- const f = o / d;
2220
- [n, s] = [s, n - f * s], [o, d] = [d, o - f * d];
2219
+ const h = o / d;
2220
+ [n, s] = [s, n - h * s], [o, d] = [d, o - h * d];
2221
2221
  }
2222
2222
  if (o > 1n) throw new Error("a is not invertible");
2223
2223
  return n < 0n && (n += t), n;
@@ -2241,8 +2241,8 @@ var di = {};
2241
2241
  if (n === 0n && s === 0n) return [e, t];
2242
2242
  if (e === n && t === $(-s, o)) return [0n, 0n];
2243
2243
  if (e === n && t === s) return br(e, t, o);
2244
- const d = $((s - t) * Ye(n - e, o), o), f = $(d * d - e - n, o), v = $(d * (e - f) - t, o);
2245
- return [f, v];
2244
+ const d = $((s - t) * Ye(n - e, o), o), h = $(d * d - e - n, o), v = $(d * (e - h) - t, o);
2245
+ return [h, v];
2246
2246
  }
2247
2247
  function il(e) {
2248
2248
  if (e <= 0n || e >= D) throw new Error("Invalid private key");
@@ -2271,8 +2271,8 @@ var di = {};
2271
2271
  }
2272
2272
  function xe(e, t, n, s) {
2273
2273
  let o = [0n, 0n], d = [e, t];
2274
- const f = n.toString(2);
2275
- for (const v of f)
2274
+ const h = n.toString(2);
2275
+ for (const v of h)
2276
2276
  v === "0" ? (d = Ut(o[0], o[1], d[0], d[1], s), o = br(o[0], o[1], s)) : (o = Ut(o[0], o[1], d[0], d[1], s), d = br(d[0], d[1], s));
2277
2277
  return o;
2278
2278
  }
@@ -2290,19 +2290,19 @@ var di = {};
2290
2290
  )), n <= 0n || n >= D)
2291
2291
  throw new Error("Invalid nonce");
2292
2292
  const s = $(e, D), o = xe(jt, Dt, n, Z), d = $(o[0], D);
2293
- let f = $((s + $(d, D) * t) * Ye(n, D), D);
2294
- if (d === 0n || f === 0n) throw new Error("Invalid r or s value");
2293
+ let h = $((s + $(d, D) * t) * Ye(n, D), D);
2294
+ if (d === 0n || h === 0n) throw new Error("Invalid r or s value");
2295
2295
  let v = o[1] % 2n === 0n ? 27n : 28n;
2296
- return f > D / 2n && (f = D - f, v = v === 27n ? 28n : 27n), [d, f, v];
2296
+ return h > D / 2n && (h = D - h, v = v === 27n ? 28n : 27n), [d, h, v];
2297
2297
  }
2298
2298
  function dl(e, t, n, s) {
2299
2299
  const o = zs($(t ** 3n + 7n, Z), Z);
2300
2300
  if (!o) throw new Error("Invalid r: does not correspond to a valid curve point");
2301
- const d = s === 27n ? 0n : 1n, f = o % 2n === d ? o : Z - o, v = $(Ne(se(e), "BE"), D), m = xe(t, f, n, Z), x = xe(jt, Dt, v, Z), M = Ut(m[0], m[1], x[0], $(-x[1], Z), Z);
2301
+ const d = s === 27n ? 0n : 1n, h = o % 2n === d ? o : Z - o, v = $(Ne(se(e), "BE"), D), m = xe(t, h, n, Z), x = xe(jt, Dt, v, Z), M = Ut(m[0], m[1], x[0], $(-x[1], Z), Z);
2302
2302
  return xe(M[0], M[1], Ye(t, D), Z);
2303
2303
  }
2304
2304
  function fl(e, t, n, s) {
2305
- const o = $(Ne(se(e), "BE"), D), d = Ye(s, D), f = $(o * d, D), v = $(n * d, D), m = xe(jt, Dt, f, Z), x = xe(t[0], t[1], v, Z), M = Ut(m[0], m[1], x[0], x[1], Z);
2305
+ const o = $(Ne(se(e), "BE"), D), d = Ye(s, D), h = $(o * d, D), v = $(n * d, D), m = xe(jt, Dt, h, Z), x = xe(t[0], t[1], v, Z), M = Ut(m[0], m[1], x[0], x[1], Z);
2306
2306
  return n === $(M[0], D);
2307
2307
  }
2308
2308
  class Fs {
@@ -2429,8 +2429,8 @@ var di = {};
2429
2429
  const o = e.findIndex((v) => v === `--${t}` || v.startsWith(`--${t}=`)), d = e[o];
2430
2430
  if (!d) return (n || {})[s || t || ""] || null;
2431
2431
  if (d.includes("=")) return d.split("=")[1];
2432
- const f = e[o + 1];
2433
- return f && !f.startsWith("-") ? f : (n || {})[s || t || ""] || null;
2432
+ const h = e[o + 1];
2433
+ return h && !h.startsWith("-") ? h : (n || {})[s || t || ""] || null;
2434
2434
  }
2435
2435
  function pl(e, t, n, s) {
2436
2436
  const o = Zt(e, t, n, s);
@@ -2445,8 +2445,8 @@ var di = {};
2445
2445
  const o = e.some((m) => m.endsWith("-" + t)), d = Zt(e, t, n, s);
2446
2446
  if (!d && o) return !0;
2447
2447
  if (!d && !o) return null;
2448
- const f = ["true", "1", "yes", "y", "on"], v = ["false", "0", "no", "n", "off"];
2449
- if (f.includes(d.toLowerCase())) return !0;
2448
+ const h = ["true", "1", "yes", "y", "on"], v = ["false", "0", "no", "n", "off"];
2449
+ if (h.includes(d.toLowerCase())) return !0;
2450
2450
  if (v.includes(d.toLowerCase())) return !1;
2451
2451
  throw Error(`Invalid boolean argument ${t}: ${d}`);
2452
2452
  }
@@ -2520,9 +2520,9 @@ var di = {};
2520
2520
  return !e[t][n + 1];
2521
2521
  }
2522
2522
  function xl(e, t, n) {
2523
- var o, d, f, v, m, x, M, U;
2523
+ var o, d, h, v, m, x, M, U;
2524
2524
  const s = [];
2525
- return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) && Ys(e, t, n) && Xs(e, t, n) && s.push({ x: t, y: n }), !((d = e[t + 1]) != null && d[n - 1]) && Qs(e, t, n) && Xs(e, t, n) && s.push({ x: t + 1, y: n }), !((f = e[t - 1]) != null && f[n + 1]) && Ys(e, t, n) && ei(e, t, n) && s.push({ x: t, y: n + 1 }), !((v = e[t + 1]) != null && v[n + 1]) && Qs(e, t, n) && ei(e, t, n) && s.push({ x: t + 1, y: n + 1 }), s) : ((m = e[t - 1]) != null && m[n] && e[t][n - 1] && s.push({ x: t, y: n }), (x = e[t + 1]) != null && x[n] && e[t][n - 1] && s.push({ x: t + 1, y: n }), (M = e[t - 1]) != null && M[n] && e[t][n + 1] && s.push({ x: t, y: n + 1 }), (U = e[t + 1]) != null && U[n] && e[t][n + 1] && s.push({ x: t + 1, y: n + 1 }), s);
2525
+ return e[t][n] ? bl(e, t, n) || _l(e, t, n) ? [] : (!((o = e[t - 1]) != null && o[n - 1]) && Ys(e, t, n) && Xs(e, t, n) && s.push({ x: t, y: n }), !((d = e[t + 1]) != null && d[n - 1]) && Qs(e, t, n) && Xs(e, t, n) && s.push({ x: t + 1, y: n }), !((h = e[t - 1]) != null && h[n + 1]) && Ys(e, t, n) && ei(e, t, n) && s.push({ x: t, y: n + 1 }), !((v = e[t + 1]) != null && v[n + 1]) && Qs(e, t, n) && ei(e, t, n) && s.push({ x: t + 1, y: n + 1 }), s) : ((m = e[t - 1]) != null && m[n] && e[t][n - 1] && s.push({ x: t, y: n }), (x = e[t + 1]) != null && x[n] && e[t][n - 1] && s.push({ x: t + 1, y: n }), (M = e[t - 1]) != null && M[n] && e[t][n + 1] && s.push({ x: t, y: n + 1 }), (U = e[t + 1]) != null && U[n] && e[t][n + 1] && s.push({ x: t + 1, y: n + 1 }), s);
2526
2526
  }
2527
2527
  function kl(e, t, n, s) {
2528
2528
  const o = [
@@ -2532,8 +2532,8 @@ var di = {};
2532
2532
  { x: n, y: s }
2533
2533
  ];
2534
2534
  for (let d = 0; d < e.length; d++)
2535
- for (let f = 0; f < e[0].length; f++) {
2536
- const v = xl(e, d, f);
2535
+ for (let h = 0; h < e[0].length; h++) {
2536
+ const v = xl(e, d, h);
2537
2537
  for (const m of v) o.some((x) => x.x === m.x && x.y === m.y) || o.push(m);
2538
2538
  }
2539
2539
  return o.map((d) => ({ x: d.x * t, y: d.y * t }));
@@ -2563,8 +2563,8 @@ var di = {};
2563
2563
  dy: 1
2564
2564
  }));
2565
2565
  n.forEach((m) => m.y++), d.forEach((m) => m.x++);
2566
- const f = yr([...o, ...d], (m, x) => m.x === x.x && m.y - 1 === x.y), v = yr([...s, ...n], (m, x) => m.y === x.y && m.x - 1 === x.x);
2567
- return [...f, ...v].map((m) => ({ start: m[0], end: qe(m) })).map((m) => ({
2566
+ const h = yr([...o, ...d], (m, x) => m.x === x.x && m.y - 1 === x.y), v = yr([...s, ...n], (m, x) => m.y === x.y && m.x - 1 === x.x);
2567
+ return [...h, ...v].map((m) => ({ start: m[0], end: qe(m) })).map((m) => ({
2568
2568
  start: xr(m.start, t),
2569
2569
  end: xr(Gs(m.end, { x: m.start.dx, y: m.start.dy }), t)
2570
2570
  }));
@@ -2578,26 +2578,26 @@ var di = {};
2578
2578
  function ti(e, t, n, s) {
2579
2579
  const o = (s.y - n.y) * (t.x - e.x) - (s.x - n.x) * (t.y - e.y);
2580
2580
  if (o === 0) return null;
2581
- let d = e.y - n.y, f = e.x - n.x;
2582
- const v = (s.x - n.x) * d - (s.y - n.y) * f, m = (t.x - e.x) * d - (t.y - e.y) * f;
2583
- return d = v / o, f = m / o, d > 0 && d < 1 && f > 0 && f < 1 ? { x: e.x + d * (t.x - e.x), y: e.y + d * (t.y - e.y) } : null;
2581
+ let d = e.y - n.y, h = e.x - n.x;
2582
+ const v = (s.x - n.x) * d - (s.y - n.y) * h, m = (t.x - e.x) * d - (t.y - e.y) * h;
2583
+ return d = v / o, h = m / o, d > 0 && d < 1 && h > 0 && h < 1 ? { x: e.x + d * (t.x - e.x), y: e.y + d * (t.y - e.y) } : null;
2584
2584
  }
2585
2585
  function kr(e, t, n) {
2586
2586
  const s = [], o = Js(e, n, 1e4);
2587
2587
  for (const d of t) {
2588
- const f = ti(e, o, d.start, d.end);
2589
- f && s.push(f);
2588
+ const h = ti(e, o, d.start, d.end);
2589
+ h && s.push(h);
2590
2590
  }
2591
- return s.length ? s.reduce((d, f) => {
2592
- const v = Ks(e, f), m = Ks(e, d);
2593
- return v < m ? f : d;
2591
+ return s.length ? s.reduce((d, h) => {
2592
+ const v = Ks(e, h), m = Ks(e, d);
2593
+ return v < m ? h : d;
2594
2594
  }) : null;
2595
2595
  }
2596
2596
  function Al(e, t, n) {
2597
2597
  const s = Tl(e, n), o = [];
2598
2598
  for (const d of s) {
2599
- const f = kr(e, t, d - 1e-3), v = kr(e, t, d + 1e-3);
2600
- f && o.push(f), v && o.push(v);
2599
+ const h = kr(e, t, d - 1e-3), v = kr(e, t, d + 1e-3);
2600
+ h && o.push(h), v && o.push(v);
2601
2601
  }
2602
2602
  return o;
2603
2603
  }
@@ -2714,7 +2714,7 @@ var di = {};
2714
2714
  onlyOrNull: g,
2715
2715
  firstOrThrow: E,
2716
2716
  firstOrNull: y,
2717
- shuffle: h,
2717
+ shuffle: f,
2718
2718
  initialize: N,
2719
2719
  initialize2D: ne,
2720
2720
  rotate2D: re,
@@ -3073,12 +3073,12 @@ function ed(a, r) {
3073
3073
  }
3074
3074
  function ai(a, r, i) {
3075
3075
  r = new Bt(r), i = new ke(i);
3076
- const c = ed(r, i.publicKey().address()), u = i.sign(B.concatBytes(r.toUint8Array(), a.address.toUint8Array())), l = B.concatBytes(r.toUint8Array(), u.toUint8Array(), a.data), h = Le.fromSlice(a.data, 0), p = Pe.fromSlice(a.data, Le.LENGTH);
3076
+ const c = ed(r, i.publicKey().address()), u = i.sign(B.concatBytes(r.toUint8Array(), a.address.toUint8Array())), l = B.concatBytes(r.toUint8Array(), u.toUint8Array(), a.data), f = Le.fromSlice(a.data, 0), p = Pe.fromSlice(a.data, Le.LENGTH);
3077
3077
  return {
3078
3078
  data: l,
3079
3079
  identifier: r,
3080
3080
  signature: u,
3081
- span: h,
3081
+ span: f,
3082
3082
  payload: p,
3083
3083
  address: c,
3084
3084
  owner: i.publicKey().address()
@@ -3132,28 +3132,28 @@ var I;
3132
3132
  }
3133
3133
  a.assertNever = i, a.arrayToEnum = (u) => {
3134
3134
  const l = {};
3135
- for (const h of u)
3136
- l[h] = h;
3135
+ for (const f of u)
3136
+ l[f] = f;
3137
3137
  return l;
3138
3138
  }, a.getValidEnumValues = (u) => {
3139
- const l = a.objectKeys(u).filter((p) => typeof u[u[p]] != "number"), h = {};
3139
+ const l = a.objectKeys(u).filter((p) => typeof u[u[p]] != "number"), f = {};
3140
3140
  for (const p of l)
3141
- h[p] = u[p];
3142
- return a.objectValues(h);
3141
+ f[p] = u[p];
3142
+ return a.objectValues(f);
3143
3143
  }, a.objectValues = (u) => a.objectKeys(u).map(function(l) {
3144
3144
  return u[l];
3145
3145
  }), a.objectKeys = typeof Object.keys == "function" ? (u) => Object.keys(u) : (u) => {
3146
3146
  const l = [];
3147
- for (const h in u)
3148
- Object.prototype.hasOwnProperty.call(u, h) && l.push(h);
3147
+ for (const f in u)
3148
+ Object.prototype.hasOwnProperty.call(u, f) && l.push(f);
3149
3149
  return l;
3150
3150
  }, a.find = (u, l) => {
3151
- for (const h of u)
3152
- if (l(h))
3153
- return h;
3151
+ for (const f of u)
3152
+ if (l(f))
3153
+ return f;
3154
3154
  }, a.isInteger = typeof Number.isInteger == "function" ? (u) => Number.isInteger(u) : (u) => typeof u == "number" && isFinite(u) && Math.floor(u) === u;
3155
3155
  function c(u, l = " | ") {
3156
- return u.map((h) => typeof h == "string" ? `'${h}'` : h).join(l);
3156
+ return u.map((f) => typeof f == "string" ? `'${f}'` : f).join(l);
3157
3157
  }
3158
3158
  a.joinValues = c, a.jsonStringifyReplacer = (u, l) => typeof l == "bigint" ? l.toString() : l;
3159
3159
  })(I || (I = {}));
@@ -3242,20 +3242,20 @@ class V extends Error {
3242
3242
  const i = r || function(l) {
3243
3243
  return l.message;
3244
3244
  }, c = { _errors: [] }, u = (l) => {
3245
- for (const h of l.issues)
3246
- if (h.code === "invalid_union")
3247
- h.unionErrors.map(u);
3248
- else if (h.code === "invalid_return_type")
3249
- u(h.returnTypeError);
3250
- else if (h.code === "invalid_arguments")
3251
- u(h.argumentsError);
3252
- else if (h.path.length === 0)
3253
- c._errors.push(i(h));
3245
+ for (const f of l.issues)
3246
+ if (f.code === "invalid_union")
3247
+ f.unionErrors.map(u);
3248
+ else if (f.code === "invalid_return_type")
3249
+ u(f.returnTypeError);
3250
+ else if (f.code === "invalid_arguments")
3251
+ u(f.argumentsError);
3252
+ else if (f.path.length === 0)
3253
+ c._errors.push(i(f));
3254
3254
  else {
3255
3255
  let p = c, g = 0;
3256
- for (; g < h.path.length; ) {
3257
- const y = h.path[g];
3258
- g === h.path.length - 1 ? (p[y] = p[y] || { _errors: [] }, p[y]._errors.push(i(h))) : p[y] = p[y] || { _errors: [] }, p = p[y], g++;
3256
+ for (; g < f.path.length; ) {
3257
+ const y = f.path[g];
3258
+ g === f.path.length - 1 ? (p[y] = p[y] || { _errors: [] }, p[y]._errors.push(i(f))) : p[y] = p[y] || { _errors: [] }, p = p[y], g++;
3259
3259
  }
3260
3260
  }
3261
3261
  };
@@ -3349,7 +3349,7 @@ function Lt() {
3349
3349
  return hi;
3350
3350
  }
3351
3351
  const zt = (a) => {
3352
- const { data: r, path: i, errorMaps: c, issueData: u } = a, l = [...i, ...u.path || []], h = {
3352
+ const { data: r, path: i, errorMaps: c, issueData: u } = a, l = [...i, ...u.path || []], f = {
3353
3353
  ...u,
3354
3354
  path: l
3355
3355
  };
@@ -3362,7 +3362,7 @@ const zt = (a) => {
3362
3362
  let p = "";
3363
3363
  const g = c.filter((y) => !!y).slice().reverse();
3364
3364
  for (const y of g)
3365
- p = y(h, { data: r, defaultError: p }).message;
3365
+ p = y(f, { data: r, defaultError: p }).message;
3366
3366
  return {
3367
3367
  ...u,
3368
3368
  path: l,
@@ -3409,10 +3409,10 @@ class L {
3409
3409
  static async mergeObjectAsync(r, i) {
3410
3410
  const c = [];
3411
3411
  for (const u of i) {
3412
- const l = await u.key, h = await u.value;
3412
+ const l = await u.key, f = await u.value;
3413
3413
  c.push({
3414
3414
  key: l,
3415
- value: h
3415
+ value: f
3416
3416
  });
3417
3417
  }
3418
3418
  return L.mergeObjectSync(r, c);
@@ -3420,10 +3420,10 @@ class L {
3420
3420
  static mergeObjectSync(r, i) {
3421
3421
  const c = {};
3422
3422
  for (const u of i) {
3423
- const { key: l, value: h } = u;
3424
- if (l.status === "aborted" || h.status === "aborted")
3423
+ const { key: l, value: f } = u;
3424
+ if (l.status === "aborted" || f.status === "aborted")
3425
3425
  return T;
3426
- l.status === "dirty" && r.dirty(), h.status === "dirty" && r.dirty(), l.value !== "__proto__" && (typeof h.value < "u" || u.alwaysSet) && (c[l.value] = h.value);
3426
+ l.status === "dirty" && r.dirty(), f.status === "dirty" && r.dirty(), l.value !== "__proto__" && (typeof f.value < "u" || u.alwaysSet) && (c[l.value] = f.value);
3427
3427
  }
3428
3428
  return { status: r.value, value: c };
3429
3429
  }
@@ -3473,10 +3473,10 @@ function A(a) {
3473
3473
  const { errorMap: r, invalid_type_error: i, required_error: c, description: u } = a;
3474
3474
  if (r && (i || c))
3475
3475
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
3476
- return r ? { errorMap: r, description: u } : { errorMap: (h, p) => {
3476
+ return r ? { errorMap: r, description: u } : { errorMap: (f, p) => {
3477
3477
  var g, y;
3478
3478
  const { message: E } = a;
3479
- return h.code === "invalid_enum_value" ? { message: E ?? p.defaultError } : typeof p.data > "u" ? { message: (g = E ?? c) !== null && g !== void 0 ? g : p.defaultError } : h.code !== "invalid_type" ? { message: p.defaultError } : { message: (y = E ?? i) !== null && y !== void 0 ? y : p.defaultError };
3479
+ return f.code === "invalid_enum_value" ? { message: E ?? p.defaultError } : typeof p.data > "u" ? { message: (g = E ?? c) !== null && g !== void 0 ? g : p.defaultError } : f.code !== "invalid_type" ? { message: p.defaultError } : { message: (y = E ?? i) !== null && y !== void 0 ? y : p.defaultError };
3480
3480
  }, description: u };
3481
3481
  }
3482
3482
  class O {
@@ -3598,11 +3598,11 @@ class O {
3598
3598
  refine(r, i) {
3599
3599
  const c = (u) => typeof i == "string" || typeof i > "u" ? { message: i } : typeof i == "function" ? i(u) : i;
3600
3600
  return this._refinement((u, l) => {
3601
- const h = r(u), p = () => l.addIssue({
3601
+ const f = r(u), p = () => l.addIssue({
3602
3602
  code: w.custom,
3603
3603
  ...c(u)
3604
3604
  });
3605
- return typeof Promise < "u" && h instanceof Promise ? h.then((g) => g ? !0 : (p(), !1)) : h ? !0 : (p(), !1);
3605
+ return typeof Promise < "u" && f instanceof Promise ? f.then((g) => g ? !0 : (p(), !1)) : f ? !0 : (p(), !1);
3606
3606
  });
3607
3607
  }
3608
3608
  refinement(r, i) {
@@ -3762,8 +3762,8 @@ class q extends O {
3762
3762
  message: l.message
3763
3763
  }), c.dirty());
3764
3764
  else if (l.kind === "length") {
3765
- const h = r.data.length > l.value, p = r.data.length < l.value;
3766
- (h || p) && (u = this._getOrReturnCtx(r, u), h ? b(u, {
3765
+ const f = r.data.length > l.value, p = r.data.length < l.value;
3766
+ (f || p) && (u = this._getOrReturnCtx(r, u), f ? b(u, {
3767
3767
  code: w.too_big,
3768
3768
  maximum: l.value,
3769
3769
  type: "string",
@@ -4118,8 +4118,8 @@ q.create = (a) => {
4118
4118
  });
4119
4119
  };
4120
4120
  function Od(a, r) {
4121
- const i = (a.toString().split(".")[1] || "").length, c = (r.toString().split(".")[1] || "").length, u = i > c ? i : c, l = parseInt(a.toFixed(u).replace(".", "")), h = parseInt(r.toFixed(u).replace(".", ""));
4122
- return l % h / Math.pow(10, u);
4121
+ const i = (a.toString().split(".")[1] || "").length, c = (r.toString().split(".")[1] || "").length, u = i > c ? i : c, l = parseInt(a.toFixed(u).replace(".", "")), f = parseInt(r.toFixed(u).replace(".", ""));
4122
+ return l % f / Math.pow(10, u);
4123
4123
  }
4124
4124
  class fe extends O {
4125
4125
  constructor() {
@@ -4641,11 +4641,11 @@ class G extends O {
4641
4641
  received: i.parsedType
4642
4642
  }), T;
4643
4643
  if (u.exactLength !== null) {
4644
- const h = i.data.length > u.exactLength.value, p = i.data.length < u.exactLength.value;
4645
- (h || p) && (b(i, {
4646
- code: h ? w.too_big : w.too_small,
4644
+ const f = i.data.length > u.exactLength.value, p = i.data.length < u.exactLength.value;
4645
+ (f || p) && (b(i, {
4646
+ code: f ? w.too_big : w.too_small,
4647
4647
  minimum: p ? u.exactLength.value : void 0,
4648
- maximum: h ? u.exactLength.value : void 0,
4648
+ maximum: f ? u.exactLength.value : void 0,
4649
4649
  type: "array",
4650
4650
  inclusive: !0,
4651
4651
  exact: !0,
@@ -4667,8 +4667,8 @@ class G extends O {
4667
4667
  exact: !1,
4668
4668
  message: u.maxLength.message
4669
4669
  }), c.dirty()), i.common.async)
4670
- return Promise.all([...i.data].map((h, p) => u.type._parseAsync(new ee(i, h, i.path, p)))).then((h) => L.mergeArray(c, h));
4671
- const l = [...i.data].map((h, p) => u.type._parseSync(new ee(i, h, i.path, p)));
4670
+ return Promise.all([...i.data].map((f, p) => u.type._parseAsync(new ee(i, f, i.path, p)))).then((f) => L.mergeArray(c, f));
4671
+ const l = [...i.data].map((f, p) => u.type._parseSync(new ee(i, f, i.path, p)));
4672
4672
  return L.mergeArray(c, l);
4673
4673
  }
4674
4674
  get element() {
@@ -4739,12 +4739,12 @@ class C extends O {
4739
4739
  received: y.parsedType
4740
4740
  }), T;
4741
4741
  }
4742
- const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: h } = this._getCached(), p = [];
4742
+ const { status: c, ctx: u } = this._processInputParams(r), { shape: l, keys: f } = this._getCached(), p = [];
4743
4743
  if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
4744
4744
  for (const y in u.data)
4745
- h.includes(y) || p.push(y);
4745
+ f.includes(y) || p.push(y);
4746
4746
  const g = [];
4747
- for (const y of h) {
4747
+ for (const y of f) {
4748
4748
  const E = l[y], N = u.data[y];
4749
4749
  g.push({
4750
4750
  key: { status: "valid", value: y },
@@ -4802,8 +4802,8 @@ class C extends O {
4802
4802
  unknownKeys: "strict",
4803
4803
  ...r !== void 0 ? {
4804
4804
  errorMap: (i, c) => {
4805
- var u, l, h, p;
4806
- const g = (h = (l = (u = this._def).errorMap) === null || l === void 0 ? void 0 : l.call(u, i, c).message) !== null && h !== void 0 ? h : c.defaultError;
4805
+ var u, l, f, p;
4806
+ const g = (f = (l = (u = this._def).errorMap) === null || l === void 0 ? void 0 : l.call(u, i, c).message) !== null && f !== void 0 ? f : c.defaultError;
4807
4807
  return i.code === "unrecognized_keys" ? {
4808
4808
  message: (p = k.errToObj(r).message) !== null && p !== void 0 ? p : g
4809
4809
  } : {
@@ -5017,15 +5017,15 @@ class mt extends O {
5017
5017
  for (const p of l)
5018
5018
  if (p.result.status === "dirty")
5019
5019
  return i.common.issues.push(...p.ctx.common.issues), p.result;
5020
- const h = l.map((p) => new V(p.ctx.common.issues));
5020
+ const f = l.map((p) => new V(p.ctx.common.issues));
5021
5021
  return b(i, {
5022
5022
  code: w.invalid_union,
5023
- unionErrors: h
5023
+ unionErrors: f
5024
5024
  }), T;
5025
5025
  }
5026
5026
  if (i.common.async)
5027
5027
  return Promise.all(c.map(async (l) => {
5028
- const h = {
5028
+ const f = {
5029
5029
  ...i,
5030
5030
  common: {
5031
5031
  ...i.common,
@@ -5037,14 +5037,14 @@ class mt extends O {
5037
5037
  result: await l._parseAsync({
5038
5038
  data: i.data,
5039
5039
  path: i.path,
5040
- parent: h
5040
+ parent: f
5041
5041
  }),
5042
- ctx: h
5042
+ ctx: f
5043
5043
  };
5044
5044
  })).then(u);
5045
5045
  {
5046
5046
  let l;
5047
- const h = [];
5047
+ const f = [];
5048
5048
  for (const g of c) {
5049
5049
  const y = {
5050
5050
  ...i,
@@ -5060,11 +5060,11 @@ class mt extends O {
5060
5060
  });
5061
5061
  if (E.status === "valid")
5062
5062
  return E;
5063
- E.status === "dirty" && !l && (l = { result: E, ctx: y }), y.common.issues.length && h.push(y.common.issues);
5063
+ E.status === "dirty" && !l && (l = { result: E, ctx: y }), y.common.issues.length && f.push(y.common.issues);
5064
5064
  }
5065
5065
  if (l)
5066
5066
  return i.common.issues.push(...l.ctx.common.issues), l.result;
5067
- const p = h.map((g) => new V(g));
5067
+ const p = f.map((g) => new V(g));
5068
5068
  return b(i, {
5069
5069
  code: w.invalid_union,
5070
5070
  unionErrors: p
@@ -5125,10 +5125,10 @@ class Gt extends O {
5125
5125
  static create(r, i, c) {
5126
5126
  const u = /* @__PURE__ */ new Map();
5127
5127
  for (const l of i) {
5128
- const h = ie(l.shape[r]);
5129
- if (!h.length)
5128
+ const f = ie(l.shape[r]);
5129
+ if (!f.length)
5130
5130
  throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);
5131
- for (const p of h) {
5131
+ for (const p of f) {
5132
5132
  if (u.has(p))
5133
5133
  throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(p)}`);
5134
5134
  u.set(p, l);
@@ -5148,20 +5148,20 @@ function $n(a, r) {
5148
5148
  if (a === r)
5149
5149
  return { valid: !0, data: a };
5150
5150
  if (i === _.object && c === _.object) {
5151
- const u = I.objectKeys(r), l = I.objectKeys(a).filter((p) => u.indexOf(p) !== -1), h = { ...a, ...r };
5151
+ const u = I.objectKeys(r), l = I.objectKeys(a).filter((p) => u.indexOf(p) !== -1), f = { ...a, ...r };
5152
5152
  for (const p of l) {
5153
5153
  const g = $n(a[p], r[p]);
5154
5154
  if (!g.valid)
5155
5155
  return { valid: !1 };
5156
- h[p] = g.data;
5156
+ f[p] = g.data;
5157
5157
  }
5158
- return { valid: !0, data: h };
5158
+ return { valid: !0, data: f };
5159
5159
  } else if (i === _.array && c === _.array) {
5160
5160
  if (a.length !== r.length)
5161
5161
  return { valid: !1 };
5162
5162
  const u = [];
5163
5163
  for (let l = 0; l < a.length; l++) {
5164
- const h = a[l], p = r[l], g = $n(h, p);
5164
+ const f = a[l], p = r[l], g = $n(f, p);
5165
5165
  if (!g.valid)
5166
5166
  return { valid: !1 };
5167
5167
  u.push(g.data);
@@ -5171,11 +5171,11 @@ function $n(a, r) {
5171
5171
  }
5172
5172
  class gt extends O {
5173
5173
  _parse(r) {
5174
- const { status: i, ctx: c } = this._processInputParams(r), u = (l, h) => {
5175
- if (In(l) || In(h))
5174
+ const { status: i, ctx: c } = this._processInputParams(r), u = (l, f) => {
5175
+ if (In(l) || In(f))
5176
5176
  return T;
5177
- const p = $n(l.value, h.value);
5178
- return p.valid ? ((Mn(l) || Mn(h)) && i.dirty(), { status: i.value, value: p.data }) : (b(c, {
5177
+ const p = $n(l.value, f.value);
5178
+ return p.valid ? ((Mn(l) || Mn(f)) && i.dirty(), { status: i.value, value: p.data }) : (b(c, {
5179
5179
  code: w.invalid_intersection_types
5180
5180
  }), T);
5181
5181
  };
@@ -5190,7 +5190,7 @@ class gt extends O {
5190
5190
  path: c.path,
5191
5191
  parent: c
5192
5192
  })
5193
- ]).then(([l, h]) => u(l, h)) : u(this._def.left._parseSync({
5193
+ ]).then(([l, f]) => u(l, f)) : u(this._def.left._parseSync({
5194
5194
  data: c.data,
5195
5195
  path: c.path,
5196
5196
  parent: c
@@ -5231,11 +5231,11 @@ class te extends O {
5231
5231
  exact: !1,
5232
5232
  type: "array"
5233
5233
  }), i.dirty());
5234
- const l = [...c.data].map((h, p) => {
5234
+ const l = [...c.data].map((f, p) => {
5235
5235
  const g = this._def.items[p] || this._def.rest;
5236
- return g ? g._parse(new ee(c, h, c.path, p)) : null;
5237
- }).filter((h) => !!h);
5238
- return c.common.async ? Promise.all(l).then((h) => L.mergeArray(i, h)) : L.mergeArray(i, l);
5236
+ return g ? g._parse(new ee(c, f, c.path, p)) : null;
5237
+ }).filter((f) => !!f);
5238
+ return c.common.async ? Promise.all(l).then((f) => L.mergeArray(i, f)) : L.mergeArray(i, l);
5239
5239
  }
5240
5240
  get items() {
5241
5241
  return this._def.items;
@@ -5272,11 +5272,11 @@ class yt extends O {
5272
5272
  expected: _.object,
5273
5273
  received: c.parsedType
5274
5274
  }), T;
5275
- const u = [], l = this._def.keyType, h = this._def.valueType;
5275
+ const u = [], l = this._def.keyType, f = this._def.valueType;
5276
5276
  for (const p in c.data)
5277
5277
  u.push({
5278
5278
  key: l._parse(new ee(c, p, c.path, p)),
5279
- value: h._parse(new ee(c, c.data[p], c.path, p)),
5279
+ value: f._parse(new ee(c, c.data[p], c.path, p)),
5280
5280
  alwaysSet: p in c.data
5281
5281
  });
5282
5282
  return c.common.async ? L.mergeObjectAsync(i, u) : L.mergeObjectSync(i, u);
@@ -5313,14 +5313,14 @@ class Ht extends O {
5313
5313
  expected: _.map,
5314
5314
  received: c.parsedType
5315
5315
  }), T;
5316
- const u = this._def.keyType, l = this._def.valueType, h = [...c.data.entries()].map(([p, g], y) => ({
5316
+ const u = this._def.keyType, l = this._def.valueType, f = [...c.data.entries()].map(([p, g], y) => ({
5317
5317
  key: u._parse(new ee(c, p, c.path, [y, "key"])),
5318
5318
  value: l._parse(new ee(c, g, c.path, [y, "value"]))
5319
5319
  }));
5320
5320
  if (c.common.async) {
5321
5321
  const p = /* @__PURE__ */ new Map();
5322
5322
  return Promise.resolve().then(async () => {
5323
- for (const g of h) {
5323
+ for (const g of f) {
5324
5324
  const y = await g.key, E = await g.value;
5325
5325
  if (y.status === "aborted" || E.status === "aborted")
5326
5326
  return T;
@@ -5330,7 +5330,7 @@ class Ht extends O {
5330
5330
  });
5331
5331
  } else {
5332
5332
  const p = /* @__PURE__ */ new Map();
5333
- for (const g of h) {
5333
+ for (const g of f) {
5334
5334
  const y = g.key, E = g.value;
5335
5335
  if (y.status === "aborted" || E.status === "aborted")
5336
5336
  return T;
@@ -5372,7 +5372,7 @@ class Ae extends O {
5372
5372
  message: u.maxSize.message
5373
5373
  }), i.dirty());
5374
5374
  const l = this._def.valueType;
5375
- function h(g) {
5375
+ function f(g) {
5376
5376
  const y = /* @__PURE__ */ new Set();
5377
5377
  for (const E of g) {
5378
5378
  if (E.status === "aborted")
@@ -5382,7 +5382,7 @@ class Ae extends O {
5382
5382
  return { status: i.value, value: y };
5383
5383
  }
5384
5384
  const p = [...c.data.values()].map((g, y) => l._parse(new ee(c, g, c.path, y)));
5385
- return c.common.async ? Promise.all(p).then((g) => h(g)) : h(p);
5385
+ return c.common.async ? Promise.all(p).then((g) => f(g)) : f(p);
5386
5386
  }
5387
5387
  min(r, i) {
5388
5388
  return new Ae({
@@ -5454,13 +5454,13 @@ class Be extends O {
5454
5454
  }
5455
5455
  });
5456
5456
  }
5457
- const l = { errorMap: i.common.contextualErrorMap }, h = i.data;
5457
+ const l = { errorMap: i.common.contextualErrorMap }, f = i.data;
5458
5458
  if (this._def.returns instanceof Fe) {
5459
5459
  const p = this;
5460
5460
  return z(async function(...g) {
5461
5461
  const y = new V([]), E = await p._def.args.parseAsync(g, l).catch((ne) => {
5462
5462
  throw y.addIssue(c(g, ne)), y;
5463
- }), N = await Reflect.apply(h, this, E);
5463
+ }), N = await Reflect.apply(f, this, E);
5464
5464
  return await p._def.returns._def.type.parseAsync(N, l).catch((ne) => {
5465
5465
  throw y.addIssue(u(N, ne)), y;
5466
5466
  });
@@ -5471,7 +5471,7 @@ class Be extends O {
5471
5471
  const y = p._def.args.safeParse(g, l);
5472
5472
  if (!y.success)
5473
5473
  throw new V([c(g, y.error)]);
5474
- const E = Reflect.apply(h, this, y.data), N = p._def.returns.safeParse(E, l);
5474
+ const E = Reflect.apply(f, this, y.data), N = p._def.returns.safeParse(E, l);
5475
5475
  if (!N.success)
5476
5476
  throw new V([u(E, N.error)]);
5477
5477
  return N.data;
@@ -5679,17 +5679,17 @@ class J extends O {
5679
5679
  }
5680
5680
  _parse(r) {
5681
5681
  const { status: i, ctx: c } = this._processInputParams(r), u = this._def.effect || null, l = {
5682
- addIssue: (h) => {
5683
- b(c, h), h.fatal ? i.abort() : i.dirty();
5682
+ addIssue: (f) => {
5683
+ b(c, f), f.fatal ? i.abort() : i.dirty();
5684
5684
  },
5685
5685
  get path() {
5686
5686
  return c.path;
5687
5687
  }
5688
5688
  };
5689
5689
  if (l.addIssue = l.addIssue.bind(l), u.type === "preprocess") {
5690
- const h = u.transform(c.data, l);
5690
+ const f = u.transform(c.data, l);
5691
5691
  if (c.common.async)
5692
- return Promise.resolve(h).then(async (p) => {
5692
+ return Promise.resolve(f).then(async (p) => {
5693
5693
  if (i.value === "aborted")
5694
5694
  return T;
5695
5695
  const g = await this._def.schema._parseAsync({
@@ -5703,7 +5703,7 @@ class J extends O {
5703
5703
  if (i.value === "aborted")
5704
5704
  return T;
5705
5705
  const p = this._def.schema._parseSync({
5706
- data: h,
5706
+ data: f,
5707
5707
  path: c.path,
5708
5708
  parent: c
5709
5709
  });
@@ -5711,7 +5711,7 @@ class J extends O {
5711
5711
  }
5712
5712
  }
5713
5713
  if (u.type === "refinement") {
5714
- const h = (p) => {
5714
+ const f = (p) => {
5715
5715
  const g = u.refinement(p, l);
5716
5716
  if (c.common.async)
5717
5717
  return Promise.resolve(g);
@@ -5725,25 +5725,25 @@ class J extends O {
5725
5725
  path: c.path,
5726
5726
  parent: c
5727
5727
  });
5728
- return p.status === "aborted" ? T : (p.status === "dirty" && i.dirty(), h(p.value), { status: i.value, value: p.value });
5728
+ return p.status === "aborted" ? T : (p.status === "dirty" && i.dirty(), f(p.value), { status: i.value, value: p.value });
5729
5729
  } else
5730
- return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((p) => p.status === "aborted" ? T : (p.status === "dirty" && i.dirty(), h(p.value).then(() => ({ status: i.value, value: p.value }))));
5730
+ return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((p) => p.status === "aborted" ? T : (p.status === "dirty" && i.dirty(), f(p.value).then(() => ({ status: i.value, value: p.value }))));
5731
5731
  }
5732
5732
  if (u.type === "transform")
5733
5733
  if (c.common.async === !1) {
5734
- const h = this._def.schema._parseSync({
5734
+ const f = this._def.schema._parseSync({
5735
5735
  data: c.data,
5736
5736
  path: c.path,
5737
5737
  parent: c
5738
5738
  });
5739
- if (!Se(h))
5740
- return h;
5741
- const p = u.transform(h.value, l);
5739
+ if (!Se(f))
5740
+ return f;
5741
+ const p = u.transform(f.value, l);
5742
5742
  if (p instanceof Promise)
5743
5743
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
5744
5744
  return { status: i.value, value: p };
5745
5745
  } else
5746
- return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((h) => Se(h) ? Promise.resolve(u.transform(h.value, l)).then((p) => ({ status: i.value, value: p })) : h);
5746
+ return this._def.schema._parseAsync({ data: c.data, path: c.path, parent: c }).then((f) => Se(f) ? Promise.resolve(u.transform(f.value, l)).then((p) => ({ status: i.value, value: p })) : f);
5747
5747
  I.assertNever(u);
5748
5748
  }
5749
5749
  }
@@ -5935,9 +5935,9 @@ kt.create = (a, r) => new kt({
5935
5935
  });
5936
5936
  function wi(a, r = {}, i) {
5937
5937
  return a ? Ve.create().superRefine((c, u) => {
5938
- var l, h;
5938
+ var l, f;
5939
5939
  if (!a(c)) {
5940
- const p = typeof r == "function" ? r(c) : typeof r == "string" ? { message: r } : r, g = (h = (l = p.fatal) !== null && l !== void 0 ? l : i) !== null && h !== void 0 ? h : !0, y = typeof p == "string" ? { message: p } : p;
5940
+ const p = typeof r == "function" ? r(c) : typeof r == "string" ? { message: r } : r, g = (f = (l = p.fatal) !== null && l !== void 0 ? l : i) !== null && f !== void 0 ? f : !0, y = typeof p == "string" ? { message: p } : p;
5941
5941
  u.addIssue({ code: "custom", ...y, fatal: g });
5942
5942
  }
5943
5943
  }) : Ve.create();
@@ -6161,15 +6161,15 @@ function wf(a) {
6161
6161
  const i = JSON.stringify(a), c = new TextEncoder().encode(i).length, u = 1 * 1024;
6162
6162
  c > u && r.push(`Additional properties too large: ${c} bytes (max: ${u} bytes)`);
6163
6163
  const l = 5;
6164
- function h(g, y = 0) {
6164
+ function f(g, y = 0) {
6165
6165
  if (y > l) return !1;
6166
6166
  if (typeof g == "object" && g !== null && !Array.isArray(g)) {
6167
6167
  for (const E of Object.values(g))
6168
- if (!h(E, y + 1)) return !1;
6168
+ if (!f(E, y + 1)) return !1;
6169
6169
  }
6170
6170
  return !0;
6171
6171
  }
6172
- h(a) || r.push(`Additional properties nested too deeply (max depth: ${l})`);
6172
+ f(a) || r.push(`Additional properties nested too deeply (max depth: ${l})`);
6173
6173
  for (const [g, y] of Object.entries(a))
6174
6174
  if (g.length > 100 && r.push(`Property key '${g}' too long (max: 100 characters)`), typeof y == "string" && y.length > 1e3 && r.push(`Property '${g}' value too long (max: 1000 characters)`), typeof y == "string") {
6175
6175
  const E = [
@@ -6319,14 +6319,14 @@ class xf {
6319
6319
  throw new Error("Enveloped mode is enabled, but stamp is not provided");
6320
6320
  }
6321
6321
  async writeOwnFeedDataByIndexOwned(r, i) {
6322
- const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: h, ownAddress: p } = this.userDetails, g = this.generateUserOwnedFeedId(l, p), y = De.fromString(g);
6323
- await c.makeFeedWriter(y, new ke(h)).uploadPayload(u, JSON.stringify(i), {
6322
+ const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress: p } = this.userDetails, g = this.generateUserOwnedFeedId(l, p), y = De.fromString(g);
6323
+ await c.makeFeedWriter(y, new ke(f)).uploadPayload(u, JSON.stringify(i), {
6324
6324
  index: r
6325
6325
  });
6326
6326
  }
6327
6327
  // TODO: support for wrapped chunks
6328
6328
  async writeOwnFeedDataByIndexEnvelope(r, i) {
6329
- const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: h, ownAddress: p } = this.userDetails, g = new ke(h), y = xn.fromBlank(h, u, this.depth), E = this.generateUserOwnedFeedId(l, p), N = De.fromString(E), re = fi(N, r), ne = ii(i), We = ai(ne, re, g), Oe = {
6329
+ const { bee: c, stamp: u, chatTopic: l } = this.swarmSettings, { privateKey: f, ownAddress: p } = this.userDetails, g = new ke(f), y = xn.fromBlank(f, u, this.depth), E = this.generateUserOwnedFeedId(l, p), N = De.fromString(E), re = fi(N, r), ne = ii(i), We = ai(ne, re, g), Oe = {
6330
6330
  hash: () => We.address.toUint8Array()
6331
6331
  }, Jt = y.stamp(Oe), { upload: Kt } = c.makeSOCWriter(g), He = Pe.fromUtf8(i);
6332
6332
  return (await Kt(Jt, re, He.toUint8Array())).reference.toHex();
@@ -6360,10 +6360,10 @@ class xf {
6360
6360
  }
6361
6361
  async uploadObjectToBeeEnvelope(r) {
6362
6362
  try {
6363
- const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), h = Pe.fromUtf8(JSON.stringify(r)), p = new Jl(async (y) => {
6363
+ const { bee: i, stamp: c } = this.swarmSettings, { privateKey: u } = this.userDetails, l = xn.fromBlank(u, c, this.depth), f = Pe.fromUtf8(JSON.stringify(r)), p = new Jl(async (y) => {
6364
6364
  await i.uploadChunk(l.stamp(y), y.build());
6365
6365
  });
6366
- await p.append(h.toUint8Array());
6366
+ await p.append(f.toUint8Array());
6367
6367
  const g = await p.finalize();
6368
6368
  return B.uint8ArrayToHex(g.hash());
6369
6369
  } catch (i) {
@@ -6381,7 +6381,9 @@ class xf {
6381
6381
  }
6382
6382
  }
6383
6383
  async fetchLatestChatMessage() {
6384
- const { bee: r, chatTopic: i, chatAddress: c } = this.swarmSettings, l = await r.makeFeedReader(De.fromString(i), Tn(c)).downloadPayload();
6384
+ const { bee: r, chatTopic: i, chatAddress: c } = this.swarmSettings, l = await r.makeFeedReader(De.fromString(i), Tn(c), {
6385
+ timeout: 12e3
6386
+ }).downloadPayload();
6385
6387
  return { data: l.payload.toJSON(), index: l.feedIndex };
6386
6388
  }
6387
6389
  async fetchChatMessage(r) {
@@ -6398,25 +6400,33 @@ class xf {
6398
6400
  throw new Error("Enveloped mode is enabled, but stamp is not provided");
6399
6401
  }
6400
6402
  async rawSocDownload(r, i) {
6401
- const { beeUrl: c } = this.swarmSettings, u = await fetch(`${c}/soc/${r}/${i}`, {
6402
- headers: {
6403
- "swarm-chunk-retrieval-timeout": "2000ms"
6403
+ const { beeUrl: c } = this.swarmSettings, u = new AbortController(), l = setTimeout(() => u.abort(), 5e3);
6404
+ try {
6405
+ const f = await fetch(`${c}/soc/${r}/${i}`, {
6406
+ headers: {
6407
+ "swarm-chunk-retrieval-timeout": "2000ms"
6408
+ },
6409
+ signal: u.signal
6410
+ });
6411
+ if (!f.ok) {
6412
+ const p = new Error(`Failed to fetch: ${r}/${i} [${f.status}]`);
6413
+ throw p.status = f.status, p;
6404
6414
  }
6405
- });
6406
- if (!u.ok) {
6407
- const l = new Error(`Failed to fetch: ${r}/${i} [${u.status}]`);
6408
- throw l.status = u.status, l;
6415
+ return await f.text();
6416
+ } catch (f) {
6417
+ throw f.name === "AbortError" ? new Error(`Request timeout: ${r}/${i}`) : f;
6418
+ } finally {
6419
+ clearTimeout(l);
6409
6420
  }
6410
- return u.text();
6411
6421
  }
6412
6422
  async sendMessageToGsocOwn(r) {
6413
- const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, h = new ke(l), p = Bt.fromString(u), g = Pe.fromUtf8(r), { upload: y } = i.makeSOCWriter(h, {
6423
+ const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, f = new ke(l), p = Bt.fromString(u), g = Pe.fromUtf8(r), { upload: y } = i.makeSOCWriter(f, {
6414
6424
  timeout: this.UPLOAD_GSOC_TIMEOUT
6415
6425
  });
6416
6426
  await y(c, p, g.toUint8Array());
6417
6427
  }
6418
6428
  async sendMessageToGsocEnvelope(r) {
6419
- const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, { privateKey: h } = this.userDetails, p = xn.fromBlank(h, c, this.depth), g = new ke(l), y = Bt.fromString(u), E = Pe.fromUtf8(r), N = ii(E.toUint8Array()), re = ai(N, y, g), ne = {
6429
+ const { bee: i, stamp: c, gsocTopic: u, gsocResourceId: l } = this.swarmSettings, { privateKey: f } = this.userDetails, p = xn.fromBlank(f, c, this.depth), g = new ke(l), y = Bt.fromString(u), E = Pe.fromUtf8(r), N = ii(E.toUint8Array()), re = ai(N, y, g), ne = {
6420
6430
  hash: () => re.address.toUint8Array()
6421
6431
  }, We = p.stamp(ne), { upload: Oe } = i.makeSOCWriter(g, {
6422
6432
  timeout: this.UPLOAD_GSOC_TIMEOUT
@@ -6481,7 +6491,7 @@ class Ef {
6481
6491
  return this.utils.orderMessages(r);
6482
6492
  }
6483
6493
  async sendMessage(r, i, c, u, l) {
6484
- const h = this.userDetails.ownIndex === -1 ? 0 : this.userDetails.ownIndex + 1, p = {
6494
+ const f = this.userDetails.ownIndex === -1 ? 0 : this.userDetails.ownIndex + 1, p = {
6485
6495
  id: u || Hl(),
6486
6496
  username: this.userDetails.nickname,
6487
6497
  address: this.userDetails.ownAddress,
@@ -6489,7 +6499,7 @@ class Ef {
6489
6499
  userTopic: this.utils.generateUserOwnedFeedId(this.swarmSettings.chatTopic, this.userDetails.ownAddress),
6490
6500
  signature: this.getSignature(r),
6491
6501
  timestamp: Date.now(),
6492
- index: h,
6502
+ index: f,
6493
6503
  type: i,
6494
6504
  targetMessageId: c,
6495
6505
  message: r,
@@ -6500,7 +6510,7 @@ class Ef {
6500
6510
  throw this.logger.error(y), new Error(y);
6501
6511
  }
6502
6512
  try {
6503
- this.emitter.emit(W.MESSAGE_REQUEST_INITIATED, p), await this.utils.writeOwnFeedDataByIndex(h, JSON.stringify(p)), this.userDetails.ownIndex = h, this.emitter.emit(W.MESSAGE_REQUEST_UPLOADED, p), await this.broadcastUserMessage(p);
6513
+ this.emitter.emit(W.MESSAGE_REQUEST_INITIATED, p), await this.utils.writeOwnFeedDataByIndex(f, JSON.stringify(p)), this.userDetails.ownIndex = f, this.emitter.emit(W.MESSAGE_REQUEST_UPLOADED, p), await this.broadcastUserMessage(p);
6504
6514
  } catch (y) {
6505
6515
  this.emitter.emit(W.MESSAGE_REQUEST_ERROR, p), this.errorHandler.handleError(y, "Chat.sendMessage");
6506
6516
  }
@@ -6544,11 +6554,11 @@ class Ef {
6544
6554
  }
6545
6555
  }
6546
6556
  getSignature(r) {
6547
- const { ownAddress: i, privateKey: c, nickname: u } = this.userDetails, l = new Ll(i).toString(), h = new ke(c);
6548
- if (h.publicKey().address().toString() !== l)
6557
+ const { ownAddress: i, privateKey: c, nickname: u } = this.userDetails, l = new Ll(i).toString(), f = new ke(c);
6558
+ if (f.publicKey().address().toString() !== l)
6549
6559
  throw new Error("The provided address does not match the address derived from the private key");
6550
6560
  const g = Date.now();
6551
- return h.sign(JSON.stringify({ username: u, address: l, message: r, timestamp: g })).toHex();
6561
+ return f.sign(JSON.stringify({ username: u, address: l, message: r, timestamp: g })).toHex();
6552
6562
  }
6553
6563
  }
6554
6564
  export {