aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-31 17:55:16 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-31 17:55:16 -0800
commitcc4326cd829decc95d1f1f23998f97705637e04b (patch)
tree9ccaa829b6d48af521d5e5fcdbabc0dac8d186af /src
parentc57b37d29f9d04780c7f7917789cf8b424710d23 (diff)
downloadbun-cc4326cd829decc95d1f1f23998f97705637e04b.tar.gz
bun-cc4326cd829decc95d1f1f23998f97705637e04b.tar.zst
bun-cc4326cd829decc95d1f1f23998f97705637e04b.zip
Re-run prettier after changes
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/api/crypto.classes.ts13
-rw-r--r--src/bun.js/assert.exports.js456
-rw-r--r--src/bun.js/bindings/sqlite/sqlite.exports.js70
-rw-r--r--src/bun.js/builtins/js/ProcessObjectInternals.js40
-rw-r--r--src/bun.js/bun-jsc.exports.js3
-rw-r--r--src/bun.js/child_process.exports.js147
-rw-r--r--src/bun.js/crypto.exports.js7624
-rw-r--r--src/bun.js/depd.exports.js10
-rw-r--r--src/bun.js/ffi.exports.js91
-rw-r--r--src/bun.js/fs.exports.js71
-rw-r--r--src/bun.js/fs_promises.exports.js2
-rw-r--r--src/bun.js/http.exports.js33
-rw-r--r--src/bun.js/net.exports.js11
-rw-r--r--src/bun.js/node-dns.exports.js139
-rw-r--r--src/bun.js/node-tls.exports.js3
-rw-r--r--src/bun.js/node_streams_consumer.exports.js5
-rw-r--r--src/bun.js/node_streams_web.exports.js47
-rw-r--r--src/bun.js/node_timers_promises.exports.js12
-rw-r--r--src/bun.js/perf_hooks.exports.js4
-rw-r--r--src/bun.js/readline.exports.js293
-rw-r--r--src/bun.js/streams.exports.js1176
-rw-r--r--src/bun.js/url.exports.js95
-rw-r--r--src/bun.js/util.exports.js76
-rw-r--r--src/bun.js/ws.exports.js12
-rw-r--r--src/bun.js/zlib.exports.js526
25 files changed, 2518 insertions, 8441 deletions
diff --git a/src/bun.js/api/crypto.classes.ts b/src/bun.js/api/crypto.classes.ts
index b3852157a..c91913cc4 100644
--- a/src/bun.js/api/crypto.classes.ts
+++ b/src/bun.js/api/crypto.classes.ts
@@ -1,16 +1,7 @@
import { define } from "../scripts/class-definitions";
-const names = [
- "SHA1",
- "MD5",
- "MD4",
- "SHA224",
- "SHA512",
- "SHA384",
- "SHA256",
- "SHA512_256",
-];
-const named = names.map((name) => {
+const names = ["SHA1", "MD5", "MD4", "SHA224", "SHA512", "SHA384", "SHA256", "SHA512_256"];
+const named = names.map(name => {
return define({
name: name,
construct: true,
diff --git a/src/bun.js/assert.exports.js b/src/bun.js/assert.exports.js
index 179d8494d..82527610a 100644
--- a/src/bun.js/assert.exports.js
+++ b/src/bun.js/assert.exports.js
@@ -6,13 +6,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf,
__hasOwnProp = Object.prototype.hasOwnProperty;
-var __markAsModule = (target) => __defProp(target, "__esModule", { value: !0 });
+var __markAsModule = target => __defProp(target, "__esModule", { value: !0 });
var __commonJS = (cb, mod) =>
function () {
- return (
- mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod),
- mod.exports
- );
+ return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __reExport = (target, module2, desc) => {
if ((module2 && typeof module2 == "object") || typeof module2 == "function")
@@ -21,12 +18,11 @@ var __reExport = (target, module2, desc) => {
key !== "default" &&
__defProp(target, key, {
get: () => module2[key],
- enumerable:
- !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable,
+ enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable,
});
return target;
},
- __toModule = (module2) =>
+ __toModule = module2 =>
__reExport(
__markAsModule(
__defProp(
@@ -40,7 +36,7 @@ var __reExport = (target, module2, desc) => {
module2,
);
-var require = (path) => import.meta.require(path);
+var require = path => import.meta.require(path);
// assert/build/internal/errors.js
var require_errors = __commonJS({
@@ -53,10 +49,7 @@ var require_errors = __commonJS({
return typeof obj2;
})
: (_typeof = function (obj2) {
- return obj2 &&
- typeof Symbol == "function" &&
- obj2.constructor === Symbol &&
- obj2 !== Symbol.prototype
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype
? "symbol"
: typeof obj2;
}),
@@ -64,19 +57,13 @@ var require_errors = __commonJS({
);
}
function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor))
- throw new TypeError("Cannot call a class as a function");
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
function _possibleConstructorReturn(self, call) {
- return call && (_typeof(call) === "object" || typeof call == "function")
- ? call
- : _assertThisInitialized(self);
+ return call && (_typeof(call) === "object" || typeof call == "function") ? call : _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
- if (self === void 0)
- throw new ReferenceError(
- "this hasn't been initialised - super() hasn't been called",
- );
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
}
function _getPrototypeOf(o) {
@@ -91,9 +78,7 @@ var require_errors = __commonJS({
}
function _inherits(subClass, superClass) {
if (typeof superClass != "function" && superClass !== null)
- throw new TypeError(
- "Super expression must either be null or a function",
- );
+ throw new TypeError("Super expression must either be null or a function");
(subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: { value: subClass, writable: !0, configurable: !0 },
})),
@@ -125,10 +110,7 @@ var require_errors = __commonJS({
_classCallCheck(this, NodeError2),
(_this = _possibleConstructorReturn(
this,
- _getPrototypeOf(NodeError2).call(
- this,
- getMessage(arg1, arg2, arg3),
- ),
+ _getPrototypeOf(NodeError2).call(this, getMessage(arg1, arg2, arg3)),
)),
(_this.code = code),
_this
@@ -146,15 +128,9 @@ var require_errors = __commonJS({
return String(i);
})),
len > 2
- ? "one of "
- .concat(thing, " ")
- .concat(expected.slice(0, len - 1).join(", "), ", or ") +
- expected[len - 1]
+ ? "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(", "), ", or ") + expected[len - 1]
: len === 2
- ? "one of "
- .concat(thing, " ")
- .concat(expected[0], " or ")
- .concat(expected[1])
+ ? "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1])
: "of ".concat(thing, " ").concat(expected[0])
);
} else return "of ".concat(thing, " ").concat(String(expected));
@@ -164,47 +140,31 @@ var require_errors = __commonJS({
}
function endsWith(str, search, this_len) {
return (
- (this_len === void 0 || this_len > str.length) &&
- (this_len = str.length),
+ (this_len === void 0 || this_len > str.length) && (this_len = str.length),
str.substring(this_len - search.length, this_len) === search
);
}
function includes(str, search, start) {
return (
typeof start != "number" && (start = 0),
- start + search.length > str.length
- ? !1
- : str.indexOf(search, start) !== -1
+ start + search.length > str.length ? !1 : str.indexOf(search, start) !== -1
);
}
- createErrorType(
- "ERR_AMBIGUOUS_ARGUMENT",
- 'The "%s" argument is ambiguous. %s',
- TypeError,
- );
+ createErrorType("ERR_AMBIGUOUS_ARGUMENT", 'The "%s" argument is ambiguous. %s', TypeError);
createErrorType(
"ERR_INVALID_ARG_TYPE",
function (name, expected, actual) {
- assert === void 0 && (assert = require_assert()),
- assert(typeof name == "string", "'name' must be a string");
+ assert === void 0 && (assert = require_assert()), assert(typeof name == "string", "'name' must be a string");
var determiner;
typeof expected == "string" && startsWith(expected, "not ")
- ? ((determiner = "must not be"),
- (expected = expected.replace(/^not /, "")))
+ ? ((determiner = "must not be"), (expected = expected.replace(/^not /, "")))
: (determiner = "must be");
var msg;
if (endsWith(name, " argument"))
- msg = "The "
- .concat(name, " ")
- .concat(determiner, " ")
- .concat(oneOf(expected, "type"));
+ msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
else {
var type = includes(name, ".") ? "property" : "argument";
- msg = 'The "'
- .concat(name, '" ')
- .concat(type, " ")
- .concat(determiner, " ")
- .concat(oneOf(expected, "type"));
+ msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
}
return (msg += ". Received type ".concat(_typeof(actual))), msg;
},
@@ -213,19 +173,12 @@ var require_errors = __commonJS({
createErrorType(
"ERR_INVALID_ARG_VALUE",
function (name, value) {
- var reason =
- arguments.length > 2 && arguments[2] !== void 0
- ? arguments[2]
- : "is invalid";
+ var reason = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "is invalid";
util === void 0 && (util = require("util"));
var inspected = util.inspect(value);
return (
- inspected.length > 128 &&
- (inspected = "".concat(inspected.slice(0, 128), "...")),
- "The argument '"
- .concat(name, "' ")
- .concat(reason, ". Received ")
- .concat(inspected)
+ inspected.length > 128 && (inspected = "".concat(inspected.slice(0, 128), "...")),
+ "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected)
);
},
TypeError,
@@ -239,9 +192,8 @@ var require_errors = __commonJS({
value && value.constructor && value.constructor.name
? (type = "instance of ".concat(value.constructor.name))
: (type = "type ".concat(_typeof(value))),
- "Expected "
- .concat(input, ' to be returned from the "')
- .concat(name, '"') + " function but got ".concat(type, ".")
+ "Expected ".concat(input, ' to be returned from the "').concat(name, '"') +
+ " function but got ".concat(type, ".")
);
},
TypeError,
@@ -249,11 +201,7 @@ var require_errors = __commonJS({
createErrorType(
"ERR_MISSING_ARGS",
function () {
- for (
- var _len = arguments.length, args = new Array(_len), _key = 0;
- _key < _len;
- _key++
- )
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
args[_key] = arguments[_key];
assert === void 0 && (assert = require_assert()),
assert(args.length > 0, "At least one arg needs to be specified");
@@ -272,8 +220,7 @@ var require_errors = __commonJS({
msg += "".concat(args[0], " and ").concat(args[1], " arguments");
break;
default:
- (msg += args.slice(0, len - 1).join(", ")),
- (msg += ", and ".concat(args[len - 1], " arguments"));
+ (msg += args.slice(0, len - 1).join(", ")), (msg += ", and ".concat(args[len - 1], " arguments"));
break;
}
return "".concat(msg, " must be specified");
@@ -318,8 +265,7 @@ var require_assertion_error = __commonJS({
);
}
function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor))
- throw new TypeError("Cannot call a class as a function");
+ 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++) {
@@ -338,22 +284,15 @@ var require_assertion_error = __commonJS({
);
}
function _possibleConstructorReturn(self, call) {
- return call && (_typeof(call) === "object" || typeof call == "function")
- ? call
- : _assertThisInitialized(self);
+ return call && (_typeof(call) === "object" || typeof call == "function") ? call : _assertThisInitialized(self);
}
function _assertThisInitialized(self) {
- if (self === void 0)
- throw new ReferenceError(
- "this hasn't been initialised - super() hasn't been called",
- );
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
}
function _inherits(subClass, superClass) {
if (typeof superClass != "function" && superClass !== null)
- throw new TypeError(
- "Super expression must either be null or a function",
- );
+ throw new TypeError("Super expression must either be null or a function");
(subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: { value: subClass, writable: !0, configurable: !0 },
})),
@@ -364,20 +303,13 @@ var require_assertion_error = __commonJS({
return (
(_wrapNativeSuper = function (Class2) {
if (Class2 === null || !_isNativeFunction(Class2)) return Class2;
- if (typeof Class2 != "function")
- throw new TypeError(
- "Super expression must either be null or a function",
- );
+ if (typeof Class2 != "function") throw new TypeError("Super expression must either be null or a function");
if (typeof _cache != "undefined") {
if (_cache.has(Class2)) return _cache.get(Class2);
_cache.set(Class2, Wrapper);
}
function Wrapper() {
- return _construct(
- Class2,
- arguments,
- _getPrototypeOf(this).constructor,
- );
+ return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
}
return (
(Wrapper.prototype = Object.create(Class2.prototype, {
@@ -395,20 +327,10 @@ var require_assertion_error = __commonJS({
);
}
function isNativeReflectConstruct() {
- if (
- typeof Reflect == "undefined" ||
- !Reflect.construct ||
- Reflect.construct.sham
- )
- return !1;
+ if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) return !1;
if (typeof Proxy == "function") return !0;
try {
- return (
- Date.prototype.toString.call(
- Reflect.construct(Date, [], function () {}),
- ),
- !0
- );
+ return Date.prototype.toString.call(Reflect.construct(Date, [], function () {})), !0;
} catch {
return !1;
}
@@ -422,9 +344,7 @@ var require_assertion_error = __commonJS({
a.push.apply(a, args2);
var Constructor = Function.bind.apply(Parent2, a),
instance = new Constructor();
- return (
- Class2 && _setPrototypeOf(instance, Class2.prototype), instance
- );
+ return Class2 && _setPrototypeOf(instance, Class2.prototype), instance;
}),
_construct.apply(null, arguments)
);
@@ -459,10 +379,7 @@ var require_assertion_error = __commonJS({
return typeof obj2;
})
: (_typeof = function (obj2) {
- return obj2 &&
- typeof Symbol == "function" &&
- obj2.constructor === Symbol &&
- obj2 !== Symbol.prototype
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype
? "symbol"
: typeof obj2;
}),
@@ -475,17 +392,14 @@ var require_assertion_error = __commonJS({
ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE;
function endsWith(str, search, this_len) {
return (
- (this_len === void 0 || this_len > str.length) &&
- (this_len = str.length),
+ (this_len === void 0 || this_len > str.length) && (this_len = str.length),
str.substring(this_len - search.length, this_len) === search
);
}
function repeat(str, count) {
- if (((count = Math.floor(count)), str.length == 0 || count == 0))
- return "";
+ if (((count = Math.floor(count)), str.length == 0 || count == 0)) return "";
var maxCount = str.length * count;
- for (count = Math.floor(Math.log(count) / Math.log(2)); count; )
- (str += str), count--;
+ for (count = Math.floor(Math.log(count) / Math.log(2)); count; ) (str += str), count--;
return (str += str.substring(0, maxCount - str.length)), str;
}
var blue = "",
@@ -495,15 +409,12 @@ var require_assertion_error = __commonJS({
kReadableOperator = {
deepStrictEqual: "Expected values to be strictly deep-equal:",
strictEqual: "Expected values to be strictly equal:",
- strictEqualObject:
- 'Expected "actual" to be reference-equal to "expected":',
+ strictEqualObject: 'Expected "actual" to be reference-equal to "expected":',
deepEqual: "Expected values to be loosely deep-equal:",
equal: "Expected values to be loosely equal:",
- notDeepStrictEqual:
- 'Expected "actual" not to be strictly deep-equal to:',
+ notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:',
notStrictEqual: 'Expected "actual" to be strictly unequal to:',
- notStrictEqualObject:
- 'Expected "actual" not to be reference-equal to "expected":',
+ notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":',
notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
notEqual: 'Expected "actual" to be loosely unequal to:',
notIdentical: "Values identical but not reference-equal:",
@@ -555,9 +466,7 @@ var require_assertion_error = __commonJS({
actual !== null &&
expected !== null &&
(operator = "strictEqualObject"),
- actualLines.length === 1 &&
- expectedLines.length === 1 &&
- actualLines[0] !== expectedLines[0])
+ actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0])
) {
var inputLength = actualLines[0].length + expectedLines[0].length;
if (inputLength <= kMaxShortLength) {
@@ -580,10 +489,7 @@ var require_assertion_error = __commonJS({
)
);
} else if (operator !== "strictEqualObject") {
- var maxLength =
- process.stderr && process.stderr.isTTY
- ? process.stderr.columns
- : 80;
+ var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;
if (inputLength < maxLength) {
for (; actualLines[0][i] === expectedLines[0][i]; ) i++;
i > 2 &&
@@ -594,8 +500,7 @@ var require_assertion_error = __commonJS({
}
}
for (
- var a = actualLines[actualLines.length - 1],
- b = expectedLines[expectedLines.length - 1];
+ var a = actualLines[actualLines.length - 1], b = expectedLines[expectedLines.length - 1];
a === b &&
(i++ < 2
? (end = `
@@ -608,19 +513,13 @@ var require_assertion_error = __commonJS({
!(actualLines.length === 0 || expectedLines.length === 0));
)
- (a = actualLines[actualLines.length - 1]),
- (b = expectedLines[expectedLines.length - 1]);
+ (a = actualLines[actualLines.length - 1]), (b = expectedLines[expectedLines.length - 1]);
var maxLines = Math.max(actualLines.length, expectedLines.length);
if (maxLines === 0) {
var _actualLines = actualInspected.split(`
`);
if (_actualLines.length > 30)
- for (
- _actualLines[26] = "".concat(blue, "...").concat(white);
- _actualLines.length > 27;
-
- )
- _actualLines.pop();
+ for (_actualLines[26] = "".concat(blue, "...").concat(white); _actualLines.length > 27; ) _actualLines.pop();
return ""
.concat(
kReadableOperator.notIdentical,
@@ -710,9 +609,7 @@ var require_assertion_error = __commonJS({
var expectedLine = expectedLines[i],
actualLine = actualLines[i],
divergingLines =
- actualLine !== expectedLine &&
- (!endsWith(actualLine, ",") ||
- actualLine.slice(0, -1) !== expectedLine);
+ actualLine !== expectedLine && (!endsWith(actualLine, ",") || actualLine.slice(0, -1) !== expectedLine);
divergingLines &&
endsWith(expectedLine, ",") &&
expectedLine.slice(0, -1) === actualLine &&
@@ -791,10 +688,7 @@ var require_assertion_error = __commonJS({
_inherits(AssertionError2, _Error);
function AssertionError2(options) {
var _this;
- if (
- (_classCallCheck(this, AssertionError2),
- _typeof(options) !== "object" || options === null)
- )
+ if ((_classCallCheck(this, AssertionError2), _typeof(options) !== "object" || options === null))
throw new ERR_INVALID_ARG_TYPE("options", "Object", options);
var message = options.message,
operator = options.operator,
@@ -803,16 +697,11 @@ var require_assertion_error = __commonJS({
expected = options.expected,
limit = Error.stackTraceLimit;
if (((Error.stackTraceLimit = 0), message != null))
- _this = _possibleConstructorReturn(
- this,
- _getPrototypeOf(AssertionError2).call(this, String(message)),
- );
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(AssertionError2).call(this, String(message)));
else if (
(process.stderr &&
process.stderr.isTTY &&
- (process.stderr &&
- process.stderr.getColorDepth &&
- process.stderr.getColorDepth() !== 1
+ (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1
? ((blue = ""), (green = ""), (white = ""), (red = ""))
: ((blue = ""), (green = ""), (white = ""), (red = ""))),
_typeof(actual) === "object" &&
@@ -828,15 +717,9 @@ var require_assertion_error = __commonJS({
)
_this = _possibleConstructorReturn(
this,
- _getPrototypeOf(AssertionError2).call(
- this,
- createErrDiff(actual, expected, operator),
- ),
+ _getPrototypeOf(AssertionError2).call(this, createErrDiff(actual, expected, operator)),
);
- else if (
- operator === "notDeepStrictEqual" ||
- operator === "notStrictEqual"
- ) {
+ else if (operator === "notDeepStrictEqual" || operator === "notStrictEqual") {
var base = kReadableOperator[operator],
res = inspectValue(actual).split(`
`);
@@ -847,19 +730,11 @@ var require_assertion_error = __commonJS({
(base = kReadableOperator.notStrictEqualObject),
res.length > 30)
)
- for (
- res[26] = "".concat(blue, "...").concat(white);
- res.length > 27;
-
- )
- res.pop();
+ for (res[26] = "".concat(blue, "...").concat(white); res.length > 27; ) res.pop();
res.length === 1
? (_this = _possibleConstructorReturn(
this,
- _getPrototypeOf(AssertionError2).call(
- this,
- "".concat(base, " ").concat(res[0]),
- ),
+ _getPrototypeOf(AssertionError2).call(this, "".concat(base, " ").concat(res[0])),
))
: (_this = _possibleConstructorReturn(
this,
@@ -893,13 +768,10 @@ var require_assertion_error = __commonJS({
`,
)
.concat(_res)),
- _res.length > 1024 &&
- (_res = "".concat(_res.slice(0, 1021), "...")))
+ _res.length > 1024 && (_res = "".concat(_res.slice(0, 1021), "...")))
: ((other = "".concat(inspectValue(expected))),
- _res.length > 512 &&
- (_res = "".concat(_res.slice(0, 509), "...")),
- other.length > 512 &&
- (other = "".concat(other.slice(0, 509), "...")),
+ _res.length > 512 && (_res = "".concat(_res.slice(0, 509), "...")),
+ other.length > 512 && (other = "".concat(other.slice(0, 509), "...")),
operator === "deepEqual" || operator === "equal"
? (_res = ""
.concat(
@@ -919,10 +791,7 @@ should equal
: (other = " ".concat(operator, " ").concat(other))),
(_this = _possibleConstructorReturn(
this,
- _getPrototypeOf(AssertionError2).call(
- this,
- "".concat(_res).concat(other),
- ),
+ _getPrototypeOf(AssertionError2).call(this, "".concat(_res).concat(other)),
));
}
return (
@@ -938,11 +807,7 @@ should equal
(_this.actual = actual),
(_this.expected = expected),
(_this.operator = operator),
- Error.captureStackTrace &&
- Error.captureStackTrace(
- _assertThisInitialized(_this),
- stackStartFn,
- ),
+ Error.captureStackTrace && Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn),
_this.stack,
(_this.name = "AssertionError"),
_possibleConstructorReturn(_this)
@@ -953,10 +818,7 @@ should equal
{
key: "toString",
value: function () {
- return ""
- .concat(this.name, " [")
- .concat(this.code, "]: ")
- .concat(this.message);
+ return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message);
},
},
{
@@ -990,10 +852,7 @@ var require_assert = __commonJS({
return typeof obj2;
})
: (_typeof = function (obj2) {
- return obj2 &&
- typeof Symbol == "function" &&
- obj2.constructor === Symbol &&
- obj2 !== Symbol.prototype
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype
? "symbol"
: typeof obj2;
}),
@@ -1001,8 +860,7 @@ var require_assert = __commonJS({
);
}
function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor))
- throw new TypeError("Cannot call a class as a function");
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}
var _require = require_errors(),
_require$codes = _require.codes,
@@ -1025,9 +883,7 @@ var require_assert = __commonJS({
assert = (module2.exports = ok),
NO_EXCEPTION_SENTINEL = {};
function innerFail(obj) {
- throw obj.message instanceof Error
- ? obj.message
- : new AssertionError(obj);
+ throw obj.message instanceof Error ? obj.message : new AssertionError(obj);
}
function fail(actual, expected, message, operator, stackStartFn) {
var argsLen = arguments.length,
@@ -1037,9 +893,7 @@ var require_assert = __commonJS({
else {
if (warned === !1) {
warned = !0;
- var warn = process.emitWarning
- ? process.emitWarning
- : console.warn.bind(console);
+ var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);
warn(
"assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.",
"DeprecationWarning",
@@ -1057,20 +911,14 @@ var require_assert = __commonJS({
};
message !== void 0 && (errArgs.message = message);
var err = new AssertionError(errArgs);
- throw (
- (internalMessage &&
- ((err.message = internalMessage), (err.generatedMessage = !0)),
- err)
- );
+ throw (internalMessage && ((err.message = internalMessage), (err.generatedMessage = !0)), err);
}
assert.fail = fail;
assert.AssertionError = AssertionError;
function innerOk(fn, argLen, value, message) {
if (!value) {
var generatedMessage = !1;
- if (argLen === 0)
- (generatedMessage = !0),
- (message = "No value argument passed to `assert.ok()`");
+ if (argLen === 0) (generatedMessage = !0), (message = "No value argument passed to `assert.ok()`");
else if (message instanceof Error) throw message;
var err = new AssertionError({
actual: value,
@@ -1083,18 +931,13 @@ var require_assert = __commonJS({
}
}
function ok() {
- for (
- var _len = arguments.length, args = new Array(_len), _key = 0;
- _key < _len;
- _key++
- )
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
args[_key] = arguments[_key];
innerOk.apply(void 0, [ok, args.length].concat(args));
}
assert.ok = ok;
assert.equal = function equal(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
actual != expected &&
innerFail({
actual,
@@ -1105,8 +948,7 @@ var require_assert = __commonJS({
});
};
assert.notEqual = function notEqual(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
actual == expected &&
innerFail({
actual,
@@ -1117,8 +959,7 @@ var require_assert = __commonJS({
});
};
assert.deepEqual = function deepEqual(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
isDeepEqual(actual, expected, false) ||
innerFail({
actual,
@@ -1129,8 +970,7 @@ var require_assert = __commonJS({
});
};
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
isDeepEqual(actual, expected, false) &&
innerFail({
actual,
@@ -1140,13 +980,8 @@ var require_assert = __commonJS({
stackStartFn: notDeepEqual,
});
};
- assert.deepStrictEqual = function deepStrictEqual(
- actual,
- expected,
- message,
- ) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
isDeepEqual(actual, expected, true) ||
innerFail({
@@ -1159,8 +994,7 @@ var require_assert = __commonJS({
};
assert.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
isDeepEqual(actual, expected, true) &&
innerFail({
@@ -1172,8 +1006,7 @@ var require_assert = __commonJS({
});
}
assert.strictEqual = function strictEqual(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
objectIs(actual, expected) ||
innerFail({
actual,
@@ -1184,8 +1017,7 @@ var require_assert = __commonJS({
});
};
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
objectIs(actual, expected) &&
innerFail({
actual,
@@ -1196,10 +1028,8 @@ var require_assert = __commonJS({
});
};
assert.match = function match(actual, expected, message) {
- if (arguments.length < 2)
- throw new ERR_MISSING_ARGS("actual", "expected");
- if (!isRegExp(expected))
- throw new ERR_INVALID_ARG_TYPE("expected", "RegExp", expected);
+ if (arguments.length < 2) throw new ERR_MISSING_ARGS("actual", "expected");
+ if (!isRegExp(expected)) throw new ERR_INVALID_ARG_TYPE("expected", "RegExp", expected);
expected.test(actual) ||
innerFail({
actual,
@@ -1214,10 +1044,7 @@ var require_assert = __commonJS({
_classCallCheck(this, Comparison2),
keys.forEach(function (key) {
key in obj &&
- (actual !== void 0 &&
- typeof actual[key] == "string" &&
- isRegExp(obj[key]) &&
- obj[key].test(actual[key])
+ (actual !== void 0 && typeof actual[key] == "string" && isRegExp(obj[key]) && obj[key].test(actual[key])
? (_this[key] = actual[key])
: (_this[key] = obj[key]));
});
@@ -1233,12 +1060,7 @@ var require_assert = __commonJS({
operator: "deepStrictEqual",
stackStartFn: fn,
});
- throw (
- ((err.actual = actual),
- (err.expected = expected),
- (err.operator = fn.name),
- err)
- );
+ throw ((err.actual = actual), (err.expected = expected), (err.operator = fn.name), err);
}
innerFail({
actual,
@@ -1252,12 +1074,7 @@ var require_assert = __commonJS({
function expectedException(actual, expected, msg, fn) {
if (typeof expected != "function") {
if (isRegExp(expected)) return expected.test(actual);
- if (arguments.length === 2)
- throw new ERR_INVALID_ARG_TYPE(
- "expected",
- ["Function", "RegExp"],
- expected,
- );
+ if (arguments.length === 2) throw new ERR_INVALID_ARG_TYPE("expected", ["Function", "RegExp"], expected);
if (_typeof(actual) !== "object" || actual === null) {
var err = new AssertionError({
actual,
@@ -1270,18 +1087,11 @@ var require_assert = __commonJS({
}
var keys = Object.keys(expected);
if (expected instanceof Error) keys.push("name", "message");
- else if (keys.length === 0)
- throw new ERR_INVALID_ARG_VALUE(
- "error",
- expected,
- "may not be an empty object",
- );
+ else if (keys.length === 0) throw new ERR_INVALID_ARG_VALUE("error", expected, "may not be an empty object");
return (
keys.forEach(function (key) {
return (
- (typeof actual[key] == "string" &&
- isRegExp(expected[key]) &&
- expected[key].test(actual[key])) ||
+ (typeof actual[key] == "string" && isRegExp(expected[key]) && expected[key].test(actual[key])) ||
compareExceptionKey(actual, expected, key, msg, keys, fn)
);
}),
@@ -1295,8 +1105,7 @@ var require_assert = __commonJS({
: expected.call({}, actual) === !0;
}
function getActual(fn) {
- if (typeof fn != "function")
- throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn);
+ if (typeof fn != "function") throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn);
try {
fn();
} catch (e) {
@@ -1307,10 +1116,7 @@ var require_assert = __commonJS({
function checkIsPromise(obj) {
return (
isPromise(obj) ||
- (obj !== null &&
- _typeof(obj) === "object" &&
- typeof obj.then == "function" &&
- typeof obj.catch == "function")
+ (obj !== null && _typeof(obj) === "object" && typeof obj.then == "function" && typeof obj.catch == "function")
);
}
function waitForActual(promiseFn) {
@@ -1318,18 +1124,9 @@ var require_assert = __commonJS({
var resultPromise;
if (typeof promiseFn == "function") {
if (((resultPromise = promiseFn()), !checkIsPromise(resultPromise)))
- throw new ERR_INVALID_RETURN_VALUE(
- "instance of Promise",
- "promiseFn",
- resultPromise,
- );
+ throw new ERR_INVALID_RETURN_VALUE("instance of Promise", "promiseFn", resultPromise);
} else if (checkIsPromise(promiseFn)) resultPromise = promiseFn;
- else
- throw new ERR_INVALID_ARG_TYPE(
- "promiseFn",
- ["Function", "Promise"],
- promiseFn,
- );
+ else throw new ERR_INVALID_ARG_TYPE("promiseFn", ["Function", "Promise"], promiseFn);
return Promise.resolve()
.then(function () {
return resultPromise;
@@ -1345,19 +1142,12 @@ var require_assert = __commonJS({
function expectsError(stackStartFn, actual, error, message) {
if (typeof error == "string") {
if (arguments.length === 4)
- throw new ERR_INVALID_ARG_TYPE(
- "error",
- ["Object", "Error", "Function", "RegExp"],
- error,
- );
+ throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error);
if (_typeof(actual) === "object" && actual !== null) {
if (actual.message === error)
throw new ERR_AMBIGUOUS_ARGUMENT(
"error/message",
- 'The error message "'.concat(
- actual.message,
- '" is identical to the message.',
- ),
+ 'The error message "'.concat(actual.message, '" is identical to the message.'),
);
} else if (actual === error)
throw new ERR_AMBIGUOUS_ARGUMENT(
@@ -1365,22 +1155,13 @@ var require_assert = __commonJS({
'The error "'.concat(actual, '" is identical to the message.'),
);
(message = error), (error = void 0);
- } else if (
- error != null &&
- _typeof(error) !== "object" &&
- typeof error != "function"
- )
- throw new ERR_INVALID_ARG_TYPE(
- "error",
- ["Object", "Error", "Function", "RegExp"],
- error,
- );
+ } else if (error != null && _typeof(error) !== "object" && typeof error != "function")
+ throw new ERR_INVALID_ARG_TYPE("error", ["Object", "Error", "Function", "RegExp"], error);
if (actual === NO_EXCEPTION_SENTINEL) {
var details = "";
error && error.name && (details += " (".concat(error.name, ")")),
(details += message ? ": ".concat(message) : ".");
- var fnType =
- stackStartFn.name === "rejects" ? "rejection" : "exception";
+ var fnType = stackStartFn.name === "rejects" ? "rejection" : "exception";
innerFail({
actual: void 0,
expected: error,
@@ -1389,8 +1170,7 @@ var require_assert = __commonJS({
stackStartFn,
});
}
- if (error && !expectedException(actual, error, message, stackStartFn))
- throw actual;
+ if (error && !expectedException(actual, error, message, stackStartFn)) throw actual;
}
function expectsNoError(stackStartFn, actual, error, message) {
if (actual !== NO_EXCEPTION_SENTINEL) {
@@ -1399,8 +1179,7 @@ var require_assert = __commonJS({
!error || expectedException(actual, error))
) {
var details = message ? ": ".concat(message) : ".",
- fnType =
- stackStartFn.name === "doesNotReject" ? "rejection" : "exception";
+ fnType = stackStartFn.name === "doesNotReject" ? "rejection" : "exception";
innerFail({
actual,
expected: error,
@@ -1418,54 +1197,27 @@ var require_assert = __commonJS({
}
}
assert.throws = function throws(promiseFn) {
- for (
- var _len2 = arguments.length,
- args = new Array(_len2 > 1 ? _len2 - 1 : 0),
- _key2 = 1;
- _key2 < _len2;
- _key2++
- )
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)
args[_key2 - 1] = arguments[_key2];
expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));
};
assert.rejects = function rejects(promiseFn) {
- for (
- var _len3 = arguments.length,
- args = new Array(_len3 > 1 ? _len3 - 1 : 0),
- _key3 = 1;
- _key3 < _len3;
- _key3++
- )
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)
args[_key3 - 1] = arguments[_key3];
return waitForActual(promiseFn).then(function (result) {
return expectsError.apply(void 0, [rejects, result].concat(args));
});
};
assert.doesNotThrow = function doesNotThrow(fn) {
- for (
- var _len4 = arguments.length,
- args = new Array(_len4 > 1 ? _len4 - 1 : 0),
- _key4 = 1;
- _key4 < _len4;
- _key4++
- )
+ for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++)
args[_key4 - 1] = arguments[_key4];
expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));
};
assert.doesNotReject = function doesNotReject(fn) {
- for (
- var _len5 = arguments.length,
- args = new Array(_len5 > 1 ? _len5 - 1 : 0),
- _key5 = 1;
- _key5 < _len5;
- _key5++
- )
+ for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++)
args[_key5 - 1] = arguments[_key5];
return waitForActual(fn).then(function (result) {
- return expectsNoError.apply(
- void 0,
- [doesNotReject, result].concat(args),
- );
+ return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));
});
};
assert.ifError = function ifError(err) {
@@ -1517,11 +1269,7 @@ var require_assert = __commonJS({
}
};
function strict() {
- for (
- var _len6 = arguments.length, args = new Array(_len6), _key6 = 0;
- _key6 < _len6;
- _key6++
- )
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++)
args[_key6] = arguments[_key6];
innerOk.apply(void 0, [strict, args.length].concat(args));
}
diff --git a/src/bun.js/bindings/sqlite/sqlite.exports.js b/src/bun.js/bindings/sqlite/sqlite.exports.js
index 875e28ff1..b64ec1508 100644
--- a/src/bun.js/bindings/sqlite/sqlite.exports.js
+++ b/src/bun.js/bindings/sqlite/sqlite.exports.js
@@ -2,9 +2,7 @@ var symbolFor = Symbol.for;
const lazy = globalThis[symbolFor("Bun.lazy")];
if (!lazy || typeof lazy !== "function") {
- throw new Error(
- "Something went wrong while loading Bun. Expected 'Bun.lazy' to be defined.",
- );
+ throw new Error("Something went wrong while loading Bun. Expected 'Bun.lazy' to be defined.");
}
var defineProperties = Object.defineProperties;
@@ -120,8 +118,7 @@ export class Statement {
// ("foo") => ["foo"]
// (Uint8Array(1024)) => [Uint8Array]
// (123) => [123]
- return !isArray(arg0) &&
- (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
+ return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
? this.#raw.get(args)
: this.#raw.get(...args);
}
@@ -133,8 +130,7 @@ export class Statement {
// ("foo") => ["foo"]
// (Uint8Array(1024)) => [Uint8Array]
// (123) => [123]
- return !isArray(arg0) &&
- (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
+ return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
? this.#raw.all(args)
: this.#raw.all(...args);
}
@@ -146,8 +142,7 @@ export class Statement {
// ("foo") => ["foo"]
// (Uint8Array(1024)) => [Uint8Array]
// (123) => [123]
- return !isArray(arg0) &&
- (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
+ return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
? this.#raw.values(args)
: this.#raw.values(...args);
}
@@ -191,13 +186,10 @@ export class Database {
return;
}
- throw new TypeError(
- `Expected 'filename' to be a string, got '${typeof filenameGiven}'`,
- );
+ throw new TypeError(`Expected 'filename' to be a string, got '${typeof filenameGiven}'`);
}
- var filename =
- typeof filenameGiven === "string" ? filenameGiven.trim() : ":memory:";
+ var filename = typeof filenameGiven === "string" ? filenameGiven.trim() : ":memory:";
var flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;
if (typeof options === "object" && options) {
flags = 0;
@@ -206,10 +198,7 @@ export class Database {
flags = constants.SQLITE_OPEN_READONLY;
}
- if ("readOnly" in options)
- throw new TypeError(
- 'Misspelled option "readOnly" should be "readonly"',
- );
+ if ("readOnly" in options) throw new TypeError('Misspelled option "readOnly" should be "readonly"');
if (options.create) {
flags = constants.SQLITE_OPEN_READWRITE | constants.SQLITE_OPEN_CREATE;
@@ -297,8 +286,7 @@ export class Database {
}
var arg0 = params[0];
- return !isArray(arg0) &&
- (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
+ return !isArray(arg0) && (!arg0 || typeof arg0 !== "object" || isTypedArray(arg0))
? SQL.run(this.#handle, query, params)
: SQL.run(this.#handle, query, ...params);
}
@@ -315,9 +303,7 @@ export class Database {
query(query) {
if (typeof query !== "string") {
- throw new TypeError(
- `Expected 'query' to be a string, got '${typeof query}'`,
- );
+ throw new TypeError(`Expected 'query' to be a string, got '${typeof query}'`);
}
if (query.length === 0) {
@@ -343,14 +329,9 @@ export class Database {
return stmt;
}
- const willCache =
- this.#cachedQueriesKeys.length < Database.MAX_QUERY_CACHE_SIZE;
+ const willCache = this.#cachedQueriesKeys.length < Database.MAX_QUERY_CACHE_SIZE;
- var stmt = this.prepare(
- query,
- undefined,
- willCache ? constants.SQLITE_PREPARE_PERSISTENT : 0,
- );
+ var stmt = this.prepare(query, undefined, willCache ? constants.SQLITE_PREPARE_PERSISTENT : 0);
if (willCache) {
this.#cachedQueriesKeys.push(query);
@@ -365,8 +346,7 @@ export class Database {
// https://github.com/JoshuaWise/better-sqlite3/blob/master/lib/methods/transaction.js
// thank you @JoshuaWise!
transaction(fn, self) {
- if (typeof fn !== "function")
- throw new TypeError("Expected first argument to be a function");
+ if (typeof fn !== "function") throw new TypeError("Expected first argument to be a function");
const db = this;
const controller = getController(db, self);
@@ -411,22 +391,10 @@ const getController = (db, self) => {
controllers.set(
db,
(controller = {
- default: Object.assign(
- { begin: db.prepare("BEGIN", undefined, 0) },
- shared,
- ),
- deferred: Object.assign(
- { begin: db.prepare("BEGIN DEFERRED", undefined, 0) },
- shared,
- ),
- immediate: Object.assign(
- { begin: db.prepare("BEGIN IMMEDIATE", undefined, 0) },
- shared,
- ),
- exclusive: Object.assign(
- { begin: db.prepare("BEGIN EXCLUSIVE", undefined, 0) },
- shared,
- ),
+ default: Object.assign({ begin: db.prepare("BEGIN", undefined, 0) }, shared),
+ deferred: Object.assign({ begin: db.prepare("BEGIN DEFERRED", undefined, 0) }, shared),
+ immediate: Object.assign({ begin: db.prepare("BEGIN IMMEDIATE", undefined, 0) }, shared),
+ exclusive: Object.assign({ begin: db.prepare("BEGIN EXCLUSIVE", undefined, 0) }, shared),
}),
);
}
@@ -434,11 +402,7 @@ const getController = (db, self) => {
};
// Return a new transaction function by wrapping the given function
-const wrapTransaction = (
- fn,
- db,
- { begin, commit, rollback, savepoint, release, rollbackTo },
-) =>
+const wrapTransaction = (fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) =>
function transaction(...args) {
let before, after, undo;
if (db.inTransaction) {
diff --git a/src/bun.js/builtins/js/ProcessObjectInternals.js b/src/bun.js/builtins/js/ProcessObjectInternals.js
index e23e516b8..723528fec 100644
--- a/src/bun.js/builtins/js/ProcessObjectInternals.js
+++ b/src/bun.js/builtins/js/ProcessObjectInternals.js
@@ -25,7 +25,7 @@
function getStdioWriteStream(fd_, rawRequire) {
var module = { path: "node:process", require: rawRequire };
- var require = (path) => module.require(path);
+ var require = path => module.require(path);
function createStdioWriteStream(fd_) {
var { Duplex, eos, destroy } = require("node:stream");
@@ -72,18 +72,9 @@ function getStdioWriteStream(fd_, rawRequire) {
_destroy(err, callback) {
if (!err && this.#onClose !== null) {
var AbortError = class AbortError extends Error {
- constructor(
- message = "The operation was aborted",
- options = void 0,
- ) {
+ constructor(message = "The operation was aborted", options = void 0) {
if (options !== void 0 && typeof options !== "object") {
- throw new Error(
- `Invalid AbortError options:\n\n${JSON.stringify(
- options,
- null,
- 2,
- )}`,
- );
+ throw new Error(`Invalid AbortError options:\n\n${JSON.stringify(options, null, 2)}`);
}
super(message, options);
this.code = "ABORT_ERR";
@@ -125,7 +116,7 @@ function getStdioWriteStream(fd_, rawRequire) {
}
});
- eos(stream, (err) => {
+ eos(stream, err => {
this.#writable = false;
if (err) {
destroy(stream, err);
@@ -164,7 +155,7 @@ function getStdioWriteStream(fd_, rawRequire) {
this.push(null);
});
- eos(readStream, (err) => {
+ eos(readStream, err => {
this.#readable = false;
if (err) {
destroy(readStream, err);
@@ -197,12 +188,7 @@ function getStdioWriteStream(fd_, rawRequire) {
if (!encoding) return true;
var normalied = encoding.toLowerCase();
- return (
- normalied === "utf8" ||
- normalied === "utf-8" ||
- normalied === "buffer" ||
- normalied === "binary"
- );
+ return normalied === "utf8" || normalied === "utf-8" || normalied === "buffer" || normalied === "binary";
}
var FastStdioWriteStream = class StdioWriteStream extends EventEmitter {
@@ -356,7 +342,7 @@ function getStdioWriteStream(fd_, rawRequire) {
this.#performCallback(callback);
this.emit("drain");
},
- (err) => this.#performCallback(callback, err),
+ err => this.#performCallback(callback, err),
);
return false;
}
@@ -437,7 +423,7 @@ function getStdioWriteStream(fd_, rawRequire) {
function getStdinStream(fd_, rawRequire, Bun) {
var module = { path: "node:process", require: rawRequire };
- var require = (path) => module.require(path);
+ var require = path => module.require(path);
var { Duplex, eos, destroy } = require("node:stream");
@@ -486,13 +472,7 @@ function getStdinStream(fd_, rawRequire, Bun) {
var AbortError = class AbortError extends Error {
constructor(message = "The operation was aborted", options = void 0) {
if (options !== void 0 && typeof options !== "object") {
- throw new Error(
- `Invalid AbortError options:\n\n${JSON.stringify(
- options,
- null,
- 2,
- )}`,
- );
+ throw new Error(`Invalid AbortError options:\n\n${JSON.stringify(options, null, 2)}`);
}
super(message, options);
this.code = "ABORT_ERR";
@@ -610,7 +590,7 @@ function getStdinStream(fd_, rawRequire, Bun) {
}
});
- eos(writeStream, (err) => {
+ eos(writeStream, err => {
this.#writable = false;
if (err) {
destroy(writeStream, err);
diff --git a/src/bun.js/bun-jsc.exports.js b/src/bun.js/bun-jsc.exports.js
index b35a5e7a6..2e1b1376a 100644
--- a/src/bun.js/bun-jsc.exports.js
+++ b/src/bun.js/bun-jsc.exports.js
@@ -25,7 +25,6 @@ export const setRandomSeed = jsc.setRandomSeed;
export const startRemoteDebugger = jsc.startRemoteDebugger;
export const totalCompileTime = jsc.totalCompileTime;
export const getProtectedObjects = jsc.getProtectedObjects;
-export const generateHeapSnapshotForDebugging =
- jsc.generateHeapSnapshotForDebugging;
+export const generateHeapSnapshotForDebugging = jsc.generateHeapSnapshotForDebugging;
export const profile = jsc.profile;
export default jsc;
diff --git a/src/bun.js/child_process.exports.js b/src/bun.js/child_process.exports.js
index 71d97366a..afb427461 100644
--- a/src/bun.js/child_process.exports.js
+++ b/src/bun.js/child_process.exports.js
@@ -162,9 +162,7 @@ export function spawn(file, args, options) {
process.nextTick(onAbortListener);
} else {
signal.addEventListener("abort", onAbortListener, { once: true });
- child.once("exit", () =>
- signal.removeEventListener("abort", onAbortListener),
- );
+ child.once("exit", () => signal.removeEventListener("abort", onAbortListener));
}
function onAbortListener() {
@@ -200,12 +198,7 @@ export function spawn(file, args, options) {
* @returns {ChildProcess}
*/
export function execFile(file, args, options, callback) {
- ({ file, args, options, callback } = normalizeExecFileArgs(
- file,
- args,
- options,
- callback,
- ));
+ ({ file, args, options, callback } = normalizeExecFileArgs(file, args, options, callback));
options = {
encoding: "utf8",
@@ -357,10 +350,7 @@ export function execFile(file, args, options, callback) {
encodedStdoutLen += actualLen;
}
const truncatedLen = maxBuffer - (encodedStdoutLen - actualLen);
- ArrayPrototypePush.call(
- _stdout,
- StringPrototypeSlice.apply(chunk, 0, truncatedLen),
- );
+ ArrayPrototypePush.call(_stdout, StringPrototypeSlice.apply(chunk, 0, truncatedLen));
ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER("stdout");
kill();
@@ -408,10 +398,7 @@ export function execFile(file, args, options, callback) {
encodedStderrLen += actualLen;
}
const truncatedLen = maxBuffer - (encodedStderrLen - actualLen);
- ArrayPrototypePush.call(
- _stderr,
- StringPrototypeSlice.call(chunk, 0, truncatedLen),
- );
+ ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen));
ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER("stderr");
kill();
@@ -424,10 +411,7 @@ export function execFile(file, args, options, callback) {
if (stderrLen > maxBuffer) {
const truncatedLen = maxBuffer - (stderrLen - chunk.length);
- ArrayPrototypePush.call(
- _stderr,
- StringPrototypeSlice.call(chunk, 0, truncatedLen),
- );
+ ArrayPrototypePush.call(_stderr, StringPrototypeSlice.call(chunk, 0, truncatedLen));
ex = new ERR_CHILD_PROCESS_STDIO_MAXBUFFER("stderr");
kill();
@@ -530,11 +514,7 @@ export function spawnSync(file, args, options) {
} else if (typeof input === "string") {
bunStdio[0] = Buffer.from(input, encoding || "utf8");
} else {
- throw new ERR_INVALID_ARG_TYPE(
- `options.stdio[0]`,
- ["Buffer", "TypedArray", "DataView", "string"],
- input,
- );
+ throw new ERR_INVALID_ARG_TYPE(`options.stdio[0]`, ["Buffer", "TypedArray", "DataView", "string"], input);
}
}
@@ -565,13 +545,7 @@ export function spawnSync(file, args, options) {
result.stderr = result.output[2];
if (!success) {
- result.error = new SystemError(
- result.output[2],
- options.file,
- "spawnSync",
- -1,
- result.status,
- );
+ result.error = new SystemError(result.output[2], options.file, "spawnSync", -1, result.status);
result.error.spawnargs = ArrayPrototypeSlice.call(options.args, 1);
}
@@ -657,8 +631,7 @@ export function fork() {
// Section 2. child_process helpers
//------------------------------------------------------------------------------
function convertToValidSignal(signal) {
- if (typeof signal === "number" && getSignalsToNamesMapping()[signal])
- return signal;
+ if (typeof signal === "number" && getSignalsToNamesMapping()[signal]) return signal;
if (typeof signal === "string") {
const signalName = signals[StringPrototypeToUpperCase.call(signal)];
@@ -672,11 +645,7 @@ function sanitizeKillSignal(killSignal) {
if (typeof killSignal === "string" || typeof killSignal === "number") {
return convertToValidSignal(killSignal);
} else if (killSignal != null) {
- throw new ERR_INVALID_ARG_TYPE(
- "options.killSignal",
- ["string", "number"],
- killSignal,
- );
+ throw new ERR_INVALID_ARG_TYPE("options.killSignal", ["string", "number"], killSignal);
}
}
@@ -756,8 +725,7 @@ function normalizeSpawnArguments(file, args, options) {
validateString(file, "file");
validateArgumentNullCheck(file, "file");
- if (file.length === 0)
- throw new ERR_INVALID_ARG_VALUE("file", file, "cannot be empty");
+ if (file.length === 0) throw new ERR_INVALID_ARG_VALUE("file", file, "cannot be empty");
if (ArrayIsArray(args)) {
args = ArrayPrototypeSlice.call(args);
@@ -787,16 +755,8 @@ function normalizeSpawnArguments(file, args, options) {
// TODO: Uid check
// Validate the shell, if present.
- if (
- options.shell != null &&
- typeof options.shell !== "boolean" &&
- typeof options.shell !== "string"
- ) {
- throw new ERR_INVALID_ARG_TYPE(
- "options.shell",
- ["boolean", "string"],
- options.shell,
- );
+ if (options.shell != null && typeof options.shell !== "boolean" && typeof options.shell !== "string") {
+ throw new ERR_INVALID_ARG_TYPE("options.shell", ["boolean", "string"], options.shell);
}
// Validate argv0, if present.
@@ -858,8 +818,7 @@ function checkExecSyncError(ret, args, cmd) {
} else if (ret.status !== 0) {
let msg = "Command failed: ";
msg += cmd || ArrayPrototypeJoin.call(args, " ");
- if (ret.stderr && ret.stderr.length > 0)
- msg += `\n${ret.stderr.toString()}`;
+ if (ret.stderr && ret.stderr.length > 0) msg += `\n${ret.stderr.toString()}`;
err = genericNodeError(msg, ret);
}
return err;
@@ -937,9 +896,7 @@ export class ChildProcess extends EventEmitter {
#getBunSpawnIo(i, encoding) {
if (__DEBUG__ && !this.#handle) {
if (this.#handle === null) {
- debug(
- "ChildProcess: getBunSpawnIo: this.#handle is null. This means the subprocess already exited",
- );
+ debug("ChildProcess: getBunSpawnIo: this.#handle is null. This means the subprocess already exited");
} else {
debug("ChildProcess: getBunSpawnIo: this.#handle is undefined");
}
@@ -967,9 +924,7 @@ export class ChildProcess extends EventEmitter {
__TRACK_STDIO__
? {
encoding,
- __id: `PARENT_${fdToStdioName(
- i,
- ).toUpperCase()}-${globalThis.__getId()}`,
+ __id: `PARENT_${fdToStdioName(i).toUpperCase()}-${globalThis.__getId()}`,
}
: { encoding },
);
@@ -1081,9 +1036,7 @@ export class ChildProcess extends EventEmitter {
if (!hasEmittedSpawn) {
hasEmittedSpawn = true;
process.nextTick(onSpawnNT, this);
- process.nextTick((exitCode, signalCode, err) =>
- this.#handleOnExit(exitCode, signalCode, err),
- );
+ process.nextTick((exitCode, signalCode, err) => this.#handleOnExit(exitCode, signalCode, err));
} else {
this.#handleOnExit(exitCode, signalCode, err);
}
@@ -1138,16 +1091,11 @@ export class ChildProcess extends EventEmitter {
}
disconnect() {
- console.log(
- "ChildProcess.prototype.disconnect() - Sorry! Not implemented yet",
- );
+ console.log("ChildProcess.prototype.disconnect() - Sorry! Not implemented yet");
}
kill(sig) {
- const signal =
- sig === 0
- ? sig
- : convertToValidSignal(sig === undefined ? "SIGTERM" : sig);
+ const signal = sig === 0 ? sig : convertToValidSignal(sig === undefined ? "SIGTERM" : sig);
if (this.#handle) {
this.#handle.kill(signal);
@@ -1238,7 +1186,7 @@ function getBunStdioFromOptions(stdio) {
// ignore -> null
// inherit -> inherit (stdin/stdout/stderr)
// Stream -> throw err for now
- const bunStdio = normalizedStdio.map((item) => nodeToBun(item));
+ const bunStdio = normalizedStdio.map(item => nodeToBun(item));
return bunStdio;
}
@@ -1264,7 +1212,7 @@ function normalizeStdio(stdio) {
else if (stdio.length === 2) processedStdio = [stdio[0], stdio[1], "pipe"];
else if (stdio.length >= 3) processedStdio = [stdio[0], stdio[1], stdio[2]];
- return processedStdio.map((item) => (!item ? "pipe" : item));
+ return processedStdio.map(item => (!item ? "pipe" : item));
} else {
throw new ERR_INVALID_OPT_VALUE("stdio", stdio);
}
@@ -1323,21 +1271,13 @@ class ShimmedStdioOutStream extends EventEmitter {
function validateMaxBuffer(maxBuffer) {
if (maxBuffer != null && !(typeof maxBuffer === "number" && maxBuffer >= 0)) {
- throw new ERR_OUT_OF_RANGE(
- "options.maxBuffer",
- "a positive number",
- maxBuffer,
- );
+ throw new ERR_OUT_OF_RANGE("options.maxBuffer", "a positive number", maxBuffer);
}
}
function validateArgumentNullCheck(arg, propName) {
if (typeof arg === "string" && StringPrototypeIncludes.call(arg, "\u0000")) {
- throw new ERR_INVALID_ARG_VALUE(
- propName,
- arg,
- "must be a string without null bytes",
- );
+ throw new ERR_INVALID_ARG_VALUE(propName, arg, "must be a string without null bytes");
}
}
@@ -1354,8 +1294,7 @@ function validateTimeout(timeout) {
}
function validateBoolean(value, name) {
- if (typeof value !== "boolean")
- throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
+ if (typeof value !== "boolean") throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
}
/**
@@ -1367,8 +1306,7 @@ function validateBoolean(value, name) {
/** @type {validateFunction} */
function validateFunction(value, name) {
- if (typeof value !== "function")
- throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
+ if (typeof value !== "function") throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
}
/**
@@ -1379,10 +1317,7 @@ function validateFunction(value, name) {
/** @type {validateAbortSignal} */
const validateAbortSignal = (signal, name) => {
- if (
- signal !== undefined &&
- (signal === null || typeof signal !== "object" || !("aborted" in signal))
- ) {
+ if (signal !== undefined && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
}
};
@@ -1400,9 +1335,7 @@ const validateOneOf = (value, name, oneOf) => {
// const validateOneOf = hideStackFrames((value, name, oneOf) => {
if (!ArrayPrototypeIncludes.call(oneOf, value)) {
const allowed = ArrayPrototypeJoin.call(
- ArrayPrototypeMap.call(oneOf, (v) =>
- typeof v === "string" ? `'${v}'` : String(v),
- ),
+ ArrayPrototypeMap.call(oneOf, v => (typeof v === "string" ? `'${v}'` : String(v))),
", ",
);
const reason = "must be one of: " + allowed;
@@ -1430,8 +1363,7 @@ const validateObject = (value, name, options = null) => {
if (
(!nullable && value === null) ||
(!allowArray && ArrayIsArray.call(value)) ||
- (typeof value !== "object" &&
- (!allowFunction || typeof value !== "function"))
+ (typeof value !== "object" && (!allowFunction || typeof value !== "function"))
) {
throw new ERR_INVALID_ARG_TYPE(name, "object", value);
}
@@ -1466,8 +1398,7 @@ const validateArray = (value, name, minLength = 0) => {
/** @type {validateString} */
function validateString(value, name) {
- if (typeof value !== "string")
- throw new ERR_INVALID_ARG_TYPE(name, "string", value);
+ if (typeof value !== "string") throw new ERR_INVALID_ARG_TYPE(name, "string", value);
}
function nullCheck(path, propName, throwError = true) {
@@ -1483,11 +1414,7 @@ function nullCheck(path, propName, throwError = true) {
return;
}
- const err = new ERR_INVALID_ARG_VALUE(
- propName,
- path,
- "must be a string or Uint8Array without null bytes",
- );
+ const err = new ERR_INVALID_ARG_VALUE(propName, path, "must be a string or Uint8Array without null bytes");
if (throwError) {
throw err;
}
@@ -1550,9 +1477,7 @@ var StringPrototypeIncludes = String.prototype.includes;
var Uint8ArrayPrototypeIncludes = Uint8Array.prototype.includes;
function isUint8Array(value) {
- return (
- typeof value === "object" && value !== null && value instanceof Uint8Array
- );
+ return typeof value === "object" && value !== null && value instanceof Uint8Array;
}
//------------------------------------------------------------------------------
@@ -1746,9 +1671,7 @@ function ERR_OUT_OF_RANGE(str, range, input, replaceDefaultBoolean = false) {
// }
// msg += ` It must be ${range}. Received ${received}`;
// return new RangeError(msg);
- return new RangeError(
- `The value of ${str} is out of range. It must be ${range}. Received ${input}`,
- );
+ return new RangeError(`The value of ${str} is out of range. It must be ${range}. Received ${input}`);
}
function ERR_CHILD_PROCESS_STDIO_MAXBUFFER(stdio) {
@@ -1762,9 +1685,7 @@ function ERR_UNKNOWN_SIGNAL(name) {
}
function ERR_INVALID_ARG_TYPE(name, type, value) {
- const err = new TypeError(
- `The "${name}" argument must be of type ${type}. Received ${value}`,
- );
+ const err = new TypeError(`The "${name}" argument must be of type ${type}. Received ${value}`);
err.code = "ERR_INVALID_ARG_TYPE";
return err;
}
@@ -1774,9 +1695,7 @@ function ERR_INVALID_OPT_VALUE(name, value) {
}
function ERR_INVALID_ARG_VALUE(name, value, reason) {
- return new Error(
- `The value "${value}" is invalid for argument '${name}'. Reason: ${reason}`,
- );
+ return new Error(`The value "${value}" is invalid for argument '${name}'. Reason: ${reason}`);
}
class SystemError extends Error {
diff --git a/src/bun.js/crypto.exports.js b/src/bun.js/crypto.exports.js
index 6362a6ea1..24115e0be 100644
--- a/src/bun.js/crypto.exports.js
+++ b/src/bun.js/crypto.exports.js
@@ -5,7 +5,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf,
__hasOwnProp = Object.prototype.hasOwnProperty;
-var __require = (id) => import.meta.require(id);
+var __require = id => import.meta.require(id);
var __esm = (fn, res) =>
function () {
@@ -13,15 +13,10 @@ var __esm = (fn, res) =>
};
var __commonJS = (cb, mod) =>
function () {
- return (
- mod ||
- (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
- mod.exports
- );
+ 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: !0 });
+ for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 });
},
__copyProps = (to, from, except, desc) => {
if ((from && typeof from == "object") || typeof from == "function")
@@ -30,21 +25,17 @@ var __export = (target, all) => {
key !== except &&
__defProp(to, key, {
get: () => from[key],
- enumerable:
- !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
});
return to;
},
__reExport = (target, mod, secondTarget) => (
- __copyProps(target, mod, "default"),
- secondTarget && __copyProps(secondTarget, mod, "default")
+ __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")
),
__toESM = (mod, isNodeMode, target) => (
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
__copyProps(
- isNodeMode || !mod || !mod.__esModule
- ? __defProp(target, "default", { value: mod, enumerable: !0 })
- : target,
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
mod,
)
);
@@ -57,10 +48,7 @@ var require_safe_buffer = __commonJS({
function copyProps(src, dst) {
for (var key in src) dst[key] = src[key];
}
- Buffer2.from &&
- Buffer2.alloc &&
- Buffer2.allocUnsafe &&
- Buffer2.allocUnsafeSlow
+ Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow
? (module.exports = buffer)
: (copyProps(buffer, exports), (exports.Buffer = SafeBuffer));
function SafeBuffer(arg, encodingOrOffset, length) {
@@ -69,31 +57,22 @@ var require_safe_buffer = __commonJS({
SafeBuffer.prototype = Object.create(Buffer2.prototype);
copyProps(Buffer2, SafeBuffer);
SafeBuffer.from = function (arg, encodingOrOffset, length) {
- if (typeof arg == "number")
- throw new TypeError("Argument must not be a number");
+ if (typeof arg == "number") throw new TypeError("Argument must not be a number");
return Buffer2(arg, encodingOrOffset, length);
};
SafeBuffer.alloc = function (size, fill, encoding) {
- if (typeof size != "number")
- throw new TypeError("Argument must be a number");
+ if (typeof size != "number") throw new TypeError("Argument must be a number");
var buf = Buffer2(size);
return (
- fill !== void 0
- ? typeof encoding == "string"
- ? buf.fill(fill, encoding)
- : buf.fill(fill)
- : buf.fill(0),
- buf
+ fill !== void 0 ? (typeof encoding == "string" ? buf.fill(fill, encoding) : buf.fill(fill)) : buf.fill(0), buf
);
};
SafeBuffer.allocUnsafe = function (size) {
- if (typeof size != "number")
- throw new TypeError("Argument must be a number");
+ if (typeof size != "number") throw new TypeError("Argument must be a number");
return Buffer2(size);
};
SafeBuffer.allocUnsafeSlow = function (size) {
- if (typeof size != "number")
- throw new TypeError("Argument must be a number");
+ if (typeof size != "number") throw new TypeError("Argument must be a number");
return buffer.SlowBuffer(size);
};
},
@@ -111,19 +90,14 @@ Use Chrome, Firefox or Internet Explorer 11`);
}
var Buffer2 = require_safe_buffer().Buffer,
crypto2 = global.crypto || global.msCrypto;
- crypto2 && crypto2.getRandomValues
- ? (module.exports = randomBytes)
- : (module.exports = oldBrowser);
+ crypto2 && crypto2.getRandomValues ? (module.exports = randomBytes) : (module.exports = oldBrowser);
function randomBytes(size, cb) {
- if (size > MAX_UINT32)
- throw new RangeError("requested too many random bytes");
+ if (size > MAX_UINT32) throw new RangeError("requested too many random bytes");
var bytes = Buffer2.allocUnsafe(size);
if (size > 0)
if (size > MAX_BYTES)
for (var generated = 0; generated < size; generated += MAX_BYTES)
- crypto2.getRandomValues(
- bytes.slice(generated, generated + MAX_BYTES),
- );
+ crypto2.getRandomValues(bytes.slice(generated, generated + MAX_BYTES));
else crypto2.getRandomValues(bytes);
return typeof cb == "function"
? process.nextTick(function () {
@@ -201,20 +175,13 @@ var require_hash_base = __commonJS({
callback(error);
};
HashBase.prototype.update = function (data, encoding) {
- if ((throwIfNotStringOrBuffer(data, "Data"), this._finalized))
- throw new Error("Digest already called");
+ if ((throwIfNotStringOrBuffer(data, "Data"), this._finalized)) throw new Error("Digest already called");
Buffer2.isBuffer(data) || (data = Buffer2.from(data, encoding));
- for (
- var block = this._block, offset = 0;
- this._blockOffset + data.length - offset >= this._blockSize;
-
- ) {
- for (var i = this._blockOffset; i < this._blockSize; )
- block[i++] = data[offset++];
+ for (var block = this._block, offset = 0; this._blockOffset + data.length - offset >= this._blockSize; ) {
+ for (var i = this._blockOffset; i < this._blockSize; ) block[i++] = data[offset++];
this._update(), (this._blockOffset = 0);
}
- for (; offset < data.length; )
- block[this._blockOffset++] = data[offset++];
+ for (; offset < data.length; ) block[this._blockOffset++] = data[offset++];
for (var j = 0, carry = data.length * 8; carry > 0; ++j)
(this._length[j] += carry),
(carry = (this._length[j] / 4294967296) | 0),
@@ -228,9 +195,7 @@ var require_hash_base = __commonJS({
if (this._finalized) throw new Error("Digest already called");
this._finalized = !0;
var digest = this._digest();
- encoding !== void 0 && (digest = digest.toString(encoding)),
- this._block.fill(0),
- (this._blockOffset = 0);
+ encoding !== void 0 && (digest = digest.toString(encoding)), this._block.fill(0), (this._blockOffset = 0);
for (var i = 0; i < 4; ++i) this._length[i] = 0;
return digest;
};
@@ -258,8 +223,7 @@ var require_md5 = __commonJS({
}
inherits(MD5, HashBase);
MD5.prototype._update = function () {
- for (var M = ARRAY16, i = 0; i < 16; ++i)
- M[i] = this._block.readInt32LE(i * 4);
+ for (var M = ARRAY16, i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4);
var a = this._a,
b = this._b,
c = this._c,
@@ -335,10 +299,7 @@ var require_md5 = __commonJS({
};
MD5.prototype._digest = function () {
(this._block[this._blockOffset++] = 128),
- this._blockOffset > 56 &&
- (this._block.fill(0, this._blockOffset, 64),
- this._update(),
- (this._blockOffset = 0)),
+ this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), (this._blockOffset = 0)),
this._block.fill(0, this._blockOffset, 56),
this._block.writeUInt32LE(this._length[0], 56),
this._block.writeUInt32LE(this._length[1], 60),
@@ -380,28 +341,24 @@ var require_ripemd160 = __commonJS({
HashBase = require_hash_base(),
ARRAY16 = new Array(16),
zl = [
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10,
- 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0,
- 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
- 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3,
+ 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0,
+ 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13,
],
zr = [
- 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0,
- 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8,
- 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10,
- 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11,
+ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15,
+ 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15,
+ 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11,
],
sl = [
- 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11,
- 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14,
- 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6,
- 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6,
+ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
+ 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
+ 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6,
],
sr = [
- 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7,
- 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12,
- 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12,
- 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11,
+ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
+ 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
+ 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11,
],
hl = [0, 1518500249, 1859775393, 2400959708, 2840853838],
hr = [1352829926, 1548603684, 1836072691, 2053994217, 0];
@@ -415,8 +372,7 @@ var require_ripemd160 = __commonJS({
}
inherits(RIPEMD160, HashBase);
RIPEMD160.prototype._update = function () {
- for (var words = ARRAY16, j = 0; j < 16; ++j)
- words[j] = this._block.readInt32LE(j * 4);
+ for (var words = ARRAY16, j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4);
for (
var al = this._a | 0,
bl = this._b | 0,
@@ -467,10 +423,7 @@ var require_ripemd160 = __commonJS({
};
RIPEMD160.prototype._digest = function () {
(this._block[this._blockOffset++] = 128),
- this._blockOffset > 56 &&
- (this._block.fill(0, this._blockOffset, 64),
- this._update(),
- (this._blockOffset = 0)),
+ this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), (this._blockOffset = 0)),
this._block.fill(0, this._blockOffset, 56),
this._block.writeUInt32LE(this._length[0], 56),
this._block.writeUInt32LE(this._length[1], 60),
@@ -518,28 +471,19 @@ var require_hash = __commonJS({
(this._len = 0);
}
Hash.prototype.update = function (data, enc) {
- typeof data == "string" &&
- ((enc = enc || "utf8"), (data = Buffer2.from(data, enc)));
+ typeof data == "string" && ((enc = enc || "utf8"), (data = Buffer2.from(data, enc)));
for (
- var block = this._block,
- blockSize = this._blockSize,
- length = data.length,
- accum = this._len,
- offset = 0;
+ var block = this._block, blockSize = this._blockSize, length = data.length, accum = this._len, offset = 0;
offset < length;
) {
for (
- var assigned = accum % blockSize,
- remainder = Math.min(length - offset, blockSize - assigned),
- i = 0;
+ var assigned = accum % blockSize, remainder = Math.min(length - offset, blockSize - assigned), i = 0;
i < remainder;
i++
)
block[assigned + i] = data[offset + i];
- (accum += remainder),
- (offset += remainder),
- accum % blockSize === 0 && this._update(block);
+ (accum += remainder), (offset += remainder), accum % blockSize === 0 && this._update(block);
}
return (this._len += length), this;
};
@@ -547,11 +491,9 @@ var require_hash = __commonJS({
var rem = this._len % this._blockSize;
(this._block[rem] = 128),
this._block.fill(0, rem + 1),
- rem >= this._finalSize &&
- (this._update(this._block), this._block.fill(0));
+ rem >= this._finalSize && (this._update(this._block), this._block.fill(0));
var bits = this._len * 8;
- if (bits <= 4294967295)
- this._block.writeUInt32BE(bits, this._blockSize - 4);
+ if (bits <= 4294967295) this._block.writeUInt32BE(bits, this._blockSize - 4);
else {
var lowBits = (bits & 4294967295) >>> 0,
highBits = (bits - lowBits) / 4294967296;
@@ -598,27 +540,16 @@ var require_sha = __commonJS({
return (num << 30) | (num >>> 2);
}
function ft(s, b, c, d) {
- return s === 0
- ? (b & c) | (~b & d)
- : s === 2
- ? (b & c) | (b & d) | (c & d)
- : b ^ c ^ d;
+ return s === 0 ? (b & c) | (~b & d) : s === 2 ? (b & c) | (b & d) | (c & d) : b ^ c ^ d;
}
Sha.prototype._update = function (M) {
for (
- var W2 = this._w,
- a = this._a | 0,
- b = this._b | 0,
- c = this._c | 0,
- d = this._d | 0,
- e = this._e | 0,
- i = 0;
+ var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;
i < 16;
++i
)
W2[i] = M.readInt32BE(i * 4);
- for (; i < 80; ++i)
- W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];
+ for (; i < 80; ++i) W2[i] = W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16];
for (var j = 0; j < 80; ++j) {
var s = ~~(j / 20),
t = (rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s]) | 0;
@@ -677,27 +608,16 @@ var require_sha1 = __commonJS({
return (num << 30) | (num >>> 2);
}
function ft(s, b, c, d) {
- return s === 0
- ? (b & c) | (~b & d)
- : s === 2
- ? (b & c) | (b & d) | (c & d)
- : b ^ c ^ d;
+ return s === 0 ? (b & c) | (~b & d) : s === 2 ? (b & c) | (b & d) | (c & d) : b ^ c ^ d;
}
Sha1.prototype._update = function (M) {
for (
- var W2 = this._w,
- a = this._a | 0,
- b = this._b | 0,
- c = this._c | 0,
- d = this._d | 0,
- e = this._e | 0,
- i = 0;
+ var W2 = this._w, a = this._a | 0, b = this._b | 0, c = this._c | 0, d = this._d | 0, e = this._e | 0, i = 0;
i < 16;
++i
)
W2[i] = M.readInt32BE(i * 4);
- for (; i < 80; ++i)
- W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
+ for (; i < 80; ++i) W2[i] = rotl1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16]);
for (var j = 0; j < 80; ++j) {
var s = ~~(j / 20),
t = (rotl5(a) + ft(s, b, c, d) + e + W2[j] + K[s]) | 0;
@@ -731,17 +651,14 @@ var require_sha256 = __commonJS({
Hash = require_hash(),
Buffer2 = require_safe_buffer().Buffer,
K = [
- 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993,
- 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987,
- 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774,
- 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986,
- 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711,
- 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,
- 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411,
- 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344,
- 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,
- 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424,
- 2428436474, 2756734187, 3204031479, 3329325298,
+ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080,
+ 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774,
+ 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808,
+ 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,
+ 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817,
+ 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,
+ 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479,
+ 3329325298,
],
W = new Array(64);
function Sha256() {
@@ -768,18 +685,10 @@ var require_sha256 = __commonJS({
return (x & y) | (z & (x | y));
}
function sigma0(x) {
- return (
- ((x >>> 2) | (x << 30)) ^
- ((x >>> 13) | (x << 19)) ^
- ((x >>> 22) | (x << 10))
- );
+ return ((x >>> 2) | (x << 30)) ^ ((x >>> 13) | (x << 19)) ^ ((x >>> 22) | (x << 10));
}
function sigma1(x) {
- return (
- ((x >>> 6) | (x << 26)) ^
- ((x >>> 11) | (x << 21)) ^
- ((x >>> 25) | (x << 7))
- );
+ return ((x >>> 6) | (x << 26)) ^ ((x >>> 11) | (x << 21)) ^ ((x >>> 25) | (x << 7));
}
function gamma0(x) {
return ((x >>> 7) | (x << 25)) ^ ((x >>> 18) | (x << 14)) ^ (x >>> 3);
@@ -803,20 +712,11 @@ var require_sha256 = __commonJS({
++i
)
W2[i] = M.readInt32BE(i * 4);
- for (; i < 64; ++i)
- W2[i] =
- (gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16]) | 0;
+ for (; i < 64; ++i) W2[i] = (gamma1(W2[i - 2]) + W2[i - 7] + gamma0(W2[i - 15]) + W2[i - 16]) | 0;
for (var j = 0; j < 64; ++j) {
var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W2[j]) | 0,
T2 = (sigma0(a) + maj(a, b, c)) | 0;
- (h = g),
- (g = f),
- (f = e),
- (e = (d + T1) | 0),
- (d = c),
- (c = b),
- (b = a),
- (a = (T1 + T2) | 0);
+ (h = g), (g = f), (f = e), (e = (d + T1) | 0), (d = c), (c = b), (b = a), (a = (T1 + T2) | 0);
}
(this._a = (a + this._a) | 0),
(this._b = (b + this._b) | 0),
@@ -894,33 +794,24 @@ var require_sha512 = __commonJS({
Hash = require_hash(),
Buffer2 = require_safe_buffer().Buffer,
K = [
- 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399,
- 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265,
- 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394,
- 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994,
- 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317,
- 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139,
- 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901,
- 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837,
- 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879,
- 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901,
- 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964,
- 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823,
- 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142,
- 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273,
- 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344,
- 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720,
- 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593,
- 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403,
- 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012,
- 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044,
- 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573,
- 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711,
- 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554,
- 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315,
- 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100,
- 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866,
- 1607167915, 987167468, 1816402316, 1246189591,
+ 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163,
+ 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394,
+ 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206,
+ 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139,
+ 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692,
+ 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879,
+ 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895,
+ 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823,
+ 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921,
+ 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344,
+ 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616,
+ 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403,
+ 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452,
+ 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573,
+ 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271,
+ 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315,
+ 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470,
+ 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591,
],
W = new Array(160);
function Sha512() {
@@ -955,38 +846,22 @@ var require_sha512 = __commonJS({
return (x & y) | (z & (x | y));
}
function sigma0(x, xl) {
- return (
- ((x >>> 28) | (xl << 4)) ^
- ((xl >>> 2) | (x << 30)) ^
- ((xl >>> 7) | (x << 25))
- );
+ return ((x >>> 28) | (xl << 4)) ^ ((xl >>> 2) | (x << 30)) ^ ((xl >>> 7) | (x << 25));
}
function sigma1(x, xl) {
- return (
- ((x >>> 14) | (xl << 18)) ^
- ((x >>> 18) | (xl << 14)) ^
- ((xl >>> 9) | (x << 23))
- );
+ return ((x >>> 14) | (xl << 18)) ^ ((x >>> 18) | (xl << 14)) ^ ((xl >>> 9) | (x << 23));
}
function Gamma0(x, xl) {
return ((x >>> 1) | (xl << 31)) ^ ((x >>> 8) | (xl << 24)) ^ (x >>> 7);
}
function Gamma0l(x, xl) {
- return (
- ((x >>> 1) | (xl << 31)) ^
- ((x >>> 8) | (xl << 24)) ^
- ((x >>> 7) | (xl << 25))
- );
+ return ((x >>> 1) | (xl << 31)) ^ ((x >>> 8) | (xl << 24)) ^ ((x >>> 7) | (xl << 25));
}
function Gamma1(x, xl) {
return ((x >>> 19) | (xl << 13)) ^ ((xl >>> 29) | (x << 3)) ^ (x >>> 6);
}
function Gamma1l(x, xl) {
- return (
- ((x >>> 19) | (xl << 13)) ^
- ((xl >>> 29) | (x << 3)) ^
- ((x >>> 6) | (xl << 26))
- );
+ return ((x >>> 19) | (xl << 13)) ^ ((xl >>> 29) | (x << 3)) ^ ((x >>> 6) | (xl << 26));
}
function getCarry(a, b) {
return a >>> 0 < b >>> 0 ? 1 : 0;
@@ -1171,10 +1046,7 @@ var require_sha2 = __commonJS({
var exports = (module.exports = function (algorithm) {
algorithm = algorithm.toLowerCase();
var Algorithm = exports[algorithm];
- if (!Algorithm)
- throw new Error(
- algorithm + " is not supported (we accept pull requests)",
- );
+ if (!Algorithm) throw new Error(algorithm + " is not supported (we accept pull requests)");
return new Algorithm();
});
exports.sha = require_sha();
@@ -1199,9 +1071,7 @@ var require_cipher_base = __commonJS({
function CipherBase(hashMode) {
Transform.call(this),
(this.hashMode = typeof hashMode == "string"),
- this.hashMode
- ? (this[hashMode] = this._finalOrDigest)
- : (this.final = this._finalOrDigest),
+ this.hashMode ? (this[hashMode] = this._finalOrDigest) : (this.final = this._finalOrDigest),
this._final && ((this.__final = this._final), (this._final = null)),
(this._decoder = null),
(this._encoding = null);
@@ -1210,10 +1080,7 @@ var require_cipher_base = __commonJS({
CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
typeof data == "string" && (data = Buffer2.from(data, inputEnc));
var outData = this._update(data);
- return this.hashMode
- ? this
- : (outputEnc && (outData = this._toString(outData, outputEnc)),
- outData);
+ return this.hashMode ? this : (outputEnc && (outData = this._toString(outData, outputEnc)), outData);
};
CipherBase.prototype.setAutoPadding = function () {};
CipherBase.prototype.getAuthTag = function () {
@@ -1246,16 +1113,10 @@ var require_cipher_base = __commonJS({
};
CipherBase.prototype._finalOrDigest = function (outputEnc) {
var outData = this.__final() || Buffer2.alloc(0);
- return (
- outputEnc && (outData = this._toString(outData, outputEnc, !0)), outData
- );
+ return outputEnc && (outData = this._toString(outData, outputEnc, !0)), outData;
};
CipherBase.prototype._toString = function (value, enc, fin) {
- if (
- (this._decoder ||
- ((this._decoder = new StringDecoder(enc)), (this._encoding = enc)),
- this._encoding !== enc)
- )
+ if ((this._decoder || ((this._decoder = new StringDecoder(enc)), (this._encoding = enc)), this._encoding !== enc))
throw new Error("can't switch encodings");
var out = this._decoder.write(value);
return fin && (out += this._decoder.end()), out;
@@ -1346,8 +1207,7 @@ var require_legacy = __commonJS({
(this._key = key),
key.length > blocksize
? (key = alg(key))
- : key.length < blocksize &&
- (key = Buffer2.concat([key, ZEROS], blocksize));
+ : key.length < blocksize && (key = Buffer2.concat([key, ZEROS], blocksize));
for (
var ipad = (this._ipad = Buffer2.allocUnsafe(blocksize)),
opad = (this._opad = Buffer2.allocUnsafe(blocksize)),
@@ -1393,15 +1253,12 @@ var require_browser3 = __commonJS({
sha = require_sha2(),
ZEROS = Buffer2.alloc(128);
function Hmac(alg, key) {
- Base.call(this, "digest"),
- typeof key == "string" && (key = Buffer2.from(key));
+ Base.call(this, "digest"), typeof key == "string" && (key = Buffer2.from(key));
var blocksize = alg === "sha512" || alg === "sha384" ? 128 : 64;
if (((this._alg = alg), (this._key = key), key.length > blocksize)) {
var hash = alg === "rmd160" ? new RIPEMD160() : sha(alg);
key = hash.update(key).digest();
- } else
- key.length < blocksize &&
- (key = Buffer2.concat([key, ZEROS], blocksize));
+ } else key.length < blocksize && (key = Buffer2.concat([key, ZEROS], blocksize));
for (
var ipad = (this._ipad = Buffer2.allocUnsafe(blocksize)),
opad = (this._opad = Buffer2.allocUnsafe(blocksize)),
@@ -1410,8 +1267,7 @@ var require_browser3 = __commonJS({
i++
)
(ipad[i] = key[i] ^ 54), (opad[i] = key[i] ^ 92);
- (this._hash = alg === "rmd160" ? new RIPEMD160() : sha(alg)),
- this._hash.update(ipad);
+ (this._hash = alg === "rmd160" ? new RIPEMD160() : sha(alg)), this._hash.update(ipad);
}
inherits(Hmac, Base);
Hmac.prototype._update = function (data) {
@@ -1605,13 +1461,10 @@ var require_precondition = __commonJS({
"node_modules/pbkdf2/lib/precondition.js"(exports, module) {
var MAX_ALLOC = Math.pow(2, 30) - 1;
module.exports = function (iterations, keylen) {
- if (typeof iterations != "number")
- throw new TypeError("Iterations not a number");
+ if (typeof iterations != "number") throw new TypeError("Iterations not a number");
if (iterations < 0) throw new TypeError("Bad iterations");
- if (typeof keylen != "number")
- throw new TypeError("Key length not a number");
- if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen)
- throw new TypeError("Bad key length");
+ if (typeof keylen != "number") throw new TypeError("Key length not a number");
+ if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) throw new TypeError("Bad key length");
};
},
});
@@ -1639,9 +1492,7 @@ var require_to_buffer = __commonJS({
if (Buffer2.isBuffer(thing)) return thing;
if (typeof thing == "string") return Buffer2.from(thing, encoding);
if (ArrayBuffer.isView(thing)) return Buffer2.from(thing.buffer);
- throw new TypeError(
- name + " must be a string, a Buffer, a typed array or a DataView",
- );
+ throw new TypeError(name + " must be a string, a Buffer, a typed array or a DataView");
};
},
});
@@ -1672,8 +1523,7 @@ var require_sync_browser = __commonJS({
blocksize = alg === "sha512" || alg === "sha384" ? 128 : 64;
key.length > blocksize
? (key = hash(key))
- : key.length < blocksize &&
- (key = Buffer2.concat([key, ZEROS], blocksize));
+ : key.length < blocksize && (key = Buffer2.concat([key, ZEROS], blocksize));
for (
var ipad = Buffer2.allocUnsafe(blocksize + sizes[alg]),
opad = Buffer2.allocUnsafe(blocksize + sizes[alg]),
@@ -1704,11 +1554,7 @@ var require_sync_browser = __commonJS({
function rmd160Func(data) {
return new RIPEMD160().update(data).digest();
}
- return alg === "rmd160" || alg === "ripemd160"
- ? rmd160Func
- : alg === "md5"
- ? md5
- : shaFunc;
+ return alg === "rmd160" || alg === "ripemd160" ? rmd160Func : alg === "md5" ? md5 : shaFunc;
}
function pbkdf2(password, salt, iterations, keylen, digest) {
checkParameters(iterations, keylen),
@@ -1719,20 +1565,9 @@ var require_sync_browser = __commonJS({
DK = Buffer2.allocUnsafe(keylen),
block1 = Buffer2.allocUnsafe(salt.length + 4);
salt.copy(block1, 0, 0, salt.length);
- for (
- var destPos = 0,
- hLen = sizes[digest],
- l = Math.ceil(keylen / hLen),
- i = 1;
- i <= l;
- i++
- ) {
+ for (var destPos = 0, hLen = sizes[digest], l = Math.ceil(keylen / hLen), i = 1; i <= l; i++) {
block1.writeUInt32BE(i, salt.length);
- for (
- var T = hmac.run(block1, hmac.ipad1), U = T, j = 1;
- j < iterations;
- j++
- ) {
+ for (var T = hmac.run(block1, hmac.ipad1), U = T, j = 1; j < iterations; j++) {
U = hmac.run(U, hmac.ipad2);
for (var k = 0; k < hLen; k++) T[k] ^= U[k];
}
@@ -1767,12 +1602,7 @@ var require_async = __commonJS({
},
checks = [];
function checkNative(algo) {
- if (
- (global.process && !global.process.browser) ||
- !subtle ||
- !subtle.importKey ||
- !subtle.deriveBits
- )
+ if ((global.process && !global.process.browser) || !subtle || !subtle.importKey || !subtle.deriveBits)
return Promise.resolve(!1);
if (checks[algo] !== void 0) return checks[algo];
ZERO_BUF = ZERO_BUF || Buffer2.alloc(8);
@@ -1834,16 +1664,8 @@ var require_async = __commonJS({
},
);
}
- module.exports = function (
- password,
- salt,
- iterations,
- keylen,
- digest,
- callback,
- ) {
- typeof digest == "function" && ((callback = digest), (digest = void 0)),
- (digest = digest || "sha1");
+ module.exports = function (password, salt, iterations, keylen, digest, callback) {
+ typeof digest == "function" && ((callback = digest), (digest = void 0)), (digest = digest || "sha1");
var algo = toBrowser[digest.toLowerCase()];
if (!algo || typeof global.Promise != "function") {
getNextTick()(function () {
@@ -1889,11 +1711,7 @@ var require_utils = __commonJS({
"node_modules/des.js/lib/des/utils.js"(exports) {
"use strict";
exports.readUInt32BE = function (bytes, off) {
- var res =
- (bytes[0 + off] << 24) |
- (bytes[1 + off] << 16) |
- (bytes[2 + off] << 8) |
- bytes[3 + off];
+ var res = (bytes[0 + off] << 24) | (bytes[1 + off] << 16) | (bytes[2 + off] << 8) | bytes[3 + off];
return res >>> 0;
};
exports.writeUInt32BE = function (bytes, value, off) {
@@ -1904,70 +1722,48 @@ var require_utils = __commonJS({
};
exports.ip = function (inL, inR, out, off) {
for (var outL = 0, outR = 0, i = 6; i >= 0; i -= 2) {
- for (var j = 0; j <= 24; j += 8)
- (outL <<= 1), (outL |= (inR >>> (j + i)) & 1);
- for (var j = 0; j <= 24; j += 8)
- (outL <<= 1), (outL |= (inL >>> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outL <<= 1), (outL |= (inR >>> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outL <<= 1), (outL |= (inL >>> (j + i)) & 1);
}
for (var i = 6; i >= 0; i -= 2) {
- for (var j = 1; j <= 25; j += 8)
- (outR <<= 1), (outR |= (inR >>> (j + i)) & 1);
- for (var j = 1; j <= 25; j += 8)
- (outR <<= 1), (outR |= (inL >>> (j + i)) & 1);
+ for (var j = 1; j <= 25; j += 8) (outR <<= 1), (outR |= (inR >>> (j + i)) & 1);
+ for (var j = 1; j <= 25; j += 8) (outR <<= 1), (outR |= (inL >>> (j + i)) & 1);
}
(out[off + 0] = outL >>> 0), (out[off + 1] = outR >>> 0);
};
exports.rip = function (inL, inR, out, off) {
for (var outL = 0, outR = 0, i = 0; i < 4; i++)
for (var j = 24; j >= 0; j -= 8)
- (outL <<= 1),
- (outL |= (inR >>> (j + i)) & 1),
- (outL <<= 1),
- (outL |= (inL >>> (j + i)) & 1);
+ (outL <<= 1), (outL |= (inR >>> (j + i)) & 1), (outL <<= 1), (outL |= (inL >>> (j + i)) & 1);
for (var i = 4; i < 8; i++)
for (var j = 24; j >= 0; j -= 8)
- (outR <<= 1),
- (outR |= (inR >>> (j + i)) & 1),
- (outR <<= 1),
- (outR |= (inL >>> (j + i)) & 1);
+ (outR <<= 1), (outR |= (inR >>> (j + i)) & 1), (outR <<= 1), (outR |= (inL >>> (j + i)) & 1);
(out[off + 0] = outL >>> 0), (out[off + 1] = outR >>> 0);
};
exports.pc1 = function (inL, inR, out, off) {
for (var outL = 0, outR = 0, i = 7; i >= 5; i--) {
- for (var j = 0; j <= 24; j += 8)
- (outL <<= 1), (outL |= (inR >> (j + i)) & 1);
- for (var j = 0; j <= 24; j += 8)
- (outL <<= 1), (outL |= (inL >> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outL <<= 1), (outL |= (inR >> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outL <<= 1), (outL |= (inL >> (j + i)) & 1);
}
- for (var j = 0; j <= 24; j += 8)
- (outL <<= 1), (outL |= (inR >> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outL <<= 1), (outL |= (inR >> (j + i)) & 1);
for (var i = 1; i <= 3; i++) {
- for (var j = 0; j <= 24; j += 8)
- (outR <<= 1), (outR |= (inR >> (j + i)) & 1);
- for (var j = 0; j <= 24; j += 8)
- (outR <<= 1), (outR |= (inL >> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outR <<= 1), (outR |= (inR >> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outR <<= 1), (outR |= (inL >> (j + i)) & 1);
}
- for (var j = 0; j <= 24; j += 8)
- (outR <<= 1), (outR |= (inL >> (j + i)) & 1);
+ for (var j = 0; j <= 24; j += 8) (outR <<= 1), (outR |= (inL >> (j + i)) & 1);
(out[off + 0] = outL >>> 0), (out[off + 1] = outR >>> 0);
};
exports.r28shl = function (num, shift) {
return ((num << shift) & 268435455) | (num >>> (28 - shift));
};
var pc2table = [
- 14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21,
- 1, 8, 15, 26, 15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22,
- 3, 10, 14, 6, 20, 27, 24,
+ 14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, 15, 4, 25, 19, 9, 1, 26,
+ 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24,
];
exports.pc2 = function (inL, inR, out, off) {
- for (
- var outL = 0, outR = 0, len = pc2table.length >>> 1, i = 0;
- i < len;
- i++
- )
+ for (var outL = 0, outR = 0, len = pc2table.length >>> 1, i = 0; i < len; i++)
(outL <<= 1), (outL |= (inL >>> pc2table[i]) & 1);
- for (var i = len; i < pc2table.length; i++)
- (outR <<= 1), (outR |= (inR >>> pc2table[i]) & 1);
+ for (var i = len; i < pc2table.length; i++) (outR <<= 1), (outR |= (inR >>> pc2table[i]) & 1);
(out[off + 0] = outL >>> 0), (out[off + 1] = outR >>> 0);
};
exports.expand = function (r, out, off) {
@@ -1976,35 +1772,25 @@ var require_utils = __commonJS({
outL = ((r & 1) << 5) | (r >>> 27);
for (var i = 23; i >= 15; i -= 4) (outL <<= 6), (outL |= (r >>> i) & 63);
for (var i = 11; i >= 3; i -= 4) (outR |= (r >>> i) & 63), (outR <<= 6);
- (outR |= ((r & 31) << 1) | (r >>> 31)),
- (out[off + 0] = outL >>> 0),
- (out[off + 1] = outR >>> 0);
+ (outR |= ((r & 31) << 1) | (r >>> 31)), (out[off + 0] = outL >>> 0), (out[off + 1] = outR >>> 0);
};
var sTable = [
- 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6,
- 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6,
- 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15,
- 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13,
- 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15,
- 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13,
- 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14,
- 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8,
- 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13,
- 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1,
- 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13,
- 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4,
- 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0,
- 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15,
- 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15,
- 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3,
- 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14,
- 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4,
- 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
- 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0,
- 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3,
- 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2,
- 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13,
- 0, 15, 3, 3, 5, 5, 6, 8, 11,
+ 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15,
+ 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, 3, 1, 13,
+ 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10,
+ 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9,
+ 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6,
+ 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6,
+ 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7,
+ 13, 13, 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13,
+ 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
+ 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6,
+ 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0,
+ 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, 3, 14, 12, 3,
+ 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0,
+ 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11,
+ 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3,
+ 3, 5, 5, 6, 8, 11,
];
exports.substitute = function (inL, inR) {
for (var out = 0, i = 0; i < 4; i++) {
@@ -2020,18 +1806,16 @@ var require_utils = __commonJS({
return out >>> 0;
};
var permuteTable = [
- 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18,
- 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7,
+ 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28,
+ 7,
];
exports.permute = function (num) {
- for (var out = 0, i = 0; i < permuteTable.length; i++)
- (out <<= 1), (out |= (num >>> permuteTable[i]) & 1);
+ for (var out = 0, i = 0; i < permuteTable.length; i++) (out <<= 1), (out |= (num >>> permuteTable[i]) & 1);
return out >>> 0;
};
exports.padSplit = function (num, size, group) {
for (var str = num.toString(2); str.length < size; ) str = "0" + str;
- for (var out = [], i = 0; i < size; i += group)
- out.push(str.slice(i, i + group));
+ for (var out = [], i = 0; i < size; i += group) out.push(str.slice(i, i + group));
return out.join(" ");
};
},
@@ -2066,31 +1850,15 @@ var require_cipher = __commonJS({
module.exports = Cipher;
Cipher.prototype._init = function () {};
Cipher.prototype.update = function (data) {
- return data.length === 0
- ? []
- : this.type === "decrypt"
- ? this._updateDecrypt(data)
- : this._updateEncrypt(data);
+ return data.length === 0 ? [] : this.type === "decrypt" ? this._updateDecrypt(data) : this._updateEncrypt(data);
};
Cipher.prototype._buffer = function (data, off) {
- for (
- var min = Math.min(
- this.buffer.length - this.bufferOff,
- data.length - off,
- ),
- i = 0;
- i < min;
- i++
- )
+ for (var min = Math.min(this.buffer.length - this.bufferOff, data.length - off), i = 0; i < min; i++)
this.buffer[this.bufferOff + i] = data[off + i];
return (this.bufferOff += min), min;
};
Cipher.prototype._flushBuffer = function (out, off) {
- return (
- this._update(this.buffer, 0, out, off),
- (this.bufferOff = 0),
- this.blockSize
- );
+ return this._update(this.buffer, 0, out, off), (this.bufferOff = 0), this.blockSize;
};
Cipher.prototype._updateEncrypt = function (data) {
var inputOff = 0,
@@ -2099,31 +1867,26 @@ var require_cipher = __commonJS({
out = new Array(count * this.blockSize);
this.bufferOff !== 0 &&
((inputOff += this._buffer(data, inputOff)),
- this.bufferOff === this.buffer.length &&
- (outputOff += this._flushBuffer(out, outputOff)));
+ this.bufferOff === this.buffer.length && (outputOff += this._flushBuffer(out, outputOff)));
for (
var max = data.length - ((data.length - inputOff) % this.blockSize);
inputOff < max;
inputOff += this.blockSize
)
- this._update(data, inputOff, out, outputOff),
- (outputOff += this.blockSize);
- for (; inputOff < data.length; inputOff++, this.bufferOff++)
- this.buffer[this.bufferOff] = data[inputOff];
+ this._update(data, inputOff, out, outputOff), (outputOff += this.blockSize);
+ for (; inputOff < data.length; inputOff++, this.bufferOff++) this.buffer[this.bufferOff] = data[inputOff];
return out;
};
Cipher.prototype._updateDecrypt = function (data) {
for (
var inputOff = 0,
outputOff = 0,
- count =
- Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1,
+ count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1,
out = new Array(count * this.blockSize);
count > 0;
count--
)
- (inputOff += this._buffer(data, inputOff)),
- (outputOff += this._flushBuffer(out, outputOff));
+ (inputOff += this._buffer(data, inputOff)), (outputOff += this._flushBuffer(out, outputOff));
return (inputOff += this._buffer(data, inputOff)), out;
};
Cipher.prototype.final = function (buffer) {
@@ -2131,9 +1894,7 @@ var require_cipher = __commonJS({
buffer && (first = this.update(buffer));
var last;
return (
- this.type === "encrypt"
- ? (last = this._finalEncrypt())
- : (last = this._finalDecrypt()),
+ this.type === "encrypt" ? (last = this._finalEncrypt()) : (last = this._finalDecrypt()),
first ? first.concat(last) : last
);
};
@@ -2151,11 +1912,7 @@ var require_cipher = __commonJS({
return buffer;
};
Cipher.prototype._finalDecrypt = function () {
- assert.equal(
- this.bufferOff,
- this.blockSize,
- "Not enough data to decrypt",
- );
+ assert.equal(this.bufferOff, this.blockSize, "Not enough data to decrypt");
var out = new Array(this.blockSize);
return this._flushBuffer(out, 0), this._unpad(out);
};
@@ -2185,16 +1942,13 @@ var require_des = __commonJS({
};
var shiftTable = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];
DES.prototype.deriveKeys = function (state, key) {
- (state.keys = new Array(16 * 2)),
- assert.equal(key.length, this.blockSize, "Invalid key length");
+ (state.keys = new Array(16 * 2)), assert.equal(key.length, this.blockSize, "Invalid key length");
var kL = utils.readUInt32BE(key, 0),
kR = utils.readUInt32BE(key, 4);
utils.pc1(kL, kR, state.tmp, 0), (kL = state.tmp[0]), (kR = state.tmp[1]);
for (var i = 0; i < state.keys.length; i += 2) {
var shift = shiftTable[i >>> 1];
- (kL = utils.r28shl(kL, shift)),
- (kR = utils.r28shl(kR, shift)),
- utils.pc2(kL, kR, state.keys, i);
+ (kL = utils.r28shl(kL, shift)), (kR = utils.r28shl(kR, shift)), utils.pc2(kL, kR, state.keys, i);
}
};
DES.prototype._update = function (inp, inOff, out, outOff) {
@@ -2204,25 +1958,18 @@ var require_des = __commonJS({
utils.ip(l, r, state.tmp, 0),
(l = state.tmp[0]),
(r = state.tmp[1]),
- this.type === "encrypt"
- ? this._encrypt(state, l, r, state.tmp, 0)
- : this._decrypt(state, l, r, state.tmp, 0),
+ this.type === "encrypt" ? this._encrypt(state, l, r, state.tmp, 0) : this._decrypt(state, l, r, state.tmp, 0),
(l = state.tmp[0]),
(r = state.tmp[1]),
utils.writeUInt32BE(out, l, outOff),
utils.writeUInt32BE(out, r, outOff + 4);
};
DES.prototype._pad = function (buffer, off) {
- for (var value = buffer.length - off, i = off; i < buffer.length; i++)
- buffer[i] = value;
+ for (var value = buffer.length - off, i = off; i < buffer.length; i++) buffer[i] = value;
return !0;
};
DES.prototype._unpad = function (buffer) {
- for (
- var pad = buffer[buffer.length - 1], i = buffer.length - pad;
- i < buffer.length;
- i++
- )
+ for (var pad = buffer[buffer.length - 1], i = buffer.length - pad; i < buffer.length; i++)
assert.equal(buffer[i], pad);
return buffer.slice(0, buffer.length - pad);
};
@@ -2230,9 +1977,7 @@ var require_des = __commonJS({
for (var l = lStart, r = rStart, i = 0; i < state.keys.length; i += 2) {
var keyL = state.keys[i],
keyR = state.keys[i + 1];
- utils.expand(r, state.tmp, 0),
- (keyL ^= state.tmp[0]),
- (keyR ^= state.tmp[1]);
+ utils.expand(r, state.tmp, 0), (keyL ^= state.tmp[0]), (keyR ^= state.tmp[1]);
var s = utils.substitute(keyL, keyR),
f = utils.permute(s),
t = r;
@@ -2241,16 +1986,10 @@ var require_des = __commonJS({
utils.rip(r, l, out, off);
};
DES.prototype._decrypt = function (state, lStart, rStart, out, off) {
- for (
- var l = rStart, r = lStart, i = state.keys.length - 2;
- i >= 0;
- i -= 2
- ) {
+ for (var l = rStart, r = lStart, i = state.keys.length - 2; i >= 0; i -= 2) {
var keyL = state.keys[i],
keyR = state.keys[i + 1];
- utils.expand(l, state.tmp, 0),
- (keyL ^= state.tmp[0]),
- (keyR ^= state.tmp[1]);
+ utils.expand(l, state.tmp, 0), (keyL ^= state.tmp[0]), (keyR ^= state.tmp[1]);
var s = utils.substitute(keyL, keyR),
f = utils.permute(s),
t = l;
@@ -2395,8 +2134,7 @@ var require_browserify_des = __commonJS({
opts.decrypt ? (type = "decrypt") : (type = "encrypt");
var key = opts.key;
Buffer2.isBuffer(key) || (key = Buffer2.from(key)),
- (modeName === "des-ede" || modeName === "des-ede-cbc") &&
- (key = Buffer2.concat([key, key.slice(0, 8)]));
+ (modeName === "des-ede" || modeName === "des-ede-cbc") && (key = Buffer2.concat([key, key.slice(0, 8)]));
var iv = opts.iv;
Buffer2.isBuffer(iv) || (iv = Buffer2.from(iv)),
(this._des = mode.create({
@@ -2430,13 +2168,7 @@ var require_ecb = __commonJS({
var require_buffer_xor = __commonJS({
"node_modules/buffer-xor/index.js"(exports, module) {
module.exports = function (a, b) {
- for (
- var length = Math.min(a.length, b.length),
- buffer = new Buffer(length),
- i = 0;
- i < length;
- ++i
- )
+ for (var length = Math.min(a.length, b.length), buffer = new Buffer(length), i = 0; i < length; ++i)
buffer[i] = a[i] ^ b[i];
return buffer;
};
@@ -2478,15 +2210,11 @@ var require_cfb = __commonJS({
for (var out = Buffer2.allocUnsafe(0), len; data.length; )
if (
(self2._cache.length === 0 &&
- ((self2._cache = self2._cipher.encryptBlock(self2._prev)),
- (self2._prev = Buffer2.allocUnsafe(0))),
+ ((self2._cache = self2._cipher.encryptBlock(self2._prev)), (self2._prev = Buffer2.allocUnsafe(0))),
self2._cache.length <= data.length)
)
(len = self2._cache.length),
- (out = Buffer2.concat([
- out,
- encryptStart(self2, data.slice(0, len), decrypt),
- ])),
+ (out = Buffer2.concat([out, encryptStart(self2, data.slice(0, len), decrypt)])),
(data = data.slice(len));
else {
out = Buffer2.concat([out, encryptStart(self2, data, decrypt)]);
@@ -2504,20 +2232,10 @@ var require_cfb8 = __commonJS({
function encryptByte(self2, byteParam, decrypt) {
var pad = self2._cipher.encryptBlock(self2._prev),
out = pad[0] ^ byteParam;
- return (
- (self2._prev = Buffer2.concat([
- self2._prev.slice(1),
- Buffer2.from([decrypt ? byteParam : out]),
- ])),
- out
- );
+ return (self2._prev = Buffer2.concat([self2._prev.slice(1), Buffer2.from([decrypt ? byteParam : out])])), out;
}
exports.encrypt = function (self2, chunk, decrypt) {
- for (
- var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;
- ++i < len;
-
- )
+ for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1; ++i < len; )
out[i] = encryptByte(self2, chunk[i], decrypt);
return out;
};
@@ -2541,20 +2259,12 @@ var require_cfb1 = __commonJS({
var len = buffer.length,
i = -1,
out = Buffer2.allocUnsafe(buffer.length);
- for (
- buffer = Buffer2.concat([buffer, Buffer2.from([value])]);
- ++i < len;
-
- )
+ for (buffer = Buffer2.concat([buffer, Buffer2.from([value])]); ++i < len; )
out[i] = (buffer[i] << 1) | (buffer[i + 1] >> 7);
return out;
}
exports.encrypt = function (self2, chunk, decrypt) {
- for (
- var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1;
- ++i < len;
-
- )
+ for (var len = chunk.length, out = Buffer2.allocUnsafe(len), i = -1; ++i < len; )
out[i] = encryptByte(self2, chunk[i], decrypt);
return out;
};
@@ -2566,13 +2276,10 @@ var require_ofb = __commonJS({
"node_modules/browserify-aes/modes/ofb.js"(exports) {
var xor = require_buffer_xor();
function getBlock(self2) {
- return (
- (self2._prev = self2._cipher.encryptBlock(self2._prev)), self2._prev
- );
+ return (self2._prev = self2._cipher.encryptBlock(self2._prev)), self2._prev;
}
exports.encrypt = function (self2, chunk) {
- for (; self2._cache.length < chunk.length; )
- self2._cache = Buffer.concat([self2._cache, getBlock(self2)]);
+ for (; self2._cache.length < chunk.length; ) self2._cache = Buffer.concat([self2._cache, getBlock(self2)]);
var pad = self2._cache.slice(0, chunk.length);
return (self2._cache = self2._cache.slice(chunk.length)), xor(chunk, pad);
};
@@ -2608,10 +2315,7 @@ var require_ctr = __commonJS({
exports.encrypt = function (self2, chunk) {
var chunkNum = Math.ceil(chunk.length / blockSize),
start = self2._cache.length;
- self2._cache = Buffer2.concat([
- self2._cache,
- Buffer2.allocUnsafe(chunkNum * blockSize),
- ]);
+ self2._cache = Buffer2.concat([self2._cache, Buffer2.allocUnsafe(chunkNum * blockSize)]);
for (var i = 0; i < chunkNum; i++) {
var out = getBlock(self2),
offset = start + i * blockSize;
@@ -2849,12 +2553,7 @@ var require_aes = __commonJS({
var Buffer2 = require_safe_buffer().Buffer;
function asUInt32Array(buf) {
Buffer2.isBuffer(buf) || (buf = Buffer2.from(buf));
- for (
- var len = (buf.length / 4) | 0, out = new Array(len), i = 0;
- i < len;
- i++
- )
- out[i] = buf.readUInt32BE(i * 4);
+ for (var len = (buf.length / 4) | 0, out = new Array(len), i = 0; i < len; i++) out[i] = buf.readUInt32BE(i * 4);
return out;
}
function scrubVec(v) {
@@ -2909,28 +2608,16 @@ var require_aes = __commonJS({
(s3 = t3);
return (
(t0 =
- ((SBOX[s0 >>> 24] << 24) |
- (SBOX[(s1 >>> 16) & 255] << 16) |
- (SBOX[(s2 >>> 8) & 255] << 8) |
- SBOX[s3 & 255]) ^
+ ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 255] << 16) | (SBOX[(s2 >>> 8) & 255] << 8) | SBOX[s3 & 255]) ^
keySchedule[ksRow++]),
(t1 =
- ((SBOX[s1 >>> 24] << 24) |
- (SBOX[(s2 >>> 16) & 255] << 16) |
- (SBOX[(s3 >>> 8) & 255] << 8) |
- SBOX[s0 & 255]) ^
+ ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 255] << 16) | (SBOX[(s3 >>> 8) & 255] << 8) | SBOX[s0 & 255]) ^
keySchedule[ksRow++]),
(t2 =
- ((SBOX[s2 >>> 24] << 24) |
- (SBOX[(s3 >>> 16) & 255] << 16) |
- (SBOX[(s0 >>> 8) & 255] << 8) |
- SBOX[s1 & 255]) ^
+ ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 255] << 16) | (SBOX[(s0 >>> 8) & 255] << 8) | SBOX[s1 & 255]) ^
keySchedule[ksRow++]),
(t3 =
- ((SBOX[s3 >>> 24] << 24) |
- (SBOX[(s0 >>> 16) & 255] << 16) |
- (SBOX[(s1 >>> 8) & 255] << 8) |
- SBOX[s2 & 255]) ^
+ ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 255] << 16) | (SBOX[(s1 >>> 8) & 255] << 8) | SBOX[s2 & 255]) ^
keySchedule[ksRow++]),
(t0 = t0 >>> 0),
(t1 = t1 >>> 0),
@@ -2941,8 +2628,7 @@ var require_aes = __commonJS({
}
var RCON = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54],
G = (function () {
- for (var d = new Array(256), j = 0; j < 256; j++)
- j < 128 ? (d[j] = j << 1) : (d[j] = (j << 1) ^ 283);
+ for (var d = new Array(256), j = 0; j < 256; j++) j < 128 ? (d[j] = j << 1) : (d[j] = (j << 1) ^ 283);
for (
var SBOX = [],
INV_SBOX = [],
@@ -2955,9 +2641,7 @@ var require_aes = __commonJS({
++i
) {
var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
- (sx = (sx >>> 8) ^ (sx & 255) ^ 99),
- (SBOX[x] = sx),
- (INV_SBOX[sx] = x);
+ (sx = (sx >>> 8) ^ (sx & 255) ^ 99), (SBOX[x] = sx), (INV_SBOX[sx] = x);
var x2 = d[x],
x4 = d[x2],
x8 = d[x4],
@@ -2971,9 +2655,7 @@ var require_aes = __commonJS({
(INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)),
(INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)),
(INV_SUB_MIX[3][sx] = t),
- x === 0
- ? (x = xi = 1)
- : ((x = x2 ^ d[d[d[x8 ^ x2]]]), (xi ^= d[d[xi]]));
+ x === 0 ? (x = xi = 1) : ((x = x2 ^ d[d[d[x8 ^ x2]]]), (xi ^= d[d[xi]]));
}
return {
SBOX,
@@ -3031,15 +2713,10 @@ var require_aes = __commonJS({
G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 255]] ^
G.INV_SUB_MIX[3][G.SBOX[tt & 255]]);
}
- (this._nRounds = nRounds),
- (this._keySchedule = keySchedule),
- (this._invKeySchedule = invKeySchedule);
+ (this._nRounds = nRounds), (this._keySchedule = keySchedule), (this._invKeySchedule = invKeySchedule);
};
AES.prototype.encryptBlockRaw = function (M) {
- return (
- (M = asUInt32Array(M)),
- cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)
- );
+ return (M = asUInt32Array(M)), cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);
};
AES.prototype.encryptBlock = function (M) {
var out = this.encryptBlockRaw(M),
@@ -3056,13 +2733,7 @@ var require_aes = __commonJS({
M = asUInt32Array(M);
var m1 = M[1];
(M[1] = M[3]), (M[3] = m1);
- var out = cryptBlock(
- M,
- this._invKeySchedule,
- G.INV_SUB_MIX,
- G.INV_SBOX,
- this._nRounds,
- ),
+ var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds),
buf = Buffer2.allocUnsafe(16);
return (
buf.writeUInt32BE(out[0], 0),
@@ -3073,9 +2744,7 @@ var require_aes = __commonJS({
);
};
AES.prototype.scrub = function () {
- scrubVec(this._keySchedule),
- scrubVec(this._invKeySchedule),
- scrubVec(this._key);
+ scrubVec(this._keySchedule), scrubVec(this._invKeySchedule), scrubVec(this._key);
};
module.exports.AES = AES;
},
@@ -3087,12 +2756,7 @@ var require_ghash = __commonJS({
var Buffer2 = require_safe_buffer().Buffer,
ZEROES = Buffer2.alloc(16, 0);
function toArray(buf) {
- return [
- buf.readUInt32BE(0),
- buf.readUInt32BE(4),
- buf.readUInt32BE(8),
- buf.readUInt32BE(12),
- ];
+ return [buf.readUInt32BE(0), buf.readUInt32BE(4), buf.readUInt32BE(8), buf.readUInt32BE(12)];
}
function fromArray(out) {
var buf = Buffer2.allocUnsafe(16);
@@ -3105,27 +2769,17 @@ var require_ghash = __commonJS({
);
}
function GHASH(key) {
- (this.h = key),
- (this.state = Buffer2.alloc(16, 0)),
- (this.cache = Buffer2.allocUnsafe(0));
+ (this.h = key), (this.state = Buffer2.alloc(16, 0)), (this.cache = Buffer2.allocUnsafe(0));
}
GHASH.prototype.ghash = function (block) {
for (var i = -1; ++i < block.length; ) this.state[i] ^= block[i];
this._multiply();
};
GHASH.prototype._multiply = function () {
- for (
- var Vi = toArray(this.h), Zi = [0, 0, 0, 0], j, xi, lsbVi, i = -1;
- ++i < 128;
-
- ) {
+ for (var Vi = toArray(this.h), Zi = [0, 0, 0, 0], j, xi, lsbVi, i = -1; ++i < 128; ) {
for (
xi = (this.state[~~(i / 8)] & (1 << (7 - (i % 8)))) !== 0,
- xi &&
- ((Zi[0] ^= Vi[0]),
- (Zi[1] ^= Vi[1]),
- (Zi[2] ^= Vi[2]),
- (Zi[3] ^= Vi[3])),
+ xi && ((Zi[0] ^= Vi[0]), (Zi[1] ^= Vi[1]), (Zi[2] ^= Vi[2]), (Zi[3] ^= Vi[3])),
lsbVi = (Vi[3] & 1) !== 0,
j = 3;
j > 0;
@@ -3139,14 +2793,11 @@ var require_ghash = __commonJS({
GHASH.prototype.update = function (buf) {
this.cache = Buffer2.concat([this.cache, buf]);
for (var chunk; this.cache.length >= 16; )
- (chunk = this.cache.slice(0, 16)),
- (this.cache = this.cache.slice(16)),
- this.ghash(chunk);
+ (chunk = this.cache.slice(0, 16)), (this.cache = this.cache.slice(16)), this.ghash(chunk);
};
GHASH.prototype.final = function (abl, bl) {
return (
- this.cache.length &&
- this.ghash(Buffer2.concat([this.cache, ZEROES], 16)),
+ this.cache.length && this.ghash(Buffer2.concat([this.cache, ZEROES], 16)),
this.ghash(fromArray([0, abl, 0, bl])),
this.state
);
@@ -3168,8 +2819,7 @@ var require_authCipher = __commonJS({
function xorTest(a, b) {
var out = 0;
a.length !== b.length && out++;
- for (var len = Math.min(a.length, b.length), i = 0; i < len; ++i)
- out += a[i] ^ b[i];
+ for (var len = Math.min(a.length, b.length), i = 0; i < len; ++i) out += a[i] ^ b[i];
return out;
}
function calcIv(self2, iv, ck) {
@@ -3186,9 +2836,7 @@ var require_authCipher = __commonJS({
ghash.update(Buffer2.alloc(8, 0));
var ivBits = len * 8,
tail = Buffer2.alloc(8);
- tail.writeUIntBE(ivBits, 0, 8),
- ghash.update(tail),
- (self2._finID = ghash.state);
+ tail.writeUIntBE(ivBits, 0, 8), ghash.update(tail), (self2._finID = ghash.state);
var out = Buffer2.from(self2._finID);
return incr32(out), out;
}
@@ -3213,24 +2861,15 @@ var require_authCipher = __commonJS({
StreamCipher.prototype._update = function (chunk) {
if (!this._called && this._alen) {
var rump = 16 - (this._alen % 16);
- rump < 16 &&
- ((rump = Buffer2.alloc(rump, 0)), this._ghash.update(rump));
+ rump < 16 && ((rump = Buffer2.alloc(rump, 0)), this._ghash.update(rump));
}
this._called = !0;
var out = this._mode.encrypt(this, chunk);
- return (
- this._decrypt ? this._ghash.update(chunk) : this._ghash.update(out),
- (this._len += chunk.length),
- out
- );
+ return this._decrypt ? this._ghash.update(chunk) : this._ghash.update(out), (this._len += chunk.length), out;
};
StreamCipher.prototype._final = function () {
- if (this._decrypt && !this._authTag)
- throw new Error("Unsupported state or unable to authenticate data");
- var tag = xor(
- this._ghash.final(this._alen * 8, this._len * 8),
- this._cipher.encryptBlock(this._finID),
- );
+ if (this._decrypt && !this._authTag) throw new Error("Unsupported state or unable to authenticate data");
+ var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));
if (this._decrypt && xorTest(tag, this._authTag))
throw new Error("Unsupported state or unable to authenticate data");
(this._authTag = tag), this._cipher.scrub();
@@ -3241,13 +2880,11 @@ var require_authCipher = __commonJS({
return this._authTag;
};
StreamCipher.prototype.setAuthTag = function (tag) {
- if (!this._decrypt)
- throw new Error("Attempting to set auth tag in unsupported state");
+ if (!this._decrypt) throw new Error("Attempting to set auth tag in unsupported state");
this._authTag = tag;
};
StreamCipher.prototype.setAAD = function (buf) {
- if (this._called)
- throw new Error("Attempting to set AAD in unsupported state");
+ if (this._called) throw new Error("Attempting to set AAD in unsupported state");
this._ghash.update(buf), (this._alen += buf.length);
};
module.exports = StreamCipher;
@@ -3288,32 +2925,21 @@ var require_evp_bytestokey = __commonJS({
MD5 = require_md5();
function EVP_BytesToKey(password, salt, keyBits, ivLen) {
if (
- (Buffer2.isBuffer(password) ||
- (password = Buffer2.from(password, "binary")),
- salt &&
- (Buffer2.isBuffer(salt) || (salt = Buffer2.from(salt, "binary")),
- salt.length !== 8))
+ (Buffer2.isBuffer(password) || (password = Buffer2.from(password, "binary")),
+ salt && (Buffer2.isBuffer(salt) || (salt = Buffer2.from(salt, "binary")), salt.length !== 8))
)
throw new RangeError("salt should be Buffer with 8 byte length");
for (
- var keyLen = keyBits / 8,
- key = Buffer2.alloc(keyLen),
- iv = Buffer2.alloc(ivLen || 0),
- tmp = Buffer2.alloc(0);
+ var keyLen = keyBits / 8, key = Buffer2.alloc(keyLen), iv = Buffer2.alloc(ivLen || 0), tmp = Buffer2.alloc(0);
keyLen > 0 || ivLen > 0;
) {
var hash = new MD5();
- hash.update(tmp),
- hash.update(password),
- salt && hash.update(salt),
- (tmp = hash.digest());
+ hash.update(tmp), hash.update(password), salt && hash.update(salt), (tmp = hash.digest());
var used = 0;
if (keyLen > 0) {
var keyStart = key.length - keyLen;
- (used = Math.min(keyLen, tmp.length)),
- tmp.copy(key, keyStart, 0, used),
- (keyLen -= used);
+ (used = Math.min(keyLen, tmp.length)), tmp.copy(key, keyStart, 0, used), (keyLen -= used);
}
if (used < tmp.length && ivLen > 0) {
var ivStart = iv.length - ivLen,
@@ -3356,14 +2982,8 @@ var require_encrypter = __commonJS({
var PADDING = Buffer2.alloc(16, 16);
Cipher.prototype._final = function () {
var chunk = this._cache.flush();
- if (this._autopadding)
- return (
- (chunk = this._mode.encrypt(this, chunk)), this._cipher.scrub(), chunk
- );
- if (!chunk.equals(PADDING))
- throw (
- (this._cipher.scrub(), new Error("data not multiple of block length"))
- );
+ if (this._autopadding) return (chunk = this._mode.encrypt(this, chunk)), this._cipher.scrub(), chunk;
+ if (!chunk.equals(PADDING)) throw (this._cipher.scrub(), new Error("data not multiple of block length"));
};
Cipher.prototype.setAutoPadding = function (setTo) {
return (this._autopadding = !!setTo), this;
@@ -3382,28 +3002,16 @@ var require_encrypter = __commonJS({
return null;
};
Splitter.prototype.flush = function () {
- for (
- var len = 16 - this.cache.length,
- padBuff = Buffer2.allocUnsafe(len),
- i = -1;
- ++i < len;
-
- )
+ for (var len = 16 - this.cache.length, padBuff = Buffer2.allocUnsafe(len), i = -1; ++i < len; )
padBuff.writeUInt8(len, i);
return Buffer2.concat([this.cache, padBuff]);
};
function createCipheriv(suite, password, iv) {
var config = MODES[suite.toLowerCase()];
if (!config) throw new TypeError("invalid suite type");
- if (
- (typeof password == "string" && (password = Buffer2.from(password)),
- password.length !== config.key / 8)
- )
+ if ((typeof password == "string" && (password = Buffer2.from(password)), password.length !== config.key / 8))
throw new TypeError("invalid key length " + password.length);
- if (
- (typeof iv == "string" && (iv = Buffer2.from(iv)),
- config.mode !== "GCM" && iv.length !== config.iv)
- )
+ if ((typeof iv == "string" && (iv = Buffer2.from(iv)), config.mode !== "GCM" && iv.length !== config.iv))
throw new TypeError("invalid iv length " + iv.length);
return config.type === "stream"
? new StreamCipher(config.module, password, iv)
@@ -3445,11 +3053,7 @@ var require_decrypter = __commonJS({
inherits(Decipher, Transform);
Decipher.prototype._update = function (data) {
this._cache.add(data);
- for (
- var chunk, thing, out = [];
- (chunk = this._cache.get(this._autopadding));
-
- )
+ for (var chunk, thing, out = []; (chunk = this._cache.get(this._autopadding)); )
(thing = this._mode.decrypt(this, chunk)), out.push(thing);
return Buffer2.concat(out);
};
@@ -3470,18 +3074,9 @@ var require_decrypter = __commonJS({
Splitter.prototype.get = function (autoPadding) {
var out;
if (autoPadding) {
- if (this.cache.length > 16)
- return (
- (out = this.cache.slice(0, 16)),
- (this.cache = this.cache.slice(16)),
- out
- );
+ if (this.cache.length > 16) return (out = this.cache.slice(0, 16)), (this.cache = this.cache.slice(16)), out;
} else if (this.cache.length >= 16)
- return (
- (out = this.cache.slice(0, 16)),
- (this.cache = this.cache.slice(16)),
- out
- );
+ return (out = this.cache.slice(0, 16)), (this.cache = this.cache.slice(16)), out;
return null;
};
Splitter.prototype.flush = function () {
@@ -3491,22 +3086,15 @@ var require_decrypter = __commonJS({
var padded = last[15];
if (padded < 1 || padded > 16) throw new Error("unable to decrypt data");
for (var i = -1; ++i < padded; )
- if (last[i + (16 - padded)] !== padded)
- throw new Error("unable to decrypt data");
+ if (last[i + (16 - padded)] !== padded) throw new Error("unable to decrypt data");
if (padded !== 16) return last.slice(0, 16 - padded);
}
function createDecipheriv(suite, password, iv) {
var config = MODES[suite.toLowerCase()];
if (!config) throw new TypeError("invalid suite type");
- if (
- (typeof iv == "string" && (iv = Buffer2.from(iv)),
- config.mode !== "GCM" && iv.length !== config.iv)
- )
+ if ((typeof iv == "string" && (iv = Buffer2.from(iv)), config.mode !== "GCM" && iv.length !== config.iv))
throw new TypeError("invalid iv length " + iv.length);
- if (
- (typeof password == "string" && (password = Buffer2.from(password)),
- password.length !== config.key / 8)
- )
+ if ((typeof password == "string" && (password = Buffer2.from(password)), password.length !== config.key / 8))
throw new TypeError("invalid key length " + password.length);
return config.type === "stream"
? new StreamCipher(config.module, password, iv, !0)
@@ -3583,10 +3171,8 @@ var require_browser6 = __commonJS({
function createCipher(suite, password) {
suite = suite.toLowerCase();
var keyLen, ivLen;
- if (aesModes[suite])
- (keyLen = aesModes[suite].key), (ivLen = aesModes[suite].iv);
- else if (desModes[suite])
- (keyLen = desModes[suite].key * 8), (ivLen = desModes[suite].iv);
+ if (aesModes[suite]) (keyLen = aesModes[suite].key), (ivLen = aesModes[suite].iv);
+ else if (desModes[suite]) (keyLen = desModes[suite].key * 8), (ivLen = desModes[suite].iv);
else throw new TypeError("invalid suite type");
var keys = ebtk(password, !1, keyLen, ivLen);
return createCipheriv(suite, keys.key, keys.iv);
@@ -3594,25 +3180,20 @@ var require_browser6 = __commonJS({
function createDecipher(suite, password) {
suite = suite.toLowerCase();
var keyLen, ivLen;
- if (aesModes[suite])
- (keyLen = aesModes[suite].key), (ivLen = aesModes[suite].iv);
- else if (desModes[suite])
- (keyLen = desModes[suite].key * 8), (ivLen = desModes[suite].iv);
+ if (aesModes[suite]) (keyLen = aesModes[suite].key), (ivLen = aesModes[suite].iv);
+ else if (desModes[suite]) (keyLen = desModes[suite].key * 8), (ivLen = desModes[suite].iv);
else throw new TypeError("invalid suite type");
var keys = ebtk(password, !1, keyLen, ivLen);
return createDecipheriv(suite, keys.key, keys.iv);
}
function createCipheriv(suite, key, iv) {
- if (((suite = suite.toLowerCase()), aesModes[suite]))
- return aes.createCipheriv(suite, key, iv);
+ if (((suite = suite.toLowerCase()), aesModes[suite])) return aes.createCipheriv(suite, key, iv);
if (desModes[suite]) return new DES({ key, iv, mode: suite });
throw new TypeError("invalid suite type");
}
function createDecipheriv(suite, key, iv) {
- if (((suite = suite.toLowerCase()), aesModes[suite]))
- return aes.createDecipheriv(suite, key, iv);
- if (desModes[suite])
- return new DES({ key, iv, mode: suite, decrypt: !0 });
+ if (((suite = suite.toLowerCase()), aesModes[suite])) return aes.createDecipheriv(suite, key, iv);
+ if (desModes[suite]) return new DES({ key, iv, mode: suite, decrypt: !0 });
throw new TypeError("invalid suite type");
}
function getCiphers() {
@@ -3651,9 +3232,7 @@ var require_bn = __commonJS({
((base === "le" || base === "be") && ((endian = base), (base = 10)),
this._init(number || 0, base || 10, endian || "be"));
}
- typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN),
- (BN.BN = BN),
- (BN.wordSize = 26);
+ typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN), (BN.BN = BN), (BN.wordSize = 26);
var Buffer2;
try {
typeof window < "u" && typeof window.Buffer < "u"
@@ -3675,10 +3254,8 @@ var require_bn = __commonJS({
return left.cmp(right) < 0 ? left : right;
}),
(BN.prototype._init = function (number, base, endian) {
- if (typeof number == "number")
- return this._initNumber(number, base, endian);
- if (typeof number == "object")
- return this._initArray(number, base, endian);
+ if (typeof number == "number") return this._initNumber(number, base, endian);
+ if (typeof number == "object") return this._initArray(number, base, endian);
base === "hex" && (base = 16),
assert(base === (base | 0) && base >= 2 && base <= 36),
(number = number.toString().replace(/\s+/g, ""));
@@ -3688,33 +3265,23 @@ var require_bn = __commonJS({
(base === 16
? this._parseHex(number, start, endian)
: (this._parseBase(number, base, start),
- endian === "le" &&
- this._initArray(this.toArray(), base, endian)));
+ endian === "le" && this._initArray(this.toArray(), base, endian)));
}),
(BN.prototype._initNumber = function (number, base, endian) {
number < 0 && ((this.negative = 1), (number = -number)),
number < 67108864
? ((this.words = [number & 67108863]), (this.length = 1))
: number < 4503599627370496
- ? ((this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- ]),
- (this.length = 2))
+ ? ((this.words = [number & 67108863, (number / 67108864) & 67108863]), (this.length = 2))
: (assert(number < 9007199254740992),
- (this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- 1,
- ]),
+ (this.words = [number & 67108863, (number / 67108864) & 67108863, 1]),
(this.length = 3)),
endian === "le" && this._initArray(this.toArray(), base, endian);
}),
(BN.prototype._initArray = function (number, base, endian) {
if ((assert(typeof number.length == "number"), number.length <= 0))
return (this.words = [0]), (this.length = 1), this;
- (this.length = Math.ceil(number.length / 3)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil(number.length / 3)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var j,
w,
@@ -3737,23 +3304,14 @@ var require_bn = __commonJS({
});
function parseHex4Bits(string, index) {
var c = string.charCodeAt(index);
- return c >= 65 && c <= 70
- ? c - 55
- : c >= 97 && c <= 102
- ? c - 87
- : (c - 48) & 15;
+ return c >= 65 && c <= 70 ? c - 55 : c >= 97 && c <= 102 ? c - 87 : (c - 48) & 15;
}
function parseHexByte(string, lowerBound, index) {
var r = parseHex4Bits(string, index);
- return (
- index - 1 >= lowerBound &&
- (r |= parseHex4Bits(string, index - 1) << 4),
- r
- );
+ return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;
}
BN.prototype._parseHex = function (number, start, endian) {
- (this.length = Math.ceil((number.length - start) / 6)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil((number.length - start) / 6)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var off = 0,
j = 0,
@@ -3762,44 +3320,26 @@ var require_bn = __commonJS({
for (i = number.length - 1; i >= start; i -= 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
else {
var parseLength = number.length - start;
- for (
- i = parseLength % 2 === 0 ? start + 1 : start;
- i < number.length;
- i += 2
- )
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
}
this.strip();
};
function parseBase(str, start, end, mul) {
- for (
- var r = 0, len = Math.min(str.length, end), i = start;
- i < len;
- i++
- ) {
+ for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
var c = str.charCodeAt(i) - 48;
- (r *= mul),
- c >= 49
- ? (r += c - 49 + 10)
- : c >= 17
- ? (r += c - 17 + 10)
- : (r += c);
+ (r *= mul), c >= 49 ? (r += c - 49 + 10) : c >= 17 ? (r += c - 17 + 10) : (r += c);
}
return r;
}
(BN.prototype._parseBase = function (number, base, start) {
(this.words = [0]), (this.length = 1);
- for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base)
- limbLen++;
+ for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
limbLen--, (limbPow = (limbPow / base) | 0);
for (
var total = number.length - start,
@@ -3812,30 +3352,18 @@ var require_bn = __commonJS({
)
(word = parseBase(number, i, i + limbLen, base)),
this.imuln(limbPow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
if (mod !== 0) {
var pow = 1;
- for (
- word = parseBase(number, i, number.length, base), i = 0;
- i < mod;
- i++
- )
- pow *= base;
- this.imuln(pow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
+ this.imuln(pow), this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
}
this.strip();
}),
(BN.prototype.copy = function (dest) {
dest.words = new Array(this.length);
for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
- (dest.length = this.length),
- (dest.negative = this.negative),
- (dest.red = this.red);
+ (dest.length = this.length), (dest.negative = this.negative), (dest.red = this.red);
}),
(BN.prototype.clone = function () {
var r = new BN(null);
@@ -3846,15 +3374,11 @@ var require_bn = __commonJS({
return this;
}),
(BN.prototype.strip = function () {
- for (; this.length > 1 && this.words[this.length - 1] === 0; )
- this.length--;
+ for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
return this._normSign();
}),
(BN.prototype._normSign = function () {
- return (
- this.length === 1 && this.words[0] === 0 && (this.negative = 0),
- this
- );
+ return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}),
(BN.prototype.inspect = function () {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -3888,15 +3412,13 @@ var require_bn = __commonJS({
"0000000000000000000000000",
],
groupSizes = [
- 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5,
],
groupBases = [
- 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607,
- 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536,
- 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101,
- 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368,
- 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
+ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808,
+ 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624,
+ 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
60466176,
];
(BN.prototype.toString = function (base, padding) {
@@ -3908,18 +3430,11 @@ var require_bn = __commonJS({
var w = this.words[i],
word = (((w << off) | carry) & 16777215).toString(16);
(carry = (w >>> (24 - off)) & 16777215),
- carry !== 0 || i !== this.length - 1
- ? (out = zeros[6 - word.length] + word + out)
- : (out = word + out),
+ carry !== 0 || i !== this.length - 1 ? (out = zeros[6 - word.length] + word + out) : (out = word + out),
(off += 2),
off >= 26 && ((off -= 26), i--);
}
- for (
- carry !== 0 && (out = carry.toString(16) + out);
- out.length % padding !== 0;
-
- )
- out = "0" + out;
+ for (carry !== 0 && (out = carry.toString(16) + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
if (base === (base | 0) && base >= 2 && base <= 36) {
@@ -3929,13 +3444,9 @@ var require_bn = __commonJS({
var c = this.clone();
for (c.negative = 0; !c.isZero(); ) {
var r = c.modn(groupBase).toString(base);
- (c = c.idivn(groupBase)),
- c.isZero()
- ? (out = r + out)
- : (out = zeros[groupSize - r.length] + r + out);
+ (c = c.idivn(groupBase)), c.isZero() ? (out = r + out) : (out = zeros[groupSize - r.length] + r + out);
}
- for (this.isZero() && (out = "0" + out); out.length % padding !== 0; )
- out = "0" + out;
+ for (this.isZero() && (out = "0" + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
assert(!1, "Base should be between 2 and 36");
@@ -3947,8 +3458,7 @@ var require_bn = __commonJS({
? (ret += this.words[1] * 67108864)
: this.length === 3 && this.words[2] === 1
? (ret += 4503599627370496 + this.words[1] * 67108864)
- : this.length > 2 &&
- assert(!1, "Number can only safely store up to 53 bits"),
+ : this.length > 2 && assert(!1, "Number can only safely store up to 53 bits"),
this.negative !== 0 ? -ret : ret
);
}),
@@ -3956,10 +3466,7 @@ var require_bn = __commonJS({
return this.toString(16);
}),
(BN.prototype.toBuffer = function (endian, length) {
- return (
- assert(typeof Buffer2 < "u"),
- this.toArrayLike(Buffer2, endian, length)
- );
+ return assert(typeof Buffer2 < "u"), this.toArrayLike(Buffer2, endian, length);
}),
(BN.prototype.toArray = function (endian, length) {
return this.toArrayLike(Array, endian, length);
@@ -3967,10 +3474,7 @@ var require_bn = __commonJS({
(BN.prototype.toArrayLike = function (ArrayType, endian, length) {
var byteLength = this.byteLength(),
reqLength = length || Math.max(1, byteLength);
- assert(
- byteLength <= reqLength,
- "byte array longer than desired length",
- ),
+ assert(byteLength <= reqLength, "byte array longer than desired length"),
assert(reqLength > 0, "Requested array length <= 0"),
this.strip();
var littleEndian = endian === "le",
@@ -3979,13 +3483,11 @@ var require_bn = __commonJS({
i,
q = this.clone();
if (littleEndian) {
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[i] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[i] = b);
for (; i < reqLength; i++) res[i] = 0;
} else {
for (i = 0; i < reqLength - byteLength; i++) res[i] = 0;
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
}
return res;
}),
@@ -4023,11 +3525,7 @@ var require_bn = __commonJS({
return (this.length - 1) * 26 + hi;
});
function toBitArray(num) {
- for (
- var w = new Array(num.bitLength()), bit = 0;
- bit < w.length;
- bit++
- ) {
+ for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
var off = (bit / 26) | 0,
wbit = bit % 26;
w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
@@ -4046,14 +3544,10 @@ var require_bn = __commonJS({
return Math.ceil(this.bitLength() / 8);
}),
(BN.prototype.toTwos = function (width) {
- return this.negative !== 0
- ? this.abs().inotn(width).iaddn(1)
- : this.clone();
+ return this.negative !== 0 ? this.abs().inotn(width).iaddn(1) : this.clone();
}),
(BN.prototype.fromTwos = function (width) {
- return this.testn(width - 1)
- ? this.notn(width).iaddn(1).ineg()
- : this.clone();
+ return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
}),
(BN.prototype.isNeg = function () {
return this.negative !== 0;
@@ -4066,50 +3560,37 @@ var require_bn = __commonJS({
}),
(BN.prototype.iuor = function (num) {
for (; this.length < num.length; ) this.words[this.length++] = 0;
- for (var i = 0; i < num.length; i++)
- this.words[i] = this.words[i] | num.words[i];
+ for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
return this.strip();
}),
(BN.prototype.ior = function (num) {
return assert((this.negative | num.negative) === 0), this.iuor(num);
}),
(BN.prototype.or = function (num) {
- return this.length > num.length
- ? this.clone().ior(num)
- : num.clone().ior(this);
+ return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
}),
(BN.prototype.uor = function (num) {
- return this.length > num.length
- ? this.clone().iuor(num)
- : num.clone().iuor(this);
+ return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
}),
(BN.prototype.iuand = function (num) {
var b;
this.length > num.length ? (b = num) : (b = this);
- for (var i = 0; i < b.length; i++)
- this.words[i] = this.words[i] & num.words[i];
+ for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
return (this.length = b.length), this.strip();
}),
(BN.prototype.iand = function (num) {
return assert((this.negative | num.negative) === 0), this.iuand(num);
}),
(BN.prototype.and = function (num) {
- return this.length > num.length
- ? this.clone().iand(num)
- : num.clone().iand(this);
+ return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
}),
(BN.prototype.uand = function (num) {
- return this.length > num.length
- ? this.clone().iuand(num)
- : num.clone().iuand(this);
+ return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
}),
(BN.prototype.iuxor = function (num) {
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
- for (var i = 0; i < b.length; i++)
- this.words[i] = a.words[i] ^ b.words[i];
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
+ for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
if (this !== a) for (; i < a.length; i++) this.words[i] = a.words[i];
return (this.length = a.length), this.strip();
}),
@@ -4117,27 +3598,18 @@ var require_bn = __commonJS({
return assert((this.negative | num.negative) === 0), this.iuxor(num);
}),
(BN.prototype.xor = function (num) {
- return this.length > num.length
- ? this.clone().ixor(num)
- : num.clone().ixor(this);
+ return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
}),
(BN.prototype.uxor = function (num) {
- return this.length > num.length
- ? this.clone().iuxor(num)
- : num.clone().iuxor(this);
+ return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
}),
(BN.prototype.inotn = function (width) {
assert(typeof width == "number" && width >= 0);
var bytesNeeded = Math.ceil(width / 26) | 0,
bitsLeft = width % 26;
this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;
- for (var i = 0; i < bytesNeeded; i++)
- this.words[i] = ~this.words[i] & 67108863;
- return (
- bitsLeft > 0 &&
- (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))),
- this.strip()
- );
+ for (var i = 0; i < bytesNeeded; i++) this.words[i] = ~this.words[i] & 67108863;
+ return bitsLeft > 0 && (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))), this.strip();
}),
(BN.prototype.notn = function (width) {
return this.clone().inotn(width);
@@ -4157,49 +3629,25 @@ var require_bn = __commonJS({
(BN.prototype.iadd = function (num) {
var r;
if (this.negative !== 0 && num.negative === 0)
- return (
- (this.negative = 0),
- (r = this.isub(num)),
- (this.negative ^= 1),
- this._normSign()
- );
+ return (this.negative = 0), (r = this.isub(num)), (this.negative ^= 1), this._normSign();
if (this.negative === 0 && num.negative !== 0)
- return (
- (num.negative = 0),
- (r = this.isub(num)),
- (num.negative = 1),
- r._normSign()
- );
+ return (num.negative = 0), (r = this.isub(num)), (num.negative = 1), r._normSign();
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) + (b.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
+ (r = (a.words[i] | 0) + (b.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
- if (((this.length = a.length), carry !== 0))
- (this.words[this.length] = carry), this.length++;
- else if (a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
+ (r = (a.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
+ if (((this.length = a.length), carry !== 0)) (this.words[this.length] = carry), this.length++;
+ else if (a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
return this;
}),
(BN.prototype.add = function (num) {
var res;
return num.negative !== 0 && this.negative === 0
- ? ((num.negative = 0),
- (res = this.sub(num)),
- (num.negative ^= 1),
- res)
+ ? ((num.negative = 0), (res = this.sub(num)), (num.negative ^= 1), res)
: num.negative === 0 && this.negative !== 0
- ? ((this.negative = 0),
- (res = num.sub(this)),
- (this.negative = 1),
- res)
+ ? ((this.negative = 0), (res = num.sub(this)), (this.negative = 1), res)
: this.length > num.length
? this.clone().iadd(num)
: num.clone().iadd(this);
@@ -4210,34 +3658,17 @@ var require_bn = __commonJS({
var r = this.iadd(num);
return (num.negative = 1), r._normSign();
} else if (this.negative !== 0)
- return (
- (this.negative = 0),
- this.iadd(num),
- (this.negative = 1),
- this._normSign()
- );
+ return (this.negative = 0), this.iadd(num), (this.negative = 1), this._normSign();
var cmp = this.cmp(num);
- if (cmp === 0)
- return (
- (this.negative = 0), (this.length = 1), (this.words[0] = 0), this
- );
+ if (cmp === 0) return (this.negative = 0), (this.length = 1), (this.words[0] = 0), this;
var a, b;
cmp > 0 ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) - (b.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
+ (r = (a.words[i] | 0) - (b.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
- if (carry === 0 && i < a.length && a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
- return (
- (this.length = Math.max(this.length, i)),
- a !== this && (this.negative = 1),
- this.strip()
- );
+ (r = (a.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
+ if (carry === 0 && i < a.length && a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
+ return (this.length = Math.max(this.length, i)), a !== this && (this.negative = 1), this.strip();
}),
(BN.prototype.sub = function (num) {
return this.clone().isub(num);
@@ -4270,9 +3701,7 @@ var require_bn = __commonJS({
}
(out.words[k] = rword | 0), (carry = ncarry | 0);
}
- return (
- carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip()
- );
+ return carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip();
}
var comb10MulTo = function (self2, num, out) {
var a = self2.words,
@@ -4827,15 +4256,12 @@ var require_bn = __commonJS({
};
Math.imul || (comb10MulTo = smallMulTo);
function bigMulTo(self2, num, out) {
- (out.negative = num.negative ^ self2.negative),
- (out.length = self2.length + num.length);
+ (out.negative = num.negative ^ self2.negative), (out.length = self2.length + num.length);
for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
var ncarry = hncarry;
hncarry = 0;
for (
- var rword = carry & 67108863,
- maxJ = Math.min(k, num.length - 1),
- j = Math.max(0, k - self2.length + 1);
+ var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);
j <= maxJ;
j++
) {
@@ -4877,32 +4303,22 @@ var require_bn = __commonJS({
(this.x = x), (this.y = y);
}
(FFTM.prototype.makeRBT = function (N) {
- for (
- var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0;
- i < N;
- i++
- )
- t[i] = this.revBin(i, l, N);
+ for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
return t;
}),
(FFTM.prototype.revBin = function (x, l, N) {
if (x === 0 || x === N - 1) return x;
- for (var rb = 0, i = 0; i < l; i++)
- (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
+ for (var rb = 0, i = 0; i < l; i++) (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
return rb;
}),
(FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++)
- (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
+ for (var i = 0; i < N; i++) (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
}),
(FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) {
this.permute(rbt, rws, iws, rtws, itws, N);
for (var s = 1; s < N; s <<= 1)
for (
- var l = s << 1,
- rtwdf = Math.cos((2 * Math.PI) / l),
- itwdf = Math.sin((2 * Math.PI) / l),
- p = 0;
+ var l = s << 1, rtwdf = Math.cos((2 * Math.PI) / l), itwdf = Math.sin((2 * Math.PI) / l), p = 0;
p < N;
p += l
)
@@ -4919,9 +4335,7 @@ var require_bn = __commonJS({
(rtws[p + j + s] = re - ro),
(itws[p + j + s] = ie - io),
j !== l &&
- ((rx = rtwdf * rtwdf_ - itwdf * itwdf_),
- (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_),
- (rtwdf_ = rx));
+ ((rx = rtwdf * rtwdf_ - itwdf * itwdf_), (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_), (rtwdf_ = rx));
}
}),
(FFTM.prototype.guessLen13b = function (n, m) {
@@ -4944,12 +4358,8 @@ var require_bn = __commonJS({
}),
(FFTM.prototype.normalize13b = function (ws, N) {
for (var carry = 0, i = 0; i < N / 2; i++) {
- var w =
- Math.round(ws[2 * i + 1] / N) * 8192 +
- Math.round(ws[2 * i] / N) +
- carry;
- (ws[i] = w & 67108863),
- w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
+ var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;
+ (ws[i] = w & 67108863), w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
}
return ws;
}),
@@ -4999,17 +4409,11 @@ var require_bn = __commonJS({
}),
(BN.prototype.mul = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- this.mulTo(num, out)
- );
+ return (out.words = new Array(this.length + num.length)), this.mulTo(num, out);
}),
(BN.prototype.mulf = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- jumboMulTo(this, num, out)
- );
+ return (out.words = new Array(this.length + num.length)), jumboMulTo(this, num, out);
}),
(BN.prototype.imul = function (num) {
return this.clone().mulTo(num, this);
@@ -5019,10 +4423,7 @@ var require_bn = __commonJS({
for (var carry = 0, i = 0; i < this.length; i++) {
var w = (this.words[i] | 0) * num,
lo = (w & 67108863) + (carry & 67108863);
- (carry >>= 26),
- (carry += (w / 67108864) | 0),
- (carry += lo >>> 26),
- (this.words[i] = lo & 67108863);
+ (carry >>= 26), (carry += (w / 67108864) | 0), (carry += lo >>> 26), (this.words[i] = lo & 67108863);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -5038,14 +4439,8 @@ var require_bn = __commonJS({
(BN.prototype.pow = function (num) {
var w = toBitArray(num);
if (w.length === 0) return new BN(1);
- for (
- var res = this, i = 0;
- i < w.length && w[i] === 0;
- i++, res = res.sqr()
- );
- if (++i < w.length)
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr())
- w[i] !== 0 && (res = res.mul(q));
+ for (var res = this, i = 0; i < w.length && w[i] === 0; i++, res = res.sqr());
+ if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) w[i] !== 0 && (res = res.mul(q));
return res;
}),
(BN.prototype.iushln = function (bits) {
@@ -5064,8 +4459,7 @@ var require_bn = __commonJS({
carry && ((this.words[i] = carry), this.length++);
}
if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--)
- this.words[i + s] = this.words[i];
+ for (i = this.length - 1; i >= 0; i--) this.words[i + s] = this.words[i];
for (i = 0; i < s; i++) this.words[i] = 0;
this.length += s;
}
@@ -5087,20 +4481,15 @@ var require_bn = __commonJS({
maskedWords.length = s;
}
if (s !== 0)
- if (this.length > s)
- for (this.length -= s, i = 0; i < this.length; i++)
- this.words[i] = this.words[i + s];
+ if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s];
else (this.words[0] = 0), (this.length = 1);
var carry = 0;
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
var word = this.words[i] | 0;
- (this.words[i] = (carry << (26 - r)) | (word >>> r)),
- (carry = word & mask);
+ (this.words[i] = (carry << (26 - r)) | (word >>> r)), (carry = word & mask);
}
return (
- maskedWords &&
- carry !== 0 &&
- (maskedWords.words[maskedWords.length++] = carry),
+ maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry),
this.length === 0 && ((this.words[0] = 0), (this.length = 1)),
this.strip()
);
@@ -5133,17 +4522,8 @@ var require_bn = __commonJS({
assert(typeof bits == "number" && bits >= 0);
var r = bits % 26,
s = (bits - r) / 26;
- if (
- (assert(
- this.negative === 0,
- "imaskn works only with positive numbers",
- ),
- this.length <= s)
- )
- return this;
- if (
- (r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)
- ) {
+ if ((assert(this.negative === 0, "imaskn works only with positive numbers"), this.length <= s)) return this;
+ if ((r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)) {
var mask = 67108863 ^ ((67108863 >>> r) << r);
this.words[this.length - 1] &= mask;
}
@@ -5160,32 +4540,20 @@ var require_bn = __commonJS({
? this.isubn(-num)
: this.negative !== 0
? this.length === 1 && (this.words[0] | 0) < num
- ? ((this.words[0] = num - (this.words[0] | 0)),
- (this.negative = 0),
- this)
- : ((this.negative = 0),
- this.isubn(num),
- (this.negative = 1),
- this)
+ ? ((this.words[0] = num - (this.words[0] | 0)), (this.negative = 0), this)
+ : ((this.negative = 0), this.isubn(num), (this.negative = 1), this)
: this._iaddn(num)
);
}),
(BN.prototype._iaddn = function (num) {
this.words[0] += num;
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++)
- (this.words[i] -= 67108864),
- i === this.length - 1
- ? (this.words[i + 1] = 1)
- : this.words[i + 1]++;
+ (this.words[i] -= 67108864), i === this.length - 1 ? (this.words[i + 1] = 1) : this.words[i + 1]++;
return (this.length = Math.max(this.length, i + 1)), this;
}),
(BN.prototype.isubn = function (num) {
- if ((assert(typeof num == "number"), assert(num < 67108864), num < 0))
- return this.iaddn(-num);
- if (this.negative !== 0)
- return (
- (this.negative = 0), this.iaddn(num), (this.negative = 1), this
- );
+ if ((assert(typeof num == "number"), assert(num < 67108864), num < 0)) return this.iaddn(-num);
+ if (this.negative !== 0) return (this.negative = 0), this.iaddn(num), (this.negative = 1), this;
if (((this.words[0] -= num), this.length === 1 && this.words[0] < 0))
(this.words[0] = -this.words[0]), (this.negative = 1);
else
@@ -5219,14 +4587,10 @@ var require_bn = __commonJS({
(this.words[i + shift] = w & 67108863);
}
for (; i < this.length - shift; i++)
- (w = (this.words[i + shift] | 0) + carry),
- (carry = w >> 26),
- (this.words[i + shift] = w & 67108863);
+ (w = (this.words[i + shift] | 0) + carry), (carry = w >> 26), (this.words[i + shift] = w & 67108863);
if (carry === 0) return this.strip();
for (assert(carry === -1), carry = 0, i = 0; i < this.length; i++)
- (w = -(this.words[i] | 0) + carry),
- (carry = w >> 26),
- (this.words[i] = w & 67108863);
+ (w = -(this.words[i] | 0) + carry), (carry = w >> 26), (this.words[i] = w & 67108863);
return (this.negative = 1), this.strip();
}),
(BN.prototype._wordDiv = function (num, mode) {
@@ -5236,33 +4600,19 @@ var require_bn = __commonJS({
bhi = b.words[b.length - 1] | 0,
bhiBits = this._countBits(bhi);
(shift = 26 - bhiBits),
- shift !== 0 &&
- ((b = b.ushln(shift)),
- a.iushln(shift),
- (bhi = b.words[b.length - 1] | 0));
+ shift !== 0 && ((b = b.ushln(shift)), a.iushln(shift), (bhi = b.words[b.length - 1] | 0));
var m = a.length - b.length,
q;
if (mode !== "mod") {
- (q = new BN(null)),
- (q.length = m + 1),
- (q.words = new Array(q.length));
+ (q = new BN(null)), (q.length = m + 1), (q.words = new Array(q.length));
for (var i = 0; i < q.length; i++) q.words[i] = 0;
}
var diff = a.clone()._ishlnsubmul(b, 1, m);
diff.negative === 0 && ((a = diff), q && (q.words[m] = 1));
for (var j = m - 1; j >= 0; j--) {
- var qj =
- (a.words[b.length + j] | 0) * 67108864 +
- (a.words[b.length + j - 1] | 0);
- for (
- qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j);
- a.negative !== 0;
-
- )
- qj--,
- (a.negative = 0),
- a._ishlnsubmul(b, 1, j),
- a.isZero() || (a.negative ^= 1);
+ var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);
+ for (qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j); a.negative !== 0; )
+ qj--, (a.negative = 0), a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
q && (q.words[j] = qj);
}
return (
@@ -5285,9 +4635,7 @@ var require_bn = __commonJS({
return this.negative !== 0 && num.negative === 0
? ((res = this.neg().divmod(num, mode)),
mode !== "mod" && (div = res.div.neg()),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.iadd(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.iadd(num)),
{
div,
mod,
@@ -5301,9 +4649,7 @@ var require_bn = __commonJS({
})
: (this.negative & num.negative) !== 0
? ((res = this.neg().divmod(num.neg(), mode)),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.isub(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.isub(num)),
{
div: res.div,
mod,
@@ -5354,11 +4700,7 @@ var require_bn = __commonJS({
}),
(BN.prototype.modn = function (num) {
assert(num <= 67108863);
- for (
- var p = (1 << 26) % num, acc = 0, i = this.length - 1;
- i >= 0;
- i--
- )
+ for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; i >= 0; i--)
acc = (p * acc + (this.words[i] | 0)) % num;
return acc;
}),
@@ -5378,40 +4720,18 @@ var require_bn = __commonJS({
var x = this,
y = p.clone();
x.negative !== 0 ? (x = x.umod(p)) : (x = x.clone());
- for (
- var A = new BN(1),
- B = new BN(0),
- C = new BN(0),
- D = new BN(1),
- g = 0;
- x.isEven() && y.isEven();
-
- )
+ for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); )
x.iushrn(1), y.iushrn(1), ++g;
for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
- for (
- var i = 0, im = 1;
- (x.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
if (i > 0)
for (x.iushrn(i); i-- > 0; )
- (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)),
- A.iushrn(1),
- B.iushrn(1);
- for (
- var j = 0, jm = 1;
- (y.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
+ (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
if (j > 0)
for (y.iushrn(j); j-- > 0; )
- (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)),
- C.iushrn(1),
- D.iushrn(1);
- x.cmp(y) >= 0
- ? (x.isub(y), A.isub(C), B.isub(D))
- : (y.isub(x), C.isub(A), D.isub(B));
+ (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);
+ x.cmp(y) >= 0 ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
}
return {
a: C,
@@ -5424,35 +4744,15 @@ var require_bn = __commonJS({
var a = this,
b = p.clone();
a.negative !== 0 ? (a = a.umod(p)) : (a = a.clone());
- for (
- var x1 = new BN(1), x2 = new BN(0), delta = b.clone();
- a.cmpn(1) > 0 && b.cmpn(1) > 0;
-
- ) {
- for (
- var i = 0, im = 1;
- (a.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
- if (i > 0)
- for (a.iushrn(i); i-- > 0; )
- x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
- for (
- var j = 0, jm = 1;
- (b.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
- if (j > 0)
- for (b.iushrn(j); j-- > 0; )
- x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
+ for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone(); a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
+ if (i > 0) for (a.iushrn(i); i-- > 0; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
+ if (j > 0) for (b.iushrn(j); j-- > 0; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
a.cmp(b) >= 0 ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
}
var res;
- return (
- a.cmpn(1) === 0 ? (res = x1) : (res = x2),
- res.cmpn(0) < 0 && res.iadd(p),
- res
- );
+ return a.cmpn(1) === 0 ? (res = x1) : (res = x2), res.cmpn(0) < 0 && res.iadd(p), res;
}),
(BN.prototype.gcd = function (num) {
if (this.isZero()) return num.abs();
@@ -5460,8 +4760,7 @@ var require_bn = __commonJS({
var a = this.clone(),
b = num.clone();
(a.negative = 0), (b.negative = 0);
- for (var shift = 0; a.isEven() && b.isEven(); shift++)
- a.iushrn(1), b.iushrn(1);
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), b.iushrn(1);
do {
for (; a.isEven(); ) a.iushrn(1);
for (; b.isEven(); ) b.iushrn(1);
@@ -5491,14 +4790,10 @@ var require_bn = __commonJS({
var r = bit % 26,
s = (bit - r) / 26,
q = 1 << r;
- if (this.length <= s)
- return this._expand(s + 1), (this.words[s] |= q), this;
+ if (this.length <= s) return this._expand(s + 1), (this.words[s] |= q), this;
for (var carry = q, i = s; carry !== 0 && i < this.length; i++) {
var w = this.words[i] | 0;
- (w += carry),
- (carry = w >>> 26),
- (w &= 67108863),
- (this.words[i] = w);
+ (w += carry), (carry = w >>> 26), (w &= 67108863), (this.words[i] = w);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -5513,8 +4808,7 @@ var require_bn = __commonJS({
var res;
if (this.length > 1) res = 1;
else {
- negative && (num = -num),
- assert(num <= 67108863, "Number is too big");
+ negative && (num = -num), assert(num <= 67108863, "Number is too big");
var w = this.words[0] | 0;
res = w === num ? 0 : w < num ? -1 : 1;
}
@@ -5580,52 +4874,28 @@ var require_bn = __commonJS({
);
}),
(BN.prototype.fromRed = function () {
- return (
- assert(
- this.red,
- "fromRed works only with numbers in reduction context",
- ),
- this.red.convertFrom(this)
- );
+ return assert(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
}),
(BN.prototype._forceRed = function (ctx) {
return (this.red = ctx), this;
}),
(BN.prototype.forceRed = function (ctx) {
- return (
- assert(!this.red, "Already a number in reduction context"),
- this._forceRed(ctx)
- );
+ return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
}),
(BN.prototype.redAdd = function (num) {
- return (
- assert(this.red, "redAdd works only with red numbers"),
- this.red.add(this, num)
- );
+ return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
}),
(BN.prototype.redIAdd = function (num) {
- return (
- assert(this.red, "redIAdd works only with red numbers"),
- this.red.iadd(this, num)
- );
+ return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
}),
(BN.prototype.redSub = function (num) {
- return (
- assert(this.red, "redSub works only with red numbers"),
- this.red.sub(this, num)
- );
+ return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
}),
(BN.prototype.redISub = function (num) {
- return (
- assert(this.red, "redISub works only with red numbers"),
- this.red.isub(this, num)
- );
+ return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
}),
(BN.prototype.redShl = function (num) {
- return (
- assert(this.red, "redShl works only with red numbers"),
- this.red.shl(this, num)
- );
+ return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
}),
(BN.prototype.redMul = function (num) {
return (
@@ -5642,46 +4912,22 @@ var require_bn = __commonJS({
);
}),
(BN.prototype.redSqr = function () {
- return (
- assert(this.red, "redSqr works only with red numbers"),
- this.red._verify1(this),
- this.red.sqr(this)
- );
+ return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
}),
(BN.prototype.redISqr = function () {
- return (
- assert(this.red, "redISqr works only with red numbers"),
- this.red._verify1(this),
- this.red.isqr(this)
- );
+ return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
}),
(BN.prototype.redSqrt = function () {
- return (
- assert(this.red, "redSqrt works only with red numbers"),
- this.red._verify1(this),
- this.red.sqrt(this)
- );
+ return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
}),
(BN.prototype.redInvm = function () {
- return (
- assert(this.red, "redInvm works only with red numbers"),
- this.red._verify1(this),
- this.red.invm(this)
- );
+ return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
}),
(BN.prototype.redNeg = function () {
- return (
- assert(this.red, "redNeg works only with red numbers"),
- this.red._verify1(this),
- this.red.neg(this)
- );
+ return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
}),
(BN.prototype.redPow = function (num) {
- return (
- assert(this.red && !num.red, "redPow(normalNum)"),
- this.red._verify1(this),
- this.red.pow(this, num)
- );
+ return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, num);
});
var primes = {
k256: null,
@@ -5703,11 +4949,7 @@ var require_bn = __commonJS({
(MPrime.prototype.ireduce = function (num) {
var r = num,
rlen;
- do
- this.split(r, this.tmp),
- (r = this.imulK(r)),
- (r = r.iadd(this.tmp)),
- (rlen = r.bitLength());
+ do this.split(r, this.tmp), (r = this.imulK(r)), (r = r.iadd(this.tmp)), (rlen = r.bitLength());
while (rlen > this.n);
var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
return (
@@ -5728,78 +4970,45 @@ var require_bn = __commonJS({
return num.imul(this.k);
});
function K256() {
- MPrime.call(
- this,
- "k256",
- "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
- );
+ MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
}
inherits(K256, MPrime),
(K256.prototype.split = function (input, output) {
- for (
- var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;
- i < outLen;
- i++
- )
+ for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0; i < outLen; i++)
output.words[i] = input.words[i];
if (((output.length = outLen), input.length <= 9)) {
(input.words[0] = 0), (input.length = 1);
return;
}
var prev = input.words[9];
- for (
- output.words[output.length++] = prev & mask, i = 10;
- i < input.length;
- i++
- ) {
+ for (output.words[output.length++] = prev & mask, i = 10; i < input.length; i++) {
var next = input.words[i] | 0;
- (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)),
- (prev = next);
+ (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)), (prev = next);
}
(prev >>>= 22),
(input.words[i - 10] = prev),
- prev === 0 && input.length > 10
- ? (input.length -= 10)
- : (input.length -= 9);
+ prev === 0 && input.length > 10 ? (input.length -= 10) : (input.length -= 9);
}),
(K256.prototype.imulK = function (num) {
- (num.words[num.length] = 0),
- (num.words[num.length + 1] = 0),
- (num.length += 2);
+ (num.words[num.length] = 0), (num.words[num.length + 1] = 0), (num.length += 2);
for (var lo = 0, i = 0; i < num.length; i++) {
var w = num.words[i] | 0;
- (lo += w * 977),
- (num.words[i] = lo & 67108863),
- (lo = w * 64 + ((lo / 67108864) | 0));
+ (lo += w * 977), (num.words[i] = lo & 67108863), (lo = w * 64 + ((lo / 67108864) | 0));
}
return (
- num.words[num.length - 1] === 0 &&
- (num.length--, num.words[num.length - 1] === 0 && num.length--),
- num
+ num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num
);
});
function P224() {
- MPrime.call(
- this,
- "p224",
- "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
- );
+ MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
}
inherits(P224, MPrime);
function P192() {
- MPrime.call(
- this,
- "p192",
- "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
- );
+ MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
}
inherits(P192, MPrime);
function P25519() {
- MPrime.call(
- this,
- "25519",
- "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
- );
+ MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
}
inherits(P25519, MPrime),
(P25519.prototype.imulK = function (num) {
@@ -5824,26 +5033,17 @@ var require_bn = __commonJS({
if (typeof m == "string") {
var prime = BN._prime(m);
(this.m = prime.p), (this.prime = prime);
- } else
- assert(m.gtn(1), "modulus must be greater than 1"),
- (this.m = m),
- (this.prime = null);
+ } else assert(m.gtn(1), "modulus must be greater than 1"), (this.m = m), (this.prime = null);
}
(Red.prototype._verify1 = function (a) {
- assert(a.negative === 0, "red works only with positives"),
- assert(a.red, "red works only with red numbers");
+ assert(a.negative === 0, "red works only with positives"), assert(a.red, "red works only with red numbers");
}),
(Red.prototype._verify2 = function (a, b) {
- assert(
- (a.negative | b.negative) === 0,
- "red works only with positives",
- ),
+ assert((a.negative | b.negative) === 0, "red works only with positives"),
assert(a.red && a.red === b.red, "red works only with red numbers");
}),
(Red.prototype.imod = function (a) {
- return this.prime
- ? this.prime.ireduce(a)._forceRed(this)
- : a.umod(this.m)._forceRed(this);
+ return this.prime ? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);
}),
(Red.prototype.neg = function (a) {
return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
@@ -5890,29 +5090,19 @@ var require_bn = __commonJS({
var pow = this.m.add(new BN(1)).iushrn(2);
return this.pow(a, pow);
}
- for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; )
- s++, q.iushrn(1);
+ for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; ) s++, q.iushrn(1);
assert(!q.isZero());
var one = new BN(1).toRed(this),
nOne = one.redNeg(),
lpow = this.m.subn(1).iushrn(1),
z = this.m.bitLength();
+ for (z = new BN(2 * z * z).toRed(this); this.pow(z, lpow).cmp(nOne) !== 0; ) z.redIAdd(nOne);
for (
- z = new BN(2 * z * z).toRed(this);
- this.pow(z, lpow).cmp(nOne) !== 0;
-
- )
- z.redIAdd(nOne);
- for (
- var c = this.pow(z, q),
- r = this.pow(a, q.addn(1).iushrn(1)),
- t = this.pow(a, q),
- m = s;
+ var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;
t.cmp(one) !== 0;
) {
- for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++)
- tmp = tmp.redSqr();
+ for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++) tmp = tmp.redSqr();
assert(i < m);
var b = this.pow(c, new BN(1).iushln(m - i - 1));
(r = r.redMul(b)), (c = b.redSqr()), (t = t.redMul(c)), (m = i);
@@ -5921,9 +5111,7 @@ var require_bn = __commonJS({
}),
(Red.prototype.invm = function (a) {
var inv = a._invmp(this.m);
- return inv.negative !== 0
- ? ((inv.negative = 0), this.imod(inv).redNeg())
- : this.imod(inv);
+ return inv.negative !== 0 ? ((inv.negative = 0), this.imod(inv).redNeg()) : this.imod(inv);
}),
(Red.prototype.pow = function (a, num) {
if (num.isZero()) return new BN(1).toRed(this);
@@ -5939,10 +5127,7 @@ var require_bn = __commonJS({
for (start === 0 && (start = 26), i = num.length - 1; i >= 0; i--) {
for (var word = num.words[i], j = start - 1; j >= 0; j--) {
var bit = (word >> j) & 1;
- if (
- (res !== wnd[0] && (res = this.sqr(res)),
- bit === 0 && current === 0)
- ) {
+ if ((res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0)) {
currentLen = 0;
continue;
}
@@ -5950,9 +5135,7 @@ var require_bn = __commonJS({
(current |= bit),
currentLen++,
!(currentLen !== windowSize && (i !== 0 || j !== 0)) &&
- ((res = this.mul(res, wnd[current])),
- (currentLen = 0),
- (current = 0));
+ ((res = this.mul(res, wnd[current])), (currentLen = 0), (current = 0));
}
start = 26;
}
@@ -5989,38 +5172,23 @@ var require_bn = __commonJS({
return (r.red = null), r;
}),
(Mont.prototype.imul = function (a, b) {
- if (a.isZero() || b.isZero())
- return (a.words[0] = 0), (a.length = 1), a;
+ if (a.isZero() || b.isZero()) return (a.words[0] = 0), (a.length = 1), a;
var t = a.imul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.mul = function (a, b) {
if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
var t = a.mul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.invm = function (a) {
@@ -6056,9 +5224,7 @@ var require_bn2 = __commonJS({
((base === "le" || base === "be") && ((endian = base), (base = 10)),
this._init(number || 0, base || 10, endian || "be"));
}
- typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN),
- (BN.BN = BN),
- (BN.wordSize = 26);
+ typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN), (BN.BN = BN), (BN.wordSize = 26);
var Buffer2;
try {
typeof window < "u" && typeof window.Buffer < "u"
@@ -6080,10 +5246,8 @@ var require_bn2 = __commonJS({
return left.cmp(right) < 0 ? left : right;
}),
(BN.prototype._init = function (number, base, endian) {
- if (typeof number == "number")
- return this._initNumber(number, base, endian);
- if (typeof number == "object")
- return this._initArray(number, base, endian);
+ if (typeof number == "number") return this._initNumber(number, base, endian);
+ if (typeof number == "object") return this._initArray(number, base, endian);
base === "hex" && (base = 16),
assert(base === (base | 0) && base >= 2 && base <= 36),
(number = number.toString().replace(/\s+/g, ""));
@@ -6093,33 +5257,23 @@ var require_bn2 = __commonJS({
(base === 16
? this._parseHex(number, start, endian)
: (this._parseBase(number, base, start),
- endian === "le" &&
- this._initArray(this.toArray(), base, endian)));
+ endian === "le" && this._initArray(this.toArray(), base, endian)));
}),
(BN.prototype._initNumber = function (number, base, endian) {
number < 0 && ((this.negative = 1), (number = -number)),
number < 67108864
? ((this.words = [number & 67108863]), (this.length = 1))
: number < 4503599627370496
- ? ((this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- ]),
- (this.length = 2))
+ ? ((this.words = [number & 67108863, (number / 67108864) & 67108863]), (this.length = 2))
: (assert(number < 9007199254740992),
- (this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- 1,
- ]),
+ (this.words = [number & 67108863, (number / 67108864) & 67108863, 1]),
(this.length = 3)),
endian === "le" && this._initArray(this.toArray(), base, endian);
}),
(BN.prototype._initArray = function (number, base, endian) {
if ((assert(typeof number.length == "number"), number.length <= 0))
return (this.words = [0]), (this.length = 1), this;
- (this.length = Math.ceil(number.length / 3)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil(number.length / 3)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var j,
w,
@@ -6142,23 +5296,14 @@ var require_bn2 = __commonJS({
});
function parseHex4Bits(string, index) {
var c = string.charCodeAt(index);
- return c >= 65 && c <= 70
- ? c - 55
- : c >= 97 && c <= 102
- ? c - 87
- : (c - 48) & 15;
+ return c >= 65 && c <= 70 ? c - 55 : c >= 97 && c <= 102 ? c - 87 : (c - 48) & 15;
}
function parseHexByte(string, lowerBound, index) {
var r = parseHex4Bits(string, index);
- return (
- index - 1 >= lowerBound &&
- (r |= parseHex4Bits(string, index - 1) << 4),
- r
- );
+ return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;
}
BN.prototype._parseHex = function (number, start, endian) {
- (this.length = Math.ceil((number.length - start) / 6)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil((number.length - start) / 6)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var off = 0,
j = 0,
@@ -6167,44 +5312,26 @@ var require_bn2 = __commonJS({
for (i = number.length - 1; i >= start; i -= 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
else {
var parseLength = number.length - start;
- for (
- i = parseLength % 2 === 0 ? start + 1 : start;
- i < number.length;
- i += 2
- )
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
}
this.strip();
};
function parseBase(str, start, end, mul) {
- for (
- var r = 0, len = Math.min(str.length, end), i = start;
- i < len;
- i++
- ) {
+ for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
var c = str.charCodeAt(i) - 48;
- (r *= mul),
- c >= 49
- ? (r += c - 49 + 10)
- : c >= 17
- ? (r += c - 17 + 10)
- : (r += c);
+ (r *= mul), c >= 49 ? (r += c - 49 + 10) : c >= 17 ? (r += c - 17 + 10) : (r += c);
}
return r;
}
(BN.prototype._parseBase = function (number, base, start) {
(this.words = [0]), (this.length = 1);
- for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base)
- limbLen++;
+ for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
limbLen--, (limbPow = (limbPow / base) | 0);
for (
var total = number.length - start,
@@ -6217,30 +5344,18 @@ var require_bn2 = __commonJS({
)
(word = parseBase(number, i, i + limbLen, base)),
this.imuln(limbPow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
if (mod !== 0) {
var pow = 1;
- for (
- word = parseBase(number, i, number.length, base), i = 0;
- i < mod;
- i++
- )
- pow *= base;
- this.imuln(pow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
+ this.imuln(pow), this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
}
this.strip();
}),
(BN.prototype.copy = function (dest) {
dest.words = new Array(this.length);
for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
- (dest.length = this.length),
- (dest.negative = this.negative),
- (dest.red = this.red);
+ (dest.length = this.length), (dest.negative = this.negative), (dest.red = this.red);
}),
(BN.prototype.clone = function () {
var r = new BN(null);
@@ -6251,15 +5366,11 @@ var require_bn2 = __commonJS({
return this;
}),
(BN.prototype.strip = function () {
- for (; this.length > 1 && this.words[this.length - 1] === 0; )
- this.length--;
+ for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
return this._normSign();
}),
(BN.prototype._normSign = function () {
- return (
- this.length === 1 && this.words[0] === 0 && (this.negative = 0),
- this
- );
+ return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}),
(BN.prototype.inspect = function () {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -6293,15 +5404,13 @@ var require_bn2 = __commonJS({
"0000000000000000000000000",
],
groupSizes = [
- 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5,
],
groupBases = [
- 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607,
- 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536,
- 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101,
- 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368,
- 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
+ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808,
+ 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624,
+ 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
60466176,
];
(BN.prototype.toString = function (base, padding) {
@@ -6313,18 +5422,11 @@ var require_bn2 = __commonJS({
var w = this.words[i],
word = (((w << off) | carry) & 16777215).toString(16);
(carry = (w >>> (24 - off)) & 16777215),
- carry !== 0 || i !== this.length - 1
- ? (out = zeros[6 - word.length] + word + out)
- : (out = word + out),
+ carry !== 0 || i !== this.length - 1 ? (out = zeros[6 - word.length] + word + out) : (out = word + out),
(off += 2),
off >= 26 && ((off -= 26), i--);
}
- for (
- carry !== 0 && (out = carry.toString(16) + out);
- out.length % padding !== 0;
-
- )
- out = "0" + out;
+ for (carry !== 0 && (out = carry.toString(16) + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
if (base === (base | 0) && base >= 2 && base <= 36) {
@@ -6334,13 +5436,9 @@ var require_bn2 = __commonJS({
var c = this.clone();
for (c.negative = 0; !c.isZero(); ) {
var r = c.modn(groupBase).toString(base);
- (c = c.idivn(groupBase)),
- c.isZero()
- ? (out = r + out)
- : (out = zeros[groupSize - r.length] + r + out);
+ (c = c.idivn(groupBase)), c.isZero() ? (out = r + out) : (out = zeros[groupSize - r.length] + r + out);
}
- for (this.isZero() && (out = "0" + out); out.length % padding !== 0; )
- out = "0" + out;
+ for (this.isZero() && (out = "0" + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
assert(!1, "Base should be between 2 and 36");
@@ -6352,8 +5450,7 @@ var require_bn2 = __commonJS({
? (ret += this.words[1] * 67108864)
: this.length === 3 && this.words[2] === 1
? (ret += 4503599627370496 + this.words[1] * 67108864)
- : this.length > 2 &&
- assert(!1, "Number can only safely store up to 53 bits"),
+ : this.length > 2 && assert(!1, "Number can only safely store up to 53 bits"),
this.negative !== 0 ? -ret : ret
);
}),
@@ -6361,10 +5458,7 @@ var require_bn2 = __commonJS({
return this.toString(16);
}),
(BN.prototype.toBuffer = function (endian, length) {
- return (
- assert(typeof Buffer2 < "u"),
- this.toArrayLike(Buffer2, endian, length)
- );
+ return assert(typeof Buffer2 < "u"), this.toArrayLike(Buffer2, endian, length);
}),
(BN.prototype.toArray = function (endian, length) {
return this.toArrayLike(Array, endian, length);
@@ -6372,10 +5466,7 @@ var require_bn2 = __commonJS({
(BN.prototype.toArrayLike = function (ArrayType, endian, length) {
var byteLength = this.byteLength(),
reqLength = length || Math.max(1, byteLength);
- assert(
- byteLength <= reqLength,
- "byte array longer than desired length",
- ),
+ assert(byteLength <= reqLength, "byte array longer than desired length"),
assert(reqLength > 0, "Requested array length <= 0"),
this.strip();
var littleEndian = endian === "le",
@@ -6384,13 +5475,11 @@ var require_bn2 = __commonJS({
i,
q = this.clone();
if (littleEndian) {
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[i] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[i] = b);
for (; i < reqLength; i++) res[i] = 0;
} else {
for (i = 0; i < reqLength - byteLength; i++) res[i] = 0;
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
}
return res;
}),
@@ -6428,11 +5517,7 @@ var require_bn2 = __commonJS({
return (this.length - 1) * 26 + hi;
});
function toBitArray(num) {
- for (
- var w = new Array(num.bitLength()), bit = 0;
- bit < w.length;
- bit++
- ) {
+ for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
var off = (bit / 26) | 0,
wbit = bit % 26;
w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
@@ -6451,14 +5536,10 @@ var require_bn2 = __commonJS({
return Math.ceil(this.bitLength() / 8);
}),
(BN.prototype.toTwos = function (width) {
- return this.negative !== 0
- ? this.abs().inotn(width).iaddn(1)
- : this.clone();
+ return this.negative !== 0 ? this.abs().inotn(width).iaddn(1) : this.clone();
}),
(BN.prototype.fromTwos = function (width) {
- return this.testn(width - 1)
- ? this.notn(width).iaddn(1).ineg()
- : this.clone();
+ return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
}),
(BN.prototype.isNeg = function () {
return this.negative !== 0;
@@ -6471,50 +5552,37 @@ var require_bn2 = __commonJS({
}),
(BN.prototype.iuor = function (num) {
for (; this.length < num.length; ) this.words[this.length++] = 0;
- for (var i = 0; i < num.length; i++)
- this.words[i] = this.words[i] | num.words[i];
+ for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
return this.strip();
}),
(BN.prototype.ior = function (num) {
return assert((this.negative | num.negative) === 0), this.iuor(num);
}),
(BN.prototype.or = function (num) {
- return this.length > num.length
- ? this.clone().ior(num)
- : num.clone().ior(this);
+ return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
}),
(BN.prototype.uor = function (num) {
- return this.length > num.length
- ? this.clone().iuor(num)
- : num.clone().iuor(this);
+ return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
}),
(BN.prototype.iuand = function (num) {
var b;
this.length > num.length ? (b = num) : (b = this);
- for (var i = 0; i < b.length; i++)
- this.words[i] = this.words[i] & num.words[i];
+ for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
return (this.length = b.length), this.strip();
}),
(BN.prototype.iand = function (num) {
return assert((this.negative | num.negative) === 0), this.iuand(num);
}),
(BN.prototype.and = function (num) {
- return this.length > num.length
- ? this.clone().iand(num)
- : num.clone().iand(this);
+ return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
}),
(BN.prototype.uand = function (num) {
- return this.length > num.length
- ? this.clone().iuand(num)
- : num.clone().iuand(this);
+ return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
}),
(BN.prototype.iuxor = function (num) {
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
- for (var i = 0; i < b.length; i++)
- this.words[i] = a.words[i] ^ b.words[i];
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
+ for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
if (this !== a) for (; i < a.length; i++) this.words[i] = a.words[i];
return (this.length = a.length), this.strip();
}),
@@ -6522,27 +5590,18 @@ var require_bn2 = __commonJS({
return assert((this.negative | num.negative) === 0), this.iuxor(num);
}),
(BN.prototype.xor = function (num) {
- return this.length > num.length
- ? this.clone().ixor(num)
- : num.clone().ixor(this);
+ return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
}),
(BN.prototype.uxor = function (num) {
- return this.length > num.length
- ? this.clone().iuxor(num)
- : num.clone().iuxor(this);
+ return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
}),
(BN.prototype.inotn = function (width) {
assert(typeof width == "number" && width >= 0);
var bytesNeeded = Math.ceil(width / 26) | 0,
bitsLeft = width % 26;
this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;
- for (var i = 0; i < bytesNeeded; i++)
- this.words[i] = ~this.words[i] & 67108863;
- return (
- bitsLeft > 0 &&
- (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))),
- this.strip()
- );
+ for (var i = 0; i < bytesNeeded; i++) this.words[i] = ~this.words[i] & 67108863;
+ return bitsLeft > 0 && (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))), this.strip();
}),
(BN.prototype.notn = function (width) {
return this.clone().inotn(width);
@@ -6562,49 +5621,25 @@ var require_bn2 = __commonJS({
(BN.prototype.iadd = function (num) {
var r;
if (this.negative !== 0 && num.negative === 0)
- return (
- (this.negative = 0),
- (r = this.isub(num)),
- (this.negative ^= 1),
- this._normSign()
- );
+ return (this.negative = 0), (r = this.isub(num)), (this.negative ^= 1), this._normSign();
if (this.negative === 0 && num.negative !== 0)
- return (
- (num.negative = 0),
- (r = this.isub(num)),
- (num.negative = 1),
- r._normSign()
- );
+ return (num.negative = 0), (r = this.isub(num)), (num.negative = 1), r._normSign();
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) + (b.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
+ (r = (a.words[i] | 0) + (b.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
- if (((this.length = a.length), carry !== 0))
- (this.words[this.length] = carry), this.length++;
- else if (a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
+ (r = (a.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
+ if (((this.length = a.length), carry !== 0)) (this.words[this.length] = carry), this.length++;
+ else if (a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
return this;
}),
(BN.prototype.add = function (num) {
var res;
return num.negative !== 0 && this.negative === 0
- ? ((num.negative = 0),
- (res = this.sub(num)),
- (num.negative ^= 1),
- res)
+ ? ((num.negative = 0), (res = this.sub(num)), (num.negative ^= 1), res)
: num.negative === 0 && this.negative !== 0
- ? ((this.negative = 0),
- (res = num.sub(this)),
- (this.negative = 1),
- res)
+ ? ((this.negative = 0), (res = num.sub(this)), (this.negative = 1), res)
: this.length > num.length
? this.clone().iadd(num)
: num.clone().iadd(this);
@@ -6615,34 +5650,17 @@ var require_bn2 = __commonJS({
var r = this.iadd(num);
return (num.negative = 1), r._normSign();
} else if (this.negative !== 0)
- return (
- (this.negative = 0),
- this.iadd(num),
- (this.negative = 1),
- this._normSign()
- );
+ return (this.negative = 0), this.iadd(num), (this.negative = 1), this._normSign();
var cmp = this.cmp(num);
- if (cmp === 0)
- return (
- (this.negative = 0), (this.length = 1), (this.words[0] = 0), this
- );
+ if (cmp === 0) return (this.negative = 0), (this.length = 1), (this.words[0] = 0), this;
var a, b;
cmp > 0 ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) - (b.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
+ (r = (a.words[i] | 0) - (b.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
- if (carry === 0 && i < a.length && a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
- return (
- (this.length = Math.max(this.length, i)),
- a !== this && (this.negative = 1),
- this.strip()
- );
+ (r = (a.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
+ if (carry === 0 && i < a.length && a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
+ return (this.length = Math.max(this.length, i)), a !== this && (this.negative = 1), this.strip();
}),
(BN.prototype.sub = function (num) {
return this.clone().isub(num);
@@ -6675,9 +5693,7 @@ var require_bn2 = __commonJS({
}
(out.words[k] = rword | 0), (carry = ncarry | 0);
}
- return (
- carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip()
- );
+ return carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip();
}
var comb10MulTo = function (self2, num, out) {
var a = self2.words,
@@ -7232,15 +6248,12 @@ var require_bn2 = __commonJS({
};
Math.imul || (comb10MulTo = smallMulTo);
function bigMulTo(self2, num, out) {
- (out.negative = num.negative ^ self2.negative),
- (out.length = self2.length + num.length);
+ (out.negative = num.negative ^ self2.negative), (out.length = self2.length + num.length);
for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
var ncarry = hncarry;
hncarry = 0;
for (
- var rword = carry & 67108863,
- maxJ = Math.min(k, num.length - 1),
- j = Math.max(0, k - self2.length + 1);
+ var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);
j <= maxJ;
j++
) {
@@ -7282,32 +6295,22 @@ var require_bn2 = __commonJS({
(this.x = x), (this.y = y);
}
(FFTM.prototype.makeRBT = function (N) {
- for (
- var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0;
- i < N;
- i++
- )
- t[i] = this.revBin(i, l, N);
+ for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
return t;
}),
(FFTM.prototype.revBin = function (x, l, N) {
if (x === 0 || x === N - 1) return x;
- for (var rb = 0, i = 0; i < l; i++)
- (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
+ for (var rb = 0, i = 0; i < l; i++) (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
return rb;
}),
(FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++)
- (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
+ for (var i = 0; i < N; i++) (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
}),
(FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) {
this.permute(rbt, rws, iws, rtws, itws, N);
for (var s = 1; s < N; s <<= 1)
for (
- var l = s << 1,
- rtwdf = Math.cos((2 * Math.PI) / l),
- itwdf = Math.sin((2 * Math.PI) / l),
- p = 0;
+ var l = s << 1, rtwdf = Math.cos((2 * Math.PI) / l), itwdf = Math.sin((2 * Math.PI) / l), p = 0;
p < N;
p += l
)
@@ -7324,9 +6327,7 @@ var require_bn2 = __commonJS({
(rtws[p + j + s] = re - ro),
(itws[p + j + s] = ie - io),
j !== l &&
- ((rx = rtwdf * rtwdf_ - itwdf * itwdf_),
- (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_),
- (rtwdf_ = rx));
+ ((rx = rtwdf * rtwdf_ - itwdf * itwdf_), (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_), (rtwdf_ = rx));
}
}),
(FFTM.prototype.guessLen13b = function (n, m) {
@@ -7349,12 +6350,8 @@ var require_bn2 = __commonJS({
}),
(FFTM.prototype.normalize13b = function (ws, N) {
for (var carry = 0, i = 0; i < N / 2; i++) {
- var w =
- Math.round(ws[2 * i + 1] / N) * 8192 +
- Math.round(ws[2 * i] / N) +
- carry;
- (ws[i] = w & 67108863),
- w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
+ var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;
+ (ws[i] = w & 67108863), w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
}
return ws;
}),
@@ -7404,17 +6401,11 @@ var require_bn2 = __commonJS({
}),
(BN.prototype.mul = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- this.mulTo(num, out)
- );
+ return (out.words = new Array(this.length + num.length)), this.mulTo(num, out);
}),
(BN.prototype.mulf = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- jumboMulTo(this, num, out)
- );
+ return (out.words = new Array(this.length + num.length)), jumboMulTo(this, num, out);
}),
(BN.prototype.imul = function (num) {
return this.clone().mulTo(num, this);
@@ -7424,10 +6415,7 @@ var require_bn2 = __commonJS({
for (var carry = 0, i = 0; i < this.length; i++) {
var w = (this.words[i] | 0) * num,
lo = (w & 67108863) + (carry & 67108863);
- (carry >>= 26),
- (carry += (w / 67108864) | 0),
- (carry += lo >>> 26),
- (this.words[i] = lo & 67108863);
+ (carry >>= 26), (carry += (w / 67108864) | 0), (carry += lo >>> 26), (this.words[i] = lo & 67108863);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -7443,14 +6431,8 @@ var require_bn2 = __commonJS({
(BN.prototype.pow = function (num) {
var w = toBitArray(num);
if (w.length === 0) return new BN(1);
- for (
- var res = this, i = 0;
- i < w.length && w[i] === 0;
- i++, res = res.sqr()
- );
- if (++i < w.length)
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr())
- w[i] !== 0 && (res = res.mul(q));
+ for (var res = this, i = 0; i < w.length && w[i] === 0; i++, res = res.sqr());
+ if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) w[i] !== 0 && (res = res.mul(q));
return res;
}),
(BN.prototype.iushln = function (bits) {
@@ -7469,8 +6451,7 @@ var require_bn2 = __commonJS({
carry && ((this.words[i] = carry), this.length++);
}
if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--)
- this.words[i + s] = this.words[i];
+ for (i = this.length - 1; i >= 0; i--) this.words[i + s] = this.words[i];
for (i = 0; i < s; i++) this.words[i] = 0;
this.length += s;
}
@@ -7492,20 +6473,15 @@ var require_bn2 = __commonJS({
maskedWords.length = s;
}
if (s !== 0)
- if (this.length > s)
- for (this.length -= s, i = 0; i < this.length; i++)
- this.words[i] = this.words[i + s];
+ if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s];
else (this.words[0] = 0), (this.length = 1);
var carry = 0;
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
var word = this.words[i] | 0;
- (this.words[i] = (carry << (26 - r)) | (word >>> r)),
- (carry = word & mask);
+ (this.words[i] = (carry << (26 - r)) | (word >>> r)), (carry = word & mask);
}
return (
- maskedWords &&
- carry !== 0 &&
- (maskedWords.words[maskedWords.length++] = carry),
+ maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry),
this.length === 0 && ((this.words[0] = 0), (this.length = 1)),
this.strip()
);
@@ -7538,17 +6514,8 @@ var require_bn2 = __commonJS({
assert(typeof bits == "number" && bits >= 0);
var r = bits % 26,
s = (bits - r) / 26;
- if (
- (assert(
- this.negative === 0,
- "imaskn works only with positive numbers",
- ),
- this.length <= s)
- )
- return this;
- if (
- (r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)
- ) {
+ if ((assert(this.negative === 0, "imaskn works only with positive numbers"), this.length <= s)) return this;
+ if ((r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)) {
var mask = 67108863 ^ ((67108863 >>> r) << r);
this.words[this.length - 1] &= mask;
}
@@ -7565,32 +6532,20 @@ var require_bn2 = __commonJS({
? this.isubn(-num)
: this.negative !== 0
? this.length === 1 && (this.words[0] | 0) < num
- ? ((this.words[0] = num - (this.words[0] | 0)),
- (this.negative = 0),
- this)
- : ((this.negative = 0),
- this.isubn(num),
- (this.negative = 1),
- this)
+ ? ((this.words[0] = num - (this.words[0] | 0)), (this.negative = 0), this)
+ : ((this.negative = 0), this.isubn(num), (this.negative = 1), this)
: this._iaddn(num)
);
}),
(BN.prototype._iaddn = function (num) {
this.words[0] += num;
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++)
- (this.words[i] -= 67108864),
- i === this.length - 1
- ? (this.words[i + 1] = 1)
- : this.words[i + 1]++;
+ (this.words[i] -= 67108864), i === this.length - 1 ? (this.words[i + 1] = 1) : this.words[i + 1]++;
return (this.length = Math.max(this.length, i + 1)), this;
}),
(BN.prototype.isubn = function (num) {
- if ((assert(typeof num == "number"), assert(num < 67108864), num < 0))
- return this.iaddn(-num);
- if (this.negative !== 0)
- return (
- (this.negative = 0), this.iaddn(num), (this.negative = 1), this
- );
+ if ((assert(typeof num == "number"), assert(num < 67108864), num < 0)) return this.iaddn(-num);
+ if (this.negative !== 0) return (this.negative = 0), this.iaddn(num), (this.negative = 1), this;
if (((this.words[0] -= num), this.length === 1 && this.words[0] < 0))
(this.words[0] = -this.words[0]), (this.negative = 1);
else
@@ -7624,14 +6579,10 @@ var require_bn2 = __commonJS({
(this.words[i + shift] = w & 67108863);
}
for (; i < this.length - shift; i++)
- (w = (this.words[i + shift] | 0) + carry),
- (carry = w >> 26),
- (this.words[i + shift] = w & 67108863);
+ (w = (this.words[i + shift] | 0) + carry), (carry = w >> 26), (this.words[i + shift] = w & 67108863);
if (carry === 0) return this.strip();
for (assert(carry === -1), carry = 0, i = 0; i < this.length; i++)
- (w = -(this.words[i] | 0) + carry),
- (carry = w >> 26),
- (this.words[i] = w & 67108863);
+ (w = -(this.words[i] | 0) + carry), (carry = w >> 26), (this.words[i] = w & 67108863);
return (this.negative = 1), this.strip();
}),
(BN.prototype._wordDiv = function (num, mode) {
@@ -7641,33 +6592,19 @@ var require_bn2 = __commonJS({
bhi = b.words[b.length - 1] | 0,
bhiBits = this._countBits(bhi);
(shift = 26 - bhiBits),
- shift !== 0 &&
- ((b = b.ushln(shift)),
- a.iushln(shift),
- (bhi = b.words[b.length - 1] | 0));
+ shift !== 0 && ((b = b.ushln(shift)), a.iushln(shift), (bhi = b.words[b.length - 1] | 0));
var m = a.length - b.length,
q;
if (mode !== "mod") {
- (q = new BN(null)),
- (q.length = m + 1),
- (q.words = new Array(q.length));
+ (q = new BN(null)), (q.length = m + 1), (q.words = new Array(q.length));
for (var i = 0; i < q.length; i++) q.words[i] = 0;
}
var diff = a.clone()._ishlnsubmul(b, 1, m);
diff.negative === 0 && ((a = diff), q && (q.words[m] = 1));
for (var j = m - 1; j >= 0; j--) {
- var qj =
- (a.words[b.length + j] | 0) * 67108864 +
- (a.words[b.length + j - 1] | 0);
- for (
- qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j);
- a.negative !== 0;
-
- )
- qj--,
- (a.negative = 0),
- a._ishlnsubmul(b, 1, j),
- a.isZero() || (a.negative ^= 1);
+ var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);
+ for (qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j); a.negative !== 0; )
+ qj--, (a.negative = 0), a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
q && (q.words[j] = qj);
}
return (
@@ -7690,9 +6627,7 @@ var require_bn2 = __commonJS({
return this.negative !== 0 && num.negative === 0
? ((res = this.neg().divmod(num, mode)),
mode !== "mod" && (div = res.div.neg()),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.iadd(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.iadd(num)),
{
div,
mod,
@@ -7706,9 +6641,7 @@ var require_bn2 = __commonJS({
})
: (this.negative & num.negative) !== 0
? ((res = this.neg().divmod(num.neg(), mode)),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.isub(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.isub(num)),
{
div: res.div,
mod,
@@ -7759,11 +6692,7 @@ var require_bn2 = __commonJS({
}),
(BN.prototype.modn = function (num) {
assert(num <= 67108863);
- for (
- var p = (1 << 26) % num, acc = 0, i = this.length - 1;
- i >= 0;
- i--
- )
+ for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; i >= 0; i--)
acc = (p * acc + (this.words[i] | 0)) % num;
return acc;
}),
@@ -7783,40 +6712,18 @@ var require_bn2 = __commonJS({
var x = this,
y = p.clone();
x.negative !== 0 ? (x = x.umod(p)) : (x = x.clone());
- for (
- var A = new BN(1),
- B = new BN(0),
- C = new BN(0),
- D = new BN(1),
- g = 0;
- x.isEven() && y.isEven();
-
- )
+ for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); )
x.iushrn(1), y.iushrn(1), ++g;
for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
- for (
- var i = 0, im = 1;
- (x.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
if (i > 0)
for (x.iushrn(i); i-- > 0; )
- (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)),
- A.iushrn(1),
- B.iushrn(1);
- for (
- var j = 0, jm = 1;
- (y.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
+ (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
if (j > 0)
for (y.iushrn(j); j-- > 0; )
- (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)),
- C.iushrn(1),
- D.iushrn(1);
- x.cmp(y) >= 0
- ? (x.isub(y), A.isub(C), B.isub(D))
- : (y.isub(x), C.isub(A), D.isub(B));
+ (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);
+ x.cmp(y) >= 0 ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
}
return {
a: C,
@@ -7829,35 +6736,15 @@ var require_bn2 = __commonJS({
var a = this,
b = p.clone();
a.negative !== 0 ? (a = a.umod(p)) : (a = a.clone());
- for (
- var x1 = new BN(1), x2 = new BN(0), delta = b.clone();
- a.cmpn(1) > 0 && b.cmpn(1) > 0;
-
- ) {
- for (
- var i = 0, im = 1;
- (a.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
- if (i > 0)
- for (a.iushrn(i); i-- > 0; )
- x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
- for (
- var j = 0, jm = 1;
- (b.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
- if (j > 0)
- for (b.iushrn(j); j-- > 0; )
- x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
+ for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone(); a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
+ if (i > 0) for (a.iushrn(i); i-- > 0; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
+ if (j > 0) for (b.iushrn(j); j-- > 0; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
a.cmp(b) >= 0 ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
}
var res;
- return (
- a.cmpn(1) === 0 ? (res = x1) : (res = x2),
- res.cmpn(0) < 0 && res.iadd(p),
- res
- );
+ return a.cmpn(1) === 0 ? (res = x1) : (res = x2), res.cmpn(0) < 0 && res.iadd(p), res;
}),
(BN.prototype.gcd = function (num) {
if (this.isZero()) return num.abs();
@@ -7865,8 +6752,7 @@ var require_bn2 = __commonJS({
var a = this.clone(),
b = num.clone();
(a.negative = 0), (b.negative = 0);
- for (var shift = 0; a.isEven() && b.isEven(); shift++)
- a.iushrn(1), b.iushrn(1);
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), b.iushrn(1);
do {
for (; a.isEven(); ) a.iushrn(1);
for (; b.isEven(); ) b.iushrn(1);
@@ -7896,14 +6782,10 @@ var require_bn2 = __commonJS({
var r = bit % 26,
s = (bit - r) / 26,
q = 1 << r;
- if (this.length <= s)
- return this._expand(s + 1), (this.words[s] |= q), this;
+ if (this.length <= s) return this._expand(s + 1), (this.words[s] |= q), this;
for (var carry = q, i = s; carry !== 0 && i < this.length; i++) {
var w = this.words[i] | 0;
- (w += carry),
- (carry = w >>> 26),
- (w &= 67108863),
- (this.words[i] = w);
+ (w += carry), (carry = w >>> 26), (w &= 67108863), (this.words[i] = w);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -7918,8 +6800,7 @@ var require_bn2 = __commonJS({
var res;
if (this.length > 1) res = 1;
else {
- negative && (num = -num),
- assert(num <= 67108863, "Number is too big");
+ negative && (num = -num), assert(num <= 67108863, "Number is too big");
var w = this.words[0] | 0;
res = w === num ? 0 : w < num ? -1 : 1;
}
@@ -7985,52 +6866,28 @@ var require_bn2 = __commonJS({
);
}),
(BN.prototype.fromRed = function () {
- return (
- assert(
- this.red,
- "fromRed works only with numbers in reduction context",
- ),
- this.red.convertFrom(this)
- );
+ return assert(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
}),
(BN.prototype._forceRed = function (ctx) {
return (this.red = ctx), this;
}),
(BN.prototype.forceRed = function (ctx) {
- return (
- assert(!this.red, "Already a number in reduction context"),
- this._forceRed(ctx)
- );
+ return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
}),
(BN.prototype.redAdd = function (num) {
- return (
- assert(this.red, "redAdd works only with red numbers"),
- this.red.add(this, num)
- );
+ return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
}),
(BN.prototype.redIAdd = function (num) {
- return (
- assert(this.red, "redIAdd works only with red numbers"),
- this.red.iadd(this, num)
- );
+ return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
}),
(BN.prototype.redSub = function (num) {
- return (
- assert(this.red, "redSub works only with red numbers"),
- this.red.sub(this, num)
- );
+ return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
}),
(BN.prototype.redISub = function (num) {
- return (
- assert(this.red, "redISub works only with red numbers"),
- this.red.isub(this, num)
- );
+ return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
}),
(BN.prototype.redShl = function (num) {
- return (
- assert(this.red, "redShl works only with red numbers"),
- this.red.shl(this, num)
- );
+ return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
}),
(BN.prototype.redMul = function (num) {
return (
@@ -8047,46 +6904,22 @@ var require_bn2 = __commonJS({
);
}),
(BN.prototype.redSqr = function () {
- return (
- assert(this.red, "redSqr works only with red numbers"),
- this.red._verify1(this),
- this.red.sqr(this)
- );
+ return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
}),
(BN.prototype.redISqr = function () {
- return (
- assert(this.red, "redISqr works only with red numbers"),
- this.red._verify1(this),
- this.red.isqr(this)
- );
+ return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
}),
(BN.prototype.redSqrt = function () {
- return (
- assert(this.red, "redSqrt works only with red numbers"),
- this.red._verify1(this),
- this.red.sqrt(this)
- );
+ return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
}),
(BN.prototype.redInvm = function () {
- return (
- assert(this.red, "redInvm works only with red numbers"),
- this.red._verify1(this),
- this.red.invm(this)
- );
+ return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
}),
(BN.prototype.redNeg = function () {
- return (
- assert(this.red, "redNeg works only with red numbers"),
- this.red._verify1(this),
- this.red.neg(this)
- );
+ return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
}),
(BN.prototype.redPow = function (num) {
- return (
- assert(this.red && !num.red, "redPow(normalNum)"),
- this.red._verify1(this),
- this.red.pow(this, num)
- );
+ return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, num);
});
var primes = {
k256: null,
@@ -8108,11 +6941,7 @@ var require_bn2 = __commonJS({
(MPrime.prototype.ireduce = function (num) {
var r = num,
rlen;
- do
- this.split(r, this.tmp),
- (r = this.imulK(r)),
- (r = r.iadd(this.tmp)),
- (rlen = r.bitLength());
+ do this.split(r, this.tmp), (r = this.imulK(r)), (r = r.iadd(this.tmp)), (rlen = r.bitLength());
while (rlen > this.n);
var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
return (
@@ -8133,78 +6962,45 @@ var require_bn2 = __commonJS({
return num.imul(this.k);
});
function K256() {
- MPrime.call(
- this,
- "k256",
- "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
- );
+ MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
}
inherits(K256, MPrime),
(K256.prototype.split = function (input, output) {
- for (
- var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;
- i < outLen;
- i++
- )
+ for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0; i < outLen; i++)
output.words[i] = input.words[i];
if (((output.length = outLen), input.length <= 9)) {
(input.words[0] = 0), (input.length = 1);
return;
}
var prev = input.words[9];
- for (
- output.words[output.length++] = prev & mask, i = 10;
- i < input.length;
- i++
- ) {
+ for (output.words[output.length++] = prev & mask, i = 10; i < input.length; i++) {
var next = input.words[i] | 0;
- (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)),
- (prev = next);
+ (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)), (prev = next);
}
(prev >>>= 22),
(input.words[i - 10] = prev),
- prev === 0 && input.length > 10
- ? (input.length -= 10)
- : (input.length -= 9);
+ prev === 0 && input.length > 10 ? (input.length -= 10) : (input.length -= 9);
}),
(K256.prototype.imulK = function (num) {
- (num.words[num.length] = 0),
- (num.words[num.length + 1] = 0),
- (num.length += 2);
+ (num.words[num.length] = 0), (num.words[num.length + 1] = 0), (num.length += 2);
for (var lo = 0, i = 0; i < num.length; i++) {
var w = num.words[i] | 0;
- (lo += w * 977),
- (num.words[i] = lo & 67108863),
- (lo = w * 64 + ((lo / 67108864) | 0));
+ (lo += w * 977), (num.words[i] = lo & 67108863), (lo = w * 64 + ((lo / 67108864) | 0));
}
return (
- num.words[num.length - 1] === 0 &&
- (num.length--, num.words[num.length - 1] === 0 && num.length--),
- num
+ num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num
);
});
function P224() {
- MPrime.call(
- this,
- "p224",
- "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
- );
+ MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
}
inherits(P224, MPrime);
function P192() {
- MPrime.call(
- this,
- "p192",
- "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
- );
+ MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
}
inherits(P192, MPrime);
function P25519() {
- MPrime.call(
- this,
- "25519",
- "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
- );
+ MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
}
inherits(P25519, MPrime),
(P25519.prototype.imulK = function (num) {
@@ -8229,26 +7025,17 @@ var require_bn2 = __commonJS({
if (typeof m == "string") {
var prime = BN._prime(m);
(this.m = prime.p), (this.prime = prime);
- } else
- assert(m.gtn(1), "modulus must be greater than 1"),
- (this.m = m),
- (this.prime = null);
+ } else assert(m.gtn(1), "modulus must be greater than 1"), (this.m = m), (this.prime = null);
}
(Red.prototype._verify1 = function (a) {
- assert(a.negative === 0, "red works only with positives"),
- assert(a.red, "red works only with red numbers");
+ assert(a.negative === 0, "red works only with positives"), assert(a.red, "red works only with red numbers");
}),
(Red.prototype._verify2 = function (a, b) {
- assert(
- (a.negative | b.negative) === 0,
- "red works only with positives",
- ),
+ assert((a.negative | b.negative) === 0, "red works only with positives"),
assert(a.red && a.red === b.red, "red works only with red numbers");
}),
(Red.prototype.imod = function (a) {
- return this.prime
- ? this.prime.ireduce(a)._forceRed(this)
- : a.umod(this.m)._forceRed(this);
+ return this.prime ? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);
}),
(Red.prototype.neg = function (a) {
return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
@@ -8295,29 +7082,19 @@ var require_bn2 = __commonJS({
var pow = this.m.add(new BN(1)).iushrn(2);
return this.pow(a, pow);
}
- for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; )
- s++, q.iushrn(1);
+ for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; ) s++, q.iushrn(1);
assert(!q.isZero());
var one = new BN(1).toRed(this),
nOne = one.redNeg(),
lpow = this.m.subn(1).iushrn(1),
z = this.m.bitLength();
+ for (z = new BN(2 * z * z).toRed(this); this.pow(z, lpow).cmp(nOne) !== 0; ) z.redIAdd(nOne);
for (
- z = new BN(2 * z * z).toRed(this);
- this.pow(z, lpow).cmp(nOne) !== 0;
-
- )
- z.redIAdd(nOne);
- for (
- var c = this.pow(z, q),
- r = this.pow(a, q.addn(1).iushrn(1)),
- t = this.pow(a, q),
- m = s;
+ var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;
t.cmp(one) !== 0;
) {
- for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++)
- tmp = tmp.redSqr();
+ for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++) tmp = tmp.redSqr();
assert(i < m);
var b = this.pow(c, new BN(1).iushln(m - i - 1));
(r = r.redMul(b)), (c = b.redSqr()), (t = t.redMul(c)), (m = i);
@@ -8326,9 +7103,7 @@ var require_bn2 = __commonJS({
}),
(Red.prototype.invm = function (a) {
var inv = a._invmp(this.m);
- return inv.negative !== 0
- ? ((inv.negative = 0), this.imod(inv).redNeg())
- : this.imod(inv);
+ return inv.negative !== 0 ? ((inv.negative = 0), this.imod(inv).redNeg()) : this.imod(inv);
}),
(Red.prototype.pow = function (a, num) {
if (num.isZero()) return new BN(1).toRed(this);
@@ -8344,10 +7119,7 @@ var require_bn2 = __commonJS({
for (start === 0 && (start = 26), i = num.length - 1; i >= 0; i--) {
for (var word = num.words[i], j = start - 1; j >= 0; j--) {
var bit = (word >> j) & 1;
- if (
- (res !== wnd[0] && (res = this.sqr(res)),
- bit === 0 && current === 0)
- ) {
+ if ((res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0)) {
currentLen = 0;
continue;
}
@@ -8355,9 +7127,7 @@ var require_bn2 = __commonJS({
(current |= bit),
currentLen++,
!(currentLen !== windowSize && (i !== 0 || j !== 0)) &&
- ((res = this.mul(res, wnd[current])),
- (currentLen = 0),
- (current = 0));
+ ((res = this.mul(res, wnd[current])), (currentLen = 0), (current = 0));
}
start = 26;
}
@@ -8394,38 +7164,23 @@ var require_bn2 = __commonJS({
return (r.red = null), r;
}),
(Mont.prototype.imul = function (a, b) {
- if (a.isZero() || b.isZero())
- return (a.words[0] = 0), (a.length = 1), a;
+ if (a.isZero() || b.isZero()) return (a.words[0] = 0), (a.length = 1), a;
var t = a.imul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.mul = function (a, b) {
if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
var t = a.mul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.invm = function (a) {
@@ -8519,8 +7274,7 @@ var require_mr = __commonJS({
var x = a.toRed(red).redPow(d);
if (!(x.cmp(rone) === 0 || x.cmp(rn1) === 0)) {
for (var i = 1; i < s; i++) {
- if (((x = x.redSqr()), x.cmp(rone) === 0))
- return x.fromRed().subn(1).gcd(n);
+ if (((x = x.redSqr()), x.cmp(rone) === 0)) return x.fromRed().subn(1).gcd(n);
if (x.cmp(rn1) === 0) break;
}
if (i === s) return (x = x.redSqr()), x.fromRed().subn(1).gcd(n);
@@ -8560,11 +7314,7 @@ var require_generatePrime = __commonJS({
res = [];
res[0] = 2;
for (var i = 1, k = 3; k < limit; k += 2) {
- for (
- var sqrt = Math.ceil(Math.sqrt(k)), j = 0;
- j < i && res[j] <= sqrt && k % res[j] !== 0;
- j++
- );
+ for (var sqrt = Math.ceil(Math.sqrt(k)), j = 0; j < i && res[j] <= sqrt && k % res[j] !== 0; j++);
(i !== j && res[j] <= sqrt) || (res[i++] = k);
}
return (primes = res), res;
@@ -8579,21 +7329,11 @@ var require_generatePrime = __commonJS({
return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
}
function findPrime(bits, gen) {
- if (bits < 16)
- return gen === 2 || gen === 5 ? new BN([140, 123]) : new BN([140, 39]);
+ if (bits < 16) return gen === 2 || gen === 5 ? new BN([140, 123]) : new BN([140, 39]);
gen = new BN(gen);
for (var num, n2; ; ) {
- for (
- num = new BN(randomBytes(Math.ceil(bits / 8)));
- num.bitLength() > bits;
-
- )
- num.ishrn(1);
- if (
- (num.isEven() && num.iadd(ONE),
- num.testn(1) || num.iadd(TWO),
- gen.cmp(TWO))
- ) {
+ for (num = new BN(randomBytes(Math.ceil(bits / 8))); num.bitLength() > bits; ) num.ishrn(1);
+ if ((num.isEven() && num.iadd(ONE), num.testn(1) || num.iadd(TWO), gen.cmp(TWO))) {
if (!gen.cmp(FIVE)) for (; num.mod(TEN).cmp(THREE); ) num.iadd(FOUR);
} else for (; num.mod(TWENTYFOUR).cmp(ELEVEN); ) num.iadd(FOUR);
if (
@@ -8675,10 +7415,7 @@ var require_dh = __commonJS({
module.exports = DH;
function setPublicKey(pub, enc) {
return (
- (enc = enc || "utf8"),
- Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)),
- (this._pub = new BN(pub)),
- this
+ (enc = enc || "utf8"), Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), (this._pub = new BN(pub)), this
);
}
function setPrivateKey(priv, enc) {
@@ -8695,17 +7432,9 @@ var require_dh = __commonJS({
hex = [gen, prime.toString(16)].join("_");
if (hex in primeCache) return primeCache[hex];
var error = 0;
- if (
- prime.isEven() ||
- !primes.simpleSieve ||
- !primes.fermatTest(prime) ||
- !millerRabin.test(prime)
- )
+ if (prime.isEven() || !primes.simpleSieve || !primes.fermatTest(prime) || !millerRabin.test(prime))
return (
- (error += 1),
- gen === "02" || gen === "05" ? (error += 8) : (error += 4),
- (primeCache[hex] = error),
- error
+ (error += 1), gen === "02" || gen === "05" ? (error += 8) : (error += 4), (primeCache[hex] = error), error
);
millerRabin.test(prime.shrn(1)) || (error += 2);
var rem;
@@ -8714,8 +7443,7 @@ var require_dh = __commonJS({
prime.mod(TWENTYFOUR).cmp(ELEVEN) && (error += 8);
break;
case "05":
- (rem = prime.mod(TEN)),
- rem.cmp(THREE) && rem.cmp(SEVEN) && (error += 8);
+ (rem = prime.mod(TEN)), rem.cmp(THREE) && rem.cmp(SEVEN) && (error += 8);
break;
default:
error += 4;
@@ -8730,17 +7458,13 @@ var require_dh = __commonJS({
(this._pub = void 0),
(this._priv = void 0),
(this._primeCode = void 0),
- malleable
- ? ((this.setPublicKey = setPublicKey),
- (this.setPrivateKey = setPrivateKey))
- : (this._primeCode = 8);
+ malleable ? ((this.setPublicKey = setPublicKey), (this.setPrivateKey = setPrivateKey)) : (this._primeCode = 8);
}
Object.defineProperty(DH.prototype, "verifyError", {
enumerable: !0,
get: function () {
return (
- typeof this._primeCode != "number" &&
- (this._primeCode = checkPrime(this.__prime, this.__gen)),
+ typeof this._primeCode != "number" && (this._primeCode = checkPrime(this.__prime, this.__gen)),
this._primeCode
);
},
@@ -8813,17 +7537,12 @@ var require_browser7 = __commonJS({
: ((enc = enc || "binary"),
(genc = genc || "binary"),
(generator = generator || new Buffer([2])),
- Buffer.isBuffer(generator) ||
- (generator = new Buffer(generator, genc)),
+ Buffer.isBuffer(generator) || (generator = new Buffer(generator, genc)),
typeof prime == "number"
? new DH(generatePrime(prime, generator), generator, !0)
- : (Buffer.isBuffer(prime) || (prime = new Buffer(prime, enc)),
- new DH(prime, generator, !0)));
+ : (Buffer.isBuffer(prime) || (prime = new Buffer(prime, enc)), new DH(prime, generator, !0)));
}
- exports.DiffieHellmanGroup =
- exports.createDiffieHellmanGroup =
- exports.getDiffieHellman =
- getDiffieHellman;
+ exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman;
exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman;
},
});
@@ -8853,9 +7572,7 @@ var require_bn3 = __commonJS({
((base === "le" || base === "be") && ((endian = base), (base = 10)),
this._init(number || 0, base || 10, endian || "be"));
}
- typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN),
- (BN.BN = BN),
- (BN.wordSize = 26);
+ typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN), (BN.BN = BN), (BN.wordSize = 26);
var Buffer2;
try {
typeof window < "u" && typeof window.Buffer < "u"
@@ -8877,10 +7594,8 @@ var require_bn3 = __commonJS({
return left.cmp(right) < 0 ? left : right;
}),
(BN.prototype._init = function (number, base, endian) {
- if (typeof number == "number")
- return this._initNumber(number, base, endian);
- if (typeof number == "object")
- return this._initArray(number, base, endian);
+ if (typeof number == "number") return this._initNumber(number, base, endian);
+ if (typeof number == "object") return this._initArray(number, base, endian);
base === "hex" && (base = 16),
assert(base === (base | 0) && base >= 2 && base <= 36),
(number = number.toString().replace(/\s+/g, ""));
@@ -8890,33 +7605,23 @@ var require_bn3 = __commonJS({
(base === 16
? this._parseHex(number, start, endian)
: (this._parseBase(number, base, start),
- endian === "le" &&
- this._initArray(this.toArray(), base, endian)));
+ endian === "le" && this._initArray(this.toArray(), base, endian)));
}),
(BN.prototype._initNumber = function (number, base, endian) {
number < 0 && ((this.negative = 1), (number = -number)),
number < 67108864
? ((this.words = [number & 67108863]), (this.length = 1))
: number < 4503599627370496
- ? ((this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- ]),
- (this.length = 2))
+ ? ((this.words = [number & 67108863, (number / 67108864) & 67108863]), (this.length = 2))
: (assert(number < 9007199254740992),
- (this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- 1,
- ]),
+ (this.words = [number & 67108863, (number / 67108864) & 67108863, 1]),
(this.length = 3)),
endian === "le" && this._initArray(this.toArray(), base, endian);
}),
(BN.prototype._initArray = function (number, base, endian) {
if ((assert(typeof number.length == "number"), number.length <= 0))
return (this.words = [0]), (this.length = 1), this;
- (this.length = Math.ceil(number.length / 3)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil(number.length / 3)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var j,
w,
@@ -8946,15 +7651,10 @@ var require_bn3 = __commonJS({
}
function parseHexByte(string, lowerBound, index) {
var r = parseHex4Bits(string, index);
- return (
- index - 1 >= lowerBound &&
- (r |= parseHex4Bits(string, index - 1) << 4),
- r
- );
+ return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;
}
BN.prototype._parseHex = function (number, start, endian) {
- (this.length = Math.ceil((number.length - start) / 6)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil((number.length - start) / 6)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var off = 0,
j = 0,
@@ -8963,30 +7663,18 @@ var require_bn3 = __commonJS({
for (i = number.length - 1; i >= start; i -= 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
else {
var parseLength = number.length - start;
- for (
- i = parseLength % 2 === 0 ? start + 1 : start;
- i < number.length;
- i += 2
- )
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
}
this._strip();
};
function parseBase(str, start, end, mul) {
- for (
- var r = 0, b = 0, len = Math.min(str.length, end), i = start;
- i < len;
- i++
- ) {
+ for (var r = 0, b = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
var c = str.charCodeAt(i) - 48;
(r *= mul),
c >= 49 ? (b = c - 49 + 10) : c >= 17 ? (b = c - 17 + 10) : (b = c),
@@ -8997,8 +7685,7 @@ var require_bn3 = __commonJS({
}
(BN.prototype._parseBase = function (number, base, start) {
(this.words = [0]), (this.length = 1);
- for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base)
- limbLen++;
+ for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
limbLen--, (limbPow = (limbPow / base) | 0);
for (
var total = number.length - start,
@@ -9011,36 +7698,21 @@ var require_bn3 = __commonJS({
)
(word = parseBase(number, i, i + limbLen, base)),
this.imuln(limbPow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
if (mod !== 0) {
var pow = 1;
- for (
- word = parseBase(number, i, number.length, base), i = 0;
- i < mod;
- i++
- )
- pow *= base;
- this.imuln(pow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
+ this.imuln(pow), this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
}
this._strip();
}),
(BN.prototype.copy = function (dest) {
dest.words = new Array(this.length);
for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
- (dest.length = this.length),
- (dest.negative = this.negative),
- (dest.red = this.red);
+ (dest.length = this.length), (dest.negative = this.negative), (dest.red = this.red);
});
function move(dest, src) {
- (dest.words = src.words),
- (dest.length = src.length),
- (dest.negative = src.negative),
- (dest.red = src.red);
+ (dest.words = src.words), (dest.length = src.length), (dest.negative = src.negative), (dest.red = src.red);
}
if (
((BN.prototype._move = function (dest) {
@@ -9055,15 +7727,11 @@ var require_bn3 = __commonJS({
return this;
}),
(BN.prototype._strip = function () {
- for (; this.length > 1 && this.words[this.length - 1] === 0; )
- this.length--;
+ for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
return this._normSign();
}),
(BN.prototype._normSign = function () {
- return (
- this.length === 1 && this.words[0] === 0 && (this.negative = 0),
- this
- );
+ return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}),
typeof Symbol < "u" && typeof Symbol.for == "function")
)
@@ -9105,15 +7773,13 @@ var require_bn3 = __commonJS({
"0000000000000000000000000",
],
groupSizes = [
- 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5,
],
groupBases = [
- 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607,
- 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536,
- 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101,
- 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368,
- 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
+ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808,
+ 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624,
+ 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
60466176,
];
(BN.prototype.toString = function (base, padding) {
@@ -9127,16 +7793,9 @@ var require_bn3 = __commonJS({
(carry = (w >>> (24 - off)) & 16777215),
(off += 2),
off >= 26 && ((off -= 26), i--),
- carry !== 0 || i !== this.length - 1
- ? (out = zeros[6 - word.length] + word + out)
- : (out = word + out);
+ carry !== 0 || i !== this.length - 1 ? (out = zeros[6 - word.length] + word + out) : (out = word + out);
}
- for (
- carry !== 0 && (out = carry.toString(16) + out);
- out.length % padding !== 0;
-
- )
- out = "0" + out;
+ for (carry !== 0 && (out = carry.toString(16) + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
if (base === (base | 0) && base >= 2 && base <= 36) {
@@ -9146,13 +7805,9 @@ var require_bn3 = __commonJS({
var c = this.clone();
for (c.negative = 0; !c.isZero(); ) {
var r = c.modrn(groupBase).toString(base);
- (c = c.idivn(groupBase)),
- c.isZero()
- ? (out = r + out)
- : (out = zeros[groupSize - r.length] + r + out);
+ (c = c.idivn(groupBase)), c.isZero() ? (out = r + out) : (out = zeros[groupSize - r.length] + r + out);
}
- for (this.isZero() && (out = "0" + out); out.length % padding !== 0; )
- out = "0" + out;
+ for (this.isZero() && (out = "0" + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
assert(!1, "Base should be between 2 and 36");
@@ -9164,8 +7819,7 @@ var require_bn3 = __commonJS({
? (ret += this.words[1] * 67108864)
: this.length === 3 && this.words[2] === 1
? (ret += 4503599627370496 + this.words[1] * 67108864)
- : this.length > 2 &&
- assert(!1, "Number can only safely store up to 53 bits"),
+ : this.length > 2 && assert(!1, "Number can only safely store up to 53 bits"),
this.negative !== 0 ? -ret : ret
);
}),
@@ -9180,62 +7834,41 @@ var require_bn3 = __commonJS({
return this.toArrayLike(Array, endian, length);
});
var allocate = function (ArrayType, size) {
- return ArrayType.allocUnsafe
- ? ArrayType.allocUnsafe(size)
- : new ArrayType(size);
+ return ArrayType.allocUnsafe ? ArrayType.allocUnsafe(size) : new ArrayType(size);
};
(BN.prototype.toArrayLike = function (ArrayType, endian, length) {
this._strip();
var byteLength = this.byteLength(),
reqLength = length || Math.max(1, byteLength);
- assert(
- byteLength <= reqLength,
- "byte array longer than desired length",
- ),
+ assert(byteLength <= reqLength, "byte array longer than desired length"),
assert(reqLength > 0, "Requested array length <= 0");
var res = allocate(ArrayType, reqLength),
postfix = endian === "le" ? "LE" : "BE";
return this["_toArrayLike" + postfix](res, byteLength), res;
}),
(BN.prototype._toArrayLikeLE = function (res, byteLength) {
- for (
- var position = 0, carry = 0, i = 0, shift = 0;
- i < this.length;
- i++
- ) {
+ for (var position = 0, carry = 0, i = 0, shift = 0; i < this.length; i++) {
var word = (this.words[i] << shift) | carry;
(res[position++] = word & 255),
position < res.length && (res[position++] = (word >> 8) & 255),
position < res.length && (res[position++] = (word >> 16) & 255),
shift === 6
- ? (position < res.length &&
- (res[position++] = (word >> 24) & 255),
- (carry = 0),
- (shift = 0))
+ ? (position < res.length && (res[position++] = (word >> 24) & 255), (carry = 0), (shift = 0))
: ((carry = word >>> 24), (shift += 2));
}
- if (position < res.length)
- for (res[position++] = carry; position < res.length; )
- res[position++] = 0;
+ if (position < res.length) for (res[position++] = carry; position < res.length; ) res[position++] = 0;
}),
(BN.prototype._toArrayLikeBE = function (res, byteLength) {
- for (
- var position = res.length - 1, carry = 0, i = 0, shift = 0;
- i < this.length;
- i++
- ) {
+ for (var position = res.length - 1, carry = 0, i = 0, shift = 0; i < this.length; i++) {
var word = (this.words[i] << shift) | carry;
(res[position--] = word & 255),
position >= 0 && (res[position--] = (word >> 8) & 255),
position >= 0 && (res[position--] = (word >> 16) & 255),
shift === 6
- ? (position >= 0 && (res[position--] = (word >> 24) & 255),
- (carry = 0),
- (shift = 0))
+ ? (position >= 0 && (res[position--] = (word >> 24) & 255), (carry = 0), (shift = 0))
: ((carry = word >>> 24), (shift += 2));
}
- if (position >= 0)
- for (res[position--] = carry; position >= 0; ) res[position--] = 0;
+ if (position >= 0) for (res[position--] = carry; position >= 0; ) res[position--] = 0;
}),
Math.clz32
? (BN.prototype._countBits = function (w) {
@@ -9271,11 +7904,7 @@ var require_bn3 = __commonJS({
return (this.length - 1) * 26 + hi;
});
function toBitArray(num) {
- for (
- var w = new Array(num.bitLength()), bit = 0;
- bit < w.length;
- bit++
- ) {
+ for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
var off = (bit / 26) | 0,
wbit = bit % 26;
w[bit] = (num.words[off] >>> wbit) & 1;
@@ -9294,14 +7923,10 @@ var require_bn3 = __commonJS({
return Math.ceil(this.bitLength() / 8);
}),
(BN.prototype.toTwos = function (width) {
- return this.negative !== 0
- ? this.abs().inotn(width).iaddn(1)
- : this.clone();
+ return this.negative !== 0 ? this.abs().inotn(width).iaddn(1) : this.clone();
}),
(BN.prototype.fromTwos = function (width) {
- return this.testn(width - 1)
- ? this.notn(width).iaddn(1).ineg()
- : this.clone();
+ return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
}),
(BN.prototype.isNeg = function () {
return this.negative !== 0;
@@ -9314,50 +7939,37 @@ var require_bn3 = __commonJS({
}),
(BN.prototype.iuor = function (num) {
for (; this.length < num.length; ) this.words[this.length++] = 0;
- for (var i = 0; i < num.length; i++)
- this.words[i] = this.words[i] | num.words[i];
+ for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
return this._strip();
}),
(BN.prototype.ior = function (num) {
return assert((this.negative | num.negative) === 0), this.iuor(num);
}),
(BN.prototype.or = function (num) {
- return this.length > num.length
- ? this.clone().ior(num)
- : num.clone().ior(this);
+ return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
}),
(BN.prototype.uor = function (num) {
- return this.length > num.length
- ? this.clone().iuor(num)
- : num.clone().iuor(this);
+ return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
}),
(BN.prototype.iuand = function (num) {
var b;
this.length > num.length ? (b = num) : (b = this);
- for (var i = 0; i < b.length; i++)
- this.words[i] = this.words[i] & num.words[i];
+ for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
return (this.length = b.length), this._strip();
}),
(BN.prototype.iand = function (num) {
return assert((this.negative | num.negative) === 0), this.iuand(num);
}),
(BN.prototype.and = function (num) {
- return this.length > num.length
- ? this.clone().iand(num)
- : num.clone().iand(this);
+ return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
}),
(BN.prototype.uand = function (num) {
- return this.length > num.length
- ? this.clone().iuand(num)
- : num.clone().iuand(this);
+ return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
}),
(BN.prototype.iuxor = function (num) {
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
- for (var i = 0; i < b.length; i++)
- this.words[i] = a.words[i] ^ b.words[i];
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
+ for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
if (this !== a) for (; i < a.length; i++) this.words[i] = a.words[i];
return (this.length = a.length), this._strip();
}),
@@ -9365,27 +7977,18 @@ var require_bn3 = __commonJS({
return assert((this.negative | num.negative) === 0), this.iuxor(num);
}),
(BN.prototype.xor = function (num) {
- return this.length > num.length
- ? this.clone().ixor(num)
- : num.clone().ixor(this);
+ return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
}),
(BN.prototype.uxor = function (num) {
- return this.length > num.length
- ? this.clone().iuxor(num)
- : num.clone().iuxor(this);
+ return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
}),
(BN.prototype.inotn = function (width) {
assert(typeof width == "number" && width >= 0);
var bytesNeeded = Math.ceil(width / 26) | 0,
bitsLeft = width % 26;
this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;
- for (var i = 0; i < bytesNeeded; i++)
- this.words[i] = ~this.words[i] & 67108863;
- return (
- bitsLeft > 0 &&
- (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))),
- this._strip()
- );
+ for (var i = 0; i < bytesNeeded; i++) this.words[i] = ~this.words[i] & 67108863;
+ return bitsLeft > 0 && (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))), this._strip();
}),
(BN.prototype.notn = function (width) {
return this.clone().inotn(width);
@@ -9405,49 +8008,25 @@ var require_bn3 = __commonJS({
(BN.prototype.iadd = function (num) {
var r;
if (this.negative !== 0 && num.negative === 0)
- return (
- (this.negative = 0),
- (r = this.isub(num)),
- (this.negative ^= 1),
- this._normSign()
- );
+ return (this.negative = 0), (r = this.isub(num)), (this.negative ^= 1), this._normSign();
if (this.negative === 0 && num.negative !== 0)
- return (
- (num.negative = 0),
- (r = this.isub(num)),
- (num.negative = 1),
- r._normSign()
- );
+ return (num.negative = 0), (r = this.isub(num)), (num.negative = 1), r._normSign();
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) + (b.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
+ (r = (a.words[i] | 0) + (b.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
- if (((this.length = a.length), carry !== 0))
- (this.words[this.length] = carry), this.length++;
- else if (a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
+ (r = (a.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
+ if (((this.length = a.length), carry !== 0)) (this.words[this.length] = carry), this.length++;
+ else if (a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
return this;
}),
(BN.prototype.add = function (num) {
var res;
return num.negative !== 0 && this.negative === 0
- ? ((num.negative = 0),
- (res = this.sub(num)),
- (num.negative ^= 1),
- res)
+ ? ((num.negative = 0), (res = this.sub(num)), (num.negative ^= 1), res)
: num.negative === 0 && this.negative !== 0
- ? ((this.negative = 0),
- (res = num.sub(this)),
- (this.negative = 1),
- res)
+ ? ((this.negative = 0), (res = num.sub(this)), (this.negative = 1), res)
: this.length > num.length
? this.clone().iadd(num)
: num.clone().iadd(this);
@@ -9458,34 +8037,17 @@ var require_bn3 = __commonJS({
var r = this.iadd(num);
return (num.negative = 1), r._normSign();
} else if (this.negative !== 0)
- return (
- (this.negative = 0),
- this.iadd(num),
- (this.negative = 1),
- this._normSign()
- );
+ return (this.negative = 0), this.iadd(num), (this.negative = 1), this._normSign();
var cmp = this.cmp(num);
- if (cmp === 0)
- return (
- (this.negative = 0), (this.length = 1), (this.words[0] = 0), this
- );
+ if (cmp === 0) return (this.negative = 0), (this.length = 1), (this.words[0] = 0), this;
var a, b;
cmp > 0 ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) - (b.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
+ (r = (a.words[i] | 0) - (b.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
- if (carry === 0 && i < a.length && a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
- return (
- (this.length = Math.max(this.length, i)),
- a !== this && (this.negative = 1),
- this._strip()
- );
+ (r = (a.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
+ if (carry === 0 && i < a.length && a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
+ return (this.length = Math.max(this.length, i)), a !== this && (this.negative = 1), this._strip();
}),
(BN.prototype.sub = function (num) {
return this.clone().isub(num);
@@ -9518,9 +8080,7 @@ var require_bn3 = __commonJS({
}
(out.words[k] = rword | 0), (carry = ncarry | 0);
}
- return (
- carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out._strip()
- );
+ return carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out._strip();
}
var comb10MulTo = function (self2, num, out) {
var a = self2.words,
@@ -10075,15 +8635,12 @@ var require_bn3 = __commonJS({
};
Math.imul || (comb10MulTo = smallMulTo);
function bigMulTo(self2, num, out) {
- (out.negative = num.negative ^ self2.negative),
- (out.length = self2.length + num.length);
+ (out.negative = num.negative ^ self2.negative), (out.length = self2.length + num.length);
for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
var ncarry = hncarry;
hncarry = 0;
for (
- var rword = carry & 67108863,
- maxJ = Math.min(k, num.length - 1),
- j = Math.max(0, k - self2.length + 1);
+ var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);
j <= maxJ;
j++
) {
@@ -10101,9 +8658,7 @@ var require_bn3 = __commonJS({
}
(out.words[k] = rword), (carry = ncarry), (ncarry = hncarry);
}
- return (
- carry !== 0 ? (out.words[k] = carry) : out.length--, out._strip()
- );
+ return carry !== 0 ? (out.words[k] = carry) : out.length--, out._strip();
}
function jumboMulTo(self2, num, out) {
return bigMulTo(self2, num, out);
@@ -10126,32 +8681,22 @@ var require_bn3 = __commonJS({
(this.x = x), (this.y = y);
}
(FFTM.prototype.makeRBT = function (N) {
- for (
- var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0;
- i < N;
- i++
- )
- t[i] = this.revBin(i, l, N);
+ for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
return t;
}),
(FFTM.prototype.revBin = function (x, l, N) {
if (x === 0 || x === N - 1) return x;
- for (var rb = 0, i = 0; i < l; i++)
- (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
+ for (var rb = 0, i = 0; i < l; i++) (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
return rb;
}),
(FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++)
- (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
+ for (var i = 0; i < N; i++) (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
}),
(FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) {
this.permute(rbt, rws, iws, rtws, itws, N);
for (var s = 1; s < N; s <<= 1)
for (
- var l = s << 1,
- rtwdf = Math.cos((2 * Math.PI) / l),
- itwdf = Math.sin((2 * Math.PI) / l),
- p = 0;
+ var l = s << 1, rtwdf = Math.cos((2 * Math.PI) / l), itwdf = Math.sin((2 * Math.PI) / l), p = 0;
p < N;
p += l
)
@@ -10168,9 +8713,7 @@ var require_bn3 = __commonJS({
(rtws[p + j + s] = re - ro),
(itws[p + j + s] = ie - io),
j !== l &&
- ((rx = rtwdf * rtwdf_ - itwdf * itwdf_),
- (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_),
- (rtwdf_ = rx));
+ ((rx = rtwdf * rtwdf_ - itwdf * itwdf_), (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_), (rtwdf_ = rx));
}
}),
(FFTM.prototype.guessLen13b = function (n, m) {
@@ -10193,12 +8736,8 @@ var require_bn3 = __commonJS({
}),
(FFTM.prototype.normalize13b = function (ws, N) {
for (var carry = 0, i = 0; i < N / 2; i++) {
- var w =
- Math.round(ws[2 * i + 1] / N) * 8192 +
- Math.round(ws[2 * i] / N) +
- carry;
- (ws[i] = w & 67108863),
- w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
+ var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;
+ (ws[i] = w & 67108863), w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
}
return ws;
}),
@@ -10248,38 +8787,24 @@ var require_bn3 = __commonJS({
}),
(BN.prototype.mul = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- this.mulTo(num, out)
- );
+ return (out.words = new Array(this.length + num.length)), this.mulTo(num, out);
}),
(BN.prototype.mulf = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- jumboMulTo(this, num, out)
- );
+ return (out.words = new Array(this.length + num.length)), jumboMulTo(this, num, out);
}),
(BN.prototype.imul = function (num) {
return this.clone().mulTo(num, this);
}),
(BN.prototype.imuln = function (num) {
var isNegNum = num < 0;
- isNegNum && (num = -num),
- assert(typeof num == "number"),
- assert(num < 67108864);
+ isNegNum && (num = -num), assert(typeof num == "number"), assert(num < 67108864);
for (var carry = 0, i = 0; i < this.length; i++) {
var w = (this.words[i] | 0) * num,
lo = (w & 67108863) + (carry & 67108863);
- (carry >>= 26),
- (carry += (w / 67108864) | 0),
- (carry += lo >>> 26),
- (this.words[i] = lo & 67108863);
+ (carry >>= 26), (carry += (w / 67108864) | 0), (carry += lo >>> 26), (this.words[i] = lo & 67108863);
}
- return (
- carry !== 0 && ((this.words[i] = carry), this.length++),
- isNegNum ? this.ineg() : this
- );
+ return carry !== 0 && ((this.words[i] = carry), this.length++), isNegNum ? this.ineg() : this;
}),
(BN.prototype.muln = function (num) {
return this.clone().imuln(num);
@@ -10293,14 +8818,8 @@ var require_bn3 = __commonJS({
(BN.prototype.pow = function (num) {
var w = toBitArray(num);
if (w.length === 0) return new BN(1);
- for (
- var res = this, i = 0;
- i < w.length && w[i] === 0;
- i++, res = res.sqr()
- );
- if (++i < w.length)
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr())
- w[i] !== 0 && (res = res.mul(q));
+ for (var res = this, i = 0; i < w.length && w[i] === 0; i++, res = res.sqr());
+ if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) w[i] !== 0 && (res = res.mul(q));
return res;
}),
(BN.prototype.iushln = function (bits) {
@@ -10319,8 +8838,7 @@ var require_bn3 = __commonJS({
carry && ((this.words[i] = carry), this.length++);
}
if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--)
- this.words[i + s] = this.words[i];
+ for (i = this.length - 1; i >= 0; i--) this.words[i + s] = this.words[i];
for (i = 0; i < s; i++) this.words[i] = 0;
this.length += s;
}
@@ -10342,20 +8860,15 @@ var require_bn3 = __commonJS({
maskedWords.length = s;
}
if (s !== 0)
- if (this.length > s)
- for (this.length -= s, i = 0; i < this.length; i++)
- this.words[i] = this.words[i + s];
+ if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s];
else (this.words[0] = 0), (this.length = 1);
var carry = 0;
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
var word = this.words[i] | 0;
- (this.words[i] = (carry << (26 - r)) | (word >>> r)),
- (carry = word & mask);
+ (this.words[i] = (carry << (26 - r)) | (word >>> r)), (carry = word & mask);
}
return (
- maskedWords &&
- carry !== 0 &&
- (maskedWords.words[maskedWords.length++] = carry),
+ maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry),
this.length === 0 && ((this.words[0] = 0), (this.length = 1)),
this._strip()
);
@@ -10388,17 +8901,8 @@ var require_bn3 = __commonJS({
assert(typeof bits == "number" && bits >= 0);
var r = bits % 26,
s = (bits - r) / 26;
- if (
- (assert(
- this.negative === 0,
- "imaskn works only with positive numbers",
- ),
- this.length <= s)
- )
- return this;
- if (
- (r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)
- ) {
+ if ((assert(this.negative === 0, "imaskn works only with positive numbers"), this.length <= s)) return this;
+ if ((r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)) {
var mask = 67108863 ^ ((67108863 >>> r) << r);
this.words[this.length - 1] &= mask;
}
@@ -10415,32 +8919,20 @@ var require_bn3 = __commonJS({
? this.isubn(-num)
: this.negative !== 0
? this.length === 1 && (this.words[0] | 0) <= num
- ? ((this.words[0] = num - (this.words[0] | 0)),
- (this.negative = 0),
- this)
- : ((this.negative = 0),
- this.isubn(num),
- (this.negative = 1),
- this)
+ ? ((this.words[0] = num - (this.words[0] | 0)), (this.negative = 0), this)
+ : ((this.negative = 0), this.isubn(num), (this.negative = 1), this)
: this._iaddn(num)
);
}),
(BN.prototype._iaddn = function (num) {
this.words[0] += num;
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++)
- (this.words[i] -= 67108864),
- i === this.length - 1
- ? (this.words[i + 1] = 1)
- : this.words[i + 1]++;
+ (this.words[i] -= 67108864), i === this.length - 1 ? (this.words[i + 1] = 1) : this.words[i + 1]++;
return (this.length = Math.max(this.length, i + 1)), this;
}),
(BN.prototype.isubn = function (num) {
- if ((assert(typeof num == "number"), assert(num < 67108864), num < 0))
- return this.iaddn(-num);
- if (this.negative !== 0)
- return (
- (this.negative = 0), this.iaddn(num), (this.negative = 1), this
- );
+ if ((assert(typeof num == "number"), assert(num < 67108864), num < 0)) return this.iaddn(-num);
+ if (this.negative !== 0) return (this.negative = 0), this.iaddn(num), (this.negative = 1), this;
if (((this.words[0] -= num), this.length === 1 && this.words[0] < 0))
(this.words[0] = -this.words[0]), (this.negative = 1);
else
@@ -10474,14 +8966,10 @@ var require_bn3 = __commonJS({
(this.words[i + shift] = w & 67108863);
}
for (; i < this.length - shift; i++)
- (w = (this.words[i + shift] | 0) + carry),
- (carry = w >> 26),
- (this.words[i + shift] = w & 67108863);
+ (w = (this.words[i + shift] | 0) + carry), (carry = w >> 26), (this.words[i + shift] = w & 67108863);
if (carry === 0) return this._strip();
for (assert(carry === -1), carry = 0, i = 0; i < this.length; i++)
- (w = -(this.words[i] | 0) + carry),
- (carry = w >> 26),
- (this.words[i] = w & 67108863);
+ (w = -(this.words[i] | 0) + carry), (carry = w >> 26), (this.words[i] = w & 67108863);
return (this.negative = 1), this._strip();
}),
(BN.prototype._wordDiv = function (num, mode) {
@@ -10491,33 +8979,19 @@ var require_bn3 = __commonJS({
bhi = b.words[b.length - 1] | 0,
bhiBits = this._countBits(bhi);
(shift = 26 - bhiBits),
- shift !== 0 &&
- ((b = b.ushln(shift)),
- a.iushln(shift),
- (bhi = b.words[b.length - 1] | 0));
+ shift !== 0 && ((b = b.ushln(shift)), a.iushln(shift), (bhi = b.words[b.length - 1] | 0));
var m = a.length - b.length,
q;
if (mode !== "mod") {
- (q = new BN(null)),
- (q.length = m + 1),
- (q.words = new Array(q.length));
+ (q = new BN(null)), (q.length = m + 1), (q.words = new Array(q.length));
for (var i = 0; i < q.length; i++) q.words[i] = 0;
}
var diff = a.clone()._ishlnsubmul(b, 1, m);
diff.negative === 0 && ((a = diff), q && (q.words[m] = 1));
for (var j = m - 1; j >= 0; j--) {
- var qj =
- (a.words[b.length + j] | 0) * 67108864 +
- (a.words[b.length + j - 1] | 0);
- for (
- qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j);
- a.negative !== 0;
-
- )
- qj--,
- (a.negative = 0),
- a._ishlnsubmul(b, 1, j),
- a.isZero() || (a.negative ^= 1);
+ var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);
+ for (qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j); a.negative !== 0; )
+ qj--, (a.negative = 0), a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
q && (q.words[j] = qj);
}
return (
@@ -10540,9 +9014,7 @@ var require_bn3 = __commonJS({
return this.negative !== 0 && num.negative === 0
? ((res = this.neg().divmod(num, mode)),
mode !== "mod" && (div = res.div.neg()),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.iadd(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.iadd(num)),
{
div,
mod,
@@ -10556,9 +9028,7 @@ var require_bn3 = __commonJS({
})
: (this.negative & num.negative) !== 0
? ((res = this.neg().divmod(num.neg(), mode)),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.isub(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.isub(num)),
{
div: res.div,
mod,
@@ -10610,11 +9080,7 @@ var require_bn3 = __commonJS({
(BN.prototype.modrn = function (num) {
var isNegNum = num < 0;
isNegNum && (num = -num), assert(num <= 67108863);
- for (
- var p = (1 << 26) % num, acc = 0, i = this.length - 1;
- i >= 0;
- i--
- )
+ for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; i >= 0; i--)
acc = (p * acc + (this.words[i] | 0)) % num;
return isNegNum ? -acc : acc;
}),
@@ -10638,40 +9104,18 @@ var require_bn3 = __commonJS({
var x = this,
y = p.clone();
x.negative !== 0 ? (x = x.umod(p)) : (x = x.clone());
- for (
- var A = new BN(1),
- B = new BN(0),
- C = new BN(0),
- D = new BN(1),
- g = 0;
- x.isEven() && y.isEven();
-
- )
+ for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); )
x.iushrn(1), y.iushrn(1), ++g;
for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
- for (
- var i = 0, im = 1;
- (x.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
if (i > 0)
for (x.iushrn(i); i-- > 0; )
- (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)),
- A.iushrn(1),
- B.iushrn(1);
- for (
- var j = 0, jm = 1;
- (y.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
+ (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
if (j > 0)
for (y.iushrn(j); j-- > 0; )
- (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)),
- C.iushrn(1),
- D.iushrn(1);
- x.cmp(y) >= 0
- ? (x.isub(y), A.isub(C), B.isub(D))
- : (y.isub(x), C.isub(A), D.isub(B));
+ (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);
+ x.cmp(y) >= 0 ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
}
return {
a: C,
@@ -10684,35 +9128,15 @@ var require_bn3 = __commonJS({
var a = this,
b = p.clone();
a.negative !== 0 ? (a = a.umod(p)) : (a = a.clone());
- for (
- var x1 = new BN(1), x2 = new BN(0), delta = b.clone();
- a.cmpn(1) > 0 && b.cmpn(1) > 0;
-
- ) {
- for (
- var i = 0, im = 1;
- (a.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
- if (i > 0)
- for (a.iushrn(i); i-- > 0; )
- x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
- for (
- var j = 0, jm = 1;
- (b.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
- if (j > 0)
- for (b.iushrn(j); j-- > 0; )
- x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
+ for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone(); a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
+ if (i > 0) for (a.iushrn(i); i-- > 0; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
+ if (j > 0) for (b.iushrn(j); j-- > 0; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
a.cmp(b) >= 0 ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
}
var res;
- return (
- a.cmpn(1) === 0 ? (res = x1) : (res = x2),
- res.cmpn(0) < 0 && res.iadd(p),
- res
- );
+ return a.cmpn(1) === 0 ? (res = x1) : (res = x2), res.cmpn(0) < 0 && res.iadd(p), res;
}),
(BN.prototype.gcd = function (num) {
if (this.isZero()) return num.abs();
@@ -10720,8 +9144,7 @@ var require_bn3 = __commonJS({
var a = this.clone(),
b = num.clone();
(a.negative = 0), (b.negative = 0);
- for (var shift = 0; a.isEven() && b.isEven(); shift++)
- a.iushrn(1), b.iushrn(1);
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), b.iushrn(1);
do {
for (; a.isEven(); ) a.iushrn(1);
for (; b.isEven(); ) b.iushrn(1);
@@ -10751,14 +9174,10 @@ var require_bn3 = __commonJS({
var r = bit % 26,
s = (bit - r) / 26,
q = 1 << r;
- if (this.length <= s)
- return this._expand(s + 1), (this.words[s] |= q), this;
+ if (this.length <= s) return this._expand(s + 1), (this.words[s] |= q), this;
for (var carry = q, i = s; carry !== 0 && i < this.length; i++) {
var w = this.words[i] | 0;
- (w += carry),
- (carry = w >>> 26),
- (w &= 67108863),
- (this.words[i] = w);
+ (w += carry), (carry = w >>> 26), (w &= 67108863), (this.words[i] = w);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -10773,8 +9192,7 @@ var require_bn3 = __commonJS({
var res;
if (this.length > 1) res = 1;
else {
- negative && (num = -num),
- assert(num <= 67108863, "Number is too big");
+ negative && (num = -num), assert(num <= 67108863, "Number is too big");
var w = this.words[0] | 0;
res = w === num ? 0 : w < num ? -1 : 1;
}
@@ -10840,52 +9258,28 @@ var require_bn3 = __commonJS({
);
}),
(BN.prototype.fromRed = function () {
- return (
- assert(
- this.red,
- "fromRed works only with numbers in reduction context",
- ),
- this.red.convertFrom(this)
- );
+ return assert(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
}),
(BN.prototype._forceRed = function (ctx) {
return (this.red = ctx), this;
}),
(BN.prototype.forceRed = function (ctx) {
- return (
- assert(!this.red, "Already a number in reduction context"),
- this._forceRed(ctx)
- );
+ return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
}),
(BN.prototype.redAdd = function (num) {
- return (
- assert(this.red, "redAdd works only with red numbers"),
- this.red.add(this, num)
- );
+ return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
}),
(BN.prototype.redIAdd = function (num) {
- return (
- assert(this.red, "redIAdd works only with red numbers"),
- this.red.iadd(this, num)
- );
+ return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
}),
(BN.prototype.redSub = function (num) {
- return (
- assert(this.red, "redSub works only with red numbers"),
- this.red.sub(this, num)
- );
+ return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
}),
(BN.prototype.redISub = function (num) {
- return (
- assert(this.red, "redISub works only with red numbers"),
- this.red.isub(this, num)
- );
+ return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
}),
(BN.prototype.redShl = function (num) {
- return (
- assert(this.red, "redShl works only with red numbers"),
- this.red.shl(this, num)
- );
+ return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
}),
(BN.prototype.redMul = function (num) {
return (
@@ -10902,46 +9296,22 @@ var require_bn3 = __commonJS({
);
}),
(BN.prototype.redSqr = function () {
- return (
- assert(this.red, "redSqr works only with red numbers"),
- this.red._verify1(this),
- this.red.sqr(this)
- );
+ return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
}),
(BN.prototype.redISqr = function () {
- return (
- assert(this.red, "redISqr works only with red numbers"),
- this.red._verify1(this),
- this.red.isqr(this)
- );
+ return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
}),
(BN.prototype.redSqrt = function () {
- return (
- assert(this.red, "redSqrt works only with red numbers"),
- this.red._verify1(this),
- this.red.sqrt(this)
- );
+ return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
}),
(BN.prototype.redInvm = function () {
- return (
- assert(this.red, "redInvm works only with red numbers"),
- this.red._verify1(this),
- this.red.invm(this)
- );
+ return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
}),
(BN.prototype.redNeg = function () {
- return (
- assert(this.red, "redNeg works only with red numbers"),
- this.red._verify1(this),
- this.red.neg(this)
- );
+ return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
}),
(BN.prototype.redPow = function (num) {
- return (
- assert(this.red && !num.red, "redPow(normalNum)"),
- this.red._verify1(this),
- this.red.pow(this, num)
- );
+ return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, num);
});
var primes = {
k256: null,
@@ -10963,11 +9333,7 @@ var require_bn3 = __commonJS({
(MPrime.prototype.ireduce = function (num) {
var r = num,
rlen;
- do
- this.split(r, this.tmp),
- (r = this.imulK(r)),
- (r = r.iadd(this.tmp)),
- (rlen = r.bitLength());
+ do this.split(r, this.tmp), (r = this.imulK(r)), (r = r.iadd(this.tmp)), (rlen = r.bitLength());
while (rlen > this.n);
var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
return (
@@ -10988,78 +9354,45 @@ var require_bn3 = __commonJS({
return num.imul(this.k);
});
function K256() {
- MPrime.call(
- this,
- "k256",
- "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
- );
+ MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
}
inherits(K256, MPrime),
(K256.prototype.split = function (input, output) {
- for (
- var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;
- i < outLen;
- i++
- )
+ for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0; i < outLen; i++)
output.words[i] = input.words[i];
if (((output.length = outLen), input.length <= 9)) {
(input.words[0] = 0), (input.length = 1);
return;
}
var prev = input.words[9];
- for (
- output.words[output.length++] = prev & mask, i = 10;
- i < input.length;
- i++
- ) {
+ for (output.words[output.length++] = prev & mask, i = 10; i < input.length; i++) {
var next = input.words[i] | 0;
- (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)),
- (prev = next);
+ (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)), (prev = next);
}
(prev >>>= 22),
(input.words[i - 10] = prev),
- prev === 0 && input.length > 10
- ? (input.length -= 10)
- : (input.length -= 9);
+ prev === 0 && input.length > 10 ? (input.length -= 10) : (input.length -= 9);
}),
(K256.prototype.imulK = function (num) {
- (num.words[num.length] = 0),
- (num.words[num.length + 1] = 0),
- (num.length += 2);
+ (num.words[num.length] = 0), (num.words[num.length + 1] = 0), (num.length += 2);
for (var lo = 0, i = 0; i < num.length; i++) {
var w = num.words[i] | 0;
- (lo += w * 977),
- (num.words[i] = lo & 67108863),
- (lo = w * 64 + ((lo / 67108864) | 0));
+ (lo += w * 977), (num.words[i] = lo & 67108863), (lo = w * 64 + ((lo / 67108864) | 0));
}
return (
- num.words[num.length - 1] === 0 &&
- (num.length--, num.words[num.length - 1] === 0 && num.length--),
- num
+ num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num
);
});
function P224() {
- MPrime.call(
- this,
- "p224",
- "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
- );
+ MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
}
inherits(P224, MPrime);
function P192() {
- MPrime.call(
- this,
- "p192",
- "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
- );
+ MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
}
inherits(P192, MPrime);
function P25519() {
- MPrime.call(
- this,
- "25519",
- "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
- );
+ MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
}
inherits(P25519, MPrime),
(P25519.prototype.imulK = function (num) {
@@ -11084,26 +9417,17 @@ var require_bn3 = __commonJS({
if (typeof m == "string") {
var prime = BN._prime(m);
(this.m = prime.p), (this.prime = prime);
- } else
- assert(m.gtn(1), "modulus must be greater than 1"),
- (this.m = m),
- (this.prime = null);
+ } else assert(m.gtn(1), "modulus must be greater than 1"), (this.m = m), (this.prime = null);
}
(Red.prototype._verify1 = function (a) {
- assert(a.negative === 0, "red works only with positives"),
- assert(a.red, "red works only with red numbers");
+ assert(a.negative === 0, "red works only with positives"), assert(a.red, "red works only with red numbers");
}),
(Red.prototype._verify2 = function (a, b) {
- assert(
- (a.negative | b.negative) === 0,
- "red works only with positives",
- ),
+ assert((a.negative | b.negative) === 0, "red works only with positives"),
assert(a.red && a.red === b.red, "red works only with red numbers");
}),
(Red.prototype.imod = function (a) {
- return this.prime
- ? this.prime.ireduce(a)._forceRed(this)
- : (move(a, a.umod(this.m)._forceRed(this)), a);
+ return this.prime ? this.prime.ireduce(a)._forceRed(this) : (move(a, a.umod(this.m)._forceRed(this)), a);
}),
(Red.prototype.neg = function (a) {
return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
@@ -11150,29 +9474,19 @@ var require_bn3 = __commonJS({
var pow = this.m.add(new BN(1)).iushrn(2);
return this.pow(a, pow);
}
- for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; )
- s++, q.iushrn(1);
+ for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; ) s++, q.iushrn(1);
assert(!q.isZero());
var one = new BN(1).toRed(this),
nOne = one.redNeg(),
lpow = this.m.subn(1).iushrn(1),
z = this.m.bitLength();
+ for (z = new BN(2 * z * z).toRed(this); this.pow(z, lpow).cmp(nOne) !== 0; ) z.redIAdd(nOne);
for (
- z = new BN(2 * z * z).toRed(this);
- this.pow(z, lpow).cmp(nOne) !== 0;
-
- )
- z.redIAdd(nOne);
- for (
- var c = this.pow(z, q),
- r = this.pow(a, q.addn(1).iushrn(1)),
- t = this.pow(a, q),
- m = s;
+ var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;
t.cmp(one) !== 0;
) {
- for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++)
- tmp = tmp.redSqr();
+ for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++) tmp = tmp.redSqr();
assert(i < m);
var b = this.pow(c, new BN(1).iushln(m - i - 1));
(r = r.redMul(b)), (c = b.redSqr()), (t = t.redMul(c)), (m = i);
@@ -11181,9 +9495,7 @@ var require_bn3 = __commonJS({
}),
(Red.prototype.invm = function (a) {
var inv = a._invmp(this.m);
- return inv.negative !== 0
- ? ((inv.negative = 0), this.imod(inv).redNeg())
- : this.imod(inv);
+ return inv.negative !== 0 ? ((inv.negative = 0), this.imod(inv).redNeg()) : this.imod(inv);
}),
(Red.prototype.pow = function (a, num) {
if (num.isZero()) return new BN(1).toRed(this);
@@ -11199,10 +9511,7 @@ var require_bn3 = __commonJS({
for (start === 0 && (start = 26), i = num.length - 1; i >= 0; i--) {
for (var word = num.words[i], j = start - 1; j >= 0; j--) {
var bit = (word >> j) & 1;
- if (
- (res !== wnd[0] && (res = this.sqr(res)),
- bit === 0 && current === 0)
- ) {
+ if ((res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0)) {
currentLen = 0;
continue;
}
@@ -11210,9 +9519,7 @@ var require_bn3 = __commonJS({
(current |= bit),
currentLen++,
!(currentLen !== windowSize && (i !== 0 || j !== 0)) &&
- ((res = this.mul(res, wnd[current])),
- (currentLen = 0),
- (current = 0));
+ ((res = this.mul(res, wnd[current])), (currentLen = 0), (current = 0));
}
start = 26;
}
@@ -11249,38 +9556,23 @@ var require_bn3 = __commonJS({
return (r.red = null), r;
}),
(Mont.prototype.imul = function (a, b) {
- if (a.isZero() || b.isZero())
- return (a.words[0] = 0), (a.length = 1), a;
+ if (a.isZero() || b.isZero()) return (a.words[0] = 0), (a.length = 1), a;
var t = a.imul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.mul = function (a, b) {
if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
var t = a.mul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.invm = function (a) {
@@ -11298,21 +9590,14 @@ var require_browserify_rsa = __commonJS({
randomBytes = require_browser();
function blind(priv) {
var r = getr(priv),
- blinder = r
- .toRed(BN.mont(priv.modulus))
- .redPow(new BN(priv.publicExponent))
- .fromRed();
+ blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed();
return { blinder, unblinder: r.invm(priv.modulus) };
}
function getr(priv) {
var len = priv.modulus.byteLength(),
r;
do r = new BN(randomBytes(len));
- while (
- r.cmp(priv.modulus) >= 0 ||
- !r.umod(priv.prime1) ||
- !r.umod(priv.prime2)
- );
+ while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2));
return r;
}
function crt(msg, priv) {
@@ -11327,11 +9612,7 @@ var require_browserify_rsa = __commonJS({
m1 = c1.redPow(priv.exponent1).fromRed(),
m2 = c2.redPow(priv.exponent2).fromRed(),
h = m1.isub(m2).imul(qinv).umod(p).imul(q);
- return m2
- .iadd(h)
- .imul(blinds.unblinder)
- .umod(priv.modulus)
- .toArrayLike(Buffer, "be", len);
+ return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, "be", len);
}
crt.getr = getr;
module.exports = crt;
@@ -11418,9 +9699,7 @@ var require_bn4 = __commonJS({
((base === "le" || base === "be") && ((endian = base), (base = 10)),
this._init(number || 0, base || 10, endian || "be"));
}
- typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN),
- (BN.BN = BN),
- (BN.wordSize = 26);
+ typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN), (BN.BN = BN), (BN.wordSize = 26);
var Buffer2;
try {
typeof window < "u" && typeof window.Buffer < "u"
@@ -11442,10 +9721,8 @@ var require_bn4 = __commonJS({
return left.cmp(right) < 0 ? left : right;
}),
(BN.prototype._init = function (number, base, endian) {
- if (typeof number == "number")
- return this._initNumber(number, base, endian);
- if (typeof number == "object")
- return this._initArray(number, base, endian);
+ if (typeof number == "number") return this._initNumber(number, base, endian);
+ if (typeof number == "object") return this._initArray(number, base, endian);
base === "hex" && (base = 16),
assert(base === (base | 0) && base >= 2 && base <= 36),
(number = number.toString().replace(/\s+/g, ""));
@@ -11455,33 +9732,23 @@ var require_bn4 = __commonJS({
(base === 16
? this._parseHex(number, start, endian)
: (this._parseBase(number, base, start),
- endian === "le" &&
- this._initArray(this.toArray(), base, endian)));
+ endian === "le" && this._initArray(this.toArray(), base, endian)));
}),
(BN.prototype._initNumber = function (number, base, endian) {
number < 0 && ((this.negative = 1), (number = -number)),
number < 67108864
? ((this.words = [number & 67108863]), (this.length = 1))
: number < 4503599627370496
- ? ((this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- ]),
- (this.length = 2))
+ ? ((this.words = [number & 67108863, (number / 67108864) & 67108863]), (this.length = 2))
: (assert(number < 9007199254740992),
- (this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- 1,
- ]),
+ (this.words = [number & 67108863, (number / 67108864) & 67108863, 1]),
(this.length = 3)),
endian === "le" && this._initArray(this.toArray(), base, endian);
}),
(BN.prototype._initArray = function (number, base, endian) {
if ((assert(typeof number.length == "number"), number.length <= 0))
return (this.words = [0]), (this.length = 1), this;
- (this.length = Math.ceil(number.length / 3)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil(number.length / 3)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var j,
w,
@@ -11504,23 +9771,14 @@ var require_bn4 = __commonJS({
});
function parseHex4Bits(string, index) {
var c = string.charCodeAt(index);
- return c >= 65 && c <= 70
- ? c - 55
- : c >= 97 && c <= 102
- ? c - 87
- : (c - 48) & 15;
+ return c >= 65 && c <= 70 ? c - 55 : c >= 97 && c <= 102 ? c - 87 : (c - 48) & 15;
}
function parseHexByte(string, lowerBound, index) {
var r = parseHex4Bits(string, index);
- return (
- index - 1 >= lowerBound &&
- (r |= parseHex4Bits(string, index - 1) << 4),
- r
- );
+ return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;
}
BN.prototype._parseHex = function (number, start, endian) {
- (this.length = Math.ceil((number.length - start) / 6)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil((number.length - start) / 6)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var off = 0,
j = 0,
@@ -11529,44 +9787,26 @@ var require_bn4 = __commonJS({
for (i = number.length - 1; i >= start; i -= 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
else {
var parseLength = number.length - start;
- for (
- i = parseLength % 2 === 0 ? start + 1 : start;
- i < number.length;
- i += 2
- )
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
}
this.strip();
};
function parseBase(str, start, end, mul) {
- for (
- var r = 0, len = Math.min(str.length, end), i = start;
- i < len;
- i++
- ) {
+ for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
var c = str.charCodeAt(i) - 48;
- (r *= mul),
- c >= 49
- ? (r += c - 49 + 10)
- : c >= 17
- ? (r += c - 17 + 10)
- : (r += c);
+ (r *= mul), c >= 49 ? (r += c - 49 + 10) : c >= 17 ? (r += c - 17 + 10) : (r += c);
}
return r;
}
(BN.prototype._parseBase = function (number, base, start) {
(this.words = [0]), (this.length = 1);
- for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base)
- limbLen++;
+ for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
limbLen--, (limbPow = (limbPow / base) | 0);
for (
var total = number.length - start,
@@ -11579,30 +9819,18 @@ var require_bn4 = __commonJS({
)
(word = parseBase(number, i, i + limbLen, base)),
this.imuln(limbPow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
if (mod !== 0) {
var pow = 1;
- for (
- word = parseBase(number, i, number.length, base), i = 0;
- i < mod;
- i++
- )
- pow *= base;
- this.imuln(pow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
+ this.imuln(pow), this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
}
this.strip();
}),
(BN.prototype.copy = function (dest) {
dest.words = new Array(this.length);
for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
- (dest.length = this.length),
- (dest.negative = this.negative),
- (dest.red = this.red);
+ (dest.length = this.length), (dest.negative = this.negative), (dest.red = this.red);
}),
(BN.prototype.clone = function () {
var r = new BN(null);
@@ -11613,15 +9841,11 @@ var require_bn4 = __commonJS({
return this;
}),
(BN.prototype.strip = function () {
- for (; this.length > 1 && this.words[this.length - 1] === 0; )
- this.length--;
+ for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
return this._normSign();
}),
(BN.prototype._normSign = function () {
- return (
- this.length === 1 && this.words[0] === 0 && (this.negative = 0),
- this
- );
+ return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}),
(BN.prototype.inspect = function () {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -11655,15 +9879,13 @@ var require_bn4 = __commonJS({
"0000000000000000000000000",
],
groupSizes = [
- 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5,
],
groupBases = [
- 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607,
- 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536,
- 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101,
- 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368,
- 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
+ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808,
+ 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624,
+ 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
60466176,
];
(BN.prototype.toString = function (base, padding) {
@@ -11675,18 +9897,11 @@ var require_bn4 = __commonJS({
var w = this.words[i],
word = (((w << off) | carry) & 16777215).toString(16);
(carry = (w >>> (24 - off)) & 16777215),
- carry !== 0 || i !== this.length - 1
- ? (out = zeros[6 - word.length] + word + out)
- : (out = word + out),
+ carry !== 0 || i !== this.length - 1 ? (out = zeros[6 - word.length] + word + out) : (out = word + out),
(off += 2),
off >= 26 && ((off -= 26), i--);
}
- for (
- carry !== 0 && (out = carry.toString(16) + out);
- out.length % padding !== 0;
-
- )
- out = "0" + out;
+ for (carry !== 0 && (out = carry.toString(16) + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
if (base === (base | 0) && base >= 2 && base <= 36) {
@@ -11696,13 +9911,9 @@ var require_bn4 = __commonJS({
var c = this.clone();
for (c.negative = 0; !c.isZero(); ) {
var r = c.modn(groupBase).toString(base);
- (c = c.idivn(groupBase)),
- c.isZero()
- ? (out = r + out)
- : (out = zeros[groupSize - r.length] + r + out);
+ (c = c.idivn(groupBase)), c.isZero() ? (out = r + out) : (out = zeros[groupSize - r.length] + r + out);
}
- for (this.isZero() && (out = "0" + out); out.length % padding !== 0; )
- out = "0" + out;
+ for (this.isZero() && (out = "0" + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
assert(!1, "Base should be between 2 and 36");
@@ -11714,8 +9925,7 @@ var require_bn4 = __commonJS({
? (ret += this.words[1] * 67108864)
: this.length === 3 && this.words[2] === 1
? (ret += 4503599627370496 + this.words[1] * 67108864)
- : this.length > 2 &&
- assert(!1, "Number can only safely store up to 53 bits"),
+ : this.length > 2 && assert(!1, "Number can only safely store up to 53 bits"),
this.negative !== 0 ? -ret : ret
);
}),
@@ -11723,10 +9933,7 @@ var require_bn4 = __commonJS({
return this.toString(16);
}),
(BN.prototype.toBuffer = function (endian, length) {
- return (
- assert(typeof Buffer2 < "u"),
- this.toArrayLike(Buffer2, endian, length)
- );
+ return assert(typeof Buffer2 < "u"), this.toArrayLike(Buffer2, endian, length);
}),
(BN.prototype.toArray = function (endian, length) {
return this.toArrayLike(Array, endian, length);
@@ -11734,10 +9941,7 @@ var require_bn4 = __commonJS({
(BN.prototype.toArrayLike = function (ArrayType, endian, length) {
var byteLength = this.byteLength(),
reqLength = length || Math.max(1, byteLength);
- assert(
- byteLength <= reqLength,
- "byte array longer than desired length",
- ),
+ assert(byteLength <= reqLength, "byte array longer than desired length"),
assert(reqLength > 0, "Requested array length <= 0"),
this.strip();
var littleEndian = endian === "le",
@@ -11746,13 +9950,11 @@ var require_bn4 = __commonJS({
i,
q = this.clone();
if (littleEndian) {
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[i] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[i] = b);
for (; i < reqLength; i++) res[i] = 0;
} else {
for (i = 0; i < reqLength - byteLength; i++) res[i] = 0;
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
}
return res;
}),
@@ -11790,11 +9992,7 @@ var require_bn4 = __commonJS({
return (this.length - 1) * 26 + hi;
});
function toBitArray(num) {
- for (
- var w = new Array(num.bitLength()), bit = 0;
- bit < w.length;
- bit++
- ) {
+ for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
var off = (bit / 26) | 0,
wbit = bit % 26;
w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
@@ -11813,14 +10011,10 @@ var require_bn4 = __commonJS({
return Math.ceil(this.bitLength() / 8);
}),
(BN.prototype.toTwos = function (width) {
- return this.negative !== 0
- ? this.abs().inotn(width).iaddn(1)
- : this.clone();
+ return this.negative !== 0 ? this.abs().inotn(width).iaddn(1) : this.clone();
}),
(BN.prototype.fromTwos = function (width) {
- return this.testn(width - 1)
- ? this.notn(width).iaddn(1).ineg()
- : this.clone();
+ return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
}),
(BN.prototype.isNeg = function () {
return this.negative !== 0;
@@ -11833,50 +10027,37 @@ var require_bn4 = __commonJS({
}),
(BN.prototype.iuor = function (num) {
for (; this.length < num.length; ) this.words[this.length++] = 0;
- for (var i = 0; i < num.length; i++)
- this.words[i] = this.words[i] | num.words[i];
+ for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
return this.strip();
}),
(BN.prototype.ior = function (num) {
return assert((this.negative | num.negative) === 0), this.iuor(num);
}),
(BN.prototype.or = function (num) {
- return this.length > num.length
- ? this.clone().ior(num)
- : num.clone().ior(this);
+ return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
}),
(BN.prototype.uor = function (num) {
- return this.length > num.length
- ? this.clone().iuor(num)
- : num.clone().iuor(this);
+ return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
}),
(BN.prototype.iuand = function (num) {
var b;
this.length > num.length ? (b = num) : (b = this);
- for (var i = 0; i < b.length; i++)
- this.words[i] = this.words[i] & num.words[i];
+ for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
return (this.length = b.length), this.strip();
}),
(BN.prototype.iand = function (num) {
return assert((this.negative | num.negative) === 0), this.iuand(num);
}),
(BN.prototype.and = function (num) {
- return this.length > num.length
- ? this.clone().iand(num)
- : num.clone().iand(this);
+ return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
}),
(BN.prototype.uand = function (num) {
- return this.length > num.length
- ? this.clone().iuand(num)
- : num.clone().iuand(this);
+ return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
}),
(BN.prototype.iuxor = function (num) {
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
- for (var i = 0; i < b.length; i++)
- this.words[i] = a.words[i] ^ b.words[i];
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
+ for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
if (this !== a) for (; i < a.length; i++) this.words[i] = a.words[i];
return (this.length = a.length), this.strip();
}),
@@ -11884,27 +10065,18 @@ var require_bn4 = __commonJS({
return assert((this.negative | num.negative) === 0), this.iuxor(num);
}),
(BN.prototype.xor = function (num) {
- return this.length > num.length
- ? this.clone().ixor(num)
- : num.clone().ixor(this);
+ return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
}),
(BN.prototype.uxor = function (num) {
- return this.length > num.length
- ? this.clone().iuxor(num)
- : num.clone().iuxor(this);
+ return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
}),
(BN.prototype.inotn = function (width) {
assert(typeof width == "number" && width >= 0);
var bytesNeeded = Math.ceil(width / 26) | 0,
bitsLeft = width % 26;
this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;
- for (var i = 0; i < bytesNeeded; i++)
- this.words[i] = ~this.words[i] & 67108863;
- return (
- bitsLeft > 0 &&
- (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))),
- this.strip()
- );
+ for (var i = 0; i < bytesNeeded; i++) this.words[i] = ~this.words[i] & 67108863;
+ return bitsLeft > 0 && (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))), this.strip();
}),
(BN.prototype.notn = function (width) {
return this.clone().inotn(width);
@@ -11924,49 +10096,25 @@ var require_bn4 = __commonJS({
(BN.prototype.iadd = function (num) {
var r;
if (this.negative !== 0 && num.negative === 0)
- return (
- (this.negative = 0),
- (r = this.isub(num)),
- (this.negative ^= 1),
- this._normSign()
- );
+ return (this.negative = 0), (r = this.isub(num)), (this.negative ^= 1), this._normSign();
if (this.negative === 0 && num.negative !== 0)
- return (
- (num.negative = 0),
- (r = this.isub(num)),
- (num.negative = 1),
- r._normSign()
- );
+ return (num.negative = 0), (r = this.isub(num)), (num.negative = 1), r._normSign();
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) + (b.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
+ (r = (a.words[i] | 0) + (b.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
- if (((this.length = a.length), carry !== 0))
- (this.words[this.length] = carry), this.length++;
- else if (a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
+ (r = (a.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
+ if (((this.length = a.length), carry !== 0)) (this.words[this.length] = carry), this.length++;
+ else if (a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
return this;
}),
(BN.prototype.add = function (num) {
var res;
return num.negative !== 0 && this.negative === 0
- ? ((num.negative = 0),
- (res = this.sub(num)),
- (num.negative ^= 1),
- res)
+ ? ((num.negative = 0), (res = this.sub(num)), (num.negative ^= 1), res)
: num.negative === 0 && this.negative !== 0
- ? ((this.negative = 0),
- (res = num.sub(this)),
- (this.negative = 1),
- res)
+ ? ((this.negative = 0), (res = num.sub(this)), (this.negative = 1), res)
: this.length > num.length
? this.clone().iadd(num)
: num.clone().iadd(this);
@@ -11977,34 +10125,17 @@ var require_bn4 = __commonJS({
var r = this.iadd(num);
return (num.negative = 1), r._normSign();
} else if (this.negative !== 0)
- return (
- (this.negative = 0),
- this.iadd(num),
- (this.negative = 1),
- this._normSign()
- );
+ return (this.negative = 0), this.iadd(num), (this.negative = 1), this._normSign();
var cmp = this.cmp(num);
- if (cmp === 0)
- return (
- (this.negative = 0), (this.length = 1), (this.words[0] = 0), this
- );
+ if (cmp === 0) return (this.negative = 0), (this.length = 1), (this.words[0] = 0), this;
var a, b;
cmp > 0 ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) - (b.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
+ (r = (a.words[i] | 0) - (b.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
- if (carry === 0 && i < a.length && a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
- return (
- (this.length = Math.max(this.length, i)),
- a !== this && (this.negative = 1),
- this.strip()
- );
+ (r = (a.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
+ if (carry === 0 && i < a.length && a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
+ return (this.length = Math.max(this.length, i)), a !== this && (this.negative = 1), this.strip();
}),
(BN.prototype.sub = function (num) {
return this.clone().isub(num);
@@ -12037,9 +10168,7 @@ var require_bn4 = __commonJS({
}
(out.words[k] = rword | 0), (carry = ncarry | 0);
}
- return (
- carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip()
- );
+ return carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip();
}
var comb10MulTo = function (self2, num, out) {
var a = self2.words,
@@ -12594,15 +10723,12 @@ var require_bn4 = __commonJS({
};
Math.imul || (comb10MulTo = smallMulTo);
function bigMulTo(self2, num, out) {
- (out.negative = num.negative ^ self2.negative),
- (out.length = self2.length + num.length);
+ (out.negative = num.negative ^ self2.negative), (out.length = self2.length + num.length);
for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
var ncarry = hncarry;
hncarry = 0;
for (
- var rword = carry & 67108863,
- maxJ = Math.min(k, num.length - 1),
- j = Math.max(0, k - self2.length + 1);
+ var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);
j <= maxJ;
j++
) {
@@ -12644,32 +10770,22 @@ var require_bn4 = __commonJS({
(this.x = x), (this.y = y);
}
(FFTM.prototype.makeRBT = function (N) {
- for (
- var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0;
- i < N;
- i++
- )
- t[i] = this.revBin(i, l, N);
+ for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
return t;
}),
(FFTM.prototype.revBin = function (x, l, N) {
if (x === 0 || x === N - 1) return x;
- for (var rb = 0, i = 0; i < l; i++)
- (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
+ for (var rb = 0, i = 0; i < l; i++) (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
return rb;
}),
(FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++)
- (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
+ for (var i = 0; i < N; i++) (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
}),
(FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) {
this.permute(rbt, rws, iws, rtws, itws, N);
for (var s = 1; s < N; s <<= 1)
for (
- var l = s << 1,
- rtwdf = Math.cos((2 * Math.PI) / l),
- itwdf = Math.sin((2 * Math.PI) / l),
- p = 0;
+ var l = s << 1, rtwdf = Math.cos((2 * Math.PI) / l), itwdf = Math.sin((2 * Math.PI) / l), p = 0;
p < N;
p += l
)
@@ -12686,9 +10802,7 @@ var require_bn4 = __commonJS({
(rtws[p + j + s] = re - ro),
(itws[p + j + s] = ie - io),
j !== l &&
- ((rx = rtwdf * rtwdf_ - itwdf * itwdf_),
- (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_),
- (rtwdf_ = rx));
+ ((rx = rtwdf * rtwdf_ - itwdf * itwdf_), (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_), (rtwdf_ = rx));
}
}),
(FFTM.prototype.guessLen13b = function (n, m) {
@@ -12711,12 +10825,8 @@ var require_bn4 = __commonJS({
}),
(FFTM.prototype.normalize13b = function (ws, N) {
for (var carry = 0, i = 0; i < N / 2; i++) {
- var w =
- Math.round(ws[2 * i + 1] / N) * 8192 +
- Math.round(ws[2 * i] / N) +
- carry;
- (ws[i] = w & 67108863),
- w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
+ var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;
+ (ws[i] = w & 67108863), w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
}
return ws;
}),
@@ -12766,17 +10876,11 @@ var require_bn4 = __commonJS({
}),
(BN.prototype.mul = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- this.mulTo(num, out)
- );
+ return (out.words = new Array(this.length + num.length)), this.mulTo(num, out);
}),
(BN.prototype.mulf = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- jumboMulTo(this, num, out)
- );
+ return (out.words = new Array(this.length + num.length)), jumboMulTo(this, num, out);
}),
(BN.prototype.imul = function (num) {
return this.clone().mulTo(num, this);
@@ -12786,10 +10890,7 @@ var require_bn4 = __commonJS({
for (var carry = 0, i = 0; i < this.length; i++) {
var w = (this.words[i] | 0) * num,
lo = (w & 67108863) + (carry & 67108863);
- (carry >>= 26),
- (carry += (w / 67108864) | 0),
- (carry += lo >>> 26),
- (this.words[i] = lo & 67108863);
+ (carry >>= 26), (carry += (w / 67108864) | 0), (carry += lo >>> 26), (this.words[i] = lo & 67108863);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -12805,14 +10906,8 @@ var require_bn4 = __commonJS({
(BN.prototype.pow = function (num) {
var w = toBitArray(num);
if (w.length === 0) return new BN(1);
- for (
- var res = this, i = 0;
- i < w.length && w[i] === 0;
- i++, res = res.sqr()
- );
- if (++i < w.length)
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr())
- w[i] !== 0 && (res = res.mul(q));
+ for (var res = this, i = 0; i < w.length && w[i] === 0; i++, res = res.sqr());
+ if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) w[i] !== 0 && (res = res.mul(q));
return res;
}),
(BN.prototype.iushln = function (bits) {
@@ -12831,8 +10926,7 @@ var require_bn4 = __commonJS({
carry && ((this.words[i] = carry), this.length++);
}
if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--)
- this.words[i + s] = this.words[i];
+ for (i = this.length - 1; i >= 0; i--) this.words[i + s] = this.words[i];
for (i = 0; i < s; i++) this.words[i] = 0;
this.length += s;
}
@@ -12854,20 +10948,15 @@ var require_bn4 = __commonJS({
maskedWords.length = s;
}
if (s !== 0)
- if (this.length > s)
- for (this.length -= s, i = 0; i < this.length; i++)
- this.words[i] = this.words[i + s];
+ if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s];
else (this.words[0] = 0), (this.length = 1);
var carry = 0;
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
var word = this.words[i] | 0;
- (this.words[i] = (carry << (26 - r)) | (word >>> r)),
- (carry = word & mask);
+ (this.words[i] = (carry << (26 - r)) | (word >>> r)), (carry = word & mask);
}
return (
- maskedWords &&
- carry !== 0 &&
- (maskedWords.words[maskedWords.length++] = carry),
+ maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry),
this.length === 0 && ((this.words[0] = 0), (this.length = 1)),
this.strip()
);
@@ -12900,17 +10989,8 @@ var require_bn4 = __commonJS({
assert(typeof bits == "number" && bits >= 0);
var r = bits % 26,
s = (bits - r) / 26;
- if (
- (assert(
- this.negative === 0,
- "imaskn works only with positive numbers",
- ),
- this.length <= s)
- )
- return this;
- if (
- (r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)
- ) {
+ if ((assert(this.negative === 0, "imaskn works only with positive numbers"), this.length <= s)) return this;
+ if ((r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)) {
var mask = 67108863 ^ ((67108863 >>> r) << r);
this.words[this.length - 1] &= mask;
}
@@ -12927,32 +11007,20 @@ var require_bn4 = __commonJS({
? this.isubn(-num)
: this.negative !== 0
? this.length === 1 && (this.words[0] | 0) < num
- ? ((this.words[0] = num - (this.words[0] | 0)),
- (this.negative = 0),
- this)
- : ((this.negative = 0),
- this.isubn(num),
- (this.negative = 1),
- this)
+ ? ((this.words[0] = num - (this.words[0] | 0)), (this.negative = 0), this)
+ : ((this.negative = 0), this.isubn(num), (this.negative = 1), this)
: this._iaddn(num)
);
}),
(BN.prototype._iaddn = function (num) {
this.words[0] += num;
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++)
- (this.words[i] -= 67108864),
- i === this.length - 1
- ? (this.words[i + 1] = 1)
- : this.words[i + 1]++;
+ (this.words[i] -= 67108864), i === this.length - 1 ? (this.words[i + 1] = 1) : this.words[i + 1]++;
return (this.length = Math.max(this.length, i + 1)), this;
}),
(BN.prototype.isubn = function (num) {
- if ((assert(typeof num == "number"), assert(num < 67108864), num < 0))
- return this.iaddn(-num);
- if (this.negative !== 0)
- return (
- (this.negative = 0), this.iaddn(num), (this.negative = 1), this
- );
+ if ((assert(typeof num == "number"), assert(num < 67108864), num < 0)) return this.iaddn(-num);
+ if (this.negative !== 0) return (this.negative = 0), this.iaddn(num), (this.negative = 1), this;
if (((this.words[0] -= num), this.length === 1 && this.words[0] < 0))
(this.words[0] = -this.words[0]), (this.negative = 1);
else
@@ -12986,14 +11054,10 @@ var require_bn4 = __commonJS({
(this.words[i + shift] = w & 67108863);
}
for (; i < this.length - shift; i++)
- (w = (this.words[i + shift] | 0) + carry),
- (carry = w >> 26),
- (this.words[i + shift] = w & 67108863);
+ (w = (this.words[i + shift] | 0) + carry), (carry = w >> 26), (this.words[i + shift] = w & 67108863);
if (carry === 0) return this.strip();
for (assert(carry === -1), carry = 0, i = 0; i < this.length; i++)
- (w = -(this.words[i] | 0) + carry),
- (carry = w >> 26),
- (this.words[i] = w & 67108863);
+ (w = -(this.words[i] | 0) + carry), (carry = w >> 26), (this.words[i] = w & 67108863);
return (this.negative = 1), this.strip();
}),
(BN.prototype._wordDiv = function (num, mode) {
@@ -13003,33 +11067,19 @@ var require_bn4 = __commonJS({
bhi = b.words[b.length - 1] | 0,
bhiBits = this._countBits(bhi);
(shift = 26 - bhiBits),
- shift !== 0 &&
- ((b = b.ushln(shift)),
- a.iushln(shift),
- (bhi = b.words[b.length - 1] | 0));
+ shift !== 0 && ((b = b.ushln(shift)), a.iushln(shift), (bhi = b.words[b.length - 1] | 0));
var m = a.length - b.length,
q;
if (mode !== "mod") {
- (q = new BN(null)),
- (q.length = m + 1),
- (q.words = new Array(q.length));
+ (q = new BN(null)), (q.length = m + 1), (q.words = new Array(q.length));
for (var i = 0; i < q.length; i++) q.words[i] = 0;
}
var diff = a.clone()._ishlnsubmul(b, 1, m);
diff.negative === 0 && ((a = diff), q && (q.words[m] = 1));
for (var j = m - 1; j >= 0; j--) {
- var qj =
- (a.words[b.length + j] | 0) * 67108864 +
- (a.words[b.length + j - 1] | 0);
- for (
- qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j);
- a.negative !== 0;
-
- )
- qj--,
- (a.negative = 0),
- a._ishlnsubmul(b, 1, j),
- a.isZero() || (a.negative ^= 1);
+ var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);
+ for (qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j); a.negative !== 0; )
+ qj--, (a.negative = 0), a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
q && (q.words[j] = qj);
}
return (
@@ -13052,9 +11102,7 @@ var require_bn4 = __commonJS({
return this.negative !== 0 && num.negative === 0
? ((res = this.neg().divmod(num, mode)),
mode !== "mod" && (div = res.div.neg()),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.iadd(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.iadd(num)),
{
div,
mod,
@@ -13068,9 +11116,7 @@ var require_bn4 = __commonJS({
})
: (this.negative & num.negative) !== 0
? ((res = this.neg().divmod(num.neg(), mode)),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.isub(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.isub(num)),
{
div: res.div,
mod,
@@ -13121,11 +11167,7 @@ var require_bn4 = __commonJS({
}),
(BN.prototype.modn = function (num) {
assert(num <= 67108863);
- for (
- var p = (1 << 26) % num, acc = 0, i = this.length - 1;
- i >= 0;
- i--
- )
+ for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; i >= 0; i--)
acc = (p * acc + (this.words[i] | 0)) % num;
return acc;
}),
@@ -13145,40 +11187,18 @@ var require_bn4 = __commonJS({
var x = this,
y = p.clone();
x.negative !== 0 ? (x = x.umod(p)) : (x = x.clone());
- for (
- var A = new BN(1),
- B = new BN(0),
- C = new BN(0),
- D = new BN(1),
- g = 0;
- x.isEven() && y.isEven();
-
- )
+ for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); )
x.iushrn(1), y.iushrn(1), ++g;
for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
- for (
- var i = 0, im = 1;
- (x.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
if (i > 0)
for (x.iushrn(i); i-- > 0; )
- (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)),
- A.iushrn(1),
- B.iushrn(1);
- for (
- var j = 0, jm = 1;
- (y.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
+ (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
if (j > 0)
for (y.iushrn(j); j-- > 0; )
- (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)),
- C.iushrn(1),
- D.iushrn(1);
- x.cmp(y) >= 0
- ? (x.isub(y), A.isub(C), B.isub(D))
- : (y.isub(x), C.isub(A), D.isub(B));
+ (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);
+ x.cmp(y) >= 0 ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
}
return {
a: C,
@@ -13191,35 +11211,15 @@ var require_bn4 = __commonJS({
var a = this,
b = p.clone();
a.negative !== 0 ? (a = a.umod(p)) : (a = a.clone());
- for (
- var x1 = new BN(1), x2 = new BN(0), delta = b.clone();
- a.cmpn(1) > 0 && b.cmpn(1) > 0;
-
- ) {
- for (
- var i = 0, im = 1;
- (a.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
- if (i > 0)
- for (a.iushrn(i); i-- > 0; )
- x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
- for (
- var j = 0, jm = 1;
- (b.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
- if (j > 0)
- for (b.iushrn(j); j-- > 0; )
- x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
+ for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone(); a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
+ if (i > 0) for (a.iushrn(i); i-- > 0; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
+ if (j > 0) for (b.iushrn(j); j-- > 0; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
a.cmp(b) >= 0 ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
}
var res;
- return (
- a.cmpn(1) === 0 ? (res = x1) : (res = x2),
- res.cmpn(0) < 0 && res.iadd(p),
- res
- );
+ return a.cmpn(1) === 0 ? (res = x1) : (res = x2), res.cmpn(0) < 0 && res.iadd(p), res;
}),
(BN.prototype.gcd = function (num) {
if (this.isZero()) return num.abs();
@@ -13227,8 +11227,7 @@ var require_bn4 = __commonJS({
var a = this.clone(),
b = num.clone();
(a.negative = 0), (b.negative = 0);
- for (var shift = 0; a.isEven() && b.isEven(); shift++)
- a.iushrn(1), b.iushrn(1);
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), b.iushrn(1);
do {
for (; a.isEven(); ) a.iushrn(1);
for (; b.isEven(); ) b.iushrn(1);
@@ -13258,14 +11257,10 @@ var require_bn4 = __commonJS({
var r = bit % 26,
s = (bit - r) / 26,
q = 1 << r;
- if (this.length <= s)
- return this._expand(s + 1), (this.words[s] |= q), this;
+ if (this.length <= s) return this._expand(s + 1), (this.words[s] |= q), this;
for (var carry = q, i = s; carry !== 0 && i < this.length; i++) {
var w = this.words[i] | 0;
- (w += carry),
- (carry = w >>> 26),
- (w &= 67108863),
- (this.words[i] = w);
+ (w += carry), (carry = w >>> 26), (w &= 67108863), (this.words[i] = w);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -13280,8 +11275,7 @@ var require_bn4 = __commonJS({
var res;
if (this.length > 1) res = 1;
else {
- negative && (num = -num),
- assert(num <= 67108863, "Number is too big");
+ negative && (num = -num), assert(num <= 67108863, "Number is too big");
var w = this.words[0] | 0;
res = w === num ? 0 : w < num ? -1 : 1;
}
@@ -13347,52 +11341,28 @@ var require_bn4 = __commonJS({
);
}),
(BN.prototype.fromRed = function () {
- return (
- assert(
- this.red,
- "fromRed works only with numbers in reduction context",
- ),
- this.red.convertFrom(this)
- );
+ return assert(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
}),
(BN.prototype._forceRed = function (ctx) {
return (this.red = ctx), this;
}),
(BN.prototype.forceRed = function (ctx) {
- return (
- assert(!this.red, "Already a number in reduction context"),
- this._forceRed(ctx)
- );
+ return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
}),
(BN.prototype.redAdd = function (num) {
- return (
- assert(this.red, "redAdd works only with red numbers"),
- this.red.add(this, num)
- );
+ return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
}),
(BN.prototype.redIAdd = function (num) {
- return (
- assert(this.red, "redIAdd works only with red numbers"),
- this.red.iadd(this, num)
- );
+ return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
}),
(BN.prototype.redSub = function (num) {
- return (
- assert(this.red, "redSub works only with red numbers"),
- this.red.sub(this, num)
- );
+ return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
}),
(BN.prototype.redISub = function (num) {
- return (
- assert(this.red, "redISub works only with red numbers"),
- this.red.isub(this, num)
- );
+ return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
}),
(BN.prototype.redShl = function (num) {
- return (
- assert(this.red, "redShl works only with red numbers"),
- this.red.shl(this, num)
- );
+ return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
}),
(BN.prototype.redMul = function (num) {
return (
@@ -13409,46 +11379,22 @@ var require_bn4 = __commonJS({
);
}),
(BN.prototype.redSqr = function () {
- return (
- assert(this.red, "redSqr works only with red numbers"),
- this.red._verify1(this),
- this.red.sqr(this)
- );
+ return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
}),
(BN.prototype.redISqr = function () {
- return (
- assert(this.red, "redISqr works only with red numbers"),
- this.red._verify1(this),
- this.red.isqr(this)
- );
+ return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
}),
(BN.prototype.redSqrt = function () {
- return (
- assert(this.red, "redSqrt works only with red numbers"),
- this.red._verify1(this),
- this.red.sqrt(this)
- );
+ return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
}),
(BN.prototype.redInvm = function () {
- return (
- assert(this.red, "redInvm works only with red numbers"),
- this.red._verify1(this),
- this.red.invm(this)
- );
+ return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
}),
(BN.prototype.redNeg = function () {
- return (
- assert(this.red, "redNeg works only with red numbers"),
- this.red._verify1(this),
- this.red.neg(this)
- );
+ return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
}),
(BN.prototype.redPow = function (num) {
- return (
- assert(this.red && !num.red, "redPow(normalNum)"),
- this.red._verify1(this),
- this.red.pow(this, num)
- );
+ return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, num);
});
var primes = {
k256: null,
@@ -13470,11 +11416,7 @@ var require_bn4 = __commonJS({
(MPrime.prototype.ireduce = function (num) {
var r = num,
rlen;
- do
- this.split(r, this.tmp),
- (r = this.imulK(r)),
- (r = r.iadd(this.tmp)),
- (rlen = r.bitLength());
+ do this.split(r, this.tmp), (r = this.imulK(r)), (r = r.iadd(this.tmp)), (rlen = r.bitLength());
while (rlen > this.n);
var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
return (
@@ -13495,78 +11437,45 @@ var require_bn4 = __commonJS({
return num.imul(this.k);
});
function K256() {
- MPrime.call(
- this,
- "k256",
- "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
- );
+ MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
}
inherits(K256, MPrime),
(K256.prototype.split = function (input, output) {
- for (
- var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;
- i < outLen;
- i++
- )
+ for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0; i < outLen; i++)
output.words[i] = input.words[i];
if (((output.length = outLen), input.length <= 9)) {
(input.words[0] = 0), (input.length = 1);
return;
}
var prev = input.words[9];
- for (
- output.words[output.length++] = prev & mask, i = 10;
- i < input.length;
- i++
- ) {
+ for (output.words[output.length++] = prev & mask, i = 10; i < input.length; i++) {
var next = input.words[i] | 0;
- (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)),
- (prev = next);
+ (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)), (prev = next);
}
(prev >>>= 22),
(input.words[i - 10] = prev),
- prev === 0 && input.length > 10
- ? (input.length -= 10)
- : (input.length -= 9);
+ prev === 0 && input.length > 10 ? (input.length -= 10) : (input.length -= 9);
}),
(K256.prototype.imulK = function (num) {
- (num.words[num.length] = 0),
- (num.words[num.length + 1] = 0),
- (num.length += 2);
+ (num.words[num.length] = 0), (num.words[num.length + 1] = 0), (num.length += 2);
for (var lo = 0, i = 0; i < num.length; i++) {
var w = num.words[i] | 0;
- (lo += w * 977),
- (num.words[i] = lo & 67108863),
- (lo = w * 64 + ((lo / 67108864) | 0));
+ (lo += w * 977), (num.words[i] = lo & 67108863), (lo = w * 64 + ((lo / 67108864) | 0));
}
return (
- num.words[num.length - 1] === 0 &&
- (num.length--, num.words[num.length - 1] === 0 && num.length--),
- num
+ num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num
);
});
function P224() {
- MPrime.call(
- this,
- "p224",
- "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
- );
+ MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
}
inherits(P224, MPrime);
function P192() {
- MPrime.call(
- this,
- "p192",
- "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
- );
+ MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
}
inherits(P192, MPrime);
function P25519() {
- MPrime.call(
- this,
- "25519",
- "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
- );
+ MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
}
inherits(P25519, MPrime),
(P25519.prototype.imulK = function (num) {
@@ -13591,26 +11500,17 @@ var require_bn4 = __commonJS({
if (typeof m == "string") {
var prime = BN._prime(m);
(this.m = prime.p), (this.prime = prime);
- } else
- assert(m.gtn(1), "modulus must be greater than 1"),
- (this.m = m),
- (this.prime = null);
+ } else assert(m.gtn(1), "modulus must be greater than 1"), (this.m = m), (this.prime = null);
}
(Red.prototype._verify1 = function (a) {
- assert(a.negative === 0, "red works only with positives"),
- assert(a.red, "red works only with red numbers");
+ assert(a.negative === 0, "red works only with positives"), assert(a.red, "red works only with red numbers");
}),
(Red.prototype._verify2 = function (a, b) {
- assert(
- (a.negative | b.negative) === 0,
- "red works only with positives",
- ),
+ assert((a.negative | b.negative) === 0, "red works only with positives"),
assert(a.red && a.red === b.red, "red works only with red numbers");
}),
(Red.prototype.imod = function (a) {
- return this.prime
- ? this.prime.ireduce(a)._forceRed(this)
- : a.umod(this.m)._forceRed(this);
+ return this.prime ? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);
}),
(Red.prototype.neg = function (a) {
return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
@@ -13657,29 +11557,19 @@ var require_bn4 = __commonJS({
var pow = this.m.add(new BN(1)).iushrn(2);
return this.pow(a, pow);
}
- for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; )
- s++, q.iushrn(1);
+ for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; ) s++, q.iushrn(1);
assert(!q.isZero());
var one = new BN(1).toRed(this),
nOne = one.redNeg(),
lpow = this.m.subn(1).iushrn(1),
z = this.m.bitLength();
+ for (z = new BN(2 * z * z).toRed(this); this.pow(z, lpow).cmp(nOne) !== 0; ) z.redIAdd(nOne);
for (
- z = new BN(2 * z * z).toRed(this);
- this.pow(z, lpow).cmp(nOne) !== 0;
-
- )
- z.redIAdd(nOne);
- for (
- var c = this.pow(z, q),
- r = this.pow(a, q.addn(1).iushrn(1)),
- t = this.pow(a, q),
- m = s;
+ var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;
t.cmp(one) !== 0;
) {
- for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++)
- tmp = tmp.redSqr();
+ for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++) tmp = tmp.redSqr();
assert(i < m);
var b = this.pow(c, new BN(1).iushln(m - i - 1));
(r = r.redMul(b)), (c = b.redSqr()), (t = t.redMul(c)), (m = i);
@@ -13688,9 +11578,7 @@ var require_bn4 = __commonJS({
}),
(Red.prototype.invm = function (a) {
var inv = a._invmp(this.m);
- return inv.negative !== 0
- ? ((inv.negative = 0), this.imod(inv).redNeg())
- : this.imod(inv);
+ return inv.negative !== 0 ? ((inv.negative = 0), this.imod(inv).redNeg()) : this.imod(inv);
}),
(Red.prototype.pow = function (a, num) {
if (num.isZero()) return new BN(1).toRed(this);
@@ -13706,10 +11594,7 @@ var require_bn4 = __commonJS({
for (start === 0 && (start = 26), i = num.length - 1; i >= 0; i--) {
for (var word = num.words[i], j = start - 1; j >= 0; j--) {
var bit = (word >> j) & 1;
- if (
- (res !== wnd[0] && (res = this.sqr(res)),
- bit === 0 && current === 0)
- ) {
+ if ((res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0)) {
currentLen = 0;
continue;
}
@@ -13717,9 +11602,7 @@ var require_bn4 = __commonJS({
(current |= bit),
currentLen++,
!(currentLen !== windowSize && (i !== 0 || j !== 0)) &&
- ((res = this.mul(res, wnd[current])),
- (currentLen = 0),
- (current = 0));
+ ((res = this.mul(res, wnd[current])), (currentLen = 0), (current = 0));
}
start = 26;
}
@@ -13756,38 +11639,23 @@ var require_bn4 = __commonJS({
return (r.red = null), r;
}),
(Mont.prototype.imul = function (a, b) {
- if (a.isZero() || b.isZero())
- return (a.words[0] = 0), (a.length = 1), a;
+ if (a.isZero() || b.isZero()) return (a.words[0] = 0), (a.length = 1), a;
var t = a.imul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.mul = function (a, b) {
if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
var t = a.mul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.invm = function (a) {
@@ -13812,10 +11680,8 @@ var require_utils2 = __commonJS({
return res;
}
if (enc === "hex") {
- (msg = msg.replace(/[^a-z0-9]+/gi, "")),
- msg.length % 2 !== 0 && (msg = "0" + msg);
- for (var i = 0; i < msg.length; i += 2)
- res.push(parseInt(msg[i] + msg[i + 1], 16));
+ (msg = msg.replace(/[^a-z0-9]+/gi, "")), msg.length % 2 !== 0 && (msg = "0" + msg);
+ for (var i = 0; i < msg.length; i += 2) res.push(parseInt(msg[i] + msg[i + 1], 16));
} else
for (var i = 0; i < msg.length; i++) {
var c = msg.charCodeAt(i),
@@ -13831,8 +11697,7 @@ var require_utils2 = __commonJS({
}
utils.zero2 = zero2;
function toHex(msg) {
- for (var res = "", i = 0; i < msg.length; i++)
- res += zero2(msg[i].toString(16));
+ for (var res = "", i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16));
return res;
}
utils.toHex = toHex;
@@ -13861,10 +11726,7 @@ var require_utils3 = __commonJS({
for (var ws = 1 << (w + 1), k = num.clone(), i = 0; i < naf.length; i++) {
var z,
mod = k.andln(ws - 1);
- k.isOdd()
- ? (mod > (ws >> 1) - 1 ? (z = (ws >> 1) - mod) : (z = mod),
- k.isubn(z))
- : (z = 0),
+ k.isOdd() ? (mod > (ws >> 1) - 1 ? (z = (ws >> 1) - mod) : (z = mod), k.isubn(z)) : (z = 0),
(naf[i] = z),
k.iushrn(1);
}
@@ -13881,14 +11743,12 @@ var require_utils3 = __commonJS({
var u1;
(m14 & 1) === 0
? (u1 = 0)
- : ((m8 = (k1.andln(7) + d1) & 7),
- (m8 === 3 || m8 === 5) && m24 === 2 ? (u1 = -m14) : (u1 = m14)),
+ : ((m8 = (k1.andln(7) + d1) & 7), (m8 === 3 || m8 === 5) && m24 === 2 ? (u1 = -m14) : (u1 = m14)),
jsf[0].push(u1);
var u2;
(m24 & 1) === 0
? (u2 = 0)
- : ((m8 = (k2.andln(7) + d2) & 7),
- (m8 === 3 || m8 === 5) && m14 === 2 ? (u2 = -m24) : (u2 = m24)),
+ : ((m8 = (k2.andln(7) + d2) & 7), (m8 === 3 || m8 === 5) && m14 === 2 ? (u2 = -m24) : (u2 = m24)),
jsf[1].push(u2),
2 * d1 === u1 + 1 && (d1 = 1 - d1),
2 * d2 === u2 + 1 && (d2 = 1 - d2),
@@ -13901,9 +11761,7 @@ var require_utils3 = __commonJS({
function cachedProperty(obj, name, computer) {
var key = "_" + name;
obj.prototype[name] = function () {
- return this[key] !== void 0
- ? this[key]
- : (this[key] = computer.call(this));
+ return this[key] !== void 0 ? this[key] : (this[key] = computer.call(this));
};
}
utils.cachedProperty = cachedProperty;
@@ -13964,22 +11822,13 @@ var require_base = __commonJS({
nafW;
for (j = 0; j < naf.length; j += doubles.step) {
nafW = 0;
- for (var l = j + doubles.step - 1; l >= j; l--)
- nafW = (nafW << 1) + naf[l];
+ for (var l = j + doubles.step - 1; l >= j; l--) nafW = (nafW << 1) + naf[l];
repr.push(nafW);
}
- for (
- var a = this.jpoint(null, null, null),
- b = this.jpoint(null, null, null),
- i = I;
- i > 0;
- i--
- ) {
+ for (var a = this.jpoint(null, null, null), b = this.jpoint(null, null, null), i = I; i > 0; i--) {
for (j = 0; j < repr.length; j++)
(nafW = repr[j]),
- nafW === i
- ? (b = b.mixedAdd(doubles.points[j]))
- : nafW === -i && (b = b.mixedAdd(doubles.points[j].neg()));
+ nafW === i ? (b = b.mixedAdd(doubles.points[j])) : nafW === -i && (b = b.mixedAdd(doubles.points[j].neg()));
a = a.add(b);
}
return a.toP();
@@ -14010,13 +11859,7 @@ var require_base = __commonJS({
}
return p.type === "affine" ? acc.toP() : acc;
};
- BaseCurve.prototype._wnafMulAdd = function (
- defW,
- points,
- coeffs,
- len,
- jacobianResult,
- ) {
+ BaseCurve.prototype._wnafMulAdd = function (defW, points, coeffs, len, jacobianResult) {
var wndWidth = this._wnafT1,
wnd = this._wnafT2,
naf = this._wnafT3,
@@ -14041,28 +11884,20 @@ var require_base = __commonJS({
}
var comb = [points[a], null, null, points[b]];
points[a].y.cmp(points[b].y) === 0
- ? ((comb[1] = points[a].add(points[b])),
- (comb[2] = points[a].toJ().mixedAdd(points[b].neg())))
+ ? ((comb[1] = points[a].add(points[b])), (comb[2] = points[a].toJ().mixedAdd(points[b].neg())))
: points[a].y.cmp(points[b].y.redNeg()) === 0
- ? ((comb[1] = points[a].toJ().mixedAdd(points[b])),
- (comb[2] = points[a].add(points[b].neg())))
- : ((comb[1] = points[a].toJ().mixedAdd(points[b])),
- (comb[2] = points[a].toJ().mixedAdd(points[b].neg())));
+ ? ((comb[1] = points[a].toJ().mixedAdd(points[b])), (comb[2] = points[a].add(points[b].neg())))
+ : ((comb[1] = points[a].toJ().mixedAdd(points[b])), (comb[2] = points[a].toJ().mixedAdd(points[b].neg())));
var index = [-3, -1, -5, -7, 0, 7, 5, 1, 3],
jsf = getJSF(coeffs[a], coeffs[b]);
for (
- max = Math.max(jsf[0].length, max),
- naf[a] = new Array(max),
- naf[b] = new Array(max),
- j = 0;
+ max = Math.max(jsf[0].length, max), naf[a] = new Array(max), naf[b] = new Array(max), j = 0;
j < max;
j++
) {
var ja = jsf[0][j] | 0,
jb = jsf[1][j] | 0;
- (naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]),
- (naf[b][j] = 0),
- (wnd[a] = comb);
+ (naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]), (naf[b][j] = 0), (wnd[a] = comb);
}
}
var acc = this.jpoint(null, null, null),
@@ -14070,8 +11905,7 @@ var require_base = __commonJS({
for (i = max; i >= 0; i--) {
for (var k = 0; i >= 0; ) {
var zero = !0;
- for (j = 0; j < len; j++)
- (tmp[j] = naf[j][i] | 0), tmp[j] !== 0 && (zero = !1);
+ for (j = 0; j < len; j++) (tmp[j] = naf[j][i] | 0), tmp[j] !== 0 && (zero = !1);
if (!zero) break;
k++, i--;
}
@@ -14079,9 +11913,7 @@ var require_base = __commonJS({
for (j = 0; j < len; j++) {
var z = tmp[j];
z !== 0 &&
- (z > 0
- ? (p = wnd[j][(z - 1) >> 1])
- : z < 0 && (p = wnd[j][(-z - 1) >> 1].neg()),
+ (z > 0 ? (p = wnd[j][(z - 1) >> 1]) : z < 0 && (p = wnd[j][(-z - 1) >> 1].neg()),
p.type === "affine" ? (acc = acc.mixedAdd(p)) : (acc = acc.add(p)));
}
}
@@ -14101,17 +11933,11 @@ var require_base = __commonJS({
BaseCurve.prototype.decodePoint = function (bytes, enc) {
bytes = utils.toArray(bytes, enc);
var len = this.p.byteLength();
- if (
- (bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) &&
- bytes.length - 1 === 2 * len
- ) {
+ if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) {
bytes[0] === 6
? assert(bytes[bytes.length - 1] % 2 === 0)
: bytes[0] === 7 && assert(bytes[bytes.length - 1] % 2 === 1);
- var res = this.point(
- bytes.slice(1, 1 + len),
- bytes.slice(1 + len, 1 + 2 * len),
- );
+ var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));
return res;
} else if ((bytes[0] === 2 || bytes[0] === 3) && bytes.length - 1 === len)
return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3);
@@ -14123,9 +11949,7 @@ var require_base = __commonJS({
BasePoint.prototype._encode = function (compact) {
var len = this.curve.p.byteLength(),
x = this.getX().toArray("be", len);
- return compact
- ? [this.getY().isEven() ? 2 : 3].concat(x)
- : [4].concat(x, this.getY().toArray("be", len));
+ return compact ? [this.getY().isEven() ? 2 : 3].concat(x) : [4].concat(x, this.getY().toArray("be", len));
};
BasePoint.prototype.encode = function (enc, compact) {
return utils.encode(this._encode(compact), enc);
@@ -14148,13 +11972,10 @@ var require_base = __commonJS({
BasePoint.prototype._hasDoubles = function (k) {
if (!this.precomputed) return !1;
var doubles = this.precomputed.doubles;
- return doubles
- ? doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step)
- : !1;
+ return doubles ? doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step) : !1;
};
BasePoint.prototype._getDoubles = function (step, power) {
- if (this.precomputed && this.precomputed.doubles)
- return this.precomputed.doubles;
+ if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles;
for (var doubles = [this], acc = this, i = 0; i < power; i += step) {
for (var j = 0; j < step; j++) acc = acc.dbl();
doubles.push(acc);
@@ -14166,14 +11987,7 @@ var require_base = __commonJS({
};
BasePoint.prototype._getNAFPoints = function (wnd) {
if (this.precomputed && this.precomputed.naf) return this.precomputed.naf;
- for (
- var res = [this],
- max = (1 << wnd) - 1,
- dbl = max === 1 ? null : this.dbl(),
- i = 1;
- i < max;
- i++
- )
+ for (var res = [this], max = (1 << wnd) - 1, dbl = max === 1 ? null : this.dbl(), i = 1; i < max; i++)
res[i] = res[i - 1].add(dbl);
return {
wnd,
@@ -14218,16 +12032,14 @@ var require_short = __commonJS({
if (conf.beta) beta = new BN(conf.beta, 16).toRed(this.red);
else {
var betas = this._getEndoRoots(this.p);
- (beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]),
- (beta = beta.toRed(this.red));
+ (beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]), (beta = beta.toRed(this.red));
}
if (conf.lambda) lambda = new BN(conf.lambda, 16);
else {
var lambdas = this._getEndoRoots(this.n);
this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0
? (lambda = lambdas[0])
- : ((lambda = lambdas[1]),
- assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0));
+ : ((lambda = lambdas[1]), assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0));
}
var basis;
return (
@@ -14281,8 +12093,7 @@ var require_short = __commonJS({
var q = v.div(u);
(r = v.sub(q.mul(u))), (x = x2.sub(q.mul(x1)));
var y = y2.sub(q.mul(y1));
- if (!a1 && r.cmp(aprxSqrt) < 0)
- (a0 = prevR.neg()), (b0 = x1), (a1 = r.neg()), (b1 = x);
+ if (!a1 && r.cmp(aprxSqrt) < 0) (a0 = prevR.neg()), (b0 = x1), (a1 = r.neg()), (b1 = x);
else if (a1 && ++i === 2) break;
(prevR = r), (v = u), (u = r), (x2 = x1), (x1 = x), (y2 = y1), (y1 = y);
}
@@ -14317,13 +12128,9 @@ var require_short = __commonJS({
(x = new BN(x, 16)), x.red || (x = x.toRed(this.red));
var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b),
y = y2.redSqrt();
- if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
- throw new Error("invalid point");
+ if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error("invalid point");
var isOdd = y.fromRed().isOdd();
- return (
- ((odd && !isOdd) || (!odd && isOdd)) && (y = y.redNeg()),
- this.point(x, y)
- );
+ return ((odd && !isOdd) || (!odd && isOdd)) && (y = y.redNeg()), this.point(x, y);
};
ShortCurve.prototype.validate = function (point) {
if (point.inf) return !0;
@@ -14333,16 +12140,8 @@ var require_short = __commonJS({
rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
return y.redSqr().redISub(rhs).cmpn(0) === 0;
};
- ShortCurve.prototype._endoWnafMulAdd = function (
- points,
- coeffs,
- jacobianResult,
- ) {
- for (
- var npoints = this._endoWnafT1, ncoeffs = this._endoWnafT2, i = 0;
- i < points.length;
- i++
- ) {
+ ShortCurve.prototype._endoWnafMulAdd = function (points, coeffs, jacobianResult) {
+ for (var npoints = this._endoWnafT1, ncoeffs = this._endoWnafT2, i = 0; i < points.length; i++) {
var split = this._endoSplit(coeffs[i]),
p = points[i],
beta = p._getBeta();
@@ -14353,12 +12152,7 @@ var require_short = __commonJS({
(ncoeffs[i * 2] = split.k1),
(ncoeffs[i * 2 + 1] = split.k2);
}
- for (
- var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult),
- j = 0;
- j < i * 2;
- j++
- )
+ for (var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult), j = 0; j < i * 2; j++)
(npoints[j] = null), (ncoeffs[j] = null);
return res;
};
@@ -14368,9 +12162,7 @@ var require_short = __commonJS({
? ((this.x = null), (this.y = null), (this.inf = !0))
: ((this.x = new BN(x, 16)),
(this.y = new BN(y, 16)),
- isRed &&
- (this.x.forceRed(this.curve.red),
- this.y.forceRed(this.curve.red)),
+ isRed && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)),
this.x.red || (this.x = this.x.toRed(this.curve.red)),
this.y.red || (this.y = this.y.toRed(this.curve.red)),
(this.inf = !1));
@@ -14386,10 +12178,7 @@ var require_short = __commonJS({
if (!!this.curve.endo) {
var pre = this.precomputed;
if (pre && pre.beta) return pre.beta;
- var beta = this.curve.point(
- this.x.redMul(this.curve.endo.beta),
- this.y,
- );
+ var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
if (pre) {
var curve = this.curve,
endoMul = function (p) {
@@ -14455,11 +12244,7 @@ var require_short = __commonJS({
Point.prototype.inspect = function () {
return this.isInfinity()
? "<EC Point Infinity>"
- : "<EC Point x: " +
- this.x.fromRed().toString(16, 2) +
- " y: " +
- this.y.fromRed().toString(16, 2) +
- ">";
+ : "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + ">";
};
Point.prototype.isInfinity = function () {
return this.inf;
@@ -14521,11 +12306,7 @@ var require_short = __commonJS({
: this.curve._wnafMulAdd(1, points, coeffs, 2, !0);
};
Point.prototype.eq = function (p) {
- return (
- this === p ||
- (this.inf === p.inf &&
- (this.inf || (this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0)))
- );
+ return this === p || (this.inf === p.inf && (this.inf || (this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0)));
};
Point.prototype.neg = function (_precompute) {
if (this.inf) return this;
@@ -14556,12 +12337,8 @@ var require_short = __commonJS({
function JPoint(curve, x, y, z) {
Base.BasePoint.call(this, curve, "jacobian"),
x === null && y === null && z === null
- ? ((this.x = this.curve.one),
- (this.y = this.curve.one),
- (this.z = new BN(0)))
- : ((this.x = new BN(x, 16)),
- (this.y = new BN(y, 16)),
- (this.z = new BN(z, 16))),
+ ? ((this.x = this.curve.one), (this.y = this.curve.one), (this.z = new BN(0)))
+ : ((this.x = new BN(x, 16)), (this.y = new BN(y, 16)), (this.z = new BN(z, 16))),
this.x.red || (this.x = this.x.toRed(this.curve.red)),
this.y.red || (this.y = this.y.toRed(this.curve.red)),
this.z.red || (this.z = this.z.toRed(this.curve.red)),
@@ -14593,10 +12370,7 @@ var require_short = __commonJS({
s2 = p.y.redMul(z2.redMul(this.z)),
h = u1.redSub(u2),
r = s1.redSub(s2);
- if (h.cmpn(0) === 0)
- return r.cmpn(0) !== 0
- ? this.curve.jpoint(null, null, null)
- : this.dbl();
+ if (h.cmpn(0) === 0) return r.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl();
var h2 = h.redSqr(),
h3 = h2.redMul(h),
v = u1.redMul(h2),
@@ -14615,10 +12389,7 @@ var require_short = __commonJS({
s2 = p.y.redMul(z2).redMul(this.z),
h = u1.redSub(u2),
r = s1.redSub(s2);
- if (h.cmpn(0) === 0)
- return r.cmpn(0) !== 0
- ? this.curve.jpoint(null, null, null)
- : this.dbl();
+ if (h.cmpn(0) === 0) return r.cmpn(0) !== 0 ? this.curve.jpoint(null, null, null) : this.dbl();
var h2 = h.redSqr(),
h3 = h2.redMul(h),
v = u1.redMul(h2),
@@ -14655,10 +12426,7 @@ var require_short = __commonJS({
dny = c.redMul(t2);
dny = dny.redIAdd(dny).redISub(jyd4);
var nz = jyd.redMul(jz);
- i + 1 < pow && (jz4 = jz4.redMul(jyd4)),
- (jx = nx),
- (jz = nz),
- (jyd = dny);
+ i + 1 < pow && (jz4 = jz4.redMul(jyd4)), (jx = nx), (jz = nz), (jyd = dny);
}
return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
};
@@ -14730,8 +12498,7 @@ var require_short = __commonJS({
var beta4 = beta.redIAdd(beta);
beta4 = beta4.redIAdd(beta4);
var beta8 = beta4.redAdd(beta4);
- (nx = alpha.redSqr().redISub(beta8)),
- (nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta));
+ (nx = alpha.redSqr().redISub(beta8)), (nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta));
var ggamma8 = gamma.redSqr();
(ggamma8 = ggamma8.redIAdd(ggamma8)),
(ggamma8 = ggamma8.redIAdd(ggamma8)),
@@ -14755,9 +12522,7 @@ var require_short = __commonJS({
nx = c.redSqr().redISub(t1.redAdd(t1)),
t2 = t1.redISub(nx),
jyd8 = jy2.redSqr();
- (jyd8 = jyd8.redIAdd(jyd8)),
- (jyd8 = jyd8.redIAdd(jyd8)),
- (jyd8 = jyd8.redIAdd(jyd8));
+ (jyd8 = jyd8.redIAdd(jyd8)), (jyd8 = jyd8.redIAdd(jyd8)), (jyd8 = jyd8.redIAdd(jyd8));
var ny = c.redMul(t2).redISub(jyd8),
nz = jy.redAdd(jy).redMul(jz);
return this.curve.jpoint(nx, ny, nz);
@@ -14878,11 +12643,7 @@ var require_mont = __commonJS({
Point.prototype.inspect = function () {
return this.isInfinity()
? "<EC Point Infinity>"
- : "<EC Point x: " +
- this.x.fromRed().toString(16, 2) +
- " z: " +
- this.z.fromRed().toString(16, 2) +
- ">";
+ : "<EC Point x: " + this.x.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
};
Point.prototype.isInfinity = function () {
return this.z.cmpn(0) === 0;
@@ -14913,19 +12674,13 @@ var require_mont = __commonJS({
};
Point.prototype.mul = function (k) {
for (
- var t = k.clone(),
- a = this,
- b = this.curve.point(null, null),
- c = this,
- bits = [];
+ var t = k.clone(), a = this, b = this.curve.point(null, null), c = this, bits = [];
t.cmpn(0) !== 0;
t.iushrn(1)
)
bits.push(t.andln(1));
for (var i = bits.length - 1; i >= 0; i--)
- bits[i] === 0
- ? ((a = a.diffAdd(b, c)), (b = b.dbl()))
- : ((b = a.diffAdd(b, c)), (a = a.dbl()));
+ bits[i] === 0 ? ((a = a.diffAdd(b, c)), (b = b.dbl())) : ((b = a.diffAdd(b, c)), (a = a.dbl()));
return b;
};
Point.prototype.mulAdd = function () {
@@ -14938,11 +12693,7 @@ var require_mont = __commonJS({
return this.getX().cmp(other.getX()) === 0;
};
Point.prototype.normalize = function () {
- return (
- (this.x = this.x.redMul(this.z.redInvm())),
- (this.z = this.curve.one),
- this
- );
+ return (this.x = this.x.redMul(this.z.redInvm())), (this.z = this.curve.one), this;
};
Point.prototype.getX = function () {
return this.normalize(), this.x.fromRed();
@@ -14991,13 +12742,9 @@ var require_edwards = __commonJS({
lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)),
y2 = rhs.redMul(lhs.redInvm()),
y = y2.redSqrt();
- if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
- throw new Error("invalid point");
+ if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error("invalid point");
var isOdd = y.fromRed().isOdd();
- return (
- ((odd && !isOdd) || (!odd && isOdd)) && (y = y.redNeg()),
- this.point(x, y)
- );
+ return ((odd && !isOdd) || (!odd && isOdd)) && (y = y.redNeg()), this.point(x, y);
};
EdwardsCurve.prototype.pointFromY = function (y, odd) {
(y = new BN(y, 16)), y.red || (y = y.toRed(this.red));
@@ -15010,8 +12757,7 @@ var require_edwards = __commonJS({
return this.point(this.zero, y);
}
var x = x2.redSqrt();
- if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
- throw new Error("invalid point");
+ if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) throw new Error("invalid point");
return x.fromRed().isOdd() !== odd && (x = x.redNeg()), this.point(x, y);
};
EdwardsCurve.prototype.validate = function (point) {
@@ -15042,8 +12788,7 @@ var require_edwards = __commonJS({
(this.zOne = this.z === this.curve.one),
this.curve.extended &&
!this.t &&
- ((this.t = this.x.redMul(this.y)),
- this.zOne || (this.t = this.t.redMul(this.z.redInvm()))));
+ ((this.t = this.x.redMul(this.y)), this.zOne || (this.t = this.t.redMul(this.z.redInvm()))));
}
inherits(Point, Base.BasePoint);
EdwardsCurve.prototype.pointFromJSON = function (obj) {
@@ -15067,11 +12812,7 @@ var require_edwards = __commonJS({
">";
};
Point.prototype.isInfinity = function () {
- return (
- this.x.cmpn(0) === 0 &&
- (this.y.cmp(this.z) === 0 ||
- (this.zOne && this.y.cmp(this.curve.c) === 0))
- );
+ return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || (this.zOne && this.y.cmp(this.curve.c) === 0));
};
Point.prototype._extDbl = function () {
var a = this.x.redSqr(),
@@ -15121,11 +12862,7 @@ var require_edwards = __commonJS({
return this.curve.point(nx, ny, nz);
};
Point.prototype.dbl = function () {
- return this.isInfinity()
- ? this
- : this.curve.extended
- ? this._extDbl()
- : this._projDbl();
+ return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl();
};
Point.prototype._extAdd = function (p) {
var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)),
@@ -15150,36 +12887,22 @@ var require_edwards = __commonJS({
e = this.curve.d.redMul(c).redMul(d),
f = b.redSub(e),
g = b.redAdd(e),
- tmp = this.x
- .redAdd(this.y)
- .redMul(p.x.redAdd(p.y))
- .redISub(c)
- .redISub(d),
+ tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d),
nx = a.redMul(f).redMul(tmp),
ny,
nz;
return (
this.curve.twisted
- ? ((ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)))),
- (nz = f.redMul(g)))
- : ((ny = a.redMul(g).redMul(d.redSub(c))),
- (nz = this.curve._mulC(f).redMul(g))),
+ ? ((ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)))), (nz = f.redMul(g)))
+ : ((ny = a.redMul(g).redMul(d.redSub(c))), (nz = this.curve._mulC(f).redMul(g))),
this.curve.point(nx, ny, nz)
);
};
Point.prototype.add = function (p) {
- return this.isInfinity()
- ? p
- : p.isInfinity()
- ? this
- : this.curve.extended
- ? this._extAdd(p)
- : this._projAdd(p);
+ return this.isInfinity() ? p : p.isInfinity() ? this : this.curve.extended ? this._extAdd(p) : this._projAdd(p);
};
Point.prototype.mul = function (k) {
- return this._hasDoubles(k)
- ? this.curve._fixedNafMul(this, k)
- : this.curve._wnafMul(this, k);
+ return this._hasDoubles(k) ? this.curve._fixedNafMul(this, k) : this.curve._wnafMul(this, k);
};
Point.prototype.mulAdd = function (k1, p, k2) {
return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, !1);
@@ -15200,12 +12923,7 @@ var require_edwards = __commonJS({
);
};
Point.prototype.neg = function () {
- return this.curve.point(
- this.x.redNeg(),
- this.y,
- this.z,
- this.t && this.t.redNeg(),
- );
+ return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());
};
Point.prototype.getX = function () {
return this.normalize(), this.x.fromRed();
@@ -15214,11 +12932,7 @@ var require_edwards = __commonJS({
return this.normalize(), this.y.fromRed();
};
Point.prototype.eq = function (other) {
- return (
- this === other ||
- (this.getX().cmp(other.getX()) === 0 &&
- this.getY().cmp(other.getY()) === 0)
- );
+ return this === other || (this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0);
};
Point.prototype.eqXToP = function (x) {
var rx = x.toRed(this.curve.red).redMul(this.z);
@@ -15253,9 +12967,7 @@ var require_utils4 = __commonJS({
inherits = require_inherits_browser();
exports.inherits = inherits;
function isSurrogatePair(msg, i) {
- return (msg.charCodeAt(i) & 64512) !== 55296 ||
- i < 0 ||
- i + 1 >= msg.length
+ return (msg.charCodeAt(i) & 64512) !== 55296 || i < 0 || i + 1 >= msg.length
? !1
: (msg.charCodeAt(i + 1) & 64512) === 56320;
}
@@ -15267,9 +12979,7 @@ var require_utils4 = __commonJS({
if (enc) {
if (enc === "hex")
for (
- msg = msg.replace(/[^a-z0-9]+/gi, ""),
- msg.length % 2 !== 0 && (msg = "0" + msg),
- i = 0;
+ msg = msg.replace(/[^a-z0-9]+/gi, ""), msg.length % 2 !== 0 && (msg = "0" + msg), i = 0;
i < msg.length;
i += 2
)
@@ -15282,32 +12992,24 @@ var require_utils4 = __commonJS({
: c < 2048
? ((res[p++] = (c >> 6) | 192), (res[p++] = (c & 63) | 128))
: isSurrogatePair(msg, i)
- ? ((c =
- 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023)),
+ ? ((c = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023)),
(res[p++] = (c >> 18) | 240),
(res[p++] = ((c >> 12) & 63) | 128),
(res[p++] = ((c >> 6) & 63) | 128),
(res[p++] = (c & 63) | 128))
- : ((res[p++] = (c >> 12) | 224),
- (res[p++] = ((c >> 6) & 63) | 128),
- (res[p++] = (c & 63) | 128));
+ : ((res[p++] = (c >> 12) | 224), (res[p++] = ((c >> 6) & 63) | 128), (res[p++] = (c & 63) | 128));
}
else for (i = 0; i < msg.length; i++) res[i] = msg[i] | 0;
return res;
}
exports.toArray = toArray;
function toHex(msg) {
- for (var res = "", i = 0; i < msg.length; i++)
- res += zero2(msg[i].toString(16));
+ for (var res = "", i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16));
return res;
}
exports.toHex = toHex;
function htonl(w) {
- var res =
- (w >>> 24) |
- ((w >>> 8) & 65280) |
- ((w << 8) & 16711680) |
- ((w & 255) << 24);
+ var res = (w >>> 24) | ((w >>> 8) & 65280) | ((w << 8) & 16711680) | ((w & 255) << 24);
return res >>> 0;
}
exports.htonl = htonl;
@@ -15344,34 +13046,18 @@ var require_utils4 = __commonJS({
function join32(msg, start, end, endian) {
var len = end - start;
assert(len % 4 === 0);
- for (
- var res = new Array(len / 4), i = 0, k = start;
- i < res.length;
- i++, k += 4
- ) {
+ for (var res = new Array(len / 4), i = 0, k = start; i < res.length; i++, k += 4) {
var w;
endian === "big"
- ? (w =
- (msg[k] << 24) |
- (msg[k + 1] << 16) |
- (msg[k + 2] << 8) |
- msg[k + 3])
- : (w =
- (msg[k + 3] << 24) |
- (msg[k + 2] << 16) |
- (msg[k + 1] << 8) |
- msg[k]),
+ ? (w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3])
+ : (w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]),
(res[i] = w >>> 0);
}
return res;
}
exports.join32 = join32;
function split32(msg, endian) {
- for (
- var res = new Array(msg.length * 4), i = 0, k = 0;
- i < msg.length;
- i++, k += 4
- ) {
+ for (var res = new Array(msg.length * 4), i = 0, k = 0; i < msg.length; i++, k += 4) {
var m = msg[i];
endian === "big"
? ((res[k] = m >>> 24),
@@ -15510,9 +13196,7 @@ var require_common = __commonJS({
BlockHash.prototype.update = function (msg, enc) {
if (
((msg = utils.toArray(msg, enc)),
- this.pending
- ? (this.pending = this.pending.concat(msg))
- : (this.pending = msg),
+ this.pending ? (this.pending = this.pending.concat(msg)) : (this.pending = msg),
(this.pendingTotal += msg.length),
this.pending.length >= this._delta8)
) {
@@ -15521,17 +13205,12 @@ var require_common = __commonJS({
(this.pending = msg.slice(msg.length - r, msg.length)),
this.pending.length === 0 && (this.pending = null),
(msg = utils.join32(msg, 0, msg.length - r, this.endian));
- for (var i = 0; i < msg.length; i += this._delta32)
- this._update(msg, i, i + this._delta32);
+ for (var i = 0; i < msg.length; i += this._delta32) this._update(msg, i, i + this._delta32);
}
return this;
};
BlockHash.prototype.digest = function (enc) {
- return (
- this.update(this._pad()),
- assert(this.pending === null),
- this._digest(enc)
- );
+ return this.update(this._pad()), assert(this.pending === null), this._digest(enc);
};
BlockHash.prototype._pad = function () {
var len = this.pendingTotal,
@@ -15640,8 +13319,7 @@ var require__ = __commonJS({
SHA1.padLength = 64;
SHA1.prototype._update = function (msg, start) {
for (var W = this.W, i = 0; i < 16; i++) W[i] = msg[start + i];
- for (; i < W.length; i++)
- W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
+ for (; i < W.length; i++) W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
var a = this.h[0],
b = this.h[1],
c = this.h[2],
@@ -15659,9 +13337,7 @@ var require__ = __commonJS({
(this.h[4] = sum32(this.h[4], e));
};
SHA1.prototype._digest = function (enc) {
- return enc === "hex"
- ? utils.toHex32(this.h, "big")
- : utils.split32(this.h, "big");
+ return enc === "hex" ? utils.toHex32(this.h, "big") : utils.split32(this.h, "big");
};
},
});
@@ -15685,25 +13361,19 @@ var require__2 = __commonJS({
g1_256 = shaCommon.g1_256,
BlockHash = common.BlockHash,
sha256_K = [
- 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993,
- 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987,
- 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774,
- 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986,
- 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711,
- 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,
- 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411,
- 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344,
- 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,
- 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424,
- 2428436474, 2756734187, 3204031479, 3329325298,
+ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080,
+ 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774,
+ 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808,
+ 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291,
+ 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817,
+ 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218,
+ 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479,
+ 3329325298,
];
function SHA256() {
if (!(this instanceof SHA256)) return new SHA256();
BlockHash.call(this),
- (this.h = [
- 1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
- 2600822924, 528734635, 1541459225,
- ]),
+ (this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]),
(this.k = sha256_K),
(this.W = new Array(64));
}
@@ -15715,13 +13385,7 @@ var require__2 = __commonJS({
SHA256.padLength = 64;
SHA256.prototype._update = function (msg, start) {
for (var W = this.W, i = 0; i < 16; i++) W[i] = msg[start + i];
- for (; i < W.length; i++)
- W[i] = sum32_4(
- g1_256(W[i - 2]),
- W[i - 7],
- g0_256(W[i - 15]),
- W[i - 16],
- );
+ for (; i < W.length; i++) W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
var a = this.h[0],
b = this.h[1],
c = this.h[2],
@@ -15733,14 +13397,7 @@ var require__2 = __commonJS({
for (assert(this.k.length === W.length), i = 0; i < W.length; i++) {
var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]),
T2 = sum32(s0_256(a), maj32(a, b, c));
- (h = g),
- (g = f),
- (f = e),
- (e = sum32(d, T1)),
- (d = c),
- (c = b),
- (b = a),
- (a = sum32(T1, T2));
+ (h = g), (g = f), (f = e), (e = sum32(d, T1)), (d = c), (c = b), (b = a), (a = sum32(T1, T2));
}
(this.h[0] = sum32(this.h[0], a)),
(this.h[1] = sum32(this.h[1], b)),
@@ -15752,9 +13409,7 @@ var require__2 = __commonJS({
(this.h[7] = sum32(this.h[7], h));
};
SHA256.prototype._digest = function (enc) {
- return enc === "hex"
- ? utils.toHex32(this.h, "big")
- : utils.split32(this.h, "big");
+ return enc === "hex" ? utils.toHex32(this.h, "big") : utils.split32(this.h, "big");
};
},
});
@@ -15768,10 +13423,7 @@ var require__3 = __commonJS({
function SHA224() {
if (!(this instanceof SHA224)) return new SHA224();
SHA256.call(this),
- (this.h = [
- 3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025,
- 1694076839, 3204075428,
- ]);
+ (this.h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428]);
}
utils.inherits(SHA224, SHA256);
module.exports = SHA224;
@@ -15780,9 +13432,7 @@ var require__3 = __commonJS({
SHA224.hmacStrength = 192;
SHA224.padLength = 64;
SHA224.prototype._digest = function (enc) {
- return enc === "hex"
- ? utils.toHex32(this.h.slice(0, 7), "big")
- : utils.split32(this.h.slice(0, 7), "big");
+ return enc === "hex" ? utils.toHex32(this.h.slice(0, 7), "big") : utils.split32(this.h.slice(0, 7), "big");
};
},
});
@@ -15807,41 +13457,31 @@ var require__4 = __commonJS({
sum64_5_lo = utils.sum64_5_lo,
BlockHash = common.BlockHash,
sha512_K = [
- 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399,
- 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265,
- 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394,
- 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994,
- 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317,
- 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139,
- 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901,
- 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837,
- 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879,
- 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901,
- 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964,
- 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823,
- 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142,
- 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273,
- 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344,
- 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720,
- 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593,
- 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403,
- 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012,
- 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044,
- 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573,
- 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711,
- 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554,
- 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315,
- 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100,
- 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866,
- 1607167915, 987167468, 1816402316, 1246189591,
+ 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163,
+ 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394,
+ 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206,
+ 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139,
+ 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692,
+ 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879,
+ 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895,
+ 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823,
+ 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921,
+ 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344,
+ 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616,
+ 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403,
+ 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452,
+ 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573,
+ 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271,
+ 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315,
+ 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470,
+ 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591,
];
function SHA512() {
if (!(this instanceof SHA512)) return new SHA512();
BlockHash.call(this),
(this.h = [
- 1779033703, 4089235720, 3144134277, 2227873595, 1013904242,
- 4271175723, 2773480762, 1595750129, 1359893119, 2917565137,
- 2600822924, 725511199, 528734635, 4215389547, 1541459225, 327033209,
+ 1779033703, 4089235720, 3144134277, 2227873595, 1013904242, 4271175723, 2773480762, 1595750129, 1359893119,
+ 2917565137, 2600822924, 725511199, 528734635, 4215389547, 1541459225, 327033209,
]),
(this.k = sha512_K),
(this.W = new Array(160));
@@ -15863,26 +13503,8 @@ var require__4 = __commonJS({
c2_lo = g0_512_lo(W[i - 30], W[i - 29]),
c3_hi = W[i - 32],
c3_lo = W[i - 31];
- (W[i] = sum64_4_hi(
- c0_hi,
- c0_lo,
- c1_hi,
- c1_lo,
- c2_hi,
- c2_lo,
- c3_hi,
- c3_lo,
- )),
- (W[i + 1] = sum64_4_lo(
- c0_hi,
- c0_lo,
- c1_hi,
- c1_lo,
- c2_hi,
- c2_lo,
- c3_hi,
- c3_lo,
- ));
+ (W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo)),
+ (W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo));
}
};
SHA512.prototype._update = function (msg, start) {
@@ -15916,30 +13538,8 @@ var require__4 = __commonJS({
c3_lo = this.k[i + 1],
c4_hi = W[i],
c4_lo = W[i + 1],
- T1_hi = sum64_5_hi(
- c0_hi,
- c0_lo,
- c1_hi,
- c1_lo,
- c2_hi,
- c2_lo,
- c3_hi,
- c3_lo,
- c4_hi,
- c4_lo,
- ),
- T1_lo = sum64_5_lo(
- c0_hi,
- c0_lo,
- c1_hi,
- c1_lo,
- c2_hi,
- c2_lo,
- c3_hi,
- c3_lo,
- c4_hi,
- c4_lo,
- );
+ T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo),
+ T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);
(c0_hi = s0_512_hi(ah, al)),
(c0_lo = s0_512_lo(ah, al)),
(c1_hi = maj64_hi(ah, al, bh, bl, ch, cl)),
@@ -15973,9 +13573,7 @@ var require__4 = __commonJS({
sum64(this.h, 14, hh, hl);
};
SHA512.prototype._digest = function (enc) {
- return enc === "hex"
- ? utils.toHex32(this.h, "big")
- : utils.split32(this.h, "big");
+ return enc === "hex" ? utils.toHex32(this.h, "big") : utils.split32(this.h, "big");
};
function ch64_hi(xh, xl, yh, yl, zh) {
var r = (xh & yh) ^ (~xh & zh);
@@ -16062,9 +13660,8 @@ var require__5 = __commonJS({
if (!(this instanceof SHA384)) return new SHA384();
SHA512.call(this),
(this.h = [
- 3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999,
- 355462360, 4144912697, 1731405415, 4290775857, 2394180231, 1750603025,
- 3675008525, 1694076839, 1203062813, 3204075428,
+ 3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999, 355462360, 4144912697, 1731405415,
+ 4290775857, 2394180231, 1750603025, 3675008525, 1694076839, 1203062813, 3204075428,
]);
}
utils.inherits(SHA384, SHA512);
@@ -16074,9 +13671,7 @@ var require__5 = __commonJS({
SHA384.hmacStrength = 192;
SHA384.padLength = 128;
SHA384.prototype._digest = function (enc) {
- return enc === "hex"
- ? utils.toHex32(this.h.slice(0, 12), "big")
- : utils.split32(this.h.slice(0, 12), "big");
+ return enc === "hex" ? utils.toHex32(this.h.slice(0, 12), "big") : utils.split32(this.h.slice(0, 12), "big");
};
},
});
@@ -16132,22 +13727,13 @@ var require_ripemd = __commonJS({
j < 80;
j++
) {
- var T = sum32(
- rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]),
- E,
- );
+ var T = sum32(rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E);
(A = E),
(E = D),
(D = rotl32(C, 10)),
(C = B),
(B = T),
- (T = sum32(
- rotl32(
- sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
- sh[j],
- ),
- Eh,
- )),
+ (T = sum32(rotl32(sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh)),
(Ah = Eh),
(Eh = Dh),
(Dh = rotl32(Ch, 10)),
@@ -16162,9 +13748,7 @@ var require_ripemd = __commonJS({
(this.h[0] = T);
};
RIPEMD160.prototype._digest = function (enc) {
- return enc === "hex"
- ? utils.toHex32(this.h, "little")
- : utils.split32(this.h, "little");
+ return enc === "hex" ? utils.toHex32(this.h, "little") : utils.split32(this.h, "little");
};
function f(j, x, y, z) {
return j <= 15
@@ -16178,50 +13762,30 @@ var require_ripemd = __commonJS({
: x ^ (y | ~z);
}
function K(j) {
- return j <= 15
- ? 0
- : j <= 31
- ? 1518500249
- : j <= 47
- ? 1859775393
- : j <= 63
- ? 2400959708
- : 2840853838;
+ return j <= 15 ? 0 : j <= 31 ? 1518500249 : j <= 47 ? 1859775393 : j <= 63 ? 2400959708 : 2840853838;
}
function Kh(j) {
- return j <= 15
- ? 1352829926
- : j <= 31
- ? 1548603684
- : j <= 47
- ? 1836072691
- : j <= 63
- ? 2053994217
- : 0;
+ return j <= 15 ? 1352829926 : j <= 31 ? 1548603684 : j <= 47 ? 1836072691 : j <= 63 ? 2053994217 : 0;
}
var r = [
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10,
- 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0,
- 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
- 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3,
+ 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0,
+ 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13,
],
rh = [
- 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0,
- 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8,
- 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10,
- 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11,
+ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15,
+ 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15,
+ 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11,
],
s = [
- 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11,
- 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14,
- 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6,
- 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6,
+ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
+ 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
+ 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6,
],
sh = [
- 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7,
- 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12,
- 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12,
- 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11,
+ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
+ 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
+ 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11,
];
},
});
@@ -16243,13 +13807,10 @@ var require_hmac = __commonJS({
}
module.exports = Hmac;
Hmac.prototype._init = function (key) {
- key.length > this.blockSize &&
- (key = new this.Hash().update(key).digest()),
- assert(key.length <= this.blockSize);
+ key.length > this.blockSize && (key = new this.Hash().update(key).digest()), assert(key.length <= this.blockSize);
for (var i = key.length; i < this.blockSize; i++) key.push(0);
for (i = 0; i < key.length; i++) key[i] ^= 54;
- for (this.inner = new this.Hash().update(key), i = 0; i < key.length; i++)
- key[i] ^= 106;
+ for (this.inner = new this.Hash().update(key), i = 0; i < key.length; i++) key[i] ^= 106;
this.outer = new this.Hash().update(key);
};
Hmac.prototype.update = function (msg, enc) {
@@ -16281,10 +13842,7 @@ var require_hash2 = __commonJS({
// node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js
var require_secp256k1 = __commonJS({
- "node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js"(
- exports,
- module,
- ) {
+ "node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js"(exports, module) {
module.exports = {
doubles: {
step: 4,
@@ -17219,8 +14777,7 @@ var require_curves = __commonJS({
h: "1",
hash: hash.sha256,
beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",
- lambda:
- "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",
+ lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",
basis: [
{
a: "3086d221a7d46bcde86c90e49284eb15",
@@ -17261,21 +14818,15 @@ var require_hmac_drbg = __commonJS({
var entropy = utils.toArray(options.entropy, options.entropyEnc || "hex"),
nonce = utils.toArray(options.nonce, options.nonceEnc || "hex"),
pers = utils.toArray(options.pers, options.persEnc || "hex");
- assert(
- entropy.length >= this.minEntropy / 8,
- "Not enough entropy. Minimum is: " + this.minEntropy + " bits",
- ),
+ assert(entropy.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"),
this._init(entropy, nonce, pers);
}
module.exports = HmacDRBG;
HmacDRBG.prototype._init = function (entropy, nonce, pers) {
var seed = entropy.concat(nonce).concat(pers);
- (this.K = new Array(this.outLen / 8)),
- (this.V = new Array(this.outLen / 8));
+ (this.K = new Array(this.outLen / 8)), (this.V = new Array(this.outLen / 8));
for (var i = 0; i < this.V.length; i++) (this.K[i] = 0), (this.V[i] = 1);
- this._update(seed),
- (this._reseed = 1),
- (this.reseedInterval = 281474976710656);
+ this._update(seed), (this._reseed = 1), (this.reseedInterval = 281474976710656);
};
HmacDRBG.prototype._hmac = function () {
return new hash.hmac(this.hash, this.K);
@@ -17286,33 +14837,23 @@ var require_hmac_drbg = __commonJS({
(this.K = kmac.digest()),
(this.V = this._hmac().update(this.V).digest()),
seed &&
- ((this.K = this._hmac()
- .update(this.V)
- .update([1])
- .update(seed)
- .digest()),
+ ((this.K = this._hmac().update(this.V).update([1]).update(seed).digest()),
(this.V = this._hmac().update(this.V).digest()));
};
HmacDRBG.prototype.reseed = function (entropy, entropyEnc, add, addEnc) {
- typeof entropyEnc != "string" &&
- ((addEnc = add), (add = entropyEnc), (entropyEnc = null)),
+ typeof entropyEnc != "string" && ((addEnc = add), (add = entropyEnc), (entropyEnc = null)),
(entropy = utils.toArray(entropy, entropyEnc)),
(add = utils.toArray(add, addEnc)),
- assert(
- entropy.length >= this.minEntropy / 8,
- "Not enough entropy. Minimum is: " + this.minEntropy + " bits",
- ),
+ assert(entropy.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"),
this._update(entropy.concat(add || [])),
(this._reseed = 1);
};
HmacDRBG.prototype.generate = function (len, enc, add, addEnc) {
- if (this._reseed > this.reseedInterval)
- throw new Error("Reseed is required");
+ if (this._reseed > this.reseedInterval) throw new Error("Reseed is required");
typeof enc != "string" && ((addEnc = add), (add = enc), (enc = null)),
add && ((add = utils.toArray(add, addEnc || "hex")), this._update(add));
for (var temp = []; temp.length < len; )
- (this.V = this._hmac().update(this.V).digest()),
- (temp = temp.concat(this.V));
+ (this.V = this._hmac().update(this.V).digest()), (temp = temp.concat(this.V));
var res = temp.slice(0, len);
return this._update(add), this._reseed++, utils.encode(res, enc);
};
@@ -17371,15 +14912,13 @@ var require_key = __commonJS({
return enc === "hex" ? this.priv.toString(16, 2) : this.priv;
};
KeyPair.prototype._importPrivate = function (key, enc) {
- (this.priv = new BN(key, enc || 16)),
- (this.priv = this.priv.umod(this.ec.curve.n));
+ (this.priv = new BN(key, enc || 16)), (this.priv = this.priv.umod(this.ec.curve.n));
};
KeyPair.prototype._importPublic = function (key, enc) {
if (key.x || key.y) {
this.ec.curve.type === "mont"
? assert(key.x, "Need x coordinate")
- : (this.ec.curve.type === "short" ||
- this.ec.curve.type === "edwards") &&
+ : (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") &&
assert(key.x && key.y, "Need both x and y coordinate"),
(this.pub = this.ec.curve.point(key.x, key.y));
return;
@@ -17387,10 +14926,7 @@ var require_key = __commonJS({
this.pub = this.ec.curve.decodePoint(key, enc);
};
KeyPair.prototype.derive = function (pub) {
- return (
- pub.validate() || assert(pub.validate(), "public point not validated"),
- pub.mul(this.priv).getX()
- );
+ return pub.validate() || assert(pub.validate(), "public point not validated"), pub.mul(this.priv).getX();
};
KeyPair.prototype.sign = function (msg, enc, options) {
return this.ec.sign(msg, this, enc, options);
@@ -17400,11 +14936,7 @@ var require_key = __commonJS({
};
KeyPair.prototype.inspect = function () {
return (
- "<Key priv: " +
- (this.priv && this.priv.toString(16, 2)) +
- " pub: " +
- (this.pub && this.pub.inspect()) +
- " >"
+ "<Key priv: " + (this.priv && this.priv.toString(16, 2)) + " pub: " + (this.pub && this.pub.inspect()) + " >"
);
};
},
@@ -17423,9 +14955,7 @@ var require_signature = __commonJS({
(assert(options.r && options.s, "Signature without r or s"),
(this.r = new BN(options.r, 16)),
(this.s = new BN(options.s, 16)),
- options.recoveryParam === void 0
- ? (this.recoveryParam = null)
- : (this.recoveryParam = options.recoveryParam));
+ options.recoveryParam === void 0 ? (this.recoveryParam = null) : (this.recoveryParam = options.recoveryParam));
}
module.exports = Signature;
function Position() {
@@ -17436,17 +14966,11 @@ var require_signature = __commonJS({
if (!(initial & 128)) return initial;
var octetLen = initial & 15;
if (octetLen === 0 || octetLen > 4) return !1;
- for (var val = 0, i = 0, off = p.place; i < octetLen; i++, off++)
- (val <<= 8), (val |= buf[off]), (val >>>= 0);
+ for (var val = 0, i = 0, off = p.place; i < octetLen; i++, off++) (val <<= 8), (val |= buf[off]), (val >>>= 0);
return val <= 127 ? !1 : ((p.place = off), val);
}
function rmPadding(buf) {
- for (
- var i = 0, len = buf.length - 1;
- !buf[i] && !(buf[i + 1] & 128) && i < len;
-
- )
- i++;
+ for (var i = 0, len = buf.length - 1; !buf[i] && !(buf[i + 1] & 128) && i < len; ) i++;
return i === 0 ? buf : buf.slice(i);
}
Signature.prototype._importDER = function (data, enc) {
@@ -17454,8 +14978,7 @@ var require_signature = __commonJS({
var p = new Position();
if (data[p.place++] !== 48) return !1;
var len = getLength(data, p);
- if (len === !1 || len + p.place !== data.length || data[p.place++] !== 2)
- return !1;
+ if (len === !1 || len + p.place !== data.length || data[p.place++] !== 2) return !1;
var rlen = getLength(data, p);
if (rlen === !1) return !1;
var r = data.slice(p.place, rlen + p.place);
@@ -17469,12 +14992,7 @@ var require_signature = __commonJS({
if (s[0] === 0)
if (s[1] & 128) s = s.slice(1);
else return !1;
- return (
- (this.r = new BN(r)),
- (this.s = new BN(s)),
- (this.recoveryParam = null),
- !0
- );
+ return (this.r = new BN(r)), (this.s = new BN(s)), (this.recoveryParam = null), !0;
};
function constructLength(arr, len) {
if (len < 128) {
@@ -17482,34 +15000,23 @@ var require_signature = __commonJS({
return;
}
var octets = 1 + ((Math.log(len) / Math.LN2) >>> 3);
- for (arr.push(octets | 128); --octets; )
- arr.push((len >>> (octets << 3)) & 255);
+ for (arr.push(octets | 128); --octets; ) arr.push((len >>> (octets << 3)) & 255);
arr.push(len);
}
Signature.prototype.toDER = function (enc) {
var r = this.r.toArray(),
s = this.s.toArray();
for (
- r[0] & 128 && (r = [0].concat(r)),
- s[0] & 128 && (s = [0].concat(s)),
- r = rmPadding(r),
- s = rmPadding(s);
+ r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s)), r = rmPadding(r), s = rmPadding(s);
!s[0] && !(s[1] & 128);
)
s = s.slice(1);
var arr = [2];
- constructLength(arr, r.length),
- (arr = arr.concat(r)),
- arr.push(2),
- constructLength(arr, s.length);
+ constructLength(arr, r.length), (arr = arr.concat(r)), arr.push(2), constructLength(arr, s.length);
var backHalf = arr.concat(s),
res = [48];
- return (
- constructLength(res, backHalf.length),
- (res = res.concat(backHalf)),
- utils.encode(res, enc)
- );
+ return constructLength(res, backHalf.length), (res = res.concat(backHalf)), utils.encode(res, enc);
};
},
});
@@ -17529,10 +15036,7 @@ var require_ec = __commonJS({
function EC(options) {
if (!(this instanceof EC)) return new EC(options);
typeof options == "string" &&
- (assert(
- Object.prototype.hasOwnProperty.call(curves, options),
- "Unknown curve " + options,
- ),
+ (assert(Object.prototype.hasOwnProperty.call(curves, options), "Unknown curve " + options),
(options = curves[options])),
options instanceof curves.PresetCurve && (options = { curve: options }),
(this.curve = options.curve.curve),
@@ -17570,16 +15074,12 @@ var require_ec = __commonJS({
) {
var priv = new BN(drbg.generate(bytes));
- if (!(priv.cmp(ns2) > 0))
- return priv.iaddn(1), this.keyFromPrivate(priv);
+ if (!(priv.cmp(ns2) > 0)) return priv.iaddn(1), this.keyFromPrivate(priv);
}
};
EC.prototype._truncateToN = function (msg, truncOnly) {
var delta = msg.byteLength() * 8 - this.n.bitLength();
- return (
- delta > 0 && (msg = msg.ushrn(delta)),
- !truncOnly && msg.cmp(this.n) >= 0 ? msg.sub(this.n) : msg
- );
+ return delta > 0 && (msg = msg.ushrn(delta)), !truncOnly && msg.cmp(this.n) >= 0 ? msg.sub(this.n) : msg;
};
EC.prototype.sign = function (msg, key, enc, options) {
typeof enc == "object" && ((options = enc), (enc = null)),
@@ -17602,12 +15102,8 @@ var require_ec = __commonJS({
;
iter++
) {
- var k = options.k
- ? options.k(iter)
- : new BN(drbg.generate(this.n.byteLength()));
- if (
- ((k = this._truncateToN(k, !0)), !(k.cmpn(1) <= 0 || k.cmp(ns1) >= 0))
- ) {
+ var k = options.k ? options.k(iter) : new BN(drbg.generate(this.n.byteLength()));
+ if (((k = this._truncateToN(k, !0)), !(k.cmpn(1) <= 0 || k.cmp(ns1) >= 0))) {
var kp = this.g.mul(k);
if (!kp.isInfinity()) {
var kpX = kp.getX(),
@@ -17615,12 +15111,9 @@ var require_ec = __commonJS({
if (r.cmpn(0) !== 0) {
var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
if (((s = s.umod(this.n)), s.cmpn(0) !== 0)) {
- var recoveryParam =
- (kp.getY().isOdd() ? 1 : 0) | (kpX.cmp(r) !== 0 ? 2 : 0);
+ var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | (kpX.cmp(r) !== 0 ? 2 : 0);
return (
- options.canonical &&
- s.cmp(this.nh) > 0 &&
- ((s = this.n.sub(s)), (recoveryParam ^= 1)),
+ options.canonical && s.cmp(this.nh) > 0 && ((s = this.n.sub(s)), (recoveryParam ^= 1)),
new Signature({ r, s, recoveryParam })
);
}
@@ -17635,26 +15128,17 @@ var require_ec = __commonJS({
(signature = new Signature(signature, "hex"));
var r = signature.r,
s = signature.s;
- if (
- r.cmpn(1) < 0 ||
- r.cmp(this.n) >= 0 ||
- s.cmpn(1) < 0 ||
- s.cmp(this.n) >= 0
- )
- return !1;
+ if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0 || s.cmpn(1) < 0 || s.cmp(this.n) >= 0) return !1;
var sinv = s.invm(this.n),
u1 = sinv.mul(msg).umod(this.n),
u2 = sinv.mul(r).umod(this.n),
p;
return this.curve._maxwellTrick
- ? ((p = this.g.jmulAdd(u1, key.getPublic(), u2)),
- p.isInfinity() ? !1 : p.eqXToP(r))
- : ((p = this.g.mulAdd(u1, key.getPublic(), u2)),
- p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(r) === 0);
+ ? ((p = this.g.jmulAdd(u1, key.getPublic(), u2)), p.isInfinity() ? !1 : p.eqXToP(r))
+ : ((p = this.g.mulAdd(u1, key.getPublic(), u2)), p.isInfinity() ? !1 : p.getX().umod(this.n).cmp(r) === 0);
};
EC.prototype.recoverPubKey = function (msg, signature, j, enc) {
- assert((3 & j) === j, "The recovery param is more than two bits"),
- (signature = new Signature(signature, enc));
+ assert((3 & j) === j, "The recovery param is more than two bits"), (signature = new Signature(signature, enc));
var n = this.n,
e = new BN(msg),
r = signature.r,
@@ -17663,19 +15147,14 @@ var require_ec = __commonJS({
isSecondKey = j >> 1;
if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
throw new Error("Unable to find sencond key candinate");
- isSecondKey
- ? (r = this.curve.pointFromX(r.add(this.curve.n), isYOdd))
- : (r = this.curve.pointFromX(r, isYOdd));
+ isSecondKey ? (r = this.curve.pointFromX(r.add(this.curve.n), isYOdd)) : (r = this.curve.pointFromX(r, isYOdd));
var rInv = signature.r.invm(n),
s1 = n.sub(e).mul(rInv).umod(n),
s2 = s.mul(rInv).umod(n);
return this.g.mulAdd(s1, r, s2);
};
EC.prototype.getKeyRecoveryParam = function (e, signature, Q, enc) {
- if (
- ((signature = new Signature(signature, enc)),
- signature.recoveryParam !== null)
- )
+ if (((signature = new Signature(signature, enc)), signature.recoveryParam !== null))
return signature.recoveryParam;
for (var i = 0; i < 4; i++) {
var Qprime;
@@ -17702,17 +15181,13 @@ var require_key2 = __commonJS({
function KeyPair(eddsa, params) {
(this.eddsa = eddsa),
(this._secret = parseBytes(params.secret)),
- eddsa.isPoint(params.pub)
- ? (this._pub = params.pub)
- : (this._pubBytes = parseBytes(params.pub));
+ eddsa.isPoint(params.pub) ? (this._pub = params.pub) : (this._pubBytes = parseBytes(params.pub));
}
KeyPair.fromPublic = function (eddsa, pub) {
return pub instanceof KeyPair ? pub : new KeyPair(eddsa, { pub });
};
KeyPair.fromSecret = function (eddsa, secret) {
- return secret instanceof KeyPair
- ? secret
- : new KeyPair(eddsa, { secret });
+ return secret instanceof KeyPair ? secret : new KeyPair(eddsa, { secret });
};
KeyPair.prototype.secret = function () {
return this._secret;
@@ -17721,9 +15196,7 @@ var require_key2 = __commonJS({
return this.eddsa.encodePoint(this.pub());
});
cachedProperty(KeyPair, "pub", function () {
- return this._pubBytes
- ? this.eddsa.decodePoint(this._pubBytes)
- : this.eddsa.g.mul(this.priv());
+ return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv());
});
cachedProperty(KeyPair, "privBytes", function () {
var eddsa = this.eddsa,
@@ -17742,19 +15215,13 @@ var require_key2 = __commonJS({
return this.hash().slice(this.eddsa.encodingLength);
});
KeyPair.prototype.sign = function (message) {
- return (
- assert(this._secret, "KeyPair can only verify"),
- this.eddsa.sign(message, this)
- );
+ return assert(this._secret, "KeyPair can only verify"), this.eddsa.sign(message, this);
};
KeyPair.prototype.verify = function (message, sig) {
return this.eddsa.verify(message, sig, this);
};
KeyPair.prototype.getSecret = function (enc) {
- return (
- assert(this._secret, "KeyPair is public only"),
- utils.encode(this.secret(), enc)
- );
+ return assert(this._secret, "KeyPair is public only"), utils.encode(this.secret(), enc);
};
KeyPair.prototype.getPublic = function (enc) {
return utils.encode(this.pubBytes(), enc);
@@ -17820,10 +15287,7 @@ var require_eddsa = __commonJS({
KeyPair = require_key2(),
Signature = require_signature2();
function EDDSA(curve) {
- if (
- (assert(curve === "ed25519", "only tested with ed25519 so far"),
- !(this instanceof EDDSA))
- )
+ if ((assert(curve === "ed25519", "only tested with ed25519 so far"), !(this instanceof EDDSA)))
return new EDDSA(curve);
(curve = curves[curve].curve),
(this.curve = curve),
@@ -17853,8 +15317,7 @@ var require_eddsa = __commonJS({
return RplusAh.eq(SG);
};
EDDSA.prototype.hashInt = function () {
- for (var hash2 = this.hash(), i = 0; i < arguments.length; i++)
- hash2.update(arguments[i]);
+ for (var hash2 = this.hash(), i = 0; i < arguments.length; i++) hash2.update(arguments[i]);
return utils.intFromLE(hash2.digest()).umod(this.curve.n);
};
EDDSA.prototype.keyFromPublic = function (pub) {
@@ -17868,9 +15331,7 @@ var require_eddsa = __commonJS({
};
EDDSA.prototype.encodePoint = function (point) {
var enc = point.getY().toArray("le", this.encodingLength);
- return (
- (enc[this.encodingLength - 1] |= point.getX().isOdd() ? 128 : 0), enc
- );
+ return (enc[this.encodingLength - 1] |= point.getX().isOdd() ? 128 : 0), enc;
};
EDDSA.prototype.decodePoint = function (bytes) {
bytes = utils.parseBytes(bytes);
@@ -17932,9 +15393,7 @@ var require_bn5 = __commonJS({
((base === "le" || base === "be") && ((endian = base), (base = 10)),
this._init(number || 0, base || 10, endian || "be"));
}
- typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN),
- (BN.BN = BN),
- (BN.wordSize = 26);
+ typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN), (BN.BN = BN), (BN.wordSize = 26);
var Buffer2;
try {
typeof window < "u" && typeof window.Buffer < "u"
@@ -17956,10 +15415,8 @@ var require_bn5 = __commonJS({
return left.cmp(right) < 0 ? left : right;
}),
(BN.prototype._init = function (number, base, endian) {
- if (typeof number == "number")
- return this._initNumber(number, base, endian);
- if (typeof number == "object")
- return this._initArray(number, base, endian);
+ if (typeof number == "number") return this._initNumber(number, base, endian);
+ if (typeof number == "object") return this._initArray(number, base, endian);
base === "hex" && (base = 16),
assert(base === (base | 0) && base >= 2 && base <= 36),
(number = number.toString().replace(/\s+/g, ""));
@@ -17969,33 +15426,23 @@ var require_bn5 = __commonJS({
(base === 16
? this._parseHex(number, start, endian)
: (this._parseBase(number, base, start),
- endian === "le" &&
- this._initArray(this.toArray(), base, endian)));
+ endian === "le" && this._initArray(this.toArray(), base, endian)));
}),
(BN.prototype._initNumber = function (number, base, endian) {
number < 0 && ((this.negative = 1), (number = -number)),
number < 67108864
? ((this.words = [number & 67108863]), (this.length = 1))
: number < 4503599627370496
- ? ((this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- ]),
- (this.length = 2))
+ ? ((this.words = [number & 67108863, (number / 67108864) & 67108863]), (this.length = 2))
: (assert(number < 9007199254740992),
- (this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- 1,
- ]),
+ (this.words = [number & 67108863, (number / 67108864) & 67108863, 1]),
(this.length = 3)),
endian === "le" && this._initArray(this.toArray(), base, endian);
}),
(BN.prototype._initArray = function (number, base, endian) {
if ((assert(typeof number.length == "number"), number.length <= 0))
return (this.words = [0]), (this.length = 1), this;
- (this.length = Math.ceil(number.length / 3)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil(number.length / 3)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var j,
w,
@@ -18018,23 +15465,14 @@ var require_bn5 = __commonJS({
});
function parseHex4Bits(string, index) {
var c = string.charCodeAt(index);
- return c >= 65 && c <= 70
- ? c - 55
- : c >= 97 && c <= 102
- ? c - 87
- : (c - 48) & 15;
+ return c >= 65 && c <= 70 ? c - 55 : c >= 97 && c <= 102 ? c - 87 : (c - 48) & 15;
}
function parseHexByte(string, lowerBound, index) {
var r = parseHex4Bits(string, index);
- return (
- index - 1 >= lowerBound &&
- (r |= parseHex4Bits(string, index - 1) << 4),
- r
- );
+ return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;
}
BN.prototype._parseHex = function (number, start, endian) {
- (this.length = Math.ceil((number.length - start) / 6)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil((number.length - start) / 6)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var off = 0,
j = 0,
@@ -18043,44 +15481,26 @@ var require_bn5 = __commonJS({
for (i = number.length - 1; i >= start; i -= 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
else {
var parseLength = number.length - start;
- for (
- i = parseLength % 2 === 0 ? start + 1 : start;
- i < number.length;
- i += 2
- )
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
}
this.strip();
};
function parseBase(str, start, end, mul) {
- for (
- var r = 0, len = Math.min(str.length, end), i = start;
- i < len;
- i++
- ) {
+ for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
var c = str.charCodeAt(i) - 48;
- (r *= mul),
- c >= 49
- ? (r += c - 49 + 10)
- : c >= 17
- ? (r += c - 17 + 10)
- : (r += c);
+ (r *= mul), c >= 49 ? (r += c - 49 + 10) : c >= 17 ? (r += c - 17 + 10) : (r += c);
}
return r;
}
(BN.prototype._parseBase = function (number, base, start) {
(this.words = [0]), (this.length = 1);
- for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base)
- limbLen++;
+ for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
limbLen--, (limbPow = (limbPow / base) | 0);
for (
var total = number.length - start,
@@ -18093,30 +15513,18 @@ var require_bn5 = __commonJS({
)
(word = parseBase(number, i, i + limbLen, base)),
this.imuln(limbPow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
if (mod !== 0) {
var pow = 1;
- for (
- word = parseBase(number, i, number.length, base), i = 0;
- i < mod;
- i++
- )
- pow *= base;
- this.imuln(pow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
+ this.imuln(pow), this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
}
this.strip();
}),
(BN.prototype.copy = function (dest) {
dest.words = new Array(this.length);
for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
- (dest.length = this.length),
- (dest.negative = this.negative),
- (dest.red = this.red);
+ (dest.length = this.length), (dest.negative = this.negative), (dest.red = this.red);
}),
(BN.prototype.clone = function () {
var r = new BN(null);
@@ -18127,15 +15535,11 @@ var require_bn5 = __commonJS({
return this;
}),
(BN.prototype.strip = function () {
- for (; this.length > 1 && this.words[this.length - 1] === 0; )
- this.length--;
+ for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
return this._normSign();
}),
(BN.prototype._normSign = function () {
- return (
- this.length === 1 && this.words[0] === 0 && (this.negative = 0),
- this
- );
+ return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}),
(BN.prototype.inspect = function () {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -18169,15 +15573,13 @@ var require_bn5 = __commonJS({
"0000000000000000000000000",
],
groupSizes = [
- 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5,
],
groupBases = [
- 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607,
- 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536,
- 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101,
- 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368,
- 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
+ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808,
+ 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624,
+ 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
60466176,
];
(BN.prototype.toString = function (base, padding) {
@@ -18189,18 +15591,11 @@ var require_bn5 = __commonJS({
var w = this.words[i],
word = (((w << off) | carry) & 16777215).toString(16);
(carry = (w >>> (24 - off)) & 16777215),
- carry !== 0 || i !== this.length - 1
- ? (out = zeros[6 - word.length] + word + out)
- : (out = word + out),
+ carry !== 0 || i !== this.length - 1 ? (out = zeros[6 - word.length] + word + out) : (out = word + out),
(off += 2),
off >= 26 && ((off -= 26), i--);
}
- for (
- carry !== 0 && (out = carry.toString(16) + out);
- out.length % padding !== 0;
-
- )
- out = "0" + out;
+ for (carry !== 0 && (out = carry.toString(16) + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
if (base === (base | 0) && base >= 2 && base <= 36) {
@@ -18210,13 +15605,9 @@ var require_bn5 = __commonJS({
var c = this.clone();
for (c.negative = 0; !c.isZero(); ) {
var r = c.modn(groupBase).toString(base);
- (c = c.idivn(groupBase)),
- c.isZero()
- ? (out = r + out)
- : (out = zeros[groupSize - r.length] + r + out);
+ (c = c.idivn(groupBase)), c.isZero() ? (out = r + out) : (out = zeros[groupSize - r.length] + r + out);
}
- for (this.isZero() && (out = "0" + out); out.length % padding !== 0; )
- out = "0" + out;
+ for (this.isZero() && (out = "0" + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
assert(!1, "Base should be between 2 and 36");
@@ -18228,8 +15619,7 @@ var require_bn5 = __commonJS({
? (ret += this.words[1] * 67108864)
: this.length === 3 && this.words[2] === 1
? (ret += 4503599627370496 + this.words[1] * 67108864)
- : this.length > 2 &&
- assert(!1, "Number can only safely store up to 53 bits"),
+ : this.length > 2 && assert(!1, "Number can only safely store up to 53 bits"),
this.negative !== 0 ? -ret : ret
);
}),
@@ -18237,10 +15627,7 @@ var require_bn5 = __commonJS({
return this.toString(16);
}),
(BN.prototype.toBuffer = function (endian, length) {
- return (
- assert(typeof Buffer2 < "u"),
- this.toArrayLike(Buffer2, endian, length)
- );
+ return assert(typeof Buffer2 < "u"), this.toArrayLike(Buffer2, endian, length);
}),
(BN.prototype.toArray = function (endian, length) {
return this.toArrayLike(Array, endian, length);
@@ -18248,10 +15635,7 @@ var require_bn5 = __commonJS({
(BN.prototype.toArrayLike = function (ArrayType, endian, length) {
var byteLength = this.byteLength(),
reqLength = length || Math.max(1, byteLength);
- assert(
- byteLength <= reqLength,
- "byte array longer than desired length",
- ),
+ assert(byteLength <= reqLength, "byte array longer than desired length"),
assert(reqLength > 0, "Requested array length <= 0"),
this.strip();
var littleEndian = endian === "le",
@@ -18260,13 +15644,11 @@ var require_bn5 = __commonJS({
i,
q = this.clone();
if (littleEndian) {
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[i] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[i] = b);
for (; i < reqLength; i++) res[i] = 0;
} else {
for (i = 0; i < reqLength - byteLength; i++) res[i] = 0;
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
}
return res;
}),
@@ -18304,11 +15686,7 @@ var require_bn5 = __commonJS({
return (this.length - 1) * 26 + hi;
});
function toBitArray(num) {
- for (
- var w = new Array(num.bitLength()), bit = 0;
- bit < w.length;
- bit++
- ) {
+ for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
var off = (bit / 26) | 0,
wbit = bit % 26;
w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
@@ -18327,14 +15705,10 @@ var require_bn5 = __commonJS({
return Math.ceil(this.bitLength() / 8);
}),
(BN.prototype.toTwos = function (width) {
- return this.negative !== 0
- ? this.abs().inotn(width).iaddn(1)
- : this.clone();
+ return this.negative !== 0 ? this.abs().inotn(width).iaddn(1) : this.clone();
}),
(BN.prototype.fromTwos = function (width) {
- return this.testn(width - 1)
- ? this.notn(width).iaddn(1).ineg()
- : this.clone();
+ return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
}),
(BN.prototype.isNeg = function () {
return this.negative !== 0;
@@ -18347,50 +15721,37 @@ var require_bn5 = __commonJS({
}),
(BN.prototype.iuor = function (num) {
for (; this.length < num.length; ) this.words[this.length++] = 0;
- for (var i = 0; i < num.length; i++)
- this.words[i] = this.words[i] | num.words[i];
+ for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
return this.strip();
}),
(BN.prototype.ior = function (num) {
return assert((this.negative | num.negative) === 0), this.iuor(num);
}),
(BN.prototype.or = function (num) {
- return this.length > num.length
- ? this.clone().ior(num)
- : num.clone().ior(this);
+ return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
}),
(BN.prototype.uor = function (num) {
- return this.length > num.length
- ? this.clone().iuor(num)
- : num.clone().iuor(this);
+ return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
}),
(BN.prototype.iuand = function (num) {
var b;
this.length > num.length ? (b = num) : (b = this);
- for (var i = 0; i < b.length; i++)
- this.words[i] = this.words[i] & num.words[i];
+ for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
return (this.length = b.length), this.strip();
}),
(BN.prototype.iand = function (num) {
return assert((this.negative | num.negative) === 0), this.iuand(num);
}),
(BN.prototype.and = function (num) {
- return this.length > num.length
- ? this.clone().iand(num)
- : num.clone().iand(this);
+ return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
}),
(BN.prototype.uand = function (num) {
- return this.length > num.length
- ? this.clone().iuand(num)
- : num.clone().iuand(this);
+ return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
}),
(BN.prototype.iuxor = function (num) {
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
- for (var i = 0; i < b.length; i++)
- this.words[i] = a.words[i] ^ b.words[i];
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
+ for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
if (this !== a) for (; i < a.length; i++) this.words[i] = a.words[i];
return (this.length = a.length), this.strip();
}),
@@ -18398,27 +15759,18 @@ var require_bn5 = __commonJS({
return assert((this.negative | num.negative) === 0), this.iuxor(num);
}),
(BN.prototype.xor = function (num) {
- return this.length > num.length
- ? this.clone().ixor(num)
- : num.clone().ixor(this);
+ return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
}),
(BN.prototype.uxor = function (num) {
- return this.length > num.length
- ? this.clone().iuxor(num)
- : num.clone().iuxor(this);
+ return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
}),
(BN.prototype.inotn = function (width) {
assert(typeof width == "number" && width >= 0);
var bytesNeeded = Math.ceil(width / 26) | 0,
bitsLeft = width % 26;
this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;
- for (var i = 0; i < bytesNeeded; i++)
- this.words[i] = ~this.words[i] & 67108863;
- return (
- bitsLeft > 0 &&
- (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))),
- this.strip()
- );
+ for (var i = 0; i < bytesNeeded; i++) this.words[i] = ~this.words[i] & 67108863;
+ return bitsLeft > 0 && (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))), this.strip();
}),
(BN.prototype.notn = function (width) {
return this.clone().inotn(width);
@@ -18438,49 +15790,25 @@ var require_bn5 = __commonJS({
(BN.prototype.iadd = function (num) {
var r;
if (this.negative !== 0 && num.negative === 0)
- return (
- (this.negative = 0),
- (r = this.isub(num)),
- (this.negative ^= 1),
- this._normSign()
- );
+ return (this.negative = 0), (r = this.isub(num)), (this.negative ^= 1), this._normSign();
if (this.negative === 0 && num.negative !== 0)
- return (
- (num.negative = 0),
- (r = this.isub(num)),
- (num.negative = 1),
- r._normSign()
- );
+ return (num.negative = 0), (r = this.isub(num)), (num.negative = 1), r._normSign();
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) + (b.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
+ (r = (a.words[i] | 0) + (b.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
- if (((this.length = a.length), carry !== 0))
- (this.words[this.length] = carry), this.length++;
- else if (a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
+ (r = (a.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
+ if (((this.length = a.length), carry !== 0)) (this.words[this.length] = carry), this.length++;
+ else if (a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
return this;
}),
(BN.prototype.add = function (num) {
var res;
return num.negative !== 0 && this.negative === 0
- ? ((num.negative = 0),
- (res = this.sub(num)),
- (num.negative ^= 1),
- res)
+ ? ((num.negative = 0), (res = this.sub(num)), (num.negative ^= 1), res)
: num.negative === 0 && this.negative !== 0
- ? ((this.negative = 0),
- (res = num.sub(this)),
- (this.negative = 1),
- res)
+ ? ((this.negative = 0), (res = num.sub(this)), (this.negative = 1), res)
: this.length > num.length
? this.clone().iadd(num)
: num.clone().iadd(this);
@@ -18491,34 +15819,17 @@ var require_bn5 = __commonJS({
var r = this.iadd(num);
return (num.negative = 1), r._normSign();
} else if (this.negative !== 0)
- return (
- (this.negative = 0),
- this.iadd(num),
- (this.negative = 1),
- this._normSign()
- );
+ return (this.negative = 0), this.iadd(num), (this.negative = 1), this._normSign();
var cmp = this.cmp(num);
- if (cmp === 0)
- return (
- (this.negative = 0), (this.length = 1), (this.words[0] = 0), this
- );
+ if (cmp === 0) return (this.negative = 0), (this.length = 1), (this.words[0] = 0), this;
var a, b;
cmp > 0 ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) - (b.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
+ (r = (a.words[i] | 0) - (b.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
- if (carry === 0 && i < a.length && a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
- return (
- (this.length = Math.max(this.length, i)),
- a !== this && (this.negative = 1),
- this.strip()
- );
+ (r = (a.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
+ if (carry === 0 && i < a.length && a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
+ return (this.length = Math.max(this.length, i)), a !== this && (this.negative = 1), this.strip();
}),
(BN.prototype.sub = function (num) {
return this.clone().isub(num);
@@ -18551,9 +15862,7 @@ var require_bn5 = __commonJS({
}
(out.words[k] = rword | 0), (carry = ncarry | 0);
}
- return (
- carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip()
- );
+ return carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip();
}
var comb10MulTo = function (self2, num, out) {
var a = self2.words,
@@ -19108,15 +16417,12 @@ var require_bn5 = __commonJS({
};
Math.imul || (comb10MulTo = smallMulTo);
function bigMulTo(self2, num, out) {
- (out.negative = num.negative ^ self2.negative),
- (out.length = self2.length + num.length);
+ (out.negative = num.negative ^ self2.negative), (out.length = self2.length + num.length);
for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
var ncarry = hncarry;
hncarry = 0;
for (
- var rword = carry & 67108863,
- maxJ = Math.min(k, num.length - 1),
- j = Math.max(0, k - self2.length + 1);
+ var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);
j <= maxJ;
j++
) {
@@ -19158,32 +16464,22 @@ var require_bn5 = __commonJS({
(this.x = x), (this.y = y);
}
(FFTM.prototype.makeRBT = function (N) {
- for (
- var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0;
- i < N;
- i++
- )
- t[i] = this.revBin(i, l, N);
+ for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
return t;
}),
(FFTM.prototype.revBin = function (x, l, N) {
if (x === 0 || x === N - 1) return x;
- for (var rb = 0, i = 0; i < l; i++)
- (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
+ for (var rb = 0, i = 0; i < l; i++) (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
return rb;
}),
(FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++)
- (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
+ for (var i = 0; i < N; i++) (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
}),
(FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) {
this.permute(rbt, rws, iws, rtws, itws, N);
for (var s = 1; s < N; s <<= 1)
for (
- var l = s << 1,
- rtwdf = Math.cos((2 * Math.PI) / l),
- itwdf = Math.sin((2 * Math.PI) / l),
- p = 0;
+ var l = s << 1, rtwdf = Math.cos((2 * Math.PI) / l), itwdf = Math.sin((2 * Math.PI) / l), p = 0;
p < N;
p += l
)
@@ -19200,9 +16496,7 @@ var require_bn5 = __commonJS({
(rtws[p + j + s] = re - ro),
(itws[p + j + s] = ie - io),
j !== l &&
- ((rx = rtwdf * rtwdf_ - itwdf * itwdf_),
- (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_),
- (rtwdf_ = rx));
+ ((rx = rtwdf * rtwdf_ - itwdf * itwdf_), (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_), (rtwdf_ = rx));
}
}),
(FFTM.prototype.guessLen13b = function (n, m) {
@@ -19225,12 +16519,8 @@ var require_bn5 = __commonJS({
}),
(FFTM.prototype.normalize13b = function (ws, N) {
for (var carry = 0, i = 0; i < N / 2; i++) {
- var w =
- Math.round(ws[2 * i + 1] / N) * 8192 +
- Math.round(ws[2 * i] / N) +
- carry;
- (ws[i] = w & 67108863),
- w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
+ var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;
+ (ws[i] = w & 67108863), w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
}
return ws;
}),
@@ -19280,17 +16570,11 @@ var require_bn5 = __commonJS({
}),
(BN.prototype.mul = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- this.mulTo(num, out)
- );
+ return (out.words = new Array(this.length + num.length)), this.mulTo(num, out);
}),
(BN.prototype.mulf = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- jumboMulTo(this, num, out)
- );
+ return (out.words = new Array(this.length + num.length)), jumboMulTo(this, num, out);
}),
(BN.prototype.imul = function (num) {
return this.clone().mulTo(num, this);
@@ -19300,10 +16584,7 @@ var require_bn5 = __commonJS({
for (var carry = 0, i = 0; i < this.length; i++) {
var w = (this.words[i] | 0) * num,
lo = (w & 67108863) + (carry & 67108863);
- (carry >>= 26),
- (carry += (w / 67108864) | 0),
- (carry += lo >>> 26),
- (this.words[i] = lo & 67108863);
+ (carry >>= 26), (carry += (w / 67108864) | 0), (carry += lo >>> 26), (this.words[i] = lo & 67108863);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -19319,14 +16600,8 @@ var require_bn5 = __commonJS({
(BN.prototype.pow = function (num) {
var w = toBitArray(num);
if (w.length === 0) return new BN(1);
- for (
- var res = this, i = 0;
- i < w.length && w[i] === 0;
- i++, res = res.sqr()
- );
- if (++i < w.length)
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr())
- w[i] !== 0 && (res = res.mul(q));
+ for (var res = this, i = 0; i < w.length && w[i] === 0; i++, res = res.sqr());
+ if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) w[i] !== 0 && (res = res.mul(q));
return res;
}),
(BN.prototype.iushln = function (bits) {
@@ -19345,8 +16620,7 @@ var require_bn5 = __commonJS({
carry && ((this.words[i] = carry), this.length++);
}
if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--)
- this.words[i + s] = this.words[i];
+ for (i = this.length - 1; i >= 0; i--) this.words[i + s] = this.words[i];
for (i = 0; i < s; i++) this.words[i] = 0;
this.length += s;
}
@@ -19368,20 +16642,15 @@ var require_bn5 = __commonJS({
maskedWords.length = s;
}
if (s !== 0)
- if (this.length > s)
- for (this.length -= s, i = 0; i < this.length; i++)
- this.words[i] = this.words[i + s];
+ if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s];
else (this.words[0] = 0), (this.length = 1);
var carry = 0;
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
var word = this.words[i] | 0;
- (this.words[i] = (carry << (26 - r)) | (word >>> r)),
- (carry = word & mask);
+ (this.words[i] = (carry << (26 - r)) | (word >>> r)), (carry = word & mask);
}
return (
- maskedWords &&
- carry !== 0 &&
- (maskedWords.words[maskedWords.length++] = carry),
+ maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry),
this.length === 0 && ((this.words[0] = 0), (this.length = 1)),
this.strip()
);
@@ -19414,17 +16683,8 @@ var require_bn5 = __commonJS({
assert(typeof bits == "number" && bits >= 0);
var r = bits % 26,
s = (bits - r) / 26;
- if (
- (assert(
- this.negative === 0,
- "imaskn works only with positive numbers",
- ),
- this.length <= s)
- )
- return this;
- if (
- (r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)
- ) {
+ if ((assert(this.negative === 0, "imaskn works only with positive numbers"), this.length <= s)) return this;
+ if ((r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)) {
var mask = 67108863 ^ ((67108863 >>> r) << r);
this.words[this.length - 1] &= mask;
}
@@ -19441,32 +16701,20 @@ var require_bn5 = __commonJS({
? this.isubn(-num)
: this.negative !== 0
? this.length === 1 && (this.words[0] | 0) < num
- ? ((this.words[0] = num - (this.words[0] | 0)),
- (this.negative = 0),
- this)
- : ((this.negative = 0),
- this.isubn(num),
- (this.negative = 1),
- this)
+ ? ((this.words[0] = num - (this.words[0] | 0)), (this.negative = 0), this)
+ : ((this.negative = 0), this.isubn(num), (this.negative = 1), this)
: this._iaddn(num)
);
}),
(BN.prototype._iaddn = function (num) {
this.words[0] += num;
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++)
- (this.words[i] -= 67108864),
- i === this.length - 1
- ? (this.words[i + 1] = 1)
- : this.words[i + 1]++;
+ (this.words[i] -= 67108864), i === this.length - 1 ? (this.words[i + 1] = 1) : this.words[i + 1]++;
return (this.length = Math.max(this.length, i + 1)), this;
}),
(BN.prototype.isubn = function (num) {
- if ((assert(typeof num == "number"), assert(num < 67108864), num < 0))
- return this.iaddn(-num);
- if (this.negative !== 0)
- return (
- (this.negative = 0), this.iaddn(num), (this.negative = 1), this
- );
+ if ((assert(typeof num == "number"), assert(num < 67108864), num < 0)) return this.iaddn(-num);
+ if (this.negative !== 0) return (this.negative = 0), this.iaddn(num), (this.negative = 1), this;
if (((this.words[0] -= num), this.length === 1 && this.words[0] < 0))
(this.words[0] = -this.words[0]), (this.negative = 1);
else
@@ -19500,14 +16748,10 @@ var require_bn5 = __commonJS({
(this.words[i + shift] = w & 67108863);
}
for (; i < this.length - shift; i++)
- (w = (this.words[i + shift] | 0) + carry),
- (carry = w >> 26),
- (this.words[i + shift] = w & 67108863);
+ (w = (this.words[i + shift] | 0) + carry), (carry = w >> 26), (this.words[i + shift] = w & 67108863);
if (carry === 0) return this.strip();
for (assert(carry === -1), carry = 0, i = 0; i < this.length; i++)
- (w = -(this.words[i] | 0) + carry),
- (carry = w >> 26),
- (this.words[i] = w & 67108863);
+ (w = -(this.words[i] | 0) + carry), (carry = w >> 26), (this.words[i] = w & 67108863);
return (this.negative = 1), this.strip();
}),
(BN.prototype._wordDiv = function (num, mode) {
@@ -19517,33 +16761,19 @@ var require_bn5 = __commonJS({
bhi = b.words[b.length - 1] | 0,
bhiBits = this._countBits(bhi);
(shift = 26 - bhiBits),
- shift !== 0 &&
- ((b = b.ushln(shift)),
- a.iushln(shift),
- (bhi = b.words[b.length - 1] | 0));
+ shift !== 0 && ((b = b.ushln(shift)), a.iushln(shift), (bhi = b.words[b.length - 1] | 0));
var m = a.length - b.length,
q;
if (mode !== "mod") {
- (q = new BN(null)),
- (q.length = m + 1),
- (q.words = new Array(q.length));
+ (q = new BN(null)), (q.length = m + 1), (q.words = new Array(q.length));
for (var i = 0; i < q.length; i++) q.words[i] = 0;
}
var diff = a.clone()._ishlnsubmul(b, 1, m);
diff.negative === 0 && ((a = diff), q && (q.words[m] = 1));
for (var j = m - 1; j >= 0; j--) {
- var qj =
- (a.words[b.length + j] | 0) * 67108864 +
- (a.words[b.length + j - 1] | 0);
- for (
- qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j);
- a.negative !== 0;
-
- )
- qj--,
- (a.negative = 0),
- a._ishlnsubmul(b, 1, j),
- a.isZero() || (a.negative ^= 1);
+ var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);
+ for (qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j); a.negative !== 0; )
+ qj--, (a.negative = 0), a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
q && (q.words[j] = qj);
}
return (
@@ -19566,9 +16796,7 @@ var require_bn5 = __commonJS({
return this.negative !== 0 && num.negative === 0
? ((res = this.neg().divmod(num, mode)),
mode !== "mod" && (div = res.div.neg()),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.iadd(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.iadd(num)),
{
div,
mod,
@@ -19582,9 +16810,7 @@ var require_bn5 = __commonJS({
})
: (this.negative & num.negative) !== 0
? ((res = this.neg().divmod(num.neg(), mode)),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.isub(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.isub(num)),
{
div: res.div,
mod,
@@ -19635,11 +16861,7 @@ var require_bn5 = __commonJS({
}),
(BN.prototype.modn = function (num) {
assert(num <= 67108863);
- for (
- var p = (1 << 26) % num, acc = 0, i = this.length - 1;
- i >= 0;
- i--
- )
+ for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; i >= 0; i--)
acc = (p * acc + (this.words[i] | 0)) % num;
return acc;
}),
@@ -19659,40 +16881,18 @@ var require_bn5 = __commonJS({
var x = this,
y = p.clone();
x.negative !== 0 ? (x = x.umod(p)) : (x = x.clone());
- for (
- var A = new BN(1),
- B = new BN(0),
- C = new BN(0),
- D = new BN(1),
- g = 0;
- x.isEven() && y.isEven();
-
- )
+ for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); )
x.iushrn(1), y.iushrn(1), ++g;
for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
- for (
- var i = 0, im = 1;
- (x.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
if (i > 0)
for (x.iushrn(i); i-- > 0; )
- (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)),
- A.iushrn(1),
- B.iushrn(1);
- for (
- var j = 0, jm = 1;
- (y.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
+ (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
if (j > 0)
for (y.iushrn(j); j-- > 0; )
- (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)),
- C.iushrn(1),
- D.iushrn(1);
- x.cmp(y) >= 0
- ? (x.isub(y), A.isub(C), B.isub(D))
- : (y.isub(x), C.isub(A), D.isub(B));
+ (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);
+ x.cmp(y) >= 0 ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
}
return {
a: C,
@@ -19705,35 +16905,15 @@ var require_bn5 = __commonJS({
var a = this,
b = p.clone();
a.negative !== 0 ? (a = a.umod(p)) : (a = a.clone());
- for (
- var x1 = new BN(1), x2 = new BN(0), delta = b.clone();
- a.cmpn(1) > 0 && b.cmpn(1) > 0;
-
- ) {
- for (
- var i = 0, im = 1;
- (a.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
- if (i > 0)
- for (a.iushrn(i); i-- > 0; )
- x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
- for (
- var j = 0, jm = 1;
- (b.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
- if (j > 0)
- for (b.iushrn(j); j-- > 0; )
- x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
+ for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone(); a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
+ if (i > 0) for (a.iushrn(i); i-- > 0; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
+ if (j > 0) for (b.iushrn(j); j-- > 0; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
a.cmp(b) >= 0 ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
}
var res;
- return (
- a.cmpn(1) === 0 ? (res = x1) : (res = x2),
- res.cmpn(0) < 0 && res.iadd(p),
- res
- );
+ return a.cmpn(1) === 0 ? (res = x1) : (res = x2), res.cmpn(0) < 0 && res.iadd(p), res;
}),
(BN.prototype.gcd = function (num) {
if (this.isZero()) return num.abs();
@@ -19741,8 +16921,7 @@ var require_bn5 = __commonJS({
var a = this.clone(),
b = num.clone();
(a.negative = 0), (b.negative = 0);
- for (var shift = 0; a.isEven() && b.isEven(); shift++)
- a.iushrn(1), b.iushrn(1);
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), b.iushrn(1);
do {
for (; a.isEven(); ) a.iushrn(1);
for (; b.isEven(); ) b.iushrn(1);
@@ -19772,14 +16951,10 @@ var require_bn5 = __commonJS({
var r = bit % 26,
s = (bit - r) / 26,
q = 1 << r;
- if (this.length <= s)
- return this._expand(s + 1), (this.words[s] |= q), this;
+ if (this.length <= s) return this._expand(s + 1), (this.words[s] |= q), this;
for (var carry = q, i = s; carry !== 0 && i < this.length; i++) {
var w = this.words[i] | 0;
- (w += carry),
- (carry = w >>> 26),
- (w &= 67108863),
- (this.words[i] = w);
+ (w += carry), (carry = w >>> 26), (w &= 67108863), (this.words[i] = w);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -19794,8 +16969,7 @@ var require_bn5 = __commonJS({
var res;
if (this.length > 1) res = 1;
else {
- negative && (num = -num),
- assert(num <= 67108863, "Number is too big");
+ negative && (num = -num), assert(num <= 67108863, "Number is too big");
var w = this.words[0] | 0;
res = w === num ? 0 : w < num ? -1 : 1;
}
@@ -19861,52 +17035,28 @@ var require_bn5 = __commonJS({
);
}),
(BN.prototype.fromRed = function () {
- return (
- assert(
- this.red,
- "fromRed works only with numbers in reduction context",
- ),
- this.red.convertFrom(this)
- );
+ return assert(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
}),
(BN.prototype._forceRed = function (ctx) {
return (this.red = ctx), this;
}),
(BN.prototype.forceRed = function (ctx) {
- return (
- assert(!this.red, "Already a number in reduction context"),
- this._forceRed(ctx)
- );
+ return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
}),
(BN.prototype.redAdd = function (num) {
- return (
- assert(this.red, "redAdd works only with red numbers"),
- this.red.add(this, num)
- );
+ return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
}),
(BN.prototype.redIAdd = function (num) {
- return (
- assert(this.red, "redIAdd works only with red numbers"),
- this.red.iadd(this, num)
- );
+ return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
}),
(BN.prototype.redSub = function (num) {
- return (
- assert(this.red, "redSub works only with red numbers"),
- this.red.sub(this, num)
- );
+ return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
}),
(BN.prototype.redISub = function (num) {
- return (
- assert(this.red, "redISub works only with red numbers"),
- this.red.isub(this, num)
- );
+ return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
}),
(BN.prototype.redShl = function (num) {
- return (
- assert(this.red, "redShl works only with red numbers"),
- this.red.shl(this, num)
- );
+ return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
}),
(BN.prototype.redMul = function (num) {
return (
@@ -19923,46 +17073,22 @@ var require_bn5 = __commonJS({
);
}),
(BN.prototype.redSqr = function () {
- return (
- assert(this.red, "redSqr works only with red numbers"),
- this.red._verify1(this),
- this.red.sqr(this)
- );
+ return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
}),
(BN.prototype.redISqr = function () {
- return (
- assert(this.red, "redISqr works only with red numbers"),
- this.red._verify1(this),
- this.red.isqr(this)
- );
+ return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
}),
(BN.prototype.redSqrt = function () {
- return (
- assert(this.red, "redSqrt works only with red numbers"),
- this.red._verify1(this),
- this.red.sqrt(this)
- );
+ return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
}),
(BN.prototype.redInvm = function () {
- return (
- assert(this.red, "redInvm works only with red numbers"),
- this.red._verify1(this),
- this.red.invm(this)
- );
+ return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
}),
(BN.prototype.redNeg = function () {
- return (
- assert(this.red, "redNeg works only with red numbers"),
- this.red._verify1(this),
- this.red.neg(this)
- );
+ return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
}),
(BN.prototype.redPow = function (num) {
- return (
- assert(this.red && !num.red, "redPow(normalNum)"),
- this.red._verify1(this),
- this.red.pow(this, num)
- );
+ return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, num);
});
var primes = {
k256: null,
@@ -19984,11 +17110,7 @@ var require_bn5 = __commonJS({
(MPrime.prototype.ireduce = function (num) {
var r = num,
rlen;
- do
- this.split(r, this.tmp),
- (r = this.imulK(r)),
- (r = r.iadd(this.tmp)),
- (rlen = r.bitLength());
+ do this.split(r, this.tmp), (r = this.imulK(r)), (r = r.iadd(this.tmp)), (rlen = r.bitLength());
while (rlen > this.n);
var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
return (
@@ -20009,78 +17131,45 @@ var require_bn5 = __commonJS({
return num.imul(this.k);
});
function K256() {
- MPrime.call(
- this,
- "k256",
- "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
- );
+ MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
}
inherits(K256, MPrime),
(K256.prototype.split = function (input, output) {
- for (
- var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;
- i < outLen;
- i++
- )
+ for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0; i < outLen; i++)
output.words[i] = input.words[i];
if (((output.length = outLen), input.length <= 9)) {
(input.words[0] = 0), (input.length = 1);
return;
}
var prev = input.words[9];
- for (
- output.words[output.length++] = prev & mask, i = 10;
- i < input.length;
- i++
- ) {
+ for (output.words[output.length++] = prev & mask, i = 10; i < input.length; i++) {
var next = input.words[i] | 0;
- (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)),
- (prev = next);
+ (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)), (prev = next);
}
(prev >>>= 22),
(input.words[i - 10] = prev),
- prev === 0 && input.length > 10
- ? (input.length -= 10)
- : (input.length -= 9);
+ prev === 0 && input.length > 10 ? (input.length -= 10) : (input.length -= 9);
}),
(K256.prototype.imulK = function (num) {
- (num.words[num.length] = 0),
- (num.words[num.length + 1] = 0),
- (num.length += 2);
+ (num.words[num.length] = 0), (num.words[num.length + 1] = 0), (num.length += 2);
for (var lo = 0, i = 0; i < num.length; i++) {
var w = num.words[i] | 0;
- (lo += w * 977),
- (num.words[i] = lo & 67108863),
- (lo = w * 64 + ((lo / 67108864) | 0));
+ (lo += w * 977), (num.words[i] = lo & 67108863), (lo = w * 64 + ((lo / 67108864) | 0));
}
return (
- num.words[num.length - 1] === 0 &&
- (num.length--, num.words[num.length - 1] === 0 && num.length--),
- num
+ num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num
);
});
function P224() {
- MPrime.call(
- this,
- "p224",
- "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
- );
+ MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
}
inherits(P224, MPrime);
function P192() {
- MPrime.call(
- this,
- "p192",
- "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
- );
+ MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
}
inherits(P192, MPrime);
function P25519() {
- MPrime.call(
- this,
- "25519",
- "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
- );
+ MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
}
inherits(P25519, MPrime),
(P25519.prototype.imulK = function (num) {
@@ -20105,26 +17194,17 @@ var require_bn5 = __commonJS({
if (typeof m == "string") {
var prime = BN._prime(m);
(this.m = prime.p), (this.prime = prime);
- } else
- assert(m.gtn(1), "modulus must be greater than 1"),
- (this.m = m),
- (this.prime = null);
+ } else assert(m.gtn(1), "modulus must be greater than 1"), (this.m = m), (this.prime = null);
}
(Red.prototype._verify1 = function (a) {
- assert(a.negative === 0, "red works only with positives"),
- assert(a.red, "red works only with red numbers");
+ assert(a.negative === 0, "red works only with positives"), assert(a.red, "red works only with red numbers");
}),
(Red.prototype._verify2 = function (a, b) {
- assert(
- (a.negative | b.negative) === 0,
- "red works only with positives",
- ),
+ assert((a.negative | b.negative) === 0, "red works only with positives"),
assert(a.red && a.red === b.red, "red works only with red numbers");
}),
(Red.prototype.imod = function (a) {
- return this.prime
- ? this.prime.ireduce(a)._forceRed(this)
- : a.umod(this.m)._forceRed(this);
+ return this.prime ? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);
}),
(Red.prototype.neg = function (a) {
return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
@@ -20171,29 +17251,19 @@ var require_bn5 = __commonJS({
var pow = this.m.add(new BN(1)).iushrn(2);
return this.pow(a, pow);
}
- for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; )
- s++, q.iushrn(1);
+ for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; ) s++, q.iushrn(1);
assert(!q.isZero());
var one = new BN(1).toRed(this),
nOne = one.redNeg(),
lpow = this.m.subn(1).iushrn(1),
z = this.m.bitLength();
+ for (z = new BN(2 * z * z).toRed(this); this.pow(z, lpow).cmp(nOne) !== 0; ) z.redIAdd(nOne);
for (
- z = new BN(2 * z * z).toRed(this);
- this.pow(z, lpow).cmp(nOne) !== 0;
-
- )
- z.redIAdd(nOne);
- for (
- var c = this.pow(z, q),
- r = this.pow(a, q.addn(1).iushrn(1)),
- t = this.pow(a, q),
- m = s;
+ var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;
t.cmp(one) !== 0;
) {
- for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++)
- tmp = tmp.redSqr();
+ for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++) tmp = tmp.redSqr();
assert(i < m);
var b = this.pow(c, new BN(1).iushln(m - i - 1));
(r = r.redMul(b)), (c = b.redSqr()), (t = t.redMul(c)), (m = i);
@@ -20202,9 +17272,7 @@ var require_bn5 = __commonJS({
}),
(Red.prototype.invm = function (a) {
var inv = a._invmp(this.m);
- return inv.negative !== 0
- ? ((inv.negative = 0), this.imod(inv).redNeg())
- : this.imod(inv);
+ return inv.negative !== 0 ? ((inv.negative = 0), this.imod(inv).redNeg()) : this.imod(inv);
}),
(Red.prototype.pow = function (a, num) {
if (num.isZero()) return new BN(1).toRed(this);
@@ -20220,10 +17288,7 @@ var require_bn5 = __commonJS({
for (start === 0 && (start = 26), i = num.length - 1; i >= 0; i--) {
for (var word = num.words[i], j = start - 1; j >= 0; j--) {
var bit = (word >> j) & 1;
- if (
- (res !== wnd[0] && (res = this.sqr(res)),
- bit === 0 && current === 0)
- ) {
+ if ((res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0)) {
currentLen = 0;
continue;
}
@@ -20231,9 +17296,7 @@ var require_bn5 = __commonJS({
(current |= bit),
currentLen++,
!(currentLen !== windowSize && (i !== 0 || j !== 0)) &&
- ((res = this.mul(res, wnd[current])),
- (currentLen = 0),
- (current = 0));
+ ((res = this.mul(res, wnd[current])), (currentLen = 0), (current = 0));
}
start = 26;
}
@@ -20270,38 +17333,23 @@ var require_bn5 = __commonJS({
return (r.red = null), r;
}),
(Mont.prototype.imul = function (a, b) {
- if (a.isZero() || b.isZero())
- return (a.words[0] = 0), (a.length = 1), a;
+ if (a.isZero() || b.isZero()) return (a.words[0] = 0), (a.length = 1), a;
var t = a.imul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.mul = function (a, b) {
if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
var t = a.mul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.invm = function (a) {
@@ -20321,24 +17369,15 @@ var require_safer = __commonJS({
safer = {},
key;
for (key in buffer)
- !buffer.hasOwnProperty(key) ||
- key === "SlowBuffer" ||
- key === "Buffer" ||
- (safer[key] = buffer[key]);
+ !buffer.hasOwnProperty(key) || key === "SlowBuffer" || key === "Buffer" || (safer[key] = buffer[key]);
var Safer = (safer.Buffer = {});
for (key in Buffer2)
- !Buffer2.hasOwnProperty(key) ||
- key === "allocUnsafe" ||
- key === "allocUnsafeSlow" ||
- (Safer[key] = Buffer2[key]);
+ !Buffer2.hasOwnProperty(key) || key === "allocUnsafe" || key === "allocUnsafeSlow" || (Safer[key] = Buffer2[key]);
safer.Buffer.prototype = Buffer2.prototype;
(!Safer.from || Safer.from === Uint8Array.from) &&
(Safer.from = function (value, encodingOrOffset, length) {
if (typeof value == "number")
- throw new TypeError(
- 'The "value" argument must not be of type number. Received type ' +
- typeof value,
- );
+ throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value);
if (value && typeof value.length > "u")
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " +
@@ -20349,14 +17388,9 @@ var require_safer = __commonJS({
Safer.alloc ||
(Safer.alloc = function (size, fill, encoding) {
if (typeof size != "number")
- throw new TypeError(
- 'The "size" argument must be of type number. Received type ' +
- typeof size,
- );
+ throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size);
if (size < 0 || size >= 2 * (1 << 30))
- throw new RangeError(
- 'The value "' + size + '" is invalid for option "size"',
- );
+ throw new RangeError('The value "' + size + '" is invalid for option "size"');
var buf = Buffer2(size);
return (
!fill || fill.length === 0
@@ -20375,8 +17409,7 @@ var require_safer = __commonJS({
((safer.constants = {
MAX_LENGTH: safer.kMaxLength,
}),
- safer.kStringMaxLength &&
- (safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength));
+ safer.kStringMaxLength && (safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength));
module.exports = safer;
},
});
@@ -20536,8 +17569,7 @@ var require_buffer = __commonJS({
: this.error(fail || "DecoderBuffer overrun");
};
DecoderBuffer.prototype.skip = function (bytes, fail) {
- if (!(this.offset + bytes <= this.length))
- return this.error(fail || "DecoderBuffer overrun");
+ if (!(this.offset + bytes <= this.length)) return this.error(fail || "DecoderBuffer overrun");
let res = new DecoderBuffer(this.base);
return (
(res._reporterState = this._reporterState),
@@ -20555,20 +17587,16 @@ var require_buffer = __commonJS({
(this.length = 0),
(this.value = value.map(function (item) {
return (
- EncoderBuffer.isEncoderBuffer(item) ||
- (item = new EncoderBuffer(item, reporter)),
+ EncoderBuffer.isEncoderBuffer(item) || (item = new EncoderBuffer(item, reporter)),
(this.length += item.length),
item
);
}, this));
else if (typeof value == "number") {
- if (!(0 <= value && value <= 255))
- return reporter.error("non-byte EncoderBuffer value");
+ if (!(0 <= value && value <= 255)) return reporter.error("non-byte EncoderBuffer value");
(this.value = value), (this.length = 1);
- } else if (typeof value == "string")
- (this.value = value), (this.length = Buffer2.byteLength(value));
- else if (Buffer2.isBuffer(value))
- (this.value = value), (this.length = value.length);
+ } else if (typeof value == "string") (this.value = value), (this.length = Buffer2.byteLength(value));
+ else if (Buffer2.isBuffer(value)) (this.value = value), (this.length = value.length);
else return reporter.error("Unsupported type: " + typeof value);
}
exports.EncoderBuffer = EncoderBuffer;
@@ -20637,18 +17665,9 @@ var require_node = __commonJS({
"utf8str",
"videostr",
],
- methods = [
- "key",
- "obj",
- "use",
- "optional",
- "explicit",
- "implicit",
- "def",
- "choice",
- "any",
- "contains",
- ].concat(tags),
+ methods = ["key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains"].concat(
+ tags,
+ ),
overrided = [
"_peekTag",
"_decodeTag",
@@ -20725,9 +17744,7 @@ var require_node = __commonJS({
methods.forEach(function (method) {
this[method] = function () {
let clone = new this.constructor(this);
- return (
- state.children.push(clone), clone[method].apply(clone, arguments)
- );
+ return state.children.push(clone), clone[method].apply(clone, arguments);
};
}, this);
};
@@ -20738,11 +17755,7 @@ var require_node = __commonJS({
(state.children = state.children.filter(function (child) {
return child._baseState.parent === this;
}, this)),
- assert.equal(
- state.children.length,
- 1,
- "Root node can have only one child",
- );
+ assert.equal(state.children.length, 1, "Root node can have only one child");
};
Node.prototype._useArgs = function (args) {
let state = this._baseState,
@@ -20762,8 +17775,7 @@ var require_node = __commonJS({
(assert(state.args === null),
(state.args = args),
(state.reverseArgs = args.map(function (arg) {
- if (typeof arg != "object" || arg.constructor !== Object)
- return arg;
+ if (typeof arg != "object" || arg.constructor !== Object) return arg;
let res = {};
return (
Object.keys(arg).forEach(function (key) {
@@ -20785,12 +17797,7 @@ var require_node = __commonJS({
Node.prototype[tag] = function () {
let state = this._baseState,
args = Array.prototype.slice.call(arguments);
- return (
- assert(state.tag === null),
- (state.tag = tag),
- this._useArgs(args),
- this
- );
+ return assert(state.tag === null), (state.tag = tag), this._useArgs(args), this;
};
});
Node.prototype.use = function (item) {
@@ -20804,28 +17811,15 @@ var require_node = __commonJS({
};
Node.prototype.def = function (val) {
let state = this._baseState;
- return (
- assert(state.default === null),
- (state.default = val),
- (state.optional = !0),
- this
- );
+ return assert(state.default === null), (state.default = val), (state.optional = !0), this;
};
Node.prototype.explicit = function (num) {
let state = this._baseState;
- return (
- assert(state.explicit === null && state.implicit === null),
- (state.explicit = num),
- this
- );
+ return assert(state.explicit === null && state.implicit === null), (state.explicit = num), this;
};
Node.prototype.implicit = function (num) {
let state = this._baseState;
- return (
- assert(state.explicit === null && state.implicit === null),
- (state.implicit = num),
- this
- );
+ return assert(state.explicit === null && state.implicit === null), (state.implicit = num), this;
};
Node.prototype.obj = function () {
let state = this._baseState,
@@ -20859,15 +17853,11 @@ var require_node = __commonJS({
};
Node.prototype._decode = function (input, options) {
let state = this._baseState;
- if (state.parent === null)
- return input.wrapResult(state.children[0]._decode(input, options));
+ if (state.parent === null) return input.wrapResult(state.children[0]._decode(input, options));
let result = state.default,
present = !0,
prevKey = null;
- if (
- (state.key !== null && (prevKey = input.enterKey(state.key)),
- state.optional)
- ) {
+ if ((state.key !== null && (prevKey = input.enterKey(state.key)), state.optional)) {
let tag = null;
if (
(state.explicit !== null
@@ -20879,19 +17869,13 @@ var require_node = __commonJS({
) {
let save = input.save();
try {
- state.choice === null
- ? this._decodeGeneric(state.tag, input, options)
- : this._decodeChoice(input, options),
+ state.choice === null ? this._decodeGeneric(state.tag, input, options) : this._decodeChoice(input, options),
(present = !0);
} catch {
present = !1;
}
input.restore(save);
- } else if (
- ((present = this._peekTag(input, tag, state.any)),
- input.isError(present))
- )
- return present;
+ } else if (((present = this._peekTag(input, tag, state.any)), input.isError(present))) return present;
}
let prevObj;
if ((state.obj && present && (prevObj = input.enterObject()), present)) {
@@ -20904,19 +17888,12 @@ var require_node = __commonJS({
if (state.use === null && state.choice === null) {
let save;
state.any && (save = input.save());
- let body = this._decodeTag(
- input,
- state.implicit !== null ? state.implicit : state.tag,
- state.any,
- );
+ let body = this._decodeTag(input, state.implicit !== null ? state.implicit : state.tag, state.any);
if (input.isError(body)) return body;
state.any ? (result = input.raw(save)) : (input = body);
}
if (
- (options &&
- options.track &&
- state.tag !== null &&
- options.track(input.path(), start, input.length, "tagged"),
+ (options && options.track && state.tag !== null && options.track(input.path(), start, input.length, "tagged"),
options &&
options.track &&
state.tag !== null &&
@@ -20938,10 +17915,7 @@ var require_node = __commonJS({
state.contains && (state.tag === "octstr" || state.tag === "bitstr"))
) {
let data = new DecoderBuffer(result);
- result = this._getUse(
- state.contains,
- input._reporterState.obj,
- )._decode(data, options);
+ result = this._getUse(state.contains, input._reporterState.obj)._decode(data, options);
}
}
return (
@@ -20975,10 +17949,7 @@ var require_node = __commonJS({
: tag === "int" || tag === "enum"
? this._decodeInt(input, state.args && state.args[0], options)
: state.use !== null
- ? this._getUse(state.use, input._reporterState.obj)._decode(
- input,
- options,
- )
+ ? this._getUse(state.use, input._reporterState.obj)._decode(input, options)
: input.error("unknown tag: " + tag);
};
Node.prototype._getUse = function (entity, obj) {
@@ -20988,8 +17959,7 @@ var require_node = __commonJS({
assert(state.useDecoder._baseState.parent === null),
(state.useDecoder = state.useDecoder._baseState.children[0]),
state.implicit !== state.useDecoder._baseState.implicit &&
- ((state.useDecoder = state.useDecoder.clone()),
- (state.useDecoder._baseState.implicit = state.implicit)),
+ ((state.useDecoder = state.useDecoder.clone()), (state.useDecoder._baseState.implicit = state.implicit)),
state.useDecoder
);
};
@@ -21020,13 +17990,11 @@ var require_node = __commonJS({
let state = this._baseState;
if (state.default !== null && state.default === data) return;
let result = this._encodeValue(data, reporter, parent);
- if (result !== void 0 && !this._skipDefault(result, reporter, parent))
- return result;
+ if (result !== void 0 && !this._skipDefault(result, reporter, parent)) return result;
};
Node.prototype._encodeValue = function (data, reporter, parent) {
let state = this._baseState;
- if (state.parent === null)
- return state.children[0]._encode(data, reporter || new Reporter());
+ if (state.parent === null) return state.children[0]._encode(data, reporter || new Reporter());
let result = null;
if (((this.reporter = reporter), state.optional && data === void 0))
if (state.default !== null) data = state.default;
@@ -21036,21 +18004,14 @@ var require_node = __commonJS({
if (state.any) result = this._createEncoderBuffer(data);
else if (state.choice) result = this._encodeChoice(data, reporter);
else if (state.contains)
- (content = this._getUse(state.contains, parent)._encode(
- data,
- reporter,
- )),
- (primitive = !0);
+ (content = this._getUse(state.contains, parent)._encode(data, reporter)), (primitive = !0);
else if (state.children)
(content = state.children
.map(function (child) {
- if (child._baseState.tag === "null_")
- return child._encode(null, reporter, data);
- if (child._baseState.key === null)
- return reporter.error("Child should have a key");
+ if (child._baseState.tag === "null_") return child._encode(null, reporter, data);
+ if (child._baseState.key === null) return reporter.error("Child should have a key");
let prevKey = reporter.enterKey(child._baseState.key);
- if (typeof data != "object")
- return reporter.error("Child expected, but input is not object");
+ if (typeof data != "object") return reporter.error("Child expected, but input is not object");
let res = child._encode(data[child._baseState.key], reporter, data);
return reporter.leaveKey(prevKey), res;
}, this)
@@ -21059,10 +18020,8 @@ var require_node = __commonJS({
})),
(content = this._createEncoderBuffer(content));
else if (state.tag === "seqof" || state.tag === "setof") {
- if (!(state.args && state.args.length === 1))
- return reporter.error("Too many args for : " + state.tag);
- if (!Array.isArray(data))
- return reporter.error("seqof/setof, but data is not Array");
+ if (!(state.args && state.args.length === 1)) return reporter.error("Too many args for : " + state.tag);
+ if (!Array.isArray(data)) return reporter.error("seqof/setof, but data is not Array");
let child = this.clone();
(child._baseState.implicit = null),
(content = this._createEncoderBuffer(
@@ -21074,53 +18033,32 @@ var require_node = __commonJS({
} else
state.use !== null
? (result = this._getUse(state.use, parent)._encode(data, reporter))
- : ((content = this._encodePrimitive(state.tag, data)),
- (primitive = !0));
+ : ((content = this._encodePrimitive(state.tag, data)), (primitive = !0));
if (!state.any && state.choice === null) {
let tag = state.implicit !== null ? state.implicit : state.tag,
cls = state.implicit === null ? "universal" : "context";
tag === null
- ? state.use === null &&
- reporter.error("Tag could be omitted only for .use()")
- : state.use === null &&
- (result = this._encodeComposite(tag, primitive, cls, content));
+ ? state.use === null && reporter.error("Tag could be omitted only for .use()")
+ : state.use === null && (result = this._encodeComposite(tag, primitive, cls, content));
}
- return (
- state.explicit !== null &&
- (result = this._encodeComposite(
- state.explicit,
- !1,
- "context",
- result,
- )),
- result
- );
+ return state.explicit !== null && (result = this._encodeComposite(state.explicit, !1, "context", result)), result;
};
Node.prototype._encodeChoice = function (data, reporter) {
let state = this._baseState,
node = state.choice[data.type];
return (
- node ||
- assert(
- !1,
- data.type +
- " not found in " +
- JSON.stringify(Object.keys(state.choice)),
- ),
+ node || assert(!1, data.type + " not found in " + JSON.stringify(Object.keys(state.choice))),
node._encode(data.value, reporter)
);
};
Node.prototype._encodePrimitive = function (tag, data) {
let state = this._baseState;
if (/str$/.test(tag)) return this._encodeStr(data, tag);
- if (tag === "objid" && state.args)
- return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
+ if (tag === "objid" && state.args) return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
if (tag === "objid") return this._encodeObjid(data, null, null);
- if (tag === "gentime" || tag === "utctime")
- return this._encodeTime(data, tag);
+ if (tag === "gentime" || tag === "utctime") return this._encodeTime(data, tag);
if (tag === "null_") return this._encodeNull();
- if (tag === "int" || tag === "enum")
- return this._encodeInt(data, state.args && state.reverseArgs[0]);
+ if (tag === "int" || tag === "enum") return this._encodeInt(data, state.args && state.reverseArgs[0]);
if (tag === "bool") return this._encodeBool(data);
if (tag === "objDesc") return this._encodeStr(data, tag);
throw new Error("Unsupported tag: " + tag);
@@ -21214,44 +18152,30 @@ var require_der2 = __commonJS({
Node.call(this, "der", parent);
}
inherits(DERNode, Node);
- DERNode.prototype._encodeComposite = function (
- tag,
- primitive,
- cls,
- content,
- ) {
+ DERNode.prototype._encodeComposite = function (tag, primitive, cls, content) {
let encodedTag = encodeTag(tag, primitive, cls, this.reporter);
if (content.length < 128) {
let header2 = Buffer2.alloc(2);
- return (
- (header2[0] = encodedTag),
- (header2[1] = content.length),
- this._createEncoderBuffer([header2, content])
- );
+ return (header2[0] = encodedTag), (header2[1] = content.length), this._createEncoderBuffer([header2, content]);
}
let lenOctets = 1;
for (let i = content.length; i >= 256; i >>= 8) lenOctets++;
let header = Buffer2.alloc(1 + 1 + lenOctets);
(header[0] = encodedTag), (header[1] = 128 | lenOctets);
- for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
- header[i] = j & 255;
+ for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) header[i] = j & 255;
return this._createEncoderBuffer([header, content]);
};
DERNode.prototype._encodeStr = function (str, tag) {
- if (tag === "bitstr")
- return this._createEncoderBuffer([str.unused | 0, str.data]);
+ if (tag === "bitstr") return this._createEncoderBuffer([str.unused | 0, str.data]);
if (tag === "bmpstr") {
let buf = Buffer2.alloc(str.length * 2);
- for (let i = 0; i < str.length; i++)
- buf.writeUInt16BE(str.charCodeAt(i), i * 2);
+ for (let i = 0; i < str.length; i++) buf.writeUInt16BE(str.charCodeAt(i), i * 2);
return this._createEncoderBuffer(buf);
} else
return tag === "numstr"
? this._isNumstr(str)
? this._createEncoderBuffer(str)
- : this.reporter.error(
- "Encoding of string type: numstr supports only digits and space",
- )
+ : this.reporter.error("Encoding of string type: numstr supports only digits and space")
: tag === "printstr"
? this._isPrintstr(str)
? this._createEncoderBuffer(str)
@@ -21262,18 +18186,12 @@ var require_der2 = __commonJS({
? this._createEncoderBuffer(str)
: tag === "objDesc"
? this._createEncoderBuffer(str)
- : this.reporter.error(
- "Encoding of string type: " + tag + " unsupported",
- );
+ : this.reporter.error("Encoding of string type: " + tag + " unsupported");
};
DERNode.prototype._encodeObjid = function (id, values, relative) {
if (typeof id == "string") {
- if (!values)
- return this.reporter.error(
- "string objid given, but no values map found",
- );
- if (!values.hasOwnProperty(id))
- return this.reporter.error("objid not found in values map");
+ if (!values) return this.reporter.error("string objid given, but no values map found");
+ if (!values.hasOwnProperty(id)) return this.reporter.error("objid not found in values map");
id = values[id].split(/[\s.]+/g);
for (let i = 0; i < id.length; i++) id[i] |= 0;
} else if (Array.isArray(id)) {
@@ -21281,13 +18199,9 @@ var require_der2 = __commonJS({
for (let i = 0; i < id.length; i++) id[i] |= 0;
}
if (!Array.isArray(id))
- return this.reporter.error(
- "objid() should be either array or string, got: " +
- JSON.stringify(id),
- );
+ return this.reporter.error("objid() should be either array or string, got: " + JSON.stringify(id));
if (!relative) {
- if (id[1] >= 40)
- return this.reporter.error("Second objid identifier OOB");
+ if (id[1] >= 40) return this.reporter.error("Second objid identifier OOB");
id.splice(0, 2, id[0] * 40 + id[1]);
}
let size = 0;
@@ -21299,8 +18213,7 @@ var require_der2 = __commonJS({
offset = objid.length - 1;
for (let i = id.length - 1; i >= 0; i--) {
let ident = id[i];
- for (objid[offset--] = ident & 127; (ident >>= 7) > 0; )
- objid[offset--] = 128 | (ident & 127);
+ for (objid[offset--] = ident & 127; (ident >>= 7) > 0; ) objid[offset--] = 128 | (ident & 127);
}
return this._createEncoderBuffer(objid);
};
@@ -21331,9 +18244,7 @@ var require_der2 = __commonJS({
two(date.getUTCSeconds()),
"Z",
].join(""))
- : this.reporter.error(
- "Encoding " + tag + " time is not supported yet",
- ),
+ : this.reporter.error("Encoding " + tag + " time is not supported yet"),
this._encodeStr(str, "octstr")
);
};
@@ -21342,51 +18253,34 @@ var require_der2 = __commonJS({
};
DERNode.prototype._encodeInt = function (num, values) {
if (typeof num == "string") {
- if (!values)
- return this.reporter.error(
- "String int or enum given, but no values map",
- );
+ if (!values) return this.reporter.error("String int or enum given, but no values map");
if (!values.hasOwnProperty(num))
- return this.reporter.error(
- "Values map doesn't contain: " + JSON.stringify(num),
- );
+ return this.reporter.error("Values map doesn't contain: " + JSON.stringify(num));
num = values[num];
}
if (typeof num != "number" && !Buffer2.isBuffer(num)) {
let numArray = num.toArray();
- !num.sign && numArray[0] & 128 && numArray.unshift(0),
- (num = Buffer2.from(numArray));
+ !num.sign && numArray[0] & 128 && numArray.unshift(0), (num = Buffer2.from(numArray));
}
if (Buffer2.isBuffer(num)) {
let size2 = num.length;
num.length === 0 && size2++;
let out2 = Buffer2.alloc(size2);
- return (
- num.copy(out2),
- num.length === 0 && (out2[0] = 0),
- this._createEncoderBuffer(out2)
- );
+ return num.copy(out2), num.length === 0 && (out2[0] = 0), this._createEncoderBuffer(out2);
}
if (num < 128) return this._createEncoderBuffer(num);
if (num < 256) return this._createEncoderBuffer([0, num]);
let size = 1;
for (let i = num; i >= 256; i >>= 8) size++;
let out = new Array(size);
- for (let i = out.length - 1; i >= 0; i--)
- (out[i] = num & 255), (num >>= 8);
- return (
- out[0] & 128 && out.unshift(0),
- this._createEncoderBuffer(Buffer2.from(out))
- );
+ for (let i = out.length - 1; i >= 0; i--) (out[i] = num & 255), (num >>= 8);
+ return out[0] & 128 && out.unshift(0), this._createEncoderBuffer(Buffer2.from(out));
};
DERNode.prototype._encodeBool = function (value) {
return this._createEncoderBuffer(value ? 255 : 0);
};
DERNode.prototype._use = function (entity, obj) {
- return (
- typeof entity == "function" && (entity = entity(obj)),
- entity._getEncoder("der").tree
- );
+ return typeof entity == "function" && (entity = entity(obj)), entity._getEncoder("der").tree;
};
DERNode.prototype._skipDefault = function (dataBuffer, reporter, parent) {
let state = this._baseState,
@@ -21395,32 +18289,22 @@ var require_der2 = __commonJS({
let data = dataBuffer.join();
if (
(state.defaultBuffer === void 0 &&
- (state.defaultBuffer = this._encodeValue(
- state.default,
- reporter,
- parent,
- ).join()),
+ (state.defaultBuffer = this._encodeValue(state.default, reporter, parent).join()),
data.length !== state.defaultBuffer.length)
)
return !1;
- for (i = 0; i < data.length; i++)
- if (data[i] !== state.defaultBuffer[i]) return !1;
+ for (i = 0; i < data.length; i++) if (data[i] !== state.defaultBuffer[i]) return !1;
return !0;
};
function encodeTag(tag, primitive, cls, reporter) {
let res;
- if (
- (tag === "seqof" ? (tag = "seq") : tag === "setof" && (tag = "set"),
- der.tagByName.hasOwnProperty(tag))
- )
+ if ((tag === "seqof" ? (tag = "seq") : tag === "setof" && (tag = "set"), der.tagByName.hasOwnProperty(tag)))
res = der.tagByName[tag];
else if (typeof tag == "number" && (tag | 0) === tag) res = tag;
else return reporter.error("Unknown tag: " + tag);
return res >= 31
? reporter.error("Multi-octet tag encoding unsupported")
- : (primitive || (res |= 32),
- (res |= der.tagClassByName[cls || "universal"] << 6),
- res);
+ : (primitive || (res |= 32), (res |= der.tagClassByName[cls || "universal"] << 6), res);
}
},
});
@@ -21478,8 +18362,7 @@ var require_der3 = __commonJS({
module.exports = DERDecoder;
DERDecoder.prototype.decode = function (data, options) {
return (
- DecoderBuffer.isDecoderBuffer(data) ||
- (data = new DecoderBuffer(data, options)),
+ DecoderBuffer.isDecoderBuffer(data) || (data = new DecoderBuffer(data, options)),
this.tree._decode(data, options)
);
};
@@ -21494,37 +18377,18 @@ var require_der3 = __commonJS({
return buffer.isError(decodedTag)
? decodedTag
: (buffer.restore(state),
- decodedTag.tag === tag ||
- decodedTag.tagStr === tag ||
- decodedTag.tagStr + "of" === tag ||
- any);
+ decodedTag.tag === tag || decodedTag.tagStr === tag || decodedTag.tagStr + "of" === tag || any);
};
DERNode.prototype._decodeTag = function (buffer, tag, any) {
- let decodedTag = derDecodeTag(
- buffer,
- 'Failed to decode tag of "' + tag + '"',
- );
+ let decodedTag = derDecodeTag(buffer, 'Failed to decode tag of "' + tag + '"');
if (buffer.isError(decodedTag)) return decodedTag;
- let len = derDecodeLen(
- buffer,
- decodedTag.primitive,
- 'Failed to get length of "' + tag + '"',
- );
+ let len = derDecodeLen(buffer, decodedTag.primitive, 'Failed to get length of "' + tag + '"');
if (buffer.isError(len)) return len;
- if (
- !any &&
- decodedTag.tag !== tag &&
- decodedTag.tagStr !== tag &&
- decodedTag.tagStr + "of" !== tag
- )
+ if (!any && decodedTag.tag !== tag && decodedTag.tagStr !== tag && decodedTag.tagStr + "of" !== tag)
return buffer.error('Failed to match tag: "' + tag + '"');
- if (decodedTag.primitive || len !== null)
- return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
+ if (decodedTag.primitive || len !== null) return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
let state = buffer.save(),
- res = this._skipUntilEnd(
- buffer,
- 'Failed to skip indefinite length body: "' + this.tag + '"',
- );
+ res = this._skipUntilEnd(buffer, 'Failed to skip indefinite length body: "' + this.tag + '"');
return buffer.isError(res)
? res
: ((len = buffer.offset - state.offset),
@@ -21539,9 +18403,7 @@ var require_der3 = __commonJS({
if (buffer.isError(len)) return len;
let res;
if (
- (tag.primitive || len !== null
- ? (res = buffer.skip(len))
- : (res = this._skipUntilEnd(buffer, fail)),
+ (tag.primitive || len !== null ? (res = buffer.skip(len)) : (res = this._skipUntilEnd(buffer, fail)),
buffer.isError(res))
)
return res;
@@ -21565,21 +18427,13 @@ var require_der3 = __commonJS({
return buffer.isError(unused) ? unused : { unused, data: buffer.raw() };
} else if (tag === "bmpstr") {
let raw = buffer.raw();
- if (raw.length % 2 === 1)
- return buffer.error(
- "Decoding of string type: bmpstr length mismatch",
- );
+ if (raw.length % 2 === 1) return buffer.error("Decoding of string type: bmpstr length mismatch");
let str = "";
- for (let i = 0; i < raw.length / 2; i++)
- str += String.fromCharCode(raw.readUInt16BE(i * 2));
+ for (let i = 0; i < raw.length / 2; i++) str += String.fromCharCode(raw.readUInt16BE(i * 2));
return str;
} else if (tag === "numstr") {
let numstr = buffer.raw().toString("ascii");
- return this._isNumstr(numstr)
- ? numstr
- : buffer.error(
- "Decoding of string type: numstr unsupported characters",
- );
+ return this._isNumstr(numstr) ? numstr : buffer.error("Decoding of string type: numstr unsupported characters");
} else {
if (tag === "octstr") return buffer.raw();
if (tag === "objDesc") return buffer.raw();
@@ -21587,9 +18441,7 @@ var require_der3 = __commonJS({
let printstr = buffer.raw().toString("ascii");
return this._isPrintstr(printstr)
? printstr
- : buffer.error(
- "Decoding of string type: printstr unsupported characters",
- );
+ : buffer.error("Decoding of string type: printstr unsupported characters");
} else
return /str$/.test(tag)
? buffer.raw().toString()
@@ -21609,15 +18461,9 @@ var require_der3 = __commonJS({
subident & 128 && identifiers.push(ident);
let first = (identifiers[0] / 40) | 0,
second = identifiers[0] % 40;
- if (
- (relative
- ? (result = identifiers)
- : (result = [first, second].concat(identifiers.slice(1))),
- values)
- ) {
+ if ((relative ? (result = identifiers) : (result = [first, second].concat(identifiers.slice(1))), values)) {
let tmp = values[result.join(" ")];
- tmp === void 0 && (tmp = values[result.join(".")]),
- tmp !== void 0 && (result = tmp);
+ tmp === void 0 && (tmp = values[result.join(".")]), tmp !== void 0 && (result = tmp);
}
return result;
};
@@ -21644,8 +18490,7 @@ var require_der3 = __commonJS({
(min = str.slice(8, 10) | 0),
(sec = str.slice(10, 12) | 0),
year < 70 ? (year = 2e3 + year) : (year = 1900 + year);
- else
- return buffer.error("Decoding " + tag + " time is not supported yet");
+ else return buffer.error("Decoding " + tag + " time is not supported yet");
return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
};
DERNode.prototype._decodeNull = function () {
@@ -21661,10 +18506,7 @@ var require_der3 = __commonJS({
return values && (res = values[res.toString(10)] || res), res;
};
DERNode.prototype._use = function (entity, obj) {
- return (
- typeof entity == "function" && (entity = entity(obj)),
- entity._getDecoder("der").tree
- );
+ return typeof entity == "function" && (entity = entity(obj)), entity._getDecoder("der").tree;
};
function derDecodeTag(buf, fail) {
let tag = buf.readUInt8(fail);
@@ -21735,8 +18577,7 @@ var require_pem2 = __commonJS({
break;
}
}
- if (start === -1 || end === -1)
- throw new Error("PEM section not found for: " + label);
+ if (start === -1 || end === -1) throw new Error("PEM section not found for: " + label);
let base64 = lines.slice(start + 1, end).join("");
base64.replace(/[^a-z0-9+/=]+/gi, "");
let input = Buffer2.from(base64, "base64");
@@ -21767,10 +18608,7 @@ var require_api = __commonJS({
return new Entity(name, body);
};
function Entity(name, body) {
- (this.name = name),
- (this.body = body),
- (this.decoders = {}),
- (this.encoders = {});
+ (this.name = name), (this.body = body), (this.decoders = {}), (this.encoders = {});
}
Entity.prototype._createNamed = function (Base) {
let name = this.name;
@@ -21788,8 +18626,7 @@ var require_api = __commonJS({
Entity.prototype._getDecoder = function (enc) {
return (
(enc = enc || "der"),
- this.decoders.hasOwnProperty(enc) ||
- (this.decoders[enc] = this._createNamed(decoders[enc])),
+ this.decoders.hasOwnProperty(enc) || (this.decoders[enc] = this._createNamed(decoders[enc])),
this.decoders[enc]
);
};
@@ -21799,8 +18636,7 @@ var require_api = __commonJS({
Entity.prototype._getEncoder = function (enc) {
return (
(enc = enc || "der"),
- this.encoders.hasOwnProperty(enc) ||
- (this.encoders[enc] = this._createNamed(encoders[enc])),
+ this.encoders.hasOwnProperty(enc) || (this.encoders[enc] = this._createNamed(encoders[enc])),
this.encoders[enc]
);
};
@@ -21878,17 +18714,11 @@ var require_certificate = __commonJS({
);
}),
SubjectPublicKeyInfo = asn.define("SubjectPublicKeyInfo", function () {
- this.seq().obj(
- this.key("algorithm").use(AlgorithmIdentifier),
- this.key("subjectPublicKey").bitstr(),
- );
+ this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier), this.key("subjectPublicKey").bitstr());
+ }),
+ RelativeDistinguishedName = asn.define("RelativeDistinguishedName", function () {
+ this.setof(AttributeTypeValue);
}),
- RelativeDistinguishedName = asn.define(
- "RelativeDistinguishedName",
- function () {
- this.setof(AttributeTypeValue);
- },
- ),
RDNSequence = asn.define("RDNSequence", function () {
this.seqof(RelativeDistinguishedName);
}),
@@ -21898,17 +18728,10 @@ var require_certificate = __commonJS({
});
}),
Validity = asn.define("Validity", function () {
- this.seq().obj(
- this.key("notBefore").use(Time),
- this.key("notAfter").use(Time),
- );
+ this.seq().obj(this.key("notBefore").use(Time), this.key("notAfter").use(Time));
}),
Extension = asn.define("Extension", function () {
- this.seq().obj(
- this.key("extnID").objid(),
- this.key("critical").bool().def(!1),
- this.key("extnValue").octstr(),
- );
+ this.seq().obj(this.key("extnID").objid(), this.key("critical").bool().def(!1), this.key("extnValue").octstr());
}),
TBSCertificate = asn.define("TBSCertificate", function () {
this.seq().obj(
@@ -21956,17 +18779,11 @@ var require_asn12 = __commonJS({
});
exports.RSAPrivateKey = RSAPrivateKey;
var RSAPublicKey = asn1.define("RSAPublicKey", function () {
- this.seq().obj(
- this.key("modulus").int(),
- this.key("publicExponent").int(),
- );
+ this.seq().obj(this.key("modulus").int(), this.key("publicExponent").int());
});
exports.RSAPublicKey = RSAPublicKey;
var PublicKey = asn1.define("SubjectPublicKeyInfo", function () {
- this.seq().obj(
- this.key("algorithm").use(AlgorithmIdentifier),
- this.key("subjectPublicKey").bitstr(),
- );
+ this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier), this.key("subjectPublicKey").bitstr());
});
exports.PublicKey = PublicKey;
var AlgorithmIdentifier = asn1.define("AlgorithmIdentifier", function () {
@@ -21974,10 +18791,7 @@ var require_asn12 = __commonJS({
this.key("algorithm").objid(),
this.key("none").null_().optional(),
this.key("curve").objid().optional(),
- this.key("params")
- .seq()
- .obj(this.key("p").int(), this.key("q").int(), this.key("g").int())
- .optional(),
+ this.key("params").seq().obj(this.key("p").int(), this.key("q").int(), this.key("g").int()).optional(),
);
}),
PrivateKeyInfo = asn1.define("PrivateKeyInfo", function () {
@@ -21988,37 +18802,27 @@ var require_asn12 = __commonJS({
);
});
exports.PrivateKey = PrivateKeyInfo;
- var EncryptedPrivateKeyInfo = asn1.define(
- "EncryptedPrivateKeyInfo",
- function () {
- this.seq().obj(
- this.key("algorithm")
- .seq()
- .obj(
- this.key("id").objid(),
- this.key("decrypt")
- .seq()
- .obj(
- this.key("kde")
- .seq()
- .obj(
- this.key("id").objid(),
- this.key("kdeparams")
- .seq()
- .obj(
- this.key("salt").octstr(),
- this.key("iters").int(),
- ),
- ),
- this.key("cipher")
- .seq()
- .obj(this.key("algo").objid(), this.key("iv").octstr()),
- ),
- ),
- this.key("subjectPrivateKey").octstr(),
- );
- },
- );
+ var EncryptedPrivateKeyInfo = asn1.define("EncryptedPrivateKeyInfo", function () {
+ this.seq().obj(
+ this.key("algorithm")
+ .seq()
+ .obj(
+ this.key("id").objid(),
+ this.key("decrypt")
+ .seq()
+ .obj(
+ this.key("kde")
+ .seq()
+ .obj(
+ this.key("id").objid(),
+ this.key("kdeparams").seq().obj(this.key("salt").octstr(), this.key("iters").int()),
+ ),
+ this.key("cipher").seq().obj(this.key("algo").objid(), this.key("iv").octstr()),
+ ),
+ ),
+ this.key("subjectPrivateKey").octstr(),
+ );
+ });
exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;
var DSAPrivateKey = asn1.define("DSAPrivateKey", function () {
this.seq().obj(
@@ -22080,8 +18884,7 @@ var require_fixProc = __commonJS({
var findProc =
/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,
startRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,
- fullRegex =
- /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,
+ fullRegex = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,
evp = require_evp_bytestokey(),
ciphers = require_browser5(),
Buffer2 = require_safe_buffer().Buffer;
@@ -22096,9 +18899,7 @@ var require_fixProc = __commonJS({
cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key,
out = [],
cipher = ciphers.createDecipheriv(suite, cipherKey, iv);
- out.push(cipher.update(cipherText)),
- out.push(cipher.final()),
- (decrypted = Buffer2.concat(out));
+ out.push(cipher.update(cipherText)), out.push(cipher.final()), (decrypted = Buffer2.concat(out));
} else {
var match2 = key.match(fullRegex);
decrypted = Buffer2.from(match2[2].replace(/[\r\n]/g, ""), "base64");
@@ -22124,9 +18925,7 @@ var require_parse_asn1 = __commonJS({
module.exports = parseKeys;
function parseKeys(buffer) {
var password;
- typeof buffer == "object" &&
- !Buffer2.isBuffer(buffer) &&
- ((password = buffer.passphrase), (buffer = buffer.key)),
+ typeof buffer == "object" && !Buffer2.isBuffer(buffer) && ((password = buffer.passphrase), (buffer = buffer.key)),
typeof buffer == "string" && (buffer = Buffer2.from(buffer));
var stripped = fixProc(buffer, password),
type = stripped.tag,
@@ -22135,8 +18934,7 @@ var require_parse_asn1 = __commonJS({
ndata;
switch (type) {
case "CERTIFICATE":
- ndata = asn1.certificate.decode(data, "der").tbsCertificate
- .subjectPublicKeyInfo;
+ ndata = asn1.certificate.decode(data, "der").tbsCertificate.subjectPublicKeyInfo;
case "PUBLIC KEY":
switch (
(ndata || (ndata = asn1.PublicKey.decode(data, "der")),
@@ -22144,10 +18942,7 @@ var require_parse_asn1 = __commonJS({
subtype)
) {
case "1.2.840.113549.1.1.1":
- return asn1.RSAPublicKey.decode(
- ndata.subjectPublicKey.data,
- "der",
- );
+ return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, "der");
case "1.2.840.10045.2.1":
return (
(ndata.subjectPrivateKey = ndata.subjectPublicKey),
@@ -22158,10 +18953,7 @@ var require_parse_asn1 = __commonJS({
);
case "1.2.840.10040.4.1":
return (
- (ndata.algorithm.params.pub_key = asn1.DSAparam.decode(
- ndata.subjectPublicKey.data,
- "der",
- )),
+ (ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, "der")),
{
type: "dsa",
data: ndata.algorithm.params,
@@ -22171,30 +18963,21 @@ var require_parse_asn1 = __commonJS({
throw new Error("unknown key id " + subtype);
}
case "ENCRYPTED PRIVATE KEY":
- (data = asn1.EncryptedPrivateKey.decode(data, "der")),
- (data = decrypt(data, password));
+ (data = asn1.EncryptedPrivateKey.decode(data, "der")), (data = decrypt(data, password));
case "PRIVATE KEY":
switch (
- ((ndata = asn1.PrivateKey.decode(data, "der")),
- (subtype = ndata.algorithm.algorithm.join(".")),
- subtype)
+ ((ndata = asn1.PrivateKey.decode(data, "der")), (subtype = ndata.algorithm.algorithm.join(".")), subtype)
) {
case "1.2.840.113549.1.1.1":
return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, "der");
case "1.2.840.10045.2.1":
return {
curve: ndata.algorithm.curve,
- privateKey: asn1.ECPrivateKey.decode(
- ndata.subjectPrivateKey,
- "der",
- ).privateKey,
+ privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, "der").privateKey,
};
case "1.2.840.10040.4.1":
return (
- (ndata.algorithm.params.priv_key = asn1.DSAparam.decode(
- ndata.subjectPrivateKey,
- "der",
- )),
+ (ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, "der")),
{
type: "dsa",
params: ndata.algorithm.params,
@@ -22227,10 +19010,7 @@ var require_parse_asn1 = __commonJS({
parseKeys.signature = asn1.signature;
function decrypt(data, password) {
var salt = data.algorithm.decrypt.kde.kdeparams.salt,
- iters = parseInt(
- data.algorithm.decrypt.kde.kdeparams.iters.toString(),
- 10,
- ),
+ iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10),
algo = aesid[data.algorithm.decrypt.cipher.algo.join(".")],
iv = data.algorithm.decrypt.cipher.iv,
cipherText = data.subjectPrivateKey,
@@ -22238,11 +19018,7 @@ var require_parse_asn1 = __commonJS({
key = compat.pbkdf2Sync(password, salt, iters, keylen, "sha1"),
cipher = ciphers.createDecipheriv(algo, key, iv),
out = [];
- return (
- out.push(cipher.update(cipherText)),
- out.push(cipher.final()),
- Buffer2.concat(out)
- );
+ return out.push(cipher.update(cipherText)), out.push(cipher.final()), Buffer2.concat(out);
}
},
});
@@ -22274,21 +19050,14 @@ var require_sign = __commonJS({
function sign(hash, key, hashType, signType, tag) {
var priv = parseKeys(key);
if (priv.curve) {
- if (signType !== "ecdsa" && signType !== "ecdsa/rsa")
- throw new Error("wrong private key type");
+ if (signType !== "ecdsa" && signType !== "ecdsa/rsa") throw new Error("wrong private key type");
return ecSign(hash, priv);
} else if (priv.type === "dsa") {
if (signType !== "dsa") throw new Error("wrong private key type");
return dsaSign(hash, priv, hashType);
- } else if (signType !== "rsa" && signType !== "ecdsa/rsa")
- throw new Error("wrong private key type");
+ } else if (signType !== "rsa" && signType !== "ecdsa/rsa") throw new Error("wrong private key type");
hash = Buffer2.concat([tag, hash]);
- for (
- var len = priv.modulus.byteLength(), pad = [0, 1];
- hash.length + pad.length + 1 < len;
-
- )
- pad.push(255);
+ for (var len = priv.modulus.byteLength(), pad = [0, 1]; hash.length + pad.length + 1 < len; ) pad.push(255);
pad.push(0);
for (var i = -1; ++i < hash.length; ) pad.push(hash[i]);
var out = crt(pad, priv);
@@ -22326,10 +19095,7 @@ var require_sign = __commonJS({
return toDER(r, s);
}
function toDER(r, s) {
- (r = r.toArray()),
- (s = s.toArray()),
- r[0] & 128 && (r = [0].concat(r)),
- s[0] & 128 && (s = [0].concat(s));
+ (r = r.toArray()), (s = s.toArray()), r[0] & 128 && (r = [0].concat(r)), s[0] & 128 && (s = [0].concat(s));
var total = r.length + s.length + 4,
res = [48, total, 2, r.length];
return (res = res.concat(r, [2, s.length], s)), Buffer2.from(res);
@@ -22380,8 +19146,7 @@ var require_sign = __commonJS({
var t, k;
do {
for (t = Buffer2.alloc(0); t.length * 8 < q.bitLength(); )
- (kv.v = createHmac(algo, kv.k).update(kv.v).digest()),
- (t = Buffer2.concat([t, kv.v]));
+ (kv.v = createHmac(algo, kv.k).update(kv.v).digest()), (t = Buffer2.concat([t, kv.v]));
(k = bits2int(t, q)),
(kv.k = createHmac(algo, kv.k)
.update(kv.v)
@@ -22411,20 +19176,14 @@ var require_verify = __commonJS({
function verify(sig, hash, key, signType, tag) {
var pub = parseKeys(key);
if (pub.type === "ec") {
- if (signType !== "ecdsa" && signType !== "ecdsa/rsa")
- throw new Error("wrong public key type");
+ if (signType !== "ecdsa" && signType !== "ecdsa/rsa") throw new Error("wrong public key type");
return ecVerify(sig, hash, pub);
} else if (pub.type === "dsa") {
if (signType !== "dsa") throw new Error("wrong public key type");
return dsaVerify(sig, hash, pub);
- } else if (signType !== "rsa" && signType !== "ecdsa/rsa")
- throw new Error("wrong public key type");
+ } else if (signType !== "rsa" && signType !== "ecdsa/rsa") throw new Error("wrong public key type");
hash = Buffer2.concat([tag, hash]);
- for (
- var len = pub.modulus.byteLength(), pad = [1], padNum = 0;
- hash.length + pad.length + 2 < len;
-
- )
+ for (var len = pub.modulus.byteLength(), pad = [1], padNum = 0; hash.length + pad.length + 2 < len; )
pad.push(255), padNum++;
pad.push(0);
for (var i = -1; ++i < hash.length; ) pad.push(hash[i]);
@@ -22434,20 +19193,13 @@ var require_verify = __commonJS({
(sig = sig.redPow(new BN(pub.publicExponent))),
(sig = Buffer2.from(sig.fromRed().toArray()));
var out = padNum < 8 ? 1 : 0;
- for (
- len = Math.min(sig.length, pad.length),
- sig.length !== pad.length && (out = 1),
- i = -1;
- ++i < len;
-
- )
+ for (len = Math.min(sig.length, pad.length), sig.length !== pad.length && (out = 1), i = -1; ++i < len; )
out |= sig[i] ^ pad[i];
return out === 0;
}
function ecVerify(sig, hash, pub) {
var curveId = curves[pub.data.algorithm.curve.join(".")];
- if (!curveId)
- throw new Error("unknown curve " + pub.data.algorithm.curve.join("."));
+ if (!curveId) throw new Error("unknown curve " + pub.data.algorithm.curve.join("."));
var curve = new EC(curveId),
pubkey = pub.data.subjectPrivateKey.data;
return curve.verify(hash, sig, pubkey);
@@ -22491,8 +19243,7 @@ var require_browser8 = __commonJS({
verify = require_verify(),
algorithms = require_algorithms();
Object.keys(algorithms).forEach(function (key) {
- (algorithms[key].id = Buffer2.from(algorithms[key].id, "hex")),
- (algorithms[key.toLowerCase()] = algorithms[key]);
+ (algorithms[key].id = Buffer2.from(algorithms[key].id, "hex")), (algorithms[key.toLowerCase()] = algorithms[key]);
});
function Sign(algorithm) {
stream.Writable.call(this);
@@ -22508,11 +19259,7 @@ var require_browser8 = __commonJS({
this._hash.update(data), done();
};
Sign.prototype.update = function (data, enc) {
- return (
- typeof data == "string" && (data = Buffer2.from(data, enc)),
- this._hash.update(data),
- this
- );
+ return typeof data == "string" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;
};
Sign.prototype.sign = function (key, enc) {
this.end();
@@ -22524,20 +19271,14 @@ var require_browser8 = __commonJS({
stream.Writable.call(this);
var data = algorithms[algorithm];
if (!data) throw new Error("Unknown message digest");
- (this._hash = createHash(data.hash)),
- (this._tag = data.id),
- (this._signType = data.sign);
+ (this._hash = createHash(data.hash)), (this._tag = data.id), (this._signType = data.sign);
}
inherits(Verify, stream.Writable);
Verify.prototype._write = function (data, _, done) {
this._hash.update(data), done();
};
Verify.prototype.update = function (data, enc) {
- return (
- typeof data == "string" && (data = Buffer2.from(data, enc)),
- this._hash.update(data),
- this
- );
+ return typeof data == "string" && (data = Buffer2.from(data, enc)), this._hash.update(data), this;
};
Verify.prototype.verify = function (key, sig, enc) {
typeof sig == "string" && (sig = Buffer2.from(sig, enc)), this.end();
@@ -22584,9 +19325,7 @@ var require_bn6 = __commonJS({
((base === "le" || base === "be") && ((endian = base), (base = 10)),
this._init(number || 0, base || 10, endian || "be"));
}
- typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN),
- (BN.BN = BN),
- (BN.wordSize = 26);
+ typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN), (BN.BN = BN), (BN.wordSize = 26);
var Buffer2;
try {
typeof window < "u" && typeof window.Buffer < "u"
@@ -22608,10 +19347,8 @@ var require_bn6 = __commonJS({
return left.cmp(right) < 0 ? left : right;
}),
(BN.prototype._init = function (number, base, endian) {
- if (typeof number == "number")
- return this._initNumber(number, base, endian);
- if (typeof number == "object")
- return this._initArray(number, base, endian);
+ if (typeof number == "number") return this._initNumber(number, base, endian);
+ if (typeof number == "object") return this._initArray(number, base, endian);
base === "hex" && (base = 16),
assert(base === (base | 0) && base >= 2 && base <= 36),
(number = number.toString().replace(/\s+/g, ""));
@@ -22621,33 +19358,23 @@ var require_bn6 = __commonJS({
(base === 16
? this._parseHex(number, start, endian)
: (this._parseBase(number, base, start),
- endian === "le" &&
- this._initArray(this.toArray(), base, endian)));
+ endian === "le" && this._initArray(this.toArray(), base, endian)));
}),
(BN.prototype._initNumber = function (number, base, endian) {
number < 0 && ((this.negative = 1), (number = -number)),
number < 67108864
? ((this.words = [number & 67108863]), (this.length = 1))
: number < 4503599627370496
- ? ((this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- ]),
- (this.length = 2))
+ ? ((this.words = [number & 67108863, (number / 67108864) & 67108863]), (this.length = 2))
: (assert(number < 9007199254740992),
- (this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- 1,
- ]),
+ (this.words = [number & 67108863, (number / 67108864) & 67108863, 1]),
(this.length = 3)),
endian === "le" && this._initArray(this.toArray(), base, endian);
}),
(BN.prototype._initArray = function (number, base, endian) {
if ((assert(typeof number.length == "number"), number.length <= 0))
return (this.words = [0]), (this.length = 1), this;
- (this.length = Math.ceil(number.length / 3)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil(number.length / 3)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var j,
w,
@@ -22670,23 +19397,14 @@ var require_bn6 = __commonJS({
});
function parseHex4Bits(string, index) {
var c = string.charCodeAt(index);
- return c >= 65 && c <= 70
- ? c - 55
- : c >= 97 && c <= 102
- ? c - 87
- : (c - 48) & 15;
+ return c >= 65 && c <= 70 ? c - 55 : c >= 97 && c <= 102 ? c - 87 : (c - 48) & 15;
}
function parseHexByte(string, lowerBound, index) {
var r = parseHex4Bits(string, index);
- return (
- index - 1 >= lowerBound &&
- (r |= parseHex4Bits(string, index - 1) << 4),
- r
- );
+ return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;
}
BN.prototype._parseHex = function (number, start, endian) {
- (this.length = Math.ceil((number.length - start) / 6)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil((number.length - start) / 6)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var off = 0,
j = 0,
@@ -22695,44 +19413,26 @@ var require_bn6 = __commonJS({
for (i = number.length - 1; i >= start; i -= 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
else {
var parseLength = number.length - start;
- for (
- i = parseLength % 2 === 0 ? start + 1 : start;
- i < number.length;
- i += 2
- )
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
}
this.strip();
};
function parseBase(str, start, end, mul) {
- for (
- var r = 0, len = Math.min(str.length, end), i = start;
- i < len;
- i++
- ) {
+ for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
var c = str.charCodeAt(i) - 48;
- (r *= mul),
- c >= 49
- ? (r += c - 49 + 10)
- : c >= 17
- ? (r += c - 17 + 10)
- : (r += c);
+ (r *= mul), c >= 49 ? (r += c - 49 + 10) : c >= 17 ? (r += c - 17 + 10) : (r += c);
}
return r;
}
(BN.prototype._parseBase = function (number, base, start) {
(this.words = [0]), (this.length = 1);
- for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base)
- limbLen++;
+ for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
limbLen--, (limbPow = (limbPow / base) | 0);
for (
var total = number.length - start,
@@ -22745,30 +19445,18 @@ var require_bn6 = __commonJS({
)
(word = parseBase(number, i, i + limbLen, base)),
this.imuln(limbPow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
if (mod !== 0) {
var pow = 1;
- for (
- word = parseBase(number, i, number.length, base), i = 0;
- i < mod;
- i++
- )
- pow *= base;
- this.imuln(pow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
+ this.imuln(pow), this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
}
this.strip();
}),
(BN.prototype.copy = function (dest) {
dest.words = new Array(this.length);
for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
- (dest.length = this.length),
- (dest.negative = this.negative),
- (dest.red = this.red);
+ (dest.length = this.length), (dest.negative = this.negative), (dest.red = this.red);
}),
(BN.prototype.clone = function () {
var r = new BN(null);
@@ -22779,15 +19467,11 @@ var require_bn6 = __commonJS({
return this;
}),
(BN.prototype.strip = function () {
- for (; this.length > 1 && this.words[this.length - 1] === 0; )
- this.length--;
+ for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
return this._normSign();
}),
(BN.prototype._normSign = function () {
- return (
- this.length === 1 && this.words[0] === 0 && (this.negative = 0),
- this
- );
+ return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}),
(BN.prototype.inspect = function () {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -22821,15 +19505,13 @@ var require_bn6 = __commonJS({
"0000000000000000000000000",
],
groupSizes = [
- 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5,
],
groupBases = [
- 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607,
- 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536,
- 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101,
- 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368,
- 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
+ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808,
+ 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624,
+ 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
60466176,
];
(BN.prototype.toString = function (base, padding) {
@@ -22841,18 +19523,11 @@ var require_bn6 = __commonJS({
var w = this.words[i],
word = (((w << off) | carry) & 16777215).toString(16);
(carry = (w >>> (24 - off)) & 16777215),
- carry !== 0 || i !== this.length - 1
- ? (out = zeros[6 - word.length] + word + out)
- : (out = word + out),
+ carry !== 0 || i !== this.length - 1 ? (out = zeros[6 - word.length] + word + out) : (out = word + out),
(off += 2),
off >= 26 && ((off -= 26), i--);
}
- for (
- carry !== 0 && (out = carry.toString(16) + out);
- out.length % padding !== 0;
-
- )
- out = "0" + out;
+ for (carry !== 0 && (out = carry.toString(16) + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
if (base === (base | 0) && base >= 2 && base <= 36) {
@@ -22862,13 +19537,9 @@ var require_bn6 = __commonJS({
var c = this.clone();
for (c.negative = 0; !c.isZero(); ) {
var r = c.modn(groupBase).toString(base);
- (c = c.idivn(groupBase)),
- c.isZero()
- ? (out = r + out)
- : (out = zeros[groupSize - r.length] + r + out);
+ (c = c.idivn(groupBase)), c.isZero() ? (out = r + out) : (out = zeros[groupSize - r.length] + r + out);
}
- for (this.isZero() && (out = "0" + out); out.length % padding !== 0; )
- out = "0" + out;
+ for (this.isZero() && (out = "0" + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
assert(!1, "Base should be between 2 and 36");
@@ -22880,8 +19551,7 @@ var require_bn6 = __commonJS({
? (ret += this.words[1] * 67108864)
: this.length === 3 && this.words[2] === 1
? (ret += 4503599627370496 + this.words[1] * 67108864)
- : this.length > 2 &&
- assert(!1, "Number can only safely store up to 53 bits"),
+ : this.length > 2 && assert(!1, "Number can only safely store up to 53 bits"),
this.negative !== 0 ? -ret : ret
);
}),
@@ -22889,10 +19559,7 @@ var require_bn6 = __commonJS({
return this.toString(16);
}),
(BN.prototype.toBuffer = function (endian, length) {
- return (
- assert(typeof Buffer2 < "u"),
- this.toArrayLike(Buffer2, endian, length)
- );
+ return assert(typeof Buffer2 < "u"), this.toArrayLike(Buffer2, endian, length);
}),
(BN.prototype.toArray = function (endian, length) {
return this.toArrayLike(Array, endian, length);
@@ -22900,10 +19567,7 @@ var require_bn6 = __commonJS({
(BN.prototype.toArrayLike = function (ArrayType, endian, length) {
var byteLength = this.byteLength(),
reqLength = length || Math.max(1, byteLength);
- assert(
- byteLength <= reqLength,
- "byte array longer than desired length",
- ),
+ assert(byteLength <= reqLength, "byte array longer than desired length"),
assert(reqLength > 0, "Requested array length <= 0"),
this.strip();
var littleEndian = endian === "le",
@@ -22912,13 +19576,11 @@ var require_bn6 = __commonJS({
i,
q = this.clone();
if (littleEndian) {
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[i] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[i] = b);
for (; i < reqLength; i++) res[i] = 0;
} else {
for (i = 0; i < reqLength - byteLength; i++) res[i] = 0;
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
}
return res;
}),
@@ -22956,11 +19618,7 @@ var require_bn6 = __commonJS({
return (this.length - 1) * 26 + hi;
});
function toBitArray(num) {
- for (
- var w = new Array(num.bitLength()), bit = 0;
- bit < w.length;
- bit++
- ) {
+ for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
var off = (bit / 26) | 0,
wbit = bit % 26;
w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
@@ -22979,14 +19637,10 @@ var require_bn6 = __commonJS({
return Math.ceil(this.bitLength() / 8);
}),
(BN.prototype.toTwos = function (width) {
- return this.negative !== 0
- ? this.abs().inotn(width).iaddn(1)
- : this.clone();
+ return this.negative !== 0 ? this.abs().inotn(width).iaddn(1) : this.clone();
}),
(BN.prototype.fromTwos = function (width) {
- return this.testn(width - 1)
- ? this.notn(width).iaddn(1).ineg()
- : this.clone();
+ return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
}),
(BN.prototype.isNeg = function () {
return this.negative !== 0;
@@ -22999,50 +19653,37 @@ var require_bn6 = __commonJS({
}),
(BN.prototype.iuor = function (num) {
for (; this.length < num.length; ) this.words[this.length++] = 0;
- for (var i = 0; i < num.length; i++)
- this.words[i] = this.words[i] | num.words[i];
+ for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
return this.strip();
}),
(BN.prototype.ior = function (num) {
return assert((this.negative | num.negative) === 0), this.iuor(num);
}),
(BN.prototype.or = function (num) {
- return this.length > num.length
- ? this.clone().ior(num)
- : num.clone().ior(this);
+ return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
}),
(BN.prototype.uor = function (num) {
- return this.length > num.length
- ? this.clone().iuor(num)
- : num.clone().iuor(this);
+ return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
}),
(BN.prototype.iuand = function (num) {
var b;
this.length > num.length ? (b = num) : (b = this);
- for (var i = 0; i < b.length; i++)
- this.words[i] = this.words[i] & num.words[i];
+ for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
return (this.length = b.length), this.strip();
}),
(BN.prototype.iand = function (num) {
return assert((this.negative | num.negative) === 0), this.iuand(num);
}),
(BN.prototype.and = function (num) {
- return this.length > num.length
- ? this.clone().iand(num)
- : num.clone().iand(this);
+ return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
}),
(BN.prototype.uand = function (num) {
- return this.length > num.length
- ? this.clone().iuand(num)
- : num.clone().iuand(this);
+ return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
}),
(BN.prototype.iuxor = function (num) {
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
- for (var i = 0; i < b.length; i++)
- this.words[i] = a.words[i] ^ b.words[i];
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
+ for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
if (this !== a) for (; i < a.length; i++) this.words[i] = a.words[i];
return (this.length = a.length), this.strip();
}),
@@ -23050,27 +19691,18 @@ var require_bn6 = __commonJS({
return assert((this.negative | num.negative) === 0), this.iuxor(num);
}),
(BN.prototype.xor = function (num) {
- return this.length > num.length
- ? this.clone().ixor(num)
- : num.clone().ixor(this);
+ return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
}),
(BN.prototype.uxor = function (num) {
- return this.length > num.length
- ? this.clone().iuxor(num)
- : num.clone().iuxor(this);
+ return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
}),
(BN.prototype.inotn = function (width) {
assert(typeof width == "number" && width >= 0);
var bytesNeeded = Math.ceil(width / 26) | 0,
bitsLeft = width % 26;
this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;
- for (var i = 0; i < bytesNeeded; i++)
- this.words[i] = ~this.words[i] & 67108863;
- return (
- bitsLeft > 0 &&
- (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))),
- this.strip()
- );
+ for (var i = 0; i < bytesNeeded; i++) this.words[i] = ~this.words[i] & 67108863;
+ return bitsLeft > 0 && (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))), this.strip();
}),
(BN.prototype.notn = function (width) {
return this.clone().inotn(width);
@@ -23090,49 +19722,25 @@ var require_bn6 = __commonJS({
(BN.prototype.iadd = function (num) {
var r;
if (this.negative !== 0 && num.negative === 0)
- return (
- (this.negative = 0),
- (r = this.isub(num)),
- (this.negative ^= 1),
- this._normSign()
- );
+ return (this.negative = 0), (r = this.isub(num)), (this.negative ^= 1), this._normSign();
if (this.negative === 0 && num.negative !== 0)
- return (
- (num.negative = 0),
- (r = this.isub(num)),
- (num.negative = 1),
- r._normSign()
- );
+ return (num.negative = 0), (r = this.isub(num)), (num.negative = 1), r._normSign();
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) + (b.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
+ (r = (a.words[i] | 0) + (b.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
- if (((this.length = a.length), carry !== 0))
- (this.words[this.length] = carry), this.length++;
- else if (a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
+ (r = (a.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
+ if (((this.length = a.length), carry !== 0)) (this.words[this.length] = carry), this.length++;
+ else if (a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
return this;
}),
(BN.prototype.add = function (num) {
var res;
return num.negative !== 0 && this.negative === 0
- ? ((num.negative = 0),
- (res = this.sub(num)),
- (num.negative ^= 1),
- res)
+ ? ((num.negative = 0), (res = this.sub(num)), (num.negative ^= 1), res)
: num.negative === 0 && this.negative !== 0
- ? ((this.negative = 0),
- (res = num.sub(this)),
- (this.negative = 1),
- res)
+ ? ((this.negative = 0), (res = num.sub(this)), (this.negative = 1), res)
: this.length > num.length
? this.clone().iadd(num)
: num.clone().iadd(this);
@@ -23143,34 +19751,17 @@ var require_bn6 = __commonJS({
var r = this.iadd(num);
return (num.negative = 1), r._normSign();
} else if (this.negative !== 0)
- return (
- (this.negative = 0),
- this.iadd(num),
- (this.negative = 1),
- this._normSign()
- );
+ return (this.negative = 0), this.iadd(num), (this.negative = 1), this._normSign();
var cmp = this.cmp(num);
- if (cmp === 0)
- return (
- (this.negative = 0), (this.length = 1), (this.words[0] = 0), this
- );
+ if (cmp === 0) return (this.negative = 0), (this.length = 1), (this.words[0] = 0), this;
var a, b;
cmp > 0 ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) - (b.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
+ (r = (a.words[i] | 0) - (b.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
- if (carry === 0 && i < a.length && a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
- return (
- (this.length = Math.max(this.length, i)),
- a !== this && (this.negative = 1),
- this.strip()
- );
+ (r = (a.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
+ if (carry === 0 && i < a.length && a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
+ return (this.length = Math.max(this.length, i)), a !== this && (this.negative = 1), this.strip();
}),
(BN.prototype.sub = function (num) {
return this.clone().isub(num);
@@ -23203,9 +19794,7 @@ var require_bn6 = __commonJS({
}
(out.words[k] = rword | 0), (carry = ncarry | 0);
}
- return (
- carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip()
- );
+ return carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip();
}
var comb10MulTo = function (self2, num, out) {
var a = self2.words,
@@ -23760,15 +20349,12 @@ var require_bn6 = __commonJS({
};
Math.imul || (comb10MulTo = smallMulTo);
function bigMulTo(self2, num, out) {
- (out.negative = num.negative ^ self2.negative),
- (out.length = self2.length + num.length);
+ (out.negative = num.negative ^ self2.negative), (out.length = self2.length + num.length);
for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
var ncarry = hncarry;
hncarry = 0;
for (
- var rword = carry & 67108863,
- maxJ = Math.min(k, num.length - 1),
- j = Math.max(0, k - self2.length + 1);
+ var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);
j <= maxJ;
j++
) {
@@ -23810,32 +20396,22 @@ var require_bn6 = __commonJS({
(this.x = x), (this.y = y);
}
(FFTM.prototype.makeRBT = function (N) {
- for (
- var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0;
- i < N;
- i++
- )
- t[i] = this.revBin(i, l, N);
+ for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
return t;
}),
(FFTM.prototype.revBin = function (x, l, N) {
if (x === 0 || x === N - 1) return x;
- for (var rb = 0, i = 0; i < l; i++)
- (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
+ for (var rb = 0, i = 0; i < l; i++) (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
return rb;
}),
(FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++)
- (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
+ for (var i = 0; i < N; i++) (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
}),
(FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) {
this.permute(rbt, rws, iws, rtws, itws, N);
for (var s = 1; s < N; s <<= 1)
for (
- var l = s << 1,
- rtwdf = Math.cos((2 * Math.PI) / l),
- itwdf = Math.sin((2 * Math.PI) / l),
- p = 0;
+ var l = s << 1, rtwdf = Math.cos((2 * Math.PI) / l), itwdf = Math.sin((2 * Math.PI) / l), p = 0;
p < N;
p += l
)
@@ -23852,9 +20428,7 @@ var require_bn6 = __commonJS({
(rtws[p + j + s] = re - ro),
(itws[p + j + s] = ie - io),
j !== l &&
- ((rx = rtwdf * rtwdf_ - itwdf * itwdf_),
- (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_),
- (rtwdf_ = rx));
+ ((rx = rtwdf * rtwdf_ - itwdf * itwdf_), (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_), (rtwdf_ = rx));
}
}),
(FFTM.prototype.guessLen13b = function (n, m) {
@@ -23877,12 +20451,8 @@ var require_bn6 = __commonJS({
}),
(FFTM.prototype.normalize13b = function (ws, N) {
for (var carry = 0, i = 0; i < N / 2; i++) {
- var w =
- Math.round(ws[2 * i + 1] / N) * 8192 +
- Math.round(ws[2 * i] / N) +
- carry;
- (ws[i] = w & 67108863),
- w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
+ var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;
+ (ws[i] = w & 67108863), w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
}
return ws;
}),
@@ -23932,17 +20502,11 @@ var require_bn6 = __commonJS({
}),
(BN.prototype.mul = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- this.mulTo(num, out)
- );
+ return (out.words = new Array(this.length + num.length)), this.mulTo(num, out);
}),
(BN.prototype.mulf = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- jumboMulTo(this, num, out)
- );
+ return (out.words = new Array(this.length + num.length)), jumboMulTo(this, num, out);
}),
(BN.prototype.imul = function (num) {
return this.clone().mulTo(num, this);
@@ -23952,10 +20516,7 @@ var require_bn6 = __commonJS({
for (var carry = 0, i = 0; i < this.length; i++) {
var w = (this.words[i] | 0) * num,
lo = (w & 67108863) + (carry & 67108863);
- (carry >>= 26),
- (carry += (w / 67108864) | 0),
- (carry += lo >>> 26),
- (this.words[i] = lo & 67108863);
+ (carry >>= 26), (carry += (w / 67108864) | 0), (carry += lo >>> 26), (this.words[i] = lo & 67108863);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -23971,14 +20532,8 @@ var require_bn6 = __commonJS({
(BN.prototype.pow = function (num) {
var w = toBitArray(num);
if (w.length === 0) return new BN(1);
- for (
- var res = this, i = 0;
- i < w.length && w[i] === 0;
- i++, res = res.sqr()
- );
- if (++i < w.length)
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr())
- w[i] !== 0 && (res = res.mul(q));
+ for (var res = this, i = 0; i < w.length && w[i] === 0; i++, res = res.sqr());
+ if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) w[i] !== 0 && (res = res.mul(q));
return res;
}),
(BN.prototype.iushln = function (bits) {
@@ -23997,8 +20552,7 @@ var require_bn6 = __commonJS({
carry && ((this.words[i] = carry), this.length++);
}
if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--)
- this.words[i + s] = this.words[i];
+ for (i = this.length - 1; i >= 0; i--) this.words[i + s] = this.words[i];
for (i = 0; i < s; i++) this.words[i] = 0;
this.length += s;
}
@@ -24020,20 +20574,15 @@ var require_bn6 = __commonJS({
maskedWords.length = s;
}
if (s !== 0)
- if (this.length > s)
- for (this.length -= s, i = 0; i < this.length; i++)
- this.words[i] = this.words[i + s];
+ if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s];
else (this.words[0] = 0), (this.length = 1);
var carry = 0;
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
var word = this.words[i] | 0;
- (this.words[i] = (carry << (26 - r)) | (word >>> r)),
- (carry = word & mask);
+ (this.words[i] = (carry << (26 - r)) | (word >>> r)), (carry = word & mask);
}
return (
- maskedWords &&
- carry !== 0 &&
- (maskedWords.words[maskedWords.length++] = carry),
+ maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry),
this.length === 0 && ((this.words[0] = 0), (this.length = 1)),
this.strip()
);
@@ -24066,17 +20615,8 @@ var require_bn6 = __commonJS({
assert(typeof bits == "number" && bits >= 0);
var r = bits % 26,
s = (bits - r) / 26;
- if (
- (assert(
- this.negative === 0,
- "imaskn works only with positive numbers",
- ),
- this.length <= s)
- )
- return this;
- if (
- (r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)
- ) {
+ if ((assert(this.negative === 0, "imaskn works only with positive numbers"), this.length <= s)) return this;
+ if ((r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)) {
var mask = 67108863 ^ ((67108863 >>> r) << r);
this.words[this.length - 1] &= mask;
}
@@ -24093,32 +20633,20 @@ var require_bn6 = __commonJS({
? this.isubn(-num)
: this.negative !== 0
? this.length === 1 && (this.words[0] | 0) < num
- ? ((this.words[0] = num - (this.words[0] | 0)),
- (this.negative = 0),
- this)
- : ((this.negative = 0),
- this.isubn(num),
- (this.negative = 1),
- this)
+ ? ((this.words[0] = num - (this.words[0] | 0)), (this.negative = 0), this)
+ : ((this.negative = 0), this.isubn(num), (this.negative = 1), this)
: this._iaddn(num)
);
}),
(BN.prototype._iaddn = function (num) {
this.words[0] += num;
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++)
- (this.words[i] -= 67108864),
- i === this.length - 1
- ? (this.words[i + 1] = 1)
- : this.words[i + 1]++;
+ (this.words[i] -= 67108864), i === this.length - 1 ? (this.words[i + 1] = 1) : this.words[i + 1]++;
return (this.length = Math.max(this.length, i + 1)), this;
}),
(BN.prototype.isubn = function (num) {
- if ((assert(typeof num == "number"), assert(num < 67108864), num < 0))
- return this.iaddn(-num);
- if (this.negative !== 0)
- return (
- (this.negative = 0), this.iaddn(num), (this.negative = 1), this
- );
+ if ((assert(typeof num == "number"), assert(num < 67108864), num < 0)) return this.iaddn(-num);
+ if (this.negative !== 0) return (this.negative = 0), this.iaddn(num), (this.negative = 1), this;
if (((this.words[0] -= num), this.length === 1 && this.words[0] < 0))
(this.words[0] = -this.words[0]), (this.negative = 1);
else
@@ -24152,14 +20680,10 @@ var require_bn6 = __commonJS({
(this.words[i + shift] = w & 67108863);
}
for (; i < this.length - shift; i++)
- (w = (this.words[i + shift] | 0) + carry),
- (carry = w >> 26),
- (this.words[i + shift] = w & 67108863);
+ (w = (this.words[i + shift] | 0) + carry), (carry = w >> 26), (this.words[i + shift] = w & 67108863);
if (carry === 0) return this.strip();
for (assert(carry === -1), carry = 0, i = 0; i < this.length; i++)
- (w = -(this.words[i] | 0) + carry),
- (carry = w >> 26),
- (this.words[i] = w & 67108863);
+ (w = -(this.words[i] | 0) + carry), (carry = w >> 26), (this.words[i] = w & 67108863);
return (this.negative = 1), this.strip();
}),
(BN.prototype._wordDiv = function (num, mode) {
@@ -24169,33 +20693,19 @@ var require_bn6 = __commonJS({
bhi = b.words[b.length - 1] | 0,
bhiBits = this._countBits(bhi);
(shift = 26 - bhiBits),
- shift !== 0 &&
- ((b = b.ushln(shift)),
- a.iushln(shift),
- (bhi = b.words[b.length - 1] | 0));
+ shift !== 0 && ((b = b.ushln(shift)), a.iushln(shift), (bhi = b.words[b.length - 1] | 0));
var m = a.length - b.length,
q;
if (mode !== "mod") {
- (q = new BN(null)),
- (q.length = m + 1),
- (q.words = new Array(q.length));
+ (q = new BN(null)), (q.length = m + 1), (q.words = new Array(q.length));
for (var i = 0; i < q.length; i++) q.words[i] = 0;
}
var diff = a.clone()._ishlnsubmul(b, 1, m);
diff.negative === 0 && ((a = diff), q && (q.words[m] = 1));
for (var j = m - 1; j >= 0; j--) {
- var qj =
- (a.words[b.length + j] | 0) * 67108864 +
- (a.words[b.length + j - 1] | 0);
- for (
- qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j);
- a.negative !== 0;
-
- )
- qj--,
- (a.negative = 0),
- a._ishlnsubmul(b, 1, j),
- a.isZero() || (a.negative ^= 1);
+ var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);
+ for (qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j); a.negative !== 0; )
+ qj--, (a.negative = 0), a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
q && (q.words[j] = qj);
}
return (
@@ -24218,9 +20728,7 @@ var require_bn6 = __commonJS({
return this.negative !== 0 && num.negative === 0
? ((res = this.neg().divmod(num, mode)),
mode !== "mod" && (div = res.div.neg()),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.iadd(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.iadd(num)),
{
div,
mod,
@@ -24234,9 +20742,7 @@ var require_bn6 = __commonJS({
})
: (this.negative & num.negative) !== 0
? ((res = this.neg().divmod(num.neg(), mode)),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.isub(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.isub(num)),
{
div: res.div,
mod,
@@ -24287,11 +20793,7 @@ var require_bn6 = __commonJS({
}),
(BN.prototype.modn = function (num) {
assert(num <= 67108863);
- for (
- var p = (1 << 26) % num, acc = 0, i = this.length - 1;
- i >= 0;
- i--
- )
+ for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; i >= 0; i--)
acc = (p * acc + (this.words[i] | 0)) % num;
return acc;
}),
@@ -24311,40 +20813,18 @@ var require_bn6 = __commonJS({
var x = this,
y = p.clone();
x.negative !== 0 ? (x = x.umod(p)) : (x = x.clone());
- for (
- var A = new BN(1),
- B = new BN(0),
- C = new BN(0),
- D = new BN(1),
- g = 0;
- x.isEven() && y.isEven();
-
- )
+ for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); )
x.iushrn(1), y.iushrn(1), ++g;
for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
- for (
- var i = 0, im = 1;
- (x.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
if (i > 0)
for (x.iushrn(i); i-- > 0; )
- (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)),
- A.iushrn(1),
- B.iushrn(1);
- for (
- var j = 0, jm = 1;
- (y.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
+ (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
if (j > 0)
for (y.iushrn(j); j-- > 0; )
- (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)),
- C.iushrn(1),
- D.iushrn(1);
- x.cmp(y) >= 0
- ? (x.isub(y), A.isub(C), B.isub(D))
- : (y.isub(x), C.isub(A), D.isub(B));
+ (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);
+ x.cmp(y) >= 0 ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
}
return {
a: C,
@@ -24357,35 +20837,15 @@ var require_bn6 = __commonJS({
var a = this,
b = p.clone();
a.negative !== 0 ? (a = a.umod(p)) : (a = a.clone());
- for (
- var x1 = new BN(1), x2 = new BN(0), delta = b.clone();
- a.cmpn(1) > 0 && b.cmpn(1) > 0;
-
- ) {
- for (
- var i = 0, im = 1;
- (a.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
- if (i > 0)
- for (a.iushrn(i); i-- > 0; )
- x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
- for (
- var j = 0, jm = 1;
- (b.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
- if (j > 0)
- for (b.iushrn(j); j-- > 0; )
- x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
+ for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone(); a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
+ if (i > 0) for (a.iushrn(i); i-- > 0; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
+ if (j > 0) for (b.iushrn(j); j-- > 0; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
a.cmp(b) >= 0 ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
}
var res;
- return (
- a.cmpn(1) === 0 ? (res = x1) : (res = x2),
- res.cmpn(0) < 0 && res.iadd(p),
- res
- );
+ return a.cmpn(1) === 0 ? (res = x1) : (res = x2), res.cmpn(0) < 0 && res.iadd(p), res;
}),
(BN.prototype.gcd = function (num) {
if (this.isZero()) return num.abs();
@@ -24393,8 +20853,7 @@ var require_bn6 = __commonJS({
var a = this.clone(),
b = num.clone();
(a.negative = 0), (b.negative = 0);
- for (var shift = 0; a.isEven() && b.isEven(); shift++)
- a.iushrn(1), b.iushrn(1);
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), b.iushrn(1);
do {
for (; a.isEven(); ) a.iushrn(1);
for (; b.isEven(); ) b.iushrn(1);
@@ -24424,14 +20883,10 @@ var require_bn6 = __commonJS({
var r = bit % 26,
s = (bit - r) / 26,
q = 1 << r;
- if (this.length <= s)
- return this._expand(s + 1), (this.words[s] |= q), this;
+ if (this.length <= s) return this._expand(s + 1), (this.words[s] |= q), this;
for (var carry = q, i = s; carry !== 0 && i < this.length; i++) {
var w = this.words[i] | 0;
- (w += carry),
- (carry = w >>> 26),
- (w &= 67108863),
- (this.words[i] = w);
+ (w += carry), (carry = w >>> 26), (w &= 67108863), (this.words[i] = w);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -24446,8 +20901,7 @@ var require_bn6 = __commonJS({
var res;
if (this.length > 1) res = 1;
else {
- negative && (num = -num),
- assert(num <= 67108863, "Number is too big");
+ negative && (num = -num), assert(num <= 67108863, "Number is too big");
var w = this.words[0] | 0;
res = w === num ? 0 : w < num ? -1 : 1;
}
@@ -24513,52 +20967,28 @@ var require_bn6 = __commonJS({
);
}),
(BN.prototype.fromRed = function () {
- return (
- assert(
- this.red,
- "fromRed works only with numbers in reduction context",
- ),
- this.red.convertFrom(this)
- );
+ return assert(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
}),
(BN.prototype._forceRed = function (ctx) {
return (this.red = ctx), this;
}),
(BN.prototype.forceRed = function (ctx) {
- return (
- assert(!this.red, "Already a number in reduction context"),
- this._forceRed(ctx)
- );
+ return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
}),
(BN.prototype.redAdd = function (num) {
- return (
- assert(this.red, "redAdd works only with red numbers"),
- this.red.add(this, num)
- );
+ return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
}),
(BN.prototype.redIAdd = function (num) {
- return (
- assert(this.red, "redIAdd works only with red numbers"),
- this.red.iadd(this, num)
- );
+ return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
}),
(BN.prototype.redSub = function (num) {
- return (
- assert(this.red, "redSub works only with red numbers"),
- this.red.sub(this, num)
- );
+ return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
}),
(BN.prototype.redISub = function (num) {
- return (
- assert(this.red, "redISub works only with red numbers"),
- this.red.isub(this, num)
- );
+ return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
}),
(BN.prototype.redShl = function (num) {
- return (
- assert(this.red, "redShl works only with red numbers"),
- this.red.shl(this, num)
- );
+ return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
}),
(BN.prototype.redMul = function (num) {
return (
@@ -24575,46 +21005,22 @@ var require_bn6 = __commonJS({
);
}),
(BN.prototype.redSqr = function () {
- return (
- assert(this.red, "redSqr works only with red numbers"),
- this.red._verify1(this),
- this.red.sqr(this)
- );
+ return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
}),
(BN.prototype.redISqr = function () {
- return (
- assert(this.red, "redISqr works only with red numbers"),
- this.red._verify1(this),
- this.red.isqr(this)
- );
+ return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
}),
(BN.prototype.redSqrt = function () {
- return (
- assert(this.red, "redSqrt works only with red numbers"),
- this.red._verify1(this),
- this.red.sqrt(this)
- );
+ return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
}),
(BN.prototype.redInvm = function () {
- return (
- assert(this.red, "redInvm works only with red numbers"),
- this.red._verify1(this),
- this.red.invm(this)
- );
+ return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
}),
(BN.prototype.redNeg = function () {
- return (
- assert(this.red, "redNeg works only with red numbers"),
- this.red._verify1(this),
- this.red.neg(this)
- );
+ return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
}),
(BN.prototype.redPow = function (num) {
- return (
- assert(this.red && !num.red, "redPow(normalNum)"),
- this.red._verify1(this),
- this.red.pow(this, num)
- );
+ return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, num);
});
var primes = {
k256: null,
@@ -24636,11 +21042,7 @@ var require_bn6 = __commonJS({
(MPrime.prototype.ireduce = function (num) {
var r = num,
rlen;
- do
- this.split(r, this.tmp),
- (r = this.imulK(r)),
- (r = r.iadd(this.tmp)),
- (rlen = r.bitLength());
+ do this.split(r, this.tmp), (r = this.imulK(r)), (r = r.iadd(this.tmp)), (rlen = r.bitLength());
while (rlen > this.n);
var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
return (
@@ -24661,78 +21063,45 @@ var require_bn6 = __commonJS({
return num.imul(this.k);
});
function K256() {
- MPrime.call(
- this,
- "k256",
- "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
- );
+ MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
}
inherits(K256, MPrime),
(K256.prototype.split = function (input, output) {
- for (
- var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;
- i < outLen;
- i++
- )
+ for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0; i < outLen; i++)
output.words[i] = input.words[i];
if (((output.length = outLen), input.length <= 9)) {
(input.words[0] = 0), (input.length = 1);
return;
}
var prev = input.words[9];
- for (
- output.words[output.length++] = prev & mask, i = 10;
- i < input.length;
- i++
- ) {
+ for (output.words[output.length++] = prev & mask, i = 10; i < input.length; i++) {
var next = input.words[i] | 0;
- (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)),
- (prev = next);
+ (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)), (prev = next);
}
(prev >>>= 22),
(input.words[i - 10] = prev),
- prev === 0 && input.length > 10
- ? (input.length -= 10)
- : (input.length -= 9);
+ prev === 0 && input.length > 10 ? (input.length -= 10) : (input.length -= 9);
}),
(K256.prototype.imulK = function (num) {
- (num.words[num.length] = 0),
- (num.words[num.length + 1] = 0),
- (num.length += 2);
+ (num.words[num.length] = 0), (num.words[num.length + 1] = 0), (num.length += 2);
for (var lo = 0, i = 0; i < num.length; i++) {
var w = num.words[i] | 0;
- (lo += w * 977),
- (num.words[i] = lo & 67108863),
- (lo = w * 64 + ((lo / 67108864) | 0));
+ (lo += w * 977), (num.words[i] = lo & 67108863), (lo = w * 64 + ((lo / 67108864) | 0));
}
return (
- num.words[num.length - 1] === 0 &&
- (num.length--, num.words[num.length - 1] === 0 && num.length--),
- num
+ num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num
);
});
function P224() {
- MPrime.call(
- this,
- "p224",
- "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
- );
+ MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
}
inherits(P224, MPrime);
function P192() {
- MPrime.call(
- this,
- "p192",
- "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
- );
+ MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
}
inherits(P192, MPrime);
function P25519() {
- MPrime.call(
- this,
- "25519",
- "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
- );
+ MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
}
inherits(P25519, MPrime),
(P25519.prototype.imulK = function (num) {
@@ -24757,26 +21126,17 @@ var require_bn6 = __commonJS({
if (typeof m == "string") {
var prime = BN._prime(m);
(this.m = prime.p), (this.prime = prime);
- } else
- assert(m.gtn(1), "modulus must be greater than 1"),
- (this.m = m),
- (this.prime = null);
+ } else assert(m.gtn(1), "modulus must be greater than 1"), (this.m = m), (this.prime = null);
}
(Red.prototype._verify1 = function (a) {
- assert(a.negative === 0, "red works only with positives"),
- assert(a.red, "red works only with red numbers");
+ assert(a.negative === 0, "red works only with positives"), assert(a.red, "red works only with red numbers");
}),
(Red.prototype._verify2 = function (a, b) {
- assert(
- (a.negative | b.negative) === 0,
- "red works only with positives",
- ),
+ assert((a.negative | b.negative) === 0, "red works only with positives"),
assert(a.red && a.red === b.red, "red works only with red numbers");
}),
(Red.prototype.imod = function (a) {
- return this.prime
- ? this.prime.ireduce(a)._forceRed(this)
- : a.umod(this.m)._forceRed(this);
+ return this.prime ? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);
}),
(Red.prototype.neg = function (a) {
return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
@@ -24823,29 +21183,19 @@ var require_bn6 = __commonJS({
var pow = this.m.add(new BN(1)).iushrn(2);
return this.pow(a, pow);
}
- for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; )
- s++, q.iushrn(1);
+ for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; ) s++, q.iushrn(1);
assert(!q.isZero());
var one = new BN(1).toRed(this),
nOne = one.redNeg(),
lpow = this.m.subn(1).iushrn(1),
z = this.m.bitLength();
+ for (z = new BN(2 * z * z).toRed(this); this.pow(z, lpow).cmp(nOne) !== 0; ) z.redIAdd(nOne);
for (
- z = new BN(2 * z * z).toRed(this);
- this.pow(z, lpow).cmp(nOne) !== 0;
-
- )
- z.redIAdd(nOne);
- for (
- var c = this.pow(z, q),
- r = this.pow(a, q.addn(1).iushrn(1)),
- t = this.pow(a, q),
- m = s;
+ var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;
t.cmp(one) !== 0;
) {
- for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++)
- tmp = tmp.redSqr();
+ for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++) tmp = tmp.redSqr();
assert(i < m);
var b = this.pow(c, new BN(1).iushln(m - i - 1));
(r = r.redMul(b)), (c = b.redSqr()), (t = t.redMul(c)), (m = i);
@@ -24854,9 +21204,7 @@ var require_bn6 = __commonJS({
}),
(Red.prototype.invm = function (a) {
var inv = a._invmp(this.m);
- return inv.negative !== 0
- ? ((inv.negative = 0), this.imod(inv).redNeg())
- : this.imod(inv);
+ return inv.negative !== 0 ? ((inv.negative = 0), this.imod(inv).redNeg()) : this.imod(inv);
}),
(Red.prototype.pow = function (a, num) {
if (num.isZero()) return new BN(1).toRed(this);
@@ -24872,10 +21220,7 @@ var require_bn6 = __commonJS({
for (start === 0 && (start = 26), i = num.length - 1; i >= 0; i--) {
for (var word = num.words[i], j = start - 1; j >= 0; j--) {
var bit = (word >> j) & 1;
- if (
- (res !== wnd[0] && (res = this.sqr(res)),
- bit === 0 && current === 0)
- ) {
+ if ((res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0)) {
currentLen = 0;
continue;
}
@@ -24883,9 +21228,7 @@ var require_bn6 = __commonJS({
(current |= bit),
currentLen++,
!(currentLen !== windowSize && (i !== 0 || j !== 0)) &&
- ((res = this.mul(res, wnd[current])),
- (currentLen = 0),
- (current = 0));
+ ((res = this.mul(res, wnd[current])), (currentLen = 0), (current = 0));
}
start = 26;
}
@@ -24922,38 +21265,23 @@ var require_bn6 = __commonJS({
return (r.red = null), r;
}),
(Mont.prototype.imul = function (a, b) {
- if (a.isZero() || b.isZero())
- return (a.words[0] = 0), (a.length = 1), a;
+ if (a.isZero() || b.isZero()) return (a.words[0] = 0), (a.length = 1), a;
var t = a.imul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.mul = function (a, b) {
if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
var t = a.mul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.invm = function (a) {
@@ -25017,13 +21345,10 @@ var require_browser9 = __commonJS({
(this.keys = void 0);
}
ECDH.prototype.generateKeys = function (enc, format) {
- return (
- (this.keys = this.curve.genKeyPair()), this.getPublicKey(enc, format)
- );
+ return (this.keys = this.curve.genKeyPair()), this.getPublicKey(enc, format);
};
ECDH.prototype.computeSecret = function (other, inenc, enc) {
- (inenc = inenc || "utf8"),
- Buffer.isBuffer(other) || (other = new Buffer(other, inenc));
+ (inenc = inenc || "utf8"), Buffer.isBuffer(other) || (other = new Buffer(other, inenc));
var otherPub = this.curve.keyFromPublic(other).getPublic(),
out = otherPub.mul(this.keys.getPrivate()).getX();
return formatReturnValue(out, enc, this.curveType.byteLength);
@@ -25031,9 +21356,7 @@ var require_browser9 = __commonJS({
ECDH.prototype.getPublicKey = function (enc, format) {
var key = this.keys.getPublic(format === "compressed", !0);
return (
- format === "hybrid" &&
- (key[key.length - 1] % 2 ? (key[0] = 7) : (key[0] = 6)),
- formatReturnValue(key, enc)
+ format === "hybrid" && (key[key.length - 1] % 2 ? (key[0] = 7) : (key[0] = 6)), formatReturnValue(key, enc)
);
};
ECDH.prototype.getPrivateKey = function (enc) {
@@ -25041,22 +21364,13 @@ var require_browser9 = __commonJS({
};
ECDH.prototype.setPublicKey = function (pub, enc) {
return (
- (enc = enc || "utf8"),
- Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)),
- this.keys._importPublic(pub),
- this
+ (enc = enc || "utf8"), Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), this.keys._importPublic(pub), this
);
};
ECDH.prototype.setPrivateKey = function (priv, enc) {
- (enc = enc || "utf8"),
- Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc));
+ (enc = enc || "utf8"), Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc));
var _priv = new BN(priv);
- return (
- (_priv = _priv.toString(16)),
- (this.keys = this.curve.genKeyPair()),
- this.keys._importPrivate(_priv),
- this
- );
+ return (_priv = _priv.toString(16)), (this.keys = this.curve.genKeyPair()), this.keys._importPrivate(_priv), this;
};
function formatReturnValue(bn, enc, len) {
Array.isArray(bn) || (bn = bn.toArray());
@@ -25077,11 +21391,7 @@ var require_mgf = __commonJS({
Buffer2 = require_safe_buffer().Buffer;
module.exports = function (seed, len) {
for (var t = Buffer2.alloc(0), i = 0, c; t.length < len; )
- (c = i2ops(i++)),
- (t = Buffer2.concat([
- t,
- createHash("sha1").update(seed).update(c).digest(),
- ]));
+ (c = i2ops(i++)), (t = Buffer2.concat([t, createHash("sha1").update(seed).update(c).digest()]));
return t.slice(0, len);
};
function i2ops(c) {
@@ -25126,9 +21436,7 @@ var require_bn7 = __commonJS({
((base === "le" || base === "be") && ((endian = base), (base = 10)),
this._init(number || 0, base || 10, endian || "be"));
}
- typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN),
- (BN.BN = BN),
- (BN.wordSize = 26);
+ typeof module2 == "object" ? (module2.exports = BN) : (exports2.BN = BN), (BN.BN = BN), (BN.wordSize = 26);
var Buffer2 = globalThis.Buffer;
(BN.isBN = function (num) {
return num instanceof BN
@@ -25145,10 +21453,8 @@ var require_bn7 = __commonJS({
return left.cmp(right) < 0 ? left : right;
}),
(BN.prototype._init = function (number, base, endian) {
- if (typeof number == "number")
- return this._initNumber(number, base, endian);
- if (typeof number == "object")
- return this._initArray(number, base, endian);
+ if (typeof number == "number") return this._initNumber(number, base, endian);
+ if (typeof number == "object") return this._initArray(number, base, endian);
base === "hex" && (base = 16),
assert(base === (base | 0) && base >= 2 && base <= 36),
(number = number.toString().replace(/\s+/g, ""));
@@ -25158,33 +21464,23 @@ var require_bn7 = __commonJS({
(base === 16
? this._parseHex(number, start, endian)
: (this._parseBase(number, base, start),
- endian === "le" &&
- this._initArray(this.toArray(), base, endian)));
+ endian === "le" && this._initArray(this.toArray(), base, endian)));
}),
(BN.prototype._initNumber = function (number, base, endian) {
number < 0 && ((this.negative = 1), (number = -number)),
number < 67108864
? ((this.words = [number & 67108863]), (this.length = 1))
: number < 4503599627370496
- ? ((this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- ]),
- (this.length = 2))
+ ? ((this.words = [number & 67108863, (number / 67108864) & 67108863]), (this.length = 2))
: (assert(number < 9007199254740992),
- (this.words = [
- number & 67108863,
- (number / 67108864) & 67108863,
- 1,
- ]),
+ (this.words = [number & 67108863, (number / 67108864) & 67108863, 1]),
(this.length = 3)),
endian === "le" && this._initArray(this.toArray(), base, endian);
}),
(BN.prototype._initArray = function (number, base, endian) {
if ((assert(typeof number.length == "number"), number.length <= 0))
return (this.words = [0]), (this.length = 1), this;
- (this.length = Math.ceil(number.length / 3)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil(number.length / 3)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var j,
w,
@@ -25207,23 +21503,14 @@ var require_bn7 = __commonJS({
});
function parseHex4Bits(string, index) {
var c = string.charCodeAt(index);
- return c >= 65 && c <= 70
- ? c - 55
- : c >= 97 && c <= 102
- ? c - 87
- : (c - 48) & 15;
+ return c >= 65 && c <= 70 ? c - 55 : c >= 97 && c <= 102 ? c - 87 : (c - 48) & 15;
}
function parseHexByte(string, lowerBound, index) {
var r = parseHex4Bits(string, index);
- return (
- index - 1 >= lowerBound &&
- (r |= parseHex4Bits(string, index - 1) << 4),
- r
- );
+ return index - 1 >= lowerBound && (r |= parseHex4Bits(string, index - 1) << 4), r;
}
BN.prototype._parseHex = function (number, start, endian) {
- (this.length = Math.ceil((number.length - start) / 6)),
- (this.words = new Array(this.length));
+ (this.length = Math.ceil((number.length - start) / 6)), (this.words = new Array(this.length));
for (var i = 0; i < this.length; i++) this.words[i] = 0;
var off = 0,
j = 0,
@@ -25232,44 +21519,26 @@ var require_bn7 = __commonJS({
for (i = number.length - 1; i >= start; i -= 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
else {
var parseLength = number.length - start;
- for (
- i = parseLength % 2 === 0 ? start + 1 : start;
- i < number.length;
- i += 2
- )
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2)
(w = parseHexByte(number, start, i) << off),
(this.words[j] |= w & 67108863),
- off >= 18
- ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26))
- : (off += 8);
+ off >= 18 ? ((off -= 18), (j += 1), (this.words[j] |= w >>> 26)) : (off += 8);
}
this.strip();
};
function parseBase(str, start, end, mul) {
- for (
- var r = 0, len = Math.min(str.length, end), i = start;
- i < len;
- i++
- ) {
+ for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
var c = str.charCodeAt(i) - 48;
- (r *= mul),
- c >= 49
- ? (r += c - 49 + 10)
- : c >= 17
- ? (r += c - 17 + 10)
- : (r += c);
+ (r *= mul), c >= 49 ? (r += c - 49 + 10) : c >= 17 ? (r += c - 17 + 10) : (r += c);
}
return r;
}
(BN.prototype._parseBase = function (number, base, start) {
(this.words = [0]), (this.length = 1);
- for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base)
- limbLen++;
+ for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
limbLen--, (limbPow = (limbPow / base) | 0);
for (
var total = number.length - start,
@@ -25282,30 +21551,18 @@ var require_bn7 = __commonJS({
)
(word = parseBase(number, i, i + limbLen, base)),
this.imuln(limbPow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
if (mod !== 0) {
var pow = 1;
- for (
- word = parseBase(number, i, number.length, base), i = 0;
- i < mod;
- i++
- )
- pow *= base;
- this.imuln(pow),
- this.words[0] + word < 67108864
- ? (this.words[0] += word)
- : this._iaddn(word);
+ for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
+ this.imuln(pow), this.words[0] + word < 67108864 ? (this.words[0] += word) : this._iaddn(word);
}
this.strip();
}),
(BN.prototype.copy = function (dest) {
dest.words = new Array(this.length);
for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
- (dest.length = this.length),
- (dest.negative = this.negative),
- (dest.red = this.red);
+ (dest.length = this.length), (dest.negative = this.negative), (dest.red = this.red);
}),
(BN.prototype.clone = function () {
var r = new BN(null);
@@ -25316,15 +21573,11 @@ var require_bn7 = __commonJS({
return this;
}),
(BN.prototype.strip = function () {
- for (; this.length > 1 && this.words[this.length - 1] === 0; )
- this.length--;
+ for (; this.length > 1 && this.words[this.length - 1] === 0; ) this.length--;
return this._normSign();
}),
(BN.prototype._normSign = function () {
- return (
- this.length === 1 && this.words[0] === 0 && (this.negative = 0),
- this
- );
+ return this.length === 1 && this.words[0] === 0 && (this.negative = 0), this;
}),
(BN.prototype.inspect = function () {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
@@ -25358,15 +21611,13 @@ var require_bn7 = __commonJS({
"0000000000000000000000000",
],
groupSizes = [
- 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5,
],
groupBases = [
- 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607,
- 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536,
- 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101,
- 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368,
- 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
+ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808,
+ 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624,
+ 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875,
60466176,
];
(BN.prototype.toString = function (base, padding) {
@@ -25378,18 +21629,11 @@ var require_bn7 = __commonJS({
var w = this.words[i],
word = (((w << off) | carry) & 16777215).toString(16);
(carry = (w >>> (24 - off)) & 16777215),
- carry !== 0 || i !== this.length - 1
- ? (out = zeros[6 - word.length] + word + out)
- : (out = word + out),
+ carry !== 0 || i !== this.length - 1 ? (out = zeros[6 - word.length] + word + out) : (out = word + out),
(off += 2),
off >= 26 && ((off -= 26), i--);
}
- for (
- carry !== 0 && (out = carry.toString(16) + out);
- out.length % padding !== 0;
-
- )
- out = "0" + out;
+ for (carry !== 0 && (out = carry.toString(16) + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
if (base === (base | 0) && base >= 2 && base <= 36) {
@@ -25399,13 +21643,9 @@ var require_bn7 = __commonJS({
var c = this.clone();
for (c.negative = 0; !c.isZero(); ) {
var r = c.modn(groupBase).toString(base);
- (c = c.idivn(groupBase)),
- c.isZero()
- ? (out = r + out)
- : (out = zeros[groupSize - r.length] + r + out);
+ (c = c.idivn(groupBase)), c.isZero() ? (out = r + out) : (out = zeros[groupSize - r.length] + r + out);
}
- for (this.isZero() && (out = "0" + out); out.length % padding !== 0; )
- out = "0" + out;
+ for (this.isZero() && (out = "0" + out); out.length % padding !== 0; ) out = "0" + out;
return this.negative !== 0 && (out = "-" + out), out;
}
assert(!1, "Base should be between 2 and 36");
@@ -25417,8 +21657,7 @@ var require_bn7 = __commonJS({
? (ret += this.words[1] * 67108864)
: this.length === 3 && this.words[2] === 1
? (ret += 4503599627370496 + this.words[1] * 67108864)
- : this.length > 2 &&
- assert(!1, "Number can only safely store up to 53 bits"),
+ : this.length > 2 && assert(!1, "Number can only safely store up to 53 bits"),
this.negative !== 0 ? -ret : ret
);
}),
@@ -25426,10 +21665,7 @@ var require_bn7 = __commonJS({
return this.toString(16);
}),
(BN.prototype.toBuffer = function (endian, length) {
- return (
- assert(typeof Buffer2 < "u"),
- this.toArrayLike(Buffer2, endian, length)
- );
+ return assert(typeof Buffer2 < "u"), this.toArrayLike(Buffer2, endian, length);
}),
(BN.prototype.toArray = function (endian, length) {
return this.toArrayLike(Array, endian, length);
@@ -25437,10 +21673,7 @@ var require_bn7 = __commonJS({
(BN.prototype.toArrayLike = function (ArrayType, endian, length) {
var byteLength = this.byteLength(),
reqLength = length || Math.max(1, byteLength);
- assert(
- byteLength <= reqLength,
- "byte array longer than desired length",
- ),
+ assert(byteLength <= reqLength, "byte array longer than desired length"),
assert(reqLength > 0, "Requested array length <= 0"),
this.strip();
var littleEndian = endian === "le",
@@ -25449,13 +21682,11 @@ var require_bn7 = __commonJS({
i,
q = this.clone();
if (littleEndian) {
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[i] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[i] = b);
for (; i < reqLength; i++) res[i] = 0;
} else {
for (i = 0; i < reqLength - byteLength; i++) res[i] = 0;
- for (i = 0; !q.isZero(); i++)
- (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
+ for (i = 0; !q.isZero(); i++) (b = q.andln(255)), q.iushrn(8), (res[reqLength - i - 1] = b);
}
return res;
}),
@@ -25493,11 +21724,7 @@ var require_bn7 = __commonJS({
return (this.length - 1) * 26 + hi;
});
function toBitArray(num) {
- for (
- var w = new Array(num.bitLength()), bit = 0;
- bit < w.length;
- bit++
- ) {
+ for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
var off = (bit / 26) | 0,
wbit = bit % 26;
w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
@@ -25516,14 +21743,10 @@ var require_bn7 = __commonJS({
return Math.ceil(this.bitLength() / 8);
}),
(BN.prototype.toTwos = function (width) {
- return this.negative !== 0
- ? this.abs().inotn(width).iaddn(1)
- : this.clone();
+ return this.negative !== 0 ? this.abs().inotn(width).iaddn(1) : this.clone();
}),
(BN.prototype.fromTwos = function (width) {
- return this.testn(width - 1)
- ? this.notn(width).iaddn(1).ineg()
- : this.clone();
+ return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
}),
(BN.prototype.isNeg = function () {
return this.negative !== 0;
@@ -25536,50 +21759,37 @@ var require_bn7 = __commonJS({
}),
(BN.prototype.iuor = function (num) {
for (; this.length < num.length; ) this.words[this.length++] = 0;
- for (var i = 0; i < num.length; i++)
- this.words[i] = this.words[i] | num.words[i];
+ for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
return this.strip();
}),
(BN.prototype.ior = function (num) {
return assert((this.negative | num.negative) === 0), this.iuor(num);
}),
(BN.prototype.or = function (num) {
- return this.length > num.length
- ? this.clone().ior(num)
- : num.clone().ior(this);
+ return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
}),
(BN.prototype.uor = function (num) {
- return this.length > num.length
- ? this.clone().iuor(num)
- : num.clone().iuor(this);
+ return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
}),
(BN.prototype.iuand = function (num) {
var b;
this.length > num.length ? (b = num) : (b = this);
- for (var i = 0; i < b.length; i++)
- this.words[i] = this.words[i] & num.words[i];
+ for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
return (this.length = b.length), this.strip();
}),
(BN.prototype.iand = function (num) {
return assert((this.negative | num.negative) === 0), this.iuand(num);
}),
(BN.prototype.and = function (num) {
- return this.length > num.length
- ? this.clone().iand(num)
- : num.clone().iand(this);
+ return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
}),
(BN.prototype.uand = function (num) {
- return this.length > num.length
- ? this.clone().iuand(num)
- : num.clone().iuand(this);
+ return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
}),
(BN.prototype.iuxor = function (num) {
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
- for (var i = 0; i < b.length; i++)
- this.words[i] = a.words[i] ^ b.words[i];
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
+ for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
if (this !== a) for (; i < a.length; i++) this.words[i] = a.words[i];
return (this.length = a.length), this.strip();
}),
@@ -25587,27 +21797,18 @@ var require_bn7 = __commonJS({
return assert((this.negative | num.negative) === 0), this.iuxor(num);
}),
(BN.prototype.xor = function (num) {
- return this.length > num.length
- ? this.clone().ixor(num)
- : num.clone().ixor(this);
+ return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
}),
(BN.prototype.uxor = function (num) {
- return this.length > num.length
- ? this.clone().iuxor(num)
- : num.clone().iuxor(this);
+ return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
}),
(BN.prototype.inotn = function (width) {
assert(typeof width == "number" && width >= 0);
var bytesNeeded = Math.ceil(width / 26) | 0,
bitsLeft = width % 26;
this._expand(bytesNeeded), bitsLeft > 0 && bytesNeeded--;
- for (var i = 0; i < bytesNeeded; i++)
- this.words[i] = ~this.words[i] & 67108863;
- return (
- bitsLeft > 0 &&
- (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))),
- this.strip()
- );
+ for (var i = 0; i < bytesNeeded; i++) this.words[i] = ~this.words[i] & 67108863;
+ return bitsLeft > 0 && (this.words[i] = ~this.words[i] & (67108863 >> (26 - bitsLeft))), this.strip();
}),
(BN.prototype.notn = function (width) {
return this.clone().inotn(width);
@@ -25627,49 +21828,25 @@ var require_bn7 = __commonJS({
(BN.prototype.iadd = function (num) {
var r;
if (this.negative !== 0 && num.negative === 0)
- return (
- (this.negative = 0),
- (r = this.isub(num)),
- (this.negative ^= 1),
- this._normSign()
- );
+ return (this.negative = 0), (r = this.isub(num)), (this.negative ^= 1), this._normSign();
if (this.negative === 0 && num.negative !== 0)
- return (
- (num.negative = 0),
- (r = this.isub(num)),
- (num.negative = 1),
- r._normSign()
- );
+ return (num.negative = 0), (r = this.isub(num)), (num.negative = 1), r._normSign();
var a, b;
- this.length > num.length
- ? ((a = this), (b = num))
- : ((a = num), (b = this));
+ this.length > num.length ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) + (b.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
+ (r = (a.words[i] | 0) + (b.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (this.words[i] = r & 67108863),
- (carry = r >>> 26);
- if (((this.length = a.length), carry !== 0))
- (this.words[this.length] = carry), this.length++;
- else if (a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
+ (r = (a.words[i] | 0) + carry), (this.words[i] = r & 67108863), (carry = r >>> 26);
+ if (((this.length = a.length), carry !== 0)) (this.words[this.length] = carry), this.length++;
+ else if (a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
return this;
}),
(BN.prototype.add = function (num) {
var res;
return num.negative !== 0 && this.negative === 0
- ? ((num.negative = 0),
- (res = this.sub(num)),
- (num.negative ^= 1),
- res)
+ ? ((num.negative = 0), (res = this.sub(num)), (num.negative ^= 1), res)
: num.negative === 0 && this.negative !== 0
- ? ((this.negative = 0),
- (res = num.sub(this)),
- (this.negative = 1),
- res)
+ ? ((this.negative = 0), (res = num.sub(this)), (this.negative = 1), res)
: this.length > num.length
? this.clone().iadd(num)
: num.clone().iadd(this);
@@ -25680,34 +21857,17 @@ var require_bn7 = __commonJS({
var r = this.iadd(num);
return (num.negative = 1), r._normSign();
} else if (this.negative !== 0)
- return (
- (this.negative = 0),
- this.iadd(num),
- (this.negative = 1),
- this._normSign()
- );
+ return (this.negative = 0), this.iadd(num), (this.negative = 1), this._normSign();
var cmp = this.cmp(num);
- if (cmp === 0)
- return (
- (this.negative = 0), (this.length = 1), (this.words[0] = 0), this
- );
+ if (cmp === 0) return (this.negative = 0), (this.length = 1), (this.words[0] = 0), this;
var a, b;
cmp > 0 ? ((a = this), (b = num)) : ((a = num), (b = this));
for (var carry = 0, i = 0; i < b.length; i++)
- (r = (a.words[i] | 0) - (b.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
+ (r = (a.words[i] | 0) - (b.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
for (; carry !== 0 && i < a.length; i++)
- (r = (a.words[i] | 0) + carry),
- (carry = r >> 26),
- (this.words[i] = r & 67108863);
- if (carry === 0 && i < a.length && a !== this)
- for (; i < a.length; i++) this.words[i] = a.words[i];
- return (
- (this.length = Math.max(this.length, i)),
- a !== this && (this.negative = 1),
- this.strip()
- );
+ (r = (a.words[i] | 0) + carry), (carry = r >> 26), (this.words[i] = r & 67108863);
+ if (carry === 0 && i < a.length && a !== this) for (; i < a.length; i++) this.words[i] = a.words[i];
+ return (this.length = Math.max(this.length, i)), a !== this && (this.negative = 1), this.strip();
}),
(BN.prototype.sub = function (num) {
return this.clone().isub(num);
@@ -25740,9 +21900,7 @@ var require_bn7 = __commonJS({
}
(out.words[k] = rword | 0), (carry = ncarry | 0);
}
- return (
- carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip()
- );
+ return carry !== 0 ? (out.words[k] = carry | 0) : out.length--, out.strip();
}
var comb10MulTo = function (self2, num, out) {
var a = self2.words,
@@ -26297,15 +22455,12 @@ var require_bn7 = __commonJS({
};
Math.imul || (comb10MulTo = smallMulTo);
function bigMulTo(self2, num, out) {
- (out.negative = num.negative ^ self2.negative),
- (out.length = self2.length + num.length);
+ (out.negative = num.negative ^ self2.negative), (out.length = self2.length + num.length);
for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
var ncarry = hncarry;
hncarry = 0;
for (
- var rword = carry & 67108863,
- maxJ = Math.min(k, num.length - 1),
- j = Math.max(0, k - self2.length + 1);
+ var rword = carry & 67108863, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self2.length + 1);
j <= maxJ;
j++
) {
@@ -26347,32 +22502,22 @@ var require_bn7 = __commonJS({
(this.x = x), (this.y = y);
}
(FFTM.prototype.makeRBT = function (N) {
- for (
- var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0;
- i < N;
- i++
- )
- t[i] = this.revBin(i, l, N);
+ for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
return t;
}),
(FFTM.prototype.revBin = function (x, l, N) {
if (x === 0 || x === N - 1) return x;
- for (var rb = 0, i = 0; i < l; i++)
- (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
+ for (var rb = 0, i = 0; i < l; i++) (rb |= (x & 1) << (l - i - 1)), (x >>= 1);
return rb;
}),
(FFTM.prototype.permute = function (rbt, rws, iws, rtws, itws, N) {
- for (var i = 0; i < N; i++)
- (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
+ for (var i = 0; i < N; i++) (rtws[i] = rws[rbt[i]]), (itws[i] = iws[rbt[i]]);
}),
(FFTM.prototype.transform = function (rws, iws, rtws, itws, N, rbt) {
this.permute(rbt, rws, iws, rtws, itws, N);
for (var s = 1; s < N; s <<= 1)
for (
- var l = s << 1,
- rtwdf = Math.cos((2 * Math.PI) / l),
- itwdf = Math.sin((2 * Math.PI) / l),
- p = 0;
+ var l = s << 1, rtwdf = Math.cos((2 * Math.PI) / l), itwdf = Math.sin((2 * Math.PI) / l), p = 0;
p < N;
p += l
)
@@ -26389,9 +22534,7 @@ var require_bn7 = __commonJS({
(rtws[p + j + s] = re - ro),
(itws[p + j + s] = ie - io),
j !== l &&
- ((rx = rtwdf * rtwdf_ - itwdf * itwdf_),
- (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_),
- (rtwdf_ = rx));
+ ((rx = rtwdf * rtwdf_ - itwdf * itwdf_), (itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_), (rtwdf_ = rx));
}
}),
(FFTM.prototype.guessLen13b = function (n, m) {
@@ -26414,12 +22557,8 @@ var require_bn7 = __commonJS({
}),
(FFTM.prototype.normalize13b = function (ws, N) {
for (var carry = 0, i = 0; i < N / 2; i++) {
- var w =
- Math.round(ws[2 * i + 1] / N) * 8192 +
- Math.round(ws[2 * i] / N) +
- carry;
- (ws[i] = w & 67108863),
- w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
+ var w = Math.round(ws[2 * i + 1] / N) * 8192 + Math.round(ws[2 * i] / N) + carry;
+ (ws[i] = w & 67108863), w < 67108864 ? (carry = 0) : (carry = (w / 67108864) | 0);
}
return ws;
}),
@@ -26469,17 +22608,11 @@ var require_bn7 = __commonJS({
}),
(BN.prototype.mul = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- this.mulTo(num, out)
- );
+ return (out.words = new Array(this.length + num.length)), this.mulTo(num, out);
}),
(BN.prototype.mulf = function (num) {
var out = new BN(null);
- return (
- (out.words = new Array(this.length + num.length)),
- jumboMulTo(this, num, out)
- );
+ return (out.words = new Array(this.length + num.length)), jumboMulTo(this, num, out);
}),
(BN.prototype.imul = function (num) {
return this.clone().mulTo(num, this);
@@ -26489,10 +22622,7 @@ var require_bn7 = __commonJS({
for (var carry = 0, i = 0; i < this.length; i++) {
var w = (this.words[i] | 0) * num,
lo = (w & 67108863) + (carry & 67108863);
- (carry >>= 26),
- (carry += (w / 67108864) | 0),
- (carry += lo >>> 26),
- (this.words[i] = lo & 67108863);
+ (carry >>= 26), (carry += (w / 67108864) | 0), (carry += lo >>> 26), (this.words[i] = lo & 67108863);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -26508,14 +22638,8 @@ var require_bn7 = __commonJS({
(BN.prototype.pow = function (num) {
var w = toBitArray(num);
if (w.length === 0) return new BN(1);
- for (
- var res = this, i = 0;
- i < w.length && w[i] === 0;
- i++, res = res.sqr()
- );
- if (++i < w.length)
- for (var q = res.sqr(); i < w.length; i++, q = q.sqr())
- w[i] !== 0 && (res = res.mul(q));
+ for (var res = this, i = 0; i < w.length && w[i] === 0; i++, res = res.sqr());
+ if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) w[i] !== 0 && (res = res.mul(q));
return res;
}),
(BN.prototype.iushln = function (bits) {
@@ -26534,8 +22658,7 @@ var require_bn7 = __commonJS({
carry && ((this.words[i] = carry), this.length++);
}
if (s !== 0) {
- for (i = this.length - 1; i >= 0; i--)
- this.words[i + s] = this.words[i];
+ for (i = this.length - 1; i >= 0; i--) this.words[i + s] = this.words[i];
for (i = 0; i < s; i++) this.words[i] = 0;
this.length += s;
}
@@ -26557,20 +22680,15 @@ var require_bn7 = __commonJS({
maskedWords.length = s;
}
if (s !== 0)
- if (this.length > s)
- for (this.length -= s, i = 0; i < this.length; i++)
- this.words[i] = this.words[i + s];
+ if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s];
else (this.words[0] = 0), (this.length = 1);
var carry = 0;
for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
var word = this.words[i] | 0;
- (this.words[i] = (carry << (26 - r)) | (word >>> r)),
- (carry = word & mask);
+ (this.words[i] = (carry << (26 - r)) | (word >>> r)), (carry = word & mask);
}
return (
- maskedWords &&
- carry !== 0 &&
- (maskedWords.words[maskedWords.length++] = carry),
+ maskedWords && carry !== 0 && (maskedWords.words[maskedWords.length++] = carry),
this.length === 0 && ((this.words[0] = 0), (this.length = 1)),
this.strip()
);
@@ -26603,17 +22721,8 @@ var require_bn7 = __commonJS({
assert(typeof bits == "number" && bits >= 0);
var r = bits % 26,
s = (bits - r) / 26;
- if (
- (assert(
- this.negative === 0,
- "imaskn works only with positive numbers",
- ),
- this.length <= s)
- )
- return this;
- if (
- (r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)
- ) {
+ if ((assert(this.negative === 0, "imaskn works only with positive numbers"), this.length <= s)) return this;
+ if ((r !== 0 && s++, (this.length = Math.min(s, this.length)), r !== 0)) {
var mask = 67108863 ^ ((67108863 >>> r) << r);
this.words[this.length - 1] &= mask;
}
@@ -26630,32 +22739,20 @@ var require_bn7 = __commonJS({
? this.isubn(-num)
: this.negative !== 0
? this.length === 1 && (this.words[0] | 0) < num
- ? ((this.words[0] = num - (this.words[0] | 0)),
- (this.negative = 0),
- this)
- : ((this.negative = 0),
- this.isubn(num),
- (this.negative = 1),
- this)
+ ? ((this.words[0] = num - (this.words[0] | 0)), (this.negative = 0), this)
+ : ((this.negative = 0), this.isubn(num), (this.negative = 1), this)
: this._iaddn(num)
);
}),
(BN.prototype._iaddn = function (num) {
this.words[0] += num;
for (var i = 0; i < this.length && this.words[i] >= 67108864; i++)
- (this.words[i] -= 67108864),
- i === this.length - 1
- ? (this.words[i + 1] = 1)
- : this.words[i + 1]++;
+ (this.words[i] -= 67108864), i === this.length - 1 ? (this.words[i + 1] = 1) : this.words[i + 1]++;
return (this.length = Math.max(this.length, i + 1)), this;
}),
(BN.prototype.isubn = function (num) {
- if ((assert(typeof num == "number"), assert(num < 67108864), num < 0))
- return this.iaddn(-num);
- if (this.negative !== 0)
- return (
- (this.negative = 0), this.iaddn(num), (this.negative = 1), this
- );
+ if ((assert(typeof num == "number"), assert(num < 67108864), num < 0)) return this.iaddn(-num);
+ if (this.negative !== 0) return (this.negative = 0), this.iaddn(num), (this.negative = 1), this;
if (((this.words[0] -= num), this.length === 1 && this.words[0] < 0))
(this.words[0] = -this.words[0]), (this.negative = 1);
else
@@ -26689,14 +22786,10 @@ var require_bn7 = __commonJS({
(this.words[i + shift] = w & 67108863);
}
for (; i < this.length - shift; i++)
- (w = (this.words[i + shift] | 0) + carry),
- (carry = w >> 26),
- (this.words[i + shift] = w & 67108863);
+ (w = (this.words[i + shift] | 0) + carry), (carry = w >> 26), (this.words[i + shift] = w & 67108863);
if (carry === 0) return this.strip();
for (assert(carry === -1), carry = 0, i = 0; i < this.length; i++)
- (w = -(this.words[i] | 0) + carry),
- (carry = w >> 26),
- (this.words[i] = w & 67108863);
+ (w = -(this.words[i] | 0) + carry), (carry = w >> 26), (this.words[i] = w & 67108863);
return (this.negative = 1), this.strip();
}),
(BN.prototype._wordDiv = function (num, mode) {
@@ -26706,33 +22799,19 @@ var require_bn7 = __commonJS({
bhi = b.words[b.length - 1] | 0,
bhiBits = this._countBits(bhi);
(shift = 26 - bhiBits),
- shift !== 0 &&
- ((b = b.ushln(shift)),
- a.iushln(shift),
- (bhi = b.words[b.length - 1] | 0));
+ shift !== 0 && ((b = b.ushln(shift)), a.iushln(shift), (bhi = b.words[b.length - 1] | 0));
var m = a.length - b.length,
q;
if (mode !== "mod") {
- (q = new BN(null)),
- (q.length = m + 1),
- (q.words = new Array(q.length));
+ (q = new BN(null)), (q.length = m + 1), (q.words = new Array(q.length));
for (var i = 0; i < q.length; i++) q.words[i] = 0;
}
var diff = a.clone()._ishlnsubmul(b, 1, m);
diff.negative === 0 && ((a = diff), q && (q.words[m] = 1));
for (var j = m - 1; j >= 0; j--) {
- var qj =
- (a.words[b.length + j] | 0) * 67108864 +
- (a.words[b.length + j - 1] | 0);
- for (
- qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j);
- a.negative !== 0;
-
- )
- qj--,
- (a.negative = 0),
- a._ishlnsubmul(b, 1, j),
- a.isZero() || (a.negative ^= 1);
+ var qj = (a.words[b.length + j] | 0) * 67108864 + (a.words[b.length + j - 1] | 0);
+ for (qj = Math.min((qj / bhi) | 0, 67108863), a._ishlnsubmul(b, qj, j); a.negative !== 0; )
+ qj--, (a.negative = 0), a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
q && (q.words[j] = qj);
}
return (
@@ -26755,9 +22834,7 @@ var require_bn7 = __commonJS({
return this.negative !== 0 && num.negative === 0
? ((res = this.neg().divmod(num, mode)),
mode !== "mod" && (div = res.div.neg()),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.iadd(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.iadd(num)),
{
div,
mod,
@@ -26771,9 +22848,7 @@ var require_bn7 = __commonJS({
})
: (this.negative & num.negative) !== 0
? ((res = this.neg().divmod(num.neg(), mode)),
- mode !== "div" &&
- ((mod = res.mod.neg()),
- positive && mod.negative !== 0 && mod.isub(num)),
+ mode !== "div" && ((mod = res.mod.neg()), positive && mod.negative !== 0 && mod.isub(num)),
{
div: res.div,
mod,
@@ -26824,11 +22899,7 @@ var require_bn7 = __commonJS({
}),
(BN.prototype.modn = function (num) {
assert(num <= 67108863);
- for (
- var p = (1 << 26) % num, acc = 0, i = this.length - 1;
- i >= 0;
- i--
- )
+ for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; i >= 0; i--)
acc = (p * acc + (this.words[i] | 0)) % num;
return acc;
}),
@@ -26848,40 +22919,18 @@ var require_bn7 = __commonJS({
var x = this,
y = p.clone();
x.negative !== 0 ? (x = x.umod(p)) : (x = x.clone());
- for (
- var A = new BN(1),
- B = new BN(0),
- C = new BN(0),
- D = new BN(1),
- g = 0;
- x.isEven() && y.isEven();
-
- )
+ for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); )
x.iushrn(1), y.iushrn(1), ++g;
for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
- for (
- var i = 0, im = 1;
- (x.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
+ for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
if (i > 0)
for (x.iushrn(i); i-- > 0; )
- (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)),
- A.iushrn(1),
- B.iushrn(1);
- for (
- var j = 0, jm = 1;
- (y.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
+ (A.isOdd() || B.isOdd()) && (A.iadd(yp), B.isub(xp)), A.iushrn(1), B.iushrn(1);
+ for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
if (j > 0)
for (y.iushrn(j); j-- > 0; )
- (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)),
- C.iushrn(1),
- D.iushrn(1);
- x.cmp(y) >= 0
- ? (x.isub(y), A.isub(C), B.isub(D))
- : (y.isub(x), C.isub(A), D.isub(B));
+ (C.isOdd() || D.isOdd()) && (C.iadd(yp), D.isub(xp)), C.iushrn(1), D.iushrn(1);
+ x.cmp(y) >= 0 ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
}
return {
a: C,
@@ -26894,35 +22943,15 @@ var require_bn7 = __commonJS({
var a = this,
b = p.clone();
a.negative !== 0 ? (a = a.umod(p)) : (a = a.clone());
- for (
- var x1 = new BN(1), x2 = new BN(0), delta = b.clone();
- a.cmpn(1) > 0 && b.cmpn(1) > 0;
-
- ) {
- for (
- var i = 0, im = 1;
- (a.words[0] & im) === 0 && i < 26;
- ++i, im <<= 1
- );
- if (i > 0)
- for (a.iushrn(i); i-- > 0; )
- x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
- for (
- var j = 0, jm = 1;
- (b.words[0] & jm) === 0 && j < 26;
- ++j, jm <<= 1
- );
- if (j > 0)
- for (b.iushrn(j); j-- > 0; )
- x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
+ for (var x1 = new BN(1), x2 = new BN(0), delta = b.clone(); a.cmpn(1) > 0 && b.cmpn(1) > 0; ) {
+ for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
+ if (i > 0) for (a.iushrn(i); i-- > 0; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
+ for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
+ if (j > 0) for (b.iushrn(j); j-- > 0; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
a.cmp(b) >= 0 ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
}
var res;
- return (
- a.cmpn(1) === 0 ? (res = x1) : (res = x2),
- res.cmpn(0) < 0 && res.iadd(p),
- res
- );
+ return a.cmpn(1) === 0 ? (res = x1) : (res = x2), res.cmpn(0) < 0 && res.iadd(p), res;
}),
(BN.prototype.gcd = function (num) {
if (this.isZero()) return num.abs();
@@ -26930,8 +22959,7 @@ var require_bn7 = __commonJS({
var a = this.clone(),
b = num.clone();
(a.negative = 0), (b.negative = 0);
- for (var shift = 0; a.isEven() && b.isEven(); shift++)
- a.iushrn(1), b.iushrn(1);
+ for (var shift = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), b.iushrn(1);
do {
for (; a.isEven(); ) a.iushrn(1);
for (; b.isEven(); ) b.iushrn(1);
@@ -26961,14 +22989,10 @@ var require_bn7 = __commonJS({
var r = bit % 26,
s = (bit - r) / 26,
q = 1 << r;
- if (this.length <= s)
- return this._expand(s + 1), (this.words[s] |= q), this;
+ if (this.length <= s) return this._expand(s + 1), (this.words[s] |= q), this;
for (var carry = q, i = s; carry !== 0 && i < this.length; i++) {
var w = this.words[i] | 0;
- (w += carry),
- (carry = w >>> 26),
- (w &= 67108863),
- (this.words[i] = w);
+ (w += carry), (carry = w >>> 26), (w &= 67108863), (this.words[i] = w);
}
return carry !== 0 && ((this.words[i] = carry), this.length++), this;
}),
@@ -26983,8 +23007,7 @@ var require_bn7 = __commonJS({
var res;
if (this.length > 1) res = 1;
else {
- negative && (num = -num),
- assert(num <= 67108863, "Number is too big");
+ negative && (num = -num), assert(num <= 67108863, "Number is too big");
var w = this.words[0] | 0;
res = w === num ? 0 : w < num ? -1 : 1;
}
@@ -27050,52 +23073,28 @@ var require_bn7 = __commonJS({
);
}),
(BN.prototype.fromRed = function () {
- return (
- assert(
- this.red,
- "fromRed works only with numbers in reduction context",
- ),
- this.red.convertFrom(this)
- );
+ return assert(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this);
}),
(BN.prototype._forceRed = function (ctx) {
return (this.red = ctx), this;
}),
(BN.prototype.forceRed = function (ctx) {
- return (
- assert(!this.red, "Already a number in reduction context"),
- this._forceRed(ctx)
- );
+ return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
}),
(BN.prototype.redAdd = function (num) {
- return (
- assert(this.red, "redAdd works only with red numbers"),
- this.red.add(this, num)
- );
+ return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
}),
(BN.prototype.redIAdd = function (num) {
- return (
- assert(this.red, "redIAdd works only with red numbers"),
- this.red.iadd(this, num)
- );
+ return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
}),
(BN.prototype.redSub = function (num) {
- return (
- assert(this.red, "redSub works only with red numbers"),
- this.red.sub(this, num)
- );
+ return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
}),
(BN.prototype.redISub = function (num) {
- return (
- assert(this.red, "redISub works only with red numbers"),
- this.red.isub(this, num)
- );
+ return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
}),
(BN.prototype.redShl = function (num) {
- return (
- assert(this.red, "redShl works only with red numbers"),
- this.red.shl(this, num)
- );
+ return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
}),
(BN.prototype.redMul = function (num) {
return (
@@ -27112,46 +23111,22 @@ var require_bn7 = __commonJS({
);
}),
(BN.prototype.redSqr = function () {
- return (
- assert(this.red, "redSqr works only with red numbers"),
- this.red._verify1(this),
- this.red.sqr(this)
- );
+ return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this);
}),
(BN.prototype.redISqr = function () {
- return (
- assert(this.red, "redISqr works only with red numbers"),
- this.red._verify1(this),
- this.red.isqr(this)
- );
+ return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this);
}),
(BN.prototype.redSqrt = function () {
- return (
- assert(this.red, "redSqrt works only with red numbers"),
- this.red._verify1(this),
- this.red.sqrt(this)
- );
+ return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this);
}),
(BN.prototype.redInvm = function () {
- return (
- assert(this.red, "redInvm works only with red numbers"),
- this.red._verify1(this),
- this.red.invm(this)
- );
+ return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this);
}),
(BN.prototype.redNeg = function () {
- return (
- assert(this.red, "redNeg works only with red numbers"),
- this.red._verify1(this),
- this.red.neg(this)
- );
+ return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this);
}),
(BN.prototype.redPow = function (num) {
- return (
- assert(this.red && !num.red, "redPow(normalNum)"),
- this.red._verify1(this),
- this.red.pow(this, num)
- );
+ return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, num);
});
var primes = {
k256: null,
@@ -27173,11 +23148,7 @@ var require_bn7 = __commonJS({
(MPrime.prototype.ireduce = function (num) {
var r = num,
rlen;
- do
- this.split(r, this.tmp),
- (r = this.imulK(r)),
- (r = r.iadd(this.tmp)),
- (rlen = r.bitLength());
+ do this.split(r, this.tmp), (r = this.imulK(r)), (r = r.iadd(this.tmp)), (rlen = r.bitLength());
while (rlen > this.n);
var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
return (
@@ -27198,78 +23169,45 @@ var require_bn7 = __commonJS({
return num.imul(this.k);
});
function K256() {
- MPrime.call(
- this,
- "k256",
- "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
- );
+ MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
}
inherits(K256, MPrime),
(K256.prototype.split = function (input, output) {
- for (
- var mask = 4194303, outLen = Math.min(input.length, 9), i = 0;
- i < outLen;
- i++
- )
+ for (var mask = 4194303, outLen = Math.min(input.length, 9), i = 0; i < outLen; i++)
output.words[i] = input.words[i];
if (((output.length = outLen), input.length <= 9)) {
(input.words[0] = 0), (input.length = 1);
return;
}
var prev = input.words[9];
- for (
- output.words[output.length++] = prev & mask, i = 10;
- i < input.length;
- i++
- ) {
+ for (output.words[output.length++] = prev & mask, i = 10; i < input.length; i++) {
var next = input.words[i] | 0;
- (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)),
- (prev = next);
+ (input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22)), (prev = next);
}
(prev >>>= 22),
(input.words[i - 10] = prev),
- prev === 0 && input.length > 10
- ? (input.length -= 10)
- : (input.length -= 9);
+ prev === 0 && input.length > 10 ? (input.length -= 10) : (input.length -= 9);
}),
(K256.prototype.imulK = function (num) {
- (num.words[num.length] = 0),
- (num.words[num.length + 1] = 0),
- (num.length += 2);
+ (num.words[num.length] = 0), (num.words[num.length + 1] = 0), (num.length += 2);
for (var lo = 0, i = 0; i < num.length; i++) {
var w = num.words[i] | 0;
- (lo += w * 977),
- (num.words[i] = lo & 67108863),
- (lo = w * 64 + ((lo / 67108864) | 0));
+ (lo += w * 977), (num.words[i] = lo & 67108863), (lo = w * 64 + ((lo / 67108864) | 0));
}
return (
- num.words[num.length - 1] === 0 &&
- (num.length--, num.words[num.length - 1] === 0 && num.length--),
- num
+ num.words[num.length - 1] === 0 && (num.length--, num.words[num.length - 1] === 0 && num.length--), num
);
});
function P224() {
- MPrime.call(
- this,
- "p224",
- "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
- );
+ MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
}
inherits(P224, MPrime);
function P192() {
- MPrime.call(
- this,
- "p192",
- "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
- );
+ MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
}
inherits(P192, MPrime);
function P25519() {
- MPrime.call(
- this,
- "25519",
- "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
- );
+ MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
}
inherits(P25519, MPrime),
(P25519.prototype.imulK = function (num) {
@@ -27294,26 +23232,17 @@ var require_bn7 = __commonJS({
if (typeof m == "string") {
var prime = BN._prime(m);
(this.m = prime.p), (this.prime = prime);
- } else
- assert(m.gtn(1), "modulus must be greater than 1"),
- (this.m = m),
- (this.prime = null);
+ } else assert(m.gtn(1), "modulus must be greater than 1"), (this.m = m), (this.prime = null);
}
(Red.prototype._verify1 = function (a) {
- assert(a.negative === 0, "red works only with positives"),
- assert(a.red, "red works only with red numbers");
+ assert(a.negative === 0, "red works only with positives"), assert(a.red, "red works only with red numbers");
}),
(Red.prototype._verify2 = function (a, b) {
- assert(
- (a.negative | b.negative) === 0,
- "red works only with positives",
- ),
+ assert((a.negative | b.negative) === 0, "red works only with positives"),
assert(a.red && a.red === b.red, "red works only with red numbers");
}),
(Red.prototype.imod = function (a) {
- return this.prime
- ? this.prime.ireduce(a)._forceRed(this)
- : a.umod(this.m)._forceRed(this);
+ return this.prime ? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);
}),
(Red.prototype.neg = function (a) {
return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
@@ -27360,29 +23289,19 @@ var require_bn7 = __commonJS({
var pow = this.m.add(new BN(1)).iushrn(2);
return this.pow(a, pow);
}
- for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; )
- s++, q.iushrn(1);
+ for (var q = this.m.subn(1), s = 0; !q.isZero() && q.andln(1) === 0; ) s++, q.iushrn(1);
assert(!q.isZero());
var one = new BN(1).toRed(this),
nOne = one.redNeg(),
lpow = this.m.subn(1).iushrn(1),
z = this.m.bitLength();
+ for (z = new BN(2 * z * z).toRed(this); this.pow(z, lpow).cmp(nOne) !== 0; ) z.redIAdd(nOne);
for (
- z = new BN(2 * z * z).toRed(this);
- this.pow(z, lpow).cmp(nOne) !== 0;
-
- )
- z.redIAdd(nOne);
- for (
- var c = this.pow(z, q),
- r = this.pow(a, q.addn(1).iushrn(1)),
- t = this.pow(a, q),
- m = s;
+ var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s;
t.cmp(one) !== 0;
) {
- for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++)
- tmp = tmp.redSqr();
+ for (var tmp = t, i = 0; tmp.cmp(one) !== 0; i++) tmp = tmp.redSqr();
assert(i < m);
var b = this.pow(c, new BN(1).iushln(m - i - 1));
(r = r.redMul(b)), (c = b.redSqr()), (t = t.redMul(c)), (m = i);
@@ -27391,9 +23310,7 @@ var require_bn7 = __commonJS({
}),
(Red.prototype.invm = function (a) {
var inv = a._invmp(this.m);
- return inv.negative !== 0
- ? ((inv.negative = 0), this.imod(inv).redNeg())
- : this.imod(inv);
+ return inv.negative !== 0 ? ((inv.negative = 0), this.imod(inv).redNeg()) : this.imod(inv);
}),
(Red.prototype.pow = function (a, num) {
if (num.isZero()) return new BN(1).toRed(this);
@@ -27409,10 +23326,7 @@ var require_bn7 = __commonJS({
for (start === 0 && (start = 26), i = num.length - 1; i >= 0; i--) {
for (var word = num.words[i], j = start - 1; j >= 0; j--) {
var bit = (word >> j) & 1;
- if (
- (res !== wnd[0] && (res = this.sqr(res)),
- bit === 0 && current === 0)
- ) {
+ if ((res !== wnd[0] && (res = this.sqr(res)), bit === 0 && current === 0)) {
currentLen = 0;
continue;
}
@@ -27420,9 +23334,7 @@ var require_bn7 = __commonJS({
(current |= bit),
currentLen++,
!(currentLen !== windowSize && (i !== 0 || j !== 0)) &&
- ((res = this.mul(res, wnd[current])),
- (currentLen = 0),
- (current = 0));
+ ((res = this.mul(res, wnd[current])), (currentLen = 0), (current = 0));
}
start = 26;
}
@@ -27459,38 +23371,23 @@ var require_bn7 = __commonJS({
return (r.red = null), r;
}),
(Mont.prototype.imul = function (a, b) {
- if (a.isZero() || b.isZero())
- return (a.words[0] = 0), (a.length = 1), a;
+ if (a.isZero() || b.isZero()) return (a.words[0] = 0), (a.length = 1), a;
var t = a.imul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.mul = function (a, b) {
if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
var t = a.mul(b),
- c = t
- .maskn(this.shift)
- .mul(this.minv)
- .imaskn(this.shift)
- .mul(this.m),
+ c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
u = t.isub(c).iushrn(this.shift),
res = u;
return (
- u.cmp(this.m) >= 0
- ? (res = u.isub(this.m))
- : u.cmpn(0) < 0 && (res = u.iadd(this.m)),
- res._forceRed(this)
+ u.cmp(this.m) >= 0 ? (res = u.isub(this.m)) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), res._forceRed(this)
);
}),
(Mont.prototype.invm = function (a) {
@@ -27509,13 +23406,7 @@ var require_withPublic = __commonJS({
var BN = require_bn7(),
Buffer2 = require_safe_buffer().Buffer;
function withPublic(paddedMsg, key) {
- return Buffer2.from(
- paddedMsg
- .toRed(BN.mont(key.modulus))
- .redPow(new BN(key.publicExponent))
- .fromRed()
- .toArray(),
- );
+ return Buffer2.from(paddedMsg.toRed(BN.mont(key.modulus)).redPow(new BN(key.publicExponent)).fromRed().toArray());
}
module.exports = withPublic;
},
@@ -27535,18 +23426,13 @@ var require_publicEncrypt = __commonJS({
Buffer2 = require_safe_buffer().Buffer;
module.exports = function (publicKey, msg, reverse) {
var padding;
- publicKey.padding
- ? (padding = publicKey.padding)
- : reverse
- ? (padding = 1)
- : (padding = 4);
+ publicKey.padding ? (padding = publicKey.padding) : reverse ? (padding = 1) : (padding = 4);
var key = parseKeys(publicKey),
paddedMsg;
if (padding === 4) paddedMsg = oaep(key, msg);
else if (padding === 1) paddedMsg = pkcs1(key, msg, reverse);
else if (padding === 3) {
- if (((paddedMsg = new BN(msg)), paddedMsg.cmp(key.modulus) >= 0))
- throw new Error("data too long for modulus");
+ if (((paddedMsg = new BN(msg)), paddedMsg.cmp(key.modulus) >= 0)) throw new Error("data too long for modulus");
} else throw new Error("unknown padding");
return reverse ? crt(paddedMsg, key) : withPublic(paddedMsg, key);
};
@@ -27560,14 +23446,9 @@ var require_publicEncrypt = __commonJS({
var ps = Buffer2.alloc(k - mLen - hLen2 - 2),
dblen = k - hLen - 1,
seed = randomBytes(hLen),
- maskedDb = xor(
- Buffer2.concat([iHash, ps, Buffer2.alloc(1, 1), msg], dblen),
- mgf(seed, dblen),
- ),
+ maskedDb = xor(Buffer2.concat([iHash, ps, Buffer2.alloc(1, 1), msg], dblen), mgf(seed, dblen)),
maskedSeed = xor(seed, mgf(maskedDb, hLen));
- return new BN(
- Buffer2.concat([Buffer2.alloc(1), maskedSeed, maskedDb], k),
- );
+ return new BN(Buffer2.concat([Buffer2.alloc(1), maskedSeed, maskedDb], k));
}
function pkcs1(key, msg, reverse) {
var mLen = msg.length,
@@ -27575,27 +23456,12 @@ var require_publicEncrypt = __commonJS({
if (mLen > k - 11) throw new Error("message too long");
var ps;
return (
- reverse
- ? (ps = Buffer2.alloc(k - mLen - 3, 255))
- : (ps = nonZero(k - mLen - 3)),
- new BN(
- Buffer2.concat(
- [Buffer2.from([0, reverse ? 1 : 2]), ps, Buffer2.alloc(1), msg],
- k,
- ),
- )
+ reverse ? (ps = Buffer2.alloc(k - mLen - 3, 255)) : (ps = nonZero(k - mLen - 3)),
+ new BN(Buffer2.concat([Buffer2.from([0, reverse ? 1 : 2]), ps, Buffer2.alloc(1), msg], k))
);
}
function nonZero(len) {
- for (
- var out = Buffer2.allocUnsafe(len),
- i = 0,
- cache = randomBytes(len * 2),
- cur = 0,
- num;
- i < len;
-
- )
+ for (var out = Buffer2.allocUnsafe(len), i = 0, cache = randomBytes(len * 2), cur = 0, num; i < len; )
cur === cache.length && ((cache = randomBytes(len * 2)), (cur = 0)),
(num = cache[cur++]),
num && (out[i++] = num);
@@ -27617,20 +23483,14 @@ var require_privateDecrypt = __commonJS({
Buffer2 = require_safe_buffer().Buffer;
module.exports = function (privateKey, enc, reverse) {
var padding;
- privateKey.padding
- ? (padding = privateKey.padding)
- : reverse
- ? (padding = 1)
- : (padding = 4);
+ privateKey.padding ? (padding = privateKey.padding) : reverse ? (padding = 1) : (padding = 4);
var key = parseKeys(privateKey),
k = key.modulus.byteLength();
- if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0)
- throw new Error("decryption error");
+ if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) throw new Error("decryption error");
var msg;
reverse ? (msg = withPublic(new BN(enc), key)) : (msg = crt(enc, key));
var zBuffer = Buffer2.alloc(k - msg.length);
- if (((msg = Buffer2.concat([zBuffer, msg], k)), padding === 4))
- return oaep(key, msg);
+ if (((msg = Buffer2.concat([zBuffer, msg], k)), padding === 4)) return oaep(key, msg);
if (padding === 1) return pkcs1(key, msg, reverse);
if (padding === 3) return msg;
throw new Error("unknown padding");
@@ -27644,8 +23504,7 @@ var require_privateDecrypt = __commonJS({
maskedDb = msg.slice(hLen + 1),
seed = xor(maskedSeed, mgf(maskedDb, hLen)),
db = xor(maskedDb, mgf(seed, k - hLen - 1));
- if (compare(iHash, db.slice(0, hLen)))
- throw new Error("decryption error");
+ if (compare(iHash, db.slice(0, hLen))) throw new Error("decryption error");
for (var i = hLen; db[i] === 0; ) i++;
if (db[i++] !== 1) throw new Error("decryption error");
return db.slice(i);
@@ -27658,9 +23517,7 @@ var require_privateDecrypt = __commonJS({
}
var ps = msg.slice(2, i - 1);
if (
- (((p1.toString("hex") !== "0002" && !reverse) ||
- (p1.toString("hex") !== "0001" && reverse)) &&
- status++,
+ (((p1.toString("hex") !== "0002" && !reverse) || (p1.toString("hex") !== "0001" && reverse)) && status++,
ps.length < 8 && status++,
status)
)
@@ -27707,20 +23564,14 @@ use chrome, FireFox or Internet Explorer 11`);
crypto2 = global.crypto || global.msCrypto,
kMaxUint32 = Math.pow(2, 32) - 1;
function assertOffset(offset, length) {
- if (typeof offset != "number" || offset !== offset)
- throw new TypeError("offset must be a number");
- if (offset > kMaxUint32 || offset < 0)
- throw new TypeError("offset must be a uint32");
- if (offset > kBufferMaxLength || offset > length)
- throw new RangeError("offset out of range");
+ if (typeof offset != "number" || offset !== offset) throw new TypeError("offset must be a number");
+ if (offset > kMaxUint32 || offset < 0) throw new TypeError("offset must be a uint32");
+ if (offset > kBufferMaxLength || offset > length) throw new RangeError("offset out of range");
}
function assertSize(size, offset, length) {
- if (typeof size != "number" || size !== size)
- throw new TypeError("size must be a number");
- if (size > kMaxUint32 || size < 0)
- throw new TypeError("size must be a uint32");
- if (size + offset > length || size > kBufferMaxLength)
- throw new RangeError("buffer too small");
+ if (typeof size != "number" || size !== size) throw new TypeError("size must be a number");
+ if (size > kMaxUint32 || size < 0) throw new TypeError("size must be a uint32");
+ if (size + offset > length || size > kBufferMaxLength) throw new RangeError("buffer too small");
}
exports.randomFill = randomFill;
@@ -27729,17 +23580,10 @@ use chrome, FireFox or Internet Explorer 11`);
function randomFill(buf, offset, size, cb) {
if (!Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))
throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
- if (typeof offset == "function")
- (cb = offset), (offset = 0), (size = buf.length);
- else if (typeof size == "function")
- (cb = size), (size = buf.length - offset);
- else if (typeof cb != "function")
- throw new TypeError('"cb" argument must be a function');
- return (
- assertOffset(offset, buf.length),
- assertSize(size, offset, buf.length),
- actualFill(buf, offset, size, cb)
- );
+ if (typeof offset == "function") (cb = offset), (offset = 0), (size = buf.length);
+ else if (typeof size == "function") (cb = size), (size = buf.length - offset);
+ else if (typeof cb != "function") throw new TypeError('"cb" argument must be a function');
+ return assertOffset(offset, buf.length), assertSize(size, offset, buf.length), actualFill(buf, offset, size, cb);
}
function actualFill(buf, offset, size, cb) {
if (cb) {
@@ -27753,10 +23597,7 @@ use chrome, FireFox or Internet Explorer 11`);
return bytes.copy(buf, offset), buf;
}
function randomFillSync(buf, offset, size) {
- if (
- (typeof offset > "u" && (offset = 0),
- !Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array))
- )
+ if ((typeof offset > "u" && (offset = 0), !Buffer2.isBuffer(buf) && !(buf instanceof global.Uint8Array)))
throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
return (
assertOffset(offset, buf.length),
@@ -27772,25 +23613,13 @@ use chrome, FireFox or Internet Explorer 11`);
var require_crypto_browserify2 = __commonJS({
"node_modules/crypto-browserify/index.js"(exports) {
"use strict";
- exports.randomBytes =
- exports.rng =
- exports.pseudoRandomBytes =
- exports.prng =
- require_browser();
+ exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require_browser();
exports.createHash = require_browser2();
exports.Hash = exports.createHash.Hash;
exports.createHmac = exports.Hmac = require_browser3();
var algos = require_algos(),
algoKeys = Object.keys(algos),
- hashes = [
- "sha1",
- "sha224",
- "sha256",
- "sha384",
- "sha512",
- "md5",
- "rmd160",
- ].concat(algoKeys);
+ hashes = ["sha1", "sha224", "sha256", "sha384", "sha512", "md5", "rmd160"].concat(algoKeys);
exports.getHashes = function () {
return hashes;
};
@@ -27873,7 +23702,7 @@ __export(crypto_exports, {
webcrypto: () => webcrypto,
});
var DEFAULT_ENCODING = "buffer",
- getRandomValues = (array) => crypto.getRandomValues(array),
+ getRandomValues = array => crypto.getRandomValues(array),
randomUUID = () => crypto.randomUUID(),
timingSafeEqual =
"timingSafeEqual" in crypto
@@ -27882,8 +23711,7 @@ var DEFAULT_ENCODING = "buffer",
{ byteLength: byteLengthB } = b;
if (typeof byteLengthA != "number" || typeof byteLengthB != "number")
throw new TypeError("Input must be an array buffer view");
- if (byteLengthA !== byteLengthB)
- throw new RangeError("Input buffers must have the same length");
+ if (byteLengthA !== byteLengthB) throw new RangeError("Input buffers must have the same length");
return crypto.timingSafeEqual(a, b);
}
: void 0,
@@ -27891,18 +23719,14 @@ var DEFAULT_ENCODING = "buffer",
"scryptSync" in crypto
? (password, salt, keylen, options) => {
let res = crypto.scryptSync(password, salt, keylen, options);
- return DEFAULT_ENCODING !== "buffer"
- ? new Buffer(res).toString(DEFAULT_ENCODING)
- : new Buffer(res);
+ return DEFAULT_ENCODING !== "buffer" ? new Buffer(res).toString(DEFAULT_ENCODING) : new Buffer(res);
}
: void 0,
scrypt =
"scryptSync" in crypto
? function (password, salt, keylen, options, callback) {
if (
- (typeof options == "function" &&
- ((callback = options), (options = void 0)),
- typeof callback != "function")
+ (typeof options == "function" && ((callback = options), (options = void 0)), typeof callback != "function")
) {
var err = new TypeError("callback must be a function");
throw ((err.code = "ERR_INVALID_CALLBACK"), err);
@@ -27912,9 +23736,7 @@ var DEFAULT_ENCODING = "buffer",
process.nextTick(
callback,
null,
- DEFAULT_ENCODING !== "buffer"
- ? new Buffer(result).toString(DEFAULT_ENCODING)
- : new Buffer(result),
+ DEFAULT_ENCODING !== "buffer" ? new Buffer(result).toString(DEFAULT_ENCODING) : new Buffer(result),
);
} catch (err2) {
throw err2;
@@ -27932,14 +23754,6 @@ timingSafeEqual &&
value: "::bunternal::",
}));
var webcrypto = crypto;
-export {
- DEFAULT_ENCODING,
- getRandomValues,
- randomUUID,
- scrypt,
- scryptSync,
- timingSafeEqual,
- webcrypto,
-};
+export { DEFAULT_ENCODING, getRandomValues, randomUUID, scrypt, scryptSync, timingSafeEqual, webcrypto };
export default crypto_exports;
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
diff --git a/src/bun.js/depd.exports.js b/src/bun.js/depd.exports.js
index b6164bf02..b76526c01 100644
--- a/src/bun.js/depd.exports.js
+++ b/src/bun.js/depd.exports.js
@@ -15,11 +15,7 @@ var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) =>
function __require() {
- return (
- mod ||
- (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
- mod.exports
- );
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if ((from && typeof from === "object") || typeof from === "function") {
@@ -35,9 +31,7 @@ var __copyProps = (to, from, except, desc) => {
var __toESM = (mod, isNodeMode, target) => (
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
__copyProps(
- isNodeMode || !mod || !mod.__esModule
- ? __defProp(target, "default", { value: mod, enumerable: true })
- : target,
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod,
)
);
diff --git a/src/bun.js/ffi.exports.js b/src/bun.js/ffi.exports.js
index ec553b7d5..51a34e67a 100644
--- a/src/bun.js/ffi.exports.js
+++ b/src/bun.js/ffi.exports.js
@@ -1,8 +1,7 @@
// --- FFIType ---
var ffi = globalThis.Bun.FFI;
-export const ptr = (arg1, arg2) =>
- typeof arg2 === "undefined" ? ffi.ptr(arg1) : ffi.ptr(arg1, arg2);
+export const ptr = (arg1, arg2) => (typeof arg2 === "undefined" ? ffi.ptr(arg1) : ffi.ptr(arg1, arg2));
export const toBuffer = ffi.toBuffer;
export const toArrayBuffer = ffi.toArrayBuffer;
export const viewSource = ffi.viewSource;
@@ -79,11 +78,7 @@ export class CString extends String {
return (this.#cachedArrayBuffer = new ArrayBuffer(0));
}
- return (this.#cachedArrayBuffer = toArrayBuffer(
- this.ptr,
- this.byteOffset,
- this.byteLength,
- ));
+ return (this.#cachedArrayBuffer = toArrayBuffer(this.ptr, this.byteOffset, this.byteLength));
}
}
Object.defineProperty(globalThis, "__GlobalBunCString", {
@@ -94,7 +89,7 @@ Object.defineProperty(globalThis, "__GlobalBunCString", {
const ffiWrappers = new Array(18);
-var char = (val) => val | 0;
+var char = val => val | 0;
ffiWrappers.fill(char);
ffiWrappers[FFIType.uint8_t] = function uint8(val) {
return val < 0 ? 0 : val >= 255 ? 255 : val | 0;
@@ -114,10 +109,7 @@ ffiWrappers[FFIType.uint32_t] = function uint32(val) {
};
ffiWrappers[FFIType.i64_fast] = function int64(val) {
if (typeof val === "bigint") {
- if (
- val <= BigInt(Number.MAX_SAFE_INTEGER) &&
- val >= BigInt(-Number.MAX_SAFE_INTEGER)
- ) {
+ if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(-Number.MAX_SAFE_INTEGER)) {
return Number(val).valueOf() || 0;
}
@@ -165,8 +157,7 @@ ffiWrappers[FFIType.uint64_t] = function uint64(val) {
ffiWrappers[FFIType.u64_fast] = function u64_fast(val) {
if (typeof val === "bigint") {
- if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(0))
- return Number(val);
+ if (val <= BigInt(Number.MAX_SAFE_INTEGER) && val >= BigInt(0)) return Number(val);
return val;
}
@@ -181,9 +172,7 @@ ffiWrappers[FFIType.uint16_t] = function uint16(val) {
ffiWrappers[FFIType.double] = function double(val) {
if (typeof val === "bigint") {
if (val.valueOf() < BigInt(Number.MAX_VALUE)) {
- return (
- Math.abs(Number(val).valueOf()) + 0.00000000000001 - 0.00000000000001
- );
+ return Math.abs(Number(val).valueOf()) + 0.00000000000001 - 0.00000000000001;
}
}
@@ -208,9 +197,7 @@ Object.defineProperty(globalThis, "__GlobalBunFFIPtrFunctionForWrapper", {
configurable: true,
});
-ffiWrappers[FFIType.cstring] = ffiWrappers[FFIType.pointer] = function pointer(
- val,
-) {
+ffiWrappers[FFIType.cstring] = ffiWrappers[FFIType.pointer] = function pointer(val) {
if (typeof val === "number") return val;
if (!val) {
return null;
@@ -221,9 +208,7 @@ ffiWrappers[FFIType.cstring] = ffiWrappers[FFIType.pointer] = function pointer(
}
if (typeof val === "string") {
- throw new TypeError(
- "To convert a string to a pointer, encode it as a buffer",
- );
+ throw new TypeError("To convert a string to a pointer, encode it as a buffer");
}
throw new TypeError(`Unable to convert ${val} to a pointer`);
@@ -252,9 +237,7 @@ ffiWrappers[FFIType.function] = function functionType(val) {
};
function FFIBuilder(params, returnType, functionToCall, name) {
- const hasReturnType =
- typeof FFIType[returnType] === "number" &&
- FFIType[returnType] !== FFIType.void;
+ const hasReturnType = typeof FFIType[returnType] === "number" && FFIType[returnType] !== FFIType.void;
var paramNames = new Array(params.length);
var args = new Array(params.length);
for (let i = 0; i < params.length; i++) {
@@ -264,11 +247,7 @@ function FFIBuilder(params, returnType, functionToCall, name) {
// doing this inline benchmarked about 4x faster than referencing
args[i] = `(${wrapper.toString()})(p${i})`;
} else {
- throw new TypeError(
- `Unsupported type ${params[i]}. Must be one of: ${Object.keys(FFIType)
- .sort()
- .join(", ")}`,
- );
+ throw new TypeError(`Unsupported type ${params[i]}. Must be one of: ${Object.keys(FFIType).sort().join(", ")}`);
}
}
@@ -295,7 +274,7 @@ function FFIBuilder(params, returnType, functionToCall, name) {
wrap = () => func(functionToCall);
break;
case 1:
- wrap = (arg1) => func(functionToCall, arg1);
+ wrap = arg1 => func(functionToCall, arg1);
break;
case 2:
wrap = (arg1, arg2) => func(functionToCall, arg1, arg2);
@@ -304,16 +283,13 @@ function FFIBuilder(params, returnType, functionToCall, name) {
wrap = (arg1, arg2, arg3) => func(functionToCall, arg1, arg2, arg3);
break;
case 4:
- wrap = (arg1, arg2, arg3, arg4) =>
- func(functionToCall, arg1, arg2, arg3, arg4);
+ wrap = (arg1, arg2, arg3, arg4) => func(functionToCall, arg1, arg2, arg3, arg4);
break;
case 5:
- wrap = (arg1, arg2, arg3, arg4, arg5) =>
- func(functionToCall, arg1, arg2, arg3, arg4, arg5);
+ wrap = (arg1, arg2, arg3, arg4, arg5) => func(functionToCall, arg1, arg2, arg3, arg4, arg5);
break;
case 6:
- wrap = (arg1, arg2, arg3, arg4, arg5, arg6) =>
- func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6);
+ wrap = (arg1, arg2, arg3, arg4, arg5, arg6) => func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6);
break;
case 7:
wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7) =>
@@ -325,18 +301,7 @@ function FFIBuilder(params, returnType, functionToCall, name) {
break;
case 9:
wrap = (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) =>
- func(
- functionToCall,
- arg1,
- arg2,
- arg3,
- arg4,
- arg5,
- arg6,
- arg7,
- arg8,
- arg9,
- );
+ func(functionToCall, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
break;
default: {
wrap = (...args) => func(functionToCall, ...args);
@@ -361,10 +326,7 @@ export function dlopen(path, options) {
for (let key in result.symbols) {
var symbol = result.symbols[key];
- if (
- options[key]?.args?.length ||
- FFIType[options[key]?.returns] === FFIType.cstring
- ) {
+ if (options[key]?.args?.length || FFIType[options[key]?.returns] === FFIType.cstring) {
result.symbols[key] = FFIBuilder(
options[key].args ?? [],
options[key].returns ?? FFIType.void,
@@ -374,9 +336,7 @@ export function dlopen(path, options) {
// "/usr/lib/sqlite3.so"
// we want
// "sqlite3_get_version() - sqlit3.so"
- path.includes("/")
- ? `${key} (${path.split("/").pop()})`
- : `${key} (${path})`,
+ path.includes("/") ? `${key} (${path.split("/").pop()})` : `${key} (${path})`,
);
} else {
// consistentcy
@@ -392,16 +352,8 @@ export function linkSymbols(options) {
for (let key in result.symbols) {
var symbol = result.symbols[key];
- if (
- options[key]?.args?.length ||
- FFIType[options[key]?.returns] === FFIType.cstring
- ) {
- result.symbols[key] = FFIBuilder(
- options[key].args ?? [],
- options[key].returns ?? FFIType.void,
- symbol,
- key,
- );
+ if (options[key]?.args?.length || FFIType[options[key]?.returns] === FFIType.cstring) {
+ result.symbols[key] = FFIBuilder(options[key].args ?? [], options[key].returns ?? FFIType.void, symbol, key);
} else {
// consistentcy
result.symbols[key].native = result.symbols[key];
@@ -431,10 +383,7 @@ export function CFunction(options) {
};
cFunctionRegistry ||= new FinalizationRegistry(onCloseCFunction);
- cFunctionRegistry.register(
- result.symbols[identifier],
- result.symbols[identifier].close,
- );
+ cFunctionRegistry.register(result.symbols[identifier], result.symbols[identifier].close);
return result.symbols[identifier];
}
diff --git a/src/bun.js/fs.exports.js b/src/bun.js/fs.exports.js
index 158e929fa..86a0ef469 100644
--- a/src/bun.js/fs.exports.js
+++ b/src/bun.js/fs.exports.js
@@ -171,15 +171,11 @@ function callbackify(fsFunction, args) {
// _eventsCount
// _maxListener
var _lazyReadStream;
-var readStreamPathFastPathSymbol = Symbol.for(
- "Bun.Node.readStreamPathFastPath",
-);
+var readStreamPathFastPathSymbol = Symbol.for("Bun.Node.readStreamPathFastPath");
const readStreamSymbol = Symbol.for("Bun.NodeReadStream");
const readStreamPathOrFdSymbol = Symbol.for("Bun.NodeReadStreamPathOrFd");
var writeStreamPathFastPathSymbol = Symbol.for("Bun.NodeWriteStreamFastPath");
-var writeStreamPathFastPathCallSymbol = Symbol.for(
- "Bun.NodeWriteStreamFastPathCall",
-);
+var writeStreamPathFastPathCallSymbol = Symbol.for("Bun.NodeWriteStreamFastPathCall");
var kIoDone = Symbol.for("kIoDone");
function getLazyReadStream() {
@@ -187,11 +183,7 @@ function getLazyReadStream() {
return _lazyReadStream;
}
- var {
- Readable,
- _getNativeReadableStreamPrototype,
- eos: eos_,
- } = import.meta.require("node:stream");
+ var { Readable, _getNativeReadableStreamPrototype, eos: eos_ } = import.meta.require("node:stream");
var defaultReadStreamOptions = {
file: undefined,
fd: undefined,
@@ -255,10 +247,7 @@ function getLazyReadStream() {
if (pathOrFd.length === 0) {
throw new TypeError("Expected path to be a non-empty string");
}
- tempThis.path =
- tempThis.file =
- tempThis[readStreamPathOrFdSymbol] =
- pathOrFd;
+ tempThis.path = tempThis.file = tempThis[readStreamPathOrFdSymbol] = pathOrFd;
} else if (typeof pathOrFd === "number") {
pathOrFd |= 0;
if (pathOrFd < 0) {
@@ -364,7 +353,7 @@ function getLazyReadStream() {
if (!fd) {
cb(err);
} else {
- this.#fs.close(fd, (er) => {
+ this.#fs.close(fd, er => {
cb(er || err);
});
this.fd = null;
@@ -474,7 +463,7 @@ function getLazyReadStream() {
this.emit(kIoDone);
}
},
- (er) => {
+ er => {
this[kIoDone] = true;
this.#errorOrDestroy(er);
},
@@ -520,15 +509,8 @@ function getLazyReadStream() {
}
pipe(dest, pipeOpts) {
- if (
- this[readStreamPathFastPathSymbol] &&
- (pipeOpts?.end ?? true) &&
- this._readableState?.pipes?.length === 0
- ) {
- if (
- writeStreamPathFastPathSymbol in dest &&
- dest[writeStreamPathFastPathSymbol]
- ) {
+ if (this[readStreamPathFastPathSymbol] && (pipeOpts?.end ?? true) && this._readableState?.pipes?.length === 0) {
+ if (writeStreamPathFastPathSymbol in dest && dest[writeStreamPathFastPathSymbol]) {
if (dest[writeStreamPathFastPathCallSymbol](this, pipeOpts)) {
return this;
}
@@ -657,12 +639,7 @@ function getLazyWriteStream() {
if (encoding !== defaultWriteStreamOptions.encoding) {
this.setDefaultEncoding(encoding);
- if (
- encoding !== "buffer" &&
- encoding !== "utf8" &&
- encoding !== "utf-8" &&
- encoding !== "binary"
- ) {
+ if (encoding !== "buffer" && encoding !== "utf8" && encoding !== "utf-8" && encoding !== "binary") {
this[writeStreamPathFastPathSymbol] = false;
}
}
@@ -703,18 +680,15 @@ function getLazyWriteStream() {
this[kIoDone] = false;
readStream[kIoDone] = false;
- return Bun.write(
- this[writeStreamPathFastPathSymbol],
- readStream[readStreamPathOrFdSymbol],
- ).then(
- (bytesWritten) => {
+ return Bun.write(this[writeStreamPathFastPathSymbol], readStream[readStreamPathOrFdSymbol]).then(
+ bytesWritten => {
readStream[kIoDone] = this[kIoDone] = true;
this.bytesWritten += bytesWritten;
readStream.bytesRead += bytesWritten;
this.end();
readStream.close();
},
- (err) => {
+ err => {
readStream[kIoDone] = this[kIoDone] = true;
this.#errorOrDestroy(err);
readStream.emit("error", err);
@@ -741,7 +715,7 @@ function getLazyWriteStream() {
#internalClose(err, cb) {
this[writeStreamPathFastPathSymbol] = false;
var fd = this.fd;
- this.#fs.close(fd, (er) => {
+ this.#fs.close(fd, er => {
this.fd = null;
cb(err || er);
});
@@ -818,20 +792,13 @@ function getLazyWriteStream() {
}
#internalWriteSlow(chunk, encoding, cb) {
- this.#fs.write(
- this.fd,
- chunk,
- 0,
- chunk.length,
- this.pos,
- (err, bytes) => {
- this[kIoDone] = false;
- this.#handleWrite(err, bytes);
- this.emit(kIoDone);
+ this.#fs.write(this.fd, chunk, 0, chunk.length, this.pos, (err, bytes) => {
+ this[kIoDone] = false;
+ this.#handleWrite(err, bytes);
+ this.emit(kIoDone);
- !err ? cb() : cb(err);
- },
- );
+ !err ? cb() : cb(err);
+ });
}
end(chunk, encoding, cb) {
diff --git a/src/bun.js/fs_promises.exports.js b/src/bun.js/fs_promises.exports.js
index bcd67c6ac..fbf7cf641 100644
--- a/src/bun.js/fs_promises.exports.js
+++ b/src/bun.js/fs_promises.exports.js
@@ -5,7 +5,7 @@ var fs = Bun.fs();
// this is just better than nothing.
const notrace = "::bunternal::";
var promisify = {
- [notrace]: (fsFunction) => {
+ [notrace]: fsFunction => {
// TODO: remove variadic arguments
// we can use new Function() here instead
// based on fsFucntion.length
diff --git a/src/bun.js/http.exports.js b/src/bun.js/http.exports.js
index dd3745b30..d7f6e7053 100644
--- a/src/bun.js/http.exports.js
+++ b/src/bun.js/http.exports.js
@@ -65,7 +65,7 @@ export class Server extends EventEmitter {
var pendingResponse;
var pendingError;
var rejectFunction, resolveFunction;
- var reject = (err) => {
+ var reject = err => {
if (pendingError) return;
pendingError = err;
if (rejectFunction) rejectFunction(err);
@@ -80,8 +80,8 @@ export class Server extends EventEmitter {
const http_req = new RequestClass(req);
const http_res = new ResponseClass({ reply, req: http_req });
- http_req.once("error", (err) => reject(err));
- http_res.once("error", (err) => reject(err));
+ http_req.once("error", err => reject(err));
+ http_res.once("error", err => reject(err));
server.emit("request", http_req, http_res);
if (pendingError) {
@@ -99,11 +99,7 @@ export class Server extends EventEmitter {
},
});
- if (onListen)
- setTimeout(
- () => onListen(null, this.#server.hostname, this.#server.port),
- 0,
- );
+ if (onListen) setTimeout(() => onListen(null, this.#server.hostname, this.#server.port), 0);
} catch (err) {
if (onListen) {
setTimeout(onListen, 0, err);
@@ -201,15 +197,13 @@ export class IncomingMessage extends Readable {
const contentLength = this.#req.headers.get("content-length");
let remaining = contentLength ? parseInt(contentLength, 10) : 0;
this.#bodyStream = Readable.fromWeb(this.#req.body, {
- highWaterMark: Number.isFinite(remaining)
- ? Math.min(remaining, 16384)
- : 16384,
+ highWaterMark: Number.isFinite(remaining) ? Math.min(remaining, 16384) : 16384,
});
const isBodySizeKnown = remaining > 0 && Number.isSafeInteger(remaining);
if (isBodySizeKnown) {
- this.#bodyStream.on("data", (chunk) => {
+ this.#bodyStream.on("data", chunk => {
this.push(chunk);
// when we are streaming a known body size, automatically close the stream when we have read enough
remaining -= chunk?.byteLength ?? 0;
@@ -218,7 +212,7 @@ export class IncomingMessage extends Readable {
}
});
} else {
- this.#bodyStream.on("data", (chunk) => {
+ this.#bodyStream.on("data", chunk => {
this.push(chunk);
});
}
@@ -333,7 +327,7 @@ export class ServerResponse extends Writable {
return;
}
- this.#ensureReadableStreamController((controller) => {
+ this.#ensureReadableStreamController(controller => {
controller.write(chunk);
callback();
});
@@ -346,7 +340,7 @@ export class ServerResponse extends Writable {
return;
}
- this.#ensureReadableStreamController((controller) => {
+ this.#ensureReadableStreamController(controller => {
for (const chunk of chunks) {
controller.write(chunk.chunk);
}
@@ -365,13 +359,13 @@ export class ServerResponse extends Writable {
new Response(
new ReadableStream({
type: "direct",
- pull: (controller) => {
+ pull: controller => {
this.#controller = controller;
if (firstWrite) controller.write(firstWrite);
firstWrite = undefined;
run(controller);
if (!this.#finished) {
- return new Promise((resolve) => {
+ return new Promise(resolve => {
this.#deferred = resolve;
});
}
@@ -403,7 +397,7 @@ export class ServerResponse extends Writable {
}
this.#finished = true;
- this.#ensureReadableStreamController((controller) => {
+ this.#ensureReadableStreamController(controller => {
controller.end();
callback();
@@ -685,8 +679,7 @@ function _writeHead(statusCode, reason, obj, response) {
response.statusMessage = reason;
} else {
// writeHead(statusCode[, headers])
- if (!response.statusMessage)
- response.statusMessage = STATUS_CODES[statusCode] || "unknown";
+ if (!response.statusMessage) response.statusMessage = STATUS_CODES[statusCode] || "unknown";
obj = reason;
}
response.statusCode = statusCode;
diff --git a/src/bun.js/net.exports.js b/src/bun.js/net.exports.js
index b4229a271..6ed03d2b7 100644
--- a/src/bun.js/net.exports.js
+++ b/src/bun.js/net.exports.js
@@ -166,13 +166,7 @@ export const Socket = (function (InternalSocket) {
#pendingRead;
constructor(options) {
- const {
- signal,
- write,
- read,
- allowHalfOpen = false,
- ...opts
- } = options || {};
+ const { signal, write, read, allowHalfOpen = false, ...opts } = options || {};
super({
...opts,
allowHalfOpen,
@@ -335,8 +329,7 @@ export const Socket = (function (InternalSocket) {
}
_write(chunk, encoding, callback) {
- if (typeof chunk == "string" && encoding !== "utf8")
- chunk = Buffer.from(chunk, encoding);
+ if (typeof chunk == "string" && encoding !== "utf8") chunk = Buffer.from(chunk, encoding);
var written = this.#socket?.write(chunk);
if (written == chunk.length) {
callback();
diff --git a/src/bun.js/node-dns.exports.js b/src/bun.js/node-dns.exports.js
index 0bcc915cd..ad3a44d1b 100644
--- a/src/bun.js/node-dns.exports.js
+++ b/src/bun.js/node-dns.exports.js
@@ -19,7 +19,7 @@ function lookup(domain, options, callback) {
([{ address, family }]) => {
callback(null, address, family);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -31,26 +31,25 @@ function resolveSrv(hostname, callback) {
}
dns.resolveSrv(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
}
-
function resolveTxt(hostname, callback) {
if (typeof callback != "function") {
throw new TypeError("callback must be a function");
}
dns.resolveTxt(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -62,10 +61,10 @@ function resolveSoa(hostname, callback) {
}
dns.resolveSoa(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -77,10 +76,10 @@ function resolveNaptr(hostname, callback) {
}
dns.resolveNaptr(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -92,14 +91,13 @@ function resolveMx(hostname, callback) {
}
dns.resolveMx(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
-
}
function resolveCaa(hostname, callback) {
@@ -108,10 +106,10 @@ function resolveCaa(hostname, callback) {
}
dns.resolveCaa(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -123,10 +121,10 @@ function resolveNs(hostname, callback) {
}
dns.resolveNs(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -138,10 +136,10 @@ function resolvePtr(hostname, callback) {
}
dns.resolvePtr(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -153,10 +151,10 @@ function resolveCname(hostname, callback) {
}
dns.resolveCname(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -171,9 +169,9 @@ function lookupService(address, port, callback) {
}
var InternalResolver = class Resolver {
- constructor(options) { }
+ constructor(options) {}
- cancel() { }
+ cancel() {}
getServers() {
return [];
@@ -189,10 +187,10 @@ var InternalResolver = class Resolver {
}
dns.resolve(hostname).then(
- (results) => {
+ results => {
switch (rrtype?.toLowerCase()) {
- case 'a':
- case 'aaaa':
+ case "a":
+ case "aaaa":
callback(
null,
hostname,
@@ -203,9 +201,8 @@ var InternalResolver = class Resolver {
callback(null, results);
break;
}
-
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -221,13 +218,13 @@ var InternalResolver = class Resolver {
}
dns.lookup(hostname, { family: 4 }).then(
- (addresses) => {
+ addresses => {
callback(
null,
addresses.map(({ address }) => address),
);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -243,13 +240,13 @@ var InternalResolver = class Resolver {
}
dns.lookup(hostname, { family: 6 }).then(
- (addresses) => {
+ addresses => {
callback(
null,
addresses.map(({ address }) => address),
);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -265,10 +262,10 @@ var InternalResolver = class Resolver {
}
dns.resolveCname(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -280,14 +277,13 @@ var InternalResolver = class Resolver {
}
dns.resolveMx(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
-
}
resolveNaptr(hostname, callback) {
@@ -296,10 +292,10 @@ var InternalResolver = class Resolver {
}
dns.resolveNaptr(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -311,10 +307,10 @@ var InternalResolver = class Resolver {
}
dns.resolveNs(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -326,10 +322,10 @@ var InternalResolver = class Resolver {
}
dns.resolvePtr(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -341,10 +337,10 @@ var InternalResolver = class Resolver {
}
dns.resolveSrv(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -356,10 +352,10 @@ var InternalResolver = class Resolver {
}
dns.resolveCaa(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -371,10 +367,10 @@ var InternalResolver = class Resolver {
}
dns.resolveTxt(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -385,10 +381,10 @@ var InternalResolver = class Resolver {
}
dns.resolveSoa(hostname, callback).then(
- (results) => {
+ results => {
callback(null, results);
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -398,7 +394,7 @@ var InternalResolver = class Resolver {
callback(null, []);
}
- setServers(servers) { }
+ setServers(servers) {}
};
function resolve(hostname, rrtype, callback) {
@@ -411,10 +407,10 @@ function resolve(hostname, rrtype, callback) {
}
dns.resolve(hostname).then(
- (results) => {
+ results => {
switch (rrtype?.toLowerCase()) {
- case 'a':
- case 'aaaa':
+ case "a":
+ case "aaaa":
callback(
null,
hostname,
@@ -425,9 +421,8 @@ function resolve(hostname, rrtype, callback) {
callback(null, results);
break;
}
-
},
- (error) => {
+ error => {
callback(error);
},
);
@@ -456,29 +451,28 @@ export var {
resolveTxt,
} = InternalResolver.prototype;
-function setDefaultResultOrder() { }
-function setServers() { }
+function setDefaultResultOrder() {}
+function setServers() {}
-const promisifyLookup = (res) => {
+const promisifyLookup = res => {
res.sort((a, b) => a.family - b.family);
const [{ address, family }] = res;
return { address, family };
};
-const promisifyResolve = (rrtype) => {
+const promisifyResolve = rrtype => {
switch (rrtype?.toLowerCase()) {
- case 'a':
- case 'aaaa':
- return (res) => {
-
+ case "a":
+ case "aaaa":
+ return res => {
res.sort((a, b) => a.family - b.family);
const [{ address, family }] = res;
return { address, family };
};
default:
- return (res) => res;
+ return res => res;
}
-}
+};
// promisified versions
export const promises = {
@@ -532,9 +526,9 @@ export const promises = {
},
Resolver: class Resolver {
- constructor(options) { }
+ constructor(options) {}
- cancel() { }
+ cancel() {}
getServers() {
return [];
@@ -596,13 +590,10 @@ export const promises = {
return Promise.resolve([]);
}
- setServers(servers) { }
+ setServers(servers) {}
},
};
-for (const key of [
- "resolveAny",
- "reverse",
-]) {
+for (const key of ["resolveAny", "reverse"]) {
promises[key] = () => Promise.resolve(undefined);
}
diff --git a/src/bun.js/node-tls.exports.js b/src/bun.js/node-tls.exports.js
index bb1a4f950..74a64cca4 100644
--- a/src/bun.js/node-tls.exports.js
+++ b/src/bun.js/node-tls.exports.js
@@ -11,8 +11,7 @@ function createSecureContext(options) {
return new SecureContext();
}
-const { [Symbol.for("::bunternal::")]: InternalTCPSocket } =
- import.meta.require("net");
+const { [Symbol.for("::bunternal::")]: InternalTCPSocket } = import.meta.require("net");
const buntls = Symbol.for("::buntls::");
diff --git a/src/bun.js/node_streams_consumer.exports.js b/src/bun.js/node_streams_consumer.exports.js
index d4f775ba9..dba3f6a93 100644
--- a/src/bun.js/node_streams_consumer.exports.js
+++ b/src/bun.js/node_streams_consumer.exports.js
@@ -2,10 +2,9 @@ const { Bun } = import.meta.primordials;
export const arrayBuffer = Bun.readableStreamToArrayBuffer;
export const text = Bun.readableStreamToText;
-export const json = (stream) =>
- Bun.readableStreamToText(stream).then(JSON.parse);
+export const json = stream => Bun.readableStreamToText(stream).then(JSON.parse);
-export const buffer = async (readableStream) => {
+export const buffer = async readableStream => {
return new Buffer(await arrayBuffer(readableStream));
};
diff --git a/src/bun.js/node_streams_web.exports.js b/src/bun.js/node_streams_web.exports.js
index a856839ec..d4c5a278c 100644
--- a/src/bun.js/node_streams_web.exports.js
+++ b/src/bun.js/node_streams_web.exports.js
@@ -1,18 +1,29 @@
-export const ReadableStream = globalThis.ReadableStream;
-export const ReadableStreamDefaultController =
- globalThis.ReadableStreamDefaultController;
-export const WritableStream = globalThis.WritableStream;
-export const WritableStreamDefaultController =
- globalThis.WritableStreamDefaultController;
-export const WritableStreamDefaultWriter =
- globalThis.WritableStreamDefaultWriter;
-export const TransformStream = globalThis.TransformStream;
-export const TransformStreamDefaultController =
- globalThis.TransformStreamDefaultController;
-
-export const ByteLengthQueuingStrategy = globalThis.ByteLengthQueuingStrategy;
-export const CountQueuingStrategy = globalThis.CountQueuingStrategy;
-export const ReadableStreamBYOBReader = globalThis.ReadableStreamBYOBReader;
-export const ReadableStreamBYOBRequest = globalThis.ReadableStreamBYOBRequest;
-export const ReadableStreamDefaultReader =
- globalThis.ReadableStreamDefaultReader;
+export const {
+ ReadableStream,
+ ReadableStreamDefaultController,
+ WritableStream,
+ WritableStreamDefaultController,
+ WritableStreamDefaultWriter,
+ TransformStream,
+ TransformStreamDefaultController,
+ ByteLengthQueuingStrategy,
+ CountQueuingStrategy,
+ ReadableStreamBYOBReader,
+ ReadableStreamBYOBRequest,
+ ReadableStreamDefaultReader,
+} = globalThis;
+export default {
+ ReadableStream,
+ ReadableStreamDefaultController,
+ WritableStream,
+ WritableStreamDefaultController,
+ WritableStreamDefaultWriter,
+ TransformStream,
+ TransformStreamDefaultController,
+ ByteLengthQueuingStrategy,
+ CountQueuingStrategy,
+ ReadableStreamBYOBReader,
+ ReadableStreamBYOBRequest,
+ ReadableStreamDefaultReader,
+ [Symbol.for("CommonJS")]: 0,
+};
diff --git a/src/bun.js/node_timers_promises.exports.js b/src/bun.js/node_timers_promises.exports.js
index a2c6d4558..3c4c5d1a5 100644
--- a/src/bun.js/node_timers_promises.exports.js
+++ b/src/bun.js/node_timers_promises.exports.js
@@ -1,5 +1,4 @@
// https://github.com/niksy/isomorphic-timers-promises/blob/master/index.js
-
const symbolAsyncIterator = Symbol.asyncIterator;
class ERR_INVALID_ARG_TYPE extends Error {
@@ -29,10 +28,7 @@ function validateBoolean(value, name) {
}
function validateAbortSignal(signal, name) {
- if (
- typeof signal !== "undefined" &&
- (signal === null || typeof signal !== "object" || !("aborted" in signal))
- ) {
+ if (typeof signal !== "undefined" && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
}
}
@@ -235,8 +231,4 @@ function setIntervalPromise(after = 1, value, options = {}) {
}
}
-export {
- setTimeoutPromise as setTimeout,
- setImmediatePromise as setImmediate,
- setIntervalPromise as setInterval,
-};
+export { setTimeoutPromise as setTimeout, setImmediatePromise as setImmediate, setIntervalPromise as setInterval };
diff --git a/src/bun.js/perf_hooks.exports.js b/src/bun.js/perf_hooks.exports.js
index d25f90ccf..8a1a9a915 100644
--- a/src/bun.js/perf_hooks.exports.js
+++ b/src/bun.js/perf_hooks.exports.js
@@ -13,9 +13,7 @@ export class PerformanceEntry {
}
export class PerformanceNodeTiming {
constructor() {
- throw new Error(
- "PerformanceNodeTiming is not supported in this environment.",
- );
+ throw new Error("PerformanceNodeTiming is not supported in this environment.");
}
}
diff --git a/src/bun.js/readline.exports.js b/src/bun.js/readline.exports.js
index cc85389fb..be7b75568 100644
--- a/src/bun.js/readline.exports.js
+++ b/src/bun.js/readline.exports.js
@@ -109,10 +109,7 @@ var createSafeIterator = (factory, next) => {
return SafeIterator;
};
-var SafeStringIterator = createSafeIterator(
- StringPrototypeSymbolIterator,
- StringIteratorPrototypeNext,
-);
+var SafeStringIterator = createSafeIterator(StringPrototypeSymbolIterator, StringIteratorPrototypeNext);
// ----------------------------------------------------------------------------
// Section: "Internal" modules
@@ -122,7 +119,7 @@ var SafeStringIterator = createSafeIterator(
* Returns true if the character represented by a given
* Unicode code point is full-width. Otherwise returns false.
*/
-var isFullWidthCodePoint = (code) => {
+var isFullWidthCodePoint = code => {
// Code points are partially derived from:
// https://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
return (
@@ -161,7 +158,7 @@ var isFullWidthCodePoint = (code) => {
);
};
-var isZeroWidthCodePoint = (code) => {
+var isZeroWidthCodePoint = code => {
return (
code <= 0x1f || // C0 control codes
(code >= 0x7f && code <= 0x9f) || // C1 control codes
@@ -248,8 +245,7 @@ function promisify(original) {
}
if (argumentNames !== undefined && values.length > 1) {
var obj = {};
- for (var i = 0; i < argumentNames.length; i++)
- obj[argumentNames[i]] = values[i];
+ for (var i = 0; i < argumentNames.length; i++) obj[argumentNames[i]] = values[i];
resolve(obj);
} else {
resolve(values[0]);
@@ -330,21 +326,17 @@ var NodeRangeError = getNodeErrorByName("RangeError");
class ERR_INVALID_ARG_TYPE extends NodeTypeError {
constructor(name, type, value) {
- super(
- `The "${name}" argument must be of type ${type}. Received type ${typeof value}`,
- { code: "ERR_INVALID_ARG_TYPE" },
- );
+ super(`The "${name}" argument must be of type ${type}. Received type ${typeof value}`, {
+ code: "ERR_INVALID_ARG_TYPE",
+ });
}
}
class ERR_INVALID_ARG_VALUE extends NodeTypeError {
constructor(name, value, reason = "not specified") {
- super(
- `The value "${String(
- value,
- )}" is invalid for argument '${name}'. Reason: ${reason}`,
- { code: "ERR_INVALID_ARG_VALUE" },
- );
+ super(`The value "${String(value)}" is invalid for argument '${name}'. Reason: ${reason}`, {
+ code: "ERR_INVALID_ARG_VALUE",
+ });
}
}
@@ -358,10 +350,9 @@ class ERR_INVALID_CURSOR_POS extends NodeTypeError {
class ERR_OUT_OF_RANGE extends NodeRangeError {
constructor(name, range, received) {
- super(
- `The value of "${name}" is out of range. It must be ${range}. Received ${received}`,
- { code: "ERR_OUT_OF_RANGE" },
- );
+ super(`The value of "${name}" is out of range. It must be ${range}. Received ${received}`, {
+ code: "ERR_OUT_OF_RANGE",
+ });
}
}
@@ -390,8 +381,7 @@ class AbortError extends Error {
* @returns {asserts value is Function}
*/
function validateFunction(value, name) {
- if (typeof value !== "function")
- throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
+ if (typeof value !== "function") throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
}
/**
@@ -400,10 +390,7 @@ function validateFunction(value, name) {
* @param {string} name
*/
function validateAbortSignal(signal, name) {
- if (
- signal !== undefined &&
- (signal === null || typeof signal !== "object" || !("aborted" in signal))
- ) {
+ if (signal !== undefined && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
}
}
@@ -433,8 +420,7 @@ function validateArray(value, name, minLength = 0) {
* @returns {asserts value is string}
*/
function validateString(value, name) {
- if (typeof value !== "string")
- throw new ERR_INVALID_ARG_TYPE(name, "string", value);
+ if (typeof value !== "string") throw new ERR_INVALID_ARG_TYPE(name, "string", value);
}
/**
@@ -444,8 +430,7 @@ function validateString(value, name) {
* @returns {asserts value is boolean}
*/
function validateBoolean(value, name) {
- if (typeof value !== "boolean")
- throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
+ if (typeof value !== "boolean") throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
}
/**
@@ -466,8 +451,7 @@ function validateObject(value, name, options = null) {
if (
(!nullable && value === null) ||
(!allowArray && ArrayIsArray.call(value)) ||
- (typeof value !== "object" &&
- (!allowFunction || typeof value !== "function"))
+ (typeof value !== "object" && (!allowFunction || typeof value !== "function"))
) {
throw new ERR_INVALID_ARG_TYPE(name, "object", value);
}
@@ -481,18 +465,10 @@ function validateObject(value, name, options = null) {
* @param {number} [max]
* @returns {asserts value is number}
*/
-function validateInteger(
- value,
- name,
- min = NumberMIN_SAFE_INTEGER,
- max = NumberMAX_SAFE_INTEGER,
-) {
- if (typeof value !== "number")
- throw new ERR_INVALID_ARG_TYPE(name, "number", value);
- if (!NumberIsInteger(value))
- throw new ERR_OUT_OF_RANGE(name, "an integer", value);
- if (value < min || value > max)
- throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+function validateInteger(value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) {
+ if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
}
/**
@@ -543,9 +519,7 @@ CSI.kClearToLineEnd = kClearToLineEnd = CSI`0K`;
function charLengthLeft(str, i) {
if (i <= 0) return 0;
if (
- (i > 1 &&
- StringPrototypeCodePointAt.call(str, i - 2) >=
- kUTF16SurrogateThreshold) ||
+ (i > 1 && StringPrototypeCodePointAt.call(str, i - 2) >= kUTF16SurrogateThreshold) ||
StringPrototypeCodePointAt.call(str, i - 1) >= kUTF16SurrogateThreshold
) {
return 2;
@@ -559,9 +533,7 @@ function charLengthAt(str, i) {
// moving to the right.
return 1;
}
- return StringPrototypeCodePointAt.call(str, i) >= kUTF16SurrogateThreshold
- ? 2
- : 1;
+ return StringPrototypeCodePointAt.call(str, i) >= kUTF16SurrogateThreshold ? 2 : 1;
}
/*
@@ -702,14 +674,10 @@ function* emitKeys(stream) {
var cmd = StringPrototypeSlice.call(s, cmdStart);
var match;
- if (
- (match = RegExpPrototypeExec.call(/^(\d\d?)(;(\d))?([~^$])$/, cmd))
- ) {
+ if ((match = RegExpPrototypeExec.call(/^(\d\d?)(;(\d))?([~^$])$/, cmd))) {
code += match[1] + match[4];
modifier = (match[3] || 1) - 1;
- } else if (
- (match = RegExpPrototypeExec.call(/^((\d;)?(\d))?([A-Za-z])$/, cmd))
- ) {
+ } else if ((match = RegExpPrototypeExec.call(/^((\d;)?(\d))?([A-Za-z])$/, cmd))) {
code += match[4];
modifier = (match[3] || 1) - 1;
} else {
@@ -1019,11 +987,7 @@ function* emitKeys(stream) {
keyMeta = escaped;
} else if (!escaped && ch <= "\x1a") {
// ctrl+letter
- keyName = StringFromCharCode(
- StringPrototypeCharCodeAt.call(ch) +
- StringPrototypeCharCodeAt.call("a") -
- 1,
- );
+ keyName = StringFromCharCode(StringPrototypeCharCodeAt.call(ch) + StringPrototypeCharCodeAt.call("a") - 1);
keyCtrl = true;
} else if (RegExpPrototypeExec.call(/^[0-9A-Za-z]$/, ch) !== null) {
// Letter, number, shift+letter
@@ -1160,8 +1124,7 @@ function clearLine(stream, dir, callback) {
return true;
}
- var type =
- dir < 0 ? kClearToLineBeginning : dir > 0 ? kClearToLineEnd : kClearLine;
+ var type = dir < 0 ? kClearToLineBeginning : dir > 0 ? kClearToLineEnd : kClearLine;
return stream.write(type, callback);
}
@@ -1504,10 +1467,7 @@ function InterfaceConstructor(input, output, completer, terminal) {
if (NumberIsFinite(inputEscapeCodeTimeout)) {
this.escapeCodeTimeout = inputEscapeCodeTimeout;
} else {
- throw new ERR_INVALID_ARG_VALUE(
- "input.escapeCodeTimeout",
- this.escapeCodeTimeout,
- );
+ throw new ERR_INVALID_ARG_VALUE("input.escapeCodeTimeout", this.escapeCodeTimeout);
}
}
@@ -1533,11 +1493,7 @@ function InterfaceConstructor(input, output, completer, terminal) {
historySize = kHistorySize;
}
- if (
- typeof historySize !== "number" ||
- NumberIsNaN(historySize) ||
- historySize < 0
- ) {
+ if (typeof historySize !== "number" || NumberIsNaN(historySize) || historySize < 0) {
throw new ERR_INVALID_ARG_VALUE("historySize", historySize);
}
@@ -1565,9 +1521,7 @@ function InterfaceConstructor(input, output, completer, terminal) {
this[kKillRingCursor] = 0;
this.removeHistoryDuplicates = !!removeHistoryDuplicates;
- this.crlfDelay = crlfDelay
- ? MathMax(kMincrlfDelay, crlfDelay)
- : kMincrlfDelay;
+ this.crlfDelay = crlfDelay ? MathMax(kMincrlfDelay, crlfDelay) : kMincrlfDelay;
this.completer = completer;
this.setPrompt(prompt);
@@ -1597,8 +1551,7 @@ function InterfaceConstructor(input, output, completer, terminal) {
this.cursor = 0;
this.historyIndex = -1;
- if (output !== null && output !== undefined)
- output.on("resize", this[kOnResize]);
+ if (output !== null && output !== undefined) output.on("resize", this[kOnResize]);
this.once("close", this[kOnSelfCloseWithTerminal]);
}
@@ -1738,15 +1691,13 @@ var _Interface = class Interface extends InterfaceConstructor {
if (this.removeHistoryDuplicates) {
// Remove older history line if identical to new one
var dupIndex = ArrayPrototypeIndexOf.call(this.history, this.line);
- if (dupIndex !== -1)
- ArrayPrototypeSplice.call(this.history, dupIndex, 1);
+ if (dupIndex !== -1) ArrayPrototypeSplice.call(this.history, dupIndex, 1);
}
ArrayPrototypeUnshift.call(this.history, this.line);
// Only store so many
- if (this.history.length > this.historySize)
- ArrayPrototypePop.call(this.history);
+ if (this.history.length > this.historySize) ArrayPrototypePop.call(this.history);
}
this.historyIndex = -1;
@@ -1866,12 +1817,8 @@ var _Interface = class Interface extends InterfaceConstructor {
return;
}
var string = this[kDecoder].write(b);
- if (
- this[kSawReturnAt] &&
- DateNow() - this[kSawReturnAt] <= this.crlfDelay
- ) {
- if (StringPrototypeCodePointAt.call(string) === 10)
- string = StringPrototypeSlice.call(string, 1);
+ if (this[kSawReturnAt] && DateNow() - this[kSawReturnAt] <= this.crlfDelay) {
+ if (StringPrototypeCodePointAt.call(string) === 10) string = StringPrototypeSlice.call(string, 1);
this[kSawReturnAt] = 0;
}
@@ -1883,27 +1830,18 @@ var _Interface = class Interface extends InterfaceConstructor {
this[kLine_buffer] = null;
newPartContainsEnding = RegExpPrototypeExec.call(lineEnding, string);
}
- this[kSawReturnAt] = StringPrototypeEndsWith.call(string, "\r")
- ? DateNow()
- : 0;
+ this[kSawReturnAt] = StringPrototypeEndsWith.call(string, "\r") ? DateNow() : 0;
var indexes = [0, newPartContainsEnding.index, lineEnding.lastIndex];
var nextMatch;
- while (
- (nextMatch = RegExpPrototypeExec.call(lineEnding, string)) !== null
- ) {
+ while ((nextMatch = RegExpPrototypeExec.call(lineEnding, string)) !== null) {
ArrayPrototypePush.call(indexes, nextMatch.index, lineEnding.lastIndex);
}
var lastIndex = indexes.length - 1;
// Either '' or (conceivably) the unfinished portion of the next line
- this[kLine_buffer] = StringPrototypeSlice.call(
- string,
- indexes[lastIndex],
- );
+ this[kLine_buffer] = StringPrototypeSlice.call(string, indexes[lastIndex]);
for (var i = 1; i < lastIndex; i += 2) {
- this[kOnLine](
- StringPrototypeSlice.call(string, indexes[i - 1], indexes[i]),
- );
+ this[kOnLine](StringPrototypeSlice.call(string, indexes[i - 1], indexes[i]));
}
} else if (string) {
// No newlines this time, save what we have for next time
@@ -1919,11 +1857,7 @@ var _Interface = class Interface extends InterfaceConstructor {
this[kBeforeEdit](this.line, this.cursor);
if (this.cursor < this.line.length) {
var beg = StringPrototypeSlice.call(this.line, 0, this.cursor);
- var end = StringPrototypeSlice.call(
- this.line,
- this.cursor,
- this.line.length,
- );
+ var end = StringPrototypeSlice.call(this.line, this.cursor, this.line.length);
this.line = beg + c + end;
this.cursor += c.length;
this[kRefreshLine]();
@@ -1964,22 +1898,13 @@ var _Interface = class Interface extends InterfaceConstructor {
}
// If there is a common prefix to all matches, then apply that portion.
- var prefix = commonPrefix(
- ArrayPrototypeFilter.call(completions, (e) => e !== ""),
- );
- if (
- StringPrototypeStartsWith.call(prefix, completeOn) &&
- prefix.length > completeOn.length
- ) {
+ var prefix = commonPrefix(ArrayPrototypeFilter.call(completions, e => e !== ""));
+ if (StringPrototypeStartsWith.call(prefix, completeOn) && prefix.length > completeOn.length) {
this[kInsertString](StringPrototypeSlice.call(prefix, completeOn.length));
return;
} else if (!StringPrototypeStartsWith.call(completeOn, prefix)) {
this.line =
- StringPrototypeSlice.call(
- this.line,
- 0,
- this.cursor - completeOn.length,
- ) +
+ StringPrototypeSlice.call(this.line, 0, this.cursor - completeOn.length) +
prefix +
StringPrototypeSlice.call(this.line, this.cursor, this.line.length);
this.cursor = this.cursor - completeOn.length + prefix.length;
@@ -1994,9 +1919,7 @@ var _Interface = class Interface extends InterfaceConstructor {
this[kBeforeEdit](this.line, this.cursor);
// Apply/show completions.
- var completionsWidth = ArrayPrototypeMap.call(completions, (e) =>
- getStringWidth(e),
- );
+ var completionsWidth = ArrayPrototypeMap.call(completions, e => getStringWidth(e));
var width = MathMaxApply(completionsWidth) + 2; // 2 space padding
var maxColumns = MathFloor(this.columns / width) || 1;
if (maxColumns === Infinity) {
@@ -2034,10 +1957,7 @@ var _Interface = class Interface extends InterfaceConstructor {
// Reverse the string and match a word near beginning
// to avoid quadratic time complexity
var leading = StringPrototypeSlice.call(this.line, 0, this.cursor);
- var reversed = ArrayPrototypeJoin.call(
- ArrayPrototypeReverse.call(ArrayFrom(leading)),
- "",
- );
+ var reversed = ArrayPrototypeJoin.call(ArrayPrototypeReverse.call(ArrayFrom(leading)), "");
var match = RegExpPrototypeExec.call(/^\s*(?:[^\w\s]+|\w+)?/, reversed);
this[kMoveCursor](-match[0].length);
}
@@ -2046,10 +1966,7 @@ var _Interface = class Interface extends InterfaceConstructor {
[kWordRight]() {
if (this.cursor < this.line.length) {
var trailing = StringPrototypeSlice.call(this.line, this.cursor);
- var match = RegExpPrototypeExec.call(
- /^(?:\s+|[^\w\s]+|\w+)\s*/,
- trailing,
- );
+ var match = RegExpPrototypeExec.call(/^(?:\s+|[^\w\s]+|\w+)\s*/, trailing);
this[kMoveCursor](match[0].length);
}
}
@@ -2075,11 +1992,7 @@ var _Interface = class Interface extends InterfaceConstructor {
var charSize = charLengthAt(this.line, this.cursor);
this.line =
StringPrototypeSlice.call(this.line, 0, this.cursor) +
- StringPrototypeSlice.call(
- this.line,
- this.cursor + charSize,
- this.line.length,
- );
+ StringPrototypeSlice.call(this.line, this.cursor + charSize, this.line.length);
this[kRefreshLine]();
}
}
@@ -2090,19 +2003,10 @@ var _Interface = class Interface extends InterfaceConstructor {
// Reverse the string and match a word near beginning
// to avoid quadratic time complexity
var leading = StringPrototypeSlice.call(this.line, 0, this.cursor);
- var reversed = ArrayPrototypeJoin.call(
- ArrayPrototypeReverse.call(ArrayFrom(leading)),
- "",
- );
+ var reversed = ArrayPrototypeJoin.call(ArrayPrototypeReverse.call(ArrayFrom(leading)), "");
var match = RegExpPrototypeExec.call(/^\s*(?:[^\w\s]+|\w+)?/, reversed);
- leading = StringPrototypeSlice.call(
- leading,
- 0,
- leading.length - match[0].length,
- );
- this.line =
- leading +
- StringPrototypeSlice.call(this.line, this.cursor, this.line.length);
+ leading = StringPrototypeSlice.call(leading, 0, leading.length - match[0].length);
+ this.line = leading + StringPrototypeSlice.call(this.line, this.cursor, this.line.length);
this.cursor = leading.length;
this[kRefreshLine]();
}
@@ -2114,8 +2018,7 @@ var _Interface = class Interface extends InterfaceConstructor {
var trailing = StringPrototypeSlice.call(this.line, this.cursor);
var match = RegExpPrototypeExec.call(/^(?:\s+|\W+|\w+)\s*/, trailing);
this.line =
- StringPrototypeSlice.call(this.line, 0, this.cursor) +
- StringPrototypeSlice.call(trailing, match[0].length);
+ StringPrototypeSlice.call(this.line, 0, this.cursor) + StringPrototypeSlice.call(trailing, match[0].length);
this[kRefreshLine]();
}
}
@@ -2141,8 +2044,7 @@ var _Interface = class Interface extends InterfaceConstructor {
if (!del || del === this[kKillRing][0]) return;
ArrayPrototypeUnshift.call(this[kKillRing], del);
this[kKillRingCursor] = 0;
- while (this[kKillRing].length > kMaxLengthOfKillRing)
- ArrayPrototypePop.call(this[kKillRing]);
+ while (this[kKillRing].length > kMaxLengthOfKillRing) ArrayPrototypePop.call(this[kKillRing]);
}
[kYank]() {
@@ -2163,11 +2065,7 @@ var _Interface = class Interface extends InterfaceConstructor {
this[kKillRingCursor] = 0;
}
var currentYank = this[kKillRing][this[kKillRingCursor]];
- var head = StringPrototypeSlice.call(
- this.line,
- 0,
- this.cursor - lastYank.length,
- );
+ var head = StringPrototypeSlice.call(this.line, 0, this.cursor - lastYank.length);
var tail = StringPrototypeSlice.call(this.line, this.cursor);
this.line = head + currentYank + tail;
this.cursor = head.length + currentYank.length;
@@ -2192,10 +2090,7 @@ var _Interface = class Interface extends InterfaceConstructor {
}
[kPushToUndoStack](text, cursor) {
- if (
- ArrayPrototypePush.call(this[kUndoStack], { text, cursor }) >
- kMaxUndoRedoStackSize
- ) {
+ if (ArrayPrototypePush.call(this[kUndoStack], { text, cursor }) > kMaxUndoRedoStackSize) {
ArrayPrototypeShift.call(this[kUndoStack]);
}
}
@@ -2237,8 +2132,7 @@ var _Interface = class Interface extends InterfaceConstructor {
var index = this.historyIndex - 1;
while (
index >= 0 &&
- (!StringPrototypeStartsWith.call(this.history[index], search) ||
- this.line === this.history[index])
+ (!StringPrototypeStartsWith.call(this.history[index], search) || this.line === this.history[index])
) {
index--;
}
@@ -2260,8 +2154,7 @@ var _Interface = class Interface extends InterfaceConstructor {
var index = this.historyIndex + 1;
while (
index < this.history.length &&
- (!StringPrototypeStartsWith.call(this.history[index], search) ||
- this.line === this.history[index])
+ (!StringPrototypeStartsWith.call(this.history[index], search) || this.line === this.history[index])
) {
index++;
}
@@ -2319,8 +2212,7 @@ var _Interface = class Interface extends InterfaceConstructor {
* }}
*/
getCursorPos() {
- var strBeforeCursor =
- this[kPrompt] + StringPrototypeSlice.call(this.line, 0, this.cursor);
+ var strBeforeCursor = this[kPrompt] + StringPrototypeSlice.call(this.line, 0, this.cursor);
return this[kGetDisplayPos](strBeforeCursor);
}
@@ -2364,18 +2256,9 @@ var _Interface = class Interface extends InterfaceConstructor {
}
// Activate or deactivate substring search.
- if (
- (keyName === "up" || keyName === "down") &&
- !keyCtrl &&
- !keyMeta &&
- !keyShift
- ) {
+ if ((keyName === "up" || keyName === "down") && !keyCtrl && !keyMeta && !keyShift) {
if (this[kSubstringSearch] === null) {
- this[kSubstringSearch] = StringPrototypeSlice.call(
- this.line,
- 0,
- this.cursor,
- );
+ this[kSubstringSearch] = StringPrototypeSlice.call(this.line, 0, this.cursor);
}
} else if (this[kSubstringSearch] !== null) {
this[kSubstringSearch] = null;
@@ -2564,10 +2447,7 @@ var _Interface = class Interface extends InterfaceConstructor {
case "enter":
// When key interval > crlfDelay
- if (
- this[kSawReturnAt] === 0 ||
- DateNow() - this[kSawReturnAt] > this.crlfDelay
- ) {
+ if (this[kSawReturnAt] === 0 || DateNow() - this[kSawReturnAt] > this.crlfDelay) {
this[kLine]();
}
this[kSawReturnAt] = 0;
@@ -2608,10 +2488,7 @@ var _Interface = class Interface extends InterfaceConstructor {
case "tab":
// If tab completion enabled, do that...
- if (
- typeof this.completer === "function" &&
- this.isCompletionEnabled
- ) {
+ if (typeof this.completer === "function" && this.isCompletionEnabled) {
var lastKeypressWasTab = previousKey && previousKey.name === "tab";
this[kTabComplete](lastKeypressWasTab);
break;
@@ -2621,17 +2498,11 @@ var _Interface = class Interface extends InterfaceConstructor {
if (typeof s === "string" && s) {
var nextMatch = RegExpPrototypeExec.call(lineEnding, s);
if (nextMatch !== null) {
- this[kInsertString](
- StringPrototypeSlice.call(s, 0, nextMatch.index),
- );
+ this[kInsertString](StringPrototypeSlice.call(s, 0, nextMatch.index));
var { lastIndex } = lineEnding;
- while (
- (nextMatch = RegExpPrototypeExec.call(lineEnding, s)) !== null
- ) {
+ while ((nextMatch = RegExpPrototypeExec.call(lineEnding, s)) !== null) {
this[kLine]();
- this[kInsertString](
- StringPrototypeSlice.call(s, lastIndex, nextMatch.index),
- );
+ this[kInsertString](StringPrototypeSlice.call(s, lastIndex, nextMatch.index));
({ lastIndex } = lineEnding);
}
if (lastIndex === s.length) this[kLine]();
@@ -2669,11 +2540,7 @@ function Interface(input, output, completer, terminal) {
return new Interface(input, output, completer, terminal);
}
- if (
- input?.input &&
- typeof input.completer === "function" &&
- input.completer.length !== 2
- ) {
+ if (input?.input && typeof input.completer === "function" && input.completer.length !== 2) {
var { completer } = input;
input.completer = (v, cb) => cb(null, completer(v));
} else if (typeof completer === "function" && completer.length !== 2) {
@@ -2722,7 +2589,7 @@ Interface.prototype.question = function question(query, options, cb) {
var originalCb = cb;
cb =
typeof cb === "function"
- ? (answer) => {
+ ? answer => {
cleanup();
return originalCb(answer);
}
@@ -2734,10 +2601,7 @@ Interface.prototype.question = function question(query, options, cb) {
}
};
-Interface.prototype.question[promisify.custom] = function question(
- query,
- options,
-) {
+Interface.prototype.question[promisify.custom] = function question(query, options) {
if (options === null || typeof options !== "object") {
options = kEmptyObject;
}
@@ -2755,7 +2619,7 @@ Interface.prototype.question[promisify.custom] = function question(
reject(new AbortError(undefined, { cause: signal.reason }));
};
signal.addEventListener("abort", onAbort, { once: true });
- cb = (answer) => {
+ cb = answer => {
signal.removeEventListener("abort", onAbort);
resolve(answer);
};
@@ -3072,10 +2936,7 @@ function _ttyWriteDumb(s, key) {
case "enter":
// When key interval > crlfDelay
- if (
- this[kSawReturnAt] === 0 ||
- DateNow() - this[kSawReturnAt] > this.crlfDelay
- ) {
+ if (this[kSawReturnAt] === 0 || DateNow() - this[kSawReturnAt] > this.crlfDelay) {
this._line();
}
this[kSawReturnAt] = 0;
@@ -3097,8 +2958,7 @@ class Readline {
constructor(stream, options = undefined) {
isWritable ??= import.meta.require("node:stream").isWritable;
- if (!isWritable(stream))
- throw new ERR_INVALID_ARG_TYPE("stream", "Writable", stream);
+ if (!isWritable(stream)) throw new ERR_INVALID_ARG_TYPE("stream", "Writable", stream);
this.#stream = stream;
if (options?.autoCommit != null) {
validateBoolean(options.autoCommit, "options.autoCommit");
@@ -3164,8 +3024,7 @@ class Readline {
clearLine(dir) {
validateInteger(dir, "dir", -1, 1);
- var data =
- dir < 0 ? kClearToLineBeginning : dir > 0 ? kClearToLineEnd : kClearLine;
+ var data = dir < 0 ? kClearToLineBeginning : dir > 0 ? kClearToLineEnd : kClearLine;
if (this.#autoCommit) process.nextTick(() => this.#stream.write(data));
else ArrayPrototypePush.call(this.#todo, data);
return this;
@@ -3191,7 +3050,7 @@ class Readline {
* flushed to the associated `stream`.
*/
commit() {
- return new Promise((resolve) => {
+ return new Promise(resolve => {
this.#stream.write(ArrayPrototypeJoin.call(this.#todo, ""), resolve);
this.#todo = [];
});
@@ -3218,9 +3077,7 @@ var PromisesInterface = class Interface extends _Interface {
if (signal) {
validateAbortSignal(signal, "options.signal");
if (signal.aborted) {
- return PromiseReject(
- new AbortError(undefined, { cause: signal.reason }),
- );
+ return PromiseReject(new AbortError(undefined, { cause: signal.reason }));
}
}
return new Promise((resolve, reject) => {
@@ -3231,7 +3088,7 @@ var PromisesInterface = class Interface extends _Interface {
reject(new AbortError(undefined, { cause: signal.reason }));
};
signal.addEventListener("abort", onAbort, { once: true });
- cb = (answer) => {
+ cb = answer => {
signal.removeEventListener("abort", onAbort);
resolve(answer);
};
diff --git a/src/bun.js/streams.exports.js b/src/bun.js/streams.exports.js
index d5e8a2183..19e68ca58 100644
--- a/src/bun.js/streams.exports.js
+++ b/src/bun.js/streams.exports.js
@@ -16,11 +16,7 @@ globalThis.__IDS_TO_TRACK = process.env.DEBUG_TRACK_EE?.length
// By default, child_process gives
const __TRACK_EE__ = !!process.env.DEBUG_TRACK_EE;
-const __DEBUG__ = !!(
- process.env.DEBUG ||
- process.env.DEBUG_STREAMS ||
- __TRACK_EE__
-);
+const __DEBUG__ = !!(process.env.DEBUG || process.env.DEBUG_STREAMS || __TRACK_EE__);
var debug = __DEBUG__
? globalThis.__IDS_TO_TRACK
@@ -40,7 +36,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __ObjectSetPrototypeOf = Object.setPrototypeOf;
-var __require = (x) => import.meta.require(x);
+var __require = x => import.meta.require(x);
var _EE = __require("events");
@@ -85,11 +81,7 @@ DebugEventEmitter.prototype.addListener = function (event, handler) {
var __commonJS = (cb, mod) =>
function __require2() {
- return (
- mod ||
- (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
- mod.exports
- );
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if ((from && typeof from === "object") || typeof from === "function") {
@@ -97,7 +89,7 @@ var __copyProps = (to, from, except, desc) => {
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, {
get: () => from[key],
- set: (val) => (from[key] = val),
+ set: val => (from[key] = val),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
configurable: true,
});
@@ -108,16 +100,11 @@ var __copyProps = (to, from, except, desc) => {
var runOnNextTick = process.nextTick;
function isReadableStream(value) {
- return (
- typeof value === "object" &&
- value !== null &&
- value instanceof ReadableStream
- );
+ return typeof value === "object" && value !== null && value instanceof ReadableStream;
}
function validateBoolean(value, name) {
- if (typeof value !== "boolean")
- throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
+ if (typeof value !== "boolean") throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
}
/**
@@ -139,8 +126,7 @@ const validateObject = (value, name, options = null) => {
if (
(!nullable && value === null) ||
(!allowArray && ArrayIsArray(value)) ||
- (typeof value !== "object" &&
- (!allowFunction || typeof value !== "function"))
+ (typeof value !== "object" && (!allowFunction || typeof value !== "function"))
) {
throw new ERR_INVALID_ARG_TYPE(name, "Object", value);
}
@@ -155,8 +141,7 @@ const validateObject = (value, name, options = null) => {
/** @type {validateString} */
function validateString(value, name) {
- if (typeof value !== "string")
- throw new ERR_INVALID_ARG_TYPE(name, "string", value);
+ if (typeof value !== "string") throw new ERR_INVALID_ARG_TYPE(name, "string", value);
}
var ArrayIsArray = Array.isArray;
@@ -166,15 +151,11 @@ var ArrayIsArray = Array.isArray;
//------------------------------------------------------------------------------
function ERR_INVALID_ARG_TYPE(name, type, value) {
- return new Error(
- `The argument '${name}' is invalid. Received '${value}' for type '${type}'`,
- );
+ return new Error(`The argument '${name}' is invalid. Received '${value}' for type '${type}'`);
}
function ERR_INVALID_ARG_VALUE(name, value, reason) {
- return new Error(
- `The value '${value}' is invalid for argument '${name}'. Reason: ${reason}`,
- );
+ return new Error(`The value '${value}' is invalid for argument '${name}'. Reason: ${reason}`);
}
// node_modules/readable-stream/lib/ours/primordials.js
@@ -292,9 +273,7 @@ var require_util = __commonJS({
var AggregateError = class extends Error {
constructor(errors) {
if (!Array.isArray(errors)) {
- throw new TypeError(
- `Expected input to be an Array, got ${typeof errors}`,
- );
+ throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
}
let message = "";
for (let i = 0; i < errors.length; i++) {
@@ -352,10 +331,7 @@ var require_util = __commonJS({
} else if (type === "j") {
return JSON.stringify(replacement);
} else if (type === "s" && typeof replacement === "object") {
- const ctor =
- replacement.constructor !== Object
- ? replacement.constructor.name
- : "";
+ const ctor = replacement.constructor !== Object ? replacement.constructor.name : "";
return `${ctor} {}`.trim();
} else {
return replacement.toString();
@@ -399,9 +375,7 @@ var require_util = __commonJS({
},
isBlob,
};
- module.exports.promisify.custom = Symbol.for(
- "nodejs.util.promisify.custom",
- );
+ module.exports.promisify.custom = Symbol.for("nodejs.util.promisify.custom");
},
});
@@ -409,24 +383,10 @@ var require_util = __commonJS({
var require_errors = __commonJS({
"node_modules/readable-stream/lib/ours/errors.js"(exports, module) {
"use strict";
- var {
- format,
- inspect,
- AggregateError: CustomAggregateError,
- } = require_util();
+ var { format, inspect, AggregateError: CustomAggregateError } = require_util();
var AggregateError = globalThis.AggregateError || CustomAggregateError;
var kIsNodeError = Symbol("kIsNodeError");
- var kTypes = [
- "string",
- "function",
- "number",
- "object",
- "Function",
- "Object",
- "boolean",
- "bigint",
- "symbol",
- ];
+ var kTypes = ["string", "function", "number", "object", "Function", "Object", "boolean", "bigint", "symbol"];
var classRegExp = /^([A-Z][a-z0-9]*)+$/;
var nodeInternalPrefix = "__node_internal_";
var codes = {};
@@ -507,10 +467,7 @@ var require_errors = __commonJS({
outerError.errors.push(innerError);
return outerError;
}
- const err = new AggregateError(
- [outerError, innerError],
- outerError.message,
- );
+ const err = new AggregateError([outerError, innerError], outerError.message);
err.code = outerError.code;
return err;
}
@@ -545,19 +502,13 @@ var require_errors = __commonJS({
const instances = [];
const other = [];
for (const value of expected) {
- assert(
- typeof value === "string",
- "All expected entries have to be of type string",
- );
+ assert(typeof value === "string", "All expected entries have to be of type string");
if (kTypes.includes(value)) {
types.push(value.toLowerCase());
} else if (classRegExp.test(value)) {
instances.push(value);
} else {
- assert(
- value !== "object",
- 'The value "object" should be written as "Object"',
- );
+ assert(value !== "object", 'The value "object" should be written as "Object"');
other.push(value);
}
}
@@ -684,9 +635,7 @@ var require_errors = __commonJS({
assert(args.length > 0, "At least one arg needs to be specified");
let msg;
const len = args.length;
- args = (Array.isArray(args) ? args : [args])
- .map((a) => `"${a}"`)
- .join(" or ");
+ args = (Array.isArray(args) ? args : [args]).map(a => `"${a}"`).join(" or ");
switch (len) {
case 1:
msg += `The ${args[0]} argument`;
@@ -727,29 +676,13 @@ var require_errors = __commonJS({
);
E("ERR_MULTIPLE_CALLBACK", "Callback called multiple times", Error);
E("ERR_METHOD_NOT_IMPLEMENTED", "The %s method is not implemented", Error);
- E(
- "ERR_STREAM_ALREADY_FINISHED",
- "Cannot call %s after a stream was finished",
- Error,
- );
+ E("ERR_STREAM_ALREADY_FINISHED", "Cannot call %s after a stream was finished", Error);
E("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable", Error);
- E(
- "ERR_STREAM_DESTROYED",
- "Cannot call %s after a stream was destroyed",
- Error,
- );
- E(
- "ERR_STREAM_NULL_VALUES",
- "May not write null values to stream",
- TypeError,
- );
+ E("ERR_STREAM_DESTROYED", "Cannot call %s after a stream was destroyed", Error);
+ E("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError);
E("ERR_STREAM_PREMATURE_CLOSE", "Premature close", Error);
E("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF", Error);
- E(
- "ERR_STREAM_UNSHIFT_AFTER_END_EVENT",
- "stream.unshift() after end event",
- Error,
- );
+ E("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event", Error);
E("ERR_STREAM_WRITE_AFTER_END", "write after end", Error);
E("ERR_UNKNOWN_ENCODING", "Unknown encoding: %s", TypeError);
module.exports = {
@@ -781,13 +714,7 @@ var require_validators = __commonJS({
} = require_primordials();
var {
hideStackFrames,
- codes: {
- ERR_SOCKET_BAD_PORT,
- ERR_INVALID_ARG_TYPE,
- ERR_INVALID_ARG_VALUE,
- ERR_OUT_OF_RANGE,
- ERR_UNKNOWN_SIGNAL,
- },
+ codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL },
} = require_errors();
var { normalizeEncoding } = require_util();
var { isAsyncFunction, isArrayBufferView } = require_util().types;
@@ -813,37 +740,25 @@ var require_validators = __commonJS({
validateInt32(value, name, 0, 2 ** 32 - 1);
return value;
}
- var validateInteger = hideStackFrames(
- (
- value,
- name,
- min = NumberMIN_SAFE_INTEGER,
- max = NumberMAX_SAFE_INTEGER,
- ) => {
- if (typeof value !== "number")
- throw new ERR_INVALID_ARG_TYPE(name, "number", value);
- if (!NumberIsInteger(value))
+ var validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {
+ if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, "an integer", value);
+ if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+ });
+ var validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {
+ if (typeof value !== "number") {
+ throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ }
+ if (!isInt32(value)) {
+ if (!NumberIsInteger(value)) {
throw new ERR_OUT_OF_RANGE(name, "an integer", value);
- if (value < min || value > max)
- throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
- },
- );
- var validateInt32 = hideStackFrames(
- (value, name, min = -2147483648, max = 2147483647) => {
- if (typeof value !== "number") {
- throw new ERR_INVALID_ARG_TYPE(name, "number", value);
- }
- if (!isInt32(value)) {
- if (!NumberIsInteger(value)) {
- throw new ERR_OUT_OF_RANGE(name, "an integer", value);
- }
- throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
- }
- if (value < min || value > max) {
- throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
}
- },
- );
+ throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+ }
+ if (value < min || value > max) {
+ throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
+ }
+ });
var validateUint32 = hideStackFrames((value, name, positive) => {
if (typeof value !== "number") {
throw new ERR_INVALID_ARG_TYPE(name, "number", value);
@@ -860,19 +775,15 @@ var require_validators = __commonJS({
}
});
function validateString(value, name) {
- if (typeof value !== "string")
- throw new ERR_INVALID_ARG_TYPE(name, "string", value);
+ if (typeof value !== "string") throw new ERR_INVALID_ARG_TYPE(name, "string", value);
}
function validateNumber(value, name) {
- if (typeof value !== "number")
- throw new ERR_INVALID_ARG_TYPE(name, "number", value);
+ if (typeof value !== "number") throw new ERR_INVALID_ARG_TYPE(name, "number", value);
}
var validateOneOf = hideStackFrames((value, name, oneOf) => {
if (!ArrayPrototypeIncludes(oneOf, value)) {
const allowed = ArrayPrototypeJoin(
- ArrayPrototypeMap(oneOf, (v) =>
- typeof v === "string" ? `'${v}'` : String2(v),
- ),
+ ArrayPrototypeMap(oneOf, v => (typeof v === "string" ? `'${v}'` : String2(v))),
", ",
);
const reason = "must be one of: " + allowed;
@@ -880,8 +791,7 @@ var require_validators = __commonJS({
}
});
function validateBoolean(value, name) {
- if (typeof value !== "boolean")
- throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
+ if (typeof value !== "boolean") throw new ERR_INVALID_ARG_TYPE(name, "boolean", value);
}
var validateObject = hideStackFrames((value, name, options) => {
const useDefaultOptions = options == null;
@@ -891,8 +801,7 @@ var require_validators = __commonJS({
if (
(!nullable && value === null) ||
(!allowArray && ArrayIsArray(value)) ||
- (typeof value !== "object" &&
- (!allowFunction || typeof value !== "function"))
+ (typeof value !== "object" && (!allowFunction || typeof value !== "function"))
) {
throw new ERR_INVALID_ARG_TYPE(name, "Object", value);
}
@@ -910,31 +819,21 @@ var require_validators = __commonJS({
validateString(signal, name);
if (signals[signal] === void 0) {
if (signals[StringPrototypeToUpperCase(signal)] !== void 0) {
- throw new ERR_UNKNOWN_SIGNAL(
- signal + " (signals must use all capital letters)",
- );
+ throw new ERR_UNKNOWN_SIGNAL(signal + " (signals must use all capital letters)");
}
throw new ERR_UNKNOWN_SIGNAL(signal);
}
}
var validateBuffer = hideStackFrames((buffer, name = "buffer") => {
if (!isArrayBufferView(buffer)) {
- throw new ERR_INVALID_ARG_TYPE(
- name,
- ["Buffer", "TypedArray", "DataView"],
- buffer,
- );
+ throw new ERR_INVALID_ARG_TYPE(name, ["Buffer", "TypedArray", "DataView"], buffer);
}
});
function validateEncoding(data, encoding) {
const normalizedEncoding = normalizeEncoding(encoding);
const length = data.length;
if (normalizedEncoding === "hex" && length % 2 !== 0) {
- throw new ERR_INVALID_ARG_VALUE(
- "encoding",
- encoding,
- `is invalid for data of length ${length}`,
- );
+ throw new ERR_INVALID_ARG_VALUE("encoding", encoding, `is invalid for data of length ${length}`);
}
}
function validatePort(port, name = "Port", allowZero = true) {
@@ -950,26 +849,19 @@ var require_validators = __commonJS({
return port | 0;
}
var validateAbortSignal = hideStackFrames((signal, name) => {
- if (
- signal !== void 0 &&
- (signal === null ||
- typeof signal !== "object" ||
- !("aborted" in signal))
- ) {
+ if (signal !== void 0 && (signal === null || typeof signal !== "object" || !("aborted" in signal))) {
throw new ERR_INVALID_ARG_TYPE(name, "AbortSignal", signal);
}
});
var validateFunction = hideStackFrames((value, name) => {
- if (typeof value !== "function")
- throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
+ if (typeof value !== "function") throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
});
var validatePlainFunction = hideStackFrames((value, name) => {
if (typeof value !== "function" || isAsyncFunction(value))
throw new ERR_INVALID_ARG_TYPE(name, "Function", value);
});
var validateUndefined = hideStackFrames((value, name) => {
- if (value !== void 0)
- throw new ERR_INVALID_ARG_TYPE(name, "undefined", value);
+ if (value !== void 0) throw new ERR_INVALID_ARG_TYPE(name, "undefined", value);
});
module.exports = {
isInt32,
@@ -998,16 +890,9 @@ var require_validators = __commonJS({
// node_modules/readable-stream/lib/internal/streams/utils.js
var require_utils = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/utils.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/utils.js"(exports, module) {
"use strict";
- var {
- Symbol: Symbol2,
- SymbolAsyncIterator,
- SymbolIterator,
- } = require_primordials();
+ var { Symbol: Symbol2, SymbolAsyncIterator, SymbolIterator } = require_primordials();
var kDestroyed = Symbol2("kDestroyed");
var kIsErrored = Symbol2("kIsErrored");
var kIsReadable = Symbol2("kIsReadable");
@@ -1018,12 +903,9 @@ var require_utils = __commonJS({
obj &&
typeof obj.pipe === "function" &&
typeof obj.on === "function" &&
- (!strict ||
- (typeof obj.pause === "function" &&
- typeof obj.resume === "function")) &&
+ (!strict || (typeof obj.pause === "function" && typeof obj.resume === "function")) &&
(!obj._writableState ||
- ((_obj$_readableState = obj._readableState) === null ||
- _obj$_readableState === void 0
+ ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === void 0
? void 0
: _obj$_readableState.readable) !== false) &&
(!obj._writableState || obj._readableState)
@@ -1036,8 +918,7 @@ var require_utils = __commonJS({
typeof obj.write === "function" &&
typeof obj.on === "function" &&
(!obj._readableState ||
- ((_obj$_writableState = obj._writableState) === null ||
- _obj$_writableState === void 0
+ ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === void 0
? void 0
: _obj$_writableState.writable) !== false)
);
@@ -1062,36 +943,23 @@ var require_utils = __commonJS({
}
function isIterable(obj, isAsync) {
if (obj == null) return false;
- if (isAsync === true)
- return typeof obj[SymbolAsyncIterator] === "function";
+ if (isAsync === true) return typeof obj[SymbolAsyncIterator] === "function";
if (isAsync === false) return typeof obj[SymbolIterator] === "function";
- return (
- typeof obj[SymbolAsyncIterator] === "function" ||
- typeof obj[SymbolIterator] === "function"
- );
+ return typeof obj[SymbolAsyncIterator] === "function" || typeof obj[SymbolIterator] === "function";
}
function isDestroyed(stream) {
if (!isNodeStream(stream)) return null;
const wState = stream._writableState;
const rState = stream._readableState;
const state = wState || rState;
- return !!(
- stream.destroyed ||
- stream[kDestroyed] ||
- (state !== null && state !== void 0 && state.destroyed)
- );
+ return !!(stream.destroyed || stream[kDestroyed] || (state !== null && state !== void 0 && state.destroyed));
}
function isWritableEnded(stream) {
if (!isWritableNodeStream(stream)) return null;
if (stream.writableEnded === true) return true;
const wState = stream._writableState;
if (wState !== null && wState !== void 0 && wState.errored) return false;
- if (
- typeof (wState === null || wState === void 0
- ? void 0
- : wState.ended) !== "boolean"
- )
- return null;
+ if (typeof (wState === null || wState === void 0 ? void 0 : wState.ended) !== "boolean") return null;
return wState.ended;
}
function isWritableFinished(stream, strict) {
@@ -1099,73 +967,34 @@ var require_utils = __commonJS({
if (stream.writableFinished === true) return true;
const wState = stream._writableState;
if (wState !== null && wState !== void 0 && wState.errored) return false;
- if (
- typeof (wState === null || wState === void 0
- ? void 0
- : wState.finished) !== "boolean"
- )
- return null;
- return !!(
- wState.finished ||
- (strict === false && wState.ended === true && wState.length === 0)
- );
+ if (typeof (wState === null || wState === void 0 ? void 0 : wState.finished) !== "boolean") return null;
+ return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0));
}
function isReadableEnded(stream) {
if (!isReadableNodeStream(stream)) return null;
if (stream.readableEnded === true) return true;
const rState = stream._readableState;
if (!rState || rState.errored) return false;
- if (
- typeof (rState === null || rState === void 0
- ? void 0
- : rState.ended) !== "boolean"
- )
- return null;
+ if (typeof (rState === null || rState === void 0 ? void 0 : rState.ended) !== "boolean") return null;
return rState.ended;
}
function isReadableFinished(stream, strict) {
if (!isReadableNodeStream(stream)) return null;
const rState = stream._readableState;
if (rState !== null && rState !== void 0 && rState.errored) return false;
- if (
- typeof (rState === null || rState === void 0
- ? void 0
- : rState.endEmitted) !== "boolean"
- )
- return null;
- return !!(
- rState.endEmitted ||
- (strict === false && rState.ended === true && rState.length === 0)
- );
+ if (typeof (rState === null || rState === void 0 ? void 0 : rState.endEmitted) !== "boolean") return null;
+ return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0));
}
function isReadable(stream) {
if (stream && stream[kIsReadable] != null) return stream[kIsReadable];
- if (
- typeof (stream === null || stream === void 0
- ? void 0
- : stream.readable) !== "boolean"
- )
- return null;
+ if (typeof (stream === null || stream === void 0 ? void 0 : stream.readable) !== "boolean") return null;
if (isDestroyed(stream)) return false;
- return (
- isReadableNodeStream(stream) &&
- stream.readable &&
- !isReadableFinished(stream)
- );
+ return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream);
}
function isWritable(stream) {
- if (
- typeof (stream === null || stream === void 0
- ? void 0
- : stream.writable) !== "boolean"
- )
- return null;
+ if (typeof (stream === null || stream === void 0 ? void 0 : stream.writable) !== "boolean") return null;
if (isDestroyed(stream)) return false;
- return (
- isWritableNodeStream(stream) &&
- stream.writable &&
- !isWritableEnded(stream)
- );
+ return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream);
}
function isFinished(stream, opts) {
if (!isNodeStream(stream)) {
@@ -1174,16 +1003,10 @@ var require_utils = __commonJS({
if (isDestroyed(stream)) {
return true;
}
- if (
- (opts === null || opts === void 0 ? void 0 : opts.readable) !== false &&
- isReadable(stream)
- ) {
+ if ((opts === null || opts === void 0 ? void 0 : opts.readable) !== false && isReadable(stream)) {
return false;
}
- if (
- (opts === null || opts === void 0 ? void 0 : opts.writable) !== false &&
- isWritable(stream)
- ) {
+ if ((opts === null || opts === void 0 ? void 0 : opts.writable) !== false && isWritable(stream)) {
return false;
}
return true;
@@ -1197,11 +1020,9 @@ var require_utils = __commonJS({
return stream.writableErrored;
}
return (_stream$_writableStat =
- (_stream$_writableStat2 = stream._writableState) === null ||
- _stream$_writableStat2 === void 0
+ (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === void 0
? void 0
- : _stream$_writableStat2.errored) !== null &&
- _stream$_writableStat !== void 0
+ : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== void 0
? _stream$_writableStat
: null;
}
@@ -1214,11 +1035,9 @@ var require_utils = __commonJS({
return stream.readableErrored;
}
return (_stream$_readableStat =
- (_stream$_readableStat2 = stream._readableState) === null ||
- _stream$_readableStat2 === void 0
+ (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === void 0
? void 0
- : _stream$_readableStat2.errored) !== null &&
- _stream$_readableStat !== void 0
+ : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== void 0
? _stream$_readableStat
: null;
}
@@ -1232,12 +1051,8 @@ var require_utils = __commonJS({
const wState = stream._writableState;
const rState = stream._readableState;
if (
- typeof (wState === null || wState === void 0
- ? void 0
- : wState.closed) === "boolean" ||
- typeof (rState === null || rState === void 0
- ? void 0
- : rState.closed) === "boolean"
+ typeof (wState === null || wState === void 0 ? void 0 : wState.closed) === "boolean" ||
+ typeof (rState === null || rState === void 0 ? void 0 : rState.closed) === "boolean"
) {
return (
(wState === null || wState === void 0 ? void 0 : wState.closed) ||
@@ -1265,9 +1080,8 @@ var require_utils = __commonJS({
return (
typeof stream._consuming === "boolean" &&
typeof stream._dumped === "boolean" &&
- ((_stream$req = stream.req) === null || _stream$req === void 0
- ? void 0
- : _stream$req.upgradeOrConnect) === void 0
+ ((_stream$req = stream.req) === null || _stream$req === void 0 ? void 0 : _stream$req.upgradeOrConnect) ===
+ void 0
);
}
function willEmitClose(stream) {
@@ -1277,20 +1091,14 @@ var require_utils = __commonJS({
const state = wState || rState;
return (
(!state && isServerResponse(stream)) ||
- !!(
- state &&
- state.autoDestroy &&
- state.emitClose &&
- state.closed === false
- )
+ !!(state && state.autoDestroy && state.emitClose && state.closed === false)
);
}
function isDisturbed(stream) {
var _stream$kIsDisturbed;
return !!(
stream &&
- ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null &&
- _stream$kIsDisturbed !== void 0
+ ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== void 0
? _stream$kIsDisturbed
: stream.readableDidRead || stream.readableAborted)
);
@@ -1313,32 +1121,25 @@ var require_utils = __commonJS({
(_ref3 =
(_ref4 =
(_ref5 =
- (_stream$kIsErrored = stream[kIsErrored]) !== null &&
- _stream$kIsErrored !== void 0
+ (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== void 0
? _stream$kIsErrored
: stream.readableErrored) !== null && _ref5 !== void 0
? _ref5
: stream.writableErrored) !== null && _ref4 !== void 0
? _ref4
- : (_stream$_readableStat3 = stream._readableState) === null ||
- _stream$_readableStat3 === void 0
+ : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === void 0
? void 0
- : _stream$_readableStat3.errorEmitted) !== null &&
- _ref3 !== void 0
+ : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== void 0
? _ref3
- : (_stream$_writableStat3 = stream._writableState) === null ||
- _stream$_writableStat3 === void 0
+ : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === void 0
? void 0
- : _stream$_writableStat3.errorEmitted) !== null &&
- _ref2 !== void 0
+ : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== void 0
? _ref2
- : (_stream$_readableStat4 = stream._readableState) === null ||
- _stream$_readableStat4 === void 0
+ : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === void 0
? void 0
: _stream$_readableStat4.errored) !== null && _ref !== void 0
? _ref
- : (_stream$_writableStat4 = stream._writableState) === null ||
- _stream$_writableStat4 === void 0
+ : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === void 0
? void 0
: _stream$_writableStat4.errored)
);
@@ -1375,16 +1176,12 @@ var require_utils = __commonJS({
// node_modules/readable-stream/lib/internal/streams/end-of-stream.js
var require_end_of_stream = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/end-of-stream.js"(exports, module) {
"use strict";
var { AbortError, codes } = require_errors();
var { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes;
var { once } = require_util();
- var { validateAbortSignal, validateFunction, validateObject } =
- require_validators();
+ var { validateAbortSignal, validateFunction, validateObject } = require_validators();
var { Promise: Promise2 } = require_primordials();
var {
isClosed,
@@ -1417,13 +1214,11 @@ var require_end_of_stream = __commonJS({
validateAbortSignal(options.signal, "options.signal");
callback = once(callback);
const readable =
- (_options$readable = options.readable) !== null &&
- _options$readable !== void 0
+ (_options$readable = options.readable) !== null && _options$readable !== void 0
? _options$readable
: isReadableNodeStream(stream);
const writable =
- (_options$writable = options.writable) !== null &&
- _options$writable !== void 0
+ (_options$writable = options.writable) !== null && _options$writable !== void 0
? _options$writable
: isWritableNodeStream(stream);
if (!isNodeStream(stream)) {
@@ -1466,7 +1261,7 @@ var require_end_of_stream = __commonJS({
callback.call(stream);
}
};
- const onerror = (err) => {
+ const onerror = err => {
callback.call(stream, err);
};
let closed = isClosed(stream);
@@ -1476,17 +1271,11 @@ var require_end_of_stream = __commonJS({
if (errored && typeof errored !== "boolean") {
return callback.call(stream, errored);
}
- if (
- readable &&
- !readableFinished &&
- isReadableNodeStream(stream, true)
- ) {
- if (!isReadableFinished(stream, false))
- return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE());
+ if (readable && !readableFinished && isReadableNodeStream(stream, true)) {
+ if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE());
}
if (writable && !writableFinished) {
- if (!isWritableFinished(stream, false))
- return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE());
+ if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE());
}
callback.call(stream);
};
@@ -1580,7 +1369,7 @@ var require_end_of_stream = __commonJS({
}
function finished(stream, opts) {
return new Promise2((resolve, reject) => {
- eos(stream, opts, (err) => {
+ eos(stream, opts, err => {
if (err) {
reject(err);
} else {
@@ -1596,20 +1385,14 @@ var require_end_of_stream = __commonJS({
// node_modules/readable-stream/lib/internal/streams/operators.js
var require_operators = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/operators.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/operators.js"(exports, module) {
"use strict";
- var AbortController =
- globalThis.AbortController ||
- __require("abort-controller").AbortController;
+ var AbortController = globalThis.AbortController || __require("abort-controller").AbortController;
var {
codes: { ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },
AbortError,
} = require_errors();
- var { validateAbortSignal, validateInteger, validateObject } =
- require_validators();
+ var { validateAbortSignal, validateInteger, validateObject } = require_validators();
var kWeakHandler = require_primordials().Symbol("kWeak");
var { finished } = require_end_of_stream();
var {
@@ -1631,18 +1414,11 @@ var require_operators = __commonJS({
if (options != null) {
validateObject(options, "options");
}
- if (
- (options === null || options === void 0 ? void 0 : options.signal) !=
- null
- ) {
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
validateAbortSignal(options.signal, "options.signal");
}
let concurrency = 1;
- if (
- (options === null || options === void 0
- ? void 0
- : options.concurrency) != null
- ) {
+ if ((options === null || options === void 0 ? void 0 : options.concurrency) != null) {
concurrency = MathFloor(options.concurrency);
}
validateInteger(concurrency, "concurrency", 1);
@@ -1667,8 +1443,7 @@ var require_operators = __commonJS({
}
options === null || options === void 0
? void 0
- : (_options$signal2 = options.signal) === null ||
- _options$signal2 === void 0
+ : (_options$signal2 = options.signal) === null || _options$signal2 === void 0
? void 0
: _options$signal2.addEventListener("abort", abort);
let next;
@@ -1695,11 +1470,7 @@ var require_operators = __commonJS({
if (val === kEmpty) {
continue;
}
- if (
- typeof ((_val = val) === null || _val === void 0
- ? void 0
- : _val.catch) === "function"
- ) {
+ if (typeof ((_val = val) === null || _val === void 0 ? void 0 : _val.catch) === "function") {
val.catch(onDone);
}
queue.push(val);
@@ -1708,7 +1479,7 @@ var require_operators = __commonJS({
next = null;
}
if (!done && queue.length && queue.length >= concurrency) {
- await new Promise2((resolve) => {
+ await new Promise2(resolve => {
resume = resolve;
});
}
@@ -1727,8 +1498,7 @@ var require_operators = __commonJS({
}
options === null || options === void 0
? void 0
- : (_options$signal3 = options.signal) === null ||
- _options$signal3 === void 0
+ : (_options$signal3 = options.signal) === null || _options$signal3 === void 0
? void 0
: _options$signal3.removeEventListener("abort", abort);
}
@@ -1753,7 +1523,7 @@ var require_operators = __commonJS({
resume = null;
}
}
- await new Promise2((resolve) => {
+ await new Promise2(resolve => {
next = resolve;
});
}
@@ -1771,10 +1541,7 @@ var require_operators = __commonJS({
if (options != null) {
validateObject(options, "options");
}
- if (
- (options === null || options === void 0 ? void 0 : options.signal) !=
- null
- ) {
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
validateAbortSignal(options.signal, "options.signal");
}
return async function* asIndexedPairs2() {
@@ -1851,19 +1618,12 @@ var require_operators = __commonJS({
async function reduce(reducer, initialValue, options) {
var _options$signal5;
if (typeof reducer !== "function") {
- throw new ERR_INVALID_ARG_TYPE(
- "reducer",
- ["Function", "AsyncFunction"],
- reducer,
- );
+ throw new ERR_INVALID_ARG_TYPE("reducer", ["Function", "AsyncFunction"], reducer);
}
if (options != null) {
validateObject(options, "options");
}
- if (
- (options === null || options === void 0 ? void 0 : options.signal) !=
- null
- ) {
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
validateAbortSignal(options.signal, "options.signal");
}
let hasInitialValue = arguments.length > 1;
@@ -1925,10 +1685,7 @@ var require_operators = __commonJS({
if (options != null) {
validateObject(options, "options");
}
- if (
- (options === null || options === void 0 ? void 0 : options.signal) !=
- null
- ) {
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
validateAbortSignal(options.signal, "options.signal");
}
const result = [];
@@ -1971,10 +1728,7 @@ var require_operators = __commonJS({
if (options != null) {
validateObject(options, "options");
}
- if (
- (options === null || options === void 0 ? void 0 : options.signal) !=
- null
- ) {
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
validateAbortSignal(options.signal, "options.signal");
}
number = toIntegerOrInfinity(number);
@@ -2010,10 +1764,7 @@ var require_operators = __commonJS({
if (options != null) {
validateObject(options, "options");
}
- if (
- (options === null || options === void 0 ? void 0 : options.signal) !=
- null
- ) {
+ if ((options === null || options === void 0 ? void 0 : options.signal) != null) {
validateAbortSignal(options.signal, "options.signal");
}
number = toIntegerOrInfinity(number);
@@ -2068,10 +1819,7 @@ var require_operators = __commonJS({
// node_modules/readable-stream/lib/internal/streams/destroy.js
var require_destroy = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/destroy.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports, module) {
"use strict";
var {
aggregateTwoErrors,
@@ -2079,8 +1827,7 @@ var require_destroy = __commonJS({
AbortError,
} = require_errors();
var { Symbol: Symbol2 } = require_primordials();
- var { kDestroyed, isDestroyed, isFinished, isServerRequest } =
- require_utils();
+ var { kDestroyed, isDestroyed, isFinished, isServerRequest } = require_utils();
var kDestroy = "#kDestroy";
var kConstruct = "#kConstruct";
function checkError(err, w, r) {
@@ -2112,7 +1859,7 @@ var require_destroy = __commonJS({
r.destroyed = true;
}
if (!s.constructed) {
- this.once(kDestroy, (er) => {
+ this.once(kDestroy, er => {
_destroy(this, aggregateTwoErrors(er, err), cb);
});
} else {
@@ -2254,10 +2001,7 @@ var require_destroy = __commonJS({
let called = false;
function onConstruct(err) {
if (called) {
- errorOrDestroy(
- stream,
- err !== null && err !== void 0 ? err : new ERR_MULTIPLE_CALLBACK(),
- );
+ errorOrDestroy(stream, err !== null && err !== void 0 ? err : new ERR_MULTIPLE_CALLBACK());
return;
}
called = true;
@@ -2336,10 +2080,7 @@ var require_destroy = __commonJS({
// node_modules/readable-stream/lib/internal/streams/legacy.js
var require_legacy = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/legacy.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/legacy.js"(exports, module) {
"use strict";
var { ArrayIsArray, ObjectSetPrototypeOf } = require_primordials();
var { EventEmitter: _EE } = __require("events");
@@ -2412,11 +2153,9 @@ var require_legacy = __commonJS({
return dest;
};
function prependListener(emitter, event, fn) {
- if (typeof emitter.prependListener === "function")
- return emitter.prependListener(event, fn);
+ if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
- else if (ArrayIsArray(emitter._events[event]))
- emitter._events[event].unshift(fn);
+ else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn);
else emitter._events[event] = [fn, emitter._events[event]];
}
module.exports = {
@@ -2428,10 +2167,7 @@ var require_legacy = __commonJS({
// node_modules/readable-stream/lib/internal/streams/add-abort-signal.js
var require_add_abort_signal = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/add-abort-signal.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/add-abort-signal.js"(exports, module) {
"use strict";
var { AbortError, codes } = require_errors();
var eos = require_end_of_stream();
@@ -2475,19 +2211,12 @@ var require_add_abort_signal = __commonJS({
// node_modules/readable-stream/lib/internal/streams/state.js
var require_state = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/state.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/state.js"(exports, module) {
"use strict";
var { MathFloor, NumberIsInteger } = require_primordials();
var { ERR_INVALID_ARG_VALUE } = require_errors().codes;
function highWaterMarkFrom(options, isDuplex, duplexKey) {
- return options.highWaterMark != null
- ? options.highWaterMark
- : isDuplex
- ? options[duplexKey]
- : null;
+ return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
}
function getDefaultHighWaterMark(objectMode) {
return objectMode ? 16 : 16 * 1024;
@@ -2496,9 +2225,7 @@ var require_state = __commonJS({
const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
if (hwm != null) {
if (!NumberIsInteger(hwm) || hwm < 0) {
- const name = isDuplex
- ? `options.${duplexKey}`
- : "options.highWaterMark";
+ const name = isDuplex ? `options.${duplexKey}` : "options.highWaterMark";
throw new ERR_INVALID_ARG_VALUE(name, hwm);
}
return MathFloor(hwm);
@@ -2516,10 +2243,8 @@ var require_state = __commonJS({
var require_from = __commonJS({
"node_modules/readable-stream/lib/internal/streams/from.js"(exports, module) {
"use strict";
- var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } =
- require_primordials();
- var { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } =
- require_errors().codes;
+ var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
+ var { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require_errors().codes;
function from(Readable, iterable, opts) {
let iterator;
if (typeof iterable === "string" || iterable instanceof Buffer) {
@@ -2558,7 +2283,7 @@ var require_from = __commonJS({
PromisePrototypeThen(
close(error),
() => runOnNextTick(cb, error),
- (e) => runOnNextTick(cb, e || error),
+ e => runOnNextTick(cb, e || error),
);
};
async function close(error) {
@@ -2579,14 +2304,11 @@ var require_from = __commonJS({
async function next() {
for (;;) {
try {
- const { value, done } = isAsync
- ? await iterator.next()
- : iterator.next();
+ const { value, done } = isAsync ? await iterator.next() : iterator.next();
if (done) {
readable.push(null);
} else {
- const res =
- value && typeof value.then === "function" ? await value : value;
+ const res = value && typeof value.then === "function" ? await value : value;
if (res === null) {
reading = false;
throw new ERR_STREAM_NULL_VALUES();
@@ -2610,10 +2332,7 @@ var require_from = __commonJS({
// node_modules/readable-stream/lib/internal/streams/readable.js
var require_readable = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/readable.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/readable.js"(exports, module) {
"use strict";
var {
ArrayPrototypeIndexOf,
@@ -2629,8 +2348,7 @@ var require_readable = __commonJS({
Symbol: Symbol2,
} = require_primordials();
- var ReadableState =
- globalThis[Symbol.for("Bun.lazy")]("bun:stream").ReadableState;
+ var ReadableState = globalThis[Symbol.for("Bun.lazy")]("bun:stream").ReadableState;
var { EventEmitter: EE } = __require("events");
var { Stream, prependListener } = require_legacy();
@@ -2828,11 +2546,7 @@ var require_readable = __commonJS({
*/
function newStreamReadableFromReadableStream(readableStream, options = {}) {
if (!isReadableStream(readableStream)) {
- throw new ERR_INVALID_ARG_TYPE(
- "readableStream",
- "ReadableStream",
- readableStream,
- );
+ throw new ERR_INVALID_ARG_TYPE("readableStream", "ReadableStream", readableStream);
}
validateObject(options, "options");
@@ -2862,11 +2576,7 @@ var require_readable = __commonJS({
// );
// }
- const nativeStream = getNativeReadableStream(
- Readable,
- readableStream,
- options,
- );
+ const nativeStream = getNativeReadableStream(Readable, readableStream, options);
return (
nativeStream ||
@@ -2954,11 +2664,7 @@ var require_readable = __commonJS({
}
encoding = "";
} else if (chunk != null) {
- err = new ERR_INVALID_ARG_TYPE(
- "chunk",
- ["string", "Buffer", "Uint8Array"],
- chunk,
- );
+ err = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
}
}
if (err) {
@@ -2968,8 +2674,7 @@ var require_readable = __commonJS({
onEofChunk(stream, state);
} else if (state.objectMode || (chunk && chunk.length > 0)) {
if (addToFront) {
- if (state.endEmitted)
- errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
+ if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());
else if (state.destroyed || state.errored) return false;
else addChunk(stream, state, chunk, true);
} else if (state.ended) {
@@ -2980,8 +2685,7 @@ var require_readable = __commonJS({
state.reading = false;
if (state.decoder && !encoding) {
chunk = state.decoder.write(chunk);
- if (state.objectMode || chunk.length !== 0)
- addChunk(stream, state, chunk, false);
+ if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);
else maybeReadMore(stream, state);
} else {
addChunk(stream, state, chunk, false);
@@ -2991,20 +2695,12 @@ var require_readable = __commonJS({
state.reading = false;
maybeReadMore(stream, state);
}
- return (
- !state.ended &&
- (state.length < state.highWaterMark || state.length === 0)
- );
+ return !state.ended && (state.length < state.highWaterMark || state.length === 0);
}
function addChunk(stream, state, chunk, addToFront) {
__DEBUG__ && debug("adding chunk", stream.__id);
__DEBUG__ && debug("chunk", chunk.toString(), stream.__id);
- if (
- state.flowing &&
- state.length === 0 &&
- !state.sync &&
- stream.listenerCount("data") > 0
- ) {
+ if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount("data") > 0) {
if (state.multiAwaitDrain) {
state.awaitDrainWriters.clear();
} else {
@@ -3016,8 +2712,7 @@ var require_readable = __commonJS({
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront) state.buffer.unshift(chunk);
else state.buffer.push(chunk);
- __DEBUG__ &&
- debug("needReadable @ addChunk", state.needReadable, stream.__id);
+ __DEBUG__ && debug("needReadable @ addChunk", state.needReadable, stream.__id);
if (state.needReadable) emitReadable(stream, state);
}
maybeReadMore(stream, state);
@@ -3079,8 +2774,7 @@ var require_readable = __commonJS({
const nOrig = n;
// If we're asking for more than the current hwm, then raise the hwm.
- if (n > state.highWaterMark)
- state.highWaterMark = computeNewHighWaterMark(n);
+ if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
if (n !== 0) state.emittedReadable = false;
@@ -3090,18 +2784,9 @@ var require_readable = __commonJS({
if (
n === 0 &&
state.needReadable &&
- ((state.highWaterMark !== 0
- ? state.length >= state.highWaterMark
- : state.length > 0) ||
- state.ended)
+ ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)
) {
- __DEBUG__ &&
- debug(
- "read: emitReadable or endReadable",
- state.length,
- state.ended,
- this.__id,
- );
+ __DEBUG__ && debug("read: emitReadable or endReadable", state.length, state.ended, this.__id);
if (state.length === 0 && state.ended) endReadable(this);
else emitReadable(this, state);
return null;
@@ -3112,12 +2797,7 @@ var require_readable = __commonJS({
// If we've ended, and we're now clear, then finish it up.
if (n === 0 && state.ended) {
__DEBUG__ &&
- debug(
- "read: calling endReadable if length 0 -- length, state.ended",
- state.length,
- state.ended,
- this.__id,
- );
+ debug("read: calling endReadable if length 0 -- length, state.ended", state.length, state.ended, this.__id);
if (state.length === 0) endReadable(this);
return null;
}
@@ -3157,13 +2837,7 @@ var require_readable = __commonJS({
// However, if we've ended, then there's no point, if we're already
// reading, then it's unnecessary, if we're constructing we have to wait,
// and if we're destroyed or errored, then it's not allowed,
- if (
- state.ended ||
- state.reading ||
- state.destroyed ||
- state.errored ||
- !state.constructed
- ) {
+ if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) {
__DEBUG__ && debug("state.constructed?", state.constructed, this.__id);
doRead = false;
__DEBUG__ && debug("reading, ended or constructing", doRead, this.__id);
@@ -3211,8 +2885,7 @@ var require_readable = __commonJS({
if (ret === null) {
state.needReadable = state.length <= state.highWaterMark;
- __DEBUG__ &&
- debug("state.length while ret = null", state.length, this.__id);
+ __DEBUG__ && debug("state.length while ret = null", state.length, this.__id);
n = 0;
} else {
state.length -= n;
@@ -3248,18 +2921,12 @@ var require_readable = __commonJS({
if (state.pipes.length === 1) {
if (!state.multiAwaitDrain) {
state.multiAwaitDrain = true;
- state.awaitDrainWriters = new SafeSet(
- state.awaitDrainWriters ? [state.awaitDrainWriters] : [],
- );
+ state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : []);
}
}
state.pipes.push(dest);
- __DEBUG__ &&
- debug("pipe count=%d opts=%j", state.pipes.length, pipeOpts, src.__id);
- const doEnd =
- (!pipeOpts || pipeOpts.end !== false) &&
- dest !== process.stdout &&
- dest !== process.stderr;
+ __DEBUG__ && debug("pipe count=%d opts=%j", state.pipes.length, pipeOpts, src.__id);
+ const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
const endFn = doEnd ? onend : unpipe;
if (state.endEmitted) runOnNextTick(endFn);
else src.once("end", endFn);
@@ -3292,12 +2959,7 @@ var require_readable = __commonJS({
src.removeListener("end", unpipe);
src.removeListener("data", ondata);
cleanedUp = true;
- if (
- ondrain &&
- state.awaitDrainWriters &&
- (!dest._writableState || dest._writableState.needDrain)
- )
- ondrain();
+ if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
function pause() {
if (!cleanedUp) {
@@ -3306,12 +2968,7 @@ var require_readable = __commonJS({
state.awaitDrainWriters = dest;
state.multiAwaitDrain = false;
} else if (state.pipes.length > 1 && state.pipes.includes(dest)) {
- __DEBUG__ &&
- debug(
- "false write response, pause",
- state.awaitDrainWriters.size,
- src.__id,
- );
+ __DEBUG__ && debug("false write response, pause", state.awaitDrainWriters.size, src.__id);
state.awaitDrainWriters.add(dest);
}
src.pause();
@@ -3380,10 +3037,7 @@ var require_readable = __commonJS({
debug("pipeOnDrain", state.awaitDrainWriters.size);
state.awaitDrainWriters.delete(dest);
}
- if (
- (!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) &&
- src.listenerCount("data")
- ) {
+ if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount("data")) {
src.resume();
}
};
@@ -3453,8 +3107,7 @@ var require_readable = __commonJS({
return this;
};
Readable.prototype.pause = function () {
- __DEBUG__ &&
- debug("call pause flowing=%j", this._readableState.flowing, this.__id);
+ __DEBUG__ && debug("call pause flowing=%j", this._readableState.flowing, this.__id);
if (this._readableState.flowing !== false) {
__DEBUG__ && debug("pause", this.__id);
this._readableState.flowing = false;
@@ -3465,7 +3118,7 @@ var require_readable = __commonJS({
};
Readable.prototype.wrap = function (stream) {
let paused = false;
- stream.on("data", (chunk) => {
+ stream.on("data", chunk => {
if (!this.push(chunk) && stream.pause) {
paused = true;
stream.pause();
@@ -3474,7 +3127,7 @@ var require_readable = __commonJS({
stream.on("end", () => {
this.push(null);
});
- stream.on("error", (err) => {
+ stream.on("error", err => {
errorOrDestroy(this, err);
});
stream.on("close", () => {
@@ -3534,7 +3187,7 @@ var require_readable = __commonJS({
{
writable: false,
},
- (err) => {
+ err => {
error = err ? aggregateTwoErrors(error, err) : null;
callback();
callback = nop;
@@ -3558,10 +3211,7 @@ var require_readable = __commonJS({
throw error;
} finally {
if (
- (error ||
- (options === null || options === void 0
- ? void 0
- : options.destroyOnReturn) !== false) &&
+ (error || (options === null || options === void 0 ? void 0 : options.destroyOnReturn) !== false) &&
(error === void 0 || stream._readableState.autoDestroy)
) {
destroyImpl.destroyer(stream, null);
@@ -3575,13 +3225,7 @@ var require_readable = __commonJS({
readable: {
get() {
const r = this._readableState;
- return (
- !!r &&
- r.readable !== false &&
- !r.destroyed &&
- !r.errorEmitted &&
- !r.endEmitted
- );
+ return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted;
},
set(val) {
if (this._readableState) {
@@ -3693,27 +3337,15 @@ var require_readable = __commonJS({
}
function endReadable(stream) {
const state = stream._readableState;
- __DEBUG__ &&
- debug("endEmitted @ endReadable", state.endEmitted, stream.__id);
+ __DEBUG__ && debug("endEmitted @ endReadable", state.endEmitted, stream.__id);
if (!state.endEmitted) {
state.ended = true;
runOnNextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
- __DEBUG__ &&
- debug(
- "endReadableNT -- endEmitted, state.length",
- state.endEmitted,
- state.length,
- stream.__id,
- );
- if (
- !state.errored &&
- !state.closeEmitted &&
- !state.endEmitted &&
- state.length === 0
- ) {
+ __DEBUG__ && debug("endReadableNT -- endEmitted, state.length", state.endEmitted, state.length, stream.__id);
+ if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.emit("end");
__DEBUG__ && debug("end emitted @ endReadableNT", stream.__id);
@@ -3721,10 +3353,7 @@ var require_readable = __commonJS({
runOnNextTick(endWritableNT, stream);
} else if (state.autoDestroy) {
const wState = stream._writableState;
- const autoDestroy =
- !wState ||
- (wState.autoDestroy &&
- (wState.finished || wState.writable === false));
+ const autoDestroy = !wState || (wState.autoDestroy && (wState.finished || wState.writable === false));
if (autoDestroy) {
stream.destroy();
}
@@ -3732,8 +3361,7 @@ var require_readable = __commonJS({
}
}
function endWritableNT(stream) {
- const writable =
- stream.writable && !stream.writableEnded && !stream.destroyed;
+ const writable = stream.writable && !stream.writableEnded && !stream.destroyed;
if (writable) {
stream.end();
}
@@ -3749,23 +3377,17 @@ var require_readable = __commonJS({
return webStreamsAdapters;
}
Readable.fromWeb = function (readableStream, options) {
- return lazyWebStreams().newStreamReadableFromReadableStream(
- readableStream,
- options,
- );
+ return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options);
};
Readable.toWeb = function (streamReadable) {
- return lazyWebStreams().newReadableStreamFromStreamReadable(
- streamReadable,
- );
+ return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable);
};
Readable.wrap = function (src, options) {
var _ref, _src$readableObjectMo;
return new Readable({
objectMode:
(_ref =
- (_src$readableObjectMo = src.readableObjectMode) !== null &&
- _src$readableObjectMo !== void 0
+ (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== void 0
? _src$readableObjectMo
: src.objectMode) !== null && _ref !== void 0
? _ref
@@ -3782,10 +3404,7 @@ var require_readable = __commonJS({
// node_modules/readable-stream/lib/internal/streams/writable.js
var require_writable = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/writable.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/writable.js"(exports, module) {
"use strict";
var {
ArrayPrototypeSlice,
@@ -3819,17 +3438,14 @@ var require_writable = __commonJS({
function Writable(options = {}) {
const isDuplex = this instanceof require_duplex();
- if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this))
- return new Writable(options);
+ if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options);
this._writableState = new WritableState(options, this, isDuplex);
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.destroy === "function") this._destroy = options.destroy;
if (typeof options.final === "function") this._final = options.final;
- if (typeof options.construct === "function")
- this._construct = options.construct;
+ if (typeof options.construct === "function") this._construct = options.construct;
if (options.signal) addAbortSignal(options.signal, this);
}
Stream.call(this, options);
@@ -3849,12 +3465,9 @@ var require_writable = __commonJS({
function nop() {}
var kOnFinished = Symbol2("kOnFinished");
function WritableState(options, stream, isDuplex) {
- if (typeof isDuplex !== "boolean")
- isDuplex = stream instanceof require_duplex();
+ if (typeof isDuplex !== "boolean") isDuplex = stream instanceof require_duplex();
this.objectMode = !!(options && options.objectMode);
- if (isDuplex)
- this.objectMode =
- this.objectMode || !!(options && options.writableObjectMode);
+ if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode);
this.highWaterMark = options
? getHighWaterMark(this, options, "writableHighWaterMark", isDuplex)
: getDefaultHighWaterMark(false);
@@ -3920,8 +3533,7 @@ var require_writable = __commonJS({
encoding = state.defaultEncoding;
} else {
if (!encoding) encoding = state.defaultEncoding;
- else if (encoding !== "buffer" && !Buffer.isEncoding(encoding))
- throw new ERR_UNKNOWN_ENCODING(encoding);
+ else if (encoding !== "buffer" && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding);
if (typeof cb !== "function") cb = nop;
}
if (chunk === null) {
@@ -3938,11 +3550,7 @@ var require_writable = __commonJS({
chunk = Stream._uint8ArrayToBuffer(chunk);
encoding = "buffer";
} else {
- throw new ERR_INVALID_ARG_TYPE(
- "chunk",
- ["string", "Buffer", "Uint8Array"],
- chunk,
- );
+ throw new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer", "Uint8Array"], chunk);
}
}
let err;
@@ -3972,13 +3580,9 @@ var require_writable = __commonJS({
if (!state.writing) clearBuffer(this, state);
}
};
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(
- encoding,
- ) {
- if (typeof encoding === "string")
- encoding = StringPrototypeToLowerCase(encoding);
- if (!Buffer.isEncoding(encoding))
- throw new ERR_UNKNOWN_ENCODING(encoding);
+ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
+ if (typeof encoding === "string") encoding = StringPrototypeToLowerCase(encoding);
+ if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding);
this._writableState.defaultEncoding = encoding;
return this;
};
@@ -3987,12 +3591,7 @@ var require_writable = __commonJS({
state.length += len;
const ret = state.length < state.highWaterMark;
if (!ret) state.needDrain = true;
- if (
- state.writing ||
- state.corked ||
- state.errored ||
- !state.constructed
- ) {
+ if (state.writing || state.corked || state.errored || !state.constructed) {
state.buffered.push({
chunk,
encoding,
@@ -4060,10 +3659,7 @@ var require_writable = __commonJS({
clearBuffer(stream, state);
}
if (sync) {
- if (
- state.afterWriteTickInfo !== null &&
- state.afterWriteTickInfo.cb === cb
- ) {
+ if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) {
state.afterWriteTickInfo.count++;
} else {
state.afterWriteTickInfo = {
@@ -4084,11 +3680,7 @@ var require_writable = __commonJS({
return afterWrite(stream, state, count, cb);
}
function afterWrite(stream, state, count, cb) {
- const needDrain =
- !state.ending &&
- !stream.destroyed &&
- state.length === 0 &&
- state.needDrain;
+ const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain;
if (needDrain) {
state.needDrain = false;
stream.emit("drain");
@@ -4121,8 +3713,7 @@ var require_writable = __commonJS({
for (let i = 0; i < onfinishCallbacks.length; i++) {
var _state$errored2;
onfinishCallbacks[i](
- (_state$errored2 = state.errored) !== null &&
- _state$errored2 !== void 0
+ (_state$errored2 = state.errored) !== null && _state$errored2 !== void 0
? _state$errored2
: new ERR_STREAM_DESTROYED("end"),
);
@@ -4130,12 +3721,7 @@ var require_writable = __commonJS({
resetBuffer(state);
}
function clearBuffer(stream, state) {
- if (
- state.corked ||
- state.bufferProcessing ||
- state.destroyed ||
- !state.constructed
- ) {
+ if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) {
return;
}
const { buffered, bufferedIndex, objectMode } = state;
@@ -4149,15 +3735,12 @@ var require_writable = __commonJS({
state.pendingcb -= bufferedLength - 1;
const callback = state.allNoop
? nop
- : (err) => {
+ : err => {
for (let n = i; n < buffered.length; ++n) {
buffered[n].callback(err);
}
};
- const chunks =
- state.allNoop && i === 0
- ? buffered
- : ArrayPrototypeSlice(buffered, i);
+ const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i);
chunks.allBuffers = state.allBuffers;
doWrite(stream, state, true, state.length, chunks, "", callback);
resetBuffer(state);
@@ -4261,10 +3844,7 @@ var require_writable = __commonJS({
let called = false;
function onFinish(err) {
if (called) {
- errorOrDestroy(
- stream,
- err !== null && err !== void 0 ? err : ERR_MULTIPLE_CALLBACK(),
- );
+ errorOrDestroy(stream, err !== null && err !== void 0 ? err : ERR_MULTIPLE_CALLBACK());
return;
}
called = true;
@@ -4303,8 +3883,7 @@ var require_writable = __commonJS({
}
}
function finishMaybe(stream, state, sync) {
- __DEBUG__ &&
- debug("finishMaybe -- state, sync", state, sync, stream.__id);
+ __DEBUG__ && debug("finishMaybe -- state, sync", state, sync, stream.__id);
if (!needFinish(state, stream.__id)) return;
@@ -4339,10 +3918,7 @@ var require_writable = __commonJS({
stream.emit("finish");
if (state.autoDestroy) {
const rState = stream._readableState;
- const autoDestroy =
- !rState ||
- (rState.autoDestroy &&
- (rState.endEmitted || rState.readable === false));
+ const autoDestroy = !rState || (rState.autoDestroy && (rState.endEmitted || rState.readable === false));
if (autoDestroy) {
stream.destroy();
}
@@ -4367,14 +3943,7 @@ var require_writable = __commonJS({
writable: {
get() {
const w = this._writableState;
- return (
- !!w &&
- w.writable !== false &&
- !w.destroyed &&
- !w.errored &&
- !w.ending &&
- !w.ended
- );
+ return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended;
},
set(val) {
if (this._writableState) {
@@ -4444,11 +4013,7 @@ var require_writable = __commonJS({
var destroy = destroyImpl.destroy;
Writable.prototype.destroy = function (err, cb) {
const state = this._writableState;
- if (
- !state.destroyed &&
- (state.bufferedIndex < state.buffered.length ||
- state[kOnFinished].length)
- ) {
+ if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) {
runOnNextTick(errorBuffer, state);
}
destroy.call(this, err, cb);
@@ -4467,25 +4032,17 @@ var require_writable = __commonJS({
return webStreamsAdapters;
}
Writable.fromWeb = function (writableStream, options) {
- return lazyWebStreams().newStreamWritableFromWritableStream(
- writableStream,
- options,
- );
+ return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options);
};
Writable.toWeb = function (streamWritable) {
- return lazyWebStreams().newWritableStreamFromStreamWritable(
- streamWritable,
- );
+ return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);
};
},
});
// node_modules/readable-stream/lib/internal/streams/duplexify.js
var require_duplexify = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/duplexify.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/duplexify.js"(exports, module) {
"use strict";
var bufferModule = __require("buffer");
var {
@@ -4516,9 +4073,7 @@ var require_duplexify = __commonJS({
: function isBlob2(b) {
return false;
};
- var AbortController =
- globalThis.AbortController ||
- __require("abort-controller").AbortController;
+ var AbortController = globalThis.AbortController || __require("abort-controller").AbortController;
var { FunctionPrototypeCall } = require_primordials();
class Duplexify extends Duplex {
constructor(options) {
@@ -4526,20 +4081,12 @@ var require_duplexify = __commonJS({
// https://github.com/nodejs/node/pull/34385
- if (
- (options === null || options === undefined
- ? undefined
- : options.readable) === false
- ) {
+ if ((options === null || options === undefined ? undefined : options.readable) === false) {
this._readableState.readable = false;
this._readableState.ended = true;
this._readableState.endEmitted = true;
}
- if (
- (options === null || options === undefined
- ? undefined
- : options.writable) === false
- ) {
+ if ((options === null || options === undefined ? undefined : options.writable) === false) {
this._writableState.writable = false;
this._writableState.ending = true;
this._writableState.ended = true;
@@ -4583,12 +4130,12 @@ var require_duplexify = __commonJS({
const promise = FunctionPrototypeCall(
then2,
value,
- (val) => {
+ val => {
if (val != null) {
throw new ERR_INVALID_RETURN_VALUE("nully", "body", val);
}
},
- (err) => {
+ err => {
destroyer(d, err);
},
);
@@ -4609,11 +4156,7 @@ var require_duplexify = __commonJS({
destroy,
}));
}
- throw new ERR_INVALID_RETURN_VALUE(
- "Iterable, AsyncIterable or AsyncFunction",
- name,
- value,
- );
+ throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or AsyncFunction", name, value);
}
if (isBlob(body)) {
return duplexify(body.arrayBuffer());
@@ -4625,16 +4168,12 @@ var require_duplexify = __commonJS({
});
}
if (
- typeof (body === null || body === void 0 ? void 0 : body.writable) ===
- "object" ||
- typeof (body === null || body === void 0 ? void 0 : body.readable) ===
- "object"
+ typeof (body === null || body === void 0 ? void 0 : body.writable) === "object" ||
+ typeof (body === null || body === void 0 ? void 0 : body.readable) === "object"
) {
const readable =
body !== null && body !== void 0 && body.readable
- ? isReadableNodeStream(
- body === null || body === void 0 ? void 0 : body.readable,
- )
+ ? isReadableNodeStream(body === null || body === void 0 ? void 0 : body.readable)
? body === null || body === void 0
? void 0
: body.readable
@@ -4642,9 +4181,7 @@ var require_duplexify = __commonJS({
: void 0;
const writable =
body !== null && body !== void 0 && body.writable
- ? isWritableNodeStream(
- body === null || body === void 0 ? void 0 : body.writable,
- )
+ ? isWritableNodeStream(body === null || body === void 0 ? void 0 : body.writable)
? body === null || body === void 0
? void 0
: body.writable
@@ -4661,13 +4198,13 @@ var require_duplexify = __commonJS({
FunctionPrototypeCall(
then,
body,
- (val) => {
+ val => {
if (val != null) {
d.push(val);
}
d.push(null);
},
- (err) => {
+ err => {
destroyer(d, err);
},
);
@@ -4744,9 +4281,7 @@ var require_duplexify = __commonJS({
}
function _duplexify(pair) {
const r =
- pair.readable && typeof pair.readable.read !== "function"
- ? Readable.wrap(pair.readable)
- : pair.readable;
+ pair.readable && typeof pair.readable.read !== "function" ? Readable.wrap(pair.readable) : pair.readable;
const w = pair.writable;
let readable = !!isReadable(r);
let writable = !!isWritable(w);
@@ -4767,21 +4302,13 @@ var require_duplexify = __commonJS({
}
}
d = new Duplexify({
- readableObjectMode: !!(
- r !== null &&
- r !== void 0 &&
- r.readableObjectMode
- ),
- writableObjectMode: !!(
- w !== null &&
- w !== void 0 &&
- w.writableObjectMode
- ),
+ readableObjectMode: !!(r !== null && r !== void 0 && r.readableObjectMode),
+ writableObjectMode: !!(w !== null && w !== void 0 && w.writableObjectMode),
readable,
writable,
});
if (writable) {
- eos(w, (err) => {
+ eos(w, err => {
writable = false;
if (err) {
destroyer(r, err);
@@ -4815,7 +4342,7 @@ var require_duplexify = __commonJS({
});
}
if (readable) {
- eos(r, (err) => {
+ eos(r, err => {
readable = false;
if (err) {
destroyer(r, err);
@@ -4867,17 +4394,10 @@ var require_duplexify = __commonJS({
// node_modules/readable-stream/lib/internal/streams/duplex.js
var require_duplex = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/duplex.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/duplex.js"(exports, module) {
"use strict";
- var {
- ObjectDefineProperties,
- ObjectGetOwnPropertyDescriptor,
- ObjectKeys,
- ObjectSetPrototypeOf,
- } = require_primordials();
+ var { ObjectDefineProperties, ObjectGetOwnPropertyDescriptor, ObjectKeys, ObjectSetPrototypeOf } =
+ require_primordials();
var Readable = require_readable();
@@ -4910,51 +4430,23 @@ var require_duplex = __commonJS({
{
for (var method in Writable.prototype) {
- if (!Duplex.prototype[method])
- Duplex.prototype[method] = Writable.prototype[method];
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
}
}
ObjectDefineProperties(Duplex.prototype, {
writable: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writable"),
- writableHighWaterMark: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableHighWaterMark",
- ),
- writableObjectMode: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableObjectMode",
- ),
- writableBuffer: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableBuffer",
- ),
- writableLength: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableLength",
- ),
- writableFinished: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableFinished",
- ),
- writableCorked: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableCorked",
- ),
- writableEnded: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableEnded",
- ),
- writableNeedDrain: ObjectGetOwnPropertyDescriptor(
- Writable.prototype,
- "writableNeedDrain",
- ),
+ writableHighWaterMark: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableHighWaterMark"),
+ writableObjectMode: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableObjectMode"),
+ writableBuffer: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableBuffer"),
+ writableLength: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableLength"),
+ writableFinished: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableFinished"),
+ writableCorked: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableCorked"),
+ writableEnded: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableEnded"),
+ writableNeedDrain: ObjectGetOwnPropertyDescriptor(Writable.prototype, "writableNeedDrain"),
destroyed: {
get() {
- if (
- this._readableState === void 0 ||
- this._writableState === void 0
- ) {
+ if (this._readableState === void 0 || this._writableState === void 0) {
return false;
}
return this._readableState.destroyed && this._writableState.destroyed;
@@ -4973,10 +4465,7 @@ var require_duplex = __commonJS({
return webStreamsAdapters;
}
Duplex.fromWeb = function (pair, options) {
- return lazyWebStreams().newStreamDuplexFromReadableWritablePair(
- pair,
- options,
- );
+ return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options);
};
Duplex.toWeb = function (duplex) {
return lazyWebStreams().newReadableWritablePairFromDuplex(duplex);
@@ -4993,10 +4482,7 @@ var require_duplex = __commonJS({
// node_modules/readable-stream/lib/internal/streams/transform.js
var require_transform = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/transform.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/transform.js"(exports, module) {
"use strict";
var { ObjectSetPrototypeOf, Symbol: Symbol2 } = require_primordials();
var { ERR_METHOD_NOT_IMPLEMENTED } = require_errors().codes;
@@ -5009,8 +4495,7 @@ var require_transform = __commonJS({
this[kCallback] = null;
if (options) {
- if (typeof options.transform === "function")
- this._transform = options.transform;
+ if (typeof options.transform === "function") this._transform = options.transform;
if (typeof options.flush === "function") this._flush = options.flush;
}
@@ -5093,10 +4578,7 @@ var require_transform = __commonJS({
// node_modules/readable-stream/lib/internal/streams/passthrough.js
var require_passthrough = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/passthrough.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/passthrough.js"(exports, module) {
"use strict";
var { ObjectSetPrototypeOf } = require_primordials();
var Transform = require_transform();
@@ -5119,36 +4601,21 @@ var require_passthrough = __commonJS({
// node_modules/readable-stream/lib/internal/streams/pipeline.js
var require_pipeline = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/pipeline.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/pipeline.js"(exports, module) {
"use strict";
- var {
- ArrayIsArray,
- Promise: Promise2,
- SymbolAsyncIterator,
- } = require_primordials();
+ var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator } = require_primordials();
var eos = require_end_of_stream();
var { once } = require_util();
var destroyImpl = require_destroy();
var Duplex = require_duplex();
var {
aggregateTwoErrors,
- codes: {
- ERR_INVALID_ARG_TYPE,
- ERR_INVALID_RETURN_VALUE,
- ERR_MISSING_ARGS,
- ERR_STREAM_DESTROYED,
- },
+ codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE, ERR_MISSING_ARGS, ERR_STREAM_DESTROYED },
AbortError,
} = require_errors();
var { validateFunction, validateAbortSignal } = require_validators();
- var { isIterable, isReadable, isReadableNodeStream, isNodeStream } =
- require_utils();
- var AbortController =
- globalThis.AbortController ||
- __require("abort-controller").AbortController;
+ var { isIterable, isReadable, isReadableNodeStream, isNodeStream } = require_utils();
+ var AbortController = globalThis.AbortController || __require("abort-controller").AbortController;
var PassThrough;
var Readable;
function destroyer(stream, reading, writing) {
@@ -5162,27 +4629,21 @@ var require_pipeline = __commonJS({
readable: reading,
writable: writing,
},
- (err) => {
+ err => {
finished = !err;
},
);
return {
- destroy: (err) => {
+ destroy: err => {
if (finished) return;
finished = true;
- destroyImpl.destroyer(
- stream,
- err || new ERR_STREAM_DESTROYED("pipe"),
- );
+ destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED("pipe"));
},
cleanup,
};
}
function popCallback(streams) {
- validateFunction(
- streams[streams.length - 1],
- "streams[stream.length - 1]",
- );
+ validateFunction(streams[streams.length - 1], "streams[stream.length - 1]");
return streams.pop();
}
function makeAsyncIterable(val) {
@@ -5191,11 +4652,7 @@ var require_pipeline = __commonJS({
} else if (isReadableNodeStream(val)) {
return fromReadable(val);
}
- throw new ERR_INVALID_ARG_TYPE(
- "val",
- ["Readable", "Iterable", "AsyncIterable"],
- val,
- );
+ throw new ERR_INVALID_ARG_TYPE("val", ["Readable", "Iterable", "AsyncIterable"], val);
}
async function* fromReadable(val) {
if (!Readable) {
@@ -5206,7 +4663,7 @@ var require_pipeline = __commonJS({
async function pump(iterable, writable, finish, { end }) {
let error;
let onresolve = null;
- const resume = (err) => {
+ const resume = err => {
if (err) {
error = err;
}
@@ -5271,16 +4728,13 @@ var require_pipeline = __commonJS({
}
const ac = new AbortController();
const signal = ac.signal;
- const outerSignal =
- opts === null || opts === void 0 ? void 0 : opts.signal;
+ const outerSignal = opts === null || opts === void 0 ? void 0 : opts.signal;
const lastStreamCleanup = [];
validateAbortSignal(outerSignal, "options.signal");
function abort() {
finishImpl(new AbortError());
}
- outerSignal === null || outerSignal === void 0
- ? void 0
- : outerSignal.addEventListener("abort", abort);
+ outerSignal === null || outerSignal === void 0 ? void 0 : outerSignal.addEventListener("abort", abort);
let error;
let value;
const destroys = [];
@@ -5298,13 +4752,11 @@ var require_pipeline = __commonJS({
while (destroys.length) {
destroys.shift()(error);
}
- outerSignal === null || outerSignal === void 0
- ? void 0
- : outerSignal.removeEventListener("abort", abort);
+ outerSignal === null || outerSignal === void 0 ? void 0 : outerSignal.removeEventListener("abort", abort);
ac.abort();
if (final) {
if (!error) {
- lastStreamCleanup.forEach((fn) => fn());
+ lastStreamCleanup.forEach(fn => fn());
}
runOnNextTick(callback, error, value);
}
@@ -5314,17 +4766,11 @@ var require_pipeline = __commonJS({
const stream = streams[i];
const reading = i < streams.length - 1;
const writing = i > 0;
- const end =
- reading ||
- (opts === null || opts === void 0 ? void 0 : opts.end) !== false;
+ const end = reading || (opts === null || opts === void 0 ? void 0 : opts.end) !== false;
const isLastStream = i === streams.length - 1;
if (isNodeStream(stream)) {
let onError = function (err) {
- if (
- err &&
- err.name !== "AbortError" &&
- err.code !== "ERR_STREAM_PREMATURE_CLOSE"
- ) {
+ if (err && err.name !== "AbortError" && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
finish(err);
}
};
@@ -5348,11 +4794,7 @@ var require_pipeline = __commonJS({
signal,
});
if (!isIterable(ret)) {
- throw new ERR_INVALID_RETURN_VALUE(
- "Iterable, AsyncIterable or Stream",
- "source",
- ret,
- );
+ throw new ERR_INVALID_RETURN_VALUE("Iterable, AsyncIterable or Stream", "source", ret);
}
} else if (isIterable(stream) || isReadableNodeStream(stream)) {
ret = stream;
@@ -5366,11 +4808,7 @@ var require_pipeline = __commonJS({
});
if (reading) {
if (!isIterable(ret, true)) {
- throw new ERR_INVALID_RETURN_VALUE(
- "AsyncIterable",
- `transform[${i - 1}]`,
- ret,
- );
+ throw new ERR_INVALID_RETURN_VALUE("AsyncIterable", `transform[${i - 1}]`, ret);
}
} else {
var _ret;
@@ -5380,13 +4818,12 @@ var require_pipeline = __commonJS({
const pt = new PassThrough({
objectMode: true,
});
- const then =
- (_ret = ret) === null || _ret === void 0 ? void 0 : _ret.then;
+ const then = (_ret = ret) === null || _ret === void 0 ? void 0 : _ret.then;
if (typeof then === "function") {
finishCount++;
then.call(
ret,
- (val) => {
+ val => {
value = val;
if (val != null) {
pt.write(val);
@@ -5396,7 +4833,7 @@ var require_pipeline = __commonJS({
}
runOnNextTick(finish);
},
- (err) => {
+ err => {
pt.destroy(err);
runOnNextTick(finish, err);
},
@@ -5407,11 +4844,7 @@ var require_pipeline = __commonJS({
end,
});
} else {
- throw new ERR_INVALID_RETURN_VALUE(
- "AsyncIterable or Promise",
- "destination",
- ret,
- );
+ throw new ERR_INVALID_RETURN_VALUE("AsyncIterable or Promise", "destination", ret);
}
ret = pt;
const { destroy, cleanup } = destroyer(ret, false, true);
@@ -5435,11 +4868,7 @@ var require_pipeline = __commonJS({
end,
});
} else {
- throw new ERR_INVALID_ARG_TYPE(
- "val",
- ["Readable", "Iterable", "AsyncIterable"],
- ret,
- );
+ throw new ERR_INVALID_ARG_TYPE("val", ["Readable", "Iterable", "AsyncIterable"], ret);
}
ret = stream;
} else {
@@ -5469,7 +4898,7 @@ var require_pipeline = __commonJS({
readable: true,
writable: false,
},
- (err) => {
+ err => {
const rState = src._readableState;
if (
err &&
@@ -5503,10 +4932,7 @@ var require_pipeline = __commonJS({
// node_modules/readable-stream/lib/internal/streams/compose.js
var require_compose = __commonJS({
- "node_modules/readable-stream/lib/internal/streams/compose.js"(
- exports,
- module,
- ) {
+ "node_modules/readable-stream/lib/internal/streams/compose.js"(exports, module) {
"use strict";
var { pipeline } = require_pipeline();
var Duplex = require_duplex();
@@ -5536,18 +4962,10 @@ var require_compose = __commonJS({
continue;
}
if (n < streams.length - 1 && !isReadable(streams[n])) {
- throw new ERR_INVALID_ARG_VALUE(
- `streams[${n}]`,
- orgStreams[n],
- "must be readable",
- );
+ throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be readable");
}
if (n > 0 && !isWritable(streams[n])) {
- throw new ERR_INVALID_ARG_VALUE(
- `streams[${n}]`,
- orgStreams[n],
- "must be writable",
- );
+ throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be writable");
}
}
let ondrain;
@@ -5571,16 +4989,8 @@ var require_compose = __commonJS({
const writable = !!isWritable(head);
const readable = !!isReadable(tail);
d = new Duplex({
- writableObjectMode: !!(
- head !== null &&
- head !== void 0 &&
- head.writableObjectMode
- ),
- readableObjectMode: !!(
- tail !== null &&
- tail !== void 0 &&
- tail.writableObjectMode
- ),
+ writableObjectMode: !!(head !== null && head !== void 0 && head.writableObjectMode),
+ readableObjectMode: !!(tail !== null && tail !== void 0 && tail.writableObjectMode),
writable,
readable,
});
@@ -5667,12 +5077,7 @@ var require_promises = __commonJS({
let signal;
let end;
const lastArg = streams[streams.length - 1];
- if (
- lastArg &&
- typeof lastArg === "object" &&
- !isNodeStream(lastArg) &&
- !isIterable(lastArg)
- ) {
+ if (lastArg && typeof lastArg === "object" && !isNodeStream(lastArg) && !isIterable(lastArg)) {
const options = ArrayPrototypePop(streams);
signal = options.signal;
end = options.end;
@@ -5703,14 +5108,12 @@ var require_promises = __commonJS({
var require_stream = __commonJS({
"node_modules/readable-stream/lib/stream.js"(exports, module) {
"use strict";
- var { ObjectDefineProperty, ObjectKeys, ReflectApply } =
- require_primordials();
+ var { ObjectDefineProperty, ObjectKeys, ReflectApply } = require_primordials();
var {
promisify: { custom: customPromisify },
} = require_util();
- var { streamReturningOperators, promiseReturningOperators } =
- require_operators();
+ var { streamReturningOperators, promiseReturningOperators } = require_operators();
var {
codes: { ERR_ILLEGAL_CONSTRUCTOR },
} = require_errors();
@@ -5833,8 +5236,7 @@ var require_ours = __commonJS({
module.exports.pipeline = CustomStream.pipeline;
module.exports.compose = CustomStream.compose;
- module.exports._getNativeReadableStreamPrototype =
- getNativeReadableStreamPrototype;
+ module.exports._getNativeReadableStreamPrototype = getNativeReadableStreamPrototype;
module.exports.NativeWritable = NativeWritable;
Object.defineProperty(CustomStream, "promises", {
@@ -5856,8 +5258,7 @@ var require_ours = __commonJS({
*
*/
function createNativeStreamReadable(nativeType, Readable) {
- var [pull, start, cancel, setClose, deinit, updateRef, drainFn] =
- globalThis[Symbol.for("Bun.lazy")](nativeType);
+ var [pull, start, cancel, setClose, deinit, updateRef, drainFn] = globalThis[Symbol.for("Bun.lazy")](nativeType);
var closer = [false];
var handleNumberResult = function (nativeReadable, result, view, isClosed) {
@@ -5882,12 +5283,7 @@ function createNativeStreamReadable(nativeType, Readable) {
return view;
};
- var handleArrayBufferViewResult = function (
- nativeReadable,
- result,
- view,
- isClosed,
- ) {
+ var handleArrayBufferViewResult = function (nativeReadable, result, view, isClosed) {
if (result.byteLength > 0) {
nativeReadable.push(result);
}
@@ -5899,10 +5295,9 @@ function createNativeStreamReadable(nativeType, Readable) {
return view;
};
- var DYNAMICALLY_ADJUST_CHUNK_SIZE =
- process.env.BUN_DISABLE_DYNAMIC_CHUNK_SIZE !== "1";
+ var DYNAMICALLY_ADJUST_CHUNK_SIZE = process.env.BUN_DISABLE_DYNAMIC_CHUNK_SIZE !== "1";
- const finalizer = new FinalizationRegistry((ptr) => ptr && deinit(ptr));
+ const finalizer = new FinalizationRegistry(ptr => ptr && deinit(ptr));
const MIN_BUFFER_SIZE = 256;
var NativeReadable = class NativeReadable extends Readable {
#ptr;
@@ -5973,8 +5368,7 @@ function createNativeStreamReadable(nativeType, Readable) {
#internalConstruct(ptr) {
this.#constructed = true;
const result = start(ptr, this.#highWaterMark);
- __DEBUG__ &&
- debug("NativeReadable internal `start` result", result, this.__id);
+ __DEBUG__ && debug("NativeReadable internal `start` result", result, this.__id);
if (typeof result === "number" && result > 1) {
this.#hasResized = true;
@@ -5985,8 +5379,7 @@ function createNativeStreamReadable(nativeType, Readable) {
if (drainFn) {
const drainResult = drainFn(ptr);
- __DEBUG__ &&
- debug("NativeReadable drain result", drainResult, this.__id);
+ __DEBUG__ && debug("NativeReadable drain result", drainResult, this.__id);
if ((drainResult?.byteLength ?? 0) > 0) {
this.push(drainResult);
}
@@ -6007,19 +5400,12 @@ function createNativeStreamReadable(nativeType, Readable) {
}
push(result, encoding) {
- __DEBUG__ &&
- debug(
- "NativeReadable push -- result, encoding",
- result,
- encoding,
- this.__id,
- );
+ __DEBUG__ && debug("NativeReadable push -- result, encoding", result, encoding, this.__id);
return super.push(...arguments);
}
#handleResult(result, view, isClosed) {
- __DEBUG__ &&
- debug("result, isClosed @ #handleResult", result, isClosed, this.__id);
+ __DEBUG__ && debug("result, isClosed @ #handleResult", result, isClosed, this.__id);
if (typeof result === "number") {
if (result >= this.#highWaterMark && !this.#hasResized && !isClosed) {
@@ -6032,11 +5418,7 @@ function createNativeStreamReadable(nativeType, Readable) {
this.push(null);
return view?.byteLength ?? 0 > 0 ? view : undefined;
} else if (ArrayBuffer.isView(result)) {
- if (
- result.byteLength >= this.#highWaterMark &&
- !this.#hasResized &&
- !isClosed
- ) {
+ if (result.byteLength >= this.#highWaterMark && !this.#hasResized && !isClosed) {
this.#highWaterMark *= 2;
this.#hasResized = true;
__DEBUG__ && debug("Resized", this.__id);
@@ -6056,16 +5438,12 @@ function createNativeStreamReadable(nativeType, Readable) {
if (isPromise(result)) {
this.#pendingRead = true;
return result.then(
- (result) => {
+ result => {
this.#pendingRead = false;
- __DEBUG__ &&
- debug(
- "pending no longerrrrrrrr (result returned from pull)",
- this.__id,
- );
+ __DEBUG__ && debug("pending no longerrrrrrrr (result returned from pull)", this.__id);
this.#remainingChunk = this.#handleResult(result, view, closer[0]);
},
- (reason) => {
+ reason => {
__DEBUG__ && debug("error from pull", reason, this.__id);
errorOrDestroy(this, reason);
},
@@ -6126,14 +5504,11 @@ var nativeReadableStreamPrototypes = {
5: undefined,
};
function getNativeReadableStreamPrototype(nativeType, Readable) {
- return (nativeReadableStreamPrototypes[nativeType] ||=
- createNativeStreamReadable(nativeType, Readable));
+ return (nativeReadableStreamPrototypes[nativeType] ||= createNativeStreamReadable(nativeType, Readable));
}
function getNativeReadableStream(Readable, stream, options) {
- if (
- !(stream && typeof stream === "object" && stream instanceof ReadableStream)
- ) {
+ if (!(stream && typeof stream === "object" && stream instanceof ReadableStream)) {
return undefined;
}
@@ -6272,6 +5647,5 @@ export var pipeline = stream_exports.pipeline;
export var compose = stream_exports.compose;
export var Stream = stream_exports.Stream;
export var eos = (stream_exports["eos"] = require_end_of_stream);
-export var _getNativeReadableStreamPrototype =
- stream_exports._getNativeReadableStreamPrototype;
+export var _getNativeReadableStreamPrototype = stream_exports._getNativeReadableStreamPrototype;
export var NativeWritable = stream_exports.NativeWritable;
diff --git a/src/bun.js/url.exports.js b/src/bun.js/url.exports.js
index f1478e212..c7d91d509 100644
--- a/src/bun.js/url.exports.js
+++ b/src/bun.js/url.exports.js
@@ -100,8 +100,7 @@ function A(s, r, t) {
return o.parse(s, r, t), o;
}
m.prototype.parse = function (s, r, t) {
- if (!it(s))
- throw new TypeError("Parameter 'url' must be a string, not " + typeof s);
+ if (!it(s)) throw new TypeError("Parameter 'url' must be a string, not " + typeof s);
var o = s.indexOf("?"),
a = o !== -1 && o < s.indexOf("#") ? "?" : "#",
l = s.split(a),
@@ -117,9 +116,7 @@ m.prototype.parse = function (s, r, t) {
(this.pathname = g[1]),
g[2]
? ((this.search = g[2]),
- r
- ? (this.query = Z.parse(this.search.substr(1)))
- : (this.query = this.search.substr(1)))
+ r ? (this.query = Z.parse(this.search.substr(1))) : (this.query = this.search.substr(1)))
: r && ((this.search = ""), (this.query = {})),
this
);
@@ -141,10 +138,7 @@ m.prototype.parse = function (s, r, t) {
}
var P, p;
u === -1 ? (p = h.lastIndexOf("@")) : (p = h.lastIndexOf("@", u)),
- p !== -1 &&
- ((P = h.slice(0, p)),
- (h = h.slice(p + 1)),
- (this.auth = decodeURIComponent(P))),
+ p !== -1 && ((P = h.slice(0, p)), (h = h.slice(p + 1)), (this.auth = decodeURIComponent(P))),
(u = -1);
for (var n = 0; n < G.length; n++) {
var b = h.indexOf(G[n]);
@@ -155,15 +149,12 @@ m.prototype.parse = function (s, r, t) {
(h = h.slice(u)),
this.parseHost(),
(this.hostname = this.hostname || "");
- var C =
- this.hostname[0] === "[" &&
- this.hostname[this.hostname.length - 1] === "]";
+ var C = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
if (!C)
for (var e = this.hostname.split(/\./), n = 0, i = e.length; n < i; n++) {
var d = e[n];
if (!!d && !d.match(K)) {
- for (var y = "", x = 0, _ = d.length; x < _; x++)
- d.charCodeAt(x) > 127 ? (y += "x") : (y += d[x]);
+ for (var y = "", x = 0, _ = d.length; x < _; x++) d.charCodeAt(x) > 127 ? (y += "x") : (y += d[x]);
if (!y.match(K)) {
var q = e.slice(0, n),
O = e.slice(n + 1),
@@ -175,17 +166,13 @@ m.prototype.parse = function (s, r, t) {
}
}
}
- this.hostname.length > ot
- ? (this.hostname = "")
- : (this.hostname = this.hostname.toLowerCase()),
+ this.hostname.length > ot ? (this.hostname = "") : (this.hostname = this.hostname.toLowerCase()),
C || (this.hostname = new F(`https://${this.hostname}`).hostname);
var w = this.port ? ":" + this.port : "",
H = this.hostname || "";
(this.host = H + w),
(this.href += this.host),
- C &&
- ((this.hostname = this.hostname.substr(1, this.hostname.length - 2)),
- h[0] !== "/" && (h = "/" + h));
+ C && ((this.hostname = this.hostname.substr(1, this.hostname.length - 2)), h[0] !== "/" && (h = "/" + h));
}
if (!nt[v])
for (var n = 0, i = B.length; n < i; n++) {
@@ -216,10 +203,7 @@ m.prototype.parse = function (s, r, t) {
return (this.href = this.format()), this;
};
function V(s) {
- return (
- it(s) && (s = A(s)),
- s instanceof m ? s.format() : m.prototype.format.call(s)
- );
+ return it(s) && (s = A(s)), s instanceof m ? s.format() : m.prototype.format.call(s);
}
m.prototype.format = function () {
var s = this.auth || "";
@@ -232,16 +216,9 @@ m.prototype.format = function () {
this.host
? (a = s + this.host)
: this.hostname &&
- ((a =
- s +
- (this.hostname.indexOf(":") === -1
- ? this.hostname
- : "[" + this.hostname + "]")),
+ ((a = s + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]")),
this.port && (a += ":" + this.port)),
- this.query &&
- D(this.query) &&
- Object.keys(this.query).length &&
- (l = Z.stringify(this.query));
+ this.query && D(this.query) && Object.keys(this.query).length && (l = Z.stringify(this.query));
var f = this.search || (l && "?" + l) || "";
return (
r && r.substr(-1) !== ":" && (r += ":"),
@@ -281,11 +258,7 @@ function X(s, r) {
var g = f[h];
g !== "protocol" && (t[g] = s[g]);
}
- return (
- R[t.protocol] && t.hostname && !t.pathname && (t.path = t.pathname = "/"),
- (t.href = t.format()),
- t
- );
+ return R[t.protocol] && t.hostname && !t.pathname && (t.path = t.pathname = "/"), (t.href = t.format()), t;
}
if (s.protocol && s.protocol !== t.protocol) {
if (!R[s.protocol]) {
@@ -296,11 +269,7 @@ function X(s, r) {
return (t.href = t.format()), t;
}
if (((t.protocol = s.protocol), !s.host && !N[s.protocol])) {
- for (
- var i = (s.pathname || "").split("/");
- i.length && !(s.host = i.shift());
-
- );
+ for (var i = (s.pathname || "").split("/"); i.length && !(s.host = i.shift()); );
s.host || (s.host = ""),
s.hostname || (s.hostname = ""),
i[0] !== "" && i.unshift(""),
@@ -348,12 +317,7 @@ function X(s, r) {
(t.search = s.search),
(t.query = s.query),
(e = i);
- else if (i.length)
- e || (e = []),
- e.pop(),
- (e = e.concat(i)),
- (t.search = s.search),
- (t.query = s.query);
+ else if (i.length) e || (e = []), e.pop(), (e = e.concat(i)), (t.search = s.search), (t.query = s.query);
else if (!E(s.search)) {
if (d) {
t.hostname = t.host = e.shift();
@@ -363,35 +327,22 @@ function X(s, r) {
return (
(t.search = s.search),
(t.query = s.query),
- (!I(t.pathname) || !I(t.search)) &&
- (t.path = (t.pathname ? t.pathname : "") + (t.search ? t.search : "")),
+ (!I(t.pathname) || !I(t.search)) && (t.path = (t.pathname ? t.pathname : "") + (t.search ? t.search : "")),
(t.href = t.format()),
t
);
}
if (!e.length)
- return (
- (t.pathname = null),
- t.search ? (t.path = "/" + t.search) : (t.path = null),
- (t.href = t.format()),
- t
- );
+ return (t.pathname = null), t.search ? (t.path = "/" + t.search) : (t.path = null), (t.href = t.format()), t;
for (
var x = e.slice(-1)[0],
- _ =
- ((t.host || s.host || e.length > 1) && (x === "." || x === "..")) ||
- x === "",
+ _ = ((t.host || s.host || e.length > 1) && (x === "." || x === "..")) || x === "",
q = 0,
O = e.length;
O >= 0;
O--
)
- (x = e[O]),
- x === "."
- ? e.splice(O, 1)
- : x === ".."
- ? (e.splice(O, 1), q++)
- : q && (e.splice(O, 1), q--);
+ (x = e[O]), x === "." ? e.splice(O, 1) : x === ".." ? (e.splice(O, 1), q++) : q && (e.splice(O, 1), q--);
if (!p && !C) for (; q--; q) e.unshift("..");
p && e[0] !== "" && (!e[0] || e[0].charAt(0) !== "/") && e.unshift(""),
_ && e.join("/").substr(-1) !== "/" && e.push("");
@@ -404,11 +355,8 @@ function X(s, r) {
return (
(p = p || (t.host && e.length)),
p && !U && e.unshift(""),
- e.length
- ? (t.pathname = e.join("/"))
- : ((t.pathname = null), (t.path = null)),
- (!I(t.pathname) || !I(t.search)) &&
- (t.path = (t.pathname ? t.pathname : "") + (t.search ? t.search : "")),
+ e.length ? (t.pathname = e.join("/")) : ((t.pathname = null), (t.path = null)),
+ (!I(t.pathname) || !I(t.search)) && (t.path = (t.pathname ? t.pathname : "") + (t.search ? t.search : "")),
(t.auth = s.auth || t.auth),
(t.slashes = t.slashes || s.slashes),
(t.href = t.format()),
@@ -418,10 +366,7 @@ function X(s, r) {
(m.prototype.parseHost = function () {
var s = this.host,
r = st.exec(s);
- r &&
- ((r = r[0]),
- r !== ":" && (this.port = r.substr(1)),
- (s = s.substr(0, s.length - r.length))),
+ r && ((r = r[0]), r !== ":" && (this.port = r.substr(1)), (s = s.substr(0, s.length - r.length))),
s && (this.hostname = s);
});
var Y, k;
diff --git a/src/bun.js/util.exports.js b/src/bun.js/util.exports.js
index a3067dae6..1bba01977 100644
--- a/src/bun.js/util.exports.js
+++ b/src/bun.js/util.exports.js
@@ -1,19 +1,13 @@
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) =>
function __require() {
- return (
- mod ||
- (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
- mod.exports
- );
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
export function isBuffer(value) {
return (
Buffer.isBuffer(value) ||
// incase it ends up as a browserify buffer
- (typeof arg?.copy === "function" &&
- typeof arg?.fill === "function" &&
- typeof arg?.readUInt8 === "function")
+ (typeof arg?.copy === "function" && typeof arg?.fill === "function" && typeof arg?.readUInt8 === "function")
);
}
@@ -178,15 +172,7 @@ inspect.styles = {
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
- return (
- "\x1B[" +
- inspect.colors[style][0] +
- "m" +
- str +
- "\x1B[" +
- inspect.colors[style][1] +
- "m"
- );
+ return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
} else {
return str;
}
@@ -224,10 +210,7 @@ function formatValue(ctx, value, recurseTimes) {
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
- if (
- isError(value) &&
- (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)
- ) {
+ if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
return formatError(value);
}
if (keys.length === 0) {
@@ -290,13 +273,7 @@ function formatValue(ctx, value, recurseTimes) {
function formatPrimitive(ctx, value) {
if (isUndefined(value)) return ctx.stylize("undefined", "undefined");
if (isString(value)) {
- var simple =
- "'" +
- JSON.stringify(value)
- .replace(/^"|"$/g, "")
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') +
- "'";
+ var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
return ctx.stylize(simple, "string");
}
if (isNumber(value)) return ctx.stylize("" + value, "number");
@@ -310,18 +287,14 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
- output.push(
- formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true),
- );
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
} else {
output.push("");
}
}
keys.forEach(function (key) {
if (!key.match(/^\d+$/)) {
- output.push(
- formatProperty(ctx, value, recurseTimes, visibleKeys, key, true),
- );
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
}
});
return output;
@@ -402,14 +375,7 @@ function reduceToSingleString(output, base, braces) {
return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
}, 0);
if (length > 60) {
- return (
- braces[0] +
- (base === "" ? "" : base + "\n ") +
- " " +
- output.join(",\n ") +
- " " +
- braces[1]
- );
+ return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
}
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
}
@@ -473,25 +439,10 @@ exports.isBuffer = isBuffer;
function pad(n) {
return n < 10 ? "0" + n.toString(10) : n.toString(10);
}
-var months = [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec",
-];
+var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
function timestamp() {
var d = new Date();
- var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(
- ":",
- );
+ var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":");
return [d.getDate(), months[d.getMonth()], time].join(" ");
}
var log = (exports.log = function () {
@@ -512,14 +463,11 @@ function hasOwnProperty(obj, prop) {
}
var kCustomPromisifiedSymbol = Symbol.for("util.promisify.custom");
var promisify = (exports.promisify = function promisify(original) {
- if (typeof original !== "function")
- throw new TypeError('The "original" argument must be of type Function');
+ if (typeof original !== "function") throw new TypeError('The "original" argument must be of type Function');
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
var fn = original[kCustomPromisifiedSymbol];
if (typeof fn !== "function") {
- throw new TypeError(
- 'The "util.promisify.custom" argument must be of type Function',
- );
+ throw new TypeError('The "util.promisify.custom" argument must be of type Function');
}
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
diff --git a/src/bun.js/ws.exports.js b/src/bun.js/ws.exports.js
index d7a79b0b7..912a54944 100644
--- a/src/bun.js/ws.exports.js
+++ b/src/bun.js/ws.exports.js
@@ -80,18 +80,10 @@ var Receiver = (BunWebSocket.Receiver = class Receiver {
}
});
-var createWebSocketStream = (BunWebSocket.createWebSocketStream = function (
- ws,
-) {
+var createWebSocketStream = (BunWebSocket.createWebSocketStream = function (ws) {
throw new Error("Not supported in Bun");
});
export default BunWebSocket;
-export {
- createWebSocketStream,
- Sender,
- Receiver,
- BunWebSocket as WebSocket,
- WebSocketServer,
-};
+export { createWebSocketStream, Sender, Receiver, BunWebSocket as WebSocket, WebSocketServer };
diff --git a/src/bun.js/zlib.exports.js b/src/bun.js/zlib.exports.js
index 175d617db..d322b7028 100644
--- a/src/bun.js/zlib.exports.js
+++ b/src/bun.js/zlib.exports.js
@@ -11,11 +11,7 @@ var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) =>
function __require() {
- return (
- mod ||
- (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
- mod.exports
- );
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
@@ -30,22 +26,18 @@ var __copyProps = (to, from, except, desc) => {
return to;
};
var __reExport = (target, mod, secondTarget) => (
- __copyProps(target, mod, "default"),
- secondTarget && __copyProps(secondTarget, mod, "default")
+ __copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")
);
var __toESM = (mod, isNodeMode, target) => (
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
__copyProps(
- isNodeMode || !mod || !mod.__esModule
- ? __defProp(target, "default", { value: mod, enumerable: true })
- : target,
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod,
)
);
-var __toCommonJS = (mod) =>
- __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
-const require = (id) => import.meta.require(id);
+const require = id => import.meta.require(id);
// node_modules/pako/lib/zlib/zstream.js
var require_zstream = __commonJS({
@@ -74,9 +66,7 @@ var require_common = __commonJS({
"node_modules/pako/lib/utils/common.js"(exports) {
"use strict";
var TYPED_OK =
- typeof Uint8Array !== "undefined" &&
- typeof Uint16Array !== "undefined" &&
- typeof Int32Array !== "undefined";
+ typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined";
function _has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
@@ -194,20 +184,12 @@ var require_trees = __commonJS({
var REP_3_6 = 16;
var REPZ_3_10 = 17;
var REPZ_11_138 = 18;
- var extra_lbits = [
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5,
- 5, 5, 5, 0,
- ];
+ var extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];
var extra_dbits = [
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
- 11, 11, 12, 12, 13, 13,
- ];
- var extra_blbits = [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7,
- ];
- var bl_order = [
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15,
+ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13,
];
+ var extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];
+ var bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
var DIST_CODE_LEN = 512;
var static_ltree = new Array((L_CODES + 2) * 2);
zero(static_ltree);
@@ -221,13 +203,7 @@ var require_trees = __commonJS({
zero(base_length);
var base_dist = new Array(D_CODES);
zero(base_dist);
- function StaticTreeDesc(
- static_tree,
- extra_bits,
- extra_base,
- elems,
- max_length,
- ) {
+ function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
this.static_tree = static_tree;
this.extra_bits = extra_bits;
this.extra_base = extra_base;
@@ -426,27 +402,9 @@ var require_trees = __commonJS({
static_dtree[n * 2 + 1] = 5;
static_dtree[n * 2] = bi_reverse(n, 5);
}
- static_l_desc = new StaticTreeDesc(
- static_ltree,
- extra_lbits,
- LITERALS + 1,
- L_CODES,
- MAX_BITS,
- );
- static_d_desc = new StaticTreeDesc(
- static_dtree,
- extra_dbits,
- 0,
- D_CODES,
- MAX_BITS,
- );
- static_bl_desc = new StaticTreeDesc(
- new Array(0),
- extra_blbits,
- 0,
- BL_CODES,
- MAX_BL_BITS,
- );
+ static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);
+ static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);
+ static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);
}
function init_block(s) {
var n;
@@ -484,19 +442,13 @@ var require_trees = __commonJS({
function smaller(tree, n, m, depth) {
var _n2 = n * 2;
var _m2 = m * 2;
- return (
- tree[_n2] < tree[_m2] ||
- (tree[_n2] === tree[_m2] && depth[n] <= depth[m])
- );
+ return tree[_n2] < tree[_m2] || (tree[_n2] === tree[_m2] && depth[n] <= depth[m]);
}
function pqdownheap(s, tree, k) {
var v = s.heap[k];
var j = k << 1;
while (j <= s.heap_len) {
- if (
- j < s.heap_len &&
- smaller(tree, s.heap[j + 1], s.heap[j], s.depth)
- ) {
+ if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {
j++;
}
if (smaller(tree, v, s.heap[j], s.depth)) {
@@ -516,9 +468,7 @@ var require_trees = __commonJS({
var extra;
if (s.last_lit !== 0) {
do {
- dist =
- (s.pending_buf[s.d_buf + lx * 2] << 8) |
- s.pending_buf[s.d_buf + lx * 2 + 1];
+ dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | s.pending_buf[s.d_buf + lx * 2 + 1];
lc = s.pending_buf[s.l_buf + lx];
lx++;
if (dist === 0) {
@@ -584,8 +534,7 @@ var require_trees = __commonJS({
s.heap[--s.heap_max] = n;
s.heap[--s.heap_max] = m;
tree[node * 2] = tree[n * 2] + tree[m * 2];
- s.depth[node] =
- (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
+ s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;
tree[n * 2 + 1] = tree[m * 2 + 1] = node;
s.heap[1] = node++;
pqdownheap(s, tree, 1);
@@ -719,11 +668,7 @@ var require_trees = __commonJS({
return Z_BINARY;
}
}
- if (
- s.dyn_ltree[9 * 2] !== 0 ||
- s.dyn_ltree[10 * 2] !== 0 ||
- s.dyn_ltree[13 * 2] !== 0
- ) {
+ if (s.dyn_ltree[9 * 2] !== 0 || s.dyn_ltree[10 * 2] !== 0 || s.dyn_ltree[13 * 2] !== 0) {
return Z_TEXT;
}
for (n = 32; n < LITERALS; n++) {
@@ -780,12 +725,7 @@ var require_trees = __commonJS({
compress_block(s, static_ltree, static_dtree);
} else {
send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);
- send_all_trees(
- s,
- s.l_desc.max_code + 1,
- s.d_desc.max_code + 1,
- max_blindex + 1,
- );
+ send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);
compress_block(s, s.dyn_ltree, s.dyn_dtree);
}
init_block(s);
@@ -963,13 +903,7 @@ var require_deflate = __commonJS({
if (len === 0) {
return;
}
- utils.arraySet(
- strm.output,
- s.pending_buf,
- s.pending_out,
- len,
- strm.next_out,
- );
+ utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
strm.next_out += len;
s.pending_out += len;
strm.total_out += len;
@@ -980,12 +914,7 @@ var require_deflate = __commonJS({
}
}
function flush_block_only(s, last) {
- trees._tr_flush_block(
- s,
- s.block_start >= 0 ? s.block_start : -1,
- s.strstart - s.block_start,
- last,
- );
+ trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last);
s.block_start = s.strstart;
flush_pending(s.strm);
}
@@ -1022,10 +951,7 @@ var require_deflate = __commonJS({
var len;
var best_len = s.prev_length;
var nice_match = s.nice_match;
- var limit =
- s.strstart > s.w_size - MIN_LOOKAHEAD
- ? s.strstart - (s.w_size - MIN_LOOKAHEAD)
- : 0;
+ var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0;
var _win = s.window;
var wmask = s.w_mask;
var prev = s.prev;
@@ -1072,10 +998,7 @@ var require_deflate = __commonJS({
scan_end1 = _win[scan + best_len - 1];
scan_end = _win[scan + best_len];
}
- } while (
- (cur_match = prev[cur_match & wmask]) > limit &&
- --chain_length !== 0
- );
+ } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);
if (best_len <= s.lookahead) {
return best_len;
}
@@ -1113,12 +1036,9 @@ var require_deflate = __commonJS({
if (s.lookahead + s.insert >= MIN_MATCH) {
str = s.strstart - s.insert;
s.ins_h = s.window[str];
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;
while (s.insert) {
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) &
- s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
s.prev[str & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = str;
str++;
@@ -1194,33 +1114,21 @@ var require_deflate = __commonJS({
}
hash_head = 0;
if (s.lookahead >= MIN_MATCH) {
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) &
- s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
}
- if (
- hash_head !== 0 &&
- s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD
- ) {
+ if (hash_head !== 0 && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {
s.match_length = longest_match(s, hash_head);
}
if (s.match_length >= MIN_MATCH) {
- bflush = trees._tr_tally(
- s,
- s.strstart - s.match_start,
- s.match_length - MIN_MATCH,
- );
+ bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);
s.lookahead -= s.match_length;
if (s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {
s.match_length--;
do {
s.strstart++;
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^
- s.window[s.strstart + MIN_MATCH - 1]) &
- s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
} while (--s.match_length !== 0);
@@ -1229,9 +1137,7 @@ var require_deflate = __commonJS({
s.strstart += s.match_length;
s.match_length = 0;
s.ins_h = s.window[s.strstart];
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) &
- s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;
}
} else {
bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
@@ -1277,45 +1183,30 @@ var require_deflate = __commonJS({
}
hash_head = 0;
if (s.lookahead >= MIN_MATCH) {
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) &
- s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
}
s.prev_length = s.match_length;
s.prev_match = s.match_start;
s.match_length = MIN_MATCH - 1;
- if (
- hash_head !== 0 &&
- s.prev_length < s.max_lazy_match &&
- s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD
- ) {
+ if (hash_head !== 0 && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {
s.match_length = longest_match(s, hash_head);
if (
s.match_length <= 5 &&
- (s.strategy === Z_FILTERED ||
- (s.match_length === MIN_MATCH &&
- s.strstart - s.match_start > 4096))
+ (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096))
) {
s.match_length = MIN_MATCH - 1;
}
}
if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
max_insert = s.strstart + s.lookahead - MIN_MATCH;
- bflush = trees._tr_tally(
- s,
- s.strstart - 1 - s.prev_match,
- s.prev_length - MIN_MATCH,
- );
+ bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);
s.lookahead -= s.prev_length - 1;
s.prev_length -= 2;
do {
if (++s.strstart <= max_insert) {
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^
- s.window[s.strstart + MIN_MATCH - 1]) &
- s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;
hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = s.strstart;
}
@@ -1384,11 +1275,7 @@ var require_deflate = __commonJS({
if (s.lookahead >= MIN_MATCH && s.strstart > 0) {
scan = s.strstart - 1;
prev = _win[scan];
- if (
- prev === _win[++scan] &&
- prev === _win[++scan] &&
- prev === _win[++scan]
- ) {
+ if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
strend = s.strstart + MAX_MATCH;
do {} while (
prev === _win[++scan] &&
@@ -1672,14 +1559,7 @@ var require_deflate = __commonJS({
return deflateReset(strm);
}
function deflateInit(strm, level) {
- return deflateInit2(
- strm,
- level,
- Z_DEFLATED,
- MAX_WBITS,
- DEF_MEM_LEVEL,
- Z_DEFAULT_STRATEGY,
- );
+ return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
}
function deflate(strm, flush) {
var old_flush, s;
@@ -1688,11 +1568,7 @@ var require_deflate = __commonJS({
return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
}
s = strm.state;
- if (
- !strm.output ||
- (!strm.input && strm.avail_in !== 0) ||
- (s.status === FINISH_STATE && flush !== Z_FINISH)
- ) {
+ if (!strm.output || (!strm.input && strm.avail_in !== 0) || (s.status === FINISH_STATE && flush !== Z_FINISH)) {
return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR);
}
s.strm = strm;
@@ -1710,14 +1586,7 @@ var require_deflate = __commonJS({
put_byte(s, 0);
put_byte(s, 0);
put_byte(s, 0);
- put_byte(
- s,
- s.level === 9
- ? 2
- : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2
- ? 4
- : 0,
- );
+ put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
put_byte(s, OS_CODE);
s.status = BUSY_STATE;
} else {
@@ -1733,14 +1602,7 @@ var require_deflate = __commonJS({
put_byte(s, (s.gzhead.time >> 8) & 255);
put_byte(s, (s.gzhead.time >> 16) & 255);
put_byte(s, (s.gzhead.time >> 24) & 255);
- put_byte(
- s,
- s.level === 9
- ? 2
- : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2
- ? 4
- : 0,
- );
+ put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);
put_byte(s, s.gzhead.os & 255);
if (s.gzhead.extra && s.gzhead.extra.length) {
put_byte(s, s.gzhead.extra.length & 255);
@@ -1784,12 +1646,7 @@ var require_deflate = __commonJS({
while (s.gzindex < (s.gzhead.extra.length & 65535)) {
if (s.pending === s.pending_buf_size) {
if (s.gzhead.hcrc && s.pending > beg) {
- strm.adler = crc32(
- strm.adler,
- s.pending_buf,
- s.pending - beg,
- beg,
- );
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
flush_pending(strm);
beg = s.pending;
@@ -1817,12 +1674,7 @@ var require_deflate = __commonJS({
do {
if (s.pending === s.pending_buf_size) {
if (s.gzhead.hcrc && s.pending > beg) {
- strm.adler = crc32(
- strm.adler,
- s.pending_buf,
- s.pending - beg,
- beg,
- );
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
flush_pending(strm);
beg = s.pending;
@@ -1855,12 +1707,7 @@ var require_deflate = __commonJS({
do {
if (s.pending === s.pending_buf_size) {
if (s.gzhead.hcrc && s.pending > beg) {
- strm.adler = crc32(
- strm.adler,
- s.pending_buf,
- s.pending - beg,
- beg,
- );
+ strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
flush_pending(strm);
beg = s.pending;
@@ -1907,21 +1754,13 @@ var require_deflate = __commonJS({
s.last_flush = -1;
return Z_OK;
}
- } else if (
- strm.avail_in === 0 &&
- rank(flush) <= rank(old_flush) &&
- flush !== Z_FINISH
- ) {
+ } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) {
return err(strm, Z_BUF_ERROR);
}
if (s.status === FINISH_STATE && strm.avail_in !== 0) {
return err(strm, Z_BUF_ERROR);
}
- if (
- strm.avail_in !== 0 ||
- s.lookahead !== 0 ||
- (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)
- ) {
+ if (strm.avail_in !== 0 || s.lookahead !== 0 || (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {
var bstate =
s.strategy === Z_HUFFMAN_ONLY
? deflate_huff(s, flush)
@@ -2017,11 +1856,7 @@ var require_deflate = __commonJS({
}
s = strm.state;
wrap = s.wrap;
- if (
- wrap === 2 ||
- (wrap === 1 && s.status !== INIT_STATE) ||
- s.lookahead
- ) {
+ if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {
return Z_STREAM_ERROR;
}
if (wrap === 1) {
@@ -2051,9 +1886,7 @@ var require_deflate = __commonJS({
str = s.strstart;
n = s.lookahead - (MIN_MATCH - 1);
do {
- s.ins_h =
- ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) &
- s.hash_mask;
+ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;
s.prev[str & s.w_mask] = s.head[s.ins_h];
s.head[s.ins_h] = str;
str++;
@@ -2324,31 +2157,22 @@ var require_inftrees = __commonJS({
var LENS = 1;
var DISTS = 2;
var lbase = [
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
- 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258,
+ 0, 0,
];
var lext = [
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19,
- 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78,
+ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21,
+ 16, 72, 78,
];
var dbase = [
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513,
- 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0,
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+ 8193, 12289, 16385, 24577, 0, 0,
];
var dext = [
- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23,
- 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64,
+ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28,
+ 29, 29, 64, 64,
];
- module2.exports = function inflate_table(
- type,
- lens,
- lens_index,
- codes,
- table,
- table_index,
- work,
- opts,
- ) {
+ module2.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {
var bits = opts.bits;
var len = 0;
var sym = 0;
@@ -2445,10 +2269,7 @@ var require_inftrees = __commonJS({
low = -1;
used = 1 << root;
mask = used - 1;
- if (
- (type === LENS && used > ENOUGH_LENS) ||
- (type === DISTS && used > ENOUGH_DISTS)
- ) {
+ if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) {
return 1;
}
for (;;) {
@@ -2468,8 +2289,7 @@ var require_inftrees = __commonJS({
min = fill;
do {
fill -= incr;
- table[next + (huff >> drop) + fill] =
- (here_bits << 24) | (here_op << 16) | here_val | 0;
+ table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val | 0;
} while (fill !== 0);
incr = 1 << (len - 1);
while (huff & incr) {
@@ -2504,10 +2324,7 @@ var require_inftrees = __commonJS({
left <<= 1;
}
used += 1 << curr;
- if (
- (type === LENS && used > ENOUGH_LENS) ||
- (type === DISTS && used > ENOUGH_DISTS)
- ) {
+ if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) {
return 1;
}
low = huff & mask;
@@ -2583,12 +2400,7 @@ var require_inflate = __commonJS({
var MAX_WBITS = 15;
var DEF_WBITS = MAX_WBITS;
function zswap32(q) {
- return (
- ((q >>> 24) & 255) +
- ((q >>> 8) & 65280) +
- ((q & 65280) << 8) +
- ((q & 255) << 24)
- );
+ return ((q >>> 24) & 255) + ((q >>> 8) & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
}
function InflateState() {
this.mode = 0;
@@ -2800,15 +2612,8 @@ var require_inflate = __commonJS({
var hbuf = new utils.Buf8(4);
var opts;
var n;
- var order = [
- 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15,
- ];
- if (
- !strm ||
- !strm.state ||
- !strm.output ||
- (!strm.input && strm.avail_in !== 0)
- ) {
+ var order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
+ if (!strm || !strm.state || !strm.output || (!strm.input && strm.avail_in !== 0)) {
return Z_STREAM_ERROR;
}
state = strm.state;
@@ -3243,16 +3048,7 @@ var require_inflate = __commonJS({
state.lencode = state.lendyn;
state.lenbits = 7;
opts = { bits: state.lenbits };
- ret = inflate_table(
- CODES,
- state.lens,
- 0,
- 19,
- state.lencode,
- 0,
- state.work,
- opts,
- );
+ ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
state.lenbits = opts.bits;
if (ret) {
strm.msg = "invalid code lengths set";
@@ -3357,16 +3153,7 @@ var require_inflate = __commonJS({
}
state.lenbits = 9;
opts = { bits: state.lenbits };
- ret = inflate_table(
- LENS,
- state.lens,
- 0,
- state.nlen,
- state.lencode,
- 0,
- state.work,
- opts,
- );
+ ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
state.lenbits = opts.bits;
if (ret) {
strm.msg = "invalid literal/lengths set";
@@ -3376,16 +3163,7 @@ var require_inflate = __commonJS({
state.distbits = 6;
state.distcode = state.distdyn;
opts = { bits: state.distbits };
- ret = inflate_table(
- DISTS,
- state.lens,
- state.nlen,
- state.ndist,
- state.distcode,
- 0,
- state.work,
- opts,
- );
+ ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
state.distbits = opts.bits;
if (ret) {
strm.msg = "invalid distances set";
@@ -3441,11 +3219,7 @@ var require_inflate = __commonJS({
last_op = here_op;
last_val = here_val;
for (;;) {
- here =
- state.lencode[
- last_val +
- ((hold & ((1 << (last_bits + last_op)) - 1)) >> last_bits)
- ];
+ here = state.lencode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1)) >> last_bits)];
here_bits = here >>> 24;
here_op = (here >>> 16) & 255;
here_val = here & 65535;
@@ -3522,11 +3296,7 @@ var require_inflate = __commonJS({
last_op = here_op;
last_val = here_val;
for (;;) {
- here =
- state.distcode[
- last_val +
- ((hold & ((1 << (last_bits + last_op)) - 1)) >> last_bits)
- ];
+ here = state.distcode[last_val + ((hold & ((1 << (last_bits + last_op)) - 1)) >> last_bits)];
here_bits = here >>> 24;
here_op = (here >>> 16) & 255;
here_val = here & 65535;
@@ -3692,15 +3462,8 @@ var require_inflate = __commonJS({
strm.avail_in = have;
state.hold = hold;
state.bits = bits;
- if (
- state.wsize ||
- (_out !== strm.avail_out &&
- state.mode < BAD &&
- (state.mode < CHECK || flush !== Z_FINISH))
- ) {
- if (
- updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)
- ) {
+ if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH))) {
+ if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
state.mode = MEM;
return Z_MEM_ERROR;
}
@@ -3849,11 +3612,7 @@ var require_binding = __commonJS({
var GZIP_HEADER_ID1 = 31;
var GZIP_HEADER_ID2 = 139;
function Zlib(mode) {
- if (
- typeof mode !== "number" ||
- mode < exports.DEFLATE ||
- mode > exports.UNZIP
- ) {
+ if (typeof mode !== "number" || mode < exports.DEFLATE || mode > exports.UNZIP) {
throw new TypeError("Bad argument");
}
this.dictionary = null;
@@ -3877,11 +3636,7 @@ var require_binding = __commonJS({
this.pending_close = false;
assert(this.init_done, "close before init");
assert(this.mode <= exports.UNZIP);
- if (
- this.mode === exports.DEFLATE ||
- this.mode === exports.GZIP ||
- this.mode === exports.DEFLATERAW
- ) {
+ if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) {
zlib_deflate.deflateEnd(this.strm);
} else if (
this.mode === exports.INFLATE ||
@@ -3894,56 +3649,13 @@ var require_binding = __commonJS({
this.mode = exports.NONE;
this.dictionary = null;
};
- Zlib.prototype.write = function (
- flush,
- input,
- in_off,
- in_len,
- out,
- out_off,
- out_len,
- ) {
- return this._write(
- true,
- flush,
- input,
- in_off,
- in_len,
- out,
- out_off,
- out_len,
- );
+ Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) {
+ return this._write(true, flush, input, in_off, in_len, out, out_off, out_len);
};
- Zlib.prototype.writeSync = function (
- flush,
- input,
- in_off,
- in_len,
- out,
- out_off,
- out_len,
- ) {
- return this._write(
- false,
- flush,
- input,
- in_off,
- in_len,
- out,
- out_off,
- out_len,
- );
+ Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) {
+ return this._write(false, flush, input, in_off, in_len, out, out_off, out_len);
};
- Zlib.prototype._write = function (
- async,
- flush,
- input,
- in_off,
- in_len,
- out,
- out_off,
- out_len,
- ) {
+ Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) {
assert.equal(arguments.length, 8);
assert(this.init_done, "write before init");
assert(this.mode !== exports.NONE, "already finalized");
@@ -4011,9 +3723,7 @@ var require_binding = __commonJS({
if (next_expected_header_byte === null) {
break;
}
- if (
- this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1
- ) {
+ if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) {
this.gzip_id_bytes_read = 1;
next_expected_header_byte++;
if (this.strm.avail_in === 1) {
@@ -4027,9 +3737,7 @@ var require_binding = __commonJS({
if (next_expected_header_byte === null) {
break;
}
- if (
- this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2
- ) {
+ if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) {
this.gzip_id_bytes_read = 2;
this.mode = exports.GUNZIP;
} else {
@@ -4044,10 +3752,7 @@ var require_binding = __commonJS({
case exports.INFLATERAW:
this.err = zlib_inflate.inflate(this.strm, this.flush);
if (this.err === exports.Z_NEED_DICT && this.dictionary) {
- this.err = zlib_inflate.inflateSetDictionary(
- this.strm,
- this.dictionary,
- );
+ this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary);
if (this.err === exports.Z_OK) {
this.err = zlib_inflate.inflate(this.strm, this.flush);
} else if (this.err === exports.Z_DATA_ERROR) {
@@ -4114,13 +3819,7 @@ var require_binding = __commonJS({
this.close();
}
};
- Zlib.prototype.init = function (
- windowBits,
- level,
- memLevel,
- strategy,
- dictionary,
- ) {
+ Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) {
assert(
arguments.length === 4 || arguments.length === 5,
"init(windowBits, level, memLevel, strategy, [dictionary])",
@@ -4146,13 +3845,7 @@ var require_binding = __commonJS({
this._reset();
this._setDictionary();
};
- Zlib.prototype._init = function (
- level,
- windowBits,
- memLevel,
- strategy,
- dictionary,
- ) {
+ Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) {
this.level = level;
this.windowBits = windowBits;
this.memLevel = memLevel;
@@ -4165,10 +3858,7 @@ var require_binding = __commonJS({
if (this.mode === exports.UNZIP) {
this.windowBits += 32;
}
- if (
- this.mode === exports.DEFLATERAW ||
- this.mode === exports.INFLATERAW
- ) {
+ if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) {
this.windowBits = -1 * this.windowBits;
}
this.strm = new Zstream();
@@ -4209,10 +3899,7 @@ var require_binding = __commonJS({
switch (this.mode) {
case exports.DEFLATE:
case exports.DEFLATERAW:
- this.err = zlib_deflate.deflateSetDictionary(
- this.strm,
- this.dictionary,
- );
+ this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary);
break;
default:
break;
@@ -4256,9 +3943,7 @@ var require_lib = __commonJS({
var assert = require("assert").ok;
var kMaxLength = require("buffer").kMaxLength;
var kRangeErrorMessage =
- "Cannot create final Buffer. It would be larger than 0x" +
- kMaxLength.toString(16) +
- " bytes";
+ "Cannot create final Buffer. It would be larger than 0x" + kMaxLength.toString(16) + " bytes";
binding.Z_MIN_WINDOWBITS = 8;
binding.Z_MAX_WINDOWBITS = 15;
binding.Z_DEFAULT_WINDOWBITS = 15;
@@ -4440,8 +4125,7 @@ var require_lib = __commonJS({
}
function zlibBufferSync(engine, buffer) {
if (typeof buffer === "string") buffer = Buffer2.from(buffer);
- if (!Buffer2.isBuffer(buffer))
- throw new TypeError("Not a string or buffer");
+ if (!Buffer2.isBuffer(buffer)) throw new TypeError("Not a string or buffer");
var flushFlag = engine._finishFlushFlag;
return engine._processChunk(buffer, flushFlag);
}
@@ -4495,39 +4179,24 @@ var require_lib = __commonJS({
throw new Error("Invalid flush flag: " + opts.finishFlush);
}
this._flushFlag = opts.flush || binding.Z_NO_FLUSH;
- this._finishFlushFlag =
- typeof opts.finishFlush !== "undefined"
- ? opts.finishFlush
- : binding.Z_FINISH;
+ this._finishFlushFlag = typeof opts.finishFlush !== "undefined" ? opts.finishFlush : binding.Z_FINISH;
if (opts.chunkSize) {
- if (
- opts.chunkSize < exports.Z_MIN_CHUNK ||
- opts.chunkSize > exports.Z_MAX_CHUNK
- ) {
+ if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) {
throw new Error("Invalid chunk size: " + opts.chunkSize);
}
}
if (opts.windowBits) {
- if (
- opts.windowBits < exports.Z_MIN_WINDOWBITS ||
- opts.windowBits > exports.Z_MAX_WINDOWBITS
- ) {
+ if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) {
throw new Error("Invalid windowBits: " + opts.windowBits);
}
}
if (opts.level) {
- if (
- opts.level < exports.Z_MIN_LEVEL ||
- opts.level > exports.Z_MAX_LEVEL
- ) {
+ if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) {
throw new Error("Invalid compression level: " + opts.level);
}
}
if (opts.memLevel) {
- if (
- opts.memLevel < exports.Z_MIN_MEMLEVEL ||
- opts.memLevel > exports.Z_MAX_MEMLEVEL
- ) {
+ if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) {
throw new Error("Invalid memLevel: " + opts.memLevel);
}
}
@@ -4658,8 +4327,7 @@ var require_lib = __commonJS({
var ws = this._writableState;
var ending = ws.ending || ws.ended;
var last = ending && (!chunk || ws.length === chunk.length);
- if (chunk !== null && !Buffer2.isBuffer(chunk))
- return cb(new Error("invalid input"));
+ if (chunk !== null && !Buffer2.isBuffer(chunk)) return cb(new Error("invalid input"));
if (!this._handle) return cb(new Error("zlib binding closed"));
if (last) flushFlag = this._finishFlushFlag;
else {
@@ -4707,15 +4375,7 @@ var require_lib = __commonJS({
return buf;
}
assert(this._handle, "zlib binding closed");
- var req = this._handle.write(
- flushFlag,
- chunk,
- inOff,
- availInBefore,
- this._buffer,
- this._offset,
- availOutBefore,
- );
+ var req = this._handle.write(flushFlag, chunk, inOff, availInBefore, this._buffer, this._offset, availOutBefore);
req.buffer = chunk;
req.callback = callback;
function callback(availInAfter, availOutAfter) {