document-model 1.0.51 → 1.0.53

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 (98) hide show
  1. package/dist/browser/cjs/document-model.js +1 -1
  2. package/dist/browser/cjs/document.js +1 -1
  3. package/dist/browser/cjs/index.js +1 -1
  4. package/dist/{node/cjs/internal/index-CRjFLQNR.js → browser/cjs/internal/index-BAk-LH-1.js} +1 -1
  5. package/dist/browser/cjs/internal/{index-CPJM383s.js → index-Cb6Xq42D.js} +1 -1
  6. package/dist/browser/cjs/internal/object-D1n8rS0m.js +25 -0
  7. package/dist/browser/es/document-model.js +2 -2
  8. package/dist/browser/es/document.js +2 -2
  9. package/dist/browser/es/index.js +3 -3
  10. package/dist/browser/es/internal/{index-BzIVYv7p.js → index-DeOZH3b_.js} +1 -1
  11. package/dist/browser/es/internal/{index-tEH7iGUj.js → index-DwxnEmzI.js} +1 -1
  12. package/dist/browser/es/internal/{object-Dev4WFVH.js → object-DsqsdDFj.js} +767 -771
  13. package/dist/browser/src/document/object.d.ts +35 -0
  14. package/dist/browser/src/document/types.d.ts +2 -0
  15. package/dist/node/cjs/document-model.js +1 -1
  16. package/dist/node/cjs/document.js +1 -1
  17. package/dist/node/cjs/index.js +1 -1
  18. package/dist/{browser/cjs/internal/index-REU04m7f.js → node/cjs/internal/index-CpjKrifV.js} +1 -1
  19. package/dist/node/cjs/internal/{index-BX95XaQ_.js → index-DzXcygIJ.js} +1 -1
  20. package/dist/node/cjs/internal/object-Cx_c54j_.js +20 -0
  21. package/dist/node/es/document-model.js +2 -2
  22. package/dist/node/es/document.js +2 -2
  23. package/dist/node/es/index.js +3 -3
  24. package/dist/node/es/internal/{index-BzNCX_-9.js → index-CUitPgxf.js} +1 -1
  25. package/dist/node/es/internal/{index-DpH4_29z.js → index-V-nmqbyU.js} +1 -1
  26. package/dist/node/es/internal/{object-BFkXGmt6.js → object-C0WcyLCx.js} +500 -504
  27. package/dist/node/src/document/object.d.ts +35 -0
  28. package/dist/node/src/document/types.d.ts +2 -0
  29. package/package.json +1 -1
  30. package/dist/browser/cjs/internal/object-DkoS83BB.js +0 -25
  31. package/dist/node/cjs/internal/object-CGt7Qacd.js +0 -20
  32. package/dist/src/document/actions/creators.d.ts +0 -47
  33. package/dist/src/document/actions/index.d.ts +0 -14
  34. package/dist/src/document/actions/types.d.ts +0 -15
  35. package/dist/src/document/index.d.ts +0 -6
  36. package/dist/src/document/object.d.ts +0 -1140
  37. package/dist/src/document/reducer.d.ts +0 -32
  38. package/dist/src/document/schema/index.d.ts +0 -2
  39. package/dist/src/document/schema/types.d.ts +0 -176
  40. package/dist/src/document/schema/zod.d.ts +0 -113
  41. package/dist/src/document/signal.d.ts +0 -29
  42. package/dist/src/document/types.d.ts +0 -247
  43. package/dist/src/document/utils/base.d.ts +0 -85
  44. package/dist/src/document/utils/file.d.ts +0 -48
  45. package/dist/src/document/utils/index.d.ts +0 -4
  46. package/dist/src/document/utils/node.d.ts +0 -9
  47. package/dist/src/document/utils/validation.d.ts +0 -2
  48. package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
  49. package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
  50. package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
  51. package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
  52. package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
  53. package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
  54. package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
  55. package/dist/src/document-model/custom/utils.d.ts +0 -7
  56. package/dist/src/document-model/gen/actions.d.ts +0 -15
  57. package/dist/src/document-model/gen/creators.d.ts +0 -7
  58. package/dist/src/document-model/gen/document-model.d.ts +0 -2
  59. package/dist/src/document-model/gen/header/actions.d.ts +0 -9
  60. package/dist/src/document-model/gen/header/creators.d.ts +0 -8
  61. package/dist/src/document-model/gen/header/object.d.ts +0 -12
  62. package/dist/src/document-model/gen/header/operations.d.ts +0 -10
  63. package/dist/src/document-model/gen/index.d.ts +0 -5
  64. package/dist/src/document-model/gen/module/actions.d.ts +0 -8
  65. package/dist/src/document-model/gen/module/creators.d.ts +0 -7
  66. package/dist/src/document-model/gen/module/object.d.ts +0 -11
  67. package/dist/src/document-model/gen/module/operations.d.ts +0 -9
  68. package/dist/src/document-model/gen/object.d.ts +0 -28
  69. package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
  70. package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
  71. package/dist/src/document-model/gen/operation/object.d.ts +0 -16
  72. package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
  73. package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
  74. package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
  75. package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
  76. package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
  77. package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
  78. package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
  79. package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
  80. package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
  81. package/dist/src/document-model/gen/reducer.d.ts +0 -5
  82. package/dist/src/document-model/gen/schema/index.d.ts +0 -2
  83. package/dist/src/document-model/gen/schema/types.d.ts +0 -453
  84. package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
  85. package/dist/src/document-model/gen/state/actions.d.ts +0 -9
  86. package/dist/src/document-model/gen/state/creators.d.ts +0 -8
  87. package/dist/src/document-model/gen/state/object.d.ts +0 -12
  88. package/dist/src/document-model/gen/state/operations.d.ts +0 -10
  89. package/dist/src/document-model/gen/types.d.ts +0 -8
  90. package/dist/src/document-model/gen/utils.d.ts +0 -6
  91. package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
  92. package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
  93. package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
  94. package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
  95. package/dist/src/document-model/index.d.ts +0 -80
  96. package/dist/src/index.d.ts +0 -25
  97. package/dist/vite.config.d.ts +0 -2
  98. package/dist/vitest.config.d.ts +0 -2
@@ -1,21 +1,21 @@
1
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
- var At = (i, r, s) => (Ce(i, typeof r != "symbol" ? r + "" : r, s), s);
2
+ var Ce = (r, i, s) => i in r ? De(r, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[i] = s;
3
+ var At = (r, i, s) => (Ce(r, typeof i != "symbol" ? i + "" : i, s), s);
4
4
  import { produce as xt, castDraft as Ut, castImmutable as Ne, freeze as Me } from "immer";
5
- import { z as A } from "zod";
5
+ import { z as v } from "zod";
6
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"]);
7
+ const re = (r) => r != null, Re = v.any().refine((r) => re(r)), ie = v.enum(["LOAD_STATE"]), ne = v.enum(["PRUNE"]), oe = v.enum(["REDO"]), ae = v.enum(["SET_NAME"]), se = v.enum(["UNDO"]);
8
8
  function Le() {
9
- return A.object({
10
- __typename: A.literal("Action").optional(),
11
- type: A.string()
9
+ return v.object({
10
+ __typename: v.literal("Action").optional(),
11
+ type: v.string()
12
12
  });
13
13
  }
14
14
  function dt() {
15
- return A.literal("global").or(A.literal("local"));
15
+ return v.literal("global").or(v.literal("local"));
16
16
  }
17
17
  function pe() {
18
- return A.union([
18
+ return v.union([
19
19
  ce(),
20
20
  ue(),
21
21
  fe(),
@@ -24,84 +24,84 @@ function pe() {
24
24
  ]);
25
25
  }
26
26
  function ze() {
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()
27
+ return v.object({
28
+ __typename: v.literal("DocumentFile").optional(),
29
+ data: v.string(),
30
+ extension: v.string().nullable(),
31
+ fileName: v.string().nullable(),
32
+ mimeType: v.string()
33
33
  });
34
34
  }
35
35
  function ce() {
36
- return A.object({
37
- input: A.lazy(() => Mt()),
36
+ return v.object({
37
+ input: v.lazy(() => Mt()),
38
38
  type: ie,
39
39
  scope: dt()
40
40
  });
41
41
  }
42
42
  function Mt() {
43
- return A.object({
44
- operations: A.number(),
45
- state: A.lazy(() => le())
43
+ return v.object({
44
+ operations: v.number(),
45
+ state: v.lazy(() => le())
46
46
  });
47
47
  }
48
48
  function le() {
49
- return A.object({
50
- data: A.unknown().nullish(),
51
- name: A.string()
49
+ return v.object({
50
+ data: v.unknown().nullish(),
51
+ name: v.string()
52
52
  });
53
53
  }
54
54
  function Pe() {
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()
55
+ return v.object({
56
+ __typename: v.literal("Operation").optional(),
57
+ hash: v.string(),
58
+ index: v.number(),
59
+ timestamp: v.string().datetime(),
60
+ type: v.string()
61
61
  });
62
62
  }
63
63
  function ue() {
64
- return A.object({
65
- input: A.lazy(() => Rt()),
64
+ return v.object({
65
+ input: v.lazy(() => Rt()),
66
66
  type: ne,
67
67
  scope: dt()
68
68
  });
69
69
  }
70
70
  function Rt() {
71
- return A.object({
72
- end: A.number().nullish(),
73
- start: A.number().nullish()
71
+ return v.object({
72
+ end: v.number().nullish(),
73
+ start: v.number().nullish()
74
74
  });
75
75
  }
76
- const Lt = A.number;
76
+ const Lt = v.number;
77
77
  function fe() {
78
- return A.object({
78
+ return v.object({
79
79
  input: Lt(),
80
80
  type: oe,
81
81
  scope: dt()
82
82
  });
83
83
  }
84
- const zt = A.string;
84
+ const zt = v.string;
85
85
  function he() {
86
- return A.object({
86
+ return v.object({
87
87
  input: zt(),
88
88
  type: ae,
89
- scope: A.literal("global")
89
+ scope: v.literal("global")
90
90
  });
91
91
  }
92
92
  function qe() {
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()
93
+ return v.object({
94
+ __typename: v.literal("SetNameOperation").optional(),
95
+ hash: v.string(),
96
+ index: v.number(),
97
+ input: v.string(),
98
+ timestamp: v.string().datetime(),
99
+ type: v.string()
100
100
  });
101
101
  }
102
- const Pt = A.number;
102
+ const Pt = v.number;
103
103
  function me() {
104
- return A.object({
104
+ return v.object({
105
105
  input: Pt(),
106
106
  type: se,
107
107
  scope: dt()
@@ -134,28 +134,28 @@ const ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
134
134
  definedNonNullAnySchema: Re,
135
135
  isDefinedNonNullAny: re
136
136
  }, Symbol.toStringTag, { value: "Module" }));
137
- function qt(i) {
138
- return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
137
+ function qt(r) {
138
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
139
139
  }
140
140
  var $t = { exports: {} };
141
- (function(i, r) {
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;
141
+ (function(r, i) {
142
+ const { hasOwnProperty: s } = Object.prototype, p = C();
143
+ p.configure = C, p.stringify = p, p.default = p, i.stringify = p, i.configure = C, r.exports = p;
144
144
  const f = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
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;
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 b = 1; b < y.length; b++) {
152
+ const I = y[b];
153
+ let W = b;
154
+ for (; W !== 0 && y[W - 1] > I; )
155
+ y[W] = y[W - 1], W--;
156
+ y[W] = I;
157
157
  }
158
- return g;
158
+ return y;
159
159
  }
160
160
  const a = Object.getOwnPropertyDescriptor(
161
161
  Object.getPrototypeOf(
@@ -165,20 +165,20 @@ var $t = { exports: {} };
165
165
  ),
166
166
  Symbol.toStringTag
167
167
  ).get;
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;
168
+ function h(y) {
169
+ return a.call(y) !== void 0 && y.length !== 0;
170
+ }
171
+ function w(y, b, I) {
172
+ y.length < I && (I = y.length);
173
+ const W = b === "," ? "" : " ";
174
+ let Y = `"0":${W}${y[0]}`;
175
+ for (let G = 1; G < I; G++)
176
+ Y += `${b}"${G}":${W}${y[G]}`;
177
+ return Y;
178
+ }
179
+ function g(y) {
180
+ if (s.call(y, "circularValue")) {
181
+ const b = y.circularValue;
182
182
  if (typeof b == "string")
183
183
  return `"${b}"`;
184
184
  if (b == null)
@@ -193,51 +193,51 @@ var $t = { exports: {} };
193
193
  }
194
194
  return '"[Circular]"';
195
195
  }
196
- function _(g, b) {
197
- let O;
198
- if (s.call(g, b) && (O = g[b], typeof O != "boolean"))
196
+ function A(y, b) {
197
+ let I;
198
+ if (s.call(y, b) && (I = y[b], typeof I != "boolean"))
199
199
  throw new TypeError(`The "${b}" argument must be of type boolean`);
200
- return O === void 0 ? !0 : O;
200
+ return I === void 0 ? !0 : I;
201
201
  }
202
- function v(g, b) {
203
- let O;
204
- if (s.call(g, b)) {
205
- if (O = g[b], typeof O != "number")
202
+ function _(y, b) {
203
+ let I;
204
+ if (s.call(y, b)) {
205
+ if (I = y[b], typeof I != "number")
206
206
  throw new TypeError(`The "${b}" argument must be of type number`);
207
- if (!Number.isInteger(O))
207
+ if (!Number.isInteger(I))
208
208
  throw new TypeError(`The "${b}" argument must be an integer`);
209
- if (O < 1)
209
+ if (I < 1)
210
210
  throw new RangeError(`The "${b}" argument must be >= 1`);
211
211
  }
212
- return O === void 0 ? 1 / 0 : O;
212
+ return I === void 0 ? 1 / 0 : I;
213
213
  }
214
- function B(g) {
215
- return g === 1 ? "1 item" : `${g} items`;
214
+ function F(y) {
215
+ return y === 1 ? "1 item" : `${y} items`;
216
216
  }
217
- function W(g) {
217
+ function U(y) {
218
218
  const b = /* @__PURE__ */ new Set();
219
- for (const O of g)
220
- (typeof O == "string" || typeof O == "number") && b.add(String(O));
219
+ for (const I of y)
220
+ (typeof I == "string" || typeof I == "number") && b.add(String(I));
221
221
  return b;
222
222
  }
223
- function C(g) {
224
- if (s.call(g, "strict")) {
225
- const b = g.strict;
223
+ function L(y) {
224
+ if (s.call(y, "strict")) {
225
+ const b = y.strict;
226
226
  if (typeof b != "boolean")
227
227
  throw new TypeError('The "strict" argument must be of type boolean');
228
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);
229
+ return (I) => {
230
+ let W = `Object can not safely be stringified. Received type ${typeof I}`;
231
+ throw typeof I != "function" && (W += ` (${I.toString()})`), new Error(W);
232
232
  };
233
233
  }
234
234
  }
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, $) {
235
+ function C(y) {
236
+ y = { ...y };
237
+ const b = L(y);
238
+ b && (y.bigint === void 0 && (y.bigint = !1), "circularValue" in y || (y.circularValue = Error));
239
+ const I = g(y), W = A(y, "bigint"), Y = A(y, "deterministic"), G = _(y, "maximumDepth"), R = _(y, "maximumBreadth");
240
+ function ct(V, m, E, T, j, D) {
241
241
  let S = m[V];
242
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":
@@ -246,53 +246,53 @@ var $t = { exports: {} };
246
246
  if (S === null)
247
247
  return "null";
248
248
  if (E.indexOf(S) !== -1)
249
- return O;
250
- let k = "", F = ",";
251
- const I = $;
249
+ return I;
250
+ let k = "", B = ",";
251
+ const O = D;
252
252
  if (Array.isArray(S)) {
253
253
  if (S.length === 0)
254
254
  return "[]";
255
- if (Y < E.length + 1)
255
+ if (G < E.length + 1)
256
256
  return '"[Array]"';
257
- E.push(S), j !== "" && ($ += j, k += `
258
- ${$}`, F = `,
259
- ${$}`);
260
- const H = Math.min(S.length, M);
257
+ E.push(S), j !== "" && (D += j, k += `
258
+ ${D}`, B = `,
259
+ ${D}`);
260
+ const H = Math.min(S.length, R);
261
261
  let Q = 0;
262
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;
263
+ const st = ct(String(Q), S, E, T, j, D);
264
+ k += st !== void 0 ? st : "null", k += B;
265
265
  }
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"`;
266
+ const tt = ct(String(Q), S, E, T, j, D);
267
+ if (k += tt !== void 0 ? tt : "null", S.length - 1 > R) {
268
+ const st = S.length - R - 1;
269
+ k += `${B}"... ${F(st)} not stringified"`;
270
270
  }
271
271
  return j !== "" && (k += `
272
- ${I}`), E.pop(), `[${k}]`;
272
+ ${O}`), E.pop(), `[${k}]`;
273
273
  }
274
- let L = Object.keys(S);
275
- const J = L.length;
274
+ let z = Object.keys(S);
275
+ const J = z.length;
276
276
  if (J === 0)
277
277
  return "{}";
278
- if (Y < E.length + 1)
278
+ if (G < E.length + 1)
279
279
  return '"[Object]"';
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);
280
+ let N = "", K = "";
281
+ j !== "" && (D += j, B = `,
282
+ ${D}`, N = " ");
283
+ const X = Math.min(J, R);
284
+ Y && !h(S) && (z = l(z)), E.push(S);
285
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);
286
+ const Q = z[H], tt = ct(Q, S, E, T, j, D);
287
+ tt !== void 0 && (k += `${K}${u(Q)}:${N}${tt}`, K = B);
288
288
  }
289
- if (J > M) {
290
- const H = J - M;
291
- k += `${Z}"...":${D}"${B(H)} not stringified"`, Z = F;
289
+ if (J > R) {
290
+ const H = J - R;
291
+ k += `${K}"...":${N}"${F(H)} not stringified"`, K = B;
292
292
  }
293
- return j !== "" && Z.length > 1 && (k = `
294
- ${$}${k}
295
- ${I}`), E.pop(), `{${k}}`;
293
+ return j !== "" && K.length > 1 && (k = `
294
+ ${D}${k}
295
+ ${O}`), E.pop(), `{${k}}`;
296
296
  }
297
297
  case "number":
298
298
  return isFinite(S) ? String(S) : b ? b(S) : "null";
@@ -301,13 +301,13 @@ ${I}`), E.pop(), `{${k}}`;
301
301
  case "undefined":
302
302
  return;
303
303
  case "bigint":
304
- if (P)
304
+ if (W)
305
305
  return String(S);
306
306
  default:
307
307
  return b ? b(S) : void 0;
308
308
  }
309
309
  }
310
- function lt(V, m, E, T, j, $) {
310
+ function lt(V, m, E, T, j, D) {
311
311
  switch (typeof m == "object" && m !== null && typeof m.toJSON == "function" && (m = m.toJSON(V)), typeof m) {
312
312
  case "string":
313
313
  return u(m);
@@ -315,42 +315,42 @@ ${I}`), E.pop(), `{${k}}`;
315
315
  if (m === null)
316
316
  return "null";
317
317
  if (E.indexOf(m) !== -1)
318
- return O;
319
- const S = $;
320
- let k = "", F = ",";
318
+ return I;
319
+ const S = D;
320
+ let k = "", B = ",";
321
321
  if (Array.isArray(m)) {
322
322
  if (m.length === 0)
323
323
  return "[]";
324
- if (Y < E.length + 1)
324
+ if (G < E.length + 1)
325
325
  return '"[Array]"';
326
- E.push(m), j !== "" && ($ += j, k += `
327
- ${$}`, F = `,
328
- ${$}`);
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;
326
+ E.push(m), j !== "" && (D += j, k += `
327
+ ${D}`, B = `,
328
+ ${D}`);
329
+ const J = Math.min(m.length, R);
330
+ let N = 0;
331
+ for (; N < J - 1; N++) {
332
+ const X = lt(String(N), m[N], E, T, j, D);
333
+ k += X !== void 0 ? X : "null", k += B;
334
334
  }
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"`;
335
+ const K = lt(String(N), m[N], E, T, j, D);
336
+ if (k += K !== void 0 ? K : "null", m.length - 1 > R) {
337
+ const X = m.length - R - 1;
338
+ k += `${B}"... ${F(X)} not stringified"`;
339
339
  }
340
340
  return j !== "" && (k += `
341
341
  ${S}`), E.pop(), `[${k}]`;
342
342
  }
343
343
  E.push(m);
344
- let I = "";
345
- j !== "" && ($ += j, F = `,
346
- ${$}`, I = " ");
347
- let L = "";
344
+ let O = "";
345
+ j !== "" && (D += j, B = `,
346
+ ${D}`, O = " ");
347
+ let z = "";
348
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);
349
+ const N = lt(J, m[J], E, T, j, D);
350
+ N !== void 0 && (k += `${z}${u(J)}:${O}${N}`, z = B);
351
351
  }
352
- return j !== "" && L.length > 1 && (k = `
353
- ${$}${k}
352
+ return j !== "" && z.length > 1 && (k = `
353
+ ${D}${k}
354
354
  ${S}`), E.pop(), `{${k}}`;
355
355
  }
356
356
  case "number":
@@ -360,7 +360,7 @@ ${S}`), E.pop(), `{${k}}`;
360
360
  case "undefined":
361
361
  return;
362
362
  case "bigint":
363
- if (P)
363
+ if (W)
364
364
  return String(m);
365
365
  default:
366
366
  return b ? b(m) : void 0;
@@ -380,53 +380,53 @@ ${S}`), E.pop(), `{${k}}`;
380
380
  return "null";
381
381
  }
382
382
  if (E.indexOf(m) !== -1)
383
- return O;
384
- const $ = j;
383
+ return I;
384
+ const D = j;
385
385
  if (Array.isArray(m)) {
386
386
  if (m.length === 0)
387
387
  return "[]";
388
- if (Y < E.length + 1)
388
+ if (G < E.length + 1)
389
389
  return '"[Array]"';
390
390
  E.push(m), j += T;
391
- let D = `
391
+ let N = `
392
392
  ${j}`;
393
- const Z = `,
394
- ${j}`, X = Math.min(m.length, M);
393
+ const K = `,
394
+ ${j}`, X = Math.min(m.length, R);
395
395
  let H = 0;
396
396
  for (; H < X - 1; H++) {
397
397
  const tt = ot(String(H), m[H], E, T, j);
398
- D += tt !== void 0 ? tt : "null", D += Z;
398
+ N += tt !== void 0 ? tt : "null", N += K;
399
399
  }
400
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"`;
401
+ if (N += Q !== void 0 ? Q : "null", m.length - 1 > R) {
402
+ const tt = m.length - R - 1;
403
+ N += `${K}"... ${F(tt)} not stringified"`;
404
404
  }
405
- return D += `
406
- ${$}`, E.pop(), `[${D}]`;
405
+ return N += `
406
+ ${D}`, E.pop(), `[${N}]`;
407
407
  }
408
408
  let S = Object.keys(m);
409
409
  const k = S.length;
410
410
  if (k === 0)
411
411
  return "{}";
412
- if (Y < E.length + 1)
412
+ if (G < E.length + 1)
413
413
  return '"[Object]"';
414
414
  j += T;
415
- const F = `,
415
+ const B = `,
416
416
  ${j}`;
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);
417
+ let O = "", z = "", J = Math.min(k, R);
418
+ h(m) && (O += w(m, B, R), S = S.slice(m.length), J -= m.length, z = B), Y && (S = l(S)), E.push(m);
419
+ for (let N = 0; N < J; N++) {
420
+ const K = S[N], X = ot(K, m[K], E, T, j);
421
+ X !== void 0 && (O += `${z}${u(K)}: ${X}`, z = B);
422
422
  }
423
- if (k > M) {
424
- const D = k - M;
425
- I += `${L}"...": "${B(D)} not stringified"`, L = F;
423
+ if (k > R) {
424
+ const N = k - R;
425
+ O += `${z}"...": "${F(N)} not stringified"`, z = B;
426
426
  }
427
- return L !== "" && (I = `
428
- ${j}${I}
429
- ${$}`), E.pop(), `{${I}}`;
427
+ return z !== "" && (O = `
428
+ ${j}${O}
429
+ ${D}`), E.pop(), `{${O}}`;
430
430
  }
431
431
  case "number":
432
432
  return isFinite(m) ? String(m) : b ? b(m) : "null";
@@ -435,7 +435,7 @@ ${$}`), E.pop(), `{${I}}`;
435
435
  case "undefined":
436
436
  return;
437
437
  case "bigint":
438
- if (P)
438
+ if (W)
439
439
  return String(m);
440
440
  default:
441
441
  return b ? b(m) : void 0;
@@ -455,42 +455,42 @@ ${$}`), E.pop(), `{${I}}`;
455
455
  return "null";
456
456
  }
457
457
  if (E.indexOf(m) !== -1)
458
- return O;
458
+ return I;
459
459
  let T = "";
460
460
  if (Array.isArray(m)) {
461
461
  if (m.length === 0)
462
462
  return "[]";
463
- if (Y < E.length + 1)
463
+ if (G < E.length + 1)
464
464
  return '"[Array]"';
465
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);
466
+ const B = Math.min(m.length, R);
467
+ let O = 0;
468
+ for (; O < B - 1; O++) {
469
+ const J = at(String(O), m[O], E);
470
470
  T += J !== void 0 ? J : "null", T += ",";
471
471
  }
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"`;
472
+ const z = at(String(O), m[O], E);
473
+ if (T += z !== void 0 ? z : "null", m.length - 1 > R) {
474
+ const J = m.length - R - 1;
475
+ T += `,"... ${F(J)} not stringified"`;
476
476
  }
477
477
  return E.pop(), `[${T}]`;
478
478
  }
479
479
  let j = Object.keys(m);
480
- const $ = j.length;
481
- if ($ === 0)
480
+ const D = j.length;
481
+ if (D === 0)
482
482
  return "{}";
483
- if (Y < E.length + 1)
483
+ if (G < E.length + 1)
484
484
  return '"[Object]"';
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 = ",");
485
+ let S = "", k = Math.min(D, R);
486
+ h(m) && (T += w(m, ",", R), j = j.slice(m.length), k -= m.length, S = ","), Y && (j = l(j)), E.push(m);
487
+ for (let B = 0; B < k; B++) {
488
+ const O = j[B], z = at(O, m[O], E);
489
+ z !== void 0 && (T += `${S}${u(O)}:${z}`, S = ",");
490
490
  }
491
- if ($ > M) {
492
- const F = $ - M;
493
- T += `${S}"...":"${B(F)} not stringified"`;
491
+ if (D > R) {
492
+ const B = D - R;
493
+ T += `${S}"...":"${F(B)} not stringified"`;
494
494
  }
495
495
  return E.pop(), `{${T}}`;
496
496
  }
@@ -501,7 +501,7 @@ ${$}`), E.pop(), `{${I}}`;
501
501
  case "undefined":
502
502
  return;
503
503
  case "bigint":
504
- if (P)
504
+ if (W)
505
505
  return String(m);
506
506
  default:
507
507
  return b ? b(m) : void 0;
@@ -514,7 +514,7 @@ ${$}`), E.pop(), `{${I}}`;
514
514
  if (typeof m == "function")
515
515
  return ct("", { "": V }, [], m, T, "");
516
516
  if (Array.isArray(m))
517
- return lt("", V, [], W(m), T, "");
517
+ return lt("", V, [], U(m), T, "");
518
518
  }
519
519
  if (T.length !== 0)
520
520
  return ot("", V, [], T, "");
@@ -527,24 +527,24 @@ ${$}`), E.pop(), `{${I}}`;
527
527
  var Je = $t.exports;
528
528
  const St = /* @__PURE__ */ qt(Je);
529
529
  St.configure;
530
- function We(i, r) {
531
- return { ...i, name: r };
530
+ function We(r, i) {
531
+ return { ...r, name: i };
532
532
  }
533
- function Ve(i, r, s) {
533
+ function Ve(r, i, s) {
534
534
  const p = {
535
535
  skip: s,
536
- document: i
537
- }, { scope: f } = r;
538
- return !f || r.skip === void 0 ? p : xt(p, (u) => {
536
+ document: r
537
+ }, { scope: f } = i;
538
+ return !f || i.skip === void 0 ? p : xt(p, (u) => {
539
539
  const [l] = u.document.operations[f].slice(-1);
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();
540
+ i.skip && i.skip > 0 && (u.skip = i.skip), l.type === "NOOP" && i.index === l.index && u.skip > l.skip && u.document.operations[f].pop();
541
541
  });
542
542
  }
543
- function He(i, r, s) {
544
- const { scope: p, input: f } = r;
543
+ function He(r, i, s) {
544
+ const { scope: p, input: f } = i;
545
545
  return xt({
546
- document: i,
547
- action: r,
546
+ document: r,
547
+ action: i,
548
548
  skip: s
549
549
  }, (l) => {
550
550
  if (l.document.operations[p].length < 1)
@@ -562,31 +562,31 @@ function He(i, r, s) {
562
562
  const [a] = l.document.operations[p].slice(-1), h = a.type === "NOOP" && a.skip > 0;
563
563
  if (l.skip += f, h) {
564
564
  l.skip += a.skip;
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();
565
+ const _ = l.document.operations[p][l.document.operations[p].length - 2];
566
+ _ && a.index - _.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 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--, _--;
572
+ const w = l.document.operations[p].length - 1;
573
+ let g = f, A = h ? w - a.skip : w;
574
+ for (; g > 0 && A >= 0; ) {
575
+ const _ = l.document.operations[p][A];
576
+ if (!_) {
577
+ g--, A--;
578
578
  continue;
579
579
  }
580
- v.type === "NOOP" && v.skip > 0 ? (_ = _ - (v.skip + 1), l.skip += v.skip + 1) : (l.document.clipboard.push({ ...v }), w--, _--);
580
+ _.type === "NOOP" && _.skip > 0 ? (A = A - (_.skip + 1), l.skip += _.skip + 1) : (l.document.clipboard.push({ ..._ }), g--, A--);
581
581
  }
582
582
  l.action = Zt(p);
583
583
  });
584
584
  }
585
- function Ke(i, r, s) {
586
- const { scope: p, input: f } = r;
585
+ function Ke(r, i, s) {
586
+ const { scope: p, input: f } = i;
587
587
  return xt({
588
- document: i,
589
- action: r,
588
+ document: r,
589
+ action: i,
590
590
  skip: s
591
591
  }, (l) => {
592
592
  if (l.skip > 0)
@@ -602,7 +602,7 @@ function Ke(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
- (y) => y.scope === p
605
+ (w) => w.scope === p
606
606
  );
607
607
  if (a < 0)
608
608
  throw new Error(
@@ -616,192 +616,198 @@ function Ke(i, r, s) {
616
616
  });
617
617
  });
618
618
  }
619
- function Ze(i, r, s) {
620
- const { scope: p } = r, f = i.operations[p];
619
+ function Ze(r, i, s) {
620
+ const { scope: p } = i, f = r.operations[p];
621
621
  let {
622
622
  input: { start: u, end: l }
623
- } = r;
623
+ } = i;
624
624
  u = u || 0, l = l || f.length;
625
- const a = f.slice(u, l), h = f.slice(0, u), y = f.slice(l), w = Nt(
626
- i.initialState,
625
+ const a = f.slice(u, l), h = f.slice(0, u), w = f.slice(l), g = Nt(
626
+ r.initialState,
627
627
  {
628
- ...i.operations,
628
+ ...r.operations,
629
629
  [p]: h.concat(a)
630
630
  },
631
631
  s
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();
632
+ ), { name: A, state: _ } = g, F = h.length, U = h.length ? h[h.length - 1].timestamp : w.length ? w[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
633
633
  return Nt(
634
- i.initialState,
634
+ r.initialState,
635
635
  {
636
- ...i.operations,
636
+ ...r.operations,
637
637
  [p]: [
638
638
  ...h,
639
639
  {
640
640
  ...Kt(
641
- { name: _, state: v },
641
+ { name: A, state: _ },
642
642
  a.length
643
643
  ),
644
- timestamp: W,
645
- index: B,
646
- hash: Ht({ state: v }, "global")
644
+ timestamp: U,
645
+ index: F,
646
+ hash: Ht({ state: _ }, "global")
647
647
  },
648
- ...y.map((C, R) => ({
649
- ...C,
650
- index: B + R + 1
648
+ ...w.map((L, C) => ({
649
+ ...L,
650
+ index: F + C + 1
651
651
  }))
652
652
  ]
653
653
  },
654
654
  s
655
655
  );
656
656
  }
657
- function Ge(i, r) {
657
+ function Ge(r, i) {
658
658
  return {
659
- ...i,
660
- name: r.name,
661
- state: r.state ?? { global: {}, local: {} }
659
+ ...r,
660
+ name: i.name,
661
+ state: i.state ?? { global: {}, local: {} }
662
662
  };
663
663
  }
664
664
  const xe = "SET_NAME", gt = "UNDO", yt = "REDO", Ft = "PRUNE", de = "LOAD_STATE", Ye = "NOOP";
665
- function Xe(i, r) {
665
+ function Xe(r, i) {
666
666
  let s;
667
- return "index" in r ? s = { ...r } : s = i.operations[r.scope].slice(-1)[0], ((s == null ? void 0 : s.index) ?? -1) + 1;
667
+ return "index" in i ? s = { ...i } : s = r.operations[i.scope].slice(-1)[0], ((s == null ? void 0 : s.index) ?? -1) + 1;
668
668
  }
669
- function Qe(i, r) {
669
+ function Qe(r, i) {
670
670
  return {
671
- ...i,
671
+ ...r,
672
672
  revision: {
673
- ...i.revision,
674
- [r.scope]: Xe(i, r)
673
+ ...r.revision,
674
+ [i.scope]: Xe(r, i)
675
675
  },
676
676
  lastModified: (/* @__PURE__ */ new Date()).toISOString()
677
677
  };
678
678
  }
679
- function tr(i, r, s = 0) {
680
- if ([gt, yt, Ft].includes(r.type))
681
- return i;
682
- const { scope: p } = r, f = i.operations[p].slice(
679
+ function tr(r, i, s = 0) {
680
+ if ([gt, yt, Ft].includes(i.type))
681
+ return r;
682
+ const { scope: p } = i, f = r.operations[p].slice(
683
683
  0,
684
- i.revision[p]
684
+ r.revision[p]
685
685
  ), u = [...f].pop();
686
686
  let l = ((u == null ? void 0 : u.index) ?? -1) + 1;
687
- if ("index" in r) {
688
- if (r.index > l + s)
687
+ if ("index" in i) {
688
+ if (i.index > l + s)
689
689
  throw new Error(
690
- `Missing operations: expected ${l} with skip 0 or equivalent, got index ${r.index} with skip ${s}`
690
+ `Missing operations: expected ${l} with skip 0 or equivalent, got index ${i.index} with skip ${s}`
691
691
  );
692
- l = r.index;
692
+ l = i.index;
693
693
  }
694
694
  return f.push({
695
- ...r,
695
+ ...i,
696
696
  index: l,
697
697
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
698
698
  hash: "",
699
699
  scope: p,
700
- skip: s
700
+ skip: s,
701
+ error: void 0
701
702
  }), {
702
- ...i,
703
- operations: { ...i.operations, [p]: f }
703
+ ...r,
704
+ operations: { ...r.operations, [p]: f }
704
705
  };
705
706
  }
706
- function er(i, r, s = 0) {
707
- let p = tr(i, r, s);
708
- return p = Qe(p, r), p;
707
+ function er(r, i, s = 0) {
708
+ let p = tr(r, i, s);
709
+ return p = Qe(p, i), p;
709
710
  }
710
- function rr(i, r, s) {
711
- switch (pe().parse(r), r.type) {
711
+ function rr(r, i, s) {
712
+ switch (pe().parse(i), i.type) {
712
713
  case xe:
713
- return We(i, r.input);
714
+ return We(r, i.input);
714
715
  case Ft:
715
- return Ze(i, r, s);
716
+ return Ze(r, i, s);
716
717
  case de:
717
- return Ge(i, r.input.state);
718
+ return Ge(r, i.input.state);
718
719
  default:
719
- return i;
720
+ return r;
720
721
  }
721
722
  }
722
- function ir(i, r, s) {
723
- switch (r.type) {
723
+ function ir(r, i, s) {
724
+ switch (i.type) {
724
725
  case gt:
725
- return He(i, r, s);
726
+ return He(r, i, s);
726
727
  case yt:
727
- return Ke(i, r, s);
728
+ return Ke(r, i, s);
728
729
  default:
729
- return { document: i, action: r, skip: s };
730
+ return { document: r, action: i, skip: s };
730
731
  }
731
732
  }
732
- function ge(i, r, s, p, f = {}) {
733
+ function ge(r, i, s, p, f = {}) {
733
734
  const { skip: u, ignoreSkipOperations: l = !1, reuseHash: a = !1 } = f;
734
- let h = { ...r }, y = u || 0, w = i, _ = [...i.clipboard];
735
+ let h = { ...i }, w = u || 0, g = r, A = [...r.clipboard];
735
736
  if (Mr(h)) {
736
- const { document: v, skip: B } = Ve(w, h, y);
737
- y = B, w = v;
737
+ const { document: _, skip: F } = Ve(g, h, w);
738
+ w = F, g = _;
738
739
  }
739
740
  if (Xt(h)) {
740
741
  const {
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],
742
+ skip: _,
743
+ action: F,
744
+ document: U
745
+ } = ir(r, h, w);
746
+ h = F, w = _, g = U, A = [...g.clipboard];
747
+ }
748
+ if (Qt(h) && (g = rr(g, h, s)), w > 0 && !l) {
749
+ let _ = w;
750
+ "index" in h && (_ = qr(
751
+ g.operations[h.scope],
751
752
  h.index,
752
- y
753
- )), w = Nt(
754
- w.initialState,
755
- w.operations,
753
+ w
754
+ )), g = Nt(
755
+ g.initialState,
756
+ g.operations,
756
757
  s,
757
758
  void 0,
758
759
  void 0,
759
760
  void 0,
760
- { [h.scope]: v }
761
+ { [h.scope]: _ }
761
762
  // TODO reuse hash?
762
763
  );
763
764
  }
764
- return w = er(w, h, y), w = xt(w, (v) => {
765
- const B = s(
766
- v.state,
767
- h,
768
- p
769
- ), W = Xt(r) ? [..._] : [];
770
- if (B)
771
- return Ut({
772
- ...w,
773
- clipboard: [...W],
774
- state: B
775
- });
776
- v.clipboard = Ut([...W]);
777
- }), xt(w, (v) => {
765
+ return g = er(g, h, w), g = xt(g, (_) => {
766
+ try {
767
+ const F = s(
768
+ _.state,
769
+ h,
770
+ p
771
+ ), U = Xt(i) ? [...A] : [];
772
+ if (F)
773
+ return Ut({
774
+ ...g,
775
+ clipboard: [...U],
776
+ state: F
777
+ });
778
+ _.clipboard = Ut([...U]);
779
+ } catch (F) {
780
+ const U = g.operations[h.scope].length - 1;
781
+ _.operations[h.scope][U].error = F.message;
782
+ }
783
+ }), xt(g, (_) => {
778
784
  if ([gt, yt, Ft].includes(h.type))
779
- return v;
780
- const B = h.scope || "global", W = a && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : Ht(v, B);
781
- v.operations[B][v.operations[B].length - 1].hash = W, !Qt(h) && h.attachments && h.attachments.forEach((C) => {
782
- const { hash: R, ...g } = C;
783
- v.attachments[R] = {
784
- ...g
785
+ return _;
786
+ const F = h.scope || "global", U = a && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : Ht(_, F);
787
+ _.operations[F][_.operations[F].length - 1].hash = U, !Qt(h) && h.attachments && h.attachments.forEach((L) => {
788
+ const { hash: C, ...y } = L;
789
+ _.attachments[C] = {
790
+ ...y
785
791
  };
786
792
  });
787
793
  });
788
794
  }
789
795
  var Dt = { exports: {} };
790
- typeof Object.create == "function" ? Dt.exports = function(r, s) {
791
- s && (r.super_ = s, r.prototype = Object.create(s.prototype, {
796
+ typeof Object.create == "function" ? Dt.exports = function(i, s) {
797
+ s && (i.super_ = s, i.prototype = Object.create(s.prototype, {
792
798
  constructor: {
793
- value: r,
799
+ value: i,
794
800
  enumerable: !1,
795
801
  writable: !0,
796
802
  configurable: !0
797
803
  }
798
804
  }));
799
- } : Dt.exports = function(r, s) {
805
+ } : Dt.exports = function(i, s) {
800
806
  if (s) {
801
- r.super_ = s;
807
+ i.super_ = s;
802
808
  var p = function() {
803
809
  };
804
- p.prototype = s.prototype, r.prototype = new p(), r.prototype.constructor = r;
810
+ p.prototype = s.prototype, i.prototype = new p(), i.prototype.constructor = i;
805
811
  }
806
812
  };
807
813
  var ye = Dt.exports, Ct = { exports: {} }, we = {}, Bt = {};
@@ -813,69 +819,69 @@ for (var ut = 0, or = kt.length; ut < or; ++ut)
813
819
  nt[ut] = kt[ut], rt[kt.charCodeAt(ut)] = ut;
814
820
  rt[45] = 62;
815
821
  rt[95] = 63;
816
- function be(i) {
817
- var r = i.length;
818
- if (r % 4 > 0)
822
+ function be(r) {
823
+ var i = r.length;
824
+ if (i % 4 > 0)
819
825
  throw new Error("Invalid string. Length must be a multiple of 4");
820
- var s = i.indexOf("=");
821
- s === -1 && (s = r);
822
- var p = s === r ? 0 : 4 - s % 4;
826
+ var s = r.indexOf("=");
827
+ s === -1 && (s = i);
828
+ var p = s === i ? 0 : 4 - s % 4;
823
829
  return [s, p];
824
830
  }
825
- function ar(i) {
826
- var r = be(i), s = r[0], p = r[1];
831
+ function ar(r) {
832
+ var i = be(r), s = i[0], p = i[1];
827
833
  return (s + p) * 3 / 4 - p;
828
834
  }
829
- function sr(i, r, s) {
830
- return (r + s) * 3 / 4 - s;
835
+ function sr(r, i, s) {
836
+ return (i + s) * 3 / 4 - s;
831
837
  }
832
- function pr(i) {
833
- 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;
838
+ function pr(r) {
839
+ var i, s = be(r), p = s[0], f = s[1], u = new nr(sr(r, p, f)), l = 0, a = f > 0 ? p - 4 : p, h;
834
840
  for (h = 0; h < a; h += 4)
835
- 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;
836
- 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;
841
+ i = rt[r.charCodeAt(h)] << 18 | rt[r.charCodeAt(h + 1)] << 12 | rt[r.charCodeAt(h + 2)] << 6 | rt[r.charCodeAt(h + 3)], u[l++] = i >> 16 & 255, u[l++] = i >> 8 & 255, u[l++] = i & 255;
842
+ return f === 2 && (i = rt[r.charCodeAt(h)] << 2 | rt[r.charCodeAt(h + 1)] >> 4, u[l++] = i & 255), f === 1 && (i = rt[r.charCodeAt(h)] << 10 | rt[r.charCodeAt(h + 1)] << 4 | rt[r.charCodeAt(h + 2)] >> 2, u[l++] = i >> 8 & 255, u[l++] = i & 255), u;
837
843
  }
838
- function cr(i) {
839
- return nt[i >> 18 & 63] + nt[i >> 12 & 63] + nt[i >> 6 & 63] + nt[i & 63];
844
+ function cr(r) {
845
+ return nt[r >> 18 & 63] + nt[r >> 12 & 63] + nt[r >> 6 & 63] + nt[r & 63];
840
846
  }
841
- function lr(i, r, s) {
842
- for (var p, f = [], u = r; u < s; u += 3)
843
- p = (i[u] << 16 & 16711680) + (i[u + 1] << 8 & 65280) + (i[u + 2] & 255), f.push(cr(p));
847
+ function lr(r, i, s) {
848
+ for (var p, f = [], u = i; u < s; u += 3)
849
+ p = (r[u] << 16 & 16711680) + (r[u + 1] << 8 & 65280) + (r[u + 2] & 255), f.push(cr(p));
844
850
  return f.join("");
845
851
  }
846
- function ur(i) {
847
- for (var r, s = i.length, p = s % 3, f = [], u = 16383, l = 0, a = s - p; l < a; l += u)
848
- f.push(lr(i, l, l + u > a ? a : l + u));
849
- return p === 1 ? (r = i[s - 1], f.push(
850
- nt[r >> 2] + nt[r << 4 & 63] + "=="
851
- )) : p === 2 && (r = (i[s - 2] << 8) + i[s - 1], f.push(
852
- nt[r >> 10] + nt[r >> 4 & 63] + nt[r << 2 & 63] + "="
852
+ function ur(r) {
853
+ for (var i, s = r.length, p = s % 3, f = [], u = 16383, l = 0, a = s - p; l < a; l += u)
854
+ f.push(lr(r, l, l + u > a ? a : l + u));
855
+ return p === 1 ? (i = r[s - 1], f.push(
856
+ nt[i >> 2] + nt[i << 4 & 63] + "=="
857
+ )) : p === 2 && (i = (r[s - 2] << 8) + r[s - 1], f.push(
858
+ nt[i >> 10] + nt[i >> 4 & 63] + nt[i << 2 & 63] + "="
853
859
  )), f.join("");
854
860
  }
855
861
  var Jt = {};
856
862
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
857
- Jt.read = function(i, r, s, p, f) {
858
- 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 + _];
859
- for (_ += v, u = B & (1 << -w) - 1, B >>= -w, w += a; w > 0; u = u * 256 + i[r + _], _ += v, w -= 8)
863
+ Jt.read = function(r, i, s, p, f) {
864
+ var u, l, a = f * 8 - p - 1, h = (1 << a) - 1, w = h >> 1, g = -7, A = s ? f - 1 : 0, _ = s ? -1 : 1, F = r[i + A];
865
+ for (A += _, u = F & (1 << -g) - 1, F >>= -g, g += a; g > 0; u = u * 256 + r[i + A], A += _, g -= 8)
860
866
  ;
861
- for (l = u & (1 << -w) - 1, u >>= -w, w += p; w > 0; l = l * 256 + i[r + _], _ += v, w -= 8)
867
+ for (l = u & (1 << -g) - 1, u >>= -g, g += p; g > 0; l = l * 256 + r[i + A], A += _, g -= 8)
862
868
  ;
863
869
  if (u === 0)
864
- u = 1 - y;
870
+ u = 1 - w;
865
871
  else {
866
872
  if (u === h)
867
- return l ? NaN : (B ? -1 : 1) * (1 / 0);
868
- l = l + Math.pow(2, p), u = u - y;
873
+ return l ? NaN : (F ? -1 : 1) * (1 / 0);
874
+ l = l + Math.pow(2, p), u = u - w;
869
875
  }
870
- return (B ? -1 : 1) * l * Math.pow(2, u - p);
876
+ return (F ? -1 : 1) * l * Math.pow(2, u - p);
871
877
  };
872
- Jt.write = function(i, r, s, p, f, u) {
873
- 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;
874
- 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)
878
+ Jt.write = function(r, i, s, p, f, u) {
879
+ var l, a, h, w = u * 8 - f - 1, g = (1 << w) - 1, A = g >> 1, _ = f === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = p ? 0 : u - 1, U = p ? 1 : -1, L = i < 0 || i === 0 && 1 / i < 0 ? 1 : 0;
880
+ for (i = Math.abs(i), isNaN(i) || i === 1 / 0 ? (a = isNaN(i) ? 1 : 0, l = g) : (l = Math.floor(Math.log(i) / Math.LN2), i * (h = Math.pow(2, -l)) < 1 && (l--, h *= 2), l + A >= 1 ? i += _ / h : i += _ * Math.pow(2, 1 - A), i * h >= 2 && (l++, h /= 2), l + A >= g ? (a = 0, l = g) : l + A >= 1 ? (a = (i * h - 1) * Math.pow(2, f), l = l + A) : (a = i * Math.pow(2, A - 1) * Math.pow(2, f), l = 0)); f >= 8; r[s + F] = a & 255, F += U, a /= 256, f -= 8)
875
881
  ;
876
- for (l = l << f | a, y += f; y > 0; i[s + B] = l & 255, B += W, l /= 256, y -= 8)
882
+ for (l = l << f | a, w += f; w > 0; r[s + F] = l & 255, F += U, l /= 256, w -= 8)
877
883
  ;
878
- i[s + B - W] |= C * 128;
884
+ r[s + F - U] |= L * 128;
879
885
  };
880
886
  /*!
881
887
  * The buffer module from node.js, for the browser.
@@ -883,11 +889,11 @@ Jt.write = function(i, r, s, p, f, u) {
883
889
  * @author Feross Aboukhadijeh <https://feross.org>
884
890
  * @license MIT
885
891
  */
886
- (function(i) {
887
- var r = Bt, s = Jt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
888
- i.Buffer = a, i.SlowBuffer = b, i.INSPECT_MAX_BYTES = 50;
892
+ (function(r) {
893
+ var i = Bt, s = Jt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
894
+ r.Buffer = a, r.SlowBuffer = b, r.INSPECT_MAX_BYTES = 50;
889
895
  var f = 2147483647;
890
- i.kMaxLength = f, a.TYPED_ARRAY_SUPPORT = u(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
896
+ r.kMaxLength = f, a.TYPED_ARRAY_SUPPORT = u(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
891
897
  "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
892
898
  );
893
899
  function u() {
@@ -925,22 +931,22 @@ Jt.write = function(i, r, s, p, f, u) {
925
931
  throw new TypeError(
926
932
  'The "string" argument must be of type string. Received type number'
927
933
  );
928
- return _(n);
934
+ return A(n);
929
935
  }
930
936
  return h(n, t, e);
931
937
  }
932
938
  a.poolSize = 8192;
933
939
  function h(n, t, e) {
934
940
  if (typeof n == "string")
935
- return v(n, t);
941
+ return _(n, t);
936
942
  if (ArrayBuffer.isView(n))
937
- return W(n);
943
+ return U(n);
938
944
  if (n == null)
939
945
  throw new TypeError(
940
946
  "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
941
947
  );
942
948
  if (it(n, ArrayBuffer) || n && it(n.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (it(n, SharedArrayBuffer) || n && it(n.buffer, SharedArrayBuffer)))
943
- return C(n, t, e);
949
+ return L(n, t, e);
944
950
  if (typeof n == "number")
945
951
  throw new TypeError(
946
952
  'The "value" argument must not be of type number. Received type number'
@@ -948,7 +954,7 @@ Jt.write = function(i, r, s, p, f, u) {
948
954
  var o = n.valueOf && n.valueOf();
949
955
  if (o != null && o !== n)
950
956
  return a.from(o, t, e);
951
- var c = R(n);
957
+ var c = C(n);
952
958
  if (c)
953
959
  return c;
954
960
  if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof n[Symbol.toPrimitive] == "function")
@@ -964,45 +970,45 @@ Jt.write = function(i, r, s, p, f, u) {
964
970
  a.from = function(n, t, e) {
965
971
  return h(n, t, e);
966
972
  }, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
967
- function y(n) {
973
+ function w(n) {
968
974
  if (typeof n != "number")
969
975
  throw new TypeError('"size" argument must be of type number');
970
976
  if (n < 0)
971
977
  throw new RangeError('The value "' + n + '" is invalid for option "size"');
972
978
  }
973
- function w(n, t, e) {
974
- return y(n), n <= 0 ? l(n) : t !== void 0 ? typeof e == "string" ? l(n).fill(t, e) : l(n).fill(t) : l(n);
979
+ function g(n, t, e) {
980
+ return w(n), n <= 0 ? l(n) : t !== void 0 ? typeof e == "string" ? l(n).fill(t, e) : l(n).fill(t) : l(n);
975
981
  }
976
982
  a.alloc = function(n, t, e) {
977
- return w(n, t, e);
983
+ return g(n, t, e);
978
984
  };
979
- function _(n) {
980
- return y(n), l(n < 0 ? 0 : g(n) | 0);
985
+ function A(n) {
986
+ return w(n), l(n < 0 ? 0 : y(n) | 0);
981
987
  }
982
988
  a.allocUnsafe = function(n) {
983
- return _(n);
989
+ return A(n);
984
990
  }, a.allocUnsafeSlow = function(n) {
985
- return _(n);
991
+ return A(n);
986
992
  };
987
- function v(n, t) {
993
+ function _(n, t) {
988
994
  if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
989
995
  throw new TypeError("Unknown encoding: " + t);
990
- var e = O(n, t) | 0, o = l(e), c = o.write(n, t);
996
+ var e = I(n, t) | 0, o = l(e), c = o.write(n, t);
991
997
  return c !== e && (o = o.slice(0, c)), o;
992
998
  }
993
- function B(n) {
994
- for (var t = n.length < 0 ? 0 : g(n.length) | 0, e = l(t), o = 0; o < t; o += 1)
999
+ function F(n) {
1000
+ for (var t = n.length < 0 ? 0 : y(n.length) | 0, e = l(t), o = 0; o < t; o += 1)
995
1001
  e[o] = n[o] & 255;
996
1002
  return e;
997
1003
  }
998
- function W(n) {
1004
+ function U(n) {
999
1005
  if (it(n, Uint8Array)) {
1000
1006
  var t = new Uint8Array(n);
1001
- return C(t.buffer, t.byteOffset, t.byteLength);
1007
+ return L(t.buffer, t.byteOffset, t.byteLength);
1002
1008
  }
1003
- return B(n);
1009
+ return F(n);
1004
1010
  }
1005
- function C(n, t, e) {
1011
+ function L(n, t, e) {
1006
1012
  if (t < 0 || n.byteLength < t)
1007
1013
  throw new RangeError('"offset" is outside of buffer bounds');
1008
1014
  if (n.byteLength < t + (e || 0))
@@ -1010,17 +1016,17 @@ Jt.write = function(i, r, s, p, f, u) {
1010
1016
  var o;
1011
1017
  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;
1012
1018
  }
1013
- function R(n) {
1019
+ function C(n) {
1014
1020
  if (a.isBuffer(n)) {
1015
- var t = g(n.length) | 0, e = l(t);
1021
+ var t = y(n.length) | 0, e = l(t);
1016
1022
  return e.length === 0 || n.copy(e, 0, 0, t), e;
1017
1023
  }
1018
1024
  if (n.length !== void 0)
1019
- return typeof n.length != "number" || Tt(n.length) ? l(0) : B(n);
1025
+ return typeof n.length != "number" || Tt(n.length) ? l(0) : F(n);
1020
1026
  if (n.type === "Buffer" && Array.isArray(n.data))
1021
- return B(n.data);
1027
+ return F(n.data);
1022
1028
  }
1023
- function g(n) {
1029
+ function y(n) {
1024
1030
  if (n >= f)
1025
1031
  throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + f.toString(16) + " bytes");
1026
1032
  return n | 0;
@@ -1086,7 +1092,7 @@ Jt.write = function(i, r, s, p, f, u) {
1086
1092
  }
1087
1093
  return c;
1088
1094
  };
1089
- function O(n, t) {
1095
+ function I(n, t) {
1090
1096
  if (a.isBuffer(n))
1091
1097
  return n.length;
1092
1098
  if (ArrayBuffer.isView(n) || it(n, ArrayBuffer))
@@ -1122,8 +1128,8 @@ Jt.write = function(i, r, s, p, f, u) {
1122
1128
  t = ("" + t).toLowerCase(), c = !0;
1123
1129
  }
1124
1130
  }
1125
- a.byteLength = O;
1126
- function P(n, t, e) {
1131
+ a.byteLength = I;
1132
+ function W(n, t, e) {
1127
1133
  var o = !1;
1128
1134
  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))
1129
1135
  return "";
@@ -1138,7 +1144,7 @@ Jt.write = function(i, r, s, p, f, u) {
1138
1144
  return j(this, t, e);
1139
1145
  case "latin1":
1140
1146
  case "binary":
1141
- return $(this, t, e);
1147
+ return D(this, t, e);
1142
1148
  case "base64":
1143
1149
  return V(this, t, e);
1144
1150
  case "ucs2":
@@ -1153,7 +1159,7 @@ Jt.write = function(i, r, s, p, f, u) {
1153
1159
  }
1154
1160
  }
1155
1161
  a.prototype._isBuffer = !0;
1156
- function K(n, t, e) {
1162
+ function Y(n, t, e) {
1157
1163
  var o = n[t];
1158
1164
  n[t] = n[e], n[e] = o;
1159
1165
  }
@@ -1162,31 +1168,31 @@ Jt.write = function(i, r, s, p, f, u) {
1162
1168
  if (t % 2 !== 0)
1163
1169
  throw new RangeError("Buffer size must be a multiple of 16-bits");
1164
1170
  for (var e = 0; e < t; e += 2)
1165
- K(this, e, e + 1);
1171
+ Y(this, e, e + 1);
1166
1172
  return this;
1167
1173
  }, a.prototype.swap32 = function() {
1168
1174
  var t = this.length;
1169
1175
  if (t % 4 !== 0)
1170
1176
  throw new RangeError("Buffer size must be a multiple of 32-bits");
1171
1177
  for (var e = 0; e < t; e += 4)
1172
- K(this, e, e + 3), K(this, e + 1, e + 2);
1178
+ Y(this, e, e + 3), Y(this, e + 1, e + 2);
1173
1179
  return this;
1174
1180
  }, a.prototype.swap64 = function() {
1175
1181
  var t = this.length;
1176
1182
  if (t % 8 !== 0)
1177
1183
  throw new RangeError("Buffer size must be a multiple of 64-bits");
1178
1184
  for (var e = 0; e < t; e += 8)
1179
- K(this, e, e + 7), K(this, e + 1, e + 6), K(this, e + 2, e + 5), K(this, e + 3, e + 4);
1185
+ Y(this, e, e + 7), Y(this, e + 1, e + 6), Y(this, e + 2, e + 5), Y(this, e + 3, e + 4);
1180
1186
  return this;
1181
1187
  }, a.prototype.toString = function() {
1182
1188
  var t = this.length;
1183
- return t === 0 ? "" : arguments.length === 0 ? m(this, 0, t) : P.apply(this, arguments);
1189
+ return t === 0 ? "" : arguments.length === 0 ? m(this, 0, t) : W.apply(this, arguments);
1184
1190
  }, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
1185
1191
  if (!a.isBuffer(t))
1186
1192
  throw new TypeError("Argument must be a Buffer");
1187
1193
  return this === t ? !0 : a.compare(this, t) === 0;
1188
1194
  }, a.prototype.inspect = function() {
1189
- var t = "", e = i.INSPECT_MAX_BYTES;
1195
+ var t = "", e = r.INSPECT_MAX_BYTES;
1190
1196
  return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
1191
1197
  }, p && (a.prototype[p] = a.prototype.inspect), a.prototype.compare = function(t, e, o, c, x) {
1192
1198
  if (it(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
@@ -1203,14 +1209,14 @@ Jt.write = function(i, r, s, p, f, u) {
1203
1209
  return 1;
1204
1210
  if (e >>>= 0, o >>>= 0, c >>>= 0, x >>>= 0, this === t)
1205
1211
  return 0;
1206
- 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)
1207
- if (z[q] !== G[q]) {
1208
- d = z[q], U = G[q];
1212
+ for (var d = x - c, $ = o - e, M = Math.min(d, $), P = this.slice(c, x), Z = t.slice(e, o), q = 0; q < M; ++q)
1213
+ if (P[q] !== Z[q]) {
1214
+ d = P[q], $ = Z[q];
1209
1215
  break;
1210
1216
  }
1211
- return d < U ? -1 : U < d ? 1 : 0;
1217
+ return d < $ ? -1 : $ < d ? 1 : 0;
1212
1218
  };
1213
- function Y(n, t, e, o, c) {
1219
+ function G(n, t, e, o, c) {
1214
1220
  if (n.length === 0)
1215
1221
  return -1;
1216
1222
  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) {
@@ -1223,48 +1229,48 @@ Jt.write = function(i, r, s, p, f, u) {
1223
1229
  else
1224
1230
  return -1;
1225
1231
  if (typeof t == "string" && (t = a.from(t, o)), a.isBuffer(t))
1226
- return t.length === 0 ? -1 : M(n, t, e, o, c);
1232
+ return t.length === 0 ? -1 : R(n, t, e, o, c);
1227
1233
  if (typeof t == "number")
1228
- 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);
1234
+ return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? c ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : R(n, [t], e, o, c);
1229
1235
  throw new TypeError("val must be string, number or Buffer");
1230
1236
  }
1231
- function M(n, t, e, o, c) {
1232
- var x = 1, d = n.length, U = t.length;
1237
+ function R(n, t, e, o, c) {
1238
+ var x = 1, d = n.length, $ = t.length;
1233
1239
  if (o !== void 0 && (o = String(o).toLowerCase(), o === "ucs2" || o === "ucs-2" || o === "utf16le" || o === "utf-16le")) {
1234
1240
  if (n.length < 2 || t.length < 2)
1235
1241
  return -1;
1236
- x = 2, d /= 2, U /= 2, e /= 2;
1242
+ x = 2, d /= 2, $ /= 2, e /= 2;
1237
1243
  }
1238
- function N(Gt, Yt) {
1244
+ function M(Gt, Yt) {
1239
1245
  return x === 1 ? Gt[Yt] : Gt.readUInt16BE(Yt * x);
1240
1246
  }
1241
- var z;
1247
+ var P;
1242
1248
  if (c) {
1243
- var G = -1;
1244
- for (z = e; z < d; z++)
1245
- if (N(n, z) === N(t, G === -1 ? 0 : z - G)) {
1246
- if (G === -1 && (G = z), z - G + 1 === U)
1247
- return G * x;
1249
+ var Z = -1;
1250
+ for (P = e; P < d; P++)
1251
+ if (M(n, P) === M(t, Z === -1 ? 0 : P - Z)) {
1252
+ if (Z === -1 && (Z = P), P - Z + 1 === $)
1253
+ return Z * x;
1248
1254
  } else
1249
- G !== -1 && (z -= z - G), G = -1;
1255
+ Z !== -1 && (P -= P - Z), Z = -1;
1250
1256
  } else
1251
- for (e + U > d && (e = d - U), z = e; z >= 0; z--) {
1252
- for (var q = !0, vt = 0; vt < U; vt++)
1253
- if (N(n, z + vt) !== N(t, vt)) {
1257
+ for (e + $ > d && (e = d - $), P = e; P >= 0; P--) {
1258
+ for (var q = !0, vt = 0; vt < $; vt++)
1259
+ if (M(n, P + vt) !== M(t, vt)) {
1254
1260
  q = !1;
1255
1261
  break;
1256
1262
  }
1257
1263
  if (q)
1258
- return z;
1264
+ return P;
1259
1265
  }
1260
1266
  return -1;
1261
1267
  }
1262
1268
  a.prototype.includes = function(t, e, o) {
1263
1269
  return this.indexOf(t, e, o) !== -1;
1264
1270
  }, a.prototype.indexOf = function(t, e, o) {
1265
- return Y(this, t, e, o, !0);
1271
+ return G(this, t, e, o, !0);
1266
1272
  }, a.prototype.lastIndexOf = function(t, e, o) {
1267
- return Y(this, t, e, o, !1);
1273
+ return G(this, t, e, o, !1);
1268
1274
  };
1269
1275
  function ct(n, t, e, o) {
1270
1276
  e = Number(e) || 0;
@@ -1273,10 +1279,10 @@ Jt.write = function(i, r, s, p, f, u) {
1273
1279
  var x = t.length;
1274
1280
  o > x / 2 && (o = x / 2);
1275
1281
  for (var d = 0; d < o; ++d) {
1276
- var U = parseInt(t.substr(d * 2, 2), 16);
1277
- if (Tt(U))
1282
+ var $ = parseInt(t.substr(d * 2, 2), 16);
1283
+ if (Tt($))
1278
1284
  return d;
1279
- n[e + d] = U;
1285
+ n[e + d] = $;
1280
1286
  }
1281
1287
  return d;
1282
1288
  }
@@ -1337,29 +1343,29 @@ Jt.write = function(i, r, s, p, f, u) {
1337
1343
  };
1338
1344
  };
1339
1345
  function V(n, t, e) {
1340
- return t === 0 && e === n.length ? r.fromByteArray(n) : r.fromByteArray(n.slice(t, e));
1346
+ return t === 0 && e === n.length ? i.fromByteArray(n) : i.fromByteArray(n.slice(t, e));
1341
1347
  }
1342
1348
  function m(n, t, e) {
1343
1349
  e = Math.min(n.length, e);
1344
1350
  for (var o = [], c = t; c < e; ) {
1345
- var x = n[c], d = null, U = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
1346
- if (c + U <= e) {
1347
- var N, z, G, q;
1348
- switch (U) {
1351
+ var x = n[c], d = null, $ = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
1352
+ if (c + $ <= e) {
1353
+ var M, P, Z, q;
1354
+ switch ($) {
1349
1355
  case 1:
1350
1356
  x < 128 && (d = x);
1351
1357
  break;
1352
1358
  case 2:
1353
- N = n[c + 1], (N & 192) === 128 && (q = (x & 31) << 6 | N & 63, q > 127 && (d = q));
1359
+ M = n[c + 1], (M & 192) === 128 && (q = (x & 31) << 6 | M & 63, q > 127 && (d = q));
1354
1360
  break;
1355
1361
  case 3:
1356
- 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));
1362
+ M = n[c + 1], P = n[c + 2], (M & 192) === 128 && (P & 192) === 128 && (q = (x & 15) << 12 | (M & 63) << 6 | P & 63, q > 2047 && (q < 55296 || q > 57343) && (d = q));
1357
1363
  break;
1358
1364
  case 4:
1359
- 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));
1365
+ M = n[c + 1], P = n[c + 2], Z = n[c + 3], (M & 192) === 128 && (P & 192) === 128 && (Z & 192) === 128 && (q = (x & 15) << 18 | (M & 63) << 12 | (P & 63) << 6 | Z & 63, q > 65535 && q < 1114112 && (d = q));
1360
1366
  }
1361
1367
  }
1362
- 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;
1368
+ d === null ? (d = 65533, $ = 1) : d > 65535 && (d -= 65536, o.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), o.push(d), c += $;
1363
1369
  }
1364
1370
  return T(o);
1365
1371
  }
@@ -1382,7 +1388,7 @@ Jt.write = function(i, r, s, p, f, u) {
1382
1388
  o += String.fromCharCode(n[c] & 127);
1383
1389
  return o;
1384
1390
  }
1385
- function $(n, t, e) {
1391
+ function D(n, t, e) {
1386
1392
  var o = "";
1387
1393
  e = Math.min(n.length, e);
1388
1394
  for (var c = t; c < e; ++c)
@@ -1407,66 +1413,66 @@ Jt.write = function(i, r, s, p, f, u) {
1407
1413
  var c = this.subarray(t, e);
1408
1414
  return Object.setPrototypeOf(c, a.prototype), c;
1409
1415
  };
1410
- function F(n, t, e) {
1416
+ function B(n, t, e) {
1411
1417
  if (n % 1 !== 0 || n < 0)
1412
1418
  throw new RangeError("offset is not uint");
1413
1419
  if (n + t > e)
1414
1420
  throw new RangeError("Trying to access beyond buffer length");
1415
1421
  }
1416
1422
  a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, o) {
1417
- t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1423
+ t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1418
1424
  for (var c = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1419
1425
  c += this[t + d] * x;
1420
1426
  return c;
1421
1427
  }, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, o) {
1422
- t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1428
+ t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1423
1429
  for (var c = this[t + --e], x = 1; e > 0 && (x *= 256); )
1424
1430
  c += this[t + --e] * x;
1425
1431
  return c;
1426
1432
  }, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
1427
- return t = t >>> 0, e || F(t, 1, this.length), this[t];
1433
+ return t = t >>> 0, e || B(t, 1, this.length), this[t];
1428
1434
  }, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(t, e) {
1429
- return t = t >>> 0, e || F(t, 2, this.length), this[t] | this[t + 1] << 8;
1435
+ return t = t >>> 0, e || B(t, 2, this.length), this[t] | this[t + 1] << 8;
1430
1436
  }, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(t, e) {
1431
- return t = t >>> 0, e || F(t, 2, this.length), this[t] << 8 | this[t + 1];
1437
+ return t = t >>> 0, e || B(t, 2, this.length), this[t] << 8 | this[t + 1];
1432
1438
  }, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(t, e) {
1433
- return t = t >>> 0, e || F(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
1439
+ return t = t >>> 0, e || B(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
1434
1440
  }, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(t, e) {
1435
- return t = t >>> 0, e || F(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
1441
+ return t = t >>> 0, e || B(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
1436
1442
  }, a.prototype.readIntLE = function(t, e, o) {
1437
- t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1443
+ t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1438
1444
  for (var c = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
1439
1445
  c += this[t + d] * x;
1440
1446
  return x *= 128, c >= x && (c -= Math.pow(2, 8 * e)), c;
1441
1447
  }, a.prototype.readIntBE = function(t, e, o) {
1442
- t = t >>> 0, e = e >>> 0, o || F(t, e, this.length);
1448
+ t = t >>> 0, e = e >>> 0, o || B(t, e, this.length);
1443
1449
  for (var c = e, x = 1, d = this[t + --c]; c > 0 && (x *= 256); )
1444
1450
  d += this[t + --c] * x;
1445
1451
  return x *= 128, d >= x && (d -= Math.pow(2, 8 * e)), d;
1446
1452
  }, a.prototype.readInt8 = function(t, e) {
1447
- return t = t >>> 0, e || F(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
1453
+ return t = t >>> 0, e || B(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
1448
1454
  }, a.prototype.readInt16LE = function(t, e) {
1449
- t = t >>> 0, e || F(t, 2, this.length);
1455
+ t = t >>> 0, e || B(t, 2, this.length);
1450
1456
  var o = this[t] | this[t + 1] << 8;
1451
1457
  return o & 32768 ? o | 4294901760 : o;
1452
1458
  }, a.prototype.readInt16BE = function(t, e) {
1453
- t = t >>> 0, e || F(t, 2, this.length);
1459
+ t = t >>> 0, e || B(t, 2, this.length);
1454
1460
  var o = this[t + 1] | this[t] << 8;
1455
1461
  return o & 32768 ? o | 4294901760 : o;
1456
1462
  }, a.prototype.readInt32LE = function(t, e) {
1457
- return t = t >>> 0, e || F(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
1463
+ return t = t >>> 0, e || B(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
1458
1464
  }, a.prototype.readInt32BE = function(t, e) {
1459
- return t = t >>> 0, e || F(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
1465
+ return t = t >>> 0, e || B(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
1460
1466
  }, a.prototype.readFloatLE = function(t, e) {
1461
- return t = t >>> 0, e || F(t, 4, this.length), s.read(this, t, !0, 23, 4);
1467
+ return t = t >>> 0, e || B(t, 4, this.length), s.read(this, t, !0, 23, 4);
1462
1468
  }, a.prototype.readFloatBE = function(t, e) {
1463
- return t = t >>> 0, e || F(t, 4, this.length), s.read(this, t, !1, 23, 4);
1469
+ return t = t >>> 0, e || B(t, 4, this.length), s.read(this, t, !1, 23, 4);
1464
1470
  }, a.prototype.readDoubleLE = function(t, e) {
1465
- return t = t >>> 0, e || F(t, 8, this.length), s.read(this, t, !0, 52, 8);
1471
+ return t = t >>> 0, e || B(t, 8, this.length), s.read(this, t, !0, 52, 8);
1466
1472
  }, a.prototype.readDoubleBE = function(t, e) {
1467
- return t = t >>> 0, e || F(t, 8, this.length), s.read(this, t, !1, 52, 8);
1473
+ return t = t >>> 0, e || B(t, 8, this.length), s.read(this, t, !1, 52, 8);
1468
1474
  };
1469
- function I(n, t, e, o, c, x) {
1475
+ function O(n, t, e, o, c, x) {
1470
1476
  if (!a.isBuffer(n))
1471
1477
  throw new TypeError('"buffer" argument must be a Buffer instance');
1472
1478
  if (t > c || t < x)
@@ -1477,81 +1483,81 @@ Jt.write = function(i, r, s, p, f, u) {
1477
1483
  a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, o, c) {
1478
1484
  if (t = +t, e = e >>> 0, o = o >>> 0, !c) {
1479
1485
  var x = Math.pow(2, 8 * o) - 1;
1480
- I(this, t, e, o, x, 0);
1486
+ O(this, t, e, o, x, 0);
1481
1487
  }
1482
- var d = 1, U = 0;
1483
- for (this[e] = t & 255; ++U < o && (d *= 256); )
1484
- this[e + U] = t / d & 255;
1488
+ var d = 1, $ = 0;
1489
+ for (this[e] = t & 255; ++$ < o && (d *= 256); )
1490
+ this[e + $] = t / d & 255;
1485
1491
  return e + o;
1486
1492
  }, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, o, c) {
1487
1493
  if (t = +t, e = e >>> 0, o = o >>> 0, !c) {
1488
1494
  var x = Math.pow(2, 8 * o) - 1;
1489
- I(this, t, e, o, x, 0);
1495
+ O(this, t, e, o, x, 0);
1490
1496
  }
1491
- var d = o - 1, U = 1;
1492
- for (this[e + d] = t & 255; --d >= 0 && (U *= 256); )
1493
- this[e + d] = t / U & 255;
1497
+ var d = o - 1, $ = 1;
1498
+ for (this[e + d] = t & 255; --d >= 0 && ($ *= 256); )
1499
+ this[e + d] = t / $ & 255;
1494
1500
  return e + o;
1495
1501
  }, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, o) {
1496
- return t = +t, e = e >>> 0, o || I(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1502
+ return t = +t, e = e >>> 0, o || O(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
1497
1503
  }, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(t, e, o) {
1498
- 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;
1504
+ 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;
1499
1505
  }, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(t, e, o) {
1500
- 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;
1506
+ 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;
1501
1507
  }, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(t, e, o) {
1502
- 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;
1508
+ 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;
1503
1509
  }, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(t, e, o) {
1504
- 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;
1510
+ 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;
1505
1511
  }, a.prototype.writeIntLE = function(t, e, o, c) {
1506
1512
  if (t = +t, e = e >>> 0, !c) {
1507
1513
  var x = Math.pow(2, 8 * o - 1);
1508
- I(this, t, e, o, x - 1, -x);
1514
+ O(this, t, e, o, x - 1, -x);
1509
1515
  }
1510
- var d = 0, U = 1, N = 0;
1511
- for (this[e] = t & 255; ++d < o && (U *= 256); )
1512
- t < 0 && N === 0 && this[e + d - 1] !== 0 && (N = 1), this[e + d] = (t / U >> 0) - N & 255;
1516
+ var d = 0, $ = 1, M = 0;
1517
+ for (this[e] = t & 255; ++d < o && ($ *= 256); )
1518
+ t < 0 && M === 0 && this[e + d - 1] !== 0 && (M = 1), this[e + d] = (t / $ >> 0) - M & 255;
1513
1519
  return e + o;
1514
1520
  }, a.prototype.writeIntBE = function(t, e, o, c) {
1515
1521
  if (t = +t, e = e >>> 0, !c) {
1516
1522
  var x = Math.pow(2, 8 * o - 1);
1517
- I(this, t, e, o, x - 1, -x);
1523
+ O(this, t, e, o, x - 1, -x);
1518
1524
  }
1519
- var d = o - 1, U = 1, N = 0;
1520
- for (this[e + d] = t & 255; --d >= 0 && (U *= 256); )
1521
- t < 0 && N === 0 && this[e + d + 1] !== 0 && (N = 1), this[e + d] = (t / U >> 0) - N & 255;
1525
+ var d = o - 1, $ = 1, M = 0;
1526
+ for (this[e + d] = t & 255; --d >= 0 && ($ *= 256); )
1527
+ t < 0 && M === 0 && this[e + d + 1] !== 0 && (M = 1), this[e + d] = (t / $ >> 0) - M & 255;
1522
1528
  return e + o;
1523
1529
  }, a.prototype.writeInt8 = function(t, e, o) {
1524
- 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;
1530
+ 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;
1525
1531
  }, a.prototype.writeInt16LE = function(t, e, o) {
1526
- 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;
1532
+ 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;
1527
1533
  }, a.prototype.writeInt16BE = function(t, e, o) {
1528
- 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;
1534
+ 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;
1529
1535
  }, a.prototype.writeInt32LE = function(t, e, o) {
1530
- 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;
1536
+ 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;
1531
1537
  }, a.prototype.writeInt32BE = function(t, e, o) {
1532
- 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;
1538
+ 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;
1533
1539
  };
1534
- function L(n, t, e, o, c, x) {
1540
+ function z(n, t, e, o, c, x) {
1535
1541
  if (e + o > n.length)
1536
1542
  throw new RangeError("Index out of range");
1537
1543
  if (e < 0)
1538
1544
  throw new RangeError("Index out of range");
1539
1545
  }
1540
1546
  function J(n, t, e, o, c) {
1541
- return t = +t, e = e >>> 0, c || L(n, t, e, 4), s.write(n, t, e, o, 23, 4), e + 4;
1547
+ return t = +t, e = e >>> 0, c || z(n, t, e, 4), s.write(n, t, e, o, 23, 4), e + 4;
1542
1548
  }
1543
1549
  a.prototype.writeFloatLE = function(t, e, o) {
1544
1550
  return J(this, t, e, !0, o);
1545
1551
  }, a.prototype.writeFloatBE = function(t, e, o) {
1546
1552
  return J(this, t, e, !1, o);
1547
1553
  };
1548
- function D(n, t, e, o, c) {
1549
- return t = +t, e = e >>> 0, c || L(n, t, e, 8), s.write(n, t, e, o, 52, 8), e + 8;
1554
+ function N(n, t, e, o, c) {
1555
+ return t = +t, e = e >>> 0, c || z(n, t, e, 8), s.write(n, t, e, o, 52, 8), e + 8;
1550
1556
  }
1551
1557
  a.prototype.writeDoubleLE = function(t, e, o) {
1552
- return D(this, t, e, !0, o);
1558
+ return N(this, t, e, !0, o);
1553
1559
  }, a.prototype.writeDoubleBE = function(t, e, o) {
1554
- return D(this, t, e, !1, o);
1560
+ return N(this, t, e, !1, o);
1555
1561
  }, a.prototype.copy = function(t, e, o, c) {
1556
1562
  if (!a.isBuffer(t))
1557
1563
  throw new TypeError("argument should be a Buffer");
@@ -1592,17 +1598,17 @@ Jt.write = function(i, r, s, p, f, u) {
1592
1598
  for (d = e; d < o; ++d)
1593
1599
  this[d] = t;
1594
1600
  else {
1595
- var U = a.isBuffer(t) ? t : a.from(t, c), N = U.length;
1596
- if (N === 0)
1601
+ var $ = a.isBuffer(t) ? t : a.from(t, c), M = $.length;
1602
+ if (M === 0)
1597
1603
  throw new TypeError('The value "' + t + '" is invalid for argument "value"');
1598
1604
  for (d = 0; d < o - e; ++d)
1599
- this[d + e] = U[d % N];
1605
+ this[d + e] = $[d % M];
1600
1606
  }
1601
1607
  return this;
1602
1608
  };
1603
- var Z = /[^+/0-9A-Za-z-_]/g;
1609
+ var K = /[^+/0-9A-Za-z-_]/g;
1604
1610
  function X(n) {
1605
- if (n = n.split("=")[0], n = n.trim().replace(Z, ""), n.length < 2)
1611
+ if (n = n.split("=")[0], n = n.trim().replace(K, ""), n.length < 2)
1606
1612
  return "";
1607
1613
  for (; n.length % 4 !== 0; )
1608
1614
  n = n + "=";
@@ -1674,7 +1680,7 @@ Jt.write = function(i, r, s, p, f, u) {
1674
1680
  return x;
1675
1681
  }
1676
1682
  function st(n) {
1677
- return r.toByteArray(X(n));
1683
+ return i.toByteArray(X(n));
1678
1684
  }
1679
1685
  function Et(n, t, e, o) {
1680
1686
  for (var c = 0; c < o && !(c + e >= t.length || c >= n.length); ++c)
@@ -1695,13 +1701,13 @@ Jt.write = function(i, r, s, p, f, u) {
1695
1701
  }();
1696
1702
  })(we);
1697
1703
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1698
- (function(i, r) {
1704
+ (function(r, i) {
1699
1705
  var s = we, p = s.Buffer;
1700
1706
  function f(l, a) {
1701
1707
  for (var h in l)
1702
1708
  a[h] = l[h];
1703
1709
  }
1704
- p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? i.exports = s : (f(s, r), r.Buffer = u);
1710
+ p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? r.exports = s : (f(s, i), i.Buffer = u);
1705
1711
  function u(l, a, h) {
1706
1712
  return p(l, a, h);
1707
1713
  }
@@ -1712,8 +1718,8 @@ Jt.write = function(i, r, s, p, f, u) {
1712
1718
  }, u.alloc = function(l, a, h) {
1713
1719
  if (typeof l != "number")
1714
1720
  throw new TypeError("Argument must be a number");
1715
- var y = p(l);
1716
- return a !== void 0 ? typeof h == "string" ? y.fill(a, h) : y.fill(a) : y.fill(0), y;
1721
+ var w = p(l);
1722
+ return a !== void 0 ? typeof h == "string" ? w.fill(a, h) : w.fill(a) : w.fill(0), w;
1717
1723
  }, u.allocUnsafe = function(l) {
1718
1724
  if (typeof l != "number")
1719
1725
  throw new TypeError("Argument must be a number");
@@ -1725,21 +1731,21 @@ Jt.write = function(i, r, s, p, f, u) {
1725
1731
  };
1726
1732
  })(Ct, Ct.exports);
1727
1733
  var Wt = Ct.exports, Ee = Wt.Buffer;
1728
- function jt(i, r) {
1729
- this._block = Ee.alloc(i), this._finalSize = r, this._blockSize = i, this._len = 0;
1730
- }
1731
- jt.prototype.update = function(i, r) {
1732
- typeof i == "string" && (r = r || "utf8", i = Ee.from(i, r));
1733
- for (var s = this._block, p = this._blockSize, f = i.length, u = this._len, l = 0; l < f; ) {
1734
- for (var a = u % p, h = Math.min(f - l, p - a), y = 0; y < h; y++)
1735
- s[a + y] = i[l + y];
1734
+ function jt(r, i) {
1735
+ this._block = Ee.alloc(r), this._finalSize = i, this._blockSize = r, this._len = 0;
1736
+ }
1737
+ jt.prototype.update = function(r, i) {
1738
+ typeof r == "string" && (i = i || "utf8", r = Ee.from(r, i));
1739
+ for (var s = this._block, p = this._blockSize, f = r.length, u = this._len, l = 0; l < f; ) {
1740
+ for (var a = u % p, h = Math.min(f - l, p - a), w = 0; w < h; w++)
1741
+ s[a + w] = r[l + w];
1736
1742
  u += h, l += h, u % p === 0 && this._update(s);
1737
1743
  }
1738
1744
  return this._len += f, this;
1739
1745
  };
1740
- jt.prototype.digest = function(i) {
1741
- var r = this._len % this._blockSize;
1742
- this._block[r] = 128, this._block.fill(0, r + 1), r >= this._finalSize && (this._update(this._block), this._block.fill(0));
1746
+ jt.prototype.digest = function(r) {
1747
+ var i = this._len % this._blockSize;
1748
+ this._block[i] = 128, this._block.fill(0, i + 1), i >= this._finalSize && (this._update(this._block), this._block.fill(0));
1743
1749
  var s = this._len * 8;
1744
1750
  if (s <= 4294967295)
1745
1751
  this._block.writeUInt32BE(s, this._blockSize - 4);
@@ -1749,7 +1755,7 @@ jt.prototype.digest = function(i) {
1749
1755
  }
1750
1756
  this._update(this._block);
1751
1757
  var u = this._hash();
1752
- return i ? u.toString(i) : u;
1758
+ return r ? u.toString(r) : u;
1753
1759
  };
1754
1760
  jt.prototype._update = function() {
1755
1761
  throw new Error("_update must be implemented by subclass");
@@ -1767,32 +1773,32 @@ fr(wt, Ae);
1767
1773
  wt.prototype.init = function() {
1768
1774
  return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
1769
1775
  };
1770
- function dr(i) {
1771
- return i << 1 | i >>> 31;
1776
+ function dr(r) {
1777
+ return r << 1 | r >>> 31;
1772
1778
  }
1773
- function gr(i) {
1774
- return i << 5 | i >>> 27;
1779
+ function gr(r) {
1780
+ return r << 5 | r >>> 27;
1775
1781
  }
1776
- function yr(i) {
1777
- return i << 30 | i >>> 2;
1782
+ function yr(r) {
1783
+ return r << 30 | r >>> 2;
1778
1784
  }
1779
- function wr(i, r, s, p) {
1780
- return i === 0 ? r & s | ~r & p : i === 2 ? r & s | r & p | s & p : r ^ s ^ p;
1785
+ function wr(r, i, s, p) {
1786
+ return r === 0 ? i & s | ~i & p : r === 2 ? i & s | i & p | s & p : i ^ s ^ p;
1781
1787
  }
1782
- wt.prototype._update = function(i) {
1783
- 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 = 0; a < 16; ++a)
1784
- r[a] = i.readInt32BE(a * 4);
1788
+ wt.prototype._update = function(r) {
1789
+ for (var i = this._w, s = this._a | 0, p = this._b | 0, f = this._c | 0, u = this._d | 0, l = this._e | 0, a = 0; a < 16; ++a)
1790
+ i[a] = r.readInt32BE(a * 4);
1785
1791
  for (; a < 80; ++a)
1786
- r[a] = dr(r[a - 3] ^ r[a - 8] ^ r[a - 14] ^ r[a - 16]);
1792
+ i[a] = dr(i[a - 3] ^ i[a - 8] ^ i[a - 14] ^ i[a - 16]);
1787
1793
  for (var h = 0; h < 80; ++h) {
1788
- var y = ~~(h / 20), w = gr(s) + wr(y, p, f, u) + l + r[h] + mr[y] | 0;
1789
- l = u, u = f, f = yr(p), p = s, s = w;
1794
+ var w = ~~(h / 20), g = gr(s) + wr(w, p, f, u) + l + i[h] + mr[w] | 0;
1795
+ l = u, u = f, f = yr(p), p = s, s = g;
1790
1796
  }
1791
1797
  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;
1792
1798
  };
1793
1799
  wt.prototype._hash = function() {
1794
- var i = hr.allocUnsafe(20);
1795
- return i.writeInt32BE(this._a | 0, 0), i.writeInt32BE(this._b | 0, 4), i.writeInt32BE(this._c | 0, 8), i.writeInt32BE(this._d | 0, 12), i.writeInt32BE(this._e | 0, 16), i;
1800
+ var r = hr.allocUnsafe(20);
1801
+ return r.writeInt32BE(this._a | 0, 0), r.writeInt32BE(this._b | 0, 4), r.writeInt32BE(this._c | 0, 8), r.writeInt32BE(this._d | 0, 12), r.writeInt32BE(this._e | 0, 16), r;
1796
1802
  };
1797
1803
  var br = wt;
1798
1804
  const Er = /* @__PURE__ */ qt(br);
@@ -1869,74 +1875,74 @@ vr(bt, _e);
1869
1875
  bt.prototype.init = function() {
1870
1876
  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;
1871
1877
  };
1872
- function Fr(i, r, s) {
1873
- return s ^ i & (r ^ s);
1878
+ function Fr(r, i, s) {
1879
+ return s ^ r & (i ^ s);
1874
1880
  }
1875
- function Br(i, r, s) {
1876
- return i & r | s & (i | r);
1881
+ function Br(r, i, s) {
1882
+ return r & i | s & (r | i);
1877
1883
  }
1878
- function jr(i) {
1879
- return (i >>> 2 | i << 30) ^ (i >>> 13 | i << 19) ^ (i >>> 22 | i << 10);
1884
+ function jr(r) {
1885
+ return (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10);
1880
1886
  }
1881
- function Or(i) {
1882
- return (i >>> 6 | i << 26) ^ (i >>> 11 | i << 21) ^ (i >>> 25 | i << 7);
1887
+ function Or(r) {
1888
+ return (r >>> 6 | r << 26) ^ (r >>> 11 | r << 21) ^ (r >>> 25 | r << 7);
1883
1889
  }
1884
- function Ir(i) {
1885
- return (i >>> 7 | i << 25) ^ (i >>> 18 | i << 14) ^ i >>> 3;
1890
+ function Ir(r) {
1891
+ return (r >>> 7 | r << 25) ^ (r >>> 18 | r << 14) ^ r >>> 3;
1886
1892
  }
1887
- function Tr(i) {
1888
- return (i >>> 17 | i << 15) ^ (i >>> 19 | i << 13) ^ i >>> 10;
1893
+ function Tr(r) {
1894
+ return (r >>> 17 | r << 15) ^ (r >>> 19 | r << 13) ^ r >>> 10;
1889
1895
  }
1890
- bt.prototype._update = function(i) {
1891
- 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)
1892
- r[w] = i.readInt32BE(w * 4);
1893
- for (; w < 64; ++w)
1894
- r[w] = Tr(r[w - 2]) + r[w - 7] + Ir(r[w - 15]) + r[w - 16] | 0;
1895
- for (var _ = 0; _ < 64; ++_) {
1896
- var v = y + Or(l) + Fr(l, a, h) + _r[_] + r[_] | 0, B = jr(s) + Br(s, p, f) | 0;
1897
- y = h, h = a, a = l, l = u + v | 0, u = f, f = p, p = s, s = v + B | 0;
1896
+ bt.prototype._update = function(r) {
1897
+ for (var i = 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, w = this._h | 0, g = 0; g < 16; ++g)
1898
+ i[g] = r.readInt32BE(g * 4);
1899
+ for (; g < 64; ++g)
1900
+ i[g] = Tr(i[g - 2]) + i[g - 7] + Ir(i[g - 15]) + i[g - 16] | 0;
1901
+ for (var A = 0; A < 64; ++A) {
1902
+ var _ = w + Or(l) + Fr(l, a, h) + _r[A] + i[A] | 0, F = jr(s) + Br(s, p, f) | 0;
1903
+ w = h, h = a, a = l, l = u + _ | 0, u = f, f = p, p = s, s = _ + F | 0;
1898
1904
  }
1899
- 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;
1905
+ 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 = w + this._h | 0;
1900
1906
  };
1901
1907
  bt.prototype._hash = function() {
1902
- var i = Ar.allocUnsafe(32);
1903
- return i.writeInt32BE(this._a, 0), i.writeInt32BE(this._b, 4), i.writeInt32BE(this._c, 8), i.writeInt32BE(this._d, 12), i.writeInt32BE(this._e, 16), i.writeInt32BE(this._f, 20), i.writeInt32BE(this._g, 24), i.writeInt32BE(this._h, 28), i;
1908
+ var r = Ar.allocUnsafe(32);
1909
+ return r.writeInt32BE(this._a, 0), r.writeInt32BE(this._b, 4), r.writeInt32BE(this._c, 8), r.writeInt32BE(this._d, 12), r.writeInt32BE(this._e, 16), r.writeInt32BE(this._f, 20), r.writeInt32BE(this._g, 24), r.writeInt32BE(this._h, 28), r;
1904
1910
  };
1905
1911
  var kr = bt;
1906
1912
  const Ur = /* @__PURE__ */ qt(kr), Vt = new Error("File system not available.");
1907
- function $r(i, r, s) {
1913
+ function $r(r, i, s) {
1908
1914
  throw Vt;
1909
1915
  }
1910
- function Se(i) {
1916
+ function Se(r) {
1911
1917
  throw Vt;
1912
1918
  }
1913
- function Dr(i) {
1919
+ function Dr(r) {
1914
1920
  throw Vt;
1915
1921
  }
1916
- const Cr = async (i) => Se(), Nr = {
1922
+ const Cr = async (r) => Se(), Nr = {
1917
1923
  sha1: Er,
1918
1924
  sha256: Ur
1919
- }, Ot = (i, r = "sha1") => {
1920
- if (!["sha1", "sha256"].includes(r))
1925
+ }, Ot = (r, i = "sha1") => {
1926
+ if (!["sha1", "sha256"].includes(i))
1921
1927
  throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
1922
- const s = Nr[r];
1923
- return new s().update(i).digest("base64");
1928
+ const s = Nr[i];
1929
+ return new s().update(r).digest("base64");
1924
1930
  };
1925
- function Mr(i) {
1926
- return i.type === Ye && i.skip !== void 0 && i.skip > 0 && i.hash !== void 0;
1931
+ function Mr(r) {
1932
+ return r.type === Ye && r.skip !== void 0 && r.skip > 0 && r.hash !== void 0;
1927
1933
  }
1928
- function Xt(i) {
1929
- return [gt, yt].includes(i.type);
1934
+ function Xt(r) {
1935
+ return [gt, yt].includes(r.type);
1930
1936
  }
1931
- function Qt(i) {
1932
- return [xe, gt, yt, Ft, de].includes(i.type);
1937
+ function Qt(r) {
1938
+ return [xe, gt, yt, Ft, de].includes(r.type);
1933
1939
  }
1934
- function ht(i, r, s, p, f = "global") {
1935
- if (!i)
1940
+ function ht(r, i, s, p, f = "global") {
1941
+ if (!r)
1936
1942
  throw new Error("Empty action type");
1937
- if (typeof i != "string")
1938
- throw new Error(`Invalid action type: ${JSON.stringify(i)}`);
1939
- const u = { type: i, input: r, scope: f };
1943
+ if (typeof r != "string")
1944
+ throw new Error(`Invalid action type: ${JSON.stringify(r)}`);
1945
+ const u = { type: r, input: i, scope: f };
1940
1946
  s && (u.attachments = s);
1941
1947
  try {
1942
1948
  p == null || p().parse(u.input);
@@ -1945,10 +1951,10 @@ function ht(i, r, s, p, f = "global") {
1945
1951
  }
1946
1952
  return u;
1947
1953
  }
1948
- function Rr(i, r = ge) {
1949
- return (s, p, f, u) => r(s, p, i, f, u);
1954
+ function Rr(r, i = ge) {
1955
+ return (s, p, f, u) => i(s, p, r, f, u);
1950
1956
  }
1951
- const Lr = (i, r) => ({
1957
+ const Lr = (r, i) => ({
1952
1958
  name: "",
1953
1959
  documentType: "",
1954
1960
  revision: {
@@ -1958,12 +1964,12 @@ const Lr = (i, r) => ({
1958
1964
  created: (/* @__PURE__ */ new Date()).toISOString(),
1959
1965
  lastModified: (/* @__PURE__ */ new Date()).toISOString(),
1960
1966
  attachments: {},
1961
- ...i,
1962
- state: (r == null ? void 0 : r(i == null ? void 0 : i.state)) ?? (i == null ? void 0 : i.state) ?? { global: {}, local: {} }
1963
- }), zr = (i, r) => {
1967
+ ...r,
1968
+ state: (i == null ? void 0 : i(r == null ? void 0 : r.state)) ?? (r == null ? void 0 : r.state) ?? { global: {}, local: {} }
1969
+ }), zr = (r, i) => {
1964
1970
  const s = Lr(
1965
- i,
1966
- r
1971
+ r,
1972
+ i
1967
1973
  );
1968
1974
  return {
1969
1975
  ...s,
@@ -1971,21 +1977,21 @@ const Lr = (i, r) => ({
1971
1977
  operations: { global: [], local: [] },
1972
1978
  clipboard: []
1973
1979
  };
1974
- }, Ht = (i, r = "global") => Ot(St(i.state[r] || "")), ri = (i, r = 1e3) => {
1975
- const s = Math.random() * r;
1976
- return Ot(`${(i ?? /* @__PURE__ */ new Date()).toISOString()}${s}`);
1980
+ }, Ht = (r, i = "global") => Ot(St(r.state[i] || "")), ri = (r, i = 1e3) => {
1981
+ const s = Math.random() * i;
1982
+ return Ot(`${(r ?? /* @__PURE__ */ new Date()).toISOString()}${s}`);
1977
1983
  };
1978
- function _t(i) {
1979
- return Ne(Me(i, !0));
1984
+ function _t(r) {
1985
+ return Ne(Me(r, !0));
1980
1986
  }
1981
- function Pr(i, r) {
1982
- const s = [...i];
1983
- let p = r || 0, f = s.length > 0 ? s[s.length - 1].index : 0;
1987
+ function Pr(r, i) {
1988
+ const s = [...r];
1989
+ let p = i || 0, f = s.length > 0 ? s[s.length - 1].index : 0;
1984
1990
  const u = [];
1985
1991
  for (const l of s.reverse()) {
1986
1992
  if (p > 0) {
1987
- const y = f - l.index;
1988
- p -= y;
1993
+ const w = f - l.index;
1994
+ p -= w;
1989
1995
  }
1990
1996
  if (p < 0)
1991
1997
  throw new Error("Invalid operation index, missing operations");
@@ -1994,16 +2000,16 @@ function Pr(i, r) {
1994
2000
  operation: l
1995
2001
  }, h = l.skip > 0 ? l.skip + 1 : 0;
1996
2002
  if (h > 0 && h > p) {
1997
- const y = h - p;
1998
- p = p + y;
2003
+ const w = h - p;
2004
+ p = p + w;
1999
2005
  }
2000
2006
  f = l.index, u.push(a);
2001
2007
  }
2002
2008
  return u.reverse();
2003
2009
  }
2004
- function qr(i, r, s) {
2005
- const p = i.slice().sort((a, h) => a.skip - h.skip).sort((a, h) => a.index - h.index);
2006
- let f = s, u = 0, l = r;
2010
+ function qr(r, i, s) {
2011
+ const p = r.slice().sort((a, h) => a.skip - h.skip).sort((a, h) => a.index - h.index);
2012
+ let f = s, u = 0, l = i;
2007
2013
  for (const a of p.reverse()) {
2008
2014
  const h = l - a.index;
2009
2015
  if (f = f - h, f > -1)
@@ -2013,21 +2019,21 @@ function qr(i, r, s) {
2013
2019
  }
2014
2020
  return u;
2015
2021
  }
2016
- function ii(i) {
2017
- return Object.values(i).flatMap((r) => r).sort(
2018
- (r, s) => new Date(r.timestamp).getTime() - new Date(s.timestamp).getTime()
2022
+ function ii(r) {
2023
+ return Object.values(r).flatMap((i) => i).sort(
2024
+ (i, s) => new Date(i.timestamp).getTime() - new Date(s.timestamp).getTime()
2019
2025
  );
2020
2026
  }
2021
- function Jr(i) {
2022
- return Object.values(i).flatMap((r) => r).sort(
2023
- (r, s) => new Date(r.operation.timestamp).getTime() - new Date(s.operation.timestamp).getTime()
2027
+ function Jr(r) {
2028
+ return Object.values(r).flatMap((i) => i).sort(
2029
+ (i, s) => new Date(i.operation.timestamp).getTime() - new Date(s.operation.timestamp).getTime()
2024
2030
  );
2025
2031
  }
2026
- function Nt(i, r, s, p, f, u = ge, l = {}, a) {
2032
+ function Nt(r, i, s, p, f, u = ge, l = {}, a) {
2027
2033
  const h = Rr(s, u);
2028
2034
  return Fe(
2029
- i,
2030
2035
  r,
2036
+ i,
2031
2037
  h,
2032
2038
  p,
2033
2039
  f,
@@ -2035,106 +2041,96 @@ function Nt(i, r, s, p, f, u = ge, l = {}, a) {
2035
2041
  a
2036
2042
  );
2037
2043
  }
2038
- function Fe(i, r, s, p, f, u = {}, l) {
2039
- const a = (l == null ? void 0 : l.checkHashes) ?? !0, h = zr(i), y = Object.keys(r).reduce((C, R) => {
2040
- const g = R;
2044
+ function Fe(r, i, s, p, f, u = {}, l) {
2045
+ const a = (l == null ? void 0 : l.checkHashes) ?? !0, h = zr(r), w = Object.keys(i).reduce((U, L) => {
2046
+ const C = L;
2041
2047
  return {
2042
- ...C,
2043
- [g]: r[g].slice(0, f == null ? void 0 : f.revision[g])
2048
+ ...U,
2049
+ [C]: Pr(
2050
+ i[C],
2051
+ u[C]
2052
+ )
2044
2053
  };
2045
- }, {}), w = Object.keys(y).reduce(
2046
- (C, R) => {
2047
- const g = R;
2048
- return {
2049
- ...C,
2050
- [g]: Pr(
2051
- y[g],
2052
- u[g]
2053
- )
2054
- };
2055
- },
2056
- {}
2057
- ), _ = Jr(w), v = _.reduce(
2058
- (C, { ignore: R, operation: g }, b, O) => R ? s(C, Zt(g.scope), p, {
2059
- skip: g.skip,
2054
+ }, {}), g = Jr(w), A = g.reduce(
2055
+ (U, { ignore: L, operation: C }) => L ? s(U, Zt(C.scope), p, {
2056
+ skip: C.skip,
2060
2057
  ignoreSkipOperations: !0
2061
2058
  // TODO: reuse hash?
2062
- }) : s(C, g, p, {
2063
- skip: g.skip,
2059
+ }) : s(U, C, p, {
2060
+ skip: C.skip,
2064
2061
  ignoreSkipOperations: !0,
2065
2062
  reuseHash: !a
2066
2063
  }),
2067
2064
  h
2068
2065
  );
2069
- if (!a) {
2070
- for (const C of Object.keys(v.state))
2071
- for (let R = _.length - 1; R >= 0; R--)
2072
- if (_[R].operation.scope === C) {
2073
- if (_[R].operation.hash !== Ht(v, C))
2074
- throw new Error(`Hash mismatch for scope ${C}`);
2066
+ if (!a)
2067
+ for (const U of Object.keys(A.state))
2068
+ for (let L = g.length - 1; L >= 0; L--) {
2069
+ const { ignore: C, operation: y } = g[L];
2070
+ if (!(C || y.scope !== U)) {
2071
+ if (y.hash !== Ht(A, U))
2072
+ throw new Error(`Hash mismatch for scope ${U}`);
2075
2073
  break;
2076
2074
  }
2077
- }
2078
- const B = Object.keys(
2079
- v.operations
2075
+ }
2076
+ const _ = Object.keys(
2077
+ A.operations
2080
2078
  ).reduce(
2081
- (C, R) => {
2082
- const g = R, b = f && f.revision[g] < r[g].length ? r[g].slice(f.revision[g]) : [];
2079
+ (U, L) => {
2080
+ const C = L;
2083
2081
  return {
2084
- ...C,
2085
- [g]: [
2086
- ...v.operations[g].map((O, P) => {
2087
- var K;
2082
+ ...U,
2083
+ [C]: [
2084
+ ...A.operations[C].map((y, b) => {
2085
+ var I;
2088
2086
  return {
2089
- ...O,
2090
- timestamp: ((K = r[g][P]) == null ? void 0 : K.timestamp) ?? O.timestamp
2087
+ ...y,
2088
+ timestamp: ((I = i[C][b]) == null ? void 0 : I.timestamp) ?? y.timestamp
2091
2089
  };
2092
- }),
2093
- ...b
2090
+ })
2094
2091
  ]
2095
2092
  };
2096
2093
  },
2097
2094
  { global: [], local: [] }
2098
- ), W = Object.values(B).reduce((C, R) => {
2099
- for (const g of R)
2100
- g.timestamp > C && (C = g.timestamp);
2101
- return C;
2102
- }, i.lastModified);
2103
- return { ...v, operations: B, lastModified: W };
2095
+ ), F = Object.values(_).reduce((U, L) => {
2096
+ const C = L[L.length - 1];
2097
+ return (C == null ? void 0 : C.timestamp) > U && (U = C.timestamp), U;
2098
+ }, r.lastModified);
2099
+ return { ...A, operations: _, lastModified: F };
2104
2100
  }
2105
- function ni(i, r) {
2106
- return St(i) === St(r);
2101
+ function ni(r, i) {
2102
+ return St(r) === St(i);
2107
2103
  }
2108
- const Be = (i) => ht(
2104
+ const Be = (r) => ht(
2109
2105
  "SET_NAME",
2110
- i,
2106
+ r,
2111
2107
  void 0,
2112
2108
  zt,
2113
2109
  void 0
2114
- ), je = (i = 1, r = "global") => ht(
2110
+ ), je = (r = 1, i = "global") => ht(
2115
2111
  "UNDO",
2116
- i,
2112
+ r,
2117
2113
  void 0,
2118
2114
  Pt,
2119
- r
2120
- ), Oe = (i = 1, r = "global") => ht(
2115
+ i
2116
+ ), Oe = (r = 1, i = "global") => ht(
2121
2117
  "REDO",
2122
- i,
2118
+ r,
2123
2119
  void 0,
2124
2120
  Lt,
2125
- r
2126
- ), Ie = (i, r, s = "global") => ht(
2121
+ i
2122
+ ), Ie = (r, i, s = "global") => ht(
2127
2123
  "PRUNE",
2128
- { start: i, end: r },
2124
+ { start: r, end: i },
2129
2125
  void 0,
2130
2126
  Rt,
2131
2127
  s
2132
- ), Kt = (i, r) => ht(
2128
+ ), Kt = (r, i) => ht(
2133
2129
  "LOAD_STATE",
2134
- { state: i, operations: r },
2130
+ { state: r, operations: i },
2135
2131
  void 0,
2136
2132
  Mt
2137
- ), Zt = (i = "global") => ht("NOOP", {}, void 0, void 0, i), oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2133
+ ), Zt = (r = "global") => ht("NOOP", {}, void 0, void 0, r), oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2138
2134
  __proto__: null,
2139
2135
  loadState: Kt,
2140
2136
  noop: Zt,
@@ -2144,21 +2140,21 @@ const Be = (i) => ht(
2144
2140
  undo: je
2145
2141
  }, 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"] };
2146
2142
  Object.freeze(Te);
2147
- var et = function(i, r, s, p) {
2143
+ var et = function(r, i, s, p) {
2148
2144
  if (s === "a" && !p)
2149
2145
  throw new TypeError("Private accessor was defined without a getter");
2150
- if (typeof r == "function" ? i !== r || !p : !r.has(i))
2146
+ if (typeof i == "function" ? r !== i || !p : !i.has(r))
2151
2147
  throw new TypeError("Cannot read private member from an object whose class did not declare it");
2152
- return s === "m" ? p : s === "a" ? p.call(i) : p ? p.value : r.get(i);
2148
+ return s === "m" ? p : s === "a" ? p.call(r) : p ? p.value : i.get(r);
2153
2149
  }, ft, mt, pt;
2154
2150
  class Wr {
2155
- constructor(...r) {
2151
+ constructor(...i) {
2156
2152
  ft.set(this, /* @__PURE__ */ new Map()), mt.set(this, /* @__PURE__ */ new Map()), pt.set(this, /* @__PURE__ */ new Map());
2157
- for (const s of r)
2153
+ for (const s of i)
2158
2154
  this.define(s);
2159
2155
  }
2160
- define(r, s = !1) {
2161
- for (let [p, f] of Object.entries(r)) {
2156
+ define(i, s = !1) {
2157
+ for (let [p, f] of Object.entries(i)) {
2162
2158
  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
2159
  const u = et(this, pt, "f").get(p);
2164
2160
  let l = !0;
@@ -2166,33 +2162,33 @@ class Wr {
2166
2162
  const h = a.startsWith("*");
2167
2163
  if (a = h ? a.slice(1) : a, u == null || u.add(a), l && et(this, mt, "f").set(p, a), l = !1, h)
2168
2164
  continue;
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.`);
2165
+ const w = et(this, ft, "f").get(a);
2166
+ if (w && w != p && !s)
2167
+ throw new Error(`"${p} -> ${a}" conflicts with "${w} -> ${a}". Pass \`force=true\` to override this definition.`);
2172
2168
  et(this, ft, "f").set(a, p);
2173
2169
  }
2174
2170
  }
2175
2171
  return this;
2176
2172
  }
2177
- getType(r) {
2178
- if (typeof r != "string")
2173
+ getType(i) {
2174
+ if (typeof i != "string")
2179
2175
  return null;
2180
- const s = r.replace(/^.*[/\\]/, "").toLowerCase(), p = s.replace(/^.*\./, "").toLowerCase(), f = s.length < r.length;
2176
+ const s = i.replace(/^.*[/\\]/, "").toLowerCase(), p = s.replace(/^.*\./, "").toLowerCase(), f = s.length < i.length;
2181
2177
  return !(p.length < s.length - 1) && f ? null : et(this, ft, "f").get(p) ?? null;
2182
2178
  }
2183
- getExtension(r) {
2179
+ getExtension(i) {
2184
2180
  var s;
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);
2181
+ return typeof i != "string" ? null : (i = (s = i == null ? void 0 : i.split) == null ? void 0 : s.call(i, ";")[0], (i && et(this, mt, "f").get(i.trim().toLowerCase())) ?? null);
2186
2182
  }
2187
- getAllExtensions(r) {
2188
- return typeof r != "string" ? null : et(this, pt, "f").get(r.toLowerCase()) ?? null;
2183
+ getAllExtensions(i) {
2184
+ return typeof i != "string" ? null : et(this, pt, "f").get(i.toLowerCase()) ?? null;
2189
2185
  }
2190
2186
  _freeze() {
2191
2187
  this.define = () => {
2192
2188
  throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
2193
2189
  }, Object.freeze(this);
2194
- for (const r of et(this, pt, "f").values())
2195
- Object.freeze(r);
2190
+ for (const i of et(this, pt, "f").values())
2191
+ Object.freeze(i);
2196
2192
  return this;
2197
2193
  }
2198
2194
  _getTestState() {
@@ -2204,12 +2200,12 @@ class Wr {
2204
2200
  }
2205
2201
  ft = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap();
2206
2202
  const Vr = new Wr(Te)._freeze();
2207
- function Hr(i) {
2208
- const r = [], s = Object.keys(i);
2203
+ function Hr(r) {
2204
+ const i = [], s = Object.keys(r);
2209
2205
  for (const p of s) {
2210
- const f = i[p].sort((u, l) => u.index - l.index);
2206
+ const f = r[p].sort((u, l) => u.index - l.index);
2211
2207
  for (let u = 0; u < f.length; u++)
2212
- f[u].index !== u && r.push({
2208
+ f[u].index !== u && i.push({
2213
2209
  message: `Invalid operation index ${f[u].index} at position ${u}`,
2214
2210
  details: {
2215
2211
  position: u,
@@ -2218,85 +2214,85 @@ function Hr(i) {
2218
2214
  }
2219
2215
  });
2220
2216
  }
2221
- return r;
2217
+ return i;
2222
2218
  }
2223
- const ke = async (i) => {
2224
- const r = new ee(), { name: s, revision: p, documentType: f, created: u, lastModified: l } = i, a = {
2219
+ const ke = async (r) => {
2220
+ const i = new ee(), { name: s, revision: p, documentType: f, created: u, lastModified: l } = r, a = {
2225
2221
  name: s,
2226
2222
  revision: p,
2227
2223
  documentType: f,
2228
2224
  created: u,
2229
2225
  lastModified: l
2230
2226
  };
2231
- return r.file("header.json", JSON.stringify(a, null, 2)), r.file(
2227
+ return i.file("header.json", JSON.stringify(a, null, 2)), i.file(
2232
2228
  "state.json",
2233
- JSON.stringify(i.initialState || {}, null, 2)
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, {
2229
+ JSON.stringify(r.initialState || {}, null, 2)
2230
+ ), i.file("operations.json", JSON.stringify(r.operations, null, 2)), Object.keys(r.attachments).forEach((w) => {
2231
+ const { data: g, ...A } = r.attachments[w];
2232
+ i.file(w, g, {
2237
2233
  base64: !0,
2238
2234
  createFolders: !0,
2239
- comment: JSON.stringify(_)
2235
+ comment: JSON.stringify(A)
2240
2236
  });
2241
- }), r;
2242
- }, Kr = async (i, r, s, p) => {
2243
- await (await ke(i)).generateAsync({
2237
+ }), i;
2238
+ }, Kr = async (r, i, s, p) => {
2239
+ await (await ke(r)).generateAsync({
2244
2240
  type: "uint8array",
2245
2241
  streamFiles: !0
2246
2242
  });
2247
- const u = p ?? i.name, l = `.${s}.zip`;
2243
+ const u = p ?? r.name, l = `.${s}.zip`;
2248
2244
  return $r(
2249
- r,
2245
+ i,
2250
2246
  u.endsWith(l) ? u : `${u}${l}`
2251
2247
  );
2252
- }, ai = async (i, r) => {
2253
- const p = await (await ke(i)).generateAsync({ type: "blob" }), f = await r.createWritable();
2248
+ }, ai = async (r, i) => {
2249
+ const p = await (await ke(r)).generateAsync({ type: "blob" }), f = await i.createWritable();
2254
2250
  await f.write(p), await f.close();
2255
- }, te = async (i, r, s) => {
2251
+ }, te = async (r, i, s) => {
2256
2252
  const p = Se();
2257
- return Zr(p, r, s);
2258
- }, Zr = async (i, r, s) => {
2253
+ return Zr(p, i, s);
2254
+ }, Zr = async (r, i, s) => {
2259
2255
  const p = new ee();
2260
- return await p.loadAsync(i), Gr(p, r, s);
2256
+ return await p.loadAsync(r), Gr(p, i, s);
2261
2257
  };
2262
- async function Gr(i, r, s) {
2263
- const p = i.file("state.json");
2258
+ async function Gr(r, i, s) {
2259
+ const p = r.file("state.json");
2264
2260
  if (!p)
2265
2261
  throw new Error("Initial state not found");
2266
- const f = await p.async("string"), u = JSON.parse(f), l = i.file("header.json");
2262
+ const f = await p.async("string"), u = JSON.parse(f), l = r.file("header.json");
2267
2263
  let a;
2268
2264
  l && (a = JSON.parse(await l.async("string")));
2269
- const h = i.file("operations.json");
2265
+ const h = r.file("operations.json");
2270
2266
  if (!h)
2271
2267
  throw new Error("Operations history not found");
2272
- const y = JSON.parse(
2268
+ const w = JSON.parse(
2273
2269
  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(`
2270
+ ), g = Hr(w);
2271
+ if (g.length) {
2272
+ const _ = g.map((F) => F.message);
2273
+ throw new Error(_.join(`
2278
2274
  `));
2279
2275
  }
2280
- let _ = Fe(
2276
+ let A = Fe(
2281
2277
  u,
2282
- y,
2283
- r,
2278
+ w,
2279
+ i,
2284
2280
  void 0,
2285
2281
  a,
2286
2282
  {},
2287
2283
  s
2288
2284
  );
2289
- return a && (_ = {
2290
- ..._,
2285
+ return a && (A = {
2286
+ ...A,
2291
2287
  ...a
2292
- }), _;
2288
+ }), A;
2293
2289
  }
2294
- function Ue(i) {
2295
- const r = i.replace(/^.*\./, "") || void 0, s = i.replace(/^.*[/\\]/, "") || void 0;
2296
- return { extension: r, fileName: s };
2290
+ function Ue(r) {
2291
+ const i = r.replace(/^.*\./, "") || void 0, s = r.replace(/^.*[/\\]/, "") || void 0;
2292
+ return { extension: i, fileName: s };
2297
2293
  }
2298
- async function si(i) {
2299
- const { buffer: r, mimeType: s = "application/octet-stream" } = await Dr(), p = Ue(i), f = r.toString("base64");
2294
+ async function si(r) {
2295
+ const { buffer: i, mimeType: s = "application/octet-stream" } = await Dr(), p = Ue(r), f = i.toString("base64");
2300
2296
  return {
2301
2297
  data: f,
2302
2298
  hash: Ot(f),
@@ -2304,8 +2300,8 @@ async function si(i) {
2304
2300
  ...p
2305
2301
  };
2306
2302
  }
2307
- async function pi(i) {
2308
- const r = await Cr(), s = Vr.getType(i) || "application/octet-stream", p = Ue(i), f = r.toString("base64");
2303
+ async function pi(r) {
2304
+ const i = await Cr(), s = Vr.getType(r) || "application/octet-stream", p = Ue(r), f = i.toString("base64");
2309
2305
  return { data: f, hash: Ot(f), mimeType: s, ...p };
2310
2306
  }
2311
2307
  class ci {
@@ -2314,21 +2310,21 @@ class ci {
2314
2310
  * @param reducer - The reducer function that updates the state.
2315
2311
  * @param document - The initial state of the document.
2316
2312
  */
2317
- constructor(r, s, p) {
2313
+ constructor(i, s, p) {
2318
2314
  At(this, "_document");
2319
2315
  At(this, "_reducer");
2320
2316
  At(this, "_signalDispatch");
2321
- this._reducer = r, this._document = s, this._signalDispatch = p;
2317
+ this._reducer = i, this._document = s, this._signalDispatch = p;
2322
2318
  }
2323
2319
  /**
2324
2320
  * Dispatches an action to update the state of the document.
2325
2321
  * @param action - The action to dispatch.
2326
2322
  * @returns The Document instance.
2327
2323
  */
2328
- dispatch(r, s) {
2324
+ dispatch(i, s) {
2329
2325
  return this._document = this._reducer(
2330
2326
  this._document,
2331
- r,
2327
+ i,
2332
2328
  this._signalDispatch,
2333
2329
  s
2334
2330
  ), this;
@@ -2339,15 +2335,15 @@ class ci {
2339
2335
  * @param extension - The file extension to use when saving the state.
2340
2336
  * @returns The file path where the state was saved.
2341
2337
  */
2342
- saveToFile(r, s, p) {
2343
- return Kr(this._document, r, s, p);
2338
+ saveToFile(i, s, p) {
2339
+ return Kr(this._document, i, s, p);
2344
2340
  }
2345
2341
  /**
2346
2342
  * Loads the state of the document from a file.
2347
2343
  * @param path - The file path where the state is stored.
2348
2344
  */
2349
- async loadFromFile(r) {
2350
- this._document = await te(r, this._reducer);
2345
+ async loadFromFile(i) {
2346
+ this._document = await te(i, this._reducer);
2351
2347
  }
2352
2348
  /**
2353
2349
  * Loads the state of the document from a file and returns it.
@@ -2355,8 +2351,8 @@ class ci {
2355
2351
  * @param reducer - The reducer function that updates the state.
2356
2352
  * @returns The state of the document.
2357
2353
  */
2358
- static async stateFromFile(r, s) {
2359
- return await te(r, s);
2354
+ static async stateFromFile(i, s) {
2355
+ return await te(i, s);
2360
2356
  }
2361
2357
  /**
2362
2358
  * Gets the current state of the document.
@@ -2400,8 +2396,8 @@ class ci {
2400
2396
  get revision() {
2401
2397
  return this._document.revision.global;
2402
2398
  }
2403
- getRevision(r) {
2404
- return this._document.revision[r];
2399
+ getRevision(i) {
2400
+ return this._document.revision[i];
2405
2401
  }
2406
2402
  /**
2407
2403
  * Gets the initial state of the document.
@@ -2419,53 +2415,53 @@ class ci {
2419
2415
  * Gets the attachment associated with the given key.
2420
2416
  * @param attachment - The key of the attachment to retrieve.
2421
2417
  */
2422
- getAttachment(r) {
2423
- return this._document.attachments[r];
2418
+ getAttachment(i) {
2419
+ return this._document.attachments[i];
2424
2420
  }
2425
2421
  /**
2426
2422
  * Sets the name of the document.
2427
2423
  * @param name - The new name of the document.
2428
2424
  */
2429
- setName(r) {
2430
- return this.dispatch(Be(r)), this;
2425
+ setName(i) {
2426
+ return this.dispatch(Be(i)), this;
2431
2427
  }
2432
2428
  /**
2433
2429
  * Reverts a number of actions from the document.
2434
2430
  * @param count - The number of actions to revert.
2435
2431
  */
2436
- undo(r) {
2437
- return this.dispatch(je(r)), this;
2432
+ undo(i) {
2433
+ return this.dispatch(je(i)), this;
2438
2434
  }
2439
2435
  /**
2440
2436
  * Reapplies a number of actions to the document.
2441
2437
  * @param count - The number of actions to reapply.
2442
2438
  */
2443
- redo(r) {
2444
- return this.dispatch(Oe(r)), this;
2439
+ redo(i) {
2440
+ return this.dispatch(Oe(i)), this;
2445
2441
  }
2446
2442
  /**
2447
2443
  * Removes a range of operations from the document.
2448
2444
  * @param start - The starting index of the range to remove.
2449
2445
  * @param end - The ending index of the range to remove.
2450
2446
  */
2451
- prune(r, s) {
2452
- return this.dispatch(Ie(r, s)), this;
2447
+ prune(i, s) {
2448
+ return this.dispatch(Ie(i, s)), this;
2453
2449
  }
2454
2450
  /**
2455
2451
  * Loads a document state and a set of operations.
2456
2452
  * @param state - The state to load.
2457
2453
  * @param operations - The operations to apply to the document.
2458
2454
  */
2459
- loadState(r, s) {
2460
- return this.dispatch(Kt(r, s)), this;
2455
+ loadState(i, s) {
2456
+ return this.dispatch(Kt(i, s)), this;
2461
2457
  }
2462
2458
  }
2463
- function li(i, r) {
2464
- r.forEach((s) => {
2459
+ function li(r, i) {
2460
+ i.forEach((s) => {
2465
2461
  Object.getOwnPropertyNames(s.prototype).forEach((p) => {
2466
2462
  Object.defineProperty(
2467
2463
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
2468
- i.prototype,
2464
+ r.prototype,
2469
2465
  p,
2470
2466
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
2471
2467
  Object.getOwnPropertyDescriptor(s.prototype, p) || /* @__PURE__ */ Object.create(null)