document-model 1.0.42 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +2 -2
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/{index-CDcO7NCS.js → index-CJWLwwNi.js} +1 -1
- package/dist/{node/internal/index-fctxJxHD.js → browser/internal/index-CvQOfeml.js} +1 -1
- package/dist/{node/internal/index-D_LMFQg7.js → browser/internal/index-QMhrjNyi.js} +1 -1
- package/dist/browser/internal/{index-DhzefrNj.js → index-eSGNXD4L.js} +1 -1
- package/dist/browser/internal/{object-CrDRbO7a.js → object-ChusgY57.js} +822 -808
- package/dist/browser/internal/object-NkahWZEb.js +25 -0
- package/dist/browser/src/document/types.d.ts +2 -0
- package/dist/browser/src/document/utils/base.d.ts +7 -2
- package/dist/browser/src/document/utils/file.d.ts +3 -2
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +2 -2
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/internal/{index-Cz8HaIxu.js → index-CAadnKaJ.js} +1 -1
- package/dist/{browser/internal/index-CfgX2mMt.js → node/internal/index-CKwU8URS.js} +1 -1
- package/dist/node/internal/{index-BWW7KbVk.js → index-CkYTa7KK.js} +1 -1
- package/dist/{browser/internal/index-EdTViyyq.js → node/internal/index-DphjSNet.js} +1 -1
- package/dist/node/internal/object-BLNJYMtQ.js +20 -0
- package/dist/node/internal/{object-BDRv-l-h.js → object-BsCssWq4.js} +622 -608
- package/dist/node/src/document/types.d.ts +2 -0
- package/dist/node/src/document/utils/base.d.ts +7 -2
- package/dist/node/src/document/utils/file.d.ts +3 -2
- package/package.json +3 -5
- package/dist/browser/internal/object-BkewFVld.js +0 -25
- package/dist/node/internal/object-Br6jYeW0.js +0 -20
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Qt = (e, t, i) => t in e ?
|
|
1
|
+
var Gt = Object.defineProperty;
|
|
2
|
+
var Qt = (e, t, i) => t in e ? Gt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
3
|
var nt = (e, t, i) => (Qt(e, typeof t != "symbol" ? t + "" : t, i), i);
|
|
4
|
-
import { produce as
|
|
5
|
-
import { z as
|
|
4
|
+
import { produce as G, castDraft as pt, castImmutable as Xt, freeze as Yt } from "immer";
|
|
5
|
+
import { z as u } from "zod";
|
|
6
6
|
import te from "crypto";
|
|
7
7
|
import ct from "fs";
|
|
8
8
|
import ee from "https";
|
|
9
9
|
import { join as ie } from "path";
|
|
10
10
|
import St from "jszip";
|
|
11
|
-
const
|
|
11
|
+
const $t = (e) => e != null, ne = u.any().refine((e) => $t(e)), Et = u.enum(["LOAD_STATE"]), vt = u.enum(["PRUNE"]), Tt = u.enum(["REDO"]), kt = u.enum(["SET_NAME"]), _t = u.enum(["UNDO"]);
|
|
12
12
|
function oe() {
|
|
13
|
-
return
|
|
14
|
-
__typename:
|
|
15
|
-
type:
|
|
13
|
+
return u.object({
|
|
14
|
+
__typename: u.literal("Action").optional(),
|
|
15
|
+
type: u.string()
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
function Q() {
|
|
19
|
-
return
|
|
19
|
+
return u.literal("global").or(u.literal("local"));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
Dt(),
|
|
21
|
+
function At() {
|
|
22
|
+
return u.union([
|
|
23
|
+
Nt(),
|
|
25
24
|
Mt(),
|
|
26
25
|
Pt(),
|
|
27
|
-
It()
|
|
26
|
+
It(),
|
|
27
|
+
zt()
|
|
28
28
|
]);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
32
|
-
__typename:
|
|
33
|
-
data:
|
|
34
|
-
extension:
|
|
35
|
-
fileName:
|
|
36
|
-
mimeType:
|
|
30
|
+
function se() {
|
|
31
|
+
return u.object({
|
|
32
|
+
__typename: u.literal("DocumentFile").optional(),
|
|
33
|
+
data: u.string(),
|
|
34
|
+
extension: u.string().nullable(),
|
|
35
|
+
fileName: u.string().nullable(),
|
|
36
|
+
mimeType: u.string()
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
41
|
-
input:
|
|
42
|
-
type:
|
|
39
|
+
function Nt() {
|
|
40
|
+
return u.object({
|
|
41
|
+
input: u.lazy(() => ut()),
|
|
42
|
+
type: Et,
|
|
43
43
|
scope: Q()
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
function ut() {
|
|
47
|
-
return
|
|
48
|
-
operations:
|
|
49
|
-
state:
|
|
47
|
+
return u.object({
|
|
48
|
+
operations: u.number(),
|
|
49
|
+
state: u.lazy(() => Dt())
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
54
|
-
data:
|
|
55
|
-
name:
|
|
52
|
+
function Dt() {
|
|
53
|
+
return u.object({
|
|
54
|
+
data: u.unknown().nullish(),
|
|
55
|
+
name: u.string()
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
60
|
-
__typename:
|
|
61
|
-
hash:
|
|
62
|
-
index:
|
|
63
|
-
timestamp:
|
|
64
|
-
type:
|
|
58
|
+
function re() {
|
|
59
|
+
return u.object({
|
|
60
|
+
__typename: u.literal("Operation").optional(),
|
|
61
|
+
hash: u.string(),
|
|
62
|
+
index: u.number(),
|
|
63
|
+
timestamp: u.string().datetime(),
|
|
64
|
+
type: u.string()
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
69
|
-
input:
|
|
70
|
-
type:
|
|
67
|
+
function Mt() {
|
|
68
|
+
return u.object({
|
|
69
|
+
input: u.lazy(() => ft()),
|
|
70
|
+
type: vt,
|
|
71
71
|
scope: Q()
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
function ft() {
|
|
75
|
-
return
|
|
76
|
-
end:
|
|
77
|
-
start:
|
|
75
|
+
return u.object({
|
|
76
|
+
end: u.number().nullish(),
|
|
77
|
+
start: u.number().nullish()
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
const dt =
|
|
81
|
-
function
|
|
82
|
-
return
|
|
80
|
+
const dt = u.number;
|
|
81
|
+
function Pt() {
|
|
82
|
+
return u.object({
|
|
83
83
|
input: dt(),
|
|
84
|
-
type:
|
|
84
|
+
type: Tt,
|
|
85
85
|
scope: Q()
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
const gt =
|
|
89
|
-
function
|
|
90
|
-
return
|
|
88
|
+
const gt = u.string;
|
|
89
|
+
function It() {
|
|
90
|
+
return u.object({
|
|
91
91
|
input: gt(),
|
|
92
|
-
type:
|
|
93
|
-
scope:
|
|
92
|
+
type: kt,
|
|
93
|
+
scope: u.literal("global")
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
function ae() {
|
|
97
|
-
return
|
|
98
|
-
__typename:
|
|
99
|
-
hash:
|
|
100
|
-
index:
|
|
101
|
-
input:
|
|
102
|
-
timestamp:
|
|
103
|
-
type:
|
|
97
|
+
return u.object({
|
|
98
|
+
__typename: u.literal("SetNameOperation").optional(),
|
|
99
|
+
hash: u.string(),
|
|
100
|
+
index: u.number(),
|
|
101
|
+
input: u.string(),
|
|
102
|
+
timestamp: u.string().datetime(),
|
|
103
|
+
type: u.string()
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
const ht =
|
|
107
|
-
function
|
|
108
|
-
return
|
|
106
|
+
const ht = u.number;
|
|
107
|
+
function zt() {
|
|
108
|
+
return u.object({
|
|
109
109
|
input: ht(),
|
|
110
110
|
type: _t,
|
|
111
111
|
scope: Q()
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
115
115
|
__proto__: null,
|
|
116
116
|
ActionSchema: oe,
|
|
117
|
-
BaseActionSchema:
|
|
118
|
-
DocumentFileSchema:
|
|
117
|
+
BaseActionSchema: At,
|
|
118
|
+
DocumentFileSchema: se,
|
|
119
119
|
LoadStateActionInputSchema: ut,
|
|
120
|
-
LoadStateActionSchema:
|
|
121
|
-
LoadStateActionStateInputSchema:
|
|
122
|
-
Load_StateSchema:
|
|
123
|
-
OperationSchema:
|
|
120
|
+
LoadStateActionSchema: Nt,
|
|
121
|
+
LoadStateActionStateInputSchema: Dt,
|
|
122
|
+
Load_StateSchema: Et,
|
|
123
|
+
OperationSchema: re,
|
|
124
124
|
OperationScopeSchema: Q,
|
|
125
125
|
PruneActionInputSchema: ft,
|
|
126
|
-
PruneActionSchema:
|
|
127
|
-
PruneSchema:
|
|
126
|
+
PruneActionSchema: Mt,
|
|
127
|
+
PruneSchema: vt,
|
|
128
128
|
RedoActionInputSchema: dt,
|
|
129
|
-
RedoActionSchema:
|
|
130
|
-
RedoSchema:
|
|
129
|
+
RedoActionSchema: Pt,
|
|
130
|
+
RedoSchema: Tt,
|
|
131
131
|
SetNameActionInputSchema: gt,
|
|
132
|
-
SetNameActionSchema:
|
|
132
|
+
SetNameActionSchema: It,
|
|
133
133
|
SetNameOperationSchema: ae,
|
|
134
|
-
Set_NameSchema:
|
|
134
|
+
Set_NameSchema: kt,
|
|
135
135
|
UndoActionInputSchema: ht,
|
|
136
|
-
UndoActionSchema:
|
|
136
|
+
UndoActionSchema: zt,
|
|
137
137
|
UndoSchema: _t,
|
|
138
138
|
definedNonNullAnySchema: ne,
|
|
139
|
-
isDefinedNonNullAny:
|
|
139
|
+
isDefinedNonNullAny: $t
|
|
140
140
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
141
141
|
function pe(e) {
|
|
142
142
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
143
143
|
}
|
|
144
144
|
var lt = { exports: {} };
|
|
145
145
|
(function(e, t) {
|
|
146
|
-
const { hasOwnProperty: i } = Object.prototype, n =
|
|
147
|
-
n.configure =
|
|
148
|
-
const
|
|
149
|
-
function
|
|
150
|
-
return
|
|
146
|
+
const { hasOwnProperty: i } = Object.prototype, n = A();
|
|
147
|
+
n.configure = A, n.stringify = n, n.default = n, t.stringify = n, t.configure = A, e.exports = n;
|
|
148
|
+
const a = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
|
|
149
|
+
function p(r) {
|
|
150
|
+
return r.length < 5e3 && !a.test(r) ? `"${r}"` : JSON.stringify(r);
|
|
151
151
|
}
|
|
152
|
-
function r
|
|
153
|
-
if (
|
|
154
|
-
return
|
|
155
|
-
for (let
|
|
156
|
-
const
|
|
157
|
-
let D =
|
|
158
|
-
for (; D !== 0 &&
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
function s(r) {
|
|
153
|
+
if (r.length > 200)
|
|
154
|
+
return r.sort();
|
|
155
|
+
for (let m = 1; m < r.length; m++) {
|
|
156
|
+
const b = r[m];
|
|
157
|
+
let D = m;
|
|
158
|
+
for (; D !== 0 && r[D - 1] > b; )
|
|
159
|
+
r[D] = r[D - 1], D--;
|
|
160
|
+
r[D] = b;
|
|
161
161
|
}
|
|
162
|
-
return
|
|
162
|
+
return r;
|
|
163
163
|
}
|
|
164
|
-
const
|
|
164
|
+
const l = Object.getOwnPropertyDescriptor(
|
|
165
165
|
Object.getPrototypeOf(
|
|
166
166
|
Object.getPrototypeOf(
|
|
167
167
|
new Int8Array()
|
|
@@ -169,25 +169,25 @@ var lt = { exports: {} };
|
|
|
169
169
|
),
|
|
170
170
|
Symbol.toStringTag
|
|
171
171
|
).get;
|
|
172
|
-
function
|
|
173
|
-
return
|
|
172
|
+
function c(r) {
|
|
173
|
+
return l.call(r) !== void 0 && r.length !== 0;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
177
|
-
const D =
|
|
178
|
-
let
|
|
179
|
-
for (let
|
|
180
|
-
|
|
181
|
-
return
|
|
175
|
+
function x(r, m, b) {
|
|
176
|
+
r.length < b && (b = r.length);
|
|
177
|
+
const D = m === "," ? "" : " ";
|
|
178
|
+
let U = `"0":${D}${r[0]}`;
|
|
179
|
+
for (let R = 1; R < b; R++)
|
|
180
|
+
U += `${m}"${R}":${D}${r[R]}`;
|
|
181
|
+
return U;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
if (i.call(
|
|
185
|
-
const
|
|
186
|
-
if (typeof
|
|
187
|
-
return `"${
|
|
188
|
-
if (
|
|
189
|
-
return
|
|
190
|
-
if (
|
|
183
|
+
function j(r) {
|
|
184
|
+
if (i.call(r, "circularValue")) {
|
|
185
|
+
const m = r.circularValue;
|
|
186
|
+
if (typeof m == "string")
|
|
187
|
+
return `"${m}"`;
|
|
188
|
+
if (m == null)
|
|
189
|
+
return m;
|
|
190
|
+
if (m === Error || m === TypeError)
|
|
191
191
|
return {
|
|
192
192
|
toString() {
|
|
193
193
|
throw new TypeError("Converting circular structure to JSON");
|
|
@@ -197,168 +197,168 @@ var lt = { exports: {} };
|
|
|
197
197
|
}
|
|
198
198
|
return '"[Circular]"';
|
|
199
199
|
}
|
|
200
|
-
function
|
|
201
|
-
let
|
|
202
|
-
if (i.call(
|
|
203
|
-
throw new TypeError(`The "${
|
|
204
|
-
return
|
|
200
|
+
function E(r, m) {
|
|
201
|
+
let b;
|
|
202
|
+
if (i.call(r, m) && (b = r[m], typeof b != "boolean"))
|
|
203
|
+
throw new TypeError(`The "${m}" argument must be of type boolean`);
|
|
204
|
+
return b === void 0 ? !0 : b;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
207
|
-
let
|
|
208
|
-
if (i.call(
|
|
209
|
-
if (
|
|
210
|
-
throw new TypeError(`The "${
|
|
211
|
-
if (!Number.isInteger(
|
|
212
|
-
throw new TypeError(`The "${
|
|
213
|
-
if (
|
|
214
|
-
throw new RangeError(`The "${
|
|
206
|
+
function g(r, m) {
|
|
207
|
+
let b;
|
|
208
|
+
if (i.call(r, m)) {
|
|
209
|
+
if (b = r[m], typeof b != "number")
|
|
210
|
+
throw new TypeError(`The "${m}" argument must be of type number`);
|
|
211
|
+
if (!Number.isInteger(b))
|
|
212
|
+
throw new TypeError(`The "${m}" argument must be an integer`);
|
|
213
|
+
if (b < 1)
|
|
214
|
+
throw new RangeError(`The "${m}" argument must be >= 1`);
|
|
215
215
|
}
|
|
216
|
-
return
|
|
216
|
+
return b === void 0 ? 1 / 0 : b;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
return
|
|
218
|
+
function S(r) {
|
|
219
|
+
return r === 1 ? "1 item" : `${r} items`;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
const
|
|
223
|
-
for (const
|
|
224
|
-
(typeof
|
|
225
|
-
return
|
|
221
|
+
function F(r) {
|
|
222
|
+
const m = /* @__PURE__ */ new Set();
|
|
223
|
+
for (const b of r)
|
|
224
|
+
(typeof b == "string" || typeof b == "number") && m.add(String(b));
|
|
225
|
+
return m;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
if (i.call(
|
|
229
|
-
const
|
|
230
|
-
if (typeof
|
|
227
|
+
function _(r) {
|
|
228
|
+
if (i.call(r, "strict")) {
|
|
229
|
+
const m = r.strict;
|
|
230
|
+
if (typeof m != "boolean")
|
|
231
231
|
throw new TypeError('The "strict" argument must be of type boolean');
|
|
232
|
-
if (
|
|
233
|
-
return (
|
|
234
|
-
let D = `Object can not safely be stringified. Received type ${typeof
|
|
235
|
-
throw typeof
|
|
232
|
+
if (m)
|
|
233
|
+
return (b) => {
|
|
234
|
+
let D = `Object can not safely be stringified. Received type ${typeof b}`;
|
|
235
|
+
throw typeof b != "function" && (D += ` (${b.toString()})`), new Error(D);
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
function tt(
|
|
245
|
-
let
|
|
246
|
-
switch (typeof
|
|
239
|
+
function A(r) {
|
|
240
|
+
r = { ...r };
|
|
241
|
+
const m = _(r);
|
|
242
|
+
m && (r.bigint === void 0 && (r.bigint = !1), "circularValue" in r || (r.circularValue = Error));
|
|
243
|
+
const b = j(r), D = E(r, "bigint"), U = E(r, "deterministic"), R = g(r, "maximumDepth"), T = g(r, "maximumBreadth");
|
|
244
|
+
function tt(P, o, f, y, h, O) {
|
|
245
|
+
let d = o[P];
|
|
246
|
+
switch (typeof d == "object" && d !== null && typeof d.toJSON == "function" && (d = d.toJSON(P)), d = y.call(o, P, d), typeof d) {
|
|
247
247
|
case "string":
|
|
248
|
-
return
|
|
248
|
+
return p(d);
|
|
249
249
|
case "object": {
|
|
250
|
-
if (
|
|
250
|
+
if (d === null)
|
|
251
251
|
return "null";
|
|
252
|
-
if (
|
|
253
|
-
return
|
|
252
|
+
if (f.indexOf(d) !== -1)
|
|
253
|
+
return b;
|
|
254
254
|
let w = "", v = ",";
|
|
255
|
-
const
|
|
256
|
-
if (Array.isArray(
|
|
257
|
-
if (
|
|
255
|
+
const k = O;
|
|
256
|
+
if (Array.isArray(d)) {
|
|
257
|
+
if (d.length === 0)
|
|
258
258
|
return "[]";
|
|
259
|
-
if (
|
|
259
|
+
if (R < f.length + 1)
|
|
260
260
|
return '"[Array]"';
|
|
261
|
-
|
|
261
|
+
f.push(d), h !== "" && (O += h, w += `
|
|
262
262
|
${O}`, v = `,
|
|
263
263
|
${O}`);
|
|
264
|
-
const
|
|
265
|
-
let
|
|
266
|
-
for (;
|
|
267
|
-
const it = tt(String(
|
|
264
|
+
const z = Math.min(d.length, T);
|
|
265
|
+
let C = 0;
|
|
266
|
+
for (; C < z - 1; C++) {
|
|
267
|
+
const it = tt(String(C), d, f, y, h, O);
|
|
268
268
|
w += it !== void 0 ? it : "null", w += v;
|
|
269
269
|
}
|
|
270
|
-
const
|
|
271
|
-
if (w +=
|
|
272
|
-
const it =
|
|
273
|
-
w += `${v}"... ${
|
|
270
|
+
const J = tt(String(C), d, f, y, h, O);
|
|
271
|
+
if (w += J !== void 0 ? J : "null", d.length - 1 > T) {
|
|
272
|
+
const it = d.length - T - 1;
|
|
273
|
+
w += `${v}"... ${S(it)} not stringified"`;
|
|
274
274
|
}
|
|
275
|
-
return
|
|
276
|
-
${
|
|
275
|
+
return h !== "" && (w += `
|
|
276
|
+
${k}`), f.pop(), `[${w}]`;
|
|
277
277
|
}
|
|
278
|
-
let
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
278
|
+
let N = Object.keys(d);
|
|
279
|
+
const M = N.length;
|
|
280
|
+
if (M === 0)
|
|
281
281
|
return "{}";
|
|
282
|
-
if (
|
|
282
|
+
if (R < f.length + 1)
|
|
283
283
|
return '"[Object]"';
|
|
284
|
-
let
|
|
285
|
-
|
|
286
|
-
${O}`,
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
for (let
|
|
290
|
-
const
|
|
291
|
-
|
|
284
|
+
let $ = "", I = "";
|
|
285
|
+
h !== "" && (O += h, v = `,
|
|
286
|
+
${O}`, $ = " ");
|
|
287
|
+
const q = Math.min(M, T);
|
|
288
|
+
U && !c(d) && (N = s(N)), f.push(d);
|
|
289
|
+
for (let z = 0; z < q; z++) {
|
|
290
|
+
const C = N[z], J = tt(C, d, f, y, h, O);
|
|
291
|
+
J !== void 0 && (w += `${I}${p(C)}:${$}${J}`, I = v);
|
|
292
292
|
}
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
w += `${
|
|
293
|
+
if (M > T) {
|
|
294
|
+
const z = M - T;
|
|
295
|
+
w += `${I}"...":${$}"${S(z)} not stringified"`, I = v;
|
|
296
296
|
}
|
|
297
|
-
return
|
|
297
|
+
return h !== "" && I.length > 1 && (w = `
|
|
298
298
|
${O}${w}
|
|
299
|
-
${
|
|
299
|
+
${k}`), f.pop(), `{${w}}`;
|
|
300
300
|
}
|
|
301
301
|
case "number":
|
|
302
|
-
return isFinite(
|
|
302
|
+
return isFinite(d) ? String(d) : m ? m(d) : "null";
|
|
303
303
|
case "boolean":
|
|
304
|
-
return
|
|
304
|
+
return d === !0 ? "true" : "false";
|
|
305
305
|
case "undefined":
|
|
306
306
|
return;
|
|
307
307
|
case "bigint":
|
|
308
308
|
if (D)
|
|
309
|
-
return String(
|
|
309
|
+
return String(d);
|
|
310
310
|
default:
|
|
311
|
-
return
|
|
311
|
+
return m ? m(d) : void 0;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
function et(
|
|
315
|
-
switch (typeof o == "object" && o !== null && typeof o.toJSON == "function" && (o = o.toJSON(
|
|
314
|
+
function et(P, o, f, y, h, O) {
|
|
315
|
+
switch (typeof o == "object" && o !== null && typeof o.toJSON == "function" && (o = o.toJSON(P)), typeof o) {
|
|
316
316
|
case "string":
|
|
317
|
-
return
|
|
317
|
+
return p(o);
|
|
318
318
|
case "object": {
|
|
319
319
|
if (o === null)
|
|
320
320
|
return "null";
|
|
321
|
-
if (
|
|
322
|
-
return
|
|
323
|
-
const
|
|
321
|
+
if (f.indexOf(o) !== -1)
|
|
322
|
+
return b;
|
|
323
|
+
const d = O;
|
|
324
324
|
let w = "", v = ",";
|
|
325
325
|
if (Array.isArray(o)) {
|
|
326
326
|
if (o.length === 0)
|
|
327
327
|
return "[]";
|
|
328
|
-
if (
|
|
328
|
+
if (R < f.length + 1)
|
|
329
329
|
return '"[Array]"';
|
|
330
|
-
|
|
330
|
+
f.push(o), h !== "" && (O += h, w += `
|
|
331
331
|
${O}`, v = `,
|
|
332
332
|
${O}`);
|
|
333
|
-
const
|
|
334
|
-
let
|
|
335
|
-
for (;
|
|
336
|
-
const
|
|
337
|
-
w +=
|
|
333
|
+
const M = Math.min(o.length, T);
|
|
334
|
+
let $ = 0;
|
|
335
|
+
for (; $ < M - 1; $++) {
|
|
336
|
+
const q = et(String($), o[$], f, y, h, O);
|
|
337
|
+
w += q !== void 0 ? q : "null", w += v;
|
|
338
338
|
}
|
|
339
|
-
const
|
|
340
|
-
if (w +=
|
|
341
|
-
const
|
|
342
|
-
w += `${v}"... ${
|
|
339
|
+
const I = et(String($), o[$], f, y, h, O);
|
|
340
|
+
if (w += I !== void 0 ? I : "null", o.length - 1 > T) {
|
|
341
|
+
const q = o.length - T - 1;
|
|
342
|
+
w += `${v}"... ${S(q)} not stringified"`;
|
|
343
343
|
}
|
|
344
|
-
return
|
|
345
|
-
${
|
|
344
|
+
return h !== "" && (w += `
|
|
345
|
+
${d}`), f.pop(), `[${w}]`;
|
|
346
346
|
}
|
|
347
|
-
|
|
348
|
-
let _ = "";
|
|
349
|
-
x !== "" && (O += x, v = `,
|
|
350
|
-
${O}`, _ = " ");
|
|
347
|
+
f.push(o);
|
|
351
348
|
let k = "";
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
349
|
+
h !== "" && (O += h, v = `,
|
|
350
|
+
${O}`, k = " ");
|
|
351
|
+
let N = "";
|
|
352
|
+
for (const M of y) {
|
|
353
|
+
const $ = et(M, o[M], f, y, h, O);
|
|
354
|
+
$ !== void 0 && (w += `${N}${p(M)}:${k}${$}`, N = v);
|
|
355
355
|
}
|
|
356
|
-
return
|
|
356
|
+
return h !== "" && N.length > 1 && (w = `
|
|
357
357
|
${O}${w}
|
|
358
|
-
${
|
|
358
|
+
${d}`), f.pop(), `{${w}}`;
|
|
359
359
|
}
|
|
360
360
|
case "number":
|
|
361
|
-
return isFinite(o) ? String(o) :
|
|
361
|
+
return isFinite(o) ? String(o) : m ? m(o) : "null";
|
|
362
362
|
case "boolean":
|
|
363
363
|
return o === !0 ? "true" : "false";
|
|
364
364
|
case "undefined":
|
|
@@ -367,73 +367,73 @@ ${g}`), u.pop(), `{${w}}`;
|
|
|
367
367
|
if (D)
|
|
368
368
|
return String(o);
|
|
369
369
|
default:
|
|
370
|
-
return
|
|
370
|
+
return m ? m(o) : void 0;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
function
|
|
373
|
+
function W(P, o, f, y, h) {
|
|
374
374
|
switch (typeof o) {
|
|
375
375
|
case "string":
|
|
376
|
-
return
|
|
376
|
+
return p(o);
|
|
377
377
|
case "object": {
|
|
378
378
|
if (o === null)
|
|
379
379
|
return "null";
|
|
380
380
|
if (typeof o.toJSON == "function") {
|
|
381
|
-
if (o = o.toJSON(
|
|
382
|
-
return
|
|
381
|
+
if (o = o.toJSON(P), typeof o != "object")
|
|
382
|
+
return W(P, o, f, y, h);
|
|
383
383
|
if (o === null)
|
|
384
384
|
return "null";
|
|
385
385
|
}
|
|
386
|
-
if (
|
|
387
|
-
return
|
|
388
|
-
const O =
|
|
386
|
+
if (f.indexOf(o) !== -1)
|
|
387
|
+
return b;
|
|
388
|
+
const O = h;
|
|
389
389
|
if (Array.isArray(o)) {
|
|
390
390
|
if (o.length === 0)
|
|
391
391
|
return "[]";
|
|
392
|
-
if (
|
|
392
|
+
if (R < f.length + 1)
|
|
393
393
|
return '"[Array]"';
|
|
394
|
-
|
|
395
|
-
let
|
|
396
|
-
${
|
|
397
|
-
const
|
|
398
|
-
${
|
|
399
|
-
let
|
|
400
|
-
for (;
|
|
401
|
-
const
|
|
402
|
-
|
|
394
|
+
f.push(o), h += y;
|
|
395
|
+
let $ = `
|
|
396
|
+
${h}`;
|
|
397
|
+
const I = `,
|
|
398
|
+
${h}`, q = Math.min(o.length, T);
|
|
399
|
+
let z = 0;
|
|
400
|
+
for (; z < q - 1; z++) {
|
|
401
|
+
const J = W(String(z), o[z], f, y, h);
|
|
402
|
+
$ += J !== void 0 ? J : "null", $ += I;
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
const
|
|
407
|
-
|
|
404
|
+
const C = W(String(z), o[z], f, y, h);
|
|
405
|
+
if ($ += C !== void 0 ? C : "null", o.length - 1 > T) {
|
|
406
|
+
const J = o.length - T - 1;
|
|
407
|
+
$ += `${I}"... ${S(J)} not stringified"`;
|
|
408
408
|
}
|
|
409
|
-
return
|
|
410
|
-
${O}`,
|
|
409
|
+
return $ += `
|
|
410
|
+
${O}`, f.pop(), `[${$}]`;
|
|
411
411
|
}
|
|
412
|
-
let
|
|
413
|
-
const w =
|
|
412
|
+
let d = Object.keys(o);
|
|
413
|
+
const w = d.length;
|
|
414
414
|
if (w === 0)
|
|
415
415
|
return "{}";
|
|
416
|
-
if (
|
|
416
|
+
if (R < f.length + 1)
|
|
417
417
|
return '"[Object]"';
|
|
418
|
-
|
|
418
|
+
h += y;
|
|
419
419
|
const v = `,
|
|
420
|
-
${
|
|
421
|
-
let
|
|
422
|
-
|
|
423
|
-
for (let
|
|
424
|
-
const
|
|
425
|
-
|
|
420
|
+
${h}`;
|
|
421
|
+
let k = "", N = "", M = Math.min(w, T);
|
|
422
|
+
c(o) && (k += x(o, v, T), d = d.slice(o.length), M -= o.length, N = v), U && (d = s(d)), f.push(o);
|
|
423
|
+
for (let $ = 0; $ < M; $++) {
|
|
424
|
+
const I = d[$], q = W(I, o[I], f, y, h);
|
|
425
|
+
q !== void 0 && (k += `${N}${p(I)}: ${q}`, N = v);
|
|
426
426
|
}
|
|
427
427
|
if (w > T) {
|
|
428
|
-
const
|
|
429
|
-
|
|
428
|
+
const $ = w - T;
|
|
429
|
+
k += `${N}"...": "${S($)} not stringified"`, N = v;
|
|
430
430
|
}
|
|
431
|
-
return
|
|
432
|
-
${
|
|
433
|
-
${O}`),
|
|
431
|
+
return N !== "" && (k = `
|
|
432
|
+
${h}${k}
|
|
433
|
+
${O}`), f.pop(), `{${k}}`;
|
|
434
434
|
}
|
|
435
435
|
case "number":
|
|
436
|
-
return isFinite(o) ? String(o) :
|
|
436
|
+
return isFinite(o) ? String(o) : m ? m(o) : "null";
|
|
437
437
|
case "boolean":
|
|
438
438
|
return o === !0 ? "true" : "false";
|
|
439
439
|
case "undefined":
|
|
@@ -442,64 +442,64 @@ ${O}`), u.pop(), `{${_}}`;
|
|
|
442
442
|
if (D)
|
|
443
443
|
return String(o);
|
|
444
444
|
default:
|
|
445
|
-
return
|
|
445
|
+
return m ? m(o) : void 0;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function B(P, o, f) {
|
|
449
449
|
switch (typeof o) {
|
|
450
450
|
case "string":
|
|
451
|
-
return
|
|
451
|
+
return p(o);
|
|
452
452
|
case "object": {
|
|
453
453
|
if (o === null)
|
|
454
454
|
return "null";
|
|
455
455
|
if (typeof o.toJSON == "function") {
|
|
456
|
-
if (o = o.toJSON(
|
|
457
|
-
return
|
|
456
|
+
if (o = o.toJSON(P), typeof o != "object")
|
|
457
|
+
return B(P, o, f);
|
|
458
458
|
if (o === null)
|
|
459
459
|
return "null";
|
|
460
460
|
}
|
|
461
|
-
if (
|
|
462
|
-
return
|
|
461
|
+
if (f.indexOf(o) !== -1)
|
|
462
|
+
return b;
|
|
463
463
|
let y = "";
|
|
464
464
|
if (Array.isArray(o)) {
|
|
465
465
|
if (o.length === 0)
|
|
466
466
|
return "[]";
|
|
467
|
-
if (
|
|
467
|
+
if (R < f.length + 1)
|
|
468
468
|
return '"[Array]"';
|
|
469
|
-
|
|
469
|
+
f.push(o);
|
|
470
470
|
const v = Math.min(o.length, T);
|
|
471
|
-
let
|
|
472
|
-
for (;
|
|
473
|
-
const
|
|
474
|
-
y +=
|
|
471
|
+
let k = 0;
|
|
472
|
+
for (; k < v - 1; k++) {
|
|
473
|
+
const M = B(String(k), o[k], f);
|
|
474
|
+
y += M !== void 0 ? M : "null", y += ",";
|
|
475
475
|
}
|
|
476
|
-
const
|
|
477
|
-
if (y +=
|
|
478
|
-
const
|
|
479
|
-
y += `,"... ${
|
|
476
|
+
const N = B(String(k), o[k], f);
|
|
477
|
+
if (y += N !== void 0 ? N : "null", o.length - 1 > T) {
|
|
478
|
+
const M = o.length - T - 1;
|
|
479
|
+
y += `,"... ${S(M)} not stringified"`;
|
|
480
480
|
}
|
|
481
|
-
return
|
|
481
|
+
return f.pop(), `[${y}]`;
|
|
482
482
|
}
|
|
483
|
-
let
|
|
484
|
-
const O =
|
|
483
|
+
let h = Object.keys(o);
|
|
484
|
+
const O = h.length;
|
|
485
485
|
if (O === 0)
|
|
486
486
|
return "{}";
|
|
487
|
-
if (
|
|
487
|
+
if (R < f.length + 1)
|
|
488
488
|
return '"[Object]"';
|
|
489
|
-
let
|
|
490
|
-
|
|
489
|
+
let d = "", w = Math.min(O, T);
|
|
490
|
+
c(o) && (y += x(o, ",", T), h = h.slice(o.length), w -= o.length, d = ","), U && (h = s(h)), f.push(o);
|
|
491
491
|
for (let v = 0; v < w; v++) {
|
|
492
|
-
const
|
|
493
|
-
|
|
492
|
+
const k = h[v], N = B(k, o[k], f);
|
|
493
|
+
N !== void 0 && (y += `${d}${p(k)}:${N}`, d = ",");
|
|
494
494
|
}
|
|
495
495
|
if (O > T) {
|
|
496
496
|
const v = O - T;
|
|
497
|
-
y += `${
|
|
497
|
+
y += `${d}"...":"${S(v)} not stringified"`;
|
|
498
498
|
}
|
|
499
|
-
return
|
|
499
|
+
return f.pop(), `{${y}}`;
|
|
500
500
|
}
|
|
501
501
|
case "number":
|
|
502
|
-
return isFinite(o) ? String(o) :
|
|
502
|
+
return isFinite(o) ? String(o) : m ? m(o) : "null";
|
|
503
503
|
case "boolean":
|
|
504
504
|
return o === !0 ? "true" : "false";
|
|
505
505
|
case "undefined":
|
|
@@ -508,29 +508,29 @@ ${O}`), u.pop(), `{${_}}`;
|
|
|
508
508
|
if (D)
|
|
509
509
|
return String(o);
|
|
510
510
|
default:
|
|
511
|
-
return
|
|
511
|
+
return m ? m(o) : void 0;
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function Zt(P, o, f) {
|
|
515
515
|
if (arguments.length > 1) {
|
|
516
516
|
let y = "";
|
|
517
|
-
if (typeof
|
|
517
|
+
if (typeof f == "number" ? y = " ".repeat(Math.min(f, 10)) : typeof f == "string" && (y = f.slice(0, 10)), o != null) {
|
|
518
518
|
if (typeof o == "function")
|
|
519
|
-
return tt("", { "":
|
|
519
|
+
return tt("", { "": P }, [], o, y, "");
|
|
520
520
|
if (Array.isArray(o))
|
|
521
|
-
return et("",
|
|
521
|
+
return et("", P, [], F(o), y, "");
|
|
522
522
|
}
|
|
523
523
|
if (y.length !== 0)
|
|
524
|
-
return
|
|
524
|
+
return W("", P, [], y, "");
|
|
525
525
|
}
|
|
526
|
-
return
|
|
526
|
+
return B("", P, []);
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return Zt;
|
|
529
529
|
}
|
|
530
530
|
})(lt, lt.exports);
|
|
531
531
|
var ce = lt.exports;
|
|
532
|
-
const
|
|
533
|
-
|
|
532
|
+
const st = /* @__PURE__ */ pe(ce);
|
|
533
|
+
st.configure;
|
|
534
534
|
function le(e, t) {
|
|
535
535
|
return { ...e, name: t };
|
|
536
536
|
}
|
|
@@ -538,120 +538,120 @@ function me(e, t, i) {
|
|
|
538
538
|
const n = {
|
|
539
539
|
skip: i,
|
|
540
540
|
document: e
|
|
541
|
-
}, { scope:
|
|
542
|
-
return !
|
|
543
|
-
const [
|
|
544
|
-
t.skip && t.skip > 0 && (
|
|
541
|
+
}, { scope: a } = t;
|
|
542
|
+
return !a || t.skip === void 0 ? n : G(n, (p) => {
|
|
543
|
+
const [s] = p.document.operations[a].slice(-1);
|
|
544
|
+
t.skip && t.skip > 0 && (p.skip = t.skip), s.type === "NOOP" && t.index === s.index && p.skip > s.skip && p.document.operations[a].pop();
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
547
|
function ue(e, t, i) {
|
|
548
|
-
const { scope: n, input:
|
|
549
|
-
return
|
|
548
|
+
const { scope: n, input: a } = t;
|
|
549
|
+
return G({
|
|
550
550
|
document: e,
|
|
551
551
|
action: t,
|
|
552
552
|
skip: i
|
|
553
|
-
}, (
|
|
554
|
-
if (
|
|
553
|
+
}, (s) => {
|
|
554
|
+
if (s.document.operations[n].length < 1)
|
|
555
555
|
throw new Error(
|
|
556
556
|
`Cannot undo: no operations in history for scope "${n}"`
|
|
557
557
|
);
|
|
558
|
-
if (
|
|
558
|
+
if (a < 1)
|
|
559
559
|
throw new Error(
|
|
560
560
|
"Invalid UNDO action: input value must be greater than 0"
|
|
561
561
|
);
|
|
562
|
-
if (
|
|
562
|
+
if (s.skip > 0)
|
|
563
563
|
throw new Error(
|
|
564
564
|
"Cannot undo: skip value from reducer cannot be used with UNDO action"
|
|
565
565
|
);
|
|
566
|
-
const [
|
|
567
|
-
if (
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
|
|
566
|
+
const [l] = s.document.operations[n].slice(-1), c = l.type === "NOOP" && l.skip > 0;
|
|
567
|
+
if (s.skip += a, c) {
|
|
568
|
+
s.skip += l.skip;
|
|
569
|
+
const g = s.document.operations[n][s.document.operations[n].length - 2];
|
|
570
|
+
g && l.index - g.index === 1 && s.document.operations[n].pop();
|
|
571
571
|
}
|
|
572
|
-
if (
|
|
572
|
+
if (s.document.operations[n].length < s.skip)
|
|
573
573
|
throw new Error(
|
|
574
574
|
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
575
575
|
);
|
|
576
|
-
const
|
|
577
|
-
let
|
|
578
|
-
for (;
|
|
579
|
-
const
|
|
580
|
-
if (!
|
|
581
|
-
|
|
576
|
+
const x = s.document.operations[n].length - 1;
|
|
577
|
+
let j = a, E = c ? x - l.skip : x;
|
|
578
|
+
for (; j > 0 && E >= 0; ) {
|
|
579
|
+
const g = s.document.operations[n][E];
|
|
580
|
+
if (!g) {
|
|
581
|
+
j--, E--;
|
|
582
582
|
continue;
|
|
583
583
|
}
|
|
584
|
-
|
|
584
|
+
g.type === "NOOP" && g.skip > 0 ? (E = E - (g.skip + 1), s.skip += g.skip + 1) : (s.document.clipboard.push({ ...g }), j--, E--);
|
|
585
585
|
}
|
|
586
|
-
|
|
586
|
+
s.action = yt(n);
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
function fe(e, t, i) {
|
|
590
|
-
const { scope: n, input:
|
|
591
|
-
return
|
|
590
|
+
const { scope: n, input: a } = t;
|
|
591
|
+
return G({
|
|
592
592
|
document: e,
|
|
593
593
|
action: t,
|
|
594
594
|
skip: i
|
|
595
|
-
}, (
|
|
596
|
-
if (
|
|
595
|
+
}, (s) => {
|
|
596
|
+
if (s.skip > 0)
|
|
597
597
|
throw new Error(
|
|
598
598
|
"Cannot redo: skip value from reducer cannot be used with REDO action"
|
|
599
599
|
);
|
|
600
|
-
if (
|
|
600
|
+
if (a > 1)
|
|
601
601
|
throw new Error(
|
|
602
602
|
"Cannot redo: you can only redo one operation at a time"
|
|
603
603
|
);
|
|
604
|
-
if (
|
|
604
|
+
if (a < 1)
|
|
605
605
|
throw new Error("Invalid REDO action: invalid redo input value");
|
|
606
|
-
if (
|
|
606
|
+
if (s.document.clipboard.length < 1)
|
|
607
607
|
throw new Error("Cannot redo: no operations in the clipboard");
|
|
608
|
-
const
|
|
609
|
-
(
|
|
608
|
+
const l = s.document.clipboard.findLastIndex(
|
|
609
|
+
(x) => x.scope === n
|
|
610
610
|
);
|
|
611
|
-
if (
|
|
611
|
+
if (l < 0)
|
|
612
612
|
throw new Error(
|
|
613
613
|
`Cannot redo: no operations in clipboard for scope "${n}"`
|
|
614
614
|
);
|
|
615
|
-
const
|
|
616
|
-
|
|
617
|
-
type:
|
|
618
|
-
scope:
|
|
619
|
-
input:
|
|
615
|
+
const c = s.document.clipboard.splice(l, 1)[0];
|
|
616
|
+
s.action = pt({
|
|
617
|
+
type: c.type,
|
|
618
|
+
scope: c.scope,
|
|
619
|
+
input: c.input
|
|
620
620
|
});
|
|
621
621
|
});
|
|
622
622
|
}
|
|
623
623
|
function de(e, t, i) {
|
|
624
|
-
const { scope: n } = t,
|
|
624
|
+
const { scope: n } = t, a = e.operations[n];
|
|
625
625
|
let {
|
|
626
|
-
input: { start:
|
|
626
|
+
input: { start: p, end: s }
|
|
627
627
|
} = t;
|
|
628
|
-
|
|
629
|
-
const
|
|
628
|
+
p = p || 0, s = s || a.length;
|
|
629
|
+
const l = a.slice(p, s), c = a.slice(0, p), x = a.slice(s), j = mt(
|
|
630
630
|
e.initialState,
|
|
631
631
|
{
|
|
632
632
|
...e.operations,
|
|
633
|
-
[n]:
|
|
633
|
+
[n]: c.concat(l)
|
|
634
634
|
},
|
|
635
635
|
i
|
|
636
|
-
), { name:
|
|
636
|
+
), { name: E, state: g } = j, S = c.length, F = c.length ? c[c.length - 1].timestamp : x.length ? x[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
637
637
|
return mt(
|
|
638
638
|
e.initialState,
|
|
639
639
|
{
|
|
640
640
|
...e.operations,
|
|
641
641
|
[n]: [
|
|
642
|
-
...
|
|
642
|
+
...c,
|
|
643
643
|
{
|
|
644
|
-
...
|
|
645
|
-
{ name:
|
|
646
|
-
|
|
644
|
+
...bt(
|
|
645
|
+
{ name: E, state: g },
|
|
646
|
+
l.length
|
|
647
647
|
),
|
|
648
|
-
timestamp:
|
|
649
|
-
index:
|
|
650
|
-
hash:
|
|
648
|
+
timestamp: F,
|
|
649
|
+
index: S,
|
|
650
|
+
hash: xt({ state: g }, "global")
|
|
651
651
|
},
|
|
652
|
-
...
|
|
653
|
-
...
|
|
654
|
-
index:
|
|
652
|
+
...x.map((_, A) => ({
|
|
653
|
+
..._,
|
|
654
|
+
index: S + A + 1
|
|
655
655
|
}))
|
|
656
656
|
]
|
|
657
657
|
},
|
|
@@ -665,7 +665,7 @@ function ge(e, t) {
|
|
|
665
665
|
state: t.state ?? { global: {}, local: {} }
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
|
-
const
|
|
668
|
+
const Ft = "SET_NAME", X = "UNDO", Y = "REDO", rt = "PRUNE", Rt = "LOAD_STATE", he = "NOOP";
|
|
669
669
|
function xe(e, t) {
|
|
670
670
|
let i;
|
|
671
671
|
return "index" in t ? i = { ...t } : i = e.operations[t.scope].slice(-1)[0], ((i == null ? void 0 : i.index) ?? -1) + 1;
|
|
@@ -681,30 +681,30 @@ function be(e, t) {
|
|
|
681
681
|
};
|
|
682
682
|
}
|
|
683
683
|
function ye(e, t, i = 0) {
|
|
684
|
-
if ([X, Y,
|
|
684
|
+
if ([X, Y, rt].includes(t.type))
|
|
685
685
|
return e;
|
|
686
|
-
const { scope: n } = t,
|
|
686
|
+
const { scope: n } = t, a = e.operations[n].slice(
|
|
687
687
|
0,
|
|
688
688
|
e.revision[n]
|
|
689
|
-
),
|
|
690
|
-
let
|
|
689
|
+
), p = [...a].pop();
|
|
690
|
+
let s = ((p == null ? void 0 : p.index) ?? -1) + 1;
|
|
691
691
|
if ("index" in t) {
|
|
692
|
-
if (t.index >
|
|
692
|
+
if (t.index > s + i)
|
|
693
693
|
throw new Error(
|
|
694
|
-
`Missing operations: expected ${
|
|
694
|
+
`Missing operations: expected ${s} with skip 0 or equivalent, got index ${t.index} with skip ${i}`
|
|
695
695
|
);
|
|
696
|
-
|
|
696
|
+
s = t.index;
|
|
697
697
|
}
|
|
698
|
-
return
|
|
698
|
+
return a.push({
|
|
699
699
|
...t,
|
|
700
|
-
index:
|
|
700
|
+
index: s,
|
|
701
701
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
702
702
|
hash: "",
|
|
703
703
|
scope: n,
|
|
704
704
|
skip: i
|
|
705
705
|
}), {
|
|
706
706
|
...e,
|
|
707
|
-
operations: { ...e.operations, [n]:
|
|
707
|
+
operations: { ...e.operations, [n]: a }
|
|
708
708
|
};
|
|
709
709
|
}
|
|
710
710
|
function we(e, t, i = 0) {
|
|
@@ -712,18 +712,18 @@ function we(e, t, i = 0) {
|
|
|
712
712
|
return n = be(n, t), n;
|
|
713
713
|
}
|
|
714
714
|
function je(e, t, i) {
|
|
715
|
-
switch (
|
|
716
|
-
case
|
|
715
|
+
switch (At().parse(t), t.type) {
|
|
716
|
+
case Ft:
|
|
717
717
|
return le(e, t.input);
|
|
718
|
-
case
|
|
718
|
+
case rt:
|
|
719
719
|
return de(e, t, i);
|
|
720
|
-
case
|
|
720
|
+
case Rt:
|
|
721
721
|
return ge(e, t.input.state);
|
|
722
722
|
default:
|
|
723
723
|
return e;
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
function
|
|
726
|
+
function Oe(e, t, i) {
|
|
727
727
|
switch (t.type) {
|
|
728
728
|
case X:
|
|
729
729
|
return ue(e, t, i);
|
|
@@ -733,119 +733,122 @@ function Se(e, t, i) {
|
|
|
733
733
|
return { document: e, action: t, skip: i };
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
|
-
function
|
|
737
|
-
const { skip:
|
|
738
|
-
let
|
|
739
|
-
if (ve(
|
|
740
|
-
const { document:
|
|
741
|
-
|
|
736
|
+
function Lt(e, t, i, n, a = {}) {
|
|
737
|
+
const { skip: p, ignoreSkipOperations: s = !1, reuseHash: l = !1 } = a;
|
|
738
|
+
let c = { ...t }, x = p || 0, j = e, E = [...e.clipboard];
|
|
739
|
+
if (ve(c)) {
|
|
740
|
+
const { document: g, skip: S } = me(j, c, x);
|
|
741
|
+
x = S, j = g;
|
|
742
742
|
}
|
|
743
|
-
if (
|
|
743
|
+
if (wt(c)) {
|
|
744
744
|
const {
|
|
745
|
-
skip:
|
|
746
|
-
action:
|
|
747
|
-
document:
|
|
748
|
-
} =
|
|
749
|
-
|
|
745
|
+
skip: g,
|
|
746
|
+
action: S,
|
|
747
|
+
document: F
|
|
748
|
+
} = Oe(e, c, x);
|
|
749
|
+
c = S, x = g, j = F, E = [...j.clipboard];
|
|
750
750
|
}
|
|
751
|
-
if (
|
|
752
|
-
let
|
|
753
|
-
"index" in
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
)),
|
|
758
|
-
|
|
759
|
-
|
|
751
|
+
if (jt(c) && (j = je(j, c, i)), x > 0 && !s) {
|
|
752
|
+
let g = x;
|
|
753
|
+
"index" in c && (g = Ne(
|
|
754
|
+
j.operations[c.scope],
|
|
755
|
+
c.index,
|
|
756
|
+
x
|
|
757
|
+
)), j = mt(
|
|
758
|
+
j.initialState,
|
|
759
|
+
j.operations,
|
|
760
760
|
i,
|
|
761
761
|
void 0,
|
|
762
762
|
void 0,
|
|
763
763
|
void 0,
|
|
764
|
-
{ [
|
|
764
|
+
{ [c.scope]: g }
|
|
765
|
+
// TODO reuse hash?
|
|
765
766
|
);
|
|
766
767
|
}
|
|
767
|
-
return
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
return j = we(j, c, x), j = G(j, (g) => {
|
|
769
|
+
const S = i(
|
|
770
|
+
g.state,
|
|
771
|
+
c,
|
|
771
772
|
n
|
|
772
|
-
),
|
|
773
|
-
if (
|
|
773
|
+
), F = wt(t) ? [...E] : [];
|
|
774
|
+
if (S)
|
|
774
775
|
return pt({
|
|
775
|
-
...
|
|
776
|
-
clipboard: [
|
|
777
|
-
state:
|
|
776
|
+
...j,
|
|
777
|
+
clipboard: [...F],
|
|
778
|
+
state: S
|
|
778
779
|
});
|
|
779
|
-
|
|
780
|
-
}),
|
|
781
|
-
if ([X, Y,
|
|
782
|
-
return
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
780
|
+
g.clipboard = pt([...F]);
|
|
781
|
+
}), G(j, (g) => {
|
|
782
|
+
if ([X, Y, rt].includes(c.type))
|
|
783
|
+
return g;
|
|
784
|
+
const S = c.scope || "global";
|
|
785
|
+
console.time("hash");
|
|
786
|
+
const F = l && Object.prototype.hasOwnProperty.call(c, "hash") ? c.hash : xt(g, S);
|
|
787
|
+
console.timeEnd("hash"), g.operations[S][g.operations[S].length - 1].hash = F, !jt(c) && c.attachments && c.attachments.forEach((_) => {
|
|
788
|
+
const { hash: A, ...r } = _;
|
|
789
|
+
g.attachments[A] = {
|
|
790
|
+
...r
|
|
788
791
|
};
|
|
789
792
|
});
|
|
790
793
|
});
|
|
791
794
|
}
|
|
792
|
-
function
|
|
795
|
+
function Se(e, t, i) {
|
|
793
796
|
const n = ie(e, t);
|
|
794
|
-
return ct.mkdirSync(e, { recursive: !0 }), new Promise((
|
|
797
|
+
return ct.mkdirSync(e, { recursive: !0 }), new Promise((a, p) => {
|
|
795
798
|
try {
|
|
796
|
-
ct.writeFile(n, i, {}, (
|
|
797
|
-
|
|
799
|
+
ct.writeFile(n, i, {}, (s) => {
|
|
800
|
+
s ? p(s) : a(n);
|
|
798
801
|
});
|
|
799
|
-
} catch (
|
|
800
|
-
|
|
802
|
+
} catch (s) {
|
|
803
|
+
p(s);
|
|
801
804
|
}
|
|
802
805
|
});
|
|
803
806
|
}
|
|
804
|
-
function
|
|
807
|
+
function qt(e) {
|
|
805
808
|
return ct.readFileSync(e);
|
|
806
809
|
}
|
|
807
810
|
function $e(e) {
|
|
808
811
|
return new Promise((t, i) => {
|
|
809
812
|
ee.get(e, (n) => {
|
|
810
|
-
const
|
|
811
|
-
n.on("data", (
|
|
812
|
-
|
|
813
|
+
const a = [], p = n.headers["content-type"];
|
|
814
|
+
n.on("data", (s) => {
|
|
815
|
+
a.push(s);
|
|
813
816
|
}), n.on("end", () => {
|
|
814
|
-
t({ buffer: Buffer.concat(
|
|
817
|
+
t({ buffer: Buffer.concat(a), mimeType: p });
|
|
815
818
|
});
|
|
816
819
|
}).on("error", (n) => {
|
|
817
820
|
i(n);
|
|
818
821
|
});
|
|
819
822
|
});
|
|
820
823
|
}
|
|
821
|
-
const Ee = async (e) =>
|
|
824
|
+
const Ee = async (e) => qt(e), at = (e, t = "sha1") => te.createHash(t).update(e).digest("base64");
|
|
822
825
|
function ve(e) {
|
|
823
826
|
return e.type === he && e.skip !== void 0 && e.skip > 0 && e.hash !== void 0;
|
|
824
827
|
}
|
|
825
|
-
function
|
|
828
|
+
function wt(e) {
|
|
826
829
|
return [X, Y].includes(e.type);
|
|
827
830
|
}
|
|
828
|
-
function
|
|
829
|
-
return [
|
|
831
|
+
function jt(e) {
|
|
832
|
+
return [Ft, X, Y, rt, Rt].includes(e.type);
|
|
830
833
|
}
|
|
831
|
-
function
|
|
834
|
+
function H(e, t, i, n, a = "global") {
|
|
832
835
|
if (!e)
|
|
833
836
|
throw new Error("Empty action type");
|
|
834
837
|
if (typeof e != "string")
|
|
835
|
-
throw new Error(`Invalid action type: ${e}`);
|
|
836
|
-
const
|
|
837
|
-
i && (
|
|
838
|
+
throw new Error(`Invalid action type: ${JSON.stringify(e)}`);
|
|
839
|
+
const p = { type: e, input: t, scope: a };
|
|
840
|
+
i && (p.attachments = i);
|
|
838
841
|
try {
|
|
839
|
-
n == null || n().parse(
|
|
840
|
-
} catch (
|
|
841
|
-
throw new Error(`Invalid action input: ${
|
|
842
|
+
n == null || n().parse(p.input);
|
|
843
|
+
} catch (s) {
|
|
844
|
+
throw new Error(`Invalid action input: ${s}`);
|
|
842
845
|
}
|
|
843
|
-
return
|
|
846
|
+
return p;
|
|
844
847
|
}
|
|
845
|
-
function Te(e, t =
|
|
846
|
-
return (i, n,
|
|
848
|
+
function Te(e, t = Lt) {
|
|
849
|
+
return (i, n, a, p) => t(i, n, e, a, p);
|
|
847
850
|
}
|
|
848
|
-
const
|
|
851
|
+
const ke = (e, t) => ({
|
|
849
852
|
name: "",
|
|
850
853
|
documentType: "",
|
|
851
854
|
revision: {
|
|
@@ -857,8 +860,8 @@ const _e = (e, t) => ({
|
|
|
857
860
|
attachments: {},
|
|
858
861
|
...e,
|
|
859
862
|
state: (t == null ? void 0 : t(e == null ? void 0 : e.state)) ?? (e == null ? void 0 : e.state) ?? { global: {}, local: {} }
|
|
860
|
-
}),
|
|
861
|
-
const i =
|
|
863
|
+
}), _e = (e, t) => {
|
|
864
|
+
const i = ke(
|
|
862
865
|
e,
|
|
863
866
|
t
|
|
864
867
|
);
|
|
@@ -868,7 +871,7 @@ const _e = (e, t) => ({
|
|
|
868
871
|
operations: { global: [], local: [] },
|
|
869
872
|
clipboard: []
|
|
870
873
|
};
|
|
871
|
-
},
|
|
874
|
+
}, xt = (e, t = "global") => at(st(e.state[t] || "")), Be = (e, t = 1e3) => {
|
|
872
875
|
const i = Math.random() * t;
|
|
873
876
|
return at(`${(e ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
|
|
874
877
|
};
|
|
@@ -877,40 +880,40 @@ function ot(e) {
|
|
|
877
880
|
}
|
|
878
881
|
function Ae(e, t) {
|
|
879
882
|
const i = [...e];
|
|
880
|
-
let n = t || 0,
|
|
881
|
-
const
|
|
882
|
-
for (const
|
|
883
|
+
let n = t || 0, a = i.length > 0 ? i[i.length - 1].index : 0;
|
|
884
|
+
const p = [];
|
|
885
|
+
for (const s of i.reverse()) {
|
|
883
886
|
if (n > 0) {
|
|
884
|
-
const
|
|
885
|
-
n -=
|
|
887
|
+
const x = a - s.index;
|
|
888
|
+
n -= x;
|
|
886
889
|
}
|
|
887
890
|
if (n < 0)
|
|
888
891
|
throw new Error("Invalid operation index, missing operations");
|
|
889
|
-
const
|
|
892
|
+
const l = {
|
|
890
893
|
ignore: n > 0,
|
|
891
|
-
operation:
|
|
892
|
-
},
|
|
893
|
-
if (
|
|
894
|
-
const
|
|
895
|
-
n = n +
|
|
894
|
+
operation: s
|
|
895
|
+
}, c = s.skip > 0 ? s.skip + 1 : 0;
|
|
896
|
+
if (c > 0 && c > n) {
|
|
897
|
+
const x = c - n;
|
|
898
|
+
n = n + x;
|
|
896
899
|
}
|
|
897
|
-
|
|
900
|
+
a = s.index, p.push(l);
|
|
898
901
|
}
|
|
899
|
-
return
|
|
902
|
+
return p.reverse();
|
|
900
903
|
}
|
|
901
904
|
function Ne(e, t, i) {
|
|
902
|
-
const n = e.slice().sort((
|
|
903
|
-
let
|
|
904
|
-
for (const
|
|
905
|
-
const
|
|
906
|
-
if (
|
|
907
|
-
|
|
905
|
+
const n = e.slice().sort((l, c) => l.skip - c.skip).sort((l, c) => l.index - c.index);
|
|
906
|
+
let a = i, p = 0, s = t;
|
|
907
|
+
for (const l of n.reverse()) {
|
|
908
|
+
const c = s - l.index;
|
|
909
|
+
if (a = a - c, a > -1)
|
|
910
|
+
p++, s = l.index;
|
|
908
911
|
else
|
|
909
912
|
break;
|
|
910
913
|
}
|
|
911
|
-
return
|
|
914
|
+
return p;
|
|
912
915
|
}
|
|
913
|
-
function
|
|
916
|
+
function Ze(e) {
|
|
914
917
|
return Object.values(e).flatMap((t) => t).sort(
|
|
915
918
|
(t, i) => new Date(t.timestamp).getTime() - new Date(i.timestamp).getTime()
|
|
916
919
|
);
|
|
@@ -920,140 +923,151 @@ function De(e) {
|
|
|
920
923
|
(t, i) => new Date(t.operation.timestamp).getTime() - new Date(i.operation.timestamp).getTime()
|
|
921
924
|
);
|
|
922
925
|
}
|
|
923
|
-
function mt(e, t, i, n,
|
|
924
|
-
const
|
|
926
|
+
function mt(e, t, i, n, a, p = Lt, s = {}, l) {
|
|
927
|
+
const c = Te(i, p);
|
|
925
928
|
return Ct(
|
|
926
929
|
e,
|
|
927
930
|
t,
|
|
928
|
-
|
|
931
|
+
c,
|
|
929
932
|
n,
|
|
933
|
+
a,
|
|
930
934
|
s,
|
|
931
|
-
|
|
935
|
+
l
|
|
932
936
|
);
|
|
933
937
|
}
|
|
934
|
-
function Ct(e, t, i, n,
|
|
935
|
-
const
|
|
936
|
-
const
|
|
938
|
+
function Ct(e, t, i, n, a, p = {}, s) {
|
|
939
|
+
const l = (s == null ? void 0 : s.checkHashes) ?? !0, c = _e(e), x = Object.keys(t).reduce((_, A) => {
|
|
940
|
+
const r = A;
|
|
937
941
|
return {
|
|
938
|
-
...
|
|
939
|
-
[
|
|
942
|
+
..._,
|
|
943
|
+
[r]: t[r].slice(0, a == null ? void 0 : a.revision[r])
|
|
940
944
|
};
|
|
941
|
-
}, {}),
|
|
942
|
-
(
|
|
943
|
-
const
|
|
945
|
+
}, {}), j = Object.keys(x).reduce(
|
|
946
|
+
(_, A) => {
|
|
947
|
+
const r = A;
|
|
944
948
|
return {
|
|
945
|
-
...
|
|
946
|
-
[
|
|
947
|
-
|
|
948
|
-
|
|
949
|
+
..._,
|
|
950
|
+
[r]: Ae(
|
|
951
|
+
x[r],
|
|
952
|
+
p[r]
|
|
949
953
|
)
|
|
950
954
|
};
|
|
951
955
|
},
|
|
952
956
|
{}
|
|
953
|
-
),
|
|
954
|
-
(
|
|
955
|
-
skip:
|
|
956
|
-
ignoreSkipOperations: !0
|
|
957
|
-
}) : i(h, S, n, {
|
|
958
|
-
skip: S.skip,
|
|
957
|
+
), E = De(j), g = E.reduce(
|
|
958
|
+
(_, { ignore: A, operation: r }, m, b) => A ? i(_, yt(r.scope), n, {
|
|
959
|
+
skip: r.skip,
|
|
959
960
|
ignoreSkipOperations: !0
|
|
961
|
+
// TODO: reuse hash?
|
|
962
|
+
}) : i(_, r, n, {
|
|
963
|
+
skip: r.skip,
|
|
964
|
+
ignoreSkipOperations: !0,
|
|
965
|
+
reuseHash: !l
|
|
960
966
|
}),
|
|
961
|
-
|
|
962
|
-
)
|
|
963
|
-
|
|
967
|
+
c
|
|
968
|
+
);
|
|
969
|
+
for (const _ of Object.keys(g.state))
|
|
970
|
+
for (let A = E.length - 1; A >= 0; A--)
|
|
971
|
+
if (E[A].operation.scope === _) {
|
|
972
|
+
if (E[A].operation.hash !== xt(g, _))
|
|
973
|
+
throw new Error(`Hash mismatch for scope ${_}`);
|
|
974
|
+
break;
|
|
975
|
+
}
|
|
976
|
+
const S = Object.keys(
|
|
977
|
+
g.operations
|
|
964
978
|
).reduce(
|
|
965
|
-
(
|
|
966
|
-
const
|
|
979
|
+
(_, A) => {
|
|
980
|
+
const r = A, m = a && a.revision[r] < t[r].length ? t[r].slice(a.revision[r]) : [];
|
|
967
981
|
return {
|
|
968
|
-
...
|
|
969
|
-
[
|
|
970
|
-
...
|
|
971
|
-
var
|
|
982
|
+
..._,
|
|
983
|
+
[r]: [
|
|
984
|
+
...g.operations[r].map((b, D) => {
|
|
985
|
+
var U;
|
|
972
986
|
return {
|
|
973
|
-
...
|
|
974
|
-
timestamp: ((
|
|
987
|
+
...b,
|
|
988
|
+
timestamp: ((U = t[r][D]) == null ? void 0 : U.timestamp) ?? b.timestamp
|
|
975
989
|
};
|
|
976
990
|
}),
|
|
977
|
-
...
|
|
991
|
+
...m
|
|
978
992
|
]
|
|
979
993
|
};
|
|
980
994
|
},
|
|
981
995
|
{ global: [], local: [] }
|
|
982
|
-
),
|
|
983
|
-
for (const
|
|
984
|
-
|
|
985
|
-
return
|
|
996
|
+
), F = Object.values(S).reduce((_, A) => {
|
|
997
|
+
for (const r of A)
|
|
998
|
+
r.timestamp > _ && (_ = r.timestamp);
|
|
999
|
+
return _;
|
|
986
1000
|
}, e.lastModified);
|
|
987
|
-
return { ...
|
|
1001
|
+
return { ...g, operations: S, lastModified: F };
|
|
988
1002
|
}
|
|
989
|
-
function
|
|
990
|
-
return
|
|
1003
|
+
function Ge(e, t) {
|
|
1004
|
+
return st(e) === st(t);
|
|
991
1005
|
}
|
|
992
|
-
const Jt = (e) =>
|
|
1006
|
+
const Jt = (e) => H(
|
|
993
1007
|
"SET_NAME",
|
|
994
1008
|
e,
|
|
995
1009
|
void 0,
|
|
996
1010
|
gt,
|
|
997
1011
|
void 0
|
|
998
|
-
), Ut = (e = 1, t = "global") =>
|
|
1012
|
+
), Ut = (e = 1, t = "global") => H(
|
|
999
1013
|
"UNDO",
|
|
1000
1014
|
e,
|
|
1001
1015
|
void 0,
|
|
1002
1016
|
ht,
|
|
1003
1017
|
t
|
|
1004
|
-
), Vt = (e = 1, t = "global") =>
|
|
1018
|
+
), Vt = (e = 1, t = "global") => H(
|
|
1005
1019
|
"REDO",
|
|
1006
1020
|
e,
|
|
1007
1021
|
void 0,
|
|
1008
1022
|
dt,
|
|
1009
1023
|
t
|
|
1010
|
-
), Kt = (e, t, i = "global") =>
|
|
1024
|
+
), Kt = (e, t, i = "global") => H(
|
|
1011
1025
|
"PRUNE",
|
|
1012
1026
|
{ start: e, end: t },
|
|
1013
1027
|
void 0,
|
|
1014
1028
|
ft,
|
|
1015
1029
|
i
|
|
1016
|
-
),
|
|
1030
|
+
), bt = (e, t) => H(
|
|
1017
1031
|
"LOAD_STATE",
|
|
1018
1032
|
{ state: e, operations: t },
|
|
1019
1033
|
void 0,
|
|
1020
1034
|
ut
|
|
1021
|
-
),
|
|
1035
|
+
), yt = (e = "global") => H("NOOP", {}, void 0, void 0, e), Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1022
1036
|
__proto__: null,
|
|
1023
|
-
loadState:
|
|
1024
|
-
noop:
|
|
1037
|
+
loadState: bt,
|
|
1038
|
+
noop: yt,
|
|
1025
1039
|
prune: Kt,
|
|
1026
1040
|
redo: Vt,
|
|
1027
1041
|
setName: Jt,
|
|
1028
1042
|
undo: Ut
|
|
1029
|
-
}, Symbol.toStringTag, { value: "Module" })), Wt = { "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"] };
|
|
1030
|
-
Object.freeze(
|
|
1031
|
-
var
|
|
1043
|
+
}, Symbol.toStringTag, { value: "Module" })), Ht = { "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"] };
|
|
1044
|
+
Object.freeze(Ht);
|
|
1045
|
+
var L = function(e, t, i, n) {
|
|
1032
1046
|
if (i === "a" && !n)
|
|
1033
1047
|
throw new TypeError("Private accessor was defined without a getter");
|
|
1034
1048
|
if (typeof t == "function" ? e !== t || !n : !t.has(e))
|
|
1035
1049
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1036
1050
|
return i === "m" ? n : i === "a" ? n.call(e) : n ? n.value : t.get(e);
|
|
1037
|
-
}, K,
|
|
1051
|
+
}, K, Z, V;
|
|
1038
1052
|
class Me {
|
|
1039
1053
|
constructor(...t) {
|
|
1040
|
-
K.set(this, /* @__PURE__ */ new Map()),
|
|
1054
|
+
K.set(this, /* @__PURE__ */ new Map()), Z.set(this, /* @__PURE__ */ new Map()), V.set(this, /* @__PURE__ */ new Map());
|
|
1041
1055
|
for (const i of t)
|
|
1042
1056
|
this.define(i);
|
|
1043
1057
|
}
|
|
1044
1058
|
define(t, i = !1) {
|
|
1045
|
-
for (let [n,
|
|
1046
|
-
n = n.toLowerCase(),
|
|
1047
|
-
const
|
|
1048
|
-
let
|
|
1049
|
-
for (let
|
|
1050
|
-
const
|
|
1051
|
-
if (
|
|
1059
|
+
for (let [n, a] of Object.entries(t)) {
|
|
1060
|
+
n = n.toLowerCase(), a = a.map((l) => l.toLowerCase()), L(this, V, "f").has(n) || L(this, V, "f").set(n, /* @__PURE__ */ new Set());
|
|
1061
|
+
const p = L(this, V, "f").get(n);
|
|
1062
|
+
let s = !0;
|
|
1063
|
+
for (let l of a) {
|
|
1064
|
+
const c = l.startsWith("*");
|
|
1065
|
+
if (l = c ? l.slice(1) : l, p == null || p.add(l), s && L(this, Z, "f").set(n, l), s = !1, c)
|
|
1052
1066
|
continue;
|
|
1053
|
-
const
|
|
1054
|
-
if (
|
|
1055
|
-
throw new Error(`"${n} -> ${
|
|
1056
|
-
|
|
1067
|
+
const x = L(this, K, "f").get(l);
|
|
1068
|
+
if (x && x != n && !i)
|
|
1069
|
+
throw new Error(`"${n} -> ${l}" conflicts with "${x} -> ${l}". Pass \`force=true\` to override this definition.`);
|
|
1070
|
+
L(this, K, "f").set(l, n);
|
|
1057
1071
|
}
|
|
1058
1072
|
}
|
|
1059
1073
|
return this;
|
|
@@ -1061,134 +1075,134 @@ class Me {
|
|
|
1061
1075
|
getType(t) {
|
|
1062
1076
|
if (typeof t != "string")
|
|
1063
1077
|
return null;
|
|
1064
|
-
const i = t.replace(/^.*[/\\]/, "").toLowerCase(), n = i.replace(/^.*\./, "").toLowerCase(),
|
|
1065
|
-
return !(n.length < i.length - 1) &&
|
|
1078
|
+
const i = t.replace(/^.*[/\\]/, "").toLowerCase(), n = i.replace(/^.*\./, "").toLowerCase(), a = i.length < t.length;
|
|
1079
|
+
return !(n.length < i.length - 1) && a ? null : L(this, K, "f").get(n) ?? null;
|
|
1066
1080
|
}
|
|
1067
1081
|
getExtension(t) {
|
|
1068
1082
|
var i;
|
|
1069
|
-
return typeof t != "string" ? null : (t = (i = t == null ? void 0 : t.split) == null ? void 0 : i.call(t, ";")[0], (t &&
|
|
1083
|
+
return typeof t != "string" ? null : (t = (i = t == null ? void 0 : t.split) == null ? void 0 : i.call(t, ";")[0], (t && L(this, Z, "f").get(t.trim().toLowerCase())) ?? null);
|
|
1070
1084
|
}
|
|
1071
1085
|
getAllExtensions(t) {
|
|
1072
|
-
return typeof t != "string" ? null :
|
|
1086
|
+
return typeof t != "string" ? null : L(this, V, "f").get(t.toLowerCase()) ?? null;
|
|
1073
1087
|
}
|
|
1074
1088
|
_freeze() {
|
|
1075
1089
|
this.define = () => {
|
|
1076
1090
|
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
1077
1091
|
}, Object.freeze(this);
|
|
1078
|
-
for (const t of
|
|
1092
|
+
for (const t of L(this, V, "f").values())
|
|
1079
1093
|
Object.freeze(t);
|
|
1080
1094
|
return this;
|
|
1081
1095
|
}
|
|
1082
1096
|
_getTestState() {
|
|
1083
1097
|
return {
|
|
1084
|
-
types:
|
|
1085
|
-
extensions:
|
|
1098
|
+
types: L(this, K, "f"),
|
|
1099
|
+
extensions: L(this, Z, "f")
|
|
1086
1100
|
};
|
|
1087
1101
|
}
|
|
1088
1102
|
}
|
|
1089
|
-
K = /* @__PURE__ */ new WeakMap(),
|
|
1090
|
-
const Pe = new Me(
|
|
1103
|
+
K = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap();
|
|
1104
|
+
const Pe = new Me(Ht)._freeze();
|
|
1091
1105
|
function Ie(e) {
|
|
1092
1106
|
const t = [], i = Object.keys(e);
|
|
1093
1107
|
for (const n of i) {
|
|
1094
|
-
const
|
|
1095
|
-
for (let
|
|
1096
|
-
|
|
1097
|
-
message: `Invalid operation index ${
|
|
1108
|
+
const a = e[n].sort((p, s) => p.index - s.index);
|
|
1109
|
+
for (let p = 0; p < a.length; p++)
|
|
1110
|
+
a[p].index !== p && t.push({
|
|
1111
|
+
message: `Invalid operation index ${a[p].index} at position ${p}`,
|
|
1098
1112
|
details: {
|
|
1099
|
-
position:
|
|
1100
|
-
operation:
|
|
1101
|
-
scope:
|
|
1113
|
+
position: p,
|
|
1114
|
+
operation: a[p],
|
|
1115
|
+
scope: a[p].scope
|
|
1102
1116
|
}
|
|
1103
1117
|
});
|
|
1104
1118
|
}
|
|
1105
1119
|
return t;
|
|
1106
1120
|
}
|
|
1107
|
-
const
|
|
1108
|
-
const t = new St(), { name: i, revision: n, documentType:
|
|
1121
|
+
const Wt = async (e) => {
|
|
1122
|
+
const t = new St(), { name: i, revision: n, documentType: a, created: p, lastModified: s } = e, l = {
|
|
1109
1123
|
name: i,
|
|
1110
1124
|
revision: n,
|
|
1111
|
-
documentType:
|
|
1112
|
-
created:
|
|
1113
|
-
lastModified:
|
|
1125
|
+
documentType: a,
|
|
1126
|
+
created: p,
|
|
1127
|
+
lastModified: s
|
|
1114
1128
|
};
|
|
1115
|
-
return t.file("header.json", JSON.stringify(
|
|
1129
|
+
return t.file("header.json", JSON.stringify(l, null, 2)), t.file(
|
|
1116
1130
|
"state.json",
|
|
1117
1131
|
JSON.stringify(e.initialState || {}, null, 2)
|
|
1118
|
-
), t.file("operations.json", JSON.stringify(e.operations, null, 2)), Object.keys(e.attachments).forEach((
|
|
1119
|
-
const { data:
|
|
1120
|
-
t.file(
|
|
1132
|
+
), t.file("operations.json", JSON.stringify(e.operations, null, 2)), Object.keys(e.attachments).forEach((x) => {
|
|
1133
|
+
const { data: j, ...E } = e.attachments[x];
|
|
1134
|
+
t.file(x, j, {
|
|
1121
1135
|
base64: !0,
|
|
1122
1136
|
createFolders: !0,
|
|
1123
|
-
comment: JSON.stringify(
|
|
1137
|
+
comment: JSON.stringify(E)
|
|
1124
1138
|
});
|
|
1125
1139
|
}), t;
|
|
1126
1140
|
}, ze = async (e, t, i, n) => {
|
|
1127
|
-
const
|
|
1141
|
+
const p = await (await Wt(e)).generateAsync({
|
|
1128
1142
|
type: "uint8array",
|
|
1129
1143
|
streamFiles: !0
|
|
1130
|
-
}),
|
|
1131
|
-
return
|
|
1144
|
+
}), s = n ?? e.name, l = `.${i}.zip`;
|
|
1145
|
+
return Se(
|
|
1132
1146
|
t,
|
|
1133
|
-
|
|
1134
|
-
|
|
1147
|
+
s.endsWith(l) ? s : `${s}${l}`,
|
|
1148
|
+
p
|
|
1135
1149
|
);
|
|
1136
1150
|
}, Xe = async (e, t) => {
|
|
1137
|
-
const n = await (await
|
|
1138
|
-
await
|
|
1139
|
-
},
|
|
1140
|
-
const
|
|
1141
|
-
return Fe(
|
|
1142
|
-
}, Fe = async (e, t) => {
|
|
1143
|
-
const
|
|
1144
|
-
return await
|
|
1151
|
+
const n = await (await Wt(e)).generateAsync({ type: "blob" }), a = await t.createWritable();
|
|
1152
|
+
await a.write(n), await a.close();
|
|
1153
|
+
}, Ot = async (e, t, i) => {
|
|
1154
|
+
const n = qt(e);
|
|
1155
|
+
return Fe(n, t);
|
|
1156
|
+
}, Fe = async (e, t, i) => {
|
|
1157
|
+
const n = new St();
|
|
1158
|
+
return await n.loadAsync(e), Re(n, t);
|
|
1145
1159
|
};
|
|
1146
|
-
async function Re(e, t) {
|
|
1147
|
-
const
|
|
1148
|
-
if (!
|
|
1160
|
+
async function Re(e, t, i) {
|
|
1161
|
+
const n = e.file("state.json");
|
|
1162
|
+
if (!n)
|
|
1149
1163
|
throw new Error("Initial state not found");
|
|
1150
|
-
const
|
|
1151
|
-
let
|
|
1152
|
-
|
|
1153
|
-
const
|
|
1154
|
-
if (!
|
|
1164
|
+
const a = await n.async("string"), p = JSON.parse(a), s = e.file("header.json");
|
|
1165
|
+
let l;
|
|
1166
|
+
s && (l = JSON.parse(await s.async("string")));
|
|
1167
|
+
const c = e.file("operations.json");
|
|
1168
|
+
if (!c)
|
|
1155
1169
|
throw new Error("Operations history not found");
|
|
1156
|
-
const
|
|
1157
|
-
await
|
|
1158
|
-
),
|
|
1159
|
-
if (
|
|
1160
|
-
const
|
|
1161
|
-
throw new Error(
|
|
1170
|
+
const x = JSON.parse(
|
|
1171
|
+
await c.async("string")
|
|
1172
|
+
), j = Ie(x);
|
|
1173
|
+
if (j.length) {
|
|
1174
|
+
const g = j.map((S) => S.message);
|
|
1175
|
+
throw new Error(g.join(`
|
|
1162
1176
|
`));
|
|
1163
1177
|
}
|
|
1164
|
-
let
|
|
1165
|
-
|
|
1166
|
-
|
|
1178
|
+
let E = Ct(
|
|
1179
|
+
p,
|
|
1180
|
+
x,
|
|
1167
1181
|
t,
|
|
1168
1182
|
void 0,
|
|
1169
|
-
|
|
1183
|
+
l
|
|
1170
1184
|
);
|
|
1171
|
-
return
|
|
1172
|
-
...
|
|
1173
|
-
...
|
|
1174
|
-
}),
|
|
1185
|
+
return l && (E = {
|
|
1186
|
+
...E,
|
|
1187
|
+
...l
|
|
1188
|
+
}), E;
|
|
1175
1189
|
}
|
|
1176
|
-
function
|
|
1190
|
+
function Bt(e) {
|
|
1177
1191
|
const t = e.replace(/^.*\./, "") || void 0, i = e.replace(/^.*[/\\]/, "") || void 0;
|
|
1178
1192
|
return { extension: t, fileName: i };
|
|
1179
1193
|
}
|
|
1180
1194
|
async function Ye(e) {
|
|
1181
|
-
const { buffer: t, mimeType: i = "application/octet-stream" } = await $e(e), n =
|
|
1195
|
+
const { buffer: t, mimeType: i = "application/octet-stream" } = await $e(e), n = Bt(e), a = t.toString("base64");
|
|
1182
1196
|
return {
|
|
1183
|
-
data:
|
|
1184
|
-
hash: at(
|
|
1197
|
+
data: a,
|
|
1198
|
+
hash: at(a),
|
|
1185
1199
|
mimeType: i,
|
|
1186
1200
|
...n
|
|
1187
1201
|
};
|
|
1188
1202
|
}
|
|
1189
1203
|
async function ti(e) {
|
|
1190
|
-
const t = await Ee(e), i = Pe.getType(e) || "application/octet-stream", n =
|
|
1191
|
-
return { data:
|
|
1204
|
+
const t = await Ee(e), i = Pe.getType(e) || "application/octet-stream", n = Bt(e), a = t.toString("base64");
|
|
1205
|
+
return { data: a, hash: at(a), mimeType: i, ...n };
|
|
1192
1206
|
}
|
|
1193
1207
|
class ei {
|
|
1194
1208
|
/**
|
|
@@ -1229,7 +1243,7 @@ class ei {
|
|
|
1229
1243
|
* @param path - The file path where the state is stored.
|
|
1230
1244
|
*/
|
|
1231
1245
|
async loadFromFile(t) {
|
|
1232
|
-
this._document = await
|
|
1246
|
+
this._document = await Ot(t, this._reducer);
|
|
1233
1247
|
}
|
|
1234
1248
|
/**
|
|
1235
1249
|
* Loads the state of the document from a file and returns it.
|
|
@@ -1238,7 +1252,7 @@ class ei {
|
|
|
1238
1252
|
* @returns The state of the document.
|
|
1239
1253
|
*/
|
|
1240
1254
|
static async stateFromFile(t, i) {
|
|
1241
|
-
return await
|
|
1255
|
+
return await Ot(t, i);
|
|
1242
1256
|
}
|
|
1243
1257
|
/**
|
|
1244
1258
|
* Gets the current state of the document.
|
|
@@ -1339,7 +1353,7 @@ class ei {
|
|
|
1339
1353
|
* @param operations - The operations to apply to the document.
|
|
1340
1354
|
*/
|
|
1341
1355
|
loadState(t, i) {
|
|
1342
|
-
return this.dispatch(
|
|
1356
|
+
return this.dispatch(bt(t, i)), this;
|
|
1343
1357
|
}
|
|
1344
1358
|
}
|
|
1345
1359
|
function ii(e, t) {
|
|
@@ -1358,33 +1372,33 @@ function ii(e, t) {
|
|
|
1358
1372
|
export {
|
|
1359
1373
|
Ie as A,
|
|
1360
1374
|
ei as B,
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1375
|
+
Lt as C,
|
|
1376
|
+
Oe as D,
|
|
1377
|
+
We as E,
|
|
1378
|
+
ke as a,
|
|
1379
|
+
_e as b,
|
|
1366
1380
|
Te as c,
|
|
1367
1381
|
Xe as d,
|
|
1368
1382
|
Fe as e,
|
|
1369
|
-
|
|
1383
|
+
H as f,
|
|
1370
1384
|
ii as g,
|
|
1371
1385
|
Qe as h,
|
|
1372
|
-
|
|
1386
|
+
jt as i,
|
|
1373
1387
|
Ne as j,
|
|
1374
|
-
|
|
1375
|
-
|
|
1388
|
+
Wt as k,
|
|
1389
|
+
Ot as l,
|
|
1376
1390
|
ti as m,
|
|
1377
1391
|
Ye as n,
|
|
1378
|
-
|
|
1379
|
-
|
|
1392
|
+
xt as o,
|
|
1393
|
+
Be as p,
|
|
1380
1394
|
ve as q,
|
|
1381
|
-
|
|
1395
|
+
Ge as r,
|
|
1382
1396
|
ze as s,
|
|
1383
|
-
|
|
1397
|
+
wt as t,
|
|
1384
1398
|
Ae as u,
|
|
1385
1399
|
ot as v,
|
|
1386
1400
|
Ct as w,
|
|
1387
1401
|
mt as x,
|
|
1388
1402
|
De as y,
|
|
1389
|
-
|
|
1403
|
+
Ze as z
|
|
1390
1404
|
};
|