document-model 1.0.54 → 1.1.0-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/cjs/document-model.js +1 -1
- package/dist/browser/cjs/document.js +1 -1
- package/dist/browser/cjs/index.js +1 -1
- package/dist/browser/cjs/internal/index-DZx9eknf.js +1 -0
- package/dist/browser/cjs/internal/{index-CnVGNZ9_.js → index-DypcJuba.js} +1 -1
- package/dist/browser/cjs/internal/object-BU2CI8g7.js +25 -0
- package/dist/browser/es/document-model.js +2 -2
- package/dist/browser/es/document.js +2 -2
- package/dist/browser/es/index.js +3 -3
- package/dist/browser/es/internal/index-BP3Z2ZVF.js +43 -0
- package/dist/browser/es/internal/{index-aS_vqu4O.js → index-CyBZ1dJQ.js} +1 -1
- package/dist/browser/es/internal/object-CPDHmXxz.js +2712 -0
- package/dist/browser/src/document/reducer.d.ts +13 -2
- package/dist/browser/src/document/utils/base.d.ts +1 -1
- package/dist/browser/src/document/utils/document-helpers.d.ts +53 -0
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/node/cjs/document-model.js +1 -1
- package/dist/node/cjs/document.js +1 -1
- package/dist/node/cjs/index.js +1 -1
- package/dist/node/cjs/internal/{index-JtuONOcD.js → index-Bt4KwBzM.js} +1 -1
- package/dist/node/cjs/internal/index-CwTTSCCW.js +1 -0
- package/dist/node/cjs/internal/object-Bc_eSRcx.js +20 -0
- package/dist/node/es/document-model.js +3 -3
- package/dist/node/es/document.js +3 -3
- package/dist/node/es/index.js +4 -4
- package/dist/node/es/internal/{index-BclkoIYP.js → index-6nUwJlFL.js} +2 -2
- package/dist/node/es/internal/index-CLgAZiia.js +43 -0
- package/dist/node/es/internal/object-DofGWMf1.js +1610 -0
- package/dist/node/src/document/reducer.d.ts +13 -2
- package/dist/node/src/document/utils/base.d.ts +1 -1
- package/dist/node/src/document/utils/document-helpers.d.ts +53 -0
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/package.json +7 -2
- package/dist/browser/cjs/internal/index-BVWyYyNE.js +0 -1
- package/dist/browser/cjs/internal/object-5l5_pTNL.js +0 -25
- package/dist/browser/es/internal/index-CF0d1_Cg.js +0 -42
- package/dist/browser/es/internal/object-BdaEhPk1.js +0 -2507
- package/dist/node/cjs/internal/index-B9gc2lPN.js +0 -1
- package/dist/node/cjs/internal/object-D6wRzEDN.js +0 -20
- package/dist/node/es/internal/index-EY0PPZnJ.js +0 -42
- package/dist/node/es/internal/object-BxC3xMqY.js +0 -1405
- package/dist/src/document/actions/creators.d.ts +0 -47
- package/dist/src/document/actions/index.d.ts +0 -14
- package/dist/src/document/actions/types.d.ts +0 -15
- package/dist/src/document/index.d.ts +0 -6
- package/dist/src/document/object.d.ts +0 -1175
- package/dist/src/document/reducer.d.ts +0 -32
- package/dist/src/document/schema/index.d.ts +0 -2
- package/dist/src/document/schema/types.d.ts +0 -176
- package/dist/src/document/schema/zod.d.ts +0 -113
- package/dist/src/document/signal.d.ts +0 -29
- package/dist/src/document/types.d.ts +0 -249
- package/dist/src/document/utils/base.d.ts +0 -85
- package/dist/src/document/utils/file.d.ts +0 -48
- package/dist/src/document/utils/index.d.ts +0 -4
- package/dist/src/document/utils/node.d.ts +0 -9
- package/dist/src/document/utils/validation.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/header.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/module.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/operation-error.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/operation-example.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/operation.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/state.d.ts +0 -2
- package/dist/src/document-model/custom/reducers/versioning.d.ts +0 -7
- package/dist/src/document-model/custom/utils.d.ts +0 -7
- package/dist/src/document-model/gen/actions.d.ts +0 -15
- package/dist/src/document-model/gen/creators.d.ts +0 -7
- package/dist/src/document-model/gen/document-model.d.ts +0 -2
- package/dist/src/document-model/gen/header/actions.d.ts +0 -9
- package/dist/src/document-model/gen/header/creators.d.ts +0 -8
- package/dist/src/document-model/gen/header/object.d.ts +0 -12
- package/dist/src/document-model/gen/header/operations.d.ts +0 -10
- package/dist/src/document-model/gen/index.d.ts +0 -5
- package/dist/src/document-model/gen/module/actions.d.ts +0 -8
- package/dist/src/document-model/gen/module/creators.d.ts +0 -7
- package/dist/src/document-model/gen/module/object.d.ts +0 -11
- package/dist/src/document-model/gen/module/operations.d.ts +0 -9
- package/dist/src/document-model/gen/object.d.ts +0 -28
- package/dist/src/document-model/gen/operation/actions.d.ts +0 -13
- package/dist/src/document-model/gen/operation/creators.d.ts +0 -12
- package/dist/src/document-model/gen/operation/object.d.ts +0 -16
- package/dist/src/document-model/gen/operation/operations.d.ts +0 -14
- package/dist/src/document-model/gen/operation-error/actions.d.ts +0 -10
- package/dist/src/document-model/gen/operation-error/creators.d.ts +0 -9
- package/dist/src/document-model/gen/operation-error/object.d.ts +0 -13
- package/dist/src/document-model/gen/operation-error/operations.d.ts +0 -11
- package/dist/src/document-model/gen/operation-example/actions.d.ts +0 -7
- package/dist/src/document-model/gen/operation-example/creators.d.ts +0 -6
- package/dist/src/document-model/gen/operation-example/object.d.ts +0 -10
- package/dist/src/document-model/gen/operation-example/operations.d.ts +0 -8
- package/dist/src/document-model/gen/reducer.d.ts +0 -5
- package/dist/src/document-model/gen/schema/index.d.ts +0 -2
- package/dist/src/document-model/gen/schema/types.d.ts +0 -453
- package/dist/src/document-model/gen/schema/zod.d.ts +0 -453
- package/dist/src/document-model/gen/state/actions.d.ts +0 -9
- package/dist/src/document-model/gen/state/creators.d.ts +0 -8
- package/dist/src/document-model/gen/state/object.d.ts +0 -12
- package/dist/src/document-model/gen/state/operations.d.ts +0 -10
- package/dist/src/document-model/gen/types.d.ts +0 -8
- package/dist/src/document-model/gen/utils.d.ts +0 -6
- package/dist/src/document-model/gen/versioning/actions.d.ts +0 -8
- package/dist/src/document-model/gen/versioning/creators.d.ts +0 -7
- package/dist/src/document-model/gen/versioning/object.d.ts +0 -11
- package/dist/src/document-model/gen/versioning/operations.d.ts +0 -9
- package/dist/src/document-model/index.d.ts +0 -80
- package/dist/src/index.d.ts +0 -25
- package/dist/vite.config.d.ts +0 -2
- package/dist/vitest.config.d.ts +0 -2
|
@@ -0,0 +1,2712 @@
|
|
|
1
|
+
var We = Object.defineProperty;
|
|
2
|
+
var Xe = (r, i, o) => i in r ? We(r, i, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[i] = o;
|
|
3
|
+
var St = (r, i, o) => (Xe(r, typeof i != "symbol" ? i + "" : i, o), o);
|
|
4
|
+
import { produce as Ot, castDraft as Bt, castImmutable as Ve, freeze as Ke } from "immer";
|
|
5
|
+
import { z as v } from "zod";
|
|
6
|
+
import oe from "jszip";
|
|
7
|
+
const ae = (r) => r != null, Ge = v.any().refine((r) => ae(r)), se = v.enum(["LOAD_STATE"]), pe = v.enum(["PRUNE"]), ce = v.enum(["REDO"]), le = v.enum(["SET_NAME"]), ue = v.enum(["UNDO"]);
|
|
8
|
+
function Ze() {
|
|
9
|
+
return v.object({
|
|
10
|
+
__typename: v.literal("Action").optional(),
|
|
11
|
+
type: v.string()
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function yt() {
|
|
15
|
+
return v.literal("global").or(v.literal("local"));
|
|
16
|
+
}
|
|
17
|
+
function fe() {
|
|
18
|
+
return v.union([
|
|
19
|
+
he(),
|
|
20
|
+
xe(),
|
|
21
|
+
de(),
|
|
22
|
+
ge(),
|
|
23
|
+
ye()
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
function Ye() {
|
|
27
|
+
return v.object({
|
|
28
|
+
__typename: v.literal("DocumentFile").optional(),
|
|
29
|
+
data: v.string(),
|
|
30
|
+
extension: v.string().nullable(),
|
|
31
|
+
fileName: v.string().nullable(),
|
|
32
|
+
mimeType: v.string()
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function he() {
|
|
36
|
+
return v.object({
|
|
37
|
+
input: v.lazy(() => zt()),
|
|
38
|
+
type: se,
|
|
39
|
+
scope: yt()
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function zt() {
|
|
43
|
+
return v.object({
|
|
44
|
+
operations: v.number(),
|
|
45
|
+
state: v.lazy(() => me())
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function me() {
|
|
49
|
+
return v.object({
|
|
50
|
+
data: v.unknown().nullish(),
|
|
51
|
+
name: v.string()
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function Qe() {
|
|
55
|
+
return v.object({
|
|
56
|
+
__typename: v.literal("Operation").optional(),
|
|
57
|
+
hash: v.string(),
|
|
58
|
+
index: v.number(),
|
|
59
|
+
timestamp: v.string().datetime(),
|
|
60
|
+
type: v.string()
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function xe() {
|
|
64
|
+
return v.object({
|
|
65
|
+
input: v.lazy(() => qt()),
|
|
66
|
+
type: pe,
|
|
67
|
+
scope: yt()
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function qt() {
|
|
71
|
+
return v.object({
|
|
72
|
+
end: v.number().nullish(),
|
|
73
|
+
start: v.number().nullish()
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const Ht = v.number;
|
|
77
|
+
function de() {
|
|
78
|
+
return v.object({
|
|
79
|
+
input: Ht(),
|
|
80
|
+
type: ce,
|
|
81
|
+
scope: yt()
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const Jt = v.string;
|
|
85
|
+
function ge() {
|
|
86
|
+
return v.object({
|
|
87
|
+
input: Jt(),
|
|
88
|
+
type: le,
|
|
89
|
+
scope: v.literal("global")
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function tr() {
|
|
93
|
+
return v.object({
|
|
94
|
+
__typename: v.literal("SetNameOperation").optional(),
|
|
95
|
+
hash: v.string(),
|
|
96
|
+
index: v.number(),
|
|
97
|
+
input: v.string(),
|
|
98
|
+
timestamp: v.string().datetime(),
|
|
99
|
+
type: v.string()
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
const Wt = v.number;
|
|
103
|
+
function ye() {
|
|
104
|
+
return v.object({
|
|
105
|
+
input: Wt(),
|
|
106
|
+
type: ue,
|
|
107
|
+
scope: yt()
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
const di = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
111
|
+
__proto__: null,
|
|
112
|
+
ActionSchema: Ze,
|
|
113
|
+
BaseActionSchema: fe,
|
|
114
|
+
DocumentFileSchema: Ye,
|
|
115
|
+
LoadStateActionInputSchema: zt,
|
|
116
|
+
LoadStateActionSchema: he,
|
|
117
|
+
LoadStateActionStateInputSchema: me,
|
|
118
|
+
Load_StateSchema: se,
|
|
119
|
+
OperationSchema: Qe,
|
|
120
|
+
OperationScopeSchema: yt,
|
|
121
|
+
PruneActionInputSchema: qt,
|
|
122
|
+
PruneActionSchema: xe,
|
|
123
|
+
PruneSchema: pe,
|
|
124
|
+
RedoActionInputSchema: Ht,
|
|
125
|
+
RedoActionSchema: de,
|
|
126
|
+
RedoSchema: ce,
|
|
127
|
+
SetNameActionInputSchema: Jt,
|
|
128
|
+
SetNameActionSchema: ge,
|
|
129
|
+
SetNameOperationSchema: tr,
|
|
130
|
+
Set_NameSchema: le,
|
|
131
|
+
UndoActionInputSchema: Wt,
|
|
132
|
+
UndoActionSchema: ye,
|
|
133
|
+
UndoSchema: ue,
|
|
134
|
+
definedNonNullAnySchema: Ge,
|
|
135
|
+
isDefinedNonNullAny: ae
|
|
136
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
137
|
+
function Xt(r) {
|
|
138
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
139
|
+
}
|
|
140
|
+
var Nt = { exports: {} };
|
|
141
|
+
(function(r, i) {
|
|
142
|
+
const { hasOwnProperty: o } = Object.prototype, p = Y();
|
|
143
|
+
p.configure = Y, p.stringify = p, p.default = p, i.stringify = p, i.configure = Y, r.exports = p;
|
|
144
|
+
const u = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
|
|
145
|
+
function f(w) {
|
|
146
|
+
return w.length < 5e3 && !u.test(w) ? `"${w}"` : JSON.stringify(w);
|
|
147
|
+
}
|
|
148
|
+
function c(w) {
|
|
149
|
+
if (w.length > 200)
|
|
150
|
+
return w.sort();
|
|
151
|
+
for (let E = 1; E < w.length; E++) {
|
|
152
|
+
const k = w[E];
|
|
153
|
+
let H = E;
|
|
154
|
+
for (; H !== 0 && w[H - 1] > k; )
|
|
155
|
+
w[H] = w[H - 1], H--;
|
|
156
|
+
w[H] = k;
|
|
157
|
+
}
|
|
158
|
+
return w;
|
|
159
|
+
}
|
|
160
|
+
const s = Object.getOwnPropertyDescriptor(
|
|
161
|
+
Object.getPrototypeOf(
|
|
162
|
+
Object.getPrototypeOf(
|
|
163
|
+
new Int8Array()
|
|
164
|
+
)
|
|
165
|
+
),
|
|
166
|
+
Symbol.toStringTag
|
|
167
|
+
).get;
|
|
168
|
+
function h(w) {
|
|
169
|
+
return s.call(w) !== void 0 && w.length !== 0;
|
|
170
|
+
}
|
|
171
|
+
function g(w, E, k) {
|
|
172
|
+
w.length < k && (k = w.length);
|
|
173
|
+
const H = E === "," ? "" : " ";
|
|
174
|
+
let G = `"0":${H}${w[0]}`;
|
|
175
|
+
for (let K = 1; K < k; K++)
|
|
176
|
+
G += `${E}"${K}":${H}${w[K]}`;
|
|
177
|
+
return G;
|
|
178
|
+
}
|
|
179
|
+
function y(w) {
|
|
180
|
+
if (o.call(w, "circularValue")) {
|
|
181
|
+
const E = w.circularValue;
|
|
182
|
+
if (typeof E == "string")
|
|
183
|
+
return `"${E}"`;
|
|
184
|
+
if (E == null)
|
|
185
|
+
return E;
|
|
186
|
+
if (E === Error || E === TypeError)
|
|
187
|
+
return {
|
|
188
|
+
toString() {
|
|
189
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
|
|
193
|
+
}
|
|
194
|
+
return '"[Circular]"';
|
|
195
|
+
}
|
|
196
|
+
function _(w, E) {
|
|
197
|
+
let k;
|
|
198
|
+
if (o.call(w, E) && (k = w[E], typeof k != "boolean"))
|
|
199
|
+
throw new TypeError(`The "${E}" argument must be of type boolean`);
|
|
200
|
+
return k === void 0 ? !0 : k;
|
|
201
|
+
}
|
|
202
|
+
function F(w, E) {
|
|
203
|
+
let k;
|
|
204
|
+
if (o.call(w, E)) {
|
|
205
|
+
if (k = w[E], typeof k != "number")
|
|
206
|
+
throw new TypeError(`The "${E}" argument must be of type number`);
|
|
207
|
+
if (!Number.isInteger(k))
|
|
208
|
+
throw new TypeError(`The "${E}" argument must be an integer`);
|
|
209
|
+
if (k < 1)
|
|
210
|
+
throw new RangeError(`The "${E}" argument must be >= 1`);
|
|
211
|
+
}
|
|
212
|
+
return k === void 0 ? 1 / 0 : k;
|
|
213
|
+
}
|
|
214
|
+
function A(w) {
|
|
215
|
+
return w === 1 ? "1 item" : `${w} items`;
|
|
216
|
+
}
|
|
217
|
+
function $(w) {
|
|
218
|
+
const E = /* @__PURE__ */ new Set();
|
|
219
|
+
for (const k of w)
|
|
220
|
+
(typeof k == "string" || typeof k == "number") && E.add(String(k));
|
|
221
|
+
return E;
|
|
222
|
+
}
|
|
223
|
+
function R(w) {
|
|
224
|
+
if (o.call(w, "strict")) {
|
|
225
|
+
const E = w.strict;
|
|
226
|
+
if (typeof E != "boolean")
|
|
227
|
+
throw new TypeError('The "strict" argument must be of type boolean');
|
|
228
|
+
if (E)
|
|
229
|
+
return (k) => {
|
|
230
|
+
let H = `Object can not safely be stringified. Received type ${typeof k}`;
|
|
231
|
+
throw typeof k != "function" && (H += ` (${k.toString()})`), new Error(H);
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function Y(w) {
|
|
236
|
+
w = { ...w };
|
|
237
|
+
const E = R(w);
|
|
238
|
+
E && (w.bigint === void 0 && (w.bigint = !1), "circularValue" in w || (w.circularValue = Error));
|
|
239
|
+
const k = y(w), H = _(w, "bigint"), G = _(w, "deterministic"), K = F(w, "maximumDepth"), M = F(w, "maximumBreadth");
|
|
240
|
+
function ut(J, m, b, j, O, C) {
|
|
241
|
+
let S = m[J];
|
|
242
|
+
switch (typeof S == "object" && S !== null && typeof S.toJSON == "function" && (S = S.toJSON(J)), S = j.call(m, J, S), typeof S) {
|
|
243
|
+
case "string":
|
|
244
|
+
return f(S);
|
|
245
|
+
case "object": {
|
|
246
|
+
if (S === null)
|
|
247
|
+
return "null";
|
|
248
|
+
if (b.indexOf(S) !== -1)
|
|
249
|
+
return k;
|
|
250
|
+
let T = "", B = ",";
|
|
251
|
+
const I = C;
|
|
252
|
+
if (Array.isArray(S)) {
|
|
253
|
+
if (S.length === 0)
|
|
254
|
+
return "[]";
|
|
255
|
+
if (K < b.length + 1)
|
|
256
|
+
return '"[Array]"';
|
|
257
|
+
b.push(S), O !== "" && (C += O, T += `
|
|
258
|
+
${C}`, B = `,
|
|
259
|
+
${C}`);
|
|
260
|
+
const W = Math.min(S.length, M);
|
|
261
|
+
let Q = 0;
|
|
262
|
+
for (; Q < W - 1; Q++) {
|
|
263
|
+
const ct = ut(String(Q), S, b, j, O, C);
|
|
264
|
+
T += ct !== void 0 ? ct : "null", T += B;
|
|
265
|
+
}
|
|
266
|
+
const tt = ut(String(Q), S, b, j, O, C);
|
|
267
|
+
if (T += tt !== void 0 ? tt : "null", S.length - 1 > M) {
|
|
268
|
+
const ct = S.length - M - 1;
|
|
269
|
+
T += `${B}"... ${A(ct)} not stringified"`;
|
|
270
|
+
}
|
|
271
|
+
return O !== "" && (T += `
|
|
272
|
+
${I}`), b.pop(), `[${T}]`;
|
|
273
|
+
}
|
|
274
|
+
let L = Object.keys(S);
|
|
275
|
+
const q = L.length;
|
|
276
|
+
if (q === 0)
|
|
277
|
+
return "{}";
|
|
278
|
+
if (K < b.length + 1)
|
|
279
|
+
return '"[Object]"';
|
|
280
|
+
let U = "", X = "";
|
|
281
|
+
O !== "" && (C += O, B = `,
|
|
282
|
+
${C}`, U = " ");
|
|
283
|
+
const Z = Math.min(q, M);
|
|
284
|
+
G && !h(S) && (L = c(L)), b.push(S);
|
|
285
|
+
for (let W = 0; W < Z; W++) {
|
|
286
|
+
const Q = L[W], tt = ut(Q, S, b, j, O, C);
|
|
287
|
+
tt !== void 0 && (T += `${X}${f(Q)}:${U}${tt}`, X = B);
|
|
288
|
+
}
|
|
289
|
+
if (q > M) {
|
|
290
|
+
const W = q - M;
|
|
291
|
+
T += `${X}"...":${U}"${A(W)} not stringified"`, X = B;
|
|
292
|
+
}
|
|
293
|
+
return O !== "" && X.length > 1 && (T = `
|
|
294
|
+
${C}${T}
|
|
295
|
+
${I}`), b.pop(), `{${T}}`;
|
|
296
|
+
}
|
|
297
|
+
case "number":
|
|
298
|
+
return isFinite(S) ? String(S) : E ? E(S) : "null";
|
|
299
|
+
case "boolean":
|
|
300
|
+
return S === !0 ? "true" : "false";
|
|
301
|
+
case "undefined":
|
|
302
|
+
return;
|
|
303
|
+
case "bigint":
|
|
304
|
+
if (H)
|
|
305
|
+
return String(S);
|
|
306
|
+
default:
|
|
307
|
+
return E ? E(S) : void 0;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function ft(J, m, b, j, O, C) {
|
|
311
|
+
switch (typeof m == "object" && m !== null && typeof m.toJSON == "function" && (m = m.toJSON(J)), typeof m) {
|
|
312
|
+
case "string":
|
|
313
|
+
return f(m);
|
|
314
|
+
case "object": {
|
|
315
|
+
if (m === null)
|
|
316
|
+
return "null";
|
|
317
|
+
if (b.indexOf(m) !== -1)
|
|
318
|
+
return k;
|
|
319
|
+
const S = C;
|
|
320
|
+
let T = "", B = ",";
|
|
321
|
+
if (Array.isArray(m)) {
|
|
322
|
+
if (m.length === 0)
|
|
323
|
+
return "[]";
|
|
324
|
+
if (K < b.length + 1)
|
|
325
|
+
return '"[Array]"';
|
|
326
|
+
b.push(m), O !== "" && (C += O, T += `
|
|
327
|
+
${C}`, B = `,
|
|
328
|
+
${C}`);
|
|
329
|
+
const q = Math.min(m.length, M);
|
|
330
|
+
let U = 0;
|
|
331
|
+
for (; U < q - 1; U++) {
|
|
332
|
+
const Z = ft(String(U), m[U], b, j, O, C);
|
|
333
|
+
T += Z !== void 0 ? Z : "null", T += B;
|
|
334
|
+
}
|
|
335
|
+
const X = ft(String(U), m[U], b, j, O, C);
|
|
336
|
+
if (T += X !== void 0 ? X : "null", m.length - 1 > M) {
|
|
337
|
+
const Z = m.length - M - 1;
|
|
338
|
+
T += `${B}"... ${A(Z)} not stringified"`;
|
|
339
|
+
}
|
|
340
|
+
return O !== "" && (T += `
|
|
341
|
+
${S}`), b.pop(), `[${T}]`;
|
|
342
|
+
}
|
|
343
|
+
b.push(m);
|
|
344
|
+
let I = "";
|
|
345
|
+
O !== "" && (C += O, B = `,
|
|
346
|
+
${C}`, I = " ");
|
|
347
|
+
let L = "";
|
|
348
|
+
for (const q of j) {
|
|
349
|
+
const U = ft(q, m[q], b, j, O, C);
|
|
350
|
+
U !== void 0 && (T += `${L}${f(q)}:${I}${U}`, L = B);
|
|
351
|
+
}
|
|
352
|
+
return O !== "" && L.length > 1 && (T = `
|
|
353
|
+
${C}${T}
|
|
354
|
+
${S}`), b.pop(), `{${T}}`;
|
|
355
|
+
}
|
|
356
|
+
case "number":
|
|
357
|
+
return isFinite(m) ? String(m) : E ? E(m) : "null";
|
|
358
|
+
case "boolean":
|
|
359
|
+
return m === !0 ? "true" : "false";
|
|
360
|
+
case "undefined":
|
|
361
|
+
return;
|
|
362
|
+
case "bigint":
|
|
363
|
+
if (H)
|
|
364
|
+
return String(m);
|
|
365
|
+
default:
|
|
366
|
+
return E ? E(m) : void 0;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function st(J, m, b, j, O) {
|
|
370
|
+
switch (typeof m) {
|
|
371
|
+
case "string":
|
|
372
|
+
return f(m);
|
|
373
|
+
case "object": {
|
|
374
|
+
if (m === null)
|
|
375
|
+
return "null";
|
|
376
|
+
if (typeof m.toJSON == "function") {
|
|
377
|
+
if (m = m.toJSON(J), typeof m != "object")
|
|
378
|
+
return st(J, m, b, j, O);
|
|
379
|
+
if (m === null)
|
|
380
|
+
return "null";
|
|
381
|
+
}
|
|
382
|
+
if (b.indexOf(m) !== -1)
|
|
383
|
+
return k;
|
|
384
|
+
const C = O;
|
|
385
|
+
if (Array.isArray(m)) {
|
|
386
|
+
if (m.length === 0)
|
|
387
|
+
return "[]";
|
|
388
|
+
if (K < b.length + 1)
|
|
389
|
+
return '"[Array]"';
|
|
390
|
+
b.push(m), O += j;
|
|
391
|
+
let U = `
|
|
392
|
+
${O}`;
|
|
393
|
+
const X = `,
|
|
394
|
+
${O}`, Z = Math.min(m.length, M);
|
|
395
|
+
let W = 0;
|
|
396
|
+
for (; W < Z - 1; W++) {
|
|
397
|
+
const tt = st(String(W), m[W], b, j, O);
|
|
398
|
+
U += tt !== void 0 ? tt : "null", U += X;
|
|
399
|
+
}
|
|
400
|
+
const Q = st(String(W), m[W], b, j, O);
|
|
401
|
+
if (U += Q !== void 0 ? Q : "null", m.length - 1 > M) {
|
|
402
|
+
const tt = m.length - M - 1;
|
|
403
|
+
U += `${X}"... ${A(tt)} not stringified"`;
|
|
404
|
+
}
|
|
405
|
+
return U += `
|
|
406
|
+
${C}`, b.pop(), `[${U}]`;
|
|
407
|
+
}
|
|
408
|
+
let S = Object.keys(m);
|
|
409
|
+
const T = S.length;
|
|
410
|
+
if (T === 0)
|
|
411
|
+
return "{}";
|
|
412
|
+
if (K < b.length + 1)
|
|
413
|
+
return '"[Object]"';
|
|
414
|
+
O += j;
|
|
415
|
+
const B = `,
|
|
416
|
+
${O}`;
|
|
417
|
+
let I = "", L = "", q = Math.min(T, M);
|
|
418
|
+
h(m) && (I += g(m, B, M), S = S.slice(m.length), q -= m.length, L = B), G && (S = c(S)), b.push(m);
|
|
419
|
+
for (let U = 0; U < q; U++) {
|
|
420
|
+
const X = S[U], Z = st(X, m[X], b, j, O);
|
|
421
|
+
Z !== void 0 && (I += `${L}${f(X)}: ${Z}`, L = B);
|
|
422
|
+
}
|
|
423
|
+
if (T > M) {
|
|
424
|
+
const U = T - M;
|
|
425
|
+
I += `${L}"...": "${A(U)} not stringified"`, L = B;
|
|
426
|
+
}
|
|
427
|
+
return L !== "" && (I = `
|
|
428
|
+
${O}${I}
|
|
429
|
+
${C}`), b.pop(), `{${I}}`;
|
|
430
|
+
}
|
|
431
|
+
case "number":
|
|
432
|
+
return isFinite(m) ? String(m) : E ? E(m) : "null";
|
|
433
|
+
case "boolean":
|
|
434
|
+
return m === !0 ? "true" : "false";
|
|
435
|
+
case "undefined":
|
|
436
|
+
return;
|
|
437
|
+
case "bigint":
|
|
438
|
+
if (H)
|
|
439
|
+
return String(m);
|
|
440
|
+
default:
|
|
441
|
+
return E ? E(m) : void 0;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function pt(J, m, b) {
|
|
445
|
+
switch (typeof m) {
|
|
446
|
+
case "string":
|
|
447
|
+
return f(m);
|
|
448
|
+
case "object": {
|
|
449
|
+
if (m === null)
|
|
450
|
+
return "null";
|
|
451
|
+
if (typeof m.toJSON == "function") {
|
|
452
|
+
if (m = m.toJSON(J), typeof m != "object")
|
|
453
|
+
return pt(J, m, b);
|
|
454
|
+
if (m === null)
|
|
455
|
+
return "null";
|
|
456
|
+
}
|
|
457
|
+
if (b.indexOf(m) !== -1)
|
|
458
|
+
return k;
|
|
459
|
+
let j = "";
|
|
460
|
+
if (Array.isArray(m)) {
|
|
461
|
+
if (m.length === 0)
|
|
462
|
+
return "[]";
|
|
463
|
+
if (K < b.length + 1)
|
|
464
|
+
return '"[Array]"';
|
|
465
|
+
b.push(m);
|
|
466
|
+
const B = Math.min(m.length, M);
|
|
467
|
+
let I = 0;
|
|
468
|
+
for (; I < B - 1; I++) {
|
|
469
|
+
const q = pt(String(I), m[I], b);
|
|
470
|
+
j += q !== void 0 ? q : "null", j += ",";
|
|
471
|
+
}
|
|
472
|
+
const L = pt(String(I), m[I], b);
|
|
473
|
+
if (j += L !== void 0 ? L : "null", m.length - 1 > M) {
|
|
474
|
+
const q = m.length - M - 1;
|
|
475
|
+
j += `,"... ${A(q)} not stringified"`;
|
|
476
|
+
}
|
|
477
|
+
return b.pop(), `[${j}]`;
|
|
478
|
+
}
|
|
479
|
+
let O = Object.keys(m);
|
|
480
|
+
const C = O.length;
|
|
481
|
+
if (C === 0)
|
|
482
|
+
return "{}";
|
|
483
|
+
if (K < b.length + 1)
|
|
484
|
+
return '"[Object]"';
|
|
485
|
+
let S = "", T = Math.min(C, M);
|
|
486
|
+
h(m) && (j += g(m, ",", M), O = O.slice(m.length), T -= m.length, S = ","), G && (O = c(O)), b.push(m);
|
|
487
|
+
for (let B = 0; B < T; B++) {
|
|
488
|
+
const I = O[B], L = pt(I, m[I], b);
|
|
489
|
+
L !== void 0 && (j += `${S}${f(I)}:${L}`, S = ",");
|
|
490
|
+
}
|
|
491
|
+
if (C > M) {
|
|
492
|
+
const B = C - M;
|
|
493
|
+
j += `${S}"...":"${A(B)} not stringified"`;
|
|
494
|
+
}
|
|
495
|
+
return b.pop(), `{${j}}`;
|
|
496
|
+
}
|
|
497
|
+
case "number":
|
|
498
|
+
return isFinite(m) ? String(m) : E ? E(m) : "null";
|
|
499
|
+
case "boolean":
|
|
500
|
+
return m === !0 ? "true" : "false";
|
|
501
|
+
case "undefined":
|
|
502
|
+
return;
|
|
503
|
+
case "bigint":
|
|
504
|
+
if (H)
|
|
505
|
+
return String(m);
|
|
506
|
+
default:
|
|
507
|
+
return E ? E(m) : void 0;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
function Dt(J, m, b) {
|
|
511
|
+
if (arguments.length > 1) {
|
|
512
|
+
let j = "";
|
|
513
|
+
if (typeof b == "number" ? j = " ".repeat(Math.min(b, 10)) : typeof b == "string" && (j = b.slice(0, 10)), m != null) {
|
|
514
|
+
if (typeof m == "function")
|
|
515
|
+
return ut("", { "": J }, [], m, j, "");
|
|
516
|
+
if (Array.isArray(m))
|
|
517
|
+
return ft("", J, [], $(m), j, "");
|
|
518
|
+
}
|
|
519
|
+
if (j.length !== 0)
|
|
520
|
+
return st("", J, [], j, "");
|
|
521
|
+
}
|
|
522
|
+
return pt("", J, []);
|
|
523
|
+
}
|
|
524
|
+
return Dt;
|
|
525
|
+
}
|
|
526
|
+
})(Nt, Nt.exports);
|
|
527
|
+
var er = Nt.exports;
|
|
528
|
+
const xt = /* @__PURE__ */ Xt(er);
|
|
529
|
+
xt.configure;
|
|
530
|
+
function rr(r, i) {
|
|
531
|
+
return { ...r, name: i };
|
|
532
|
+
}
|
|
533
|
+
function ir(r, i, o) {
|
|
534
|
+
const { scope: p, input: u } = i;
|
|
535
|
+
return Ot({
|
|
536
|
+
document: r,
|
|
537
|
+
action: i,
|
|
538
|
+
skip: o
|
|
539
|
+
}, (c) => {
|
|
540
|
+
if (c.document.operations[p].length < 1)
|
|
541
|
+
throw new Error(
|
|
542
|
+
`Cannot undo: no operations in history for scope "${p}"`
|
|
543
|
+
);
|
|
544
|
+
if (u < 1)
|
|
545
|
+
throw new Error(
|
|
546
|
+
"Invalid UNDO action: input value must be greater than 0"
|
|
547
|
+
);
|
|
548
|
+
if (c.skip > 0)
|
|
549
|
+
throw new Error(
|
|
550
|
+
"Cannot undo: skip value from reducer cannot be used with UNDO action"
|
|
551
|
+
);
|
|
552
|
+
const s = c.document.operations[p].at(-1), h = s && s.type === "NOOP" && s.skip > 0;
|
|
553
|
+
if (c.skip += u, h) {
|
|
554
|
+
c.skip += s.skip;
|
|
555
|
+
const F = c.document.operations[p][c.document.operations[p].length - 2];
|
|
556
|
+
F && s.index - F.index === 1 && c.document.operations[p].pop();
|
|
557
|
+
}
|
|
558
|
+
if (c.document.operations[p].length < c.skip)
|
|
559
|
+
throw new Error(
|
|
560
|
+
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
561
|
+
);
|
|
562
|
+
const g = c.document.operations[p].length - 1;
|
|
563
|
+
let y = u, _ = h ? g - s.skip : g;
|
|
564
|
+
for (; y > 0 && _ >= 0; ) {
|
|
565
|
+
const F = c.document.operations[p][_];
|
|
566
|
+
if (!F) {
|
|
567
|
+
y--, _--;
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
F.type === "NOOP" && F.skip > 0 ? (_ = _ - (F.skip + 1), c.skip += F.skip + 1) : (c.document.clipboard.push({ ...F }), y--, _--);
|
|
571
|
+
}
|
|
572
|
+
c.action = He(p);
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
function nr(r, i, o) {
|
|
576
|
+
const { scope: p, input: u } = i;
|
|
577
|
+
return Ot({
|
|
578
|
+
document: r,
|
|
579
|
+
action: i,
|
|
580
|
+
skip: o
|
|
581
|
+
}, (c) => {
|
|
582
|
+
if (c.skip > 0)
|
|
583
|
+
throw new Error(
|
|
584
|
+
"Cannot redo: skip value from reducer cannot be used with REDO action"
|
|
585
|
+
);
|
|
586
|
+
if (u > 1)
|
|
587
|
+
throw new Error(
|
|
588
|
+
"Cannot redo: you can only redo one operation at a time"
|
|
589
|
+
);
|
|
590
|
+
if (u < 1)
|
|
591
|
+
throw new Error("Invalid REDO action: invalid redo input value");
|
|
592
|
+
if (c.document.clipboard.length < 1)
|
|
593
|
+
throw new Error("Cannot redo: no operations in the clipboard");
|
|
594
|
+
const s = c.document.clipboard.findLastIndex(
|
|
595
|
+
(g) => g.scope === p
|
|
596
|
+
);
|
|
597
|
+
if (s < 0)
|
|
598
|
+
throw new Error(
|
|
599
|
+
`Cannot redo: no operations in clipboard for scope "${p}"`
|
|
600
|
+
);
|
|
601
|
+
const h = c.document.clipboard.splice(s, 1)[0];
|
|
602
|
+
c.action = Bt({
|
|
603
|
+
type: h.type,
|
|
604
|
+
scope: h.scope,
|
|
605
|
+
input: h.input
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
function or(r, i, o) {
|
|
610
|
+
const { scope: p } = i, u = r.operations[p];
|
|
611
|
+
let {
|
|
612
|
+
input: { start: f, end: c }
|
|
613
|
+
} = i;
|
|
614
|
+
f = f || 0, c = c || u.length;
|
|
615
|
+
const s = u.slice(f, c), h = u.slice(0, f), g = u.slice(c), y = Pt(
|
|
616
|
+
r.initialState,
|
|
617
|
+
{
|
|
618
|
+
...r.operations,
|
|
619
|
+
[p]: h.concat(s)
|
|
620
|
+
},
|
|
621
|
+
o
|
|
622
|
+
), { name: _, state: F } = y, A = h.length, $ = h.length ? h[h.length - 1].timestamp : g.length ? g[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
623
|
+
return Pt(
|
|
624
|
+
r.initialState,
|
|
625
|
+
{
|
|
626
|
+
...r.operations,
|
|
627
|
+
[p]: [
|
|
628
|
+
...h,
|
|
629
|
+
{
|
|
630
|
+
...te(
|
|
631
|
+
{ name: _, state: F },
|
|
632
|
+
s.length
|
|
633
|
+
),
|
|
634
|
+
timestamp: $,
|
|
635
|
+
index: A,
|
|
636
|
+
hash: Qt({ state: F }, "global")
|
|
637
|
+
},
|
|
638
|
+
...g.map((R, Y) => ({
|
|
639
|
+
...R,
|
|
640
|
+
index: A + Y + 1
|
|
641
|
+
}))
|
|
642
|
+
]
|
|
643
|
+
},
|
|
644
|
+
o
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
function ar(r, i) {
|
|
648
|
+
return {
|
|
649
|
+
...r,
|
|
650
|
+
name: i.name,
|
|
651
|
+
state: i.state ?? { global: {}, local: {} }
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
const we = "SET_NAME", wt = "UNDO", Et = "REDO", It = "PRUNE", Ee = "LOAD_STATE", sr = "NOOP", be = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
655
|
+
Object.freeze(be);
|
|
656
|
+
var et = function(r, i, o, p) {
|
|
657
|
+
if (o === "a" && !p)
|
|
658
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
659
|
+
if (typeof i == "function" ? r !== i || !p : !i.has(r))
|
|
660
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
661
|
+
return o === "m" ? p : o === "a" ? p.call(r) : p ? p.value : i.get(r);
|
|
662
|
+
}, mt, gt, lt;
|
|
663
|
+
class pr {
|
|
664
|
+
constructor(...i) {
|
|
665
|
+
mt.set(this, /* @__PURE__ */ new Map()), gt.set(this, /* @__PURE__ */ new Map()), lt.set(this, /* @__PURE__ */ new Map());
|
|
666
|
+
for (const o of i)
|
|
667
|
+
this.define(o);
|
|
668
|
+
}
|
|
669
|
+
define(i, o = !1) {
|
|
670
|
+
for (let [p, u] of Object.entries(i)) {
|
|
671
|
+
p = p.toLowerCase(), u = u.map((s) => s.toLowerCase()), et(this, lt, "f").has(p) || et(this, lt, "f").set(p, /* @__PURE__ */ new Set());
|
|
672
|
+
const f = et(this, lt, "f").get(p);
|
|
673
|
+
let c = !0;
|
|
674
|
+
for (let s of u) {
|
|
675
|
+
const h = s.startsWith("*");
|
|
676
|
+
if (s = h ? s.slice(1) : s, f == null || f.add(s), c && et(this, gt, "f").set(p, s), c = !1, h)
|
|
677
|
+
continue;
|
|
678
|
+
const g = et(this, mt, "f").get(s);
|
|
679
|
+
if (g && g != p && !o)
|
|
680
|
+
throw new Error(`"${p} -> ${s}" conflicts with "${g} -> ${s}". Pass \`force=true\` to override this definition.`);
|
|
681
|
+
et(this, mt, "f").set(s, p);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return this;
|
|
685
|
+
}
|
|
686
|
+
getType(i) {
|
|
687
|
+
if (typeof i != "string")
|
|
688
|
+
return null;
|
|
689
|
+
const o = i.replace(/^.*[/\\]/, "").toLowerCase(), p = o.replace(/^.*\./, "").toLowerCase(), u = o.length < i.length;
|
|
690
|
+
return !(p.length < o.length - 1) && u ? null : et(this, mt, "f").get(p) ?? null;
|
|
691
|
+
}
|
|
692
|
+
getExtension(i) {
|
|
693
|
+
var o;
|
|
694
|
+
return typeof i != "string" ? null : (i = (o = i == null ? void 0 : i.split) == null ? void 0 : o.call(i, ";")[0], (i && et(this, gt, "f").get(i.trim().toLowerCase())) ?? null);
|
|
695
|
+
}
|
|
696
|
+
getAllExtensions(i) {
|
|
697
|
+
return typeof i != "string" ? null : et(this, lt, "f").get(i.toLowerCase()) ?? null;
|
|
698
|
+
}
|
|
699
|
+
_freeze() {
|
|
700
|
+
this.define = () => {
|
|
701
|
+
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
702
|
+
}, Object.freeze(this);
|
|
703
|
+
for (const i of et(this, lt, "f").values())
|
|
704
|
+
Object.freeze(i);
|
|
705
|
+
return this;
|
|
706
|
+
}
|
|
707
|
+
_getTestState() {
|
|
708
|
+
return {
|
|
709
|
+
types: et(this, mt, "f"),
|
|
710
|
+
extensions: et(this, gt, "f")
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
mt = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap();
|
|
715
|
+
const cr = new pr(be)._freeze();
|
|
716
|
+
var Mt = { exports: {} };
|
|
717
|
+
typeof Object.create == "function" ? Mt.exports = function(i, o) {
|
|
718
|
+
o && (i.super_ = o, i.prototype = Object.create(o.prototype, {
|
|
719
|
+
constructor: {
|
|
720
|
+
value: i,
|
|
721
|
+
enumerable: !1,
|
|
722
|
+
writable: !0,
|
|
723
|
+
configurable: !0
|
|
724
|
+
}
|
|
725
|
+
}));
|
|
726
|
+
} : Mt.exports = function(i, o) {
|
|
727
|
+
if (o) {
|
|
728
|
+
i.super_ = o;
|
|
729
|
+
var p = function() {
|
|
730
|
+
};
|
|
731
|
+
p.prototype = o.prototype, i.prototype = new p(), i.prototype.constructor = i;
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
var ve = Mt.exports, Rt = { exports: {} }, _e = {}, jt = {};
|
|
735
|
+
jt.byteLength = fr;
|
|
736
|
+
jt.toByteArray = mr;
|
|
737
|
+
jt.fromByteArray = gr;
|
|
738
|
+
var nt = [], rt = [], lr = typeof Uint8Array < "u" ? Uint8Array : Array, Ut = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
739
|
+
for (var ht = 0, ur = Ut.length; ht < ur; ++ht)
|
|
740
|
+
nt[ht] = Ut[ht], rt[Ut.charCodeAt(ht)] = ht;
|
|
741
|
+
rt[45] = 62;
|
|
742
|
+
rt[95] = 63;
|
|
743
|
+
function Ae(r) {
|
|
744
|
+
var i = r.length;
|
|
745
|
+
if (i % 4 > 0)
|
|
746
|
+
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
747
|
+
var o = r.indexOf("=");
|
|
748
|
+
o === -1 && (o = i);
|
|
749
|
+
var p = o === i ? 0 : 4 - o % 4;
|
|
750
|
+
return [o, p];
|
|
751
|
+
}
|
|
752
|
+
function fr(r) {
|
|
753
|
+
var i = Ae(r), o = i[0], p = i[1];
|
|
754
|
+
return (o + p) * 3 / 4 - p;
|
|
755
|
+
}
|
|
756
|
+
function hr(r, i, o) {
|
|
757
|
+
return (i + o) * 3 / 4 - o;
|
|
758
|
+
}
|
|
759
|
+
function mr(r) {
|
|
760
|
+
var i, o = Ae(r), p = o[0], u = o[1], f = new lr(hr(r, p, u)), c = 0, s = u > 0 ? p - 4 : p, h;
|
|
761
|
+
for (h = 0; h < s; h += 4)
|
|
762
|
+
i = rt[r.charCodeAt(h)] << 18 | rt[r.charCodeAt(h + 1)] << 12 | rt[r.charCodeAt(h + 2)] << 6 | rt[r.charCodeAt(h + 3)], f[c++] = i >> 16 & 255, f[c++] = i >> 8 & 255, f[c++] = i & 255;
|
|
763
|
+
return u === 2 && (i = rt[r.charCodeAt(h)] << 2 | rt[r.charCodeAt(h + 1)] >> 4, f[c++] = i & 255), u === 1 && (i = rt[r.charCodeAt(h)] << 10 | rt[r.charCodeAt(h + 1)] << 4 | rt[r.charCodeAt(h + 2)] >> 2, f[c++] = i >> 8 & 255, f[c++] = i & 255), f;
|
|
764
|
+
}
|
|
765
|
+
function xr(r) {
|
|
766
|
+
return nt[r >> 18 & 63] + nt[r >> 12 & 63] + nt[r >> 6 & 63] + nt[r & 63];
|
|
767
|
+
}
|
|
768
|
+
function dr(r, i, o) {
|
|
769
|
+
for (var p, u = [], f = i; f < o; f += 3)
|
|
770
|
+
p = (r[f] << 16 & 16711680) + (r[f + 1] << 8 & 65280) + (r[f + 2] & 255), u.push(xr(p));
|
|
771
|
+
return u.join("");
|
|
772
|
+
}
|
|
773
|
+
function gr(r) {
|
|
774
|
+
for (var i, o = r.length, p = o % 3, u = [], f = 16383, c = 0, s = o - p; c < s; c += f)
|
|
775
|
+
u.push(dr(r, c, c + f > s ? s : c + f));
|
|
776
|
+
return p === 1 ? (i = r[o - 1], u.push(
|
|
777
|
+
nt[i >> 2] + nt[i << 4 & 63] + "=="
|
|
778
|
+
)) : p === 2 && (i = (r[o - 2] << 8) + r[o - 1], u.push(
|
|
779
|
+
nt[i >> 10] + nt[i >> 4 & 63] + nt[i << 2 & 63] + "="
|
|
780
|
+
)), u.join("");
|
|
781
|
+
}
|
|
782
|
+
var Vt = {};
|
|
783
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
784
|
+
Vt.read = function(r, i, o, p, u) {
|
|
785
|
+
var f, c, s = u * 8 - p - 1, h = (1 << s) - 1, g = h >> 1, y = -7, _ = o ? u - 1 : 0, F = o ? -1 : 1, A = r[i + _];
|
|
786
|
+
for (_ += F, f = A & (1 << -y) - 1, A >>= -y, y += s; y > 0; f = f * 256 + r[i + _], _ += F, y -= 8)
|
|
787
|
+
;
|
|
788
|
+
for (c = f & (1 << -y) - 1, f >>= -y, y += p; y > 0; c = c * 256 + r[i + _], _ += F, y -= 8)
|
|
789
|
+
;
|
|
790
|
+
if (f === 0)
|
|
791
|
+
f = 1 - g;
|
|
792
|
+
else {
|
|
793
|
+
if (f === h)
|
|
794
|
+
return c ? NaN : (A ? -1 : 1) * (1 / 0);
|
|
795
|
+
c = c + Math.pow(2, p), f = f - g;
|
|
796
|
+
}
|
|
797
|
+
return (A ? -1 : 1) * c * Math.pow(2, f - p);
|
|
798
|
+
};
|
|
799
|
+
Vt.write = function(r, i, o, p, u, f) {
|
|
800
|
+
var c, s, h, g = f * 8 - u - 1, y = (1 << g) - 1, _ = y >> 1, F = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, A = p ? 0 : f - 1, $ = p ? 1 : -1, R = i < 0 || i === 0 && 1 / i < 0 ? 1 : 0;
|
|
801
|
+
for (i = Math.abs(i), isNaN(i) || i === 1 / 0 ? (s = isNaN(i) ? 1 : 0, c = y) : (c = Math.floor(Math.log(i) / Math.LN2), i * (h = Math.pow(2, -c)) < 1 && (c--, h *= 2), c + _ >= 1 ? i += F / h : i += F * Math.pow(2, 1 - _), i * h >= 2 && (c++, h /= 2), c + _ >= y ? (s = 0, c = y) : c + _ >= 1 ? (s = (i * h - 1) * Math.pow(2, u), c = c + _) : (s = i * Math.pow(2, _ - 1) * Math.pow(2, u), c = 0)); u >= 8; r[o + A] = s & 255, A += $, s /= 256, u -= 8)
|
|
802
|
+
;
|
|
803
|
+
for (c = c << u | s, g += u; g > 0; r[o + A] = c & 255, A += $, c /= 256, g -= 8)
|
|
804
|
+
;
|
|
805
|
+
r[o + A - $] |= R * 128;
|
|
806
|
+
};
|
|
807
|
+
/*!
|
|
808
|
+
* The buffer module from node.js, for the browser.
|
|
809
|
+
*
|
|
810
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
811
|
+
* @license MIT
|
|
812
|
+
*/
|
|
813
|
+
(function(r) {
|
|
814
|
+
var i = jt, o = Vt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
815
|
+
r.Buffer = s, r.SlowBuffer = E, r.INSPECT_MAX_BYTES = 50;
|
|
816
|
+
var u = 2147483647;
|
|
817
|
+
r.kMaxLength = u, s.TYPED_ARRAY_SUPPORT = f(), !s.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
818
|
+
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
819
|
+
);
|
|
820
|
+
function f() {
|
|
821
|
+
try {
|
|
822
|
+
var n = new Uint8Array(1), t = { foo: function() {
|
|
823
|
+
return 42;
|
|
824
|
+
} };
|
|
825
|
+
return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(n, t), n.foo() === 42;
|
|
826
|
+
} catch {
|
|
827
|
+
return !1;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
Object.defineProperty(s.prototype, "parent", {
|
|
831
|
+
enumerable: !0,
|
|
832
|
+
get: function() {
|
|
833
|
+
if (s.isBuffer(this))
|
|
834
|
+
return this.buffer;
|
|
835
|
+
}
|
|
836
|
+
}), Object.defineProperty(s.prototype, "offset", {
|
|
837
|
+
enumerable: !0,
|
|
838
|
+
get: function() {
|
|
839
|
+
if (s.isBuffer(this))
|
|
840
|
+
return this.byteOffset;
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
function c(n) {
|
|
844
|
+
if (n > u)
|
|
845
|
+
throw new RangeError('The value "' + n + '" is invalid for option "size"');
|
|
846
|
+
var t = new Uint8Array(n);
|
|
847
|
+
return Object.setPrototypeOf(t, s.prototype), t;
|
|
848
|
+
}
|
|
849
|
+
function s(n, t, e) {
|
|
850
|
+
if (typeof n == "number") {
|
|
851
|
+
if (typeof t == "string")
|
|
852
|
+
throw new TypeError(
|
|
853
|
+
'The "string" argument must be of type string. Received type number'
|
|
854
|
+
);
|
|
855
|
+
return _(n);
|
|
856
|
+
}
|
|
857
|
+
return h(n, t, e);
|
|
858
|
+
}
|
|
859
|
+
s.poolSize = 8192;
|
|
860
|
+
function h(n, t, e) {
|
|
861
|
+
if (typeof n == "string")
|
|
862
|
+
return F(n, t);
|
|
863
|
+
if (ArrayBuffer.isView(n))
|
|
864
|
+
return $(n);
|
|
865
|
+
if (n == null)
|
|
866
|
+
throw new TypeError(
|
|
867
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
|
|
868
|
+
);
|
|
869
|
+
if (it(n, ArrayBuffer) || n && it(n.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (it(n, SharedArrayBuffer) || n && it(n.buffer, SharedArrayBuffer)))
|
|
870
|
+
return R(n, t, e);
|
|
871
|
+
if (typeof n == "number")
|
|
872
|
+
throw new TypeError(
|
|
873
|
+
'The "value" argument must not be of type number. Received type number'
|
|
874
|
+
);
|
|
875
|
+
var a = n.valueOf && n.valueOf();
|
|
876
|
+
if (a != null && a !== n)
|
|
877
|
+
return s.from(a, t, e);
|
|
878
|
+
var l = Y(n);
|
|
879
|
+
if (l)
|
|
880
|
+
return l;
|
|
881
|
+
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof n[Symbol.toPrimitive] == "function")
|
|
882
|
+
return s.from(
|
|
883
|
+
n[Symbol.toPrimitive]("string"),
|
|
884
|
+
t,
|
|
885
|
+
e
|
|
886
|
+
);
|
|
887
|
+
throw new TypeError(
|
|
888
|
+
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
s.from = function(n, t, e) {
|
|
892
|
+
return h(n, t, e);
|
|
893
|
+
}, Object.setPrototypeOf(s.prototype, Uint8Array.prototype), Object.setPrototypeOf(s, Uint8Array);
|
|
894
|
+
function g(n) {
|
|
895
|
+
if (typeof n != "number")
|
|
896
|
+
throw new TypeError('"size" argument must be of type number');
|
|
897
|
+
if (n < 0)
|
|
898
|
+
throw new RangeError('The value "' + n + '" is invalid for option "size"');
|
|
899
|
+
}
|
|
900
|
+
function y(n, t, e) {
|
|
901
|
+
return g(n), n <= 0 ? c(n) : t !== void 0 ? typeof e == "string" ? c(n).fill(t, e) : c(n).fill(t) : c(n);
|
|
902
|
+
}
|
|
903
|
+
s.alloc = function(n, t, e) {
|
|
904
|
+
return y(n, t, e);
|
|
905
|
+
};
|
|
906
|
+
function _(n) {
|
|
907
|
+
return g(n), c(n < 0 ? 0 : w(n) | 0);
|
|
908
|
+
}
|
|
909
|
+
s.allocUnsafe = function(n) {
|
|
910
|
+
return _(n);
|
|
911
|
+
}, s.allocUnsafeSlow = function(n) {
|
|
912
|
+
return _(n);
|
|
913
|
+
};
|
|
914
|
+
function F(n, t) {
|
|
915
|
+
if ((typeof t != "string" || t === "") && (t = "utf8"), !s.isEncoding(t))
|
|
916
|
+
throw new TypeError("Unknown encoding: " + t);
|
|
917
|
+
var e = k(n, t) | 0, a = c(e), l = a.write(n, t);
|
|
918
|
+
return l !== e && (a = a.slice(0, l)), a;
|
|
919
|
+
}
|
|
920
|
+
function A(n) {
|
|
921
|
+
for (var t = n.length < 0 ? 0 : w(n.length) | 0, e = c(t), a = 0; a < t; a += 1)
|
|
922
|
+
e[a] = n[a] & 255;
|
|
923
|
+
return e;
|
|
924
|
+
}
|
|
925
|
+
function $(n) {
|
|
926
|
+
if (it(n, Uint8Array)) {
|
|
927
|
+
var t = new Uint8Array(n);
|
|
928
|
+
return R(t.buffer, t.byteOffset, t.byteLength);
|
|
929
|
+
}
|
|
930
|
+
return A(n);
|
|
931
|
+
}
|
|
932
|
+
function R(n, t, e) {
|
|
933
|
+
if (t < 0 || n.byteLength < t)
|
|
934
|
+
throw new RangeError('"offset" is outside of buffer bounds');
|
|
935
|
+
if (n.byteLength < t + (e || 0))
|
|
936
|
+
throw new RangeError('"length" is outside of buffer bounds');
|
|
937
|
+
var a;
|
|
938
|
+
return t === void 0 && e === void 0 ? a = new Uint8Array(n) : e === void 0 ? a = new Uint8Array(n, t) : a = new Uint8Array(n, t, e), Object.setPrototypeOf(a, s.prototype), a;
|
|
939
|
+
}
|
|
940
|
+
function Y(n) {
|
|
941
|
+
if (s.isBuffer(n)) {
|
|
942
|
+
var t = w(n.length) | 0, e = c(t);
|
|
943
|
+
return e.length === 0 || n.copy(e, 0, 0, t), e;
|
|
944
|
+
}
|
|
945
|
+
if (n.length !== void 0)
|
|
946
|
+
return typeof n.length != "number" || Ct(n.length) ? c(0) : A(n);
|
|
947
|
+
if (n.type === "Buffer" && Array.isArray(n.data))
|
|
948
|
+
return A(n.data);
|
|
949
|
+
}
|
|
950
|
+
function w(n) {
|
|
951
|
+
if (n >= u)
|
|
952
|
+
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + u.toString(16) + " bytes");
|
|
953
|
+
return n | 0;
|
|
954
|
+
}
|
|
955
|
+
function E(n) {
|
|
956
|
+
return +n != n && (n = 0), s.alloc(+n);
|
|
957
|
+
}
|
|
958
|
+
s.isBuffer = function(t) {
|
|
959
|
+
return t != null && t._isBuffer === !0 && t !== s.prototype;
|
|
960
|
+
}, s.compare = function(t, e) {
|
|
961
|
+
if (it(t, Uint8Array) && (t = s.from(t, t.offset, t.byteLength)), it(e, Uint8Array) && (e = s.from(e, e.offset, e.byteLength)), !s.isBuffer(t) || !s.isBuffer(e))
|
|
962
|
+
throw new TypeError(
|
|
963
|
+
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
964
|
+
);
|
|
965
|
+
if (t === e)
|
|
966
|
+
return 0;
|
|
967
|
+
for (var a = t.length, l = e.length, x = 0, d = Math.min(a, l); x < d; ++x)
|
|
968
|
+
if (t[x] !== e[x]) {
|
|
969
|
+
a = t[x], l = e[x];
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
return a < l ? -1 : l < a ? 1 : 0;
|
|
973
|
+
}, s.isEncoding = function(t) {
|
|
974
|
+
switch (String(t).toLowerCase()) {
|
|
975
|
+
case "hex":
|
|
976
|
+
case "utf8":
|
|
977
|
+
case "utf-8":
|
|
978
|
+
case "ascii":
|
|
979
|
+
case "latin1":
|
|
980
|
+
case "binary":
|
|
981
|
+
case "base64":
|
|
982
|
+
case "ucs2":
|
|
983
|
+
case "ucs-2":
|
|
984
|
+
case "utf16le":
|
|
985
|
+
case "utf-16le":
|
|
986
|
+
return !0;
|
|
987
|
+
default:
|
|
988
|
+
return !1;
|
|
989
|
+
}
|
|
990
|
+
}, s.concat = function(t, e) {
|
|
991
|
+
if (!Array.isArray(t))
|
|
992
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
993
|
+
if (t.length === 0)
|
|
994
|
+
return s.alloc(0);
|
|
995
|
+
var a;
|
|
996
|
+
if (e === void 0)
|
|
997
|
+
for (e = 0, a = 0; a < t.length; ++a)
|
|
998
|
+
e += t[a].length;
|
|
999
|
+
var l = s.allocUnsafe(e), x = 0;
|
|
1000
|
+
for (a = 0; a < t.length; ++a) {
|
|
1001
|
+
var d = t[a];
|
|
1002
|
+
if (it(d, Uint8Array))
|
|
1003
|
+
x + d.length > l.length ? s.from(d).copy(l, x) : Uint8Array.prototype.set.call(
|
|
1004
|
+
l,
|
|
1005
|
+
d,
|
|
1006
|
+
x
|
|
1007
|
+
);
|
|
1008
|
+
else if (s.isBuffer(d))
|
|
1009
|
+
d.copy(l, x);
|
|
1010
|
+
else
|
|
1011
|
+
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1012
|
+
x += d.length;
|
|
1013
|
+
}
|
|
1014
|
+
return l;
|
|
1015
|
+
};
|
|
1016
|
+
function k(n, t) {
|
|
1017
|
+
if (s.isBuffer(n))
|
|
1018
|
+
return n.length;
|
|
1019
|
+
if (ArrayBuffer.isView(n) || it(n, ArrayBuffer))
|
|
1020
|
+
return n.byteLength;
|
|
1021
|
+
if (typeof n != "string")
|
|
1022
|
+
throw new TypeError(
|
|
1023
|
+
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof n
|
|
1024
|
+
);
|
|
1025
|
+
var e = n.length, a = arguments.length > 2 && arguments[2] === !0;
|
|
1026
|
+
if (!a && e === 0)
|
|
1027
|
+
return 0;
|
|
1028
|
+
for (var l = !1; ; )
|
|
1029
|
+
switch (t) {
|
|
1030
|
+
case "ascii":
|
|
1031
|
+
case "latin1":
|
|
1032
|
+
case "binary":
|
|
1033
|
+
return e;
|
|
1034
|
+
case "utf8":
|
|
1035
|
+
case "utf-8":
|
|
1036
|
+
return W(n).length;
|
|
1037
|
+
case "ucs2":
|
|
1038
|
+
case "ucs-2":
|
|
1039
|
+
case "utf16le":
|
|
1040
|
+
case "utf-16le":
|
|
1041
|
+
return e * 2;
|
|
1042
|
+
case "hex":
|
|
1043
|
+
return e >>> 1;
|
|
1044
|
+
case "base64":
|
|
1045
|
+
return ct(n).length;
|
|
1046
|
+
default:
|
|
1047
|
+
if (l)
|
|
1048
|
+
return a ? -1 : W(n).length;
|
|
1049
|
+
t = ("" + t).toLowerCase(), l = !0;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
s.byteLength = k;
|
|
1053
|
+
function H(n, t, e) {
|
|
1054
|
+
var a = !1;
|
|
1055
|
+
if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, t >>>= 0, e <= t))
|
|
1056
|
+
return "";
|
|
1057
|
+
for (n || (n = "utf8"); ; )
|
|
1058
|
+
switch (n) {
|
|
1059
|
+
case "hex":
|
|
1060
|
+
return S(this, t, e);
|
|
1061
|
+
case "utf8":
|
|
1062
|
+
case "utf-8":
|
|
1063
|
+
return m(this, t, e);
|
|
1064
|
+
case "ascii":
|
|
1065
|
+
return O(this, t, e);
|
|
1066
|
+
case "latin1":
|
|
1067
|
+
case "binary":
|
|
1068
|
+
return C(this, t, e);
|
|
1069
|
+
case "base64":
|
|
1070
|
+
return J(this, t, e);
|
|
1071
|
+
case "ucs2":
|
|
1072
|
+
case "ucs-2":
|
|
1073
|
+
case "utf16le":
|
|
1074
|
+
case "utf-16le":
|
|
1075
|
+
return T(this, t, e);
|
|
1076
|
+
default:
|
|
1077
|
+
if (a)
|
|
1078
|
+
throw new TypeError("Unknown encoding: " + n);
|
|
1079
|
+
n = (n + "").toLowerCase(), a = !0;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
s.prototype._isBuffer = !0;
|
|
1083
|
+
function G(n, t, e) {
|
|
1084
|
+
var a = n[t];
|
|
1085
|
+
n[t] = n[e], n[e] = a;
|
|
1086
|
+
}
|
|
1087
|
+
s.prototype.swap16 = function() {
|
|
1088
|
+
var t = this.length;
|
|
1089
|
+
if (t % 2 !== 0)
|
|
1090
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1091
|
+
for (var e = 0; e < t; e += 2)
|
|
1092
|
+
G(this, e, e + 1);
|
|
1093
|
+
return this;
|
|
1094
|
+
}, s.prototype.swap32 = function() {
|
|
1095
|
+
var t = this.length;
|
|
1096
|
+
if (t % 4 !== 0)
|
|
1097
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1098
|
+
for (var e = 0; e < t; e += 4)
|
|
1099
|
+
G(this, e, e + 3), G(this, e + 1, e + 2);
|
|
1100
|
+
return this;
|
|
1101
|
+
}, s.prototype.swap64 = function() {
|
|
1102
|
+
var t = this.length;
|
|
1103
|
+
if (t % 8 !== 0)
|
|
1104
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1105
|
+
for (var e = 0; e < t; e += 8)
|
|
1106
|
+
G(this, e, e + 7), G(this, e + 1, e + 6), G(this, e + 2, e + 5), G(this, e + 3, e + 4);
|
|
1107
|
+
return this;
|
|
1108
|
+
}, s.prototype.toString = function() {
|
|
1109
|
+
var t = this.length;
|
|
1110
|
+
return t === 0 ? "" : arguments.length === 0 ? m(this, 0, t) : H.apply(this, arguments);
|
|
1111
|
+
}, s.prototype.toLocaleString = s.prototype.toString, s.prototype.equals = function(t) {
|
|
1112
|
+
if (!s.isBuffer(t))
|
|
1113
|
+
throw new TypeError("Argument must be a Buffer");
|
|
1114
|
+
return this === t ? !0 : s.compare(this, t) === 0;
|
|
1115
|
+
}, s.prototype.inspect = function() {
|
|
1116
|
+
var t = "", e = r.INSPECT_MAX_BYTES;
|
|
1117
|
+
return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
|
|
1118
|
+
}, p && (s.prototype[p] = s.prototype.inspect), s.prototype.compare = function(t, e, a, l, x) {
|
|
1119
|
+
if (it(t, Uint8Array) && (t = s.from(t, t.offset, t.byteLength)), !s.isBuffer(t))
|
|
1120
|
+
throw new TypeError(
|
|
1121
|
+
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
|
|
1122
|
+
);
|
|
1123
|
+
if (e === void 0 && (e = 0), a === void 0 && (a = t ? t.length : 0), l === void 0 && (l = 0), x === void 0 && (x = this.length), e < 0 || a > t.length || l < 0 || x > this.length)
|
|
1124
|
+
throw new RangeError("out of range index");
|
|
1125
|
+
if (l >= x && e >= a)
|
|
1126
|
+
return 0;
|
|
1127
|
+
if (l >= x)
|
|
1128
|
+
return -1;
|
|
1129
|
+
if (e >= a)
|
|
1130
|
+
return 1;
|
|
1131
|
+
if (e >>>= 0, a >>>= 0, l >>>= 0, x >>>= 0, this === t)
|
|
1132
|
+
return 0;
|
|
1133
|
+
for (var d = x - l, D = a - e, N = Math.min(d, D), P = this.slice(l, x), V = t.slice(e, a), z = 0; z < N; ++z)
|
|
1134
|
+
if (P[z] !== V[z]) {
|
|
1135
|
+
d = P[z], D = V[z];
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1138
|
+
return d < D ? -1 : D < d ? 1 : 0;
|
|
1139
|
+
};
|
|
1140
|
+
function K(n, t, e, a, l) {
|
|
1141
|
+
if (n.length === 0)
|
|
1142
|
+
return -1;
|
|
1143
|
+
if (typeof e == "string" ? (a = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, Ct(e) && (e = l ? 0 : n.length - 1), e < 0 && (e = n.length + e), e >= n.length) {
|
|
1144
|
+
if (l)
|
|
1145
|
+
return -1;
|
|
1146
|
+
e = n.length - 1;
|
|
1147
|
+
} else if (e < 0)
|
|
1148
|
+
if (l)
|
|
1149
|
+
e = 0;
|
|
1150
|
+
else
|
|
1151
|
+
return -1;
|
|
1152
|
+
if (typeof t == "string" && (t = s.from(t, a)), s.isBuffer(t))
|
|
1153
|
+
return t.length === 0 ? -1 : M(n, t, e, a, l);
|
|
1154
|
+
if (typeof t == "number")
|
|
1155
|
+
return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? l ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : M(n, [t], e, a, l);
|
|
1156
|
+
throw new TypeError("val must be string, number or Buffer");
|
|
1157
|
+
}
|
|
1158
|
+
function M(n, t, e, a, l) {
|
|
1159
|
+
var x = 1, d = n.length, D = t.length;
|
|
1160
|
+
if (a !== void 0 && (a = String(a).toLowerCase(), a === "ucs2" || a === "ucs-2" || a === "utf16le" || a === "utf-16le")) {
|
|
1161
|
+
if (n.length < 2 || t.length < 2)
|
|
1162
|
+
return -1;
|
|
1163
|
+
x = 2, d /= 2, D /= 2, e /= 2;
|
|
1164
|
+
}
|
|
1165
|
+
function N(ee, re) {
|
|
1166
|
+
return x === 1 ? ee[re] : ee.readUInt16BE(re * x);
|
|
1167
|
+
}
|
|
1168
|
+
var P;
|
|
1169
|
+
if (l) {
|
|
1170
|
+
var V = -1;
|
|
1171
|
+
for (P = e; P < d; P++)
|
|
1172
|
+
if (N(n, P) === N(t, V === -1 ? 0 : P - V)) {
|
|
1173
|
+
if (V === -1 && (V = P), P - V + 1 === D)
|
|
1174
|
+
return V * x;
|
|
1175
|
+
} else
|
|
1176
|
+
V !== -1 && (P -= P - V), V = -1;
|
|
1177
|
+
} else
|
|
1178
|
+
for (e + D > d && (e = d - D), P = e; P >= 0; P--) {
|
|
1179
|
+
for (var z = !0, At = 0; At < D; At++)
|
|
1180
|
+
if (N(n, P + At) !== N(t, At)) {
|
|
1181
|
+
z = !1;
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
if (z)
|
|
1185
|
+
return P;
|
|
1186
|
+
}
|
|
1187
|
+
return -1;
|
|
1188
|
+
}
|
|
1189
|
+
s.prototype.includes = function(t, e, a) {
|
|
1190
|
+
return this.indexOf(t, e, a) !== -1;
|
|
1191
|
+
}, s.prototype.indexOf = function(t, e, a) {
|
|
1192
|
+
return K(this, t, e, a, !0);
|
|
1193
|
+
}, s.prototype.lastIndexOf = function(t, e, a) {
|
|
1194
|
+
return K(this, t, e, a, !1);
|
|
1195
|
+
};
|
|
1196
|
+
function ut(n, t, e, a) {
|
|
1197
|
+
e = Number(e) || 0;
|
|
1198
|
+
var l = n.length - e;
|
|
1199
|
+
a ? (a = Number(a), a > l && (a = l)) : a = l;
|
|
1200
|
+
var x = t.length;
|
|
1201
|
+
a > x / 2 && (a = x / 2);
|
|
1202
|
+
for (var d = 0; d < a; ++d) {
|
|
1203
|
+
var D = parseInt(t.substr(d * 2, 2), 16);
|
|
1204
|
+
if (Ct(D))
|
|
1205
|
+
return d;
|
|
1206
|
+
n[e + d] = D;
|
|
1207
|
+
}
|
|
1208
|
+
return d;
|
|
1209
|
+
}
|
|
1210
|
+
function ft(n, t, e, a) {
|
|
1211
|
+
return _t(W(t, n.length - e), n, e, a);
|
|
1212
|
+
}
|
|
1213
|
+
function st(n, t, e, a) {
|
|
1214
|
+
return _t(Q(t), n, e, a);
|
|
1215
|
+
}
|
|
1216
|
+
function pt(n, t, e, a) {
|
|
1217
|
+
return _t(ct(t), n, e, a);
|
|
1218
|
+
}
|
|
1219
|
+
function Dt(n, t, e, a) {
|
|
1220
|
+
return _t(tt(t, n.length - e), n, e, a);
|
|
1221
|
+
}
|
|
1222
|
+
s.prototype.write = function(t, e, a, l) {
|
|
1223
|
+
if (e === void 0)
|
|
1224
|
+
l = "utf8", a = this.length, e = 0;
|
|
1225
|
+
else if (a === void 0 && typeof e == "string")
|
|
1226
|
+
l = e, a = this.length, e = 0;
|
|
1227
|
+
else if (isFinite(e))
|
|
1228
|
+
e = e >>> 0, isFinite(a) ? (a = a >>> 0, l === void 0 && (l = "utf8")) : (l = a, a = void 0);
|
|
1229
|
+
else
|
|
1230
|
+
throw new Error(
|
|
1231
|
+
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
1232
|
+
);
|
|
1233
|
+
var x = this.length - e;
|
|
1234
|
+
if ((a === void 0 || a > x) && (a = x), t.length > 0 && (a < 0 || e < 0) || e > this.length)
|
|
1235
|
+
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1236
|
+
l || (l = "utf8");
|
|
1237
|
+
for (var d = !1; ; )
|
|
1238
|
+
switch (l) {
|
|
1239
|
+
case "hex":
|
|
1240
|
+
return ut(this, t, e, a);
|
|
1241
|
+
case "utf8":
|
|
1242
|
+
case "utf-8":
|
|
1243
|
+
return ft(this, t, e, a);
|
|
1244
|
+
case "ascii":
|
|
1245
|
+
case "latin1":
|
|
1246
|
+
case "binary":
|
|
1247
|
+
return st(this, t, e, a);
|
|
1248
|
+
case "base64":
|
|
1249
|
+
return pt(this, t, e, a);
|
|
1250
|
+
case "ucs2":
|
|
1251
|
+
case "ucs-2":
|
|
1252
|
+
case "utf16le":
|
|
1253
|
+
case "utf-16le":
|
|
1254
|
+
return Dt(this, t, e, a);
|
|
1255
|
+
default:
|
|
1256
|
+
if (d)
|
|
1257
|
+
throw new TypeError("Unknown encoding: " + l);
|
|
1258
|
+
l = ("" + l).toLowerCase(), d = !0;
|
|
1259
|
+
}
|
|
1260
|
+
}, s.prototype.toJSON = function() {
|
|
1261
|
+
return {
|
|
1262
|
+
type: "Buffer",
|
|
1263
|
+
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1264
|
+
};
|
|
1265
|
+
};
|
|
1266
|
+
function J(n, t, e) {
|
|
1267
|
+
return t === 0 && e === n.length ? i.fromByteArray(n) : i.fromByteArray(n.slice(t, e));
|
|
1268
|
+
}
|
|
1269
|
+
function m(n, t, e) {
|
|
1270
|
+
e = Math.min(n.length, e);
|
|
1271
|
+
for (var a = [], l = t; l < e; ) {
|
|
1272
|
+
var x = n[l], d = null, D = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
|
|
1273
|
+
if (l + D <= e) {
|
|
1274
|
+
var N, P, V, z;
|
|
1275
|
+
switch (D) {
|
|
1276
|
+
case 1:
|
|
1277
|
+
x < 128 && (d = x);
|
|
1278
|
+
break;
|
|
1279
|
+
case 2:
|
|
1280
|
+
N = n[l + 1], (N & 192) === 128 && (z = (x & 31) << 6 | N & 63, z > 127 && (d = z));
|
|
1281
|
+
break;
|
|
1282
|
+
case 3:
|
|
1283
|
+
N = n[l + 1], P = n[l + 2], (N & 192) === 128 && (P & 192) === 128 && (z = (x & 15) << 12 | (N & 63) << 6 | P & 63, z > 2047 && (z < 55296 || z > 57343) && (d = z));
|
|
1284
|
+
break;
|
|
1285
|
+
case 4:
|
|
1286
|
+
N = n[l + 1], P = n[l + 2], V = n[l + 3], (N & 192) === 128 && (P & 192) === 128 && (V & 192) === 128 && (z = (x & 15) << 18 | (N & 63) << 12 | (P & 63) << 6 | V & 63, z > 65535 && z < 1114112 && (d = z));
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
d === null ? (d = 65533, D = 1) : d > 65535 && (d -= 65536, a.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), a.push(d), l += D;
|
|
1290
|
+
}
|
|
1291
|
+
return j(a);
|
|
1292
|
+
}
|
|
1293
|
+
var b = 4096;
|
|
1294
|
+
function j(n) {
|
|
1295
|
+
var t = n.length;
|
|
1296
|
+
if (t <= b)
|
|
1297
|
+
return String.fromCharCode.apply(String, n);
|
|
1298
|
+
for (var e = "", a = 0; a < t; )
|
|
1299
|
+
e += String.fromCharCode.apply(
|
|
1300
|
+
String,
|
|
1301
|
+
n.slice(a, a += b)
|
|
1302
|
+
);
|
|
1303
|
+
return e;
|
|
1304
|
+
}
|
|
1305
|
+
function O(n, t, e) {
|
|
1306
|
+
var a = "";
|
|
1307
|
+
e = Math.min(n.length, e);
|
|
1308
|
+
for (var l = t; l < e; ++l)
|
|
1309
|
+
a += String.fromCharCode(n[l] & 127);
|
|
1310
|
+
return a;
|
|
1311
|
+
}
|
|
1312
|
+
function C(n, t, e) {
|
|
1313
|
+
var a = "";
|
|
1314
|
+
e = Math.min(n.length, e);
|
|
1315
|
+
for (var l = t; l < e; ++l)
|
|
1316
|
+
a += String.fromCharCode(n[l]);
|
|
1317
|
+
return a;
|
|
1318
|
+
}
|
|
1319
|
+
function S(n, t, e) {
|
|
1320
|
+
var a = n.length;
|
|
1321
|
+
(!t || t < 0) && (t = 0), (!e || e < 0 || e > a) && (e = a);
|
|
1322
|
+
for (var l = "", x = t; x < e; ++x)
|
|
1323
|
+
l += Je[n[x]];
|
|
1324
|
+
return l;
|
|
1325
|
+
}
|
|
1326
|
+
function T(n, t, e) {
|
|
1327
|
+
for (var a = n.slice(t, e), l = "", x = 0; x < a.length - 1; x += 2)
|
|
1328
|
+
l += String.fromCharCode(a[x] + a[x + 1] * 256);
|
|
1329
|
+
return l;
|
|
1330
|
+
}
|
|
1331
|
+
s.prototype.slice = function(t, e) {
|
|
1332
|
+
var a = this.length;
|
|
1333
|
+
t = ~~t, e = e === void 0 ? a : ~~e, t < 0 ? (t += a, t < 0 && (t = 0)) : t > a && (t = a), e < 0 ? (e += a, e < 0 && (e = 0)) : e > a && (e = a), e < t && (e = t);
|
|
1334
|
+
var l = this.subarray(t, e);
|
|
1335
|
+
return Object.setPrototypeOf(l, s.prototype), l;
|
|
1336
|
+
};
|
|
1337
|
+
function B(n, t, e) {
|
|
1338
|
+
if (n % 1 !== 0 || n < 0)
|
|
1339
|
+
throw new RangeError("offset is not uint");
|
|
1340
|
+
if (n + t > e)
|
|
1341
|
+
throw new RangeError("Trying to access beyond buffer length");
|
|
1342
|
+
}
|
|
1343
|
+
s.prototype.readUintLE = s.prototype.readUIntLE = function(t, e, a) {
|
|
1344
|
+
t = t >>> 0, e = e >>> 0, a || B(t, e, this.length);
|
|
1345
|
+
for (var l = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
|
|
1346
|
+
l += this[t + d] * x;
|
|
1347
|
+
return l;
|
|
1348
|
+
}, s.prototype.readUintBE = s.prototype.readUIntBE = function(t, e, a) {
|
|
1349
|
+
t = t >>> 0, e = e >>> 0, a || B(t, e, this.length);
|
|
1350
|
+
for (var l = this[t + --e], x = 1; e > 0 && (x *= 256); )
|
|
1351
|
+
l += this[t + --e] * x;
|
|
1352
|
+
return l;
|
|
1353
|
+
}, s.prototype.readUint8 = s.prototype.readUInt8 = function(t, e) {
|
|
1354
|
+
return t = t >>> 0, e || B(t, 1, this.length), this[t];
|
|
1355
|
+
}, s.prototype.readUint16LE = s.prototype.readUInt16LE = function(t, e) {
|
|
1356
|
+
return t = t >>> 0, e || B(t, 2, this.length), this[t] | this[t + 1] << 8;
|
|
1357
|
+
}, s.prototype.readUint16BE = s.prototype.readUInt16BE = function(t, e) {
|
|
1358
|
+
return t = t >>> 0, e || B(t, 2, this.length), this[t] << 8 | this[t + 1];
|
|
1359
|
+
}, s.prototype.readUint32LE = s.prototype.readUInt32LE = function(t, e) {
|
|
1360
|
+
return t = t >>> 0, e || B(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
|
|
1361
|
+
}, s.prototype.readUint32BE = s.prototype.readUInt32BE = function(t, e) {
|
|
1362
|
+
return t = t >>> 0, e || B(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
|
|
1363
|
+
}, s.prototype.readIntLE = function(t, e, a) {
|
|
1364
|
+
t = t >>> 0, e = e >>> 0, a || B(t, e, this.length);
|
|
1365
|
+
for (var l = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
|
|
1366
|
+
l += this[t + d] * x;
|
|
1367
|
+
return x *= 128, l >= x && (l -= Math.pow(2, 8 * e)), l;
|
|
1368
|
+
}, s.prototype.readIntBE = function(t, e, a) {
|
|
1369
|
+
t = t >>> 0, e = e >>> 0, a || B(t, e, this.length);
|
|
1370
|
+
for (var l = e, x = 1, d = this[t + --l]; l > 0 && (x *= 256); )
|
|
1371
|
+
d += this[t + --l] * x;
|
|
1372
|
+
return x *= 128, d >= x && (d -= Math.pow(2, 8 * e)), d;
|
|
1373
|
+
}, s.prototype.readInt8 = function(t, e) {
|
|
1374
|
+
return t = t >>> 0, e || B(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
|
|
1375
|
+
}, s.prototype.readInt16LE = function(t, e) {
|
|
1376
|
+
t = t >>> 0, e || B(t, 2, this.length);
|
|
1377
|
+
var a = this[t] | this[t + 1] << 8;
|
|
1378
|
+
return a & 32768 ? a | 4294901760 : a;
|
|
1379
|
+
}, s.prototype.readInt16BE = function(t, e) {
|
|
1380
|
+
t = t >>> 0, e || B(t, 2, this.length);
|
|
1381
|
+
var a = this[t + 1] | this[t] << 8;
|
|
1382
|
+
return a & 32768 ? a | 4294901760 : a;
|
|
1383
|
+
}, s.prototype.readInt32LE = function(t, e) {
|
|
1384
|
+
return t = t >>> 0, e || B(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
|
|
1385
|
+
}, s.prototype.readInt32BE = function(t, e) {
|
|
1386
|
+
return t = t >>> 0, e || B(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
|
|
1387
|
+
}, s.prototype.readFloatLE = function(t, e) {
|
|
1388
|
+
return t = t >>> 0, e || B(t, 4, this.length), o.read(this, t, !0, 23, 4);
|
|
1389
|
+
}, s.prototype.readFloatBE = function(t, e) {
|
|
1390
|
+
return t = t >>> 0, e || B(t, 4, this.length), o.read(this, t, !1, 23, 4);
|
|
1391
|
+
}, s.prototype.readDoubleLE = function(t, e) {
|
|
1392
|
+
return t = t >>> 0, e || B(t, 8, this.length), o.read(this, t, !0, 52, 8);
|
|
1393
|
+
}, s.prototype.readDoubleBE = function(t, e) {
|
|
1394
|
+
return t = t >>> 0, e || B(t, 8, this.length), o.read(this, t, !1, 52, 8);
|
|
1395
|
+
};
|
|
1396
|
+
function I(n, t, e, a, l, x) {
|
|
1397
|
+
if (!s.isBuffer(n))
|
|
1398
|
+
throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1399
|
+
if (t > l || t < x)
|
|
1400
|
+
throw new RangeError('"value" argument is out of bounds');
|
|
1401
|
+
if (e + a > n.length)
|
|
1402
|
+
throw new RangeError("Index out of range");
|
|
1403
|
+
}
|
|
1404
|
+
s.prototype.writeUintLE = s.prototype.writeUIntLE = function(t, e, a, l) {
|
|
1405
|
+
if (t = +t, e = e >>> 0, a = a >>> 0, !l) {
|
|
1406
|
+
var x = Math.pow(2, 8 * a) - 1;
|
|
1407
|
+
I(this, t, e, a, x, 0);
|
|
1408
|
+
}
|
|
1409
|
+
var d = 1, D = 0;
|
|
1410
|
+
for (this[e] = t & 255; ++D < a && (d *= 256); )
|
|
1411
|
+
this[e + D] = t / d & 255;
|
|
1412
|
+
return e + a;
|
|
1413
|
+
}, s.prototype.writeUintBE = s.prototype.writeUIntBE = function(t, e, a, l) {
|
|
1414
|
+
if (t = +t, e = e >>> 0, a = a >>> 0, !l) {
|
|
1415
|
+
var x = Math.pow(2, 8 * a) - 1;
|
|
1416
|
+
I(this, t, e, a, x, 0);
|
|
1417
|
+
}
|
|
1418
|
+
var d = a - 1, D = 1;
|
|
1419
|
+
for (this[e + d] = t & 255; --d >= 0 && (D *= 256); )
|
|
1420
|
+
this[e + d] = t / D & 255;
|
|
1421
|
+
return e + a;
|
|
1422
|
+
}, s.prototype.writeUint8 = s.prototype.writeUInt8 = function(t, e, a) {
|
|
1423
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
|
|
1424
|
+
}, s.prototype.writeUint16LE = s.prototype.writeUInt16LE = function(t, e, a) {
|
|
1425
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
1426
|
+
}, s.prototype.writeUint16BE = s.prototype.writeUInt16BE = function(t, e, a) {
|
|
1427
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
1428
|
+
}, s.prototype.writeUint32LE = s.prototype.writeUInt32LE = function(t, e, a) {
|
|
1429
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
|
|
1430
|
+
}, s.prototype.writeUint32BE = s.prototype.writeUInt32BE = function(t, e, a) {
|
|
1431
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
1432
|
+
}, s.prototype.writeIntLE = function(t, e, a, l) {
|
|
1433
|
+
if (t = +t, e = e >>> 0, !l) {
|
|
1434
|
+
var x = Math.pow(2, 8 * a - 1);
|
|
1435
|
+
I(this, t, e, a, x - 1, -x);
|
|
1436
|
+
}
|
|
1437
|
+
var d = 0, D = 1, N = 0;
|
|
1438
|
+
for (this[e] = t & 255; ++d < a && (D *= 256); )
|
|
1439
|
+
t < 0 && N === 0 && this[e + d - 1] !== 0 && (N = 1), this[e + d] = (t / D >> 0) - N & 255;
|
|
1440
|
+
return e + a;
|
|
1441
|
+
}, s.prototype.writeIntBE = function(t, e, a, l) {
|
|
1442
|
+
if (t = +t, e = e >>> 0, !l) {
|
|
1443
|
+
var x = Math.pow(2, 8 * a - 1);
|
|
1444
|
+
I(this, t, e, a, x - 1, -x);
|
|
1445
|
+
}
|
|
1446
|
+
var d = a - 1, D = 1, N = 0;
|
|
1447
|
+
for (this[e + d] = t & 255; --d >= 0 && (D *= 256); )
|
|
1448
|
+
t < 0 && N === 0 && this[e + d + 1] !== 0 && (N = 1), this[e + d] = (t / D >> 0) - N & 255;
|
|
1449
|
+
return e + a;
|
|
1450
|
+
}, s.prototype.writeInt8 = function(t, e, a) {
|
|
1451
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
|
|
1452
|
+
}, s.prototype.writeInt16LE = function(t, e, a) {
|
|
1453
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
1454
|
+
}, s.prototype.writeInt16BE = function(t, e, a) {
|
|
1455
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
1456
|
+
}, s.prototype.writeInt32LE = function(t, e, a) {
|
|
1457
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
|
|
1458
|
+
}, s.prototype.writeInt32BE = function(t, e, a) {
|
|
1459
|
+
return t = +t, e = e >>> 0, a || I(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
1460
|
+
};
|
|
1461
|
+
function L(n, t, e, a, l, x) {
|
|
1462
|
+
if (e + a > n.length)
|
|
1463
|
+
throw new RangeError("Index out of range");
|
|
1464
|
+
if (e < 0)
|
|
1465
|
+
throw new RangeError("Index out of range");
|
|
1466
|
+
}
|
|
1467
|
+
function q(n, t, e, a, l) {
|
|
1468
|
+
return t = +t, e = e >>> 0, l || L(n, t, e, 4), o.write(n, t, e, a, 23, 4), e + 4;
|
|
1469
|
+
}
|
|
1470
|
+
s.prototype.writeFloatLE = function(t, e, a) {
|
|
1471
|
+
return q(this, t, e, !0, a);
|
|
1472
|
+
}, s.prototype.writeFloatBE = function(t, e, a) {
|
|
1473
|
+
return q(this, t, e, !1, a);
|
|
1474
|
+
};
|
|
1475
|
+
function U(n, t, e, a, l) {
|
|
1476
|
+
return t = +t, e = e >>> 0, l || L(n, t, e, 8), o.write(n, t, e, a, 52, 8), e + 8;
|
|
1477
|
+
}
|
|
1478
|
+
s.prototype.writeDoubleLE = function(t, e, a) {
|
|
1479
|
+
return U(this, t, e, !0, a);
|
|
1480
|
+
}, s.prototype.writeDoubleBE = function(t, e, a) {
|
|
1481
|
+
return U(this, t, e, !1, a);
|
|
1482
|
+
}, s.prototype.copy = function(t, e, a, l) {
|
|
1483
|
+
if (!s.isBuffer(t))
|
|
1484
|
+
throw new TypeError("argument should be a Buffer");
|
|
1485
|
+
if (a || (a = 0), !l && l !== 0 && (l = this.length), e >= t.length && (e = t.length), e || (e = 0), l > 0 && l < a && (l = a), l === a || t.length === 0 || this.length === 0)
|
|
1486
|
+
return 0;
|
|
1487
|
+
if (e < 0)
|
|
1488
|
+
throw new RangeError("targetStart out of bounds");
|
|
1489
|
+
if (a < 0 || a >= this.length)
|
|
1490
|
+
throw new RangeError("Index out of range");
|
|
1491
|
+
if (l < 0)
|
|
1492
|
+
throw new RangeError("sourceEnd out of bounds");
|
|
1493
|
+
l > this.length && (l = this.length), t.length - e < l - a && (l = t.length - e + a);
|
|
1494
|
+
var x = l - a;
|
|
1495
|
+
return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, a, l) : Uint8Array.prototype.set.call(
|
|
1496
|
+
t,
|
|
1497
|
+
this.subarray(a, l),
|
|
1498
|
+
e
|
|
1499
|
+
), x;
|
|
1500
|
+
}, s.prototype.fill = function(t, e, a, l) {
|
|
1501
|
+
if (typeof t == "string") {
|
|
1502
|
+
if (typeof e == "string" ? (l = e, e = 0, a = this.length) : typeof a == "string" && (l = a, a = this.length), l !== void 0 && typeof l != "string")
|
|
1503
|
+
throw new TypeError("encoding must be a string");
|
|
1504
|
+
if (typeof l == "string" && !s.isEncoding(l))
|
|
1505
|
+
throw new TypeError("Unknown encoding: " + l);
|
|
1506
|
+
if (t.length === 1) {
|
|
1507
|
+
var x = t.charCodeAt(0);
|
|
1508
|
+
(l === "utf8" && x < 128 || l === "latin1") && (t = x);
|
|
1509
|
+
}
|
|
1510
|
+
} else
|
|
1511
|
+
typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
|
|
1512
|
+
if (e < 0 || this.length < e || this.length < a)
|
|
1513
|
+
throw new RangeError("Out of range index");
|
|
1514
|
+
if (a <= e)
|
|
1515
|
+
return this;
|
|
1516
|
+
e = e >>> 0, a = a === void 0 ? this.length : a >>> 0, t || (t = 0);
|
|
1517
|
+
var d;
|
|
1518
|
+
if (typeof t == "number")
|
|
1519
|
+
for (d = e; d < a; ++d)
|
|
1520
|
+
this[d] = t;
|
|
1521
|
+
else {
|
|
1522
|
+
var D = s.isBuffer(t) ? t : s.from(t, l), N = D.length;
|
|
1523
|
+
if (N === 0)
|
|
1524
|
+
throw new TypeError('The value "' + t + '" is invalid for argument "value"');
|
|
1525
|
+
for (d = 0; d < a - e; ++d)
|
|
1526
|
+
this[d + e] = D[d % N];
|
|
1527
|
+
}
|
|
1528
|
+
return this;
|
|
1529
|
+
};
|
|
1530
|
+
var X = /[^+/0-9A-Za-z-_]/g;
|
|
1531
|
+
function Z(n) {
|
|
1532
|
+
if (n = n.split("=")[0], n = n.trim().replace(X, ""), n.length < 2)
|
|
1533
|
+
return "";
|
|
1534
|
+
for (; n.length % 4 !== 0; )
|
|
1535
|
+
n = n + "=";
|
|
1536
|
+
return n;
|
|
1537
|
+
}
|
|
1538
|
+
function W(n, t) {
|
|
1539
|
+
t = t || 1 / 0;
|
|
1540
|
+
for (var e, a = n.length, l = null, x = [], d = 0; d < a; ++d) {
|
|
1541
|
+
if (e = n.charCodeAt(d), e > 55295 && e < 57344) {
|
|
1542
|
+
if (!l) {
|
|
1543
|
+
if (e > 56319) {
|
|
1544
|
+
(t -= 3) > -1 && x.push(239, 191, 189);
|
|
1545
|
+
continue;
|
|
1546
|
+
} else if (d + 1 === a) {
|
|
1547
|
+
(t -= 3) > -1 && x.push(239, 191, 189);
|
|
1548
|
+
continue;
|
|
1549
|
+
}
|
|
1550
|
+
l = e;
|
|
1551
|
+
continue;
|
|
1552
|
+
}
|
|
1553
|
+
if (e < 56320) {
|
|
1554
|
+
(t -= 3) > -1 && x.push(239, 191, 189), l = e;
|
|
1555
|
+
continue;
|
|
1556
|
+
}
|
|
1557
|
+
e = (l - 55296 << 10 | e - 56320) + 65536;
|
|
1558
|
+
} else
|
|
1559
|
+
l && (t -= 3) > -1 && x.push(239, 191, 189);
|
|
1560
|
+
if (l = null, e < 128) {
|
|
1561
|
+
if ((t -= 1) < 0)
|
|
1562
|
+
break;
|
|
1563
|
+
x.push(e);
|
|
1564
|
+
} else if (e < 2048) {
|
|
1565
|
+
if ((t -= 2) < 0)
|
|
1566
|
+
break;
|
|
1567
|
+
x.push(
|
|
1568
|
+
e >> 6 | 192,
|
|
1569
|
+
e & 63 | 128
|
|
1570
|
+
);
|
|
1571
|
+
} else if (e < 65536) {
|
|
1572
|
+
if ((t -= 3) < 0)
|
|
1573
|
+
break;
|
|
1574
|
+
x.push(
|
|
1575
|
+
e >> 12 | 224,
|
|
1576
|
+
e >> 6 & 63 | 128,
|
|
1577
|
+
e & 63 | 128
|
|
1578
|
+
);
|
|
1579
|
+
} else if (e < 1114112) {
|
|
1580
|
+
if ((t -= 4) < 0)
|
|
1581
|
+
break;
|
|
1582
|
+
x.push(
|
|
1583
|
+
e >> 18 | 240,
|
|
1584
|
+
e >> 12 & 63 | 128,
|
|
1585
|
+
e >> 6 & 63 | 128,
|
|
1586
|
+
e & 63 | 128
|
|
1587
|
+
);
|
|
1588
|
+
} else
|
|
1589
|
+
throw new Error("Invalid code point");
|
|
1590
|
+
}
|
|
1591
|
+
return x;
|
|
1592
|
+
}
|
|
1593
|
+
function Q(n) {
|
|
1594
|
+
for (var t = [], e = 0; e < n.length; ++e)
|
|
1595
|
+
t.push(n.charCodeAt(e) & 255);
|
|
1596
|
+
return t;
|
|
1597
|
+
}
|
|
1598
|
+
function tt(n, t) {
|
|
1599
|
+
for (var e, a, l, x = [], d = 0; d < n.length && !((t -= 2) < 0); ++d)
|
|
1600
|
+
e = n.charCodeAt(d), a = e >> 8, l = e % 256, x.push(l), x.push(a);
|
|
1601
|
+
return x;
|
|
1602
|
+
}
|
|
1603
|
+
function ct(n) {
|
|
1604
|
+
return i.toByteArray(Z(n));
|
|
1605
|
+
}
|
|
1606
|
+
function _t(n, t, e, a) {
|
|
1607
|
+
for (var l = 0; l < a && !(l + e >= t.length || l >= n.length); ++l)
|
|
1608
|
+
t[l + e] = n[l];
|
|
1609
|
+
return l;
|
|
1610
|
+
}
|
|
1611
|
+
function it(n, t) {
|
|
1612
|
+
return n instanceof t || n != null && n.constructor != null && n.constructor.name != null && n.constructor.name === t.name;
|
|
1613
|
+
}
|
|
1614
|
+
function Ct(n) {
|
|
1615
|
+
return n !== n;
|
|
1616
|
+
}
|
|
1617
|
+
var Je = function() {
|
|
1618
|
+
for (var n = "0123456789abcdef", t = new Array(256), e = 0; e < 16; ++e)
|
|
1619
|
+
for (var a = e * 16, l = 0; l < 16; ++l)
|
|
1620
|
+
t[a + l] = n[e] + n[l];
|
|
1621
|
+
return t;
|
|
1622
|
+
}();
|
|
1623
|
+
})(_e);
|
|
1624
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1625
|
+
(function(r, i) {
|
|
1626
|
+
var o = _e, p = o.Buffer;
|
|
1627
|
+
function u(c, s) {
|
|
1628
|
+
for (var h in c)
|
|
1629
|
+
s[h] = c[h];
|
|
1630
|
+
}
|
|
1631
|
+
p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? r.exports = o : (u(o, i), i.Buffer = f);
|
|
1632
|
+
function f(c, s, h) {
|
|
1633
|
+
return p(c, s, h);
|
|
1634
|
+
}
|
|
1635
|
+
f.prototype = Object.create(p.prototype), u(p, f), f.from = function(c, s, h) {
|
|
1636
|
+
if (typeof c == "number")
|
|
1637
|
+
throw new TypeError("Argument must not be a number");
|
|
1638
|
+
return p(c, s, h);
|
|
1639
|
+
}, f.alloc = function(c, s, h) {
|
|
1640
|
+
if (typeof c != "number")
|
|
1641
|
+
throw new TypeError("Argument must be a number");
|
|
1642
|
+
var g = p(c);
|
|
1643
|
+
return s !== void 0 ? typeof h == "string" ? g.fill(s, h) : g.fill(s) : g.fill(0), g;
|
|
1644
|
+
}, f.allocUnsafe = function(c) {
|
|
1645
|
+
if (typeof c != "number")
|
|
1646
|
+
throw new TypeError("Argument must be a number");
|
|
1647
|
+
return p(c);
|
|
1648
|
+
}, f.allocUnsafeSlow = function(c) {
|
|
1649
|
+
if (typeof c != "number")
|
|
1650
|
+
throw new TypeError("Argument must be a number");
|
|
1651
|
+
return o.SlowBuffer(c);
|
|
1652
|
+
};
|
|
1653
|
+
})(Rt, Rt.exports);
|
|
1654
|
+
var Kt = Rt.exports, Se = Kt.Buffer;
|
|
1655
|
+
function kt(r, i) {
|
|
1656
|
+
this._block = Se.alloc(r), this._finalSize = i, this._blockSize = r, this._len = 0;
|
|
1657
|
+
}
|
|
1658
|
+
kt.prototype.update = function(r, i) {
|
|
1659
|
+
typeof r == "string" && (i = i || "utf8", r = Se.from(r, i));
|
|
1660
|
+
for (var o = this._block, p = this._blockSize, u = r.length, f = this._len, c = 0; c < u; ) {
|
|
1661
|
+
for (var s = f % p, h = Math.min(u - c, p - s), g = 0; g < h; g++)
|
|
1662
|
+
o[s + g] = r[c + g];
|
|
1663
|
+
f += h, c += h, f % p === 0 && this._update(o);
|
|
1664
|
+
}
|
|
1665
|
+
return this._len += u, this;
|
|
1666
|
+
};
|
|
1667
|
+
kt.prototype.digest = function(r) {
|
|
1668
|
+
var i = this._len % this._blockSize;
|
|
1669
|
+
this._block[i] = 128, this._block.fill(0, i + 1), i >= this._finalSize && (this._update(this._block), this._block.fill(0));
|
|
1670
|
+
var o = this._len * 8;
|
|
1671
|
+
if (o <= 4294967295)
|
|
1672
|
+
this._block.writeUInt32BE(o, this._blockSize - 4);
|
|
1673
|
+
else {
|
|
1674
|
+
var p = (o & 4294967295) >>> 0, u = (o - p) / 4294967296;
|
|
1675
|
+
this._block.writeUInt32BE(u, this._blockSize - 8), this._block.writeUInt32BE(p, this._blockSize - 4);
|
|
1676
|
+
}
|
|
1677
|
+
this._update(this._block);
|
|
1678
|
+
var f = this._hash();
|
|
1679
|
+
return r ? f.toString(r) : f;
|
|
1680
|
+
};
|
|
1681
|
+
kt.prototype._update = function() {
|
|
1682
|
+
throw new Error("_update must be implemented by subclass");
|
|
1683
|
+
};
|
|
1684
|
+
var Fe = kt, yr = ve, Be = Fe, wr = Kt.Buffer, Er = [
|
|
1685
|
+
1518500249,
|
|
1686
|
+
1859775393,
|
|
1687
|
+
-1894007588,
|
|
1688
|
+
-899497514
|
|
1689
|
+
], br = new Array(80);
|
|
1690
|
+
function bt() {
|
|
1691
|
+
this.init(), this._w = br, Be.call(this, 64, 56);
|
|
1692
|
+
}
|
|
1693
|
+
yr(bt, Be);
|
|
1694
|
+
bt.prototype.init = function() {
|
|
1695
|
+
return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
|
|
1696
|
+
};
|
|
1697
|
+
function vr(r) {
|
|
1698
|
+
return r << 1 | r >>> 31;
|
|
1699
|
+
}
|
|
1700
|
+
function _r(r) {
|
|
1701
|
+
return r << 5 | r >>> 27;
|
|
1702
|
+
}
|
|
1703
|
+
function Ar(r) {
|
|
1704
|
+
return r << 30 | r >>> 2;
|
|
1705
|
+
}
|
|
1706
|
+
function Sr(r, i, o, p) {
|
|
1707
|
+
return r === 0 ? i & o | ~i & p : r === 2 ? i & o | i & p | o & p : i ^ o ^ p;
|
|
1708
|
+
}
|
|
1709
|
+
bt.prototype._update = function(r) {
|
|
1710
|
+
for (var i = this._w, o = this._a | 0, p = this._b | 0, u = this._c | 0, f = this._d | 0, c = this._e | 0, s = 0; s < 16; ++s)
|
|
1711
|
+
i[s] = r.readInt32BE(s * 4);
|
|
1712
|
+
for (; s < 80; ++s)
|
|
1713
|
+
i[s] = vr(i[s - 3] ^ i[s - 8] ^ i[s - 14] ^ i[s - 16]);
|
|
1714
|
+
for (var h = 0; h < 80; ++h) {
|
|
1715
|
+
var g = ~~(h / 20), y = _r(o) + Sr(g, p, u, f) + c + i[h] + Er[g] | 0;
|
|
1716
|
+
c = f, f = u, u = Ar(p), p = o, o = y;
|
|
1717
|
+
}
|
|
1718
|
+
this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = u + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0;
|
|
1719
|
+
};
|
|
1720
|
+
bt.prototype._hash = function() {
|
|
1721
|
+
var r = wr.allocUnsafe(20);
|
|
1722
|
+
return r.writeInt32BE(this._a | 0, 0), r.writeInt32BE(this._b | 0, 4), r.writeInt32BE(this._c | 0, 8), r.writeInt32BE(this._d | 0, 12), r.writeInt32BE(this._e | 0, 16), r;
|
|
1723
|
+
};
|
|
1724
|
+
var Fr = bt;
|
|
1725
|
+
const Br = /* @__PURE__ */ Xt(Fr);
|
|
1726
|
+
var Or = ve, Oe = Fe, Ir = Kt.Buffer, jr = [
|
|
1727
|
+
1116352408,
|
|
1728
|
+
1899447441,
|
|
1729
|
+
3049323471,
|
|
1730
|
+
3921009573,
|
|
1731
|
+
961987163,
|
|
1732
|
+
1508970993,
|
|
1733
|
+
2453635748,
|
|
1734
|
+
2870763221,
|
|
1735
|
+
3624381080,
|
|
1736
|
+
310598401,
|
|
1737
|
+
607225278,
|
|
1738
|
+
1426881987,
|
|
1739
|
+
1925078388,
|
|
1740
|
+
2162078206,
|
|
1741
|
+
2614888103,
|
|
1742
|
+
3248222580,
|
|
1743
|
+
3835390401,
|
|
1744
|
+
4022224774,
|
|
1745
|
+
264347078,
|
|
1746
|
+
604807628,
|
|
1747
|
+
770255983,
|
|
1748
|
+
1249150122,
|
|
1749
|
+
1555081692,
|
|
1750
|
+
1996064986,
|
|
1751
|
+
2554220882,
|
|
1752
|
+
2821834349,
|
|
1753
|
+
2952996808,
|
|
1754
|
+
3210313671,
|
|
1755
|
+
3336571891,
|
|
1756
|
+
3584528711,
|
|
1757
|
+
113926993,
|
|
1758
|
+
338241895,
|
|
1759
|
+
666307205,
|
|
1760
|
+
773529912,
|
|
1761
|
+
1294757372,
|
|
1762
|
+
1396182291,
|
|
1763
|
+
1695183700,
|
|
1764
|
+
1986661051,
|
|
1765
|
+
2177026350,
|
|
1766
|
+
2456956037,
|
|
1767
|
+
2730485921,
|
|
1768
|
+
2820302411,
|
|
1769
|
+
3259730800,
|
|
1770
|
+
3345764771,
|
|
1771
|
+
3516065817,
|
|
1772
|
+
3600352804,
|
|
1773
|
+
4094571909,
|
|
1774
|
+
275423344,
|
|
1775
|
+
430227734,
|
|
1776
|
+
506948616,
|
|
1777
|
+
659060556,
|
|
1778
|
+
883997877,
|
|
1779
|
+
958139571,
|
|
1780
|
+
1322822218,
|
|
1781
|
+
1537002063,
|
|
1782
|
+
1747873779,
|
|
1783
|
+
1955562222,
|
|
1784
|
+
2024104815,
|
|
1785
|
+
2227730452,
|
|
1786
|
+
2361852424,
|
|
1787
|
+
2428436474,
|
|
1788
|
+
2756734187,
|
|
1789
|
+
3204031479,
|
|
1790
|
+
3329325298
|
|
1791
|
+
], kr = new Array(64);
|
|
1792
|
+
function vt() {
|
|
1793
|
+
this.init(), this._w = kr, Oe.call(this, 64, 56);
|
|
1794
|
+
}
|
|
1795
|
+
Or(vt, Oe);
|
|
1796
|
+
vt.prototype.init = function() {
|
|
1797
|
+
return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;
|
|
1798
|
+
};
|
|
1799
|
+
function Tr(r, i, o) {
|
|
1800
|
+
return o ^ r & (i ^ o);
|
|
1801
|
+
}
|
|
1802
|
+
function Dr(r, i, o) {
|
|
1803
|
+
return r & i | o & (r | i);
|
|
1804
|
+
}
|
|
1805
|
+
function Cr(r) {
|
|
1806
|
+
return (r >>> 2 | r << 30) ^ (r >>> 13 | r << 19) ^ (r >>> 22 | r << 10);
|
|
1807
|
+
}
|
|
1808
|
+
function Ur(r) {
|
|
1809
|
+
return (r >>> 6 | r << 26) ^ (r >>> 11 | r << 21) ^ (r >>> 25 | r << 7);
|
|
1810
|
+
}
|
|
1811
|
+
function $r(r) {
|
|
1812
|
+
return (r >>> 7 | r << 25) ^ (r >>> 18 | r << 14) ^ r >>> 3;
|
|
1813
|
+
}
|
|
1814
|
+
function Nr(r) {
|
|
1815
|
+
return (r >>> 17 | r << 15) ^ (r >>> 19 | r << 13) ^ r >>> 10;
|
|
1816
|
+
}
|
|
1817
|
+
vt.prototype._update = function(r) {
|
|
1818
|
+
for (var i = this._w, o = this._a | 0, p = this._b | 0, u = this._c | 0, f = this._d | 0, c = this._e | 0, s = this._f | 0, h = this._g | 0, g = this._h | 0, y = 0; y < 16; ++y)
|
|
1819
|
+
i[y] = r.readInt32BE(y * 4);
|
|
1820
|
+
for (; y < 64; ++y)
|
|
1821
|
+
i[y] = Nr(i[y - 2]) + i[y - 7] + $r(i[y - 15]) + i[y - 16] | 0;
|
|
1822
|
+
for (var _ = 0; _ < 64; ++_) {
|
|
1823
|
+
var F = g + Ur(c) + Tr(c, s, h) + jr[_] + i[_] | 0, A = Cr(o) + Dr(o, p, u) | 0;
|
|
1824
|
+
g = h, h = s, s = c, c = f + F | 0, f = u, u = p, p = o, o = F + A | 0;
|
|
1825
|
+
}
|
|
1826
|
+
this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = u + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0, this._f = s + this._f | 0, this._g = h + this._g | 0, this._h = g + this._h | 0;
|
|
1827
|
+
};
|
|
1828
|
+
vt.prototype._hash = function() {
|
|
1829
|
+
var r = Ir.allocUnsafe(32);
|
|
1830
|
+
return r.writeInt32BE(this._a, 0), r.writeInt32BE(this._b, 4), r.writeInt32BE(this._c, 8), r.writeInt32BE(this._d, 12), r.writeInt32BE(this._e, 16), r.writeInt32BE(this._f, 20), r.writeInt32BE(this._g, 24), r.writeInt32BE(this._h, 28), r;
|
|
1831
|
+
};
|
|
1832
|
+
var Mr = vt;
|
|
1833
|
+
const Rr = /* @__PURE__ */ Xt(Mr), Gt = new Error("File system not available.");
|
|
1834
|
+
function Lr(r, i, o) {
|
|
1835
|
+
throw Gt;
|
|
1836
|
+
}
|
|
1837
|
+
function Ie(r) {
|
|
1838
|
+
throw Gt;
|
|
1839
|
+
}
|
|
1840
|
+
function Pr(r) {
|
|
1841
|
+
throw Gt;
|
|
1842
|
+
}
|
|
1843
|
+
const zr = async (r) => Ie(), qr = {
|
|
1844
|
+
sha1: Br,
|
|
1845
|
+
sha256: Rr
|
|
1846
|
+
}, Tt = (r, i = "sha1") => {
|
|
1847
|
+
if (!["sha1", "sha256"].includes(i))
|
|
1848
|
+
throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
|
|
1849
|
+
const o = qr[i];
|
|
1850
|
+
return new o().update(r).digest("base64");
|
|
1851
|
+
};
|
|
1852
|
+
function Hr(r) {
|
|
1853
|
+
const i = [], o = Object.keys(r);
|
|
1854
|
+
for (const p of o) {
|
|
1855
|
+
const u = r[p].sort((f, c) => f.index - c.index);
|
|
1856
|
+
for (let f = 0; f < u.length; f++)
|
|
1857
|
+
u[f].index !== f && i.push({
|
|
1858
|
+
message: `Invalid operation index ${u[f].index} at position ${f}`,
|
|
1859
|
+
details: {
|
|
1860
|
+
position: f,
|
|
1861
|
+
operation: u[f],
|
|
1862
|
+
scope: u[f].scope
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
return i;
|
|
1867
|
+
}
|
|
1868
|
+
const je = async (r) => {
|
|
1869
|
+
const i = new oe(), { name: o, revision: p, documentType: u, created: f, lastModified: c } = r, s = {
|
|
1870
|
+
name: o,
|
|
1871
|
+
revision: p,
|
|
1872
|
+
documentType: u,
|
|
1873
|
+
created: f,
|
|
1874
|
+
lastModified: c
|
|
1875
|
+
};
|
|
1876
|
+
return i.file("header.json", JSON.stringify(s, null, 2)), i.file(
|
|
1877
|
+
"state.json",
|
|
1878
|
+
JSON.stringify(r.initialState || {}, null, 2)
|
|
1879
|
+
), i.file("operations.json", JSON.stringify(r.operations, null, 2)), Object.keys(r.attachments).forEach((g) => {
|
|
1880
|
+
const { data: y, ..._ } = r.attachments[g];
|
|
1881
|
+
i.file(g, y, {
|
|
1882
|
+
base64: !0,
|
|
1883
|
+
createFolders: !0,
|
|
1884
|
+
comment: JSON.stringify(_)
|
|
1885
|
+
});
|
|
1886
|
+
}), i;
|
|
1887
|
+
}, Jr = async (r, i, o, p) => {
|
|
1888
|
+
await (await je(r)).generateAsync({
|
|
1889
|
+
type: "uint8array",
|
|
1890
|
+
streamFiles: !0
|
|
1891
|
+
});
|
|
1892
|
+
const f = p ?? r.name, c = `.${o}.zip`;
|
|
1893
|
+
return Lr(
|
|
1894
|
+
i,
|
|
1895
|
+
f.endsWith(c) ? f : `${f}${c}`
|
|
1896
|
+
);
|
|
1897
|
+
}, gi = async (r, i) => {
|
|
1898
|
+
const p = await (await je(r)).generateAsync({ type: "blob" }), u = await i.createWritable();
|
|
1899
|
+
await u.write(p), await u.close();
|
|
1900
|
+
}, ie = async (r, i, o) => {
|
|
1901
|
+
const p = Ie();
|
|
1902
|
+
return Wr(p, i, o);
|
|
1903
|
+
}, Wr = async (r, i, o) => {
|
|
1904
|
+
const p = new oe();
|
|
1905
|
+
return await p.loadAsync(r), Xr(p, i, o);
|
|
1906
|
+
};
|
|
1907
|
+
async function Xr(r, i, o) {
|
|
1908
|
+
const p = r.file("state.json");
|
|
1909
|
+
if (!p)
|
|
1910
|
+
throw new Error("Initial state not found");
|
|
1911
|
+
const u = await p.async("string"), f = JSON.parse(u), c = r.file("header.json");
|
|
1912
|
+
let s;
|
|
1913
|
+
c && (s = JSON.parse(await c.async("string")));
|
|
1914
|
+
const h = r.file("operations.json");
|
|
1915
|
+
if (!h)
|
|
1916
|
+
throw new Error("Operations history not found");
|
|
1917
|
+
const g = JSON.parse(
|
|
1918
|
+
await h.async("string")
|
|
1919
|
+
), y = Hr(g);
|
|
1920
|
+
if (y.length) {
|
|
1921
|
+
const F = y.map((A) => A.message);
|
|
1922
|
+
throw new Error(F.join(`
|
|
1923
|
+
`));
|
|
1924
|
+
}
|
|
1925
|
+
let _ = Re(
|
|
1926
|
+
f,
|
|
1927
|
+
g,
|
|
1928
|
+
i,
|
|
1929
|
+
void 0,
|
|
1930
|
+
s,
|
|
1931
|
+
{},
|
|
1932
|
+
o
|
|
1933
|
+
);
|
|
1934
|
+
return s && (_ = {
|
|
1935
|
+
..._,
|
|
1936
|
+
...s
|
|
1937
|
+
}), _;
|
|
1938
|
+
}
|
|
1939
|
+
function ke(r) {
|
|
1940
|
+
const i = r.replace(/^.*\./, "") || void 0, o = r.replace(/^.*[/\\]/, "") || void 0;
|
|
1941
|
+
return { extension: i, fileName: o };
|
|
1942
|
+
}
|
|
1943
|
+
async function yi(r) {
|
|
1944
|
+
const { buffer: i, mimeType: o = "application/octet-stream" } = await Pr(), p = ke(r), u = i.toString("base64");
|
|
1945
|
+
return {
|
|
1946
|
+
data: u,
|
|
1947
|
+
hash: Tt(u),
|
|
1948
|
+
mimeType: o,
|
|
1949
|
+
...p
|
|
1950
|
+
};
|
|
1951
|
+
}
|
|
1952
|
+
async function wi(r) {
|
|
1953
|
+
const i = await zr(), o = cr.getType(r) || "application/octet-stream", p = ke(r), u = i.toString("base64");
|
|
1954
|
+
return { data: u, hash: Tt(u), mimeType: o, ...p };
|
|
1955
|
+
}
|
|
1956
|
+
var Te = /* @__PURE__ */ ((r) => (r.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", r))(Te || {}), De = /* @__PURE__ */ ((r) => (r.DUPLICATED_INDEX = "DUPLICATED_INDEX", r.MISSING_INDEX = "MISSING_INDEX", r))(De || {});
|
|
1957
|
+
function Zt(r) {
|
|
1958
|
+
const i = [];
|
|
1959
|
+
let o = -1;
|
|
1960
|
+
for (const p of r) {
|
|
1961
|
+
const u = p.index - p.skip;
|
|
1962
|
+
u !== o + 1 && i.push({
|
|
1963
|
+
operation: {
|
|
1964
|
+
index: p.index,
|
|
1965
|
+
skip: p.skip
|
|
1966
|
+
},
|
|
1967
|
+
issue: "UNEXPECTED_INDEX",
|
|
1968
|
+
category: u > o + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
|
|
1969
|
+
message: `Expected index ${o + 1} with skip 0 or equivalent, got index ${p.index} with skip ${p.skip}`
|
|
1970
|
+
}), o = p.index;
|
|
1971
|
+
}
|
|
1972
|
+
return i;
|
|
1973
|
+
}
|
|
1974
|
+
function ot(r) {
|
|
1975
|
+
var p, u, f;
|
|
1976
|
+
const i = [];
|
|
1977
|
+
let o = r.length - 1;
|
|
1978
|
+
for (; o > -1; ) {
|
|
1979
|
+
i.unshift(r[o]);
|
|
1980
|
+
const c = (((p = r[o]) == null ? void 0 : p.index) || 0) - (((u = r[o]) == null ? void 0 : u.skip) || 0) - 1;
|
|
1981
|
+
let s = o - 1;
|
|
1982
|
+
for (; s > -1 && (((f = r[s]) == null ? void 0 : f.index) || 0) > c; )
|
|
1983
|
+
s--;
|
|
1984
|
+
o = s;
|
|
1985
|
+
}
|
|
1986
|
+
return i;
|
|
1987
|
+
}
|
|
1988
|
+
function Vr(r) {
|
|
1989
|
+
const i = [...r], o = i[i.length - 1];
|
|
1990
|
+
return o && (o.type === "NOOP" ? i.push({
|
|
1991
|
+
...o,
|
|
1992
|
+
index: o.index,
|
|
1993
|
+
type: "NOOP",
|
|
1994
|
+
skip: $e(r)
|
|
1995
|
+
}) : i.push({
|
|
1996
|
+
type: "NOOP",
|
|
1997
|
+
index: o.index + 1,
|
|
1998
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1999
|
+
input: {},
|
|
2000
|
+
skip: 1,
|
|
2001
|
+
scope: o.scope,
|
|
2002
|
+
hash: o.hash
|
|
2003
|
+
})), i;
|
|
2004
|
+
}
|
|
2005
|
+
function at(r) {
|
|
2006
|
+
return r.slice().sort((i, o) => i.skip - o.skip).sort((i, o) => i.index - o.index);
|
|
2007
|
+
}
|
|
2008
|
+
const Kr = (r, i, o) => [...i, ...o].sort(
|
|
2009
|
+
(p, u) => new Date(p.timestamp).getTime() - new Date(u.timestamp).getTime()
|
|
2010
|
+
).map((p, u) => ({
|
|
2011
|
+
...p,
|
|
2012
|
+
index: r.index + u,
|
|
2013
|
+
skip: u === 0 ? r.skip : 0
|
|
2014
|
+
})), Gr = (r, i, o) => [...i, ...o].sort(
|
|
2015
|
+
(p, u) => new Date(p.timestamp).getTime() - new Date(u.timestamp).getTime()
|
|
2016
|
+
).sort((p, u) => p.index - u.index).map((p, u) => ({
|
|
2017
|
+
...p,
|
|
2018
|
+
index: r.index + u,
|
|
2019
|
+
skip: u === 0 ? r.skip : 0
|
|
2020
|
+
}));
|
|
2021
|
+
function Yt(r, i) {
|
|
2022
|
+
return xt(r) === xt(i);
|
|
2023
|
+
}
|
|
2024
|
+
function Zr(r, i) {
|
|
2025
|
+
const o = ot(at(r.slice())), p = ot(at(i.slice()));
|
|
2026
|
+
if (o.length < 1)
|
|
2027
|
+
return [p, []];
|
|
2028
|
+
const u = [];
|
|
2029
|
+
let f = !1;
|
|
2030
|
+
for (; p.length > 0; ) {
|
|
2031
|
+
const c = p[0];
|
|
2032
|
+
let s = o.shift();
|
|
2033
|
+
for (; s && Ce(s, c); )
|
|
2034
|
+
u.push(s), s = o.shift();
|
|
2035
|
+
if (s ? f || (Yt(s, c) ? (p.shift(), u.push(s)) : (o.unshift(s), f = !0)) : f = !0, f) {
|
|
2036
|
+
let h = p.shift();
|
|
2037
|
+
for (; h; )
|
|
2038
|
+
u.push(h), h = p.shift();
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
if (!f) {
|
|
2042
|
+
let c = o.shift();
|
|
2043
|
+
for (; c; )
|
|
2044
|
+
u.push(c), c = o.shift();
|
|
2045
|
+
}
|
|
2046
|
+
return [ot(u), o];
|
|
2047
|
+
}
|
|
2048
|
+
function Ce(r, i) {
|
|
2049
|
+
return r.index < i.index || r.index === i.index && r.skip < i.skip;
|
|
2050
|
+
}
|
|
2051
|
+
function Ue(r, i) {
|
|
2052
|
+
const o = [], p = [], u = [], f = Math.max(
|
|
2053
|
+
r.length,
|
|
2054
|
+
i.length
|
|
2055
|
+
);
|
|
2056
|
+
let c = !1;
|
|
2057
|
+
for (let s = 0; s < f; s++) {
|
|
2058
|
+
const h = r[s], g = i[s];
|
|
2059
|
+
h && g ? !c && Yt(h, g) ? o.push(h) : (c = !0, p.push(h), u.push(g)) : h ? p.push(h) : g && u.push(g);
|
|
2060
|
+
}
|
|
2061
|
+
return [o, p, u];
|
|
2062
|
+
}
|
|
2063
|
+
function Yr(r, i, o) {
|
|
2064
|
+
const [p, u, f] = Ue(
|
|
2065
|
+
ot(r),
|
|
2066
|
+
ot(i)
|
|
2067
|
+
), c = $t(p), s = 1 + Math.max(
|
|
2068
|
+
c,
|
|
2069
|
+
$t(u),
|
|
2070
|
+
$t(f)
|
|
2071
|
+
), h = o(
|
|
2072
|
+
{
|
|
2073
|
+
index: s,
|
|
2074
|
+
skip: s - (c + 1)
|
|
2075
|
+
},
|
|
2076
|
+
u,
|
|
2077
|
+
f
|
|
2078
|
+
);
|
|
2079
|
+
return p.concat(h);
|
|
2080
|
+
}
|
|
2081
|
+
function $t(r) {
|
|
2082
|
+
const i = r[r.length - 1];
|
|
2083
|
+
return i ? i.index : -1;
|
|
2084
|
+
}
|
|
2085
|
+
function $e(r) {
|
|
2086
|
+
var p, u, f;
|
|
2087
|
+
if (r.length < 1)
|
|
2088
|
+
return -1;
|
|
2089
|
+
const i = ot(r);
|
|
2090
|
+
let o = (((p = i[i.length - 1]) == null ? void 0 : p.skip) || 0) + 1;
|
|
2091
|
+
return i.length > 1 && (o += ((u = i[i.length - 2]) == null ? void 0 : u.skip) || 0), (((f = i[i.length - 1]) == null ? void 0 : f.index) || -1) < o ? -1 : o;
|
|
2092
|
+
}
|
|
2093
|
+
const Qr = (r) => Zt(
|
|
2094
|
+
ot(at(r))
|
|
2095
|
+
), ti = (r) => r.reduce((o, p) => {
|
|
2096
|
+
var u;
|
|
2097
|
+
return o[p.scope] || (o[p.scope] = []), (u = o[p.scope]) == null || u.push(p), o;
|
|
2098
|
+
}, {}), ei = (r, i) => {
|
|
2099
|
+
var h;
|
|
2100
|
+
const o = {
|
|
2101
|
+
integrityIssues: [],
|
|
2102
|
+
validOperations: [],
|
|
2103
|
+
invalidOperations: [],
|
|
2104
|
+
duplicatedOperations: []
|
|
2105
|
+
}, p = at(r), u = at(i), f = Zt([
|
|
2106
|
+
...p,
|
|
2107
|
+
...u
|
|
2108
|
+
]), s = (h = [...f.filter(
|
|
2109
|
+
(g) => g.category === "MISSING_INDEX"
|
|
2110
|
+
/* MISSING_INDEX */
|
|
2111
|
+
)].sort((g, y) => y.operation.index - g.operation.index).pop()) == null ? void 0 : h.operation;
|
|
2112
|
+
for (const g of u) {
|
|
2113
|
+
if (s && g.index >= s.index) {
|
|
2114
|
+
o.invalidOperations.push(g);
|
|
2115
|
+
continue;
|
|
2116
|
+
}
|
|
2117
|
+
if (f.some((_) => _.operation.index === g.index && _.operation.skip === g.skip && _.category === "DUPLICATED_INDEX")) {
|
|
2118
|
+
o.duplicatedOperations.push(g);
|
|
2119
|
+
continue;
|
|
2120
|
+
}
|
|
2121
|
+
o.validOperations.push(g);
|
|
2122
|
+
}
|
|
2123
|
+
return o.integrityIssues.push(...f), o;
|
|
2124
|
+
};
|
|
2125
|
+
function ri(r, i) {
|
|
2126
|
+
return r.filter((o) => !i.some((p) => o.type === "NOOP" && o.skip === 0 && o.index === p.index || o.index === p.index && o.skip === p.skip && o.scope === p.scope && o.hash === p.hash && o.type === p.type));
|
|
2127
|
+
}
|
|
2128
|
+
function Ne(r, i) {
|
|
2129
|
+
const [o] = at(r).slice(-1), p = (o == null ? void 0 : o.index) ?? -1, u = p + 1, f = {
|
|
2130
|
+
...i,
|
|
2131
|
+
index: i.index ?? u
|
|
2132
|
+
};
|
|
2133
|
+
if (f.index < p)
|
|
2134
|
+
throw new Error(
|
|
2135
|
+
`The skip header operation index must be greater than or equal to ${p}`
|
|
2136
|
+
);
|
|
2137
|
+
return (ot(
|
|
2138
|
+
at([...r, f])
|
|
2139
|
+
) || []).slice(0, -1);
|
|
2140
|
+
}
|
|
2141
|
+
function Lt(r) {
|
|
2142
|
+
return {
|
|
2143
|
+
...Object.entries(r).reduce(
|
|
2144
|
+
(o, p) => {
|
|
2145
|
+
const [u, f] = p;
|
|
2146
|
+
return {
|
|
2147
|
+
...o,
|
|
2148
|
+
[u]: ot(at(f))
|
|
2149
|
+
};
|
|
2150
|
+
},
|
|
2151
|
+
{}
|
|
2152
|
+
)
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
const Ei = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2156
|
+
__proto__: null,
|
|
2157
|
+
IntegrityIssueSubType: De,
|
|
2158
|
+
IntegrityIssueType: Te,
|
|
2159
|
+
addUndo: Vr,
|
|
2160
|
+
attachBranch: Zr,
|
|
2161
|
+
checkCleanedOperationsIntegrity: Zt,
|
|
2162
|
+
checkOperationsIntegrity: Qr,
|
|
2163
|
+
garbageCollect: ot,
|
|
2164
|
+
grabageCollectDocumentOperations: Lt,
|
|
2165
|
+
groupOperationsByScope: ti,
|
|
2166
|
+
merge: Yr,
|
|
2167
|
+
nextSkipNumber: $e,
|
|
2168
|
+
operationsAreEqual: Yt,
|
|
2169
|
+
precedes: Ce,
|
|
2170
|
+
prepareOperations: ei,
|
|
2171
|
+
removeExistingOperations: ri,
|
|
2172
|
+
reshuffleByTimestamp: Kr,
|
|
2173
|
+
reshuffleByTimestampAndIndex: Gr,
|
|
2174
|
+
skipHeaderOperations: Ne,
|
|
2175
|
+
sortOperations: at,
|
|
2176
|
+
split: Ue
|
|
2177
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2178
|
+
function ii(r, i) {
|
|
2179
|
+
let o;
|
|
2180
|
+
return "index" in i ? o = { ...i } : o = r.operations[i.scope].at(-1), ((o == null ? void 0 : o.index) ?? -1) + 1;
|
|
2181
|
+
}
|
|
2182
|
+
function ni(r, i) {
|
|
2183
|
+
return {
|
|
2184
|
+
...r,
|
|
2185
|
+
revision: {
|
|
2186
|
+
...r.revision,
|
|
2187
|
+
[i.scope]: ii(r, i)
|
|
2188
|
+
},
|
|
2189
|
+
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
function oi(r, i, o = 0) {
|
|
2193
|
+
if ([wt, Et, It].includes(i.type))
|
|
2194
|
+
return r;
|
|
2195
|
+
const { scope: p } = i, u = r.operations[p].slice(
|
|
2196
|
+
0,
|
|
2197
|
+
r.revision[p]
|
|
2198
|
+
), f = [...u].pop();
|
|
2199
|
+
let c = ((f == null ? void 0 : f.index) ?? -1) + 1;
|
|
2200
|
+
if ("index" in i) {
|
|
2201
|
+
if (i.index - o > c)
|
|
2202
|
+
throw new Error(
|
|
2203
|
+
`Missing operations: expected ${c} with skip 0 or equivalent, got index ${i.index} with skip ${o}`
|
|
2204
|
+
);
|
|
2205
|
+
c = i.index;
|
|
2206
|
+
}
|
|
2207
|
+
return u.push({
|
|
2208
|
+
...i,
|
|
2209
|
+
index: c,
|
|
2210
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2211
|
+
hash: "",
|
|
2212
|
+
scope: p,
|
|
2213
|
+
skip: o,
|
|
2214
|
+
error: void 0
|
|
2215
|
+
}), {
|
|
2216
|
+
...r,
|
|
2217
|
+
operations: { ...r.operations, [p]: u }
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
function ai(r, i, o = 0) {
|
|
2221
|
+
let p = oi(r, i, o);
|
|
2222
|
+
return p = ni(p, i), p;
|
|
2223
|
+
}
|
|
2224
|
+
function si(r, i, o) {
|
|
2225
|
+
switch (fe().parse(i), i.type) {
|
|
2226
|
+
case we:
|
|
2227
|
+
return rr(r, i.input);
|
|
2228
|
+
case It:
|
|
2229
|
+
return or(r, i, o);
|
|
2230
|
+
case Ee:
|
|
2231
|
+
return ar(r, i.input.state);
|
|
2232
|
+
default:
|
|
2233
|
+
return r;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
function bi(r, i, o) {
|
|
2237
|
+
switch (i.type) {
|
|
2238
|
+
case wt:
|
|
2239
|
+
return ir(r, i, o);
|
|
2240
|
+
case Et:
|
|
2241
|
+
return nr(r, i, o);
|
|
2242
|
+
default:
|
|
2243
|
+
return { document: r, action: i, skip: o };
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
function pi(r, i, o, p) {
|
|
2247
|
+
const u = i.scope, f = r.operations[u].at(-1);
|
|
2248
|
+
if (!f)
|
|
2249
|
+
return r;
|
|
2250
|
+
const c = Lt(
|
|
2251
|
+
{
|
|
2252
|
+
...r.operations,
|
|
2253
|
+
[u]: Ne(
|
|
2254
|
+
r.operations[u],
|
|
2255
|
+
f
|
|
2256
|
+
)
|
|
2257
|
+
}
|
|
2258
|
+
), { state: s } = Pt(
|
|
2259
|
+
r.initialState,
|
|
2260
|
+
c,
|
|
2261
|
+
o,
|
|
2262
|
+
void 0,
|
|
2263
|
+
void 0,
|
|
2264
|
+
void 0
|
|
2265
|
+
);
|
|
2266
|
+
return {
|
|
2267
|
+
...r,
|
|
2268
|
+
state: s,
|
|
2269
|
+
operations: Lt({
|
|
2270
|
+
...r.operations
|
|
2271
|
+
})
|
|
2272
|
+
};
|
|
2273
|
+
}
|
|
2274
|
+
function Me(r, i, o, p, u = {}) {
|
|
2275
|
+
const { skip: f, ignoreSkipOperations: c = !1, reuseHash: s = !1 } = u, h = { ...i }, g = f || 0;
|
|
2276
|
+
let y = { ...r };
|
|
2277
|
+
const _ = !c && (g > 0 || "index" in h && h.skip > 0);
|
|
2278
|
+
return ne(h) && (y = si(y, h, o)), y = ai(y, h, g), _ && (y = pi(
|
|
2279
|
+
y,
|
|
2280
|
+
h,
|
|
2281
|
+
o
|
|
2282
|
+
)), y = Ot(y, (F) => {
|
|
2283
|
+
try {
|
|
2284
|
+
const A = o(
|
|
2285
|
+
F.state,
|
|
2286
|
+
h,
|
|
2287
|
+
p
|
|
2288
|
+
);
|
|
2289
|
+
if (A)
|
|
2290
|
+
return Bt({
|
|
2291
|
+
...y,
|
|
2292
|
+
// clipboard: [...clipboardValue],
|
|
2293
|
+
state: A
|
|
2294
|
+
});
|
|
2295
|
+
} catch (A) {
|
|
2296
|
+
const $ = y.operations[h.scope].length - 1;
|
|
2297
|
+
F.operations[h.scope][$].error = A.message, F.operations[h.scope][$].skip = 0, _ && (F.state = Bt({ ...r.state }), F.operations = Bt({
|
|
2298
|
+
...r.operations,
|
|
2299
|
+
[h.scope]: [
|
|
2300
|
+
...r.operations[h.scope],
|
|
2301
|
+
{
|
|
2302
|
+
...F.operations[h.scope][$]
|
|
2303
|
+
}
|
|
2304
|
+
]
|
|
2305
|
+
}));
|
|
2306
|
+
}
|
|
2307
|
+
}), Ot(y, (F) => {
|
|
2308
|
+
if ([wt, Et, It].includes(h.type))
|
|
2309
|
+
return F;
|
|
2310
|
+
const A = h.scope || "global", $ = s && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : Qt(F, A);
|
|
2311
|
+
F.operations[A][F.operations[A].length - 1].hash = $, !ne(h) && h.attachments && h.attachments.forEach((R) => {
|
|
2312
|
+
const { hash: Y, ...w } = R;
|
|
2313
|
+
F.attachments[Y] = {
|
|
2314
|
+
...w
|
|
2315
|
+
};
|
|
2316
|
+
});
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
function vi(r) {
|
|
2320
|
+
return r.type === sr && r.skip !== void 0 && r.skip > 0 && r.hash !== void 0;
|
|
2321
|
+
}
|
|
2322
|
+
function _i(r) {
|
|
2323
|
+
return [wt, Et].includes(r.type);
|
|
2324
|
+
}
|
|
2325
|
+
function ne(r) {
|
|
2326
|
+
return [we, wt, Et, It, Ee].includes(r.type);
|
|
2327
|
+
}
|
|
2328
|
+
function dt(r, i, o, p, u = "global") {
|
|
2329
|
+
if (!r)
|
|
2330
|
+
throw new Error("Empty action type");
|
|
2331
|
+
if (typeof r != "string")
|
|
2332
|
+
throw new Error(`Invalid action type: ${JSON.stringify(r)}`);
|
|
2333
|
+
const f = { type: r, input: i, scope: u };
|
|
2334
|
+
o && (f.attachments = o);
|
|
2335
|
+
try {
|
|
2336
|
+
p == null || p().parse(f.input);
|
|
2337
|
+
} catch (c) {
|
|
2338
|
+
throw new Error(`Invalid action input: ${c}`);
|
|
2339
|
+
}
|
|
2340
|
+
return f;
|
|
2341
|
+
}
|
|
2342
|
+
function ci(r, i = Me) {
|
|
2343
|
+
return (o, p, u, f) => i(o, p, r, u, f);
|
|
2344
|
+
}
|
|
2345
|
+
const li = (r, i) => ({
|
|
2346
|
+
name: "",
|
|
2347
|
+
documentType: "",
|
|
2348
|
+
revision: {
|
|
2349
|
+
global: 0,
|
|
2350
|
+
local: 0
|
|
2351
|
+
},
|
|
2352
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2353
|
+
lastModified: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2354
|
+
attachments: {},
|
|
2355
|
+
...r,
|
|
2356
|
+
state: (i == null ? void 0 : i(r == null ? void 0 : r.state)) ?? (r == null ? void 0 : r.state) ?? { global: {}, local: {} }
|
|
2357
|
+
}), ui = (r, i) => {
|
|
2358
|
+
const o = li(
|
|
2359
|
+
r,
|
|
2360
|
+
i
|
|
2361
|
+
);
|
|
2362
|
+
return {
|
|
2363
|
+
...o,
|
|
2364
|
+
initialState: o,
|
|
2365
|
+
operations: { global: [], local: [] },
|
|
2366
|
+
clipboard: []
|
|
2367
|
+
};
|
|
2368
|
+
}, Qt = (r, i = "global") => Tt(xt(r.state[i] || "")), Ai = (r, i = 1e3) => {
|
|
2369
|
+
const o = Math.random() * i;
|
|
2370
|
+
return Tt(`${(r ?? /* @__PURE__ */ new Date()).toISOString()}${o}`);
|
|
2371
|
+
};
|
|
2372
|
+
function Ft(r) {
|
|
2373
|
+
return Ve(Ke(r, !0));
|
|
2374
|
+
}
|
|
2375
|
+
function Si(r, i) {
|
|
2376
|
+
const o = [...r];
|
|
2377
|
+
let p = i || 0, u = o.length > 0 ? o[o.length - 1].index : 0;
|
|
2378
|
+
const f = [];
|
|
2379
|
+
for (const c of o.reverse()) {
|
|
2380
|
+
if (p > 0) {
|
|
2381
|
+
const g = u - c.index;
|
|
2382
|
+
p -= g;
|
|
2383
|
+
}
|
|
2384
|
+
if (p < 0)
|
|
2385
|
+
throw new Error("Invalid operation index, missing operations");
|
|
2386
|
+
const s = {
|
|
2387
|
+
ignore: p > 0,
|
|
2388
|
+
operation: c
|
|
2389
|
+
}, h = c.skip > 0 ? c.skip + 1 : 0;
|
|
2390
|
+
if (h > 0 && h > p) {
|
|
2391
|
+
const g = h - p;
|
|
2392
|
+
p = p + g;
|
|
2393
|
+
}
|
|
2394
|
+
u = c.index, f.push(s);
|
|
2395
|
+
}
|
|
2396
|
+
return f.reverse();
|
|
2397
|
+
}
|
|
2398
|
+
function Fi(r, i, o) {
|
|
2399
|
+
const p = r.slice().sort((s, h) => s.skip - h.skip).sort((s, h) => s.index - h.index);
|
|
2400
|
+
let u = o, f = 0, c = i;
|
|
2401
|
+
for (const s of p.reverse()) {
|
|
2402
|
+
const h = c - s.index;
|
|
2403
|
+
if (u = u - h, u > -1)
|
|
2404
|
+
f++, c = s.index;
|
|
2405
|
+
else
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2408
|
+
return f;
|
|
2409
|
+
}
|
|
2410
|
+
function Bi(r) {
|
|
2411
|
+
return Object.values(r).flatMap((i) => i).sort(
|
|
2412
|
+
(i, o) => new Date(i.timestamp).getTime() - new Date(o.timestamp).getTime()
|
|
2413
|
+
);
|
|
2414
|
+
}
|
|
2415
|
+
function Oi(r) {
|
|
2416
|
+
return Object.values(r).flatMap((i) => i).sort(
|
|
2417
|
+
(i, o) => new Date(i.operation.timestamp).getTime() - new Date(o.operation.timestamp).getTime()
|
|
2418
|
+
);
|
|
2419
|
+
}
|
|
2420
|
+
function Pt(r, i, o, p, u, f = Me, c = {}, s) {
|
|
2421
|
+
const h = ci(o, f);
|
|
2422
|
+
return Re(
|
|
2423
|
+
r,
|
|
2424
|
+
i,
|
|
2425
|
+
h,
|
|
2426
|
+
p,
|
|
2427
|
+
u,
|
|
2428
|
+
c,
|
|
2429
|
+
s
|
|
2430
|
+
);
|
|
2431
|
+
}
|
|
2432
|
+
function Re(r, i, o, p, u, f = {}, c) {
|
|
2433
|
+
const s = (c == null ? void 0 : c.checkHashes) ?? !0, h = ui(r), g = Object.values(i).flat(), y = g.reduce((A, $) => o(A, $, p, {
|
|
2434
|
+
skip: $.skip,
|
|
2435
|
+
ignoreSkipOperations: !0,
|
|
2436
|
+
reuseHash: !s
|
|
2437
|
+
}), h);
|
|
2438
|
+
if (!s)
|
|
2439
|
+
for (const A of Object.keys(y.state))
|
|
2440
|
+
for (let $ = g.length - 1; $ >= 0; $--) {
|
|
2441
|
+
const R = g[$];
|
|
2442
|
+
if (R.scope === A) {
|
|
2443
|
+
if (R.hash !== Qt(y, A))
|
|
2444
|
+
throw new Error(`Hash mismatch for scope ${A}`);
|
|
2445
|
+
break;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
const _ = Object.keys(
|
|
2449
|
+
y.operations
|
|
2450
|
+
).reduce(
|
|
2451
|
+
(A, $) => {
|
|
2452
|
+
const R = $;
|
|
2453
|
+
return {
|
|
2454
|
+
...A,
|
|
2455
|
+
[R]: [
|
|
2456
|
+
...y.operations[R].map((Y, w) => {
|
|
2457
|
+
var E;
|
|
2458
|
+
return {
|
|
2459
|
+
...Y,
|
|
2460
|
+
timestamp: ((E = i[R][w]) == null ? void 0 : E.timestamp) ?? Y.timestamp
|
|
2461
|
+
};
|
|
2462
|
+
})
|
|
2463
|
+
]
|
|
2464
|
+
};
|
|
2465
|
+
},
|
|
2466
|
+
{ global: [], local: [] }
|
|
2467
|
+
), F = Object.values(_).reduce((A, $) => {
|
|
2468
|
+
const R = $[$.length - 1];
|
|
2469
|
+
return (R == null ? void 0 : R.timestamp) > A && (A = R.timestamp), A;
|
|
2470
|
+
}, r.lastModified);
|
|
2471
|
+
return { ...y, operations: _, lastModified: F };
|
|
2472
|
+
}
|
|
2473
|
+
function Ii(r, i) {
|
|
2474
|
+
return xt(r) === xt(i);
|
|
2475
|
+
}
|
|
2476
|
+
const Le = (r) => dt(
|
|
2477
|
+
"SET_NAME",
|
|
2478
|
+
r,
|
|
2479
|
+
void 0,
|
|
2480
|
+
Jt,
|
|
2481
|
+
void 0
|
|
2482
|
+
), Pe = (r = 1, i = "global") => dt(
|
|
2483
|
+
"UNDO",
|
|
2484
|
+
r,
|
|
2485
|
+
void 0,
|
|
2486
|
+
Wt,
|
|
2487
|
+
i
|
|
2488
|
+
), ze = (r = 1, i = "global") => dt(
|
|
2489
|
+
"REDO",
|
|
2490
|
+
r,
|
|
2491
|
+
void 0,
|
|
2492
|
+
Ht,
|
|
2493
|
+
i
|
|
2494
|
+
), qe = (r, i, o = "global") => dt(
|
|
2495
|
+
"PRUNE",
|
|
2496
|
+
{ start: r, end: i },
|
|
2497
|
+
void 0,
|
|
2498
|
+
qt,
|
|
2499
|
+
o
|
|
2500
|
+
), te = (r, i) => dt(
|
|
2501
|
+
"LOAD_STATE",
|
|
2502
|
+
{ state: r, operations: i },
|
|
2503
|
+
void 0,
|
|
2504
|
+
zt
|
|
2505
|
+
), He = (r = "global") => dt("NOOP", {}, void 0, void 0, r), ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2506
|
+
__proto__: null,
|
|
2507
|
+
loadState: te,
|
|
2508
|
+
noop: He,
|
|
2509
|
+
prune: qe,
|
|
2510
|
+
redo: ze,
|
|
2511
|
+
setName: Le,
|
|
2512
|
+
undo: Pe
|
|
2513
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2514
|
+
class ki {
|
|
2515
|
+
/**
|
|
2516
|
+
* Constructs a BaseDocument instance with an initial state.
|
|
2517
|
+
* @param reducer - The reducer function that updates the state.
|
|
2518
|
+
* @param document - The initial state of the document.
|
|
2519
|
+
*/
|
|
2520
|
+
constructor(i, o, p) {
|
|
2521
|
+
St(this, "_document");
|
|
2522
|
+
St(this, "_reducer");
|
|
2523
|
+
St(this, "_signalDispatch");
|
|
2524
|
+
this._reducer = i, this._document = o, this._signalDispatch = p;
|
|
2525
|
+
}
|
|
2526
|
+
/**
|
|
2527
|
+
* Dispatches an action to update the state of the document.
|
|
2528
|
+
* @param action - The action to dispatch.
|
|
2529
|
+
* @returns The Document instance.
|
|
2530
|
+
*/
|
|
2531
|
+
dispatch(i, o) {
|
|
2532
|
+
return this._document = this._reducer(
|
|
2533
|
+
this._document,
|
|
2534
|
+
i,
|
|
2535
|
+
this._signalDispatch,
|
|
2536
|
+
o
|
|
2537
|
+
), this;
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Saves the state of the document to a file.
|
|
2541
|
+
* @param path - The file path where the state should be saved.
|
|
2542
|
+
* @param extension - The file extension to use when saving the state.
|
|
2543
|
+
* @returns The file path where the state was saved.
|
|
2544
|
+
*/
|
|
2545
|
+
saveToFile(i, o, p) {
|
|
2546
|
+
return Jr(this._document, i, o, p);
|
|
2547
|
+
}
|
|
2548
|
+
/**
|
|
2549
|
+
* Loads the state of the document from a file.
|
|
2550
|
+
* @param path - The file path where the state is stored.
|
|
2551
|
+
*/
|
|
2552
|
+
async loadFromFile(i) {
|
|
2553
|
+
this._document = await ie(i, this._reducer);
|
|
2554
|
+
}
|
|
2555
|
+
/**
|
|
2556
|
+
* Loads the state of the document from a file and returns it.
|
|
2557
|
+
* @param path - The file path where the state is stored.
|
|
2558
|
+
* @param reducer - The reducer function that updates the state.
|
|
2559
|
+
* @returns The state of the document.
|
|
2560
|
+
*/
|
|
2561
|
+
static async stateFromFile(i, o) {
|
|
2562
|
+
return await ie(i, o);
|
|
2563
|
+
}
|
|
2564
|
+
/**
|
|
2565
|
+
* Gets the current state of the document.
|
|
2566
|
+
*/
|
|
2567
|
+
get state() {
|
|
2568
|
+
return Ft(this._document.state);
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* Gets the list of operations performed on the document.
|
|
2572
|
+
*/
|
|
2573
|
+
get operations() {
|
|
2574
|
+
return Ft(this._document.operations);
|
|
2575
|
+
}
|
|
2576
|
+
/**
|
|
2577
|
+
* Gets the name of the document.
|
|
2578
|
+
*/
|
|
2579
|
+
get name() {
|
|
2580
|
+
return this._document.name;
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Gets the type of document.
|
|
2584
|
+
*/
|
|
2585
|
+
get documentType() {
|
|
2586
|
+
return this._document.documentType;
|
|
2587
|
+
}
|
|
2588
|
+
/**
|
|
2589
|
+
* Gets the timestamp of the date the document was created.
|
|
2590
|
+
*/
|
|
2591
|
+
get created() {
|
|
2592
|
+
return this._document.created;
|
|
2593
|
+
}
|
|
2594
|
+
/**
|
|
2595
|
+
* Gets the timestamp of the date the document was last modified.
|
|
2596
|
+
*/
|
|
2597
|
+
get lastModified() {
|
|
2598
|
+
return this._document.lastModified;
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Gets the global revision number of the document.
|
|
2602
|
+
*/
|
|
2603
|
+
get revision() {
|
|
2604
|
+
return this._document.revision.global;
|
|
2605
|
+
}
|
|
2606
|
+
getRevision(i) {
|
|
2607
|
+
return this._document.revision[i];
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Gets the initial state of the document.
|
|
2611
|
+
*/
|
|
2612
|
+
get initialState() {
|
|
2613
|
+
return Ft(this._document.initialState);
|
|
2614
|
+
}
|
|
2615
|
+
/**
|
|
2616
|
+
* Returns the current document as an object
|
|
2617
|
+
*/
|
|
2618
|
+
toDocument() {
|
|
2619
|
+
return Ft(this._document);
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* Gets the attachment associated with the given key.
|
|
2623
|
+
* @param attachment - The key of the attachment to retrieve.
|
|
2624
|
+
*/
|
|
2625
|
+
getAttachment(i) {
|
|
2626
|
+
return this._document.attachments[i];
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Sets the name of the document.
|
|
2630
|
+
* @param name - The new name of the document.
|
|
2631
|
+
*/
|
|
2632
|
+
setName(i) {
|
|
2633
|
+
return this.dispatch(Le(i)), this;
|
|
2634
|
+
}
|
|
2635
|
+
/**
|
|
2636
|
+
* Reverts a number of actions from the document.
|
|
2637
|
+
* @param count - The number of actions to revert.
|
|
2638
|
+
*/
|
|
2639
|
+
undo(i) {
|
|
2640
|
+
return this.dispatch(Pe(i)), this;
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Reapplies a number of actions to the document.
|
|
2644
|
+
* @param count - The number of actions to reapply.
|
|
2645
|
+
*/
|
|
2646
|
+
redo(i) {
|
|
2647
|
+
return this.dispatch(ze(i)), this;
|
|
2648
|
+
}
|
|
2649
|
+
/**
|
|
2650
|
+
* Removes a range of operations from the document.
|
|
2651
|
+
* @param start - The starting index of the range to remove.
|
|
2652
|
+
* @param end - The ending index of the range to remove.
|
|
2653
|
+
*/
|
|
2654
|
+
prune(i, o) {
|
|
2655
|
+
return this.dispatch(qe(i, o)), this;
|
|
2656
|
+
}
|
|
2657
|
+
/**
|
|
2658
|
+
* Loads a document state and a set of operations.
|
|
2659
|
+
* @param state - The state to load.
|
|
2660
|
+
* @param operations - The operations to apply to the document.
|
|
2661
|
+
*/
|
|
2662
|
+
loadState(i, o) {
|
|
2663
|
+
return this.dispatch(te(i, o)), this;
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
function Ti(r, i) {
|
|
2667
|
+
i.forEach((o) => {
|
|
2668
|
+
Object.getOwnPropertyNames(o.prototype).forEach((p) => {
|
|
2669
|
+
Object.defineProperty(
|
|
2670
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2671
|
+
r.prototype,
|
|
2672
|
+
p,
|
|
2673
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
2674
|
+
Object.getOwnPropertyDescriptor(o.prototype, p) || /* @__PURE__ */ Object.create(null)
|
|
2675
|
+
);
|
|
2676
|
+
});
|
|
2677
|
+
});
|
|
2678
|
+
}
|
|
2679
|
+
export {
|
|
2680
|
+
Bi as A,
|
|
2681
|
+
ki as B,
|
|
2682
|
+
Hr as C,
|
|
2683
|
+
Me as D,
|
|
2684
|
+
bi as E,
|
|
2685
|
+
di as F,
|
|
2686
|
+
li as a,
|
|
2687
|
+
ui as b,
|
|
2688
|
+
ci as c,
|
|
2689
|
+
gi as d,
|
|
2690
|
+
Wr as e,
|
|
2691
|
+
dt as f,
|
|
2692
|
+
Ti as g,
|
|
2693
|
+
ji as h,
|
|
2694
|
+
ne as i,
|
|
2695
|
+
Fi as j,
|
|
2696
|
+
je as k,
|
|
2697
|
+
ie as l,
|
|
2698
|
+
Ei as m,
|
|
2699
|
+
wi as n,
|
|
2700
|
+
yi as o,
|
|
2701
|
+
Qt as p,
|
|
2702
|
+
Ai as q,
|
|
2703
|
+
vi as r,
|
|
2704
|
+
Jr as s,
|
|
2705
|
+
Ii as t,
|
|
2706
|
+
_i as u,
|
|
2707
|
+
Si as v,
|
|
2708
|
+
Ft as w,
|
|
2709
|
+
Re as x,
|
|
2710
|
+
Pt as y,
|
|
2711
|
+
Oi as z
|
|
2712
|
+
};
|