document-model 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/cjs/document-model.js +2 -2
- package/dist/browser/cjs/document.js +2 -2
- package/dist/browser/cjs/index.js +2 -2
- package/dist/browser/cjs/internal/{index-BImZF-Wk.js → index-BllCzBc9.js} +11 -3
- package/dist/browser/cjs/internal/index-BllCzBc9.js.map +1 -0
- package/dist/browser/cjs/internal/{index-vlbA6Asd.js → index-DTRXQ2Nf.js} +5 -10
- package/dist/browser/{es/internal/index-CuhiYn-8.js.map → cjs/internal/index-DTRXQ2Nf.js.map} +1 -1
- package/dist/browser/cjs/internal/{object-9Wvjprnm.js → object-Bf9_woMQ.js} +302 -320
- package/dist/browser/cjs/internal/object-Bf9_woMQ.js.map +1 -0
- package/dist/browser/es/document-model.js +2 -2
- package/dist/browser/es/document.js +8 -8
- package/dist/browser/es/index.js +2 -2
- package/dist/browser/es/internal/{index-CuhiYn-8.js → index-BAvDobTr.js} +5 -10
- package/dist/{node/es/internal/index-BNAE-_Hg.js.map → browser/es/internal/index-BAvDobTr.js.map} +1 -1
- package/dist/browser/es/internal/index-Db40bdYP.js +58 -0
- package/dist/browser/es/internal/index-Db40bdYP.js.map +1 -0
- package/dist/browser/es/internal/{object-CyAog_F_.js → object-CY74acQg.js} +327 -345
- package/dist/browser/es/internal/object-CY74acQg.js.map +1 -0
- package/dist/browser/src/document/actions/creators.d.ts +1 -1
- package/dist/browser/src/document/schema/zod.d.ts +18 -18
- package/dist/browser/src/document/types.d.ts +12 -1
- package/dist/browser/src/document/utils/base.d.ts +1 -1
- package/dist/browser/src/document/utils/crypto.d.ts +10 -0
- package/dist/browser/src/document/utils/index.d.ts +1 -0
- package/dist/browser/src/document/utils/node.d.ts +3 -2
- package/dist/browser/src/document-model/gen/schema/zod.d.ts +177 -177
- package/dist/browser/src/document-model/index.d.ts +3 -3
- package/dist/node/cjs/document-model.js +2 -2
- package/dist/node/cjs/document.js +2 -2
- package/dist/node/cjs/index.js +2 -2
- package/dist/node/cjs/internal/{index-DWeC8dwW.js → index-aABa-Hb0.js} +5 -10
- package/dist/node/cjs/internal/{index-DWeC8dwW.js.map → index-aABa-Hb0.js.map} +1 -1
- package/dist/node/cjs/internal/{index-CJIU8iX-.js → index-kI4cPPpE.js} +11 -3
- package/dist/node/cjs/internal/index-kI4cPPpE.js.map +1 -0
- package/dist/node/cjs/internal/{object-op6YzhH1.js → object-BMm0OLWL.js} +148 -59
- package/dist/node/cjs/internal/object-BMm0OLWL.js.map +1 -0
- package/dist/node/es/document-model.js +2 -2
- package/dist/node/es/document.js +8 -8
- package/dist/node/es/index.js +2 -2
- package/dist/node/es/internal/{index-BNAE-_Hg.js → index-B0WPutmO.js} +5 -10
- package/dist/{browser/cjs/internal/index-vlbA6Asd.js.map → node/es/internal/index-B0WPutmO.js.map} +1 -1
- package/dist/node/es/internal/index-MkEgGMJR.js +58 -0
- package/dist/node/es/internal/index-MkEgGMJR.js.map +1 -0
- package/dist/node/es/internal/{object-BuK9PFjs.js → object-VZ_AS47_.js} +173 -84
- package/dist/node/es/internal/object-VZ_AS47_.js.map +1 -0
- package/dist/node/src/document/actions/creators.d.ts +1 -1
- package/dist/node/src/document/schema/zod.d.ts +18 -18
- package/dist/node/src/document/types.d.ts +12 -1
- package/dist/node/src/document/utils/base.d.ts +1 -1
- package/dist/node/src/document/utils/crypto.d.ts +10 -0
- package/dist/node/src/document/utils/index.d.ts +1 -0
- package/dist/node/src/document/utils/node.d.ts +3 -2
- package/dist/node/src/document-model/gen/schema/zod.d.ts +177 -177
- package/dist/node/src/document-model/index.d.ts +3 -3
- package/package.json +2 -1
- package/dist/browser/cjs/internal/index-BImZF-Wk.js.map +0 -1
- package/dist/browser/cjs/internal/object-9Wvjprnm.js.map +0 -1
- package/dist/browser/es/internal/index-Drp90r05.js +0 -50
- package/dist/browser/es/internal/index-Drp90r05.js.map +0 -1
- package/dist/browser/es/internal/object-CyAog_F_.js.map +0 -1
- package/dist/node/cjs/internal/index-CJIU8iX-.js.map +0 -1
- package/dist/node/cjs/internal/object-op6YzhH1.js.map +0 -1
- package/dist/node/es/internal/index-B_7z_4EV.js +0 -50
- package/dist/node/es/internal/index-B_7z_4EV.js.map +0 -1
- package/dist/node/es/internal/object-BuK9PFjs.js.map +0 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import { create, castDraft, unsafe } from "mutative";
|
|
8
5
|
import { z } from "zod";
|
|
9
6
|
import JSZip from "jszip";
|
|
@@ -270,8 +267,7 @@ var safeStableStringify = { exports: {} };
|
|
|
270
267
|
if (value) {
|
|
271
268
|
return (value2) => {
|
|
272
269
|
let message = `Object can not safely be stringified. Received type ${typeof value2}`;
|
|
273
|
-
if (typeof value2 !== "function")
|
|
274
|
-
message += ` (${value2.toString()})`;
|
|
270
|
+
if (typeof value2 !== "function") message += ` (${value2.toString()})`;
|
|
275
271
|
throw new Error(message);
|
|
276
272
|
};
|
|
277
273
|
}
|
|
@@ -920,95 +916,6 @@ const REDO = "REDO";
|
|
|
920
916
|
const PRUNE = "PRUNE";
|
|
921
917
|
const LOAD_STATE = "LOAD_STATE";
|
|
922
918
|
const NOOP = "NOOP";
|
|
923
|
-
const types = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
924
|
-
Object.freeze(types);
|
|
925
|
-
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
926
|
-
if (kind === "a" && !f)
|
|
927
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
928
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
929
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
930
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
931
|
-
};
|
|
932
|
-
var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
|
|
933
|
-
class Mime {
|
|
934
|
-
constructor(...args) {
|
|
935
|
-
_Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
|
|
936
|
-
_Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
|
|
937
|
-
_Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
|
|
938
|
-
for (const arg of args) {
|
|
939
|
-
this.define(arg);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
define(typeMap, force = false) {
|
|
943
|
-
for (let [type, extensions] of Object.entries(typeMap)) {
|
|
944
|
-
type = type.toLowerCase();
|
|
945
|
-
extensions = extensions.map((ext) => ext.toLowerCase());
|
|
946
|
-
if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) {
|
|
947
|
-
__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
|
|
948
|
-
}
|
|
949
|
-
const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
|
|
950
|
-
let first = true;
|
|
951
|
-
for (let extension of extensions) {
|
|
952
|
-
const starred = extension.startsWith("*");
|
|
953
|
-
extension = starred ? extension.slice(1) : extension;
|
|
954
|
-
allExtensions == null ? void 0 : allExtensions.add(extension);
|
|
955
|
-
if (first) {
|
|
956
|
-
__classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension);
|
|
957
|
-
}
|
|
958
|
-
first = false;
|
|
959
|
-
if (starred)
|
|
960
|
-
continue;
|
|
961
|
-
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension);
|
|
962
|
-
if (currentType && currentType != type && !force) {
|
|
963
|
-
throw new Error(`"${type} -> ${extension}" conflicts with "${currentType} -> ${extension}". Pass \`force=true\` to override this definition.`);
|
|
964
|
-
}
|
|
965
|
-
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension, type);
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
return this;
|
|
969
|
-
}
|
|
970
|
-
getType(path) {
|
|
971
|
-
if (typeof path !== "string")
|
|
972
|
-
return null;
|
|
973
|
-
const last = path.replace(/^.*[/\\]/, "").toLowerCase();
|
|
974
|
-
const ext = last.replace(/^.*\./, "").toLowerCase();
|
|
975
|
-
const hasPath = last.length < path.length;
|
|
976
|
-
const hasDot = ext.length < last.length - 1;
|
|
977
|
-
if (!hasDot && hasPath)
|
|
978
|
-
return null;
|
|
979
|
-
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
980
|
-
}
|
|
981
|
-
getExtension(type) {
|
|
982
|
-
var _a;
|
|
983
|
-
if (typeof type !== "string")
|
|
984
|
-
return null;
|
|
985
|
-
type = (_a = type == null ? void 0 : type.split) == null ? void 0 : _a.call(type, ";")[0];
|
|
986
|
-
return (type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null;
|
|
987
|
-
}
|
|
988
|
-
getAllExtensions(type) {
|
|
989
|
-
if (typeof type !== "string")
|
|
990
|
-
return null;
|
|
991
|
-
return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
|
|
992
|
-
}
|
|
993
|
-
_freeze() {
|
|
994
|
-
this.define = () => {
|
|
995
|
-
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
996
|
-
};
|
|
997
|
-
Object.freeze(this);
|
|
998
|
-
for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
|
|
999
|
-
Object.freeze(extensions);
|
|
1000
|
-
}
|
|
1001
|
-
return this;
|
|
1002
|
-
}
|
|
1003
|
-
_getTestState() {
|
|
1004
|
-
return {
|
|
1005
|
-
types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
|
|
1006
|
-
extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f")
|
|
1007
|
-
};
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
_Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
|
|
1011
|
-
const mime = new Mime(types)._freeze();
|
|
1012
919
|
var inherits_browser = { exports: {} };
|
|
1013
920
|
if (typeof Object.create === "function") {
|
|
1014
921
|
inherits_browser.exports = function inherits2(ctor, superCtor) {
|
|
@@ -1059,8 +966,7 @@ function getLens(b64) {
|
|
|
1059
966
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
1060
967
|
}
|
|
1061
968
|
var validLen = b64.indexOf("=");
|
|
1062
|
-
if (validLen === -1)
|
|
1063
|
-
validLen = len;
|
|
969
|
+
if (validLen === -1) validLen = len;
|
|
1064
970
|
var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
|
|
1065
971
|
return [validLen, placeHoldersLen];
|
|
1066
972
|
}
|
|
@@ -1249,16 +1155,14 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1249
1155
|
Object.defineProperty(Buffer3.prototype, "parent", {
|
|
1250
1156
|
enumerable: true,
|
|
1251
1157
|
get: function() {
|
|
1252
|
-
if (!Buffer3.isBuffer(this))
|
|
1253
|
-
return void 0;
|
|
1158
|
+
if (!Buffer3.isBuffer(this)) return void 0;
|
|
1254
1159
|
return this.buffer;
|
|
1255
1160
|
}
|
|
1256
1161
|
});
|
|
1257
1162
|
Object.defineProperty(Buffer3.prototype, "offset", {
|
|
1258
1163
|
enumerable: true,
|
|
1259
1164
|
get: function() {
|
|
1260
|
-
if (!Buffer3.isBuffer(this))
|
|
1261
|
-
return void 0;
|
|
1165
|
+
if (!Buffer3.isBuffer(this)) return void 0;
|
|
1262
1166
|
return this.byteOffset;
|
|
1263
1167
|
}
|
|
1264
1168
|
});
|
|
@@ -1310,8 +1214,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1310
1214
|
return Buffer3.from(valueOf, encodingOrOffset, length);
|
|
1311
1215
|
}
|
|
1312
1216
|
var b = fromObject(value);
|
|
1313
|
-
if (b)
|
|
1314
|
-
return b;
|
|
1217
|
+
if (b) return b;
|
|
1315
1218
|
if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
|
|
1316
1219
|
return Buffer3.from(
|
|
1317
1220
|
value[Symbol.toPrimitive]("string"),
|
|
@@ -1442,17 +1345,14 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1442
1345
|
return b != null && b._isBuffer === true && b !== Buffer3.prototype;
|
|
1443
1346
|
};
|
|
1444
1347
|
Buffer3.compare = function compare(a, b) {
|
|
1445
|
-
if (isInstance(a, Uint8Array))
|
|
1446
|
-
|
|
1447
|
-
if (isInstance(b, Uint8Array))
|
|
1448
|
-
b = Buffer3.from(b, b.offset, b.byteLength);
|
|
1348
|
+
if (isInstance(a, Uint8Array)) a = Buffer3.from(a, a.offset, a.byteLength);
|
|
1349
|
+
if (isInstance(b, Uint8Array)) b = Buffer3.from(b, b.offset, b.byteLength);
|
|
1449
1350
|
if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {
|
|
1450
1351
|
throw new TypeError(
|
|
1451
1352
|
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
1452
1353
|
);
|
|
1453
1354
|
}
|
|
1454
|
-
if (a === b)
|
|
1455
|
-
return 0;
|
|
1355
|
+
if (a === b) return 0;
|
|
1456
1356
|
var x = a.length;
|
|
1457
1357
|
var y = b.length;
|
|
1458
1358
|
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
|
|
@@ -1462,10 +1362,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1462
1362
|
break;
|
|
1463
1363
|
}
|
|
1464
1364
|
}
|
|
1465
|
-
if (x < y)
|
|
1466
|
-
|
|
1467
|
-
if (y < x)
|
|
1468
|
-
return 1;
|
|
1365
|
+
if (x < y) return -1;
|
|
1366
|
+
if (y < x) return 1;
|
|
1469
1367
|
return 0;
|
|
1470
1368
|
};
|
|
1471
1369
|
Buffer3.isEncoding = function isEncoding(encoding) {
|
|
@@ -1537,8 +1435,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1537
1435
|
}
|
|
1538
1436
|
var len = string.length;
|
|
1539
1437
|
var mustMatch = arguments.length > 2 && arguments[2] === true;
|
|
1540
|
-
if (!mustMatch && len === 0)
|
|
1541
|
-
return 0;
|
|
1438
|
+
if (!mustMatch && len === 0) return 0;
|
|
1542
1439
|
var loweredCase = false;
|
|
1543
1440
|
for (; ; ) {
|
|
1544
1441
|
switch (encoding) {
|
|
@@ -1587,8 +1484,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1587
1484
|
if (end <= start) {
|
|
1588
1485
|
return "";
|
|
1589
1486
|
}
|
|
1590
|
-
if (!encoding)
|
|
1591
|
-
encoding = "utf8";
|
|
1487
|
+
if (!encoding) encoding = "utf8";
|
|
1592
1488
|
while (true) {
|
|
1593
1489
|
switch (encoding) {
|
|
1594
1490
|
case "hex":
|
|
@@ -1609,8 +1505,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1609
1505
|
case "utf-16le":
|
|
1610
1506
|
return utf16leSlice(this, start, end);
|
|
1611
1507
|
default:
|
|
1612
|
-
if (loweredCase)
|
|
1613
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1508
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1614
1509
|
encoding = (encoding + "").toLowerCase();
|
|
1615
1510
|
loweredCase = true;
|
|
1616
1511
|
}
|
|
@@ -1658,26 +1553,21 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1658
1553
|
};
|
|
1659
1554
|
Buffer3.prototype.toString = function toString() {
|
|
1660
1555
|
var length = this.length;
|
|
1661
|
-
if (length === 0)
|
|
1662
|
-
|
|
1663
|
-
if (arguments.length === 0)
|
|
1664
|
-
return utf8Slice(this, 0, length);
|
|
1556
|
+
if (length === 0) return "";
|
|
1557
|
+
if (arguments.length === 0) return utf8Slice(this, 0, length);
|
|
1665
1558
|
return slowToString.apply(this, arguments);
|
|
1666
1559
|
};
|
|
1667
1560
|
Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
|
|
1668
1561
|
Buffer3.prototype.equals = function equals(b) {
|
|
1669
|
-
if (!Buffer3.isBuffer(b))
|
|
1670
|
-
|
|
1671
|
-
if (this === b)
|
|
1672
|
-
return true;
|
|
1562
|
+
if (!Buffer3.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
|
|
1563
|
+
if (this === b) return true;
|
|
1673
1564
|
return Buffer3.compare(this, b) === 0;
|
|
1674
1565
|
};
|
|
1675
1566
|
Buffer3.prototype.inspect = function inspect() {
|
|
1676
1567
|
var str = "";
|
|
1677
1568
|
var max = exports.INSPECT_MAX_BYTES;
|
|
1678
1569
|
str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
|
|
1679
|
-
if (this.length > max)
|
|
1680
|
-
str += " ... ";
|
|
1570
|
+
if (this.length > max) str += " ... ";
|
|
1681
1571
|
return "<Buffer " + str + ">";
|
|
1682
1572
|
};
|
|
1683
1573
|
if (customInspectSymbol) {
|
|
@@ -1720,8 +1610,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1720
1610
|
end >>>= 0;
|
|
1721
1611
|
thisStart >>>= 0;
|
|
1722
1612
|
thisEnd >>>= 0;
|
|
1723
|
-
if (this === target)
|
|
1724
|
-
return 0;
|
|
1613
|
+
if (this === target) return 0;
|
|
1725
1614
|
var x = thisEnd - thisStart;
|
|
1726
1615
|
var y = end - start;
|
|
1727
1616
|
var len = Math.min(x, y);
|
|
@@ -1734,15 +1623,12 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1734
1623
|
break;
|
|
1735
1624
|
}
|
|
1736
1625
|
}
|
|
1737
|
-
if (x < y)
|
|
1738
|
-
|
|
1739
|
-
if (y < x)
|
|
1740
|
-
return 1;
|
|
1626
|
+
if (x < y) return -1;
|
|
1627
|
+
if (y < x) return 1;
|
|
1741
1628
|
return 0;
|
|
1742
1629
|
};
|
|
1743
1630
|
function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) {
|
|
1744
|
-
if (buffer2.length === 0)
|
|
1745
|
-
return -1;
|
|
1631
|
+
if (buffer2.length === 0) return -1;
|
|
1746
1632
|
if (typeof byteOffset === "string") {
|
|
1747
1633
|
encoding = byteOffset;
|
|
1748
1634
|
byteOffset = 0;
|
|
@@ -1755,18 +1641,13 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1755
1641
|
if (numberIsNaN(byteOffset)) {
|
|
1756
1642
|
byteOffset = dir ? 0 : buffer2.length - 1;
|
|
1757
1643
|
}
|
|
1758
|
-
if (byteOffset < 0)
|
|
1759
|
-
byteOffset = buffer2.length + byteOffset;
|
|
1644
|
+
if (byteOffset < 0) byteOffset = buffer2.length + byteOffset;
|
|
1760
1645
|
if (byteOffset >= buffer2.length) {
|
|
1761
|
-
if (dir)
|
|
1762
|
-
|
|
1763
|
-
else
|
|
1764
|
-
byteOffset = buffer2.length - 1;
|
|
1646
|
+
if (dir) return -1;
|
|
1647
|
+
else byteOffset = buffer2.length - 1;
|
|
1765
1648
|
} else if (byteOffset < 0) {
|
|
1766
|
-
if (dir)
|
|
1767
|
-
|
|
1768
|
-
else
|
|
1769
|
-
return -1;
|
|
1649
|
+
if (dir) byteOffset = 0;
|
|
1650
|
+
else return -1;
|
|
1770
1651
|
}
|
|
1771
1652
|
if (typeof val === "string") {
|
|
1772
1653
|
val = Buffer3.from(val, encoding);
|
|
@@ -1817,19 +1698,15 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1817
1698
|
var foundIndex = -1;
|
|
1818
1699
|
for (i = byteOffset; i < arrLength; i++) {
|
|
1819
1700
|
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
|
1820
|
-
if (foundIndex === -1)
|
|
1821
|
-
|
|
1822
|
-
if (i - foundIndex + 1 === valLength)
|
|
1823
|
-
return foundIndex * indexSize;
|
|
1701
|
+
if (foundIndex === -1) foundIndex = i;
|
|
1702
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
|
1824
1703
|
} else {
|
|
1825
|
-
if (foundIndex !== -1)
|
|
1826
|
-
i -= i - foundIndex;
|
|
1704
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
1827
1705
|
foundIndex = -1;
|
|
1828
1706
|
}
|
|
1829
1707
|
}
|
|
1830
1708
|
} else {
|
|
1831
|
-
if (byteOffset + valLength > arrLength)
|
|
1832
|
-
byteOffset = arrLength - valLength;
|
|
1709
|
+
if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
|
|
1833
1710
|
for (i = byteOffset; i >= 0; i--) {
|
|
1834
1711
|
var found = true;
|
|
1835
1712
|
for (var j = 0; j < valLength; j++) {
|
|
@@ -1838,8 +1715,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1838
1715
|
break;
|
|
1839
1716
|
}
|
|
1840
1717
|
}
|
|
1841
|
-
if (found)
|
|
1842
|
-
return i;
|
|
1718
|
+
if (found) return i;
|
|
1843
1719
|
}
|
|
1844
1720
|
}
|
|
1845
1721
|
return -1;
|
|
@@ -1870,8 +1746,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1870
1746
|
}
|
|
1871
1747
|
for (var i = 0; i < length; ++i) {
|
|
1872
1748
|
var parsed = parseInt(string.substr(i * 2, 2), 16);
|
|
1873
|
-
if (numberIsNaN(parsed))
|
|
1874
|
-
return i;
|
|
1749
|
+
if (numberIsNaN(parsed)) return i;
|
|
1875
1750
|
buf[offset + i] = parsed;
|
|
1876
1751
|
}
|
|
1877
1752
|
return i;
|
|
@@ -1901,8 +1776,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1901
1776
|
offset = offset >>> 0;
|
|
1902
1777
|
if (isFinite(length)) {
|
|
1903
1778
|
length = length >>> 0;
|
|
1904
|
-
if (encoding === void 0)
|
|
1905
|
-
encoding = "utf8";
|
|
1779
|
+
if (encoding === void 0) encoding = "utf8";
|
|
1906
1780
|
} else {
|
|
1907
1781
|
encoding = length;
|
|
1908
1782
|
length = void 0;
|
|
@@ -1913,13 +1787,11 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1913
1787
|
);
|
|
1914
1788
|
}
|
|
1915
1789
|
var remaining = this.length - offset;
|
|
1916
|
-
if (length === void 0 || length > remaining)
|
|
1917
|
-
length = remaining;
|
|
1790
|
+
if (length === void 0 || length > remaining) length = remaining;
|
|
1918
1791
|
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
|
|
1919
1792
|
throw new RangeError("Attempt to write outside buffer bounds");
|
|
1920
1793
|
}
|
|
1921
|
-
if (!encoding)
|
|
1922
|
-
encoding = "utf8";
|
|
1794
|
+
if (!encoding) encoding = "utf8";
|
|
1923
1795
|
var loweredCase = false;
|
|
1924
1796
|
for (; ; ) {
|
|
1925
1797
|
switch (encoding) {
|
|
@@ -1940,8 +1812,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
1940
1812
|
case "utf-16le":
|
|
1941
1813
|
return ucs2Write(this, string, offset, length);
|
|
1942
1814
|
default:
|
|
1943
|
-
if (loweredCase)
|
|
1944
|
-
throw new TypeError("Unknown encoding: " + encoding);
|
|
1815
|
+
if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
|
|
1945
1816
|
encoding = ("" + encoding).toLowerCase();
|
|
1946
1817
|
loweredCase = true;
|
|
1947
1818
|
}
|
|
@@ -2054,10 +1925,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2054
1925
|
}
|
|
2055
1926
|
function hexSlice(buf, start, end) {
|
|
2056
1927
|
var len = buf.length;
|
|
2057
|
-
if (!start || start < 0)
|
|
2058
|
-
|
|
2059
|
-
if (!end || end < 0 || end > len)
|
|
2060
|
-
end = len;
|
|
1928
|
+
if (!start || start < 0) start = 0;
|
|
1929
|
+
if (!end || end < 0 || end > len) end = len;
|
|
2061
1930
|
var out = "";
|
|
2062
1931
|
for (var i = start; i < end; ++i) {
|
|
2063
1932
|
out += hexSliceLookupTable[buf[i]];
|
|
@@ -2078,35 +1947,29 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2078
1947
|
end = end === void 0 ? len : ~~end;
|
|
2079
1948
|
if (start < 0) {
|
|
2080
1949
|
start += len;
|
|
2081
|
-
if (start < 0)
|
|
2082
|
-
start = 0;
|
|
1950
|
+
if (start < 0) start = 0;
|
|
2083
1951
|
} else if (start > len) {
|
|
2084
1952
|
start = len;
|
|
2085
1953
|
}
|
|
2086
1954
|
if (end < 0) {
|
|
2087
1955
|
end += len;
|
|
2088
|
-
if (end < 0)
|
|
2089
|
-
end = 0;
|
|
1956
|
+
if (end < 0) end = 0;
|
|
2090
1957
|
} else if (end > len) {
|
|
2091
1958
|
end = len;
|
|
2092
1959
|
}
|
|
2093
|
-
if (end < start)
|
|
2094
|
-
end = start;
|
|
1960
|
+
if (end < start) end = start;
|
|
2095
1961
|
var newBuf = this.subarray(start, end);
|
|
2096
1962
|
Object.setPrototypeOf(newBuf, Buffer3.prototype);
|
|
2097
1963
|
return newBuf;
|
|
2098
1964
|
};
|
|
2099
1965
|
function checkOffset(offset, ext, length) {
|
|
2100
|
-
if (offset % 1 !== 0 || offset < 0)
|
|
2101
|
-
|
|
2102
|
-
if (offset + ext > length)
|
|
2103
|
-
throw new RangeError("Trying to access beyond buffer length");
|
|
1966
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
|
1967
|
+
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
|
2104
1968
|
}
|
|
2105
1969
|
Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = function readUIntLE(offset, byteLength3, noAssert) {
|
|
2106
1970
|
offset = offset >>> 0;
|
|
2107
1971
|
byteLength3 = byteLength3 >>> 0;
|
|
2108
|
-
if (!noAssert)
|
|
2109
|
-
checkOffset(offset, byteLength3, this.length);
|
|
1972
|
+
if (!noAssert) checkOffset(offset, byteLength3, this.length);
|
|
2110
1973
|
var val = this[offset];
|
|
2111
1974
|
var mul = 1;
|
|
2112
1975
|
var i = 0;
|
|
@@ -2130,39 +1993,33 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2130
1993
|
};
|
|
2131
1994
|
Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = function readUInt8(offset, noAssert) {
|
|
2132
1995
|
offset = offset >>> 0;
|
|
2133
|
-
if (!noAssert)
|
|
2134
|
-
checkOffset(offset, 1, this.length);
|
|
1996
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
2135
1997
|
return this[offset];
|
|
2136
1998
|
};
|
|
2137
1999
|
Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
|
|
2138
2000
|
offset = offset >>> 0;
|
|
2139
|
-
if (!noAssert)
|
|
2140
|
-
checkOffset(offset, 2, this.length);
|
|
2001
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2141
2002
|
return this[offset] | this[offset + 1] << 8;
|
|
2142
2003
|
};
|
|
2143
2004
|
Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
|
|
2144
2005
|
offset = offset >>> 0;
|
|
2145
|
-
if (!noAssert)
|
|
2146
|
-
checkOffset(offset, 2, this.length);
|
|
2006
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2147
2007
|
return this[offset] << 8 | this[offset + 1];
|
|
2148
2008
|
};
|
|
2149
2009
|
Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
|
|
2150
2010
|
offset = offset >>> 0;
|
|
2151
|
-
if (!noAssert)
|
|
2152
|
-
checkOffset(offset, 4, this.length);
|
|
2011
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2153
2012
|
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
|
|
2154
2013
|
};
|
|
2155
2014
|
Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
|
|
2156
2015
|
offset = offset >>> 0;
|
|
2157
|
-
if (!noAssert)
|
|
2158
|
-
checkOffset(offset, 4, this.length);
|
|
2016
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2159
2017
|
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
|
|
2160
2018
|
};
|
|
2161
2019
|
Buffer3.prototype.readIntLE = function readIntLE(offset, byteLength3, noAssert) {
|
|
2162
2020
|
offset = offset >>> 0;
|
|
2163
2021
|
byteLength3 = byteLength3 >>> 0;
|
|
2164
|
-
if (!noAssert)
|
|
2165
|
-
checkOffset(offset, byteLength3, this.length);
|
|
2022
|
+
if (!noAssert) checkOffset(offset, byteLength3, this.length);
|
|
2166
2023
|
var val = this[offset];
|
|
2167
2024
|
var mul = 1;
|
|
2168
2025
|
var i = 0;
|
|
@@ -2170,15 +2027,13 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2170
2027
|
val += this[offset + i] * mul;
|
|
2171
2028
|
}
|
|
2172
2029
|
mul *= 128;
|
|
2173
|
-
if (val >= mul)
|
|
2174
|
-
val -= Math.pow(2, 8 * byteLength3);
|
|
2030
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
|
|
2175
2031
|
return val;
|
|
2176
2032
|
};
|
|
2177
2033
|
Buffer3.prototype.readIntBE = function readIntBE(offset, byteLength3, noAssert) {
|
|
2178
2034
|
offset = offset >>> 0;
|
|
2179
2035
|
byteLength3 = byteLength3 >>> 0;
|
|
2180
|
-
if (!noAssert)
|
|
2181
|
-
checkOffset(offset, byteLength3, this.length);
|
|
2036
|
+
if (!noAssert) checkOffset(offset, byteLength3, this.length);
|
|
2182
2037
|
var i = byteLength3;
|
|
2183
2038
|
var mul = 1;
|
|
2184
2039
|
var val = this[offset + --i];
|
|
@@ -2186,75 +2041,61 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2186
2041
|
val += this[offset + --i] * mul;
|
|
2187
2042
|
}
|
|
2188
2043
|
mul *= 128;
|
|
2189
|
-
if (val >= mul)
|
|
2190
|
-
val -= Math.pow(2, 8 * byteLength3);
|
|
2044
|
+
if (val >= mul) val -= Math.pow(2, 8 * byteLength3);
|
|
2191
2045
|
return val;
|
|
2192
2046
|
};
|
|
2193
2047
|
Buffer3.prototype.readInt8 = function readInt8(offset, noAssert) {
|
|
2194
2048
|
offset = offset >>> 0;
|
|
2195
|
-
if (!noAssert)
|
|
2196
|
-
|
|
2197
|
-
if (!(this[offset] & 128))
|
|
2198
|
-
return this[offset];
|
|
2049
|
+
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
2050
|
+
if (!(this[offset] & 128)) return this[offset];
|
|
2199
2051
|
return (255 - this[offset] + 1) * -1;
|
|
2200
2052
|
};
|
|
2201
2053
|
Buffer3.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
|
|
2202
2054
|
offset = offset >>> 0;
|
|
2203
|
-
if (!noAssert)
|
|
2204
|
-
checkOffset(offset, 2, this.length);
|
|
2055
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2205
2056
|
var val = this[offset] | this[offset + 1] << 8;
|
|
2206
2057
|
return val & 32768 ? val | 4294901760 : val;
|
|
2207
2058
|
};
|
|
2208
2059
|
Buffer3.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
|
|
2209
2060
|
offset = offset >>> 0;
|
|
2210
|
-
if (!noAssert)
|
|
2211
|
-
checkOffset(offset, 2, this.length);
|
|
2061
|
+
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
2212
2062
|
var val = this[offset + 1] | this[offset] << 8;
|
|
2213
2063
|
return val & 32768 ? val | 4294901760 : val;
|
|
2214
2064
|
};
|
|
2215
2065
|
Buffer3.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
|
|
2216
2066
|
offset = offset >>> 0;
|
|
2217
|
-
if (!noAssert)
|
|
2218
|
-
checkOffset(offset, 4, this.length);
|
|
2067
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2219
2068
|
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
|
|
2220
2069
|
};
|
|
2221
2070
|
Buffer3.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
|
|
2222
2071
|
offset = offset >>> 0;
|
|
2223
|
-
if (!noAssert)
|
|
2224
|
-
checkOffset(offset, 4, this.length);
|
|
2072
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2225
2073
|
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
|
|
2226
2074
|
};
|
|
2227
2075
|
Buffer3.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
|
|
2228
2076
|
offset = offset >>> 0;
|
|
2229
|
-
if (!noAssert)
|
|
2230
|
-
checkOffset(offset, 4, this.length);
|
|
2077
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2231
2078
|
return ieee754$1.read(this, offset, true, 23, 4);
|
|
2232
2079
|
};
|
|
2233
2080
|
Buffer3.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
|
|
2234
2081
|
offset = offset >>> 0;
|
|
2235
|
-
if (!noAssert)
|
|
2236
|
-
checkOffset(offset, 4, this.length);
|
|
2082
|
+
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
2237
2083
|
return ieee754$1.read(this, offset, false, 23, 4);
|
|
2238
2084
|
};
|
|
2239
2085
|
Buffer3.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
|
|
2240
2086
|
offset = offset >>> 0;
|
|
2241
|
-
if (!noAssert)
|
|
2242
|
-
checkOffset(offset, 8, this.length);
|
|
2087
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2243
2088
|
return ieee754$1.read(this, offset, true, 52, 8);
|
|
2244
2089
|
};
|
|
2245
2090
|
Buffer3.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
|
|
2246
2091
|
offset = offset >>> 0;
|
|
2247
|
-
if (!noAssert)
|
|
2248
|
-
checkOffset(offset, 8, this.length);
|
|
2092
|
+
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
2249
2093
|
return ieee754$1.read(this, offset, false, 52, 8);
|
|
2250
2094
|
};
|
|
2251
2095
|
function checkInt(buf, value, offset, ext, max, min) {
|
|
2252
|
-
if (!Buffer3.isBuffer(buf))
|
|
2253
|
-
|
|
2254
|
-
if (
|
|
2255
|
-
throw new RangeError('"value" argument is out of bounds');
|
|
2256
|
-
if (offset + ext > buf.length)
|
|
2257
|
-
throw new RangeError("Index out of range");
|
|
2096
|
+
if (!Buffer3.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
2097
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
|
2098
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2258
2099
|
}
|
|
2259
2100
|
Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength3, noAssert) {
|
|
2260
2101
|
value = +value;
|
|
@@ -2291,16 +2132,14 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2291
2132
|
Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
|
|
2292
2133
|
value = +value;
|
|
2293
2134
|
offset = offset >>> 0;
|
|
2294
|
-
if (!noAssert)
|
|
2295
|
-
checkInt(this, value, offset, 1, 255, 0);
|
|
2135
|
+
if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
|
|
2296
2136
|
this[offset] = value & 255;
|
|
2297
2137
|
return offset + 1;
|
|
2298
2138
|
};
|
|
2299
2139
|
Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
|
|
2300
2140
|
value = +value;
|
|
2301
2141
|
offset = offset >>> 0;
|
|
2302
|
-
if (!noAssert)
|
|
2303
|
-
checkInt(this, value, offset, 2, 65535, 0);
|
|
2142
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
2304
2143
|
this[offset] = value & 255;
|
|
2305
2144
|
this[offset + 1] = value >>> 8;
|
|
2306
2145
|
return offset + 2;
|
|
@@ -2308,8 +2147,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2308
2147
|
Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
|
|
2309
2148
|
value = +value;
|
|
2310
2149
|
offset = offset >>> 0;
|
|
2311
|
-
if (!noAssert)
|
|
2312
|
-
checkInt(this, value, offset, 2, 65535, 0);
|
|
2150
|
+
if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
|
|
2313
2151
|
this[offset] = value >>> 8;
|
|
2314
2152
|
this[offset + 1] = value & 255;
|
|
2315
2153
|
return offset + 2;
|
|
@@ -2317,8 +2155,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2317
2155
|
Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
|
|
2318
2156
|
value = +value;
|
|
2319
2157
|
offset = offset >>> 0;
|
|
2320
|
-
if (!noAssert)
|
|
2321
|
-
checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2158
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2322
2159
|
this[offset + 3] = value >>> 24;
|
|
2323
2160
|
this[offset + 2] = value >>> 16;
|
|
2324
2161
|
this[offset + 1] = value >>> 8;
|
|
@@ -2328,8 +2165,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2328
2165
|
Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
|
|
2329
2166
|
value = +value;
|
|
2330
2167
|
offset = offset >>> 0;
|
|
2331
|
-
if (!noAssert)
|
|
2332
|
-
checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2168
|
+
if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
|
|
2333
2169
|
this[offset] = value >>> 24;
|
|
2334
2170
|
this[offset + 1] = value >>> 16;
|
|
2335
2171
|
this[offset + 2] = value >>> 8;
|
|
@@ -2377,18 +2213,15 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2377
2213
|
Buffer3.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
|
|
2378
2214
|
value = +value;
|
|
2379
2215
|
offset = offset >>> 0;
|
|
2380
|
-
if (!noAssert)
|
|
2381
|
-
|
|
2382
|
-
if (value < 0)
|
|
2383
|
-
value = 255 + value + 1;
|
|
2216
|
+
if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
|
|
2217
|
+
if (value < 0) value = 255 + value + 1;
|
|
2384
2218
|
this[offset] = value & 255;
|
|
2385
2219
|
return offset + 1;
|
|
2386
2220
|
};
|
|
2387
2221
|
Buffer3.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
|
|
2388
2222
|
value = +value;
|
|
2389
2223
|
offset = offset >>> 0;
|
|
2390
|
-
if (!noAssert)
|
|
2391
|
-
checkInt(this, value, offset, 2, 32767, -32768);
|
|
2224
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
2392
2225
|
this[offset] = value & 255;
|
|
2393
2226
|
this[offset + 1] = value >>> 8;
|
|
2394
2227
|
return offset + 2;
|
|
@@ -2396,8 +2229,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2396
2229
|
Buffer3.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
|
|
2397
2230
|
value = +value;
|
|
2398
2231
|
offset = offset >>> 0;
|
|
2399
|
-
if (!noAssert)
|
|
2400
|
-
checkInt(this, value, offset, 2, 32767, -32768);
|
|
2232
|
+
if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
|
|
2401
2233
|
this[offset] = value >>> 8;
|
|
2402
2234
|
this[offset + 1] = value & 255;
|
|
2403
2235
|
return offset + 2;
|
|
@@ -2405,8 +2237,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2405
2237
|
Buffer3.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
|
|
2406
2238
|
value = +value;
|
|
2407
2239
|
offset = offset >>> 0;
|
|
2408
|
-
if (!noAssert)
|
|
2409
|
-
checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2240
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2410
2241
|
this[offset] = value & 255;
|
|
2411
2242
|
this[offset + 1] = value >>> 8;
|
|
2412
2243
|
this[offset + 2] = value >>> 16;
|
|
@@ -2416,10 +2247,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2416
2247
|
Buffer3.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
|
|
2417
2248
|
value = +value;
|
|
2418
2249
|
offset = offset >>> 0;
|
|
2419
|
-
if (!noAssert)
|
|
2420
|
-
|
|
2421
|
-
if (value < 0)
|
|
2422
|
-
value = 4294967295 + value + 1;
|
|
2250
|
+
if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
|
|
2251
|
+
if (value < 0) value = 4294967295 + value + 1;
|
|
2423
2252
|
this[offset] = value >>> 24;
|
|
2424
2253
|
this[offset + 1] = value >>> 16;
|
|
2425
2254
|
this[offset + 2] = value >>> 8;
|
|
@@ -2427,10 +2256,8 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2427
2256
|
return offset + 4;
|
|
2428
2257
|
};
|
|
2429
2258
|
function checkIEEE754(buf, value, offset, ext, max, min) {
|
|
2430
|
-
if (offset + ext > buf.length)
|
|
2431
|
-
|
|
2432
|
-
if (offset < 0)
|
|
2433
|
-
throw new RangeError("Index out of range");
|
|
2259
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
|
2260
|
+
if (offset < 0) throw new RangeError("Index out of range");
|
|
2434
2261
|
}
|
|
2435
2262
|
function writeFloat(buf, value, offset, littleEndian, noAssert) {
|
|
2436
2263
|
value = +value;
|
|
@@ -2463,31 +2290,20 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2463
2290
|
return writeDouble(this, value, offset, false, noAssert);
|
|
2464
2291
|
};
|
|
2465
2292
|
Buffer3.prototype.copy = function copy(target, targetStart, start, end) {
|
|
2466
|
-
if (!Buffer3.isBuffer(target))
|
|
2467
|
-
|
|
2468
|
-
if (!
|
|
2469
|
-
|
|
2470
|
-
if (!
|
|
2471
|
-
|
|
2472
|
-
if (
|
|
2473
|
-
|
|
2474
|
-
if (!targetStart)
|
|
2475
|
-
targetStart = 0;
|
|
2476
|
-
if (end > 0 && end < start)
|
|
2477
|
-
end = start;
|
|
2478
|
-
if (end === start)
|
|
2479
|
-
return 0;
|
|
2480
|
-
if (target.length === 0 || this.length === 0)
|
|
2481
|
-
return 0;
|
|
2293
|
+
if (!Buffer3.isBuffer(target)) throw new TypeError("argument should be a Buffer");
|
|
2294
|
+
if (!start) start = 0;
|
|
2295
|
+
if (!end && end !== 0) end = this.length;
|
|
2296
|
+
if (targetStart >= target.length) targetStart = target.length;
|
|
2297
|
+
if (!targetStart) targetStart = 0;
|
|
2298
|
+
if (end > 0 && end < start) end = start;
|
|
2299
|
+
if (end === start) return 0;
|
|
2300
|
+
if (target.length === 0 || this.length === 0) return 0;
|
|
2482
2301
|
if (targetStart < 0) {
|
|
2483
2302
|
throw new RangeError("targetStart out of bounds");
|
|
2484
2303
|
}
|
|
2485
|
-
if (start < 0 || start >= this.length)
|
|
2486
|
-
|
|
2487
|
-
if (end
|
|
2488
|
-
throw new RangeError("sourceEnd out of bounds");
|
|
2489
|
-
if (end > this.length)
|
|
2490
|
-
end = this.length;
|
|
2304
|
+
if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
|
|
2305
|
+
if (end < 0) throw new RangeError("sourceEnd out of bounds");
|
|
2306
|
+
if (end > this.length) end = this.length;
|
|
2491
2307
|
if (target.length - targetStart < end - start) {
|
|
2492
2308
|
end = target.length - targetStart + start;
|
|
2493
2309
|
}
|
|
@@ -2538,8 +2354,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2538
2354
|
}
|
|
2539
2355
|
start = start >>> 0;
|
|
2540
2356
|
end = end === void 0 ? this.length : end >>> 0;
|
|
2541
|
-
if (!val)
|
|
2542
|
-
val = 0;
|
|
2357
|
+
if (!val) val = 0;
|
|
2543
2358
|
var i;
|
|
2544
2359
|
if (typeof val === "number") {
|
|
2545
2360
|
for (i = start; i < end; ++i) {
|
|
@@ -2561,8 +2376,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2561
2376
|
function base64clean(str) {
|
|
2562
2377
|
str = str.split("=")[0];
|
|
2563
2378
|
str = str.trim().replace(INVALID_BASE64_RE, "");
|
|
2564
|
-
if (str.length < 2)
|
|
2565
|
-
return "";
|
|
2379
|
+
if (str.length < 2) return "";
|
|
2566
2380
|
while (str.length % 4 !== 0) {
|
|
2567
2381
|
str = str + "=";
|
|
2568
2382
|
}
|
|
@@ -2579,51 +2393,43 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2579
2393
|
if (codePoint > 55295 && codePoint < 57344) {
|
|
2580
2394
|
if (!leadSurrogate) {
|
|
2581
2395
|
if (codePoint > 56319) {
|
|
2582
|
-
if ((units -= 3) > -1)
|
|
2583
|
-
bytes.push(239, 191, 189);
|
|
2396
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2584
2397
|
continue;
|
|
2585
2398
|
} else if (i + 1 === length) {
|
|
2586
|
-
if ((units -= 3) > -1)
|
|
2587
|
-
bytes.push(239, 191, 189);
|
|
2399
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2588
2400
|
continue;
|
|
2589
2401
|
}
|
|
2590
2402
|
leadSurrogate = codePoint;
|
|
2591
2403
|
continue;
|
|
2592
2404
|
}
|
|
2593
2405
|
if (codePoint < 56320) {
|
|
2594
|
-
if ((units -= 3) > -1)
|
|
2595
|
-
bytes.push(239, 191, 189);
|
|
2406
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2596
2407
|
leadSurrogate = codePoint;
|
|
2597
2408
|
continue;
|
|
2598
2409
|
}
|
|
2599
2410
|
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
|
|
2600
2411
|
} else if (leadSurrogate) {
|
|
2601
|
-
if ((units -= 3) > -1)
|
|
2602
|
-
bytes.push(239, 191, 189);
|
|
2412
|
+
if ((units -= 3) > -1) bytes.push(239, 191, 189);
|
|
2603
2413
|
}
|
|
2604
2414
|
leadSurrogate = null;
|
|
2605
2415
|
if (codePoint < 128) {
|
|
2606
|
-
if ((units -= 1) < 0)
|
|
2607
|
-
break;
|
|
2416
|
+
if ((units -= 1) < 0) break;
|
|
2608
2417
|
bytes.push(codePoint);
|
|
2609
2418
|
} else if (codePoint < 2048) {
|
|
2610
|
-
if ((units -= 2) < 0)
|
|
2611
|
-
break;
|
|
2419
|
+
if ((units -= 2) < 0) break;
|
|
2612
2420
|
bytes.push(
|
|
2613
2421
|
codePoint >> 6 | 192,
|
|
2614
2422
|
codePoint & 63 | 128
|
|
2615
2423
|
);
|
|
2616
2424
|
} else if (codePoint < 65536) {
|
|
2617
|
-
if ((units -= 3) < 0)
|
|
2618
|
-
break;
|
|
2425
|
+
if ((units -= 3) < 0) break;
|
|
2619
2426
|
bytes.push(
|
|
2620
2427
|
codePoint >> 12 | 224,
|
|
2621
2428
|
codePoint >> 6 & 63 | 128,
|
|
2622
2429
|
codePoint & 63 | 128
|
|
2623
2430
|
);
|
|
2624
2431
|
} else if (codePoint < 1114112) {
|
|
2625
|
-
if ((units -= 4) < 0)
|
|
2626
|
-
break;
|
|
2432
|
+
if ((units -= 4) < 0) break;
|
|
2627
2433
|
bytes.push(
|
|
2628
2434
|
codePoint >> 18 | 240,
|
|
2629
2435
|
codePoint >> 12 & 63 | 128,
|
|
@@ -2647,8 +2453,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2647
2453
|
var c, hi, lo;
|
|
2648
2454
|
var byteArray = [];
|
|
2649
2455
|
for (var i = 0; i < str.length; ++i) {
|
|
2650
|
-
if ((units -= 2) < 0)
|
|
2651
|
-
break;
|
|
2456
|
+
if ((units -= 2) < 0) break;
|
|
2652
2457
|
c = str.charCodeAt(i);
|
|
2653
2458
|
hi = c >> 8;
|
|
2654
2459
|
lo = c % 256;
|
|
@@ -2662,8 +2467,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
|
|
|
2662
2467
|
}
|
|
2663
2468
|
function blitBuffer(src, dst, offset, length) {
|
|
2664
2469
|
for (var i = 0; i < length; ++i) {
|
|
2665
|
-
if (i + offset >= dst.length || i >= src.length)
|
|
2666
|
-
break;
|
|
2470
|
+
if (i + offset >= dst.length || i >= src.length) break;
|
|
2667
2471
|
dst[i + offset] = src[i];
|
|
2668
2472
|
}
|
|
2669
2473
|
return i;
|
|
@@ -2832,10 +2636,8 @@ function rotl30(num) {
|
|
|
2832
2636
|
return num << 30 | num >>> 2;
|
|
2833
2637
|
}
|
|
2834
2638
|
function ft(s, b, c, d) {
|
|
2835
|
-
if (s === 0)
|
|
2836
|
-
|
|
2837
|
-
if (s === 2)
|
|
2838
|
-
return b & c | b & d | c & d;
|
|
2639
|
+
if (s === 0) return b & c | ~b & d;
|
|
2640
|
+
if (s === 2) return b & c | b & d | c & d;
|
|
2839
2641
|
return b ^ c ^ d;
|
|
2840
2642
|
}
|
|
2841
2643
|
Sha1.prototype._update = function(M) {
|
|
@@ -2845,10 +2647,8 @@ Sha1.prototype._update = function(M) {
|
|
|
2845
2647
|
var c = this._c | 0;
|
|
2846
2648
|
var d = this._d | 0;
|
|
2847
2649
|
var e = this._e | 0;
|
|
2848
|
-
for (var i = 0; i < 16; ++i)
|
|
2849
|
-
|
|
2850
|
-
for (; i < 80; ++i)
|
|
2851
|
-
W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
|
|
2650
|
+
for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4);
|
|
2651
|
+
for (; i < 80; ++i) W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
|
|
2852
2652
|
for (var j = 0; j < 80; ++j) {
|
|
2853
2653
|
var s = ~~(j / 20);
|
|
2854
2654
|
var t = rotl5(a) + ft(s, b, c, d) + e + W2[j] + K$1[s] | 0;
|
|
@@ -2990,10 +2790,8 @@ Sha256.prototype._update = function(M) {
|
|
|
2990
2790
|
var f = this._f | 0;
|
|
2991
2791
|
var g = this._g | 0;
|
|
2992
2792
|
var h = this._h | 0;
|
|
2993
|
-
for (var i = 0; i < 16; ++i)
|
|
2994
|
-
|
|
2995
|
-
for (; i < 64; ++i)
|
|
2996
|
-
W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
|
|
2793
|
+
for (var i = 0; i < 16; ++i) W2[i] = M.readInt32BE(i * 4);
|
|
2794
|
+
for (; i < 64; ++i) W2[i] = gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16] | 0;
|
|
2997
2795
|
for (var j = 0; j < 64; ++j) {
|
|
2998
2796
|
var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W2[j] | 0;
|
|
2999
2797
|
var T2 = sigma0(a) + maj(a, b, c) | 0;
|
|
@@ -3048,12 +2846,190 @@ const hashAlgorithms = {
|
|
|
3048
2846
|
};
|
|
3049
2847
|
const hash = (data, algorithm = "sha1") => {
|
|
3050
2848
|
if (!["sha1", "sha256"].includes(algorithm)) {
|
|
3051
|
-
throw new Error(
|
|
2849
|
+
throw new Error(
|
|
2850
|
+
"Hashing algorithm not supported: Available: sha1, sha256"
|
|
2851
|
+
);
|
|
3052
2852
|
}
|
|
3053
2853
|
const Algorithm = hashAlgorithms[algorithm];
|
|
3054
2854
|
const sha = new Algorithm();
|
|
3055
2855
|
return sha.update(data).digest("base64");
|
|
3056
2856
|
};
|
|
2857
|
+
function getUnixTimestamp(date) {
|
|
2858
|
+
return (new Date(date).getTime() / 1e3).toFixed(0);
|
|
2859
|
+
}
|
|
2860
|
+
function buildOperationSignatureParams({
|
|
2861
|
+
documentId,
|
|
2862
|
+
signer,
|
|
2863
|
+
operation,
|
|
2864
|
+
previousStateHash
|
|
2865
|
+
}) {
|
|
2866
|
+
const { timestamp, scope, id, type } = operation;
|
|
2867
|
+
return [
|
|
2868
|
+
getUnixTimestamp(timestamp),
|
|
2869
|
+
// timestamp,
|
|
2870
|
+
signer.app.key,
|
|
2871
|
+
// signer public key
|
|
2872
|
+
hash(
|
|
2873
|
+
// hash (docID, scope, operationID, operationName, operationInput)
|
|
2874
|
+
[documentId, scope, id, type, cjsModule(operation.input)].join(
|
|
2875
|
+
""
|
|
2876
|
+
)
|
|
2877
|
+
),
|
|
2878
|
+
previousStateHash
|
|
2879
|
+
// state hash that the operation was applied to
|
|
2880
|
+
];
|
|
2881
|
+
}
|
|
2882
|
+
const textEncode = new TextEncoder();
|
|
2883
|
+
function buildOperationSignatureMessage(params) {
|
|
2884
|
+
const message = params.join("");
|
|
2885
|
+
const prefix = "Signed Operation:\n" + message.length.toString();
|
|
2886
|
+
return textEncode.encode(prefix + message);
|
|
2887
|
+
}
|
|
2888
|
+
function ab2hex(ab) {
|
|
2889
|
+
return Array.prototype.map.call(
|
|
2890
|
+
new Uint8Array(ab),
|
|
2891
|
+
(x) => ("00" + x.toString(16)).slice(-2)
|
|
2892
|
+
).join("");
|
|
2893
|
+
}
|
|
2894
|
+
function hex2ab(hex) {
|
|
2895
|
+
var _a;
|
|
2896
|
+
return new Uint8Array(
|
|
2897
|
+
((_a = hex.match(/[\da-f]{2}/gi)) == null ? void 0 : _a.map(function(h) {
|
|
2898
|
+
return parseInt(h, 16);
|
|
2899
|
+
})) ?? []
|
|
2900
|
+
);
|
|
2901
|
+
}
|
|
2902
|
+
async function buildOperationSignature(context, signMethod) {
|
|
2903
|
+
const params = buildOperationSignatureParams(context);
|
|
2904
|
+
const message = buildOperationSignatureMessage(params);
|
|
2905
|
+
const signature = await signMethod(message);
|
|
2906
|
+
return [...params, `0x${ab2hex(signature)}`];
|
|
2907
|
+
}
|
|
2908
|
+
async function buildSignedOperation(action, reducer, document, context, signHandler) {
|
|
2909
|
+
var _a, _b;
|
|
2910
|
+
const result = reducer(document, action, void 0, {
|
|
2911
|
+
reuseHash: true,
|
|
2912
|
+
reuseOperationResultingState: true
|
|
2913
|
+
});
|
|
2914
|
+
const operation = result.operations[action.scope].at(-1);
|
|
2915
|
+
if (!operation) {
|
|
2916
|
+
throw new Error("Action was not applied");
|
|
2917
|
+
}
|
|
2918
|
+
const previousStateHash = ((_a = result.operations[action.scope].at(-2)) == null ? void 0 : _a.hash) ?? "";
|
|
2919
|
+
const signature = await buildOperationSignature(
|
|
2920
|
+
{
|
|
2921
|
+
...context,
|
|
2922
|
+
operation,
|
|
2923
|
+
previousStateHash
|
|
2924
|
+
},
|
|
2925
|
+
signHandler
|
|
2926
|
+
);
|
|
2927
|
+
return {
|
|
2928
|
+
...operation,
|
|
2929
|
+
context: {
|
|
2930
|
+
...operation.context,
|
|
2931
|
+
signer: {
|
|
2932
|
+
...(_b = operation.context) == null ? void 0 : _b.signer,
|
|
2933
|
+
...context.signer,
|
|
2934
|
+
signatures: [...context.signer.signatures ?? [], signature]
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
async function verifyOperationSignature(signature, signer, verifyHandler) {
|
|
2940
|
+
const publicKey = signer.app.key;
|
|
2941
|
+
const params = signature.slice(0, 4);
|
|
2942
|
+
const signatureBytes = hex2ab(signature[4]);
|
|
2943
|
+
const expectedMessage = buildOperationSignatureMessage(params);
|
|
2944
|
+
return verifyHandler(publicKey, signatureBytes, expectedMessage);
|
|
2945
|
+
}
|
|
2946
|
+
const types = { "application/andrew-inset": ["ez"], "application/appinstaller": ["appinstaller"], "application/applixware": ["aw"], "application/appx": ["appx"], "application/appxbundle": ["appxbundle"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/automationml-aml+xml": ["aml"], "application/automationml-amlx+zip": ["amlx"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cpl+xml": ["cpl"], "application/cu-seeme": ["cu"], "application/cwl": ["cwl"], "application/dash+xml": ["mpd"], "application/dash-patch+xml": ["mpp"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/express": ["exp"], "application/fdf": ["fdf"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["*js"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/media-policy-dataset+xml": ["mpf"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["*mp4", "*mpg4", "mp4s", "m4p"], "application/msix": ["msix"], "application/msixbundle": ["msixbundle"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-keys": ["asc"], "application/pgp-signature": ["sig", "*asc"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/sql": ["sql"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/trig": ["trig"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/watcherinfo+xml": ["wif"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xfdf": ["xfdf"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/aac": ["adts", "aac"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avci": ["avci"], "image/avcs": ["avcs"], "image/avif": ["avif"], "image/bmp": ["bmp", "dib"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/dpx": ["dpx"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm", "jpgm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/jt": ["jt"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/prc": ["prc"], "model/step+xml": ["stpx"], "model/step+zip": ["stpz"], "model/step-xml+zip": ["stpxz"], "model/stl": ["stl"], "model/u3d": ["u3d"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/javascript": ["js", "mjs"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["md", "markdown"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/wgsl": ["wgsl"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "*jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
|
|
2947
|
+
Object.freeze(types);
|
|
2948
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
2949
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
2950
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2951
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2952
|
+
};
|
|
2953
|
+
var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
|
|
2954
|
+
class Mime {
|
|
2955
|
+
constructor(...args) {
|
|
2956
|
+
_Mime_extensionToType.set(this, /* @__PURE__ */ new Map());
|
|
2957
|
+
_Mime_typeToExtension.set(this, /* @__PURE__ */ new Map());
|
|
2958
|
+
_Mime_typeToExtensions.set(this, /* @__PURE__ */ new Map());
|
|
2959
|
+
for (const arg of args) {
|
|
2960
|
+
this.define(arg);
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
define(typeMap, force = false) {
|
|
2964
|
+
for (let [type, extensions] of Object.entries(typeMap)) {
|
|
2965
|
+
type = type.toLowerCase();
|
|
2966
|
+
extensions = extensions.map((ext) => ext.toLowerCase());
|
|
2967
|
+
if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) {
|
|
2968
|
+
__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, /* @__PURE__ */ new Set());
|
|
2969
|
+
}
|
|
2970
|
+
const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
|
|
2971
|
+
let first = true;
|
|
2972
|
+
for (let extension of extensions) {
|
|
2973
|
+
const starred = extension.startsWith("*");
|
|
2974
|
+
extension = starred ? extension.slice(1) : extension;
|
|
2975
|
+
allExtensions == null ? void 0 : allExtensions.add(extension);
|
|
2976
|
+
if (first) {
|
|
2977
|
+
__classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension);
|
|
2978
|
+
}
|
|
2979
|
+
first = false;
|
|
2980
|
+
if (starred)
|
|
2981
|
+
continue;
|
|
2982
|
+
const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension);
|
|
2983
|
+
if (currentType && currentType != type && !force) {
|
|
2984
|
+
throw new Error(`"${type} -> ${extension}" conflicts with "${currentType} -> ${extension}". Pass \`force=true\` to override this definition.`);
|
|
2985
|
+
}
|
|
2986
|
+
__classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension, type);
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
return this;
|
|
2990
|
+
}
|
|
2991
|
+
getType(path) {
|
|
2992
|
+
if (typeof path !== "string")
|
|
2993
|
+
return null;
|
|
2994
|
+
const last = path.replace(/^.*[/\\]/, "").toLowerCase();
|
|
2995
|
+
const ext = last.replace(/^.*\./, "").toLowerCase();
|
|
2996
|
+
const hasPath = last.length < path.length;
|
|
2997
|
+
const hasDot = ext.length < last.length - 1;
|
|
2998
|
+
if (!hasDot && hasPath)
|
|
2999
|
+
return null;
|
|
3000
|
+
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
3001
|
+
}
|
|
3002
|
+
getExtension(type) {
|
|
3003
|
+
var _a;
|
|
3004
|
+
if (typeof type !== "string")
|
|
3005
|
+
return null;
|
|
3006
|
+
type = (_a = type == null ? void 0 : type.split) == null ? void 0 : _a.call(type, ";")[0];
|
|
3007
|
+
return (type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null;
|
|
3008
|
+
}
|
|
3009
|
+
getAllExtensions(type) {
|
|
3010
|
+
if (typeof type !== "string")
|
|
3011
|
+
return null;
|
|
3012
|
+
return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
|
|
3013
|
+
}
|
|
3014
|
+
_freeze() {
|
|
3015
|
+
this.define = () => {
|
|
3016
|
+
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
3017
|
+
};
|
|
3018
|
+
Object.freeze(this);
|
|
3019
|
+
for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
|
|
3020
|
+
Object.freeze(extensions);
|
|
3021
|
+
}
|
|
3022
|
+
return this;
|
|
3023
|
+
}
|
|
3024
|
+
_getTestState() {
|
|
3025
|
+
return {
|
|
3026
|
+
types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
|
|
3027
|
+
extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f")
|
|
3028
|
+
};
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
_Mime_extensionToType = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtension = /* @__PURE__ */ new WeakMap(), _Mime_typeToExtensions = /* @__PURE__ */ new WeakMap();
|
|
3032
|
+
const mime = new Mime(types)._freeze();
|
|
3057
3033
|
function validateOperations(operations) {
|
|
3058
3034
|
const errors = [];
|
|
3059
3035
|
const scopes = Object.keys(operations);
|
|
@@ -3123,8 +3099,7 @@ function garbageCollect(sortedOperations) {
|
|
|
3123
3099
|
function addUndo(sortedOperations) {
|
|
3124
3100
|
const operationsCopy = [...sortedOperations];
|
|
3125
3101
|
const latestOperation = operationsCopy[operationsCopy.length - 1];
|
|
3126
|
-
if (!latestOperation)
|
|
3127
|
-
return operationsCopy;
|
|
3102
|
+
if (!latestOperation) return operationsCopy;
|
|
3128
3103
|
if (latestOperation.type === "NOOP") {
|
|
3129
3104
|
operationsCopy.push({
|
|
3130
3105
|
...latestOperation,
|
|
@@ -3595,7 +3570,7 @@ function updateOperations(document, action, skip = 0) {
|
|
|
3595
3570
|
nextIndex = action.index;
|
|
3596
3571
|
operationId = action.id;
|
|
3597
3572
|
} else {
|
|
3598
|
-
operationId = v4();
|
|
3573
|
+
operationId = "id" in action ? action.id : v4();
|
|
3599
3574
|
}
|
|
3600
3575
|
operations.push({
|
|
3601
3576
|
...action,
|
|
@@ -3643,8 +3618,7 @@ function processUndoRedo(document, action, skip) {
|
|
|
3643
3618
|
function processSkipOperation(document, action, customReducer, skipValue, reuseOperationResultingState = false, resultingStateParser = parseResultingState) {
|
|
3644
3619
|
const scope = action.scope;
|
|
3645
3620
|
const latestOperation = document.operations[scope].at(-1);
|
|
3646
|
-
if (!latestOperation)
|
|
3647
|
-
return document;
|
|
3621
|
+
if (!latestOperation) return document;
|
|
3648
3622
|
const documentOperations = garbageCollectDocumentOperations(
|
|
3649
3623
|
{
|
|
3650
3624
|
...document.operations,
|
|
@@ -4320,17 +4294,25 @@ function applyMixins(derivedCtor, constructors) {
|
|
|
4320
4294
|
});
|
|
4321
4295
|
}
|
|
4322
4296
|
export {
|
|
4323
|
-
|
|
4297
|
+
isNoopOperation as A,
|
|
4324
4298
|
BaseDocument as B,
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4299
|
+
isSameDocument as C,
|
|
4300
|
+
isUndoRedo as D,
|
|
4301
|
+
mapSkippedOperations as E,
|
|
4302
|
+
parseResultingState as F,
|
|
4303
|
+
readOnly as G,
|
|
4304
|
+
replayDocument as H,
|
|
4305
|
+
replayOperations as I,
|
|
4306
|
+
sortMappedOperations as J,
|
|
4307
|
+
sortOperations as K,
|
|
4308
|
+
validateOperations as L,
|
|
4309
|
+
verifyOperationSignature as M,
|
|
4310
|
+
baseReducer as N,
|
|
4311
|
+
mutableBaseReducer as O,
|
|
4312
|
+
processUndoRedo as P,
|
|
4313
|
+
updateDocument as Q,
|
|
4314
|
+
updateHeader as R,
|
|
4315
|
+
zod as S,
|
|
4334
4316
|
createExtendedState as a,
|
|
4335
4317
|
createDocument as b,
|
|
4336
4318
|
createReducer as c,
|
|
@@ -4340,22 +4322,22 @@ export {
|
|
|
4340
4322
|
applyMixins as g,
|
|
4341
4323
|
BaseActions as h,
|
|
4342
4324
|
isBaseAction as i,
|
|
4343
|
-
|
|
4344
|
-
|
|
4325
|
+
ab2hex as j,
|
|
4326
|
+
buildOperationSignature as k,
|
|
4345
4327
|
loadFromFile as l,
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4328
|
+
buildOperationSignatureMessage as m,
|
|
4329
|
+
buildOperationSignatureParams as n,
|
|
4330
|
+
buildSignedOperation as o,
|
|
4331
|
+
calculateSkipsLeft as p,
|
|
4332
|
+
createUnsafeReducer as q,
|
|
4333
|
+
createZip as r,
|
|
4352
4334
|
saveToFile as s,
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4335
|
+
documentHelpers as t,
|
|
4336
|
+
getLocalFile as u,
|
|
4337
|
+
getRemoteFile as v,
|
|
4338
|
+
getUnixTimestamp as w,
|
|
4339
|
+
hashDocument as x,
|
|
4340
|
+
hashKey as y,
|
|
4341
|
+
hex2ab as z
|
|
4360
4342
|
};
|
|
4361
|
-
//# sourceMappingURL=object-
|
|
4343
|
+
//# sourceMappingURL=object-CY74acQg.js.map
|