document-model 1.0.16 → 1.0.17
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/schema/zod.d.ts +24 -0
- package/dist/browser/document/types.d.ts +8 -7
- package/dist/browser/document/utils/base.d.ts +4 -4
- package/dist/browser/document-model/gen/object.d.ts +1 -1
- package/dist/browser/document-model/gen/schema/types.d.ts +12 -5
- package/dist/browser/document-model/gen/schema/zod.d.ts +20 -1
- package/dist/browser/document-model/index.d.ts +3 -3
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +2 -2
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/index-01030c3f.js +22 -0
- package/dist/{node/internal/index-0e7af6c6.js → browser/internal/index-2aee8ea9.js} +1 -1
- package/dist/browser/internal/{index-37753e74.js → index-5f1909ad.js} +513 -435
- package/dist/{node/internal/index-124bda95.js → browser/internal/index-a1282d5c.js} +1 -1
- package/dist/browser/internal/object-24df9d92.js +6 -0
- package/dist/browser/internal/{object-17aee7a9.js → object-7e8eaff4.js} +377 -365
- package/dist/node/document/schema/zod.d.ts +24 -0
- package/dist/node/document/types.d.ts +8 -7
- package/dist/node/document/utils/base.d.ts +4 -4
- package/dist/node/document-model/gen/object.d.ts +1 -1
- package/dist/node/document-model/gen/schema/types.d.ts +12 -5
- package/dist/node/document-model/gen/schema/zod.d.ts +20 -1
- package/dist/node/document-model/index.d.ts +3 -3
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +2 -2
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/internal/{index-9037f83a.js → index-0db636da.js} +513 -435
- package/dist/{browser/internal/index-f5587600.js → node/internal/index-2d4783d9.js} +1 -1
- package/dist/{browser/internal/index-9b4d67fc.js → node/internal/index-5ef0c6b0.js} +1 -1
- package/dist/node/internal/index-cddc9dfd.js +22 -0
- package/dist/node/internal/object-21f3d2ee.js +1 -0
- package/dist/node/internal/{object-f7cd4777.js → object-c32ea0a0.js} +154 -142
- package/package.json +1 -1
- package/dist/browser/internal/index-a5150e7e.js +0 -22
- package/dist/browser/internal/object-28a1a8bf.js +0 -6
- package/dist/node/internal/index-417115f1.js +0 -22
- package/dist/node/internal/object-f3dd289e.js +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var x = (t, e, i) => (
|
|
4
|
-
import
|
|
5
|
-
import { produce as N, castDraft as
|
|
1
|
+
var at = Object.defineProperty;
|
|
2
|
+
var ot = (t, e, i) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var x = (t, e, i) => (ot(t, typeof e != "symbol" ? e + "" : e, i), i);
|
|
4
|
+
import nt from "json-stringify-deterministic";
|
|
5
|
+
import { produce as N, castDraft as st, castImmutable as lt, freeze as pt } from "immer";
|
|
6
6
|
import F from "jszip";
|
|
7
|
-
import
|
|
7
|
+
import ct from "crypto";
|
|
8
8
|
import w from "fs";
|
|
9
|
-
import
|
|
10
|
-
import { join as
|
|
9
|
+
import rt from "https";
|
|
10
|
+
import { join as mt } from "path";
|
|
11
11
|
import { z as n } from "zod";
|
|
12
|
-
const P = (t) => t != null,
|
|
13
|
-
function
|
|
12
|
+
const P = (t) => t != null, ut = n.any().refine((t) => P(t)), q = n.enum(["LOAD_STATE"]), I = n.enum(["PRUNE"]), M = n.enum(["REDO"]), R = n.enum(["SET_NAME"]), L = n.enum(["UNDO"]);
|
|
13
|
+
function dt() {
|
|
14
14
|
return n.object({
|
|
15
15
|
__typename: n.literal("Action").optional(),
|
|
16
16
|
type: n.string()
|
|
@@ -18,14 +18,14 @@ function rt() {
|
|
|
18
18
|
}
|
|
19
19
|
function U() {
|
|
20
20
|
return n.union([
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
J(),
|
|
22
|
+
C(),
|
|
23
|
+
B(),
|
|
24
|
+
Z(),
|
|
25
|
+
H()
|
|
26
26
|
]);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function xt() {
|
|
29
29
|
return n.object({
|
|
30
30
|
__typename: n.literal("DocumentFile").optional(),
|
|
31
31
|
data: n.string(),
|
|
@@ -34,26 +34,26 @@ function mt() {
|
|
|
34
34
|
mimeType: n.string()
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function J() {
|
|
38
38
|
return n.object({
|
|
39
|
-
input: n.lazy(() =>
|
|
39
|
+
input: n.lazy(() => S()),
|
|
40
40
|
type: q,
|
|
41
41
|
scope: n.literal("global")
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function S() {
|
|
45
45
|
return n.object({
|
|
46
46
|
operations: n.number(),
|
|
47
|
-
state: n.lazy(() =>
|
|
47
|
+
state: n.lazy(() => $())
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function $() {
|
|
51
51
|
return n.object({
|
|
52
52
|
data: n.unknown().nullish(),
|
|
53
53
|
name: n.string()
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function gt() {
|
|
57
57
|
return n.object({
|
|
58
58
|
__typename: n.literal("Operation").optional(),
|
|
59
59
|
hash: n.string(),
|
|
@@ -62,34 +62,36 @@ function ut() {
|
|
|
62
62
|
type: n.string()
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function C() {
|
|
66
66
|
return n.object({
|
|
67
|
-
input: n.lazy(() =>
|
|
68
|
-
type:
|
|
67
|
+
input: n.lazy(() => _()),
|
|
68
|
+
type: I,
|
|
69
69
|
scope: n.literal("global")
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function _() {
|
|
73
73
|
return n.object({
|
|
74
74
|
end: n.number().nullish(),
|
|
75
75
|
start: n.number().nullish()
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
const O = n.number;
|
|
79
|
+
function B() {
|
|
79
80
|
return n.object({
|
|
80
|
-
input:
|
|
81
|
-
type:
|
|
81
|
+
input: O(),
|
|
82
|
+
type: M,
|
|
82
83
|
scope: n.literal("global")
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
+
const D = n.string;
|
|
87
|
+
function Z() {
|
|
86
88
|
return n.object({
|
|
87
|
-
input:
|
|
89
|
+
input: D(),
|
|
88
90
|
type: R,
|
|
89
91
|
scope: n.literal("global")
|
|
90
92
|
});
|
|
91
93
|
}
|
|
92
|
-
function
|
|
94
|
+
function ft() {
|
|
93
95
|
return n.object({
|
|
94
96
|
__typename: n.literal("SetNameOperation").optional(),
|
|
95
97
|
hash: n.string(),
|
|
@@ -99,37 +101,41 @@ function dt() {
|
|
|
99
101
|
type: n.string()
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
|
-
|
|
104
|
+
const k = n.number;
|
|
105
|
+
function H() {
|
|
103
106
|
return n.object({
|
|
104
|
-
input:
|
|
105
|
-
type:
|
|
107
|
+
input: k(),
|
|
108
|
+
type: L,
|
|
106
109
|
scope: n.literal("global")
|
|
107
110
|
});
|
|
108
111
|
}
|
|
109
|
-
const
|
|
112
|
+
const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
110
113
|
__proto__: null,
|
|
111
|
-
ActionSchema:
|
|
114
|
+
ActionSchema: dt,
|
|
112
115
|
BaseActionSchema: U,
|
|
113
|
-
DocumentFileSchema:
|
|
114
|
-
LoadStateActionInputSchema:
|
|
115
|
-
LoadStateActionSchema:
|
|
116
|
-
LoadStateActionStateInputSchema:
|
|
116
|
+
DocumentFileSchema: xt,
|
|
117
|
+
LoadStateActionInputSchema: S,
|
|
118
|
+
LoadStateActionSchema: J,
|
|
119
|
+
LoadStateActionStateInputSchema: $,
|
|
117
120
|
Load_StateSchema: q,
|
|
118
|
-
OperationSchema:
|
|
119
|
-
PruneActionInputSchema:
|
|
120
|
-
PruneActionSchema:
|
|
121
|
-
PruneSchema:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
OperationSchema: gt,
|
|
122
|
+
PruneActionInputSchema: _,
|
|
123
|
+
PruneActionSchema: C,
|
|
124
|
+
PruneSchema: I,
|
|
125
|
+
RedoActionInputSchema: O,
|
|
126
|
+
RedoActionSchema: B,
|
|
127
|
+
RedoSchema: M,
|
|
128
|
+
SetNameActionInputSchema: D,
|
|
129
|
+
SetNameActionSchema: Z,
|
|
130
|
+
SetNameOperationSchema: ft,
|
|
126
131
|
Set_NameSchema: R,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
UndoActionInputSchema: k,
|
|
133
|
+
UndoActionSchema: H,
|
|
134
|
+
UndoSchema: L,
|
|
135
|
+
definedNonNullAnySchema: ut,
|
|
130
136
|
isDefinedNonNullAny: P
|
|
131
137
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
132
|
-
function
|
|
138
|
+
function ht(t) {
|
|
133
139
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
134
140
|
}
|
|
135
141
|
function h() {
|
|
@@ -168,12 +174,12 @@ h.prototype.getType = function(t) {
|
|
|
168
174
|
h.prototype.getExtension = function(t) {
|
|
169
175
|
return t = /^\s*([^;\s]*)/.test(t) && RegExp.$1, t && this._extensions[t.toLowerCase()] || null;
|
|
170
176
|
};
|
|
171
|
-
var gt = h, 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"] };
|
|
172
|
-
let
|
|
173
|
-
var
|
|
174
|
-
const
|
|
175
|
-
function
|
|
176
|
-
const a =
|
|
177
|
+
var bt = h, vt = { "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"] };
|
|
178
|
+
let yt = bt;
|
|
179
|
+
var jt = new yt(vt);
|
|
180
|
+
const wt = /* @__PURE__ */ ht(jt);
|
|
181
|
+
function St(t, e, i) {
|
|
182
|
+
const a = mt(t, e);
|
|
177
183
|
return w.mkdirSync(t, { recursive: !0 }), new Promise((o, s) => {
|
|
178
184
|
try {
|
|
179
185
|
w.writeFile(a, i, {}, (l) => {
|
|
@@ -184,12 +190,12 @@ function yt(t, e, i) {
|
|
|
184
190
|
}
|
|
185
191
|
});
|
|
186
192
|
}
|
|
187
|
-
function
|
|
193
|
+
function K(t) {
|
|
188
194
|
return w.readFileSync(t);
|
|
189
195
|
}
|
|
190
|
-
function
|
|
196
|
+
function _t(t) {
|
|
191
197
|
return new Promise((e, i) => {
|
|
192
|
-
|
|
198
|
+
rt.get(t, (a) => {
|
|
193
199
|
const o = [], s = a.headers["content-type"];
|
|
194
200
|
a.on("data", (l) => {
|
|
195
201
|
o.push(l);
|
|
@@ -201,7 +207,7 @@ function jt(t) {
|
|
|
201
207
|
});
|
|
202
208
|
});
|
|
203
209
|
}
|
|
204
|
-
const
|
|
210
|
+
const Ot = async (t) => K(t), b = (t, e = "sha1") => ct.createHash(e).update(t).digest("base64"), W = async (t) => {
|
|
205
211
|
const e = new F(), { name: i, revision: a, documentType: o, created: s, lastModified: l } = t, p = {
|
|
206
212
|
name: i,
|
|
207
213
|
revision: a,
|
|
@@ -220,27 +226,27 @@ const wt = async (t) => B(t), b = (t, e = "sha1") => st.createHash(e).update(t).
|
|
|
220
226
|
comment: JSON.stringify(j)
|
|
221
227
|
});
|
|
222
228
|
}), e;
|
|
223
|
-
},
|
|
224
|
-
const s = await (await
|
|
229
|
+
}, Dt = async (t, e, i, a) => {
|
|
230
|
+
const s = await (await W(t)).generateAsync({
|
|
225
231
|
type: "uint8array",
|
|
226
232
|
streamFiles: !0
|
|
227
233
|
}), l = a ?? t.name, p = `.${i}.zip`;
|
|
228
|
-
return
|
|
234
|
+
return St(
|
|
229
235
|
e,
|
|
230
236
|
l.endsWith(p) ? l : `${l}${p}`,
|
|
231
237
|
s
|
|
232
238
|
);
|
|
233
|
-
},
|
|
234
|
-
const a = await (await
|
|
239
|
+
}, Yt = async (t, e) => {
|
|
240
|
+
const a = await (await W(t)).generateAsync({ type: "blob" }), o = await e.createWritable();
|
|
235
241
|
await o.write(a), await o.close();
|
|
236
242
|
}, A = async (t, e) => {
|
|
237
|
-
const i =
|
|
238
|
-
return
|
|
239
|
-
},
|
|
243
|
+
const i = K(t);
|
|
244
|
+
return kt(i, e);
|
|
245
|
+
}, kt = async (t, e) => {
|
|
240
246
|
const i = new F();
|
|
241
|
-
return await i.loadAsync(t),
|
|
247
|
+
return await i.loadAsync(t), Et(i, e);
|
|
242
248
|
};
|
|
243
|
-
async function
|
|
249
|
+
async function Et(t, e) {
|
|
244
250
|
const i = t.file("state.json");
|
|
245
251
|
if (!i)
|
|
246
252
|
throw new Error("Initial state not found");
|
|
@@ -260,7 +266,7 @@ async function Ot(t, e) {
|
|
|
260
266
|
attachments: { ...o.attachments }
|
|
261
267
|
};
|
|
262
268
|
let r = c.global.concat(c.local).slice(0, l == null ? void 0 : l.revision).reduce(
|
|
263
|
-
(j,
|
|
269
|
+
(j, it) => e(j, it),
|
|
264
270
|
m
|
|
265
271
|
);
|
|
266
272
|
return l && (r = {
|
|
@@ -275,12 +281,12 @@ async function Ot(t, e) {
|
|
|
275
281
|
}
|
|
276
282
|
}), r;
|
|
277
283
|
}
|
|
278
|
-
function
|
|
284
|
+
function G(t) {
|
|
279
285
|
const e = t.replace(/^.*\./, "") || void 0, i = t.replace(/^.*[/\\]/, "") || void 0;
|
|
280
286
|
return { extension: e, fileName: i };
|
|
281
287
|
}
|
|
282
|
-
async function
|
|
283
|
-
const { buffer: e, mimeType: i = "application/octet-stream" } = await
|
|
288
|
+
async function te(t) {
|
|
289
|
+
const { buffer: e, mimeType: i = "application/octet-stream" } = await _t(t), a = G(t), o = e.toString("base64");
|
|
284
290
|
return {
|
|
285
291
|
data: o,
|
|
286
292
|
hash: b(o),
|
|
@@ -288,21 +294,21 @@ async function Vt(t) {
|
|
|
288
294
|
...a
|
|
289
295
|
};
|
|
290
296
|
}
|
|
291
|
-
async function
|
|
292
|
-
const e = await
|
|
297
|
+
async function ee(t) {
|
|
298
|
+
const e = await Ot(t), i = wt.getType(t) || "application/octet-stream", a = G(t), o = e.toString("base64");
|
|
293
299
|
return { data: o, hash: b(o), mimeType: i, ...a };
|
|
294
300
|
}
|
|
295
301
|
function f(t, e, i, a) {
|
|
296
|
-
const o =
|
|
302
|
+
const o = $t(t), s = Ut(i);
|
|
297
303
|
return e.global.concat(e.local).reduce(
|
|
298
304
|
(l, p) => s(l, p, a),
|
|
299
305
|
o
|
|
300
306
|
);
|
|
301
307
|
}
|
|
302
|
-
function
|
|
308
|
+
function Nt(t, e) {
|
|
303
309
|
return { ...t, name: e };
|
|
304
310
|
}
|
|
305
|
-
function
|
|
311
|
+
function At(t, e, i) {
|
|
306
312
|
const a = Math.min(e, t.revision), o = t.operations.global.slice(
|
|
307
313
|
0,
|
|
308
314
|
t.revision - a
|
|
@@ -320,7 +326,7 @@ function kt(t, e, i) {
|
|
|
320
326
|
revision: t.revision - a
|
|
321
327
|
};
|
|
322
328
|
}
|
|
323
|
-
function
|
|
329
|
+
function Tt(t, e, i) {
|
|
324
330
|
const a = t.operations.global.length - t.revision;
|
|
325
331
|
if (!a)
|
|
326
332
|
throw new Error("There is no UNDO operation to REDO");
|
|
@@ -341,7 +347,7 @@ function Et(t, e, i) {
|
|
|
341
347
|
revision: t.revision + o
|
|
342
348
|
};
|
|
343
349
|
}
|
|
344
|
-
function
|
|
350
|
+
function zt(t, e, i, a) {
|
|
345
351
|
e = e || 0, i = i || t.operations.global.length;
|
|
346
352
|
const o = t.operations.global.slice(e, i), s = t.operations.global.slice(0, e), l = t.operations.global.slice(i), p = f(
|
|
347
353
|
t.initialState,
|
|
@@ -364,25 +370,25 @@ function Nt(t, e, i, a) {
|
|
|
364
370
|
a
|
|
365
371
|
);
|
|
366
372
|
}
|
|
367
|
-
function
|
|
373
|
+
function Ft(t, e) {
|
|
368
374
|
return {
|
|
369
375
|
...t,
|
|
370
376
|
name: e.name,
|
|
371
377
|
state: e.state ?? { global: {}, local: {} }
|
|
372
378
|
};
|
|
373
379
|
}
|
|
374
|
-
const
|
|
375
|
-
function
|
|
380
|
+
const Q = "SET_NAME", v = "UNDO", y = "REDO", u = "PRUNE", V = "LOAD_STATE";
|
|
381
|
+
function Pt(t, e) {
|
|
376
382
|
return [v, y, u].includes(e.type) ? t.revision : t.revision + 1;
|
|
377
383
|
}
|
|
378
|
-
function
|
|
384
|
+
function qt(t, e) {
|
|
379
385
|
return {
|
|
380
386
|
...t,
|
|
381
|
-
revision:
|
|
387
|
+
revision: Pt(t, e),
|
|
382
388
|
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
383
389
|
};
|
|
384
390
|
}
|
|
385
|
-
function
|
|
391
|
+
function It(t, e) {
|
|
386
392
|
if ([v, y, u, u].includes(e.type))
|
|
387
393
|
return t;
|
|
388
394
|
const i = t.operations.global.slice(
|
|
@@ -409,37 +415,37 @@ function Ft(t, e) {
|
|
|
409
415
|
}
|
|
410
416
|
};
|
|
411
417
|
}
|
|
412
|
-
function
|
|
413
|
-
let i =
|
|
414
|
-
return (!e.scope || e.scope === "global") && (i =
|
|
418
|
+
function Mt(t, e) {
|
|
419
|
+
let i = It(t, e);
|
|
420
|
+
return (!e.scope || e.scope === "global") && (i = qt(i, e)), i;
|
|
415
421
|
}
|
|
416
|
-
function
|
|
422
|
+
function Rt(t, e, i) {
|
|
417
423
|
switch (U().parse(e), e.type) {
|
|
418
|
-
case
|
|
419
|
-
return
|
|
424
|
+
case Q:
|
|
425
|
+
return Nt(t, e.input);
|
|
420
426
|
case v:
|
|
421
|
-
return
|
|
427
|
+
return At(t, e.input, i);
|
|
422
428
|
case y:
|
|
423
|
-
return
|
|
429
|
+
return Tt(t, e.input, i);
|
|
424
430
|
case u:
|
|
425
|
-
return
|
|
431
|
+
return zt(
|
|
426
432
|
t,
|
|
427
433
|
e.input.start,
|
|
428
434
|
e.input.end,
|
|
429
435
|
i
|
|
430
436
|
);
|
|
431
|
-
case
|
|
432
|
-
return
|
|
437
|
+
case V:
|
|
438
|
+
return Ft(t, e.input.state);
|
|
433
439
|
default:
|
|
434
440
|
return t;
|
|
435
441
|
}
|
|
436
442
|
}
|
|
437
|
-
function
|
|
443
|
+
function Lt(t, e, i, a) {
|
|
438
444
|
let o = t;
|
|
439
|
-
return T(e) && (o =
|
|
445
|
+
return T(e) && (o = Rt(o, e, i)), o = Mt(o, e), o = N(o, (s) => {
|
|
440
446
|
const l = i(s.state, e, a);
|
|
441
447
|
if (l)
|
|
442
|
-
return
|
|
448
|
+
return st({
|
|
443
449
|
...o,
|
|
444
450
|
state: l
|
|
445
451
|
});
|
|
@@ -453,7 +459,7 @@ function Mt(t, e, i, a) {
|
|
|
453
459
|
});
|
|
454
460
|
}
|
|
455
461
|
function T(t) {
|
|
456
|
-
return [
|
|
462
|
+
return [Q, v, y, u, V].includes(t.type);
|
|
457
463
|
}
|
|
458
464
|
function d(t, e, i, a, o = "global") {
|
|
459
465
|
if (!t)
|
|
@@ -461,12 +467,18 @@ function d(t, e, i, a, o = "global") {
|
|
|
461
467
|
if (typeof t != "string")
|
|
462
468
|
throw new Error(`Invalid action type: ${t}`);
|
|
463
469
|
const s = { type: t, input: e, scope: o };
|
|
464
|
-
|
|
470
|
+
i && (s.attachments = i);
|
|
471
|
+
try {
|
|
472
|
+
a == null || a().parse(s.input);
|
|
473
|
+
} catch (l) {
|
|
474
|
+
throw new Error(`Invalid action input: ${l}`);
|
|
475
|
+
}
|
|
476
|
+
return s;
|
|
465
477
|
}
|
|
466
|
-
function
|
|
478
|
+
function Ut(t, e = Lt) {
|
|
467
479
|
return (i, a, o) => e(i, a, t, o);
|
|
468
480
|
}
|
|
469
|
-
const
|
|
481
|
+
const Jt = (t, e) => ({
|
|
470
482
|
name: "",
|
|
471
483
|
documentType: "",
|
|
472
484
|
revision: 0,
|
|
@@ -475,8 +487,8 @@ const Rt = (t, e) => ({
|
|
|
475
487
|
attachments: {},
|
|
476
488
|
...t,
|
|
477
489
|
state: (e == null ? void 0 : e(t == null ? void 0 : t.state)) ?? (t == null ? void 0 : t.state) ?? { global: {}, local: {} }
|
|
478
|
-
}),
|
|
479
|
-
const i =
|
|
490
|
+
}), $t = (t, e) => {
|
|
491
|
+
const i = Jt(
|
|
480
492
|
t,
|
|
481
493
|
e
|
|
482
494
|
);
|
|
@@ -486,22 +498,22 @@ const Rt = (t, e) => ({
|
|
|
486
498
|
operations: { global: [], local: [] }
|
|
487
499
|
};
|
|
488
500
|
}, z = (t, e = "global") => b(
|
|
489
|
-
|
|
501
|
+
nt(
|
|
490
502
|
e === "local" ? t.state.local : t.state.global
|
|
491
503
|
)
|
|
492
|
-
),
|
|
504
|
+
), ie = (t, e = 1e3) => {
|
|
493
505
|
const i = Math.random() * e;
|
|
494
506
|
return b(`${(t ?? /* @__PURE__ */ new Date()).toISOString()}${i}`);
|
|
495
507
|
};
|
|
496
508
|
function g(t) {
|
|
497
|
-
return
|
|
509
|
+
return lt(pt(t, !0));
|
|
498
510
|
}
|
|
499
|
-
const
|
|
511
|
+
const X = (t) => d(
|
|
500
512
|
"SET_NAME",
|
|
501
513
|
t,
|
|
502
514
|
void 0,
|
|
503
515
|
D
|
|
504
|
-
),
|
|
516
|
+
), Y = (t = 1) => d("UNDO", t, void 0, k), tt = (t = 1) => d("REDO", t, void 0, O), et = (t, e) => d(
|
|
505
517
|
"PRUNE",
|
|
506
518
|
{ start: t, end: e },
|
|
507
519
|
void 0,
|
|
@@ -511,15 +523,15 @@ const G = (t) => d(
|
|
|
511
523
|
{ state: t, operations: e },
|
|
512
524
|
void 0,
|
|
513
525
|
S
|
|
514
|
-
),
|
|
526
|
+
), ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
515
527
|
__proto__: null,
|
|
516
528
|
loadState: E,
|
|
517
|
-
prune:
|
|
518
|
-
redo:
|
|
519
|
-
setName:
|
|
520
|
-
undo:
|
|
529
|
+
prune: et,
|
|
530
|
+
redo: tt,
|
|
531
|
+
setName: X,
|
|
532
|
+
undo: Y
|
|
521
533
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
522
|
-
class
|
|
534
|
+
class oe {
|
|
523
535
|
/**
|
|
524
536
|
* Constructs a BaseDocument instance with an initial state.
|
|
525
537
|
* @param reducer - The reducer function that updates the state.
|
|
@@ -550,7 +562,7 @@ class ee {
|
|
|
550
562
|
* @returns The file path where the state was saved.
|
|
551
563
|
*/
|
|
552
564
|
saveToFile(e, i, a) {
|
|
553
|
-
return
|
|
565
|
+
return Dt(this._document, e, i, a);
|
|
554
566
|
}
|
|
555
567
|
/**
|
|
556
568
|
* Loads the state of the document from a file.
|
|
@@ -634,21 +646,21 @@ class ee {
|
|
|
634
646
|
* @param name - The new name of the document.
|
|
635
647
|
*/
|
|
636
648
|
setName(e) {
|
|
637
|
-
return this.dispatch(
|
|
649
|
+
return this.dispatch(X(e)), this;
|
|
638
650
|
}
|
|
639
651
|
/**
|
|
640
652
|
* Reverts a number of actions from the document.
|
|
641
653
|
* @param count - The number of actions to revert.
|
|
642
654
|
*/
|
|
643
655
|
undo(e) {
|
|
644
|
-
return this.dispatch(
|
|
656
|
+
return this.dispatch(Y(e)), this;
|
|
645
657
|
}
|
|
646
658
|
/**
|
|
647
659
|
* Reapplies a number of actions to the document.
|
|
648
660
|
* @param count - The number of actions to reapply.
|
|
649
661
|
*/
|
|
650
662
|
redo(e) {
|
|
651
|
-
return this.dispatch(
|
|
663
|
+
return this.dispatch(tt(e)), this;
|
|
652
664
|
}
|
|
653
665
|
/**
|
|
654
666
|
* Removes a range of operations from the document.
|
|
@@ -656,7 +668,7 @@ class ee {
|
|
|
656
668
|
* @param end - The ending index of the range to remove.
|
|
657
669
|
*/
|
|
658
670
|
prune(e, i) {
|
|
659
|
-
return this.dispatch(
|
|
671
|
+
return this.dispatch(et(e, i)), this;
|
|
660
672
|
}
|
|
661
673
|
/**
|
|
662
674
|
* Loads a document state and a set of operations.
|
|
@@ -667,7 +679,7 @@ class ee {
|
|
|
667
679
|
return this.dispatch(E(e, i)), this;
|
|
668
680
|
}
|
|
669
681
|
}
|
|
670
|
-
function
|
|
682
|
+
function ne(t, e) {
|
|
671
683
|
e.forEach((i) => {
|
|
672
684
|
Object.getOwnPropertyNames(i.prototype).forEach((a) => {
|
|
673
685
|
Object.defineProperty(
|
|
@@ -679,24 +691,24 @@ function ie(t, e) {
|
|
|
679
691
|
});
|
|
680
692
|
}
|
|
681
693
|
export {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
694
|
+
oe as B,
|
|
695
|
+
Jt as a,
|
|
696
|
+
$t as b,
|
|
697
|
+
Ut as c,
|
|
698
|
+
Yt as d,
|
|
699
|
+
kt as e,
|
|
688
700
|
d as f,
|
|
689
|
-
|
|
690
|
-
|
|
701
|
+
ne as g,
|
|
702
|
+
ae as h,
|
|
691
703
|
T as i,
|
|
692
|
-
|
|
693
|
-
|
|
704
|
+
W as j,
|
|
705
|
+
ee as k,
|
|
694
706
|
A as l,
|
|
695
|
-
|
|
707
|
+
te as m,
|
|
696
708
|
z as n,
|
|
697
|
-
|
|
698
|
-
|
|
709
|
+
ie as o,
|
|
710
|
+
Lt as p,
|
|
699
711
|
g as r,
|
|
700
|
-
|
|
701
|
-
|
|
712
|
+
Dt as s,
|
|
713
|
+
Xt as z
|
|
702
714
|
};
|