document-model 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +2 -2
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/{index-TAPWNyA9.js → index-99f8b333.js} +16 -6
- package/dist/{node/internal/index-FmPDtpIY.js → browser/internal/index-df4df518.js} +1 -1
- package/dist/{node/internal/index-lh4jt_0f.js → browser/internal/index-e019b5aa.js} +1 -1
- package/dist/browser/internal/{index-3haD_DrE.js → index-ff67644b.js} +1 -1
- package/dist/browser/internal/{object-jGU_rY7z.js → object-4b5800c0.js} +348 -352
- package/dist/browser/internal/{object-1BuggAcr.js → object-be1b0c52.js} +2 -2
- package/dist/browser/src/document/schema/index.d.ts +2 -2
- package/dist/browser/src/document/schema/types.d.ts +8 -12
- package/dist/browser/src/document/signal.d.ts +1 -0
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/browser/src/document-model/custom/reducers/versioning.d.ts +4 -4
- package/dist/browser/vitest.config.d.ts +2 -0
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +3 -3
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +3 -3
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +4 -4
- package/dist/{browser/internal/index-7bSWIChK.js → node/internal/index-2d55ed8c.js} +1 -1
- package/dist/node/internal/{index-pZl431ni.js → index-433d6a9b.js} +1 -1
- package/dist/{browser/internal/index-DQNkZhvL.js → node/internal/index-78c035e1.js} +1 -1
- package/dist/node/internal/{index-GpOpKG2W.js → index-a46dcf07.js} +17 -7
- package/dist/node/internal/{object-evJm9vYN.js → object-305e4c59.js} +244 -248
- package/dist/node/internal/object-ff6617a2.js +1 -0
- package/dist/node/src/document/schema/index.d.ts +2 -2
- package/dist/node/src/document/schema/types.d.ts +8 -12
- package/dist/node/src/document/signal.d.ts +1 -0
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/dist/node/src/document-model/custom/reducers/versioning.d.ts +4 -4
- package/dist/node/vitest.config.d.ts +2 -0
- package/package.json +23 -17
- package/dist/browser/jest.config.d.ts +0 -8
- package/dist/node/internal/object-pZF_UDWv.js +0 -1
- package/dist/node/jest.config.d.ts +0 -8
|
@@ -232,7 +232,7 @@ function Ce(i, o, p) {
|
|
|
232
232
|
),
|
|
233
233
|
timestamp: U,
|
|
234
234
|
index: y,
|
|
235
|
-
hash:
|
|
235
|
+
hash: Qt({ state: v }, "global")
|
|
236
236
|
},
|
|
237
237
|
...d.map((j, z) => ({
|
|
238
238
|
...j,
|
|
@@ -251,49 +251,112 @@ function Le(i, o) {
|
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
253
|
const Pt = "SET_NAME", M = "UNDO", C = "REDO", $ = "PRUNE", Jt = "LOAD_STATE";
|
|
254
|
-
function
|
|
255
|
-
|
|
254
|
+
function ze(i, o) {
|
|
255
|
+
const p = i.revision[o.scope];
|
|
256
|
+
return [M, C, $].includes(o.type) ? p : p + 1;
|
|
256
257
|
}
|
|
257
|
-
function
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
function qe(i, o) {
|
|
259
|
+
return {
|
|
260
|
+
...i,
|
|
261
|
+
revision: {
|
|
262
|
+
...i.revision,
|
|
263
|
+
[o.scope]: ze(i, o)
|
|
264
|
+
},
|
|
265
|
+
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
266
|
+
};
|
|
262
267
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
268
|
+
function $e(i, o, p = 0) {
|
|
269
|
+
if ([M, C, $].includes(o.type))
|
|
270
|
+
return i;
|
|
271
|
+
const { scope: c } = o, u = i.operations[c].slice(
|
|
272
|
+
0,
|
|
273
|
+
i.revision[c]
|
|
274
|
+
);
|
|
275
|
+
return u.push({
|
|
276
|
+
...o,
|
|
277
|
+
index: u.length,
|
|
278
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
279
|
+
hash: "",
|
|
280
|
+
scope: c,
|
|
281
|
+
skip: p
|
|
282
|
+
}), {
|
|
283
|
+
...i,
|
|
284
|
+
operations: { ...i.operations, [c]: u }
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function Pe(i, o, p = 0) {
|
|
288
|
+
let c = $e(i, o, p);
|
|
289
|
+
return c = qe(c, o), c;
|
|
290
|
+
}
|
|
291
|
+
function Je(i, o, p) {
|
|
292
|
+
switch (Rt().parse(o), o.type) {
|
|
293
|
+
case Pt:
|
|
294
|
+
return Ne(i, o.input);
|
|
295
|
+
case $:
|
|
296
|
+
return Ce(i, o, p);
|
|
297
|
+
case Jt:
|
|
298
|
+
return Le(i, o.input.state);
|
|
299
|
+
default:
|
|
300
|
+
return i;
|
|
283
301
|
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
};
|
|
293
|
-
var ze = K, qe = { "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"] };
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
const
|
|
302
|
+
}
|
|
303
|
+
function We(i, o, p) {
|
|
304
|
+
switch (o.type) {
|
|
305
|
+
case M:
|
|
306
|
+
return Re(i, o, p);
|
|
307
|
+
case C:
|
|
308
|
+
return Me(i, o, p);
|
|
309
|
+
default:
|
|
310
|
+
return { document: i, action: o, skip: p };
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function Wt(i, o, p, c, u = {}) {
|
|
314
|
+
const { skip: h, ignoreSkipOperations: l = !1 } = u;
|
|
315
|
+
let a = { ...o }, x = h || 0, d = i, E = [...i.clipboard];
|
|
316
|
+
if (St(a)) {
|
|
317
|
+
const {
|
|
318
|
+
skip: w,
|
|
319
|
+
action: v,
|
|
320
|
+
document: y
|
|
321
|
+
} = We(i, a, x);
|
|
322
|
+
a = v, x = w, d = y, E = [...d.clipboard];
|
|
323
|
+
}
|
|
324
|
+
return Bt(a) && (d = Je(d, a, p)), x > 0 && !l && (d = ot(
|
|
325
|
+
d.initialState,
|
|
326
|
+
d.operations,
|
|
327
|
+
p,
|
|
328
|
+
void 0,
|
|
329
|
+
void 0,
|
|
330
|
+
void 0,
|
|
331
|
+
{ [a.scope]: x }
|
|
332
|
+
)), d = Pe(d, a, x), d = Y(d, (w) => {
|
|
333
|
+
const v = p(
|
|
334
|
+
w.state,
|
|
335
|
+
a,
|
|
336
|
+
c
|
|
337
|
+
), y = St(o) ? [...E] : [];
|
|
338
|
+
if (v)
|
|
339
|
+
return rt({
|
|
340
|
+
...d,
|
|
341
|
+
clipboard: [...y],
|
|
342
|
+
state: v
|
|
343
|
+
});
|
|
344
|
+
w.clipboard = rt([...y]);
|
|
345
|
+
}), Y(d, (w) => {
|
|
346
|
+
if ([M, C, $].includes(a.type))
|
|
347
|
+
return w;
|
|
348
|
+
const v = a.scope || "global";
|
|
349
|
+
w.operations[v][w.operations[v].length - 1].hash = Qt(w, v), !Bt(a) && a.attachments && a.attachments.forEach((y) => {
|
|
350
|
+
const { hash: U, ...j } = y;
|
|
351
|
+
w.attachments[U] = {
|
|
352
|
+
...j
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function Ht(i) {
|
|
358
|
+
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
359
|
+
}
|
|
297
360
|
var it = { exports: {} };
|
|
298
361
|
typeof Object.create == "function" ? it.exports = function(o, p) {
|
|
299
362
|
p && (o.super_ = p, o.prototype = Object.create(p.prototype, {
|
|
@@ -312,16 +375,16 @@ typeof Object.create == "function" ? it.exports = function(o, p) {
|
|
|
312
375
|
c.prototype = p.prototype, o.prototype = new c(), o.prototype.constructor = o;
|
|
313
376
|
}
|
|
314
377
|
};
|
|
315
|
-
var
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
var T = [], I = [],
|
|
320
|
-
for (var R = 0,
|
|
378
|
+
var He = it.exports, nt = { exports: {} }, Zt = {}, K = {};
|
|
379
|
+
K.byteLength = Ke;
|
|
380
|
+
K.toByteArray = Xe;
|
|
381
|
+
K.fromByteArray = tr;
|
|
382
|
+
var T = [], I = [], Ze = typeof Uint8Array < "u" ? Uint8Array : Array, et = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
383
|
+
for (var R = 0, Ye = et.length; R < Ye; ++R)
|
|
321
384
|
T[R] = et[R], I[et.charCodeAt(R)] = R;
|
|
322
|
-
I[
|
|
323
|
-
I[
|
|
324
|
-
function
|
|
385
|
+
I["-".charCodeAt(0)] = 62;
|
|
386
|
+
I["_".charCodeAt(0)] = 63;
|
|
387
|
+
function Yt(i) {
|
|
325
388
|
var o = i.length;
|
|
326
389
|
if (o % 4 > 0)
|
|
327
390
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
@@ -330,30 +393,30 @@ function Zt(i) {
|
|
|
330
393
|
var c = p === o ? 0 : 4 - p % 4;
|
|
331
394
|
return [p, c];
|
|
332
395
|
}
|
|
333
|
-
function
|
|
334
|
-
var o =
|
|
396
|
+
function Ke(i) {
|
|
397
|
+
var o = Yt(i), p = o[0], c = o[1];
|
|
335
398
|
return (p + c) * 3 / 4 - c;
|
|
336
399
|
}
|
|
337
|
-
function
|
|
400
|
+
function Ve(i, o, p) {
|
|
338
401
|
return (o + p) * 3 / 4 - p;
|
|
339
402
|
}
|
|
340
|
-
function
|
|
341
|
-
var o, p =
|
|
403
|
+
function Xe(i) {
|
|
404
|
+
var o, p = Yt(i), c = p[0], u = p[1], h = new Ze(Ve(i, c, u)), l = 0, a = u > 0 ? c - 4 : c, x;
|
|
342
405
|
for (x = 0; x < a; x += 4)
|
|
343
406
|
o = I[i.charCodeAt(x)] << 18 | I[i.charCodeAt(x + 1)] << 12 | I[i.charCodeAt(x + 2)] << 6 | I[i.charCodeAt(x + 3)], h[l++] = o >> 16 & 255, h[l++] = o >> 8 & 255, h[l++] = o & 255;
|
|
344
407
|
return u === 2 && (o = I[i.charCodeAt(x)] << 2 | I[i.charCodeAt(x + 1)] >> 4, h[l++] = o & 255), u === 1 && (o = I[i.charCodeAt(x)] << 10 | I[i.charCodeAt(x + 1)] << 4 | I[i.charCodeAt(x + 2)] >> 2, h[l++] = o >> 8 & 255, h[l++] = o & 255), h;
|
|
345
408
|
}
|
|
346
|
-
function
|
|
409
|
+
function Ge(i) {
|
|
347
410
|
return T[i >> 18 & 63] + T[i >> 12 & 63] + T[i >> 6 & 63] + T[i & 63];
|
|
348
411
|
}
|
|
349
|
-
function
|
|
412
|
+
function Qe(i, o, p) {
|
|
350
413
|
for (var c, u = [], h = o; h < p; h += 3)
|
|
351
|
-
c = (i[h] << 16 & 16711680) + (i[h + 1] << 8 & 65280) + (i[h + 2] & 255), u.push(
|
|
414
|
+
c = (i[h] << 16 & 16711680) + (i[h + 1] << 8 & 65280) + (i[h + 2] & 255), u.push(Ge(c));
|
|
352
415
|
return u.join("");
|
|
353
416
|
}
|
|
354
|
-
function
|
|
417
|
+
function tr(i) {
|
|
355
418
|
for (var o, p = i.length, c = p % 3, u = [], h = 16383, l = 0, a = p - c; l < a; l += h)
|
|
356
|
-
u.push(
|
|
419
|
+
u.push(Qe(i, l, l + h > a ? a : l + h));
|
|
357
420
|
return c === 1 ? (o = i[p - 1], u.push(
|
|
358
421
|
T[o >> 2] + T[o << 4 & 63] + "=="
|
|
359
422
|
)) : c === 2 && (o = (i[p - 2] << 8) + i[p - 1], u.push(
|
|
@@ -392,7 +455,7 @@ ut.write = function(i, o, p, c, u, h) {
|
|
|
392
455
|
* @license MIT
|
|
393
456
|
*/
|
|
394
457
|
(function(i) {
|
|
395
|
-
var o =
|
|
458
|
+
var o = K, p = ut, c = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
396
459
|
i.Buffer = a, i.SlowBuffer = pe, i.INSPECT_MAX_BYTES = 50;
|
|
397
460
|
var u = 2147483647;
|
|
398
461
|
i.kMaxLength = u, a.TYPED_ARRAY_SUPPORT = h(), !a.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
@@ -1201,10 +1264,10 @@ ut.write = function(i, o, p, c, u, h) {
|
|
|
1201
1264
|
t[n + s] = r[e] + r[s];
|
|
1202
1265
|
return t;
|
|
1203
1266
|
}();
|
|
1204
|
-
})(
|
|
1267
|
+
})(Zt);
|
|
1205
1268
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1206
1269
|
(function(i, o) {
|
|
1207
|
-
var p =
|
|
1270
|
+
var p = Zt, c = p.Buffer;
|
|
1208
1271
|
function u(l, a) {
|
|
1209
1272
|
for (var x in l)
|
|
1210
1273
|
a[x] = l[x];
|
|
@@ -1232,12 +1295,12 @@ ut.write = function(i, o, p, c, u, h) {
|
|
|
1232
1295
|
return p.SlowBuffer(l);
|
|
1233
1296
|
};
|
|
1234
1297
|
})(nt, nt.exports);
|
|
1235
|
-
var
|
|
1236
|
-
function
|
|
1237
|
-
this._block =
|
|
1298
|
+
var Kt = nt.exports, Vt = Kt.Buffer;
|
|
1299
|
+
function V(i, o) {
|
|
1300
|
+
this._block = Vt.alloc(i), this._finalSize = o, this._blockSize = i, this._len = 0;
|
|
1238
1301
|
}
|
|
1239
|
-
|
|
1240
|
-
typeof i == "string" && (o = o || "utf8", i =
|
|
1302
|
+
V.prototype.update = function(i, o) {
|
|
1303
|
+
typeof i == "string" && (o = o || "utf8", i = Vt.from(i, o));
|
|
1241
1304
|
for (var p = this._block, c = this._blockSize, u = i.length, h = this._len, l = 0; l < u; ) {
|
|
1242
1305
|
for (var a = h % c, x = Math.min(u - l, c - a), d = 0; d < x; d++)
|
|
1243
1306
|
p[a + d] = i[l + d];
|
|
@@ -1245,7 +1308,7 @@ X.prototype.update = function(i, o) {
|
|
|
1245
1308
|
}
|
|
1246
1309
|
return this._len += u, this;
|
|
1247
1310
|
};
|
|
1248
|
-
|
|
1311
|
+
V.prototype.digest = function(i) {
|
|
1249
1312
|
var o = this._len % this._blockSize;
|
|
1250
1313
|
this._block[o] = 128, this._block.fill(0, o + 1), o >= this._finalSize && (this._update(this._block), this._block.fill(0));
|
|
1251
1314
|
var p = this._len * 8;
|
|
@@ -1259,260 +1322,77 @@ X.prototype.digest = function(i) {
|
|
|
1259
1322
|
var h = this._hash();
|
|
1260
1323
|
return i ? h.toString(i) : h;
|
|
1261
1324
|
};
|
|
1262
|
-
|
|
1325
|
+
V.prototype._update = function() {
|
|
1263
1326
|
throw new Error("_update must be implemented by subclass");
|
|
1264
1327
|
};
|
|
1265
|
-
var
|
|
1328
|
+
var er = V, rr = He, Xt = er, ir = Kt.Buffer, nr = [
|
|
1266
1329
|
1518500249,
|
|
1267
1330
|
1859775393,
|
|
1268
1331
|
-1894007588,
|
|
1269
1332
|
-899497514
|
|
1270
|
-
],
|
|
1333
|
+
], or = new Array(80);
|
|
1271
1334
|
function P() {
|
|
1272
|
-
this.init(), this._w =
|
|
1335
|
+
this.init(), this._w = or, Xt.call(this, 64, 56);
|
|
1273
1336
|
}
|
|
1274
|
-
|
|
1337
|
+
rr(P, Xt);
|
|
1275
1338
|
P.prototype.init = function() {
|
|
1276
1339
|
return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520, this;
|
|
1277
1340
|
};
|
|
1278
|
-
function
|
|
1341
|
+
function ar(i) {
|
|
1279
1342
|
return i << 1 | i >>> 31;
|
|
1280
1343
|
}
|
|
1281
|
-
function
|
|
1344
|
+
function pr(i) {
|
|
1282
1345
|
return i << 5 | i >>> 27;
|
|
1283
1346
|
}
|
|
1284
|
-
function
|
|
1347
|
+
function sr(i) {
|
|
1285
1348
|
return i << 30 | i >>> 2;
|
|
1286
1349
|
}
|
|
1287
|
-
function
|
|
1350
|
+
function cr(i, o, p, c) {
|
|
1288
1351
|
return i === 0 ? o & p | ~o & c : i === 2 ? o & p | o & c | p & c : o ^ p ^ c;
|
|
1289
1352
|
}
|
|
1290
1353
|
P.prototype._update = function(i) {
|
|
1291
1354
|
for (var o = this._w, p = this._a | 0, c = this._b | 0, u = this._c | 0, h = this._d | 0, l = this._e | 0, a = 0; a < 16; ++a)
|
|
1292
1355
|
o[a] = i.readInt32BE(a * 4);
|
|
1293
1356
|
for (; a < 80; ++a)
|
|
1294
|
-
o[a] =
|
|
1357
|
+
o[a] = ar(o[a - 3] ^ o[a - 8] ^ o[a - 14] ^ o[a - 16]);
|
|
1295
1358
|
for (var x = 0; x < 80; ++x) {
|
|
1296
|
-
var d = ~~(x / 20), E =
|
|
1297
|
-
l = h, h = u, u =
|
|
1359
|
+
var d = ~~(x / 20), E = pr(p) + cr(d, c, u, h) + l + o[x] + nr[d] | 0;
|
|
1360
|
+
l = h, h = u, u = sr(c), c = p, p = E;
|
|
1298
1361
|
}
|
|
1299
1362
|
this._a = p + this._a | 0, this._b = c + this._b | 0, this._c = u + this._c | 0, this._d = h + this._d | 0, this._e = l + this._e | 0;
|
|
1300
1363
|
};
|
|
1301
1364
|
P.prototype._hash = function() {
|
|
1302
|
-
var i =
|
|
1365
|
+
var i = ir.allocUnsafe(20);
|
|
1303
1366
|
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;
|
|
1304
1367
|
};
|
|
1305
|
-
var
|
|
1306
|
-
const
|
|
1307
|
-
function
|
|
1368
|
+
var lr = P;
|
|
1369
|
+
const ur = /* @__PURE__ */ Ht(lr), ft = new Error("File system not available.");
|
|
1370
|
+
function fr(i, o, p) {
|
|
1308
1371
|
throw ft;
|
|
1309
1372
|
}
|
|
1310
|
-
function
|
|
1373
|
+
function Gt(i) {
|
|
1311
1374
|
throw ft;
|
|
1312
1375
|
}
|
|
1313
|
-
function
|
|
1376
|
+
function hr(i) {
|
|
1314
1377
|
throw ft;
|
|
1315
1378
|
}
|
|
1316
|
-
const
|
|
1317
|
-
function
|
|
1379
|
+
const mr = async (i) => Gt();
|
|
1380
|
+
function xr(i) {
|
|
1318
1381
|
let o = "";
|
|
1319
1382
|
for (let p = 0; p < i.length; p += 2)
|
|
1320
1383
|
o += String.fromCharCode(parseInt(i.substr(p, 2), 16));
|
|
1321
1384
|
return btoa(o);
|
|
1322
1385
|
}
|
|
1323
|
-
const
|
|
1386
|
+
const X = (i, o = "sha1") => {
|
|
1324
1387
|
if (o !== "sha1")
|
|
1325
1388
|
throw new Error("Only sha1 algorithm is available.");
|
|
1326
|
-
const p = new
|
|
1327
|
-
return
|
|
1328
|
-
}, Gt = async (i) => {
|
|
1329
|
-
const o = new jt(), { name: p, revision: c, documentType: u, created: h, lastModified: l } = i, a = {
|
|
1330
|
-
name: p,
|
|
1331
|
-
revision: c,
|
|
1332
|
-
documentType: u,
|
|
1333
|
-
created: h,
|
|
1334
|
-
lastModified: l
|
|
1335
|
-
};
|
|
1336
|
-
return o.file("header.json", JSON.stringify(a, null, 2)), o.file(
|
|
1337
|
-
"state.json",
|
|
1338
|
-
JSON.stringify(i.initialState || {}, null, 2)
|
|
1339
|
-
), o.file("operations.json", JSON.stringify(i.operations, null, 2)), Object.keys(i.attachments).forEach((d) => {
|
|
1340
|
-
const { data: E, ...w } = i.attachments[d];
|
|
1341
|
-
o.file(d, E, {
|
|
1342
|
-
base64: !0,
|
|
1343
|
-
createFolders: !0,
|
|
1344
|
-
comment: JSON.stringify(w)
|
|
1345
|
-
});
|
|
1346
|
-
}), o;
|
|
1347
|
-
}, xr = async (i, o, p, c) => {
|
|
1348
|
-
await (await Gt(i)).generateAsync({
|
|
1349
|
-
type: "uint8array",
|
|
1350
|
-
streamFiles: !0
|
|
1351
|
-
});
|
|
1352
|
-
const h = c ?? i.name, l = `.${p}.zip`;
|
|
1353
|
-
return ur(
|
|
1354
|
-
o,
|
|
1355
|
-
h.endsWith(l) ? h : `${h}${l}`
|
|
1356
|
-
);
|
|
1357
|
-
}, Nr = async (i, o) => {
|
|
1358
|
-
const c = await (await Gt(i)).generateAsync({ type: "blob" }), u = await o.createWritable();
|
|
1359
|
-
await u.write(c), await u.close();
|
|
1360
|
-
}, St = async (i, o) => {
|
|
1361
|
-
const p = Xt();
|
|
1362
|
-
return dr(p, o);
|
|
1363
|
-
}, dr = async (i, o) => {
|
|
1364
|
-
const p = new jt();
|
|
1365
|
-
return await p.loadAsync(i), gr(p, o);
|
|
1389
|
+
const p = new ur();
|
|
1390
|
+
return xr(p.update(i).digest("hex"));
|
|
1366
1391
|
};
|
|
1367
|
-
|
|
1368
|
-
const p = i.file("state.json");
|
|
1369
|
-
if (!p)
|
|
1370
|
-
throw new Error("Initial state not found");
|
|
1371
|
-
const c = await p.async("string"), u = JSON.parse(c), h = i.file("header.json");
|
|
1372
|
-
let l;
|
|
1373
|
-
h && (l = JSON.parse(await h.async("string")));
|
|
1374
|
-
const a = i.file("operations.json");
|
|
1375
|
-
if (!a)
|
|
1376
|
-
throw new Error("Operations history not found");
|
|
1377
|
-
const x = JSON.parse(
|
|
1378
|
-
await a.async("string")
|
|
1379
|
-
);
|
|
1380
|
-
let d = re(
|
|
1381
|
-
u,
|
|
1382
|
-
x,
|
|
1383
|
-
o,
|
|
1384
|
-
void 0,
|
|
1385
|
-
l
|
|
1386
|
-
);
|
|
1387
|
-
return l && (d = {
|
|
1388
|
-
...d,
|
|
1389
|
-
...l
|
|
1390
|
-
}), d;
|
|
1391
|
-
}
|
|
1392
|
-
function Qt(i) {
|
|
1393
|
-
const o = i.replace(/^.*\./, "") || void 0, p = i.replace(/^.*[/\\]/, "") || void 0;
|
|
1394
|
-
return { extension: o, fileName: p };
|
|
1395
|
-
}
|
|
1396
|
-
async function Rr(i) {
|
|
1397
|
-
const { buffer: o, mimeType: p = "application/octet-stream" } = await fr(), c = Qt(i), u = o.toString("base64");
|
|
1398
|
-
return {
|
|
1399
|
-
data: u,
|
|
1400
|
-
hash: G(u),
|
|
1401
|
-
mimeType: p,
|
|
1402
|
-
...c
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
async function Mr(i) {
|
|
1406
|
-
const o = await hr(), p = Je.getType(i) || "application/octet-stream", c = Qt(i), u = o.toString("base64");
|
|
1407
|
-
return { data: u, hash: G(u), mimeType: p, ...c };
|
|
1408
|
-
}
|
|
1409
|
-
function wr(i, o) {
|
|
1410
|
-
const p = i.revision[o.scope];
|
|
1411
|
-
return [M, C, $].includes(o.type) ? p : p + 1;
|
|
1412
|
-
}
|
|
1413
|
-
function yr(i, o) {
|
|
1414
|
-
return {
|
|
1415
|
-
...i,
|
|
1416
|
-
revision: {
|
|
1417
|
-
...i.revision,
|
|
1418
|
-
[o.scope]: wr(i, o)
|
|
1419
|
-
},
|
|
1420
|
-
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
1421
|
-
};
|
|
1422
|
-
}
|
|
1423
|
-
function vr(i, o, p = 0) {
|
|
1424
|
-
if ([M, C, $].includes(o.type))
|
|
1425
|
-
return i;
|
|
1426
|
-
const { scope: c } = o, u = i.operations[c].slice(
|
|
1427
|
-
0,
|
|
1428
|
-
i.revision[c]
|
|
1429
|
-
);
|
|
1430
|
-
return u.push({
|
|
1431
|
-
...o,
|
|
1432
|
-
index: u.length,
|
|
1433
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1434
|
-
hash: "",
|
|
1435
|
-
scope: c,
|
|
1436
|
-
skip: p
|
|
1437
|
-
}), {
|
|
1438
|
-
...i,
|
|
1439
|
-
operations: { ...i.operations, [c]: u }
|
|
1440
|
-
};
|
|
1441
|
-
}
|
|
1442
|
-
function br(i, o, p = 0) {
|
|
1443
|
-
let c = vr(i, o, p);
|
|
1444
|
-
return c = yr(c, o), c;
|
|
1445
|
-
}
|
|
1446
|
-
function Er(i, o, p) {
|
|
1447
|
-
switch (Rt().parse(o), o.type) {
|
|
1448
|
-
case Pt:
|
|
1449
|
-
return Ne(i, o.input);
|
|
1450
|
-
case $:
|
|
1451
|
-
return Ce(i, o, p);
|
|
1452
|
-
case Jt:
|
|
1453
|
-
return Le(i, o.input.state);
|
|
1454
|
-
default:
|
|
1455
|
-
return i;
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
function _r(i, o, p) {
|
|
1459
|
-
switch (o.type) {
|
|
1460
|
-
case M:
|
|
1461
|
-
return Re(i, o, p);
|
|
1462
|
-
case C:
|
|
1463
|
-
return Me(i, o, p);
|
|
1464
|
-
default:
|
|
1465
|
-
return { document: i, action: o, skip: p };
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
function te(i, o, p, c, u = {}) {
|
|
1469
|
-
const { skip: h, ignoreSkipOperations: l = !1 } = u;
|
|
1470
|
-
let a = { ...o }, x = h || 0, d = i, E = [...i.clipboard];
|
|
1471
|
-
if (Bt(a)) {
|
|
1472
|
-
const {
|
|
1473
|
-
skip: w,
|
|
1474
|
-
action: v,
|
|
1475
|
-
document: y
|
|
1476
|
-
} = _r(i, a, x);
|
|
1477
|
-
a = v, x = w, d = y, E = [...d.clipboard];
|
|
1478
|
-
}
|
|
1479
|
-
return kt(a) && (d = Er(d, a, p)), x > 0 && !l && (d = ot(
|
|
1480
|
-
d.initialState,
|
|
1481
|
-
d.operations,
|
|
1482
|
-
p,
|
|
1483
|
-
void 0,
|
|
1484
|
-
void 0,
|
|
1485
|
-
void 0,
|
|
1486
|
-
{ [a.scope]: x }
|
|
1487
|
-
)), d = br(d, a, x), d = Y(d, (w) => {
|
|
1488
|
-
const v = p(
|
|
1489
|
-
w.state,
|
|
1490
|
-
a,
|
|
1491
|
-
c
|
|
1492
|
-
), y = Bt(o) ? [...E] : [];
|
|
1493
|
-
if (v)
|
|
1494
|
-
return rt({
|
|
1495
|
-
...d,
|
|
1496
|
-
clipboard: [...y],
|
|
1497
|
-
state: v
|
|
1498
|
-
});
|
|
1499
|
-
w.clipboard = rt([...y]);
|
|
1500
|
-
}), Y(d, (w) => {
|
|
1501
|
-
if ([M, C, $].includes(a.type))
|
|
1502
|
-
return w;
|
|
1503
|
-
const v = a.scope || "global";
|
|
1504
|
-
w.operations[v][w.operations[v].length - 1].hash = ee(w, v), !kt(a) && a.attachments && a.attachments.forEach((y) => {
|
|
1505
|
-
const { hash: U, ...j } = y;
|
|
1506
|
-
w.attachments[U] = {
|
|
1507
|
-
...j
|
|
1508
|
-
};
|
|
1509
|
-
});
|
|
1510
|
-
});
|
|
1511
|
-
}
|
|
1512
|
-
function Bt(i) {
|
|
1392
|
+
function St(i) {
|
|
1513
1393
|
return [M, C].includes(i.type);
|
|
1514
1394
|
}
|
|
1515
|
-
function
|
|
1395
|
+
function Bt(i) {
|
|
1516
1396
|
return [Pt, M, C, $, Jt].includes(i.type);
|
|
1517
1397
|
}
|
|
1518
1398
|
function L(i, o, p, c, u = "global") {
|
|
@@ -1529,10 +1409,10 @@ function L(i, o, p, c, u = "global") {
|
|
|
1529
1409
|
}
|
|
1530
1410
|
return h;
|
|
1531
1411
|
}
|
|
1532
|
-
function
|
|
1412
|
+
function dr(i, o = Wt) {
|
|
1533
1413
|
return (p, c, u, h) => o(p, c, i, u, h);
|
|
1534
1414
|
}
|
|
1535
|
-
const
|
|
1415
|
+
const gr = (i, o) => ({
|
|
1536
1416
|
name: "",
|
|
1537
1417
|
documentType: "",
|
|
1538
1418
|
revision: {
|
|
@@ -1544,8 +1424,8 @@ const Ar = (i, o) => ({
|
|
|
1544
1424
|
attachments: {},
|
|
1545
1425
|
...i,
|
|
1546
1426
|
state: (o == null ? void 0 : o(i == null ? void 0 : i.state)) ?? (i == null ? void 0 : i.state) ?? { global: {}, local: {} }
|
|
1547
|
-
}),
|
|
1548
|
-
const p =
|
|
1427
|
+
}), wr = (i, o) => {
|
|
1428
|
+
const p = gr(
|
|
1549
1429
|
i,
|
|
1550
1430
|
o
|
|
1551
1431
|
);
|
|
@@ -1555,14 +1435,14 @@ const Ar = (i, o) => ({
|
|
|
1555
1435
|
operations: { global: [], local: [] },
|
|
1556
1436
|
clipboard: []
|
|
1557
1437
|
};
|
|
1558
|
-
},
|
|
1438
|
+
}, Qt = (i, o = "global") => X(je(i.state[o])), Nr = (i, o = 1e3) => {
|
|
1559
1439
|
const p = Math.random() * o;
|
|
1560
|
-
return
|
|
1440
|
+
return X(`${(i ?? /* @__PURE__ */ new Date()).toISOString()}${p}`);
|
|
1561
1441
|
};
|
|
1562
1442
|
function Z(i) {
|
|
1563
1443
|
return Be(ke(i, !0));
|
|
1564
1444
|
}
|
|
1565
|
-
function
|
|
1445
|
+
function yr(i, o) {
|
|
1566
1446
|
const p = [...i];
|
|
1567
1447
|
let c = o || 0, u = p.length > 0 ? p[p.length - 1].index : 0;
|
|
1568
1448
|
const h = [];
|
|
@@ -1585,19 +1465,19 @@ function Br(i, o) {
|
|
|
1585
1465
|
}
|
|
1586
1466
|
return h.reverse();
|
|
1587
1467
|
}
|
|
1588
|
-
function
|
|
1468
|
+
function Rr(i) {
|
|
1589
1469
|
return Object.values(i).flatMap((o) => o).sort(
|
|
1590
1470
|
(o, p) => new Date(o.timestamp).getTime() - new Date(p.timestamp).getTime()
|
|
1591
1471
|
);
|
|
1592
1472
|
}
|
|
1593
|
-
function
|
|
1473
|
+
function vr(i) {
|
|
1594
1474
|
return Object.values(i).flatMap((o) => o).sort(
|
|
1595
1475
|
(o, p) => new Date(o.operation.timestamp).getTime() - new Date(p.operation.timestamp).getTime()
|
|
1596
1476
|
);
|
|
1597
1477
|
}
|
|
1598
|
-
function ot(i, o, p, c, u, h =
|
|
1599
|
-
const a =
|
|
1600
|
-
return
|
|
1478
|
+
function ot(i, o, p, c, u, h = Wt, l = {}) {
|
|
1479
|
+
const a = dr(p, h);
|
|
1480
|
+
return te(
|
|
1601
1481
|
i,
|
|
1602
1482
|
o,
|
|
1603
1483
|
a,
|
|
@@ -1606,31 +1486,33 @@ function ot(i, o, p, c, u, h = te, l = {}) {
|
|
|
1606
1486
|
l
|
|
1607
1487
|
);
|
|
1608
1488
|
}
|
|
1609
|
-
function
|
|
1610
|
-
const l =
|
|
1489
|
+
function te(i, o, p, c, u, h = {}) {
|
|
1490
|
+
const l = wr(i), a = Object.keys(o).reduce((w, v) => {
|
|
1611
1491
|
const y = v;
|
|
1612
1492
|
return {
|
|
1613
1493
|
...w,
|
|
1614
1494
|
[y]: o[y].slice(0, u == null ? void 0 : u.revision[y])
|
|
1615
1495
|
};
|
|
1616
|
-
}, {}), x = Object.keys(a).reduce(
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
y,
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1496
|
+
}, {}), x = Object.keys(a).reduce(
|
|
1497
|
+
(w, v) => {
|
|
1498
|
+
const y = v;
|
|
1499
|
+
return {
|
|
1500
|
+
...w,
|
|
1501
|
+
[y]: yr(
|
|
1502
|
+
a[y],
|
|
1503
|
+
h[y]
|
|
1504
|
+
)
|
|
1505
|
+
};
|
|
1506
|
+
},
|
|
1507
|
+
{}
|
|
1508
|
+
), d = vr(x).reduce(
|
|
1509
|
+
(w, { ignore: v, operation: y }) => v ? p(w, mt(y.scope), c, {
|
|
1510
|
+
skip: y.skip,
|
|
1511
|
+
ignoreSkipOperations: !0
|
|
1512
|
+
}) : p(w, y, c, {
|
|
1513
|
+
skip: y.skip,
|
|
1514
|
+
ignoreSkipOperations: !0
|
|
1515
|
+
}),
|
|
1634
1516
|
l
|
|
1635
1517
|
), E = Object.keys(
|
|
1636
1518
|
d.operations
|
|
@@ -1655,25 +1537,25 @@ function re(i, o, p, c, u, h = {}) {
|
|
|
1655
1537
|
);
|
|
1656
1538
|
return { ...d, operations: E };
|
|
1657
1539
|
}
|
|
1658
|
-
const
|
|
1540
|
+
const ee = (i) => L(
|
|
1659
1541
|
"SET_NAME",
|
|
1660
1542
|
i,
|
|
1661
1543
|
void 0,
|
|
1662
1544
|
ct,
|
|
1663
1545
|
void 0
|
|
1664
|
-
),
|
|
1546
|
+
), re = (i = 1, o = "global") => L(
|
|
1665
1547
|
"UNDO",
|
|
1666
1548
|
i,
|
|
1667
1549
|
void 0,
|
|
1668
1550
|
lt,
|
|
1669
1551
|
o
|
|
1670
|
-
),
|
|
1552
|
+
), ie = (i = 1, o = "global") => L(
|
|
1671
1553
|
"REDO",
|
|
1672
1554
|
i,
|
|
1673
1555
|
void 0,
|
|
1674
1556
|
st,
|
|
1675
1557
|
o
|
|
1676
|
-
),
|
|
1558
|
+
), ne = (i, o, p = "global") => L(
|
|
1677
1559
|
"PRUNE",
|
|
1678
1560
|
{ start: i, end: o },
|
|
1679
1561
|
void 0,
|
|
@@ -1684,21 +1566,135 @@ const ie = (i) => L(
|
|
|
1684
1566
|
{ state: i, operations: o },
|
|
1685
1567
|
void 0,
|
|
1686
1568
|
at
|
|
1687
|
-
), mt = (i = "global") => L(
|
|
1688
|
-
"NOOP",
|
|
1689
|
-
{},
|
|
1690
|
-
void 0,
|
|
1691
|
-
void 0,
|
|
1692
|
-
i
|
|
1693
|
-
), zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1569
|
+
), mt = (i = "global") => L("NOOP", {}, void 0, void 0, i), Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1694
1570
|
__proto__: null,
|
|
1695
1571
|
loadState: ht,
|
|
1696
1572
|
noop: mt,
|
|
1697
|
-
prune:
|
|
1698
|
-
redo:
|
|
1699
|
-
setName:
|
|
1700
|
-
undo:
|
|
1573
|
+
prune: ne,
|
|
1574
|
+
redo: ie,
|
|
1575
|
+
setName: ee,
|
|
1576
|
+
undo: re
|
|
1701
1577
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1578
|
+
function G() {
|
|
1579
|
+
this._types = /* @__PURE__ */ Object.create(null), this._extensions = /* @__PURE__ */ Object.create(null);
|
|
1580
|
+
for (let i = 0; i < arguments.length; i++)
|
|
1581
|
+
this.define(arguments[i]);
|
|
1582
|
+
this.define = this.define.bind(this), this.getType = this.getType.bind(this), this.getExtension = this.getExtension.bind(this);
|
|
1583
|
+
}
|
|
1584
|
+
G.prototype.define = function(i, o) {
|
|
1585
|
+
for (let p in i) {
|
|
1586
|
+
let c = i[p].map(function(u) {
|
|
1587
|
+
return u.toLowerCase();
|
|
1588
|
+
});
|
|
1589
|
+
p = p.toLowerCase();
|
|
1590
|
+
for (let u = 0; u < c.length; u++) {
|
|
1591
|
+
const h = c[u];
|
|
1592
|
+
if (h[0] !== "*") {
|
|
1593
|
+
if (!o && h in this._types)
|
|
1594
|
+
throw new Error(
|
|
1595
|
+
'Attempt to change mapping for "' + h + '" extension from "' + this._types[h] + '" to "' + p + '". Pass `force=true` to allow this, otherwise remove "' + h + '" from the list of extensions for "' + p + '".'
|
|
1596
|
+
);
|
|
1597
|
+
this._types[h] = p;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
if (o || !this._extensions[p]) {
|
|
1601
|
+
const u = c[0];
|
|
1602
|
+
this._extensions[p] = u[0] !== "*" ? u : u.substr(1);
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
G.prototype.getType = function(i) {
|
|
1607
|
+
i = String(i);
|
|
1608
|
+
let o = i.replace(/^.*[/\\]/, "").toLowerCase(), p = o.replace(/^.*\./, "").toLowerCase(), c = o.length < i.length;
|
|
1609
|
+
return (p.length < o.length - 1 || !c) && this._types[p] || null;
|
|
1610
|
+
};
|
|
1611
|
+
G.prototype.getExtension = function(i) {
|
|
1612
|
+
return i = /^\s*([^;\s]*)/.test(i) && RegExp.$1, i && this._extensions[i.toLowerCase()] || null;
|
|
1613
|
+
};
|
|
1614
|
+
var br = G, Er = { "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"] };
|
|
1615
|
+
let _r = br;
|
|
1616
|
+
var Fr = new _r(Er);
|
|
1617
|
+
const Ar = /* @__PURE__ */ Ht(Fr), oe = async (i) => {
|
|
1618
|
+
const o = new jt(), { name: p, revision: c, documentType: u, created: h, lastModified: l } = i, a = {
|
|
1619
|
+
name: p,
|
|
1620
|
+
revision: c,
|
|
1621
|
+
documentType: u,
|
|
1622
|
+
created: h,
|
|
1623
|
+
lastModified: l
|
|
1624
|
+
};
|
|
1625
|
+
return o.file("header.json", JSON.stringify(a, null, 2)), o.file(
|
|
1626
|
+
"state.json",
|
|
1627
|
+
JSON.stringify(i.initialState || {}, null, 2)
|
|
1628
|
+
), o.file("operations.json", JSON.stringify(i.operations, null, 2)), Object.keys(i.attachments).forEach((d) => {
|
|
1629
|
+
const { data: E, ...w } = i.attachments[d];
|
|
1630
|
+
o.file(d, E, {
|
|
1631
|
+
base64: !0,
|
|
1632
|
+
createFolders: !0,
|
|
1633
|
+
comment: JSON.stringify(w)
|
|
1634
|
+
});
|
|
1635
|
+
}), o;
|
|
1636
|
+
}, Sr = async (i, o, p, c) => {
|
|
1637
|
+
await (await oe(i)).generateAsync({
|
|
1638
|
+
type: "uint8array",
|
|
1639
|
+
streamFiles: !0
|
|
1640
|
+
});
|
|
1641
|
+
const h = c ?? i.name, l = `.${p}.zip`;
|
|
1642
|
+
return fr(
|
|
1643
|
+
o,
|
|
1644
|
+
h.endsWith(l) ? h : `${h}${l}`
|
|
1645
|
+
);
|
|
1646
|
+
}, Cr = async (i, o) => {
|
|
1647
|
+
const c = await (await oe(i)).generateAsync({ type: "blob" }), u = await o.createWritable();
|
|
1648
|
+
await u.write(c), await u.close();
|
|
1649
|
+
}, kt = async (i, o) => {
|
|
1650
|
+
const p = Gt();
|
|
1651
|
+
return Br(p, o);
|
|
1652
|
+
}, Br = async (i, o) => {
|
|
1653
|
+
const p = new jt();
|
|
1654
|
+
return await p.loadAsync(i), kr(p, o);
|
|
1655
|
+
};
|
|
1656
|
+
async function kr(i, o) {
|
|
1657
|
+
const p = i.file("state.json");
|
|
1658
|
+
if (!p)
|
|
1659
|
+
throw new Error("Initial state not found");
|
|
1660
|
+
const c = await p.async("string"), u = JSON.parse(c), h = i.file("header.json");
|
|
1661
|
+
let l;
|
|
1662
|
+
h && (l = JSON.parse(await h.async("string")));
|
|
1663
|
+
const a = i.file("operations.json");
|
|
1664
|
+
if (!a)
|
|
1665
|
+
throw new Error("Operations history not found");
|
|
1666
|
+
const x = JSON.parse(
|
|
1667
|
+
await a.async("string")
|
|
1668
|
+
);
|
|
1669
|
+
let d = te(
|
|
1670
|
+
u,
|
|
1671
|
+
x,
|
|
1672
|
+
o,
|
|
1673
|
+
void 0,
|
|
1674
|
+
l
|
|
1675
|
+
);
|
|
1676
|
+
return l && (d = {
|
|
1677
|
+
...d,
|
|
1678
|
+
...l
|
|
1679
|
+
}), d;
|
|
1680
|
+
}
|
|
1681
|
+
function ae(i) {
|
|
1682
|
+
const o = i.replace(/^.*\./, "") || void 0, p = i.replace(/^.*[/\\]/, "") || void 0;
|
|
1683
|
+
return { extension: o, fileName: p };
|
|
1684
|
+
}
|
|
1685
|
+
async function Lr(i) {
|
|
1686
|
+
const { buffer: o, mimeType: p = "application/octet-stream" } = await hr(), c = ae(i), u = o.toString("base64");
|
|
1687
|
+
return {
|
|
1688
|
+
data: u,
|
|
1689
|
+
hash: X(u),
|
|
1690
|
+
mimeType: p,
|
|
1691
|
+
...c
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
async function zr(i) {
|
|
1695
|
+
const o = await mr(), p = Ar.getType(i) || "application/octet-stream", c = ae(i), u = o.toString("base64");
|
|
1696
|
+
return { data: u, hash: X(u), mimeType: p, ...c };
|
|
1697
|
+
}
|
|
1702
1698
|
class qr {
|
|
1703
1699
|
/**
|
|
1704
1700
|
* Constructs a BaseDocument instance with an initial state.
|
|
@@ -1731,14 +1727,14 @@ class qr {
|
|
|
1731
1727
|
* @returns The file path where the state was saved.
|
|
1732
1728
|
*/
|
|
1733
1729
|
saveToFile(o, p, c) {
|
|
1734
|
-
return
|
|
1730
|
+
return Sr(this._document, o, p, c);
|
|
1735
1731
|
}
|
|
1736
1732
|
/**
|
|
1737
1733
|
* Loads the state of the document from a file.
|
|
1738
1734
|
* @param path - The file path where the state is stored.
|
|
1739
1735
|
*/
|
|
1740
1736
|
async loadFromFile(o) {
|
|
1741
|
-
this._document = await
|
|
1737
|
+
this._document = await kt(o, this._reducer);
|
|
1742
1738
|
}
|
|
1743
1739
|
/**
|
|
1744
1740
|
* Loads the state of the document from a file and returns it.
|
|
@@ -1747,7 +1743,7 @@ class qr {
|
|
|
1747
1743
|
* @returns The state of the document.
|
|
1748
1744
|
*/
|
|
1749
1745
|
static async stateFromFile(o, p) {
|
|
1750
|
-
return await
|
|
1746
|
+
return await kt(o, p);
|
|
1751
1747
|
}
|
|
1752
1748
|
/**
|
|
1753
1749
|
* Gets the current state of the document.
|
|
@@ -1818,21 +1814,21 @@ class qr {
|
|
|
1818
1814
|
* @param name - The new name of the document.
|
|
1819
1815
|
*/
|
|
1820
1816
|
setName(o) {
|
|
1821
|
-
return this.dispatch(
|
|
1817
|
+
return this.dispatch(ee(o)), this;
|
|
1822
1818
|
}
|
|
1823
1819
|
/**
|
|
1824
1820
|
* Reverts a number of actions from the document.
|
|
1825
1821
|
* @param count - The number of actions to revert.
|
|
1826
1822
|
*/
|
|
1827
1823
|
undo(o) {
|
|
1828
|
-
return this.dispatch(
|
|
1824
|
+
return this.dispatch(re(o)), this;
|
|
1829
1825
|
}
|
|
1830
1826
|
/**
|
|
1831
1827
|
* Reapplies a number of actions to the document.
|
|
1832
1828
|
* @param count - The number of actions to reapply.
|
|
1833
1829
|
*/
|
|
1834
1830
|
redo(o) {
|
|
1835
|
-
return this.dispatch(
|
|
1831
|
+
return this.dispatch(ie(o)), this;
|
|
1836
1832
|
}
|
|
1837
1833
|
/**
|
|
1838
1834
|
* Removes a range of operations from the document.
|
|
@@ -1840,7 +1836,7 @@ class qr {
|
|
|
1840
1836
|
* @param end - The ending index of the range to remove.
|
|
1841
1837
|
*/
|
|
1842
1838
|
prune(o, p) {
|
|
1843
|
-
return this.dispatch(
|
|
1839
|
+
return this.dispatch(ne(o, p)), this;
|
|
1844
1840
|
}
|
|
1845
1841
|
/**
|
|
1846
1842
|
* Loads a document state and a set of operations.
|
|
@@ -1866,30 +1862,30 @@ function $r(i, o) {
|
|
|
1866
1862
|
}
|
|
1867
1863
|
export {
|
|
1868
1864
|
qr as B,
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1865
|
+
gr as a,
|
|
1866
|
+
wr as b,
|
|
1867
|
+
dr as c,
|
|
1868
|
+
Cr as d,
|
|
1869
|
+
Br as e,
|
|
1874
1870
|
L as f,
|
|
1875
1871
|
$r as g,
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1872
|
+
Mr as h,
|
|
1873
|
+
Bt as i,
|
|
1874
|
+
oe as j,
|
|
1875
|
+
zr as k,
|
|
1876
|
+
kt as l,
|
|
1877
|
+
Lr as m,
|
|
1878
|
+
Qt as n,
|
|
1879
|
+
Nr as o,
|
|
1880
|
+
St as p,
|
|
1881
|
+
yr as q,
|
|
1886
1882
|
Z as r,
|
|
1887
|
-
|
|
1888
|
-
|
|
1883
|
+
Sr as s,
|
|
1884
|
+
te as t,
|
|
1889
1885
|
ot as u,
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1886
|
+
vr as v,
|
|
1887
|
+
Rr as w,
|
|
1888
|
+
Wt as x,
|
|
1889
|
+
We as y,
|
|
1894
1890
|
Dr as z
|
|
1895
1891
|
};
|