1028 lines
40 KiB
JavaScript
1028 lines
40 KiB
JavaScript
var __bare_os_bundle_exports__ = (() => {
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
}) : x)(function(x) {
|
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
});
|
|
var __commonJS = (cb, mod) => function __require2() {
|
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// ../../node_modules/bare-buffer/binding.js
|
|
var require_binding = __commonJS({
|
|
"../../node_modules/bare-buffer/binding.js"(exports, module) {
|
|
module.exports = __require.addon();
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/constants.js
|
|
var require_constants = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/constants.js"(exports, module) {
|
|
var binding = require_binding();
|
|
module.exports = binding.constants;
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/ascii.js
|
|
var require_ascii = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/ascii.js"(exports) {
|
|
var binding = require_binding();
|
|
exports.byteLength = function byteLength(string) {
|
|
return string.length;
|
|
};
|
|
exports.toString = function toString(buffer) {
|
|
const len = buffer.byteLength;
|
|
let result = "";
|
|
for (let i = 0; i < len; i++) {
|
|
result += String.fromCharCode(buffer[i] & 127);
|
|
}
|
|
return result;
|
|
};
|
|
exports.write = function write(buffer, string) {
|
|
const len = buffer.byteLength;
|
|
for (let i = 0; i < len; i++) {
|
|
buffer[i] = string.charCodeAt(i);
|
|
}
|
|
return len;
|
|
};
|
|
exports.validate = function validate(buffer) {
|
|
return binding.validateAscii(buffer.buffer, buffer.byteLength);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/base64.js
|
|
var require_base64 = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/base64.js"(exports) {
|
|
var binding = require_binding();
|
|
exports.byteLength = function byteLength(string) {
|
|
let len = string.length;
|
|
if (string.charCodeAt(len - 1) === 61) len--;
|
|
if (len > 1 && string.charCodeAt(len - 1) === 61) len--;
|
|
return len * 3 >>> 2;
|
|
};
|
|
exports.toString = function toString(buffer) {
|
|
return binding.toStringBase64(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
};
|
|
exports.write = function write(buffer, string) {
|
|
return binding.writeBase64(buffer.buffer, buffer.byteOffset, buffer.byteLength, string);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/base64url.js
|
|
var require_base64url = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/base64url.js"(exports) {
|
|
var binding = require_binding();
|
|
exports.byteLength = function byteLength(string) {
|
|
let len = string.length;
|
|
if (string.charCodeAt(len - 1) === 61) len--;
|
|
if (len > 1 && string.charCodeAt(len - 1) === 61) len--;
|
|
return len * 3 >>> 2;
|
|
};
|
|
exports.toString = function toString(buffer) {
|
|
return binding.toStringBase64URL(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
};
|
|
exports.write = function write(buffer, string) {
|
|
return binding.writeBase64(buffer.buffer, buffer.byteOffset, buffer.byteLength, string);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/hex.js
|
|
var require_hex = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/hex.js"(exports) {
|
|
var binding = require_binding();
|
|
exports.byteLength = function byteLength(string) {
|
|
return string.length >>> 1;
|
|
};
|
|
exports.toString = function toString(buffer) {
|
|
return binding.toStringHex(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
};
|
|
exports.write = function write(buffer, string) {
|
|
return binding.writeHex(buffer.buffer, buffer.byteOffset, buffer.byteLength, string);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/utf8.js
|
|
var require_utf8 = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/utf8.js"(exports) {
|
|
var binding = require_binding();
|
|
exports.byteLength = function byteLength(string) {
|
|
return binding.byteLengthUTF8(string);
|
|
};
|
|
exports.toString = function toString(buffer) {
|
|
return binding.toStringUTF8(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
};
|
|
exports.write = function write(buffer, string) {
|
|
return binding.writeUTF8(buffer.buffer, buffer.byteOffset, buffer.byteLength, string);
|
|
};
|
|
exports.validate = function validate(buffer) {
|
|
return binding.validateUTF8(buffer.buffer, buffer.byteLength);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/utf16le.js
|
|
var require_utf16le = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/utf16le.js"(exports) {
|
|
var binding = require_binding();
|
|
exports.byteLength = function byteLength(string) {
|
|
return string.length * 2;
|
|
};
|
|
exports.toString = function toString(buffer) {
|
|
return binding.toStringUTF16LE(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
};
|
|
exports.write = function write(buffer, string) {
|
|
return binding.writeUTF16LE(buffer.buffer, buffer.byteOffset, buffer.byteLength, string);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/lib/latin1.js
|
|
var require_latin1 = __commonJS({
|
|
"../../node_modules/bare-buffer/lib/latin1.js"(exports) {
|
|
var binding = require_binding();
|
|
exports.byteLength = function byteLength(string) {
|
|
return string.length;
|
|
};
|
|
exports.toString = function toString(buffer) {
|
|
return binding.toStringLatin1(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
};
|
|
exports.write = function write(buffer, string) {
|
|
return binding.writeLatin1(buffer.buffer, buffer.byteOffset, buffer.byteLength, string);
|
|
};
|
|
}
|
|
});
|
|
|
|
// ../../node_modules/bare-buffer/index.js
|
|
var require_bare_buffer = __commonJS({
|
|
"../../node_modules/bare-buffer/index.js"(exports, module) {
|
|
var constants = require_constants();
|
|
var ascii = require_ascii();
|
|
var base64 = require_base64();
|
|
var base64url = require_base64url();
|
|
var hex = require_hex();
|
|
var utf8 = require_utf8();
|
|
var utf16le = require_utf16le();
|
|
var latin1 = require_latin1();
|
|
var binding = require_binding();
|
|
var kind = Symbol.for("bare.buffer.kind");
|
|
var poolSize = 0;
|
|
module.exports = exports = class Buffer3 extends Uint8Array {
|
|
static get [kind]() {
|
|
return 0;
|
|
}
|
|
static get poolSize() {
|
|
return poolSize;
|
|
}
|
|
static set poolSize(value) {
|
|
poolSize = Math.max(0, value);
|
|
}
|
|
constructor(arrayBuffer, offset, length, opts = {}) {
|
|
if (typeof arrayBuffer === "number") {
|
|
opts = offset || {};
|
|
const { uninitialized = false } = opts;
|
|
offset = 0;
|
|
length = arrayBuffer;
|
|
if (length > constants.MAX_LENGTH) {
|
|
throw new RangeError(`Buffer length must be at most ${constants.MAX_LENGTH}`);
|
|
}
|
|
arrayBuffer = uninitialized ? binding.allocUnsafe(length) : binding.alloc(length);
|
|
} else {
|
|
if (length > constants.MAX_LENGTH) {
|
|
throw new RangeError(`Buffer length must be at most ${constants.MAX_LENGTH}`);
|
|
}
|
|
if (typeof offset === "object" && offset !== null) {
|
|
opts = offset;
|
|
offset = 0;
|
|
length = arrayBuffer.byteLength;
|
|
} else if (typeof length === "length" && length !== null) {
|
|
opts = length;
|
|
length = arrayBuffer.byteLength - offset;
|
|
}
|
|
}
|
|
super(arrayBuffer, offset, length);
|
|
}
|
|
get [kind]() {
|
|
return Buffer3[kind];
|
|
}
|
|
copy(target, targetStart = 0, sourceStart = 0, sourceEnd = this.byteLength) {
|
|
let source = this;
|
|
if (targetStart < 0) targetStart = 0;
|
|
if (targetStart >= target.byteLength) return 0;
|
|
const targetLength = target.byteLength - targetStart;
|
|
if (sourceStart < 0) sourceStart = 0;
|
|
if (sourceStart >= source.byteLength) return 0;
|
|
if (sourceEnd <= sourceStart) return 0;
|
|
if (sourceEnd > source.byteLength) sourceEnd = source.byteLength;
|
|
if (sourceEnd - sourceStart > targetLength) {
|
|
sourceEnd = sourceStart + targetLength;
|
|
}
|
|
const sourceLength = sourceEnd - sourceStart;
|
|
if (source === target) {
|
|
target.copyWithin(targetStart, sourceStart, sourceEnd);
|
|
} else {
|
|
if (sourceStart !== 0 || sourceEnd !== source.byteLength) {
|
|
source = source.subarray(sourceStart, sourceEnd);
|
|
}
|
|
target.set(source, targetStart);
|
|
}
|
|
return sourceLength;
|
|
}
|
|
equals(target) {
|
|
const source = this;
|
|
if (source === target) return true;
|
|
if (source.byteLength !== target.byteLength) return false;
|
|
return binding.compare(
|
|
source.buffer,
|
|
source.byteOffset,
|
|
source.byteLength,
|
|
target.buffer,
|
|
target.byteOffset,
|
|
target.byteLength
|
|
) === 0;
|
|
}
|
|
compare(target, targetStart = 0, targetEnd = target.byteLength, sourceStart = 0, sourceEnd = this.byteLength) {
|
|
let source = this;
|
|
if (source === target) return 0;
|
|
if (arguments.length > 1) {
|
|
if (targetStart < 0) targetStart = 0;
|
|
if (targetStart > target.byteLength) targetStart = target.byteLength;
|
|
if (targetEnd < targetStart) targetEnd = targetStart;
|
|
if (targetEnd > target.byteLength) targetEnd = target.byteLength;
|
|
if (sourceStart < 0) sourceStart = 0;
|
|
if (sourceStart > source.byteLength) sourceStart = source.byteLength;
|
|
if (sourceEnd < sourceStart) sourceEnd = sourceStart;
|
|
if (sourceEnd > source.byteLength) sourceEnd = source.byteLength;
|
|
if (sourceStart !== 0 || sourceEnd !== source.byteLength) {
|
|
source = source.subarray(sourceStart, sourceEnd);
|
|
}
|
|
if (targetStart !== 0 || targetEnd !== target.byteLength) {
|
|
target = target.subarray(targetStart, targetEnd);
|
|
}
|
|
}
|
|
return binding.compare(
|
|
source.buffer,
|
|
source.byteOffset,
|
|
source.byteLength,
|
|
target.buffer,
|
|
target.byteOffset,
|
|
target.byteLength
|
|
);
|
|
}
|
|
fill(value, offset = 0, end = this.byteLength, encoding = "utf8") {
|
|
if (typeof value === "string") {
|
|
if (typeof offset === "string") {
|
|
encoding = offset;
|
|
offset = 0;
|
|
end = this.byteLength;
|
|
} else if (typeof end === "string") {
|
|
encoding = end;
|
|
end = this.byteLength;
|
|
}
|
|
} else if (typeof value === "number") {
|
|
value = value & 255;
|
|
} else if (typeof value === "boolean") {
|
|
value = +value;
|
|
}
|
|
if (offset < 0) offset = 0;
|
|
if (offset >= this.byteLength) return this;
|
|
if (end <= offset) return this;
|
|
if (end > this.byteLength) end = this.byteLength;
|
|
if (typeof value === "number") return super.fill(value, offset, end);
|
|
if (typeof value === "string") value = exports.from(value, encoding);
|
|
const length = value.byteLength;
|
|
for (let i = 0, n = end - offset; i < n; ++i) {
|
|
this[i + offset] = value[i % length];
|
|
}
|
|
return this;
|
|
}
|
|
includes(value, offset, encoding) {
|
|
return this.indexOf(value, offset, encoding) !== -1;
|
|
}
|
|
indexOf(value, offset = 0, encoding) {
|
|
if (typeof value === "boolean") value = +value;
|
|
if (typeof value === "number") {
|
|
return super.indexOf(value & 255, offset);
|
|
}
|
|
return bidirectionalIndexOf(
|
|
this,
|
|
value,
|
|
offset,
|
|
encoding,
|
|
true
|
|
/* first */
|
|
);
|
|
}
|
|
lastIndexOf(value, offset = this.byteLength - 1, encoding) {
|
|
if (typeof value === "boolean") value = +value;
|
|
if (typeof value === "number") {
|
|
return super.lastIndexOf(value & 255, offset);
|
|
}
|
|
return bidirectionalIndexOf(
|
|
this,
|
|
value,
|
|
offset,
|
|
encoding,
|
|
false
|
|
/* last */
|
|
);
|
|
}
|
|
swap16() {
|
|
const length = this.byteLength;
|
|
if (length % 2 !== 0) {
|
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
}
|
|
for (let i = 0; i < length; i += 2) swap(this, i, i + 1);
|
|
return this;
|
|
}
|
|
swap32() {
|
|
const length = this.byteLength;
|
|
if (length % 4 !== 0) {
|
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
}
|
|
for (let i = 0; i < length; i += 4) {
|
|
swap(this, i, i + 3);
|
|
swap(this, i + 1, i + 2);
|
|
}
|
|
return this;
|
|
}
|
|
swap64() {
|
|
const length = this.byteLength;
|
|
if (length % 8 !== 0) {
|
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
}
|
|
for (let i = 0; i < length; i += 8) {
|
|
swap(this, i, i + 7);
|
|
swap(this, i + 1, i + 6);
|
|
swap(this, i + 2, i + 5);
|
|
swap(this, i + 3, i + 4);
|
|
}
|
|
return this;
|
|
}
|
|
toString(encoding = "utf8", start = 0, end = this.byteLength) {
|
|
if (arguments.length === 0) return utf8.toString(this);
|
|
if (arguments.length === 1) return codecFor(encoding).toString(this);
|
|
if (start < 0) start = 0;
|
|
if (start >= this.byteLength) return "";
|
|
if (end <= start) return "";
|
|
if (end > this.byteLength) end = this.byteLength;
|
|
let buffer = this;
|
|
if (start !== 0 || end !== this.byteLength) {
|
|
buffer = buffer.subarray(start, end);
|
|
}
|
|
return codecFor(encoding).toString(buffer);
|
|
}
|
|
toJSON() {
|
|
return Array.from(this);
|
|
}
|
|
write(string, offset = 0, length = this.byteLength - offset, encoding = "utf8") {
|
|
if (arguments.length === 1) return utf8.write(this, string);
|
|
if (typeof offset === "string") {
|
|
encoding = offset;
|
|
offset = 0;
|
|
length = this.byteLength;
|
|
} else if (typeof length === "string") {
|
|
encoding = length;
|
|
length = this.byteLength - offset;
|
|
}
|
|
length = Math.min(length, exports.byteLength(string, encoding));
|
|
let start = offset;
|
|
if (start < 0) start = 0;
|
|
if (start >= this.byteLength) return 0;
|
|
let end = offset + length;
|
|
if (end <= start) return 0;
|
|
if (end > this.byteLength) end = this.byteLength;
|
|
let buffer = this;
|
|
if (start !== 0 || end !== this.byteLength) {
|
|
buffer = buffer.subarray(start, end);
|
|
}
|
|
return codecFor(encoding).write(buffer, string);
|
|
}
|
|
readBigInt64BE(offset = 0) {
|
|
return viewOf(this).getBigInt64(offset, false);
|
|
}
|
|
readBigInt64LE(offset = 0) {
|
|
return viewOf(this).getBigInt64(offset, true);
|
|
}
|
|
readBigUint64BE(offset = 0) {
|
|
return viewOf(this).getBigUint64(offset, false);
|
|
}
|
|
readBigUint64LE(offset = 0) {
|
|
return viewOf(this).getBigUint64(offset, true);
|
|
}
|
|
readDoubleBE(offset = 0) {
|
|
return viewOf(this).getFloat64(offset, false);
|
|
}
|
|
readDoubleLE(offset = 0) {
|
|
return viewOf(this).getFloat64(offset, true);
|
|
}
|
|
readFloatBE(offset = 0) {
|
|
return viewOf(this).getFloat32(offset, false);
|
|
}
|
|
readFloatLE(offset = 0) {
|
|
return viewOf(this).getFloat32(offset, true);
|
|
}
|
|
readInt8(offset = 0) {
|
|
return viewOf(this).getInt8(offset);
|
|
}
|
|
readInt16BE(offset = 0) {
|
|
return viewOf(this).getInt16(offset, false);
|
|
}
|
|
readInt16LE(offset = 0) {
|
|
return viewOf(this).getInt16(offset, true);
|
|
}
|
|
readInt32BE(offset = 0) {
|
|
return viewOf(this).getInt32(offset, false);
|
|
}
|
|
readInt32LE(offset = 0) {
|
|
return viewOf(this).getInt32(offset, true);
|
|
}
|
|
readIntBE(offset, byteLength) {
|
|
if (byteLength === 6) return readInt48BE(viewOf(this), offset);
|
|
if (byteLength === 5) return readInt40BE(viewOf(this), offset);
|
|
if (byteLength === 3) return readInt24BE(viewOf(this), offset);
|
|
if (byteLength === 4) return this.readInt32BE(offset);
|
|
if (byteLength === 2) return this.readInt16BE(offset);
|
|
if (byteLength === 1) return this.readInt8(offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
readIntLE(offset, byteLength) {
|
|
if (byteLength === 6) return readInt48LE(viewOf(this), offset);
|
|
if (byteLength === 5) return readInt40LE(viewOf(this), offset);
|
|
if (byteLength === 3) return readInt24LE(viewOf(this), offset);
|
|
if (byteLength === 4) return this.readInt32LE(offset);
|
|
if (byteLength === 2) return this.readInt16LE(offset);
|
|
if (byteLength === 1) return this.readInt8(offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
readUint8(offset = 0) {
|
|
return viewOf(this).getUint8(offset);
|
|
}
|
|
readUint16BE(offset = 0) {
|
|
return viewOf(this).getUint16(offset, false);
|
|
}
|
|
readUint16LE(offset = 0) {
|
|
return viewOf(this).getUint16(offset, true);
|
|
}
|
|
readUint32BE(offset = 0) {
|
|
return viewOf(this).getUint32(offset, false);
|
|
}
|
|
readUint32LE(offset = 0) {
|
|
return viewOf(this).getUint32(offset, true);
|
|
}
|
|
readUintBE(offset, byteLength) {
|
|
if (byteLength === 6) return readUint48BE(viewOf(this), offset);
|
|
if (byteLength === 5) return readUint40BE(viewOf(this), offset);
|
|
if (byteLength === 3) return readUint24BE(viewOf(this), offset);
|
|
if (byteLength === 4) return this.readUint32BE(offset);
|
|
if (byteLength === 2) return this.readUint16BE(offset);
|
|
if (byteLength === 1) return this.readUint8(offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
readUintLE(offset, byteLength) {
|
|
if (byteLength === 6) return readUint48LE(viewOf(this), offset);
|
|
if (byteLength === 5) return readUint40LE(viewOf(this), offset);
|
|
if (byteLength === 3) return readUint24LE(viewOf(this), offset);
|
|
if (byteLength === 4) return this.readUint32LE(offset);
|
|
if (byteLength === 2) return this.readUint16LE(offset);
|
|
if (byteLength === 1) return this.readUint8(offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
readBigUInt64BE(...args) {
|
|
return this.readBigUint64BE(...args);
|
|
}
|
|
readBigUInt64LE(...args) {
|
|
return this.readBigUint64LE(...args);
|
|
}
|
|
readUInt8(...args) {
|
|
return this.readUint8(...args);
|
|
}
|
|
readUInt16BE(...args) {
|
|
return this.readUint16BE(...args);
|
|
}
|
|
readUInt16LE(...args) {
|
|
return this.readUint16LE(...args);
|
|
}
|
|
readUInt32BE(...args) {
|
|
return this.readUint32BE(...args);
|
|
}
|
|
readUInt32LE(...args) {
|
|
return this.readUint32LE(...args);
|
|
}
|
|
readUIntBE(...args) {
|
|
return this.readUintBE(...args);
|
|
}
|
|
readUIntLE(...args) {
|
|
return this.readUintLE(...args);
|
|
}
|
|
writeBigInt64BE(value, offset = 0) {
|
|
viewOf(this).setBigInt64(offset, value, false);
|
|
return offset + 8;
|
|
}
|
|
writeBigInt64LE(value, offset = 0) {
|
|
viewOf(this).setBigInt64(offset, value, true);
|
|
return offset + 8;
|
|
}
|
|
writeBigUint64BE(value, offset = 0) {
|
|
viewOf(this).setBigUint64(offset, value, false);
|
|
return offset + 8;
|
|
}
|
|
writeBigUint64LE(value, offset = 0) {
|
|
viewOf(this).setBigUint64(offset, value, true);
|
|
return offset + 8;
|
|
}
|
|
writeDoubleBE(value, offset = 0) {
|
|
viewOf(this).setFloat64(offset, value, false);
|
|
return offset + 8;
|
|
}
|
|
writeDoubleLE(value, offset = 0) {
|
|
viewOf(this).setFloat64(offset, value, true);
|
|
return offset + 8;
|
|
}
|
|
writeFloatBE(value, offset = 0) {
|
|
viewOf(this).setFloat32(offset, value, false);
|
|
return offset + 4;
|
|
}
|
|
writeFloatLE(value, offset = 0) {
|
|
viewOf(this).setFloat32(offset, value, true);
|
|
return offset + 4;
|
|
}
|
|
writeInt8(value, offset = 0) {
|
|
viewOf(this).setInt8(offset, value);
|
|
return offset + 1;
|
|
}
|
|
writeInt16BE(value, offset = 0) {
|
|
viewOf(this).setInt16(offset, value, false);
|
|
return offset + 2;
|
|
}
|
|
writeInt16LE(value, offset = 0) {
|
|
viewOf(this).setInt16(offset, value, true);
|
|
return offset + 2;
|
|
}
|
|
writeInt32BE(value, offset = 0) {
|
|
viewOf(this).setInt32(offset, value, false);
|
|
return offset + 4;
|
|
}
|
|
writeInt32LE(value, offset = 0) {
|
|
viewOf(this).setInt32(offset, value, true);
|
|
return offset + 4;
|
|
}
|
|
writeIntBE(value, offset, byteLength) {
|
|
if (byteLength === 6) return writeInt48BE(value, viewOf(this), offset);
|
|
if (byteLength === 5) return writeInt40BE(value, viewOf(this), offset);
|
|
if (byteLength === 3) return writeInt24BE(value, viewOf(this), offset);
|
|
if (byteLength === 4) return this.writeInt32BE(value, offset);
|
|
if (byteLength === 2) return this.writeInt16BE(value, offset);
|
|
if (byteLength === 1) return this.writeInt8(value, offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
writeIntLE(value, offset, byteLength) {
|
|
if (byteLength === 6) return writeInt48LE(value, viewOf(this), offset);
|
|
if (byteLength === 5) return writeInt40LE(value, viewOf(this), offset);
|
|
if (byteLength === 3) return writeInt24LE(value, viewOf(this), offset);
|
|
if (byteLength === 4) return this.writeInt32LE(value, offset);
|
|
if (byteLength === 2) return this.writeInt16LE(value, offset);
|
|
if (byteLength === 1) return this.writeInt8(value, offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
writeUint8(value, offset = 0) {
|
|
viewOf(this).setUint8(offset, value, true);
|
|
return offset + 1;
|
|
}
|
|
writeUint16BE(value, offset = 0) {
|
|
viewOf(this).setUint16(offset, value, false);
|
|
return offset + 2;
|
|
}
|
|
writeUint16LE(value, offset = 0) {
|
|
viewOf(this).setUint16(offset, value, true);
|
|
return offset + 2;
|
|
}
|
|
writeUint32LE(value, offset = 0) {
|
|
viewOf(this).setUint32(offset, value, true);
|
|
return offset + 4;
|
|
}
|
|
writeUint32BE(value, offset = 0) {
|
|
viewOf(this).setUint32(offset, value, false);
|
|
return offset + 4;
|
|
}
|
|
writeUintBE(value, offset, byteLength) {
|
|
if (byteLength === 6) return writeUint48BE(value, viewOf(this), offset);
|
|
if (byteLength === 5) return writeUint40BE(value, viewOf(this), offset);
|
|
if (byteLength === 3) return writeUint24BE(value, viewOf(this), offset);
|
|
if (byteLength === 4) return this.writeUint32BE(value, offset);
|
|
if (byteLength === 2) return this.writeUint16BE(value, offset);
|
|
if (byteLength === 1) return this.writeUint8(value, offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
writeUintLE(value, offset, byteLength) {
|
|
if (byteLength === 6) return writeUint48LE(value, viewOf(this), offset);
|
|
if (byteLength === 5) return writeUint40LE(value, viewOf(this), offset);
|
|
if (byteLength === 3) return writeUint24LE(value, viewOf(this), offset);
|
|
if (byteLength === 4) return this.writeUint32LE(value, offset);
|
|
if (byteLength === 2) return this.writeUint16LE(value, offset);
|
|
if (byteLength === 1) return this.writeUint8(value, offset);
|
|
throw new RangeError(`Byte length must be between 1 and 6`);
|
|
}
|
|
writeBigUInt64BE(...args) {
|
|
return this.writeBigUint64BE(...args);
|
|
}
|
|
writeBigUInt64LE(...args) {
|
|
return this.writeBigUint64LE(...args);
|
|
}
|
|
writeUInt8(...args) {
|
|
return this.writeUint8(...args);
|
|
}
|
|
writeUInt16BE(...args) {
|
|
return this.writeUint16BE(...args);
|
|
}
|
|
writeUInt16LE(...args) {
|
|
return this.writeUint16LE(...args);
|
|
}
|
|
writeUInt32BE(...args) {
|
|
return this.writeUint32BE(...args);
|
|
}
|
|
writeUInt32LE(...args) {
|
|
return this.writeUint32LE(...args);
|
|
}
|
|
writeUIntBE(...args) {
|
|
return this.writeUintBE(...args);
|
|
}
|
|
writeUIntLE(...args) {
|
|
return this.writeUintLE(...args);
|
|
}
|
|
};
|
|
var Buffer2 = exports;
|
|
exports.Buffer = Buffer2;
|
|
exports.constants = constants;
|
|
var codecs = /* @__PURE__ */ Object.create(null);
|
|
codecs.ascii = ascii;
|
|
codecs.base64 = base64;
|
|
codecs.base64url = base64url;
|
|
codecs.hex = hex;
|
|
codecs.utf8 = codecs["utf-8"] = utf8;
|
|
codecs.utf16le = codecs.ucs2 = codecs["utf-16le"] = codecs["ucs-2"] = utf16le;
|
|
codecs.latin1 = codecs.binary = latin1;
|
|
function codecFor(encoding = "utf8") {
|
|
if (encoding in codecs) return codecs[encoding];
|
|
encoding = encoding.toLowerCase();
|
|
if (encoding in codecs) return codecs[encoding];
|
|
throw new Error(`Unknown encoding '${encoding}'`);
|
|
}
|
|
var views = /* @__PURE__ */ new WeakMap();
|
|
function viewOf(buffer) {
|
|
let view = views.get(buffer);
|
|
if (view === void 0) {
|
|
view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
views.set(buffer, view);
|
|
}
|
|
return view;
|
|
}
|
|
exports.isBuffer = function isBuffer(value) {
|
|
if (value instanceof Buffer2) return true;
|
|
return typeof value === "object" && value !== null && value[kind] === Buffer2[kind];
|
|
};
|
|
exports.isEncoding = function isEncoding(encoding) {
|
|
try {
|
|
codecFor(encoding);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
};
|
|
exports.isASCII = function isASCII(buffer) {
|
|
return ascii.validate(buffer);
|
|
};
|
|
exports.isAscii = exports.isASCII;
|
|
exports.isUTF8 = function isUTF8(buffer) {
|
|
return utf8.validate(buffer);
|
|
};
|
|
exports.isUtf8 = exports.isUTF8;
|
|
exports.alloc = function alloc(size, fill, encoding) {
|
|
const buffer = new Buffer2(size);
|
|
if (fill !== void 0) buffer.fill(fill, 0, buffer.byteLength, encoding);
|
|
return buffer;
|
|
};
|
|
exports.allocUnsafe = function allocUnsafe(size) {
|
|
return new Buffer2(size, { uninitialized: true });
|
|
};
|
|
exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
|
|
return exports.allocUnsafe(size);
|
|
};
|
|
exports.byteLength = function byteLength(string, encoding) {
|
|
if (typeof string === "string") {
|
|
return codecFor(encoding).byteLength(string);
|
|
}
|
|
return string.byteLength;
|
|
};
|
|
exports.compare = function compare(a, b) {
|
|
return binding.compare(a.buffer, a.byteOffset, a.byteLength, b.buffer, b.byteOffset, b.byteLength);
|
|
};
|
|
exports.concat = function concat(buffers, length) {
|
|
if (length === void 0) {
|
|
length = buffers.reduce((length2, buffer) => length2 + buffer.byteLength, 0);
|
|
}
|
|
const result = new Buffer2(length);
|
|
for (let i = 0, n = buffers.length, offset = 0; i < n; i++) {
|
|
const buffer = buffers[i];
|
|
if (offset + buffer.byteLength > result.byteLength) {
|
|
result.set(buffer.subarray(0, result.byteLength - offset), offset);
|
|
return result;
|
|
}
|
|
result.set(buffer, offset);
|
|
offset += buffer.byteLength;
|
|
}
|
|
return result;
|
|
};
|
|
exports.coerce = function coerce(buffer) {
|
|
if (exports.isBuffer(buffer)) return buffer;
|
|
return new Buffer2(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
};
|
|
exports.copyBytesFrom = function copyBytesFrom(view, offset = 0, length = view.length - offset) {
|
|
if (offset + length > view.length) {
|
|
throw new RangeError("View length is out of range");
|
|
}
|
|
if (offset !== 0 || length !== view.length) {
|
|
view = view.subarray(offset, offset + length);
|
|
}
|
|
return new Buffer2(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength));
|
|
};
|
|
exports.from = function from(value, encodingOrOffset, length) {
|
|
if (typeof value === "string") return fromString(value, encodingOrOffset);
|
|
if (Array.isArray(value)) return fromArray(value);
|
|
if (ArrayBuffer.isView(value)) return fromBuffer(value);
|
|
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
};
|
|
function fromString(string, encoding) {
|
|
const codec = codecFor(encoding);
|
|
const buffer = new Buffer2(codec.byteLength(string));
|
|
codec.write(buffer, string);
|
|
return buffer;
|
|
}
|
|
function fromArray(array) {
|
|
const buffer = new Buffer2(array.length);
|
|
buffer.set(array);
|
|
return buffer;
|
|
}
|
|
function fromBuffer(buffer) {
|
|
const copy = new Buffer2(buffer.byteLength);
|
|
copy.set(buffer);
|
|
return copy;
|
|
}
|
|
function fromArrayBuffer(arrayBuffer, offset, length) {
|
|
return new Buffer2(arrayBuffer, offset, length);
|
|
}
|
|
function bidirectionalIndexOf(buffer, value, offset, encoding, first) {
|
|
if (buffer.byteLength === 0) return -1;
|
|
if (typeof offset === "string") {
|
|
encoding = offset;
|
|
offset = 0;
|
|
} else if (offset === void 0) {
|
|
offset = first ? 0 : buffer.byteLength - 1;
|
|
} else if (offset < 0) {
|
|
offset += buffer.byteLength;
|
|
}
|
|
if (offset >= buffer.byteLength) {
|
|
if (first) return -1;
|
|
else offset = buffer.byteLength - 1;
|
|
} else if (offset < 0) {
|
|
if (first) offset = 0;
|
|
else return -1;
|
|
}
|
|
if (typeof value === "string") value = exports.from(value, encoding);
|
|
if (value.byteLength === 0) return -1;
|
|
if (first) {
|
|
let foundIndex = -1;
|
|
for (let i = offset; i < buffer.byteLength; i++) {
|
|
if (buffer[i] === value[foundIndex === -1 ? 0 : i - foundIndex]) {
|
|
if (foundIndex === -1) foundIndex = i;
|
|
if (i - foundIndex + 1 === value.byteLength) return foundIndex;
|
|
} else {
|
|
if (foundIndex !== -1) i -= i - foundIndex;
|
|
foundIndex = -1;
|
|
}
|
|
}
|
|
} else {
|
|
if (offset + value.byteLength > buffer.byteLength) {
|
|
offset = buffer.byteLength - value.byteLength;
|
|
}
|
|
for (let i = offset; i >= 0; i--) {
|
|
let found = true;
|
|
for (let j = 0; j < value.byteLength; j++) {
|
|
if (buffer[i + j] !== value[j]) {
|
|
found = false;
|
|
break;
|
|
}
|
|
}
|
|
if (found) return i;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
function swap(buffer, n, m) {
|
|
const i = buffer[n];
|
|
buffer[n] = buffer[m];
|
|
buffer[m] = i;
|
|
}
|
|
exports.atob = function atob(data) {
|
|
return Buffer2.from(data, "base64").toString("latin1");
|
|
};
|
|
exports.btoa = function btoa(data) {
|
|
if (typeof data !== "string") data = String(data);
|
|
return Buffer2.from(data, "latin1").toString("base64");
|
|
};
|
|
exports.transcode = function transcode(buffer, from, to) {
|
|
return Buffer2.from(buffer.toString(from), to);
|
|
};
|
|
function readInt48BE(view, offset) {
|
|
const hi = view.getUint16(offset, false);
|
|
const lo = view.getUint32(offset + 2, false);
|
|
let value = lo + hi * 4294967296;
|
|
if (hi & 32768) value -= 281474976710656;
|
|
return value;
|
|
}
|
|
function readInt48LE(view, offset) {
|
|
const lo = view.getUint32(offset, true);
|
|
const hi = view.getUint16(offset + 4, true);
|
|
let value = lo + hi * 4294967296;
|
|
if (hi & 32768) value -= 281474976710656;
|
|
return value;
|
|
}
|
|
function readInt40BE(view, offset) {
|
|
const hi = view.getUint8(offset);
|
|
const lo = view.getUint32(offset + 1, false);
|
|
let value = lo + hi * 4294967296;
|
|
if (hi & 128) value -= 1099511627776;
|
|
return value;
|
|
}
|
|
function readInt40LE(view, offset) {
|
|
const lo = view.getUint32(offset, true);
|
|
const hi = view.getUint8(offset + 4);
|
|
let value = lo + hi * 4294967296;
|
|
if (hi & 128) value -= 1099511627776;
|
|
return value;
|
|
}
|
|
function readInt24BE(view, offset) {
|
|
const value = view.getUint8(offset) << 16 | view.getUint8(offset + 1) << 8 | view.getUint8(offset + 2);
|
|
return value & 8388608 ? value - 16777216 : value;
|
|
}
|
|
function readInt24LE(view, offset) {
|
|
const value = view.getUint8(offset) | view.getUint8(offset + 1) << 8 | view.getUint8(offset + 2) << 16;
|
|
return value & 8388608 ? value - 16777216 : value;
|
|
}
|
|
function readUint48BE(view, offset) {
|
|
const hi = view.getUint16(offset, false);
|
|
const lo = view.getUint32(offset + 2, false);
|
|
return lo + hi * 4294967296;
|
|
}
|
|
function readUint48LE(view, offset) {
|
|
const lo = view.getUint32(offset, true);
|
|
const hi = view.getUint16(offset + 4, true);
|
|
return lo + hi * 4294967296;
|
|
}
|
|
function readUint40BE(view, offset) {
|
|
const hi = view.getUint8(offset);
|
|
const lo = view.getUint32(offset + 1, false);
|
|
return lo + hi * 4294967296;
|
|
}
|
|
function readUint40LE(view, offset) {
|
|
const lo = view.getUint32(offset, true);
|
|
const hi = view.getUint8(offset + 4);
|
|
return lo + hi * 4294967296;
|
|
}
|
|
function readUint24BE(view, offset) {
|
|
return view.getUint8(offset) << 16 | view.getUint8(offset + 1) << 8 | view.getUint8(offset + 2);
|
|
}
|
|
function readUint24LE(view, offset) {
|
|
return view.getUint8(offset) | view.getUint8(offset + 1) << 8 | view.getUint8(offset + 2) << 16;
|
|
}
|
|
function writeInt48BE(value, view, offset) {
|
|
if (value < 0) value += 281474976710656;
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint16(offset, hi, false);
|
|
view.setUint32(offset + 2, lo, false);
|
|
return offset + 6;
|
|
}
|
|
function writeInt48LE(value, view, offset) {
|
|
if (value < 0) value += 281474976710656;
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint32(offset, lo, true);
|
|
view.setUint16(offset + 4, hi, true);
|
|
return offset + 6;
|
|
}
|
|
function writeInt40BE(value, view, offset) {
|
|
if (value < 0) value += 1099511627776;
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint8(offset, hi);
|
|
view.setUint32(offset + 1, lo, false);
|
|
return offset + 5;
|
|
}
|
|
function writeInt40LE(value, view, offset) {
|
|
if (value < 0) value += 1099511627776;
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint32(offset, lo, true);
|
|
view.setUint8(offset + 4, hi);
|
|
return offset + 5;
|
|
}
|
|
function writeInt24BE(value, view, offset) {
|
|
if (value < 0) value += 16777216;
|
|
view.setUint8(offset, value >> 16 & 255);
|
|
view.setUint8(offset + 1, value >> 8 & 255);
|
|
view.setUint8(offset + 2, value & 255);
|
|
return offset + 3;
|
|
}
|
|
function writeInt24LE(value, view, offset) {
|
|
if (value < 0) value += 16777216;
|
|
view.setUint8(offset, value & 255);
|
|
view.setUint8(offset + 1, value >> 8 & 255);
|
|
view.setUint8(offset + 2, value >> 16 & 255);
|
|
return offset + 3;
|
|
}
|
|
function writeUint48BE(value, view, offset) {
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint16(offset, hi, false);
|
|
view.setUint32(offset + 2, lo, false);
|
|
return offset + 6;
|
|
}
|
|
function writeUint48LE(value, view, offset) {
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint32(offset, lo, true);
|
|
view.setUint16(offset + 4, hi, true);
|
|
return offset + 6;
|
|
}
|
|
function writeUint40BE(value, view, offset) {
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint8(offset, hi);
|
|
view.setUint32(offset + 1, lo, false);
|
|
return offset + 5;
|
|
}
|
|
function writeUint40LE(value, view, offset) {
|
|
const hi = Math.floor(value / 4294967296);
|
|
const lo = value >>> 0;
|
|
view.setUint32(offset, lo, true);
|
|
view.setUint8(offset + 4, hi);
|
|
return offset + 5;
|
|
}
|
|
function writeUint24BE(value, view, offset) {
|
|
view.setUint8(offset, value >> 16 & 255);
|
|
view.setUint8(offset + 1, value >> 8 & 255);
|
|
view.setUint8(offset + 2, value & 255);
|
|
return offset + 3;
|
|
}
|
|
function writeUint24LE(value, view, offset) {
|
|
view.setUint8(offset, value & 255);
|
|
view.setUint8(offset + 1, value >> 8 & 255);
|
|
view.setUint8(offset + 2, value >> 16 & 255);
|
|
return offset + 3;
|
|
}
|
|
}
|
|
});
|
|
|
|
// ../../bare-lib-entry-bareBuffer.js
|
|
var bare_lib_entry_bareBuffer_exports = {};
|
|
__export(bare_lib_entry_bareBuffer_exports, {
|
|
default: () => bare_lib_entry_bareBuffer_default
|
|
});
|
|
var import_bare_buffer = __toESM(require_bare_buffer());
|
|
var bare_lib_entry_bareBuffer_default = import_bare_buffer.default;
|
|
return __toCommonJS(bare_lib_entry_bareBuffer_exports);
|
|
})();
|
|
;(function(){var g=globalThis;var s="__bare_os_stdlib__";g[s]=g[s]||{};var e=typeof __bare_os_bundle_exports__!=="undefined"?__bare_os_bundle_exports__:void 0;var v=e!=null&&typeof e==="object"&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;g[s]["bareBuffer"]=v;})();
|