document-model 1.0.43 → 1.0.44

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 (33) hide show
  1. package/dist/browser/document-model.cjs +1 -1
  2. package/dist/browser/document-model.js +2 -2
  3. package/dist/browser/document.cjs +1 -1
  4. package/dist/browser/document.js +2 -2
  5. package/dist/browser/index.cjs +1 -1
  6. package/dist/browser/index.js +3 -3
  7. package/dist/browser/internal/{index-CDcO7NCS.js → index-CJWLwwNi.js} +1 -1
  8. package/dist/{node/internal/index-fctxJxHD.js → browser/internal/index-CvQOfeml.js} +1 -1
  9. package/dist/{node/internal/index-D_LMFQg7.js → browser/internal/index-QMhrjNyi.js} +1 -1
  10. package/dist/browser/internal/{index-DhzefrNj.js → index-eSGNXD4L.js} +1 -1
  11. package/dist/browser/internal/{object-CrDRbO7a.js → object-ChusgY57.js} +822 -808
  12. package/dist/browser/internal/object-NkahWZEb.js +25 -0
  13. package/dist/browser/src/document/types.d.ts +2 -0
  14. package/dist/browser/src/document/utils/base.d.ts +7 -2
  15. package/dist/browser/src/document/utils/file.d.ts +3 -2
  16. package/dist/node/document-model.cjs +1 -1
  17. package/dist/node/document-model.js +2 -2
  18. package/dist/node/document.cjs +1 -1
  19. package/dist/node/document.js +2 -2
  20. package/dist/node/index.cjs +1 -1
  21. package/dist/node/index.js +3 -3
  22. package/dist/node/internal/{index-Cz8HaIxu.js → index-CAadnKaJ.js} +1 -1
  23. package/dist/{browser/internal/index-CfgX2mMt.js → node/internal/index-CKwU8URS.js} +1 -1
  24. package/dist/node/internal/{index-BWW7KbVk.js → index-CkYTa7KK.js} +1 -1
  25. package/dist/{browser/internal/index-EdTViyyq.js → node/internal/index-DphjSNet.js} +1 -1
  26. package/dist/node/internal/object-BLNJYMtQ.js +20 -0
  27. package/dist/node/internal/{object-BDRv-l-h.js → object-BsCssWq4.js} +622 -608
  28. package/dist/node/src/document/types.d.ts +2 -0
  29. package/dist/node/src/document/utils/base.d.ts +7 -2
  30. package/dist/node/src/document/utils/file.d.ts +3 -2
  31. package/package.json +2 -5
  32. package/dist/browser/internal/object-BkewFVld.js +0 -25
  33. package/dist/node/internal/object-Br6jYeW0.js +0 -20
@@ -1,161 +1,161 @@
1
- var $e = Object.defineProperty;
2
- var Ce = (i, r, s) => r in i ? $e(i, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[r] = s;
1
+ var De = Object.defineProperty;
2
+ var Ce = (i, r, s) => r in i ? De(i, r, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[r] = s;
3
3
  var At = (i, r, s) => (Ce(i, typeof r != "symbol" ? r + "" : r, s), s);
4
- import { produce as xt, castDraft as Ut, castImmutable as Me, freeze as Ne } from "immer";
5
- import { z as _ } from "zod";
6
- import te from "jszip";
7
- const ee = (i) => i != null, Re = _.any().refine((i) => ee(i)), re = _.enum(["LOAD_STATE"]), ie = _.enum(["PRUNE"]), ne = _.enum(["REDO"]), oe = _.enum(["SET_NAME"]), ae = _.enum(["UNDO"]);
4
+ import { produce as xt, castDraft as Ut, castImmutable as Ne, freeze as Me } from "immer";
5
+ import { z as A } from "zod";
6
+ import ee from "jszip";
7
+ const re = (i) => i != null, Re = A.any().refine((i) => re(i)), ie = A.enum(["LOAD_STATE"]), ne = A.enum(["PRUNE"]), oe = A.enum(["REDO"]), ae = A.enum(["SET_NAME"]), se = A.enum(["UNDO"]);
8
8
  function Le() {
9
- return _.object({
10
- __typename: _.literal("Action").optional(),
11
- type: _.string()
9
+ return A.object({
10
+ __typename: A.literal("Action").optional(),
11
+ type: A.string()
12
12
  });
13
13
  }
14
14
  function dt() {
15
- return _.literal("global").or(_.literal("local"));
15
+ return A.literal("global").or(A.literal("local"));
16
16
  }
17
- function se() {
18
- return _.union([
19
- pe(),
20
- le(),
17
+ function pe() {
18
+ return A.union([
19
+ ce(),
21
20
  ue(),
22
21
  fe(),
23
- he()
22
+ he(),
23
+ me()
24
24
  ]);
25
25
  }
26
26
  function ze() {
27
- return _.object({
28
- __typename: _.literal("DocumentFile").optional(),
29
- data: _.string(),
30
- extension: _.string().nullable(),
31
- fileName: _.string().nullable(),
32
- mimeType: _.string()
27
+ return A.object({
28
+ __typename: A.literal("DocumentFile").optional(),
29
+ data: A.string(),
30
+ extension: A.string().nullable(),
31
+ fileName: A.string().nullable(),
32
+ mimeType: A.string()
33
33
  });
34
34
  }
35
- function pe() {
36
- return _.object({
37
- input: _.lazy(() => Nt()),
38
- type: re,
35
+ function ce() {
36
+ return A.object({
37
+ input: A.lazy(() => Mt()),
38
+ type: ie,
39
39
  scope: dt()
40
40
  });
41
41
  }
42
- function Nt() {
43
- return _.object({
44
- operations: _.number(),
45
- state: _.lazy(() => ce())
42
+ function Mt() {
43
+ return A.object({
44
+ operations: A.number(),
45
+ state: A.lazy(() => le())
46
46
  });
47
47
  }
48
- function ce() {
49
- return _.object({
50
- data: _.unknown().nullish(),
51
- name: _.string()
48
+ function le() {
49
+ return A.object({
50
+ data: A.unknown().nullish(),
51
+ name: A.string()
52
52
  });
53
53
  }
54
54
  function Pe() {
55
- return _.object({
56
- __typename: _.literal("Operation").optional(),
57
- hash: _.string(),
58
- index: _.number(),
59
- timestamp: _.string().datetime(),
60
- type: _.string()
55
+ return A.object({
56
+ __typename: A.literal("Operation").optional(),
57
+ hash: A.string(),
58
+ index: A.number(),
59
+ timestamp: A.string().datetime(),
60
+ type: A.string()
61
61
  });
62
62
  }
63
- function le() {
64
- return _.object({
65
- input: _.lazy(() => Rt()),
66
- type: ie,
63
+ function ue() {
64
+ return A.object({
65
+ input: A.lazy(() => Rt()),
66
+ type: ne,
67
67
  scope: dt()
68
68
  });
69
69
  }
70
70
  function Rt() {
71
- return _.object({
72
- end: _.number().nullish(),
73
- start: _.number().nullish()
71
+ return A.object({
72
+ end: A.number().nullish(),
73
+ start: A.number().nullish()
74
74
  });
75
75
  }
76
- const Lt = _.number;
77
- function ue() {
78
- return _.object({
76
+ const Lt = A.number;
77
+ function fe() {
78
+ return A.object({
79
79
  input: Lt(),
80
- type: ne,
80
+ type: oe,
81
81
  scope: dt()
82
82
  });
83
83
  }
84
- const zt = _.string;
85
- function fe() {
86
- return _.object({
84
+ const zt = A.string;
85
+ function he() {
86
+ return A.object({
87
87
  input: zt(),
88
- type: oe,
89
- scope: _.literal("global")
88
+ type: ae,
89
+ scope: A.literal("global")
90
90
  });
91
91
  }
92
92
  function qe() {
93
- return _.object({
94
- __typename: _.literal("SetNameOperation").optional(),
95
- hash: _.string(),
96
- index: _.number(),
97
- input: _.string(),
98
- timestamp: _.string().datetime(),
99
- type: _.string()
93
+ return A.object({
94
+ __typename: A.literal("SetNameOperation").optional(),
95
+ hash: A.string(),
96
+ index: A.number(),
97
+ input: A.string(),
98
+ timestamp: A.string().datetime(),
99
+ type: A.string()
100
100
  });
101
101
  }
102
- const Pt = _.number;
103
- function he() {
104
- return _.object({
102
+ const Pt = A.number;
103
+ function me() {
104
+ return A.object({
105
105
  input: Pt(),
106
- type: ae,
106
+ type: se,
107
107
  scope: dt()
108
108
  });
109
109
  }
110
110
  const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
111
111
  __proto__: null,
112
112
  ActionSchema: Le,
113
- BaseActionSchema: se,
113
+ BaseActionSchema: pe,
114
114
  DocumentFileSchema: ze,
115
- LoadStateActionInputSchema: Nt,
116
- LoadStateActionSchema: pe,
117
- LoadStateActionStateInputSchema: ce,
118
- Load_StateSchema: re,
115
+ LoadStateActionInputSchema: Mt,
116
+ LoadStateActionSchema: ce,
117
+ LoadStateActionStateInputSchema: le,
118
+ Load_StateSchema: ie,
119
119
  OperationSchema: Pe,
120
120
  OperationScopeSchema: dt,
121
121
  PruneActionInputSchema: Rt,
122
- PruneActionSchema: le,
123
- PruneSchema: ie,
122
+ PruneActionSchema: ue,
123
+ PruneSchema: ne,
124
124
  RedoActionInputSchema: Lt,
125
- RedoActionSchema: ue,
126
- RedoSchema: ne,
125
+ RedoActionSchema: fe,
126
+ RedoSchema: oe,
127
127
  SetNameActionInputSchema: zt,
128
- SetNameActionSchema: fe,
128
+ SetNameActionSchema: he,
129
129
  SetNameOperationSchema: qe,
130
- Set_NameSchema: oe,
130
+ Set_NameSchema: ae,
131
131
  UndoActionInputSchema: Pt,
132
- UndoActionSchema: he,
133
- UndoSchema: ae,
132
+ UndoActionSchema: me,
133
+ UndoSchema: se,
134
134
  definedNonNullAnySchema: Re,
135
- isDefinedNonNullAny: ee
135
+ isDefinedNonNullAny: re
136
136
  }, Symbol.toStringTag, { value: "Module" }));
137
137
  function qt(i) {
138
138
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
139
139
  }
140
- var Dt = { exports: {} };
140
+ var $t = { exports: {} };
141
141
  (function(i, r) {
142
- const { hasOwnProperty: s } = Object.prototype, p = rt();
143
- p.configure = rt, p.stringify = p, p.default = p, r.stringify = p, r.configure = rt, i.exports = p;
142
+ const { hasOwnProperty: s } = Object.prototype, p = R();
143
+ p.configure = R, p.stringify = p, p.default = p, r.stringify = p, r.configure = R, i.exports = p;
144
144
  const f = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
145
- function u(y) {
146
- return y.length < 5e3 && !f.test(y) ? `"${y}"` : JSON.stringify(y);
147
- }
148
- function l(y) {
149
- if (y.length > 200)
150
- return y.sort();
151
- for (let E = 1; E < y.length; E++) {
152
- const k = y[E];
153
- let q = E;
154
- for (; q !== 0 && y[q - 1] > k; )
155
- y[q] = y[q - 1], q--;
156
- y[q] = k;
145
+ function u(g) {
146
+ return g.length < 5e3 && !f.test(g) ? `"${g}"` : JSON.stringify(g);
147
+ }
148
+ function l(g) {
149
+ if (g.length > 200)
150
+ return g.sort();
151
+ for (let b = 1; b < g.length; b++) {
152
+ const O = g[b];
153
+ let P = b;
154
+ for (; P !== 0 && g[P - 1] > O; )
155
+ g[P] = g[P - 1], P--;
156
+ g[P] = O;
157
157
  }
158
- return y;
158
+ return g;
159
159
  }
160
160
  const a = Object.getOwnPropertyDescriptor(
161
161
  Object.getPrototypeOf(
@@ -165,25 +165,25 @@ var Dt = { exports: {} };
165
165
  ),
166
166
  Symbol.toStringTag
167
167
  ).get;
168
- function x(y) {
169
- return a.call(y) !== void 0 && y.length !== 0;
170
- }
171
- function g(y, E, k) {
172
- y.length < k && (k = y.length);
173
- const q = E === "," ? "" : " ";
174
- let Z = `"0":${q}${y[0]}`;
175
- for (let H = 1; H < k; H++)
176
- Z += `${E}"${H}":${q}${y[H]}`;
177
- return Z;
178
- }
179
- function A(y) {
180
- if (s.call(y, "circularValue")) {
181
- const E = y.circularValue;
182
- if (typeof E == "string")
183
- return `"${E}"`;
184
- if (E == null)
185
- return E;
186
- if (E === Error || E === TypeError)
168
+ function h(g) {
169
+ return a.call(g) !== void 0 && g.length !== 0;
170
+ }
171
+ function y(g, b, O) {
172
+ g.length < O && (O = g.length);
173
+ const P = b === "," ? "" : " ";
174
+ let K = `"0":${P}${g[0]}`;
175
+ for (let Y = 1; Y < O; Y++)
176
+ K += `${b}"${Y}":${P}${g[Y]}`;
177
+ return K;
178
+ }
179
+ function w(g) {
180
+ if (s.call(g, "circularValue")) {
181
+ const b = g.circularValue;
182
+ if (typeof b == "string")
183
+ return `"${b}"`;
184
+ if (b == null)
185
+ return b;
186
+ if (b === Error || b === TypeError)
187
187
  return {
188
188
  toString() {
189
189
  throw new TypeError("Converting circular structure to JSON");
@@ -193,338 +193,338 @@ var Dt = { exports: {} };
193
193
  }
194
194
  return '"[Circular]"';
195
195
  }
196
- function w(y, E) {
197
- let k;
198
- if (s.call(y, E) && (k = y[E], typeof k != "boolean"))
199
- throw new TypeError(`The "${E}" argument must be of type boolean`);
200
- return k === void 0 ? !0 : k;
201
- }
202
- function b(y, E) {
203
- let k;
204
- if (s.call(y, E)) {
205
- if (k = y[E], typeof k != "number")
206
- throw new TypeError(`The "${E}" argument must be of type number`);
207
- if (!Number.isInteger(k))
208
- throw new TypeError(`The "${E}" argument must be an integer`);
209
- if (k < 1)
210
- throw new RangeError(`The "${E}" argument must be >= 1`);
196
+ function _(g, b) {
197
+ let O;
198
+ if (s.call(g, b) && (O = g[b], typeof O != "boolean"))
199
+ throw new TypeError(`The "${b}" argument must be of type boolean`);
200
+ return O === void 0 ? !0 : O;
201
+ }
202
+ function v(g, b) {
203
+ let O;
204
+ if (s.call(g, b)) {
205
+ if (O = g[b], typeof O != "number")
206
+ throw new TypeError(`The "${b}" argument must be of type number`);
207
+ if (!Number.isInteger(O))
208
+ throw new TypeError(`The "${b}" argument must be an integer`);
209
+ if (O < 1)
210
+ throw new RangeError(`The "${b}" argument must be >= 1`);
211
211
  }
212
- return k === void 0 ? 1 / 0 : k;
212
+ return O === void 0 ? 1 / 0 : O;
213
213
  }
214
- function F(y) {
215
- return y === 1 ? "1 item" : `${y} items`;
214
+ function B(g) {
215
+ return g === 1 ? "1 item" : `${g} items`;
216
216
  }
217
- function I(y) {
218
- const E = /* @__PURE__ */ new Set();
219
- for (const k of y)
220
- (typeof k == "string" || typeof k == "number") && E.add(String(k));
221
- return E;
217
+ function W(g) {
218
+ const b = /* @__PURE__ */ new Set();
219
+ for (const O of g)
220
+ (typeof O == "string" || typeof O == "number") && b.add(String(O));
221
+ return b;
222
222
  }
223
- function G(y) {
224
- if (s.call(y, "strict")) {
225
- const E = y.strict;
226
- if (typeof E != "boolean")
223
+ function C(g) {
224
+ if (s.call(g, "strict")) {
225
+ const b = g.strict;
226
+ if (typeof b != "boolean")
227
227
  throw new TypeError('The "strict" argument must be of type boolean');
228
- if (E)
229
- return (k) => {
230
- let q = `Object can not safely be stringified. Received type ${typeof k}`;
231
- throw typeof k != "function" && (q += ` (${k.toString()})`), new Error(q);
228
+ if (b)
229
+ return (O) => {
230
+ let P = `Object can not safely be stringified. Received type ${typeof O}`;
231
+ throw typeof O != "function" && (P += ` (${O.toString()})`), new Error(P);
232
232
  };
233
233
  }
234
234
  }
235
- function rt(y) {
236
- y = { ...y };
237
- const E = G(y);
238
- E && (y.bigint === void 0 && (y.bigint = !1), "circularValue" in y || (y.circularValue = Error));
239
- const k = A(y), q = w(y, "bigint"), Z = w(y, "deterministic"), H = b(y, "maximumDepth"), N = b(y, "maximumBreadth");
240
- function ct(J, h, v, T, j, $) {
241
- let S = h[J];
242
- switch (typeof S == "object" && S !== null && typeof S.toJSON == "function" && (S = S.toJSON(J)), S = T.call(h, J, S), typeof S) {
235
+ function R(g) {
236
+ g = { ...g };
237
+ const b = C(g);
238
+ b && (g.bigint === void 0 && (g.bigint = !1), "circularValue" in g || (g.circularValue = Error));
239
+ const O = w(g), P = _(g, "bigint"), K = _(g, "deterministic"), Y = v(g, "maximumDepth"), M = v(g, "maximumBreadth");
240
+ function ct(V, m, E, T, j, $) {
241
+ let S = m[V];
242
+ switch (typeof S == "object" && S !== null && typeof S.toJSON == "function" && (S = S.toJSON(V)), S = T.call(m, V, S), typeof S) {
243
243
  case "string":
244
244
  return u(S);
245
245
  case "object": {
246
246
  if (S === null)
247
247
  return "null";
248
- if (v.indexOf(S) !== -1)
249
- return k;
250
- let U = "", B = ",";
251
- const O = $;
248
+ if (E.indexOf(S) !== -1)
249
+ return O;
250
+ let k = "", F = ",";
251
+ const I = $;
252
252
  if (Array.isArray(S)) {
253
253
  if (S.length === 0)
254
254
  return "[]";
255
- if (H < v.length + 1)
255
+ if (Y < E.length + 1)
256
256
  return '"[Array]"';
257
- v.push(S), j !== "" && ($ += j, U += `
258
- ${$}`, B = `,
257
+ E.push(S), j !== "" && ($ += j, k += `
258
+ ${$}`, F = `,
259
259
  ${$}`);
260
- const W = Math.min(S.length, N);
261
- let X = 0;
262
- for (; X < W - 1; X++) {
263
- const st = ct(String(X), S, v, T, j, $);
264
- U += st !== void 0 ? st : "null", U += B;
260
+ const H = Math.min(S.length, M);
261
+ let Q = 0;
262
+ for (; Q < H - 1; Q++) {
263
+ const st = ct(String(Q), S, E, T, j, $);
264
+ k += st !== void 0 ? st : "null", k += F;
265
265
  }
266
- const Q = ct(String(X), S, v, T, j, $);
267
- if (U += Q !== void 0 ? Q : "null", S.length - 1 > N) {
268
- const st = S.length - N - 1;
269
- U += `${B}"... ${F(st)} not stringified"`;
266
+ const tt = ct(String(Q), S, E, T, j, $);
267
+ if (k += tt !== void 0 ? tt : "null", S.length - 1 > M) {
268
+ const st = S.length - M - 1;
269
+ k += `${F}"... ${B(st)} not stringified"`;
270
270
  }
271
- return j !== "" && (U += `
272
- ${O}`), v.pop(), `[${U}]`;
271
+ return j !== "" && (k += `
272
+ ${I}`), E.pop(), `[${k}]`;
273
273
  }
274
- let R = Object.keys(S);
275
- const P = R.length;
276
- if (P === 0)
274
+ let L = Object.keys(S);
275
+ const J = L.length;
276
+ if (J === 0)
277
277
  return "{}";
278
- if (H < v.length + 1)
278
+ if (Y < E.length + 1)
279
279
  return '"[Object]"';
280
- let C = "", V = "";
281
- j !== "" && ($ += j, B = `,
282
- ${$}`, C = " ");
283
- const Y = Math.min(P, N);
284
- Z && !x(S) && (R = l(R)), v.push(S);
285
- for (let W = 0; W < Y; W++) {
286
- const X = R[W], Q = ct(X, S, v, T, j, $);
287
- Q !== void 0 && (U += `${V}${u(X)}:${C}${Q}`, V = B);
280
+ let D = "", Z = "";
281
+ j !== "" && ($ += j, F = `,
282
+ ${$}`, D = " ");
283
+ const X = Math.min(J, M);
284
+ K && !h(S) && (L = l(L)), E.push(S);
285
+ for (let H = 0; H < X; H++) {
286
+ const Q = L[H], tt = ct(Q, S, E, T, j, $);
287
+ tt !== void 0 && (k += `${Z}${u(Q)}:${D}${tt}`, Z = F);
288
288
  }
289
- if (P > N) {
290
- const W = P - N;
291
- U += `${V}"...":${C}"${F(W)} not stringified"`, V = B;
289
+ if (J > M) {
290
+ const H = J - M;
291
+ k += `${Z}"...":${D}"${B(H)} not stringified"`, Z = F;
292
292
  }
293
- return j !== "" && V.length > 1 && (U = `
294
- ${$}${U}
295
- ${O}`), v.pop(), `{${U}}`;
293
+ return j !== "" && Z.length > 1 && (k = `
294
+ ${$}${k}
295
+ ${I}`), E.pop(), `{${k}}`;
296
296
  }
297
297
  case "number":
298
- return isFinite(S) ? String(S) : E ? E(S) : "null";
298
+ return isFinite(S) ? String(S) : b ? b(S) : "null";
299
299
  case "boolean":
300
300
  return S === !0 ? "true" : "false";
301
301
  case "undefined":
302
302
  return;
303
303
  case "bigint":
304
- if (q)
304
+ if (P)
305
305
  return String(S);
306
306
  default:
307
- return E ? E(S) : void 0;
307
+ return b ? b(S) : void 0;
308
308
  }
309
309
  }
310
- function lt(J, h, v, T, j, $) {
311
- switch (typeof h == "object" && h !== null && typeof h.toJSON == "function" && (h = h.toJSON(J)), typeof h) {
310
+ function lt(V, m, E, T, j, $) {
311
+ switch (typeof m == "object" && m !== null && typeof m.toJSON == "function" && (m = m.toJSON(V)), typeof m) {
312
312
  case "string":
313
- return u(h);
313
+ return u(m);
314
314
  case "object": {
315
- if (h === null)
315
+ if (m === null)
316
316
  return "null";
317
- if (v.indexOf(h) !== -1)
318
- return k;
317
+ if (E.indexOf(m) !== -1)
318
+ return O;
319
319
  const S = $;
320
- let U = "", B = ",";
321
- if (Array.isArray(h)) {
322
- if (h.length === 0)
320
+ let k = "", F = ",";
321
+ if (Array.isArray(m)) {
322
+ if (m.length === 0)
323
323
  return "[]";
324
- if (H < v.length + 1)
324
+ if (Y < E.length + 1)
325
325
  return '"[Array]"';
326
- v.push(h), j !== "" && ($ += j, U += `
327
- ${$}`, B = `,
326
+ E.push(m), j !== "" && ($ += j, k += `
327
+ ${$}`, F = `,
328
328
  ${$}`);
329
- const P = Math.min(h.length, N);
330
- let C = 0;
331
- for (; C < P - 1; C++) {
332
- const Y = lt(String(C), h[C], v, T, j, $);
333
- U += Y !== void 0 ? Y : "null", U += B;
329
+ const J = Math.min(m.length, M);
330
+ let D = 0;
331
+ for (; D < J - 1; D++) {
332
+ const X = lt(String(D), m[D], E, T, j, $);
333
+ k += X !== void 0 ? X : "null", k += F;
334
334
  }
335
- const V = lt(String(C), h[C], v, T, j, $);
336
- if (U += V !== void 0 ? V : "null", h.length - 1 > N) {
337
- const Y = h.length - N - 1;
338
- U += `${B}"... ${F(Y)} not stringified"`;
335
+ const Z = lt(String(D), m[D], E, T, j, $);
336
+ if (k += Z !== void 0 ? Z : "null", m.length - 1 > M) {
337
+ const X = m.length - M - 1;
338
+ k += `${F}"... ${B(X)} not stringified"`;
339
339
  }
340
- return j !== "" && (U += `
341
- ${S}`), v.pop(), `[${U}]`;
340
+ return j !== "" && (k += `
341
+ ${S}`), E.pop(), `[${k}]`;
342
342
  }
343
- v.push(h);
344
- let O = "";
345
- j !== "" && ($ += j, B = `,
346
- ${$}`, O = " ");
347
- let R = "";
348
- for (const P of T) {
349
- const C = lt(P, h[P], v, T, j, $);
350
- C !== void 0 && (U += `${R}${u(P)}:${O}${C}`, R = B);
343
+ E.push(m);
344
+ let I = "";
345
+ j !== "" && ($ += j, F = `,
346
+ ${$}`, I = " ");
347
+ let L = "";
348
+ for (const J of T) {
349
+ const D = lt(J, m[J], E, T, j, $);
350
+ D !== void 0 && (k += `${L}${u(J)}:${I}${D}`, L = F);
351
351
  }
352
- return j !== "" && R.length > 1 && (U = `
353
- ${$}${U}
354
- ${S}`), v.pop(), `{${U}}`;
352
+ return j !== "" && L.length > 1 && (k = `
353
+ ${$}${k}
354
+ ${S}`), E.pop(), `{${k}}`;
355
355
  }
356
356
  case "number":
357
- return isFinite(h) ? String(h) : E ? E(h) : "null";
357
+ return isFinite(m) ? String(m) : b ? b(m) : "null";
358
358
  case "boolean":
359
- return h === !0 ? "true" : "false";
359
+ return m === !0 ? "true" : "false";
360
360
  case "undefined":
361
361
  return;
362
362
  case "bigint":
363
- if (q)
364
- return String(h);
363
+ if (P)
364
+ return String(m);
365
365
  default:
366
- return E ? E(h) : void 0;
366
+ return b ? b(m) : void 0;
367
367
  }
368
368
  }
369
- function ot(J, h, v, T, j) {
370
- switch (typeof h) {
369
+ function ot(V, m, E, T, j) {
370
+ switch (typeof m) {
371
371
  case "string":
372
- return u(h);
372
+ return u(m);
373
373
  case "object": {
374
- if (h === null)
374
+ if (m === null)
375
375
  return "null";
376
- if (typeof h.toJSON == "function") {
377
- if (h = h.toJSON(J), typeof h != "object")
378
- return ot(J, h, v, T, j);
379
- if (h === null)
376
+ if (typeof m.toJSON == "function") {
377
+ if (m = m.toJSON(V), typeof m != "object")
378
+ return ot(V, m, E, T, j);
379
+ if (m === null)
380
380
  return "null";
381
381
  }
382
- if (v.indexOf(h) !== -1)
383
- return k;
382
+ if (E.indexOf(m) !== -1)
383
+ return O;
384
384
  const $ = j;
385
- if (Array.isArray(h)) {
386
- if (h.length === 0)
385
+ if (Array.isArray(m)) {
386
+ if (m.length === 0)
387
387
  return "[]";
388
- if (H < v.length + 1)
388
+ if (Y < E.length + 1)
389
389
  return '"[Array]"';
390
- v.push(h), j += T;
391
- let C = `
390
+ E.push(m), j += T;
391
+ let D = `
392
392
  ${j}`;
393
- const V = `,
394
- ${j}`, Y = Math.min(h.length, N);
395
- let W = 0;
396
- for (; W < Y - 1; W++) {
397
- const Q = ot(String(W), h[W], v, T, j);
398
- C += Q !== void 0 ? Q : "null", C += V;
393
+ const Z = `,
394
+ ${j}`, X = Math.min(m.length, M);
395
+ let H = 0;
396
+ for (; H < X - 1; H++) {
397
+ const tt = ot(String(H), m[H], E, T, j);
398
+ D += tt !== void 0 ? tt : "null", D += Z;
399
399
  }
400
- const X = ot(String(W), h[W], v, T, j);
401
- if (C += X !== void 0 ? X : "null", h.length - 1 > N) {
402
- const Q = h.length - N - 1;
403
- C += `${V}"... ${F(Q)} not stringified"`;
400
+ const Q = ot(String(H), m[H], E, T, j);
401
+ if (D += Q !== void 0 ? Q : "null", m.length - 1 > M) {
402
+ const tt = m.length - M - 1;
403
+ D += `${Z}"... ${B(tt)} not stringified"`;
404
404
  }
405
- return C += `
406
- ${$}`, v.pop(), `[${C}]`;
405
+ return D += `
406
+ ${$}`, E.pop(), `[${D}]`;
407
407
  }
408
- let S = Object.keys(h);
409
- const U = S.length;
410
- if (U === 0)
408
+ let S = Object.keys(m);
409
+ const k = S.length;
410
+ if (k === 0)
411
411
  return "{}";
412
- if (H < v.length + 1)
412
+ if (Y < E.length + 1)
413
413
  return '"[Object]"';
414
414
  j += T;
415
- const B = `,
415
+ const F = `,
416
416
  ${j}`;
417
- let O = "", R = "", P = Math.min(U, N);
418
- x(h) && (O += g(h, B, N), S = S.slice(h.length), P -= h.length, R = B), Z && (S = l(S)), v.push(h);
419
- for (let C = 0; C < P; C++) {
420
- const V = S[C], Y = ot(V, h[V], v, T, j);
421
- Y !== void 0 && (O += `${R}${u(V)}: ${Y}`, R = B);
417
+ let I = "", L = "", J = Math.min(k, M);
418
+ h(m) && (I += y(m, F, M), S = S.slice(m.length), J -= m.length, L = F), K && (S = l(S)), E.push(m);
419
+ for (let D = 0; D < J; D++) {
420
+ const Z = S[D], X = ot(Z, m[Z], E, T, j);
421
+ X !== void 0 && (I += `${L}${u(Z)}: ${X}`, L = F);
422
422
  }
423
- if (U > N) {
424
- const C = U - N;
425
- O += `${R}"...": "${F(C)} not stringified"`, R = B;
423
+ if (k > M) {
424
+ const D = k - M;
425
+ I += `${L}"...": "${B(D)} not stringified"`, L = F;
426
426
  }
427
- return R !== "" && (O = `
428
- ${j}${O}
429
- ${$}`), v.pop(), `{${O}}`;
427
+ return L !== "" && (I = `
428
+ ${j}${I}
429
+ ${$}`), E.pop(), `{${I}}`;
430
430
  }
431
431
  case "number":
432
- return isFinite(h) ? String(h) : E ? E(h) : "null";
432
+ return isFinite(m) ? String(m) : b ? b(m) : "null";
433
433
  case "boolean":
434
- return h === !0 ? "true" : "false";
434
+ return m === !0 ? "true" : "false";
435
435
  case "undefined":
436
436
  return;
437
437
  case "bigint":
438
- if (q)
439
- return String(h);
438
+ if (P)
439
+ return String(m);
440
440
  default:
441
- return E ? E(h) : void 0;
441
+ return b ? b(m) : void 0;
442
442
  }
443
443
  }
444
- function at(J, h, v) {
445
- switch (typeof h) {
444
+ function at(V, m, E) {
445
+ switch (typeof m) {
446
446
  case "string":
447
- return u(h);
447
+ return u(m);
448
448
  case "object": {
449
- if (h === null)
449
+ if (m === null)
450
450
  return "null";
451
- if (typeof h.toJSON == "function") {
452
- if (h = h.toJSON(J), typeof h != "object")
453
- return at(J, h, v);
454
- if (h === null)
451
+ if (typeof m.toJSON == "function") {
452
+ if (m = m.toJSON(V), typeof m != "object")
453
+ return at(V, m, E);
454
+ if (m === null)
455
455
  return "null";
456
456
  }
457
- if (v.indexOf(h) !== -1)
458
- return k;
457
+ if (E.indexOf(m) !== -1)
458
+ return O;
459
459
  let T = "";
460
- if (Array.isArray(h)) {
461
- if (h.length === 0)
460
+ if (Array.isArray(m)) {
461
+ if (m.length === 0)
462
462
  return "[]";
463
- if (H < v.length + 1)
463
+ if (Y < E.length + 1)
464
464
  return '"[Array]"';
465
- v.push(h);
466
- const B = Math.min(h.length, N);
467
- let O = 0;
468
- for (; O < B - 1; O++) {
469
- const P = at(String(O), h[O], v);
470
- T += P !== void 0 ? P : "null", T += ",";
465
+ E.push(m);
466
+ const F = Math.min(m.length, M);
467
+ let I = 0;
468
+ for (; I < F - 1; I++) {
469
+ const J = at(String(I), m[I], E);
470
+ T += J !== void 0 ? J : "null", T += ",";
471
471
  }
472
- const R = at(String(O), h[O], v);
473
- if (T += R !== void 0 ? R : "null", h.length - 1 > N) {
474
- const P = h.length - N - 1;
475
- T += `,"... ${F(P)} not stringified"`;
472
+ const L = at(String(I), m[I], E);
473
+ if (T += L !== void 0 ? L : "null", m.length - 1 > M) {
474
+ const J = m.length - M - 1;
475
+ T += `,"... ${B(J)} not stringified"`;
476
476
  }
477
- return v.pop(), `[${T}]`;
477
+ return E.pop(), `[${T}]`;
478
478
  }
479
- let j = Object.keys(h);
479
+ let j = Object.keys(m);
480
480
  const $ = j.length;
481
481
  if ($ === 0)
482
482
  return "{}";
483
- if (H < v.length + 1)
483
+ if (Y < E.length + 1)
484
484
  return '"[Object]"';
485
- let S = "", U = Math.min($, N);
486
- x(h) && (T += g(h, ",", N), j = j.slice(h.length), U -= h.length, S = ","), Z && (j = l(j)), v.push(h);
487
- for (let B = 0; B < U; B++) {
488
- const O = j[B], R = at(O, h[O], v);
489
- R !== void 0 && (T += `${S}${u(O)}:${R}`, S = ",");
485
+ let S = "", k = Math.min($, M);
486
+ h(m) && (T += y(m, ",", M), j = j.slice(m.length), k -= m.length, S = ","), K && (j = l(j)), E.push(m);
487
+ for (let F = 0; F < k; F++) {
488
+ const I = j[F], L = at(I, m[I], E);
489
+ L !== void 0 && (T += `${S}${u(I)}:${L}`, S = ",");
490
490
  }
491
- if ($ > N) {
492
- const B = $ - N;
493
- T += `${S}"...":"${F(B)} not stringified"`;
491
+ if ($ > M) {
492
+ const F = $ - M;
493
+ T += `${S}"...":"${B(F)} not stringified"`;
494
494
  }
495
- return v.pop(), `{${T}}`;
495
+ return E.pop(), `{${T}}`;
496
496
  }
497
497
  case "number":
498
- return isFinite(h) ? String(h) : E ? E(h) : "null";
498
+ return isFinite(m) ? String(m) : b ? b(m) : "null";
499
499
  case "boolean":
500
- return h === !0 ? "true" : "false";
500
+ return m === !0 ? "true" : "false";
501
501
  case "undefined":
502
502
  return;
503
503
  case "bigint":
504
- if (q)
505
- return String(h);
504
+ if (P)
505
+ return String(m);
506
506
  default:
507
- return E ? E(h) : void 0;
507
+ return b ? b(m) : void 0;
508
508
  }
509
509
  }
510
- function It(J, h, v) {
510
+ function It(V, m, E) {
511
511
  if (arguments.length > 1) {
512
512
  let T = "";
513
- if (typeof v == "number" ? T = " ".repeat(Math.min(v, 10)) : typeof v == "string" && (T = v.slice(0, 10)), h != null) {
514
- if (typeof h == "function")
515
- return ct("", { "": J }, [], h, T, "");
516
- if (Array.isArray(h))
517
- return lt("", J, [], I(h), T, "");
513
+ if (typeof E == "number" ? T = " ".repeat(Math.min(E, 10)) : typeof E == "string" && (T = E.slice(0, 10)), m != null) {
514
+ if (typeof m == "function")
515
+ return ct("", { "": V }, [], m, T, "");
516
+ if (Array.isArray(m))
517
+ return lt("", V, [], W(m), T, "");
518
518
  }
519
519
  if (T.length !== 0)
520
- return ot("", J, [], T, "");
520
+ return ot("", V, [], T, "");
521
521
  }
522
- return at("", J, []);
522
+ return at("", V, []);
523
523
  }
524
524
  return It;
525
525
  }
526
- })(Dt, Dt.exports);
527
- var Je = Dt.exports;
526
+ })($t, $t.exports);
527
+ var Je = $t.exports;
528
528
  const St = /* @__PURE__ */ qt(Je);
529
529
  St.configure;
530
530
  function We(i, r) {
@@ -540,7 +540,7 @@ function Ve(i, r, s) {
540
540
  r.skip && r.skip > 0 && (u.skip = r.skip), l.type === "NOOP" && r.index === l.index && u.skip > l.skip && u.document.operations[f].pop();
541
541
  });
542
542
  }
543
- function Ke(i, r, s) {
543
+ function He(i, r, s) {
544
544
  const { scope: p, input: f } = r;
545
545
  return xt({
546
546
  document: i,
@@ -559,30 +559,30 @@ function Ke(i, r, s) {
559
559
  throw new Error(
560
560
  "Cannot undo: skip value from reducer cannot be used with UNDO action"
561
561
  );
562
- const [a] = l.document.operations[p].slice(-1), x = a.type === "NOOP" && a.skip > 0;
563
- if (l.skip += f, x) {
562
+ const [a] = l.document.operations[p].slice(-1), h = a.type === "NOOP" && a.skip > 0;
563
+ if (l.skip += f, h) {
564
564
  l.skip += a.skip;
565
- const b = l.document.operations[p][l.document.operations[p].length - 2];
566
- b && a.index - b.index === 1 && l.document.operations[p].pop();
565
+ const v = l.document.operations[p][l.document.operations[p].length - 2];
566
+ v && a.index - v.index === 1 && l.document.operations[p].pop();
567
567
  }
568
568
  if (l.document.operations[p].length < l.skip)
569
569
  throw new Error(
570
570
  "Cannot undo: you can't undo more operations than the ones in the scope history"
571
571
  );
572
- const g = l.document.operations[p].length - 1;
573
- let A = f, w = x ? g - a.skip : g;
574
- for (; A > 0 && w >= 0; ) {
575
- const b = l.document.operations[p][w];
576
- if (!b) {
577
- A--, w--;
572
+ const y = l.document.operations[p].length - 1;
573
+ let w = f, _ = h ? y - a.skip : y;
574
+ for (; w > 0 && _ >= 0; ) {
575
+ const v = l.document.operations[p][_];
576
+ if (!v) {
577
+ w--, _--;
578
578
  continue;
579
579
  }
580
- b.type === "NOOP" && b.skip > 0 ? (w = w - (b.skip + 1), l.skip += b.skip + 1) : (l.document.clipboard.push({ ...b }), A--, w--);
580
+ v.type === "NOOP" && v.skip > 0 ? (_ = _ - (v.skip + 1), l.skip += v.skip + 1) : (l.document.clipboard.push({ ...v }), w--, _--);
581
581
  }
582
- l.action = Ht(p);
582
+ l.action = Zt(p);
583
583
  });
584
584
  }
585
- function He(i, r, s) {
585
+ function Ke(i, r, s) {
586
586
  const { scope: p, input: f } = r;
587
587
  return xt({
588
588
  document: i,
@@ -602,17 +602,17 @@ function He(i, r, s) {
602
602
  if (l.document.clipboard.length < 1)
603
603
  throw new Error("Cannot redo: no operations in the clipboard");
604
604
  const a = l.document.clipboard.findLastIndex(
605
- (g) => g.scope === p
605
+ (y) => y.scope === p
606
606
  );
607
607
  if (a < 0)
608
608
  throw new Error(
609
609
  `Cannot redo: no operations in clipboard for scope "${p}"`
610
610
  );
611
- const x = l.document.clipboard.splice(a, 1)[0];
611
+ const h = l.document.clipboard.splice(a, 1)[0];
612
612
  l.action = Ut({
613
- type: x.type,
614
- scope: x.scope,
615
- input: x.input
613
+ type: h.type,
614
+ scope: h.scope,
615
+ input: h.input
616
616
  });
617
617
  });
618
618
  }
@@ -622,32 +622,32 @@ function Ze(i, r, s) {
622
622
  input: { start: u, end: l }
623
623
  } = r;
624
624
  u = u || 0, l = l || f.length;
625
- const a = f.slice(u, l), x = f.slice(0, u), g = f.slice(l), A = Mt(
625
+ const a = f.slice(u, l), h = f.slice(0, u), y = f.slice(l), w = Nt(
626
626
  i.initialState,
627
627
  {
628
628
  ...i.operations,
629
- [p]: x.concat(a)
629
+ [p]: h.concat(a)
630
630
  },
631
631
  s
632
- ), { name: w, state: b } = A, F = x.length, I = x.length ? x[x.length - 1].timestamp : g.length ? g[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
633
- return Mt(
632
+ ), { name: _, state: v } = w, B = h.length, W = h.length ? h[h.length - 1].timestamp : y.length ? y[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
633
+ return Nt(
634
634
  i.initialState,
635
635
  {
636
636
  ...i.operations,
637
637
  [p]: [
638
- ...x,
638
+ ...h,
639
639
  {
640
640
  ...Kt(
641
- { name: w, state: b },
641
+ { name: _, state: v },
642
642
  a.length
643
643
  ),
644
- timestamp: I,
645
- index: F,
646
- hash: Se({ state: b }, "global")
644
+ timestamp: W,
645
+ index: B,
646
+ hash: Ht({ state: v }, "global")
647
647
  },
648
- ...g.map((G, rt) => ({
649
- ...G,
650
- index: F + rt + 1
648
+ ...y.map((C, R) => ({
649
+ ...C,
650
+ index: B + R + 1
651
651
  }))
652
652
  ]
653
653
  },
@@ -661,7 +661,7 @@ function Ge(i, r) {
661
661
  state: r.state ?? { global: {}, local: {} }
662
662
  };
663
663
  }
664
- const me = "SET_NAME", gt = "UNDO", yt = "REDO", Ft = "PRUNE", xe = "LOAD_STATE", Ye = "NOOP";
664
+ const xe = "SET_NAME", gt = "UNDO", yt = "REDO", Ft = "PRUNE", de = "LOAD_STATE", Ye = "NOOP";
665
665
  function Xe(i, r) {
666
666
  let s;
667
667
  return "index" in r ? s = { ...r } : s = i.operations[r.scope].slice(-1)[0], ((s == null ? void 0 : s.index) ?? -1) + 1;
@@ -708,12 +708,12 @@ function er(i, r, s = 0) {
708
708
  return p = Qe(p, r), p;
709
709
  }
710
710
  function rr(i, r, s) {
711
- switch (se().parse(r), r.type) {
712
- case me:
711
+ switch (pe().parse(r), r.type) {
712
+ case xe:
713
713
  return We(i, r.input);
714
714
  case Ft:
715
715
  return Ze(i, r, s);
716
- case xe:
716
+ case de:
717
717
  return Ge(i, r.input.state);
718
718
  default:
719
719
  return i;
@@ -722,71 +722,74 @@ function rr(i, r, s) {
722
722
  function ir(i, r, s) {
723
723
  switch (r.type) {
724
724
  case gt:
725
- return Ke(i, r, s);
726
- case yt:
727
725
  return He(i, r, s);
726
+ case yt:
727
+ return Ke(i, r, s);
728
728
  default:
729
729
  return { document: i, action: r, skip: s };
730
730
  }
731
731
  }
732
- function de(i, r, s, p, f = {}) {
733
- const { skip: u, ignoreSkipOperations: l = !1 } = f;
734
- let a = { ...r }, x = u || 0, g = i, A = [...i.clipboard];
735
- if (Nr(a)) {
736
- const { document: w, skip: b } = Ve(g, a, x);
737
- x = b, g = w;
732
+ function ge(i, r, s, p, f = {}) {
733
+ const { skip: u, ignoreSkipOperations: l = !1, reuseHash: a = !1 } = f;
734
+ let h = { ...r }, y = u || 0, w = i, _ = [...i.clipboard];
735
+ if (Mr(h)) {
736
+ const { document: v, skip: B } = Ve(w, h, y);
737
+ y = B, w = v;
738
738
  }
739
- if (Yt(a)) {
739
+ if (Xt(h)) {
740
740
  const {
741
- skip: w,
742
- action: b,
743
- document: F
744
- } = ir(i, a, x);
745
- a = b, x = w, g = F, A = [...g.clipboard];
746
- }
747
- if (Xt(a) && (g = rr(g, a, s)), x > 0 && !l) {
748
- let w = x;
749
- "index" in a && (w = qr(
750
- g.operations[a.scope],
751
- a.index,
752
- x
753
- )), g = Mt(
754
- g.initialState,
755
- g.operations,
741
+ skip: v,
742
+ action: B,
743
+ document: W
744
+ } = ir(i, h, y);
745
+ h = B, y = v, w = W, _ = [...w.clipboard];
746
+ }
747
+ if (Qt(h) && (w = rr(w, h, s)), y > 0 && !l) {
748
+ let v = y;
749
+ "index" in h && (v = qr(
750
+ w.operations[h.scope],
751
+ h.index,
752
+ y
753
+ )), w = Nt(
754
+ w.initialState,
755
+ w.operations,
756
756
  s,
757
757
  void 0,
758
758
  void 0,
759
759
  void 0,
760
- { [a.scope]: w }
760
+ { [h.scope]: v }
761
+ // TODO reuse hash?
761
762
  );
762
763
  }
763
- return g = er(g, a, x), g = xt(g, (w) => {
764
- const b = s(
765
- w.state,
766
- a,
764
+ return w = er(w, h, y), w = xt(w, (v) => {
765
+ const B = s(
766
+ v.state,
767
+ h,
767
768
  p
768
- ), F = Yt(r) ? [...A] : [];
769
- if (b)
769
+ ), W = Xt(r) ? [..._] : [];
770
+ if (B)
770
771
  return Ut({
771
- ...g,
772
- clipboard: [...F],
773
- state: b
772
+ ...w,
773
+ clipboard: [...W],
774
+ state: B
774
775
  });
775
- w.clipboard = Ut([...F]);
776
- }), xt(g, (w) => {
777
- if ([gt, yt, Ft].includes(a.type))
778
- return w;
779
- const b = a.scope || "global";
780
- w.operations[b][w.operations[b].length - 1].hash = Se(w, b), !Xt(a) && a.attachments && a.attachments.forEach((F) => {
781
- const { hash: I, ...G } = F;
782
- w.attachments[I] = {
783
- ...G
776
+ v.clipboard = Ut([...W]);
777
+ }), xt(w, (v) => {
778
+ if ([gt, yt, Ft].includes(h.type))
779
+ return v;
780
+ const B = h.scope || "global";
781
+ console.time("hash");
782
+ const W = a && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : Ht(v, B);
783
+ console.timeEnd("hash"), v.operations[B][v.operations[B].length - 1].hash = W, !Qt(h) && h.attachments && h.attachments.forEach((C) => {
784
+ const { hash: R, ...g } = C;
785
+ v.attachments[R] = {
786
+ ...g
784
787
  };
785
788
  });
786
789
  });
787
790
  }
788
- var $t = { exports: {} };
789
- typeof Object.create == "function" ? $t.exports = function(r, s) {
791
+ var Dt = { exports: {} };
792
+ typeof Object.create == "function" ? Dt.exports = function(r, s) {
790
793
  s && (r.super_ = s, r.prototype = Object.create(s.prototype, {
791
794
  constructor: {
792
795
  value: r,
@@ -795,7 +798,7 @@ typeof Object.create == "function" ? $t.exports = function(r, s) {
795
798
  configurable: !0
796
799
  }
797
800
  }));
798
- } : $t.exports = function(r, s) {
801
+ } : Dt.exports = function(r, s) {
799
802
  if (s) {
800
803
  r.super_ = s;
801
804
  var p = function() {
@@ -803,16 +806,16 @@ typeof Object.create == "function" ? $t.exports = function(r, s) {
803
806
  p.prototype = s.prototype, r.prototype = new p(), r.prototype.constructor = r;
804
807
  }
805
808
  };
806
- var ge = $t.exports, Ct = { exports: {} }, ye = {}, Bt = {};
809
+ var ye = Dt.exports, Ct = { exports: {} }, we = {}, Bt = {};
807
810
  Bt.byteLength = ar;
808
811
  Bt.toByteArray = pr;
809
812
  Bt.fromByteArray = ur;
810
- var nt = [], et = [], nr = typeof Uint8Array < "u" ? Uint8Array : Array, kt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
813
+ var nt = [], rt = [], nr = typeof Uint8Array < "u" ? Uint8Array : Array, kt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
811
814
  for (var ut = 0, or = kt.length; ut < or; ++ut)
812
- nt[ut] = kt[ut], et[kt.charCodeAt(ut)] = ut;
813
- et[45] = 62;
814
- et[95] = 63;
815
- function we(i) {
815
+ nt[ut] = kt[ut], rt[kt.charCodeAt(ut)] = ut;
816
+ rt[45] = 62;
817
+ rt[95] = 63;
818
+ function be(i) {
816
819
  var r = i.length;
817
820
  if (r % 4 > 0)
818
821
  throw new Error("Invalid string. Length must be a multiple of 4");
@@ -822,17 +825,17 @@ function we(i) {
822
825
  return [s, p];
823
826
  }
824
827
  function ar(i) {
825
- var r = we(i), s = r[0], p = r[1];
828
+ var r = be(i), s = r[0], p = r[1];
826
829
  return (s + p) * 3 / 4 - p;
827
830
  }
828
831
  function sr(i, r, s) {
829
832
  return (r + s) * 3 / 4 - s;
830
833
  }
831
834
  function pr(i) {
832
- var r, s = we(i), p = s[0], f = s[1], u = new nr(sr(i, p, f)), l = 0, a = f > 0 ? p - 4 : p, x;
833
- for (x = 0; x < a; x += 4)
834
- r = et[i.charCodeAt(x)] << 18 | et[i.charCodeAt(x + 1)] << 12 | et[i.charCodeAt(x + 2)] << 6 | et[i.charCodeAt(x + 3)], u[l++] = r >> 16 & 255, u[l++] = r >> 8 & 255, u[l++] = r & 255;
835
- return f === 2 && (r = et[i.charCodeAt(x)] << 2 | et[i.charCodeAt(x + 1)] >> 4, u[l++] = r & 255), f === 1 && (r = et[i.charCodeAt(x)] << 10 | et[i.charCodeAt(x + 1)] << 4 | et[i.charCodeAt(x + 2)] >> 2, u[l++] = r >> 8 & 255, u[l++] = r & 255), u;
835
+ var r, s = be(i), p = s[0], f = s[1], u = new nr(sr(i, p, f)), l = 0, a = f > 0 ? p - 4 : p, h;
836
+ for (h = 0; h < a; h += 4)
837
+ r = rt[i.charCodeAt(h)] << 18 | rt[i.charCodeAt(h + 1)] << 12 | rt[i.charCodeAt(h + 2)] << 6 | rt[i.charCodeAt(h + 3)], u[l++] = r >> 16 & 255, u[l++] = r >> 8 & 255, u[l++] = r & 255;
838
+ return f === 2 && (r = rt[i.charCodeAt(h)] << 2 | rt[i.charCodeAt(h + 1)] >> 4, u[l++] = r & 255), f === 1 && (r = rt[i.charCodeAt(h)] << 10 | rt[i.charCodeAt(h + 1)] << 4 | rt[i.charCodeAt(h + 2)] >> 2, u[l++] = r >> 8 & 255, u[l++] = r & 255), u;
836
839
  }
837
840
  function cr(i) {
838
841
  return nt[i >> 18 & 63] + nt[i >> 12 & 63] + nt[i >> 6 & 63] + nt[i & 63];
@@ -854,27 +857,27 @@ function ur(i) {
854
857
  var Jt = {};
855
858
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
856
859
  Jt.read = function(i, r, s, p, f) {
857
- var u, l, a = f * 8 - p - 1, x = (1 << a) - 1, g = x >> 1, A = -7, w = s ? f - 1 : 0, b = s ? -1 : 1, F = i[r + w];
858
- for (w += b, u = F & (1 << -A) - 1, F >>= -A, A += a; A > 0; u = u * 256 + i[r + w], w += b, A -= 8)
860
+ var u, l, a = f * 8 - p - 1, h = (1 << a) - 1, y = h >> 1, w = -7, _ = s ? f - 1 : 0, v = s ? -1 : 1, B = i[r + _];
861
+ for (_ += v, u = B & (1 << -w) - 1, B >>= -w, w += a; w > 0; u = u * 256 + i[r + _], _ += v, w -= 8)
859
862
  ;
860
- for (l = u & (1 << -A) - 1, u >>= -A, A += p; A > 0; l = l * 256 + i[r + w], w += b, A -= 8)
863
+ for (l = u & (1 << -w) - 1, u >>= -w, w += p; w > 0; l = l * 256 + i[r + _], _ += v, w -= 8)
861
864
  ;
862
865
  if (u === 0)
863
- u = 1 - g;
866
+ u = 1 - y;
864
867
  else {
865
- if (u === x)
866
- return l ? NaN : (F ? -1 : 1) * (1 / 0);
867
- l = l + Math.pow(2, p), u = u - g;
868
+ if (u === h)
869
+ return l ? NaN : (B ? -1 : 1) * (1 / 0);
870
+ l = l + Math.pow(2, p), u = u - y;
868
871
  }
869
- return (F ? -1 : 1) * l * Math.pow(2, u - p);
872
+ return (B ? -1 : 1) * l * Math.pow(2, u - p);
870
873
  };
871
874
  Jt.write = function(i, r, s, p, f, u) {
872
- var l, a, x, g = u * 8 - f - 1, A = (1 << g) - 1, w = A >> 1, b = f === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = p ? 0 : u - 1, I = p ? 1 : -1, G = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
873
- for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (a = isNaN(r) ? 1 : 0, l = A) : (l = Math.floor(Math.log(r) / Math.LN2), r * (x = Math.pow(2, -l)) < 1 && (l--, x *= 2), l + w >= 1 ? r += b / x : r += b * Math.pow(2, 1 - w), r * x >= 2 && (l++, x /= 2), l + w >= A ? (a = 0, l = A) : l + w >= 1 ? (a = (r * x - 1) * Math.pow(2, f), l = l + w) : (a = r * Math.pow(2, w - 1) * Math.pow(2, f), l = 0)); f >= 8; i[s + F] = a & 255, F += I, a /= 256, f -= 8)
875
+ var l, a, h, y = u * 8 - f - 1, w = (1 << y) - 1, _ = w >> 1, v = f === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, B = p ? 0 : u - 1, W = p ? 1 : -1, C = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
876
+ for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (a = isNaN(r) ? 1 : 0, l = w) : (l = Math.floor(Math.log(r) / Math.LN2), r * (h = Math.pow(2, -l)) < 1 && (l--, h *= 2), l + _ >= 1 ? r += v / h : r += v * Math.pow(2, 1 - _), r * h >= 2 && (l++, h /= 2), l + _ >= w ? (a = 0, l = w) : l + _ >= 1 ? (a = (r * h - 1) * Math.pow(2, f), l = l + _) : (a = r * Math.pow(2, _ - 1) * Math.pow(2, f), l = 0)); f >= 8; i[s + B] = a & 255, B += W, a /= 256, f -= 8)
874
877
  ;
875
- for (l = l << f | a, g += f; g > 0; i[s + F] = l & 255, F += I, l /= 256, g -= 8)
878
+ for (l = l << f | a, y += f; y > 0; i[s + B] = l & 255, B += W, l /= 256, y -= 8)
876
879
  ;
877
- i[s + F - I] |= G * 128;
880
+ i[s + B - W] |= C * 128;
878
881
  };
879
882
  /*!
880
883
  * The buffer module from node.js, for the browser.
@@ -884,7 +887,7 @@ Jt.write = function(i, r, s, p, f, u) {
884
887
  */
885
888
  (function(i) {
886
889
  var r = Bt, s = Jt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
887
- i.Buffer = a, i.SlowBuffer = E, i.INSPECT_MAX_BYTES = 50;
890
+ i.Buffer = a, i.SlowBuffer = b, i.INSPECT_MAX_BYTES = 50;
888
891
  var f = 2147483647;
889
892
  i.kMaxLength = f, a.TYPED_ARRAY_SUPPORT = u(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
890
893
  "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
@@ -924,22 +927,22 @@ Jt.write = function(i, r, s, p, f, u) {
924
927
  throw new TypeError(
925
928
  'The "string" argument must be of type string. Received type number'
926
929
  );
927
- return w(n);
930
+ return _(n);
928
931
  }
929
- return x(n, t, e);
932
+ return h(n, t, e);
930
933
  }
931
934
  a.poolSize = 8192;
932
- function x(n, t, e) {
935
+ function h(n, t, e) {
933
936
  if (typeof n == "string")
934
- return b(n, t);
937
+ return v(n, t);
935
938
  if (ArrayBuffer.isView(n))
936
- return I(n);
939
+ return W(n);
937
940
  if (n == null)
938
941
  throw new TypeError(
939
942
  "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
940
943
  );
941
944
  if (it(n, ArrayBuffer) || n && it(n.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (it(n, SharedArrayBuffer) || n && it(n.buffer, SharedArrayBuffer)))
942
- return G(n, t, e);
945
+ return C(n, t, e);
943
946
  if (typeof n == "number")
944
947
  throw new TypeError(
945
948
  'The "value" argument must not be of type number. Received type number'
@@ -947,7 +950,7 @@ Jt.write = function(i, r, s, p, f, u) {
947
950
  var o = n.valueOf && n.valueOf();
948
951
  if (o != null && o !== n)
949
952
  return a.from(o, t, e);
950
- var c = rt(n);
953
+ var c = R(n);
951
954
  if (c)
952
955
  return c;
953
956
  if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof n[Symbol.toPrimitive] == "function")
@@ -961,47 +964,47 @@ Jt.write = function(i, r, s, p, f, u) {
961
964
  );
962
965
  }
963
966
  a.from = function(n, t, e) {
964
- return x(n, t, e);
967
+ return h(n, t, e);
965
968
  }, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
966
- function g(n) {
969
+ function y(n) {
967
970
  if (typeof n != "number")
968
971
  throw new TypeError('"size" argument must be of type number');
969
972
  if (n < 0)
970
973
  throw new RangeError('The value "' + n + '" is invalid for option "size"');
971
974
  }
972
- function A(n, t, e) {
973
- return g(n), n <= 0 ? l(n) : t !== void 0 ? typeof e == "string" ? l(n).fill(t, e) : l(n).fill(t) : l(n);
975
+ function w(n, t, e) {
976
+ return y(n), n <= 0 ? l(n) : t !== void 0 ? typeof e == "string" ? l(n).fill(t, e) : l(n).fill(t) : l(n);
974
977
  }
975
978
  a.alloc = function(n, t, e) {
976
- return A(n, t, e);
979
+ return w(n, t, e);
977
980
  };
978
- function w(n) {
979
- return g(n), l(n < 0 ? 0 : y(n) | 0);
981
+ function _(n) {
982
+ return y(n), l(n < 0 ? 0 : g(n) | 0);
980
983
  }
981
984
  a.allocUnsafe = function(n) {
982
- return w(n);
985
+ return _(n);
983
986
  }, a.allocUnsafeSlow = function(n) {
984
- return w(n);
987
+ return _(n);
985
988
  };
986
- function b(n, t) {
989
+ function v(n, t) {
987
990
  if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
988
991
  throw new TypeError("Unknown encoding: " + t);
989
- var e = k(n, t) | 0, o = l(e), c = o.write(n, t);
992
+ var e = O(n, t) | 0, o = l(e), c = o.write(n, t);
990
993
  return c !== e && (o = o.slice(0, c)), o;
991
994
  }
992
- function F(n) {
993
- for (var t = n.length < 0 ? 0 : y(n.length) | 0, e = l(t), o = 0; o < t; o += 1)
995
+ function B(n) {
996
+ for (var t = n.length < 0 ? 0 : g(n.length) | 0, e = l(t), o = 0; o < t; o += 1)
994
997
  e[o] = n[o] & 255;
995
998
  return e;
996
999
  }
997
- function I(n) {
1000
+ function W(n) {
998
1001
  if (it(n, Uint8Array)) {
999
1002
  var t = new Uint8Array(n);
1000
- return G(t.buffer, t.byteOffset, t.byteLength);
1003
+ return C(t.buffer, t.byteOffset, t.byteLength);
1001
1004
  }
1002
- return F(n);
1005
+ return B(n);
1003
1006
  }
1004
- function G(n, t, e) {
1007
+ function C(n, t, e) {
1005
1008
  if (t < 0 || n.byteLength < t)
1006
1009
  throw new RangeError('"offset" is outside of buffer bounds');
1007
1010
  if (n.byteLength < t + (e || 0))
@@ -1009,22 +1012,22 @@ Jt.write = function(i, r, s, p, f, u) {
1009
1012
  var o;
1010
1013
  return t === void 0 && e === void 0 ? o = new Uint8Array(n) : e === void 0 ? o = new Uint8Array(n, t) : o = new Uint8Array(n, t, e), Object.setPrototypeOf(o, a.prototype), o;
1011
1014
  }
1012
- function rt(n) {
1015
+ function R(n) {
1013
1016
  if (a.isBuffer(n)) {
1014
- var t = y(n.length) | 0, e = l(t);
1017
+ var t = g(n.length) | 0, e = l(t);
1015
1018
  return e.length === 0 || n.copy(e, 0, 0, t), e;
1016
1019
  }
1017
1020
  if (n.length !== void 0)
1018
- return typeof n.length != "number" || Tt(n.length) ? l(0) : F(n);
1021
+ return typeof n.length != "number" || Tt(n.length) ? l(0) : B(n);
1019
1022
  if (n.type === "Buffer" && Array.isArray(n.data))
1020
- return F(n.data);
1023
+ return B(n.data);
1021
1024
  }
1022
- function y(n) {
1025
+ function g(n) {
1023
1026
  if (n >= f)
1024
1027
  throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + f.toString(16) + " bytes");
1025
1028
  return n | 0;
1026
1029
  }
1027
- function E(n) {
1030
+ function b(n) {
1028
1031
  return +n != n && (n = 0), a.alloc(+n);
1029
1032
  }
1030
1033
  a.isBuffer = function(t) {
@@ -1036,9 +1039,9 @@ Jt.write = function(i, r, s, p, f, u) {
1036
1039
  );
1037
1040
  if (t === e)
1038
1041
  return 0;
1039
- for (var o = t.length, c = e.length, m = 0, d = Math.min(o, c); m < d; ++m)
1040
- if (t[m] !== e[m]) {
1041
- o = t[m], c = e[m];
1042
+ for (var o = t.length, c = e.length, x = 0, d = Math.min(o, c); x < d; ++x)
1043
+ if (t[x] !== e[x]) {
1044
+ o = t[x], c = e[x];
1042
1045
  break;
1043
1046
  }
1044
1047
  return o < c ? -1 : c < o ? 1 : 0;
@@ -1068,24 +1071,24 @@ Jt.write = function(i, r, s, p, f, u) {
1068
1071
  if (e === void 0)
1069
1072
  for (e = 0, o = 0; o < t.length; ++o)
1070
1073
  e += t[o].length;
1071
- var c = a.allocUnsafe(e), m = 0;
1074
+ var c = a.allocUnsafe(e), x = 0;
1072
1075
  for (o = 0; o < t.length; ++o) {
1073
1076
  var d = t[o];
1074
1077
  if (it(d, Uint8Array))
1075
- m + d.length > c.length ? a.from(d).copy(c, m) : Uint8Array.prototype.set.call(
1078
+ x + d.length > c.length ? a.from(d).copy(c, x) : Uint8Array.prototype.set.call(
1076
1079
  c,
1077
1080
  d,
1078
- m
1081
+ x
1079
1082
  );
1080
1083
  else if (a.isBuffer(d))
1081
- d.copy(c, m);
1084
+ d.copy(c, x);
1082
1085
  else
1083
1086
  throw new TypeError('"list" argument must be an Array of Buffers');
1084
- m += d.length;
1087
+ x += d.length;
1085
1088
  }
1086
1089
  return c;
1087
1090
  };
1088
- function k(n, t) {
1091
+ function O(n, t) {
1089
1092
  if (a.isBuffer(n))
1090
1093
  return n.length;
1091
1094
  if (ArrayBuffer.isView(n) || it(n, ArrayBuffer))
@@ -1105,7 +1108,7 @@ Jt.write = function(i, r, s, p, f, u) {
1105
1108
  return e;
1106
1109
  case "utf8":
1107
1110
  case "utf-8":
1108
- return W(n).length;
1111
+ return H(n).length;
1109
1112
  case "ucs2":
1110
1113
  case "ucs-2":
1111
1114
  case "utf16le":
@@ -1117,12 +1120,12 @@ Jt.write = function(i, r, s, p, f, u) {
1117
1120
  return st(n).length;
1118
1121
  default:
1119
1122
  if (c)
1120
- return o ? -1 : W(n).length;
1123
+ return o ? -1 : H(n).length;
1121
1124
  t = ("" + t).toLowerCase(), c = !0;
1122
1125
  }
1123
1126
  }
1124
- a.byteLength = k;
1125
- function q(n, t, e) {
1127
+ a.byteLength = O;
1128
+ function P(n, t, e) {
1126
1129
  var o = !1;
1127
1130
  if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, t >>>= 0, e <= t))
1128
1131
  return "";
@@ -1132,19 +1135,19 @@ Jt.write = function(i, r, s, p, f, u) {
1132
1135
  return S(this, t, e);
1133
1136
  case "utf8":
1134
1137
  case "utf-8":
1135
- return h(this, t, e);
1138
+ return m(this, t, e);
1136
1139
  case "ascii":
1137
1140
  return j(this, t, e);
1138
1141
  case "latin1":
1139
1142
  case "binary":
1140
1143
  return $(this, t, e);
1141
1144
  case "base64":
1142
- return J(this, t, e);
1145
+ return V(this, t, e);
1143
1146
  case "ucs2":
1144
1147
  case "ucs-2":
1145
1148
  case "utf16le":
1146
1149
  case "utf-16le":
1147
- return U(this, t, e);
1150
+ return k(this, t, e);
1148
1151
  default:
1149
1152
  if (o)
1150
1153
  throw new TypeError("Unknown encoding: " + n);
@@ -1152,7 +1155,7 @@ Jt.write = function(i, r, s, p, f, u) {
1152
1155
  }
1153
1156
  }
1154
1157
  a.prototype._isBuffer = !0;
1155
- function Z(n, t, e) {
1158
+ function K(n, t, e) {
1156
1159
  var o = n[t];
1157
1160
  n[t] = n[e], n[e] = o;
1158
1161
  }
@@ -1161,25 +1164,25 @@ Jt.write = function(i, r, s, p, f, u) {
1161
1164
  if (t % 2 !== 0)
1162
1165
  throw new RangeError("Buffer size must be a multiple of 16-bits");
1163
1166
  for (var e = 0; e < t; e += 2)
1164
- Z(this, e, e + 1);
1167
+ K(this, e, e + 1);
1165
1168
  return this;
1166
1169
  }, a.prototype.swap32 = function() {
1167
1170
  var t = this.length;
1168
1171
  if (t % 4 !== 0)
1169
1172
  throw new RangeError("Buffer size must be a multiple of 32-bits");
1170
1173
  for (var e = 0; e < t; e += 4)
1171
- Z(this, e, e + 3), Z(this, e + 1, e + 2);
1174
+ K(this, e, e + 3), K(this, e + 1, e + 2);
1172
1175
  return this;
1173
1176
  }, a.prototype.swap64 = function() {
1174
1177
  var t = this.length;
1175
1178
  if (t % 8 !== 0)
1176
1179
  throw new RangeError("Buffer size must be a multiple of 64-bits");
1177
1180
  for (var e = 0; e < t; e += 8)
1178
- Z(this, e, e + 7), Z(this, e + 1, e + 6), Z(this, e + 2, e + 5), Z(this, e + 3, e + 4);
1181
+ K(this, e, e + 7), K(this, e + 1, e + 6), K(this, e + 2, e + 5), K(this, e + 3, e + 4);
1179
1182
  return this;
1180
1183
  }, a.prototype.toString = function() {
1181
1184
  var t = this.length;
1182
- return t === 0 ? "" : arguments.length === 0 ? h(this, 0, t) : q.apply(this, arguments);
1185
+ return t === 0 ? "" : arguments.length === 0 ? m(this, 0, t) : P.apply(this, arguments);
1183
1186
  }, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
1184
1187
  if (!a.isBuffer(t))
1185
1188
  throw new TypeError("Argument must be a Buffer");
@@ -1187,29 +1190,29 @@ Jt.write = function(i, r, s, p, f, u) {
1187
1190
  }, a.prototype.inspect = function() {
1188
1191
  var t = "", e = i.INSPECT_MAX_BYTES;
1189
1192
  return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
1190
- }, p && (a.prototype[p] = a.prototype.inspect), a.prototype.compare = function(t, e, o, c, m) {
1193
+ }, p && (a.prototype[p] = a.prototype.inspect), a.prototype.compare = function(t, e, o, c, x) {
1191
1194
  if (it(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
1192
1195
  throw new TypeError(
1193
1196
  'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
1194
1197
  );
1195
- if (e === void 0 && (e = 0), o === void 0 && (o = t ? t.length : 0), c === void 0 && (c = 0), m === void 0 && (m = this.length), e < 0 || o > t.length || c < 0 || m > this.length)
1198
+ if (e === void 0 && (e = 0), o === void 0 && (o = t ? t.length : 0), c === void 0 && (c = 0), x === void 0 && (x = this.length), e < 0 || o > t.length || c < 0 || x > this.length)
1196
1199
  throw new RangeError("out of range index");
1197
- if (c >= m && e >= o)
1200
+ if (c >= x && e >= o)
1198
1201
  return 0;
1199
- if (c >= m)
1202
+ if (c >= x)
1200
1203
  return -1;
1201
1204
  if (e >= o)
1202
1205
  return 1;
1203
- if (e >>>= 0, o >>>= 0, c >>>= 0, m >>>= 0, this === t)
1206
+ if (e >>>= 0, o >>>= 0, c >>>= 0, x >>>= 0, this === t)
1204
1207
  return 0;
1205
- for (var d = m - c, D = o - e, M = Math.min(d, D), L = this.slice(c, m), K = t.slice(e, o), z = 0; z < M; ++z)
1206
- if (L[z] !== K[z]) {
1207
- d = L[z], D = K[z];
1208
+ for (var d = x - c, U = o - e, N = Math.min(d, U), z = this.slice(c, x), G = t.slice(e, o), q = 0; q < N; ++q)
1209
+ if (z[q] !== G[q]) {
1210
+ d = z[q], U = G[q];
1208
1211
  break;
1209
1212
  }
1210
- return d < D ? -1 : D < d ? 1 : 0;
1213
+ return d < U ? -1 : U < d ? 1 : 0;
1211
1214
  };
1212
- function H(n, t, e, o, c) {
1215
+ function Y(n, t, e, o, c) {
1213
1216
  if (n.length === 0)
1214
1217
  return -1;
1215
1218
  if (typeof e == "string" ? (o = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, Tt(e) && (e = c ? 0 : n.length - 1), e < 0 && (e = n.length + e), e >= n.length) {
@@ -1222,74 +1225,74 @@ Jt.write = function(i, r, s, p, f, u) {
1222
1225
  else
1223
1226
  return -1;
1224
1227
  if (typeof t == "string" && (t = a.from(t, o)), a.isBuffer(t))
1225
- return t.length === 0 ? -1 : N(n, t, e, o, c);
1228
+ return t.length === 0 ? -1 : M(n, t, e, o, c);
1226
1229
  if (typeof t == "number")
1227
- return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? c ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : N(n, [t], e, o, c);
1230
+ return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? c ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : M(n, [t], e, o, c);
1228
1231
  throw new TypeError("val must be string, number or Buffer");
1229
1232
  }
1230
- function N(n, t, e, o, c) {
1231
- var m = 1, d = n.length, D = t.length;
1233
+ function M(n, t, e, o, c) {
1234
+ var x = 1, d = n.length, U = t.length;
1232
1235
  if (o !== void 0 && (o = String(o).toLowerCase(), o === "ucs2" || o === "ucs-2" || o === "utf16le" || o === "utf-16le")) {
1233
1236
  if (n.length < 2 || t.length < 2)
1234
1237
  return -1;
1235
- m = 2, d /= 2, D /= 2, e /= 2;
1238
+ x = 2, d /= 2, U /= 2, e /= 2;
1236
1239
  }
1237
- function M(Zt, Gt) {
1238
- return m === 1 ? Zt[Gt] : Zt.readUInt16BE(Gt * m);
1240
+ function N(Gt, Yt) {
1241
+ return x === 1 ? Gt[Yt] : Gt.readUInt16BE(Yt * x);
1239
1242
  }
1240
- var L;
1243
+ var z;
1241
1244
  if (c) {
1242
- var K = -1;
1243
- for (L = e; L < d; L++)
1244
- if (M(n, L) === M(t, K === -1 ? 0 : L - K)) {
1245
- if (K === -1 && (K = L), L - K + 1 === D)
1246
- return K * m;
1245
+ var G = -1;
1246
+ for (z = e; z < d; z++)
1247
+ if (N(n, z) === N(t, G === -1 ? 0 : z - G)) {
1248
+ if (G === -1 && (G = z), z - G + 1 === U)
1249
+ return G * x;
1247
1250
  } else
1248
- K !== -1 && (L -= L - K), K = -1;
1251
+ G !== -1 && (z -= z - G), G = -1;
1249
1252
  } else
1250
- for (e + D > d && (e = d - D), L = e; L >= 0; L--) {
1251
- for (var z = !0, vt = 0; vt < D; vt++)
1252
- if (M(n, L + vt) !== M(t, vt)) {
1253
- z = !1;
1253
+ for (e + U > d && (e = d - U), z = e; z >= 0; z--) {
1254
+ for (var q = !0, vt = 0; vt < U; vt++)
1255
+ if (N(n, z + vt) !== N(t, vt)) {
1256
+ q = !1;
1254
1257
  break;
1255
1258
  }
1256
- if (z)
1257
- return L;
1259
+ if (q)
1260
+ return z;
1258
1261
  }
1259
1262
  return -1;
1260
1263
  }
1261
1264
  a.prototype.includes = function(t, e, o) {
1262
1265
  return this.indexOf(t, e, o) !== -1;
1263
1266
  }, a.prototype.indexOf = function(t, e, o) {
1264
- return H(this, t, e, o, !0);
1267
+ return Y(this, t, e, o, !0);
1265
1268
  }, a.prototype.lastIndexOf = function(t, e, o) {
1266
- return H(this, t, e, o, !1);
1269
+ return Y(this, t, e, o, !1);
1267
1270
  };
1268
1271
  function ct(n, t, e, o) {
1269
1272
  e = Number(e) || 0;
1270
1273
  var c = n.length - e;
1271
1274
  o ? (o = Number(o), o > c && (o = c)) : o = c;
1272
- var m = t.length;
1273
- o > m / 2 && (o = m / 2);
1275
+ var x = t.length;
1276
+ o > x / 2 && (o = x / 2);
1274
1277
  for (var d = 0; d < o; ++d) {
1275
- var D = parseInt(t.substr(d * 2, 2), 16);
1276
- if (Tt(D))
1278
+ var U = parseInt(t.substr(d * 2, 2), 16);
1279
+ if (Tt(U))
1277
1280
  return d;
1278
- n[e + d] = D;
1281
+ n[e + d] = U;
1279
1282
  }
1280
1283
  return d;
1281
1284
  }
1282
1285
  function lt(n, t, e, o) {
1283
- return Et(W(t, n.length - e), n, e, o);
1286
+ return Et(H(t, n.length - e), n, e, o);
1284
1287
  }
1285
1288
  function ot(n, t, e, o) {
1286
- return Et(X(t), n, e, o);
1289
+ return Et(Q(t), n, e, o);
1287
1290
  }
1288
1291
  function at(n, t, e, o) {
1289
1292
  return Et(st(t), n, e, o);
1290
1293
  }
1291
1294
  function It(n, t, e, o) {
1292
- return Et(Q(t, n.length - e), n, e, o);
1295
+ return Et(tt(t, n.length - e), n, e, o);
1293
1296
  }
1294
1297
  a.prototype.write = function(t, e, o, c) {
1295
1298
  if (e === void 0)
@@ -1302,8 +1305,8 @@ Jt.write = function(i, r, s, p, f, u) {
1302
1305
  throw new Error(
1303
1306
  "Buffer.write(string, encoding, offset[, length]) is no longer supported"
1304
1307
  );
1305
- var m = this.length - e;
1306
- if ((o === void 0 || o > m) && (o = m), t.length > 0 && (o < 0 || e < 0) || e > this.length)
1308
+ var x = this.length - e;
1309
+ if ((o === void 0 || o > x) && (o = x), t.length > 0 && (o < 0 || e < 0) || e > this.length)
1307
1310
  throw new RangeError("Attempt to write outside buffer bounds");
1308
1311
  c || (c = "utf8");
1309
1312
  for (var d = !1; ; )
@@ -1335,42 +1338,42 @@ Jt.write = function(i, r, s, p, f, u) {
1335
1338
  data: Array.prototype.slice.call(this._arr || this, 0)
1336
1339
  };
1337
1340
  };
1338
- function J(n, t, e) {
1341
+ function V(n, t, e) {
1339
1342
  return t === 0 && e === n.length ? r.fromByteArray(n) : r.fromByteArray(n.slice(t, e));
1340
1343
  }
1341
- function h(n, t, e) {
1344
+ function m(n, t, e) {
1342
1345
  e = Math.min(n.length, e);
1343
1346
  for (var o = [], c = t; c < e; ) {
1344
- var m = n[c], d = null, D = m > 239 ? 4 : m > 223 ? 3 : m > 191 ? 2 : 1;
1345
- if (c + D <= e) {
1346
- var M, L, K, z;
1347
- switch (D) {
1347
+ var x = n[c], d = null, U = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
1348
+ if (c + U <= e) {
1349
+ var N, z, G, q;
1350
+ switch (U) {
1348
1351
  case 1:
1349
- m < 128 && (d = m);
1352
+ x < 128 && (d = x);
1350
1353
  break;
1351
1354
  case 2:
1352
- M = n[c + 1], (M & 192) === 128 && (z = (m & 31) << 6 | M & 63, z > 127 && (d = z));
1355
+ N = n[c + 1], (N & 192) === 128 && (q = (x & 31) << 6 | N & 63, q > 127 && (d = q));
1353
1356
  break;
1354
1357
  case 3:
1355
- M = n[c + 1], L = n[c + 2], (M & 192) === 128 && (L & 192) === 128 && (z = (m & 15) << 12 | (M & 63) << 6 | L & 63, z > 2047 && (z < 55296 || z > 57343) && (d = z));
1358
+ N = n[c + 1], z = n[c + 2], (N & 192) === 128 && (z & 192) === 128 && (q = (x & 15) << 12 | (N & 63) << 6 | z & 63, q > 2047 && (q < 55296 || q > 57343) && (d = q));
1356
1359
  break;
1357
1360
  case 4:
1358
- M = n[c + 1], L = n[c + 2], K = n[c + 3], (M & 192) === 128 && (L & 192) === 128 && (K & 192) === 128 && (z = (m & 15) << 18 | (M & 63) << 12 | (L & 63) << 6 | K & 63, z > 65535 && z < 1114112 && (d = z));
1361
+ N = n[c + 1], z = n[c + 2], G = n[c + 3], (N & 192) === 128 && (z & 192) === 128 && (G & 192) === 128 && (q = (x & 15) << 18 | (N & 63) << 12 | (z & 63) << 6 | G & 63, q > 65535 && q < 1114112 && (d = q));
1359
1362
  }
1360
1363
  }
1361
- d === null ? (d = 65533, D = 1) : d > 65535 && (d -= 65536, o.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), o.push(d), c += D;
1364
+ d === null ? (d = 65533, U = 1) : d > 65535 && (d -= 65536, o.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), o.push(d), c += U;
1362
1365
  }
1363
1366
  return T(o);
1364
1367
  }
1365
- var v = 4096;
1368
+ var E = 4096;
1366
1369
  function T(n) {
1367
1370
  var t = n.length;
1368
- if (t <= v)
1371
+ if (t <= E)
1369
1372
  return String.fromCharCode.apply(String, n);
1370
1373
  for (var e = "", o = 0; o < t; )
1371
1374
  e += String.fromCharCode.apply(
1372
1375
  String,
1373
- n.slice(o, o += v)
1376
+ n.slice(o, o += E)
1374
1377
  );
1375
1378
  return e;
1376
1379
  }
@@ -1391,13 +1394,13 @@ Jt.write = function(i, r, s, p, f, u) {
1391
1394
  function S(n, t, e) {
1392
1395
  var o = n.length;
1393
1396
  (!t || t < 0) && (t = 0), (!e || e < 0 || e > o) && (e = o);
1394
- for (var c = "", m = t; m < e; ++m)
1395
- c += De[n[m]];
1397
+ for (var c = "", x = t; x < e; ++x)
1398
+ c += $e[n[x]];
1396
1399
  return c;
1397
1400
  }
1398
- function U(n, t, e) {
1399
- for (var o = n.slice(t, e), c = "", m = 0; m < o.length - 1; m += 2)
1400
- c += String.fromCharCode(o[m] + o[m + 1] * 256);
1401
+ function k(n, t, e) {
1402
+ for (var o = n.slice(t, e), c = "", x = 0; x < o.length - 1; x += 2)
1403
+ c += String.fromCharCode(o[x] + o[x + 1] * 256);
1401
1404
  return c;
1402
1405
  }
1403
1406
  a.prototype.slice = function(t, e) {
@@ -1406,151 +1409,151 @@ Jt.write = function(i, r, s, p, f, u) {
1406
1409
  var c = this.subarray(t, e);
1407
1410
  return Object.setPrototypeOf(c, a.prototype), c;
1408
1411
  };
1409
- function B(n, t, e) {
1412
+ function F(n, t, e) {
1410
1413
  if (n % 1 !== 0 || n < 0)
1411
1414
  throw new RangeError("offset is not uint");
1412
1415
  if (n + t > e)
1413
1416
  throw new RangeError("Trying to access beyond buffer length");
1414
1417
  }
1415
1418
  a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, o) {
1416
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1417
- for (var c = this[t], m = 1, d = 0; ++d < e && (m *= 256); )
1418
- c += this[t + d] * m;
1419
+ t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1420
+ for (var c = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1421
+ c += this[t + d] * x;
1419
1422
  return c;
1420
1423
  }, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, o) {
1421
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1422
- for (var c = this[t + --e], m = 1; e > 0 && (m *= 256); )
1423
- c += this[t + --e] * m;
1424
+ t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1425
+ for (var c = this[t + --e], x = 1; e > 0 && (x *= 256); )
1426
+ c += this[t + --e] * x;
1424
1427
  return c;
1425
1428
  }, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
1426
- return t = t >>> 0, e || B(t, 1, this.length), this[t];
1429
+ return t = t >>> 0, e || F(t, 1, this.length), this[t];
1427
1430
  }, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(t, e) {
1428
- return t = t >>> 0, e || B(t, 2, this.length), this[t] | this[t + 1] << 8;
1431
+ return t = t >>> 0, e || F(t, 2, this.length), this[t] | this[t + 1] << 8;
1429
1432
  }, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(t, e) {
1430
- return t = t >>> 0, e || B(t, 2, this.length), this[t] << 8 | this[t + 1];
1433
+ return t = t >>> 0, e || F(t, 2, this.length), this[t] << 8 | this[t + 1];
1431
1434
  }, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(t, e) {
1432
- return t = t >>> 0, e || B(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
1435
+ return t = t >>> 0, e || F(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
1433
1436
  }, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(t, e) {
1434
- return t = t >>> 0, e || B(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
1437
+ return t = t >>> 0, e || F(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
1435
1438
  }, a.prototype.readIntLE = function(t, e, o) {
1436
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1437
- for (var c = this[t], m = 1, d = 0; ++d < e && (m *= 256); )
1438
- c += this[t + d] * m;
1439
- return m *= 128, c >= m && (c -= Math.pow(2, 8 * e)), c;
1439
+ t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1440
+ for (var c = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1441
+ c += this[t + d] * x;
1442
+ return x *= 128, c >= x && (c -= Math.pow(2, 8 * e)), c;
1440
1443
  }, a.prototype.readIntBE = function(t, e, o) {
1441
- t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1442
- for (var c = e, m = 1, d = this[t + --c]; c > 0 && (m *= 256); )
1443
- d += this[t + --c] * m;
1444
- return m *= 128, d >= m && (d -= Math.pow(2, 8 * e)), d;
1444
+ t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1445
+ for (var c = e, x = 1, d = this[t + --c]; c > 0 && (x *= 256); )
1446
+ d += this[t + --c] * x;
1447
+ return x *= 128, d >= x && (d -= Math.pow(2, 8 * e)), d;
1445
1448
  }, a.prototype.readInt8 = function(t, e) {
1446
- return t = t >>> 0, e || B(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
1449
+ return t = t >>> 0, e || F(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
1447
1450
  }, a.prototype.readInt16LE = function(t, e) {
1448
- t = t >>> 0, e || B(t, 2, this.length);
1451
+ t = t >>> 0, e || F(t, 2, this.length);
1449
1452
  var o = this[t] | this[t + 1] << 8;
1450
1453
  return o & 32768 ? o | 4294901760 : o;
1451
1454
  }, a.prototype.readInt16BE = function(t, e) {
1452
- t = t >>> 0, e || B(t, 2, this.length);
1455
+ t = t >>> 0, e || F(t, 2, this.length);
1453
1456
  var o = this[t + 1] | this[t] << 8;
1454
1457
  return o & 32768 ? o | 4294901760 : o;
1455
1458
  }, a.prototype.readInt32LE = function(t, e) {
1456
- return t = t >>> 0, e || B(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
1459
+ return t = t >>> 0, e || F(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
1457
1460
  }, a.prototype.readInt32BE = function(t, e) {
1458
- return t = t >>> 0, e || B(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
1461
+ return t = t >>> 0, e || F(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
1459
1462
  }, a.prototype.readFloatLE = function(t, e) {
1460
- return t = t >>> 0, e || B(t, 4, this.length), s.read(this, t, !0, 23, 4);
1463
+ return t = t >>> 0, e || F(t, 4, this.length), s.read(this, t, !0, 23, 4);
1461
1464
  }, a.prototype.readFloatBE = function(t, e) {
1462
- return t = t >>> 0, e || B(t, 4, this.length), s.read(this, t, !1, 23, 4);
1465
+ return t = t >>> 0, e || F(t, 4, this.length), s.read(this, t, !1, 23, 4);
1463
1466
  }, a.prototype.readDoubleLE = function(t, e) {
1464
- return t = t >>> 0, e || B(t, 8, this.length), s.read(this, t, !0, 52, 8);
1467
+ return t = t >>> 0, e || F(t, 8, this.length), s.read(this, t, !0, 52, 8);
1465
1468
  }, a.prototype.readDoubleBE = function(t, e) {
1466
- return t = t >>> 0, e || B(t, 8, this.length), s.read(this, t, !1, 52, 8);
1469
+ return t = t >>> 0, e || F(t, 8, this.length), s.read(this, t, !1, 52, 8);
1467
1470
  };
1468
- function O(n, t, e, o, c, m) {
1471
+ function I(n, t, e, o, c, x) {
1469
1472
  if (!a.isBuffer(n))
1470
1473
  throw new TypeError('"buffer" argument must be a Buffer instance');
1471
- if (t > c || t < m)
1474
+ if (t > c || t < x)
1472
1475
  throw new RangeError('"value" argument is out of bounds');
1473
1476
  if (e + o > n.length)
1474
1477
  throw new RangeError("Index out of range");
1475
1478
  }
1476
1479
  a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, o, c) {
1477
1480
  if (t = +t, e = e >>> 0, o = o >>> 0, !c) {
1478
- var m = Math.pow(2, 8 * o) - 1;
1479
- O(this, t, e, o, m, 0);
1481
+ var x = Math.pow(2, 8 * o) - 1;
1482
+ I(this, t, e, o, x, 0);
1480
1483
  }
1481
- var d = 1, D = 0;
1482
- for (this[e] = t & 255; ++D < o && (d *= 256); )
1483
- this[e + D] = t / d & 255;
1484
+ var d = 1, U = 0;
1485
+ for (this[e] = t & 255; ++U < o && (d *= 256); )
1486
+ this[e + U] = t / d & 255;
1484
1487
  return e + o;
1485
1488
  }, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, o, c) {
1486
1489
  if (t = +t, e = e >>> 0, o = o >>> 0, !c) {
1487
- var m = Math.pow(2, 8 * o) - 1;
1488
- O(this, t, e, o, m, 0);
1490
+ var x = Math.pow(2, 8 * o) - 1;
1491
+ I(this, t, e, o, x, 0);
1489
1492
  }
1490
- var d = o - 1, D = 1;
1491
- for (this[e + d] = t & 255; --d >= 0 && (D *= 256); )
1492
- this[e + d] = t / D & 255;
1493
+ var d = o - 1, U = 1;
1494
+ for (this[e + d] = t & 255; --d >= 0 && (U *= 256); )
1495
+ this[e + d] = t / U & 255;
1493
1496
  return e + o;
1494
1497
  }, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, o) {
1495
- return t = +t, e = e >>> 0, o || O(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1498
+ return t = +t, e = e >>> 0, o || I(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1496
1499
  }, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(t, e, o) {
1497
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1500
+ return t = +t, e = e >>> 0, o || I(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1498
1501
  }, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(t, e, o) {
1499
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1502
+ return t = +t, e = e >>> 0, o || I(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1500
1503
  }, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(t, e, o) {
1501
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
1504
+ return t = +t, e = e >>> 0, o || I(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
1502
1505
  }, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(t, e, o) {
1503
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1506
+ return t = +t, e = e >>> 0, o || I(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1504
1507
  }, a.prototype.writeIntLE = function(t, e, o, c) {
1505
1508
  if (t = +t, e = e >>> 0, !c) {
1506
- var m = Math.pow(2, 8 * o - 1);
1507
- O(this, t, e, o, m - 1, -m);
1509
+ var x = Math.pow(2, 8 * o - 1);
1510
+ I(this, t, e, o, x - 1, -x);
1508
1511
  }
1509
- var d = 0, D = 1, M = 0;
1510
- for (this[e] = t & 255; ++d < o && (D *= 256); )
1511
- t < 0 && M === 0 && this[e + d - 1] !== 0 && (M = 1), this[e + d] = (t / D >> 0) - M & 255;
1512
+ var d = 0, U = 1, N = 0;
1513
+ for (this[e] = t & 255; ++d < o && (U *= 256); )
1514
+ t < 0 && N === 0 && this[e + d - 1] !== 0 && (N = 1), this[e + d] = (t / U >> 0) - N & 255;
1512
1515
  return e + o;
1513
1516
  }, a.prototype.writeIntBE = function(t, e, o, c) {
1514
1517
  if (t = +t, e = e >>> 0, !c) {
1515
- var m = Math.pow(2, 8 * o - 1);
1516
- O(this, t, e, o, m - 1, -m);
1518
+ var x = Math.pow(2, 8 * o - 1);
1519
+ I(this, t, e, o, x - 1, -x);
1517
1520
  }
1518
- var d = o - 1, D = 1, M = 0;
1519
- for (this[e + d] = t & 255; --d >= 0 && (D *= 256); )
1520
- t < 0 && M === 0 && this[e + d + 1] !== 0 && (M = 1), this[e + d] = (t / D >> 0) - M & 255;
1521
+ var d = o - 1, U = 1, N = 0;
1522
+ for (this[e + d] = t & 255; --d >= 0 && (U *= 256); )
1523
+ t < 0 && N === 0 && this[e + d + 1] !== 0 && (N = 1), this[e + d] = (t / U >> 0) - N & 255;
1521
1524
  return e + o;
1522
1525
  }, a.prototype.writeInt8 = function(t, e, o) {
1523
- return t = +t, e = e >>> 0, o || O(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
1526
+ return t = +t, e = e >>> 0, o || I(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
1524
1527
  }, a.prototype.writeInt16LE = function(t, e, o) {
1525
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1528
+ return t = +t, e = e >>> 0, o || I(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
1526
1529
  }, a.prototype.writeInt16BE = function(t, e, o) {
1527
- return t = +t, e = e >>> 0, o || O(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1530
+ return t = +t, e = e >>> 0, o || I(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
1528
1531
  }, a.prototype.writeInt32LE = function(t, e, o) {
1529
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
1532
+ return t = +t, e = e >>> 0, o || I(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
1530
1533
  }, a.prototype.writeInt32BE = function(t, e, o) {
1531
- return t = +t, e = e >>> 0, o || O(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1534
+ return t = +t, e = e >>> 0, o || I(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
1532
1535
  };
1533
- function R(n, t, e, o, c, m) {
1536
+ function L(n, t, e, o, c, x) {
1534
1537
  if (e + o > n.length)
1535
1538
  throw new RangeError("Index out of range");
1536
1539
  if (e < 0)
1537
1540
  throw new RangeError("Index out of range");
1538
1541
  }
1539
- function P(n, t, e, o, c) {
1540
- return t = +t, e = e >>> 0, c || R(n, t, e, 4), s.write(n, t, e, o, 23, 4), e + 4;
1542
+ function J(n, t, e, o, c) {
1543
+ return t = +t, e = e >>> 0, c || L(n, t, e, 4), s.write(n, t, e, o, 23, 4), e + 4;
1541
1544
  }
1542
1545
  a.prototype.writeFloatLE = function(t, e, o) {
1543
- return P(this, t, e, !0, o);
1546
+ return J(this, t, e, !0, o);
1544
1547
  }, a.prototype.writeFloatBE = function(t, e, o) {
1545
- return P(this, t, e, !1, o);
1548
+ return J(this, t, e, !1, o);
1546
1549
  };
1547
- function C(n, t, e, o, c) {
1548
- return t = +t, e = e >>> 0, c || R(n, t, e, 8), s.write(n, t, e, o, 52, 8), e + 8;
1550
+ function D(n, t, e, o, c) {
1551
+ return t = +t, e = e >>> 0, c || L(n, t, e, 8), s.write(n, t, e, o, 52, 8), e + 8;
1549
1552
  }
1550
1553
  a.prototype.writeDoubleLE = function(t, e, o) {
1551
- return C(this, t, e, !0, o);
1554
+ return D(this, t, e, !0, o);
1552
1555
  }, a.prototype.writeDoubleBE = function(t, e, o) {
1553
- return C(this, t, e, !1, o);
1556
+ return D(this, t, e, !1, o);
1554
1557
  }, a.prototype.copy = function(t, e, o, c) {
1555
1558
  if (!a.isBuffer(t))
1556
1559
  throw new TypeError("argument should be a Buffer");
@@ -1563,12 +1566,12 @@ Jt.write = function(i, r, s, p, f, u) {
1563
1566
  if (c < 0)
1564
1567
  throw new RangeError("sourceEnd out of bounds");
1565
1568
  c > this.length && (c = this.length), t.length - e < c - o && (c = t.length - e + o);
1566
- var m = c - o;
1569
+ var x = c - o;
1567
1570
  return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, o, c) : Uint8Array.prototype.set.call(
1568
1571
  t,
1569
1572
  this.subarray(o, c),
1570
1573
  e
1571
- ), m;
1574
+ ), x;
1572
1575
  }, a.prototype.fill = function(t, e, o, c) {
1573
1576
  if (typeof t == "string") {
1574
1577
  if (typeof e == "string" ? (c = e, e = 0, o = this.length) : typeof o == "string" && (c = o, o = this.length), c !== void 0 && typeof c != "string")
@@ -1576,8 +1579,8 @@ Jt.write = function(i, r, s, p, f, u) {
1576
1579
  if (typeof c == "string" && !a.isEncoding(c))
1577
1580
  throw new TypeError("Unknown encoding: " + c);
1578
1581
  if (t.length === 1) {
1579
- var m = t.charCodeAt(0);
1580
- (c === "utf8" && m < 128 || c === "latin1") && (t = m);
1582
+ var x = t.charCodeAt(0);
1583
+ (c === "utf8" && x < 128 || c === "latin1") && (t = x);
1581
1584
  }
1582
1585
  } else
1583
1586
  typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
@@ -1591,59 +1594,59 @@ Jt.write = function(i, r, s, p, f, u) {
1591
1594
  for (d = e; d < o; ++d)
1592
1595
  this[d] = t;
1593
1596
  else {
1594
- var D = a.isBuffer(t) ? t : a.from(t, c), M = D.length;
1595
- if (M === 0)
1597
+ var U = a.isBuffer(t) ? t : a.from(t, c), N = U.length;
1598
+ if (N === 0)
1596
1599
  throw new TypeError('The value "' + t + '" is invalid for argument "value"');
1597
1600
  for (d = 0; d < o - e; ++d)
1598
- this[d + e] = D[d % M];
1601
+ this[d + e] = U[d % N];
1599
1602
  }
1600
1603
  return this;
1601
1604
  };
1602
- var V = /[^+/0-9A-Za-z-_]/g;
1603
- function Y(n) {
1604
- if (n = n.split("=")[0], n = n.trim().replace(V, ""), n.length < 2)
1605
+ var Z = /[^+/0-9A-Za-z-_]/g;
1606
+ function X(n) {
1607
+ if (n = n.split("=")[0], n = n.trim().replace(Z, ""), n.length < 2)
1605
1608
  return "";
1606
1609
  for (; n.length % 4 !== 0; )
1607
1610
  n = n + "=";
1608
1611
  return n;
1609
1612
  }
1610
- function W(n, t) {
1613
+ function H(n, t) {
1611
1614
  t = t || 1 / 0;
1612
- for (var e, o = n.length, c = null, m = [], d = 0; d < o; ++d) {
1615
+ for (var e, o = n.length, c = null, x = [], d = 0; d < o; ++d) {
1613
1616
  if (e = n.charCodeAt(d), e > 55295 && e < 57344) {
1614
1617
  if (!c) {
1615
1618
  if (e > 56319) {
1616
- (t -= 3) > -1 && m.push(239, 191, 189);
1619
+ (t -= 3) > -1 && x.push(239, 191, 189);
1617
1620
  continue;
1618
1621
  } else if (d + 1 === o) {
1619
- (t -= 3) > -1 && m.push(239, 191, 189);
1622
+ (t -= 3) > -1 && x.push(239, 191, 189);
1620
1623
  continue;
1621
1624
  }
1622
1625
  c = e;
1623
1626
  continue;
1624
1627
  }
1625
1628
  if (e < 56320) {
1626
- (t -= 3) > -1 && m.push(239, 191, 189), c = e;
1629
+ (t -= 3) > -1 && x.push(239, 191, 189), c = e;
1627
1630
  continue;
1628
1631
  }
1629
1632
  e = (c - 55296 << 10 | e - 56320) + 65536;
1630
1633
  } else
1631
- c && (t -= 3) > -1 && m.push(239, 191, 189);
1634
+ c && (t -= 3) > -1 && x.push(239, 191, 189);
1632
1635
  if (c = null, e < 128) {
1633
1636
  if ((t -= 1) < 0)
1634
1637
  break;
1635
- m.push(e);
1638
+ x.push(e);
1636
1639
  } else if (e < 2048) {
1637
1640
  if ((t -= 2) < 0)
1638
1641
  break;
1639
- m.push(
1642
+ x.push(
1640
1643
  e >> 6 | 192,
1641
1644
  e & 63 | 128
1642
1645
  );
1643
1646
  } else if (e < 65536) {
1644
1647
  if ((t -= 3) < 0)
1645
1648
  break;
1646
- m.push(
1649
+ x.push(
1647
1650
  e >> 12 | 224,
1648
1651
  e >> 6 & 63 | 128,
1649
1652
  e & 63 | 128
@@ -1651,7 +1654,7 @@ Jt.write = function(i, r, s, p, f, u) {
1651
1654
  } else if (e < 1114112) {
1652
1655
  if ((t -= 4) < 0)
1653
1656
  break;
1654
- m.push(
1657
+ x.push(
1655
1658
  e >> 18 | 240,
1656
1659
  e >> 12 & 63 | 128,
1657
1660
  e >> 6 & 63 | 128,
@@ -1660,20 +1663,20 @@ Jt.write = function(i, r, s, p, f, u) {
1660
1663
  } else
1661
1664
  throw new Error("Invalid code point");
1662
1665
  }
1663
- return m;
1666
+ return x;
1664
1667
  }
1665
- function X(n) {
1668
+ function Q(n) {
1666
1669
  for (var t = [], e = 0; e < n.length; ++e)
1667
1670
  t.push(n.charCodeAt(e) & 255);
1668
1671
  return t;
1669
1672
  }
1670
- function Q(n, t) {
1671
- for (var e, o, c, m = [], d = 0; d < n.length && !((t -= 2) < 0); ++d)
1672
- e = n.charCodeAt(d), o = e >> 8, c = e % 256, m.push(c), m.push(o);
1673
- return m;
1673
+ function tt(n, t) {
1674
+ for (var e, o, c, x = [], d = 0; d < n.length && !((t -= 2) < 0); ++d)
1675
+ e = n.charCodeAt(d), o = e >> 8, c = e % 256, x.push(c), x.push(o);
1676
+ return x;
1674
1677
  }
1675
1678
  function st(n) {
1676
- return r.toByteArray(Y(n));
1679
+ return r.toByteArray(X(n));
1677
1680
  }
1678
1681
  function Et(n, t, e, o) {
1679
1682
  for (var c = 0; c < o && !(c + e >= t.length || c >= n.length); ++c)
@@ -1686,33 +1689,33 @@ Jt.write = function(i, r, s, p, f, u) {
1686
1689
  function Tt(n) {
1687
1690
  return n !== n;
1688
1691
  }
1689
- var De = function() {
1692
+ var $e = function() {
1690
1693
  for (var n = "0123456789abcdef", t = new Array(256), e = 0; e < 16; ++e)
1691
1694
  for (var o = e * 16, c = 0; c < 16; ++c)
1692
1695
  t[o + c] = n[e] + n[c];
1693
1696
  return t;
1694
1697
  }();
1695
- })(ye);
1698
+ })(we);
1696
1699
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1697
1700
  (function(i, r) {
1698
- var s = ye, p = s.Buffer;
1701
+ var s = we, p = s.Buffer;
1699
1702
  function f(l, a) {
1700
- for (var x in l)
1701
- a[x] = l[x];
1703
+ for (var h in l)
1704
+ a[h] = l[h];
1702
1705
  }
1703
1706
  p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? i.exports = s : (f(s, r), r.Buffer = u);
1704
- function u(l, a, x) {
1705
- return p(l, a, x);
1707
+ function u(l, a, h) {
1708
+ return p(l, a, h);
1706
1709
  }
1707
- u.prototype = Object.create(p.prototype), f(p, u), u.from = function(l, a, x) {
1710
+ u.prototype = Object.create(p.prototype), f(p, u), u.from = function(l, a, h) {
1708
1711
  if (typeof l == "number")
1709
1712
  throw new TypeError("Argument must not be a number");
1710
- return p(l, a, x);
1711
- }, u.alloc = function(l, a, x) {
1713
+ return p(l, a, h);
1714
+ }, u.alloc = function(l, a, h) {
1712
1715
  if (typeof l != "number")
1713
1716
  throw new TypeError("Argument must be a number");
1714
- var g = p(l);
1715
- return a !== void 0 ? typeof x == "string" ? g.fill(a, x) : g.fill(a) : g.fill(0), g;
1717
+ var y = p(l);
1718
+ return a !== void 0 ? typeof h == "string" ? y.fill(a, h) : y.fill(a) : y.fill(0), y;
1716
1719
  }, u.allocUnsafe = function(l) {
1717
1720
  if (typeof l != "number")
1718
1721
  throw new TypeError("Argument must be a number");
@@ -1723,16 +1726,16 @@ Jt.write = function(i, r, s, p, f, u) {
1723
1726
  return s.SlowBuffer(l);
1724
1727
  };
1725
1728
  })(Ct, Ct.exports);
1726
- var Wt = Ct.exports, be = Wt.Buffer;
1729
+ var Wt = Ct.exports, Ee = Wt.Buffer;
1727
1730
  function jt(i, r) {
1728
- this._block = be.alloc(i), this._finalSize = r, this._blockSize = i, this._len = 0;
1731
+ this._block = Ee.alloc(i), this._finalSize = r, this._blockSize = i, this._len = 0;
1729
1732
  }
1730
1733
  jt.prototype.update = function(i, r) {
1731
- typeof i == "string" && (r = r || "utf8", i = be.from(i, r));
1734
+ typeof i == "string" && (r = r || "utf8", i = Ee.from(i, r));
1732
1735
  for (var s = this._block, p = this._blockSize, f = i.length, u = this._len, l = 0; l < f; ) {
1733
- for (var a = u % p, x = Math.min(f - l, p - a), g = 0; g < x; g++)
1734
- s[a + g] = i[l + g];
1735
- u += x, l += x, u % p === 0 && this._update(s);
1736
+ for (var a = u % p, h = Math.min(f - l, p - a), y = 0; y < h; y++)
1737
+ s[a + y] = i[l + y];
1738
+ u += h, l += h, u % p === 0 && this._update(s);
1736
1739
  }
1737
1740
  return this._len += f, this;
1738
1741
  };
@@ -1753,16 +1756,16 @@ jt.prototype.digest = function(i) {
1753
1756
  jt.prototype._update = function() {
1754
1757
  throw new Error("_update must be implemented by subclass");
1755
1758
  };
1756
- var Ee = jt, fr = ge, ve = Ee, hr = Wt.Buffer, mr = [
1759
+ var ve = jt, fr = ye, Ae = ve, hr = Wt.Buffer, mr = [
1757
1760
  1518500249,
1758
1761
  1859775393,
1759
1762
  -1894007588,
1760
1763
  -899497514
1761
1764
  ], xr = new Array(80);
1762
1765
  function wt() {
1763
- this.init(), this._w = xr, ve.call(this, 64, 56);
1766
+ this.init(), this._w = xr, Ae.call(this, 64, 56);
1764
1767
  }
1765
- fr(wt, ve);
1768
+ fr(wt, Ae);
1766
1769
  wt.prototype.init = function() {
1767
1770
  return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
1768
1771
  };
@@ -1783,9 +1786,9 @@ wt.prototype._update = function(i) {
1783
1786
  r[a] = i.readInt32BE(a * 4);
1784
1787
  for (; a < 80; ++a)
1785
1788
  r[a] = dr(r[a - 3] ^ r[a - 8] ^ r[a - 14] ^ r[a - 16]);
1786
- for (var x = 0; x < 80; ++x) {
1787
- var g = ~~(x / 20), A = gr(s) + wr(g, p, f, u) + l + r[x] + mr[g] | 0;
1788
- l = u, u = f, f = yr(p), p = s, s = A;
1789
+ for (var h = 0; h < 80; ++h) {
1790
+ var y = ~~(h / 20), w = gr(s) + wr(y, p, f, u) + l + r[h] + mr[y] | 0;
1791
+ l = u, u = f, f = yr(p), p = s, s = w;
1789
1792
  }
1790
1793
  this._a = s + this._a | 0, this._b = p + this._b | 0, this._c = f + this._c | 0, this._d = u + this._d | 0, this._e = l + this._e | 0;
1791
1794
  };
@@ -1795,7 +1798,7 @@ wt.prototype._hash = function() {
1795
1798
  };
1796
1799
  var br = wt;
1797
1800
  const Er = /* @__PURE__ */ qt(br);
1798
- var vr = ge, Ae = Ee, Ar = Wt.Buffer, _r = [
1801
+ var vr = ye, _e = ve, Ar = Wt.Buffer, _r = [
1799
1802
  1116352408,
1800
1803
  1899447441,
1801
1804
  3049323471,
@@ -1862,9 +1865,9 @@ var vr = ge, Ae = Ee, Ar = Wt.Buffer, _r = [
1862
1865
  3329325298
1863
1866
  ], Sr = new Array(64);
1864
1867
  function bt() {
1865
- this.init(), this._w = Sr, Ae.call(this, 64, 56);
1868
+ this.init(), this._w = Sr, _e.call(this, 64, 56);
1866
1869
  }
1867
- vr(bt, Ae);
1870
+ vr(bt, _e);
1868
1871
  bt.prototype.init = function() {
1869
1872
  return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;
1870
1873
  };
@@ -1887,15 +1890,15 @@ function Tr(i) {
1887
1890
  return (i >>> 17 | i << 15) ^ (i >>> 19 | i << 13) ^ i >>> 10;
1888
1891
  }
1889
1892
  bt.prototype._update = function(i) {
1890
- for (var r = this._w, s = this._a | 0, p = this._b | 0, f = this._c | 0, u = this._d | 0, l = this._e | 0, a = this._f | 0, x = this._g | 0, g = this._h | 0, A = 0; A < 16; ++A)
1891
- r[A] = i.readInt32BE(A * 4);
1892
- for (; A < 64; ++A)
1893
- r[A] = Tr(r[A - 2]) + r[A - 7] + Ir(r[A - 15]) + r[A - 16] | 0;
1894
- for (var w = 0; w < 64; ++w) {
1895
- var b = g + Or(l) + Fr(l, a, x) + _r[w] + r[w] | 0, F = jr(s) + Br(s, p, f) | 0;
1896
- g = x, x = a, a = l, l = u + b | 0, u = f, f = p, p = s, s = b + F | 0;
1897
- }
1898
- this._a = s + this._a | 0, this._b = p + this._b | 0, this._c = f + this._c | 0, this._d = u + this._d | 0, this._e = l + this._e | 0, this._f = a + this._f | 0, this._g = x + this._g | 0, this._h = g + this._h | 0;
1893
+ for (var r = this._w, s = this._a | 0, p = this._b | 0, f = this._c | 0, u = this._d | 0, l = this._e | 0, a = this._f | 0, h = this._g | 0, y = this._h | 0, w = 0; w < 16; ++w)
1894
+ r[w] = i.readInt32BE(w * 4);
1895
+ for (; w < 64; ++w)
1896
+ r[w] = Tr(r[w - 2]) + r[w - 7] + Ir(r[w - 15]) + r[w - 16] | 0;
1897
+ for (var _ = 0; _ < 64; ++_) {
1898
+ var v = y + Or(l) + Fr(l, a, h) + _r[_] + r[_] | 0, B = jr(s) + Br(s, p, f) | 0;
1899
+ y = h, h = a, a = l, l = u + v | 0, u = f, f = p, p = s, s = v + B | 0;
1900
+ }
1901
+ this._a = s + this._a | 0, this._b = p + this._b | 0, this._c = f + this._c | 0, this._d = u + this._d | 0, this._e = l + this._e | 0, this._f = a + this._f | 0, this._g = h + this._g | 0, this._h = y + this._h | 0;
1899
1902
  };
1900
1903
  bt.prototype._hash = function() {
1901
1904
  var i = Ar.allocUnsafe(32);
@@ -1903,38 +1906,38 @@ bt.prototype._hash = function() {
1903
1906
  };
1904
1907
  var kr = bt;
1905
1908
  const Ur = /* @__PURE__ */ qt(kr), Vt = new Error("File system not available.");
1906
- function Dr(i, r, s) {
1909
+ function $r(i, r, s) {
1907
1910
  throw Vt;
1908
1911
  }
1909
- function _e(i) {
1912
+ function Se(i) {
1910
1913
  throw Vt;
1911
1914
  }
1912
- function $r(i) {
1915
+ function Dr(i) {
1913
1916
  throw Vt;
1914
1917
  }
1915
- const Cr = async (i) => _e(), Mr = {
1918
+ const Cr = async (i) => Se(), Nr = {
1916
1919
  sha1: Er,
1917
1920
  sha256: Ur
1918
1921
  }, Ot = (i, r = "sha1") => {
1919
1922
  if (!["sha1", "sha256"].includes(r))
1920
1923
  throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
1921
- const s = Mr[r];
1924
+ const s = Nr[r];
1922
1925
  return new s().update(i).digest("base64");
1923
1926
  };
1924
- function Nr(i) {
1927
+ function Mr(i) {
1925
1928
  return i.type === Ye && i.skip !== void 0 && i.skip > 0 && i.hash !== void 0;
1926
1929
  }
1927
- function Yt(i) {
1930
+ function Xt(i) {
1928
1931
  return [gt, yt].includes(i.type);
1929
1932
  }
1930
- function Xt(i) {
1931
- return [me, gt, yt, Ft, xe].includes(i.type);
1933
+ function Qt(i) {
1934
+ return [xe, gt, yt, Ft, de].includes(i.type);
1932
1935
  }
1933
1936
  function ht(i, r, s, p, f = "global") {
1934
1937
  if (!i)
1935
1938
  throw new Error("Empty action type");
1936
1939
  if (typeof i != "string")
1937
- throw new Error(`Invalid action type: ${i}`);
1940
+ throw new Error(`Invalid action type: ${JSON.stringify(i)}`);
1938
1941
  const u = { type: i, input: r, scope: f };
1939
1942
  s && (u.attachments = s);
1940
1943
  try {
@@ -1944,7 +1947,7 @@ function ht(i, r, s, p, f = "global") {
1944
1947
  }
1945
1948
  return u;
1946
1949
  }
1947
- function Rr(i, r = de) {
1950
+ function Rr(i, r = ge) {
1948
1951
  return (s, p, f, u) => r(s, p, i, f, u);
1949
1952
  }
1950
1953
  const Lr = (i, r) => ({
@@ -1970,12 +1973,12 @@ const Lr = (i, r) => ({
1970
1973
  operations: { global: [], local: [] },
1971
1974
  clipboard: []
1972
1975
  };
1973
- }, Se = (i, r = "global") => Ot(St(i.state[r] || "")), ri = (i, r = 1e3) => {
1976
+ }, Ht = (i, r = "global") => Ot(St(i.state[r] || "")), ri = (i, r = 1e3) => {
1974
1977
  const s = Math.random() * r;
1975
1978
  return Ot(`${(i ?? /* @__PURE__ */ new Date()).toISOString()}${s}`);
1976
1979
  };
1977
1980
  function _t(i) {
1978
- return Me(Ne(i, !0));
1981
+ return Ne(Me(i, !0));
1979
1982
  }
1980
1983
  function Pr(i, r) {
1981
1984
  const s = [...i];
@@ -1983,29 +1986,29 @@ function Pr(i, r) {
1983
1986
  const u = [];
1984
1987
  for (const l of s.reverse()) {
1985
1988
  if (p > 0) {
1986
- const g = f - l.index;
1987
- p -= g;
1989
+ const y = f - l.index;
1990
+ p -= y;
1988
1991
  }
1989
1992
  if (p < 0)
1990
1993
  throw new Error("Invalid operation index, missing operations");
1991
1994
  const a = {
1992
1995
  ignore: p > 0,
1993
1996
  operation: l
1994
- }, x = l.skip > 0 ? l.skip + 1 : 0;
1995
- if (x > 0 && x > p) {
1996
- const g = x - p;
1997
- p = p + g;
1997
+ }, h = l.skip > 0 ? l.skip + 1 : 0;
1998
+ if (h > 0 && h > p) {
1999
+ const y = h - p;
2000
+ p = p + y;
1998
2001
  }
1999
2002
  f = l.index, u.push(a);
2000
2003
  }
2001
2004
  return u.reverse();
2002
2005
  }
2003
2006
  function qr(i, r, s) {
2004
- const p = i.slice().sort((a, x) => a.skip - x.skip).sort((a, x) => a.index - x.index);
2007
+ const p = i.slice().sort((a, h) => a.skip - h.skip).sort((a, h) => a.index - h.index);
2005
2008
  let f = s, u = 0, l = r;
2006
2009
  for (const a of p.reverse()) {
2007
- const x = l - a.index;
2008
- if (f = f - x, f > -1)
2010
+ const h = l - a.index;
2011
+ if (f = f - h, f > -1)
2009
2012
  u++, l = a.index;
2010
2013
  else
2011
2014
  break;
@@ -2022,71 +2025,82 @@ function Jr(i) {
2022
2025
  (r, s) => new Date(r.operation.timestamp).getTime() - new Date(s.operation.timestamp).getTime()
2023
2026
  );
2024
2027
  }
2025
- function Mt(i, r, s, p, f, u = de, l = {}) {
2026
- const a = Rr(s, u);
2028
+ function Nt(i, r, s, p, f, u = ge, l = {}, a) {
2029
+ const h = Rr(s, u);
2027
2030
  return Fe(
2028
2031
  i,
2029
2032
  r,
2030
- a,
2033
+ h,
2031
2034
  p,
2032
2035
  f,
2033
- l
2036
+ l,
2037
+ a
2034
2038
  );
2035
2039
  }
2036
- function Fe(i, r, s, p, f, u = {}) {
2037
- const l = zr(i), a = Object.keys(r).reduce((b, F) => {
2038
- const I = F;
2040
+ function Fe(i, r, s, p, f, u = {}, l) {
2041
+ const a = (l == null ? void 0 : l.checkHashes) ?? !0, h = zr(i), y = Object.keys(r).reduce((C, R) => {
2042
+ const g = R;
2039
2043
  return {
2040
- ...b,
2041
- [I]: r[I].slice(0, f == null ? void 0 : f.revision[I])
2044
+ ...C,
2045
+ [g]: r[g].slice(0, f == null ? void 0 : f.revision[g])
2042
2046
  };
2043
- }, {}), x = Object.keys(a).reduce(
2044
- (b, F) => {
2045
- const I = F;
2047
+ }, {}), w = Object.keys(y).reduce(
2048
+ (C, R) => {
2049
+ const g = R;
2046
2050
  return {
2047
- ...b,
2048
- [I]: Pr(
2049
- a[I],
2050
- u[I]
2051
+ ...C,
2052
+ [g]: Pr(
2053
+ y[g],
2054
+ u[g]
2051
2055
  )
2052
2056
  };
2053
2057
  },
2054
2058
  {}
2055
- ), g = Jr(x).reduce(
2056
- (b, { ignore: F, operation: I }) => F ? s(b, Ht(I.scope), p, {
2057
- skip: I.skip,
2058
- ignoreSkipOperations: !0
2059
- }) : s(b, I, p, {
2060
- skip: I.skip,
2059
+ ), _ = Jr(w), v = _.reduce(
2060
+ (C, { ignore: R, operation: g }, b, O) => R ? s(C, Zt(g.scope), p, {
2061
+ skip: g.skip,
2061
2062
  ignoreSkipOperations: !0
2063
+ // TODO: reuse hash?
2064
+ }) : s(C, g, p, {
2065
+ skip: g.skip,
2066
+ ignoreSkipOperations: !0,
2067
+ reuseHash: !a
2062
2068
  }),
2063
- l
2064
- ), A = Object.keys(
2065
- g.operations
2069
+ h
2070
+ );
2071
+ for (const C of Object.keys(v.state))
2072
+ for (let R = _.length - 1; R >= 0; R--)
2073
+ if (_[R].operation.scope === C) {
2074
+ if (_[R].operation.hash !== Ht(v, C))
2075
+ throw new Error(`Hash mismatch for scope ${C}`);
2076
+ break;
2077
+ }
2078
+ const B = Object.keys(
2079
+ v.operations
2066
2080
  ).reduce(
2067
- (b, F) => {
2068
- const I = F, G = f && f.revision[I] < r[I].length ? r[I].slice(f.revision[I]) : [];
2081
+ (C, R) => {
2082
+ const g = R, b = f && f.revision[g] < r[g].length ? r[g].slice(f.revision[g]) : [];
2069
2083
  return {
2070
- ...b,
2071
- [I]: [
2072
- ...g.operations[I].map((rt, y) => {
2073
- var E;
2084
+ ...C,
2085
+ [g]: [
2086
+ ...v.operations[g].map((O, P) => {
2087
+ var K;
2074
2088
  return {
2075
- ...rt,
2076
- timestamp: ((E = r[I][y]) == null ? void 0 : E.timestamp) ?? rt.timestamp
2089
+ ...O,
2090
+ timestamp: ((K = r[g][P]) == null ? void 0 : K.timestamp) ?? O.timestamp
2077
2091
  };
2078
2092
  }),
2079
- ...G
2093
+ ...b
2080
2094
  ]
2081
2095
  };
2082
2096
  },
2083
2097
  { global: [], local: [] }
2084
- ), w = Object.values(A).reduce((b, F) => {
2085
- for (const I of F)
2086
- I.timestamp > b && (b = I.timestamp);
2087
- return b;
2098
+ ), W = Object.values(B).reduce((C, R) => {
2099
+ for (const g of R)
2100
+ g.timestamp > C && (C = g.timestamp);
2101
+ return C;
2088
2102
  }, i.lastModified);
2089
- return { ...g, operations: A, lastModified: w };
2103
+ return { ...v, operations: B, lastModified: W };
2090
2104
  }
2091
2105
  function ni(i, r) {
2092
2106
  return St(i) === St(r);
@@ -2119,18 +2133,18 @@ const Be = (i) => ht(
2119
2133
  "LOAD_STATE",
2120
2134
  { state: i, operations: r },
2121
2135
  void 0,
2122
- Nt
2123
- ), Ht = (i = "global") => ht("NOOP", {}, void 0, void 0, i), oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2136
+ Mt
2137
+ ), Zt = (i = "global") => ht("NOOP", {}, void 0, void 0, i), oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2124
2138
  __proto__: null,
2125
2139
  loadState: Kt,
2126
- noop: Ht,
2140
+ noop: Zt,
2127
2141
  prune: Ie,
2128
2142
  redo: Oe,
2129
2143
  setName: Be,
2130
2144
  undo: je
2131
2145
  }, Symbol.toStringTag, { value: "Module" })), Te = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
2132
2146
  Object.freeze(Te);
2133
- var tt = function(i, r, s, p) {
2147
+ var et = function(i, r, s, p) {
2134
2148
  if (s === "a" && !p)
2135
2149
  throw new TypeError("Private accessor was defined without a getter");
2136
2150
  if (typeof r == "function" ? i !== r || !p : !r.has(i))
@@ -2145,17 +2159,17 @@ class Wr {
2145
2159
  }
2146
2160
  define(r, s = !1) {
2147
2161
  for (let [p, f] of Object.entries(r)) {
2148
- p = p.toLowerCase(), f = f.map((a) => a.toLowerCase()), tt(this, pt, "f").has(p) || tt(this, pt, "f").set(p, /* @__PURE__ */ new Set());
2149
- const u = tt(this, pt, "f").get(p);
2162
+ p = p.toLowerCase(), f = f.map((a) => a.toLowerCase()), et(this, pt, "f").has(p) || et(this, pt, "f").set(p, /* @__PURE__ */ new Set());
2163
+ const u = et(this, pt, "f").get(p);
2150
2164
  let l = !0;
2151
2165
  for (let a of f) {
2152
- const x = a.startsWith("*");
2153
- if (a = x ? a.slice(1) : a, u == null || u.add(a), l && tt(this, mt, "f").set(p, a), l = !1, x)
2166
+ const h = a.startsWith("*");
2167
+ if (a = h ? a.slice(1) : a, u == null || u.add(a), l && et(this, mt, "f").set(p, a), l = !1, h)
2154
2168
  continue;
2155
- const g = tt(this, ft, "f").get(a);
2156
- if (g && g != p && !s)
2157
- throw new Error(`"${p} -> ${a}" conflicts with "${g} -> ${a}". Pass \`force=true\` to override this definition.`);
2158
- tt(this, ft, "f").set(a, p);
2169
+ const y = et(this, ft, "f").get(a);
2170
+ if (y && y != p && !s)
2171
+ throw new Error(`"${p} -> ${a}" conflicts with "${y} -> ${a}". Pass \`force=true\` to override this definition.`);
2172
+ et(this, ft, "f").set(a, p);
2159
2173
  }
2160
2174
  }
2161
2175
  return this;
@@ -2164,33 +2178,33 @@ class Wr {
2164
2178
  if (typeof r != "string")
2165
2179
  return null;
2166
2180
  const s = r.replace(/^.*[/\\]/, "").toLowerCase(), p = s.replace(/^.*\./, "").toLowerCase(), f = s.length < r.length;
2167
- return !(p.length < s.length - 1) && f ? null : tt(this, ft, "f").get(p) ?? null;
2181
+ return !(p.length < s.length - 1) && f ? null : et(this, ft, "f").get(p) ?? null;
2168
2182
  }
2169
2183
  getExtension(r) {
2170
2184
  var s;
2171
- return typeof r != "string" ? null : (r = (s = r == null ? void 0 : r.split) == null ? void 0 : s.call(r, ";")[0], (r && tt(this, mt, "f").get(r.trim().toLowerCase())) ?? null);
2185
+ return typeof r != "string" ? null : (r = (s = r == null ? void 0 : r.split) == null ? void 0 : s.call(r, ";")[0], (r && et(this, mt, "f").get(r.trim().toLowerCase())) ?? null);
2172
2186
  }
2173
2187
  getAllExtensions(r) {
2174
- return typeof r != "string" ? null : tt(this, pt, "f").get(r.toLowerCase()) ?? null;
2188
+ return typeof r != "string" ? null : et(this, pt, "f").get(r.toLowerCase()) ?? null;
2175
2189
  }
2176
2190
  _freeze() {
2177
2191
  this.define = () => {
2178
2192
  throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
2179
2193
  }, Object.freeze(this);
2180
- for (const r of tt(this, pt, "f").values())
2194
+ for (const r of et(this, pt, "f").values())
2181
2195
  Object.freeze(r);
2182
2196
  return this;
2183
2197
  }
2184
2198
  _getTestState() {
2185
2199
  return {
2186
- types: tt(this, ft, "f"),
2187
- extensions: tt(this, mt, "f")
2200
+ types: et(this, ft, "f"),
2201
+ extensions: et(this, mt, "f")
2188
2202
  };
2189
2203
  }
2190
2204
  }
2191
2205
  ft = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap();
2192
2206
  const Vr = new Wr(Te)._freeze();
2193
- function Kr(i) {
2207
+ function Hr(i) {
2194
2208
  const r = [], s = Object.keys(i);
2195
2209
  for (const p of s) {
2196
2210
  const f = i[p].sort((u, l) => u.index - l.index);
@@ -2207,7 +2221,7 @@ function Kr(i) {
2207
2221
  return r;
2208
2222
  }
2209
2223
  const ke = async (i) => {
2210
- const r = new te(), { name: s, revision: p, documentType: f, created: u, lastModified: l } = i, a = {
2224
+ const r = new ee(), { name: s, revision: p, documentType: f, created: u, lastModified: l } = i, a = {
2211
2225
  name: s,
2212
2226
  revision: p,
2213
2227
  documentType: f,
@@ -2217,70 +2231,70 @@ const ke = async (i) => {
2217
2231
  return r.file("header.json", JSON.stringify(a, null, 2)), r.file(
2218
2232
  "state.json",
2219
2233
  JSON.stringify(i.initialState || {}, null, 2)
2220
- ), r.file("operations.json", JSON.stringify(i.operations, null, 2)), Object.keys(i.attachments).forEach((g) => {
2221
- const { data: A, ...w } = i.attachments[g];
2222
- r.file(g, A, {
2234
+ ), r.file("operations.json", JSON.stringify(i.operations, null, 2)), Object.keys(i.attachments).forEach((y) => {
2235
+ const { data: w, ..._ } = i.attachments[y];
2236
+ r.file(y, w, {
2223
2237
  base64: !0,
2224
2238
  createFolders: !0,
2225
- comment: JSON.stringify(w)
2239
+ comment: JSON.stringify(_)
2226
2240
  });
2227
2241
  }), r;
2228
- }, Hr = async (i, r, s, p) => {
2242
+ }, Kr = async (i, r, s, p) => {
2229
2243
  await (await ke(i)).generateAsync({
2230
2244
  type: "uint8array",
2231
2245
  streamFiles: !0
2232
2246
  });
2233
2247
  const u = p ?? i.name, l = `.${s}.zip`;
2234
- return Dr(
2248
+ return $r(
2235
2249
  r,
2236
2250
  u.endsWith(l) ? u : `${u}${l}`
2237
2251
  );
2238
2252
  }, ai = async (i, r) => {
2239
2253
  const p = await (await ke(i)).generateAsync({ type: "blob" }), f = await r.createWritable();
2240
2254
  await f.write(p), await f.close();
2241
- }, Qt = async (i, r) => {
2242
- const s = _e();
2243
- return Zr(s, r);
2244
- }, Zr = async (i, r) => {
2245
- const s = new te();
2246
- return await s.loadAsync(i), Gr(s, r);
2255
+ }, te = async (i, r, s) => {
2256
+ const p = Se();
2257
+ return Zr(p, r);
2258
+ }, Zr = async (i, r, s) => {
2259
+ const p = new ee();
2260
+ return await p.loadAsync(i), Gr(p, r);
2247
2261
  };
2248
- async function Gr(i, r) {
2249
- const s = i.file("state.json");
2250
- if (!s)
2262
+ async function Gr(i, r, s) {
2263
+ const p = i.file("state.json");
2264
+ if (!p)
2251
2265
  throw new Error("Initial state not found");
2252
- const p = await s.async("string"), f = JSON.parse(p), u = i.file("header.json");
2253
- let l;
2254
- u && (l = JSON.parse(await u.async("string")));
2255
- const a = i.file("operations.json");
2256
- if (!a)
2266
+ const f = await p.async("string"), u = JSON.parse(f), l = i.file("header.json");
2267
+ let a;
2268
+ l && (a = JSON.parse(await l.async("string")));
2269
+ const h = i.file("operations.json");
2270
+ if (!h)
2257
2271
  throw new Error("Operations history not found");
2258
- const x = JSON.parse(
2259
- await a.async("string")
2260
- ), g = Kr(x);
2261
- if (g.length) {
2262
- const w = g.map((b) => b.message);
2263
- throw new Error(w.join(`
2272
+ const y = JSON.parse(
2273
+ await h.async("string")
2274
+ ), w = Hr(y);
2275
+ if (w.length) {
2276
+ const v = w.map((B) => B.message);
2277
+ throw new Error(v.join(`
2264
2278
  `));
2265
2279
  }
2266
- let A = Fe(
2267
- f,
2268
- x,
2280
+ let _ = Fe(
2281
+ u,
2282
+ y,
2269
2283
  r,
2270
2284
  void 0,
2271
- l
2285
+ a
2272
2286
  );
2273
- return l && (A = {
2274
- ...A,
2275
- ...l
2276
- }), A;
2287
+ return a && (_ = {
2288
+ ..._,
2289
+ ...a
2290
+ }), _;
2277
2291
  }
2278
2292
  function Ue(i) {
2279
2293
  const r = i.replace(/^.*\./, "") || void 0, s = i.replace(/^.*[/\\]/, "") || void 0;
2280
2294
  return { extension: r, fileName: s };
2281
2295
  }
2282
2296
  async function si(i) {
2283
- const { buffer: r, mimeType: s = "application/octet-stream" } = await $r(), p = Ue(i), f = r.toString("base64");
2297
+ const { buffer: r, mimeType: s = "application/octet-stream" } = await Dr(), p = Ue(i), f = r.toString("base64");
2284
2298
  return {
2285
2299
  data: f,
2286
2300
  hash: Ot(f),
@@ -2324,14 +2338,14 @@ class ci {
2324
2338
  * @returns The file path where the state was saved.
2325
2339
  */
2326
2340
  saveToFile(r, s, p) {
2327
- return Hr(this._document, r, s, p);
2341
+ return Kr(this._document, r, s, p);
2328
2342
  }
2329
2343
  /**
2330
2344
  * Loads the state of the document from a file.
2331
2345
  * @param path - The file path where the state is stored.
2332
2346
  */
2333
2347
  async loadFromFile(r) {
2334
- this._document = await Qt(r, this._reducer);
2348
+ this._document = await te(r, this._reducer);
2335
2349
  }
2336
2350
  /**
2337
2351
  * Loads the state of the document from a file and returns it.
@@ -2340,7 +2354,7 @@ class ci {
2340
2354
  * @returns The state of the document.
2341
2355
  */
2342
2356
  static async stateFromFile(r, s) {
2343
- return await Qt(r, s);
2357
+ return await te(r, s);
2344
2358
  }
2345
2359
  /**
2346
2360
  * Gets the current state of the document.
@@ -2458,9 +2472,9 @@ function li(i, r) {
2458
2472
  });
2459
2473
  }
2460
2474
  export {
2461
- Kr as A,
2475
+ Hr as A,
2462
2476
  ci as B,
2463
- de as C,
2477
+ ge as C,
2464
2478
  ir as D,
2465
2479
  ei as E,
2466
2480
  Lr as a,
@@ -2471,22 +2485,22 @@ export {
2471
2485
  ht as f,
2472
2486
  li as g,
2473
2487
  oi as h,
2474
- Xt as i,
2488
+ Qt as i,
2475
2489
  qr as j,
2476
2490
  ke as k,
2477
- Qt as l,
2491
+ te as l,
2478
2492
  pi as m,
2479
2493
  si as n,
2480
- Se as o,
2494
+ Ht as o,
2481
2495
  ri as p,
2482
- Nr as q,
2496
+ Mr as q,
2483
2497
  ni as r,
2484
- Hr as s,
2485
- Yt as t,
2498
+ Kr as s,
2499
+ Xt as t,
2486
2500
  Pr as u,
2487
2501
  _t as v,
2488
2502
  Fe as w,
2489
- Mt as x,
2503
+ Nt as x,
2490
2504
  Jr as y,
2491
2505
  ii as z
2492
2506
  };