document-model 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/cjs/document-model.js +20 -1
- package/dist/browser/cjs/document-model.js.map +1 -0
- package/dist/browser/cjs/document.js +15 -1
- package/dist/browser/cjs/document.js.map +1 -0
- package/dist/browser/cjs/index.js +14 -1
- package/dist/browser/cjs/index.js.map +1 -0
- package/dist/browser/cjs/internal/index-DdOJi6Ua.js +2336 -0
- package/dist/browser/cjs/internal/index-DdOJi6Ua.js.map +1 -0
- package/dist/browser/cjs/internal/index-pAtJQrtD.js +49 -0
- package/dist/browser/cjs/internal/index-pAtJQrtD.js.map +1 -0
- package/dist/browser/cjs/internal/object-CRlmL8Nt.js +4333 -0
- package/dist/browser/cjs/internal/object-CRlmL8Nt.js.map +1 -0
- package/dist/browser/es/document-model.js +17 -17
- package/dist/browser/es/document-model.js.map +1 -0
- package/dist/browser/es/document.js +13 -14
- package/dist/browser/es/document.js.map +1 -0
- package/dist/browser/es/index.js +12 -14
- package/dist/browser/es/index.js.map +1 -0
- package/dist/browser/es/internal/index-BsGRYydP.js +50 -0
- package/dist/browser/es/internal/index-BsGRYydP.js.map +1 -0
- package/dist/browser/es/internal/index-C1HKYMZA.js +2337 -0
- package/dist/browser/es/internal/index-C1HKYMZA.js.map +1 -0
- package/dist/browser/es/internal/object-B562qKhQ.js +4334 -0
- package/dist/browser/es/internal/object-B562qKhQ.js.map +1 -0
- package/dist/browser/src/document/actions/creators.d.ts +2 -1
- package/dist/browser/src/document/actions/index.d.ts +1 -0
- package/dist/browser/src/document/actions/types.d.ts +3 -2
- package/dist/browser/src/document/object.d.ts +9 -1128
- package/dist/browser/src/document/reducer.d.ts +16 -13
- package/dist/browser/src/document/schema/types.d.ts +1 -0
- package/dist/browser/src/document/schema/zod.d.ts +12 -8
- package/dist/browser/src/document/signal.d.ts +1 -0
- package/dist/browser/src/document/types.d.ts +9 -6
- package/dist/browser/src/document/utils/base.d.ts +7 -5
- package/dist/browser/src/document/utils/document-helpers.d.ts +1 -0
- package/dist/browser/src/document/utils/file.d.ts +3 -2
- package/dist/browser/src/document/utils/validation.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/header.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/module.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/operation-error.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/operation-example.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/operation.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/state.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/versioning.d.ts +1 -5
- package/dist/browser/src/document-model/custom/utils.d.ts +1 -0
- package/dist/browser/src/document-model/gen/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/document-model.d.ts +2 -1
- package/dist/browser/src/document-model/gen/header/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/header/creators.d.ts +1 -0
- package/dist/browser/src/document-model/gen/header/object.d.ts +1 -0
- package/dist/browser/src/document-model/gen/header/operations.d.ts +1 -0
- package/dist/browser/src/document-model/gen/module/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/module/creators.d.ts +1 -0
- package/dist/browser/src/document-model/gen/module/object.d.ts +1 -0
- package/dist/browser/src/document-model/gen/module/operations.d.ts +1 -0
- package/dist/browser/src/document-model/gen/object.d.ts +8 -7
- package/dist/browser/src/document-model/gen/operation/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation/creators.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation/object.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation/operations.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-error/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-error/creators.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-error/object.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-error/operations.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-example/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-example/creators.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-example/object.d.ts +1 -0
- package/dist/browser/src/document-model/gen/operation-example/operations.d.ts +1 -0
- package/dist/browser/src/document-model/gen/reducer.d.ts +2 -1
- package/dist/browser/src/document-model/gen/schema/index.d.ts +2 -2
- package/dist/browser/src/document-model/gen/schema/types.d.ts +1 -0
- package/dist/browser/src/document-model/gen/schema/zod.d.ts +70 -69
- package/dist/browser/src/document-model/gen/state/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/state/creators.d.ts +1 -0
- package/dist/browser/src/document-model/gen/state/object.d.ts +1 -0
- package/dist/browser/src/document-model/gen/state/operations.d.ts +1 -0
- package/dist/browser/src/document-model/gen/types.d.ts +4 -3
- package/dist/browser/src/document-model/gen/utils.d.ts +1 -0
- package/dist/browser/src/document-model/gen/versioning/actions.d.ts +1 -0
- package/dist/browser/src/document-model/gen/versioning/creators.d.ts +1 -0
- package/dist/browser/src/document-model/gen/versioning/object.d.ts +1 -0
- package/dist/browser/src/document-model/gen/versioning/operations.d.ts +1 -0
- package/dist/browser/src/document-model/index.d.ts +62 -65
- package/dist/browser/vite.config.d.ts +1 -1
- package/dist/browser/vitest.config.d.ts +1 -1
- package/dist/node/cjs/document-model.js +24 -1
- package/dist/node/cjs/document-model.js.map +1 -0
- package/dist/node/cjs/document.js +15 -1
- package/dist/node/cjs/document.js.map +1 -0
- package/dist/node/cjs/index.js +14 -1
- package/dist/node/cjs/index.js.map +1 -0
- package/dist/node/cjs/internal/index-BWc0K1Dk.js +2340 -0
- package/dist/node/cjs/internal/index-BWc0K1Dk.js.map +1 -0
- package/dist/node/cjs/internal/index-DxD7Ha1j.js +49 -0
- package/dist/node/cjs/internal/index-DxD7Ha1j.js.map +1 -0
- package/dist/node/cjs/internal/object-_zq9luMS.js +2335 -0
- package/dist/node/cjs/internal/object-_zq9luMS.js.map +1 -0
- package/dist/node/es/document-model.js +16 -16
- package/dist/node/es/document-model.js.map +1 -0
- package/dist/node/es/document.js +13 -18
- package/dist/node/es/document.js.map +1 -0
- package/dist/node/es/index.js +12 -18
- package/dist/node/es/index.js.map +1 -0
- package/dist/node/es/internal/index-D8WTToX1.js +2341 -0
- package/dist/node/es/internal/index-D8WTToX1.js.map +1 -0
- package/dist/node/es/internal/index-DkkBVgni.js +50 -0
- package/dist/node/es/internal/index-DkkBVgni.js.map +1 -0
- package/dist/node/es/internal/object-D3jjs7tr.js +2336 -0
- package/dist/node/es/internal/object-D3jjs7tr.js.map +1 -0
- package/dist/node/src/document/actions/creators.d.ts +2 -1
- package/dist/node/src/document/actions/index.d.ts +1 -0
- package/dist/node/src/document/actions/types.d.ts +3 -2
- package/dist/node/src/document/object.d.ts +9 -1128
- package/dist/node/src/document/reducer.d.ts +16 -13
- package/dist/node/src/document/schema/types.d.ts +1 -0
- package/dist/node/src/document/schema/zod.d.ts +12 -8
- package/dist/node/src/document/signal.d.ts +1 -0
- package/dist/node/src/document/types.d.ts +9 -6
- package/dist/node/src/document/utils/base.d.ts +7 -5
- package/dist/node/src/document/utils/document-helpers.d.ts +1 -0
- package/dist/node/src/document/utils/file.d.ts +3 -2
- package/dist/node/src/document/utils/validation.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/header.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/module.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/operation-error.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/operation-example.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/operation.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/state.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/versioning.d.ts +1 -5
- package/dist/node/src/document-model/custom/utils.d.ts +1 -0
- package/dist/node/src/document-model/gen/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/document-model.d.ts +2 -1
- package/dist/node/src/document-model/gen/header/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/header/creators.d.ts +1 -0
- package/dist/node/src/document-model/gen/header/object.d.ts +1 -0
- package/dist/node/src/document-model/gen/header/operations.d.ts +1 -0
- package/dist/node/src/document-model/gen/module/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/module/creators.d.ts +1 -0
- package/dist/node/src/document-model/gen/module/object.d.ts +1 -0
- package/dist/node/src/document-model/gen/module/operations.d.ts +1 -0
- package/dist/node/src/document-model/gen/object.d.ts +8 -7
- package/dist/node/src/document-model/gen/operation/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation/creators.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation/object.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation/operations.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-error/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-error/creators.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-error/object.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-error/operations.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-example/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-example/creators.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-example/object.d.ts +1 -0
- package/dist/node/src/document-model/gen/operation-example/operations.d.ts +1 -0
- package/dist/node/src/document-model/gen/reducer.d.ts +2 -1
- package/dist/node/src/document-model/gen/schema/index.d.ts +2 -2
- package/dist/node/src/document-model/gen/schema/types.d.ts +1 -0
- package/dist/node/src/document-model/gen/schema/zod.d.ts +70 -69
- package/dist/node/src/document-model/gen/state/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/state/creators.d.ts +1 -0
- package/dist/node/src/document-model/gen/state/object.d.ts +1 -0
- package/dist/node/src/document-model/gen/state/operations.d.ts +1 -0
- package/dist/node/src/document-model/gen/types.d.ts +4 -3
- package/dist/node/src/document-model/gen/utils.d.ts +1 -0
- package/dist/node/src/document-model/gen/versioning/actions.d.ts +1 -0
- package/dist/node/src/document-model/gen/versioning/creators.d.ts +1 -0
- package/dist/node/src/document-model/gen/versioning/object.d.ts +1 -0
- package/dist/node/src/document-model/gen/versioning/operations.d.ts +1 -0
- package/dist/node/src/document-model/index.d.ts +62 -65
- package/dist/node/vite.config.d.ts +1 -1
- package/dist/node/vitest.config.d.ts +1 -1
- package/package.json +5 -4
- package/dist/browser/cjs/internal/index-DGWOisRG.js +0 -22
- package/dist/browser/cjs/internal/index-Dl3D9TzG.js +0 -1
- package/dist/browser/cjs/internal/object-DQmy6ar9.js +0 -25
- package/dist/browser/es/internal/index-BnpyOR6R.js +0 -46
- package/dist/browser/es/internal/index-DynAX_OS.js +0 -2104
- package/dist/browser/es/internal/object-DenwvByi.js +0 -2838
- package/dist/node/cjs/internal/index-B96klT84.js +0 -1
- package/dist/node/cjs/internal/index-CtqbrEO2.js +0 -22
- package/dist/node/cjs/internal/object-CXx7IaXb.js +0 -20
- package/dist/node/es/internal/index-DEAJDDrx.js +0 -46
- package/dist/node/es/internal/index-pNw-lk-q.js +0 -2108
- package/dist/node/es/internal/object-2jyfnUeK.js +0 -1736
|
@@ -1,2838 +0,0 @@
|
|
|
1
|
-
var Ye = Object.defineProperty;
|
|
2
|
-
var Qe = (i, r, o) => r in i ? Ye(i, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[r] = o;
|
|
3
|
-
var Ft = (i, r, o) => (Qe(i, typeof r != "symbol" ? r + "" : r, o), o);
|
|
4
|
-
import { produce as jt, castDraft as It, castImmutable as ti, freeze as ei } from "immer";
|
|
5
|
-
import { z as _ } from "zod";
|
|
6
|
-
import pe from "jszip";
|
|
7
|
-
const ce = (i) => i != null, ii = _.any().refine((i) => ce(i)), le = _.enum(["LOAD_STATE"]), ue = _.enum(["PRUNE"]), fe = _.enum(["REDO"]), he = _.enum(["SET_NAME"]), me = _.enum(["UNDO"]);
|
|
8
|
-
function ri() {
|
|
9
|
-
return _.object({
|
|
10
|
-
__typename: _.literal("Action").optional(),
|
|
11
|
-
type: _.string()
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function wt() {
|
|
15
|
-
return _.literal("global").or(_.literal("local"));
|
|
16
|
-
}
|
|
17
|
-
function xe() {
|
|
18
|
-
return _.union([
|
|
19
|
-
de(),
|
|
20
|
-
ye(),
|
|
21
|
-
we(),
|
|
22
|
-
Ee(),
|
|
23
|
-
be()
|
|
24
|
-
]);
|
|
25
|
-
}
|
|
26
|
-
function ni() {
|
|
27
|
-
return _.object({
|
|
28
|
-
__typename: _.literal("DocumentFile").optional(),
|
|
29
|
-
data: _.string(),
|
|
30
|
-
extension: _.string().nullable(),
|
|
31
|
-
fileName: _.string().nullable(),
|
|
32
|
-
mimeType: _.string()
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function de() {
|
|
36
|
-
return _.object({
|
|
37
|
-
input: _.lazy(() => Ht()),
|
|
38
|
-
type: le,
|
|
39
|
-
scope: wt()
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function Ht() {
|
|
43
|
-
return _.object({
|
|
44
|
-
operations: _.number(),
|
|
45
|
-
state: _.lazy(() => ge())
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function ge() {
|
|
49
|
-
return _.object({
|
|
50
|
-
data: _.unknown().nullish(),
|
|
51
|
-
name: _.string()
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function oi() {
|
|
55
|
-
return _.object({
|
|
56
|
-
__typename: _.literal("Operation").optional(),
|
|
57
|
-
hash: _.string(),
|
|
58
|
-
index: _.number(),
|
|
59
|
-
timestamp: _.string().datetime(),
|
|
60
|
-
type: _.string()
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function ye() {
|
|
64
|
-
return _.object({
|
|
65
|
-
input: _.lazy(() => Jt()),
|
|
66
|
-
type: ue,
|
|
67
|
-
scope: wt()
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function Jt() {
|
|
71
|
-
return _.object({
|
|
72
|
-
end: _.number().nullish(),
|
|
73
|
-
start: _.number().nullish()
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
const Vt = _.number;
|
|
77
|
-
function we() {
|
|
78
|
-
return _.object({
|
|
79
|
-
input: Vt(),
|
|
80
|
-
type: fe,
|
|
81
|
-
scope: wt()
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
const Wt = _.string;
|
|
85
|
-
function Ee() {
|
|
86
|
-
return _.object({
|
|
87
|
-
input: Wt(),
|
|
88
|
-
type: he,
|
|
89
|
-
scope: _.literal("global")
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function ai() {
|
|
93
|
-
return _.object({
|
|
94
|
-
__typename: _.literal("SetNameOperation").optional(),
|
|
95
|
-
hash: _.string(),
|
|
96
|
-
index: _.number(),
|
|
97
|
-
input: _.string(),
|
|
98
|
-
timestamp: _.string().datetime(),
|
|
99
|
-
type: _.string()
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
const Xt = _.number;
|
|
103
|
-
function be() {
|
|
104
|
-
return _.object({
|
|
105
|
-
input: Xt(),
|
|
106
|
-
type: me,
|
|
107
|
-
scope: wt()
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
const Fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
111
|
-
__proto__: null,
|
|
112
|
-
ActionSchema: ri,
|
|
113
|
-
BaseActionSchema: xe,
|
|
114
|
-
DocumentFileSchema: ni,
|
|
115
|
-
LoadStateActionInputSchema: Ht,
|
|
116
|
-
LoadStateActionSchema: de,
|
|
117
|
-
LoadStateActionStateInputSchema: ge,
|
|
118
|
-
Load_StateSchema: le,
|
|
119
|
-
OperationSchema: oi,
|
|
120
|
-
OperationScopeSchema: wt,
|
|
121
|
-
PruneActionInputSchema: Jt,
|
|
122
|
-
PruneActionSchema: ye,
|
|
123
|
-
PruneSchema: ue,
|
|
124
|
-
RedoActionInputSchema: Vt,
|
|
125
|
-
RedoActionSchema: we,
|
|
126
|
-
RedoSchema: fe,
|
|
127
|
-
SetNameActionInputSchema: Wt,
|
|
128
|
-
SetNameActionSchema: Ee,
|
|
129
|
-
SetNameOperationSchema: ai,
|
|
130
|
-
Set_NameSchema: he,
|
|
131
|
-
UndoActionInputSchema: Xt,
|
|
132
|
-
UndoActionSchema: be,
|
|
133
|
-
UndoSchema: me,
|
|
134
|
-
definedNonNullAnySchema: ii,
|
|
135
|
-
isDefinedNonNullAny: ce
|
|
136
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
137
|
-
function Kt(i) {
|
|
138
|
-
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
139
|
-
}
|
|
140
|
-
var Rt = { exports: {} };
|
|
141
|
-
(function(i, r) {
|
|
142
|
-
const { hasOwnProperty: o } = Object.prototype, p = Y();
|
|
143
|
-
p.configure = Y, p.stringify = p, p.default = p, r.stringify = p, r.configure = Y, i.exports = p;
|
|
144
|
-
const l = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
|
|
145
|
-
function f(w) {
|
|
146
|
-
return w.length < 5e3 && !l.test(w) ? `"${w}"` : JSON.stringify(w);
|
|
147
|
-
}
|
|
148
|
-
function c(w) {
|
|
149
|
-
if (w.length > 200)
|
|
150
|
-
return w.sort();
|
|
151
|
-
for (let E = 1; E < w.length; E++) {
|
|
152
|
-
const v = w[E];
|
|
153
|
-
let M = E;
|
|
154
|
-
for (; M !== 0 && w[M - 1] > v; )
|
|
155
|
-
w[M] = w[M - 1], M--;
|
|
156
|
-
w[M] = v;
|
|
157
|
-
}
|
|
158
|
-
return w;
|
|
159
|
-
}
|
|
160
|
-
const a = Object.getOwnPropertyDescriptor(
|
|
161
|
-
Object.getPrototypeOf(
|
|
162
|
-
Object.getPrototypeOf(
|
|
163
|
-
new Int8Array()
|
|
164
|
-
)
|
|
165
|
-
),
|
|
166
|
-
Symbol.toStringTag
|
|
167
|
-
).get;
|
|
168
|
-
function h(w) {
|
|
169
|
-
return a.call(w) !== void 0 && w.length !== 0;
|
|
170
|
-
}
|
|
171
|
-
function g(w, E, v) {
|
|
172
|
-
w.length < v && (v = w.length);
|
|
173
|
-
const M = E === "," ? "" : " ";
|
|
174
|
-
let J = `"0":${M}${w[0]}`;
|
|
175
|
-
for (let V = 1; V < v; V++)
|
|
176
|
-
J += `${E}"${V}":${M}${w[V]}`;
|
|
177
|
-
return J;
|
|
178
|
-
}
|
|
179
|
-
function y(w) {
|
|
180
|
-
if (o.call(w, "circularValue")) {
|
|
181
|
-
const E = w.circularValue;
|
|
182
|
-
if (typeof E == "string")
|
|
183
|
-
return `"${E}"`;
|
|
184
|
-
if (E == null)
|
|
185
|
-
return E;
|
|
186
|
-
if (E === Error || E === TypeError)
|
|
187
|
-
return {
|
|
188
|
-
toString() {
|
|
189
|
-
throw new TypeError("Converting circular structure to JSON");
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
|
|
193
|
-
}
|
|
194
|
-
return '"[Circular]"';
|
|
195
|
-
}
|
|
196
|
-
function b(w, E) {
|
|
197
|
-
let v;
|
|
198
|
-
if (o.call(w, E) && (v = w[E], typeof v != "boolean"))
|
|
199
|
-
throw new TypeError(`The "${E}" argument must be of type boolean`);
|
|
200
|
-
return v === void 0 ? !0 : v;
|
|
201
|
-
}
|
|
202
|
-
function F(w, E) {
|
|
203
|
-
let v;
|
|
204
|
-
if (o.call(w, E)) {
|
|
205
|
-
if (v = w[E], typeof v != "number")
|
|
206
|
-
throw new TypeError(`The "${E}" argument must be of type number`);
|
|
207
|
-
if (!Number.isInteger(v))
|
|
208
|
-
throw new TypeError(`The "${E}" argument must be an integer`);
|
|
209
|
-
if (v < 1)
|
|
210
|
-
throw new RangeError(`The "${E}" argument must be >= 1`);
|
|
211
|
-
}
|
|
212
|
-
return v === void 0 ? 1 / 0 : v;
|
|
213
|
-
}
|
|
214
|
-
function j(w) {
|
|
215
|
-
return w === 1 ? "1 item" : `${w} items`;
|
|
216
|
-
}
|
|
217
|
-
function U(w) {
|
|
218
|
-
const E = /* @__PURE__ */ new Set();
|
|
219
|
-
for (const v of w)
|
|
220
|
-
(typeof v == "string" || typeof v == "number") && E.add(String(v));
|
|
221
|
-
return E;
|
|
222
|
-
}
|
|
223
|
-
function q(w) {
|
|
224
|
-
if (o.call(w, "strict")) {
|
|
225
|
-
const E = w.strict;
|
|
226
|
-
if (typeof E != "boolean")
|
|
227
|
-
throw new TypeError('The "strict" argument must be of type boolean');
|
|
228
|
-
if (E)
|
|
229
|
-
return (v) => {
|
|
230
|
-
let M = `Object can not safely be stringified. Received type ${typeof v}`;
|
|
231
|
-
throw typeof v != "function" && (M += ` (${v.toString()})`), new Error(M);
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
function Y(w) {
|
|
236
|
-
w = { ...w };
|
|
237
|
-
const E = q(w);
|
|
238
|
-
E && (w.bigint === void 0 && (w.bigint = !1), "circularValue" in w || (w.circularValue = Error));
|
|
239
|
-
const v = y(w), M = b(w, "bigint"), J = b(w, "deterministic"), V = F(w, "maximumDepth"), R = F(w, "maximumBreadth");
|
|
240
|
-
function ft(W, m, S, D, B, C) {
|
|
241
|
-
let A = m[W];
|
|
242
|
-
switch (typeof A == "object" && A !== null && typeof A.toJSON == "function" && (A = A.toJSON(W)), A = D.call(m, W, A), typeof A) {
|
|
243
|
-
case "string":
|
|
244
|
-
return f(A);
|
|
245
|
-
case "object": {
|
|
246
|
-
if (A === null)
|
|
247
|
-
return "null";
|
|
248
|
-
if (S.indexOf(A) !== -1)
|
|
249
|
-
return v;
|
|
250
|
-
let T = "", O = ",";
|
|
251
|
-
const I = C;
|
|
252
|
-
if (Array.isArray(A)) {
|
|
253
|
-
if (A.length === 0)
|
|
254
|
-
return "[]";
|
|
255
|
-
if (V < S.length + 1)
|
|
256
|
-
return '"[Array]"';
|
|
257
|
-
S.push(A), B !== "" && (C += B, T += `
|
|
258
|
-
${C}`, O = `,
|
|
259
|
-
${C}`);
|
|
260
|
-
const X = Math.min(A.length, R);
|
|
261
|
-
let tt = 0;
|
|
262
|
-
for (; tt < X - 1; tt++) {
|
|
263
|
-
const lt = ft(String(tt), A, S, D, B, C);
|
|
264
|
-
T += lt !== void 0 ? lt : "null", T += O;
|
|
265
|
-
}
|
|
266
|
-
const et = ft(String(tt), A, S, D, B, C);
|
|
267
|
-
if (T += et !== void 0 ? et : "null", A.length - 1 > R) {
|
|
268
|
-
const lt = A.length - R - 1;
|
|
269
|
-
T += `${O}"... ${j(lt)} not stringified"`;
|
|
270
|
-
}
|
|
271
|
-
return B !== "" && (T += `
|
|
272
|
-
${I}`), S.pop(), `[${T}]`;
|
|
273
|
-
}
|
|
274
|
-
let L = Object.keys(A);
|
|
275
|
-
const H = L.length;
|
|
276
|
-
if (H === 0)
|
|
277
|
-
return "{}";
|
|
278
|
-
if (V < S.length + 1)
|
|
279
|
-
return '"[Object]"';
|
|
280
|
-
let $ = "", K = "";
|
|
281
|
-
B !== "" && (C += B, O = `,
|
|
282
|
-
${C}`, $ = " ");
|
|
283
|
-
const Q = Math.min(H, R);
|
|
284
|
-
J && !h(A) && (L = c(L)), S.push(A);
|
|
285
|
-
for (let X = 0; X < Q; X++) {
|
|
286
|
-
const tt = L[X], et = ft(tt, A, S, D, B, C);
|
|
287
|
-
et !== void 0 && (T += `${K}${f(tt)}:${$}${et}`, K = O);
|
|
288
|
-
}
|
|
289
|
-
if (H > R) {
|
|
290
|
-
const X = H - R;
|
|
291
|
-
T += `${K}"...":${$}"${j(X)} not stringified"`, K = O;
|
|
292
|
-
}
|
|
293
|
-
return B !== "" && K.length > 1 && (T = `
|
|
294
|
-
${C}${T}
|
|
295
|
-
${I}`), S.pop(), `{${T}}`;
|
|
296
|
-
}
|
|
297
|
-
case "number":
|
|
298
|
-
return isFinite(A) ? String(A) : E ? E(A) : "null";
|
|
299
|
-
case "boolean":
|
|
300
|
-
return A === !0 ? "true" : "false";
|
|
301
|
-
case "undefined":
|
|
302
|
-
return;
|
|
303
|
-
case "bigint":
|
|
304
|
-
if (M)
|
|
305
|
-
return String(A);
|
|
306
|
-
default:
|
|
307
|
-
return E ? E(A) : void 0;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
function ht(W, m, S, D, B, C) {
|
|
311
|
-
switch (typeof m == "object" && m !== null && typeof m.toJSON == "function" && (m = m.toJSON(W)), typeof m) {
|
|
312
|
-
case "string":
|
|
313
|
-
return f(m);
|
|
314
|
-
case "object": {
|
|
315
|
-
if (m === null)
|
|
316
|
-
return "null";
|
|
317
|
-
if (S.indexOf(m) !== -1)
|
|
318
|
-
return v;
|
|
319
|
-
const A = C;
|
|
320
|
-
let T = "", O = ",";
|
|
321
|
-
if (Array.isArray(m)) {
|
|
322
|
-
if (m.length === 0)
|
|
323
|
-
return "[]";
|
|
324
|
-
if (V < S.length + 1)
|
|
325
|
-
return '"[Array]"';
|
|
326
|
-
S.push(m), B !== "" && (C += B, T += `
|
|
327
|
-
${C}`, O = `,
|
|
328
|
-
${C}`);
|
|
329
|
-
const H = Math.min(m.length, R);
|
|
330
|
-
let $ = 0;
|
|
331
|
-
for (; $ < H - 1; $++) {
|
|
332
|
-
const Q = ht(String($), m[$], S, D, B, C);
|
|
333
|
-
T += Q !== void 0 ? Q : "null", T += O;
|
|
334
|
-
}
|
|
335
|
-
const K = ht(String($), m[$], S, D, B, C);
|
|
336
|
-
if (T += K !== void 0 ? K : "null", m.length - 1 > R) {
|
|
337
|
-
const Q = m.length - R - 1;
|
|
338
|
-
T += `${O}"... ${j(Q)} not stringified"`;
|
|
339
|
-
}
|
|
340
|
-
return B !== "" && (T += `
|
|
341
|
-
${A}`), S.pop(), `[${T}]`;
|
|
342
|
-
}
|
|
343
|
-
S.push(m);
|
|
344
|
-
let I = "";
|
|
345
|
-
B !== "" && (C += B, O = `,
|
|
346
|
-
${C}`, I = " ");
|
|
347
|
-
let L = "";
|
|
348
|
-
for (const H of D) {
|
|
349
|
-
const $ = ht(H, m[H], S, D, B, C);
|
|
350
|
-
$ !== void 0 && (T += `${L}${f(H)}:${I}${$}`, L = O);
|
|
351
|
-
}
|
|
352
|
-
return B !== "" && L.length > 1 && (T = `
|
|
353
|
-
${C}${T}
|
|
354
|
-
${A}`), S.pop(), `{${T}}`;
|
|
355
|
-
}
|
|
356
|
-
case "number":
|
|
357
|
-
return isFinite(m) ? String(m) : E ? E(m) : "null";
|
|
358
|
-
case "boolean":
|
|
359
|
-
return m === !0 ? "true" : "false";
|
|
360
|
-
case "undefined":
|
|
361
|
-
return;
|
|
362
|
-
case "bigint":
|
|
363
|
-
if (M)
|
|
364
|
-
return String(m);
|
|
365
|
-
default:
|
|
366
|
-
return E ? E(m) : void 0;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
function pt(W, m, S, D, B) {
|
|
370
|
-
switch (typeof m) {
|
|
371
|
-
case "string":
|
|
372
|
-
return f(m);
|
|
373
|
-
case "object": {
|
|
374
|
-
if (m === null)
|
|
375
|
-
return "null";
|
|
376
|
-
if (typeof m.toJSON == "function") {
|
|
377
|
-
if (m = m.toJSON(W), typeof m != "object")
|
|
378
|
-
return pt(W, m, S, D, B);
|
|
379
|
-
if (m === null)
|
|
380
|
-
return "null";
|
|
381
|
-
}
|
|
382
|
-
if (S.indexOf(m) !== -1)
|
|
383
|
-
return v;
|
|
384
|
-
const C = B;
|
|
385
|
-
if (Array.isArray(m)) {
|
|
386
|
-
if (m.length === 0)
|
|
387
|
-
return "[]";
|
|
388
|
-
if (V < S.length + 1)
|
|
389
|
-
return '"[Array]"';
|
|
390
|
-
S.push(m), B += D;
|
|
391
|
-
let $ = `
|
|
392
|
-
${B}`;
|
|
393
|
-
const K = `,
|
|
394
|
-
${B}`, Q = Math.min(m.length, R);
|
|
395
|
-
let X = 0;
|
|
396
|
-
for (; X < Q - 1; X++) {
|
|
397
|
-
const et = pt(String(X), m[X], S, D, B);
|
|
398
|
-
$ += et !== void 0 ? et : "null", $ += K;
|
|
399
|
-
}
|
|
400
|
-
const tt = pt(String(X), m[X], S, D, B);
|
|
401
|
-
if ($ += tt !== void 0 ? tt : "null", m.length - 1 > R) {
|
|
402
|
-
const et = m.length - R - 1;
|
|
403
|
-
$ += `${K}"... ${j(et)} not stringified"`;
|
|
404
|
-
}
|
|
405
|
-
return $ += `
|
|
406
|
-
${C}`, S.pop(), `[${$}]`;
|
|
407
|
-
}
|
|
408
|
-
let A = Object.keys(m);
|
|
409
|
-
const T = A.length;
|
|
410
|
-
if (T === 0)
|
|
411
|
-
return "{}";
|
|
412
|
-
if (V < S.length + 1)
|
|
413
|
-
return '"[Object]"';
|
|
414
|
-
B += D;
|
|
415
|
-
const O = `,
|
|
416
|
-
${B}`;
|
|
417
|
-
let I = "", L = "", H = Math.min(T, R);
|
|
418
|
-
h(m) && (I += g(m, O, R), A = A.slice(m.length), H -= m.length, L = O), J && (A = c(A)), S.push(m);
|
|
419
|
-
for (let $ = 0; $ < H; $++) {
|
|
420
|
-
const K = A[$], Q = pt(K, m[K], S, D, B);
|
|
421
|
-
Q !== void 0 && (I += `${L}${f(K)}: ${Q}`, L = O);
|
|
422
|
-
}
|
|
423
|
-
if (T > R) {
|
|
424
|
-
const $ = T - R;
|
|
425
|
-
I += `${L}"...": "${j($)} not stringified"`, L = O;
|
|
426
|
-
}
|
|
427
|
-
return L !== "" && (I = `
|
|
428
|
-
${B}${I}
|
|
429
|
-
${C}`), S.pop(), `{${I}}`;
|
|
430
|
-
}
|
|
431
|
-
case "number":
|
|
432
|
-
return isFinite(m) ? String(m) : E ? E(m) : "null";
|
|
433
|
-
case "boolean":
|
|
434
|
-
return m === !0 ? "true" : "false";
|
|
435
|
-
case "undefined":
|
|
436
|
-
return;
|
|
437
|
-
case "bigint":
|
|
438
|
-
if (M)
|
|
439
|
-
return String(m);
|
|
440
|
-
default:
|
|
441
|
-
return E ? E(m) : void 0;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
function ct(W, m, S) {
|
|
445
|
-
switch (typeof m) {
|
|
446
|
-
case "string":
|
|
447
|
-
return f(m);
|
|
448
|
-
case "object": {
|
|
449
|
-
if (m === null)
|
|
450
|
-
return "null";
|
|
451
|
-
if (typeof m.toJSON == "function") {
|
|
452
|
-
if (m = m.toJSON(W), typeof m != "object")
|
|
453
|
-
return ct(W, m, S);
|
|
454
|
-
if (m === null)
|
|
455
|
-
return "null";
|
|
456
|
-
}
|
|
457
|
-
if (S.indexOf(m) !== -1)
|
|
458
|
-
return v;
|
|
459
|
-
let D = "";
|
|
460
|
-
if (Array.isArray(m)) {
|
|
461
|
-
if (m.length === 0)
|
|
462
|
-
return "[]";
|
|
463
|
-
if (V < S.length + 1)
|
|
464
|
-
return '"[Array]"';
|
|
465
|
-
S.push(m);
|
|
466
|
-
const O = Math.min(m.length, R);
|
|
467
|
-
let I = 0;
|
|
468
|
-
for (; I < O - 1; I++) {
|
|
469
|
-
const H = ct(String(I), m[I], S);
|
|
470
|
-
D += H !== void 0 ? H : "null", D += ",";
|
|
471
|
-
}
|
|
472
|
-
const L = ct(String(I), m[I], S);
|
|
473
|
-
if (D += L !== void 0 ? L : "null", m.length - 1 > R) {
|
|
474
|
-
const H = m.length - R - 1;
|
|
475
|
-
D += `,"... ${j(H)} not stringified"`;
|
|
476
|
-
}
|
|
477
|
-
return S.pop(), `[${D}]`;
|
|
478
|
-
}
|
|
479
|
-
let B = Object.keys(m);
|
|
480
|
-
const C = B.length;
|
|
481
|
-
if (C === 0)
|
|
482
|
-
return "{}";
|
|
483
|
-
if (V < S.length + 1)
|
|
484
|
-
return '"[Object]"';
|
|
485
|
-
let A = "", T = Math.min(C, R);
|
|
486
|
-
h(m) && (D += g(m, ",", R), B = B.slice(m.length), T -= m.length, A = ","), J && (B = c(B)), S.push(m);
|
|
487
|
-
for (let O = 0; O < T; O++) {
|
|
488
|
-
const I = B[O], L = ct(I, m[I], S);
|
|
489
|
-
L !== void 0 && (D += `${A}${f(I)}:${L}`, A = ",");
|
|
490
|
-
}
|
|
491
|
-
if (C > R) {
|
|
492
|
-
const O = C - R;
|
|
493
|
-
D += `${A}"...":"${j(O)} not stringified"`;
|
|
494
|
-
}
|
|
495
|
-
return S.pop(), `{${D}}`;
|
|
496
|
-
}
|
|
497
|
-
case "number":
|
|
498
|
-
return isFinite(m) ? String(m) : E ? E(m) : "null";
|
|
499
|
-
case "boolean":
|
|
500
|
-
return m === !0 ? "true" : "false";
|
|
501
|
-
case "undefined":
|
|
502
|
-
return;
|
|
503
|
-
case "bigint":
|
|
504
|
-
if (M)
|
|
505
|
-
return String(m);
|
|
506
|
-
default:
|
|
507
|
-
return E ? E(m) : void 0;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
function Ct(W, m, S) {
|
|
511
|
-
if (arguments.length > 1) {
|
|
512
|
-
let D = "";
|
|
513
|
-
if (typeof S == "number" ? D = " ".repeat(Math.min(S, 10)) : typeof S == "string" && (D = S.slice(0, 10)), m != null) {
|
|
514
|
-
if (typeof m == "function")
|
|
515
|
-
return ft("", { "": W }, [], m, D, "");
|
|
516
|
-
if (Array.isArray(m))
|
|
517
|
-
return ht("", W, [], U(m), D, "");
|
|
518
|
-
}
|
|
519
|
-
if (D.length !== 0)
|
|
520
|
-
return pt("", W, [], D, "");
|
|
521
|
-
}
|
|
522
|
-
return ct("", W, []);
|
|
523
|
-
}
|
|
524
|
-
return Ct;
|
|
525
|
-
}
|
|
526
|
-
})(Rt, Rt.exports);
|
|
527
|
-
var si = Rt.exports;
|
|
528
|
-
const dt = /* @__PURE__ */ Kt(si);
|
|
529
|
-
dt.configure;
|
|
530
|
-
let Ot;
|
|
531
|
-
const pi = new Uint8Array(16);
|
|
532
|
-
function ci() {
|
|
533
|
-
if (!Ot && (Ot = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Ot))
|
|
534
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
535
|
-
return Ot(pi);
|
|
536
|
-
}
|
|
537
|
-
const G = [];
|
|
538
|
-
for (let i = 0; i < 256; ++i)
|
|
539
|
-
G.push((i + 256).toString(16).slice(1));
|
|
540
|
-
function li(i, r = 0) {
|
|
541
|
-
return G[i[r + 0]] + G[i[r + 1]] + G[i[r + 2]] + G[i[r + 3]] + "-" + G[i[r + 4]] + G[i[r + 5]] + "-" + G[i[r + 6]] + G[i[r + 7]] + "-" + G[i[r + 8]] + G[i[r + 9]] + "-" + G[i[r + 10]] + G[i[r + 11]] + G[i[r + 12]] + G[i[r + 13]] + G[i[r + 14]] + G[i[r + 15]];
|
|
542
|
-
}
|
|
543
|
-
const ui = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), oe = {
|
|
544
|
-
randomUUID: ui
|
|
545
|
-
};
|
|
546
|
-
function fi(i, r, o) {
|
|
547
|
-
if (oe.randomUUID && !r && !i)
|
|
548
|
-
return oe.randomUUID();
|
|
549
|
-
i = i || {};
|
|
550
|
-
const p = i.random || (i.rng || ci)();
|
|
551
|
-
if (p[6] = p[6] & 15 | 64, p[8] = p[8] & 63 | 128, r) {
|
|
552
|
-
o = o || 0;
|
|
553
|
-
for (let l = 0; l < 16; ++l)
|
|
554
|
-
r[o + l] = p[l];
|
|
555
|
-
return r;
|
|
556
|
-
}
|
|
557
|
-
return li(p);
|
|
558
|
-
}
|
|
559
|
-
function hi(i, r) {
|
|
560
|
-
return { ...i, name: r };
|
|
561
|
-
}
|
|
562
|
-
function mi(i, r, o) {
|
|
563
|
-
const { scope: p, input: l } = r;
|
|
564
|
-
return jt({
|
|
565
|
-
document: i,
|
|
566
|
-
action: r,
|
|
567
|
-
skip: o
|
|
568
|
-
}, (c) => {
|
|
569
|
-
if (c.document.operations[p].length < 1)
|
|
570
|
-
throw new Error(
|
|
571
|
-
`Cannot undo: no operations in history for scope "${p}"`
|
|
572
|
-
);
|
|
573
|
-
if (l < 1)
|
|
574
|
-
throw new Error(
|
|
575
|
-
"Invalid UNDO action: input value must be greater than 0"
|
|
576
|
-
);
|
|
577
|
-
if (c.skip > 0)
|
|
578
|
-
throw new Error(
|
|
579
|
-
"Cannot undo: skip value from reducer cannot be used with UNDO action"
|
|
580
|
-
);
|
|
581
|
-
const a = c.document.operations[p].at(-1), h = a && a.type === "NOOP" && a.skip > 0;
|
|
582
|
-
if (c.skip += l, h) {
|
|
583
|
-
c.skip += a.skip;
|
|
584
|
-
const F = c.document.operations[p][c.document.operations[p].length - 2];
|
|
585
|
-
F && a.index - F.index === 1 && c.document.operations[p].pop();
|
|
586
|
-
}
|
|
587
|
-
if (c.document.operations[p].length < c.skip)
|
|
588
|
-
throw new Error(
|
|
589
|
-
"Cannot undo: you can't undo more operations than the ones in the scope history"
|
|
590
|
-
);
|
|
591
|
-
const g = c.document.operations[p].length - 1;
|
|
592
|
-
let y = l, b = h ? g - a.skip : g;
|
|
593
|
-
for (; y > 0 && b >= 0; ) {
|
|
594
|
-
const F = c.document.operations[p][b];
|
|
595
|
-
if (!F) {
|
|
596
|
-
y--, b--;
|
|
597
|
-
continue;
|
|
598
|
-
}
|
|
599
|
-
F.type === "NOOP" && F.skip > 0 ? (b = b - (F.skip + 1), c.skip += F.skip + 1) : (c.document.clipboard.push({ ...F }), y--, b--);
|
|
600
|
-
}
|
|
601
|
-
c.action = Ge(p);
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
function xi(i, r, o) {
|
|
605
|
-
const { scope: p, input: l } = r;
|
|
606
|
-
return jt({
|
|
607
|
-
document: i,
|
|
608
|
-
action: r,
|
|
609
|
-
skip: o
|
|
610
|
-
}, (c) => {
|
|
611
|
-
if (c.skip > 0)
|
|
612
|
-
throw new Error(
|
|
613
|
-
"Cannot redo: skip value from reducer cannot be used with REDO action"
|
|
614
|
-
);
|
|
615
|
-
if (l > 1)
|
|
616
|
-
throw new Error(
|
|
617
|
-
"Cannot redo: you can only redo one operation at a time"
|
|
618
|
-
);
|
|
619
|
-
if (l < 1)
|
|
620
|
-
throw new Error("Invalid REDO action: invalid redo input value");
|
|
621
|
-
if (c.document.clipboard.length < 1)
|
|
622
|
-
throw new Error("Cannot redo: no operations in the clipboard");
|
|
623
|
-
const a = c.document.clipboard.findLastIndex(
|
|
624
|
-
(g) => g.scope === p
|
|
625
|
-
);
|
|
626
|
-
if (a < 0)
|
|
627
|
-
throw new Error(
|
|
628
|
-
`Cannot redo: no operations in clipboard for scope "${p}"`
|
|
629
|
-
);
|
|
630
|
-
const h = c.document.clipboard.splice(a, 1)[0];
|
|
631
|
-
c.action = It({
|
|
632
|
-
type: h.type,
|
|
633
|
-
scope: h.scope,
|
|
634
|
-
input: h.input
|
|
635
|
-
});
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
function di(i, r, o) {
|
|
639
|
-
const { scope: p } = r, l = i.operations[p];
|
|
640
|
-
let {
|
|
641
|
-
input: { start: f, end: c }
|
|
642
|
-
} = r;
|
|
643
|
-
f = f || 0, c = c || l.length;
|
|
644
|
-
const a = l.slice(f, c), h = l.slice(0, f), g = l.slice(c), y = qt(
|
|
645
|
-
i.initialState,
|
|
646
|
-
{
|
|
647
|
-
...i.operations,
|
|
648
|
-
[p]: h.concat(a)
|
|
649
|
-
},
|
|
650
|
-
o
|
|
651
|
-
), { name: b, state: F } = y, j = h.length, U = h.length ? h[h.length - 1].timestamp : g.length ? g[0].timestamp : (/* @__PURE__ */ new Date()).toISOString();
|
|
652
|
-
return qt(
|
|
653
|
-
i.initialState,
|
|
654
|
-
{
|
|
655
|
-
...i.operations,
|
|
656
|
-
[p]: [
|
|
657
|
-
...h,
|
|
658
|
-
{
|
|
659
|
-
...ie(
|
|
660
|
-
{ name: b, state: F },
|
|
661
|
-
a.length
|
|
662
|
-
),
|
|
663
|
-
timestamp: U,
|
|
664
|
-
index: j,
|
|
665
|
-
hash: ee({ state: F }, "global")
|
|
666
|
-
},
|
|
667
|
-
...g.map((q, Y) => ({
|
|
668
|
-
...q,
|
|
669
|
-
index: j + Y + 1
|
|
670
|
-
}))
|
|
671
|
-
]
|
|
672
|
-
},
|
|
673
|
-
o
|
|
674
|
-
);
|
|
675
|
-
}
|
|
676
|
-
function gi(i, r) {
|
|
677
|
-
return {
|
|
678
|
-
...i,
|
|
679
|
-
name: r.name,
|
|
680
|
-
state: r.state ?? { global: {}, local: {} }
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
const ve = "SET_NAME", Et = "UNDO", bt = "REDO", Dt = "PRUNE", Se = "LOAD_STATE", yi = "NOOP", _e = { "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"] };
|
|
684
|
-
Object.freeze(_e);
|
|
685
|
-
var it = function(i, r, o, p) {
|
|
686
|
-
if (o === "a" && !p)
|
|
687
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
688
|
-
if (typeof r == "function" ? i !== r || !p : !r.has(i))
|
|
689
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
690
|
-
return o === "m" ? p : o === "a" ? p.call(i) : p ? p.value : r.get(i);
|
|
691
|
-
}, xt, yt, ut;
|
|
692
|
-
class wi {
|
|
693
|
-
constructor(...r) {
|
|
694
|
-
xt.set(this, /* @__PURE__ */ new Map()), yt.set(this, /* @__PURE__ */ new Map()), ut.set(this, /* @__PURE__ */ new Map());
|
|
695
|
-
for (const o of r)
|
|
696
|
-
this.define(o);
|
|
697
|
-
}
|
|
698
|
-
define(r, o = !1) {
|
|
699
|
-
for (let [p, l] of Object.entries(r)) {
|
|
700
|
-
p = p.toLowerCase(), l = l.map((a) => a.toLowerCase()), it(this, ut, "f").has(p) || it(this, ut, "f").set(p, /* @__PURE__ */ new Set());
|
|
701
|
-
const f = it(this, ut, "f").get(p);
|
|
702
|
-
let c = !0;
|
|
703
|
-
for (let a of l) {
|
|
704
|
-
const h = a.startsWith("*");
|
|
705
|
-
if (a = h ? a.slice(1) : a, f == null || f.add(a), c && it(this, yt, "f").set(p, a), c = !1, h)
|
|
706
|
-
continue;
|
|
707
|
-
const g = it(this, xt, "f").get(a);
|
|
708
|
-
if (g && g != p && !o)
|
|
709
|
-
throw new Error(`"${p} -> ${a}" conflicts with "${g} -> ${a}". Pass \`force=true\` to override this definition.`);
|
|
710
|
-
it(this, xt, "f").set(a, p);
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
return this;
|
|
714
|
-
}
|
|
715
|
-
getType(r) {
|
|
716
|
-
if (typeof r != "string")
|
|
717
|
-
return null;
|
|
718
|
-
const o = r.replace(/^.*[/\\]/, "").toLowerCase(), p = o.replace(/^.*\./, "").toLowerCase(), l = o.length < r.length;
|
|
719
|
-
return !(p.length < o.length - 1) && l ? null : it(this, xt, "f").get(p) ?? null;
|
|
720
|
-
}
|
|
721
|
-
getExtension(r) {
|
|
722
|
-
var o;
|
|
723
|
-
return typeof r != "string" ? null : (r = (o = r == null ? void 0 : r.split) == null ? void 0 : o.call(r, ";")[0], (r && it(this, yt, "f").get(r.trim().toLowerCase())) ?? null);
|
|
724
|
-
}
|
|
725
|
-
getAllExtensions(r) {
|
|
726
|
-
return typeof r != "string" ? null : it(this, ut, "f").get(r.toLowerCase()) ?? null;
|
|
727
|
-
}
|
|
728
|
-
_freeze() {
|
|
729
|
-
this.define = () => {
|
|
730
|
-
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
731
|
-
}, Object.freeze(this);
|
|
732
|
-
for (const r of it(this, ut, "f").values())
|
|
733
|
-
Object.freeze(r);
|
|
734
|
-
return this;
|
|
735
|
-
}
|
|
736
|
-
_getTestState() {
|
|
737
|
-
return {
|
|
738
|
-
types: it(this, xt, "f"),
|
|
739
|
-
extensions: it(this, yt, "f")
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
xt = /* @__PURE__ */ new WeakMap(), yt = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap();
|
|
744
|
-
const Ei = new wi(_e)._freeze();
|
|
745
|
-
var Lt = { exports: {} };
|
|
746
|
-
typeof Object.create == "function" ? Lt.exports = function(r, o) {
|
|
747
|
-
o && (r.super_ = o, r.prototype = Object.create(o.prototype, {
|
|
748
|
-
constructor: {
|
|
749
|
-
value: r,
|
|
750
|
-
enumerable: !1,
|
|
751
|
-
writable: !0,
|
|
752
|
-
configurable: !0
|
|
753
|
-
}
|
|
754
|
-
}));
|
|
755
|
-
} : Lt.exports = function(r, o) {
|
|
756
|
-
if (o) {
|
|
757
|
-
r.super_ = o;
|
|
758
|
-
var p = function() {
|
|
759
|
-
};
|
|
760
|
-
p.prototype = o.prototype, r.prototype = new p(), r.prototype.constructor = r;
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
var Ae = Lt.exports, Pt = { exports: {} }, Fe = {}, Tt = {};
|
|
764
|
-
Tt.byteLength = Si;
|
|
765
|
-
Tt.toByteArray = Ai;
|
|
766
|
-
Tt.fromByteArray = Bi;
|
|
767
|
-
var ot = [], rt = [], bi = typeof Uint8Array < "u" ? Uint8Array : Array, Nt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
768
|
-
for (var mt = 0, vi = Nt.length; mt < vi; ++mt)
|
|
769
|
-
ot[mt] = Nt[mt], rt[Nt.charCodeAt(mt)] = mt;
|
|
770
|
-
rt[45] = 62;
|
|
771
|
-
rt[95] = 63;
|
|
772
|
-
function Oe(i) {
|
|
773
|
-
var r = i.length;
|
|
774
|
-
if (r % 4 > 0)
|
|
775
|
-
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
776
|
-
var o = i.indexOf("=");
|
|
777
|
-
o === -1 && (o = r);
|
|
778
|
-
var p = o === r ? 0 : 4 - o % 4;
|
|
779
|
-
return [o, p];
|
|
780
|
-
}
|
|
781
|
-
function Si(i) {
|
|
782
|
-
var r = Oe(i), o = r[0], p = r[1];
|
|
783
|
-
return (o + p) * 3 / 4 - p;
|
|
784
|
-
}
|
|
785
|
-
function _i(i, r, o) {
|
|
786
|
-
return (r + o) * 3 / 4 - o;
|
|
787
|
-
}
|
|
788
|
-
function Ai(i) {
|
|
789
|
-
var r, o = Oe(i), p = o[0], l = o[1], f = new bi(_i(i, p, l)), c = 0, a = l > 0 ? p - 4 : p, h;
|
|
790
|
-
for (h = 0; h < a; h += 4)
|
|
791
|
-
r = rt[i.charCodeAt(h)] << 18 | rt[i.charCodeAt(h + 1)] << 12 | rt[i.charCodeAt(h + 2)] << 6 | rt[i.charCodeAt(h + 3)], f[c++] = r >> 16 & 255, f[c++] = r >> 8 & 255, f[c++] = r & 255;
|
|
792
|
-
return l === 2 && (r = rt[i.charCodeAt(h)] << 2 | rt[i.charCodeAt(h + 1)] >> 4, f[c++] = r & 255), l === 1 && (r = rt[i.charCodeAt(h)] << 10 | rt[i.charCodeAt(h + 1)] << 4 | rt[i.charCodeAt(h + 2)] >> 2, f[c++] = r >> 8 & 255, f[c++] = r & 255), f;
|
|
793
|
-
}
|
|
794
|
-
function Fi(i) {
|
|
795
|
-
return ot[i >> 18 & 63] + ot[i >> 12 & 63] + ot[i >> 6 & 63] + ot[i & 63];
|
|
796
|
-
}
|
|
797
|
-
function Oi(i, r, o) {
|
|
798
|
-
for (var p, l = [], f = r; f < o; f += 3)
|
|
799
|
-
p = (i[f] << 16 & 16711680) + (i[f + 1] << 8 & 65280) + (i[f + 2] & 255), l.push(Fi(p));
|
|
800
|
-
return l.join("");
|
|
801
|
-
}
|
|
802
|
-
function Bi(i) {
|
|
803
|
-
for (var r, o = i.length, p = o % 3, l = [], f = 16383, c = 0, a = o - p; c < a; c += f)
|
|
804
|
-
l.push(Oi(i, c, c + f > a ? a : c + f));
|
|
805
|
-
return p === 1 ? (r = i[o - 1], l.push(
|
|
806
|
-
ot[r >> 2] + ot[r << 4 & 63] + "=="
|
|
807
|
-
)) : p === 2 && (r = (i[o - 2] << 8) + i[o - 1], l.push(
|
|
808
|
-
ot[r >> 10] + ot[r >> 4 & 63] + ot[r << 2 & 63] + "="
|
|
809
|
-
)), l.join("");
|
|
810
|
-
}
|
|
811
|
-
var Gt = {};
|
|
812
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
813
|
-
Gt.read = function(i, r, o, p, l) {
|
|
814
|
-
var f, c, a = l * 8 - p - 1, h = (1 << a) - 1, g = h >> 1, y = -7, b = o ? l - 1 : 0, F = o ? -1 : 1, j = i[r + b];
|
|
815
|
-
for (b += F, f = j & (1 << -y) - 1, j >>= -y, y += a; y > 0; f = f * 256 + i[r + b], b += F, y -= 8)
|
|
816
|
-
;
|
|
817
|
-
for (c = f & (1 << -y) - 1, f >>= -y, y += p; y > 0; c = c * 256 + i[r + b], b += F, y -= 8)
|
|
818
|
-
;
|
|
819
|
-
if (f === 0)
|
|
820
|
-
f = 1 - g;
|
|
821
|
-
else {
|
|
822
|
-
if (f === h)
|
|
823
|
-
return c ? NaN : (j ? -1 : 1) * (1 / 0);
|
|
824
|
-
c = c + Math.pow(2, p), f = f - g;
|
|
825
|
-
}
|
|
826
|
-
return (j ? -1 : 1) * c * Math.pow(2, f - p);
|
|
827
|
-
};
|
|
828
|
-
Gt.write = function(i, r, o, p, l, f) {
|
|
829
|
-
var c, a, h, g = f * 8 - l - 1, y = (1 << g) - 1, b = y >> 1, F = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, j = p ? 0 : f - 1, U = p ? 1 : -1, q = r < 0 || r === 0 && 1 / r < 0 ? 1 : 0;
|
|
830
|
-
for (r = Math.abs(r), isNaN(r) || r === 1 / 0 ? (a = isNaN(r) ? 1 : 0, c = y) : (c = Math.floor(Math.log(r) / Math.LN2), r * (h = Math.pow(2, -c)) < 1 && (c--, h *= 2), c + b >= 1 ? r += F / h : r += F * Math.pow(2, 1 - b), r * h >= 2 && (c++, h /= 2), c + b >= y ? (a = 0, c = y) : c + b >= 1 ? (a = (r * h - 1) * Math.pow(2, l), c = c + b) : (a = r * Math.pow(2, b - 1) * Math.pow(2, l), c = 0)); l >= 8; i[o + j] = a & 255, j += U, a /= 256, l -= 8)
|
|
831
|
-
;
|
|
832
|
-
for (c = c << l | a, g += l; g > 0; i[o + j] = c & 255, j += U, c /= 256, g -= 8)
|
|
833
|
-
;
|
|
834
|
-
i[o + j - U] |= q * 128;
|
|
835
|
-
};
|
|
836
|
-
/*!
|
|
837
|
-
* The buffer module from node.js, for the browser.
|
|
838
|
-
*
|
|
839
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
840
|
-
* @license MIT
|
|
841
|
-
*/
|
|
842
|
-
(function(i) {
|
|
843
|
-
var r = Tt, o = Gt, p = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
844
|
-
i.Buffer = a, i.SlowBuffer = E, i.INSPECT_MAX_BYTES = 50;
|
|
845
|
-
var l = 2147483647;
|
|
846
|
-
i.kMaxLength = l, a.TYPED_ARRAY_SUPPORT = f(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
847
|
-
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
848
|
-
);
|
|
849
|
-
function f() {
|
|
850
|
-
try {
|
|
851
|
-
var n = new Uint8Array(1), t = { foo: function() {
|
|
852
|
-
return 42;
|
|
853
|
-
} };
|
|
854
|
-
return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(n, t), n.foo() === 42;
|
|
855
|
-
} catch {
|
|
856
|
-
return !1;
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
Object.defineProperty(a.prototype, "parent", {
|
|
860
|
-
enumerable: !0,
|
|
861
|
-
get: function() {
|
|
862
|
-
if (a.isBuffer(this))
|
|
863
|
-
return this.buffer;
|
|
864
|
-
}
|
|
865
|
-
}), Object.defineProperty(a.prototype, "offset", {
|
|
866
|
-
enumerable: !0,
|
|
867
|
-
get: function() {
|
|
868
|
-
if (a.isBuffer(this))
|
|
869
|
-
return this.byteOffset;
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
function c(n) {
|
|
873
|
-
if (n > l)
|
|
874
|
-
throw new RangeError('The value "' + n + '" is invalid for option "size"');
|
|
875
|
-
var t = new Uint8Array(n);
|
|
876
|
-
return Object.setPrototypeOf(t, a.prototype), t;
|
|
877
|
-
}
|
|
878
|
-
function a(n, t, e) {
|
|
879
|
-
if (typeof n == "number") {
|
|
880
|
-
if (typeof t == "string")
|
|
881
|
-
throw new TypeError(
|
|
882
|
-
'The "string" argument must be of type string. Received type number'
|
|
883
|
-
);
|
|
884
|
-
return b(n);
|
|
885
|
-
}
|
|
886
|
-
return h(n, t, e);
|
|
887
|
-
}
|
|
888
|
-
a.poolSize = 8192;
|
|
889
|
-
function h(n, t, e) {
|
|
890
|
-
if (typeof n == "string")
|
|
891
|
-
return F(n, t);
|
|
892
|
-
if (ArrayBuffer.isView(n))
|
|
893
|
-
return U(n);
|
|
894
|
-
if (n == null)
|
|
895
|
-
throw new TypeError(
|
|
896
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
|
|
897
|
-
);
|
|
898
|
-
if (nt(n, ArrayBuffer) || n && nt(n.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (nt(n, SharedArrayBuffer) || n && nt(n.buffer, SharedArrayBuffer)))
|
|
899
|
-
return q(n, t, e);
|
|
900
|
-
if (typeof n == "number")
|
|
901
|
-
throw new TypeError(
|
|
902
|
-
'The "value" argument must not be of type number. Received type number'
|
|
903
|
-
);
|
|
904
|
-
var s = n.valueOf && n.valueOf();
|
|
905
|
-
if (s != null && s !== n)
|
|
906
|
-
return a.from(s, t, e);
|
|
907
|
-
var u = Y(n);
|
|
908
|
-
if (u)
|
|
909
|
-
return u;
|
|
910
|
-
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof n[Symbol.toPrimitive] == "function")
|
|
911
|
-
return a.from(
|
|
912
|
-
n[Symbol.toPrimitive]("string"),
|
|
913
|
-
t,
|
|
914
|
-
e
|
|
915
|
-
);
|
|
916
|
-
throw new TypeError(
|
|
917
|
-
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof n
|
|
918
|
-
);
|
|
919
|
-
}
|
|
920
|
-
a.from = function(n, t, e) {
|
|
921
|
-
return h(n, t, e);
|
|
922
|
-
}, Object.setPrototypeOf(a.prototype, Uint8Array.prototype), Object.setPrototypeOf(a, Uint8Array);
|
|
923
|
-
function g(n) {
|
|
924
|
-
if (typeof n != "number")
|
|
925
|
-
throw new TypeError('"size" argument must be of type number');
|
|
926
|
-
if (n < 0)
|
|
927
|
-
throw new RangeError('The value "' + n + '" is invalid for option "size"');
|
|
928
|
-
}
|
|
929
|
-
function y(n, t, e) {
|
|
930
|
-
return g(n), n <= 0 ? c(n) : t !== void 0 ? typeof e == "string" ? c(n).fill(t, e) : c(n).fill(t) : c(n);
|
|
931
|
-
}
|
|
932
|
-
a.alloc = function(n, t, e) {
|
|
933
|
-
return y(n, t, e);
|
|
934
|
-
};
|
|
935
|
-
function b(n) {
|
|
936
|
-
return g(n), c(n < 0 ? 0 : w(n) | 0);
|
|
937
|
-
}
|
|
938
|
-
a.allocUnsafe = function(n) {
|
|
939
|
-
return b(n);
|
|
940
|
-
}, a.allocUnsafeSlow = function(n) {
|
|
941
|
-
return b(n);
|
|
942
|
-
};
|
|
943
|
-
function F(n, t) {
|
|
944
|
-
if ((typeof t != "string" || t === "") && (t = "utf8"), !a.isEncoding(t))
|
|
945
|
-
throw new TypeError("Unknown encoding: " + t);
|
|
946
|
-
var e = v(n, t) | 0, s = c(e), u = s.write(n, t);
|
|
947
|
-
return u !== e && (s = s.slice(0, u)), s;
|
|
948
|
-
}
|
|
949
|
-
function j(n) {
|
|
950
|
-
for (var t = n.length < 0 ? 0 : w(n.length) | 0, e = c(t), s = 0; s < t; s += 1)
|
|
951
|
-
e[s] = n[s] & 255;
|
|
952
|
-
return e;
|
|
953
|
-
}
|
|
954
|
-
function U(n) {
|
|
955
|
-
if (nt(n, Uint8Array)) {
|
|
956
|
-
var t = new Uint8Array(n);
|
|
957
|
-
return q(t.buffer, t.byteOffset, t.byteLength);
|
|
958
|
-
}
|
|
959
|
-
return j(n);
|
|
960
|
-
}
|
|
961
|
-
function q(n, t, e) {
|
|
962
|
-
if (t < 0 || n.byteLength < t)
|
|
963
|
-
throw new RangeError('"offset" is outside of buffer bounds');
|
|
964
|
-
if (n.byteLength < t + (e || 0))
|
|
965
|
-
throw new RangeError('"length" is outside of buffer bounds');
|
|
966
|
-
var s;
|
|
967
|
-
return t === void 0 && e === void 0 ? s = new Uint8Array(n) : e === void 0 ? s = new Uint8Array(n, t) : s = new Uint8Array(n, t, e), Object.setPrototypeOf(s, a.prototype), s;
|
|
968
|
-
}
|
|
969
|
-
function Y(n) {
|
|
970
|
-
if (a.isBuffer(n)) {
|
|
971
|
-
var t = w(n.length) | 0, e = c(t);
|
|
972
|
-
return e.length === 0 || n.copy(e, 0, 0, t), e;
|
|
973
|
-
}
|
|
974
|
-
if (n.length !== void 0)
|
|
975
|
-
return typeof n.length != "number" || $t(n.length) ? c(0) : j(n);
|
|
976
|
-
if (n.type === "Buffer" && Array.isArray(n.data))
|
|
977
|
-
return j(n.data);
|
|
978
|
-
}
|
|
979
|
-
function w(n) {
|
|
980
|
-
if (n >= l)
|
|
981
|
-
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + l.toString(16) + " bytes");
|
|
982
|
-
return n | 0;
|
|
983
|
-
}
|
|
984
|
-
function E(n) {
|
|
985
|
-
return +n != n && (n = 0), a.alloc(+n);
|
|
986
|
-
}
|
|
987
|
-
a.isBuffer = function(t) {
|
|
988
|
-
return t != null && t._isBuffer === !0 && t !== a.prototype;
|
|
989
|
-
}, a.compare = function(t, e) {
|
|
990
|
-
if (nt(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), nt(e, Uint8Array) && (e = a.from(e, e.offset, e.byteLength)), !a.isBuffer(t) || !a.isBuffer(e))
|
|
991
|
-
throw new TypeError(
|
|
992
|
-
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
993
|
-
);
|
|
994
|
-
if (t === e)
|
|
995
|
-
return 0;
|
|
996
|
-
for (var s = t.length, u = e.length, x = 0, d = Math.min(s, u); x < d; ++x)
|
|
997
|
-
if (t[x] !== e[x]) {
|
|
998
|
-
s = t[x], u = e[x];
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
return s < u ? -1 : u < s ? 1 : 0;
|
|
1002
|
-
}, a.isEncoding = function(t) {
|
|
1003
|
-
switch (String(t).toLowerCase()) {
|
|
1004
|
-
case "hex":
|
|
1005
|
-
case "utf8":
|
|
1006
|
-
case "utf-8":
|
|
1007
|
-
case "ascii":
|
|
1008
|
-
case "latin1":
|
|
1009
|
-
case "binary":
|
|
1010
|
-
case "base64":
|
|
1011
|
-
case "ucs2":
|
|
1012
|
-
case "ucs-2":
|
|
1013
|
-
case "utf16le":
|
|
1014
|
-
case "utf-16le":
|
|
1015
|
-
return !0;
|
|
1016
|
-
default:
|
|
1017
|
-
return !1;
|
|
1018
|
-
}
|
|
1019
|
-
}, a.concat = function(t, e) {
|
|
1020
|
-
if (!Array.isArray(t))
|
|
1021
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1022
|
-
if (t.length === 0)
|
|
1023
|
-
return a.alloc(0);
|
|
1024
|
-
var s;
|
|
1025
|
-
if (e === void 0)
|
|
1026
|
-
for (e = 0, s = 0; s < t.length; ++s)
|
|
1027
|
-
e += t[s].length;
|
|
1028
|
-
var u = a.allocUnsafe(e), x = 0;
|
|
1029
|
-
for (s = 0; s < t.length; ++s) {
|
|
1030
|
-
var d = t[s];
|
|
1031
|
-
if (nt(d, Uint8Array))
|
|
1032
|
-
x + d.length > u.length ? a.from(d).copy(u, x) : Uint8Array.prototype.set.call(
|
|
1033
|
-
u,
|
|
1034
|
-
d,
|
|
1035
|
-
x
|
|
1036
|
-
);
|
|
1037
|
-
else if (a.isBuffer(d))
|
|
1038
|
-
d.copy(u, x);
|
|
1039
|
-
else
|
|
1040
|
-
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
1041
|
-
x += d.length;
|
|
1042
|
-
}
|
|
1043
|
-
return u;
|
|
1044
|
-
};
|
|
1045
|
-
function v(n, t) {
|
|
1046
|
-
if (a.isBuffer(n))
|
|
1047
|
-
return n.length;
|
|
1048
|
-
if (ArrayBuffer.isView(n) || nt(n, ArrayBuffer))
|
|
1049
|
-
return n.byteLength;
|
|
1050
|
-
if (typeof n != "string")
|
|
1051
|
-
throw new TypeError(
|
|
1052
|
-
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof n
|
|
1053
|
-
);
|
|
1054
|
-
var e = n.length, s = arguments.length > 2 && arguments[2] === !0;
|
|
1055
|
-
if (!s && e === 0)
|
|
1056
|
-
return 0;
|
|
1057
|
-
for (var u = !1; ; )
|
|
1058
|
-
switch (t) {
|
|
1059
|
-
case "ascii":
|
|
1060
|
-
case "latin1":
|
|
1061
|
-
case "binary":
|
|
1062
|
-
return e;
|
|
1063
|
-
case "utf8":
|
|
1064
|
-
case "utf-8":
|
|
1065
|
-
return X(n).length;
|
|
1066
|
-
case "ucs2":
|
|
1067
|
-
case "ucs-2":
|
|
1068
|
-
case "utf16le":
|
|
1069
|
-
case "utf-16le":
|
|
1070
|
-
return e * 2;
|
|
1071
|
-
case "hex":
|
|
1072
|
-
return e >>> 1;
|
|
1073
|
-
case "base64":
|
|
1074
|
-
return lt(n).length;
|
|
1075
|
-
default:
|
|
1076
|
-
if (u)
|
|
1077
|
-
return s ? -1 : X(n).length;
|
|
1078
|
-
t = ("" + t).toLowerCase(), u = !0;
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
a.byteLength = v;
|
|
1082
|
-
function M(n, t, e) {
|
|
1083
|
-
var s = !1;
|
|
1084
|
-
if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((e === void 0 || e > this.length) && (e = this.length), e <= 0) || (e >>>= 0, t >>>= 0, e <= t))
|
|
1085
|
-
return "";
|
|
1086
|
-
for (n || (n = "utf8"); ; )
|
|
1087
|
-
switch (n) {
|
|
1088
|
-
case "hex":
|
|
1089
|
-
return A(this, t, e);
|
|
1090
|
-
case "utf8":
|
|
1091
|
-
case "utf-8":
|
|
1092
|
-
return m(this, t, e);
|
|
1093
|
-
case "ascii":
|
|
1094
|
-
return B(this, t, e);
|
|
1095
|
-
case "latin1":
|
|
1096
|
-
case "binary":
|
|
1097
|
-
return C(this, t, e);
|
|
1098
|
-
case "base64":
|
|
1099
|
-
return W(this, t, e);
|
|
1100
|
-
case "ucs2":
|
|
1101
|
-
case "ucs-2":
|
|
1102
|
-
case "utf16le":
|
|
1103
|
-
case "utf-16le":
|
|
1104
|
-
return T(this, t, e);
|
|
1105
|
-
default:
|
|
1106
|
-
if (s)
|
|
1107
|
-
throw new TypeError("Unknown encoding: " + n);
|
|
1108
|
-
n = (n + "").toLowerCase(), s = !0;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
a.prototype._isBuffer = !0;
|
|
1112
|
-
function J(n, t, e) {
|
|
1113
|
-
var s = n[t];
|
|
1114
|
-
n[t] = n[e], n[e] = s;
|
|
1115
|
-
}
|
|
1116
|
-
a.prototype.swap16 = function() {
|
|
1117
|
-
var t = this.length;
|
|
1118
|
-
if (t % 2 !== 0)
|
|
1119
|
-
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1120
|
-
for (var e = 0; e < t; e += 2)
|
|
1121
|
-
J(this, e, e + 1);
|
|
1122
|
-
return this;
|
|
1123
|
-
}, a.prototype.swap32 = function() {
|
|
1124
|
-
var t = this.length;
|
|
1125
|
-
if (t % 4 !== 0)
|
|
1126
|
-
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1127
|
-
for (var e = 0; e < t; e += 4)
|
|
1128
|
-
J(this, e, e + 3), J(this, e + 1, e + 2);
|
|
1129
|
-
return this;
|
|
1130
|
-
}, a.prototype.swap64 = function() {
|
|
1131
|
-
var t = this.length;
|
|
1132
|
-
if (t % 8 !== 0)
|
|
1133
|
-
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1134
|
-
for (var e = 0; e < t; e += 8)
|
|
1135
|
-
J(this, e, e + 7), J(this, e + 1, e + 6), J(this, e + 2, e + 5), J(this, e + 3, e + 4);
|
|
1136
|
-
return this;
|
|
1137
|
-
}, a.prototype.toString = function() {
|
|
1138
|
-
var t = this.length;
|
|
1139
|
-
return t === 0 ? "" : arguments.length === 0 ? m(this, 0, t) : M.apply(this, arguments);
|
|
1140
|
-
}, a.prototype.toLocaleString = a.prototype.toString, a.prototype.equals = function(t) {
|
|
1141
|
-
if (!a.isBuffer(t))
|
|
1142
|
-
throw new TypeError("Argument must be a Buffer");
|
|
1143
|
-
return this === t ? !0 : a.compare(this, t) === 0;
|
|
1144
|
-
}, a.prototype.inspect = function() {
|
|
1145
|
-
var t = "", e = i.INSPECT_MAX_BYTES;
|
|
1146
|
-
return t = this.toString("hex", 0, e).replace(/(.{2})/g, "$1 ").trim(), this.length > e && (t += " ... "), "<Buffer " + t + ">";
|
|
1147
|
-
}, p && (a.prototype[p] = a.prototype.inspect), a.prototype.compare = function(t, e, s, u, x) {
|
|
1148
|
-
if (nt(t, Uint8Array) && (t = a.from(t, t.offset, t.byteLength)), !a.isBuffer(t))
|
|
1149
|
-
throw new TypeError(
|
|
1150
|
-
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
|
|
1151
|
-
);
|
|
1152
|
-
if (e === void 0 && (e = 0), s === void 0 && (s = t ? t.length : 0), u === void 0 && (u = 0), x === void 0 && (x = this.length), e < 0 || s > t.length || u < 0 || x > this.length)
|
|
1153
|
-
throw new RangeError("out of range index");
|
|
1154
|
-
if (u >= x && e >= s)
|
|
1155
|
-
return 0;
|
|
1156
|
-
if (u >= x)
|
|
1157
|
-
return -1;
|
|
1158
|
-
if (e >= s)
|
|
1159
|
-
return 1;
|
|
1160
|
-
if (e >>>= 0, s >>>= 0, u >>>= 0, x >>>= 0, this === t)
|
|
1161
|
-
return 0;
|
|
1162
|
-
for (var d = x - u, k = s - e, N = Math.min(d, k), P = this.slice(u, x), Z = t.slice(e, s), z = 0; z < N; ++z)
|
|
1163
|
-
if (P[z] !== Z[z]) {
|
|
1164
|
-
d = P[z], k = Z[z];
|
|
1165
|
-
break;
|
|
1166
|
-
}
|
|
1167
|
-
return d < k ? -1 : k < d ? 1 : 0;
|
|
1168
|
-
};
|
|
1169
|
-
function V(n, t, e, s, u) {
|
|
1170
|
-
if (n.length === 0)
|
|
1171
|
-
return -1;
|
|
1172
|
-
if (typeof e == "string" ? (s = e, e = 0) : e > 2147483647 ? e = 2147483647 : e < -2147483648 && (e = -2147483648), e = +e, $t(e) && (e = u ? 0 : n.length - 1), e < 0 && (e = n.length + e), e >= n.length) {
|
|
1173
|
-
if (u)
|
|
1174
|
-
return -1;
|
|
1175
|
-
e = n.length - 1;
|
|
1176
|
-
} else if (e < 0)
|
|
1177
|
-
if (u)
|
|
1178
|
-
e = 0;
|
|
1179
|
-
else
|
|
1180
|
-
return -1;
|
|
1181
|
-
if (typeof t == "string" && (t = a.from(t, s)), a.isBuffer(t))
|
|
1182
|
-
return t.length === 0 ? -1 : R(n, t, e, s, u);
|
|
1183
|
-
if (typeof t == "number")
|
|
1184
|
-
return t = t & 255, typeof Uint8Array.prototype.indexOf == "function" ? u ? Uint8Array.prototype.indexOf.call(n, t, e) : Uint8Array.prototype.lastIndexOf.call(n, t, e) : R(n, [t], e, s, u);
|
|
1185
|
-
throw new TypeError("val must be string, number or Buffer");
|
|
1186
|
-
}
|
|
1187
|
-
function R(n, t, e, s, u) {
|
|
1188
|
-
var x = 1, d = n.length, k = t.length;
|
|
1189
|
-
if (s !== void 0 && (s = String(s).toLowerCase(), s === "ucs2" || s === "ucs-2" || s === "utf16le" || s === "utf-16le")) {
|
|
1190
|
-
if (n.length < 2 || t.length < 2)
|
|
1191
|
-
return -1;
|
|
1192
|
-
x = 2, d /= 2, k /= 2, e /= 2;
|
|
1193
|
-
}
|
|
1194
|
-
function N(re, ne) {
|
|
1195
|
-
return x === 1 ? re[ne] : re.readUInt16BE(ne * x);
|
|
1196
|
-
}
|
|
1197
|
-
var P;
|
|
1198
|
-
if (u) {
|
|
1199
|
-
var Z = -1;
|
|
1200
|
-
for (P = e; P < d; P++)
|
|
1201
|
-
if (N(n, P) === N(t, Z === -1 ? 0 : P - Z)) {
|
|
1202
|
-
if (Z === -1 && (Z = P), P - Z + 1 === k)
|
|
1203
|
-
return Z * x;
|
|
1204
|
-
} else
|
|
1205
|
-
Z !== -1 && (P -= P - Z), Z = -1;
|
|
1206
|
-
} else
|
|
1207
|
-
for (e + k > d && (e = d - k), P = e; P >= 0; P--) {
|
|
1208
|
-
for (var z = !0, At = 0; At < k; At++)
|
|
1209
|
-
if (N(n, P + At) !== N(t, At)) {
|
|
1210
|
-
z = !1;
|
|
1211
|
-
break;
|
|
1212
|
-
}
|
|
1213
|
-
if (z)
|
|
1214
|
-
return P;
|
|
1215
|
-
}
|
|
1216
|
-
return -1;
|
|
1217
|
-
}
|
|
1218
|
-
a.prototype.includes = function(t, e, s) {
|
|
1219
|
-
return this.indexOf(t, e, s) !== -1;
|
|
1220
|
-
}, a.prototype.indexOf = function(t, e, s) {
|
|
1221
|
-
return V(this, t, e, s, !0);
|
|
1222
|
-
}, a.prototype.lastIndexOf = function(t, e, s) {
|
|
1223
|
-
return V(this, t, e, s, !1);
|
|
1224
|
-
};
|
|
1225
|
-
function ft(n, t, e, s) {
|
|
1226
|
-
e = Number(e) || 0;
|
|
1227
|
-
var u = n.length - e;
|
|
1228
|
-
s ? (s = Number(s), s > u && (s = u)) : s = u;
|
|
1229
|
-
var x = t.length;
|
|
1230
|
-
s > x / 2 && (s = x / 2);
|
|
1231
|
-
for (var d = 0; d < s; ++d) {
|
|
1232
|
-
var k = parseInt(t.substr(d * 2, 2), 16);
|
|
1233
|
-
if ($t(k))
|
|
1234
|
-
return d;
|
|
1235
|
-
n[e + d] = k;
|
|
1236
|
-
}
|
|
1237
|
-
return d;
|
|
1238
|
-
}
|
|
1239
|
-
function ht(n, t, e, s) {
|
|
1240
|
-
return _t(X(t, n.length - e), n, e, s);
|
|
1241
|
-
}
|
|
1242
|
-
function pt(n, t, e, s) {
|
|
1243
|
-
return _t(tt(t), n, e, s);
|
|
1244
|
-
}
|
|
1245
|
-
function ct(n, t, e, s) {
|
|
1246
|
-
return _t(lt(t), n, e, s);
|
|
1247
|
-
}
|
|
1248
|
-
function Ct(n, t, e, s) {
|
|
1249
|
-
return _t(et(t, n.length - e), n, e, s);
|
|
1250
|
-
}
|
|
1251
|
-
a.prototype.write = function(t, e, s, u) {
|
|
1252
|
-
if (e === void 0)
|
|
1253
|
-
u = "utf8", s = this.length, e = 0;
|
|
1254
|
-
else if (s === void 0 && typeof e == "string")
|
|
1255
|
-
u = e, s = this.length, e = 0;
|
|
1256
|
-
else if (isFinite(e))
|
|
1257
|
-
e = e >>> 0, isFinite(s) ? (s = s >>> 0, u === void 0 && (u = "utf8")) : (u = s, s = void 0);
|
|
1258
|
-
else
|
|
1259
|
-
throw new Error(
|
|
1260
|
-
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
1261
|
-
);
|
|
1262
|
-
var x = this.length - e;
|
|
1263
|
-
if ((s === void 0 || s > x) && (s = x), t.length > 0 && (s < 0 || e < 0) || e > this.length)
|
|
1264
|
-
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1265
|
-
u || (u = "utf8");
|
|
1266
|
-
for (var d = !1; ; )
|
|
1267
|
-
switch (u) {
|
|
1268
|
-
case "hex":
|
|
1269
|
-
return ft(this, t, e, s);
|
|
1270
|
-
case "utf8":
|
|
1271
|
-
case "utf-8":
|
|
1272
|
-
return ht(this, t, e, s);
|
|
1273
|
-
case "ascii":
|
|
1274
|
-
case "latin1":
|
|
1275
|
-
case "binary":
|
|
1276
|
-
return pt(this, t, e, s);
|
|
1277
|
-
case "base64":
|
|
1278
|
-
return ct(this, t, e, s);
|
|
1279
|
-
case "ucs2":
|
|
1280
|
-
case "ucs-2":
|
|
1281
|
-
case "utf16le":
|
|
1282
|
-
case "utf-16le":
|
|
1283
|
-
return Ct(this, t, e, s);
|
|
1284
|
-
default:
|
|
1285
|
-
if (d)
|
|
1286
|
-
throw new TypeError("Unknown encoding: " + u);
|
|
1287
|
-
u = ("" + u).toLowerCase(), d = !0;
|
|
1288
|
-
}
|
|
1289
|
-
}, a.prototype.toJSON = function() {
|
|
1290
|
-
return {
|
|
1291
|
-
type: "Buffer",
|
|
1292
|
-
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
1293
|
-
};
|
|
1294
|
-
};
|
|
1295
|
-
function W(n, t, e) {
|
|
1296
|
-
return t === 0 && e === n.length ? r.fromByteArray(n) : r.fromByteArray(n.slice(t, e));
|
|
1297
|
-
}
|
|
1298
|
-
function m(n, t, e) {
|
|
1299
|
-
e = Math.min(n.length, e);
|
|
1300
|
-
for (var s = [], u = t; u < e; ) {
|
|
1301
|
-
var x = n[u], d = null, k = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
|
|
1302
|
-
if (u + k <= e) {
|
|
1303
|
-
var N, P, Z, z;
|
|
1304
|
-
switch (k) {
|
|
1305
|
-
case 1:
|
|
1306
|
-
x < 128 && (d = x);
|
|
1307
|
-
break;
|
|
1308
|
-
case 2:
|
|
1309
|
-
N = n[u + 1], (N & 192) === 128 && (z = (x & 31) << 6 | N & 63, z > 127 && (d = z));
|
|
1310
|
-
break;
|
|
1311
|
-
case 3:
|
|
1312
|
-
N = n[u + 1], P = n[u + 2], (N & 192) === 128 && (P & 192) === 128 && (z = (x & 15) << 12 | (N & 63) << 6 | P & 63, z > 2047 && (z < 55296 || z > 57343) && (d = z));
|
|
1313
|
-
break;
|
|
1314
|
-
case 4:
|
|
1315
|
-
N = n[u + 1], P = n[u + 2], Z = n[u + 3], (N & 192) === 128 && (P & 192) === 128 && (Z & 192) === 128 && (z = (x & 15) << 18 | (N & 63) << 12 | (P & 63) << 6 | Z & 63, z > 65535 && z < 1114112 && (d = z));
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
d === null ? (d = 65533, k = 1) : d > 65535 && (d -= 65536, s.push(d >>> 10 & 1023 | 55296), d = 56320 | d & 1023), s.push(d), u += k;
|
|
1319
|
-
}
|
|
1320
|
-
return D(s);
|
|
1321
|
-
}
|
|
1322
|
-
var S = 4096;
|
|
1323
|
-
function D(n) {
|
|
1324
|
-
var t = n.length;
|
|
1325
|
-
if (t <= S)
|
|
1326
|
-
return String.fromCharCode.apply(String, n);
|
|
1327
|
-
for (var e = "", s = 0; s < t; )
|
|
1328
|
-
e += String.fromCharCode.apply(
|
|
1329
|
-
String,
|
|
1330
|
-
n.slice(s, s += S)
|
|
1331
|
-
);
|
|
1332
|
-
return e;
|
|
1333
|
-
}
|
|
1334
|
-
function B(n, t, e) {
|
|
1335
|
-
var s = "";
|
|
1336
|
-
e = Math.min(n.length, e);
|
|
1337
|
-
for (var u = t; u < e; ++u)
|
|
1338
|
-
s += String.fromCharCode(n[u] & 127);
|
|
1339
|
-
return s;
|
|
1340
|
-
}
|
|
1341
|
-
function C(n, t, e) {
|
|
1342
|
-
var s = "";
|
|
1343
|
-
e = Math.min(n.length, e);
|
|
1344
|
-
for (var u = t; u < e; ++u)
|
|
1345
|
-
s += String.fromCharCode(n[u]);
|
|
1346
|
-
return s;
|
|
1347
|
-
}
|
|
1348
|
-
function A(n, t, e) {
|
|
1349
|
-
var s = n.length;
|
|
1350
|
-
(!t || t < 0) && (t = 0), (!e || e < 0 || e > s) && (e = s);
|
|
1351
|
-
for (var u = "", x = t; x < e; ++x)
|
|
1352
|
-
u += Ze[n[x]];
|
|
1353
|
-
return u;
|
|
1354
|
-
}
|
|
1355
|
-
function T(n, t, e) {
|
|
1356
|
-
for (var s = n.slice(t, e), u = "", x = 0; x < s.length - 1; x += 2)
|
|
1357
|
-
u += String.fromCharCode(s[x] + s[x + 1] * 256);
|
|
1358
|
-
return u;
|
|
1359
|
-
}
|
|
1360
|
-
a.prototype.slice = function(t, e) {
|
|
1361
|
-
var s = this.length;
|
|
1362
|
-
t = ~~t, e = e === void 0 ? s : ~~e, t < 0 ? (t += s, t < 0 && (t = 0)) : t > s && (t = s), e < 0 ? (e += s, e < 0 && (e = 0)) : e > s && (e = s), e < t && (e = t);
|
|
1363
|
-
var u = this.subarray(t, e);
|
|
1364
|
-
return Object.setPrototypeOf(u, a.prototype), u;
|
|
1365
|
-
};
|
|
1366
|
-
function O(n, t, e) {
|
|
1367
|
-
if (n % 1 !== 0 || n < 0)
|
|
1368
|
-
throw new RangeError("offset is not uint");
|
|
1369
|
-
if (n + t > e)
|
|
1370
|
-
throw new RangeError("Trying to access beyond buffer length");
|
|
1371
|
-
}
|
|
1372
|
-
a.prototype.readUintLE = a.prototype.readUIntLE = function(t, e, s) {
|
|
1373
|
-
t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
|
|
1374
|
-
for (var u = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
|
|
1375
|
-
u += this[t + d] * x;
|
|
1376
|
-
return u;
|
|
1377
|
-
}, a.prototype.readUintBE = a.prototype.readUIntBE = function(t, e, s) {
|
|
1378
|
-
t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
|
|
1379
|
-
for (var u = this[t + --e], x = 1; e > 0 && (x *= 256); )
|
|
1380
|
-
u += this[t + --e] * x;
|
|
1381
|
-
return u;
|
|
1382
|
-
}, a.prototype.readUint8 = a.prototype.readUInt8 = function(t, e) {
|
|
1383
|
-
return t = t >>> 0, e || O(t, 1, this.length), this[t];
|
|
1384
|
-
}, a.prototype.readUint16LE = a.prototype.readUInt16LE = function(t, e) {
|
|
1385
|
-
return t = t >>> 0, e || O(t, 2, this.length), this[t] | this[t + 1] << 8;
|
|
1386
|
-
}, a.prototype.readUint16BE = a.prototype.readUInt16BE = function(t, e) {
|
|
1387
|
-
return t = t >>> 0, e || O(t, 2, this.length), this[t] << 8 | this[t + 1];
|
|
1388
|
-
}, a.prototype.readUint32LE = a.prototype.readUInt32LE = function(t, e) {
|
|
1389
|
-
return t = t >>> 0, e || O(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
|
|
1390
|
-
}, a.prototype.readUint32BE = a.prototype.readUInt32BE = function(t, e) {
|
|
1391
|
-
return t = t >>> 0, e || O(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
|
|
1392
|
-
}, a.prototype.readIntLE = function(t, e, s) {
|
|
1393
|
-
t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
|
|
1394
|
-
for (var u = this[t], x = 1, d = 0; ++d < e && (x *= 256); )
|
|
1395
|
-
u += this[t + d] * x;
|
|
1396
|
-
return x *= 128, u >= x && (u -= Math.pow(2, 8 * e)), u;
|
|
1397
|
-
}, a.prototype.readIntBE = function(t, e, s) {
|
|
1398
|
-
t = t >>> 0, e = e >>> 0, s || O(t, e, this.length);
|
|
1399
|
-
for (var u = e, x = 1, d = this[t + --u]; u > 0 && (x *= 256); )
|
|
1400
|
-
d += this[t + --u] * x;
|
|
1401
|
-
return x *= 128, d >= x && (d -= Math.pow(2, 8 * e)), d;
|
|
1402
|
-
}, a.prototype.readInt8 = function(t, e) {
|
|
1403
|
-
return t = t >>> 0, e || O(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
|
|
1404
|
-
}, a.prototype.readInt16LE = function(t, e) {
|
|
1405
|
-
t = t >>> 0, e || O(t, 2, this.length);
|
|
1406
|
-
var s = this[t] | this[t + 1] << 8;
|
|
1407
|
-
return s & 32768 ? s | 4294901760 : s;
|
|
1408
|
-
}, a.prototype.readInt16BE = function(t, e) {
|
|
1409
|
-
t = t >>> 0, e || O(t, 2, this.length);
|
|
1410
|
-
var s = this[t + 1] | this[t] << 8;
|
|
1411
|
-
return s & 32768 ? s | 4294901760 : s;
|
|
1412
|
-
}, a.prototype.readInt32LE = function(t, e) {
|
|
1413
|
-
return t = t >>> 0, e || O(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
|
|
1414
|
-
}, a.prototype.readInt32BE = function(t, e) {
|
|
1415
|
-
return t = t >>> 0, e || O(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
|
|
1416
|
-
}, a.prototype.readFloatLE = function(t, e) {
|
|
1417
|
-
return t = t >>> 0, e || O(t, 4, this.length), o.read(this, t, !0, 23, 4);
|
|
1418
|
-
}, a.prototype.readFloatBE = function(t, e) {
|
|
1419
|
-
return t = t >>> 0, e || O(t, 4, this.length), o.read(this, t, !1, 23, 4);
|
|
1420
|
-
}, a.prototype.readDoubleLE = function(t, e) {
|
|
1421
|
-
return t = t >>> 0, e || O(t, 8, this.length), o.read(this, t, !0, 52, 8);
|
|
1422
|
-
}, a.prototype.readDoubleBE = function(t, e) {
|
|
1423
|
-
return t = t >>> 0, e || O(t, 8, this.length), o.read(this, t, !1, 52, 8);
|
|
1424
|
-
};
|
|
1425
|
-
function I(n, t, e, s, u, x) {
|
|
1426
|
-
if (!a.isBuffer(n))
|
|
1427
|
-
throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1428
|
-
if (t > u || t < x)
|
|
1429
|
-
throw new RangeError('"value" argument is out of bounds');
|
|
1430
|
-
if (e + s > n.length)
|
|
1431
|
-
throw new RangeError("Index out of range");
|
|
1432
|
-
}
|
|
1433
|
-
a.prototype.writeUintLE = a.prototype.writeUIntLE = function(t, e, s, u) {
|
|
1434
|
-
if (t = +t, e = e >>> 0, s = s >>> 0, !u) {
|
|
1435
|
-
var x = Math.pow(2, 8 * s) - 1;
|
|
1436
|
-
I(this, t, e, s, x, 0);
|
|
1437
|
-
}
|
|
1438
|
-
var d = 1, k = 0;
|
|
1439
|
-
for (this[e] = t & 255; ++k < s && (d *= 256); )
|
|
1440
|
-
this[e + k] = t / d & 255;
|
|
1441
|
-
return e + s;
|
|
1442
|
-
}, a.prototype.writeUintBE = a.prototype.writeUIntBE = function(t, e, s, u) {
|
|
1443
|
-
if (t = +t, e = e >>> 0, s = s >>> 0, !u) {
|
|
1444
|
-
var x = Math.pow(2, 8 * s) - 1;
|
|
1445
|
-
I(this, t, e, s, x, 0);
|
|
1446
|
-
}
|
|
1447
|
-
var d = s - 1, k = 1;
|
|
1448
|
-
for (this[e + d] = t & 255; --d >= 0 && (k *= 256); )
|
|
1449
|
-
this[e + d] = t / k & 255;
|
|
1450
|
-
return e + s;
|
|
1451
|
-
}, a.prototype.writeUint8 = a.prototype.writeUInt8 = function(t, e, s) {
|
|
1452
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 1, 255, 0), this[e] = t & 255, e + 1;
|
|
1453
|
-
}, a.prototype.writeUint16LE = a.prototype.writeUInt16LE = function(t, e, s) {
|
|
1454
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 2, 65535, 0), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
1455
|
-
}, a.prototype.writeUint16BE = a.prototype.writeUInt16BE = function(t, e, s) {
|
|
1456
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 2, 65535, 0), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
1457
|
-
}, a.prototype.writeUint32LE = a.prototype.writeUInt32LE = function(t, e, s) {
|
|
1458
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 4, 4294967295, 0), this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = t & 255, e + 4;
|
|
1459
|
-
}, a.prototype.writeUint32BE = a.prototype.writeUInt32BE = function(t, e, s) {
|
|
1460
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 4, 4294967295, 0), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
1461
|
-
}, a.prototype.writeIntLE = function(t, e, s, u) {
|
|
1462
|
-
if (t = +t, e = e >>> 0, !u) {
|
|
1463
|
-
var x = Math.pow(2, 8 * s - 1);
|
|
1464
|
-
I(this, t, e, s, x - 1, -x);
|
|
1465
|
-
}
|
|
1466
|
-
var d = 0, k = 1, N = 0;
|
|
1467
|
-
for (this[e] = t & 255; ++d < s && (k *= 256); )
|
|
1468
|
-
t < 0 && N === 0 && this[e + d - 1] !== 0 && (N = 1), this[e + d] = (t / k >> 0) - N & 255;
|
|
1469
|
-
return e + s;
|
|
1470
|
-
}, a.prototype.writeIntBE = function(t, e, s, u) {
|
|
1471
|
-
if (t = +t, e = e >>> 0, !u) {
|
|
1472
|
-
var x = Math.pow(2, 8 * s - 1);
|
|
1473
|
-
I(this, t, e, s, x - 1, -x);
|
|
1474
|
-
}
|
|
1475
|
-
var d = s - 1, k = 1, N = 0;
|
|
1476
|
-
for (this[e + d] = t & 255; --d >= 0 && (k *= 256); )
|
|
1477
|
-
t < 0 && N === 0 && this[e + d + 1] !== 0 && (N = 1), this[e + d] = (t / k >> 0) - N & 255;
|
|
1478
|
-
return e + s;
|
|
1479
|
-
}, a.prototype.writeInt8 = function(t, e, s) {
|
|
1480
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[e] = t & 255, e + 1;
|
|
1481
|
-
}, a.prototype.writeInt16LE = function(t, e, s) {
|
|
1482
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 2, 32767, -32768), this[e] = t & 255, this[e + 1] = t >>> 8, e + 2;
|
|
1483
|
-
}, a.prototype.writeInt16BE = function(t, e, s) {
|
|
1484
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 2, 32767, -32768), this[e] = t >>> 8, this[e + 1] = t & 255, e + 2;
|
|
1485
|
-
}, a.prototype.writeInt32LE = function(t, e, s) {
|
|
1486
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 4, 2147483647, -2147483648), this[e] = t & 255, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24, e + 4;
|
|
1487
|
-
}, a.prototype.writeInt32BE = function(t, e, s) {
|
|
1488
|
-
return t = +t, e = e >>> 0, s || I(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = t & 255, e + 4;
|
|
1489
|
-
};
|
|
1490
|
-
function L(n, t, e, s, u, x) {
|
|
1491
|
-
if (e + s > n.length)
|
|
1492
|
-
throw new RangeError("Index out of range");
|
|
1493
|
-
if (e < 0)
|
|
1494
|
-
throw new RangeError("Index out of range");
|
|
1495
|
-
}
|
|
1496
|
-
function H(n, t, e, s, u) {
|
|
1497
|
-
return t = +t, e = e >>> 0, u || L(n, t, e, 4), o.write(n, t, e, s, 23, 4), e + 4;
|
|
1498
|
-
}
|
|
1499
|
-
a.prototype.writeFloatLE = function(t, e, s) {
|
|
1500
|
-
return H(this, t, e, !0, s);
|
|
1501
|
-
}, a.prototype.writeFloatBE = function(t, e, s) {
|
|
1502
|
-
return H(this, t, e, !1, s);
|
|
1503
|
-
};
|
|
1504
|
-
function $(n, t, e, s, u) {
|
|
1505
|
-
return t = +t, e = e >>> 0, u || L(n, t, e, 8), o.write(n, t, e, s, 52, 8), e + 8;
|
|
1506
|
-
}
|
|
1507
|
-
a.prototype.writeDoubleLE = function(t, e, s) {
|
|
1508
|
-
return $(this, t, e, !0, s);
|
|
1509
|
-
}, a.prototype.writeDoubleBE = function(t, e, s) {
|
|
1510
|
-
return $(this, t, e, !1, s);
|
|
1511
|
-
}, a.prototype.copy = function(t, e, s, u) {
|
|
1512
|
-
if (!a.isBuffer(t))
|
|
1513
|
-
throw new TypeError("argument should be a Buffer");
|
|
1514
|
-
if (s || (s = 0), !u && u !== 0 && (u = this.length), e >= t.length && (e = t.length), e || (e = 0), u > 0 && u < s && (u = s), u === s || t.length === 0 || this.length === 0)
|
|
1515
|
-
return 0;
|
|
1516
|
-
if (e < 0)
|
|
1517
|
-
throw new RangeError("targetStart out of bounds");
|
|
1518
|
-
if (s < 0 || s >= this.length)
|
|
1519
|
-
throw new RangeError("Index out of range");
|
|
1520
|
-
if (u < 0)
|
|
1521
|
-
throw new RangeError("sourceEnd out of bounds");
|
|
1522
|
-
u > this.length && (u = this.length), t.length - e < u - s && (u = t.length - e + s);
|
|
1523
|
-
var x = u - s;
|
|
1524
|
-
return this === t && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(e, s, u) : Uint8Array.prototype.set.call(
|
|
1525
|
-
t,
|
|
1526
|
-
this.subarray(s, u),
|
|
1527
|
-
e
|
|
1528
|
-
), x;
|
|
1529
|
-
}, a.prototype.fill = function(t, e, s, u) {
|
|
1530
|
-
if (typeof t == "string") {
|
|
1531
|
-
if (typeof e == "string" ? (u = e, e = 0, s = this.length) : typeof s == "string" && (u = s, s = this.length), u !== void 0 && typeof u != "string")
|
|
1532
|
-
throw new TypeError("encoding must be a string");
|
|
1533
|
-
if (typeof u == "string" && !a.isEncoding(u))
|
|
1534
|
-
throw new TypeError("Unknown encoding: " + u);
|
|
1535
|
-
if (t.length === 1) {
|
|
1536
|
-
var x = t.charCodeAt(0);
|
|
1537
|
-
(u === "utf8" && x < 128 || u === "latin1") && (t = x);
|
|
1538
|
-
}
|
|
1539
|
-
} else
|
|
1540
|
-
typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
|
|
1541
|
-
if (e < 0 || this.length < e || this.length < s)
|
|
1542
|
-
throw new RangeError("Out of range index");
|
|
1543
|
-
if (s <= e)
|
|
1544
|
-
return this;
|
|
1545
|
-
e = e >>> 0, s = s === void 0 ? this.length : s >>> 0, t || (t = 0);
|
|
1546
|
-
var d;
|
|
1547
|
-
if (typeof t == "number")
|
|
1548
|
-
for (d = e; d < s; ++d)
|
|
1549
|
-
this[d] = t;
|
|
1550
|
-
else {
|
|
1551
|
-
var k = a.isBuffer(t) ? t : a.from(t, u), N = k.length;
|
|
1552
|
-
if (N === 0)
|
|
1553
|
-
throw new TypeError('The value "' + t + '" is invalid for argument "value"');
|
|
1554
|
-
for (d = 0; d < s - e; ++d)
|
|
1555
|
-
this[d + e] = k[d % N];
|
|
1556
|
-
}
|
|
1557
|
-
return this;
|
|
1558
|
-
};
|
|
1559
|
-
var K = /[^+/0-9A-Za-z-_]/g;
|
|
1560
|
-
function Q(n) {
|
|
1561
|
-
if (n = n.split("=")[0], n = n.trim().replace(K, ""), n.length < 2)
|
|
1562
|
-
return "";
|
|
1563
|
-
for (; n.length % 4 !== 0; )
|
|
1564
|
-
n = n + "=";
|
|
1565
|
-
return n;
|
|
1566
|
-
}
|
|
1567
|
-
function X(n, t) {
|
|
1568
|
-
t = t || 1 / 0;
|
|
1569
|
-
for (var e, s = n.length, u = null, x = [], d = 0; d < s; ++d) {
|
|
1570
|
-
if (e = n.charCodeAt(d), e > 55295 && e < 57344) {
|
|
1571
|
-
if (!u) {
|
|
1572
|
-
if (e > 56319) {
|
|
1573
|
-
(t -= 3) > -1 && x.push(239, 191, 189);
|
|
1574
|
-
continue;
|
|
1575
|
-
} else if (d + 1 === s) {
|
|
1576
|
-
(t -= 3) > -1 && x.push(239, 191, 189);
|
|
1577
|
-
continue;
|
|
1578
|
-
}
|
|
1579
|
-
u = e;
|
|
1580
|
-
continue;
|
|
1581
|
-
}
|
|
1582
|
-
if (e < 56320) {
|
|
1583
|
-
(t -= 3) > -1 && x.push(239, 191, 189), u = e;
|
|
1584
|
-
continue;
|
|
1585
|
-
}
|
|
1586
|
-
e = (u - 55296 << 10 | e - 56320) + 65536;
|
|
1587
|
-
} else
|
|
1588
|
-
u && (t -= 3) > -1 && x.push(239, 191, 189);
|
|
1589
|
-
if (u = null, e < 128) {
|
|
1590
|
-
if ((t -= 1) < 0)
|
|
1591
|
-
break;
|
|
1592
|
-
x.push(e);
|
|
1593
|
-
} else if (e < 2048) {
|
|
1594
|
-
if ((t -= 2) < 0)
|
|
1595
|
-
break;
|
|
1596
|
-
x.push(
|
|
1597
|
-
e >> 6 | 192,
|
|
1598
|
-
e & 63 | 128
|
|
1599
|
-
);
|
|
1600
|
-
} else if (e < 65536) {
|
|
1601
|
-
if ((t -= 3) < 0)
|
|
1602
|
-
break;
|
|
1603
|
-
x.push(
|
|
1604
|
-
e >> 12 | 224,
|
|
1605
|
-
e >> 6 & 63 | 128,
|
|
1606
|
-
e & 63 | 128
|
|
1607
|
-
);
|
|
1608
|
-
} else if (e < 1114112) {
|
|
1609
|
-
if ((t -= 4) < 0)
|
|
1610
|
-
break;
|
|
1611
|
-
x.push(
|
|
1612
|
-
e >> 18 | 240,
|
|
1613
|
-
e >> 12 & 63 | 128,
|
|
1614
|
-
e >> 6 & 63 | 128,
|
|
1615
|
-
e & 63 | 128
|
|
1616
|
-
);
|
|
1617
|
-
} else
|
|
1618
|
-
throw new Error("Invalid code point");
|
|
1619
|
-
}
|
|
1620
|
-
return x;
|
|
1621
|
-
}
|
|
1622
|
-
function tt(n) {
|
|
1623
|
-
for (var t = [], e = 0; e < n.length; ++e)
|
|
1624
|
-
t.push(n.charCodeAt(e) & 255);
|
|
1625
|
-
return t;
|
|
1626
|
-
}
|
|
1627
|
-
function et(n, t) {
|
|
1628
|
-
for (var e, s, u, x = [], d = 0; d < n.length && !((t -= 2) < 0); ++d)
|
|
1629
|
-
e = n.charCodeAt(d), s = e >> 8, u = e % 256, x.push(u), x.push(s);
|
|
1630
|
-
return x;
|
|
1631
|
-
}
|
|
1632
|
-
function lt(n) {
|
|
1633
|
-
return r.toByteArray(Q(n));
|
|
1634
|
-
}
|
|
1635
|
-
function _t(n, t, e, s) {
|
|
1636
|
-
for (var u = 0; u < s && !(u + e >= t.length || u >= n.length); ++u)
|
|
1637
|
-
t[u + e] = n[u];
|
|
1638
|
-
return u;
|
|
1639
|
-
}
|
|
1640
|
-
function nt(n, t) {
|
|
1641
|
-
return n instanceof t || n != null && n.constructor != null && n.constructor.name != null && n.constructor.name === t.name;
|
|
1642
|
-
}
|
|
1643
|
-
function $t(n) {
|
|
1644
|
-
return n !== n;
|
|
1645
|
-
}
|
|
1646
|
-
var Ze = function() {
|
|
1647
|
-
for (var n = "0123456789abcdef", t = new Array(256), e = 0; e < 16; ++e)
|
|
1648
|
-
for (var s = e * 16, u = 0; u < 16; ++u)
|
|
1649
|
-
t[s + u] = n[e] + n[u];
|
|
1650
|
-
return t;
|
|
1651
|
-
}();
|
|
1652
|
-
})(Fe);
|
|
1653
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1654
|
-
(function(i, r) {
|
|
1655
|
-
var o = Fe, p = o.Buffer;
|
|
1656
|
-
function l(c, a) {
|
|
1657
|
-
for (var h in c)
|
|
1658
|
-
a[h] = c[h];
|
|
1659
|
-
}
|
|
1660
|
-
p.from && p.alloc && p.allocUnsafe && p.allocUnsafeSlow ? i.exports = o : (l(o, r), r.Buffer = f);
|
|
1661
|
-
function f(c, a, h) {
|
|
1662
|
-
return p(c, a, h);
|
|
1663
|
-
}
|
|
1664
|
-
f.prototype = Object.create(p.prototype), l(p, f), f.from = function(c, a, h) {
|
|
1665
|
-
if (typeof c == "number")
|
|
1666
|
-
throw new TypeError("Argument must not be a number");
|
|
1667
|
-
return p(c, a, h);
|
|
1668
|
-
}, f.alloc = function(c, a, h) {
|
|
1669
|
-
if (typeof c != "number")
|
|
1670
|
-
throw new TypeError("Argument must be a number");
|
|
1671
|
-
var g = p(c);
|
|
1672
|
-
return a !== void 0 ? typeof h == "string" ? g.fill(a, h) : g.fill(a) : g.fill(0), g;
|
|
1673
|
-
}, f.allocUnsafe = function(c) {
|
|
1674
|
-
if (typeof c != "number")
|
|
1675
|
-
throw new TypeError("Argument must be a number");
|
|
1676
|
-
return p(c);
|
|
1677
|
-
}, f.allocUnsafeSlow = function(c) {
|
|
1678
|
-
if (typeof c != "number")
|
|
1679
|
-
throw new TypeError("Argument must be a number");
|
|
1680
|
-
return o.SlowBuffer(c);
|
|
1681
|
-
};
|
|
1682
|
-
})(Pt, Pt.exports);
|
|
1683
|
-
var Zt = Pt.exports, Be = Zt.Buffer;
|
|
1684
|
-
function kt(i, r) {
|
|
1685
|
-
this._block = Be.alloc(i), this._finalSize = r, this._blockSize = i, this._len = 0;
|
|
1686
|
-
}
|
|
1687
|
-
kt.prototype.update = function(i, r) {
|
|
1688
|
-
typeof i == "string" && (r = r || "utf8", i = Be.from(i, r));
|
|
1689
|
-
for (var o = this._block, p = this._blockSize, l = i.length, f = this._len, c = 0; c < l; ) {
|
|
1690
|
-
for (var a = f % p, h = Math.min(l - c, p - a), g = 0; g < h; g++)
|
|
1691
|
-
o[a + g] = i[c + g];
|
|
1692
|
-
f += h, c += h, f % p === 0 && this._update(o);
|
|
1693
|
-
}
|
|
1694
|
-
return this._len += l, this;
|
|
1695
|
-
};
|
|
1696
|
-
kt.prototype.digest = function(i) {
|
|
1697
|
-
var r = this._len % this._blockSize;
|
|
1698
|
-
this._block[r] = 128, this._block.fill(0, r + 1), r >= this._finalSize && (this._update(this._block), this._block.fill(0));
|
|
1699
|
-
var o = this._len * 8;
|
|
1700
|
-
if (o <= 4294967295)
|
|
1701
|
-
this._block.writeUInt32BE(o, this._blockSize - 4);
|
|
1702
|
-
else {
|
|
1703
|
-
var p = (o & 4294967295) >>> 0, l = (o - p) / 4294967296;
|
|
1704
|
-
this._block.writeUInt32BE(l, this._blockSize - 8), this._block.writeUInt32BE(p, this._blockSize - 4);
|
|
1705
|
-
}
|
|
1706
|
-
this._update(this._block);
|
|
1707
|
-
var f = this._hash();
|
|
1708
|
-
return i ? f.toString(i) : f;
|
|
1709
|
-
};
|
|
1710
|
-
kt.prototype._update = function() {
|
|
1711
|
-
throw new Error("_update must be implemented by subclass");
|
|
1712
|
-
};
|
|
1713
|
-
var Ie = kt, Ii = Ae, je = Ie, ji = Zt.Buffer, Di = [
|
|
1714
|
-
1518500249,
|
|
1715
|
-
1859775393,
|
|
1716
|
-
-1894007588,
|
|
1717
|
-
-899497514
|
|
1718
|
-
], Ti = new Array(80);
|
|
1719
|
-
function vt() {
|
|
1720
|
-
this.init(), this._w = Ti, je.call(this, 64, 56);
|
|
1721
|
-
}
|
|
1722
|
-
Ii(vt, je);
|
|
1723
|
-
vt.prototype.init = function() {
|
|
1724
|
-
return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
|
|
1725
|
-
};
|
|
1726
|
-
function ki(i) {
|
|
1727
|
-
return i << 1 | i >>> 31;
|
|
1728
|
-
}
|
|
1729
|
-
function Ui(i) {
|
|
1730
|
-
return i << 5 | i >>> 27;
|
|
1731
|
-
}
|
|
1732
|
-
function Ci(i) {
|
|
1733
|
-
return i << 30 | i >>> 2;
|
|
1734
|
-
}
|
|
1735
|
-
function $i(i, r, o, p) {
|
|
1736
|
-
return i === 0 ? r & o | ~r & p : i === 2 ? r & o | r & p | o & p : r ^ o ^ p;
|
|
1737
|
-
}
|
|
1738
|
-
vt.prototype._update = function(i) {
|
|
1739
|
-
for (var r = this._w, o = this._a | 0, p = this._b | 0, l = this._c | 0, f = this._d | 0, c = this._e | 0, a = 0; a < 16; ++a)
|
|
1740
|
-
r[a] = i.readInt32BE(a * 4);
|
|
1741
|
-
for (; a < 80; ++a)
|
|
1742
|
-
r[a] = ki(r[a - 3] ^ r[a - 8] ^ r[a - 14] ^ r[a - 16]);
|
|
1743
|
-
for (var h = 0; h < 80; ++h) {
|
|
1744
|
-
var g = ~~(h / 20), y = Ui(o) + $i(g, p, l, f) + c + r[h] + Di[g] | 0;
|
|
1745
|
-
c = f, f = l, l = Ci(p), p = o, o = y;
|
|
1746
|
-
}
|
|
1747
|
-
this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = l + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0;
|
|
1748
|
-
};
|
|
1749
|
-
vt.prototype._hash = function() {
|
|
1750
|
-
var i = ji.allocUnsafe(20);
|
|
1751
|
-
return i.writeInt32BE(this._a | 0, 0), i.writeInt32BE(this._b | 0, 4), i.writeInt32BE(this._c | 0, 8), i.writeInt32BE(this._d | 0, 12), i.writeInt32BE(this._e | 0, 16), i;
|
|
1752
|
-
};
|
|
1753
|
-
var Ni = vt;
|
|
1754
|
-
const Mi = /* @__PURE__ */ Kt(Ni);
|
|
1755
|
-
var Ri = Ae, De = Ie, Li = Zt.Buffer, Pi = [
|
|
1756
|
-
1116352408,
|
|
1757
|
-
1899447441,
|
|
1758
|
-
3049323471,
|
|
1759
|
-
3921009573,
|
|
1760
|
-
961987163,
|
|
1761
|
-
1508970993,
|
|
1762
|
-
2453635748,
|
|
1763
|
-
2870763221,
|
|
1764
|
-
3624381080,
|
|
1765
|
-
310598401,
|
|
1766
|
-
607225278,
|
|
1767
|
-
1426881987,
|
|
1768
|
-
1925078388,
|
|
1769
|
-
2162078206,
|
|
1770
|
-
2614888103,
|
|
1771
|
-
3248222580,
|
|
1772
|
-
3835390401,
|
|
1773
|
-
4022224774,
|
|
1774
|
-
264347078,
|
|
1775
|
-
604807628,
|
|
1776
|
-
770255983,
|
|
1777
|
-
1249150122,
|
|
1778
|
-
1555081692,
|
|
1779
|
-
1996064986,
|
|
1780
|
-
2554220882,
|
|
1781
|
-
2821834349,
|
|
1782
|
-
2952996808,
|
|
1783
|
-
3210313671,
|
|
1784
|
-
3336571891,
|
|
1785
|
-
3584528711,
|
|
1786
|
-
113926993,
|
|
1787
|
-
338241895,
|
|
1788
|
-
666307205,
|
|
1789
|
-
773529912,
|
|
1790
|
-
1294757372,
|
|
1791
|
-
1396182291,
|
|
1792
|
-
1695183700,
|
|
1793
|
-
1986661051,
|
|
1794
|
-
2177026350,
|
|
1795
|
-
2456956037,
|
|
1796
|
-
2730485921,
|
|
1797
|
-
2820302411,
|
|
1798
|
-
3259730800,
|
|
1799
|
-
3345764771,
|
|
1800
|
-
3516065817,
|
|
1801
|
-
3600352804,
|
|
1802
|
-
4094571909,
|
|
1803
|
-
275423344,
|
|
1804
|
-
430227734,
|
|
1805
|
-
506948616,
|
|
1806
|
-
659060556,
|
|
1807
|
-
883997877,
|
|
1808
|
-
958139571,
|
|
1809
|
-
1322822218,
|
|
1810
|
-
1537002063,
|
|
1811
|
-
1747873779,
|
|
1812
|
-
1955562222,
|
|
1813
|
-
2024104815,
|
|
1814
|
-
2227730452,
|
|
1815
|
-
2361852424,
|
|
1816
|
-
2428436474,
|
|
1817
|
-
2756734187,
|
|
1818
|
-
3204031479,
|
|
1819
|
-
3329325298
|
|
1820
|
-
], zi = new Array(64);
|
|
1821
|
-
function St() {
|
|
1822
|
-
this.init(), this._w = zi, De.call(this, 64, 56);
|
|
1823
|
-
}
|
|
1824
|
-
Ri(St, De);
|
|
1825
|
-
St.prototype.init = function() {
|
|
1826
|
-
return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this;
|
|
1827
|
-
};
|
|
1828
|
-
function qi(i, r, o) {
|
|
1829
|
-
return o ^ i & (r ^ o);
|
|
1830
|
-
}
|
|
1831
|
-
function Hi(i, r, o) {
|
|
1832
|
-
return i & r | o & (i | r);
|
|
1833
|
-
}
|
|
1834
|
-
function Ji(i) {
|
|
1835
|
-
return (i >>> 2 | i << 30) ^ (i >>> 13 | i << 19) ^ (i >>> 22 | i << 10);
|
|
1836
|
-
}
|
|
1837
|
-
function Vi(i) {
|
|
1838
|
-
return (i >>> 6 | i << 26) ^ (i >>> 11 | i << 21) ^ (i >>> 25 | i << 7);
|
|
1839
|
-
}
|
|
1840
|
-
function Wi(i) {
|
|
1841
|
-
return (i >>> 7 | i << 25) ^ (i >>> 18 | i << 14) ^ i >>> 3;
|
|
1842
|
-
}
|
|
1843
|
-
function Xi(i) {
|
|
1844
|
-
return (i >>> 17 | i << 15) ^ (i >>> 19 | i << 13) ^ i >>> 10;
|
|
1845
|
-
}
|
|
1846
|
-
St.prototype._update = function(i) {
|
|
1847
|
-
for (var r = this._w, o = this._a | 0, p = this._b | 0, l = this._c | 0, f = this._d | 0, c = this._e | 0, a = this._f | 0, h = this._g | 0, g = this._h | 0, y = 0; y < 16; ++y)
|
|
1848
|
-
r[y] = i.readInt32BE(y * 4);
|
|
1849
|
-
for (; y < 64; ++y)
|
|
1850
|
-
r[y] = Xi(r[y - 2]) + r[y - 7] + Wi(r[y - 15]) + r[y - 16] | 0;
|
|
1851
|
-
for (var b = 0; b < 64; ++b) {
|
|
1852
|
-
var F = g + Vi(c) + qi(c, a, h) + Pi[b] + r[b] | 0, j = Ji(o) + Hi(o, p, l) | 0;
|
|
1853
|
-
g = h, h = a, a = c, c = f + F | 0, f = l, l = p, p = o, o = F + j | 0;
|
|
1854
|
-
}
|
|
1855
|
-
this._a = o + this._a | 0, this._b = p + this._b | 0, this._c = l + this._c | 0, this._d = f + this._d | 0, this._e = c + this._e | 0, this._f = a + this._f | 0, this._g = h + this._g | 0, this._h = g + this._h | 0;
|
|
1856
|
-
};
|
|
1857
|
-
St.prototype._hash = function() {
|
|
1858
|
-
var i = Li.allocUnsafe(32);
|
|
1859
|
-
return i.writeInt32BE(this._a, 0), i.writeInt32BE(this._b, 4), i.writeInt32BE(this._c, 8), i.writeInt32BE(this._d, 12), i.writeInt32BE(this._e, 16), i.writeInt32BE(this._f, 20), i.writeInt32BE(this._g, 24), i.writeInt32BE(this._h, 28), i;
|
|
1860
|
-
};
|
|
1861
|
-
var Ki = St;
|
|
1862
|
-
const Gi = /* @__PURE__ */ Kt(Ki), Yt = new Error("File system not available.");
|
|
1863
|
-
function Zi(i, r, o) {
|
|
1864
|
-
throw Yt;
|
|
1865
|
-
}
|
|
1866
|
-
function Te(i) {
|
|
1867
|
-
throw Yt;
|
|
1868
|
-
}
|
|
1869
|
-
function Yi(i) {
|
|
1870
|
-
throw Yt;
|
|
1871
|
-
}
|
|
1872
|
-
const Qi = async (i) => Te(), tr = {
|
|
1873
|
-
sha1: Mi,
|
|
1874
|
-
sha256: Gi
|
|
1875
|
-
}, Ut = (i, r = "sha1") => {
|
|
1876
|
-
if (!["sha1", "sha256"].includes(r))
|
|
1877
|
-
throw new Error("Hashing algorithm not supported: Available: sha1, sha256");
|
|
1878
|
-
const o = tr[r];
|
|
1879
|
-
return new o().update(i).digest("base64");
|
|
1880
|
-
};
|
|
1881
|
-
function er(i) {
|
|
1882
|
-
const r = [], o = Object.keys(i);
|
|
1883
|
-
for (const p of o) {
|
|
1884
|
-
const l = i[p].sort((f, c) => f.index - c.index);
|
|
1885
|
-
for (let f = 0; f < l.length; f++)
|
|
1886
|
-
l[f].index !== f && r.push({
|
|
1887
|
-
message: `Invalid operation index ${l[f].index} at position ${f}`,
|
|
1888
|
-
details: {
|
|
1889
|
-
position: f,
|
|
1890
|
-
operation: l[f],
|
|
1891
|
-
scope: l[f].scope
|
|
1892
|
-
}
|
|
1893
|
-
});
|
|
1894
|
-
}
|
|
1895
|
-
return r;
|
|
1896
|
-
}
|
|
1897
|
-
const ke = async (i) => {
|
|
1898
|
-
const r = new pe(), { name: o, revision: p, documentType: l, created: f, lastModified: c } = i, a = {
|
|
1899
|
-
name: o,
|
|
1900
|
-
revision: p,
|
|
1901
|
-
documentType: l,
|
|
1902
|
-
created: f,
|
|
1903
|
-
lastModified: c
|
|
1904
|
-
};
|
|
1905
|
-
return r.file("header.json", JSON.stringify(a, null, 2)), r.file(
|
|
1906
|
-
"state.json",
|
|
1907
|
-
JSON.stringify(i.initialState || {}, null, 2)
|
|
1908
|
-
), r.file("operations.json", JSON.stringify(i.operations, null, 2)), Object.keys(i.attachments).forEach((g) => {
|
|
1909
|
-
const { data: y, ...b } = i.attachments[g];
|
|
1910
|
-
r.file(g, y, {
|
|
1911
|
-
base64: !0,
|
|
1912
|
-
createFolders: !0,
|
|
1913
|
-
comment: JSON.stringify(b)
|
|
1914
|
-
});
|
|
1915
|
-
}), r;
|
|
1916
|
-
}, ir = async (i, r, o, p) => {
|
|
1917
|
-
await (await ke(i)).generateAsync({
|
|
1918
|
-
type: "uint8array",
|
|
1919
|
-
streamFiles: !0
|
|
1920
|
-
});
|
|
1921
|
-
const f = p ?? i.name, c = `.${o}.zip`;
|
|
1922
|
-
return Zi(
|
|
1923
|
-
r,
|
|
1924
|
-
f.endsWith(c) ? f : `${f}${c}`
|
|
1925
|
-
);
|
|
1926
|
-
}, Or = async (i, r) => {
|
|
1927
|
-
const p = await (await ke(i)).generateAsync({ type: "blob" }), l = await r.createWritable();
|
|
1928
|
-
await l.write(p), await l.close();
|
|
1929
|
-
}, ae = async (i, r, o) => {
|
|
1930
|
-
const p = Te();
|
|
1931
|
-
return rr(p, r, o);
|
|
1932
|
-
}, rr = async (i, r, o) => {
|
|
1933
|
-
const p = new pe();
|
|
1934
|
-
return await p.loadAsync(i), nr(p, r, o);
|
|
1935
|
-
};
|
|
1936
|
-
async function nr(i, r, o) {
|
|
1937
|
-
const p = i.file("state.json");
|
|
1938
|
-
if (!p)
|
|
1939
|
-
throw new Error("Initial state not found");
|
|
1940
|
-
const l = await p.async("string"), f = JSON.parse(l), c = i.file("header.json");
|
|
1941
|
-
let a;
|
|
1942
|
-
c && (a = JSON.parse(await c.async("string")));
|
|
1943
|
-
const h = i.file("operations.json");
|
|
1944
|
-
if (!h)
|
|
1945
|
-
throw new Error("Operations history not found");
|
|
1946
|
-
const g = JSON.parse(
|
|
1947
|
-
await h.async("string")
|
|
1948
|
-
), y = er(g);
|
|
1949
|
-
if (y.length) {
|
|
1950
|
-
const F = y.map((j) => j.message);
|
|
1951
|
-
throw new Error(F.join(`
|
|
1952
|
-
`));
|
|
1953
|
-
}
|
|
1954
|
-
let b = He(
|
|
1955
|
-
f,
|
|
1956
|
-
g,
|
|
1957
|
-
r,
|
|
1958
|
-
void 0,
|
|
1959
|
-
a,
|
|
1960
|
-
{},
|
|
1961
|
-
o
|
|
1962
|
-
);
|
|
1963
|
-
return a && (b = {
|
|
1964
|
-
...b,
|
|
1965
|
-
...a
|
|
1966
|
-
}), b;
|
|
1967
|
-
}
|
|
1968
|
-
function Ue(i) {
|
|
1969
|
-
const r = i.replace(/^.*\./, "") || void 0, o = i.replace(/^.*[/\\]/, "") || void 0;
|
|
1970
|
-
return { extension: r, fileName: o };
|
|
1971
|
-
}
|
|
1972
|
-
async function Br(i) {
|
|
1973
|
-
const { buffer: r, mimeType: o = "application/octet-stream" } = await Yi(), p = Ue(i), l = r.toString("base64");
|
|
1974
|
-
return {
|
|
1975
|
-
data: l,
|
|
1976
|
-
hash: Ut(l),
|
|
1977
|
-
mimeType: o,
|
|
1978
|
-
...p
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1981
|
-
async function Ir(i) {
|
|
1982
|
-
const r = await Qi(), o = Ei.getType(i) || "application/octet-stream", p = Ue(i), l = r.toString("base64");
|
|
1983
|
-
return { data: l, hash: Ut(l), mimeType: o, ...p };
|
|
1984
|
-
}
|
|
1985
|
-
var Ce = /* @__PURE__ */ ((i) => (i.UNEXPECTED_INDEX = "UNEXPECTED_INDEX", i))(Ce || {}), $e = /* @__PURE__ */ ((i) => (i.DUPLICATED_INDEX = "DUPLICATED_INDEX", i.MISSING_INDEX = "MISSING_INDEX", i))($e || {});
|
|
1986
|
-
function Qt(i) {
|
|
1987
|
-
const r = [];
|
|
1988
|
-
let o = -1;
|
|
1989
|
-
for (const p of i) {
|
|
1990
|
-
const l = p.index - p.skip;
|
|
1991
|
-
l !== o + 1 && r.push({
|
|
1992
|
-
operation: {
|
|
1993
|
-
index: p.index,
|
|
1994
|
-
skip: p.skip
|
|
1995
|
-
},
|
|
1996
|
-
issue: "UNEXPECTED_INDEX",
|
|
1997
|
-
category: l > o + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
|
|
1998
|
-
message: `Expected index ${o + 1} with skip 0 or equivalent, got index ${p.index} with skip ${p.skip}`
|
|
1999
|
-
}), o = p.index;
|
|
2000
|
-
}
|
|
2001
|
-
return r;
|
|
2002
|
-
}
|
|
2003
|
-
function at(i) {
|
|
2004
|
-
var p, l, f;
|
|
2005
|
-
const r = [];
|
|
2006
|
-
let o = i.length - 1;
|
|
2007
|
-
for (; o > -1; ) {
|
|
2008
|
-
r.unshift(i[o]);
|
|
2009
|
-
const c = (((p = i[o]) == null ? void 0 : p.index) || 0) - (((l = i[o]) == null ? void 0 : l.skip) || 0) - 1;
|
|
2010
|
-
let a = o - 1;
|
|
2011
|
-
for (; a > -1 && (((f = i[a]) == null ? void 0 : f.index) || 0) > c; )
|
|
2012
|
-
a--;
|
|
2013
|
-
o = a;
|
|
2014
|
-
}
|
|
2015
|
-
return r;
|
|
2016
|
-
}
|
|
2017
|
-
function or(i) {
|
|
2018
|
-
const r = [...i], o = r[r.length - 1];
|
|
2019
|
-
return o && (o.type === "NOOP" ? r.push({
|
|
2020
|
-
...o,
|
|
2021
|
-
index: o.index,
|
|
2022
|
-
type: "NOOP",
|
|
2023
|
-
skip: Re(i)
|
|
2024
|
-
}) : r.push({
|
|
2025
|
-
type: "NOOP",
|
|
2026
|
-
index: o.index + 1,
|
|
2027
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2028
|
-
input: {},
|
|
2029
|
-
skip: 1,
|
|
2030
|
-
scope: o.scope,
|
|
2031
|
-
hash: o.hash
|
|
2032
|
-
})), r;
|
|
2033
|
-
}
|
|
2034
|
-
function st(i) {
|
|
2035
|
-
return i.slice().sort((r, o) => r.skip - o.skip).sort((r, o) => r.index - o.index);
|
|
2036
|
-
}
|
|
2037
|
-
const ar = (i, r, o) => [...r, ...o].sort(
|
|
2038
|
-
(p, l) => new Date(p.timestamp).getTime() - new Date(l.timestamp).getTime()
|
|
2039
|
-
).map((p, l) => ({
|
|
2040
|
-
...p,
|
|
2041
|
-
index: i.index + l,
|
|
2042
|
-
skip: l === 0 ? i.skip : 0
|
|
2043
|
-
})), sr = (i, r, o) => [...r, ...o].sort(
|
|
2044
|
-
(p, l) => new Date(p.timestamp).getTime() - new Date(l.timestamp).getTime()
|
|
2045
|
-
).sort((p, l) => p.index - l.index).map((p, l) => ({
|
|
2046
|
-
...p,
|
|
2047
|
-
index: i.index + l,
|
|
2048
|
-
skip: l === 0 ? i.skip : 0
|
|
2049
|
-
}));
|
|
2050
|
-
function te(i, r) {
|
|
2051
|
-
return dt(i) === dt(r);
|
|
2052
|
-
}
|
|
2053
|
-
function pr(i, r) {
|
|
2054
|
-
const o = at(st(i.slice())), p = at(st(r.slice()));
|
|
2055
|
-
if (o.length < 1)
|
|
2056
|
-
return [p, []];
|
|
2057
|
-
const l = [];
|
|
2058
|
-
let f = !1;
|
|
2059
|
-
for (; p.length > 0; ) {
|
|
2060
|
-
const c = p[0];
|
|
2061
|
-
let a = o.shift();
|
|
2062
|
-
for (; a && Ne(a, c); )
|
|
2063
|
-
l.push(a), a = o.shift();
|
|
2064
|
-
if (a ? f || (te(a, c) ? (p.shift(), l.push(a)) : (o.unshift(a), f = !0)) : f = !0, f) {
|
|
2065
|
-
let h = p.shift();
|
|
2066
|
-
for (; h; )
|
|
2067
|
-
l.push(h), h = p.shift();
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
if (!f) {
|
|
2071
|
-
let c = o.shift();
|
|
2072
|
-
for (; c; )
|
|
2073
|
-
l.push(c), c = o.shift();
|
|
2074
|
-
}
|
|
2075
|
-
return [at(l), o];
|
|
2076
|
-
}
|
|
2077
|
-
function Ne(i, r) {
|
|
2078
|
-
return i.index < r.index || i.index === r.index && i.id === r.id && i.skip < r.skip;
|
|
2079
|
-
}
|
|
2080
|
-
function Me(i, r) {
|
|
2081
|
-
const o = [], p = [], l = [], f = Math.max(
|
|
2082
|
-
i.length,
|
|
2083
|
-
r.length
|
|
2084
|
-
);
|
|
2085
|
-
let c = !1;
|
|
2086
|
-
for (let a = 0; a < f; a++) {
|
|
2087
|
-
const h = i[a], g = r[a];
|
|
2088
|
-
h && g ? !c && te(h, g) ? o.push(h) : (c = !0, p.push(h), l.push(g)) : h ? p.push(h) : g && l.push(g);
|
|
2089
|
-
}
|
|
2090
|
-
return [o, p, l];
|
|
2091
|
-
}
|
|
2092
|
-
function cr(i, r, o) {
|
|
2093
|
-
const [p, l, f] = Me(
|
|
2094
|
-
at(i),
|
|
2095
|
-
at(r)
|
|
2096
|
-
), c = Mt(p), a = 1 + Math.max(
|
|
2097
|
-
c,
|
|
2098
|
-
Mt(l),
|
|
2099
|
-
Mt(f)
|
|
2100
|
-
), h = Pe(
|
|
2101
|
-
f,
|
|
2102
|
-
l
|
|
2103
|
-
), g = o(
|
|
2104
|
-
{
|
|
2105
|
-
index: a,
|
|
2106
|
-
skip: a - (c + 1)
|
|
2107
|
-
},
|
|
2108
|
-
l,
|
|
2109
|
-
h
|
|
2110
|
-
);
|
|
2111
|
-
return p.concat(g);
|
|
2112
|
-
}
|
|
2113
|
-
function Mt(i) {
|
|
2114
|
-
const r = i[i.length - 1];
|
|
2115
|
-
return r ? r.index : -1;
|
|
2116
|
-
}
|
|
2117
|
-
function Re(i) {
|
|
2118
|
-
var p, l, f;
|
|
2119
|
-
if (i.length < 1)
|
|
2120
|
-
return -1;
|
|
2121
|
-
const r = at(i);
|
|
2122
|
-
let o = (((p = r[r.length - 1]) == null ? void 0 : p.skip) || 0) + 1;
|
|
2123
|
-
return r.length > 1 && (o += ((l = r[r.length - 2]) == null ? void 0 : l.skip) || 0), (((f = r[r.length - 1]) == null ? void 0 : f.index) || -1) < o ? -1 : o;
|
|
2124
|
-
}
|
|
2125
|
-
const lr = (i) => Qt(
|
|
2126
|
-
at(st(i))
|
|
2127
|
-
), ur = (i) => i.reduce((o, p) => {
|
|
2128
|
-
var l;
|
|
2129
|
-
return o[p.scope] || (o[p.scope] = []), (l = o[p.scope]) == null || l.push(p), o;
|
|
2130
|
-
}, {}), fr = (i, r) => {
|
|
2131
|
-
var h;
|
|
2132
|
-
const o = {
|
|
2133
|
-
integrityIssues: [],
|
|
2134
|
-
validOperations: [],
|
|
2135
|
-
invalidOperations: [],
|
|
2136
|
-
duplicatedOperations: []
|
|
2137
|
-
}, p = st(i), l = st(r), f = Qt([
|
|
2138
|
-
...p,
|
|
2139
|
-
...l
|
|
2140
|
-
]), a = (h = [...f.filter(
|
|
2141
|
-
(g) => g.category === "MISSING_INDEX"
|
|
2142
|
-
/* MISSING_INDEX */
|
|
2143
|
-
)].sort((g, y) => y.operation.index - g.operation.index).pop()) == null ? void 0 : h.operation;
|
|
2144
|
-
for (const g of l) {
|
|
2145
|
-
if (a && g.index >= a.index) {
|
|
2146
|
-
o.invalidOperations.push(g);
|
|
2147
|
-
continue;
|
|
2148
|
-
}
|
|
2149
|
-
if (f.some((b) => b.operation.index === g.index && b.operation.skip === g.skip && b.category === "DUPLICATED_INDEX")) {
|
|
2150
|
-
o.duplicatedOperations.push(g);
|
|
2151
|
-
continue;
|
|
2152
|
-
}
|
|
2153
|
-
o.validOperations.push(g);
|
|
2154
|
-
}
|
|
2155
|
-
return o.integrityIssues.push(...f), o;
|
|
2156
|
-
};
|
|
2157
|
-
function hr(i, r) {
|
|
2158
|
-
return i.filter((o) => !r.some((p) => o.type === "NOOP" && o.skip === 0 && o.index === p.index || o.index === p.index && o.skip === p.skip && o.scope === p.scope && o.hash === p.hash && o.type === p.type));
|
|
2159
|
-
}
|
|
2160
|
-
function Le(i, r) {
|
|
2161
|
-
const [o] = st(i).slice(-1), p = (o == null ? void 0 : o.index) ?? -1, l = p + 1, f = {
|
|
2162
|
-
...r,
|
|
2163
|
-
index: r.index ?? l
|
|
2164
|
-
};
|
|
2165
|
-
if (f.index < p)
|
|
2166
|
-
throw new Error(
|
|
2167
|
-
`The skip header operation index must be greater than or equal to ${p}`
|
|
2168
|
-
);
|
|
2169
|
-
return (at(
|
|
2170
|
-
st([...i, f])
|
|
2171
|
-
) || []).slice(0, -1);
|
|
2172
|
-
}
|
|
2173
|
-
function zt(i) {
|
|
2174
|
-
return {
|
|
2175
|
-
...Object.entries(i).reduce(
|
|
2176
|
-
(o, p) => {
|
|
2177
|
-
const [l, f] = p;
|
|
2178
|
-
return {
|
|
2179
|
-
...o,
|
|
2180
|
-
[l]: at(st(f))
|
|
2181
|
-
};
|
|
2182
|
-
},
|
|
2183
|
-
{}
|
|
2184
|
-
)
|
|
2185
|
-
};
|
|
2186
|
-
}
|
|
2187
|
-
function Pe(i, r) {
|
|
2188
|
-
return i.filter((o) => o.id ? !r.some((p) => p.id === o.id) : !0);
|
|
2189
|
-
}
|
|
2190
|
-
const jr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2191
|
-
__proto__: null,
|
|
2192
|
-
IntegrityIssueSubType: $e,
|
|
2193
|
-
IntegrityIssueType: Ce,
|
|
2194
|
-
addUndo: or,
|
|
2195
|
-
attachBranch: pr,
|
|
2196
|
-
checkCleanedOperationsIntegrity: Qt,
|
|
2197
|
-
checkOperationsIntegrity: lr,
|
|
2198
|
-
filterDuplicatedOperations: Pe,
|
|
2199
|
-
garbageCollect: at,
|
|
2200
|
-
garbageCollectDocumentOperations: zt,
|
|
2201
|
-
groupOperationsByScope: ur,
|
|
2202
|
-
merge: cr,
|
|
2203
|
-
nextSkipNumber: Re,
|
|
2204
|
-
operationsAreEqual: te,
|
|
2205
|
-
precedes: Ne,
|
|
2206
|
-
prepareOperations: fr,
|
|
2207
|
-
removeExistingOperations: hr,
|
|
2208
|
-
reshuffleByTimestamp: ar,
|
|
2209
|
-
reshuffleByTimestampAndIndex: sr,
|
|
2210
|
-
skipHeaderOperations: Le,
|
|
2211
|
-
sortOperations: st,
|
|
2212
|
-
split: Me
|
|
2213
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2214
|
-
function mr(i, r) {
|
|
2215
|
-
let o;
|
|
2216
|
-
return "index" in r ? o = { ...r } : o = i.operations[r.scope].at(-1), ((o == null ? void 0 : o.index) ?? -1) + 1;
|
|
2217
|
-
}
|
|
2218
|
-
function ze(i, r) {
|
|
2219
|
-
return {
|
|
2220
|
-
...i,
|
|
2221
|
-
revision: {
|
|
2222
|
-
...i.revision,
|
|
2223
|
-
[r.scope]: mr(i, r)
|
|
2224
|
-
},
|
|
2225
|
-
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
2226
|
-
};
|
|
2227
|
-
}
|
|
2228
|
-
function xr(i, r, o = 0) {
|
|
2229
|
-
if ([Et, bt, Dt].includes(r.type))
|
|
2230
|
-
return i;
|
|
2231
|
-
const { scope: p } = r, l = i.operations[p].slice();
|
|
2232
|
-
let f;
|
|
2233
|
-
const c = l.at(-1);
|
|
2234
|
-
let a = ((c == null ? void 0 : c.index) ?? -1) + 1;
|
|
2235
|
-
if ("index" in r) {
|
|
2236
|
-
if (r.index - o > a)
|
|
2237
|
-
throw new Error(
|
|
2238
|
-
`Missing operations: expected ${a} with skip 0 or equivalent, got index ${r.index} with skip ${o}`
|
|
2239
|
-
);
|
|
2240
|
-
a = r.index, f = r.id;
|
|
2241
|
-
} else
|
|
2242
|
-
f = fi();
|
|
2243
|
-
return l.push({
|
|
2244
|
-
...r,
|
|
2245
|
-
id: f,
|
|
2246
|
-
index: a,
|
|
2247
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2248
|
-
hash: "",
|
|
2249
|
-
scope: p,
|
|
2250
|
-
skip: o,
|
|
2251
|
-
error: void 0
|
|
2252
|
-
}), {
|
|
2253
|
-
...i,
|
|
2254
|
-
operations: { ...i.operations, [p]: l }
|
|
2255
|
-
};
|
|
2256
|
-
}
|
|
2257
|
-
function dr(i, r, o = 0) {
|
|
2258
|
-
let p = xr(i, r, o);
|
|
2259
|
-
return p = ze(p, r), p;
|
|
2260
|
-
}
|
|
2261
|
-
function gr(i, r, o) {
|
|
2262
|
-
switch (xe().parse(r), r.type) {
|
|
2263
|
-
case ve:
|
|
2264
|
-
return hi(i, r.input);
|
|
2265
|
-
case Dt:
|
|
2266
|
-
return di(i, r, o);
|
|
2267
|
-
case Se:
|
|
2268
|
-
return gi(i, r.input.state);
|
|
2269
|
-
default:
|
|
2270
|
-
return i;
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
function Dr(i, r, o) {
|
|
2274
|
-
switch (r.type) {
|
|
2275
|
-
case Et:
|
|
2276
|
-
return mi(i, r, o);
|
|
2277
|
-
case bt:
|
|
2278
|
-
return xi(i, r, o);
|
|
2279
|
-
default:
|
|
2280
|
-
return { document: i, action: r, skip: o };
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
function yr(i, r, o, p, l = !1, f = Je) {
|
|
2284
|
-
const c = r.scope, a = i.operations[c].at(-1);
|
|
2285
|
-
if (!a)
|
|
2286
|
-
return i;
|
|
2287
|
-
const h = zt(
|
|
2288
|
-
{
|
|
2289
|
-
...i.operations,
|
|
2290
|
-
[c]: Le(
|
|
2291
|
-
i.operations[c],
|
|
2292
|
-
a
|
|
2293
|
-
)
|
|
2294
|
-
}
|
|
2295
|
-
);
|
|
2296
|
-
let g;
|
|
2297
|
-
const y = h[c].at(-1);
|
|
2298
|
-
if (l && (y != null && y.resultingState))
|
|
2299
|
-
g = f(
|
|
2300
|
-
y.resultingState
|
|
2301
|
-
);
|
|
2302
|
-
else {
|
|
2303
|
-
const { state: b } = qt(
|
|
2304
|
-
i.initialState,
|
|
2305
|
-
h,
|
|
2306
|
-
o,
|
|
2307
|
-
void 0,
|
|
2308
|
-
void 0,
|
|
2309
|
-
void 0,
|
|
2310
|
-
void 0,
|
|
2311
|
-
{
|
|
2312
|
-
reuseHash: !0,
|
|
2313
|
-
reuseOperationResultingState: l,
|
|
2314
|
-
operationResultingStateParser: f
|
|
2315
|
-
}
|
|
2316
|
-
);
|
|
2317
|
-
g = b[c];
|
|
2318
|
-
}
|
|
2319
|
-
return {
|
|
2320
|
-
...i,
|
|
2321
|
-
state: {
|
|
2322
|
-
...i.state,
|
|
2323
|
-
[c]: g
|
|
2324
|
-
},
|
|
2325
|
-
operations: zt({
|
|
2326
|
-
...i.operations
|
|
2327
|
-
})
|
|
2328
|
-
};
|
|
2329
|
-
}
|
|
2330
|
-
function qe(i, r, o, p, l = {}) {
|
|
2331
|
-
const {
|
|
2332
|
-
skip: f,
|
|
2333
|
-
ignoreSkipOperations: c = !1,
|
|
2334
|
-
reuseHash: a = !1,
|
|
2335
|
-
reuseOperationResultingState: h = !1,
|
|
2336
|
-
operationResultingStateParser: g
|
|
2337
|
-
} = l, y = { ...r }, b = f || 0;
|
|
2338
|
-
let F = { ...i };
|
|
2339
|
-
const j = !c && (b > 0 || "index" in y && y.skip > 0);
|
|
2340
|
-
return se(y) && (F = gr(F, y, o)), F = dr(F, y, b), j && (F = yr(
|
|
2341
|
-
F,
|
|
2342
|
-
y,
|
|
2343
|
-
o,
|
|
2344
|
-
b,
|
|
2345
|
-
h,
|
|
2346
|
-
g
|
|
2347
|
-
)), F = jt(F, (U) => {
|
|
2348
|
-
try {
|
|
2349
|
-
const q = o(
|
|
2350
|
-
U.state,
|
|
2351
|
-
y,
|
|
2352
|
-
p
|
|
2353
|
-
);
|
|
2354
|
-
if (q)
|
|
2355
|
-
return It({
|
|
2356
|
-
...F,
|
|
2357
|
-
// clipboard: [...clipboardValue],
|
|
2358
|
-
state: q
|
|
2359
|
-
});
|
|
2360
|
-
} catch (q) {
|
|
2361
|
-
const Y = F.operations[y.scope].length - 1;
|
|
2362
|
-
U.operations[y.scope][Y].error = q.message, U.operations[y.scope][Y].skip = 0, j && (U.state = It({ ...i.state }), U.operations = It({
|
|
2363
|
-
...i.operations,
|
|
2364
|
-
[y.scope]: [
|
|
2365
|
-
...i.operations[y.scope],
|
|
2366
|
-
{
|
|
2367
|
-
...U.operations[y.scope][Y]
|
|
2368
|
-
}
|
|
2369
|
-
]
|
|
2370
|
-
}));
|
|
2371
|
-
}
|
|
2372
|
-
}), jt(F, (U) => {
|
|
2373
|
-
if ([Et, bt, Dt].includes(y.type))
|
|
2374
|
-
return U;
|
|
2375
|
-
const q = y.scope || "global", Y = a && Object.prototype.hasOwnProperty.call(y, "hash") ? y.hash : ee(U, q), w = U.operations[q].at(-1);
|
|
2376
|
-
w && (w.hash = Y, h && (w.resultingState = U.state[q]), !se(y) && y.attachments && y.attachments.forEach((E) => {
|
|
2377
|
-
const { hash: v, ...M } = E;
|
|
2378
|
-
U.attachments[v] = {
|
|
2379
|
-
...M
|
|
2380
|
-
};
|
|
2381
|
-
}));
|
|
2382
|
-
});
|
|
2383
|
-
}
|
|
2384
|
-
function Tr(i) {
|
|
2385
|
-
return i.type === yi && i.skip !== void 0 && i.skip > 0 && i.hash !== void 0;
|
|
2386
|
-
}
|
|
2387
|
-
function kr(i) {
|
|
2388
|
-
return [Et, bt].includes(i.type);
|
|
2389
|
-
}
|
|
2390
|
-
function se(i) {
|
|
2391
|
-
return [ve, Et, bt, Dt, Se].includes(i.type);
|
|
2392
|
-
}
|
|
2393
|
-
function gt(i, r, o, p, l = "global") {
|
|
2394
|
-
if (!i)
|
|
2395
|
-
throw new Error("Empty action type");
|
|
2396
|
-
if (typeof i != "string")
|
|
2397
|
-
throw new Error(`Invalid action type: ${JSON.stringify(i)}`);
|
|
2398
|
-
const f = { type: i, input: r, scope: l };
|
|
2399
|
-
o && (f.attachments = o);
|
|
2400
|
-
try {
|
|
2401
|
-
p == null || p().parse(f.input);
|
|
2402
|
-
} catch (c) {
|
|
2403
|
-
throw new Error(`Invalid action input: ${c}`);
|
|
2404
|
-
}
|
|
2405
|
-
return f;
|
|
2406
|
-
}
|
|
2407
|
-
function wr(i, r = qe) {
|
|
2408
|
-
return (o, p, l, f) => r(o, p, i, l, f);
|
|
2409
|
-
}
|
|
2410
|
-
const Er = (i, r) => ({
|
|
2411
|
-
name: "",
|
|
2412
|
-
documentType: "",
|
|
2413
|
-
revision: {
|
|
2414
|
-
global: 0,
|
|
2415
|
-
local: 0
|
|
2416
|
-
},
|
|
2417
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2418
|
-
lastModified: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2419
|
-
attachments: {},
|
|
2420
|
-
...i,
|
|
2421
|
-
state: (r == null ? void 0 : r(i == null ? void 0 : i.state)) ?? (i == null ? void 0 : i.state) ?? { global: {}, local: {} }
|
|
2422
|
-
}), br = (i, r) => {
|
|
2423
|
-
const o = Er(
|
|
2424
|
-
i,
|
|
2425
|
-
r
|
|
2426
|
-
);
|
|
2427
|
-
return {
|
|
2428
|
-
...o,
|
|
2429
|
-
initialState: o,
|
|
2430
|
-
operations: { global: [], local: [] },
|
|
2431
|
-
clipboard: []
|
|
2432
|
-
};
|
|
2433
|
-
}, ee = (i, r = "global") => Ut(dt(i.state[r] || "")), Ur = (i, r = 1e3) => {
|
|
2434
|
-
const o = Math.random() * r;
|
|
2435
|
-
return Ut(`${(i ?? /* @__PURE__ */ new Date()).toISOString()}${o}`);
|
|
2436
|
-
};
|
|
2437
|
-
function Bt(i) {
|
|
2438
|
-
return ti(ei(i, !0));
|
|
2439
|
-
}
|
|
2440
|
-
function Cr(i, r) {
|
|
2441
|
-
const o = [...i];
|
|
2442
|
-
let p = r || 0, l = o.length > 0 ? o[o.length - 1].index : 0;
|
|
2443
|
-
const f = [];
|
|
2444
|
-
for (const c of o.reverse()) {
|
|
2445
|
-
if (p > 0) {
|
|
2446
|
-
const g = l - c.index;
|
|
2447
|
-
p -= g;
|
|
2448
|
-
}
|
|
2449
|
-
if (p < 0)
|
|
2450
|
-
throw new Error("Invalid operation index, missing operations");
|
|
2451
|
-
const a = {
|
|
2452
|
-
ignore: p > 0,
|
|
2453
|
-
operation: c
|
|
2454
|
-
}, h = c.skip > 0 ? c.skip + 1 : 0;
|
|
2455
|
-
if (h > 0 && h > p) {
|
|
2456
|
-
const g = h - p;
|
|
2457
|
-
p = p + g;
|
|
2458
|
-
}
|
|
2459
|
-
l = c.index, f.push(a);
|
|
2460
|
-
}
|
|
2461
|
-
return f.reverse();
|
|
2462
|
-
}
|
|
2463
|
-
function $r(i, r, o) {
|
|
2464
|
-
const p = i.slice().sort((a, h) => a.skip - h.skip).sort((a, h) => a.index - h.index);
|
|
2465
|
-
let l = o, f = 0, c = r;
|
|
2466
|
-
for (const a of p.reverse()) {
|
|
2467
|
-
const h = c - a.index;
|
|
2468
|
-
if (l = l - h, l > -1)
|
|
2469
|
-
f++, c = a.index;
|
|
2470
|
-
else
|
|
2471
|
-
break;
|
|
2472
|
-
}
|
|
2473
|
-
return f;
|
|
2474
|
-
}
|
|
2475
|
-
function Nr(i) {
|
|
2476
|
-
return Object.values(i).flatMap((r) => r).sort(
|
|
2477
|
-
(r, o) => new Date(r.timestamp).getTime() - new Date(o.timestamp).getTime()
|
|
2478
|
-
);
|
|
2479
|
-
}
|
|
2480
|
-
function Mr(i) {
|
|
2481
|
-
return Object.values(i).flatMap((r) => r).sort(
|
|
2482
|
-
(r, o) => new Date(r.operation.timestamp).getTime() - new Date(o.operation.timestamp).getTime()
|
|
2483
|
-
);
|
|
2484
|
-
}
|
|
2485
|
-
function qt(i, r, o, p, l, f = qe, c = {}, a) {
|
|
2486
|
-
const h = wr(o, f);
|
|
2487
|
-
return He(
|
|
2488
|
-
i,
|
|
2489
|
-
r,
|
|
2490
|
-
h,
|
|
2491
|
-
p,
|
|
2492
|
-
l,
|
|
2493
|
-
c,
|
|
2494
|
-
a
|
|
2495
|
-
);
|
|
2496
|
-
}
|
|
2497
|
-
function He(i, r, o, p, l, f = {}, c) {
|
|
2498
|
-
const {
|
|
2499
|
-
checkHashes: a = !0,
|
|
2500
|
-
reuseOperationResultingState: h,
|
|
2501
|
-
operationResultingStateParser: g = Je
|
|
2502
|
-
} = c || {};
|
|
2503
|
-
let y = i;
|
|
2504
|
-
const b = [], F = {
|
|
2505
|
-
global: [],
|
|
2506
|
-
local: []
|
|
2507
|
-
};
|
|
2508
|
-
if (h)
|
|
2509
|
-
for (const [w, E] of Object.entries(r)) {
|
|
2510
|
-
const v = E.findLastIndex(
|
|
2511
|
-
(J) => !!J.resultingState
|
|
2512
|
-
);
|
|
2513
|
-
if (v < 0) {
|
|
2514
|
-
b.push(...E);
|
|
2515
|
-
continue;
|
|
2516
|
-
}
|
|
2517
|
-
const M = E[v];
|
|
2518
|
-
try {
|
|
2519
|
-
const J = g(
|
|
2520
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-type-assertion
|
|
2521
|
-
M.resultingState
|
|
2522
|
-
);
|
|
2523
|
-
y = {
|
|
2524
|
-
...y,
|
|
2525
|
-
state: {
|
|
2526
|
-
...y.state,
|
|
2527
|
-
// TODO how to deal with attachments?
|
|
2528
|
-
[w]: J
|
|
2529
|
-
}
|
|
2530
|
-
}, F[w].push(
|
|
2531
|
-
...E.slice(0, v + 1)
|
|
2532
|
-
), b.push(...E.slice(v + 1));
|
|
2533
|
-
} catch {
|
|
2534
|
-
b.push(...E);
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
else
|
|
2538
|
-
b.push(...Object.values(r).flat());
|
|
2539
|
-
const j = br(y);
|
|
2540
|
-
j.initialState = i, j.operations = F;
|
|
2541
|
-
let U = j;
|
|
2542
|
-
if (b.length)
|
|
2543
|
-
U = b.reduce((w, E) => o(w, E, p, {
|
|
2544
|
-
skip: E.skip,
|
|
2545
|
-
ignoreSkipOperations: !0,
|
|
2546
|
-
reuseHash: !a
|
|
2547
|
-
}), j);
|
|
2548
|
-
else
|
|
2549
|
-
for (const w of Object.values(F)) {
|
|
2550
|
-
const E = w.at(-1);
|
|
2551
|
-
E && (U = ze(U, E));
|
|
2552
|
-
}
|
|
2553
|
-
if (!a)
|
|
2554
|
-
for (const w of Object.keys(U.state))
|
|
2555
|
-
for (let E = b.length - 1; E >= 0; E--) {
|
|
2556
|
-
const v = b[E];
|
|
2557
|
-
if (v.scope === w) {
|
|
2558
|
-
if (v.hash !== ee(U, w))
|
|
2559
|
-
throw new Error(`Hash mismatch for scope ${w}`);
|
|
2560
|
-
break;
|
|
2561
|
-
}
|
|
2562
|
-
}
|
|
2563
|
-
const q = Object.keys(
|
|
2564
|
-
U.operations
|
|
2565
|
-
).reduce(
|
|
2566
|
-
(w, E) => {
|
|
2567
|
-
const v = E;
|
|
2568
|
-
return {
|
|
2569
|
-
...w,
|
|
2570
|
-
[v]: [
|
|
2571
|
-
...U.operations[v].map((M, J) => {
|
|
2572
|
-
var V;
|
|
2573
|
-
return {
|
|
2574
|
-
...M,
|
|
2575
|
-
timestamp: ((V = r[v][J]) == null ? void 0 : V.timestamp) ?? M.timestamp
|
|
2576
|
-
};
|
|
2577
|
-
})
|
|
2578
|
-
]
|
|
2579
|
-
};
|
|
2580
|
-
},
|
|
2581
|
-
{ global: [], local: [] }
|
|
2582
|
-
), Y = Object.values(q).reduce((w, E) => {
|
|
2583
|
-
const v = E[E.length - 1];
|
|
2584
|
-
return (v == null ? void 0 : v.timestamp) > w && (w = v.timestamp), w;
|
|
2585
|
-
}, i.lastModified);
|
|
2586
|
-
return { ...U, operations: q, lastModified: Y };
|
|
2587
|
-
}
|
|
2588
|
-
function Rr(i, r) {
|
|
2589
|
-
return dt(i) === dt(r);
|
|
2590
|
-
}
|
|
2591
|
-
function Je(i) {
|
|
2592
|
-
const r = typeof i;
|
|
2593
|
-
if (r === "string")
|
|
2594
|
-
return JSON.parse(i);
|
|
2595
|
-
if (r === "object")
|
|
2596
|
-
return i;
|
|
2597
|
-
throw new Error(`Providing resulting state is of type: ${r}`);
|
|
2598
|
-
}
|
|
2599
|
-
const Ve = (i) => gt(
|
|
2600
|
-
"SET_NAME",
|
|
2601
|
-
i,
|
|
2602
|
-
void 0,
|
|
2603
|
-
Wt,
|
|
2604
|
-
void 0
|
|
2605
|
-
), We = (i = 1, r = "global") => gt(
|
|
2606
|
-
"UNDO",
|
|
2607
|
-
i,
|
|
2608
|
-
void 0,
|
|
2609
|
-
Xt,
|
|
2610
|
-
r
|
|
2611
|
-
), Xe = (i = 1, r = "global") => gt(
|
|
2612
|
-
"REDO",
|
|
2613
|
-
i,
|
|
2614
|
-
void 0,
|
|
2615
|
-
Vt,
|
|
2616
|
-
r
|
|
2617
|
-
), Ke = (i, r, o = "global") => gt(
|
|
2618
|
-
"PRUNE",
|
|
2619
|
-
{ start: i, end: r },
|
|
2620
|
-
void 0,
|
|
2621
|
-
Jt,
|
|
2622
|
-
o
|
|
2623
|
-
), ie = (i, r) => gt(
|
|
2624
|
-
"LOAD_STATE",
|
|
2625
|
-
{ state: i, operations: r },
|
|
2626
|
-
void 0,
|
|
2627
|
-
Ht
|
|
2628
|
-
), Ge = (i = "global") => gt("NOOP", {}, void 0, void 0, i), Lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2629
|
-
__proto__: null,
|
|
2630
|
-
loadState: ie,
|
|
2631
|
-
noop: Ge,
|
|
2632
|
-
prune: Ke,
|
|
2633
|
-
redo: Xe,
|
|
2634
|
-
setName: Ve,
|
|
2635
|
-
undo: We
|
|
2636
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2637
|
-
class Pr {
|
|
2638
|
-
/**
|
|
2639
|
-
* Constructs a BaseDocument instance with an initial state.
|
|
2640
|
-
* @param reducer - The reducer function that updates the state.
|
|
2641
|
-
* @param document - The initial state of the document.
|
|
2642
|
-
*/
|
|
2643
|
-
constructor(r, o, p) {
|
|
2644
|
-
Ft(this, "_document");
|
|
2645
|
-
Ft(this, "_reducer");
|
|
2646
|
-
Ft(this, "_signalDispatch");
|
|
2647
|
-
this._reducer = r, this._document = o, this._signalDispatch = p;
|
|
2648
|
-
}
|
|
2649
|
-
/**
|
|
2650
|
-
* Dispatches an action to update the state of the document.
|
|
2651
|
-
* @param action - The action to dispatch.
|
|
2652
|
-
* @returns The Document instance.
|
|
2653
|
-
*/
|
|
2654
|
-
dispatch(r, o) {
|
|
2655
|
-
return this._document = this._reducer(
|
|
2656
|
-
this._document,
|
|
2657
|
-
r,
|
|
2658
|
-
this._signalDispatch,
|
|
2659
|
-
o
|
|
2660
|
-
), this;
|
|
2661
|
-
}
|
|
2662
|
-
/**
|
|
2663
|
-
* Saves the state of the document to a file.
|
|
2664
|
-
* @param path - The file path where the state should be saved.
|
|
2665
|
-
* @param extension - The file extension to use when saving the state.
|
|
2666
|
-
* @returns The file path where the state was saved.
|
|
2667
|
-
*/
|
|
2668
|
-
saveToFile(r, o, p) {
|
|
2669
|
-
return ir(this._document, r, o, p);
|
|
2670
|
-
}
|
|
2671
|
-
/**
|
|
2672
|
-
* Loads the state of the document from a file.
|
|
2673
|
-
* @param path - The file path where the state is stored.
|
|
2674
|
-
*/
|
|
2675
|
-
async loadFromFile(r) {
|
|
2676
|
-
this._document = await ae(r, this._reducer);
|
|
2677
|
-
}
|
|
2678
|
-
/**
|
|
2679
|
-
* Loads the state of the document from a file and returns it.
|
|
2680
|
-
* @param path - The file path where the state is stored.
|
|
2681
|
-
* @param reducer - The reducer function that updates the state.
|
|
2682
|
-
* @returns The state of the document.
|
|
2683
|
-
*/
|
|
2684
|
-
static async stateFromFile(r, o) {
|
|
2685
|
-
return await ae(r, o);
|
|
2686
|
-
}
|
|
2687
|
-
/**
|
|
2688
|
-
* Gets the current state of the document.
|
|
2689
|
-
*/
|
|
2690
|
-
get state() {
|
|
2691
|
-
return Bt(this._document.state);
|
|
2692
|
-
}
|
|
2693
|
-
/**
|
|
2694
|
-
* Gets the list of operations performed on the document.
|
|
2695
|
-
*/
|
|
2696
|
-
get operations() {
|
|
2697
|
-
return Bt(this._document.operations);
|
|
2698
|
-
}
|
|
2699
|
-
/**
|
|
2700
|
-
* Gets the name of the document.
|
|
2701
|
-
*/
|
|
2702
|
-
get name() {
|
|
2703
|
-
return this._document.name;
|
|
2704
|
-
}
|
|
2705
|
-
/**
|
|
2706
|
-
* Gets the type of document.
|
|
2707
|
-
*/
|
|
2708
|
-
get documentType() {
|
|
2709
|
-
return this._document.documentType;
|
|
2710
|
-
}
|
|
2711
|
-
/**
|
|
2712
|
-
* Gets the timestamp of the date the document was created.
|
|
2713
|
-
*/
|
|
2714
|
-
get created() {
|
|
2715
|
-
return this._document.created;
|
|
2716
|
-
}
|
|
2717
|
-
/**
|
|
2718
|
-
* Gets the timestamp of the date the document was last modified.
|
|
2719
|
-
*/
|
|
2720
|
-
get lastModified() {
|
|
2721
|
-
return this._document.lastModified;
|
|
2722
|
-
}
|
|
2723
|
-
/**
|
|
2724
|
-
* Gets the global revision number of the document.
|
|
2725
|
-
*/
|
|
2726
|
-
get revision() {
|
|
2727
|
-
return this._document.revision.global;
|
|
2728
|
-
}
|
|
2729
|
-
getRevision(r) {
|
|
2730
|
-
return this._document.revision[r];
|
|
2731
|
-
}
|
|
2732
|
-
/**
|
|
2733
|
-
* Gets the initial state of the document.
|
|
2734
|
-
*/
|
|
2735
|
-
get initialState() {
|
|
2736
|
-
return Bt(this._document.initialState);
|
|
2737
|
-
}
|
|
2738
|
-
/**
|
|
2739
|
-
* Returns the current document as an object
|
|
2740
|
-
*/
|
|
2741
|
-
toDocument() {
|
|
2742
|
-
return Bt(this._document);
|
|
2743
|
-
}
|
|
2744
|
-
/**
|
|
2745
|
-
* Gets the attachment associated with the given key.
|
|
2746
|
-
* @param attachment - The key of the attachment to retrieve.
|
|
2747
|
-
*/
|
|
2748
|
-
getAttachment(r) {
|
|
2749
|
-
return this._document.attachments[r];
|
|
2750
|
-
}
|
|
2751
|
-
/**
|
|
2752
|
-
* Sets the name of the document.
|
|
2753
|
-
* @param name - The new name of the document.
|
|
2754
|
-
*/
|
|
2755
|
-
setName(r) {
|
|
2756
|
-
return this.dispatch(Ve(r)), this;
|
|
2757
|
-
}
|
|
2758
|
-
/**
|
|
2759
|
-
* Reverts a number of actions from the document.
|
|
2760
|
-
* @param count - The number of actions to revert.
|
|
2761
|
-
*/
|
|
2762
|
-
undo(r) {
|
|
2763
|
-
return this.dispatch(We(r)), this;
|
|
2764
|
-
}
|
|
2765
|
-
/**
|
|
2766
|
-
* Reapplies a number of actions to the document.
|
|
2767
|
-
* @param count - The number of actions to reapply.
|
|
2768
|
-
*/
|
|
2769
|
-
redo(r) {
|
|
2770
|
-
return this.dispatch(Xe(r)), this;
|
|
2771
|
-
}
|
|
2772
|
-
/**
|
|
2773
|
-
* Removes a range of operations from the document.
|
|
2774
|
-
* @param start - The starting index of the range to remove.
|
|
2775
|
-
* @param end - The ending index of the range to remove.
|
|
2776
|
-
*/
|
|
2777
|
-
prune(r, o) {
|
|
2778
|
-
return this.dispatch(Ke(r, o)), this;
|
|
2779
|
-
}
|
|
2780
|
-
/**
|
|
2781
|
-
* Loads a document state and a set of operations.
|
|
2782
|
-
* @param state - The state to load.
|
|
2783
|
-
* @param operations - The operations to apply to the document.
|
|
2784
|
-
*/
|
|
2785
|
-
loadState(r, o) {
|
|
2786
|
-
return this.dispatch(ie(r, o)), this;
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
function zr(i, r) {
|
|
2790
|
-
r.forEach((o) => {
|
|
2791
|
-
Object.getOwnPropertyNames(o.prototype).forEach((p) => {
|
|
2792
|
-
Object.defineProperty(
|
|
2793
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2794
|
-
i.prototype,
|
|
2795
|
-
p,
|
|
2796
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
2797
|
-
Object.getOwnPropertyDescriptor(o.prototype, p) || /* @__PURE__ */ Object.create(null)
|
|
2798
|
-
);
|
|
2799
|
-
});
|
|
2800
|
-
});
|
|
2801
|
-
}
|
|
2802
|
-
export {
|
|
2803
|
-
Mr as A,
|
|
2804
|
-
Pr as B,
|
|
2805
|
-
Nr as C,
|
|
2806
|
-
er as D,
|
|
2807
|
-
qe as E,
|
|
2808
|
-
Dr as F,
|
|
2809
|
-
dr as G,
|
|
2810
|
-
ze as H,
|
|
2811
|
-
Fr as I,
|
|
2812
|
-
Er as a,
|
|
2813
|
-
br as b,
|
|
2814
|
-
wr as c,
|
|
2815
|
-
Or as d,
|
|
2816
|
-
rr as e,
|
|
2817
|
-
gt as f,
|
|
2818
|
-
zr as g,
|
|
2819
|
-
Lr as h,
|
|
2820
|
-
se as i,
|
|
2821
|
-
$r as j,
|
|
2822
|
-
ke as k,
|
|
2823
|
-
ae as l,
|
|
2824
|
-
jr as m,
|
|
2825
|
-
Ir as n,
|
|
2826
|
-
Br as o,
|
|
2827
|
-
ee as p,
|
|
2828
|
-
Ur as q,
|
|
2829
|
-
Tr as r,
|
|
2830
|
-
ir as s,
|
|
2831
|
-
Rr as t,
|
|
2832
|
-
kr as u,
|
|
2833
|
-
Cr as v,
|
|
2834
|
-
Je as w,
|
|
2835
|
-
Bt as x,
|
|
2836
|
-
He as y,
|
|
2837
|
-
qt as z
|
|
2838
|
-
};
|