document-model 1.1.0-experimental.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/cjs/document-model.js +1 -1
- package/dist/browser/cjs/document.js +1 -1
- package/dist/browser/cjs/index.js +1 -1
- package/dist/browser/cjs/internal/{index-dwAOfmBp.js → index-Bqu_Uzaf.js} +1 -1
- package/dist/browser/cjs/internal/{index-DMRH7zDy.js → index-DD_uV5_l.js} +1 -1
- package/dist/browser/cjs/internal/object-CHFtJl_E.js +25 -0
- package/dist/browser/es/document-model.js +2 -2
- package/dist/browser/es/document.js +9 -7
- package/dist/browser/es/index.js +3 -3
- package/dist/browser/es/internal/{index-DQztOVJu.js → index-C9_nWw6z.js} +1 -1
- package/dist/browser/es/internal/index-CNILoLzv.js +46 -0
- package/dist/browser/es/internal/{object-iTBekDVP.js → object-CJvDhUxl.js} +1003 -965
- package/dist/browser/src/document/object.d.ts +35 -0
- package/dist/browser/src/document/reducer.d.ts +17 -0
- package/dist/browser/src/document/types.d.ts +2 -0
- package/dist/browser/src/document/utils/document-helpers.d.ts +9 -0
- package/dist/node/cjs/document-model.js +1 -1
- package/dist/node/cjs/document.js +1 -1
- package/dist/node/cjs/index.js +1 -1
- package/dist/node/cjs/internal/{index-BNFVmPew.js → index-DSsY5px9.js} +1 -1
- package/dist/node/cjs/internal/{index-FvRO8SnG.js → index-eJODAZgf.js} +1 -1
- package/dist/node/cjs/internal/object-9bv72oJK.js +20 -0
- package/dist/node/es/document-model.js +2 -2
- package/dist/node/es/document.js +10 -8
- package/dist/node/es/index.js +3 -3
- package/dist/node/es/internal/index-Dug-2E00.js +46 -0
- package/dist/node/es/internal/{index-DOpbr_uw.js → index-nccvxxIw.js} +1 -1
- package/dist/node/es/internal/{object-C2s2eZ08.js → object-B9OVOSMl.js} +668 -630
- package/dist/node/src/document/object.d.ts +35 -0
- package/dist/node/src/document/reducer.d.ts +17 -0
- package/dist/node/src/document/types.d.ts +2 -0
- package/dist/node/src/document/utils/document-helpers.d.ts +9 -0
- package/package.json +3 -1
- package/dist/browser/cjs/internal/object-C-PazS9q.js +0 -25
- package/dist/browser/es/internal/index-BVJxzkIs.js +0 -44
- package/dist/node/cjs/internal/object-Xvr4kDQj.js +0 -20
- package/dist/node/es/internal/index-BIrQOTP_.js +0 -44
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { produce as
|
|
5
|
-
import { z as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { join as
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
return
|
|
14
|
-
__typename:
|
|
15
|
-
type:
|
|
1
|
+
var fe = Object.defineProperty;
|
|
2
|
+
var de = (t, e, n) => e in t ? fe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var rt = (t, e, n) => (de(t, typeof e != "symbol" ? e + "" : e, n), n);
|
|
4
|
+
import { produce as lt, castDraft as ct, castImmutable as ge, freeze as he } from "immer";
|
|
5
|
+
import { z as d } from "zod";
|
|
6
|
+
import vt from "jszip";
|
|
7
|
+
import xe from "crypto";
|
|
8
|
+
import dt from "fs";
|
|
9
|
+
import ye from "https";
|
|
10
|
+
import { join as be } from "path";
|
|
11
|
+
const It = (t) => t != null, we = d.any().refine((t) => It(t)), Nt = d.enum(["LOAD_STATE"]), At = d.enum(["PRUNE"]), Pt = d.enum(["REDO"]), Mt = d.enum(["SET_NAME"]), Rt = d.enum(["UNDO"]);
|
|
12
|
+
function Oe() {
|
|
13
|
+
return d.object({
|
|
14
|
+
__typename: d.literal("Action").optional(),
|
|
15
|
+
type: d.string()
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function tt() {
|
|
19
|
+
return d.literal("global").or(d.literal("local"));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
Rt(),
|
|
25
|
-
Ct(),
|
|
21
|
+
function zt() {
|
|
22
|
+
return d.union([
|
|
23
|
+
Ut(),
|
|
26
24
|
Ft(),
|
|
27
|
-
Lt()
|
|
25
|
+
Lt(),
|
|
26
|
+
qt(),
|
|
27
|
+
Jt()
|
|
28
28
|
]);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
32
|
-
__typename:
|
|
33
|
-
data:
|
|
34
|
-
extension:
|
|
35
|
-
fileName:
|
|
36
|
-
mimeType:
|
|
30
|
+
function Se() {
|
|
31
|
+
return d.object({
|
|
32
|
+
__typename: d.literal("DocumentFile").optional(),
|
|
33
|
+
data: d.string(),
|
|
34
|
+
extension: d.string().nullable(),
|
|
35
|
+
fileName: d.string().nullable(),
|
|
36
|
+
mimeType: d.string()
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
41
|
-
input:
|
|
42
|
-
type:
|
|
43
|
-
scope:
|
|
39
|
+
function Ut() {
|
|
40
|
+
return d.object({
|
|
41
|
+
input: d.lazy(() => yt()),
|
|
42
|
+
type: Nt,
|
|
43
|
+
scope: tt()
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
48
|
-
operations:
|
|
49
|
-
state:
|
|
46
|
+
function yt() {
|
|
47
|
+
return d.object({
|
|
48
|
+
operations: d.number(),
|
|
49
|
+
state: d.lazy(() => Ct())
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
54
|
-
data:
|
|
55
|
-
name:
|
|
52
|
+
function Ct() {
|
|
53
|
+
return d.object({
|
|
54
|
+
data: d.unknown().nullish(),
|
|
55
|
+
name: d.string()
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
60
|
-
__typename:
|
|
61
|
-
hash:
|
|
62
|
-
index:
|
|
63
|
-
timestamp:
|
|
64
|
-
type:
|
|
58
|
+
function je() {
|
|
59
|
+
return d.object({
|
|
60
|
+
__typename: d.literal("Operation").optional(),
|
|
61
|
+
hash: d.string(),
|
|
62
|
+
index: d.number(),
|
|
63
|
+
timestamp: d.string().datetime(),
|
|
64
|
+
type: d.string()
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
69
|
-
input:
|
|
70
|
-
type:
|
|
71
|
-
scope:
|
|
67
|
+
function Ft() {
|
|
68
|
+
return d.object({
|
|
69
|
+
input: d.lazy(() => bt()),
|
|
70
|
+
type: At,
|
|
71
|
+
scope: tt()
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
76
|
-
end:
|
|
77
|
-
start:
|
|
74
|
+
function bt() {
|
|
75
|
+
return d.object({
|
|
76
|
+
end: d.number().nullish(),
|
|
77
|
+
start: d.number().nullish()
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
function
|
|
82
|
-
return
|
|
83
|
-
input:
|
|
84
|
-
type:
|
|
85
|
-
scope:
|
|
80
|
+
const wt = d.number;
|
|
81
|
+
function Lt() {
|
|
82
|
+
return d.object({
|
|
83
|
+
input: wt(),
|
|
84
|
+
type: Pt,
|
|
85
|
+
scope: tt()
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
const
|
|
89
|
-
function
|
|
90
|
-
return
|
|
91
|
-
input:
|
|
92
|
-
type:
|
|
93
|
-
scope:
|
|
88
|
+
const Ot = d.string;
|
|
89
|
+
function qt() {
|
|
90
|
+
return d.object({
|
|
91
|
+
input: Ot(),
|
|
92
|
+
type: Mt,
|
|
93
|
+
scope: d.literal("global")
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return
|
|
98
|
-
__typename:
|
|
99
|
-
hash:
|
|
100
|
-
index:
|
|
101
|
-
input:
|
|
102
|
-
timestamp:
|
|
103
|
-
type:
|
|
96
|
+
function Ee() {
|
|
97
|
+
return d.object({
|
|
98
|
+
__typename: d.literal("SetNameOperation").optional(),
|
|
99
|
+
hash: d.string(),
|
|
100
|
+
index: d.number(),
|
|
101
|
+
input: d.string(),
|
|
102
|
+
timestamp: d.string().datetime(),
|
|
103
|
+
type: d.string()
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
function
|
|
108
|
-
return
|
|
109
|
-
input:
|
|
110
|
-
type:
|
|
111
|
-
scope:
|
|
106
|
+
const St = d.number;
|
|
107
|
+
function Jt() {
|
|
108
|
+
return d.object({
|
|
109
|
+
input: St(),
|
|
110
|
+
type: Rt,
|
|
111
|
+
scope: tt()
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
115
115
|
__proto__: null,
|
|
116
|
-
ActionSchema:
|
|
117
|
-
BaseActionSchema:
|
|
118
|
-
DocumentFileSchema:
|
|
119
|
-
LoadStateActionInputSchema:
|
|
120
|
-
LoadStateActionSchema:
|
|
121
|
-
LoadStateActionStateInputSchema:
|
|
122
|
-
Load_StateSchema:
|
|
123
|
-
OperationSchema:
|
|
124
|
-
OperationScopeSchema:
|
|
125
|
-
PruneActionInputSchema:
|
|
126
|
-
PruneActionSchema:
|
|
127
|
-
PruneSchema:
|
|
128
|
-
RedoActionInputSchema:
|
|
129
|
-
RedoActionSchema:
|
|
130
|
-
RedoSchema:
|
|
131
|
-
SetNameActionInputSchema:
|
|
132
|
-
SetNameActionSchema:
|
|
133
|
-
SetNameOperationSchema:
|
|
134
|
-
Set_NameSchema:
|
|
135
|
-
UndoActionInputSchema:
|
|
136
|
-
UndoActionSchema:
|
|
137
|
-
UndoSchema:
|
|
138
|
-
definedNonNullAnySchema:
|
|
139
|
-
isDefinedNonNullAny:
|
|
116
|
+
ActionSchema: Oe,
|
|
117
|
+
BaseActionSchema: zt,
|
|
118
|
+
DocumentFileSchema: Se,
|
|
119
|
+
LoadStateActionInputSchema: yt,
|
|
120
|
+
LoadStateActionSchema: Ut,
|
|
121
|
+
LoadStateActionStateInputSchema: Ct,
|
|
122
|
+
Load_StateSchema: Nt,
|
|
123
|
+
OperationSchema: je,
|
|
124
|
+
OperationScopeSchema: tt,
|
|
125
|
+
PruneActionInputSchema: bt,
|
|
126
|
+
PruneActionSchema: Ft,
|
|
127
|
+
PruneSchema: At,
|
|
128
|
+
RedoActionInputSchema: wt,
|
|
129
|
+
RedoActionSchema: Lt,
|
|
130
|
+
RedoSchema: Pt,
|
|
131
|
+
SetNameActionInputSchema: Ot,
|
|
132
|
+
SetNameActionSchema: qt,
|
|
133
|
+
SetNameOperationSchema: Ee,
|
|
134
|
+
Set_NameSchema: Mt,
|
|
135
|
+
UndoActionInputSchema: St,
|
|
136
|
+
UndoActionSchema: Jt,
|
|
137
|
+
UndoSchema: Rt,
|
|
138
|
+
definedNonNullAnySchema: we,
|
|
139
|
+
isDefinedNonNullAny: It
|
|
140
140
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
141
|
-
function
|
|
141
|
+
function $e(t) {
|
|
142
142
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
143
143
|
}
|
|
144
|
-
var
|
|
144
|
+
var gt = { exports: {} };
|
|
145
145
|
(function(t, e) {
|
|
146
146
|
const { hasOwnProperty: n } = Object.prototype, i = C();
|
|
147
147
|
i.configure = C, i.stringify = i, i.default = i, e.stringify = i, e.configure = C, t.exports = i;
|
|
@@ -153,11 +153,11 @@ var ft = { exports: {} };
|
|
|
153
153
|
if (c.length > 200)
|
|
154
154
|
return c.sort();
|
|
155
155
|
for (let l = 1; l < c.length; l++) {
|
|
156
|
-
const
|
|
157
|
-
let
|
|
158
|
-
for (;
|
|
159
|
-
c[
|
|
160
|
-
c[
|
|
156
|
+
const f = c[l];
|
|
157
|
+
let k = l;
|
|
158
|
+
for (; k !== 0 && c[k - 1] > f; )
|
|
159
|
+
c[k] = c[k - 1], k--;
|
|
160
|
+
c[k] = f;
|
|
161
161
|
}
|
|
162
162
|
return c;
|
|
163
163
|
}
|
|
@@ -172,12 +172,12 @@ var ft = { exports: {} };
|
|
|
172
172
|
function m(c) {
|
|
173
173
|
return p.call(c) !== void 0 && c.length !== 0;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
c.length <
|
|
177
|
-
const
|
|
178
|
-
let F = `"0":${
|
|
179
|
-
for (let
|
|
180
|
-
F += `${l}"${
|
|
175
|
+
function u(c, l, f) {
|
|
176
|
+
c.length < f && (f = c.length);
|
|
177
|
+
const k = l === "," ? "" : " ";
|
|
178
|
+
let F = `"0":${k}${c[0]}`;
|
|
179
|
+
for (let R = 1; R < f; R++)
|
|
180
|
+
F += `${l}"${R}":${k}${c[R]}`;
|
|
181
181
|
return F;
|
|
182
182
|
}
|
|
183
183
|
function h(c) {
|
|
@@ -198,105 +198,105 @@ var ft = { exports: {} };
|
|
|
198
198
|
return '"[Circular]"';
|
|
199
199
|
}
|
|
200
200
|
function b(c, l) {
|
|
201
|
-
let
|
|
202
|
-
if (n.call(c, l) && (
|
|
201
|
+
let f;
|
|
202
|
+
if (n.call(c, l) && (f = c[l], typeof f != "boolean"))
|
|
203
203
|
throw new TypeError(`The "${l}" argument must be of type boolean`);
|
|
204
|
-
return
|
|
204
|
+
return f === void 0 ? !0 : f;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
207
|
-
let
|
|
206
|
+
function w(c, l) {
|
|
207
|
+
let f;
|
|
208
208
|
if (n.call(c, l)) {
|
|
209
|
-
if (
|
|
209
|
+
if (f = c[l], typeof f != "number")
|
|
210
210
|
throw new TypeError(`The "${l}" argument must be of type number`);
|
|
211
|
-
if (!Number.isInteger(
|
|
211
|
+
if (!Number.isInteger(f))
|
|
212
212
|
throw new TypeError(`The "${l}" argument must be an integer`);
|
|
213
|
-
if (
|
|
213
|
+
if (f < 1)
|
|
214
214
|
throw new RangeError(`The "${l}" argument must be >= 1`);
|
|
215
215
|
}
|
|
216
|
-
return
|
|
216
|
+
return f === void 0 ? 1 / 0 : f;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function I(c) {
|
|
219
219
|
return c === 1 ? "1 item" : `${c} items`;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function $(c) {
|
|
222
222
|
const l = /* @__PURE__ */ new Set();
|
|
223
|
-
for (const
|
|
224
|
-
(typeof
|
|
223
|
+
for (const f of c)
|
|
224
|
+
(typeof f == "string" || typeof f == "number") && l.add(String(f));
|
|
225
225
|
return l;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function M(c) {
|
|
228
228
|
if (n.call(c, "strict")) {
|
|
229
229
|
const l = c.strict;
|
|
230
230
|
if (typeof l != "boolean")
|
|
231
231
|
throw new TypeError('The "strict" argument must be of type boolean');
|
|
232
232
|
if (l)
|
|
233
|
-
return (
|
|
234
|
-
let
|
|
235
|
-
throw typeof
|
|
233
|
+
return (f) => {
|
|
234
|
+
let k = `Object can not safely be stringified. Received type ${typeof f}`;
|
|
235
|
+
throw typeof f != "function" && (k += ` (${f.toString()})`), new Error(k);
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
function C(c) {
|
|
240
240
|
c = { ...c };
|
|
241
|
-
const l =
|
|
241
|
+
const l = M(c);
|
|
242
242
|
l && (c.bigint === void 0 && (c.bigint = !1), "circularValue" in c || (c.circularValue = Error));
|
|
243
|
-
const
|
|
244
|
-
function
|
|
245
|
-
let x = s[
|
|
246
|
-
switch (typeof x == "object" && x !== null && typeof x.toJSON == "function" && (x = x.toJSON(
|
|
243
|
+
const f = h(c), k = b(c, "bigint"), F = b(c, "deterministic"), R = w(c, "maximumDepth"), T = w(c, "maximumBreadth");
|
|
244
|
+
function it(P, s, g, O, y, j) {
|
|
245
|
+
let x = s[P];
|
|
246
|
+
switch (typeof x == "object" && x !== null && typeof x.toJSON == "function" && (x = x.toJSON(P)), x = O.call(s, P, x), typeof x) {
|
|
247
247
|
case "string":
|
|
248
248
|
return a(x);
|
|
249
249
|
case "object": {
|
|
250
250
|
if (x === null)
|
|
251
251
|
return "null";
|
|
252
252
|
if (g.indexOf(x) !== -1)
|
|
253
|
-
return
|
|
254
|
-
let S = "",
|
|
255
|
-
const
|
|
253
|
+
return f;
|
|
254
|
+
let S = "", D = ",";
|
|
255
|
+
const _ = j;
|
|
256
256
|
if (Array.isArray(x)) {
|
|
257
257
|
if (x.length === 0)
|
|
258
258
|
return "[]";
|
|
259
|
-
if (
|
|
259
|
+
if (R < g.length + 1)
|
|
260
260
|
return '"[Array]"';
|
|
261
261
|
g.push(x), y !== "" && (j += y, S += `
|
|
262
|
-
${j}`,
|
|
262
|
+
${j}`, D = `,
|
|
263
263
|
${j}`);
|
|
264
|
-
const
|
|
265
|
-
let
|
|
266
|
-
for (;
|
|
267
|
-
const
|
|
268
|
-
S +=
|
|
264
|
+
const U = Math.min(x.length, T);
|
|
265
|
+
let J = 0;
|
|
266
|
+
for (; J < U - 1; J++) {
|
|
267
|
+
const st = it(String(J), x, g, O, y, j);
|
|
268
|
+
S += st !== void 0 ? st : "null", S += D;
|
|
269
269
|
}
|
|
270
|
-
const
|
|
271
|
-
if (S +=
|
|
272
|
-
const
|
|
273
|
-
S += `${
|
|
270
|
+
const V = it(String(J), x, g, O, y, j);
|
|
271
|
+
if (S += V !== void 0 ? V : "null", x.length - 1 > T) {
|
|
272
|
+
const st = x.length - T - 1;
|
|
273
|
+
S += `${D}"... ${I(st)} not stringified"`;
|
|
274
274
|
}
|
|
275
275
|
return y !== "" && (S += `
|
|
276
|
-
${
|
|
276
|
+
${_}`), g.pop(), `[${S}]`;
|
|
277
277
|
}
|
|
278
|
-
let
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
278
|
+
let v = Object.keys(x);
|
|
279
|
+
const N = v.length;
|
|
280
|
+
if (N === 0)
|
|
281
281
|
return "{}";
|
|
282
|
-
if (
|
|
282
|
+
if (R < g.length + 1)
|
|
283
283
|
return '"[Object]"';
|
|
284
284
|
let E = "", z = "";
|
|
285
|
-
y !== "" && (j += y,
|
|
285
|
+
y !== "" && (j += y, D = `,
|
|
286
286
|
${j}`, E = " ");
|
|
287
|
-
const q = Math.min(
|
|
288
|
-
F && !m(x) && (
|
|
289
|
-
for (let
|
|
290
|
-
const
|
|
291
|
-
|
|
287
|
+
const q = Math.min(N, T);
|
|
288
|
+
F && !m(x) && (v = r(v)), g.push(x);
|
|
289
|
+
for (let U = 0; U < q; U++) {
|
|
290
|
+
const J = v[U], V = it(J, x, g, O, y, j);
|
|
291
|
+
V !== void 0 && (S += `${z}${a(J)}:${E}${V}`, z = D);
|
|
292
292
|
}
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
S += `${z}"...":${E}"${
|
|
293
|
+
if (N > T) {
|
|
294
|
+
const U = N - T;
|
|
295
|
+
S += `${z}"...":${E}"${I(U)} not stringified"`, z = D;
|
|
296
296
|
}
|
|
297
297
|
return y !== "" && z.length > 1 && (S = `
|
|
298
298
|
${j}${S}
|
|
299
|
-
${
|
|
299
|
+
${_}`), g.pop(), `{${S}}`;
|
|
300
300
|
}
|
|
301
301
|
case "number":
|
|
302
302
|
return isFinite(x) ? String(x) : l ? l(x) : "null";
|
|
@@ -305,55 +305,55 @@ ${D}`), g.pop(), `{${S}}`;
|
|
|
305
305
|
case "undefined":
|
|
306
306
|
return;
|
|
307
307
|
case "bigint":
|
|
308
|
-
if (
|
|
308
|
+
if (k)
|
|
309
309
|
return String(x);
|
|
310
310
|
default:
|
|
311
311
|
return l ? l(x) : void 0;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
switch (typeof s == "object" && s !== null && typeof s.toJSON == "function" && (s = s.toJSON(
|
|
314
|
+
function ot(P, s, g, O, y, j) {
|
|
315
|
+
switch (typeof s == "object" && s !== null && typeof s.toJSON == "function" && (s = s.toJSON(P)), typeof s) {
|
|
316
316
|
case "string":
|
|
317
317
|
return a(s);
|
|
318
318
|
case "object": {
|
|
319
319
|
if (s === null)
|
|
320
320
|
return "null";
|
|
321
321
|
if (g.indexOf(s) !== -1)
|
|
322
|
-
return
|
|
322
|
+
return f;
|
|
323
323
|
const x = j;
|
|
324
|
-
let S = "",
|
|
324
|
+
let S = "", D = ",";
|
|
325
325
|
if (Array.isArray(s)) {
|
|
326
326
|
if (s.length === 0)
|
|
327
327
|
return "[]";
|
|
328
|
-
if (
|
|
328
|
+
if (R < g.length + 1)
|
|
329
329
|
return '"[Array]"';
|
|
330
330
|
g.push(s), y !== "" && (j += y, S += `
|
|
331
|
-
${j}`,
|
|
331
|
+
${j}`, D = `,
|
|
332
332
|
${j}`);
|
|
333
|
-
const
|
|
333
|
+
const N = Math.min(s.length, T);
|
|
334
334
|
let E = 0;
|
|
335
|
-
for (; E <
|
|
336
|
-
const q =
|
|
337
|
-
S += q !== void 0 ? q : "null", S +=
|
|
335
|
+
for (; E < N - 1; E++) {
|
|
336
|
+
const q = ot(String(E), s[E], g, O, y, j);
|
|
337
|
+
S += q !== void 0 ? q : "null", S += D;
|
|
338
338
|
}
|
|
339
|
-
const z =
|
|
340
|
-
if (S += z !== void 0 ? z : "null", s.length - 1 >
|
|
341
|
-
const q = s.length -
|
|
342
|
-
S += `${
|
|
339
|
+
const z = ot(String(E), s[E], g, O, y, j);
|
|
340
|
+
if (S += z !== void 0 ? z : "null", s.length - 1 > T) {
|
|
341
|
+
const q = s.length - T - 1;
|
|
342
|
+
S += `${D}"... ${I(q)} not stringified"`;
|
|
343
343
|
}
|
|
344
344
|
return y !== "" && (S += `
|
|
345
345
|
${x}`), g.pop(), `[${S}]`;
|
|
346
346
|
}
|
|
347
347
|
g.push(s);
|
|
348
|
-
let
|
|
349
|
-
y !== "" && (j += y,
|
|
350
|
-
${j}`,
|
|
351
|
-
let
|
|
352
|
-
for (const
|
|
353
|
-
const E =
|
|
354
|
-
E !== void 0 && (S += `${
|
|
348
|
+
let _ = "";
|
|
349
|
+
y !== "" && (j += y, D = `,
|
|
350
|
+
${j}`, _ = " ");
|
|
351
|
+
let v = "";
|
|
352
|
+
for (const N of O) {
|
|
353
|
+
const E = ot(N, s[N], g, O, y, j);
|
|
354
|
+
E !== void 0 && (S += `${v}${a(N)}:${_}${E}`, v = D);
|
|
355
355
|
}
|
|
356
|
-
return y !== "" &&
|
|
356
|
+
return y !== "" && v.length > 1 && (S = `
|
|
357
357
|
${j}${S}
|
|
358
358
|
${x}`), g.pop(), `{${S}}`;
|
|
359
359
|
}
|
|
@@ -364,13 +364,13 @@ ${x}`), g.pop(), `{${S}}`;
|
|
|
364
364
|
case "undefined":
|
|
365
365
|
return;
|
|
366
366
|
case "bigint":
|
|
367
|
-
if (
|
|
367
|
+
if (k)
|
|
368
368
|
return String(s);
|
|
369
369
|
default:
|
|
370
370
|
return l ? l(s) : void 0;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
function
|
|
373
|
+
function Z(P, s, g, O, y) {
|
|
374
374
|
switch (typeof s) {
|
|
375
375
|
case "string":
|
|
376
376
|
return a(s);
|
|
@@ -378,33 +378,33 @@ ${x}`), g.pop(), `{${S}}`;
|
|
|
378
378
|
if (s === null)
|
|
379
379
|
return "null";
|
|
380
380
|
if (typeof s.toJSON == "function") {
|
|
381
|
-
if (s = s.toJSON(
|
|
382
|
-
return
|
|
381
|
+
if (s = s.toJSON(P), typeof s != "object")
|
|
382
|
+
return Z(P, s, g, O, y);
|
|
383
383
|
if (s === null)
|
|
384
384
|
return "null";
|
|
385
385
|
}
|
|
386
386
|
if (g.indexOf(s) !== -1)
|
|
387
|
-
return
|
|
387
|
+
return f;
|
|
388
388
|
const j = y;
|
|
389
389
|
if (Array.isArray(s)) {
|
|
390
390
|
if (s.length === 0)
|
|
391
391
|
return "[]";
|
|
392
|
-
if (
|
|
392
|
+
if (R < g.length + 1)
|
|
393
393
|
return '"[Array]"';
|
|
394
|
-
g.push(s), y +=
|
|
394
|
+
g.push(s), y += O;
|
|
395
395
|
let E = `
|
|
396
396
|
${y}`;
|
|
397
397
|
const z = `,
|
|
398
|
-
${y}`, q = Math.min(s.length,
|
|
399
|
-
let
|
|
400
|
-
for (;
|
|
401
|
-
const
|
|
402
|
-
E +=
|
|
398
|
+
${y}`, q = Math.min(s.length, T);
|
|
399
|
+
let U = 0;
|
|
400
|
+
for (; U < q - 1; U++) {
|
|
401
|
+
const V = Z(String(U), s[U], g, O, y);
|
|
402
|
+
E += V !== void 0 ? V : "null", E += z;
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
if (E +=
|
|
406
|
-
const
|
|
407
|
-
E += `${z}"... ${
|
|
404
|
+
const J = Z(String(U), s[U], g, O, y);
|
|
405
|
+
if (E += J !== void 0 ? J : "null", s.length - 1 > T) {
|
|
406
|
+
const V = s.length - T - 1;
|
|
407
|
+
E += `${z}"... ${I(V)} not stringified"`;
|
|
408
408
|
}
|
|
409
409
|
return E += `
|
|
410
410
|
${j}`, g.pop(), `[${E}]`;
|
|
@@ -413,24 +413,24 @@ ${j}`, g.pop(), `[${E}]`;
|
|
|
413
413
|
const S = x.length;
|
|
414
414
|
if (S === 0)
|
|
415
415
|
return "{}";
|
|
416
|
-
if (
|
|
416
|
+
if (R < g.length + 1)
|
|
417
417
|
return '"[Object]"';
|
|
418
|
-
y +=
|
|
419
|
-
const
|
|
418
|
+
y += O;
|
|
419
|
+
const D = `,
|
|
420
420
|
${y}`;
|
|
421
|
-
let
|
|
422
|
-
m(s) && (
|
|
423
|
-
for (let E = 0; E <
|
|
424
|
-
const z = x[E], q =
|
|
425
|
-
q !== void 0 && (
|
|
421
|
+
let _ = "", v = "", N = Math.min(S, T);
|
|
422
|
+
m(s) && (_ += u(s, D, T), x = x.slice(s.length), N -= s.length, v = D), F && (x = r(x)), g.push(s);
|
|
423
|
+
for (let E = 0; E < N; E++) {
|
|
424
|
+
const z = x[E], q = Z(z, s[z], g, O, y);
|
|
425
|
+
q !== void 0 && (_ += `${v}${a(z)}: ${q}`, v = D);
|
|
426
426
|
}
|
|
427
|
-
if (S >
|
|
428
|
-
const E = S -
|
|
429
|
-
|
|
427
|
+
if (S > T) {
|
|
428
|
+
const E = S - T;
|
|
429
|
+
_ += `${v}"...": "${I(E)} not stringified"`, v = D;
|
|
430
430
|
}
|
|
431
|
-
return
|
|
432
|
-
${y}${
|
|
433
|
-
${j}`), g.pop(), `{${
|
|
431
|
+
return v !== "" && (_ = `
|
|
432
|
+
${y}${_}
|
|
433
|
+
${j}`), g.pop(), `{${_}}`;
|
|
434
434
|
}
|
|
435
435
|
case "number":
|
|
436
436
|
return isFinite(s) ? String(s) : l ? l(s) : "null";
|
|
@@ -439,13 +439,13 @@ ${j}`), g.pop(), `{${D}}`;
|
|
|
439
439
|
case "undefined":
|
|
440
440
|
return;
|
|
441
441
|
case "bigint":
|
|
442
|
-
if (
|
|
442
|
+
if (k)
|
|
443
443
|
return String(s);
|
|
444
444
|
default:
|
|
445
445
|
return l ? l(s) : void 0;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function Q(P, s, g) {
|
|
449
449
|
switch (typeof s) {
|
|
450
450
|
case "string":
|
|
451
451
|
return a(s);
|
|
@@ -453,50 +453,50 @@ ${j}`), g.pop(), `{${D}}`;
|
|
|
453
453
|
if (s === null)
|
|
454
454
|
return "null";
|
|
455
455
|
if (typeof s.toJSON == "function") {
|
|
456
|
-
if (s = s.toJSON(
|
|
457
|
-
return
|
|
456
|
+
if (s = s.toJSON(P), typeof s != "object")
|
|
457
|
+
return Q(P, s, g);
|
|
458
458
|
if (s === null)
|
|
459
459
|
return "null";
|
|
460
460
|
}
|
|
461
461
|
if (g.indexOf(s) !== -1)
|
|
462
|
-
return
|
|
463
|
-
let
|
|
462
|
+
return f;
|
|
463
|
+
let O = "";
|
|
464
464
|
if (Array.isArray(s)) {
|
|
465
465
|
if (s.length === 0)
|
|
466
466
|
return "[]";
|
|
467
|
-
if (
|
|
467
|
+
if (R < g.length + 1)
|
|
468
468
|
return '"[Array]"';
|
|
469
469
|
g.push(s);
|
|
470
|
-
const
|
|
471
|
-
let
|
|
472
|
-
for (;
|
|
473
|
-
const
|
|
474
|
-
|
|
470
|
+
const D = Math.min(s.length, T);
|
|
471
|
+
let _ = 0;
|
|
472
|
+
for (; _ < D - 1; _++) {
|
|
473
|
+
const N = Q(String(_), s[_], g);
|
|
474
|
+
O += N !== void 0 ? N : "null", O += ",";
|
|
475
475
|
}
|
|
476
|
-
const
|
|
477
|
-
if (
|
|
478
|
-
const
|
|
479
|
-
|
|
476
|
+
const v = Q(String(_), s[_], g);
|
|
477
|
+
if (O += v !== void 0 ? v : "null", s.length - 1 > T) {
|
|
478
|
+
const N = s.length - T - 1;
|
|
479
|
+
O += `,"... ${I(N)} not stringified"`;
|
|
480
480
|
}
|
|
481
|
-
return g.pop(), `[${
|
|
481
|
+
return g.pop(), `[${O}]`;
|
|
482
482
|
}
|
|
483
483
|
let y = Object.keys(s);
|
|
484
484
|
const j = y.length;
|
|
485
485
|
if (j === 0)
|
|
486
486
|
return "{}";
|
|
487
|
-
if (
|
|
487
|
+
if (R < g.length + 1)
|
|
488
488
|
return '"[Object]"';
|
|
489
|
-
let x = "", S = Math.min(j,
|
|
490
|
-
m(s) && (
|
|
491
|
-
for (let
|
|
492
|
-
const
|
|
493
|
-
|
|
489
|
+
let x = "", S = Math.min(j, T);
|
|
490
|
+
m(s) && (O += u(s, ",", T), y = y.slice(s.length), S -= s.length, x = ","), F && (y = r(y)), g.push(s);
|
|
491
|
+
for (let D = 0; D < S; D++) {
|
|
492
|
+
const _ = y[D], v = Q(_, s[_], g);
|
|
493
|
+
v !== void 0 && (O += `${x}${a(_)}:${v}`, x = ",");
|
|
494
494
|
}
|
|
495
|
-
if (j >
|
|
496
|
-
const
|
|
497
|
-
|
|
495
|
+
if (j > T) {
|
|
496
|
+
const D = j - T;
|
|
497
|
+
O += `${x}"...":"${I(D)} not stringified"`;
|
|
498
498
|
}
|
|
499
|
-
return g.pop(), `{${
|
|
499
|
+
return g.pop(), `{${O}}`;
|
|
500
500
|
}
|
|
501
501
|
case "number":
|
|
502
502
|
return isFinite(s) ? String(s) : l ? l(s) : "null";
|
|
@@ -505,38 +505,67 @@ ${j}`), g.pop(), `{${D}}`;
|
|
|
505
505
|
case "undefined":
|
|
506
506
|
return;
|
|
507
507
|
case "bigint":
|
|
508
|
-
if (
|
|
508
|
+
if (k)
|
|
509
509
|
return String(s);
|
|
510
510
|
default:
|
|
511
511
|
return l ? l(s) : void 0;
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function ue(P, s, g) {
|
|
515
515
|
if (arguments.length > 1) {
|
|
516
|
-
let
|
|
517
|
-
if (typeof g == "number" ?
|
|
516
|
+
let O = "";
|
|
517
|
+
if (typeof g == "number" ? O = " ".repeat(Math.min(g, 10)) : typeof g == "string" && (O = g.slice(0, 10)), s != null) {
|
|
518
518
|
if (typeof s == "function")
|
|
519
|
-
return
|
|
519
|
+
return it("", { "": P }, [], s, O, "");
|
|
520
520
|
if (Array.isArray(s))
|
|
521
|
-
return
|
|
521
|
+
return ot("", P, [], $(s), O, "");
|
|
522
522
|
}
|
|
523
|
-
if (
|
|
524
|
-
return
|
|
523
|
+
if (O.length !== 0)
|
|
524
|
+
return Z("", P, [], O, "");
|
|
525
525
|
}
|
|
526
|
-
return
|
|
526
|
+
return Q("", P, []);
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return ue;
|
|
529
529
|
}
|
|
530
|
-
})(
|
|
531
|
-
var
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
530
|
+
})(gt, gt.exports);
|
|
531
|
+
var De = gt.exports;
|
|
532
|
+
const W = /* @__PURE__ */ $e(De);
|
|
533
|
+
W.configure;
|
|
534
|
+
let at;
|
|
535
|
+
const ke = new Uint8Array(16);
|
|
536
|
+
function Te() {
|
|
537
|
+
if (!at && (at = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !at))
|
|
538
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
539
|
+
return at(ke);
|
|
540
|
+
}
|
|
541
|
+
const A = [];
|
|
542
|
+
for (let t = 0; t < 256; ++t)
|
|
543
|
+
A.push((t + 256).toString(16).slice(1));
|
|
544
|
+
function _e(t, e = 0) {
|
|
545
|
+
return A[t[e + 0]] + A[t[e + 1]] + A[t[e + 2]] + A[t[e + 3]] + "-" + A[t[e + 4]] + A[t[e + 5]] + "-" + A[t[e + 6]] + A[t[e + 7]] + "-" + A[t[e + 8]] + A[t[e + 9]] + "-" + A[t[e + 10]] + A[t[e + 11]] + A[t[e + 12]] + A[t[e + 13]] + A[t[e + 14]] + A[t[e + 15]];
|
|
546
|
+
}
|
|
547
|
+
const ve = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kt = {
|
|
548
|
+
randomUUID: ve
|
|
549
|
+
};
|
|
550
|
+
function Ie(t, e, n) {
|
|
551
|
+
if (kt.randomUUID && !e && !t)
|
|
552
|
+
return kt.randomUUID();
|
|
553
|
+
t = t || {};
|
|
554
|
+
const i = t.random || (t.rng || Te)();
|
|
555
|
+
if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, e) {
|
|
556
|
+
n = n || 0;
|
|
557
|
+
for (let o = 0; o < 16; ++o)
|
|
558
|
+
e[n + o] = i[o];
|
|
559
|
+
return e;
|
|
560
|
+
}
|
|
561
|
+
return _e(i);
|
|
562
|
+
}
|
|
563
|
+
function Ne(t, e) {
|
|
535
564
|
return { ...t, name: e };
|
|
536
565
|
}
|
|
537
|
-
function
|
|
566
|
+
function Ae(t, e, n) {
|
|
538
567
|
const { scope: i, input: o } = e;
|
|
539
|
-
return
|
|
568
|
+
return lt({
|
|
540
569
|
document: t,
|
|
541
570
|
action: e,
|
|
542
571
|
skip: n
|
|
@@ -556,29 +585,29 @@ function je(t, e, n) {
|
|
|
556
585
|
const p = r.document.operations[i].at(-1), m = p && p.type === "NOOP" && p.skip > 0;
|
|
557
586
|
if (r.skip += o, m) {
|
|
558
587
|
r.skip += p.skip;
|
|
559
|
-
const
|
|
560
|
-
|
|
588
|
+
const w = r.document.operations[i][r.document.operations[i].length - 2];
|
|
589
|
+
w && p.index - w.index === 1 && r.document.operations[i].pop();
|
|
561
590
|
}
|
|
562
591
|
if (r.document.operations[i].length < r.skip)
|
|
563
592
|
throw new Error(
|
|
564
593
|
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
565
594
|
);
|
|
566
|
-
const
|
|
567
|
-
let h = o, b = m ?
|
|
595
|
+
const u = r.document.operations[i].length - 1;
|
|
596
|
+
let h = o, b = m ? u - p.skip : u;
|
|
568
597
|
for (; h > 0 && b >= 0; ) {
|
|
569
|
-
const
|
|
570
|
-
if (!
|
|
598
|
+
const w = r.document.operations[i][b];
|
|
599
|
+
if (!w) {
|
|
571
600
|
h--, b--;
|
|
572
601
|
continue;
|
|
573
602
|
}
|
|
574
|
-
|
|
603
|
+
w.type === "NOOP" && w.skip > 0 ? (b = b - (w.skip + 1), r.skip += w.skip + 1) : (r.document.clipboard.push({ ...w }), h--, b--);
|
|
575
604
|
}
|
|
576
|
-
r.action =
|
|
605
|
+
r.action = me(i);
|
|
577
606
|
});
|
|
578
607
|
}
|
|
579
|
-
function
|
|
608
|
+
function Pe(t, e, n) {
|
|
580
609
|
const { scope: i, input: o } = e;
|
|
581
|
-
return
|
|
610
|
+
return lt({
|
|
582
611
|
document: t,
|
|
583
612
|
action: e,
|
|
584
613
|
skip: n
|
|
@@ -596,93 +625,93 @@ function Ee(t, e, n) {
|
|
|
596
625
|
if (r.document.clipboard.length < 1)
|
|
597
626
|
throw new Error("Cannot redo: no operations in the clipboard");
|
|
598
627
|
const p = r.document.clipboard.findLastIndex(
|
|
599
|
-
(
|
|
628
|
+
(u) => u.scope === i
|
|
600
629
|
);
|
|
601
630
|
if (p < 0)
|
|
602
631
|
throw new Error(
|
|
603
632
|
`Cannot redo: no operations in clipboard for scope "${i}"`
|
|
604
633
|
);
|
|
605
634
|
const m = r.document.clipboard.splice(p, 1)[0];
|
|
606
|
-
r.action =
|
|
635
|
+
r.action = ct({
|
|
607
636
|
type: m.type,
|
|
608
637
|
scope: m.scope,
|
|
609
638
|
input: m.input
|
|
610
639
|
});
|
|
611
640
|
});
|
|
612
641
|
}
|
|
613
|
-
function
|
|
642
|
+
function Me(t, e, n) {
|
|
614
643
|
const { scope: i } = e, o = t.operations[i];
|
|
615
644
|
let {
|
|
616
645
|
input: { start: a, end: r }
|
|
617
646
|
} = e;
|
|
618
647
|
a = a || 0, r = r || o.length;
|
|
619
|
-
const p = o.slice(a, r), m = o.slice(0, a),
|
|
648
|
+
const p = o.slice(a, r), m = o.slice(0, a), u = o.slice(r), h = xt(
|
|
620
649
|
t.initialState,
|
|
621
650
|
{
|
|
622
651
|
...t.operations,
|
|
623
652
|
[i]: m.concat(p)
|
|
624
653
|
},
|
|
625
654
|
n
|
|
626
|
-
), { name: b, state:
|
|
627
|
-
return
|
|
655
|
+
), { name: b, state: w } = h, I = m.length, $ = m.length ? m[m.length - 1].timestamp : u.length ? u[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
656
|
+
return xt(
|
|
628
657
|
t.initialState,
|
|
629
658
|
{
|
|
630
659
|
...t.operations,
|
|
631
660
|
[i]: [
|
|
632
661
|
...m,
|
|
633
662
|
{
|
|
634
|
-
...
|
|
635
|
-
{ name: b, state:
|
|
663
|
+
...Dt(
|
|
664
|
+
{ name: b, state: w },
|
|
636
665
|
p.length
|
|
637
666
|
),
|
|
638
|
-
timestamp:
|
|
639
|
-
index:
|
|
640
|
-
hash:
|
|
667
|
+
timestamp: $,
|
|
668
|
+
index: I,
|
|
669
|
+
hash: $t({ state: w }, "global")
|
|
641
670
|
},
|
|
642
|
-
...
|
|
643
|
-
...
|
|
644
|
-
index:
|
|
671
|
+
...u.map((M, C) => ({
|
|
672
|
+
...M,
|
|
673
|
+
index: I + C + 1
|
|
645
674
|
}))
|
|
646
675
|
]
|
|
647
676
|
},
|
|
648
677
|
n
|
|
649
678
|
);
|
|
650
679
|
}
|
|
651
|
-
function
|
|
680
|
+
function Re(t, e) {
|
|
652
681
|
return {
|
|
653
682
|
...t,
|
|
654
683
|
name: e.name,
|
|
655
684
|
state: e.state ?? { global: {}, local: {} }
|
|
656
685
|
};
|
|
657
686
|
}
|
|
658
|
-
const qt = "SET_NAME", tt = "UNDO", et = "REDO", ct = "PRUNE", Ut = "LOAD_STATE", De = "NOOP", Jt = { "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"] };
|
|
659
|
-
Object.freeze(
|
|
687
|
+
const Vt = "SET_NAME", et = "UNDO", nt = "REDO", mt = "PRUNE", Ht = "LOAD_STATE", ze = "NOOP", 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"] };
|
|
688
|
+
Object.freeze(Xt);
|
|
660
689
|
var L = function(t, e, n, i) {
|
|
661
690
|
if (n === "a" && !i)
|
|
662
691
|
throw new TypeError("Private accessor was defined without a getter");
|
|
663
692
|
if (typeof e == "function" ? t !== e || !i : !e.has(t))
|
|
664
693
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
665
694
|
return n === "m" ? i : n === "a" ? i.call(t) : i ? i.value : e.get(t);
|
|
666
|
-
},
|
|
667
|
-
class
|
|
695
|
+
}, K, Y, B;
|
|
696
|
+
class Ue {
|
|
668
697
|
constructor(...e) {
|
|
669
|
-
|
|
698
|
+
K.set(this, /* @__PURE__ */ new Map()), Y.set(this, /* @__PURE__ */ new Map()), B.set(this, /* @__PURE__ */ new Map());
|
|
670
699
|
for (const n of e)
|
|
671
700
|
this.define(n);
|
|
672
701
|
}
|
|
673
702
|
define(e, n = !1) {
|
|
674
703
|
for (let [i, o] of Object.entries(e)) {
|
|
675
|
-
i = i.toLowerCase(), o = o.map((p) => p.toLowerCase()), L(this,
|
|
676
|
-
const a = L(this,
|
|
704
|
+
i = i.toLowerCase(), o = o.map((p) => p.toLowerCase()), L(this, B, "f").has(i) || L(this, B, "f").set(i, /* @__PURE__ */ new Set());
|
|
705
|
+
const a = L(this, B, "f").get(i);
|
|
677
706
|
let r = !0;
|
|
678
707
|
for (let p of o) {
|
|
679
708
|
const m = p.startsWith("*");
|
|
680
|
-
if (p = m ? p.slice(1) : p, a == null || a.add(p), r && L(this,
|
|
709
|
+
if (p = m ? p.slice(1) : p, a == null || a.add(p), r && L(this, Y, "f").set(i, p), r = !1, m)
|
|
681
710
|
continue;
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
684
|
-
throw new Error(`"${i} -> ${p}" conflicts with "${
|
|
685
|
-
L(this,
|
|
711
|
+
const u = L(this, K, "f").get(p);
|
|
712
|
+
if (u && u != i && !n)
|
|
713
|
+
throw new Error(`"${i} -> ${p}" conflicts with "${u} -> ${p}". Pass \`force=true\` to override this definition.`);
|
|
714
|
+
L(this, K, "f").set(p, i);
|
|
686
715
|
}
|
|
687
716
|
}
|
|
688
717
|
return this;
|
|
@@ -691,37 +720,37 @@ class Te {
|
|
|
691
720
|
if (typeof e != "string")
|
|
692
721
|
return null;
|
|
693
722
|
const n = e.replace(/^.*[/\\]/, "").toLowerCase(), i = n.replace(/^.*\./, "").toLowerCase(), o = n.length < e.length;
|
|
694
|
-
return !(i.length < n.length - 1) && o ? null : L(this,
|
|
723
|
+
return !(i.length < n.length - 1) && o ? null : L(this, K, "f").get(i) ?? null;
|
|
695
724
|
}
|
|
696
725
|
getExtension(e) {
|
|
697
726
|
var n;
|
|
698
|
-
return typeof e != "string" ? null : (e = (n = e == null ? void 0 : e.split) == null ? void 0 : n.call(e, ";")[0], (e && L(this,
|
|
727
|
+
return typeof e != "string" ? null : (e = (n = e == null ? void 0 : e.split) == null ? void 0 : n.call(e, ";")[0], (e && L(this, Y, "f").get(e.trim().toLowerCase())) ?? null);
|
|
699
728
|
}
|
|
700
729
|
getAllExtensions(e) {
|
|
701
|
-
return typeof e != "string" ? null : L(this,
|
|
730
|
+
return typeof e != "string" ? null : L(this, B, "f").get(e.toLowerCase()) ?? null;
|
|
702
731
|
}
|
|
703
732
|
_freeze() {
|
|
704
733
|
this.define = () => {
|
|
705
734
|
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
706
735
|
}, Object.freeze(this);
|
|
707
|
-
for (const e of L(this,
|
|
736
|
+
for (const e of L(this, B, "f").values())
|
|
708
737
|
Object.freeze(e);
|
|
709
738
|
return this;
|
|
710
739
|
}
|
|
711
740
|
_getTestState() {
|
|
712
741
|
return {
|
|
713
|
-
types: L(this,
|
|
714
|
-
extensions: L(this,
|
|
742
|
+
types: L(this, K, "f"),
|
|
743
|
+
extensions: L(this, Y, "f")
|
|
715
744
|
};
|
|
716
745
|
}
|
|
717
746
|
}
|
|
718
|
-
|
|
719
|
-
const
|
|
720
|
-
function
|
|
721
|
-
const i =
|
|
722
|
-
return
|
|
747
|
+
K = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap();
|
|
748
|
+
const Ce = new Ue(Xt)._freeze();
|
|
749
|
+
function Fe(t, e, n) {
|
|
750
|
+
const i = be(t, e);
|
|
751
|
+
return dt.mkdirSync(t, { recursive: !0 }), new Promise((o, a) => {
|
|
723
752
|
try {
|
|
724
|
-
|
|
753
|
+
dt.writeFile(i, n, {}, (r) => {
|
|
725
754
|
r ? a(r) : o(i);
|
|
726
755
|
});
|
|
727
756
|
} catch (r) {
|
|
@@ -729,12 +758,12 @@ function Ne(t, e, n) {
|
|
|
729
758
|
}
|
|
730
759
|
});
|
|
731
760
|
}
|
|
732
|
-
function
|
|
733
|
-
return
|
|
761
|
+
function Bt(t) {
|
|
762
|
+
return dt.readFileSync(t);
|
|
734
763
|
}
|
|
735
|
-
function
|
|
764
|
+
function Le(t) {
|
|
736
765
|
return new Promise((e, n) => {
|
|
737
|
-
|
|
766
|
+
ye.get(t, (i) => {
|
|
738
767
|
const o = [], a = i.headers["content-type"];
|
|
739
768
|
i.on("data", (r) => {
|
|
740
769
|
o.push(r);
|
|
@@ -746,8 +775,8 @@ function ve(t) {
|
|
|
746
775
|
});
|
|
747
776
|
});
|
|
748
777
|
}
|
|
749
|
-
const
|
|
750
|
-
function
|
|
778
|
+
const qe = async (t) => Bt(t), ut = (t, e = "sha1") => xe.createHash(e).update(t).digest("base64");
|
|
779
|
+
function Je(t) {
|
|
751
780
|
const e = [], n = Object.keys(t);
|
|
752
781
|
for (const i of n) {
|
|
753
782
|
const o = t[i].sort((a, r) => a.index - r.index);
|
|
@@ -763,8 +792,8 @@ function Ae(t) {
|
|
|
763
792
|
}
|
|
764
793
|
return e;
|
|
765
794
|
}
|
|
766
|
-
const
|
|
767
|
-
const e = new
|
|
795
|
+
const Kt = async (t) => {
|
|
796
|
+
const e = new vt(), { name: n, revision: i, documentType: o, created: a, lastModified: r } = t, p = {
|
|
768
797
|
name: n,
|
|
769
798
|
revision: i,
|
|
770
799
|
documentType: o,
|
|
@@ -774,35 +803,35 @@ const Xt = async (t) => {
|
|
|
774
803
|
return e.file("header.json", JSON.stringify(p, null, 2)), e.file(
|
|
775
804
|
"state.json",
|
|
776
805
|
JSON.stringify(t.initialState || {}, null, 2)
|
|
777
|
-
), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((
|
|
778
|
-
const { data: h, ...b } = t.attachments[
|
|
779
|
-
e.file(
|
|
806
|
+
), e.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((u) => {
|
|
807
|
+
const { data: h, ...b } = t.attachments[u];
|
|
808
|
+
e.file(u, h, {
|
|
780
809
|
base64: !0,
|
|
781
810
|
createFolders: !0,
|
|
782
811
|
comment: JSON.stringify(b)
|
|
783
812
|
});
|
|
784
813
|
}), e;
|
|
785
|
-
},
|
|
786
|
-
const a = await (await
|
|
814
|
+
}, Ve = async (t, e, n, i) => {
|
|
815
|
+
const a = await (await Kt(t)).generateAsync({
|
|
787
816
|
type: "uint8array",
|
|
788
817
|
streamFiles: !0
|
|
789
818
|
}), r = i ?? t.name, p = `.${n}.zip`;
|
|
790
|
-
return
|
|
819
|
+
return Fe(
|
|
791
820
|
e,
|
|
792
821
|
r.endsWith(p) ? r : `${r}${p}`,
|
|
793
822
|
a
|
|
794
823
|
);
|
|
795
|
-
},
|
|
796
|
-
const i = await (await
|
|
824
|
+
}, wn = async (t, e) => {
|
|
825
|
+
const i = await (await Kt(t)).generateAsync({ type: "blob" }), o = await e.createWritable();
|
|
797
826
|
await o.write(i), await o.close();
|
|
798
|
-
},
|
|
799
|
-
const i =
|
|
800
|
-
return
|
|
801
|
-
},
|
|
802
|
-
const i = new
|
|
803
|
-
return await i.loadAsync(t),
|
|
827
|
+
}, Tt = async (t, e, n) => {
|
|
828
|
+
const i = Bt(t);
|
|
829
|
+
return He(i, e, n);
|
|
830
|
+
}, He = async (t, e, n) => {
|
|
831
|
+
const i = new vt();
|
|
832
|
+
return await i.loadAsync(t), Xe(i, e, n);
|
|
804
833
|
};
|
|
805
|
-
async function
|
|
834
|
+
async function Xe(t, e, n) {
|
|
806
835
|
const i = t.file("state.json");
|
|
807
836
|
if (!i)
|
|
808
837
|
throw new Error("Initial state not found");
|
|
@@ -812,17 +841,17 @@ async function ze(t, e, n) {
|
|
|
812
841
|
const m = t.file("operations.json");
|
|
813
842
|
if (!m)
|
|
814
843
|
throw new Error("Operations history not found");
|
|
815
|
-
const
|
|
844
|
+
const u = JSON.parse(
|
|
816
845
|
await m.async("string")
|
|
817
|
-
), h =
|
|
846
|
+
), h = Je(u);
|
|
818
847
|
if (h.length) {
|
|
819
|
-
const
|
|
820
|
-
throw new Error(
|
|
848
|
+
const w = h.map((I) => I.message);
|
|
849
|
+
throw new Error(w.join(`
|
|
821
850
|
`));
|
|
822
851
|
}
|
|
823
|
-
let b =
|
|
852
|
+
let b = se(
|
|
824
853
|
a,
|
|
825
|
-
|
|
854
|
+
u,
|
|
826
855
|
e,
|
|
827
856
|
void 0,
|
|
828
857
|
p,
|
|
@@ -834,25 +863,25 @@ async function ze(t, e, n) {
|
|
|
834
863
|
...p
|
|
835
864
|
}), b;
|
|
836
865
|
}
|
|
837
|
-
function
|
|
866
|
+
function Wt(t) {
|
|
838
867
|
const e = t.replace(/^.*\./, "") || void 0, n = t.replace(/^.*[/\\]/, "") || void 0;
|
|
839
868
|
return { extension: e, fileName: n };
|
|
840
869
|
}
|
|
841
|
-
async function
|
|
842
|
-
const { buffer: e, mimeType: n = "application/octet-stream" } = await
|
|
870
|
+
async function On(t) {
|
|
871
|
+
const { buffer: e, mimeType: n = "application/octet-stream" } = await Le(t), i = Wt(t), o = e.toString("base64");
|
|
843
872
|
return {
|
|
844
873
|
data: o,
|
|
845
|
-
hash:
|
|
874
|
+
hash: ut(o),
|
|
846
875
|
mimeType: n,
|
|
847
876
|
...i
|
|
848
877
|
};
|
|
849
878
|
}
|
|
850
|
-
async function
|
|
851
|
-
const e = await
|
|
852
|
-
return { data: o, hash:
|
|
879
|
+
async function Sn(t) {
|
|
880
|
+
const e = await qe(t), n = Ce.getType(t) || "application/octet-stream", i = Wt(t), o = e.toString("base64");
|
|
881
|
+
return { data: o, hash: ut(o), mimeType: n, ...i };
|
|
853
882
|
}
|
|
854
|
-
var
|
|
855
|
-
function
|
|
883
|
+
var Gt = /* @__PURE__ */ ((t) => (t.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", t))(Gt || {}), Zt = /* @__PURE__ */ ((t) => (t.DUPLICATED_INDEX = "DUPLICATED_INDEX", t.MISSING_INDEX = "MISSING_INDEX", t))(Zt || {});
|
|
884
|
+
function jt(t) {
|
|
856
885
|
const e = [];
|
|
857
886
|
let n = -1;
|
|
858
887
|
for (const i of t) {
|
|
@@ -869,7 +898,7 @@ function Ot(t) {
|
|
|
869
898
|
}
|
|
870
899
|
return e;
|
|
871
900
|
}
|
|
872
|
-
function
|
|
901
|
+
function H(t) {
|
|
873
902
|
var i, o, a;
|
|
874
903
|
const e = [];
|
|
875
904
|
let n = t.length - 1;
|
|
@@ -883,13 +912,13 @@ function V(t) {
|
|
|
883
912
|
}
|
|
884
913
|
return e;
|
|
885
914
|
}
|
|
886
|
-
function
|
|
915
|
+
function Be(t) {
|
|
887
916
|
const e = [...t], n = e[e.length - 1];
|
|
888
917
|
return n && (n.type === "NOOP" ? e.push({
|
|
889
918
|
...n,
|
|
890
919
|
index: n.index,
|
|
891
920
|
type: "NOOP",
|
|
892
|
-
skip:
|
|
921
|
+
skip: te(t)
|
|
893
922
|
}) : e.push({
|
|
894
923
|
type: "NOOP",
|
|
895
924
|
index: n.index + 1,
|
|
@@ -903,24 +932,24 @@ function Re(t) {
|
|
|
903
932
|
function X(t) {
|
|
904
933
|
return t.slice().sort((e, n) => e.skip - n.skip).sort((e, n) => e.index - n.index);
|
|
905
934
|
}
|
|
906
|
-
const
|
|
935
|
+
const Ke = (t, e, n) => [...e, ...n].sort(
|
|
907
936
|
(i, o) => new Date(i.timestamp).getTime() - new Date(o.timestamp).getTime()
|
|
908
937
|
).map((i, o) => ({
|
|
909
938
|
...i,
|
|
910
939
|
index: t.index + o,
|
|
911
940
|
skip: o === 0 ? t.skip : 0
|
|
912
|
-
})),
|
|
941
|
+
})), We = (t, e, n) => [...e, ...n].sort(
|
|
913
942
|
(i, o) => new Date(i.timestamp).getTime() - new Date(o.timestamp).getTime()
|
|
914
943
|
).sort((i, o) => i.index - o.index).map((i, o) => ({
|
|
915
944
|
...i,
|
|
916
945
|
index: t.index + o,
|
|
917
946
|
skip: o === 0 ? t.skip : 0
|
|
918
947
|
}));
|
|
919
|
-
function
|
|
920
|
-
return
|
|
948
|
+
function Et(t, e) {
|
|
949
|
+
return W(t) === W(e);
|
|
921
950
|
}
|
|
922
|
-
function
|
|
923
|
-
const n =
|
|
951
|
+
function Ge(t, e) {
|
|
952
|
+
const n = H(X(t.slice())), i = H(X(e.slice()));
|
|
924
953
|
if (n.length < 1)
|
|
925
954
|
return [i, []];
|
|
926
955
|
const o = [];
|
|
@@ -928,9 +957,9 @@ function Le(t, e) {
|
|
|
928
957
|
for (; i.length > 0; ) {
|
|
929
958
|
const r = i[0];
|
|
930
959
|
let p = n.shift();
|
|
931
|
-
for (; p &&
|
|
960
|
+
for (; p && Qt(p, r); )
|
|
932
961
|
o.push(p), p = n.shift();
|
|
933
|
-
if (p ? a || (
|
|
962
|
+
if (p ? a || (Et(p, r) ? (i.shift(), o.push(p)) : (n.unshift(p), a = !0)) : a = !0, a) {
|
|
934
963
|
let m = i.shift();
|
|
935
964
|
for (; m; )
|
|
936
965
|
o.push(m), m = i.shift();
|
|
@@ -941,89 +970,92 @@ function Le(t, e) {
|
|
|
941
970
|
for (; r; )
|
|
942
971
|
o.push(r), r = n.shift();
|
|
943
972
|
}
|
|
944
|
-
return [
|
|
973
|
+
return [H(o), n];
|
|
945
974
|
}
|
|
946
|
-
function
|
|
975
|
+
function Qt(t, e) {
|
|
947
976
|
return t.index < e.index || t.index === e.index && t.skip < e.skip;
|
|
948
977
|
}
|
|
949
|
-
function
|
|
978
|
+
function Yt(t, e) {
|
|
950
979
|
const n = [], i = [], o = [], a = Math.max(
|
|
951
980
|
t.length,
|
|
952
981
|
e.length
|
|
953
982
|
);
|
|
954
983
|
let r = !1;
|
|
955
984
|
for (let p = 0; p < a; p++) {
|
|
956
|
-
const m = t[p],
|
|
957
|
-
m &&
|
|
985
|
+
const m = t[p], u = e[p];
|
|
986
|
+
m && u ? !r && Et(m, u) ? n.push(m) : (r = !0, i.push(m), o.push(u)) : m ? i.push(m) : u && o.push(u);
|
|
958
987
|
}
|
|
959
988
|
return [n, i, o];
|
|
960
989
|
}
|
|
961
|
-
function
|
|
962
|
-
const [i, o, a] =
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
), r =
|
|
990
|
+
function Ze(t, e, n) {
|
|
991
|
+
const [i, o, a] = Yt(
|
|
992
|
+
H(t),
|
|
993
|
+
H(e)
|
|
994
|
+
), r = ft(i), p = 1 + Math.max(
|
|
966
995
|
r,
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
), m =
|
|
996
|
+
ft(o),
|
|
997
|
+
ft(a)
|
|
998
|
+
), m = ne(
|
|
999
|
+
a,
|
|
1000
|
+
o
|
|
1001
|
+
), u = n(
|
|
970
1002
|
{
|
|
971
1003
|
index: p,
|
|
972
1004
|
skip: p - (r + 1)
|
|
973
1005
|
},
|
|
974
1006
|
o,
|
|
975
|
-
|
|
1007
|
+
m
|
|
976
1008
|
);
|
|
977
|
-
return i.concat(
|
|
1009
|
+
return i.concat(u);
|
|
978
1010
|
}
|
|
979
|
-
function
|
|
1011
|
+
function ft(t) {
|
|
980
1012
|
const e = t[t.length - 1];
|
|
981
1013
|
return e ? e.index : -1;
|
|
982
1014
|
}
|
|
983
|
-
function
|
|
1015
|
+
function te(t) {
|
|
984
1016
|
var i, o, a;
|
|
985
1017
|
if (t.length < 1)
|
|
986
1018
|
return -1;
|
|
987
|
-
const e =
|
|
1019
|
+
const e = H(t);
|
|
988
1020
|
let n = (((i = e[e.length - 1]) == null ? void 0 : i.skip) || 0) + 1;
|
|
989
1021
|
return e.length > 1 && (n += ((o = e[e.length - 2]) == null ? void 0 : o.skip) || 0), (((a = e[e.length - 1]) == null ? void 0 : a.index) || -1) < n ? -1 : n;
|
|
990
1022
|
}
|
|
991
|
-
const
|
|
992
|
-
|
|
993
|
-
),
|
|
1023
|
+
const Qe = (t) => jt(
|
|
1024
|
+
H(X(t))
|
|
1025
|
+
), Ye = (t) => t.reduce((n, i) => {
|
|
994
1026
|
var o;
|
|
995
1027
|
return n[i.scope] || (n[i.scope] = []), (o = n[i.scope]) == null || o.push(i), n;
|
|
996
|
-
}, {}),
|
|
1028
|
+
}, {}), tn = (t, e) => {
|
|
997
1029
|
var m;
|
|
998
1030
|
const n = {
|
|
999
1031
|
integrityIssues: [],
|
|
1000
1032
|
validOperations: [],
|
|
1001
1033
|
invalidOperations: [],
|
|
1002
1034
|
duplicatedOperations: []
|
|
1003
|
-
}, i = X(t), o = X(e), a =
|
|
1035
|
+
}, i = X(t), o = X(e), a = jt([
|
|
1004
1036
|
...i,
|
|
1005
1037
|
...o
|
|
1006
1038
|
]), p = (m = [...a.filter(
|
|
1007
|
-
(
|
|
1039
|
+
(u) => u.category === "MISSING_INDEX"
|
|
1008
1040
|
/* MISSING_INDEX */
|
|
1009
|
-
)].sort((
|
|
1010
|
-
for (const
|
|
1011
|
-
if (p &&
|
|
1012
|
-
n.invalidOperations.push(
|
|
1041
|
+
)].sort((u, h) => h.operation.index - u.operation.index).pop()) == null ? void 0 : m.operation;
|
|
1042
|
+
for (const u of o) {
|
|
1043
|
+
if (p && u.index >= p.index) {
|
|
1044
|
+
n.invalidOperations.push(u);
|
|
1013
1045
|
continue;
|
|
1014
1046
|
}
|
|
1015
|
-
if (a.some((b) => b.operation.index ===
|
|
1016
|
-
n.duplicatedOperations.push(
|
|
1047
|
+
if (a.some((b) => b.operation.index === u.index && b.operation.skip === u.skip && b.category === "DUPLICATED_INDEX")) {
|
|
1048
|
+
n.duplicatedOperations.push(u);
|
|
1017
1049
|
continue;
|
|
1018
1050
|
}
|
|
1019
|
-
n.validOperations.push(
|
|
1051
|
+
n.validOperations.push(u);
|
|
1020
1052
|
}
|
|
1021
1053
|
return n.integrityIssues.push(...a), n;
|
|
1022
1054
|
};
|
|
1023
|
-
function
|
|
1055
|
+
function en(t, e) {
|
|
1024
1056
|
return t.filter((n) => !e.some((i) => n.type === "NOOP" && n.skip === 0 && n.index === i.index || n.index === i.index && n.skip === i.skip && n.scope === i.scope && n.hash === i.hash && n.type === i.type));
|
|
1025
1057
|
}
|
|
1026
|
-
function
|
|
1058
|
+
function ee(t, e) {
|
|
1027
1059
|
const [n] = X(t).slice(-1), i = (n == null ? void 0 : n.index) ?? -1, o = i + 1, a = {
|
|
1028
1060
|
...e,
|
|
1029
1061
|
index: e.index ?? o
|
|
@@ -1032,139 +1064,141 @@ function Qt(t, e) {
|
|
|
1032
1064
|
throw new Error(
|
|
1033
1065
|
`The skip header operation index must be greater than or equal to ${i}`
|
|
1034
1066
|
);
|
|
1035
|
-
return (
|
|
1067
|
+
return (H(
|
|
1036
1068
|
X([...t, a])
|
|
1037
1069
|
) || []).slice(0, -1);
|
|
1038
1070
|
}
|
|
1039
|
-
function
|
|
1071
|
+
function ht(t) {
|
|
1040
1072
|
return {
|
|
1041
1073
|
...Object.entries(t).reduce(
|
|
1042
1074
|
(n, i) => {
|
|
1043
1075
|
const [o, a] = i;
|
|
1044
1076
|
return {
|
|
1045
1077
|
...n,
|
|
1046
|
-
[o]:
|
|
1078
|
+
[o]: H(X(a))
|
|
1047
1079
|
};
|
|
1048
1080
|
},
|
|
1049
1081
|
{}
|
|
1050
1082
|
)
|
|
1051
1083
|
};
|
|
1052
1084
|
}
|
|
1053
|
-
|
|
1085
|
+
function ne(t, e) {
|
|
1086
|
+
return t.filter((n) => n.id ? !e.some((i) => i.id === n.id) : !0);
|
|
1087
|
+
}
|
|
1088
|
+
const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1054
1089
|
__proto__: null,
|
|
1055
|
-
IntegrityIssueSubType:
|
|
1056
|
-
IntegrityIssueType:
|
|
1057
|
-
addUndo:
|
|
1058
|
-
attachBranch:
|
|
1059
|
-
checkCleanedOperationsIntegrity:
|
|
1060
|
-
checkOperationsIntegrity:
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1090
|
+
IntegrityIssueSubType: Zt,
|
|
1091
|
+
IntegrityIssueType: Gt,
|
|
1092
|
+
addUndo: Be,
|
|
1093
|
+
attachBranch: Ge,
|
|
1094
|
+
checkCleanedOperationsIntegrity: jt,
|
|
1095
|
+
checkOperationsIntegrity: Qe,
|
|
1096
|
+
filterDuplicatedOperations: ne,
|
|
1097
|
+
garbageCollect: H,
|
|
1098
|
+
garbageCollectDocumentOperations: ht,
|
|
1099
|
+
groupOperationsByScope: Ye,
|
|
1100
|
+
merge: Ze,
|
|
1101
|
+
nextSkipNumber: te,
|
|
1102
|
+
operationsAreEqual: Et,
|
|
1103
|
+
precedes: Qt,
|
|
1104
|
+
prepareOperations: tn,
|
|
1105
|
+
removeExistingOperations: en,
|
|
1106
|
+
reshuffleByTimestamp: Ke,
|
|
1107
|
+
reshuffleByTimestampAndIndex: We,
|
|
1108
|
+
skipHeaderOperations: ee,
|
|
1073
1109
|
sortOperations: X,
|
|
1074
|
-
split:
|
|
1110
|
+
split: Yt
|
|
1075
1111
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1076
|
-
function
|
|
1112
|
+
function nn(t, e) {
|
|
1077
1113
|
let n;
|
|
1078
1114
|
return "index" in e ? n = { ...e } : n = t.operations[e.scope].at(-1), ((n == null ? void 0 : n.index) ?? -1) + 1;
|
|
1079
1115
|
}
|
|
1080
|
-
function
|
|
1116
|
+
function ie(t, e) {
|
|
1081
1117
|
return {
|
|
1082
1118
|
...t,
|
|
1083
1119
|
revision: {
|
|
1084
1120
|
...t.revision,
|
|
1085
|
-
[e.scope]:
|
|
1121
|
+
[e.scope]: nn(t, e)
|
|
1086
1122
|
},
|
|
1087
1123
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
1088
1124
|
};
|
|
1089
1125
|
}
|
|
1090
|
-
function
|
|
1091
|
-
if ([
|
|
1126
|
+
function on(t, e, n = 0) {
|
|
1127
|
+
if ([et, nt, mt].includes(e.type))
|
|
1092
1128
|
return t;
|
|
1093
|
-
const { scope:
|
|
1129
|
+
const { scope: i } = e, o = t.operations[i].slice();
|
|
1130
|
+
let a;
|
|
1131
|
+
const r = o.at(-1);
|
|
1094
1132
|
let p = ((r == null ? void 0 : r.index) ?? -1) + 1;
|
|
1095
1133
|
if ("index" in e) {
|
|
1096
1134
|
if (e.index - n > p)
|
|
1097
1135
|
throw new Error(
|
|
1098
1136
|
`Missing operations: expected ${p} with skip 0 or equivalent, got index ${e.index} with skip ${n}`
|
|
1099
1137
|
);
|
|
1100
|
-
p = e.index;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1138
|
+
p = e.index, a = e.id;
|
|
1139
|
+
} else
|
|
1140
|
+
a = Ie();
|
|
1141
|
+
return o.push({
|
|
1103
1142
|
...e,
|
|
1143
|
+
id: a,
|
|
1104
1144
|
index: p,
|
|
1105
1145
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1106
1146
|
hash: "",
|
|
1107
|
-
scope:
|
|
1147
|
+
scope: i,
|
|
1108
1148
|
skip: n,
|
|
1109
1149
|
error: void 0
|
|
1110
|
-
}
|
|
1111
|
-
return i && (m.resultingState = t.state[o]), a.push(m), {
|
|
1150
|
+
}), {
|
|
1112
1151
|
...t,
|
|
1113
|
-
operations: { ...t.operations, [
|
|
1152
|
+
operations: { ...t.operations, [i]: o }
|
|
1114
1153
|
};
|
|
1115
1154
|
}
|
|
1116
|
-
function
|
|
1117
|
-
let
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
return Se(t, e.input);
|
|
1129
|
-
case ct:
|
|
1130
|
-
return $e(t, e, n);
|
|
1131
|
-
case Ut:
|
|
1132
|
-
return ke(t, e.input.state);
|
|
1155
|
+
function sn(t, e, n = 0) {
|
|
1156
|
+
let i = on(t, e, n);
|
|
1157
|
+
return i = ie(i, e), i;
|
|
1158
|
+
}
|
|
1159
|
+
function rn(t, e, n) {
|
|
1160
|
+
switch (zt().parse(e), e.type) {
|
|
1161
|
+
case Vt:
|
|
1162
|
+
return Ne(t, e.input);
|
|
1163
|
+
case mt:
|
|
1164
|
+
return Me(t, e, n);
|
|
1165
|
+
case Ht:
|
|
1166
|
+
return Re(t, e.input.state);
|
|
1133
1167
|
default:
|
|
1134
1168
|
return t;
|
|
1135
1169
|
}
|
|
1136
1170
|
}
|
|
1137
|
-
function
|
|
1171
|
+
function En(t, e, n) {
|
|
1138
1172
|
switch (e.type) {
|
|
1139
|
-
case tt:
|
|
1140
|
-
return je(t, e, n);
|
|
1141
1173
|
case et:
|
|
1142
|
-
return
|
|
1174
|
+
return Ae(t, e, n);
|
|
1175
|
+
case nt:
|
|
1176
|
+
return Pe(t, e, n);
|
|
1143
1177
|
default:
|
|
1144
1178
|
return { document: t, action: e, skip: n };
|
|
1145
1179
|
}
|
|
1146
1180
|
}
|
|
1147
|
-
function
|
|
1181
|
+
function an(t, e, n, i, o = !1, a = re) {
|
|
1148
1182
|
const r = e.scope, p = t.operations[r].at(-1);
|
|
1149
1183
|
if (!p)
|
|
1150
1184
|
return t;
|
|
1151
|
-
const m =
|
|
1185
|
+
const m = ht(
|
|
1152
1186
|
{
|
|
1153
1187
|
...t.operations,
|
|
1154
|
-
[r]:
|
|
1188
|
+
[r]: ee(
|
|
1155
1189
|
t.operations[r],
|
|
1156
1190
|
p
|
|
1157
1191
|
)
|
|
1158
1192
|
}
|
|
1159
1193
|
);
|
|
1160
|
-
let
|
|
1194
|
+
let u;
|
|
1161
1195
|
const h = m[r].at(-1);
|
|
1162
1196
|
if (o && (h != null && h.resultingState))
|
|
1163
|
-
|
|
1197
|
+
u = a(
|
|
1164
1198
|
h.resultingState
|
|
1165
1199
|
);
|
|
1166
1200
|
else {
|
|
1167
|
-
const { state: b } =
|
|
1201
|
+
const { state: b } = xt(
|
|
1168
1202
|
t.initialState,
|
|
1169
1203
|
m,
|
|
1170
1204
|
n,
|
|
@@ -1178,88 +1212,83 @@ function Ze(t, e, n, i, o = !1, a = ee) {
|
|
|
1178
1212
|
operationResultingStateParser: a
|
|
1179
1213
|
}
|
|
1180
1214
|
);
|
|
1181
|
-
|
|
1215
|
+
u = b[r];
|
|
1182
1216
|
}
|
|
1183
1217
|
return {
|
|
1184
1218
|
...t,
|
|
1185
1219
|
state: {
|
|
1186
1220
|
...t.state,
|
|
1187
|
-
[r]:
|
|
1221
|
+
[r]: u
|
|
1188
1222
|
},
|
|
1189
|
-
operations:
|
|
1223
|
+
operations: ht({
|
|
1190
1224
|
...t.operations
|
|
1191
1225
|
})
|
|
1192
1226
|
};
|
|
1193
1227
|
}
|
|
1194
|
-
function
|
|
1228
|
+
function oe(t, e, n, i, o = {}) {
|
|
1195
1229
|
const {
|
|
1196
1230
|
skip: a,
|
|
1197
1231
|
ignoreSkipOperations: r = !1,
|
|
1198
1232
|
reuseHash: p = !1,
|
|
1199
1233
|
reuseOperationResultingState: m = !1,
|
|
1200
|
-
operationResultingStateParser:
|
|
1234
|
+
operationResultingStateParser: u
|
|
1201
1235
|
} = o, h = { ...e }, b = a || 0;
|
|
1202
|
-
let
|
|
1203
|
-
const
|
|
1204
|
-
return
|
|
1205
|
-
|
|
1206
|
-
h,
|
|
1207
|
-
b,
|
|
1208
|
-
m
|
|
1209
|
-
), v && (O = Ze(
|
|
1210
|
-
O,
|
|
1236
|
+
let w = { ...t };
|
|
1237
|
+
const I = !r && (b > 0 || "index" in h && h.skip > 0);
|
|
1238
|
+
return _t(h) && (w = rn(w, h, n)), w = sn(w, h, b), I && (w = an(
|
|
1239
|
+
w,
|
|
1211
1240
|
h,
|
|
1212
1241
|
n,
|
|
1213
1242
|
b,
|
|
1214
1243
|
m,
|
|
1215
|
-
|
|
1216
|
-
)),
|
|
1244
|
+
u
|
|
1245
|
+
)), w = lt(w, ($) => {
|
|
1217
1246
|
try {
|
|
1218
|
-
const
|
|
1219
|
-
|
|
1247
|
+
const M = n(
|
|
1248
|
+
$.state,
|
|
1220
1249
|
h,
|
|
1221
1250
|
i
|
|
1222
1251
|
);
|
|
1223
|
-
if (
|
|
1224
|
-
return
|
|
1225
|
-
...
|
|
1252
|
+
if (M)
|
|
1253
|
+
return ct({
|
|
1254
|
+
...w,
|
|
1226
1255
|
// clipboard: [...clipboardValue],
|
|
1227
|
-
state:
|
|
1256
|
+
state: M
|
|
1228
1257
|
});
|
|
1229
|
-
} catch (
|
|
1230
|
-
const C =
|
|
1231
|
-
|
|
1258
|
+
} catch (M) {
|
|
1259
|
+
const C = w.operations[h.scope].length - 1;
|
|
1260
|
+
$.operations[h.scope][C].error = M.message, $.operations[h.scope][C].skip = 0, I && ($.state = ct({ ...t.state }), $.operations = ct({
|
|
1232
1261
|
...t.operations,
|
|
1233
1262
|
[h.scope]: [
|
|
1234
1263
|
...t.operations[h.scope],
|
|
1235
1264
|
{
|
|
1236
|
-
|
|
1265
|
+
...$.operations[h.scope][C]
|
|
1237
1266
|
}
|
|
1238
1267
|
]
|
|
1239
1268
|
}));
|
|
1240
1269
|
}
|
|
1241
|
-
}),
|
|
1242
|
-
if ([
|
|
1243
|
-
return
|
|
1244
|
-
const
|
|
1245
|
-
|
|
1246
|
-
const { hash:
|
|
1247
|
-
|
|
1248
|
-
...
|
|
1270
|
+
}), lt(w, ($) => {
|
|
1271
|
+
if ([et, nt, mt].includes(h.type))
|
|
1272
|
+
return $;
|
|
1273
|
+
const M = h.scope || "global", C = p && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : $t($, M), c = $.operations[M].at(-1);
|
|
1274
|
+
c && (c.hash = C, m && (c.resultingState = $.state[M]), !_t(h) && h.attachments && h.attachments.forEach((l) => {
|
|
1275
|
+
const { hash: f, ...k } = l;
|
|
1276
|
+
$.attachments[f] = {
|
|
1277
|
+
...k
|
|
1249
1278
|
};
|
|
1250
|
-
});
|
|
1279
|
+
}));
|
|
1251
1280
|
});
|
|
1252
1281
|
}
|
|
1253
|
-
function
|
|
1254
|
-
return t.type ===
|
|
1282
|
+
function $n(t) {
|
|
1283
|
+
return t.type === ze && t.skip !== void 0 && t.skip > 0 && t.hash !== void 0;
|
|
1255
1284
|
}
|
|
1256
|
-
function
|
|
1257
|
-
return [
|
|
1285
|
+
function Dn(t) {
|
|
1286
|
+
return [et, nt].includes(t.type);
|
|
1258
1287
|
}
|
|
1259
|
-
function
|
|
1260
|
-
return [
|
|
1288
|
+
function _t(t) {
|
|
1289
|
+
return [Vt, et, nt, mt, Ht].includes(t.type);
|
|
1261
1290
|
}
|
|
1262
|
-
function
|
|
1291
|
+
function G(t, e, n, i, o = "global") {
|
|
1263
1292
|
if (!t)
|
|
1264
1293
|
throw new Error("Empty action type");
|
|
1265
1294
|
if (typeof t != "string")
|
|
@@ -1273,10 +1302,10 @@ function W(t, e, n, i, o = "global") {
|
|
|
1273
1302
|
}
|
|
1274
1303
|
return a;
|
|
1275
1304
|
}
|
|
1276
|
-
function
|
|
1305
|
+
function pn(t, e = oe) {
|
|
1277
1306
|
return (n, i, o, a) => e(n, i, t, o, a);
|
|
1278
1307
|
}
|
|
1279
|
-
const
|
|
1308
|
+
const cn = (t, e) => ({
|
|
1280
1309
|
name: "",
|
|
1281
1310
|
documentType: "",
|
|
1282
1311
|
revision: {
|
|
@@ -1288,8 +1317,8 @@ const Ye = (t, e) => ({
|
|
|
1288
1317
|
attachments: {},
|
|
1289
1318
|
...t,
|
|
1290
1319
|
state: (e == null ? void 0 : e(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
|
|
1291
|
-
}),
|
|
1292
|
-
const n =
|
|
1320
|
+
}), ln = (t, e) => {
|
|
1321
|
+
const n = cn(
|
|
1293
1322
|
t,
|
|
1294
1323
|
e
|
|
1295
1324
|
);
|
|
@@ -1299,21 +1328,21 @@ const Ye = (t, e) => ({
|
|
|
1299
1328
|
operations: { global: [], local: [] },
|
|
1300
1329
|
clipboard: []
|
|
1301
1330
|
};
|
|
1302
|
-
},
|
|
1331
|
+
}, $t = (t, e = "global") => ut(W(t.state[e] || "")), kn = (t, e = 1e3) => {
|
|
1303
1332
|
const n = Math.random() * e;
|
|
1304
|
-
return
|
|
1333
|
+
return ut(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${n}`);
|
|
1305
1334
|
};
|
|
1306
|
-
function
|
|
1307
|
-
return
|
|
1335
|
+
function pt(t) {
|
|
1336
|
+
return ge(he(t, !0));
|
|
1308
1337
|
}
|
|
1309
|
-
function
|
|
1338
|
+
function Tn(t, e) {
|
|
1310
1339
|
const n = [...t];
|
|
1311
1340
|
let i = e || 0, o = n.length > 0 ? n[n.length - 1].index : 0;
|
|
1312
1341
|
const a = [];
|
|
1313
1342
|
for (const r of n.reverse()) {
|
|
1314
1343
|
if (i > 0) {
|
|
1315
|
-
const
|
|
1316
|
-
i -=
|
|
1344
|
+
const u = o - r.index;
|
|
1345
|
+
i -= u;
|
|
1317
1346
|
}
|
|
1318
1347
|
if (i < 0)
|
|
1319
1348
|
throw new Error("Invalid operation index, missing operations");
|
|
@@ -1322,14 +1351,14 @@ function bn(t, e) {
|
|
|
1322
1351
|
operation: r
|
|
1323
1352
|
}, m = r.skip > 0 ? r.skip + 1 : 0;
|
|
1324
1353
|
if (m > 0 && m > i) {
|
|
1325
|
-
const
|
|
1326
|
-
i = i +
|
|
1354
|
+
const u = m - i;
|
|
1355
|
+
i = i + u;
|
|
1327
1356
|
}
|
|
1328
1357
|
o = r.index, a.push(p);
|
|
1329
1358
|
}
|
|
1330
1359
|
return a.reverse();
|
|
1331
1360
|
}
|
|
1332
|
-
function
|
|
1361
|
+
function _n(t, e, n) {
|
|
1333
1362
|
const i = t.slice().sort((p, m) => p.skip - m.skip).sort((p, m) => p.index - m.index);
|
|
1334
1363
|
let o = n, a = 0, r = e;
|
|
1335
1364
|
for (const p of i.reverse()) {
|
|
@@ -1341,19 +1370,19 @@ function wn(t, e, n) {
|
|
|
1341
1370
|
}
|
|
1342
1371
|
return a;
|
|
1343
1372
|
}
|
|
1344
|
-
function
|
|
1373
|
+
function vn(t) {
|
|
1345
1374
|
return Object.values(t).flatMap((e) => e).sort(
|
|
1346
1375
|
(e, n) => new Date(e.timestamp).getTime() - new Date(n.timestamp).getTime()
|
|
1347
1376
|
);
|
|
1348
1377
|
}
|
|
1349
|
-
function
|
|
1378
|
+
function In(t) {
|
|
1350
1379
|
return Object.values(t).flatMap((e) => e).sort(
|
|
1351
1380
|
(e, n) => new Date(e.operation.timestamp).getTime() - new Date(n.operation.timestamp).getTime()
|
|
1352
1381
|
);
|
|
1353
1382
|
}
|
|
1354
|
-
function
|
|
1355
|
-
const m =
|
|
1356
|
-
return
|
|
1383
|
+
function xt(t, e, n, i, o, a = oe, r = {}, p) {
|
|
1384
|
+
const m = pn(n, a);
|
|
1385
|
+
return se(
|
|
1357
1386
|
t,
|
|
1358
1387
|
e,
|
|
1359
1388
|
m,
|
|
@@ -1363,31 +1392,31 @@ function gt(t, e, n, i, o, a = Yt, r = {}, p) {
|
|
|
1363
1392
|
p
|
|
1364
1393
|
);
|
|
1365
1394
|
}
|
|
1366
|
-
function
|
|
1395
|
+
function se(t, e, n, i, o, a = {}, r) {
|
|
1367
1396
|
const {
|
|
1368
1397
|
checkHashes: p = !0,
|
|
1369
1398
|
reuseOperationResultingState: m,
|
|
1370
|
-
operationResultingStateParser:
|
|
1399
|
+
operationResultingStateParser: u = re
|
|
1371
1400
|
} = r || {};
|
|
1372
1401
|
let h = t;
|
|
1373
|
-
const b = [],
|
|
1402
|
+
const b = [], w = {
|
|
1374
1403
|
global: [],
|
|
1375
1404
|
local: []
|
|
1376
1405
|
};
|
|
1377
1406
|
if (m)
|
|
1378
1407
|
for (const [c, l] of Object.entries(e)) {
|
|
1379
|
-
const
|
|
1408
|
+
const f = l.findLastIndex(
|
|
1380
1409
|
(F) => !!F.resultingState
|
|
1381
1410
|
);
|
|
1382
|
-
if (
|
|
1411
|
+
if (f < 0) {
|
|
1383
1412
|
b.push(...l);
|
|
1384
1413
|
continue;
|
|
1385
1414
|
}
|
|
1386
|
-
const
|
|
1415
|
+
const k = l[f];
|
|
1387
1416
|
try {
|
|
1388
|
-
const F =
|
|
1417
|
+
const F = u(
|
|
1389
1418
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion
|
|
1390
|
-
|
|
1419
|
+
k.resultingState
|
|
1391
1420
|
);
|
|
1392
1421
|
h = {
|
|
1393
1422
|
...h,
|
|
@@ -1396,61 +1425,68 @@ function te(t, e, n, i, o, a = {}, r) {
|
|
|
1396
1425
|
// TODO how to deal with attachments?
|
|
1397
1426
|
[c]: F
|
|
1398
1427
|
}
|
|
1399
|
-
},
|
|
1400
|
-
...l.slice(0,
|
|
1401
|
-
), b.push(...l.slice(
|
|
1428
|
+
}, w[c].push(
|
|
1429
|
+
...l.slice(0, f + 1)
|
|
1430
|
+
), b.push(...l.slice(f + 1));
|
|
1402
1431
|
} catch {
|
|
1403
1432
|
b.push(...l);
|
|
1404
1433
|
}
|
|
1405
1434
|
}
|
|
1406
1435
|
else
|
|
1407
1436
|
b.push(...Object.values(e).flat());
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1437
|
+
const I = ln(h);
|
|
1438
|
+
I.initialState = t, I.operations = w;
|
|
1439
|
+
let $ = I;
|
|
1440
|
+
if (b.length)
|
|
1441
|
+
$ = b.reduce((c, l) => n(c, l, i, {
|
|
1442
|
+
skip: l.skip,
|
|
1443
|
+
ignoreSkipOperations: !0,
|
|
1444
|
+
reuseHash: !p
|
|
1445
|
+
}), I);
|
|
1446
|
+
else
|
|
1447
|
+
for (const c of Object.values(w)) {
|
|
1448
|
+
const l = c.at(-1);
|
|
1449
|
+
l && ($ = ie($, l));
|
|
1450
|
+
}
|
|
1415
1451
|
if (!p)
|
|
1416
|
-
for (const c of Object.keys(
|
|
1452
|
+
for (const c of Object.keys($.state))
|
|
1417
1453
|
for (let l = b.length - 1; l >= 0; l--) {
|
|
1418
|
-
const
|
|
1419
|
-
if (
|
|
1420
|
-
if (
|
|
1454
|
+
const f = b[l];
|
|
1455
|
+
if (f.scope === c) {
|
|
1456
|
+
if (f.hash !== $t($, c))
|
|
1421
1457
|
throw new Error(`Hash mismatch for scope ${c}`);
|
|
1422
1458
|
break;
|
|
1423
1459
|
}
|
|
1424
1460
|
}
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1461
|
+
const M = Object.keys(
|
|
1462
|
+
$.operations
|
|
1427
1463
|
).reduce(
|
|
1428
1464
|
(c, l) => {
|
|
1429
|
-
const
|
|
1465
|
+
const f = l;
|
|
1430
1466
|
return {
|
|
1431
1467
|
...c,
|
|
1432
|
-
[
|
|
1433
|
-
|
|
1434
|
-
var
|
|
1468
|
+
[f]: [
|
|
1469
|
+
...$.operations[f].map((k, F) => {
|
|
1470
|
+
var R;
|
|
1435
1471
|
return {
|
|
1436
|
-
...
|
|
1437
|
-
timestamp: ((
|
|
1472
|
+
...k,
|
|
1473
|
+
timestamp: ((R = e[f][F]) == null ? void 0 : R.timestamp) ?? k.timestamp
|
|
1438
1474
|
};
|
|
1439
1475
|
})
|
|
1440
1476
|
]
|
|
1441
1477
|
};
|
|
1442
1478
|
},
|
|
1443
1479
|
{ global: [], local: [] }
|
|
1444
|
-
), C = Object.values(
|
|
1445
|
-
const
|
|
1446
|
-
return (
|
|
1480
|
+
), C = Object.values(M).reduce((c, l) => {
|
|
1481
|
+
const f = l[l.length - 1];
|
|
1482
|
+
return (f == null ? void 0 : f.timestamp) > c && (c = f.timestamp), c;
|
|
1447
1483
|
}, t.lastModified);
|
|
1448
|
-
return {
|
|
1484
|
+
return { ...$, operations: M, lastModified: C };
|
|
1449
1485
|
}
|
|
1450
|
-
function
|
|
1451
|
-
return
|
|
1486
|
+
function Nn(t, e) {
|
|
1487
|
+
return W(t) === W(e);
|
|
1452
1488
|
}
|
|
1453
|
-
function
|
|
1489
|
+
function re(t) {
|
|
1454
1490
|
const e = typeof t;
|
|
1455
1491
|
if (e === "string")
|
|
1456
1492
|
return JSON.parse(t);
|
|
@@ -1458,54 +1494,54 @@ function ee(t) {
|
|
|
1458
1494
|
return t;
|
|
1459
1495
|
throw new Error(`Providing resulting state is of type: ${e}`);
|
|
1460
1496
|
}
|
|
1461
|
-
const
|
|
1497
|
+
const ae = (t) => G(
|
|
1462
1498
|
"SET_NAME",
|
|
1463
1499
|
t,
|
|
1464
1500
|
void 0,
|
|
1465
|
-
|
|
1501
|
+
Ot,
|
|
1466
1502
|
void 0
|
|
1467
|
-
),
|
|
1503
|
+
), pe = (t = 1, e = "global") => G(
|
|
1468
1504
|
"UNDO",
|
|
1469
1505
|
t,
|
|
1470
1506
|
void 0,
|
|
1471
|
-
|
|
1507
|
+
St,
|
|
1472
1508
|
e
|
|
1473
|
-
),
|
|
1509
|
+
), ce = (t = 1, e = "global") => G(
|
|
1474
1510
|
"REDO",
|
|
1475
1511
|
t,
|
|
1476
1512
|
void 0,
|
|
1477
|
-
|
|
1513
|
+
wt,
|
|
1478
1514
|
e
|
|
1479
|
-
),
|
|
1515
|
+
), le = (t, e, n = "global") => G(
|
|
1480
1516
|
"PRUNE",
|
|
1481
1517
|
{ start: t, end: e },
|
|
1482
1518
|
void 0,
|
|
1483
|
-
|
|
1519
|
+
bt,
|
|
1484
1520
|
n
|
|
1485
|
-
),
|
|
1521
|
+
), Dt = (t, e) => G(
|
|
1486
1522
|
"LOAD_STATE",
|
|
1487
1523
|
{ state: t, operations: e },
|
|
1488
1524
|
void 0,
|
|
1489
|
-
|
|
1490
|
-
),
|
|
1525
|
+
yt
|
|
1526
|
+
), me = (t = "global") => G("NOOP", {}, void 0, void 0, t), An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1491
1527
|
__proto__: null,
|
|
1492
|
-
loadState:
|
|
1493
|
-
noop:
|
|
1494
|
-
prune:
|
|
1495
|
-
redo:
|
|
1496
|
-
setName:
|
|
1497
|
-
undo:
|
|
1528
|
+
loadState: Dt,
|
|
1529
|
+
noop: me,
|
|
1530
|
+
prune: le,
|
|
1531
|
+
redo: ce,
|
|
1532
|
+
setName: ae,
|
|
1533
|
+
undo: pe
|
|
1498
1534
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1499
|
-
class
|
|
1535
|
+
class Pn {
|
|
1500
1536
|
/**
|
|
1501
1537
|
* Constructs a BaseDocument instance with an initial state.
|
|
1502
1538
|
* @param reducer - The reducer function that updates the state.
|
|
1503
1539
|
* @param document - The initial state of the document.
|
|
1504
1540
|
*/
|
|
1505
1541
|
constructor(e, n, i) {
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1542
|
+
rt(this, "_document");
|
|
1543
|
+
rt(this, "_reducer");
|
|
1544
|
+
rt(this, "_signalDispatch");
|
|
1509
1545
|
this._reducer = e, this._document = n, this._signalDispatch = i;
|
|
1510
1546
|
}
|
|
1511
1547
|
/**
|
|
@@ -1528,14 +1564,14 @@ class $n {
|
|
|
1528
1564
|
* @returns The file path where the state was saved.
|
|
1529
1565
|
*/
|
|
1530
1566
|
saveToFile(e, n, i) {
|
|
1531
|
-
return
|
|
1567
|
+
return Ve(this._document, e, n, i);
|
|
1532
1568
|
}
|
|
1533
1569
|
/**
|
|
1534
1570
|
* Loads the state of the document from a file.
|
|
1535
1571
|
* @param path - The file path where the state is stored.
|
|
1536
1572
|
*/
|
|
1537
1573
|
async loadFromFile(e) {
|
|
1538
|
-
this._document = await
|
|
1574
|
+
this._document = await Tt(e, this._reducer);
|
|
1539
1575
|
}
|
|
1540
1576
|
/**
|
|
1541
1577
|
* Loads the state of the document from a file and returns it.
|
|
@@ -1544,19 +1580,19 @@ class $n {
|
|
|
1544
1580
|
* @returns The state of the document.
|
|
1545
1581
|
*/
|
|
1546
1582
|
static async stateFromFile(e, n) {
|
|
1547
|
-
return await
|
|
1583
|
+
return await Tt(e, n);
|
|
1548
1584
|
}
|
|
1549
1585
|
/**
|
|
1550
1586
|
* Gets the current state of the document.
|
|
1551
1587
|
*/
|
|
1552
1588
|
get state() {
|
|
1553
|
-
return
|
|
1589
|
+
return pt(this._document.state);
|
|
1554
1590
|
}
|
|
1555
1591
|
/**
|
|
1556
1592
|
* Gets the list of operations performed on the document.
|
|
1557
1593
|
*/
|
|
1558
1594
|
get operations() {
|
|
1559
|
-
return
|
|
1595
|
+
return pt(this._document.operations);
|
|
1560
1596
|
}
|
|
1561
1597
|
/**
|
|
1562
1598
|
* Gets the name of the document.
|
|
@@ -1595,13 +1631,13 @@ class $n {
|
|
|
1595
1631
|
* Gets the initial state of the document.
|
|
1596
1632
|
*/
|
|
1597
1633
|
get initialState() {
|
|
1598
|
-
return
|
|
1634
|
+
return pt(this._document.initialState);
|
|
1599
1635
|
}
|
|
1600
1636
|
/**
|
|
1601
1637
|
* Returns the current document as an object
|
|
1602
1638
|
*/
|
|
1603
1639
|
toDocument() {
|
|
1604
|
-
return
|
|
1640
|
+
return pt(this._document);
|
|
1605
1641
|
}
|
|
1606
1642
|
/**
|
|
1607
1643
|
* Gets the attachment associated with the given key.
|
|
@@ -1615,21 +1651,21 @@ class $n {
|
|
|
1615
1651
|
* @param name - The new name of the document.
|
|
1616
1652
|
*/
|
|
1617
1653
|
setName(e) {
|
|
1618
|
-
return this.dispatch(
|
|
1654
|
+
return this.dispatch(ae(e)), this;
|
|
1619
1655
|
}
|
|
1620
1656
|
/**
|
|
1621
1657
|
* Reverts a number of actions from the document.
|
|
1622
1658
|
* @param count - The number of actions to revert.
|
|
1623
1659
|
*/
|
|
1624
1660
|
undo(e) {
|
|
1625
|
-
return this.dispatch(
|
|
1661
|
+
return this.dispatch(pe(e)), this;
|
|
1626
1662
|
}
|
|
1627
1663
|
/**
|
|
1628
1664
|
* Reapplies a number of actions to the document.
|
|
1629
1665
|
* @param count - The number of actions to reapply.
|
|
1630
1666
|
*/
|
|
1631
1667
|
redo(e) {
|
|
1632
|
-
return this.dispatch(
|
|
1668
|
+
return this.dispatch(ce(e)), this;
|
|
1633
1669
|
}
|
|
1634
1670
|
/**
|
|
1635
1671
|
* Removes a range of operations from the document.
|
|
@@ -1637,7 +1673,7 @@ class $n {
|
|
|
1637
1673
|
* @param end - The ending index of the range to remove.
|
|
1638
1674
|
*/
|
|
1639
1675
|
prune(e, n) {
|
|
1640
|
-
return this.dispatch(
|
|
1676
|
+
return this.dispatch(le(e, n)), this;
|
|
1641
1677
|
}
|
|
1642
1678
|
/**
|
|
1643
1679
|
* Loads a document state and a set of operations.
|
|
@@ -1645,10 +1681,10 @@ class $n {
|
|
|
1645
1681
|
* @param operations - The operations to apply to the document.
|
|
1646
1682
|
*/
|
|
1647
1683
|
loadState(e, n) {
|
|
1648
|
-
return this.dispatch(
|
|
1684
|
+
return this.dispatch(Dt(e, n)), this;
|
|
1649
1685
|
}
|
|
1650
1686
|
}
|
|
1651
|
-
function
|
|
1687
|
+
function Mn(t, e) {
|
|
1652
1688
|
e.forEach((n) => {
|
|
1653
1689
|
Object.getOwnPropertyNames(n.prototype).forEach((i) => {
|
|
1654
1690
|
Object.defineProperty(
|
|
@@ -1662,37 +1698,39 @@ function kn(t, e) {
|
|
|
1662
1698
|
});
|
|
1663
1699
|
}
|
|
1664
1700
|
export {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1701
|
+
In as A,
|
|
1702
|
+
Pn as B,
|
|
1703
|
+
vn as C,
|
|
1704
|
+
Je as D,
|
|
1705
|
+
oe as E,
|
|
1706
|
+
En as F,
|
|
1707
|
+
sn as G,
|
|
1708
|
+
ie as H,
|
|
1709
|
+
bn as I,
|
|
1710
|
+
cn as a,
|
|
1711
|
+
ln as b,
|
|
1712
|
+
pn as c,
|
|
1713
|
+
wn as d,
|
|
1714
|
+
He as e,
|
|
1715
|
+
G as f,
|
|
1716
|
+
Mn as g,
|
|
1717
|
+
An as h,
|
|
1718
|
+
_t as i,
|
|
1719
|
+
_n as j,
|
|
1720
|
+
Kt as k,
|
|
1721
|
+
Tt as l,
|
|
1722
|
+
jn as m,
|
|
1723
|
+
Sn as n,
|
|
1724
|
+
On as o,
|
|
1725
|
+
$t as p,
|
|
1726
|
+
kn as q,
|
|
1727
|
+
$n as r,
|
|
1728
|
+
Ve as s,
|
|
1729
|
+
Nn as t,
|
|
1730
|
+
Dn as u,
|
|
1731
|
+
Tn as v,
|
|
1732
|
+
re as w,
|
|
1733
|
+
pt as x,
|
|
1734
|
+
se as y,
|
|
1735
|
+
xt as z
|
|
1698
1736
|
};
|