document-model 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/document/object.d.ts +137 -4
- package/dist/browser/document/types.d.ts +1 -0
- package/dist/browser/document/utils/base.d.ts +2 -1
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +3 -3
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +4 -4
- package/dist/browser/internal/{index-d577364b.js → index-48f140bc.js} +1 -1
- package/dist/browser/internal/{index-91e3abf2.js → index-7d7d05c8.js} +1 -1
- package/dist/browser/internal/index-9922a4fc.js +31 -0
- package/dist/browser/internal/index-ff22a5bb.js +1 -0
- package/dist/browser/internal/{object-e8af0c3a.js → object-98a2cff6.js} +313 -308
- package/dist/browser/internal/object-ceb8f869.js +6 -0
- package/dist/node/document/object.d.ts +137 -4
- package/dist/node/document/types.d.ts +1 -0
- package/dist/node/document/utils/base.d.ts +2 -1
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +4 -4
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +5 -5
- package/dist/node/internal/{index-574ece31.js → index-2e487f63.js} +1 -1
- package/dist/node/internal/index-5b0ca13a.js +31 -0
- package/dist/node/internal/index-6a7277fe.js +1 -0
- package/dist/node/internal/{index-f3fdeced.js → index-dfaca09a.js} +1 -1
- package/dist/node/internal/{object-9fcc9b3e.js → object-10abe15d.js} +1 -1
- package/dist/node/internal/{object-19968a54.js → object-6f942fcb.js} +194 -189
- package/package.json +1 -1
- package/dist/browser/internal/index-05f6fe71.js +0 -30
- package/dist/browser/internal/index-336e6f47.js +0 -1
- package/dist/browser/internal/object-41731a51.js +0 -6
- package/dist/node/internal/index-6ee6330b.js +0 -1
- package/dist/node/internal/index-af4b7a66.js +0 -30
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { produce as
|
|
1
|
+
var Y = Object.defineProperty;
|
|
2
|
+
var tt = (t, i, e) => i in t ? Y(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
|
|
3
|
+
var j = (t, i, e) => (tt(t, typeof i != "symbol" ? i + "" : i, e), e);
|
|
4
|
+
import it from "json-stringify-deterministic";
|
|
5
|
+
import { produce as N, castDraft as et, castImmutable as at, freeze as nt } from "immer";
|
|
6
|
+
import z from "jszip";
|
|
7
|
+
import ot from "crypto";
|
|
8
|
+
import w from "fs";
|
|
9
|
+
import st from "https";
|
|
10
|
+
import { join as pt } from "path";
|
|
6
11
|
import { z as o } from "zod";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import at from "https";
|
|
10
|
-
import { join as nt } from "path";
|
|
11
|
-
import T from "jszip";
|
|
12
|
-
const z = (t) => t != null, ot = o.any().refine((t) => z(t)), F = o.enum(["LOAD_STATE"]), P = o.enum(["PRUNE"]), q = o.enum(["REDO"]), M = o.enum(["SET_NAME"]), L = o.enum(["UNDO"]);
|
|
13
|
-
function st() {
|
|
12
|
+
const F = (t) => t != null, lt = o.any().refine((t) => F(t)), P = o.enum(["LOAD_STATE"]), q = o.enum(["PRUNE"]), M = o.enum(["REDO"]), L = o.enum(["SET_NAME"]), R = o.enum(["UNDO"]);
|
|
13
|
+
function ct() {
|
|
14
14
|
return o.object({
|
|
15
15
|
__typename: o.literal("Action").optional(),
|
|
16
16
|
type: o.string()
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function I() {
|
|
20
20
|
return o.union([
|
|
21
|
-
w(),
|
|
22
21
|
S(),
|
|
23
22
|
_(),
|
|
24
23
|
O(),
|
|
25
|
-
k()
|
|
24
|
+
k(),
|
|
25
|
+
D()
|
|
26
26
|
]);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function rt() {
|
|
29
29
|
return o.object({
|
|
30
30
|
__typename: o.literal("DocumentFile").optional(),
|
|
31
31
|
data: o.string(),
|
|
@@ -34,25 +34,25 @@ function pt() {
|
|
|
34
34
|
mimeType: o.string()
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function S() {
|
|
38
38
|
return o.object({
|
|
39
|
-
input: o.lazy(() =>
|
|
40
|
-
type:
|
|
39
|
+
input: o.lazy(() => U()),
|
|
40
|
+
type: P
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function U() {
|
|
44
44
|
return o.object({
|
|
45
45
|
operations: o.number(),
|
|
46
|
-
state: o.lazy(() =>
|
|
46
|
+
state: o.lazy(() => J())
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function J() {
|
|
50
50
|
return o.object({
|
|
51
51
|
data: o.unknown().nullish(),
|
|
52
52
|
name: o.string()
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function mt() {
|
|
56
56
|
return o.object({
|
|
57
57
|
__typename: o.literal("Operation").optional(),
|
|
58
58
|
hash: o.string(),
|
|
@@ -61,31 +61,31 @@ function lt() {
|
|
|
61
61
|
type: o.string()
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function _() {
|
|
65
65
|
return o.object({
|
|
66
|
-
input: o.lazy(() =>
|
|
67
|
-
type:
|
|
66
|
+
input: o.lazy(() => C()),
|
|
67
|
+
type: q
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function C() {
|
|
71
71
|
return o.object({
|
|
72
72
|
end: o.number().nullish(),
|
|
73
73
|
start: o.number().nullish()
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function O() {
|
|
77
77
|
return o.object({
|
|
78
78
|
input: o.number(),
|
|
79
|
-
type:
|
|
79
|
+
type: M
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function k() {
|
|
83
83
|
return o.object({
|
|
84
84
|
input: o.string(),
|
|
85
|
-
type:
|
|
85
|
+
type: L
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function dt() {
|
|
89
89
|
return o.object({
|
|
90
90
|
__typename: o.literal("SetNameOperation").optional(),
|
|
91
91
|
hash: o.string(),
|
|
@@ -95,45 +95,45 @@ function ct() {
|
|
|
95
95
|
type: o.string()
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function D() {
|
|
99
99
|
return o.object({
|
|
100
100
|
input: o.number(),
|
|
101
|
-
type:
|
|
101
|
+
type: R
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
105
105
|
__proto__: null,
|
|
106
|
-
ActionSchema:
|
|
107
|
-
BaseActionSchema:
|
|
108
|
-
DocumentFileSchema:
|
|
109
|
-
LoadStateActionInputSchema:
|
|
110
|
-
LoadStateActionSchema:
|
|
111
|
-
LoadStateActionStateInputSchema:
|
|
112
|
-
Load_StateSchema:
|
|
113
|
-
OperationSchema:
|
|
114
|
-
PruneActionInputSchema:
|
|
115
|
-
PruneActionSchema:
|
|
116
|
-
PruneSchema:
|
|
117
|
-
RedoActionSchema:
|
|
118
|
-
RedoSchema:
|
|
119
|
-
SetNameActionSchema:
|
|
120
|
-
SetNameOperationSchema:
|
|
121
|
-
Set_NameSchema:
|
|
122
|
-
UndoActionSchema:
|
|
123
|
-
UndoSchema:
|
|
124
|
-
definedNonNullAnySchema:
|
|
125
|
-
isDefinedNonNullAny:
|
|
106
|
+
ActionSchema: ct,
|
|
107
|
+
BaseActionSchema: I,
|
|
108
|
+
DocumentFileSchema: rt,
|
|
109
|
+
LoadStateActionInputSchema: U,
|
|
110
|
+
LoadStateActionSchema: S,
|
|
111
|
+
LoadStateActionStateInputSchema: J,
|
|
112
|
+
Load_StateSchema: P,
|
|
113
|
+
OperationSchema: mt,
|
|
114
|
+
PruneActionInputSchema: C,
|
|
115
|
+
PruneActionSchema: _,
|
|
116
|
+
PruneSchema: q,
|
|
117
|
+
RedoActionSchema: O,
|
|
118
|
+
RedoSchema: M,
|
|
119
|
+
SetNameActionSchema: k,
|
|
120
|
+
SetNameOperationSchema: dt,
|
|
121
|
+
Set_NameSchema: L,
|
|
122
|
+
UndoActionSchema: D,
|
|
123
|
+
UndoSchema: R,
|
|
124
|
+
definedNonNullAnySchema: lt,
|
|
125
|
+
isDefinedNonNullAny: F
|
|
126
126
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
127
|
-
function
|
|
127
|
+
function ut(t) {
|
|
128
128
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function g() {
|
|
131
131
|
this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
|
|
132
132
|
for (let t = 0; t < arguments.length; t++)
|
|
133
133
|
this.define(arguments[t]);
|
|
134
134
|
this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
g.prototype.define = function(t, i) {
|
|
137
137
|
for (let e in t) {
|
|
138
138
|
let a = t[e].map(function(n) {
|
|
139
139
|
return n.toLowerCase();
|
|
@@ -155,23 +155,23 @@ f.prototype.define = function(t, i) {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
|
|
158
|
+
g.prototype.getType = function(t) {
|
|
159
159
|
t = String(t);
|
|
160
160
|
let i = t.replace(/^.*[/\\]/, "").toLowerCase(), e = i.replace(/^.*\./, "").toLowerCase(), a = i.length < t.length;
|
|
161
161
|
return (e.length < i.length - 1 || !a) && this._types[e] || null;
|
|
162
162
|
};
|
|
163
|
-
|
|
163
|
+
g.prototype.getExtension = function(t) {
|
|
164
164
|
return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
|
|
165
165
|
};
|
|
166
|
-
var mt = f, dt = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
|
|
167
|
-
let
|
|
168
|
-
var
|
|
169
|
-
const
|
|
170
|
-
function
|
|
171
|
-
const a =
|
|
172
|
-
return
|
|
166
|
+
var xt = g, ft = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "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/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/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["es", "ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "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", "mjs"], "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/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": ["mp4s", "m4p"], "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-signature": ["asc", "sig"], "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/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/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/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/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/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "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"], "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/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "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/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "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/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"] };
|
|
167
|
+
let gt = xt;
|
|
168
|
+
var ht = new gt(ft);
|
|
169
|
+
const vt = /* @__PURE__ */ ut(ht);
|
|
170
|
+
function yt(t, i, e) {
|
|
171
|
+
const a = pt(t, i);
|
|
172
|
+
return w.mkdirSync(t, { recursive: !0 }), new Promise((n, s) => {
|
|
173
173
|
try {
|
|
174
|
-
|
|
174
|
+
w.writeFile(a, e, {}, (p) => {
|
|
175
175
|
p ? s(p) : n(a);
|
|
176
176
|
});
|
|
177
177
|
} catch (p) {
|
|
@@ -179,12 +179,12 @@ function gt(t, i, e) {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
return
|
|
182
|
+
function $(t) {
|
|
183
|
+
return w.readFileSync(t);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function bt(t) {
|
|
186
186
|
return new Promise((i, e) => {
|
|
187
|
-
|
|
187
|
+
st.get(t, (a) => {
|
|
188
188
|
const n = [], s = a.headers["content-type"];
|
|
189
189
|
a.on("data", (p) => {
|
|
190
190
|
n.push(p);
|
|
@@ -196,8 +196,8 @@ function ht(t) {
|
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
const
|
|
200
|
-
const i = new
|
|
199
|
+
const jt = async (t) => $(t), h = (t, i = "sha1") => ot.createHash(i).update(t).digest("base64"), B = async (t) => {
|
|
200
|
+
const i = new z(), { name: e, revision: a, documentType: n, created: s, lastModified: p } = t, l = {
|
|
201
201
|
name: e,
|
|
202
202
|
revision: a,
|
|
203
203
|
documentType: n,
|
|
@@ -208,34 +208,34 @@ const vt = async (t) => C(t), g = (t, i = "sha1") => et.createHash(i).update(t).
|
|
|
208
208
|
"state.json",
|
|
209
209
|
JSON.stringify(t.initialState || {}, null, 2)
|
|
210
210
|
), i.file("operations.json", JSON.stringify(t.operations, null, 2)), Object.keys(t.attachments).forEach((c) => {
|
|
211
|
-
const { data: r, ...
|
|
211
|
+
const { data: r, ...b } = t.attachments[c];
|
|
212
212
|
i.file(c, r, {
|
|
213
213
|
base64: !0,
|
|
214
214
|
createFolders: !0,
|
|
215
|
-
comment: JSON.stringify(
|
|
215
|
+
comment: JSON.stringify(b)
|
|
216
216
|
});
|
|
217
217
|
}), i;
|
|
218
|
-
},
|
|
219
|
-
const s = await (await
|
|
218
|
+
}, wt = async (t, i, e, a) => {
|
|
219
|
+
const s = await (await B(t)).generateAsync({
|
|
220
220
|
type: "uint8array",
|
|
221
221
|
streamFiles: !0
|
|
222
222
|
}), p = a ?? t.name, l = `.${e}.zip`;
|
|
223
|
-
return
|
|
223
|
+
return yt(
|
|
224
224
|
i,
|
|
225
225
|
p.endsWith(l) ? p : `${p}${l}`,
|
|
226
226
|
s
|
|
227
227
|
);
|
|
228
|
-
},
|
|
229
|
-
const a = await (await
|
|
228
|
+
}, Qt = async (t, i) => {
|
|
229
|
+
const a = await (await B(t)).generateAsync({ type: "blob" }), n = await i.createWritable();
|
|
230
230
|
await n.write(a), await n.close();
|
|
231
|
-
},
|
|
232
|
-
const e =
|
|
233
|
-
return
|
|
234
|
-
},
|
|
235
|
-
const e = new
|
|
236
|
-
return await e.loadAsync(t),
|
|
231
|
+
}, A = async (t, i) => {
|
|
232
|
+
const e = $(t);
|
|
233
|
+
return St(e, i);
|
|
234
|
+
}, St = async (t, i) => {
|
|
235
|
+
const e = new z();
|
|
236
|
+
return await e.loadAsync(t), _t(e, i);
|
|
237
237
|
};
|
|
238
|
-
async function
|
|
238
|
+
async function _t(t, i) {
|
|
239
239
|
const e = t.file("state.json");
|
|
240
240
|
if (!e)
|
|
241
241
|
throw new Error("Initial state not found");
|
|
@@ -255,7 +255,7 @@ async function bt(t, i) {
|
|
|
255
255
|
attachments: { ...n.attachments }
|
|
256
256
|
};
|
|
257
257
|
let r = m.slice(0, p == null ? void 0 : p.revision).reduce(
|
|
258
|
-
(
|
|
258
|
+
(b, X) => i(b, X),
|
|
259
259
|
c
|
|
260
260
|
);
|
|
261
261
|
return p && (r = {
|
|
@@ -267,42 +267,42 @@ async function bt(t, i) {
|
|
|
267
267
|
]
|
|
268
268
|
}), r;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Z(t) {
|
|
271
271
|
const i = t.replace(/^.*\./, "") || void 0, e = t.replace(/^.*[/\\]/, "") || void 0;
|
|
272
272
|
return { extension: i, fileName: e };
|
|
273
273
|
}
|
|
274
|
-
async function
|
|
275
|
-
const { buffer: i, mimeType: e = "application/octet-stream" } = await
|
|
274
|
+
async function Vt(t) {
|
|
275
|
+
const { buffer: i, mimeType: e = "application/octet-stream" } = await bt(
|
|
276
276
|
t
|
|
277
|
-
), a =
|
|
277
|
+
), a = Z(t), n = i.toString("base64");
|
|
278
278
|
return {
|
|
279
279
|
data: n,
|
|
280
|
-
hash:
|
|
280
|
+
hash: h(n),
|
|
281
281
|
mimeType: e,
|
|
282
282
|
...a
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
|
-
async function
|
|
286
|
-
const i = await
|
|
287
|
-
return { data: n, hash:
|
|
285
|
+
async function Xt(t) {
|
|
286
|
+
const i = await jt(t), e = vt.getType(t) || "application/octet-stream", a = Z(t), n = i.toString("base64");
|
|
287
|
+
return { data: n, hash: h(n), mimeType: e, ...a };
|
|
288
288
|
}
|
|
289
|
-
function
|
|
290
|
-
const a =
|
|
289
|
+
function f(t, i, e) {
|
|
290
|
+
const a = Rt(t), n = Mt(e);
|
|
291
291
|
return i.reduce(
|
|
292
292
|
(s, p) => n(s, p),
|
|
293
293
|
a
|
|
294
294
|
);
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Ot(t, i) {
|
|
297
297
|
return { ...t, name: i };
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function kt(t, i, e) {
|
|
300
300
|
const a = Math.min(i, t.revision), n = t.operations.slice(
|
|
301
301
|
0,
|
|
302
302
|
t.revision - a
|
|
303
303
|
);
|
|
304
304
|
return {
|
|
305
|
-
...
|
|
305
|
+
...f(
|
|
306
306
|
t.initialState,
|
|
307
307
|
n,
|
|
308
308
|
e
|
|
@@ -311,7 +311,7 @@ function St(t, i, e) {
|
|
|
311
311
|
revision: t.revision - a
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Dt(t, i, e) {
|
|
315
315
|
const a = t.operations.length - t.revision;
|
|
316
316
|
if (!a)
|
|
317
317
|
throw new Error("There is no UNDO operation to REDO");
|
|
@@ -320,7 +320,7 @@ function _t(t, i, e) {
|
|
|
320
320
|
t.revision + n
|
|
321
321
|
);
|
|
322
322
|
return {
|
|
323
|
-
...
|
|
323
|
+
...f(
|
|
324
324
|
t.initialState,
|
|
325
325
|
s,
|
|
326
326
|
e
|
|
@@ -329,43 +329,43 @@ function _t(t, i, e) {
|
|
|
329
329
|
revision: t.revision + n
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Et(t, i, e, a) {
|
|
333
333
|
i = i || 0, e = e || t.operations.length;
|
|
334
|
-
const n = t.operations.slice(i, e), s = t.operations.slice(0, i), p = t.operations.slice(e), l =
|
|
334
|
+
const n = t.operations.slice(i, e), s = t.operations.slice(0, i), p = t.operations.slice(e), l = f(
|
|
335
335
|
t.initialState,
|
|
336
336
|
s.concat(n),
|
|
337
337
|
a
|
|
338
338
|
), { name: m, state: c } = l;
|
|
339
|
-
return
|
|
339
|
+
return f(
|
|
340
340
|
t.initialState,
|
|
341
341
|
[
|
|
342
342
|
...s,
|
|
343
|
-
|
|
343
|
+
E({ name: m, state: c }, n.length),
|
|
344
344
|
...p
|
|
345
345
|
],
|
|
346
346
|
a
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Nt(t, i) {
|
|
350
350
|
return {
|
|
351
351
|
...t,
|
|
352
352
|
name: i.name,
|
|
353
353
|
state: i.state ?? {}
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
const
|
|
357
|
-
function
|
|
358
|
-
return [
|
|
356
|
+
const H = "SET_NAME", v = "UNDO", y = "REDO", d = "PRUNE", K = "LOAD_STATE";
|
|
357
|
+
function At(t, i) {
|
|
358
|
+
return [v, y, d].includes(i.type) ? t.revision : t.revision + 1;
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function Tt(t, i) {
|
|
361
361
|
return {
|
|
362
362
|
...t,
|
|
363
|
-
revision:
|
|
363
|
+
revision: At(t, i),
|
|
364
364
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
if ([
|
|
367
|
+
function zt(t, i) {
|
|
368
|
+
if ([v, y, d, d].includes(i.type))
|
|
369
369
|
return t;
|
|
370
370
|
const e = t.operations.slice(0, t.revision);
|
|
371
371
|
return {
|
|
@@ -381,42 +381,42 @@ function Nt(t, i) {
|
|
|
381
381
|
]
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
let e =
|
|
386
|
-
return e =
|
|
387
|
-
}
|
|
388
|
-
function
|
|
389
|
-
switch (
|
|
390
|
-
case
|
|
391
|
-
return
|
|
392
|
-
case h:
|
|
393
|
-
return St(t, i.input, e);
|
|
384
|
+
function Ft(t, i) {
|
|
385
|
+
let e = zt(t, i);
|
|
386
|
+
return e = Tt(e, i), e;
|
|
387
|
+
}
|
|
388
|
+
function Pt(t, i, e) {
|
|
389
|
+
switch (I().parse(i), i.type) {
|
|
390
|
+
case H:
|
|
391
|
+
return Ot(t, i.input);
|
|
394
392
|
case v:
|
|
395
|
-
return
|
|
393
|
+
return kt(t, i.input, e);
|
|
394
|
+
case y:
|
|
395
|
+
return Dt(t, i.input, e);
|
|
396
396
|
case d:
|
|
397
|
-
return
|
|
397
|
+
return Et(
|
|
398
398
|
t,
|
|
399
399
|
i.input.start,
|
|
400
400
|
i.input.end,
|
|
401
401
|
e
|
|
402
402
|
);
|
|
403
|
-
case
|
|
404
|
-
return
|
|
403
|
+
case K:
|
|
404
|
+
return Nt(t, i.input.state);
|
|
405
405
|
default:
|
|
406
406
|
return t;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function qt(t, i, e) {
|
|
410
410
|
let a = t;
|
|
411
|
-
return
|
|
411
|
+
return T(i) && (a = Pt(a, i, e)), a = Ft(a, i), a = N(a, (n) => {
|
|
412
412
|
const s = e(n.state, i);
|
|
413
413
|
if (s)
|
|
414
|
-
return
|
|
414
|
+
return et({
|
|
415
415
|
...a,
|
|
416
416
|
state: s
|
|
417
417
|
});
|
|
418
|
-
}),
|
|
419
|
-
n.operations[n.operations.length - 1].hash =
|
|
418
|
+
}), N(a, (n) => {
|
|
419
|
+
n.operations[n.operations.length - 1].hash = It(n), !T(i) && i.attachments && i.attachments.forEach((s) => {
|
|
420
420
|
const { hash: p, ...l } = s;
|
|
421
421
|
n.attachments[p] = {
|
|
422
422
|
...l
|
|
@@ -424,8 +424,8 @@ function zt(t, i, e) {
|
|
|
424
424
|
});
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
|
-
function
|
|
428
|
-
return [
|
|
427
|
+
function T(t) {
|
|
428
|
+
return [H, v, y, d, K].includes(t.type);
|
|
429
429
|
}
|
|
430
430
|
function u(t, i, e, a) {
|
|
431
431
|
if (!t)
|
|
@@ -435,10 +435,10 @@ function u(t, i, e, a) {
|
|
|
435
435
|
const n = e ? { type: t, input: i, attachments: e } : { type: t, input: i };
|
|
436
436
|
return a == null || a().parse(n), n;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function Mt(t, i = qt) {
|
|
439
439
|
return (e, a) => i(e, a, t);
|
|
440
440
|
}
|
|
441
|
-
const
|
|
441
|
+
const Lt = (t, i) => ({
|
|
442
442
|
name: "",
|
|
443
443
|
documentType: "",
|
|
444
444
|
revision: 0,
|
|
@@ -447,8 +447,8 @@ const Pt = (t, i) => ({
|
|
|
447
447
|
attachments: {},
|
|
448
448
|
...t,
|
|
449
449
|
state: (i == null ? void 0 : i(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? {}
|
|
450
|
-
}),
|
|
451
|
-
const e =
|
|
450
|
+
}), Rt = (t, i) => {
|
|
451
|
+
const e = Lt(
|
|
452
452
|
t,
|
|
453
453
|
i
|
|
454
454
|
);
|
|
@@ -457,41 +457,45 @@ const Pt = (t, i) => ({
|
|
|
457
457
|
initialState: e,
|
|
458
458
|
operations: []
|
|
459
459
|
};
|
|
460
|
-
},
|
|
460
|
+
}, It = (t) => h(it(t.state)), Yt = (t, i = 1e3) => {
|
|
461
461
|
const e = Math.random() * i;
|
|
462
|
-
return
|
|
463
|
-
}
|
|
462
|
+
return h(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${e}`);
|
|
463
|
+
};
|
|
464
|
+
function x(t) {
|
|
465
|
+
return at(nt(t, !0));
|
|
466
|
+
}
|
|
467
|
+
const W = (t) => u(
|
|
464
468
|
"SET_NAME",
|
|
465
469
|
t,
|
|
466
470
|
void 0,
|
|
467
|
-
|
|
468
|
-
),
|
|
471
|
+
k
|
|
472
|
+
), G = (t = 1) => u("UNDO", t, void 0, D), Q = (t = 1) => u("REDO", t, void 0, O), V = (t, i) => u(
|
|
469
473
|
"PRUNE",
|
|
470
474
|
{ start: t, end: i },
|
|
471
475
|
void 0,
|
|
472
|
-
|
|
473
|
-
),
|
|
476
|
+
_
|
|
477
|
+
), E = (t, i) => u(
|
|
474
478
|
"LOAD_STATE",
|
|
475
479
|
{ state: t, operations: i },
|
|
476
480
|
void 0,
|
|
477
|
-
|
|
478
|
-
),
|
|
481
|
+
S
|
|
482
|
+
), ti = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
479
483
|
__proto__: null,
|
|
480
|
-
loadState:
|
|
481
|
-
prune:
|
|
482
|
-
redo:
|
|
483
|
-
setName:
|
|
484
|
-
undo:
|
|
484
|
+
loadState: E,
|
|
485
|
+
prune: V,
|
|
486
|
+
redo: Q,
|
|
487
|
+
setName: W,
|
|
488
|
+
undo: G
|
|
485
489
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
486
|
-
class
|
|
490
|
+
class ii {
|
|
487
491
|
/**
|
|
488
492
|
* Constructs a BaseDocument instance with an initial state.
|
|
489
493
|
* @param reducer - The reducer function that updates the state.
|
|
490
494
|
* @param document - The initial state of the document.
|
|
491
495
|
*/
|
|
492
496
|
constructor(i, e) {
|
|
493
|
-
|
|
494
|
-
|
|
497
|
+
j(this, "_document");
|
|
498
|
+
j(this, "_reducer");
|
|
495
499
|
this._reducer = i, this._document = e;
|
|
496
500
|
}
|
|
497
501
|
/**
|
|
@@ -509,14 +513,14 @@ class Xt {
|
|
|
509
513
|
* @returns The file path where the state was saved.
|
|
510
514
|
*/
|
|
511
515
|
saveToFile(i, e, a) {
|
|
512
|
-
return
|
|
516
|
+
return wt(this._document, i, e, a);
|
|
513
517
|
}
|
|
514
518
|
/**
|
|
515
519
|
* Loads the state of the document from a file.
|
|
516
520
|
* @param path - The file path where the state is stored.
|
|
517
521
|
*/
|
|
518
522
|
async loadFromFile(i) {
|
|
519
|
-
this._document = await
|
|
523
|
+
this._document = await A(i, this._reducer);
|
|
520
524
|
}
|
|
521
525
|
/**
|
|
522
526
|
* Loads the state of the document from a file and returns it.
|
|
@@ -525,19 +529,19 @@ class Xt {
|
|
|
525
529
|
* @returns The state of the document.
|
|
526
530
|
*/
|
|
527
531
|
static async stateFromFile(i, e) {
|
|
528
|
-
return await
|
|
532
|
+
return await A(i, e);
|
|
529
533
|
}
|
|
530
534
|
/**
|
|
531
535
|
* Gets the current state of the document.
|
|
532
536
|
*/
|
|
533
537
|
get state() {
|
|
534
|
-
return this._document.state;
|
|
538
|
+
return x(this._document.state);
|
|
535
539
|
}
|
|
536
540
|
/**
|
|
537
541
|
* Gets the list of operations performed on the document.
|
|
538
542
|
*/
|
|
539
543
|
get operations() {
|
|
540
|
-
return this._document.operations;
|
|
544
|
+
return x(this._document.operations);
|
|
541
545
|
}
|
|
542
546
|
/**
|
|
543
547
|
* Gets the name of the document.
|
|
@@ -573,13 +577,13 @@ class Xt {
|
|
|
573
577
|
* Gets the initial state of the document.
|
|
574
578
|
*/
|
|
575
579
|
get initialState() {
|
|
576
|
-
return this._document.initialState;
|
|
580
|
+
return x(this._document.initialState);
|
|
577
581
|
}
|
|
578
582
|
/**
|
|
579
583
|
* Returns the current document as an object
|
|
580
584
|
*/
|
|
581
585
|
toDocument() {
|
|
582
|
-
return this._document;
|
|
586
|
+
return x(this._document);
|
|
583
587
|
}
|
|
584
588
|
/**
|
|
585
589
|
* Gets the attachment associated with the given key.
|
|
@@ -593,21 +597,21 @@ class Xt {
|
|
|
593
597
|
* @param name - The new name of the document.
|
|
594
598
|
*/
|
|
595
599
|
setName(i) {
|
|
596
|
-
return this.dispatch(
|
|
600
|
+
return this.dispatch(W(i)), this;
|
|
597
601
|
}
|
|
598
602
|
/**
|
|
599
603
|
* Reverts a number of actions from the document.
|
|
600
604
|
* @param count - The number of actions to revert.
|
|
601
605
|
*/
|
|
602
606
|
undo(i) {
|
|
603
|
-
return this.dispatch(
|
|
607
|
+
return this.dispatch(G(i)), this;
|
|
604
608
|
}
|
|
605
609
|
/**
|
|
606
610
|
* Reapplies a number of actions to the document.
|
|
607
611
|
* @param count - The number of actions to reapply.
|
|
608
612
|
*/
|
|
609
613
|
redo(i) {
|
|
610
|
-
return this.dispatch(
|
|
614
|
+
return this.dispatch(Q(i)), this;
|
|
611
615
|
}
|
|
612
616
|
/**
|
|
613
617
|
* Removes a range of operations from the document.
|
|
@@ -615,7 +619,7 @@ class Xt {
|
|
|
615
619
|
* @param end - The ending index of the range to remove.
|
|
616
620
|
*/
|
|
617
621
|
prune(i, e) {
|
|
618
|
-
return this.dispatch(
|
|
622
|
+
return this.dispatch(V(i, e)), this;
|
|
619
623
|
}
|
|
620
624
|
/**
|
|
621
625
|
* Loads a document state and a set of operations.
|
|
@@ -623,10 +627,10 @@ class Xt {
|
|
|
623
627
|
* @param operations - The operations to apply to the document.
|
|
624
628
|
*/
|
|
625
629
|
loadState(i, e) {
|
|
626
|
-
return this.dispatch(
|
|
630
|
+
return this.dispatch(E(i, e)), this;
|
|
627
631
|
}
|
|
628
632
|
}
|
|
629
|
-
function
|
|
633
|
+
function ei(t, i) {
|
|
630
634
|
i.forEach((e) => {
|
|
631
635
|
Object.getOwnPropertyNames(e.prototype).forEach((a) => {
|
|
632
636
|
Object.defineProperty(
|
|
@@ -638,23 +642,24 @@ function Yt(t, i) {
|
|
|
638
642
|
});
|
|
639
643
|
}
|
|
640
644
|
export {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
645
|
+
ii as B,
|
|
646
|
+
Lt as a,
|
|
647
|
+
Rt as b,
|
|
648
|
+
Mt as c,
|
|
649
|
+
Qt as d,
|
|
650
|
+
St as e,
|
|
647
651
|
u as f,
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
652
|
+
ei as g,
|
|
653
|
+
ti as h,
|
|
654
|
+
T as i,
|
|
655
|
+
B as j,
|
|
656
|
+
Xt as k,
|
|
657
|
+
A as l,
|
|
658
|
+
Vt as m,
|
|
659
|
+
It as n,
|
|
660
|
+
Yt as o,
|
|
661
|
+
qt as p,
|
|
662
|
+
x as r,
|
|
663
|
+
wt as s,
|
|
664
|
+
Gt as z
|
|
660
665
|
};
|