document-model 1.1.0-experimental.3 → 1.1.0-experimental.4
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/CHANGELOG.md +33 -0
- 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-DMRH7zDy.js → index-BLpgsifL.js} +1 -1
- package/dist/browser/cjs/internal/{index-dwAOfmBp.js → index-BTG_-qY6.js} +1 -1
- package/dist/browser/cjs/internal/object-BHB7lY3H.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-2Qq00NLA.js +46 -0
- package/dist/browser/es/internal/{index-DQztOVJu.js → index-BD2hB9El.js} +1 -1
- package/dist/browser/es/internal/{object-iTBekDVP.js → object-BW-G4r5m.js} +733 -735
- package/dist/browser/src/document/reducer.d.ts +17 -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-FvRO8SnG.js → index-B31DqWHj.js} +1 -1
- package/dist/node/cjs/internal/{index-BNFVmPew.js → index-BBm_wnUa.js} +1 -1
- package/dist/node/cjs/internal/{object-Xvr4kDQj.js → object-CxVzP-Xe.js} +17 -17
- 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-DOpbr_uw.js → index-BPCSW4M1.js} +1 -1
- package/dist/node/es/internal/index-C7I4OGkU.js +46 -0
- package/dist/node/es/internal/{object-C2s2eZ08.js → object-C-_SkpQ0.js} +516 -518
- package/dist/node/src/document/reducer.d.ts +17 -0
- package/dist/src/document/actions/creators.d.ts +47 -0
- package/dist/src/document/actions/index.d.ts +14 -0
- package/dist/src/document/actions/types.d.ts +15 -0
- package/dist/src/document/index.d.ts +6 -0
- package/dist/src/document/object.d.ts +1210 -0
- package/dist/src/document/reducer.d.ts +60 -0
- package/dist/src/document/schema/index.d.ts +2 -0
- package/dist/src/document/schema/types.d.ts +176 -0
- package/dist/src/document/schema/zod.d.ts +113 -0
- package/dist/src/document/signal.d.ts +29 -0
- package/dist/src/document/types.d.ts +255 -0
- package/dist/src/document/utils/base.d.ts +86 -0
- package/dist/src/document/utils/document-helpers.d.ts +53 -0
- package/dist/src/document/utils/file.d.ts +48 -0
- package/dist/src/document/utils/index.d.ts +5 -0
- package/dist/src/document/utils/node.d.ts +9 -0
- package/dist/src/document/utils/validation.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/header.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/module.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-error.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation-example.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/operation.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/state.d.ts +2 -0
- package/dist/src/document-model/custom/reducers/versioning.d.ts +7 -0
- package/dist/src/document-model/custom/utils.d.ts +7 -0
- package/dist/src/document-model/gen/actions.d.ts +15 -0
- package/dist/src/document-model/gen/creators.d.ts +7 -0
- package/dist/src/document-model/gen/document-model.d.ts +2 -0
- package/dist/src/document-model/gen/header/actions.d.ts +9 -0
- package/dist/src/document-model/gen/header/creators.d.ts +8 -0
- package/dist/src/document-model/gen/header/object.d.ts +12 -0
- package/dist/src/document-model/gen/header/operations.d.ts +10 -0
- package/dist/src/document-model/gen/index.d.ts +5 -0
- package/dist/src/document-model/gen/module/actions.d.ts +8 -0
- package/dist/src/document-model/gen/module/creators.d.ts +7 -0
- package/dist/src/document-model/gen/module/object.d.ts +11 -0
- package/dist/src/document-model/gen/module/operations.d.ts +9 -0
- package/dist/src/document-model/gen/object.d.ts +28 -0
- package/dist/src/document-model/gen/operation/actions.d.ts +13 -0
- package/dist/src/document-model/gen/operation/creators.d.ts +12 -0
- package/dist/src/document-model/gen/operation/object.d.ts +16 -0
- package/dist/src/document-model/gen/operation/operations.d.ts +14 -0
- package/dist/src/document-model/gen/operation-error/actions.d.ts +10 -0
- package/dist/src/document-model/gen/operation-error/creators.d.ts +9 -0
- package/dist/src/document-model/gen/operation-error/object.d.ts +13 -0
- package/dist/src/document-model/gen/operation-error/operations.d.ts +11 -0
- package/dist/src/document-model/gen/operation-example/actions.d.ts +7 -0
- package/dist/src/document-model/gen/operation-example/creators.d.ts +6 -0
- package/dist/src/document-model/gen/operation-example/object.d.ts +10 -0
- package/dist/src/document-model/gen/operation-example/operations.d.ts +8 -0
- package/dist/src/document-model/gen/reducer.d.ts +5 -0
- package/dist/src/document-model/gen/schema/index.d.ts +2 -0
- package/dist/src/document-model/gen/schema/types.d.ts +453 -0
- package/dist/src/document-model/gen/schema/zod.d.ts +453 -0
- package/dist/src/document-model/gen/state/actions.d.ts +9 -0
- package/dist/src/document-model/gen/state/creators.d.ts +8 -0
- package/dist/src/document-model/gen/state/object.d.ts +12 -0
- package/dist/src/document-model/gen/state/operations.d.ts +10 -0
- package/dist/src/document-model/gen/types.d.ts +8 -0
- package/dist/src/document-model/gen/utils.d.ts +6 -0
- package/dist/src/document-model/gen/versioning/actions.d.ts +8 -0
- package/dist/src/document-model/gen/versioning/creators.d.ts +7 -0
- package/dist/src/document-model/gen/versioning/object.d.ts +11 -0
- package/dist/src/document-model/gen/versioning/operations.d.ts +9 -0
- package/dist/src/document-model/index.d.ts +80 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vitest.config.d.ts +2 -0
- package/package.json +1 -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/es/internal/index-BIrQOTP_.js +0 -44
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var st = (t, e,
|
|
4
|
-
import { produce as pt, castDraft as at, castImmutable as
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var le = (t, e, i) => e in t ? ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var st = (t, e, i) => (le(t, typeof e != "symbol" ? e + "" : e, i), i);
|
|
4
|
+
import { produce as pt, castDraft as at, castImmutable as me, freeze as ue } from "immer";
|
|
5
5
|
import { z as f } from "zod";
|
|
6
6
|
import Dt from "jszip";
|
|
7
|
-
import
|
|
7
|
+
import fe from "crypto";
|
|
8
8
|
import ut from "fs";
|
|
9
|
-
import
|
|
10
|
-
import { join as
|
|
11
|
-
const Tt = (t) => t != null,
|
|
12
|
-
function
|
|
9
|
+
import de from "https";
|
|
10
|
+
import { join as ge } from "path";
|
|
11
|
+
const Tt = (t) => t != null, he = f.any().refine((t) => Tt(t)), _t = f.enum(["LOAD_STATE"]), vt = f.enum(["PRUNE"]), Nt = f.enum(["REDO"]), It = f.enum(["SET_NAME"]), At = f.enum(["UNDO"]);
|
|
12
|
+
function xe() {
|
|
13
13
|
return f.object({
|
|
14
14
|
__typename: f.literal("Action").optional(),
|
|
15
15
|
type: f.string()
|
|
@@ -27,7 +27,7 @@ function Pt() {
|
|
|
27
27
|
Lt()
|
|
28
28
|
]);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function ye() {
|
|
31
31
|
return f.object({
|
|
32
32
|
__typename: f.literal("DocumentFile").optional(),
|
|
33
33
|
data: f.string(),
|
|
@@ -55,7 +55,7 @@ function zt() {
|
|
|
55
55
|
name: f.string()
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function be() {
|
|
59
59
|
return f.object({
|
|
60
60
|
__typename: f.literal("Operation").optional(),
|
|
61
61
|
hash: f.string(),
|
|
@@ -67,7 +67,7 @@ function ye() {
|
|
|
67
67
|
function Rt() {
|
|
68
68
|
return f.object({
|
|
69
69
|
input: f.lazy(() => xt()),
|
|
70
|
-
type:
|
|
70
|
+
type: vt,
|
|
71
71
|
scope: Y()
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -81,7 +81,7 @@ const yt = f.number;
|
|
|
81
81
|
function Ct() {
|
|
82
82
|
return f.object({
|
|
83
83
|
input: yt(),
|
|
84
|
-
type:
|
|
84
|
+
type: Nt,
|
|
85
85
|
scope: Y()
|
|
86
86
|
});
|
|
87
87
|
}
|
|
@@ -93,7 +93,7 @@ function Ft() {
|
|
|
93
93
|
scope: f.literal("global")
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function we() {
|
|
97
97
|
return f.object({
|
|
98
98
|
__typename: f.literal("SetNameOperation").optional(),
|
|
99
99
|
hash: f.string(),
|
|
@@ -111,40 +111,40 @@ function Lt() {
|
|
|
111
111
|
scope: Y()
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
115
115
|
__proto__: null,
|
|
116
|
-
ActionSchema:
|
|
116
|
+
ActionSchema: xe,
|
|
117
117
|
BaseActionSchema: Pt,
|
|
118
|
-
DocumentFileSchema:
|
|
118
|
+
DocumentFileSchema: ye,
|
|
119
119
|
LoadStateActionInputSchema: ht,
|
|
120
120
|
LoadStateActionSchema: Mt,
|
|
121
121
|
LoadStateActionStateInputSchema: zt,
|
|
122
122
|
Load_StateSchema: _t,
|
|
123
|
-
OperationSchema:
|
|
123
|
+
OperationSchema: be,
|
|
124
124
|
OperationScopeSchema: Y,
|
|
125
125
|
PruneActionInputSchema: xt,
|
|
126
126
|
PruneActionSchema: Rt,
|
|
127
|
-
PruneSchema:
|
|
127
|
+
PruneSchema: vt,
|
|
128
128
|
RedoActionInputSchema: yt,
|
|
129
129
|
RedoActionSchema: Ct,
|
|
130
|
-
RedoSchema:
|
|
130
|
+
RedoSchema: Nt,
|
|
131
131
|
SetNameActionInputSchema: bt,
|
|
132
132
|
SetNameActionSchema: Ft,
|
|
133
|
-
SetNameOperationSchema:
|
|
133
|
+
SetNameOperationSchema: we,
|
|
134
134
|
Set_NameSchema: It,
|
|
135
135
|
UndoActionInputSchema: wt,
|
|
136
136
|
UndoActionSchema: Lt,
|
|
137
137
|
UndoSchema: At,
|
|
138
|
-
definedNonNullAnySchema:
|
|
138
|
+
definedNonNullAnySchema: he,
|
|
139
139
|
isDefinedNonNullAny: Tt
|
|
140
140
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
141
|
-
function
|
|
141
|
+
function Oe(t) {
|
|
142
142
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
143
143
|
}
|
|
144
144
|
var ft = { exports: {} };
|
|
145
145
|
(function(t, e) {
|
|
146
|
-
const { hasOwnProperty:
|
|
147
|
-
|
|
146
|
+
const { hasOwnProperty: i } = Object.prototype, n = C();
|
|
147
|
+
n.configure = C, n.stringify = n, n.default = n, e.stringify = n, e.configure = C, t.exports = n;
|
|
148
148
|
const o = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
|
|
149
149
|
function a(c) {
|
|
150
150
|
return c.length < 5e3 && !o.test(c) ? `"${c}"` : JSON.stringify(c);
|
|
@@ -154,10 +154,10 @@ var ft = { exports: {} };
|
|
|
154
154
|
return c.sort();
|
|
155
155
|
for (let l = 1; l < c.length; l++) {
|
|
156
156
|
const u = c[l];
|
|
157
|
-
let
|
|
158
|
-
for (;
|
|
159
|
-
c[
|
|
160
|
-
c[
|
|
157
|
+
let D = l;
|
|
158
|
+
for (; D !== 0 && c[D - 1] > u; )
|
|
159
|
+
c[D] = c[D - 1], D--;
|
|
160
|
+
c[D] = u;
|
|
161
161
|
}
|
|
162
162
|
return c;
|
|
163
163
|
}
|
|
@@ -174,14 +174,14 @@ var ft = { exports: {} };
|
|
|
174
174
|
}
|
|
175
175
|
function d(c, l, u) {
|
|
176
176
|
c.length < u && (u = c.length);
|
|
177
|
-
const
|
|
178
|
-
let F = `"0":${
|
|
177
|
+
const D = l === "," ? "" : " ";
|
|
178
|
+
let F = `"0":${D}${c[0]}`;
|
|
179
179
|
for (let M = 1; M < u; M++)
|
|
180
|
-
F += `${l}"${M}":${
|
|
180
|
+
F += `${l}"${M}":${D}${c[M]}`;
|
|
181
181
|
return F;
|
|
182
182
|
}
|
|
183
183
|
function h(c) {
|
|
184
|
-
if (
|
|
184
|
+
if (i.call(c, "circularValue")) {
|
|
185
185
|
const l = c.circularValue;
|
|
186
186
|
if (typeof l == "string")
|
|
187
187
|
return `"${l}"`;
|
|
@@ -199,13 +199,13 @@ var ft = { exports: {} };
|
|
|
199
199
|
}
|
|
200
200
|
function b(c, l) {
|
|
201
201
|
let u;
|
|
202
|
-
if (
|
|
202
|
+
if (i.call(c, l) && (u = c[l], typeof u != "boolean"))
|
|
203
203
|
throw new TypeError(`The "${l}" argument must be of type boolean`);
|
|
204
204
|
return u === void 0 ? !0 : u;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function w(c, l) {
|
|
207
207
|
let u;
|
|
208
|
-
if (
|
|
208
|
+
if (i.call(c, l)) {
|
|
209
209
|
if (u = c[l], typeof u != "number")
|
|
210
210
|
throw new TypeError(`The "${l}" argument must be of type number`);
|
|
211
211
|
if (!Number.isInteger(u))
|
|
@@ -215,24 +215,24 @@ var ft = { exports: {} };
|
|
|
215
215
|
}
|
|
216
216
|
return u === void 0 ? 1 / 0 : u;
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function N(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
223
|
for (const u of c)
|
|
224
224
|
(typeof u == "string" || typeof u == "number") && l.add(String(u));
|
|
225
225
|
return l;
|
|
226
226
|
}
|
|
227
227
|
function P(c) {
|
|
228
|
-
if (
|
|
228
|
+
if (i.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
233
|
return (u) => {
|
|
234
|
-
let
|
|
235
|
-
throw typeof u != "function" && (
|
|
234
|
+
let D = `Object can not safely be stringified. Received type ${typeof u}`;
|
|
235
|
+
throw typeof u != "function" && (D += ` (${u.toString()})`), new Error(D);
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
238
|
}
|
|
@@ -240,10 +240,10 @@ var ft = { exports: {} };
|
|
|
240
240
|
c = { ...c };
|
|
241
241
|
const l = P(c);
|
|
242
242
|
l && (c.bigint === void 0 && (c.bigint = !1), "circularValue" in c || (c.circularValue = Error));
|
|
243
|
-
const u = h(c),
|
|
244
|
-
function
|
|
243
|
+
const u = h(c), D = b(c, "bigint"), F = b(c, "deterministic"), M = w(c, "maximumDepth"), T = w(c, "maximumBreadth");
|
|
244
|
+
function it(A, s, g, O, y, j) {
|
|
245
245
|
let x = s[A];
|
|
246
|
-
switch (typeof x == "object" && x !== null && typeof x.toJSON == "function" && (x = x.toJSON(A)), x =
|
|
246
|
+
switch (typeof x == "object" && x !== null && typeof x.toJSON == "function" && (x = x.toJSON(A)), x = O.call(s, A, x), typeof x) {
|
|
247
247
|
case "string":
|
|
248
248
|
return a(x);
|
|
249
249
|
case "object": {
|
|
@@ -251,52 +251,52 @@ var ft = { exports: {} };
|
|
|
251
251
|
return "null";
|
|
252
252
|
if (g.indexOf(x) !== -1)
|
|
253
253
|
return u;
|
|
254
|
-
let S = "",
|
|
255
|
-
const
|
|
254
|
+
let S = "", k = ",";
|
|
255
|
+
const _ = j;
|
|
256
256
|
if (Array.isArray(x)) {
|
|
257
257
|
if (x.length === 0)
|
|
258
258
|
return "[]";
|
|
259
259
|
if (M < g.length + 1)
|
|
260
260
|
return '"[Array]"';
|
|
261
261
|
g.push(x), y !== "" && (j += y, S += `
|
|
262
|
-
${j}`,
|
|
262
|
+
${j}`, k = `,
|
|
263
263
|
${j}`);
|
|
264
|
-
const R = Math.min(x.length,
|
|
264
|
+
const R = Math.min(x.length, T);
|
|
265
265
|
let U = 0;
|
|
266
266
|
for (; U < R - 1; U++) {
|
|
267
|
-
const ot =
|
|
268
|
-
S += ot !== void 0 ? ot : "null", S +=
|
|
267
|
+
const ot = it(String(U), x, g, O, y, j);
|
|
268
|
+
S += ot !== void 0 ? ot : "null", S += k;
|
|
269
269
|
}
|
|
270
|
-
const J =
|
|
271
|
-
if (S += J !== void 0 ? J : "null", x.length - 1 >
|
|
272
|
-
const ot = x.length -
|
|
273
|
-
S += `${
|
|
270
|
+
const J = it(String(U), x, g, O, y, j);
|
|
271
|
+
if (S += J !== void 0 ? J : "null", x.length - 1 > T) {
|
|
272
|
+
const ot = x.length - T - 1;
|
|
273
|
+
S += `${k}"... ${N(ot)} not stringified"`;
|
|
274
274
|
}
|
|
275
275
|
return y !== "" && (S += `
|
|
276
|
-
${
|
|
276
|
+
${_}`), g.pop(), `[${S}]`;
|
|
277
277
|
}
|
|
278
|
-
let
|
|
279
|
-
const I =
|
|
278
|
+
let v = Object.keys(x);
|
|
279
|
+
const I = v.length;
|
|
280
280
|
if (I === 0)
|
|
281
281
|
return "{}";
|
|
282
282
|
if (M < g.length + 1)
|
|
283
283
|
return '"[Object]"';
|
|
284
284
|
let E = "", z = "";
|
|
285
|
-
y !== "" && (j += y,
|
|
285
|
+
y !== "" && (j += y, k = `,
|
|
286
286
|
${j}`, E = " ");
|
|
287
|
-
const q = Math.min(I,
|
|
288
|
-
F && !m(x) && (
|
|
287
|
+
const q = Math.min(I, T);
|
|
288
|
+
F && !m(x) && (v = r(v)), g.push(x);
|
|
289
289
|
for (let R = 0; R < q; R++) {
|
|
290
|
-
const U =
|
|
291
|
-
J !== void 0 && (S += `${z}${a(U)}:${E}${J}`, z =
|
|
290
|
+
const U = v[R], J = it(U, x, g, O, y, j);
|
|
291
|
+
J !== void 0 && (S += `${z}${a(U)}:${E}${J}`, z = k);
|
|
292
292
|
}
|
|
293
|
-
if (I >
|
|
294
|
-
const R = I -
|
|
295
|
-
S += `${z}"...":${E}"${
|
|
293
|
+
if (I > T) {
|
|
294
|
+
const R = I - T;
|
|
295
|
+
S += `${z}"...":${E}"${N(R)} not stringified"`, z = k;
|
|
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,13 +305,13 @@ ${D}`), g.pop(), `{${S}}`;
|
|
|
305
305
|
case "undefined":
|
|
306
306
|
return;
|
|
307
307
|
case "bigint":
|
|
308
|
-
if (
|
|
308
|
+
if (D)
|
|
309
309
|
return String(x);
|
|
310
310
|
default:
|
|
311
311
|
return l ? l(x) : void 0;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function nt(A, s, g, O, y, j) {
|
|
315
315
|
switch (typeof s == "object" && s !== null && typeof s.toJSON == "function" && (s = s.toJSON(A)), typeof s) {
|
|
316
316
|
case "string":
|
|
317
317
|
return a(s);
|
|
@@ -321,39 +321,39 @@ ${D}`), g.pop(), `{${S}}`;
|
|
|
321
321
|
if (g.indexOf(s) !== -1)
|
|
322
322
|
return u;
|
|
323
323
|
const x = j;
|
|
324
|
-
let S = "",
|
|
324
|
+
let S = "", k = ",";
|
|
325
325
|
if (Array.isArray(s)) {
|
|
326
326
|
if (s.length === 0)
|
|
327
327
|
return "[]";
|
|
328
328
|
if (M < g.length + 1)
|
|
329
329
|
return '"[Array]"';
|
|
330
330
|
g.push(s), y !== "" && (j += y, S += `
|
|
331
|
-
${j}`,
|
|
331
|
+
${j}`, k = `,
|
|
332
332
|
${j}`);
|
|
333
|
-
const I = Math.min(s.length,
|
|
333
|
+
const I = Math.min(s.length, T);
|
|
334
334
|
let E = 0;
|
|
335
335
|
for (; E < I - 1; E++) {
|
|
336
|
-
const q =
|
|
337
|
-
S += q !== void 0 ? q : "null", S +=
|
|
336
|
+
const q = nt(String(E), s[E], g, O, y, j);
|
|
337
|
+
S += q !== void 0 ? q : "null", S += k;
|
|
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 = nt(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 += `${k}"... ${N(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 I of
|
|
353
|
-
const E =
|
|
354
|
-
E !== void 0 && (S += `${
|
|
348
|
+
let _ = "";
|
|
349
|
+
y !== "" && (j += y, k = `,
|
|
350
|
+
${j}`, _ = " ");
|
|
351
|
+
let v = "";
|
|
352
|
+
for (const I of O) {
|
|
353
|
+
const E = nt(I, s[I], g, O, y, j);
|
|
354
|
+
E !== void 0 && (S += `${v}${a(I)}:${_}${E}`, v = k);
|
|
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 (D)
|
|
368
368
|
return String(s);
|
|
369
369
|
default:
|
|
370
370
|
return l ? l(s) : void 0;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
function G(A, s, g,
|
|
373
|
+
function G(A, s, g, O, y) {
|
|
374
374
|
switch (typeof s) {
|
|
375
375
|
case "string":
|
|
376
376
|
return a(s);
|
|
@@ -379,7 +379,7 @@ ${x}`), g.pop(), `{${S}}`;
|
|
|
379
379
|
return "null";
|
|
380
380
|
if (typeof s.toJSON == "function") {
|
|
381
381
|
if (s = s.toJSON(A), typeof s != "object")
|
|
382
|
-
return G(A, s, g,
|
|
382
|
+
return G(A, s, g, O, y);
|
|
383
383
|
if (s === null)
|
|
384
384
|
return "null";
|
|
385
385
|
}
|
|
@@ -391,20 +391,20 @@ ${x}`), g.pop(), `{${S}}`;
|
|
|
391
391
|
return "[]";
|
|
392
392
|
if (M < 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,
|
|
398
|
+
${y}`, q = Math.min(s.length, T);
|
|
399
399
|
let R = 0;
|
|
400
400
|
for (; R < q - 1; R++) {
|
|
401
|
-
const J = G(String(R), s[R], g,
|
|
401
|
+
const J = G(String(R), s[R], g, O, y);
|
|
402
402
|
E += J !== void 0 ? J : "null", E += z;
|
|
403
403
|
}
|
|
404
|
-
const U = G(String(R), s[R], g,
|
|
405
|
-
if (E += U !== void 0 ? U : "null", s.length - 1 >
|
|
406
|
-
const J = s.length -
|
|
407
|
-
E += `${z}"... ${
|
|
404
|
+
const U = G(String(R), s[R], g, O, y);
|
|
405
|
+
if (E += U !== void 0 ? U : "null", s.length - 1 > T) {
|
|
406
|
+
const J = s.length - T - 1;
|
|
407
|
+
E += `${z}"... ${N(J)} not stringified"`;
|
|
408
408
|
}
|
|
409
409
|
return E += `
|
|
410
410
|
${j}`, g.pop(), `[${E}]`;
|
|
@@ -415,22 +415,22 @@ ${j}`, g.pop(), `[${E}]`;
|
|
|
415
415
|
return "{}";
|
|
416
416
|
if (M < g.length + 1)
|
|
417
417
|
return '"[Object]"';
|
|
418
|
-
y +=
|
|
419
|
-
const
|
|
418
|
+
y += O;
|
|
419
|
+
const k = `,
|
|
420
420
|
${y}`;
|
|
421
|
-
let
|
|
422
|
-
m(s) && (
|
|
421
|
+
let _ = "", v = "", I = Math.min(S, T);
|
|
422
|
+
m(s) && (_ += d(s, k, T), x = x.slice(s.length), I -= s.length, v = k), F && (x = r(x)), g.push(s);
|
|
423
423
|
for (let E = 0; E < I; E++) {
|
|
424
|
-
const z = x[E], q = G(z, s[z], g,
|
|
425
|
-
q !== void 0 && (
|
|
424
|
+
const z = x[E], q = G(z, s[z], g, O, y);
|
|
425
|
+
q !== void 0 && (_ += `${v}${a(z)}: ${q}`, v = k);
|
|
426
426
|
}
|
|
427
|
-
if (S >
|
|
428
|
-
const E = S -
|
|
429
|
-
|
|
427
|
+
if (S > T) {
|
|
428
|
+
const E = S - T;
|
|
429
|
+
_ += `${v}"...": "${N(E)} not stringified"`, v = k;
|
|
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,7 +439,7 @@ ${j}`), g.pop(), `{${D}}`;
|
|
|
439
439
|
case "undefined":
|
|
440
440
|
return;
|
|
441
441
|
case "bigint":
|
|
442
|
-
if (
|
|
442
|
+
if (D)
|
|
443
443
|
return String(s);
|
|
444
444
|
default:
|
|
445
445
|
return l ? l(s) : void 0;
|
|
@@ -460,25 +460,25 @@ ${j}`), g.pop(), `{${D}}`;
|
|
|
460
460
|
}
|
|
461
461
|
if (g.indexOf(s) !== -1)
|
|
462
462
|
return u;
|
|
463
|
-
let
|
|
463
|
+
let O = "";
|
|
464
464
|
if (Array.isArray(s)) {
|
|
465
465
|
if (s.length === 0)
|
|
466
466
|
return "[]";
|
|
467
467
|
if (M < g.length + 1)
|
|
468
468
|
return '"[Array]"';
|
|
469
469
|
g.push(s);
|
|
470
|
-
const
|
|
471
|
-
let
|
|
472
|
-
for (;
|
|
473
|
-
const I = Z(String(
|
|
474
|
-
|
|
470
|
+
const k = Math.min(s.length, T);
|
|
471
|
+
let _ = 0;
|
|
472
|
+
for (; _ < k - 1; _++) {
|
|
473
|
+
const I = Z(String(_), s[_], g);
|
|
474
|
+
O += I !== void 0 ? I : "null", O += ",";
|
|
475
475
|
}
|
|
476
|
-
const
|
|
477
|
-
if (
|
|
478
|
-
const I = s.length -
|
|
479
|
-
|
|
476
|
+
const v = Z(String(_), s[_], g);
|
|
477
|
+
if (O += v !== void 0 ? v : "null", s.length - 1 > T) {
|
|
478
|
+
const I = s.length - T - 1;
|
|
479
|
+
O += `,"... ${N(I)} 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;
|
|
@@ -486,17 +486,17 @@ ${j}`), g.pop(), `{${D}}`;
|
|
|
486
486
|
return "{}";
|
|
487
487
|
if (M < 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 += d(s, ",", T), y = y.slice(s.length), S -= s.length, x = ","), F && (y = r(y)), g.push(s);
|
|
491
|
+
for (let k = 0; k < S; k++) {
|
|
492
|
+
const _ = y[k], v = Z(_, 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 k = j - T;
|
|
497
|
+
O += `${x}"...":"${N(k)} 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,45 +505,45 @@ ${j}`), g.pop(), `{${D}}`;
|
|
|
505
505
|
case "undefined":
|
|
506
506
|
return;
|
|
507
507
|
case "bigint":
|
|
508
|
-
if (
|
|
508
|
+
if (D)
|
|
509
509
|
return String(s);
|
|
510
510
|
default:
|
|
511
511
|
return l ? l(s) : void 0;
|
|
512
512
|
}
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function pe(A, 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("", { "": A }, [], s, O, "");
|
|
520
520
|
if (Array.isArray(s))
|
|
521
|
-
return
|
|
521
|
+
return nt("", A, [], $(s), O, "");
|
|
522
522
|
}
|
|
523
|
-
if (
|
|
524
|
-
return G("", A, [],
|
|
523
|
+
if (O.length !== 0)
|
|
524
|
+
return G("", A, [], O, "");
|
|
525
525
|
}
|
|
526
526
|
return Z("", A, []);
|
|
527
527
|
}
|
|
528
|
-
return
|
|
528
|
+
return pe;
|
|
529
529
|
}
|
|
530
530
|
})(ft, ft.exports);
|
|
531
|
-
var
|
|
532
|
-
const K = /* @__PURE__ */
|
|
531
|
+
var Se = ft.exports;
|
|
532
|
+
const K = /* @__PURE__ */ Oe(Se);
|
|
533
533
|
K.configure;
|
|
534
|
-
function
|
|
534
|
+
function je(t, e) {
|
|
535
535
|
return { ...t, name: e };
|
|
536
536
|
}
|
|
537
|
-
function
|
|
538
|
-
const { scope:
|
|
537
|
+
function Ee(t, e, i) {
|
|
538
|
+
const { scope: n, input: o } = e;
|
|
539
539
|
return pt({
|
|
540
540
|
document: t,
|
|
541
541
|
action: e,
|
|
542
|
-
skip:
|
|
542
|
+
skip: i
|
|
543
543
|
}, (r) => {
|
|
544
|
-
if (r.document.operations[
|
|
544
|
+
if (r.document.operations[n].length < 1)
|
|
545
545
|
throw new Error(
|
|
546
|
-
`Cannot undo: no operations in history for scope "${
|
|
546
|
+
`Cannot undo: no operations in history for scope "${n}"`
|
|
547
547
|
);
|
|
548
548
|
if (o < 1)
|
|
549
549
|
throw new Error(
|
|
@@ -553,35 +553,35 @@ function je(t, e, n) {
|
|
|
553
553
|
throw new Error(
|
|
554
554
|
"Cannot undo: skip value from reducer cannot be used with UNDO action"
|
|
555
555
|
);
|
|
556
|
-
const p = r.document.operations[
|
|
556
|
+
const p = r.document.operations[n].at(-1), m = p && p.type === "NOOP" && p.skip > 0;
|
|
557
557
|
if (r.skip += o, m) {
|
|
558
558
|
r.skip += p.skip;
|
|
559
|
-
const
|
|
560
|
-
|
|
559
|
+
const w = r.document.operations[n][r.document.operations[n].length - 2];
|
|
560
|
+
w && p.index - w.index === 1 && r.document.operations[n].pop();
|
|
561
561
|
}
|
|
562
|
-
if (r.document.operations[
|
|
562
|
+
if (r.document.operations[n].length < r.skip)
|
|
563
563
|
throw new Error(
|
|
564
564
|
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
565
565
|
);
|
|
566
|
-
const d = r.document.operations[
|
|
566
|
+
const d = r.document.operations[n].length - 1;
|
|
567
567
|
let h = o, b = m ? d - p.skip : d;
|
|
568
568
|
for (; h > 0 && b >= 0; ) {
|
|
569
|
-
const
|
|
570
|
-
if (!
|
|
569
|
+
const w = r.document.operations[n][b];
|
|
570
|
+
if (!w) {
|
|
571
571
|
h--, b--;
|
|
572
572
|
continue;
|
|
573
573
|
}
|
|
574
|
-
|
|
574
|
+
w.type === "NOOP" && w.skip > 0 ? (b = b - (w.skip + 1), r.skip += w.skip + 1) : (r.document.clipboard.push({ ...w }), h--, b--);
|
|
575
575
|
}
|
|
576
|
-
r.action =
|
|
576
|
+
r.action = ae(n);
|
|
577
577
|
});
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
const { scope:
|
|
579
|
+
function $e(t, e, i) {
|
|
580
|
+
const { scope: n, input: o } = e;
|
|
581
581
|
return pt({
|
|
582
582
|
document: t,
|
|
583
583
|
action: e,
|
|
584
|
-
skip:
|
|
584
|
+
skip: i
|
|
585
585
|
}, (r) => {
|
|
586
586
|
if (r.skip > 0)
|
|
587
587
|
throw new Error(
|
|
@@ -596,11 +596,11 @@ function Ee(t, e, n) {
|
|
|
596
596
|
if (r.document.clipboard.length < 1)
|
|
597
597
|
throw new Error("Cannot redo: no operations in the clipboard");
|
|
598
598
|
const p = r.document.clipboard.findLastIndex(
|
|
599
|
-
(d) => d.scope ===
|
|
599
|
+
(d) => d.scope === n
|
|
600
600
|
);
|
|
601
601
|
if (p < 0)
|
|
602
602
|
throw new Error(
|
|
603
|
-
`Cannot redo: no operations in clipboard for scope "${
|
|
603
|
+
`Cannot redo: no operations in clipboard for scope "${n}"`
|
|
604
604
|
);
|
|
605
605
|
const m = r.document.clipboard.splice(p, 1)[0];
|
|
606
606
|
r.action = at({
|
|
@@ -610,8 +610,8 @@ function Ee(t, e, n) {
|
|
|
610
610
|
});
|
|
611
611
|
});
|
|
612
612
|
}
|
|
613
|
-
function
|
|
614
|
-
const { scope:
|
|
613
|
+
function ke(t, e, i) {
|
|
614
|
+
const { scope: n } = e, o = t.operations[n];
|
|
615
615
|
let {
|
|
616
616
|
input: { start: a, end: r }
|
|
617
617
|
} = e;
|
|
@@ -620,69 +620,69 @@ function $e(t, e, n) {
|
|
|
620
620
|
t.initialState,
|
|
621
621
|
{
|
|
622
622
|
...t.operations,
|
|
623
|
-
[
|
|
623
|
+
[n]: m.concat(p)
|
|
624
624
|
},
|
|
625
|
-
|
|
626
|
-
), { name: b, state:
|
|
625
|
+
i
|
|
626
|
+
), { name: b, state: w } = h, N = m.length, $ = m.length ? m[m.length - 1].timestamp : d.length ? d[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
627
627
|
return gt(
|
|
628
628
|
t.initialState,
|
|
629
629
|
{
|
|
630
630
|
...t.operations,
|
|
631
|
-
[
|
|
631
|
+
[n]: [
|
|
632
632
|
...m,
|
|
633
633
|
{
|
|
634
634
|
...Et(
|
|
635
|
-
{ name: b, state:
|
|
635
|
+
{ name: b, state: w },
|
|
636
636
|
p.length
|
|
637
637
|
),
|
|
638
|
-
timestamp:
|
|
639
|
-
index:
|
|
640
|
-
hash: jt({ state:
|
|
638
|
+
timestamp: $,
|
|
639
|
+
index: N,
|
|
640
|
+
hash: jt({ state: w }, "global")
|
|
641
641
|
},
|
|
642
642
|
...d.map((P, C) => ({
|
|
643
643
|
...P,
|
|
644
|
-
index:
|
|
644
|
+
index: N + C + 1
|
|
645
645
|
}))
|
|
646
646
|
]
|
|
647
647
|
},
|
|
648
|
-
|
|
648
|
+
i
|
|
649
649
|
);
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function De(t, e) {
|
|
652
652
|
return {
|
|
653
653
|
...t,
|
|
654
654
|
name: e.name,
|
|
655
655
|
state: e.state ?? { global: {}, local: {} }
|
|
656
656
|
};
|
|
657
657
|
}
|
|
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"] };
|
|
658
|
+
const qt = "SET_NAME", tt = "UNDO", et = "REDO", ct = "PRUNE", Ut = "LOAD_STATE", Te = "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
659
|
Object.freeze(Jt);
|
|
660
|
-
var L = function(t, e,
|
|
661
|
-
if (
|
|
660
|
+
var L = function(t, e, i, n) {
|
|
661
|
+
if (i === "a" && !n)
|
|
662
662
|
throw new TypeError("Private accessor was defined without a getter");
|
|
663
|
-
if (typeof e == "function" ? t !== e || !
|
|
663
|
+
if (typeof e == "function" ? t !== e || !n : !e.has(t))
|
|
664
664
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
665
|
-
return
|
|
666
|
-
}, B, Q,
|
|
667
|
-
class
|
|
665
|
+
return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
|
|
666
|
+
}, B, Q, X;
|
|
667
|
+
class _e {
|
|
668
668
|
constructor(...e) {
|
|
669
|
-
B.set(this, /* @__PURE__ */ new Map()), Q.set(this, /* @__PURE__ */ new Map()),
|
|
670
|
-
for (const
|
|
671
|
-
this.define(
|
|
669
|
+
B.set(this, /* @__PURE__ */ new Map()), Q.set(this, /* @__PURE__ */ new Map()), X.set(this, /* @__PURE__ */ new Map());
|
|
670
|
+
for (const i of e)
|
|
671
|
+
this.define(i);
|
|
672
672
|
}
|
|
673
|
-
define(e,
|
|
674
|
-
for (let [
|
|
675
|
-
|
|
676
|
-
const a = L(this,
|
|
673
|
+
define(e, i = !1) {
|
|
674
|
+
for (let [n, o] of Object.entries(e)) {
|
|
675
|
+
n = n.toLowerCase(), o = o.map((p) => p.toLowerCase()), L(this, X, "f").has(n) || L(this, X, "f").set(n, /* @__PURE__ */ new Set());
|
|
676
|
+
const a = L(this, X, "f").get(n);
|
|
677
677
|
let r = !0;
|
|
678
678
|
for (let p of o) {
|
|
679
679
|
const m = p.startsWith("*");
|
|
680
|
-
if (p = m ? p.slice(1) : p, a == null || a.add(p), r && L(this, Q, "f").set(
|
|
680
|
+
if (p = m ? p.slice(1) : p, a == null || a.add(p), r && L(this, Q, "f").set(n, p), r = !1, m)
|
|
681
681
|
continue;
|
|
682
682
|
const d = L(this, B, "f").get(p);
|
|
683
|
-
if (d && d !=
|
|
684
|
-
throw new Error(`"${
|
|
685
|
-
L(this, B, "f").set(p,
|
|
683
|
+
if (d && d != n && !i)
|
|
684
|
+
throw new Error(`"${n} -> ${p}" conflicts with "${d} -> ${p}". Pass \`force=true\` to override this definition.`);
|
|
685
|
+
L(this, B, "f").set(p, n);
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
return this;
|
|
@@ -690,21 +690,21 @@ class Te {
|
|
|
690
690
|
getType(e) {
|
|
691
691
|
if (typeof e != "string")
|
|
692
692
|
return null;
|
|
693
|
-
const
|
|
694
|
-
return !(
|
|
693
|
+
const i = e.replace(/^.*[/\\]/, "").toLowerCase(), n = i.replace(/^.*\./, "").toLowerCase(), o = i.length < e.length;
|
|
694
|
+
return !(n.length < i.length - 1) && o ? null : L(this, B, "f").get(n) ?? null;
|
|
695
695
|
}
|
|
696
696
|
getExtension(e) {
|
|
697
|
-
var
|
|
698
|
-
return typeof e != "string" ? null : (e = (
|
|
697
|
+
var i;
|
|
698
|
+
return typeof e != "string" ? null : (e = (i = e == null ? void 0 : e.split) == null ? void 0 : i.call(e, ";")[0], (e && L(this, Q, "f").get(e.trim().toLowerCase())) ?? null);
|
|
699
699
|
}
|
|
700
700
|
getAllExtensions(e) {
|
|
701
|
-
return typeof e != "string" ? null : L(this,
|
|
701
|
+
return typeof e != "string" ? null : L(this, X, "f").get(e.toLowerCase()) ?? null;
|
|
702
702
|
}
|
|
703
703
|
_freeze() {
|
|
704
704
|
this.define = () => {
|
|
705
705
|
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
706
|
}, Object.freeze(this);
|
|
707
|
-
for (const e of L(this,
|
|
707
|
+
for (const e of L(this, X, "f").values())
|
|
708
708
|
Object.freeze(e);
|
|
709
709
|
return this;
|
|
710
710
|
}
|
|
@@ -715,14 +715,14 @@ class Te {
|
|
|
715
715
|
};
|
|
716
716
|
}
|
|
717
717
|
}
|
|
718
|
-
B = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(),
|
|
719
|
-
const
|
|
720
|
-
function Ne(t, e,
|
|
721
|
-
const
|
|
718
|
+
B = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap();
|
|
719
|
+
const ve = new _e(Jt)._freeze();
|
|
720
|
+
function Ne(t, e, i) {
|
|
721
|
+
const n = ge(t, e);
|
|
722
722
|
return ut.mkdirSync(t, { recursive: !0 }), new Promise((o, a) => {
|
|
723
723
|
try {
|
|
724
|
-
ut.writeFile(
|
|
725
|
-
r ? a(r) : o(
|
|
724
|
+
ut.writeFile(n, i, {}, (r) => {
|
|
725
|
+
r ? a(r) : o(n);
|
|
726
726
|
});
|
|
727
727
|
} catch (r) {
|
|
728
728
|
a(r);
|
|
@@ -732,25 +732,25 @@ function Ne(t, e, n) {
|
|
|
732
732
|
function Vt(t) {
|
|
733
733
|
return ut.readFileSync(t);
|
|
734
734
|
}
|
|
735
|
-
function
|
|
736
|
-
return new Promise((e,
|
|
737
|
-
|
|
738
|
-
const o = [], a =
|
|
739
|
-
|
|
735
|
+
function Ie(t) {
|
|
736
|
+
return new Promise((e, i) => {
|
|
737
|
+
de.get(t, (n) => {
|
|
738
|
+
const o = [], a = n.headers["content-type"];
|
|
739
|
+
n.on("data", (r) => {
|
|
740
740
|
o.push(r);
|
|
741
|
-
}),
|
|
741
|
+
}), n.on("end", () => {
|
|
742
742
|
e({ buffer: Buffer.concat(o), mimeType: a });
|
|
743
743
|
});
|
|
744
|
-
}).on("error", (
|
|
745
|
-
n
|
|
744
|
+
}).on("error", (n) => {
|
|
745
|
+
i(n);
|
|
746
746
|
});
|
|
747
747
|
});
|
|
748
748
|
}
|
|
749
|
-
const
|
|
750
|
-
function
|
|
751
|
-
const e = [],
|
|
752
|
-
for (const
|
|
753
|
-
const o = t[
|
|
749
|
+
const Ae = async (t) => Vt(t), lt = (t, e = "sha1") => fe.createHash(e).update(t).digest("base64");
|
|
750
|
+
function Pe(t) {
|
|
751
|
+
const e = [], i = Object.keys(t);
|
|
752
|
+
for (const n of i) {
|
|
753
|
+
const o = t[n].sort((a, r) => a.index - r.index);
|
|
754
754
|
for (let a = 0; a < o.length; a++)
|
|
755
755
|
o[a].index !== a && e.push({
|
|
756
756
|
message: `Invalid operation index ${o[a].index} at position ${a}`,
|
|
@@ -763,10 +763,10 @@ function Ae(t) {
|
|
|
763
763
|
}
|
|
764
764
|
return e;
|
|
765
765
|
}
|
|
766
|
-
const
|
|
767
|
-
const e = new Dt(), { name:
|
|
768
|
-
name:
|
|
769
|
-
revision:
|
|
766
|
+
const Ht = async (t) => {
|
|
767
|
+
const e = new Dt(), { name: i, revision: n, documentType: o, created: a, lastModified: r } = t, p = {
|
|
768
|
+
name: i,
|
|
769
|
+
revision: n,
|
|
770
770
|
documentType: o,
|
|
771
771
|
created: a,
|
|
772
772
|
lastModified: r
|
|
@@ -782,31 +782,31 @@ const Xt = async (t) => {
|
|
|
782
782
|
comment: JSON.stringify(b)
|
|
783
783
|
});
|
|
784
784
|
}), e;
|
|
785
|
-
},
|
|
786
|
-
const a = await (await
|
|
785
|
+
}, Me = async (t, e, i, n) => {
|
|
786
|
+
const a = await (await Ht(t)).generateAsync({
|
|
787
787
|
type: "uint8array",
|
|
788
788
|
streamFiles: !0
|
|
789
|
-
}), r =
|
|
789
|
+
}), r = n ?? t.name, p = `.${i}.zip`;
|
|
790
790
|
return Ne(
|
|
791
791
|
e,
|
|
792
792
|
r.endsWith(p) ? r : `${r}${p}`,
|
|
793
793
|
a
|
|
794
794
|
);
|
|
795
|
-
},
|
|
796
|
-
const
|
|
797
|
-
await o.write(
|
|
798
|
-
}, $t = async (t, e,
|
|
799
|
-
const
|
|
800
|
-
return
|
|
801
|
-
},
|
|
802
|
-
const
|
|
803
|
-
return await
|
|
795
|
+
}, li = async (t, e) => {
|
|
796
|
+
const n = await (await Ht(t)).generateAsync({ type: "blob" }), o = await e.createWritable();
|
|
797
|
+
await o.write(n), await o.close();
|
|
798
|
+
}, $t = async (t, e, i) => {
|
|
799
|
+
const n = Vt(t);
|
|
800
|
+
return ze(n, e, i);
|
|
801
|
+
}, ze = async (t, e, i) => {
|
|
802
|
+
const n = new Dt();
|
|
803
|
+
return await n.loadAsync(t), Re(n, e, i);
|
|
804
804
|
};
|
|
805
|
-
async function
|
|
806
|
-
const
|
|
807
|
-
if (!
|
|
805
|
+
async function Re(t, e, i) {
|
|
806
|
+
const n = t.file("state.json");
|
|
807
|
+
if (!n)
|
|
808
808
|
throw new Error("Initial state not found");
|
|
809
|
-
const o = await
|
|
809
|
+
const o = await n.async("string"), a = JSON.parse(o), r = t.file("header.json");
|
|
810
810
|
let p;
|
|
811
811
|
r && (p = JSON.parse(await r.async("string")));
|
|
812
812
|
const m = t.file("operations.json");
|
|
@@ -814,159 +814,159 @@ async function ze(t, e, n) {
|
|
|
814
814
|
throw new Error("Operations history not found");
|
|
815
815
|
const d = JSON.parse(
|
|
816
816
|
await m.async("string")
|
|
817
|
-
), h =
|
|
817
|
+
), h = Pe(d);
|
|
818
818
|
if (h.length) {
|
|
819
|
-
const
|
|
820
|
-
throw new Error(
|
|
819
|
+
const w = h.map((N) => N.message);
|
|
820
|
+
throw new Error(w.join(`
|
|
821
821
|
`));
|
|
822
822
|
}
|
|
823
|
-
let b =
|
|
823
|
+
let b = ee(
|
|
824
824
|
a,
|
|
825
825
|
d,
|
|
826
826
|
e,
|
|
827
827
|
void 0,
|
|
828
828
|
p,
|
|
829
829
|
{},
|
|
830
|
-
|
|
830
|
+
i
|
|
831
831
|
);
|
|
832
832
|
return p && (b = {
|
|
833
833
|
...b,
|
|
834
834
|
...p
|
|
835
835
|
}), b;
|
|
836
836
|
}
|
|
837
|
-
function
|
|
838
|
-
const e = t.replace(/^.*\./, "") || void 0,
|
|
839
|
-
return { extension: e, fileName:
|
|
837
|
+
function Xt(t) {
|
|
838
|
+
const e = t.replace(/^.*\./, "") || void 0, i = t.replace(/^.*[/\\]/, "") || void 0;
|
|
839
|
+
return { extension: e, fileName: i };
|
|
840
840
|
}
|
|
841
|
-
async function
|
|
842
|
-
const { buffer: e, mimeType:
|
|
841
|
+
async function mi(t) {
|
|
842
|
+
const { buffer: e, mimeType: i = "application/octet-stream" } = await Ie(t), n = Xt(t), o = e.toString("base64");
|
|
843
843
|
return {
|
|
844
844
|
data: o,
|
|
845
845
|
hash: lt(o),
|
|
846
|
-
mimeType:
|
|
847
|
-
...
|
|
846
|
+
mimeType: i,
|
|
847
|
+
...n
|
|
848
848
|
};
|
|
849
849
|
}
|
|
850
|
-
async function
|
|
851
|
-
const e = await
|
|
852
|
-
return { data: o, hash: lt(o), mimeType:
|
|
850
|
+
async function ui(t) {
|
|
851
|
+
const e = await Ae(t), i = ve.getType(t) || "application/octet-stream", n = Xt(t), o = e.toString("base64");
|
|
852
|
+
return { data: o, hash: lt(o), mimeType: i, ...n };
|
|
853
853
|
}
|
|
854
854
|
var Bt = /* @__PURE__ */ ((t) => (t.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", t))(Bt || {}), Kt = /* @__PURE__ */ ((t) => (t.DUPLICATED_INDEX = "DUPLICATED_INDEX", t.MISSING_INDEX = "MISSING_INDEX", t))(Kt || {});
|
|
855
855
|
function Ot(t) {
|
|
856
856
|
const e = [];
|
|
857
|
-
let
|
|
858
|
-
for (const
|
|
859
|
-
const o =
|
|
860
|
-
o !==
|
|
857
|
+
let i = -1;
|
|
858
|
+
for (const n of t) {
|
|
859
|
+
const o = n.index - n.skip;
|
|
860
|
+
o !== i + 1 && e.push({
|
|
861
861
|
operation: {
|
|
862
|
-
index:
|
|
863
|
-
skip:
|
|
862
|
+
index: n.index,
|
|
863
|
+
skip: n.skip
|
|
864
864
|
},
|
|
865
865
|
issue: "UNEXPECTED_INDEX",
|
|
866
|
-
category: o >
|
|
867
|
-
message: `Expected index ${
|
|
868
|
-
}),
|
|
866
|
+
category: o > i + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
|
|
867
|
+
message: `Expected index ${i + 1} with skip 0 or equivalent, got index ${n.index} with skip ${n.skip}`
|
|
868
|
+
}), i = n.index;
|
|
869
869
|
}
|
|
870
870
|
return e;
|
|
871
871
|
}
|
|
872
872
|
function V(t) {
|
|
873
|
-
var
|
|
873
|
+
var n, o, a;
|
|
874
874
|
const e = [];
|
|
875
|
-
let
|
|
876
|
-
for (;
|
|
877
|
-
e.unshift(t[
|
|
878
|
-
const r = (((
|
|
879
|
-
let p =
|
|
875
|
+
let i = t.length - 1;
|
|
876
|
+
for (; i > -1; ) {
|
|
877
|
+
e.unshift(t[i]);
|
|
878
|
+
const r = (((n = t[i]) == null ? void 0 : n.index) || 0) - (((o = t[i]) == null ? void 0 : o.skip) || 0) - 1;
|
|
879
|
+
let p = i - 1;
|
|
880
880
|
for (; p > -1 && (((a = t[p]) == null ? void 0 : a.index) || 0) > r; )
|
|
881
881
|
p--;
|
|
882
|
-
|
|
882
|
+
i = p;
|
|
883
883
|
}
|
|
884
884
|
return e;
|
|
885
885
|
}
|
|
886
|
-
function
|
|
887
|
-
const e = [...t],
|
|
888
|
-
return
|
|
889
|
-
...
|
|
890
|
-
index:
|
|
886
|
+
function Ce(t) {
|
|
887
|
+
const e = [...t], i = e[e.length - 1];
|
|
888
|
+
return i && (i.type === "NOOP" ? e.push({
|
|
889
|
+
...i,
|
|
890
|
+
index: i.index,
|
|
891
891
|
type: "NOOP",
|
|
892
892
|
skip: Zt(t)
|
|
893
893
|
}) : e.push({
|
|
894
894
|
type: "NOOP",
|
|
895
|
-
index:
|
|
895
|
+
index: i.index + 1,
|
|
896
896
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
897
897
|
input: {},
|
|
898
898
|
skip: 1,
|
|
899
|
-
scope:
|
|
900
|
-
hash:
|
|
899
|
+
scope: i.scope,
|
|
900
|
+
hash: i.hash
|
|
901
901
|
})), e;
|
|
902
902
|
}
|
|
903
|
-
function
|
|
904
|
-
return t.slice().sort((e,
|
|
903
|
+
function H(t) {
|
|
904
|
+
return t.slice().sort((e, i) => e.skip - i.skip).sort((e, i) => e.index - i.index);
|
|
905
905
|
}
|
|
906
|
-
const
|
|
907
|
-
(
|
|
908
|
-
).map((
|
|
909
|
-
...
|
|
906
|
+
const Fe = (t, e, i) => [...e, ...i].sort(
|
|
907
|
+
(n, o) => new Date(n.timestamp).getTime() - new Date(o.timestamp).getTime()
|
|
908
|
+
).map((n, o) => ({
|
|
909
|
+
...n,
|
|
910
910
|
index: t.index + o,
|
|
911
911
|
skip: o === 0 ? t.skip : 0
|
|
912
|
-
})),
|
|
913
|
-
(
|
|
914
|
-
).sort((
|
|
915
|
-
...
|
|
912
|
+
})), Le = (t, e, i) => [...e, ...i].sort(
|
|
913
|
+
(n, o) => new Date(n.timestamp).getTime() - new Date(o.timestamp).getTime()
|
|
914
|
+
).sort((n, o) => n.index - o.index).map((n, o) => ({
|
|
915
|
+
...n,
|
|
916
916
|
index: t.index + o,
|
|
917
917
|
skip: o === 0 ? t.skip : 0
|
|
918
918
|
}));
|
|
919
919
|
function St(t, e) {
|
|
920
920
|
return K(t) === K(e);
|
|
921
921
|
}
|
|
922
|
-
function
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
return [
|
|
922
|
+
function qe(t, e) {
|
|
923
|
+
const i = V(H(t.slice())), n = V(H(e.slice()));
|
|
924
|
+
if (i.length < 1)
|
|
925
|
+
return [n, []];
|
|
926
926
|
const o = [];
|
|
927
927
|
let a = !1;
|
|
928
|
-
for (;
|
|
929
|
-
const r =
|
|
930
|
-
let p =
|
|
928
|
+
for (; n.length > 0; ) {
|
|
929
|
+
const r = n[0];
|
|
930
|
+
let p = i.shift();
|
|
931
931
|
for (; p && Wt(p, r); )
|
|
932
|
-
o.push(p), p =
|
|
933
|
-
if (p ? a || (St(p, r) ? (
|
|
934
|
-
let m =
|
|
932
|
+
o.push(p), p = i.shift();
|
|
933
|
+
if (p ? a || (St(p, r) ? (n.shift(), o.push(p)) : (i.unshift(p), a = !0)) : a = !0, a) {
|
|
934
|
+
let m = n.shift();
|
|
935
935
|
for (; m; )
|
|
936
|
-
o.push(m), m =
|
|
936
|
+
o.push(m), m = n.shift();
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
if (!a) {
|
|
940
|
-
let r =
|
|
940
|
+
let r = i.shift();
|
|
941
941
|
for (; r; )
|
|
942
|
-
o.push(r), r =
|
|
942
|
+
o.push(r), r = i.shift();
|
|
943
943
|
}
|
|
944
|
-
return [V(o),
|
|
944
|
+
return [V(o), i];
|
|
945
945
|
}
|
|
946
946
|
function Wt(t, e) {
|
|
947
947
|
return t.index < e.index || t.index === e.index && t.skip < e.skip;
|
|
948
948
|
}
|
|
949
949
|
function Gt(t, e) {
|
|
950
|
-
const
|
|
950
|
+
const i = [], n = [], o = [], a = Math.max(
|
|
951
951
|
t.length,
|
|
952
952
|
e.length
|
|
953
953
|
);
|
|
954
954
|
let r = !1;
|
|
955
955
|
for (let p = 0; p < a; p++) {
|
|
956
956
|
const m = t[p], d = e[p];
|
|
957
|
-
m && d ? !r && St(m, d) ?
|
|
957
|
+
m && d ? !r && St(m, d) ? i.push(m) : (r = !0, n.push(m), o.push(d)) : m ? n.push(m) : d && o.push(d);
|
|
958
958
|
}
|
|
959
|
-
return [
|
|
959
|
+
return [i, n, o];
|
|
960
960
|
}
|
|
961
|
-
function
|
|
962
|
-
const [
|
|
961
|
+
function Ue(t, e, i) {
|
|
962
|
+
const [n, o, a] = Gt(
|
|
963
963
|
V(t),
|
|
964
964
|
V(e)
|
|
965
|
-
), r = mt(
|
|
965
|
+
), r = mt(n), p = 1 + Math.max(
|
|
966
966
|
r,
|
|
967
967
|
mt(o),
|
|
968
968
|
mt(a)
|
|
969
|
-
), m =
|
|
969
|
+
), m = i(
|
|
970
970
|
{
|
|
971
971
|
index: p,
|
|
972
972
|
skip: p - (r + 1)
|
|
@@ -974,34 +974,34 @@ function qe(t, e, n) {
|
|
|
974
974
|
o,
|
|
975
975
|
a
|
|
976
976
|
);
|
|
977
|
-
return
|
|
977
|
+
return n.concat(m);
|
|
978
978
|
}
|
|
979
979
|
function mt(t) {
|
|
980
980
|
const e = t[t.length - 1];
|
|
981
981
|
return e ? e.index : -1;
|
|
982
982
|
}
|
|
983
983
|
function Zt(t) {
|
|
984
|
-
var
|
|
984
|
+
var n, o, a;
|
|
985
985
|
if (t.length < 1)
|
|
986
986
|
return -1;
|
|
987
987
|
const e = V(t);
|
|
988
|
-
let
|
|
989
|
-
return e.length > 1 && (
|
|
988
|
+
let i = (((n = e[e.length - 1]) == null ? void 0 : n.skip) || 0) + 1;
|
|
989
|
+
return e.length > 1 && (i += ((o = e[e.length - 2]) == null ? void 0 : o.skip) || 0), (((a = e[e.length - 1]) == null ? void 0 : a.index) || -1) < i ? -1 : i;
|
|
990
990
|
}
|
|
991
|
-
const
|
|
992
|
-
V(
|
|
993
|
-
),
|
|
991
|
+
const Je = (t) => Ot(
|
|
992
|
+
V(H(t))
|
|
993
|
+
), Ve = (t) => t.reduce((i, n) => {
|
|
994
994
|
var o;
|
|
995
|
-
return n
|
|
996
|
-
}, {}),
|
|
995
|
+
return i[n.scope] || (i[n.scope] = []), (o = i[n.scope]) == null || o.push(n), i;
|
|
996
|
+
}, {}), He = (t, e) => {
|
|
997
997
|
var m;
|
|
998
|
-
const
|
|
998
|
+
const i = {
|
|
999
999
|
integrityIssues: [],
|
|
1000
1000
|
validOperations: [],
|
|
1001
1001
|
invalidOperations: [],
|
|
1002
1002
|
duplicatedOperations: []
|
|
1003
|
-
},
|
|
1004
|
-
...
|
|
1003
|
+
}, n = H(t), o = H(e), a = Ot([
|
|
1004
|
+
...n,
|
|
1005
1005
|
...o
|
|
1006
1006
|
]), p = (m = [...a.filter(
|
|
1007
1007
|
(d) => d.category === "MISSING_INDEX"
|
|
@@ -1009,142 +1009,136 @@ const Ue = (t) => Ot(
|
|
|
1009
1009
|
)].sort((d, h) => h.operation.index - d.operation.index).pop()) == null ? void 0 : m.operation;
|
|
1010
1010
|
for (const d of o) {
|
|
1011
1011
|
if (p && d.index >= p.index) {
|
|
1012
|
-
|
|
1012
|
+
i.invalidOperations.push(d);
|
|
1013
1013
|
continue;
|
|
1014
1014
|
}
|
|
1015
1015
|
if (a.some((b) => b.operation.index === d.index && b.operation.skip === d.skip && b.category === "DUPLICATED_INDEX")) {
|
|
1016
|
-
|
|
1016
|
+
i.duplicatedOperations.push(d);
|
|
1017
1017
|
continue;
|
|
1018
1018
|
}
|
|
1019
|
-
|
|
1019
|
+
i.validOperations.push(d);
|
|
1020
1020
|
}
|
|
1021
|
-
return
|
|
1021
|
+
return i.integrityIssues.push(...a), i;
|
|
1022
1022
|
};
|
|
1023
1023
|
function Xe(t, e) {
|
|
1024
|
-
return t.filter((
|
|
1024
|
+
return t.filter((i) => !e.some((n) => i.type === "NOOP" && i.skip === 0 && i.index === n.index || i.index === n.index && i.skip === n.skip && i.scope === n.scope && i.hash === n.hash && i.type === n.type));
|
|
1025
1025
|
}
|
|
1026
1026
|
function Qt(t, e) {
|
|
1027
|
-
const [
|
|
1027
|
+
const [i] = H(t).slice(-1), n = (i == null ? void 0 : i.index) ?? -1, o = n + 1, a = {
|
|
1028
1028
|
...e,
|
|
1029
1029
|
index: e.index ?? o
|
|
1030
1030
|
};
|
|
1031
|
-
if (a.index <
|
|
1031
|
+
if (a.index < n)
|
|
1032
1032
|
throw new Error(
|
|
1033
|
-
`The skip header operation index must be greater than or equal to ${
|
|
1033
|
+
`The skip header operation index must be greater than or equal to ${n}`
|
|
1034
1034
|
);
|
|
1035
1035
|
return (V(
|
|
1036
|
-
|
|
1036
|
+
H([...t, a])
|
|
1037
1037
|
) || []).slice(0, -1);
|
|
1038
1038
|
}
|
|
1039
1039
|
function dt(t) {
|
|
1040
1040
|
return {
|
|
1041
1041
|
...Object.entries(t).reduce(
|
|
1042
|
-
(
|
|
1043
|
-
const [o, a] =
|
|
1042
|
+
(i, n) => {
|
|
1043
|
+
const [o, a] = n;
|
|
1044
1044
|
return {
|
|
1045
|
-
...
|
|
1046
|
-
[o]: V(
|
|
1045
|
+
...i,
|
|
1046
|
+
[o]: V(H(a))
|
|
1047
1047
|
};
|
|
1048
1048
|
},
|
|
1049
1049
|
{}
|
|
1050
1050
|
)
|
|
1051
1051
|
};
|
|
1052
1052
|
}
|
|
1053
|
-
const
|
|
1053
|
+
const fi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1054
1054
|
__proto__: null,
|
|
1055
1055
|
IntegrityIssueSubType: Kt,
|
|
1056
1056
|
IntegrityIssueType: Bt,
|
|
1057
|
-
addUndo:
|
|
1058
|
-
attachBranch:
|
|
1057
|
+
addUndo: Ce,
|
|
1058
|
+
attachBranch: qe,
|
|
1059
1059
|
checkCleanedOperationsIntegrity: Ot,
|
|
1060
|
-
checkOperationsIntegrity:
|
|
1060
|
+
checkOperationsIntegrity: Je,
|
|
1061
1061
|
garbageCollect: V,
|
|
1062
1062
|
garbageCollectDocumentOperations: dt,
|
|
1063
|
-
groupOperationsByScope:
|
|
1064
|
-
merge:
|
|
1063
|
+
groupOperationsByScope: Ve,
|
|
1064
|
+
merge: Ue,
|
|
1065
1065
|
nextSkipNumber: Zt,
|
|
1066
1066
|
operationsAreEqual: St,
|
|
1067
1067
|
precedes: Wt,
|
|
1068
|
-
prepareOperations:
|
|
1068
|
+
prepareOperations: He,
|
|
1069
1069
|
removeExistingOperations: Xe,
|
|
1070
|
-
reshuffleByTimestamp:
|
|
1071
|
-
reshuffleByTimestampAndIndex:
|
|
1070
|
+
reshuffleByTimestamp: Fe,
|
|
1071
|
+
reshuffleByTimestampAndIndex: Le,
|
|
1072
1072
|
skipHeaderOperations: Qt,
|
|
1073
|
-
sortOperations:
|
|
1073
|
+
sortOperations: H,
|
|
1074
1074
|
split: Gt
|
|
1075
1075
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1076
|
-
function He(t, e) {
|
|
1077
|
-
let n;
|
|
1078
|
-
return "index" in e ? n = { ...e } : n = t.operations[e.scope].at(-1), ((n == null ? void 0 : n.index) ?? -1) + 1;
|
|
1079
|
-
}
|
|
1080
1076
|
function Be(t, e) {
|
|
1077
|
+
let i;
|
|
1078
|
+
return "index" in e ? i = { ...e } : i = t.operations[e.scope].at(-1), ((i == null ? void 0 : i.index) ?? -1) + 1;
|
|
1079
|
+
}
|
|
1080
|
+
function Yt(t, e) {
|
|
1081
1081
|
return {
|
|
1082
1082
|
...t,
|
|
1083
1083
|
revision: {
|
|
1084
1084
|
...t.revision,
|
|
1085
|
-
[e.scope]:
|
|
1085
|
+
[e.scope]: Be(t, e)
|
|
1086
1086
|
},
|
|
1087
1087
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
1088
1088
|
};
|
|
1089
1089
|
}
|
|
1090
|
-
function Ke(t, e,
|
|
1090
|
+
function Ke(t, e, i = 0) {
|
|
1091
1091
|
if ([tt, et, ct].includes(e.type))
|
|
1092
1092
|
return t;
|
|
1093
|
-
const { scope:
|
|
1094
|
-
let
|
|
1093
|
+
const { scope: n } = e, o = t.operations[n].slice(), a = o.at(-1);
|
|
1094
|
+
let r = ((a == null ? void 0 : a.index) ?? -1) + 1;
|
|
1095
1095
|
if ("index" in e) {
|
|
1096
|
-
if (e.index -
|
|
1096
|
+
if (e.index - i > r)
|
|
1097
1097
|
throw new Error(
|
|
1098
|
-
`Missing operations: expected ${
|
|
1098
|
+
`Missing operations: expected ${r} with skip 0 or equivalent, got index ${e.index} with skip ${i}`
|
|
1099
1099
|
);
|
|
1100
|
-
|
|
1100
|
+
r = e.index;
|
|
1101
1101
|
}
|
|
1102
|
-
|
|
1102
|
+
return o.push({
|
|
1103
1103
|
...e,
|
|
1104
|
-
index:
|
|
1104
|
+
index: r,
|
|
1105
1105
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1106
1106
|
hash: "",
|
|
1107
|
-
scope:
|
|
1108
|
-
skip:
|
|
1107
|
+
scope: n,
|
|
1108
|
+
skip: i,
|
|
1109
1109
|
error: void 0
|
|
1110
|
-
}
|
|
1111
|
-
return i && (m.resultingState = t.state[o]), a.push(m), {
|
|
1110
|
+
}), {
|
|
1112
1111
|
...t,
|
|
1113
|
-
operations: { ...t.operations, [
|
|
1112
|
+
operations: { ...t.operations, [n]: o }
|
|
1114
1113
|
};
|
|
1115
1114
|
}
|
|
1116
|
-
function We(t, e,
|
|
1117
|
-
let
|
|
1118
|
-
|
|
1119
|
-
e,
|
|
1120
|
-
n,
|
|
1121
|
-
i
|
|
1122
|
-
);
|
|
1123
|
-
return o = Be(o, e), o;
|
|
1115
|
+
function We(t, e, i = 0) {
|
|
1116
|
+
let n = Ke(t, e, i);
|
|
1117
|
+
return n = Yt(n, e), n;
|
|
1124
1118
|
}
|
|
1125
|
-
function Ge(t, e,
|
|
1119
|
+
function Ge(t, e, i) {
|
|
1126
1120
|
switch (Pt().parse(e), e.type) {
|
|
1127
1121
|
case qt:
|
|
1128
|
-
return
|
|
1122
|
+
return je(t, e.input);
|
|
1129
1123
|
case ct:
|
|
1130
|
-
return
|
|
1124
|
+
return ke(t, e, i);
|
|
1131
1125
|
case Ut:
|
|
1132
|
-
return
|
|
1126
|
+
return De(t, e.input.state);
|
|
1133
1127
|
default:
|
|
1134
1128
|
return t;
|
|
1135
1129
|
}
|
|
1136
1130
|
}
|
|
1137
|
-
function
|
|
1131
|
+
function di(t, e, i) {
|
|
1138
1132
|
switch (e.type) {
|
|
1139
1133
|
case tt:
|
|
1140
|
-
return
|
|
1134
|
+
return Ee(t, e, i);
|
|
1141
1135
|
case et:
|
|
1142
|
-
return
|
|
1136
|
+
return $e(t, e, i);
|
|
1143
1137
|
default:
|
|
1144
|
-
return { document: t, action: e, skip:
|
|
1138
|
+
return { document: t, action: e, skip: i };
|
|
1145
1139
|
}
|
|
1146
1140
|
}
|
|
1147
|
-
function Ze(t, e,
|
|
1141
|
+
function Ze(t, e, i, n, o = !1, a = ie) {
|
|
1148
1142
|
const r = e.scope, p = t.operations[r].at(-1);
|
|
1149
1143
|
if (!p)
|
|
1150
1144
|
return t;
|
|
@@ -1167,7 +1161,7 @@ function Ze(t, e, n, i, o = !1, a = ee) {
|
|
|
1167
1161
|
const { state: b } = gt(
|
|
1168
1162
|
t.initialState,
|
|
1169
1163
|
m,
|
|
1170
|
-
|
|
1164
|
+
i,
|
|
1171
1165
|
void 0,
|
|
1172
1166
|
void 0,
|
|
1173
1167
|
void 0,
|
|
@@ -1191,7 +1185,7 @@ function Ze(t, e, n, i, o = !1, a = ee) {
|
|
|
1191
1185
|
})
|
|
1192
1186
|
};
|
|
1193
1187
|
}
|
|
1194
|
-
function
|
|
1188
|
+
function te(t, e, i, n, o = {}) {
|
|
1195
1189
|
const {
|
|
1196
1190
|
skip: a,
|
|
1197
1191
|
ignoreSkipOperations: r = !1,
|
|
@@ -1199,82 +1193,77 @@ function Yt(t, e, n, i, o = {}) {
|
|
|
1199
1193
|
reuseOperationResultingState: m = !1,
|
|
1200
1194
|
operationResultingStateParser: d
|
|
1201
1195
|
} = o, h = { ...e }, b = a || 0;
|
|
1202
|
-
let
|
|
1203
|
-
const
|
|
1204
|
-
return kt(h) && (
|
|
1205
|
-
|
|
1196
|
+
let w = { ...t };
|
|
1197
|
+
const N = !r && (b > 0 || "index" in h && h.skip > 0);
|
|
1198
|
+
return kt(h) && (w = Ge(w, h, i)), w = We(w, h, b), N && (w = Ze(
|
|
1199
|
+
w,
|
|
1206
1200
|
h,
|
|
1207
|
-
|
|
1208
|
-
m
|
|
1209
|
-
), v && (O = Ze(
|
|
1210
|
-
O,
|
|
1211
|
-
h,
|
|
1212
|
-
n,
|
|
1201
|
+
i,
|
|
1213
1202
|
b,
|
|
1214
1203
|
m,
|
|
1215
1204
|
d
|
|
1216
|
-
)),
|
|
1205
|
+
)), w = pt(w, ($) => {
|
|
1217
1206
|
try {
|
|
1218
|
-
const P =
|
|
1219
|
-
|
|
1207
|
+
const P = i(
|
|
1208
|
+
$.state,
|
|
1220
1209
|
h,
|
|
1221
|
-
|
|
1210
|
+
n
|
|
1222
1211
|
);
|
|
1223
1212
|
if (P)
|
|
1224
1213
|
return at({
|
|
1225
|
-
...
|
|
1214
|
+
...w,
|
|
1226
1215
|
// clipboard: [...clipboardValue],
|
|
1227
1216
|
state: P
|
|
1228
1217
|
});
|
|
1229
1218
|
} catch (P) {
|
|
1230
|
-
const C =
|
|
1231
|
-
|
|
1219
|
+
const C = w.operations[h.scope].length - 1;
|
|
1220
|
+
$.operations[h.scope][C].error = P.message, $.operations[h.scope][C].skip = 0, N && ($.state = at({ ...t.state }), $.operations = at({
|
|
1232
1221
|
...t.operations,
|
|
1233
1222
|
[h.scope]: [
|
|
1234
1223
|
...t.operations[h.scope],
|
|
1235
1224
|
{
|
|
1236
|
-
|
|
1225
|
+
...$.operations[h.scope][C]
|
|
1237
1226
|
}
|
|
1238
1227
|
]
|
|
1239
1228
|
}));
|
|
1240
1229
|
}
|
|
1241
|
-
}), pt(
|
|
1230
|
+
}), pt(w, ($) => {
|
|
1242
1231
|
if ([tt, et, ct].includes(h.type))
|
|
1243
|
-
return
|
|
1244
|
-
const P = h.scope || "global", C = p && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : jt(
|
|
1245
|
-
|
|
1246
|
-
const { hash:
|
|
1247
|
-
|
|
1248
|
-
...
|
|
1232
|
+
return $;
|
|
1233
|
+
const P = h.scope || "global", C = p && Object.prototype.hasOwnProperty.call(h, "hash") ? h.hash : jt($, P), c = $.operations[P].at(-1);
|
|
1234
|
+
c && (c.hash = C, m && (c.resultingState = $.state[P]), !kt(h) && h.attachments && h.attachments.forEach((l) => {
|
|
1235
|
+
const { hash: u, ...D } = l;
|
|
1236
|
+
$.attachments[u] = {
|
|
1237
|
+
...D
|
|
1249
1238
|
};
|
|
1250
|
-
});
|
|
1239
|
+
}));
|
|
1251
1240
|
});
|
|
1252
1241
|
}
|
|
1253
|
-
function
|
|
1254
|
-
return t.type ===
|
|
1242
|
+
function gi(t) {
|
|
1243
|
+
return t.type === Te && t.skip !== void 0 && t.skip > 0 && t.hash !== void 0;
|
|
1255
1244
|
}
|
|
1256
|
-
function
|
|
1245
|
+
function hi(t) {
|
|
1257
1246
|
return [tt, et].includes(t.type);
|
|
1258
1247
|
}
|
|
1259
1248
|
function kt(t) {
|
|
1260
1249
|
return [qt, tt, et, ct, Ut].includes(t.type);
|
|
1261
1250
|
}
|
|
1262
|
-
function W(t, e,
|
|
1251
|
+
function W(t, e, i, n, o = "global") {
|
|
1263
1252
|
if (!t)
|
|
1264
1253
|
throw new Error("Empty action type");
|
|
1265
1254
|
if (typeof t != "string")
|
|
1266
1255
|
throw new Error(`Invalid action type: ${JSON.stringify(t)}`);
|
|
1267
1256
|
const a = { type: t, input: e, scope: o };
|
|
1268
|
-
|
|
1257
|
+
i && (a.attachments = i);
|
|
1269
1258
|
try {
|
|
1270
|
-
|
|
1259
|
+
n == null || n().parse(a.input);
|
|
1271
1260
|
} catch (r) {
|
|
1272
1261
|
throw new Error(`Invalid action input: ${r}`);
|
|
1273
1262
|
}
|
|
1274
1263
|
return a;
|
|
1275
1264
|
}
|
|
1276
|
-
function Qe(t, e =
|
|
1277
|
-
return (
|
|
1265
|
+
function Qe(t, e = te) {
|
|
1266
|
+
return (i, n, o, a) => e(i, n, t, o, a);
|
|
1278
1267
|
}
|
|
1279
1268
|
const Ye = (t, e) => ({
|
|
1280
1269
|
name: "",
|
|
@@ -1288,51 +1277,51 @@ const Ye = (t, e) => ({
|
|
|
1288
1277
|
attachments: {},
|
|
1289
1278
|
...t,
|
|
1290
1279
|
state: (e == null ? void 0 : e(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
|
|
1291
|
-
}),
|
|
1292
|
-
const
|
|
1280
|
+
}), ti = (t, e) => {
|
|
1281
|
+
const i = Ye(
|
|
1293
1282
|
t,
|
|
1294
1283
|
e
|
|
1295
1284
|
);
|
|
1296
1285
|
return {
|
|
1297
|
-
...
|
|
1298
|
-
initialState:
|
|
1286
|
+
...i,
|
|
1287
|
+
initialState: i,
|
|
1299
1288
|
operations: { global: [], local: [] },
|
|
1300
1289
|
clipboard: []
|
|
1301
1290
|
};
|
|
1302
|
-
}, jt = (t, e = "global") => lt(K(t.state[e] || "")),
|
|
1303
|
-
const
|
|
1304
|
-
return lt(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${
|
|
1291
|
+
}, jt = (t, e = "global") => lt(K(t.state[e] || "")), xi = (t, e = 1e3) => {
|
|
1292
|
+
const i = Math.random() * e;
|
|
1293
|
+
return lt(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
|
|
1305
1294
|
};
|
|
1306
1295
|
function rt(t) {
|
|
1307
|
-
return
|
|
1296
|
+
return me(ue(t, !0));
|
|
1308
1297
|
}
|
|
1309
|
-
function
|
|
1310
|
-
const
|
|
1311
|
-
let
|
|
1298
|
+
function yi(t, e) {
|
|
1299
|
+
const i = [...t];
|
|
1300
|
+
let n = e || 0, o = i.length > 0 ? i[i.length - 1].index : 0;
|
|
1312
1301
|
const a = [];
|
|
1313
|
-
for (const r of
|
|
1314
|
-
if (
|
|
1302
|
+
for (const r of i.reverse()) {
|
|
1303
|
+
if (n > 0) {
|
|
1315
1304
|
const d = o - r.index;
|
|
1316
|
-
|
|
1305
|
+
n -= d;
|
|
1317
1306
|
}
|
|
1318
|
-
if (
|
|
1307
|
+
if (n < 0)
|
|
1319
1308
|
throw new Error("Invalid operation index, missing operations");
|
|
1320
1309
|
const p = {
|
|
1321
|
-
ignore:
|
|
1310
|
+
ignore: n > 0,
|
|
1322
1311
|
operation: r
|
|
1323
1312
|
}, m = r.skip > 0 ? r.skip + 1 : 0;
|
|
1324
|
-
if (m > 0 && m >
|
|
1325
|
-
const d = m -
|
|
1326
|
-
|
|
1313
|
+
if (m > 0 && m > n) {
|
|
1314
|
+
const d = m - n;
|
|
1315
|
+
n = n + d;
|
|
1327
1316
|
}
|
|
1328
1317
|
o = r.index, a.push(p);
|
|
1329
1318
|
}
|
|
1330
1319
|
return a.reverse();
|
|
1331
1320
|
}
|
|
1332
|
-
function
|
|
1333
|
-
const
|
|
1334
|
-
let o =
|
|
1335
|
-
for (const p of
|
|
1321
|
+
function bi(t, e, i) {
|
|
1322
|
+
const n = t.slice().sort((p, m) => p.skip - m.skip).sort((p, m) => p.index - m.index);
|
|
1323
|
+
let o = i, a = 0, r = e;
|
|
1324
|
+
for (const p of n.reverse()) {
|
|
1336
1325
|
const m = r - p.index;
|
|
1337
1326
|
if (o = o - m, o > -1)
|
|
1338
1327
|
a++, r = p.index;
|
|
@@ -1341,36 +1330,36 @@ function wn(t, e, n) {
|
|
|
1341
1330
|
}
|
|
1342
1331
|
return a;
|
|
1343
1332
|
}
|
|
1344
|
-
function
|
|
1333
|
+
function wi(t) {
|
|
1345
1334
|
return Object.values(t).flatMap((e) => e).sort(
|
|
1346
|
-
(e,
|
|
1335
|
+
(e, i) => new Date(e.timestamp).getTime() - new Date(i.timestamp).getTime()
|
|
1347
1336
|
);
|
|
1348
1337
|
}
|
|
1349
|
-
function
|
|
1338
|
+
function Oi(t) {
|
|
1350
1339
|
return Object.values(t).flatMap((e) => e).sort(
|
|
1351
|
-
(e,
|
|
1340
|
+
(e, i) => new Date(e.operation.timestamp).getTime() - new Date(i.operation.timestamp).getTime()
|
|
1352
1341
|
);
|
|
1353
1342
|
}
|
|
1354
|
-
function gt(t, e,
|
|
1355
|
-
const m = Qe(
|
|
1356
|
-
return
|
|
1343
|
+
function gt(t, e, i, n, o, a = te, r = {}, p) {
|
|
1344
|
+
const m = Qe(i, a);
|
|
1345
|
+
return ee(
|
|
1357
1346
|
t,
|
|
1358
1347
|
e,
|
|
1359
1348
|
m,
|
|
1360
|
-
|
|
1349
|
+
n,
|
|
1361
1350
|
o,
|
|
1362
1351
|
r,
|
|
1363
1352
|
p
|
|
1364
1353
|
);
|
|
1365
1354
|
}
|
|
1366
|
-
function
|
|
1355
|
+
function ee(t, e, i, n, o, a = {}, r) {
|
|
1367
1356
|
const {
|
|
1368
1357
|
checkHashes: p = !0,
|
|
1369
1358
|
reuseOperationResultingState: m,
|
|
1370
|
-
operationResultingStateParser: d =
|
|
1359
|
+
operationResultingStateParser: d = ie
|
|
1371
1360
|
} = r || {};
|
|
1372
1361
|
let h = t;
|
|
1373
|
-
const b = [],
|
|
1362
|
+
const b = [], w = {
|
|
1374
1363
|
global: [],
|
|
1375
1364
|
local: []
|
|
1376
1365
|
};
|
|
@@ -1383,11 +1372,11 @@ function te(t, e, n, i, o, a = {}, r) {
|
|
|
1383
1372
|
b.push(...l);
|
|
1384
1373
|
continue;
|
|
1385
1374
|
}
|
|
1386
|
-
const
|
|
1375
|
+
const D = l[u];
|
|
1387
1376
|
try {
|
|
1388
1377
|
const F = d(
|
|
1389
1378
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion
|
|
1390
|
-
|
|
1379
|
+
D.resultingState
|
|
1391
1380
|
);
|
|
1392
1381
|
h = {
|
|
1393
1382
|
...h,
|
|
@@ -1396,7 +1385,7 @@ function te(t, e, n, i, o, a = {}, r) {
|
|
|
1396
1385
|
// TODO how to deal with attachments?
|
|
1397
1386
|
[c]: F
|
|
1398
1387
|
}
|
|
1399
|
-
},
|
|
1388
|
+
}, w[c].push(
|
|
1400
1389
|
...l.slice(0, u + 1)
|
|
1401
1390
|
), b.push(...l.slice(u + 1));
|
|
1402
1391
|
} catch {
|
|
@@ -1405,36 +1394,43 @@ function te(t, e, n, i, o, a = {}, r) {
|
|
|
1405
1394
|
}
|
|
1406
1395
|
else
|
|
1407
1396
|
b.push(...Object.values(e).flat());
|
|
1408
|
-
const
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1397
|
+
const N = ti(h);
|
|
1398
|
+
N.initialState = t, N.operations = w;
|
|
1399
|
+
let $ = N;
|
|
1400
|
+
if (b.length)
|
|
1401
|
+
$ = b.reduce((c, l) => i(c, l, n, {
|
|
1402
|
+
skip: l.skip,
|
|
1403
|
+
ignoreSkipOperations: !0,
|
|
1404
|
+
reuseHash: !p
|
|
1405
|
+
}), N);
|
|
1406
|
+
else
|
|
1407
|
+
for (const c of Object.values(w)) {
|
|
1408
|
+
const l = c.at(-1);
|
|
1409
|
+
l && ($ = Yt($, l));
|
|
1410
|
+
}
|
|
1415
1411
|
if (!p)
|
|
1416
|
-
for (const c of Object.keys(
|
|
1412
|
+
for (const c of Object.keys($.state))
|
|
1417
1413
|
for (let l = b.length - 1; l >= 0; l--) {
|
|
1418
1414
|
const u = b[l];
|
|
1419
1415
|
if (u.scope === c) {
|
|
1420
|
-
if (u.hash !== jt(
|
|
1416
|
+
if (u.hash !== jt($, c))
|
|
1421
1417
|
throw new Error(`Hash mismatch for scope ${c}`);
|
|
1422
1418
|
break;
|
|
1423
1419
|
}
|
|
1424
1420
|
}
|
|
1425
1421
|
const P = Object.keys(
|
|
1426
|
-
|
|
1422
|
+
$.operations
|
|
1427
1423
|
).reduce(
|
|
1428
1424
|
(c, l) => {
|
|
1429
1425
|
const u = l;
|
|
1430
1426
|
return {
|
|
1431
1427
|
...c,
|
|
1432
1428
|
[u]: [
|
|
1433
|
-
|
|
1429
|
+
...$.operations[u].map((D, F) => {
|
|
1434
1430
|
var M;
|
|
1435
1431
|
return {
|
|
1436
|
-
...
|
|
1437
|
-
timestamp: ((M = e[u][F]) == null ? void 0 : M.timestamp) ??
|
|
1432
|
+
...D,
|
|
1433
|
+
timestamp: ((M = e[u][F]) == null ? void 0 : M.timestamp) ?? D.timestamp
|
|
1438
1434
|
};
|
|
1439
1435
|
})
|
|
1440
1436
|
]
|
|
@@ -1445,12 +1441,12 @@ function te(t, e, n, i, o, a = {}, r) {
|
|
|
1445
1441
|
const u = l[l.length - 1];
|
|
1446
1442
|
return (u == null ? void 0 : u.timestamp) > c && (c = u.timestamp), c;
|
|
1447
1443
|
}, t.lastModified);
|
|
1448
|
-
return {
|
|
1444
|
+
return { ...$, operations: P, lastModified: C };
|
|
1449
1445
|
}
|
|
1450
|
-
function
|
|
1446
|
+
function Si(t, e) {
|
|
1451
1447
|
return K(t) === K(e);
|
|
1452
1448
|
}
|
|
1453
|
-
function
|
|
1449
|
+
function ie(t) {
|
|
1454
1450
|
const e = typeof t;
|
|
1455
1451
|
if (e === "string")
|
|
1456
1452
|
return JSON.parse(t);
|
|
@@ -1464,61 +1460,61 @@ const ne = (t) => W(
|
|
|
1464
1460
|
void 0,
|
|
1465
1461
|
bt,
|
|
1466
1462
|
void 0
|
|
1467
|
-
),
|
|
1463
|
+
), oe = (t = 1, e = "global") => W(
|
|
1468
1464
|
"UNDO",
|
|
1469
1465
|
t,
|
|
1470
1466
|
void 0,
|
|
1471
1467
|
wt,
|
|
1472
1468
|
e
|
|
1473
|
-
),
|
|
1469
|
+
), se = (t = 1, e = "global") => W(
|
|
1474
1470
|
"REDO",
|
|
1475
1471
|
t,
|
|
1476
1472
|
void 0,
|
|
1477
1473
|
yt,
|
|
1478
1474
|
e
|
|
1479
|
-
),
|
|
1475
|
+
), re = (t, e, i = "global") => W(
|
|
1480
1476
|
"PRUNE",
|
|
1481
1477
|
{ start: t, end: e },
|
|
1482
1478
|
void 0,
|
|
1483
1479
|
xt,
|
|
1484
|
-
|
|
1480
|
+
i
|
|
1485
1481
|
), Et = (t, e) => W(
|
|
1486
1482
|
"LOAD_STATE",
|
|
1487
1483
|
{ state: t, operations: e },
|
|
1488
1484
|
void 0,
|
|
1489
1485
|
ht
|
|
1490
|
-
),
|
|
1486
|
+
), ae = (t = "global") => W("NOOP", {}, void 0, void 0, t), ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1491
1487
|
__proto__: null,
|
|
1492
1488
|
loadState: Et,
|
|
1493
|
-
noop:
|
|
1494
|
-
prune:
|
|
1495
|
-
redo:
|
|
1489
|
+
noop: ae,
|
|
1490
|
+
prune: re,
|
|
1491
|
+
redo: se,
|
|
1496
1492
|
setName: ne,
|
|
1497
|
-
undo:
|
|
1493
|
+
undo: oe
|
|
1498
1494
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1499
|
-
class
|
|
1495
|
+
class Ei {
|
|
1500
1496
|
/**
|
|
1501
1497
|
* Constructs a BaseDocument instance with an initial state.
|
|
1502
1498
|
* @param reducer - The reducer function that updates the state.
|
|
1503
1499
|
* @param document - The initial state of the document.
|
|
1504
1500
|
*/
|
|
1505
|
-
constructor(e,
|
|
1501
|
+
constructor(e, i, n) {
|
|
1506
1502
|
st(this, "_document");
|
|
1507
1503
|
st(this, "_reducer");
|
|
1508
1504
|
st(this, "_signalDispatch");
|
|
1509
|
-
this._reducer = e, this._document =
|
|
1505
|
+
this._reducer = e, this._document = i, this._signalDispatch = n;
|
|
1510
1506
|
}
|
|
1511
1507
|
/**
|
|
1512
1508
|
* Dispatches an action to update the state of the document.
|
|
1513
1509
|
* @param action - The action to dispatch.
|
|
1514
1510
|
* @returns The Document instance.
|
|
1515
1511
|
*/
|
|
1516
|
-
dispatch(e,
|
|
1512
|
+
dispatch(e, i) {
|
|
1517
1513
|
return this._document = this._reducer(
|
|
1518
1514
|
this._document,
|
|
1519
1515
|
e,
|
|
1520
1516
|
this._signalDispatch,
|
|
1521
|
-
|
|
1517
|
+
i
|
|
1522
1518
|
), this;
|
|
1523
1519
|
}
|
|
1524
1520
|
/**
|
|
@@ -1527,8 +1523,8 @@ class $n {
|
|
|
1527
1523
|
* @param extension - The file extension to use when saving the state.
|
|
1528
1524
|
* @returns The file path where the state was saved.
|
|
1529
1525
|
*/
|
|
1530
|
-
saveToFile(e,
|
|
1531
|
-
return
|
|
1526
|
+
saveToFile(e, i, n) {
|
|
1527
|
+
return Me(this._document, e, i, n);
|
|
1532
1528
|
}
|
|
1533
1529
|
/**
|
|
1534
1530
|
* Loads the state of the document from a file.
|
|
@@ -1543,8 +1539,8 @@ class $n {
|
|
|
1543
1539
|
* @param reducer - The reducer function that updates the state.
|
|
1544
1540
|
* @returns The state of the document.
|
|
1545
1541
|
*/
|
|
1546
|
-
static async stateFromFile(e,
|
|
1547
|
-
return await $t(e,
|
|
1542
|
+
static async stateFromFile(e, i) {
|
|
1543
|
+
return await $t(e, i);
|
|
1548
1544
|
}
|
|
1549
1545
|
/**
|
|
1550
1546
|
* Gets the current state of the document.
|
|
@@ -1622,77 +1618,79 @@ class $n {
|
|
|
1622
1618
|
* @param count - The number of actions to revert.
|
|
1623
1619
|
*/
|
|
1624
1620
|
undo(e) {
|
|
1625
|
-
return this.dispatch(
|
|
1621
|
+
return this.dispatch(oe(e)), this;
|
|
1626
1622
|
}
|
|
1627
1623
|
/**
|
|
1628
1624
|
* Reapplies a number of actions to the document.
|
|
1629
1625
|
* @param count - The number of actions to reapply.
|
|
1630
1626
|
*/
|
|
1631
1627
|
redo(e) {
|
|
1632
|
-
return this.dispatch(
|
|
1628
|
+
return this.dispatch(se(e)), this;
|
|
1633
1629
|
}
|
|
1634
1630
|
/**
|
|
1635
1631
|
* Removes a range of operations from the document.
|
|
1636
1632
|
* @param start - The starting index of the range to remove.
|
|
1637
1633
|
* @param end - The ending index of the range to remove.
|
|
1638
1634
|
*/
|
|
1639
|
-
prune(e,
|
|
1640
|
-
return this.dispatch(
|
|
1635
|
+
prune(e, i) {
|
|
1636
|
+
return this.dispatch(re(e, i)), this;
|
|
1641
1637
|
}
|
|
1642
1638
|
/**
|
|
1643
1639
|
* Loads a document state and a set of operations.
|
|
1644
1640
|
* @param state - The state to load.
|
|
1645
1641
|
* @param operations - The operations to apply to the document.
|
|
1646
1642
|
*/
|
|
1647
|
-
loadState(e,
|
|
1648
|
-
return this.dispatch(Et(e,
|
|
1643
|
+
loadState(e, i) {
|
|
1644
|
+
return this.dispatch(Et(e, i)), this;
|
|
1649
1645
|
}
|
|
1650
1646
|
}
|
|
1651
|
-
function
|
|
1652
|
-
e.forEach((
|
|
1653
|
-
Object.getOwnPropertyNames(
|
|
1647
|
+
function $i(t, e) {
|
|
1648
|
+
e.forEach((i) => {
|
|
1649
|
+
Object.getOwnPropertyNames(i.prototype).forEach((n) => {
|
|
1654
1650
|
Object.defineProperty(
|
|
1655
1651
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
1656
1652
|
t.prototype,
|
|
1657
|
-
|
|
1653
|
+
n,
|
|
1658
1654
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
1659
|
-
Object.getOwnPropertyDescriptor(
|
|
1655
|
+
Object.getOwnPropertyDescriptor(i.prototype, n) || /* @__PURE__ */ Object.create(null)
|
|
1660
1656
|
);
|
|
1661
1657
|
});
|
|
1662
1658
|
});
|
|
1663
1659
|
}
|
|
1664
1660
|
export {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1661
|
+
Oi as A,
|
|
1662
|
+
Ei as B,
|
|
1663
|
+
wi as C,
|
|
1664
|
+
Pe as D,
|
|
1665
|
+
te as E,
|
|
1666
|
+
di as F,
|
|
1667
|
+
We as G,
|
|
1668
|
+
Yt as H,
|
|
1669
|
+
ci as I,
|
|
1672
1670
|
Ye as a,
|
|
1673
|
-
|
|
1671
|
+
ti as b,
|
|
1674
1672
|
Qe as c,
|
|
1675
|
-
|
|
1676
|
-
|
|
1673
|
+
li as d,
|
|
1674
|
+
ze as e,
|
|
1677
1675
|
W as f,
|
|
1678
|
-
|
|
1679
|
-
|
|
1676
|
+
$i as g,
|
|
1677
|
+
ji as h,
|
|
1680
1678
|
kt as i,
|
|
1681
|
-
|
|
1682
|
-
|
|
1679
|
+
bi as j,
|
|
1680
|
+
Ht as k,
|
|
1683
1681
|
$t as l,
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1682
|
+
fi as m,
|
|
1683
|
+
ui as n,
|
|
1684
|
+
mi as o,
|
|
1687
1685
|
jt as p,
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1686
|
+
xi as q,
|
|
1687
|
+
gi as r,
|
|
1688
|
+
Me as s,
|
|
1689
|
+
Si as t,
|
|
1690
|
+
hi as u,
|
|
1691
|
+
yi as v,
|
|
1692
|
+
ie as w,
|
|
1695
1693
|
rt as x,
|
|
1696
|
-
|
|
1694
|
+
ee as y,
|
|
1697
1695
|
gt as z
|
|
1698
1696
|
};
|