(() => {
    var __webpack_modules__ = [ , (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        const tslib_1 = __webpack_require__(2);
        (0, tslib_1.__exportStar)(__webpack_require__(3), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(83), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(91), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(87), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(117), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(143), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(144), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(53), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(145), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(179), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(180), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(28), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(181), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(221), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(54), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(90), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(252), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(253), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(254), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(255), exports);
        (0, tslib_1.__exportStar)(__webpack_require__(187), exports);
    }, (__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
        "use strict";
        __webpack_require__.r(__webpack_exports__);
        __webpack_require__.d(__webpack_exports__, {
            __extends: () => __extends,
            __assign: () => __assign,
            __rest: () => __rest,
            __decorate: () => __decorate,
            __param: () => __param,
            __metadata: () => __metadata,
            __awaiter: () => __awaiter,
            __generator: () => __generator,
            __createBinding: () => __createBinding,
            __exportStar: () => __exportStar,
            __values: () => __values,
            __read: () => __read,
            __spread: () => __spread,
            __spreadArrays: () => __spreadArrays,
            __spreadArray: () => __spreadArray,
            __await: () => __await,
            __asyncGenerator: () => __asyncGenerator,
            __asyncDelegator: () => __asyncDelegator,
            __asyncValues: () => __asyncValues,
            __makeTemplateObject: () => __makeTemplateObject,
            __importStar: () => __importStar,
            __importDefault: () => __importDefault,
            __classPrivateFieldGet: () => __classPrivateFieldGet,
            __classPrivateFieldSet: () => __classPrivateFieldSet
        });
        var extendStatics = function(d, b) {
            extendStatics = Object.setPrototypeOf || {
                __proto__: []
            } instanceof Array && function(d, b) {
                d.__proto__ = b;
            } || function(d, b) {
                for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
            };
            return extendStatics(d, b);
        };
        function __extends(d, b) {
            if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
            extendStatics(d, b);
            function __() {
                this.constructor = d;
            }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __);
        }
        var __assign = function() {
            __assign = Object.assign || function __assign(t) {
                for (var s, i = 1, n = arguments.length; i < n; i++) {
                    s = arguments[i];
                    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
                }
                return t;
            };
            return __assign.apply(this, arguments);
        };
        function __rest(s, e) {
            var t = {};
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
            if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
            }
            return t;
        }
        function __decorate(decorators, target, key, desc) {
            var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
            if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
            return c > 3 && r && Object.defineProperty(target, key, r), r;
        }
        function __param(paramIndex, decorator) {
            return function(target, key) {
                decorator(target, key, paramIndex);
            };
        }
        function __metadata(metadataKey, metadataValue) {
            if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
        }
        function __awaiter(thisArg, _arguments, P, generator) {
            function adopt(value) {
                return value instanceof P ? value : new P((function(resolve) {
                    resolve(value);
                }));
            }
            return new (P || (P = Promise))((function(resolve, reject) {
                function fulfilled(value) {
                    try {
                        step(generator.next(value));
                    } catch (e) {
                        reject(e);
                    }
                }
                function rejected(value) {
                    try {
                        step(generator["throw"](value));
                    } catch (e) {
                        reject(e);
                    }
                }
                function step(result) {
                    result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
                }
                step((generator = generator.apply(thisArg, _arguments || [])).next());
            }));
        }
        function __generator(thisArg, body) {
            var _ = {
                label: 0,
                sent: function() {
                    if (t[0] & 1) throw t[1];
                    return t[1];
                },
                trys: [],
                ops: []
            }, f, y, t, g;
            return g = {
                next: verb(0),
                throw: verb(1),
                return: verb(2)
            }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
                return this;
            }), g;
            function verb(n) {
                return function(v) {
                    return step([ n, v ]);
                };
            }
            function step(op) {
                if (f) throw new TypeError("Generator is already executing.");
                while (_) try {
                    if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 
                    0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                    if (y = 0, t) op = [ op[0] & 2, t.value ];
                    switch (op[0]) {
                      case 0:
                      case 1:
                        t = op;
                        break;

                      case 4:
                        _.label++;
                        return {
                            value: op[1],
                            done: false
                        };

                      case 5:
                        _.label++;
                        y = op[1];
                        op = [ 0 ];
                        continue;

                      case 7:
                        op = _.ops.pop();
                        _.trys.pop();
                        continue;

                      default:
                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                            _ = 0;
                            continue;
                        }
                        if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                            _.label = op[1];
                            break;
                        }
                        if (op[0] === 6 && _.label < t[1]) {
                            _.label = t[1];
                            t = op;
                            break;
                        }
                        if (t && _.label < t[2]) {
                            _.label = t[2];
                            _.ops.push(op);
                            break;
                        }
                        if (t[2]) _.ops.pop();
                        _.trys.pop();
                        continue;
                    }
                    op = body.call(thisArg, _);
                } catch (e) {
                    op = [ 6, e ];
                    y = 0;
                } finally {
                    f = t = 0;
                }
                if (op[0] & 5) throw op[1];
                return {
                    value: op[0] ? op[1] : void 0,
                    done: true
                };
            }
        }
        var __createBinding = Object.create ? function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            Object.defineProperty(o, k2, {
                enumerable: true,
                get: function() {
                    return m[k];
                }
            });
        } : function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            o[k2] = m[k];
        };
        function __exportStar(m, o) {
            for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
        }
        function __values(o) {
            var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
            if (m) return m.call(o);
            if (o && typeof o.length === "number") return {
                next: function() {
                    if (o && i >= o.length) o = void 0;
                    return {
                        value: o && o[i++],
                        done: !o
                    };
                }
            };
            throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
        }
        function __read(o, n) {
            var m = typeof Symbol === "function" && o[Symbol.iterator];
            if (!m) return o;
            var i = m.call(o), r, ar = [], e;
            try {
                while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
            } catch (error) {
                e = {
                    error
                };
            } finally {
                try {
                    if (r && !r.done && (m = i["return"])) m.call(i);
                } finally {
                    if (e) throw e.error;
                }
            }
            return ar;
        }
        function __spread() {
            for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
            return ar;
        }
        function __spreadArrays() {
            for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
            for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, 
            k++) r[k] = a[j];
            return r;
        }
        function __spreadArray(to, from) {
            for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i];
            return to;
        }
        function __await(v) {
            return this instanceof __await ? (this.v = v, this) : new __await(v);
        }
        function __asyncGenerator(thisArg, _arguments, generator) {
            if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
            var g = generator.apply(thisArg, _arguments || []), i, q = [];
            return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
                return this;
            }, i;
            function verb(n) {
                if (g[n]) i[n] = function(v) {
                    return new Promise((function(a, b) {
                        q.push([ n, v, a, b ]) > 1 || resume(n, v);
                    }));
                };
            }
            function resume(n, v) {
                try {
                    step(g[n](v));
                } catch (e) {
                    settle(q[0][3], e);
                }
            }
            function step(r) {
                r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
            }
            function fulfill(value) {
                resume("next", value);
            }
            function reject(value) {
                resume("throw", value);
            }
            function settle(f, v) {
                if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
            }
        }
        function __asyncDelegator(o) {
            var i, p;
            return i = {}, verb("next"), verb("throw", (function(e) {
                throw e;
            })), verb("return"), i[Symbol.iterator] = function() {
                return this;
            }, i;
            function verb(n, f) {
                i[n] = o[n] ? function(v) {
                    return (p = !p) ? {
                        value: __await(o[n](v)),
                        done: n === "return"
                    } : f ? f(v) : v;
                } : f;
            }
        }
        function __asyncValues(o) {
            if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
            var m = o[Symbol.asyncIterator], i;
            return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), 
            i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
                return this;
            }, i);
            function verb(n) {
                i[n] = o[n] && function(v) {
                    return new Promise((function(resolve, reject) {
                        v = o[n](v), settle(resolve, reject, v.done, v.value);
                    }));
                };
            }
            function settle(resolve, reject, d, v) {
                Promise.resolve(v).then((function(v) {
                    resolve({
                        value: v,
                        done: d
                    });
                }), reject);
            }
        }
        function __makeTemplateObject(cooked, raw) {
            if (Object.defineProperty) {
                Object.defineProperty(cooked, "raw", {
                    value: raw
                });
            } else {
                cooked.raw = raw;
            }
            return cooked;
        }
        var __setModuleDefault = Object.create ? function(o, v) {
            Object.defineProperty(o, "default", {
                enumerable: true,
                value: v
            });
        } : function(o, v) {
            o["default"] = v;
        };
        function __importStar(mod) {
            if (mod && mod.__esModule) return mod;
            var result = {};
            if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
            __setModuleDefault(result, mod);
            return result;
        }
        function __importDefault(mod) {
            return mod && mod.__esModule ? mod : {
                default: mod
            };
        }
        function __classPrivateFieldGet(receiver, privateMap) {
            if (!privateMap.has(receiver)) {
                throw new TypeError("attempted to get private field on non-instance");
            }
            return privateMap.get(receiver);
        }
        function __classPrivateFieldSet(receiver, privateMap, value) {
            if (!privateMap.has(receiver)) {
                throw new TypeError("attempted to set private field on non-instance");
            }
            privateMap.set(receiver, value);
            return value;
        }
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BlockDevice = void 0;
        const direct_io_1 = __webpack_require__(4);
        const fs_1 = __webpack_require__(5);
        const os_1 = __webpack_require__(6);
        const block_write_stream_1 = __webpack_require__(7);
        const constants_1 = __webpack_require__(18);
        const diskpart_1 = __webpack_require__(30);
        const lazy_1 = __webpack_require__(36);
        const sparse_write_stream_1 = __webpack_require__(52);
        const utils_1 = __webpack_require__(21);
        const file_1 = __webpack_require__(53);
        const UNMOUNT_ON_SUCCESS_TIMEOUT_MS = 2e3;
        const WIN32_FIRST_BYTES_TO_KEEP = 64 * 1024;
        class BlockDevice extends file_1.File {
            constructor({drive, unmountOnSuccess = false, write = false, direct = true}) {
                super({
                    path: drive.raw,
                    write
                });
                this.emitsProgress = false;
                this.drive = drive;
                this.unmountOnSuccess = unmountOnSuccess;
                this.oDirect = direct;
                this.alignment = Math.min(drive.blockSize || constants_1.DEFAULT_ALIGNMENT, 4 * 1024 ** 2);
            }
            getAlignment() {
                if (this.oDirect) {
                    return this.alignment;
                }
            }
            getOpenFlags() {
                let flags = this.oWrite ? fs_1.constants.O_RDWR : fs_1.constants.O_RDONLY;
                if (this.oDirect) {
                    flags |= fs_1.constants.O_DIRECT;
                }
                if (this.oWrite) {
                    const plat = (0, os_1.platform)();
                    if (plat === "linux") {
                        flags |= fs_1.constants.O_EXCL;
                    } else if (plat === "darwin") {
                        flags |= direct_io_1.O_EXLOCK;
                    }
                }
                return flags;
            }
            get isSystem() {
                return this.drive.isSystem;
            }
            get raw() {
                return this.drive.raw;
            }
            get device() {
                return this.drive.device;
            }
            get devicePath() {
                return this.drive.devicePath;
            }
            get description() {
                return this.drive.description;
            }
            get mountpoints() {
                return this.drive.mountpoints;
            }
            get size() {
                return this.drive.size;
            }
            async _getMetadata() {
                return {
                    size: this.drive.size || undefined,
                    name: this.drive.device
                };
            }
            async canWrite() {
                return !this.drive.isReadOnly;
            }
            async canCreateWriteStream() {
                return !this.drive.isReadOnly;
            }
            async canCreateSparseWriteStream() {
                return !this.drive.isReadOnly;
            }
            async createWriteStream({highWaterMark} = {}) {
                const stream = new block_write_stream_1.ProgressBlockWriteStream({
                    destination: this,
                    delayFirstBuffer: (0, os_1.platform)() === "win32",
                    highWaterMark
                });
                stream.on("finish", stream.emit.bind(stream, "done"));
                return stream;
            }
            async createSparseWriteStream({highWaterMark} = {}) {
                const stream = new sparse_write_stream_1.ProgressSparseWriteStream({
                    destination: this,
                    firstBytesToKeep: (0, os_1.platform)() === "win32" ? WIN32_FIRST_BYTES_TO_KEEP : 0,
                    highWaterMark
                });
                stream.on("finish", stream.emit.bind(stream, "done"));
                return stream;
            }
            async _open() {
                const plat = (0, os_1.platform)();
                if (this.oWrite) {
                    if (plat !== "win32") {
                        const unmountDisk = (0, lazy_1.getUnmountDisk)();
                        await unmountDisk(this.drive.device);
                    }
                    await (0, diskpart_1.clean)(this.drive.device);
                }
                await super._open();
                if (plat === "darwin") {
                    await (0, utils_1.fromCallback)((cb => {
                        (0, direct_io_1.setF_NOCACHE)(this.fileHandle.fd, 1, cb);
                    }));
                }
            }
            async _close() {
                await super._close();
                if (this.unmountOnSuccess) {
                    await (0, utils_1.delay)(UNMOUNT_ON_SUCCESS_TIMEOUT_MS);
                    const unmountDisk = (0, lazy_1.getUnmountDisk)();
                    await unmountDisk(this.drive.device);
                }
            }
            offsetIsAligned(offset) {
                return offset % this.alignment === 0;
            }
            alignOffsetBefore(offset) {
                return Math.floor(offset / this.alignment) * this.alignment;
            }
            alignOffsetAfter(offset) {
                return Math.ceil(offset / this.alignment) * this.alignment;
            }
            async alignedRead(buffer, bufferOffset, length, sourceOffset) {
                const start = this.alignOffsetBefore(sourceOffset);
                const end = this.alignOffsetAfter(sourceOffset + length);
                const alignedBuffer = (0, direct_io_1.getAlignedBuffer)(end - start, this.alignment);
                const {bytesRead} = await super.read(alignedBuffer, 0, alignedBuffer.length, start);
                const offset = sourceOffset - start;
                alignedBuffer.copy(buffer, bufferOffset, offset, offset + length);
                return {
                    buffer,
                    bytesRead: Math.min(length, bytesRead - offset)
                };
            }
            read(buffer, bufferOffset, length, sourceOffset) {
                if (!(this.offsetIsAligned(sourceOffset) && this.offsetIsAligned(length))) {
                    return this.alignedRead(buffer, bufferOffset, length, sourceOffset);
                } else {
                    return super.read(buffer, bufferOffset, length, sourceOffset);
                }
            }
            async alignedWrite(buffer, bufferOffset, length, fileOffset) {
                const start = this.alignOffsetBefore(fileOffset);
                const end = this.alignOffsetAfter(fileOffset + length);
                const alignedBuffer = (0, direct_io_1.getAlignedBuffer)(end - start, this.alignment);
                await super.read(alignedBuffer, 0, alignedBuffer.length, start);
                const offset = fileOffset - start;
                buffer.copy(alignedBuffer, offset, bufferOffset, length);
                await super.write(alignedBuffer, 0, alignedBuffer.length, start);
                return {
                    buffer,
                    bytesWritten: length
                };
            }
            write(buffer, bufferOffset, length, fileOffset) {
                if (!(this.offsetIsAligned(fileOffset) && this.offsetIsAligned(length))) {
                    return this.alignedWrite(buffer, bufferOffset, length, fileOffset);
                } else {
                    return super.write(buffer, bufferOffset, length, fileOffset);
                }
            }
        }
        exports.BlockDevice = BlockDevice;
    }, module => {
        module.exports = require("./modules/@ronomon/direct-io/binding.node");
    }, module => {
        "use strict";
        module.exports = require("fs");
    }, module => {
        "use strict";
        module.exports = require("os");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ProgressBlockWriteStream = exports.BlockWriteStream = void 0;
        const direct_io_1 = __webpack_require__(4);
        const _debug = __webpack_require__(8);
        const stream_1 = __webpack_require__(17);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const progress_1 = __webpack_require__(28);
        const utils_1 = __webpack_require__(21);
        const debug = _debug("etcher:writer:block-write-stream");
        class BlockWriteStream extends stream_1.Writable {
            constructor({destination, highWaterMark, delayFirstBuffer = false, maxRetries = 5}) {
                super({
                    objectMode: true,
                    highWaterMark
                });
                this.bytesWritten = 0;
                this.position = 0;
                this.destination = destination;
                this.delayFirstBuffer = delayFirstBuffer;
                this.maxRetries = maxRetries;
            }
            async writeBuffer(buffer, position) {
                await (0, errors_1.retryOnTransientError)((async () => {
                    await this.destination.write(buffer, 0, buffer.length, position);
                }), this.maxRetries, constants_1.RETRY_BASE_TIMEOUT);
            }
            async __write(buffer) {
                const unlock = await buffer.rlock();
                debug("_write", buffer.length, this.position, this.bytesWritten);
                try {
                    if (this.delayFirstBuffer && this.firstBuffer === undefined) {
                        this.firstBuffer = (0, direct_io_1.getAlignedBuffer)(buffer.length, buffer.alignment);
                        buffer.copy(this.firstBuffer);
                    } else {
                        await this.writeBuffer(buffer, this.position);
                        this.bytesWritten += buffer.length;
                    }
                    this.position += buffer.length;
                } finally {
                    unlock();
                }
            }
            _write(buffer, _encoding, callback) {
                (0, utils_1.asCallback)(this.__write(buffer), callback);
            }
            async __final() {
                debug("_final");
                if (this.firstBuffer) {
                    try {
                        await this.writeBuffer(this.firstBuffer, 0);
                        this.bytesWritten += this.firstBuffer.length;
                    } catch (error) {
                        this.destroy();
                        throw error;
                    }
                }
            }
            _final(callback) {
                (0, utils_1.asCallback)(this.__final(), callback);
            }
        }
        exports.BlockWriteStream = BlockWriteStream;
        exports.ProgressBlockWriteStream = (0, progress_1.makeClassEmitProgressEvents)(BlockWriteStream, "bytesWritten", "bytesWritten");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
            module.exports = __webpack_require__(9);
        } else {
            module.exports = __webpack_require__(12);
        }
    }, (module, exports, __webpack_require__) => {
        "use strict";
        function _typeof(obj) {
            if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
                _typeof = function _typeof(obj) {
                    return typeof obj;
                };
            } else {
                _typeof = function _typeof(obj) {
                    return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
                };
            }
            return _typeof(obj);
        }
        exports.log = log;
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.storage = localstorage();
        exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];
        function useColors() {
            if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
                return true;
            }
            if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
                return false;
            }
            return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
        }
        function formatArgs(args) {
            args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
            if (!this.useColors) {
                return;
            }
            var c = "color: " + this.color;
            args.splice(1, 0, c, "color: inherit");
            var index = 0;
            var lastC = 0;
            args[0].replace(/%[a-zA-Z%]/g, (function(match) {
                if (match === "%%") {
                    return;
                }
                index++;
                if (match === "%c") {
                    lastC = index;
                }
            }));
            args.splice(lastC, 0, c);
        }
        function log() {
            var _console;
            return (typeof console === "undefined" ? "undefined" : _typeof(console)) === "object" && console.log && (_console = console).log.apply(_console, arguments);
        }
        function save(namespaces) {
            try {
                if (namespaces) {
                    exports.storage.setItem("debug", namespaces);
                } else {
                    exports.storage.removeItem("debug");
                }
            } catch (error) {}
        }
        function load() {
            var r;
            try {
                r = exports.storage.getItem("debug");
            } catch (error) {}
            if (!r && typeof process !== "undefined" && "env" in process) {
                r = process.env.DEBUG;
            }
            return r;
        }
        function localstorage() {
            try {
                return localStorage;
            } catch (error) {}
        }
        module.exports = __webpack_require__(10)(exports);
        var formatters = module.exports.formatters;
        formatters.j = function(v) {
            try {
                return JSON.stringify(v);
            } catch (error) {
                return "[UnexpectedJSONParseError]: " + error.message;
            }
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        function setup(env) {
            createDebug.debug = createDebug;
            createDebug.default = createDebug;
            createDebug.coerce = coerce;
            createDebug.disable = disable;
            createDebug.enable = enable;
            createDebug.enabled = enabled;
            createDebug.humanize = __webpack_require__(11);
            Object.keys(env).forEach((function(key) {
                createDebug[key] = env[key];
            }));
            createDebug.instances = [];
            createDebug.names = [];
            createDebug.skips = [];
            createDebug.formatters = {};
            function selectColor(namespace) {
                var hash = 0;
                for (var i = 0; i < namespace.length; i++) {
                    hash = (hash << 5) - hash + namespace.charCodeAt(i);
                    hash |= 0;
                }
                return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
            }
            createDebug.selectColor = selectColor;
            function createDebug(namespace) {
                var prevTime;
                function debug() {
                    if (!debug.enabled) {
                        return;
                    }
                    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
                        args[_key] = arguments[_key];
                    }
                    var self = debug;
                    var curr = Number(new Date);
                    var ms = curr - (prevTime || curr);
                    self.diff = ms;
                    self.prev = prevTime;
                    self.curr = curr;
                    prevTime = curr;
                    args[0] = createDebug.coerce(args[0]);
                    if (typeof args[0] !== "string") {
                        args.unshift("%O");
                    }
                    var index = 0;
                    args[0] = args[0].replace(/%([a-zA-Z%])/g, (function(match, format) {
                        if (match === "%%") {
                            return match;
                        }
                        index++;
                        var formatter = createDebug.formatters[format];
                        if (typeof formatter === "function") {
                            var val = args[index];
                            match = formatter.call(self, val);
                            args.splice(index, 1);
                            index--;
                        }
                        return match;
                    }));
                    createDebug.formatArgs.call(self, args);
                    var logFn = self.log || createDebug.log;
                    logFn.apply(self, args);
                }
                debug.namespace = namespace;
                debug.enabled = createDebug.enabled(namespace);
                debug.useColors = createDebug.useColors();
                debug.color = selectColor(namespace);
                debug.destroy = destroy;
                debug.extend = extend;
                if (typeof createDebug.init === "function") {
                    createDebug.init(debug);
                }
                createDebug.instances.push(debug);
                return debug;
            }
            function destroy() {
                var index = createDebug.instances.indexOf(this);
                if (index !== -1) {
                    createDebug.instances.splice(index, 1);
                    return true;
                }
                return false;
            }
            function extend(namespace, delimiter) {
                return createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
            }
            function enable(namespaces) {
                createDebug.save(namespaces);
                createDebug.names = [];
                createDebug.skips = [];
                var i;
                var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
                var len = split.length;
                for (i = 0; i < len; i++) {
                    if (!split[i]) {
                        continue;
                    }
                    namespaces = split[i].replace(/\*/g, ".*?");
                    if (namespaces[0] === "-") {
                        createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
                    } else {
                        createDebug.names.push(new RegExp("^" + namespaces + "$"));
                    }
                }
                for (i = 0; i < createDebug.instances.length; i++) {
                    var instance = createDebug.instances[i];
                    instance.enabled = createDebug.enabled(instance.namespace);
                }
            }
            function disable() {
                createDebug.enable("");
            }
            function enabled(name) {
                if (name[name.length - 1] === "*") {
                    return true;
                }
                var i;
                var len;
                for (i = 0, len = createDebug.skips.length; i < len; i++) {
                    if (createDebug.skips[i].test(name)) {
                        return false;
                    }
                }
                for (i = 0, len = createDebug.names.length; i < len; i++) {
                    if (createDebug.names[i].test(name)) {
                        return true;
                    }
                }
                return false;
            }
            function coerce(val) {
                if (val instanceof Error) {
                    return val.stack || val.message;
                }
                return val;
            }
            createDebug.enable(createDebug.load());
            return createDebug;
        }
        module.exports = setup;
    }, module => {
        var s = 1e3;
        var m = s * 60;
        var h = m * 60;
        var d = h * 24;
        var w = d * 7;
        var y = d * 365.25;
        module.exports = function(val, options) {
            options = options || {};
            var type = typeof val;
            if (type === "string" && val.length > 0) {
                return parse(val);
            } else if (type === "number" && isFinite(val)) {
                return options.long ? fmtLong(val) : fmtShort(val);
            }
            throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
        };
        function parse(str) {
            str = String(str);
            if (str.length > 100) {
                return;
            }
            var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
            if (!match) {
                return;
            }
            var n = parseFloat(match[1]);
            var type = (match[2] || "ms").toLowerCase();
            switch (type) {
              case "years":
              case "year":
              case "yrs":
              case "yr":
              case "y":
                return n * y;

              case "weeks":
              case "week":
              case "w":
                return n * w;

              case "days":
              case "day":
              case "d":
                return n * d;

              case "hours":
              case "hour":
              case "hrs":
              case "hr":
              case "h":
                return n * h;

              case "minutes":
              case "minute":
              case "mins":
              case "min":
              case "m":
                return n * m;

              case "seconds":
              case "second":
              case "secs":
              case "sec":
              case "s":
                return n * s;

              case "milliseconds":
              case "millisecond":
              case "msecs":
              case "msec":
              case "ms":
                return n;

              default:
                return undefined;
            }
        }
        function fmtShort(ms) {
            var msAbs = Math.abs(ms);
            if (msAbs >= d) {
                return Math.round(ms / d) + "d";
            }
            if (msAbs >= h) {
                return Math.round(ms / h) + "h";
            }
            if (msAbs >= m) {
                return Math.round(ms / m) + "m";
            }
            if (msAbs >= s) {
                return Math.round(ms / s) + "s";
            }
            return ms + "ms";
        }
        function fmtLong(ms) {
            var msAbs = Math.abs(ms);
            if (msAbs >= d) {
                return plural(ms, msAbs, d, "day");
            }
            if (msAbs >= h) {
                return plural(ms, msAbs, h, "hour");
            }
            if (msAbs >= m) {
                return plural(ms, msAbs, m, "minute");
            }
            if (msAbs >= s) {
                return plural(ms, msAbs, s, "second");
            }
            return ms + " ms";
        }
        function plural(ms, msAbs, n, name) {
            var isPlural = msAbs >= n * 1.5;
            return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
        }
    }, (module, exports, __webpack_require__) => {
        "use strict";
        var tty = __webpack_require__(13);
        var util = __webpack_require__(14);
        exports.init = init;
        exports.log = log;
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.colors = [ 6, 2, 3, 4, 5, 1 ];
        try {
            var supportsColor = __webpack_require__(15);
            if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
                exports.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ];
            }
        } catch (error) {}
        exports.inspectOpts = Object.keys(process.env).filter((function(key) {
            return /^debug_/i.test(key);
        })).reduce((function(obj, key) {
            var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (function(_, k) {
                return k.toUpperCase();
            }));
            var val = process.env[key];
            if (/^(yes|on|true|enabled)$/i.test(val)) {
                val = true;
            } else if (/^(no|off|false|disabled)$/i.test(val)) {
                val = false;
            } else if (val === "null") {
                val = null;
            } else {
                val = Number(val);
            }
            obj[prop] = val;
            return obj;
        }), {});
        function useColors() {
            return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
        }
        function formatArgs(args) {
            var name = this.namespace, useColors = this.useColors;
            if (useColors) {
                var c = this.color;
                var colorCode = "[3" + (c < 8 ? c : "8;5;" + c);
                var prefix = "  ".concat(colorCode, ";1m").concat(name, " [0m");
                args[0] = prefix + args[0].split("\n").join("\n" + prefix);
                args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "[0m");
            } else {
                args[0] = getDate() + name + " " + args[0];
            }
        }
        function getDate() {
            if (exports.inspectOpts.hideDate) {
                return "";
            }
            return (new Date).toISOString() + " ";
        }
        function log() {
            return process.stderr.write(util.format.apply(util, arguments) + "\n");
        }
        function save(namespaces) {
            if (namespaces) {
                process.env.DEBUG = namespaces;
            } else {
                delete process.env.DEBUG;
            }
        }
        function load() {
            return process.env.DEBUG;
        }
        function init(debug) {
            debug.inspectOpts = {};
            var keys = Object.keys(exports.inspectOpts);
            for (var i = 0; i < keys.length; i++) {
                debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
            }
        }
        module.exports = __webpack_require__(10)(exports);
        var formatters = module.exports.formatters;
        formatters.o = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts).split("\n").map((function(str) {
                return str.trim();
            })).join(" ");
        };
        formatters.O = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts);
        };
    }, module => {
        "use strict";
        module.exports = require("tty");
    }, module => {
        "use strict";
        module.exports = require("util");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const os = __webpack_require__(6);
        const hasFlag = __webpack_require__(16);
        const env = process.env;
        let forceColor;
        if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
            forceColor = false;
        } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
            forceColor = true;
        }
        if ("FORCE_COLOR" in env) {
            forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
        }
        function translateLevel(level) {
            if (level === 0) {
                return false;
            }
            return {
                level,
                hasBasic: true,
                has256: level >= 2,
                has16m: level >= 3
            };
        }
        function supportsColor(stream) {
            if (forceColor === false) {
                return 0;
            }
            if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
                return 3;
            }
            if (hasFlag("color=256")) {
                return 2;
            }
            if (stream && !stream.isTTY && forceColor !== true) {
                return 0;
            }
            const min = forceColor ? 1 : 0;
            if (process.platform === "win32") {
                const osRelease = os.release().split(".");
                if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
                    return Number(osRelease[2]) >= 14931 ? 3 : 2;
                }
                return 1;
            }
            if ("CI" in env) {
                if ([ "TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI" ].some((sign => sign in env)) || env.CI_NAME === "codeship") {
                    return 1;
                }
                return min;
            }
            if ("TEAMCITY_VERSION" in env) {
                return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
            }
            if (env.COLORTERM === "truecolor") {
                return 3;
            }
            if ("TERM_PROGRAM" in env) {
                const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
                switch (env.TERM_PROGRAM) {
                  case "iTerm.app":
                    return version >= 3 ? 3 : 2;

                  case "Apple_Terminal":
                    return 2;
                }
            }
            if (/-256(color)?$/i.test(env.TERM)) {
                return 2;
            }
            if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
                return 1;
            }
            if ("COLORTERM" in env) {
                return 1;
            }
            if (env.TERM === "dumb") {
                return min;
            }
            return min;
        }
        function getSupportLevel(stream) {
            const level = supportsColor(stream);
            return translateLevel(level);
        }
        module.exports = {
            supportsColor: getSupportLevel,
            stdout: getSupportLevel(process.stdout),
            stderr: getSupportLevel(process.stderr)
        };
    }, module => {
        "use strict";
        module.exports = (flag, argv) => {
            argv = argv || process.argv;
            const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
            const pos = argv.indexOf(prefix + flag);
            const terminatorPos = argv.indexOf("--");
            return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
        };
    }, module => {
        "use strict";
        module.exports = require("stream");
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.DEFAULT_ALIGNMENT = exports.XXHASH_SEED = exports.NO_MATCHING_FILE_MSG = exports.CHUNK_SIZE = exports.RETRY_BASE_TIMEOUT = exports.SPEED_WINDOW = exports.PROGRESS_EMISSION_INTERVAL = void 0;
        exports.PROGRESS_EMISSION_INTERVAL = 1e3 / 4;
        exports.SPEED_WINDOW = 2;
        exports.RETRY_BASE_TIMEOUT = 100;
        exports.CHUNK_SIZE = 1024 ** 2;
        exports.NO_MATCHING_FILE_MSG = "Can't find a matching file in this zip archive";
        exports.XXHASH_SEED = 1163150152;
        exports.DEFAULT_ALIGNMENT = 512;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.retryOnTransientError = exports.BlocksVerificationError = exports.ChecksumVerificationError = exports.VerificationError = exports.NotCapable = void 0;
        const process_1 = __webpack_require__(20);
        const utils_1 = __webpack_require__(21);
        class NotCapable extends Error {}
        exports.NotCapable = NotCapable;
        class VerificationError extends Error {
            constructor() {
                super(...arguments);
                this.code = "EVALIDATION";
            }
        }
        exports.VerificationError = VerificationError;
        class ChecksumVerificationError extends VerificationError {
            constructor(message, checksum, expectedChecksum) {
                super(message);
                this.checksum = checksum;
                this.expectedChecksum = expectedChecksum;
            }
        }
        exports.ChecksumVerificationError = ChecksumVerificationError;
        function blocksVerificationErrorMessage(blocksWithChecksum, checksum) {
            const start = blocksWithChecksum.blocks[0].offset;
            const lastBlock = blocksWithChecksum.blocks[blocksWithChecksum.blocks.length - 1];
            const end = lastBlock.offset + lastBlock.length - 1;
            return `Checksum does not match for range [${start}, ${end}]: "${blocksWithChecksum.checksum}" != "${checksum}"`;
        }
        class BlocksVerificationError extends VerificationError {
            constructor(blocks, checksum) {
                super(blocksVerificationErrorMessage(blocks, checksum));
                this.blocks = blocks;
                this.checksum = checksum;
            }
        }
        exports.BlocksVerificationError = BlocksVerificationError;
        function isTransientError(error) {
            if (process_1.platform === "darwin") {
                return error.code === "ENXIO" || error.code === "EBUSY";
            } else if (process_1.platform === "linux") {
                return error.code === "EIO" || error.code === "EBUSY";
            } else if (process_1.platform === "win32") {
                return error.code === "ENOENT" || error.code === "UNKNOWN";
            }
            return false;
        }
        async function retryOnTransientError(fn, maxRetries, baseDelay) {
            let retries = 0;
            while (true) {
                try {
                    return await fn();
                } catch (error) {
                    if (isTransientError(error)) {
                        if (retries < maxRetries) {
                            retries += 1;
                            await (0, utils_1.delay)(baseDelay * retries);
                            continue;
                        }
                        error.code = "EUNPLUGGED";
                    }
                    throw error;
                }
            }
        }
        exports.retryOnTransientError = retryOnTransientError;
    }, module => {
        "use strict";
        module.exports = require("process");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.once = exports.every = exports.sumBy = exports.maxBy = exports.minBy = exports.delay = exports.fromCallback = exports.asCallback = exports.difference = exports.sparseStreamToBuffer = exports.streamToBuffer = void 0;
        const aligned_lockable_buffer_1 = __webpack_require__(22);
        function streamToBuffer(stream) {
            return new Promise(((resolve, reject) => {
                const chunks = [];
                stream.on("error", reject);
                stream.on("data", (async chunk => {
                    let data;
                    if ((0, aligned_lockable_buffer_1.isAlignedLockableBuffer)(chunk)) {
                        const unlock = await chunk.rlock();
                        try {
                            data = Buffer.allocUnsafe(chunk.length);
                            chunk.copy(data);
                        } finally {
                            unlock();
                        }
                    } else {
                        data = chunk;
                    }
                    chunks.push(data);
                }));
                stream.on("end", (() => {
                    resolve(Buffer.concat(chunks));
                }));
                stream.resume();
            }));
        }
        exports.streamToBuffer = streamToBuffer;
        async function sparseStreamToBuffer(stream) {
            const chunks = [];
            await new Promise(((resolve, reject) => {
                stream.on("error", reject);
                stream.on("end", resolve);
                stream.on("data", (async chunk => {
                    if ((0, aligned_lockable_buffer_1.isAlignedLockableBuffer)(chunk.buffer)) {
                        let unlock;
                        try {
                            unlock = await chunk.buffer.rlock();
                        } catch (error) {
                            reject(error);
                            return;
                        }
                        let data;
                        try {
                            data = Buffer.allocUnsafe(chunk.buffer.length);
                            chunk.buffer.copy(data);
                        } finally {
                            unlock();
                        }
                        chunk.buffer = data;
                    }
                    chunks.push(chunk);
                }));
            }));
            if (chunks.length === 0) {
                return Buffer.alloc(0);
            }
            const lastChunk = chunks[chunks.length - 1];
            const result = Buffer.alloc(lastChunk.position + lastChunk.buffer.length);
            for (const chunk of chunks) {
                chunk.buffer.copy(result, chunk.position);
            }
            return result;
        }
        exports.sparseStreamToBuffer = sparseStreamToBuffer;
        function difference(setA, setB) {
            const _difference = new Set(setA);
            for (const elem of setB) {
                _difference.delete(elem);
            }
            return _difference;
        }
        exports.difference = difference;
        async function asCallback(promise, callback) {
            try {
                const value = await promise;
                callback(null, value);
            } catch (error) {
                callback(error);
            }
        }
        exports.asCallback = asCallback;
        async function fromCallback(fn) {
            return await new Promise(((resolve, reject) => {
                fn(((error, result) => {
                    if (error != null) {
                        reject(error);
                    } else {
                        resolve(result);
                    }
                }));
            }));
        }
        exports.fromCallback = fromCallback;
        async function delay(ms) {
            await new Promise((resolve => {
                setTimeout(resolve, ms);
            }));
        }
        exports.delay = delay;
        function minBy(things, iteratee) {
            let result;
            let minimum;
            for (const t of things) {
                const value = iteratee(t);
                if (minimum === undefined || value < minimum) {
                    minimum = value;
                    result = t;
                }
            }
            return result;
        }
        exports.minBy = minBy;
        function maxBy(things, iteratee) {
            return minBy(things, (t => -iteratee(t)));
        }
        exports.maxBy = maxBy;
        function sumBy(things, iteratee) {
            let result = 0;
            for (const t of things) {
                result += iteratee(t);
            }
            return result;
        }
        exports.sumBy = sumBy;
        function every(things) {
            for (const t of things) {
                if (!t) {
                    return false;
                }
            }
            return true;
        }
        exports.every = every;
        function once(fn) {
            let ran = false;
            let result;
            return () => {
                if (!ran) {
                    result = fn();
                    ran = true;
                }
                return result;
            };
        }
        exports.once = once;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.AlignedReadableState = exports.isAlignedLockableBuffer = exports.createBuffer = void 0;
        const direct_io_1 = __webpack_require__(4);
        const RWMutex = __webpack_require__(23);
        function alignedLockableBufferSlice(start, end) {
            const slice = Buffer.prototype.slice.call(this, start, end);
            return attachMutex(slice, this.alignment, this.lock, this.rlock);
        }
        function attachMutex(buf, alignment, lock, rlock) {
            const buffer = buf;
            buffer.alignment = alignment;
            buffer.lock = lock;
            buffer.rlock = rlock;
            buffer.slice = alignedLockableBufferSlice;
            return buffer;
        }
        function createBuffer(size, alignment) {
            const mutex = new RWMutex;
            return attachMutex((0, direct_io_1.getAlignedBuffer)(size, alignment), alignment, mutex.lock.bind(mutex), mutex.rlock.bind(mutex));
        }
        exports.createBuffer = createBuffer;
        function isAlignedLockableBuffer(buffer) {
            return "rlock" in buffer;
        }
        exports.isAlignedLockableBuffer = isAlignedLockableBuffer;
        class AlignedReadableState {
            constructor(bufferSize, alignment, numBuffers) {
                this.bufferSize = bufferSize;
                this.alignment = alignment;
                this.numBuffers = numBuffers;
                this.currentBufferIndex = 0;
                this.buffers = new Array(numBuffers);
            }
            getCurrentBuffer() {
                let buffer = this.buffers[this.currentBufferIndex];
                if (buffer === undefined) {
                    buffer = createBuffer(this.bufferSize, this.alignment);
                    this.buffers[this.currentBufferIndex] = buffer;
                }
                this.currentBufferIndex = (this.currentBufferIndex + 1) % this.numBuffers;
                return buffer;
            }
        }
        exports.AlignedReadableState = AlignedReadableState;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        function _interopDefault(ex) {
            return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
        }
        var _debug = _interopDefault(__webpack_require__(24));
        const debug = _debug("rwmutex");
        class Mutex {
            constructor(label = "") {
                this.label = label;
                this._rlockId = 0;
                this._rlocks = [];
            }
            lock() {
                if (this._lock) {
                    return this._lock.then((() => this.lock()));
                }
                if (this._rlocks.length) {
                    return Promise.all(this._rlocks).then((() => this.lock()));
                }
                let resolve, unlocked = false;
                const promise = new Promise((r => resolve = r));
                const unlock = () => {
                    if (unlocked) return;
                    unlocked = true;
                    if (this._lock === promise) delete this._lock;
                    debug("unlock", this.label);
                    resolve();
                };
                debug("lock", this.label);
                this._lock = promise;
                return Promise.resolve(unlock);
            }
            rlock() {
                if (this._lock) {
                    return this._lock.then((() => this.rlock()));
                }
                let resolve, unlocked = false;
                const promise = new Promise((r => resolve = r));
                const unlock = () => {
                    if (unlocked) return;
                    unlocked = true;
                    const index = this._rlocks.indexOf(promise);
                    if (index > -1) this._rlocks.splice(index, 1);
                    debug("runlock", this.label, id);
                    resolve();
                };
                const id = this._rlockId++;
                debug("rlock", this.label, id);
                this._rlocks.push(promise);
                return Promise.resolve(unlock);
            }
        }
        module.exports = Mutex;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
            module.exports = __webpack_require__(25);
        } else {
            module.exports = __webpack_require__(27);
        }
    }, (module, exports, __webpack_require__) => {
        "use strict";
        function _typeof(obj) {
            if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
                _typeof = function _typeof(obj) {
                    return typeof obj;
                };
            } else {
                _typeof = function _typeof(obj) {
                    return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
                };
            }
            return _typeof(obj);
        }
        exports.log = log;
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.storage = localstorage();
        exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];
        function useColors() {
            if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
                return true;
            }
            if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
                return false;
            }
            return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
        }
        function formatArgs(args) {
            args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
            if (!this.useColors) {
                return;
            }
            var c = "color: " + this.color;
            args.splice(1, 0, c, "color: inherit");
            var index = 0;
            var lastC = 0;
            args[0].replace(/%[a-zA-Z%]/g, (function(match) {
                if (match === "%%") {
                    return;
                }
                index++;
                if (match === "%c") {
                    lastC = index;
                }
            }));
            args.splice(lastC, 0, c);
        }
        function log() {
            var _console;
            return (typeof console === "undefined" ? "undefined" : _typeof(console)) === "object" && console.log && (_console = console).log.apply(_console, arguments);
        }
        function save(namespaces) {
            try {
                if (namespaces) {
                    exports.storage.setItem("debug", namespaces);
                } else {
                    exports.storage.removeItem("debug");
                }
            } catch (error) {}
        }
        function load() {
            var r;
            try {
                r = exports.storage.getItem("debug");
            } catch (error) {}
            if (!r && typeof process !== "undefined" && "env" in process) {
                r = process.env.DEBUG;
            }
            return r;
        }
        function localstorage() {
            try {
                return localStorage;
            } catch (error) {}
        }
        module.exports = __webpack_require__(26)(exports);
        var formatters = module.exports.formatters;
        formatters.j = function(v) {
            try {
                return JSON.stringify(v);
            } catch (error) {
                return "[UnexpectedJSONParseError]: " + error.message;
            }
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        function setup(env) {
            createDebug.debug = createDebug;
            createDebug.default = createDebug;
            createDebug.coerce = coerce;
            createDebug.disable = disable;
            createDebug.enable = enable;
            createDebug.enabled = enabled;
            createDebug.humanize = __webpack_require__(11);
            Object.keys(env).forEach((function(key) {
                createDebug[key] = env[key];
            }));
            createDebug.instances = [];
            createDebug.names = [];
            createDebug.skips = [];
            createDebug.formatters = {};
            function selectColor(namespace) {
                var hash = 0;
                for (var i = 0; i < namespace.length; i++) {
                    hash = (hash << 5) - hash + namespace.charCodeAt(i);
                    hash |= 0;
                }
                return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
            }
            createDebug.selectColor = selectColor;
            function createDebug(namespace) {
                var prevTime;
                function debug() {
                    if (!debug.enabled) {
                        return;
                    }
                    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
                        args[_key] = arguments[_key];
                    }
                    var self = debug;
                    var curr = Number(new Date);
                    var ms = curr - (prevTime || curr);
                    self.diff = ms;
                    self.prev = prevTime;
                    self.curr = curr;
                    prevTime = curr;
                    args[0] = createDebug.coerce(args[0]);
                    if (typeof args[0] !== "string") {
                        args.unshift("%O");
                    }
                    var index = 0;
                    args[0] = args[0].replace(/%([a-zA-Z%])/g, (function(match, format) {
                        if (match === "%%") {
                            return match;
                        }
                        index++;
                        var formatter = createDebug.formatters[format];
                        if (typeof formatter === "function") {
                            var val = args[index];
                            match = formatter.call(self, val);
                            args.splice(index, 1);
                            index--;
                        }
                        return match;
                    }));
                    createDebug.formatArgs.call(self, args);
                    var logFn = self.log || createDebug.log;
                    logFn.apply(self, args);
                }
                debug.namespace = namespace;
                debug.enabled = createDebug.enabled(namespace);
                debug.useColors = createDebug.useColors();
                debug.color = selectColor(namespace);
                debug.destroy = destroy;
                debug.extend = extend;
                if (typeof createDebug.init === "function") {
                    createDebug.init(debug);
                }
                createDebug.instances.push(debug);
                return debug;
            }
            function destroy() {
                var index = createDebug.instances.indexOf(this);
                if (index !== -1) {
                    createDebug.instances.splice(index, 1);
                    return true;
                }
                return false;
            }
            function extend(namespace, delimiter) {
                return createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
            }
            function enable(namespaces) {
                createDebug.save(namespaces);
                createDebug.names = [];
                createDebug.skips = [];
                var i;
                var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
                var len = split.length;
                for (i = 0; i < len; i++) {
                    if (!split[i]) {
                        continue;
                    }
                    namespaces = split[i].replace(/\*/g, ".*?");
                    if (namespaces[0] === "-") {
                        createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
                    } else {
                        createDebug.names.push(new RegExp("^" + namespaces + "$"));
                    }
                }
                for (i = 0; i < createDebug.instances.length; i++) {
                    var instance = createDebug.instances[i];
                    instance.enabled = createDebug.enabled(instance.namespace);
                }
            }
            function disable() {
                createDebug.enable("");
            }
            function enabled(name) {
                if (name[name.length - 1] === "*") {
                    return true;
                }
                var i;
                var len;
                for (i = 0, len = createDebug.skips.length; i < len; i++) {
                    if (createDebug.skips[i].test(name)) {
                        return false;
                    }
                }
                for (i = 0, len = createDebug.names.length; i < len; i++) {
                    if (createDebug.names[i].test(name)) {
                        return true;
                    }
                }
                return false;
            }
            function coerce(val) {
                if (val instanceof Error) {
                    return val.stack || val.message;
                }
                return val;
            }
            createDebug.enable(createDebug.load());
            return createDebug;
        }
        module.exports = setup;
    }, (module, exports, __webpack_require__) => {
        "use strict";
        var tty = __webpack_require__(13);
        var util = __webpack_require__(14);
        exports.init = init;
        exports.log = log;
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.colors = [ 6, 2, 3, 4, 5, 1 ];
        try {
            var supportsColor = __webpack_require__(15);
            if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
                exports.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ];
            }
        } catch (error) {}
        exports.inspectOpts = Object.keys(process.env).filter((function(key) {
            return /^debug_/i.test(key);
        })).reduce((function(obj, key) {
            var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (function(_, k) {
                return k.toUpperCase();
            }));
            var val = process.env[key];
            if (/^(yes|on|true|enabled)$/i.test(val)) {
                val = true;
            } else if (/^(no|off|false|disabled)$/i.test(val)) {
                val = false;
            } else if (val === "null") {
                val = null;
            } else {
                val = Number(val);
            }
            obj[prop] = val;
            return obj;
        }), {});
        function useColors() {
            return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
        }
        function formatArgs(args) {
            var name = this.namespace, useColors = this.useColors;
            if (useColors) {
                var c = this.color;
                var colorCode = "[3" + (c < 8 ? c : "8;5;" + c);
                var prefix = "  ".concat(colorCode, ";1m").concat(name, " [0m");
                args[0] = prefix + args[0].split("\n").join("\n" + prefix);
                args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "[0m");
            } else {
                args[0] = getDate() + name + " " + args[0];
            }
        }
        function getDate() {
            if (exports.inspectOpts.hideDate) {
                return "";
            }
            return (new Date).toISOString() + " ";
        }
        function log() {
            return process.stderr.write(util.format.apply(util, arguments) + "\n");
        }
        function save(namespaces) {
            if (namespaces) {
                process.env.DEBUG = namespaces;
            } else {
                delete process.env.DEBUG;
            }
        }
        function load() {
            return process.env.DEBUG;
        }
        function init(debug) {
            debug.inspectOpts = {};
            var keys = Object.keys(exports.inspectOpts);
            for (var i = 0; i < keys.length; i++) {
                debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
            }
        }
        module.exports = __webpack_require__(26)(exports);
        var formatters = module.exports.formatters;
        formatters.o = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts).split("\n").map((function(str) {
                return str.trim();
            })).join(" ");
        };
        formatters.O = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts);
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ProgressWritable = exports.CountingWritable = exports.makeClassEmitProgressEvents = void 0;
        const stream_1 = __webpack_require__(17);
        const constants_1 = __webpack_require__(18);
        const speedometer_1 = __webpack_require__(29);
        function makeClassEmitProgressEvents(Cls, attribute, positionAttribute, interval = constants_1.PROGRESS_EMISSION_INTERVAL) {
            return class extends Cls {
                constructor(...args) {
                    super(...args);
                    const startTime = Date.now();
                    const meter = new speedometer_1.Speedometer(constants_1.SPEED_WINDOW);
                    const state = {
                        position: 0,
                        bytes: 0,
                        speed: 0,
                        averageSpeed: 0
                    };
                    let attributeValue = this[attribute];
                    const update = () => {
                        const newValue = this[attribute];
                        const attributeDelta = newValue - attributeValue;
                        if (attributeDelta === 0) {
                            return;
                        }
                        attributeValue = newValue;
                        state.bytes += attributeDelta;
                        const position = this[positionAttribute];
                        if (position !== undefined) {
                            state.position = position;
                        }
                        state.speed = meter.speed(attributeDelta);
                        state.averageSpeed = state.bytes / (Date.now() - startTime) * 1e3;
                        this.emit("progress", state);
                    };
                    const timer = setInterval(update, interval);
                    const clear = () => {
                        clearInterval(timer);
                    };
                    this.once("error", clear);
                    this.once("finish", clear);
                    this.once("finish", update);
                    this.once("end", clear);
                    this.once("end", update);
                }
            };
        }
        exports.makeClassEmitProgressEvents = makeClassEmitProgressEvents;
        class CountingWritable extends stream_1.Writable {
            constructor() {
                super(...arguments);
                this.bytesWritten = 0;
            }
            _write(chunk, _enc, callback) {
                if (Buffer.isBuffer(chunk)) {
                    this.bytesWritten = this.position = this.bytesWritten + chunk.length;
                } else {
                    this.bytesWritten += chunk.buffer.length;
                    this.position = chunk.position + chunk.buffer.length;
                }
                callback();
            }
        }
        exports.CountingWritable = CountingWritable;
        exports.ProgressWritable = makeClassEmitProgressEvents(CountingWritable, "bytesWritten", "position");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Speedometer = void 0;
        const utils_1 = __webpack_require__(21);
        class Speedometer {
            constructor(windowSize = 5) {
                this.windowSize = windowSize;
                this.values = [];
                this.values.push([ this.now(), 0 ]);
            }
            now() {
                return Date.now() / 1e3;
            }
            removeOldValues(start) {
                const index = this.values.findIndex((v => v[0] > start));
                const deleteUntil = index === -1 ? undefined : index - 1;
                this.values.splice(0, deleteUntil);
            }
            moment(index) {
                return this.values[index][0];
            }
            value(index) {
                return this.values[index][1];
            }
            speed(amount) {
                const now = this.now();
                this.values.push([ now, amount ]);
                const start = now - this.windowSize;
                this.removeOldValues(start);
                if (this.values.length < 2) {
                    return 0;
                }
                let ratio;
                let duration;
                if (start <= this.values[0][0]) {
                    ratio = (this.moment(1) - start) / (this.moment(1) - this.moment(0));
                    duration = this.windowSize;
                } else {
                    ratio = 1;
                    duration = now - this.moment(0);
                }
                const sum = ratio * this.value(1) + (0, utils_1.sumBy)(this.values.slice(2), (v => v[1]));
                return sum / duration;
            }
        }
        exports.Speedometer = Speedometer;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.clean = void 0;
        const child_process_1 = __webpack_require__(31);
        const _debug = __webpack_require__(8);
        const fs_1 = __webpack_require__(5);
        const os_1 = __webpack_require__(6);
        const RWMutex = __webpack_require__(23);
        const tmp_1 = __webpack_require__(32);
        const utils_1 = __webpack_require__(21);
        const debug = _debug("etcher-sdk:diskpart");
        const DISKPART_DELAY = 2e3;
        const DISKPART_RETRIES = 5;
        const PATTERN = /PHYSICALDRIVE(\d+)/i;
        const execFileAsync = async (command, args = [], options = {}) => await new Promise(((resolve, reject) => {
            (0, child_process_1.execFile)(command, args, options, ((error, stdout, stderr) => {
                if (error) {
                    reject(error);
                } else {
                    resolve({
                        stdout,
                        stderr
                    });
                }
            }));
        }));
        const diskpartMutex = new RWMutex;
        async function withDiskpartMutex(fn) {
            const unlock = await diskpartMutex.lock();
            try {
                return await fn();
            } finally {
                unlock();
            }
        }
        const runDiskpart = async commands => {
            if ((0, os_1.platform)() !== "win32") {
                return;
            }
            await (0, tmp_1.withTmpFile)({
                keepOpen: false
            }, (async file => {
                await fs_1.promises.writeFile(file.path, commands.join("\r\n"));
                await withDiskpartMutex((async () => {
                    const {stdout, stderr} = await execFileAsync("diskpart", [ "/s", file.path ]);
                    debug("stdout:", stdout);
                    debug("stderr:", stderr);
                }));
            }));
        };
        const clean = async device => {
            if ((0, os_1.platform)() !== "win32") {
                return;
            }
            const match = device.match(PATTERN);
            if (match === null) {
                throw new Error(`Invalid device: "${device}"`);
            }
            debug("clean", device);
            const deviceId = match.pop();
            let errorCount = 0;
            while (errorCount <= DISKPART_RETRIES) {
                try {
                    await runDiskpart([ `select disk ${deviceId}`, "clean", "rescan" ]);
                    return;
                } catch (error) {
                    if (error.code === 2147756042) {
                        return;
                    }
                    errorCount += 1;
                    if (errorCount <= DISKPART_RETRIES) {
                        await (0, utils_1.delay)(DISKPART_DELAY);
                    } else {
                        throw new Error(`Couldn't clean the drive, ${error.message} (code ${error.code})`);
                    }
                }
            }
        };
        exports.clean = clean;
    }, module => {
        "use strict";
        module.exports = require("child_process");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.freeSpace = exports.withTmpFile = exports.tmpFile = exports.cleanupTmpFiles = void 0;
        const checkDiskSpace = __webpack_require__(33);
        const crypto_1 = __webpack_require__(35);
        const fs_1 = __webpack_require__(5);
        const os_1 = __webpack_require__(6);
        const path_1 = __webpack_require__(34);
        const TMP_RANDOM_BYTES = 6;
        const TMP_DIR = (0, path_1.join)((0, os_1.tmpdir)(), "etcher");
        const TRIES = 5;
        function randomFilePath(prefix, postfix) {
            return (0, path_1.join)(TMP_DIR, `${prefix}${(0, crypto_1.randomBytes)(TMP_RANDOM_BYTES).toString("hex")}${postfix}`);
        }
        async function cleanupTmpFiles(olderThan = Date.now(), prefix = "") {
            let dirents = [];
            try {
                dirents = await fs_1.promises.readdir(TMP_DIR, {
                    withFileTypes: true
                });
            } catch (_a) {
                return;
            }
            for (const dirent of dirents) {
                if (dirent.isFile()) {
                    if (dirent.name.startsWith(prefix)) {
                        const filename = (0, path_1.join)(TMP_DIR, dirent.name);
                        try {
                            const stats = await fs_1.promises.stat(filename);
                            if (stats.ctime.getTime() <= olderThan) {
                                await fs_1.promises.unlink(filename);
                            }
                        } catch (_b) {}
                    }
                }
            }
        }
        exports.cleanupTmpFiles = cleanupTmpFiles;
        async function createTmpRoot() {
            try {
                await fs_1.promises.mkdir(TMP_DIR, {
                    recursive: true
                });
            } catch (error) {
                if (error.code === "EEXIST" && !(await fs_1.promises.stat(TMP_DIR)).isDirectory()) {
                    await fs_1.promises.unlink(TMP_DIR);
                    await fs_1.promises.mkdir(TMP_DIR, {
                        recursive: true
                    });
                }
            }
        }
        async function tmpFile({keepOpen = true, prefix = "tmp-", postfix = ".tmp"}) {
            await createTmpRoot();
            let fileHandle;
            let path;
            let ok = false;
            for (let i = 0; i < TRIES; i++) {
                path = randomFilePath(prefix, postfix);
                try {
                    fileHandle = await fs_1.promises.open(path, "wx+");
                    ok = true;
                    break;
                } catch (error) {
                    if (error.code !== "EEXIST") {
                        throw error;
                    }
                }
            }
            if (!ok) {
                throw new Error(`Could not generate a temporary filename in ${TRIES} tries`);
            }
            if (!keepOpen && fileHandle !== undefined) {
                await fileHandle.close();
                fileHandle = undefined;
            }
            return {
                fileHandle,
                path
            };
        }
        exports.tmpFile = tmpFile;
        async function withTmpFile(options, fn) {
            const result = await tmpFile(options);
            try {
                return await fn(result);
            } finally {
                if (options.keepOpen && result.fileHandle !== undefined) {
                    await result.fileHandle.close();
                }
                try {
                    await fs_1.promises.unlink(result.path);
                } catch (error) {
                    if (error.code !== "ENOENT") {
                        throw error;
                    }
                }
            }
        }
        exports.withTmpFile = withTmpFile;
        async function freeSpace() {
            try {
                return (await checkDiskSpace(TMP_DIR)).free;
            } catch (error) {
                console.warn(`Could not check free disk space in "${TMP_DIR}": ${error}`);
                return 0;
            }
        }
        exports.freeSpace = freeSpace;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const {exec} = __webpack_require__(31);
        const fs = __webpack_require__(5);
        const path = __webpack_require__(34);
        const util = __webpack_require__(14);
        const InvalidPathError = function(message) {
            Error.captureStackTrace(this, this.constructor);
            this.name = "InvalidPathError";
            this.message = message || "";
        };
        util.inherits(InvalidPathError, Error);
        const NoMatchError = function(message) {
            Error.captureStackTrace(this, this.constructor);
            this.name = "NoMatchError";
            this.message = message || "";
        };
        util.inherits(NoMatchError, Error);
        function mapOutput(stdout, filter, mapping, coefficient = 1) {
            const parsed = stdout.trim().split("\n").slice(1).map((line => line.trim().split(/\s+(?=[\d/])/)));
            let filtered = parsed.filter(filter);
            if (filtered.length === 0) {
                throw new NoMatchError;
            }
            filtered = filtered[0];
            return {
                diskPath: filtered[mapping.diskPath],
                free: parseInt(filtered[mapping.free], 10) * coefficient,
                size: parseInt(filtered[mapping.size], 10) * coefficient
            };
        }
        function check(cmd, filter, mapping, coefficient = 1) {
            return new Promise(((resolve, reject) => {
                exec(cmd, ((error, stdout) => {
                    if (error) {
                        reject(error);
                    }
                    try {
                        resolve(mapOutput(stdout, filter, mapping, coefficient));
                    } catch (error2) {
                        reject(error2);
                    }
                }));
            }));
        }
        function checkWin32(directoryPath) {
            if (directoryPath.charAt(1) !== ":") {
                return new Promise(((resolve, reject) => {
                    reject(new InvalidPathError(`The following path is invalid (should be X:\\...): ${directoryPath}`));
                }));
            }
            return check("wmic logicaldisk get size,freespace,caption", (driveData => {
                const driveLetter = driveData[0];
                return directoryPath.startsWith(driveLetter);
            }), {
                diskPath: 0,
                free: 1,
                size: 2
            });
        }
        function checkUnix(directoryPath) {
            if (!path.normalize(directoryPath).startsWith(path.sep)) {
                return new Promise(((resolve, reject) => {
                    reject(new InvalidPathError(`The following path is invalid (should start by ${path.sep}): ${directoryPath}`));
                }));
            }
            return check(`df -Pk "${module.exports.getFirstExistingParentPath(directoryPath)}"`, (() => true), {
                diskPath: 5,
                free: 3,
                size: 1
            }, 1024);
        }
        module.exports = process.platform === "win32" ? checkWin32 : checkUnix;
        module.exports.getFirstExistingParentPath = directoryPath => {
            let parentDirectoryPath = directoryPath;
            let parentDirectoryFound = fs.existsSync(parentDirectoryPath);
            while (!parentDirectoryFound) {
                parentDirectoryPath = path.normalize(parentDirectoryPath + "/..");
                parentDirectoryFound = fs.existsSync(parentDirectoryPath);
            }
            return parentDirectoryPath;
        };
        module.exports.InvalidPathError = InvalidPathError;
        module.exports.NoMatchError = NoMatchError;
    }, module => {
        "use strict";
        module.exports = require("path");
    }, module => {
        "use strict";
        module.exports = require("crypto");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.getCrc = exports.getUnmountDisk = exports.getXXHash = exports.getRaspberrypiUsbboot = void 0;
        const util_1 = __webpack_require__(14);
        const utils_1 = __webpack_require__(21);
        exports.getRaspberrypiUsbboot = (0, utils_1.once)((() => {
            try {
                return __webpack_require__(37);
            } catch (e) {
                console.warn("Failed to import node-raspberrypi-usbboot:", e);
            }
        }));
        exports.getXXHash = (0, utils_1.once)((() => __webpack_require__(47)));
        exports.getUnmountDisk = (0, utils_1.once)((() => (0, util_1.promisify)(__webpack_require__(49).unmountDisk)));
        exports.getCrc = (0, utils_1.once)((() => __webpack_require__(51)));
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.UsbbootScanner = exports.CM4 = exports.CM3 = exports.UsbbootDevice = exports.isUsbBootCapableUSBDevice = void 0;
        const usb = __webpack_require__(38);
        const _debug = __webpack_require__(42);
        const events_1 = __webpack_require__(41);
        const fs_1 = __webpack_require__(5);
        const Path = __webpack_require__(34);
        const util_1 = __webpack_require__(14);
        async function delay(ms) {
            await new Promise((resolve => {
                setTimeout(resolve, ms);
            }));
        }
        function fromCallback(fn) {
            return new Promise(((resolve, reject) => {
                fn(((error, result) => {
                    if (error == null) {
                        resolve(result);
                    } else {
                        reject(error);
                    }
                }));
            }));
        }
        const readFile = util_1.promisify(fs_1.readFile);
        const debug = _debug("node-raspberrypi-usbboot");
        const POLLING_INTERVAL_MS = 2e3;
        const TRANSFER_BLOCK_SIZE = 1024 ** 2;
        const NULL_BUFFER = Buffer.alloc(0);
        const BOOT_MESSAGE_BOOTCODE_LENGTH_SIZE = 4;
        const BOOT_MESSAGE_BOOTCODE_LENGTH_OFFSET = 0;
        const BOOT_MESSAGE_SIGNATURE_SIZE = 20;
        const FILE_MESSAGE_COMMAND_OFFSET = 0;
        const FILE_MESSAGE_COMMAND_SIZE = 4;
        const FILE_MESSAGE_FILE_NAME_OFFSET = FILE_MESSAGE_COMMAND_SIZE;
        const FILE_MESSAGE_FILE_NAME_SIZE = 256;
        const USB_REQUEST_CODE_GET_STATUS = 0;
        const USBBOOT_MESSAGE_MAX_BUFFER_LENGTH = 65535;
        const CONTROL_TRANSFER_INDEX_RIGHT_BIT_SHIFT = 16;
        const FILE_MESSAGE_SIZE = FILE_MESSAGE_COMMAND_SIZE + FILE_MESSAGE_FILE_NAME_SIZE;
        const RETURN_CODE_SUCCESS = 0;
        const RETURN_CODE_LENGTH = 4;
        const USB_CONTROL_TRANSFER_TIMEOUT_MS = 1e4;
        const USB_BULK_TRANSFER_TIMEOUT_MS = 1e4;
        const USB_ENDPOINT_INTERFACES_SOC_BCM2835 = 1;
        const USB_VENDOR_ID_BROADCOM_CORPORATION = 2652;
        const USB_PRODUCT_ID_BCM2708_BOOT = 10083;
        const USB_PRODUCT_ID_BCM2710_BOOT = 10084;
        const USB_PRODUCT_ID_BCM2711_BOOT = 10001;
        const USB_PRODUCT_ID_BCM2711_MASS_STORAGE = 1;
        const USB_VENDOR_ID_NETCHIP_TECHNOLOGY = 1317;
        const USB_PRODUCT_ID_POCKETBOOK_PRO_903 = 42149;
        const DEVICE_UNPLUG_TIMEOUT = 5e3;
        const READ_ERROR_DELAY = 100;
        var FileMessageCommand;
        (function(FileMessageCommand) {
            FileMessageCommand[FileMessageCommand["GetFileSize"] = 0] = "GetFileSize";
            FileMessageCommand[FileMessageCommand["ReadFile"] = 1] = "ReadFile";
            FileMessageCommand[FileMessageCommand["Done"] = 2] = "Done";
        })(FileMessageCommand || (FileMessageCommand = {}));
        const getCommand = fileMessageBuffer => {
            const command = fileMessageBuffer.readInt32LE(FILE_MESSAGE_COMMAND_OFFSET);
            if (!(command in FileMessageCommand)) {
                throw new Error(`Invalid file message command code: ${command}`);
            }
            return command;
        };
        const getFilename = fileMessageBuffer => {
            let end = fileMessageBuffer.indexOf(0, FILE_MESSAGE_FILE_NAME_OFFSET);
            if (end === -1) {
                end = fileMessageBuffer.length;
            }
            return fileMessageBuffer.slice(FILE_MESSAGE_FILE_NAME_OFFSET, end).toString("ascii");
        };
        const parseFileMessageBuffer = fileMessageBuffer => {
            let command = getCommand(fileMessageBuffer);
            const filename = getFilename(fileMessageBuffer);
            if (filename === "") {
                command = FileMessageCommand.Done;
            }
            return {
                command,
                filename
            };
        };
        const performControlTransfer = async (device, bmRequestType, bRequest, wValue, wIndex, dataOrLength) => {
            const previousTimeout = device.timeout;
            device.timeout = USB_CONTROL_TRANSFER_TIMEOUT_MS;
            const result = await fromCallback((callback => {
                device.controlTransfer(bmRequestType, bRequest, wValue, wIndex, dataOrLength, callback);
            }));
            device.timeout = previousTimeout;
            return result;
        };
        const isUsbBootCapableUSBDevice = (idVendor, idProduct) => idVendor === USB_VENDOR_ID_BROADCOM_CORPORATION && (idProduct === USB_PRODUCT_ID_BCM2708_BOOT || idProduct === USB_PRODUCT_ID_BCM2710_BOOT || idProduct === USB_PRODUCT_ID_BCM2711_BOOT);
        exports.isUsbBootCapableUSBDevice = isUsbBootCapableUSBDevice;
        const isUsbBootCapableUSBDevice$ = device => exports.isUsbBootCapableUSBDevice(device.deviceDescriptor.idVendor, device.deviceDescriptor.idProduct);
        const isRaspberryPiInMassStorageMode = device => device.deviceDescriptor.idVendor === USB_VENDOR_ID_NETCHIP_TECHNOLOGY && device.deviceDescriptor.idProduct === USB_PRODUCT_ID_POCKETBOOK_PRO_903;
        const isComputeModule4InMassStorageMode = device => device.deviceDescriptor.idVendor === USB_VENDOR_ID_BROADCOM_CORPORATION && device.deviceDescriptor.idProduct === USB_PRODUCT_ID_BCM2711_MASS_STORAGE;
        const initializeDevice = device => {
            device.open();
            let interfaceNumber;
            let endpointNumber;
            if (device.configDescriptor.bNumInterfaces === USB_ENDPOINT_INTERFACES_SOC_BCM2835) {
                interfaceNumber = 0;
                endpointNumber = 1;
            } else {
                interfaceNumber = 1;
                endpointNumber = 3;
            }
            const iface = device.interface(interfaceNumber);
            iface.claim();
            const endpoint = iface.endpoint(endpointNumber);
            if (!(endpoint instanceof usb.OutEndpoint)) {
                throw new Error("endpoint is not an usb.OutEndpoint");
            }
            debug("Initialized device correctly", devicePortId(device));
            return {
                iface,
                endpoint
            };
        };
        const sendSize = async (device, size) => {
            await performControlTransfer(device, usb.LIBUSB_REQUEST_TYPE_VENDOR, USB_REQUEST_CODE_GET_STATUS, size & USBBOOT_MESSAGE_MAX_BUFFER_LENGTH, size >> CONTROL_TRANSFER_INDEX_RIGHT_BIT_SHIFT, NULL_BUFFER);
        };
        function* chunks(buffer, size) {
            for (let start = 0; start < buffer.length; start += size) {
                yield buffer.slice(start, start + size);
            }
        }
        const transfer = async (endpoint, chunk) => {
            endpoint.timeout = USB_BULK_TRANSFER_TIMEOUT_MS;
            for (let tries = 0; tries < 3; tries++) {
                if (tries > 0) {
                    debug("Transfer stall, retrying");
                }
                try {
                    await fromCallback((callback => {
                        endpoint.transfer(chunk, callback);
                    }));
                    return;
                } catch (error) {
                    if (error.errno === usb.LIBUSB_TRANSFER_STALL) {
                        continue;
                    }
                    throw error;
                }
            }
        };
        const epWrite = async (buffer, device, endpoint) => {
            debug("Sending buffer size", buffer.length);
            await sendSize(device, buffer.length);
            if (buffer.length > 0) {
                for (const chunk of chunks(buffer, TRANSFER_BLOCK_SIZE)) {
                    debug("Sending chunk of size", chunk.length);
                    await transfer(endpoint, chunk);
                }
            }
        };
        const epRead = async (device, bytesToRead) => await performControlTransfer(device, usb.LIBUSB_REQUEST_TYPE_VENDOR | usb.LIBUSB_ENDPOINT_IN, USB_REQUEST_CODE_GET_STATUS, bytesToRead & USBBOOT_MESSAGE_MAX_BUFFER_LENGTH, bytesToRead >> CONTROL_TRANSFER_INDEX_RIGHT_BIT_SHIFT, bytesToRead);
        const getDeviceId = device => `${device.busNumber}:${device.deviceAddress}`;
        const safeReadFile = async filename => {
            try {
                const {app, remote} = __webpack_require__(46);
                return await readFile(Path.join((app || remote.app).getAppPath().replace(/\.asar$/, (() => process.platform === "darwin" ? "-" + process.arch : "")), "generated", __dirname.replace("node_modules", "modules"), "..", "blobs", filename));
            } catch (e) {}
        };
        const getFileBuffer = async (device, filename) => {
            const folder = device.deviceDescriptor.idProduct === USB_PRODUCT_ID_BCM2711_BOOT ? "cm4" : "raspberrypi";
            const buffer = await safeReadFile(Path.join(folder, filename));
            if (buffer === undefined) {
                debug("Can't read file", filename);
            }
            return buffer;
        };
        const createBootMessageBuffer = bootCodeBufferLength => {
            const bootMessageBufferSize = BOOT_MESSAGE_BOOTCODE_LENGTH_SIZE + BOOT_MESSAGE_SIGNATURE_SIZE;
            const bootMessageBuffer = Buffer.alloc(bootMessageBufferSize);
            bootMessageBuffer.writeInt32LE(bootCodeBufferLength, BOOT_MESSAGE_BOOTCODE_LENGTH_OFFSET);
            return bootMessageBuffer;
        };
        const secondStageBoot = async (device, endpoint) => {
            const bootcodeBuffer = await getFileBuffer(device, "bootcode.bin");
            if (bootcodeBuffer === undefined) {
                throw new Error("Can't find bootcode.bin");
            }
            const bootMessage = createBootMessageBuffer(bootcodeBuffer.length);
            await epWrite(bootMessage, device, endpoint);
            debug(`Writing ${bootMessage.length} bytes`, devicePortId(device));
            await epWrite(bootcodeBuffer, device, endpoint);
            const data = await epRead(device, RETURN_CODE_LENGTH);
            const returnCode = data.readInt32LE(0);
            if (returnCode !== RETURN_CODE_SUCCESS) {
                throw new Error(`Couldn't write the bootcode, got return code ${returnCode} from device`);
            }
        };
        class UsbbootDevice extends events_1.EventEmitter {
            constructor(portId) {
                super();
                this.portId = portId;
                this._step = 0;
            }
            get progress() {
                return Math.round(this._step / this.LAST_STEP * 100);
            }
            get step() {
                return this._step;
            }
            set step(step) {
                this._step = step;
                this.emit("progress", this.progress);
            }
        }
        exports.UsbbootDevice = UsbbootDevice;
        class CM3 extends UsbbootDevice {
            constructor() {
                super(...arguments);
                this.LAST_STEP = 40;
            }
        }
        exports.CM3 = CM3;
        class CM4 extends UsbbootDevice {
            constructor() {
                super(...arguments);
                this.LAST_STEP = 10;
            }
        }
        exports.CM4 = CM4;
        class UsbbootScanner extends events_1.EventEmitter {
            constructor() {
                super();
                this.usbbootDevices = new Map;
                this.attachedDeviceIds = new Set;
                this.boundAttachDevice = this.attachDevice.bind(this);
                this.boundDetachDevice = this.detachDevice.bind(this);
            }
            start() {
                debug("Waiting for BCM2835/6/7/2711");
                usb.getDeviceList().map(this.boundAttachDevice);
                this.emit("ready");
                usb.on("attach", this.boundAttachDevice);
                usb.on("detach", this.boundDetachDevice);
                this.interval = setInterval((() => {}), POLLING_INTERVAL_MS);
            }
            stop() {
                usb.removeListener("attach", this.boundAttachDevice);
                usb.removeListener("detach", this.boundDetachDevice);
                clearInterval(this.interval);
                this.usbbootDevices.clear();
            }
            step(device, step) {
                const usbbootDevice = this.getOrCreate(device);
                usbbootDevice.step = step;
                if (step === usbbootDevice.LAST_STEP) {
                    this.remove(device);
                }
            }
            get(device) {
                const key = devicePortId(device);
                return this.usbbootDevices.get(key);
            }
            getOrCreate(device) {
                const key = devicePortId(device);
                let usbbootDevice = this.usbbootDevices.get(key);
                if (usbbootDevice === undefined) {
                    const Cls = device.deviceDescriptor.idProduct === USB_PRODUCT_ID_BCM2711_BOOT ? CM4 : CM3;
                    usbbootDevice = new Cls(key);
                    this.usbbootDevices.set(key, usbbootDevice);
                    this.emit("attach", usbbootDevice);
                }
                return usbbootDevice;
            }
            remove(device) {
                const key = devicePortId(device);
                const usbbootDevice = this.usbbootDevices.get(key);
                if (usbbootDevice !== undefined) {
                    this.usbbootDevices.delete(key);
                    this.emit("detach", usbbootDevice);
                }
            }
            async attachDevice(device) {
                if (this.attachedDeviceIds.has(getDeviceId(device))) {
                    return;
                }
                this.attachedDeviceIds.add(getDeviceId(device));
                const usbbootDevice = this.get(device);
                if ((isRaspberryPiInMassStorageMode(device) || isComputeModule4InMassStorageMode(device)) && usbbootDevice !== undefined) {
                    this.step(device, usbbootDevice.LAST_STEP);
                    return;
                }
                if (!isUsbBootCapableUSBDevice$(device)) {
                    return;
                }
                debug("Found serial number", device.deviceDescriptor.iSerialNumber);
                debug("port id", devicePortId(device));
                try {
                    const {endpoint} = initializeDevice(device);
                    if (device.deviceDescriptor.iSerialNumber === 0 || device.deviceDescriptor.iSerialNumber === 3) {
                        debug("Sending bootcode.bin", devicePortId(device));
                        this.step(device, 0);
                        await secondStageBoot(device, endpoint);
                    } else {
                        debug("Second stage boot server", devicePortId(device));
                        await this.fileServer(device, endpoint, 2);
                    }
                    device.close();
                } catch (error) {
                    debug("error", error, devicePortId(device));
                    this.remove(device);
                }
            }
            detachDevice(device) {
                this.attachedDeviceIds.delete(getDeviceId(device));
                if (!isUsbBootCapableUSBDevice$(device)) {
                    return;
                }
                const usbbootDevice = this.getOrCreate(device);
                const step = device.deviceDescriptor.iSerialNumber === 1 ? usbbootDevice.LAST_STEP - 1 : 1;
                debug("detach", devicePortId(device), step);
                this.step(device, step);
                setTimeout((() => {
                    const $usbbootDevice = this.get(device);
                    if ($usbbootDevice !== undefined && $usbbootDevice.step === step) {
                        debug("device", devicePortId(device), "did not reattached after", DEVICE_UNPLUG_TIMEOUT, "ms.");
                        this.remove(device);
                    }
                }), DEVICE_UNPLUG_TIMEOUT);
            }
            async fileServer(device, endpoint, step) {
                while (true) {
                    let data;
                    try {
                        data = await epRead(device, FILE_MESSAGE_SIZE);
                    } catch (error) {
                        if (error.message === "LIBUSB_ERROR_NO_DEVICE" || error.message === "LIBUSB_ERROR_IO") {
                            break;
                        }
                        await delay(READ_ERROR_DELAY);
                        continue;
                    }
                    this.step(device, step);
                    step += 1;
                    const message = parseFileMessageBuffer(data);
                    debug("Received message", FileMessageCommand[message.command], message.filename, devicePortId(device));
                    if (message.command === FileMessageCommand.GetFileSize || message.command === FileMessageCommand.ReadFile) {
                        const buffer = await getFileBuffer(device, message.filename);
                        if (buffer === undefined) {
                            debug(`Couldn't find ${message.filename}`, devicePortId(device));
                            await sendSize(device, 0);
                        } else {
                            if (message.command === FileMessageCommand.GetFileSize) {
                                await sendSize(device, buffer.length);
                            } else {
                                await epWrite(buffer, device, endpoint);
                            }
                        }
                    } else if (message.command === FileMessageCommand.Done) {
                        break;
                    }
                }
                debug("File server done", devicePortId(device));
                await delay(2e3);
                try {
                    device.open();
                } catch (_a) {}
            }
        }
        exports.UsbbootScanner = UsbbootScanner;
        const devicePortId = device => {
            let result = `${device.busNumber}`;
            if (device.portNumbers !== undefined) {
                result += `-${device.portNumbers.join(".")}`;
            }
            return result;
        };
    }, (module, exports, __webpack_require__) => {
        var binary = __webpack_require__(39);
        var path = __webpack_require__(34);
        var binding_path = binary.find(path.resolve(path.join(__dirname, "./package.json")));
        var usb = exports = module.exports = __webpack_require__(40);
        var events = __webpack_require__(41);
        var util = __webpack_require__(14);
        if (usb.INIT_ERROR) {
            console.warn("Failed to initialize libusb.");
            usb.Device = function() {
                throw new Error("Device cannot be instantiated directly.");
            };
            usb.Transfer = function() {
                throw new Error("Transfer cannot be instantiated directly.");
            };
            usb.setDebugLevel = function() {};
            usb.getDeviceList = function() {
                return [];
            };
            usb._enableHotplugEvents = function() {};
            usb._disableHotplugEvents = function() {};
        }
        Object.keys(events.EventEmitter.prototype).forEach((function(key) {
            exports[key] = events.EventEmitter.prototype[key];
        }));
        exports.findByIds = function(vid, pid) {
            var devices = usb.getDeviceList();
            for (var i = 0; i < devices.length; i++) {
                var deviceDesc = devices[i].deviceDescriptor;
                if (deviceDesc.idVendor == vid && deviceDesc.idProduct == pid) {
                    return devices[i];
                }
            }
        };
        usb.Device.prototype.timeout = 1e3;
        usb.Device.prototype.open = function(defaultConfig) {
            this.__open();
            if (defaultConfig === false) return;
            this.interfaces = [];
            var len = this.configDescriptor.interfaces.length;
            for (var i = 0; i < len; i++) {
                this.interfaces[i] = new Interface(this, i);
            }
        };
        usb.Device.prototype.close = function() {
            this.__close();
            this.interfaces = null;
        };
        Object.defineProperty(usb.Device.prototype, "configDescriptor", {
            get: function() {
                return this._configDescriptor || (this._configDescriptor = this.__getConfigDescriptor());
            }
        });
        Object.defineProperty(usb.Device.prototype, "allConfigDescriptors", {
            get: function() {
                return this._allConfigDescriptors || (this._allConfigDescriptors = this.__getAllConfigDescriptors());
            }
        });
        Object.defineProperty(usb.Device.prototype, "parent", {
            get: function() {
                return this._parent || (this._parent = this.__getParent());
            }
        });
        usb.Device.prototype.interface = function(addr) {
            if (!this.interfaces) {
                throw new Error("Device must be open before searching for interfaces");
            }
            addr = addr || 0;
            for (var i = 0; i < this.interfaces.length; i++) {
                if (this.interfaces[i].interfaceNumber == addr) {
                    return this.interfaces[i];
                }
            }
        };
        var SETUP_SIZE = usb.LIBUSB_CONTROL_SETUP_SIZE;
        usb.Device.prototype.controlTransfer = function(bmRequestType, bRequest, wValue, wIndex, data_or_length, callback) {
            var self = this;
            var isIn = !!(bmRequestType & usb.LIBUSB_ENDPOINT_IN);
            var wLength;
            if (isIn) {
                if (!(data_or_length >= 0)) {
                    throw new TypeError("Expected size number for IN transfer (based on bmRequestType)");
                }
                wLength = data_or_length;
            } else {
                if (!Buffer.isBuffer(data_or_length)) {
                    throw new TypeError("Expected buffer for OUT transfer (based on bmRequestType)");
                }
                wLength = data_or_length.length;
            }
            var buf = new Buffer(wLength + SETUP_SIZE);
            buf.writeUInt8(bmRequestType, 0);
            buf.writeUInt8(bRequest, 1);
            buf.writeUInt16LE(wValue, 2);
            buf.writeUInt16LE(wIndex, 4);
            buf.writeUInt16LE(wLength, 6);
            if (!isIn) {
                data_or_length.copy(buf, SETUP_SIZE);
            }
            var transfer = new usb.Transfer(this, 0, usb.LIBUSB_TRANSFER_TYPE_CONTROL, this.timeout, (function(error, buf, actual) {
                if (callback) {
                    if (isIn) {
                        callback.call(self, error, buf.slice(SETUP_SIZE, SETUP_SIZE + actual));
                    } else {
                        callback.call(self, error);
                    }
                }
            }));
            try {
                transfer.submit(buf);
            } catch (e) {
                if (callback) {
                    process.nextTick((function() {
                        callback.call(self, e);
                    }));
                }
            }
            return this;
        };
        usb.Device.prototype.getStringDescriptor = function(desc_index, callback) {
            var langid = 1033;
            var length = 255;
            this.controlTransfer(usb.LIBUSB_ENDPOINT_IN, usb.LIBUSB_REQUEST_GET_DESCRIPTOR, usb.LIBUSB_DT_STRING << 8 | desc_index, langid, length, (function(error, buf) {
                if (error) return callback(error);
                callback(undefined, buf.toString("utf16le", 2));
            }));
        };
        usb.Device.prototype.setConfiguration = function(desired, cb) {
            var self = this;
            this.__setConfiguration(desired, (function(err) {
                if (!err) {
                    this.interfaces = [];
                    var len = this.configDescriptor.interfaces.length;
                    for (var i = 0; i < len; i++) {
                        this.interfaces[i] = new Interface(this, i);
                    }
                }
                cb.call(self, err);
            }));
        };
        function Interface(device, id) {
            this.device = device;
            this.id = id;
            this.altSetting = 0;
            this.__refresh();
        }
        Interface.prototype.__refresh = function() {
            this.descriptor = this.device.configDescriptor.interfaces[this.id][this.altSetting];
            this.interfaceNumber = this.descriptor.bInterfaceNumber;
            this.endpoints = [];
            var len = this.descriptor.endpoints.length;
            for (var i = 0; i < len; i++) {
                var desc = this.descriptor.endpoints[i];
                var c = desc.bEndpointAddress & usb.LIBUSB_ENDPOINT_IN ? InEndpoint : OutEndpoint;
                this.endpoints[i] = new c(this.device, desc);
            }
        };
        Interface.prototype.claim = function() {
            this.device.__claimInterface(this.id);
        };
        Interface.prototype.release = function(closeEndpoints, cb) {
            var self = this;
            if (typeof closeEndpoints == "function") {
                cb = closeEndpoints;
                closeEndpoints = null;
            }
            if (!closeEndpoints || this.endpoints.length == 0) {
                next();
            } else {
                var n = self.endpoints.length;
                self.endpoints.forEach((function(ep, i) {
                    if (ep.pollActive) {
                        ep.once("end", (function() {
                            if (--n == 0) next();
                        }));
                        ep.stopPoll();
                    } else {
                        if (--n == 0) next();
                    }
                }));
            }
            function next() {
                self.device.__releaseInterface(self.id, (function(err) {
                    if (!err) {
                        self.altSetting = 0;
                        self.__refresh();
                    }
                    cb.call(self, err);
                }));
            }
        };
        Interface.prototype.isKernelDriverActive = function() {
            return this.device.__isKernelDriverActive(this.id);
        };
        Interface.prototype.detachKernelDriver = function() {
            return this.device.__detachKernelDriver(this.id);
        };
        Interface.prototype.attachKernelDriver = function() {
            return this.device.__attachKernelDriver(this.id);
        };
        Interface.prototype.setAltSetting = function(altSetting, cb) {
            var self = this;
            this.device.__setInterface(this.id, altSetting, (function(err) {
                if (!err) {
                    self.altSetting = altSetting;
                    self.__refresh();
                }
                cb.call(self, err);
            }));
        };
        Interface.prototype.endpoint = function(addr) {
            for (var i = 0; i < this.endpoints.length; i++) {
                if (this.endpoints[i].address == addr) {
                    return this.endpoints[i];
                }
            }
        };
        function Endpoint(device, descriptor) {
            this.device = device;
            this.descriptor = descriptor;
            this.address = descriptor.bEndpointAddress;
            this.transferType = descriptor.bmAttributes & 3;
        }
        util.inherits(Endpoint, events.EventEmitter);
        Endpoint.prototype.timeout = 0;
        Endpoint.prototype.makeTransfer = function(timeout, callback) {
            return new usb.Transfer(this.device, this.address, this.transferType, timeout, callback);
        };
        Endpoint.prototype.startPoll = function(nTransfers, transferSize, callback) {
            if (this.pollTransfers) {
                throw new Error("Polling already active");
            }
            nTransfers = nTransfers || 3;
            this.pollTransferSize = transferSize || this.descriptor.wMaxPacketSize;
            this.pollActive = true;
            this.pollPending = 0;
            var transfers = [];
            for (var i = 0; i < nTransfers; i++) {
                transfers[i] = this.makeTransfer(0, callback);
            }
            return transfers;
        };
        Endpoint.prototype.stopPoll = function(cb) {
            if (!this.pollTransfers) {
                throw new Error("Polling is not active.");
            }
            for (var i = 0; i < this.pollTransfers.length; i++) {
                try {
                    this.pollTransfers[i].cancel();
                } catch (err) {
                    this.emit("error", err);
                }
            }
            this.pollActive = false;
            if (cb) this.once("end", cb);
        };
        function InEndpoint(device, descriptor) {
            Endpoint.call(this, device, descriptor);
        }
        exports.InEndpoint = InEndpoint;
        util.inherits(InEndpoint, Endpoint);
        InEndpoint.prototype.direction = "in";
        InEndpoint.prototype.transfer = function(length, cb) {
            var self = this;
            var buffer = new Buffer(length);
            function callback(error, buf, actual) {
                cb.call(self, error, buffer.slice(0, actual));
            }
            try {
                this.makeTransfer(this.timeout, callback).submit(buffer);
            } catch (e) {
                process.nextTick((function() {
                    cb.call(self, e);
                }));
            }
            return this;
        };
        InEndpoint.prototype.startPoll = function(nTransfers, transferSize) {
            var self = this;
            this.pollTransfers = InEndpoint.super_.prototype.startPoll.call(this, nTransfers, transferSize, transferDone);
            function transferDone(error, buf, actual) {
                if (!error) {
                    self.emit("data", buf.slice(0, actual));
                } else if (error.errno != usb.LIBUSB_TRANSFER_CANCELLED) {
                    self.emit("error", error);
                    self.stopPoll();
                }
                if (self.pollActive) {
                    startTransfer(this);
                } else {
                    self.pollPending--;
                    if (self.pollPending == 0) {
                        self.emit("end");
                    }
                }
            }
            function startTransfer(t) {
                try {
                    t.submit(new Buffer(self.pollTransferSize), transferDone);
                } catch (e) {
                    self.emit("error", e);
                    self.stopPoll();
                }
            }
            this.pollTransfers.forEach(startTransfer);
            self.pollPending = this.pollTransfers.length;
        };
        function OutEndpoint(device, descriptor) {
            Endpoint.call(this, device, descriptor);
        }
        exports.OutEndpoint = OutEndpoint;
        util.inherits(OutEndpoint, Endpoint);
        OutEndpoint.prototype.direction = "out";
        OutEndpoint.prototype.transfer = function(buffer, cb) {
            var self = this;
            if (!buffer) {
                buffer = new Buffer(0);
            } else if (!Buffer.isBuffer(buffer)) {
                buffer = new Buffer(buffer);
            }
            function callback(error, buf, actual) {
                if (cb) cb.call(self, error);
            }
            try {
                this.makeTransfer(this.timeout, callback).submit(buffer);
            } catch (e) {
                process.nextTick((function() {
                    callback(e);
                }));
            }
            return this;
        };
        OutEndpoint.prototype.transferWithZLP = function(buf, cb) {
            if (buf.length % this.descriptor.wMaxPacketSize == 0) {
                this.transfer(buf);
                this.transfer(new Buffer(0), cb);
            } else {
                this.transfer(buf, cb);
            }
        };
        var hotplugListeners = 0;
        exports.on("newListener", (function(name) {
            if (name !== "attach" && name !== "detach") return;
            if (++hotplugListeners === 1) {
                usb._enableHotplugEvents();
            }
        }));
        exports.on("removeListener", (function(name) {
            if (name !== "attach" && name !== "detach") return;
            if (--hotplugListeners === 0) {
                usb._disableHotplugEvents();
            }
        }));
    }, module => {
        "use strict";
        module.exports = {
            find: () => {}
        };
    }, module => {
        module.exports = require("./modules/@balena.io/usb/build/Release/usb_bindings.node");
    }, module => {
        "use strict";
        module.exports = require("events");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
            module.exports = __webpack_require__(43);
        } else {
            module.exports = __webpack_require__(45);
        }
    }, (module, exports, __webpack_require__) => {
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.storage = localstorage();
        exports.destroy = (() => {
            let warned = false;
            return () => {
                if (!warned) {
                    warned = true;
                    console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
                }
            };
        })();
        exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ];
        function useColors() {
            if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
                return true;
            }
            if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
                return false;
            }
            return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
        }
        function formatArgs(args) {
            args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
            if (!this.useColors) {
                return;
            }
            const c = "color: " + this.color;
            args.splice(1, 0, c, "color: inherit");
            let index = 0;
            let lastC = 0;
            args[0].replace(/%[a-zA-Z%]/g, (match => {
                if (match === "%%") {
                    return;
                }
                index++;
                if (match === "%c") {
                    lastC = index;
                }
            }));
            args.splice(lastC, 0, c);
        }
        exports.log = console.debug || console.log || (() => {});
        function save(namespaces) {
            try {
                if (namespaces) {
                    exports.storage.setItem("debug", namespaces);
                } else {
                    exports.storage.removeItem("debug");
                }
            } catch (error) {}
        }
        function load() {
            let r;
            try {
                r = exports.storage.getItem("debug");
            } catch (error) {}
            if (!r && typeof process !== "undefined" && "env" in process) {
                r = process.env.DEBUG;
            }
            return r;
        }
        function localstorage() {
            try {
                return localStorage;
            } catch (error) {}
        }
        module.exports = __webpack_require__(44)(exports);
        const {formatters} = module.exports;
        formatters.j = function(v) {
            try {
                return JSON.stringify(v);
            } catch (error) {
                return "[UnexpectedJSONParseError]: " + error.message;
            }
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        function setup(env) {
            createDebug.debug = createDebug;
            createDebug.default = createDebug;
            createDebug.coerce = coerce;
            createDebug.disable = disable;
            createDebug.enable = enable;
            createDebug.enabled = enabled;
            createDebug.humanize = __webpack_require__(11);
            createDebug.destroy = destroy;
            Object.keys(env).forEach((key => {
                createDebug[key] = env[key];
            }));
            createDebug.names = [];
            createDebug.skips = [];
            createDebug.formatters = {};
            function selectColor(namespace) {
                let hash = 0;
                for (let i = 0; i < namespace.length; i++) {
                    hash = (hash << 5) - hash + namespace.charCodeAt(i);
                    hash |= 0;
                }
                return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
            }
            createDebug.selectColor = selectColor;
            function createDebug(namespace) {
                let prevTime;
                let enableOverride = null;
                function debug(...args) {
                    if (!debug.enabled) {
                        return;
                    }
                    const self = debug;
                    const curr = Number(new Date);
                    const ms = curr - (prevTime || curr);
                    self.diff = ms;
                    self.prev = prevTime;
                    self.curr = curr;
                    prevTime = curr;
                    args[0] = createDebug.coerce(args[0]);
                    if (typeof args[0] !== "string") {
                        args.unshift("%O");
                    }
                    let index = 0;
                    args[0] = args[0].replace(/%([a-zA-Z%])/g, ((match, format) => {
                        if (match === "%%") {
                            return "%";
                        }
                        index++;
                        const formatter = createDebug.formatters[format];
                        if (typeof formatter === "function") {
                            const val = args[index];
                            match = formatter.call(self, val);
                            args.splice(index, 1);
                            index--;
                        }
                        return match;
                    }));
                    createDebug.formatArgs.call(self, args);
                    const logFn = self.log || createDebug.log;
                    logFn.apply(self, args);
                }
                debug.namespace = namespace;
                debug.useColors = createDebug.useColors();
                debug.color = createDebug.selectColor(namespace);
                debug.extend = extend;
                debug.destroy = createDebug.destroy;
                Object.defineProperty(debug, "enabled", {
                    enumerable: true,
                    configurable: false,
                    get: () => enableOverride === null ? createDebug.enabled(namespace) : enableOverride,
                    set: v => {
                        enableOverride = v;
                    }
                });
                if (typeof createDebug.init === "function") {
                    createDebug.init(debug);
                }
                return debug;
            }
            function extend(namespace, delimiter) {
                const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
                newDebug.log = this.log;
                return newDebug;
            }
            function enable(namespaces) {
                createDebug.save(namespaces);
                createDebug.names = [];
                createDebug.skips = [];
                let i;
                const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
                const len = split.length;
                for (i = 0; i < len; i++) {
                    if (!split[i]) {
                        continue;
                    }
                    namespaces = split[i].replace(/\*/g, ".*?");
                    if (namespaces[0] === "-") {
                        createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
                    } else {
                        createDebug.names.push(new RegExp("^" + namespaces + "$"));
                    }
                }
            }
            function disable() {
                const namespaces = [ ...createDebug.names.map(toNamespace), ...createDebug.skips.map(toNamespace).map((namespace => "-" + namespace)) ].join(",");
                createDebug.enable("");
                return namespaces;
            }
            function enabled(name) {
                if (name[name.length - 1] === "*") {
                    return true;
                }
                let i;
                let len;
                for (i = 0, len = createDebug.skips.length; i < len; i++) {
                    if (createDebug.skips[i].test(name)) {
                        return false;
                    }
                }
                for (i = 0, len = createDebug.names.length; i < len; i++) {
                    if (createDebug.names[i].test(name)) {
                        return true;
                    }
                }
                return false;
            }
            function toNamespace(regexp) {
                return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
            }
            function coerce(val) {
                if (val instanceof Error) {
                    return val.stack || val.message;
                }
                return val;
            }
            function destroy() {
                console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
            }
            createDebug.enable(createDebug.load());
            return createDebug;
        }
        module.exports = setup;
    }, (module, exports, __webpack_require__) => {
        const tty = __webpack_require__(13);
        const util = __webpack_require__(14);
        exports.init = init;
        exports.log = log;
        exports.formatArgs = formatArgs;
        exports.save = save;
        exports.load = load;
        exports.useColors = useColors;
        exports.destroy = util.deprecate((() => {}), "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
        exports.colors = [ 6, 2, 3, 4, 5, 1 ];
        try {
            const supportsColor = __webpack_require__(15);
            if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
                exports.colors = [ 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221 ];
            }
        } catch (error) {}
        exports.inspectOpts = Object.keys(process.env).filter((key => /^debug_/i.test(key))).reduce(((obj, key) => {
            const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, ((_, k) => k.toUpperCase()));
            let val = process.env[key];
            if (/^(yes|on|true|enabled)$/i.test(val)) {
                val = true;
            } else if (/^(no|off|false|disabled)$/i.test(val)) {
                val = false;
            } else if (val === "null") {
                val = null;
            } else {
                val = Number(val);
            }
            obj[prop] = val;
            return obj;
        }), {});
        function useColors() {
            return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
        }
        function formatArgs(args) {
            const {namespace: name, useColors} = this;
            if (useColors) {
                const c = this.color;
                const colorCode = "[3" + (c < 8 ? c : "8;5;" + c);
                const prefix = `  ${colorCode};1m${name} [0m`;
                args[0] = prefix + args[0].split("\n").join("\n" + prefix);
                args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "[0m");
            } else {
                args[0] = getDate() + name + " " + args[0];
            }
        }
        function getDate() {
            if (exports.inspectOpts.hideDate) {
                return "";
            }
            return (new Date).toISOString() + " ";
        }
        function log(...args) {
            return process.stderr.write(util.format(...args) + "\n");
        }
        function save(namespaces) {
            if (namespaces) {
                process.env.DEBUG = namespaces;
            } else {
                delete process.env.DEBUG;
            }
        }
        function load() {
            return process.env.DEBUG;
        }
        function init(debug) {
            debug.inspectOpts = {};
            const keys = Object.keys(exports.inspectOpts);
            for (let i = 0; i < keys.length; i++) {
                debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
            }
        }
        module.exports = __webpack_require__(44)(exports);
        const {formatters} = module.exports;
        formatters.o = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts).split("\n").map((str => str.trim())).join(" ");
        };
        formatters.O = function(v) {
            this.inspectOpts.colors = this.useColors;
            return util.inspect(v, this.inspectOpts);
        };
    }, module => {
        "use strict";
        module.exports = require("electron");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        const addon = __webpack_require__(48);
        const XXHash32 = addon.XXHash32, XXHash64 = addon.XXHash64, XXHash3 = addon.XXHash3, XXHash128 = addon.XXHash128;
        module.exports = {
            XXHash32,
            XXHash64,
            XXHash3,
            XXHash128
        };
    }, module => {
        module.exports = require("./modules/xxhash-addon/build/Release/addon.node");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        module.exports = __webpack_require__(50);
    }, module => {
        module.exports = require("./modules/mountutils/build/Release/MountUtils.node");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var stream = __webpack_require__(17);
        function crc32(buffer, seed, table) {
            var crc = seed ^ -1;
            var length = buffer.length - 15;
            var TABLE = table || crc32.TABLE.DEFAULT;
            var i = 0;
            while (i < length) {
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
                crc = crc >>> 8 ^ TABLE[255 & (crc ^ buffer[i++])];
            }
            length = length + 15;
            while (i < length) crc = crc >>> 8 ^ TABLE[(crc ^ buffer[i++]) & 255];
            return crc ^ -1;
        }
        module.exports = crc32;
        crc32.TABLE = {
            DEFAULT: new Int32Array([ 0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117 ]),
            CASTAGNOLI: new Int32Array([ 0, 4067132163, 3778769143, 324072436, 3348797215, 904991772, 648144872, 3570033899, 2329499855, 2024987596, 1809983544, 2575936315, 1296289744, 3207089363, 2893594407, 1578318884, 274646895, 3795141740, 4049975192, 51262619, 3619967088, 632279923, 922689671, 3298075524, 2592579488, 1760304291, 2075979607, 2312596564, 1562183871, 2943781820, 3156637768, 1313733451, 549293790, 3537243613, 3246849577, 871202090, 3878099393, 357341890, 102525238, 4101499445, 2858735121, 1477399826, 1264559846, 3107202533, 1845379342, 2677391885, 2361733625, 2125378298, 820201905, 3263744690, 3520608582, 598981189, 4151959214, 85089709, 373468761, 3827903834, 3124367742, 1213305469, 1526817161, 2842354314, 2107672161, 2412447074, 2627466902, 1861252501, 1098587580, 3004210879, 2688576843, 1378610760, 2262928035, 1955203488, 1742404180, 2511436119, 3416409459, 969524848, 714683780, 3639785095, 205050476, 4266873199, 3976438427, 526918040, 1361435347, 2739821008, 2954799652, 1114974503, 2529119692, 1691668175, 2005155131, 2247081528, 3690758684, 697762079, 986182379, 3366744552, 476452099, 3993867776, 4250756596, 255256311, 1640403810, 2477592673, 2164122517, 1922457750, 2791048317, 1412925310, 1197962378, 3037525897, 3944729517, 427051182, 170179418, 4165941337, 746937522, 3740196785, 3451792453, 1070968646, 1905808397, 2213795598, 2426610938, 1657317369, 3053634322, 1147748369, 1463399397, 2773627110, 4215344322, 153784257, 444234805, 3893493558, 1021025245, 3467647198, 3722505002, 797665321, 2197175160, 1889384571, 1674398607, 2443626636, 1164749927, 3070701412, 2757221520, 1446797203, 137323447, 4198817972, 3910406976, 461344835, 3484808360, 1037989803, 781091935, 3705997148, 2460548119, 1623424788, 1939049696, 2180517859, 1429367560, 2807687179, 3020495871, 1180866812, 410100952, 3927582683, 4182430767, 186734380, 3756733383, 763408580, 1053836080, 3434856499, 2722870694, 1344288421, 1131464017, 2971354706, 1708204729, 2545590714, 2229949006, 1988219213, 680717673, 3673779818, 3383336350, 1002577565, 4010310262, 493091189, 238226049, 4233660802, 2987750089, 1082061258, 1395524158, 2705686845, 1972364758, 2279892693, 2494862625, 1725896226, 952904198, 3399985413, 3656866545, 731699698, 4283874585, 222117402, 510512622, 3959836397, 3280807620, 837199303, 582374963, 3504198960, 68661723, 4135334616, 3844915500, 390545967, 1230274059, 3141532936, 2825850620, 1510247935, 2395924756, 2091215383, 1878366691, 2644384480, 3553878443, 565732008, 854102364, 3229815391, 340358836, 3861050807, 4117890627, 119113024, 1493875044, 2875275879, 3090270611, 1247431312, 2660249211, 1828433272, 2141937292, 2378227087, 3811616794, 291187481, 34330861, 4032846830, 615137029, 3603020806, 3314634738, 939183345, 1776939221, 2609017814, 2295496738, 2058945313, 2926798794, 1545135305, 1330124605, 3173225534, 4084100981, 17165430, 307568514, 3762199681, 888469610, 3332340585, 3587147933, 665062302, 2042050490, 2346497209, 2559330125, 1793573966, 3190661285, 1279665062, 1595330642, 2910671697 ])
        };
        crc32.Hash = class CRC32Stream extends stream.Transform {
            constructor(options) {
                super(options);
                this.bytesRead = 0;
                this.bytesWritten = 0;
                this.crc = options && options.seed != null ? options.seed : 0;
                this.crcTable = options && (options.table || crc32.TABLE.DEFAULT);
            }
            update(data, encoding) {
                this.write(data, encoding);
                return this;
            }
            digest(encoding) {
                var buffer = Buffer.alloc(4, 0);
                buffer.writeInt32BE(this.crc, 0);
                return encoding == null ? buffer : buffer.toString(encoding);
            }
            _transform(chunk, _, next) {
                this.bytesRead += chunk.length;
                this.crc = crc32(chunk, this.crc, this.crcTable);
                next();
            }
            _flush(done) {
                this.push(this.digest());
                this.bytesWritten += 4;
                done();
            }
        };
        crc32.createHash = function createHash() {
            return new crc32.Hash;
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ProgressSparseWriteStream = exports.SparseWriteStream = void 0;
        const direct_io_1 = __webpack_require__(4);
        const stream_1 = __webpack_require__(17);
        const aligned_lockable_buffer_1 = __webpack_require__(22);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const progress_1 = __webpack_require__(28);
        const utils_1 = __webpack_require__(21);
        class SparseWriteStream extends stream_1.Writable {
            constructor({destination, highWaterMark, firstBytesToKeep = 0, maxRetries = 5}) {
                super({
                    objectMode: true,
                    highWaterMark
                });
                this.bytesWritten = 0;
                this._firstChunks = [];
                this.destination = destination;
                this.firstBytesToKeep = firstBytesToKeep;
                this.maxRetries = maxRetries;
            }
            async writeChunk(chunk, flushing = false) {
                await (0, errors_1.retryOnTransientError)((async () => {
                    this.position = chunk.position;
                    await this.destination.write(chunk.buffer, 0, chunk.buffer.length, chunk.position);
                    if (!flushing) {
                        this.position += chunk.buffer.length;
                        this.bytesWritten += chunk.buffer.length;
                    }
                }), this.maxRetries, constants_1.RETRY_BASE_TIMEOUT);
            }
            copyChunk(chunk) {
                if ((0, aligned_lockable_buffer_1.isAlignedLockableBuffer)(chunk.buffer)) {
                    const buffer = (0, direct_io_1.getAlignedBuffer)(chunk.buffer.length, chunk.buffer.alignment);
                    chunk.buffer.copy(buffer);
                    return {
                        position: chunk.position,
                        buffer
                    };
                } else {
                    return chunk;
                }
            }
            async __write(chunk) {
                const unlock = (0, aligned_lockable_buffer_1.isAlignedLockableBuffer)(chunk.buffer) ? await chunk.buffer.rlock() : undefined;
                try {
                    if (chunk.position < this.firstBytesToKeep) {
                        const end = chunk.position + chunk.buffer.length;
                        if (end <= this.firstBytesToKeep) {
                            this._firstChunks.push(this.copyChunk(chunk));
                            this.position = chunk.position + chunk.buffer.length;
                            this.bytesWritten += chunk.buffer.length;
                        } else {
                            const difference = this.firstBytesToKeep - chunk.position;
                            this._firstChunks.push(this.copyChunk({
                                position: chunk.position,
                                buffer: chunk.buffer.slice(0, difference)
                            }));
                            this.position = this.firstBytesToKeep;
                            this.bytesWritten += difference;
                            const remainingBuffer = chunk.buffer.slice(difference);
                            await this.writeChunk({
                                position: this.firstBytesToKeep,
                                buffer: remainingBuffer
                            });
                        }
                    } else {
                        await this.writeChunk(chunk);
                    }
                } finally {
                    unlock === null || unlock === void 0 ? void 0 : unlock();
                }
            }
            _write(chunk, _enc, callback) {
                (0, utils_1.asCallback)(this.__write(chunk), callback);
            }
            async __final() {
                try {
                    for (const chunk of this._firstChunks) {
                        await this.writeChunk(chunk, true);
                    }
                } catch (error) {
                    this.destroy();
                    throw error;
                }
            }
            _final(callback) {
                (0, utils_1.asCallback)(this.__final(), callback);
            }
        }
        exports.SparseWriteStream = SparseWriteStream;
        exports.ProgressSparseWriteStream = (0, progress_1.makeClassEmitProgressEvents)(SparseWriteStream, "bytesWritten", "position");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.File = exports.ProgressWriteStream = void 0;
        const fs_1 = __webpack_require__(5);
        const path_1 = __webpack_require__(34);
        const progress_1 = __webpack_require__(28);
        const source_destination_1 = __webpack_require__(54);
        const block_read_stream_1 = __webpack_require__(82);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const sparse_write_stream_1 = __webpack_require__(52);
        exports.ProgressWriteStream = (0, progress_1.makeClassEmitProgressEvents)(fs_1.WriteStream, "bytesWritten", "bytesWritten");
        const READ_TRIES = 5;
        const readEndMarker = Buffer.from(`not the correct data ${Math.random()}`);
        class File extends source_destination_1.SourceDestination {
            constructor({path, write = false}) {
                super();
                this.path = path;
                this.oWrite = write;
            }
            getOpenFlags() {
                return this.oWrite ? fs_1.constants.O_CREAT | fs_1.constants.O_RDWR : fs_1.constants.O_RDONLY;
            }
            async canRead() {
                return true;
            }
            async canWrite() {
                return this.oWrite;
            }
            async canCreateReadStream() {
                return true;
            }
            canCreateWriteStream() {
                return this.canWrite();
            }
            canCreateSparseWriteStream() {
                return this.canWrite();
            }
            async _getMetadata() {
                return {
                    size: (await fs_1.promises.stat(this.path)).size,
                    name: (0, path_1.basename)(this.path)
                };
            }
            async read(buffer, bufferOffset, length, sourceOffset) {
                let result;
                let tries = READ_TRIES;
                const markerPosition = bufferOffset + length - readEndMarker.length;
                if (length >= readEndMarker.length) {
                    readEndMarker.copy(buffer, markerPosition);
                }
                do {
                    if (tries < READ_TRIES) {
                        console.warn("Incomplete read", {
                            path: this.path,
                            bufferOffset,
                            length,
                            sourceOffset,
                            bufferLength: buffer.length
                        });
                    }
                    result = await this.fileHandle.read(buffer, bufferOffset, length, sourceOffset);
                    tries -= 1;
                } while (tries > 0 && length >= readEndMarker.length && result.bytesRead === length && readEndMarker.compare(buffer, markerPosition, markerPosition + readEndMarker.length) === 0);
                return result;
            }
            write(buffer, bufferOffset, length, fileOffset) {
                return this.fileHandle.write(buffer, bufferOffset, length, fileOffset);
            }
            async createReadStream({emitProgress = false, start = 0, end, alignment, numBuffers} = {}) {
                await this.open();
                const metadata = await this.getMetadata();
                if (metadata.size !== 0) {
                    const lastByte = metadata.size - 1;
                    end = end === undefined ? lastByte : Math.min(end, lastByte);
                }
                if (emitProgress) {
                    return new block_read_stream_1.ProgressBlockReadStream({
                        source: this,
                        alignment,
                        start,
                        end,
                        numBuffers
                    });
                } else {
                    return new block_read_stream_1.BlockReadStream({
                        source: this,
                        alignment,
                        start,
                        end,
                        numBuffers
                    });
                }
            }
            async createWriteStream({highWaterMark} = {}) {
                const stream = new exports.ProgressWriteStream(null, {
                    fd: this.fileHandle.fd,
                    autoClose: false,
                    highWaterMark
                });
                stream.on("finish", stream.emit.bind(stream, "done"));
                return stream;
            }
            async createSparseWriteStream({highWaterMark} = {}) {
                const stream = new sparse_write_stream_1.ProgressSparseWriteStream({
                    destination: this,
                    highWaterMark
                });
                stream.on("finish", stream.emit.bind(stream, "done"));
                return stream;
            }
            async _open() {
                await (0, errors_1.retryOnTransientError)((async () => {
                    this.fileHandle = await fs_1.promises.open(this.path, this.getOpenFlags());
                }), 5, constants_1.RETRY_BASE_TIMEOUT);
            }
            async _close() {
                await this.fileHandle.close();
            }
        }
        exports.File = File;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.SourceDestination = exports.SparseStreamVerifier = exports.StreamVerifier = exports.Verifier = exports.SourceDestinationFs = exports.createHasher = exports.ProgressHashStream = exports.CountingHashStream = void 0;
        const stream_1 = __webpack_require__(17);
        const events_1 = __webpack_require__(41);
        const fileType = __webpack_require__(55);
        const partitioninfo_1 = __webpack_require__(56);
        const path_1 = __webpack_require__(34);
        const xxhash_addon_1 = __webpack_require__(47);
        const aligned_lockable_buffer_1 = __webpack_require__(22);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const sparse_filter_stream_1 = __webpack_require__(79);
        const sparse_read_stream_1 = __webpack_require__(81);
        const utils_1 = __webpack_require__(21);
        const progress_1 = __webpack_require__(28);
        class HashStream extends stream_1.Transform {
            constructor(seed, outEnc) {
                super();
                if (outEnc && typeof outEnc !== "string" && !Buffer.isBuffer(outEnc)) {
                    outEnc = "buffer";
                }
                this._outEnc = outEnc;
                this._hash = new xxhash_addon_1.XXHash3(seed);
            }
            _transform(chunk, _encoding, callback) {
                this._hash.update(chunk);
                callback();
            }
            _flush(callback) {
                this.push(this._hash.digest(this._outEnc));
                callback();
            }
        }
        class CountingHashStream extends HashStream {
            constructor() {
                super(...arguments);
                this.bytesWritten = 0;
            }
            async __transform(chunk, encoding) {
                const unlock = (0, aligned_lockable_buffer_1.isAlignedLockableBuffer)(chunk) ? await chunk.rlock() : undefined;
                try {
                    await (0, utils_1.fromCallback)((callback => {
                        super._transform(chunk, encoding, callback);
                    }));
                } finally {
                    unlock === null || unlock === void 0 ? void 0 : unlock();
                }
                this.bytesWritten += chunk.length;
            }
            _transform(chunk, encoding, callback) {
                (0, utils_1.asCallback)(this.__transform(chunk, encoding), callback);
            }
        }
        exports.CountingHashStream = CountingHashStream;
        exports.ProgressHashStream = (0, progress_1.makeClassEmitProgressEvents)(CountingHashStream, "bytesWritten", "bytesWritten");
        function createHasher() {
            const hasher = new exports.ProgressHashStream(constants_1.XXHASH_SEED, "buffer");
            hasher.on("finish", (async () => {
                const checksum = (await (0, utils_1.streamToBuffer)(hasher)).toString("hex");
                hasher.emit("checksum", checksum);
            }));
            return hasher;
        }
        exports.createHasher = createHasher;
        class SourceDestinationFs {
            constructor(source) {
                this.source = source;
            }
            open(_path, _options, callback) {
                callback(null, 1);
            }
            close(_fd, callback) {
                callback(null);
            }
            fstat(_fd, callback) {
                this.source.getMetadata().then((metadata => {
                    if (metadata.size === undefined) {
                        callback(new Error("No size"));
                        return;
                    }
                    callback(null, {
                        size: metadata.size
                    });
                })).catch(callback);
            }
            read(_fd, buffer, bufferOffset, length, sourceOffset, callback) {
                this.source.read(buffer, bufferOffset, length, sourceOffset).then((res => {
                    callback(null, res.bytesRead, res.buffer);
                })).catch(callback);
            }
        }
        exports.SourceDestinationFs = SourceDestinationFs;
        class Verifier extends events_1.EventEmitter {
            constructor() {
                super(...arguments);
                this.progress = {
                    bytes: 0,
                    position: 0,
                    speed: 0,
                    averageSpeed: 0
                };
            }
            handleEventsAndPipe(stream, meter) {
                meter.on("progress", (progress => {
                    this.progress = progress;
                    this.emit("progress", progress);
                }));
                stream.on("end", this.emit.bind(this, "end"));
                meter.on("finish", this.emit.bind(this, "finish"));
                stream.once("error", (() => {
                    stream.unpipe(meter);
                    meter.end();
                }));
                stream.pipe(meter);
            }
        }
        exports.Verifier = Verifier;
        class StreamVerifier extends Verifier {
            constructor(source, checksum, size) {
                super();
                this.source = source;
                this.checksum = checksum;
                this.size = size;
            }
            async run() {
                const stream = await this.source.createReadStream({
                    end: this.size - 1,
                    alignment: this.source.getAlignment()
                });
                stream.on("error", this.emit.bind(this, "error"));
                const hasher = createHasher();
                hasher.on("error", this.emit.bind(this, "error"));
                hasher.on("checksum", (streamChecksum => {
                    if (streamChecksum !== this.checksum) {
                        this.emit("error", new errors_1.ChecksumVerificationError(`Source and destination checksums do not match: ${this.checksum} !== ${streamChecksum}`, streamChecksum, this.checksum));
                    }
                }));
                this.handleEventsAndPipe(stream, hasher);
            }
        }
        exports.StreamVerifier = StreamVerifier;
        class SparseStreamVerifier extends Verifier {
            constructor(source, blocks) {
                super();
                this.source = source;
                this.blocks = blocks;
            }
            async run() {
                const alignment = this.source.getAlignment();
                let stream;
                if (await this.source.canRead()) {
                    stream = new sparse_read_stream_1.SparseReadStream({
                        source: this.source,
                        blocks: this.blocks,
                        chunkSize: constants_1.CHUNK_SIZE,
                        verify: true,
                        generateChecksums: false,
                        alignment,
                        numBuffers: 2
                    });
                    stream.on("error", this.emit.bind(this, "error"));
                } else if (await this.source.canCreateReadStream()) {
                    const originalStream = await this.source.createReadStream();
                    originalStream.once("error", (error => {
                        originalStream.unpipe(transform);
                        this.emit("error", error);
                    }));
                    const transform = new sparse_filter_stream_1.SparseFilterStream({
                        blocks: this.blocks,
                        verify: true,
                        generateChecksums: false
                    });
                    transform.once("error", (error => {
                        originalStream.unpipe(transform);
                        if (typeof originalStream.destroy === "function") {
                            originalStream.destroy();
                        }
                        this.emit("error", error);
                    }));
                    originalStream.pipe(transform);
                    stream = transform;
                } else {
                    throw new errors_1.NotCapable;
                }
                const meter = new progress_1.ProgressWritable({
                    objectMode: true
                });
                this.handleEventsAndPipe(stream, meter);
            }
        }
        exports.SparseStreamVerifier = SparseStreamVerifier;
        class SourceDestination extends events_1.EventEmitter {
            constructor() {
                super(...arguments);
                this.isOpen = false;
            }
            static register(Cls) {
                if (Cls.mimetype !== undefined) {
                    SourceDestination.mimetypes.set(Cls.mimetype, Cls);
                }
            }
            getAlignment() {
                return undefined;
            }
            async canRead() {
                return false;
            }
            async canWrite() {
                return false;
            }
            async canCreateReadStream() {
                return false;
            }
            async canCreateSparseReadStream() {
                return false;
            }
            async canCreateWriteStream() {
                return false;
            }
            async canCreateSparseWriteStream() {
                return false;
            }
            async getMetadata() {
                if (this.metadata === undefined) {
                    this.metadata = await this._getMetadata();
                }
                return this.metadata;
            }
            async _getMetadata() {
                return {};
            }
            async read(_buffer, _bufferOffset, _length, _sourceOffset) {
                throw new errors_1.NotCapable;
            }
            async write(_buffer, _bufferOffset, _length, _fileOffset) {
                throw new errors_1.NotCapable;
            }
            async createReadStream(_options = {}) {
                throw new errors_1.NotCapable;
            }
            async createSparseReadStream(_options = {}) {
                throw new errors_1.NotCapable;
            }
            async getBlocks() {
                throw new errors_1.NotCapable;
            }
            async createWriteStream(_options = {}) {
                throw new errors_1.NotCapable;
            }
            async createSparseWriteStream(_options = {}) {
                throw new errors_1.NotCapable;
            }
            async open() {
                if (!this.isOpen) {
                    await this._open();
                    this.isOpen = true;
                }
            }
            async close() {
                if (this.isOpen) {
                    await this._close();
                    this.isOpen = false;
                }
            }
            async _open() {}
            async _close() {}
            createVerifier(checksumOrBlocks, size) {
                if (Array.isArray(checksumOrBlocks)) {
                    for (const block of checksumOrBlocks) {
                        if (block.checksumType === undefined || block.checksum === undefined) {
                            throw new Error("Block is missing checksum or checksumType attributes, can not create verifier");
                        }
                    }
                    return new SparseStreamVerifier(this, checksumOrBlocks);
                } else {
                    if (size === undefined) {
                        throw new Error("A size argument is required for creating a stream checksum verifier");
                    }
                    return new StreamVerifier(this, checksumOrBlocks, size);
                }
            }
            async getMimeTypeFromName() {
                const metadata = await this.getMetadata();
                if (metadata.name === undefined) {
                    return;
                }
                const extension = (0, path_1.extname)(metadata.name).toLowerCase();
                if (extension === ".dmg") {
                    return "application/x-apple-diskimage";
                }
            }
            async getMimeTypeFromContent() {
                let stream;
                try {
                    stream = await this.createReadStream({
                        end: 263,
                        alignment: this.getAlignment()
                    });
                } catch (error) {
                    if (error instanceof errors_1.NotCapable) {
                        return;
                    }
                    throw error;
                }
                const ft = fileType(await (0, utils_1.streamToBuffer)(stream));
                if (ft !== null) {
                    return ft.mime;
                }
            }
            async getInnerSourceHelper(mimetype) {
                if (mimetype === undefined) {
                    return this;
                }
                const Cls = SourceDestination.mimetypes.get(mimetype);
                if (Cls === undefined) {
                    return this;
                }
                if (Cls.requiresRandomReadableSource && !await this.canRead()) {
                    throw new errors_1.NotCapable(`Can not read a ${Cls.name} from a ${this.constructor.name}.`);
                }
                const innerSource = new Cls(this);
                return innerSource.getInnerSource();
            }
            async getInnerSource() {
                await this.open();
                const metadata = await this.getMetadata();
                if (metadata.isEtch === true) {
                    return this;
                }
                let mimetype = await this.getMimeTypeFromName();
                if (mimetype !== undefined) {
                    try {
                        return await this.getInnerSourceHelper(mimetype);
                    } catch (error) {
                        if (error instanceof errors_1.NotCapable) {
                            throw error;
                        }
                    }
                }
                mimetype = await this.getMimeTypeFromContent();
                return this.getInnerSourceHelper(mimetype);
            }
            async getPartitionTable() {
                const stream = await this.createReadStream({
                    end: 34 * 512,
                    alignment: this.getAlignment()
                });
                const buffer = await (0, utils_1.streamToBuffer)(stream);
                try {
                    return await (0, partitioninfo_1.getPartitions)(buffer, {
                        getLogical: false
                    });
                } catch (_a) {}
            }
        }
        exports.SourceDestination = SourceDestination;
        SourceDestination.imageExtensions = [ "img", "iso", "bin", "dsk", "hddimg", "raw", "dmg", "sdcard", "rpi-sdimg", "wic" ];
        SourceDestination.mimetypes = new Map;
    }, module => {
        "use strict";
        const toBytes = s => [ ...s ].map((c => c.charCodeAt(0)));
        const xpiZipFilename = toBytes("META-INF/mozilla.rsa");
        const oxmlContentTypes = toBytes("[Content_Types].xml");
        const oxmlRels = toBytes("_rels/.rels");
        module.exports = input => {
            const buf = input instanceof Uint8Array ? input : new Uint8Array(input);
            if (!(buf && buf.length > 1)) {
                return null;
            }
            const check = (header, options) => {
                options = Object.assign({
                    offset: 0
                }, options);
                for (let i = 0; i < header.length; i++) {
                    if (options.mask) {
                        if (header[i] !== (options.mask[i] & buf[i + options.offset])) {
                            return false;
                        }
                    } else if (header[i] !== buf[i + options.offset]) {
                        return false;
                    }
                }
                return true;
            };
            const checkString = (header, options) => check(toBytes(header), options);
            if (check([ 255, 216, 255 ])) {
                return {
                    ext: "jpg",
                    mime: "image/jpeg"
                };
            }
            if (check([ 137, 80, 78, 71, 13, 10, 26, 10 ])) {
                return {
                    ext: "png",
                    mime: "image/png"
                };
            }
            if (check([ 71, 73, 70 ])) {
                return {
                    ext: "gif",
                    mime: "image/gif"
                };
            }
            if (check([ 87, 69, 66, 80 ], {
                offset: 8
            })) {
                return {
                    ext: "webp",
                    mime: "image/webp"
                };
            }
            if (check([ 70, 76, 73, 70 ])) {
                return {
                    ext: "flif",
                    mime: "image/flif"
                };
            }
            if ((check([ 73, 73, 42, 0 ]) || check([ 77, 77, 0, 42 ])) && check([ 67, 82 ], {
                offset: 8
            })) {
                return {
                    ext: "cr2",
                    mime: "image/x-canon-cr2"
                };
            }
            if (check([ 73, 73, 42, 0 ]) || check([ 77, 77, 0, 42 ])) {
                return {
                    ext: "tif",
                    mime: "image/tiff"
                };
            }
            if (check([ 66, 77 ])) {
                return {
                    ext: "bmp",
                    mime: "image/bmp"
                };
            }
            if (check([ 73, 73, 188 ])) {
                return {
                    ext: "jxr",
                    mime: "image/vnd.ms-photo"
                };
            }
            if (check([ 56, 66, 80, 83 ])) {
                return {
                    ext: "psd",
                    mime: "image/vnd.adobe.photoshop"
                };
            }
            if (check([ 80, 75, 3, 4 ])) {
                if (check([ 109, 105, 109, 101, 116, 121, 112, 101, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 101, 112, 117, 98, 43, 122, 105, 112 ], {
                    offset: 30
                })) {
                    return {
                        ext: "epub",
                        mime: "application/epub+zip"
                    };
                }
                if (check(xpiZipFilename, {
                    offset: 30
                })) {
                    return {
                        ext: "xpi",
                        mime: "application/x-xpinstall"
                    };
                }
                if (checkString("mimetypeapplication/vnd.oasis.opendocument.text", {
                    offset: 30
                })) {
                    return {
                        ext: "odt",
                        mime: "application/vnd.oasis.opendocument.text"
                    };
                }
                if (checkString("mimetypeapplication/vnd.oasis.opendocument.spreadsheet", {
                    offset: 30
                })) {
                    return {
                        ext: "ods",
                        mime: "application/vnd.oasis.opendocument.spreadsheet"
                    };
                }
                if (checkString("mimetypeapplication/vnd.oasis.opendocument.presentation", {
                    offset: 30
                })) {
                    return {
                        ext: "odp",
                        mime: "application/vnd.oasis.opendocument.presentation"
                    };
                }
                if (check(oxmlContentTypes, {
                    offset: 30
                }) || check(oxmlRels, {
                    offset: 30
                })) {
                    const sliced = buf.subarray(4, 4 + 2e3);
                    const nextZipHeaderIndex = arr => arr.findIndex(((el, i, arr) => arr[i] === 80 && arr[i + 1] === 75 && arr[i + 2] === 3 && arr[i + 3] === 4));
                    const header2Pos = nextZipHeaderIndex(sliced);
                    if (header2Pos !== -1) {
                        const slicedAgain = buf.subarray(header2Pos + 8, header2Pos + 8 + 1e3);
                        const header3Pos = nextZipHeaderIndex(slicedAgain);
                        if (header3Pos !== -1) {
                            const offset = 8 + header2Pos + header3Pos + 30;
                            if (checkString("word/", {
                                offset
                            })) {
                                return {
                                    ext: "docx",
                                    mime: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                                };
                            }
                            if (checkString("ppt/", {
                                offset
                            })) {
                                return {
                                    ext: "pptx",
                                    mime: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
                                };
                            }
                            if (checkString("xl/", {
                                offset
                            })) {
                                return {
                                    ext: "xlsx",
                                    mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                                };
                            }
                        }
                    }
                }
            }
            if (check([ 80, 75 ]) && (buf[2] === 3 || buf[2] === 5 || buf[2] === 7) && (buf[3] === 4 || buf[3] === 6 || buf[3] === 8)) {
                return {
                    ext: "zip",
                    mime: "application/zip"
                };
            }
            if (check([ 117, 115, 116, 97, 114 ], {
                offset: 257
            })) {
                return {
                    ext: "tar",
                    mime: "application/x-tar"
                };
            }
            if (check([ 82, 97, 114, 33, 26, 7 ]) && (buf[6] === 0 || buf[6] === 1)) {
                return {
                    ext: "rar",
                    mime: "application/x-rar-compressed"
                };
            }
            if (check([ 31, 139, 8 ])) {
                return {
                    ext: "gz",
                    mime: "application/gzip"
                };
            }
            if (check([ 66, 90, 104 ])) {
                return {
                    ext: "bz2",
                    mime: "application/x-bzip2"
                };
            }
            if (check([ 55, 122, 188, 175, 39, 28 ])) {
                return {
                    ext: "7z",
                    mime: "application/x-7z-compressed"
                };
            }
            if (check([ 120, 1 ])) {
                return {
                    ext: "dmg",
                    mime: "application/x-apple-diskimage"
                };
            }
            if (check([ 51, 103, 112, 53 ]) || check([ 0, 0, 0 ]) && check([ 102, 116, 121, 112 ], {
                offset: 4
            }) && (check([ 109, 112, 52, 49 ], {
                offset: 8
            }) || check([ 109, 112, 52, 50 ], {
                offset: 8
            }) || check([ 105, 115, 111, 109 ], {
                offset: 8
            }) || check([ 105, 115, 111, 50 ], {
                offset: 8
            }) || check([ 109, 109, 112, 52 ], {
                offset: 8
            }) || check([ 77, 52, 86 ], {
                offset: 8
            }) || check([ 100, 97, 115, 104 ], {
                offset: 8
            }))) {
                return {
                    ext: "mp4",
                    mime: "video/mp4"
                };
            }
            if (check([ 77, 84, 104, 100 ])) {
                return {
                    ext: "mid",
                    mime: "audio/midi"
                };
            }
            if (check([ 26, 69, 223, 163 ])) {
                const sliced = buf.subarray(4, 4 + 4096);
                const idPos = sliced.findIndex(((el, i, arr) => arr[i] === 66 && arr[i + 1] === 130));
                if (idPos !== -1) {
                    const docTypePos = idPos + 3;
                    const findDocType = type => [ ...type ].every(((c, i) => sliced[docTypePos + i] === c.charCodeAt(0)));
                    if (findDocType("matroska")) {
                        return {
                            ext: "mkv",
                            mime: "video/x-matroska"
                        };
                    }
                    if (findDocType("webm")) {
                        return {
                            ext: "webm",
                            mime: "video/webm"
                        };
                    }
                }
            }
            if (check([ 0, 0, 0, 20, 102, 116, 121, 112, 113, 116, 32, 32 ]) || check([ 102, 114, 101, 101 ], {
                offset: 4
            }) || check([ 102, 116, 121, 112, 113, 116, 32, 32 ], {
                offset: 4
            }) || check([ 109, 100, 97, 116 ], {
                offset: 4
            }) || check([ 119, 105, 100, 101 ], {
                offset: 4
            })) {
                return {
                    ext: "mov",
                    mime: "video/quicktime"
                };
            }
            if (check([ 82, 73, 70, 70 ])) {
                if (check([ 65, 86, 73 ], {
                    offset: 8
                })) {
                    return {
                        ext: "avi",
                        mime: "video/x-msvideo"
                    };
                }
                if (check([ 87, 65, 86, 69 ], {
                    offset: 8
                })) {
                    return {
                        ext: "wav",
                        mime: "audio/x-wav"
                    };
                }
                if (check([ 81, 76, 67, 77 ], {
                    offset: 8
                })) {
                    return {
                        ext: "qcp",
                        mime: "audio/qcelp"
                    };
                }
            }
            if (check([ 48, 38, 178, 117, 142, 102, 207, 17, 166, 217 ])) {
                return {
                    ext: "wmv",
                    mime: "video/x-ms-wmv"
                };
            }
            if (check([ 0, 0, 1, 186 ]) || check([ 0, 0, 1, 179 ])) {
                return {
                    ext: "mpg",
                    mime: "video/mpeg"
                };
            }
            if (check([ 102, 116, 121, 112, 51, 103 ], {
                offset: 4
            })) {
                return {
                    ext: "3gp",
                    mime: "video/3gpp"
                };
            }
            for (let start = 0; start < 2 && start < buf.length - 16; start++) {
                if (check([ 73, 68, 51 ], {
                    offset: start
                }) || check([ 255, 226 ], {
                    offset: start,
                    mask: [ 255, 226 ]
                })) {
                    return {
                        ext: "mp3",
                        mime: "audio/mpeg"
                    };
                }
                if (check([ 255, 228 ], {
                    offset: start,
                    mask: [ 255, 228 ]
                })) {
                    return {
                        ext: "mp2",
                        mime: "audio/mpeg"
                    };
                }
                if (check([ 255, 248 ], {
                    offset: start,
                    mask: [ 255, 252 ]
                })) {
                    return {
                        ext: "mp2",
                        mime: "audio/mpeg"
                    };
                }
                if (check([ 255, 240 ], {
                    offset: start,
                    mask: [ 255, 252 ]
                })) {
                    return {
                        ext: "mp4",
                        mime: "audio/mpeg"
                    };
                }
            }
            if (check([ 102, 116, 121, 112, 77, 52, 65 ], {
                offset: 4
            }) || check([ 77, 52, 65, 32 ])) {
                return {
                    ext: "m4a",
                    mime: "audio/m4a"
                };
            }
            if (check([ 79, 112, 117, 115, 72, 101, 97, 100 ], {
                offset: 28
            })) {
                return {
                    ext: "opus",
                    mime: "audio/opus"
                };
            }
            if (check([ 79, 103, 103, 83 ])) {
                if (check([ 128, 116, 104, 101, 111, 114, 97 ], {
                    offset: 28
                })) {
                    return {
                        ext: "ogv",
                        mime: "video/ogg"
                    };
                }
                if (check([ 1, 118, 105, 100, 101, 111, 0 ], {
                    offset: 28
                })) {
                    return {
                        ext: "ogm",
                        mime: "video/ogg"
                    };
                }
                if (check([ 127, 70, 76, 65, 67 ], {
                    offset: 28
                })) {
                    return {
                        ext: "oga",
                        mime: "audio/ogg"
                    };
                }
                if (check([ 83, 112, 101, 101, 120, 32, 32 ], {
                    offset: 28
                })) {
                    return {
                        ext: "spx",
                        mime: "audio/ogg"
                    };
                }
                if (check([ 1, 118, 111, 114, 98, 105, 115 ], {
                    offset: 28
                })) {
                    return {
                        ext: "ogg",
                        mime: "audio/ogg"
                    };
                }
                return {
                    ext: "ogx",
                    mime: "application/ogg"
                };
            }
            if (check([ 102, 76, 97, 67 ])) {
                return {
                    ext: "flac",
                    mime: "audio/x-flac"
                };
            }
            if (check([ 77, 65, 67, 32 ])) {
                return {
                    ext: "ape",
                    mime: "audio/ape"
                };
            }
            if (check([ 35, 33, 65, 77, 82, 10 ])) {
                return {
                    ext: "amr",
                    mime: "audio/amr"
                };
            }
            if (check([ 37, 80, 68, 70 ])) {
                return {
                    ext: "pdf",
                    mime: "application/pdf"
                };
            }
            if (check([ 77, 90 ])) {
                return {
                    ext: "exe",
                    mime: "application/x-msdownload"
                };
            }
            if ((buf[0] === 67 || buf[0] === 70) && check([ 87, 83 ], {
                offset: 1
            })) {
                return {
                    ext: "swf",
                    mime: "application/x-shockwave-flash"
                };
            }
            if (check([ 123, 92, 114, 116, 102 ])) {
                return {
                    ext: "rtf",
                    mime: "application/rtf"
                };
            }
            if (check([ 0, 97, 115, 109 ])) {
                return {
                    ext: "wasm",
                    mime: "application/wasm"
                };
            }
            if (check([ 119, 79, 70, 70 ]) && (check([ 0, 1, 0, 0 ], {
                offset: 4
            }) || check([ 79, 84, 84, 79 ], {
                offset: 4
            }))) {
                return {
                    ext: "woff",
                    mime: "font/woff"
                };
            }
            if (check([ 119, 79, 70, 50 ]) && (check([ 0, 1, 0, 0 ], {
                offset: 4
            }) || check([ 79, 84, 84, 79 ], {
                offset: 4
            }))) {
                return {
                    ext: "woff2",
                    mime: "font/woff2"
                };
            }
            if (check([ 76, 80 ], {
                offset: 34
            }) && (check([ 0, 0, 1 ], {
                offset: 8
            }) || check([ 1, 0, 2 ], {
                offset: 8
            }) || check([ 2, 0, 2 ], {
                offset: 8
            }))) {
                return {
                    ext: "eot",
                    mime: "application/octet-stream"
                };
            }
            if (check([ 0, 1, 0, 0, 0 ])) {
                return {
                    ext: "ttf",
                    mime: "font/ttf"
                };
            }
            if (check([ 79, 84, 84, 79, 0 ])) {
                return {
                    ext: "otf",
                    mime: "font/otf"
                };
            }
            if (check([ 0, 0, 1, 0 ])) {
                return {
                    ext: "ico",
                    mime: "image/x-icon"
                };
            }
            if (check([ 0, 0, 2, 0 ])) {
                return {
                    ext: "cur",
                    mime: "image/x-icon"
                };
            }
            if (check([ 70, 76, 86, 1 ])) {
                return {
                    ext: "flv",
                    mime: "video/x-flv"
                };
            }
            if (check([ 37, 33 ])) {
                return {
                    ext: "ps",
                    mime: "application/postscript"
                };
            }
            if (check([ 253, 55, 122, 88, 90, 0 ])) {
                return {
                    ext: "xz",
                    mime: "application/x-xz"
                };
            }
            if (check([ 83, 81, 76, 105 ])) {
                return {
                    ext: "sqlite",
                    mime: "application/x-sqlite3"
                };
            }
            if (check([ 78, 69, 83, 26 ])) {
                return {
                    ext: "nes",
                    mime: "application/x-nintendo-nes-rom"
                };
            }
            if (check([ 67, 114, 50, 52 ])) {
                return {
                    ext: "crx",
                    mime: "application/x-google-chrome-extension"
                };
            }
            if (check([ 77, 83, 67, 70 ]) || check([ 73, 83, 99, 40 ])) {
                return {
                    ext: "cab",
                    mime: "application/vnd.ms-cab-compressed"
                };
            }
            if (check([ 33, 60, 97, 114, 99, 104, 62, 10, 100, 101, 98, 105, 97, 110, 45, 98, 105, 110, 97, 114, 121 ])) {
                return {
                    ext: "deb",
                    mime: "application/x-deb"
                };
            }
            if (check([ 33, 60, 97, 114, 99, 104, 62 ])) {
                return {
                    ext: "ar",
                    mime: "application/x-unix-archive"
                };
            }
            if (check([ 237, 171, 238, 219 ])) {
                return {
                    ext: "rpm",
                    mime: "application/x-rpm"
                };
            }
            if (check([ 31, 160 ]) || check([ 31, 157 ])) {
                return {
                    ext: "Z",
                    mime: "application/x-compress"
                };
            }
            if (check([ 76, 90, 73, 80 ])) {
                return {
                    ext: "lz",
                    mime: "application/x-lzip"
                };
            }
            if (check([ 208, 207, 17, 224, 161, 177, 26, 225 ])) {
                return {
                    ext: "msi",
                    mime: "application/x-msi"
                };
            }
            if (check([ 6, 14, 43, 52, 2, 5, 1, 1, 13, 1, 2, 1, 1, 2 ])) {
                return {
                    ext: "mxf",
                    mime: "application/mxf"
                };
            }
            if (check([ 71 ], {
                offset: 4
            }) && (check([ 71 ], {
                offset: 192
            }) || check([ 71 ], {
                offset: 196
            }))) {
                return {
                    ext: "mts",
                    mime: "video/mp2t"
                };
            }
            if (check([ 66, 76, 69, 78, 68, 69, 82 ])) {
                return {
                    ext: "blend",
                    mime: "application/x-blender"
                };
            }
            if (check([ 66, 80, 71, 251 ])) {
                return {
                    ext: "bpg",
                    mime: "image/bpg"
                };
            }
            if (check([ 0, 0, 0, 12, 106, 80, 32, 32, 13, 10, 135, 10 ])) {
                if (check([ 106, 112, 50, 32 ], {
                    offset: 20
                })) {
                    return {
                        ext: "jp2",
                        mime: "image/jp2"
                    };
                }
                if (check([ 106, 112, 120, 32 ], {
                    offset: 20
                })) {
                    return {
                        ext: "jpx",
                        mime: "image/jpx"
                    };
                }
                if (check([ 106, 112, 109, 32 ], {
                    offset: 20
                })) {
                    return {
                        ext: "jpm",
                        mime: "image/jpm"
                    };
                }
                if (check([ 109, 106, 112, 50 ], {
                    offset: 20
                })) {
                    return {
                        ext: "mj2",
                        mime: "image/mj2"
                    };
                }
            }
            if (check([ 70, 79, 82, 77, 0 ])) {
                return {
                    ext: "aif",
                    mime: "audio/aiff"
                };
            }
            if (checkString("<?xml ")) {
                return {
                    ext: "xml",
                    mime: "application/xml"
                };
            }
            if (check([ 66, 79, 79, 75, 77, 79, 66, 73 ], {
                offset: 60
            })) {
                return {
                    ext: "mobi",
                    mime: "application/x-mobipocket-ebook"
                };
            }
            if (check([ 102, 116, 121, 112 ], {
                offset: 4
            })) {
                if (check([ 109, 105, 102, 49 ], {
                    offset: 8
                })) {
                    return {
                        ext: "heic",
                        mime: "image/heif"
                    };
                }
                if (check([ 109, 115, 102, 49 ], {
                    offset: 8
                })) {
                    return {
                        ext: "heic",
                        mime: "image/heif-sequence"
                    };
                }
                if (check([ 104, 101, 105, 99 ], {
                    offset: 8
                }) || check([ 104, 101, 105, 120 ], {
                    offset: 8
                })) {
                    return {
                        ext: "heic",
                        mime: "image/heic"
                    };
                }
                if (check([ 104, 101, 118, 99 ], {
                    offset: 8
                }) || check([ 104, 101, 118, 120 ], {
                    offset: 8
                })) {
                    return {
                        ext: "heic",
                        mime: "image/heic-sequence"
                    };
                }
            }
            if (check([ 171, 75, 84, 88, 32, 49, 49, 187, 13, 10, 26, 10 ])) {
                return {
                    ext: "ktx",
                    mime: "image/ktx"
                };
            }
            return null;
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.getPartitions = exports.get = exports.PartitionNotFound = void 0;
        const file_disk_1 = __webpack_require__(57);
        const GPT = __webpack_require__(61);
        const MBR = __webpack_require__(65);
        const typed_error_1 = __webpack_require__(78);
        const MBR_SIZE = 512;
        const GPT_SIZE = 512 * 41;
        const GPT_PROTECTIVE_MBR = 238;
        const MBR_LAST_PRIMARY_PARTITION = 4;
        const MBR_FIRST_LOGICAL_PARTITION = 5;
        function mbrPartitionDict(p, offset, index) {
            return {
                offset: offset + p.byteOffset(),
                size: p.byteSize(),
                type: p.type,
                index
            };
        }
        function gptPartitionDict(gpt, p, index) {
            return {
                offset: p.firstLBA * gpt.blockSize,
                size: (p.lastLBA - p.firstLBA + 1) * gpt.blockSize,
                type: p.type,
                guid: p.guid,
                name: p.name,
                index
            };
        }
        function getPartitionsFromMBRBuf(buf) {
            return new MBR(buf).partitions.filter((p => p.type));
        }
        async function readFromDisk(disk, offset, size) {
            const {buffer} = await disk.read(Buffer.alloc(size), 0, size, offset);
            return buffer;
        }
        async function getLogicalPartitions(disk, index, offset, extendedPartitionOffset, limit) {
            if (extendedPartitionOffset === undefined) {
                extendedPartitionOffset = offset;
            }
            if (limit === undefined) {
                limit = Infinity;
            }
            const result = [];
            if (limit <= 0) {
                return result;
            }
            const buf = await readFromDisk(disk, offset, MBR_SIZE);
            for (const p of getPartitionsFromMBRBuf(buf)) {
                if (!p.extended) {
                    result.push(mbrPartitionDict(p, offset, index));
                } else if (limit > 0) {
                    const logicalPartitions = await getLogicalPartitions(disk, index + 1, extendedPartitionOffset + p.byteOffset(), extendedPartitionOffset, limit - 1);
                    result.push(...logicalPartitions);
                    return result;
                }
            }
            return result;
        }
        function detectGPT(buffer) {
            let blockSize = MBR_SIZE;
            let lastError;
            while (blockSize <= 4096) {
                try {
                    return GPT.parse(buffer.slice(blockSize));
                } catch (error) {
                    lastError = error;
                }
                blockSize *= 2;
            }
            throw lastError;
        }
        async function getDiskPartitions(disk, {offset, includeExtended, getLogical}) {
            let extended = null;
            const mbrBuf = await readFromDisk(disk, offset, MBR_SIZE);
            const partitions = getPartitionsFromMBRBuf(mbrBuf);
            if (partitions.length >= 1 && partitions[0].type === GPT_PROTECTIVE_MBR) {
                const gptBuf = await readFromDisk(disk, 0, GPT_SIZE);
                const gpt = detectGPT(gptBuf);
                return {
                    type: "gpt",
                    partitions: gpt.partitions.map(((partition, index) => gptPartitionDict(gpt, partition, index + 1)))
                };
            } else {
                const mbrPartitions = [];
                for (let index = 0; index < partitions.length; index++) {
                    const p = partitions[index];
                    if (p.extended) {
                        extended = p;
                        if (includeExtended) {
                            mbrPartitions.push(mbrPartitionDict(p, offset, index + 1));
                        }
                    } else {
                        mbrPartitions.push(mbrPartitionDict(p, offset, index + 1));
                    }
                }
                if (extended != null && getLogical) {
                    const logicalPartitions = await getLogicalPartitions(disk, MBR_FIRST_LOGICAL_PARTITION, extended.byteOffset());
                    mbrPartitions.push(...logicalPartitions);
                }
                return {
                    type: "mbr",
                    partitions: mbrPartitions
                };
            }
        }
        class PartitionNotFound extends typed_error_1.TypedError {
            constructor(partitionNumber) {
                super(`Partition not found: ${partitionNumber}.`);
            }
        }
        exports.PartitionNotFound = PartitionNotFound;
        async function getPartition(disk, partitionNumber) {
            if (partitionNumber < 1) {
                throw new Error("The partition number must be at least 1.");
            }
            const info = await getDiskPartitions(disk, {
                includeExtended: true,
                offset: 0,
                getLogical: false
            });
            if (info.type === "gpt") {
                if (info.partitions.length < partitionNumber) {
                    throw new PartitionNotFound(partitionNumber);
                } else {
                    return info.partitions[partitionNumber - 1];
                }
            }
            if (partitionNumber <= MBR_LAST_PRIMARY_PARTITION) {
                if (partitionNumber <= info.partitions.length) {
                    return info.partitions[partitionNumber - 1];
                } else {
                    throw new PartitionNotFound(partitionNumber);
                }
            }
            const extended = info.partitions.find((p => MBR.Partition.isExtended(p.type)));
            if (!extended) {
                throw new PartitionNotFound(partitionNumber);
            } else {
                const logicalPartitionPosition = partitionNumber - MBR_FIRST_LOGICAL_PARTITION;
                const logicalPartitions = await getLogicalPartitions(disk, MBR_FIRST_LOGICAL_PARTITION, extended.offset, extended.offset, logicalPartitionPosition + 1);
                if (logicalPartitionPosition < logicalPartitions.length) {
                    return logicalPartitions[logicalPartitionPosition];
                } else {
                    throw new PartitionNotFound(partitionNumber);
                }
            }
        }
        function isString(x) {
            return typeof x === "string";
        }
        async function callWithDisk(fn, pathOrBufferOrDisk, arg) {
            if (isString(pathOrBufferOrDisk)) {
                return await file_disk_1.withOpenFile(pathOrBufferOrDisk, "r", (async fd => await fn(new file_disk_1.FileDisk(fd), arg)));
            } else if (Buffer.isBuffer(pathOrBufferOrDisk)) {
                return await fn(new file_disk_1.BufferDisk(pathOrBufferOrDisk), arg);
            } else {
                return await fn(pathOrBufferOrDisk, arg);
            }
        }
        async function get(disk, partitionNumber) {
            return await callWithDisk(getPartition, disk, partitionNumber);
        }
        exports.get = get;
        async function getPartitions(disk, {offset = 0, includeExtended = true, getLogical = true} = {
            offset: 0,
            includeExtended: true,
            getLogical: true
        }) {
            return await callWithDisk(getDiskPartitions, disk, {
                offset,
                includeExtended,
                getLogical
            });
        }
        exports.getPartitions = getPartitions;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BufferDisk = exports.FileDisk = exports.Disk = exports.withOpenFile = exports.DiskStream = exports.DiskChunk = exports.DiscardDiskChunk = exports.BufferDiskChunk = void 0;
        const fs_1 = __webpack_require__(5);
        const stream_1 = __webpack_require__(17);
        const diskchunk_1 = __webpack_require__(58);
        Object.defineProperty(exports, "BufferDiskChunk", {
            enumerable: true,
            get: function() {
                return diskchunk_1.BufferDiskChunk;
            }
        });
        Object.defineProperty(exports, "DiscardDiskChunk", {
            enumerable: true,
            get: function() {
                return diskchunk_1.DiscardDiskChunk;
            }
        });
        Object.defineProperty(exports, "DiskChunk", {
            enumerable: true,
            get: function() {
                return diskchunk_1.DiskChunk;
            }
        });
        const interval_intersection_1 = __webpack_require__(59);
        const mapped_ranges_1 = __webpack_require__(60);
        const MIN_HIGH_WATER_MARK = 16;
        const DEFAULT_HIGH_WATER_MARK = 16384;
        class DiskStream extends stream_1.Readable {
            constructor(disk, capacity, highWaterMark, position) {
                super({
                    highWaterMark: Math.max(highWaterMark, MIN_HIGH_WATER_MARK)
                });
                this.disk = disk;
                this.capacity = capacity;
                this.position = position;
                this.isReading = false;
            }
            async __read(size) {
                if (this.isReading) {
                    return;
                }
                this.isReading = true;
                while (this.isReading) {
                    const length = Math.min(size, this.capacity - this.position);
                    if (length <= 0) {
                        this.isReading = this.push(null);
                        return;
                    }
                    let bytesRead;
                    let buffer;
                    try {
                        ({bytesRead, buffer} = await this.disk.read(Buffer.allocUnsafe(length), 0, length, this.position));
                    } catch (err) {
                        this.emit("error", err);
                        return;
                    }
                    this.position += bytesRead;
                    this.isReading = this.push(buffer);
                }
            }
            _read(size) {
                this.__read(size);
            }
        }
        exports.DiskStream = DiskStream;
        class DiskTransformStream extends stream_1.Transform {
            constructor(disk) {
                super();
                this.disk = disk;
                this.position = 0;
                this.chunks = this.getKnownChunks();
                this.currentChunk = this.chunks.next().value;
            }
            * getKnownChunks() {
                for (const chunk of this.disk.knownChunks) {
                    if (chunk instanceof diskchunk_1.BufferDiskChunk) {
                        yield chunk;
                    }
                }
            }
            _transform(chunk, _enc, cb) {
                const start = this.position;
                const end = start + chunk.length - 1;
                const interval = [ start, end ];
                while (this.currentChunk) {
                    if (interval_intersection_1.intervalIntersection(this.currentChunk.interval(), interval)) {
                        const buf = this.currentChunk.data();
                        const startShift = this.currentChunk.start - start;
                        const endShift = this.currentChunk.end - end;
                        const sourceStart = startShift < 0 ? -startShift : 0;
                        const sourceEnd = buf.length - Math.max(endShift, 0);
                        const targetStart = Math.max(startShift, 0);
                        buf.copy(chunk, targetStart, sourceStart, sourceEnd);
                    }
                    if (this.currentChunk.end > end) {
                        break;
                    } else {
                        this.currentChunk = this.chunks.next().value;
                    }
                }
                this.push(chunk);
                this.position = end + 1;
                cb();
            }
        }
        async function withOpenFile(path, flags, fn) {
            const handle = await fs_1.promises.open(path, flags);
            try {
                return await fn(handle);
            } finally {
                await handle.close();
            }
        }
        exports.withOpenFile = withOpenFile;
        class Disk {
            constructor(readOnly = false, recordWrites = false, recordReads = false, discardIsZero = true) {
                this.readOnly = readOnly;
                this.recordWrites = recordWrites;
                this.recordReads = recordReads;
                this.discardIsZero = discardIsZero;
                this.knownChunks = [];
                this.capacity = null;
            }
            getTransformStream() {
                return new DiskTransformStream(this);
            }
            async read(buffer, _bufferOffset, length, fileOffset) {
                const plan = this.createReadPlan(fileOffset, length);
                return await this.readAccordingToPlan(buffer, plan);
            }
            async write(buffer, bufferOffset, length, fileOffset) {
                if (this.recordWrites) {
                    const chunk = new diskchunk_1.BufferDiskChunk(buffer.slice(bufferOffset, bufferOffset + length), fileOffset);
                    await this.insertDiskChunk(chunk);
                } else {
                    const chunk = new diskchunk_1.DiscardDiskChunk(fileOffset, length);
                    await this.insertDiskChunk(chunk, false);
                }
                if (this.readOnly) {
                    return {
                        bytesWritten: length,
                        buffer
                    };
                } else {
                    return await this._write(buffer, bufferOffset, length, fileOffset);
                }
            }
            async flush() {
                if (!this.readOnly) {
                    return await this._flush();
                }
            }
            async discard(offset, length) {
                await this.insertDiskChunk(new diskchunk_1.DiscardDiskChunk(offset, length));
            }
            async getCapacity() {
                if (this.capacity === null) {
                    this.capacity = await this._getCapacity();
                }
                return this.capacity;
            }
            async getStream(position = 0, length = null, highWaterMark = DEFAULT_HIGH_WATER_MARK) {
                let end = await this.getCapacity();
                if (length !== null) {
                    end = Math.min(position + length, end);
                }
                return new DiskStream(this, end, highWaterMark, position);
            }
            getDiscardedChunks() {
                return this.knownChunks.filter((chunk => chunk instanceof diskchunk_1.DiscardDiskChunk));
            }
            async getRanges(blockSize) {
                return Array.from(await mapped_ranges_1.getRanges(this, blockSize));
            }
            async insertDiskChunk(chunk, insert = true) {
                const capacity = await this.getCapacity();
                if (chunk.start < 0 || chunk.end > capacity) {
                    return;
                }
                let insertAt = 0;
                for (let i = 0; i < this.knownChunks.length; i++) {
                    const other = this.knownChunks[i];
                    if (other.start > chunk.end) {
                        break;
                    }
                    if (other.start < chunk.start) {
                        insertAt = i + 1;
                    } else {
                        insertAt = i;
                    }
                    if (!chunk.intersects(other)) {
                        continue;
                    } else if (other.includedIn(chunk)) {
                        this.knownChunks.splice(i, 1);
                        i--;
                    } else {
                        const newChunks = other.cut(chunk);
                        this.knownChunks.splice(i, 1, ...newChunks);
                        i += newChunks.length - 1;
                    }
                }
                if (insert) {
                    this.knownChunks.splice(insertAt, 0, chunk);
                }
            }
            createReadPlan(offset, length) {
                const end = offset + length - 1;
                const interval = [ offset, end ];
                let chunks = this.knownChunks;
                if (!this.discardIsZero) {
                    chunks = chunks.filter((c => !(c instanceof diskchunk_1.DiscardDiskChunk)));
                }
                const intersections = [];
                chunks.forEach((c => {
                    const inter = interval_intersection_1.intervalIntersection(interval, c.interval());
                    if (inter !== null) {
                        intersections.push(c.slice(inter[0], inter[1]));
                    }
                }));
                if (intersections.length === 0) {
                    return [ interval ];
                }
                const readPlan = [];
                let chunk;
                for (chunk of intersections) {
                    if (offset < chunk.start) {
                        readPlan.push([ offset, chunk.start - 1 ]);
                    }
                    readPlan.push(chunk);
                    offset = chunk.end + 1;
                }
                if (chunk && end > chunk.end) {
                    readPlan.push([ chunk.end + 1, end ]);
                }
                return readPlan;
            }
            async readAccordingToPlan(buffer, plan) {
                let offset = 0;
                for (const entry of plan) {
                    if (entry instanceof diskchunk_1.DiskChunk) {
                        const data = entry.data();
                        const length = Math.min(data.length, buffer.length - offset);
                        data.copy(buffer, offset, 0, length);
                        offset += length;
                    } else {
                        const length = entry[1] - entry[0] + 1;
                        await this._read(buffer, offset, length, entry[0]);
                        if (this.recordReads) {
                            const chunk = new diskchunk_1.BufferDiskChunk(Buffer.from(buffer.slice(offset, offset + length)), entry[0]);
                            await this.insertDiskChunk(chunk);
                        }
                        offset += length;
                    }
                }
                return {
                    bytesRead: offset,
                    buffer
                };
            }
        }
        exports.Disk = Disk;
        class FileDisk extends Disk {
            constructor(handle, readOnly = false, recordWrites = false, recordReads = false, discardIsZero = true) {
                super(readOnly, recordWrites, recordReads, discardIsZero);
                this.handle = handle;
            }
            async _getCapacity() {
                const stats = await this.handle.stat();
                return stats.size;
            }
            async _read(buffer, bufferOffset, length, fileOffset) {
                return await this.handle.read(buffer, bufferOffset, length, fileOffset);
            }
            async _write(buffer, bufferOffset, length, fileOffset) {
                return await this.handle.write(buffer, bufferOffset, length, fileOffset);
            }
            async _flush() {
                await this.handle.datasync();
            }
        }
        exports.FileDisk = FileDisk;
        class BufferDisk extends Disk {
            constructor(buffer, readOnly = false, recordWrites = false, recordReads = false, discardIsZero = true) {
                super(readOnly, recordWrites, recordReads, discardIsZero);
                this.buffer = buffer;
            }
            async _getCapacity() {
                return this.buffer.length;
            }
            async _read(buffer, bufferOffset, length, fileOffset) {
                const bytesRead = this.buffer.copy(buffer, bufferOffset, fileOffset, fileOffset + length);
                return {
                    buffer,
                    bytesRead
                };
            }
            async _write(buffer, bufferOffset, length, fileOffset) {
                const bytesWritten = buffer.copy(this.buffer, fileOffset, bufferOffset, bufferOffset + length);
                return {
                    buffer,
                    bytesWritten
                };
            }
            async _flush() {}
        }
        exports.BufferDisk = BufferDisk;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.DiscardDiskChunk = exports.BufferDiskChunk = exports.DiskChunk = void 0;
        const interval_intersection_1 = __webpack_require__(59);
        class DiskChunk {
            constructor(start, end) {
                this.start = start;
                this.end = end;
            }
            interval() {
                return [ this.start, this.end ];
            }
            intersection(other) {
                return interval_intersection_1.intervalIntersection(this.interval(), other.interval());
            }
            intersects(other) {
                return this.intersection(other) !== null;
            }
            includedIn(other) {
                return this.start >= other.start && this.end <= other.end;
            }
            cut(other) {
                const result = [];
                const intersection = this.intersection(other);
                if (intersection === null) {
                    throw new Error("`other` must be an overlapping `DiskChunk`");
                }
                if (intersection[0] > this.start) {
                    result.push(this.slice(this.start, intersection[0] - 1));
                }
                if (this.end > intersection[1]) {
                    result.push(this.slice(intersection[1] + 1, this.end));
                }
                return result;
            }
        }
        exports.DiskChunk = DiskChunk;
        class BufferDiskChunk extends DiskChunk {
            constructor(buffer, offset, copy = true) {
                super(offset, offset + buffer.length - 1);
                if (copy) {
                    this.buffer = Buffer.from(buffer);
                } else {
                    this.buffer = buffer;
                }
            }
            data() {
                return this.buffer;
            }
            slice(start, end) {
                const startInBuffer = start - this.start;
                return new BufferDiskChunk(this.buffer.slice(startInBuffer, startInBuffer + end - start + 1), start, false);
            }
        }
        exports.BufferDiskChunk = BufferDiskChunk;
        class DiscardDiskChunk extends DiskChunk {
            constructor(offset, length) {
                super(offset, offset + length - 1);
            }
            data() {
                return Buffer.alloc(this.end - this.start + 1);
            }
            slice(start, end) {
                return new DiscardDiskChunk(start, end - start + 1);
            }
        }
        exports.DiscardDiskChunk = DiscardDiskChunk;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.intervalIntersection = void 0;
        function intervalIntersection(a, b) {
            const start = Math.max(a[0], b[0]);
            const end = Math.min(a[1], b[1]);
            if (start > end) {
                return null;
            }
            return [ start, end ];
        }
        exports.intervalIntersection = intervalIntersection;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.getRanges = void 0;
        function* mapIterable(source, transform) {
            for (const value of source) {
                yield transform(value);
            }
        }
        async function getNotDiscardedIntervals(disk) {
            return notDiscardedIntervalsIterator(disk.getDiscardedChunks(), await disk.getCapacity());
        }
        function* notDiscardedIntervalsIterator(discardedChunks, capacity) {
            let lastStart = 0;
            for (const discardedChunk of discardedChunks) {
                yield [ lastStart, discardedChunk.start - 1 ];
                lastStart = discardedChunk.end + 1;
            }
            if (lastStart < capacity) {
                yield [ lastStart, capacity - 1 ];
            }
        }
        function* mergeIntervals(intervals) {
            let current;
            for (const interval of intervals) {
                if (current === undefined) {
                    current = interval.slice();
                } else if (interval[0] > current[1] + 1) {
                    yield current;
                    current = interval.slice();
                } else {
                    current[1] = interval[1];
                }
            }
            if (current !== undefined) {
                yield current;
            }
        }
        async function getRanges(disk, blockSize) {
            const intervals = await getNotDiscardedIntervals(disk);
            const blockSizedIntervals = mapIterable(intervals, (chunk => [ Math.floor(chunk[0] / blockSize), Math.floor(chunk[1] / blockSize) ]));
            const mergedBlockSizedIntervals = mergeIntervals(blockSizedIntervals);
            return mapIterable(mergedBlockSizedIntervals, (interval => {
                const offset = interval[0] * blockSize;
                const length = (interval[1] - interval[0] + 1) * blockSize;
                return {
                    offset,
                    length
                };
            }));
        }
        exports.getRanges = getRanges;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var crc32 = __webpack_require__(51);
        var uint64 = __webpack_require__(62);
        function GPT(options) {
            if (!(this instanceof GPT)) {
                return new GPT(options);
            }
            options = options != null ? options : {};
            this.blockSize = options.blockSize || 512;
            this.guid = options.guid || GPT.GUID.ZERO;
            this.revision = options.revision || 65536;
            this.headerSize = options.headerSize || GPT.HEADER_SIZE;
            this.headerChecksum = 0;
            this.currentLBA = options.currentLBA || 1;
            this.backupLBA = options.backupLBA || 0;
            this.firstLBA = options.firstLBA || 34;
            this.lastLBA = options.lastLBA || 0;
            this.tableOffset = options.tableOffset || GPT.TABLE_OFFSET;
            this.entries = options.entries || GPT.TABLE_ENTRIES;
            this.entrySize = options.entrySize || GPT.TABLE_ENTRY_SIZE;
            this.tableChecksum = 0;
            this.partitions = [];
        }
        module.exports = GPT;
        GPT.SIGNATURE = "EFI PART";
        GPT.HEADER_SIZE = 92;
        GPT.TABLE_OFFSET = 2;
        GPT.TABLE_MIN_SIZE = 16384;
        GPT.TABLE_ENTRIES = 128;
        GPT.TABLE_ENTRY_SIZE = 128;
        GPT.GUID = __webpack_require__(63);
        GPT.PartitionEntry = __webpack_require__(64);
        GPT.parse = function(buffer, offset) {
            return (new GPT).parse(buffer, offset);
        };
        GPT.parseBackup = function(buffer, offset) {
            return (new GPT).parseBackup(buffer, offset);
        };
        function align(value, boundary) {
            return value + (boundary - value % boundary) % boundary;
        }
        GPT.prototype = {
            constructor: GPT,
            get tableSize() {
                return Math.max(align(this.entrySize * this.entries, this.blockSize), GPT.TABLE_MIN_SIZE);
            },
            verify() {
                return this.verifyHeader() && this.verifyTable();
            },
            verifyHeader() {
                return this.checksumHeader() === this.headerChecksum;
            },
            verifyTable() {
                return this.checksumTable() === this.tableChecksum;
            },
            checksumHeader(buffer, offset) {
                offset = offset || 0;
                buffer = buffer || this.writeHeader(null, 0, true);
                var storedChecksum = buffer.readUInt32LE(offset + 16);
                buffer.writeUInt32LE(0, offset + 16);
                var checksum = crc32(buffer) >>> 0;
                buffer.writeUInt32LE(storedChecksum, offset + 16);
                return checksum;
            },
            checksumTable(buffer, offset) {
                var tableSize = this.tableSize;
                offset = offset || 0;
                if (buffer == null) {
                    buffer = Buffer.alloc(tableSize);
                    this.writeTable(this.partitions, buffer, offset);
                } else if (buffer.length - offset >= tableSize) {
                    buffer = buffer.length !== tableSize ? buffer.slice(offset, offset + tableSize) : buffer;
                } else {
                    throw new Error(`Buffer smaller than table size (${buffer.length - offset} < ${tableSize})`);
                }
                return crc32(buffer) >>> 0;
            },
            parse(buffer, offset) {
                offset = offset || 0;
                this.partitions.length = 0;
                this.parseHeader(buffer, offset);
                var tableOffset = (this.tableOffset - this.currentLBA) * this.blockSize;
                this.parseTable(buffer, offset + tableOffset, offset + tableOffset + this.tableSize);
                return this;
            },
            parseBackup(buffer, offset) {
                offset = offset || 0;
                this.partitions.length = 0;
                this.parseHeader(buffer, offset + this.tableSize);
                this.parseTable(buffer, offset, offset + this.tableSize);
                return this;
            },
            parseHeader(buffer, offset) {
                offset = offset || 0;
                if (buffer.length - offset < GPT.HEADER_SIZE) {
                    throw new Error(`Buffer too small: Minimum header size is ${GPT.HEADER_SIZE} bytes, got ${buffer.length - offset} bytes`);
                }
                var signature = buffer.toString("ascii", offset + 0, offset + 8);
                if (signature !== GPT.SIGNATURE) {
                    throw new Error(`Invalid signature: Expected "${GPT.SIGNATURE}", saw "${signature}"`);
                }
                this.revision = buffer.readUInt32LE(offset + 8);
                this.headerSize = buffer.readUInt32LE(offset + 12);
                this.headerChecksum = buffer.readUInt32LE(offset + 16);
                this.currentLBA = uint64.readLE(buffer, offset + 24);
                this.backupLBA = uint64.readLE(buffer, offset + 32);
                this.firstLBA = uint64.readLE(buffer, offset + 40);
                this.lastLBA = uint64.readLE(buffer, offset + 48);
                this.guid = GPT.GUID.toString(buffer, offset + 56);
                this.tableOffset = uint64.readLE(buffer, offset + 72);
                this.entries = buffer.readUInt32LE(offset + 80);
                this.entrySize = buffer.readUInt32LE(offset + 84);
                this.tableChecksum = buffer.readUInt32LE(offset + 88);
                return this;
            },
            parseTable(buffer, offset, end) {
                offset = offset || 0;
                end = Math.min(end || buffer.length, buffer.length);
                var part = null;
                for (var i = 0; i < this.entries && offset + this.entrySize <= end; i++) {
                    part = GPT.PartitionEntry.parse(buffer, offset);
                    if (!part.isEmpty()) {
                        this.partitions.push(part);
                    }
                    offset += this.entrySize;
                }
                return this;
            },
            write(buffer, offset) {
                var tableOffset = (this.tableOffset - this.currentLBA) * this.blockSize;
                var length = this.blockSize + this.tableSize;
                offset = offset || 0;
                buffer = buffer || Buffer.alloc(offset + length, 0);
                this.writeTable(this.partitions, buffer, offset + tableOffset);
                this.tableChecksum = this.checksumTable(buffer, offset + tableOffset);
                this.writeHeader(buffer, offset);
                return buffer;
            },
            writeBackup(buffer, offset) {
                var tableSize = this.tableSize;
                var length = this.blockSize + tableSize;
                offset = offset || 0;
                buffer = buffer || Buffer.alloc(offset + length);
                this.writeTable(this.partitions, buffer, offset);
                this.tableChecksum = this.checksumTable(buffer, offset);
                this.writeHeader(buffer, offset + tableSize);
                return buffer;
            },
            writeBackupFromPrimary(buffer, offset) {
                var currentLBA = this.currentLBA;
                var backupLBA = this.backupLBA;
                var tableOffset = this.tableOffset;
                this.backupLBA = currentLBA;
                this.currentLBA = backupLBA;
                this.tableOffset = this.currentLBA - this.tableSize / this.blockSize;
                var output = this.writeBackup(buffer, offset);
                this.backupLBA = backupLBA;
                this.currentLBA = currentLBA;
                this.tableOffset = tableOffset;
                return output;
            },
            writeHeader(buffer, offset, noChecksum) {
                offset = offset || 0;
                buffer = buffer || Buffer.alloc(offset + this.headerSize);
                buffer.write(GPT.SIGNATURE, offset + 0, offset + 8, "ascii");
                buffer.writeUInt32LE(this.revision, offset + 8);
                buffer.writeUInt32LE(this.headerSize, offset + 12);
                buffer.writeUInt32LE(this.headerChecksum, offset + 16);
                uint64.writeLE(buffer, this.currentLBA, offset + 24);
                uint64.writeLE(buffer, this.backupLBA, offset + 32);
                uint64.writeLE(buffer, this.firstLBA, offset + 40);
                uint64.writeLE(buffer, this.lastLBA, offset + 48);
                GPT.GUID.write(this.guid, buffer, offset + 56);
                uint64.writeLE(buffer, this.tableOffset, offset + 72);
                buffer.writeUInt32LE(this.entries, offset + 80);
                buffer.writeUInt32LE(this.entrySize, offset + 84);
                buffer.writeUInt32LE(this.tableChecksum, offset + 88);
                if (!noChecksum) {
                    this.headerChecksum = this.checksumHeader(buffer.slice(offset, offset + this.headerSize));
                    buffer.writeUInt32LE(this.headerChecksum, offset + 16);
                }
                return buffer;
            },
            writeTable(entries, buffer, offset) {
                offset = offset || 0;
                buffer = buffer || Buffer.alloc(offset + this.entrySize * entries.length);
                for (var i = 0; i < entries.length; i++) {
                    entries[i].write(buffer, offset + i * this.entrySize);
                }
                return buffer;
            }
        };
    }, module => {
        var uint64 = module.exports;
        var MAX_UINT32 = Math.pow(2, 32);
        uint64.readLE = function(buffer, offset) {
            offset = offset || 0;
            var hi = buffer.readUInt32LE(offset + 4);
            var lo = buffer.readUInt32LE(offset);
            return hi * MAX_UINT32 + lo;
        };
        uint64.writeLE = function(buffer, value, offset) {
            offset = offset || 0;
            var hi = Math.floor(value / MAX_UINT32);
            var lo = value - hi * MAX_UINT32;
            buffer.writeUInt32LE(hi, offset + 4);
            buffer.writeUInt32LE(lo, offset);
            return offset + 8;
        };
        uint64.readBE = function(buffer, offset) {
            offset = offset || 0;
            var hi = buffer.readUInt32BE(offset);
            var lo = buffer.readUInt32BE(offset + 4);
            return hi * MAX_UINT32 + lo;
        };
        uint64.writeBE = function(buffer, value, offset) {
            offset = offset || 0;
            var hi = Math.floor(value / MAX_UINT32);
            var lo = value - hi * MAX_UINT32;
            buffer.writeUInt32BE(hi, offset);
            buffer.writeUInt32BE(lo, offset + 4);
            return offset + 8;
        };
    }, module => {
        var GUID = module.exports;
        GUID.ZERO = "00000000-0000-0000-0000-000000000000";
        GUID.HEX = [];
        GUID.DEC = new Map;
        void function() {
            var hex = "";
            for (var i = 0; i < 256; i++) {
                hex = (i + 256).toString(16).substr(1).toUpperCase();
                GUID.HEX[i] = hex;
                GUID.DEC.set(hex, i);
            }
        }();
        GUID.toString = function(buffer, offset) {
            offset = offset || 0;
            var guid = GUID.HEX[buffer[offset + 3]] + GUID.HEX[buffer[offset + 2]] + GUID.HEX[buffer[offset + 1]] + GUID.HEX[buffer[offset + 0]] + "-" + GUID.HEX[buffer[offset + 5]] + GUID.HEX[buffer[offset + 4]] + "-" + GUID.HEX[buffer[offset + 7]] + GUID.HEX[buffer[offset + 6]] + "-" + GUID.HEX[buffer[offset + 8]] + GUID.HEX[buffer[offset + 9]] + "-" + GUID.HEX[buffer[offset + 10]] + GUID.HEX[buffer[offset + 11]] + GUID.HEX[buffer[offset + 12]] + GUID.HEX[buffer[offset + 13]] + GUID.HEX[buffer[offset + 14]] + GUID.HEX[buffer[offset + 15]];
            return guid.toUpperCase();
        };
        GUID.write = function(value, buffer, offset) {
            offset = offset || 0;
            buffer = buffer || Buffer.allocUnsafe(offset + 16);
            var pattern = /[0-9A-F]{2}/g;
            var values = value.toUpperCase().match(pattern);
            buffer[offset + 3] = GUID.DEC.get(values[0]);
            buffer[offset + 2] = GUID.DEC.get(values[1]);
            buffer[offset + 1] = GUID.DEC.get(values[2]);
            buffer[offset + 0] = GUID.DEC.get(values[3]);
            buffer[offset + 5] = GUID.DEC.get(values[4]);
            buffer[offset + 4] = GUID.DEC.get(values[5]);
            buffer[offset + 7] = GUID.DEC.get(values[6]);
            buffer[offset + 6] = GUID.DEC.get(values[7]);
            buffer[offset + 8] = GUID.DEC.get(values[8]);
            buffer[offset + 9] = GUID.DEC.get(values[9]);
            buffer[offset + 10] = GUID.DEC.get(values[10]);
            buffer[offset + 11] = GUID.DEC.get(values[11]);
            buffer[offset + 12] = GUID.DEC.get(values[12]);
            buffer[offset + 13] = GUID.DEC.get(values[13]);
            buffer[offset + 14] = GUID.DEC.get(values[14]);
            buffer[offset + 15] = GUID.DEC.get(values[15]);
            return buffer;
        };
        module.exports = GUID;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var GUID = __webpack_require__(63);
        var GPT = __webpack_require__(61);
        var uint64 = __webpack_require__(62);
        function PartitionEntry(options) {
            if (!(this instanceof PartitionEntry)) {
                return new PartitionEntry(options);
            }
            options = options != null ? options : {};
            this.type = options.type || GUID.ZERO;
            this.guid = options.guid || GUID.ZERO;
            this.name = options.name || "";
            this.firstLBA = options.firstLBA || 0;
            this.lastLBA = options.lastLBA || 0;
            this.attr = options.attr || 0;
        }
        PartitionEntry.parse = function(buffer, offset) {
            return (new PartitionEntry).parse(buffer, offset);
        };
        PartitionEntry.prototype = {
            constructor: PartitionEntry,
            isEmpty() {
                return this.type.toString() === GUID.ZERO;
            },
            parse(buffer, offset) {
                offset = offset || 0;
                this.type = GUID.toString(buffer, offset + 0);
                this.guid = GUID.toString(buffer, offset + 16);
                this.firstLBA = uint64.readLE(buffer, offset + 32);
                this.lastLBA = uint64.readLE(buffer, offset + 40);
                this.attr = uint64.readLE(buffer, offset + 48);
                this.name = buffer.toString("ucs2", offset + 56, offset + GPT.TABLE_ENTRY_SIZE).replace(/\x00+/g, "");
                return this;
            },
            write(buffer, offset) {
                buffer = buffer || Buffer.alloc(GPT.TABLE_ENTRY_SIZE, 0);
                offset = offset || 0;
                GPT.GUID.write(this.type, buffer, offset + 0);
                GPT.GUID.write(this.guid, buffer, offset + 16);
                uint64.writeLE(buffer, this.firstLBA, offset + 32);
                uint64.writeLE(buffer, this.lastLBA, offset + 40);
                uint64.writeLE(buffer, this.attr, offset + 48);
                buffer.fill(0, offset + 56, offset + GPT.TABLE_ENTRY_SIZE);
                buffer.write(this.name, offset + 56, offset + GPT.TABLE_ENTRY_SIZE, "ucs2");
                return buffer;
            }
        };
        module.exports = PartitionEntry;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        function MBR(buffer, start, end) {
            if (!(this instanceof MBR) || this.format === "MBR") {
                return MBR.parse(buffer, start, end);
            }
            this.partitions = [];
            this.code = [];
            for (var i = 0; i < this.partitionEntries; i++) {
                this.partitions.push(new MBR.Partition);
            }
            if (Buffer.isBuffer(buffer)) {
                this.parse(buffer, start, end);
            }
        }
        MBR.TABLE_OFFSET = 446;
        MBR.PARTITION_ENTRIES = 4;
        MBR.Partition = __webpack_require__(66);
        MBR.Code = __webpack_require__(68);
        MBR.parse = function(buffer, start, end) {
            var buffer = buffer.slice(start, end);
            var format = MBR.detectFormat(buffer);
            return new MBR[format](buffer);
        };
        MBR.detectFormat = function(buffer) {
            if (!Buffer.isBuffer(buffer)) throw new TypeError("Argument must be a Buffer");
            if (buffer.length < 512) throw new Error("Buffer too small (must be at least 512 bytes)");
            if (buffer.readUInt16LE(510) !== 43605) {
                throw new SyntaxError("Invalid MBR boot signature. Expected 0xAA55, " + "but saw 0x" + buffer.readUInt16LE(510).toString(16).toUpperCase());
            }
            if (buffer[380] === 90 && buffer[381] === 165) {
                return "AST";
            } else if (buffer[252] === 170 && buffer[253] === 85) {
                return "DM";
            } else if (buffer.readUIntBE(2, 6) === 86059724325970) {
                return "NEWLDR";
            } else if (buffer[428] === 120 && buffer[429] === 86) {
                return "AAP";
            } else if (buffer[218] === 0 && buffer[219] === 0) {
                return "MODERN";
            } else {
                return "CLASSIC";
            }
        };
        MBR.createBuffer = function() {
            var buffer = new Buffer(512);
            buffer.fill(0);
            buffer[510] = 85;
            buffer[511] = 170;
            return buffer;
        };
        MBR.isExtendedPartition = function(partition) {
            return MBR.Partition.isExtended(partition.type);
        };
        MBR.prototype = {
            constructor: MBR,
            get buffer() {
                throw new Error("Not implemented");
            },
            set buffer(value) {
                throw new Error("Not implemented");
            },
            get format() {
                return this.constructor.name.toUpperCase();
            },
            get tableOffset() {
                return this.constructor.TABLE_OFFSET;
            },
            get partitionEntries() {
                return this.constructor.PARTITION_ENTRIES;
            },
            parse: function(buffer, start, end) {
                this.buffer = buffer.slice(start, end);
            },
            getEFIPart: function() {
                var i = 0;
                var part = null;
                for (var i = 0; i < this.partitions.length; i++) {
                    part = this.partitions[i];
                    if (part.type === 238 || part.type === 239) {
                        return part;
                    }
                }
                return null;
            }
        };
        module.exports = MBR;
        MBR.CLASSIC = __webpack_require__(69);
        MBR.MODERN = __webpack_require__(71);
        MBR.AAP = __webpack_require__(72);
        MBR.NEWLDR = __webpack_require__(74);
        MBR.AST = __webpack_require__(76);
        MBR.DM = __webpack_require__(77);
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var CHS = __webpack_require__(67);
        function Partition(buffer, start, end) {
            if (!(this instanceof Partition)) return new Partition(buffer, start, end);
            if (buffer != null && !Buffer.isBuffer(buffer)) throw new TypeError("Argument must be a Buffer");
            this.status = 0;
            this.type = 0;
            this.sectors = 0;
            this.firstLBA = 0;
            this.firstCHS = new CHS;
            this.lastCHS = new CHS;
            if (buffer != null) {
                this.buffer = buffer.slice(start, end);
            }
        }
        Partition.EXTENDED = [ 5, 15, 133, 21, 31, 145, 155, 94, 95, 207, 213, 197 ];
        Partition.parse = function(buffer, start, end) {
            return new Partition(buffer, start, end);
        };
        Partition.isExtended = function(type) {
            return !!~Partition.EXTENDED.indexOf(type);
        };
        Partition.prototype = {
            constructor: Partition,
            get statusText() {
                switch (this.status) {
                  case 128:
                    return "active";
                    break;

                  case 0:
                    return "inactive";
                    break;

                  default:
                    return "invalid";
                    break;
                }
            },
            get active() {
                return this.status === 128;
            },
            get inactive() {
                return this.status === 0;
            },
            get invalid() {
                return !this.active && !this.inactive;
            },
            get extended() {
                return Partition.isExtended(this.type);
            },
            get lastLBA() {
                return this.firstLBA + this.sectors;
            },
            byteOffset: function(blockSize) {
                blockSize = blockSize || 512;
                return this.firstLBA * blockSize;
            },
            byteSize: function(blockSize) {
                blockSize = blockSize || 512;
                return this.sectors * blockSize;
            },
            parse: function(buffer, start, end) {
                this.buffer = buffer.slice(start, end);
            },
            get buffer() {
                var buffer = new Buffer(16);
                buffer.fill(0);
                buffer.writeUInt8(this.status, 0);
                buffer.writeUInt8(this.type, 4);
                buffer.writeUInt32LE(this.firstLBA, 8);
                buffer.writeUInt32LE(this.sectors, 12);
                this.firstCHS.buffer.copy(buffer, 1);
                this.lastCHS.buffer.copy(buffer, 5);
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Argument must be a Buffer");
                if (value.length < 16) {
                    throw new SyntaxError("Partition entry size unacceptable:" + "expected 16 bytes, but got " + data.length);
                }
                this.status = value.readUInt8(0);
                this.type = value.readUInt8(4);
                this.firstLBA = value.readUInt32LE(8);
                this.sectors = value.readUInt32LE(12);
                this.firstCHS.buffer = value.slice(1, 4);
                this.lastCHS.buffer = value.slice(5, 8);
            }
        };
        module.exports = Partition;
    }, module => {
        function CHS(cylinder, head, sector) {
            if (!(this instanceof CHS)) return new CHS(cylinder, head, sector);
            if (Buffer.isBuffer(cylinder)) return CHS.fromBuffer(cylinder);
            this.cylinder = cylinder & 1023;
            this.head = head & 255;
            this.sector = sector & 63;
        }
        CHS.fromBuffer = function(buffer, offset) {
            return (new CHS).parse(buffer, offset);
        };
        CHS.fromLBA = function(lba, hpt, spt) {
            return (new CHS).setLBA(lba, hpt, spt);
        };
        CHS.prototype = {
            constructor: CHS,
            set buffer(value) {
                return this.parse(value);
            },
            get buffer() {
                return this.toBuffer();
            },
            setLBA: function(lba, hpt, spt) {
                this.cylinder = lba / (spt * hpt) | 0;
                this.head = lba / spt % hpt;
                this.sector = lba % spt + 1;
                return this;
            },
            getLBA: function(hpt, spt) {
                return (this.cylinder * hpt + this.head) * spt + (this.sector - 1);
            },
            toLBA: function(hpt, spt) {
                return this.getLBA(hpt, spt);
            },
            clone: function() {
                return new CHS(this.cylinder, this.head, this.sector);
            },
            copy: function(target) {
                target.cylinder = this.cylinder;
                target.head = this.head;
                target.sector = this.sector;
                return target;
            },
            parse: function(buffer, offset) {
                if (!Buffer.isBuffer(buffer)) throw new TypeError("Value must be a buffer");
                offset = offset || 0;
                return this.fromNumber(buffer.readUIntLE(offset, 3));
            },
            write: function(buffer, offset) {
                offset = offset || 0;
                buffer.writeUIntLE(this.toNumber(), offset, 3);
                return buffer;
            },
            toBuffer: function() {
                return this.write(Buffer.alloc(3));
            },
            fromNumber: function(value) {
                this.head = (value & 16711680) >>> 16;
                this.cylinder = (value & 65472) >>> 6;
                this.sector = value & 63;
                return this;
            },
            toNumber: function() {
                var value = (this.head & 255) << 16;
                value = value | this.cylinder << 6 & 65472;
                value = value | this.sector & 63;
                return value;
            }
        };
        module.exports = CHS;
    }, module => {
        function Code(buffer, start, end) {
            if (!(this instanceof Code)) return new Code(buffer, start, end);
            this.offset = start || 0;
            if (Buffer.isBuffer(buffer)) {
                this.data = buffer.slice(start, end);
            } else {
                this.data = new Buffer(446);
                this.data.fill(0);
            }
        }
        Code.prototype = {
            constructor: Code,
            get length() {
                return this.data.length;
            }
        };
        module.exports = Code;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var inherit = __webpack_require__(70);
        var MBR = __webpack_require__(65);
        function CLASSIC(buffer, start, end) {
            if (!(this instanceof CLASSIC)) return new CLASSIC(buffer, start, end);
            MBR.call(this, buffer, start, end);
        }
        CLASSIC.TABLE_OFFSET = 446;
        CLASSIC.PARTITION_ENTRIES = 4;
        CLASSIC.prototype = {
            constructor: CLASSIC,
            get buffer() {
                var buffer = MBR.createBuffer();
                var offset = this.tableOffset;
                for (var i = 0; i < this.code.length; i++) {
                    this.code[i].data.copy(buffer, this.code[i].offset);
                }
                this.partitions[0].buffer.copy(buffer, offset);
                this.partitions[1].buffer.copy(buffer, offset += 16);
                this.partitions[2].buffer.copy(buffer, offset += 16);
                this.partitions[3].buffer.copy(buffer, offset += 16);
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.code = [ new MBR.Code(value, 0, 446) ];
                var i, count = this.partitionEntries;
                var offset = this.tableOffset;
                for (i = 0; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
            }
        };
        inherit(CLASSIC, MBR);
        module.exports = CLASSIC;
    }, module => {
        function describe(object) {
            return Object.getOwnPropertyNames(object).reduce((function(desc, key) {
                desc[key] = Object.getOwnPropertyDescriptor(object, key);
                return desc;
            }), Object.create(null));
        }
        function inherit(ctor, sctor) {
            ctor.prototype = Object.create(sctor.prototype, describe(ctor.prototype));
        }
        module.exports = inherit;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var inherit = __webpack_require__(70);
        var MBR = __webpack_require__(65);
        function MODERN(buffer, start, end) {
            if (!(this instanceof MODERN)) return new MODERN(buffer, start, end);
            this.physicalDrive = 128;
            this.timestamp = {
                seconds: 0,
                minutes: 0,
                hours: 0
            };
            this.signature = null;
            this.copyProtected = false;
            MBR.call(this, buffer, start, end);
        }
        MODERN.TABLE_OFFSET = 446;
        MODERN.PARTITION_ENTRIES = 4;
        MODERN.prototype = {
            constructor: MODERN,
            get buffer() {
                var buffer = MBR.createBuffer();
                for (var i = 0; i < this.code.length; i++) {
                    this.code[i].data.copy(buffer, this.code[i].offset);
                }
                buffer[220] = this.physicalDrive;
                buffer[221] = this.timestamp.seconds;
                buffer[222] = this.timestamp.minutes;
                buffer[223] = this.timestamp.hours;
                if (this.code[1] && this.code[1].data.length === 216) {
                    buffer.writeUInt32LE(this.signature, 440);
                    this.copyProtected ? buffer.writeUInt16LE(23130, 444) : buffer.writeUInt16LE(0, 444);
                }
                var offset = this.tableOffset;
                this.partitions[0].buffer.copy(buffer, offset);
                this.partitions[1].buffer.copy(buffer, offset += 16);
                this.partitions[2].buffer.copy(buffer, offset += 16);
                this.partitions[3].buffer.copy(buffer, offset += 16);
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.physicalDrive = value.readUInt8(220);
                this.timestamp.seconds = value[221];
                this.timestamp.minutes = value[222];
                this.timestamp.hours = value[223];
                var marker = value.readUInt16LE(444);
                this.copyProtected = marker === 23130;
                this.signature = marker === 0 || this.copyProtected ? value.readUInt32LE(440) : null;
                var endOfCode = this.signature == null ? 446 : 440;
                this.code = [ new MBR.Code(value, 0, 218), new MBR.Code(value, 224, endOfCode) ];
                var i, count = this.partitionEntries;
                var offset = this.tableOffset;
                for (i = 0; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
            }
        };
        inherit(MODERN, MBR);
        module.exports = MODERN;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var inherit = __webpack_require__(70);
        var MBR = __webpack_require__(65);
        function AAP(buffer, start, end) {
            if (!(this instanceof AAP)) return new AAP(buffer, start, end);
            this.aap = new AAP.Record;
            MBR.call(this, buffer, start, end);
        }
        AAP.TABLE_OFFSET = 446;
        AAP.PARTITION_ENTRIES = 4;
        AAP.Record = __webpack_require__(73);
        AAP.prototype = {
            constructor: AAP,
            get buffer() {
                var buffer = MBR.createBuffer();
                var offset = this.tableOffset;
                for (var i = 0; i < this.code.length; i++) {
                    this.code[i].data.copy(buffer, this.code[i].offset);
                }
                this.aap.buffer.copy(buffer, 430);
                this.partitions[0].buffer.copy(buffer, offset);
                this.partitions[1].buffer.copy(buffer, offset += 16);
                this.partitions[2].buffer.copy(buffer, offset += 16);
                this.partitions[3].buffer.copy(buffer, offset += 16);
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.code = [ new MBR.Code(value, 0, 427) ];
                this.aap.buffer = value.slice(430, 442);
                var i, count = this.partitionEntries;
                var offset = this.tableOffset;
                for (i = 0; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
            }
        };
        inherit(AAP, MBR);
        module.exports = AAP;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var CHS = __webpack_require__(67);
        function Record(buffer, start, end) {
            if (!(this instanceof Record)) return new Record(buffer, start, end);
            this.physicalDrive = 0;
            this.firstCHS = new CHS;
            this.partitionType = 0;
            this.lastCHS = new CHS;
            this.firstLBA = 0;
            this.sectors = 0;
            if (Buffer.isBuffer(buffer)) {
                this.buffer = buffer.slice(start, end);
            }
        }
        Record.prototype = {
            constructor: Record,
            get buffer() {
                var buffer = new Buffer(16);
                buffer.writeUInt8(this.physicalDrive, 0);
                buffer.writeUInt8(this.partitionType, 4);
                buffer.writeUInt32LE(this.firstLBA, 8);
                buffer.writeUInt32LE(this.sectors, 12);
                this.firstCHS.buffer.copy(buffer, 1);
                this.lastCHS.buffer.copy(buffer, 5);
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.physicalDrive = value.readUInt8(0);
                this.firstCHS.buffer = value.slice(1, 4);
                this.partitionType = value.readUInt8(4);
                this.lastCHS.buffer = value.slice(5, 8);
                this.firstLBA = value.readUInt32LE(8);
                this.sectors = value.readUInt32LE(12);
                return this;
            }
        };
        module.exports = Record;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var inherit = __webpack_require__(70);
        var MBR = __webpack_require__(65);
        function NEWLDR(buffer, start, end) {
            if (!(this instanceof NEWLDR)) return new NEWLDR(buffer, start, end);
            this.newldr = new NEWLDR.Record;
            this.aap = new MBR.AAP.Record;
            MBR.call(this, buffer, start, end);
        }
        NEWLDR.TABLE_OFFSET = 446;
        NEWLDR.PARTITION_ENTRIES = 4;
        NEWLDR.Record = __webpack_require__(75);
        NEWLDR.prototype = {
            constructor: NEWLDR,
            get buffer() {
                var buffer = MBR.createBuffer();
                var offset = this.tableOffset;
                for (var i = 0; i < this.code.length; i++) {
                    this.code[i].data.copy(buffer, this.code[i].offset);
                }
                this.newldr.buffer.copy(buffer);
                this.aap.buffer.copy(buffer, 430);
                this.partitions[0].buffer.copy(buffer, offset);
                this.partitions[1].buffer.copy(buffer, offset += 16);
                this.partitions[2].buffer.copy(buffer, offset += 16);
                this.partitions[3].buffer.copy(buffer, offset += 16);
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.code = [ new MBR.Code(value, value[1], 428) ];
                this.newldr.buffer = value.slice(0, value[1]);
                this.aap.buffer = value.slice(430, 446);
                var i, count = this.partitionEntries;
                var offset = this.tableOffset;
                for (i = 0; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
            }
        };
        inherit(NEWLDR, MBR);
        module.exports = NEWLDR;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var CHS = __webpack_require__(67);
        function Record(buffer, start, end) {
            if (!(this instanceof Record)) return new Record(buffer, start, end);
            this.size = 22;
            this.physicalDrive = 0;
            this.firstCHS = new CHS;
            this.minDL = 0;
            this.firstLBA = 0;
            this.patchOffset = 0;
            this.checksum = 0;
            this.signature = "MSWIN4";
            if (Buffer.isBuffer(buffer)) {
                this.buffer = buffer.slice(start, end);
            }
        }
        Record.prototype = {
            constructor: Record,
            get buffer() {
                var buffer = new Buffer(30);
                buffer.fill(0);
                buffer[0] = 235;
                buffer.writeUInt8(this.size, 1);
                buffer.write("NEWLDR", 2, "ascii");
                buffer.writeUInt8(this.physicalDrive, 8);
                this.firstCHS.buffer.copy(buffer, 9);
                buffer.writeUInt8(this.minDL, 12);
                buffer.writeUInt32LE(this.firstLBA, 16);
                buffer.writeUInt16LE(this.patchOffset, 20);
                buffer.writeUInt16LE(this.checksum, 22);
                buffer.write(this.signature, 24, "ascii");
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.size = value.readUInt8(1);
                this.physicalDrive = value.readUInt8(8);
                this.firstCHS.buffer = value.slice(9, 12);
                this.minDL = value.readUInt8(12);
                this.firstLBA = value.readUInt32LE(16);
                this.patchOffset = value.readUInt16LE(20);
                this.checksum = value.readUInt16LE(22);
                this.signature = value.toString("ascii", 24);
            }
        };
        module.exports = Record;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var inherit = __webpack_require__(70);
        var MBR = __webpack_require__(65);
        function AST(buffer, start, end) {
            if (!(this instanceof AST)) return new AST(buffer, start, end);
            MBR.call(this, buffer, start, end);
        }
        AST.TABLE_OFFSET = 382;
        AST.PARTITION_ENTRIES = 8;
        AST.prototype = {
            constructor: AST,
            get buffer() {
                var buffer = MBR.createBuffer();
                var offset = this.tableOffset;
                for (var i = 0; i < this.code.length; i++) {
                    this.code[i].data.copy(buffer, this.code[i].offset);
                }
                this.partitions[4].buffer.copy(buffer, offset);
                this.partitions[5].buffer.copy(buffer, offset += 16);
                this.partitions[6].buffer.copy(buffer, offset += 16);
                this.partitions[7].buffer.copy(buffer, offset += 16);
                this.partitions[0].buffer.copy(buffer, offset += 16);
                this.partitions[1].buffer.copy(buffer, offset += 16);
                this.partitions[2].buffer.copy(buffer, offset += 16);
                this.partitions[3].buffer.copy(buffer, offset += 16);
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.code = [ new MBR.Code(value, 0, 382) ];
                var i, count = 4;
                var offset = 446;
                for (i = 0; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
                count += count;
                offset = this.tableOffset;
                for (i = 4; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
            }
        };
        inherit(AST, MBR);
        module.exports = AST;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var inherit = __webpack_require__(70);
        var MBR = __webpack_require__(65);
        function DM(buffer, start, end) {
            if (!(this instanceof DM)) return new DM(buffer, start, end);
            MBR.call(this, buffer, start, end);
        }
        DM.TABLE_OFFSET = 254;
        DM.PARTITION_ENTRIES = 16;
        DM.prototype = {
            constructor: DM,
            get buffer() {
                var buffer = MBR.createBuffer();
                var offset = this.tableOffset;
                for (var i = 0; i < this.code.length; i++) {
                    this.code[i].data.copy(buffer, this.code[i].offset);
                }
                for (var i = 4; i < DM.PARTITION_ENTRIES; i++) {
                    this.partitions[i].buffer.copy(buffer, offset);
                    offset += 16;
                }
                for (var i = 0; i < 4; i++) {
                    this.partitions[i].buffer.copy(buffer, offset);
                    offset += 16;
                }
                return buffer;
            },
            set buffer(value) {
                if (!Buffer.isBuffer(value)) throw new TypeError("Value must be a Buffer");
                this.code = [ new MBR.Code(value, 0, 254) ];
                var i, count = 4;
                var offset = 446;
                for (i = 0; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
                count *= 4;
                offset = this.tableOffset;
                for (i = 4; i < count; i++) {
                    this.partitions[i].buffer = value.slice(offset, offset += 16);
                }
            }
        };
        inherit(DM, MBR);
        module.exports = DM;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.TypedError = void 0;
        let getStackTrace;
        if (Error.captureStackTrace != null) {
            const captureStackTrace = Error.captureStackTrace;
            getStackTrace = e => {
                captureStackTrace(e, e.constructor);
            };
        } else {
            getStackTrace = (e, err) => {
                if (!(err instanceof Error)) {
                    err = new Error(err);
                }
                if (err.stack != null) {
                    e.stack = err.stack;
                }
            };
        }
        class TypedError extends Error {
            constructor(err = "") {
                super();
                this.stack = "";
                if (err instanceof Error) {
                    this.message = err.message;
                } else {
                    this.message = err;
                }
                Object.setPrototypeOf(this, new.target.prototype);
                this.name = this.constructor.name;
                getStackTrace(this, err);
            }
        }
        exports.TypedError = TypedError;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.SparseFilterStream = void 0;
        const stream_1 = __webpack_require__(17);
        const shared_1 = __webpack_require__(80);
        class SparseFilterStream extends stream_1.Transform {
            constructor({blocks, verify, generateChecksums}) {
                super({
                    objectMode: true
                });
                this.position = 0;
                this.blocks = blocks;
                this.stateIterator = (0, shared_1.createSparseReaderStateIterator)(blocks, verify, generateChecksums);
                this.nextBlock();
            }
            nextBlock() {
                this.state = this.stateIterator.next().value;
            }
            _transform(chunk, _encoding, callback) {
                let error;
                try {
                    this.__transform(chunk);
                } catch (err) {
                    error = err;
                }
                callback(error);
            }
            __transform(buffer) {
                while (true) {
                    if (this.state === undefined) {
                        this.position += buffer.length;
                        return;
                    }
                    if (this.position >= this.state.subBlock.offset + this.state.subBlock.length) {
                        this.nextBlock();
                        continue;
                    }
                    if (buffer.length === 0) {
                        return;
                    }
                    if (this.position < this.state.subBlock.offset) {
                        const toSkip = Math.min(this.state.subBlock.offset - this.position, buffer.length);
                        this.position += toSkip;
                        if (toSkip >= buffer.length) {
                            return;
                        }
                        buffer = buffer.slice(toSkip);
                    }
                    const bytesLeftInBlock = this.state.subBlock.offset + this.state.subBlock.length - this.position;
                    const length = Math.min(bytesLeftInBlock, buffer.length);
                    const bufferToPush = buffer.slice(0, length);
                    if (this.state.hasher !== undefined) {
                        this.state.hasher.update(bufferToPush);
                    }
                    this.push({
                        buffer: bufferToPush,
                        position: this.position
                    });
                    this.position += length;
                    buffer = buffer.slice(length);
                }
            }
        }
        exports.SparseFilterStream = SparseFilterStream;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.blocksLength = exports.createSparseReaderStateIterator = void 0;
        const crypto_1 = __webpack_require__(35);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const lazy_1 = __webpack_require__(36);
        function createHasher(checksumType) {
            if (checksumType === "crc32") {
                return (0, lazy_1.getCrc)().createHash();
            } else if (checksumType === "sha1" || checksumType === "sha256") {
                return (0, crypto_1.createHash)(checksumType);
            } else if (checksumType === "xxhash3") {
                const {XXHash3} = (0, lazy_1.getXXHash)();
                return new XXHash3(constants_1.XXHASH_SEED);
            }
        }
        function* createSparseReaderStateIterator(blocks, verify, generateChecksums) {
            if (verify && generateChecksums) {
                throw new Error("verify and generateChecksums are mutually exclusive");
            }
            if (generateChecksums) {
                for (const block of blocks) {
                    if (block.checksumType === undefined) {
                        throw new Error("All blocks must have a checksumType if generateChecksums is true");
                    }
                }
            }
            for (const block of blocks) {
                const hasher = createHasher(block.checksumType);
                for (const subBlock of block.blocks) {
                    yield {
                        block,
                        subBlock,
                        hasher
                    };
                }
                verifyOrGenerateChecksum(hasher, block, verify, generateChecksums);
            }
        }
        exports.createSparseReaderStateIterator = createSparseReaderStateIterator;
        function verifyOrGenerateChecksum(hasher, blocks, verify, generateChecksums) {
            var _a;
            if (hasher !== undefined) {
                const checksum = hasher.digest("hex");
                if (generateChecksums) {
                    blocks.checksum = checksum;
                } else if (verify && ((_a = blocks.checksum) === null || _a === void 0 ? void 0 : _a.toString()) !== checksum.toString()) {
                    throw new errors_1.BlocksVerificationError(blocks, checksum);
                }
            }
        }
        function blocksLength(blocks) {
            let sum = 0;
            for (const block of blocks) {
                for (const blk of block.blocks) {
                    sum += blk.length;
                }
            }
            return sum;
        }
        exports.blocksLength = blocksLength;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.SparseReadStream = void 0;
        const stream_1 = __webpack_require__(17);
        const aligned_lockable_buffer_1 = __webpack_require__(22);
        const shared_1 = __webpack_require__(80);
        class SparseReadStream extends stream_1.Readable {
            constructor({source, blocks, chunkSize, verify, generateChecksums, alignment, numBuffers = 2}) {
                super({
                    objectMode: true,
                    highWaterMark: numBuffers - 1
                });
                this.positionInBlock = 0;
                this.source = source;
                this.blocks = blocks;
                this.chunkSize = chunkSize;
                if (alignment !== undefined) {
                    this.alignedReadableState = new aligned_lockable_buffer_1.AlignedReadableState(chunkSize, alignment, numBuffers);
                }
                this.stateIterator = (0, shared_1.createSparseReaderStateIterator)(blocks, verify, generateChecksums);
                this.nextBlock();
            }
            async _read() {
                try {
                    this.push(await this.__read());
                } catch (error) {
                    this.emit("error", error);
                    this.push(null);
                }
            }
            nextBlock() {
                this.state = this.stateIterator.next().value;
                this.positionInBlock = 0;
            }
            async __read() {
                var _a;
                if (this.state === undefined) {
                    return null;
                }
                const length = Math.min(this.chunkSize, this.state.subBlock.length - this.positionInBlock);
                const buffer = this.alignedReadableState !== undefined ? this.alignedReadableState.getCurrentBuffer().slice(0, length) : Buffer.allocUnsafe(length);
                const unlock = (0, aligned_lockable_buffer_1.isAlignedLockableBuffer)(buffer) ? await buffer.lock() : undefined;
                try {
                    await this.source.read(buffer, 0, length, this.state.subBlock.offset + this.positionInBlock);
                    (_a = this.state.hasher) === null || _a === void 0 ? void 0 : _a.update(buffer);
                } finally {
                    unlock === null || unlock === void 0 ? void 0 : unlock();
                }
                const chunk = {
                    buffer,
                    position: this.state.subBlock.offset + this.positionInBlock
                };
                this.positionInBlock += length;
                if (this.positionInBlock === this.state.subBlock.length) {
                    this.nextBlock();
                }
                return chunk;
            }
        }
        exports.SparseReadStream = SparseReadStream;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ProgressBlockReadStream = exports.BlockReadStream = void 0;
        const stream_1 = __webpack_require__(17);
        const aligned_lockable_buffer_1 = __webpack_require__(22);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const progress_1 = __webpack_require__(28);
        class BlockReadStream extends stream_1.Readable {
            constructor({source, alignment, start = 0, end = Infinity, chunkSize = constants_1.CHUNK_SIZE, maxRetries = 5, numBuffers = 2}) {
                super({
                    objectMode: true,
                    highWaterMark: numBuffers - 1
                });
                this.bytesRead = 0;
                this.source = source;
                this.alignment = alignment;
                this.bytesRead = start;
                this.end = end;
                this.chunkSize = chunkSize;
                this.maxRetries = maxRetries;
                if (alignment !== undefined) {
                    this.chunkSize = Math.max(Math.floor(chunkSize / alignment) * alignment, alignment);
                    this.alignedReadableState = new aligned_lockable_buffer_1.AlignedReadableState(chunkSize, alignment, numBuffers);
                }
            }
            async tryRead(buffer) {
                return await (0, errors_1.retryOnTransientError)((async () => await this.source.read(buffer, 0, buffer.length, this.bytesRead)), this.maxRetries, constants_1.RETRY_BASE_TIMEOUT);
            }
            async _read() {
                if (this.bytesRead > this.end) {
                    this.push(null);
                    return;
                }
                let buffer = this.alignment !== undefined ? this.alignedReadableState.getCurrentBuffer() : Buffer.allocUnsafe(this.chunkSize);
                const toRead = this.end - this.bytesRead + 1;
                if (toRead < buffer.length) {
                    buffer = buffer.slice(0, toRead);
                }
                try {
                    let unlock;
                    if ((0, aligned_lockable_buffer_1.isAlignedLockableBuffer)(buffer)) {
                        unlock = await buffer.lock();
                    }
                    let bytesRead;
                    try {
                        ({bytesRead} = await this.tryRead(buffer));
                    } finally {
                        unlock === null || unlock === void 0 ? void 0 : unlock();
                    }
                    this.bytesRead += bytesRead;
                    if (bytesRead !== 0) {
                        this.push(buffer.slice(0, bytesRead));
                    } else {
                        this.push(null);
                    }
                } catch (error) {
                    this.emit("error", error);
                }
            }
        }
        exports.BlockReadStream = BlockReadStream;
        exports.ProgressBlockReadStream = (0, progress_1.makeClassEmitProgressEvents)(BlockReadStream, "bytesRead", "bytesRead");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BZip2Source = void 0;
        const unbzip2Stream = __webpack_require__(84);
        const compressed_source_1 = __webpack_require__(87);
        const source_destination_1 = __webpack_require__(54);
        class BZip2Source extends compressed_source_1.CompressedSource {
            createTransform() {
                return unbzip2Stream();
            }
            async getSize() {
                const size = await this.getSizeFromPartitionTable();
                if (size !== undefined) {
                    return {
                        size,
                        isEstimated: true
                    };
                }
            }
        }
        exports.BZip2Source = BZip2Source;
        BZip2Source.mimetype = "application/x-bzip2";
        source_destination_1.SourceDestination.register(BZip2Source);
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var stream = __webpack_require__(17);
        var bz2 = __webpack_require__(85);
        var bitIterator = __webpack_require__(86);
        class Unbzip2Stream extends stream.Transform {
            constructor(options) {
                super(options);
                this.queue = [];
                this.hasBytes = 0;
                this.blockSize = 0;
                this.done = false;
                this.bitReader = null;
                this.streamCRC = null;
            }
            _decompressAndQueue() {
                if (this.destroyed) return false;
                try {
                    return this._decompressBlock();
                } catch (error) {
                    this.destroy(error);
                    return false;
                }
            }
            _decompressBlock() {
                if (!this.blockSize) {
                    this.blockSize = bz2.header(this.bitReader);
                    return true;
                } else {
                    var length = 1e5 * this.blockSize;
                    var buffer = new Int32Array(length);
                    var bytes = [];
                    var push = value => {
                        bytes.push(value);
                    };
                    this.streamCRC = bz2.decompress(this.bitReader, push, buffer, length, this.streamCRC);
                    if (this.streamCRC === null) {
                        this.blockSize = 0;
                        return false;
                    } else {
                        this.push(Buffer.from(bytes));
                        return true;
                    }
                }
            }
            _transform(chunk, encoding, next) {
                this.queue.push(chunk);
                this.hasBytes += chunk.length;
                if (this.bitReader == null) {
                    this.bitReader = bitIterator((() => this.queue.shift()));
                }
                while (!this.destroyed && this.hasBytes - this.bitReader.bytesRead + 1 >= (25e3 + 1e5 * this.blockSize || 4)) {
                    this._decompressAndQueue();
                }
                process.nextTick(next);
            }
            _flush(next) {
                while (!this.destroyed && this.hasBytes > this.bitReader.bytesRead) {
                    this._decompressAndQueue();
                }
                if (this.destroyed) {
                    return;
                }
                if (this.streamCRC !== null) {
                    this.destroy(new Error("input stream ended prematurely"));
                }
                this.push(null);
            }
        }
        module.exports = function unbzip2Stream(options) {
            return new Unbzip2Stream(options);
        };
        module.exports.Stream = Unbzip2Stream;
    }, module => {
        function Bzip2Error(message) {
            this.name = "Bzip2Error";
            this.message = message;
            this.stack = (new Error).stack;
        }
        Bzip2Error.prototype = new Error;
        var message = {
            Error: function(message) {
                throw new Error(message);
            }
        };
        var bzip2 = {};
        bzip2.Bzip2Error = Bzip2Error;
        bzip2.crcTable = [ 0, 79764919, 159529838, 222504665, 319059676, 398814059, 445009330, 507990021, 638119352, 583659535, 797628118, 726387553, 890018660, 835552979, 1015980042, 944750013, 1276238704, 1221641927, 1167319070, 1095957929, 1595256236, 1540665371, 1452775106, 1381403509, 1780037320, 1859660671, 1671105958, 1733955601, 2031960084, 2111593891, 1889500026, 1952343757, 2552477408, 2632100695, 2443283854, 2506133561, 2334638140, 2414271883, 2191915858, 2254759653, 3190512472, 3135915759, 3081330742, 3009969537, 2905550212, 2850959411, 2762807018, 2691435357, 3560074640, 3505614887, 3719321342, 3648080713, 3342211916, 3287746299, 3467911202, 3396681109, 4063920168, 4143685023, 4223187782, 4286162673, 3779000052, 3858754371, 3904687514, 3967668269, 881225847, 809987520, 1023691545, 969234094, 662832811, 591600412, 771767749, 717299826, 311336399, 374308984, 453813921, 533576470, 25881363, 88864420, 134795389, 214552010, 2023205639, 2086057648, 1897238633, 1976864222, 1804852699, 1867694188, 1645340341, 1724971778, 1587496639, 1516133128, 1461550545, 1406951526, 1302016099, 1230646740, 1142491917, 1087903418, 2896545431, 2825181984, 2770861561, 2716262478, 3215044683, 3143675388, 3055782693, 3001194130, 2326604591, 2389456536, 2200899649, 2280525302, 2578013683, 2640855108, 2418763421, 2498394922, 3769900519, 3832873040, 3912640137, 3992402750, 4088425275, 4151408268, 4197601365, 4277358050, 3334271071, 3263032808, 3476998961, 3422541446, 3585640067, 3514407732, 3694837229, 3640369242, 1762451694, 1842216281, 1619975040, 1682949687, 2047383090, 2127137669, 1938468188, 2001449195, 1325665622, 1271206113, 1183200824, 1111960463, 1543535498, 1489069629, 1434599652, 1363369299, 622672798, 568075817, 748617968, 677256519, 907627842, 853037301, 1067152940, 995781531, 51762726, 131386257, 177728840, 240578815, 269590778, 349224269, 429104020, 491947555, 4046411278, 4126034873, 4172115296, 4234965207, 3794477266, 3874110821, 3953728444, 4016571915, 3609705398, 3555108353, 3735388376, 3664026991, 3290680682, 3236090077, 3449943556, 3378572211, 3174993278, 3120533705, 3032266256, 2961025959, 2923101090, 2868635157, 2813903052, 2742672763, 2604032198, 2683796849, 2461293480, 2524268063, 2284983834, 2364738477, 2175806836, 2238787779, 1569362073, 1498123566, 1409854455, 1355396672, 1317987909, 1246755826, 1192025387, 1137557660, 2072149281, 2135122070, 1912620623, 1992383480, 1753615357, 1816598090, 1627664531, 1707420964, 295390185, 358241886, 404320391, 483945776, 43990325, 106832002, 186451547, 266083308, 932423249, 861060070, 1041341759, 986742920, 613929101, 542559546, 756411363, 701822548, 3316196985, 3244833742, 3425377559, 3370778784, 3601682597, 3530312978, 3744426955, 3689838204, 3819031489, 3881883254, 3928223919, 4007849240, 4037393693, 4100235434, 4180117107, 4259748804, 2310601993, 2373574846, 2151335527, 2231098320, 2596047829, 2659030626, 2470359227, 2550115596, 2947551409, 2876312838, 2788305887, 2733848168, 3165939309, 3094707162, 3040238851, 2985771188 ];
        bzip2.array = function(bytes) {
            var bit = 0, byte = 0;
            var BITMASK = [ 0, 1, 3, 7, 15, 31, 63, 127, 255 ];
            return function(n) {
                var result = 0;
                while (n > 0) {
                    var left = 8 - bit;
                    if (n >= left) {
                        result <<= left;
                        result |= BITMASK[left] & bytes[byte++];
                        bit = 0;
                        n -= left;
                    } else {
                        result <<= n;
                        result |= (bytes[byte] & BITMASK[n] << 8 - n - bit) >> 8 - n - bit;
                        bit += n;
                        n = 0;
                    }
                }
                return result;
            };
        };
        bzip2.simple = function(srcbuffer, stream) {
            var bits = bzip2.array(srcbuffer);
            var size = bzip2.header(bits);
            var ret = false;
            var bufsize = 1e5 * size;
            var buf = new Int32Array(bufsize);
            do {
                ret = bzip2.decompress(bits, stream, buf, bufsize);
            } while (!ret);
        };
        bzip2.header = function(bits) {
            this.byteCount = new Int32Array(256);
            this.symToByte = new Uint8Array(256);
            this.mtfSymbol = new Int32Array(256);
            this.selectors = new Uint8Array(32768);
            if (bits(8 * 3) != 4348520) message.Error("No magic number found");
            var i = bits(8) - 48;
            if (i < 1 || i > 9) message.Error("Not a BZIP archive");
            return i;
        };
        bzip2.decompress = function(bits, stream, buf, bufsize, streamCRC) {
            var MAX_HUFCODE_BITS = 20;
            var MAX_SYMBOLS = 258;
            var SYMBOL_RUNA = 0;
            var SYMBOL_RUNB = 1;
            var GROUP_SIZE = 50;
            var crc = 0 ^ -1;
            for (var h = "", i = 0; i < 6; i++) h += bits(8).toString(16);
            if (h == "177245385090") {
                var finalCRC = bits(32) | 0;
                if (finalCRC !== streamCRC) message.Error("Error in bzip2: crc32 do not match");
                bits(null);
                return null;
            }
            if (h != "314159265359") message.Error("eek not valid bzip data");
            var crcblock = bits(32) | 0;
            if (bits(1)) message.Error("unsupported obsolete version");
            var origPtr = bits(24);
            if (origPtr > bufsize) message.Error("Initial position larger than buffer size");
            var t = bits(16);
            var symTotal = 0;
            for (i = 0; i < 16; i++) {
                if (t & 1 << 15 - i) {
                    var k = bits(16);
                    for (j = 0; j < 16; j++) {
                        if (k & 1 << 15 - j) {
                            this.symToByte[symTotal++] = 16 * i + j;
                        }
                    }
                }
            }
            var groupCount = bits(3);
            if (groupCount < 2 || groupCount > 6) message.Error("another error");
            var nSelectors = bits(15);
            if (nSelectors == 0) message.Error("meh");
            for (var i = 0; i < groupCount; i++) this.mtfSymbol[i] = i;
            for (var i = 0; i < nSelectors; i++) {
                for (var j = 0; bits(1); j++) if (j >= groupCount) message.Error("whoops another error");
                var uc = this.mtfSymbol[j];
                for (var k = j - 1; k >= 0; k--) {
                    this.mtfSymbol[k + 1] = this.mtfSymbol[k];
                }
                this.mtfSymbol[0] = uc;
                this.selectors[i] = uc;
            }
            var symCount = symTotal + 2;
            var groups = [];
            var length = new Uint8Array(MAX_SYMBOLS), temp = new Uint16Array(MAX_HUFCODE_BITS + 1);
            var hufGroup;
            for (var j = 0; j < groupCount; j++) {
                t = bits(5);
                for (var i = 0; i < symCount; i++) {
                    while (true) {
                        if (t < 1 || t > MAX_HUFCODE_BITS) message.Error("I gave up a while ago on writing error messages");
                        if (!bits(1)) break;
                        if (!bits(1)) t++; else t--;
                    }
                    length[i] = t;
                }
                var minLen, maxLen;
                minLen = maxLen = length[0];
                for (var i = 1; i < symCount; i++) {
                    if (length[i] > maxLen) maxLen = length[i]; else if (length[i] < minLen) minLen = length[i];
                }
                hufGroup = groups[j] = {};
                hufGroup.permute = new Int32Array(MAX_SYMBOLS);
                hufGroup.limit = new Int32Array(MAX_HUFCODE_BITS + 1);
                hufGroup.base = new Int32Array(MAX_HUFCODE_BITS + 1);
                hufGroup.minLen = minLen;
                hufGroup.maxLen = maxLen;
                var base = hufGroup.base;
                var limit = hufGroup.limit;
                var pp = 0;
                for (var i = minLen; i <= maxLen; i++) for (var t = 0; t < symCount; t++) if (length[t] == i) hufGroup.permute[pp++] = t;
                for (i = minLen; i <= maxLen; i++) temp[i] = limit[i] = 0;
                for (i = 0; i < symCount; i++) temp[length[i]]++;
                pp = t = 0;
                for (i = minLen; i < maxLen; i++) {
                    pp += temp[i];
                    limit[i] = pp - 1;
                    pp <<= 1;
                    base[i + 1] = pp - (t += temp[i]);
                }
                limit[maxLen] = pp + temp[maxLen] - 1;
                base[minLen] = 0;
            }
            for (var i = 0; i < 256; i++) {
                this.mtfSymbol[i] = i;
                this.byteCount[i] = 0;
            }
            var runPos, count, symCount, selector;
            runPos = count = symCount = selector = 0;
            while (true) {
                if (!symCount--) {
                    symCount = GROUP_SIZE - 1;
                    if (selector >= nSelectors) message.Error("meow i'm a kitty, that's an error");
                    hufGroup = groups[this.selectors[selector++]];
                    base = hufGroup.base;
                    limit = hufGroup.limit;
                }
                i = hufGroup.minLen;
                j = bits(i);
                while (true) {
                    if (i > hufGroup.maxLen) message.Error("rawr i'm a dinosaur");
                    if (j <= limit[i]) break;
                    i++;
                    j = j << 1 | bits(1);
                }
                j -= base[i];
                if (j < 0 || j >= MAX_SYMBOLS) message.Error("moo i'm a cow");
                var nextSym = hufGroup.permute[j];
                if (nextSym == SYMBOL_RUNA || nextSym == SYMBOL_RUNB) {
                    if (!runPos) {
                        runPos = 1;
                        t = 0;
                    }
                    if (nextSym == SYMBOL_RUNA) t += runPos; else t += 2 * runPos;
                    runPos <<= 1;
                    continue;
                }
                if (runPos) {
                    runPos = 0;
                    if (count + t > bufsize) message.Error("Boom.");
                    uc = this.symToByte[this.mtfSymbol[0]];
                    this.byteCount[uc] += t;
                    while (t--) buf[count++] = uc;
                }
                if (nextSym > symTotal) break;
                if (count >= bufsize) message.Error("I can't think of anything. Error");
                i = nextSym - 1;
                uc = this.mtfSymbol[i];
                for (var k = i - 1; k >= 0; k--) {
                    this.mtfSymbol[k + 1] = this.mtfSymbol[k];
                }
                this.mtfSymbol[0] = uc;
                uc = this.symToByte[uc];
                this.byteCount[uc]++;
                buf[count++] = uc;
            }
            if (origPtr < 0 || origPtr >= count) message.Error("I'm a monkey and I'm throwing something at someone, namely you");
            var j = 0;
            for (var i = 0; i < 256; i++) {
                k = j + this.byteCount[i];
                this.byteCount[i] = j;
                j = k;
            }
            for (var i = 0; i < count; i++) {
                uc = buf[i] & 255;
                buf[this.byteCount[uc]] |= i << 8;
                this.byteCount[uc]++;
            }
            var pos = 0, current = 0, run = 0;
            if (count) {
                pos = buf[origPtr];
                current = pos & 255;
                pos >>= 8;
                run = -1;
            }
            count = count;
            var copies, previous, outbyte;
            while (count) {
                count--;
                previous = current;
                pos = buf[pos];
                current = pos & 255;
                pos >>= 8;
                if (run++ == 3) {
                    copies = current;
                    outbyte = previous;
                    current = -1;
                } else {
                    copies = 1;
                    outbyte = current;
                }
                while (copies--) {
                    crc = (crc << 8 ^ this.crcTable[(crc >> 24 ^ outbyte) & 255]) & 4294967295;
                    stream(outbyte);
                }
                if (current != previous) run = 0;
            }
            crc = (crc ^ -1) >>> 0;
            if ((crc | 0) != (crcblock | 0)) message.Error("Error in bzip2: crc32 do not match");
            if (streamCRC === null) streamCRC = 0;
            streamCRC = (crc ^ (streamCRC << 1 | streamCRC >>> 31)) & 4294967295;
            return streamCRC;
        };
        module.exports = bzip2;
    }, module => {
        var BITMASK = [ 0, 1, 3, 7, 15, 31, 63, 127, 255 ];
        module.exports = function bitIterator(nextBuffer) {
            var bit = 0, byte = 0;
            var bytes = nextBuffer();
            var f = function(n) {
                if (n === null && bit != 0) {
                    bit = 0;
                    byte++;
                    return;
                }
                var result = 0;
                while (n > 0) {
                    if (byte >= bytes.length) {
                        byte = 0;
                        bytes = nextBuffer();
                    }
                    var left = 8 - bit;
                    if (bit === 0 && n > 0) f.bytesRead++;
                    if (n >= left) {
                        result <<= left;
                        result |= BITMASK[left] & bytes[byte++];
                        bit = 0;
                        n -= left;
                    } else {
                        result <<= n;
                        result |= (bytes[byte] & BITMASK[n] << 8 - n - bit) >> 8 - n - bit;
                        bit += n;
                        n = 0;
                    }
                }
                return result;
            };
            f.bytesRead = 0;
            return f;
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.CompressedSource = exports.getRootStream = exports.isSourceTransform = void 0;
        const path_1 = __webpack_require__(34);
        const errors_1 = __webpack_require__(19);
        const stream_limiter_1 = __webpack_require__(88);
        const source_source_1 = __webpack_require__(90);
        function isSourceTransform(stream) {
            return stream.sourceStream !== undefined;
        }
        exports.isSourceTransform = isSourceTransform;
        function getRootStream(stream) {
            while (isSourceTransform(stream)) {
                stream = stream.sourceStream;
            }
            return stream;
        }
        exports.getRootStream = getRootStream;
        class CompressedSource extends source_source_1.SourceSource {
            async getSize() {
                return;
            }
            async canCreateReadStream() {
                return true;
            }
            async createReadStream({emitProgress = false, start = 0, end} = {}) {
                if (start !== 0) {
                    throw new errors_1.NotCapable;
                }
                const stream = await this.source.createReadStream({
                    emitProgress
                });
                const transform = this.createTransform();
                stream.pipe(transform);
                transform.sourceStream = stream;
                if (end !== undefined) {
                    const limiter = new stream_limiter_1.StreamLimiter(transform, end + 1);
                    limiter.sourceStream = transform;
                    limiter.on("finish", (() => {
                        stream.on("error", (err => {
                            if (err.code !== "EBADF") {
                                throw err;
                            }
                        }));
                    }));
                    return limiter;
                }
                return transform;
            }
            async getSizeFromPartitionTable() {
                try {
                    const partitions = await this.getPartitionTable();
                    if (partitions !== undefined) {
                        const lastByte = Math.max(...partitions.partitions.map((({offset, size}) => offset + size)));
                        if (lastByte !== -Infinity) {
                            return lastByte;
                        }
                    }
                } catch (error) {}
            }
            async _getMetadata() {
                const sourceMetadata = await this.source.getMetadata();
                const compressedSize = sourceMetadata.compressedSize || sourceMetadata.size;
                const size = await this.getSize();
                let name;
                if (sourceMetadata.name !== undefined) {
                    name = (0, path_1.basename)(sourceMetadata.name, (0, path_1.extname)(sourceMetadata.name));
                }
                return {
                    isCompressed: true,
                    name,
                    size: size === null || size === void 0 ? void 0 : size.size,
                    compressedSize,
                    isSizeEstimated: size === null || size === void 0 ? void 0 : size.isEstimated
                };
            }
        }
        exports.CompressedSource = CompressedSource;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.StreamLimiter = void 0;
        const stream_1 = __webpack_require__(17);
        const zlib = __webpack_require__(89);
        const compressed_source_1 = __webpack_require__(87);
        class StreamLimiter extends stream_1.Transform {
            constructor(stream, maxBytes) {
                super();
                this.stream = stream;
                this.maxBytes = maxBytes;
                this.stream.on("error", this.emit.bind(this, "error"));
                this.stream.pipe(this);
            }
            _transform(buffer, _encoding, callback) {
                var _a, _b, _c, _d, _e, _f;
                const length = Math.min(buffer.length, this.maxBytes);
                if (length > 0) {
                    this.push(buffer.slice(0, length));
                }
                this.maxBytes -= length;
                if (this.maxBytes === 0) {
                    (_b = (_a = this.stream).unpipe) === null || _b === void 0 ? void 0 : _b.call(_a, this);
                    this.push(null);
                    this.emit("finish");
                    (0, compressed_source_1.getRootStream)(this.stream).emit("end");
                    if (!(this.stream instanceof zlib.Gunzip)) {
                        (_d = (_c = this.stream).close) === null || _d === void 0 ? void 0 : _d.call(_c);
                    }
                    if (this.stream.constructor.name !== "JSLzmaStream") {
                        (_f = (_e = this.stream).destroy) === null || _f === void 0 ? void 0 : _f.call(_e);
                    }
                }
                callback();
            }
        }
        exports.StreamLimiter = StreamLimiter;
    }, module => {
        "use strict";
        module.exports = require("zlib");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.SourceSource = void 0;
        const source_destination_1 = __webpack_require__(54);
        class SourceSource extends source_destination_1.SourceDestination {
            constructor(source) {
                super();
                this.source = source;
            }
            async _open() {
                await this.source.open();
            }
            async _close() {
                await this.source.close();
            }
        }
        exports.SourceSource = SourceSource;
        SourceSource.requiresRandomReadableSource = false;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ConfiguredSource = exports.SourceDisk = void 0;
        const balena_image_fs_1 = __webpack_require__(92);
        const _debug = __webpack_require__(8);
        const file_disk_1 = __webpack_require__(57);
        const partitioninfo_1 = __webpack_require__(56);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const shared_1 = __webpack_require__(80);
        const sparse_filter_stream_1 = __webpack_require__(79);
        const sparse_read_stream_1 = __webpack_require__(81);
        const block_device_1 = __webpack_require__(3);
        const source_source_1 = __webpack_require__(90);
        const configure_1 = __webpack_require__(113);
        const debug = _debug("etcher-sdk:configured-source");
        class SourceDisk extends file_disk_1.Disk {
            constructor(source) {
                super(true, true, true, true);
                this.source = source;
                if (source instanceof block_device_1.BlockDevice && source.oDirect) {
                    throw new Error("Can't create a SourceDisk from a BlockDevice opened with O_DIRECT");
                }
            }
            async _getCapacity() {
                const size = (await this.source.getMetadata()).size;
                if (size === undefined) {
                    throw new errors_1.NotCapable;
                }
                return size;
            }
            async _read(buffer, bufferOffset, length, fileOffset) {
                return await this.source.read(buffer, bufferOffset, length, fileOffset);
            }
            async _write(_buffer, _bufferOffset, _length, _fileOffset) {
                throw new Error("Can't write to a SourceDisk");
            }
            async _flush() {}
        }
        exports.SourceDisk = SourceDisk;
        class ConfiguredSource extends source_source_1.SourceSource {
            constructor({source, shouldTrimPartitions, createStreamFromDisk, configure, checksumType = "xxhash3", chunkSize = constants_1.CHUNK_SIZE}) {
                super(source);
                this.shouldTrimPartitions = shouldTrimPartitions;
                this.createStreamFromDisk = createStreamFromDisk;
                this.checksumType = checksumType;
                this.chunkSize = chunkSize;
                this.disk = new SourceDisk(source);
                if (configure === "legacy") {
                    this.configure = configure_1.configure;
                } else {
                    this.configure = configure;
                }
            }
            async getBlocks() {
                const blocks = await this.disk.getRanges(this.chunkSize);
                if (blocks.length) {
                    const lastBlock = blocks[blocks.length - 1];
                    const metadata = await this.source.getMetadata();
                    const overflow = lastBlock.offset + lastBlock.length - metadata.size;
                    if (overflow > 0) {
                        lastBlock.length -= overflow;
                    }
                }
                return blocks.map((block => ({
                    blocks: [ block ]
                })));
            }
            async getBlocksWithChecksumType(generateChecksums) {
                let blocks = await this.getBlocks();
                if (generateChecksums) {
                    blocks = blocks.map((block => ({
                        ...block,
                        checksumType: this.checksumType
                    })));
                }
                return blocks;
            }
            async canRead() {
                return true;
            }
            async canCreateReadStream() {
                return true;
            }
            async canCreateSparseReadStream() {
                return true;
            }
            async read(buffer, bufferOffset, length, sourceOffset) {
                return await this.disk.read(buffer, bufferOffset, length, sourceOffset);
            }
            async createReadStream(options) {
                const imageStream = await this.source.createReadStream(options);
                const transform = this.disk.getTransformStream();
                imageStream.on("error", (err => {
                    transform.emit("error", err);
                }));
                imageStream.pipe(transform);
                return transform;
            }
            async createSparseReadStreamFromDisk(generateChecksums, alignment, numBuffers = 2) {
                return new sparse_read_stream_1.SparseReadStream({
                    source: this,
                    blocks: await this.getBlocksWithChecksumType(generateChecksums),
                    chunkSize: constants_1.CHUNK_SIZE,
                    verify: false,
                    generateChecksums,
                    alignment,
                    numBuffers
                });
            }
            async createSparseReadStreamFromStream(generateChecksums, alignment, numBuffers = 2) {
                const stream = await this.createReadStream({
                    alignment,
                    numBuffers
                });
                const transform = new sparse_filter_stream_1.SparseFilterStream({
                    blocks: await this.getBlocksWithChecksumType(generateChecksums),
                    verify: false,
                    generateChecksums
                });
                stream.on("error", transform.emit.bind(transform, "error"));
                stream.pipe(transform);
                return transform;
            }
            async createSparseReadStream({generateChecksums = false, alignment, numBuffers = 2} = {}) {
                if (this.createStreamFromDisk) {
                    return await this.createSparseReadStreamFromDisk(generateChecksums, alignment, numBuffers);
                } else {
                    return await this.createSparseReadStreamFromStream(generateChecksums, alignment, numBuffers);
                }
            }
            async _getMetadata() {
                const sourceMetadata = await this.source.getMetadata();
                const blocks = await this.getBlocks();
                const blockmappedSize = (0, shared_1.blocksLength)(blocks);
                return {
                    ...sourceMetadata,
                    blocks,
                    blockmappedSize
                };
            }
            async trimPartitions() {
                let partitions;
                try {
                    ({partitions} = await (0, partitioninfo_1.getPartitions)(this.disk, {
                        includeExtended: false
                    }));
                } catch (error) {
                    debug("Couldn't read partition table", error);
                    return;
                }
                for (const partition of partitions) {
                    try {
                        await (0, balena_image_fs_1.interact)(this.disk, partition.index, (async fs => {
                            if (fs.trim !== undefined) {
                                await fs.trim();
                            }
                        }));
                    } catch (_a) {}
                }
                const discards = this.disk.getDiscardedChunks();
                const discardedBytes = discards.map((d => d.end - d.start + 1)).reduce(((a, b) => a + b), 0);
                const metadata = await this.getMetadata();
                if (metadata.size !== undefined) {
                    const percentage = Math.round(discardedBytes / metadata.size * 100);
                    debug(`discarded ${discards.length} chunks, ${discardedBytes} bytes, ${percentage}% of the image`);
                }
            }
            async _open() {
                await super._open();
                if (this.configure !== undefined) {
                    await this.configure(this.disk);
                }
                if (this.shouldTrimPartitions) {
                    await this.trimPartitions();
                }
                this.disk.recordReads = false;
            }
            async _close() {
                await super._close();
            }
        }
        exports.ConfiguredSource = ConfiguredSource;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.interact = void 0;
        const ext2fs = __webpack_require__(93);
        const fatfs = __webpack_require__(103);
        const file_disk_1 = __webpack_require__(57);
        const partitioninfo = __webpack_require__(56);
        const typed_error_1 = __webpack_require__(78);
        class MountError extends typed_error_1.TypedError {}
        const SECTOR_SIZE = 512;
        async function runInFat(disk, offset, size, fn) {
            function sectorPosition(sector) {
                return offset + sector * SECTOR_SIZE;
            }
            const fat = fatfs.createFileSystem({
                sectorSize: SECTOR_SIZE,
                numSectors: size / SECTOR_SIZE,
                readSectors: async (sector, dest, callback) => {
                    try {
                        const {bytesRead, buffer} = await disk.read(dest, 0, dest.length, sectorPosition(sector));
                        callback(null, bytesRead, buffer);
                    } catch (e) {
                        callback(e);
                    }
                },
                writeSectors: async (sector, data, callback) => {
                    try {
                        const {bytesWritten, buffer} = await disk.write(data, 0, data.length, sectorPosition(sector));
                        callback(null, bytesWritten, buffer);
                    } catch (e) {
                        callback(e);
                    }
                }
            });
            await new Promise((function(resolve, reject) {
                fat.on("error", (e => {
                    reject(new MountError(e));
                }));
                fat.on("ready", resolve);
            }));
            return await fn(fat);
        }
        async function runInExt(disk, offset, fn) {
            let fs;
            try {
                fs = await ext2fs.mount(disk, offset);
            } catch (e) {
                throw new MountError(e);
            }
            try {
                return await fn(fs);
            } finally {
                await ext2fs.umount(fs);
            }
        }
        async function tryInteract(disk, offset, size, fn) {
            try {
                return await runInFat(disk, offset, size, fn);
            } catch (e) {
                if (!(e instanceof MountError)) {
                    throw e;
                }
                try {
                    return await runInExt(disk, offset, fn);
                } catch (e2) {
                    if (!(e2 instanceof MountError)) {
                        throw e2;
                    }
                    throw new Error("Unsupported filesystem.");
                }
            }
        }
        async function getPartitionOffset(disk, partition) {
            if (partition === undefined) {
                const size = await disk.getCapacity();
                return {
                    offset: 0,
                    size
                };
            } else {
                return await partitioninfo.get(disk, partition);
            }
        }
        async function diskInteract(disk, partition, fn) {
            const {offset, size} = await getPartitionOffset(disk, partition);
            return await tryInteract(disk, offset, size, fn);
        }
        async function interact(disk, partition, fn) {
            if (typeof disk === "string") {
                return await file_disk_1.withOpenFile(disk, "r+", (async handle => {
                    disk = new file_disk_1.FileDisk(handle);
                    return await diskInteract(disk, partition, fn);
                }));
            } else if (disk instanceof file_disk_1.Disk) {
                return await diskInteract(disk, partition, fn);
            } else {
                throw new Error("image must be a String (file path) or a Disk instance");
            }
        }
        exports.interact = interact;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        module.exports = __webpack_require__(94);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        const {DiskWrapper} = __webpack_require__(95);
        const createFs = __webpack_require__(96);
        const Module = __webpack_require__(98);
        const {ccallThrowAsync} = __webpack_require__(100);
        const ready = new Promise((resolve => {
            Module.onRuntimeInitialized = resolve;
        }));
        exports.mount = async function(disk, offset = 0) {
            await ready;
            const wrapper = new DiskWrapper(disk, offset);
            const diskId = Module.setObject(wrapper);
            let fsPointer;
            try {
                fsPointer = await ccallThrowAsync("node_ext2fs_mount", "number", [ "number" ], [ diskId ]);
            } catch (error) {
                Module.deleteObject(diskId);
                throw error;
            }
            const fs = createFs(fsPointer);
            fs.trim = async () => {
                await ccallThrowAsync("node_ext2fs_trim", "number", [ "number" ], [ fsPointer ]);
            };
            fs.diskId = diskId;
            return fs;
        };
        exports.umount = async function(fs) {
            await fs.closeAllFileDescriptors();
            await ccallThrowAsync("node_ext2fs_umount", "number", [ "number" ], [ fs.fsPointer ]);
            Module.deleteObject(fs.diskId);
        };
        exports.withMountedDisk = async function(disk, offset, fn) {
            const fs = await exports.mount(disk, offset);
            try {
                return await fn(fs);
            } finally {
                await exports.umount(fs);
            }
        };
    }, (__unused_webpack_module, exports) => {
        "use strict";
        class DiskWrapper {
            constructor(disk, offset = 0) {
                this.disk = disk;
                this.offset = offset;
            }
            async read(buffer, bufferOffset, length, fileOffset) {
                return await this.disk.read(buffer, bufferOffset, length, fileOffset + this.offset);
            }
            async write(buffer, bufferOffset, length, fileOffset) {
                return await this.disk.write(buffer, bufferOffset, length, fileOffset + this.offset);
            }
            async discard(offset, length) {
                return await this.disk.discard(offset + this.offset, length);
            }
            async flush() {
                return await this.disk.flush();
            }
        }
        exports.DiskWrapper = DiskWrapper;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const constants = {
            O_RDONLY: 0,
            O_WRONLY: 1,
            O_RDWR: 2,
            S_IFMT: 61440,
            S_IFREG: 32768,
            S_IFDIR: 16384,
            S_IFCHR: 8192,
            S_IFBLK: 24576,
            S_IFIFO: 4096,
            S_IFLNK: 40960,
            S_IFSOCK: 49152,
            O_CREAT: 64,
            O_EXCL: 128,
            O_NOCTTY: 256,
            O_TRUNC: 512,
            O_APPEND: 1024,
            O_DIRECTORY: 65536,
            O_NOATIME: 262144,
            O_NOFOLLOW: 131072,
            O_SYNC: 1052672,
            O_DIRECT: 16384,
            O_NONBLOCK: 2048,
            S_IRWXU: 448,
            S_IRUSR: 256,
            S_IWUSR: 128,
            S_IXUSR: 64,
            S_IRWXG: 56,
            S_IRGRP: 32,
            S_IWGRP: 16,
            S_IXGRP: 8,
            S_IRWXO: 7,
            S_IROTH: 4,
            S_IWOTH: 2,
            S_IXOTH: 1,
            F_OK: 0,
            R_OK: 4,
            W_OK: 2,
            X_OK: 1
        };
        function assertEncoding(encoding) {
            if (encoding && !Buffer.isEncoding(encoding)) {
                throw new Error(`Unknown encoding: ${encoding}`);
            }
        }
        function stringToFlags(flag) {
            if (typeof flag === "number") {
                return flag;
            }
            switch (flag) {
              case "r":
                return constants.O_RDONLY;

              case "rs":
              case "sr":
                return constants.O_RDONLY | constants.O_SYNC;

              case "r+":
                return constants.O_RDWR;

              case "rs+":
              case "sr+":
                return constants.O_RDWR | constants.O_SYNC;

              case "w":
                return constants.O_TRUNC | constants.O_CREAT | constants.O_WRONLY;

              case "wx":
              case "xw":
                return constants.O_TRUNC | constants.O_CREAT | constants.O_WRONLY | constants.O_EXCL;

              case "w+":
                return constants.O_TRUNC | constants.O_CREAT | constants.O_RDWR;

              case "wx+":
              case "xw+":
                return constants.O_TRUNC | constants.O_CREAT | constants.O_RDWR | constants.O_EXCL;

              case "a":
                return constants.O_APPEND | constants.O_CREAT | constants.O_WRONLY;

              case "ax":
              case "xa":
                return constants.O_APPEND | constants.O_CREAT | constants.O_WRONLY | constants.O_EXCL;

              case "a+":
                return constants.O_APPEND | constants.O_CREAT | constants.O_RDWR;

              case "ax+":
              case "xa+":
                return constants.O_APPEND | constants.O_CREAT | constants.O_RDWR | constants.O_EXCL;
            }
            throw new Error("Unknown file open flag: " + flag);
        }
        module.exports = function(fsPointer) {
            const util = __webpack_require__(14);
            const pathModule = __webpack_require__(34);
            const binding = __webpack_require__(97)(constants, fsPointer);
            const fs = {};
            fs.fsPointer = fsPointer;
            fs.closeAllFileDescriptors = binding.closeAllFileDescriptors;
            fs.openFiles = binding.openFiles;
            const Buffer = __webpack_require__(102).Buffer;
            const Stream = __webpack_require__(17).Stream;
            const FSReqWrap = binding.FSReqWrap;
            Object.defineProperty(fs, "constants", {
                configurable: false,
                enumerable: true,
                value: constants
            });
            const Readable = Stream.Readable;
            const Writable = Stream.Writable;
            const kMinPoolSpace = 128;
            const kMaxLength = __webpack_require__(102).kMaxLength;
            const isWindows = false;
            const DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
            function getOptions(options, defaultOptions) {
                if (options === null || options === undefined || typeof options === "function") {
                    return defaultOptions;
                }
                if (typeof options === "string") {
                    defaultOptions = util._extend({}, defaultOptions);
                    defaultOptions.encoding = options;
                    options = defaultOptions;
                } else if (typeof options !== "object") {
                    throw new TypeError('"options" must be a string or an object, got ' + typeof options + " instead.");
                }
                if (options.encoding !== "buffer") assertEncoding(options.encoding);
                return options;
            }
            function copyObject(source) {
                const target = {};
                for (const key in source) target[key] = source[key];
                return target;
            }
            function rethrow() {
                process.emitWarning("Calling an asynchronous function without callback is deprecated.", "DeprecationWarning", rethrow);
                if (DEBUG) {
                    var backtrace = new Error;
                    return function(err) {
                        if (err) {
                            backtrace.stack = err.name + ": " + err.message + backtrace.stack.substr(backtrace.name.length);
                            throw backtrace;
                        }
                    };
                }
                return function(err) {
                    if (err) {
                        throw err;
                    }
                };
            }
            function maybeCallback(cb) {
                return typeof cb === "function" ? cb : rethrow();
            }
            function makeCallback(cb) {
                if (cb === undefined) {
                    return rethrow();
                }
                if (typeof cb !== "function") {
                    throw new TypeError('"callback" argument must be a function');
                }
                return function() {
                    return cb.apply(null, arguments);
                };
            }
            function nullCheck(path, callback) {
                if (("" + path).indexOf("\0") !== -1) {
                    var er = new Error("Path must be a string without null bytes");
                    er.code = "ENOENT";
                    if (typeof callback !== "function") throw er;
                    process.nextTick(callback, er);
                    return false;
                }
                return true;
            }
            function isFd(path) {
                return path >>> 0 === path;
            }
            fs.Stats = function(dev, mode, nlink, uid, gid, rdev, blksize, ino, size, blocks, atim_msec, mtim_msec, ctim_msec, birthtim_msec) {
                this.dev = dev;
                this.mode = mode;
                this.nlink = nlink;
                this.uid = uid;
                this.gid = gid;
                this.rdev = rdev;
                this.blksize = blksize;
                this.ino = ino;
                this.size = size;
                this.blocks = blocks;
                this.atime = new Date(atim_msec);
                this.mtime = new Date(mtim_msec);
                this.ctime = new Date(ctim_msec);
                this.birthtime = new Date(birthtim_msec);
            };
            binding.FSInitialize(fs.Stats);
            fs.Stats.prototype._checkModeProperty = function(property) {
                return (this.mode & constants.S_IFMT) === property;
            };
            fs.Stats.prototype.isDirectory = function() {
                return this._checkModeProperty(constants.S_IFDIR);
            };
            fs.Stats.prototype.isFile = function() {
                return this._checkModeProperty(constants.S_IFREG);
            };
            fs.Stats.prototype.isBlockDevice = function() {
                return this._checkModeProperty(constants.S_IFBLK);
            };
            fs.Stats.prototype.isCharacterDevice = function() {
                return this._checkModeProperty(constants.S_IFCHR);
            };
            fs.Stats.prototype.isSymbolicLink = function() {
                return this._checkModeProperty(constants.S_IFLNK);
            };
            fs.Stats.prototype.isFIFO = function() {
                return this._checkModeProperty(constants.S_IFIFO);
            };
            fs.Stats.prototype.isSocket = function() {
                return this._checkModeProperty(constants.S_IFSOCK);
            };
            [ "F_OK", "R_OK", "W_OK", "X_OK" ].forEach((function(key) {
                Object.defineProperty(fs, key, {
                    enumerable: true,
                    value: constants[key] || 0,
                    writable: false
                });
            }));
            fs.access = function(path, mode, callback) {
                if (typeof mode === "function") {
                    callback = mode;
                    mode = fs.F_OK;
                } else if (typeof callback !== "function") {
                    throw new TypeError('"callback" argument must be a function');
                }
                if (!nullCheck(path, callback)) return;
                mode = mode | 0;
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.access(path, mode, req);
            };
            fs.exists = function(path, callback) {
                if (!nullCheck(path, cb)) return;
                var req = new FSReqWrap;
                req.oncomplete = cb;
                binding.stat(path, req);
                function cb(err, stats) {
                    if (callback) callback(err ? false : true);
                }
            };
            fs.readFile = function(path, options, callback) {
                callback = maybeCallback(arguments[arguments.length - 1]);
                options = getOptions(options, {
                    flag: "r"
                });
                if (!nullCheck(path, callback)) return;
                var context = new ReadFileContext(callback, options.encoding);
                context.isUserFd = isFd(path);
                var req = new FSReqWrap;
                req.context = context;
                req.oncomplete = readFileAfterOpen;
                if (context.isUserFd) {
                    process.nextTick((function() {
                        req.oncomplete(null, path);
                    }));
                    return;
                }
                binding.open(path, stringToFlags(options.flag || "r"), 438, req);
            };
            const kReadFileBufferLength = 8 * 1024;
            function ReadFileContext(callback, encoding) {
                this.fd = undefined;
                this.isUserFd = undefined;
                this.size = undefined;
                this.callback = callback;
                this.buffers = null;
                this.buffer = null;
                this.pos = 0;
                this.encoding = encoding;
                this.err = null;
            }
            ReadFileContext.prototype.read = function() {
                var buffer;
                var offset;
                var length;
                if (this.size === 0) {
                    buffer = this.buffer = Buffer.allocUnsafeSlow(kReadFileBufferLength);
                    offset = 0;
                    length = kReadFileBufferLength;
                } else {
                    buffer = this.buffer;
                    offset = this.pos;
                    length = this.size - this.pos;
                }
                var req = new FSReqWrap;
                req.oncomplete = readFileAfterRead;
                req.context = this;
                binding.read(this.fd, buffer, offset, length, -1, req);
            };
            ReadFileContext.prototype.close = function(err) {
                var req = new FSReqWrap;
                req.oncomplete = readFileAfterClose;
                req.context = this;
                this.err = err;
                if (this.isUserFd) {
                    process.nextTick((function() {
                        req.oncomplete(null);
                    }));
                    return;
                }
                binding.close(this.fd, req);
            };
            function readFileAfterOpen(err, fd) {
                var context = this.context;
                if (err) {
                    context.callback(err);
                    return;
                }
                context.fd = fd;
                var req = new FSReqWrap;
                req.oncomplete = readFileAfterStat;
                req.context = context;
                binding.fstat(fd, req);
            }
            function readFileAfterStat(err, st) {
                var context = this.context;
                if (err) return context.close(err);
                var size = context.size = st.isFile() ? st.size : 0;
                if (size === 0) {
                    context.buffers = [];
                    context.read();
                    return;
                }
                if (size > kMaxLength) {
                    err = new RangeError("File size is greater than possible Buffer: " + `0x${kMaxLength.toString(16)} bytes`);
                    return context.close(err);
                }
                context.buffer = Buffer.allocUnsafeSlow(size);
                context.read();
            }
            function readFileAfterRead(err, bytesRead) {
                var context = this.context;
                if (err) return context.close(err);
                if (bytesRead === 0) return context.close();
                context.pos += bytesRead;
                if (context.size !== 0) {
                    if (context.pos === context.size) context.close(); else context.read();
                } else {
                    context.buffers.push(context.buffer.slice(0, bytesRead));
                    context.read();
                }
            }
            function readFileAfterClose(err) {
                var context = this.context;
                var buffer = null;
                var callback = context.callback;
                if (context.err) return callback(context.err);
                if (context.size === 0) buffer = Buffer.concat(context.buffers, context.pos); else if (context.pos < context.size) buffer = context.buffer.slice(0, context.pos); else buffer = context.buffer;
                if (err) return callback(err, buffer);
                if (context.encoding) {
                    return tryToString(buffer, context.encoding, callback);
                }
                callback(null, buffer);
            }
            function tryToString(buf, encoding, callback) {
                var e = null;
                try {
                    buf = buf.toString(encoding);
                } catch (err) {
                    e = err;
                }
                callback(e, buf);
            }
            fs.close = function(fd, callback) {
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.close(fd, req);
            };
            function modeNum(m, def) {
                if (typeof m === "number") return m;
                if (typeof m === "string") return parseInt(m, 8);
                if (def) return modeNum(def);
                return undefined;
            }
            fs.open = function(path, flags, mode, callback_) {
                var callback = makeCallback(arguments[arguments.length - 1]);
                mode = modeNum(mode, 438);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.open(path, stringToFlags(flags), mode, req);
            };
            var readWarned = false;
            fs.read = function(fd, buffer, offset, length, position, callback) {
                if (!(buffer instanceof Buffer)) {
                    if (!readWarned) {
                        readWarned = true;
                        process.emitWarning("fs.read's legacy String interface is deprecated. Use the Buffer " + "API as mentioned in the documentation instead.", "DeprecationWarning");
                    }
                    const cb = arguments[4];
                    const encoding = arguments[3];
                    assertEncoding(encoding);
                    position = arguments[2];
                    length = arguments[1];
                    buffer = Buffer.allocUnsafe(length);
                    offset = 0;
                    callback = function(err, bytesRead) {
                        if (!cb) return;
                        if (err) return cb(err);
                        if (bytesRead > 0) {
                            tryToStringWithEnd(buffer, encoding, bytesRead, cb);
                        } else {
                            cb(err, "", bytesRead);
                        }
                    };
                }
                if (length === 0) {
                    return process.nextTick((function() {
                        callback && callback(null, 0, buffer);
                    }));
                }
                function wrapper(err, bytesRead) {
                    callback && callback(err, bytesRead || 0, buffer);
                }
                var req = new FSReqWrap;
                req.oncomplete = wrapper;
                binding.read(fd, buffer, offset, length, position, req);
            };
            function tryToStringWithEnd(buf, encoding, end, callback) {
                var e;
                try {
                    buf = buf.toString(encoding, 0, end);
                } catch (err) {
                    e = err;
                }
                callback(e, buf, end);
            }
            fs.write = function(fd, buffer, offset, length, position, callback) {
                function wrapper(err, written) {
                    callback(err, written || 0, buffer);
                }
                var req = new FSReqWrap;
                req.oncomplete = wrapper;
                if (buffer instanceof Buffer) {
                    callback = maybeCallback(callback || position || length || offset);
                    if (typeof offset !== "number") {
                        offset = 0;
                    }
                    if (typeof length !== "number") {
                        length = buffer.length - offset;
                    }
                    if (typeof position !== "number") {
                        position = null;
                    }
                    return binding.writeBuffer(fd, buffer, offset, length, position, req);
                }
                if (typeof buffer !== "string") buffer += "";
                if (typeof position !== "function") {
                    if (typeof offset === "function") {
                        position = offset;
                        offset = null;
                    } else {
                        position = length;
                    }
                    length = "utf8";
                }
                callback = maybeCallback(position);
                return binding.writeString(fd, buffer, offset, length, req);
            };
            fs.rename = function(oldPath, newPath, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(oldPath, callback)) return;
                if (!nullCheck(newPath, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.rename(path, path, req);
            };
            fs.truncate = function(path, len, callback) {
                if (typeof path === "number") {
                    return fs.ftruncate(path, len, callback);
                }
                if (typeof len === "function") {
                    callback = len;
                    len = 0;
                } else if (len === undefined) {
                    len = 0;
                }
                callback = maybeCallback(callback);
                fs.open(path, "r+", (function(er, fd) {
                    if (er) return callback(er);
                    var req = new FSReqWrap;
                    req.oncomplete = function oncomplete(er) {
                        fs.close(fd, (function(er2) {
                            callback(er || er2);
                        }));
                    };
                    binding.ftruncate(fd, len, req);
                }));
            };
            fs.ftruncate = function(fd, len, callback) {
                if (typeof len === "function") {
                    callback = len;
                    len = 0;
                } else if (len === undefined) {
                    len = 0;
                }
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.ftruncate(fd, len, req);
            };
            fs.rmdir = function(path, callback) {
                callback = maybeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.rmdir(path, req);
            };
            fs.fdatasync = function(fd, callback) {
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.fdatasync(fd, req);
            };
            fs.fsync = function(fd, callback) {
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.fsync(fd, req);
            };
            fs.mkdir = function(path, mode, callback) {
                if (typeof mode === "function") callback = mode;
                callback = makeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.mkdir(path, modeNum(mode, 511), req);
            };
            fs.readdir = function(path, options, callback) {
                callback = makeCallback(typeof options === "function" ? options : callback);
                options = getOptions(options, {});
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.readdir(path, options.encoding, req);
            };
            fs.fstat = function(fd, callback) {
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.fstat(fd, req);
            };
            fs.lstat = function(path, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.lstat(path, req);
            };
            fs.stat = function(path, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.stat(path, req);
            };
            fs.readlink = function(path, options, callback) {
                callback = makeCallback(typeof options === "function" ? options : callback);
                options = getOptions(options, {});
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.readlink(path, options.encoding, req);
            };
            function preprocessSymlinkDestination(path, type, linkPath) {
                if (!isWindows) {
                    return path;
                } else if (type === "junction") {
                    path = pathModule.resolve(linkPath, "..", path);
                    return path;
                } else {
                    return ("" + path).replace(/\//g, "\\");
                }
            }
            fs.symlink = function(target, path, type_, callback_) {
                var type = typeof type_ === "string" ? type_ : null;
                var callback = makeCallback(arguments[arguments.length - 1]);
                if (!nullCheck(target, callback)) return;
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.symlink(preprocessSymlinkDestination(target, type, path), path, type, req);
            };
            fs.link = function(existingPath, newPath, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(existingPath, callback)) return;
                if (!nullCheck(newPath, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.link(path, path, req);
            };
            fs.unlink = function(path, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.unlink(path, req);
            };
            fs.fchmod = function(fd, mode, callback) {
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.fchmod(fd, modeNum(mode), req);
            };
            if (constants.O_SYMLINK !== undefined) {
                fs.lchmod = function(path, mode, callback) {
                    callback = maybeCallback(callback);
                    fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, (function(err, fd) {
                        if (err) {
                            callback(err);
                            return;
                        }
                        fs.fchmod(fd, mode, (function(err) {
                            fs.close(fd, (function(err2) {
                                callback(err || err2);
                            }));
                        }));
                    }));
                };
            }
            fs.chmod = function(path, mode, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.chmod(path, modeNum(mode), req);
            };
            if (constants.O_SYMLINK !== undefined) {
                fs.lchown = function(path, uid, gid, callback) {
                    callback = maybeCallback(callback);
                    fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, (function(err, fd) {
                        if (err) {
                            callback(err);
                            return;
                        }
                        fs.fchown(fd, uid, gid, callback);
                    }));
                };
            }
            fs.fchown = function(fd, uid, gid, callback) {
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.fchown(fd, uid, gid, req);
            };
            fs.chown = function(path, uid, gid, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.chown(path, uid, gid, req);
            };
            function toUnixTimestamp(time) {
                if (typeof time === "string" && +time == time) {
                    return +time;
                }
                if (typeof time === "number") {
                    if (!Number.isFinite(time) || time < 0) {
                        return Date.now() / 1e3;
                    }
                    return time;
                }
                if (util.isDate(time)) {
                    return time.getTime() / 1e3;
                }
                throw new Error("Cannot parse time: " + time);
            }
            fs._toUnixTimestamp = toUnixTimestamp;
            fs.utimes = function(path, atime, mtime, callback) {
                callback = makeCallback(callback);
                if (!nullCheck(path, callback)) return;
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.utimes(path, toUnixTimestamp(atime), toUnixTimestamp(mtime), req);
            };
            fs.futimes = function(fd, atime, mtime, callback) {
                atime = toUnixTimestamp(atime);
                mtime = toUnixTimestamp(mtime);
                var req = new FSReqWrap;
                req.oncomplete = makeCallback(callback);
                binding.futimes(fd, atime, mtime, req);
            };
            function writeAll(fd, isUserFd, buffer, offset, length, position, callback_) {
                var callback = maybeCallback(arguments[arguments.length - 1]);
                fs.write(fd, buffer, offset, length, position, (function(writeErr, written) {
                    if (writeErr) {
                        if (isUserFd) {
                            callback(writeErr);
                        } else {
                            fs.close(fd, (function() {
                                callback(writeErr);
                            }));
                        }
                    } else {
                        if (written === length) {
                            if (isUserFd) {
                                callback(null);
                            } else {
                                fs.close(fd, callback);
                            }
                        } else {
                            offset += written;
                            length -= written;
                            if (position !== null) {
                                position += written;
                            }
                            writeAll(fd, isUserFd, buffer, offset, length, position, callback);
                        }
                    }
                }));
            }
            fs.writeFile = function(path, data, options, callback) {
                callback = maybeCallback(arguments[arguments.length - 1]);
                options = getOptions(options, {
                    encoding: "utf8",
                    mode: 438,
                    flag: "w"
                });
                const flag = options.flag || "w";
                if (isFd(path)) {
                    writeFd(path, true);
                    return;
                }
                fs.open(path, flag, options.mode, (function(openErr, fd) {
                    if (openErr) {
                        callback(openErr);
                    } else {
                        writeFd(fd, false);
                    }
                }));
                function writeFd(fd, isUserFd) {
                    var buffer = data instanceof Buffer ? data : Buffer.from("" + data, options.encoding || "utf8");
                    var position = /a/.test(flag) ? null : 0;
                    writeAll(fd, isUserFd, buffer, 0, buffer.length, position, callback);
                }
            };
            fs.appendFile = function(path, data, options, callback) {
                callback = maybeCallback(arguments[arguments.length - 1]);
                options = getOptions(options, {
                    encoding: "utf8",
                    mode: 438,
                    flag: "a"
                });
                options = copyObject(options);
                if (!options.flag || isFd(path)) options.flag = "a";
                fs.writeFile(path, data, options, callback);
            };
            const nextPartRe = isWindows ? /(.*?)(?:[/\\]+|$)/g : /(.*?)(?:[/]+|$)/g;
            const splitRootRe = isWindows ? /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/][^\\/]+)?[\\/]*/ : /^[/]*/;
            function encodeRealpathResult(result, options, err) {
                if (!options || !options.encoding || options.encoding === "utf8" || err) return result;
                const asBuffer = Buffer.from(result);
                if (options.encoding === "buffer") {
                    return asBuffer;
                } else {
                    return asBuffer.toString(options.encoding);
                }
            }
            fs.realpath = function realpath(p, options, callback) {
                callback = maybeCallback(typeof options === "function" ? options : callback);
                options = getOptions(options, {});
                if (!nullCheck(p, callback)) return;
                p = p.toString("utf8");
                p = pathModule.resolve(p);
                const seenLinks = {};
                const knownHard = {};
                var pos;
                var current;
                var base;
                var previous;
                start();
                function start() {
                    var m = splitRootRe.exec(p);
                    pos = m[0].length;
                    current = m[0];
                    base = m[0];
                    previous = "";
                    if (isWindows && !knownHard[base]) {
                        fs.lstat(base, (function(err) {
                            if (err) return callback(err);
                            knownHard[base] = true;
                            LOOP();
                        }));
                    } else {
                        process.nextTick(LOOP);
                    }
                }
                function LOOP() {
                    if (pos >= p.length) {
                        return callback(null, encodeRealpathResult(p, options));
                    }
                    nextPartRe.lastIndex = pos;
                    var result = nextPartRe.exec(p);
                    previous = current;
                    current += result[0];
                    base = previous + result[1];
                    pos = nextPartRe.lastIndex;
                    if (knownHard[base]) {
                        return process.nextTick(LOOP);
                    }
                    return fs.lstat(base, gotStat);
                }
                function gotStat(err, stat) {
                    if (err) return callback(err);
                    if (!stat.isSymbolicLink()) {
                        knownHard[base] = true;
                        return process.nextTick(LOOP);
                    }
                    let id;
                    if (!isWindows) {
                        id = `${stat.dev.toString(32)}:${stat.ino.toString(32)}`;
                        if (seenLinks.hasOwnProperty(id)) {
                            return gotTarget(null, seenLinks[id], base);
                        }
                    }
                    fs.stat(base, (function(err) {
                        if (err) return callback(err);
                        fs.readlink(base, (function(err, target) {
                            if (!isWindows) seenLinks[id] = target;
                            gotTarget(err, target);
                        }));
                    }));
                }
                function gotTarget(err, target, base) {
                    if (err) return callback(err);
                    var resolvedLink = pathModule.resolve(previous, target);
                    gotResolvedLink(resolvedLink);
                }
                function gotResolvedLink(resolvedLink) {
                    p = pathModule.resolve(resolvedLink, p.slice(pos));
                    start();
                }
            };
            fs.mkdtemp = function(prefix, options, callback) {
                callback = makeCallback(typeof options === "function" ? options : callback);
                options = getOptions(options, {});
                if (!prefix || typeof prefix !== "string") throw new TypeError("filename prefix is required");
                if (!nullCheck(prefix, callback)) {
                    return;
                }
                var req = new FSReqWrap;
                req.oncomplete = callback;
                binding.mkdtemp(prefix + "XXXXXX", options.encoding, req);
            };
            var pool;
            function allocNewPool(poolSize) {
                pool = Buffer.allocUnsafe(poolSize);
                pool.used = 0;
            }
            fs.createReadStream = function(path, options) {
                return new ReadStream(path, options);
            };
            util.inherits(ReadStream, Readable);
            fs.ReadStream = ReadStream;
            function ReadStream(path, options) {
                if (!(this instanceof ReadStream)) return new ReadStream(path, options);
                options = copyObject(getOptions(options, {}));
                if (options.highWaterMark === undefined) options.highWaterMark = 64 * 1024;
                Readable.call(this, options);
                this.path = path;
                this.fd = options.fd === undefined ? null : options.fd;
                this.flags = options.flags === undefined ? "r" : options.flags;
                this.mode = options.mode === undefined ? 438 : options.mode;
                this.start = options.start;
                this.end = options.end;
                this.autoClose = options.autoClose === undefined ? true : options.autoClose;
                this.pos = undefined;
                this.bytesRead = 0;
                if (this.start !== undefined) {
                    if (typeof this.start !== "number") {
                        throw new TypeError('"start" option must be a Number');
                    }
                    if (this.end === undefined) {
                        this.end = Infinity;
                    } else if (typeof this.end !== "number") {
                        throw new TypeError('"end" option must be a Number');
                    }
                    if (this.start > this.end) {
                        throw new Error('"start" option must be <= "end" option');
                    }
                    this.pos = this.start;
                }
                if (typeof this.fd !== "number") this.open();
                this.on("end", (function() {
                    if (this.autoClose) {
                        this.destroy();
                    }
                }));
            }
            fs.FileReadStream = fs.ReadStream;
            ReadStream.prototype.open = function() {
                var self = this;
                fs.open(this.path, this.flags, this.mode, (function(er, fd) {
                    if (er) {
                        if (self.autoClose) {
                            self.destroy();
                        }
                        self.emit("error", er);
                        return;
                    }
                    self.fd = fd;
                    self.emit("open", fd);
                    self.read();
                }));
            };
            ReadStream.prototype._read = function(n) {
                if (typeof this.fd !== "number") return this.once("open", (function() {
                    this._read(n);
                }));
                if (this.destroyed) return;
                if (!pool || pool.length - pool.used < kMinPoolSpace) {
                    allocNewPool(this._readableState.highWaterMark);
                }
                var thisPool = pool;
                var toRead = Math.min(pool.length - pool.used, n);
                var start = pool.used;
                if (this.pos !== undefined) toRead = Math.min(this.end - this.pos + 1, toRead);
                if (toRead <= 0) return this.push(null);
                var self = this;
                fs.read(this.fd, pool, pool.used, toRead, this.pos, onread);
                if (this.pos !== undefined) this.pos += toRead;
                pool.used += toRead;
                function onread(er, bytesRead) {
                    if (er) {
                        if (self.autoClose) {
                            self.destroy();
                        }
                        self.emit("error", er);
                    } else {
                        var b = null;
                        if (bytesRead > 0) {
                            self.bytesRead += bytesRead;
                            b = thisPool.slice(start, start + bytesRead);
                        }
                        self.push(b);
                    }
                }
            };
            ReadStream.prototype.destroy = function() {
                if (this.destroyed) return;
                this.destroyed = true;
                this.close();
            };
            ReadStream.prototype.close = function(cb) {
                var self = this;
                if (cb) this.once("close", cb);
                if (this.closed || typeof this.fd !== "number") {
                    if (typeof this.fd !== "number") {
                        this.once("open", close);
                        return;
                    }
                    return process.nextTick((() => this.emit("close")));
                }
                this.closed = true;
                close();
                function close(fd) {
                    fs.close(fd || self.fd, (function(er) {
                        if (er) self.emit("error", er); else self.emit("close");
                    }));
                    self.fd = null;
                }
            };
            fs.createWriteStream = function(path, options) {
                return new WriteStream(path, options);
            };
            util.inherits(WriteStream, Writable);
            fs.WriteStream = WriteStream;
            function WriteStream(path, options) {
                if (!(this instanceof WriteStream)) return new WriteStream(path, options);
                options = copyObject(getOptions(options, {}));
                Writable.call(this, options);
                this.path = path;
                this.fd = options.fd === undefined ? null : options.fd;
                this.flags = options.flags === undefined ? "w" : options.flags;
                this.mode = options.mode === undefined ? 438 : options.mode;
                this.start = options.start;
                this.autoClose = options.autoClose === undefined ? true : !!options.autoClose;
                this.pos = undefined;
                this.bytesWritten = 0;
                if (this.start !== undefined) {
                    if (typeof this.start !== "number") {
                        throw new TypeError('"start" option must be a Number');
                    }
                    if (this.start < 0) {
                        throw new Error('"start" must be >= zero');
                    }
                    this.pos = this.start;
                }
                if (options.encoding) this.setDefaultEncoding(options.encoding);
                if (typeof this.fd !== "number") this.open();
                this.once("finish", (function() {
                    if (this.autoClose) {
                        this.close();
                    }
                }));
            }
            fs.FileWriteStream = fs.WriteStream;
            WriteStream.prototype.open = function() {
                fs.open(this.path, this.flags, this.mode, function(er, fd) {
                    if (er) {
                        if (this.autoClose) {
                            this.destroy();
                        }
                        this.emit("error", er);
                        return;
                    }
                    this.fd = fd;
                    this.emit("open", fd);
                }.bind(this));
            };
            WriteStream.prototype._write = function(data, encoding, cb) {
                if (!(data instanceof Buffer)) return this.emit("error", new Error("Invalid data"));
                if (typeof this.fd !== "number") return this.once("open", (function() {
                    this._write(data, encoding, cb);
                }));
                var self = this;
                fs.write(this.fd, data, 0, data.length, this.pos, (function(er, bytes) {
                    if (er) {
                        if (self.autoClose) {
                            self.destroy();
                        }
                        return cb(er);
                    }
                    self.bytesWritten += bytes;
                    cb();
                }));
                if (this.pos !== undefined) this.pos += data.length;
            };
            function writev(fd, chunks, position, callback) {
                function wrapper(err, written) {
                    callback(err, written || 0, chunks);
                }
                const req = new FSReqWrap;
                req.oncomplete = wrapper;
                binding.writeBuffers(fd, chunks, position, req);
            }
            WriteStream.prototype._writev = function(data, cb) {
                if (typeof this.fd !== "number") return this.once("open", (function() {
                    this._writev(data, cb);
                }));
                const self = this;
                const len = data.length;
                const chunks = new Array(len);
                var size = 0;
                for (var i = 0; i < len; i++) {
                    var chunk = data[i].chunk;
                    chunks[i] = chunk;
                    size += chunk.length;
                }
                writev(this.fd, chunks, this.pos, (function(er, bytes) {
                    if (er) {
                        self.destroy();
                        return cb(er);
                    }
                    self.bytesWritten += bytes;
                    cb();
                }));
                if (this.pos !== undefined) this.pos += size;
            };
            WriteStream.prototype.destroy = ReadStream.prototype.destroy;
            WriteStream.prototype.close = ReadStream.prototype.close;
            WriteStream.prototype.destroySoon = WriteStream.prototype.end;
            return fs;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const Module = __webpack_require__(98);
        const {CODE_TO_ERRNO} = __webpack_require__(99);
        const {ErrnoException, ccallThrow, ccallThrowAsync, promiseToCallback, withHeapBuffer, withPathAsHeapBuffer} = __webpack_require__(100);
        function getCallback(req) {
            if (!req || typeof req.oncomplete !== "function") {
                throw new Error("A callback is required.");
            }
            return req.oncomplete.bind(req);
        }
        module.exports = function(constants, fsPointer) {
            const exports = {};
            const openFiles = new Map;
            exports.openFiles = openFiles;
            exports.FSReqWrap = function() {};
            let Stats;
            exports.FSInitialize = function(s) {
                Stats = s;
            };
            async function access(path, mode) {
                const X = constants.S_IXUSR | constants.S_IXGRP | constants.S_IXOTH;
                const stats = await stat(path);
                if ((mode & constants.X_OK) !== 0 && (stats.mode & X) === 0) {
                    throw new ErrnoException(CODE_TO_ERRNO["EACCES"], "access", [ path, mode ]);
                }
            }
            exports.access = function(path, mode, req) {
                promiseToCallback(access(path, mode), getCallback(req));
            };
            function checkFd(fd, syscall, args) {
                if (!openFiles.has(fd)) {
                    throw new ErrnoException(CODE_TO_ERRNO["EBADF"], syscall, args);
                }
            }
            async function chmod(path, mode) {
                const fd = await open(path, 0, 0);
                await fchmod(fd, mode);
            }
            exports.chmod = function(path, mode, req) {
                promiseToCallback(chmod(path, mode), getCallback(req));
            };
            async function chown(path, uid, gid) {
                const fd = await open(path, 0, 0);
                await fchown(fd, uid, gid);
            }
            exports.chown = function(path, uid, gid, req) {
                promiseToCallback(chown(path, uid, gid), getCallback(req));
            };
            async function close(fd) {
                checkFd(fd, "node_ext2fs_close", [ fd ]);
                await ccallThrowAsync("node_ext2fs_close", "number", [ "number" ], [ fd ]);
                openFiles.delete(fd);
            }
            exports.close = function(fd, req) {
                promiseToCallback(close(fd), getCallback(req));
            };
            async function fchmod(fd, mode) {
                checkFd(fd, "node_ext2fs_chmod", [ fd, mode ]);
                await ccallThrowAsync("node_ext2fs_chmod", "number", [ "number", "number" ], [ fd, mode ]);
            }
            exports.fchmod = function(fd, mode, req) {
                promiseToCallback(fchmod(fd, mode), getCallback(req));
            };
            async function fchown(fd, uid, gid) {
                checkFd(fd, "node_ext2fs_chown", [ fd, uid, gid ]);
                await ccallThrowAsync("node_ext2fs_chown", "number", [ "number", "number", "number" ], [ fd, uid, gid ]);
            }
            exports.fchown = function(fd, uid, gid, req) {
                promiseToCallback(fchown(fd, uid, gid), getCallback(req));
            };
            exports.fdatasync = function() {
                throw new Error("Unimplemented");
            };
            function fstat(fd) {
                checkFd(fd, "fstat", [ fd ]);
                function getAttr(name) {
                    return ccallThrow(`node_ext2fs_stat_${name}`, "number", [ "number" ], [ fd ]);
                }
                const ctime = getAttr("i_ctime") * 1e3;
                return new Stats(0, getAttr("i_mode"), getAttr("i_links_count"), getAttr("i_uid"), getAttr("i_gid"), 0, getAttr("blocksize"), getAttr("ino"), getAttr("i_size"), getAttr("i_blocks"), getAttr("i_atime") * 1e3, getAttr("i_mtime") * 1e3, ctime, ctime);
            }
            exports.fstat = function(fd, req) {
                const callback = getCallback(req);
                try {
                    callback(null, fstat(fd));
                } catch (error) {
                    callback(error);
                }
            };
            exports.fsync = function() {
                throw new Error("Unimplemented");
            };
            exports.ftruncate = function() {
                throw new Error("Unimplemented");
            };
            exports.futimes = function() {
                throw new Error("Unimplemented");
            };
            exports.link = function() {
                throw new Error("Unimplemented");
            };
            exports.lstat = function() {
                throw new Error("Unimplemented");
            };
            async function mkdir(path, mode) {
                return await withPathAsHeapBuffer(path, (async heapBufferPointer => {
                    await ccallThrowAsync("node_ext2fs_mkdir", "number", [ "number", "number", "number" ], [ fsPointer, heapBufferPointer, mode ]);
                }));
            }
            exports.mkdir = function(path, mode, req) {
                promiseToCallback(mkdir(path, mode), getCallback(req));
            };
            exports.mkdtemp = function() {
                throw new Error("Unimplemented");
            };
            async function open(path, flags, mode) {
                return await withPathAsHeapBuffer(path, (async heapBufferPointer => {
                    const fd = await ccallThrowAsync("node_ext2fs_open", "number", [ "number", "number", "number", "number" ], [ fsPointer, heapBufferPointer, flags, mode ]);
                    openFiles.set(fd, flags);
                    return fd;
                }));
            }
            exports.open = function(path, flags, mode, req) {
                promiseToCallback(open(path, flags, mode), getCallback(req));
            };
            async function read(fd, buffer, offset, length, position) {
                checkFd(fd, "node_ext2fs_read", [ fd, buffer, offset, length, position ]);
                return await withHeapBuffer(length, (async (heapBuffer, heapBufferPointer) => {
                    const got = await ccallThrowAsync("node_ext2fs_read", "number", [ "number", "number", "number", "number", "number" ], [ fd, openFiles.get(fd), heapBufferPointer, length, position ]);
                    heapBuffer.copy(buffer, offset);
                    return got;
                }));
            }
            exports.read = function(fd, buffer, offset, length, position, req) {
                promiseToCallback(read(fd, buffer, offset, length, typeof position !== "number" ? -1 : position), getCallback(req));
            };
            async function readdir(path, encoding) {
                if (encoding === undefined) {
                    encoding = "utf8";
                }
                const array = [];
                await Module.withObjectId(array, (async arrayId => {
                    await withPathAsHeapBuffer(path, (async heapBufferPointer => {
                        await ccallThrowAsync("node_ext2fs_readdir", "number", [ "number", "number", "number" ], [ fsPointer, heapBufferPointer, arrayId ]);
                    }));
                }));
                if (encoding === "buffer") {
                    return array;
                } else {
                    return array.map((b => b.toString(encoding)));
                }
            }
            exports.readdir = function(path, encoding, req) {
                promiseToCallback(readdir(path, encoding), getCallback(req));
            };
            exports.readlink = function() {
                throw new Error("Unimplemented");
            };
            exports.rename = function() {
                throw new Error("Unimplemented");
            };
            async function unlink(path, isdir) {
                await withPathAsHeapBuffer(path, (async heapBufferPointer => {
                    await ccallThrowAsync("node_ext2fs_unlink", "number", [ "number", "number", "number" ], [ fsPointer, heapBufferPointer, isdir ]);
                }));
            }
            exports.rmdir = function(path, req) {
                promiseToCallback(unlink(path, 1), getCallback(req));
            };
            async function stat(path) {
                const fd = await open(path, "r", 0);
                const stats = await fstat(fd);
                await close(fd);
                return stats;
            }
            exports.stat = function(path, req) {
                promiseToCallback(stat(path), getCallback(req));
            };
            exports.StatWatcher = function() {
                throw new Error("Unimplemented");
            };
            exports.symlink = function() {
                throw new Error("Unimplemented");
            };
            exports.unlink = function(path, req) {
                promiseToCallback(unlink(path, 0), getCallback(req));
            };
            exports.utimes = function() {
                throw new Error("Unimplemented");
            };
            async function writeBuffer(fd, buffer, offset, length, position) {
                checkFd(fd, "node_ext2fs_write", [ fd, buffer, offset, length, position ]);
                return await withHeapBuffer(length, (async (heapBuffer, heapBufferPointer) => {
                    buffer.copy(heapBuffer, 0, offset, offset + length);
                    return await ccallThrowAsync("node_ext2fs_write", "number", [ "number", "number", "number", "number", "number" ], [ fd, openFiles.get(fd), heapBufferPointer, length, position ]);
                }));
            }
            exports.writeBuffer = function(fd, buffer, offset, length, position, req) {
                promiseToCallback(writeBuffer(fd, buffer, offset, length, typeof position !== "number" ? -1 : position), getCallback(req));
            };
            exports.writeBuffers = function() {
                throw new Error("Unimplemented");
            };
            exports.writeString = function(fd, string, position, enc, req) {
                const buffer = Buffer.from(string, enc);
                exports.writeBuffer(fd, buffer, 0, buffer.length, position, req);
            };
            exports.closeAllFileDescriptors = async function() {
                for (const fd of openFiles.keys()) {
                    await close(fd);
                }
            };
            return exports;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Module = typeof Module !== "undefined" ? Module : {};
        const objects = new Map;
        let nextId = 0;
        const idPool = [];
        function reserveId() {
            if (idPool.length === 0) {
                nextId += 1;
                idPool.push(nextId);
            }
            return idPool.shift();
        }
        function releaseId(id) {
            idPool.push(id);
        }
        function setObject(obj) {
            const id = reserveId();
            objects.set(id, obj);
            return id;
        }
        Module.setObject = setObject;
        function getObject(id) {
            return objects.get(id);
        }
        Module.getObject = getObject;
        function deleteObject(id) {
            objects.delete(id);
            releaseId(id);
        }
        Module.deleteObject = deleteObject;
        async function withObjectId(obj, fn) {
            const id = setObject(obj);
            try {
                return await fn(id);
            } finally {
                deleteObject(id);
            }
        }
        Module.withObjectId = withObjectId;
        function getBuffer(pointer, length) {
            return Buffer.from(Module.HEAP8.buffer, pointer, length);
        }
        Module.getBuffer = getBuffer;
        Module.EIO = 29;
        var moduleOverrides = {};
        var key;
        for (key in Module) {
            if (Module.hasOwnProperty(key)) {
                moduleOverrides[key] = Module[key];
            }
        }
        var arguments_ = [];
        var thisProgram = "./this.program";
        var quit_ = function(status, toThrow) {
            throw toThrow;
        };
        var ENVIRONMENT_IS_WEB = false;
        var ENVIRONMENT_IS_WORKER = false;
        var ENVIRONMENT_IS_NODE = false;
        var ENVIRONMENT_IS_SHELL = false;
        ENVIRONMENT_IS_WEB = typeof window === "object";
        ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
        ENVIRONMENT_IS_NODE = typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string";
        ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
        var scriptDirectory = "";
        function locateFile(path) {
            if (Module["locateFile"]) {
                return Module["locateFile"](path, scriptDirectory);
            }
            return scriptDirectory + path;
        }
        var read_, readAsync, readBinary, setWindowTitle;
        var nodeFS;
        var nodePath;
        if (ENVIRONMENT_IS_NODE) {
            if (ENVIRONMENT_IS_WORKER) {
                scriptDirectory = __webpack_require__(34).dirname(scriptDirectory) + "/";
            } else {
                const Path = __webpack_require__(34);
                let electron;
                try {
                    electron = __webpack_require__(46);
                } catch {}
                function appPath() {
                    return Path.isAbsolute(__dirname) ? __dirname : Path.join(electron.remote.app.getAppPath().replace(/\.asar$/, (() => process.platform === "darwin" ? "-" + process.arch : "")), "generated");
                }
                scriptDirectory = Path.join(appPath(), "modules", "ext2fs", "lib", "/");
            }
            read_ = function shell_read(filename, binary) {
                if (!nodeFS) nodeFS = __webpack_require__(5);
                if (!nodePath) nodePath = __webpack_require__(34);
                filename = nodePath["normalize"](filename);
                return nodeFS["readFileSync"](filename, binary ? null : "utf8");
            };
            readBinary = function readBinary(filename) {
                var ret = read_(filename, true);
                if (!ret.buffer) {
                    ret = new Uint8Array(ret);
                }
                assert(ret.buffer);
                return ret;
            };
            if (process["argv"].length > 1) {
                thisProgram = process["argv"][1].replace(/\\/g, "/");
            }
            arguments_ = process["argv"].slice(2);
            if (true) {
                module["exports"] = Module;
            }
            process["on"]("uncaughtException", (function(ex) {
                if (!(ex instanceof ExitStatus)) {
                    throw ex;
                }
            }));
            process["on"]("unhandledRejection", abort);
            quit_ = function(status) {
                process["exit"](status);
            };
            Module["inspect"] = function() {
                return "[Emscripten Module object]";
            };
        } else if (ENVIRONMENT_IS_SHELL) {
            if (typeof read != "undefined") {
                read_ = function shell_read(f) {
                    return read(f);
                };
            }
            readBinary = function readBinary(f) {
                var data;
                if (typeof readbuffer === "function") {
                    return new Uint8Array(readbuffer(f));
                }
                data = read(f, "binary");
                assert(typeof data === "object");
                return data;
            };
            if (typeof scriptArgs != "undefined") {
                arguments_ = scriptArgs;
            } else if (typeof arguments != "undefined") {
                arguments_ = arguments;
            }
            if (typeof quit === "function") {
                quit_ = function(status) {
                    quit(status);
                };
            }
            if (typeof print !== "undefined") {
                if (typeof console === "undefined") console = {};
                console.log = print;
                console.warn = console.error = typeof printErr !== "undefined" ? printErr : print;
            }
        } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
            if (ENVIRONMENT_IS_WORKER) {
                scriptDirectory = self.location.href;
            } else if (document.currentScript) {
                scriptDirectory = document.currentScript.src;
            }
            if (scriptDirectory.indexOf("blob:") !== 0) {
                scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1);
            } else {
                scriptDirectory = "";
            }
            {
                read_ = function shell_read(url) {
                    var xhr = new XMLHttpRequest;
                    xhr.open("GET", url, false);
                    xhr.send(null);
                    return xhr.responseText;
                };
                if (ENVIRONMENT_IS_WORKER) {
                    readBinary = function readBinary(url) {
                        var xhr = new XMLHttpRequest;
                        xhr.open("GET", url, false);
                        xhr.responseType = "arraybuffer";
                        xhr.send(null);
                        return new Uint8Array(xhr.response);
                    };
                }
                readAsync = function readAsync(url, onload, onerror) {
                    var xhr = new XMLHttpRequest;
                    xhr.open("GET", url, true);
                    xhr.responseType = "arraybuffer";
                    xhr.onload = function xhr_onload() {
                        if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
                            onload(xhr.response);
                            return;
                        }
                        onerror();
                    };
                    xhr.onerror = onerror;
                    xhr.send(null);
                };
            }
            setWindowTitle = function(title) {
                document.title = title;
            };
        } else {}
        var out = Module["print"] || console.log.bind(console);
        var err = Module["printErr"] || console.warn.bind(console);
        for (key in moduleOverrides) {
            if (moduleOverrides.hasOwnProperty(key)) {
                Module[key] = moduleOverrides[key];
            }
        }
        moduleOverrides = null;
        if (Module["arguments"]) arguments_ = Module["arguments"];
        if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
        if (Module["quit"]) quit_ = Module["quit"];
        var STACK_ALIGN = 16;
        function alignMemory(size, factor) {
            if (!factor) factor = STACK_ALIGN;
            return Math.ceil(size / factor) * factor;
        }
        var tempRet0 = 0;
        var setTempRet0 = function(value) {
            tempRet0 = value;
        };
        var wasmBinary;
        if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
        var noExitRuntime;
        if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
        if (typeof WebAssembly !== "object") {
            abort("no native wasm support detected");
        }
        var wasmMemory;
        var wasmTable;
        var ABORT = false;
        var EXITSTATUS = 0;
        function assert(condition, text) {
            if (!condition) {
                abort("Assertion failed: " + text);
            }
        }
        function getCFunc(ident) {
            var func = Module["_" + ident];
            assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");
            return func;
        }
        function ccall(ident, returnType, argTypes, args, opts) {
            var toC = {
                string: function(str) {
                    var ret = 0;
                    if (str !== null && str !== undefined && str !== 0) {
                        var len = (str.length << 2) + 1;
                        ret = stackAlloc(len);
                        stringToUTF8(str, ret, len);
                    }
                    return ret;
                },
                array: function(arr) {
                    var ret = stackAlloc(arr.length);
                    writeArrayToMemory(arr, ret);
                    return ret;
                }
            };
            function convertReturnValue(ret) {
                if (returnType === "string") return UTF8ToString(ret);
                if (returnType === "boolean") return Boolean(ret);
                return ret;
            }
            var func = getCFunc(ident);
            var cArgs = [];
            var stack = 0;
            if (args) {
                for (var i = 0; i < args.length; i++) {
                    var converter = toC[argTypes[i]];
                    if (converter) {
                        if (stack === 0) stack = stackSave();
                        cArgs[i] = converter(args[i]);
                    } else {
                        cArgs[i] = args[i];
                    }
                }
            }
            var ret = func.apply(null, cArgs);
            var asyncMode = opts && opts.async;
            var runningAsync = typeof Asyncify === "object" && Asyncify.currData;
            var prevRunningAsync = typeof Asyncify === "object" && Asyncify.asyncFinalizers.length > 0;
            if (runningAsync && !prevRunningAsync) {
                return new Promise((function(resolve) {
                    Asyncify.asyncFinalizers.push((function(ret) {
                        if (stack !== 0) stackRestore(stack);
                        resolve(convertReturnValue(ret));
                    }));
                }));
            }
            ret = convertReturnValue(ret);
            if (stack !== 0) stackRestore(stack);
            if (opts && opts.async) return Promise.resolve(ret);
            return ret;
        }
        var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;
        function UTF8ArrayToString(heap, idx, maxBytesToRead) {
            var endIdx = idx + maxBytesToRead;
            var endPtr = idx;
            while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr;
            if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) {
                return UTF8Decoder.decode(heap.subarray(idx, endPtr));
            } else {
                var str = "";
                while (idx < endPtr) {
                    var u0 = heap[idx++];
                    if (!(u0 & 128)) {
                        str += String.fromCharCode(u0);
                        continue;
                    }
                    var u1 = heap[idx++] & 63;
                    if ((u0 & 224) == 192) {
                        str += String.fromCharCode((u0 & 31) << 6 | u1);
                        continue;
                    }
                    var u2 = heap[idx++] & 63;
                    if ((u0 & 240) == 224) {
                        u0 = (u0 & 15) << 12 | u1 << 6 | u2;
                    } else {
                        u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63;
                    }
                    if (u0 < 65536) {
                        str += String.fromCharCode(u0);
                    } else {
                        var ch = u0 - 65536;
                        str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
                    }
                }
            }
            return str;
        }
        function UTF8ToString(ptr, maxBytesToRead) {
            return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
        }
        function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
            if (!(maxBytesToWrite > 0)) return 0;
            var startIdx = outIdx;
            var endIdx = outIdx + maxBytesToWrite - 1;
            for (var i = 0; i < str.length; ++i) {
                var u = str.charCodeAt(i);
                if (u >= 55296 && u <= 57343) {
                    var u1 = str.charCodeAt(++i);
                    u = 65536 + ((u & 1023) << 10) | u1 & 1023;
                }
                if (u <= 127) {
                    if (outIdx >= endIdx) break;
                    heap[outIdx++] = u;
                } else if (u <= 2047) {
                    if (outIdx + 1 >= endIdx) break;
                    heap[outIdx++] = 192 | u >> 6;
                    heap[outIdx++] = 128 | u & 63;
                } else if (u <= 65535) {
                    if (outIdx + 2 >= endIdx) break;
                    heap[outIdx++] = 224 | u >> 12;
                    heap[outIdx++] = 128 | u >> 6 & 63;
                    heap[outIdx++] = 128 | u & 63;
                } else {
                    if (outIdx + 3 >= endIdx) break;
                    heap[outIdx++] = 240 | u >> 18;
                    heap[outIdx++] = 128 | u >> 12 & 63;
                    heap[outIdx++] = 128 | u >> 6 & 63;
                    heap[outIdx++] = 128 | u & 63;
                }
            }
            heap[outIdx] = 0;
            return outIdx - startIdx;
        }
        function stringToUTF8(str, outPtr, maxBytesToWrite) {
            return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
        }
        function lengthBytesUTF8(str) {
            var len = 0;
            for (var i = 0; i < str.length; ++i) {
                var u = str.charCodeAt(i);
                if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023;
                if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4;
            }
            return len;
        }
        function writeArrayToMemory(array, buffer) {
            HEAP8.set(array, buffer);
        }
        function writeAsciiToMemory(str, buffer, dontAddNull) {
            for (var i = 0; i < str.length; ++i) {
                HEAP8[buffer++ >> 0] = str.charCodeAt(i);
            }
            if (!dontAddNull) HEAP8[buffer >> 0] = 0;
        }
        var WASM_PAGE_SIZE = 65536;
        var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
        function updateGlobalBufferAndViews(buf) {
            buffer = buf;
            Module["HEAP8"] = HEAP8 = new Int8Array(buf);
            Module["HEAP16"] = HEAP16 = new Int16Array(buf);
            Module["HEAP32"] = HEAP32 = new Int32Array(buf);
            Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
            Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);
            Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
            Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);
            Module["HEAPF64"] = HEAPF64 = new Float64Array(buf);
        }
        var INITIAL_INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
        if (Module["wasmMemory"]) {
            wasmMemory = Module["wasmMemory"];
        } else {
            wasmMemory = new WebAssembly.Memory({
                initial: INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE,
                maximum: INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE
            });
        }
        if (wasmMemory) {
            buffer = wasmMemory.buffer;
        }
        INITIAL_INITIAL_MEMORY = buffer.byteLength;
        updateGlobalBufferAndViews(buffer);
        var __ATPRERUN__ = [];
        var __ATINIT__ = [];
        var __ATMAIN__ = [];
        var __ATPOSTRUN__ = [];
        var runtimeInitialized = false;
        function preRun() {
            if (Module["preRun"]) {
                if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ];
                while (Module["preRun"].length) {
                    addOnPreRun(Module["preRun"].shift());
                }
            }
            callRuntimeCallbacks(__ATPRERUN__);
        }
        function initRuntime() {
            runtimeInitialized = true;
            if (!Module["noFSInit"] && !FS.init.initialized) FS.init();
            TTY.init();
            callRuntimeCallbacks(__ATINIT__);
        }
        function preMain() {
            FS.ignorePermissions = false;
            callRuntimeCallbacks(__ATMAIN__);
        }
        function postRun() {
            if (Module["postRun"]) {
                if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ];
                while (Module["postRun"].length) {
                    addOnPostRun(Module["postRun"].shift());
                }
            }
            callRuntimeCallbacks(__ATPOSTRUN__);
        }
        function addOnPreRun(cb) {
            __ATPRERUN__.unshift(cb);
        }
        function addOnPostRun(cb) {
            __ATPOSTRUN__.unshift(cb);
        }
        var runDependencies = 0;
        var runDependencyWatcher = null;
        var dependenciesFulfilled = null;
        function getUniqueRunDependency(id) {
            return id;
        }
        function addRunDependency(id) {
            runDependencies++;
            if (Module["monitorRunDependencies"]) {
                Module["monitorRunDependencies"](runDependencies);
            }
        }
        function removeRunDependency(id) {
            runDependencies--;
            if (Module["monitorRunDependencies"]) {
                Module["monitorRunDependencies"](runDependencies);
            }
            if (runDependencies == 0) {
                if (runDependencyWatcher !== null) {
                    clearInterval(runDependencyWatcher);
                    runDependencyWatcher = null;
                }
                if (dependenciesFulfilled) {
                    var callback = dependenciesFulfilled;
                    dependenciesFulfilled = null;
                    callback();
                }
            }
        }
        Module["preloadedImages"] = {};
        Module["preloadedAudios"] = {};
        function abort(what) {
            if (Module["onAbort"]) {
                Module["onAbort"](what);
            }
            what += "";
            err(what);
            ABORT = true;
            EXITSTATUS = 1;
            what = "abort(" + what + "). Build with -s ASSERTIONS=1 for more info.";
            var e = new WebAssembly.RuntimeError(what);
            throw e;
        }
        function hasPrefix(str, prefix) {
            return String.prototype.startsWith ? str.startsWith(prefix) : str.indexOf(prefix) === 0;
        }
        var dataURIPrefix = "data:application/octet-stream;base64,";
        function isDataURI(filename) {
            return hasPrefix(filename, dataURIPrefix);
        }
        var fileURIPrefix = "file://";
        function isFileURI(filename) {
            return hasPrefix(filename, fileURIPrefix);
        }
        var wasmBinaryFile = "libext2fs.wasm";
        if (!isDataURI(wasmBinaryFile)) {
            wasmBinaryFile = locateFile(wasmBinaryFile);
        }
        function getBinary() {
            try {
                if (wasmBinary) {
                    return new Uint8Array(wasmBinary);
                }
                if (readBinary) {
                    return readBinary(wasmBinaryFile);
                } else {
                    throw "both async and sync fetching of the wasm failed";
                }
            } catch (err) {
                abort(err);
            }
        }
        function getBinaryPromise() {
            if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === "function" && !isFileURI(wasmBinaryFile)) {
                return fetch(wasmBinaryFile, {
                    credentials: "same-origin"
                }).then((function(response) {
                    if (!response["ok"]) {
                        throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
                    }
                    return response["arrayBuffer"]();
                })).catch((function() {
                    return getBinary();
                }));
            }
            return Promise.resolve().then(getBinary);
        }
        function createWasm() {
            var info = {
                a: asmLibraryArg
            };
            function receiveInstance(instance, module) {
                var exports = instance.exports;
                exports = Asyncify.instrumentWasmExports(exports);
                Module["asm"] = exports;
                wasmTable = Module["asm"]["B"];
                removeRunDependency("wasm-instantiate");
            }
            addRunDependency("wasm-instantiate");
            function receiveInstantiatedSource(output) {
                receiveInstance(output["instance"]);
            }
            function instantiateArrayBuffer(receiver) {
                return getBinaryPromise().then((function(binary) {
                    return WebAssembly.instantiate(binary, info);
                })).then(receiver, (function(reason) {
                    err("failed to asynchronously prepare wasm: " + reason);
                    abort(reason);
                }));
            }
            function instantiateAsync() {
                if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch === "function") {
                    fetch(wasmBinaryFile, {
                        credentials: "same-origin"
                    }).then((function(response) {
                        var result = WebAssembly.instantiateStreaming(response, info);
                        return result.then(receiveInstantiatedSource, (function(reason) {
                            err("wasm streaming compile failed: " + reason);
                            err("falling back to ArrayBuffer instantiation");
                            return instantiateArrayBuffer(receiveInstantiatedSource);
                        }));
                    }));
                } else {
                    return instantiateArrayBuffer(receiveInstantiatedSource);
                }
            }
            if (Module["instantiateWasm"]) {
                try {
                    var exports = Module["instantiateWasm"](info, receiveInstance);
                    exports = Asyncify.instrumentWasmExports(exports);
                    return exports;
                } catch (e) {
                    err("Module.instantiateWasm callback failed with error: " + e);
                    return false;
                }
            }
            instantiateAsync();
            return {};
        }
        var tempDouble;
        var tempI64;
        function array_push_buffer(array_id, value, len) {
            const heapBuffer = Module.getBuffer(value, len);
            const buffer = Buffer.alloc(len);
            heapBuffer.copy(buffer);
            Module.getObject(array_id).push(buffer);
        }
        function blk_read(disk_id, block_size, block, count, data) {
            return Asyncify.handleAsync((async () => {
                const offset = block * block_size;
                const size = count < 0 ? -count : count * block_size;
                const buffer = Module.getBuffer(data, size);
                const disk = Module.getObject(disk_id);
                try {
                    await disk.read(buffer, 0, buffer.length, offset);
                    return 0;
                } catch (error) {
                    return Module.EIO;
                }
            }));
        }
        function blk_write(disk_id, block_size, block, count, data) {
            return Asyncify.handleAsync((async () => {
                const offset = block * block_size;
                const size = count < 0 ? -count : count * block_size;
                const buffer = Module.getBuffer(data, size);
                const disk = Module.getObject(disk_id);
                try {
                    await disk.write(buffer, 0, buffer.length, offset);
                    return 0;
                } catch (error) {
                    return Module.EIO;
                }
            }));
        }
        function discard(disk_id, block_size, block, count) {
            return Asyncify.handleAsync((async () => {
                const disk = Module.getObject(disk_id);
                const offset = block * block_size;
                const size = count < 0 ? -count : count * block_size;
                try {
                    await disk.discard(offset, size);
                    return 0;
                } catch (error) {
                    return Module.EIO;
                }
            }));
        }
        function flush(disk_id) {
            return Asyncify.handleAsync((async () => {
                const disk = Module.getObject(disk_id);
                try {
                    await disk.flush();
                    return 0;
                } catch (error) {
                    return Module.EIO;
                }
            }));
        }
        function callRuntimeCallbacks(callbacks) {
            while (callbacks.length > 0) {
                var callback = callbacks.shift();
                if (typeof callback == "function") {
                    callback(Module);
                    continue;
                }
                var func = callback.func;
                if (typeof func === "number") {
                    if (callback.arg === undefined) {
                        getDynCaller("v", func)();
                    } else {
                        getDynCaller("vi", func)(callback.arg);
                    }
                } else {
                    func(callback.arg === undefined ? null : callback.arg);
                }
            }
        }
        function demangle(func) {
            return func;
        }
        function demangleAll(text) {
            var regex = /\b_Z[\w\d_]+/g;
            return text.replace(regex, (function(x) {
                var y = demangle(x);
                return x === y ? x : y + " [" + x + "]";
            }));
        }
        function dynCallLegacy(sig, ptr, args) {
            if (args && args.length) {
                return Module["dynCall_" + sig].apply(null, [ ptr ].concat(args));
            }
            return Module["dynCall_" + sig].call(null, ptr);
        }
        function dynCall(sig, ptr, args) {
            return dynCallLegacy(sig, ptr, args);
        }
        function getDynCaller(sig, ptr) {
            var argCache = [];
            return function() {
                argCache.length = arguments.length;
                for (var i = 0; i < arguments.length; i++) {
                    argCache[i] = arguments[i];
                }
                return dynCall(sig, ptr, argCache);
            };
        }
        function jsStackTrace() {
            var error = new Error;
            if (!error.stack) {
                try {
                    throw new Error;
                } catch (e) {
                    error = e;
                }
                if (!error.stack) {
                    return "(no stack trace available)";
                }
            }
            return error.stack.toString();
        }
        function stackTrace() {
            var js = jsStackTrace();
            if (Module["extraStackTrace"]) js += "\n" + Module["extraStackTrace"]();
            return demangleAll(js);
        }
        var PATH = {
            splitPath: function(filename) {
                var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
                return splitPathRe.exec(filename).slice(1);
            },
            normalizeArray: function(parts, allowAboveRoot) {
                var up = 0;
                for (var i = parts.length - 1; i >= 0; i--) {
                    var last = parts[i];
                    if (last === ".") {
                        parts.splice(i, 1);
                    } else if (last === "..") {
                        parts.splice(i, 1);
                        up++;
                    } else if (up) {
                        parts.splice(i, 1);
                        up--;
                    }
                }
                if (allowAboveRoot) {
                    for (;up; up--) {
                        parts.unshift("..");
                    }
                }
                return parts;
            },
            normalize: function(path) {
                var isAbsolute = path.charAt(0) === "/", trailingSlash = path.substr(-1) === "/";
                path = PATH.normalizeArray(path.split("/").filter((function(p) {
                    return !!p;
                })), !isAbsolute).join("/");
                if (!path && !isAbsolute) {
                    path = ".";
                }
                if (path && trailingSlash) {
                    path += "/";
                }
                return (isAbsolute ? "/" : "") + path;
            },
            dirname: function(path) {
                var result = PATH.splitPath(path), root = result[0], dir = result[1];
                if (!root && !dir) {
                    return ".";
                }
                if (dir) {
                    dir = dir.substr(0, dir.length - 1);
                }
                return root + dir;
            },
            basename: function(path) {
                if (path === "/") return "/";
                path = PATH.normalize(path);
                path = path.replace(/\/$/, "");
                var lastSlash = path.lastIndexOf("/");
                if (lastSlash === -1) return path;
                return path.substr(lastSlash + 1);
            },
            extname: function(path) {
                return PATH.splitPath(path)[3];
            },
            join: function() {
                var paths = Array.prototype.slice.call(arguments, 0);
                return PATH.normalize(paths.join("/"));
            },
            join2: function(l, r) {
                return PATH.normalize(l + "/" + r);
            }
        };
        function setErrNo(value) {
            HEAP32[___errno_location() >> 2] = value;
            return value;
        }
        function getRandomDevice() {
            if (typeof crypto === "object" && typeof crypto["getRandomValues"] === "function") {
                var randomBuffer = new Uint8Array(1);
                return function() {
                    crypto.getRandomValues(randomBuffer);
                    return randomBuffer[0];
                };
            } else if (ENVIRONMENT_IS_NODE) {
                try {
                    var crypto_module = __webpack_require__(35);
                    return function() {
                        return crypto_module["randomBytes"](1)[0];
                    };
                } catch (e) {}
            }
            return function() {
                abort("randomDevice");
            };
        }
        var PATH_FS = {
            resolve: function() {
                var resolvedPath = "", resolvedAbsolute = false;
                for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
                    var path = i >= 0 ? arguments[i] : FS.cwd();
                    if (typeof path !== "string") {
                        throw new TypeError("Arguments to path.resolve must be strings");
                    } else if (!path) {
                        return "";
                    }
                    resolvedPath = path + "/" + resolvedPath;
                    resolvedAbsolute = path.charAt(0) === "/";
                }
                resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter((function(p) {
                    return !!p;
                })), !resolvedAbsolute).join("/");
                return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
            },
            relative: function(from, to) {
                from = PATH_FS.resolve(from).substr(1);
                to = PATH_FS.resolve(to).substr(1);
                function trim(arr) {
                    var start = 0;
                    for (;start < arr.length; start++) {
                        if (arr[start] !== "") break;
                    }
                    var end = arr.length - 1;
                    for (;end >= 0; end--) {
                        if (arr[end] !== "") break;
                    }
                    if (start > end) return [];
                    return arr.slice(start, end - start + 1);
                }
                var fromParts = trim(from.split("/"));
                var toParts = trim(to.split("/"));
                var length = Math.min(fromParts.length, toParts.length);
                var samePartsLength = length;
                for (var i = 0; i < length; i++) {
                    if (fromParts[i] !== toParts[i]) {
                        samePartsLength = i;
                        break;
                    }
                }
                var outputParts = [];
                for (var i = samePartsLength; i < fromParts.length; i++) {
                    outputParts.push("..");
                }
                outputParts = outputParts.concat(toParts.slice(samePartsLength));
                return outputParts.join("/");
            }
        };
        var TTY = {
            ttys: [],
            init: function() {},
            shutdown: function() {},
            register: function(dev, ops) {
                TTY.ttys[dev] = {
                    input: [],
                    output: [],
                    ops
                };
                FS.registerDevice(dev, TTY.stream_ops);
            },
            stream_ops: {
                open: function(stream) {
                    var tty = TTY.ttys[stream.node.rdev];
                    if (!tty) {
                        throw new FS.ErrnoError(43);
                    }
                    stream.tty = tty;
                    stream.seekable = false;
                },
                close: function(stream) {
                    stream.tty.ops.flush(stream.tty);
                },
                flush: function(stream) {
                    stream.tty.ops.flush(stream.tty);
                },
                read: function(stream, buffer, offset, length, pos) {
                    if (!stream.tty || !stream.tty.ops.get_char) {
                        throw new FS.ErrnoError(60);
                    }
                    var bytesRead = 0;
                    for (var i = 0; i < length; i++) {
                        var result;
                        try {
                            result = stream.tty.ops.get_char(stream.tty);
                        } catch (e) {
                            throw new FS.ErrnoError(29);
                        }
                        if (result === undefined && bytesRead === 0) {
                            throw new FS.ErrnoError(6);
                        }
                        if (result === null || result === undefined) break;
                        bytesRead++;
                        buffer[offset + i] = result;
                    }
                    if (bytesRead) {
                        stream.node.timestamp = Date.now();
                    }
                    return bytesRead;
                },
                write: function(stream, buffer, offset, length, pos) {
                    if (!stream.tty || !stream.tty.ops.put_char) {
                        throw new FS.ErrnoError(60);
                    }
                    try {
                        for (var i = 0; i < length; i++) {
                            stream.tty.ops.put_char(stream.tty, buffer[offset + i]);
                        }
                    } catch (e) {
                        throw new FS.ErrnoError(29);
                    }
                    if (length) {
                        stream.node.timestamp = Date.now();
                    }
                    return i;
                }
            },
            default_tty_ops: {
                get_char: function(tty) {
                    if (!tty.input.length) {
                        var result = null;
                        if (ENVIRONMENT_IS_NODE) {
                            var BUFSIZE = 256;
                            var buf = Buffer.alloc ? Buffer.alloc(BUFSIZE) : new Buffer(BUFSIZE);
                            var bytesRead = 0;
                            try {
                                bytesRead = nodeFS.readSync(process.stdin.fd, buf, 0, BUFSIZE, null);
                            } catch (e) {
                                if (e.toString().indexOf("EOF") != -1) bytesRead = 0; else throw e;
                            }
                            if (bytesRead > 0) {
                                result = buf.slice(0, bytesRead).toString("utf-8");
                            } else {
                                result = null;
                            }
                        } else if (typeof window != "undefined" && typeof window.prompt == "function") {
                            result = window.prompt("Input: ");
                            if (result !== null) {
                                result += "\n";
                            }
                        } else if (typeof readline == "function") {
                            result = readline();
                            if (result !== null) {
                                result += "\n";
                            }
                        }
                        if (!result) {
                            return null;
                        }
                        tty.input = intArrayFromString(result, true);
                    }
                    return tty.input.shift();
                },
                put_char: function(tty, val) {
                    if (val === null || val === 10) {
                        out(UTF8ArrayToString(tty.output, 0));
                        tty.output = [];
                    } else {
                        if (val != 0) tty.output.push(val);
                    }
                },
                flush: function(tty) {
                    if (tty.output && tty.output.length > 0) {
                        out(UTF8ArrayToString(tty.output, 0));
                        tty.output = [];
                    }
                }
            },
            default_tty1_ops: {
                put_char: function(tty, val) {
                    if (val === null || val === 10) {
                        err(UTF8ArrayToString(tty.output, 0));
                        tty.output = [];
                    } else {
                        if (val != 0) tty.output.push(val);
                    }
                },
                flush: function(tty) {
                    if (tty.output && tty.output.length > 0) {
                        err(UTF8ArrayToString(tty.output, 0));
                        tty.output = [];
                    }
                }
            }
        };
        function mmapAlloc(size) {
            var alignedSize = alignMemory(size, 16384);
            var ptr = _malloc(alignedSize);
            while (size < alignedSize) HEAP8[ptr + size++] = 0;
            return ptr;
        }
        var MEMFS = {
            ops_table: null,
            mount: function(mount) {
                return MEMFS.createNode(null, "/", 16384 | 511, 0);
            },
            createNode: function(parent, name, mode, dev) {
                if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
                    throw new FS.ErrnoError(63);
                }
                if (!MEMFS.ops_table) {
                    MEMFS.ops_table = {
                        dir: {
                            node: {
                                getattr: MEMFS.node_ops.getattr,
                                setattr: MEMFS.node_ops.setattr,
                                lookup: MEMFS.node_ops.lookup,
                                mknod: MEMFS.node_ops.mknod,
                                rename: MEMFS.node_ops.rename,
                                unlink: MEMFS.node_ops.unlink,
                                rmdir: MEMFS.node_ops.rmdir,
                                readdir: MEMFS.node_ops.readdir,
                                symlink: MEMFS.node_ops.symlink
                            },
                            stream: {
                                llseek: MEMFS.stream_ops.llseek
                            }
                        },
                        file: {
                            node: {
                                getattr: MEMFS.node_ops.getattr,
                                setattr: MEMFS.node_ops.setattr
                            },
                            stream: {
                                llseek: MEMFS.stream_ops.llseek,
                                read: MEMFS.stream_ops.read,
                                write: MEMFS.stream_ops.write,
                                allocate: MEMFS.stream_ops.allocate,
                                mmap: MEMFS.stream_ops.mmap,
                                msync: MEMFS.stream_ops.msync
                            }
                        },
                        link: {
                            node: {
                                getattr: MEMFS.node_ops.getattr,
                                setattr: MEMFS.node_ops.setattr,
                                readlink: MEMFS.node_ops.readlink
                            },
                            stream: {}
                        },
                        chrdev: {
                            node: {
                                getattr: MEMFS.node_ops.getattr,
                                setattr: MEMFS.node_ops.setattr
                            },
                            stream: FS.chrdev_stream_ops
                        }
                    };
                }
                var node = FS.createNode(parent, name, mode, dev);
                if (FS.isDir(node.mode)) {
                    node.node_ops = MEMFS.ops_table.dir.node;
                    node.stream_ops = MEMFS.ops_table.dir.stream;
                    node.contents = {};
                } else if (FS.isFile(node.mode)) {
                    node.node_ops = MEMFS.ops_table.file.node;
                    node.stream_ops = MEMFS.ops_table.file.stream;
                    node.usedBytes = 0;
                    node.contents = null;
                } else if (FS.isLink(node.mode)) {
                    node.node_ops = MEMFS.ops_table.link.node;
                    node.stream_ops = MEMFS.ops_table.link.stream;
                } else if (FS.isChrdev(node.mode)) {
                    node.node_ops = MEMFS.ops_table.chrdev.node;
                    node.stream_ops = MEMFS.ops_table.chrdev.stream;
                }
                node.timestamp = Date.now();
                if (parent) {
                    parent.contents[name] = node;
                }
                return node;
            },
            getFileDataAsRegularArray: function(node) {
                if (node.contents && node.contents.subarray) {
                    var arr = [];
                    for (var i = 0; i < node.usedBytes; ++i) arr.push(node.contents[i]);
                    return arr;
                }
                return node.contents;
            },
            getFileDataAsTypedArray: function(node) {
                if (!node.contents) return new Uint8Array(0);
                if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes);
                return new Uint8Array(node.contents);
            },
            expandFileStorage: function(node, newCapacity) {
                var prevCapacity = node.contents ? node.contents.length : 0;
                if (prevCapacity >= newCapacity) return;
                var CAPACITY_DOUBLING_MAX = 1024 * 1024;
                newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0);
                if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256);
                var oldContents = node.contents;
                node.contents = new Uint8Array(newCapacity);
                if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
                return;
            },
            resizeFileStorage: function(node, newSize) {
                if (node.usedBytes == newSize) return;
                if (newSize == 0) {
                    node.contents = null;
                    node.usedBytes = 0;
                    return;
                }
                if (!node.contents || node.contents.subarray) {
                    var oldContents = node.contents;
                    node.contents = new Uint8Array(newSize);
                    if (oldContents) {
                        node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes)));
                    }
                    node.usedBytes = newSize;
                    return;
                }
                if (!node.contents) node.contents = [];
                if (node.contents.length > newSize) node.contents.length = newSize; else while (node.contents.length < newSize) node.contents.push(0);
                node.usedBytes = newSize;
            },
            node_ops: {
                getattr: function(node) {
                    var attr = {};
                    attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
                    attr.ino = node.id;
                    attr.mode = node.mode;
                    attr.nlink = 1;
                    attr.uid = 0;
                    attr.gid = 0;
                    attr.rdev = node.rdev;
                    if (FS.isDir(node.mode)) {
                        attr.size = 4096;
                    } else if (FS.isFile(node.mode)) {
                        attr.size = node.usedBytes;
                    } else if (FS.isLink(node.mode)) {
                        attr.size = node.link.length;
                    } else {
                        attr.size = 0;
                    }
                    attr.atime = new Date(node.timestamp);
                    attr.mtime = new Date(node.timestamp);
                    attr.ctime = new Date(node.timestamp);
                    attr.blksize = 4096;
                    attr.blocks = Math.ceil(attr.size / attr.blksize);
                    return attr;
                },
                setattr: function(node, attr) {
                    if (attr.mode !== undefined) {
                        node.mode = attr.mode;
                    }
                    if (attr.timestamp !== undefined) {
                        node.timestamp = attr.timestamp;
                    }
                    if (attr.size !== undefined) {
                        MEMFS.resizeFileStorage(node, attr.size);
                    }
                },
                lookup: function(parent, name) {
                    throw FS.genericErrors[44];
                },
                mknod: function(parent, name, mode, dev) {
                    return MEMFS.createNode(parent, name, mode, dev);
                },
                rename: function(old_node, new_dir, new_name) {
                    if (FS.isDir(old_node.mode)) {
                        var new_node;
                        try {
                            new_node = FS.lookupNode(new_dir, new_name);
                        } catch (e) {}
                        if (new_node) {
                            for (var i in new_node.contents) {
                                throw new FS.ErrnoError(55);
                            }
                        }
                    }
                    delete old_node.parent.contents[old_node.name];
                    old_node.name = new_name;
                    new_dir.contents[new_name] = old_node;
                    old_node.parent = new_dir;
                },
                unlink: function(parent, name) {
                    delete parent.contents[name];
                },
                rmdir: function(parent, name) {
                    var node = FS.lookupNode(parent, name);
                    for (var i in node.contents) {
                        throw new FS.ErrnoError(55);
                    }
                    delete parent.contents[name];
                },
                readdir: function(node) {
                    var entries = [ ".", ".." ];
                    for (var key in node.contents) {
                        if (!node.contents.hasOwnProperty(key)) {
                            continue;
                        }
                        entries.push(key);
                    }
                    return entries;
                },
                symlink: function(parent, newname, oldpath) {
                    var node = MEMFS.createNode(parent, newname, 511 | 40960, 0);
                    node.link = oldpath;
                    return node;
                },
                readlink: function(node) {
                    if (!FS.isLink(node.mode)) {
                        throw new FS.ErrnoError(28);
                    }
                    return node.link;
                }
            },
            stream_ops: {
                read: function(stream, buffer, offset, length, position) {
                    var contents = stream.node.contents;
                    if (position >= stream.node.usedBytes) return 0;
                    var size = Math.min(stream.node.usedBytes - position, length);
                    if (size > 8 && contents.subarray) {
                        buffer.set(contents.subarray(position, position + size), offset);
                    } else {
                        for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
                    }
                    return size;
                },
                write: function(stream, buffer, offset, length, position, canOwn) {
                    if (!length) return 0;
                    var node = stream.node;
                    node.timestamp = Date.now();
                    if (buffer.subarray && (!node.contents || node.contents.subarray)) {
                        if (canOwn) {
                            node.contents = buffer.subarray(offset, offset + length);
                            node.usedBytes = length;
                            return length;
                        } else if (node.usedBytes === 0 && position === 0) {
                            node.contents = buffer.slice(offset, offset + length);
                            node.usedBytes = length;
                            return length;
                        } else if (position + length <= node.usedBytes) {
                            node.contents.set(buffer.subarray(offset, offset + length), position);
                            return length;
                        }
                    }
                    MEMFS.expandFileStorage(node, position + length);
                    if (node.contents.subarray && buffer.subarray) {
                        node.contents.set(buffer.subarray(offset, offset + length), position);
                    } else {
                        for (var i = 0; i < length; i++) {
                            node.contents[position + i] = buffer[offset + i];
                        }
                    }
                    node.usedBytes = Math.max(node.usedBytes, position + length);
                    return length;
                },
                llseek: function(stream, offset, whence) {
                    var position = offset;
                    if (whence === 1) {
                        position += stream.position;
                    } else if (whence === 2) {
                        if (FS.isFile(stream.node.mode)) {
                            position += stream.node.usedBytes;
                        }
                    }
                    if (position < 0) {
                        throw new FS.ErrnoError(28);
                    }
                    return position;
                },
                allocate: function(stream, offset, length) {
                    MEMFS.expandFileStorage(stream.node, offset + length);
                    stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length);
                },
                mmap: function(stream, address, length, position, prot, flags) {
                    assert(address === 0);
                    if (!FS.isFile(stream.node.mode)) {
                        throw new FS.ErrnoError(43);
                    }
                    var ptr;
                    var allocated;
                    var contents = stream.node.contents;
                    if (!(flags & 2) && contents.buffer === buffer) {
                        allocated = false;
                        ptr = contents.byteOffset;
                    } else {
                        if (position > 0 || position + length < contents.length) {
                            if (contents.subarray) {
                                contents = contents.subarray(position, position + length);
                            } else {
                                contents = Array.prototype.slice.call(contents, position, position + length);
                            }
                        }
                        allocated = true;
                        ptr = mmapAlloc(length);
                        if (!ptr) {
                            throw new FS.ErrnoError(48);
                        }
                        HEAP8.set(contents, ptr);
                    }
                    return {
                        ptr,
                        allocated
                    };
                },
                msync: function(stream, buffer, offset, length, mmapFlags) {
                    if (!FS.isFile(stream.node.mode)) {
                        throw new FS.ErrnoError(43);
                    }
                    if (mmapFlags & 2) {
                        return 0;
                    }
                    var bytesWritten = MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false);
                    return 0;
                }
            }
        };
        var FS = {
            root: null,
            mounts: [],
            devices: {},
            streams: [],
            nextInode: 1,
            nameTable: null,
            currentPath: "/",
            initialized: false,
            ignorePermissions: true,
            trackingDelegate: {},
            tracking: {
                openFlags: {
                    READ: 1,
                    WRITE: 2
                }
            },
            ErrnoError: null,
            genericErrors: {},
            filesystems: null,
            syncFSRequests: 0,
            handleFSError: function(e) {
                if (!(e instanceof FS.ErrnoError)) throw e + " : " + stackTrace();
                return setErrNo(e.errno);
            },
            lookupPath: function(path, opts) {
                path = PATH_FS.resolve(FS.cwd(), path);
                opts = opts || {};
                if (!path) return {
                    path: "",
                    node: null
                };
                var defaults = {
                    follow_mount: true,
                    recurse_count: 0
                };
                for (var key in defaults) {
                    if (opts[key] === undefined) {
                        opts[key] = defaults[key];
                    }
                }
                if (opts.recurse_count > 8) {
                    throw new FS.ErrnoError(32);
                }
                var parts = PATH.normalizeArray(path.split("/").filter((function(p) {
                    return !!p;
                })), false);
                var current = FS.root;
                var current_path = "/";
                for (var i = 0; i < parts.length; i++) {
                    var islast = i === parts.length - 1;
                    if (islast && opts.parent) {
                        break;
                    }
                    current = FS.lookupNode(current, parts[i]);
                    current_path = PATH.join2(current_path, parts[i]);
                    if (FS.isMountpoint(current)) {
                        if (!islast || islast && opts.follow_mount) {
                            current = current.mounted.root;
                        }
                    }
                    if (!islast || opts.follow) {
                        var count = 0;
                        while (FS.isLink(current.mode)) {
                            var link = FS.readlink(current_path);
                            current_path = PATH_FS.resolve(PATH.dirname(current_path), link);
                            var lookup = FS.lookupPath(current_path, {
                                recurse_count: opts.recurse_count
                            });
                            current = lookup.node;
                            if (count++ > 40) {
                                throw new FS.ErrnoError(32);
                            }
                        }
                    }
                }
                return {
                    path: current_path,
                    node: current
                };
            },
            getPath: function(node) {
                var path;
                while (true) {
                    if (FS.isRoot(node)) {
                        var mount = node.mount.mountpoint;
                        if (!path) return mount;
                        return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path;
                    }
                    path = path ? node.name + "/" + path : node.name;
                    node = node.parent;
                }
            },
            hashName: function(parentid, name) {
                var hash = 0;
                for (var i = 0; i < name.length; i++) {
                    hash = (hash << 5) - hash + name.charCodeAt(i) | 0;
                }
                return (parentid + hash >>> 0) % FS.nameTable.length;
            },
            hashAddNode: function(node) {
                var hash = FS.hashName(node.parent.id, node.name);
                node.name_next = FS.nameTable[hash];
                FS.nameTable[hash] = node;
            },
            hashRemoveNode: function(node) {
                var hash = FS.hashName(node.parent.id, node.name);
                if (FS.nameTable[hash] === node) {
                    FS.nameTable[hash] = node.name_next;
                } else {
                    var current = FS.nameTable[hash];
                    while (current) {
                        if (current.name_next === node) {
                            current.name_next = node.name_next;
                            break;
                        }
                        current = current.name_next;
                    }
                }
            },
            lookupNode: function(parent, name) {
                var errCode = FS.mayLookup(parent);
                if (errCode) {
                    throw new FS.ErrnoError(errCode, parent);
                }
                var hash = FS.hashName(parent.id, name);
                for (var node = FS.nameTable[hash]; node; node = node.name_next) {
                    var nodeName = node.name;
                    if (node.parent.id === parent.id && nodeName === name) {
                        return node;
                    }
                }
                return FS.lookup(parent, name);
            },
            createNode: function(parent, name, mode, rdev) {
                var node = new FS.FSNode(parent, name, mode, rdev);
                FS.hashAddNode(node);
                return node;
            },
            destroyNode: function(node) {
                FS.hashRemoveNode(node);
            },
            isRoot: function(node) {
                return node === node.parent;
            },
            isMountpoint: function(node) {
                return !!node.mounted;
            },
            isFile: function(mode) {
                return (mode & 61440) === 32768;
            },
            isDir: function(mode) {
                return (mode & 61440) === 16384;
            },
            isLink: function(mode) {
                return (mode & 61440) === 40960;
            },
            isChrdev: function(mode) {
                return (mode & 61440) === 8192;
            },
            isBlkdev: function(mode) {
                return (mode & 61440) === 24576;
            },
            isFIFO: function(mode) {
                return (mode & 61440) === 4096;
            },
            isSocket: function(mode) {
                return (mode & 49152) === 49152;
            },
            flagModes: {
                r: 0,
                rs: 1052672,
                "r+": 2,
                w: 577,
                wx: 705,
                xw: 705,
                "w+": 578,
                "wx+": 706,
                "xw+": 706,
                a: 1089,
                ax: 1217,
                xa: 1217,
                "a+": 1090,
                "ax+": 1218,
                "xa+": 1218
            },
            modeStringToFlags: function(str) {
                var flags = FS.flagModes[str];
                if (typeof flags === "undefined") {
                    throw new Error("Unknown file open mode: " + str);
                }
                return flags;
            },
            flagsToPermissionString: function(flag) {
                var perms = [ "r", "w", "rw" ][flag & 3];
                if (flag & 512) {
                    perms += "w";
                }
                return perms;
            },
            nodePermissions: function(node, perms) {
                if (FS.ignorePermissions) {
                    return 0;
                }
                if (perms.indexOf("r") !== -1 && !(node.mode & 292)) {
                    return 2;
                } else if (perms.indexOf("w") !== -1 && !(node.mode & 146)) {
                    return 2;
                } else if (perms.indexOf("x") !== -1 && !(node.mode & 73)) {
                    return 2;
                }
                return 0;
            },
            mayLookup: function(dir) {
                var errCode = FS.nodePermissions(dir, "x");
                if (errCode) return errCode;
                if (!dir.node_ops.lookup) return 2;
                return 0;
            },
            mayCreate: function(dir, name) {
                try {
                    var node = FS.lookupNode(dir, name);
                    return 20;
                } catch (e) {}
                return FS.nodePermissions(dir, "wx");
            },
            mayDelete: function(dir, name, isdir) {
                var node;
                try {
                    node = FS.lookupNode(dir, name);
                } catch (e) {
                    return e.errno;
                }
                var errCode = FS.nodePermissions(dir, "wx");
                if (errCode) {
                    return errCode;
                }
                if (isdir) {
                    if (!FS.isDir(node.mode)) {
                        return 54;
                    }
                    if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
                        return 10;
                    }
                } else {
                    if (FS.isDir(node.mode)) {
                        return 31;
                    }
                }
                return 0;
            },
            mayOpen: function(node, flags) {
                if (!node) {
                    return 44;
                }
                if (FS.isLink(node.mode)) {
                    return 32;
                } else if (FS.isDir(node.mode)) {
                    if (FS.flagsToPermissionString(flags) !== "r" || flags & 512) {
                        return 31;
                    }
                }
                return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
            },
            MAX_OPEN_FDS: 4096,
            nextfd: function(fd_start, fd_end) {
                fd_start = fd_start || 0;
                fd_end = fd_end || FS.MAX_OPEN_FDS;
                for (var fd = fd_start; fd <= fd_end; fd++) {
                    if (!FS.streams[fd]) {
                        return fd;
                    }
                }
                throw new FS.ErrnoError(33);
            },
            getStream: function(fd) {
                return FS.streams[fd];
            },
            createStream: function(stream, fd_start, fd_end) {
                if (!FS.FSStream) {
                    FS.FSStream = function() {};
                    FS.FSStream.prototype = {
                        object: {
                            get: function() {
                                return this.node;
                            },
                            set: function(val) {
                                this.node = val;
                            }
                        },
                        isRead: {
                            get: function() {
                                return (this.flags & 2097155) !== 1;
                            }
                        },
                        isWrite: {
                            get: function() {
                                return (this.flags & 2097155) !== 0;
                            }
                        },
                        isAppend: {
                            get: function() {
                                return this.flags & 1024;
                            }
                        }
                    };
                }
                var newStream = new FS.FSStream;
                for (var p in stream) {
                    newStream[p] = stream[p];
                }
                stream = newStream;
                var fd = FS.nextfd(fd_start, fd_end);
                stream.fd = fd;
                FS.streams[fd] = stream;
                return stream;
            },
            closeStream: function(fd) {
                FS.streams[fd] = null;
            },
            chrdev_stream_ops: {
                open: function(stream) {
                    var device = FS.getDevice(stream.node.rdev);
                    stream.stream_ops = device.stream_ops;
                    if (stream.stream_ops.open) {
                        stream.stream_ops.open(stream);
                    }
                },
                llseek: function() {
                    throw new FS.ErrnoError(70);
                }
            },
            major: function(dev) {
                return dev >> 8;
            },
            minor: function(dev) {
                return dev & 255;
            },
            makedev: function(ma, mi) {
                return ma << 8 | mi;
            },
            registerDevice: function(dev, ops) {
                FS.devices[dev] = {
                    stream_ops: ops
                };
            },
            getDevice: function(dev) {
                return FS.devices[dev];
            },
            getMounts: function(mount) {
                var mounts = [];
                var check = [ mount ];
                while (check.length) {
                    var m = check.pop();
                    mounts.push(m);
                    check.push.apply(check, m.mounts);
                }
                return mounts;
            },
            syncfs: function(populate, callback) {
                if (typeof populate === "function") {
                    callback = populate;
                    populate = false;
                }
                FS.syncFSRequests++;
                if (FS.syncFSRequests > 1) {
                    err("warning: " + FS.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work");
                }
                var mounts = FS.getMounts(FS.root.mount);
                var completed = 0;
                function doCallback(errCode) {
                    FS.syncFSRequests--;
                    return callback(errCode);
                }
                function done(errCode) {
                    if (errCode) {
                        if (!done.errored) {
                            done.errored = true;
                            return doCallback(errCode);
                        }
                        return;
                    }
                    if (++completed >= mounts.length) {
                        doCallback(null);
                    }
                }
                mounts.forEach((function(mount) {
                    if (!mount.type.syncfs) {
                        return done(null);
                    }
                    mount.type.syncfs(mount, populate, done);
                }));
            },
            mount: function(type, opts, mountpoint) {
                var root = mountpoint === "/";
                var pseudo = !mountpoint;
                var node;
                if (root && FS.root) {
                    throw new FS.ErrnoError(10);
                } else if (!root && !pseudo) {
                    var lookup = FS.lookupPath(mountpoint, {
                        follow_mount: false
                    });
                    mountpoint = lookup.path;
                    node = lookup.node;
                    if (FS.isMountpoint(node)) {
                        throw new FS.ErrnoError(10);
                    }
                    if (!FS.isDir(node.mode)) {
                        throw new FS.ErrnoError(54);
                    }
                }
                var mount = {
                    type,
                    opts,
                    mountpoint,
                    mounts: []
                };
                var mountRoot = type.mount(mount);
                mountRoot.mount = mount;
                mount.root = mountRoot;
                if (root) {
                    FS.root = mountRoot;
                } else if (node) {
                    node.mounted = mount;
                    if (node.mount) {
                        node.mount.mounts.push(mount);
                    }
                }
                return mountRoot;
            },
            unmount: function(mountpoint) {
                var lookup = FS.lookupPath(mountpoint, {
                    follow_mount: false
                });
                if (!FS.isMountpoint(lookup.node)) {
                    throw new FS.ErrnoError(28);
                }
                var node = lookup.node;
                var mount = node.mounted;
                var mounts = FS.getMounts(mount);
                Object.keys(FS.nameTable).forEach((function(hash) {
                    var current = FS.nameTable[hash];
                    while (current) {
                        var next = current.name_next;
                        if (mounts.indexOf(current.mount) !== -1) {
                            FS.destroyNode(current);
                        }
                        current = next;
                    }
                }));
                node.mounted = null;
                var idx = node.mount.mounts.indexOf(mount);
                node.mount.mounts.splice(idx, 1);
            },
            lookup: function(parent, name) {
                return parent.node_ops.lookup(parent, name);
            },
            mknod: function(path, mode, dev) {
                var lookup = FS.lookupPath(path, {
                    parent: true
                });
                var parent = lookup.node;
                var name = PATH.basename(path);
                if (!name || name === "." || name === "..") {
                    throw new FS.ErrnoError(28);
                }
                var errCode = FS.mayCreate(parent, name);
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                if (!parent.node_ops.mknod) {
                    throw new FS.ErrnoError(63);
                }
                return parent.node_ops.mknod(parent, name, mode, dev);
            },
            create: function(path, mode) {
                mode = mode !== undefined ? mode : 438;
                mode &= 4095;
                mode |= 32768;
                return FS.mknod(path, mode, 0);
            },
            mkdir: function(path, mode) {
                mode = mode !== undefined ? mode : 511;
                mode &= 511 | 512;
                mode |= 16384;
                return FS.mknod(path, mode, 0);
            },
            mkdirTree: function(path, mode) {
                var dirs = path.split("/");
                var d = "";
                for (var i = 0; i < dirs.length; ++i) {
                    if (!dirs[i]) continue;
                    d += "/" + dirs[i];
                    try {
                        FS.mkdir(d, mode);
                    } catch (e) {
                        if (e.errno != 20) throw e;
                    }
                }
            },
            mkdev: function(path, mode, dev) {
                if (typeof dev === "undefined") {
                    dev = mode;
                    mode = 438;
                }
                mode |= 8192;
                return FS.mknod(path, mode, dev);
            },
            symlink: function(oldpath, newpath) {
                if (!PATH_FS.resolve(oldpath)) {
                    throw new FS.ErrnoError(44);
                }
                var lookup = FS.lookupPath(newpath, {
                    parent: true
                });
                var parent = lookup.node;
                if (!parent) {
                    throw new FS.ErrnoError(44);
                }
                var newname = PATH.basename(newpath);
                var errCode = FS.mayCreate(parent, newname);
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                if (!parent.node_ops.symlink) {
                    throw new FS.ErrnoError(63);
                }
                return parent.node_ops.symlink(parent, newname, oldpath);
            },
            rename: function(old_path, new_path) {
                var old_dirname = PATH.dirname(old_path);
                var new_dirname = PATH.dirname(new_path);
                var old_name = PATH.basename(old_path);
                var new_name = PATH.basename(new_path);
                var lookup, old_dir, new_dir;
                lookup = FS.lookupPath(old_path, {
                    parent: true
                });
                old_dir = lookup.node;
                lookup = FS.lookupPath(new_path, {
                    parent: true
                });
                new_dir = lookup.node;
                if (!old_dir || !new_dir) throw new FS.ErrnoError(44);
                if (old_dir.mount !== new_dir.mount) {
                    throw new FS.ErrnoError(75);
                }
                var old_node = FS.lookupNode(old_dir, old_name);
                var relative = PATH_FS.relative(old_path, new_dirname);
                if (relative.charAt(0) !== ".") {
                    throw new FS.ErrnoError(28);
                }
                relative = PATH_FS.relative(new_path, old_dirname);
                if (relative.charAt(0) !== ".") {
                    throw new FS.ErrnoError(55);
                }
                var new_node;
                try {
                    new_node = FS.lookupNode(new_dir, new_name);
                } catch (e) {}
                if (old_node === new_node) {
                    return;
                }
                var isdir = FS.isDir(old_node.mode);
                var errCode = FS.mayDelete(old_dir, old_name, isdir);
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name);
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                if (!old_dir.node_ops.rename) {
                    throw new FS.ErrnoError(63);
                }
                if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) {
                    throw new FS.ErrnoError(10);
                }
                if (new_dir !== old_dir) {
                    errCode = FS.nodePermissions(old_dir, "w");
                    if (errCode) {
                        throw new FS.ErrnoError(errCode);
                    }
                }
                try {
                    if (FS.trackingDelegate["willMovePath"]) {
                        FS.trackingDelegate["willMovePath"](old_path, new_path);
                    }
                } catch (e) {
                    err("FS.trackingDelegate['willMovePath']('" + old_path + "', '" + new_path + "') threw an exception: " + e.message);
                }
                FS.hashRemoveNode(old_node);
                try {
                    old_dir.node_ops.rename(old_node, new_dir, new_name);
                } catch (e) {
                    throw e;
                } finally {
                    FS.hashAddNode(old_node);
                }
                try {
                    if (FS.trackingDelegate["onMovePath"]) FS.trackingDelegate["onMovePath"](old_path, new_path);
                } catch (e) {
                    err("FS.trackingDelegate['onMovePath']('" + old_path + "', '" + new_path + "') threw an exception: " + e.message);
                }
            },
            rmdir: function(path) {
                var lookup = FS.lookupPath(path, {
                    parent: true
                });
                var parent = lookup.node;
                var name = PATH.basename(path);
                var node = FS.lookupNode(parent, name);
                var errCode = FS.mayDelete(parent, name, true);
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                if (!parent.node_ops.rmdir) {
                    throw new FS.ErrnoError(63);
                }
                if (FS.isMountpoint(node)) {
                    throw new FS.ErrnoError(10);
                }
                try {
                    if (FS.trackingDelegate["willDeletePath"]) {
                        FS.trackingDelegate["willDeletePath"](path);
                    }
                } catch (e) {
                    err("FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message);
                }
                parent.node_ops.rmdir(parent, name);
                FS.destroyNode(node);
                try {
                    if (FS.trackingDelegate["onDeletePath"]) FS.trackingDelegate["onDeletePath"](path);
                } catch (e) {
                    err("FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message);
                }
            },
            readdir: function(path) {
                var lookup = FS.lookupPath(path, {
                    follow: true
                });
                var node = lookup.node;
                if (!node.node_ops.readdir) {
                    throw new FS.ErrnoError(54);
                }
                return node.node_ops.readdir(node);
            },
            unlink: function(path) {
                var lookup = FS.lookupPath(path, {
                    parent: true
                });
                var parent = lookup.node;
                var name = PATH.basename(path);
                var node = FS.lookupNode(parent, name);
                var errCode = FS.mayDelete(parent, name, false);
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                if (!parent.node_ops.unlink) {
                    throw new FS.ErrnoError(63);
                }
                if (FS.isMountpoint(node)) {
                    throw new FS.ErrnoError(10);
                }
                try {
                    if (FS.trackingDelegate["willDeletePath"]) {
                        FS.trackingDelegate["willDeletePath"](path);
                    }
                } catch (e) {
                    err("FS.trackingDelegate['willDeletePath']('" + path + "') threw an exception: " + e.message);
                }
                parent.node_ops.unlink(parent, name);
                FS.destroyNode(node);
                try {
                    if (FS.trackingDelegate["onDeletePath"]) FS.trackingDelegate["onDeletePath"](path);
                } catch (e) {
                    err("FS.trackingDelegate['onDeletePath']('" + path + "') threw an exception: " + e.message);
                }
            },
            readlink: function(path) {
                var lookup = FS.lookupPath(path);
                var link = lookup.node;
                if (!link) {
                    throw new FS.ErrnoError(44);
                }
                if (!link.node_ops.readlink) {
                    throw new FS.ErrnoError(28);
                }
                return PATH_FS.resolve(FS.getPath(link.parent), link.node_ops.readlink(link));
            },
            stat: function(path, dontFollow) {
                var lookup = FS.lookupPath(path, {
                    follow: !dontFollow
                });
                var node = lookup.node;
                if (!node) {
                    throw new FS.ErrnoError(44);
                }
                if (!node.node_ops.getattr) {
                    throw new FS.ErrnoError(63);
                }
                return node.node_ops.getattr(node);
            },
            lstat: function(path) {
                return FS.stat(path, true);
            },
            chmod: function(path, mode, dontFollow) {
                var node;
                if (typeof path === "string") {
                    var lookup = FS.lookupPath(path, {
                        follow: !dontFollow
                    });
                    node = lookup.node;
                } else {
                    node = path;
                }
                if (!node.node_ops.setattr) {
                    throw new FS.ErrnoError(63);
                }
                node.node_ops.setattr(node, {
                    mode: mode & 4095 | node.mode & ~4095,
                    timestamp: Date.now()
                });
            },
            lchmod: function(path, mode) {
                FS.chmod(path, mode, true);
            },
            fchmod: function(fd, mode) {
                var stream = FS.getStream(fd);
                if (!stream) {
                    throw new FS.ErrnoError(8);
                }
                FS.chmod(stream.node, mode);
            },
            chown: function(path, uid, gid, dontFollow) {
                var node;
                if (typeof path === "string") {
                    var lookup = FS.lookupPath(path, {
                        follow: !dontFollow
                    });
                    node = lookup.node;
                } else {
                    node = path;
                }
                if (!node.node_ops.setattr) {
                    throw new FS.ErrnoError(63);
                }
                node.node_ops.setattr(node, {
                    timestamp: Date.now()
                });
            },
            lchown: function(path, uid, gid) {
                FS.chown(path, uid, gid, true);
            },
            fchown: function(fd, uid, gid) {
                var stream = FS.getStream(fd);
                if (!stream) {
                    throw new FS.ErrnoError(8);
                }
                FS.chown(stream.node, uid, gid);
            },
            truncate: function(path, len) {
                if (len < 0) {
                    throw new FS.ErrnoError(28);
                }
                var node;
                if (typeof path === "string") {
                    var lookup = FS.lookupPath(path, {
                        follow: true
                    });
                    node = lookup.node;
                } else {
                    node = path;
                }
                if (!node.node_ops.setattr) {
                    throw new FS.ErrnoError(63);
                }
                if (FS.isDir(node.mode)) {
                    throw new FS.ErrnoError(31);
                }
                if (!FS.isFile(node.mode)) {
                    throw new FS.ErrnoError(28);
                }
                var errCode = FS.nodePermissions(node, "w");
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                node.node_ops.setattr(node, {
                    size: len,
                    timestamp: Date.now()
                });
            },
            ftruncate: function(fd, len) {
                var stream = FS.getStream(fd);
                if (!stream) {
                    throw new FS.ErrnoError(8);
                }
                if ((stream.flags & 2097155) === 0) {
                    throw new FS.ErrnoError(28);
                }
                FS.truncate(stream.node, len);
            },
            utime: function(path, atime, mtime) {
                var lookup = FS.lookupPath(path, {
                    follow: true
                });
                var node = lookup.node;
                node.node_ops.setattr(node, {
                    timestamp: Math.max(atime, mtime)
                });
            },
            open: function(path, flags, mode, fd_start, fd_end) {
                if (path === "") {
                    throw new FS.ErrnoError(44);
                }
                flags = typeof flags === "string" ? FS.modeStringToFlags(flags) : flags;
                mode = typeof mode === "undefined" ? 438 : mode;
                if (flags & 64) {
                    mode = mode & 4095 | 32768;
                } else {
                    mode = 0;
                }
                var node;
                if (typeof path === "object") {
                    node = path;
                } else {
                    path = PATH.normalize(path);
                    try {
                        var lookup = FS.lookupPath(path, {
                            follow: !(flags & 131072)
                        });
                        node = lookup.node;
                    } catch (e) {}
                }
                var created = false;
                if (flags & 64) {
                    if (node) {
                        if (flags & 128) {
                            throw new FS.ErrnoError(20);
                        }
                    } else {
                        node = FS.mknod(path, mode, 0);
                        created = true;
                    }
                }
                if (!node) {
                    throw new FS.ErrnoError(44);
                }
                if (FS.isChrdev(node.mode)) {
                    flags &= ~512;
                }
                if (flags & 65536 && !FS.isDir(node.mode)) {
                    throw new FS.ErrnoError(54);
                }
                if (!created) {
                    var errCode = FS.mayOpen(node, flags);
                    if (errCode) {
                        throw new FS.ErrnoError(errCode);
                    }
                }
                if (flags & 512) {
                    FS.truncate(node, 0);
                }
                flags &= ~(128 | 512 | 131072);
                var stream = FS.createStream({
                    node,
                    path: FS.getPath(node),
                    flags,
                    seekable: true,
                    position: 0,
                    stream_ops: node.stream_ops,
                    ungotten: [],
                    error: false
                }, fd_start, fd_end);
                if (stream.stream_ops.open) {
                    stream.stream_ops.open(stream);
                }
                if (Module["logReadFiles"] && !(flags & 1)) {
                    if (!FS.readFiles) FS.readFiles = {};
                    if (!(path in FS.readFiles)) {
                        FS.readFiles[path] = 1;
                        err("FS.trackingDelegate error on read file: " + path);
                    }
                }
                try {
                    if (FS.trackingDelegate["onOpenFile"]) {
                        var trackingFlags = 0;
                        if ((flags & 2097155) !== 1) {
                            trackingFlags |= FS.tracking.openFlags.READ;
                        }
                        if ((flags & 2097155) !== 0) {
                            trackingFlags |= FS.tracking.openFlags.WRITE;
                        }
                        FS.trackingDelegate["onOpenFile"](path, trackingFlags);
                    }
                } catch (e) {
                    err("FS.trackingDelegate['onOpenFile']('" + path + "', flags) threw an exception: " + e.message);
                }
                return stream;
            },
            close: function(stream) {
                if (FS.isClosed(stream)) {
                    throw new FS.ErrnoError(8);
                }
                if (stream.getdents) stream.getdents = null;
                try {
                    if (stream.stream_ops.close) {
                        stream.stream_ops.close(stream);
                    }
                } catch (e) {
                    throw e;
                } finally {
                    FS.closeStream(stream.fd);
                }
                stream.fd = null;
            },
            isClosed: function(stream) {
                return stream.fd === null;
            },
            llseek: function(stream, offset, whence) {
                if (FS.isClosed(stream)) {
                    throw new FS.ErrnoError(8);
                }
                if (!stream.seekable || !stream.stream_ops.llseek) {
                    throw new FS.ErrnoError(70);
                }
                if (whence != 0 && whence != 1 && whence != 2) {
                    throw new FS.ErrnoError(28);
                }
                stream.position = stream.stream_ops.llseek(stream, offset, whence);
                stream.ungotten = [];
                return stream.position;
            },
            read: function(stream, buffer, offset, length, position) {
                if (length < 0 || position < 0) {
                    throw new FS.ErrnoError(28);
                }
                if (FS.isClosed(stream)) {
                    throw new FS.ErrnoError(8);
                }
                if ((stream.flags & 2097155) === 1) {
                    throw new FS.ErrnoError(8);
                }
                if (FS.isDir(stream.node.mode)) {
                    throw new FS.ErrnoError(31);
                }
                if (!stream.stream_ops.read) {
                    throw new FS.ErrnoError(28);
                }
                var seeking = typeof position !== "undefined";
                if (!seeking) {
                    position = stream.position;
                } else if (!stream.seekable) {
                    throw new FS.ErrnoError(70);
                }
                var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
                if (!seeking) stream.position += bytesRead;
                return bytesRead;
            },
            write: function(stream, buffer, offset, length, position, canOwn) {
                if (length < 0 || position < 0) {
                    throw new FS.ErrnoError(28);
                }
                if (FS.isClosed(stream)) {
                    throw new FS.ErrnoError(8);
                }
                if ((stream.flags & 2097155) === 0) {
                    throw new FS.ErrnoError(8);
                }
                if (FS.isDir(stream.node.mode)) {
                    throw new FS.ErrnoError(31);
                }
                if (!stream.stream_ops.write) {
                    throw new FS.ErrnoError(28);
                }
                if (stream.seekable && stream.flags & 1024) {
                    FS.llseek(stream, 0, 2);
                }
                var seeking = typeof position !== "undefined";
                if (!seeking) {
                    position = stream.position;
                } else if (!stream.seekable) {
                    throw new FS.ErrnoError(70);
                }
                var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
                if (!seeking) stream.position += bytesWritten;
                try {
                    if (stream.path && FS.trackingDelegate["onWriteToFile"]) FS.trackingDelegate["onWriteToFile"](stream.path);
                } catch (e) {
                    err("FS.trackingDelegate['onWriteToFile']('" + stream.path + "') threw an exception: " + e.message);
                }
                return bytesWritten;
            },
            allocate: function(stream, offset, length) {
                if (FS.isClosed(stream)) {
                    throw new FS.ErrnoError(8);
                }
                if (offset < 0 || length <= 0) {
                    throw new FS.ErrnoError(28);
                }
                if ((stream.flags & 2097155) === 0) {
                    throw new FS.ErrnoError(8);
                }
                if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) {
                    throw new FS.ErrnoError(43);
                }
                if (!stream.stream_ops.allocate) {
                    throw new FS.ErrnoError(138);
                }
                stream.stream_ops.allocate(stream, offset, length);
            },
            mmap: function(stream, address, length, position, prot, flags) {
                if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) {
                    throw new FS.ErrnoError(2);
                }
                if ((stream.flags & 2097155) === 1) {
                    throw new FS.ErrnoError(2);
                }
                if (!stream.stream_ops.mmap) {
                    throw new FS.ErrnoError(43);
                }
                return stream.stream_ops.mmap(stream, address, length, position, prot, flags);
            },
            msync: function(stream, buffer, offset, length, mmapFlags) {
                if (!stream || !stream.stream_ops.msync) {
                    return 0;
                }
                return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags);
            },
            munmap: function(stream) {
                return 0;
            },
            ioctl: function(stream, cmd, arg) {
                if (!stream.stream_ops.ioctl) {
                    throw new FS.ErrnoError(59);
                }
                return stream.stream_ops.ioctl(stream, cmd, arg);
            },
            readFile: function(path, opts) {
                opts = opts || {};
                opts.flags = opts.flags || "r";
                opts.encoding = opts.encoding || "binary";
                if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
                    throw new Error('Invalid encoding type "' + opts.encoding + '"');
                }
                var ret;
                var stream = FS.open(path, opts.flags);
                var stat = FS.stat(path);
                var length = stat.size;
                var buf = new Uint8Array(length);
                FS.read(stream, buf, 0, length, 0);
                if (opts.encoding === "utf8") {
                    ret = UTF8ArrayToString(buf, 0);
                } else if (opts.encoding === "binary") {
                    ret = buf;
                }
                FS.close(stream);
                return ret;
            },
            writeFile: function(path, data, opts) {
                opts = opts || {};
                opts.flags = opts.flags || "w";
                var stream = FS.open(path, opts.flags, opts.mode);
                if (typeof data === "string") {
                    var buf = new Uint8Array(lengthBytesUTF8(data) + 1);
                    var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
                    FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn);
                } else if (ArrayBuffer.isView(data)) {
                    FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn);
                } else {
                    throw new Error("Unsupported data type");
                }
                FS.close(stream);
            },
            cwd: function() {
                return FS.currentPath;
            },
            chdir: function(path) {
                var lookup = FS.lookupPath(path, {
                    follow: true
                });
                if (lookup.node === null) {
                    throw new FS.ErrnoError(44);
                }
                if (!FS.isDir(lookup.node.mode)) {
                    throw new FS.ErrnoError(54);
                }
                var errCode = FS.nodePermissions(lookup.node, "x");
                if (errCode) {
                    throw new FS.ErrnoError(errCode);
                }
                FS.currentPath = lookup.path;
            },
            createDefaultDirectories: function() {
                FS.mkdir("/tmp");
                FS.mkdir("/home");
                FS.mkdir("/home/web_user");
            },
            createDefaultDevices: function() {
                FS.mkdir("/dev");
                FS.registerDevice(FS.makedev(1, 3), {
                    read: function() {
                        return 0;
                    },
                    write: function(stream, buffer, offset, length, pos) {
                        return length;
                    }
                });
                FS.mkdev("/dev/null", FS.makedev(1, 3));
                TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
                TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
                FS.mkdev("/dev/tty", FS.makedev(5, 0));
                FS.mkdev("/dev/tty1", FS.makedev(6, 0));
                var random_device = getRandomDevice();
                FS.createDevice("/dev", "random", random_device);
                FS.createDevice("/dev", "urandom", random_device);
                FS.mkdir("/dev/shm");
                FS.mkdir("/dev/shm/tmp");
            },
            createSpecialDirectories: function() {
                FS.mkdir("/proc");
                FS.mkdir("/proc/self");
                FS.mkdir("/proc/self/fd");
                FS.mount({
                    mount: function() {
                        var node = FS.createNode("/proc/self", "fd", 16384 | 511, 73);
                        node.node_ops = {
                            lookup: function(parent, name) {
                                var fd = +name;
                                var stream = FS.getStream(fd);
                                if (!stream) throw new FS.ErrnoError(8);
                                var ret = {
                                    parent: null,
                                    mount: {
                                        mountpoint: "fake"
                                    },
                                    node_ops: {
                                        readlink: function() {
                                            return stream.path;
                                        }
                                    }
                                };
                                ret.parent = ret;
                                return ret;
                            }
                        };
                        return node;
                    }
                }, {}, "/proc/self/fd");
            },
            createStandardStreams: function() {
                if (Module["stdin"]) {
                    FS.createDevice("/dev", "stdin", Module["stdin"]);
                } else {
                    FS.symlink("/dev/tty", "/dev/stdin");
                }
                if (Module["stdout"]) {
                    FS.createDevice("/dev", "stdout", null, Module["stdout"]);
                } else {
                    FS.symlink("/dev/tty", "/dev/stdout");
                }
                if (Module["stderr"]) {
                    FS.createDevice("/dev", "stderr", null, Module["stderr"]);
                } else {
                    FS.symlink("/dev/tty1", "/dev/stderr");
                }
                var stdin = FS.open("/dev/stdin", "r");
                var stdout = FS.open("/dev/stdout", "w");
                var stderr = FS.open("/dev/stderr", "w");
            },
            ensureErrnoError: function() {
                if (FS.ErrnoError) return;
                FS.ErrnoError = function ErrnoError(errno, node) {
                    this.node = node;
                    this.setErrno = function(errno) {
                        this.errno = errno;
                    };
                    this.setErrno(errno);
                    this.message = "FS error";
                };
                FS.ErrnoError.prototype = new Error;
                FS.ErrnoError.prototype.constructor = FS.ErrnoError;
                [ 44 ].forEach((function(code) {
                    FS.genericErrors[code] = new FS.ErrnoError(code);
                    FS.genericErrors[code].stack = "<generic error, no stack>";
                }));
            },
            staticInit: function() {
                FS.ensureErrnoError();
                FS.nameTable = new Array(4096);
                FS.mount(MEMFS, {}, "/");
                FS.createDefaultDirectories();
                FS.createDefaultDevices();
                FS.createSpecialDirectories();
                FS.filesystems = {
                    MEMFS
                };
            },
            init: function(input, output, error) {
                FS.init.initialized = true;
                FS.ensureErrnoError();
                Module["stdin"] = input || Module["stdin"];
                Module["stdout"] = output || Module["stdout"];
                Module["stderr"] = error || Module["stderr"];
                FS.createStandardStreams();
            },
            quit: function() {
                FS.init.initialized = false;
                var fflush = Module["_fflush"];
                if (fflush) fflush(0);
                for (var i = 0; i < FS.streams.length; i++) {
                    var stream = FS.streams[i];
                    if (!stream) {
                        continue;
                    }
                    FS.close(stream);
                }
            },
            getMode: function(canRead, canWrite) {
                var mode = 0;
                if (canRead) mode |= 292 | 73;
                if (canWrite) mode |= 146;
                return mode;
            },
            findObject: function(path, dontResolveLastLink) {
                var ret = FS.analyzePath(path, dontResolveLastLink);
                if (ret.exists) {
                    return ret.object;
                } else {
                    setErrNo(ret.error);
                    return null;
                }
            },
            analyzePath: function(path, dontResolveLastLink) {
                try {
                    var lookup = FS.lookupPath(path, {
                        follow: !dontResolveLastLink
                    });
                    path = lookup.path;
                } catch (e) {}
                var ret = {
                    isRoot: false,
                    exists: false,
                    error: 0,
                    name: null,
                    path: null,
                    object: null,
                    parentExists: false,
                    parentPath: null,
                    parentObject: null
                };
                try {
                    var lookup = FS.lookupPath(path, {
                        parent: true
                    });
                    ret.parentExists = true;
                    ret.parentPath = lookup.path;
                    ret.parentObject = lookup.node;
                    ret.name = PATH.basename(path);
                    lookup = FS.lookupPath(path, {
                        follow: !dontResolveLastLink
                    });
                    ret.exists = true;
                    ret.path = lookup.path;
                    ret.object = lookup.node;
                    ret.name = lookup.node.name;
                    ret.isRoot = lookup.path === "/";
                } catch (e) {
                    ret.error = e.errno;
                }
                return ret;
            },
            createPath: function(parent, path, canRead, canWrite) {
                parent = typeof parent === "string" ? parent : FS.getPath(parent);
                var parts = path.split("/").reverse();
                while (parts.length) {
                    var part = parts.pop();
                    if (!part) continue;
                    var current = PATH.join2(parent, part);
                    try {
                        FS.mkdir(current);
                    } catch (e) {}
                    parent = current;
                }
                return current;
            },
            createFile: function(parent, name, properties, canRead, canWrite) {
                var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
                var mode = FS.getMode(canRead, canWrite);
                return FS.create(path, mode);
            },
            createDataFile: function(parent, name, data, canRead, canWrite, canOwn) {
                var path = name ? PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name) : parent;
                var mode = FS.getMode(canRead, canWrite);
                var node = FS.create(path, mode);
                if (data) {
                    if (typeof data === "string") {
                        var arr = new Array(data.length);
                        for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
                        data = arr;
                    }
                    FS.chmod(node, mode | 146);
                    var stream = FS.open(node, "w");
                    FS.write(stream, data, 0, data.length, 0, canOwn);
                    FS.close(stream);
                    FS.chmod(node, mode);
                }
                return node;
            },
            createDevice: function(parent, name, input, output) {
                var path = PATH.join2(typeof parent === "string" ? parent : FS.getPath(parent), name);
                var mode = FS.getMode(!!input, !!output);
                if (!FS.createDevice.major) FS.createDevice.major = 64;
                var dev = FS.makedev(FS.createDevice.major++, 0);
                FS.registerDevice(dev, {
                    open: function(stream) {
                        stream.seekable = false;
                    },
                    close: function(stream) {
                        if (output && output.buffer && output.buffer.length) {
                            output(10);
                        }
                    },
                    read: function(stream, buffer, offset, length, pos) {
                        var bytesRead = 0;
                        for (var i = 0; i < length; i++) {
                            var result;
                            try {
                                result = input();
                            } catch (e) {
                                throw new FS.ErrnoError(29);
                            }
                            if (result === undefined && bytesRead === 0) {
                                throw new FS.ErrnoError(6);
                            }
                            if (result === null || result === undefined) break;
                            bytesRead++;
                            buffer[offset + i] = result;
                        }
                        if (bytesRead) {
                            stream.node.timestamp = Date.now();
                        }
                        return bytesRead;
                    },
                    write: function(stream, buffer, offset, length, pos) {
                        for (var i = 0; i < length; i++) {
                            try {
                                output(buffer[offset + i]);
                            } catch (e) {
                                throw new FS.ErrnoError(29);
                            }
                        }
                        if (length) {
                            stream.node.timestamp = Date.now();
                        }
                        return i;
                    }
                });
                return FS.mkdev(path, mode, dev);
            },
            forceLoadFile: function(obj) {
                if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
                var success = true;
                if (typeof XMLHttpRequest !== "undefined") {
                    throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");
                } else if (read_) {
                    try {
                        obj.contents = intArrayFromString(read_(obj.url), true);
                        obj.usedBytes = obj.contents.length;
                    } catch (e) {
                        success = false;
                    }
                } else {
                    throw new Error("Cannot load without read() or XMLHttpRequest.");
                }
                if (!success) setErrNo(29);
                return success;
            },
            createLazyFile: function(parent, name, url, canRead, canWrite) {
                function LazyUint8Array() {
                    this.lengthKnown = false;
                    this.chunks = [];
                }
                LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) {
                    if (idx > this.length - 1 || idx < 0) {
                        return undefined;
                    }
                    var chunkOffset = idx % this.chunkSize;
                    var chunkNum = idx / this.chunkSize | 0;
                    return this.getter(chunkNum)[chunkOffset];
                };
                LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) {
                    this.getter = getter;
                };
                LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() {
                    var xhr = new XMLHttpRequest;
                    xhr.open("HEAD", url, false);
                    xhr.send(null);
                    if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
                    var datalength = Number(xhr.getResponseHeader("Content-length"));
                    var header;
                    var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
                    var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
                    var chunkSize = 1024 * 1024;
                    if (!hasByteServing) chunkSize = datalength;
                    var doXHR = function(from, to) {
                        if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
                        if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!");
                        var xhr = new XMLHttpRequest;
                        xhr.open("GET", url, false);
                        if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to);
                        if (typeof Uint8Array != "undefined") xhr.responseType = "arraybuffer";
                        if (xhr.overrideMimeType) {
                            xhr.overrideMimeType("text/plain; charset=x-user-defined");
                        }
                        xhr.send(null);
                        if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
                        if (xhr.response !== undefined) {
                            return new Uint8Array(xhr.response || []);
                        } else {
                            return intArrayFromString(xhr.responseText || "", true);
                        }
                    };
                    var lazyArray = this;
                    lazyArray.setDataGetter((function(chunkNum) {
                        var start = chunkNum * chunkSize;
                        var end = (chunkNum + 1) * chunkSize - 1;
                        end = Math.min(end, datalength - 1);
                        if (typeof lazyArray.chunks[chunkNum] === "undefined") {
                            lazyArray.chunks[chunkNum] = doXHR(start, end);
                        }
                        if (typeof lazyArray.chunks[chunkNum] === "undefined") throw new Error("doXHR failed!");
                        return lazyArray.chunks[chunkNum];
                    }));
                    if (usesGzip || !datalength) {
                        chunkSize = datalength = 1;
                        datalength = this.getter(0).length;
                        chunkSize = datalength;
                        out("LazyFiles on gzip forces download of the whole file when length is accessed");
                    }
                    this._length = datalength;
                    this._chunkSize = chunkSize;
                    this.lengthKnown = true;
                };
                if (typeof XMLHttpRequest !== "undefined") {
                    if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
                    var lazyArray = new LazyUint8Array;
                    Object.defineProperties(lazyArray, {
                        length: {
                            get: function() {
                                if (!this.lengthKnown) {
                                    this.cacheLength();
                                }
                                return this._length;
                            }
                        },
                        chunkSize: {
                            get: function() {
                                if (!this.lengthKnown) {
                                    this.cacheLength();
                                }
                                return this._chunkSize;
                            }
                        }
                    });
                    var properties = {
                        isDevice: false,
                        contents: lazyArray
                    };
                } else {
                    var properties = {
                        isDevice: false,
                        url
                    };
                }
                var node = FS.createFile(parent, name, properties, canRead, canWrite);
                if (properties.contents) {
                    node.contents = properties.contents;
                } else if (properties.url) {
                    node.contents = null;
                    node.url = properties.url;
                }
                Object.defineProperties(node, {
                    usedBytes: {
                        get: function() {
                            return this.contents.length;
                        }
                    }
                });
                var stream_ops = {};
                var keys = Object.keys(node.stream_ops);
                keys.forEach((function(key) {
                    var fn = node.stream_ops[key];
                    stream_ops[key] = function forceLoadLazyFile() {
                        if (!FS.forceLoadFile(node)) {
                            throw new FS.ErrnoError(29);
                        }
                        return fn.apply(null, arguments);
                    };
                }));
                stream_ops.read = function stream_ops_read(stream, buffer, offset, length, position) {
                    if (!FS.forceLoadFile(node)) {
                        throw new FS.ErrnoError(29);
                    }
                    var contents = stream.node.contents;
                    if (position >= contents.length) return 0;
                    var size = Math.min(contents.length - position, length);
                    if (contents.slice) {
                        for (var i = 0; i < size; i++) {
                            buffer[offset + i] = contents[position + i];
                        }
                    } else {
                        for (var i = 0; i < size; i++) {
                            buffer[offset + i] = contents.get(position + i);
                        }
                    }
                    return size;
                };
                node.stream_ops = stream_ops;
                return node;
            },
            createPreloadedFile: function(parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) {
                Browser.init();
                var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
                var dep = getUniqueRunDependency("cp " + fullname);
                function processData(byteArray) {
                    function finish(byteArray) {
                        if (preFinish) preFinish();
                        if (!dontCreateFile) {
                            FS.createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
                        }
                        if (onload) onload();
                        removeRunDependency(dep);
                    }
                    var handled = false;
                    Module["preloadPlugins"].forEach((function(plugin) {
                        if (handled) return;
                        if (plugin["canHandle"](fullname)) {
                            plugin["handle"](byteArray, fullname, finish, (function() {
                                if (onerror) onerror();
                                removeRunDependency(dep);
                            }));
                            handled = true;
                        }
                    }));
                    if (!handled) finish(byteArray);
                }
                addRunDependency(dep);
                if (typeof url == "string") {
                    Browser.asyncLoad(url, (function(byteArray) {
                        processData(byteArray);
                    }), onerror);
                } else {
                    processData(url);
                }
            },
            indexedDB: function() {
                return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
            },
            DB_NAME: function() {
                return "EM_FS_" + window.location.pathname;
            },
            DB_VERSION: 20,
            DB_STORE_NAME: "FILE_DATA",
            saveFilesToDB: function(paths, onload, onerror) {
                onload = onload || function() {};
                onerror = onerror || function() {};
                var indexedDB = FS.indexedDB();
                try {
                    var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
                } catch (e) {
                    return onerror(e);
                }
                openRequest.onupgradeneeded = function openRequest_onupgradeneeded() {
                    out("creating db");
                    var db = openRequest.result;
                    db.createObjectStore(FS.DB_STORE_NAME);
                };
                openRequest.onsuccess = function openRequest_onsuccess() {
                    var db = openRequest.result;
                    var transaction = db.transaction([ FS.DB_STORE_NAME ], "readwrite");
                    var files = transaction.objectStore(FS.DB_STORE_NAME);
                    var ok = 0, fail = 0, total = paths.length;
                    function finish() {
                        if (fail == 0) onload(); else onerror();
                    }
                    paths.forEach((function(path) {
                        var putRequest = files.put(FS.analyzePath(path).object.contents, path);
                        putRequest.onsuccess = function putRequest_onsuccess() {
                            ok++;
                            if (ok + fail == total) finish();
                        };
                        putRequest.onerror = function putRequest_onerror() {
                            fail++;
                            if (ok + fail == total) finish();
                        };
                    }));
                    transaction.onerror = onerror;
                };
                openRequest.onerror = onerror;
            },
            loadFilesFromDB: function(paths, onload, onerror) {
                onload = onload || function() {};
                onerror = onerror || function() {};
                var indexedDB = FS.indexedDB();
                try {
                    var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
                } catch (e) {
                    return onerror(e);
                }
                openRequest.onupgradeneeded = onerror;
                openRequest.onsuccess = function openRequest_onsuccess() {
                    var db = openRequest.result;
                    try {
                        var transaction = db.transaction([ FS.DB_STORE_NAME ], "readonly");
                    } catch (e) {
                        onerror(e);
                        return;
                    }
                    var files = transaction.objectStore(FS.DB_STORE_NAME);
                    var ok = 0, fail = 0, total = paths.length;
                    function finish() {
                        if (fail == 0) onload(); else onerror();
                    }
                    paths.forEach((function(path) {
                        var getRequest = files.get(path);
                        getRequest.onsuccess = function getRequest_onsuccess() {
                            if (FS.analyzePath(path).exists) {
                                FS.unlink(path);
                            }
                            FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
                            ok++;
                            if (ok + fail == total) finish();
                        };
                        getRequest.onerror = function getRequest_onerror() {
                            fail++;
                            if (ok + fail == total) finish();
                        };
                    }));
                    transaction.onerror = onerror;
                };
                openRequest.onerror = onerror;
            }
        };
        var SYSCALLS = {
            mappings: {},
            DEFAULT_POLLMASK: 5,
            umask: 511,
            calculateAt: function(dirfd, path) {
                if (path[0] !== "/") {
                    var dir;
                    if (dirfd === -100) {
                        dir = FS.cwd();
                    } else {
                        var dirstream = FS.getStream(dirfd);
                        if (!dirstream) throw new FS.ErrnoError(8);
                        dir = dirstream.path;
                    }
                    path = PATH.join2(dir, path);
                }
                return path;
            },
            doStat: function(func, path, buf) {
                try {
                    var stat = func(path);
                } catch (e) {
                    if (e && e.node && PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node))) {
                        return -54;
                    }
                    throw e;
                }
                HEAP32[buf >> 2] = stat.dev;
                HEAP32[buf + 4 >> 2] = 0;
                HEAP32[buf + 8 >> 2] = stat.ino;
                HEAP32[buf + 12 >> 2] = stat.mode;
                HEAP32[buf + 16 >> 2] = stat.nlink;
                HEAP32[buf + 20 >> 2] = stat.uid;
                HEAP32[buf + 24 >> 2] = stat.gid;
                HEAP32[buf + 28 >> 2] = stat.rdev;
                HEAP32[buf + 32 >> 2] = 0;
                tempI64 = [ stat.size >>> 0, (tempDouble = stat.size, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], 
                HEAP32[buf + 40 >> 2] = tempI64[0], HEAP32[buf + 44 >> 2] = tempI64[1];
                HEAP32[buf + 48 >> 2] = 4096;
                HEAP32[buf + 52 >> 2] = stat.blocks;
                HEAP32[buf + 56 >> 2] = stat.atime.getTime() / 1e3 | 0;
                HEAP32[buf + 60 >> 2] = 0;
                HEAP32[buf + 64 >> 2] = stat.mtime.getTime() / 1e3 | 0;
                HEAP32[buf + 68 >> 2] = 0;
                HEAP32[buf + 72 >> 2] = stat.ctime.getTime() / 1e3 | 0;
                HEAP32[buf + 76 >> 2] = 0;
                tempI64 = [ stat.ino >>> 0, (tempDouble = stat.ino, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], 
                HEAP32[buf + 80 >> 2] = tempI64[0], HEAP32[buf + 84 >> 2] = tempI64[1];
                return 0;
            },
            doMsync: function(addr, stream, len, flags, offset) {
                var buffer = HEAPU8.slice(addr, addr + len);
                FS.msync(stream, buffer, offset, len, flags);
            },
            doMkdir: function(path, mode) {
                path = PATH.normalize(path);
                if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1);
                FS.mkdir(path, mode, 0);
                return 0;
            },
            doMknod: function(path, mode, dev) {
                switch (mode & 61440) {
                  case 32768:
                  case 8192:
                  case 24576:
                  case 4096:
                  case 49152:
                    break;

                  default:
                    return -28;
                }
                FS.mknod(path, mode, dev);
                return 0;
            },
            doReadlink: function(path, buf, bufsize) {
                if (bufsize <= 0) return -28;
                var ret = FS.readlink(path);
                var len = Math.min(bufsize, lengthBytesUTF8(ret));
                var endChar = HEAP8[buf + len];
                stringToUTF8(ret, buf, bufsize + 1);
                HEAP8[buf + len] = endChar;
                return len;
            },
            doAccess: function(path, amode) {
                if (amode & ~7) {
                    return -28;
                }
                var node;
                var lookup = FS.lookupPath(path, {
                    follow: true
                });
                node = lookup.node;
                if (!node) {
                    return -44;
                }
                var perms = "";
                if (amode & 4) perms += "r";
                if (amode & 2) perms += "w";
                if (amode & 1) perms += "x";
                if (perms && FS.nodePermissions(node, perms)) {
                    return -2;
                }
                return 0;
            },
            doDup: function(path, flags, suggestFD) {
                var suggest = FS.getStream(suggestFD);
                if (suggest) FS.close(suggest);
                return FS.open(path, flags, 0, suggestFD, suggestFD).fd;
            },
            doReadv: function(stream, iov, iovcnt, offset) {
                var ret = 0;
                for (var i = 0; i < iovcnt; i++) {
                    var ptr = HEAP32[iov + i * 8 >> 2];
                    var len = HEAP32[iov + (i * 8 + 4) >> 2];
                    var curr = FS.read(stream, HEAP8, ptr, len, offset);
                    if (curr < 0) return -1;
                    ret += curr;
                    if (curr < len) break;
                }
                return ret;
            },
            doWritev: function(stream, iov, iovcnt, offset) {
                var ret = 0;
                for (var i = 0; i < iovcnt; i++) {
                    var ptr = HEAP32[iov + i * 8 >> 2];
                    var len = HEAP32[iov + (i * 8 + 4) >> 2];
                    var curr = FS.write(stream, HEAP8, ptr, len, offset);
                    if (curr < 0) return -1;
                    ret += curr;
                }
                return ret;
            },
            varargs: undefined,
            get: function() {
                SYSCALLS.varargs += 4;
                var ret = HEAP32[SYSCALLS.varargs - 4 >> 2];
                return ret;
            },
            getStr: function(ptr) {
                var ret = UTF8ToString(ptr);
                return ret;
            },
            getStreamFromFD: function(fd) {
                var stream = FS.getStream(fd);
                if (!stream) throw new FS.ErrnoError(8);
                return stream;
            },
            get64: function(low, high) {
                return low;
            }
        };
        function ___sys_getpid() {
            return 42;
        }
        function ___sys_getegid32() {
            return 0;
        }
        function ___sys_getuid32() {
            return ___sys_getegid32();
        }
        function ___sys_ioctl(fd, op, varargs) {
            SYSCALLS.varargs = varargs;
            try {
                var stream = SYSCALLS.getStreamFromFD(fd);
                switch (op) {
                  case 21509:
                  case 21505:
                    {
                        if (!stream.tty) return -59;
                        return 0;
                    }

                  case 21510:
                  case 21511:
                  case 21512:
                  case 21506:
                  case 21507:
                  case 21508:
                    {
                        if (!stream.tty) return -59;
                        return 0;
                    }

                  case 21519:
                    {
                        if (!stream.tty) return -59;
                        var argp = SYSCALLS.get();
                        HEAP32[argp >> 2] = 0;
                        return 0;
                    }

                  case 21520:
                    {
                        if (!stream.tty) return -59;
                        return -28;
                    }

                  case 21531:
                    {
                        var argp = SYSCALLS.get();
                        return FS.ioctl(stream, op, argp);
                    }

                  case 21523:
                    {
                        if (!stream.tty) return -59;
                        return 0;
                    }

                  case 21524:
                    {
                        if (!stream.tty) return -59;
                        return 0;
                    }

                  default:
                    abort("bad ioctl syscall " + op);
                }
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return -e.errno;
            }
        }
        function ___sys_open(path, flags, varargs) {
            SYSCALLS.varargs = varargs;
            try {
                var pathname = SYSCALLS.getStr(path);
                var mode = SYSCALLS.get();
                var stream = FS.open(pathname, flags, mode);
                return stream.fd;
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return -e.errno;
            }
        }
        function ___sys_read(fd, buf, count) {
            try {
                var stream = SYSCALLS.getStreamFromFD(fd);
                return FS.read(stream, HEAP8, buf, count);
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return -e.errno;
            }
        }
        function ___sys_uname(buf) {
            try {
                if (!buf) return -21;
                var layout = {
                    __size__: 390,
                    sysname: 0,
                    nodename: 65,
                    release: 130,
                    version: 195,
                    machine: 260,
                    domainname: 325
                };
                var copyString = function(element, value) {
                    var offset = layout[element];
                    writeAsciiToMemory(value, buf + offset);
                };
                copyString("sysname", "Emscripten");
                copyString("nodename", "emscripten");
                copyString("release", "1.0");
                copyString("version", "#1");
                copyString("machine", "x86-JS");
                return 0;
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return -e.errno;
            }
        }
        function _abort() {
            abort();
        }
        var _emscripten_get_now;
        if (ENVIRONMENT_IS_NODE) {
            _emscripten_get_now = function() {
                var t = process["hrtime"]();
                return t[0] * 1e3 + t[1] / 1e6;
            };
        } else if (typeof dateNow !== "undefined") {
            _emscripten_get_now = dateNow;
        } else _emscripten_get_now = function() {
            return performance.now();
        };
        var _emscripten_get_now_is_monotonic = true;
        function _clock_gettime(clk_id, tp) {
            var now;
            if (clk_id === 0) {
                now = Date.now();
            } else if ((clk_id === 1 || clk_id === 4) && _emscripten_get_now_is_monotonic) {
                now = _emscripten_get_now();
            } else {
                setErrNo(28);
                return -1;
            }
            HEAP32[tp >> 2] = now / 1e3 | 0;
            HEAP32[tp + 4 >> 2] = now % 1e3 * 1e3 * 1e3 | 0;
            return 0;
        }
        function _emscripten_memcpy_big(dest, src, num) {
            HEAPU8.copyWithin(dest, src, src + num);
        }
        function abortOnCannotGrowMemory(requestedSize) {
            abort("OOM");
        }
        function _emscripten_resize_heap(requestedSize) {
            requestedSize = requestedSize >>> 0;
            abortOnCannotGrowMemory(requestedSize);
        }
        var ENV = {};
        function getExecutableName() {
            return thisProgram || "./this.program";
        }
        function getEnvStrings() {
            if (!getEnvStrings.strings) {
                var lang = (typeof navigator === "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
                var env = {
                    USER: "web_user",
                    LOGNAME: "web_user",
                    PATH: "/",
                    PWD: "/",
                    HOME: "/home/web_user",
                    LANG: lang,
                    _: getExecutableName()
                };
                for (var x in ENV) {
                    env[x] = ENV[x];
                }
                var strings = [];
                for (var x in env) {
                    strings.push(x + "=" + env[x]);
                }
                getEnvStrings.strings = strings;
            }
            return getEnvStrings.strings;
        }
        function _environ_get(__environ, environ_buf) {
            var bufSize = 0;
            getEnvStrings().forEach((function(string, i) {
                var ptr = environ_buf + bufSize;
                HEAP32[__environ + i * 4 >> 2] = ptr;
                writeAsciiToMemory(string, ptr);
                bufSize += string.length + 1;
            }));
            return 0;
        }
        function _environ_sizes_get(penviron_count, penviron_buf_size) {
            var strings = getEnvStrings();
            HEAP32[penviron_count >> 2] = strings.length;
            var bufSize = 0;
            strings.forEach((function(string) {
                bufSize += string.length + 1;
            }));
            HEAP32[penviron_buf_size >> 2] = bufSize;
            return 0;
        }
        function _fd_close(fd) {
            try {
                var stream = SYSCALLS.getStreamFromFD(fd);
                FS.close(stream);
                return 0;
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return e.errno;
            }
        }
        function _fd_fdstat_get(fd, pbuf) {
            try {
                var stream = SYSCALLS.getStreamFromFD(fd);
                var type = stream.tty ? 2 : FS.isDir(stream.mode) ? 3 : FS.isLink(stream.mode) ? 7 : 4;
                HEAP8[pbuf >> 0] = type;
                return 0;
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return e.errno;
            }
        }
        function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
            try {
                var stream = SYSCALLS.getStreamFromFD(fd);
                var HIGH_OFFSET = 4294967296;
                var offset = offset_high * HIGH_OFFSET + (offset_low >>> 0);
                var DOUBLE_LIMIT = 9007199254740992;
                if (offset <= -DOUBLE_LIMIT || offset >= DOUBLE_LIMIT) {
                    return -61;
                }
                FS.llseek(stream, offset, whence);
                tempI64 = [ stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0) ], 
                HEAP32[newOffset >> 2] = tempI64[0], HEAP32[newOffset + 4 >> 2] = tempI64[1];
                if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
                return 0;
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return e.errno;
            }
        }
        function _fd_write(fd, iov, iovcnt, pnum) {
            try {
                var stream = SYSCALLS.getStreamFromFD(fd);
                var num = SYSCALLS.doWritev(stream, iov, iovcnt);
                HEAP32[pnum >> 2] = num;
                return 0;
            } catch (e) {
                if (typeof FS === "undefined" || !(e instanceof FS.ErrnoError)) abort(e);
                return e.errno;
            }
        }
        function _gettimeofday(ptr) {
            var now = Date.now();
            HEAP32[ptr >> 2] = now / 1e3 | 0;
            HEAP32[ptr + 4 >> 2] = now % 1e3 * 1e3 | 0;
            return 0;
        }
        function _usleep(useconds) {
            var start = _emscripten_get_now();
            while (_emscripten_get_now() - start < useconds / 1e3) {}
        }
        Module["_usleep"] = _usleep;
        function _nanosleep(rqtp, rmtp) {
            if (rqtp === 0) {
                setErrNo(28);
                return -1;
            }
            var seconds = HEAP32[rqtp >> 2];
            var nanoseconds = HEAP32[rqtp + 4 >> 2];
            if (nanoseconds < 0 || nanoseconds > 999999999 || seconds < 0) {
                setErrNo(28);
                return -1;
            }
            if (rmtp !== 0) {
                HEAP32[rmtp >> 2] = 0;
                HEAP32[rmtp + 4 >> 2] = 0;
            }
            return _usleep(seconds * 1e6 + nanoseconds / 1e3);
        }
        function _setTempRet0($i) {
            setTempRet0($i | 0);
        }
        function _sysconf(name) {
            switch (name) {
              case 30:
                return 16384;

              case 85:
                var maxHeapSize = HEAPU8.length;
                return maxHeapSize / 16384;

              case 132:
              case 133:
              case 12:
              case 137:
              case 138:
              case 15:
              case 235:
              case 16:
              case 17:
              case 18:
              case 19:
              case 20:
              case 149:
              case 13:
              case 10:
              case 236:
              case 153:
              case 9:
              case 21:
              case 22:
              case 159:
              case 154:
              case 14:
              case 77:
              case 78:
              case 139:
              case 80:
              case 81:
              case 82:
              case 68:
              case 67:
              case 164:
              case 11:
              case 29:
              case 47:
              case 48:
              case 95:
              case 52:
              case 51:
              case 46:
              case 79:
                return 200809;

              case 27:
              case 246:
              case 127:
              case 128:
              case 23:
              case 24:
              case 160:
              case 161:
              case 181:
              case 182:
              case 242:
              case 183:
              case 184:
              case 243:
              case 244:
              case 245:
              case 165:
              case 178:
              case 179:
              case 49:
              case 50:
              case 168:
              case 169:
              case 175:
              case 170:
              case 171:
              case 172:
              case 97:
              case 76:
              case 32:
              case 173:
              case 35:
                return -1;

              case 176:
              case 177:
              case 7:
              case 155:
              case 8:
              case 157:
              case 125:
              case 126:
              case 92:
              case 93:
              case 129:
              case 130:
              case 131:
              case 94:
              case 91:
                return 1;

              case 74:
              case 60:
              case 69:
              case 70:
              case 4:
                return 1024;

              case 31:
              case 42:
              case 72:
                return 32;

              case 87:
              case 26:
              case 33:
                return 2147483647;

              case 34:
              case 1:
                return 47839;

              case 38:
              case 36:
                return 99;

              case 43:
              case 37:
                return 2048;

              case 0:
                return 2097152;

              case 3:
                return 65536;

              case 28:
                return 32768;

              case 44:
                return 32767;

              case 75:
                return 16384;

              case 39:
                return 1e3;

              case 89:
                return 700;

              case 71:
                return 256;

              case 40:
                return 255;

              case 2:
                return 100;

              case 180:
                return 64;

              case 25:
                return 20;

              case 5:
                return 16;

              case 6:
                return 6;

              case 73:
                return 4;

              case 84:
                {
                    if (typeof navigator === "object") return navigator["hardwareConcurrency"] || 1;
                    return 1;
                }
            }
            setErrNo(28);
            return -1;
        }
        function _time(ptr) {
            var ret = Date.now() / 1e3 | 0;
            if (ptr) {
                HEAP32[ptr >> 2] = ret;
            }
            return ret;
        }
        function runAndAbortIfError(func) {
            try {
                return func();
            } catch (e) {
                abort(e);
            }
        }
        var Asyncify = {
            State: {
                Normal: 0,
                Unwinding: 1,
                Rewinding: 2
            },
            state: 0,
            StackSize: 4096,
            currData: null,
            handleSleepReturnValue: 0,
            exportCallStack: [],
            callStackNameToId: {},
            callStackIdToName: {},
            callStackId: 0,
            afterUnwind: null,
            asyncFinalizers: [],
            sleepCallbacks: [],
            getCallStackId: function(funcName) {
                var id = Asyncify.callStackNameToId[funcName];
                if (id === undefined) {
                    id = Asyncify.callStackId++;
                    Asyncify.callStackNameToId[funcName] = id;
                    Asyncify.callStackIdToName[id] = funcName;
                }
                return id;
            },
            instrumentWasmExports: function(exports) {
                var ret = {};
                for (var x in exports) {
                    (function(x) {
                        var original = exports[x];
                        if (typeof original === "function") {
                            ret[x] = function() {
                                Asyncify.exportCallStack.push(x);
                                try {
                                    return original.apply(null, arguments);
                                } finally {
                                    if (ABORT) return;
                                    var y = Asyncify.exportCallStack.pop();
                                    assert(y === x);
                                    Asyncify.maybeStopUnwind();
                                }
                            };
                        } else {
                            ret[x] = original;
                        }
                    })(x);
                }
                return ret;
            },
            maybeStopUnwind: function() {
                if (Asyncify.currData && Asyncify.state === Asyncify.State.Unwinding && Asyncify.exportCallStack.length === 0) {
                    Asyncify.state = Asyncify.State.Normal;
                    runAndAbortIfError(Module["_asyncify_stop_unwind"]);
                    if (typeof Fibers !== "undefined") {
                        Fibers.trampoline();
                    }
                    if (Asyncify.afterUnwind) {
                        Asyncify.afterUnwind();
                        Asyncify.afterUnwind = null;
                    }
                }
            },
            allocateData: function() {
                var ptr = _malloc(12 + Asyncify.StackSize);
                Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize);
                Asyncify.setDataRewindFunc(ptr);
                return ptr;
            },
            setDataHeader: function(ptr, stack, stackSize) {
                HEAP32[ptr >> 2] = stack;
                HEAP32[ptr + 4 >> 2] = stack + stackSize;
            },
            setDataRewindFunc: function(ptr) {
                var bottomOfCallStack = Asyncify.exportCallStack[0];
                var rewindId = Asyncify.getCallStackId(bottomOfCallStack);
                HEAP32[ptr + 8 >> 2] = rewindId;
            },
            getDataRewindFunc: function(ptr) {
                var id = HEAP32[ptr + 8 >> 2];
                var name = Asyncify.callStackIdToName[id];
                var func = Module["asm"][name];
                return func;
            },
            handleSleep: function(startAsync) {
                if (ABORT) return;
                noExitRuntime = true;
                if (Asyncify.state === Asyncify.State.Normal) {
                    var reachedCallback = false;
                    var reachedAfterCallback = false;
                    startAsync((function(handleSleepReturnValue) {
                        if (ABORT) return;
                        Asyncify.handleSleepReturnValue = handleSleepReturnValue || 0;
                        reachedCallback = true;
                        if (!reachedAfterCallback) {
                            return;
                        }
                        Asyncify.state = Asyncify.State.Rewinding;
                        runAndAbortIfError((function() {
                            Module["_asyncify_start_rewind"](Asyncify.currData);
                        }));
                        if (typeof Browser !== "undefined" && Browser.mainLoop.func) {
                            Browser.mainLoop.resume();
                        }
                        var start = Asyncify.getDataRewindFunc(Asyncify.currData);
                        var asyncWasmReturnValue = start();
                        if (!Asyncify.currData) {
                            var asyncFinalizers = Asyncify.asyncFinalizers;
                            Asyncify.asyncFinalizers = [];
                            asyncFinalizers.forEach((function(func) {
                                func(asyncWasmReturnValue);
                            }));
                        }
                    }));
                    reachedAfterCallback = true;
                    if (!reachedCallback) {
                        Asyncify.state = Asyncify.State.Unwinding;
                        Asyncify.currData = Asyncify.allocateData();
                        runAndAbortIfError((function() {
                            Module["_asyncify_start_unwind"](Asyncify.currData);
                        }));
                        if (typeof Browser !== "undefined" && Browser.mainLoop.func) {
                            Browser.mainLoop.pause();
                        }
                    }
                } else if (Asyncify.state === Asyncify.State.Rewinding) {
                    Asyncify.state = Asyncify.State.Normal;
                    runAndAbortIfError(Module["_asyncify_stop_rewind"]);
                    _free(Asyncify.currData);
                    Asyncify.currData = null;
                    Asyncify.sleepCallbacks.forEach((function(func) {
                        func();
                    }));
                } else {
                    abort("invalid state: " + Asyncify.state);
                }
                return Asyncify.handleSleepReturnValue;
            },
            handleAsync: function(startAsync) {
                return Asyncify.handleSleep((function(wakeUp) {
                    startAsync().then(wakeUp);
                }));
            }
        };
        var FSNode = function(parent, name, mode, rdev) {
            if (!parent) {
                parent = this;
            }
            this.parent = parent;
            this.mount = parent.mount;
            this.mounted = null;
            this.id = FS.nextInode++;
            this.name = name;
            this.mode = mode;
            this.node_ops = {};
            this.stream_ops = {};
            this.rdev = rdev;
        };
        var readMode = 292 | 73;
        var writeMode = 146;
        Object.defineProperties(FSNode.prototype, {
            read: {
                get: function() {
                    return (this.mode & readMode) === readMode;
                },
                set: function(val) {
                    val ? this.mode |= readMode : this.mode &= ~readMode;
                }
            },
            write: {
                get: function() {
                    return (this.mode & writeMode) === writeMode;
                },
                set: function(val) {
                    val ? this.mode |= writeMode : this.mode &= ~writeMode;
                }
            },
            isFolder: {
                get: function() {
                    return FS.isDir(this.mode);
                }
            },
            isDevice: {
                get: function() {
                    return FS.isChrdev(this.mode);
                }
            }
        });
        FS.FSNode = FSNode;
        FS.staticInit();
        function intArrayFromString(stringy, dontAddNull, length) {
            var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
            var u8array = new Array(len);
            var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
            if (dontAddNull) u8array.length = numBytesWritten;
            return u8array;
        }
        __ATINIT__.push({
            func: function() {
                ___wasm_call_ctors();
            }
        });
        var asmLibraryArg = {
            t: ___sys_getpid,
            v: ___sys_getuid32,
            y: ___sys_ioctl,
            z: ___sys_open,
            u: ___sys_read,
            w: ___sys_uname,
            A: _abort,
            k: array_push_buffer,
            f: blk_read,
            d: blk_write,
            g: _clock_gettime,
            e: discard,
            o: _emscripten_memcpy_big,
            p: _emscripten_resize_heap,
            q: _environ_get,
            r: _environ_sizes_get,
            i: _fd_close,
            s: _fd_fdstat_get,
            m: _fd_seek,
            h: _fd_write,
            j: flush,
            b: _gettimeofday,
            a: wasmMemory,
            x: _nanosleep,
            n: _setTempRet0,
            l: _sysconf,
            c: _time
        };
        var asm = createWasm();
        var ___wasm_call_ctors = Module["___wasm_call_ctors"] = function() {
            return (___wasm_call_ctors = Module["___wasm_call_ctors"] = Module["asm"]["C"]).apply(null, arguments);
        };
        var _free = Module["_free"] = function() {
            return (_free = Module["_free"] = Module["asm"]["D"]).apply(null, arguments);
        };
        var _malloc = Module["_malloc"] = function() {
            return (_malloc = Module["_malloc"] = Module["asm"]["E"]).apply(null, arguments);
        };
        var ___errno_location = Module["___errno_location"] = function() {
            return (___errno_location = Module["___errno_location"] = Module["asm"]["F"]).apply(null, arguments);
        };
        var _malloc_from_js = Module["_malloc_from_js"] = function() {
            return (_malloc_from_js = Module["_malloc_from_js"] = Module["asm"]["G"]).apply(null, arguments);
        };
        var _free_from_js = Module["_free_from_js"] = function() {
            return (_free_from_js = Module["_free_from_js"] = Module["asm"]["H"]).apply(null, arguments);
        };
        var _node_ext2fs_mount = Module["_node_ext2fs_mount"] = function() {
            return (_node_ext2fs_mount = Module["_node_ext2fs_mount"] = Module["asm"]["I"]).apply(null, arguments);
        };
        var _node_ext2fs_trim = Module["_node_ext2fs_trim"] = function() {
            return (_node_ext2fs_trim = Module["_node_ext2fs_trim"] = Module["asm"]["J"]).apply(null, arguments);
        };
        var _node_ext2fs_readdir = Module["_node_ext2fs_readdir"] = function() {
            return (_node_ext2fs_readdir = Module["_node_ext2fs_readdir"] = Module["asm"]["K"]).apply(null, arguments);
        };
        var _node_ext2fs_open = Module["_node_ext2fs_open"] = function() {
            return (_node_ext2fs_open = Module["_node_ext2fs_open"] = Module["asm"]["L"]).apply(null, arguments);
        };
        var _node_ext2fs_read = Module["_node_ext2fs_read"] = function() {
            return (_node_ext2fs_read = Module["_node_ext2fs_read"] = Module["asm"]["M"]).apply(null, arguments);
        };
        var _node_ext2fs_write = Module["_node_ext2fs_write"] = function() {
            return (_node_ext2fs_write = Module["_node_ext2fs_write"] = Module["asm"]["N"]).apply(null, arguments);
        };
        var _node_ext2fs_mkdir = Module["_node_ext2fs_mkdir"] = function() {
            return (_node_ext2fs_mkdir = Module["_node_ext2fs_mkdir"] = Module["asm"]["O"]).apply(null, arguments);
        };
        var _node_ext2fs_unlink = Module["_node_ext2fs_unlink"] = function() {
            return (_node_ext2fs_unlink = Module["_node_ext2fs_unlink"] = Module["asm"]["P"]).apply(null, arguments);
        };
        var _node_ext2fs_chmod = Module["_node_ext2fs_chmod"] = function() {
            return (_node_ext2fs_chmod = Module["_node_ext2fs_chmod"] = Module["asm"]["Q"]).apply(null, arguments);
        };
        var _node_ext2fs_chown = Module["_node_ext2fs_chown"] = function() {
            return (_node_ext2fs_chown = Module["_node_ext2fs_chown"] = Module["asm"]["R"]).apply(null, arguments);
        };
        var _node_ext2fs_close = Module["_node_ext2fs_close"] = function() {
            return (_node_ext2fs_close = Module["_node_ext2fs_close"] = Module["asm"]["S"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_mode = Module["_node_ext2fs_stat_i_mode"] = function() {
            return (_node_ext2fs_stat_i_mode = Module["_node_ext2fs_stat_i_mode"] = Module["asm"]["T"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_links_count = Module["_node_ext2fs_stat_i_links_count"] = function() {
            return (_node_ext2fs_stat_i_links_count = Module["_node_ext2fs_stat_i_links_count"] = Module["asm"]["U"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_uid = Module["_node_ext2fs_stat_i_uid"] = function() {
            return (_node_ext2fs_stat_i_uid = Module["_node_ext2fs_stat_i_uid"] = Module["asm"]["V"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_gid = Module["_node_ext2fs_stat_i_gid"] = function() {
            return (_node_ext2fs_stat_i_gid = Module["_node_ext2fs_stat_i_gid"] = Module["asm"]["W"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_blocksize = Module["_node_ext2fs_stat_blocksize"] = function() {
            return (_node_ext2fs_stat_blocksize = Module["_node_ext2fs_stat_blocksize"] = Module["asm"]["X"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_size = Module["_node_ext2fs_stat_i_size"] = function() {
            return (_node_ext2fs_stat_i_size = Module["_node_ext2fs_stat_i_size"] = Module["asm"]["Y"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_ino = Module["_node_ext2fs_stat_ino"] = function() {
            return (_node_ext2fs_stat_ino = Module["_node_ext2fs_stat_ino"] = Module["asm"]["Z"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_blocks = Module["_node_ext2fs_stat_i_blocks"] = function() {
            return (_node_ext2fs_stat_i_blocks = Module["_node_ext2fs_stat_i_blocks"] = Module["asm"]["_"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_atime = Module["_node_ext2fs_stat_i_atime"] = function() {
            return (_node_ext2fs_stat_i_atime = Module["_node_ext2fs_stat_i_atime"] = Module["asm"]["$"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_mtime = Module["_node_ext2fs_stat_i_mtime"] = function() {
            return (_node_ext2fs_stat_i_mtime = Module["_node_ext2fs_stat_i_mtime"] = Module["asm"]["aa"]).apply(null, arguments);
        };
        var _node_ext2fs_stat_i_ctime = Module["_node_ext2fs_stat_i_ctime"] = function() {
            return (_node_ext2fs_stat_i_ctime = Module["_node_ext2fs_stat_i_ctime"] = Module["asm"]["ba"]).apply(null, arguments);
        };
        var _node_ext2fs_umount = Module["_node_ext2fs_umount"] = function() {
            return (_node_ext2fs_umount = Module["_node_ext2fs_umount"] = Module["asm"]["ca"]).apply(null, arguments);
        };
        var stackSave = Module["stackSave"] = function() {
            return (stackSave = Module["stackSave"] = Module["asm"]["da"]).apply(null, arguments);
        };
        var stackRestore = Module["stackRestore"] = function() {
            return (stackRestore = Module["stackRestore"] = Module["asm"]["ea"]).apply(null, arguments);
        };
        var stackAlloc = Module["stackAlloc"] = function() {
            return (stackAlloc = Module["stackAlloc"] = Module["asm"]["fa"]).apply(null, arguments);
        };
        var dynCall_ii = Module["dynCall_ii"] = function() {
            return (dynCall_ii = Module["dynCall_ii"] = Module["asm"]["ga"]).apply(null, arguments);
        };
        var dynCall_iii = Module["dynCall_iii"] = function() {
            return (dynCall_iii = Module["dynCall_iii"] = Module["asm"]["ha"]).apply(null, arguments);
        };
        var dynCall_vi = Module["dynCall_vi"] = function() {
            return (dynCall_vi = Module["dynCall_vi"] = Module["asm"]["ia"]).apply(null, arguments);
        };
        var dynCall_iijj = Module["dynCall_iijj"] = function() {
            return (dynCall_iijj = Module["dynCall_iijj"] = Module["asm"]["ja"]).apply(null, arguments);
        };
        var dynCall_iij = Module["dynCall_iij"] = function() {
            return (dynCall_iij = Module["dynCall_iij"] = Module["asm"]["ka"]).apply(null, arguments);
        };
        var dynCall_viji = Module["dynCall_viji"] = function() {
            return (dynCall_viji = Module["dynCall_viji"] = Module["asm"]["la"]).apply(null, arguments);
        };
        var dynCall_iiji = Module["dynCall_iiji"] = function() {
            return (dynCall_iiji = Module["dynCall_iiji"] = Module["asm"]["ma"]).apply(null, arguments);
        };
        var dynCall_iijii = Module["dynCall_iijii"] = function() {
            return (dynCall_iijii = Module["dynCall_iijii"] = Module["asm"]["na"]).apply(null, arguments);
        };
        var dynCall_iijji = Module["dynCall_iijji"] = function() {
            return (dynCall_iijji = Module["dynCall_iijji"] = Module["asm"]["oa"]).apply(null, arguments);
        };
        var dynCall_iiijjii = Module["dynCall_iiijjii"] = function() {
            return (dynCall_iiijjii = Module["dynCall_iiijjii"] = Module["asm"]["pa"]).apply(null, arguments);
        };
        var dynCall_iiiiiiii = Module["dynCall_iiiiiiii"] = function() {
            return (dynCall_iiiiiiii = Module["dynCall_iiiiiiii"] = Module["asm"]["qa"]).apply(null, arguments);
        };
        var dynCall_iiiiii = Module["dynCall_iiiiii"] = function() {
            return (dynCall_iiiiii = Module["dynCall_iiiiii"] = Module["asm"]["ra"]).apply(null, arguments);
        };
        var dynCall_viiii = Module["dynCall_viiii"] = function() {
            return (dynCall_viiii = Module["dynCall_viiii"] = Module["asm"]["sa"]).apply(null, arguments);
        };
        var dynCall_iiiii = Module["dynCall_iiiii"] = function() {
            return (dynCall_iiiii = Module["dynCall_iiiii"] = Module["asm"]["ta"]).apply(null, arguments);
        };
        var dynCall_iiii = Module["dynCall_iiii"] = function() {
            return (dynCall_iiii = Module["dynCall_iiii"] = Module["asm"]["ua"]).apply(null, arguments);
        };
        var dynCall_iidiiii = Module["dynCall_iidiiii"] = function() {
            return (dynCall_iidiiii = Module["dynCall_iidiiii"] = Module["asm"]["va"]).apply(null, arguments);
        };
        var dynCall_vii = Module["dynCall_vii"] = function() {
            return (dynCall_vii = Module["dynCall_vii"] = Module["asm"]["wa"]).apply(null, arguments);
        };
        var dynCall_jiji = Module["dynCall_jiji"] = function() {
            return (dynCall_jiji = Module["dynCall_jiji"] = Module["asm"]["xa"]).apply(null, arguments);
        };
        var _asyncify_start_unwind = Module["_asyncify_start_unwind"] = function() {
            return (_asyncify_start_unwind = Module["_asyncify_start_unwind"] = Module["asm"]["ya"]).apply(null, arguments);
        };
        var _asyncify_stop_unwind = Module["_asyncify_stop_unwind"] = function() {
            return (_asyncify_stop_unwind = Module["_asyncify_stop_unwind"] = Module["asm"]["za"]).apply(null, arguments);
        };
        var _asyncify_start_rewind = Module["_asyncify_start_rewind"] = function() {
            return (_asyncify_start_rewind = Module["_asyncify_start_rewind"] = Module["asm"]["Aa"]).apply(null, arguments);
        };
        var _asyncify_stop_rewind = Module["_asyncify_stop_rewind"] = function() {
            return (_asyncify_stop_rewind = Module["_asyncify_stop_rewind"] = Module["asm"]["Ba"]).apply(null, arguments);
        };
        Module["ccall"] = ccall;
        var calledRun;
        function ExitStatus(status) {
            this.name = "ExitStatus";
            this.message = "Program terminated with exit(" + status + ")";
            this.status = status;
        }
        dependenciesFulfilled = function runCaller() {
            if (!calledRun) run();
            if (!calledRun) dependenciesFulfilled = runCaller;
        };
        function run(args) {
            args = args || arguments_;
            if (runDependencies > 0) {
                return;
            }
            preRun();
            if (runDependencies > 0) return;
            function doRun() {
                if (calledRun) return;
                calledRun = true;
                Module["calledRun"] = true;
                if (ABORT) return;
                initRuntime();
                preMain();
                if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
                postRun();
            }
            if (Module["setStatus"]) {
                Module["setStatus"]("Running...");
                setTimeout((function() {
                    setTimeout((function() {
                        Module["setStatus"]("");
                    }), 1);
                    doRun();
                }), 1);
            } else {
                doRun();
            }
        }
        Module["run"] = run;
        if (Module["preInit"]) {
            if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ];
            while (Module["preInit"].length > 0) {
                Module["preInit"].pop()();
            }
        }
        noExitRuntime = true;
        run();
    }, (__unused_webpack_module, exports) => {
        "use strict";
        exports.CODE_TO_ERRNO = {
            E2BIG: 1,
            EACCES: 2,
            EADDRINUSE: 3,
            EADDRNOTAVAIL: 4,
            EAFNOSUPPORT: 5,
            EAGAIN: 6,
            EALREADY: 7,
            EBADF: 8,
            EBADMSG: 9,
            EBUSY: 10,
            ECANCELED: 11,
            ECHILD: 12,
            ECONNABORTED: 13,
            ECONNREFUSED: 14,
            ECONNRESET: 15,
            EDEADLOCK: 16,
            EDESTADDRREQ: 17,
            EDOM: 18,
            EDQUOT: 19,
            EEXIST: 20,
            EFAULT: 21,
            EFBIG: 22,
            EHOSTUNREACH: 23,
            EIDRM: 24,
            EILSEQ: 25,
            EINPROGRESS: 26,
            EINTR: 27,
            EINVAL: 28,
            EIO: 29,
            EISCONN: 30,
            EISDIR: 31,
            ELOOP: 32,
            EMFILE: 33,
            EMLINK: 34,
            EMSGSIZE: 35,
            EMULTIHOP: 36,
            ENAMETOOLONG: 37,
            ENETDOWN: 38,
            ENETRESET: 39,
            ENETUNREACH: 40,
            ENFILE: 41,
            ENOBUFS: 42,
            ENODEV: 43,
            ENOENT: 44,
            ENOEXEC: 45,
            ENOLCK: 46,
            ENOLINK: 47,
            ENOMEM: 48,
            ENOMSG: 49,
            ENOPROTOOPT: 50,
            ENOSPC: 51,
            ENOSYS: 52,
            ENOTCONN: 53,
            ENOTDIR: 54,
            ENOTEMPTY: 55,
            ENOTRECOVERABLE: 56,
            ENOTSOCK: 57,
            ENOTTY: 59,
            ENXIO: 60,
            EOVERFLOW: 61,
            EOWNERDEAD: 62,
            EPERM: 63,
            EPIPE: 64,
            EPROTO: 65,
            EPROTONOSUPPORT: 66,
            EPROTOTYPE: 67,
            ERANGE: 68,
            EROFS: 69,
            ESPIPE: 70,
            ESRCH: 71,
            ESTALE: 72,
            ETIMEDOUT: 73,
            ETXTBSY: 74,
            EXDEV: 75
        };
        exports.ERRNO_TO_CODE = {};
        for (const [key, value] of Object.entries(exports.CODE_TO_ERRNO)) {
            exports.ERRNO_TO_CODE[value] = key;
        }
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        const {ERRNO_TO_CODE} = __webpack_require__(99);
        const Module = __webpack_require__(98);
        const queue = __webpack_require__(101);
        async function promiseToCallback(promise, callback) {
            try {
                const result = await promise;
                callback(null, result);
            } catch (error) {
                callback(error);
            }
        }
        exports.promiseToCallback = promiseToCallback;
        class ErrnoException extends Error {
            constructor(errno, syscall, args) {
                const code = ERRNO_TO_CODE[errno] || "UNKNOWN";
                super(`${syscall} ${code} (${errno}) args: ${JSON.stringify(args)}`);
                this.name = "ErrnoException";
                this.errno = errno;
                this.syscall = syscall;
                this.code = code;
            }
        }
        exports.ErrnoException = ErrnoException;
        function ccallThrow(name, returnType, argsType, args) {
            const result = Module.ccall(name, returnType, argsType, args);
            if (result < 0) {
                throw new ErrnoException(-result, name, args);
            }
            return result;
        }
        exports.ccallThrow = ccallThrow;
        async function ccallThrowAsync(name, returnType, argsType, args) {
            const result = await queue.addOperation(Module.ccall, [ name, returnType, argsType, args, {
                async: true
            } ]);
            if (result < 0) {
                throw new ErrnoException(-result, name, args);
            }
            return result;
        }
        exports.ccallThrowAsync = ccallThrowAsync;
        async function withHeapBuffer(length, fn) {
            const heapBufferPointer = ccallThrow("malloc_from_js", "number", [ "number" ], [ length ]);
            const heapBuffer = Module.getBuffer(heapBufferPointer, length);
            try {
                return await fn(heapBuffer, heapBufferPointer);
            } finally {
                ccallThrow("free_from_js", "void", [ "number" ], [ heapBufferPointer ]);
            }
        }
        exports.withHeapBuffer = withHeapBuffer;
        function rstripSlashesBuffer(buf) {
            while (buf[buf.length - 1] === 47) {
                buf = buf.slice(0, buf.length - 1);
            }
            return buf;
        }
        async function withPathAsHeapBuffer(path, fn) {
            if (!Buffer.isBuffer(path)) {
                path = Buffer.from(path);
            }
            path = rstripSlashesBuffer(path);
            const length = path.length + 1;
            return await withHeapBuffer(length, (async (heapBuffer, heapBufferPointer) => {
                heapBuffer[length - 1] = 0;
                path.copy(heapBuffer);
                return await fn(heapBufferPointer);
            }));
        }
        exports.withPathAsHeapBuffer = withPathAsHeapBuffer;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        let running = false;
        const queue = [];
        async function run() {
            running = true;
            if (queue.length === 0) {
                running = false;
                return;
            }
            const {fn, args, resolve, reject} = queue.shift();
            try {
                resolve(await fn(...args));
            } catch (error) {
                reject(error);
            } finally {
                await run();
            }
        }
        exports.addOperation = function(fn, args) {
            return new Promise(((resolve, reject) => {
                queue.push({
                    fn,
                    args,
                    resolve,
                    reject
                });
                if (!running) {
                    run();
                }
            }));
        };
    }, module => {
        "use strict";
        module.exports = require("buffer");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var events = __webpack_require__(41), streams = __webpack_require__(17), fifolock = __webpack_require__(104), S = __webpack_require__(105), _ = __webpack_require__(107);
        exports.createFileSystem = function(volume, opts, cb) {
            if (typeof opts === "function") {
                cb = opts;
                opts = null;
            }
            opts = _.extend({
                ro: false,
                noatime: true,
                modmode: 73,
                umask: "umask" in process ? process.umask() : 18,
                uid: "getuid" in process ? process.getuid() : 0,
                gid: "getgid" in process ? process.getgid() : 0
            }, opts);
            if (!volume.writeSectors) opts.ro = true;
            if (opts.ro) opts.noatime = true;
            var fs = new events.EventEmitter, vol = null, dir = __webpack_require__(109), c = __webpack_require__(110), q = fifolock();
            var GROUP = _.log.level < _.log.INFO ? q.TRANSACTION_WRAPPER.bind({
                postAcquire: function(proceed) {
                    _.log(_.log.DBG, "=== Starting GROUP ===");
                    proceed();
                },
                preRelease: function(finish) {
                    _.log(_.log.DBG, "=== Finishing GROUP ===");
                    finish();
                }
            }) : q.TRANSACTION_WRAPPER;
            q.acquire((function(unlock) {
                var d = _.allocBuffer(volume.sectorSize);
                volume.readSectors(0, d, (function(e) {
                    if (e) fs.emit("error", e); else {
                        try {
                            init(d);
                        } catch (e) {
                            fs.emit("error", e);
                            unlock();
                            return;
                        }
                        fs.emit("ready");
                    }
                    unlock();
                }));
            }));
            if (cb) fs.on("error", cb).on("ready", cb.bind(null, null));
            function init(bootSector) {
                vol = __webpack_require__(111).init(volume, opts, bootSector);
                fs._dirIterator = dir.iterator.bind(dir);
                var entryInfoByPath = {}, baseEntry = {
                    _refs: 0,
                    _record: function() {
                        entryInfoByPath[this.path] = this;
                        if (this.parent) this.parent.retain();
                        return this;
                    },
                    retain: function() {
                        if (!this._refs) this._record();
                        this._refs += 1;
                        return this;
                    },
                    release: function() {
                        this._refs -= 1;
                        if (!this._refs) this._rescind();
                    },
                    _rescind: function() {
                        if (this.parent) this.parent.release();
                        delete entryInfoByPath[this.path];
                    }
                };
                fs._createSharedEntry = function(path, entry, chain, parent) {
                    return _.extend(Object.create(baseEntry), {
                        _refs: 0,
                        path,
                        entry,
                        chain,
                        parent
                    }).retain();
                };
                fs._createSharedEntry("/", {
                    Attr: {
                        directory: true
                    }
                }, vol.rootDirectoryChain);
                fs._sharedEntryForSteps = function(steps, opts, cb) {
                    var path = steps.join("/") || "/", name = steps.pop(), info = entryInfoByPath[path];
                    if (info) cb(null, info.retain()); else fs._sharedEntryForSteps(steps, {}, (function(e, parentInfo) {
                        if (e) cb(e); else if (!parentInfo.entry.Attr.directory) cb(S.err.NOTDIR()); else dir.findInDirectory(vol, parentInfo.chain, name, opts, (function(e, entry) {
                            if (e && !opts.prepareForCreate) cb(e); else if (e) cb(e, {
                                missingChild: _.extend(entry, {
                                    name
                                }),
                                parent: parentInfo
                            }); else cb(null, fs._createSharedEntry(path, entry, vol.chainForCluster(entry._firstCluster), parentInfo));
                        }));
                    }));
                };
                fs._updateEntry = dir.updateEntry.bind(dir, vol);
                fs._makeStat = dir.makeStat.bind(dir, vol);
                fs._addFile = dir.addFile.bind(dir, vol);
                fs._initDir = dir.init.bind(dir, vol);
            }
            var fileDescriptors = [ null, null, null ];
            fs.open = function(path, flags, mode, cb, _n_) {
                if (typeof mode === "function") {
                    _n_ = cb;
                    cb = mode;
                    mode = 438;
                }
                cb = GROUP(cb, (function() {
                    var _fd = {
                        flags: null,
                        entry: null,
                        chain: null,
                        pos: 0
                    }, f = _.parseFlags(flags);
                    if (vol.opts.ro && (f.write || f.create || f.truncate)) return _.delayedCall(cb, S.err.ROFS()); else _fd.flags = f;
                    fs._sharedEntryForSteps(_.absoluteSteps(path), {
                        prepareForCreate: f.create
                    }, (function(e, info) {
                        if (e && !(e.code === "NOENT" && f.create && info)) cb(e); else if (e) fs._addFile(info.parent.chain, info.missingChild, {
                            dir: f._openDir
                        }, (function(e, newEntry, newChain) {
                            if (e) cb(e); else finish(fs._createSharedEntry(_.absolutePath(path), newEntry, newChain, info.parent));
                        })); else if (info && f.exclusive) cb(S.err.EXIST()); else if (info.entry.Attr.directory && !f._openDir) cb(S.err.ISDIR()); else if (f.write && info.entry.Attr.readonly) cb(S.err.ACCES()); else finish(info);
                        function finish(fileInfo) {
                            var fd = fileDescriptors.push(_fd) - 1;
                            _fd.info = fileInfo;
                            _fd.entry = fileInfo.entry;
                            _fd.chain = fileInfo.chain;
                            if (f.append) _fd.pos = _fd.entry._size;
                            if (f._openDir) _fd.chain.cacheAdvice = "WILLNEED";
                            if (f.truncate && _fd.entry._size) fs.ftruncate(fd, 0, (function(e) {
                                cb(e, fd);
                            }), "_nested_"); else _.delayedCall(cb, null, fd);
                        }
                    }));
                }), _n_ === "_nested_");
            };
            fs.fstat = function(fd, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.read) _.delayedCall(cb, S.err.BADF()); else _.delayedCall(cb, null, fs._makeStat(_fd.entry));
                }), _n_ === "_nested_");
            };
            fs.futimes = function(fd, atime, mtime, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.write) _.delayedCall(cb, S.err.BADF()); else fs._updateEntry(_fd.entry, {
                        atime: atime || true,
                        mtime: mtime || true
                    }, cb);
                }), _n_ === "_nested_");
            };
            fs.fchmod = function(fd, mode, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.write) _.delayedCall(cb, S.err.BADF()); else {
                        mode &= S._I._chmoddable;
                        if (_fd.entry.Attr.directory) mode |= S._I.FDIR; else if (!_fd.entry.Attr.volume_id) mode |= S._I.FREG;
                        fs._updateEntry(_fd.entry, {
                            mode
                        }, cb);
                    }
                }), _n_ === "_nested_");
            };
            fs.read = function(fd, buf, off, len, pos, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.read) _.delayedCall(cb, S.err.BADF());
                    var _pos = pos === null ? _fd.pos : pos, _len = Math.min(len, _fd.entry._size - _pos), _buf = buf.slice(off, off + _len);
                    _fd.chain.readFromPosition(_pos, _buf, (function(e, bytes, slice) {
                        if (_.workaroundTessel380) _buf.copy(buf, off);
                        _fd.pos = _pos + bytes;
                        if (e || vol.opts.noatime) finish(e); else fs._updateEntry(_fd.entry, {
                            atime: true
                        }, finish);
                        function finish(e) {
                            cb(e, bytes, buf);
                        }
                    }));
                }), _n_ === "_nested_");
            };
            fs._readdir = function(fd, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.read) _.delayedCall(cb, S.err.BADF()); else {
                        var entryNames = [], getNextEntry = fs._dirIterator(_fd.chain);
                        function processNext() {
                            getNextEntry((function(e, d) {
                                if (e) cb(e); else if (!d && !entryNames.length) cb(null, entryNames); else if (!d) cb(null, entryNames.sort()); else {
                                    if (d._name !== "." && d._name !== "..") entryNames.push(d._name);
                                    processNext();
                                }
                            }));
                        }
                        processNext();
                    }
                }), _n_ === "_nested_");
            };
            fs._mkdir = function(fd, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.write) _.delayedCall(cb, S.err.BADF()); else fs._initDir(_fd.info, cb);
                }), _n_ === "_nested_");
            };
            fs.write = function(fd, buf, off, len, pos, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.write) _.delayedCall(cb, S.err.BADF());
                    var _pos = pos === null || _fd.flags.append ? _fd.pos : pos, _buf = buf.slice(off, off + len);
                    if (_pos > _fd.entry._size) {
                        var padLen = _pos - _fd.entry._size, padBuf = _.allocBuffer(padLen + _buf.length);
                        padBuf.fill(0, 0, padLen);
                        _buf.copy(padBuf, padLen);
                        _pos = _fd.entry._size;
                        _buf = padBuf;
                    }
                    _fd.chain.writeToPosition(_pos, _buf, (function(e) {
                        _fd.pos = _pos + len;
                        var newSize = Math.max(_fd.entry._size, _fd.pos), newInfo = {
                            size: newSize,
                            _touch: true
                        };
                        fs._updateEntry(_fd.entry, newInfo, (function(ee) {
                            cb(e || ee, len, buf);
                        }));
                    }));
                }), _n_ === "_nested_");
            };
            fs.ftruncate = function(fd, len, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.write) _.delayedCall(cb, S.err.BADF());
                    var newStats = {
                        size: len,
                        _touch: true
                    };
                    if (len === _fd.entry._size) _.delayedCall(cb); else if (len < _fd.entry._size) fs._updateEntry(_fd.entry, newStats, (function(e) {
                        if (e) cb(e); else _fd.chain.truncate(Math.ceil(len / _fd.chain.sectorSize), cb);
                    })); else _fd.chain.writeToPosition(_fd.entry._size, _.allocBuffer(len - _fd.entry._size, 0), (function(e) {
                        if (e) cb(e); else fs._updateEntry(_fd.entry, newStats, cb);
                    }));
                }), _n_ === "_nested_");
            };
            fs._fadviseSync = function(fd, off, len, advice) {
                if (off !== 0 || len !== 0) throw Error("Cache advise can currently be given only for whole file!");
                var _fd = fileDescriptors[fd];
                if (!_fd) throw S.err.BADF(); else _fd.chain.cacheAdvice = advice;
            };
            fs.fsync = function(fd, cb) {
                var _fd = fileDescriptors[fd];
                if (!_fd) _.delayedCall(cb, S.err.BADF()); else _.delayedCall(cb);
            };
            fs.close = function(fd, cb) {
                var _fd = fileDescriptors[fd];
                if (!_fd) _.delayedCall(cb, S.err.BADF()); else setTimeout(_fd.info.release.bind(_fd.info), 500), 
                _.delayedCall(cb, fileDescriptors[fd] = null);
            };
            var workaroundTessel436;
            try {
                new __webpack_require__(17).Readable({
                    encoding: "utf8"
                });
                new streams.Readable({
                    encoding: "utf8"
                });
            } catch (e) {
                workaroundTessel436 = true;
            }
            function _createStream(StreamType, path, opts) {
                if (workaroundTessel436 && "encoding" in opts) {
                    console.warn("Tessel does not currently support encoding option for Readable streams, discarding!");
                    delete opts.encoding;
                }
                var fd = opts.fd !== null ? opts.fd : "_opening_", pos = opts.start, stream = new StreamType(opts);
                if (fd === "_opening_") fs.open(path, opts.flags, opts.mode, (function(e, _fd) {
                    if (e) {
                        fd = "_open_error_";
                        stream.emit("error", e);
                    } else {
                        fd = _fd;
                        fs._fadviseSync(fd, 0, 0, "SEQUENTIAL");
                        stream.emit("open", fd);
                    }
                }));
                function autoClose(tombstone) {
                    if (opts.autoClose) fs.close(fd, (function(e) {
                        if (e) stream.emit("error", e); else stream.emit("close");
                    }));
                    fd = tombstone;
                }
                if (StreamType === streams.Readable) {
                    stream._read = function(n) {
                        var buf;
                        n = Math.min(n, opts.end - pos);
                        if (fd === "_opening_") stream.once("open", (function() {
                            stream._read(n);
                        })); else if (pos > opts.end) stream.push(null); else if (n > 0) buf = _.allocBuffer(n), 
                        fs.read(fd, buf, 0, n, pos, (function(e, n, d) {
                            if (e) {
                                autoClose("_read_error_");
                                stream.emit("error", e);
                            } else stream.push(n ? d.slice(0, n) : null);
                        })), pos += n; else stream.push(null);
                    };
                    stream.once("end", (function() {
                        autoClose("_ended_");
                    }));
                } else if (StreamType === streams.Writable) {
                    stream.bytesWritten = 0;
                    stream._write = function(data, _enc, cb) {
                        if (fd === "_opening_") stream.once("open", (function() {
                            stream._write(data, null, cb);
                        })); else fs.write(fd, data, 0, data.length, pos, (function(e, n) {
                            if (e) {
                                autoClose("_write_error_");
                                cb(e);
                            } else {
                                stream.bytesWritten += n;
                                cb();
                            }
                        })), pos += data.length;
                    };
                    stream.once("finish", (function() {
                        autoClose("_finished_");
                    }));
                }
                return stream;
            }
            fs.createReadStream = function(path, opts) {
                return _createStream(streams.Readable, path, _.extend({
                    start: 0,
                    end: Infinity,
                    flags: "r",
                    mode: 438,
                    encoding: null,
                    fd: null,
                    autoClose: true
                }, opts));
            };
            fs.createWriteStream = function(path, opts) {
                return _createStream(streams.Writable, path, _.extend({
                    start: 0,
                    flags: "w",
                    mode: 438,
                    fd: null,
                    autoClose: true
                }, opts, {
                    decodeStrings: true,
                    objectMode: false
                }));
            };
            function _fdOperation(path, opts, fn, cb) {
                cb = GROUP(cb, (function() {
                    opts.advice || (opts.advice = "NORMAL");
                    fs.open(path, opts.flag, (function(e, fd) {
                        if (e) cb(e); else fs._fadviseSync(fd, 0, 0, opts.advice), fn(fd, (function() {
                            var ctx = this, args = arguments;
                            fs.close(fd, (function(closeErr) {
                                cb.apply(ctx, args);
                            }), "_nested_");
                        }));
                    }), "_nested_");
                }));
            }
            fs.stat = fs.lstat = function(path, cb) {
                _fdOperation(path, {
                    flag: "r"
                }, (function(fd, cb) {
                    fs.fstat(fd, cb, "_nested_");
                }), cb);
            };
            fs.exists = function(path, cb) {
                fs.stat(path, (function(err) {
                    cb(err ? false : true);
                }));
            };
            fs.readFile = function(path, opts, cb) {
                if (typeof opts === "function") {
                    cb = opts;
                    opts = {};
                }
                opts.flag || (opts.flag = "r");
                opts.advice || (opts.advice = "NOREUSE");
                _fdOperation(path, opts, (function(fd, cb) {
                    fs.fstat(fd, (function(e, stat) {
                        if (e) return cb(e); else {
                            var buffer = _.allocBuffer(stat.size);
                            fs.read(fd, buffer, 0, buffer.length, null, (function(e) {
                                if (e) cb(e); else cb(null, opts.encoding ? buffer.toString(opts.encoding) : buffer);
                            }), "_nested_");
                        }
                    }), "_nested_");
                }), cb);
            };
            fs.writeFile = function(path, data, opts, cb) {
                if (typeof opts === "function") {
                    cb = opts;
                    opts = {};
                }
                opts.flag || (opts.flag = "w");
                opts.advice || (opts.advice = "NOREUSE");
                _fdOperation(path, opts, (function(fd, cb) {
                    if (typeof data === "string") data = _.bufferFrom(data, opts.encoding || "utf8");
                    fs.write(fd, data, 0, data.length, null, (function(e) {
                        cb(e);
                    }), "_nested_");
                }), cb);
            };
            fs.appendFile = function(path, data, opts, cb) {
                if (typeof opts === "function") {
                    cb = opts;
                    opts = {};
                }
                opts.flag || (opts.flag = "a");
                fs.writeFile(path, data, opts, cb);
            };
            fs.truncate = function(path, len, cb) {
                _fdOperation(path, {
                    flag: "r+"
                }, (function(fd, cb) {
                    fs.ftruncate(fd, len, cb, "_nested_");
                }), cb);
            };
            fs.readdir = function(path, cb) {
                _fdOperation(path, {
                    flag: "\\r"
                }, (function(fd, cb) {
                    fs._readdir(fd, cb, "_nested_");
                }), cb);
            };
            fs.mkdir = function(path, mode, cb) {
                if (typeof mode === "function") {
                    cb = mode;
                    mode = 511;
                }
                _fdOperation(path, {
                    flag: "\\wx"
                }, (function(fd, cb) {
                    fs._mkdir(fd, cb, "_nested_");
                }), cb);
            };
            fs.utimes = function(path, atime, mtime, cb) {
                _fdOperation(path, {
                    flag: "r+"
                }, (function(fd, cb) {
                    fs.futimes(fd, atime, mtime, cb, "_nested_");
                }), cb);
            };
            fs.chmod = fs.lchmod = function(path, mode, cb) {
                _fdOperation(path, {
                    flag: "\\r+"
                }, (function(fd, cb) {
                    fs.fchmod(fd, mode, cb, "_nested_");
                }), cb);
            };
            fs.chown = fs.lchown = function(path, uid, gid, cb) {
                _fdOperation(path, {
                    flag: "\\r+"
                }, (function(fd, cb) {
                    fs.fchown(fd, uid, gid, cb, "_nested_");
                }), cb);
            };
            fs.link = function(src, dst, cb) {
                _.delayedCall(cb, S.err.NOSYS());
            };
            fs.symlink = function(src, dst, type, cb) {
                if (typeof type === "function") {
                    cb = type;
                    type = null;
                }
                _.delayedCall(cb, S.err.NOSYS());
            };
            fs.readlink = function(path, cb) {
                _fdOperation(path, {
                    flag: "\\r"
                }, (function(fd, cb) {
                    cb(S.err.INVAL());
                }), cb);
            };
            fs.realpath = function(path, cache, cb) {
                if (typeof cache === "function") {
                    cb = cache;
                    cache = null;
                }
                if (cache) _.delayedCall(cb, S.err.NOSYS()); else _fdOperation(path, {
                    flag: "\\r"
                }, (function(fd, cb) {
                    cb(null, _.absolutePath(path));
                }), cb);
            };
            fs.fchown = function(fd, uid, gid, cb, _n_) {
                cb = GROUP(cb, (function() {
                    var _fd = fileDescriptors[fd];
                    if (!_fd || !_fd.flags.write) _.delayedCall(cb, S.err.BADF()); else _.delayedCall(cb, S.err.NOSYS());
                }), _n_ === "_nested_");
            };
            return fs;
        };
    }, module => {
        module.exports = function SerialQueue() {
            var q = {}, tasks = [];
            function runNext() {
                tasks[0]((function() {
                    tasks.shift();
                    if (tasks.length) runNext();
                }));
            }
            q.acquire = function(fn) {
                var len = tasks.push(fn);
                if (len === 1) process.nextTick(runNext);
            };
            q.TRANSACTION_WRAPPER = function(cb, proceed, nested) {
                if (nested) return process.nextTick(proceed), cb;
                var _releaseQueue;
                if ("postAcquire" in this) proceed = this.postAcquire.bind(q, proceed);
                q.acquire((function(releaseQueue) {
                    _releaseQueue = releaseQueue;
                    proceed();
                }));
                var capturedCB, finish = "preRelease" in this ? this.preRelease.bind(q, _finish) : _finish;
                function _finish() {
                    capturedCB();
                    _releaseQueue();
                }
                return function() {
                    capturedCB = Function.prototype.apply.bind(cb, this, arguments);
                    finish.call(null, Array.prototype.slice.call(arguments, 0), this);
                };
            };
            return q;
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var _ = __webpack_require__(106), __ = __webpack_require__(107);
        var bootBase = _.struct([ _.byte("jmpBoot", 3), _.char("OEMName", 8), _.uint16le("BytsPerSec"), _.uint8("SecPerClus"), _.uint16le("ResvdSecCnt"), _.uint8("NumFATs"), _.uint16le("RootEntCnt"), _.uint16le("TotSec16"), _.uint8("Media"), _.uint16le("FATSz16"), _.uint16le("SecPerTrk"), _.uint16le("NumHeads"), _.uint32le("HiddSec"), _.uint32le("TotSec32") ]);
        var bootInfo = _.struct([ _.uint8("DrvNum"), _.uint8("Reserved1"), _.uint8("BootSig"), _.uint32le("VolID"), _.char("VolLab", 11), _.char("FilSysType", 8) ]);
        exports.boot16 = _.struct([ bootBase, bootInfo ]);
        exports.boot32 = _.struct([ bootBase, _.uint32le("FATSz32"), _.struct("ExtFlags", [ _.ubit("NumActiveFAT", 4), _.ubit("_reserved1", 3), _.bool("MirroredFAT"), _.ubit("_reserved2", 8) ].reverse()), _.struct("FSVer", [ _.uint8("Major"), _.uint8("Minor") ]), _.uint32le("RootClus"), _.uint16le("FSInfo"), _.uint16le("BkBootSec"), _.byte("Reserved", 12), bootInfo ]);
        var _time = _.struct([ _.ubit("hours", 5), _.ubit("minutes", 6), _.ubit("seconds_2", 5) ]), time = {
            valueFromBytes: function(buf, off) {
                off || (off = {
                    bytes: 0
                });
                var _buf = __.bufferFrom([ buf[off.bytes + 1], buf[off.bytes + 0] ]), val = _time.valueFromBytes(_buf);
                off.bytes += this.size;
                return val;
            },
            bytesFromValue: function(val, buf, off) {
                val || (val = {
                    hours: 0,
                    minutes: 0,
                    seconds_2: 0
                });
                buf || (buf = __.allocBuffer(this.size));
                off || (off = {
                    bytes: 0
                });
                var _buf = _time.bytesFromValue(val);
                buf[off.bytes + 1] = _buf[0];
                buf[off.bytes + 0] = _buf[1];
                off.bytes += this.size;
                return buf;
            },
            size: _time.size
        };
        var _date = _.struct([ _.ubit("year", 7), _.ubit("month", 4), _.ubit("day", 5) ]), date = {
            valueFromBytes: function(buf, off) {
                off || (off = {
                    bytes: 0
                });
                var _buf = __.bufferFrom([ buf[off.bytes + 1], buf[off.bytes + 0] ]), val = _date.valueFromBytes(_buf);
                off.bytes += this.size;
                return val;
            },
            bytesFromValue: function(val, buf, off) {
                val || (val = {
                    year: 0,
                    month: 0,
                    day: 0
                });
                buf || (buf = __.allocBuffer(this.size));
                off || (off = {
                    bytes: 0
                });
                var _buf = _date.bytesFromValue(val);
                buf[off.bytes + 1] = _buf[0];
                buf[off.bytes + 0] = _buf[1];
                off.bytes += this.size;
                return buf;
            },
            size: _date.size
        };
        exports.dirEntry = _.struct([ _.struct("Name", [ _.char("filename", 8), _.char("extension", 3) ]), _.struct("Attr", [ _.bool("readonly"), _.bool("hidden"), _.bool("system"), _.bool("volume_id"), _.bool("directory"), _.bool("archive"), _.ubit("reserved", 2) ].reverse()), _.byte("NTRes", 1), _.uint8("CrtTimeTenth"), _.struct("CrtTime", [ time ]), _.struct("CrtDate", [ date ]), _.struct("LstAccDate", [ date ]), _.uint16le("FstClusHI"), _.struct("WrtTime", [ time ]), _.struct("WrtDate", [ date ]), _.uint16le("FstClusLO"), _.uint32le("FileSize") ]);
        exports.entryDoneFlag = 0;
        exports.entryFreeFlag = 229;
        exports.entryIsE5Flag = 5;
        exports.dirEntry_simple = _.struct([ _.struct("Name", [ _.char("filename", 8), _.char("extension", 3) ]), _.padTo(exports.dirEntry.size) ]);
        exports.lastLongFlag = 64;
        exports.longDirFlag = 15;
        exports.longDirEntry = _.struct([ _.uint8("Ord"), _.char16le("Name1", 10), _.uint8("Attr_raw"), _.uint8("Type"), _.uint8("Chksum"), _.char16le("Name2", 12), _.uint16le("FstClusLO"), _.char16le("Name3", 4) ]);
        if (exports.longDirEntry.size !== exports.dirEntry.size) throw Error("Structs ain't right!");
        exports.fatField = {
            fat12: _.struct("Status", [ _.ubit("field0bc", 8), _.ubit("field1c", 4), _.ubit("field0a", 4), _.ubit("field1ab", 8) ]),
            fat16: _.uint16le("Status"),
            fat32: _.uint32le("Status")
        };
        exports.fatPrefix = {
            fat12: 3840,
            fat16: 65280,
            fat32: 268435200
        };
        exports.fatStat = {
            free: 0,
            _undef: 1,
            rsvMin: 240,
            bad: 247,
            eofMin: 248,
            eof: 255
        };
        exports._I = {
            RUSR: 256,
            WUSR: 128,
            XUSR: 64,
            RGRP: 32,
            WGRP: 16,
            XGRP: 8,
            ROTH: 4,
            WOTH: 2,
            XOTH: 1,
            SUID: 2048,
            SGID: 1024,
            SVTX: 512,
            FDIR: 16384,
            FREG: 32768
        };
        exports._I.RWXU = exports._I.RUSR | exports._I.WUSR | exports._I.XUSR;
        exports._I.RWXG = exports._I.RGRP | exports._I.WGRP | exports._I.XGRP;
        exports._I.RWXO = exports._I.ROTH | exports._I.WOTH | exports._I.XOTH;
        exports._I._sss = exports._I.SUID | exports._I.SGID | exports._I.SVTX;
        exports._I._chmoddable = exports._I.RWXU | exports._I.RWXG | exports._I.RWXO | exports._I._sss;
        var _errors = {
            IO: "Input/output error",
            NOENT: "No such file or directory",
            INVAL: "Invalid argument",
            EXIST: "File exists",
            NAMETOOLONG: "Filename too long",
            NOSPC: "No space left on device",
            NOSYS: "Function not supported",
            ROFS: "ROFLCopter file system",
            NOTDIR: "Not a directory",
            BADF: "Bad file descriptor",
            EXIST: "File exists",
            ISDIR: "Is a directory",
            ACCES: "Permission denied",
            NOSYS: "Function not implemented",
            _TODO: "Not implemented yet!"
        };
        exports.err = {};
        Object.keys(_errors).forEach((function(sym) {
            var msg = _errors[sym];
            exports.err[sym] = function() {
                var e = new Error(msg);
                e.code = sym;
                return e;
            };
        }));
    }, module => {
        var _ = {};
        function truncatedReadUInt32BE(buffer, offset) {
            var availableBytes = buffer.length - offset;
            if (availableBytes >= 4) {
                return buffer.readUInt32BE(offset);
            } else if (availableBytes === 3) {
                var first = buffer.readUInt16BE(offset);
                var second = buffer.readUInt8(offset + 2);
                return (first << 8) + second << 8 >>> 0;
            } else if (availableBytes === 2) {
                return buffer.readUInt16BE(offset) << 16 >>> 0;
            } else if (availableBytes === 1) {
                return buffer.readUInt8(offset) << 24 >>> 0;
            } else if (availableBytes <= 0) {
                return 0;
            }
        }
        function truncatedWriteUInt32BE(buffer, offset, data) {
            var availableBytes = buffer.length - offset;
            if (availableBytes >= 4) {
                buffer.writeUInt32BE(data, offset);
            } else if (availableBytes === 3) {
                buffer.writeUInt16BE(data >>> 16, offset);
                buffer.writeUInt8(data >>> 8 & 255, offset + 2);
            } else if (availableBytes === 2) {
                buffer.writeUInt16BE(data >>> 16, offset);
            } else if (availableBytes === 1) {
                buffer.writeUInt8(data >>> 24, offset);
            }
        }
        function newBuffer(size) {
            if (Buffer.alloc) {
                return Buffer.alloc(size);
            } else {
                return new Buffer(size);
            }
        }
        function extend(obj) {
            Array.prototype.slice.call(arguments, 1).forEach((function(ext) {
                Object.keys(ext).forEach((function(key) {
                    obj[key] = ext[key];
                }));
            }));
            return obj;
        }
        function addField(ctr, f) {
            if ("width" in f) {
                ctr.bits = (ctr.bits || 0) + f.width;
                while (ctr.bits > 7) {
                    ctr.bytes += 1;
                    ctr.bits -= 8;
                }
            } else if (!ctr.bits) {
                ctr.bytes += f.size;
            } else {
                throw Error("Improperly aligned bitfield before field: " + f.name);
            }
            return ctr;
        }
        function arrayizeField(f, count) {
            var f2 = typeof count === "number" ? extend({
                name: f.name,
                field: f,
                valueFromBytes: function(buf, off) {
                    off || (off = {
                        bytes: 0,
                        bits: 0
                    });
                    var arr = new Array(count);
                    for (var idx = 0, len = arr.length; idx < len; idx += 1) {
                        arr[idx] = f.valueFromBytes(buf, off);
                    }
                    return arr;
                },
                bytesFromValue: function(arr, buf, off) {
                    arr || (arr = new Array(count));
                    buf || (buf = newBuffer(this.size));
                    off || (off = {
                        bytes: 0,
                        bits: 0
                    });
                    for (var idx = 0, len = Math.min(arr.length, count); idx < len; idx += 1) {
                        f.bytesFromValue(arr[idx], buf, off);
                    }
                    while (idx++ < count) addField(off, f);
                    return buf;
                }
            }, "width" in f ? {
                width: f.width * count
            } : {
                size: f.size * count
            }) : f;
            f2.pack = f2.bytesFromValue;
            f2.unpack = f2.valueFromBytes;
            return f2;
        }
        _.struct = function(name, fields, count) {
            if (typeof name !== "string") {
                count = fields;
                fields = name;
                name = null;
            }
            var _size = {
                bytes: 0,
                bits: 0
            }, _padsById = Object.create(null), fieldsObj = fields.reduce((function(obj, f, i) {
                if ("_padTo" in f) {
                    f._id || (f._id = "id" + Math.random().toFixed(20).slice(2));
                    var _f = _padsById[f._id] = _size.bits ? {
                        width: 8 * (f._padTo - _size.bytes) - _size.bits
                    } : {
                        size: f._padTo - _size.bytes
                    };
                    if (_f.width < 0 || _f.size < 0) {
                        var xtraMsg = _size.bits ? " and " + _size.bits + " bits" : "";
                        throw Error("Invalid .padTo(" + f._padTo + ") field, struct is already " + _size.bytes + " byte(s)" + xtraMsg + "!");
                    }
                    f = _f;
                } else if (f._hoistFields) Object.keys(f._hoistFields).forEach((function(name) {
                    var _f = Object.create(f._hoistFields[name]);
                    if ("width" in _f) _f.offset = {
                        bytes: _f.offset.bytes + _size.bytes,
                        bits: _f.offset.bits
                    }; else _f.offset += _size.bytes;
                    obj[name] = _f;
                })); else if (f.name) {
                    f = Object.create(f);
                    f.offset = "width" in f ? {
                        bytes: _size.bytes,
                        bits: _size.bits
                    } : _size.bytes, obj[f.name] = f;
                }
                addField(_size, f);
                return obj;
            }), {});
            if (_size.bits) throw Error("Improperly aligned bitfield at end of struct: " + name);
            return arrayizeField({
                valueFromBytes: function(buf, off) {
                    off || (off = {
                        bytes: 0,
                        bits: 0
                    });
                    var obj = new Object;
                    fields.forEach((function(f) {
                        if ("_padTo" in f) return addField(off, _padsById[f._id]);
                        var value = f.valueFromBytes(buf, off);
                        if (f.name) obj[f.name] = value; else if (typeof value === "object") extend(obj, value);
                    }));
                    return obj;
                },
                bytesFromValue: function(obj, buf, off) {
                    obj || (obj = {});
                    buf || (buf = newBuffer(this.size));
                    off || (off = {
                        bytes: 0,
                        bits: 0
                    });
                    fields.forEach((function(f) {
                        if ("_padTo" in f) return addField(off, _padsById[f._id]);
                        var value = f.name ? obj[f.name] : obj;
                        f.bytesFromValue(value, buf, off);
                    }));
                    return buf;
                },
                _hoistFields: !name ? fieldsObj : null,
                fields: fieldsObj,
                size: _size.bytes,
                name
            }, count);
        };
        _.padTo = function(off) {
            return {
                _padTo: off
            };
        };
        var FULL = 4294967295;
        function bitfield(name, width, count) {
            width || (width = 1);
            if (width > 24) throw Error("Bitfields support a maximum width of 24 bits.");
            var impl = this, mask = FULL >>> 32 - width;
            return arrayizeField({
                valueFromBytes: function(buf, off) {
                    off || (off = {
                        bytes: 0,
                        bits: 0
                    });
                    var end = (off.bits || 0) + width, word = truncatedReadUInt32BE(buf, off.bytes) || 0, over = word >>> 32 - end;
                    addField(off, this);
                    return impl.b2v.call(this, over & mask);
                },
                bytesFromValue: function(val, buf, off) {
                    val = impl.v2b.call(this, val || 0);
                    off || (off = {
                        bytes: 0,
                        bits: 0
                    });
                    var end = (off.bits || 0) + width, word = truncatedReadUInt32BE(buf, off.bytes) || 0, zero = mask << 32 - end, over = (val & mask) << 32 - end;
                    word &= ~zero;
                    word |= over;
                    word >>>= 0;
                    truncatedWriteUInt32BE(buf, off.bytes, word);
                    addField(off, this);
                    return buf;
                },
                width,
                name
            }, count);
        }
        function swapBits(n, w) {
            var o = 0;
            while (w--) {
                o <<= 1;
                o |= n & 1;
                n >>>= 1;
            }
            return o;
        }
        _.bool = function(name, count) {
            return bitfield.call({
                b2v: function(b) {
                    return Boolean(b);
                },
                v2b: function(v) {
                    return v ? FULL : 0;
                }
            }, name, 1, count);
        };
        _.ubit = bitfield.bind({
            b2v: function(b) {
                return b;
            },
            v2b: function(v) {
                return v;
            }
        });
        _.ubitLE = bitfield.bind({
            b2v: function(b) {
                return swapBits(b, this.width);
            },
            v2b: function(v) {
                return swapBits(v, this.width);
            }
        });
        _.sbit = bitfield.bind({
            b2v: function(b) {
                var m = 1 << this.width - 1, s = b & m;
                return s ? -(b &= ~m) : b;
            },
            v2b: function(v) {
                var m = 1 << this.width - 1, s = v < 0;
                return s ? -v | m : v;
            }
        });
        function bytefield(name, size, count) {
            if (typeof name !== "string") {
                count = size;
                size = name;
                name = null;
            }
            size = typeof size === "number" ? size : 1;
            var impl = this;
            return arrayizeField({
                valueFromBytes: function(buf, off) {
                    off || (off = {
                        bytes: 0,
                        bits: 0
                    });
                    var val = buf.slice(off.bytes, off.bytes + this.size);
                    addField(off, this);
                    return impl.b2v.call(this, val);
                },
                bytesFromValue: function(val, buf, off) {
                    off || (off = {
                        bytes: 0
                    });
                    buf || (buf = newBuffer(this.size));
                    var blk = buf.slice(off.bytes, off.bytes + this.size), len = impl.vTb.call(this, val, blk);
                    if (len < blk.length) blk.fill(0, len);
                    addField(off, this);
                    return buf;
                },
                size,
                name
            }, count);
        }
        function swapBytesPairs(fromBuffer, toBuffer) {
            toBuffer = toBuffer || fromBuffer;
            var l = fromBuffer.length;
            for (var i = 1; i < l; i += 2) {
                var a = fromBuffer[i - 1];
                toBuffer[i - 1] = fromBuffer[i];
                toBuffer[i] = a;
            }
            return toBuffer;
        }
        _.byte = bytefield.bind({
            b2v: function(b) {
                return b;
            },
            vTb: function(v, b) {
                if (!v) return 0;
                v.copy(b);
                return v.length;
            }
        });
        _.char = bytefield.bind({
            b2v: function(b) {
                var v = b.toString("utf8"), z = v.indexOf("\0");
                return ~z ? v.slice(0, z) : v;
            },
            vTb: function(v, b) {
                v || (v = "");
                return b.write(v, "utf8");
            }
        });
        _.char16le = bytefield.bind({
            b2v: function(b) {
                var v = b.toString("utf16le"), z = v.indexOf("\0");
                return ~z ? v.slice(0, z) : v;
            },
            vTb: function(v, b) {
                v || (v = "");
                return b.write(v, "utf16le");
            }
        });
        _.char16be = bytefield.bind({
            b2v: function(b) {
                var temp = newBuffer(b.length);
                swapBytesPairs(b, temp);
                var v = temp.toString("utf16le"), z = v.indexOf("\0");
                return ~z ? v.slice(0, z) : v;
            },
            vTb: function(v, b) {
                v || (v = "");
                var len = b.write(v, "utf16le");
                swapBytesPairs(b);
                return len;
            }
        });
        function standardField(sig, size) {
            var read = "read" + sig, dump = "write" + sig;
            size || (size = +sig.match(/\d+/)[0] >> 3);
            return function(name, count) {
                if (typeof name !== "string") {
                    count = name;
                    name = null;
                }
                return arrayizeField({
                    valueFromBytes: function(buf, off) {
                        off || (off = {
                            bytes: 0
                        });
                        var val = buf[read](off.bytes);
                        addField(off, this);
                        return val;
                    },
                    bytesFromValue: function(val, buf, off) {
                        val || (val = 0);
                        buf || (buf = newBuffer(this.size));
                        off || (off = {
                            bytes: 0
                        });
                        buf[dump](val, off.bytes);
                        addField(off, this);
                        return buf;
                    },
                    size,
                    name
                }, count);
            };
        }
        _.float32 = standardField("FloatBE", 4);
        _.float64 = standardField("DoubleBE", 8);
        _.float32le = standardField("FloatLE", 4);
        _.float64le = standardField("DoubleLE", 8);
        _.uint8 = standardField("UInt8");
        _.uint16 = standardField("UInt16BE");
        _.uint32 = standardField("UInt32BE");
        _.uint16le = standardField("UInt16LE");
        _.uint32le = standardField("UInt32LE");
        _.int8 = standardField("Int8");
        _.int16 = standardField("Int16BE");
        _.int32 = standardField("Int32BE");
        _.int16le = standardField("Int16LE");
        _.int32le = standardField("Int32LE");
        _.derive = function(orig, pack, unpack) {
            return function(name, count) {
                if (typeof name !== "string") {
                    count = name;
                    name = null;
                }
                return arrayizeField(extend({
                    valueFromBytes: function(buf, off) {
                        return unpack(orig.valueFromBytes(buf, off));
                    },
                    bytesFromValue: function(val, buf, off) {
                        return orig.bytesFromValue(pack(val), buf, off);
                    },
                    name
                }, "width" in orig ? {
                    width: orig.width
                } : {
                    size: orig.size
                }), count);
            };
        };
        module.exports = _;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var S = __webpack_require__(105), _xok = __webpack_require__(108);
        exports.allocBuffer = Buffer.alloc || function(len, val) {
            var b = Buffer(len);
            if (arguments.length > 1) b.fill(val);
            return b;
        };
        exports.bufferFrom = Buffer.from || function(arg0, arg1) {
            return arguments.length > 1 ? Buffer(arg0, arg1) : Buffer(arg0);
        };
        exports.workaroundTessel380 = !Buffer.from && function() {
            var b = Buffer([ 0 ]), s = b.slice(0);
            return (s[0] = 255) !== b[0];
        }();
        var oldslice;
        if (!Buffer.alloc && Buffer(5).slice(10).length < 0) oldslice = Buffer.prototype.slice, 
        Buffer.prototype.slice = function(s, e) {
            if (s > this.length) s = this.length;
            return arguments.length > 1 ? oldslice.call(this, s, e) : oldslice.call(this, s);
        };
        exports.absoluteSteps = function(path) {
            var steps = [];
            path.split("/").forEach((function(str) {
                if (str === "..") steps.pop(); else if (str && str !== ".") steps.push(str);
            }));
            return steps.map(exports.longname);
        };
        exports.absolutePath = function(path) {
            return "/" + exports.absoluteSteps(path).join("/");
        };
        exports.parseFlags = function(flags) {
            var info, _dir;
            if (flags[0] === "\\") {
                flags = flags.slice(1);
                _dir = true;
            }
            switch (flags) {
              case "r":
                info = {
                    read: true,
                    write: false,
                    create: false
                };
                break;

              case "r+":
                info = {
                    read: true,
                    write: true,
                    create: false
                };
                break;

              case "rs":
                info = {
                    read: true,
                    write: false,
                    create: false,
                    sync: true
                };
                break;

              case "rs+":
                info = {
                    read: true,
                    write: true,
                    create: false,
                    sync: true
                };
                break;

              case "w":
                info = {
                    read: false,
                    write: true,
                    create: true,
                    truncate: true
                };
                break;

              case "wx":
                info = {
                    read: false,
                    write: true,
                    create: true,
                    exclusive: true
                };
                break;

              case "w+":
                info = {
                    read: true,
                    write: true,
                    create: true,
                    truncate: true
                };
                break;

              case "wx+":
                info = {
                    read: true,
                    write: true,
                    create: true,
                    exclusive: true
                };
                break;

              case "a":
                info = {
                    read: false,
                    write: true,
                    create: true,
                    append: true
                };
                break;

              case "ax":
                info = {
                    read: false,
                    write: true,
                    create: true,
                    append: true,
                    exclusive: true
                };
                break;

              case "a+":
                info = {
                    read: true,
                    write: true,
                    create: true,
                    append: true
                };
                break;

              case "ax+":
                info = {
                    read: true,
                    write: true,
                    create: true,
                    append: true,
                    exclusive: true
                };
                break;

              default:
                throw Error("Uknown mode: " + flags);
            }
            if (info.sync) throw Error("Mode not implemented.");
            if (_dir) info._openDir = true;
            return info;
        };
        var _snInvalid = /[^A-Z0-9$%'-_@~`!(){}^#&.]/g;
        exports.shortname = function(name) {
            var lossy = false;
            name = name.toUpperCase().replace(/ /g, "").replace(/^\.+/, "");
            name = name.replace(_snInvalid, (function() {
                lossy = true;
                return "_";
            }));
            var parts = name.split("."), basis3 = parts.pop(), basis8 = parts.join("");
            if (!parts.length) {
                basis8 = basis3;
                basis3 = "   ";
            }
            if (basis8.length > 8) {
                basis8 = basis8.slice(0, 8);
                lossy = true;
            } else while (basis8.length < 8) basis8 += " ";
            if (basis3.length > 3) {
                basis3 = basis3.slice(0, 3);
                lossy = true;
            } else while (basis3.length < 3) basis3 += " ";
            return {
                filename: basis8,
                extension: basis3,
                _lossy: lossy
            };
            return {
                basis: [ basis8, basis3 ],
                lossy
            };
        };
        var _lnInvalid = /[^a-zA-Z0-9$%'-_@~`!(){}^#&.+,;=[\] ]/g;
        exports.longname = function(name) {
            name = name.trim().replace(/\.+$/, "").replace(_lnInvalid, (function(c) {
                if (c.length > 1) throw Error("Internal problem: unexpected match length!");
                if (c.charCodeAt(0) > 127) return c; else throw Error("Invalid character " + JSON.stringify(c) + " in name.");
                lossy = true;
                return "_";
            }));
            if (name.length > 255) throw Error("Name is too long.");
            return name;
        };
        function nameChkSum(sum, c) {
            return (sum & 1 ? 128 : 0) + (sum >>> 1) + c & 255;
        }
        function reduceBuffer(buf, start, end, fn, res) {
            for (var i = start; i < end; ++i) {
                res = fn(res, buf[i]);
            }
            return res;
        }
        exports.checksumName = function(buf, off) {
            off || (off = 0);
            var len = S.dirEntry.fields["Name"].size;
            return reduceBuffer(buf, off, off + len, nameChkSum, 0);
        };
        exports.fmtHex = function(n, ff) {
            return (1 + ff + n).toString(16).slice(1);
        };
        exports.delayedCall = function(fn) {
            if (!fn) throw Error("No function provided!");
            var ctx = this, args = Array.prototype.slice.call(arguments, 1);
            setImmediate((function() {
                fn.apply(ctx, args);
            }));
        };
        exports.adjustedPos = function(vol, pos, bytes) {
            var _pos = {
                chain: pos.chain,
                sector: pos.sector,
                offset: pos.offset + bytes
            }, secSize = vol._sectorSize;
            while (_pos.offset >= secSize) {
                _pos.sector += 1;
                _pos.offset -= secSize;
            }
            return _pos;
        };
        exports.extend = _xok;
        var _prevDbg = Date.now(), _thresh = 50;
        function log(level) {
            if (level < log.level) return;
            var now = Date.now(), diff = now - _prevDbg;
            arguments[0] = (diff < _thresh ? " " : "") + diff.toFixed(0) + "ms";
            console.log.apply(console, arguments);
            _prevDbg = now;
        }
        log.DBG = -4;
        log.INFO = -3;
        log.WARN = -2;
        log.ERR = -1;
        log.level = log.WARN;
        exports.log = log;
    }, module => {
        module.exports = function(obj) {
            Array.prototype.slice.call(arguments, 1).forEach((function(ext) {
                if (ext) Object.keys(ext).forEach((function(key) {
                    obj[key] = ext[key];
                }));
            }));
            return obj;
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var S = __webpack_require__(105), _ = __webpack_require__(107);
        var dir = exports;
        dir.iterator = function(dirChain, opts) {
            opts || (opts = {});
            var cache = {
                buffer: null,
                n: null
            };
            function getSectorBuffer(n, cb) {
                if (cache.n === n) cb(null, cache.buffer); else cache.n = cache.buffer = null, dirChain.readSectors(n, _.allocBuffer(dirChain.sectorSize), (function(e, d) {
                    if (e) cb(e); else if (!d) return cb(null, null); else {
                        cache.n = n;
                        cache.buffer = d;
                        getSectorBuffer(n, cb);
                    }
                }));
            }
            var secIdx = 0, off = {
                bytes: 0
            }, long = null;
            function getNextEntry(cb) {
                if (off.bytes >= dirChain.sectorSize) {
                    secIdx += 1;
                    off.bytes -= dirChain.sectorSize;
                }
                var entryPos = {
                    chain: dirChain,
                    sector: secIdx,
                    offset: off.bytes
                };
                getSectorBuffer(secIdx, (function(e, buf) {
                    if (e) return cb(S.err.IO()); else if (!buf) return cb(null, null, entryPos);
                    var entryIdx = off.bytes, signalByte = buf[entryIdx];
                    if (signalByte === S.entryDoneFlag) return cb(null, null, entryPos); else if (signalByte === S.entryFreeFlag) {
                        off.bytes += S.dirEntry.size;
                        long = null;
                        if (opts.includeFree) return cb(null, {
                            _free: true,
                            _pos: entryPos
                        }, entryPos); else return getNextEntry(cb);
                    }
                    var attrByte = buf[entryIdx + S.dirEntry.fields.Attr.offset], entryType = attrByte === S.longDirFlag ? S.longDirEntry : S.dirEntry_simple;
                    var entry = entryType.valueFromBytes(buf, off);
                    entry._pos = entryPos;
                    _.log(_.log.DBG, "entry:", entry, secIdx, entryIdx);
                    if (entryType === S.longDirEntry) {
                        var firstEntry;
                        if (entry.Ord & S.lastLongFlag) {
                            firstEntry = true;
                            entry.Ord &= ~S.lastLongFlag;
                            long = {
                                name: -1,
                                sum: entry.Chksum,
                                _rem: entry.Ord - 1,
                                _arr: []
                            };
                        }
                        if (firstEntry || long && entry.Chksum === long.sum && entry.Ord === long._rem--) {
                            var S_lde_f = S.longDirEntry.fields, namepart = entry.Name1;
                            if (entry.Name1.length === S_lde_f.Name1.size / 2) {
                                namepart += entry.Name2;
                                if (entry.Name2.length === S_lde_f.Name2.size / 2) {
                                    namepart += entry.Name3;
                                }
                            }
                            long._arr.push(namepart);
                            if (!long._rem) {
                                long.name = long._arr.reverse().join("");
                                delete long._arr;
                                delete long._rem;
                            }
                        } else long = null;
                    } else if ((attrByte & 8) === 0) {
                        var bestName = null;
                        if (long && long.name) {
                            var pos = entryIdx + S.dirEntry.fields["Name"].offset, sum = _.checksumName(buf, pos);
                            if (sum === long.sum) bestName = long.name;
                        }
                        if (!bestName) {
                            if (signalByte === S.entryIsE5Flag) entry.Name.filename = "å" + entry.Name.filename.slice(1);
                            var nam = entry.Name.filename.replace(/ +$/, ""), ext = entry.Name.extension.replace(/ +$/, "");
                            bestName = ext ? nam + "." + ext : nam;
                        }
                        entry._name = bestName;
                        var _entryBuffer = buf.slice(off.bytes - S.dirEntry.size, off.bytes);
                        entry._full = function() {
                            var _entry = S.dirEntry.valueFromBytes(_entryBuffer);
                            _.extend(entry, _entry);
                            entry._size = entry.FileSize;
                            entry._firstCluster = (entry.FstClusHI << 16) + entry.FstClusLO;
                            return entry;
                        };
                        long = null;
                        return cb(null, entry, entryPos);
                    } else long = null;
                    getNextEntry(cb);
                }));
            }
            function iter(cb) {
                getNextEntry(cb);
                return iter;
            }
            return iter;
        };
        function _updateEntry(vol, entry, newStats) {
            if ("size" in newStats) entry._size = entry.FileSize = newStats.size;
            if ("_touch" in newStats) newStats.archive = newStats.atime = newStats.mtime = true;
            if ("archive" in newStats) entry.Attr.archive = true;
            var _now;
            function applyDate(d, prefix, timeToo, tenthToo) {
                if (d === true) d = _now || (_now = new Date);
                entry[prefix + "Date"] = {
                    year: d.getFullYear() - 1980,
                    month: d.getMonth() + 1,
                    day: d.getDate()
                };
                if (timeToo) {
                    entry[prefix + "Time"] = {
                        hours: d.getHours(),
                        minutes: d.getMinutes(),
                        seconds_2: d.getSeconds() >>> 1
                    };
                    if (tenthToo) {
                        var msec = d.getSeconds() % 2 * 1e3 + d.getMilliseconds();
                        entry[prefix + "TimeTenth"] = Math.floor(msec / 100);
                    }
                }
            }
            if ("ctime" in newStats) applyDate(newStats.ctime, "Crt", true, true);
            if ("mtime" in newStats) applyDate(newStats.mtime, "Wrt", true);
            if ("atime" in newStats) applyDate(newStats.atime, "LstAcc");
            if ("mode" in newStats) {
                entry.Attr.directory = newStats.mode & S._I.FDIR ? true : false;
                entry.Attr.volume_id = newStats.mode & S._I.FREG ? false : true;
                if (vol.opts.modmode === 73) {
                    entry.Attr.archive = newStats.mode & S._I.XUSR ? true : false;
                    entry.Attr.system = newStats.mode & S._I.XGRP ? true : false;
                    entry.Attr.hidden = newStats.mode & S._I.XOTH ? true : false;
                    entry.Attr.readonly = newStats.mode & S._I.WUSR ? false : true;
                } else if (vol.opts.modmode === 3584) {
                    entry.Attr.archive = newStats.mode & S._I.SVTX ? true : false;
                    entry.Attr.system = newStats.mode & S._I.SGID ? true : false;
                    entry.Attr.hidden = newStats.mode & S._I.SUID ? true : false;
                    entry.Attr.readonly = newStats.mode & S._I.WUSR || newStats.mode & S._I.WGRP || newStats.mode & S._I.WOTH ? false : true;
                }
            }
            if ("firstCluster" in newStats) {
                entry.FstClusLO = newStats.firstCluster & 65535;
                entry.FstClusHI = newStats.firstCluster >>> 16;
                entry._firstCluster = newStats.firstCluster;
            }
            return entry;
        }
        dir.makeStat = function(vol, entry) {
            var stats = {};
            stats.isFile = function() {
                return !entry.Attr.volume_id && !entry.Attr.directory;
            };
            stats.isDirectory = function() {
                return entry.Attr.directory;
            };
            stats.isBlockDevice = function() {
                return false;
            };
            stats.isCharacterDevice = function() {
                return false;
            };
            stats.isSymbolicLink = function() {
                return false;
            };
            stats.isFIFO = function() {
                return false;
            };
            stats.isSocket = function() {
                return false;
            };
            stats.size = entry.FileSize;
            stats.blksize = vol._sectorsPerCluster * vol._sectorSize;
            stats.blocks = Math.ceil(stats.size / stats.blksize) || 1;
            stats.nlink = 1;
            stats.mode = S._I.RUSR | S._I.RGRP | S._I.ROTH;
            if (!entry.Attr.readonly) stats.mode |= S._I.WUSR | S._I.WGRP | S._I.WOTH;
            if (entry.Attr.directory) stats.mode |= S._I.FDIR; else if (!entry.Attr.volume_id) stats.mode |= S._I.FREG;
            if (vol.opts.modmode === 73) {
                if (entry.Attr.archive) stats.mode |= S._I.XUSR;
                if (entry.Attr.system) stats.mode |= S._I.XGRP;
                if (entry.Attr.hidden) stats.mode |= S._I.XOTH;
            } else if (vol.opts.modmode === 3584) {
                if (entry.Attr.archive) stats.mode |= S._I.SVTX;
                if (entry.Attr.system) stats.mode |= S._I.SGID;
                if (entry.Attr.hidden) stats.mode |= S._I.SUID;
            }
            stats.mode &= ~vol.opts.umask;
            stats.uid = vol.opts.uid;
            stats.gid = vol.opts.gid;
            function extractDate(prefix) {
                var date = entry[prefix + "Date"], time = entry[prefix + "Time"] || {
                    hours: 0,
                    minutes: 0,
                    seconds_2: 0
                }, secs = time.seconds_2 * 2, sect = entry[prefix + "TimeTenth"] || 0;
                if (sect > 100) {
                    secs += 1;
                    sect -= 100;
                }
                return new Date(date.year + 1980, date.month - 1, date.day, time.hours, time.minutes, secs, sect * 100);
            }
            stats.atime = extractDate("LstAcc");
            stats.mtime = extractDate("Wrt");
            stats.ctime = extractDate("Crt");
            entry = {
                Attr: _.extend({}, entry.Attr)
            };
            return stats;
        };
        dir.init = function(vol, dirInfo, cb) {
            var dirChain = dirInfo.chain, isRootDir = "numSectors" in dirChain, initialCluster = _.allocBuffer(dirChain.sectorSize * vol._sectorsPerCluster), entriesOffset = {
                bytes: 0
            };
            initialCluster.fill(0);
            function writeEntry(name, clusterNum) {
                while (name.length < 8) name += " ";
                S.dirEntry.bytesFromValue(_updateEntry(vol, {
                    Name: {
                        filename: name,
                        extension: "   "
                    },
                    Attr: {
                        directory: true
                    }
                }, {
                    firstCluster: clusterNum,
                    _touch: true,
                    ctime: true
                }), initialCluster, entriesOffset);
            }
            if (!isRootDir) {
                writeEntry(".", dirChain.firstCluster);
                writeEntry("..", dirInfo.parent.chain.firstCluster);
            }
            dirChain.writeToPosition(0, initialCluster, cb);
        };
        dir.addFile = function(vol, dirChain, entryInfo, opts, cb) {
            if (typeof opts === "function") {
                cb = opts;
                opts = {};
            }
            var name = entryInfo.name, entries = [], mainEntry;
            entries.push(mainEntry = {
                Name: _.shortname(name),
                Attr: {
                    directory: opts.dir || false
                },
                _name: name
            });
            if (true) {
                var workaroundTessel427 = "".length !== 1;
                if (workaroundTessel427) throw Error("Your JS runtime does not have proper Unicode string support. (If Tessel, is your firmware up-to-date?)");
                var S_lde_f = S.longDirEntry.fields, ENTRY_CHUNK_LEN = (S_lde_f.Name1.size + S_lde_f.Name2.size + S_lde_f.Name3.size) / 2, partialLen = name.length % ENTRY_CHUNK_LEN, paddingNeeded = partialLen && ENTRY_CHUNK_LEN - partialLen;
                if (paddingNeeded--) name += "\0";
                while (paddingNeeded-- > 0) name += "";
                var off = 0, ord = 1;
                while (off < name.length) entries.push({
                    Ord: ord++,
                    Name1: name.slice(off, off += S_lde_f.Name1.size / 2),
                    Attr_raw: S.longDirFlag,
                    Chksum: null,
                    Name2: name.slice(off, off += S_lde_f.Name2.size / 2),
                    Name3: name.slice(off, off += S_lde_f.Name3.size / 2)
                });
                entries[entries.length - 1].Ord |= S.lastLongFlag;
            }
            if (entryInfo.tail) {
                var name = mainEntry.Name.filename, suffix = "~" + entryInfo.tail, endIdx = name.indexOf(" "), sufIdx = ~endIdx ? Math.min(endIdx, name.length - suffix.length) : name.length - suffix.length;
                if (sufIdx < 0) return cb(S.err.NAMETOOLONG());
                mainEntry.Name.filename = name.slice(0, sufIdx) + suffix + name.slice(sufIdx + suffix.length);
                _.log(_.log.DBG, "Shortname amended to:", mainEntry.Name);
            }
            vol.allocateInFAT(dirChain.firstCluster || 2, (function(e, fileCluster) {
                if (e) return cb(e);
                var nameBuf = S.dirEntry.fields["Name"].bytesFromValue(mainEntry.Name), nameSum = _.checksumName(nameBuf);
                _updateEntry(vol, mainEntry, {
                    firstCluster: fileCluster,
                    size: 0,
                    ctime: true,
                    _touch: true
                });
                mainEntry._pos = _.adjustedPos(vol, entryInfo.target, S.dirEntry.size * (entries.length - 1));
                entries.slice(1).forEach((function(entry) {
                    entry.Chksum = nameSum;
                }));
                entries.reverse();
                if (entryInfo.lastEntry) entries.push({});
                var entriesData = _.allocBuffer(S.dirEntry.size * entries.length), dataOffset = {
                    bytes: 0
                };
                entries.forEach((function(entry) {
                    var entryType = "Ord" in entry ? S.longDirEntry : S.dirEntry;
                    entryType.bytesFromValue(entry, entriesData, dataOffset);
                }));
                _.log(_.log.DBG, "Writing", entriesData.length, "byte directory entry", mainEntry, "into", dirChain.toJSON(), "at", entryInfo.target);
                dirChain.writeToPosition(entryInfo.target, entriesData, (function(e) {
                    if (e) cb(e); else cb(null, mainEntry, vol.chainForCluster(fileCluster, dirChain));
                }));
            }));
        };
        dir.findInDirectory = function(vol, dirChain, name, opts, cb) {
            var matchName = name.toUpperCase(), tailName = opts.prepareForCreate ? _.shortname(name) : null, maxTail = 0;
            function processNext(next) {
                next = next((function(e, d, entryPos) {
                    if (e) cb(e); else if (!d) cb(S.err.NOENT(), {
                        tail: maxTail,
                        target: entryPos,
                        lastEntry: true
                    }); else if (d._free) processNext(next); else if (d._name.toUpperCase() === matchName) return cb(null, d._full()); else if (!opts.prepareForCreate) processNext(next); else {
                        var dNum = 1, dName = d.Name.filename, dTail = dName.match(/(.*)~(\d+)/);
                        if (dTail) {
                            dNum = +dTail[2];
                            dName = dTail[1];
                        }
                        if (tailName.extension === d.Name.extension && tailName.filename.indexOf(dName) === 0) {
                            maxTail = Math.max(dNum + 1, maxTail);
                        }
                        processNext(next);
                    }
                }));
            }
            processNext(dir.iterator(dirChain, {
                includeFree: 0 && 0
            }));
        };
        dir.updateEntry = function(vol, entry, newStats, cb) {
            if (!entry._pos || !entry._pos.chain) throw Error("Entry source unknown!");
            var entryPos = entry._pos, newEntry = _updateEntry(vol, entry, newStats), data = S.dirEntry.bytesFromValue(newEntry);
            _.log(_.log.DBG, "UPDATING ENTRY", newStats, newEntry, entryPos, data);
            entryPos.chain.writeToPosition(entryPos, data, cb);
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var S = __webpack_require__(105), _ = __webpack_require__(107);
        function _baseChain(vol) {
            var chain = {};
            chain.sectorSize = vol._sectorSize;
            function posFromOffset(off) {
                var secSize = chain.sectorSize, offset = off % secSize, sector = (off - offset) / secSize;
                return {
                    sector,
                    offset
                };
            }
            var sectorCache = vol._makeCache();
            Object.defineProperty(chain, "cacheAdvice", {
                enumerable: true,
                get: function() {
                    return sectorCache.advice();
                },
                set: function(v) {
                    sectorCache.advice(v);
                }
            });
            chain._vol_readSectors = vol._readSectors.bind(vol, sectorCache);
            chain._vol_writeSectors = vol._writeSectors.bind(vol, sectorCache);
            chain.readFromPosition = function(targetPos, buffer, cb) {
                if (typeof targetPos === "number") targetPos = posFromOffset(targetPos);
                if (typeof buffer === "number") buffer = _.allocBuffer(buffer);
                if (targetPos.offset) chain.readSectors(targetPos.sector, _.allocBuffer(chain.sectorSize), (function(e, d) {
                    if (e || !d) cb(e, 0, buffer); else {
                        var dBeg = targetPos.offset, dEnd = dBeg + buffer.length;
                        d.copy(buffer, 0, dBeg, dEnd);
                        if (dEnd > d.length) readMain(); else cb(null, buffer.length, buffer);
                    }
                })); else readMain();
                function readMain() {
                    var prefaceLen = targetPos.offset && chain.sectorSize - targetPos.offset, trailerLen = (buffer.length - prefaceLen) % chain.sectorSize, mainSector = prefaceLen ? targetPos.sector + 1 : targetPos.sector, mainBuffer = trailerLen ? buffer.slice(prefaceLen, -trailerLen) : buffer.slice(prefaceLen);
                    if (mainBuffer.length) chain.readSectors(mainSector, mainBuffer, (function(e, d) {
                        if (e || !d) cb(e, prefaceLen, buffer); else if (!trailerLen) cb(null, buffer.length, buffer); else readTrailer();
                    })); else readTrailer();
                    function readTrailer() {
                        var trailerSector = mainSector + mainBuffer.length / chain.sectorSize;
                        chain.readSectors(trailerSector, _.allocBuffer(chain.sectorSize), (function(e, d) {
                            if (e || !d) cb(e, buffer.length - trailerLen, buffer); else {
                                d.copy(buffer, buffer.length - trailerLen, 0, trailerLen);
                                cb(null, buffer.length, buffer);
                            }
                        }));
                    }
                }
            };
            chain.writeToPosition = function(targetPos, data, cb) {
                _.log(_.log.DBG, "WRITING", data.length, "bytes at", targetPos, "in", this.toJSON(), data);
                if (typeof targetPos === "number") targetPos = posFromOffset(targetPos);
                var prefaceBuffer = targetPos.offset ? data.slice(0, chain.sectorSize - targetPos.offset) : null;
                if (prefaceBuffer) _modifySector(targetPos.sector, targetPos.offset, prefaceBuffer, (function(e) {
                    if (e) cb(e); else if (prefaceBuffer.length < data.length) writeMain(); else cb();
                })); else writeMain();
                function writeMain() {
                    var prefaceLen = prefaceBuffer ? prefaceBuffer.length : 0, trailerLen = (data.length - prefaceLen) % chain.sectorSize, mainSector = prefaceLen ? targetPos.sector + 1 : targetPos.sector, mainBuffer = trailerLen ? data.slice(prefaceLen, -trailerLen) : data.slice(prefaceLen);
                    if (mainBuffer.length) chain.writeSectors(mainSector, mainBuffer, (function(e) {
                        if (e) cb(e); else if (!trailerLen) cb(); else writeTrailer();
                    })); else writeTrailer();
                    function writeTrailer() {
                        var trailerSector = mainSector + mainBuffer.length / chain.sectorSize, trailerBuffer = data.slice(data.length - trailerLen);
                        _modifySector(trailerSector, 0, trailerBuffer, cb);
                    }
                }
                function _modifySector(sec, off, data, cb) {
                    chain.readSectors(sec, _.allocBuffer(chain.sectorSize), (function(e, orig) {
                        if (e) return cb(e);
                        orig || (orig = _.allocBuffer(chain.sectorSize, 0));
                        data.copy(orig, off);
                        chain.writeSectors(sec, orig, cb);
                    }));
                }
            };
            return chain;
        }
        exports.clusterChain = function(vol, firstCluster, _parent) {
            var chain = _baseChain(vol), cache = [ firstCluster ];
            chain.firstCluster = firstCluster;
            function _cacheIsComplete() {
                return cache[cache.length - 1] === "eof";
            }
            function extendCacheToInclude(i, cb) {
                if (i < cache.length) cb(null, cache[i]); else if (_cacheIsComplete()) cb(null, "eof"); else vol.fetchFromFAT(cache[cache.length - 1], (function(e, d) {
                    if (e) cb(e); else if (typeof d === "string" && d !== "eof") cb(S.err.IO()); else {
                        cache.push(d);
                        extendCacheToInclude(i, cb);
                    }
                }));
            }
            function expandChainToLength(clusterCount, cb) {
                if (!_cacheIsComplete()) throw Error("Must be called only when cache is complete!"); else cache.pop();
                function addCluster(clustersNeeded, lastCluster) {
                    if (!clustersNeeded) cache.push("eof"), cb(); else vol.allocateInFAT(lastCluster, (function(e, newCluster) {
                        if (e) cb(e); else vol.storeToFAT(lastCluster, newCluster, (function(e) {
                            if (e) return cb(e);
                            cache.push(newCluster);
                            addCluster(clustersNeeded - 1, newCluster);
                        }));
                    }));
                }
                addCluster(clusterCount - cache.length, cache[cache.length - 1]);
            }
            function shrinkChainToLength(clusterCount, cb) {
                if (!_cacheIsComplete()) throw Error("Must be called only when cache is complete!"); else cache.pop();
                function removeClusters(count, cb) {
                    if (!count) cache.push("eof"), cb(); else vol.storeToFAT(cache.pop(), "free", (function(e) {
                        if (e) cb(e); else removeClusters(count - 1, cb);
                    }));
                }
                if (clusterCount) removeClusters(cache.length - clusterCount, cb); else removeClusters(cache.length - 1, cb);
            }
            function determineSectorGroups(sectorIdx, numSectors, alloc, cb) {
                var sectorOffset = sectorIdx % vol._sectorsPerCluster, clusterIdx = (sectorIdx - sectorOffset) / vol._sectorsPerCluster, numClusters = Math.ceil((numSectors + sectorOffset) / vol._sectorsPerCluster), chainLength = clusterIdx + numClusters;
                extendCacheToInclude(chainLength - 1, (function(e, c) {
                    if (e) cb(e); else if (c === "eof" && alloc) expandChainToLength(chainLength, (function(e) {
                        if (e) cb(e); else _determineSectorGroups();
                    })); else _determineSectorGroups();
                }));
                function _determineSectorGroups() {
                    var groups = [], _group = null;
                    for (var i = clusterIdx; i < chainLength; ++i) {
                        var c = i < cache.length ? cache[i] : "eof";
                        if (c === "eof") break; else if (_group && c !== _group._nextCluster) {
                            groups.push(_group);
                            _group = null;
                        }
                        if (!_group) _group = {
                            _nextCluster: c + 1,
                            firstSector: vol._firstSectorOfCluster(c) + sectorOffset,
                            numSectors: vol._sectorsPerCluster - sectorOffset
                        }; else {
                            _group._nextCluster += 1;
                            _group.numSectors += vol._sectorsPerCluster;
                        }
                        sectorOffset = 0;
                    }
                    if (_group) groups.push(_group);
                    cb(null, groups, i === chainLength);
                }
            }
            chain.readSectors = function(i, dest, cb) {
                var groupOffset = 0, groupsPending;
                determineSectorGroups(i, dest.length / chain.sectorSize, false, (function(e, groups, complete) {
                    if (e) cb(e); else if (!complete) groupsPending = -1, _pastEOF(cb); else if (groupsPending = groups.length) groups.forEach((function(group) {
                        var groupLength = group.numSectors * chain.sectorSize, groupBuffer = dest.slice(groupOffset, groupOffset += groupLength);
                        chain._vol_readSectors(group.firstSector, groupBuffer, (function(e, d) {
                            if (e && groupsPending !== -1) groupsPending = -1, cb(e); else if (--groupsPending === 0) cb(null, dest);
                        }));
                    })); else cb(null, dest);
                }));
            };
            chain.writeSectors = function(i, data, cb) {
                var groupOffset = 0, groupsPending;
                determineSectorGroups(i, data.length / chain.sectorSize, true, (function(e, groups) {
                    if (e) cb(e); else if (groupsPending = groups.length) groups.forEach((function(group) {
                        var groupLength = group.numSectors * chain.sectorSize, groupBuffer = data.slice(groupOffset, groupOffset += groupLength);
                        chain._vol_writeSectors(group.firstSector, groupBuffer, (function(e) {
                            if (e && groupsPending !== -1) groupsPending = -1, cb(e); else if (--groupsPending === 0) cb();
                        }));
                    })); else cb();
                }));
            };
            chain.truncate = function(numSectors, cb) {
                extendCacheToInclude(Infinity, (function(e, c) {
                    if (e) return cb(e);
                    var currentLength = cache.length - 1, clustersNeeded = Math.ceil(numSectors / vol._sectorsPerCluster);
                    if (clustersNeeded < currentLength) shrinkChainToLength(clustersNeeded, cb); else if (clustersNeeded > currentLength) expandChainToLength(clustersNeeded, cb); else cb();
                }));
            };
            chain.toJSON = function() {
                return {
                    firstCluster
                };
            };
            return chain;
        };
        exports.sectorChain = function(vol, firstSector, numSectors) {
            var chain = _baseChain(vol);
            chain.firstSector = firstSector;
            chain.numSectors = numSectors;
            chain.readSectors = function(i, dest, cb) {
                if (i < numSectors) chain._vol_readSectors(firstSector + i, dest, cb); else _pastEOF(cb);
            };
            chain.writeSectors = function(i, data, cb) {
                if (i < numSectors) chain._vol_writeSectors(firstSector + i, data, cb); else _.delayedCall(cb, S.err.NOSPC());
            };
            chain.truncate = function(i, cb) {
                _.delayedCall(cb, S.err.INVAL());
            };
            chain.toJSON = function() {
                return {
                    firstSector,
                    numSectors
                };
            };
            return chain;
        };
        function _pastEOF(cb) {
            _.delayedCall(cb, null, null);
        }
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var S = __webpack_require__(105), c = __webpack_require__(110), $ = __webpack_require__(112), _ = __webpack_require__(107);
        exports.init = function(volume, opts, bootSector) {
            if (bootSector[510] !== 85 || bootSector[511] !== 170) throw Error("Invalid volume signature!");
            var isFAT16 = bootSector.readUInt16LE(S.boot16.fields["FATSz16"].offset), bootStruct = isFAT16 ? S.boot16 : S.boot32, BS = bootStruct.valueFromBytes(bootSector);
            _.log(_.log.DBG, "Boot sector info:", BS);
            bootSector = null;
            if (!BS.BytsPerSec) throw Error("This looks like an ExFAT volume! (unsupported)"); else if (BS.BytsPerSec !== volume.sectorSize) throw Error("Sector size mismatch with FAT table.");
            var FATSz = isFAT16 ? BS.FATSz16 : BS.FATSz32, rootDirSectors = Math.ceil(BS.RootEntCnt * 32 / BS.BytsPerSec), firstDataSector = BS.ResvdSecCnt + BS.NumFATs * FATSz + rootDirSectors, totSec = BS.TotSec16 ? BS.TotSec16 : BS.TotSec32, dataSec = totSec - firstDataSector, countofClusters = Math.floor(dataSec / BS.SecPerClus);
            if (totSec > volume.numSectors) throw Error("Volume size mismatch!");
            var fatType;
            if (countofClusters < 4085) {
                fatType = "fat12";
            } else if (countofClusters < 65525) {
                fatType = "fat16";
            } else {
                fatType = "fat32";
            }
            _.log(_.log.DBG, "rootDirSectors", rootDirSectors, "firstDataSector", firstDataSector, "countofClusters", countofClusters, "=>", fatType);
            var vol = {};
            vol.opts = opts;
            vol._sectorSize = BS.BytsPerSec;
            vol._sectorsPerCluster = BS.SecPerClus;
            vol._firstSectorOfCluster = function(n) {
                return firstDataSector + (n - 2) * vol._sectorsPerCluster;
            };
            vol._makeCache = function() {
                return $.wrapDriver(volume);
            };
            vol._readSectors = function(cache, secNum, dest, cb) {
                if (typeof dest === "function") {
                    cb = dest;
                    dest = _.allocBuffer(vol._sectorSize);
                }
                _.log(_.log.DBG, "vol._readSectors", secNum, dest.length);
                if (secNum < volume.numSectors) cache.readSectors(secNum, dest, (function(e) {
                    cb(e, dest);
                })); else throw Error("Invalid sector number!");
            };
            vol._writeSectors = function(cache, secNum, data, cb) {
                _.log(_.log.DBG, "vol._writeSectors", secNum, data.length);
                if (data.length % volume.sectorSize) throw Error("Buffer length not a multiple of sector size"); else if (opts.ro) throw Error("Read-only filesystem"); else if (secNum < volume.numSectors) cache.writeSectors(secNum, data, cb); else throw Error("Invalid sector number!");
            };
            function fatInfoForCluster(n) {
                var entryStruct = S.fatField[fatType], FATOffset = fatType === "fat12" ? Math.floor(n / 2) * entryStruct.size : n * entryStruct.size, SecNum = BS.ResvdSecCnt + Math.floor(FATOffset / BS.BytsPerSec);
                EntOffset = FATOffset % BS.BytsPerSec;
                return {
                    sector: SecNum - BS.ResvdSecCnt,
                    offset: EntOffset,
                    struct: entryStruct
                };
            }
            var fatChain = c.sectorChain(vol, BS.ResvdSecCnt, FATSz);
            fatChain.cacheAdvice = "RANDOM";
            vol.fetchFromFAT = function(clusterNum, cb) {
                var info = fatInfoForCluster(clusterNum);
                fatChain.readFromPosition(info, info.struct.size, (function(e, n, d) {
                    if (e) return cb(e);
                    var status = info.struct.valueFromBytes(d), prefix;
                    if (fatType === "fat12") {
                        if (clusterNum % 2) {
                            status = (status.field1ab << 4) + status.field1c;
                        } else {
                            status = (status.field0a << 8) + status.field0bc;
                        }
                    } else if (fatType === "fat32") {
                        status &= 268435455;
                    }
                    var prefix = S.fatPrefix[fatType];
                    if (status === S.fatStat.free) cb(null, "free"); else if (status === S.fatStat._undef) cb(null, "-invalid-"); else if (status > prefix + S.fatStat.eofMin) cb(null, "eof"); else if (status === prefix + S.fatStat.bad) cb(null, "bad"); else if (status > prefix + S.fatStat.rsvMin) cb(null, "reserved"); else cb(null, status);
                }));
            };
            vol.storeToFAT = function(clusterNum, status, cb) {
                if (typeof status === "string") {
                    status = S.fatStat[status];
                    status += S.fatPrefix[fatType];
                }
                var info = fatInfoForCluster(clusterNum);
                if (fatType === "fat12") fatChain.readFromPosition(info, info.struct.size, (function(e, n, d) {
                    var value = info.struct.valueFromBytes(d);
                    if (clusterNum % 2) {
                        value.field1ab = status >>> 4;
                        value.field1c = status & 15;
                    } else {
                        value.field0a = status >>> 8;
                        value.field0bc = status & 255;
                    }
                    var entry = info.struct.bytesFromValue(value);
                    fatChain.writeToPosition(info, entry, cb);
                })); else {
                    var entry = info.struct.bytesFromValue(status);
                    fatChain.writeToPosition(info, entry, cb);
                }
            };
            vol.allocateInFAT = function(hint, cb) {
                if (typeof hint === "function") {
                    cb = hint;
                    hint = 2;
                }
                function searchForFreeCluster(num, cb) {
                    if (num < countofClusters) vol.fetchFromFAT(num, (function(e, status) {
                        if (e) cb(e); else if (status === "free") cb(null, num); else searchForFreeCluster(num + 1, cb);
                    })); else cb(S.err.NOSPC());
                }
                searchForFreeCluster(hint, (function(e, clusterNum) {
                    if (e) cb(e); else vol.storeToFAT(clusterNum, "eof", cb.bind(null, null, clusterNum));
                }));
            };
            vol.rootDirectoryChain = isFAT16 ? c.sectorChain(vol, firstDataSector - rootDirSectors, rootDirSectors) : c.clusterChain(vol, BS.RootClus);
            vol.rootDirectoryChain.cacheAdvice = "WILLNEED";
            vol.chainForCluster = c.clusterChain.bind(c, vol);
            vol.chainFromJSON = function(d) {
                return "numSectors" in d ? c.sectorChain(vol, d.firstSector, d.numSectors) : c.clusterChain(vol, d.firstCluster);
            };
            return vol;
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var _ = __webpack_require__(107);
        exports.wrapDriver = function(volume, opts) {
            opts = _.extend({
                maxSectors: 2048
            }, opts);
            var cache = {}, advice = "NORMAL", secSize = volume.sectorSize;
            function _freezeBuffer(b) {
                var f = _.allocBuffer(b.length);
                b.copy(f);
                return f;
            }
            function addToCache(i, data) {
                if (advice === "SEQUENTIAL" || advice === "NOREUSE") return;
                data = _freezeBuffer(data);
                cache[i] = data;
                while (data.length > secSize) {
                    data = data.slice(secSize);
                    cache[++i] = data;
                }
                Object.keys(cache).sort().slice(opts.maxSectors).forEach((function(x) {
                    delete cache[x];
                }));
                _.log(_.log.DBG, "Cache now contains:", Object.keys(cache).join(","));
            }
            return {
                sectorSize: volume.sectorSize,
                numSectors: volume.numSectors,
                advice: function(val) {
                    if (!arguments.length) return advice; else advice = val;
                    if (advice === "SEQUENTIAL" || advice === "NOREUSE") cache = {};
                    return this;
                },
                readSectors: function(i, dest, cb) {
                    if (i in cache && dest.length === secSize) {
                        cache[i].copy(dest);
                        setImmediate(cb);
                    } else volume.readSectors(i, dest, (function(e) {
                        if (e) cb(e); else addToCache(i, dest), cb();
                    }));
                },
                writeSectors: !volume.writeSectors ? null : function(i, data, cb) {
                    volume.writeSectors(i, data, (function(e) {
                        if (e) cb(e); else addToCache(i, data), cb();
                    }));
                }
            };
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.configure = exports.normalizePartition = exports.shouldRunOperation = void 0;
        const balena_image_fs_1 = __webpack_require__(92);
        const partitioninfo_1 = __webpack_require__(56);
        const util_1 = __webpack_require__(14);
        const configure_1 = __webpack_require__(114);
        const copy_1 = __webpack_require__(116);
        const MBR_LAST_PRIMARY_PARTITION = 4;
        function shouldRunOperation(options, operation) {
            var _a;
            const when = (_a = operation.when) !== null && _a !== void 0 ? _a : {};
            for (const [key, value] of Object.entries(when)) {
                if (options[key] !== value) {
                    return false;
                }
            }
            return true;
        }
        exports.shouldRunOperation = shouldRunOperation;
        function normalizePartition(partition) {
            if (typeof partition === "number") {
                return partition;
            }
            if (typeof partition.logical === "number") {
                return partition.logical + MBR_LAST_PRIMARY_PARTITION;
            }
            if (typeof partition.primary === "number") {
                return partition.primary;
            }
            throw new Error(`Invalid partition: ${partition}`);
        }
        exports.normalizePartition = normalizePartition;
        async function getDiskDeviceType(disk) {
            const partitions = await (0, partitioninfo_1.getPartitions)(disk);
            for (const partition of partitions.partitions) {
                if (partition.type === 14) {
                    const deviceType = await (0, balena_image_fs_1.interact)(disk, partition.index, (async fs => {
                        try {
                            return await (0, util_1.promisify)(fs.readFile)("/device-type.json");
                        } catch (error) {
                            return undefined;
                        }
                    }));
                    if (deviceType) {
                        return JSON.parse(deviceType.toString());
                    }
                }
            }
        }
        async function configure(disk, config) {
            var _a, _b, _c;
            const deviceType = await getDiskDeviceType(disk);
            const operations = (_b = (_a = deviceType === null || deviceType === void 0 ? void 0 : deviceType.configuration) === null || _a === void 0 ? void 0 : _a.operations) !== null && _b !== void 0 ? _b : [];
            const configPartition = (_c = deviceType === null || deviceType === void 0 ? void 0 : deviceType.configuration) === null || _c === void 0 ? void 0 : _c.config.partition;
            if (config !== undefined && configPartition !== undefined) {
                await (0, configure_1.configure)(disk, normalizePartition(configPartition), config);
            }
            for (const cpy of operations) {
                if (cpy.from.partition !== undefined && cpy.to.partition !== undefined && shouldRunOperation(config !== null && config !== void 0 ? config : {}, cpy)) {
                    await (0, copy_1.copy)(disk, normalizePartition(cpy.from.partition), cpy.from.path, disk, normalizePartition(cpy.to.partition), cpy.to.path);
                }
            }
        }
        exports.configure = configure;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.configure = void 0;
        const balena_image_fs_1 = __webpack_require__(92);
        const outdent_1 = __webpack_require__(115);
        const util_1 = __webpack_require__(14);
        function nmWifiConfig(index, options) {
            let config = (0, outdent_1.outdent)`
		[connection]
		id=balena-wifi-${pad(index)}
		type=wifi

		[wifi]
		hidden=true
		mode=infrastructure
		ssid=${options.wifiSsid}

		[ipv4]
	`;
            if (options.routeMetric) {
                config += (0, outdent_1.outdent)`

			route-metric=${options.routeMetric}
		`;
            }
            if (options.ip && options.netmask && options.gateway) {
                config += (0, outdent_1.outdent)`

			method=manual
			address1=${options.ip}/${options.netmask},${options.gateway}
		`;
            } else {
                config += (0, outdent_1.outdent)`

			method=auto
		`;
            }
            config += (0, outdent_1.outdent)`


		[ipv6]
		addr-gen-mode=stable-privacy
		method=auto
	`;
            if (options.wifiKey) {
                config += (0, outdent_1.outdent)`


			[wifi-security]
			auth-alg=open
			key-mgmt=wpa-psk
			psk=${options.wifiKey}
		`;
            }
            return config;
        }
        function createNetworkConfigFiles(networks) {
            return {
                ethernet: networks.map((n => n.configuration)).filter((n => !!n)),
                wifi: networks.filter((n => !!n.wifiSsid)).map(((network, index) => nmWifiConfig(index + 1, network)))
            };
        }
        function pad(num) {
            return `${num}`.padStart(2, "0");
        }
        async function configure(disk, partition, config) {
            const {wifiSsid, wifiKey, ip, netmask, gateway, routeMetric, network, ...configJSON} = config;
            const networks = [ {
                wifiSsid,
                wifiKey,
                ip,
                netmask,
                gateway,
                routeMetric
            }, ...network !== null && network !== void 0 ? network : [] ];
            const networkConfigFiles = createNetworkConfigFiles(networks);
            await (0, balena_image_fs_1.interact)(disk, partition, (async fs => {
                const writeFileAsync = (0, util_1.promisify)(fs.writeFile);
                const mkdirAsync = (0, util_1.promisify)(fs.mkdir);
                await writeFileAsync("/config.json", JSON.stringify(configJSON));
                try {
                    await mkdirAsync("/system-connections");
                } catch (_a) {}
                for (const [index, configuration] of networkConfigFiles.ethernet.entries()) {
                    await writeFileAsync(`/system-connections/connection-${pad(index + 1)}`, configuration);
                }
                for (const [index, configuration] of networkConfigFiles.wifi.entries()) {
                    await writeFileAsync(`/system-connections/balena-wifi-${pad(index + 1)}`, configuration);
                }
            }));
        }
        exports.configure = configure;
    }, (module, __webpack_exports__, __webpack_require__) => {
        "use strict";
        __webpack_require__.r(__webpack_exports__);
        __webpack_require__.d(__webpack_exports__, {
            default: () => __WEBPACK_DEFAULT_EXPORT__,
            outdent: () => defaultOutdent
        });
        module = __webpack_require__.hmd(module);
        function noop() {
            var args = [];
            for (var _i = 0; _i < arguments.length; _i++) {
                args[_i] = arguments[_i];
            }
        }
        function createWeakMap() {
            if (typeof WeakMap !== "undefined") {
                return new WeakMap;
            } else {
                return fakeSetOrMap();
            }
        }
        function fakeSetOrMap() {
            return {
                add: noop,
                delete: noop,
                get: noop,
                set: noop,
                has: function(k) {
                    return false;
                }
            };
        }
        var hop = Object.prototype.hasOwnProperty;
        var has = function(obj, prop) {
            return hop.call(obj, prop);
        };
        function extend(target, source) {
            for (var prop in source) {
                if (has(source, prop)) {
                    target[prop] = source[prop];
                }
            }
            return target;
        }
        var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
        var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
        var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
        var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
        var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
        function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
            var indentationLevel = 0;
            var match = strings[0].match(reDetectIndentation);
            if (match) {
                indentationLevel = match[1].length;
            }
            var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
            var reMatchIndent = new RegExp(reSource, "g");
            if (firstInterpolatedValueSetsIndentationLevel) {
                strings = strings.slice(1);
            }
            var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
            var normalizeNewlines = typeof newline === "string";
            var l = strings.length;
            var outdentedStrings = strings.map((function(v, i) {
                v = v.replace(reMatchIndent, "$1");
                if (i === 0 && trimLeadingNewline) {
                    v = v.replace(reLeadingNewline, "");
                }
                if (i === l - 1 && trimTrailingNewline) {
                    v = v.replace(reTrailingNewline, "");
                }
                if (normalizeNewlines) {
                    v = v.replace(/\r\n|\n|\r/g, (function(_) {
                        return newline;
                    }));
                }
                return v;
            }));
            return outdentedStrings;
        }
        function concatStringsAndValues(strings, values) {
            var ret = "";
            for (var i = 0, l = strings.length; i < l; i++) {
                ret += strings[i];
                if (i < l - 1) {
                    ret += values[i];
                }
            }
            return ret;
        }
        function isTemplateStringsArray(v) {
            return has(v, "raw") && has(v, "length");
        }
        function createInstance(options) {
            var arrayAutoIndentCache = createWeakMap();
            var arrayFirstInterpSetsIndentCache = createWeakMap();
            function outdent(stringsOrOptions) {
                var values = [];
                for (var _i = 1; _i < arguments.length; _i++) {
                    values[_i - 1] = arguments[_i];
                }
                if (isTemplateStringsArray(stringsOrOptions)) {
                    var strings = stringsOrOptions;
                    var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
                    var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
                    var renderedArray = cache.get(strings);
                    if (!renderedArray) {
                        renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
                        cache.set(strings, renderedArray);
                    }
                    if (values.length === 0) {
                        return renderedArray[0];
                    }
                    var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
                    return rendered;
                } else {
                    return createInstance(extend(extend({}, options), stringsOrOptions || {}));
                }
            }
            var fullOutdent = extend(outdent, {
                string: function(str) {
                    return _outdentArray([ str ], false, options)[0];
                }
            });
            return fullOutdent;
        }
        var defaultOutdent = createInstance({
            trimLeadingNewline: true,
            trimTrailingNewline: true
        });
        const __WEBPACK_DEFAULT_EXPORT__ = defaultOutdent;
        if (true) {
            try {
                module.exports = defaultOutdent;
                Object.defineProperty(defaultOutdent, "__esModule", {
                    value: true
                });
                defaultOutdent.default = defaultOutdent;
                defaultOutdent.outdent = defaultOutdent;
            } catch (e) {}
        }
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.copy = void 0;
        const balena_image_fs_1 = __webpack_require__(92);
        async function copyFile(sourceFs, sourcePath, destinationFs, destinationPath) {
            const readStream = sourceFs.createReadStream(`/${sourcePath}`);
            const writeStream = destinationFs.createWriteStream(`/${destinationPath}`);
            await new Promise(((resolve, reject) => {
                readStream.on("error", reject).pipe(writeStream).on("error", reject).on("close", resolve);
            }));
        }
        async function copy(diskFrom, partitionFrom, pathFrom, diskTo, partitionTo, pathTo) {
            await (0, balena_image_fs_1.interact)(diskFrom, partitionFrom, (async fsFrom => {
                if (diskFrom === diskTo && partitionFrom === partitionTo) {
                    await copyFile(fsFrom, pathFrom, fsFrom, pathTo);
                } else {
                    await (0, balena_image_fs_1.interact)(diskTo, partitionTo, (async fsTo => {
                        await copyFile(fsFrom, pathFrom, fsTo, pathTo);
                    }));
                }
            }));
        }
        exports.copy = copy;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.DmgSource = void 0;
        const udif_1 = __webpack_require__(118);
        const source_destination_1 = __webpack_require__(54);
        const source_source_1 = __webpack_require__(90);
        const block_transform_stream_1 = __webpack_require__(141);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const shared_1 = __webpack_require__(80);
        const sparse_transform_stream_1 = __webpack_require__(142);
        class DmgSource extends source_source_1.SourceSource {
            constructor(source) {
                super(source);
            }
            async canCreateReadStream() {
                return true;
            }
            async canCreateSparseReadStream() {
                return true;
            }
            async createReadStream({start = 0, end, alignment, numBuffers} = {}) {
                if (start !== 0) {
                    throw new errors_1.NotCapable;
                }
                const stream = await this.image.createReadStream(end);
                return block_transform_stream_1.BlockTransformStream.alignIfNeeded(stream, alignment, numBuffers);
            }
            async createSparseReadStream({alignment, numBuffers} = {}) {
                const blocks = await this.getBlocks();
                const stream = Object.assign(await this.image.createSparseReadStream(), {
                    blocks
                });
                if (alignment !== undefined) {
                    const transform = new sparse_transform_stream_1.ProgressSparseTransformStream({
                        blocks,
                        chunkSize: constants_1.CHUNK_SIZE,
                        alignment,
                        numBuffers
                    });
                    stream.on("error", transform.emit.bind(transform, "error"));
                    stream.pipe(transform);
                    return transform;
                } else {
                    return stream;
                }
            }
            async getBlocks() {
                const result = [];
                for (const blk of this.image.resourceFork.blkx) {
                    const childBlocks = blk.map.blocks.filter((b => DmgSource.mappedBlockTypes.includes(b.type)));
                    if (childBlocks.length === 0) {
                        continue;
                    }
                    let checksumType;
                    let checksum;
                    if (blk.map.checksum.type === udif_1.CHECKSUM_TYPE.CRC32) {
                        checksumType = "crc32";
                        checksum = blk.map.checksum.value;
                    }
                    const blocks = [];
                    result.push({
                        checksumType,
                        checksum,
                        blocks
                    });
                    let lastBlock;
                    for (const childBlk of childBlocks) {
                        const offset = (blk.map.sectorNumber + childBlk.sectorNumber) * udif_1.SECTOR_SIZE;
                        const length = childBlk.sectorCount * udif_1.SECTOR_SIZE;
                        if (lastBlock === undefined) {
                            lastBlock = {
                                offset,
                                length
                            };
                        } else if (lastBlock.offset + lastBlock.length === offset) {
                            lastBlock.length += length;
                        } else {
                            blocks.push(lastBlock);
                            lastBlock = {
                                offset,
                                length
                            };
                        }
                    }
                    blocks.push(lastBlock);
                }
                return result;
            }
            async _getMetadata() {
                const blocks = await this.getBlocks();
                const blockmappedSize = (0, shared_1.blocksLength)(blocks);
                const compressedSize = (await this.source.getMetadata()).size;
                const size = await this.image.getUncompressedSize();
                return {
                    blocks,
                    blockmappedSize,
                    compressedSize,
                    size
                };
            }
            async _open() {
                await super._open();
                this.image = new udif_1.Image({
                    size: (await this.source.getMetadata()).size,
                    createReadStream: async (start, end) => await this.source.createReadStream({
                        start,
                        end
                    })
                });
                await this.image.ready;
            }
        }
        exports.DmgSource = DmgSource;
        DmgSource.mappedBlockTypes = [ udif_1.BLOCK.ZEROFILL, udif_1.BLOCK.RAW, udif_1.BLOCK.UDCO, udif_1.BLOCK.UDZO, udif_1.BLOCK.UDBZ, udif_1.BLOCK.LZFSE ];
        DmgSource.requiresRandomReadableSource = true;
        DmgSource.mimetype = "application/x-apple-diskimage";
        source_destination_1.SourceDestination.register(DmgSource);
    }, function(__unused_webpack_module, exports, __webpack_require__) {
        "use strict";
        var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            Object.defineProperty(o, k2, {
                enumerable: true,
                get: function() {
                    return m[k];
                }
            });
        } : function(o, m, k, k2) {
            if (k2 === undefined) k2 = k;
            o[k2] = m[k];
        });
        var __exportStar = this && this.__exportStar || function(m, exports) {
            for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
        };
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        __exportStar(__webpack_require__(119), exports);
        __exportStar(__webpack_require__(122), exports);
        __exportStar(__webpack_require__(123), exports);
        __exportStar(__webpack_require__(120), exports);
        __exportStar(__webpack_require__(124), exports);
        __exportStar(__webpack_require__(125), exports);
        __exportStar(__webpack_require__(135), exports);
        __exportStar(__webpack_require__(140), exports);
        __exportStar(__webpack_require__(121), exports);
        __exportStar(__webpack_require__(136), exports);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Block = void 0;
        const constants_1 = __webpack_require__(120);
        const uint64_1 = __webpack_require__(121);
        class Block {
            constructor() {
                this.type = 0;
                this.description = "UNKNOWN";
                this.comment = "";
                this.sectorNumber = 0;
                this.sectorCount = 0;
                this.compressedOffset = 0;
                this.compressedLength = 0;
            }
            static getDescription(type) {
                switch (type) {
                  case constants_1.BLOCK.ZEROFILL:
                    return "ZEROFILL";
                    break;

                  case constants_1.BLOCK.RAW:
                    return "UDRW (raw)";
                    break;

                  case constants_1.BLOCK.FREE:
                    return "FREE (unallocated)";
                    break;

                  case constants_1.BLOCK.UDCO:
                    return "UDCO (adc-compressed)";
                    break;

                  case constants_1.BLOCK.UDZO:
                    return "UDZO (zlib-compressed)";
                    break;

                  case constants_1.BLOCK.UDBZ:
                    return "UDBZ (bzip2-compressed)";
                    break;

                  case constants_1.BLOCK.COMMENT:
                    return "COMMENT";
                    break;

                  case constants_1.BLOCK.TERMINATOR:
                    return "TERMINATOR";
                    break;

                  default:
                    return "UNKNOWN";
                    break;
                }
            }
            static parse(buffer, offset = 0) {
                return (new Block).parse(buffer, offset);
            }
            parse(buffer, offset = 0) {
                this.type = buffer.readUInt32BE(offset + 0);
                this.description = Block.getDescription(this.type);
                this.comment = buffer.toString("ascii", offset + 4, offset + 8).replace(/\u0000/g, "");
                this.sectorNumber = uint64_1.readBE(buffer, offset + 8);
                this.sectorCount = uint64_1.readBE(buffer, offset + 16);
                this.compressedOffset = uint64_1.readBE(buffer, offset + 24);
                this.compressedLength = uint64_1.readBE(buffer, offset + 32);
                return this;
            }
            write(buffer, offset = 0) {
                buffer.writeUInt32BE(this.type, offset + 0);
                buffer.write(this.comment, offset + 4, 4, "ascii");
                uint64_1.writeBE(buffer, this.sectorNumber, offset + 8);
                uint64_1.writeBE(buffer, this.sectorCount, offset + 16);
                uint64_1.writeBE(buffer, this.compressedOffset, offset + 24);
                uint64_1.writeBE(buffer, this.compressedLength, offset + 32);
                return buffer;
            }
        }
        exports.Block = Block;
        Block.SIZE = 40;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BLOCK = exports.CHECKSUM_TYPE = exports.SECTOR_SIZE = void 0;
        exports.SECTOR_SIZE = 512;
        var CHECKSUM_TYPE;
        (function(CHECKSUM_TYPE) {
            CHECKSUM_TYPE[CHECKSUM_TYPE["NONE"] = 0] = "NONE";
            CHECKSUM_TYPE[CHECKSUM_TYPE["CRC32"] = 2] = "CRC32";
        })(CHECKSUM_TYPE = exports.CHECKSUM_TYPE || (exports.CHECKSUM_TYPE = {}));
        var BLOCK;
        (function(BLOCK) {
            BLOCK[BLOCK["ZEROFILL"] = 0] = "ZEROFILL";
            BLOCK[BLOCK["RAW"] = 1] = "RAW";
            BLOCK[BLOCK["FREE"] = 2] = "FREE";
            BLOCK[BLOCK["UDCO"] = 2147483652] = "UDCO";
            BLOCK[BLOCK["UDZO"] = 2147483653] = "UDZO";
            BLOCK[BLOCK["UDBZ"] = 2147483654] = "UDBZ";
            BLOCK[BLOCK["LZFSE"] = 2147483655] = "LZFSE";
            BLOCK[BLOCK["COMMENT"] = 2147483646] = "COMMENT";
            BLOCK[BLOCK["TERMINATOR"] = 4294967295] = "TERMINATOR";
        })(BLOCK = exports.BLOCK || (exports.BLOCK = {}));
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.writeBE = exports.readBE = void 0;
        const MAX_UINT32 = Math.pow(2, 32);
        function readBE(buffer, offset) {
            offset = offset || 0;
            const hi = buffer.readUInt32BE(offset);
            const lo = buffer.readUInt32BE(offset + 4);
            return hi * MAX_UINT32 + lo;
        }
        exports.readBE = readBE;
        function writeBE(buffer, value, offset) {
            offset = offset || 0;
            const hi = value / MAX_UINT32;
            const lo = value - hi * MAX_UINT32;
            buffer.writeUInt32BE(hi, offset);
            buffer.writeUInt32BE(lo, offset + 4);
            return offset + 8;
        }
        exports.writeBE = writeBE;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BlockMap = void 0;
        const checksum_1 = __webpack_require__(123);
        const uint64_1 = __webpack_require__(121);
        const block_1 = __webpack_require__(119);
        class BlockMap {
            constructor() {
                this.signature = 0;
                this.version = 0;
                this.sectorNumber = 0;
                this.sectorCount = 0;
                this.dataOffset = 0;
                this.buffersNeeded = 0;
                this.blockDescriptorCount = 0;
                this.reserved1 = 0;
                this.reserved2 = 0;
                this.reserved3 = 0;
                this.reserved4 = 0;
                this.reserved5 = 0;
                this.reserved6 = 0;
                this.checksum = new checksum_1.Checksum;
                this.blockCount = 0;
                this.blocks = [];
            }
            static parse(buffer, offset = 0) {
                return (new BlockMap).parse(buffer, offset);
            }
            parse(buffer, offset = 0) {
                this.signature = buffer.readUInt32BE(offset + 0);
                if (this.signature !== BlockMap.SIGNATURE) {
                    const expected = BlockMap.SIGNATURE.toString(16);
                    const actual = this.signature.toString(16);
                    throw new Error(`Invalid block map signature: Expected 0x${expected}, saw 0x${actual}`);
                }
                this.version = buffer.readUInt32BE(offset + 4);
                this.sectorNumber = uint64_1.readBE(buffer, offset + 8);
                this.sectorCount = uint64_1.readBE(buffer, offset + 16);
                this.dataOffset = uint64_1.readBE(buffer, offset + 24);
                this.buffersNeeded = buffer.readUInt32BE(offset + 32);
                this.blockDescriptorCount = buffer.readUInt32BE(offset + 36);
                this.reserved1 = buffer.readUInt32BE(offset + 40);
                this.reserved2 = buffer.readUInt32BE(offset + 44);
                this.reserved3 = buffer.readUInt32BE(offset + 48);
                this.reserved4 = buffer.readUInt32BE(offset + 52);
                this.reserved5 = buffer.readUInt32BE(offset + 56);
                this.reserved6 = buffer.readUInt32BE(offset + 60);
                this.checksum.parse(buffer, offset + 64);
                this.blockCount = buffer.readUInt32BE(offset + 200);
                this.blocks = [];
                for (let i = 0; i < this.blockCount; i++) {
                    this.blocks.push(block_1.Block.parse(buffer, BlockMap.SIZE + i * block_1.Block.SIZE + offset));
                }
                return this;
            }
            write(buffer, offset = 0) {
                const length = BlockMap.SIZE + this.blocks.length * block_1.Block.SIZE;
                offset = offset || 0;
                buffer = buffer || Buffer.alloc(length + offset);
                this.blockCount = this.blocks.length;
                buffer.writeUInt32BE(this.signature, offset + 0);
                buffer.writeUInt32BE(this.version, offset + 4);
                uint64_1.writeBE(buffer, this.sectorNumber, offset + 8);
                uint64_1.writeBE(buffer, this.sectorCount, offset + 16);
                uint64_1.writeBE(buffer, this.dataOffset, offset + 24);
                buffer.writeUInt32BE(this.buffersNeeded, offset + 32);
                buffer.writeUInt32BE(this.blockDescriptorCount, offset + 36);
                buffer.writeUInt32BE(this.reserved1, offset + 40);
                buffer.writeUInt32BE(this.reserved2, offset + 44);
                buffer.writeUInt32BE(this.reserved3, offset + 48);
                buffer.writeUInt32BE(this.reserved4, offset + 52);
                buffer.writeUInt32BE(this.reserved5, offset + 56);
                buffer.writeUInt32BE(this.reserved6, offset + 60);
                this.checksum.write(buffer, offset + 64);
                buffer.writeUInt32BE(this.blockCount, offset + 200);
                for (let i = 0; i < this.blockCount; i++) {
                    this.blocks[i].write(buffer, BlockMap.SIZE + i * block_1.Block.SIZE + offset);
                }
                return buffer;
            }
        }
        exports.BlockMap = BlockMap;
        BlockMap.SIZE = 204;
        BlockMap.SIGNATURE = 1835627368;
        BlockMap.VERSION = 1;
        BlockMap.Block = block_1.Block;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Checksum = void 0;
        const constants_1 = __webpack_require__(120);
        class Checksum {
            constructor() {
                this.type = constants_1.CHECKSUM_TYPE.NONE;
                this.bits = 0;
                this.value = "";
            }
            static parse(buffer, offset) {
                return (new Checksum).parse(buffer, offset);
            }
            parse(buffer, offset = 0) {
                this.type = buffer.readUInt32BE(offset + 0);
                this.bits = buffer.readUInt32BE(offset + 4);
                this.value = buffer.toString("hex", offset + 8, offset + 8 + this.bits / 8);
                return this;
            }
            write(buffer, offset = 0) {
                buffer = buffer || Buffer.alloc(Checksum.SIZE + offset);
                buffer.writeUInt32BE(this.type, offset + 0);
                buffer.writeUInt32BE(this.bits, offset + 4);
                buffer.write(this.value, offset + 8, this.bits / 8, "hex");
                return buffer;
            }
        }
        exports.Checksum = Checksum;
        Checksum.SIZE = 128;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Footer = void 0;
        const checksum_1 = __webpack_require__(123);
        const uint64_1 = __webpack_require__(121);
        class Footer {
            constructor() {
                this.signature = Footer.SIGNATURE;
                this.version = 0;
                this.headerSize = 0;
                this.flags = 0;
                this.runningDataForkOffset = 0;
                this.dataForkOffset = 0;
                this.dataForkLength = 0;
                this.resourceForkOffset = 0;
                this.resourceForkLength = 0;
                this.segmentNumber = 0;
                this.segmentCount = 0;
                this.segmentId = Buffer.alloc(16);
                this.dataChecksum = new checksum_1.Checksum;
                this.xmlOffset = 0;
                this.xmlLength = 0;
                this.reserved1 = Buffer.alloc(120);
                this.checksum = new checksum_1.Checksum;
                this.imageVariant = 0;
                this.sectorCount = 0;
                this.reserved2 = 0;
                this.reserved3 = 0;
                this.reserved4 = 0;
            }
            static parse(buffer, offset = 0) {
                return (new Footer).parse(buffer, offset);
            }
            parse(buffer, offset = 0) {
                this.signature = buffer.readUInt32BE(offset + 0);
                if (this.signature !== Footer.SIGNATURE) {
                    const expected = Footer.SIGNATURE.toString(16);
                    const actual = this.signature.toString(16);
                    throw new Error(`Invalid footer signature: Expected 0x${expected}, saw 0x${actual}`);
                }
                this.version = buffer.readUInt32BE(offset + 4);
                this.headerSize = buffer.readUInt32BE(offset + 8);
                this.flags = buffer.readUInt32BE(offset + 12);
                this.runningDataForkOffset = uint64_1.readBE(buffer, offset + 16);
                this.dataForkOffset = uint64_1.readBE(buffer, offset + 24);
                this.dataForkLength = uint64_1.readBE(buffer, offset + 32);
                this.resourceForkOffset = uint64_1.readBE(buffer, offset + 40);
                this.resourceForkLength = uint64_1.readBE(buffer, offset + 48);
                this.segmentNumber = buffer.readUInt32BE(offset + 56);
                this.segmentCount = buffer.readUInt32BE(offset + 60);
                buffer.copy(this.segmentId, 0, offset + 64, offset + 64 + 16);
                this.dataChecksum.parse(buffer, offset + 80);
                this.xmlOffset = uint64_1.readBE(buffer, offset + 216);
                this.xmlLength = uint64_1.readBE(buffer, offset + 224);
                buffer.copy(this.reserved1, 0, offset + 232, offset + 232 + 120);
                this.checksum.parse(buffer, offset + 352);
                this.imageVariant = buffer.readUInt32BE(offset + 488);
                this.sectorCount = uint64_1.readBE(buffer, offset + 492);
                this.reserved2 = buffer.readUInt32BE(offset + 500);
                this.reserved3 = buffer.readUInt32BE(offset + 504);
                this.reserved4 = buffer.readUInt32BE(offset + 508);
                return this;
            }
            write(buffer, offset = 0) {
                buffer = buffer || Buffer.alloc(Footer.SIZE + offset);
                buffer.writeUInt32BE(this.signature, offset + 0);
                buffer.writeUInt32BE(this.version, offset + 4);
                buffer.writeUInt32BE(this.headerSize, offset + 8);
                buffer.writeUInt32BE(this.flags, offset + 12);
                uint64_1.writeBE(buffer, this.runningDataForkOffset, offset + 16);
                uint64_1.writeBE(buffer, this.dataForkOffset, offset + 24);
                uint64_1.writeBE(buffer, this.dataForkLength, offset + 32);
                uint64_1.writeBE(buffer, this.resourceForkOffset, offset + 40);
                uint64_1.writeBE(buffer, this.resourceForkLength, offset + 48);
                buffer.writeUInt32BE(this.segmentNumber, offset + 56);
                buffer.writeUInt32BE(this.segmentCount, offset + 60);
                this.segmentId.copy(buffer, offset + 64);
                this.dataChecksum.write(buffer, offset + 80);
                uint64_1.writeBE(buffer, this.xmlOffset, offset + 216);
                uint64_1.writeBE(buffer, this.xmlLength, offset + 224);
                this.reserved1.copy(buffer, offset + 232);
                this.checksum.write(buffer, offset + 352);
                buffer.writeUInt32BE(this.imageVariant, offset + 488);
                uint64_1.writeBE(buffer, this.sectorCount, offset + 492);
                buffer.writeUInt32BE(this.reserved2, offset + 500);
                buffer.writeUInt32BE(this.reserved3, offset + 504);
                buffer.writeUInt32BE(this.reserved4, offset + 508);
                return buffer;
            }
        }
        exports.Footer = Footer;
        Footer.SIZE = 512;
        Footer.SIGNATURE = 1802464377;
        Footer.VERSION = 4;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Image = void 0;
        const plist = __webpack_require__(126);
        const crc32 = __webpack_require__(51);
        const stream_1 = __webpack_require__(17);
        const blockmap_1 = __webpack_require__(122);
        const constants_1 = __webpack_require__(120);
        const footer_1 = __webpack_require__(124);
        const readstream_1 = __webpack_require__(135);
        const sparse_readstream_1 = __webpack_require__(140);
        const utils_1 = __webpack_require__(136);
        class Image {
            constructor(fs) {
                this.fs = fs;
                this.resourceFork = {
                    blkx: [],
                    nsiz: [],
                    cSum: [],
                    plst: [],
                    size: []
                };
                this.ready = this.open();
            }
            async open() {
                await this.readFooter();
                await this.readPropertyList();
            }
            static parseBlkx(blkx) {
                return blkx.map((block => ({
                    id: +block["ID"],
                    attributes: +block["Attributes"],
                    name: block["Name"],
                    coreFoundationName: block["CFName"],
                    map: blockmap_1.BlockMap.parse(block["Data"])
                })));
            }
            static parseNsiz(nsiz) {
                return nsiz.map((block => ({
                    id: +block["ID"],
                    attributes: +block["Attributes"],
                    name: block["Name"],
                    data: plist.parse(block["Data"].toString()).data
                })));
            }
            static parsePlst(plst) {
                return plst.map((block => ({
                    id: +block["ID"],
                    attributes: +block["Attributes"],
                    name: block["Name"],
                    data: block["Data"]
                })));
            }
            static parseCsum(plst) {
                return plst.map((block => ({
                    id: +block["ID"],
                    attributes: +block["Attributes"],
                    name: block["Name"],
                    data: {
                        unknown: block["Data"].readUInt16LE(0),
                        type: block["Data"].readUInt32LE(2),
                        value: block["Data"].toString("hex", 6)
                    }
                })));
            }
            static parseSize(size) {
                return size.map((block => ({
                    id: +block["ID"],
                    attributes: +block["Attributes"],
                    name: block["Name"],
                    data: block["Data"]
                })));
            }
            async createReadStream(end = Infinity) {
                await this.ready;
                return stream_1.Readable.from(readstream_1.readStream(this, end));
            }
            async createSparseReadStream() {
                await this.ready;
                return stream_1.Readable.from(sparse_readstream_1.sparseReadStream(this));
            }
            async getUncompressedSize() {
                await this.ready;
                return this.resourceFork.blkx.reduce(((size, resource) => resource.map.blocks.reduce(((s, block) => s + block.sectorCount * constants_1.SECTOR_SIZE), size)), 0);
            }
            async getMappedSize() {
                await this.ready;
                return this.resourceFork.blkx.reduce(((size, resource) => resource.map.blocks.reduce(((s, block) => {
                    if (block.type !== constants_1.BLOCK.ZEROFILL && block.type !== constants_1.BLOCK.FREE) {
                        return s + block.sectorCount * constants_1.SECTOR_SIZE;
                    } else {
                        return s;
                    }
                }), size)), 0);
            }
            async verifyData() {
                await this.ready;
                if (this.footer === undefined) {
                    throw new Error("Must read footer before calling verifyData");
                }
                if (!this.footer.dataChecksum || this.footer.dataChecksum.type === constants_1.CHECKSUM_TYPE.NONE) {
                    return null;
                }
                let hash;
                let checksum = "";
                if (this.footer.dataChecksum.type === constants_1.CHECKSUM_TYPE.CRC32) {
                    hash = new crc32.Hash({
                        encoding: "hex"
                    });
                } else {
                    throw new Error(`Unknown or unsupported checksum type "${this.footer.dataChecksum.type}"`);
                }
                const readable = await this.fs.createReadStream(this.footer.dataForkOffset, this.footer.dataForkOffset + this.footer.dataForkLength - 1);
                return await new Promise(((resolve, reject) => {
                    readable.on("error", reject).pipe(hash).on("error", reject).on("readable", (function() {
                        let chunk = this.read();
                        while (chunk) {
                            checksum += chunk;
                            chunk = this.read();
                        }
                    })).on("end", (() => {
                        var _a, _b;
                        resolve(checksum === ((_b = (_a = this.footer) === null || _a === void 0 ? void 0 : _a.dataChecksum) === null || _b === void 0 ? void 0 : _b.value));
                    }));
                }));
            }
            async readFooter() {
                const length = footer_1.Footer.SIZE;
                const position = this.fs.size - footer_1.Footer.SIZE;
                const buffer = await utils_1.streamToBuffer(await this.fs.createReadStream(position, position + length - 1));
                this.footer = footer_1.Footer.parse(buffer);
                return this.footer;
            }
            async readPropertyList() {
                if (this.footer === undefined) {
                    throw new Error("Must read footer before property list");
                }
                const length = this.footer.xmlLength;
                const position = this.footer.xmlOffset;
                const buffer = await utils_1.streamToBuffer(await this.fs.createReadStream(position, position + length - 1));
                const data = plist.parse(buffer.toString()).data;
                const resourceFork = data["resource-fork"];
                if (resourceFork.blkx) {
                    this.resourceFork.blkx = Image.parseBlkx(resourceFork.blkx);
                }
                if (resourceFork.nsiz) {
                    this.resourceFork.nsiz = Image.parseNsiz(resourceFork.nsiz);
                }
                if (resourceFork.cSum) {
                    this.resourceFork.cSum = Image.parseCsum(resourceFork.cSum);
                }
                if (resourceFork.plst) {
                    this.resourceFork.plst = Image.parsePlst(resourceFork.plst);
                }
                if (resourceFork.size) {
                    this.resourceFork.size = Image.parseSize(resourceFork.size);
                }
                return this.resourceFork;
            }
        }
        exports.Image = Image;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        const JSON_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?Z$/;
        class Plist {
            constructor() {
                this.data = {};
            }
            get(keyPath) {
                var path = keyPath.split(".");
                var key = path.pop();
                var objRef = this.data;
                var pathComp = null;
                while (pathComp = path.shift()) {
                    if (objRef[pathComp] == null) return undefined;
                    objRef = objRef[pathComp];
                }
                return objRef[key];
            }
            set(keyPath, value) {
                var path = keyPath.split(".");
                var key = path.pop();
                var objRef = this.data;
                var pathComp = null;
                while (pathComp = path.shift()) {
                    if (objRef[pathComp] == null) return undefined;
                    objRef = objRef[pathComp];
                }
                return objRef[key] = value;
            }
            replace(keyPath, value) {
                if (this.get(keyPath) !== undefined) {
                    this.set(keyPath, value);
                    return true;
                }
                return false;
            }
            delete(keyPath) {
                this.data[keyPath] = undefined;
                delete this.data[keyPath];
            }
            parse(buffer, offset, length) {
                offset = offset || 0;
                length = length || buffer.length - offset;
                if (buffer.indexOf(Plist.SIGNATURE_BINARY, offset) === offset) {
                    return this.parseBinary(buffer, offset, length);
                } else if (buffer.indexOf(Plist.SIGNATURE_XML, offset) === offset) {
                    return this.parseXML(buffer, offset, length);
                } else if (buffer.indexOf(Plist.SIGNATURE_JSON, offset) === offset) {
                    return this.fromJSON(buffer.slice(offset, offset + length));
                }
                throw new Error(`Invalid property list signature at offset 0x${offset.toString(16)}`);
                return this;
            }
            parseBinary(buffer, offset, length) {
                this.data = Plist.binary.parse(buffer, offset, length);
                return this;
            }
            parseXML(buffer, offset, length) {
                this.data = Plist.xml.parse(buffer, offset, length);
                return this;
            }
            fromJSON(value) {
                this.data = null;
                if (typeof value === "string") {
                    this.data = JSON.parse(value, Plist.reviver);
                } else if (Buffer.isBuffer(value)) {
                    this.data = JSON.parse(value.toString("utf8"), Plist.reviver);
                } else {
                    this.data = JSON.parse(JSON.stringify(value), Plist.reviver);
                }
                return this;
            }
            toJSON() {
                return this.data;
            }
            toString() {
                return Plist.xml.write(this.data);
            }
            write(buffer, offset, encoding) {
                encoding = encoding || "binary";
                switch (encoding) {
                  case "binary":
                    return Plist.binary.write(this.data, buffer, offset);

                  case "xml":
                    return Buffer.from(this.toString());

                  case "json":
                    return Buffer.from(JSON.stringify(this.data));

                  default:
                    throw new Error(`Unknown encoding ${encoding}`);
                }
            }
        }
        module.exports = Plist;
        Plist.SIGNATURE_BINARY = "bplist";
        Plist.SIGNATURE_XML = "<?xml ";
        Plist.SIGNATURE_JSON = "{";
        Plist.EPOCH = 9783072e5;
        Plist.DOCTYPE = {
            "1.0": '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">'
        };
        Plist.xml = {
            parse: __webpack_require__(127),
            write: __webpack_require__(130)
        };
        Plist.binary = {
            parse: __webpack_require__(132),
            write: __webpack_require__(134)
        };
        Plist.reviver = function(key, value) {
            var isBuffer = typeof value === "object" && !Array.isArray(value) && value.type === "Buffer" && Array.isArray(value.data);
            if (isBuffer) {
                return Buffer.from(value.data);
            }
            if (typeof value == "string" && JSON_DATE_PATTERN.test(value)) {
                return new Date(value);
            }
            return value;
        };
        Plist.fromJSON = function(value) {
            return (new Plist).fromJSON(value);
        };
        Plist.parse = function(buffer, offset) {
            return (new Plist).parse(buffer, offset);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Plist = __webpack_require__(126);
        var sax = __webpack_require__(128);
        var depth = 0;
        var state = [];
        var values = [];
        var keys = [];
        var textContent = "";
        function isStruct(name) {
            return name === "dict" || name === "array" || name === "set";
        }
        function isValue(name) {
            return name === "string" || name === "integer" || name === "real" || name === "true" || name === "false" || name === "null" || name === "data" || name === "date";
        }
        function reset() {
            depth = 0;
            state = [];
            values = [];
            key = "";
            textContent = "";
        }
        function pushValue() {
            switch (state[0]) {
              case "true":
                values.unshift(true);
                break;

              case "false":
                values.unshift(false);
                break;

              case "null":
                values.unshift(null);
                break;

              case "string":
                values.unshift(textContent.trim());
                break;

              case "integer":
                values.unshift(+textContent.trim());
                break;

              case "real":
                values.unshift(+textContent.trim());
                break;

              case "data":
                values.unshift(Buffer.from(textContent.trim(), "base64"));
                break;

              case "date":
                values.unshift(new Date(textContent.trim()));
                break;
            }
        }
        function popValue() {
            switch (state[0]) {
              case "dict":
                values[1][keys.shift()] = values.shift();
                break;

              case "array":
                values[1].push(values.shift());
                break;

              case "set":
                values[1].add(values.shift());
                break;
            }
        }
        var parser = sax.parser(true);
        parser.onopentag = tag => {
            if (tag.name === "plist") {
                if (tag.attributes.version !== "1.0") {
                    reset();
                    parser.reset();
                    throw new Error(`Unsupported version "${tag.attributes.version}"`);
                }
                return;
            }
            state.unshift(tag.name);
            if (tag.name === "dict" || tag.name === "array" || tag.name === "set") {
                depth++;
                switch (tag.name) {
                  case "dict":
                    values.unshift({});
                    break;

                  case "array":
                    values.unshift([]);
                    break;

                  case "set":
                    values.unshift(new Set);
                    break;
                }
            }
        };
        parser.ontext = text => {
            if (state[0] === "key" || isValue(state[0])) textContent += text;
        };
        parser.onclosetag = name => {
            if (name === "plist") return;
            if (state[0] === "key") {
                keys.unshift(textContent.trim());
                textContent = "";
                state.shift();
                return;
            }
            if (isValue(name)) {
                pushValue();
                textContent = "";
                state.shift();
                if (isStruct(state[0])) {
                    popValue();
                }
            } else if (isStruct(name)) {
                state.shift();
                depth--;
                if (isStruct(state[0])) {
                    popValue();
                }
            } else {
                throw new Error(`Unexpected closing state for "${name}"`);
            }
        };
        parser.onend = () => {
            if (depth) {
                var msg = `Unbalanced structure, remaining depth of ${depth}`;
                reset();
                parser.reset();
                throw new Error(msg);
            }
        };
        function parse(buffer, offset, length) {
            offset = offset || 0;
            length = length || buffer.length - offset;
            if (buffer.indexOf(Plist.SIGNATURE_XML, offset) !== offset) {
                throw new Error(`Invalid property list signature at offset 0x${offset.toString(16)}`);
            }
            var xml = Buffer.isBuffer(buffer) ? buffer.toString("utf8", offset, offset + length) : offset === 0 ? buffer : buffer.slice(offset, offset + length);
            parser.write(xml).close();
            var data = values[0];
            reset();
            return data;
        }
        module.exports = parse;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        (function(sax) {
            sax.parser = function(strict, opt) {
                return new SAXParser(strict, opt);
            };
            sax.SAXParser = SAXParser;
            sax.SAXStream = SAXStream;
            sax.createStream = createStream;
            sax.MAX_BUFFER_LENGTH = 64 * 1024;
            var buffers = [ "comment", "sgmlDecl", "textNode", "tagName", "doctype", "procInstName", "procInstBody", "entity", "attribName", "attribValue", "cdata", "script" ];
            sax.EVENTS = [ "text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "opentagstart", "attribute", "opentag", "closetag", "opencdata", "cdata", "closecdata", "error", "end", "ready", "script", "opennamespace", "closenamespace" ];
            function SAXParser(strict, opt) {
                if (!(this instanceof SAXParser)) {
                    return new SAXParser(strict, opt);
                }
                var parser = this;
                clearBuffers(parser);
                parser.q = parser.c = "";
                parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH;
                parser.opt = opt || {};
                parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags;
                parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase";
                parser.tags = [];
                parser.closed = parser.closedRoot = parser.sawRoot = false;
                parser.tag = parser.error = null;
                parser.strict = !!strict;
                parser.noscript = !!(strict || parser.opt.noscript);
                parser.state = S.BEGIN;
                parser.strictEntities = parser.opt.strictEntities;
                parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES);
                parser.attribList = [];
                if (parser.opt.xmlns) {
                    parser.ns = Object.create(rootNS);
                }
                parser.trackPosition = parser.opt.position !== false;
                if (parser.trackPosition) {
                    parser.position = parser.line = parser.column = 0;
                }
                emit(parser, "onready");
            }
            if (!Object.create) {
                Object.create = function(o) {
                    function F() {}
                    F.prototype = o;
                    var newf = new F;
                    return newf;
                };
            }
            if (!Object.keys) {
                Object.keys = function(o) {
                    var a = [];
                    for (var i in o) if (o.hasOwnProperty(i)) a.push(i);
                    return a;
                };
            }
            function checkBufferLength(parser) {
                var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10);
                var maxActual = 0;
                for (var i = 0, l = buffers.length; i < l; i++) {
                    var len = parser[buffers[i]].length;
                    if (len > maxAllowed) {
                        switch (buffers[i]) {
                          case "textNode":
                            closeText(parser);
                            break;

                          case "cdata":
                            emitNode(parser, "oncdata", parser.cdata);
                            parser.cdata = "";
                            break;

                          case "script":
                            emitNode(parser, "onscript", parser.script);
                            parser.script = "";
                            break;

                          default:
                            error(parser, "Max buffer length exceeded: " + buffers[i]);
                        }
                    }
                    maxActual = Math.max(maxActual, len);
                }
                var m = sax.MAX_BUFFER_LENGTH - maxActual;
                parser.bufferCheckPosition = m + parser.position;
            }
            function clearBuffers(parser) {
                for (var i = 0, l = buffers.length; i < l; i++) {
                    parser[buffers[i]] = "";
                }
            }
            function flushBuffers(parser) {
                closeText(parser);
                if (parser.cdata !== "") {
                    emitNode(parser, "oncdata", parser.cdata);
                    parser.cdata = "";
                }
                if (parser.script !== "") {
                    emitNode(parser, "onscript", parser.script);
                    parser.script = "";
                }
            }
            SAXParser.prototype = {
                end: function() {
                    end(this);
                },
                write,
                resume: function() {
                    this.error = null;
                    return this;
                },
                close: function() {
                    return this.write(null);
                },
                flush: function() {
                    flushBuffers(this);
                }
            };
            var Stream;
            try {
                Stream = __webpack_require__(17).Stream;
            } catch (ex) {
                Stream = function() {};
            }
            var streamWraps = sax.EVENTS.filter((function(ev) {
                return ev !== "error" && ev !== "end";
            }));
            function createStream(strict, opt) {
                return new SAXStream(strict, opt);
            }
            function SAXStream(strict, opt) {
                if (!(this instanceof SAXStream)) {
                    return new SAXStream(strict, opt);
                }
                Stream.apply(this);
                this._parser = new SAXParser(strict, opt);
                this.writable = true;
                this.readable = true;
                var me = this;
                this._parser.onend = function() {
                    me.emit("end");
                };
                this._parser.onerror = function(er) {
                    me.emit("error", er);
                    me._parser.error = null;
                };
                this._decoder = null;
                streamWraps.forEach((function(ev) {
                    Object.defineProperty(me, "on" + ev, {
                        get: function() {
                            return me._parser["on" + ev];
                        },
                        set: function(h) {
                            if (!h) {
                                me.removeAllListeners(ev);
                                me._parser["on" + ev] = h;
                                return h;
                            }
                            me.on(ev, h);
                        },
                        enumerable: true,
                        configurable: false
                    });
                }));
            }
            SAXStream.prototype = Object.create(Stream.prototype, {
                constructor: {
                    value: SAXStream
                }
            });
            SAXStream.prototype.write = function(data) {
                if (typeof Buffer === "function" && typeof Buffer.isBuffer === "function" && Buffer.isBuffer(data)) {
                    if (!this._decoder) {
                        var SD = __webpack_require__(129).StringDecoder;
                        this._decoder = new SD("utf8");
                    }
                    data = this._decoder.write(data);
                }
                this._parser.write(data.toString());
                this.emit("data", data);
                return true;
            };
            SAXStream.prototype.end = function(chunk) {
                if (chunk && chunk.length) {
                    this.write(chunk);
                }
                this._parser.end();
                return true;
            };
            SAXStream.prototype.on = function(ev, handler) {
                var me = this;
                if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
                    me._parser["on" + ev] = function() {
                        var args = arguments.length === 1 ? [ arguments[0] ] : Array.apply(null, arguments);
                        args.splice(0, 0, ev);
                        me.emit.apply(me, args);
                    };
                }
                return Stream.prototype.on.call(me, ev, handler);
            };
            var CDATA = "[CDATA[";
            var DOCTYPE = "DOCTYPE";
            var XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
            var XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
            var rootNS = {
                xml: XML_NAMESPACE,
                xmlns: XMLNS_NAMESPACE
            };
            var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
            var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
            var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
            var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
            function isWhitespace(c) {
                return c === " " || c === "\n" || c === "\r" || c === "\t";
            }
            function isQuote(c) {
                return c === '"' || c === "'";
            }
            function isAttribEnd(c) {
                return c === ">" || isWhitespace(c);
            }
            function isMatch(regex, c) {
                return regex.test(c);
            }
            function notMatch(regex, c) {
                return !isMatch(regex, c);
            }
            var S = 0;
            sax.STATE = {
                BEGIN: S++,
                BEGIN_WHITESPACE: S++,
                TEXT: S++,
                TEXT_ENTITY: S++,
                OPEN_WAKA: S++,
                SGML_DECL: S++,
                SGML_DECL_QUOTED: S++,
                DOCTYPE: S++,
                DOCTYPE_QUOTED: S++,
                DOCTYPE_DTD: S++,
                DOCTYPE_DTD_QUOTED: S++,
                COMMENT_STARTING: S++,
                COMMENT: S++,
                COMMENT_ENDING: S++,
                COMMENT_ENDED: S++,
                CDATA: S++,
                CDATA_ENDING: S++,
                CDATA_ENDING_2: S++,
                PROC_INST: S++,
                PROC_INST_BODY: S++,
                PROC_INST_ENDING: S++,
                OPEN_TAG: S++,
                OPEN_TAG_SLASH: S++,
                ATTRIB: S++,
                ATTRIB_NAME: S++,
                ATTRIB_NAME_SAW_WHITE: S++,
                ATTRIB_VALUE: S++,
                ATTRIB_VALUE_QUOTED: S++,
                ATTRIB_VALUE_CLOSED: S++,
                ATTRIB_VALUE_UNQUOTED: S++,
                ATTRIB_VALUE_ENTITY_Q: S++,
                ATTRIB_VALUE_ENTITY_U: S++,
                CLOSE_TAG: S++,
                CLOSE_TAG_SAW_WHITE: S++,
                SCRIPT: S++,
                SCRIPT_ENDING: S++
            };
            sax.XML_ENTITIES = {
                amp: "&",
                gt: ">",
                lt: "<",
                quot: '"',
                apos: "'"
            };
            sax.ENTITIES = {
                amp: "&",
                gt: ">",
                lt: "<",
                quot: '"',
                apos: "'",
                AElig: 198,
                Aacute: 193,
                Acirc: 194,
                Agrave: 192,
                Aring: 197,
                Atilde: 195,
                Auml: 196,
                Ccedil: 199,
                ETH: 208,
                Eacute: 201,
                Ecirc: 202,
                Egrave: 200,
                Euml: 203,
                Iacute: 205,
                Icirc: 206,
                Igrave: 204,
                Iuml: 207,
                Ntilde: 209,
                Oacute: 211,
                Ocirc: 212,
                Ograve: 210,
                Oslash: 216,
                Otilde: 213,
                Ouml: 214,
                THORN: 222,
                Uacute: 218,
                Ucirc: 219,
                Ugrave: 217,
                Uuml: 220,
                Yacute: 221,
                aacute: 225,
                acirc: 226,
                aelig: 230,
                agrave: 224,
                aring: 229,
                atilde: 227,
                auml: 228,
                ccedil: 231,
                eacute: 233,
                ecirc: 234,
                egrave: 232,
                eth: 240,
                euml: 235,
                iacute: 237,
                icirc: 238,
                igrave: 236,
                iuml: 239,
                ntilde: 241,
                oacute: 243,
                ocirc: 244,
                ograve: 242,
                oslash: 248,
                otilde: 245,
                ouml: 246,
                szlig: 223,
                thorn: 254,
                uacute: 250,
                ucirc: 251,
                ugrave: 249,
                uuml: 252,
                yacute: 253,
                yuml: 255,
                copy: 169,
                reg: 174,
                nbsp: 160,
                iexcl: 161,
                cent: 162,
                pound: 163,
                curren: 164,
                yen: 165,
                brvbar: 166,
                sect: 167,
                uml: 168,
                ordf: 170,
                laquo: 171,
                not: 172,
                shy: 173,
                macr: 175,
                deg: 176,
                plusmn: 177,
                sup1: 185,
                sup2: 178,
                sup3: 179,
                acute: 180,
                micro: 181,
                para: 182,
                middot: 183,
                cedil: 184,
                ordm: 186,
                raquo: 187,
                frac14: 188,
                frac12: 189,
                frac34: 190,
                iquest: 191,
                times: 215,
                divide: 247,
                OElig: 338,
                oelig: 339,
                Scaron: 352,
                scaron: 353,
                Yuml: 376,
                fnof: 402,
                circ: 710,
                tilde: 732,
                Alpha: 913,
                Beta: 914,
                Gamma: 915,
                Delta: 916,
                Epsilon: 917,
                Zeta: 918,
                Eta: 919,
                Theta: 920,
                Iota: 921,
                Kappa: 922,
                Lambda: 923,
                Mu: 924,
                Nu: 925,
                Xi: 926,
                Omicron: 927,
                Pi: 928,
                Rho: 929,
                Sigma: 931,
                Tau: 932,
                Upsilon: 933,
                Phi: 934,
                Chi: 935,
                Psi: 936,
                Omega: 937,
                alpha: 945,
                beta: 946,
                gamma: 947,
                delta: 948,
                epsilon: 949,
                zeta: 950,
                eta: 951,
                theta: 952,
                iota: 953,
                kappa: 954,
                lambda: 955,
                mu: 956,
                nu: 957,
                xi: 958,
                omicron: 959,
                pi: 960,
                rho: 961,
                sigmaf: 962,
                sigma: 963,
                tau: 964,
                upsilon: 965,
                phi: 966,
                chi: 967,
                psi: 968,
                omega: 969,
                thetasym: 977,
                upsih: 978,
                piv: 982,
                ensp: 8194,
                emsp: 8195,
                thinsp: 8201,
                zwnj: 8204,
                zwj: 8205,
                lrm: 8206,
                rlm: 8207,
                ndash: 8211,
                mdash: 8212,
                lsquo: 8216,
                rsquo: 8217,
                sbquo: 8218,
                ldquo: 8220,
                rdquo: 8221,
                bdquo: 8222,
                dagger: 8224,
                Dagger: 8225,
                bull: 8226,
                hellip: 8230,
                permil: 8240,
                prime: 8242,
                Prime: 8243,
                lsaquo: 8249,
                rsaquo: 8250,
                oline: 8254,
                frasl: 8260,
                euro: 8364,
                image: 8465,
                weierp: 8472,
                real: 8476,
                trade: 8482,
                alefsym: 8501,
                larr: 8592,
                uarr: 8593,
                rarr: 8594,
                darr: 8595,
                harr: 8596,
                crarr: 8629,
                lArr: 8656,
                uArr: 8657,
                rArr: 8658,
                dArr: 8659,
                hArr: 8660,
                forall: 8704,
                part: 8706,
                exist: 8707,
                empty: 8709,
                nabla: 8711,
                isin: 8712,
                notin: 8713,
                ni: 8715,
                prod: 8719,
                sum: 8721,
                minus: 8722,
                lowast: 8727,
                radic: 8730,
                prop: 8733,
                infin: 8734,
                ang: 8736,
                and: 8743,
                or: 8744,
                cap: 8745,
                cup: 8746,
                int: 8747,
                there4: 8756,
                sim: 8764,
                cong: 8773,
                asymp: 8776,
                ne: 8800,
                equiv: 8801,
                le: 8804,
                ge: 8805,
                sub: 8834,
                sup: 8835,
                nsub: 8836,
                sube: 8838,
                supe: 8839,
                oplus: 8853,
                otimes: 8855,
                perp: 8869,
                sdot: 8901,
                lceil: 8968,
                rceil: 8969,
                lfloor: 8970,
                rfloor: 8971,
                lang: 9001,
                rang: 9002,
                loz: 9674,
                spades: 9824,
                clubs: 9827,
                hearts: 9829,
                diams: 9830
            };
            Object.keys(sax.ENTITIES).forEach((function(key) {
                var e = sax.ENTITIES[key];
                var s = typeof e === "number" ? String.fromCharCode(e) : e;
                sax.ENTITIES[key] = s;
            }));
            for (var s in sax.STATE) {
                sax.STATE[sax.STATE[s]] = s;
            }
            S = sax.STATE;
            function emit(parser, event, data) {
                parser[event] && parser[event](data);
            }
            function emitNode(parser, nodeType, data) {
                if (parser.textNode) closeText(parser);
                emit(parser, nodeType, data);
            }
            function closeText(parser) {
                parser.textNode = textopts(parser.opt, parser.textNode);
                if (parser.textNode) emit(parser, "ontext", parser.textNode);
                parser.textNode = "";
            }
            function textopts(opt, text) {
                if (opt.trim) text = text.trim();
                if (opt.normalize) text = text.replace(/\s+/g, " ");
                return text;
            }
            function error(parser, er) {
                closeText(parser);
                if (parser.trackPosition) {
                    er += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c;
                }
                er = new Error(er);
                parser.error = er;
                emit(parser, "onerror", er);
                return parser;
            }
            function end(parser) {
                if (parser.sawRoot && !parser.closedRoot) strictFail(parser, "Unclosed root tag");
                if (parser.state !== S.BEGIN && parser.state !== S.BEGIN_WHITESPACE && parser.state !== S.TEXT) {
                    error(parser, "Unexpected end");
                }
                closeText(parser);
                parser.c = "";
                parser.closed = true;
                emit(parser, "onend");
                SAXParser.call(parser, parser.strict, parser.opt);
                return parser;
            }
            function strictFail(parser, message) {
                if (typeof parser !== "object" || !(parser instanceof SAXParser)) {
                    throw new Error("bad call to strictFail");
                }
                if (parser.strict) {
                    error(parser, message);
                }
            }
            function newTag(parser) {
                if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]();
                var parent = parser.tags[parser.tags.length - 1] || parser;
                var tag = parser.tag = {
                    name: parser.tagName,
                    attributes: {}
                };
                if (parser.opt.xmlns) {
                    tag.ns = parent.ns;
                }
                parser.attribList.length = 0;
                emitNode(parser, "onopentagstart", tag);
            }
            function qname(name, attribute) {
                var i = name.indexOf(":");
                var qualName = i < 0 ? [ "", name ] : name.split(":");
                var prefix = qualName[0];
                var local = qualName[1];
                if (attribute && name === "xmlns") {
                    prefix = "xmlns";
                    local = "";
                }
                return {
                    prefix,
                    local
                };
            }
            function attrib(parser) {
                if (!parser.strict) {
                    parser.attribName = parser.attribName[parser.looseCase]();
                }
                if (parser.attribList.indexOf(parser.attribName) !== -1 || parser.tag.attributes.hasOwnProperty(parser.attribName)) {
                    parser.attribName = parser.attribValue = "";
                    return;
                }
                if (parser.opt.xmlns) {
                    var qn = qname(parser.attribName, true);
                    var prefix = qn.prefix;
                    var local = qn.local;
                    if (prefix === "xmlns") {
                        if (local === "xml" && parser.attribValue !== XML_NAMESPACE) {
                            strictFail(parser, "xml: prefix must be bound to " + XML_NAMESPACE + "\n" + "Actual: " + parser.attribValue);
                        } else if (local === "xmlns" && parser.attribValue !== XMLNS_NAMESPACE) {
                            strictFail(parser, "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\n" + "Actual: " + parser.attribValue);
                        } else {
                            var tag = parser.tag;
                            var parent = parser.tags[parser.tags.length - 1] || parser;
                            if (tag.ns === parent.ns) {
                                tag.ns = Object.create(parent.ns);
                            }
                            tag.ns[local] = parser.attribValue;
                        }
                    }
                    parser.attribList.push([ parser.attribName, parser.attribValue ]);
                } else {
                    parser.tag.attributes[parser.attribName] = parser.attribValue;
                    emitNode(parser, "onattribute", {
                        name: parser.attribName,
                        value: parser.attribValue
                    });
                }
                parser.attribName = parser.attribValue = "";
            }
            function openTag(parser, selfClosing) {
                if (parser.opt.xmlns) {
                    var tag = parser.tag;
                    var qn = qname(parser.tagName);
                    tag.prefix = qn.prefix;
                    tag.local = qn.local;
                    tag.uri = tag.ns[qn.prefix] || "";
                    if (tag.prefix && !tag.uri) {
                        strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName));
                        tag.uri = qn.prefix;
                    }
                    var parent = parser.tags[parser.tags.length - 1] || parser;
                    if (tag.ns && parent.ns !== tag.ns) {
                        Object.keys(tag.ns).forEach((function(p) {
                            emitNode(parser, "onopennamespace", {
                                prefix: p,
                                uri: tag.ns[p]
                            });
                        }));
                    }
                    for (var i = 0, l = parser.attribList.length; i < l; i++) {
                        var nv = parser.attribList[i];
                        var name = nv[0];
                        var value = nv[1];
                        var qualName = qname(name, true);
                        var prefix = qualName.prefix;
                        var local = qualName.local;
                        var uri = prefix === "" ? "" : tag.ns[prefix] || "";
                        var a = {
                            name,
                            value,
                            prefix,
                            local,
                            uri
                        };
                        if (prefix && prefix !== "xmlns" && !uri) {
                            strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix));
                            a.uri = prefix;
                        }
                        parser.tag.attributes[name] = a;
                        emitNode(parser, "onattribute", a);
                    }
                    parser.attribList.length = 0;
                }
                parser.tag.isSelfClosing = !!selfClosing;
                parser.sawRoot = true;
                parser.tags.push(parser.tag);
                emitNode(parser, "onopentag", parser.tag);
                if (!selfClosing) {
                    if (!parser.noscript && parser.tagName.toLowerCase() === "script") {
                        parser.state = S.SCRIPT;
                    } else {
                        parser.state = S.TEXT;
                    }
                    parser.tag = null;
                    parser.tagName = "";
                }
                parser.attribName = parser.attribValue = "";
                parser.attribList.length = 0;
            }
            function closeTag(parser) {
                if (!parser.tagName) {
                    strictFail(parser, "Weird empty close tag.");
                    parser.textNode += "</>";
                    parser.state = S.TEXT;
                    return;
                }
                if (parser.script) {
                    if (parser.tagName !== "script") {
                        parser.script += "</" + parser.tagName + ">";
                        parser.tagName = "";
                        parser.state = S.SCRIPT;
                        return;
                    }
                    emitNode(parser, "onscript", parser.script);
                    parser.script = "";
                }
                var t = parser.tags.length;
                var tagName = parser.tagName;
                if (!parser.strict) {
                    tagName = tagName[parser.looseCase]();
                }
                var closeTo = tagName;
                while (t--) {
                    var close = parser.tags[t];
                    if (close.name !== closeTo) {
                        strictFail(parser, "Unexpected close tag");
                    } else {
                        break;
                    }
                }
                if (t < 0) {
                    strictFail(parser, "Unmatched closing tag: " + parser.tagName);
                    parser.textNode += "</" + parser.tagName + ">";
                    parser.state = S.TEXT;
                    return;
                }
                parser.tagName = tagName;
                var s = parser.tags.length;
                while (s-- > t) {
                    var tag = parser.tag = parser.tags.pop();
                    parser.tagName = parser.tag.name;
                    emitNode(parser, "onclosetag", parser.tagName);
                    var x = {};
                    for (var i in tag.ns) {
                        x[i] = tag.ns[i];
                    }
                    var parent = parser.tags[parser.tags.length - 1] || parser;
                    if (parser.opt.xmlns && tag.ns !== parent.ns) {
                        Object.keys(tag.ns).forEach((function(p) {
                            var n = tag.ns[p];
                            emitNode(parser, "onclosenamespace", {
                                prefix: p,
                                uri: n
                            });
                        }));
                    }
                }
                if (t === 0) parser.closedRoot = true;
                parser.tagName = parser.attribValue = parser.attribName = "";
                parser.attribList.length = 0;
                parser.state = S.TEXT;
            }
            function parseEntity(parser) {
                var entity = parser.entity;
                var entityLC = entity.toLowerCase();
                var num;
                var numStr = "";
                if (parser.ENTITIES[entity]) {
                    return parser.ENTITIES[entity];
                }
                if (parser.ENTITIES[entityLC]) {
                    return parser.ENTITIES[entityLC];
                }
                entity = entityLC;
                if (entity.charAt(0) === "#") {
                    if (entity.charAt(1) === "x") {
                        entity = entity.slice(2);
                        num = parseInt(entity, 16);
                        numStr = num.toString(16);
                    } else {
                        entity = entity.slice(1);
                        num = parseInt(entity, 10);
                        numStr = num.toString(10);
                    }
                }
                entity = entity.replace(/^0+/, "");
                if (isNaN(num) || numStr.toLowerCase() !== entity) {
                    strictFail(parser, "Invalid character entity");
                    return "&" + parser.entity + ";";
                }
                return String.fromCodePoint(num);
            }
            function beginWhiteSpace(parser, c) {
                if (c === "<") {
                    parser.state = S.OPEN_WAKA;
                    parser.startTagPosition = parser.position;
                } else if (!isWhitespace(c)) {
                    strictFail(parser, "Non-whitespace before first tag.");
                    parser.textNode = c;
                    parser.state = S.TEXT;
                }
            }
            function charAt(chunk, i) {
                var result = "";
                if (i < chunk.length) {
                    result = chunk.charAt(i);
                }
                return result;
            }
            function write(chunk) {
                var parser = this;
                if (this.error) {
                    throw this.error;
                }
                if (parser.closed) {
                    return error(parser, "Cannot write after close. Assign an onready handler.");
                }
                if (chunk === null) {
                    return end(parser);
                }
                if (typeof chunk === "object") {
                    chunk = chunk.toString();
                }
                var i = 0;
                var c = "";
                while (true) {
                    c = charAt(chunk, i++);
                    parser.c = c;
                    if (!c) {
                        break;
                    }
                    if (parser.trackPosition) {
                        parser.position++;
                        if (c === "\n") {
                            parser.line++;
                            parser.column = 0;
                        } else {
                            parser.column++;
                        }
                    }
                    switch (parser.state) {
                      case S.BEGIN:
                        parser.state = S.BEGIN_WHITESPACE;
                        if (c === "\ufeff") {
                            continue;
                        }
                        beginWhiteSpace(parser, c);
                        continue;

                      case S.BEGIN_WHITESPACE:
                        beginWhiteSpace(parser, c);
                        continue;

                      case S.TEXT:
                        if (parser.sawRoot && !parser.closedRoot) {
                            var starti = i - 1;
                            while (c && c !== "<" && c !== "&") {
                                c = charAt(chunk, i++);
                                if (c && parser.trackPosition) {
                                    parser.position++;
                                    if (c === "\n") {
                                        parser.line++;
                                        parser.column = 0;
                                    } else {
                                        parser.column++;
                                    }
                                }
                            }
                            parser.textNode += chunk.substring(starti, i - 1);
                        }
                        if (c === "<" && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
                            parser.state = S.OPEN_WAKA;
                            parser.startTagPosition = parser.position;
                        } else {
                            if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
                                strictFail(parser, "Text data outside of root node.");
                            }
                            if (c === "&") {
                                parser.state = S.TEXT_ENTITY;
                            } else {
                                parser.textNode += c;
                            }
                        }
                        continue;

                      case S.SCRIPT:
                        if (c === "<") {
                            parser.state = S.SCRIPT_ENDING;
                        } else {
                            parser.script += c;
                        }
                        continue;

                      case S.SCRIPT_ENDING:
                        if (c === "/") {
                            parser.state = S.CLOSE_TAG;
                        } else {
                            parser.script += "<" + c;
                            parser.state = S.SCRIPT;
                        }
                        continue;

                      case S.OPEN_WAKA:
                        if (c === "!") {
                            parser.state = S.SGML_DECL;
                            parser.sgmlDecl = "";
                        } else if (isWhitespace(c)) {} else if (isMatch(nameStart, c)) {
                            parser.state = S.OPEN_TAG;
                            parser.tagName = c;
                        } else if (c === "/") {
                            parser.state = S.CLOSE_TAG;
                            parser.tagName = "";
                        } else if (c === "?") {
                            parser.state = S.PROC_INST;
                            parser.procInstName = parser.procInstBody = "";
                        } else {
                            strictFail(parser, "Unencoded <");
                            if (parser.startTagPosition + 1 < parser.position) {
                                var pad = parser.position - parser.startTagPosition;
                                c = new Array(pad).join(" ") + c;
                            }
                            parser.textNode += "<" + c;
                            parser.state = S.TEXT;
                        }
                        continue;

                      case S.SGML_DECL:
                        if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
                            emitNode(parser, "onopencdata");
                            parser.state = S.CDATA;
                            parser.sgmlDecl = "";
                            parser.cdata = "";
                        } else if (parser.sgmlDecl + c === "--") {
                            parser.state = S.COMMENT;
                            parser.comment = "";
                            parser.sgmlDecl = "";
                        } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
                            parser.state = S.DOCTYPE;
                            if (parser.doctype || parser.sawRoot) {
                                strictFail(parser, "Inappropriately located doctype declaration");
                            }
                            parser.doctype = "";
                            parser.sgmlDecl = "";
                        } else if (c === ">") {
                            emitNode(parser, "onsgmldeclaration", parser.sgmlDecl);
                            parser.sgmlDecl = "";
                            parser.state = S.TEXT;
                        } else if (isQuote(c)) {
                            parser.state = S.SGML_DECL_QUOTED;
                            parser.sgmlDecl += c;
                        } else {
                            parser.sgmlDecl += c;
                        }
                        continue;

                      case S.SGML_DECL_QUOTED:
                        if (c === parser.q) {
                            parser.state = S.SGML_DECL;
                            parser.q = "";
                        }
                        parser.sgmlDecl += c;
                        continue;

                      case S.DOCTYPE:
                        if (c === ">") {
                            parser.state = S.TEXT;
                            emitNode(parser, "ondoctype", parser.doctype);
                            parser.doctype = true;
                        } else {
                            parser.doctype += c;
                            if (c === "[") {
                                parser.state = S.DOCTYPE_DTD;
                            } else if (isQuote(c)) {
                                parser.state = S.DOCTYPE_QUOTED;
                                parser.q = c;
                            }
                        }
                        continue;

                      case S.DOCTYPE_QUOTED:
                        parser.doctype += c;
                        if (c === parser.q) {
                            parser.q = "";
                            parser.state = S.DOCTYPE;
                        }
                        continue;

                      case S.DOCTYPE_DTD:
                        parser.doctype += c;
                        if (c === "]") {
                            parser.state = S.DOCTYPE;
                        } else if (isQuote(c)) {
                            parser.state = S.DOCTYPE_DTD_QUOTED;
                            parser.q = c;
                        }
                        continue;

                      case S.DOCTYPE_DTD_QUOTED:
                        parser.doctype += c;
                        if (c === parser.q) {
                            parser.state = S.DOCTYPE_DTD;
                            parser.q = "";
                        }
                        continue;

                      case S.COMMENT:
                        if (c === "-") {
                            parser.state = S.COMMENT_ENDING;
                        } else {
                            parser.comment += c;
                        }
                        continue;

                      case S.COMMENT_ENDING:
                        if (c === "-") {
                            parser.state = S.COMMENT_ENDED;
                            parser.comment = textopts(parser.opt, parser.comment);
                            if (parser.comment) {
                                emitNode(parser, "oncomment", parser.comment);
                            }
                            parser.comment = "";
                        } else {
                            parser.comment += "-" + c;
                            parser.state = S.COMMENT;
                        }
                        continue;

                      case S.COMMENT_ENDED:
                        if (c !== ">") {
                            strictFail(parser, "Malformed comment");
                            parser.comment += "--" + c;
                            parser.state = S.COMMENT;
                        } else {
                            parser.state = S.TEXT;
                        }
                        continue;

                      case S.CDATA:
                        if (c === "]") {
                            parser.state = S.CDATA_ENDING;
                        } else {
                            parser.cdata += c;
                        }
                        continue;

                      case S.CDATA_ENDING:
                        if (c === "]") {
                            parser.state = S.CDATA_ENDING_2;
                        } else {
                            parser.cdata += "]" + c;
                            parser.state = S.CDATA;
                        }
                        continue;

                      case S.CDATA_ENDING_2:
                        if (c === ">") {
                            if (parser.cdata) {
                                emitNode(parser, "oncdata", parser.cdata);
                            }
                            emitNode(parser, "onclosecdata");
                            parser.cdata = "";
                            parser.state = S.TEXT;
                        } else if (c === "]") {
                            parser.cdata += "]";
                        } else {
                            parser.cdata += "]]" + c;
                            parser.state = S.CDATA;
                        }
                        continue;

                      case S.PROC_INST:
                        if (c === "?") {
                            parser.state = S.PROC_INST_ENDING;
                        } else if (isWhitespace(c)) {
                            parser.state = S.PROC_INST_BODY;
                        } else {
                            parser.procInstName += c;
                        }
                        continue;

                      case S.PROC_INST_BODY:
                        if (!parser.procInstBody && isWhitespace(c)) {
                            continue;
                        } else if (c === "?") {
                            parser.state = S.PROC_INST_ENDING;
                        } else {
                            parser.procInstBody += c;
                        }
                        continue;

                      case S.PROC_INST_ENDING:
                        if (c === ">") {
                            emitNode(parser, "onprocessinginstruction", {
                                name: parser.procInstName,
                                body: parser.procInstBody
                            });
                            parser.procInstName = parser.procInstBody = "";
                            parser.state = S.TEXT;
                        } else {
                            parser.procInstBody += "?" + c;
                            parser.state = S.PROC_INST_BODY;
                        }
                        continue;

                      case S.OPEN_TAG:
                        if (isMatch(nameBody, c)) {
                            parser.tagName += c;
                        } else {
                            newTag(parser);
                            if (c === ">") {
                                openTag(parser);
                            } else if (c === "/") {
                                parser.state = S.OPEN_TAG_SLASH;
                            } else {
                                if (!isWhitespace(c)) {
                                    strictFail(parser, "Invalid character in tag name");
                                }
                                parser.state = S.ATTRIB;
                            }
                        }
                        continue;

                      case S.OPEN_TAG_SLASH:
                        if (c === ">") {
                            openTag(parser, true);
                            closeTag(parser);
                        } else {
                            strictFail(parser, "Forward-slash in opening tag not followed by >");
                            parser.state = S.ATTRIB;
                        }
                        continue;

                      case S.ATTRIB:
                        if (isWhitespace(c)) {
                            continue;
                        } else if (c === ">") {
                            openTag(parser);
                        } else if (c === "/") {
                            parser.state = S.OPEN_TAG_SLASH;
                        } else if (isMatch(nameStart, c)) {
                            parser.attribName = c;
                            parser.attribValue = "";
                            parser.state = S.ATTRIB_NAME;
                        } else {
                            strictFail(parser, "Invalid attribute name");
                        }
                        continue;

                      case S.ATTRIB_NAME:
                        if (c === "=") {
                            parser.state = S.ATTRIB_VALUE;
                        } else if (c === ">") {
                            strictFail(parser, "Attribute without value");
                            parser.attribValue = parser.attribName;
                            attrib(parser);
                            openTag(parser);
                        } else if (isWhitespace(c)) {
                            parser.state = S.ATTRIB_NAME_SAW_WHITE;
                        } else if (isMatch(nameBody, c)) {
                            parser.attribName += c;
                        } else {
                            strictFail(parser, "Invalid attribute name");
                        }
                        continue;

                      case S.ATTRIB_NAME_SAW_WHITE:
                        if (c === "=") {
                            parser.state = S.ATTRIB_VALUE;
                        } else if (isWhitespace(c)) {
                            continue;
                        } else {
                            strictFail(parser, "Attribute without value");
                            parser.tag.attributes[parser.attribName] = "";
                            parser.attribValue = "";
                            emitNode(parser, "onattribute", {
                                name: parser.attribName,
                                value: ""
                            });
                            parser.attribName = "";
                            if (c === ">") {
                                openTag(parser);
                            } else if (isMatch(nameStart, c)) {
                                parser.attribName = c;
                                parser.state = S.ATTRIB_NAME;
                            } else {
                                strictFail(parser, "Invalid attribute name");
                                parser.state = S.ATTRIB;
                            }
                        }
                        continue;

                      case S.ATTRIB_VALUE:
                        if (isWhitespace(c)) {
                            continue;
                        } else if (isQuote(c)) {
                            parser.q = c;
                            parser.state = S.ATTRIB_VALUE_QUOTED;
                        } else {
                            strictFail(parser, "Unquoted attribute value");
                            parser.state = S.ATTRIB_VALUE_UNQUOTED;
                            parser.attribValue = c;
                        }
                        continue;

                      case S.ATTRIB_VALUE_QUOTED:
                        if (c !== parser.q) {
                            if (c === "&") {
                                parser.state = S.ATTRIB_VALUE_ENTITY_Q;
                            } else {
                                parser.attribValue += c;
                            }
                            continue;
                        }
                        attrib(parser);
                        parser.q = "";
                        parser.state = S.ATTRIB_VALUE_CLOSED;
                        continue;

                      case S.ATTRIB_VALUE_CLOSED:
                        if (isWhitespace(c)) {
                            parser.state = S.ATTRIB;
                        } else if (c === ">") {
                            openTag(parser);
                        } else if (c === "/") {
                            parser.state = S.OPEN_TAG_SLASH;
                        } else if (isMatch(nameStart, c)) {
                            strictFail(parser, "No whitespace between attributes");
                            parser.attribName = c;
                            parser.attribValue = "";
                            parser.state = S.ATTRIB_NAME;
                        } else {
                            strictFail(parser, "Invalid attribute name");
                        }
                        continue;

                      case S.ATTRIB_VALUE_UNQUOTED:
                        if (!isAttribEnd(c)) {
                            if (c === "&") {
                                parser.state = S.ATTRIB_VALUE_ENTITY_U;
                            } else {
                                parser.attribValue += c;
                            }
                            continue;
                        }
                        attrib(parser);
                        if (c === ">") {
                            openTag(parser);
                        } else {
                            parser.state = S.ATTRIB;
                        }
                        continue;

                      case S.CLOSE_TAG:
                        if (!parser.tagName) {
                            if (isWhitespace(c)) {
                                continue;
                            } else if (notMatch(nameStart, c)) {
                                if (parser.script) {
                                    parser.script += "</" + c;
                                    parser.state = S.SCRIPT;
                                } else {
                                    strictFail(parser, "Invalid tagname in closing tag.");
                                }
                            } else {
                                parser.tagName = c;
                            }
                        } else if (c === ">") {
                            closeTag(parser);
                        } else if (isMatch(nameBody, c)) {
                            parser.tagName += c;
                        } else if (parser.script) {
                            parser.script += "</" + parser.tagName;
                            parser.tagName = "";
                            parser.state = S.SCRIPT;
                        } else {
                            if (!isWhitespace(c)) {
                                strictFail(parser, "Invalid tagname in closing tag");
                            }
                            parser.state = S.CLOSE_TAG_SAW_WHITE;
                        }
                        continue;

                      case S.CLOSE_TAG_SAW_WHITE:
                        if (isWhitespace(c)) {
                            continue;
                        }
                        if (c === ">") {
                            closeTag(parser);
                        } else {
                            strictFail(parser, "Invalid characters in closing tag");
                        }
                        continue;

                      case S.TEXT_ENTITY:
                      case S.ATTRIB_VALUE_ENTITY_Q:
                      case S.ATTRIB_VALUE_ENTITY_U:
                        var returnState;
                        var buffer;
                        switch (parser.state) {
                          case S.TEXT_ENTITY:
                            returnState = S.TEXT;
                            buffer = "textNode";
                            break;

                          case S.ATTRIB_VALUE_ENTITY_Q:
                            returnState = S.ATTRIB_VALUE_QUOTED;
                            buffer = "attribValue";
                            break;

                          case S.ATTRIB_VALUE_ENTITY_U:
                            returnState = S.ATTRIB_VALUE_UNQUOTED;
                            buffer = "attribValue";
                            break;
                        }
                        if (c === ";") {
                            parser[buffer] += parseEntity(parser);
                            parser.entity = "";
                            parser.state = returnState;
                        } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
                            parser.entity += c;
                        } else {
                            strictFail(parser, "Invalid character in entity name");
                            parser[buffer] += "&" + parser.entity + c;
                            parser.entity = "";
                            parser.state = returnState;
                        }
                        continue;

                      default:
                        throw new Error(parser, "Unknown state: " + parser.state);
                    }
                }
                if (parser.position >= parser.bufferCheckPosition) {
                    checkBufferLength(parser);
                }
                return parser;
            }
            if (!String.fromCodePoint) {
                (function() {
                    var stringFromCharCode = String.fromCharCode;
                    var floor = Math.floor;
                    var fromCodePoint = function() {
                        var MAX_SIZE = 16384;
                        var codeUnits = [];
                        var highSurrogate;
                        var lowSurrogate;
                        var index = -1;
                        var length = arguments.length;
                        if (!length) {
                            return "";
                        }
                        var result = "";
                        while (++index < length) {
                            var codePoint = Number(arguments[index]);
                            if (!isFinite(codePoint) || codePoint < 0 || codePoint > 1114111 || floor(codePoint) !== codePoint) {
                                throw RangeError("Invalid code point: " + codePoint);
                            }
                            if (codePoint <= 65535) {
                                codeUnits.push(codePoint);
                            } else {
                                codePoint -= 65536;
                                highSurrogate = (codePoint >> 10) + 55296;
                                lowSurrogate = codePoint % 1024 + 56320;
                                codeUnits.push(highSurrogate, lowSurrogate);
                            }
                            if (index + 1 === length || codeUnits.length > MAX_SIZE) {
                                result += stringFromCharCode.apply(null, codeUnits);
                                codeUnits.length = 0;
                            }
                        }
                        return result;
                    };
                    if (Object.defineProperty) {
                        Object.defineProperty(String, "fromCodePoint", {
                            value: fromCodePoint,
                            configurable: true,
                            writable: true
                        });
                    } else {
                        String.fromCodePoint = fromCodePoint;
                    }
                })();
            }
        })(false ? 0 : exports);
    }, module => {
        "use strict";
        module.exports = require("string_decoder");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Plist = __webpack_require__(126);
        var getType = __webpack_require__(131);
        const INDENT = "  ";
        const EOL = "\n";
        const BASE64_WIDTH = 48 * 2;
        const ENTITY_PATTERN = /<|>|"|'|&/g;
        const ENTITIES = {
            "<": "&lt;",
            ">": "&gt;",
            '"': "&quot;",
            "'": "&apos;",
            "&": "&amp;"
        };
        function encodeEntities(str) {
            return str ? str.replace(ENTITY_PATTERN, (char => ENTITIES[char])) : "";
        }
        function encodeData(value, depth) {
            var indent = INDENT.repeat(depth);
            var block = indent + "<data>" + EOL;
            var data = value.toString("base64");
            var offset = 0;
            while (offset < data.length) {
                block += indent + data.slice(offset, offset += BASE64_WIDTH) + EOL;
            }
            return block + indent + "</data>" + EOL;
        }
        function encodeString(value, depth) {
            return INDENT.repeat(depth) + `<string>${encodeEntities(value)}</string>` + EOL;
        }
        function encodeBoolean(value, depth) {
            return INDENT.repeat(depth) + (value ? `<true/>` : "<false/>") + EOL;
        }
        function encodeNumber(value, depth) {
            return INDENT.repeat(depth) + (Math.round(value) === value ? `<integer>${encodeEntities(value.toString())}</integer>` : `<real>${encodeEntities(value.toString())}</real>`) + EOL;
        }
        function encodeDate(value, depth) {
            return INDENT.repeat(depth) + `<date>${value.toJSON()}</date>` + EOL;
        }
        function encodeKey(value, depth) {
            return INDENT.repeat(depth) + `<key>${encodeEntities(value)}</key>` + EOL;
        }
        function encodeDict(value, depth) {
            var indent = INDENT.repeat(depth);
            var output = indent + "<dict>" + EOL;
            var keys = Object.keys(value);
            for (var i = 0; i < keys.length; i++) {
                output += encodeKey(keys[i], depth + 1);
                output += encodeObject(value[keys[i]], depth + 1);
            }
            return output + indent + "</dict>" + EOL;
        }
        function encodeMap(value, depth) {
            var indent = INDENT.repeat(depth);
            var output = indent + "<dict>" + EOL;
            value.forEach(((value, key) => {
                output += encodeKey(keys, depth + 1);
                output += encodeObject(value, depth + 1);
            }));
            return output + indent + "</dict>" + EOL;
        }
        function encodeSet(value, depth) {
            var indent = INDENT.repeat(depth);
            var output = indent + "<array>" + EOL;
            value.forEach((value => {
                output += encodeObject(value, depth + 1);
            }));
            return output + indent + "</array>" + EOL;
        }
        function encodeArray(value, depth) {
            var indent = INDENT.repeat(depth);
            var output = indent + "<array>" + EOL;
            for (var i = 0; i < value.length; i++) {
                output += encodeObject(value[i], depth + 1);
            }
            return output + indent + "</array>" + EOL;
        }
        function encodeObject(value, depth) {
            var type = getType(value);
            depth = depth || 0;
            switch (type) {
              case "arraybufferview":
                return encodeData(Buffer.from(value.buffer, value.byteOffset, value.byteLength), depth);

              case "arraybuffer":
                return encodeData(Buffer.from(value), depth);

              case "buffer":
                return encodeData(value, depth);

              case "array":
                return encodeArray(value, depth);

              case "set":
                return encodeSet(value, depth);

              case "object":
                return encodeDict(value, depth);

              case "map":
                return encodeMap(value, depth);

              case "number":
                return encodeNumber(value, depth);

              case "bigint":
                return encodeNumber(value, depth);

              case "string":
                return encodeString(value, depth);

              case "symbol":
                return encodeString(value.description, depth);

              case "boolean":
                return encodeBoolean(value, depth);

              case "date":
                return encodeDate(value, depth);
            }
            throw new Error(`Unknown data type "${type}"`);
        }
        function encode(data, buffer, offset) {
            return `<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n${encodeObject(data)}\n</plist>\n`;
        }
        module.exports = encode;
    }, module => {
        module.exports = function getTypeOf(value) {
            if (value === null) return "null";
            var type = typeof value;
            var isPrimitive = type == "undefined" || type == "number" || type == "bigint" || type == "string" || type == "boolean" || type == "symbol";
            if (isPrimitive) return type;
            if (Buffer.isBuffer(value)) return "buffer";
            if (Array.isArray(value)) return "array";
            if (ArrayBuffer.isView(value)) return "arraybufferview";
            if (value instanceof Number) return "number";
            if (value instanceof Boolean) return "boolean";
            if (value instanceof ArrayBuffer) return "arraybuffer";
            if (value instanceof Date) return "date";
            if (value instanceof Set) return "set";
            if (value instanceof Map) return "map";
            return type;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Plist = __webpack_require__(126);
        var {readBigInt64BE, readBigUInt64BE} = __webpack_require__(133);
        function readPrimitive(objInfo) {
            switch (objInfo) {
              case 0:
                return null;

              case 8:
                return false;

              case 9:
                return true;

              case 15:
                return undefined;
            }
        }
        function readInt(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = 1 << objInfo;
            switch (length) {
              case 1:
                return buffer.readUInt8(context.offset + offset + 1);

              case 2:
                return buffer.readUInt16BE(context.offset + offset + 1);

              case 4:
                return buffer.readUInt32BE(context.offset + offset + 1);

              case 8:
                return Number(readBigInt64BE(buffer, context.offset + offset + 1));

              case 16:
                return Number((readBigInt64BE(buffer, context.offset + offset + 1) << 64n) + readBigUInt64BE(buffer, context.offset + offset + 1 + 8));

              default:
                throw new Error(`${length} byte integers not supported`);
            }
        }
        function readReal(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = 1 << objInfo;
            switch (length) {
              case 4:
                return buffer.readFloatBE(context.offset + offset + 1);

              case 8:
                return buffer.readDoubleBE(context.offset + offset + 1);

              default:
                throw new Error(`${length} byte reals not supported`);
            }
        }
        function readDate(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            offset += 1;
            var seconds = buffer.readDoubleBE(context.offset + offset);
            return new Date(Plist.EPOCH + seconds * 1e3);
        }
        function readData(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = objInfo !== 15 ? objInfo : -1;
            offset += 1;
            if (length === -1) {
                length = readInt(context, buffer, offset);
                offset += 1 + (1 << (buffer[context.offset + offset] & 15));
            }
            var data = Buffer.alloc(length);
            var start = context.offset + offset;
            var end = start + length;
            buffer.copy(data, 0, start, end);
            return data;
        }
        function readAscii(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = objInfo !== 15 ? objInfo : -1;
            offset += 1;
            if (length === -1) {
                length = readInt(context, buffer, offset);
                offset += 1 + (1 << (buffer[context.offset + offset] & 15));
            }
            var start = context.offset + offset;
            var end = start + length;
            return buffer.toString("ascii", start, end);
        }
        function readUnicode(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = objInfo !== 15 ? objInfo : -1;
            offset += 1;
            if (length === -1) {
                length = readInt(context, buffer, offset);
                offset += 1 + (1 << (buffer[context.offset + offset] & 15));
            }
            var start = context.offset + offset;
            var end = start + length * 2;
            var chars = Buffer.alloc(length * 2);
            buffer.copy(chars, 0, start, end);
            return chars.swap16().toString("utf16le");
        }
        function readUID(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = objInfo + 1;
            offset += 1;
            var start = context.offset + offset;
            var end = start + length;
            return buffer.toString("hex", start, end);
        }
        function readArray(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = objInfo !== 15 ? objInfo : -1;
            offset += 1;
            if (length === -1) {
                length = readInt(context, buffer, offset);
                offset += 1 + (1 << (buffer[context.offset + offset] & 15));
            }
            var array = [];
            var objRef = null;
            for (var i = 0; i < length; i++) {
                objRef = buffer.readUIntBE(context.offset + offset + i * context.objectRefSize, context.objectRefSize);
                array.push(readObject(context, buffer, objRef));
            }
            return array;
        }
        function readSet(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = objInfo !== 15 ? objInfo : -1;
            offset += 1;
            if (length === -1) {
                length = readInt(context, buffer, offset);
                offset += 1 + (1 << (buffer[context.offset + offset] & 15));
            }
            var set = new Set;
            var objRef = null;
            for (var i = 0; i < length; i++) {
                objRef = buffer.readUIntBE(offset + i * context.objectRefSize, context.objectRefSize);
                set.add(readObject(context, buffer, objRef));
            }
            return set;
        }
        function readDict(context, buffer, offset) {
            var objInfo = buffer[context.offset + offset] & 15;
            var length = objInfo !== 15 ? objInfo : -1;
            offset += 1;
            if (length === -1) {
                length = readInt(context, buffer, offset);
                offset += 1 + (1 << (buffer[context.offset + offset] & 15));
            }
            var dict = {};
            var keys = [];
            var objRef = null;
            for (var i = 0; i < length; i++) {
                objRef = buffer.readUIntBE(context.offset + offset + i * context.objectRefSize, context.objectRefSize);
                keys.push(readObject(context, buffer, objRef));
            }
            var values = [];
            for (var i = 0; i < length; i++) {
                objRef = buffer.readUIntBE(context.offset + offset + (i + length) * context.objectRefSize, context.objectRefSize);
                values.push(readObject(context, buffer, objRef));
            }
            for (var i = 0; i < length; i++) {
                dict[keys[i]] = values[i];
            }
            return dict;
        }
        function readObject(context, buffer, objRef) {
            var offset = context.offsetTable.readUIntBE(objRef * context.offsetIntSize, context.offsetIntSize);
            var marker = buffer[context.offset + offset];
            var objType = (marker & 240) >>> 4;
            var objInfo = marker & 15;
            switch (objType) {
              case 0:
                return readPrimitive(objInfo);

              case 1:
                return readInt(context, buffer, offset);

              case 2:
                return readReal(context, buffer, offset);

              case 3:
                return readDate(context, buffer, offset);

              case 4:
                return readData(context, buffer, offset);

              case 5:
                return readAscii(context, buffer, offset);

              case 6:
                return readUnicode(context, buffer, offset);

              case 8:
                return readUID(context, buffer, offset);

              case 10:
                return readArray(context, buffer, offset);

              case 12:
                return readSet(context, buffer, offset);

              case 13:
                return readDict(context, buffer, offset);
            }
            throw new Error(`Unknown type marker 0b${marker.toString(2)}`);
        }
        function decode(buffer, offset, length) {
            offset = offset || 0;
            length = length || buffer.length - offset;
            if (buffer.indexOf(Plist.SIGNATURE_BINARY, offset) !== offset) {
                throw new Error(`Invalid property list signature at offset 0x${offset.toString(16)}`);
            }
            var trailerOffset = offset + length - 32;
            var context = {
                offset,
                length,
                trailerOffset,
                sortVersion: buffer[trailerOffset + 5],
                offsetIntSize: buffer[trailerOffset + 6],
                objectRefSize: buffer[trailerOffset + 7],
                objectCount: Number(readBigUInt64BE(buffer, trailerOffset + 8)),
                rootObject: Number(readBigUInt64BE(buffer, trailerOffset + 16)),
                offsetTableOffset: Number(readBigUInt64BE(buffer, trailerOffset + 24)),
                offsetTable: null
            };
            context.offsetTable = buffer.slice(offset + context.offsetTableOffset, offset + context.offsetTableOffset + context.objectCount * context.offsetIntSize);
            return readObject(context, buffer, context.rootObject);
        }
        module.exports = decode;
    }, module => {
        var buffer = module.exports;
        var hasBigIntMethods = typeof Buffer.prototype.readBigUInt64BE == "function";
        if (hasBigIntMethods) {
            buffer.readBigUInt64BE = function(buffer, offset) {
                return buffer.readBigUInt64BE(offset);
            };
            buffer.writeBigUInt64BE = function(buffer, value, offset) {
                return buffer.writeBigUInt64BE(value, offset);
            };
            buffer.readBigUInt64LE = function(buffer, offset) {
                return buffer.readBigUInt64LE(offset);
            };
            buffer.writeBigUInt64LE = function(buffer, value, offset) {
                return buffer.writeBigUInt64LE(value, offset);
            };
            buffer.readBigInt64BE = function(buffer, offset) {
                return buffer.readBigInt64BE(offset);
            };
            buffer.writeBigInt64BE = function(buffer, value, offset) {
                return buffer.writeBigInt64BE(value, offset);
            };
            buffer.readBigInt64LE = function(buffer, offset) {
                return buffer.readBigInt64LE(offset);
            };
            buffer.writeBigInt64LE = function(buffer, value, offset) {
                return buffer.writeBigInt64LE(value, offset);
            };
        } else {
            buffer.readBigUInt64BE = function(buffer, offset) {
                offset = offset || 0;
                var hi = buffer.readUInt32BE(offset);
                var lo = buffer.readUInt32BE(offset + 4);
                return (BigInt(hi) << BigInt(32)) + BigInt(lo);
            };
            buffer.writeBigUInt64BE = function(buffer, value, offset) {
                offset = offset || 0;
                var hi = BigInt(value) >> BigInt(32);
                var lo = BigInt(value) - (hi << BigInt(32));
                buffer.writeUInt32BE(Number(hi), offset);
                buffer.writeUInt32BE(Number(lo), offset + 4);
                return offset + 8;
            };
            buffer.readBigUInt64LE = function(buffer, offset) {
                offset = offset || 0;
                var hi = buffer.readUInt32LE(offset + 4);
                var lo = buffer.readUInt32LE(offset);
                return (BigInt(hi) << BigInt(32)) + BigInt(lo);
            };
            buffer.writeBigUInt64LE = function(buffer, value, offset) {
                offset = offset || 0;
                var hi = BigInt(value) >> BigInt(32);
                var lo = BigInt(value) - (hi << BigInt(32));
                buffer.writeUInt32LE(Number(hi), offset + 4);
                buffer.writeUInt32LE(Number(lo), offset);
                return offset + 8;
            };
            buffer.readBigInt64BE = function(buffer, offset) {
                offset = offset || 0;
                var hi = buffer.readInt32BE(offset);
                var lo = buffer.readUInt32BE(offset + 4);
                return (BigInt(hi) << BigInt(32)) + BigInt(lo);
            };
            buffer.writeBigInt64BE = function(buffer, value, offset) {
                offset = offset || 0;
                var hi = BigInt(value) >> BigInt(32);
                var lo = BigInt(value) - (hi << BigInt(32));
                buffer.writeInt32BE(Number(hi), offset);
                buffer.writeUInt32BE(Number(lo), offset + 4);
                return offset + 8;
            };
            buffer.readBigInt64LE = function(buffer, offset) {
                offset = offset || 0;
                var hi = buffer.readInt32LE(offset + 4);
                var lo = buffer.readUInt32LE(offset);
                return (BigInt(hi) << BigInt(32)) + BigInt(lo);
            };
            buffer.writeBigInt64LE = function(buffer, value, offset) {
                offset = offset || 0;
                var hi = BigInt(value) >> BigInt(32);
                var lo = BigInt(value) - (hi << BigInt(32));
                buffer.writeUInt32LE(Number(hi), offset + 4);
                buffer.writeInt32LE(Number(lo), offset);
                return offset + 8;
            };
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Plist = __webpack_require__(126);
        var {writeBigInt64BE, writeBigUInt64BE} = __webpack_require__(133);
        const PRIMITIVE = 0;
        const INT = 1;
        const REAL = 2;
        const DATE = 3;
        const DATA = 4;
        const ASCII = 5;
        const UNICODE = 6;
        const UUID = 8;
        const ARRAY = 10;
        const SET = 12;
        const DICT = 13;
        function bits(value, clamp = 0) {
            var bits = Math.ceil(Math.log2(Math.abs(value) + 1));
            return Math.max(clamp, 1 << Math.ceil(Math.log2(bits)));
        }
        function signedBits(value, clamp = 0) {
            var bits = Math.ceil(Math.log2(Math.abs(value)));
            return Math.max(clamp, 1 << Math.ceil(Math.log2(bits))) * 2;
        }
        function getTypeof(value) {
            if (value === null) return "null";
            if (Buffer.isBuffer(value)) return "buffer";
            if (Array.isArray(value)) return "array";
            if (ArrayBuffer.isView(value)) return "arraybufferview";
            if (value instanceof Number) return "number";
            if (value instanceof String) return "string";
            if (value instanceof Boolean) return "boolean";
            if (value instanceof Map) return "map";
            if (value instanceof Set) return "set";
            if (value instanceof ArrayBuffer) return "arraybuffer";
            return typeof value;
        }
        function isPrimitiveType(type) {
            return type == "null" || type == "undefined" || type == "boolean" || type == "number" || type == "bigint" || type == "string" || type == "date";
        }
        function getValueSet(value) {
            var values = new Set;
            var objects = new Set;
            var queue = [ value ];
            while (queue.length) {
                let value = queue.shift();
                let type = getTypeof(value);
                if (isPrimitiveType(type)) {
                    values.add(value);
                } else if (type == "object") {
                    objects.add(value);
                    Object.keys(value).forEach((key => {
                        values.add(key);
                        queue.push(value[key]);
                    }));
                } else if (type == "array" || type == "arraybufferview") {
                    objects.add(value);
                    value.forEach((item => {
                        queue.push(item);
                    }));
                } else if (type == "map") {
                    objects.add(value);
                    for (let [key, item] of value) {
                        queue.push(key);
                        queue.push(item);
                    }
                } else if (type == "set") {
                    objects.add(value);
                    for (let item of value) {
                        queue.push(item);
                    }
                } else if (type == "buffer" || type == "arraybuffer") {
                    values.add(value);
                } else {
                    throw new Error(`Unsupported value type "${type}"`);
                }
            }
            return [ ...values ].concat([ ...objects ].reverse());
        }
        function encode(value, buffer, offset) {
            offset = offset || 0;
            var values = getValueSet(value);
            var objectCount = values.length;
            var refSize = bits(objectCount, 8) / 8;
            var offsets = new Array(objectCount);
            var state = {
                offsets,
                objectCount,
                refSize
            };
            offset += buffer.write("bplist00", offset, "bplist00".length, "ascii");
            for (let i = 0; i < objectCount; i++) {
                offsets[i] = offset;
                offset = encodeValue(values, i, state, buffer, offset);
            }
            var tableOffset = offset;
            var offsetSize = bits(tableOffset, 8) / 8;
            var offsetTable = Buffer.alloc(objectCount * offsetSize);
            for (let i = 0; i < objectCount; i++) {
                let dataOffset = offsets[i];
                offset = buffer.writeUIntBE(dataOffset, offset, offsetSize);
            }
            offset = buffer.writeUIntBE(0, offset, 6);
            offset = buffer.writeUInt8(offsetSize, offset);
            offset = buffer.writeUInt8(refSize, offset);
            offset = writeBigUInt64BE(buffer, BigInt(objectCount), offset);
            offset = writeBigUInt64BE(buffer, BigInt(objectCount - 1), offset);
            offset = writeBigUInt64BE(buffer, BigInt(tableOffset), offset);
            return offset;
        }
        function encodeArray(values, index, state, buffer, offset) {
            var list = values[index];
            var length = list.length;
            var objInfo = length > 14 ? 15 : length;
            offset = buffer.writeUInt8(ARRAY << 4 | objInfo, offset);
            offset = objInfo == 15 ? encodeInt(length, buffer, offset) : offset;
            for (var i = 0; i < list.length; i++) {
                let objRef = values.indexOf(list[i]);
                if (objRef == -1) throw new Error(`Attempt to encode unknown object`);
                offset = buffer.writeUIntBE(objRef, offset, state.refSize);
            }
            return offset;
        }
        function encodeSet(values, index, state, buffer, offset) {
            var list = [ ...values[index] ];
            var length = list.length;
            var objInfo = length > 14 ? 15 : length;
            offset = buffer.writeUInt8(SET << 4 | objInfo, offset);
            offset = objInfo == 15 ? encodeInt(length, buffer, offset) : offset;
            for (var i = 0; i < list.length; i++) {
                let objRef = values.indexOf(list[i]);
                if (objRef == -1) throw new Error(`Attempt to encode unknown object`);
                offset = buffer.writeUIntBE(objRef, offset, state.refSize);
            }
            return offset;
        }
        function encodeMap(values, index, state, buffer, offset) {
            var map = values[index];
            var length = map.size;
            var objInfo = length > 14 ? 15 : length;
            offset = buffer.writeUInt8(DICT << 4 | objInfo, offset);
            offset = objInfo == 15 ? encodeInt(length, buffer, offset) : offset;
            for (let [key, value] of map) {
                let keyRef = values.indexOf(key);
                if (keyRef == -1) throw new Error(`Attempt to encode object with unknown key`);
                offset = buffer.writeUIntBE(keyRef, offset, state.refSize);
            }
            for (let [key, value] of map) {
                let objRef = values.indexOf(value);
                if (objRef == -1) throw new Error(`Attempt to encode unknown object`);
                offset = buffer.writeUIntBE(objRef, offset, state.refSize);
            }
            return offset;
        }
        function encodeDict(values, index, state, buffer, offset) {
            var dict = values[index];
            var keys = Object.keys(dict);
            var length = keys.length;
            var objInfo = length > 14 ? 15 : length;
            offset = buffer.writeUInt8(DICT << 4 | objInfo, offset);
            offset = objInfo == 15 ? encodeInt(length, buffer, offset) : offset;
            for (let i = 0; i < length; i++) {
                let keyRef = values.indexOf(keys[i]);
                if (keyRef == -1) throw new Error(`Attempt to encode object with unknown key`);
                offset = buffer.writeUIntBE(keyRef, offset, state.refSize);
            }
            for (let i = 0; i < length; i++) {
                let objRef = values.indexOf(dict[keys[i]]);
                if (objRef == -1) throw new Error(`Attempt to encode unknown object`);
                offset = buffer.writeUIntBE(objRef, offset, state.refSize);
            }
            return offset;
        }
        function encodeValue(values, index, state, buffer, offset) {
            var type = getTypeof(values[index]);
            switch (type) {
              case "null":
              case "undefined":
              case "boolean":
                return encodeBoolean(values[index], buffer, offset);

              case "number":
              case "bigint":
                return encodeNumber(values[index], buffer, offset);

              case "date":
                return encodeDate(values[index], buffer, offset);

              case "string":
                return encodeString(values[index], buffer, offset);

              case "buffer":
                return encodeBlob(values[index], buffer, offset);

              case "arraybuffer":
                return encodeBlob(Buffer.from(values[index]), buffer, offset);

              case "array":
              case "arraybufferview":
                return encodeArray(values, index, state, buffer, offset);

              case "set":
                return encodeSet(values, index, state, buffer, offset);

              case "map":
                return encodeMap(values, index, state, buffer, offset);

              case "object":
                return encodeDict(values, index, state, buffer, offset);

              default:
                throw new Error(`Invalid value type "${type}"`);
            }
        }
        function encodeBoolean(value, buffer, offset) {
            switch (value) {
              case undefined:
              case null:
                return buffer.writeUInt8(PRIMITIVE << 4 | 0, offset);

              case false:
                return buffer.writeUInt8(PRIMITIVE << 4 | 8, offset);

              case true:
                return buffer.writeUInt8(PRIMITIVE << 4 | 9, offset);

              default:
                throw new Error(`Invalid primitive value "${value}"`);
            }
        }
        function encodeNumber(value, buffer, offset) {
            var shouldFloat = Math.abs(Number(value)) > Number.MAX_SAFE_INTEGER || !Number.isFinite(value) || Math.round(value) != value;
            return shouldFloat ? encodeReal(value, buffer, offset) : encodeInt(value, buffer, offset);
        }
        function encodeInt(value, buffer, offset) {
            var size = Math.abs(Number(value)) <= Number.MAX_SAFE_INTEGER ? signedBits(Number(value), 8) : 128;
            offset = buffer.writeUInt8(INT << 4 | Math.log2(size / 8), offset);
            switch (size) {
              case 8:
                offset = buffer.writeInt8(Number(value), offset);
                break;

              case 16:
                offset = buffer.writeInt16BE(Number(value), offset);
                break;

              case 32:
                offset = buffer.writeInt32BE(Number(value), offset);
                break;

              case 64:
                offset = writeBigInt64BE(buffer, BigInt(value), offset);
                break;

              case 128:
                offset = writeBigInt64BE(buffer, BigInt(value) >> 64n, offset);
                offset = writeBigUInt64BE(buffer, BigInt(value) & 0xFFFFFFFFFFFFFFFFn, offset);
                break;

              default:
                throw new Error(`${size} bit integers not supported`);
            }
            return offset;
        }
        function encodeReal(value, buffer, offset) {
            var size = Math.abs(Number(value)) <= Number.MAX_SAFE_INTEGER ? bits(Number(value), 32) : 64;
            if (size > 64) {
                throw new Error(`${size} bit reals not supported`);
            }
            offset = buffer.writeUInt8(REAL << 4 | Math.log2(size / 8), offset);
            switch (size) {
              case 32:
                offset = buffer.writeFloatBE(Number(value), offset);
                break;

              case 64:
                offset = buffer.writeDoubleBE(Number(value), offset);
                break;
            }
            return offset;
        }
        function encodeDate(value, buffer, offset) {
            var time = value.getTime() / 1e3 - Plist.EPOCH;
            offset = buffer.writeUInt8(DATE << 4 | DATE, offset);
            offset = buffer.writeDoubleBE(time, offset);
            return offset;
        }
        function encodeString(value, buffer, offset) {
            var isUUID = /^[A-F0-9]{8}(-[A-F0-9]{4}){3}-[A-F0-9]{12}$/i.test(value);
            if (isUUID) return encodeUID(value, buffer, offset);
            var length = Buffer.byteLength(value);
            var isUnicode = length != value.length || !/^[\x00-\x7F]+$/.test(value);
            var marker = isUnicode ? UNICODE : ASCII;
            var objInfo = length > 14 ? 15 : length;
            offset = buffer.writeUInt8(marker << 4 | objInfo, offset);
            offset = objInfo == 15 ? encodeInt(length, buffer, offset) : offset;
            offset += buffer.write(value, offset, length, isUnicode ? "utf16le" : "ascii");
            return offset;
        }
        function encodeUID(value, buffer, offset) {
            var length = 15;
            offset = buffer.writeUInt8(UUID << 4 | length, offset);
            offset += buffer.write(value.slice(0, 8), offset, 8, "hex");
            offset += buffer.write(value.slice(9, 13), offset, 4, "hex");
            offset += buffer.write(value.slice(14, 18), offset, 4, "hex");
            offset += buffer.write(value.slice(19, 23), offset, 4, "hex");
            offset += buffer.write(value.slice(24, 36), offset, 12, "hex");
            return offset;
        }
        function encodeBlob(value, buffer, offset) {
            var length = value.length || Buffer.byteLength(value);
            var objInfo = length > 14 ? 15 : length;
            offset = buffer.writeUInt8(DATA << 4 | objInfo, offset);
            offset = objInfo == 15 ? encodeInt(length, buffer, offset) : offset;
            offset += value.copy(buffer, offset, 0, length);
            return offset;
        }
        module.exports = encode;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.readStream = void 0;
        const constants_1 = __webpack_require__(120);
        const utils_1 = __webpack_require__(136);
        const EXCLUDE = [ constants_1.BLOCK.COMMENT, constants_1.BLOCK.TERMINATOR ];
        async function* readStream(image, end) {
            let remaining = end + 1;
            for (const {block} of utils_1.blockGenerator(image, EXCLUDE)) {
                if (remaining <= 0) {
                    return;
                }
                if (block.type === constants_1.BLOCK.ZEROFILL || block.type === constants_1.BLOCK.FREE) {
                    const size = Math.min(block.sectorCount * constants_1.SECTOR_SIZE, remaining);
                    yield* new utils_1.ZeroStream(size);
                    remaining -= size;
                } else {
                    const offset = image.footer.dataForkOffset + block.compressedOffset;
                    const length = block.compressedLength;
                    const inputStream = await image.fs.createReadStream(offset, offset + length - 1);
                    for await (let chunk of utils_1.blockDecompressor(block.type, inputStream)) {
                        if (chunk.length > remaining) {
                            chunk = chunk.slice(0, remaining);
                        }
                        yield chunk;
                        remaining -= chunk.length;
                    }
                }
            }
        }
        exports.readStream = readStream;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.streamToBuffer = exports.ZeroStream = exports.blockDecompressor = exports.blockGenerator = exports.withOpenImage = void 0;
        const adc = __webpack_require__(137);
        const fs_1 = __webpack_require__(5);
        const stream_1 = __webpack_require__(17);
        const bz2 = __webpack_require__(84);
        const zlib = __webpack_require__(89);
        const constants_1 = __webpack_require__(120);
        const image_1 = __webpack_require__(125);
        async function withOpenImage(filePath, fn) {
            const handle = await fs_1.promises.open(filePath, "r");
            try {
                const image = new image_1.Image({
                    size: (await handle.stat()).size,
                    createReadStream: async (start = 0, end = Infinity) => fs_1.createReadStream("", {
                        fd: handle.fd,
                        autoClose: false,
                        start,
                        end
                    })
                });
                await image.ready;
                return await fn(image);
            } finally {
                await handle.close();
            }
        }
        exports.withOpenImage = withOpenImage;
        function* blockGenerator(image, exclude = []) {
            for (const entry of image.resourceFork.blkx) {
                for (const block of entry.map.blocks) {
                    if (!exclude.includes(block.type)) {
                        yield {
                            entry,
                            block
                        };
                    }
                }
            }
        }
        exports.blockGenerator = blockGenerator;
        function blockDecompressor(type, inputStream) {
            if (type === constants_1.BLOCK.RAW) {
                return inputStream;
            } else if (type === constants_1.BLOCK.UDZO) {
                return inputStream.pipe(zlib.createInflate());
            } else if (type === constants_1.BLOCK.UDBZ) {
                return inputStream.pipe(bz2());
            } else if (type === constants_1.BLOCK.UDCO) {
                return inputStream.pipe(new adc.Decompressor);
            } else if (type === constants_1.BLOCK.LZFSE) {
                throw new Error("Unsupported compression method: LZFSE");
            }
            throw new Error(`Unknown compression method for type "0x${type.toString(16)}"`);
        }
        exports.blockDecompressor = blockDecompressor;
        class ZeroStream extends stream_1.Readable {
            constructor(length = Infinity, blank) {
                super();
                this.length = length;
                this.blank = blank !== null && blank !== void 0 ? blank : Buffer.alloc(64 * 1024);
            }
            _read() {
                if (this.length >= this.blank.length) {
                    this.push(this.blank);
                    this.length -= this.blank.length;
                } else if (this.length > 0) {
                    this.push(this.blank.slice(0, this.length));
                    this.length = 0;
                } else {
                    this.push(null);
                }
            }
        }
        exports.ZeroStream = ZeroStream;
        function streamToBuffer(stream) {
            const chunks = [];
            return new Promise(((resolve, reject) => {
                stream.on("data", (buf => {
                    chunks.push(buf);
                }));
                stream.on("end", (() => {
                    resolve(Buffer.concat(chunks));
                }));
                stream.on("error", reject);
            }));
        }
        exports.streamToBuffer = streamToBuffer;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var ADC = module.exports;
        ADC.CHUNK_DATA = 128;
        ADC.CHUNK_THREE = 64;
        ADC.CHUNK_TWO = 63;
        ADC.getChunkType = function(byte) {
            if ((byte & 128) === 128) return ADC.CHUNK_DATA;
            if ((byte & 64) === 64) return ADC.CHUNK_THREE;
            return ADC.CHUNK_TWO;
        };
        ADC.getChunkLength = function(byte) {
            var chunkType = ADC.getChunkType(byte);
            switch (chunkType) {
              case ADC.CHUNK_DATA:
                return (byte & 127) + 1;

              case ADC.CHUNK_THREE:
                return (byte & 63) + 4;

              case ADC.CHUNK_TWO:
                return ((byte & 60) >> 2) + 3;

              default:
                return -1;
            }
        };
        ADC.getSequenceLength = function(byte) {
            var chunkType = ADC.getChunkType(byte);
            switch (chunkType) {
              case ADC.CHUNK_DATA:
                return (byte & 127) + 2;

              case ADC.CHUNK_THREE:
                return 3;

              case ADC.CHUNK_TWO:
                return 2;

              default:
                return 0;
            }
        };
        ADC.getOffset = function(buffer, position) {
            var chunkType = ADC.getChunkType(buffer[position]);
            switch (chunkType) {
              case ADC.CHUNK_DATA:
                return 0;

              case ADC.CHUNK_THREE:
                return (buffer[position + 1] << 8) + buffer[position + 2];

              case ADC.CHUNK_TWO:
                return ((buffer[position] & 3) << 8) + buffer[position + 1];

              default:
                return -1;
            }
        };
        ADC.decompress = __webpack_require__(138);
        ADC.Decompressor = __webpack_require__(139);
        ADC.createDecompress = function(options) {
            return new ADC.Decompressor(options);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        const ADC = __webpack_require__(137);
        var windowOffset = 0;
        var windowSize = 65535 + 67;
        const window = new Uint8Array(windowSize);
        function getWindow(position) {
            return window[(position + windowOffset) % windowSize];
        }
        function setWindow(position, value) {
            windowOffset = windowOffset % windowSize === 0 ? 0 : windowOffset;
            return window[(position + windowOffset) % windowSize] = value;
        }
        function decodeData(window, buffer, position) {
            var length = ADC.getChunkLength(buffer[position]);
            var data = Buffer.allocUnsafe(length);
            var offset = windowSize - data.length;
            position += 1;
            windowOffset += length;
            buffer.copy(data, 0, position);
            for (var i = 0; i < length; i++) {
                setWindow(offset + i, buffer[position++]);
            }
            return data;
        }
        function decodeRunlength(window, buffer, position) {
            var length = ADC.getChunkLength(buffer[position]);
            var offset = ADC.getOffset(buffer, position);
            var data = Buffer.allocUnsafe(length);
            var slidePosition = windowSize - data.length;
            windowOffset += length;
            for (var i = 0; i < length; i++) {
                data[i] = setWindow(slidePosition, getWindow(slidePosition - offset - 1));
                slidePosition++;
            }
            return data;
        }
        function decompress(buffer) {
            var chunks = [];
            var chunkType = ADC.CHUNK_UNKNOWN;
            var position = 0;
            var length = 0;
            windowOffset = 0;
            while (position < buffer.length) {
                chunkType = ADC.getChunkType(buffer[position]);
                length = ADC.getSequenceLength(buffer[position]);
                switch (chunkType) {
                  case ADC.CHUNK_DATA:
                    chunks.push(decodeData(window, buffer, position));
                    break;

                  case ADC.CHUNK_THREE:
                    chunks.push(decodeRunlength(window, buffer, position));
                    break;

                  case ADC.CHUNK_TWO:
                    chunks.push(decodeRunlength(window, buffer, position));
                    break;

                  default:
                    throw new Error("Unknown chunk type 0x" + buffer[position].toString(16) + " at " + position);
                }
                position += length;
            }
            return Buffer.concat(chunks);
        }
        decompress.decode = decodeData;
        decompress.runLength = decodeRunlength;
        module.exports = decompress;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var ADC = __webpack_require__(137);
        var Stream = __webpack_require__(17);
        var inherit = __webpack_require__(70);
        function Decompressor(options) {
            if (!(this instanceof Decompressor)) {
                return new Decompressor(options);
            }
            Stream.Transform.call(this, options);
            this._window = new Uint8Array(65535 + 67);
            this._chunks = [];
            this._bytes = 0;
        }
        Decompressor.prototype = {
            constructor: Decompressor,
            _decode(chunk, next) {
                if (this._bytes > 0) {
                    this._chunks.push(chunk);
                    chunk = Buffer.concat(this._chunks);
                    this._chunks.length = 0;
                    this._bytes = 0;
                }
                var chunks = [];
                var chunkType = ADC.CHUNK_UNKNOWN;
                var position = 0;
                var length = 0;
                while (position < chunk.length) {
                    chunkType = ADC.getChunkType(chunk[position]);
                    length = ADC.getSequenceLength(chunk[position]);
                    if (position + length > chunk.length) {
                        break;
                    }
                    switch (chunkType) {
                      case ADC.CHUNK_DATA:
                        chunks.push(ADC.decompress.decode(this._window, chunk, position));
                        break;

                      case ADC.CHUNK_THREE:
                        chunks.push(ADC.decompress.runLength(this._window, chunk, position));
                        break;

                      case ADC.CHUNK_TWO:
                        chunks.push(ADC.decompress.runLength(this._window, chunk, position));
                        break;

                      default:
                        return next(new Error("Unknown chunk type 0x" + chunk[position].toString(16) + " at " + position));
                    }
                    position += length;
                }
                if (chunk.length - position) {
                    chunk = chunk.slice(position);
                    this._chunks.push(chunk);
                    this._bytes += chunk.length;
                }
                next(null, Buffer.concat(chunks));
            },
            _transform(chunk, encoding, next) {
                this._decode(chunk, next);
            },
            _flush(done) {
                this._decode(Buffer.allocUnsafe(0), done);
            }
        };
        inherit(Decompressor, Stream.Transform);
        module.exports = Decompressor;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.sparseReadStream = void 0;
        const constants_1 = __webpack_require__(120);
        const utils_1 = __webpack_require__(136);
        const EXCLUDE = [ constants_1.BLOCK.COMMENT, constants_1.BLOCK.TERMINATOR, constants_1.BLOCK.FREE ];
        async function* sparseReadStream(image) {
            for (const {entry, block} of utils_1.blockGenerator(image, EXCLUDE)) {
                let position = entry.map.sectorNumber * constants_1.SECTOR_SIZE + block.sectorNumber * constants_1.SECTOR_SIZE;
                if (block.type === constants_1.BLOCK.ZEROFILL) {
                    const size = block.sectorCount * constants_1.SECTOR_SIZE;
                    for await (const buffer of new utils_1.ZeroStream(size)) {
                        yield {
                            buffer,
                            position
                        };
                        position += buffer.length;
                    }
                } else {
                    const offset = image.footer.dataForkOffset + block.compressedOffset;
                    const length = block.compressedLength;
                    const inputStream = await image.fs.createReadStream(offset, offset + length - 1);
                    const stream = utils_1.blockDecompressor(block.type, inputStream);
                    for await (const buffer of stream) {
                        yield {
                            buffer,
                            position
                        };
                        position += buffer.length;
                    }
                }
            }
        }
        exports.sparseReadStream = sparseReadStream;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BlockTransformStream = void 0;
        const stream_1 = __webpack_require__(17);
        const aligned_lockable_buffer_1 = __webpack_require__(22);
        const constants_1 = __webpack_require__(18);
        const utils_1 = __webpack_require__(21);
        class BlockTransformStream extends stream_1.Transform {
            constructor({chunkSize, alignment, numBuffers = 2}) {
                super({
                    objectMode: true,
                    highWaterMark: numBuffers - 1
                });
                this.bytesRead = 0;
                this.bytesWritten = 0;
                this.currentBufferPosition = 0;
                this.alignedReadableState = new aligned_lockable_buffer_1.AlignedReadableState(chunkSize, alignment, numBuffers);
            }
            __flush() {
                this.unlockCurrentBuffer();
                if (this.currentBufferPosition !== this.currentBuffer.length) {
                    this.push(this.currentBuffer.slice(0, this.currentBufferPosition));
                } else {
                    this.push(this.currentBuffer);
                }
                this.bytesWritten += this.currentBufferPosition;
                this.currentBufferPosition = 0;
            }
            async pushChunk(chunk) {
                if (chunk.length === 0) {
                    return;
                }
                if (this.currentBufferPosition === 0) {
                    this.currentBuffer = this.alignedReadableState.getCurrentBuffer();
                    this.unlockCurrentBuffer = await this.currentBuffer.lock();
                }
                const lengthToCopy = Math.min(chunk.length, this.currentBuffer.length - this.currentBufferPosition);
                chunk.copy(this.currentBuffer, this.currentBufferPosition, 0, lengthToCopy);
                this.currentBufferPosition += lengthToCopy;
                this.bytesRead += lengthToCopy;
                if (this.currentBufferPosition === this.currentBuffer.length) {
                    this.__flush();
                }
                if (lengthToCopy < chunk.length) {
                    await this.pushChunk(chunk.slice(lengthToCopy));
                }
            }
            _transform(chunk, _encoding, callback) {
                (0, utils_1.asCallback)(this.pushChunk(chunk), callback);
            }
            _flush(callback) {
                try {
                    this.__flush();
                    callback();
                } catch (error) {
                    callback(error);
                }
            }
            static alignIfNeeded(stream, alignment, numBuffers) {
                if (alignment === undefined) {
                    return stream;
                }
                const transform = new BlockTransformStream({
                    chunkSize: constants_1.CHUNK_SIZE,
                    alignment,
                    numBuffers
                });
                stream.on("error", transform.emit.bind(transform, "error"));
                stream.pipe(transform);
                return transform;
            }
        }
        exports.BlockTransformStream = BlockTransformStream;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ProgressSparseTransformStream = exports.SparseTransformStream = void 0;
        const stream_1 = __webpack_require__(17);
        const aligned_lockable_buffer_1 = __webpack_require__(22);
        const progress_1 = __webpack_require__(28);
        const utils_1 = __webpack_require__(21);
        class SparseTransformStream extends stream_1.Transform {
            constructor({blocks, chunkSize, alignment, numBuffers = 2}) {
                super({
                    objectMode: true,
                    highWaterMark: numBuffers - 1
                });
                this.position = 0;
                this.bytesWritten = 0;
                this.blocks = blocks;
                this.alignedReadableState = new aligned_lockable_buffer_1.AlignedReadableState(chunkSize, alignment, numBuffers);
            }
            async __transform(chunk) {
                this.position = chunk.position;
                let buffer = this.alignedReadableState.getCurrentBuffer();
                const unlock = await buffer.lock();
                try {
                    if (chunk.buffer.length < buffer.length) {
                        buffer = buffer.slice(0, chunk.buffer.length);
                    }
                    chunk.buffer.copy(buffer);
                } finally {
                    unlock();
                }
                this.push({
                    position: chunk.position,
                    buffer
                });
                this.bytesWritten += chunk.buffer.length;
                this.position += chunk.buffer.length;
            }
            _transform(chunk, _encoding, callback) {
                (0, utils_1.asCallback)(this.__transform(chunk), callback);
            }
        }
        exports.SparseTransformStream = SparseTransformStream;
        exports.ProgressSparseTransformStream = (0, progress_1.makeClassEmitProgressEvents)(SparseTransformStream, "bytesWritten", "position");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.DriverlessDevice = void 0;
        const source_destination_1 = __webpack_require__(54);
        class DriverlessDevice extends source_destination_1.SourceDestination {
            constructor(driverlessDevice) {
                super();
                this.accessible = false;
                this.raw = null;
                this.device = null;
                this.devicePath = null;
                this.isSystem = false;
                this.mountpoints = [];
                this.size = null;
                this.emitsProgress = false;
                this.description = "";
                this.deviceDescriptor = {
                    idVendor: driverlessDevice.vid,
                    idProduct: driverlessDevice.pid
                };
            }
        }
        exports.DriverlessDevice = DriverlessDevice;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.GZipSource = void 0;
        const zlib_1 = __webpack_require__(89);
        const compressed_source_1 = __webpack_require__(87);
        const source_destination_1 = __webpack_require__(54);
        const ISIZE_LENGTH = 4;
        class GZipSource extends compressed_source_1.CompressedSource {
            createTransform() {
                return (0, zlib_1.createGunzip)();
            }
            async getSize() {
                const sizeFromPartitionTable = await this.getSizeFromPartitionTable();
                if (await this.source.canRead()) {
                    const sourceMetadata = await this.source.getMetadata();
                    if (sourceMetadata.size !== undefined) {
                        const {buffer} = await this.source.read(Buffer.allocUnsafe(ISIZE_LENGTH), 0, ISIZE_LENGTH, sourceMetadata.size - ISIZE_LENGTH);
                        const sizeFromFooter = buffer.readUInt32LE(0);
                        return {
                            size: Math.max(sizeFromFooter, sizeFromPartitionTable || 0),
                            isEstimated: true
                        };
                    }
                } else if (sizeFromPartitionTable !== undefined) {
                    return {
                        size: sizeFromPartitionTable,
                        isEstimated: true
                    };
                }
            }
        }
        exports.GZipSource = GZipSource;
        GZipSource.mimetype = "application/gzip";
        source_destination_1.SourceDestination.register(GZipSource);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Http = void 0;
        const axios_1 = __webpack_require__(146);
        const axiosNodeAdapter = __webpack_require__(158);
        const path_1 = __webpack_require__(34);
        const querystring_1 = __webpack_require__(178);
        const url_1 = __webpack_require__(167);
        const stream_limiter_1 = __webpack_require__(88);
        const source_destination_1 = __webpack_require__(54);
        axios_1.default.defaults.adapter = axiosNodeAdapter;
        class Http extends source_destination_1.SourceDestination {
            constructor({url, avoidRandomAccess = false, axiosInstance = axios_1.default.create(), auth}) {
                super();
                this.url = url;
                this.avoidRandomAccess = avoidRandomAccess;
                this.axiosInstance = axiosInstance;
                if (auth) {
                    this.axiosInstance.defaults.auth = auth;
                }
                this.ready = this.getInfo();
            }
            async getInfo() {
                try {
                    let response;
                    try {
                        response = await this.axiosInstance({
                            method: "head",
                            url: this.url
                        });
                    } catch (error) {
                        response = await this.axiosInstance({
                            method: "get",
                            url: this.url,
                            responseType: "stream"
                        });
                        response.data.destroy();
                    }
                    this.redirectUrl = response.request.res.responseUrl;
                    this.size = parseInt(response.headers["content-length"], 10);
                    if (Number.isNaN(this.size)) {
                        this.size = undefined;
                    }
                    this.acceptsRange = response.headers["accept-ranges"] === "bytes";
                } catch (error) {
                    this.error = error;
                }
            }
            async canRead() {
                await this.ready;
                if (this.error) {
                    throw this.error;
                }
                return !this.avoidRandomAccess && this.acceptsRange;
            }
            async canCreateReadStream() {
                return true;
            }
            async _getMetadata() {
                await this.ready;
                if (this.error) {
                    throw this.error;
                }
                let name;
                const pathname = (0, url_1.parse)(this.redirectUrl).pathname;
                if (pathname !== undefined) {
                    name = (0, path_1.basename)((0, querystring_1.unescape)(pathname));
                }
                return {
                    size: this.size,
                    name
                };
            }
            getRange(start = 0, end) {
                let range = `bytes=${start}-`;
                if (end !== undefined) {
                    range += end;
                }
                return range;
            }
            async read(buffer, bufferOffset, length, sourceOffset) {
                const response = await this.axiosInstance({
                    method: "get",
                    url: this.redirectUrl,
                    responseType: "arraybuffer",
                    headers: {
                        Range: this.getRange(sourceOffset, sourceOffset + length - 1)
                    }
                });
                const bytesRead = response.data.length;
                response.data.copy(buffer, bufferOffset);
                return {
                    bytesRead,
                    buffer
                };
            }
            async createReadStream({emitProgress = false, start = 0, end} = {}) {
                const response = await this.axiosInstance({
                    method: "get",
                    url: this.redirectUrl,
                    headers: {
                        Range: this.getRange(start, end)
                    },
                    responseType: "stream"
                });
                if (emitProgress) {
                    let bytes = 0;
                    let lastTime = Date.now();
                    response.data.on("data", (chunk => {
                        const now = Date.now();
                        const length = chunk.length;
                        bytes += length;
                        const speed = length / ((now - lastTime) / 1e3);
                        lastTime = now;
                        response.data.emit("progress", {
                            position: bytes,
                            bytes,
                            speed
                        });
                    }));
                    response.data.pause();
                }
                if (end !== undefined) {
                    return new stream_limiter_1.StreamLimiter(response.data, end - start + 1);
                }
                return response.data;
            }
        }
        exports.Http = Http;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        module.exports = __webpack_require__(147);
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        var bind = __webpack_require__(149);
        var Axios = __webpack_require__(150);
        var mergeConfig = __webpack_require__(172);
        var defaults = __webpack_require__(155);
        function createInstance(defaultConfig) {
            var context = new Axios(defaultConfig);
            var instance = bind(Axios.prototype.request, context);
            utils.extend(instance, Axios.prototype, context);
            utils.extend(instance, context);
            return instance;
        }
        var axios = createInstance(defaults);
        axios.Axios = Axios;
        axios.create = function create(instanceConfig) {
            return createInstance(mergeConfig(axios.defaults, instanceConfig));
        };
        axios.Cancel = __webpack_require__(174);
        axios.CancelToken = __webpack_require__(175);
        axios.isCancel = __webpack_require__(171);
        axios.all = function all(promises) {
            return Promise.all(promises);
        };
        axios.spread = __webpack_require__(176);
        axios.isAxiosError = __webpack_require__(177);
        module.exports = axios;
        module.exports.default = axios;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var bind = __webpack_require__(149);
        var toString = Object.prototype.toString;
        function isArray(val) {
            return toString.call(val) === "[object Array]";
        }
        function isUndefined(val) {
            return typeof val === "undefined";
        }
        function isBuffer(val) {
            return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
        }
        function isArrayBuffer(val) {
            return toString.call(val) === "[object ArrayBuffer]";
        }
        function isFormData(val) {
            return typeof FormData !== "undefined" && val instanceof FormData;
        }
        function isArrayBufferView(val) {
            var result;
            if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
                result = ArrayBuffer.isView(val);
            } else {
                result = val && val.buffer && val.buffer instanceof ArrayBuffer;
            }
            return result;
        }
        function isString(val) {
            return typeof val === "string";
        }
        function isNumber(val) {
            return typeof val === "number";
        }
        function isObject(val) {
            return val !== null && typeof val === "object";
        }
        function isPlainObject(val) {
            if (toString.call(val) !== "[object Object]") {
                return false;
            }
            var prototype = Object.getPrototypeOf(val);
            return prototype === null || prototype === Object.prototype;
        }
        function isDate(val) {
            return toString.call(val) === "[object Date]";
        }
        function isFile(val) {
            return toString.call(val) === "[object File]";
        }
        function isBlob(val) {
            return toString.call(val) === "[object Blob]";
        }
        function isFunction(val) {
            return toString.call(val) === "[object Function]";
        }
        function isStream(val) {
            return isObject(val) && isFunction(val.pipe);
        }
        function isURLSearchParams(val) {
            return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
        }
        function trim(str) {
            return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
        }
        function isStandardBrowserEnv() {
            if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
                return false;
            }
            return typeof window !== "undefined" && typeof document !== "undefined";
        }
        function forEach(obj, fn) {
            if (obj === null || typeof obj === "undefined") {
                return;
            }
            if (typeof obj !== "object") {
                obj = [ obj ];
            }
            if (isArray(obj)) {
                for (var i = 0, l = obj.length; i < l; i++) {
                    fn.call(null, obj[i], i, obj);
                }
            } else {
                for (var key in obj) {
                    if (Object.prototype.hasOwnProperty.call(obj, key)) {
                        fn.call(null, obj[key], key, obj);
                    }
                }
            }
        }
        function merge() {
            var result = {};
            function assignValue(val, key) {
                if (isPlainObject(result[key]) && isPlainObject(val)) {
                    result[key] = merge(result[key], val);
                } else if (isPlainObject(val)) {
                    result[key] = merge({}, val);
                } else if (isArray(val)) {
                    result[key] = val.slice();
                } else {
                    result[key] = val;
                }
            }
            for (var i = 0, l = arguments.length; i < l; i++) {
                forEach(arguments[i], assignValue);
            }
            return result;
        }
        function extend(a, b, thisArg) {
            forEach(b, (function assignValue(val, key) {
                if (thisArg && typeof val === "function") {
                    a[key] = bind(val, thisArg);
                } else {
                    a[key] = val;
                }
            }));
            return a;
        }
        function stripBOM(content) {
            if (content.charCodeAt(0) === 65279) {
                content = content.slice(1);
            }
            return content;
        }
        module.exports = {
            isArray,
            isArrayBuffer,
            isBuffer,
            isFormData,
            isArrayBufferView,
            isString,
            isNumber,
            isObject,
            isPlainObject,
            isUndefined,
            isDate,
            isFile,
            isBlob,
            isFunction,
            isStream,
            isURLSearchParams,
            isStandardBrowserEnv,
            forEach,
            merge,
            extend,
            trim,
            stripBOM
        };
    }, module => {
        "use strict";
        module.exports = function bind(fn, thisArg) {
            return function wrap() {
                var args = new Array(arguments.length);
                for (var i = 0; i < args.length; i++) {
                    args[i] = arguments[i];
                }
                return fn.apply(thisArg, args);
            };
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        var buildURL = __webpack_require__(151);
        var InterceptorManager = __webpack_require__(152);
        var dispatchRequest = __webpack_require__(153);
        var mergeConfig = __webpack_require__(172);
        var validator = __webpack_require__(173);
        var validators = validator.validators;
        function Axios(instanceConfig) {
            this.defaults = instanceConfig;
            this.interceptors = {
                request: new InterceptorManager,
                response: new InterceptorManager
            };
        }
        Axios.prototype.request = function request(config) {
            if (typeof config === "string") {
                config = arguments[1] || {};
                config.url = arguments[0];
            } else {
                config = config || {};
            }
            config = mergeConfig(this.defaults, config);
            if (config.method) {
                config.method = config.method.toLowerCase();
            } else if (this.defaults.method) {
                config.method = this.defaults.method.toLowerCase();
            } else {
                config.method = "get";
            }
            var transitional = config.transitional;
            if (transitional !== undefined) {
                validator.assertOptions(transitional, {
                    silentJSONParsing: validators.transitional(validators.boolean, "1.0.0"),
                    forcedJSONParsing: validators.transitional(validators.boolean, "1.0.0"),
                    clarifyTimeoutError: validators.transitional(validators.boolean, "1.0.0")
                }, false);
            }
            var requestInterceptorChain = [];
            var synchronousRequestInterceptors = true;
            this.interceptors.request.forEach((function unshiftRequestInterceptors(interceptor) {
                if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
                    return;
                }
                synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
                requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
            }));
            var responseInterceptorChain = [];
            this.interceptors.response.forEach((function pushResponseInterceptors(interceptor) {
                responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
            }));
            var promise;
            if (!synchronousRequestInterceptors) {
                var chain = [ dispatchRequest, undefined ];
                Array.prototype.unshift.apply(chain, requestInterceptorChain);
                chain = chain.concat(responseInterceptorChain);
                promise = Promise.resolve(config);
                while (chain.length) {
                    promise = promise.then(chain.shift(), chain.shift());
                }
                return promise;
            }
            var newConfig = config;
            while (requestInterceptorChain.length) {
                var onFulfilled = requestInterceptorChain.shift();
                var onRejected = requestInterceptorChain.shift();
                try {
                    newConfig = onFulfilled(newConfig);
                } catch (error) {
                    onRejected(error);
                    break;
                }
            }
            try {
                promise = dispatchRequest(newConfig);
            } catch (error) {
                return Promise.reject(error);
            }
            while (responseInterceptorChain.length) {
                promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
            }
            return promise;
        };
        Axios.prototype.getUri = function getUri(config) {
            config = mergeConfig(this.defaults, config);
            return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, "");
        };
        utils.forEach([ "delete", "get", "head", "options" ], (function forEachMethodNoData(method) {
            Axios.prototype[method] = function(url, config) {
                return this.request(mergeConfig(config || {}, {
                    method,
                    url,
                    data: (config || {}).data
                }));
            };
        }));
        utils.forEach([ "post", "put", "patch" ], (function forEachMethodWithData(method) {
            Axios.prototype[method] = function(url, data, config) {
                return this.request(mergeConfig(config || {}, {
                    method,
                    url,
                    data
                }));
            };
        }));
        module.exports = Axios;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        function encode(val) {
            return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
        }
        module.exports = function buildURL(url, params, paramsSerializer) {
            if (!params) {
                return url;
            }
            var serializedParams;
            if (paramsSerializer) {
                serializedParams = paramsSerializer(params);
            } else if (utils.isURLSearchParams(params)) {
                serializedParams = params.toString();
            } else {
                var parts = [];
                utils.forEach(params, (function serialize(val, key) {
                    if (val === null || typeof val === "undefined") {
                        return;
                    }
                    if (utils.isArray(val)) {
                        key = key + "[]";
                    } else {
                        val = [ val ];
                    }
                    utils.forEach(val, (function parseValue(v) {
                        if (utils.isDate(v)) {
                            v = v.toISOString();
                        } else if (utils.isObject(v)) {
                            v = JSON.stringify(v);
                        }
                        parts.push(encode(key) + "=" + encode(v));
                    }));
                }));
                serializedParams = parts.join("&");
            }
            if (serializedParams) {
                var hashmarkIndex = url.indexOf("#");
                if (hashmarkIndex !== -1) {
                    url = url.slice(0, hashmarkIndex);
                }
                url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
            }
            return url;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        function InterceptorManager() {
            this.handlers = [];
        }
        InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
            this.handlers.push({
                fulfilled,
                rejected,
                synchronous: options ? options.synchronous : false,
                runWhen: options ? options.runWhen : null
            });
            return this.handlers.length - 1;
        };
        InterceptorManager.prototype.eject = function eject(id) {
            if (this.handlers[id]) {
                this.handlers[id] = null;
            }
        };
        InterceptorManager.prototype.forEach = function forEach(fn) {
            utils.forEach(this.handlers, (function forEachHandler(h) {
                if (h !== null) {
                    fn(h);
                }
            }));
        };
        module.exports = InterceptorManager;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        var transformData = __webpack_require__(154);
        var isCancel = __webpack_require__(171);
        var defaults = __webpack_require__(155);
        function throwIfCancellationRequested(config) {
            if (config.cancelToken) {
                config.cancelToken.throwIfRequested();
            }
        }
        module.exports = function dispatchRequest(config) {
            throwIfCancellationRequested(config);
            config.headers = config.headers || {};
            config.data = transformData.call(config, config.data, config.headers, config.transformRequest);
            config.headers = utils.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers);
            utils.forEach([ "delete", "get", "head", "post", "put", "patch", "common" ], (function cleanHeaderConfig(method) {
                delete config.headers[method];
            }));
            var adapter = config.adapter || defaults.adapter;
            return adapter(config).then((function onAdapterResolution(response) {
                throwIfCancellationRequested(config);
                response.data = transformData.call(config, response.data, response.headers, config.transformResponse);
                return response;
            }), (function onAdapterRejection(reason) {
                if (!isCancel(reason)) {
                    throwIfCancellationRequested(config);
                    if (reason && reason.response) {
                        reason.response.data = transformData.call(config, reason.response.data, reason.response.headers, config.transformResponse);
                    }
                }
                return Promise.reject(reason);
            }));
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        var defaults = __webpack_require__(155);
        module.exports = function transformData(data, headers, fns) {
            var context = this || defaults;
            utils.forEach(fns, (function transform(fn) {
                data = fn.call(context, data, headers);
            }));
            return data;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        var normalizeHeaderName = __webpack_require__(156);
        var enhanceError = __webpack_require__(157);
        var DEFAULT_CONTENT_TYPE = {
            "Content-Type": "application/x-www-form-urlencoded"
        };
        function setContentTypeIfUnset(headers, value) {
            if (!utils.isUndefined(headers) && utils.isUndefined(headers["Content-Type"])) {
                headers["Content-Type"] = value;
            }
        }
        function getDefaultAdapter() {
            var adapter;
            if (typeof XMLHttpRequest !== "undefined") {
                adapter = __webpack_require__(158);
            } else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") {
                adapter = __webpack_require__(158);
            }
            return adapter;
        }
        function stringifySafely(rawValue, parser, encoder) {
            if (utils.isString(rawValue)) {
                try {
                    (parser || JSON.parse)(rawValue);
                    return utils.trim(rawValue);
                } catch (e) {
                    if (e.name !== "SyntaxError") {
                        throw e;
                    }
                }
            }
            return (encoder || JSON.stringify)(rawValue);
        }
        var defaults = {
            transitional: {
                silentJSONParsing: true,
                forcedJSONParsing: true,
                clarifyTimeoutError: false
            },
            adapter: getDefaultAdapter(),
            transformRequest: [ function transformRequest(data, headers) {
                normalizeHeaderName(headers, "Accept");
                normalizeHeaderName(headers, "Content-Type");
                if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
                    return data;
                }
                if (utils.isArrayBufferView(data)) {
                    return data.buffer;
                }
                if (utils.isURLSearchParams(data)) {
                    setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8");
                    return data.toString();
                }
                if (utils.isObject(data) || headers && headers["Content-Type"] === "application/json") {
                    setContentTypeIfUnset(headers, "application/json");
                    return stringifySafely(data);
                }
                return data;
            } ],
            transformResponse: [ function transformResponse(data) {
                var transitional = this.transitional;
                var silentJSONParsing = transitional && transitional.silentJSONParsing;
                var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
                var strictJSONParsing = !silentJSONParsing && this.responseType === "json";
                if (strictJSONParsing || forcedJSONParsing && utils.isString(data) && data.length) {
                    try {
                        return JSON.parse(data);
                    } catch (e) {
                        if (strictJSONParsing) {
                            if (e.name === "SyntaxError") {
                                throw enhanceError(e, this, "E_JSON_PARSE");
                            }
                            throw e;
                        }
                    }
                }
                return data;
            } ],
            timeout: 0,
            xsrfCookieName: "XSRF-TOKEN",
            xsrfHeaderName: "X-XSRF-TOKEN",
            maxContentLength: -1,
            maxBodyLength: -1,
            validateStatus: function validateStatus(status) {
                return status >= 200 && status < 300;
            }
        };
        defaults.headers = {
            common: {
                Accept: "application/json, text/plain, */*"
            }
        };
        utils.forEach([ "delete", "get", "head" ], (function forEachMethodNoData(method) {
            defaults.headers[method] = {};
        }));
        utils.forEach([ "post", "put", "patch" ], (function forEachMethodWithData(method) {
            defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
        }));
        module.exports = defaults;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        module.exports = function normalizeHeaderName(headers, normalizedName) {
            utils.forEach(headers, (function processHeader(value, name) {
                if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
                    headers[normalizedName] = value;
                    delete headers[name];
                }
            }));
        };
    }, module => {
        "use strict";
        module.exports = function enhanceError(error, config, code, request, response) {
            error.config = config;
            if (code) {
                error.code = code;
            }
            error.request = request;
            error.response = response;
            error.isAxiosError = true;
            error.toJSON = function toJSON() {
                return {
                    message: this.message,
                    name: this.name,
                    description: this.description,
                    number: this.number,
                    fileName: this.fileName,
                    lineNumber: this.lineNumber,
                    columnNumber: this.columnNumber,
                    stack: this.stack,
                    config: this.config,
                    code: this.code
                };
            };
            return error;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        var settle = __webpack_require__(159);
        var buildFullPath = __webpack_require__(161);
        var buildURL = __webpack_require__(151);
        var http = __webpack_require__(164);
        var https = __webpack_require__(165);
        var httpFollow = __webpack_require__(166).http;
        var httpsFollow = __webpack_require__(166).https;
        var url = __webpack_require__(167);
        var zlib = __webpack_require__(89);
        var pkg = __webpack_require__(170);
        var createError = __webpack_require__(160);
        var enhanceError = __webpack_require__(157);
        var isHttps = /https:?/;
        function setProxy(options, proxy, location) {
            options.hostname = proxy.host;
            options.host = proxy.host;
            options.port = proxy.port;
            options.path = location;
            if (proxy.auth) {
                var base64 = Buffer.from(proxy.auth.username + ":" + proxy.auth.password, "utf8").toString("base64");
                options.headers["Proxy-Authorization"] = "Basic " + base64;
            }
            options.beforeRedirect = function beforeRedirect(redirection) {
                redirection.headers.host = redirection.host;
                setProxy(redirection, proxy, redirection.href);
            };
        }
        module.exports = function httpAdapter(config) {
            return new Promise((function dispatchHttpRequest(resolvePromise, rejectPromise) {
                var resolve = function resolve(value) {
                    resolvePromise(value);
                };
                var reject = function reject(value) {
                    rejectPromise(value);
                };
                var data = config.data;
                var headers = config.headers;
                if ("User-Agent" in headers || "user-agent" in headers) {
                    if (!headers["User-Agent"] && !headers["user-agent"]) {
                        delete headers["User-Agent"];
                        delete headers["user-agent"];
                    }
                } else {
                    headers["User-Agent"] = "axios/" + pkg.version;
                }
                if (data && !utils.isStream(data)) {
                    if (Buffer.isBuffer(data)) {} else if (utils.isArrayBuffer(data)) {
                        data = Buffer.from(new Uint8Array(data));
                    } else if (utils.isString(data)) {
                        data = Buffer.from(data, "utf-8");
                    } else {
                        return reject(createError("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream", config));
                    }
                    headers["Content-Length"] = data.length;
                }
                var auth = undefined;
                if (config.auth) {
                    var username = config.auth.username || "";
                    var password = config.auth.password || "";
                    auth = username + ":" + password;
                }
                var fullPath = buildFullPath(config.baseURL, config.url);
                var parsed = url.parse(fullPath);
                var protocol = parsed.protocol || "http:";
                if (!auth && parsed.auth) {
                    var urlAuth = parsed.auth.split(":");
                    var urlUsername = urlAuth[0] || "";
                    var urlPassword = urlAuth[1] || "";
                    auth = urlUsername + ":" + urlPassword;
                }
                if (auth) {
                    delete headers.Authorization;
                }
                var isHttpsRequest = isHttps.test(protocol);
                var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
                var options = {
                    path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ""),
                    method: config.method.toUpperCase(),
                    headers,
                    agent,
                    agents: {
                        http: config.httpAgent,
                        https: config.httpsAgent
                    },
                    auth
                };
                if (config.socketPath) {
                    options.socketPath = config.socketPath;
                } else {
                    options.hostname = parsed.hostname;
                    options.port = parsed.port;
                }
                var proxy = config.proxy;
                if (!proxy && proxy !== false) {
                    var proxyEnv = protocol.slice(0, -1) + "_proxy";
                    var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
                    if (proxyUrl) {
                        var parsedProxyUrl = url.parse(proxyUrl);
                        var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
                        var shouldProxy = true;
                        if (noProxyEnv) {
                            var noProxy = noProxyEnv.split(",").map((function trim(s) {
                                return s.trim();
                            }));
                            shouldProxy = !noProxy.some((function proxyMatch(proxyElement) {
                                if (!proxyElement) {
                                    return false;
                                }
                                if (proxyElement === "*") {
                                    return true;
                                }
                                if (proxyElement[0] === "." && parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
                                    return true;
                                }
                                return parsed.hostname === proxyElement;
                            }));
                        }
                        if (shouldProxy) {
                            proxy = {
                                host: parsedProxyUrl.hostname,
                                port: parsedProxyUrl.port,
                                protocol: parsedProxyUrl.protocol
                            };
                            if (parsedProxyUrl.auth) {
                                var proxyUrlAuth = parsedProxyUrl.auth.split(":");
                                proxy.auth = {
                                    username: proxyUrlAuth[0],
                                    password: proxyUrlAuth[1]
                                };
                            }
                        }
                    }
                }
                if (proxy) {
                    options.headers.host = parsed.hostname + (parsed.port ? ":" + parsed.port : "");
                    setProxy(options, proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
                }
                var transport;
                var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
                if (config.transport) {
                    transport = config.transport;
                } else if (config.maxRedirects === 0) {
                    transport = isHttpsProxy ? https : http;
                } else {
                    if (config.maxRedirects) {
                        options.maxRedirects = config.maxRedirects;
                    }
                    transport = isHttpsProxy ? httpsFollow : httpFollow;
                }
                if (config.maxBodyLength > -1) {
                    options.maxBodyLength = config.maxBodyLength;
                }
                var req = transport.request(options, (function handleResponse(res) {
                    if (req.aborted) return;
                    var stream = res;
                    var lastRequest = res.req || req;
                    if (res.statusCode !== 204 && lastRequest.method !== "HEAD" && config.decompress !== false) {
                        switch (res.headers["content-encoding"]) {
                          case "gzip":
                          case "compress":
                          case "deflate":
                            stream = stream.pipe(zlib.createUnzip());
                            delete res.headers["content-encoding"];
                            break;
                        }
                    }
                    var response = {
                        status: res.statusCode,
                        statusText: res.statusMessage,
                        headers: res.headers,
                        config,
                        request: lastRequest
                    };
                    if (config.responseType === "stream") {
                        response.data = stream;
                        settle(resolve, reject, response);
                    } else {
                        var responseBuffer = [];
                        var totalResponseBytes = 0;
                        stream.on("data", (function handleStreamData(chunk) {
                            responseBuffer.push(chunk);
                            totalResponseBytes += chunk.length;
                            if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
                                stream.destroy();
                                reject(createError("maxContentLength size of " + config.maxContentLength + " exceeded", config, null, lastRequest));
                            }
                        }));
                        stream.on("error", (function handleStreamError(err) {
                            if (req.aborted) return;
                            reject(enhanceError(err, config, null, lastRequest));
                        }));
                        stream.on("end", (function handleStreamEnd() {
                            var responseData = Buffer.concat(responseBuffer);
                            if (config.responseType !== "arraybuffer") {
                                responseData = responseData.toString(config.responseEncoding);
                                if (!config.responseEncoding || config.responseEncoding === "utf8") {
                                    responseData = utils.stripBOM(responseData);
                                }
                            }
                            response.data = responseData;
                            settle(resolve, reject, response);
                        }));
                    }
                }));
                req.on("error", (function handleRequestError(err) {
                    if (req.aborted && err.code !== "ERR_FR_TOO_MANY_REDIRECTS") return;
                    reject(enhanceError(err, config, null, req));
                }));
                if (config.timeout) {
                    var timeout = parseInt(config.timeout, 10);
                    if (isNaN(timeout)) {
                        reject(createError("error trying to parse `config.timeout` to int", config, "ERR_PARSE_TIMEOUT", req));
                        return;
                    }
                    req.setTimeout(timeout, (function handleRequestTimeout() {
                        req.abort();
                        reject(createError("timeout of " + timeout + "ms exceeded", config, config.transitional && config.transitional.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED", req));
                    }));
                }
                if (config.cancelToken) {
                    config.cancelToken.promise.then((function onCanceled(cancel) {
                        if (req.aborted) return;
                        req.abort();
                        reject(cancel);
                    }));
                }
                if (utils.isStream(data)) {
                    data.on("error", (function handleStreamError(err) {
                        reject(enhanceError(err, config, null, req));
                    })).pipe(req);
                } else {
                    req.end(data);
                }
            }));
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var createError = __webpack_require__(160);
        module.exports = function settle(resolve, reject, response) {
            var validateStatus = response.config.validateStatus;
            if (!response.status || !validateStatus || validateStatus(response.status)) {
                resolve(response);
            } else {
                reject(createError("Request failed with status code " + response.status, response.config, null, response.request, response));
            }
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var enhanceError = __webpack_require__(157);
        module.exports = function createError(message, config, code, request, response) {
            var error = new Error(message);
            return enhanceError(error, config, code, request, response);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var isAbsoluteURL = __webpack_require__(162);
        var combineURLs = __webpack_require__(163);
        module.exports = function buildFullPath(baseURL, requestedURL) {
            if (baseURL && !isAbsoluteURL(requestedURL)) {
                return combineURLs(baseURL, requestedURL);
            }
            return requestedURL;
        };
    }, module => {
        "use strict";
        module.exports = function isAbsoluteURL(url) {
            return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
        };
    }, module => {
        "use strict";
        module.exports = function combineURLs(baseURL, relativeURL) {
            return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
        };
    }, module => {
        "use strict";
        module.exports = require("http");
    }, module => {
        "use strict";
        module.exports = require("https");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var url = __webpack_require__(167);
        var URL = url.URL;
        var http = __webpack_require__(164);
        var https = __webpack_require__(165);
        var Writable = __webpack_require__(17).Writable;
        var assert = __webpack_require__(168);
        var debug = __webpack_require__(169);
        var events = [ "abort", "aborted", "connect", "error", "socket", "timeout" ];
        var eventHandlers = Object.create(null);
        events.forEach((function(event) {
            eventHandlers[event] = function(arg1, arg2, arg3) {
                this._redirectable.emit(event, arg1, arg2, arg3);
            };
        }));
        var RedirectionError = createErrorType("ERR_FR_REDIRECTION_FAILURE", "");
        var TooManyRedirectsError = createErrorType("ERR_FR_TOO_MANY_REDIRECTS", "Maximum number of redirects exceeded");
        var MaxBodyLengthExceededError = createErrorType("ERR_FR_MAX_BODY_LENGTH_EXCEEDED", "Request body larger than maxBodyLength limit");
        var WriteAfterEndError = createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
        function RedirectableRequest(options, responseCallback) {
            Writable.call(this);
            this._sanitizeOptions(options);
            this._options = options;
            this._ended = false;
            this._ending = false;
            this._redirectCount = 0;
            this._redirects = [];
            this._requestBodyLength = 0;
            this._requestBodyBuffers = [];
            if (responseCallback) {
                this.on("response", responseCallback);
            }
            var self = this;
            this._onNativeResponse = function(response) {
                self._processResponse(response);
            };
            this._performRequest();
        }
        RedirectableRequest.prototype = Object.create(Writable.prototype);
        RedirectableRequest.prototype.abort = function() {
            abortRequest(this._currentRequest);
            this.emit("abort");
        };
        RedirectableRequest.prototype.write = function(data, encoding, callback) {
            if (this._ending) {
                throw new WriteAfterEndError;
            }
            if (!(typeof data === "string" || typeof data === "object" && "length" in data)) {
                throw new TypeError("data should be a string, Buffer or Uint8Array");
            }
            if (typeof encoding === "function") {
                callback = encoding;
                encoding = null;
            }
            if (data.length === 0) {
                if (callback) {
                    callback();
                }
                return;
            }
            if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
                this._requestBodyLength += data.length;
                this._requestBodyBuffers.push({
                    data,
                    encoding
                });
                this._currentRequest.write(data, encoding, callback);
            } else {
                this.emit("error", new MaxBodyLengthExceededError);
                this.abort();
            }
        };
        RedirectableRequest.prototype.end = function(data, encoding, callback) {
            if (typeof data === "function") {
                callback = data;
                data = encoding = null;
            } else if (typeof encoding === "function") {
                callback = encoding;
                encoding = null;
            }
            if (!data) {
                this._ended = this._ending = true;
                this._currentRequest.end(null, null, callback);
            } else {
                var self = this;
                var currentRequest = this._currentRequest;
                this.write(data, encoding, (function() {
                    self._ended = true;
                    currentRequest.end(null, null, callback);
                }));
                this._ending = true;
            }
        };
        RedirectableRequest.prototype.setHeader = function(name, value) {
            this._options.headers[name] = value;
            this._currentRequest.setHeader(name, value);
        };
        RedirectableRequest.prototype.removeHeader = function(name) {
            delete this._options.headers[name];
            this._currentRequest.removeHeader(name);
        };
        RedirectableRequest.prototype.setTimeout = function(msecs, callback) {
            var self = this;
            function destroyOnTimeout(socket) {
                socket.setTimeout(msecs);
                socket.removeListener("timeout", socket.destroy);
                socket.addListener("timeout", socket.destroy);
            }
            function startTimer(socket) {
                if (self._timeout) {
                    clearTimeout(self._timeout);
                }
                self._timeout = setTimeout((function() {
                    self.emit("timeout");
                    clearTimer();
                }), msecs);
                destroyOnTimeout(socket);
            }
            function clearTimer() {
                if (self._timeout) {
                    clearTimeout(self._timeout);
                    self._timeout = null;
                }
                if (callback) {
                    self.removeListener("timeout", callback);
                }
                if (!self.socket) {
                    self._currentRequest.removeListener("socket", startTimer);
                }
            }
            if (callback) {
                this.on("timeout", callback);
            }
            if (this.socket) {
                startTimer(this.socket);
            } else {
                this._currentRequest.once("socket", startTimer);
            }
            this.on("socket", destroyOnTimeout);
            this.once("response", clearTimer);
            this.once("error", clearTimer);
            return this;
        };
        [ "flushHeaders", "getHeader", "setNoDelay", "setSocketKeepAlive" ].forEach((function(method) {
            RedirectableRequest.prototype[method] = function(a, b) {
                return this._currentRequest[method](a, b);
            };
        }));
        [ "aborted", "connection", "socket" ].forEach((function(property) {
            Object.defineProperty(RedirectableRequest.prototype, property, {
                get: function() {
                    return this._currentRequest[property];
                }
            });
        }));
        RedirectableRequest.prototype._sanitizeOptions = function(options) {
            if (!options.headers) {
                options.headers = {};
            }
            if (options.host) {
                if (!options.hostname) {
                    options.hostname = options.host;
                }
                delete options.host;
            }
            if (!options.pathname && options.path) {
                var searchPos = options.path.indexOf("?");
                if (searchPos < 0) {
                    options.pathname = options.path;
                } else {
                    options.pathname = options.path.substring(0, searchPos);
                    options.search = options.path.substring(searchPos);
                }
            }
        };
        RedirectableRequest.prototype._performRequest = function() {
            var protocol = this._options.protocol;
            var nativeProtocol = this._options.nativeProtocols[protocol];
            if (!nativeProtocol) {
                this.emit("error", new TypeError("Unsupported protocol " + protocol));
                return;
            }
            if (this._options.agents) {
                var scheme = protocol.substr(0, protocol.length - 1);
                this._options.agent = this._options.agents[scheme];
            }
            var request = this._currentRequest = nativeProtocol.request(this._options, this._onNativeResponse);
            this._currentUrl = url.format(this._options);
            request._redirectable = this;
            for (var e = 0; e < events.length; e++) {
                request.on(events[e], eventHandlers[events[e]]);
            }
            if (this._isRedirect) {
                var i = 0;
                var self = this;
                var buffers = this._requestBodyBuffers;
                (function writeNext(error) {
                    if (request === self._currentRequest) {
                        if (error) {
                            self.emit("error", error);
                        } else if (i < buffers.length) {
                            var buffer = buffers[i++];
                            if (!request.finished) {
                                request.write(buffer.data, buffer.encoding, writeNext);
                            }
                        } else if (self._ended) {
                            request.end();
                        }
                    }
                })();
            }
        };
        RedirectableRequest.prototype._processResponse = function(response) {
            var statusCode = response.statusCode;
            if (this._options.trackRedirects) {
                this._redirects.push({
                    url: this._currentUrl,
                    headers: response.headers,
                    statusCode
                });
            }
            var location = response.headers.location;
            if (location && this._options.followRedirects !== false && statusCode >= 300 && statusCode < 400) {
                abortRequest(this._currentRequest);
                response.destroy();
                if (++this._redirectCount > this._options.maxRedirects) {
                    this.emit("error", new TooManyRedirectsError);
                    return;
                }
                if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || statusCode === 303 && !/^(?:GET|HEAD)$/.test(this._options.method)) {
                    this._options.method = "GET";
                    this._requestBodyBuffers = [];
                    removeMatchingHeaders(/^content-/i, this._options.headers);
                }
                var previousHostName = removeMatchingHeaders(/^host$/i, this._options.headers) || url.parse(this._currentUrl).hostname;
                var redirectUrl = url.resolve(this._currentUrl, location);
                debug("redirecting to", redirectUrl);
                this._isRedirect = true;
                var redirectUrlParts = url.parse(redirectUrl);
                Object.assign(this._options, redirectUrlParts);
                if (redirectUrlParts.hostname !== previousHostName) {
                    removeMatchingHeaders(/^authorization$/i, this._options.headers);
                }
                if (typeof this._options.beforeRedirect === "function") {
                    var responseDetails = {
                        headers: response.headers
                    };
                    try {
                        this._options.beforeRedirect.call(null, this._options, responseDetails);
                    } catch (err) {
                        this.emit("error", err);
                        return;
                    }
                    this._sanitizeOptions(this._options);
                }
                try {
                    this._performRequest();
                } catch (cause) {
                    var error = new RedirectionError("Redirected request failed: " + cause.message);
                    error.cause = cause;
                    this.emit("error", error);
                }
            } else {
                response.responseUrl = this._currentUrl;
                response.redirects = this._redirects;
                this.emit("response", response);
                this._requestBodyBuffers = [];
            }
        };
        function wrap(protocols) {
            var exports = {
                maxRedirects: 21,
                maxBodyLength: 10 * 1024 * 1024
            };
            var nativeProtocols = {};
            Object.keys(protocols).forEach((function(scheme) {
                var protocol = scheme + ":";
                var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
                var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
                function request(input, options, callback) {
                    if (typeof input === "string") {
                        var urlStr = input;
                        try {
                            input = urlToOptions(new URL(urlStr));
                        } catch (err) {
                            input = url.parse(urlStr);
                        }
                    } else if (URL && input instanceof URL) {
                        input = urlToOptions(input);
                    } else {
                        callback = options;
                        options = input;
                        input = {
                            protocol
                        };
                    }
                    if (typeof options === "function") {
                        callback = options;
                        options = null;
                    }
                    options = Object.assign({
                        maxRedirects: exports.maxRedirects,
                        maxBodyLength: exports.maxBodyLength
                    }, input, options);
                    options.nativeProtocols = nativeProtocols;
                    assert.equal(options.protocol, protocol, "protocol mismatch");
                    debug("options", options);
                    return new RedirectableRequest(options, callback);
                }
                function get(input, options, callback) {
                    var wrappedRequest = wrappedProtocol.request(input, options, callback);
                    wrappedRequest.end();
                    return wrappedRequest;
                }
                Object.defineProperties(wrappedProtocol, {
                    request: {
                        value: request,
                        configurable: true,
                        enumerable: true,
                        writable: true
                    },
                    get: {
                        value: get,
                        configurable: true,
                        enumerable: true,
                        writable: true
                    }
                });
            }));
            return exports;
        }
        function noop() {}
        function urlToOptions(urlObject) {
            var options = {
                protocol: urlObject.protocol,
                hostname: urlObject.hostname.startsWith("[") ? urlObject.hostname.slice(1, -1) : urlObject.hostname,
                hash: urlObject.hash,
                search: urlObject.search,
                pathname: urlObject.pathname,
                path: urlObject.pathname + urlObject.search,
                href: urlObject.href
            };
            if (urlObject.port !== "") {
                options.port = Number(urlObject.port);
            }
            return options;
        }
        function removeMatchingHeaders(regex, headers) {
            var lastValue;
            for (var header in headers) {
                if (regex.test(header)) {
                    lastValue = headers[header];
                    delete headers[header];
                }
            }
            return lastValue;
        }
        function createErrorType(code, defaultMessage) {
            function CustomError(message) {
                Error.captureStackTrace(this, this.constructor);
                this.message = message || defaultMessage;
            }
            CustomError.prototype = new Error;
            CustomError.prototype.constructor = CustomError;
            CustomError.prototype.name = "Error [" + code + "]";
            CustomError.prototype.code = code;
            return CustomError;
        }
        function abortRequest(request) {
            for (var e = 0; e < events.length; e++) {
                request.removeListener(events[e], eventHandlers[events[e]]);
            }
            request.on("error", noop);
            request.abort();
        }
        module.exports = wrap({
            http,
            https
        });
        module.exports.wrap = wrap;
    }, module => {
        "use strict";
        module.exports = require("url");
    }, module => {
        "use strict";
        module.exports = require("assert");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var debug;
        module.exports = function() {
            if (!debug) {
                try {
                    debug = __webpack_require__(42)("follow-redirects");
                } catch (error) {}
                if (typeof debug !== "function") {
                    debug = function() {};
                }
            }
            debug.apply(null, arguments);
        };
    }, module => {
        "use strict";
        module.exports = require("../package.json");
    }, module => {
        "use strict";
        module.exports = function isCancel(value) {
            return !!(value && value.__CANCEL__);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var utils = __webpack_require__(148);
        module.exports = function mergeConfig(config1, config2) {
            config2 = config2 || {};
            var config = {};
            var valueFromConfig2Keys = [ "url", "method", "data" ];
            var mergeDeepPropertiesKeys = [ "headers", "auth", "proxy", "params" ];
            var defaultToConfig2Keys = [ "baseURL", "transformRequest", "transformResponse", "paramsSerializer", "timeout", "timeoutMessage", "withCredentials", "adapter", "responseType", "xsrfCookieName", "xsrfHeaderName", "onUploadProgress", "onDownloadProgress", "decompress", "maxContentLength", "maxBodyLength", "maxRedirects", "transport", "httpAgent", "httpsAgent", "cancelToken", "socketPath", "responseEncoding" ];
            var directMergeKeys = [ "validateStatus" ];
            function getMergedValue(target, source) {
                if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
                    return utils.merge(target, source);
                } else if (utils.isPlainObject(source)) {
                    return utils.merge({}, source);
                } else if (utils.isArray(source)) {
                    return source.slice();
                }
                return source;
            }
            function mergeDeepProperties(prop) {
                if (!utils.isUndefined(config2[prop])) {
                    config[prop] = getMergedValue(config1[prop], config2[prop]);
                } else if (!utils.isUndefined(config1[prop])) {
                    config[prop] = getMergedValue(undefined, config1[prop]);
                }
            }
            utils.forEach(valueFromConfig2Keys, (function valueFromConfig2(prop) {
                if (!utils.isUndefined(config2[prop])) {
                    config[prop] = getMergedValue(undefined, config2[prop]);
                }
            }));
            utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
            utils.forEach(defaultToConfig2Keys, (function defaultToConfig2(prop) {
                if (!utils.isUndefined(config2[prop])) {
                    config[prop] = getMergedValue(undefined, config2[prop]);
                } else if (!utils.isUndefined(config1[prop])) {
                    config[prop] = getMergedValue(undefined, config1[prop]);
                }
            }));
            utils.forEach(directMergeKeys, (function merge(prop) {
                if (prop in config2) {
                    config[prop] = getMergedValue(config1[prop], config2[prop]);
                } else if (prop in config1) {
                    config[prop] = getMergedValue(undefined, config1[prop]);
                }
            }));
            var axiosKeys = valueFromConfig2Keys.concat(mergeDeepPropertiesKeys).concat(defaultToConfig2Keys).concat(directMergeKeys);
            var otherKeys = Object.keys(config1).concat(Object.keys(config2)).filter((function filterAxiosKeys(key) {
                return axiosKeys.indexOf(key) === -1;
            }));
            utils.forEach(otherKeys, mergeDeepProperties);
            return config;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var pkg = __webpack_require__(170);
        var validators = {};
        [ "object", "boolean", "number", "function", "string", "symbol" ].forEach((function(type, i) {
            validators[type] = function validator(thing) {
                return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
            };
        }));
        var deprecatedWarnings = {};
        var currentVerArr = pkg.version.split(".");
        function isOlderVersion(version, thanVersion) {
            var pkgVersionArr = thanVersion ? thanVersion.split(".") : currentVerArr;
            var destVer = version.split(".");
            for (var i = 0; i < 3; i++) {
                if (pkgVersionArr[i] > destVer[i]) {
                    return true;
                } else if (pkgVersionArr[i] < destVer[i]) {
                    return false;
                }
            }
            return false;
        }
        validators.transitional = function transitional(validator, version, message) {
            var isDeprecated = version && isOlderVersion(version);
            function formatMessage(opt, desc) {
                return "[Axios v" + pkg.version + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
            }
            return function(value, opt, opts) {
                if (validator === false) {
                    throw new Error(formatMessage(opt, " has been removed in " + version));
                }
                if (isDeprecated && !deprecatedWarnings[opt]) {
                    deprecatedWarnings[opt] = true;
                    console.warn(formatMessage(opt, " has been deprecated since v" + version + " and will be removed in the near future"));
                }
                return validator ? validator(value, opt, opts) : true;
            };
        };
        function assertOptions(options, schema, allowUnknown) {
            if (typeof options !== "object") {
                throw new TypeError("options must be an object");
            }
            var keys = Object.keys(options);
            var i = keys.length;
            while (i-- > 0) {
                var opt = keys[i];
                var validator = schema[opt];
                if (validator) {
                    var value = options[opt];
                    var result = value === undefined || validator(value, opt, options);
                    if (result !== true) {
                        throw new TypeError("option " + opt + " must be " + result);
                    }
                    continue;
                }
                if (allowUnknown !== true) {
                    throw Error("Unknown option " + opt);
                }
            }
        }
        module.exports = {
            isOlderVersion,
            assertOptions,
            validators
        };
    }, module => {
        "use strict";
        function Cancel(message) {
            this.message = message;
        }
        Cancel.prototype.toString = function toString() {
            return "Cancel" + (this.message ? ": " + this.message : "");
        };
        Cancel.prototype.__CANCEL__ = true;
        module.exports = Cancel;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var Cancel = __webpack_require__(174);
        function CancelToken(executor) {
            if (typeof executor !== "function") {
                throw new TypeError("executor must be a function.");
            }
            var resolvePromise;
            this.promise = new Promise((function promiseExecutor(resolve) {
                resolvePromise = resolve;
            }));
            var token = this;
            executor((function cancel(message) {
                if (token.reason) {
                    return;
                }
                token.reason = new Cancel(message);
                resolvePromise(token.reason);
            }));
        }
        CancelToken.prototype.throwIfRequested = function throwIfRequested() {
            if (this.reason) {
                throw this.reason;
            }
        };
        CancelToken.source = function source() {
            var cancel;
            var token = new CancelToken((function executor(c) {
                cancel = c;
            }));
            return {
                token,
                cancel
            };
        };
        module.exports = CancelToken;
    }, module => {
        "use strict";
        module.exports = function spread(callback) {
            return function wrap(arr) {
                return callback.apply(null, arr);
            };
        };
    }, module => {
        "use strict";
        module.exports = function isAxiosError(payload) {
            return typeof payload === "object" && payload.isAxiosError === true;
        };
    }, module => {
        "use strict";
        module.exports = require("querystring");
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.MultiDestination = exports.MultiDestinationVerifier = exports.MultiDestinationError = void 0;
        const events_1 = __webpack_require__(41);
        const stream_1 = __webpack_require__(17);
        const constants_1 = __webpack_require__(18);
        const errors_1 = __webpack_require__(19);
        const utils_1 = __webpack_require__(21);
        const block_device_1 = __webpack_require__(3);
        const source_destination_1 = __webpack_require__(54);
        function isntNull(x) {
            return x !== null;
        }
        class MultiDestinationError extends Error {
            constructor(error, destination) {
                super();
                this.error = error;
                this.destination = destination;
            }
        }
        exports.MultiDestinationError = MultiDestinationError;
        class MultiDestinationVerifier extends source_destination_1.Verifier {
            constructor(source, checksumOrBlocks, size) {
                super();
                this.verifiers = new Set;
                for (const dest of source.activeDestinations) {
                    const verifier = dest.createVerifier(checksumOrBlocks, size);
                    verifier.on("error", (error => {
                        this.oneVerifierFinished(verifier);
                        source.destinationError(dest, error, this);
                    }));
                    verifier.on("finish", (() => {
                        this.oneVerifierFinished(verifier);
                    }));
                    this.verifiers.add(verifier);
                }
            }
            oneVerifierFinished(verifier) {
                if (!this.verifiers.has(verifier)) {
                    return;
                }
                if (this.verifiers.size === 1) {
                    clearInterval(this.timer);
                    this.emitProgress();
                    this.emit("finish");
                }
                this.verifiers.delete(verifier);
            }
            emitProgress() {
                const verifier = (0, utils_1.minBy)(this.verifiers, (v => v.progress.bytes));
                if (verifier !== undefined) {
                    this.emit("progress", verifier.progress);
                }
            }
            async run() {
                if (this.verifiers.size === 0) {
                    this.emit("finish");
                    return;
                }
                this.timer = setInterval(this.emitProgress.bind(this), constants_1.PROGRESS_EMISSION_INTERVAL);
                for (const verifier of this.verifiers) {
                    verifier.run();
                }
            }
        }
        exports.MultiDestinationVerifier = MultiDestinationVerifier;
        class MultiDestination extends source_destination_1.SourceDestination {
            constructor(destinations) {
                super();
                this.destinations = new Set;
                this.erroredDestinations = new Set;
                if (destinations.length === 0) {
                    throw new Error("At least one destination is required");
                }
                for (const destination of destinations) {
                    this.destinations.add(destination);
                }
            }
            getAlignment() {
                let max;
                for (const destination of this.destinations.values()) {
                    if (destination instanceof block_device_1.BlockDevice && (max === undefined || destination.alignment > max)) {
                        max = destination.alignment;
                    }
                }
                return max;
            }
            destinationError(destination, error, stream) {
                if (!(error instanceof errors_1.VerificationError)) {
                    this.erroredDestinations.add(destination);
                }
                error = new MultiDestinationError(error, destination);
                if (stream !== undefined) {
                    stream.emit("fail", error);
                } else {
                    this.emit("fail", error);
                }
            }
            get activeDestinations() {
                return (0, utils_1.difference)(this.destinations, this.erroredDestinations);
            }
            async can(methodName) {
                return (0, utils_1.every)(await Promise.all(Array.from(this.activeDestinations).map((destination => destination[methodName]()))));
            }
            canRead() {
                return this.can("canRead");
            }
            canWrite() {
                return this.can("canWrite");
            }
            canCreateReadStream() {
                return this.can("canCreateReadStream");
            }
            canCreateSparseReadStream() {
                return this.can("canCreateSparseReadStream");
            }
            canCreateWriteStream() {
                return this.can("canCreateWriteStream");
            }
            canCreateSparseWriteStream() {
                return this.can("canCreateSparseWriteStream");
            }
            read(buffer, bufferOffset, length, sourceOffset) {
                return Array.from(this.activeDestinations)[0].read(buffer, bufferOffset, length, sourceOffset);
            }
            async write(buffer, bufferOffset, length, fileOffset) {
                const results = await Promise.all(Array.from(this.activeDestinations).map((destination => destination.write(buffer, bufferOffset, length, fileOffset))));
                return results[0];
            }
            createReadStream(options) {
                return Array.from(this.activeDestinations)[0].createReadStream(options);
            }
            createSparseReadStream(options) {
                return Array.from(this.activeDestinations)[0].createSparseReadStream(options);
            }
            async createStream(methodName, ...args) {
                const passthrough = new stream_1.PassThrough({
                    objectMode: methodName === "createSparseWriteStream"
                });
                const listeners = this.activeDestinations.size + 1;
                if (listeners > events_1.EventEmitter.defaultMaxListeners) {
                    passthrough.setMaxListeners(listeners);
                }
                const progresses = new Map;
                let interval;
                function oneStreamFinished(stream) {
                    if (!progresses.has(stream)) {
                        return;
                    }
                    if (progresses.size === 1) {
                        clearInterval(interval);
                        emitProgress();
                        passthrough.emit("done");
                    }
                    progresses.delete(stream);
                }
                function emitProgress() {
                    const leastAdvancedProgress = (0, utils_1.minBy)(Array.from(progresses.values()).filter(isntNull), (p => p.position));
                    if (leastAdvancedProgress !== undefined) {
                        passthrough.emit("progress", leastAdvancedProgress);
                    }
                }
                await Promise.all(Array.from(this.activeDestinations).map((async destination => {
                    const stream = await destination[methodName](...args);
                    progresses.set(stream, null);
                    stream.on("progress", (progressEvent => {
                        progresses.set(stream, progressEvent);
                        if (interval === undefined) {
                            interval = setInterval(emitProgress, constants_1.PROGRESS_EMISSION_INTERVAL);
                        }
                    }));
                    stream.on("error", (error => {
                        this.destinationError(destination, error, passthrough);
                        oneStreamFinished(stream);
                    }));
                    stream.on("finish", oneStreamFinished.bind(null, stream));
                    passthrough.pipe(stream);
                })));
                passthrough.on("pipe", (() => {
                    if (this.activeDestinations.size === 0) {
                        passthrough.emit("done");
                    }
                }));
                return passthrough;
            }
            createWriteStream(...args) {
                return this.createStream("createWriteStream", ...args);
            }
            createSparseWriteStream(...args) {
                return this.createStream("createSparseWriteStream", ...args);
            }
            createVerifier(checksumOrBlocks, size) {
                return new MultiDestinationVerifier(this, checksumOrBlocks, size);
            }
            async _open() {
                await Promise.all(Array.from(this.destinations).map((async destination => {
                    try {
                        await destination.open();
                    } catch (error) {
                        this.destinationError(destination, error);
                    }
                })));
            }
            async _close() {
                await Promise.all(Array.from(this.destinations).map((async destination => {
                    try {
                        await destination.close();
                    } catch (error) {
                        this.destinationError(destination, error);
                    }
                })));
            }
        }
        exports.MultiDestination = MultiDestination;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BalenaS3Source = exports.BalenaS3SourceBase = void 0;
        const aws4_axios_1 = __webpack_require__(182);
        const axios_1 = __webpack_require__(146);
        const http_1 = __webpack_require__(145);
        const source_destination_1 = __webpack_require__(54);
        const zip_1 = __webpack_require__(187);
        const ESR_IMAGES_PREFIX = "esr-images";
        const IMAGES_PREFIX = "images";
        const PRELOADED_IMAGES_PREFIX = "preloaded-images";
        class BalenaS3SourceBase extends source_destination_1.SourceDestination {
            constructor({host, bucket, prefix, deviceType, buildId, release, awsCredentials}) {
                super();
                this.host = host;
                this.bucket = bucket;
                if (prefix !== undefined) {
                    this.prefix = prefix;
                } else if (release !== undefined) {
                    this.prefix = PRELOADED_IMAGES_PREFIX;
                } else if (BalenaS3SourceBase.isESRVersion(buildId)) {
                    this.prefix = ESR_IMAGES_PREFIX;
                } else {
                    this.prefix = IMAGES_PREFIX;
                }
                this.deviceType = deviceType;
                this.buildId = buildId;
                this.release = release;
                this.axiosInstance = axios_1.default.create();
                if (awsCredentials !== undefined) {
                    this.axiosInstance.interceptors.request.use((0, aws4_axios_1.aws4Interceptor)({
                        service: "s3"
                    }, awsCredentials));
                }
            }
            async canCreateReadStream() {
                return true;
            }
            static isESRVersion(buildId) {
                return /^\d{4}\.\d{2}\.\d+\.(dev|prod)$/.test(buildId);
            }
            isESR() {
                return BalenaS3SourceBase.isESRVersion(this.buildId);
            }
            async download(path, responseType) {
                return await this.axiosInstance.get(this.getUrl(path), {
                    responseType
                });
            }
            getUrl(path) {
                let prefix = this.prefix;
                let release = this.release;
                if (release !== undefined && BalenaS3SourceBase.filesMissingFromPreloadedImages.includes(path)) {
                    release = undefined;
                    prefix = this.isESR() ? ESR_IMAGES_PREFIX : IMAGES_PREFIX;
                }
                return [ this.host, this.bucket, prefix, this.deviceType, encodeURIComponent(this.buildId), release, path ].filter((x => x !== undefined)).join("/");
            }
        }
        exports.BalenaS3SourceBase = BalenaS3SourceBase;
        BalenaS3SourceBase.filesMissingFromPreloadedImages = [ "VERSION", "VERSION_HOSTOS", "device-type.json" ];
        class BalenaS3Source extends BalenaS3SourceBase {
            constructor() {
                super(...arguments);
                this.names = [ "balena", "resin" ];
            }
            async getName() {
                for (const name of this.names) {
                    try {
                        await this.axiosInstance({
                            method: "head",
                            url: this.getUrl(`image/${name}.img`)
                        });
                        return name;
                    } catch (error) {
                        if (error.response.status !== 404) {
                            throw error;
                        }
                    }
                }
                throw new Error("Could not find image");
            }
            async canRead() {
                return true;
            }
            async read(buffer, bufferOffset, length, sourceOffset) {
                return await this.rawSource.read(buffer, bufferOffset, length, sourceOffset);
            }
            async createReadStream(options = {}) {
                return await this.zipSource.createReadStream(options);
            }
            async _getMetadata() {
                return await this.zipSource.getMetadata();
            }
            async _open() {
                this.name = await this.getName();
                this.rawSource = new http_1.Http({
                    url: this.getUrl(`image/${this.name}.img`),
                    axiosInstance: this.axiosInstance
                });
                this.zipSource = new zip_1.ZipSource(new http_1.Http({
                    url: this.getUrl(`image/${this.name}.img.zip`),
                    avoidRandomAccess: true,
                    axiosInstance: this.axiosInstance
                }));
                await Promise.all([ this.rawSource.open(), await this.zipSource.open() ]);
            }
            async _close() {
                await Promise.all([ this.zipSource.close(), await this.rawSource.close() ]);
            }
        }
        exports.BalenaS3Source = BalenaS3Source;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.aws4Interceptor = exports.getAuthErrorMessage = exports.interceptor = void 0;
        var interceptor_1 = __webpack_require__(183);
        Object.defineProperty(exports, "aws4Interceptor", {
            enumerable: true,
            get: function() {
                return interceptor_1.aws4Interceptor;
            }
        });
        var getAuthErrorMessage_1 = __webpack_require__(186);
        Object.defineProperty(exports, "getAuthErrorMessage", {
            enumerable: true,
            get: function() {
                return getAuthErrorMessage_1.getAuthErrorMessage;
            }
        });
        exports.interceptor = interceptor_1.aws4Interceptor;
        exports.default = interceptor_1.aws4Interceptor;
    }, function(__unused_webpack_module, exports, __webpack_require__) {
        "use strict";
        var __assign = this && this.__assign || function() {
            __assign = Object.assign || function(t) {
                for (var s, i = 1, n = arguments.length; i < n; i++) {
                    s = arguments[i];
                    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
                }
                return t;
            };
            return __assign.apply(this, arguments);
        };
        var __rest = this && this.__rest || function(s, e) {
            var t = {};
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
            if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
            }
            return t;
        };
        var __importDefault = this && this.__importDefault || function(mod) {
            return mod && mod.__esModule ? mod : {
                default: mod
            };
        };
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.aws4Interceptor = void 0;
        var aws4_1 = __webpack_require__(184);
        var buildURL_1 = __importDefault(__webpack_require__(151));
        var combineURLs_1 = __importDefault(__webpack_require__(163));
        var isAbsoluteURL_1 = __importDefault(__webpack_require__(162));
        exports.aws4Interceptor = function(options, credentials) {
            return function(config) {
                if (!config.url) {
                    throw new Error("No URL present in request config, unable to sign request");
                }
                if (config.params) {
                    config.url = buildURL_1.default(config.url, config.params, config.paramsSerializer);
                    delete config.params;
                }
                var url = config.url;
                if (config.baseURL && !isAbsoluteURL_1.default(config.url)) {
                    url = combineURLs_1.default(config.baseURL, config.url);
                }
                var _a = new URL(url), host = _a.host, pathname = _a.pathname, search = _a.search;
                var data = config.data, headers = config.headers, method = config.method;
                var region;
                var service;
                var signQuery;
                if (options) {
                    region = options.region, service = options.service;
                }
                var transformRequest = getTransformer(config);
                var transformedData = transformRequest(data, headers);
                var common = headers.common, _delete = headers.delete, get = headers.get, head = headers.head, post = headers.post, put = headers.put, patch = headers.patch, headersToSign = __rest(headers, [ "common", "delete", "get", "head", "post", "put", "patch" ]);
                var signingOptions = __assign(__assign({
                    method: method && method.toUpperCase(),
                    host,
                    path: pathname + search,
                    region,
                    service
                }, signQuery !== undefined ? {
                    signQuery
                } : {}), {
                    body: transformedData,
                    headers: headersToSign
                });
                aws4_1.sign(signingOptions, credentials);
                config.headers = signingOptions.headers;
                return config;
            };
        };
        var getTransformer = function(config) {
            var transformRequest = config.transformRequest;
            if (transformRequest) {
                if (typeof transformRequest === "function") {
                    return transformRequest;
                } else if (transformRequest.length) {
                    return transformRequest[0];
                }
            }
            throw new Error("Could not get default transformRequest function from Axios defaults");
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var aws4 = exports, url = __webpack_require__(167), querystring = __webpack_require__(178), crypto = __webpack_require__(35), lru = __webpack_require__(185), credentialsCache = lru(1e3);
        function hmac(key, string, encoding) {
            return crypto.createHmac("sha256", key).update(string, "utf8").digest(encoding);
        }
        function hash(string, encoding) {
            return crypto.createHash("sha256").update(string, "utf8").digest(encoding);
        }
        function encodeRfc3986(urlEncodedString) {
            return urlEncodedString.replace(/[!'()*]/g, (function(c) {
                return "%" + c.charCodeAt(0).toString(16).toUpperCase();
            }));
        }
        function encodeRfc3986Full(str) {
            return encodeRfc3986(encodeURIComponent(str));
        }
        var HEADERS_TO_IGNORE = {
            authorization: true,
            connection: true,
            "x-amzn-trace-id": true,
            "user-agent": true,
            expect: true,
            "presigned-expires": true,
            range: true
        };
        function RequestSigner(request, credentials) {
            if (typeof request === "string") request = url.parse(request);
            var headers = request.headers = request.headers || {}, hostParts = (!this.service || !this.region) && this.matchHost(request.hostname || request.host || headers.Host || headers.host);
            this.request = request;
            this.credentials = credentials || this.defaultCredentials();
            this.service = request.service || hostParts[0] || "";
            this.region = request.region || hostParts[1] || "us-east-1";
            if (this.service === "email") this.service = "ses";
            if (!request.method && request.body) request.method = "POST";
            if (!headers.Host && !headers.host) {
                headers.Host = request.hostname || request.host || this.createHost();
                if (request.port) headers.Host += ":" + request.port;
            }
            if (!request.hostname && !request.host) request.hostname = headers.Host || headers.host;
            this.isCodeCommitGit = this.service === "codecommit" && request.method === "GIT";
        }
        RequestSigner.prototype.matchHost = function(host) {
            var match = (host || "").match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(\.cn)?$/);
            var hostParts = (match || []).slice(1, 3);
            if (hostParts[1] === "es") hostParts = hostParts.reverse();
            if (hostParts[1] == "s3") {
                hostParts[0] = "s3";
                hostParts[1] = "us-east-1";
            } else {
                for (var i = 0; i < 2; i++) {
                    if (/^s3-/.test(hostParts[i])) {
                        hostParts[1] = hostParts[i].slice(3);
                        hostParts[0] = "s3";
                        break;
                    }
                }
            }
            return hostParts;
        };
        RequestSigner.prototype.isSingleRegion = function() {
            if ([ "s3", "sdb" ].indexOf(this.service) >= 0 && this.region === "us-east-1") return true;
            return [ "cloudfront", "ls", "route53", "iam", "importexport", "sts" ].indexOf(this.service) >= 0;
        };
        RequestSigner.prototype.createHost = function() {
            var region = this.isSingleRegion() ? "" : "." + this.region, subdomain = this.service === "ses" ? "email" : this.service;
            return subdomain + region + ".amazonaws.com";
        };
        RequestSigner.prototype.prepareRequest = function() {
            this.parsePath();
            var request = this.request, headers = request.headers, query;
            if (request.signQuery) {
                this.parsedPath.query = query = this.parsedPath.query || {};
                if (this.credentials.sessionToken) query["X-Amz-Security-Token"] = this.credentials.sessionToken;
                if (this.service === "s3" && !query["X-Amz-Expires"]) query["X-Amz-Expires"] = 86400;
                if (query["X-Amz-Date"]) this.datetime = query["X-Amz-Date"]; else query["X-Amz-Date"] = this.getDateTime();
                query["X-Amz-Algorithm"] = "AWS4-HMAC-SHA256";
                query["X-Amz-Credential"] = this.credentials.accessKeyId + "/" + this.credentialString();
                query["X-Amz-SignedHeaders"] = this.signedHeaders();
            } else {
                if (!request.doNotModifyHeaders && !this.isCodeCommitGit) {
                    if (request.body && !headers["Content-Type"] && !headers["content-type"]) headers["Content-Type"] = "application/x-www-form-urlencoded; charset=utf-8";
                    if (request.body && !headers["Content-Length"] && !headers["content-length"]) headers["Content-Length"] = Buffer.byteLength(request.body);
                    if (this.credentials.sessionToken && !headers["X-Amz-Security-Token"] && !headers["x-amz-security-token"]) headers["X-Amz-Security-Token"] = this.credentials.sessionToken;
                    if (this.service === "s3" && !headers["X-Amz-Content-Sha256"] && !headers["x-amz-content-sha256"]) headers["X-Amz-Content-Sha256"] = hash(this.request.body || "", "hex");
                    if (headers["X-Amz-Date"] || headers["x-amz-date"]) this.datetime = headers["X-Amz-Date"] || headers["x-amz-date"]; else headers["X-Amz-Date"] = this.getDateTime();
                }
                delete headers.Authorization;
                delete headers.authorization;
            }
        };
        RequestSigner.prototype.sign = function() {
            if (!this.parsedPath) this.prepareRequest();
            if (this.request.signQuery) {
                this.parsedPath.query["X-Amz-Signature"] = this.signature();
            } else {
                this.request.headers.Authorization = this.authHeader();
            }
            this.request.path = this.formatPath();
            return this.request;
        };
        RequestSigner.prototype.getDateTime = function() {
            if (!this.datetime) {
                var headers = this.request.headers, date = new Date(headers.Date || headers.date || new Date);
                this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, "");
                if (this.isCodeCommitGit) this.datetime = this.datetime.slice(0, -1);
            }
            return this.datetime;
        };
        RequestSigner.prototype.getDate = function() {
            return this.getDateTime().substr(0, 8);
        };
        RequestSigner.prototype.authHeader = function() {
            return [ "AWS4-HMAC-SHA256 Credential=" + this.credentials.accessKeyId + "/" + this.credentialString(), "SignedHeaders=" + this.signedHeaders(), "Signature=" + this.signature() ].join(", ");
        };
        RequestSigner.prototype.signature = function() {
            var date = this.getDate(), cacheKey = [ this.credentials.secretAccessKey, date, this.region, this.service ].join(), kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey);
            if (!kCredentials) {
                kDate = hmac("AWS4" + this.credentials.secretAccessKey, date);
                kRegion = hmac(kDate, this.region);
                kService = hmac(kRegion, this.service);
                kCredentials = hmac(kService, "aws4_request");
                credentialsCache.set(cacheKey, kCredentials);
            }
            return hmac(kCredentials, this.stringToSign(), "hex");
        };
        RequestSigner.prototype.stringToSign = function() {
            return [ "AWS4-HMAC-SHA256", this.getDateTime(), this.credentialString(), hash(this.canonicalString(), "hex") ].join("\n");
        };
        RequestSigner.prototype.canonicalString = function() {
            if (!this.parsedPath) this.prepareRequest();
            var pathStr = this.parsedPath.path, query = this.parsedPath.query, headers = this.request.headers, queryStr = "", normalizePath = this.service !== "s3", decodePath = this.service === "s3" || this.request.doNotEncodePath, decodeSlashesInPath = this.service === "s3", firstValOnly = this.service === "s3", bodyHash;
            if (this.service === "s3" && this.request.signQuery) {
                bodyHash = "UNSIGNED-PAYLOAD";
            } else if (this.isCodeCommitGit) {
                bodyHash = "";
            } else {
                bodyHash = headers["X-Amz-Content-Sha256"] || headers["x-amz-content-sha256"] || hash(this.request.body || "", "hex");
            }
            if (query) {
                var reducedQuery = Object.keys(query).reduce((function(obj, key) {
                    if (!key) return obj;
                    obj[encodeRfc3986Full(key)] = !Array.isArray(query[key]) ? query[key] : firstValOnly ? query[key][0] : query[key];
                    return obj;
                }), {});
                var encodedQueryPieces = [];
                Object.keys(reducedQuery).sort().forEach((function(key) {
                    if (!Array.isArray(reducedQuery[key])) {
                        encodedQueryPieces.push(key + "=" + encodeRfc3986Full(reducedQuery[key]));
                    } else {
                        reducedQuery[key].map(encodeRfc3986Full).sort().forEach((function(val) {
                            encodedQueryPieces.push(key + "=" + val);
                        }));
                    }
                }));
                queryStr = encodedQueryPieces.join("&");
            }
            if (pathStr !== "/") {
                if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, "/");
                pathStr = pathStr.split("/").reduce((function(path, piece) {
                    if (normalizePath && piece === "..") {
                        path.pop();
                    } else if (!normalizePath || piece !== ".") {
                        if (decodePath) piece = decodeURIComponent(piece.replace(/\+/g, " "));
                        path.push(encodeRfc3986Full(piece));
                    }
                    return path;
                }), []).join("/");
                if (pathStr[0] !== "/") pathStr = "/" + pathStr;
                if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, "/");
            }
            return [ this.request.method || "GET", pathStr, queryStr, this.canonicalHeaders() + "\n", this.signedHeaders(), bodyHash ].join("\n");
        };
        RequestSigner.prototype.canonicalHeaders = function() {
            var headers = this.request.headers;
            function trimAll(header) {
                return header.toString().trim().replace(/\s+/g, " ");
            }
            return Object.keys(headers).filter((function(key) {
                return HEADERS_TO_IGNORE[key.toLowerCase()] == null;
            })).sort((function(a, b) {
                return a.toLowerCase() < b.toLowerCase() ? -1 : 1;
            })).map((function(key) {
                return key.toLowerCase() + ":" + trimAll(headers[key]);
            })).join("\n");
        };
        RequestSigner.prototype.signedHeaders = function() {
            return Object.keys(this.request.headers).map((function(key) {
                return key.toLowerCase();
            })).filter((function(key) {
                return HEADERS_TO_IGNORE[key] == null;
            })).sort().join(";");
        };
        RequestSigner.prototype.credentialString = function() {
            return [ this.getDate(), this.region, this.service, "aws4_request" ].join("/");
        };
        RequestSigner.prototype.defaultCredentials = function() {
            var env = process.env;
            return {
                accessKeyId: env.AWS_ACCESS_KEY_ID || env.AWS_ACCESS_KEY,
                secretAccessKey: env.AWS_SECRET_ACCESS_KEY || env.AWS_SECRET_KEY,
                sessionToken: env.AWS_SESSION_TOKEN
            };
        };
        RequestSigner.prototype.parsePath = function() {
            var path = this.request.path || "/";
            if (/[^0-9A-Za-z;,/?:@&=+$\-_.!~*'()#%]/.test(path)) {
                path = encodeURI(decodeURI(path));
            }
            var queryIx = path.indexOf("?"), query = null;
            if (queryIx >= 0) {
                query = querystring.parse(path.slice(queryIx + 1));
                path = path.slice(0, queryIx);
            }
            this.parsedPath = {
                path,
                query
            };
        };
        RequestSigner.prototype.formatPath = function() {
            var path = this.parsedPath.path, query = this.parsedPath.query;
            if (!query) return path;
            if (query[""] != null) delete query[""];
            return path + "?" + encodeRfc3986(querystring.stringify(query));
        };
        aws4.RequestSigner = RequestSigner;
        aws4.sign = function(request, credentials) {
            return new RequestSigner(request, credentials).sign();
        };
    }, module => {
        module.exports = function(size) {
            return new LruCache(size);
        };
        function LruCache(size) {
            this.capacity = size | 0;
            this.map = Object.create(null);
            this.list = new DoublyLinkedList;
        }
        LruCache.prototype.get = function(key) {
            var node = this.map[key];
            if (node == null) return undefined;
            this.used(node);
            return node.val;
        };
        LruCache.prototype.set = function(key, val) {
            var node = this.map[key];
            if (node != null) {
                node.val = val;
            } else {
                if (!this.capacity) this.prune();
                if (!this.capacity) return false;
                node = new DoublyLinkedNode(key, val);
                this.map[key] = node;
                this.capacity--;
            }
            this.used(node);
            return true;
        };
        LruCache.prototype.used = function(node) {
            this.list.moveToFront(node);
        };
        LruCache.prototype.prune = function() {
            var node = this.list.pop();
            if (node != null) {
                delete this.map[node.key];
                this.capacity++;
            }
        };
        function DoublyLinkedList() {
            this.firstNode = null;
            this.lastNode = null;
        }
        DoublyLinkedList.prototype.moveToFront = function(node) {
            if (this.firstNode == node) return;
            this.remove(node);
            if (this.firstNode == null) {
                this.firstNode = node;
                this.lastNode = node;
                node.prev = null;
                node.next = null;
            } else {
                node.prev = null;
                node.next = this.firstNode;
                node.next.prev = node;
                this.firstNode = node;
            }
        };
        DoublyLinkedList.prototype.pop = function() {
            var lastNode = this.lastNode;
            if (lastNode != null) {
                this.remove(lastNode);
            }
            return lastNode;
        };
        DoublyLinkedList.prototype.remove = function(node) {
            if (this.firstNode == node) {
                this.firstNode = node.next;
            } else if (node.prev != null) {
                node.prev.next = node.next;
            }
            if (this.lastNode == node) {
                this.lastNode = node.prev;
            } else if (node.next != null) {
                node.next.prev = node.prev;
            }
        };
        function DoublyLinkedNode(key, val) {
            this.key = key;
            this.val = val;
            this.prev = null;
            this.next = null;
        }
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.getAuthErrorMessage = void 0;
        exports.getAuthErrorMessage = function(error) {
            var data = error.response && error.response.data;
            if (data) {
                return data.message;
            }
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ZipSource = exports.RandomAccessZipSource = exports.StreamZipSource = exports.matchSupportedExtensions = void 0;
        const blockmap_1 = __webpack_require__(188);
        const path_1 = __webpack_require__(34);
        const stream_1 = __webpack_require__(17);
        const yauzl_1 = __webpack_require__(204);
        const constants_1 = __webpack_require__(18);
        const zip_1 = __webpack_require__(208);
        const source_destination_1 = __webpack_require__(54);
        const source_source_1 = __webpack_require__(90);
        const block_transform_stream_1 = __webpack_require__(141);
        const errors_1 = __webpack_require__(19);
        const shared_1 = __webpack_require__(80);
        const sparse_filter_stream_1 = __webpack_require__(79);
        const stream_limiter_1 = __webpack_require__(88);
        const utils_1 = __webpack_require__(21);
        function blockmapToBlocks(blockmap) {
            return blockmap.ranges.map((range => {
                const offset = range.start * blockmap.blockSize;
                const length = (range.end - range.start + 1) * blockmap.blockSize;
                const checksum = range.checksum;
                const checksumType = blockmap.checksumType === "sha1" || blockmap.checksumType === "sha256" ? blockmap.checksumType : undefined;
                return {
                    checksum,
                    checksumType,
                    blocks: [ {
                        offset,
                        length
                    } ]
                };
            }));
        }
        function matchSupportedExtensions(filename) {
            const extension = path_1.posix.extname(filename);
            return extension.length > 1 && source_destination_1.SourceDestination.imageExtensions.includes(extension.slice(1));
        }
        exports.matchSupportedExtensions = matchSupportedExtensions;
        class StreamZipSource extends source_source_1.SourceSource {
            constructor(source, match = matchSupportedExtensions) {
                super(source);
                this.match = match;
            }
            async canCreateReadStream() {
                return true;
            }
            async getEntry() {
                if (this.entry === undefined) {
                    const entry = await (0, zip_1.getFileStreamFromZipStream)(await this.source.createReadStream(), this.match);
                    this.entry = entry;
                    const onData = () => {
                        entry.removeListener("data", onData);
                        this.entry = undefined;
                    };
                    entry.on("data", onData);
                    entry.pause();
                }
                return this.entry;
            }
            async createReadStream({start = 0, end} = {}) {
                if (start !== 0) {
                    throw new errors_1.NotCapable;
                }
                const stream = await this.getEntry();
                if (end !== undefined) {
                    const transform = new stream_limiter_1.StreamLimiter(stream, end + 1);
                    return transform;
                }
                return stream;
            }
            async _getMetadata() {
                const entry = await this.getEntry();
                return {
                    size: entry.size,
                    compressedSize: entry.compressedSize,
                    name: path_1.posix.basename(entry.path)
                };
            }
        }
        exports.StreamZipSource = StreamZipSource;
        class SourceRandomAccessReader extends yauzl_1.RandomAccessReader {
            constructor(source) {
                super();
                this.source = source;
            }
            _readStreamForRange(start, end) {
                const passthrough = new stream_1.PassThrough;
                this.source.createReadStream({
                    start,
                    end: end - 1
                }).then((stream => {
                    stream.on("error", passthrough.emit.bind(passthrough, "error"));
                    stream.pipe(passthrough);
                })).catch(passthrough.emit.bind(passthrough, "error"));
                return passthrough;
            }
        }
        class RandomAccessZipSource extends source_source_1.SourceSource {
            constructor(source, match = matchSupportedExtensions) {
                super(source);
                this.match = match;
                this.entries = [];
                this.ready = this.init();
            }
            async init() {
                await this.source.open();
                const sourceMetadata = await this.source.getMetadata();
                const reader = new SourceRandomAccessReader(this.source);
                this.zip = await (0, utils_1.fromCallback)((callback => {
                    if (sourceMetadata.size === undefined) {
                        throw new errors_1.NotCapable;
                    }
                    (0, yauzl_1.fromRandomAccessReader)(reader, sourceMetadata.size, {
                        autoClose: false
                    }, callback);
                }));
                this.zip.on("entry", (entry => {
                    this.entries.push(entry);
                }));
                await new Promise(((resolve, reject) => {
                    this.zip.on("end", resolve);
                    this.zip.on("error", reject);
                }));
            }
            async canCreateReadStream() {
                return true;
            }
            async canCreateSparseReadStream() {
                const metadata = await this.getMetadata();
                return metadata.blockMap !== undefined;
            }
            async getEntries() {
                await this.ready;
                return this.entries;
            }
            async getImageEntry() {
                const entries = (await this.getEntries()).filter((e => this.match(e.fileName)));
                const entry = (0, utils_1.maxBy)(entries, (e => e.uncompressedSize));
                if (entry === undefined) {
                    throw new Error(constants_1.NO_MATCHING_FILE_MSG);
                }
                if (entry.compressionMethod !== 0 && entry.compressionMethod !== 8) {
                    throw new Error(`unsupported compression method: ${entry.compressionMethod}`);
                }
                return entry;
            }
            async _open() {
                await this.ready;
                await this.getImageEntry();
            }
            async getEntryByName(name) {
                const entries = await this.getEntries();
                for (const entry of entries) {
                    if (entry.fileName === name) {
                        return entry;
                    }
                }
            }
            async getStream(name) {
                const entry = await this.getEntryByName(name);
                if (entry !== undefined) {
                    return await (0, utils_1.fromCallback)((callback => {
                        this.zip.openReadStream(entry, callback);
                    }));
                }
            }
            async getString(name) {
                const stream = await this.getStream(name);
                if (stream !== undefined) {
                    const buffer = await (0, utils_1.streamToBuffer)(stream);
                    return buffer.toString();
                }
            }
            async getJson(name) {
                const data = await this.getString(name);
                if (data !== undefined) {
                    return JSON.parse(data);
                }
            }
            async createReadStream({start = 0, end, alignment, numBuffers}) {
                if (start !== 0) {
                    throw new errors_1.NotCapable;
                }
                const entry = await this.getImageEntry();
                const stream = await this.getStream(entry.fileName);
                if (stream === undefined) {
                    throw new errors_1.NotCapable;
                }
                if (end !== undefined) {
                    const transform = new stream_limiter_1.StreamLimiter(stream, end + 1);
                    return block_transform_stream_1.BlockTransformStream.alignIfNeeded(transform, alignment, numBuffers);
                }
                return block_transform_stream_1.BlockTransformStream.alignIfNeeded(stream, alignment, numBuffers);
            }
            async createSparseReadStream({generateChecksums = false, alignment, numBuffers} = {}) {
                const metadata = await this.getMetadata();
                if (metadata.blocks === undefined) {
                    throw new errors_1.NotCapable;
                }
                const transform = new sparse_filter_stream_1.SparseFilterStream({
                    blocks: metadata.blocks,
                    verify: !generateChecksums,
                    generateChecksums
                });
                const stream = await this.createReadStream({
                    alignment,
                    numBuffers
                });
                stream.pipe(transform);
                return transform;
            }
            async _getMetadata() {
                const entry = await this.getImageEntry();
                const result = {
                    size: entry.uncompressedSize,
                    compressedSize: entry.compressedSize
                };
                const prefix = path_1.posix.join(path_1.posix.dirname(entry.fileName), ".meta");
                result.logo = await this.getString(path_1.posix.join(prefix, "logo.svg"));
                result.instructions = await this.getString(path_1.posix.join(prefix, "instructions.markdown"));
                const blockMap = await this.getString(path_1.posix.join(prefix, "image.bmap"));
                if (blockMap !== undefined) {
                    result.blockMap = blockmap_1.BlockMap.parse(blockMap);
                    result.blocks = blockmapToBlocks(result.blockMap);
                    result.blockmappedSize = (0, shared_1.blocksLength)(result.blocks);
                }
                let manifest;
                try {
                    manifest = await this.getJson(path_1.posix.join(prefix, "manifest.json"));
                } catch (error) {
                    throw new Error("Invalid archive manifest.json");
                }
                let name;
                if (manifest !== undefined) {
                    name = manifest.name;
                    for (const key of RandomAccessZipSource.manifestFields) {
                        result[key] = manifest[key];
                    }
                }
                result.name = name || path_1.posix.basename(entry.fileName);
                if (result.logo || result.instructions || result.blockMap || manifest) {
                    result.isEtch = true;
                }
                return result;
            }
        }
        exports.RandomAccessZipSource = RandomAccessZipSource;
        RandomAccessZipSource.manifestFields = [ "bytesToZeroOutFromTheBeginning", "checksum", "checksumType", "recommendedDriveSize", "releaseNotesUrl", "supportUrl", "url", "version" ];
        class ZipSource extends source_source_1.SourceSource {
            constructor(source, preferStreamSource = false, match = matchSupportedExtensions) {
                super(source);
                this.preferStreamSource = preferStreamSource;
                this.match = match;
                this.ready = this.prepare();
            }
            async prepare() {
                if (!this.preferStreamSource && await this.source.canRead()) {
                    this.implementation = new RandomAccessZipSource(this.source, this.match);
                } else {
                    this.implementation = new StreamZipSource(this.source, this.match);
                }
            }
            async canCreateReadStream() {
                await this.ready;
                return await this.implementation.canCreateReadStream();
            }
            async open() {
                await this.ready;
                return await this.implementation.open();
            }
            async canCreateSparseReadStream() {
                await this.ready;
                return await this.implementation.canCreateSparseReadStream();
            }
            async createReadStream({emitProgress = false, start = 0, end, alignment, numBuffers} = {}) {
                await this.ready;
                const stream = await this.implementation.createReadStream({
                    emitProgress,
                    start,
                    end
                });
                return block_transform_stream_1.BlockTransformStream.alignIfNeeded(stream, alignment, numBuffers);
            }
            async createSparseReadStream({generateChecksums = false, alignment, numBuffers} = {}) {
                await this.ready;
                return await this.implementation.createSparseReadStream({
                    generateChecksums,
                    alignment,
                    numBuffers
                });
            }
            async _getMetadata() {
                await this.ready;
                const metadata = await this.implementation.getMetadata();
                return {
                    ...metadata,
                    isCompressed: true
                };
            }
        }
        exports.ZipSource = ZipSource;
        ZipSource.mimetype = "application/zip";
        source_destination_1.SourceDestination.register(ZipSource);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        const tslib_1 = __webpack_require__(2);
        tslib_1.__exportStar(__webpack_require__(189), exports);
        tslib_1.__exportStar(__webpack_require__(199), exports);
        tslib_1.__exportStar(__webpack_require__(200), exports);
        tslib_1.__exportStar(__webpack_require__(197), exports);
        tslib_1.__exportStar(__webpack_require__(198), exports);
        tslib_1.__exportStar(__webpack_require__(201), exports);
        tslib_1.__exportStar(__webpack_require__(202), exports);
        tslib_1.__exportStar(__webpack_require__(203), exports);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BlockMap = void 0;
        const crypto_1 = __webpack_require__(35);
        const xml_js_1 = __webpack_require__(190);
        const parse_1 = __webpack_require__(197);
        const range_1 = __webpack_require__(198);
        function xmlTag(tag, text) {
            return xml_js_1.js2xml({
                [tag]: {
                    _text: text
                }
            }, {
                compact: true
            });
        }
        class BlockMap {
            constructor(options = {}) {
                this.version = options.version || "2.0";
                this.imageSize = options.imageSize || 0;
                this.blockSize = options.blockSize || 4096;
                this.blocksCount = options.blocksCount || 0;
                this.mappedBlocksCount = options.mappedBlocksCount || 0;
                this.checksum = options.checksum;
                this.checksumType = options.checksumType || "sha256";
                this.ranges = (options.ranges || []).map(range_1.Range.from);
            }
            injectChecksum(bmap) {
                const checksum = this.checksum || "";
                const zerofill = xmlTag("BmapFileChecksum", checksum.replace(/./g, "0"));
                const value = bmap.replace(xmlTag("BmapFileChecksum", checksum), zerofill);
                const digest = crypto_1.createHash(this.checksumType).update(value).digest("hex");
                return value.replace(zerofill, xmlTag("BmapFileChecksum", digest));
            }
            static fromJSON(data) {
                const options = typeof data === "string" ? JSON.parse(data) : data;
                return new BlockMap(options);
            }
            toString() {
                const ranges2 = this.ranges.map((range => {
                    const blockRange = range.start !== range.end ? range.start + "-" + range.end : range.start;
                    return {
                        _attributes: {
                            chksum: range.checksum
                        },
                        _text: blockRange
                    };
                }));
                const data2 = {
                    _declaration: {
                        _attributes: {
                            version: "1.0",
                            encoding: "UTF-8"
                        }
                    },
                    bmap: {
                        _attributes: {
                            version: "2.0"
                        },
                        ImageSize: {
                            _text: this.imageSize
                        },
                        BlockSize: {
                            _text: this.blockSize
                        },
                        BlocksCount: {
                            _text: this.blocksCount
                        },
                        MappedBlocksCount: {
                            _text: this.mappedBlocksCount
                        },
                        ChecksumType: {
                            _text: this.checksumType
                        },
                        BmapFileChecksum: {
                            _text: this.checksum
                        },
                        BlockMap: {
                            Range: ranges2
                        }
                    }
                };
                const bmap2 = xml_js_1.js2xml(data2, {
                    compact: true,
                    spaces: 2
                }) + "\n";
                return this.injectChecksum(bmap2);
            }
            static parse(value, verify = true) {
                return new BlockMap(parse_1.parse(value, verify));
            }
        }
        exports.BlockMap = BlockMap;
        BlockMap.versions = [ "1.2", "1.3", "1.4", "2.0" ];
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var xml2js = __webpack_require__(191);
        var xml2json = __webpack_require__(194);
        var js2xml = __webpack_require__(195);
        var json2xml = __webpack_require__(196);
        module.exports = {
            xml2js,
            xml2json,
            js2xml,
            json2xml
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var sax = __webpack_require__(128);
        var expat = {
            on: function() {},
            parse: function() {}
        };
        var helper = __webpack_require__(192);
        var isArray = __webpack_require__(193).isArray;
        var options;
        var pureJsParser = true;
        var currentElement;
        function validateOptions(userOptions) {
            options = helper.copyOptions(userOptions);
            helper.ensureFlagExists("ignoreDeclaration", options);
            helper.ensureFlagExists("ignoreInstruction", options);
            helper.ensureFlagExists("ignoreAttributes", options);
            helper.ensureFlagExists("ignoreText", options);
            helper.ensureFlagExists("ignoreComment", options);
            helper.ensureFlagExists("ignoreCdata", options);
            helper.ensureFlagExists("ignoreDoctype", options);
            helper.ensureFlagExists("compact", options);
            helper.ensureFlagExists("alwaysChildren", options);
            helper.ensureFlagExists("addParent", options);
            helper.ensureFlagExists("trim", options);
            helper.ensureFlagExists("nativeType", options);
            helper.ensureFlagExists("nativeTypeAttributes", options);
            helper.ensureFlagExists("sanitize", options);
            helper.ensureFlagExists("instructionHasAttributes", options);
            helper.ensureFlagExists("captureSpacesBetweenElements", options);
            helper.ensureAlwaysArrayExists(options);
            helper.ensureKeyExists("declaration", options);
            helper.ensureKeyExists("instruction", options);
            helper.ensureKeyExists("attributes", options);
            helper.ensureKeyExists("text", options);
            helper.ensureKeyExists("comment", options);
            helper.ensureKeyExists("cdata", options);
            helper.ensureKeyExists("doctype", options);
            helper.ensureKeyExists("type", options);
            helper.ensureKeyExists("name", options);
            helper.ensureKeyExists("elements", options);
            helper.ensureKeyExists("parent", options);
            helper.checkFnExists("doctype", options);
            helper.checkFnExists("instruction", options);
            helper.checkFnExists("cdata", options);
            helper.checkFnExists("comment", options);
            helper.checkFnExists("text", options);
            helper.checkFnExists("instructionName", options);
            helper.checkFnExists("elementName", options);
            helper.checkFnExists("attributeName", options);
            helper.checkFnExists("attributeValue", options);
            helper.checkFnExists("attributes", options);
            return options;
        }
        function nativeType(value) {
            var nValue = Number(value);
            if (!isNaN(nValue)) {
                return nValue;
            }
            var bValue = value.toLowerCase();
            if (bValue === "true") {
                return true;
            } else if (bValue === "false") {
                return false;
            }
            return value;
        }
        function addField(type, value) {
            var key;
            if (options.compact) {
                if (!currentElement[options[type + "Key"]] && (isArray(options.alwaysArray) ? options.alwaysArray.indexOf(options[type + "Key"]) !== -1 : options.alwaysArray)) {
                    currentElement[options[type + "Key"]] = [];
                }
                if (currentElement[options[type + "Key"]] && !isArray(currentElement[options[type + "Key"]])) {
                    currentElement[options[type + "Key"]] = [ currentElement[options[type + "Key"]] ];
                }
                if (type + "Fn" in options && typeof value === "string") {
                    value = options[type + "Fn"](value, currentElement);
                }
                if (type === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) {
                    for (key in value) {
                        if (value.hasOwnProperty(key)) {
                            if ("instructionFn" in options) {
                                value[key] = options.instructionFn(value[key], key, currentElement);
                            } else {
                                var temp = value[key];
                                delete value[key];
                                value[options.instructionNameFn(key, temp, currentElement)] = temp;
                            }
                        }
                    }
                }
                if (isArray(currentElement[options[type + "Key"]])) {
                    currentElement[options[type + "Key"]].push(value);
                } else {
                    currentElement[options[type + "Key"]] = value;
                }
            } else {
                if (!currentElement[options.elementsKey]) {
                    currentElement[options.elementsKey] = [];
                }
                var element = {};
                element[options.typeKey] = type;
                if (type === "instruction") {
                    for (key in value) {
                        if (value.hasOwnProperty(key)) {
                            break;
                        }
                    }
                    element[options.nameKey] = "instructionNameFn" in options ? options.instructionNameFn(key, value, currentElement) : key;
                    if (options.instructionHasAttributes) {
                        element[options.attributesKey] = value[key][options.attributesKey];
                        if ("instructionFn" in options) {
                            element[options.attributesKey] = options.instructionFn(element[options.attributesKey], key, currentElement);
                        }
                    } else {
                        if ("instructionFn" in options) {
                            value[key] = options.instructionFn(value[key], key, currentElement);
                        }
                        element[options.instructionKey] = value[key];
                    }
                } else {
                    if (type + "Fn" in options) {
                        value = options[type + "Fn"](value, currentElement);
                    }
                    element[options[type + "Key"]] = value;
                }
                if (options.addParent) {
                    element[options.parentKey] = currentElement;
                }
                currentElement[options.elementsKey].push(element);
            }
        }
        function manipulateAttributes(attributes) {
            if ("attributesFn" in options && attributes) {
                attributes = options.attributesFn(attributes, currentElement);
            }
            if ((options.trim || "attributeValueFn" in options || "attributeNameFn" in options || options.nativeTypeAttributes) && attributes) {
                var key;
                for (key in attributes) {
                    if (attributes.hasOwnProperty(key)) {
                        if (options.trim) attributes[key] = attributes[key].trim();
                        if (options.nativeTypeAttributes) {
                            attributes[key] = nativeType(attributes[key]);
                        }
                        if ("attributeValueFn" in options) attributes[key] = options.attributeValueFn(attributes[key], key, currentElement);
                        if ("attributeNameFn" in options) {
                            var temp = attributes[key];
                            delete attributes[key];
                            attributes[options.attributeNameFn(key, attributes[key], currentElement)] = temp;
                        }
                    }
                }
            }
            return attributes;
        }
        function onInstruction(instruction) {
            var attributes = {};
            if (instruction.body && (instruction.name.toLowerCase() === "xml" || options.instructionHasAttributes)) {
                var attrsRegExp = /([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\w+))\s*/g;
                var match;
                while ((match = attrsRegExp.exec(instruction.body)) !== null) {
                    attributes[match[1]] = match[2] || match[3] || match[4];
                }
                attributes = manipulateAttributes(attributes);
            }
            if (instruction.name.toLowerCase() === "xml") {
                if (options.ignoreDeclaration) {
                    return;
                }
                currentElement[options.declarationKey] = {};
                if (Object.keys(attributes).length) {
                    currentElement[options.declarationKey][options.attributesKey] = attributes;
                }
                if (options.addParent) {
                    currentElement[options.declarationKey][options.parentKey] = currentElement;
                }
            } else {
                if (options.ignoreInstruction) {
                    return;
                }
                if (options.trim) {
                    instruction.body = instruction.body.trim();
                }
                var value = {};
                if (options.instructionHasAttributes && Object.keys(attributes).length) {
                    value[instruction.name] = {};
                    value[instruction.name][options.attributesKey] = attributes;
                } else {
                    value[instruction.name] = instruction.body;
                }
                addField("instruction", value);
            }
        }
        function onStartElement(name, attributes) {
            var element;
            if (typeof name === "object") {
                attributes = name.attributes;
                name = name.name;
            }
            attributes = manipulateAttributes(attributes);
            if ("elementNameFn" in options) {
                name = options.elementNameFn(name, currentElement);
            }
            if (options.compact) {
                element = {};
                if (!options.ignoreAttributes && attributes && Object.keys(attributes).length) {
                    element[options.attributesKey] = {};
                    var key;
                    for (key in attributes) {
                        if (attributes.hasOwnProperty(key)) {
                            element[options.attributesKey][key] = attributes[key];
                        }
                    }
                }
                if (!(name in currentElement) && (isArray(options.alwaysArray) ? options.alwaysArray.indexOf(name) !== -1 : options.alwaysArray)) {
                    currentElement[name] = [];
                }
                if (currentElement[name] && !isArray(currentElement[name])) {
                    currentElement[name] = [ currentElement[name] ];
                }
                if (isArray(currentElement[name])) {
                    currentElement[name].push(element);
                } else {
                    currentElement[name] = element;
                }
            } else {
                if (!currentElement[options.elementsKey]) {
                    currentElement[options.elementsKey] = [];
                }
                element = {};
                element[options.typeKey] = "element";
                element[options.nameKey] = name;
                if (!options.ignoreAttributes && attributes && Object.keys(attributes).length) {
                    element[options.attributesKey] = attributes;
                }
                if (options.alwaysChildren) {
                    element[options.elementsKey] = [];
                }
                currentElement[options.elementsKey].push(element);
            }
            element[options.parentKey] = currentElement;
            currentElement = element;
        }
        function onText(text) {
            if (options.ignoreText) {
                return;
            }
            if (!text.trim() && !options.captureSpacesBetweenElements) {
                return;
            }
            if (options.trim) {
                text = text.trim();
            }
            if (options.nativeType) {
                text = nativeType(text);
            }
            if (options.sanitize) {
                text = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
            }
            addField("text", text);
        }
        function onComment(comment) {
            if (options.ignoreComment) {
                return;
            }
            if (options.trim) {
                comment = comment.trim();
            }
            addField("comment", comment);
        }
        function onEndElement(name) {
            var parentElement = currentElement[options.parentKey];
            if (!options.addParent) {
                delete currentElement[options.parentKey];
            }
            currentElement = parentElement;
        }
        function onCdata(cdata) {
            if (options.ignoreCdata) {
                return;
            }
            if (options.trim) {
                cdata = cdata.trim();
            }
            addField("cdata", cdata);
        }
        function onDoctype(doctype) {
            if (options.ignoreDoctype) {
                return;
            }
            doctype = doctype.replace(/^ /, "");
            if (options.trim) {
                doctype = doctype.trim();
            }
            addField("doctype", doctype);
        }
        function onError(error) {
            error.note = error;
        }
        module.exports = function(xml, userOptions) {
            var parser = pureJsParser ? sax.parser(true, {}) : parser = new expat.Parser("UTF-8");
            var result = {};
            currentElement = result;
            options = validateOptions(userOptions);
            if (pureJsParser) {
                parser.opt = {
                    strictEntities: true
                };
                parser.onopentag = onStartElement;
                parser.ontext = onText;
                parser.oncomment = onComment;
                parser.onclosetag = onEndElement;
                parser.onerror = onError;
                parser.oncdata = onCdata;
                parser.ondoctype = onDoctype;
                parser.onprocessinginstruction = onInstruction;
            } else {
                parser.on("startElement", onStartElement);
                parser.on("text", onText);
                parser.on("comment", onComment);
                parser.on("endElement", onEndElement);
                parser.on("error", onError);
            }
            if (pureJsParser) {
                parser.write(xml).close();
            } else {
                if (!parser.parse(xml)) {
                    throw new Error("XML parsing error: " + parser.getError());
                }
            }
            if (result[options.elementsKey]) {
                var temp = result[options.elementsKey];
                delete result[options.elementsKey];
                result[options.elementsKey] = temp;
                delete result.text;
            }
            return result;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var isArray = __webpack_require__(193).isArray;
        module.exports = {
            copyOptions: function(options) {
                var key, copy = {};
                for (key in options) {
                    if (options.hasOwnProperty(key)) {
                        copy[key] = options[key];
                    }
                }
                return copy;
            },
            ensureFlagExists: function(item, options) {
                if (!(item in options) || typeof options[item] !== "boolean") {
                    options[item] = false;
                }
            },
            ensureSpacesExists: function(options) {
                if (!("spaces" in options) || typeof options.spaces !== "number" && typeof options.spaces !== "string") {
                    options.spaces = 0;
                }
            },
            ensureAlwaysArrayExists: function(options) {
                if (!("alwaysArray" in options) || typeof options.alwaysArray !== "boolean" && !isArray(options.alwaysArray)) {
                    options.alwaysArray = false;
                }
            },
            ensureKeyExists: function(key, options) {
                if (!(key + "Key" in options) || typeof options[key + "Key"] !== "string") {
                    options[key + "Key"] = options.compact ? "_" + key : key;
                }
            },
            checkFnExists: function(key, options) {
                return key + "Fn" in options;
            }
        };
    }, module => {
        module.exports = {
            isArray: function(value) {
                if (Array.isArray) {
                    return Array.isArray(value);
                }
                return Object.prototype.toString.call(value) === "[object Array]";
            }
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var helper = __webpack_require__(192);
        var xml2js = __webpack_require__(191);
        function validateOptions(userOptions) {
            var options = helper.copyOptions(userOptions);
            helper.ensureSpacesExists(options);
            return options;
        }
        module.exports = function(xml, userOptions) {
            var options, js, json, parentKey;
            options = validateOptions(userOptions);
            js = xml2js(xml, options);
            parentKey = "compact" in options && options.compact ? "_parent" : "parent";
            if ("addParent" in options && options.addParent) {
                json = JSON.stringify(js, (function(k, v) {
                    return k === parentKey ? "_" : v;
                }), options.spaces);
            } else {
                json = JSON.stringify(js, null, options.spaces);
            }
            return json.replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var helper = __webpack_require__(192);
        var isArray = __webpack_require__(193).isArray;
        var currentElement, currentElementName;
        function validateOptions(userOptions) {
            var options = helper.copyOptions(userOptions);
            helper.ensureFlagExists("ignoreDeclaration", options);
            helper.ensureFlagExists("ignoreInstruction", options);
            helper.ensureFlagExists("ignoreAttributes", options);
            helper.ensureFlagExists("ignoreText", options);
            helper.ensureFlagExists("ignoreComment", options);
            helper.ensureFlagExists("ignoreCdata", options);
            helper.ensureFlagExists("ignoreDoctype", options);
            helper.ensureFlagExists("compact", options);
            helper.ensureFlagExists("indentText", options);
            helper.ensureFlagExists("indentCdata", options);
            helper.ensureFlagExists("indentAttributes", options);
            helper.ensureFlagExists("indentInstruction", options);
            helper.ensureFlagExists("fullTagEmptyElement", options);
            helper.ensureFlagExists("noQuotesForNativeAttributes", options);
            helper.ensureSpacesExists(options);
            if (typeof options.spaces === "number") {
                options.spaces = Array(options.spaces + 1).join(" ");
            }
            helper.ensureKeyExists("declaration", options);
            helper.ensureKeyExists("instruction", options);
            helper.ensureKeyExists("attributes", options);
            helper.ensureKeyExists("text", options);
            helper.ensureKeyExists("comment", options);
            helper.ensureKeyExists("cdata", options);
            helper.ensureKeyExists("doctype", options);
            helper.ensureKeyExists("type", options);
            helper.ensureKeyExists("name", options);
            helper.ensureKeyExists("elements", options);
            helper.checkFnExists("doctype", options);
            helper.checkFnExists("instruction", options);
            helper.checkFnExists("cdata", options);
            helper.checkFnExists("comment", options);
            helper.checkFnExists("text", options);
            helper.checkFnExists("instructionName", options);
            helper.checkFnExists("elementName", options);
            helper.checkFnExists("attributeName", options);
            helper.checkFnExists("attributeValue", options);
            helper.checkFnExists("attributes", options);
            helper.checkFnExists("fullTagEmptyElement", options);
            return options;
        }
        function writeIndentation(options, depth, firstLine) {
            return (!firstLine && options.spaces ? "\n" : "") + Array(depth + 1).join(options.spaces);
        }
        function writeAttributes(attributes, options, depth) {
            if (options.ignoreAttributes) {
                return "";
            }
            if ("attributesFn" in options) {
                attributes = options.attributesFn(attributes, currentElementName, currentElement);
            }
            var key, attr, attrName, quote, result = [];
            for (key in attributes) {
                if (attributes.hasOwnProperty(key) && attributes[key] !== null && attributes[key] !== undefined) {
                    quote = options.noQuotesForNativeAttributes && typeof attributes[key] !== "string" ? "" : '"';
                    attr = "" + attributes[key];
                    attr = attr.replace(/"/g, "&quot;");
                    attrName = "attributeNameFn" in options ? options.attributeNameFn(key, attr, currentElementName, currentElement) : key;
                    result.push(options.spaces && options.indentAttributes ? writeIndentation(options, depth + 1, false) : " ");
                    result.push(attrName + "=" + quote + ("attributeValueFn" in options ? options.attributeValueFn(attr, key, currentElementName, currentElement) : attr) + quote);
                }
            }
            if (attributes && Object.keys(attributes).length && options.spaces && options.indentAttributes) {
                result.push(writeIndentation(options, depth, false));
            }
            return result.join("");
        }
        function writeDeclaration(declaration, options, depth) {
            currentElement = declaration;
            currentElementName = "xml";
            return options.ignoreDeclaration ? "" : "<?" + "xml" + writeAttributes(declaration[options.attributesKey], options, depth) + "?>";
        }
        function writeInstruction(instruction, options, depth) {
            if (options.ignoreInstruction) {
                return "";
            }
            var key;
            for (key in instruction) {
                if (instruction.hasOwnProperty(key)) {
                    break;
                }
            }
            var instructionName = "instructionNameFn" in options ? options.instructionNameFn(key, instruction[key], currentElementName, currentElement) : key;
            if (typeof instruction[key] === "object") {
                currentElement = instruction;
                currentElementName = instructionName;
                return "<?" + instructionName + writeAttributes(instruction[key][options.attributesKey], options, depth) + "?>";
            } else {
                var instructionValue = instruction[key] ? instruction[key] : "";
                if ("instructionFn" in options) instructionValue = options.instructionFn(instructionValue, key, currentElementName, currentElement);
                return "<?" + instructionName + (instructionValue ? " " + instructionValue : "") + "?>";
            }
        }
        function writeComment(comment, options) {
            return options.ignoreComment ? "" : "\x3c!--" + ("commentFn" in options ? options.commentFn(comment, currentElementName, currentElement) : comment) + "--\x3e";
        }
        function writeCdata(cdata, options) {
            return options.ignoreCdata ? "" : "<![CDATA[" + ("cdataFn" in options ? options.cdataFn(cdata, currentElementName, currentElement) : cdata.replace("]]>", "]]]]><![CDATA[>")) + "]]>";
        }
        function writeDoctype(doctype, options) {
            return options.ignoreDoctype ? "" : "<!DOCTYPE " + ("doctypeFn" in options ? options.doctypeFn(doctype, currentElementName, currentElement) : doctype) + ">";
        }
        function writeText(text, options) {
            if (options.ignoreText) return "";
            text = "" + text;
            text = text.replace(/&amp;/g, "&");
            text = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
            return "textFn" in options ? options.textFn(text, currentElementName, currentElement) : text;
        }
        function hasContent(element, options) {
            var i;
            if (element.elements && element.elements.length) {
                for (i = 0; i < element.elements.length; ++i) {
                    switch (element.elements[i][options.typeKey]) {
                      case "text":
                        if (options.indentText) {
                            return true;
                        }
                        break;

                      case "cdata":
                        if (options.indentCdata) {
                            return true;
                        }
                        break;

                      case "instruction":
                        if (options.indentInstruction) {
                            return true;
                        }
                        break;

                      case "doctype":
                      case "comment":
                      case "element":
                        return true;

                      default:
                        return true;
                    }
                }
            }
            return false;
        }
        function writeElement(element, options, depth) {
            currentElement = element;
            currentElementName = element.name;
            var xml = [], elementName = "elementNameFn" in options ? options.elementNameFn(element.name, element) : element.name;
            xml.push("<" + elementName);
            if (element[options.attributesKey]) {
                xml.push(writeAttributes(element[options.attributesKey], options, depth));
            }
            var withClosingTag = element[options.elementsKey] && element[options.elementsKey].length || element[options.attributesKey] && element[options.attributesKey]["xml:space"] === "preserve";
            if (!withClosingTag) {
                if ("fullTagEmptyElementFn" in options) {
                    withClosingTag = options.fullTagEmptyElementFn(element.name, element);
                } else {
                    withClosingTag = options.fullTagEmptyElement;
                }
            }
            if (withClosingTag) {
                xml.push(">");
                if (element[options.elementsKey] && element[options.elementsKey].length) {
                    xml.push(writeElements(element[options.elementsKey], options, depth + 1));
                    currentElement = element;
                    currentElementName = element.name;
                }
                xml.push(options.spaces && hasContent(element, options) ? "\n" + Array(depth + 1).join(options.spaces) : "");
                xml.push("</" + elementName + ">");
            } else {
                xml.push("/>");
            }
            return xml.join("");
        }
        function writeElements(elements, options, depth, firstLine) {
            return elements.reduce((function(xml, element) {
                var indent = writeIndentation(options, depth, firstLine && !xml);
                switch (element.type) {
                  case "element":
                    return xml + indent + writeElement(element, options, depth);

                  case "comment":
                    return xml + indent + writeComment(element[options.commentKey], options);

                  case "doctype":
                    return xml + indent + writeDoctype(element[options.doctypeKey], options);

                  case "cdata":
                    return xml + (options.indentCdata ? indent : "") + writeCdata(element[options.cdataKey], options);

                  case "text":
                    return xml + (options.indentText ? indent : "") + writeText(element[options.textKey], options);

                  case "instruction":
                    var instruction = {};
                    instruction[element[options.nameKey]] = element[options.attributesKey] ? element : element[options.instructionKey];
                    return xml + (options.indentInstruction ? indent : "") + writeInstruction(instruction, options, depth);
                }
            }), "");
        }
        function hasContentCompact(element, options, anyContent) {
            var key;
            for (key in element) {
                if (element.hasOwnProperty(key)) {
                    switch (key) {
                      case options.parentKey:
                      case options.attributesKey:
                        break;

                      case options.textKey:
                        if (options.indentText || anyContent) {
                            return true;
                        }
                        break;

                      case options.cdataKey:
                        if (options.indentCdata || anyContent) {
                            return true;
                        }
                        break;

                      case options.instructionKey:
                        if (options.indentInstruction || anyContent) {
                            return true;
                        }
                        break;

                      case options.doctypeKey:
                      case options.commentKey:
                        return true;

                      default:
                        return true;
                    }
                }
            }
            return false;
        }
        function writeElementCompact(element, name, options, depth, indent) {
            currentElement = element;
            currentElementName = name;
            var elementName = "elementNameFn" in options ? options.elementNameFn(name, element) : name;
            if (typeof element === "undefined" || element === null || element === "") {
                return "fullTagEmptyElementFn" in options && options.fullTagEmptyElementFn(name, element) || options.fullTagEmptyElement ? "<" + elementName + "></" + elementName + ">" : "<" + elementName + "/>";
            }
            var xml = [];
            if (name) {
                xml.push("<" + elementName);
                if (typeof element !== "object") {
                    xml.push(">" + writeText(element, options) + "</" + elementName + ">");
                    return xml.join("");
                }
                if (element[options.attributesKey]) {
                    xml.push(writeAttributes(element[options.attributesKey], options, depth));
                }
                var withClosingTag = hasContentCompact(element, options, true) || element[options.attributesKey] && element[options.attributesKey]["xml:space"] === "preserve";
                if (!withClosingTag) {
                    if ("fullTagEmptyElementFn" in options) {
                        withClosingTag = options.fullTagEmptyElementFn(name, element);
                    } else {
                        withClosingTag = options.fullTagEmptyElement;
                    }
                }
                if (withClosingTag) {
                    xml.push(">");
                } else {
                    xml.push("/>");
                    return xml.join("");
                }
            }
            xml.push(writeElementsCompact(element, options, depth + 1, false));
            currentElement = element;
            currentElementName = name;
            if (name) {
                xml.push((indent ? writeIndentation(options, depth, false) : "") + "</" + elementName + ">");
            }
            return xml.join("");
        }
        function writeElementsCompact(element, options, depth, firstLine) {
            var i, key, nodes, xml = [];
            for (key in element) {
                if (element.hasOwnProperty(key)) {
                    nodes = isArray(element[key]) ? element[key] : [ element[key] ];
                    for (i = 0; i < nodes.length; ++i) {
                        switch (key) {
                          case options.declarationKey:
                            xml.push(writeDeclaration(nodes[i], options, depth));
                            break;

                          case options.instructionKey:
                            xml.push((options.indentInstruction ? writeIndentation(options, depth, firstLine) : "") + writeInstruction(nodes[i], options, depth));
                            break;

                          case options.attributesKey:
                          case options.parentKey:
                            break;

                          case options.textKey:
                            xml.push((options.indentText ? writeIndentation(options, depth, firstLine) : "") + writeText(nodes[i], options));
                            break;

                          case options.cdataKey:
                            xml.push((options.indentCdata ? writeIndentation(options, depth, firstLine) : "") + writeCdata(nodes[i], options));
                            break;

                          case options.doctypeKey:
                            xml.push(writeIndentation(options, depth, firstLine) + writeDoctype(nodes[i], options));
                            break;

                          case options.commentKey:
                            xml.push(writeIndentation(options, depth, firstLine) + writeComment(nodes[i], options));
                            break;

                          default:
                            xml.push(writeIndentation(options, depth, firstLine) + writeElementCompact(nodes[i], key, options, depth, hasContentCompact(nodes[i], options)));
                        }
                        firstLine = firstLine && !xml.length;
                    }
                }
            }
            return xml.join("");
        }
        module.exports = function(js, options) {
            options = validateOptions(options);
            var xml = [];
            currentElement = js;
            currentElementName = "_root_";
            if (options.compact) {
                xml.push(writeElementsCompact(js, options, 0, true));
            } else {
                if (js[options.declarationKey]) {
                    xml.push(writeDeclaration(js[options.declarationKey], options, 0));
                }
                if (js[options.elementsKey] && js[options.elementsKey].length) {
                    xml.push(writeElements(js[options.elementsKey], options, 0, !xml.length));
                }
            }
            return xml.join("");
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var js2xml = __webpack_require__(195);
        module.exports = function(json, options) {
            if (json instanceof Buffer) {
                json = json.toString();
            }
            var js = null;
            if (typeof json === "string") {
                try {
                    js = JSON.parse(json);
                } catch (e) {
                    throw new Error("The JSON structure is invalid");
                }
            } else {
                js = json;
            }
            return js2xml(js, options);
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.parse = void 0;
        const crypto_1 = __webpack_require__(35);
        const xml_js_1 = __webpack_require__(190);
        const blockmap_1 = __webpack_require__(189);
        function firstChild(element, name) {
            if (element.elements !== undefined) {
                return element.elements.find((e => e.name === name));
            }
        }
        function firstChildThrow(element, name) {
            const result = firstChild(element, name);
            if (result === undefined) {
                throw new Error(`Missing tag "${name}"`);
            }
            return result;
        }
        function getAttribute(element, name) {
            if (element.attributes !== undefined) {
                return element.attributes[name];
            }
        }
        function getAttributeThrow(element, name) {
            const result = getAttribute(element, name);
            if (result === undefined) {
                throw new Error(`Missing attribute "${name}"`);
            }
            return result;
        }
        function getText(element) {
            if (Array.isArray(element)) {
                return element.map(getText).join("");
            }
            if (element.type === "element") {
                return getText(element.elements || []);
            }
            if (element.type === "text" && element.text !== undefined) {
                return "" + element.text;
            }
            return "";
        }
        function textContentThrow(element, name) {
            return getText(firstChildThrow(element, name)).trim();
        }
        function textContent(element, name) {
            const child = firstChild(element, name);
            if (child !== undefined) {
                return getText(child).trim();
            }
        }
        function getRanges(element) {
            const ranges = [];
            for (const node of element.elements || []) {
                if (node.type === "element" && node.name !== undefined && node.name.toLowerCase() === "range") {
                    const [start, end] = getText(node).trim().split("-");
                    const checksum = getAttribute(node, "sha1") || getAttribute(node, "chksum");
                    if (checksum === undefined) {
                        throw new Error("No checksum in range");
                    }
                    if (typeof checksum !== "string") {
                        throw new Error("Checksum is not a string");
                    }
                    const range = {
                        start: parseInt(start, 10),
                        end: parseInt(end || start, 10),
                        checksum
                    };
                    ranges.push(range);
                }
            }
            return ranges;
        }
        function maskChecksum(value) {
            const pattern = /BmapFileChecksum/.test(value) ? /(<BmapFileChecksum>\s*)([a-z0-9]+)(\s*<\/BmapFileChecksum>)/i : /(<BmapFileSHA1>\s*)([a-z0-9]+)(\s*<\/BmapFileSHA1>)/i;
            return value.replace(pattern, ((_match, start, checksum, end) => start + checksum.replace(/./g, "0") + end));
        }
        function parse(value, verify = true) {
            value = value.toString();
            const data = xml_js_1.xml2js(value, {
                compact: false
            });
            const bmap = firstChildThrow(data, "bmap");
            const version = getAttributeThrow(bmap, "version");
            if (typeof version !== "string") {
                throw new Error(`Version is not a string: ${version}`);
            }
            if (!blockmap_1.BlockMap.versions.includes(version)) {
                throw new Error(`Unsupported block map version "${version}"`);
            }
            const imageSize = parseInt(textContentThrow(bmap, "ImageSize"), 10);
            const blockSize = parseInt(textContentThrow(bmap, "BlockSize"), 10);
            const blocksCount = parseInt(textContentThrow(bmap, "BlocksCount"), 10);
            const mappedBlocksCount = parseInt(textContentThrow(bmap, "MappedBlocksCount"), 10);
            const checksum = textContent(bmap, "BmapFileChecksum") || textContent(bmap, "BmapFileSHA1");
            const checksumType = textContent(bmap, "ChecksumType") || "sha1";
            const map = firstChildThrow(bmap, "BlockMap");
            const ranges = getRanges(map);
            if (verify && checksum !== undefined) {
                const file = maskChecksum(value);
                const digest = crypto_1.createHash(checksumType).update(file).digest("hex");
                if (checksum !== digest) {
                    throw new Error(`File checksum mismatch: ${checksum} != ${digest}`);
                }
            }
            return {
                version,
                imageSize,
                blockSize,
                blocksCount,
                mappedBlocksCount,
                checksum,
                checksumType,
                ranges
            };
        }
        exports.parse = parse;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Range = void 0;
        class Range {
            constructor(start = 0, end = 0, checksum) {
                this.start = start;
                this.end = end;
                this.checksum = checksum;
            }
            static from(value) {
                return new Range(value.start, value.end, value.checksum);
            }
            get length() {
                return this.end - this.start + 1;
            }
            set length(value) {
                this.end = this.start + value - 1;
            }
        }
        exports.Range = Range;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.Chunk = void 0;
        class Chunk {
            constructor(buffer, position) {
                this.buffer = buffer;
                this.position = position;
            }
            get length() {
                return this.buffer.length;
            }
        }
        exports.Chunk = Chunk;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.FilterStream = void 0;
        const crypto_1 = __webpack_require__(35);
        const debug_1 = __webpack_require__(42);
        const stream_1 = __webpack_require__(17);
        const chunk_1 = __webpack_require__(199);
        const read_range_1 = __webpack_require__(201);
        const debug = debug_1.debug("blockmap:filterstream");
        class FilterStream extends stream_1.Transform {
            constructor(blockMap, verify = true, generateChecksums = false, chunkSize = 64 * 1024) {
                super({
                    readableObjectMode: true
                });
                this.blockMap = blockMap;
                this.verify = verify;
                this.generateChecksums = generateChecksums;
                this.chunkSize = chunkSize;
                this.rangesRead = 0;
                this.rangesVerified = 0;
                this.blocksRead = 0;
                this.bytesRead = 0;
                this.blocksWritten = 0;
                this.bytesWritten = 0;
                this.position = 0;
                this._chunks = [];
                this._bytes = 0;
                if (verify && generateChecksums) {
                    throw new Error("verify and generateChecksums options are mutually exclusive");
                }
                this.ranges = this._getByteRangesFromBlockMap();
                this.currentRange = this.ranges.shift();
                debug("range:next", this.currentRange);
                if (verify || generateChecksums) {
                    this._hash = crypto_1.createHash(this.blockMap.checksumType);
                }
            }
            _getByteRangesFromBlockMap() {
                return this.blockMap.ranges.map((range => new read_range_1.ReadRange(range, this.blockMap.blockSize)));
            }
            _verifyRange() {
                if (this._hash === undefined || this.currentRange === undefined) {
                    return;
                }
                const digest = this._hash.digest("hex");
                debug("verify:checksum", this.currentRange.checksum);
                debug("verify:digest  ", digest);
                this._hash = crypto_1.createHash(this.blockMap.checksumType);
                if (this.verify && this.currentRange.checksum !== digest) {
                    const error = new read_range_1.ReadRangeError(`Invalid checksum for range [${this.currentRange.startLBA},${this.currentRange.endLBA}], bytes ${this.currentRange.start}-${this.currentRange.end}`, this.currentRange, digest);
                    this.emit("error", error);
                    return;
                }
                if (this.generateChecksums) {
                    this.currentRange.range.checksum = digest;
                } else {
                    this.rangesVerified++;
                }
            }
            _rangeInChunk(chunk) {
                if (this.currentRange === undefined) {
                    return false;
                }
                const rangeStart = this.currentRange.start + this.currentRange.offset;
                const isRangeInChunk = rangeStart >= this.position && rangeStart < this.position + chunk.length;
                debug("range-in-chunk", isRangeInChunk);
                return isRangeInChunk;
            }
            _transformBlock(chunk, next) {
                let start = 0;
                let end = 0;
                let length = 0;
                let block;
                while (this.currentRange && this._rangeInChunk(chunk)) {
                    start = this.currentRange.start + this.currentRange.offset - this.position;
                    end = start + this.currentRange.length - this.currentRange.offset;
                    debug("slice", start, "-", end);
                    block = new chunk_1.Chunk(chunk.slice(start, end), this.currentRange.start + this.currentRange.offset);
                    if (end > chunk.length) {
                        length = chunk.length - start;
                        debug("chunk:partial", length);
                        if (length % this.blockMap.blockSize !== 0) {
                            debug("chunk:buffer", "length < block size");
                            this._chunks.push(block.buffer);
                            this._bytes += block.length;
                            this.position += chunk.length - block.length;
                            return process.nextTick(next);
                        }
                    }
                    this.currentRange.offset += block.length;
                    this.bytesWritten += block.length;
                    this.blocksWritten += block.length / this.blockMap.blockSize;
                    debug("push", block.position, block.position / this.blockMap.blockSize, block);
                    this.push(block);
                    if (this._hash !== undefined) {
                        this._hash.update(block.buffer);
                    }
                    if (this.currentRange.length === this.currentRange.offset) {
                        this._verifyRange();
                        this.rangesRead++;
                        this.currentRange = this.currentRange = this.ranges.shift();
                        debug("range:next", this.currentRange);
                    }
                }
                this.position += chunk.length;
                process.nextTick(next);
            }
            _transform(chunk, _encoding, next) {
                debug("position", this.position);
                debug("chunk", chunk.length, chunk);
                this.bytesRead += chunk.length;
                this.blocksRead += chunk.length / this.blockMap.blockSize;
                if (this.currentRange === undefined) {
                    debug("no current range");
                    this.position += chunk.length;
                    return process.nextTick(next);
                }
                if (!this._rangeInChunk(chunk)) {
                    debug("chunk:ignore");
                    this.position += chunk.length;
                    return process.nextTick(next);
                }
                if (this._bytes && this._bytes < this.chunkSize) {
                    debug("chunk:buffer", "not enough bytes");
                    this._chunks.push(chunk);
                    this._bytes += chunk.length;
                    return process.nextTick(next);
                }
                if (this._bytes) {
                    debug("chunk:concat", this._bytes + chunk.length);
                    this._chunks.push(chunk);
                    this._bytes += chunk.length;
                    chunk = Buffer.concat(this._chunks, this._bytes);
                    this._chunks = [];
                    this._bytes = 0;
                }
                this._transformBlock(chunk, next);
            }
            _flush(done) {
                if (this._bytes) {
                    const chunk = Buffer.concat(this._chunks, this._bytes);
                    this._chunks = [];
                    this._bytes = 0;
                    this._transformBlock(chunk, done);
                } else {
                    done();
                }
            }
        }
        exports.FilterStream = FilterStream;
    }, (__unused_webpack_module, exports) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ReadRangeError = exports.ReadRange = void 0;
        class ReadRange {
            constructor(range, blockSize) {
                this.range = range;
                this.offset = 0;
                this.checksum = range.checksum;
                this.start = range.start * blockSize;
                this.end = (range.end + 1) * blockSize;
                this.length = range.length * blockSize;
                this.startLBA = range.start;
                this.endLBA = range.end;
            }
        }
        exports.ReadRange = ReadRange;
        class ReadRangeError extends Error {
            constructor(message, range, checksum) {
                super(message);
                this.range = range;
                this.checksum = checksum;
            }
        }
        exports.ReadRangeError = ReadRangeError;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.ReadStream = void 0;
        const tslib_1 = __webpack_require__(2);
        const crypto_1 = __webpack_require__(35);
        const debug_1 = __webpack_require__(42);
        const fs_1 = __webpack_require__(5);
        const stream_1 = __webpack_require__(17);
        const chunk_1 = __webpack_require__(199);
        const read_range_1 = __webpack_require__(201);
        const debug = debug_1.debug("blockmap:readstream");
        class ReadStream extends stream_1.Readable {
            constructor(fdOrReadFn, blockMap, verify = true, generateChecksums = false, start = 0, end = Infinity, chunkSize = 64 * 1024) {
                super({
                    objectMode: true
                });
                this.blockMap = blockMap;
                this.verify = verify;
                this.generateChecksums = generateChecksums;
                this.start = start;
                this.end = end;
                this.chunkSize = chunkSize;
                this.rangesRead = 0;
                this.rangesVerified = 0;
                this.blocksRead = 0;
                this.bytesRead = 0;
                this.position = 0;
                if (verify && generateChecksums) {
                    throw new Error("verify and generateChecksums options are mutually exclusive");
                }
                if (start < 0) {
                    throw new Error("Start must not be negative");
                }
                if (start > end) {
                    throw new Error("Start must be less or equal to end");
                }
                if (verify || generateChecksums) {
                    this._hash = crypto_1.createHash(blockMap.checksumType);
                }
                this.ranges = this._prepareRanges();
                if (typeof fdOrReadFn === "number") {
                    this.readFn = (buf, offset, length, position) => new Promise(((resolve, reject) => {
                        fs_1.read(fdOrReadFn, buf, offset, length, position, ((error, bytesRead, buffer) => {
                            if (error) {
                                reject(error);
                            } else {
                                resolve({
                                    bytesRead,
                                    buffer
                                });
                            }
                        }));
                    }));
                } else {
                    this.readFn = fdOrReadFn;
                }
            }
            _prepareRanges() {
                return this.blockMap.ranges.map((range => {
                    const readRange = new read_range_1.ReadRange(range, this.blockMap.blockSize);
                    readRange.start += this.start;
                    readRange.end += this.start;
                    return readRange;
                })).filter((readRange => readRange.end <= this.end + this.start));
            }
            _verifyRange() {
                if (this.currentRange === undefined || this._hash === undefined) {
                    return;
                }
                const digest = this._hash.digest("hex");
                debug("verify:checksum", this.currentRange.checksum);
                debug("verify:digest  ", digest);
                this._hash = crypto_1.createHash(this.blockMap.checksumType);
                if (this.verify && this.currentRange.checksum !== digest) {
                    const error = new read_range_1.ReadRangeError(`Invalid checksum for range [${this.currentRange.startLBA},${this.currentRange.endLBA}], bytes ${this.currentRange.start}-${this.currentRange.end}`, this.currentRange, digest);
                    this.emit("error", error);
                }
                if (this.generateChecksums) {
                    this.currentRange.range.checksum = digest;
                } else {
                    this.rangesVerified++;
                }
            }
            _readBlock() {
                return tslib_1.__awaiter(this, void 0, void 0, (function*() {
                    if (this.currentRange === undefined) {
                        return;
                    }
                    const length = Math.min(this.currentRange.length - this.currentRange.offset, this.chunkSize);
                    const position = this.currentRange.start + this.currentRange.offset;
                    const chunk = new chunk_1.Chunk(Buffer.allocUnsafe(length), position);
                    debug("read-block:position", position);
                    debug("read-block:length", length);
                    try {
                        const {bytesRead} = yield this.readFn(chunk.buffer, 0, length, position);
                        if (bytesRead !== length) {
                            throw new Error(`Bytes read mismatch: ${bytesRead} != ${length}`);
                        }
                        this.currentRange.offset += bytesRead;
                        this.blocksRead += bytesRead / this.blockMap.blockSize;
                        this.bytesRead += bytesRead;
                        this.position += bytesRead;
                        debug("read-block:blocksRead", this.blocksRead);
                        if (this._hash !== undefined) {
                            this._hash.update(chunk.buffer);
                        }
                        this.push(chunk);
                    } catch (error) {
                        this.emit("error", error);
                    }
                }));
            }
            _advanceRange() {
                return tslib_1.__awaiter(this, void 0, void 0, (function*() {
                    if (this.ranges.length > 0) {
                        this.currentRange = this.ranges.shift();
                        this.rangesRead++;
                        debug("read:range %O", this.currentRange);
                        yield this._readBlock();
                    } else {
                        this.push(null);
                    }
                }));
            }
            _read() {
                return tslib_1.__awaiter(this, void 0, void 0, (function*() {
                    if (this.currentRange === undefined) {
                        yield this._advanceRange();
                    } else if (this.currentRange.offset === this.currentRange.length) {
                        this._verifyRange();
                        yield this._advanceRange();
                    } else {
                        yield this._readBlock();
                    }
                }));
            }
        }
        exports.ReadStream = ReadStream;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.withOpenFile = void 0;
        const tslib_1 = __webpack_require__(2);
        const fs = __webpack_require__(5);
        function open(filename) {
            return new Promise(((resolve, reject) => {
                fs.open(filename, "r", ((error, fd) => {
                    if (error) {
                        reject(error);
                    } else {
                        resolve(fd);
                    }
                }));
            }));
        }
        function close(fd) {
            return new Promise(((resolve, reject) => {
                fs.close(fd, (error => {
                    if (error) {
                        reject(error);
                    } else {
                        resolve();
                    }
                }));
            }));
        }
        function withOpenFile(filename, fn) {
            return tslib_1.__awaiter(this, void 0, void 0, (function*() {
                const fd = yield open(filename);
                try {
                    yield fn(fd);
                } finally {
                    yield close(fd);
                }
            }));
        }
        exports.withOpenFile = withOpenFile;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var fs = __webpack_require__(5);
        var zlib = __webpack_require__(89);
        var fd_slicer = __webpack_require__(205);
        var crc32 = __webpack_require__(207);
        var util = __webpack_require__(14);
        var EventEmitter = __webpack_require__(41).EventEmitter;
        var Transform = __webpack_require__(17).Transform;
        var PassThrough = __webpack_require__(17).PassThrough;
        var Writable = __webpack_require__(17).Writable;
        exports.open = open;
        exports.fromFd = fromFd;
        exports.fromBuffer = fromBuffer;
        exports.fromRandomAccessReader = fromRandomAccessReader;
        exports.dosDateTimeToDate = dosDateTimeToDate;
        exports.validateFileName = validateFileName;
        exports.ZipFile = ZipFile;
        exports.Entry = Entry;
        exports.RandomAccessReader = RandomAccessReader;
        function open(path, options, callback) {
            if (typeof options === "function") {
                callback = options;
                options = null;
            }
            if (options == null) options = {};
            if (options.autoClose == null) options.autoClose = true;
            if (options.lazyEntries == null) options.lazyEntries = false;
            if (options.decodeStrings == null) options.decodeStrings = true;
            if (options.validateEntrySizes == null) options.validateEntrySizes = true;
            if (options.strictFileNames == null) options.strictFileNames = false;
            if (callback == null) callback = defaultCallback;
            fs.open(path, "r", (function(err, fd) {
                if (err) return callback(err);
                fromFd(fd, options, (function(err, zipfile) {
                    if (err) fs.close(fd, defaultCallback);
                    callback(err, zipfile);
                }));
            }));
        }
        function fromFd(fd, options, callback) {
            if (typeof options === "function") {
                callback = options;
                options = null;
            }
            if (options == null) options = {};
            if (options.autoClose == null) options.autoClose = false;
            if (options.lazyEntries == null) options.lazyEntries = false;
            if (options.decodeStrings == null) options.decodeStrings = true;
            if (options.validateEntrySizes == null) options.validateEntrySizes = true;
            if (options.strictFileNames == null) options.strictFileNames = false;
            if (callback == null) callback = defaultCallback;
            fs.fstat(fd, (function(err, stats) {
                if (err) return callback(err);
                var reader = fd_slicer.createFromFd(fd, {
                    autoClose: true
                });
                fromRandomAccessReader(reader, stats.size, options, callback);
            }));
        }
        function fromBuffer(buffer, options, callback) {
            if (typeof options === "function") {
                callback = options;
                options = null;
            }
            if (options == null) options = {};
            options.autoClose = false;
            if (options.lazyEntries == null) options.lazyEntries = false;
            if (options.decodeStrings == null) options.decodeStrings = true;
            if (options.validateEntrySizes == null) options.validateEntrySizes = true;
            if (options.strictFileNames == null) options.strictFileNames = false;
            var reader = fd_slicer.createFromBuffer(buffer, {
                maxChunkSize: 65536
            });
            fromRandomAccessReader(reader, buffer.length, options, callback);
        }
        function fromRandomAccessReader(reader, totalSize, options, callback) {
            if (typeof options === "function") {
                callback = options;
                options = null;
            }
            if (options == null) options = {};
            if (options.autoClose == null) options.autoClose = true;
            if (options.lazyEntries == null) options.lazyEntries = false;
            if (options.decodeStrings == null) options.decodeStrings = true;
            var decodeStrings = !!options.decodeStrings;
            if (options.validateEntrySizes == null) options.validateEntrySizes = true;
            if (options.strictFileNames == null) options.strictFileNames = false;
            if (callback == null) callback = defaultCallback;
            if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
            if (totalSize > Number.MAX_SAFE_INTEGER) {
                throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
            }
            reader.ref();
            var eocdrWithoutCommentSize = 22;
            var maxCommentSize = 65535;
            var bufferSize = Math.min(eocdrWithoutCommentSize + maxCommentSize, totalSize);
            var buffer = newBuffer(bufferSize);
            var bufferReadStart = totalSize - buffer.length;
            readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, (function(err) {
                if (err) return callback(err);
                for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) {
                    if (buffer.readUInt32LE(i) !== 101010256) continue;
                    var eocdrBuffer = buffer.slice(i);
                    var diskNumber = eocdrBuffer.readUInt16LE(4);
                    if (diskNumber !== 0) {
                        return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
                    }
                    var entryCount = eocdrBuffer.readUInt16LE(10);
                    var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
                    var commentLength = eocdrBuffer.readUInt16LE(20);
                    var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
                    if (commentLength !== expectedCommentLength) {
                        return callback(new Error("invalid comment length. expected: " + expectedCommentLength + ". found: " + commentLength));
                    }
                    var comment = decodeStrings ? decodeBuffer(eocdrBuffer, 22, eocdrBuffer.length, false) : eocdrBuffer.slice(22);
                    if (!(entryCount === 65535 || centralDirectoryOffset === 4294967295)) {
                        return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
                    }
                    var zip64EocdlBuffer = newBuffer(20);
                    var zip64EocdlOffset = bufferReadStart + i - zip64EocdlBuffer.length;
                    readAndAssertNoEof(reader, zip64EocdlBuffer, 0, zip64EocdlBuffer.length, zip64EocdlOffset, (function(err) {
                        if (err) return callback(err);
                        if (zip64EocdlBuffer.readUInt32LE(0) !== 117853008) {
                            return callback(new Error("invalid zip64 end of central directory locator signature"));
                        }
                        var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
                        var zip64EocdrBuffer = newBuffer(56);
                        readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, (function(err) {
                            if (err) return callback(err);
                            if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
                                return callback(new Error("invalid zip64 end of central directory record signature"));
                            }
                            entryCount = readUInt64LE(zip64EocdrBuffer, 32);
                            centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
                            return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
                        }));
                    }));
                    return;
                }
                callback(new Error("end of central directory record signature not found"));
            }));
        }
        util.inherits(ZipFile, EventEmitter);
        function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
            var self = this;
            EventEmitter.call(self);
            self.reader = reader;
            self.reader.on("error", (function(err) {
                emitError(self, err);
            }));
            self.reader.once("close", (function() {
                self.emit("close");
            }));
            self.readEntryCursor = centralDirectoryOffset;
            self.fileSize = fileSize;
            self.entryCount = entryCount;
            self.comment = comment;
            self.entriesRead = 0;
            self.autoClose = !!autoClose;
            self.lazyEntries = !!lazyEntries;
            self.decodeStrings = !!decodeStrings;
            self.validateEntrySizes = !!validateEntrySizes;
            self.strictFileNames = !!strictFileNames;
            self.isOpen = true;
            self.emittedError = false;
            if (!self.lazyEntries) self._readEntry();
        }
        ZipFile.prototype.close = function() {
            if (!this.isOpen) return;
            this.isOpen = false;
            this.reader.unref();
        };
        function emitErrorAndAutoClose(self, err) {
            if (self.autoClose) self.close();
            emitError(self, err);
        }
        function emitError(self, err) {
            if (self.emittedError) return;
            self.emittedError = true;
            self.emit("error", err);
        }
        ZipFile.prototype.readEntry = function() {
            if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
            this._readEntry();
        };
        ZipFile.prototype._readEntry = function() {
            var self = this;
            if (self.entryCount === self.entriesRead) {
                setImmediate((function() {
                    if (self.autoClose) self.close();
                    if (self.emittedError) return;
                    self.emit("end");
                }));
                return;
            }
            if (self.emittedError) return;
            var buffer = newBuffer(46);
            readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, (function(err) {
                if (err) return emitErrorAndAutoClose(self, err);
                if (self.emittedError) return;
                var entry = new Entry;
                var signature = buffer.readUInt32LE(0);
                if (signature !== 33639248) return emitErrorAndAutoClose(self, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
                entry.versionMadeBy = buffer.readUInt16LE(4);
                entry.versionNeededToExtract = buffer.readUInt16LE(6);
                entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
                entry.compressionMethod = buffer.readUInt16LE(10);
                entry.lastModFileTime = buffer.readUInt16LE(12);
                entry.lastModFileDate = buffer.readUInt16LE(14);
                entry.crc32 = buffer.readUInt32LE(16);
                entry.compressedSize = buffer.readUInt32LE(20);
                entry.uncompressedSize = buffer.readUInt32LE(24);
                entry.fileNameLength = buffer.readUInt16LE(28);
                entry.extraFieldLength = buffer.readUInt16LE(30);
                entry.fileCommentLength = buffer.readUInt16LE(32);
                entry.internalFileAttributes = buffer.readUInt16LE(36);
                entry.externalFileAttributes = buffer.readUInt32LE(38);
                entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
                if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
                self.readEntryCursor += 46;
                buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
                readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, (function(err) {
                    if (err) return emitErrorAndAutoClose(self, err);
                    if (self.emittedError) return;
                    var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
                    entry.fileName = self.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf8) : buffer.slice(0, entry.fileNameLength);
                    var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
                    var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart);
                    entry.extraFields = [];
                    var i = 0;
                    while (i < extraFieldBuffer.length - 3) {
                        var headerId = extraFieldBuffer.readUInt16LE(i + 0);
                        var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
                        var dataStart = i + 4;
                        var dataEnd = dataStart + dataSize;
                        if (dataEnd > extraFieldBuffer.length) return emitErrorAndAutoClose(self, new Error("extra field length exceeds extra field buffer size"));
                        var dataBuffer = newBuffer(dataSize);
                        extraFieldBuffer.copy(dataBuffer, 0, dataStart, dataEnd);
                        entry.extraFields.push({
                            id: headerId,
                            data: dataBuffer
                        });
                        i = dataEnd;
                    }
                    entry.fileComment = self.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf8) : buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength);
                    entry.comment = entry.fileComment;
                    self.readEntryCursor += buffer.length;
                    self.entriesRead += 1;
                    if (entry.uncompressedSize === 4294967295 || entry.compressedSize === 4294967295 || entry.relativeOffsetOfLocalHeader === 4294967295) {
                        var zip64EiefBuffer = null;
                        for (var i = 0; i < entry.extraFields.length; i++) {
                            var extraField = entry.extraFields[i];
                            if (extraField.id === 1) {
                                zip64EiefBuffer = extraField.data;
                                break;
                            }
                        }
                        if (zip64EiefBuffer == null) {
                            return emitErrorAndAutoClose(self, new Error("expected zip64 extended information extra field"));
                        }
                        var index = 0;
                        if (entry.uncompressedSize === 4294967295) {
                            if (index + 8 > zip64EiefBuffer.length) {
                                return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include uncompressed size"));
                            }
                            entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
                            index += 8;
                        }
                        if (entry.compressedSize === 4294967295) {
                            if (index + 8 > zip64EiefBuffer.length) {
                                return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include compressed size"));
                            }
                            entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
                            index += 8;
                        }
                        if (entry.relativeOffsetOfLocalHeader === 4294967295) {
                            if (index + 8 > zip64EiefBuffer.length) {
                                return emitErrorAndAutoClose(self, new Error("zip64 extended information extra field does not include relative header offset"));
                            }
                            entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
                            index += 8;
                        }
                    }
                    if (self.decodeStrings) {
                        for (var i = 0; i < entry.extraFields.length; i++) {
                            var extraField = entry.extraFields[i];
                            if (extraField.id === 28789) {
                                if (extraField.data.length < 6) {
                                    continue;
                                }
                                if (extraField.data.readUInt8(0) !== 1) {
                                    continue;
                                }
                                var oldNameCrc32 = extraField.data.readUInt32LE(1);
                                if (crc32.unsigned(buffer.slice(0, entry.fileNameLength)) !== oldNameCrc32) {
                                    continue;
                                }
                                entry.fileName = decodeBuffer(extraField.data, 5, extraField.data.length, true);
                                break;
                            }
                        }
                    }
                    if (self.validateEntrySizes && entry.compressionMethod === 0) {
                        var expectedCompressedSize = entry.uncompressedSize;
                        if (entry.isEncrypted()) {
                            expectedCompressedSize += 12;
                        }
                        if (entry.compressedSize !== expectedCompressedSize) {
                            var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
                            return emitErrorAndAutoClose(self, new Error(msg));
                        }
                    }
                    if (self.decodeStrings) {
                        if (!self.strictFileNames) {
                            entry.fileName = entry.fileName.replace(/\\/g, "/");
                        }
                        var errorMessage = validateFileName(entry.fileName, self.validateFileNameOptions);
                        if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage));
                    }
                    self.emit("entry", entry);
                    if (!self.lazyEntries) self._readEntry();
                }));
            }));
        };
        ZipFile.prototype.openReadStream = function(entry, options, callback) {
            var self = this;
            var relativeStart = 0;
            var relativeEnd = entry.compressedSize;
            if (callback == null) {
                callback = options;
                options = {};
            } else {
                if (options.decrypt != null) {
                    if (!entry.isEncrypted()) {
                        throw new Error("options.decrypt can only be specified for encrypted entries");
                    }
                    if (options.decrypt !== false) throw new Error("invalid options.decrypt value: " + options.decrypt);
                    if (entry.isCompressed()) {
                        if (options.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false");
                    }
                }
                if (options.decompress != null) {
                    if (!entry.isCompressed()) {
                        throw new Error("options.decompress can only be specified for compressed entries");
                    }
                    if (!(options.decompress === false || options.decompress === true)) {
                        throw new Error("invalid options.decompress value: " + options.decompress);
                    }
                }
                if (options.start != null || options.end != null) {
                    if (entry.isCompressed() && options.decompress !== false) {
                        throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
                    }
                    if (entry.isEncrypted() && options.decrypt !== false) {
                        throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
                    }
                }
                if (options.start != null) {
                    relativeStart = options.start;
                    if (relativeStart < 0) throw new Error("options.start < 0");
                    if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
                }
                if (options.end != null) {
                    relativeEnd = options.end;
                    if (relativeEnd < 0) throw new Error("options.end < 0");
                    if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
                    if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
                }
            }
            if (!self.isOpen) return callback(new Error("closed"));
            if (entry.isEncrypted()) {
                if (options.decrypt !== false) return callback(new Error("entry is encrypted, and options.decrypt !== false"));
            }
            self.reader.ref();
            var buffer = newBuffer(30);
            readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, (function(err) {
                try {
                    if (err) return callback(err);
                    var signature = buffer.readUInt32LE(0);
                    if (signature !== 67324752) {
                        return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
                    }
                    var fileNameLength = buffer.readUInt16LE(26);
                    var extraFieldLength = buffer.readUInt16LE(28);
                    var localFileHeaderEnd = entry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength;
                    var decompress;
                    if (entry.compressionMethod === 0) {
                        decompress = false;
                    } else if (entry.compressionMethod === 8) {
                        decompress = options.decompress != null ? options.decompress : true;
                    } else {
                        return callback(new Error("unsupported compression method: " + entry.compressionMethod));
                    }
                    var fileDataStart = localFileHeaderEnd;
                    var fileDataEnd = fileDataStart + entry.compressedSize;
                    if (entry.compressedSize !== 0) {
                        if (fileDataEnd > self.fileSize) {
                            return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
                        }
                    }
                    var readStream = self.reader.createReadStream({
                        start: fileDataStart + relativeStart,
                        end: fileDataStart + relativeEnd
                    });
                    var endpointStream = readStream;
                    if (decompress) {
                        var destroyed = false;
                        var inflateFilter = zlib.createInflateRaw();
                        readStream.on("error", (function(err) {
                            setImmediate((function() {
                                if (!destroyed) inflateFilter.emit("error", err);
                            }));
                        }));
                        readStream.pipe(inflateFilter);
                        if (self.validateEntrySizes) {
                            endpointStream = new AssertByteCountStream(entry.uncompressedSize);
                            inflateFilter.on("error", (function(err) {
                                setImmediate((function() {
                                    if (!destroyed) endpointStream.emit("error", err);
                                }));
                            }));
                            inflateFilter.pipe(endpointStream);
                        } else {
                            endpointStream = inflateFilter;
                        }
                        endpointStream.destroy = function() {
                            destroyed = true;
                            if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
                            readStream.unpipe(inflateFilter);
                            readStream.destroy();
                        };
                    }
                    callback(null, endpointStream);
                } finally {
                    self.reader.unref();
                }
            }));
        };
        function Entry() {}
        Entry.prototype.getLastModDate = function() {
            return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime);
        };
        Entry.prototype.isEncrypted = function() {
            return (this.generalPurposeBitFlag & 1) !== 0;
        };
        Entry.prototype.isCompressed = function() {
            return this.compressionMethod === 8;
        };
        function dosDateTimeToDate(date, time) {
            var day = date & 31;
            var month = (date >> 5 & 15) - 1;
            var year = (date >> 9 & 127) + 1980;
            var millisecond = 0;
            var second = (time & 31) * 2;
            var minute = time >> 5 & 63;
            var hour = time >> 11 & 31;
            return new Date(year, month, day, hour, minute, second, millisecond);
        }
        function validateFileName(fileName) {
            if (fileName.indexOf("\\") !== -1) {
                return "invalid characters in fileName: " + fileName;
            }
            if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
                return "absolute path: " + fileName;
            }
            if (fileName.split("/").indexOf("..") !== -1) {
                return "invalid relative path: " + fileName;
            }
            return null;
        }
        function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
            if (length === 0) {
                return setImmediate((function() {
                    callback(null, newBuffer(0));
                }));
            }
            reader.read(buffer, offset, length, position, (function(err, bytesRead) {
                if (err) return callback(err);
                if (bytesRead < length) {
                    return callback(new Error("unexpected EOF"));
                }
                callback();
            }));
        }
        util.inherits(AssertByteCountStream, Transform);
        function AssertByteCountStream(byteCount) {
            Transform.call(this);
            this.actualByteCount = 0;
            this.expectedByteCount = byteCount;
        }
        AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
            this.actualByteCount += chunk.length;
            if (this.actualByteCount > this.expectedByteCount) {
                var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
                return cb(new Error(msg));
            }
            cb(null, chunk);
        };
        AssertByteCountStream.prototype._flush = function(cb) {
            if (this.actualByteCount < this.expectedByteCount) {
                var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
                return cb(new Error(msg));
            }
            cb();
        };
        util.inherits(RandomAccessReader, EventEmitter);
        function RandomAccessReader() {
            EventEmitter.call(this);
            this.refCount = 0;
        }
        RandomAccessReader.prototype.ref = function() {
            this.refCount += 1;
        };
        RandomAccessReader.prototype.unref = function() {
            var self = this;
            self.refCount -= 1;
            if (self.refCount > 0) return;
            if (self.refCount < 0) throw new Error("invalid unref");
            self.close(onCloseDone);
            function onCloseDone(err) {
                if (err) return self.emit("error", err);
                self.emit("close");
            }
        };
        RandomAccessReader.prototype.createReadStream = function(options) {
            var start = options.start;
            var end = options.end;
            if (start === end) {
                var emptyStream = new PassThrough;
                setImmediate((function() {
                    emptyStream.end();
                }));
                return emptyStream;
            }
            var stream = this._readStreamForRange(start, end);
            var destroyed = false;
            var refUnrefFilter = new RefUnrefFilter(this);
            stream.on("error", (function(err) {
                setImmediate((function() {
                    if (!destroyed) refUnrefFilter.emit("error", err);
                }));
            }));
            refUnrefFilter.destroy = function() {
                stream.unpipe(refUnrefFilter);
                refUnrefFilter.unref();
                stream.destroy();
            };
            var byteCounter = new AssertByteCountStream(end - start);
            refUnrefFilter.on("error", (function(err) {
                setImmediate((function() {
                    if (!destroyed) byteCounter.emit("error", err);
                }));
            }));
            byteCounter.destroy = function() {
                destroyed = true;
                refUnrefFilter.unpipe(byteCounter);
                refUnrefFilter.destroy();
            };
            return stream.pipe(refUnrefFilter).pipe(byteCounter);
        };
        RandomAccessReader.prototype._readStreamForRange = function(start, end) {
            throw new Error("not implemented");
        };
        RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
            var readStream = this.createReadStream({
                start: position,
                end: position + length
            });
            var writeStream = new Writable;
            var written = 0;
            writeStream._write = function(chunk, encoding, cb) {
                chunk.copy(buffer, offset + written, 0, chunk.length);
                written += chunk.length;
                cb();
            };
            writeStream.on("finish", callback);
            readStream.on("error", (function(error) {
                callback(error);
            }));
            readStream.pipe(writeStream);
        };
        RandomAccessReader.prototype.close = function(callback) {
            setImmediate(callback);
        };
        util.inherits(RefUnrefFilter, PassThrough);
        function RefUnrefFilter(context) {
            PassThrough.call(this);
            this.context = context;
            this.context.ref();
            this.unreffedYet = false;
        }
        RefUnrefFilter.prototype._flush = function(cb) {
            this.unref();
            cb();
        };
        RefUnrefFilter.prototype.unref = function(cb) {
            if (this.unreffedYet) return;
            this.unreffedYet = true;
            this.context.unref();
        };
        var cp437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñÑªº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";
        function decodeBuffer(buffer, start, end, isUtf8) {
            if (isUtf8) {
                return buffer.toString("utf8", start, end);
            } else {
                var result = "";
                for (var i = start; i < end; i++) {
                    result += cp437[buffer[i]];
                }
                return result;
            }
        }
        function readUInt64LE(buffer, offset) {
            var lower32 = buffer.readUInt32LE(offset);
            var upper32 = buffer.readUInt32LE(offset + 4);
            return upper32 * 4294967296 + lower32;
        }
        var newBuffer;
        if (typeof Buffer.allocUnsafe === "function") {
            newBuffer = function(len) {
                return Buffer.allocUnsafe(len);
            };
        } else {
            newBuffer = function(len) {
                return new Buffer(len);
            };
        }
        function defaultCallback(err) {
            if (err) throw err;
        }
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        var fs = __webpack_require__(5);
        var util = __webpack_require__(14);
        var stream = __webpack_require__(17);
        var Readable = stream.Readable;
        var Writable = stream.Writable;
        var PassThrough = stream.PassThrough;
        var Pend = __webpack_require__(206);
        var EventEmitter = __webpack_require__(41).EventEmitter;
        exports.createFromBuffer = createFromBuffer;
        exports.createFromFd = createFromFd;
        exports.BufferSlicer = BufferSlicer;
        exports.FdSlicer = FdSlicer;
        util.inherits(FdSlicer, EventEmitter);
        function FdSlicer(fd, options) {
            options = options || {};
            EventEmitter.call(this);
            this.fd = fd;
            this.pend = new Pend;
            this.pend.max = 1;
            this.refCount = 0;
            this.autoClose = !!options.autoClose;
        }
        FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
            var self = this;
            self.pend.go((function(cb) {
                fs.read(self.fd, buffer, offset, length, position, (function(err, bytesRead, buffer) {
                    cb();
                    callback(err, bytesRead, buffer);
                }));
            }));
        };
        FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
            var self = this;
            self.pend.go((function(cb) {
                fs.write(self.fd, buffer, offset, length, position, (function(err, written, buffer) {
                    cb();
                    callback(err, written, buffer);
                }));
            }));
        };
        FdSlicer.prototype.createReadStream = function(options) {
            return new ReadStream(this, options);
        };
        FdSlicer.prototype.createWriteStream = function(options) {
            return new WriteStream(this, options);
        };
        FdSlicer.prototype.ref = function() {
            this.refCount += 1;
        };
        FdSlicer.prototype.unref = function() {
            var self = this;
            self.refCount -= 1;
            if (self.refCount > 0) return;
            if (self.refCount < 0) throw new Error("invalid unref");
            if (self.autoClose) {
                fs.close(self.fd, onCloseDone);
            }
            function onCloseDone(err) {
                if (err) {
                    self.emit("error", err);
                } else {
                    self.emit("close");
                }
            }
        };
        util.inherits(ReadStream, Readable);
        function ReadStream(context, options) {
            options = options || {};
            Readable.call(this, options);
            this.context = context;
            this.context.ref();
            this.start = options.start || 0;
            this.endOffset = options.end;
            this.pos = this.start;
            this.destroyed = false;
        }
        ReadStream.prototype._read = function(n) {
            var self = this;
            if (self.destroyed) return;
            var toRead = Math.min(self._readableState.highWaterMark, n);
            if (self.endOffset != null) {
                toRead = Math.min(toRead, self.endOffset - self.pos);
            }
            if (toRead <= 0) {
                self.destroyed = true;
                self.push(null);
                self.context.unref();
                return;
            }
            self.context.pend.go((function(cb) {
                if (self.destroyed) return cb();
                var buffer = new Buffer(toRead);
                fs.read(self.context.fd, buffer, 0, toRead, self.pos, (function(err, bytesRead) {
                    if (err) {
                        self.destroy(err);
                    } else if (bytesRead === 0) {
                        self.destroyed = true;
                        self.push(null);
                        self.context.unref();
                    } else {
                        self.pos += bytesRead;
                        self.push(buffer.slice(0, bytesRead));
                    }
                    cb();
                }));
            }));
        };
        ReadStream.prototype.destroy = function(err) {
            if (this.destroyed) return;
            err = err || new Error("stream destroyed");
            this.destroyed = true;
            this.emit("error", err);
            this.context.unref();
        };
        util.inherits(WriteStream, Writable);
        function WriteStream(context, options) {
            options = options || {};
            Writable.call(this, options);
            this.context = context;
            this.context.ref();
            this.start = options.start || 0;
            this.endOffset = options.end == null ? Infinity : +options.end;
            this.bytesWritten = 0;
            this.pos = this.start;
            this.destroyed = false;
            this.on("finish", this.destroy.bind(this));
        }
        WriteStream.prototype._write = function(buffer, encoding, callback) {
            var self = this;
            if (self.destroyed) return;
            if (self.pos + buffer.length > self.endOffset) {
                var err = new Error("maximum file length exceeded");
                err.code = "ETOOBIG";
                self.destroy();
                callback(err);
                return;
            }
            self.context.pend.go((function(cb) {
                if (self.destroyed) return cb();
                fs.write(self.context.fd, buffer, 0, buffer.length, self.pos, (function(err, bytes) {
                    if (err) {
                        self.destroy();
                        cb();
                        callback(err);
                    } else {
                        self.bytesWritten += bytes;
                        self.pos += bytes;
                        self.emit("progress");
                        cb();
                        callback();
                    }
                }));
            }));
        };
        WriteStream.prototype.destroy = function() {
            if (this.destroyed) return;
            this.destroyed = true;
            this.context.unref();
        };
        util.inherits(BufferSlicer, EventEmitter);
        function BufferSlicer(buffer, options) {
            EventEmitter.call(this);
            options = options || {};
            this.refCount = 0;
            this.buffer = buffer;
            this.maxChunkSize = options.maxChunkSize || Number.MAX_SAFE_INTEGER;
        }
        BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
            var end = position + length;
            var delta = end - this.buffer.length;
            var written = delta > 0 ? delta : length;
            this.buffer.copy(buffer, offset, position, end);
            setImmediate((function() {
                callback(null, written);
            }));
        };
        BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
            buffer.copy(this.buffer, position, offset, offset + length);
            setImmediate((function() {
                callback(null, length, buffer);
            }));
        };
        BufferSlicer.prototype.createReadStream = function(options) {
            options = options || {};
            var readStream = new PassThrough(options);
            readStream.destroyed = false;
            readStream.start = options.start || 0;
            readStream.endOffset = options.end;
            readStream.pos = readStream.endOffset || this.buffer.length;
            var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
            var offset = 0;
            while (true) {
                var nextOffset = offset + this.maxChunkSize;
                if (nextOffset >= entireSlice.length) {
                    if (offset < entireSlice.length) {
                        readStream.write(entireSlice.slice(offset, entireSlice.length));
                    }
                    break;
                }
                readStream.write(entireSlice.slice(offset, nextOffset));
                offset = nextOffset;
            }
            readStream.end();
            readStream.destroy = function() {
                readStream.destroyed = true;
            };
            return readStream;
        };
        BufferSlicer.prototype.createWriteStream = function(options) {
            var bufferSlicer = this;
            options = options || {};
            var writeStream = new Writable(options);
            writeStream.start = options.start || 0;
            writeStream.endOffset = options.end == null ? this.buffer.length : +options.end;
            writeStream.bytesWritten = 0;
            writeStream.pos = writeStream.start;
            writeStream.destroyed = false;
            writeStream._write = function(buffer, encoding, callback) {
                if (writeStream.destroyed) return;
                var end = writeStream.pos + buffer.length;
                if (end > writeStream.endOffset) {
                    var err = new Error("maximum file length exceeded");
                    err.code = "ETOOBIG";
                    writeStream.destroyed = true;
                    callback(err);
                    return;
                }
                buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
                writeStream.bytesWritten += buffer.length;
                writeStream.pos = end;
                writeStream.emit("progress");
                callback();
            };
            writeStream.destroy = function() {
                writeStream.destroyed = true;
            };
            return writeStream;
        };
        BufferSlicer.prototype.ref = function() {
            this.refCount += 1;
        };
        BufferSlicer.prototype.unref = function() {
            this.refCount -= 1;
            if (this.refCount < 0) {
                throw new Error("invalid unref");
            }
        };
        function createFromBuffer(buffer, options) {
            return new BufferSlicer(buffer, options);
        }
        function createFromFd(fd, options) {
            return new FdSlicer(fd, options);
        }
    }, module => {
        module.exports = Pend;
        function Pend() {
            this.pending = 0;
            this.max = Infinity;
            this.listeners = [];
            this.waiting = [];
            this.error = null;
        }
        Pend.prototype.go = function(fn) {
            if (this.pending < this.max) {
                pendGo(this, fn);
            } else {
                this.waiting.push(fn);
            }
        };
        Pend.prototype.wait = function(cb) {
            if (this.pending === 0) {
                cb(this.error);
            } else {
                this.listeners.push(cb);
            }
        };
        Pend.prototype.hold = function() {
            return pendHold(this);
        };
        function pendHold(self) {
            self.pending += 1;
            var called = false;
            return onCb;
            function onCb(err) {
                if (called) throw new Error("callback called twice");
                called = true;
                self.error = self.error || err;
                self.pending -= 1;
                if (self.waiting.length > 0 && self.pending < self.max) {
                    pendGo(self, self.waiting.shift());
                } else if (self.pending === 0) {
                    var listeners = self.listeners;
                    self.listeners = [];
                    listeners.forEach(cbListener);
                }
            }
            function cbListener(listener) {
                listener(self.error);
            }
        }
        function pendGo(self, fn) {
            fn(pendHold(self));
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Buffer = __webpack_require__(102).Buffer;
        var CRC_TABLE = [ 0, 1996959894, 3993919788, 2567524794, 124634137, 1886057615, 3915621685, 2657392035, 249268274, 2044508324, 3772115230, 2547177864, 162941995, 2125561021, 3887607047, 2428444049, 498536548, 1789927666, 4089016648, 2227061214, 450548861, 1843258603, 4107580753, 2211677639, 325883990, 1684777152, 4251122042, 2321926636, 335633487, 1661365465, 4195302755, 2366115317, 997073096, 1281953886, 3579855332, 2724688242, 1006888145, 1258607687, 3524101629, 2768942443, 901097722, 1119000684, 3686517206, 2898065728, 853044451, 1172266101, 3705015759, 2882616665, 651767980, 1373503546, 3369554304, 3218104598, 565507253, 1454621731, 3485111705, 3099436303, 671266974, 1594198024, 3322730930, 2970347812, 795835527, 1483230225, 3244367275, 3060149565, 1994146192, 31158534, 2563907772, 4023717930, 1907459465, 112637215, 2680153253, 3904427059, 2013776290, 251722036, 2517215374, 3775830040, 2137656763, 141376813, 2439277719, 3865271297, 1802195444, 476864866, 2238001368, 4066508878, 1812370925, 453092731, 2181625025, 4111451223, 1706088902, 314042704, 2344532202, 4240017532, 1658658271, 366619977, 2362670323, 4224994405, 1303535960, 984961486, 2747007092, 3569037538, 1256170817, 1037604311, 2765210733, 3554079995, 1131014506, 879679996, 2909243462, 3663771856, 1141124467, 855842277, 2852801631, 3708648649, 1342533948, 654459306, 3188396048, 3373015174, 1466479909, 544179635, 3110523913, 3462522015, 1591671054, 702138776, 2966460450, 3352799412, 1504918807, 783551873, 3082640443, 3233442989, 3988292384, 2596254646, 62317068, 1957810842, 3939845945, 2647816111, 81470997, 1943803523, 3814918930, 2489596804, 225274430, 2053790376, 3826175755, 2466906013, 167816743, 2097651377, 4027552580, 2265490386, 503444072, 1762050814, 4150417245, 2154129355, 426522225, 1852507879, 4275313526, 2312317920, 282753626, 1742555852, 4189708143, 2394877945, 397917763, 1622183637, 3604390888, 2714866558, 953729732, 1340076626, 3518719985, 2797360999, 1068828381, 1219638859, 3624741850, 2936675148, 906185462, 1090812512, 3747672003, 2825379669, 829329135, 1181335161, 3412177804, 3160834842, 628085408, 1382605366, 3423369109, 3138078467, 570562233, 1426400815, 3317316542, 2998733608, 733239954, 1555261956, 3268935591, 3050360625, 752459403, 1541320221, 2607071920, 3965973030, 1969922972, 40735498, 2617837225, 3943577151, 1913087877, 83908371, 2512341634, 3803740692, 2075208622, 213261112, 2463272603, 3855990285, 2094854071, 198958881, 2262029012, 4057260610, 1759359992, 534414190, 2176718541, 4139329115, 1873836001, 414664567, 2282248934, 4279200368, 1711684554, 285281116, 2405801727, 4167216745, 1634467795, 376229701, 2685067896, 3608007406, 1308918612, 956543938, 2808555105, 3495958263, 1231636301, 1047427035, 2932959818, 3654703836, 1088359270, 936918e3, 2847714899, 3736837829, 1202900863, 817233897, 3183342108, 3401237130, 1404277552, 615818150, 3134207493, 3453421203, 1423857449, 601450431, 3009837614, 3294710456, 1567103746, 711928724, 3020668471, 3272380065, 1510334235, 755167117 ];
        if (typeof Int32Array !== "undefined") {
            CRC_TABLE = new Int32Array(CRC_TABLE);
        }
        function ensureBuffer(input) {
            if (Buffer.isBuffer(input)) {
                return input;
            }
            var hasNewBufferAPI = typeof Buffer.alloc === "function" && typeof Buffer.from === "function";
            if (typeof input === "number") {
                return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);
            } else if (typeof input === "string") {
                return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);
            } else {
                throw new Error("input must be buffer, number, or string, received " + typeof input);
            }
        }
        function bufferizeInt(num) {
            var tmp = ensureBuffer(4);
            tmp.writeInt32BE(num, 0);
            return tmp;
        }
        function _crc32(buf, previous) {
            buf = ensureBuffer(buf);
            if (Buffer.isBuffer(previous)) {
                previous = previous.readUInt32BE(0);
            }
            var crc = ~~previous ^ -1;
            for (var n = 0; n < buf.length; n++) {
                crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
            }
            return crc ^ -1;
        }
        function crc32() {
            return bufferizeInt(_crc32.apply(null, arguments));
        }
        crc32.signed = function() {
            return _crc32.apply(null, arguments);
        };
        crc32.unsigned = function() {
            return _crc32.apply(null, arguments) >>> 0;
        };
        module.exports = crc32;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.getFileStreamFromZipStream = void 0;
        const unzip = __webpack_require__(209);
        const constants_1 = __webpack_require__(18);
        const getFileStreamFromZipStream = async (zipStream, match) => await new Promise(((resolve, reject) => {
            let found = false;
            zipStream.on("error", reject);
            const unzipper = unzip.Parse();
            unzipper.on("error", reject);
            zipStream.pipe(unzipper);
            unzipper.on("entry", (entry => {
                if (!found && entry.type === "File" && match(entry.path)) {
                    found = true;
                    if (entry.size !== undefined) {
                        entry.compressedSize = unzipper.unzipStream.parsedEntity.compressedSize;
                    }
                    entry.on("end", (() => {
                        var _a, _b;
                        (_a = zipStream.unpipe) === null || _a === void 0 ? void 0 : _a.call(zipStream, unzipper);
                        (_b = zipStream.destroy) === null || _b === void 0 ? void 0 : _b.call(zipStream);
                    }));
                    resolve(entry);
                } else {
                    entry.autodrain();
                }
            }));
            zipStream.on("end", (() => {
                if (!found) {
                    reject(new Error(constants_1.NO_MATCHING_FILE_MSG));
                }
            }));
        }));
        exports.getFileStreamFromZipStream = getFileStreamFromZipStream;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        exports.Parse = __webpack_require__(210);
        exports.Extract = __webpack_require__(219);
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Transform = __webpack_require__(17).Transform;
        var util = __webpack_require__(14);
        var UnzipStream = __webpack_require__(211);
        function ParserStream(opts) {
            if (!(this instanceof ParserStream)) {
                return new ParserStream(opts);
            }
            var transformOpts = opts || {};
            Transform.call(this, {
                readableObjectMode: true
            });
            this.opts = opts || {};
            this.unzipStream = new UnzipStream(this.opts);
            var self = this;
            this.unzipStream.on("entry", (function(entry) {
                self.push(entry);
            }));
            this.unzipStream.on("error", (function(error) {
                self.emit("error", error);
            }));
        }
        util.inherits(ParserStream, Transform);
        ParserStream.prototype._transform = function(chunk, encoding, cb) {
            this.unzipStream.write(chunk, encoding, cb);
        };
        ParserStream.prototype._flush = function(cb) {
            var self = this;
            this.unzipStream.end((function() {
                process.nextTick((function() {
                    self.emit("close");
                }));
                cb();
            }));
        };
        ParserStream.prototype.on = function(eventName, fn) {
            if (eventName === "entry") {
                return Transform.prototype.on.call(this, "data", fn);
            }
            return Transform.prototype.on.call(this, eventName, fn);
        };
        ParserStream.prototype.drainAll = function() {
            this.unzipStream.drainAll();
            return this.pipe(new Transform({
                objectMode: true,
                transform: function(d, e, cb) {
                    cb();
                }
            }));
        };
        module.exports = ParserStream;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var binary = __webpack_require__(212);
        var stream = __webpack_require__(17);
        var util = __webpack_require__(14);
        var zlib = __webpack_require__(89);
        var MatcherStream = __webpack_require__(217);
        var Entry = __webpack_require__(218);
        const states = {
            STREAM_START: 0,
            START: 1,
            LOCAL_FILE_HEADER: 2,
            LOCAL_FILE_HEADER_SUFFIX: 3,
            FILE_DATA: 4,
            FILE_DATA_END: 5,
            DATA_DESCRIPTOR: 6,
            CENTRAL_DIRECTORY_FILE_HEADER: 7,
            CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX: 8,
            CDIR64_END: 9,
            CDIR64_END_DATA_SECTOR: 10,
            CDIR64_LOCATOR: 11,
            CENTRAL_DIRECTORY_END: 12,
            CENTRAL_DIRECTORY_END_COMMENT: 13,
            TRAILING_JUNK: 14,
            ERROR: 99
        };
        const FOUR_GIGS = 4294967296;
        const SIG_LOCAL_FILE_HEADER = 67324752;
        const SIG_DATA_DESCRIPTOR = 134695760;
        const SIG_CDIR_RECORD = 33639248;
        const SIG_CDIR64_RECORD_END = 101075792;
        const SIG_CDIR64_LOCATOR_END = 117853008;
        const SIG_CDIR_RECORD_END = 101010256;
        function UnzipStream(options) {
            if (!(this instanceof UnzipStream)) {
                return new UnzipStream(options);
            }
            stream.Transform.call(this);
            this.options = options || {};
            this.data = new Buffer("");
            this.state = states.STREAM_START;
            this.skippedBytes = 0;
            this.parsedEntity = null;
            this.outStreamInfo = {};
        }
        util.inherits(UnzipStream, stream.Transform);
        UnzipStream.prototype.processDataChunk = function(chunk) {
            var requiredLength;
            switch (this.state) {
              case states.STREAM_START:
              case states.START:
                requiredLength = 4;
                break;

              case states.LOCAL_FILE_HEADER:
                requiredLength = 26;
                break;

              case states.LOCAL_FILE_HEADER_SUFFIX:
                requiredLength = this.parsedEntity.fileNameLength + this.parsedEntity.extraFieldLength;
                break;

              case states.DATA_DESCRIPTOR:
                requiredLength = 12;
                break;

              case states.CENTRAL_DIRECTORY_FILE_HEADER:
                requiredLength = 42;
                break;

              case states.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:
                requiredLength = this.parsedEntity.fileNameLength + this.parsedEntity.extraFieldLength + this.parsedEntity.fileCommentLength;
                break;

              case states.CDIR64_END:
                requiredLength = 52;
                break;

              case states.CDIR64_END_DATA_SECTOR:
                requiredLength = this.parsedEntity.centralDirectoryRecordSize - 44;
                break;

              case states.CDIR64_LOCATOR:
                requiredLength = 16;
                break;

              case states.CENTRAL_DIRECTORY_END:
                requiredLength = 18;
                break;

              case states.CENTRAL_DIRECTORY_END_COMMENT:
                requiredLength = this.parsedEntity.commentLength;
                break;

              case states.FILE_DATA:
                return 0;

              case states.FILE_DATA_END:
                return 0;

              case states.TRAILING_JUNK:
                if (this.options.debug) console.log("found", chunk.length, "bytes of TRAILING_JUNK");
                return chunk.length;

              default:
                return chunk.length;
            }
            var chunkLength = chunk.length;
            if (chunkLength < requiredLength) {
                return 0;
            }
            switch (this.state) {
              case states.STREAM_START:
              case states.START:
                var signature = chunk.readUInt32LE(0);
                switch (signature) {
                  case SIG_LOCAL_FILE_HEADER:
                    this.state = states.LOCAL_FILE_HEADER;
                    break;

                  case SIG_CDIR_RECORD:
                    this.state = states.CENTRAL_DIRECTORY_FILE_HEADER;
                    break;

                  case SIG_CDIR64_RECORD_END:
                    this.state = states.CDIR64_END;
                    break;

                  case SIG_CDIR64_LOCATOR_END:
                    this.state = states.CDIR64_LOCATOR;
                    break;

                  case SIG_CDIR_RECORD_END:
                    this.state = states.CENTRAL_DIRECTORY_END;
                    break;

                  default:
                    var isStreamStart = this.state === states.STREAM_START;
                    if (!isStreamStart && (signature & 65535) !== 19280 && this.skippedBytes < 26) {
                        var remaining = signature;
                        var toSkip = 4;
                        for (var i = 1; i < 4 && remaining !== 0; i++) {
                            remaining = remaining >>> 8;
                            if ((remaining & 255) === 80) {
                                toSkip = i;
                                break;
                            }
                        }
                        this.skippedBytes += toSkip;
                        if (this.options.debug) console.log("Skipped", this.skippedBytes, "bytes");
                        return toSkip;
                    }
                    this.state = states.ERROR;
                    var errMsg = isStreamStart ? "Not a valid zip file" : "Invalid signature in zip file";
                    if (this.options.debug) {
                        var sig = chunk.readUInt32LE(0);
                        var asString;
                        try {
                            asString = chunk.slice(0, 4).toString();
                        } catch (e) {}
                        console.log("Unexpected signature in zip file: 0x" + sig.toString(16), '"' + asString + '", skipped', this.skippedBytes, "bytes");
                    }
                    this.emit("error", new Error(errMsg));
                    return chunk.length;
                }
                this.skippedBytes = 0;
                return requiredLength;

              case states.LOCAL_FILE_HEADER:
                this.parsedEntity = this._readFile(chunk);
                this.state = states.LOCAL_FILE_HEADER_SUFFIX;
                return requiredLength;

              case states.LOCAL_FILE_HEADER_SUFFIX:
                var entry = new Entry;
                var isUtf8 = (this.parsedEntity.flags & 2048) !== 0;
                entry.path = this._decodeString(chunk.slice(0, this.parsedEntity.fileNameLength), isUtf8);
                var extraDataBuffer = chunk.slice(this.parsedEntity.fileNameLength, this.parsedEntity.fileNameLength + this.parsedEntity.extraFieldLength);
                var extra = this._readExtraFields(extraDataBuffer);
                if (extra && extra.parsed) {
                    if (extra.parsed.path && !isUtf8) {
                        entry.path = extra.parsed.path;
                    }
                    if (Number.isFinite(extra.parsed.uncompressedSize) && this.parsedEntity.uncompressedSize === FOUR_GIGS - 1) {
                        this.parsedEntity.uncompressedSize = extra.parsed.uncompressedSize;
                    }
                    if (Number.isFinite(extra.parsed.compressedSize) && this.parsedEntity.compressedSize === FOUR_GIGS - 1) {
                        this.parsedEntity.compressedSize = extra.parsed.compressedSize;
                    }
                }
                this.parsedEntity.extra = extra.parsed || {};
                if (this.options.debug) {
                    const debugObj = Object.assign({}, this.parsedEntity, {
                        path: entry.path,
                        flags: "0x" + this.parsedEntity.flags.toString(16),
                        extraFields: extra && extra.debug
                    });
                    console.log("decoded LOCAL_FILE_HEADER:", JSON.stringify(debugObj, null, 2));
                }
                this._prepareOutStream(this.parsedEntity, entry);
                this.emit("entry", entry);
                this.state = states.FILE_DATA;
                return requiredLength;

              case states.CENTRAL_DIRECTORY_FILE_HEADER:
                this.parsedEntity = this._readCentralDirectoryEntry(chunk);
                this.state = states.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX;
                return requiredLength;

              case states.CENTRAL_DIRECTORY_FILE_HEADER_SUFFIX:
                var isUtf8 = (this.parsedEntity.flags & 2048) !== 0;
                var path = this._decodeString(chunk.slice(0, this.parsedEntity.fileNameLength), isUtf8);
                var extraDataBuffer = chunk.slice(this.parsedEntity.fileNameLength, this.parsedEntity.fileNameLength + this.parsedEntity.extraFieldLength);
                var extra = this._readExtraFields(extraDataBuffer);
                if (extra && extra.parsed && extra.parsed.path && !isUtf8) {
                    path = extra.parsed.path;
                }
                this.parsedEntity.extra = extra.parsed;
                var isUnix = (this.parsedEntity.versionMadeBy & 65280) >> 8 === 3;
                var unixAttrs, isSymlink;
                if (isUnix) {
                    unixAttrs = this.parsedEntity.externalFileAttributes >>> 16;
                    var fileType = unixAttrs >>> 12;
                    isSymlink = (fileType & 10) === 10;
                }
                if (this.options.debug) {
                    const debugObj = Object.assign({}, this.parsedEntity, {
                        path,
                        flags: "0x" + this.parsedEntity.flags.toString(16),
                        unixAttrs: unixAttrs && "0" + unixAttrs.toString(8),
                        isSymlink,
                        extraFields: extra.debug
                    });
                    console.log("decoded CENTRAL_DIRECTORY_FILE_HEADER:", JSON.stringify(debugObj, null, 2));
                }
                this.state = states.START;
                return requiredLength;

              case states.CDIR64_END:
                this.parsedEntity = this._readEndOfCentralDirectory64(chunk);
                if (this.options.debug) {
                    console.log("decoded CDIR64_END_RECORD:", this.parsedEntity);
                }
                this.state = states.CDIR64_END_DATA_SECTOR;
                return requiredLength;

              case states.CDIR64_END_DATA_SECTOR:
                this.state = states.START;
                return requiredLength;

              case states.CDIR64_LOCATOR:
                this.state = states.START;
                return requiredLength;

              case states.CENTRAL_DIRECTORY_END:
                this.parsedEntity = this._readEndOfCentralDirectory(chunk);
                if (this.options.debug) {
                    console.log("decoded CENTRAL_DIRECTORY_END:", this.parsedEntity);
                }
                this.state = states.CENTRAL_DIRECTORY_END_COMMENT;
                return requiredLength;

              case states.CENTRAL_DIRECTORY_END_COMMENT:
                if (this.options.debug) {
                    console.log("decoded CENTRAL_DIRECTORY_END_COMMENT:", chunk.slice(0, requiredLength).toString());
                }
                this.state = states.TRAILING_JUNK;
                return requiredLength;

              case states.ERROR:
                return chunk.length;

              default:
                console.log("didn't handle state #", this.state, "discarding");
                return chunk.length;
            }
        };
        UnzipStream.prototype._prepareOutStream = function(vars, entry) {
            var self = this;
            var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path);
            entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, "");
            entry.type = isDirectory ? "Directory" : "File";
            entry.isDirectory = isDirectory;
            var fileSizeKnown = !(vars.flags & 8);
            if (fileSizeKnown) {
                entry.size = vars.uncompressedSize;
            }
            var isVersionSupported = vars.versionsNeededToExtract <= 45;
            this.outStreamInfo = {
                stream: null,
                limit: fileSizeKnown ? vars.compressedSize : -1,
                written: 0
            };
            if (!fileSizeKnown) {
                var pattern = new Buffer(4);
                pattern.writeUInt32LE(SIG_DATA_DESCRIPTOR, 0);
                var zip64Mode = vars.extra.zip64Mode;
                var extraSize = zip64Mode ? 20 : 12;
                var searchPattern = {
                    pattern,
                    requiredExtraSize: extraSize
                };
                var matcherStream = new MatcherStream(searchPattern, (function(matchedChunk, sizeSoFar) {
                    var vars = self._readDataDescriptor(matchedChunk, zip64Mode);
                    var compressedSizeMatches = vars.compressedSize === sizeSoFar;
                    if (!zip64Mode && !compressedSizeMatches && sizeSoFar >= FOUR_GIGS) {
                        var overflown = sizeSoFar - FOUR_GIGS;
                        while (overflown >= 0) {
                            compressedSizeMatches = vars.compressedSize === overflown;
                            if (compressedSizeMatches) break;
                            overflown -= FOUR_GIGS;
                        }
                    }
                    if (!compressedSizeMatches) {
                        return;
                    }
                    self.state = states.FILE_DATA_END;
                    var sliceOffset = zip64Mode ? 24 : 16;
                    if (self.data.length > 0) {
                        self.data = Buffer.concat([ matchedChunk.slice(sliceOffset), self.data ]);
                    } else {
                        self.data = matchedChunk.slice(sliceOffset);
                    }
                    return true;
                }));
                this.outStreamInfo.stream = matcherStream;
            } else {
                this.outStreamInfo.stream = new stream.PassThrough;
            }
            var isEncrypted = vars.flags & 1 || vars.flags & 64;
            if (isEncrypted || !isVersionSupported) {
                var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported";
                entry.skip = true;
                setImmediate((() => {
                    entry.emit("error", new Error(message));
                }));
                this.outStreamInfo.stream.pipe((new Entry).autodrain());
                return;
            }
            var isCompressed = vars.compressionMethod > 0;
            if (isCompressed) {
                var inflater = zlib.createInflateRaw();
                inflater.on("error", (function(err) {
                    self.state = states.ERROR;
                    self.emit("error", err);
                }));
                this.outStreamInfo.stream.pipe(inflater).pipe(entry);
            } else {
                this.outStreamInfo.stream.pipe(entry);
            }
            if (this._drainAllEntries) {
                entry.autodrain();
            }
        };
        UnzipStream.prototype._readFile = function(data) {
            var vars = binary.parse(data).word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars;
            return vars;
        };
        UnzipStream.prototype._readExtraFields = function(data) {
            var extra = {};
            var result = {
                parsed: extra
            };
            if (this.options.debug) {
                result.debug = [];
            }
            var index = 0;
            while (index < data.length) {
                var vars = binary.parse(data).skip(index).word16lu("extraId").word16lu("extraSize").vars;
                index += 4;
                var fieldType = undefined;
                switch (vars.extraId) {
                  case 1:
                    fieldType = "Zip64 extended information extra field";
                    var z64vars = binary.parse(data.slice(index, index + vars.extraSize)).word64lu("uncompressedSize").word64lu("compressedSize").word64lu("offsetToLocalHeader").word32lu("diskStartNumber").vars;
                    if (z64vars.uncompressedSize !== null) {
                        extra.uncompressedSize = z64vars.uncompressedSize;
                    }
                    if (z64vars.compressedSize !== null) {
                        extra.compressedSize = z64vars.compressedSize;
                    }
                    extra.zip64Mode = true;
                    break;

                  case 10:
                    fieldType = "NTFS extra field";
                    break;

                  case 21589:
                    fieldType = "extended timestamp";
                    var timestampFields = data.readUInt8(index);
                    var offset = 1;
                    if (vars.extraSize >= offset + 4 && timestampFields & 1) {
                        extra.mtime = new Date(data.readUInt32LE(index + offset) * 1e3);
                        offset += 4;
                    }
                    if (vars.extraSize >= offset + 4 && timestampFields & 2) {
                        extra.atime = new Date(data.readUInt32LE(index + offset) * 1e3);
                        offset += 4;
                    }
                    if (vars.extraSize >= offset + 4 && timestampFields & 4) {
                        extra.ctime = new Date(data.readUInt32LE(index + offset) * 1e3);
                    }
                    break;

                  case 28789:
                    fieldType = "Info-ZIP Unicode Path Extra Field";
                    var fieldVer = data.readUInt8(index);
                    if (fieldVer === 1) {
                        var offset = 1;
                        var nameCrc32 = data.readUInt32LE(index + offset);
                        offset += 4;
                        var pathBuffer = data.slice(index + offset);
                        extra.path = pathBuffer.toString();
                    }
                    break;

                  case 13:
                  case 22613:
                    fieldType = vars.extraId === 13 ? "PKWARE Unix" : "Info-ZIP UNIX (type 1)";
                    var offset = 0;
                    if (vars.extraSize >= 8) {
                        var atime = new Date(data.readUInt32LE(index + offset) * 1e3);
                        offset += 4;
                        var mtime = new Date(data.readUInt32LE(index + offset) * 1e3);
                        offset += 4;
                        extra.atime = atime;
                        extra.mtime = mtime;
                        if (vars.extraSize >= 12) {
                            var uid = data.readUInt16LE(index + offset);
                            offset += 2;
                            var gid = data.readUInt16LE(index + offset);
                            offset += 2;
                            extra.uid = uid;
                            extra.gid = gid;
                        }
                    }
                    break;

                  case 30805:
                    fieldType = "Info-ZIP UNIX (type 2)";
                    var offset = 0;
                    if (vars.extraSize >= 4) {
                        var uid = data.readUInt16LE(index + offset);
                        offset += 2;
                        var gid = data.readUInt16LE(index + offset);
                        offset += 2;
                        extra.uid = uid;
                        extra.gid = gid;
                    }
                    break;

                  case 30837:
                    fieldType = "Info-ZIP New Unix";
                    var offset = 0;
                    var extraVer = data.readUInt8(index);
                    offset += 1;
                    if (extraVer === 1) {
                        var uidSize = data.readUInt8(index + offset);
                        offset += 1;
                        if (uidSize <= 6) {
                            extra.uid = data.readUIntLE(index + offset, uidSize);
                        }
                        offset += uidSize;
                        var gidSize = data.readUInt8(index + offset);
                        offset += 1;
                        if (gidSize <= 6) {
                            extra.gid = data.readUIntLE(index + offset, gidSize);
                        }
                    }
                    break;

                  case 30062:
                    fieldType = "ASi Unix";
                    var offset = 0;
                    if (vars.extraSize >= 14) {
                        var crc = data.readUInt32LE(index + offset);
                        offset += 4;
                        var mode = data.readUInt16LE(index + offset);
                        offset += 2;
                        var sizdev = data.readUInt32LE(index + offset);
                        offset += 4;
                        var uid = data.readUInt16LE(index + offset);
                        offset += 2;
                        var gid = data.readUInt16LE(index + offset);
                        offset += 2;
                        extra.mode = mode;
                        extra.uid = uid;
                        extra.gid = gid;
                        if (vars.extraSize > 14) {
                            var start = index + offset;
                            var end = index + vars.extraSize - 14;
                            var symlinkName = this._decodeString(data.slice(start, end));
                            extra.symlink = symlinkName;
                        }
                    }
                    break;
                }
                if (this.options.debug) {
                    result.debug.push({
                        extraId: "0x" + vars.extraId.toString(16),
                        description: fieldType,
                        data: data.slice(index, index + vars.extraSize).inspect()
                    });
                }
                index += vars.extraSize;
            }
            return result;
        };
        UnzipStream.prototype._readDataDescriptor = function(data, zip64Mode) {
            if (zip64Mode) {
                var vars = binary.parse(data).word32lu("dataDescriptorSignature").word32lu("crc32").word64lu("compressedSize").word64lu("uncompressedSize").vars;
                return vars;
            }
            var vars = binary.parse(data).word32lu("dataDescriptorSignature").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").vars;
            return vars;
        };
        UnzipStream.prototype._readCentralDirectoryEntry = function(data) {
            var vars = binary.parse(data).word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars;
            return vars;
        };
        UnzipStream.prototype._readEndOfCentralDirectory64 = function(data) {
            var vars = binary.parse(data).word64lu("centralDirectoryRecordSize").word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word32lu("diskNumber").word32lu("diskNumberWithCentralDirectoryStart").word64lu("centralDirectoryEntries").word64lu("totalCentralDirectoryEntries").word64lu("sizeOfCentralDirectory").word64lu("offsetToStartOfCentralDirectory").vars;
            return vars;
        };
        UnzipStream.prototype._readEndOfCentralDirectory = function(data) {
            var vars = binary.parse(data).word16lu("diskNumber").word16lu("diskStart").word16lu("centralDirectoryEntries").word16lu("totalCentralDirectoryEntries").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars;
            return vars;
        };
        const cp437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñÑªº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";
        UnzipStream.prototype._decodeString = function(buffer, isUtf8) {
            if (isUtf8) {
                return buffer.toString("utf8");
            }
            if (this.options.decodeString) {
                return this.options.decodeString(buffer);
            }
            let result = "";
            for (var i = 0; i < buffer.length; i++) {
                result += cp437[buffer[i]];
            }
            return result;
        };
        UnzipStream.prototype._parseOrOutput = function(encoding, cb) {
            var consume;
            while ((consume = this.processDataChunk(this.data)) > 0) {
                this.data = this.data.slice(consume);
                if (this.data.length === 0) break;
            }
            if (this.state === states.FILE_DATA) {
                if (this.outStreamInfo.limit >= 0) {
                    var remaining = this.outStreamInfo.limit - this.outStreamInfo.written;
                    var packet;
                    if (remaining < this.data.length) {
                        packet = this.data.slice(0, remaining);
                        this.data = this.data.slice(remaining);
                    } else {
                        packet = this.data;
                        this.data = new Buffer("");
                    }
                    this.outStreamInfo.written += packet.length;
                    if (this.outStreamInfo.limit === this.outStreamInfo.written) {
                        this.state = states.START;
                        this.outStreamInfo.stream.end(packet, encoding, cb);
                    } else {
                        this.outStreamInfo.stream.write(packet, encoding, cb);
                    }
                } else {
                    var packet = this.data;
                    this.data = new Buffer("");
                    this.outStreamInfo.written += packet.length;
                    var outputStream = this.outStreamInfo.stream;
                    outputStream.write(packet, encoding, (() => {
                        if (this.state === states.FILE_DATA_END) {
                            this.state = states.START;
                            return outputStream.end(cb);
                        }
                        cb();
                    }));
                }
                return;
            }
            cb();
        };
        UnzipStream.prototype.drainAll = function() {
            this._drainAllEntries = true;
        };
        UnzipStream.prototype._transform = function(chunk, encoding, cb) {
            var self = this;
            if (self.data.length > 0) {
                self.data = Buffer.concat([ self.data, chunk ]);
            } else {
                self.data = chunk;
            }
            var startDataLength = self.data.length;
            var done = function() {
                if (self.data.length > 0 && self.data.length < startDataLength) {
                    startDataLength = self.data.length;
                    self._parseOrOutput(encoding, done);
                    return;
                }
                cb();
            };
            self._parseOrOutput(encoding, done);
        };
        UnzipStream.prototype._flush = function(cb) {
            var self = this;
            if (self.data.length > 0) {
                self._parseOrOutput("buffer", (function() {
                    if (self.data.length > 0) return setImmediate((function() {
                        self._flush(cb);
                    }));
                    cb();
                }));
                return;
            }
            if (self.state === states.FILE_DATA) {
                return cb(new Error("Stream finished in an invalid state, uncompression failed"));
            }
            setImmediate(cb);
        };
        module.exports = UnzipStream;
    }, (module, exports, __webpack_require__) => {
        var Chainsaw = __webpack_require__(213);
        var EventEmitter = __webpack_require__(41).EventEmitter;
        var Buffers = __webpack_require__(215);
        var Vars = __webpack_require__(216);
        var Stream = __webpack_require__(17).Stream;
        exports = module.exports = function(bufOrEm, eventName) {
            if (Buffer.isBuffer(bufOrEm)) {
                return exports.parse(bufOrEm);
            }
            var s = exports.stream();
            if (bufOrEm && bufOrEm.pipe) {
                bufOrEm.pipe(s);
            } else if (bufOrEm) {
                bufOrEm.on(eventName || "data", (function(buf) {
                    s.write(buf);
                }));
                bufOrEm.on("end", (function() {
                    s.end();
                }));
            }
            return s;
        };
        exports.stream = function(input) {
            if (input) return exports.apply(null, arguments);
            var pending = null;
            function getBytes(bytes, cb, skip) {
                pending = {
                    bytes,
                    skip,
                    cb: function(buf) {
                        pending = null;
                        cb(buf);
                    }
                };
                dispatch();
            }
            var offset = null;
            function dispatch() {
                if (!pending) {
                    if (caughtEnd) done = true;
                    return;
                }
                if (typeof pending === "function") {
                    pending();
                } else {
                    var bytes = offset + pending.bytes;
                    if (buffers.length >= bytes) {
                        var buf;
                        if (offset == null) {
                            buf = buffers.splice(0, bytes);
                            if (!pending.skip) {
                                buf = buf.slice();
                            }
                        } else {
                            if (!pending.skip) {
                                buf = buffers.slice(offset, bytes);
                            }
                            offset = bytes;
                        }
                        if (pending.skip) {
                            pending.cb();
                        } else {
                            pending.cb(buf);
                        }
                    }
                }
            }
            function builder(saw) {
                function next() {
                    if (!done) saw.next();
                }
                var self = words((function(bytes, cb) {
                    return function(name) {
                        getBytes(bytes, (function(buf) {
                            vars.set(name, cb(buf));
                            next();
                        }));
                    };
                }));
                self.tap = function(cb) {
                    saw.nest(cb, vars.store);
                };
                self.into = function(key, cb) {
                    if (!vars.get(key)) vars.set(key, {});
                    var parent = vars;
                    vars = Vars(parent.get(key));
                    saw.nest((function() {
                        cb.apply(this, arguments);
                        this.tap((function() {
                            vars = parent;
                        }));
                    }), vars.store);
                };
                self.flush = function() {
                    vars.store = {};
                    next();
                };
                self.loop = function(cb) {
                    var end = false;
                    saw.nest(false, (function loop() {
                        this.vars = vars.store;
                        cb.call(this, (function() {
                            end = true;
                            next();
                        }), vars.store);
                        this.tap(function() {
                            if (end) saw.next(); else loop.call(this);
                        }.bind(this));
                    }), vars.store);
                };
                self.buffer = function(name, bytes) {
                    if (typeof bytes === "string") {
                        bytes = vars.get(bytes);
                    }
                    getBytes(bytes, (function(buf) {
                        vars.set(name, buf);
                        next();
                    }));
                };
                self.skip = function(bytes) {
                    if (typeof bytes === "string") {
                        bytes = vars.get(bytes);
                    }
                    getBytes(bytes, (function() {
                        next();
                    }));
                };
                self.scan = function find(name, search) {
                    if (typeof search === "string") {
                        search = new Buffer(search);
                    } else if (!Buffer.isBuffer(search)) {
                        throw new Error("search must be a Buffer or a string");
                    }
                    var taken = 0;
                    pending = function() {
                        var pos = buffers.indexOf(search, offset + taken);
                        var i = pos - offset - taken;
                        if (pos !== -1) {
                            pending = null;
                            if (offset != null) {
                                vars.set(name, buffers.slice(offset, offset + taken + i));
                                offset += taken + i + search.length;
                            } else {
                                vars.set(name, buffers.slice(0, taken + i));
                                buffers.splice(0, taken + i + search.length);
                            }
                            next();
                            dispatch();
                        } else {
                            i = Math.max(buffers.length - search.length - offset - taken, 0);
                        }
                        taken += i;
                    };
                    dispatch();
                };
                self.peek = function(cb) {
                    offset = 0;
                    saw.nest((function() {
                        cb.call(this, vars.store);
                        this.tap((function() {
                            offset = null;
                        }));
                    }));
                };
                return self;
            }
            var stream = Chainsaw.light(builder);
            stream.writable = true;
            var buffers = Buffers();
            stream.write = function(buf) {
                buffers.push(buf);
                dispatch();
            };
            var vars = Vars();
            var done = false, caughtEnd = false;
            stream.end = function() {
                caughtEnd = true;
            };
            stream.pipe = Stream.prototype.pipe;
            Object.getOwnPropertyNames(EventEmitter.prototype).forEach((function(name) {
                stream[name] = EventEmitter.prototype[name];
            }));
            return stream;
        };
        exports.parse = function parse(buffer) {
            var self = words((function(bytes, cb) {
                return function(name) {
                    if (offset + bytes <= buffer.length) {
                        var buf = buffer.slice(offset, offset + bytes);
                        offset += bytes;
                        vars.set(name, cb(buf));
                    } else {
                        vars.set(name, null);
                    }
                    return self;
                };
            }));
            var offset = 0;
            var vars = Vars();
            self.vars = vars.store;
            self.tap = function(cb) {
                cb.call(self, vars.store);
                return self;
            };
            self.into = function(key, cb) {
                if (!vars.get(key)) {
                    vars.set(key, {});
                }
                var parent = vars;
                vars = Vars(parent.get(key));
                cb.call(self, vars.store);
                vars = parent;
                return self;
            };
            self.loop = function(cb) {
                var end = false;
                var ender = function() {
                    end = true;
                };
                while (end === false) {
                    cb.call(self, ender, vars.store);
                }
                return self;
            };
            self.buffer = function(name, size) {
                if (typeof size === "string") {
                    size = vars.get(size);
                }
                var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
                offset += size;
                vars.set(name, buf);
                return self;
            };
            self.skip = function(bytes) {
                if (typeof bytes === "string") {
                    bytes = vars.get(bytes);
                }
                offset += bytes;
                return self;
            };
            self.scan = function(name, search) {
                if (typeof search === "string") {
                    search = new Buffer(search);
                } else if (!Buffer.isBuffer(search)) {
                    throw new Error("search must be a Buffer or a string");
                }
                vars.set(name, null);
                for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
                    for (var j = 0; j < search.length && buffer[offset + i + j] === search[j]; j++) ;
                    if (j === search.length) break;
                }
                vars.set(name, buffer.slice(offset, offset + i));
                offset += i + search.length;
                return self;
            };
            self.peek = function(cb) {
                var was = offset;
                cb.call(self, vars.store);
                offset = was;
                return self;
            };
            self.flush = function() {
                vars.store = {};
                return self;
            };
            self.eof = function() {
                return offset >= buffer.length;
            };
            return self;
        };
        function decodeLEu(bytes) {
            var acc = 0;
            for (var i = 0; i < bytes.length; i++) {
                acc += Math.pow(256, i) * bytes[i];
            }
            return acc;
        }
        function decodeBEu(bytes) {
            var acc = 0;
            for (var i = 0; i < bytes.length; i++) {
                acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
            }
            return acc;
        }
        function decodeBEs(bytes) {
            var val = decodeBEu(bytes);
            if ((bytes[0] & 128) == 128) {
                val -= Math.pow(256, bytes.length);
            }
            return val;
        }
        function decodeLEs(bytes) {
            var val = decodeLEu(bytes);
            if ((bytes[bytes.length - 1] & 128) == 128) {
                val -= Math.pow(256, bytes.length);
            }
            return val;
        }
        function words(decode) {
            var self = {};
            [ 1, 2, 4, 8 ].forEach((function(bytes) {
                var bits = bytes * 8;
                self["word" + bits + "le"] = self["word" + bits + "lu"] = decode(bytes, decodeLEu);
                self["word" + bits + "ls"] = decode(bytes, decodeLEs);
                self["word" + bits + "be"] = self["word" + bits + "bu"] = decode(bytes, decodeBEu);
                self["word" + bits + "bs"] = decode(bytes, decodeBEs);
            }));
            self.word8 = self.word8u = self.word8be;
            self.word8s = self.word8bs;
            return self;
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Traverse = __webpack_require__(214);
        var EventEmitter = __webpack_require__(41).EventEmitter;
        module.exports = Chainsaw;
        function Chainsaw(builder) {
            var saw = Chainsaw.saw(builder, {});
            var r = builder.call(saw.handlers, saw);
            if (r !== undefined) saw.handlers = r;
            saw.record();
            return saw.chain();
        }
        Chainsaw.light = function ChainsawLight(builder) {
            var saw = Chainsaw.saw(builder, {});
            var r = builder.call(saw.handlers, saw);
            if (r !== undefined) saw.handlers = r;
            return saw.chain();
        };
        Chainsaw.saw = function(builder, handlers) {
            var saw = new EventEmitter;
            saw.handlers = handlers;
            saw.actions = [];
            saw.chain = function() {
                var ch = Traverse(saw.handlers).map((function(node) {
                    if (this.isRoot) return node;
                    var ps = this.path;
                    if (typeof node === "function") {
                        this.update((function() {
                            saw.actions.push({
                                path: ps,
                                args: [].slice.call(arguments)
                            });
                            return ch;
                        }));
                    }
                }));
                process.nextTick((function() {
                    saw.emit("begin");
                    saw.next();
                }));
                return ch;
            };
            saw.pop = function() {
                return saw.actions.shift();
            };
            saw.next = function() {
                var action = saw.pop();
                if (!action) {
                    saw.emit("end");
                } else if (!action.trap) {
                    var node = saw.handlers;
                    action.path.forEach((function(key) {
                        node = node[key];
                    }));
                    node.apply(saw.handlers, action.args);
                }
            };
            saw.nest = function(cb) {
                var args = [].slice.call(arguments, 1);
                var autonext = true;
                if (typeof cb === "boolean") {
                    var autonext = cb;
                    cb = args.shift();
                }
                var s = Chainsaw.saw(builder, {});
                var r = builder.call(s.handlers, s);
                if (r !== undefined) s.handlers = r;
                if ("undefined" !== typeof saw.step) {
                    s.record();
                }
                cb.apply(s.chain(), args);
                if (autonext !== false) s.on("end", saw.next);
            };
            saw.record = function() {
                upgradeChainsaw(saw);
            };
            [ "trap", "down", "jump" ].forEach((function(method) {
                saw[method] = function() {
                    throw new Error("To use the trap, down and jump features, please " + "call record() first to start recording actions.");
                };
            }));
            return saw;
        };
        function upgradeChainsaw(saw) {
            saw.step = 0;
            saw.pop = function() {
                return saw.actions[saw.step++];
            };
            saw.trap = function(name, cb) {
                var ps = Array.isArray(name) ? name : [ name ];
                saw.actions.push({
                    path: ps,
                    step: saw.step,
                    cb,
                    trap: true
                });
            };
            saw.down = function(name) {
                var ps = (Array.isArray(name) ? name : [ name ]).join("/");
                var i = saw.actions.slice(saw.step).map((function(x) {
                    if (x.trap && x.step <= saw.step) return false;
                    return x.path.join("/") == ps;
                })).indexOf(true);
                if (i >= 0) saw.step += i; else saw.step = saw.actions.length;
                var act = saw.actions[saw.step - 1];
                if (act && act.trap) {
                    saw.step = act.step;
                    act.cb();
                } else saw.next();
            };
            saw.jump = function(step) {
                saw.step = step;
                saw.next();
            };
        }
    }, module => {
        module.exports = Traverse;
        function Traverse(obj) {
            if (!(this instanceof Traverse)) return new Traverse(obj);
            this.value = obj;
        }
        Traverse.prototype.get = function(ps) {
            var node = this.value;
            for (var i = 0; i < ps.length; i++) {
                var key = ps[i];
                if (!Object.hasOwnProperty.call(node, key)) {
                    node = undefined;
                    break;
                }
                node = node[key];
            }
            return node;
        };
        Traverse.prototype.set = function(ps, value) {
            var node = this.value;
            for (var i = 0; i < ps.length - 1; i++) {
                var key = ps[i];
                if (!Object.hasOwnProperty.call(node, key)) node[key] = {};
                node = node[key];
            }
            node[ps[i]] = value;
            return value;
        };
        Traverse.prototype.map = function(cb) {
            return walk(this.value, cb, true);
        };
        Traverse.prototype.forEach = function(cb) {
            this.value = walk(this.value, cb, false);
            return this.value;
        };
        Traverse.prototype.reduce = function(cb, init) {
            var skip = arguments.length === 1;
            var acc = skip ? this.value : init;
            this.forEach((function(x) {
                if (!this.isRoot || !skip) {
                    acc = cb.call(this, acc, x);
                }
            }));
            return acc;
        };
        Traverse.prototype.deepEqual = function(obj) {
            if (arguments.length !== 1) {
                throw new Error("deepEqual requires exactly one object to compare against");
            }
            var equal = true;
            var node = obj;
            this.forEach((function(y) {
                var notEqual = function() {
                    equal = false;
                    return undefined;
                }.bind(this);
                if (!this.isRoot) {
                    if (typeof node !== "object") return notEqual();
                    node = node[this.key];
                }
                var x = node;
                this.post((function() {
                    node = x;
                }));
                var toS = function(o) {
                    return Object.prototype.toString.call(o);
                };
                if (this.circular) {
                    if (Traverse(obj).get(this.circular.path) !== x) notEqual();
                } else if (typeof x !== typeof y) {
                    notEqual();
                } else if (x === null || y === null || x === undefined || y === undefined) {
                    if (x !== y) notEqual();
                } else if (x.__proto__ !== y.__proto__) {
                    notEqual();
                } else if (x === y) {} else if (typeof x === "function") {
                    if (x instanceof RegExp) {
                        if (x.toString() != y.toString()) notEqual();
                    } else if (x !== y) notEqual();
                } else if (typeof x === "object") {
                    if (toS(y) === "[object Arguments]" || toS(x) === "[object Arguments]") {
                        if (toS(x) !== toS(y)) {
                            notEqual();
                        }
                    } else if (x instanceof Date || y instanceof Date) {
                        if (!(x instanceof Date) || !(y instanceof Date) || x.getTime() !== y.getTime()) {
                            notEqual();
                        }
                    } else {
                        var kx = Object.keys(x);
                        var ky = Object.keys(y);
                        if (kx.length !== ky.length) return notEqual();
                        for (var i = 0; i < kx.length; i++) {
                            var k = kx[i];
                            if (!Object.hasOwnProperty.call(y, k)) {
                                notEqual();
                            }
                        }
                    }
                }
            }));
            return equal;
        };
        Traverse.prototype.paths = function() {
            var acc = [];
            this.forEach((function(x) {
                acc.push(this.path);
            }));
            return acc;
        };
        Traverse.prototype.nodes = function() {
            var acc = [];
            this.forEach((function(x) {
                acc.push(this.node);
            }));
            return acc;
        };
        Traverse.prototype.clone = function() {
            var parents = [], nodes = [];
            return function clone(src) {
                for (var i = 0; i < parents.length; i++) {
                    if (parents[i] === src) {
                        return nodes[i];
                    }
                }
                if (typeof src === "object" && src !== null) {
                    var dst = copy(src);
                    parents.push(src);
                    nodes.push(dst);
                    Object.keys(src).forEach((function(key) {
                        dst[key] = clone(src[key]);
                    }));
                    parents.pop();
                    nodes.pop();
                    return dst;
                } else {
                    return src;
                }
            }(this.value);
        };
        function walk(root, cb, immutable) {
            var path = [];
            var parents = [];
            var alive = true;
            return function walker(node_) {
                var node = immutable ? copy(node_) : node_;
                var modifiers = {};
                var state = {
                    node,
                    node_,
                    path: [].concat(path),
                    parent: parents.slice(-1)[0],
                    key: path.slice(-1)[0],
                    isRoot: path.length === 0,
                    level: path.length,
                    circular: null,
                    update: function(x) {
                        if (!state.isRoot) {
                            state.parent.node[state.key] = x;
                        }
                        state.node = x;
                    },
                    delete: function() {
                        delete state.parent.node[state.key];
                    },
                    remove: function() {
                        if (Array.isArray(state.parent.node)) {
                            state.parent.node.splice(state.key, 1);
                        } else {
                            delete state.parent.node[state.key];
                        }
                    },
                    before: function(f) {
                        modifiers.before = f;
                    },
                    after: function(f) {
                        modifiers.after = f;
                    },
                    pre: function(f) {
                        modifiers.pre = f;
                    },
                    post: function(f) {
                        modifiers.post = f;
                    },
                    stop: function() {
                        alive = false;
                    }
                };
                if (!alive) return state;
                if (typeof node === "object" && node !== null) {
                    state.isLeaf = Object.keys(node).length == 0;
                    for (var i = 0; i < parents.length; i++) {
                        if (parents[i].node_ === node_) {
                            state.circular = parents[i];
                            break;
                        }
                    }
                } else {
                    state.isLeaf = true;
                }
                state.notLeaf = !state.isLeaf;
                state.notRoot = !state.isRoot;
                var ret = cb.call(state, state.node);
                if (ret !== undefined && state.update) state.update(ret);
                if (modifiers.before) modifiers.before.call(state, state.node);
                if (typeof state.node == "object" && state.node !== null && !state.circular) {
                    parents.push(state);
                    var keys = Object.keys(state.node);
                    keys.forEach((function(key, i) {
                        path.push(key);
                        if (modifiers.pre) modifiers.pre.call(state, state.node[key], key);
                        var child = walker(state.node[key]);
                        if (immutable && Object.hasOwnProperty.call(state.node, key)) {
                            state.node[key] = child.node;
                        }
                        child.isLast = i == keys.length - 1;
                        child.isFirst = i == 0;
                        if (modifiers.post) modifiers.post.call(state, child);
                        path.pop();
                    }));
                    parents.pop();
                }
                if (modifiers.after) modifiers.after.call(state, state.node);
                return state;
            }(root).node;
        }
        Object.keys(Traverse.prototype).forEach((function(key) {
            Traverse[key] = function(obj) {
                var args = [].slice.call(arguments, 1);
                var t = Traverse(obj);
                return t[key].apply(t, args);
            };
        }));
        function copy(src) {
            if (typeof src === "object" && src !== null) {
                var dst;
                if (Array.isArray(src)) {
                    dst = [];
                } else if (src instanceof Date) {
                    dst = new Date(src);
                } else if (src instanceof Boolean) {
                    dst = new Boolean(src);
                } else if (src instanceof Number) {
                    dst = new Number(src);
                } else if (src instanceof String) {
                    dst = new String(src);
                } else {
                    dst = Object.create(Object.getPrototypeOf(src));
                }
                Object.keys(src).forEach((function(key) {
                    dst[key] = src[key];
                }));
                return dst;
            } else return src;
        }
    }, module => {
        module.exports = Buffers;
        function Buffers(bufs) {
            if (!(this instanceof Buffers)) return new Buffers(bufs);
            this.buffers = bufs || [];
            this.length = this.buffers.reduce((function(size, buf) {
                return size + buf.length;
            }), 0);
        }
        Buffers.prototype.push = function() {
            for (var i = 0; i < arguments.length; i++) {
                if (!Buffer.isBuffer(arguments[i])) {
                    throw new TypeError("Tried to push a non-buffer");
                }
            }
            for (var i = 0; i < arguments.length; i++) {
                var buf = arguments[i];
                this.buffers.push(buf);
                this.length += buf.length;
            }
            return this.length;
        };
        Buffers.prototype.unshift = function() {
            for (var i = 0; i < arguments.length; i++) {
                if (!Buffer.isBuffer(arguments[i])) {
                    throw new TypeError("Tried to unshift a non-buffer");
                }
            }
            for (var i = 0; i < arguments.length; i++) {
                var buf = arguments[i];
                this.buffers.unshift(buf);
                this.length += buf.length;
            }
            return this.length;
        };
        Buffers.prototype.copy = function(dst, dStart, start, end) {
            return this.slice(start, end).copy(dst, dStart, 0, end - start);
        };
        Buffers.prototype.splice = function(i, howMany) {
            var buffers = this.buffers;
            var index = i >= 0 ? i : this.length - i;
            var reps = [].slice.call(arguments, 2);
            if (howMany === undefined) {
                howMany = this.length - index;
            } else if (howMany > this.length - index) {
                howMany = this.length - index;
            }
            for (var i = 0; i < reps.length; i++) {
                this.length += reps[i].length;
            }
            var removed = new Buffers;
            var bytes = 0;
            var startBytes = 0;
            for (var ii = 0; ii < buffers.length && startBytes + buffers[ii].length < index; ii++) {
                startBytes += buffers[ii].length;
            }
            if (index - startBytes > 0) {
                var start = index - startBytes;
                if (start + howMany < buffers[ii].length) {
                    removed.push(buffers[ii].slice(start, start + howMany));
                    var orig = buffers[ii];
                    var buf0 = new Buffer(start);
                    for (var i = 0; i < start; i++) {
                        buf0[i] = orig[i];
                    }
                    var buf1 = new Buffer(orig.length - start - howMany);
                    for (var i = start + howMany; i < orig.length; i++) {
                        buf1[i - howMany - start] = orig[i];
                    }
                    if (reps.length > 0) {
                        var reps_ = reps.slice();
                        reps_.unshift(buf0);
                        reps_.push(buf1);
                        buffers.splice.apply(buffers, [ ii, 1 ].concat(reps_));
                        ii += reps_.length;
                        reps = [];
                    } else {
                        buffers.splice(ii, 1, buf0, buf1);
                        ii += 2;
                    }
                } else {
                    removed.push(buffers[ii].slice(start));
                    buffers[ii] = buffers[ii].slice(0, start);
                    ii++;
                }
            }
            if (reps.length > 0) {
                buffers.splice.apply(buffers, [ ii, 0 ].concat(reps));
                ii += reps.length;
            }
            while (removed.length < howMany) {
                var buf = buffers[ii];
                var len = buf.length;
                var take = Math.min(len, howMany - removed.length);
                if (take === len) {
                    removed.push(buf);
                    buffers.splice(ii, 1);
                } else {
                    removed.push(buf.slice(0, take));
                    buffers[ii] = buffers[ii].slice(take);
                }
            }
            this.length -= removed.length;
            return removed;
        };
        Buffers.prototype.slice = function(i, j) {
            var buffers = this.buffers;
            if (j === undefined) j = this.length;
            if (i === undefined) i = 0;
            if (j > this.length) j = this.length;
            var startBytes = 0;
            for (var si = 0; si < buffers.length && startBytes + buffers[si].length <= i; si++) {
                startBytes += buffers[si].length;
            }
            var target = new Buffer(j - i);
            var ti = 0;
            for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
                var len = buffers[ii].length;
                var start = ti === 0 ? i - startBytes : 0;
                var end = ti + len >= j - i ? Math.min(start + (j - i) - ti, len) : len;
                buffers[ii].copy(target, ti, start, end);
                ti += end - start;
            }
            return target;
        };
        Buffers.prototype.pos = function(i) {
            if (i < 0 || i >= this.length) throw new Error("oob");
            var l = i, bi = 0, bu = null;
            for (;;) {
                bu = this.buffers[bi];
                if (l < bu.length) {
                    return {
                        buf: bi,
                        offset: l
                    };
                } else {
                    l -= bu.length;
                }
                bi++;
            }
        };
        Buffers.prototype.get = function get(i) {
            var pos = this.pos(i);
            return this.buffers[pos.buf].get(pos.offset);
        };
        Buffers.prototype.set = function set(i, b) {
            var pos = this.pos(i);
            return this.buffers[pos.buf].set(pos.offset, b);
        };
        Buffers.prototype.indexOf = function(needle, offset) {
            if ("string" === typeof needle) {
                needle = new Buffer(needle);
            } else if (needle instanceof Buffer) {} else {
                throw new Error("Invalid type for a search string");
            }
            if (!needle.length) {
                return 0;
            }
            if (!this.length) {
                return -1;
            }
            var i = 0, j = 0, match = 0, mstart, pos = 0;
            if (offset) {
                var p = this.pos(offset);
                i = p.buf;
                j = p.offset;
                pos = offset;
            }
            for (;;) {
                while (j >= this.buffers[i].length) {
                    j = 0;
                    i++;
                    if (i >= this.buffers.length) {
                        return -1;
                    }
                }
                var char = this.buffers[i][j];
                if (char == needle[match]) {
                    if (match == 0) {
                        mstart = {
                            i,
                            j,
                            pos
                        };
                    }
                    match++;
                    if (match == needle.length) {
                        return mstart.pos;
                    }
                } else if (match != 0) {
                    i = mstart.i;
                    j = mstart.j;
                    pos = mstart.pos;
                    match = 0;
                }
                j++;
                pos++;
            }
        };
        Buffers.prototype.toBuffer = function() {
            return this.slice();
        };
        Buffers.prototype.toString = function(encoding, start, end) {
            return this.slice(start, end).toString(encoding);
        };
    }, module => {
        module.exports = function(store) {
            function getset(name, value) {
                var node = vars.store;
                var keys = name.split(".");
                keys.slice(0, -1).forEach((function(k) {
                    if (node[k] === undefined) node[k] = {};
                    node = node[k];
                }));
                var key = keys[keys.length - 1];
                if (arguments.length == 1) {
                    return node[key];
                } else {
                    return node[key] = value;
                }
            }
            var vars = {
                get: function(name) {
                    return getset(name);
                },
                set: function(name, value) {
                    return getset(name, value);
                },
                store: store || {}
            };
            return vars;
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Transform = __webpack_require__(17).Transform;
        var util = __webpack_require__(14);
        function MatcherStream(patternDesc, matchFn) {
            if (!(this instanceof MatcherStream)) {
                return new MatcherStream;
            }
            Transform.call(this);
            var p = typeof patternDesc === "object" ? patternDesc.pattern : patternDesc;
            this.pattern = Buffer.isBuffer(p) ? p : Buffer.from(p);
            this.requiredLength = this.pattern.length;
            if (patternDesc.requiredExtraSize) this.requiredLength += patternDesc.requiredExtraSize;
            this.data = new Buffer("");
            this.bytesSoFar = 0;
            this.matchFn = matchFn;
        }
        util.inherits(MatcherStream, Transform);
        MatcherStream.prototype.checkDataChunk = function(ignoreMatchZero) {
            var enoughData = this.data.length >= this.requiredLength;
            if (!enoughData) {
                return;
            }
            var matchIndex = this.data.indexOf(this.pattern, ignoreMatchZero ? 1 : 0);
            if (matchIndex >= 0 && matchIndex + this.requiredLength > this.data.length) {
                if (matchIndex > 0) {
                    var packet = this.data.slice(0, matchIndex);
                    this.push(packet);
                    this.bytesSoFar += matchIndex;
                    this.data = this.data.slice(matchIndex);
                }
                return;
            }
            if (matchIndex === -1) {
                var packetLen = this.data.length - this.requiredLength + 1;
                var packet = this.data.slice(0, packetLen);
                this.push(packet);
                this.bytesSoFar += packetLen;
                this.data = this.data.slice(packetLen);
                return;
            }
            if (matchIndex > 0) {
                var packet = this.data.slice(0, matchIndex);
                this.data = this.data.slice(matchIndex);
                this.push(packet);
                this.bytesSoFar += matchIndex;
            }
            var finished = this.matchFn ? this.matchFn(this.data, this.bytesSoFar) : true;
            if (finished) {
                this.data = new Buffer("");
                return;
            }
            return true;
        };
        MatcherStream.prototype._transform = function(chunk, encoding, cb) {
            this.data = Buffer.concat([ this.data, chunk ]);
            var firstIteration = true;
            while (this.checkDataChunk(!firstIteration)) {
                firstIteration = false;
            }
            cb();
        };
        MatcherStream.prototype._flush = function(cb) {
            if (this.data.length > 0) {
                var firstIteration = true;
                while (this.checkDataChunk(!firstIteration)) {
                    firstIteration = false;
                }
            }
            if (this.data.length > 0) {
                this.push(this.data);
                this.data = null;
            }
            cb();
        };
        module.exports = MatcherStream;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var stream = __webpack_require__(17);
        var inherits = __webpack_require__(14).inherits;
        function Entry() {
            if (!(this instanceof Entry)) {
                return new Entry;
            }
            stream.PassThrough.call(this);
            this.path = null;
            this.type = null;
            this.isDirectory = false;
        }
        inherits(Entry, stream.PassThrough);
        Entry.prototype.autodrain = function() {
            return this.pipe(new stream.Transform({
                transform: function(d, e, cb) {
                    cb();
                }
            }));
        };
        module.exports = Entry;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var fs = __webpack_require__(5);
        var path = __webpack_require__(34);
        var util = __webpack_require__(14);
        var mkdirp = __webpack_require__(220);
        var Transform = __webpack_require__(17).Transform;
        var UnzipStream = __webpack_require__(211);
        function Extract(opts) {
            if (!(this instanceof Extract)) return new Extract(opts);
            Transform.call(this);
            this.opts = opts || {};
            this.unzipStream = new UnzipStream(this.opts);
            this.unfinishedEntries = 0;
            this.afterFlushWait = false;
            this.createdDirectories = {};
            var self = this;
            this.unzipStream.on("entry", this._processEntry.bind(this));
            this.unzipStream.on("error", (function(error) {
                self.emit("error", error);
            }));
        }
        util.inherits(Extract, Transform);
        Extract.prototype._transform = function(chunk, encoding, cb) {
            this.unzipStream.write(chunk, encoding, cb);
        };
        Extract.prototype._flush = function(cb) {
            var self = this;
            var allDone = function() {
                process.nextTick((function() {
                    self.emit("close");
                }));
                cb();
            };
            this.unzipStream.end((function() {
                if (self.unfinishedEntries > 0) {
                    self.afterFlushWait = true;
                    return self.on("await-finished", allDone);
                }
                allDone();
            }));
        };
        Extract.prototype._processEntry = function(entry) {
            var self = this;
            var destPath = path.join(this.opts.path, entry.path);
            var directory = entry.isDirectory ? destPath : path.dirname(destPath);
            this.unfinishedEntries++;
            var writeFileFn = function() {
                var pipedStream = fs.createWriteStream(destPath);
                pipedStream.on("close", (function() {
                    self.unfinishedEntries--;
                    self._notifyAwaiter();
                }));
                pipedStream.on("error", (function(error) {
                    self.emit("error", error);
                }));
                entry.pipe(pipedStream);
            };
            if (this.createdDirectories[directory] || directory === ".") {
                return writeFileFn();
            }
            mkdirp(directory, (function(err) {
                if (err) return self.emit("error", err);
                self.createdDirectories[directory] = true;
                if (entry.isDirectory) {
                    self.unfinishedEntries--;
                    self._notifyAwaiter();
                    return;
                }
                writeFileFn();
            }));
        };
        Extract.prototype._notifyAwaiter = function() {
            if (this.afterFlushWait && this.unfinishedEntries === 0) {
                this.emit("await-finished");
                this.afterFlushWait = false;
            }
        };
        module.exports = Extract;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var path = __webpack_require__(34);
        var fs = __webpack_require__(5);
        var _0777 = parseInt("0777", 8);
        module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
        function mkdirP(p, opts, f, made) {
            if (typeof opts === "function") {
                f = opts;
                opts = {};
            } else if (!opts || typeof opts !== "object") {
                opts = {
                    mode: opts
                };
            }
            var mode = opts.mode;
            var xfs = opts.fs || fs;
            if (mode === undefined) {
                mode = _0777;
            }
            if (!made) made = null;
            var cb = f || function() {};
            p = path.resolve(p);
            xfs.mkdir(p, mode, (function(er) {
                if (!er) {
                    made = made || p;
                    return cb(null, made);
                }
                switch (er.code) {
                  case "ENOENT":
                    if (path.dirname(p) === p) return cb(er);
                    mkdirP(path.dirname(p), opts, (function(er, made) {
                        if (er) cb(er, made); else mkdirP(p, opts, cb, made);
                    }));
                    break;

                  default:
                    xfs.stat(p, (function(er2, stat) {
                        if (er2 || !stat.isDirectory()) cb(er, made); else cb(null, made);
                    }));
                    break;
                }
            }));
        }
        mkdirP.sync = function sync(p, opts, made) {
            if (!opts || typeof opts !== "object") {
                opts = {
                    mode: opts
                };
            }
            var mode = opts.mode;
            var xfs = opts.fs || fs;
            if (mode === undefined) {
                mode = _0777;
            }
            if (!made) made = null;
            p = path.resolve(p);
            try {
                xfs.mkdirSync(p, mode);
                made = made || p;
            } catch (err0) {
                switch (err0.code) {
                  case "ENOENT":
                    made = sync(path.dirname(p), opts, made);
                    sync(p, opts, made);
                    break;

                  default:
                    var stat;
                    try {
                        stat = xfs.statSync(p);
                    } catch (err1) {
                        throw err0;
                    }
                    if (!stat.isDirectory()) throw err0;
                    break;
                }
            }
            return made;
        };
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.BalenaS3CompressedSource = void 0;
        const CombinedStream = __webpack_require__(222);
        const file_disk_1 = __webpack_require__(57);
        const gzip_stream_1 = __webpack_require__(224);
        const stream_1 = __webpack_require__(17);
        const ZipPartStream = __webpack_require__(251);
        const zlib_1 = __webpack_require__(89);
        const balena_s3_source_1 = __webpack_require__(181);
        const configure_1 = __webpack_require__(113);
        const configure_2 = __webpack_require__(114);
        const copy_1 = __webpack_require__(116);
        const errors_1 = __webpack_require__(19);
        const stream_limiter_1 = __webpack_require__(88);
        const utils_1 = __webpack_require__(21);
        class BalenaS3CompressedSource extends balena_s3_source_1.BalenaS3SourceBase {
            constructor({format, filenamePrefix, configuration, ...options}) {
                super(options);
                this.configuredParts = new Map;
                this.format = format;
                this.filenamePrefix = filenamePrefix;
                this.configuration = configuration;
            }
            async getSize() {
                return (await this.createStream(true)).zLen;
            }
            getFilename() {
                return [ this.filenamePrefix, this.deviceType, this.osVersion, this.buildId.endsWith(".dev") ? "dev" : undefined, this.supervisorVersion, this.release ].filter((p => p !== undefined)).join("-");
            }
            async _getMetadata() {
                return {
                    supervisorVersion: this.supervisorVersion,
                    osVersion: this.osVersion,
                    lastModified: this.lastModified,
                    size: this.size,
                    version: this.buildId,
                    name: this.filename,
                    format: this.format
                };
            }
            async getSupervisorVersion() {
                const response = await this.download("VERSION");
                const lastModified = new Date(response.headers["last-modified"]);
                const supervisorVersion = response.data.trim();
                return {
                    supervisorVersion,
                    lastModified
                };
            }
            async getOsVersion() {
                const response = await this.download("VERSION_HOSTOS");
                return response.data.trim();
            }
            async getImageJSON() {
                const imageJSON = (await this.download("image.json")).data;
                return imageJSON;
            }
            async getDeviceTypeJSON() {
                return (await this.download("device-type.json")).data;
            }
            async getPartStream(filename) {
                const response = await this.download(`compressed/${filename}`, "stream");
                return response.data;
            }
            findPartitionPart(imageJSON, partition) {
                for (const {parts} of Object.values(imageJSON)) {
                    for (const part of parts) {
                        if (part.partitionIndex === `(${partition})`) {
                            return part;
                        }
                    }
                }
                throw new Error(`Couldn't find compressed image part for partition ${partition}`);
            }
            findImagePart(imageJSON, image) {
                var _a, _b;
                const [part] = (_b = (_a = imageJSON[image]) === null || _a === void 0 ? void 0 : _a.parts) !== null && _b !== void 0 ? _b : [];
                if (part === undefined) {
                    throw new Error(`Couldn't find compressed part for image ${image}`);
                }
                return part;
            }
            findPart(definition) {
                if (definition.partition !== undefined) {
                    const partition = (0, configure_1.normalizePartition)(definition.partition);
                    return this.findPartitionPart(this.imageJSON, partition);
                } else if (definition.image !== undefined) {
                    return this.findImagePart(this.imageJSON, definition.image);
                } else {
                    throw new Error("No partition or image to configure found");
                }
            }
            async extractDeflateToDisk(filename) {
                const stream = await this.getPartStream(filename);
                const combined = CombinedStream.create();
                combined.append(stream);
                combined.append(gzip_stream_1.DEFLATE_END);
                const inflate = (0, zlib_1.createInflateRaw)();
                combined.pipe(inflate);
                return new file_disk_1.BufferDisk(await (0, utils_1.streamToBuffer)(inflate));
            }
            async configure() {
                var _a, _b;
                if (this.configuration === undefined) {
                    return;
                }
                const disks = new Map;
                const self = this;
                async function getDisk(definition) {
                    const filename = self.findPart(definition).filename;
                    const d = disks.get(filename);
                    if (d !== undefined) {
                        return d;
                    }
                    const d2 = await self.extractDeflateToDisk(filename);
                    disks.set(filename, d2);
                    return d2;
                }
                await (0, configure_2.configure)(await getDisk(this.deviceTypeJSON.configuration.config), undefined, this.configuration);
                for (const cpy of (_a = this.deviceTypeJSON.configuration.operations) !== null && _a !== void 0 ? _a : []) {
                    if ((0, configure_1.shouldRunOperation)((_b = this.configuration) !== null && _b !== void 0 ? _b : {}, cpy)) {
                        await (0, copy_1.copy)(await getDisk(cpy.from), undefined, cpy.from.path, await getDisk(cpy.to), undefined, cpy.to.path);
                    }
                }
                await Promise.all(Array.from(disks.entries()).map((async ([filename, disk]) => {
                    const stream = (await disk.getStream()).pipe((0, gzip_stream_1.createDeflatePart)());
                    const buffer = await (0, utils_1.streamToBuffer)(stream);
                    const {crc, zLen} = stream.metadata();
                    this.configuredParts.set(filename, {
                        crc,
                        zLen,
                        buffer
                    });
                })));
            }
            async _open() {
                const [{supervisorVersion, lastModified}, osVersion, imageJSON, deviceTypeJSON] = await Promise.all([ this.getSupervisorVersion(), this.getOsVersion(), this.getImageJSON(), this.getDeviceTypeJSON() ]);
                if (deviceTypeJSON.yocto.archive) {
                    this.format = "zip";
                }
                this.supervisorVersion = supervisorVersion;
                this.lastModified = lastModified;
                this.osVersion = osVersion;
                this.deviceTypeJSON = deviceTypeJSON;
                this.filename = this.getFilename();
                const keys = Object.keys(imageJSON);
                if (keys.length === 1 && keys[0] === "resin.img") {
                    this.filename += ".img";
                    this.imageJSON = {
                        [this.filename]: imageJSON["resin.img"]
                    };
                } else {
                    this.imageJSON = imageJSON;
                }
                await this.configure();
                this.size = await this.getSize();
            }
            async getParts(fake) {
                return Promise.all(Object.entries(this.imageJSON).map((async ([filename, {parts}]) => ({
                    filename,
                    parts: await Promise.all(parts.map((async p => {
                        let stream;
                        let {crc, zLen} = p;
                        const configuredPart = this.configuredParts.get(p.filename);
                        if (configuredPart !== undefined) {
                            ({buffer: stream, crc, zLen} = configuredPart);
                        } else if (fake) {
                            stream = new stream_1.Readable;
                        } else {
                            stream = await this.getPartStream(p.filename);
                        }
                        return {
                            ...p,
                            crc,
                            zLen,
                            stream
                        };
                    })))
                }))));
            }
            async createZipStream(fake) {
                const entries = (await this.getParts(fake)).map((({filename, parts}) => ZipPartStream.createEntry(filename, parts)));
                return ZipPartStream.create(entries);
            }
            async createGzipStream(fake) {
                const [{parts}] = await this.getParts(fake);
                return (0, gzip_stream_1.createGzipFromParts)(parts);
            }
            async createStream(fake = false) {
                return await (this.format === "zip" ? this.createZipStream(fake) : this.createGzipStream(fake));
            }
            async createReadStream(options = {}) {
                if (options.start !== undefined) {
                    throw new errors_1.NotCapable;
                }
                const stream = await this.createStream();
                if (options.end !== undefined) {
                    return new stream_limiter_1.StreamLimiter(stream, options.end + 1);
                }
                return stream;
            }
        }
        exports.BalenaS3CompressedSource = BalenaS3CompressedSource;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var util = __webpack_require__(14);
        var Stream = __webpack_require__(17).Stream;
        var DelayedStream = __webpack_require__(223);
        module.exports = CombinedStream;
        function CombinedStream() {
            this.writable = false;
            this.readable = true;
            this.dataSize = 0;
            this.maxDataSize = 2 * 1024 * 1024;
            this.pauseStreams = true;
            this._released = false;
            this._streams = [];
            this._currentStream = null;
            this._insideLoop = false;
            this._pendingNext = false;
        }
        util.inherits(CombinedStream, Stream);
        CombinedStream.create = function(options) {
            var combinedStream = new this;
            options = options || {};
            for (var option in options) {
                combinedStream[option] = options[option];
            }
            return combinedStream;
        };
        CombinedStream.isStreamLike = function(stream) {
            return typeof stream !== "function" && typeof stream !== "string" && typeof stream !== "boolean" && typeof stream !== "number" && !Buffer.isBuffer(stream);
        };
        CombinedStream.prototype.append = function(stream) {
            var isStreamLike = CombinedStream.isStreamLike(stream);
            if (isStreamLike) {
                if (!(stream instanceof DelayedStream)) {
                    var newStream = DelayedStream.create(stream, {
                        maxDataSize: Infinity,
                        pauseStream: this.pauseStreams
                    });
                    stream.on("data", this._checkDataSize.bind(this));
                    stream = newStream;
                }
                this._handleErrors(stream);
                if (this.pauseStreams) {
                    stream.pause();
                }
            }
            this._streams.push(stream);
            return this;
        };
        CombinedStream.prototype.pipe = function(dest, options) {
            Stream.prototype.pipe.call(this, dest, options);
            this.resume();
            return dest;
        };
        CombinedStream.prototype._getNext = function() {
            this._currentStream = null;
            if (this._insideLoop) {
                this._pendingNext = true;
                return;
            }
            this._insideLoop = true;
            try {
                do {
                    this._pendingNext = false;
                    this._realGetNext();
                } while (this._pendingNext);
            } finally {
                this._insideLoop = false;
            }
        };
        CombinedStream.prototype._realGetNext = function() {
            var stream = this._streams.shift();
            if (typeof stream == "undefined") {
                this.end();
                return;
            }
            if (typeof stream !== "function") {
                this._pipeNext(stream);
                return;
            }
            var getStream = stream;
            getStream(function(stream) {
                var isStreamLike = CombinedStream.isStreamLike(stream);
                if (isStreamLike) {
                    stream.on("data", this._checkDataSize.bind(this));
                    this._handleErrors(stream);
                }
                this._pipeNext(stream);
            }.bind(this));
        };
        CombinedStream.prototype._pipeNext = function(stream) {
            this._currentStream = stream;
            var isStreamLike = CombinedStream.isStreamLike(stream);
            if (isStreamLike) {
                stream.on("end", this._getNext.bind(this));
                stream.pipe(this, {
                    end: false
                });
                return;
            }
            var value = stream;
            this.write(value);
            this._getNext();
        };
        CombinedStream.prototype._handleErrors = function(stream) {
            var self = this;
            stream.on("error", (function(err) {
                self._emitError(err);
            }));
        };
        CombinedStream.prototype.write = function(data) {
            this.emit("data", data);
        };
        CombinedStream.prototype.pause = function() {
            if (!this.pauseStreams) {
                return;
            }
            if (this.pauseStreams && this._currentStream && typeof this._currentStream.pause == "function") this._currentStream.pause();
            this.emit("pause");
        };
        CombinedStream.prototype.resume = function() {
            if (!this._released) {
                this._released = true;
                this.writable = true;
                this._getNext();
            }
            if (this.pauseStreams && this._currentStream && typeof this._currentStream.resume == "function") this._currentStream.resume();
            this.emit("resume");
        };
        CombinedStream.prototype.end = function() {
            this._reset();
            this.emit("end");
        };
        CombinedStream.prototype.destroy = function() {
            this._reset();
            this.emit("close");
        };
        CombinedStream.prototype._reset = function() {
            this.writable = false;
            this._streams = [];
            this._currentStream = null;
        };
        CombinedStream.prototype._checkDataSize = function() {
            this._updateDataSize();
            if (this.dataSize <= this.maxDataSize) {
                return;
            }
            var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
            this._emitError(new Error(message));
        };
        CombinedStream.prototype._updateDataSize = function() {
            this.dataSize = 0;
            var self = this;
            this._streams.forEach((function(stream) {
                if (!stream.dataSize) {
                    return;
                }
                self.dataSize += stream.dataSize;
            }));
            if (this._currentStream && this._currentStream.dataSize) {
                this.dataSize += this._currentStream.dataSize;
            }
        };
        CombinedStream.prototype._emitError = function(err) {
            this._reset();
            this.emit("error", err);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Stream = __webpack_require__(17).Stream;
        var util = __webpack_require__(14);
        module.exports = DelayedStream;
        function DelayedStream() {
            this.source = null;
            this.dataSize = 0;
            this.maxDataSize = 1024 * 1024;
            this.pauseStream = true;
            this._maxDataSizeExceeded = false;
            this._released = false;
            this._bufferedEvents = [];
        }
        util.inherits(DelayedStream, Stream);
        DelayedStream.create = function(source, options) {
            var delayedStream = new this;
            options = options || {};
            for (var option in options) {
                delayedStream[option] = options[option];
            }
            delayedStream.source = source;
            var realEmit = source.emit;
            source.emit = function() {
                delayedStream._handleEmit(arguments);
                return realEmit.apply(source, arguments);
            };
            source.on("error", (function() {}));
            if (delayedStream.pauseStream) {
                source.pause();
            }
            return delayedStream;
        };
        Object.defineProperty(DelayedStream.prototype, "readable", {
            configurable: true,
            enumerable: true,
            get: function() {
                return this.source.readable;
            }
        });
        DelayedStream.prototype.setEncoding = function() {
            return this.source.setEncoding.apply(this.source, arguments);
        };
        DelayedStream.prototype.resume = function() {
            if (!this._released) {
                this.release();
            }
            this.source.resume();
        };
        DelayedStream.prototype.pause = function() {
            this.source.pause();
        };
        DelayedStream.prototype.release = function() {
            this._released = true;
            this._bufferedEvents.forEach(function(args) {
                this.emit.apply(this, args);
            }.bind(this));
            this._bufferedEvents = [];
        };
        DelayedStream.prototype.pipe = function() {
            var r = Stream.prototype.pipe.apply(this, arguments);
            this.resume();
            return r;
        };
        DelayedStream.prototype._handleEmit = function(args) {
            if (this._released) {
                this.emit.apply(this, args);
                return;
            }
            if (args[0] === "data") {
                this.dataSize += args[1].length;
                this._checkIfMaxDataSizeExceeded();
            }
            this._bufferedEvents.push(args);
        };
        DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
            if (this._maxDataSizeExceeded) {
                return;
            }
            if (this.dataSize <= this.maxDataSize) {
                return;
            }
            this._maxDataSizeExceeded = true;
            var message = "DelayedStream#maxDataSize of " + this.maxDataSize + " bytes exceeded.";
            this.emit("error", new Error(message));
        };
    }, function(__unused_webpack_module, exports, __webpack_require__) {
        (function() {
            var CombinedStream, DEFLATE_END, DEFLATE_END_LENGTH, DeflateCRC32Stream, DeflatePartStream, GZIP_HEADER, crcUtils;
            crcUtils = __webpack_require__(225);
            CombinedStream = __webpack_require__(222);
            ({DeflateCRC32Stream} = __webpack_require__(227));
            exports.GZIP_HEADER = GZIP_HEADER = Buffer.from([ 31, 139, 8, 0, 0, 0, 0, 0, 0, 255 ]);
            exports.DEFLATE_END = DEFLATE_END = Buffer.from([ 3, 0 ]);
            exports.DEFLATE_END_LENGTH = DEFLATE_END_LENGTH = DEFLATE_END.length;
            DeflatePartStream = class DeflatePartStream extends DeflateCRC32Stream {
                constructor() {
                    super(...arguments);
                    this.buf = Buffer.alloc(0);
                }
                push(chunk) {
                    if (chunk !== null) {
                        if (chunk.length >= DEFLATE_END_LENGTH) {
                            super.push(this.buf);
                            return this.buf = chunk;
                        } else {
                            return this.buf = Buffer.concat([ this.buf, chunk ]);
                        }
                    } else {
                        if (this.buf.length >= DEFLATE_END_LENGTH && this.buf.slice(-DEFLATE_END_LENGTH).equals(DEFLATE_END)) {
                            this.buf = this.buf.slice(0, -DEFLATE_END_LENGTH);
                        }
                        super.push(this.buf);
                        return super.push(null);
                    }
                }
                end() {
                    return this.flush((() => super.end()));
                }
                metadata() {
                    return {
                        crc: this.digest().readUInt32BE(0),
                        len: this.size(),
                        zLen: this.size(true)
                    };
                }
            };
            exports.createDeflatePart = function() {
                return new DeflatePartStream;
            };
            exports.createGzipFromParts = function(parts) {
                var i, len, len1, out, stream;
                out = CombinedStream.create();
                out.append(GZIP_HEADER);
                for (i = 0, len1 = parts.length; i < len1; i++) {
                    ({stream} = parts[i]);
                    out.append(stream);
                }
                out.append(DEFLATE_END);
                out.append(crcUtils.crc32_combine_multi(parts).combinedCrc32);
                len = Buffer.alloc(4);
                len.writeUInt32LE(parts.map((function(p) {
                    return p.len;
                })).reduce((function(a, b) {
                    return a + b;
                })), 0);
                out.append(len);
                out.zLen = parts.map((function(p) {
                    return p.zLen;
                })).reduce((function(a, b) {
                    return a + b;
                })) + 20;
                return out;
            };
        }).call(this);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        const Module = __webpack_require__(226);
        const ready = new Promise((resolve => {
            Module.onRuntimeInitialized = resolve;
        }));
        exports.ready = ready;
        function crc32_combine(crc1, crc2, len2) {
            const value = Module.ccall("crc32_combine", "number", [ "number", "number", "number" ], [ crc1, crc2, len2 ]);
            const buffer = Buffer.alloc(4);
            buffer.writeInt32LE(value);
            return buffer;
        }
        exports.crc32_combine = crc32_combine;
        const message = "The argument should be an Array of at least 2 Objects with 'crc' and 'len' keys";
        exports.message = message;
        function crc32_combine_multi(crcs) {
            if (!Array.isArray(crcs)) {
                throw new Error(message);
            }
            if (crcs.length < 2) {
                throw new Error(message);
            }
            let {crc: result, len: intLength} = crcs[0];
            for (const {crc, len} of crcs.slice(1)) {
                if (!Number.isInteger(crc) || !Number.isInteger(len)) {
                    throw new Error(message);
                }
                result = crc32_combine(result, crc, len).readUInt32LE();
                intLength += len;
            }
            const combinedCrc32 = Buffer.alloc(4);
            combinedCrc32.writeUInt32LE(result);
            return {
                combinedCrc32,
                intLength
            };
        }
        exports.crc32_combine_multi = crc32_combine_multi;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        var Module = typeof Module !== "undefined" ? Module : {};
        var moduleOverrides = {};
        var key;
        for (key in Module) {
            if (Module.hasOwnProperty(key)) {
                moduleOverrides[key] = Module[key];
            }
        }
        var arguments_ = [];
        var thisProgram = "./this.program";
        var quit_ = function(status, toThrow) {
            throw toThrow;
        };
        var ENVIRONMENT_IS_WEB = false;
        var ENVIRONMENT_IS_WORKER = false;
        var ENVIRONMENT_IS_NODE = false;
        var ENVIRONMENT_IS_SHELL = false;
        ENVIRONMENT_IS_WEB = typeof window === "object";
        ENVIRONMENT_IS_WORKER = typeof importScripts === "function";
        ENVIRONMENT_IS_NODE = typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string";
        ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
        var scriptDirectory = "";
        function locateFile(path) {
            if (Module["locateFile"]) {
                return Module["locateFile"](path, scriptDirectory);
            }
            return scriptDirectory + path;
        }
        var read_, readAsync, readBinary, setWindowTitle;
        var nodeFS;
        var nodePath;
        if (ENVIRONMENT_IS_NODE) {
            if (ENVIRONMENT_IS_WORKER) {
                scriptDirectory = __webpack_require__(34).dirname(scriptDirectory) + "/";
            } else {
                const Path = __webpack_require__(34);
                let electron;
                try {
                    electron = __webpack_require__(46);
                } catch {}
                function appPath() {
                    return Path.isAbsolute(__dirname) ? __dirname : Path.join(electron.remote.app.getAppPath().replace(/\.asar$/, (() => process.platform === "darwin" ? "-" + process.arch : "")), "generated");
                }
                scriptDirectory = Path.join(appPath(), "modules", "@balena", "node-crc-utils", "/");
            }
            read_ = function shell_read(filename, binary) {
                if (!nodeFS) nodeFS = __webpack_require__(5);
                if (!nodePath) nodePath = __webpack_require__(34);
                filename = nodePath["normalize"](filename);
                return nodeFS["readFileSync"](filename, binary ? null : "utf8");
            };
            readBinary = function readBinary(filename) {
                var ret = read_(filename, true);
                if (!ret.buffer) {
                    ret = new Uint8Array(ret);
                }
                assert(ret.buffer);
                return ret;
            };
            if (process["argv"].length > 1) {
                thisProgram = process["argv"][1].replace(/\\/g, "/");
            }
            arguments_ = process["argv"].slice(2);
            if (true) {
                module["exports"] = Module;
            }
            process["on"]("uncaughtException", (function(ex) {
                if (!(ex instanceof ExitStatus)) {
                    throw ex;
                }
            }));
            process["on"]("unhandledRejection", abort);
            quit_ = function(status) {
                process["exit"](status);
            };
            Module["inspect"] = function() {
                return "[Emscripten Module object]";
            };
        } else if (ENVIRONMENT_IS_SHELL) {
            if (typeof read != "undefined") {
                read_ = function shell_read(f) {
                    return read(f);
                };
            }
            readBinary = function readBinary(f) {
                var data;
                if (typeof readbuffer === "function") {
                    return new Uint8Array(readbuffer(f));
                }
                data = read(f, "binary");
                assert(typeof data === "object");
                return data;
            };
            if (typeof scriptArgs != "undefined") {
                arguments_ = scriptArgs;
            } else if (typeof arguments != "undefined") {
                arguments_ = arguments;
            }
            if (typeof quit === "function") {
                quit_ = function(status) {
                    quit(status);
                };
            }
            if (typeof print !== "undefined") {
                if (typeof console === "undefined") console = {};
                console.log = print;
                console.warn = console.error = typeof printErr !== "undefined" ? printErr : print;
            }
        } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
            if (ENVIRONMENT_IS_WORKER) {
                scriptDirectory = self.location.href;
            } else if (document.currentScript) {
                scriptDirectory = document.currentScript.src;
            }
            if (scriptDirectory.indexOf("blob:") !== 0) {
                scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1);
            } else {
                scriptDirectory = "";
            }
            {
                read_ = function shell_read(url) {
                    var xhr = new XMLHttpRequest;
                    xhr.open("GET", url, false);
                    xhr.send(null);
                    return xhr.responseText;
                };
                if (ENVIRONMENT_IS_WORKER) {
                    readBinary = function readBinary(url) {
                        var xhr = new XMLHttpRequest;
                        xhr.open("GET", url, false);
                        xhr.responseType = "arraybuffer";
                        xhr.send(null);
                        return new Uint8Array(xhr.response);
                    };
                }
                readAsync = function readAsync(url, onload, onerror) {
                    var xhr = new XMLHttpRequest;
                    xhr.open("GET", url, true);
                    xhr.responseType = "arraybuffer";
                    xhr.onload = function xhr_onload() {
                        if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
                            onload(xhr.response);
                            return;
                        }
                        onerror();
                    };
                    xhr.onerror = onerror;
                    xhr.send(null);
                };
            }
            setWindowTitle = function(title) {
                document.title = title;
            };
        } else {}
        var out = Module["print"] || console.log.bind(console);
        var err = Module["printErr"] || console.warn.bind(console);
        for (key in moduleOverrides) {
            if (moduleOverrides.hasOwnProperty(key)) {
                Module[key] = moduleOverrides[key];
            }
        }
        moduleOverrides = null;
        if (Module["arguments"]) arguments_ = Module["arguments"];
        if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
        if (Module["quit"]) quit_ = Module["quit"];
        var wasmBinary;
        if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
        var noExitRuntime;
        if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
        if (typeof WebAssembly !== "object") {
            abort("no native wasm support detected");
        }
        var wasmMemory;
        var wasmTable;
        var ABORT = false;
        var EXITSTATUS = 0;
        function assert(condition, text) {
            if (!condition) {
                abort("Assertion failed: " + text);
            }
        }
        function getCFunc(ident) {
            var func = Module["_" + ident];
            assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");
            return func;
        }
        function ccall(ident, returnType, argTypes, args, opts) {
            var toC = {
                string: function(str) {
                    var ret = 0;
                    if (str !== null && str !== undefined && str !== 0) {
                        var len = (str.length << 2) + 1;
                        ret = stackAlloc(len);
                        stringToUTF8(str, ret, len);
                    }
                    return ret;
                },
                array: function(arr) {
                    var ret = stackAlloc(arr.length);
                    writeArrayToMemory(arr, ret);
                    return ret;
                }
            };
            function convertReturnValue(ret) {
                if (returnType === "string") return UTF8ToString(ret);
                if (returnType === "boolean") return Boolean(ret);
                return ret;
            }
            var func = getCFunc(ident);
            var cArgs = [];
            var stack = 0;
            if (args) {
                for (var i = 0; i < args.length; i++) {
                    var converter = toC[argTypes[i]];
                    if (converter) {
                        if (stack === 0) stack = stackSave();
                        cArgs[i] = converter(args[i]);
                    } else {
                        cArgs[i] = args[i];
                    }
                }
            }
            var ret = func.apply(null, cArgs);
            ret = convertReturnValue(ret);
            if (stack !== 0) stackRestore(stack);
            return ret;
        }
        var UTF8Decoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf8") : undefined;
        function UTF8ArrayToString(heap, idx, maxBytesToRead) {
            var endIdx = idx + maxBytesToRead;
            var endPtr = idx;
            while (heap[endPtr] && !(endPtr >= endIdx)) ++endPtr;
            if (endPtr - idx > 16 && heap.subarray && UTF8Decoder) {
                return UTF8Decoder.decode(heap.subarray(idx, endPtr));
            } else {
                var str = "";
                while (idx < endPtr) {
                    var u0 = heap[idx++];
                    if (!(u0 & 128)) {
                        str += String.fromCharCode(u0);
                        continue;
                    }
                    var u1 = heap[idx++] & 63;
                    if ((u0 & 224) == 192) {
                        str += String.fromCharCode((u0 & 31) << 6 | u1);
                        continue;
                    }
                    var u2 = heap[idx++] & 63;
                    if ((u0 & 240) == 224) {
                        u0 = (u0 & 15) << 12 | u1 << 6 | u2;
                    } else {
                        u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heap[idx++] & 63;
                    }
                    if (u0 < 65536) {
                        str += String.fromCharCode(u0);
                    } else {
                        var ch = u0 - 65536;
                        str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
                    }
                }
            }
            return str;
        }
        function UTF8ToString(ptr, maxBytesToRead) {
            return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
        }
        function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
            if (!(maxBytesToWrite > 0)) return 0;
            var startIdx = outIdx;
            var endIdx = outIdx + maxBytesToWrite - 1;
            for (var i = 0; i < str.length; ++i) {
                var u = str.charCodeAt(i);
                if (u >= 55296 && u <= 57343) {
                    var u1 = str.charCodeAt(++i);
                    u = 65536 + ((u & 1023) << 10) | u1 & 1023;
                }
                if (u <= 127) {
                    if (outIdx >= endIdx) break;
                    heap[outIdx++] = u;
                } else if (u <= 2047) {
                    if (outIdx + 1 >= endIdx) break;
                    heap[outIdx++] = 192 | u >> 6;
                    heap[outIdx++] = 128 | u & 63;
                } else if (u <= 65535) {
                    if (outIdx + 2 >= endIdx) break;
                    heap[outIdx++] = 224 | u >> 12;
                    heap[outIdx++] = 128 | u >> 6 & 63;
                    heap[outIdx++] = 128 | u & 63;
                } else {
                    if (outIdx + 3 >= endIdx) break;
                    heap[outIdx++] = 240 | u >> 18;
                    heap[outIdx++] = 128 | u >> 12 & 63;
                    heap[outIdx++] = 128 | u >> 6 & 63;
                    heap[outIdx++] = 128 | u & 63;
                }
            }
            heap[outIdx] = 0;
            return outIdx - startIdx;
        }
        function stringToUTF8(str, outPtr, maxBytesToWrite) {
            return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
        }
        function writeArrayToMemory(array, buffer) {
            HEAP8.set(array, buffer);
        }
        var WASM_PAGE_SIZE = 65536;
        var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
        function updateGlobalBufferAndViews(buf) {
            buffer = buf;
            Module["HEAP8"] = HEAP8 = new Int8Array(buf);
            Module["HEAP16"] = HEAP16 = new Int16Array(buf);
            Module["HEAP32"] = HEAP32 = new Int32Array(buf);
            Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf);
            Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf);
            Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf);
            Module["HEAPF32"] = HEAPF32 = new Float32Array(buf);
            Module["HEAPF64"] = HEAPF64 = new Float64Array(buf);
        }
        var INITIAL_INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
        if (Module["wasmMemory"]) {
            wasmMemory = Module["wasmMemory"];
        } else {
            wasmMemory = new WebAssembly.Memory({
                initial: INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE,
                maximum: INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE
            });
        }
        if (wasmMemory) {
            buffer = wasmMemory.buffer;
        }
        INITIAL_INITIAL_MEMORY = buffer.byteLength;
        updateGlobalBufferAndViews(buffer);
        var __ATPRERUN__ = [];
        var __ATINIT__ = [];
        var __ATMAIN__ = [];
        var __ATPOSTRUN__ = [];
        var runtimeInitialized = false;
        function preRun() {
            if (Module["preRun"]) {
                if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ];
                while (Module["preRun"].length) {
                    addOnPreRun(Module["preRun"].shift());
                }
            }
            callRuntimeCallbacks(__ATPRERUN__);
        }
        function initRuntime() {
            runtimeInitialized = true;
            callRuntimeCallbacks(__ATINIT__);
        }
        function preMain() {
            callRuntimeCallbacks(__ATMAIN__);
        }
        function postRun() {
            if (Module["postRun"]) {
                if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ];
                while (Module["postRun"].length) {
                    addOnPostRun(Module["postRun"].shift());
                }
            }
            callRuntimeCallbacks(__ATPOSTRUN__);
        }
        function addOnPreRun(cb) {
            __ATPRERUN__.unshift(cb);
        }
        function addOnPostRun(cb) {
            __ATPOSTRUN__.unshift(cb);
        }
        var runDependencies = 0;
        var runDependencyWatcher = null;
        var dependenciesFulfilled = null;
        function addRunDependency(id) {
            runDependencies++;
            if (Module["monitorRunDependencies"]) {
                Module["monitorRunDependencies"](runDependencies);
            }
        }
        function removeRunDependency(id) {
            runDependencies--;
            if (Module["monitorRunDependencies"]) {
                Module["monitorRunDependencies"](runDependencies);
            }
            if (runDependencies == 0) {
                if (runDependencyWatcher !== null) {
                    clearInterval(runDependencyWatcher);
                    runDependencyWatcher = null;
                }
                if (dependenciesFulfilled) {
                    var callback = dependenciesFulfilled;
                    dependenciesFulfilled = null;
                    callback();
                }
            }
        }
        Module["preloadedImages"] = {};
        Module["preloadedAudios"] = {};
        function abort(what) {
            if (Module["onAbort"]) {
                Module["onAbort"](what);
            }
            what += "";
            err(what);
            ABORT = true;
            EXITSTATUS = 1;
            what = "abort(" + what + "). Build with -s ASSERTIONS=1 for more info.";
            var e = new WebAssembly.RuntimeError(what);
            throw e;
        }
        function hasPrefix(str, prefix) {
            return String.prototype.startsWith ? str.startsWith(prefix) : str.indexOf(prefix) === 0;
        }
        var dataURIPrefix = "data:application/octet-stream;base64,";
        function isDataURI(filename) {
            return hasPrefix(filename, dataURIPrefix);
        }
        var fileURIPrefix = "file://";
        function isFileURI(filename) {
            return hasPrefix(filename, fileURIPrefix);
        }
        var wasmBinaryFile = "crc32.wasm";
        if (!isDataURI(wasmBinaryFile)) {
            wasmBinaryFile = locateFile(wasmBinaryFile);
        }
        function getBinary() {
            try {
                if (wasmBinary) {
                    return new Uint8Array(wasmBinary);
                }
                if (readBinary) {
                    return readBinary(wasmBinaryFile);
                } else {
                    throw "both async and sync fetching of the wasm failed";
                }
            } catch (err) {
                abort(err);
            }
        }
        function getBinaryPromise() {
            if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === "function" && !isFileURI(wasmBinaryFile)) {
                return fetch(wasmBinaryFile, {
                    credentials: "same-origin"
                }).then((function(response) {
                    if (!response["ok"]) {
                        throw "failed to load wasm binary file at '" + wasmBinaryFile + "'";
                    }
                    return response["arrayBuffer"]();
                })).catch((function() {
                    return getBinary();
                }));
            }
            return Promise.resolve().then(getBinary);
        }
        function createWasm() {
            var info = {
                a: asmLibraryArg
            };
            function receiveInstance(instance, module) {
                var exports = instance.exports;
                Module["asm"] = exports;
                wasmTable = Module["asm"]["b"];
                removeRunDependency("wasm-instantiate");
            }
            addRunDependency("wasm-instantiate");
            function receiveInstantiatedSource(output) {
                receiveInstance(output["instance"]);
            }
            function instantiateArrayBuffer(receiver) {
                return getBinaryPromise().then((function(binary) {
                    return WebAssembly.instantiate(binary, info);
                })).then(receiver, (function(reason) {
                    err("failed to asynchronously prepare wasm: " + reason);
                    abort(reason);
                }));
            }
            function instantiateAsync() {
                if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && !isFileURI(wasmBinaryFile) && typeof fetch === "function") {
                    fetch(wasmBinaryFile, {
                        credentials: "same-origin"
                    }).then((function(response) {
                        var result = WebAssembly.instantiateStreaming(response, info);
                        return result.then(receiveInstantiatedSource, (function(reason) {
                            err("wasm streaming compile failed: " + reason);
                            err("falling back to ArrayBuffer instantiation");
                            return instantiateArrayBuffer(receiveInstantiatedSource);
                        }));
                    }));
                } else {
                    return instantiateArrayBuffer(receiveInstantiatedSource);
                }
            }
            if (Module["instantiateWasm"]) {
                try {
                    var exports = Module["instantiateWasm"](info, receiveInstance);
                    return exports;
                } catch (e) {
                    err("Module.instantiateWasm callback failed with error: " + e);
                    return false;
                }
            }
            instantiateAsync();
            return {};
        }
        function callRuntimeCallbacks(callbacks) {
            while (callbacks.length > 0) {
                var callback = callbacks.shift();
                if (typeof callback == "function") {
                    callback(Module);
                    continue;
                }
                var func = callback.func;
                if (typeof func === "number") {
                    if (callback.arg === undefined) {
                        wasmTable.get(func)();
                    } else {
                        wasmTable.get(func)(callback.arg);
                    }
                } else {
                    func(callback.arg === undefined ? null : callback.arg);
                }
            }
        }
        __ATINIT__.push({
            func: function() {
                ___wasm_call_ctors();
            }
        });
        var asmLibraryArg = {
            a: wasmMemory
        };
        var asm = createWasm();
        var ___wasm_call_ctors = Module["___wasm_call_ctors"] = function() {
            return (___wasm_call_ctors = Module["___wasm_call_ctors"] = Module["asm"]["c"]).apply(null, arguments);
        };
        var _crc32_combine = Module["_crc32_combine"] = function() {
            return (_crc32_combine = Module["_crc32_combine"] = Module["asm"]["d"]).apply(null, arguments);
        };
        var stackSave = Module["stackSave"] = function() {
            return (stackSave = Module["stackSave"] = Module["asm"]["e"]).apply(null, arguments);
        };
        var stackRestore = Module["stackRestore"] = function() {
            return (stackRestore = Module["stackRestore"] = Module["asm"]["f"]).apply(null, arguments);
        };
        var stackAlloc = Module["stackAlloc"] = function() {
            return (stackAlloc = Module["stackAlloc"] = Module["asm"]["g"]).apply(null, arguments);
        };
        Module["ccall"] = ccall;
        var calledRun;
        function ExitStatus(status) {
            this.name = "ExitStatus";
            this.message = "Program terminated with exit(" + status + ")";
            this.status = status;
        }
        dependenciesFulfilled = function runCaller() {
            if (!calledRun) run();
            if (!calledRun) dependenciesFulfilled = runCaller;
        };
        function run(args) {
            args = args || arguments_;
            if (runDependencies > 0) {
                return;
            }
            preRun();
            if (runDependencies > 0) return;
            function doRun() {
                if (calledRun) return;
                calledRun = true;
                Module["calledRun"] = true;
                if (ABORT) return;
                initRuntime();
                preMain();
                if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
                postRun();
            }
            if (Module["setStatus"]) {
                Module["setStatus"]("Running...");
                setTimeout((function() {
                    setTimeout((function() {
                        Module["setStatus"]("");
                    }), 1);
                    doRun();
                }), 1);
            } else {
                doRun();
            }
        }
        Module["run"] = run;
        if (Module["preInit"]) {
            if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ];
            while (Module["preInit"].length > 0) {
                Module["preInit"].pop()();
            }
        }
        noExitRuntime = true;
        run();
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        module.exports = {
            CRC32Stream: __webpack_require__(228),
            DeflateCRC32Stream: __webpack_require__(250)
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const {Transform} = __webpack_require__(229);
        const crc32 = __webpack_require__(249);
        class CRC32Stream extends Transform {
            constructor(options) {
                super(options);
                this.checksum = Buffer.allocUnsafe(4);
                this.checksum.writeInt32BE(0, 0);
                this.rawSize = 0;
            }
            _transform(chunk, encoding, callback) {
                if (chunk) {
                    this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
                    this.rawSize += chunk.length;
                }
                callback(null, chunk);
            }
            digest(encoding) {
                const checksum = Buffer.allocUnsafe(4);
                checksum.writeUInt32BE(this.checksum >>> 0, 0);
                return encoding ? checksum.toString(encoding) : checksum;
            }
            hex() {
                return this.digest("hex").toUpperCase();
            }
            size() {
                return this.rawSize;
            }
        }
        module.exports = CRC32Stream;
    }, (module, exports, __webpack_require__) => {
        var Stream = __webpack_require__(17);
        if (process.env.READABLE_STREAM === "disable" && Stream) {
            module.exports = Stream.Readable;
            Object.assign(module.exports, Stream);
            module.exports.Stream = Stream;
        } else {
            exports = module.exports = __webpack_require__(230);
            exports.Stream = Stream || exports;
            exports.Readable = exports;
            exports.Writable = __webpack_require__(239);
            exports.Duplex = __webpack_require__(238);
            exports.Transform = __webpack_require__(246);
            exports.PassThrough = __webpack_require__(247);
            exports.finished = __webpack_require__(244);
            exports.pipeline = __webpack_require__(248);
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        module.exports = Readable;
        var Duplex;
        Readable.ReadableState = ReadableState;
        var EE = __webpack_require__(41).EventEmitter;
        var EElistenerCount = function EElistenerCount(emitter, type) {
            return emitter.listeners(type).length;
        };
        var Stream = __webpack_require__(231);
        var Buffer = __webpack_require__(102).Buffer;
        var OurUint8Array = global.Uint8Array || function() {};
        function _uint8ArrayToBuffer(chunk) {
            return Buffer.from(chunk);
        }
        function _isUint8Array(obj) {
            return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
        }
        var debugUtil = __webpack_require__(14);
        var debug;
        if (debugUtil && debugUtil.debuglog) {
            debug = debugUtil.debuglog("stream");
        } else {
            debug = function debug() {};
        }
        var BufferList = __webpack_require__(232);
        var destroyImpl = __webpack_require__(233);
        var _require = __webpack_require__(234), getHighWaterMark = _require.getHighWaterMark;
        var _require$codes = __webpack_require__(235).q, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
        var StringDecoder;
        var createReadableStreamAsyncIterator;
        var from;
        __webpack_require__(236)(Readable, Stream);
        var errorOrDestroy = destroyImpl.errorOrDestroy;
        var kProxyEvents = [ "error", "close", "destroy", "pause", "resume" ];
        function prependListener(emitter, event, fn) {
            if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
            if (!emitter._events || !emitter._events[event]) emitter.on(event, fn); else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn); else emitter._events[event] = [ fn, emitter._events[event] ];
        }
        function ReadableState(options, stream, isDuplex) {
            Duplex = Duplex || __webpack_require__(238);
            options = options || {};
            if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex;
            this.objectMode = !!options.objectMode;
            if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
            this.highWaterMark = getHighWaterMark(this, options, "readableHighWaterMark", isDuplex);
            this.buffer = new BufferList;
            this.length = 0;
            this.pipes = null;
            this.pipesCount = 0;
            this.flowing = null;
            this.ended = false;
            this.endEmitted = false;
            this.reading = false;
            this.sync = true;
            this.needReadable = false;
            this.emittedReadable = false;
            this.readableListening = false;
            this.resumeScheduled = false;
            this.paused = true;
            this.emitClose = options.emitClose !== false;
            this.autoDestroy = !!options.autoDestroy;
            this.destroyed = false;
            this.defaultEncoding = options.defaultEncoding || "utf8";
            this.awaitDrain = 0;
            this.readingMore = false;
            this.decoder = null;
            this.encoding = null;
            if (options.encoding) {
                if (!StringDecoder) StringDecoder = __webpack_require__(241).s;
                this.decoder = new StringDecoder(options.encoding);
                this.encoding = options.encoding;
            }
        }
        function Readable(options) {
            Duplex = Duplex || __webpack_require__(238);
            if (!(this instanceof Readable)) return new Readable(options);
            var isDuplex = this instanceof Duplex;
            this._readableState = new ReadableState(options, this, isDuplex);
            this.readable = true;
            if (options) {
                if (typeof options.read === "function") this._read = options.read;
                if (typeof options.destroy === "function") this._destroy = options.destroy;
            }
            Stream.call(this);
        }
        Object.defineProperty(Readable.prototype, "destroyed", {
            enumerable: false,
            get: function get() {
                if (this._readableState === undefined) {
                    return false;
                }
                return this._readableState.destroyed;
            },
            set: function set(value) {
                if (!this._readableState) {
                    return;
                }
                this._readableState.destroyed = value;
            }
        });
        Readable.prototype.destroy = destroyImpl.destroy;
        Readable.prototype._undestroy = destroyImpl.undestroy;
        Readable.prototype._destroy = function(err, cb) {
            cb(err);
        };
        Readable.prototype.push = function(chunk, encoding) {
            var state = this._readableState;
            var skipChunkCheck;
            if (!state.objectMode) {
                if (typeof chunk === "string") {
                    encoding = encoding || state.defaultEncoding;
                    if (encoding !== state.encoding) {
                        chunk = Buffer.from(chunk, encoding);
                        encoding = "";
                    }
                    skipChunkCheck = true;
                }
            } else {
                skipChunkCheck = true;
            }
            return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
        };
        Readable.prototype.unshift = function(chunk) {
            return readableAddChunk(this, chunk, null, true, false);
        };
        function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
            debug("readableAddChunk", chunk);
            var state = stream._readableState;
            if (chunk === null) {
                state.reading = false;
                onEofChunk(stream, state);
            } else {
                var er;
                if (!skipChunkCheck) er = chunkInvalid(state, chunk);
                if (er) {
                    errorOrDestroy(stream, er);
                } else if (state.objectMode || chunk && chunk.length > 0) {
                    if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
                        chunk = _uint8ArrayToBuffer(chunk);
                    }
                    if (addToFront) {
                        if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT); else addChunk(stream, state, chunk, true);
                    } else if (state.ended) {
                        errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF);
                    } else if (state.destroyed) {
                        return false;
                    } else {
                        state.reading = false;
                        if (state.decoder && !encoding) {
                            chunk = state.decoder.write(chunk);
                            if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false); else maybeReadMore(stream, state);
                        } else {
                            addChunk(stream, state, chunk, false);
                        }
                    }
                } else if (!addToFront) {
                    state.reading = false;
                    maybeReadMore(stream, state);
                }
            }
            return !state.ended && (state.length < state.highWaterMark || state.length === 0);
        }
        function addChunk(stream, state, chunk, addToFront) {
            if (state.flowing && state.length === 0 && !state.sync) {
                state.awaitDrain = 0;
                stream.emit("data", chunk);
            } else {
                state.length += state.objectMode ? 1 : chunk.length;
                if (addToFront) state.buffer.unshift(chunk); else state.buffer.push(chunk);
                if (state.needReadable) emitReadable(stream);
            }
            maybeReadMore(stream, state);
        }
        function chunkInvalid(state, chunk) {
            var er;
            if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== undefined && !state.objectMode) {
                er = new ERR_INVALID_ARG_TYPE("chunk", [ "string", "Buffer", "Uint8Array" ], chunk);
            }
            return er;
        }
        Readable.prototype.isPaused = function() {
            return this._readableState.flowing === false;
        };
        Readable.prototype.setEncoding = function(enc) {
            if (!StringDecoder) StringDecoder = __webpack_require__(241).s;
            var decoder = new StringDecoder(enc);
            this._readableState.decoder = decoder;
            this._readableState.encoding = this._readableState.decoder.encoding;
            var p = this._readableState.buffer.head;
            var content = "";
            while (p !== null) {
                content += decoder.write(p.data);
                p = p.next;
            }
            this._readableState.buffer.clear();
            if (content !== "") this._readableState.buffer.push(content);
            this._readableState.length = content.length;
            return this;
        };
        var MAX_HWM = 1073741824;
        function computeNewHighWaterMark(n) {
            if (n >= MAX_HWM) {
                n = MAX_HWM;
            } else {
                n--;
                n |= n >>> 1;
                n |= n >>> 2;
                n |= n >>> 4;
                n |= n >>> 8;
                n |= n >>> 16;
                n++;
            }
            return n;
        }
        function howMuchToRead(n, state) {
            if (n <= 0 || state.length === 0 && state.ended) return 0;
            if (state.objectMode) return 1;
            if (n !== n) {
                if (state.flowing && state.length) return state.buffer.head.data.length; else return state.length;
            }
            if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
            if (n <= state.length) return n;
            if (!state.ended) {
                state.needReadable = true;
                return 0;
            }
            return state.length;
        }
        Readable.prototype.read = function(n) {
            debug("read", n);
            n = parseInt(n, 10);
            var state = this._readableState;
            var nOrig = n;
            if (n !== 0) state.emittedReadable = false;
            if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
                debug("read: emitReadable", state.length, state.ended);
                if (state.length === 0 && state.ended) endReadable(this); else emitReadable(this);
                return null;
            }
            n = howMuchToRead(n, state);
            if (n === 0 && state.ended) {
                if (state.length === 0) endReadable(this);
                return null;
            }
            var doRead = state.needReadable;
            debug("need readable", doRead);
            if (state.length === 0 || state.length - n < state.highWaterMark) {
                doRead = true;
                debug("length less than watermark", doRead);
            }
            if (state.ended || state.reading) {
                doRead = false;
                debug("reading or ended", doRead);
            } else if (doRead) {
                debug("do read");
                state.reading = true;
                state.sync = true;
                if (state.length === 0) state.needReadable = true;
                this._read(state.highWaterMark);
                state.sync = false;
                if (!state.reading) n = howMuchToRead(nOrig, state);
            }
            var ret;
            if (n > 0) ret = fromList(n, state); else ret = null;
            if (ret === null) {
                state.needReadable = state.length <= state.highWaterMark;
                n = 0;
            } else {
                state.length -= n;
                state.awaitDrain = 0;
            }
            if (state.length === 0) {
                if (!state.ended) state.needReadable = true;
                if (nOrig !== n && state.ended) endReadable(this);
            }
            if (ret !== null) this.emit("data", ret);
            return ret;
        };
        function onEofChunk(stream, state) {
            debug("onEofChunk");
            if (state.ended) return;
            if (state.decoder) {
                var chunk = state.decoder.end();
                if (chunk && chunk.length) {
                    state.buffer.push(chunk);
                    state.length += state.objectMode ? 1 : chunk.length;
                }
            }
            state.ended = true;
            if (state.sync) {
                emitReadable(stream);
            } else {
                state.needReadable = false;
                if (!state.emittedReadable) {
                    state.emittedReadable = true;
                    emitReadable_(stream);
                }
            }
        }
        function emitReadable(stream) {
            var state = stream._readableState;
            debug("emitReadable", state.needReadable, state.emittedReadable);
            state.needReadable = false;
            if (!state.emittedReadable) {
                debug("emitReadable", state.flowing);
                state.emittedReadable = true;
                process.nextTick(emitReadable_, stream);
            }
        }
        function emitReadable_(stream) {
            var state = stream._readableState;
            debug("emitReadable_", state.destroyed, state.length, state.ended);
            if (!state.destroyed && (state.length || state.ended)) {
                stream.emit("readable");
                state.emittedReadable = false;
            }
            state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
            flow(stream);
        }
        function maybeReadMore(stream, state) {
            if (!state.readingMore) {
                state.readingMore = true;
                process.nextTick(maybeReadMore_, stream, state);
            }
        }
        function maybeReadMore_(stream, state) {
            while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
                var len = state.length;
                debug("maybeReadMore read 0");
                stream.read(0);
                if (len === state.length) break;
            }
            state.readingMore = false;
        }
        Readable.prototype._read = function(n) {
            errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
        };
        Readable.prototype.pipe = function(dest, pipeOpts) {
            var src = this;
            var state = this._readableState;
            switch (state.pipesCount) {
              case 0:
                state.pipes = dest;
                break;

              case 1:
                state.pipes = [ state.pipes, dest ];
                break;

              default:
                state.pipes.push(dest);
                break;
            }
            state.pipesCount += 1;
            debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
            var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
            var endFn = doEnd ? onend : unpipe;
            if (state.endEmitted) process.nextTick(endFn); else src.once("end", endFn);
            dest.on("unpipe", onunpipe);
            function onunpipe(readable, unpipeInfo) {
                debug("onunpipe");
                if (readable === src) {
                    if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
                        unpipeInfo.hasUnpiped = true;
                        cleanup();
                    }
                }
            }
            function onend() {
                debug("onend");
                dest.end();
            }
            var ondrain = pipeOnDrain(src);
            dest.on("drain", ondrain);
            var cleanedUp = false;
            function cleanup() {
                debug("cleanup");
                dest.removeListener("close", onclose);
                dest.removeListener("finish", onfinish);
                dest.removeListener("drain", ondrain);
                dest.removeListener("error", onerror);
                dest.removeListener("unpipe", onunpipe);
                src.removeListener("end", onend);
                src.removeListener("end", unpipe);
                src.removeListener("data", ondata);
                cleanedUp = true;
                if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
            }
            src.on("data", ondata);
            function ondata(chunk) {
                debug("ondata");
                var ret = dest.write(chunk);
                debug("dest.write", ret);
                if (ret === false) {
                    if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
                        debug("false write response, pause", state.awaitDrain);
                        state.awaitDrain++;
                    }
                    src.pause();
                }
            }
            function onerror(er) {
                debug("onerror", er);
                unpipe();
                dest.removeListener("error", onerror);
                if (EElistenerCount(dest, "error") === 0) errorOrDestroy(dest, er);
            }
            prependListener(dest, "error", onerror);
            function onclose() {
                dest.removeListener("finish", onfinish);
                unpipe();
            }
            dest.once("close", onclose);
            function onfinish() {
                debug("onfinish");
                dest.removeListener("close", onclose);
                unpipe();
            }
            dest.once("finish", onfinish);
            function unpipe() {
                debug("unpipe");
                src.unpipe(dest);
            }
            dest.emit("pipe", src);
            if (!state.flowing) {
                debug("pipe resume");
                src.resume();
            }
            return dest;
        };
        function pipeOnDrain(src) {
            return function pipeOnDrainFunctionResult() {
                var state = src._readableState;
                debug("pipeOnDrain", state.awaitDrain);
                if (state.awaitDrain) state.awaitDrain--;
                if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
                    state.flowing = true;
                    flow(src);
                }
            };
        }
        Readable.prototype.unpipe = function(dest) {
            var state = this._readableState;
            var unpipeInfo = {
                hasUnpiped: false
            };
            if (state.pipesCount === 0) return this;
            if (state.pipesCount === 1) {
                if (dest && dest !== state.pipes) return this;
                if (!dest) dest = state.pipes;
                state.pipes = null;
                state.pipesCount = 0;
                state.flowing = false;
                if (dest) dest.emit("unpipe", this, unpipeInfo);
                return this;
            }
            if (!dest) {
                var dests = state.pipes;
                var len = state.pipesCount;
                state.pipes = null;
                state.pipesCount = 0;
                state.flowing = false;
                for (var i = 0; i < len; i++) {
                    dests[i].emit("unpipe", this, {
                        hasUnpiped: false
                    });
                }
                return this;
            }
            var index = indexOf(state.pipes, dest);
            if (index === -1) return this;
            state.pipes.splice(index, 1);
            state.pipesCount -= 1;
            if (state.pipesCount === 1) state.pipes = state.pipes[0];
            dest.emit("unpipe", this, unpipeInfo);
            return this;
        };
        Readable.prototype.on = function(ev, fn) {
            var res = Stream.prototype.on.call(this, ev, fn);
            var state = this._readableState;
            if (ev === "data") {
                state.readableListening = this.listenerCount("readable") > 0;
                if (state.flowing !== false) this.resume();
            } else if (ev === "readable") {
                if (!state.endEmitted && !state.readableListening) {
                    state.readableListening = state.needReadable = true;
                    state.flowing = false;
                    state.emittedReadable = false;
                    debug("on readable", state.length, state.reading);
                    if (state.length) {
                        emitReadable(this);
                    } else if (!state.reading) {
                        process.nextTick(nReadingNextTick, this);
                    }
                }
            }
            return res;
        };
        Readable.prototype.addListener = Readable.prototype.on;
        Readable.prototype.removeListener = function(ev, fn) {
            var res = Stream.prototype.removeListener.call(this, ev, fn);
            if (ev === "readable") {
                process.nextTick(updateReadableListening, this);
            }
            return res;
        };
        Readable.prototype.removeAllListeners = function(ev) {
            var res = Stream.prototype.removeAllListeners.apply(this, arguments);
            if (ev === "readable" || ev === undefined) {
                process.nextTick(updateReadableListening, this);
            }
            return res;
        };
        function updateReadableListening(self) {
            var state = self._readableState;
            state.readableListening = self.listenerCount("readable") > 0;
            if (state.resumeScheduled && !state.paused) {
                state.flowing = true;
            } else if (self.listenerCount("data") > 0) {
                self.resume();
            }
        }
        function nReadingNextTick(self) {
            debug("readable nexttick read 0");
            self.read(0);
        }
        Readable.prototype.resume = function() {
            var state = this._readableState;
            if (!state.flowing) {
                debug("resume");
                state.flowing = !state.readableListening;
                resume(this, state);
            }
            state.paused = false;
            return this;
        };
        function resume(stream, state) {
            if (!state.resumeScheduled) {
                state.resumeScheduled = true;
                process.nextTick(resume_, stream, state);
            }
        }
        function resume_(stream, state) {
            debug("resume", state.reading);
            if (!state.reading) {
                stream.read(0);
            }
            state.resumeScheduled = false;
            stream.emit("resume");
            flow(stream);
            if (state.flowing && !state.reading) stream.read(0);
        }
        Readable.prototype.pause = function() {
            debug("call pause flowing=%j", this._readableState.flowing);
            if (this._readableState.flowing !== false) {
                debug("pause");
                this._readableState.flowing = false;
                this.emit("pause");
            }
            this._readableState.paused = true;
            return this;
        };
        function flow(stream) {
            var state = stream._readableState;
            debug("flow", state.flowing);
            while (state.flowing && stream.read() !== null) {
            }
        }
        Readable.prototype.wrap = function(stream) {
            var _this = this;
            var state = this._readableState;
            var paused = false;
            stream.on("end", (function() {
                debug("wrapped end");
                if (state.decoder && !state.ended) {
                    var chunk = state.decoder.end();
                    if (chunk && chunk.length) _this.push(chunk);
                }
                _this.push(null);
            }));
            stream.on("data", (function(chunk) {
                debug("wrapped data");
                if (state.decoder) chunk = state.decoder.write(chunk);
                if (state.objectMode && (chunk === null || chunk === undefined)) return; else if (!state.objectMode && (!chunk || !chunk.length)) return;
                var ret = _this.push(chunk);
                if (!ret) {
                    paused = true;
                    stream.pause();
                }
            }));
            for (var i in stream) {
                if (this[i] === undefined && typeof stream[i] === "function") {
                    this[i] = function methodWrap(method) {
                        return function methodWrapReturnFunction() {
                            return stream[method].apply(stream, arguments);
                        };
                    }(i);
                }
            }
            for (var n = 0; n < kProxyEvents.length; n++) {
                stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
            }
            this._read = function(n) {
                debug("wrapped _read", n);
                if (paused) {
                    paused = false;
                    stream.resume();
                }
            };
            return this;
        };
        if (typeof Symbol === "function") {
            Readable.prototype[Symbol.asyncIterator] = function() {
                if (createReadableStreamAsyncIterator === undefined) {
                    createReadableStreamAsyncIterator = __webpack_require__(243);
                }
                return createReadableStreamAsyncIterator(this);
            };
        }
        Object.defineProperty(Readable.prototype, "readableHighWaterMark", {
            enumerable: false,
            get: function get() {
                return this._readableState.highWaterMark;
            }
        });
        Object.defineProperty(Readable.prototype, "readableBuffer", {
            enumerable: false,
            get: function get() {
                return this._readableState && this._readableState.buffer;
            }
        });
        Object.defineProperty(Readable.prototype, "readableFlowing", {
            enumerable: false,
            get: function get() {
                return this._readableState.flowing;
            },
            set: function set(state) {
                if (this._readableState) {
                    this._readableState.flowing = state;
                }
            }
        });
        Readable._fromList = fromList;
        Object.defineProperty(Readable.prototype, "readableLength", {
            enumerable: false,
            get: function get() {
                return this._readableState.length;
            }
        });
        function fromList(n, state) {
            if (state.length === 0) return null;
            var ret;
            if (state.objectMode) ret = state.buffer.shift(); else if (!n || n >= state.length) {
                if (state.decoder) ret = state.buffer.join(""); else if (state.buffer.length === 1) ret = state.buffer.first(); else ret = state.buffer.concat(state.length);
                state.buffer.clear();
            } else {
                ret = state.buffer.consume(n, state.decoder);
            }
            return ret;
        }
        function endReadable(stream) {
            var state = stream._readableState;
            debug("endReadable", state.endEmitted);
            if (!state.endEmitted) {
                state.ended = true;
                process.nextTick(endReadableNT, state, stream);
            }
        }
        function endReadableNT(state, stream) {
            debug("endReadableNT", state.endEmitted, state.length);
            if (!state.endEmitted && state.length === 0) {
                state.endEmitted = true;
                stream.readable = false;
                stream.emit("end");
                if (state.autoDestroy) {
                    var wState = stream._writableState;
                    if (!wState || wState.autoDestroy && wState.finished) {
                        stream.destroy();
                    }
                }
            }
        }
        if (typeof Symbol === "function") {
            Readable.from = function(iterable, opts) {
                if (from === undefined) {
                    from = __webpack_require__(245);
                }
                return from(Readable, iterable, opts);
            };
        }
        function indexOf(xs, x) {
            for (var i = 0, l = xs.length; i < l; i++) {
                if (xs[i] === x) return i;
            }
            return -1;
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        module.exports = __webpack_require__(17);
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        function ownKeys(object, enumerableOnly) {
            var keys = Object.keys(object);
            if (Object.getOwnPropertySymbols) {
                var symbols = Object.getOwnPropertySymbols(object);
                if (enumerableOnly) symbols = symbols.filter((function(sym) {
                    return Object.getOwnPropertyDescriptor(object, sym).enumerable;
                }));
                keys.push.apply(keys, symbols);
            }
            return keys;
        }
        function _objectSpread(target) {
            for (var i = 1; i < arguments.length; i++) {
                var source = arguments[i] != null ? arguments[i] : {};
                if (i % 2) {
                    ownKeys(Object(source), true).forEach((function(key) {
                        _defineProperty(target, key, source[key]);
                    }));
                } else if (Object.getOwnPropertyDescriptors) {
                    Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
                } else {
                    ownKeys(Object(source)).forEach((function(key) {
                        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
                    }));
                }
            }
            return target;
        }
        function _defineProperty(obj, key, value) {
            if (key in obj) {
                Object.defineProperty(obj, key, {
                    value,
                    enumerable: true,
                    configurable: true,
                    writable: true
                });
            } else {
                obj[key] = value;
            }
            return obj;
        }
        function _classCallCheck(instance, Constructor) {
            if (!(instance instanceof Constructor)) {
                throw new TypeError("Cannot call a class as a function");
            }
        }
        function _defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || false;
                descriptor.configurable = true;
                if ("value" in descriptor) descriptor.writable = true;
                Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        function _createClass(Constructor, protoProps, staticProps) {
            if (protoProps) _defineProperties(Constructor.prototype, protoProps);
            if (staticProps) _defineProperties(Constructor, staticProps);
            return Constructor;
        }
        var _require = __webpack_require__(102), Buffer = _require.Buffer;
        var _require2 = __webpack_require__(14), inspect = _require2.inspect;
        var custom = inspect && inspect.custom || "inspect";
        function copyBuffer(src, target, offset) {
            Buffer.prototype.copy.call(src, target, offset);
        }
        module.exports = function() {
            function BufferList() {
                _classCallCheck(this, BufferList);
                this.head = null;
                this.tail = null;
                this.length = 0;
            }
            _createClass(BufferList, [ {
                key: "push",
                value: function push(v) {
                    var entry = {
                        data: v,
                        next: null
                    };
                    if (this.length > 0) this.tail.next = entry; else this.head = entry;
                    this.tail = entry;
                    ++this.length;
                }
            }, {
                key: "unshift",
                value: function unshift(v) {
                    var entry = {
                        data: v,
                        next: this.head
                    };
                    if (this.length === 0) this.tail = entry;
                    this.head = entry;
                    ++this.length;
                }
            }, {
                key: "shift",
                value: function shift() {
                    if (this.length === 0) return;
                    var ret = this.head.data;
                    if (this.length === 1) this.head = this.tail = null; else this.head = this.head.next;
                    --this.length;
                    return ret;
                }
            }, {
                key: "clear",
                value: function clear() {
                    this.head = this.tail = null;
                    this.length = 0;
                }
            }, {
                key: "join",
                value: function join(s) {
                    if (this.length === 0) return "";
                    var p = this.head;
                    var ret = "" + p.data;
                    while (p = p.next) {
                        ret += s + p.data;
                    }
                    return ret;
                }
            }, {
                key: "concat",
                value: function concat(n) {
                    if (this.length === 0) return Buffer.alloc(0);
                    var ret = Buffer.allocUnsafe(n >>> 0);
                    var p = this.head;
                    var i = 0;
                    while (p) {
                        copyBuffer(p.data, ret, i);
                        i += p.data.length;
                        p = p.next;
                    }
                    return ret;
                }
            }, {
                key: "consume",
                value: function consume(n, hasStrings) {
                    var ret;
                    if (n < this.head.data.length) {
                        ret = this.head.data.slice(0, n);
                        this.head.data = this.head.data.slice(n);
                    } else if (n === this.head.data.length) {
                        ret = this.shift();
                    } else {
                        ret = hasStrings ? this._getString(n) : this._getBuffer(n);
                    }
                    return ret;
                }
            }, {
                key: "first",
                value: function first() {
                    return this.head.data;
                }
            }, {
                key: "_getString",
                value: function _getString(n) {
                    var p = this.head;
                    var c = 1;
                    var ret = p.data;
                    n -= ret.length;
                    while (p = p.next) {
                        var str = p.data;
                        var nb = n > str.length ? str.length : n;
                        if (nb === str.length) ret += str; else ret += str.slice(0, n);
                        n -= nb;
                        if (n === 0) {
                            if (nb === str.length) {
                                ++c;
                                if (p.next) this.head = p.next; else this.head = this.tail = null;
                            } else {
                                this.head = p;
                                p.data = str.slice(nb);
                            }
                            break;
                        }
                        ++c;
                    }
                    this.length -= c;
                    return ret;
                }
            }, {
                key: "_getBuffer",
                value: function _getBuffer(n) {
                    var ret = Buffer.allocUnsafe(n);
                    var p = this.head;
                    var c = 1;
                    p.data.copy(ret);
                    n -= p.data.length;
                    while (p = p.next) {
                        var buf = p.data;
                        var nb = n > buf.length ? buf.length : n;
                        buf.copy(ret, ret.length - n, 0, nb);
                        n -= nb;
                        if (n === 0) {
                            if (nb === buf.length) {
                                ++c;
                                if (p.next) this.head = p.next; else this.head = this.tail = null;
                            } else {
                                this.head = p;
                                p.data = buf.slice(nb);
                            }
                            break;
                        }
                        ++c;
                    }
                    this.length -= c;
                    return ret;
                }
            }, {
                key: custom,
                value: function value(_, options) {
                    return inspect(this, _objectSpread({}, options, {
                        depth: 0,
                        customInspect: false
                    }));
                }
            } ]);
            return BufferList;
        }();
    }, module => {
        "use strict";
        function destroy(err, cb) {
            var _this = this;
            var readableDestroyed = this._readableState && this._readableState.destroyed;
            var writableDestroyed = this._writableState && this._writableState.destroyed;
            if (readableDestroyed || writableDestroyed) {
                if (cb) {
                    cb(err);
                } else if (err) {
                    if (!this._writableState) {
                        process.nextTick(emitErrorNT, this, err);
                    } else if (!this._writableState.errorEmitted) {
                        this._writableState.errorEmitted = true;
                        process.nextTick(emitErrorNT, this, err);
                    }
                }
                return this;
            }
            if (this._readableState) {
                this._readableState.destroyed = true;
            }
            if (this._writableState) {
                this._writableState.destroyed = true;
            }
            this._destroy(err || null, (function(err) {
                if (!cb && err) {
                    if (!_this._writableState) {
                        process.nextTick(emitErrorAndCloseNT, _this, err);
                    } else if (!_this._writableState.errorEmitted) {
                        _this._writableState.errorEmitted = true;
                        process.nextTick(emitErrorAndCloseNT, _this, err);
                    } else {
                        process.nextTick(emitCloseNT, _this);
                    }
                } else if (cb) {
                    process.nextTick(emitCloseNT, _this);
                    cb(err);
                } else {
                    process.nextTick(emitCloseNT, _this);
                }
            }));
            return this;
        }
        function emitErrorAndCloseNT(self, err) {
            emitErrorNT(self, err);
            emitCloseNT(self);
        }
        function emitCloseNT(self) {
            if (self._writableState && !self._writableState.emitClose) return;
            if (self._readableState && !self._readableState.emitClose) return;
            self.emit("close");
        }
        function undestroy() {
            if (this._readableState) {
                this._readableState.destroyed = false;
                this._readableState.reading = false;
                this._readableState.ended = false;
                this._readableState.endEmitted = false;
            }
            if (this._writableState) {
                this._writableState.destroyed = false;
                this._writableState.ended = false;
                this._writableState.ending = false;
                this._writableState.finalCalled = false;
                this._writableState.prefinished = false;
                this._writableState.finished = false;
                this._writableState.errorEmitted = false;
            }
        }
        function emitErrorNT(self, err) {
            self.emit("error", err);
        }
        function errorOrDestroy(stream, err) {
            var rState = stream._readableState;
            var wState = stream._writableState;
            if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err); else stream.emit("error", err);
        }
        module.exports = {
            destroy,
            undestroy,
            errorOrDestroy
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var ERR_INVALID_OPT_VALUE = __webpack_require__(235).q.ERR_INVALID_OPT_VALUE;
        function highWaterMarkFrom(options, isDuplex, duplexKey) {
            return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
        }
        function getHighWaterMark(state, options, duplexKey, isDuplex) {
            var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
            if (hwm != null) {
                if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
                    var name = isDuplex ? duplexKey : "highWaterMark";
                    throw new ERR_INVALID_OPT_VALUE(name, hwm);
                }
                return Math.floor(hwm);
            }
            return state.objectMode ? 16 : 16 * 1024;
        }
        module.exports = {
            getHighWaterMark
        };
    }, module => {
        "use strict";
        const codes = {};
        function createErrorType(code, message, Base) {
            if (!Base) {
                Base = Error;
            }
            function getMessage(arg1, arg2, arg3) {
                if (typeof message === "string") {
                    return message;
                } else {
                    return message(arg1, arg2, arg3);
                }
            }
            class NodeError extends Base {
                constructor(arg1, arg2, arg3) {
                    super(getMessage(arg1, arg2, arg3));
                }
            }
            NodeError.prototype.name = Base.name;
            NodeError.prototype.code = code;
            codes[code] = NodeError;
        }
        function oneOf(expected, thing) {
            if (Array.isArray(expected)) {
                const len = expected.length;
                expected = expected.map((i => String(i)));
                if (len > 2) {
                    return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1];
                } else if (len === 2) {
                    return `one of ${thing} ${expected[0]} or ${expected[1]}`;
                } else {
                    return `of ${thing} ${expected[0]}`;
                }
            } else {
                return `of ${thing} ${String(expected)}`;
            }
        }
        function startsWith(str, search, pos) {
            return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
        }
        function endsWith(str, search, this_len) {
            if (this_len === undefined || this_len > str.length) {
                this_len = str.length;
            }
            return str.substring(this_len - search.length, this_len) === search;
        }
        function includes(str, search, start) {
            if (typeof start !== "number") {
                start = 0;
            }
            if (start + search.length > str.length) {
                return false;
            } else {
                return str.indexOf(search, start) !== -1;
            }
        }
        createErrorType("ERR_INVALID_OPT_VALUE", (function(name, value) {
            return 'The value "' + value + '" is invalid for option "' + name + '"';
        }), TypeError);
        createErrorType("ERR_INVALID_ARG_TYPE", (function(name, expected, actual) {
            let determiner;
            if (typeof expected === "string" && startsWith(expected, "not ")) {
                determiner = "must not be";
                expected = expected.replace(/^not /, "");
            } else {
                determiner = "must be";
            }
            let msg;
            if (endsWith(name, " argument")) {
                msg = `The ${name} ${determiner} ${oneOf(expected, "type")}`;
            } else {
                const type = includes(name, ".") ? "property" : "argument";
                msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, "type")}`;
            }
            msg += `. Received type ${typeof actual}`;
            return msg;
        }), TypeError);
        createErrorType("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF");
        createErrorType("ERR_METHOD_NOT_IMPLEMENTED", (function(name) {
            return "The " + name + " method is not implemented";
        }));
        createErrorType("ERR_STREAM_PREMATURE_CLOSE", "Premature close");
        createErrorType("ERR_STREAM_DESTROYED", (function(name) {
            return "Cannot call " + name + " after a stream was destroyed";
        }));
        createErrorType("ERR_MULTIPLE_CALLBACK", "Callback called multiple times");
        createErrorType("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable");
        createErrorType("ERR_STREAM_WRITE_AFTER_END", "write after end");
        createErrorType("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
        createErrorType("ERR_UNKNOWN_ENCODING", (function(arg) {
            return "Unknown encoding: " + arg;
        }), TypeError);
        createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event");
        module.exports.q = codes;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        try {
            var util = __webpack_require__(14);
            if (typeof util.inherits !== "function") throw "";
            module.exports = util.inherits;
        } catch (e) {
            module.exports = __webpack_require__(237);
        }
    }, module => {
        if (typeof Object.create === "function") {
            module.exports = function inherits(ctor, superCtor) {
                if (superCtor) {
                    ctor.super_ = superCtor;
                    ctor.prototype = Object.create(superCtor.prototype, {
                        constructor: {
                            value: ctor,
                            enumerable: false,
                            writable: true,
                            configurable: true
                        }
                    });
                }
            };
        } else {
            module.exports = function inherits(ctor, superCtor) {
                if (superCtor) {
                    ctor.super_ = superCtor;
                    var TempCtor = function() {};
                    TempCtor.prototype = superCtor.prototype;
                    ctor.prototype = new TempCtor;
                    ctor.prototype.constructor = ctor;
                }
            };
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var objectKeys = Object.keys || function(obj) {
            var keys = [];
            for (var key in obj) {
                keys.push(key);
            }
            return keys;
        };
        module.exports = Duplex;
        var Readable = __webpack_require__(230);
        var Writable = __webpack_require__(239);
        __webpack_require__(236)(Duplex, Readable);
        {
            var keys = objectKeys(Writable.prototype);
            for (var v = 0; v < keys.length; v++) {
                var method = keys[v];
                if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
            }
        }
        function Duplex(options) {
            if (!(this instanceof Duplex)) return new Duplex(options);
            Readable.call(this, options);
            Writable.call(this, options);
            this.allowHalfOpen = true;
            if (options) {
                if (options.readable === false) this.readable = false;
                if (options.writable === false) this.writable = false;
                if (options.allowHalfOpen === false) {
                    this.allowHalfOpen = false;
                    this.once("end", onend);
                }
            }
        }
        Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
            enumerable: false,
            get: function get() {
                return this._writableState.highWaterMark;
            }
        });
        Object.defineProperty(Duplex.prototype, "writableBuffer", {
            enumerable: false,
            get: function get() {
                return this._writableState && this._writableState.getBuffer();
            }
        });
        Object.defineProperty(Duplex.prototype, "writableLength", {
            enumerable: false,
            get: function get() {
                return this._writableState.length;
            }
        });
        function onend() {
            if (this._writableState.ended) return;
            process.nextTick(onEndNT, this);
        }
        function onEndNT(self) {
            self.end();
        }
        Object.defineProperty(Duplex.prototype, "destroyed", {
            enumerable: false,
            get: function get() {
                if (this._readableState === undefined || this._writableState === undefined) {
                    return false;
                }
                return this._readableState.destroyed && this._writableState.destroyed;
            },
            set: function set(value) {
                if (this._readableState === undefined || this._writableState === undefined) {
                    return;
                }
                this._readableState.destroyed = value;
                this._writableState.destroyed = value;
            }
        });
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        module.exports = Writable;
        function WriteReq(chunk, encoding, cb) {
            this.chunk = chunk;
            this.encoding = encoding;
            this.callback = cb;
            this.next = null;
        }
        function CorkedRequest(state) {
            var _this = this;
            this.next = null;
            this.entry = null;
            this.finish = function() {
                onCorkedFinish(_this, state);
            };
        }
        var Duplex;
        Writable.WritableState = WritableState;
        var internalUtil = {
            deprecate: __webpack_require__(240)
        };
        var Stream = __webpack_require__(231);
        var Buffer = __webpack_require__(102).Buffer;
        var OurUint8Array = global.Uint8Array || function() {};
        function _uint8ArrayToBuffer(chunk) {
            return Buffer.from(chunk);
        }
        function _isUint8Array(obj) {
            return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
        }
        var destroyImpl = __webpack_require__(233);
        var _require = __webpack_require__(234), getHighWaterMark = _require.getHighWaterMark;
        var _require$codes = __webpack_require__(235).q, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
        var errorOrDestroy = destroyImpl.errorOrDestroy;
        __webpack_require__(236)(Writable, Stream);
        function nop() {}
        function WritableState(options, stream, isDuplex) {
            Duplex = Duplex || __webpack_require__(238);
            options = options || {};
            if (typeof isDuplex !== "boolean") isDuplex = stream instanceof Duplex;
            this.objectMode = !!options.objectMode;
            if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
            this.highWaterMark = getHighWaterMark(this, options, "writableHighWaterMark", isDuplex);
            this.finalCalled = false;
            this.needDrain = false;
            this.ending = false;
            this.ended = false;
            this.finished = false;
            this.destroyed = false;
            var noDecode = options.decodeStrings === false;
            this.decodeStrings = !noDecode;
            this.defaultEncoding = options.defaultEncoding || "utf8";
            this.length = 0;
            this.writing = false;
            this.corked = 0;
            this.sync = true;
            this.bufferProcessing = false;
            this.onwrite = function(er) {
                onwrite(stream, er);
            };
            this.writecb = null;
            this.writelen = 0;
            this.bufferedRequest = null;
            this.lastBufferedRequest = null;
            this.pendingcb = 0;
            this.prefinished = false;
            this.errorEmitted = false;
            this.emitClose = options.emitClose !== false;
            this.autoDestroy = !!options.autoDestroy;
            this.bufferedRequestCount = 0;
            this.corkedRequestsFree = new CorkedRequest(this);
        }
        WritableState.prototype.getBuffer = function getBuffer() {
            var current = this.bufferedRequest;
            var out = [];
            while (current) {
                out.push(current);
                current = current.next;
            }
            return out;
        };
        (function() {
            try {
                Object.defineProperty(WritableState.prototype, "buffer", {
                    get: internalUtil.deprecate((function writableStateBufferGetter() {
                        return this.getBuffer();
                    }), "_writableState.buffer is deprecated. Use _writableState.getBuffer " + "instead.", "DEP0003")
                });
            } catch (_) {}
        })();
        var realHasInstance;
        if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
            realHasInstance = Function.prototype[Symbol.hasInstance];
            Object.defineProperty(Writable, Symbol.hasInstance, {
                value: function value(object) {
                    if (realHasInstance.call(this, object)) return true;
                    if (this !== Writable) return false;
                    return object && object._writableState instanceof WritableState;
                }
            });
        } else {
            realHasInstance = function realHasInstance(object) {
                return object instanceof this;
            };
        }
        function Writable(options) {
            Duplex = Duplex || __webpack_require__(238);
            var isDuplex = this instanceof Duplex;
            if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
            this._writableState = new WritableState(options, this, isDuplex);
            this.writable = true;
            if (options) {
                if (typeof options.write === "function") this._write = options.write;
                if (typeof options.writev === "function") this._writev = options.writev;
                if (typeof options.destroy === "function") this._destroy = options.destroy;
                if (typeof options.final === "function") this._final = options.final;
            }
            Stream.call(this);
        }
        Writable.prototype.pipe = function() {
            errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE);
        };
        function writeAfterEnd(stream, cb) {
            var er = new ERR_STREAM_WRITE_AFTER_END;
            errorOrDestroy(stream, er);
            process.nextTick(cb, er);
        }
        function validChunk(stream, state, chunk, cb) {
            var er;
            if (chunk === null) {
                er = new ERR_STREAM_NULL_VALUES;
            } else if (typeof chunk !== "string" && !state.objectMode) {
                er = new ERR_INVALID_ARG_TYPE("chunk", [ "string", "Buffer" ], chunk);
            }
            if (er) {
                errorOrDestroy(stream, er);
                process.nextTick(cb, er);
                return false;
            }
            return true;
        }
        Writable.prototype.write = function(chunk, encoding, cb) {
            var state = this._writableState;
            var ret = false;
            var isBuf = !state.objectMode && _isUint8Array(chunk);
            if (isBuf && !Buffer.isBuffer(chunk)) {
                chunk = _uint8ArrayToBuffer(chunk);
            }
            if (typeof encoding === "function") {
                cb = encoding;
                encoding = null;
            }
            if (isBuf) encoding = "buffer"; else if (!encoding) encoding = state.defaultEncoding;
            if (typeof cb !== "function") cb = nop;
            if (state.ending) writeAfterEnd(this, cb); else if (isBuf || validChunk(this, state, chunk, cb)) {
                state.pendingcb++;
                ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
            }
            return ret;
        };
        Writable.prototype.cork = function() {
            this._writableState.corked++;
        };
        Writable.prototype.uncork = function() {
            var state = this._writableState;
            if (state.corked) {
                state.corked--;
                if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
            }
        };
        Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
            if (typeof encoding === "string") encoding = encoding.toLowerCase();
            if (!([ "hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw" ].indexOf((encoding + "").toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
            this._writableState.defaultEncoding = encoding;
            return this;
        };
        Object.defineProperty(Writable.prototype, "writableBuffer", {
            enumerable: false,
            get: function get() {
                return this._writableState && this._writableState.getBuffer();
            }
        });
        function decodeChunk(state, chunk, encoding) {
            if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
                chunk = Buffer.from(chunk, encoding);
            }
            return chunk;
        }
        Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
            enumerable: false,
            get: function get() {
                return this._writableState.highWaterMark;
            }
        });
        function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
            if (!isBuf) {
                var newChunk = decodeChunk(state, chunk, encoding);
                if (chunk !== newChunk) {
                    isBuf = true;
                    encoding = "buffer";
                    chunk = newChunk;
                }
            }
            var len = state.objectMode ? 1 : chunk.length;
            state.length += len;
            var ret = state.length < state.highWaterMark;
            if (!ret) state.needDrain = true;
            if (state.writing || state.corked) {
                var last = state.lastBufferedRequest;
                state.lastBufferedRequest = {
                    chunk,
                    encoding,
                    isBuf,
                    callback: cb,
                    next: null
                };
                if (last) {
                    last.next = state.lastBufferedRequest;
                } else {
                    state.bufferedRequest = state.lastBufferedRequest;
                }
                state.bufferedRequestCount += 1;
            } else {
                doWrite(stream, state, false, len, chunk, encoding, cb);
            }
            return ret;
        }
        function doWrite(stream, state, writev, len, chunk, encoding, cb) {
            state.writelen = len;
            state.writecb = cb;
            state.writing = true;
            state.sync = true;
            if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED("write")); else if (writev) stream._writev(chunk, state.onwrite); else stream._write(chunk, encoding, state.onwrite);
            state.sync = false;
        }
        function onwriteError(stream, state, sync, er, cb) {
            --state.pendingcb;
            if (sync) {
                process.nextTick(cb, er);
                process.nextTick(finishMaybe, stream, state);
                stream._writableState.errorEmitted = true;
                errorOrDestroy(stream, er);
            } else {
                cb(er);
                stream._writableState.errorEmitted = true;
                errorOrDestroy(stream, er);
                finishMaybe(stream, state);
            }
        }
        function onwriteStateUpdate(state) {
            state.writing = false;
            state.writecb = null;
            state.length -= state.writelen;
            state.writelen = 0;
        }
        function onwrite(stream, er) {
            var state = stream._writableState;
            var sync = state.sync;
            var cb = state.writecb;
            if (typeof cb !== "function") throw new ERR_MULTIPLE_CALLBACK;
            onwriteStateUpdate(state);
            if (er) onwriteError(stream, state, sync, er, cb); else {
                var finished = needFinish(state) || stream.destroyed;
                if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
                    clearBuffer(stream, state);
                }
                if (sync) {
                    process.nextTick(afterWrite, stream, state, finished, cb);
                } else {
                    afterWrite(stream, state, finished, cb);
                }
            }
        }
        function afterWrite(stream, state, finished, cb) {
            if (!finished) onwriteDrain(stream, state);
            state.pendingcb--;
            cb();
            finishMaybe(stream, state);
        }
        function onwriteDrain(stream, state) {
            if (state.length === 0 && state.needDrain) {
                state.needDrain = false;
                stream.emit("drain");
            }
        }
        function clearBuffer(stream, state) {
            state.bufferProcessing = true;
            var entry = state.bufferedRequest;
            if (stream._writev && entry && entry.next) {
                var l = state.bufferedRequestCount;
                var buffer = new Array(l);
                var holder = state.corkedRequestsFree;
                holder.entry = entry;
                var count = 0;
                var allBuffers = true;
                while (entry) {
                    buffer[count] = entry;
                    if (!entry.isBuf) allBuffers = false;
                    entry = entry.next;
                    count += 1;
                }
                buffer.allBuffers = allBuffers;
                doWrite(stream, state, true, state.length, buffer, "", holder.finish);
                state.pendingcb++;
                state.lastBufferedRequest = null;
                if (holder.next) {
                    state.corkedRequestsFree = holder.next;
                    holder.next = null;
                } else {
                    state.corkedRequestsFree = new CorkedRequest(state);
                }
                state.bufferedRequestCount = 0;
            } else {
                while (entry) {
                    var chunk = entry.chunk;
                    var encoding = entry.encoding;
                    var cb = entry.callback;
                    var len = state.objectMode ? 1 : chunk.length;
                    doWrite(stream, state, false, len, chunk, encoding, cb);
                    entry = entry.next;
                    state.bufferedRequestCount--;
                    if (state.writing) {
                        break;
                    }
                }
                if (entry === null) state.lastBufferedRequest = null;
            }
            state.bufferedRequest = entry;
            state.bufferProcessing = false;
        }
        Writable.prototype._write = function(chunk, encoding, cb) {
            cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
        };
        Writable.prototype._writev = null;
        Writable.prototype.end = function(chunk, encoding, cb) {
            var state = this._writableState;
            if (typeof chunk === "function") {
                cb = chunk;
                chunk = null;
                encoding = null;
            } else if (typeof encoding === "function") {
                cb = encoding;
                encoding = null;
            }
            if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
            if (state.corked) {
                state.corked = 1;
                this.uncork();
            }
            if (!state.ending) endWritable(this, state, cb);
            return this;
        };
        Object.defineProperty(Writable.prototype, "writableLength", {
            enumerable: false,
            get: function get() {
                return this._writableState.length;
            }
        });
        function needFinish(state) {
            return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
        }
        function callFinal(stream, state) {
            stream._final((function(err) {
                state.pendingcb--;
                if (err) {
                    errorOrDestroy(stream, err);
                }
                state.prefinished = true;
                stream.emit("prefinish");
                finishMaybe(stream, state);
            }));
        }
        function prefinish(stream, state) {
            if (!state.prefinished && !state.finalCalled) {
                if (typeof stream._final === "function" && !state.destroyed) {
                    state.pendingcb++;
                    state.finalCalled = true;
                    process.nextTick(callFinal, stream, state);
                } else {
                    state.prefinished = true;
                    stream.emit("prefinish");
                }
            }
        }
        function finishMaybe(stream, state) {
            var need = needFinish(state);
            if (need) {
                prefinish(stream, state);
                if (state.pendingcb === 0) {
                    state.finished = true;
                    stream.emit("finish");
                    if (state.autoDestroy) {
                        var rState = stream._readableState;
                        if (!rState || rState.autoDestroy && rState.endEmitted) {
                            stream.destroy();
                        }
                    }
                }
            }
            return need;
        }
        function endWritable(stream, state, cb) {
            state.ending = true;
            finishMaybe(stream, state);
            if (cb) {
                if (state.finished) process.nextTick(cb); else stream.once("finish", cb);
            }
            state.ended = true;
            stream.writable = false;
        }
        function onCorkedFinish(corkReq, state, err) {
            var entry = corkReq.entry;
            corkReq.entry = null;
            while (entry) {
                var cb = entry.callback;
                state.pendingcb--;
                cb(err);
                entry = entry.next;
            }
            state.corkedRequestsFree.next = corkReq;
        }
        Object.defineProperty(Writable.prototype, "destroyed", {
            enumerable: false,
            get: function get() {
                if (this._writableState === undefined) {
                    return false;
                }
                return this._writableState.destroyed;
            },
            set: function set(value) {
                if (!this._writableState) {
                    return;
                }
                this._writableState.destroyed = value;
            }
        });
        Writable.prototype.destroy = destroyImpl.destroy;
        Writable.prototype._undestroy = destroyImpl.undestroy;
        Writable.prototype._destroy = function(err, cb) {
            cb(err);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        module.exports = __webpack_require__(14).deprecate;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        var Buffer = __webpack_require__(242).Buffer;
        var isEncoding = Buffer.isEncoding || function(encoding) {
            encoding = "" + encoding;
            switch (encoding && encoding.toLowerCase()) {
              case "hex":
              case "utf8":
              case "utf-8":
              case "ascii":
              case "binary":
              case "base64":
              case "ucs2":
              case "ucs-2":
              case "utf16le":
              case "utf-16le":
              case "raw":
                return true;

              default:
                return false;
            }
        };
        function _normalizeEncoding(enc) {
            if (!enc) return "utf8";
            var retried;
            while (true) {
                switch (enc) {
                  case "utf8":
                  case "utf-8":
                    return "utf8";

                  case "ucs2":
                  case "ucs-2":
                  case "utf16le":
                  case "utf-16le":
                    return "utf16le";

                  case "latin1":
                  case "binary":
                    return "latin1";

                  case "base64":
                  case "ascii":
                  case "hex":
                    return enc;

                  default:
                    if (retried) return;
                    enc = ("" + enc).toLowerCase();
                    retried = true;
                }
            }
        }
        function normalizeEncoding(enc) {
            var nenc = _normalizeEncoding(enc);
            if (typeof nenc !== "string" && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
            return nenc || enc;
        }
        exports.s = StringDecoder;
        function StringDecoder(encoding) {
            this.encoding = normalizeEncoding(encoding);
            var nb;
            switch (this.encoding) {
              case "utf16le":
                this.text = utf16Text;
                this.end = utf16End;
                nb = 4;
                break;

              case "utf8":
                this.fillLast = utf8FillLast;
                nb = 4;
                break;

              case "base64":
                this.text = base64Text;
                this.end = base64End;
                nb = 3;
                break;

              default:
                this.write = simpleWrite;
                this.end = simpleEnd;
                return;
            }
            this.lastNeed = 0;
            this.lastTotal = 0;
            this.lastChar = Buffer.allocUnsafe(nb);
        }
        StringDecoder.prototype.write = function(buf) {
            if (buf.length === 0) return "";
            var r;
            var i;
            if (this.lastNeed) {
                r = this.fillLast(buf);
                if (r === undefined) return "";
                i = this.lastNeed;
                this.lastNeed = 0;
            } else {
                i = 0;
            }
            if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
            return r || "";
        };
        StringDecoder.prototype.end = utf8End;
        StringDecoder.prototype.text = utf8Text;
        StringDecoder.prototype.fillLast = function(buf) {
            if (this.lastNeed <= buf.length) {
                buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
                return this.lastChar.toString(this.encoding, 0, this.lastTotal);
            }
            buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
            this.lastNeed -= buf.length;
        };
        function utf8CheckByte(byte) {
            if (byte <= 127) return 0; else if (byte >> 5 === 6) return 2; else if (byte >> 4 === 14) return 3; else if (byte >> 3 === 30) return 4;
            return byte >> 6 === 2 ? -1 : -2;
        }
        function utf8CheckIncomplete(self, buf, i) {
            var j = buf.length - 1;
            if (j < i) return 0;
            var nb = utf8CheckByte(buf[j]);
            if (nb >= 0) {
                if (nb > 0) self.lastNeed = nb - 1;
                return nb;
            }
            if (--j < i || nb === -2) return 0;
            nb = utf8CheckByte(buf[j]);
            if (nb >= 0) {
                if (nb > 0) self.lastNeed = nb - 2;
                return nb;
            }
            if (--j < i || nb === -2) return 0;
            nb = utf8CheckByte(buf[j]);
            if (nb >= 0) {
                if (nb > 0) {
                    if (nb === 2) nb = 0; else self.lastNeed = nb - 3;
                }
                return nb;
            }
            return 0;
        }
        function utf8CheckExtraBytes(self, buf, p) {
            if ((buf[0] & 192) !== 128) {
                self.lastNeed = 0;
                return "�";
            }
            if (self.lastNeed > 1 && buf.length > 1) {
                if ((buf[1] & 192) !== 128) {
                    self.lastNeed = 1;
                    return "�";
                }
                if (self.lastNeed > 2 && buf.length > 2) {
                    if ((buf[2] & 192) !== 128) {
                        self.lastNeed = 2;
                        return "�";
                    }
                }
            }
        }
        function utf8FillLast(buf) {
            var p = this.lastTotal - this.lastNeed;
            var r = utf8CheckExtraBytes(this, buf, p);
            if (r !== undefined) return r;
            if (this.lastNeed <= buf.length) {
                buf.copy(this.lastChar, p, 0, this.lastNeed);
                return this.lastChar.toString(this.encoding, 0, this.lastTotal);
            }
            buf.copy(this.lastChar, p, 0, buf.length);
            this.lastNeed -= buf.length;
        }
        function utf8Text(buf, i) {
            var total = utf8CheckIncomplete(this, buf, i);
            if (!this.lastNeed) return buf.toString("utf8", i);
            this.lastTotal = total;
            var end = buf.length - (total - this.lastNeed);
            buf.copy(this.lastChar, 0, end);
            return buf.toString("utf8", i, end);
        }
        function utf8End(buf) {
            var r = buf && buf.length ? this.write(buf) : "";
            if (this.lastNeed) return r + "�";
            return r;
        }
        function utf16Text(buf, i) {
            if ((buf.length - i) % 2 === 0) {
                var r = buf.toString("utf16le", i);
                if (r) {
                    var c = r.charCodeAt(r.length - 1);
                    if (c >= 55296 && c <= 56319) {
                        this.lastNeed = 2;
                        this.lastTotal = 4;
                        this.lastChar[0] = buf[buf.length - 2];
                        this.lastChar[1] = buf[buf.length - 1];
                        return r.slice(0, -1);
                    }
                }
                return r;
            }
            this.lastNeed = 1;
            this.lastTotal = 2;
            this.lastChar[0] = buf[buf.length - 1];
            return buf.toString("utf16le", i, buf.length - 1);
        }
        function utf16End(buf) {
            var r = buf && buf.length ? this.write(buf) : "";
            if (this.lastNeed) {
                var end = this.lastTotal - this.lastNeed;
                return r + this.lastChar.toString("utf16le", 0, end);
            }
            return r;
        }
        function base64Text(buf, i) {
            var n = (buf.length - i) % 3;
            if (n === 0) return buf.toString("base64", i);
            this.lastNeed = 3 - n;
            this.lastTotal = 3;
            if (n === 1) {
                this.lastChar[0] = buf[buf.length - 1];
            } else {
                this.lastChar[0] = buf[buf.length - 2];
                this.lastChar[1] = buf[buf.length - 1];
            }
            return buf.toString("base64", i, buf.length - n);
        }
        function base64End(buf) {
            var r = buf && buf.length ? this.write(buf) : "";
            if (this.lastNeed) return r + this.lastChar.toString("base64", 0, 3 - this.lastNeed);
            return r;
        }
        function simpleWrite(buf) {
            return buf.toString(this.encoding);
        }
        function simpleEnd(buf) {
            return buf && buf.length ? this.write(buf) : "";
        }
    }, (module, exports, __webpack_require__) => {
        var buffer = __webpack_require__(102);
        var Buffer = buffer.Buffer;
        function copyProps(src, dst) {
            for (var key in src) {
                dst[key] = src[key];
            }
        }
        if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
            module.exports = buffer;
        } else {
            copyProps(buffer, exports);
            exports.Buffer = SafeBuffer;
        }
        function SafeBuffer(arg, encodingOrOffset, length) {
            return Buffer(arg, encodingOrOffset, length);
        }
        copyProps(Buffer, SafeBuffer);
        SafeBuffer.from = function(arg, encodingOrOffset, length) {
            if (typeof arg === "number") {
                throw new TypeError("Argument must not be a number");
            }
            return Buffer(arg, encodingOrOffset, length);
        };
        SafeBuffer.alloc = function(size, fill, encoding) {
            if (typeof size !== "number") {
                throw new TypeError("Argument must be a number");
            }
            var buf = Buffer(size);
            if (fill !== undefined) {
                if (typeof encoding === "string") {
                    buf.fill(fill, encoding);
                } else {
                    buf.fill(fill);
                }
            } else {
                buf.fill(0);
            }
            return buf;
        };
        SafeBuffer.allocUnsafe = function(size) {
            if (typeof size !== "number") {
                throw new TypeError("Argument must be a number");
            }
            return Buffer(size);
        };
        SafeBuffer.allocUnsafeSlow = function(size) {
            if (typeof size !== "number") {
                throw new TypeError("Argument must be a number");
            }
            return buffer.SlowBuffer(size);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var _Object$setPrototypeO;
        function _defineProperty(obj, key, value) {
            if (key in obj) {
                Object.defineProperty(obj, key, {
                    value,
                    enumerable: true,
                    configurable: true,
                    writable: true
                });
            } else {
                obj[key] = value;
            }
            return obj;
        }
        var finished = __webpack_require__(244);
        var kLastResolve = Symbol("lastResolve");
        var kLastReject = Symbol("lastReject");
        var kError = Symbol("error");
        var kEnded = Symbol("ended");
        var kLastPromise = Symbol("lastPromise");
        var kHandlePromise = Symbol("handlePromise");
        var kStream = Symbol("stream");
        function createIterResult(value, done) {
            return {
                value,
                done
            };
        }
        function readAndResolve(iter) {
            var resolve = iter[kLastResolve];
            if (resolve !== null) {
                var data = iter[kStream].read();
                if (data !== null) {
                    iter[kLastPromise] = null;
                    iter[kLastResolve] = null;
                    iter[kLastReject] = null;
                    resolve(createIterResult(data, false));
                }
            }
        }
        function onReadable(iter) {
            process.nextTick(readAndResolve, iter);
        }
        function wrapForNext(lastPromise, iter) {
            return function(resolve, reject) {
                lastPromise.then((function() {
                    if (iter[kEnded]) {
                        resolve(createIterResult(undefined, true));
                        return;
                    }
                    iter[kHandlePromise](resolve, reject);
                }), reject);
            };
        }
        var AsyncIteratorPrototype = Object.getPrototypeOf((function() {}));
        var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
            get stream() {
                return this[kStream];
            },
            next: function next() {
                var _this = this;
                var error = this[kError];
                if (error !== null) {
                    return Promise.reject(error);
                }
                if (this[kEnded]) {
                    return Promise.resolve(createIterResult(undefined, true));
                }
                if (this[kStream].destroyed) {
                    return new Promise((function(resolve, reject) {
                        process.nextTick((function() {
                            if (_this[kError]) {
                                reject(_this[kError]);
                            } else {
                                resolve(createIterResult(undefined, true));
                            }
                        }));
                    }));
                }
                var lastPromise = this[kLastPromise];
                var promise;
                if (lastPromise) {
                    promise = new Promise(wrapForNext(lastPromise, this));
                } else {
                    var data = this[kStream].read();
                    if (data !== null) {
                        return Promise.resolve(createIterResult(data, false));
                    }
                    promise = new Promise(this[kHandlePromise]);
                }
                this[kLastPromise] = promise;
                return promise;
            }
        }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, (function() {
            return this;
        })), _defineProperty(_Object$setPrototypeO, "return", (function _return() {
            var _this2 = this;
            return new Promise((function(resolve, reject) {
                _this2[kStream].destroy(null, (function(err) {
                    if (err) {
                        reject(err);
                        return;
                    }
                    resolve(createIterResult(undefined, true));
                }));
            }));
        })), _Object$setPrototypeO), AsyncIteratorPrototype);
        var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
            var _Object$create;
            var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, 
            _defineProperty(_Object$create, kStream, {
                value: stream,
                writable: true
            }), _defineProperty(_Object$create, kLastResolve, {
                value: null,
                writable: true
            }), _defineProperty(_Object$create, kLastReject, {
                value: null,
                writable: true
            }), _defineProperty(_Object$create, kError, {
                value: null,
                writable: true
            }), _defineProperty(_Object$create, kEnded, {
                value: stream._readableState.endEmitted,
                writable: true
            }), _defineProperty(_Object$create, kHandlePromise, {
                value: function value(resolve, reject) {
                    var data = iterator[kStream].read();
                    if (data) {
                        iterator[kLastPromise] = null;
                        iterator[kLastResolve] = null;
                        iterator[kLastReject] = null;
                        resolve(createIterResult(data, false));
                    } else {
                        iterator[kLastResolve] = resolve;
                        iterator[kLastReject] = reject;
                    }
                },
                writable: true
            }), _Object$create));
            iterator[kLastPromise] = null;
            finished(stream, (function(err) {
                if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
                    var reject = iterator[kLastReject];
                    if (reject !== null) {
                        iterator[kLastPromise] = null;
                        iterator[kLastResolve] = null;
                        iterator[kLastReject] = null;
                        reject(err);
                    }
                    iterator[kError] = err;
                    return;
                }
                var resolve = iterator[kLastResolve];
                if (resolve !== null) {
                    iterator[kLastPromise] = null;
                    iterator[kLastResolve] = null;
                    iterator[kLastReject] = null;
                    resolve(createIterResult(undefined, true));
                }
                iterator[kEnded] = true;
            }));
            stream.on("readable", onReadable.bind(null, iterator));
            return iterator;
        };
        module.exports = createReadableStreamAsyncIterator;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var ERR_STREAM_PREMATURE_CLOSE = __webpack_require__(235).q.ERR_STREAM_PREMATURE_CLOSE;
        function once(callback) {
            var called = false;
            return function() {
                if (called) return;
                called = true;
                for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
                    args[_key] = arguments[_key];
                }
                callback.apply(this, args);
            };
        }
        function noop() {}
        function isRequest(stream) {
            return stream.setHeader && typeof stream.abort === "function";
        }
        function eos(stream, opts, callback) {
            if (typeof opts === "function") return eos(stream, null, opts);
            if (!opts) opts = {};
            callback = once(callback || noop);
            var readable = opts.readable || opts.readable !== false && stream.readable;
            var writable = opts.writable || opts.writable !== false && stream.writable;
            var onlegacyfinish = function onlegacyfinish() {
                if (!stream.writable) onfinish();
            };
            var writableEnded = stream._writableState && stream._writableState.finished;
            var onfinish = function onfinish() {
                writable = false;
                writableEnded = true;
                if (!readable) callback.call(stream);
            };
            var readableEnded = stream._readableState && stream._readableState.endEmitted;
            var onend = function onend() {
                readable = false;
                readableEnded = true;
                if (!writable) callback.call(stream);
            };
            var onerror = function onerror(err) {
                callback.call(stream, err);
            };
            var onclose = function onclose() {
                var err;
                if (readable && !readableEnded) {
                    if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE;
                    return callback.call(stream, err);
                }
                if (writable && !writableEnded) {
                    if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE;
                    return callback.call(stream, err);
                }
            };
            var onrequest = function onrequest() {
                stream.req.on("finish", onfinish);
            };
            if (isRequest(stream)) {
                stream.on("complete", onfinish);
                stream.on("abort", onclose);
                if (stream.req) onrequest(); else stream.on("request", onrequest);
            } else if (writable && !stream._writableState) {
                stream.on("end", onlegacyfinish);
                stream.on("close", onlegacyfinish);
            }
            stream.on("end", onend);
            stream.on("finish", onfinish);
            if (opts.error !== false) stream.on("error", onerror);
            stream.on("close", onclose);
            return function() {
                stream.removeListener("complete", onfinish);
                stream.removeListener("abort", onclose);
                stream.removeListener("request", onrequest);
                if (stream.req) stream.req.removeListener("finish", onfinish);
                stream.removeListener("end", onlegacyfinish);
                stream.removeListener("close", onlegacyfinish);
                stream.removeListener("finish", onfinish);
                stream.removeListener("end", onend);
                stream.removeListener("error", onerror);
                stream.removeListener("close", onclose);
            };
        }
        module.exports = eos;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
            try {
                var info = gen[key](arg);
                var value = info.value;
            } catch (error) {
                reject(error);
                return;
            }
            if (info.done) {
                resolve(value);
            } else {
                Promise.resolve(value).then(_next, _throw);
            }
        }
        function _asyncToGenerator(fn) {
            return function() {
                var self = this, args = arguments;
                return new Promise((function(resolve, reject) {
                    var gen = fn.apply(self, args);
                    function _next(value) {
                        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
                    }
                    function _throw(err) {
                        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
                    }
                    _next(undefined);
                }));
            };
        }
        function ownKeys(object, enumerableOnly) {
            var keys = Object.keys(object);
            if (Object.getOwnPropertySymbols) {
                var symbols = Object.getOwnPropertySymbols(object);
                if (enumerableOnly) symbols = symbols.filter((function(sym) {
                    return Object.getOwnPropertyDescriptor(object, sym).enumerable;
                }));
                keys.push.apply(keys, symbols);
            }
            return keys;
        }
        function _objectSpread(target) {
            for (var i = 1; i < arguments.length; i++) {
                var source = arguments[i] != null ? arguments[i] : {};
                if (i % 2) {
                    ownKeys(Object(source), true).forEach((function(key) {
                        _defineProperty(target, key, source[key]);
                    }));
                } else if (Object.getOwnPropertyDescriptors) {
                    Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
                } else {
                    ownKeys(Object(source)).forEach((function(key) {
                        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
                    }));
                }
            }
            return target;
        }
        function _defineProperty(obj, key, value) {
            if (key in obj) {
                Object.defineProperty(obj, key, {
                    value,
                    enumerable: true,
                    configurable: true,
                    writable: true
                });
            } else {
                obj[key] = value;
            }
            return obj;
        }
        var ERR_INVALID_ARG_TYPE = __webpack_require__(235).q.ERR_INVALID_ARG_TYPE;
        function from(Readable, iterable, opts) {
            var iterator;
            if (iterable && typeof iterable.next === "function") {
                iterator = iterable;
            } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator](); else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator](); else throw new ERR_INVALID_ARG_TYPE("iterable", [ "Iterable" ], iterable);
            var readable = new Readable(_objectSpread({
                objectMode: true
            }, opts));
            var reading = false;
            readable._read = function() {
                if (!reading) {
                    reading = true;
                    next();
                }
            };
            function next() {
                return _next2.apply(this, arguments);
            }
            function _next2() {
                _next2 = _asyncToGenerator((function*() {
                    try {
                        var _ref = yield iterator.next(), value = _ref.value, done = _ref.done;
                        if (done) {
                            readable.push(null);
                        } else if (readable.push(yield value)) {
                            next();
                        } else {
                            reading = false;
                        }
                    } catch (err) {
                        readable.destroy(err);
                    }
                }));
                return _next2.apply(this, arguments);
            }
            return readable;
        }
        module.exports = from;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        module.exports = Transform;
        var _require$codes = __webpack_require__(235).q, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
        var Duplex = __webpack_require__(238);
        __webpack_require__(236)(Transform, Duplex);
        function afterTransform(er, data) {
            var ts = this._transformState;
            ts.transforming = false;
            var cb = ts.writecb;
            if (cb === null) {
                return this.emit("error", new ERR_MULTIPLE_CALLBACK);
            }
            ts.writechunk = null;
            ts.writecb = null;
            if (data != null) this.push(data);
            cb(er);
            var rs = this._readableState;
            rs.reading = false;
            if (rs.needReadable || rs.length < rs.highWaterMark) {
                this._read(rs.highWaterMark);
            }
        }
        function Transform(options) {
            if (!(this instanceof Transform)) return new Transform(options);
            Duplex.call(this, options);
            this._transformState = {
                afterTransform: afterTransform.bind(this),
                needTransform: false,
                transforming: false,
                writecb: null,
                writechunk: null,
                writeencoding: null
            };
            this._readableState.needReadable = true;
            this._readableState.sync = false;
            if (options) {
                if (typeof options.transform === "function") this._transform = options.transform;
                if (typeof options.flush === "function") this._flush = options.flush;
            }
            this.on("prefinish", prefinish);
        }
        function prefinish() {
            var _this = this;
            if (typeof this._flush === "function" && !this._readableState.destroyed) {
                this._flush((function(er, data) {
                    done(_this, er, data);
                }));
            } else {
                done(this, null, null);
            }
        }
        Transform.prototype.push = function(chunk, encoding) {
            this._transformState.needTransform = false;
            return Duplex.prototype.push.call(this, chunk, encoding);
        };
        Transform.prototype._transform = function(chunk, encoding, cb) {
            cb(new ERR_METHOD_NOT_IMPLEMENTED("_transform()"));
        };
        Transform.prototype._write = function(chunk, encoding, cb) {
            var ts = this._transformState;
            ts.writecb = cb;
            ts.writechunk = chunk;
            ts.writeencoding = encoding;
            if (!ts.transforming) {
                var rs = this._readableState;
                if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
            }
        };
        Transform.prototype._read = function(n) {
            var ts = this._transformState;
            if (ts.writechunk !== null && !ts.transforming) {
                ts.transforming = true;
                this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
            } else {
                ts.needTransform = true;
            }
        };
        Transform.prototype._destroy = function(err, cb) {
            Duplex.prototype._destroy.call(this, err, (function(err2) {
                cb(err2);
            }));
        };
        function done(stream, er, data) {
            if (er) return stream.emit("error", er);
            if (data != null) stream.push(data);
            if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0;
            if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING;
            return stream.push(null);
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        module.exports = PassThrough;
        var Transform = __webpack_require__(246);
        __webpack_require__(236)(PassThrough, Transform);
        function PassThrough(options) {
            if (!(this instanceof PassThrough)) return new PassThrough(options);
            Transform.call(this, options);
        }
        PassThrough.prototype._transform = function(chunk, encoding, cb) {
            cb(null, chunk);
        };
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        var eos;
        function once(callback) {
            var called = false;
            return function() {
                if (called) return;
                called = true;
                callback.apply(void 0, arguments);
            };
        }
        var _require$codes = __webpack_require__(235).q, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
        function noop(err) {
            if (err) throw err;
        }
        function isRequest(stream) {
            return stream.setHeader && typeof stream.abort === "function";
        }
        function destroyer(stream, reading, writing, callback) {
            callback = once(callback);
            var closed = false;
            stream.on("close", (function() {
                closed = true;
            }));
            if (eos === undefined) eos = __webpack_require__(244);
            eos(stream, {
                readable: reading,
                writable: writing
            }, (function(err) {
                if (err) return callback(err);
                closed = true;
                callback();
            }));
            var destroyed = false;
            return function(err) {
                if (closed) return;
                if (destroyed) return;
                destroyed = true;
                if (isRequest(stream)) return stream.abort();
                if (typeof stream.destroy === "function") return stream.destroy();
                callback(err || new ERR_STREAM_DESTROYED("pipe"));
            };
        }
        function call(fn) {
            fn();
        }
        function pipe(from, to) {
            return from.pipe(to);
        }
        function popCallback(streams) {
            if (!streams.length) return noop;
            if (typeof streams[streams.length - 1] !== "function") return noop;
            return streams.pop();
        }
        function pipeline() {
            for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
                streams[_key] = arguments[_key];
            }
            var callback = popCallback(streams);
            if (Array.isArray(streams[0])) streams = streams[0];
            if (streams.length < 2) {
                throw new ERR_MISSING_ARGS("streams");
            }
            var error;
            var destroys = streams.map((function(stream, i) {
                var reading = i < streams.length - 1;
                var writing = i > 0;
                return destroyer(stream, reading, writing, (function(err) {
                    if (!error) error = err;
                    if (err) destroys.forEach(call);
                    if (reading) return;
                    destroys.forEach(call);
                    callback(error);
                }));
            }));
            return streams.reduce(pipe);
        }
        module.exports = pipeline;
    }, (__unused_webpack_module, exports) => {
        var CRC32;
        (function(factory) {
            if (typeof DO_NOT_EXPORT_CRC === "undefined") {
                if (true) {
                    factory(exports);
                } else {}
            } else {
                factory(CRC32 = {});
            }
        })((function(CRC32) {
            CRC32.version = "1.2.0";
            function signed_crc_table() {
                var c = 0, table = new Array(256);
                for (var n = 0; n != 256; ++n) {
                    c = n;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    c = c & 1 ? -306674912 ^ c >>> 1 : c >>> 1;
                    table[n] = c;
                }
                return typeof Int32Array !== "undefined" ? new Int32Array(table) : table;
            }
            var T = signed_crc_table();
            function crc32_bstr(bstr, seed) {
                var C = seed ^ -1, L = bstr.length - 1;
                for (var i = 0; i < L; ) {
                    C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];
                    C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i++)) & 255];
                }
                if (i === L) C = C >>> 8 ^ T[(C ^ bstr.charCodeAt(i)) & 255];
                return C ^ -1;
            }
            function crc32_buf(buf, seed) {
                if (buf.length > 1e4) return crc32_buf_8(buf, seed);
                var C = seed ^ -1, L = buf.length - 3;
                for (var i = 0; i < L; ) {
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                }
                while (i < L + 3) C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                return C ^ -1;
            }
            function crc32_buf_8(buf, seed) {
                var C = seed ^ -1, L = buf.length - 7;
                for (var i = 0; i < L; ) {
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                    C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                }
                while (i < L + 7) C = C >>> 8 ^ T[(C ^ buf[i++]) & 255];
                return C ^ -1;
            }
            function crc32_str(str, seed) {
                var C = seed ^ -1;
                for (var i = 0, L = str.length, c, d; i < L; ) {
                    c = str.charCodeAt(i++);
                    if (c < 128) {
                        C = C >>> 8 ^ T[(C ^ c) & 255];
                    } else if (c < 2048) {
                        C = C >>> 8 ^ T[(C ^ (192 | c >> 6 & 31)) & 255];
                        C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];
                    } else if (c >= 55296 && c < 57344) {
                        c = (c & 1023) + 64;
                        d = str.charCodeAt(i++) & 1023;
                        C = C >>> 8 ^ T[(C ^ (240 | c >> 8 & 7)) & 255];
                        C = C >>> 8 ^ T[(C ^ (128 | c >> 2 & 63)) & 255];
                        C = C >>> 8 ^ T[(C ^ (128 | d >> 6 & 15 | (c & 3) << 4)) & 255];
                        C = C >>> 8 ^ T[(C ^ (128 | d & 63)) & 255];
                    } else {
                        C = C >>> 8 ^ T[(C ^ (224 | c >> 12 & 15)) & 255];
                        C = C >>> 8 ^ T[(C ^ (128 | c >> 6 & 63)) & 255];
                        C = C >>> 8 ^ T[(C ^ (128 | c & 63)) & 255];
                    }
                }
                return C ^ -1;
            }
            CRC32.table = T;
            CRC32.bstr = crc32_bstr;
            CRC32.buf = crc32_buf;
            CRC32.str = crc32_str;
        }));
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const {DeflateRaw} = __webpack_require__(89);
        const crc32 = __webpack_require__(249);
        class DeflateCRC32Stream extends DeflateRaw {
            constructor(options) {
                super(options);
                this.checksum = Buffer.allocUnsafe(4);
                this.checksum.writeInt32BE(0, 0);
                this.rawSize = 0;
                this.compressedSize = 0;
            }
            push(chunk, encoding) {
                if (chunk) {
                    this.compressedSize += chunk.length;
                }
                return super.push(chunk, encoding);
            }
            _transform(chunk, encoding, callback) {
                if (chunk) {
                    this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
                    this.rawSize += chunk.length;
                }
                super._transform(chunk, encoding, callback);
            }
            digest(encoding) {
                const checksum = Buffer.allocUnsafe(4);
                checksum.writeUInt32BE(this.checksum >>> 0, 0);
                return encoding ? checksum.toString(encoding) : checksum;
            }
            hex() {
                return this.digest("hex").toUpperCase();
            }
            size(compressed = false) {
                if (compressed) {
                    return this.compressedSize;
                } else {
                    return this.rawSize;
                }
            }
        }
        module.exports = DeflateCRC32Stream;
    }, function(__unused_webpack_module, exports, __webpack_require__) {
        (function() {
            var CombinedStream, DEFLATE_END, DeflateCRC32Stream, DeflatePartStream, ZIP_CD_DISK_START, ZIP_CD_EXTERNAL_ATT, ZIP_CD_FILE_COMM_LEN, ZIP_CD_INTERNAL_ATT, ZIP_CD_SIGNATURE, ZIP_CD_VERSION, ZIP_COMPRESSION_DEFLATE, ZIP_ECD_COMM_LEN, ZIP_ECD_DISK_NUM, ZIP_ECD_SIGNATURE, ZIP_ECD_SIZE, ZIP_ENTRY_EXTRAFIELD_LEN, ZIP_ENTRY_SIGNATURE, ZIP_FLAGS, ZIP_VERSION, centralDirectoryLength, crcUtils, create, createCDRecord, createEndOfCDRecord, createEntry, createFileHeader, dosFormatDate, dosFormatTime, fileHeaderLength, getCombinedCrc, iob, totalLength;
            crcUtils = __webpack_require__(225);
            CombinedStream = __webpack_require__(222);
            ({DeflateCRC32Stream} = __webpack_require__(227));
            ZIP_VERSION = Buffer.from([ 10, 0 ]);
            ZIP_FLAGS = Buffer.from([ 0, 0 ]);
            ZIP_ENTRY_SIGNATURE = Buffer.from([ 80, 75, 3, 4 ]);
            ZIP_ENTRY_EXTRAFIELD_LEN = Buffer.from([ 0, 0 ]);
            ZIP_COMPRESSION_DEFLATE = Buffer.from([ 8, 0 ]);
            ZIP_CD_SIGNATURE = Buffer.from([ 80, 75, 1, 2 ]);
            ZIP_CD_VERSION = Buffer.from([ 30, 3 ]);
            ZIP_CD_FILE_COMM_LEN = Buffer.from([ 0, 0 ]);
            ZIP_CD_DISK_START = Buffer.from([ 0, 0 ]);
            ZIP_CD_INTERNAL_ATT = Buffer.from([ 1, 0 ]);
            ZIP_CD_EXTERNAL_ATT = Buffer.from([ 0, 0, 164, 129 ]);
            ZIP_ECD_SIGNATURE = Buffer.from([ 80, 75, 5, 6 ]);
            ZIP_ECD_DISK_NUM = Buffer.from([ 0, 0 ]);
            ZIP_ECD_COMM_LEN = Buffer.from([ 0, 0 ]);
            ZIP_ECD_SIZE = 22;
            DEFLATE_END = Buffer.from([ 3, 0 ]);
            DeflatePartStream = class DeflatePartStream extends DeflateCRC32Stream {
                constructor() {
                    super(...arguments);
                    this.buf = Buffer.alloc(0);
                }
                push(chunk) {
                    if (chunk !== null) {
                        super.push(this.buf);
                        return this.buf = chunk;
                    } else {
                        if (this.buf.length >= 2 && this.buf.slice(-2).equals(DEFLATE_END)) {
                            this.buf = this.buf.slice(0, -2);
                        }
                        super.push(this.buf);
                        return super.push(null);
                    }
                }
                end() {
                    return this.flush((() => super.end()));
                }
                metadata() {
                    return {
                        crc: this.digest().readUInt32BE(0),
                        len: this.size(),
                        zLen: this.size(true)
                    };
                }
            };
            exports.createDeflatePart = function() {
                return new DeflatePartStream;
            };
            fileHeaderLength = function(filename) {
                return 30 + filename.length;
            };
            centralDirectoryLength = function(filename) {
                return 46 + filename.length;
            };
            iob = function(number, size) {
                var b;
                b = Buffer.alloc(size);
                b.fill(0).writeUIntLE(number, 0, size);
                return b;
            };
            createFileHeader = function({filename, compressed_size, uncompressed_size, crc, mtime, mdate}) {
                return Buffer.concat([ ZIP_ENTRY_SIGNATURE, ZIP_VERSION, ZIP_FLAGS, ZIP_COMPRESSION_DEFLATE, mtime, mdate, crc, iob(compressed_size, 4), iob(uncompressed_size, 4), iob(filename.length, 2), ZIP_ENTRY_EXTRAFIELD_LEN, Buffer.from(filename) ]);
            };
            createCDRecord = function({filename, compressed_size, uncompressed_size, crc, mtime, mdate}, fileHeaderOffset) {
                return Buffer.concat([ ZIP_CD_SIGNATURE, ZIP_CD_VERSION, ZIP_VERSION, ZIP_FLAGS, ZIP_COMPRESSION_DEFLATE, mtime, mdate, crc, iob(compressed_size, 4), iob(uncompressed_size, 4), iob(filename.length, 2), ZIP_ENTRY_EXTRAFIELD_LEN, ZIP_CD_FILE_COMM_LEN, ZIP_CD_DISK_START, ZIP_CD_INTERNAL_ATT, ZIP_CD_EXTERNAL_ATT, iob(fileHeaderOffset, 4), Buffer.from(filename) ]);
            };
            createEndOfCDRecord = function(entries) {
                var cd_offset, cd_size;
                cd_offset = entries.reduce((function(sum, x) {
                    return sum + fileHeaderLength(x.filename) + x.compressed_size;
                }), 0);
                cd_size = entries.reduce((function(sum, x) {
                    return sum + centralDirectoryLength(x.filename);
                }), 0);
                return Buffer.concat([ ZIP_ECD_SIGNATURE, ZIP_ECD_DISK_NUM, ZIP_CD_DISK_START, iob(entries.length, 2), iob(entries.length, 2), iob(cd_size, 4), iob(cd_offset, 4), ZIP_ECD_COMM_LEN ]);
            };
            dosFormatTime = function(d) {
                var buf;
                buf = Buffer.alloc(2);
                buf.writeUIntLE(d.getSeconds() / 2 + (d.getMinutes() << 5) + (d.getHours() << 11), 0, 2);
                return buf;
            };
            dosFormatDate = function(d) {
                var buf;
                buf = Buffer.alloc(2);
                buf.writeUIntLE(d.getDate() + (d.getMonth() + 1 << 5) + (d.getFullYear() - 1980 << 9), 0, 2);
                return buf;
            };
            getCombinedCrc = function(parts) {
                var buf;
                if (parts.length === 1) {
                    buf = Buffer.alloc(4);
                    buf.writeUInt32LE(parts[0].crc, 0, 4);
                    return buf;
                } else {
                    return crcUtils.crc32_combine_multi(parts).combinedCrc32;
                }
            };
            exports.totalLength = totalLength = function(entries) {
                return ZIP_ECD_SIZE + entries.reduce((function(sum, x) {
                    return sum + x.zLen;
                }), 0);
            };
            exports.createEntry = createEntry = function(filename, parts, mdate) {
                var compressed_size, contentLength, entry, i, len, stream, uncompressed_size;
                if (mdate == null) {
                    mdate = new Date;
                }
                compressed_size = parts.reduce((function(sum, x) {
                    return sum + x.zLen;
                }), DEFLATE_END.length);
                uncompressed_size = parts.reduce((function(sum, x) {
                    return sum + x.len;
                }), 0);
                contentLength = fileHeaderLength(filename) + compressed_size;
                entry = {
                    filename,
                    compressed_size,
                    uncompressed_size,
                    crc: getCombinedCrc(parts),
                    mtime: dosFormatTime(mdate),
                    mdate: dosFormatDate(mdate),
                    contentLength,
                    zLen: contentLength + centralDirectoryLength(filename),
                    stream: CombinedStream.create()
                };
                entry.stream.append(createFileHeader(entry));
                for (i = 0, len = parts.length; i < len; i++) {
                    ({stream} = parts[i]);
                    entry.stream.append(stream);
                }
                entry.stream.append(DEFLATE_END);
                return entry;
            };
            exports.create = create = function(entries) {
                var entry, i, j, len, len1, offset, out;
                out = CombinedStream.create();
                for (i = 0, len = entries.length; i < len; i++) {
                    entry = entries[i];
                    out.append(entry.stream);
                }
                offset = 0;
                for (j = 0, len1 = entries.length; j < len1; j++) {
                    entry = entries[j];
                    out.append(createCDRecord(entry, offset));
                    offset += entry.contentLength;
                }
                out.append(createEndOfCDRecord(entries));
                out.zLen = totalLength(entries);
                return out;
            };
            exports.createZip = function(filename, parts, mdate) {
                var entry;
                entry = createEntry(filename, parts, mdate);
                return create([ entry ]);
            };
        }).call(this);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.SingleUseStreamSource = void 0;
        const source_destination_1 = __webpack_require__(54);
        const errors_1 = __webpack_require__(19);
        const stream_limiter_1 = __webpack_require__(88);
        class SingleUseStreamSource extends source_destination_1.SourceDestination {
            constructor(stream) {
                super();
                this.stream = stream;
                this.used = false;
            }
            async canCreateReadStream() {
                return !this.used;
            }
            async createReadStream({start = 0, end} = {}) {
                if (this.used) {
                    throw new errors_1.NotCapable("Single use source stream already used");
                }
                if (start !== 0) {
                    throw new errors_1.NotCapable("Can't seek in a single use stream");
                }
                let stream = this.stream;
                if (end !== undefined) {
                    stream = new stream_limiter_1.StreamLimiter(stream, end + 1);
                }
                this.used = true;
                return stream;
            }
        }
        exports.SingleUseStreamSource = SingleUseStreamSource;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.UsbBBbootDrive = void 0;
        const source_destination_1 = __webpack_require__(54);
        class UsbBBbootDrive extends source_destination_1.SourceDestination {
            constructor(usbDevice) {
                super();
                this.usbDevice = usbDevice;
                this.raw = null;
                this.displayName = "Initializing device";
                this.device = null;
                this.devicePath = null;
                this.icon = "loading";
                this.isSystem = false;
                this.description = "BeagleBone";
                this.mountpoints = [];
                this.isReadOnly = false;
                this.disabled = true;
                this.size = null;
                this.emitsProgress = true;
                this.progress = 0;
                usbDevice.on("progress", (value => {
                    this.progress = value;
                    this.emit("progress", value);
                }));
            }
        }
        exports.UsbBBbootDrive = UsbBBbootDrive;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.UsbbootDrive = void 0;
        const source_destination_1 = __webpack_require__(54);
        class UsbbootDrive extends source_destination_1.SourceDestination {
            constructor(usbDevice) {
                super();
                this.usbDevice = usbDevice;
                this.raw = null;
                this.displayName = "Initializing device";
                this.device = null;
                this.devicePath = null;
                this.icon = "loading";
                this.isSystem = false;
                this.description = "Compute Module";
                this.mountpoints = [];
                this.isReadOnly = false;
                this.disabled = true;
                this.size = null;
                this.emitsProgress = true;
                this.progress = 0;
                usbDevice.on("progress", (value => {
                    this.progress = value;
                    this.emit("progress", value);
                }));
            }
        }
        exports.UsbbootDrive = UsbbootDrive;
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: true
        });
        exports.XzSource = void 0;
        const lzma_native_1 = __webpack_require__(256);
        const os_1 = __webpack_require__(6);
        const util_1 = __webpack_require__(14);
        const compressed_source_1 = __webpack_require__(87);
        const source_destination_1 = __webpack_require__(54);
        const parseFileIndexAsync = (0, util_1.promisify)(lzma_native_1.parseFileIndex);
        class XzSource extends compressed_source_1.CompressedSource {
            createTransform() {
                return (0, lzma_native_1.createDecompressor)({
                    memlimit: Math.floor((0, os_1.totalmem)() * .2)
                });
            }
            async getSize() {
                if (!await this.source.canRead()) {
                    const sizeFromPartitionTable = await this.getSizeFromPartitionTable();
                    if (sizeFromPartitionTable !== undefined) {
                        return {
                            size: sizeFromPartitionTable,
                            isEstimated: true
                        };
                    }
                    return;
                }
                const {size} = await this.source.getMetadata();
                if (size === undefined) {
                    return;
                }
                const {uncompressedSize} = await parseFileIndexAsync({
                    fileSize: size,
                    read: async (count, offset, callback) => {
                        try {
                            const readResult = await this.source.read(Buffer.allocUnsafe(count), 0, count, offset);
                            callback(null, readResult.buffer);
                        } catch (error) {
                            callback(error);
                        }
                    }
                });
                return {
                    size: uncompressedSize,
                    isEstimated: false
                };
            }
        }
        exports.XzSource = XzSource;
        XzSource.mimetype = "application/x-xz";
        source_destination_1.SourceDestination.register(XzSource);
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        (function() {
            "use strict";
            var stream = __webpack_require__(17);
            var assert = __webpack_require__(168);
            var fs = __webpack_require__(5);
            var util = __webpack_require__(14);
            var nodePreGyp = __webpack_require__(39);
            var path = __webpack_require__(34);
            var binding_path = nodePreGyp.find(path.resolve(path.join(__dirname, "./package.json")));
            var native = __webpack_require__(257);
            Object.assign(exports, native);
            exports.version = "6.0.1";
            var Stream = exports.Stream;
            Stream.curAsyncStreamsCount = 0;
            Stream.prototype.getStream = function(options) {
                options = options || {};
                return new JSLzmaStream(this, options);
            };
            class JSLzmaStream extends stream.Transform {
                constructor(nativeStream, options) {
                    super(options);
                    this.nativeStream = nativeStream;
                    this.synchronous = options.synchronous || !native.asyncCodeAvailable ? true : false;
                    this.chunkCallbacks = [];
                    this.totalIn_ = 0;
                    this.totalOut_ = 0;
                    this._writingLastChunk = false;
                    this._isFinished = false;
                    if (!this.synchronous) {
                        Stream.curAsyncStreamsCount++;
                        var oldCleanup = this.cleanup;
                        var countedCleanup = false;
                        this.cleanup = () => {
                            if (countedCleanup === false) {
                                Stream.curAsyncStreamsCount--;
                                countedCleanup = true;
                            }
                            oldCleanup.call(this);
                        };
                    }
                    this.once("error-cleanup", this.cleanup);
                    this.nativeStream.bufferHandler = (buf, processedChunks, err, totalIn, totalOut) => {
                        if (totalIn !== null) {
                            this.totalIn_ = totalIn;
                            this.totalOut_ = totalOut;
                        }
                        setImmediate((() => {
                            if (err) {
                                this.push(null);
                                this.emit("error-cleanup", err);
                                this.emit("error", err);
                                return;
                            }
                            if (totalIn !== null) {
                                this.emit("progress", {
                                    totalIn: this.totalIn_,
                                    totalOut: this.totalOut_
                                });
                            }
                            if (typeof processedChunks === "number") {
                                assert.ok(processedChunks <= this.chunkCallbacks.length);
                                var chunkCallbacks = this.chunkCallbacks.splice(0, processedChunks);
                                while (chunkCallbacks.length > 0) chunkCallbacks.shift().call(this);
                            } else if (buf === null) {
                                if (this._writingLastChunk) {
                                    this.push(null);
                                } else {
                                    this._isFinished = true;
                                    if (this.nativeStream && this.nativeStream._restart) {
                                        this.nativeStream._restart();
                                    } else {
                                        this.push(null);
                                    }
                                }
                            } else {
                                this.push(buf);
                            }
                        }));
                    };
                    if (typeof options.bufsize !== "undefined") {
                        this.bufsize = options.bufsize;
                    }
                }
                get bufsize() {
                    return this.setBufsize(null);
                }
                set bufsize(n) {
                    if (typeof n !== "number" || n <= 0) {
                        throw new TypeError("bufsize must be a positive number");
                    }
                    return this.setBufsize(n);
                }
                totalIn() {
                    return this.totalIn_;
                }
                totalOut() {
                    return this.totalOut_;
                }
                cleanup() {
                    if (this.nativeStream) {
                        this.nativeStream.resetUnderlying();
                    }
                    this.nativeStream = null;
                }
                _transform(chunk, encoding, callback) {
                    if (!this.nativeStream) return;
                    var possibleEndIndex = bufferIndexOfYZ(chunk);
                    if (possibleEndIndex !== -1) {
                        possibleEndIndex += 2;
                        if (possibleEndIndex !== chunk.length) {
                            this._transform(chunk.slice(0, possibleEndIndex), encoding, (() => {
                                this._transform(chunk.slice(possibleEndIndex), encoding, callback);
                            }));
                            return;
                        }
                    }
                    if (this._isFinished && chunk) {
                        chunk = skipLeadingZeroes(chunk);
                        if (chunk.length > 0) {
                            this._isFinished = false;
                        }
                    }
                    if (chunk && chunk.length === 0) {
                        return callback();
                    }
                    this.chunkCallbacks.push(callback);
                    try {
                        this.nativeStream.code(chunk, !this.synchronous);
                    } catch (e) {
                        this.emit("error-cleanup", e);
                        this.emit("error", e);
                    }
                }
                _writev(chunks, callback) {
                    chunks = chunks.map((chunk => chunk.chunk));
                    this._write(Buffer.concat(chunks), null, callback);
                }
                _flush(callback) {
                    this._writingLastChunk = true;
                    if (this._isFinished) {
                        this.cleanup();
                        callback(null);
                        return;
                    }
                    this._transform(null, null, (function() {
                        this.cleanup();
                        callback.apply(this, arguments);
                    }));
                }
            }
            Object.getOwnPropertyNames(native.Stream.prototype).forEach((function(key) {
                if (typeof native.Stream.prototype[key] !== "function" || key === "constructor") return;
                JSLzmaStream.prototype[key] = function() {
                    return this.nativeStream[key].apply(this.nativeStream, arguments);
                };
            }));
            Stream.prototype.rawEncoder = function(options) {
                return this.rawEncoder_(options.filters || []);
            };
            Stream.prototype.rawDecoder = function(options) {
                return this.rawDecoder_(options.filters || []);
            };
            Stream.prototype.easyEncoder = function(options) {
                var preset = options.preset || exports.PRESET_DEFAULT;
                var check = options.check || exports.CHECK_CRC32;
                if (typeof options.threads !== "undefined" && options.threads !== null) {
                    return this.mtEncoder_(Object.assign({
                        preset,
                        filters: null,
                        check
                    }, options));
                } else {
                    return this.easyEncoder_(preset, check);
                }
            };
            Stream.prototype.streamEncoder = function(options) {
                var filters = options.filters || [];
                var check = options.check || exports.CHECK_CRC32;
                if (typeof options.threads !== "undefined" && options.threads !== null) {
                    return this.mtEncoder_(Object.assign({
                        preset: null,
                        filters,
                        check
                    }, options));
                } else {
                    return this.streamEncoder_(filters, check);
                }
            };
            Stream.prototype.streamDecoder = function(options) {
                this._initOptions = options;
                this._restart = function() {
                    this.resetUnderlying();
                    this.streamDecoder(this._initOptions);
                };
                return this.streamDecoder_(options.memlimit || null, options.flags || 0);
            };
            Stream.prototype.autoDecoder = function(options) {
                this._initOptions = options;
                this._restart = function() {
                    this.resetUnderlying();
                    this.autoDecoder(this._initOptions);
                };
                return this.autoDecoder_(options.memlimit || null, options.flags || 0);
            };
            Stream.prototype.aloneDecoder = function(options) {
                return this.aloneDecoder_(options.memlimit || null);
            };
            var createStream = exports.createStream = function(coder, options) {
                if ([ "number", "object" ].indexOf(typeof coder) !== -1 && !options) {
                    options = coder;
                    coder = null;
                }
                if (parseInt(options) === parseInt(options)) options = {
                    preset: parseInt(options)
                };
                coder = coder || "easyEncoder";
                options = options || {};
                var stream = new Stream;
                stream[coder](options);
                if (options.memlimit) stream.memlimitSet(options.memlimit);
                return stream.getStream(options);
            };
            exports.createCompressor = function(options) {
                return createStream("easyEncoder", options);
            };
            exports.createDecompressor = function(options) {
                return createStream("autoDecoder", options);
            };
            exports.crc32 = function(input, encoding, presetCRC32) {
                if (typeof encoding === "number") {
                    presetCRC32 = encoding;
                    encoding = null;
                }
                if (typeof input === "string") input = Buffer.from(input, encoding);
                return exports.crc32_(input, presetCRC32 || 0);
            };
            exports.Compressor = function(preset, options) {
                options = Object.assign({}, options);
                if (preset) options.preset = preset;
                return createStream("easyEncoder", options);
            };
            exports.Decompressor = function(options) {
                return createStream("autoDecoder", options);
            };
            function singleStringCoding(stream, string, on_finish, on_progress) {
                on_progress = on_progress || function() {};
                on_finish = on_finish || function() {};
                if (!Buffer.isBuffer(string)) string = Buffer.from(string);
                var deferred = {}, failed = false;
                stream.once("error", (function(err) {
                    failed = true;
                    on_finish(null, err);
                }));
                deferred.promise = new Promise((function(resolve, reject) {
                    deferred.resolve = resolve;
                    deferred.reject = reject;
                }));
                deferred.promise.catch(noop);
                stream.once("error", (function(e) {
                    deferred.reject(e);
                }));
                var buffers = [];
                stream.on("data", (function(b) {
                    buffers.push(b);
                }));
                stream.once("end", (function() {
                    var result = Buffer.concat(buffers);
                    if (!failed) {
                        on_progress(1);
                        on_finish(result);
                    }
                    if (deferred) deferred.resolve(result);
                }));
                on_progress(0);
                stream.end(string);
                if (deferred) return deferred.promise;
            }
            exports.LZMA = function() {
                return {
                    compress: function(string, mode, on_finish, on_progress) {
                        var opt = {};
                        if (parseInt(mode) === parseInt(mode) && mode >= 1 && mode <= 9) opt.preset = parseInt(mode);
                        var stream = createStream("aloneEncoder", opt);
                        return singleStringCoding(stream, string, on_finish, on_progress);
                    },
                    decompress: function(byte_array, on_finish, on_progress) {
                        var stream = createStream("autoDecoder");
                        return singleStringCoding(stream, byte_array, on_finish, on_progress);
                    },
                    worker: function() {
                        return null;
                    }
                };
            };
            exports.compress = function(string, opt, on_finish) {
                if (typeof opt === "function") {
                    on_finish = opt;
                    opt = {};
                }
                var stream = createStream("easyEncoder", opt);
                return singleStringCoding(stream, string, on_finish);
            };
            exports.decompress = function(string, opt, on_finish) {
                if (typeof opt === "function") {
                    on_finish = opt;
                    opt = {};
                }
                var stream = createStream("autoDecoder", opt);
                return singleStringCoding(stream, string, on_finish);
            };
            if (util.promisify) {
                exports.compress[util.promisify.custom] = exports.compress;
                exports.decompress[util.promisify.custom] = exports.decompress;
            }
            exports.isXZ = function(buf) {
                return buf && buf.length >= 6 && buf[0] === 253 && buf[1] === 55 && buf[2] === 122 && buf[3] === 88 && buf[4] === 90 && buf[5] === 0;
            };
            exports.parseFileIndex = function(options, callback) {
                if (typeof options !== "object") {
                    throw new TypeError("parseFileIndex needs an options object");
                }
                var p = new native.IndexParser;
                if (typeof options.fileSize !== "number") {
                    throw new TypeError("parseFileeIndex needs options.fileSize");
                }
                if (typeof options.read !== "function") {
                    throw new TypeError("parseFileIndex needs a read callback");
                }
                p.init(options.fileSize, options.memlimit || 0);
                p.read_cb = function(count, offset) {
                    var inSameTick = true;
                    var bytesRead = count;
                    options.read(count, offset, (function(err, buffer) {
                        if (Buffer.isBuffer(err)) {
                            buffer = err;
                            err = null;
                        }
                        if (err) {
                            if (typeof callback === "undefined") {
                                throw err;
                            }
                            return callback(err, null);
                        }
                        p.feed(buffer);
                        bytesRead = buffer.length;
                        if (inSameTick) {
                            return;
                        }
                        var info;
                        try {
                            info = p.parse();
                        } catch (e) {
                            return callback(e, null);
                        }
                        if (info !== true) {
                            return callback(null, cleanupIndexInfo(info));
                        }
                    }));
                    inSameTick = false;
                    return bytesRead;
                };
                var info;
                try {
                    info = p.parse();
                } catch (e) {
                    if (typeof callback !== "undefined") {
                        callback(e, null);
                        return;
                    }
                    throw e;
                }
                if (info !== true) {
                    info = cleanupIndexInfo(info);
                    if (typeof callback !== "undefined" && info !== true) {
                        callback(null, info);
                    }
                    return info;
                }
            };
            exports.parseFileIndexFD = function(fd, callback) {
                return fs.fstat(fd, (function(err, stats) {
                    if (err) {
                        return callback(err, null);
                    }
                    exports.parseFileIndex({
                        fileSize: stats.size,
                        read: function(count, offset, cb) {
                            var buffer = Buffer.allocUnsafe(count);
                            fs.read(fd, buffer, 0, count, offset, (function(err, bytesRead, buffer) {
                                if (err) {
                                    return cb(err, null);
                                }
                                if (bytesRead !== count) {
                                    return cb(new Error("Truncated file!"), null);
                                }
                                cb(null, buffer);
                            }));
                        }
                    }, callback);
                }));
            };
            function cleanupIndexInfo(info) {
                var checkFlags = info.checks;
                info.checks = [];
                for (var i = 0; i < exports.CHECK_ID_MAX; i++) {
                    if (checkFlags & 1 << i) info.checks.push(i);
                }
                return info;
            }
            function skipLeadingZeroes(buffer) {
                var i;
                for (i = 0; i < buffer.length; i++) {
                    if (buffer[i] !== 0) break;
                }
                return buffer.slice(i);
            }
            function bufferIndexOfYZ(chunk) {
                if (!chunk) {
                    return -1;
                }
                if (chunk.indexOf) {
                    return chunk.indexOf("YZ");
                }
                var i;
                for (i = 0; i < chunk.length - 1; i++) {
                    if (chunk[i] === 89 && chunk[i + 1] === 90) {
                        return i;
                    }
                }
                return -1;
            }
            function noop() {}
        })();
    }, module => {
        module.exports = require("./modules/lzma-native/binding/lzma_native.node");
    }, (__unused_webpack_module, exports, __webpack_require__) => {
        "use strict";
        var __webpack_unused_export__;
        __webpack_unused_export__ = {
            value: true
        };
        __webpack_unused_export__ = exports.Ri = exports.dk = void 0;
        const fs_1 = __webpack_require__(5);
        const path_1 = __webpack_require__(34);
        const block_read_stream_1 = __webpack_require__(82);
        const block_transform_stream_1 = __webpack_require__(141);
        const constants_1 = __webpack_require__(18);
        const compressed_source_1 = __webpack_require__(87);
        const configured_source_1 = __webpack_require__(91);
        const file_1 = __webpack_require__(53);
        const multi_destination_1 = __webpack_require__(180);
        const source_destination_1 = __webpack_require__(54);
        const tmp_1 = __webpack_require__(32);
        exports.dk = "decompressed-image-";
        function getEta(current, total, speed) {
            return speed === 0 ? undefined : (total - current) / speed;
        }
        function isWorthDecompressing(filename = "") {
            return [ ".img", ".bin", ".hddimg", ".raw", ".sdcard", ".rpi-sdimg", ".wic" ].includes((0, 
            path_1.extname)(filename));
        }
        function defaultEnoughSpaceForDecompression(free, imageSize) {
            return imageSize === undefined ? false : imageSize < Math.min(free / 2, 5 * 1024 ** 3);
        }
        async function decompressThenFlash({source, destinations, onFail, onProgress, verify = false, numBuffers = 16, decompressFirst = false, trim = false, configure, enoughSpaceForDecompression = defaultEnoughSpaceForDecompression, asItIs = false}) {
            await source.open();
            if (!asItIs) {
                source = await source.getInnerSource();
            }
            const sourceMetadata = await source.getMetadata();
            const enoughDiskSpaceAvailable = enoughSpaceForDecompression(await (0, tmp_1.freeSpace)(), sourceMetadata.size);
            let decompressedFilePath;
            try {
                if (decompressFirst && sourceMetadata.isCompressed && isWorthDecompressing(sourceMetadata.name) && enoughDiskSpaceAvailable) {
                    ({path: decompressedFilePath} = await (0, tmp_1.tmpFile)({
                        keepOpen: false,
                        prefix: exports.dk
                    }));
                    const decompressedSource = new file_1.File({
                        path: decompressedFilePath,
                        write: true
                    });
                    await decompressedSource.open();
                    const inputStream = await source.createReadStream();
                    const outputStream = await decompressedSource.createWriteStream();
                    await new Promise(((resolve, reject) => {
                        outputStream.on("done", resolve);
                        outputStream.on("error", reject);
                        inputStream.on("error", reject);
                        const state = {
                            active: 0,
                            failed: 0,
                            type: "decompressing"
                        };
                        const [$onProgress, onRootStreamProgress] = createCompleteOnProgress(onProgress, sourceMetadata, state, false);
                        (0, compressed_source_1.getRootStream)(inputStream).on("progress", onRootStreamProgress);
                        outputStream.on("progress", $onProgress);
                        inputStream.pipe(outputStream);
                    }));
                    source = decompressedSource;
                }
                if ((trim || configure !== undefined) && !(source instanceof configured_source_1.ConfiguredSource)) {
                    if (!await source.canRead()) {
                        console.warn("Can't configure or trim a source that is not randomly readable, skipping");
                    } else {
                        source = new configured_source_1.ConfiguredSource({
                            source,
                            shouldTrimPartitions: trim,
                            createStreamFromDisk: decompressFirst || !sourceMetadata.isCompressed,
                            configure
                        });
                        await source.open();
                    }
                }
                return await pipeSourceToDestinations({
                    source,
                    destinations,
                    onFail,
                    onProgress,
                    verify,
                    numBuffers
                });
            } finally {
                if (decompressedFilePath) {
                    await fs_1.promises.unlink(decompressedFilePath);
                }
            }
        }
        exports.Ri = decompressThenFlash;
        function createCompleteOnProgress(onProgress, sourceMetadata, state, sparse) {
            function $onProgress(progress) {
                if (sourceMetadata.size !== undefined && state.size === undefined) {
                    state.size = sourceMetadata.size;
                }
                let size;
                let percentage;
                let eta;
                if (sparse) {
                    size = state.blockmappedSize;
                    state.bytesWritten = progress.bytes;
                } else {
                    size = state.size;
                    state.bytesWritten = progress.position;
                }
                if (size !== undefined && state.bytesWritten !== undefined && state.bytesWritten <= size) {
                    percentage = state.bytesWritten / size * 100;
                    eta = getEta(state.bytesWritten, size, progress.speed);
                } else if (state.rootStreamSpeed !== undefined && state.rootStreamPosition !== undefined && state.compressedSize !== undefined) {
                    percentage = state.rootStreamPosition / state.compressedSize * 100;
                    eta = getEta(state.rootStreamPosition, state.compressedSize, state.rootStreamSpeed);
                }
                const result = {
                    ...progress,
                    ...state,
                    percentage,
                    eta
                };
                onProgress(result);
            }
            function onRootStreamProgress(progress) {
                state.rootStreamPosition = progress.position;
                state.rootStreamSpeed = progress.speed;
                state.rootStreamAverageSpeed = progress.averageSpeed;
            }
            return [ $onProgress, onRootStreamProgress ];
        }
        async function pipeSourceToDestinations({source, destinations, onFail, onProgress, verify = false, numBuffers = 16}) {
            if (numBuffers < 2) {
                numBuffers = 2;
            }
            const destination = new multi_destination_1.MultiDestination(destinations);
            const failures = new Map;
            const state = {
                active: destination.destinations.size,
                failed: 0,
                type: "flashing"
            };
            destination.on("fail", _onFail);
            await Promise.all([ source.open(), destination.open() ]);
            const [sourceMetadata, sparseSource, sparseDestination] = await Promise.all([ source.getMetadata(), source.canCreateSparseReadStream(), destination.canCreateSparseWriteStream() ]);
            const sparse = sparseSource && sparseDestination;
            state.sparse = sparse;
            state.size = sourceMetadata.size;
            state.compressedSize = sourceMetadata.compressedSize;
            state.blockmappedSize = sourceMetadata.blockmappedSize;
            function updateState(step) {
                if (step !== undefined) {
                    state.type = step;
                }
                state.failed = failures.size;
                state.active = destination.destinations.size - state.failed;
            }
            function _onFail(error) {
                failures.set(error.destination, error.error);
                updateState();
                onFail(error.destination, error.error);
            }
            const [$onProgress, onRootStreamProgress] = createCompleteOnProgress(onProgress, sourceMetadata, state, sparse);
            if (sparse) {
                await pipeSparseSourceToDestination(source, destination, verify, numBuffers, updateState, _onFail, $onProgress, onRootStreamProgress);
            } else {
                await pipeRegularSourceToDestination(source, sourceMetadata, destination, verify, numBuffers, updateState, _onFail, $onProgress, onRootStreamProgress);
            }
            updateState("finished");
            await Promise.all([ source.close(), destination.close() ]);
            return {
                sourceMetadata,
                failures,
                bytesWritten: state.bytesWritten || 0
            };
        }
        __webpack_unused_export__ = pipeSourceToDestinations;
        function notUndefined(x) {
            return x !== undefined;
        }
        function getAlignment(...devices) {
            const alignments = devices.map((d => d.getAlignment())).filter(notUndefined);
            if (alignments.length) {
                return Math.max(...alignments);
            }
        }
        async function pipeRegularSourceToDestination(source, sourceMetadata, destination, verify, numBuffers, updateState, onFail, onProgress, onRootStreamProgress) {
            let lastPosition = 0;
            const emitSourceProgress = sourceMetadata.size === undefined || sourceMetadata.isSizeEstimated;
            const alignment = getAlignment(source, destination);
            const highWaterMark = alignment === undefined ? undefined : numBuffers - 1;
            const [sourceStream, destinationStream] = await Promise.all([ source.createReadStream({
                emitProgress: emitSourceProgress,
                alignment,
                numBuffers
            }), destination.createWriteStream({
                highWaterMark
            }) ]);
            (0, compressed_source_1.getRootStream)(sourceStream).on("progress", (progress => {
                onRootStreamProgress(progress);
            }));
            const checksum = await new Promise(((resolve, reject) => {
                let result;
                let done = false;
                let hasher;
                function maybeDone(maybeChecksum) {
                    if (maybeChecksum !== undefined) {
                        result = maybeChecksum;
                    } else {
                        done = true;
                    }
                    if (done && (!verify || destination.activeDestinations.size === 0 || result !== undefined)) {
                        if (hasher !== undefined) {
                            sourceStream.unpipe(hasher);
                            hasher.end();
                        }
                        resolve(result);
                    }
                }
                sourceStream.once("error", reject);
                destinationStream.on("fail", onFail);
                destinationStream.once("error", reject);
                if (verify) {
                    hasher = (0, source_destination_1.createHasher)();
                    hasher.once("checksum", maybeDone);
                    sourceStream.pipe(hasher);
                }
                destinationStream.once("done", maybeDone);
                destinationStream.on("progress", (progress => {
                    lastPosition = progress.position;
                    onProgress(progress);
                }));
                if (alignment !== undefined && !(sourceStream instanceof block_read_stream_1.BlockReadStream || sourceStream instanceof block_transform_stream_1.BlockTransformStream)) {
                    sourceStream.pipe(new block_transform_stream_1.BlockTransformStream({
                        chunkSize: constants_1.CHUNK_SIZE,
                        alignment,
                        numBuffers
                    })).pipe(destinationStream);
                } else {
                    sourceStream.pipe(destinationStream);
                }
            }));
            if (sourceMetadata.size === undefined || sourceMetadata.isSizeEstimated === true) {
                sourceMetadata.size = lastPosition;
                sourceMetadata.isSizeEstimated = false;
            }
            if (verify && checksum) {
                updateState("verifying");
                const verifier = destination.createVerifier(checksum, lastPosition);
                await runVerifier(verifier, onFail, onProgress);
            }
        }
        async function pipeSparseSourceToDestination(source, destination, verify, numBuffers, updateState, onFail, onProgress, onRootStreamProgress) {
            const alignment = getAlignment(source, destination);
            const highWaterMark = alignment === undefined ? undefined : numBuffers - 1;
            const [sourceStream, destinationStream] = await Promise.all([ source.createSparseReadStream({
                generateChecksums: verify,
                alignment,
                numBuffers
            }), destination.createSparseWriteStream({
                highWaterMark
            }) ]);
            (0, compressed_source_1.getRootStream)(sourceStream).on("progress", (progress => {
                onRootStreamProgress(progress);
            }));
            await new Promise(((resolve, reject) => {
                sourceStream.once("error", reject);
                destinationStream.once("error", reject);
                destinationStream.once("done", resolve);
                destinationStream.on("fail", onFail);
                destinationStream.on("progress", onProgress);
                sourceStream.pipe(destinationStream);
            }));
            if (verify) {
                updateState("verifying");
                const verifier = destination.createVerifier(sourceStream.blocks);
                await runVerifier(verifier, onFail, onProgress);
            }
        }
        async function runVerifier(verifier, onFail, onProgress) {
            await new Promise(((resolve, reject) => {
                verifier.once("error", reject);
                verifier.once("finish", resolve);
                verifier.on("fail", onFail);
                verifier.on("progress", onProgress);
                verifier.run();
            }));
        }
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const IPC = __webpack_require__(260);
        class IPCModule extends IPC {
            constructor() {
                super();
                Object.defineProperty(this, "IPC", {
                    enumerable: true,
                    writable: false,
                    value: IPC
                });
            }
        }
        module.exports = new IPCModule;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const Defaults = __webpack_require__(261), Client = __webpack_require__(262), Server = __webpack_require__(271), util = __webpack_require__(14);
        class IPC {
            constructor() {
                Object.defineProperties(this, {
                    config: {
                        enumerable: true,
                        writable: true,
                        value: new Defaults
                    },
                    connectTo: {
                        enumerable: true,
                        writable: false,
                        value: connect
                    },
                    connectToNet: {
                        enumerable: true,
                        writable: false,
                        value: connectNet
                    },
                    disconnect: {
                        enumerable: true,
                        writable: false,
                        value: disconnect
                    },
                    serve: {
                        enumerable: true,
                        writable: false,
                        value: serve
                    },
                    serveNet: {
                        enumerable: true,
                        writable: false,
                        value: serveNet
                    },
                    of: {
                        enumerable: true,
                        writable: true,
                        value: {}
                    },
                    server: {
                        enumerable: true,
                        writable: true,
                        configurable: true,
                        value: false
                    },
                    log: {
                        enumerable: true,
                        writable: false,
                        value: log
                    }
                });
            }
        }
        function log(...args) {
            if (this.config.silent) {
                return;
            }
            for (let i = 0, count = args.length; i < count; i++) {
                if (typeof args[i] != "object") {
                    continue;
                }
                args[i] = util.inspect(args[i], {
                    depth: this.config.logDepth,
                    colors: this.config.logInColor
                });
            }
            this.config.logger(args.join(" "));
        }
        function disconnect(id) {
            if (!this.of[id]) {
                return;
            }
            this.of[id].explicitlyDisconnected = true;
            this.of[id].off("*", "*");
            if (this.of[id].socket) {
                if (this.of[id].socket.destroy) {
                    this.of[id].socket.destroy();
                }
            }
            delete this.of[id];
        }
        function serve(path, callback) {
            if (typeof path == "function") {
                callback = path;
                path = false;
            }
            if (!path) {
                this.log("Server path not specified, so defaulting to", "ipc.config.socketRoot + ipc.config.appspace + ipc.config.id", this.config.socketRoot + this.config.appspace + this.config.id);
                path = this.config.socketRoot + this.config.appspace + this.config.id;
            }
            if (!callback) {
                callback = emptyCallback;
            }
            this.server = new Server(path, this.config, log);
            this.server.on("start", callback);
        }
        function emptyCallback() {}
        function serveNet(host, port, UDPType, callback) {
            if (typeof host == "number") {
                callback = UDPType;
                UDPType = port;
                port = host;
                host = false;
            }
            if (typeof host == "function") {
                callback = host;
                UDPType = false;
                host = false;
                port = false;
            }
            if (!host) {
                this.log("Server host not specified, so defaulting to", "ipc.config.networkHost", this.config.networkHost);
                host = this.config.networkHost;
            }
            if (host.toLowerCase() == "udp4" || host.toLowerCase() == "udp6") {
                callback = port;
                UDPType = host.toLowerCase();
                port = false;
                host = this.config.networkHost;
            }
            if (typeof port == "string") {
                callback = UDPType;
                UDPType = port;
                port = false;
            }
            if (typeof port == "function") {
                callback = port;
                UDPType = false;
                port = false;
            }
            if (!port) {
                this.log("Server port not specified, so defaulting to", "ipc.config.networkPort", this.config.networkPort);
                port = this.config.networkPort;
            }
            if (typeof UDPType == "function") {
                callback = UDPType;
                UDPType = false;
            }
            if (!callback) {
                callback = emptyCallback;
            }
            this.server = new Server(host, this.config, log, port);
            if (UDPType) {
                this.server[UDPType] = true;
                if (UDPType === "udp4" && host === "::1") {
                    this.server.path = "127.0.0.1";
                }
            }
            this.server.on("start", callback);
        }
        function connect(id, path, callback) {
            if (typeof path == "function") {
                callback = path;
                path = false;
            }
            if (!callback) {
                callback = emptyCallback;
            }
            if (!id) {
                this.log("Service id required", "Requested service connection without specifying service id. Aborting connection attempt");
                return;
            }
            if (!path) {
                this.log("Service path not specified, so defaulting to", "ipc.config.socketRoot + ipc.config.appspace + id", (this.config.socketRoot + this.config.appspace + id).data);
                path = this.config.socketRoot + this.config.appspace + id;
            }
            if (this.of[id]) {
                if (!this.of[id].socket.destroyed) {
                    this.log("Already Connected to", id, "- So executing success without connection");
                    callback();
                    return;
                }
                this.of[id].socket.destroy();
            }
            this.of[id] = new Client(this.config, this.log);
            this.of[id].id = id;
            this.of[id].path = path;
            this.of[id].connect();
            callback(this);
        }
        function connectNet(id, host, port, callback) {
            if (!id) {
                this.log("Service id required", "Requested service connection without specifying service id. Aborting connection attempt");
                return;
            }
            if (typeof host == "number") {
                callback = port;
                port = host;
                host = false;
            }
            if (typeof host == "function") {
                callback = host;
                host = false;
                port = false;
            }
            if (!host) {
                this.log("Server host not specified, so defaulting to", "ipc.config.networkHost", this.config.networkHost);
                host = this.config.networkHost;
            }
            if (typeof port == "function") {
                callback = port;
                port = false;
            }
            if (!port) {
                this.log("Server port not specified, so defaulting to", "ipc.config.networkPort", this.config.networkPort);
                port = this.config.networkPort;
            }
            if (typeof callback == "string") {
                UDPType = callback;
                callback = false;
            }
            if (!callback) {
                callback = emptyCallback;
            }
            if (this.of[id]) {
                if (!this.of[id].socket.destroyed) {
                    this.log("Already Connected to", id, "- So executing success without connection");
                    callback();
                    return;
                }
                this.of[id].socket.destroy();
            }
            this.of[id] = new Client(this.config, this.log);
            this.of[id].id = id;
            this.of[id].path = host;
            this.of[id].port = port;
            this.of[id].connect();
            callback(this);
        }
        module.exports = IPC;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const os = __webpack_require__(6);
        class Defaults {
            constructor() {
                this.appspace = "app.";
                this.socketRoot = "/tmp/";
                this.id = os.hostname();
                this.encoding = "utf8";
                this.rawBuffer = false;
                this.sync = false;
                this.unlink = true;
                this.delimiter = "\f";
                this.silent = false;
                this.logDepth = 5;
                this.logInColor = true;
                this.logger = console.log.bind(console);
                this.maxConnections = 100;
                this.retry = 500;
                this.maxRetries = Infinity;
                this.stopRetrying = false;
                this.IPType = getIPType();
                this.tls = false;
                this.networkHost = this.IPType == "IPv6" ? "::1" : "127.0.0.1";
                this.networkPort = 8e3;
                this.interface = {
                    localAddress: false,
                    localPort: false,
                    family: false,
                    hints: false,
                    lookup: false
                };
            }
        }
        function getIPType() {
            const networkInterfaces = os.networkInterfaces();
            let IPType = "";
            if (networkInterfaces && Array.isArray(networkInterfaces) && networkInterfaces.length > 0) {
                IPType = networkInterfaces[Object.keys(networkInterfaces)[0]][0].family;
            }
            return IPType;
        }
        module.exports = Defaults;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const net = __webpack_require__(263), tls = __webpack_require__(264), EventParser = __webpack_require__(265), Message = __webpack_require__(266), fs = __webpack_require__(5), Queue = __webpack_require__(267), Events = __webpack_require__(268);
        let eventParser = new EventParser;
        class Client extends Events {
            constructor(config, log) {
                super();
                Object.assign(this, {
                    Client,
                    config,
                    queue: new Queue,
                    socket: false,
                    connect,
                    emit,
                    log,
                    retriesRemaining: config.maxRetries || 0,
                    explicitlyDisconnected: false
                });
                eventParser = new EventParser(this.config);
            }
        }
        function emit(type, data) {
            this.log("dispatching event to ", this.id, this.path, " : ", type, ",", data);
            let message = new Message;
            message.type = type;
            message.data = data;
            if (this.config.rawBuffer) {
                message = Buffer.from(type, this.config.encoding);
            } else {
                message = eventParser.format(message);
            }
            if (!this.config.sync) {
                this.socket.write(message);
                return;
            }
            this.queue.add(syncEmit.bind(this, message));
        }
        function syncEmit(message) {
            this.log("dispatching event to ", this.id, this.path, " : ", message);
            this.socket.write(message);
        }
        function connect() {
            let client = this;
            client.log("requested connection to ", client.id, client.path);
            if (!this.path) {
                client.log("\n\n######\nerror: ", client.id, " client has not specified socket path it wishes to connect to.");
                return;
            }
            const options = {};
            if (!client.port) {
                client.log("Connecting client on Unix Socket :", client.path);
                options.path = client.path;
                if (process.platform === "win32" && !client.path.startsWith("\\\\.\\pipe\\")) {
                    options.path = options.path.replace(/^\//, "");
                    options.path = options.path.replace(/\//g, "-");
                    options.path = `\\\\.\\pipe\\${options.path}`;
                }
                client.socket = net.connect(options);
            } else {
                options.host = client.path;
                options.port = client.port;
                if (client.config.interface.localAddress) {
                    options.localAddress = client.config.interface.localAddress;
                }
                if (client.config.interface.localPort) {
                    options.localPort = client.config.interface.localPort;
                }
                if (client.config.interface.family) {
                    options.family = client.config.interface.family;
                }
                if (client.config.interface.hints) {
                    options.hints = client.config.interface.hints;
                }
                if (client.config.interface.lookup) {
                    options.lookup = client.config.interface.lookup;
                }
                if (!client.config.tls) {
                    client.log("Connecting client via TCP to", options);
                    client.socket = net.connect(options);
                } else {
                    client.log("Connecting client via TLS to", client.path, client.port, client.config.tls);
                    if (client.config.tls.private) {
                        client.config.tls.key = fs.readFileSync(client.config.tls.private);
                    }
                    if (client.config.tls.public) {
                        client.config.tls.cert = fs.readFileSync(client.config.tls.public);
                    }
                    if (client.config.tls.trustedConnections) {
                        if (typeof client.config.tls.trustedConnections === "string") {
                            client.config.tls.trustedConnections = [ client.config.tls.trustedConnections ];
                        }
                        client.config.tls.ca = [];
                        for (let i = 0; i < client.config.tls.trustedConnections.length; i++) {
                            client.config.tls.ca.push(fs.readFileSync(client.config.tls.trustedConnections[i]));
                        }
                    }
                    Object.assign(client.config.tls, options);
                    client.socket = tls.connect(client.config.tls);
                }
            }
            client.socket.setEncoding(this.config.encoding);
            client.socket.on("error", (function(err) {
                client.log("\n\n######\nerror: ", err);
                client.publish("error", err);
            }));
            client.socket.on("connect", (function connectionMade() {
                client.publish("connect");
                client.retriesRemaining = client.config.maxRetries;
                client.log("retrying reset");
            }));
            client.socket.on("close", (function connectionClosed() {
                client.log("connection closed", client.id, client.path, client.retriesRemaining, "tries remaining of", client.config.maxRetries);
                if (client.config.stopRetrying || client.retriesRemaining < 1 || client.explicitlyDisconnected) {
                    client.publish("disconnect");
                    client.log(client.config.id, "exceeded connection rety amount of", " or stopRetrying flag set.");
                    client.socket.destroy();
                    client.publish("destroy");
                    client = undefined;
                    return;
                }
                setTimeout(function retryTimeout() {
                    client.retriesRemaining--;
                    client.connect();
                }.bind(null, client), client.config.retry);
                client.publish("disconnect");
            }));
            client.socket.on("data", (function(data) {
                client.log("## received events ##");
                if (client.config.rawBuffer) {
                    client.publish("data", Buffer.from(data, client.config.encoding));
                    if (!client.config.sync) {
                        return;
                    }
                    client.queue.next();
                    return;
                }
                if (!this.ipcBuffer) {
                    this.ipcBuffer = "";
                }
                data = this.ipcBuffer += data;
                if (data.slice(-1) != eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1) {
                    client.log("Messages are large, You may want to consider smaller messages.");
                    return;
                }
                this.ipcBuffer = "";
                const events = eventParser.parse(data);
                const eCount = events.length;
                for (let i = 0; i < eCount; i++) {
                    let message = new Message;
                    message.load(events[i]);
                    client.log("detected event", message.type, message.data);
                    client.publish(message.type, message.data);
                }
                if (!client.config.sync) {
                    return;
                }
                client.queue.next();
            }));
        }
        module.exports = Client;
    }, module => {
        "use strict";
        module.exports = require("net");
    }, module => {
        "use strict";
        module.exports = require("tls");
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const Defaults = __webpack_require__(261);
        class Parser {
            constructor(config) {
                if (!config) {
                    config = new Defaults;
                }
                this.delimiter = config.delimiter;
            }
            format(message) {
                if (!message.data && message.data !== false && message.data !== 0) {
                    message.data = {};
                }
                if (message.data["_maxListeners"]) {
                    message.data = {};
                }
                message = message.JSON + this.delimiter;
                return message;
            }
            parse(data) {
                let events = data.split(this.delimiter);
                events.pop();
                return events;
            }
        }
        module.exports = Parser;
    }, module => {
        function Message() {
            Object.defineProperties(this, {
                data: {
                    enumerable: true,
                    get: getData,
                    set: setData
                },
                type: {
                    enumerable: true,
                    get: getType,
                    set: setType
                },
                load: {
                    enumerable: true,
                    writable: false,
                    value: parse
                },
                JSON: {
                    enumerable: true,
                    get: getJSON
                }
            });
            var type = "";
            var data = {};
            function getType() {
                return type;
            }
            function getData() {
                return data;
            }
            function getJSON() {
                return JSON.stringify({
                    type,
                    data
                });
            }
            function setType(value) {
                type = value;
            }
            function setData(value) {
                data = value;
            }
            function parse(message) {
                try {
                    var message = JSON.parse(message);
                    type = message.type;
                    data = message.data;
                } catch (err) {
                    var badMessage = message;
                    type = "error", data = {
                        message: "Invalid JSON response format",
                        err,
                        response: badMessage
                    };
                }
            }
        }
        module.exports = Message;
    }, module => {
        function Queue(asStack) {
            Object.defineProperties(this, {
                add: {
                    enumerable: true,
                    writable: false,
                    value: addToQueue
                },
                next: {
                    enumerable: true,
                    writable: false,
                    value: run
                },
                clear: {
                    enumerable: true,
                    writable: false,
                    value: clearQueue
                },
                contents: {
                    enumerable: false,
                    get: getQueue,
                    set: setQueue
                },
                autoRun: {
                    enumerable: true,
                    writable: true,
                    value: true
                },
                stop: {
                    enumerable: true,
                    writable: true,
                    value: false
                }
            });
            var queue = [];
            var running = false;
            var stop = false;
            function clearQueue() {
                queue = [];
                return queue;
            }
            function getQueue() {
                return queue;
            }
            function setQueue(val) {
                queue = val;
                return queue;
            }
            function addToQueue() {
                for (var i in arguments) {
                    queue.push(arguments[i]);
                }
                if (!running && !this.stop && this.autoRun) {
                    this.next();
                }
            }
            function run() {
                running = true;
                if (queue.length < 1 || this.stop) {
                    running = false;
                    return;
                }
                queue.shift().bind(this)();
            }
        }
        module.exports = Queue;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        let EventPubSub = __webpack_require__(269);
        if (process.version[1] > 5) {
            EventPubSub = __webpack_require__(270);
        }
        module.exports = EventPubSub;
    }, module => {
        "use strict";
        function EventPubSub() {
            this._events_ = {};
            this.publish = this.trigger = this.emit = emit;
            this.subscribe = this.on = on;
            this.once = once;
            this.unSubscribe = this.off = off;
            this.emit$ = emit$;
            function on(type, handler, once) {
                if (!handler) {
                    throw new ReferenceError("handler not defined.");
                }
                if (!this._events_[type]) {
                    this._events_[type] = [];
                }
                if (once) {
                    handler._once_ = once;
                }
                this._events_[type].push(handler);
                return this;
            }
            function once(type, handler) {
                return this.on(type, handler, true);
            }
            function off(type, handler) {
                if (!this._events_[type]) {
                    return this;
                }
                if (!handler) {
                    throw new ReferenceError('handler not defined. if you wish to remove all handlers from the event please pass "*" as the handler');
                }
                if (handler == "*") {
                    delete this._events_[type];
                    return this;
                }
                var handlers = this._events_[type];
                while (handlers.includes(handler)) {
                    handlers.splice(handlers.indexOf(handler), 1);
                }
                if (handlers.length < 1) {
                    delete this._events_[type];
                }
                return this;
            }
            function emit(type) {
                this.emit$.apply(this, arguments);
                if (!this._events_[type]) {
                    return this;
                }
                arguments.splice = Array.prototype.splice;
                arguments.splice(0, 1);
                var handlers = this._events_[type];
                var onceHandled = [];
                for (var i in handlers) {
                    var handler = handlers[i];
                    handler.apply(this, arguments);
                    if (handler._once_) {
                        onceHandled.push(handler);
                    }
                }
                for (var i in onceHandled) {
                    this.off(type, onceHandled[i]);
                }
                return this;
            }
            function emit$(type, args) {
                if (!this._events_["*"]) {
                    return this;
                }
                var catchAll = this._events_["*"];
                args.shift = Array.prototype.shift;
                args.shift(type);
                for (var handler of catchAll) {
                    handler.apply(this, args);
                }
                return this;
            }
            return this;
        }
        if (!Array.prototype.includes) {
            Array.prototype.includes = function(searchElement) {
                "use strict";
                if (this == null) {
                    throw new TypeError("Array.prototype.includes called on null or undefined");
                }
                var O = Object(this);
                var len = parseInt(O.length, 10) || 0;
                if (len === 0) {
                    return false;
                }
                var n = parseInt(arguments[1], 10) || 0;
                var k;
                if (n >= 0) {
                    k = n;
                } else {
                    k = len + n;
                    if (k < 0) {
                        k = 0;
                    }
                }
                var currentElement;
                while (k < len) {
                    currentElement = O[k];
                    if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {
                        return true;
                    }
                    k++;
                }
                return false;
            };
        }
        module.exports = EventPubSub;
    }, module => {
        "use strict";
        class EventPubSub {
            constructor(scope) {
                this._events_ = {};
                this.publish = this.trigger = this.emit;
                this.subscribe = this.on;
                this.unSubscribe = this.off;
            }
            on(type, handler, once) {
                if (!handler) {
                    throw new ReferenceError("handler not defined.");
                }
                if (!this._events_[type]) {
                    this._events_[type] = [];
                }
                if (once) {
                    handler._once_ = once;
                }
                this._events_[type].push(handler);
                return this;
            }
            once(type, handler) {
                return this.on(type, handler, true);
            }
            off(type, handler) {
                if (!this._events_[type]) {
                    return this;
                }
                if (!handler) {
                    throw new ReferenceError('handler not defined. if you wish to remove all handlers from the event please pass "*" as the handler');
                }
                if (handler == "*") {
                    delete this._events_[type];
                    return this;
                }
                const handlers = this._events_[type];
                while (handlers.includes(handler)) {
                    handlers.splice(handlers.indexOf(handler), 1);
                }
                if (handlers.length < 1) {
                    delete this._events_[type];
                }
                return this;
            }
            emit(type, ...args) {
                if (!this._events_[type]) {
                    return this.emit$(type, ...args);
                }
                const handlers = this._events_[type];
                const onceHandled = [];
                for (let handler of handlers) {
                    handler.apply(this, args);
                    if (handler._once_) {
                        onceHandled.push(handler);
                    }
                }
                for (let handler of onceHandled) {
                    this.off(type, handler);
                }
                return this.emit$(type, ...args);
            }
            emit$(type, ...args) {
                if (!this._events_["*"]) {
                    return this;
                }
                const catchAll = this._events_["*"];
                for (let handler of catchAll) {
                    handler.call(this, type, ...args);
                }
                return this;
            }
        }
        module.exports = EventPubSub;
    }, (module, __unused_webpack_exports, __webpack_require__) => {
        "use strict";
        const net = __webpack_require__(263), tls = __webpack_require__(264), fs = __webpack_require__(5), dgram = __webpack_require__(272), EventParser = __webpack_require__(265), Message = __webpack_require__(266), Events = __webpack_require__(268);
        let eventParser = new EventParser;
        class Server extends Events {
            constructor(path, config, log, port) {
                super();
                Object.assign(this, {
                    config,
                    path,
                    port,
                    udp4: false,
                    udp6: false,
                    log,
                    server: false,
                    sockets: [],
                    emit,
                    broadcast
                });
                eventParser = new EventParser(this.config);
                this.on("close", serverClosed.bind(this));
            }
            onStart(socket) {
                this.trigger("start", socket);
            }
            stop() {
                this.server.close();
            }
            start() {
                if (!this.path) {
                    this.log("Socket Server Path not specified, refusing to start");
                    return;
                }
                if (this.config.unlink) {
                    fs.unlink(this.path, startServer.bind(this));
                } else {
                    startServer.bind(this)();
                }
            }
        }
        function emit(socket, type, data) {
            this.log("dispatching event to socket", " : ", type, data);
            let message = new Message;
            message.type = type;
            message.data = data;
            if (this.config.rawBuffer) {
                this.log(this.config.encoding);
                message = Buffer.from(type, this.config.encoding);
            } else {
                message = eventParser.format(message);
            }
            if (this.udp4 || this.udp6) {
                if (!socket.address || !socket.port) {
                    this.log("Attempting to emit to a single UDP socket without supplying socket address or port. Redispatching event as broadcast to all connected sockets");
                    this.broadcast(type, data);
                    return;
                }
                this.server.write(message, socket);
                return;
            }
            socket.write(message);
        }
        function broadcast(type, data) {
            this.log("broadcasting event to all known sockets listening to ", this.path, " : ", this.port ? this.port : "", type, data);
            let message = new Message;
            message.type = type;
            message.data = data;
            if (this.config.rawBuffer) {
                message = Buffer.from(type, this.config.encoding);
            } else {
                message = eventParser.format(message);
            }
            if (this.udp4 || this.udp6) {
                for (let i = 1, count = this.sockets.length; i < count; i++) {
                    this.server.write(message, this.sockets[i]);
                }
            } else {
                for (let i = 0, count = this.sockets.length; i < count; i++) {
                    this.sockets[i].write(message);
                }
            }
        }
        function serverClosed() {
            for (let i = 0, count = this.sockets.length; i < count; i++) {
                let socket = this.sockets[i];
                let destroyedSocketId = false;
                if (socket) {
                    if (socket.readable) {
                        continue;
                    }
                }
                if (socket.id) {
                    destroyedSocketId = socket.id;
                }
                this.log("socket disconnected", destroyedSocketId.toString());
                if (socket && socket.destroy) {
                    socket.destroy();
                }
                this.sockets.splice(i, 1);
                this.publish("socket.disconnected", socket, destroyedSocketId);
                return;
            }
        }
        function gotData(socket, data, UDPSocket) {
            let sock = this.udp4 || this.udp6 ? UDPSocket : socket;
            if (this.config.rawBuffer) {
                data = Buffer.from(data, this.config.encoding);
                this.publish("data", data, sock);
                return;
            }
            if (!sock.ipcBuffer) {
                sock.ipcBuffer = "";
            }
            data = sock.ipcBuffer += data;
            if (data.slice(-1) != eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1) {
                this.log("Messages are large, You may want to consider smaller messages.");
                return;
            }
            sock.ipcBuffer = "";
            data = eventParser.parse(data);
            while (data.length > 0) {
                let message = new Message;
                message.load(data.shift());
                if (message.data && message.data.id) {
                    sock.id = message.data.id;
                }
                this.log("received event of : ", message.type, message.data);
                this.publish(message.type, message.data, sock);
            }
        }
        function socketClosed(socket) {
            this.publish("close", socket);
        }
        function serverCreated(socket) {
            this.sockets.push(socket);
            if (socket.setEncoding) {
                socket.setEncoding(this.config.encoding);
            }
            this.log("## socket connection to server detected ##");
            socket.on("close", socketClosed.bind(this));
            socket.on("error", function(err) {
                this.log("server socket error", err);
                this.publish("error", err);
            }.bind(this));
            socket.on("data", gotData.bind(this, socket));
            socket.on("message", function(msg, rinfo) {
                if (!rinfo) {
                    return;
                }
                this.log("Received UDP message from ", rinfo.address, rinfo.port);
                let data;
                if (this.config.rawSocket) {
                    data = Buffer.from(msg, this.config.encoding);
                } else {
                    data = msg.toString();
                }
                socket.emit("data", data, rinfo);
            }.bind(this));
            this.publish("connect", socket);
            if (this.config.rawBuffer) {
                return;
            }
        }
        function startServer() {
            this.log("starting server on ", this.path, this.port ? `:${this.port}` : "");
            if (!this.udp4 && !this.udp6) {
                this.log("starting TLS server", this.config.tls);
                if (!this.config.tls) {
                    this.server = net.createServer(serverCreated.bind(this));
                } else {
                    startTLSServer.bind(this)();
                }
            } else {
                this.server = dgram.createSocket(this.udp4 ? "udp4" : "udp6");
                this.server.write = UDPWrite.bind(this);
                this.server.on("listening", function UDPServerStarted() {
                    serverCreated.bind(this)(this.server);
                }.bind(this));
            }
            this.server.on("error", function(err) {
                this.log("server error", err);
                this.publish("error", err);
            }.bind(this));
            this.server.maxConnections = this.config.maxConnections;
            if (!this.port) {
                this.log("starting server as", "Unix || Windows Socket");
                if (process.platform === "win32") {
                    this.path = this.path.replace(/^\//, "");
                    this.path = this.path.replace(/\//g, "-");
                    this.path = `\\\\.\\pipe\\${this.path}`;
                }
                this.server.listen(this.path, this.onStart.bind(this));
                return;
            }
            if (!this.udp4 && !this.udp6) {
                this.log("starting server as", this.config.tls ? "TLS" : "TCP");
                this.server.listen(this.port, this.path, this.onStart.bind(this));
                return;
            }
            this.log("starting server as", this.udp4 ? "udp4" : "udp6");
            this.server.bind(this.port, this.path);
            this.onStart({
                address: this.path,
                port: this.port
            });
        }
        function startTLSServer() {
            this.log("starting TLS server", this.config.tls);
            if (this.config.tls.private) {
                this.config.tls.key = fs.readFileSync(this.config.tls.private);
            } else {
                this.config.tls.key = fs.readFileSync(`${__dirname}/../local-node-ipc-certs/private/server.key`);
            }
            if (this.config.tls.public) {
                this.config.tls.cert = fs.readFileSync(this.config.tls.public);
            } else {
                this.config.tls.cert = fs.readFileSync(`${__dirname}/../local-node-ipc-certs/server.pub`);
            }
            if (this.config.tls.dhparam) {
                this.config.tls.dhparam = fs.readFileSync(this.config.tls.dhparam);
            }
            if (this.config.tls.trustedConnections) {
                if (typeof this.config.tls.trustedConnections === "string") {
                    this.config.tls.trustedConnections = [ this.config.tls.trustedConnections ];
                }
                this.config.tls.ca = [];
                for (let i = 0; i < this.config.tls.trustedConnections.length; i++) {
                    this.config.tls.ca.push(fs.readFileSync(this.config.tls.trustedConnections[i]));
                }
            }
            this.server = tls.createServer(this.config.tls, serverCreated.bind(this));
        }
        function UDPWrite(message, socket) {
            let data = Buffer.from(message, this.config.encoding);
            this.server.send(data, 0, data.length, socket.port, socket.address, (function(err, bytes) {
                if (err) {
                    this.log("error writing data to socket", err);
                    this.publish("error", (function(err) {
                        this.publish("error", err);
                    }));
                }
            }));
        }
        module.exports = Server;
    }, module => {
        "use strict";
        module.exports = require("dgram");
    } ];
    var __webpack_module_cache__ = {};
    function __webpack_require__(moduleId) {
        if (__webpack_module_cache__[moduleId]) {
            return __webpack_module_cache__[moduleId].exports;
        }
        var module = __webpack_module_cache__[moduleId] = {
            id: moduleId,
            loaded: false,
            exports: {}
        };
        __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
        module.loaded = true;
        return module.exports;
    }
    (() => {
        __webpack_require__.d = (exports, definition) => {
            for (var key in definition) {
                if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
                    Object.defineProperty(exports, key, {
                        enumerable: true,
                        get: definition[key]
                    });
                }
            }
        };
    })();
    (() => {
        __webpack_require__.hmd = module => {
            module = Object.create(module);
            if (!module.children) module.children = [];
            Object.defineProperty(module, "exports", {
                enumerable: true,
                set: () => {
                    throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: " + module.id);
                }
            });
            return module;
        };
    })();
    (() => {
        __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
    })();
    (() => {
        __webpack_require__.r = exports => {
            if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
                Object.defineProperty(exports, Symbol.toStringTag, {
                    value: "Module"
                });
            }
            Object.defineProperty(exports, "__esModule", {
                value: true
            });
        };
    })();
    var __webpack_exports__ = {};
    (() => {
        "use strict";
        var source_destination = __webpack_require__(1);
        var multi_write = __webpack_require__(258);
        var tmp = __webpack_require__(32);
        var node_ipc = __webpack_require__(259);
        var external_os_ = __webpack_require__(6);
        const HUMAN_FRIENDLY = {
            ENOENT: {
                title: error => `No such file or directory: ${error.path}`,
                description: () => "The file you're trying to access doesn't exist"
            },
            EPERM: {
                title: () => "You're not authorized to perform this operation",
                description: () => "Please ensure you have necessary permissions for this task"
            },
            EACCES: {
                title: () => "You don't have access to this resource",
                description: () => "Please ensure you have necessary permissions to access this resource"
            },
            ENOMEM: {
                title: () => "Your system ran out of memory",
                description: () => "Please make sure your system has enough available memory for this task"
            }
        };
        function getUserFriendlyMessageProperty(error, property) {
            var _a, _b;
            if (typeof error.code !== "string") {
                return undefined;
            }
            return (_b = (_a = HUMAN_FRIENDLY[error.code]) === null || _a === void 0 ? void 0 : _a[property]) === null || _b === void 0 ? void 0 : _b.call(_a, error);
        }
        function isBlank(s) {
            if (typeof s === "number") {
                s = s.toString();
            }
            return (s !== null && s !== void 0 ? s : "").trim() === "";
        }
        function getTitle(error) {
            const codeTitle = getUserFriendlyMessageProperty(error, "title");
            if (codeTitle !== undefined) {
                return codeTitle;
            }
            const message = error.message;
            if (!isBlank(message)) {
                return message;
            }
            const code = error.code;
            if (!isBlank(code)) {
                return `Error code: ${code}`;
            }
            return "An error ocurred";
        }
        function getDescription(error) {
            if (!isBlank(error.description)) {
                return error.description;
            }
            const codeDescription = getUserFriendlyMessageProperty(error, "description");
            if (codeDescription !== undefined) {
                return codeDescription;
            }
            if (error.stack) {
                return error.stack;
            }
            return JSON.stringify(error, null, 2);
        }
        function createError(options) {
            if (isBlank(options.title)) {
                throw new Error(`Invalid error title: ${options.title}`);
            }
            const error = new Error(options.title);
            error.description = options.description;
            if (options.report === false) {
                error.report = false;
            }
            if (options.code !== undefined) {
                error.code = options.code;
            }
            return error;
        }
        function createUserError(options) {
            return createError({
                title: options.title,
                description: options.description,
                report: false,
                code: options.code
            });
        }
        function toJSON(error) {
            return {
                name: error.name,
                message: error.message,
                description: error.description,
                stack: error.stack,
                report: error.report,
                code: error.code,
                syscall: error.syscall,
                errno: error.errno,
                stdout: error.stdout,
                stderr: error.stderr,
                device: error.device
            };
        }
        function fromJSON(json) {
            return Object.assign(new Error(json.message), json);
        }
        const SUCCESS = 0;
        const GENERAL_ERROR = 1;
        const VALIDATION_ERROR = 2;
        const CANCELLED = 3;
        var node_modules_axios = __webpack_require__(146);
        var external_electron_ = __webpack_require__(46);
        function isValidPercentage(percentage) {
            return typeof percentage === "number" && percentage >= 0 && percentage <= 100;
        }
        function percentageToFloat(percentage) {
            if (!isValidPercentage(percentage)) {
                throw errors.createError({
                    title: `Invalid percentage: ${percentage}`
                });
            }
            return percentage / 100;
        }
        async function getConfig(configUrl) {
            configUrl = configUrl !== null && configUrl !== void 0 ? configUrl : "https://balena.io/etcher/static/config.json";
            const response = await axios.get(configUrl, {
                responseType: "json"
            });
            return response.data;
        }
        async function delay(duration) {
            await new Promise((resolve => {
                setTimeout(resolve, duration);
            }));
        }
        function getAppPath() {
            return (app || remote.app).getAppPath().replace(/\.asar$/, (() => process.platform === "darwin" ? "-" + process.arch : ""));
        }
        node_ipc.config.id = process.env.IPC_CLIENT_ID;
        node_ipc.config.socketRoot = process.env.IPC_SOCKET_ROOT;
        node_ipc.config.silent = true;
        node_ipc.config.stopRetrying = 0;
        const DISCONNECT_DELAY = 100;
        const IPC_SERVER_ID = process.env.IPC_SERVER_ID;
        function log(message) {
            node_ipc.of[IPC_SERVER_ID].emit("log", message);
        }
        async function terminate(exitCode) {
            node_ipc.disconnect(IPC_SERVER_ID);
            await (0, tmp.cleanupTmpFiles)(Date.now(), multi_write.dk);
            process.nextTick((() => {
                process.exit(exitCode || SUCCESS);
            }));
        }
        async function handleError(error) {
            node_ipc.of[IPC_SERVER_ID].emit("error", toJSON(error));
            await delay(DISCONNECT_DELAY);
            await terminate(GENERAL_ERROR);
        }
        async function writeAndValidate({source, destinations, verify, autoBlockmapping, decompressFirst, onProgress, onFail}) {
            const {sourceMetadata, failures, bytesWritten} = await (0, multi_write.Ri)({
                source,
                destinations,
                onFail,
                onProgress,
                verify,
                trim: autoBlockmapping,
                numBuffers: Math.min(2 + (destinations.length - 1) * 32, 256, Math.floor((0, external_os_.totalmem)() / 1024 ** 2 / 8)),
                decompressFirst
            });
            const result = {
                bytesWritten,
                devices: {
                    failed: failures.size,
                    successful: destinations.length - failures.size
                },
                errors: [],
                sourceMetadata
            };
            for (const [destination, error] of failures) {
                const err = error;
                const drive = destination;
                err.device = drive.device;
                err.description = drive.description;
                result.errors.push(err);
            }
            return result;
        }
        node_ipc.connectTo(IPC_SERVER_ID, (() => {
            (0, tmp.cleanupTmpFiles)(Date.now() - 60 * 60 * 1e3);
            process.once("uncaughtException", handleError);
            process.once("SIGINT", (async () => {
                await terminate(SUCCESS);
            }));
            process.once("SIGTERM", (async () => {
                await terminate(SUCCESS);
            }));
            node_ipc.of[IPC_SERVER_ID].on("error", (async () => {
                await terminate(SUCCESS);
            }));
            node_ipc.of[IPC_SERVER_ID].on("disconnect", (async () => {
                await terminate(SUCCESS);
            }));
            node_ipc.of[IPC_SERVER_ID].on("write", (async options => {
                const onProgress = state => {
                    node_ipc.of[IPC_SERVER_ID].emit("state", state);
                };
                let exitCode = SUCCESS;
                const onAbort = async () => {
                    log("Abort");
                    node_ipc.of[IPC_SERVER_ID].emit("abort");
                    await delay(DISCONNECT_DELAY);
                    await terminate(exitCode);
                };
                const onSkip = async () => {
                    log("Skip validation");
                    node_ipc.of[IPC_SERVER_ID].emit("skip");
                    await delay(DISCONNECT_DELAY);
                    await terminate(exitCode);
                };
                node_ipc.of[IPC_SERVER_ID].on("cancel", onAbort);
                node_ipc.of[IPC_SERVER_ID].on("skip", onSkip);
                const onFail = (destination, error) => {
                    node_ipc.of[IPC_SERVER_ID].emit("fail", {
                        device: destination.drive,
                        error: toJSON(error)
                    });
                };
                const destinations = options.destinations.map((d => d.device));
                const imagePath = options.image.path;
                log(`Image: ${imagePath}`);
                log(`Devices: ${destinations.join(", ")}`);
                log(`Auto blockmapping: ${options.autoBlockmapping}`);
                log(`Decompress first: ${options.decompressFirst}`);
                const dests = options.destinations.map((destination => new source_destination.BlockDevice({
                    drive: destination,
                    unmountOnSuccess: true,
                    write: true,
                    direct: true
                })));
                const {SourceType} = options;
                try {
                    let source;
                    if (options.image.drive) {
                        source = new source_destination.BlockDevice({
                            drive: options.image.drive,
                            direct: !options.autoBlockmapping
                        });
                    } else {
                        if (SourceType === source_destination.File.name) {
                            source = new source_destination.File({
                                path: imagePath
                            });
                        } else {
                            source = new source_destination.Http({
                                url: imagePath,
                                avoidRandomAccess: true
                            });
                        }
                    }
                    const results = await writeAndValidate({
                        source,
                        destinations: dests,
                        verify: true,
                        autoBlockmapping: options.autoBlockmapping,
                        decompressFirst: options.decompressFirst,
                        onProgress,
                        onFail
                    });
                    log(`Finish: ${results.bytesWritten}`);
                    results.errors = results.errors.map((error => toJSON(error)));
                    node_ipc.of[IPC_SERVER_ID].emit("done", {
                        results
                    });
                    await delay(DISCONNECT_DELAY);
                    await terminate(exitCode);
                } catch (error) {
                    exitCode = GENERAL_ERROR;
                    node_ipc.of[IPC_SERVER_ID].emit("error", toJSON(error));
                }
            }));
            node_ipc.of[IPC_SERVER_ID].on("connect", (() => {
                log(`Successfully connected to IPC server: ${IPC_SERVER_ID}, socket root ${node_ipc.config.socketRoot}`);
                node_ipc.of[IPC_SERVER_ID].emit("ready", {});
            }));
        }));
    })();
})();