document-model 1.0.41 → 1.0.43
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/document-model.cjs +1 -1
- package/dist/browser/document-model.js +14 -15
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +9 -10
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +6 -7
- package/dist/browser/internal/{index-BWV1Osza.js → index-CDcO7NCS.js} +3 -4
- package/dist/browser/internal/{index-BD_7XeO5.js → index-CfgX2mMt.js} +1 -1
- package/dist/browser/internal/{index-BxGRRPwY.js → index-DhzefrNj.js} +1 -1
- package/dist/{node/internal/index-LEexvgqj.js → browser/internal/index-EdTViyyq.js} +1 -1
- package/dist/browser/internal/object-BkewFVld.js +25 -0
- package/dist/browser/internal/object-CrDRbO7a.js +2492 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +15 -16
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +9 -10
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +7 -8
- package/dist/node/internal/{index-Dh0vfIdX.js → index-BWW7KbVk.js} +2 -2
- package/dist/node/internal/{index-DeKx7EaE.js → index-Cz8HaIxu.js} +3 -4
- package/dist/{browser/internal/index-BNBYVtaF.js → node/internal/index-D_LMFQg7.js} +1 -1
- package/dist/node/internal/{index-LD_vrQff.js → index-fctxJxHD.js} +1 -1
- package/dist/node/internal/object-BDRv-l-h.js +1390 -0
- package/dist/node/internal/object-Br6jYeW0.js +20 -0
- package/dist/src/document/actions/creators.d.ts +47 -0
- package/dist/src/document/actions/index.d.ts +14 -0
- package/dist/src/document/actions/types.d.ts +15 -0
- package/dist/src/document/index.d.ts +6 -0
- package/dist/src/document/object.d.ts +1140 -0
- package/dist/src/document/reducer.d.ts +32 -0
- package/dist/src/document/schema/index.d.ts +2 -0
- package/dist/src/document/schema/types.d.ts +176 -0
- package/dist/src/document/schema/zod.d.ts +113 -0
- package/dist/src/document/signal.d.ts +29 -0
- package/dist/src/document/types.d.ts +245 -0
- package/dist/src/document/utils/base.d.ts +80 -0
- package/dist/src/document/utils/browser.d.ts +10 -0
- package/dist/src/document/utils/file.d.ts +47 -0
- package/dist/src/document/utils/index.d.ts +4 -0
- package/dist/src/document/utils/node.d.ts +9 -0
- package/dist/src/document/utils/validation.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/header.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/module.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-error.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-example.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/state.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/versioning.d.ts +7 -0
- package/dist/src/document-model/custom/utils.d.ts +7 -0
- package/dist/src/document-model/gen/actions.d.ts +15 -0
- package/dist/src/document-model/gen/creators.d.ts +7 -0
- package/dist/src/document-model/gen/document-model.d.ts +2 -0
- package/dist/src/document-model/gen/header/actions.d.ts +9 -0
- package/dist/src/document-model/gen/header/creators.d.ts +8 -0
- package/dist/src/document-model/gen/header/object.d.ts +12 -0
- package/dist/src/document-model/gen/header/operations.d.ts +10 -0
- package/dist/src/document-model/gen/index.d.ts +5 -0
- package/dist/src/document-model/gen/module/actions.d.ts +8 -0
- package/dist/src/document-model/gen/module/creators.d.ts +7 -0
- package/dist/src/document-model/gen/module/object.d.ts +11 -0
- package/dist/src/document-model/gen/module/operations.d.ts +9 -0
- package/dist/src/document-model/gen/object.d.ts +28 -0
- package/dist/src/document-model/gen/operation/actions.d.ts +13 -0
- package/dist/src/document-model/gen/operation/creators.d.ts +12 -0
- package/dist/src/document-model/gen/operation/object.d.ts +16 -0
- package/dist/src/document-model/gen/operation/operations.d.ts +14 -0
- package/dist/src/document-model/gen/operation-error/actions.d.ts +10 -0
- package/dist/src/document-model/gen/operation-error/creators.d.ts +9 -0
- package/dist/src/document-model/gen/operation-error/object.d.ts +13 -0
- package/dist/src/document-model/gen/operation-error/operations.d.ts +11 -0
- package/dist/src/document-model/gen/operation-example/actions.d.ts +7 -0
- package/dist/src/document-model/gen/operation-example/creators.d.ts +6 -0
- package/dist/src/document-model/gen/operation-example/object.d.ts +10 -0
- package/dist/src/document-model/gen/operation-example/operations.d.ts +8 -0
- package/dist/src/document-model/gen/reducer.d.ts +5 -0
- package/dist/src/document-model/gen/schema/index.d.ts +2 -0
- package/dist/src/document-model/gen/schema/types.d.ts +453 -0
- package/dist/src/document-model/gen/schema/zod.d.ts +453 -0
- package/dist/src/document-model/gen/state/actions.d.ts +9 -0
- package/dist/src/document-model/gen/state/creators.d.ts +8 -0
- package/dist/src/document-model/gen/state/object.d.ts +12 -0
- package/dist/src/document-model/gen/state/operations.d.ts +10 -0
- package/dist/src/document-model/gen/types.d.ts +8 -0
- package/dist/src/document-model/gen/utils.d.ts +6 -0
- package/dist/src/document-model/gen/versioning/actions.d.ts +8 -0
- package/dist/src/document-model/gen/versioning/creators.d.ts +7 -0
- package/dist/src/document-model/gen/versioning/object.d.ts +11 -0
- package/dist/src/document-model/gen/versioning/operations.d.ts +9 -0
- package/dist/src/document-model/index.d.ts +80 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/test/document/event-vs-command.test.d.ts +1 -0
- package/dist/test/document/local.test.d.ts +1 -0
- package/dist/test/document/object.test.d.ts +1 -0
- package/dist/test/document/prune.test.d.ts +1 -0
- package/dist/test/document/reducer.test.d.ts +1 -0
- package/dist/test/document/skip-operations.test.d.ts +1 -0
- package/dist/test/document/undo-redo.test.d.ts +1 -0
- package/dist/test/document/utils.test.d.ts +1 -0
- package/dist/test/document-model/object.test.d.ts +1 -0
- package/dist/test/document-model/skip-operations.test.d.ts +1 -0
- package/dist/test/document-model/validation.test.d.ts +1 -0
- package/dist/test/document-model/zip.test.d.ts +1 -0
- package/dist/test/helpers.d.ts +34 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vitest.config.d.ts +2 -0
- package/package.json +3 -2
- package/dist/browser/internal/object-DHqlosWD.js +0 -7
- package/dist/browser/internal/object-StihF423.js +0 -1999
- package/dist/node/internal/object-CKxJA706.js +0 -2
- package/dist/node/internal/object-CudRLU4J.js +0 -998
|
@@ -1,1999 +0,0 @@
|
|
|
1
|
-
var je = Object.defineProperty;
|
|
2
|
-
var Ie = (n, i, p) => i in n ? je(n, i, { enumerable: !0, configurable: !0, writable: !0, value: p }) : n[i] = p;
|
|
3
|
-
var V = (n, i, p) => (Ie(n, typeof i != "symbol" ? i + "" : i, p), p);
|
|
4
|
-
import { produce as q, castDraft as at, castImmutable as Oe, freeze as Ue } from "immer";
|
|
5
|
-
import pt from "json-stringify-deterministic";
|
|
6
|
-
import { z as w } from "zod";
|
|
7
|
-
import Dt from "jszip";
|
|
8
|
-
const Mt = (n) => n != null, Te = w.any().refine((n) => Mt(n)), Nt = w.enum(["LOAD_STATE"]), Rt = w.enum(["PRUNE"]), Ct = w.enum(["REDO"]), Lt = w.enum(["SET_NAME"]), zt = w.enum(["UNDO"]);
|
|
9
|
-
function De() {
|
|
10
|
-
return w.object({
|
|
11
|
-
__typename: w.literal("Action").optional(),
|
|
12
|
-
type: w.string()
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function W() {
|
|
16
|
-
return w.literal("global").or(w.literal("local"));
|
|
17
|
-
}
|
|
18
|
-
function $t() {
|
|
19
|
-
return w.union([
|
|
20
|
-
Pt(),
|
|
21
|
-
Wt(),
|
|
22
|
-
Jt(),
|
|
23
|
-
Ht(),
|
|
24
|
-
Zt()
|
|
25
|
-
]);
|
|
26
|
-
}
|
|
27
|
-
function Me() {
|
|
28
|
-
return w.object({
|
|
29
|
-
__typename: w.literal("DocumentFile").optional(),
|
|
30
|
-
data: w.string(),
|
|
31
|
-
extension: w.string().nullable(),
|
|
32
|
-
fileName: w.string().nullable(),
|
|
33
|
-
mimeType: w.string()
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function Pt() {
|
|
37
|
-
return w.object({
|
|
38
|
-
input: w.lazy(() => ut()),
|
|
39
|
-
type: Nt,
|
|
40
|
-
scope: W()
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function ut() {
|
|
44
|
-
return w.object({
|
|
45
|
-
operations: w.number(),
|
|
46
|
-
state: w.lazy(() => qt())
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function qt() {
|
|
50
|
-
return w.object({
|
|
51
|
-
data: w.unknown().nullish(),
|
|
52
|
-
name: w.string()
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function Ne() {
|
|
56
|
-
return w.object({
|
|
57
|
-
__typename: w.literal("Operation").optional(),
|
|
58
|
-
hash: w.string(),
|
|
59
|
-
index: w.number(),
|
|
60
|
-
timestamp: w.string().datetime(),
|
|
61
|
-
type: w.string()
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function Wt() {
|
|
65
|
-
return w.object({
|
|
66
|
-
input: w.lazy(() => ft()),
|
|
67
|
-
type: Rt,
|
|
68
|
-
scope: W()
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function ft() {
|
|
72
|
-
return w.object({
|
|
73
|
-
end: w.number().nullish(),
|
|
74
|
-
start: w.number().nullish()
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
const mt = w.number;
|
|
78
|
-
function Jt() {
|
|
79
|
-
return w.object({
|
|
80
|
-
input: mt(),
|
|
81
|
-
type: Ct,
|
|
82
|
-
scope: W()
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
const ht = w.string;
|
|
86
|
-
function Ht() {
|
|
87
|
-
return w.object({
|
|
88
|
-
input: ht(),
|
|
89
|
-
type: Lt,
|
|
90
|
-
scope: w.literal("global")
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function Re() {
|
|
94
|
-
return w.object({
|
|
95
|
-
__typename: w.literal("SetNameOperation").optional(),
|
|
96
|
-
hash: w.string(),
|
|
97
|
-
index: w.number(),
|
|
98
|
-
input: w.string(),
|
|
99
|
-
timestamp: w.string().datetime(),
|
|
100
|
-
type: w.string()
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
const xt = w.number;
|
|
104
|
-
function Zt() {
|
|
105
|
-
return w.object({
|
|
106
|
-
input: xt(),
|
|
107
|
-
type: zt,
|
|
108
|
-
scope: W()
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
const zi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
112
|
-
__proto__: null,
|
|
113
|
-
ActionSchema: De,
|
|
114
|
-
BaseActionSchema: $t,
|
|
115
|
-
DocumentFileSchema: Me,
|
|
116
|
-
LoadStateActionInputSchema: ut,
|
|
117
|
-
LoadStateActionSchema: Pt,
|
|
118
|
-
LoadStateActionStateInputSchema: qt,
|
|
119
|
-
Load_StateSchema: Nt,
|
|
120
|
-
OperationSchema: Ne,
|
|
121
|
-
OperationScopeSchema: W,
|
|
122
|
-
PruneActionInputSchema: ft,
|
|
123
|
-
PruneActionSchema: Wt,
|
|
124
|
-
PruneSchema: Rt,
|
|
125
|
-
RedoActionInputSchema: mt,
|
|
126
|
-
RedoActionSchema: Jt,
|
|
127
|
-
RedoSchema: Ct,
|
|
128
|
-
SetNameActionInputSchema: ht,
|
|
129
|
-
SetNameActionSchema: Ht,
|
|
130
|
-
SetNameOperationSchema: Re,
|
|
131
|
-
Set_NameSchema: Lt,
|
|
132
|
-
UndoActionInputSchema: xt,
|
|
133
|
-
UndoActionSchema: Zt,
|
|
134
|
-
UndoSchema: zt,
|
|
135
|
-
definedNonNullAnySchema: Te,
|
|
136
|
-
isDefinedNonNullAny: Mt
|
|
137
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
138
|
-
function Ce(n, i) {
|
|
139
|
-
return { ...n, name: i };
|
|
140
|
-
}
|
|
141
|
-
function Le(n, i, p) {
|
|
142
|
-
const c = {
|
|
143
|
-
skip: p,
|
|
144
|
-
document: n
|
|
145
|
-
}, { scope: f } = i;
|
|
146
|
-
return !f || i.skip === void 0 ? c : q(c, (u) => {
|
|
147
|
-
const [l] = u.document.operations[f].slice(-1);
|
|
148
|
-
i.skip && i.skip > 0 && (u.skip = i.skip), l.type === "NOOP" && i.index === l.index && u.skip > l.skip && u.document.operations[f].pop();
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function ze(n, i, p) {
|
|
152
|
-
const { scope: c, input: f } = i;
|
|
153
|
-
return q({
|
|
154
|
-
document: n,
|
|
155
|
-
action: i,
|
|
156
|
-
skip: p
|
|
157
|
-
}, (l) => {
|
|
158
|
-
if (l.document.operations[c].length < 1)
|
|
159
|
-
throw new Error(
|
|
160
|
-
`Cannot undo: no operations in history for scope "${c}"`
|
|
161
|
-
);
|
|
162
|
-
if (f < 1)
|
|
163
|
-
throw new Error(
|
|
164
|
-
"Invalid UNDO action: input value must be greater than 0"
|
|
165
|
-
);
|
|
166
|
-
if (l.skip > 0)
|
|
167
|
-
throw new Error(
|
|
168
|
-
"Cannot undo: skip value from reducer cannot be used with UNDO action"
|
|
169
|
-
);
|
|
170
|
-
const [a] = l.document.operations[c].slice(-1), x = a.type === "NOOP" && a.skip > 0;
|
|
171
|
-
if (l.skip += f, x) {
|
|
172
|
-
l.skip += a.skip;
|
|
173
|
-
const y = l.document.operations[c][l.document.operations[c].length - 2];
|
|
174
|
-
y && a.index - y.index === 1 && l.document.operations[c].pop();
|
|
175
|
-
}
|
|
176
|
-
if (l.document.operations[c].length < l.skip)
|
|
177
|
-
throw new Error(
|
|
178
|
-
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
179
|
-
);
|
|
180
|
-
const d = l.document.operations[c].length - 1;
|
|
181
|
-
let v = f, g = x ? d - a.skip : d;
|
|
182
|
-
for (; v > 0 && g >= 0; ) {
|
|
183
|
-
const y = l.document.operations[c][g];
|
|
184
|
-
if (!y) {
|
|
185
|
-
v--, g--;
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
y.type === "NOOP" && y.skip > 0 ? (g = g - (y.skip + 1), l.skip += y.skip + 1) : (l.document.clipboard.push({ ...y }), v--, g--);
|
|
189
|
-
}
|
|
190
|
-
l.action = yt(c);
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
function $e(n, i, p) {
|
|
194
|
-
const { scope: c, input: f } = i;
|
|
195
|
-
return q({
|
|
196
|
-
document: n,
|
|
197
|
-
action: i,
|
|
198
|
-
skip: p
|
|
199
|
-
}, (l) => {
|
|
200
|
-
if (l.skip > 0)
|
|
201
|
-
throw new Error(
|
|
202
|
-
"Cannot redo: skip value from reducer cannot be used with REDO action"
|
|
203
|
-
);
|
|
204
|
-
if (f > 1)
|
|
205
|
-
throw new Error(
|
|
206
|
-
"Cannot redo: you can only redo one operation at a time"
|
|
207
|
-
);
|
|
208
|
-
if (f < 1)
|
|
209
|
-
throw new Error("Invalid REDO action: invalid redo input value");
|
|
210
|
-
if (l.document.clipboard.length < 1)
|
|
211
|
-
throw new Error("Cannot redo: no operations in the clipboard");
|
|
212
|
-
const a = l.document.clipboard.findLastIndex(
|
|
213
|
-
(d) => d.scope === c
|
|
214
|
-
);
|
|
215
|
-
if (a < 0)
|
|
216
|
-
throw new Error(
|
|
217
|
-
`Cannot redo: no operations in clipboard for scope "${c}"`
|
|
218
|
-
);
|
|
219
|
-
const x = l.document.clipboard.splice(a, 1)[0];
|
|
220
|
-
l.action = at({
|
|
221
|
-
type: x.type,
|
|
222
|
-
scope: x.scope,
|
|
223
|
-
input: x.input
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
function Pe(n, i, p) {
|
|
228
|
-
const { scope: c } = i, f = n.operations[c];
|
|
229
|
-
let {
|
|
230
|
-
input: { start: u, end: l }
|
|
231
|
-
} = i;
|
|
232
|
-
u = u || 0, l = l || f.length;
|
|
233
|
-
const a = f.slice(u, l), x = f.slice(0, u), d = f.slice(l), v = lt(
|
|
234
|
-
n.initialState,
|
|
235
|
-
{
|
|
236
|
-
...n.operations,
|
|
237
|
-
[c]: x.concat(a)
|
|
238
|
-
},
|
|
239
|
-
p
|
|
240
|
-
), { name: g, state: y } = v, b = x.length, E = x.length ? x[x.length - 1].timestamp : d.length ? d[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
241
|
-
return lt(
|
|
242
|
-
n.initialState,
|
|
243
|
-
{
|
|
244
|
-
...n.operations,
|
|
245
|
-
[c]: [
|
|
246
|
-
...x,
|
|
247
|
-
{
|
|
248
|
-
...gt(
|
|
249
|
-
{ name: g, state: y },
|
|
250
|
-
a.length
|
|
251
|
-
),
|
|
252
|
-
timestamp: E,
|
|
253
|
-
index: b,
|
|
254
|
-
hash: re({ state: y }, "global")
|
|
255
|
-
},
|
|
256
|
-
...d.map((U, R) => ({
|
|
257
|
-
...U,
|
|
258
|
-
index: b + R + 1
|
|
259
|
-
}))
|
|
260
|
-
]
|
|
261
|
-
},
|
|
262
|
-
p
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
function qe(n, i) {
|
|
266
|
-
return {
|
|
267
|
-
...n,
|
|
268
|
-
name: i.name,
|
|
269
|
-
state: i.state ?? { global: {}, local: {} }
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
const Yt = "SET_NAME", J = "UNDO", H = "REDO", Q = "PRUNE", Gt = "LOAD_STATE", We = "NOOP";
|
|
273
|
-
function Je(n, i) {
|
|
274
|
-
let p;
|
|
275
|
-
return "index" in i ? p = { ...i } : p = n.operations[i.scope].slice(-1)[0], ((p == null ? void 0 : p.index) ?? -1) + 1;
|
|
276
|
-
}
|
|
277
|
-
function He(n, i) {
|
|
278
|
-
return {
|
|
279
|
-
...n,
|
|
280
|
-
revision: {
|
|
281
|
-
...n.revision,
|
|
282
|
-
[i.scope]: Je(n, i)
|
|
283
|
-
},
|
|
284
|
-
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function Ze(n, i, p = 0) {
|
|
288
|
-
if ([J, H, Q].includes(i.type))
|
|
289
|
-
return n;
|
|
290
|
-
const { scope: c } = i, f = n.operations[c].slice(
|
|
291
|
-
0,
|
|
292
|
-
n.revision[c]
|
|
293
|
-
), u = [...f].pop();
|
|
294
|
-
let l = ((u == null ? void 0 : u.index) ?? -1) + 1;
|
|
295
|
-
if ("index" in i) {
|
|
296
|
-
if (i.index > l + p)
|
|
297
|
-
throw new Error(
|
|
298
|
-
`Missing operations: expected ${l} with skip 0 or equivalent, got index ${i.index} with skip ${p}`
|
|
299
|
-
);
|
|
300
|
-
l = i.index;
|
|
301
|
-
}
|
|
302
|
-
return f.push({
|
|
303
|
-
...i,
|
|
304
|
-
index: l,
|
|
305
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
306
|
-
hash: "",
|
|
307
|
-
scope: c,
|
|
308
|
-
skip: p
|
|
309
|
-
}), {
|
|
310
|
-
...n,
|
|
311
|
-
operations: { ...n.operations, [c]: f }
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
function Ye(n, i, p = 0) {
|
|
315
|
-
let c = Ze(n, i, p);
|
|
316
|
-
return c = He(c, i), c;
|
|
317
|
-
}
|
|
318
|
-
function Ge(n, i, p) {
|
|
319
|
-
switch ($t().parse(i), i.type) {
|
|
320
|
-
case Yt:
|
|
321
|
-
return Ce(n, i.input);
|
|
322
|
-
case Q:
|
|
323
|
-
return Pe(n, i, p);
|
|
324
|
-
case Gt:
|
|
325
|
-
return qe(n, i.input.state);
|
|
326
|
-
default:
|
|
327
|
-
return n;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function Ke(n, i, p) {
|
|
331
|
-
switch (i.type) {
|
|
332
|
-
case J:
|
|
333
|
-
return ze(n, i, p);
|
|
334
|
-
case H:
|
|
335
|
-
return $e(n, i, p);
|
|
336
|
-
default:
|
|
337
|
-
return { document: n, action: i, skip: p };
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function Kt(n, i, p, c, f = {}) {
|
|
341
|
-
const { skip: u, ignoreSkipOperations: l = !1 } = f;
|
|
342
|
-
let a = { ...i }, x = u || 0, d = n, v = [...n.clipboard];
|
|
343
|
-
if (Ei(a)) {
|
|
344
|
-
const { document: g, skip: y } = Le(d, a, x);
|
|
345
|
-
x = y, d = g;
|
|
346
|
-
}
|
|
347
|
-
if (Ot(a)) {
|
|
348
|
-
const {
|
|
349
|
-
skip: g,
|
|
350
|
-
action: y,
|
|
351
|
-
document: b
|
|
352
|
-
} = Ke(n, a, x);
|
|
353
|
-
a = y, x = g, d = b, v = [...d.clipboard];
|
|
354
|
-
}
|
|
355
|
-
if (Ut(a) && (d = Ge(d, a, p)), x > 0 && !l) {
|
|
356
|
-
let g = x;
|
|
357
|
-
"index" in a && (g = Si(
|
|
358
|
-
d.operations[a.scope],
|
|
359
|
-
a.index,
|
|
360
|
-
x
|
|
361
|
-
)), d = lt(
|
|
362
|
-
d.initialState,
|
|
363
|
-
d.operations,
|
|
364
|
-
p,
|
|
365
|
-
void 0,
|
|
366
|
-
void 0,
|
|
367
|
-
void 0,
|
|
368
|
-
{ [a.scope]: g }
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
return d = Ye(d, a, x), d = q(d, (g) => {
|
|
372
|
-
const y = p(
|
|
373
|
-
g.state,
|
|
374
|
-
a,
|
|
375
|
-
c
|
|
376
|
-
), b = Ot(i) ? [...v] : [];
|
|
377
|
-
if (y)
|
|
378
|
-
return at({
|
|
379
|
-
...d,
|
|
380
|
-
clipboard: [...b],
|
|
381
|
-
state: y
|
|
382
|
-
});
|
|
383
|
-
g.clipboard = at([...b]);
|
|
384
|
-
}), q(d, (g) => {
|
|
385
|
-
if ([J, H, Q].includes(a.type))
|
|
386
|
-
return g;
|
|
387
|
-
const y = a.scope || "global";
|
|
388
|
-
g.operations[y][g.operations[y].length - 1].hash = re(g, y), !Ut(a) && a.attachments && a.attachments.forEach((b) => {
|
|
389
|
-
const { hash: E, ...U } = b;
|
|
390
|
-
g.attachments[E] = {
|
|
391
|
-
...U
|
|
392
|
-
};
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
function Ve(n) {
|
|
397
|
-
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
398
|
-
}
|
|
399
|
-
var st = { exports: {} };
|
|
400
|
-
typeof Object.create == "function" ? st.exports = function(i, p) {
|
|
401
|
-
p && (i.super_ = p, i.prototype = Object.create(p.prototype, {
|
|
402
|
-
constructor: {
|
|
403
|
-
value: i,
|
|
404
|
-
enumerable: !1,
|
|
405
|
-
writable: !0,
|
|
406
|
-
configurable: !0
|
|
407
|
-
}
|
|
408
|
-
}));
|
|
409
|
-
} : st.exports = function(i, p) {
|
|
410
|
-
if (p) {
|
|
411
|
-
i.super_ = p;
|
|
412
|
-
var c = function() {
|
|
413
|
-
};
|
|
414
|
-
c.prototype = p.prototype, i.prototype = new c(), i.prototype.constructor = i;
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
var Xe = st.exports, ct = { exports: {} }, Vt = {}, tt = {};
|
|
418
|
-
tt.byteLength = ei;
|
|
419
|
-
tt.toByteArray = ri;
|
|
420
|
-
tt.fromByteArray = ai;
|
|
421
|
-
var D = [], O = [], Qe = typeof Uint8Array < "u" ? Uint8Array : Array, ot = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
422
|
-
for (var C = 0, ti = ot.length; C < ti; ++C)
|
|
423
|
-
D[C] = ot[C], O[ot.charCodeAt(C)] = C;
|
|
424
|
-
O[45] = 62;
|
|
425
|
-
O[95] = 63;
|
|
426
|
-
function Xt(n) {
|
|
427
|
-
var i = n.length;
|
|
428
|
-
if (i % 4 > 0)
|
|
429
|
-
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
430
|
-
var p = n.indexOf("=");
|
|
431
|
-
p === -1 && (p = i);
|
|
432
|
-
var c = p === i ? 0 : 4 - p % 4;
|
|
433
|
-
return [p, c];
|
|
434
|
-
}
|
|
435
|
-
function ei(n) {
|
|
436
|
-
var i = Xt(n), p = i[0], c = i[1];
|
|
437
|
-
return (p + c) * 3 / 4 - c;
|
|
438
|
-
}
|
|
439
|
-
function ii(n, i, p) {
|
|
440
|
-
return (i + p) * 3 / 4 - p;
|
|
441
|
-
}
|
|
442
|
-
function ri(n) {
|
|
443
|
-
var i, p = Xt(n), c = p[0], f = p[1], u = new Qe(ii(n, c, f)), l = 0, a = f > 0 ? c - 4 : c, x;
|
|
444
|
-
for (x = 0; x < a; x += 4)
|
|
445
|
-
i = O[n.charCodeAt(x)] << 18 | O[n.charCodeAt(x + 1)] << 12 | O[n.charCodeAt(x + 2)] << 6 | O[n.charCodeAt(x + 3)], u[l++] = i >> 16 & 255, u[l++] = i >> 8 & 255, u[l++] = i & 255;
|
|
446
|
-
return f === 2 && (i = O[n.charCodeAt(x)] << 2 | O[n.charCodeAt(x + 1)] >> 4, u[l++] = i & 255), f === 1 && (i = O[n.charCodeAt(x)] << 10 | O[n.charCodeAt(x + 1)] << 4 | O[n.charCodeAt(x + 2)] >> 2, u[l++] = i >> 8 & 255, u[l++] = i & 255), u;
|
|
447
|
-
}
|
|
448
|
-
function ni(n) {
|
|
449
|
-
return D[n >> 18 & 63] + D[n >> 12 & 63] + D[n >> 6 & 63] + D[n & 63];
|
|
450
|
-
}
|
|
451
|
-
function oi(n, i, p) {
|
|
452
|
-
for (var c, f = [], u = i; u < p; u += 3)
|
|
453
|
-
c = (n[u] << 16 & 16711680) + (n[u + 1] << 8 & 65280) + (n[u + 2] & 255), f.push(ni(c));
|
|
454
|
-
return f.join("");
|
|
455
|
-
}
|
|
456
|
-
function ai(n) {
|
|
457
|
-
for (var i, p = n.length, c = p % 3, f = [], u = 16383, l = 0, a = p - c; l < a; l += u)
|
|
458
|
-
f.push(oi(n, l, l + u > a ? a : l + u));
|
|
459
|
-
return c === 1 ? (i = n[p - 1], f.push(
|
|
460
|
-
D[i >> 2] + D[i << 4 & 63] + "=="
|
|
461
|
-
)) : c === 2 && (i = (n[p - 2] << 8) + n[p - 1], f.push(
|
|
462
|
-
D[i >> 10] + D[i >> 4 & 63] + D[i << 2 & 63] + "="
|
|
463
|
-
)), f.join("");
|
|
464
|
-
}
|
|
465
|
-
var dt = {};
|
|
466
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
467
|
-
dt.read = function(n, i, p, c, f) {
|
|
468
|
-
var u, l, a = f * 8 - c - 1, x = (1 << a) - 1, d = x >> 1, v = -7, g = p ? f - 1 : 0, y = p ? -1 : 1, b = n[i + g];
|
|
469
|
-
for (g += y, u = b & (1 << -v) - 1, b >>= -v, v += a; v > 0; u = u * 256 + n[i + g], g += y, v -= 8)
|
|
470
|
-
;
|
|
471
|
-
for (l = u & (1 << -v) - 1, u >>= -v, v += c; v > 0; l = l * 256 + n[i + g], g += y, v -= 8)
|
|
472
|
-
;
|
|
473
|
-
if (u === 0)
|
|
474
|
-
u = 1 - d;
|
|
475
|
-
else {
|
|
476
|
-
if (u === x)
|
|
477
|
-
return l ? NaN : (b ? -1 : 1) * (1 / 0);
|
|
478
|
-
l = l + Math.pow(2, c), u = u - d;
|
|
479
|
-
}
|
|
480
|
-
return (b ? -1 : 1) * l * Math.pow(2, u - c);
|
|
481
|
-
};
|
|
482
|
-
dt.write = function(n, i, p, c, f, u) {
|
|
483
|
-
var l, a, x, d = u * 8 - f - 1, v = (1 << d) - 1, g = v >> 1, y = f === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, b = c ? 0 : u - 1, E = c ? 1 : -1, U = i < 0 || i === 0 && 1 / i < 0 ? 1 : 0;
|
|
484
|
-
for (i = Math.abs(i), isNaN(i) || i === 1 / 0 ? (a = isNaN(i) ? 1 : 0, l = v) : (l = Math.floor(Math.log(i) / Math.LN2), i * (x = Math.pow(2, -l)) < 1 && (l--, x *= 2), l + g >= 1 ? i += y / x : i += y * Math.pow(2, 1 - g), i * x >= 2 && (l++, x /= 2), l + g >= v ? (a = 0, l = v) : l + g >= 1 ? (a = (i * x - 1) * Math.pow(2, f), l = l + g) : (a = i * Math.pow(2, g - 1) * Math.pow(2, f), l = 0)); f >= 8; n[p + b] = a & 255, b += E, a /= 256, f -= 8)
|
|
485
|
-
;
|
|
486
|
-
for (l = l << f | a, d += f; d > 0; n[p + b] = l & 255, b += E, l /= 256, d -= 8)
|
|
487
|
-
;
|
|
488
|
-
n[p + b - E] |= U * 128;
|
|
489
|
-
};
|
|
490
|
-
/*!
|
|
491
|
-
* The buffer module from node.js, for the browser.
|
|
492
|
-
*
|
|
493
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
494
|
-
* @license MIT
|
|
495
|
-
*/
|
|
496
|
-
(function(n) {
|
|
497
|
-
var i = tt, p = dt, c = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
498
|
-
n.Buffer = a, n.SlowBuffer = Y, n.INSPECT_MAX_BYTES = 50;
|
|
499
|
-
var f = 2147483647;
|
|
500
|
-
n.kMaxLength = f, a.TYPED_ARRAY_SUPPORT = u(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
501
|
-
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
502
|
-
);
|
|
503
|
-
function u() {
|
|
504
|
-
try {
|
|
505
|
-
var r = new Uint8Array(1), t = { foo: function() {
|
|
506
|
-
return 42;
|
|
507
|
-
} };
|
|
508
|
-
return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(r, t), r.foo() === 42;
|
|
509
|
-
} catch {
|
|
510
|
-
return !1;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
Object.defineProperty(a.prototype, "parent", {
|
|
514
|
-
enumerable: !0,
|
|
515
|
-
get: function() {
|
|
516
|
-
if (a.isBuffer(this))
|
|
517
|
-
return this.buffer;
|
|
518
|
-
}
|
|
519
|
-
}), Object.defineProperty(a.prototype, "offset", {
|
|
520
|
-
enumerable: !0,
|
|
521
|
-
get: function() {
|
|
522
|
-
if (a.isBuffer(this))
|
|
523
|
-
return this.byteOffset;
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
function l(r) {
|
|
527
|
-
if (r > f)
|
|
528
|
-
throw new RangeError('The value "' + r + '" is invalid for option "size"');
|
|
529
|
-
var t = new Uint8Array(r);
|
|
530
|
-
return Object.setPrototypeOf(t, a.prototype), t;
|
|
531
|
-
}
|
|
532
|
-
function a(r, t, e) {
|
|
533
|
-
if (typeof r == "number") {
|
|
534
|
-
if (typeof t == "string")
|
|
535
|
-
throw new TypeError(
|
|
536
|
-
'The "string" argument must be of type string. Received type number'
|
|
537
|
-
);
|
|
538
|
-
return g(r);
|
|
539
|
-
}
|
|
540
|
-
return x(r, t, e);
|
|
541
|
-
}
|
|
542
|
-
a.poolSize = 8192;
|
|
543
|
-
function x(r, t, e) {
|
|
544
|
-
if (typeof r == "string")
|
|
545
|
-
return y(r, t);
|
|
546
|
-
if (ArrayBuffer.isView(r))
|
|
547
|
-
return E(r);
|
|
548
|
-
if (r == null)
|
|
549
|
-
throw new TypeError(
|
|
550
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof r
|
|
551
|
-
);
|
|
552
|
-
if (T(r, ArrayBuffer) || r && T(r.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (T(r, SharedArrayBuffer) || r && T(r.buffer, SharedArrayBuffer)))
|
|
553
|
-
return U(r, t, e);
|
|
554
|
-
if (typeof r == "number")
|
|
555
|
-
throw new TypeError(
|
|
556
|
-
'The "value" argument must not be of type number. Received type number'
|
|
557
|
-
);
|
|
558
|
-
var o = r.valueOf && r.valueOf();
|
|
559
|
-
if (o != null && o !== r)
|
|
560
|
-
return a.from(o, t, e);
|
|
561
|
-
var s = R(r);
|
|
562
|
-
if (s)
|
|
563
|
-
return s;
|
|
564
|
-
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof r[Symbol.toPrimitive] == "function")
|
|
565
|
-
return a.from(
|
|
566
|
-
r[Symbol.toPrimitive]("string"),
|
|
567
|
-
t,
|
|
568
|
-
e
|
|
569
|
-
);
|
|
570
|
-
throw new TypeError(
|
|
571
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof r
|
|
572
|
-
);
|
|
573
|
-
}
|
|
574
|
-
a.from = function(r, t, e) {
|
|
575
|
-
return x(r, t, e);
|
|
576
|
-
}, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
|
|
577
|
-
function d(r) {
|
|
578
|
-
if (typeof r != "number")
|
|
579
|
-
throw new TypeError('"size" argument must be of type number');
|
|
580
|
-
if (r < 0)
|
|
581
|
-
throw new RangeError('The value "' + r + '" is invalid for option "size"');
|
|
582
|
-
}
|
|
583
|
-
function v(r, t, e) {
|
|
584
|
-
return d(r), r <= 0 ? l(r) : t !== void 0 ? typeof e == "string" ? l(r).fill(t, e) : l(r).fill(t) : l(r);
|
|
585
|
-
}
|
|
586
|
-
a.alloc = function(r, t, e) {
|
|
587
|
-
return v(r, t, e);
|
|
588
|
-
};
|
|
589
|
-
function g(r) {
|
|
590
|
-
return d(r), l(r < 0 ? 0 : $(r) | 0);
|
|
591
|
-
}
|
|
592
|
-
a.allocUnsafe = function(r) {
|
|
593
|
-
return g(r);
|
|
594
|
-
}, a.allocUnsafeSlow = function(r) {
|
|
595
|
-
return g(r);
|
|
596
|
-
};
|
|
597
|
-
function y(r, t) {
|
|
598
|
-
if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
|
|
599
|
-
throw new TypeError("Unknown encoding: " + t);
|
|
600
|
-
var e = vt(r, t) | 0, o = l(e), s = o.write(r, t);
|
|
601
|
-
return s !== e && (o = o.slice(0, s)), o;
|
|
602
|
-
}
|
|
603
|
-
function b(r) {
|
|
604
|
-
for (var t = r.length < 0 ? 0 : $(r.length) | 0, e = l(t), o = 0; o < t; o += 1)
|
|
605
|
-
e[o] = r[o] & 255;
|
|
606
|
-
return e;
|
|
607
|
-
}
|
|
608
|
-
function E(r) {
|
|
609
|
-
if (T(r, Uint8Array)) {
|
|
610
|
-
var t = new Uint8Array(r);
|
|
611
|
-
return U(t.buffer, t.byteOffset, t.byteLength);
|
|
612
|
-
}
|
|
613
|
-
return b(r);
|
|
614
|
-
}
|
|
615
|
-
function U(r, t, e) {
|
|
616
|
-
if (t < 0 || r.byteLength < t)
|
|
617
|
-
throw new RangeError('"offset" is outside of buffer bounds');
|
|
618
|
-
if (r.byteLength < t + (e || 0))
|
|
619
|
-
throw new RangeError('"length" is outside of buffer bounds');
|
|
620
|
-
var o;
|
|
621
|
-
return t === void 0 && e === void 0 ? o = new Uint8Array(r) : e === void 0 ? o = new Uint8Array(r, t) : o = new Uint8Array(r, t, e), Object.setPrototypeOf(o, a.prototype), o;
|
|
622
|
-
}
|
|
623
|
-
function R(r) {
|
|
624
|
-
if (a.isBuffer(r)) {
|
|
625
|
-
var t = $(r.length) | 0, e = l(t);
|
|
626
|
-
return e.length === 0 || r.copy(e, 0, 0, t), e;
|
|
627
|
-
}
|
|
628
|
-
if (r.length !== void 0)
|
|
629
|
-
return typeof r.length != "number" || nt(r.length) ? l(0) : b(r);
|
|
630
|
-
if (r.type === "Buffer" && Array.isArray(r.data))
|
|
631
|
-
return b(r.data);
|
|
632
|
-
}
|
|
633
|
-
function $(r) {
|
|
634
|
-
if (r >= f)
|
|
635
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + f.toString(16) + " bytes");
|
|
636
|
-
return r | 0;
|
|
637
|
-
}
|
|
638
|
-
function Y(r) {
|
|
639
|
-
return +r != r && (r = 0), a.alloc(+r);
|
|
640
|
-
}
|
|
641
|
-
a.isBuffer = function(t) {
|
|
642
|
-
return t != null && t._isBuffer === !0 && t !== a.prototype;
|
|
643
|
-
}, a.compare = function(t, e) {
|
|
644
|
-
if (T(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), T(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), !a.isBuffer(t) || !a.isBuffer(e))
|
|
645
|
-
throw new TypeError(
|
|
646
|
-
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
647
|
-
);
|
|
648
|
-
if (t === e)
|
|
649
|
-
return 0;
|
|
650
|
-
for (var o = t.length, s = e.length, m = 0, h = Math.min(o, s); m < h; ++m)
|
|
651
|
-
if (t[m] !== e[m]) {
|
|
652
|
-
o = t[m], s = e[m];
|
|
653
|
-
break;
|
|
654
|
-
}
|
|
655
|
-
return o < s ? -1 : s < o ? 1 : 0;
|
|
656
|
-
}, a.isEncoding = function(t) {
|
|
657
|
-
switch (String(t).toLowerCase()) {
|
|
658
|
-
case "hex":
|
|
659
|
-
case "utf8":
|
|
660
|
-
case "utf-8":
|
|
661
|
-
case "ascii":
|
|
662
|
-
case "latin1":
|
|
663
|
-
case "binary":
|
|
664
|
-
case "base64":
|
|
665
|
-
case "ucs2":
|
|
666
|
-
case "ucs-2":
|
|
667
|
-
case "utf16le":
|
|
668
|
-
case "utf-16le":
|
|
669
|
-
return !0;
|
|
670
|
-
default:
|
|
671
|
-
return !1;
|
|
672
|
-
}
|
|
673
|
-
}, a.concat = function(t, e) {
|
|
674
|
-
if (!Array.isArray(t))
|
|
675
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
676
|
-
if (t.length === 0)
|
|
677
|
-
return a.alloc(0);
|
|
678
|
-
var o;
|
|
679
|
-
if (e === void 0)
|
|
680
|
-
for (e = 0, o = 0; o < t.length; ++o)
|
|
681
|
-
e += t[o].length;
|
|
682
|
-
var s = a.allocUnsafe(e), m = 0;
|
|
683
|
-
for (o = 0; o < t.length; ++o) {
|
|
684
|
-
var h = t[o];
|
|
685
|
-
if (T(h, Uint8Array))
|
|
686
|
-
m + h.length > s.length ? a.from(h).copy(s, m) : Uint8Array.prototype.set.call(
|
|
687
|
-
s,
|
|
688
|
-
h,
|
|
689
|
-
m
|
|
690
|
-
);
|
|
691
|
-
else if (a.isBuffer(h))
|
|
692
|
-
h.copy(s, m);
|
|
693
|
-
else
|
|
694
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
695
|
-
m += h.length;
|
|
696
|
-
}
|
|
697
|
-
return s;
|
|
698
|
-
};
|
|
699
|
-
function vt(r, t) {
|
|
700
|
-
if (a.isBuffer(r))
|
|
701
|
-
return r.length;
|
|
702
|
-
if (ArrayBuffer.isView(r) || T(r, ArrayBuffer))
|
|
703
|
-
return r.byteLength;
|
|
704
|
-
if (typeof r != "string")
|
|
705
|
-
throw new TypeError(
|
|
706
|
-
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof r
|
|
707
|
-
);
|
|
708
|
-
var e = r.length, o = arguments.length > 2 && arguments[2] === !0;
|
|
709
|
-
if (!o && e === 0)
|
|
710
|
-
return 0;
|
|
711
|
-
for (var s = !1; ; )
|
|
712
|
-
switch (t) {
|
|
713
|
-
case "ascii":
|
|
714
|
-
case "latin1":
|
|
715
|
-
case "binary":
|
|
716
|
-
return e;
|
|
717
|
-
case "utf8":
|
|
718
|
-
case "utf-8":
|
|
719
|
-
return rt(r).length;
|
|
720
|
-
case "ucs2":
|
|
721
|
-
case "ucs-2":
|
|
722
|
-
case "utf16le":
|
|
723
|
-
case "utf-16le":
|
|
724
|
-
return e * 2;
|
|
725
|
-
case "hex":
|
|
726
|
-
return e >>> 1;
|
|
727
|
-
case "base64":
|
|
728
|
-
return Bt(r).length;
|
|
729
|
-
default:
|
|
730
|
-
if (s)
|
|
731
|
-
return o ? -1 : rt(r).length;
|
|
732
|
-
t = ("" + t).toLowerCase(), s = !0;
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
a.byteLength = vt;
|
|
736
|
-
function fe(r, t, e) {
|
|
737
|
-
var o = !1;
|
|
738
|
-
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))
|
|
739
|
-
return "";
|
|
740
|
-
for (r || (r = "utf8"); ; )
|
|
741
|
-
switch (r) {
|
|
742
|
-
case "hex":
|
|
743
|
-
return Ee(this, t, e);
|
|
744
|
-
case "utf8":
|
|
745
|
-
case "utf-8":
|
|
746
|
-
return _t(this, t, e);
|
|
747
|
-
case "ascii":
|
|
748
|
-
return ve(this, t, e);
|
|
749
|
-
case "latin1":
|
|
750
|
-
case "binary":
|
|
751
|
-
return be(this, t, e);
|
|
752
|
-
case "base64":
|
|
753
|
-
return ge(this, t, e);
|
|
754
|
-
case "ucs2":
|
|
755
|
-
case "ucs-2":
|
|
756
|
-
case "utf16le":
|
|
757
|
-
case "utf-16le":
|
|
758
|
-
return _e(this, t, e);
|
|
759
|
-
default:
|
|
760
|
-
if (o)
|
|
761
|
-
throw new TypeError("Unknown encoding: " + r);
|
|
762
|
-
r = (r + "").toLowerCase(), o = !0;
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
a.prototype._isBuffer = !0;
|
|
766
|
-
function M(r, t, e) {
|
|
767
|
-
var o = r[t];
|
|
768
|
-
r[t] = r[e], r[e] = o;
|
|
769
|
-
}
|
|
770
|
-
a.prototype.swap16 = function() {
|
|
771
|
-
var t = this.length;
|
|
772
|
-
if (t % 2 !== 0)
|
|
773
|
-
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
774
|
-
for (var e = 0; e < t; e += 2)
|
|
775
|
-
M(this, e, e + 1);
|
|
776
|
-
return this;
|
|
777
|
-
}, a.prototype.swap32 = function() {
|
|
778
|
-
var t = this.length;
|
|
779
|
-
if (t % 4 !== 0)
|
|
780
|
-
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
781
|
-
for (var e = 0; e < t; e += 4)
|
|
782
|
-
M(this, e, e + 3), M(this, e + 1, e + 2);
|
|
783
|
-
return this;
|
|
784
|
-
}, a.prototype.swap64 = function() {
|
|
785
|
-
var t = this.length;
|
|
786
|
-
if (t % 8 !== 0)
|
|
787
|
-
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
788
|
-
for (var e = 0; e < t; e += 8)
|
|
789
|
-
M(this, e, e + 7), M(this, e + 1, e + 6), M(this, e + 2, e + 5), M(this, e + 3, e + 4);
|
|
790
|
-
return this;
|
|
791
|
-
}, a.prototype.toString = function() {
|
|
792
|
-
var t = this.length;
|
|
793
|
-
return t === 0 ? "" : arguments.length === 0 ? _t(this, 0, t) : fe.apply(this, arguments);
|
|
794
|
-
}, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
|
|
795
|
-
if (!a.isBuffer(t))
|
|
796
|
-
throw new TypeError("Argument must be a Buffer");
|
|
797
|
-
return this === t ? !0 : a.compare(this, t) === 0;
|
|
798
|
-
}, a.prototype.inspect = function() {
|
|
799
|
-
var t = "", e = n.INSPECT_MAX_BYTES;
|
|
800
|
-
return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
|
|
801
|
-
}, c && (a.prototype[c] = a.prototype.inspect), a.prototype.compare = function(t, e, o, s, m) {
|
|
802
|
-
if (T(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
|
|
803
|
-
throw new TypeError(
|
|
804
|
-
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
|
|
805
|
-
);
|
|
806
|
-
if (e === void 0 && (e = 0), o === void 0 && (o = t ? t.length : 0), s === void 0 && (s = 0), m === void 0 && (m = this.length), e < 0 || o > t.length || s < 0 || m > this.length)
|
|
807
|
-
throw new RangeError("out of range index");
|
|
808
|
-
if (s >= m && e >= o)
|
|
809
|
-
return 0;
|
|
810
|
-
if (s >= m)
|
|
811
|
-
return -1;
|
|
812
|
-
if (e >= o)
|
|
813
|
-
return 1;
|
|
814
|
-
if (e >>>= 0, o >>>= 0, s >>>= 0, m >>>= 0, this === t)
|
|
815
|
-
return 0;
|
|
816
|
-
for (var h = m - s, _ = o - e, F = Math.min(h, _), k = this.slice(s, m), B = t.slice(e, o), A = 0; A < F; ++A)
|
|
817
|
-
if (k[A] !== B[A]) {
|
|
818
|
-
h = k[A], _ = B[A];
|
|
819
|
-
break;
|
|
820
|
-
}
|
|
821
|
-
return h < _ ? -1 : _ < h ? 1 : 0;
|
|
822
|
-
};
|
|
823
|
-
function bt(r, t, e, o, s) {
|
|
824
|
-
if (r.length === 0)
|
|
825
|
-
return -1;
|
|
826
|
-
if (typeof e == "string" ? (o = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, nt(e) && (e = s ? 0 : r.length - 1), e < 0 && (e = r.length + e), e >= r.length) {
|
|
827
|
-
if (s)
|
|
828
|
-
return -1;
|
|
829
|
-
e = r.length - 1;
|
|
830
|
-
} else if (e < 0)
|
|
831
|
-
if (s)
|
|
832
|
-
e = 0;
|
|
833
|
-
else
|
|
834
|
-
return -1;
|
|
835
|
-
if (typeof t == "string" && (t = a.from(t, o)), a.isBuffer(t))
|
|
836
|
-
return t.length === 0 ? -1 : Et(r, t, e, o, s);
|
|
837
|
-
if (typeof t == "number")
|
|
838
|
-
return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? s ? Uint8Array.prototype.indexOf.call(r, t, e) : Uint8Array.prototype.lastIndexOf.call(r, t, e) : Et(r, [t], e, o, s);
|
|
839
|
-
throw new TypeError("val must be string, number or Buffer");
|
|
840
|
-
}
|
|
841
|
-
function Et(r, t, e, o, s) {
|
|
842
|
-
var m = 1, h = r.length, _ = t.length;
|
|
843
|
-
if (o !== void 0 && (o = String(o).toLowerCase(), o === "ucs2" || o === "ucs-2" || o === "utf16le" || o === "utf-16le")) {
|
|
844
|
-
if (r.length < 2 || t.length < 2)
|
|
845
|
-
return -1;
|
|
846
|
-
m = 2, h /= 2, _ /= 2, e /= 2;
|
|
847
|
-
}
|
|
848
|
-
function F(jt, It) {
|
|
849
|
-
return m === 1 ? jt[It] : jt.readUInt16BE(It * m);
|
|
850
|
-
}
|
|
851
|
-
var k;
|
|
852
|
-
if (s) {
|
|
853
|
-
var B = -1;
|
|
854
|
-
for (k = e; k < h; k++)
|
|
855
|
-
if (F(r, k) === F(t, B === -1 ? 0 : k - B)) {
|
|
856
|
-
if (B === -1 && (B = k), k - B + 1 === _)
|
|
857
|
-
return B * m;
|
|
858
|
-
} else
|
|
859
|
-
B !== -1 && (k -= k - B), B = -1;
|
|
860
|
-
} else
|
|
861
|
-
for (e + _ > h && (e = h - _), k = e; k >= 0; k--) {
|
|
862
|
-
for (var A = !0, K = 0; K < _; K++)
|
|
863
|
-
if (F(r, k + K) !== F(t, K)) {
|
|
864
|
-
A = !1;
|
|
865
|
-
break;
|
|
866
|
-
}
|
|
867
|
-
if (A)
|
|
868
|
-
return k;
|
|
869
|
-
}
|
|
870
|
-
return -1;
|
|
871
|
-
}
|
|
872
|
-
a.prototype.includes = function(t, e, o) {
|
|
873
|
-
return this.indexOf(t, e, o) !== -1;
|
|
874
|
-
}, a.prototype.indexOf = function(t, e, o) {
|
|
875
|
-
return bt(this, t, e, o, !0);
|
|
876
|
-
}, a.prototype.lastIndexOf = function(t, e, o) {
|
|
877
|
-
return bt(this, t, e, o, !1);
|
|
878
|
-
};
|
|
879
|
-
function me(r, t, e, o) {
|
|
880
|
-
e = Number(e) || 0;
|
|
881
|
-
var s = r.length - e;
|
|
882
|
-
o ? (o = Number(o), o > s && (o = s)) : o = s;
|
|
883
|
-
var m = t.length;
|
|
884
|
-
o > m / 2 && (o = m / 2);
|
|
885
|
-
for (var h = 0; h < o; ++h) {
|
|
886
|
-
var _ = parseInt(t.substr(h * 2, 2), 16);
|
|
887
|
-
if (nt(_))
|
|
888
|
-
return h;
|
|
889
|
-
r[e + h] = _;
|
|
890
|
-
}
|
|
891
|
-
return h;
|
|
892
|
-
}
|
|
893
|
-
function he(r, t, e, o) {
|
|
894
|
-
return G(rt(t, r.length - e), r, e, o);
|
|
895
|
-
}
|
|
896
|
-
function xe(r, t, e, o) {
|
|
897
|
-
return G(Ae(t), r, e, o);
|
|
898
|
-
}
|
|
899
|
-
function de(r, t, e, o) {
|
|
900
|
-
return G(Bt(t), r, e, o);
|
|
901
|
-
}
|
|
902
|
-
function we(r, t, e, o) {
|
|
903
|
-
return G(Se(t, r.length - e), r, e, o);
|
|
904
|
-
}
|
|
905
|
-
a.prototype.write = function(t, e, o, s) {
|
|
906
|
-
if (e === void 0)
|
|
907
|
-
s = "utf8", o = this.length, e = 0;
|
|
908
|
-
else if (o === void 0 && typeof e == "string")
|
|
909
|
-
s = e, o = this.length, e = 0;
|
|
910
|
-
else if (isFinite(e))
|
|
911
|
-
e = e >>> 0, isFinite(o) ? (o = o >>> 0, s === void 0 && (s = "utf8")) : (s = o, o = void 0);
|
|
912
|
-
else
|
|
913
|
-
throw new Error(
|
|
914
|
-
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
915
|
-
);
|
|
916
|
-
var m = this.length - e;
|
|
917
|
-
if ((o === void 0 || o > m) && (o = m), t.length > 0 && (o < 0 || e < 0) || e > this.length)
|
|
918
|
-
throw new RangeError("Attempt to write outside buffer bounds");
|
|
919
|
-
s || (s = "utf8");
|
|
920
|
-
for (var h = !1; ; )
|
|
921
|
-
switch (s) {
|
|
922
|
-
case "hex":
|
|
923
|
-
return me(this, t, e, o);
|
|
924
|
-
case "utf8":
|
|
925
|
-
case "utf-8":
|
|
926
|
-
return he(this, t, e, o);
|
|
927
|
-
case "ascii":
|
|
928
|
-
case "latin1":
|
|
929
|
-
case "binary":
|
|
930
|
-
return xe(this, t, e, o);
|
|
931
|
-
case "base64":
|
|
932
|
-
return de(this, t, e, o);
|
|
933
|
-
case "ucs2":
|
|
934
|
-
case "ucs-2":
|
|
935
|
-
case "utf16le":
|
|
936
|
-
case "utf-16le":
|
|
937
|
-
return we(this, t, e, o);
|
|
938
|
-
default:
|
|
939
|
-
if (h)
|
|
940
|
-
throw new TypeError("Unknown encoding: " + s);
|
|
941
|
-
s = ("" + s).toLowerCase(), h = !0;
|
|
942
|
-
}
|
|
943
|
-
}, a.prototype.toJSON = function() {
|
|
944
|
-
return {
|
|
945
|
-
type: "Buffer",
|
|
946
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
947
|
-
};
|
|
948
|
-
};
|
|
949
|
-
function ge(r, t, e) {
|
|
950
|
-
return t === 0 && e === r.length ? i.fromByteArray(r) : i.fromByteArray(r.slice(t, e));
|
|
951
|
-
}
|
|
952
|
-
function _t(r, t, e) {
|
|
953
|
-
e = Math.min(r.length, e);
|
|
954
|
-
for (var o = [], s = t; s < e; ) {
|
|
955
|
-
var m = r[s], h = null, _ = m > 239 ? 4 : m > 223 ? 3 : m > 191 ? 2 : 1;
|
|
956
|
-
if (s + _ <= e) {
|
|
957
|
-
var F, k, B, A;
|
|
958
|
-
switch (_) {
|
|
959
|
-
case 1:
|
|
960
|
-
m < 128 && (h = m);
|
|
961
|
-
break;
|
|
962
|
-
case 2:
|
|
963
|
-
F = r[s + 1], (F & 192) === 128 && (A = (m & 31) << 6 | F & 63, A > 127 && (h = A));
|
|
964
|
-
break;
|
|
965
|
-
case 3:
|
|
966
|
-
F = r[s + 1], k = r[s + 2], (F & 192) === 128 && (k & 192) === 128 && (A = (m & 15) << 12 | (F & 63) << 6 | k & 63, A > 2047 && (A < 55296 || A > 57343) && (h = A));
|
|
967
|
-
break;
|
|
968
|
-
case 4:
|
|
969
|
-
F = r[s + 1], k = r[s + 2], B = r[s + 3], (F & 192) === 128 && (k & 192) === 128 && (B & 192) === 128 && (A = (m & 15) << 18 | (F & 63) << 12 | (k & 63) << 6 | B & 63, A > 65535 && A < 1114112 && (h = A));
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
h === null ? (h = 65533, _ = 1) : h > 65535 && (h -= 65536, o.push(h >>> 10 & 1023 | 55296), h = 56320 | h & 1023), o.push(h), s += _;
|
|
973
|
-
}
|
|
974
|
-
return ye(o);
|
|
975
|
-
}
|
|
976
|
-
var Ft = 4096;
|
|
977
|
-
function ye(r) {
|
|
978
|
-
var t = r.length;
|
|
979
|
-
if (t <= Ft)
|
|
980
|
-
return String.fromCharCode.apply(String, r);
|
|
981
|
-
for (var e = "", o = 0; o < t; )
|
|
982
|
-
e += String.fromCharCode.apply(
|
|
983
|
-
String,
|
|
984
|
-
r.slice(o, o += Ft)
|
|
985
|
-
);
|
|
986
|
-
return e;
|
|
987
|
-
}
|
|
988
|
-
function ve(r, t, e) {
|
|
989
|
-
var o = "";
|
|
990
|
-
e = Math.min(r.length, e);
|
|
991
|
-
for (var s = t; s < e; ++s)
|
|
992
|
-
o += String.fromCharCode(r[s] & 127);
|
|
993
|
-
return o;
|
|
994
|
-
}
|
|
995
|
-
function be(r, t, e) {
|
|
996
|
-
var o = "";
|
|
997
|
-
e = Math.min(r.length, e);
|
|
998
|
-
for (var s = t; s < e; ++s)
|
|
999
|
-
o += String.fromCharCode(r[s]);
|
|
1000
|
-
return o;
|
|
1001
|
-
}
|
|
1002
|
-
function Ee(r, t, e) {
|
|
1003
|
-
var o = r.length;
|
|
1004
|
-
(!t || t < 0) && (t = 0), (!e || e < 0 || e > o) && (e = o);
|
|
1005
|
-
for (var s = "", m = t; m < e; ++m)
|
|
1006
|
-
s += Be[r[m]];
|
|
1007
|
-
return s;
|
|
1008
|
-
}
|
|
1009
|
-
function _e(r, t, e) {
|
|
1010
|
-
for (var o = r.slice(t, e), s = "", m = 0; m < o.length - 1; m += 2)
|
|
1011
|
-
s += String.fromCharCode(o[m] + o[m + 1] * 256);
|
|
1012
|
-
return s;
|
|
1013
|
-
}
|
|
1014
|
-
a.prototype.slice = function(t, e) {
|
|
1015
|
-
var o = this.length;
|
|
1016
|
-
t = ~~t, e = e === void 0 ? o : ~~e, t < 0 ? (t += o, t < 0 && (t = 0)) : t > o && (t = o), e < 0 ? (e += o, e < 0 && (e = 0)) : e > o && (e = o), e < t && (e = t);
|
|
1017
|
-
var s = this.subarray(t, e);
|
|
1018
|
-
return Object.setPrototypeOf(s, a.prototype), s;
|
|
1019
|
-
};
|
|
1020
|
-
function S(r, t, e) {
|
|
1021
|
-
if (r % 1 !== 0 || r < 0)
|
|
1022
|
-
throw new RangeError("offset is not uint");
|
|
1023
|
-
if (r + t > e)
|
|
1024
|
-
throw new RangeError("Trying to access beyond buffer length");
|
|
1025
|
-
}
|
|
1026
|
-
a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, o) {
|
|
1027
|
-
t = t >>> 0, e = e >>> 0, o || S(t, e, this.length);
|
|
1028
|
-
for (var s = this[t], m = 1, h = 0; ++h < e && (m *= 256); )
|
|
1029
|
-
s += this[t + h] * m;
|
|
1030
|
-
return s;
|
|
1031
|
-
}, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, o) {
|
|
1032
|
-
t = t >>> 0, e = e >>> 0, o || S(t, e, this.length);
|
|
1033
|
-
for (var s = this[t + --e], m = 1; e > 0 && (m *= 256); )
|
|
1034
|
-
s += this[t + --e] * m;
|
|
1035
|
-
return s;
|
|
1036
|
-
}, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
|
|
1037
|
-
return t = t >>> 0, e || S(t, 1, this.length), this[t];
|
|
1038
|
-
}, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(t, e) {
|
|
1039
|
-
return t = t >>> 0, e || S(t, 2, this.length), this[t] | this[t + 1] << 8;
|
|
1040
|
-
}, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(t, e) {
|
|
1041
|
-
return t = t >>> 0, e || S(t, 2, this.length), this[t] << 8 | this[t + 1];
|
|
1042
|
-
}, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(t, e) {
|
|
1043
|
-
return t = t >>> 0, e || S(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
|
|
1044
|
-
}, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(t, e) {
|
|
1045
|
-
return t = t >>> 0, e || S(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
|
|
1046
|
-
}, a.prototype.readIntLE = function(t, e, o) {
|
|
1047
|
-
t = t >>> 0, e = e >>> 0, o || S(t, e, this.length);
|
|
1048
|
-
for (var s = this[t], m = 1, h = 0; ++h < e && (m *= 256); )
|
|
1049
|
-
s += this[t + h] * m;
|
|
1050
|
-
return m *= 128, s >= m && (s -= Math.pow(2, 8 * e)), s;
|
|
1051
|
-
}, a.prototype.readIntBE = function(t, e, o) {
|
|
1052
|
-
t = t >>> 0, e = e >>> 0, o || S(t, e, this.length);
|
|
1053
|
-
for (var s = e, m = 1, h = this[t + --s]; s > 0 && (m *= 256); )
|
|
1054
|
-
h += this[t + --s] * m;
|
|
1055
|
-
return m *= 128, h >= m && (h -= Math.pow(2, 8 * e)), h;
|
|
1056
|
-
}, a.prototype.readInt8 = function(t, e) {
|
|
1057
|
-
return t = t >>> 0, e || S(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
|
|
1058
|
-
}, a.prototype.readInt16LE = function(t, e) {
|
|
1059
|
-
t = t >>> 0, e || S(t, 2, this.length);
|
|
1060
|
-
var o = this[t] | this[t + 1] << 8;
|
|
1061
|
-
return o & 32768 ? o | 4294901760 : o;
|
|
1062
|
-
}, a.prototype.readInt16BE = function(t, e) {
|
|
1063
|
-
t = t >>> 0, e || S(t, 2, this.length);
|
|
1064
|
-
var o = this[t + 1] | this[t] << 8;
|
|
1065
|
-
return o & 32768 ? o | 4294901760 : o;
|
|
1066
|
-
}, a.prototype.readInt32LE = function(t, e) {
|
|
1067
|
-
return t = t >>> 0, e || S(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
|
|
1068
|
-
}, a.prototype.readInt32BE = function(t, e) {
|
|
1069
|
-
return t = t >>> 0, e || S(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
|
|
1070
|
-
}, a.prototype.readFloatLE = function(t, e) {
|
|
1071
|
-
return t = t >>> 0, e || S(t, 4, this.length), p.read(this, t, !0, 23, 4);
|
|
1072
|
-
}, a.prototype.readFloatBE = function(t, e) {
|
|
1073
|
-
return t = t >>> 0, e || S(t, 4, this.length), p.read(this, t, !1, 23, 4);
|
|
1074
|
-
}, a.prototype.readDoubleLE = function(t, e) {
|
|
1075
|
-
return t = t >>> 0, e || S(t, 8, this.length), p.read(this, t, !0, 52, 8);
|
|
1076
|
-
}, a.prototype.readDoubleBE = function(t, e) {
|
|
1077
|
-
return t = t >>> 0, e || S(t, 8, this.length), p.read(this, t, !1, 52, 8);
|
|
1078
|
-
};
|
|
1079
|
-
function j(r, t, e, o, s, m) {
|
|
1080
|
-
if (!a.isBuffer(r))
|
|
1081
|
-
throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1082
|
-
if (t > s || t < m)
|
|
1083
|
-
throw new RangeError('"value" argument is out of bounds');
|
|
1084
|
-
if (e + o > r.length)
|
|
1085
|
-
throw new RangeError("Index out of range");
|
|
1086
|
-
}
|
|
1087
|
-
a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, o, s) {
|
|
1088
|
-
if (t = +t, e = e >>> 0, o = o >>> 0, !s) {
|
|
1089
|
-
var m = Math.pow(2, 8 * o) - 1;
|
|
1090
|
-
j(this, t, e, o, m, 0);
|
|
1091
|
-
}
|
|
1092
|
-
var h = 1, _ = 0;
|
|
1093
|
-
for (this[e] = t & 255; ++_ < o && (h *= 256); )
|
|
1094
|
-
this[e + _] = t / h & 255;
|
|
1095
|
-
return e + o;
|
|
1096
|
-
}, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, o, s) {
|
|
1097
|
-
if (t = +t, e = e >>> 0, o = o >>> 0, !s) {
|
|
1098
|
-
var m = Math.pow(2, 8 * o) - 1;
|
|
1099
|
-
j(this, t, e, o, m, 0);
|
|
1100
|
-
}
|
|
1101
|
-
var h = o - 1, _ = 1;
|
|
1102
|
-
for (this[e + h] = t & 255; --h >= 0 && (_ *= 256); )
|
|
1103
|
-
this[e + h] = t / _ & 255;
|
|
1104
|
-
return e + o;
|
|
1105
|
-
}, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, o) {
|
|
1106
|
-
return t = +t, e = e >>> 0, o || j(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
|
|
1107
|
-
}, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(t, e, o) {
|
|
1108
|
-
return t = +t, e = e >>> 0, o || j(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
1109
|
-
}, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(t, e, o) {
|
|
1110
|
-
return t = +t, e = e >>> 0, o || j(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
1111
|
-
}, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(t, e, o) {
|
|
1112
|
-
return t = +t, e = e >>> 0, o || j(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;
|
|
1113
|
-
}, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(t, e, o) {
|
|
1114
|
-
return t = +t, e = e >>> 0, o || j(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;
|
|
1115
|
-
}, a.prototype.writeIntLE = function(t, e, o, s) {
|
|
1116
|
-
if (t = +t, e = e >>> 0, !s) {
|
|
1117
|
-
var m = Math.pow(2, 8 * o - 1);
|
|
1118
|
-
j(this, t, e, o, m - 1, -m);
|
|
1119
|
-
}
|
|
1120
|
-
var h = 0, _ = 1, F = 0;
|
|
1121
|
-
for (this[e] = t & 255; ++h < o && (_ *= 256); )
|
|
1122
|
-
t < 0 && F === 0 && this[e + h - 1] !== 0 && (F = 1), this[e + h] = (t / _ >> 0) - F & 255;
|
|
1123
|
-
return e + o;
|
|
1124
|
-
}, a.prototype.writeIntBE = function(t, e, o, s) {
|
|
1125
|
-
if (t = +t, e = e >>> 0, !s) {
|
|
1126
|
-
var m = Math.pow(2, 8 * o - 1);
|
|
1127
|
-
j(this, t, e, o, m - 1, -m);
|
|
1128
|
-
}
|
|
1129
|
-
var h = o - 1, _ = 1, F = 0;
|
|
1130
|
-
for (this[e + h] = t & 255; --h >= 0 && (_ *= 256); )
|
|
1131
|
-
t < 0 && F === 0 && this[e + h + 1] !== 0 && (F = 1), this[e + h] = (t / _ >> 0) - F & 255;
|
|
1132
|
-
return e + o;
|
|
1133
|
-
}, a.prototype.writeInt8 = function(t, e, o) {
|
|
1134
|
-
return t = +t, e = e >>> 0, o || j(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
|
|
1135
|
-
}, a.prototype.writeInt16LE = function(t, e, o) {
|
|
1136
|
-
return t = +t, e = e >>> 0, o || j(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
1137
|
-
}, a.prototype.writeInt16BE = function(t, e, o) {
|
|
1138
|
-
return t = +t, e = e >>> 0, o || j(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
1139
|
-
}, a.prototype.writeInt32LE = function(t, e, o) {
|
|
1140
|
-
return t = +t, e = e >>> 0, o || j(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;
|
|
1141
|
-
}, a.prototype.writeInt32BE = function(t, e, o) {
|
|
1142
|
-
return t = +t, e = e >>> 0, o || j(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;
|
|
1143
|
-
};
|
|
1144
|
-
function kt(r, t, e, o, s, m) {
|
|
1145
|
-
if (e + o > r.length)
|
|
1146
|
-
throw new RangeError("Index out of range");
|
|
1147
|
-
if (e < 0)
|
|
1148
|
-
throw new RangeError("Index out of range");
|
|
1149
|
-
}
|
|
1150
|
-
function At(r, t, e, o, s) {
|
|
1151
|
-
return t = +t, e = e >>> 0, s || kt(r, t, e, 4), p.write(r, t, e, o, 23, 4), e + 4;
|
|
1152
|
-
}
|
|
1153
|
-
a.prototype.writeFloatLE = function(t, e, o) {
|
|
1154
|
-
return At(this, t, e, !0, o);
|
|
1155
|
-
}, a.prototype.writeFloatBE = function(t, e, o) {
|
|
1156
|
-
return At(this, t, e, !1, o);
|
|
1157
|
-
};
|
|
1158
|
-
function St(r, t, e, o, s) {
|
|
1159
|
-
return t = +t, e = e >>> 0, s || kt(r, t, e, 8), p.write(r, t, e, o, 52, 8), e + 8;
|
|
1160
|
-
}
|
|
1161
|
-
a.prototype.writeDoubleLE = function(t, e, o) {
|
|
1162
|
-
return St(this, t, e, !0, o);
|
|
1163
|
-
}, a.prototype.writeDoubleBE = function(t, e, o) {
|
|
1164
|
-
return St(this, t, e, !1, o);
|
|
1165
|
-
}, a.prototype.copy = function(t, e, o, s) {
|
|
1166
|
-
if (!a.isBuffer(t))
|
|
1167
|
-
throw new TypeError("argument should be a Buffer");
|
|
1168
|
-
if (o || (o = 0), !s && s !== 0 && (s = this.length), e >= t.length && (e = t.length), e || (e = 0), s > 0 && s < o && (s = o), s === o || t.length === 0 || this.length === 0)
|
|
1169
|
-
return 0;
|
|
1170
|
-
if (e < 0)
|
|
1171
|
-
throw new RangeError("targetStart out of bounds");
|
|
1172
|
-
if (o < 0 || o >= this.length)
|
|
1173
|
-
throw new RangeError("Index out of range");
|
|
1174
|
-
if (s < 0)
|
|
1175
|
-
throw new RangeError("sourceEnd out of bounds");
|
|
1176
|
-
s > this.length && (s = this.length), t.length - e < s - o && (s = t.length - e + o);
|
|
1177
|
-
var m = s - o;
|
|
1178
|
-
return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, o, s) : Uint8Array.prototype.set.call(
|
|
1179
|
-
t,
|
|
1180
|
-
this.subarray(o, s),
|
|
1181
|
-
e
|
|
1182
|
-
), m;
|
|
1183
|
-
}, a.prototype.fill = function(t, e, o, s) {
|
|
1184
|
-
if (typeof t == "string") {
|
|
1185
|
-
if (typeof e == "string" ? (s = e, e = 0, o = this.length) : typeof o == "string" && (s = o, o = this.length), s !== void 0 && typeof s != "string")
|
|
1186
|
-
throw new TypeError("encoding must be a string");
|
|
1187
|
-
if (typeof s == "string" && !a.isEncoding(s))
|
|
1188
|
-
throw new TypeError("Unknown encoding: " + s);
|
|
1189
|
-
if (t.length === 1) {
|
|
1190
|
-
var m = t.charCodeAt(0);
|
|
1191
|
-
(s === "utf8" && m < 128 || s === "latin1") && (t = m);
|
|
1192
|
-
}
|
|
1193
|
-
} else
|
|
1194
|
-
typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
|
|
1195
|
-
if (e < 0 || this.length < e || this.length < o)
|
|
1196
|
-
throw new RangeError("Out of range index");
|
|
1197
|
-
if (o <= e)
|
|
1198
|
-
return this;
|
|
1199
|
-
e = e >>> 0, o = o === void 0 ? this.length : o >>> 0, t || (t = 0);
|
|
1200
|
-
var h;
|
|
1201
|
-
if (typeof t == "number")
|
|
1202
|
-
for (h = e; h < o; ++h)
|
|
1203
|
-
this[h] = t;
|
|
1204
|
-
else {
|
|
1205
|
-
var _ = a.isBuffer(t) ? t : a.from(t, s), F = _.length;
|
|
1206
|
-
if (F === 0)
|
|
1207
|
-
throw new TypeError('The value "' + t + '" is invalid for argument "value"');
|
|
1208
|
-
for (h = 0; h < o - e; ++h)
|
|
1209
|
-
this[h + e] = _[h % F];
|
|
1210
|
-
}
|
|
1211
|
-
return this;
|
|
1212
|
-
};
|
|
1213
|
-
var Fe = /[^+/0-9A-Za-z-_]/g;
|
|
1214
|
-
function ke(r) {
|
|
1215
|
-
if (r = r.split("=")[0], r = r.trim().replace(Fe, ""), r.length < 2)
|
|
1216
|
-
return "";
|
|
1217
|
-
for (; r.length % 4 !== 0; )
|
|
1218
|
-
r = r + "=";
|
|
1219
|
-
return r;
|
|
1220
|
-
}
|
|
1221
|
-
function rt(r, t) {
|
|
1222
|
-
t = t || 1 / 0;
|
|
1223
|
-
for (var e, o = r.length, s = null, m = [], h = 0; h < o; ++h) {
|
|
1224
|
-
if (e = r.charCodeAt(h), e > 55295 && e < 57344) {
|
|
1225
|
-
if (!s) {
|
|
1226
|
-
if (e > 56319) {
|
|
1227
|
-
(t -= 3) > -1 && m.push(239, 191, 189);
|
|
1228
|
-
continue;
|
|
1229
|
-
} else if (h + 1 === o) {
|
|
1230
|
-
(t -= 3) > -1 && m.push(239, 191, 189);
|
|
1231
|
-
continue;
|
|
1232
|
-
}
|
|
1233
|
-
s = e;
|
|
1234
|
-
continue;
|
|
1235
|
-
}
|
|
1236
|
-
if (e < 56320) {
|
|
1237
|
-
(t -= 3) > -1 && m.push(239, 191, 189), s = e;
|
|
1238
|
-
continue;
|
|
1239
|
-
}
|
|
1240
|
-
e = (s - 55296 << 10 | e - 56320) + 65536;
|
|
1241
|
-
} else
|
|
1242
|
-
s && (t -= 3) > -1 && m.push(239, 191, 189);
|
|
1243
|
-
if (s = null, e < 128) {
|
|
1244
|
-
if ((t -= 1) < 0)
|
|
1245
|
-
break;
|
|
1246
|
-
m.push(e);
|
|
1247
|
-
} else if (e < 2048) {
|
|
1248
|
-
if ((t -= 2) < 0)
|
|
1249
|
-
break;
|
|
1250
|
-
m.push(
|
|
1251
|
-
e >> 6 | 192,
|
|
1252
|
-
e & 63 | 128
|
|
1253
|
-
);
|
|
1254
|
-
} else if (e < 65536) {
|
|
1255
|
-
if ((t -= 3) < 0)
|
|
1256
|
-
break;
|
|
1257
|
-
m.push(
|
|
1258
|
-
e >> 12 | 224,
|
|
1259
|
-
e >> 6 & 63 | 128,
|
|
1260
|
-
e & 63 | 128
|
|
1261
|
-
);
|
|
1262
|
-
} else if (e < 1114112) {
|
|
1263
|
-
if ((t -= 4) < 0)
|
|
1264
|
-
break;
|
|
1265
|
-
m.push(
|
|
1266
|
-
e >> 18 | 240,
|
|
1267
|
-
e >> 12 & 63 | 128,
|
|
1268
|
-
e >> 6 & 63 | 128,
|
|
1269
|
-
e & 63 | 128
|
|
1270
|
-
);
|
|
1271
|
-
} else
|
|
1272
|
-
throw new Error("Invalid code point");
|
|
1273
|
-
}
|
|
1274
|
-
return m;
|
|
1275
|
-
}
|
|
1276
|
-
function Ae(r) {
|
|
1277
|
-
for (var t = [], e = 0; e < r.length; ++e)
|
|
1278
|
-
t.push(r.charCodeAt(e) & 255);
|
|
1279
|
-
return t;
|
|
1280
|
-
}
|
|
1281
|
-
function Se(r, t) {
|
|
1282
|
-
for (var e, o, s, m = [], h = 0; h < r.length && !((t -= 2) < 0); ++h)
|
|
1283
|
-
e = r.charCodeAt(h), o = e >> 8, s = e % 256, m.push(s), m.push(o);
|
|
1284
|
-
return m;
|
|
1285
|
-
}
|
|
1286
|
-
function Bt(r) {
|
|
1287
|
-
return i.toByteArray(ke(r));
|
|
1288
|
-
}
|
|
1289
|
-
function G(r, t, e, o) {
|
|
1290
|
-
for (var s = 0; s < o && !(s + e >= t.length || s >= r.length); ++s)
|
|
1291
|
-
t[s + e] = r[s];
|
|
1292
|
-
return s;
|
|
1293
|
-
}
|
|
1294
|
-
function T(r, t) {
|
|
1295
|
-
return r instanceof t || r != null && r.constructor != null && r.constructor.name != null && r.constructor.name === t.name;
|
|
1296
|
-
}
|
|
1297
|
-
function nt(r) {
|
|
1298
|
-
return r !== r;
|
|
1299
|
-
}
|
|
1300
|
-
var Be = function() {
|
|
1301
|
-
for (var r = "0123456789abcdef", t = new Array(256), e = 0; e < 16; ++e)
|
|
1302
|
-
for (var o = e * 16, s = 0; s < 16; ++s)
|
|
1303
|
-
t[o + s] = r[e] + r[s];
|
|
1304
|
-
return t;
|
|
1305
|
-
}();
|
|
1306
|
-
})(Vt);
|
|
1307
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1308
|
-
(function(n, i) {
|
|
1309
|
-
var p = Vt, c = p.Buffer;
|
|
1310
|
-
function f(l, a) {
|
|
1311
|
-
for (var x in l)
|
|
1312
|
-
a[x] = l[x];
|
|
1313
|
-
}
|
|
1314
|
-
c.from && c.alloc && c.allocUnsafe && c.allocUnsafeSlow ? n.exports = p : (f(p, i), i.Buffer = u);
|
|
1315
|
-
function u(l, a, x) {
|
|
1316
|
-
return c(l, a, x);
|
|
1317
|
-
}
|
|
1318
|
-
u.prototype = Object.create(c.prototype), f(c, u), u.from = function(l, a, x) {
|
|
1319
|
-
if (typeof l == "number")
|
|
1320
|
-
throw new TypeError("Argument must not be a number");
|
|
1321
|
-
return c(l, a, x);
|
|
1322
|
-
}, u.alloc = function(l, a, x) {
|
|
1323
|
-
if (typeof l != "number")
|
|
1324
|
-
throw new TypeError("Argument must be a number");
|
|
1325
|
-
var d = c(l);
|
|
1326
|
-
return a !== void 0 ? typeof x == "string" ? d.fill(a, x) : d.fill(a) : d.fill(0), d;
|
|
1327
|
-
}, u.allocUnsafe = function(l) {
|
|
1328
|
-
if (typeof l != "number")
|
|
1329
|
-
throw new TypeError("Argument must be a number");
|
|
1330
|
-
return c(l);
|
|
1331
|
-
}, u.allocUnsafeSlow = function(l) {
|
|
1332
|
-
if (typeof l != "number")
|
|
1333
|
-
throw new TypeError("Argument must be a number");
|
|
1334
|
-
return p.SlowBuffer(l);
|
|
1335
|
-
};
|
|
1336
|
-
})(ct, ct.exports);
|
|
1337
|
-
var Qt = ct.exports, te = Qt.Buffer;
|
|
1338
|
-
function et(n, i) {
|
|
1339
|
-
this._block = te.alloc(n), this._finalSize = i, this._blockSize = n, this._len = 0;
|
|
1340
|
-
}
|
|
1341
|
-
et.prototype.update = function(n, i) {
|
|
1342
|
-
typeof n == "string" && (i = i || "utf8", n = te.from(n, i));
|
|
1343
|
-
for (var p = this._block, c = this._blockSize, f = n.length, u = this._len, l = 0; l < f; ) {
|
|
1344
|
-
for (var a = u % c, x = Math.min(f - l, c - a), d = 0; d < x; d++)
|
|
1345
|
-
p[a + d] = n[l + d];
|
|
1346
|
-
u += x, l += x, u % c === 0 && this._update(p);
|
|
1347
|
-
}
|
|
1348
|
-
return this._len += f, this;
|
|
1349
|
-
};
|
|
1350
|
-
et.prototype.digest = function(n) {
|
|
1351
|
-
var i = this._len % this._blockSize;
|
|
1352
|
-
this._block[i] = 128, this._block.fill(0, i + 1), i >= this._finalSize && (this._update(this._block), this._block.fill(0));
|
|
1353
|
-
var p = this._len * 8;
|
|
1354
|
-
if (p <= 4294967295)
|
|
1355
|
-
this._block.writeUInt32BE(p, this._blockSize - 4);
|
|
1356
|
-
else {
|
|
1357
|
-
var c = (p & 4294967295) >>> 0, f = (p - c) / 4294967296;
|
|
1358
|
-
this._block.writeUInt32BE(f, this._blockSize - 8), this._block.writeUInt32BE(c, this._blockSize - 4);
|
|
1359
|
-
}
|
|
1360
|
-
this._update(this._block);
|
|
1361
|
-
var u = this._hash();
|
|
1362
|
-
return n ? u.toString(n) : u;
|
|
1363
|
-
};
|
|
1364
|
-
et.prototype._update = function() {
|
|
1365
|
-
throw new Error("_update must be implemented by subclass");
|
|
1366
|
-
};
|
|
1367
|
-
var pi = et, si = Xe, ee = pi, ci = Qt.Buffer, li = [
|
|
1368
|
-
1518500249,
|
|
1369
|
-
1859775393,
|
|
1370
|
-
-1894007588,
|
|
1371
|
-
-899497514
|
|
1372
|
-
], ui = new Array(80);
|
|
1373
|
-
function Z() {
|
|
1374
|
-
this.init(), this._w = ui, ee.call(this, 64, 56);
|
|
1375
|
-
}
|
|
1376
|
-
si(Z, ee);
|
|
1377
|
-
Z.prototype.init = function() {
|
|
1378
|
-
return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
|
|
1379
|
-
};
|
|
1380
|
-
function fi(n) {
|
|
1381
|
-
return n << 1 | n >>> 31;
|
|
1382
|
-
}
|
|
1383
|
-
function mi(n) {
|
|
1384
|
-
return n << 5 | n >>> 27;
|
|
1385
|
-
}
|
|
1386
|
-
function hi(n) {
|
|
1387
|
-
return n << 30 | n >>> 2;
|
|
1388
|
-
}
|
|
1389
|
-
function xi(n, i, p, c) {
|
|
1390
|
-
return n === 0 ? i & p | ~i & c : n === 2 ? i & p | i & c | p & c : i ^ p ^ c;
|
|
1391
|
-
}
|
|
1392
|
-
Z.prototype._update = function(n) {
|
|
1393
|
-
for (var i = this._w, p = this._a | 0, c = this._b | 0, f = this._c | 0, u = this._d | 0, l = this._e | 0, a = 0; a < 16; ++a)
|
|
1394
|
-
i[a] = n.readInt32BE(a * 4);
|
|
1395
|
-
for (; a < 80; ++a)
|
|
1396
|
-
i[a] = fi(i[a - 3] ^ i[a - 8] ^ i[a - 14] ^ i[a - 16]);
|
|
1397
|
-
for (var x = 0; x < 80; ++x) {
|
|
1398
|
-
var d = ~~(x / 20), v = mi(p) + xi(d, c, f, u) + l + i[x] + li[d] | 0;
|
|
1399
|
-
l = u, u = f, f = hi(c), c = p, p = v;
|
|
1400
|
-
}
|
|
1401
|
-
this._a = p + this._a | 0, this._b = c + this._b | 0, this._c = f + this._c | 0, this._d = u + this._d | 0, this._e = l + this._e | 0;
|
|
1402
|
-
};
|
|
1403
|
-
Z.prototype._hash = function() {
|
|
1404
|
-
var n = ci.allocUnsafe(20);
|
|
1405
|
-
return n.writeInt32BE(this._a | 0, 0), n.writeInt32BE(this._b | 0, 4), n.writeInt32BE(this._c | 0, 8), n.writeInt32BE(this._d | 0, 12), n.writeInt32BE(this._e | 0, 16), n;
|
|
1406
|
-
};
|
|
1407
|
-
var di = Z;
|
|
1408
|
-
const wi = /* @__PURE__ */ Ve(di), wt = new Error("File system not available.");
|
|
1409
|
-
function gi(n, i, p) {
|
|
1410
|
-
throw wt;
|
|
1411
|
-
}
|
|
1412
|
-
function ie(n) {
|
|
1413
|
-
throw wt;
|
|
1414
|
-
}
|
|
1415
|
-
function yi(n) {
|
|
1416
|
-
throw wt;
|
|
1417
|
-
}
|
|
1418
|
-
const vi = async (n) => ie();
|
|
1419
|
-
function bi(n) {
|
|
1420
|
-
let i = "";
|
|
1421
|
-
for (let p = 0; p < n.length; p += 2)
|
|
1422
|
-
i += String.fromCharCode(parseInt(n.substr(p, 2), 16));
|
|
1423
|
-
return btoa(i);
|
|
1424
|
-
}
|
|
1425
|
-
const it = (n, i = "sha1") => {
|
|
1426
|
-
if (i !== "sha1")
|
|
1427
|
-
throw new Error("Only sha1 algorithm is available.");
|
|
1428
|
-
const p = new wi();
|
|
1429
|
-
return bi(p.update(n).digest("hex"));
|
|
1430
|
-
};
|
|
1431
|
-
function Ei(n) {
|
|
1432
|
-
return n.type === We && n.skip !== void 0 && n.skip > 0 && n.hash !== void 0;
|
|
1433
|
-
}
|
|
1434
|
-
function Ot(n) {
|
|
1435
|
-
return [J, H].includes(n.type);
|
|
1436
|
-
}
|
|
1437
|
-
function Ut(n) {
|
|
1438
|
-
return [Yt, J, H, Q, Gt].includes(n.type);
|
|
1439
|
-
}
|
|
1440
|
-
function z(n, i, p, c, f = "global") {
|
|
1441
|
-
if (!n)
|
|
1442
|
-
throw new Error("Empty action type");
|
|
1443
|
-
if (typeof n != "string")
|
|
1444
|
-
throw new Error(`Invalid action type: ${n}`);
|
|
1445
|
-
const u = { type: n, input: i, scope: f };
|
|
1446
|
-
p && (u.attachments = p);
|
|
1447
|
-
try {
|
|
1448
|
-
c == null || c().parse(u.input);
|
|
1449
|
-
} catch (l) {
|
|
1450
|
-
throw new Error(`Invalid action input: ${l}`);
|
|
1451
|
-
}
|
|
1452
|
-
return u;
|
|
1453
|
-
}
|
|
1454
|
-
function _i(n, i = Kt) {
|
|
1455
|
-
return (p, c, f, u) => i(p, c, n, f, u);
|
|
1456
|
-
}
|
|
1457
|
-
const Fi = (n, i) => ({
|
|
1458
|
-
name: "",
|
|
1459
|
-
documentType: "",
|
|
1460
|
-
revision: {
|
|
1461
|
-
global: 0,
|
|
1462
|
-
local: 0
|
|
1463
|
-
},
|
|
1464
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1465
|
-
lastModified: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1466
|
-
attachments: {},
|
|
1467
|
-
...n,
|
|
1468
|
-
state: (i == null ? void 0 : i(n == null ? void 0 : n.state)) ?? (n == null ? void 0 : n.state) ?? { global: {}, local: {} }
|
|
1469
|
-
}), ki = (n, i) => {
|
|
1470
|
-
const p = Fi(
|
|
1471
|
-
n,
|
|
1472
|
-
i
|
|
1473
|
-
);
|
|
1474
|
-
return {
|
|
1475
|
-
...p,
|
|
1476
|
-
initialState: p,
|
|
1477
|
-
operations: { global: [], local: [] },
|
|
1478
|
-
clipboard: []
|
|
1479
|
-
};
|
|
1480
|
-
}, re = (n, i = "global") => it(pt(n.state[i])), $i = (n, i = 1e3) => {
|
|
1481
|
-
const p = Math.random() * i;
|
|
1482
|
-
return it(`${(n ?? /* @__PURE__ */ new Date()).toISOString()}${p}`);
|
|
1483
|
-
};
|
|
1484
|
-
function X(n) {
|
|
1485
|
-
return Oe(Ue(n, !0));
|
|
1486
|
-
}
|
|
1487
|
-
function Ai(n, i) {
|
|
1488
|
-
const p = [...n];
|
|
1489
|
-
let c = i || 0, f = p.length > 0 ? p[p.length - 1].index : 0;
|
|
1490
|
-
const u = [];
|
|
1491
|
-
for (const l of p.reverse()) {
|
|
1492
|
-
if (c > 0) {
|
|
1493
|
-
const d = f - l.index;
|
|
1494
|
-
c -= d;
|
|
1495
|
-
}
|
|
1496
|
-
if (c < 0)
|
|
1497
|
-
throw new Error("Invalid operation index, missing operations");
|
|
1498
|
-
const a = {
|
|
1499
|
-
ignore: c > 0,
|
|
1500
|
-
operation: l
|
|
1501
|
-
}, x = l.skip > 0 ? l.skip + 1 : 0;
|
|
1502
|
-
if (x > 0 && x > c) {
|
|
1503
|
-
const d = x - c;
|
|
1504
|
-
c = c + d;
|
|
1505
|
-
}
|
|
1506
|
-
f = l.index, u.push(a);
|
|
1507
|
-
}
|
|
1508
|
-
return u.reverse();
|
|
1509
|
-
}
|
|
1510
|
-
function Si(n, i, p) {
|
|
1511
|
-
const c = n.slice().sort((a, x) => a.skip - x.skip).sort((a, x) => a.index - x.index);
|
|
1512
|
-
let f = p, u = 0, l = i;
|
|
1513
|
-
for (const a of c.reverse()) {
|
|
1514
|
-
const x = l - a.index;
|
|
1515
|
-
if (f = f - x, f > -1)
|
|
1516
|
-
u++, l = a.index;
|
|
1517
|
-
else
|
|
1518
|
-
break;
|
|
1519
|
-
}
|
|
1520
|
-
return u;
|
|
1521
|
-
}
|
|
1522
|
-
function Pi(n) {
|
|
1523
|
-
return Object.values(n).flatMap((i) => i).sort(
|
|
1524
|
-
(i, p) => new Date(i.timestamp).getTime() - new Date(p.timestamp).getTime()
|
|
1525
|
-
);
|
|
1526
|
-
}
|
|
1527
|
-
function Bi(n) {
|
|
1528
|
-
return Object.values(n).flatMap((i) => i).sort(
|
|
1529
|
-
(i, p) => new Date(i.operation.timestamp).getTime() - new Date(p.operation.timestamp).getTime()
|
|
1530
|
-
);
|
|
1531
|
-
}
|
|
1532
|
-
function lt(n, i, p, c, f, u = Kt, l = {}) {
|
|
1533
|
-
const a = _i(p, u);
|
|
1534
|
-
return ne(
|
|
1535
|
-
n,
|
|
1536
|
-
i,
|
|
1537
|
-
a,
|
|
1538
|
-
c,
|
|
1539
|
-
f,
|
|
1540
|
-
l
|
|
1541
|
-
);
|
|
1542
|
-
}
|
|
1543
|
-
function ne(n, i, p, c, f, u = {}) {
|
|
1544
|
-
const l = ki(n), a = Object.keys(i).reduce((y, b) => {
|
|
1545
|
-
const E = b;
|
|
1546
|
-
return {
|
|
1547
|
-
...y,
|
|
1548
|
-
[E]: i[E].slice(0, f == null ? void 0 : f.revision[E])
|
|
1549
|
-
};
|
|
1550
|
-
}, {}), x = Object.keys(a).reduce(
|
|
1551
|
-
(y, b) => {
|
|
1552
|
-
const E = b;
|
|
1553
|
-
return {
|
|
1554
|
-
...y,
|
|
1555
|
-
[E]: Ai(
|
|
1556
|
-
a[E],
|
|
1557
|
-
u[E]
|
|
1558
|
-
)
|
|
1559
|
-
};
|
|
1560
|
-
},
|
|
1561
|
-
{}
|
|
1562
|
-
), d = Bi(x).reduce(
|
|
1563
|
-
(y, { ignore: b, operation: E }) => b ? p(y, yt(E.scope), c, {
|
|
1564
|
-
skip: E.skip,
|
|
1565
|
-
ignoreSkipOperations: !0
|
|
1566
|
-
}) : p(y, E, c, {
|
|
1567
|
-
skip: E.skip,
|
|
1568
|
-
ignoreSkipOperations: !0
|
|
1569
|
-
}),
|
|
1570
|
-
l
|
|
1571
|
-
), v = Object.keys(
|
|
1572
|
-
d.operations
|
|
1573
|
-
).reduce(
|
|
1574
|
-
(y, b) => {
|
|
1575
|
-
const E = b, U = f && f.revision[E] < i[E].length ? i[E].slice(f.revision[E]) : [];
|
|
1576
|
-
return {
|
|
1577
|
-
...y,
|
|
1578
|
-
[E]: [
|
|
1579
|
-
...d.operations[E].map((R, $) => {
|
|
1580
|
-
var Y;
|
|
1581
|
-
return {
|
|
1582
|
-
...R,
|
|
1583
|
-
timestamp: ((Y = i[E][$]) == null ? void 0 : Y.timestamp) ?? R.timestamp
|
|
1584
|
-
};
|
|
1585
|
-
}),
|
|
1586
|
-
...U
|
|
1587
|
-
]
|
|
1588
|
-
};
|
|
1589
|
-
},
|
|
1590
|
-
{ global: [], local: [] }
|
|
1591
|
-
), g = Object.values(v).reduce((y, b) => {
|
|
1592
|
-
for (const E of b)
|
|
1593
|
-
E.timestamp > y && (y = E.timestamp);
|
|
1594
|
-
return y;
|
|
1595
|
-
}, n.lastModified);
|
|
1596
|
-
return { ...d, operations: v, lastModified: g };
|
|
1597
|
-
}
|
|
1598
|
-
function qi(n, i) {
|
|
1599
|
-
return pt(n) === pt(i);
|
|
1600
|
-
}
|
|
1601
|
-
const oe = (n) => z(
|
|
1602
|
-
"SET_NAME",
|
|
1603
|
-
n,
|
|
1604
|
-
void 0,
|
|
1605
|
-
ht,
|
|
1606
|
-
void 0
|
|
1607
|
-
), ae = (n = 1, i = "global") => z(
|
|
1608
|
-
"UNDO",
|
|
1609
|
-
n,
|
|
1610
|
-
void 0,
|
|
1611
|
-
xt,
|
|
1612
|
-
i
|
|
1613
|
-
), pe = (n = 1, i = "global") => z(
|
|
1614
|
-
"REDO",
|
|
1615
|
-
n,
|
|
1616
|
-
void 0,
|
|
1617
|
-
mt,
|
|
1618
|
-
i
|
|
1619
|
-
), se = (n, i, p = "global") => z(
|
|
1620
|
-
"PRUNE",
|
|
1621
|
-
{ start: n, end: i },
|
|
1622
|
-
void 0,
|
|
1623
|
-
ft,
|
|
1624
|
-
p
|
|
1625
|
-
), gt = (n, i) => z(
|
|
1626
|
-
"LOAD_STATE",
|
|
1627
|
-
{ state: n, operations: i },
|
|
1628
|
-
void 0,
|
|
1629
|
-
ut
|
|
1630
|
-
), yt = (n = "global") => z("NOOP", {}, void 0, void 0, n), Wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1631
|
-
__proto__: null,
|
|
1632
|
-
loadState: gt,
|
|
1633
|
-
noop: yt,
|
|
1634
|
-
prune: se,
|
|
1635
|
-
redo: pe,
|
|
1636
|
-
setName: oe,
|
|
1637
|
-
undo: ae
|
|
1638
|
-
}, Symbol.toStringTag, { value: "Module" })), ce = { "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"] };
|
|
1639
|
-
Object.freeze(ce);
|
|
1640
|
-
var I = function(n, i, p, c) {
|
|
1641
|
-
if (p === "a" && !c)
|
|
1642
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
1643
|
-
if (typeof i == "function" ? n !== i || !c : !i.has(n))
|
|
1644
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1645
|
-
return p === "m" ? c : p === "a" ? c.call(n) : c ? c.value : i.get(n);
|
|
1646
|
-
}, L, P, N;
|
|
1647
|
-
class ji {
|
|
1648
|
-
constructor(...i) {
|
|
1649
|
-
L.set(this, /* @__PURE__ */ new Map()), P.set(this, /* @__PURE__ */ new Map()), N.set(this, /* @__PURE__ */ new Map());
|
|
1650
|
-
for (const p of i)
|
|
1651
|
-
this.define(p);
|
|
1652
|
-
}
|
|
1653
|
-
define(i, p = !1) {
|
|
1654
|
-
for (let [c, f] of Object.entries(i)) {
|
|
1655
|
-
c = c.toLowerCase(), f = f.map((a) => a.toLowerCase()), I(this, N, "f").has(c) || I(this, N, "f").set(c, /* @__PURE__ */ new Set());
|
|
1656
|
-
const u = I(this, N, "f").get(c);
|
|
1657
|
-
let l = !0;
|
|
1658
|
-
for (let a of f) {
|
|
1659
|
-
const x = a.startsWith("*");
|
|
1660
|
-
if (a = x ? a.slice(1) : a, u == null || u.add(a), l && I(this, P, "f").set(c, a), l = !1, x)
|
|
1661
|
-
continue;
|
|
1662
|
-
const d = I(this, L, "f").get(a);
|
|
1663
|
-
if (d && d != c && !p)
|
|
1664
|
-
throw new Error(`"${c} -> ${a}" conflicts with "${d} -> ${a}". Pass \`force=true\` to override this definition.`);
|
|
1665
|
-
I(this, L, "f").set(a, c);
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
return this;
|
|
1669
|
-
}
|
|
1670
|
-
getType(i) {
|
|
1671
|
-
if (typeof i != "string")
|
|
1672
|
-
return null;
|
|
1673
|
-
const p = i.replace(/^.*[/\\]/, "").toLowerCase(), c = p.replace(/^.*\./, "").toLowerCase(), f = p.length < i.length;
|
|
1674
|
-
return !(c.length < p.length - 1) && f ? null : I(this, L, "f").get(c) ?? null;
|
|
1675
|
-
}
|
|
1676
|
-
getExtension(i) {
|
|
1677
|
-
var p;
|
|
1678
|
-
return typeof i != "string" ? null : (i = (p = i == null ? void 0 : i.split) == null ? void 0 : p.call(i, ";")[0], (i && I(this, P, "f").get(i.trim().toLowerCase())) ?? null);
|
|
1679
|
-
}
|
|
1680
|
-
getAllExtensions(i) {
|
|
1681
|
-
return typeof i != "string" ? null : I(this, N, "f").get(i.toLowerCase()) ?? null;
|
|
1682
|
-
}
|
|
1683
|
-
_freeze() {
|
|
1684
|
-
this.define = () => {
|
|
1685
|
-
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
1686
|
-
}, Object.freeze(this);
|
|
1687
|
-
for (const i of I(this, N, "f").values())
|
|
1688
|
-
Object.freeze(i);
|
|
1689
|
-
return this;
|
|
1690
|
-
}
|
|
1691
|
-
_getTestState() {
|
|
1692
|
-
return {
|
|
1693
|
-
types: I(this, L, "f"),
|
|
1694
|
-
extensions: I(this, P, "f")
|
|
1695
|
-
};
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
L = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap();
|
|
1699
|
-
const Ii = new ji(ce)._freeze();
|
|
1700
|
-
function Oi(n) {
|
|
1701
|
-
const i = [], p = Object.keys(n);
|
|
1702
|
-
for (const c of p) {
|
|
1703
|
-
const f = n[c].sort((u, l) => u.index - l.index);
|
|
1704
|
-
for (let u = 0; u < f.length; u++)
|
|
1705
|
-
f[u].index !== u && i.push({
|
|
1706
|
-
message: `Invalid operation index ${f[u].index} at position ${u}`,
|
|
1707
|
-
details: {
|
|
1708
|
-
position: u,
|
|
1709
|
-
operation: f[u],
|
|
1710
|
-
scope: f[u].scope
|
|
1711
|
-
}
|
|
1712
|
-
});
|
|
1713
|
-
}
|
|
1714
|
-
return i;
|
|
1715
|
-
}
|
|
1716
|
-
const le = async (n) => {
|
|
1717
|
-
const i = new Dt(), { name: p, revision: c, documentType: f, created: u, lastModified: l } = n, a = {
|
|
1718
|
-
name: p,
|
|
1719
|
-
revision: c,
|
|
1720
|
-
documentType: f,
|
|
1721
|
-
created: u,
|
|
1722
|
-
lastModified: l
|
|
1723
|
-
};
|
|
1724
|
-
return i.file("header.json", JSON.stringify(a, null, 2)), i.file(
|
|
1725
|
-
"state.json",
|
|
1726
|
-
JSON.stringify(n.initialState || {}, null, 2)
|
|
1727
|
-
), i.file("operations.json", JSON.stringify(n.operations, null, 2)), Object.keys(n.attachments).forEach((d) => {
|
|
1728
|
-
const { data: v, ...g } = n.attachments[d];
|
|
1729
|
-
i.file(d, v, {
|
|
1730
|
-
base64: !0,
|
|
1731
|
-
createFolders: !0,
|
|
1732
|
-
comment: JSON.stringify(g)
|
|
1733
|
-
});
|
|
1734
|
-
}), i;
|
|
1735
|
-
}, Ui = async (n, i, p, c) => {
|
|
1736
|
-
await (await le(n)).generateAsync({
|
|
1737
|
-
type: "uint8array",
|
|
1738
|
-
streamFiles: !0
|
|
1739
|
-
});
|
|
1740
|
-
const u = c ?? n.name, l = `.${p}.zip`;
|
|
1741
|
-
return gi(
|
|
1742
|
-
i,
|
|
1743
|
-
u.endsWith(l) ? u : `${u}${l}`
|
|
1744
|
-
);
|
|
1745
|
-
}, Ji = async (n, i) => {
|
|
1746
|
-
const c = await (await le(n)).generateAsync({ type: "blob" }), f = await i.createWritable();
|
|
1747
|
-
await f.write(c), await f.close();
|
|
1748
|
-
}, Tt = async (n, i) => {
|
|
1749
|
-
const p = ie();
|
|
1750
|
-
return Ti(p, i);
|
|
1751
|
-
}, Ti = async (n, i) => {
|
|
1752
|
-
const p = new Dt();
|
|
1753
|
-
return await p.loadAsync(n), Di(p, i);
|
|
1754
|
-
};
|
|
1755
|
-
async function Di(n, i) {
|
|
1756
|
-
const p = n.file("state.json");
|
|
1757
|
-
if (!p)
|
|
1758
|
-
throw new Error("Initial state not found");
|
|
1759
|
-
const c = await p.async("string"), f = JSON.parse(c), u = n.file("header.json");
|
|
1760
|
-
let l;
|
|
1761
|
-
u && (l = JSON.parse(await u.async("string")));
|
|
1762
|
-
const a = n.file("operations.json");
|
|
1763
|
-
if (!a)
|
|
1764
|
-
throw new Error("Operations history not found");
|
|
1765
|
-
const x = JSON.parse(
|
|
1766
|
-
await a.async("string")
|
|
1767
|
-
), d = Oi(x);
|
|
1768
|
-
if (d.length) {
|
|
1769
|
-
const g = d.map((y) => y.message);
|
|
1770
|
-
throw new Error(g.join(`
|
|
1771
|
-
`));
|
|
1772
|
-
}
|
|
1773
|
-
let v = ne(
|
|
1774
|
-
f,
|
|
1775
|
-
x,
|
|
1776
|
-
i,
|
|
1777
|
-
void 0,
|
|
1778
|
-
l
|
|
1779
|
-
);
|
|
1780
|
-
return l && (v = {
|
|
1781
|
-
...v,
|
|
1782
|
-
...l
|
|
1783
|
-
}), v;
|
|
1784
|
-
}
|
|
1785
|
-
function ue(n) {
|
|
1786
|
-
const i = n.replace(/^.*\./, "") || void 0, p = n.replace(/^.*[/\\]/, "") || void 0;
|
|
1787
|
-
return { extension: i, fileName: p };
|
|
1788
|
-
}
|
|
1789
|
-
async function Hi(n) {
|
|
1790
|
-
const { buffer: i, mimeType: p = "application/octet-stream" } = await yi(), c = ue(n), f = i.toString("base64");
|
|
1791
|
-
return {
|
|
1792
|
-
data: f,
|
|
1793
|
-
hash: it(f),
|
|
1794
|
-
mimeType: p,
|
|
1795
|
-
...c
|
|
1796
|
-
};
|
|
1797
|
-
}
|
|
1798
|
-
async function Zi(n) {
|
|
1799
|
-
const i = await vi(), p = Ii.getType(n) || "application/octet-stream", c = ue(n), f = i.toString("base64");
|
|
1800
|
-
return { data: f, hash: it(f), mimeType: p, ...c };
|
|
1801
|
-
}
|
|
1802
|
-
class Yi {
|
|
1803
|
-
/**
|
|
1804
|
-
* Constructs a BaseDocument instance with an initial state.
|
|
1805
|
-
* @param reducer - The reducer function that updates the state.
|
|
1806
|
-
* @param document - The initial state of the document.
|
|
1807
|
-
*/
|
|
1808
|
-
constructor(i, p, c) {
|
|
1809
|
-
V(this, "_document");
|
|
1810
|
-
V(this, "_reducer");
|
|
1811
|
-
V(this, "_signalDispatch");
|
|
1812
|
-
this._reducer = i, this._document = p, this._signalDispatch = c;
|
|
1813
|
-
}
|
|
1814
|
-
/**
|
|
1815
|
-
* Dispatches an action to update the state of the document.
|
|
1816
|
-
* @param action - The action to dispatch.
|
|
1817
|
-
* @returns The Document instance.
|
|
1818
|
-
*/
|
|
1819
|
-
dispatch(i, p) {
|
|
1820
|
-
return this._document = this._reducer(
|
|
1821
|
-
this._document,
|
|
1822
|
-
i,
|
|
1823
|
-
this._signalDispatch,
|
|
1824
|
-
p
|
|
1825
|
-
), this;
|
|
1826
|
-
}
|
|
1827
|
-
/**
|
|
1828
|
-
* Saves the state of the document to a file.
|
|
1829
|
-
* @param path - The file path where the state should be saved.
|
|
1830
|
-
* @param extension - The file extension to use when saving the state.
|
|
1831
|
-
* @returns The file path where the state was saved.
|
|
1832
|
-
*/
|
|
1833
|
-
saveToFile(i, p, c) {
|
|
1834
|
-
return Ui(this._document, i, p, c);
|
|
1835
|
-
}
|
|
1836
|
-
/**
|
|
1837
|
-
* Loads the state of the document from a file.
|
|
1838
|
-
* @param path - The file path where the state is stored.
|
|
1839
|
-
*/
|
|
1840
|
-
async loadFromFile(i) {
|
|
1841
|
-
this._document = await Tt(i, this._reducer);
|
|
1842
|
-
}
|
|
1843
|
-
/**
|
|
1844
|
-
* Loads the state of the document from a file and returns it.
|
|
1845
|
-
* @param path - The file path where the state is stored.
|
|
1846
|
-
* @param reducer - The reducer function that updates the state.
|
|
1847
|
-
* @returns The state of the document.
|
|
1848
|
-
*/
|
|
1849
|
-
static async stateFromFile(i, p) {
|
|
1850
|
-
return await Tt(i, p);
|
|
1851
|
-
}
|
|
1852
|
-
/**
|
|
1853
|
-
* Gets the current state of the document.
|
|
1854
|
-
*/
|
|
1855
|
-
get state() {
|
|
1856
|
-
return X(this._document.state);
|
|
1857
|
-
}
|
|
1858
|
-
/**
|
|
1859
|
-
* Gets the list of operations performed on the document.
|
|
1860
|
-
*/
|
|
1861
|
-
get operations() {
|
|
1862
|
-
return X(this._document.operations);
|
|
1863
|
-
}
|
|
1864
|
-
/**
|
|
1865
|
-
* Gets the name of the document.
|
|
1866
|
-
*/
|
|
1867
|
-
get name() {
|
|
1868
|
-
return this._document.name;
|
|
1869
|
-
}
|
|
1870
|
-
/**
|
|
1871
|
-
* Gets the type of document.
|
|
1872
|
-
*/
|
|
1873
|
-
get documentType() {
|
|
1874
|
-
return this._document.documentType;
|
|
1875
|
-
}
|
|
1876
|
-
/**
|
|
1877
|
-
* Gets the timestamp of the date the document was created.
|
|
1878
|
-
*/
|
|
1879
|
-
get created() {
|
|
1880
|
-
return this._document.created;
|
|
1881
|
-
}
|
|
1882
|
-
/**
|
|
1883
|
-
* Gets the timestamp of the date the document was last modified.
|
|
1884
|
-
*/
|
|
1885
|
-
get lastModified() {
|
|
1886
|
-
return this._document.lastModified;
|
|
1887
|
-
}
|
|
1888
|
-
/**
|
|
1889
|
-
* Gets the global revision number of the document.
|
|
1890
|
-
*/
|
|
1891
|
-
get revision() {
|
|
1892
|
-
return this._document.revision.global;
|
|
1893
|
-
}
|
|
1894
|
-
getRevision(i) {
|
|
1895
|
-
return this._document.revision[i];
|
|
1896
|
-
}
|
|
1897
|
-
/**
|
|
1898
|
-
* Gets the initial state of the document.
|
|
1899
|
-
*/
|
|
1900
|
-
get initialState() {
|
|
1901
|
-
return X(this._document.initialState);
|
|
1902
|
-
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Returns the current document as an object
|
|
1905
|
-
*/
|
|
1906
|
-
toDocument() {
|
|
1907
|
-
return X(this._document);
|
|
1908
|
-
}
|
|
1909
|
-
/**
|
|
1910
|
-
* Gets the attachment associated with the given key.
|
|
1911
|
-
* @param attachment - The key of the attachment to retrieve.
|
|
1912
|
-
*/
|
|
1913
|
-
getAttachment(i) {
|
|
1914
|
-
return this._document.attachments[i];
|
|
1915
|
-
}
|
|
1916
|
-
/**
|
|
1917
|
-
* Sets the name of the document.
|
|
1918
|
-
* @param name - The new name of the document.
|
|
1919
|
-
*/
|
|
1920
|
-
setName(i) {
|
|
1921
|
-
return this.dispatch(oe(i)), this;
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* Reverts a number of actions from the document.
|
|
1925
|
-
* @param count - The number of actions to revert.
|
|
1926
|
-
*/
|
|
1927
|
-
undo(i) {
|
|
1928
|
-
return this.dispatch(ae(i)), this;
|
|
1929
|
-
}
|
|
1930
|
-
/**
|
|
1931
|
-
* Reapplies a number of actions to the document.
|
|
1932
|
-
* @param count - The number of actions to reapply.
|
|
1933
|
-
*/
|
|
1934
|
-
redo(i) {
|
|
1935
|
-
return this.dispatch(pe(i)), this;
|
|
1936
|
-
}
|
|
1937
|
-
/**
|
|
1938
|
-
* Removes a range of operations from the document.
|
|
1939
|
-
* @param start - The starting index of the range to remove.
|
|
1940
|
-
* @param end - The ending index of the range to remove.
|
|
1941
|
-
*/
|
|
1942
|
-
prune(i, p) {
|
|
1943
|
-
return this.dispatch(se(i, p)), this;
|
|
1944
|
-
}
|
|
1945
|
-
/**
|
|
1946
|
-
* Loads a document state and a set of operations.
|
|
1947
|
-
* @param state - The state to load.
|
|
1948
|
-
* @param operations - The operations to apply to the document.
|
|
1949
|
-
*/
|
|
1950
|
-
loadState(i, p) {
|
|
1951
|
-
return this.dispatch(gt(i, p)), this;
|
|
1952
|
-
}
|
|
1953
|
-
}
|
|
1954
|
-
function Gi(n, i) {
|
|
1955
|
-
i.forEach((p) => {
|
|
1956
|
-
Object.getOwnPropertyNames(p.prototype).forEach((c) => {
|
|
1957
|
-
Object.defineProperty(
|
|
1958
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1959
|
-
n.prototype,
|
|
1960
|
-
c,
|
|
1961
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
1962
|
-
Object.getOwnPropertyDescriptor(p.prototype, c) || /* @__PURE__ */ Object.create(null)
|
|
1963
|
-
);
|
|
1964
|
-
});
|
|
1965
|
-
});
|
|
1966
|
-
}
|
|
1967
|
-
export {
|
|
1968
|
-
Oi as A,
|
|
1969
|
-
Yi as B,
|
|
1970
|
-
Kt as C,
|
|
1971
|
-
Ke as D,
|
|
1972
|
-
zi as E,
|
|
1973
|
-
Fi as a,
|
|
1974
|
-
ki as b,
|
|
1975
|
-
_i as c,
|
|
1976
|
-
Ji as d,
|
|
1977
|
-
Ti as e,
|
|
1978
|
-
z as f,
|
|
1979
|
-
Gi as g,
|
|
1980
|
-
Wi as h,
|
|
1981
|
-
Ut as i,
|
|
1982
|
-
Si as j,
|
|
1983
|
-
le as k,
|
|
1984
|
-
Tt as l,
|
|
1985
|
-
Zi as m,
|
|
1986
|
-
Hi as n,
|
|
1987
|
-
re as o,
|
|
1988
|
-
$i as p,
|
|
1989
|
-
Ei as q,
|
|
1990
|
-
qi as r,
|
|
1991
|
-
Ui as s,
|
|
1992
|
-
Ot as t,
|
|
1993
|
-
Ai as u,
|
|
1994
|
-
X as v,
|
|
1995
|
-
ne as w,
|
|
1996
|
-
lt as x,
|
|
1997
|
-
Bi as y,
|
|
1998
|
-
Pi as z
|
|
1999
|
-
};
|