document-model 1.0.17 → 1.0.19

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 (59) hide show
  1. package/dist/browser/document/utils/base.d.ts +6 -2
  2. package/dist/browser/document-model/gen/header/object.d.ts +2 -2
  3. package/dist/browser/document-model/gen/module/object.d.ts +2 -2
  4. package/dist/browser/document-model/gen/object.d.ts +4 -4
  5. package/dist/browser/document-model/gen/operation/object.d.ts +2 -2
  6. package/dist/browser/document-model/gen/operation-error/object.d.ts +2 -2
  7. package/dist/browser/document-model/gen/operation-example/object.d.ts +2 -2
  8. package/dist/browser/document-model/gen/reducer.d.ts +2 -2
  9. package/dist/browser/document-model/gen/schema/types.d.ts +1 -1
  10. package/dist/browser/document-model/gen/state/object.d.ts +2 -2
  11. package/dist/browser/document-model/gen/types.d.ts +3 -3
  12. package/dist/browser/document-model/gen/utils.d.ts +4 -2
  13. package/dist/browser/document-model/gen/versioning/object.d.ts +2 -2
  14. package/dist/browser/document-model/index.d.ts +9 -9
  15. package/dist/browser/document-model.cjs +1 -1
  16. package/dist/browser/document-model.js +2 -2
  17. package/dist/browser/document.cjs +1 -1
  18. package/dist/browser/document.js +6 -6
  19. package/dist/browser/index.cjs +1 -1
  20. package/dist/browser/index.js +4 -4
  21. package/dist/browser/internal/{index-01030c3f.js → index-1ad32a2e.js} +2 -2
  22. package/dist/browser/internal/index-2551382e.js +34 -0
  23. package/dist/{node/internal/index-0db636da.js → browser/internal/index-46b68530.js} +22 -25
  24. package/dist/browser/internal/index-869c5d0d.js +1 -0
  25. package/dist/browser/internal/object-1fdba77d.js +6 -0
  26. package/dist/browser/internal/{object-7e8eaff4.js → object-d50f7d2f.js} +744 -715
  27. package/dist/node/document/utils/base.d.ts +6 -2
  28. package/dist/node/document-model/gen/header/object.d.ts +2 -2
  29. package/dist/node/document-model/gen/module/object.d.ts +2 -2
  30. package/dist/node/document-model/gen/object.d.ts +4 -4
  31. package/dist/node/document-model/gen/operation/object.d.ts +2 -2
  32. package/dist/node/document-model/gen/operation-error/object.d.ts +2 -2
  33. package/dist/node/document-model/gen/operation-example/object.d.ts +2 -2
  34. package/dist/node/document-model/gen/reducer.d.ts +2 -2
  35. package/dist/node/document-model/gen/schema/types.d.ts +1 -1
  36. package/dist/node/document-model/gen/state/object.d.ts +2 -2
  37. package/dist/node/document-model/gen/types.d.ts +3 -3
  38. package/dist/node/document-model/gen/utils.d.ts +4 -2
  39. package/dist/node/document-model/gen/versioning/object.d.ts +2 -2
  40. package/dist/node/document-model/index.d.ts +9 -9
  41. package/dist/node/document-model.cjs +1 -1
  42. package/dist/node/document-model.js +3 -3
  43. package/dist/node/document.cjs +1 -1
  44. package/dist/node/document.js +5 -5
  45. package/dist/node/index.cjs +1 -1
  46. package/dist/node/index.js +4 -4
  47. package/dist/node/internal/{index-cddc9dfd.js → index-631ba7bf.js} +2 -2
  48. package/dist/node/internal/index-6477ee0a.js +1 -0
  49. package/dist/{browser/internal/index-5f1909ad.js → node/internal/index-8d582c48.js} +26 -21
  50. package/dist/node/internal/index-f235f9be.js +34 -0
  51. package/dist/node/internal/object-08bd169a.js +1 -0
  52. package/dist/node/internal/{object-c32ea0a0.js → object-773231ca.js} +473 -444
  53. package/package.json +1 -1
  54. package/dist/browser/internal/index-2aee8ea9.js +0 -1
  55. package/dist/browser/internal/index-a1282d5c.js +0 -31
  56. package/dist/browser/internal/object-24df9d92.js +0 -6
  57. package/dist/node/internal/index-2d4783d9.js +0 -1
  58. package/dist/node/internal/index-5ef0c6b0.js +0 -31
  59. package/dist/node/internal/object-21f3d2ee.js +0 -1
@@ -1,27 +1,27 @@
1
- var yr = Object.defineProperty;
2
- var vr = (e, a, s) => a in e ? yr(e, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[a] = s;
3
- var q = (e, a, s) => (vr(e, typeof a != "symbol" ? a + "" : a, s), s);
4
- import br from "json-stringify-deterministic";
5
- import { produce as bt, castDraft as Er, castImmutable as _r, freeze as Fr } from "immer";
6
- import At from "jszip";
1
+ var br = Object.defineProperty;
2
+ var Er = (e, a, p) => a in e ? br(e, a, { enumerable: !0, configurable: !0, writable: !0, value: p }) : e[a] = p;
3
+ var J = (e, a, p) => (Er(e, typeof a != "symbol" ? a + "" : a, p), p);
4
+ import _r from "json-stringify-deterministic";
5
+ import { produce as bt, castDraft as Fr, castImmutable as Ar, freeze as Sr } from "immer";
7
6
  import { z as g } from "zod";
8
- const St = (e) => e != null, Ar = g.any().refine((e) => St(e)), Bt = g.enum(["LOAD_STATE"]), jt = g.enum(["PRUNE"]), It = g.enum(["REDO"]), Ut = g.enum(["SET_NAME"]), kt = g.enum(["UNDO"]);
9
- function Sr() {
7
+ import Ft from "jszip";
8
+ const At = (e) => e != null, Br = g.any().refine((e) => At(e)), St = g.enum(["LOAD_STATE"]), Bt = g.enum(["PRUNE"]), jt = g.enum(["REDO"]), It = g.enum(["SET_NAME"]), Ut = g.enum(["UNDO"]);
9
+ function jr() {
10
10
  return g.object({
11
11
  __typename: g.literal("Action").optional(),
12
12
  type: g.string()
13
13
  });
14
14
  }
15
- function Tt() {
15
+ function kt() {
16
16
  return g.union([
17
- Dt(),
17
+ Tt(),
18
+ Ot(),
18
19
  Nt(),
19
20
  Mt(),
20
- Ct(),
21
- Rt()
21
+ Ct()
22
22
  ]);
23
23
  }
24
- function Br() {
24
+ function Ir() {
25
25
  return g.object({
26
26
  __typename: g.literal("DocumentFile").optional(),
27
27
  data: g.string(),
@@ -30,26 +30,26 @@ function Br() {
30
30
  mimeType: g.string()
31
31
  });
32
32
  }
33
- function Dt() {
33
+ function Tt() {
34
34
  return g.object({
35
35
  input: g.lazy(() => it()),
36
- type: Bt,
36
+ type: St,
37
37
  scope: g.literal("global")
38
38
  });
39
39
  }
40
40
  function it() {
41
41
  return g.object({
42
42
  operations: g.number(),
43
- state: g.lazy(() => Ot())
43
+ state: g.lazy(() => Dt())
44
44
  });
45
45
  }
46
- function Ot() {
46
+ function Dt() {
47
47
  return g.object({
48
48
  data: g.unknown().nullish(),
49
49
  name: g.string()
50
50
  });
51
51
  }
52
- function jr() {
52
+ function Ur() {
53
53
  return g.object({
54
54
  __typename: g.literal("Operation").optional(),
55
55
  hash: g.string(),
@@ -58,10 +58,10 @@ function jr() {
58
58
  type: g.string()
59
59
  });
60
60
  }
61
- function Nt() {
61
+ function Ot() {
62
62
  return g.object({
63
63
  input: g.lazy(() => et()),
64
- type: jt,
64
+ type: Bt,
65
65
  scope: g.literal("global")
66
66
  });
67
67
  }
@@ -72,22 +72,22 @@ function et() {
72
72
  });
73
73
  }
74
74
  const nt = g.number;
75
- function Mt() {
75
+ function Nt() {
76
76
  return g.object({
77
77
  input: nt(),
78
- type: It,
78
+ type: jt,
79
79
  scope: g.literal("global")
80
80
  });
81
81
  }
82
82
  const at = g.string;
83
- function Ct() {
83
+ function Mt() {
84
84
  return g.object({
85
85
  input: at(),
86
- type: Ut,
86
+ type: It,
87
87
  scope: g.literal("global")
88
88
  });
89
89
  }
90
- function Ir() {
90
+ function kr() {
91
91
  return g.object({
92
92
  __typename: g.literal("SetNameOperation").optional(),
93
93
  hash: g.string(),
@@ -98,85 +98,169 @@ function Ir() {
98
98
  });
99
99
  }
100
100
  const ot = g.number;
101
- function Rt() {
101
+ function Ct() {
102
102
  return g.object({
103
103
  input: ot(),
104
- type: kt,
104
+ type: Ut,
105
105
  scope: g.literal("global")
106
106
  });
107
107
  }
108
- const Bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
108
+ const Ii = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
109
109
  __proto__: null,
110
- ActionSchema: Sr,
111
- BaseActionSchema: Tt,
112
- DocumentFileSchema: Br,
110
+ ActionSchema: jr,
111
+ BaseActionSchema: kt,
112
+ DocumentFileSchema: Ir,
113
113
  LoadStateActionInputSchema: it,
114
- LoadStateActionSchema: Dt,
115
- LoadStateActionStateInputSchema: Ot,
116
- Load_StateSchema: Bt,
117
- OperationSchema: jr,
114
+ LoadStateActionSchema: Tt,
115
+ LoadStateActionStateInputSchema: Dt,
116
+ Load_StateSchema: St,
117
+ OperationSchema: Ur,
118
118
  PruneActionInputSchema: et,
119
- PruneActionSchema: Nt,
120
- PruneSchema: jt,
119
+ PruneActionSchema: Ot,
120
+ PruneSchema: Bt,
121
121
  RedoActionInputSchema: nt,
122
- RedoActionSchema: Mt,
123
- RedoSchema: It,
122
+ RedoActionSchema: Nt,
123
+ RedoSchema: jt,
124
124
  SetNameActionInputSchema: at,
125
- SetNameActionSchema: Ct,
126
- SetNameOperationSchema: Ir,
127
- Set_NameSchema: Ut,
125
+ SetNameActionSchema: Mt,
126
+ SetNameOperationSchema: kr,
127
+ Set_NameSchema: It,
128
128
  UndoActionInputSchema: ot,
129
- UndoActionSchema: Rt,
130
- UndoSchema: kt,
131
- definedNonNullAnySchema: Ar,
132
- isDefinedNonNullAny: St
129
+ UndoActionSchema: Ct,
130
+ UndoSchema: Ut,
131
+ definedNonNullAnySchema: Br,
132
+ isDefinedNonNullAny: At
133
133
  }, Symbol.toStringTag, { value: "Module" }));
134
- function Lt(e) {
134
+ function Tr(e, a) {
135
+ return { ...e, name: a };
136
+ }
137
+ function Dr(e, a, p) {
138
+ const l = Math.min(a, e.revision), c = e.operations.global.slice(
139
+ 0,
140
+ e.revision - l
141
+ );
142
+ return {
143
+ ...W(
144
+ e.initialState,
145
+ {
146
+ global: c,
147
+ local: e.operations.local
148
+ },
149
+ p
150
+ ),
151
+ operations: e.operations,
152
+ revision: e.revision - l
153
+ };
154
+ }
155
+ function Or(e, a, p) {
156
+ const l = e.operations.global.length - e.revision;
157
+ if (!l)
158
+ throw new Error("There is no UNDO operation to REDO");
159
+ const c = a < l ? a : l, h = e.operations.global.slice(
160
+ 0,
161
+ e.revision + c
162
+ );
163
+ return {
164
+ ...W(
165
+ e.initialState,
166
+ {
167
+ global: h,
168
+ local: e.operations.local
169
+ },
170
+ p
171
+ ),
172
+ operations: e.operations,
173
+ revision: e.revision + c
174
+ };
175
+ }
176
+ function Nr(e, a, p, l) {
177
+ a = a || 0, p = p || e.operations.global.length;
178
+ const c = e.operations.global.slice(a, p), h = e.operations.global.slice(0, a), u = e.operations.global.slice(p), o = W(
179
+ e.initialState,
180
+ {
181
+ global: h.concat(c),
182
+ local: e.operations.local
183
+ },
184
+ l
185
+ ), { name: x, state: d } = o, y = h.length, b = h.length ? h[h.length - 1].timestamp : u.length ? u[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
186
+ return W(
187
+ e.initialState,
188
+ {
189
+ global: [
190
+ ...h,
191
+ {
192
+ ...lt(
193
+ { name: x, state: d },
194
+ c.length
195
+ ),
196
+ timestamp: b,
197
+ index: y,
198
+ hash: Xt({ state: d }, "global")
199
+ },
200
+ ...u.map((j, F) => ({
201
+ ...j,
202
+ index: y + F + 1
203
+ }))
204
+ ],
205
+ local: e.operations.local
206
+ },
207
+ l
208
+ );
209
+ }
210
+ function Mr(e, a) {
211
+ return {
212
+ ...e,
213
+ name: a.name,
214
+ state: a.state ?? { global: {}, local: {} }
215
+ };
216
+ }
217
+ const Rt = "SET_NAME", M = "UNDO", C = "REDO", R = "PRUNE", Lt = "LOAD_STATE";
218
+ function zt(e) {
135
219
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
136
220
  }
137
- function P() {
221
+ function H() {
138
222
  this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
139
223
  for (let e = 0; e < arguments.length; e++)
140
224
  this.define(arguments[e]);
141
225
  this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
142
226
  }
143
- P.prototype.define = function(e, a) {
144
- for (let s in e) {
145
- let l = e[s].map(function(f) {
146
- return f.toLowerCase();
227
+ H.prototype.define = function(e, a) {
228
+ for (let p in e) {
229
+ let l = e[p].map(function(c) {
230
+ return c.toLowerCase();
147
231
  });
148
- s = s.toLowerCase();
149
- for (let f = 0; f < l.length; f++) {
150
- const h = l[f];
232
+ p = p.toLowerCase();
233
+ for (let c = 0; c < l.length; c++) {
234
+ const h = l[c];
151
235
  if (h[0] !== "*") {
152
236
  if (!a && h in this._types)
153
237
  throw new Error(
154
- 'Attempt to change mapping for "' + h + '" extension from "' + this._types[h] + '" to "' + s + '". Pass `force=true` to allow this, otherwise remove "' + h + '" from the list of extensions for "' + s + '".'
238
+ 'Attempt to change mapping for "' + h + '" extension from "' + this._types[h] + '" to "' + p + '". Pass `force=true` to allow this, otherwise remove "' + h + '" from the list of extensions for "' + p + '".'
155
239
  );
156
- this._types[h] = s;
240
+ this._types[h] = p;
157
241
  }
158
242
  }
159
- if (a || !this._extensions[s]) {
160
- const f = l[0];
161
- this._extensions[s] = f[0] !== "*" ? f : f.substr(1);
243
+ if (a || !this._extensions[p]) {
244
+ const c = l[0];
245
+ this._extensions[p] = c[0] !== "*" ? c : c.substr(1);
162
246
  }
163
247
  }
164
248
  };
165
- P.prototype.getType = function(e) {
249
+ H.prototype.getType = function(e) {
166
250
  e = String(e);
167
- let a = e.replace(/^.*[/\\]/, "").toLowerCase(), s = a.replace(/^.*\./, "").toLowerCase(), l = a.length < e.length;
168
- return (s.length < a.length - 1 || !l) && this._types[s] || null;
251
+ let a = e.replace(/^.*[/\\]/, "").toLowerCase(), p = a.replace(/^.*\./, "").toLowerCase(), l = a.length < e.length;
252
+ return (p.length < a.length - 1 || !l) && this._types[p] || null;
169
253
  };
170
- P.prototype.getExtension = function(e) {
254
+ H.prototype.getExtension = function(e) {
171
255
  return e = /^\s*([^;\s]*)/.test(e) && RegExp.$1, e && this._extensions[e.toLowerCase()] || null;
172
256
  };
173
- var Ur = P, kr = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
174
- let Tr = Ur;
175
- var Dr = new Tr(kr);
176
- const Or = /* @__PURE__ */ Lt(Dr);
257
+ var Cr = H, Rr = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
258
+ let Lr = Cr;
259
+ var zr = new Lr(Rr);
260
+ const qr = /* @__PURE__ */ zt(zr);
177
261
  var tt = { exports: {} };
178
- typeof Object.create == "function" ? tt.exports = function(a, s) {
179
- s && (a.super_ = s, a.prototype = Object.create(s.prototype, {
262
+ typeof Object.create == "function" ? tt.exports = function(a, p) {
263
+ p && (a.super_ = p, a.prototype = Object.create(p.prototype, {
180
264
  constructor: {
181
265
  value: a,
182
266
  enumerable: !1,
@@ -184,86 +268,86 @@ typeof Object.create == "function" ? tt.exports = function(a, s) {
184
268
  configurable: !0
185
269
  }
186
270
  }));
187
- } : tt.exports = function(a, s) {
188
- if (s) {
189
- a.super_ = s;
271
+ } : tt.exports = function(a, p) {
272
+ if (p) {
273
+ a.super_ = p;
190
274
  var l = function() {
191
275
  };
192
- l.prototype = s.prototype, a.prototype = new l(), a.prototype.constructor = a;
276
+ l.prototype = p.prototype, a.prototype = new l(), a.prototype.constructor = a;
193
277
  }
194
278
  };
195
- var Nr = tt.exports, rt = { exports: {} }, zt = {}, W = {};
196
- W.byteLength = Rr;
197
- W.toByteArray = zr;
198
- W.fromByteArray = Jr;
199
- var k = [], j = [], Mr = typeof Uint8Array < "u" ? Uint8Array : Array, Q = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
200
- for (var D = 0, Cr = Q.length; D < Cr; ++D)
201
- k[D] = Q[D], j[Q.charCodeAt(D)] = D;
202
- j["-".charCodeAt(0)] = 62;
203
- j["_".charCodeAt(0)] = 63;
204
- function qt(e) {
279
+ var $r = tt.exports, rt = { exports: {} }, qt = {}, Z = {};
280
+ Z.byteLength = Wr;
281
+ Z.toByteArray = Zr;
282
+ Z.fromByteArray = Xr;
283
+ var k = [], I = [], Jr = typeof Uint8Array < "u" ? Uint8Array : Array, Q = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
284
+ for (var O = 0, Pr = Q.length; O < Pr; ++O)
285
+ k[O] = Q[O], I[Q.charCodeAt(O)] = O;
286
+ I["-".charCodeAt(0)] = 62;
287
+ I["_".charCodeAt(0)] = 63;
288
+ function $t(e) {
205
289
  var a = e.length;
206
290
  if (a % 4 > 0)
207
291
  throw new Error("Invalid string. Length must be a multiple of 4");
208
- var s = e.indexOf("=");
209
- s === -1 && (s = a);
210
- var l = s === a ? 0 : 4 - s % 4;
211
- return [s, l];
292
+ var p = e.indexOf("=");
293
+ p === -1 && (p = a);
294
+ var l = p === a ? 0 : 4 - p % 4;
295
+ return [p, l];
212
296
  }
213
- function Rr(e) {
214
- var a = qt(e), s = a[0], l = a[1];
215
- return (s + l) * 3 / 4 - l;
297
+ function Wr(e) {
298
+ var a = $t(e), p = a[0], l = a[1];
299
+ return (p + l) * 3 / 4 - l;
216
300
  }
217
- function Lr(e, a, s) {
218
- return (a + s) * 3 / 4 - s;
301
+ function Hr(e, a, p) {
302
+ return (a + p) * 3 / 4 - p;
219
303
  }
220
- function zr(e) {
221
- var a, s = qt(e), l = s[0], f = s[1], h = new Mr(Lr(e, l, f)), c = 0, o = f > 0 ? l - 4 : l, x;
304
+ function Zr(e) {
305
+ var a, p = $t(e), l = p[0], c = p[1], h = new Jr(Hr(e, l, c)), u = 0, o = c > 0 ? l - 4 : l, x;
222
306
  for (x = 0; x < o; x += 4)
223
- a = j[e.charCodeAt(x)] << 18 | j[e.charCodeAt(x + 1)] << 12 | j[e.charCodeAt(x + 2)] << 6 | j[e.charCodeAt(x + 3)], h[c++] = a >> 16 & 255, h[c++] = a >> 8 & 255, h[c++] = a & 255;
224
- return f === 2 && (a = j[e.charCodeAt(x)] << 2 | j[e.charCodeAt(x + 1)] >> 4, h[c++] = a & 255), f === 1 && (a = j[e.charCodeAt(x)] << 10 | j[e.charCodeAt(x + 1)] << 4 | j[e.charCodeAt(x + 2)] >> 2, h[c++] = a >> 8 & 255, h[c++] = a & 255), h;
307
+ a = I[e.charCodeAt(x)] << 18 | I[e.charCodeAt(x + 1)] << 12 | I[e.charCodeAt(x + 2)] << 6 | I[e.charCodeAt(x + 3)], h[u++] = a >> 16 & 255, h[u++] = a >> 8 & 255, h[u++] = a & 255;
308
+ return c === 2 && (a = I[e.charCodeAt(x)] << 2 | I[e.charCodeAt(x + 1)] >> 4, h[u++] = a & 255), c === 1 && (a = I[e.charCodeAt(x)] << 10 | I[e.charCodeAt(x + 1)] << 4 | I[e.charCodeAt(x + 2)] >> 2, h[u++] = a >> 8 & 255, h[u++] = a & 255), h;
225
309
  }
226
- function qr(e) {
310
+ function Yr(e) {
227
311
  return k[e >> 18 & 63] + k[e >> 12 & 63] + k[e >> 6 & 63] + k[e & 63];
228
312
  }
229
- function $r(e, a, s) {
230
- for (var l, f = [], h = a; h < s; h += 3)
231
- l = (e[h] << 16 & 16711680) + (e[h + 1] << 8 & 65280) + (e[h + 2] & 255), f.push(qr(l));
232
- return f.join("");
313
+ function Kr(e, a, p) {
314
+ for (var l, c = [], h = a; h < p; h += 3)
315
+ l = (e[h] << 16 & 16711680) + (e[h + 1] << 8 & 65280) + (e[h + 2] & 255), c.push(Yr(l));
316
+ return c.join("");
233
317
  }
234
- function Jr(e) {
235
- for (var a, s = e.length, l = s % 3, f = [], h = 16383, c = 0, o = s - l; c < o; c += h)
236
- f.push($r(e, c, c + h > o ? o : c + h));
237
- return l === 1 ? (a = e[s - 1], f.push(
318
+ function Xr(e) {
319
+ for (var a, p = e.length, l = p % 3, c = [], h = 16383, u = 0, o = p - l; u < o; u += h)
320
+ c.push(Kr(e, u, u + h > o ? o : u + h));
321
+ return l === 1 ? (a = e[p - 1], c.push(
238
322
  k[a >> 2] + k[a << 4 & 63] + "=="
239
- )) : l === 2 && (a = (e[s - 2] << 8) + e[s - 1], f.push(
323
+ )) : l === 2 && (a = (e[p - 2] << 8) + e[p - 1], c.push(
240
324
  k[a >> 10] + k[a >> 4 & 63] + k[a << 2 & 63] + "="
241
- )), f.join("");
325
+ )), c.join("");
242
326
  }
243
327
  var pt = {};
244
328
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
245
- pt.read = function(e, a, s, l, f) {
246
- var h, c, o = f * 8 - l - 1, x = (1 << o) - 1, w = x >> 1, y = -7, _ = s ? f - 1 : 0, I = s ? -1 : 1, S = e[a + _];
247
- for (_ += I, h = S & (1 << -y) - 1, S >>= -y, y += o; y > 0; h = h * 256 + e[a + _], _ += I, y -= 8)
329
+ pt.read = function(e, a, p, l, c) {
330
+ var h, u, o = c * 8 - l - 1, x = (1 << o) - 1, d = x >> 1, y = -7, b = p ? c - 1 : 0, j = p ? -1 : 1, F = e[a + b];
331
+ for (b += j, h = F & (1 << -y) - 1, F >>= -y, y += o; y > 0; h = h * 256 + e[a + b], b += j, y -= 8)
248
332
  ;
249
- for (c = h & (1 << -y) - 1, h >>= -y, y += l; y > 0; c = c * 256 + e[a + _], _ += I, y -= 8)
333
+ for (u = h & (1 << -y) - 1, h >>= -y, y += l; y > 0; u = u * 256 + e[a + b], b += j, y -= 8)
250
334
  ;
251
335
  if (h === 0)
252
- h = 1 - w;
336
+ h = 1 - d;
253
337
  else {
254
338
  if (h === x)
255
- return c ? NaN : (S ? -1 : 1) * (1 / 0);
256
- c = c + Math.pow(2, l), h = h - w;
339
+ return u ? NaN : (F ? -1 : 1) * (1 / 0);
340
+ u = u + Math.pow(2, l), h = h - d;
257
341
  }
258
- return (S ? -1 : 1) * c * Math.pow(2, h - l);
342
+ return (F ? -1 : 1) * u * Math.pow(2, h - l);
259
343
  };
260
- pt.write = function(e, a, s, l, f, h) {
261
- var c, o, x, w = h * 8 - f - 1, y = (1 << w) - 1, _ = y >> 1, I = f === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, S = l ? 0 : h - 1, O = l ? 1 : -1, N = a < 0 || a === 0 && 1 / a < 0 ? 1 : 0;
262
- for (a = Math.abs(a), isNaN(a) || a === 1 / 0 ? (o = isNaN(a) ? 1 : 0, c = y) : (c = Math.floor(Math.log(a) / Math.LN2), a * (x = Math.pow(2, -c)) < 1 && (c--, x *= 2), c + _ >= 1 ? a += I / x : a += I * Math.pow(2, 1 - _), a * x >= 2 && (c++, x /= 2), c + _ >= y ? (o = 0, c = y) : c + _ >= 1 ? (o = (a * x - 1) * Math.pow(2, f), c = c + _) : (o = a * Math.pow(2, _ - 1) * Math.pow(2, f), c = 0)); f >= 8; e[s + S] = o & 255, S += O, o /= 256, f -= 8)
344
+ pt.write = function(e, a, p, l, c, h) {
345
+ var u, o, x, d = h * 8 - c - 1, y = (1 << d) - 1, b = y >> 1, j = c === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, F = l ? 0 : h - 1, T = l ? 1 : -1, N = a < 0 || a === 0 && 1 / a < 0 ? 1 : 0;
346
+ for (a = Math.abs(a), isNaN(a) || a === 1 / 0 ? (o = isNaN(a) ? 1 : 0, u = y) : (u = Math.floor(Math.log(a) / Math.LN2), a * (x = Math.pow(2, -u)) < 1 && (u--, x *= 2), u + b >= 1 ? a += j / x : a += j * Math.pow(2, 1 - b), a * x >= 2 && (u++, x /= 2), u + b >= y ? (o = 0, u = y) : u + b >= 1 ? (o = (a * x - 1) * Math.pow(2, c), u = u + b) : (o = a * Math.pow(2, b - 1) * Math.pow(2, c), u = 0)); c >= 8; e[p + F] = o & 255, F += T, o /= 256, c -= 8)
263
347
  ;
264
- for (c = c << f | o, w += f; w > 0; e[s + S] = c & 255, S += O, c /= 256, w -= 8)
348
+ for (u = u << c | o, d += c; d > 0; e[p + F] = u & 255, F += T, u /= 256, d -= 8)
265
349
  ;
266
- e[s + S - O] |= N * 128;
350
+ e[p + F - T] |= N * 128;
267
351
  };
268
352
  /*!
269
353
  * The buffer module from node.js, for the browser.
@@ -272,10 +356,10 @@ pt.write = function(e, a, s, l, f, h) {
272
356
  * @license MIT
273
357
  */
274
358
  (function(e) {
275
- var a = W, s = pt, l = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
276
- e.Buffer = o, e.SlowBuffer = rr, e.INSPECT_MAX_BYTES = 50;
277
- var f = 2147483647;
278
- e.kMaxLength = f, o.TYPED_ARRAY_SUPPORT = h(), !o.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
359
+ var a = Z, p = pt, l = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
360
+ e.Buffer = o, e.SlowBuffer = er, e.INSPECT_MAX_BYTES = 50;
361
+ var c = 2147483647;
362
+ e.kMaxLength = c, o.TYPED_ARRAY_SUPPORT = h(), !o.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
279
363
  "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
280
364
  );
281
365
  function h() {
@@ -301,8 +385,8 @@ pt.write = function(e, a, s, l, f, h) {
301
385
  return this.byteOffset;
302
386
  }
303
387
  });
304
- function c(i) {
305
- if (i > f)
388
+ function u(i) {
389
+ if (i > c)
306
390
  throw new RangeError('The value "' + i + '" is invalid for option "size"');
307
391
  var t = new Uint8Array(i);
308
392
  return Object.setPrototypeOf(t, o.prototype), t;
@@ -313,16 +397,16 @@ pt.write = function(e, a, s, l, f, h) {
313
397
  throw new TypeError(
314
398
  'The "string" argument must be of type string. Received type number'
315
399
  );
316
- return _(i);
400
+ return b(i);
317
401
  }
318
402
  return x(i, t, r);
319
403
  }
320
404
  o.poolSize = 8192;
321
405
  function x(i, t, r) {
322
406
  if (typeof i == "string")
323
- return I(i, t);
407
+ return j(i, t);
324
408
  if (ArrayBuffer.isView(i))
325
- return O(i);
409
+ return T(i);
326
410
  if (i == null)
327
411
  throw new TypeError(
328
412
  "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof i
@@ -336,9 +420,9 @@ pt.write = function(e, a, s, l, f, h) {
336
420
  var n = i.valueOf && i.valueOf();
337
421
  if (n != null && n !== i)
338
422
  return o.from(n, t, r);
339
- var p = tr(i);
340
- if (p)
341
- return p;
423
+ var s = ir(i);
424
+ if (s)
425
+ return s;
342
426
  if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof i[Symbol.toPrimitive] == "function")
343
427
  return o.from(
344
428
  i[Symbol.toPrimitive]("string"),
@@ -352,43 +436,43 @@ pt.write = function(e, a, s, l, f, h) {
352
436
  o.from = function(i, t, r) {
353
437
  return x(i, t, r);
354
438
  }, Object.setPrototypeOf(o.prototype, Uint8Array.prototype), Object.setPrototypeOf(o, Uint8Array);
355
- function w(i) {
439
+ function d(i) {
356
440
  if (typeof i != "number")
357
441
  throw new TypeError('"size" argument must be of type number');
358
442
  if (i < 0)
359
443
  throw new RangeError('The value "' + i + '" is invalid for option "size"');
360
444
  }
361
445
  function y(i, t, r) {
362
- return w(i), i <= 0 ? c(i) : t !== void 0 ? typeof r == "string" ? c(i).fill(t, r) : c(i).fill(t) : c(i);
446
+ return d(i), i <= 0 ? u(i) : t !== void 0 ? typeof r == "string" ? u(i).fill(t, r) : u(i).fill(t) : u(i);
363
447
  }
364
448
  o.alloc = function(i, t, r) {
365
449
  return y(i, t, r);
366
450
  };
367
- function _(i) {
368
- return w(i), c(i < 0 ? 0 : X(i) | 0);
451
+ function b(i) {
452
+ return d(i), u(i < 0 ? 0 : X(i) | 0);
369
453
  }
370
454
  o.allocUnsafe = function(i) {
371
- return _(i);
455
+ return b(i);
372
456
  }, o.allocUnsafeSlow = function(i) {
373
- return _(i);
457
+ return b(i);
374
458
  };
375
- function I(i, t) {
459
+ function j(i, t) {
376
460
  if ((typeof t != "string" || t === "") && (t = "utf8"), !o.isEncoding(t))
377
461
  throw new TypeError("Unknown encoding: " + t);
378
- var r = ct(i, t) | 0, n = c(r), p = n.write(i, t);
379
- return p !== r && (n = n.slice(0, p)), n;
462
+ var r = ct(i, t) | 0, n = u(r), s = n.write(i, t);
463
+ return s !== r && (n = n.slice(0, s)), n;
380
464
  }
381
- function S(i) {
382
- for (var t = i.length < 0 ? 0 : X(i.length) | 0, r = c(t), n = 0; n < t; n += 1)
465
+ function F(i) {
466
+ for (var t = i.length < 0 ? 0 : X(i.length) | 0, r = u(t), n = 0; n < t; n += 1)
383
467
  r[n] = i[n] & 255;
384
468
  return r;
385
469
  }
386
- function O(i) {
470
+ function T(i) {
387
471
  if (U(i, Uint8Array)) {
388
472
  var t = new Uint8Array(i);
389
473
  return N(t.buffer, t.byteOffset, t.byteLength);
390
474
  }
391
- return S(i);
475
+ return F(i);
392
476
  }
393
477
  function N(i, t, r) {
394
478
  if (t < 0 || i.byteLength < t)
@@ -398,22 +482,22 @@ pt.write = function(e, a, s, l, f, h) {
398
482
  var n;
399
483
  return t === void 0 && r === void 0 ? n = new Uint8Array(i) : r === void 0 ? n = new Uint8Array(i, t) : n = new Uint8Array(i, t, r), Object.setPrototypeOf(n, o.prototype), n;
400
484
  }
401
- function tr(i) {
485
+ function ir(i) {
402
486
  if (o.isBuffer(i)) {
403
- var t = X(i.length) | 0, r = c(t);
487
+ var t = X(i.length) | 0, r = u(t);
404
488
  return r.length === 0 || i.copy(r, 0, 0, t), r;
405
489
  }
406
490
  if (i.length !== void 0)
407
- return typeof i.length != "number" || V(i.length) ? c(0) : S(i);
491
+ return typeof i.length != "number" || V(i.length) ? u(0) : F(i);
408
492
  if (i.type === "Buffer" && Array.isArray(i.data))
409
- return S(i.data);
493
+ return F(i.data);
410
494
  }
411
495
  function X(i) {
412
- if (i >= f)
413
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + f.toString(16) + " bytes");
496
+ if (i >= c)
497
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + c.toString(16) + " bytes");
414
498
  return i | 0;
415
499
  }
416
- function rr(i) {
500
+ function er(i) {
417
501
  return +i != i && (i = 0), o.alloc(+i);
418
502
  }
419
503
  o.isBuffer = function(t) {
@@ -425,12 +509,12 @@ pt.write = function(e, a, s, l, f, h) {
425
509
  );
426
510
  if (t === r)
427
511
  return 0;
428
- for (var n = t.length, p = r.length, u = 0, m = Math.min(n, p); u < m; ++u)
429
- if (t[u] !== r[u]) {
430
- n = t[u], p = r[u];
512
+ for (var n = t.length, s = r.length, f = 0, m = Math.min(n, s); f < m; ++f)
513
+ if (t[f] !== r[f]) {
514
+ n = t[f], s = r[f];
431
515
  break;
432
516
  }
433
- return n < p ? -1 : p < n ? 1 : 0;
517
+ return n < s ? -1 : s < n ? 1 : 0;
434
518
  }, o.isEncoding = function(t) {
435
519
  switch (String(t).toLowerCase()) {
436
520
  case "hex":
@@ -457,22 +541,22 @@ pt.write = function(e, a, s, l, f, h) {
457
541
  if (r === void 0)
458
542
  for (r = 0, n = 0; n < t.length; ++n)
459
543
  r += t[n].length;
460
- var p = o.allocUnsafe(r), u = 0;
544
+ var s = o.allocUnsafe(r), f = 0;
461
545
  for (n = 0; n < t.length; ++n) {
462
546
  var m = t[n];
463
547
  if (U(m, Uint8Array))
464
- u + m.length > p.length ? o.from(m).copy(p, u) : Uint8Array.prototype.set.call(
465
- p,
548
+ f + m.length > s.length ? o.from(m).copy(s, f) : Uint8Array.prototype.set.call(
549
+ s,
466
550
  m,
467
- u
551
+ f
468
552
  );
469
553
  else if (o.isBuffer(m))
470
- m.copy(p, u);
554
+ m.copy(s, f);
471
555
  else
472
556
  throw new TypeError('"list" argument must be an Array of Buffers');
473
- u += m.length;
557
+ f += m.length;
474
558
  }
475
- return p;
559
+ return s;
476
560
  };
477
561
  function ct(i, t) {
478
562
  if (o.isBuffer(i))
@@ -486,7 +570,7 @@ pt.write = function(e, a, s, l, f, h) {
486
570
  var r = i.length, n = arguments.length > 2 && arguments[2] === !0;
487
571
  if (!n && r === 0)
488
572
  return 0;
489
- for (var p = !1; ; )
573
+ for (var s = !1; ; )
490
574
  switch (t) {
491
575
  case "ascii":
492
576
  case "latin1":
@@ -505,35 +589,35 @@ pt.write = function(e, a, s, l, f, h) {
505
589
  case "base64":
506
590
  return wt(i).length;
507
591
  default:
508
- if (p)
592
+ if (s)
509
593
  return n ? -1 : G(i).length;
510
- t = ("" + t).toLowerCase(), p = !0;
594
+ t = ("" + t).toLowerCase(), s = !0;
511
595
  }
512
596
  }
513
597
  o.byteLength = ct;
514
- function ir(i, t, r) {
598
+ function nr(i, t, r) {
515
599
  var n = !1;
516
600
  if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, t >>>= 0, r <= t))
517
601
  return "";
518
602
  for (i || (i = "utf8"); ; )
519
603
  switch (i) {
520
604
  case "hex":
521
- return fr(this, t, r);
605
+ return mr(this, t, r);
522
606
  case "utf8":
523
607
  case "utf-8":
524
608
  return ht(this, t, r);
525
609
  case "ascii":
526
- return cr(this, t, r);
610
+ return fr(this, t, r);
527
611
  case "latin1":
528
612
  case "binary":
529
- return ur(this, t, r);
613
+ return hr(this, t, r);
530
614
  case "base64":
531
- return sr(this, t, r);
615
+ return cr(this, t, r);
532
616
  case "ucs2":
533
617
  case "ucs-2":
534
618
  case "utf16le":
535
619
  case "utf-16le":
536
- return hr(this, t, r);
620
+ return xr(this, t, r);
537
621
  default:
538
622
  if (n)
539
623
  throw new TypeError("Unknown encoding: " + i);
@@ -541,7 +625,7 @@ pt.write = function(e, a, s, l, f, h) {
541
625
  }
542
626
  }
543
627
  o.prototype._isBuffer = !0;
544
- function T(i, t, r) {
628
+ function D(i, t, r) {
545
629
  var n = i[t];
546
630
  i[t] = i[r], i[r] = n;
547
631
  }
@@ -550,25 +634,25 @@ pt.write = function(e, a, s, l, f, h) {
550
634
  if (t % 2 !== 0)
551
635
  throw new RangeError("Buffer size must be a multiple of 16-bits");
552
636
  for (var r = 0; r < t; r += 2)
553
- T(this, r, r + 1);
637
+ D(this, r, r + 1);
554
638
  return this;
555
639
  }, o.prototype.swap32 = function() {
556
640
  var t = this.length;
557
641
  if (t % 4 !== 0)
558
642
  throw new RangeError("Buffer size must be a multiple of 32-bits");
559
643
  for (var r = 0; r < t; r += 4)
560
- T(this, r, r + 3), T(this, r + 1, r + 2);
644
+ D(this, r, r + 3), D(this, r + 1, r + 2);
561
645
  return this;
562
646
  }, o.prototype.swap64 = function() {
563
647
  var t = this.length;
564
648
  if (t % 8 !== 0)
565
649
  throw new RangeError("Buffer size must be a multiple of 64-bits");
566
650
  for (var r = 0; r < t; r += 8)
567
- T(this, r, r + 7), T(this, r + 1, r + 6), T(this, r + 2, r + 5), T(this, r + 3, r + 4);
651
+ D(this, r, r + 7), D(this, r + 1, r + 6), D(this, r + 2, r + 5), D(this, r + 3, r + 4);
568
652
  return this;
569
653
  }, o.prototype.toString = function() {
570
654
  var t = this.length;
571
- return t === 0 ? "" : arguments.length === 0 ? ht(this, 0, t) : ir.apply(this, arguments);
655
+ return t === 0 ? "" : arguments.length === 0 ? ht(this, 0, t) : nr.apply(this, arguments);
572
656
  }, o.prototype.toLocaleString = o.prototype.toString, o.prototype.equals = function(t) {
573
657
  if (!o.isBuffer(t))
574
658
  throw new TypeError("Argument must be a Buffer");
@@ -576,74 +660,74 @@ pt.write = function(e, a, s, l, f, h) {
576
660
  }, o.prototype.inspect = function() {
577
661
  var t = "", r = e.INSPECT_MAX_BYTES;
578
662
  return t = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (t += " ... "), "<Buffer " + t + ">";
579
- }, l && (o.prototype[l] = o.prototype.inspect), o.prototype.compare = function(t, r, n, p, u) {
663
+ }, l && (o.prototype[l] = o.prototype.inspect), o.prototype.compare = function(t, r, n, s, f) {
580
664
  if (U(t, Uint8Array) && (t = o.from(t, t.offset, t.byteLength)), !o.isBuffer(t))
581
665
  throw new TypeError(
582
666
  'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
583
667
  );
584
- if (r === void 0 && (r = 0), n === void 0 && (n = t ? t.length : 0), p === void 0 && (p = 0), u === void 0 && (u = this.length), r < 0 || n > t.length || p < 0 || u > this.length)
668
+ if (r === void 0 && (r = 0), n === void 0 && (n = t ? t.length : 0), s === void 0 && (s = 0), f === void 0 && (f = this.length), r < 0 || n > t.length || s < 0 || f > this.length)
585
669
  throw new RangeError("out of range index");
586
- if (p >= u && r >= n)
670
+ if (s >= f && r >= n)
587
671
  return 0;
588
- if (p >= u)
672
+ if (s >= f)
589
673
  return -1;
590
674
  if (r >= n)
591
675
  return 1;
592
- if (r >>>= 0, n >>>= 0, p >>>= 0, u >>>= 0, this === t)
676
+ if (r >>>= 0, n >>>= 0, s >>>= 0, f >>>= 0, this === t)
593
677
  return 0;
594
- for (var m = u - p, d = n - r, v = Math.min(m, d), b = this.slice(p, u), A = t.slice(r, n), E = 0; E < v; ++E)
595
- if (b[E] !== A[E]) {
596
- m = b[E], d = A[E];
678
+ for (var m = f - s, w = n - r, v = Math.min(m, w), E = this.slice(s, f), S = t.slice(r, n), _ = 0; _ < v; ++_)
679
+ if (E[_] !== S[_]) {
680
+ m = E[_], w = S[_];
597
681
  break;
598
682
  }
599
- return m < d ? -1 : d < m ? 1 : 0;
683
+ return m < w ? -1 : w < m ? 1 : 0;
600
684
  };
601
- function ut(i, t, r, n, p) {
685
+ function ut(i, t, r, n, s) {
602
686
  if (i.length === 0)
603
687
  return -1;
604
- if (typeof r == "string" ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, V(r) && (r = p ? 0 : i.length - 1), r < 0 && (r = i.length + r), r >= i.length) {
605
- if (p)
688
+ if (typeof r == "string" ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, V(r) && (r = s ? 0 : i.length - 1), r < 0 && (r = i.length + r), r >= i.length) {
689
+ if (s)
606
690
  return -1;
607
691
  r = i.length - 1;
608
692
  } else if (r < 0)
609
- if (p)
693
+ if (s)
610
694
  r = 0;
611
695
  else
612
696
  return -1;
613
697
  if (typeof t == "string" && (t = o.from(t, n)), o.isBuffer(t))
614
- return t.length === 0 ? -1 : ft(i, t, r, n, p);
698
+ return t.length === 0 ? -1 : ft(i, t, r, n, s);
615
699
  if (typeof t == "number")
616
- return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? p ? Uint8Array.prototype.indexOf.call(i, t, r) : Uint8Array.prototype.lastIndexOf.call(i, t, r) : ft(i, [t], r, n, p);
700
+ return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? s ? Uint8Array.prototype.indexOf.call(i, t, r) : Uint8Array.prototype.lastIndexOf.call(i, t, r) : ft(i, [t], r, n, s);
617
701
  throw new TypeError("val must be string, number or Buffer");
618
702
  }
619
- function ft(i, t, r, n, p) {
620
- var u = 1, m = i.length, d = t.length;
703
+ function ft(i, t, r, n, s) {
704
+ var f = 1, m = i.length, w = t.length;
621
705
  if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
622
706
  if (i.length < 2 || t.length < 2)
623
707
  return -1;
624
- u = 2, m /= 2, d /= 2, r /= 2;
708
+ f = 2, m /= 2, w /= 2, r /= 2;
625
709
  }
626
710
  function v(yt, vt) {
627
- return u === 1 ? yt[vt] : yt.readUInt16BE(vt * u);
711
+ return f === 1 ? yt[vt] : yt.readUInt16BE(vt * f);
628
712
  }
629
- var b;
630
- if (p) {
631
- var A = -1;
632
- for (b = r; b < m; b++)
633
- if (v(i, b) === v(t, A === -1 ? 0 : b - A)) {
634
- if (A === -1 && (A = b), b - A + 1 === d)
635
- return A * u;
713
+ var E;
714
+ if (s) {
715
+ var S = -1;
716
+ for (E = r; E < m; E++)
717
+ if (v(i, E) === v(t, S === -1 ? 0 : E - S)) {
718
+ if (S === -1 && (S = E), E - S + 1 === w)
719
+ return S * f;
636
720
  } else
637
- A !== -1 && (b -= b - A), A = -1;
721
+ S !== -1 && (E -= E - S), S = -1;
638
722
  } else
639
- for (r + d > m && (r = m - d), b = r; b >= 0; b--) {
640
- for (var E = !0, z = 0; z < d; z++)
641
- if (v(i, b + z) !== v(t, z)) {
642
- E = !1;
723
+ for (r + w > m && (r = m - w), E = r; E >= 0; E--) {
724
+ for (var _ = !0, $ = 0; $ < w; $++)
725
+ if (v(i, E + $) !== v(t, $)) {
726
+ _ = !1;
643
727
  break;
644
728
  }
645
- if (E)
646
- return b;
729
+ if (_)
730
+ return E;
647
731
  }
648
732
  return -1;
649
733
  }
@@ -654,69 +738,69 @@ pt.write = function(e, a, s, l, f, h) {
654
738
  }, o.prototype.lastIndexOf = function(t, r, n) {
655
739
  return ut(this, t, r, n, !1);
656
740
  };
657
- function er(i, t, r, n) {
741
+ function ar(i, t, r, n) {
658
742
  r = Number(r) || 0;
659
- var p = i.length - r;
660
- n ? (n = Number(n), n > p && (n = p)) : n = p;
661
- var u = t.length;
662
- n > u / 2 && (n = u / 2);
743
+ var s = i.length - r;
744
+ n ? (n = Number(n), n > s && (n = s)) : n = s;
745
+ var f = t.length;
746
+ n > f / 2 && (n = f / 2);
663
747
  for (var m = 0; m < n; ++m) {
664
- var d = parseInt(t.substr(m * 2, 2), 16);
665
- if (V(d))
748
+ var w = parseInt(t.substr(m * 2, 2), 16);
749
+ if (V(w))
666
750
  return m;
667
- i[r + m] = d;
751
+ i[r + m] = w;
668
752
  }
669
753
  return m;
670
754
  }
671
- function nr(i, t, r, n) {
672
- return L(G(t, i.length - r), i, r, n);
673
- }
674
- function ar(i, t, r, n) {
675
- return L(gr(t), i, r, n);
676
- }
677
755
  function or(i, t, r, n) {
678
- return L(wt(t), i, r, n);
756
+ return q(G(t, i.length - r), i, r, n);
679
757
  }
680
758
  function pr(i, t, r, n) {
681
- return L(dr(t, i.length - r), i, r, n);
759
+ return q(wr(t), i, r, n);
760
+ }
761
+ function sr(i, t, r, n) {
762
+ return q(wt(t), i, r, n);
763
+ }
764
+ function lr(i, t, r, n) {
765
+ return q(yr(t, i.length - r), i, r, n);
682
766
  }
683
- o.prototype.write = function(t, r, n, p) {
767
+ o.prototype.write = function(t, r, n, s) {
684
768
  if (r === void 0)
685
- p = "utf8", n = this.length, r = 0;
769
+ s = "utf8", n = this.length, r = 0;
686
770
  else if (n === void 0 && typeof r == "string")
687
- p = r, n = this.length, r = 0;
771
+ s = r, n = this.length, r = 0;
688
772
  else if (isFinite(r))
689
- r = r >>> 0, isFinite(n) ? (n = n >>> 0, p === void 0 && (p = "utf8")) : (p = n, n = void 0);
773
+ r = r >>> 0, isFinite(n) ? (n = n >>> 0, s === void 0 && (s = "utf8")) : (s = n, n = void 0);
690
774
  else
691
775
  throw new Error(
692
776
  "Buffer.write(string, encoding, offset[, length]) is no longer supported"
693
777
  );
694
- var u = this.length - r;
695
- if ((n === void 0 || n > u) && (n = u), t.length > 0 && (n < 0 || r < 0) || r > this.length)
778
+ var f = this.length - r;
779
+ if ((n === void 0 || n > f) && (n = f), t.length > 0 && (n < 0 || r < 0) || r > this.length)
696
780
  throw new RangeError("Attempt to write outside buffer bounds");
697
- p || (p = "utf8");
781
+ s || (s = "utf8");
698
782
  for (var m = !1; ; )
699
- switch (p) {
783
+ switch (s) {
700
784
  case "hex":
701
- return er(this, t, r, n);
785
+ return ar(this, t, r, n);
702
786
  case "utf8":
703
787
  case "utf-8":
704
- return nr(this, t, r, n);
788
+ return or(this, t, r, n);
705
789
  case "ascii":
706
790
  case "latin1":
707
791
  case "binary":
708
- return ar(this, t, r, n);
792
+ return pr(this, t, r, n);
709
793
  case "base64":
710
- return or(this, t, r, n);
794
+ return sr(this, t, r, n);
711
795
  case "ucs2":
712
796
  case "ucs-2":
713
797
  case "utf16le":
714
798
  case "utf-16le":
715
- return pr(this, t, r, n);
799
+ return lr(this, t, r, n);
716
800
  default:
717
801
  if (m)
718
- throw new TypeError("Unknown encoding: " + p);
719
- p = ("" + p).toLowerCase(), m = !0;
802
+ throw new TypeError("Unknown encoding: " + s);
803
+ s = ("" + s).toLowerCase(), m = !0;
720
804
  }
721
805
  }, o.prototype.toJSON = function() {
722
806
  return {
@@ -724,35 +808,35 @@ pt.write = function(e, a, s, l, f, h) {
724
808
  data: Array.prototype.slice.call(this._arr || this, 0)
725
809
  };
726
810
  };
727
- function sr(i, t, r) {
811
+ function cr(i, t, r) {
728
812
  return t === 0 && r === i.length ? a.fromByteArray(i) : a.fromByteArray(i.slice(t, r));
729
813
  }
730
814
  function ht(i, t, r) {
731
815
  r = Math.min(i.length, r);
732
- for (var n = [], p = t; p < r; ) {
733
- var u = i[p], m = null, d = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1;
734
- if (p + d <= r) {
735
- var v, b, A, E;
736
- switch (d) {
816
+ for (var n = [], s = t; s < r; ) {
817
+ var f = i[s], m = null, w = f > 239 ? 4 : f > 223 ? 3 : f > 191 ? 2 : 1;
818
+ if (s + w <= r) {
819
+ var v, E, S, _;
820
+ switch (w) {
737
821
  case 1:
738
- u < 128 && (m = u);
822
+ f < 128 && (m = f);
739
823
  break;
740
824
  case 2:
741
- v = i[p + 1], (v & 192) === 128 && (E = (u & 31) << 6 | v & 63, E > 127 && (m = E));
825
+ v = i[s + 1], (v & 192) === 128 && (_ = (f & 31) << 6 | v & 63, _ > 127 && (m = _));
742
826
  break;
743
827
  case 3:
744
- v = i[p + 1], b = i[p + 2], (v & 192) === 128 && (b & 192) === 128 && (E = (u & 15) << 12 | (v & 63) << 6 | b & 63, E > 2047 && (E < 55296 || E > 57343) && (m = E));
828
+ v = i[s + 1], E = i[s + 2], (v & 192) === 128 && (E & 192) === 128 && (_ = (f & 15) << 12 | (v & 63) << 6 | E & 63, _ > 2047 && (_ < 55296 || _ > 57343) && (m = _));
745
829
  break;
746
830
  case 4:
747
- v = i[p + 1], b = i[p + 2], A = i[p + 3], (v & 192) === 128 && (b & 192) === 128 && (A & 192) === 128 && (E = (u & 15) << 18 | (v & 63) << 12 | (b & 63) << 6 | A & 63, E > 65535 && E < 1114112 && (m = E));
831
+ v = i[s + 1], E = i[s + 2], S = i[s + 3], (v & 192) === 128 && (E & 192) === 128 && (S & 192) === 128 && (_ = (f & 15) << 18 | (v & 63) << 12 | (E & 63) << 6 | S & 63, _ > 65535 && _ < 1114112 && (m = _));
748
832
  }
749
833
  }
750
- m === null ? (m = 65533, d = 1) : m > 65535 && (m -= 65536, n.push(m >>> 10 & 1023 | 55296), m = 56320 | m & 1023), n.push(m), p += d;
834
+ m === null ? (m = 65533, w = 1) : m > 65535 && (m -= 65536, n.push(m >>> 10 & 1023 | 55296), m = 56320 | m & 1023), n.push(m), s += w;
751
835
  }
752
- return lr(n);
836
+ return ur(n);
753
837
  }
754
838
  var mt = 4096;
755
- function lr(i) {
839
+ function ur(i) {
756
840
  var t = i.length;
757
841
  if (t <= mt)
758
842
  return String.fromCharCode.apply(String, i);
@@ -763,122 +847,122 @@ pt.write = function(e, a, s, l, f, h) {
763
847
  );
764
848
  return r;
765
849
  }
766
- function cr(i, t, r) {
850
+ function fr(i, t, r) {
767
851
  var n = "";
768
852
  r = Math.min(i.length, r);
769
- for (var p = t; p < r; ++p)
770
- n += String.fromCharCode(i[p] & 127);
853
+ for (var s = t; s < r; ++s)
854
+ n += String.fromCharCode(i[s] & 127);
771
855
  return n;
772
856
  }
773
- function ur(i, t, r) {
857
+ function hr(i, t, r) {
774
858
  var n = "";
775
859
  r = Math.min(i.length, r);
776
- for (var p = t; p < r; ++p)
777
- n += String.fromCharCode(i[p]);
860
+ for (var s = t; s < r; ++s)
861
+ n += String.fromCharCode(i[s]);
778
862
  return n;
779
863
  }
780
- function fr(i, t, r) {
864
+ function mr(i, t, r) {
781
865
  var n = i.length;
782
866
  (!t || t < 0) && (t = 0), (!r || r < 0 || r > n) && (r = n);
783
- for (var p = "", u = t; u < r; ++u)
784
- p += wr[i[u]];
785
- return p;
867
+ for (var s = "", f = t; f < r; ++f)
868
+ s += vr[i[f]];
869
+ return s;
786
870
  }
787
- function hr(i, t, r) {
788
- for (var n = i.slice(t, r), p = "", u = 0; u < n.length - 1; u += 2)
789
- p += String.fromCharCode(n[u] + n[u + 1] * 256);
790
- return p;
871
+ function xr(i, t, r) {
872
+ for (var n = i.slice(t, r), s = "", f = 0; f < n.length - 1; f += 2)
873
+ s += String.fromCharCode(n[f] + n[f + 1] * 256);
874
+ return s;
791
875
  }
792
876
  o.prototype.slice = function(t, r) {
793
877
  var n = this.length;
794
878
  t = ~~t, r = r === void 0 ? n : ~~r, t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), r < 0 ? (r += n, r < 0 && (r = 0)) : r > n && (r = n), r < t && (r = t);
795
- var p = this.subarray(t, r);
796
- return Object.setPrototypeOf(p, o.prototype), p;
879
+ var s = this.subarray(t, r);
880
+ return Object.setPrototypeOf(s, o.prototype), s;
797
881
  };
798
- function F(i, t, r) {
882
+ function A(i, t, r) {
799
883
  if (i % 1 !== 0 || i < 0)
800
884
  throw new RangeError("offset is not uint");
801
885
  if (i + t > r)
802
886
  throw new RangeError("Trying to access beyond buffer length");
803
887
  }
804
888
  o.prototype.readUintLE = o.prototype.readUIntLE = function(t, r, n) {
805
- t = t >>> 0, r = r >>> 0, n || F(t, r, this.length);
806
- for (var p = this[t], u = 1, m = 0; ++m < r && (u *= 256); )
807
- p += this[t + m] * u;
808
- return p;
889
+ t = t >>> 0, r = r >>> 0, n || A(t, r, this.length);
890
+ for (var s = this[t], f = 1, m = 0; ++m < r && (f *= 256); )
891
+ s += this[t + m] * f;
892
+ return s;
809
893
  }, o.prototype.readUintBE = o.prototype.readUIntBE = function(t, r, n) {
810
- t = t >>> 0, r = r >>> 0, n || F(t, r, this.length);
811
- for (var p = this[t + --r], u = 1; r > 0 && (u *= 256); )
812
- p += this[t + --r] * u;
813
- return p;
894
+ t = t >>> 0, r = r >>> 0, n || A(t, r, this.length);
895
+ for (var s = this[t + --r], f = 1; r > 0 && (f *= 256); )
896
+ s += this[t + --r] * f;
897
+ return s;
814
898
  }, o.prototype.readUint8 = o.prototype.readUInt8 = function(t, r) {
815
- return t = t >>> 0, r || F(t, 1, this.length), this[t];
899
+ return t = t >>> 0, r || A(t, 1, this.length), this[t];
816
900
  }, o.prototype.readUint16LE = o.prototype.readUInt16LE = function(t, r) {
817
- return t = t >>> 0, r || F(t, 2, this.length), this[t] | this[t + 1] << 8;
901
+ return t = t >>> 0, r || A(t, 2, this.length), this[t] | this[t + 1] << 8;
818
902
  }, o.prototype.readUint16BE = o.prototype.readUInt16BE = function(t, r) {
819
- return t = t >>> 0, r || F(t, 2, this.length), this[t] << 8 | this[t + 1];
903
+ return t = t >>> 0, r || A(t, 2, this.length), this[t] << 8 | this[t + 1];
820
904
  }, o.prototype.readUint32LE = o.prototype.readUInt32LE = function(t, r) {
821
- return t = t >>> 0, r || F(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
905
+ return t = t >>> 0, r || A(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
822
906
  }, o.prototype.readUint32BE = o.prototype.readUInt32BE = function(t, r) {
823
- return t = t >>> 0, r || F(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
907
+ return t = t >>> 0, r || A(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
824
908
  }, o.prototype.readIntLE = function(t, r, n) {
825
- t = t >>> 0, r = r >>> 0, n || F(t, r, this.length);
826
- for (var p = this[t], u = 1, m = 0; ++m < r && (u *= 256); )
827
- p += this[t + m] * u;
828
- return u *= 128, p >= u && (p -= Math.pow(2, 8 * r)), p;
909
+ t = t >>> 0, r = r >>> 0, n || A(t, r, this.length);
910
+ for (var s = this[t], f = 1, m = 0; ++m < r && (f *= 256); )
911
+ s += this[t + m] * f;
912
+ return f *= 128, s >= f && (s -= Math.pow(2, 8 * r)), s;
829
913
  }, o.prototype.readIntBE = function(t, r, n) {
830
- t = t >>> 0, r = r >>> 0, n || F(t, r, this.length);
831
- for (var p = r, u = 1, m = this[t + --p]; p > 0 && (u *= 256); )
832
- m += this[t + --p] * u;
833
- return u *= 128, m >= u && (m -= Math.pow(2, 8 * r)), m;
914
+ t = t >>> 0, r = r >>> 0, n || A(t, r, this.length);
915
+ for (var s = r, f = 1, m = this[t + --s]; s > 0 && (f *= 256); )
916
+ m += this[t + --s] * f;
917
+ return f *= 128, m >= f && (m -= Math.pow(2, 8 * r)), m;
834
918
  }, o.prototype.readInt8 = function(t, r) {
835
- return t = t >>> 0, r || F(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
919
+ return t = t >>> 0, r || A(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
836
920
  }, o.prototype.readInt16LE = function(t, r) {
837
- t = t >>> 0, r || F(t, 2, this.length);
921
+ t = t >>> 0, r || A(t, 2, this.length);
838
922
  var n = this[t] | this[t + 1] << 8;
839
923
  return n & 32768 ? n | 4294901760 : n;
840
924
  }, o.prototype.readInt16BE = function(t, r) {
841
- t = t >>> 0, r || F(t, 2, this.length);
925
+ t = t >>> 0, r || A(t, 2, this.length);
842
926
  var n = this[t + 1] | this[t] << 8;
843
927
  return n & 32768 ? n | 4294901760 : n;
844
928
  }, o.prototype.readInt32LE = function(t, r) {
845
- return t = t >>> 0, r || F(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
929
+ return t = t >>> 0, r || A(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
846
930
  }, o.prototype.readInt32BE = function(t, r) {
847
- return t = t >>> 0, r || F(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
931
+ return t = t >>> 0, r || A(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
848
932
  }, o.prototype.readFloatLE = function(t, r) {
849
- return t = t >>> 0, r || F(t, 4, this.length), s.read(this, t, !0, 23, 4);
933
+ return t = t >>> 0, r || A(t, 4, this.length), p.read(this, t, !0, 23, 4);
850
934
  }, o.prototype.readFloatBE = function(t, r) {
851
- return t = t >>> 0, r || F(t, 4, this.length), s.read(this, t, !1, 23, 4);
935
+ return t = t >>> 0, r || A(t, 4, this.length), p.read(this, t, !1, 23, 4);
852
936
  }, o.prototype.readDoubleLE = function(t, r) {
853
- return t = t >>> 0, r || F(t, 8, this.length), s.read(this, t, !0, 52, 8);
937
+ return t = t >>> 0, r || A(t, 8, this.length), p.read(this, t, !0, 52, 8);
854
938
  }, o.prototype.readDoubleBE = function(t, r) {
855
- return t = t >>> 0, r || F(t, 8, this.length), s.read(this, t, !1, 52, 8);
939
+ return t = t >>> 0, r || A(t, 8, this.length), p.read(this, t, !1, 52, 8);
856
940
  };
857
- function B(i, t, r, n, p, u) {
941
+ function B(i, t, r, n, s, f) {
858
942
  if (!o.isBuffer(i))
859
943
  throw new TypeError('"buffer" argument must be a Buffer instance');
860
- if (t > p || t < u)
944
+ if (t > s || t < f)
861
945
  throw new RangeError('"value" argument is out of bounds');
862
946
  if (r + n > i.length)
863
947
  throw new RangeError("Index out of range");
864
948
  }
865
- o.prototype.writeUintLE = o.prototype.writeUIntLE = function(t, r, n, p) {
866
- if (t = +t, r = r >>> 0, n = n >>> 0, !p) {
867
- var u = Math.pow(2, 8 * n) - 1;
868
- B(this, t, r, n, u, 0);
949
+ o.prototype.writeUintLE = o.prototype.writeUIntLE = function(t, r, n, s) {
950
+ if (t = +t, r = r >>> 0, n = n >>> 0, !s) {
951
+ var f = Math.pow(2, 8 * n) - 1;
952
+ B(this, t, r, n, f, 0);
869
953
  }
870
- var m = 1, d = 0;
871
- for (this[r] = t & 255; ++d < n && (m *= 256); )
872
- this[r + d] = t / m & 255;
954
+ var m = 1, w = 0;
955
+ for (this[r] = t & 255; ++w < n && (m *= 256); )
956
+ this[r + w] = t / m & 255;
873
957
  return r + n;
874
- }, o.prototype.writeUintBE = o.prototype.writeUIntBE = function(t, r, n, p) {
875
- if (t = +t, r = r >>> 0, n = n >>> 0, !p) {
876
- var u = Math.pow(2, 8 * n) - 1;
877
- B(this, t, r, n, u, 0);
958
+ }, o.prototype.writeUintBE = o.prototype.writeUIntBE = function(t, r, n, s) {
959
+ if (t = +t, r = r >>> 0, n = n >>> 0, !s) {
960
+ var f = Math.pow(2, 8 * n) - 1;
961
+ B(this, t, r, n, f, 0);
878
962
  }
879
- var m = n - 1, d = 1;
880
- for (this[r + m] = t & 255; --m >= 0 && (d *= 256); )
881
- this[r + m] = t / d & 255;
963
+ var m = n - 1, w = 1;
964
+ for (this[r + m] = t & 255; --m >= 0 && (w *= 256); )
965
+ this[r + m] = t / w & 255;
882
966
  return r + n;
883
967
  }, o.prototype.writeUint8 = o.prototype.writeUInt8 = function(t, r, n) {
884
968
  return t = +t, r = r >>> 0, n || B(this, t, r, 1, 255, 0), this[r] = t & 255, r + 1;
@@ -890,23 +974,23 @@ pt.write = function(e, a, s, l, f, h) {
890
974
  return t = +t, r = r >>> 0, n || B(this, t, r, 4, 4294967295, 0), this[r + 3] = t >>> 24, this[r + 2] = t >>> 16, this[r + 1] = t >>> 8, this[r] = t & 255, r + 4;
891
975
  }, o.prototype.writeUint32BE = o.prototype.writeUInt32BE = function(t, r, n) {
892
976
  return t = +t, r = r >>> 0, n || B(this, t, r, 4, 4294967295, 0), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4;
893
- }, o.prototype.writeIntLE = function(t, r, n, p) {
894
- if (t = +t, r = r >>> 0, !p) {
895
- var u = Math.pow(2, 8 * n - 1);
896
- B(this, t, r, n, u - 1, -u);
977
+ }, o.prototype.writeIntLE = function(t, r, n, s) {
978
+ if (t = +t, r = r >>> 0, !s) {
979
+ var f = Math.pow(2, 8 * n - 1);
980
+ B(this, t, r, n, f - 1, -f);
897
981
  }
898
- var m = 0, d = 1, v = 0;
899
- for (this[r] = t & 255; ++m < n && (d *= 256); )
900
- t < 0 && v === 0 && this[r + m - 1] !== 0 && (v = 1), this[r + m] = (t / d >> 0) - v & 255;
982
+ var m = 0, w = 1, v = 0;
983
+ for (this[r] = t & 255; ++m < n && (w *= 256); )
984
+ t < 0 && v === 0 && this[r + m - 1] !== 0 && (v = 1), this[r + m] = (t / w >> 0) - v & 255;
901
985
  return r + n;
902
- }, o.prototype.writeIntBE = function(t, r, n, p) {
903
- if (t = +t, r = r >>> 0, !p) {
904
- var u = Math.pow(2, 8 * n - 1);
905
- B(this, t, r, n, u - 1, -u);
986
+ }, o.prototype.writeIntBE = function(t, r, n, s) {
987
+ if (t = +t, r = r >>> 0, !s) {
988
+ var f = Math.pow(2, 8 * n - 1);
989
+ B(this, t, r, n, f - 1, -f);
906
990
  }
907
- var m = n - 1, d = 1, v = 0;
908
- for (this[r + m] = t & 255; --m >= 0 && (d *= 256); )
909
- t < 0 && v === 0 && this[r + m + 1] !== 0 && (v = 1), this[r + m] = (t / d >> 0) - v & 255;
991
+ var m = n - 1, w = 1, v = 0;
992
+ for (this[r + m] = t & 255; --m >= 0 && (w *= 256); )
993
+ t < 0 && v === 0 && this[r + m + 1] !== 0 && (v = 1), this[r + m] = (t / w >> 0) - v & 255;
910
994
  return r + n;
911
995
  }, o.prototype.writeInt8 = function(t, r, n) {
912
996
  return t = +t, r = r >>> 0, n || B(this, t, r, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[r] = t & 255, r + 1;
@@ -919,54 +1003,54 @@ pt.write = function(e, a, s, l, f, h) {
919
1003
  }, o.prototype.writeInt32BE = function(t, r, n) {
920
1004
  return t = +t, r = r >>> 0, n || B(this, t, r, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4;
921
1005
  };
922
- function xt(i, t, r, n, p, u) {
1006
+ function xt(i, t, r, n, s, f) {
923
1007
  if (r + n > i.length)
924
1008
  throw new RangeError("Index out of range");
925
1009
  if (r < 0)
926
1010
  throw new RangeError("Index out of range");
927
1011
  }
928
- function gt(i, t, r, n, p) {
929
- return t = +t, r = r >>> 0, p || xt(i, t, r, 4), s.write(i, t, r, n, 23, 4), r + 4;
1012
+ function gt(i, t, r, n, s) {
1013
+ return t = +t, r = r >>> 0, s || xt(i, t, r, 4), p.write(i, t, r, n, 23, 4), r + 4;
930
1014
  }
931
1015
  o.prototype.writeFloatLE = function(t, r, n) {
932
1016
  return gt(this, t, r, !0, n);
933
1017
  }, o.prototype.writeFloatBE = function(t, r, n) {
934
1018
  return gt(this, t, r, !1, n);
935
1019
  };
936
- function dt(i, t, r, n, p) {
937
- return t = +t, r = r >>> 0, p || xt(i, t, r, 8), s.write(i, t, r, n, 52, 8), r + 8;
1020
+ function dt(i, t, r, n, s) {
1021
+ return t = +t, r = r >>> 0, s || xt(i, t, r, 8), p.write(i, t, r, n, 52, 8), r + 8;
938
1022
  }
939
1023
  o.prototype.writeDoubleLE = function(t, r, n) {
940
1024
  return dt(this, t, r, !0, n);
941
1025
  }, o.prototype.writeDoubleBE = function(t, r, n) {
942
1026
  return dt(this, t, r, !1, n);
943
- }, o.prototype.copy = function(t, r, n, p) {
1027
+ }, o.prototype.copy = function(t, r, n, s) {
944
1028
  if (!o.isBuffer(t))
945
1029
  throw new TypeError("argument should be a Buffer");
946
- if (n || (n = 0), !p && p !== 0 && (p = this.length), r >= t.length && (r = t.length), r || (r = 0), p > 0 && p < n && (p = n), p === n || t.length === 0 || this.length === 0)
1030
+ if (n || (n = 0), !s && s !== 0 && (s = this.length), r >= t.length && (r = t.length), r || (r = 0), s > 0 && s < n && (s = n), s === n || t.length === 0 || this.length === 0)
947
1031
  return 0;
948
1032
  if (r < 0)
949
1033
  throw new RangeError("targetStart out of bounds");
950
1034
  if (n < 0 || n >= this.length)
951
1035
  throw new RangeError("Index out of range");
952
- if (p < 0)
1036
+ if (s < 0)
953
1037
  throw new RangeError("sourceEnd out of bounds");
954
- p > this.length && (p = this.length), t.length - r < p - n && (p = t.length - r + n);
955
- var u = p - n;
956
- return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(r, n, p) : Uint8Array.prototype.set.call(
1038
+ s > this.length && (s = this.length), t.length - r < s - n && (s = t.length - r + n);
1039
+ var f = s - n;
1040
+ return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(r, n, s) : Uint8Array.prototype.set.call(
957
1041
  t,
958
- this.subarray(n, p),
1042
+ this.subarray(n, s),
959
1043
  r
960
- ), u;
961
- }, o.prototype.fill = function(t, r, n, p) {
1044
+ ), f;
1045
+ }, o.prototype.fill = function(t, r, n, s) {
962
1046
  if (typeof t == "string") {
963
- if (typeof r == "string" ? (p = r, r = 0, n = this.length) : typeof n == "string" && (p = n, n = this.length), p !== void 0 && typeof p != "string")
1047
+ if (typeof r == "string" ? (s = r, r = 0, n = this.length) : typeof n == "string" && (s = n, n = this.length), s !== void 0 && typeof s != "string")
964
1048
  throw new TypeError("encoding must be a string");
965
- if (typeof p == "string" && !o.isEncoding(p))
966
- throw new TypeError("Unknown encoding: " + p);
1049
+ if (typeof s == "string" && !o.isEncoding(s))
1050
+ throw new TypeError("Unknown encoding: " + s);
967
1051
  if (t.length === 1) {
968
- var u = t.charCodeAt(0);
969
- (p === "utf8" && u < 128 || p === "latin1") && (t = u);
1052
+ var f = t.charCodeAt(0);
1053
+ (s === "utf8" && f < 128 || s === "latin1") && (t = f);
970
1054
  }
971
1055
  } else
972
1056
  typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
@@ -980,17 +1064,17 @@ pt.write = function(e, a, s, l, f, h) {
980
1064
  for (m = r; m < n; ++m)
981
1065
  this[m] = t;
982
1066
  else {
983
- var d = o.isBuffer(t) ? t : o.from(t, p), v = d.length;
1067
+ var w = o.isBuffer(t) ? t : o.from(t, s), v = w.length;
984
1068
  if (v === 0)
985
1069
  throw new TypeError('The value "' + t + '" is invalid for argument "value"');
986
1070
  for (m = 0; m < n - r; ++m)
987
- this[m + r] = d[m % v];
1071
+ this[m + r] = w[m % v];
988
1072
  }
989
1073
  return this;
990
1074
  };
991
- var mr = /[^+/0-9A-Za-z-_]/g;
992
- function xr(i) {
993
- if (i = i.split("=")[0], i = i.trim().replace(mr, ""), i.length < 2)
1075
+ var gr = /[^+/0-9A-Za-z-_]/g;
1076
+ function dr(i) {
1077
+ if (i = i.split("=")[0], i = i.trim().replace(gr, ""), i.length < 2)
994
1078
  return "";
995
1079
  for (; i.length % 4 !== 0; )
996
1080
  i = i + "=";
@@ -998,41 +1082,41 @@ pt.write = function(e, a, s, l, f, h) {
998
1082
  }
999
1083
  function G(i, t) {
1000
1084
  t = t || 1 / 0;
1001
- for (var r, n = i.length, p = null, u = [], m = 0; m < n; ++m) {
1085
+ for (var r, n = i.length, s = null, f = [], m = 0; m < n; ++m) {
1002
1086
  if (r = i.charCodeAt(m), r > 55295 && r < 57344) {
1003
- if (!p) {
1087
+ if (!s) {
1004
1088
  if (r > 56319) {
1005
- (t -= 3) > -1 && u.push(239, 191, 189);
1089
+ (t -= 3) > -1 && f.push(239, 191, 189);
1006
1090
  continue;
1007
1091
  } else if (m + 1 === n) {
1008
- (t -= 3) > -1 && u.push(239, 191, 189);
1092
+ (t -= 3) > -1 && f.push(239, 191, 189);
1009
1093
  continue;
1010
1094
  }
1011
- p = r;
1095
+ s = r;
1012
1096
  continue;
1013
1097
  }
1014
1098
  if (r < 56320) {
1015
- (t -= 3) > -1 && u.push(239, 191, 189), p = r;
1099
+ (t -= 3) > -1 && f.push(239, 191, 189), s = r;
1016
1100
  continue;
1017
1101
  }
1018
- r = (p - 55296 << 10 | r - 56320) + 65536;
1102
+ r = (s - 55296 << 10 | r - 56320) + 65536;
1019
1103
  } else
1020
- p && (t -= 3) > -1 && u.push(239, 191, 189);
1021
- if (p = null, r < 128) {
1104
+ s && (t -= 3) > -1 && f.push(239, 191, 189);
1105
+ if (s = null, r < 128) {
1022
1106
  if ((t -= 1) < 0)
1023
1107
  break;
1024
- u.push(r);
1108
+ f.push(r);
1025
1109
  } else if (r < 2048) {
1026
1110
  if ((t -= 2) < 0)
1027
1111
  break;
1028
- u.push(
1112
+ f.push(
1029
1113
  r >> 6 | 192,
1030
1114
  r & 63 | 128
1031
1115
  );
1032
1116
  } else if (r < 65536) {
1033
1117
  if ((t -= 3) < 0)
1034
1118
  break;
1035
- u.push(
1119
+ f.push(
1036
1120
  r >> 12 | 224,
1037
1121
  r >> 6 & 63 | 128,
1038
1122
  r & 63 | 128
@@ -1040,7 +1124,7 @@ pt.write = function(e, a, s, l, f, h) {
1040
1124
  } else if (r < 1114112) {
1041
1125
  if ((t -= 4) < 0)
1042
1126
  break;
1043
- u.push(
1127
+ f.push(
1044
1128
  r >> 18 | 240,
1045
1129
  r >> 12 & 63 | 128,
1046
1130
  r >> 6 & 63 | 128,
@@ -1049,25 +1133,25 @@ pt.write = function(e, a, s, l, f, h) {
1049
1133
  } else
1050
1134
  throw new Error("Invalid code point");
1051
1135
  }
1052
- return u;
1136
+ return f;
1053
1137
  }
1054
- function gr(i) {
1138
+ function wr(i) {
1055
1139
  for (var t = [], r = 0; r < i.length; ++r)
1056
1140
  t.push(i.charCodeAt(r) & 255);
1057
1141
  return t;
1058
1142
  }
1059
- function dr(i, t) {
1060
- for (var r, n, p, u = [], m = 0; m < i.length && !((t -= 2) < 0); ++m)
1061
- r = i.charCodeAt(m), n = r >> 8, p = r % 256, u.push(p), u.push(n);
1062
- return u;
1143
+ function yr(i, t) {
1144
+ for (var r, n, s, f = [], m = 0; m < i.length && !((t -= 2) < 0); ++m)
1145
+ r = i.charCodeAt(m), n = r >> 8, s = r % 256, f.push(s), f.push(n);
1146
+ return f;
1063
1147
  }
1064
1148
  function wt(i) {
1065
- return a.toByteArray(xr(i));
1149
+ return a.toByteArray(dr(i));
1066
1150
  }
1067
- function L(i, t, r, n) {
1068
- for (var p = 0; p < n && !(p + r >= t.length || p >= i.length); ++p)
1069
- t[p + r] = i[p];
1070
- return p;
1151
+ function q(i, t, r, n) {
1152
+ for (var s = 0; s < n && !(s + r >= t.length || s >= i.length); ++s)
1153
+ t[s + r] = i[s];
1154
+ return s;
1071
1155
  }
1072
1156
  function U(i, t) {
1073
1157
  return i instanceof t || i != null && i.constructor != null && i.constructor.name != null && i.constructor.name === t.name;
@@ -1075,408 +1159,312 @@ pt.write = function(e, a, s, l, f, h) {
1075
1159
  function V(i) {
1076
1160
  return i !== i;
1077
1161
  }
1078
- var wr = function() {
1162
+ var vr = function() {
1079
1163
  for (var i = "0123456789abcdef", t = new Array(256), r = 0; r < 16; ++r)
1080
- for (var n = r * 16, p = 0; p < 16; ++p)
1081
- t[n + p] = i[r] + i[p];
1164
+ for (var n = r * 16, s = 0; s < 16; ++s)
1165
+ t[n + s] = i[r] + i[s];
1082
1166
  return t;
1083
1167
  }();
1084
- })(zt);
1168
+ })(qt);
1085
1169
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
1086
1170
  (function(e, a) {
1087
- var s = zt, l = s.Buffer;
1088
- function f(c, o) {
1089
- for (var x in c)
1090
- o[x] = c[x];
1171
+ var p = qt, l = p.Buffer;
1172
+ function c(u, o) {
1173
+ for (var x in u)
1174
+ o[x] = u[x];
1091
1175
  }
1092
- l.from && l.alloc && l.allocUnsafe && l.allocUnsafeSlow ? e.exports = s : (f(s, a), a.Buffer = h);
1093
- function h(c, o, x) {
1094
- return l(c, o, x);
1176
+ l.from && l.alloc && l.allocUnsafe && l.allocUnsafeSlow ? e.exports = p : (c(p, a), a.Buffer = h);
1177
+ function h(u, o, x) {
1178
+ return l(u, o, x);
1095
1179
  }
1096
- h.prototype = Object.create(l.prototype), f(l, h), h.from = function(c, o, x) {
1097
- if (typeof c == "number")
1180
+ h.prototype = Object.create(l.prototype), c(l, h), h.from = function(u, o, x) {
1181
+ if (typeof u == "number")
1098
1182
  throw new TypeError("Argument must not be a number");
1099
- return l(c, o, x);
1100
- }, h.alloc = function(c, o, x) {
1101
- if (typeof c != "number")
1183
+ return l(u, o, x);
1184
+ }, h.alloc = function(u, o, x) {
1185
+ if (typeof u != "number")
1102
1186
  throw new TypeError("Argument must be a number");
1103
- var w = l(c);
1104
- return o !== void 0 ? typeof x == "string" ? w.fill(o, x) : w.fill(o) : w.fill(0), w;
1105
- }, h.allocUnsafe = function(c) {
1106
- if (typeof c != "number")
1187
+ var d = l(u);
1188
+ return o !== void 0 ? typeof x == "string" ? d.fill(o, x) : d.fill(o) : d.fill(0), d;
1189
+ }, h.allocUnsafe = function(u) {
1190
+ if (typeof u != "number")
1107
1191
  throw new TypeError("Argument must be a number");
1108
- return l(c);
1109
- }, h.allocUnsafeSlow = function(c) {
1110
- if (typeof c != "number")
1192
+ return l(u);
1193
+ }, h.allocUnsafeSlow = function(u) {
1194
+ if (typeof u != "number")
1111
1195
  throw new TypeError("Argument must be a number");
1112
- return s.SlowBuffer(c);
1196
+ return p.SlowBuffer(u);
1113
1197
  };
1114
1198
  })(rt, rt.exports);
1115
- var $t = rt.exports, Jt = $t.Buffer;
1116
- function H(e, a) {
1117
- this._block = Jt.alloc(e), this._finalSize = a, this._blockSize = e, this._len = 0;
1199
+ var Jt = rt.exports, Pt = Jt.Buffer;
1200
+ function Y(e, a) {
1201
+ this._block = Pt.alloc(e), this._finalSize = a, this._blockSize = e, this._len = 0;
1118
1202
  }
1119
- H.prototype.update = function(e, a) {
1120
- typeof e == "string" && (a = a || "utf8", e = Jt.from(e, a));
1121
- for (var s = this._block, l = this._blockSize, f = e.length, h = this._len, c = 0; c < f; ) {
1122
- for (var o = h % l, x = Math.min(f - c, l - o), w = 0; w < x; w++)
1123
- s[o + w] = e[c + w];
1124
- h += x, c += x, h % l === 0 && this._update(s);
1125
- }
1126
- return this._len += f, this;
1203
+ Y.prototype.update = function(e, a) {
1204
+ typeof e == "string" && (a = a || "utf8", e = Pt.from(e, a));
1205
+ for (var p = this._block, l = this._blockSize, c = e.length, h = this._len, u = 0; u < c; ) {
1206
+ for (var o = h % l, x = Math.min(c - u, l - o), d = 0; d < x; d++)
1207
+ p[o + d] = e[u + d];
1208
+ h += x, u += x, h % l === 0 && this._update(p);
1209
+ }
1210
+ return this._len += c, this;
1127
1211
  };
1128
- H.prototype.digest = function(e) {
1212
+ Y.prototype.digest = function(e) {
1129
1213
  var a = this._len % this._blockSize;
1130
1214
  this._block[a] = 128, this._block.fill(0, a + 1), a >= this._finalSize && (this._update(this._block), this._block.fill(0));
1131
- var s = this._len * 8;
1132
- if (s <= 4294967295)
1133
- this._block.writeUInt32BE(s, this._blockSize - 4);
1215
+ var p = this._len * 8;
1216
+ if (p <= 4294967295)
1217
+ this._block.writeUInt32BE(p, this._blockSize - 4);
1134
1218
  else {
1135
- var l = (s & 4294967295) >>> 0, f = (s - l) / 4294967296;
1136
- this._block.writeUInt32BE(f, this._blockSize - 8), this._block.writeUInt32BE(l, this._blockSize - 4);
1219
+ var l = (p & 4294967295) >>> 0, c = (p - l) / 4294967296;
1220
+ this._block.writeUInt32BE(c, this._blockSize - 8), this._block.writeUInt32BE(l, this._blockSize - 4);
1137
1221
  }
1138
1222
  this._update(this._block);
1139
1223
  var h = this._hash();
1140
1224
  return e ? h.toString(e) : h;
1141
1225
  };
1142
- H.prototype._update = function() {
1226
+ Y.prototype._update = function() {
1143
1227
  throw new Error("_update must be implemented by subclass");
1144
1228
  };
1145
- var Pr = H, Wr = Nr, Pt = Pr, Hr = $t.Buffer, Zr = [
1229
+ var Gr = Y, Vr = $r, Wt = Gr, Qr = Jt.Buffer, ti = [
1146
1230
  1518500249,
1147
1231
  1859775393,
1148
1232
  -1894007588,
1149
1233
  -899497514
1150
- ], Yr = new Array(80);
1151
- function C() {
1152
- this.init(), this._w = Yr, Pt.call(this, 64, 56);
1234
+ ], ri = new Array(80);
1235
+ function L() {
1236
+ this.init(), this._w = ri, Wt.call(this, 64, 56);
1153
1237
  }
1154
- Wr(C, Pt);
1155
- C.prototype.init = function() {
1238
+ Vr(L, Wt);
1239
+ L.prototype.init = function() {
1156
1240
  return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
1157
1241
  };
1158
- function Kr(e) {
1242
+ function ii(e) {
1159
1243
  return e << 1 | e >>> 31;
1160
1244
  }
1161
- function Xr(e) {
1245
+ function ei(e) {
1162
1246
  return e << 5 | e >>> 27;
1163
1247
  }
1164
- function Gr(e) {
1248
+ function ni(e) {
1165
1249
  return e << 30 | e >>> 2;
1166
1250
  }
1167
- function Vr(e, a, s, l) {
1168
- return e === 0 ? a & s | ~a & l : e === 2 ? a & s | a & l | s & l : a ^ s ^ l;
1251
+ function ai(e, a, p, l) {
1252
+ return e === 0 ? a & p | ~a & l : e === 2 ? a & p | a & l | p & l : a ^ p ^ l;
1169
1253
  }
1170
- C.prototype._update = function(e) {
1171
- for (var a = this._w, s = this._a | 0, l = this._b | 0, f = this._c | 0, h = this._d | 0, c = this._e | 0, o = 0; o < 16; ++o)
1254
+ L.prototype._update = function(e) {
1255
+ for (var a = this._w, p = this._a | 0, l = this._b | 0, c = this._c | 0, h = this._d | 0, u = this._e | 0, o = 0; o < 16; ++o)
1172
1256
  a[o] = e.readInt32BE(o * 4);
1173
1257
  for (; o < 80; ++o)
1174
- a[o] = Kr(a[o - 3] ^ a[o - 8] ^ a[o - 14] ^ a[o - 16]);
1258
+ a[o] = ii(a[o - 3] ^ a[o - 8] ^ a[o - 14] ^ a[o - 16]);
1175
1259
  for (var x = 0; x < 80; ++x) {
1176
- var w = ~~(x / 20), y = Xr(s) + Vr(w, l, f, h) + c + a[x] + Zr[w] | 0;
1177
- c = h, h = f, f = Gr(l), l = s, s = y;
1260
+ var d = ~~(x / 20), y = ei(p) + ai(d, l, c, h) + u + a[x] + ti[d] | 0;
1261
+ u = h, h = c, c = ni(l), l = p, p = y;
1178
1262
  }
1179
- this._a = s + this._a | 0, this._b = l + this._b | 0, this._c = f + this._c | 0, this._d = h + this._d | 0, this._e = c + this._e | 0;
1263
+ this._a = p + this._a | 0, this._b = l + this._b | 0, this._c = c + this._c | 0, this._d = h + this._d | 0, this._e = u + this._e | 0;
1180
1264
  };
1181
- C.prototype._hash = function() {
1182
- var e = Hr.allocUnsafe(20);
1265
+ L.prototype._hash = function() {
1266
+ var e = Qr.allocUnsafe(20);
1183
1267
  return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
1184
1268
  };
1185
- var Qr = C;
1186
- const ti = /* @__PURE__ */ Lt(Qr), st = new Error("File system not available.");
1187
- function ri(e, a, s) {
1269
+ var oi = L;
1270
+ const pi = /* @__PURE__ */ zt(oi), st = new Error("File system not available.");
1271
+ function si(e, a, p) {
1188
1272
  throw st;
1189
1273
  }
1190
- function Wt(e) {
1274
+ function Ht(e) {
1191
1275
  throw st;
1192
1276
  }
1193
- function ii(e) {
1277
+ function li(e) {
1194
1278
  throw st;
1195
1279
  }
1196
- const ei = async (e) => Wt();
1197
- function ni(e) {
1280
+ const ci = async (e) => Ht();
1281
+ function ui(e) {
1198
1282
  let a = "";
1199
- for (let s = 0; s < e.length; s += 2)
1200
- a += String.fromCharCode(parseInt(e.substr(s, 2), 16));
1283
+ for (let p = 0; p < e.length; p += 2)
1284
+ a += String.fromCharCode(parseInt(e.substr(p, 2), 16));
1201
1285
  return btoa(a);
1202
1286
  }
1203
- const Z = (e, a = "sha1") => {
1287
+ const K = (e, a = "sha1") => {
1204
1288
  if (a !== "sha1")
1205
1289
  throw new Error("Only sha1 algorithm is available.");
1206
- const s = new ti();
1207
- return ni(s.update(e).digest("hex"));
1208
- }, Ht = async (e) => {
1209
- const a = new At(), { name: s, revision: l, documentType: f, created: h, lastModified: c } = e, o = {
1210
- name: s,
1290
+ const p = new pi();
1291
+ return ui(p.update(e).digest("hex"));
1292
+ }, Zt = async (e) => {
1293
+ const a = new Ft(), { name: p, revision: l, documentType: c, created: h, lastModified: u } = e, o = {
1294
+ name: p,
1211
1295
  revision: l,
1212
- documentType: f,
1296
+ documentType: c,
1213
1297
  created: h,
1214
- lastModified: c
1298
+ lastModified: u
1215
1299
  };
1216
1300
  return a.file("header.json", JSON.stringify(o, null, 2)), a.file(
1217
1301
  "state.json",
1218
1302
  JSON.stringify(e.initialState || {}, null, 2)
1219
- ), a.file("operations.json", JSON.stringify(e.operations, null, 2)), Object.keys(e.attachments).forEach((w) => {
1220
- const { data: y, ..._ } = e.attachments[w];
1221
- a.file(w, y, {
1303
+ ), a.file("operations.json", JSON.stringify(e.operations, null, 2)), Object.keys(e.attachments).forEach((d) => {
1304
+ const { data: y, ...b } = e.attachments[d];
1305
+ a.file(d, y, {
1222
1306
  base64: !0,
1223
1307
  createFolders: !0,
1224
- comment: JSON.stringify(_)
1308
+ comment: JSON.stringify(b)
1225
1309
  });
1226
1310
  }), a;
1227
- }, ai = async (e, a, s, l) => {
1228
- await (await Ht(e)).generateAsync({
1311
+ }, fi = async (e, a, p, l) => {
1312
+ await (await Zt(e)).generateAsync({
1229
1313
  type: "uint8array",
1230
1314
  streamFiles: !0
1231
1315
  });
1232
- const h = l ?? e.name, c = `.${s}.zip`;
1233
- return ri(
1316
+ const h = l ?? e.name, u = `.${p}.zip`;
1317
+ return si(
1234
1318
  a,
1235
- h.endsWith(c) ? h : `${h}${c}`
1319
+ h.endsWith(u) ? h : `${h}${u}`
1236
1320
  );
1237
- }, ji = async (e, a) => {
1238
- const l = await (await Ht(e)).generateAsync({ type: "blob" }), f = await a.createWritable();
1239
- await f.write(l), await f.close();
1321
+ }, Ui = async (e, a) => {
1322
+ const l = await (await Zt(e)).generateAsync({ type: "blob" }), c = await a.createWritable();
1323
+ await c.write(l), await c.close();
1240
1324
  }, Et = async (e, a) => {
1241
- const s = Wt();
1242
- return oi(s, a);
1243
- }, oi = async (e, a) => {
1244
- const s = new At();
1245
- return await s.loadAsync(e), pi(s, a);
1325
+ const p = Ht();
1326
+ return hi(p, a);
1327
+ }, hi = async (e, a) => {
1328
+ const p = new Ft();
1329
+ return await p.loadAsync(e), mi(p, a);
1246
1330
  };
1247
- async function pi(e, a) {
1248
- const s = e.file("state.json");
1249
- if (!s)
1331
+ async function mi(e, a) {
1332
+ const p = e.file("state.json");
1333
+ if (!p)
1250
1334
  throw new Error("Initial state not found");
1251
- const l = await s.async("string"), f = JSON.parse(l), h = e.file("header.json");
1252
- let c = null;
1253
- h && (c = JSON.parse(await h.async("string")));
1335
+ const l = await p.async("string"), c = JSON.parse(l), h = e.file("header.json");
1336
+ let u;
1337
+ h && (u = JSON.parse(await h.async("string")));
1254
1338
  const o = e.file("operations.json");
1255
1339
  if (!o)
1256
1340
  throw new Error("Operations history not found");
1257
1341
  const x = JSON.parse(
1258
1342
  await o.async("string")
1259
- ), w = {
1260
- ...f,
1261
- ...c,
1262
- initialState: f,
1263
- operations: { global: [], local: [] },
1264
- attachments: { ...f.attachments }
1265
- };
1266
- let y = x.global.concat(x.local).slice(0, c == null ? void 0 : c.revision).reduce(
1267
- (_, I) => a(_, I),
1268
- w
1269
1343
  );
1270
- return c && (y = {
1271
- ...y,
1272
- ...c,
1273
- operations: {
1274
- global: [
1275
- ...y.operations.global,
1276
- ...x.global.slice(c.revision)
1277
- ],
1278
- local: y.operations.local
1279
- }
1280
- }), y;
1281
- }
1282
- function Zt(e) {
1283
- const a = e.replace(/^.*\./, "") || void 0, s = e.replace(/^.*[/\\]/, "") || void 0;
1284
- return { extension: a, fileName: s };
1285
- }
1286
- async function Ii(e) {
1287
- const { buffer: a, mimeType: s = "application/octet-stream" } = await ii(), l = Zt(e), f = a.toString("base64");
1288
- return {
1289
- data: f,
1290
- hash: Z(f),
1291
- mimeType: s,
1292
- ...l
1293
- };
1294
- }
1295
- async function Ui(e) {
1296
- const a = await ei(), s = Or.getType(e) || "application/octet-stream", l = Zt(e), f = a.toString("base64");
1297
- return { data: f, hash: Z(f), mimeType: s, ...l };
1298
- }
1299
- function J(e, a, s, l) {
1300
- const f = bi(e), h = yi(s);
1301
- return a.global.concat(a.local).reduce(
1302
- (c, o) => h(c, o, l),
1303
- f
1344
+ let d = Gt(
1345
+ c,
1346
+ x,
1347
+ a,
1348
+ void 0,
1349
+ u
1304
1350
  );
1351
+ return u && (d = {
1352
+ ...d,
1353
+ ...u
1354
+ }), d;
1305
1355
  }
1306
- function si(e, a) {
1307
- return { ...e, name: a };
1356
+ function Yt(e) {
1357
+ const a = e.replace(/^.*\./, "") || void 0, p = e.replace(/^.*[/\\]/, "") || void 0;
1358
+ return { extension: a, fileName: p };
1308
1359
  }
1309
- function li(e, a, s) {
1310
- const l = Math.min(a, e.revision), f = e.operations.global.slice(
1311
- 0,
1312
- e.revision - l
1313
- );
1360
+ async function ki(e) {
1361
+ const { buffer: a, mimeType: p = "application/octet-stream" } = await li(), l = Yt(e), c = a.toString("base64");
1314
1362
  return {
1315
- ...J(
1316
- e.initialState,
1317
- {
1318
- global: f,
1319
- local: e.operations.local
1320
- },
1321
- s
1322
- ),
1323
- operations: e.operations,
1324
- revision: e.revision - l
1325
- };
1326
- }
1327
- function ci(e, a, s) {
1328
- const l = e.operations.global.length - e.revision;
1329
- if (!l)
1330
- throw new Error("There is no UNDO operation to REDO");
1331
- const f = a < l ? a : l, h = e.operations.global.slice(
1332
- 0,
1333
- e.revision + f
1334
- );
1335
- return {
1336
- ...J(
1337
- e.initialState,
1338
- {
1339
- global: h,
1340
- local: e.operations.local
1341
- },
1342
- s
1343
- ),
1344
- operations: e.operations,
1345
- revision: e.revision + f
1363
+ data: c,
1364
+ hash: K(c),
1365
+ mimeType: p,
1366
+ ...l
1346
1367
  };
1347
1368
  }
1348
- function ui(e, a, s, l) {
1349
- a = a || 0, s = s || e.operations.global.length;
1350
- const f = e.operations.global.slice(a, s), h = e.operations.global.slice(0, a), c = e.operations.global.slice(s), o = J(
1351
- e.initialState,
1352
- {
1353
- global: h.concat(f),
1354
- local: e.operations.local
1355
- },
1356
- l
1357
- ), { name: x, state: w } = o;
1358
- return J(
1359
- e.initialState,
1360
- {
1361
- global: [
1362
- ...h,
1363
- lt({ name: x, state: w }, f.length),
1364
- ...c
1365
- ],
1366
- local: e.operations.local
1367
- },
1368
- l
1369
- );
1370
- }
1371
- function fi(e, a) {
1372
- return {
1373
- ...e,
1374
- name: a.name,
1375
- state: a.state ?? { global: {}, local: {} }
1376
- };
1369
+ async function Ti(e) {
1370
+ const a = await ci(), p = qr.getType(e) || "application/octet-stream", l = Yt(e), c = a.toString("base64");
1371
+ return { data: c, hash: K(c), mimeType: p, ...l };
1377
1372
  }
1378
- const Yt = "SET_NAME", Y = "UNDO", K = "REDO", M = "PRUNE", Kt = "LOAD_STATE";
1379
- function hi(e, a) {
1380
- return [Y, K, M].includes(a.type) ? e.revision : e.revision + 1;
1373
+ function xi(e, a) {
1374
+ return [M, C, R].includes(a.type) ? e.revision : e.revision + 1;
1381
1375
  }
1382
- function mi(e, a) {
1376
+ function gi(e, a) {
1383
1377
  return {
1384
1378
  ...e,
1385
- revision: hi(e, a),
1379
+ revision: xi(e, a),
1386
1380
  lastModified: (/* @__PURE__ */ new Date()).toISOString()
1387
1381
  };
1388
1382
  }
1389
- function xi(e, a) {
1390
- if ([Y, K, M, M].includes(a.type))
1383
+ function di(e, a) {
1384
+ if ([M, C, R].includes(a.type))
1391
1385
  return e;
1392
- const s = e.operations.global.slice(
1386
+ const p = e.operations.global.slice(
1393
1387
  0,
1394
1388
  e.revision
1395
- ), l = e.operations.local.slice();
1396
- return !a.scope || a.scope === "global" ? s.push({
1397
- ...a,
1398
- index: s.length,
1399
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1400
- hash: "",
1401
- scope: "global"
1402
- }) : a.scope === "local" && l.push({
1389
+ ), l = a.scope || "global", c = l === "global" ? p : e.operations[l];
1390
+ return c.push({
1403
1391
  ...a,
1404
- index: l.length,
1392
+ index: c.length,
1405
1393
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1406
1394
  hash: "",
1407
- scope: "local"
1395
+ scope: l
1408
1396
  }), {
1409
1397
  ...e,
1410
- operations: {
1411
- global: s,
1412
- local: l
1413
- }
1398
+ operations: { ...e.operations, [l]: c }
1414
1399
  };
1415
1400
  }
1416
- function gi(e, a) {
1417
- let s = xi(e, a);
1418
- return (!a.scope || a.scope === "global") && (s = mi(s, a)), s;
1401
+ function wi(e, a) {
1402
+ let p = di(e, a);
1403
+ return (!a.scope || a.scope === "global") && (p = gi(p, a)), p;
1419
1404
  }
1420
- function di(e, a, s) {
1421
- switch (Tt().parse(a), a.type) {
1422
- case Yt:
1423
- return si(e, a.input);
1424
- case Y:
1425
- return li(e, a.input, s);
1426
- case K:
1427
- return ci(e, a.input, s);
1405
+ function yi(e, a, p) {
1406
+ switch (kt().parse(a), a.type) {
1407
+ case Rt:
1408
+ return Tr(e, a.input);
1428
1409
  case M:
1429
- return ui(
1410
+ return Dr(e, a.input, p);
1411
+ case C:
1412
+ return Or(e, a.input, p);
1413
+ case R:
1414
+ return Nr(
1430
1415
  e,
1431
1416
  a.input.start,
1432
1417
  a.input.end,
1433
- s
1418
+ p
1434
1419
  );
1435
- case Kt:
1436
- return fi(e, a.input.state);
1420
+ case Lt:
1421
+ return Mr(e, a.input.state);
1437
1422
  default:
1438
1423
  return e;
1439
1424
  }
1440
1425
  }
1441
- function wi(e, a, s, l) {
1442
- let f = e;
1443
- return _t(a) && (f = di(f, a, s)), f = gi(f, a), f = bt(f, (h) => {
1444
- const c = s(h.state, a, l);
1445
- if (c)
1446
- return Er({
1447
- ...f,
1448
- state: c
1426
+ function Kt(e, a, p, l) {
1427
+ let c = e;
1428
+ return _t(a) && (c = yi(c, a, p)), c = wi(c, a), c = bt(c, (h) => {
1429
+ const u = p(h.state, a, l);
1430
+ if (u)
1431
+ return Fr({
1432
+ ...c,
1433
+ state: u
1449
1434
  });
1450
- }), bt(f, (h) => {
1451
- !a.scope || a.scope === "global" ? h.operations.global[h.operations.global.length - 1].hash = Ft(h, "global") : a.scope === "local" && (h.operations.local[h.operations.local.length - 1].hash = Ft(h, "local")), !_t(a) && a.attachments && a.attachments.forEach((c) => {
1452
- const { hash: o, ...x } = c;
1453
- h.attachments[o] = {
1454
- ...x
1435
+ }), bt(c, (h) => {
1436
+ if ([M, C, R].includes(a.type))
1437
+ return h;
1438
+ const u = a.scope || "global";
1439
+ h.operations[u][h.operations[u].length - 1].hash = Xt(h, u), !_t(a) && a.attachments && a.attachments.forEach((o) => {
1440
+ const { hash: x, ...d } = o;
1441
+ h.attachments[x] = {
1442
+ ...d
1455
1443
  };
1456
1444
  });
1457
1445
  });
1458
1446
  }
1459
1447
  function _t(e) {
1460
- return [Yt, Y, K, M, Kt].includes(e.type);
1448
+ return [Rt, M, C, R, Lt].includes(e.type);
1461
1449
  }
1462
- function R(e, a, s, l, f = "global") {
1450
+ function z(e, a, p, l, c = "global") {
1463
1451
  if (!e)
1464
1452
  throw new Error("Empty action type");
1465
1453
  if (typeof e != "string")
1466
1454
  throw new Error(`Invalid action type: ${e}`);
1467
- const h = { type: e, input: a, scope: f };
1468
- s && (h.attachments = s);
1455
+ const h = { type: e, input: a, scope: c };
1456
+ p && (h.attachments = p);
1469
1457
  try {
1470
1458
  l == null || l().parse(h.input);
1471
- } catch (c) {
1472
- throw new Error(`Invalid action input: ${c}`);
1459
+ } catch (u) {
1460
+ throw new Error(`Invalid action input: ${u}`);
1473
1461
  }
1474
1462
  return h;
1475
1463
  }
1476
- function yi(e, a = wi) {
1477
- return (s, l, f) => a(s, l, e, f);
1464
+ function vi(e, a = Kt) {
1465
+ return (p, l, c) => a(p, l, e, c);
1478
1466
  }
1479
- const vi = (e, a) => ({
1467
+ const bi = (e, a) => ({
1480
1468
  name: "",
1481
1469
  documentType: "",
1482
1470
  revision: 0,
@@ -1485,61 +1473,99 @@ const vi = (e, a) => ({
1485
1473
  attachments: {},
1486
1474
  ...e,
1487
1475
  state: (a == null ? void 0 : a(e == null ? void 0 : e.state)) ?? (e == null ? void 0 : e.state) ?? { global: {}, local: {} }
1488
- }), bi = (e, a) => {
1489
- const s = vi(
1476
+ }), Ei = (e, a) => {
1477
+ const p = bi(
1490
1478
  e,
1491
1479
  a
1492
1480
  );
1493
1481
  return {
1494
- ...s,
1495
- initialState: s,
1482
+ ...p,
1483
+ initialState: p,
1496
1484
  operations: { global: [], local: [] }
1497
1485
  };
1498
- }, Ft = (e, a = "global") => Z(
1499
- br(
1500
- a === "local" ? e.state.local : e.state.global
1501
- )
1502
- ), ki = (e, a = 1e3) => {
1503
- const s = Math.random() * a;
1504
- return Z(`${(e ?? /* @__PURE__ */ new Date()).toISOString()}${s}`);
1486
+ }, Xt = (e, a = "global") => K(_r(e.state[a])), Di = (e, a = 1e3) => {
1487
+ const p = Math.random() * a;
1488
+ return K(`${(e ?? /* @__PURE__ */ new Date()).toISOString()}${p}`);
1505
1489
  };
1506
- function $(e) {
1507
- return _r(Fr(e, !0));
1490
+ function P(e) {
1491
+ return Ar(Sr(e, !0));
1492
+ }
1493
+ function _i(e) {
1494
+ return Object.values(e).flatMap((a) => a).sort(
1495
+ (a, p) => new Date(a.timestamp).getTime() - new Date(p.timestamp).getTime()
1496
+ );
1508
1497
  }
1509
- const Xt = (e) => R(
1498
+ function W(e, a, p, l, c, h = Kt) {
1499
+ const u = vi(p, h);
1500
+ return Gt(
1501
+ e,
1502
+ a,
1503
+ u,
1504
+ l,
1505
+ c
1506
+ );
1507
+ }
1508
+ function Gt(e, a, p, l, c) {
1509
+ const h = Ei(e), u = {
1510
+ ...a,
1511
+ global: a.global.slice(0, c == null ? void 0 : c.revision)
1512
+ }, o = _i(u).reduce(
1513
+ (d, y) => p(d, y, l),
1514
+ h
1515
+ ), x = Object.keys(
1516
+ o.operations
1517
+ ).reduce(
1518
+ (d, y) => {
1519
+ const b = y, j = b === "global" && c && c.revision < a.global.length ? a.global.slice(c == null ? void 0 : c.revision) : [];
1520
+ return {
1521
+ ...d,
1522
+ [b]: [
1523
+ ...o.operations[b].map((F, T) => ({
1524
+ ...F,
1525
+ timestamp: a[b][T].timestamp
1526
+ })),
1527
+ ...j
1528
+ ]
1529
+ };
1530
+ },
1531
+ { global: [], local: [] }
1532
+ );
1533
+ return { ...o, operations: x };
1534
+ }
1535
+ const Vt = (e) => z(
1510
1536
  "SET_NAME",
1511
1537
  e,
1512
1538
  void 0,
1513
1539
  at
1514
- ), Gt = (e = 1) => R("UNDO", e, void 0, ot), Vt = (e = 1) => R("REDO", e, void 0, nt), Qt = (e, a) => R(
1540
+ ), Qt = (e = 1) => z("UNDO", e, void 0, ot), tr = (e = 1) => z("REDO", e, void 0, nt), rr = (e, a) => z(
1515
1541
  "PRUNE",
1516
1542
  { start: e, end: a },
1517
1543
  void 0,
1518
1544
  et
1519
- ), lt = (e, a) => R(
1545
+ ), lt = (e, a) => z(
1520
1546
  "LOAD_STATE",
1521
1547
  { state: e, operations: a },
1522
1548
  void 0,
1523
1549
  it
1524
- ), Ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1550
+ ), Oi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1525
1551
  __proto__: null,
1526
1552
  loadState: lt,
1527
- prune: Qt,
1528
- redo: Vt,
1529
- setName: Xt,
1530
- undo: Gt
1553
+ prune: rr,
1554
+ redo: tr,
1555
+ setName: Vt,
1556
+ undo: Qt
1531
1557
  }, Symbol.toStringTag, { value: "Module" }));
1532
- class Di {
1558
+ class Ni {
1533
1559
  /**
1534
1560
  * Constructs a BaseDocument instance with an initial state.
1535
1561
  * @param reducer - The reducer function that updates the state.
1536
1562
  * @param document - The initial state of the document.
1537
1563
  */
1538
- constructor(a, s, l) {
1539
- q(this, "_document");
1540
- q(this, "_reducer");
1541
- q(this, "_signalDispatch");
1542
- this._reducer = a, this._document = s, this._signalDispatch = l;
1564
+ constructor(a, p, l) {
1565
+ J(this, "_document");
1566
+ J(this, "_reducer");
1567
+ J(this, "_signalDispatch");
1568
+ this._reducer = a, this._document = p, this._signalDispatch = l;
1543
1569
  }
1544
1570
  /**
1545
1571
  * Dispatches an action to update the state of the document.
@@ -1559,8 +1585,8 @@ class Di {
1559
1585
  * @param extension - The file extension to use when saving the state.
1560
1586
  * @returns The file path where the state was saved.
1561
1587
  */
1562
- saveToFile(a, s, l) {
1563
- return ai(this._document, a, s, l);
1588
+ saveToFile(a, p, l) {
1589
+ return fi(this._document, a, p, l);
1564
1590
  }
1565
1591
  /**
1566
1592
  * Loads the state of the document from a file.
@@ -1575,20 +1601,20 @@ class Di {
1575
1601
  * @param reducer - The reducer function that updates the state.
1576
1602
  * @returns The state of the document.
1577
1603
  */
1578
- static async stateFromFile(a, s) {
1579
- return await Et(a, s);
1604
+ static async stateFromFile(a, p) {
1605
+ return await Et(a, p);
1580
1606
  }
1581
1607
  /**
1582
1608
  * Gets the current state of the document.
1583
1609
  */
1584
1610
  get state() {
1585
- return $(this._document.state);
1611
+ return P(this._document.state);
1586
1612
  }
1587
1613
  /**
1588
1614
  * Gets the list of operations performed on the document.
1589
1615
  */
1590
1616
  get operations() {
1591
- return $(this._document.operations);
1617
+ return P(this._document.operations);
1592
1618
  }
1593
1619
  /**
1594
1620
  * Gets the name of the document.
@@ -1624,13 +1650,13 @@ class Di {
1624
1650
  * Gets the initial state of the document.
1625
1651
  */
1626
1652
  get initialState() {
1627
- return $(this._document.initialState);
1653
+ return P(this._document.initialState);
1628
1654
  }
1629
1655
  /**
1630
1656
  * Returns the current document as an object
1631
1657
  */
1632
1658
  toDocument() {
1633
- return $(this._document);
1659
+ return P(this._document);
1634
1660
  }
1635
1661
  /**
1636
1662
  * Gets the attachment associated with the given key.
@@ -1644,69 +1670,72 @@ class Di {
1644
1670
  * @param name - The new name of the document.
1645
1671
  */
1646
1672
  setName(a) {
1647
- return this.dispatch(Xt(a)), this;
1673
+ return this.dispatch(Vt(a)), this;
1648
1674
  }
1649
1675
  /**
1650
1676
  * Reverts a number of actions from the document.
1651
1677
  * @param count - The number of actions to revert.
1652
1678
  */
1653
1679
  undo(a) {
1654
- return this.dispatch(Gt(a)), this;
1680
+ return this.dispatch(Qt(a)), this;
1655
1681
  }
1656
1682
  /**
1657
1683
  * Reapplies a number of actions to the document.
1658
1684
  * @param count - The number of actions to reapply.
1659
1685
  */
1660
1686
  redo(a) {
1661
- return this.dispatch(Vt(a)), this;
1687
+ return this.dispatch(tr(a)), this;
1662
1688
  }
1663
1689
  /**
1664
1690
  * Removes a range of operations from the document.
1665
1691
  * @param start - The starting index of the range to remove.
1666
1692
  * @param end - The ending index of the range to remove.
1667
1693
  */
1668
- prune(a, s) {
1669
- return this.dispatch(Qt(a, s)), this;
1694
+ prune(a, p) {
1695
+ return this.dispatch(rr(a, p)), this;
1670
1696
  }
1671
1697
  /**
1672
1698
  * Loads a document state and a set of operations.
1673
1699
  * @param state - The state to load.
1674
1700
  * @param operations - The operations to apply to the document.
1675
1701
  */
1676
- loadState(a, s) {
1677
- return this.dispatch(lt(a, s)), this;
1702
+ loadState(a, p) {
1703
+ return this.dispatch(lt(a, p)), this;
1678
1704
  }
1679
1705
  }
1680
- function Oi(e, a) {
1681
- a.forEach((s) => {
1682
- Object.getOwnPropertyNames(s.prototype).forEach((l) => {
1706
+ function Mi(e, a) {
1707
+ a.forEach((p) => {
1708
+ Object.getOwnPropertyNames(p.prototype).forEach((l) => {
1683
1709
  Object.defineProperty(
1684
1710
  e.prototype,
1685
1711
  l,
1686
- Object.getOwnPropertyDescriptor(s.prototype, l) || /* @__PURE__ */ Object.create(null)
1712
+ Object.getOwnPropertyDescriptor(p.prototype, l) || /* @__PURE__ */ Object.create(null)
1687
1713
  );
1688
1714
  });
1689
1715
  });
1690
1716
  }
1691
1717
  export {
1692
- Di as B,
1693
- vi as a,
1694
- bi as b,
1695
- yi as c,
1696
- ji as d,
1697
- oi as e,
1698
- R as f,
1699
- Oi as g,
1700
- Ti as h,
1718
+ Ni as B,
1719
+ bi as a,
1720
+ Ei as b,
1721
+ vi as c,
1722
+ Ui as d,
1723
+ hi as e,
1724
+ z as f,
1725
+ Mi as g,
1726
+ Oi as h,
1701
1727
  _t as i,
1702
- Ht as j,
1703
- Ui as k,
1728
+ Zt as j,
1729
+ Ti as k,
1704
1730
  Et as l,
1705
- Ii as m,
1706
- Ft as n,
1707
- ki as o,
1708
- wi as p,
1709
- $ as r,
1710
- ai as s,
1711
- Bi as z
1731
+ ki as m,
1732
+ Xt as n,
1733
+ Di as o,
1734
+ Gt as p,
1735
+ W as q,
1736
+ P as r,
1737
+ fi as s,
1738
+ _i as t,
1739
+ Kt as u,
1740
+ Ii as z
1712
1741
  };