@zxr3680166/simple-mind-map
Version:
一个简单的web在线思维导图
955 lines (951 loc) • 3.05 MB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x3) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x3, {
get: (a3, b2) => (typeof require !== "undefined" ? require : a3)[b2]
}) : x3)(function(x3) {
if (typeof require !== "undefined")
return require.apply(this, arguments);
throw new Error('Dynamic require of "' + x3 + '" is not supported');
});
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all2) => {
for (var name in all2)
__defProp(target, name, { get: all2[name], enumerable: true });
};
var __copyProps = (to2, from2, except, desc) => {
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
for (let key of __getOwnPropNames(from2))
if (!__hasOwnProp.call(to2, key) && key !== except)
__defProp(to2, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
}
return to2;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// ../simple-mind-map/node_modules/eventemitter3/index.js
var require_eventemitter3 = __commonJS({
"../simple-mind-map/node_modules/eventemitter3/index.js"(exports, module) {
"use strict";
var has = Object.prototype.hasOwnProperty;
var prefix = "~";
function Events() {
}
if (Object.create) {
Events.prototype = /* @__PURE__ */ Object.create(null);
if (!new Events().__proto__)
prefix = false;
}
function EE(fn, context, once) {
this.fn = fn;
this.context = context;
this.once = once || false;
}
function addListener(emitter, event, fn, context, once) {
if (typeof fn !== "function") {
throw new TypeError("The listener must be a function");
}
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
if (!emitter._events[evt])
emitter._events[evt] = listener, emitter._eventsCount++;
else if (!emitter._events[evt].fn)
emitter._events[evt].push(listener);
else
emitter._events[evt] = [emitter._events[evt], listener];
return emitter;
}
function clearEvent(emitter, evt) {
if (--emitter._eventsCount === 0)
emitter._events = new Events();
else
delete emitter._events[evt];
}
function EventEmitter2() {
this._events = new Events();
this._eventsCount = 0;
}
EventEmitter2.prototype.eventNames = function eventNames() {
var names2 = [], events, name;
if (this._eventsCount === 0)
return names2;
for (name in events = this._events) {
if (has.call(events, name))
names2.push(prefix ? name.slice(1) : name);
}
if (Object.getOwnPropertySymbols) {
return names2.concat(Object.getOwnPropertySymbols(events));
}
return names2;
};
EventEmitter2.prototype.listeners = function listeners(event) {
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
if (!handlers)
return [];
if (handlers.fn)
return [handlers.fn];
for (var i3 = 0, l3 = handlers.length, ee2 = new Array(l3); i3 < l3; i3++) {
ee2[i3] = handlers[i3].fn;
}
return ee2;
};
EventEmitter2.prototype.listenerCount = function listenerCount(event) {
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
if (!listeners)
return 0;
if (listeners.fn)
return 1;
return listeners.length;
};
EventEmitter2.prototype.emit = function emit(event, a1, a22, a3, a4, a5) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt])
return false;
var listeners = this._events[evt], len = arguments.length, args, i3;
if (listeners.fn) {
if (listeners.once)
this.removeListener(event, listeners.fn, void 0, true);
switch (len) {
case 1:
return listeners.fn.call(listeners.context), true;
case 2:
return listeners.fn.call(listeners.context, a1), true;
case 3:
return listeners.fn.call(listeners.context, a1, a22), true;
case 4:
return listeners.fn.call(listeners.context, a1, a22, a3), true;
case 5:
return listeners.fn.call(listeners.context, a1, a22, a3, a4), true;
case 6:
return listeners.fn.call(listeners.context, a1, a22, a3, a4, a5), true;
}
for (i3 = 1, args = new Array(len - 1); i3 < len; i3++) {
args[i3 - 1] = arguments[i3];
}
listeners.fn.apply(listeners.context, args);
} else {
var length2 = listeners.length, j2;
for (i3 = 0; i3 < length2; i3++) {
if (listeners[i3].once)
this.removeListener(event, listeners[i3].fn, void 0, true);
switch (len) {
case 1:
listeners[i3].fn.call(listeners[i3].context);
break;
case 2:
listeners[i3].fn.call(listeners[i3].context, a1);
break;
case 3:
listeners[i3].fn.call(listeners[i3].context, a1, a22);
break;
case 4:
listeners[i3].fn.call(listeners[i3].context, a1, a22, a3);
break;
default:
if (!args)
for (j2 = 1, args = new Array(len - 1); j2 < len; j2++) {
args[j2 - 1] = arguments[j2];
}
listeners[i3].fn.apply(listeners[i3].context, args);
}
}
}
return true;
};
EventEmitter2.prototype.on = function on2(event, fn, context) {
return addListener(this, event, fn, context, false);
};
EventEmitter2.prototype.once = function once(event, fn, context) {
return addListener(this, event, fn, context, true);
};
EventEmitter2.prototype.removeListener = function removeListener(event, fn, context, once) {
var evt = prefix ? prefix + event : event;
if (!this._events[evt])
return this;
if (!fn) {
clearEvent(this, evt);
return this;
}
var listeners = this._events[evt];
if (listeners.fn) {
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
clearEvent(this, evt);
}
} else {
for (var i3 = 0, events = [], length2 = listeners.length; i3 < length2; i3++) {
if (listeners[i3].fn !== fn || once && !listeners[i3].once || context && listeners[i3].context !== context) {
events.push(listeners[i3]);
}
}
if (events.length)
this._events[evt] = events.length === 1 ? events[0] : events;
else
clearEvent(this, evt);
}
return this;
};
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(event) {
var evt;
if (event) {
evt = prefix ? prefix + event : event;
if (this._events[evt])
clearEvent(this, evt);
} else {
this._events = new Events();
this._eventsCount = 0;
}
return this;
};
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
EventEmitter2.prefixed = prefix;
EventEmitter2.EventEmitter = EventEmitter2;
if ("undefined" !== typeof module) {
module.exports = EventEmitter2;
}
}
});
// ../simple-mind-map/node_modules/deepmerge/dist/cjs.js
var require_cjs = __commonJS({
"../simple-mind-map/node_modules/deepmerge/dist/cjs.js"(exports, module) {
"use strict";
var isMergeableObject = function isMergeableObject2(value) {
return isNonNullObject(value) && !isSpecial(value);
};
function isNonNullObject(value) {
return !!value && typeof value === "object";
}
function isSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
}
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
function isReactElement(value) {
return value.$$typeof === REACT_ELEMENT_TYPE;
}
function emptyTarget(val2) {
return Array.isArray(val2) ? [] : {};
}
function cloneIfNecessary(value, optionsArgument) {
var clone = optionsArgument && optionsArgument.clone === true;
return clone && isMergeableObject(value) ? deepmerge(emptyTarget(value), value, optionsArgument) : value;
}
function defaultArrayMerge(target, source, optionsArgument) {
var destination = target.slice();
source.forEach(function(e2, i3) {
if (typeof destination[i3] === "undefined") {
destination[i3] = cloneIfNecessary(e2, optionsArgument);
} else if (isMergeableObject(e2)) {
destination[i3] = deepmerge(target[i3], e2, optionsArgument);
} else if (target.indexOf(e2) === -1) {
destination.push(cloneIfNecessary(e2, optionsArgument));
}
});
return destination;
}
function mergeObject(target, source, optionsArgument) {
var destination = {};
if (isMergeableObject(target)) {
Object.keys(target).forEach(function(key) {
destination[key] = cloneIfNecessary(target[key], optionsArgument);
});
}
Object.keys(source).forEach(function(key) {
if (!isMergeableObject(source[key]) || !target[key]) {
destination[key] = cloneIfNecessary(source[key], optionsArgument);
} else {
destination[key] = deepmerge(target[key], source[key], optionsArgument);
}
});
return destination;
}
function deepmerge(target, source, optionsArgument) {
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var options = optionsArgument || { arrayMerge: defaultArrayMerge };
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneIfNecessary(source, optionsArgument);
} else if (sourceIsArray) {
var arrayMerge = options.arrayMerge || defaultArrayMerge;
return arrayMerge(target, source, optionsArgument);
} else {
return mergeObject(target, source, optionsArgument);
}
}
deepmerge.all = function deepmergeAll(array2, optionsArgument) {
if (!Array.isArray(array2) || array2.length < 2) {
throw new Error("first argument should be an array with at least two elements");
}
return array2.reduce(function(prev2, next2) {
return deepmerge(prev2, next2, optionsArgument);
});
};
var deepmerge_1 = deepmerge;
module.exports = deepmerge_1;
}
});
// ../simple-mind-map/node_modules/jszip/dist/jszip.min.js
var require_jszip_min = __commonJS({
"../simple-mind-map/node_modules/jszip/dist/jszip.min.js"(exports, module) {
!function(e2) {
if ("object" == typeof exports && "undefined" != typeof module)
module.exports = e2();
else if ("function" == typeof define && define.amd)
define([], e2);
else {
("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e2();
}
}(function() {
return function s3(a3, o3, h3) {
function u3(r2, e3) {
if (!o3[r2]) {
if (!a3[r2]) {
var t3 = "function" == typeof __require && __require;
if (!e3 && t3)
return t3(r2, true);
if (l3)
return l3(r2, true);
var n3 = new Error("Cannot find module '" + r2 + "'");
throw n3.code = "MODULE_NOT_FOUND", n3;
}
var i3 = o3[r2] = { exports: {} };
a3[r2][0].call(i3.exports, function(e4) {
var t4 = a3[r2][1][e4];
return u3(t4 || e4);
}, i3, i3.exports, s3, a3, o3, h3);
}
return o3[r2].exports;
}
for (var l3 = "function" == typeof __require && __require, e2 = 0; e2 < h3.length; e2++)
u3(h3[e2]);
return u3;
}({ 1: [function(e2, t3, r2) {
"use strict";
var d2 = e2("./utils"), c4 = e2("./support"), p3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
r2.encode = function(e3) {
for (var t4, r3, n3, i3, s3, a3, o3, h3 = [], u3 = 0, l3 = e3.length, f3 = l3, c5 = "string" !== d2.getTypeOf(e3); u3 < e3.length; )
f3 = l3 - u3, n3 = c5 ? (t4 = e3[u3++], r3 = u3 < l3 ? e3[u3++] : 0, u3 < l3 ? e3[u3++] : 0) : (t4 = e3.charCodeAt(u3++), r3 = u3 < l3 ? e3.charCodeAt(u3++) : 0, u3 < l3 ? e3.charCodeAt(u3++) : 0), i3 = t4 >> 2, s3 = (3 & t4) << 4 | r3 >> 4, a3 = 1 < f3 ? (15 & r3) << 2 | n3 >> 6 : 64, o3 = 2 < f3 ? 63 & n3 : 64, h3.push(p3.charAt(i3) + p3.charAt(s3) + p3.charAt(a3) + p3.charAt(o3));
return h3.join("");
}, r2.decode = function(e3) {
var t4, r3, n3, i3, s3, a3, o3 = 0, h3 = 0, u3 = "data:";
if (e3.substr(0, u3.length) === u3)
throw new Error("Invalid base64 input, it looks like a data url.");
var l3, f3 = 3 * (e3 = e3.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
if (e3.charAt(e3.length - 1) === p3.charAt(64) && f3--, e3.charAt(e3.length - 2) === p3.charAt(64) && f3--, f3 % 1 != 0)
throw new Error("Invalid base64 input, bad content length.");
for (l3 = c4.uint8array ? new Uint8Array(0 | f3) : new Array(0 | f3); o3 < e3.length; )
t4 = p3.indexOf(e3.charAt(o3++)) << 2 | (i3 = p3.indexOf(e3.charAt(o3++))) >> 4, r3 = (15 & i3) << 4 | (s3 = p3.indexOf(e3.charAt(o3++))) >> 2, n3 = (3 & s3) << 6 | (a3 = p3.indexOf(e3.charAt(o3++))), l3[h3++] = t4, 64 !== s3 && (l3[h3++] = r3), 64 !== a3 && (l3[h3++] = n3);
return l3;
};
}, { "./support": 30, "./utils": 32 }], 2: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./external"), i3 = e2("./stream/DataWorker"), s3 = e2("./stream/Crc32Probe"), a3 = e2("./stream/DataLengthProbe");
function o3(e3, t4, r3, n4, i4) {
this.compressedSize = e3, this.uncompressedSize = t4, this.crc32 = r3, this.compression = n4, this.compressedContent = i4;
}
o3.prototype = { getContentWorker: function() {
var e3 = new i3(n3.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a3("data_length")), t4 = this;
return e3.on("end", function() {
if (this.streamInfo.data_length !== t4.uncompressedSize)
throw new Error("Bug : uncompressed data size mismatch");
}), e3;
}, getCompressedWorker: function() {
return new i3(n3.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
} }, o3.createWorkerFrom = function(e3, t4, r3) {
return e3.pipe(new s3()).pipe(new a3("uncompressedSize")).pipe(t4.compressWorker(r3)).pipe(new a3("compressedSize")).withStreamInfo("compression", t4);
}, t3.exports = o3;
}, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./stream/GenericWorker");
r2.STORE = { magic: "\0\0", compressWorker: function() {
return new n3("STORE compression");
}, uncompressWorker: function() {
return new n3("STORE decompression");
} }, r2.DEFLATE = e2("./flate");
}, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./utils");
var o3 = function() {
for (var e3, t4 = [], r3 = 0; r3 < 256; r3++) {
e3 = r3;
for (var n4 = 0; n4 < 8; n4++)
e3 = 1 & e3 ? 3988292384 ^ e3 >>> 1 : e3 >>> 1;
t4[r3] = e3;
}
return t4;
}();
t3.exports = function(e3, t4) {
return void 0 !== e3 && e3.length ? "string" !== n3.getTypeOf(e3) ? function(e4, t5, r3, n4) {
var i3 = o3, s3 = n4 + r3;
e4 ^= -1;
for (var a3 = n4; a3 < s3; a3++)
e4 = e4 >>> 8 ^ i3[255 & (e4 ^ t5[a3])];
return -1 ^ e4;
}(0 | t4, e3, e3.length, 0) : function(e4, t5, r3, n4) {
var i3 = o3, s3 = n4 + r3;
e4 ^= -1;
for (var a3 = n4; a3 < s3; a3++)
e4 = e4 >>> 8 ^ i3[255 & (e4 ^ t5.charCodeAt(a3))];
return -1 ^ e4;
}(0 | t4, e3, e3.length, 0) : 0;
};
}, { "./utils": 32 }], 5: [function(e2, t3, r2) {
"use strict";
r2.base64 = false, r2.binary = false, r2.dir = false, r2.createFolders = true, r2.date = null, r2.compression = null, r2.compressionOptions = null, r2.comment = null, r2.unixPermissions = null, r2.dosPermissions = null;
}, {}], 6: [function(e2, t3, r2) {
"use strict";
var n3 = null;
n3 = "undefined" != typeof Promise ? Promise : e2("lie"), t3.exports = { Promise: n3 };
}, { lie: 37 }], 7: [function(e2, t3, r2) {
"use strict";
var n3 = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i3 = e2("pako"), s3 = e2("./utils"), a3 = e2("./stream/GenericWorker"), o3 = n3 ? "uint8array" : "array";
function h3(e3, t4) {
a3.call(this, "FlateWorker/" + e3), this._pako = null, this._pakoAction = e3, this._pakoOptions = t4, this.meta = {};
}
r2.magic = "\b\0", s3.inherits(h3, a3), h3.prototype.processChunk = function(e3) {
this.meta = e3.meta, null === this._pako && this._createPako(), this._pako.push(s3.transformTo(o3, e3.data), false);
}, h3.prototype.flush = function() {
a3.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true);
}, h3.prototype.cleanUp = function() {
a3.prototype.cleanUp.call(this), this._pako = null;
}, h3.prototype._createPako = function() {
this._pako = new i3[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 });
var t4 = this;
this._pako.onData = function(e3) {
t4.push({ data: e3, meta: t4.meta });
};
}, r2.compressWorker = function(e3) {
return new h3("Deflate", e3);
}, r2.uncompressWorker = function() {
return new h3("Inflate", {});
};
}, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e2, t3, r2) {
"use strict";
function A3(e3, t4) {
var r3, n4 = "";
for (r3 = 0; r3 < t4; r3++)
n4 += String.fromCharCode(255 & e3), e3 >>>= 8;
return n4;
}
function n3(e3, t4, r3, n4, i4, s4) {
var a3, o3, h3 = e3.file, u3 = e3.compression, l3 = s4 !== O3.utf8encode, f3 = I2.transformTo("string", s4(h3.name)), c4 = I2.transformTo("string", O3.utf8encode(h3.name)), d2 = h3.comment, p3 = I2.transformTo("string", s4(d2)), m4 = I2.transformTo("string", O3.utf8encode(d2)), _3 = c4.length !== h3.name.length, g2 = m4.length !== d2.length, b2 = "", v3 = "", y4 = "", w2 = h3.dir, k2 = h3.date, x3 = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
t4 && !r3 || (x3.crc32 = e3.crc32, x3.compressedSize = e3.compressedSize, x3.uncompressedSize = e3.uncompressedSize);
var S2 = 0;
t4 && (S2 |= 8), l3 || !_3 && !g2 || (S2 |= 2048);
var z2 = 0, C2 = 0;
w2 && (z2 |= 16), "UNIX" === i4 ? (C2 = 798, z2 |= function(e4, t5) {
var r4 = e4;
return e4 || (r4 = t5 ? 16893 : 33204), (65535 & r4) << 16;
}(h3.unixPermissions, w2)) : (C2 = 20, z2 |= function(e4) {
return 63 & (e4 || 0);
}(h3.dosPermissions)), a3 = k2.getUTCHours(), a3 <<= 6, a3 |= k2.getUTCMinutes(), a3 <<= 5, a3 |= k2.getUTCSeconds() / 2, o3 = k2.getUTCFullYear() - 1980, o3 <<= 4, o3 |= k2.getUTCMonth() + 1, o3 <<= 5, o3 |= k2.getUTCDate(), _3 && (v3 = A3(1, 1) + A3(B2(f3), 4) + c4, b2 += "up" + A3(v3.length, 2) + v3), g2 && (y4 = A3(1, 1) + A3(B2(p3), 4) + m4, b2 += "uc" + A3(y4.length, 2) + y4);
var E2 = "";
return E2 += "\n\0", E2 += A3(S2, 2), E2 += u3.magic, E2 += A3(a3, 2), E2 += A3(o3, 2), E2 += A3(x3.crc32, 4), E2 += A3(x3.compressedSize, 4), E2 += A3(x3.uncompressedSize, 4), E2 += A3(f3.length, 2), E2 += A3(b2.length, 2), { fileRecord: R2.LOCAL_FILE_HEADER + E2 + f3 + b2, dirRecord: R2.CENTRAL_FILE_HEADER + A3(C2, 2) + E2 + A3(p3.length, 2) + "\0\0\0\0" + A3(z2, 4) + A3(n4, 4) + f3 + b2 + p3 };
}
var I2 = e2("../utils"), i3 = e2("../stream/GenericWorker"), O3 = e2("../utf8"), B2 = e2("../crc32"), R2 = e2("../signature");
function s3(e3, t4, r3, n4) {
i3.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t4, this.zipPlatform = r3, this.encodeFileName = n4, this.streamFiles = e3, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
}
I2.inherits(s3, i3), s3.prototype.push = function(e3) {
var t4 = e3.meta.percent || 0, r3 = this.entriesCount, n4 = this._sources.length;
this.accumulate ? this.contentBuffer.push(e3) : (this.bytesWritten += e3.data.length, i3.prototype.push.call(this, { data: e3.data, meta: { currentFile: this.currentFile, percent: r3 ? (t4 + 100 * (r3 - n4 - 1)) / r3 : 100 } }));
}, s3.prototype.openedSource = function(e3) {
this.currentSourceOffset = this.bytesWritten, this.currentFile = e3.file.name;
var t4 = this.streamFiles && !e3.file.dir;
if (t4) {
var r3 = n3(e3, t4, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
this.push({ data: r3.fileRecord, meta: { percent: 0 } });
} else
this.accumulate = true;
}, s3.prototype.closedSource = function(e3) {
this.accumulate = false;
var t4 = this.streamFiles && !e3.file.dir, r3 = n3(e3, t4, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
if (this.dirRecords.push(r3.dirRecord), t4)
this.push({ data: function(e4) {
return R2.DATA_DESCRIPTOR + A3(e4.crc32, 4) + A3(e4.compressedSize, 4) + A3(e4.uncompressedSize, 4);
}(e3), meta: { percent: 100 } });
else
for (this.push({ data: r3.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; )
this.push(this.contentBuffer.shift());
this.currentFile = null;
}, s3.prototype.flush = function() {
for (var e3 = this.bytesWritten, t4 = 0; t4 < this.dirRecords.length; t4++)
this.push({ data: this.dirRecords[t4], meta: { percent: 100 } });
var r3 = this.bytesWritten - e3, n4 = function(e4, t5, r4, n5, i4) {
var s4 = I2.transformTo("string", i4(n5));
return R2.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A3(e4, 2) + A3(e4, 2) + A3(t5, 4) + A3(r4, 4) + A3(s4.length, 2) + s4;
}(this.dirRecords.length, r3, e3, this.zipComment, this.encodeFileName);
this.push({ data: n4, meta: { percent: 100 } });
}, s3.prototype.prepareNextSource = function() {
this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
}, s3.prototype.registerPrevious = function(e3) {
this._sources.push(e3);
var t4 = this;
return e3.on("data", function(e4) {
t4.processChunk(e4);
}), e3.on("end", function() {
t4.closedSource(t4.previous.streamInfo), t4._sources.length ? t4.prepareNextSource() : t4.end();
}), e3.on("error", function(e4) {
t4.error(e4);
}), this;
}, s3.prototype.resume = function() {
return !!i3.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true));
}, s3.prototype.error = function(e3) {
var t4 = this._sources;
if (!i3.prototype.error.call(this, e3))
return false;
for (var r3 = 0; r3 < t4.length; r3++)
try {
t4[r3].error(e3);
} catch (e4) {
}
return true;
}, s3.prototype.lock = function() {
i3.prototype.lock.call(this);
for (var e3 = this._sources, t4 = 0; t4 < e3.length; t4++)
e3[t4].lock();
}, t3.exports = s3;
}, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e2, t3, r2) {
"use strict";
var u3 = e2("../compressions"), n3 = e2("./ZipFileWorker");
r2.generateWorker = function(e3, a3, t4) {
var o3 = new n3(a3.streamFiles, t4, a3.platform, a3.encodeFileName), h3 = 0;
try {
e3.forEach(function(e4, t5) {
h3++;
var r3 = function(e5, t6) {
var r4 = e5 || t6, n5 = u3[r4];
if (!n5)
throw new Error(r4 + " is not a valid compression method !");
return n5;
}(t5.options.compression, a3.compression), n4 = t5.options.compressionOptions || a3.compressionOptions || {}, i3 = t5.dir, s3 = t5.date;
t5._compressWorker(r3, n4).withStreamInfo("file", { name: e4, dir: i3, date: s3, comment: t5.comment || "", unixPermissions: t5.unixPermissions, dosPermissions: t5.dosPermissions }).pipe(o3);
}), o3.entriesCount = h3;
} catch (e4) {
o3.error(e4);
}
return o3;
};
}, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e2, t3, r2) {
"use strict";
function n3() {
if (!(this instanceof n3))
return new n3();
if (arguments.length)
throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
var e3 = new n3();
for (var t4 in this)
"function" != typeof this[t4] && (e3[t4] = this[t4]);
return e3;
};
}
(n3.prototype = e2("./object")).loadAsync = e2("./load"), n3.support = e2("./support"), n3.defaults = e2("./defaults"), n3.version = "3.10.1", n3.loadAsync = function(e3, t4) {
return new n3().loadAsync(e3, t4);
}, n3.external = e2("./external"), t3.exports = n3;
}, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e2, t3, r2) {
"use strict";
var u3 = e2("./utils"), i3 = e2("./external"), n3 = e2("./utf8"), s3 = e2("./zipEntries"), a3 = e2("./stream/Crc32Probe"), l3 = e2("./nodejsUtils");
function f3(n4) {
return new i3.Promise(function(e3, t4) {
var r3 = n4.decompressed.getContentWorker().pipe(new a3());
r3.on("error", function(e4) {
t4(e4);
}).on("end", function() {
r3.streamInfo.crc32 !== n4.decompressed.crc32 ? t4(new Error("Corrupted zip : CRC32 mismatch")) : e3();
}).resume();
});
}
t3.exports = function(e3, o3) {
var h3 = this;
return o3 = u3.extend(o3 || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n3.utf8decode }), l3.isNode && l3.isStream(e3) ? i3.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u3.prepareContent("the loaded zip file", e3, true, o3.optimizedBinaryString, o3.base64).then(function(e4) {
var t4 = new s3(o3);
return t4.load(e4), t4;
}).then(function(e4) {
var t4 = [i3.Promise.resolve(e4)], r3 = e4.files;
if (o3.checkCRC32)
for (var n4 = 0; n4 < r3.length; n4++)
t4.push(f3(r3[n4]));
return i3.Promise.all(t4);
}).then(function(e4) {
for (var t4 = e4.shift(), r3 = t4.files, n4 = 0; n4 < r3.length; n4++) {
var i4 = r3[n4], s4 = i4.fileNameStr, a4 = u3.resolve(i4.fileNameStr);
h3.file(a4, i4.decompressed, { binary: true, optimizedBinaryString: true, date: i4.date, dir: i4.dir, comment: i4.fileCommentStr.length ? i4.fileCommentStr : null, unixPermissions: i4.unixPermissions, dosPermissions: i4.dosPermissions, createFolders: o3.createFolders }), i4.dir || (h3.file(a4).unsafeOriginalName = s4);
}
return t4.zipComment.length && (h3.comment = t4.zipComment), h3;
});
};
}, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e2, t3, r2) {
"use strict";
var n3 = e2("../utils"), i3 = e2("../stream/GenericWorker");
function s3(e3, t4) {
i3.call(this, "Nodejs stream input adapter for " + e3), this._upstreamEnded = false, this._bindStream(t4);
}
n3.inherits(s3, i3), s3.prototype._bindStream = function(e3) {
var t4 = this;
(this._stream = e3).pause(), e3.on("data", function(e4) {
t4.push({ data: e4, meta: { percent: 0 } });
}).on("error", function(e4) {
t4.isPaused ? this.generatedError = e4 : t4.error(e4);
}).on("end", function() {
t4.isPaused ? t4._upstreamEnded = true : t4.end();
});
}, s3.prototype.pause = function() {
return !!i3.prototype.pause.call(this) && (this._stream.pause(), true);
}, s3.prototype.resume = function() {
return !!i3.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true);
}, t3.exports = s3;
}, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e2, t3, r2) {
"use strict";
var i3 = e2("readable-stream").Readable;
function n3(e3, t4, r3) {
i3.call(this, t4), this._helper = e3;
var n4 = this;
e3.on("data", function(e4, t5) {
n4.push(e4) || n4._helper.pause(), r3 && r3(t5);
}).on("error", function(e4) {
n4.emit("error", e4);
}).on("end", function() {
n4.push(null);
});
}
e2("../utils").inherits(n3, i3), n3.prototype._read = function() {
this._helper.resume();
}, t3.exports = n3;
}, { "../utils": 32, "readable-stream": 16 }], 14: [function(e2, t3, r2) {
"use strict";
t3.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e3, t4) {
if (Buffer.from && Buffer.from !== Uint8Array.from)
return Buffer.from(e3, t4);
if ("number" == typeof e3)
throw new Error('The "data" argument must not be a number');
return new Buffer(e3, t4);
}, allocBuffer: function(e3) {
if (Buffer.alloc)
return Buffer.alloc(e3);
var t4 = new Buffer(e3);
return t4.fill(0), t4;
}, isBuffer: function(e3) {
return Buffer.isBuffer(e3);
}, isStream: function(e3) {
return e3 && "function" == typeof e3.on && "function" == typeof e3.pause && "function" == typeof e3.resume;
} };
}, {}], 15: [function(e2, t3, r2) {
"use strict";
function s3(e3, t4, r3) {
var n4, i4 = u3.getTypeOf(t4), s4 = u3.extend(r3 || {}, f3);
s4.date = s4.date || /* @__PURE__ */ new Date(), null !== s4.compression && (s4.compression = s4.compression.toUpperCase()), "string" == typeof s4.unixPermissions && (s4.unixPermissions = parseInt(s4.unixPermissions, 8)), s4.unixPermissions && 16384 & s4.unixPermissions && (s4.dir = true), s4.dosPermissions && 16 & s4.dosPermissions && (s4.dir = true), s4.dir && (e3 = g2(e3)), s4.createFolders && (n4 = _3(e3)) && b2.call(this, n4, true);
var a4 = "string" === i4 && false === s4.binary && false === s4.base64;
r3 && void 0 !== r3.binary || (s4.binary = !a4), (t4 instanceof c4 && 0 === t4.uncompressedSize || s4.dir || !t4 || 0 === t4.length) && (s4.base64 = false, s4.binary = true, t4 = "", s4.compression = "STORE", i4 = "string");
var o4 = null;
o4 = t4 instanceof c4 || t4 instanceof l3 ? t4 : p3.isNode && p3.isStream(t4) ? new m4(e3, t4) : u3.prepareContent(e3, t4, s4.binary, s4.optimizedBinaryString, s4.base64);
var h4 = new d2(e3, o4, s4);
this.files[e3] = h4;
}
var i3 = e2("./utf8"), u3 = e2("./utils"), l3 = e2("./stream/GenericWorker"), a3 = e2("./stream/StreamHelper"), f3 = e2("./defaults"), c4 = e2("./compressedObject"), d2 = e2("./zipObject"), o3 = e2("./generate"), p3 = e2("./nodejsUtils"), m4 = e2("./nodejs/NodejsStreamInputAdapter"), _3 = function(e3) {
"/" === e3.slice(-1) && (e3 = e3.substring(0, e3.length - 1));
var t4 = e3.lastIndexOf("/");
return 0 < t4 ? e3.substring(0, t4) : "";
}, g2 = function(e3) {
return "/" !== e3.slice(-1) && (e3 += "/"), e3;
}, b2 = function(e3, t4) {
return t4 = void 0 !== t4 ? t4 : f3.createFolders, e3 = g2(e3), this.files[e3] || s3.call(this, e3, null, { dir: true, createFolders: t4 }), this.files[e3];
};
function h3(e3) {
return "[object RegExp]" === Object.prototype.toString.call(e3);
}
var n3 = { load: function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, forEach: function(e3) {
var t4, r3, n4;
for (t4 in this.files)
n4 = this.files[t4], (r3 = t4.slice(this.root.length, t4.length)) && t4.slice(0, this.root.length) === this.root && e3(r3, n4);
}, filter: function(r3) {
var n4 = [];
return this.forEach(function(e3, t4) {
r3(e3, t4) && n4.push(t4);
}), n4;
}, file: function(e3, t4, r3) {
if (1 !== arguments.length)
return e3 = this.root + e3, s3.call(this, e3, t4, r3), this;
if (h3(e3)) {
var n4 = e3;
return this.filter(function(e4, t5) {
return !t5.dir && n4.test(e4);
});
}
var i4 = this.files[this.root + e3];
return i4 && !i4.dir ? i4 : null;
}, folder: function(r3) {
if (!r3)
return this;
if (h3(r3))
return this.filter(function(e4, t5) {
return t5.dir && r3.test(e4);
});
var e3 = this.root + r3, t4 = b2.call(this, e3), n4 = this.clone();
return n4.root = t4.name, n4;
}, remove: function(r3) {
r3 = this.root + r3;
var e3 = this.files[r3];
if (e3 || ("/" !== r3.slice(-1) && (r3 += "/"), e3 = this.files[r3]), e3 && !e3.dir)
delete this.files[r3];
else
for (var t4 = this.filter(function(e4, t5) {
return t5.name.slice(0, r3.length) === r3;
}), n4 = 0; n4 < t4.length; n4++)
delete this.files[t4[n4].name];
return this;
}, generate: function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, generateInternalStream: function(e3) {
var t4, r3 = {};
try {
if ((r3 = u3.extend(e3 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i3.utf8encode })).type = r3.type.toLowerCase(), r3.compression = r3.compression.toUpperCase(), "binarystring" === r3.type && (r3.type = "string"), !r3.type)
throw new Error("No output type specified.");
u3.checkSupport(r3.type), "darwin" !== r3.platform && "freebsd" !== r3.platform && "linux" !== r3.platform && "sunos" !== r3.platform || (r3.platform = "UNIX"), "win32" === r3.platform && (r3.platform = "DOS");
var n4 = r3.comment || this.comment || "";
t4 = o3.generateWorker(this, r3, n4);
} catch (e4) {
(t4 = new l3("error")).error(e4);
}
return new a3(t4, r3.type || "string", r3.mimeType);
}, generateAsync: function(e3, t4) {
return this.generateInternalStream(e3).accumulate(t4);
}, generateNodeStream: function(e3, t4) {
return (e3 = e3 || {}).type || (e3.type = "nodebuffer"), this.generateInternalStream(e3).toNodejsStream(t4);
} };
t3.exports = n3;
}, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e2, t3, r2) {
"use strict";
t3.exports = e2("stream");
}, { stream: void 0 }], 17: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./DataReader");
function i3(e3) {
n3.call(this, e3);
for (var t4 = 0; t4 < this.data.length; t4++)
e3[t4] = 255 & e3[t4];
}
e2("../utils").inherits(i3, n3), i3.prototype.byteAt = function(e3) {
return this.data[this.zero + e3];
}, i3.prototype.lastIndexOfSignature = function(e3) {
for (var t4 = e3.charCodeAt(0), r3 = e3.charCodeAt(1), n4 = e3.charCodeAt(2), i4 = e3.charCodeAt(3), s3 = this.length - 4; 0 <= s3; --s3)
if (this.data[s3] === t4 && this.data[s3 + 1] === r3 && this.data[s3 + 2] === n4 && this.data[s3 + 3] === i4)
return s3 - this.zero;
return -1;
}, i3.prototype.readAndCheckSignature = function(e3) {
var t4 = e3.charCodeAt(0), r3 = e3.charCodeAt(1), n4 = e3.charCodeAt(2), i4 = e3.charCodeAt(3), s3 = this.readData(4);
return t4 === s3[0] && r3 === s3[1] && n4 === s3[2] && i4 === s3[3];
}, i3.prototype.readData = function(e3) {
if (this.checkOffset(e3), 0 === e3)
return [];
var t4 = this.data.slice(this.zero + this.index, this.zero + this.index + e3);
return this.index += e3, t4;
}, t3.exports = i3;
}, { "../utils": 32, "./DataReader": 18 }], 18: [function(e2, t3, r2) {
"use strict";
var n3 = e2("../utils");
function i3(e3) {
this.data = e3, this.length = e3.length, this.index = 0, this.zero = 0;
}
i3.prototype = { checkOffset: function(e3) {
this.checkIndex(this.index + e3);
}, checkIndex: function(e3) {
if (this.length < this.zero + e3 || e3 < 0)
throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e3 + "). Corrupted zip ?");
}, setIndex: function(e3) {
this.checkIndex(e3), this.index = e3;
}, skip: function(e3) {
this.setIndex(this.index + e3);
}, byteAt: function() {
}, readInt: function(e3) {
var t4, r3 = 0;
for (this.checkOffset(e3), t4 = this.index + e3 - 1; t4 >= this.index; t4--)
r3 = (r3 << 8) + this.byteAt(t4);
return this.index += e3, r3;
}, readString: function(e3) {
return n3.transformTo("string", this.readData(e3));
}, readData: function() {
}, lastIndexOfSignature: function() {
}, readAndCheckSignature: function() {
}, readDate: function() {
var e3 = this.readInt(4);
return new Date(Date.UTC(1980 + (e3 >> 25 & 127), (e3 >> 21 & 15) - 1, e3 >> 16 & 31, e3 >> 11 & 31, e3 >> 5 & 63, (31 & e3) << 1));
} }, t3.exports = i3;
}, { "../utils": 32 }], 19: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./Uint8ArrayReader");
function i3(e3) {
n3.call(this, e3);
}
e2("../utils").inherits(i3, n3), i3.prototype.readData = function(e3) {
this.checkOffset(e3);
var t4 = this.data.slice(this.zero + this.index, this.zero + this.index + e3);
return this.index += e3, t4;
}, t3.exports = i3;
}, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./DataReader");
function i3(e3) {
n3.call(this, e3);
}
e2("../utils").inherits(i3, n3), i3.prototype.byteAt = function(e3) {
return this.data.charCodeAt(this.zero + e3);
}, i3.prototype.lastIndexOfSignature = function(e3) {
return this.data.lastIndexOf(e3) - this.zero;
}, i3.prototype.readAndCheckSignature = function(e3) {
return e3 === this.readData(4);
}, i3.prototype.readData = function(e3) {
this.checkOffset(e3);
var t4 = this.data.slice(this.zero + this.index, this.zero + this.index + e3);
return this.index += e3, t4;
}, t3.exports = i3;
}, { "../utils": 32, "./DataReader": 18 }], 21: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./ArrayReader");
function i3(e3) {
n3.call(this, e3);
}
e2("../utils").inherits(i3, n3), i3.prototype.readData = function(e3) {
if (this.checkOffset(e3), 0 === e3)
return new Uint8Array(0);
var t4 = this.data.subarray(this.zero + this.index, this.zero + this.index + e3);
return this.index += e3, t4;
}, t3.exports = i3;
}, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e2, t3, r2) {
"use strict";
var n3 = e2("../utils"), i3 = e2("../support"), s3 = e2("./ArrayReader"), a3 = e2("./StringReader"), o3 = e2("./NodeBufferReader"), h3 = e2("./Uint8ArrayReader");
t3.exports = function(e3) {
var t4 = n3.getTypeOf(e3);
return n3.checkSupport(t4), "string" !== t4 || i3.uint8array ? "nodebuffer" === t4 ? new o3(e3) : i3.uint8array ? new h3(n3.transformTo("uint8array", e3)) : new s3(n3.transformTo("array", e3)) : new a3(e3);
};
}, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e2, t3, r2) {
"use strict";
r2.LOCAL_FILE_HEADER = "PK", r2.CENTRAL_FILE_HEADER = "PK", r2.CENTRAL_DIRECTORY_END = "PK", r2.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r2.ZIP64_CENTRAL_DIRECTORY_END = "PK", r2.DATA_DESCRIPTOR = "PK\x07\b";
}, {}], 24: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./GenericWorker"), i3 = e2("../utils");
function s3(e3) {
n3.call(this, "ConvertWorker to " + e3), this.destType = e3;
}
i3.inherits(s3, n3), s3.prototype.processChunk = function(e3) {
this.push({ data: i3.transformTo(this.destType, e3.data), meta: e3.meta });
}, t3.exports = s3;
}, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e2, t3, r2) {
"use strict";
var n3 = e2("./GenericWorker"), i3 = e2("../crc32");
function s3() {
n3.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
}
e2("../utils").inherits(s3, n3), s3.prototype.processChunk = function(e3) {
this.streamInfo.crc32 = i3(e3.data, this.streamInfo.crc32 || 0), this.push(e3);
}, t3.exports = s3;
}, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e2, t3, r2) {
"use strict";
var n3 = e2("../utils"), i3 = e2("./GenericWorker");
function s3(e3) {
i3.call(this, "DataLengthProbe for " + e3), this.propName = e3, this.withStreamInfo(e3, 0);
}
n3.inherits(s3, i3), s3.prototype.processChunk = function(e3) {
if (e3) {
var t4 = this.streamInfo[this.propName] || 0;
this.streamInfo[this.propName] = t4 + e3.data.length;
}
i3.prototype.processChunk.call(this, e3);
}, t3.exports = s3;
}, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e2, t3, r2) {
"use strict";
var n3 = e2("../utils"), i3 = e2("./GenericWorker");
function s3(e3) {
i3.call(this, "DataWorker");
var t4 = this;
this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e3.then(function(e4) {
t4.dataIsReady = true, t4.data = e4, t4.max = e4 && e4.length || 0, t4.type = n3.getTypeOf(e4), t4.isPaused || t4._tickAndRepeat();
}, function(e4) {
t4.error(e4);
});
}
n3.inherits(s3, i3), s3.prototype.cleanUp = function() {
i3.prototype.cleanUp.call(this), this.data = null;
}, s3.prototype.resume = function() {
return !!i3.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n3.delay(this._tickAndRepeat, [], this)), true);
}, s3.prototype._tickAndRepeat = function() {
this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n3.delay(this._tickAndRepeat, [], this), this._tickScheduled = true));
}, s3.prototype._tick = function() {
if (this.isPaused || this.isFinished)
return false;
var e3 = null, t4 = Math.min(this.max, this.index + 16384);
if (this.index >= this.max)
return this.end();
switch (this.type) {
case "string":
e3 = this.data.substring(this.index, t4);
break;
case "uint8array":
e3 = this.data.subarray(this.index, t4);
break;
case "array":
case "nodebuffer":
e3 = this.data.slice(this.index, t4);
}
return this.index = t4, this.push({ data: e3, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
}, t3.exports = s3;
}, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e2, t3, r2) {
"use strict";
function n3(e3) {
this.name = e3 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
}
n3.prototype = { push: function(e3) {
this.emit("data", e3);
}, end: function() {
if (this.isFinished)
return false;
this.flush();
try {
this.emit("end"), this.cleanUp(), this.isFinished = true;
} catch (e3) {
this.emit("error", e3);
}
return true;
}, error: function(e3) {
return !this.isFinished && (this.isPaused ? this.generatedError = e3 : (this.isFinished = true, this.emit("error", e3), this.previous && this.previous.error(e3), this.cleanUp()), true);
}, on: function(e3, t4) {
return this._listeners[e3].push(t4), this;
}, cleanUp: function() {
this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
}, emit: function(e3, t4) {
if (this._listeners[e3])
for (var r3 = 0; r3 < this._listeners[e3].length; r3++)
this._listeners[e3][r3].call(this, t4);
}, pipe: function(e3) {
return e3.registerPrevious(this);
}, registerPrevious: function(e3) {
if (this.isLocked)
throw new Error("The stream '" + this + "' has already been used.");
this.streamInfo = e3.streamInfo, this.mergeStreamInfo(), this.previous = e3;
var t4 = this;
return e3.on("data", function(e4) {
t4.processChunk(e4);
}), e3.on("end", function() {
t4.end();
}), e3.on("error", function(e4) {
t4.error(e4);
}), this;
}, pause: function() {
return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true);