document-model 1.0.31 → 1.0.33
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 +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +2 -2
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/index-CBO7uxzK.js +41 -0
- package/dist/browser/internal/index-CTCFa4de.js +1 -0
- package/dist/browser/internal/{index-B7qIPXoz.js → index-DTIvFQBH.js} +1 -1
- package/dist/browser/internal/{index-BFOiHt6I.js → index-i5s_5m9e.js} +1 -1
- package/dist/browser/internal/object-BOMJbn2Y.js +7 -0
- package/dist/browser/internal/{object-Diya-yJS.js → object-CqQGngpx.js} +728 -720
- package/dist/browser/src/document/types.d.ts +3 -1
- package/dist/browser/src/document/utils/base.d.ts +1 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +3 -3
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/internal/index-C21AbOFE.js +41 -0
- package/dist/node/internal/{index-CsNA2GBY.js → index-CP5hMjbq.js} +1 -1
- package/dist/node/internal/index-CW5xQQ7a.js +1 -0
- package/dist/node/internal/{index-C-NbJIDm.js → index-rIcx-JJZ.js} +1 -1
- package/dist/node/internal/{object-usT57J9v.js → object-BIG1wTk-.js} +331 -323
- package/dist/node/internal/object-C778ylvS.js +2 -0
- package/dist/node/src/document/types.d.ts +3 -1
- package/dist/node/src/document/utils/base.d.ts +1 -0
- package/package.json +1 -1
- package/dist/browser/internal/index-BVR8cGlp.js +0 -1
- package/dist/browser/internal/index-DtMGoFXU.js +0 -40
- package/dist/browser/internal/object-O_qdzVL-.js +0 -7
- package/dist/node/internal/index-Bxw-tgFs.js +0 -1
- package/dist/node/internal/index-Ly6V0vGQ.js +0 -40
- package/dist/node/internal/object-DyU92wWO.js +0 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { produce as k, castDraft as A, castImmutable as
|
|
5
|
-
import
|
|
1
|
+
var vt = Object.defineProperty;
|
|
2
|
+
var yt = (e, t, i) => t in e ? vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var D = (e, t, i) => (yt(e, typeof t != "symbol" ? t + "" : t, i), i);
|
|
4
|
+
import { produce as k, castDraft as A, castImmutable as jt, freeze as Ot } from "immer";
|
|
5
|
+
import z from "json-stringify-deterministic";
|
|
6
6
|
import { z as c } from "zod";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { join as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
13
|
-
function
|
|
7
|
+
import kt from "crypto";
|
|
8
|
+
import M from "fs";
|
|
9
|
+
import St from "https";
|
|
10
|
+
import { join as _t } from "path";
|
|
11
|
+
import Z from "jszip";
|
|
12
|
+
const H = (e) => e != null, Et = c.any().refine((e) => H(e)), K = c.enum(["LOAD_STATE"]), V = c.enum(["PRUNE"]), G = c.enum(["REDO"]), Q = c.enum(["SET_NAME"]), X = c.enum(["UNDO"]);
|
|
13
|
+
function Dt() {
|
|
14
14
|
return c.object({
|
|
15
15
|
__typename: c.literal("Action").optional(),
|
|
16
16
|
type: c.string()
|
|
@@ -19,16 +19,16 @@ function Et() {
|
|
|
19
19
|
function S() {
|
|
20
20
|
return c.literal("global").or(c.literal("local"));
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Y() {
|
|
23
23
|
return c.union([
|
|
24
|
-
|
|
25
|
-
et(),
|
|
24
|
+
tt(),
|
|
26
25
|
it(),
|
|
27
26
|
at(),
|
|
28
|
-
nt()
|
|
27
|
+
nt(),
|
|
28
|
+
ot()
|
|
29
29
|
]);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Nt() {
|
|
32
32
|
return c.object({
|
|
33
33
|
__typename: c.literal("DocumentFile").optional(),
|
|
34
34
|
data: c.string(),
|
|
@@ -37,26 +37,26 @@ function Dt() {
|
|
|
37
37
|
mimeType: c.string()
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function tt() {
|
|
41
41
|
return c.object({
|
|
42
|
-
input: c.lazy(() =>
|
|
43
|
-
type:
|
|
42
|
+
input: c.lazy(() => I()),
|
|
43
|
+
type: K,
|
|
44
44
|
scope: S()
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function I() {
|
|
48
48
|
return c.object({
|
|
49
49
|
operations: c.number(),
|
|
50
|
-
state: c.lazy(() =>
|
|
50
|
+
state: c.lazy(() => et())
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function et() {
|
|
54
54
|
return c.object({
|
|
55
55
|
data: c.unknown().nullish(),
|
|
56
56
|
name: c.string()
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Tt() {
|
|
60
60
|
return c.object({
|
|
61
61
|
__typename: c.literal("Operation").optional(),
|
|
62
62
|
hash: c.string(),
|
|
@@ -65,36 +65,36 @@ function Nt() {
|
|
|
65
65
|
type: c.string()
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function it() {
|
|
69
69
|
return c.object({
|
|
70
|
-
input: c.lazy(() =>
|
|
71
|
-
type:
|
|
70
|
+
input: c.lazy(() => F()),
|
|
71
|
+
type: V,
|
|
72
72
|
scope: S()
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function F() {
|
|
76
76
|
return c.object({
|
|
77
77
|
end: c.number().nullish(),
|
|
78
78
|
start: c.number().nullish()
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
81
|
+
const R = c.number;
|
|
82
|
+
function at() {
|
|
83
83
|
return c.object({
|
|
84
|
-
input:
|
|
85
|
-
type:
|
|
84
|
+
input: R(),
|
|
85
|
+
type: G,
|
|
86
86
|
scope: S()
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
-
const
|
|
90
|
-
function
|
|
89
|
+
const q = c.string;
|
|
90
|
+
function nt() {
|
|
91
91
|
return c.object({
|
|
92
|
-
input:
|
|
93
|
-
type:
|
|
92
|
+
input: q(),
|
|
93
|
+
type: Q,
|
|
94
94
|
scope: c.literal("global")
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function At() {
|
|
98
98
|
return c.object({
|
|
99
99
|
__typename: c.literal("SetNameOperation").optional(),
|
|
100
100
|
hash: c.string(),
|
|
@@ -104,45 +104,45 @@ function Tt() {
|
|
|
104
104
|
type: c.string()
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
const
|
|
108
|
-
function
|
|
107
|
+
const L = c.number;
|
|
108
|
+
function ot() {
|
|
109
109
|
return c.object({
|
|
110
|
-
input:
|
|
111
|
-
type:
|
|
110
|
+
input: L(),
|
|
111
|
+
type: X,
|
|
112
112
|
scope: S()
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
116
116
|
__proto__: null,
|
|
117
|
-
ActionSchema:
|
|
118
|
-
BaseActionSchema:
|
|
119
|
-
DocumentFileSchema:
|
|
120
|
-
LoadStateActionInputSchema:
|
|
121
|
-
LoadStateActionSchema:
|
|
122
|
-
LoadStateActionStateInputSchema:
|
|
123
|
-
Load_StateSchema:
|
|
124
|
-
OperationSchema:
|
|
117
|
+
ActionSchema: Dt,
|
|
118
|
+
BaseActionSchema: Y,
|
|
119
|
+
DocumentFileSchema: Nt,
|
|
120
|
+
LoadStateActionInputSchema: I,
|
|
121
|
+
LoadStateActionSchema: tt,
|
|
122
|
+
LoadStateActionStateInputSchema: et,
|
|
123
|
+
Load_StateSchema: K,
|
|
124
|
+
OperationSchema: Tt,
|
|
125
125
|
OperationScopeSchema: S,
|
|
126
|
-
PruneActionInputSchema:
|
|
127
|
-
PruneActionSchema:
|
|
128
|
-
PruneSchema:
|
|
129
|
-
RedoActionInputSchema:
|
|
130
|
-
RedoActionSchema:
|
|
131
|
-
RedoSchema:
|
|
132
|
-
SetNameActionInputSchema:
|
|
133
|
-
SetNameActionSchema:
|
|
134
|
-
SetNameOperationSchema:
|
|
135
|
-
Set_NameSchema:
|
|
136
|
-
UndoActionInputSchema:
|
|
137
|
-
UndoActionSchema:
|
|
138
|
-
UndoSchema:
|
|
139
|
-
definedNonNullAnySchema:
|
|
140
|
-
isDefinedNonNullAny:
|
|
126
|
+
PruneActionInputSchema: F,
|
|
127
|
+
PruneActionSchema: it,
|
|
128
|
+
PruneSchema: V,
|
|
129
|
+
RedoActionInputSchema: R,
|
|
130
|
+
RedoActionSchema: at,
|
|
131
|
+
RedoSchema: G,
|
|
132
|
+
SetNameActionInputSchema: q,
|
|
133
|
+
SetNameActionSchema: nt,
|
|
134
|
+
SetNameOperationSchema: At,
|
|
135
|
+
Set_NameSchema: Q,
|
|
136
|
+
UndoActionInputSchema: L,
|
|
137
|
+
UndoActionSchema: ot,
|
|
138
|
+
UndoSchema: X,
|
|
139
|
+
definedNonNullAnySchema: Et,
|
|
140
|
+
isDefinedNonNullAny: H
|
|
141
141
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
142
|
-
function
|
|
142
|
+
function zt(e, t) {
|
|
143
143
|
return { ...e, name: t };
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Mt(e, t, i) {
|
|
146
146
|
const a = {
|
|
147
147
|
skip: i,
|
|
148
148
|
document: e
|
|
@@ -152,7 +152,7 @@ function zt(e, t, i) {
|
|
|
152
152
|
t.skip && t.skip > 0 && (s.skip = t.skip), o.type === "NOOP" && t.index === o.index && s.skip > o.skip && s.document.operations[n].pop();
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Pt(e, t, i) {
|
|
156
156
|
const { scope: a, input: n } = t;
|
|
157
157
|
return k({
|
|
158
158
|
document: e,
|
|
@@ -171,21 +171,21 @@ function Mt(e, t, i) {
|
|
|
171
171
|
throw new Error(
|
|
172
172
|
"Cannot undo: skip value from reducer cannot be used with UNDO action"
|
|
173
173
|
);
|
|
174
|
-
const [p] = o.document.operations[a].slice(-1),
|
|
175
|
-
if (o.skip += n,
|
|
174
|
+
const [p] = o.document.operations[a].slice(-1), l = p.type === "NOOP" && p.skip > 0;
|
|
175
|
+
if (o.skip += n, l && (o.skip += p.skip, o.document.operations[a].pop()), o.document.operations[a].length < o.skip)
|
|
176
176
|
throw new Error(
|
|
177
177
|
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
178
178
|
);
|
|
179
|
-
const
|
|
180
|
-
let
|
|
181
|
-
for (;
|
|
182
|
-
const
|
|
183
|
-
|
|
179
|
+
const r = o.document.operations[a].length - 1;
|
|
180
|
+
let x = n, d = l ? r - p.skip : r;
|
|
181
|
+
for (; x > 0 && d >= 0; ) {
|
|
182
|
+
const m = o.document.operations[a][d];
|
|
183
|
+
m.type === "NOOP" && m.skip > 0 ? (d = d - (m.skip + 1), o.skip += m.skip + 1) : (o.document.clipboard.push({ ...m }), x--, d--);
|
|
184
184
|
}
|
|
185
|
-
o.action =
|
|
185
|
+
o.action = $(a);
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function It(e, t, i) {
|
|
189
189
|
const { scope: a, input: n } = t;
|
|
190
190
|
return k({
|
|
191
191
|
document: e,
|
|
@@ -205,81 +205,81 @@ function Pt(e, t, i) {
|
|
|
205
205
|
if (o.document.clipboard.length < 1)
|
|
206
206
|
throw new Error("Cannot redo: no operations in the clipboard");
|
|
207
207
|
const p = o.document.clipboard.findLastIndex(
|
|
208
|
-
(
|
|
208
|
+
(r) => r.scope === a
|
|
209
209
|
);
|
|
210
210
|
if (p < 0)
|
|
211
211
|
throw new Error(
|
|
212
212
|
`Cannot redo: no operations in clipboard for scope "${a}"`
|
|
213
213
|
);
|
|
214
|
-
const
|
|
214
|
+
const l = o.document.clipboard.splice(p, 1)[0];
|
|
215
215
|
o.action = A({
|
|
216
|
-
type:
|
|
217
|
-
scope:
|
|
218
|
-
input:
|
|
216
|
+
type: l.type,
|
|
217
|
+
scope: l.scope,
|
|
218
|
+
input: l.input
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
function
|
|
222
|
+
function Ft(e, t, i) {
|
|
223
223
|
const { scope: a } = t, n = e.operations[a];
|
|
224
224
|
let {
|
|
225
225
|
input: { start: s, end: o }
|
|
226
226
|
} = t;
|
|
227
227
|
s = s || 0, o = o || n.length;
|
|
228
|
-
const p = n.slice(s, o),
|
|
228
|
+
const p = n.slice(s, o), l = n.slice(0, s), r = n.slice(o), x = P(
|
|
229
229
|
e.initialState,
|
|
230
230
|
{
|
|
231
231
|
...e.operations,
|
|
232
|
-
[a]:
|
|
232
|
+
[a]: l.concat(p)
|
|
233
233
|
},
|
|
234
234
|
i
|
|
235
|
-
), { name:
|
|
236
|
-
return
|
|
235
|
+
), { name: d, state: m } = x, f = l.length, u = l.length ? l[l.length - 1].timestamp : r.length ? r[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
236
|
+
return P(
|
|
237
237
|
e.initialState,
|
|
238
238
|
{
|
|
239
239
|
...e.operations,
|
|
240
240
|
[a]: [
|
|
241
|
-
...
|
|
241
|
+
...l,
|
|
242
242
|
{
|
|
243
|
-
...
|
|
244
|
-
{ name:
|
|
243
|
+
...U(
|
|
244
|
+
{ name: d, state: m },
|
|
245
245
|
p.length
|
|
246
246
|
),
|
|
247
|
-
timestamp:
|
|
248
|
-
index:
|
|
249
|
-
hash: lt({ state:
|
|
247
|
+
timestamp: u,
|
|
248
|
+
index: f,
|
|
249
|
+
hash: lt({ state: m }, "global")
|
|
250
250
|
},
|
|
251
|
-
...
|
|
252
|
-
...
|
|
253
|
-
index:
|
|
251
|
+
...r.map((j, E) => ({
|
|
252
|
+
...j,
|
|
253
|
+
index: f + E + 1
|
|
254
254
|
}))
|
|
255
255
|
]
|
|
256
256
|
},
|
|
257
257
|
i
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Rt(e, t) {
|
|
261
261
|
return {
|
|
262
262
|
...e,
|
|
263
263
|
name: t.name,
|
|
264
264
|
state: t.state ?? { global: {}, local: {} }
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
|
-
const
|
|
268
|
-
function
|
|
267
|
+
const st = "SET_NAME", w = "UNDO", v = "REDO", _ = "PRUNE", pt = "LOAD_STATE", qt = "NOOP";
|
|
268
|
+
function Lt(e, t) {
|
|
269
269
|
const i = e.revision[t.scope];
|
|
270
270
|
return [w, v, _].includes(t.type) ? i : i + 1;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function Ut(e, t) {
|
|
273
273
|
return {
|
|
274
274
|
...e,
|
|
275
275
|
revision: {
|
|
276
276
|
...e.revision,
|
|
277
|
-
[t.scope]:
|
|
277
|
+
[t.scope]: Lt(e, t)
|
|
278
278
|
},
|
|
279
279
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function $t(e, t, i = 0) {
|
|
283
283
|
if ([w, v, _].includes(t.type))
|
|
284
284
|
return e;
|
|
285
285
|
const { scope: a } = t, n = e.operations[a].slice(
|
|
@@ -298,85 +298,85 @@ function Ut(e, t, i = 0) {
|
|
|
298
298
|
operations: { ...e.operations, [a]: n }
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
function
|
|
302
|
-
let a =
|
|
303
|
-
return a =
|
|
301
|
+
function Ct(e, t, i = 0) {
|
|
302
|
+
let a = $t(e, t, i);
|
|
303
|
+
return a = Ut(a, t), a;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
switch (
|
|
307
|
-
case ot:
|
|
308
|
-
return At(e, t.input);
|
|
309
|
-
case _:
|
|
310
|
-
return It(e, t, i);
|
|
305
|
+
function Jt(e, t, i) {
|
|
306
|
+
switch (Y().parse(t), t.type) {
|
|
311
307
|
case st:
|
|
312
|
-
return
|
|
308
|
+
return zt(e, t.input);
|
|
309
|
+
case _:
|
|
310
|
+
return Ft(e, t, i);
|
|
311
|
+
case pt:
|
|
312
|
+
return Rt(e, t.input.state);
|
|
313
313
|
default:
|
|
314
314
|
return e;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Wt(e, t, i) {
|
|
318
318
|
switch (t.type) {
|
|
319
319
|
case w:
|
|
320
|
-
return Mt(e, t, i);
|
|
321
|
-
case v:
|
|
322
320
|
return Pt(e, t, i);
|
|
321
|
+
case v:
|
|
322
|
+
return It(e, t, i);
|
|
323
323
|
default:
|
|
324
324
|
return { document: e, action: t, skip: i };
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function ct(e, t, i, a, n = {}) {
|
|
328
328
|
const { skip: s, ignoreSkipOperations: o = !1 } = n;
|
|
329
|
-
let p = { ...t },
|
|
330
|
-
if (
|
|
331
|
-
const { document:
|
|
332
|
-
|
|
329
|
+
let p = { ...t }, l = s || 0, r = e, x = [...e.clipboard];
|
|
330
|
+
if (Kt(p)) {
|
|
331
|
+
const { document: d, skip: m } = Mt(r, p, l);
|
|
332
|
+
l = m, r = d;
|
|
333
333
|
}
|
|
334
|
-
if (
|
|
334
|
+
if (J(p)) {
|
|
335
335
|
const {
|
|
336
|
-
skip:
|
|
337
|
-
action:
|
|
338
|
-
document:
|
|
339
|
-
} =
|
|
340
|
-
p =
|
|
341
|
-
}
|
|
342
|
-
return
|
|
343
|
-
|
|
344
|
-
|
|
336
|
+
skip: d,
|
|
337
|
+
action: m,
|
|
338
|
+
document: f
|
|
339
|
+
} = Wt(e, p, l);
|
|
340
|
+
p = m, l = d, r = f, x = [...r.clipboard];
|
|
341
|
+
}
|
|
342
|
+
return W(p) && (r = Jt(r, p, i)), l > 0 && !o && (r = P(
|
|
343
|
+
r.initialState,
|
|
344
|
+
r.operations,
|
|
345
345
|
i,
|
|
346
346
|
void 0,
|
|
347
347
|
void 0,
|
|
348
348
|
void 0,
|
|
349
|
-
{ [p.scope]:
|
|
350
|
-
)),
|
|
351
|
-
const
|
|
352
|
-
|
|
349
|
+
{ [p.scope]: l }
|
|
350
|
+
)), r = Ct(r, p, l), r = k(r, (d) => {
|
|
351
|
+
const m = i(
|
|
352
|
+
d.state,
|
|
353
353
|
p,
|
|
354
354
|
a
|
|
355
|
-
),
|
|
356
|
-
if (
|
|
355
|
+
), f = J(t) ? [...x] : [];
|
|
356
|
+
if (m)
|
|
357
357
|
return A({
|
|
358
|
-
...
|
|
359
|
-
clipboard: [...
|
|
360
|
-
state:
|
|
358
|
+
...r,
|
|
359
|
+
clipboard: [...f],
|
|
360
|
+
state: m
|
|
361
361
|
});
|
|
362
|
-
|
|
363
|
-
}), k(
|
|
362
|
+
d.clipboard = A([...f]);
|
|
363
|
+
}), k(r, (d) => {
|
|
364
364
|
if ([w, v, _].includes(p.type))
|
|
365
|
-
return
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
const { hash:
|
|
369
|
-
|
|
370
|
-
...
|
|
365
|
+
return d;
|
|
366
|
+
const m = p.scope || "global";
|
|
367
|
+
d.operations[m][d.operations[m].length - 1].hash = lt(d, m), !W(p) && p.attachments && p.attachments.forEach((f) => {
|
|
368
|
+
const { hash: u, ...j } = f;
|
|
369
|
+
d.attachments[u] = {
|
|
370
|
+
...j
|
|
371
371
|
};
|
|
372
372
|
});
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
const a =
|
|
377
|
-
return
|
|
375
|
+
function Bt(e, t, i) {
|
|
376
|
+
const a = _t(e, t);
|
|
377
|
+
return M.mkdirSync(e, { recursive: !0 }), new Promise((n, s) => {
|
|
378
378
|
try {
|
|
379
|
-
|
|
379
|
+
M.writeFile(a, i, {}, (o) => {
|
|
380
380
|
o ? s(o) : n(a);
|
|
381
381
|
});
|
|
382
382
|
} catch (o) {
|
|
@@ -384,12 +384,12 @@ function Wt(e, t, i) {
|
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
return
|
|
387
|
+
function rt(e) {
|
|
388
|
+
return M.readFileSync(e);
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function Zt(e) {
|
|
391
391
|
return new Promise((t, i) => {
|
|
392
|
-
|
|
392
|
+
St.get(e, (a) => {
|
|
393
393
|
const n = [], s = a.headers["content-type"];
|
|
394
394
|
a.on("data", (o) => {
|
|
395
395
|
n.push(o);
|
|
@@ -401,15 +401,15 @@ function Bt(e) {
|
|
|
401
401
|
});
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
function
|
|
406
|
-
return e.type ===
|
|
404
|
+
const Ht = async (e) => rt(e), T = (e, t = "sha1") => kt.createHash(t).update(e).digest("base64");
|
|
405
|
+
function Kt(e) {
|
|
406
|
+
return e.type === qt && e.skip !== void 0 && e.skip > 0 && e.hash !== void 0;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function J(e) {
|
|
409
409
|
return [w, v].includes(e.type);
|
|
410
410
|
}
|
|
411
|
-
function
|
|
412
|
-
return [
|
|
411
|
+
function W(e) {
|
|
412
|
+
return [st, w, v, _, pt].includes(e.type);
|
|
413
413
|
}
|
|
414
414
|
function y(e, t, i, a, n = "global") {
|
|
415
415
|
if (!e)
|
|
@@ -425,10 +425,10 @@ function y(e, t, i, a, n = "global") {
|
|
|
425
425
|
}
|
|
426
426
|
return s;
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function Vt(e, t = ct) {
|
|
429
429
|
return (i, a, n, s) => t(i, a, e, n, s);
|
|
430
430
|
}
|
|
431
|
-
const
|
|
431
|
+
const Gt = (e, t) => ({
|
|
432
432
|
name: "",
|
|
433
433
|
documentType: "",
|
|
434
434
|
revision: {
|
|
@@ -440,8 +440,8 @@ const Vt = (e, t) => ({
|
|
|
440
440
|
attachments: {},
|
|
441
441
|
...e,
|
|
442
442
|
state: (t == null ? void 0 : t(e == null ? void 0 : e.state)) ?? (e == null ? void 0 : e.state) ?? { global: {}, local: {} }
|
|
443
|
-
}),
|
|
444
|
-
const i =
|
|
443
|
+
}), Qt = (e, t) => {
|
|
444
|
+
const i = Gt(
|
|
445
445
|
e,
|
|
446
446
|
t
|
|
447
447
|
);
|
|
@@ -451,49 +451,49 @@ const Vt = (e, t) => ({
|
|
|
451
451
|
operations: { global: [], local: [] },
|
|
452
452
|
clipboard: []
|
|
453
453
|
};
|
|
454
|
-
}, lt = (e, t = "global") =>
|
|
454
|
+
}, lt = (e, t = "global") => T(z(e.state[t])), ge = (e, t = 1e3) => {
|
|
455
455
|
const i = Math.random() * t;
|
|
456
|
-
return
|
|
456
|
+
return T(`${(e ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
|
|
457
457
|
};
|
|
458
|
-
function
|
|
459
|
-
return
|
|
458
|
+
function N(e) {
|
|
459
|
+
return jt(Ot(e, !0));
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function Xt(e, t) {
|
|
462
462
|
const i = [...e];
|
|
463
463
|
let a = t || 0, n = i.length > 0 ? i[i.length - 1].index : 0;
|
|
464
464
|
const s = [];
|
|
465
465
|
for (const o of i.reverse()) {
|
|
466
466
|
if (a > 0) {
|
|
467
|
-
const
|
|
468
|
-
a -=
|
|
467
|
+
const r = n - o.index;
|
|
468
|
+
a -= r;
|
|
469
469
|
}
|
|
470
470
|
if (a < 0)
|
|
471
471
|
throw new Error("Invalid operation index, missing operations");
|
|
472
472
|
const p = {
|
|
473
473
|
ignore: a > 0,
|
|
474
474
|
operation: o
|
|
475
|
-
},
|
|
476
|
-
if (
|
|
477
|
-
const
|
|
478
|
-
a = a +
|
|
475
|
+
}, l = o.skip > 0 ? o.skip + 1 : 0;
|
|
476
|
+
if (l > 0 && l > a) {
|
|
477
|
+
const r = l - a;
|
|
478
|
+
a = a + r;
|
|
479
479
|
}
|
|
480
480
|
n = o.index, s.push(p);
|
|
481
481
|
}
|
|
482
482
|
return s.reverse();
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function he(e) {
|
|
485
485
|
return Object.values(e).flatMap((t) => t).sort(
|
|
486
486
|
(t, i) => new Date(t.timestamp).getTime() - new Date(i.timestamp).getTime()
|
|
487
487
|
);
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Yt(e) {
|
|
490
490
|
return Object.values(e).flatMap((t) => t).sort(
|
|
491
491
|
(t, i) => new Date(t.operation.timestamp).getTime() - new Date(i.operation.timestamp).getTime()
|
|
492
492
|
);
|
|
493
493
|
}
|
|
494
|
-
function
|
|
495
|
-
const p =
|
|
496
|
-
return
|
|
494
|
+
function P(e, t, i, a, n, s = ct, o = {}) {
|
|
495
|
+
const p = Vt(i, s);
|
|
496
|
+
return mt(
|
|
497
497
|
e,
|
|
498
498
|
t,
|
|
499
499
|
p,
|
|
@@ -502,47 +502,47 @@ function M(e, t, i, a, n, s = pt, o = {}) {
|
|
|
502
502
|
o
|
|
503
503
|
);
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
const o =
|
|
507
|
-
const
|
|
505
|
+
function mt(e, t, i, a, n, s = {}) {
|
|
506
|
+
const o = Qt(e), p = Object.keys(t).reduce((m, f) => {
|
|
507
|
+
const u = f;
|
|
508
508
|
return {
|
|
509
509
|
...m,
|
|
510
|
-
[
|
|
510
|
+
[u]: t[u].slice(0, n == null ? void 0 : n.revision[u])
|
|
511
511
|
};
|
|
512
|
-
}, {}),
|
|
513
|
-
(m,
|
|
514
|
-
const
|
|
512
|
+
}, {}), l = Object.keys(p).reduce(
|
|
513
|
+
(m, f) => {
|
|
514
|
+
const u = f;
|
|
515
515
|
return {
|
|
516
516
|
...m,
|
|
517
|
-
[
|
|
518
|
-
p[
|
|
519
|
-
s[
|
|
517
|
+
[u]: Xt(
|
|
518
|
+
p[u],
|
|
519
|
+
s[u]
|
|
520
520
|
)
|
|
521
521
|
};
|
|
522
522
|
},
|
|
523
523
|
{}
|
|
524
|
-
),
|
|
525
|
-
(m, { ignore:
|
|
526
|
-
skip:
|
|
524
|
+
), r = Yt(l).reduce(
|
|
525
|
+
(m, { ignore: f, operation: u }) => f ? i(m, $(u.scope), a, {
|
|
526
|
+
skip: u.skip,
|
|
527
527
|
ignoreSkipOperations: !0
|
|
528
|
-
}) : i(m,
|
|
529
|
-
skip:
|
|
528
|
+
}) : i(m, u, a, {
|
|
529
|
+
skip: u.skip,
|
|
530
530
|
ignoreSkipOperations: !0
|
|
531
531
|
}),
|
|
532
532
|
o
|
|
533
|
-
),
|
|
534
|
-
|
|
533
|
+
), x = Object.keys(
|
|
534
|
+
r.operations
|
|
535
535
|
).reduce(
|
|
536
|
-
(m,
|
|
537
|
-
const
|
|
536
|
+
(m, f) => {
|
|
537
|
+
const u = f, j = n && n.revision[u] < t[u].length ? t[u].slice(n.revision[u]) : [];
|
|
538
538
|
return {
|
|
539
539
|
...m,
|
|
540
|
-
[
|
|
541
|
-
...
|
|
542
|
-
var
|
|
540
|
+
[u]: [
|
|
541
|
+
...r.operations[u].map((E, wt) => {
|
|
542
|
+
var C;
|
|
543
543
|
return {
|
|
544
|
-
...
|
|
545
|
-
timestamp: ((
|
|
544
|
+
...E,
|
|
545
|
+
timestamp: ((C = t[u][wt]) == null ? void 0 : C.timestamp) ?? E.timestamp
|
|
546
546
|
};
|
|
547
547
|
}),
|
|
548
548
|
...j
|
|
@@ -550,74 +550,81 @@ function rt(e, t, i, a, n, s = {}) {
|
|
|
550
550
|
};
|
|
551
551
|
},
|
|
552
552
|
{ global: [], local: [] }
|
|
553
|
-
)
|
|
554
|
-
|
|
553
|
+
), d = Object.values(x).reduce((m, f) => {
|
|
554
|
+
for (const u of f)
|
|
555
|
+
u.timestamp > m && (m = u.timestamp);
|
|
556
|
+
return m;
|
|
557
|
+
}, "0");
|
|
558
|
+
return { ...r, operations: x, lastModified: d };
|
|
559
|
+
}
|
|
560
|
+
function be(e, t) {
|
|
561
|
+
return z(e) === z(t);
|
|
555
562
|
}
|
|
556
|
-
const
|
|
563
|
+
const ut = (e) => y(
|
|
557
564
|
"SET_NAME",
|
|
558
565
|
e,
|
|
559
566
|
void 0,
|
|
560
|
-
|
|
567
|
+
q,
|
|
561
568
|
void 0
|
|
562
569
|
), dt = (e = 1, t = "global") => y(
|
|
563
570
|
"UNDO",
|
|
564
571
|
e,
|
|
565
572
|
void 0,
|
|
566
|
-
|
|
573
|
+
L,
|
|
567
574
|
t
|
|
568
|
-
),
|
|
575
|
+
), ft = (e = 1, t = "global") => y(
|
|
569
576
|
"REDO",
|
|
570
577
|
e,
|
|
571
578
|
void 0,
|
|
572
|
-
|
|
579
|
+
R,
|
|
573
580
|
t
|
|
574
|
-
),
|
|
581
|
+
), xt = (e, t, i = "global") => y(
|
|
575
582
|
"PRUNE",
|
|
576
583
|
{ start: e, end: t },
|
|
577
584
|
void 0,
|
|
578
|
-
|
|
585
|
+
F,
|
|
579
586
|
i
|
|
580
|
-
),
|
|
587
|
+
), U = (e, t) => y(
|
|
581
588
|
"LOAD_STATE",
|
|
582
589
|
{ state: e, operations: t },
|
|
583
590
|
void 0,
|
|
584
|
-
|
|
585
|
-
),
|
|
591
|
+
I
|
|
592
|
+
), $ = (e = "global") => y("NOOP", {}, void 0, void 0, e), we = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
586
593
|
__proto__: null,
|
|
587
|
-
loadState:
|
|
588
|
-
noop:
|
|
589
|
-
prune:
|
|
590
|
-
redo:
|
|
591
|
-
setName:
|
|
594
|
+
loadState: U,
|
|
595
|
+
noop: $,
|
|
596
|
+
prune: xt,
|
|
597
|
+
redo: ft,
|
|
598
|
+
setName: ut,
|
|
592
599
|
undo: dt
|
|
593
|
-
}, Symbol.toStringTag, { value: "Module" })), xt = { "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"] };
|
|
594
|
-
Object.freeze(
|
|
595
|
-
var
|
|
600
|
+
}, Symbol.toStringTag, { value: "Module" })), gt = { "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"] };
|
|
601
|
+
Object.freeze(gt);
|
|
602
|
+
var g = function(e, t, i, a) {
|
|
596
603
|
if (i === "a" && !a)
|
|
597
604
|
throw new TypeError("Private accessor was defined without a getter");
|
|
598
605
|
if (typeof t == "function" ? e !== t || !a : !t.has(e))
|
|
599
606
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
600
607
|
return i === "m" ? a : i === "a" ? a.call(e) : a ? a.value : t.get(e);
|
|
601
|
-
}, b, O,
|
|
602
|
-
class
|
|
608
|
+
}, b, O, h;
|
|
609
|
+
class te {
|
|
603
610
|
constructor(...t) {
|
|
604
|
-
b.set(this, /* @__PURE__ */ new Map()), O.set(this, /* @__PURE__ */ new Map()),
|
|
611
|
+
b.set(this, /* @__PURE__ */ new Map()), O.set(this, /* @__PURE__ */ new Map()), h.set(this, /* @__PURE__ */ new Map());
|
|
605
612
|
for (const i of t)
|
|
606
613
|
this.define(i);
|
|
607
614
|
}
|
|
608
615
|
define(t, i = !1) {
|
|
609
616
|
for (let [a, n] of Object.entries(t)) {
|
|
610
|
-
a = a.toLowerCase(), n = n.map((p) => p.toLowerCase()),
|
|
611
|
-
const s =
|
|
617
|
+
a = a.toLowerCase(), n = n.map((p) => p.toLowerCase()), g(this, h, "f").has(a) || g(this, h, "f").set(a, /* @__PURE__ */ new Set());
|
|
618
|
+
const s = g(this, h, "f").get(a);
|
|
612
619
|
let o = !0;
|
|
613
620
|
for (let p of n) {
|
|
614
|
-
const
|
|
615
|
-
if (p =
|
|
621
|
+
const l = p.startsWith("*");
|
|
622
|
+
if (p = l ? p.slice(1) : p, s == null || s.add(p), o && g(this, O, "f").set(a, p), o = !1, l)
|
|
616
623
|
continue;
|
|
617
|
-
const
|
|
618
|
-
if (
|
|
619
|
-
throw new Error(`"${a} -> ${p}" conflicts with "${
|
|
620
|
-
|
|
624
|
+
const r = g(this, b, "f").get(p);
|
|
625
|
+
if (r && r != a && !i)
|
|
626
|
+
throw new Error(`"${a} -> ${p}" conflicts with "${r} -> ${p}". Pass \`force=true\` to override this definition.`);
|
|
627
|
+
g(this, b, "f").set(p, a);
|
|
621
628
|
}
|
|
622
629
|
}
|
|
623
630
|
return this;
|
|
@@ -626,33 +633,33 @@ class Yt {
|
|
|
626
633
|
if (typeof t != "string")
|
|
627
634
|
return null;
|
|
628
635
|
const i = t.replace(/^.*[/\\]/, "").toLowerCase(), a = i.replace(/^.*\./, "").toLowerCase(), n = i.length < t.length;
|
|
629
|
-
return !(a.length < i.length - 1) && n ? null :
|
|
636
|
+
return !(a.length < i.length - 1) && n ? null : g(this, b, "f").get(a) ?? null;
|
|
630
637
|
}
|
|
631
638
|
getExtension(t) {
|
|
632
639
|
var i;
|
|
633
|
-
return typeof t != "string" ? null : (t = (i = t == null ? void 0 : t.split) == null ? void 0 : i.call(t, ";")[0], (t &&
|
|
640
|
+
return typeof t != "string" ? null : (t = (i = t == null ? void 0 : t.split) == null ? void 0 : i.call(t, ";")[0], (t && g(this, O, "f").get(t.trim().toLowerCase())) ?? null);
|
|
634
641
|
}
|
|
635
642
|
getAllExtensions(t) {
|
|
636
|
-
return typeof t != "string" ? null :
|
|
643
|
+
return typeof t != "string" ? null : g(this, h, "f").get(t.toLowerCase()) ?? null;
|
|
637
644
|
}
|
|
638
645
|
_freeze() {
|
|
639
646
|
this.define = () => {
|
|
640
647
|
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
641
648
|
}, Object.freeze(this);
|
|
642
|
-
for (const t of
|
|
649
|
+
for (const t of g(this, h, "f").values())
|
|
643
650
|
Object.freeze(t);
|
|
644
651
|
return this;
|
|
645
652
|
}
|
|
646
653
|
_getTestState() {
|
|
647
654
|
return {
|
|
648
|
-
types:
|
|
649
|
-
extensions:
|
|
655
|
+
types: g(this, b, "f"),
|
|
656
|
+
extensions: g(this, O, "f")
|
|
650
657
|
};
|
|
651
658
|
}
|
|
652
659
|
}
|
|
653
|
-
b = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(),
|
|
654
|
-
const
|
|
655
|
-
function
|
|
660
|
+
b = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap();
|
|
661
|
+
const ee = new te(gt)._freeze();
|
|
662
|
+
function ie(e) {
|
|
656
663
|
const t = [], i = Object.keys(e);
|
|
657
664
|
for (const a of i) {
|
|
658
665
|
const n = e[a].sort((s, o) => s.index - o.index);
|
|
@@ -668,8 +675,8 @@ function ee(e) {
|
|
|
668
675
|
}
|
|
669
676
|
return t;
|
|
670
677
|
}
|
|
671
|
-
const
|
|
672
|
-
const t = new
|
|
678
|
+
const ht = async (e) => {
|
|
679
|
+
const t = new Z(), { name: i, revision: a, documentType: n, created: s, lastModified: o } = e, p = {
|
|
673
680
|
name: i,
|
|
674
681
|
revision: a,
|
|
675
682
|
documentType: n,
|
|
@@ -679,35 +686,35 @@ const gt = async (e) => {
|
|
|
679
686
|
return t.file("header.json", JSON.stringify(p, null, 2)), t.file(
|
|
680
687
|
"state.json",
|
|
681
688
|
JSON.stringify(e.initialState || {}, null, 2)
|
|
682
|
-
), t.file("operations.json", JSON.stringify(e.operations, null, 2)), Object.keys(e.attachments).forEach((
|
|
683
|
-
const { data:
|
|
684
|
-
t.file(
|
|
689
|
+
), t.file("operations.json", JSON.stringify(e.operations, null, 2)), Object.keys(e.attachments).forEach((r) => {
|
|
690
|
+
const { data: x, ...d } = e.attachments[r];
|
|
691
|
+
t.file(r, x, {
|
|
685
692
|
base64: !0,
|
|
686
693
|
createFolders: !0,
|
|
687
|
-
comment: JSON.stringify(
|
|
694
|
+
comment: JSON.stringify(d)
|
|
688
695
|
});
|
|
689
696
|
}), t;
|
|
690
|
-
},
|
|
691
|
-
const s = await (await
|
|
697
|
+
}, ae = async (e, t, i, a) => {
|
|
698
|
+
const s = await (await ht(e)).generateAsync({
|
|
692
699
|
type: "uint8array",
|
|
693
700
|
streamFiles: !0
|
|
694
701
|
}), o = a ?? e.name, p = `.${i}.zip`;
|
|
695
|
-
return
|
|
702
|
+
return Bt(
|
|
696
703
|
t,
|
|
697
704
|
o.endsWith(p) ? o : `${o}${p}`,
|
|
698
705
|
s
|
|
699
706
|
);
|
|
700
|
-
},
|
|
701
|
-
const a = await (await
|
|
707
|
+
}, ve = async (e, t) => {
|
|
708
|
+
const a = await (await ht(e)).generateAsync({ type: "blob" }), n = await t.createWritable();
|
|
702
709
|
await n.write(a), await n.close();
|
|
703
|
-
},
|
|
704
|
-
const i =
|
|
705
|
-
return
|
|
706
|
-
},
|
|
707
|
-
const i = new
|
|
708
|
-
return await i.loadAsync(e),
|
|
710
|
+
}, B = async (e, t) => {
|
|
711
|
+
const i = rt(e);
|
|
712
|
+
return ne(i, t);
|
|
713
|
+
}, ne = async (e, t) => {
|
|
714
|
+
const i = new Z();
|
|
715
|
+
return await i.loadAsync(e), oe(i, t);
|
|
709
716
|
};
|
|
710
|
-
async function
|
|
717
|
+
async function oe(e, t) {
|
|
711
718
|
const i = e.file("state.json");
|
|
712
719
|
if (!i)
|
|
713
720
|
throw new Error("Initial state not found");
|
|
@@ -717,53 +724,53 @@ async function ne(e, t) {
|
|
|
717
724
|
const p = e.file("operations.json");
|
|
718
725
|
if (!p)
|
|
719
726
|
throw new Error("Operations history not found");
|
|
720
|
-
const
|
|
727
|
+
const l = JSON.parse(
|
|
721
728
|
await p.async("string")
|
|
722
|
-
),
|
|
723
|
-
if (
|
|
724
|
-
const
|
|
725
|
-
throw new Error(
|
|
729
|
+
), r = ie(l);
|
|
730
|
+
if (r.length) {
|
|
731
|
+
const d = r.map((m) => m.message);
|
|
732
|
+
throw new Error(d.join(`
|
|
726
733
|
`));
|
|
727
734
|
}
|
|
728
|
-
let
|
|
735
|
+
let x = mt(
|
|
729
736
|
n,
|
|
730
|
-
|
|
737
|
+
l,
|
|
731
738
|
t,
|
|
732
739
|
void 0,
|
|
733
740
|
o
|
|
734
741
|
);
|
|
735
|
-
return o && (
|
|
736
|
-
...
|
|
742
|
+
return o && (x = {
|
|
743
|
+
...x,
|
|
737
744
|
...o
|
|
738
|
-
}),
|
|
745
|
+
}), x;
|
|
739
746
|
}
|
|
740
|
-
function
|
|
747
|
+
function bt(e) {
|
|
741
748
|
const t = e.replace(/^.*\./, "") || void 0, i = e.replace(/^.*[/\\]/, "") || void 0;
|
|
742
749
|
return { extension: t, fileName: i };
|
|
743
750
|
}
|
|
744
|
-
async function
|
|
745
|
-
const { buffer: t, mimeType: i = "application/octet-stream" } = await
|
|
751
|
+
async function ye(e) {
|
|
752
|
+
const { buffer: t, mimeType: i = "application/octet-stream" } = await Zt(e), a = bt(e), n = t.toString("base64");
|
|
746
753
|
return {
|
|
747
754
|
data: n,
|
|
748
|
-
hash:
|
|
755
|
+
hash: T(n),
|
|
749
756
|
mimeType: i,
|
|
750
757
|
...a
|
|
751
758
|
};
|
|
752
759
|
}
|
|
753
|
-
async function
|
|
754
|
-
const t = await
|
|
755
|
-
return { data: n, hash:
|
|
760
|
+
async function je(e) {
|
|
761
|
+
const t = await Ht(e), i = ee.getType(e) || "application/octet-stream", a = bt(e), n = t.toString("base64");
|
|
762
|
+
return { data: n, hash: T(n), mimeType: i, ...a };
|
|
756
763
|
}
|
|
757
|
-
class
|
|
764
|
+
class Oe {
|
|
758
765
|
/**
|
|
759
766
|
* Constructs a BaseDocument instance with an initial state.
|
|
760
767
|
* @param reducer - The reducer function that updates the state.
|
|
761
768
|
* @param document - The initial state of the document.
|
|
762
769
|
*/
|
|
763
770
|
constructor(t, i, a) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
771
|
+
D(this, "_document");
|
|
772
|
+
D(this, "_reducer");
|
|
773
|
+
D(this, "_signalDispatch");
|
|
767
774
|
this._reducer = t, this._document = i, this._signalDispatch = a;
|
|
768
775
|
}
|
|
769
776
|
/**
|
|
@@ -786,14 +793,14 @@ class ye {
|
|
|
786
793
|
* @returns The file path where the state was saved.
|
|
787
794
|
*/
|
|
788
795
|
saveToFile(t, i, a) {
|
|
789
|
-
return
|
|
796
|
+
return ae(this._document, t, i, a);
|
|
790
797
|
}
|
|
791
798
|
/**
|
|
792
799
|
* Loads the state of the document from a file.
|
|
793
800
|
* @param path - The file path where the state is stored.
|
|
794
801
|
*/
|
|
795
802
|
async loadFromFile(t) {
|
|
796
|
-
this._document = await
|
|
803
|
+
this._document = await B(t, this._reducer);
|
|
797
804
|
}
|
|
798
805
|
/**
|
|
799
806
|
* Loads the state of the document from a file and returns it.
|
|
@@ -802,19 +809,19 @@ class ye {
|
|
|
802
809
|
* @returns The state of the document.
|
|
803
810
|
*/
|
|
804
811
|
static async stateFromFile(t, i) {
|
|
805
|
-
return await
|
|
812
|
+
return await B(t, i);
|
|
806
813
|
}
|
|
807
814
|
/**
|
|
808
815
|
* Gets the current state of the document.
|
|
809
816
|
*/
|
|
810
817
|
get state() {
|
|
811
|
-
return
|
|
818
|
+
return N(this._document.state);
|
|
812
819
|
}
|
|
813
820
|
/**
|
|
814
821
|
* Gets the list of operations performed on the document.
|
|
815
822
|
*/
|
|
816
823
|
get operations() {
|
|
817
|
-
return
|
|
824
|
+
return N(this._document.operations);
|
|
818
825
|
}
|
|
819
826
|
/**
|
|
820
827
|
* Gets the name of the document.
|
|
@@ -853,13 +860,13 @@ class ye {
|
|
|
853
860
|
* Gets the initial state of the document.
|
|
854
861
|
*/
|
|
855
862
|
get initialState() {
|
|
856
|
-
return
|
|
863
|
+
return N(this._document.initialState);
|
|
857
864
|
}
|
|
858
865
|
/**
|
|
859
866
|
* Returns the current document as an object
|
|
860
867
|
*/
|
|
861
868
|
toDocument() {
|
|
862
|
-
return
|
|
869
|
+
return N(this._document);
|
|
863
870
|
}
|
|
864
871
|
/**
|
|
865
872
|
* Gets the attachment associated with the given key.
|
|
@@ -873,7 +880,7 @@ class ye {
|
|
|
873
880
|
* @param name - The new name of the document.
|
|
874
881
|
*/
|
|
875
882
|
setName(t) {
|
|
876
|
-
return this.dispatch(
|
|
883
|
+
return this.dispatch(ut(t)), this;
|
|
877
884
|
}
|
|
878
885
|
/**
|
|
879
886
|
* Reverts a number of actions from the document.
|
|
@@ -887,7 +894,7 @@ class ye {
|
|
|
887
894
|
* @param count - The number of actions to reapply.
|
|
888
895
|
*/
|
|
889
896
|
redo(t) {
|
|
890
|
-
return this.dispatch(
|
|
897
|
+
return this.dispatch(ft(t)), this;
|
|
891
898
|
}
|
|
892
899
|
/**
|
|
893
900
|
* Removes a range of operations from the document.
|
|
@@ -895,7 +902,7 @@ class ye {
|
|
|
895
902
|
* @param end - The ending index of the range to remove.
|
|
896
903
|
*/
|
|
897
904
|
prune(t, i) {
|
|
898
|
-
return this.dispatch(
|
|
905
|
+
return this.dispatch(xt(t, i)), this;
|
|
899
906
|
}
|
|
900
907
|
/**
|
|
901
908
|
* Loads a document state and a set of operations.
|
|
@@ -903,10 +910,10 @@ class ye {
|
|
|
903
910
|
* @param operations - The operations to apply to the document.
|
|
904
911
|
*/
|
|
905
912
|
loadState(t, i) {
|
|
906
|
-
return this.dispatch(
|
|
913
|
+
return this.dispatch(U(t, i)), this;
|
|
907
914
|
}
|
|
908
915
|
}
|
|
909
|
-
function
|
|
916
|
+
function ke(e, t) {
|
|
910
917
|
t.forEach((i) => {
|
|
911
918
|
Object.getOwnPropertyNames(i.prototype).forEach((a) => {
|
|
912
919
|
Object.defineProperty(
|
|
@@ -920,33 +927,34 @@ function je(e, t) {
|
|
|
920
927
|
});
|
|
921
928
|
}
|
|
922
929
|
export {
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
Gt as
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
930
|
+
ct as A,
|
|
931
|
+
Oe as B,
|
|
932
|
+
Wt as C,
|
|
933
|
+
xe as D,
|
|
934
|
+
Gt as a,
|
|
935
|
+
Qt as b,
|
|
936
|
+
Vt as c,
|
|
937
|
+
ve as d,
|
|
938
|
+
ne as e,
|
|
931
939
|
y as f,
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
940
|
+
ke as g,
|
|
941
|
+
we as h,
|
|
942
|
+
W as i,
|
|
943
|
+
ht as j,
|
|
944
|
+
je as k,
|
|
945
|
+
B as l,
|
|
946
|
+
ye as m,
|
|
939
947
|
lt as n,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
948
|
+
ge as o,
|
|
949
|
+
Kt as p,
|
|
950
|
+
be as q,
|
|
951
|
+
J as r,
|
|
952
|
+
ae as s,
|
|
953
|
+
Xt as t,
|
|
954
|
+
N as u,
|
|
955
|
+
mt as v,
|
|
956
|
+
P as w,
|
|
957
|
+
Yt as x,
|
|
958
|
+
he as y,
|
|
959
|
+
ie as z
|
|
952
960
|
};
|