appwrite-cli 13.3.1 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +2 -2
- package/dist/bundle-win-arm64.mjs +757 -1991
- package/dist/cli.cjs +757 -1991
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +698 -1946
- package/dist/lib/commands/push.d.ts.map +1 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/json.d.ts.map +1 -1
- package/dist/lib/parser.d.ts +1 -1
- package/dist/lib/parser.d.ts.map +1 -1
- package/index.ts +17 -0
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/commands/push.ts +24 -2
- package/lib/commands/services/databases.ts +32 -8
- package/lib/commands/services/projects.ts +6 -4
- package/lib/commands/services/tables-db.ts +32 -8
- package/lib/constants.ts +1 -1
- package/lib/json.ts +10 -2
- package/lib/parser.ts +17 -7
- package/package.json +2 -3
- package/scoop/appwrite.config.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3536,11 +3536,11 @@ var require_assignValue = __commonJS({
|
|
|
3536
3536
|
// node_modules/lodash/_isIndex.js
|
|
3537
3537
|
var require_isIndex = __commonJS({
|
|
3538
3538
|
"node_modules/lodash/_isIndex.js"(exports, module) {
|
|
3539
|
-
var
|
|
3539
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
3540
3540
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
3541
3541
|
function isIndex(value, length) {
|
|
3542
3542
|
var type = typeof value;
|
|
3543
|
-
length = length == null ?
|
|
3543
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
3544
3544
|
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
3545
3545
|
}
|
|
3546
3546
|
module.exports = isIndex;
|
|
@@ -9780,9 +9780,9 @@ var require_distinctUntilKeyChanged = __commonJS({
|
|
|
9780
9780
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9781
9781
|
exports.distinctUntilKeyChanged = void 0;
|
|
9782
9782
|
var distinctUntilChanged_1 = require_distinctUntilChanged();
|
|
9783
|
-
function distinctUntilKeyChanged(key,
|
|
9783
|
+
function distinctUntilKeyChanged(key, compare) {
|
|
9784
9784
|
return distinctUntilChanged_1.distinctUntilChanged(function(x, y) {
|
|
9785
|
-
return
|
|
9785
|
+
return compare ? compare(x[key], y[key]) : x[key] === y[key];
|
|
9786
9786
|
});
|
|
9787
9787
|
}
|
|
9788
9788
|
exports.distinctUntilKeyChanged = distinctUntilKeyChanged;
|
|
@@ -14160,9 +14160,9 @@ var require_baseRest = __commonJS({
|
|
|
14160
14160
|
// node_modules/lodash/isLength.js
|
|
14161
14161
|
var require_isLength = __commonJS({
|
|
14162
14162
|
"node_modules/lodash/isLength.js"(exports, module) {
|
|
14163
|
-
var
|
|
14163
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
14164
14164
|
function isLength(value) {
|
|
14165
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <=
|
|
14165
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
14166
14166
|
}
|
|
14167
14167
|
module.exports = isLength;
|
|
14168
14168
|
}
|
|
@@ -15323,10 +15323,10 @@ var require_clone = __commonJS({
|
|
|
15323
15323
|
"node_modules/lodash/clone.js"(exports, module) {
|
|
15324
15324
|
var baseClone = require_baseClone();
|
|
15325
15325
|
var CLONE_SYMBOLS_FLAG = 4;
|
|
15326
|
-
function
|
|
15326
|
+
function clone2(value) {
|
|
15327
15327
|
return baseClone(value, CLONE_SYMBOLS_FLAG);
|
|
15328
15328
|
}
|
|
15329
|
-
module.exports =
|
|
15329
|
+
module.exports = clone2;
|
|
15330
15330
|
}
|
|
15331
15331
|
});
|
|
15332
15332
|
|
|
@@ -18152,9 +18152,9 @@ var require_log_symbols = __commonJS({
|
|
|
18152
18152
|
// node_modules/clone/clone.js
|
|
18153
18153
|
var require_clone2 = __commonJS({
|
|
18154
18154
|
"node_modules/clone/clone.js"(exports, module) {
|
|
18155
|
-
var
|
|
18155
|
+
var clone2 = (function() {
|
|
18156
18156
|
"use strict";
|
|
18157
|
-
function
|
|
18157
|
+
function clone3(parent, circular, depth, prototype) {
|
|
18158
18158
|
var filter;
|
|
18159
18159
|
if (typeof circular === "object") {
|
|
18160
18160
|
depth = circular.depth;
|
|
@@ -18179,12 +18179,12 @@ var require_clone2 = __commonJS({
|
|
|
18179
18179
|
if (typeof parent2 != "object") {
|
|
18180
18180
|
return parent2;
|
|
18181
18181
|
}
|
|
18182
|
-
if (
|
|
18182
|
+
if (clone3.__isArray(parent2)) {
|
|
18183
18183
|
child = [];
|
|
18184
|
-
} else if (
|
|
18184
|
+
} else if (clone3.__isRegExp(parent2)) {
|
|
18185
18185
|
child = new RegExp(parent2.source, __getRegExpFlags(parent2));
|
|
18186
18186
|
if (parent2.lastIndex) child.lastIndex = parent2.lastIndex;
|
|
18187
|
-
} else if (
|
|
18187
|
+
} else if (clone3.__isDate(parent2)) {
|
|
18188
18188
|
child = new Date(parent2.getTime());
|
|
18189
18189
|
} else if (useBuffer && Buffer.isBuffer(parent2)) {
|
|
18190
18190
|
if (Buffer.allocUnsafe) {
|
|
@@ -18225,7 +18225,7 @@ var require_clone2 = __commonJS({
|
|
|
18225
18225
|
}
|
|
18226
18226
|
return _clone(parent, depth);
|
|
18227
18227
|
}
|
|
18228
|
-
|
|
18228
|
+
clone3.clonePrototype = function clonePrototype(parent) {
|
|
18229
18229
|
if (parent === null)
|
|
18230
18230
|
return null;
|
|
18231
18231
|
var c = function() {
|
|
@@ -18237,22 +18237,22 @@ var require_clone2 = __commonJS({
|
|
|
18237
18237
|
return Object.prototype.toString.call(o);
|
|
18238
18238
|
}
|
|
18239
18239
|
;
|
|
18240
|
-
|
|
18240
|
+
clone3.__objToStr = __objToStr;
|
|
18241
18241
|
function __isDate(o) {
|
|
18242
18242
|
return typeof o === "object" && __objToStr(o) === "[object Date]";
|
|
18243
18243
|
}
|
|
18244
18244
|
;
|
|
18245
|
-
|
|
18245
|
+
clone3.__isDate = __isDate;
|
|
18246
18246
|
function __isArray(o) {
|
|
18247
18247
|
return typeof o === "object" && __objToStr(o) === "[object Array]";
|
|
18248
18248
|
}
|
|
18249
18249
|
;
|
|
18250
|
-
|
|
18250
|
+
clone3.__isArray = __isArray;
|
|
18251
18251
|
function __isRegExp(o) {
|
|
18252
18252
|
return typeof o === "object" && __objToStr(o) === "[object RegExp]";
|
|
18253
18253
|
}
|
|
18254
18254
|
;
|
|
18255
|
-
|
|
18255
|
+
clone3.__isRegExp = __isRegExp;
|
|
18256
18256
|
function __getRegExpFlags(re) {
|
|
18257
18257
|
var flags = "";
|
|
18258
18258
|
if (re.global) flags += "g";
|
|
@@ -18261,11 +18261,11 @@ var require_clone2 = __commonJS({
|
|
|
18261
18261
|
return flags;
|
|
18262
18262
|
}
|
|
18263
18263
|
;
|
|
18264
|
-
|
|
18265
|
-
return
|
|
18264
|
+
clone3.__getRegExpFlags = __getRegExpFlags;
|
|
18265
|
+
return clone3;
|
|
18266
18266
|
})();
|
|
18267
18267
|
if (typeof module === "object" && module.exports) {
|
|
18268
|
-
module.exports =
|
|
18268
|
+
module.exports = clone2;
|
|
18269
18269
|
}
|
|
18270
18270
|
}
|
|
18271
18271
|
});
|
|
@@ -18273,12 +18273,12 @@ var require_clone2 = __commonJS({
|
|
|
18273
18273
|
// node_modules/defaults/index.js
|
|
18274
18274
|
var require_defaults2 = __commonJS({
|
|
18275
18275
|
"node_modules/defaults/index.js"(exports, module) {
|
|
18276
|
-
var
|
|
18276
|
+
var clone2 = require_clone2();
|
|
18277
18277
|
module.exports = function(options, defaults) {
|
|
18278
18278
|
options = options || {};
|
|
18279
18279
|
Object.keys(defaults).forEach(function(key) {
|
|
18280
18280
|
if (typeof options[key] === "undefined") {
|
|
18281
|
-
options[key] =
|
|
18281
|
+
options[key] = clone2(defaults[key]);
|
|
18282
18282
|
}
|
|
18283
18283
|
});
|
|
18284
18284
|
return options;
|
|
@@ -45678,10 +45678,10 @@ var require_mock_utils = __commonJS({
|
|
|
45678
45678
|
}
|
|
45679
45679
|
}
|
|
45680
45680
|
function buildHeadersFromArray(headers) {
|
|
45681
|
-
const
|
|
45681
|
+
const clone2 = headers.slice();
|
|
45682
45682
|
const entries = [];
|
|
45683
|
-
for (let index = 0; index <
|
|
45684
|
-
entries.push([
|
|
45683
|
+
for (let index = 0; index < clone2.length; index += 2) {
|
|
45684
|
+
entries.push([clone2[index], clone2[index + 1]]);
|
|
45685
45685
|
}
|
|
45686
45686
|
return Object.fromEntries(entries);
|
|
45687
45687
|
}
|
|
@@ -52608,14 +52608,14 @@ var require_undici = __commonJS({
|
|
|
52608
52608
|
}
|
|
52609
52609
|
});
|
|
52610
52610
|
|
|
52611
|
-
// node_modules/bignumber.js/bignumber.js
|
|
52611
|
+
// node_modules/json-bigint/node_modules/bignumber.js/bignumber.js
|
|
52612
52612
|
var require_bignumber = __commonJS({
|
|
52613
|
-
"node_modules/bignumber.js/bignumber.js"(exports, module) {
|
|
52613
|
+
"node_modules/json-bigint/node_modules/bignumber.js/bignumber.js"(exports, module) {
|
|
52614
52614
|
(function(globalObject) {
|
|
52615
52615
|
"use strict";
|
|
52616
|
-
var
|
|
52617
|
-
function
|
|
52618
|
-
var div, convertBase, parseNumeric, P =
|
|
52616
|
+
var BigNumber2, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
|
|
52617
|
+
function clone2(configObject) {
|
|
52618
|
+
var div, convertBase, parseNumeric, P = BigNumber3.prototype = { constructor: BigNumber3, toString: null, valueOf: null }, ONE = new BigNumber3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
|
|
52619
52619
|
prefix: "",
|
|
52620
52620
|
groupSize: 3,
|
|
52621
52621
|
secondaryGroupSize: 0,
|
|
@@ -52626,9 +52626,9 @@ var require_bignumber = __commonJS({
|
|
|
52626
52626
|
// non-breaking space
|
|
52627
52627
|
suffix: ""
|
|
52628
52628
|
}, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
|
|
52629
|
-
function
|
|
52629
|
+
function BigNumber3(v, b) {
|
|
52630
52630
|
var alphabet, c, caseChanged, e, i, isNum, len, str, x = this;
|
|
52631
|
-
if (!(x instanceof
|
|
52631
|
+
if (!(x instanceof BigNumber3)) return new BigNumber3(v, b);
|
|
52632
52632
|
if (b == null) {
|
|
52633
52633
|
if (v && v._isBigNumber === true) {
|
|
52634
52634
|
x.s = v.s;
|
|
@@ -52656,7 +52656,7 @@ var require_bignumber = __commonJS({
|
|
|
52656
52656
|
}
|
|
52657
52657
|
str = String(v);
|
|
52658
52658
|
} else {
|
|
52659
|
-
if (!
|
|
52659
|
+
if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
|
|
52660
52660
|
x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
|
|
52661
52661
|
}
|
|
52662
52662
|
if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
|
|
@@ -52668,17 +52668,17 @@ var require_bignumber = __commonJS({
|
|
|
52668
52668
|
e = str.length;
|
|
52669
52669
|
}
|
|
52670
52670
|
} else {
|
|
52671
|
-
|
|
52671
|
+
intCheck(b, 2, ALPHABET.length, "Base");
|
|
52672
52672
|
if (b == 10 && alphabetHasNormalDecimalDigits) {
|
|
52673
|
-
x = new
|
|
52673
|
+
x = new BigNumber3(v);
|
|
52674
52674
|
return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
|
|
52675
52675
|
}
|
|
52676
52676
|
str = String(v);
|
|
52677
52677
|
if (isNum = typeof v == "number") {
|
|
52678
52678
|
if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
|
|
52679
52679
|
x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
|
|
52680
|
-
if (
|
|
52681
|
-
throw Error(
|
|
52680
|
+
if (BigNumber3.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
|
|
52681
|
+
throw Error(tooManyDigits + v);
|
|
52682
52682
|
}
|
|
52683
52683
|
} else {
|
|
52684
52684
|
x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
|
|
@@ -52712,8 +52712,8 @@ var require_bignumber = __commonJS({
|
|
|
52712
52712
|
for (len = str.length; str.charCodeAt(--len) === 48; ) ;
|
|
52713
52713
|
if (str = str.slice(i, ++len)) {
|
|
52714
52714
|
len -= i;
|
|
52715
|
-
if (isNum &&
|
|
52716
|
-
throw Error(
|
|
52715
|
+
if (isNum && BigNumber3.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
|
|
52716
|
+
throw Error(tooManyDigits + x.s * v);
|
|
52717
52717
|
}
|
|
52718
52718
|
if ((e = e - i - 1) > MAX_EXP) {
|
|
52719
52719
|
x.c = x.e = null;
|
|
@@ -52722,14 +52722,14 @@ var require_bignumber = __commonJS({
|
|
|
52722
52722
|
} else {
|
|
52723
52723
|
x.e = e;
|
|
52724
52724
|
x.c = [];
|
|
52725
|
-
i = (e + 1) %
|
|
52726
|
-
if (e < 0) i +=
|
|
52725
|
+
i = (e + 1) % LOG_BASE;
|
|
52726
|
+
if (e < 0) i += LOG_BASE;
|
|
52727
52727
|
if (i < len) {
|
|
52728
52728
|
if (i) x.c.push(+str.slice(0, i));
|
|
52729
|
-
for (len -=
|
|
52730
|
-
x.c.push(+str.slice(i, i +=
|
|
52729
|
+
for (len -= LOG_BASE; i < len; ) {
|
|
52730
|
+
x.c.push(+str.slice(i, i += LOG_BASE));
|
|
52731
52731
|
}
|
|
52732
|
-
i =
|
|
52732
|
+
i = LOG_BASE - (str = str.slice(i)).length;
|
|
52733
52733
|
} else {
|
|
52734
52734
|
i -= len;
|
|
52735
52735
|
}
|
|
@@ -52740,56 +52740,56 @@ var require_bignumber = __commonJS({
|
|
|
52740
52740
|
x.c = [x.e = 0];
|
|
52741
52741
|
}
|
|
52742
52742
|
}
|
|
52743
|
-
|
|
52744
|
-
|
|
52745
|
-
|
|
52746
|
-
|
|
52747
|
-
|
|
52748
|
-
|
|
52749
|
-
|
|
52750
|
-
|
|
52751
|
-
|
|
52752
|
-
|
|
52753
|
-
|
|
52754
|
-
|
|
52743
|
+
BigNumber3.clone = clone2;
|
|
52744
|
+
BigNumber3.ROUND_UP = 0;
|
|
52745
|
+
BigNumber3.ROUND_DOWN = 1;
|
|
52746
|
+
BigNumber3.ROUND_CEIL = 2;
|
|
52747
|
+
BigNumber3.ROUND_FLOOR = 3;
|
|
52748
|
+
BigNumber3.ROUND_HALF_UP = 4;
|
|
52749
|
+
BigNumber3.ROUND_HALF_DOWN = 5;
|
|
52750
|
+
BigNumber3.ROUND_HALF_EVEN = 6;
|
|
52751
|
+
BigNumber3.ROUND_HALF_CEIL = 7;
|
|
52752
|
+
BigNumber3.ROUND_HALF_FLOOR = 8;
|
|
52753
|
+
BigNumber3.EUCLID = 9;
|
|
52754
|
+
BigNumber3.config = BigNumber3.set = function(obj) {
|
|
52755
52755
|
var p, v;
|
|
52756
52756
|
if (obj != null) {
|
|
52757
52757
|
if (typeof obj == "object") {
|
|
52758
52758
|
if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) {
|
|
52759
52759
|
v = obj[p];
|
|
52760
|
-
|
|
52760
|
+
intCheck(v, 0, MAX, p);
|
|
52761
52761
|
DECIMAL_PLACES = v;
|
|
52762
52762
|
}
|
|
52763
52763
|
if (obj.hasOwnProperty(p = "ROUNDING_MODE")) {
|
|
52764
52764
|
v = obj[p];
|
|
52765
|
-
|
|
52765
|
+
intCheck(v, 0, 8, p);
|
|
52766
52766
|
ROUNDING_MODE = v;
|
|
52767
52767
|
}
|
|
52768
52768
|
if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) {
|
|
52769
52769
|
v = obj[p];
|
|
52770
52770
|
if (v && v.pop) {
|
|
52771
|
-
|
|
52772
|
-
|
|
52771
|
+
intCheck(v[0], -MAX, 0, p);
|
|
52772
|
+
intCheck(v[1], 0, MAX, p);
|
|
52773
52773
|
TO_EXP_NEG = v[0];
|
|
52774
52774
|
TO_EXP_POS = v[1];
|
|
52775
52775
|
} else {
|
|
52776
|
-
|
|
52776
|
+
intCheck(v, -MAX, MAX, p);
|
|
52777
52777
|
TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
|
|
52778
52778
|
}
|
|
52779
52779
|
}
|
|
52780
52780
|
if (obj.hasOwnProperty(p = "RANGE")) {
|
|
52781
52781
|
v = obj[p];
|
|
52782
52782
|
if (v && v.pop) {
|
|
52783
|
-
|
|
52784
|
-
|
|
52783
|
+
intCheck(v[0], -MAX, -1, p);
|
|
52784
|
+
intCheck(v[1], 1, MAX, p);
|
|
52785
52785
|
MIN_EXP = v[0];
|
|
52786
52786
|
MAX_EXP = v[1];
|
|
52787
52787
|
} else {
|
|
52788
|
-
|
|
52788
|
+
intCheck(v, -MAX, MAX, p);
|
|
52789
52789
|
if (v) {
|
|
52790
52790
|
MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
|
|
52791
52791
|
} else {
|
|
52792
|
-
throw Error(
|
|
52792
|
+
throw Error(bignumberError + p + " cannot be zero: " + v);
|
|
52793
52793
|
}
|
|
52794
52794
|
}
|
|
52795
52795
|
}
|
|
@@ -52801,29 +52801,29 @@ var require_bignumber = __commonJS({
|
|
|
52801
52801
|
CRYPTO = v;
|
|
52802
52802
|
} else {
|
|
52803
52803
|
CRYPTO = !v;
|
|
52804
|
-
throw Error(
|
|
52804
|
+
throw Error(bignumberError + "crypto unavailable");
|
|
52805
52805
|
}
|
|
52806
52806
|
} else {
|
|
52807
52807
|
CRYPTO = v;
|
|
52808
52808
|
}
|
|
52809
52809
|
} else {
|
|
52810
|
-
throw Error(
|
|
52810
|
+
throw Error(bignumberError + p + " not true or false: " + v);
|
|
52811
52811
|
}
|
|
52812
52812
|
}
|
|
52813
52813
|
if (obj.hasOwnProperty(p = "MODULO_MODE")) {
|
|
52814
52814
|
v = obj[p];
|
|
52815
|
-
|
|
52815
|
+
intCheck(v, 0, 9, p);
|
|
52816
52816
|
MODULO_MODE = v;
|
|
52817
52817
|
}
|
|
52818
52818
|
if (obj.hasOwnProperty(p = "POW_PRECISION")) {
|
|
52819
52819
|
v = obj[p];
|
|
52820
|
-
|
|
52820
|
+
intCheck(v, 0, MAX, p);
|
|
52821
52821
|
POW_PRECISION = v;
|
|
52822
52822
|
}
|
|
52823
52823
|
if (obj.hasOwnProperty(p = "FORMAT")) {
|
|
52824
52824
|
v = obj[p];
|
|
52825
52825
|
if (typeof v == "object") FORMAT = v;
|
|
52826
|
-
else throw Error(
|
|
52826
|
+
else throw Error(bignumberError + p + " not an object: " + v);
|
|
52827
52827
|
}
|
|
52828
52828
|
if (obj.hasOwnProperty(p = "ALPHABET")) {
|
|
52829
52829
|
v = obj[p];
|
|
@@ -52831,11 +52831,11 @@ var require_bignumber = __commonJS({
|
|
|
52831
52831
|
alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789";
|
|
52832
52832
|
ALPHABET = v;
|
|
52833
52833
|
} else {
|
|
52834
|
-
throw Error(
|
|
52834
|
+
throw Error(bignumberError + p + " invalid: " + v);
|
|
52835
52835
|
}
|
|
52836
52836
|
}
|
|
52837
52837
|
} else {
|
|
52838
|
-
throw Error(
|
|
52838
|
+
throw Error(bignumberError + "Object expected: " + obj);
|
|
52839
52839
|
}
|
|
52840
52840
|
}
|
|
52841
52841
|
return {
|
|
@@ -52850,22 +52850,22 @@ var require_bignumber = __commonJS({
|
|
|
52850
52850
|
ALPHABET
|
|
52851
52851
|
};
|
|
52852
52852
|
};
|
|
52853
|
-
|
|
52853
|
+
BigNumber3.isBigNumber = function(v) {
|
|
52854
52854
|
if (!v || v._isBigNumber !== true) return false;
|
|
52855
|
-
if (!
|
|
52855
|
+
if (!BigNumber3.DEBUG) return true;
|
|
52856
52856
|
var i, n, c = v.c, e = v.e, s = v.s;
|
|
52857
52857
|
out: if ({}.toString.call(c) == "[object Array]") {
|
|
52858
|
-
if ((s === 1 || s === -1) && e >= -
|
|
52858
|
+
if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
|
|
52859
52859
|
if (c[0] === 0) {
|
|
52860
52860
|
if (e === 0 && c.length === 1) return true;
|
|
52861
52861
|
break out;
|
|
52862
52862
|
}
|
|
52863
|
-
i = (e + 1) %
|
|
52864
|
-
if (i < 1) i +=
|
|
52863
|
+
i = (e + 1) % LOG_BASE;
|
|
52864
|
+
if (i < 1) i += LOG_BASE;
|
|
52865
52865
|
if (String(c[0]).length == i) {
|
|
52866
52866
|
for (i = 0; i < c.length; i++) {
|
|
52867
52867
|
n = c[i];
|
|
52868
|
-
if (n < 0 || n >=
|
|
52868
|
+
if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
|
|
52869
52869
|
}
|
|
52870
52870
|
if (n !== 0) return true;
|
|
52871
52871
|
}
|
|
@@ -52873,26 +52873,26 @@ var require_bignumber = __commonJS({
|
|
|
52873
52873
|
} else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
|
|
52874
52874
|
return true;
|
|
52875
52875
|
}
|
|
52876
|
-
throw Error(
|
|
52876
|
+
throw Error(bignumberError + "Invalid BigNumber: " + v);
|
|
52877
52877
|
};
|
|
52878
|
-
|
|
52878
|
+
BigNumber3.maximum = BigNumber3.max = function() {
|
|
52879
52879
|
return maxOrMin(arguments, -1);
|
|
52880
52880
|
};
|
|
52881
|
-
|
|
52881
|
+
BigNumber3.minimum = BigNumber3.min = function() {
|
|
52882
52882
|
return maxOrMin(arguments, 1);
|
|
52883
52883
|
};
|
|
52884
|
-
|
|
52884
|
+
BigNumber3.random = (function() {
|
|
52885
52885
|
var pow2_53 = 9007199254740992;
|
|
52886
52886
|
var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
|
|
52887
|
-
return
|
|
52887
|
+
return mathfloor(Math.random() * pow2_53);
|
|
52888
52888
|
} : function() {
|
|
52889
52889
|
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
52890
52890
|
};
|
|
52891
52891
|
return function(dp) {
|
|
52892
|
-
var a, b, e, k, v, i = 0, c = [], rand = new
|
|
52892
|
+
var a, b, e, k, v, i = 0, c = [], rand = new BigNumber3(ONE);
|
|
52893
52893
|
if (dp == null) dp = DECIMAL_PLACES;
|
|
52894
|
-
else
|
|
52895
|
-
k =
|
|
52894
|
+
else intCheck(dp, 0, MAX);
|
|
52895
|
+
k = mathceil(dp / LOG_BASE);
|
|
52896
52896
|
if (CRYPTO) {
|
|
52897
52897
|
if (crypto.getRandomValues) {
|
|
52898
52898
|
a = crypto.getRandomValues(new Uint32Array(k *= 2));
|
|
@@ -52922,7 +52922,7 @@ var require_bignumber = __commonJS({
|
|
|
52922
52922
|
i = k / 7;
|
|
52923
52923
|
} else {
|
|
52924
52924
|
CRYPTO = false;
|
|
52925
|
-
throw Error(
|
|
52925
|
+
throw Error(bignumberError + "crypto unavailable");
|
|
52926
52926
|
}
|
|
52927
52927
|
}
|
|
52928
52928
|
if (!CRYPTO) {
|
|
@@ -52932,26 +52932,26 @@ var require_bignumber = __commonJS({
|
|
|
52932
52932
|
}
|
|
52933
52933
|
}
|
|
52934
52934
|
k = c[--i];
|
|
52935
|
-
dp %=
|
|
52935
|
+
dp %= LOG_BASE;
|
|
52936
52936
|
if (k && dp) {
|
|
52937
|
-
v =
|
|
52938
|
-
c[i] =
|
|
52937
|
+
v = POWS_TEN[LOG_BASE - dp];
|
|
52938
|
+
c[i] = mathfloor(k / v) * v;
|
|
52939
52939
|
}
|
|
52940
52940
|
for (; c[i] === 0; c.pop(), i--) ;
|
|
52941
52941
|
if (i < 0) {
|
|
52942
52942
|
c = [e = 0];
|
|
52943
52943
|
} else {
|
|
52944
|
-
for (e = -1; c[0] === 0; c.splice(0, 1), e -=
|
|
52944
|
+
for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) ;
|
|
52945
52945
|
for (i = 1, v = c[0]; v >= 10; v /= 10, i++) ;
|
|
52946
|
-
if (i <
|
|
52946
|
+
if (i < LOG_BASE) e -= LOG_BASE - i;
|
|
52947
52947
|
}
|
|
52948
52948
|
rand.e = e;
|
|
52949
52949
|
rand.c = c;
|
|
52950
52950
|
return rand;
|
|
52951
52951
|
};
|
|
52952
52952
|
})();
|
|
52953
|
-
|
|
52954
|
-
var i = 1, args = arguments, sum = new
|
|
52953
|
+
BigNumber3.sum = function() {
|
|
52954
|
+
var i = 1, args = arguments, sum = new BigNumber3(args[0]);
|
|
52955
52955
|
for (; i < args.length; ) sum = sum.plus(args[i++]);
|
|
52956
52956
|
return sum;
|
|
52957
52957
|
};
|
|
@@ -52978,11 +52978,11 @@ var require_bignumber = __commonJS({
|
|
|
52978
52978
|
k = POW_PRECISION;
|
|
52979
52979
|
POW_PRECISION = 0;
|
|
52980
52980
|
str = str.replace(".", "");
|
|
52981
|
-
y = new
|
|
52981
|
+
y = new BigNumber3(baseIn);
|
|
52982
52982
|
x = y.pow(str.length - i);
|
|
52983
52983
|
POW_PRECISION = k;
|
|
52984
52984
|
y.c = toBaseOut(
|
|
52985
|
-
|
|
52985
|
+
toFixedPoint(coeffToString(x.c), x.e, "0"),
|
|
52986
52986
|
10,
|
|
52987
52987
|
baseOut,
|
|
52988
52988
|
decimal
|
|
@@ -53010,7 +53010,7 @@ var require_bignumber = __commonJS({
|
|
|
53010
53010
|
r = r || d < 0 || xc[d + 1] != null;
|
|
53011
53011
|
r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
|
|
53012
53012
|
if (d < 1 || !xc[0]) {
|
|
53013
|
-
str = r ?
|
|
53013
|
+
str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
|
|
53014
53014
|
} else {
|
|
53015
53015
|
xc.length = d;
|
|
53016
53016
|
if (r) {
|
|
@@ -53024,26 +53024,26 @@ var require_bignumber = __commonJS({
|
|
|
53024
53024
|
}
|
|
53025
53025
|
for (k = xc.length; !xc[--k]; ) ;
|
|
53026
53026
|
for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) ;
|
|
53027
|
-
str =
|
|
53027
|
+
str = toFixedPoint(str, e, alphabet.charAt(0));
|
|
53028
53028
|
}
|
|
53029
53029
|
return str;
|
|
53030
53030
|
};
|
|
53031
53031
|
})();
|
|
53032
53032
|
div = /* @__PURE__ */ (function() {
|
|
53033
53033
|
function multiply(x, k, base) {
|
|
53034
|
-
var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k %
|
|
53034
|
+
var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0;
|
|
53035
53035
|
for (x = x.slice(); i--; ) {
|
|
53036
|
-
xlo = x[i] %
|
|
53037
|
-
xhi = x[i] /
|
|
53036
|
+
xlo = x[i] % SQRT_BASE;
|
|
53037
|
+
xhi = x[i] / SQRT_BASE | 0;
|
|
53038
53038
|
m = khi * xlo + xhi * klo;
|
|
53039
|
-
temp = klo * xlo + m %
|
|
53040
|
-
carry = (temp / base | 0) + (m /
|
|
53039
|
+
temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;
|
|
53040
|
+
carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
|
|
53041
53041
|
x[i] = temp % base;
|
|
53042
53042
|
}
|
|
53043
53043
|
if (carry) x = [carry].concat(x);
|
|
53044
53044
|
return x;
|
|
53045
53045
|
}
|
|
53046
|
-
function
|
|
53046
|
+
function compare2(a, b, aL, bL) {
|
|
53047
53047
|
var i, cmp;
|
|
53048
53048
|
if (aL != bL) {
|
|
53049
53049
|
cmp = aL > bL ? 1 : -1;
|
|
@@ -53069,7 +53069,7 @@ var require_bignumber = __commonJS({
|
|
|
53069
53069
|
return function(x, y, dp, rm, base) {
|
|
53070
53070
|
var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c;
|
|
53071
53071
|
if (!xc || !xc[0] || !yc || !yc[0]) {
|
|
53072
|
-
return new
|
|
53072
|
+
return new BigNumber3(
|
|
53073
53073
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
53074
53074
|
!x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
|
|
53075
53075
|
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
@@ -53077,14 +53077,14 @@ var require_bignumber = __commonJS({
|
|
|
53077
53077
|
)
|
|
53078
53078
|
);
|
|
53079
53079
|
}
|
|
53080
|
-
q = new
|
|
53080
|
+
q = new BigNumber3(s);
|
|
53081
53081
|
qc = q.c = [];
|
|
53082
53082
|
e = x.e - y.e;
|
|
53083
53083
|
s = dp + e + 1;
|
|
53084
53084
|
if (!base) {
|
|
53085
|
-
base =
|
|
53086
|
-
e =
|
|
53087
|
-
s = s /
|
|
53085
|
+
base = BASE;
|
|
53086
|
+
e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
|
|
53087
|
+
s = s / LOG_BASE | 0;
|
|
53088
53088
|
}
|
|
53089
53089
|
for (i = 0; yc[i] == (xc[i] || 0); i++) ;
|
|
53090
53090
|
if (yc[i] > (xc[i] || 0)) e--;
|
|
@@ -53096,7 +53096,7 @@ var require_bignumber = __commonJS({
|
|
|
53096
53096
|
yL = yc.length;
|
|
53097
53097
|
i = 0;
|
|
53098
53098
|
s += 2;
|
|
53099
|
-
n =
|
|
53099
|
+
n = mathfloor(base / (yc[0] + 1));
|
|
53100
53100
|
if (n > 1) {
|
|
53101
53101
|
yc = multiply(yc, n, base);
|
|
53102
53102
|
xc = multiply(xc, n, base);
|
|
@@ -53113,17 +53113,17 @@ var require_bignumber = __commonJS({
|
|
|
53113
53113
|
if (yc[1] >= base / 2) yc0++;
|
|
53114
53114
|
do {
|
|
53115
53115
|
n = 0;
|
|
53116
|
-
cmp =
|
|
53116
|
+
cmp = compare2(yc, rem, yL, remL);
|
|
53117
53117
|
if (cmp < 0) {
|
|
53118
53118
|
rem0 = rem[0];
|
|
53119
53119
|
if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
|
|
53120
|
-
n =
|
|
53120
|
+
n = mathfloor(rem0 / yc0);
|
|
53121
53121
|
if (n > 1) {
|
|
53122
53122
|
if (n >= base) n = base - 1;
|
|
53123
53123
|
prod = multiply(yc, n, base);
|
|
53124
53124
|
prodL = prod.length;
|
|
53125
53125
|
remL = rem.length;
|
|
53126
|
-
while (
|
|
53126
|
+
while (compare2(prod, rem, prodL, remL) == 1) {
|
|
53127
53127
|
n--;
|
|
53128
53128
|
subtract(prod, yL < prodL ? yz : yc, prodL, base);
|
|
53129
53129
|
prodL = prod.length;
|
|
@@ -53140,7 +53140,7 @@ var require_bignumber = __commonJS({
|
|
|
53140
53140
|
subtract(rem, prod, remL, base);
|
|
53141
53141
|
remL = rem.length;
|
|
53142
53142
|
if (cmp == -1) {
|
|
53143
|
-
while (
|
|
53143
|
+
while (compare2(yc, rem, yL, remL) < 1) {
|
|
53144
53144
|
n++;
|
|
53145
53145
|
subtract(rem, yL < remL ? yz : yc, remL, base);
|
|
53146
53146
|
remL = rem.length;
|
|
@@ -53161,9 +53161,9 @@ var require_bignumber = __commonJS({
|
|
|
53161
53161
|
more = rem[0] != null;
|
|
53162
53162
|
if (!qc[0]) qc.splice(0, 1);
|
|
53163
53163
|
}
|
|
53164
|
-
if (base ==
|
|
53164
|
+
if (base == BASE) {
|
|
53165
53165
|
for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) ;
|
|
53166
|
-
round(q, dp + (q.e = i + e *
|
|
53166
|
+
round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
|
|
53167
53167
|
} else {
|
|
53168
53168
|
q.e = e;
|
|
53169
53169
|
q.r = +more;
|
|
@@ -53174,24 +53174,24 @@ var require_bignumber = __commonJS({
|
|
|
53174
53174
|
function format(n, i, rm, id) {
|
|
53175
53175
|
var c0, e, ne, len, str;
|
|
53176
53176
|
if (rm == null) rm = ROUNDING_MODE;
|
|
53177
|
-
else
|
|
53177
|
+
else intCheck(rm, 0, 8);
|
|
53178
53178
|
if (!n.c) return n.toString();
|
|
53179
53179
|
c0 = n.c[0];
|
|
53180
53180
|
ne = n.e;
|
|
53181
53181
|
if (i == null) {
|
|
53182
|
-
str =
|
|
53183
|
-
str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ?
|
|
53182
|
+
str = coeffToString(n.c);
|
|
53183
|
+
str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
|
|
53184
53184
|
} else {
|
|
53185
|
-
n = round(new
|
|
53185
|
+
n = round(new BigNumber3(n), i, rm);
|
|
53186
53186
|
e = n.e;
|
|
53187
|
-
str =
|
|
53187
|
+
str = coeffToString(n.c);
|
|
53188
53188
|
len = str.length;
|
|
53189
53189
|
if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
|
|
53190
53190
|
for (; len < i; str += "0", len++) ;
|
|
53191
|
-
str =
|
|
53191
|
+
str = toExponential(str, e);
|
|
53192
53192
|
} else {
|
|
53193
53193
|
i -= ne + (id === 2 && e > ne);
|
|
53194
|
-
str =
|
|
53194
|
+
str = toFixedPoint(str, e, "0");
|
|
53195
53195
|
if (e + 1 > len) {
|
|
53196
53196
|
if (--i > 0) for (str += "."; i--; str += "0") ;
|
|
53197
53197
|
} else {
|
|
@@ -53206,10 +53206,10 @@ var require_bignumber = __commonJS({
|
|
|
53206
53206
|
return n.s < 0 && c0 ? "-" + str : str;
|
|
53207
53207
|
}
|
|
53208
53208
|
function maxOrMin(args, n) {
|
|
53209
|
-
var k, y, i = 1, x = new
|
|
53209
|
+
var k, y, i = 1, x = new BigNumber3(args[0]);
|
|
53210
53210
|
for (; i < args.length; i++) {
|
|
53211
|
-
y = new
|
|
53212
|
-
if (!y.s || (k =
|
|
53211
|
+
y = new BigNumber3(args[i]);
|
|
53212
|
+
if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) {
|
|
53213
53213
|
x = y;
|
|
53214
53214
|
}
|
|
53215
53215
|
}
|
|
@@ -53219,7 +53219,7 @@ var require_bignumber = __commonJS({
|
|
|
53219
53219
|
var i = 1, j = c.length;
|
|
53220
53220
|
for (; !c[--j]; c.pop()) ;
|
|
53221
53221
|
for (j = c[0]; j >= 10; j /= 10, i++) ;
|
|
53222
|
-
if ((e = i + e *
|
|
53222
|
+
if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
|
|
53223
53223
|
n.c = n.e = null;
|
|
53224
53224
|
} else if (e < MIN_EXP) {
|
|
53225
53225
|
n.c = [n.e = 0];
|
|
@@ -53245,10 +53245,10 @@ var require_bignumber = __commonJS({
|
|
|
53245
53245
|
base = b;
|
|
53246
53246
|
s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
|
|
53247
53247
|
}
|
|
53248
|
-
if (str != s) return new
|
|
53248
|
+
if (str != s) return new BigNumber3(s, base);
|
|
53249
53249
|
}
|
|
53250
|
-
if (
|
|
53251
|
-
throw Error(
|
|
53250
|
+
if (BigNumber3.DEBUG) {
|
|
53251
|
+
throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str);
|
|
53252
53252
|
}
|
|
53253
53253
|
x.s = null;
|
|
53254
53254
|
}
|
|
@@ -53256,34 +53256,34 @@ var require_bignumber = __commonJS({
|
|
|
53256
53256
|
};
|
|
53257
53257
|
})();
|
|
53258
53258
|
function round(x, sd, rm, r) {
|
|
53259
|
-
var d, i, j, k, n, ni, rd, xc = x.c, pows10 =
|
|
53259
|
+
var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
|
|
53260
53260
|
if (xc) {
|
|
53261
53261
|
out: {
|
|
53262
53262
|
for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) ;
|
|
53263
53263
|
i = sd - d;
|
|
53264
53264
|
if (i < 0) {
|
|
53265
|
-
i +=
|
|
53265
|
+
i += LOG_BASE;
|
|
53266
53266
|
j = sd;
|
|
53267
53267
|
n = xc[ni = 0];
|
|
53268
|
-
rd =
|
|
53268
|
+
rd = mathfloor(n / pows10[d - j - 1] % 10);
|
|
53269
53269
|
} else {
|
|
53270
|
-
ni =
|
|
53270
|
+
ni = mathceil((i + 1) / LOG_BASE);
|
|
53271
53271
|
if (ni >= xc.length) {
|
|
53272
53272
|
if (r) {
|
|
53273
53273
|
for (; xc.length <= ni; xc.push(0)) ;
|
|
53274
53274
|
n = rd = 0;
|
|
53275
53275
|
d = 1;
|
|
53276
|
-
i %=
|
|
53277
|
-
j = i -
|
|
53276
|
+
i %= LOG_BASE;
|
|
53277
|
+
j = i - LOG_BASE + 1;
|
|
53278
53278
|
} else {
|
|
53279
53279
|
break out;
|
|
53280
53280
|
}
|
|
53281
53281
|
} else {
|
|
53282
53282
|
n = k = xc[ni];
|
|
53283
53283
|
for (d = 1; k >= 10; k /= 10, d++) ;
|
|
53284
|
-
i %=
|
|
53285
|
-
j = i -
|
|
53286
|
-
rd = j < 0 ? 0 :
|
|
53284
|
+
i %= LOG_BASE;
|
|
53285
|
+
j = i - LOG_BASE + d;
|
|
53286
|
+
rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10);
|
|
53287
53287
|
}
|
|
53288
53288
|
}
|
|
53289
53289
|
r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?
|
|
@@ -53296,7 +53296,7 @@ var require_bignumber = __commonJS({
|
|
|
53296
53296
|
xc.length = 0;
|
|
53297
53297
|
if (r) {
|
|
53298
53298
|
sd -= x.e + 1;
|
|
53299
|
-
xc[0] = pows10[(
|
|
53299
|
+
xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
|
|
53300
53300
|
x.e = -sd || 0;
|
|
53301
53301
|
} else {
|
|
53302
53302
|
xc[0] = x.e = 0;
|
|
@@ -53309,8 +53309,8 @@ var require_bignumber = __commonJS({
|
|
|
53309
53309
|
ni--;
|
|
53310
53310
|
} else {
|
|
53311
53311
|
xc.length = ni + 1;
|
|
53312
|
-
k = pows10[
|
|
53313
|
-
xc[ni] = j > 0 ?
|
|
53312
|
+
k = pows10[LOG_BASE - i];
|
|
53313
|
+
xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
|
|
53314
53314
|
}
|
|
53315
53315
|
if (r) {
|
|
53316
53316
|
for (; ; ) {
|
|
@@ -53320,12 +53320,12 @@ var require_bignumber = __commonJS({
|
|
|
53320
53320
|
for (k = 1; j >= 10; j /= 10, k++) ;
|
|
53321
53321
|
if (i != k) {
|
|
53322
53322
|
x.e++;
|
|
53323
|
-
if (xc[0] ==
|
|
53323
|
+
if (xc[0] == BASE) xc[0] = 1;
|
|
53324
53324
|
}
|
|
53325
53325
|
break;
|
|
53326
53326
|
} else {
|
|
53327
53327
|
xc[ni] += k;
|
|
53328
|
-
if (xc[ni] !=
|
|
53328
|
+
if (xc[ni] != BASE) break;
|
|
53329
53329
|
xc[ni--] = 0;
|
|
53330
53330
|
k = 1;
|
|
53331
53331
|
}
|
|
@@ -53344,71 +53344,71 @@ var require_bignumber = __commonJS({
|
|
|
53344
53344
|
function valueOf(n) {
|
|
53345
53345
|
var str, e = n.e;
|
|
53346
53346
|
if (e === null) return n.toString();
|
|
53347
|
-
str =
|
|
53348
|
-
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ?
|
|
53347
|
+
str = coeffToString(n.c);
|
|
53348
|
+
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0");
|
|
53349
53349
|
return n.s < 0 ? "-" + str : str;
|
|
53350
53350
|
}
|
|
53351
53351
|
P.absoluteValue = P.abs = function() {
|
|
53352
|
-
var x = new
|
|
53352
|
+
var x = new BigNumber3(this);
|
|
53353
53353
|
if (x.s < 0) x.s = 1;
|
|
53354
53354
|
return x;
|
|
53355
53355
|
};
|
|
53356
53356
|
P.comparedTo = function(y, b) {
|
|
53357
|
-
return
|
|
53357
|
+
return compare(this, new BigNumber3(y, b));
|
|
53358
53358
|
};
|
|
53359
53359
|
P.decimalPlaces = P.dp = function(dp, rm) {
|
|
53360
53360
|
var c, n, v, x = this;
|
|
53361
53361
|
if (dp != null) {
|
|
53362
|
-
|
|
53362
|
+
intCheck(dp, 0, MAX);
|
|
53363
53363
|
if (rm == null) rm = ROUNDING_MODE;
|
|
53364
|
-
else
|
|
53365
|
-
return round(new
|
|
53364
|
+
else intCheck(rm, 0, 8);
|
|
53365
|
+
return round(new BigNumber3(x), dp + x.e + 1, rm);
|
|
53366
53366
|
}
|
|
53367
53367
|
if (!(c = x.c)) return null;
|
|
53368
|
-
n = ((v = c.length - 1) -
|
|
53368
|
+
n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
|
|
53369
53369
|
if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) ;
|
|
53370
53370
|
if (n < 0) n = 0;
|
|
53371
53371
|
return n;
|
|
53372
53372
|
};
|
|
53373
53373
|
P.dividedBy = P.div = function(y, b) {
|
|
53374
|
-
return div(this, new
|
|
53374
|
+
return div(this, new BigNumber3(y, b), DECIMAL_PLACES, ROUNDING_MODE);
|
|
53375
53375
|
};
|
|
53376
53376
|
P.dividedToIntegerBy = P.idiv = function(y, b) {
|
|
53377
|
-
return div(this, new
|
|
53377
|
+
return div(this, new BigNumber3(y, b), 0, 1);
|
|
53378
53378
|
};
|
|
53379
53379
|
P.exponentiatedBy = P.pow = function(n, m) {
|
|
53380
53380
|
var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this;
|
|
53381
|
-
n = new
|
|
53381
|
+
n = new BigNumber3(n);
|
|
53382
53382
|
if (n.c && !n.isInteger()) {
|
|
53383
|
-
throw Error(
|
|
53383
|
+
throw Error(bignumberError + "Exponent not an integer: " + valueOf(n));
|
|
53384
53384
|
}
|
|
53385
|
-
if (m != null) m = new
|
|
53385
|
+
if (m != null) m = new BigNumber3(m);
|
|
53386
53386
|
nIsBig = n.e > 14;
|
|
53387
53387
|
if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
|
|
53388
|
-
y = new
|
|
53388
|
+
y = new BigNumber3(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));
|
|
53389
53389
|
return m ? y.mod(m) : y;
|
|
53390
53390
|
}
|
|
53391
53391
|
nIsNeg = n.s < 0;
|
|
53392
53392
|
if (m) {
|
|
53393
|
-
if (m.c ? !m.c[0] : !m.s) return new
|
|
53393
|
+
if (m.c ? !m.c[0] : !m.s) return new BigNumber3(NaN);
|
|
53394
53394
|
isModExp = !nIsNeg && x.isInteger() && m.isInteger();
|
|
53395
53395
|
if (isModExp) x = x.mod(m);
|
|
53396
53396
|
} else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
|
|
53397
|
-
k = x.s < 0 &&
|
|
53397
|
+
k = x.s < 0 && isOdd(n) ? -0 : 0;
|
|
53398
53398
|
if (x.e > -1) k = 1 / k;
|
|
53399
|
-
return new
|
|
53399
|
+
return new BigNumber3(nIsNeg ? 1 / k : k);
|
|
53400
53400
|
} else if (POW_PRECISION) {
|
|
53401
|
-
k =
|
|
53401
|
+
k = mathceil(POW_PRECISION / LOG_BASE + 2);
|
|
53402
53402
|
}
|
|
53403
53403
|
if (nIsBig) {
|
|
53404
|
-
half = new
|
|
53404
|
+
half = new BigNumber3(0.5);
|
|
53405
53405
|
if (nIsNeg) n.s = 1;
|
|
53406
|
-
nIsOdd =
|
|
53406
|
+
nIsOdd = isOdd(n);
|
|
53407
53407
|
} else {
|
|
53408
53408
|
i = Math.abs(+valueOf(n));
|
|
53409
53409
|
nIsOdd = i % 2;
|
|
53410
53410
|
}
|
|
53411
|
-
y = new
|
|
53411
|
+
y = new BigNumber3(ONE);
|
|
53412
53412
|
for (; ; ) {
|
|
53413
53413
|
if (nIsOdd) {
|
|
53414
53414
|
y = y.times(x);
|
|
@@ -53420,14 +53420,14 @@ var require_bignumber = __commonJS({
|
|
|
53420
53420
|
}
|
|
53421
53421
|
}
|
|
53422
53422
|
if (i) {
|
|
53423
|
-
i =
|
|
53423
|
+
i = mathfloor(i / 2);
|
|
53424
53424
|
if (i === 0) break;
|
|
53425
53425
|
nIsOdd = i % 2;
|
|
53426
53426
|
} else {
|
|
53427
53427
|
n = n.times(half);
|
|
53428
53428
|
round(n, n.e + 1, 1);
|
|
53429
53429
|
if (n.e > 14) {
|
|
53430
|
-
nIsOdd =
|
|
53430
|
+
nIsOdd = isOdd(n);
|
|
53431
53431
|
} else {
|
|
53432
53432
|
i = +valueOf(n);
|
|
53433
53433
|
if (i === 0) break;
|
|
@@ -53446,31 +53446,31 @@ var require_bignumber = __commonJS({
|
|
|
53446
53446
|
return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
|
|
53447
53447
|
};
|
|
53448
53448
|
P.integerValue = function(rm) {
|
|
53449
|
-
var n = new
|
|
53449
|
+
var n = new BigNumber3(this);
|
|
53450
53450
|
if (rm == null) rm = ROUNDING_MODE;
|
|
53451
|
-
else
|
|
53451
|
+
else intCheck(rm, 0, 8);
|
|
53452
53452
|
return round(n, n.e + 1, rm);
|
|
53453
53453
|
};
|
|
53454
53454
|
P.isEqualTo = P.eq = function(y, b) {
|
|
53455
|
-
return
|
|
53455
|
+
return compare(this, new BigNumber3(y, b)) === 0;
|
|
53456
53456
|
};
|
|
53457
53457
|
P.isFinite = function() {
|
|
53458
53458
|
return !!this.c;
|
|
53459
53459
|
};
|
|
53460
53460
|
P.isGreaterThan = P.gt = function(y, b) {
|
|
53461
|
-
return
|
|
53461
|
+
return compare(this, new BigNumber3(y, b)) > 0;
|
|
53462
53462
|
};
|
|
53463
53463
|
P.isGreaterThanOrEqualTo = P.gte = function(y, b) {
|
|
53464
|
-
return (b =
|
|
53464
|
+
return (b = compare(this, new BigNumber3(y, b))) === 1 || b === 0;
|
|
53465
53465
|
};
|
|
53466
53466
|
P.isInteger = function() {
|
|
53467
|
-
return !!this.c &&
|
|
53467
|
+
return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
|
|
53468
53468
|
};
|
|
53469
53469
|
P.isLessThan = P.lt = function(y, b) {
|
|
53470
|
-
return
|
|
53470
|
+
return compare(this, new BigNumber3(y, b)) < 0;
|
|
53471
53471
|
};
|
|
53472
53472
|
P.isLessThanOrEqualTo = P.lte = function(y, b) {
|
|
53473
|
-
return (b =
|
|
53473
|
+
return (b = compare(this, new BigNumber3(y, b))) === -1 || b === 0;
|
|
53474
53474
|
};
|
|
53475
53475
|
P.isNaN = function() {
|
|
53476
53476
|
return !this.s;
|
|
@@ -53486,25 +53486,25 @@ var require_bignumber = __commonJS({
|
|
|
53486
53486
|
};
|
|
53487
53487
|
P.minus = function(y, b) {
|
|
53488
53488
|
var i, j, t, xLTy, x = this, a = x.s;
|
|
53489
|
-
y = new
|
|
53489
|
+
y = new BigNumber3(y, b);
|
|
53490
53490
|
b = y.s;
|
|
53491
|
-
if (!a || !b) return new
|
|
53491
|
+
if (!a || !b) return new BigNumber3(NaN);
|
|
53492
53492
|
if (a != b) {
|
|
53493
53493
|
y.s = -b;
|
|
53494
53494
|
return x.plus(y);
|
|
53495
53495
|
}
|
|
53496
|
-
var xe = x.e /
|
|
53496
|
+
var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
|
|
53497
53497
|
if (!xe || !ye) {
|
|
53498
|
-
if (!xc || !yc) return xc ? (y.s = -b, y) : new
|
|
53498
|
+
if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber3(yc ? x : NaN);
|
|
53499
53499
|
if (!xc[0] || !yc[0]) {
|
|
53500
|
-
return yc[0] ? (y.s = -b, y) : new
|
|
53500
|
+
return yc[0] ? (y.s = -b, y) : new BigNumber3(xc[0] ? x : (
|
|
53501
53501
|
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
53502
53502
|
ROUNDING_MODE == 3 ? -0 : 0
|
|
53503
53503
|
));
|
|
53504
53504
|
}
|
|
53505
53505
|
}
|
|
53506
|
-
xe =
|
|
53507
|
-
ye =
|
|
53506
|
+
xe = bitFloor(xe);
|
|
53507
|
+
ye = bitFloor(ye);
|
|
53508
53508
|
xc = xc.slice();
|
|
53509
53509
|
if (a = xe - ye) {
|
|
53510
53510
|
if (xLTy = a < 0) {
|
|
@@ -53534,12 +53534,12 @@ var require_bignumber = __commonJS({
|
|
|
53534
53534
|
}
|
|
53535
53535
|
b = (j = yc.length) - (i = xc.length);
|
|
53536
53536
|
if (b > 0) for (; b--; xc[i++] = 0) ;
|
|
53537
|
-
b =
|
|
53537
|
+
b = BASE - 1;
|
|
53538
53538
|
for (; j > a; ) {
|
|
53539
53539
|
if (xc[--j] < yc[j]) {
|
|
53540
53540
|
for (i = j; i && !xc[--i]; xc[i] = b) ;
|
|
53541
53541
|
--xc[i];
|
|
53542
|
-
xc[j] +=
|
|
53542
|
+
xc[j] += BASE;
|
|
53543
53543
|
}
|
|
53544
53544
|
xc[j] -= yc[j];
|
|
53545
53545
|
}
|
|
@@ -53553,11 +53553,11 @@ var require_bignumber = __commonJS({
|
|
|
53553
53553
|
};
|
|
53554
53554
|
P.modulo = P.mod = function(y, b) {
|
|
53555
53555
|
var q, s, x = this;
|
|
53556
|
-
y = new
|
|
53556
|
+
y = new BigNumber3(y, b);
|
|
53557
53557
|
if (!x.c || !y.s || y.c && !y.c[0]) {
|
|
53558
|
-
return new
|
|
53558
|
+
return new BigNumber3(NaN);
|
|
53559
53559
|
} else if (!y.c || x.c && !x.c[0]) {
|
|
53560
|
-
return new
|
|
53560
|
+
return new BigNumber3(x);
|
|
53561
53561
|
}
|
|
53562
53562
|
if (MODULO_MODE == 9) {
|
|
53563
53563
|
s = y.s;
|
|
@@ -53573,7 +53573,7 @@ var require_bignumber = __commonJS({
|
|
|
53573
53573
|
return y;
|
|
53574
53574
|
};
|
|
53575
53575
|
P.multipliedBy = P.times = function(y, b) {
|
|
53576
|
-
var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new
|
|
53576
|
+
var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber3(y, b)).c;
|
|
53577
53577
|
if (!xc || !yc || !xc[0] || !yc[0]) {
|
|
53578
53578
|
if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
|
|
53579
53579
|
y.c = y.e = y.s = null;
|
|
@@ -53588,7 +53588,7 @@ var require_bignumber = __commonJS({
|
|
|
53588
53588
|
}
|
|
53589
53589
|
return y;
|
|
53590
53590
|
}
|
|
53591
|
-
e =
|
|
53591
|
+
e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
|
|
53592
53592
|
y.s *= x.s;
|
|
53593
53593
|
xcL = xc.length;
|
|
53594
53594
|
ycL = yc.length;
|
|
@@ -53601,8 +53601,8 @@ var require_bignumber = __commonJS({
|
|
|
53601
53601
|
ycL = i;
|
|
53602
53602
|
}
|
|
53603
53603
|
for (i = xcL + ycL, zc = []; i--; zc.push(0)) ;
|
|
53604
|
-
base =
|
|
53605
|
-
sqrtBase =
|
|
53604
|
+
base = BASE;
|
|
53605
|
+
sqrtBase = SQRT_BASE;
|
|
53606
53606
|
for (i = ycL; --i >= 0; ) {
|
|
53607
53607
|
c = 0;
|
|
53608
53608
|
ylo = yc[i] % sqrtBase;
|
|
@@ -53625,26 +53625,26 @@ var require_bignumber = __commonJS({
|
|
|
53625
53625
|
return normalise(y, zc, e);
|
|
53626
53626
|
};
|
|
53627
53627
|
P.negated = function() {
|
|
53628
|
-
var x = new
|
|
53628
|
+
var x = new BigNumber3(this);
|
|
53629
53629
|
x.s = -x.s || null;
|
|
53630
53630
|
return x;
|
|
53631
53631
|
};
|
|
53632
53632
|
P.plus = function(y, b) {
|
|
53633
53633
|
var t, x = this, a = x.s;
|
|
53634
|
-
y = new
|
|
53634
|
+
y = new BigNumber3(y, b);
|
|
53635
53635
|
b = y.s;
|
|
53636
|
-
if (!a || !b) return new
|
|
53636
|
+
if (!a || !b) return new BigNumber3(NaN);
|
|
53637
53637
|
if (a != b) {
|
|
53638
53638
|
y.s = -b;
|
|
53639
53639
|
return x.minus(y);
|
|
53640
53640
|
}
|
|
53641
|
-
var xe = x.e /
|
|
53641
|
+
var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
|
|
53642
53642
|
if (!xe || !ye) {
|
|
53643
|
-
if (!xc || !yc) return new
|
|
53644
|
-
if (!xc[0] || !yc[0]) return yc[0] ? y : new
|
|
53643
|
+
if (!xc || !yc) return new BigNumber3(a / 0);
|
|
53644
|
+
if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber3(xc[0] ? x : a * 0);
|
|
53645
53645
|
}
|
|
53646
|
-
xe =
|
|
53647
|
-
ye =
|
|
53646
|
+
xe = bitFloor(xe);
|
|
53647
|
+
ye = bitFloor(ye);
|
|
53648
53648
|
xc = xc.slice();
|
|
53649
53649
|
if (a = xe - ye) {
|
|
53650
53650
|
if (a > 0) {
|
|
@@ -53667,8 +53667,8 @@ var require_bignumber = __commonJS({
|
|
|
53667
53667
|
b = a;
|
|
53668
53668
|
}
|
|
53669
53669
|
for (a = 0; b; ) {
|
|
53670
|
-
a = (xc[--b] = xc[b] + yc[b] + a) /
|
|
53671
|
-
xc[b] =
|
|
53670
|
+
a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
|
|
53671
|
+
xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
|
|
53672
53672
|
}
|
|
53673
53673
|
if (a) {
|
|
53674
53674
|
xc = [a].concat(xc);
|
|
@@ -53679,14 +53679,14 @@ var require_bignumber = __commonJS({
|
|
|
53679
53679
|
P.precision = P.sd = function(sd, rm) {
|
|
53680
53680
|
var c, n, v, x = this;
|
|
53681
53681
|
if (sd != null && sd !== !!sd) {
|
|
53682
|
-
|
|
53682
|
+
intCheck(sd, 1, MAX);
|
|
53683
53683
|
if (rm == null) rm = ROUNDING_MODE;
|
|
53684
|
-
else
|
|
53685
|
-
return round(new
|
|
53684
|
+
else intCheck(rm, 0, 8);
|
|
53685
|
+
return round(new BigNumber3(x), sd, rm);
|
|
53686
53686
|
}
|
|
53687
53687
|
if (!(c = x.c)) return null;
|
|
53688
53688
|
v = c.length - 1;
|
|
53689
|
-
n = v *
|
|
53689
|
+
n = v * LOG_BASE + 1;
|
|
53690
53690
|
if (v = c[v]) {
|
|
53691
53691
|
for (; v % 10 == 0; v /= 10, n--) ;
|
|
53692
53692
|
for (v = c[0]; v >= 10; v /= 10, n++) ;
|
|
@@ -53695,29 +53695,29 @@ var require_bignumber = __commonJS({
|
|
|
53695
53695
|
return n;
|
|
53696
53696
|
};
|
|
53697
53697
|
P.shiftedBy = function(k) {
|
|
53698
|
-
|
|
53698
|
+
intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
|
53699
53699
|
return this.times("1e" + k);
|
|
53700
53700
|
};
|
|
53701
53701
|
P.squareRoot = P.sqrt = function() {
|
|
53702
|
-
var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new
|
|
53702
|
+
var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber3("0.5");
|
|
53703
53703
|
if (s !== 1 || !c || !c[0]) {
|
|
53704
|
-
return new
|
|
53704
|
+
return new BigNumber3(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
|
|
53705
53705
|
}
|
|
53706
53706
|
s = Math.sqrt(+valueOf(x));
|
|
53707
53707
|
if (s == 0 || s == 1 / 0) {
|
|
53708
|
-
n =
|
|
53708
|
+
n = coeffToString(c);
|
|
53709
53709
|
if ((n.length + e) % 2 == 0) n += "0";
|
|
53710
53710
|
s = Math.sqrt(+n);
|
|
53711
|
-
e =
|
|
53711
|
+
e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
|
|
53712
53712
|
if (s == 1 / 0) {
|
|
53713
53713
|
n = "5e" + e;
|
|
53714
53714
|
} else {
|
|
53715
53715
|
n = s.toExponential();
|
|
53716
53716
|
n = n.slice(0, n.indexOf("e") + 1) + e;
|
|
53717
53717
|
}
|
|
53718
|
-
r = new
|
|
53718
|
+
r = new BigNumber3(n);
|
|
53719
53719
|
} else {
|
|
53720
|
-
r = new
|
|
53720
|
+
r = new BigNumber3(s + "");
|
|
53721
53721
|
}
|
|
53722
53722
|
if (r.c[0]) {
|
|
53723
53723
|
e = r.e;
|
|
@@ -53726,7 +53726,7 @@ var require_bignumber = __commonJS({
|
|
|
53726
53726
|
for (; ; ) {
|
|
53727
53727
|
t = r;
|
|
53728
53728
|
r = half.times(t.plus(div(x, t, dp, 1)));
|
|
53729
|
-
if (
|
|
53729
|
+
if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
|
|
53730
53730
|
if (r.e < e) --s;
|
|
53731
53731
|
n = n.slice(s - 3, s + 1);
|
|
53732
53732
|
if (n == "9999" || !rep && n == "4999") {
|
|
@@ -53754,14 +53754,14 @@ var require_bignumber = __commonJS({
|
|
|
53754
53754
|
};
|
|
53755
53755
|
P.toExponential = function(dp, rm) {
|
|
53756
53756
|
if (dp != null) {
|
|
53757
|
-
|
|
53757
|
+
intCheck(dp, 0, MAX);
|
|
53758
53758
|
dp++;
|
|
53759
53759
|
}
|
|
53760
53760
|
return format(this, dp, rm, 1);
|
|
53761
53761
|
};
|
|
53762
53762
|
P.toFixed = function(dp, rm) {
|
|
53763
53763
|
if (dp != null) {
|
|
53764
|
-
|
|
53764
|
+
intCheck(dp, 0, MAX);
|
|
53765
53765
|
dp = dp + this.e + 1;
|
|
53766
53766
|
}
|
|
53767
53767
|
return format(this, dp, rm);
|
|
@@ -53779,7 +53779,7 @@ var require_bignumber = __commonJS({
|
|
|
53779
53779
|
format2 = FORMAT;
|
|
53780
53780
|
}
|
|
53781
53781
|
} else if (typeof format2 != "object") {
|
|
53782
|
-
throw Error(
|
|
53782
|
+
throw Error(bignumberError + "Argument not an object: " + format2);
|
|
53783
53783
|
}
|
|
53784
53784
|
str = x.toFixed(dp, rm);
|
|
53785
53785
|
if (x.c) {
|
|
@@ -53807,22 +53807,22 @@ var require_bignumber = __commonJS({
|
|
|
53807
53807
|
P.toFraction = function(md) {
|
|
53808
53808
|
var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c;
|
|
53809
53809
|
if (md != null) {
|
|
53810
|
-
n = new
|
|
53810
|
+
n = new BigNumber3(md);
|
|
53811
53811
|
if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
|
|
53812
|
-
throw Error(
|
|
53812
|
+
throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n));
|
|
53813
53813
|
}
|
|
53814
53814
|
}
|
|
53815
|
-
if (!xc) return new
|
|
53816
|
-
d = new
|
|
53817
|
-
n1 = d0 = new
|
|
53818
|
-
d1 = n0 = new
|
|
53819
|
-
s =
|
|
53815
|
+
if (!xc) return new BigNumber3(x);
|
|
53816
|
+
d = new BigNumber3(ONE);
|
|
53817
|
+
n1 = d0 = new BigNumber3(ONE);
|
|
53818
|
+
d1 = n0 = new BigNumber3(ONE);
|
|
53819
|
+
s = coeffToString(xc);
|
|
53820
53820
|
e = d.e = s.length - x.e - 1;
|
|
53821
|
-
d.c[0] =
|
|
53821
|
+
d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
|
|
53822
53822
|
md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;
|
|
53823
53823
|
exp = MAX_EXP;
|
|
53824
53824
|
MAX_EXP = 1 / 0;
|
|
53825
|
-
n = new
|
|
53825
|
+
n = new BigNumber3(s);
|
|
53826
53826
|
n0.c[0] = 0;
|
|
53827
53827
|
for (; ; ) {
|
|
53828
53828
|
q = div(n, d, 0, 1);
|
|
@@ -53850,7 +53850,7 @@ var require_bignumber = __commonJS({
|
|
|
53850
53850
|
return +valueOf(this);
|
|
53851
53851
|
};
|
|
53852
53852
|
P.toPrecision = function(sd, rm) {
|
|
53853
|
-
if (sd != null)
|
|
53853
|
+
if (sd != null) intCheck(sd, 1, MAX);
|
|
53854
53854
|
return format(this, sd, rm, 2);
|
|
53855
53855
|
};
|
|
53856
53856
|
P.toString = function(b) {
|
|
@@ -53864,13 +53864,13 @@ var require_bignumber = __commonJS({
|
|
|
53864
53864
|
}
|
|
53865
53865
|
} else {
|
|
53866
53866
|
if (b == null) {
|
|
53867
|
-
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ?
|
|
53867
|
+
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0");
|
|
53868
53868
|
} else if (b === 10 && alphabetHasNormalDecimalDigits) {
|
|
53869
|
-
n = round(new
|
|
53870
|
-
str =
|
|
53869
|
+
n = round(new BigNumber3(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
|
|
53870
|
+
str = toFixedPoint(coeffToString(n.c), n.e, "0");
|
|
53871
53871
|
} else {
|
|
53872
|
-
|
|
53873
|
-
str = convertBase(
|
|
53872
|
+
intCheck(b, 2, ALPHABET.length, "Base");
|
|
53873
|
+
str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true);
|
|
53874
53874
|
}
|
|
53875
53875
|
if (s < 0 && n.c[0]) str = "-" + str;
|
|
53876
53876
|
}
|
|
@@ -53880,25 +53880,25 @@ var require_bignumber = __commonJS({
|
|
|
53880
53880
|
return valueOf(this);
|
|
53881
53881
|
};
|
|
53882
53882
|
P._isBigNumber = true;
|
|
53883
|
-
if (configObject != null)
|
|
53884
|
-
return
|
|
53883
|
+
if (configObject != null) BigNumber3.set(configObject);
|
|
53884
|
+
return BigNumber3;
|
|
53885
53885
|
}
|
|
53886
|
-
function
|
|
53886
|
+
function bitFloor(n) {
|
|
53887
53887
|
var i = n | 0;
|
|
53888
53888
|
return n > 0 || n === i ? i : i - 1;
|
|
53889
53889
|
}
|
|
53890
|
-
function
|
|
53890
|
+
function coeffToString(a) {
|
|
53891
53891
|
var s, z3, i = 1, j = a.length, r = a[0] + "";
|
|
53892
53892
|
for (; i < j; ) {
|
|
53893
53893
|
s = a[i++] + "";
|
|
53894
|
-
z3 =
|
|
53894
|
+
z3 = LOG_BASE - s.length;
|
|
53895
53895
|
for (; z3--; s = "0" + s) ;
|
|
53896
53896
|
r += s;
|
|
53897
53897
|
}
|
|
53898
53898
|
for (j = r.length; r.charCodeAt(--j) === 48; ) ;
|
|
53899
53899
|
return r.slice(0, j + 1 || 1);
|
|
53900
53900
|
}
|
|
53901
|
-
function
|
|
53901
|
+
function compare(x, y) {
|
|
53902
53902
|
var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e;
|
|
53903
53903
|
if (!i || !j) return null;
|
|
53904
53904
|
a = xc && !xc[0];
|
|
@@ -53913,19 +53913,19 @@ var require_bignumber = __commonJS({
|
|
|
53913
53913
|
for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
|
|
53914
53914
|
return k == l ? 0 : k > l ^ a ? 1 : -1;
|
|
53915
53915
|
}
|
|
53916
|
-
function
|
|
53917
|
-
if (n < min || n > max || n !==
|
|
53918
|
-
throw Error(
|
|
53916
|
+
function intCheck(n, min, max, name) {
|
|
53917
|
+
if (n < min || n > max || n !== mathfloor(n)) {
|
|
53918
|
+
throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
|
|
53919
53919
|
}
|
|
53920
53920
|
}
|
|
53921
|
-
function
|
|
53921
|
+
function isOdd(n) {
|
|
53922
53922
|
var k = n.c.length - 1;
|
|
53923
|
-
return
|
|
53923
|
+
return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
|
|
53924
53924
|
}
|
|
53925
|
-
function
|
|
53925
|
+
function toExponential(str, e) {
|
|
53926
53926
|
return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e;
|
|
53927
53927
|
}
|
|
53928
|
-
function
|
|
53928
|
+
function toFixedPoint(str, e, z3) {
|
|
53929
53929
|
var len, zs;
|
|
53930
53930
|
if (e < 0) {
|
|
53931
53931
|
for (zs = z3 + "."; ++e; zs += z3) ;
|
|
@@ -53941,19 +53941,19 @@ var require_bignumber = __commonJS({
|
|
|
53941
53941
|
}
|
|
53942
53942
|
return str;
|
|
53943
53943
|
}
|
|
53944
|
-
|
|
53945
|
-
|
|
53944
|
+
BigNumber2 = clone2();
|
|
53945
|
+
BigNumber2["default"] = BigNumber2.BigNumber = BigNumber2;
|
|
53946
53946
|
if (typeof define == "function" && define.amd) {
|
|
53947
53947
|
define(function() {
|
|
53948
|
-
return
|
|
53948
|
+
return BigNumber2;
|
|
53949
53949
|
});
|
|
53950
53950
|
} else if (typeof module != "undefined" && module.exports) {
|
|
53951
|
-
module.exports =
|
|
53951
|
+
module.exports = BigNumber2;
|
|
53952
53952
|
} else {
|
|
53953
53953
|
if (!globalObject) {
|
|
53954
53954
|
globalObject = typeof self != "undefined" && self ? self : window;
|
|
53955
53955
|
}
|
|
53956
|
-
globalObject.BigNumber =
|
|
53956
|
+
globalObject.BigNumber = BigNumber2;
|
|
53957
53957
|
}
|
|
53958
53958
|
})(exports);
|
|
53959
53959
|
}
|
|
@@ -53962,7 +53962,7 @@ var require_bignumber = __commonJS({
|
|
|
53962
53962
|
// node_modules/json-bigint/lib/stringify.js
|
|
53963
53963
|
var require_stringify = __commonJS({
|
|
53964
53964
|
"node_modules/json-bigint/lib/stringify.js"(exports, module) {
|
|
53965
|
-
var
|
|
53965
|
+
var BigNumber2 = require_bignumber();
|
|
53966
53966
|
var JSON2 = module.exports;
|
|
53967
53967
|
(function() {
|
|
53968
53968
|
"use strict";
|
|
@@ -53987,7 +53987,7 @@ var require_stringify = __commonJS({
|
|
|
53987
53987
|
}) + '"' : '"' + string4 + '"';
|
|
53988
53988
|
}
|
|
53989
53989
|
function str(key, holder) {
|
|
53990
|
-
var i, k, v, length, mind = gap, partial2, value = holder[key],
|
|
53990
|
+
var i, k, v, length, mind = gap, partial2, value = holder[key], isBigNumber2 = value != null && (value instanceof BigNumber2 || BigNumber2.isBigNumber(value));
|
|
53991
53991
|
if (value && typeof value === "object" && typeof value.toJSON === "function") {
|
|
53992
53992
|
value = value.toJSON(key);
|
|
53993
53993
|
}
|
|
@@ -53996,7 +53996,7 @@ var require_stringify = __commonJS({
|
|
|
53996
53996
|
}
|
|
53997
53997
|
switch (typeof value) {
|
|
53998
53998
|
case "string":
|
|
53999
|
-
if (
|
|
53999
|
+
if (isBigNumber2) {
|
|
54000
54000
|
return value;
|
|
54001
54001
|
} else {
|
|
54002
54002
|
return quote(value);
|
|
@@ -54074,7 +54074,7 @@ var require_stringify = __commonJS({
|
|
|
54074
54074
|
// node_modules/json-bigint/lib/parse.js
|
|
54075
54075
|
var require_parse2 = __commonJS({
|
|
54076
54076
|
"node_modules/json-bigint/lib/parse.js"(exports, module) {
|
|
54077
|
-
var
|
|
54077
|
+
var BigNumber2 = null;
|
|
54078
54078
|
var suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
|
|
54079
54079
|
var suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
|
|
54080
54080
|
var json_parse = function(options) {
|
|
@@ -54174,11 +54174,11 @@ var require_parse2 = __commonJS({
|
|
|
54174
54174
|
if (!isFinite(number5)) {
|
|
54175
54175
|
error49("Bad number");
|
|
54176
54176
|
} else {
|
|
54177
|
-
if (
|
|
54177
|
+
if (BigNumber2 == null) BigNumber2 = require_bignumber();
|
|
54178
54178
|
if (string5.length > 15)
|
|
54179
|
-
return _options.storeAsString ? string5 : _options.useNativeBigInt ? BigInt(string5) : new
|
|
54179
|
+
return _options.storeAsString ? string5 : _options.useNativeBigInt ? BigInt(string5) : new BigNumber2(string5);
|
|
54180
54180
|
else
|
|
54181
|
-
return !_options.alwaysParseAsBig ? number5 : _options.useNativeBigInt ? BigInt(number5) : new
|
|
54181
|
+
return !_options.alwaysParseAsBig ? number5 : _options.useNativeBigInt ? BigInt(number5) : new BigNumber2(number5);
|
|
54182
54182
|
}
|
|
54183
54183
|
}, string4 = function() {
|
|
54184
54184
|
var hex3, i, string5 = "", uffff;
|
|
@@ -61766,14 +61766,14 @@ var require_tar = __commonJS({
|
|
|
61766
61766
|
}
|
|
61767
61767
|
});
|
|
61768
61768
|
|
|
61769
|
-
// node_modules
|
|
61769
|
+
// node_modules/bignumber.js/bignumber.js
|
|
61770
61770
|
var require_bignumber2 = __commonJS({
|
|
61771
|
-
"node_modules
|
|
61771
|
+
"node_modules/bignumber.js/bignumber.js"(exports, module) {
|
|
61772
61772
|
(function(globalObject) {
|
|
61773
61773
|
"use strict";
|
|
61774
|
-
var
|
|
61775
|
-
function
|
|
61776
|
-
var div, convertBase, parseNumeric, P =
|
|
61774
|
+
var BigNumber2, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
|
|
61775
|
+
function clone2(configObject) {
|
|
61776
|
+
var div, convertBase, parseNumeric, P = BigNumber3.prototype = { constructor: BigNumber3, toString: null, valueOf: null }, ONE = new BigNumber3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
|
|
61777
61777
|
prefix: "",
|
|
61778
61778
|
groupSize: 3,
|
|
61779
61779
|
secondaryGroupSize: 0,
|
|
@@ -61784,9 +61784,9 @@ var require_bignumber2 = __commonJS({
|
|
|
61784
61784
|
// non-breaking space
|
|
61785
61785
|
suffix: ""
|
|
61786
61786
|
}, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
61787
|
-
function
|
|
61787
|
+
function BigNumber3(v, b) {
|
|
61788
61788
|
var alphabet, c, caseChanged, e, i, isNum, len, str, x = this;
|
|
61789
|
-
if (!(x instanceof
|
|
61789
|
+
if (!(x instanceof BigNumber3)) return new BigNumber3(v, b);
|
|
61790
61790
|
if (b == null) {
|
|
61791
61791
|
if (v && v._isBigNumber === true) {
|
|
61792
61792
|
x.s = v.s;
|
|
@@ -61814,7 +61814,7 @@ var require_bignumber2 = __commonJS({
|
|
|
61814
61814
|
}
|
|
61815
61815
|
str = String(v);
|
|
61816
61816
|
} else {
|
|
61817
|
-
if (!
|
|
61817
|
+
if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
|
|
61818
61818
|
x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
|
|
61819
61819
|
}
|
|
61820
61820
|
if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
|
|
@@ -61826,17 +61826,17 @@ var require_bignumber2 = __commonJS({
|
|
|
61826
61826
|
e = str.length;
|
|
61827
61827
|
}
|
|
61828
61828
|
} else {
|
|
61829
|
-
|
|
61829
|
+
intCheck(b, 2, ALPHABET.length, "Base");
|
|
61830
61830
|
if (b == 10) {
|
|
61831
|
-
x = new
|
|
61831
|
+
x = new BigNumber3(v);
|
|
61832
61832
|
return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
|
|
61833
61833
|
}
|
|
61834
61834
|
str = String(v);
|
|
61835
61835
|
if (isNum = typeof v == "number") {
|
|
61836
61836
|
if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
|
|
61837
61837
|
x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
|
|
61838
|
-
if (
|
|
61839
|
-
throw Error(
|
|
61838
|
+
if (BigNumber3.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
|
|
61839
|
+
throw Error(tooManyDigits + v);
|
|
61840
61840
|
}
|
|
61841
61841
|
} else {
|
|
61842
61842
|
x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
|
|
@@ -61870,8 +61870,8 @@ var require_bignumber2 = __commonJS({
|
|
|
61870
61870
|
for (len = str.length; str.charCodeAt(--len) === 48; ) ;
|
|
61871
61871
|
if (str = str.slice(i, ++len)) {
|
|
61872
61872
|
len -= i;
|
|
61873
|
-
if (isNum &&
|
|
61874
|
-
throw Error(
|
|
61873
|
+
if (isNum && BigNumber3.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
|
|
61874
|
+
throw Error(tooManyDigits + x.s * v);
|
|
61875
61875
|
}
|
|
61876
61876
|
if ((e = e - i - 1) > MAX_EXP) {
|
|
61877
61877
|
x.c = x.e = null;
|
|
@@ -61880,14 +61880,14 @@ var require_bignumber2 = __commonJS({
|
|
|
61880
61880
|
} else {
|
|
61881
61881
|
x.e = e;
|
|
61882
61882
|
x.c = [];
|
|
61883
|
-
i = (e + 1) %
|
|
61884
|
-
if (e < 0) i +=
|
|
61883
|
+
i = (e + 1) % LOG_BASE;
|
|
61884
|
+
if (e < 0) i += LOG_BASE;
|
|
61885
61885
|
if (i < len) {
|
|
61886
61886
|
if (i) x.c.push(+str.slice(0, i));
|
|
61887
|
-
for (len -=
|
|
61888
|
-
x.c.push(+str.slice(i, i +=
|
|
61887
|
+
for (len -= LOG_BASE; i < len; ) {
|
|
61888
|
+
x.c.push(+str.slice(i, i += LOG_BASE));
|
|
61889
61889
|
}
|
|
61890
|
-
i =
|
|
61890
|
+
i = LOG_BASE - (str = str.slice(i)).length;
|
|
61891
61891
|
} else {
|
|
61892
61892
|
i -= len;
|
|
61893
61893
|
}
|
|
@@ -61898,56 +61898,56 @@ var require_bignumber2 = __commonJS({
|
|
|
61898
61898
|
x.c = [x.e = 0];
|
|
61899
61899
|
}
|
|
61900
61900
|
}
|
|
61901
|
-
|
|
61902
|
-
|
|
61903
|
-
|
|
61904
|
-
|
|
61905
|
-
|
|
61906
|
-
|
|
61907
|
-
|
|
61908
|
-
|
|
61909
|
-
|
|
61910
|
-
|
|
61911
|
-
|
|
61912
|
-
|
|
61901
|
+
BigNumber3.clone = clone2;
|
|
61902
|
+
BigNumber3.ROUND_UP = 0;
|
|
61903
|
+
BigNumber3.ROUND_DOWN = 1;
|
|
61904
|
+
BigNumber3.ROUND_CEIL = 2;
|
|
61905
|
+
BigNumber3.ROUND_FLOOR = 3;
|
|
61906
|
+
BigNumber3.ROUND_HALF_UP = 4;
|
|
61907
|
+
BigNumber3.ROUND_HALF_DOWN = 5;
|
|
61908
|
+
BigNumber3.ROUND_HALF_EVEN = 6;
|
|
61909
|
+
BigNumber3.ROUND_HALF_CEIL = 7;
|
|
61910
|
+
BigNumber3.ROUND_HALF_FLOOR = 8;
|
|
61911
|
+
BigNumber3.EUCLID = 9;
|
|
61912
|
+
BigNumber3.config = BigNumber3.set = function(obj) {
|
|
61913
61913
|
var p, v;
|
|
61914
61914
|
if (obj != null) {
|
|
61915
61915
|
if (typeof obj == "object") {
|
|
61916
61916
|
if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) {
|
|
61917
61917
|
v = obj[p];
|
|
61918
|
-
|
|
61918
|
+
intCheck(v, 0, MAX, p);
|
|
61919
61919
|
DECIMAL_PLACES = v;
|
|
61920
61920
|
}
|
|
61921
61921
|
if (obj.hasOwnProperty(p = "ROUNDING_MODE")) {
|
|
61922
61922
|
v = obj[p];
|
|
61923
|
-
|
|
61923
|
+
intCheck(v, 0, 8, p);
|
|
61924
61924
|
ROUNDING_MODE = v;
|
|
61925
61925
|
}
|
|
61926
61926
|
if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) {
|
|
61927
61927
|
v = obj[p];
|
|
61928
61928
|
if (v && v.pop) {
|
|
61929
|
-
|
|
61930
|
-
|
|
61929
|
+
intCheck(v[0], -MAX, 0, p);
|
|
61930
|
+
intCheck(v[1], 0, MAX, p);
|
|
61931
61931
|
TO_EXP_NEG = v[0];
|
|
61932
61932
|
TO_EXP_POS = v[1];
|
|
61933
61933
|
} else {
|
|
61934
|
-
|
|
61934
|
+
intCheck(v, -MAX, MAX, p);
|
|
61935
61935
|
TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
|
|
61936
61936
|
}
|
|
61937
61937
|
}
|
|
61938
61938
|
if (obj.hasOwnProperty(p = "RANGE")) {
|
|
61939
61939
|
v = obj[p];
|
|
61940
61940
|
if (v && v.pop) {
|
|
61941
|
-
|
|
61942
|
-
|
|
61941
|
+
intCheck(v[0], -MAX, -1, p);
|
|
61942
|
+
intCheck(v[1], 1, MAX, p);
|
|
61943
61943
|
MIN_EXP = v[0];
|
|
61944
61944
|
MAX_EXP = v[1];
|
|
61945
61945
|
} else {
|
|
61946
|
-
|
|
61946
|
+
intCheck(v, -MAX, MAX, p);
|
|
61947
61947
|
if (v) {
|
|
61948
61948
|
MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
|
|
61949
61949
|
} else {
|
|
61950
|
-
throw Error(
|
|
61950
|
+
throw Error(bignumberError + p + " cannot be zero: " + v);
|
|
61951
61951
|
}
|
|
61952
61952
|
}
|
|
61953
61953
|
}
|
|
@@ -61959,40 +61959,40 @@ var require_bignumber2 = __commonJS({
|
|
|
61959
61959
|
CRYPTO = v;
|
|
61960
61960
|
} else {
|
|
61961
61961
|
CRYPTO = !v;
|
|
61962
|
-
throw Error(
|
|
61962
|
+
throw Error(bignumberError + "crypto unavailable");
|
|
61963
61963
|
}
|
|
61964
61964
|
} else {
|
|
61965
61965
|
CRYPTO = v;
|
|
61966
61966
|
}
|
|
61967
61967
|
} else {
|
|
61968
|
-
throw Error(
|
|
61968
|
+
throw Error(bignumberError + p + " not true or false: " + v);
|
|
61969
61969
|
}
|
|
61970
61970
|
}
|
|
61971
61971
|
if (obj.hasOwnProperty(p = "MODULO_MODE")) {
|
|
61972
61972
|
v = obj[p];
|
|
61973
|
-
|
|
61973
|
+
intCheck(v, 0, 9, p);
|
|
61974
61974
|
MODULO_MODE = v;
|
|
61975
61975
|
}
|
|
61976
61976
|
if (obj.hasOwnProperty(p = "POW_PRECISION")) {
|
|
61977
61977
|
v = obj[p];
|
|
61978
|
-
|
|
61978
|
+
intCheck(v, 0, MAX, p);
|
|
61979
61979
|
POW_PRECISION = v;
|
|
61980
61980
|
}
|
|
61981
61981
|
if (obj.hasOwnProperty(p = "FORMAT")) {
|
|
61982
61982
|
v = obj[p];
|
|
61983
61983
|
if (typeof v == "object") FORMAT = v;
|
|
61984
|
-
else throw Error(
|
|
61984
|
+
else throw Error(bignumberError + p + " not an object: " + v);
|
|
61985
61985
|
}
|
|
61986
61986
|
if (obj.hasOwnProperty(p = "ALPHABET")) {
|
|
61987
61987
|
v = obj[p];
|
|
61988
61988
|
if (typeof v == "string" && !/^.$|[+-.\s]|(.).*\1/.test(v)) {
|
|
61989
61989
|
ALPHABET = v;
|
|
61990
61990
|
} else {
|
|
61991
|
-
throw Error(
|
|
61991
|
+
throw Error(bignumberError + p + " invalid: " + v);
|
|
61992
61992
|
}
|
|
61993
61993
|
}
|
|
61994
61994
|
} else {
|
|
61995
|
-
throw Error(
|
|
61995
|
+
throw Error(bignumberError + "Object expected: " + obj);
|
|
61996
61996
|
}
|
|
61997
61997
|
}
|
|
61998
61998
|
return {
|
|
@@ -62007,22 +62007,22 @@ var require_bignumber2 = __commonJS({
|
|
|
62007
62007
|
ALPHABET
|
|
62008
62008
|
};
|
|
62009
62009
|
};
|
|
62010
|
-
|
|
62010
|
+
BigNumber3.isBigNumber = function(v) {
|
|
62011
62011
|
if (!v || v._isBigNumber !== true) return false;
|
|
62012
|
-
if (!
|
|
62012
|
+
if (!BigNumber3.DEBUG) return true;
|
|
62013
62013
|
var i, n, c = v.c, e = v.e, s = v.s;
|
|
62014
62014
|
out: if ({}.toString.call(c) == "[object Array]") {
|
|
62015
|
-
if ((s === 1 || s === -1) && e >= -
|
|
62015
|
+
if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
|
|
62016
62016
|
if (c[0] === 0) {
|
|
62017
62017
|
if (e === 0 && c.length === 1) return true;
|
|
62018
62018
|
break out;
|
|
62019
62019
|
}
|
|
62020
|
-
i = (e + 1) %
|
|
62021
|
-
if (i < 1) i +=
|
|
62020
|
+
i = (e + 1) % LOG_BASE;
|
|
62021
|
+
if (i < 1) i += LOG_BASE;
|
|
62022
62022
|
if (String(c[0]).length == i) {
|
|
62023
62023
|
for (i = 0; i < c.length; i++) {
|
|
62024
62024
|
n = c[i];
|
|
62025
|
-
if (n < 0 || n >=
|
|
62025
|
+
if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
|
|
62026
62026
|
}
|
|
62027
62027
|
if (n !== 0) return true;
|
|
62028
62028
|
}
|
|
@@ -62030,26 +62030,26 @@ var require_bignumber2 = __commonJS({
|
|
|
62030
62030
|
} else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
|
|
62031
62031
|
return true;
|
|
62032
62032
|
}
|
|
62033
|
-
throw Error(
|
|
62033
|
+
throw Error(bignumberError + "Invalid BigNumber: " + v);
|
|
62034
62034
|
};
|
|
62035
|
-
|
|
62035
|
+
BigNumber3.maximum = BigNumber3.max = function() {
|
|
62036
62036
|
return maxOrMin(arguments, P.lt);
|
|
62037
62037
|
};
|
|
62038
|
-
|
|
62038
|
+
BigNumber3.minimum = BigNumber3.min = function() {
|
|
62039
62039
|
return maxOrMin(arguments, P.gt);
|
|
62040
62040
|
};
|
|
62041
|
-
|
|
62041
|
+
BigNumber3.random = (function() {
|
|
62042
62042
|
var pow2_53 = 9007199254740992;
|
|
62043
62043
|
var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
|
|
62044
|
-
return
|
|
62044
|
+
return mathfloor(Math.random() * pow2_53);
|
|
62045
62045
|
} : function() {
|
|
62046
62046
|
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
62047
62047
|
};
|
|
62048
62048
|
return function(dp) {
|
|
62049
|
-
var a, b, e, k, v, i = 0, c = [], rand = new
|
|
62049
|
+
var a, b, e, k, v, i = 0, c = [], rand = new BigNumber3(ONE);
|
|
62050
62050
|
if (dp == null) dp = DECIMAL_PLACES;
|
|
62051
|
-
else
|
|
62052
|
-
k =
|
|
62051
|
+
else intCheck(dp, 0, MAX);
|
|
62052
|
+
k = mathceil(dp / LOG_BASE);
|
|
62053
62053
|
if (CRYPTO) {
|
|
62054
62054
|
if (crypto.getRandomValues) {
|
|
62055
62055
|
a = crypto.getRandomValues(new Uint32Array(k *= 2));
|
|
@@ -62079,7 +62079,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62079
62079
|
i = k / 7;
|
|
62080
62080
|
} else {
|
|
62081
62081
|
CRYPTO = false;
|
|
62082
|
-
throw Error(
|
|
62082
|
+
throw Error(bignumberError + "crypto unavailable");
|
|
62083
62083
|
}
|
|
62084
62084
|
}
|
|
62085
62085
|
if (!CRYPTO) {
|
|
@@ -62089,26 +62089,26 @@ var require_bignumber2 = __commonJS({
|
|
|
62089
62089
|
}
|
|
62090
62090
|
}
|
|
62091
62091
|
k = c[--i];
|
|
62092
|
-
dp %=
|
|
62092
|
+
dp %= LOG_BASE;
|
|
62093
62093
|
if (k && dp) {
|
|
62094
|
-
v =
|
|
62095
|
-
c[i] =
|
|
62094
|
+
v = POWS_TEN[LOG_BASE - dp];
|
|
62095
|
+
c[i] = mathfloor(k / v) * v;
|
|
62096
62096
|
}
|
|
62097
62097
|
for (; c[i] === 0; c.pop(), i--) ;
|
|
62098
62098
|
if (i < 0) {
|
|
62099
62099
|
c = [e = 0];
|
|
62100
62100
|
} else {
|
|
62101
|
-
for (e = -1; c[0] === 0; c.splice(0, 1), e -=
|
|
62101
|
+
for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) ;
|
|
62102
62102
|
for (i = 1, v = c[0]; v >= 10; v /= 10, i++) ;
|
|
62103
|
-
if (i <
|
|
62103
|
+
if (i < LOG_BASE) e -= LOG_BASE - i;
|
|
62104
62104
|
}
|
|
62105
62105
|
rand.e = e;
|
|
62106
62106
|
rand.c = c;
|
|
62107
62107
|
return rand;
|
|
62108
62108
|
};
|
|
62109
62109
|
})();
|
|
62110
|
-
|
|
62111
|
-
var i = 1, args = arguments, sum = new
|
|
62110
|
+
BigNumber3.sum = function() {
|
|
62111
|
+
var i = 1, args = arguments, sum = new BigNumber3(args[0]);
|
|
62112
62112
|
for (; i < args.length; ) sum = sum.plus(args[i++]);
|
|
62113
62113
|
return sum;
|
|
62114
62114
|
};
|
|
@@ -62135,11 +62135,11 @@ var require_bignumber2 = __commonJS({
|
|
|
62135
62135
|
k = POW_PRECISION;
|
|
62136
62136
|
POW_PRECISION = 0;
|
|
62137
62137
|
str = str.replace(".", "");
|
|
62138
|
-
y = new
|
|
62138
|
+
y = new BigNumber3(baseIn);
|
|
62139
62139
|
x = y.pow(str.length - i);
|
|
62140
62140
|
POW_PRECISION = k;
|
|
62141
62141
|
y.c = toBaseOut(
|
|
62142
|
-
|
|
62142
|
+
toFixedPoint(coeffToString(x.c), x.e, "0"),
|
|
62143
62143
|
10,
|
|
62144
62144
|
baseOut,
|
|
62145
62145
|
decimal
|
|
@@ -62167,7 +62167,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62167
62167
|
r = r || d < 0 || xc[d + 1] != null;
|
|
62168
62168
|
r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
|
|
62169
62169
|
if (d < 1 || !xc[0]) {
|
|
62170
|
-
str = r ?
|
|
62170
|
+
str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
|
|
62171
62171
|
} else {
|
|
62172
62172
|
xc.length = d;
|
|
62173
62173
|
if (r) {
|
|
@@ -62181,26 +62181,26 @@ var require_bignumber2 = __commonJS({
|
|
|
62181
62181
|
}
|
|
62182
62182
|
for (k = xc.length; !xc[--k]; ) ;
|
|
62183
62183
|
for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) ;
|
|
62184
|
-
str =
|
|
62184
|
+
str = toFixedPoint(str, e, alphabet.charAt(0));
|
|
62185
62185
|
}
|
|
62186
62186
|
return str;
|
|
62187
62187
|
};
|
|
62188
62188
|
})();
|
|
62189
62189
|
div = /* @__PURE__ */ (function() {
|
|
62190
62190
|
function multiply(x, k, base) {
|
|
62191
|
-
var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k %
|
|
62191
|
+
var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0;
|
|
62192
62192
|
for (x = x.slice(); i--; ) {
|
|
62193
|
-
xlo = x[i] %
|
|
62194
|
-
xhi = x[i] /
|
|
62193
|
+
xlo = x[i] % SQRT_BASE;
|
|
62194
|
+
xhi = x[i] / SQRT_BASE | 0;
|
|
62195
62195
|
m = khi * xlo + xhi * klo;
|
|
62196
|
-
temp = klo * xlo + m %
|
|
62197
|
-
carry = (temp / base | 0) + (m /
|
|
62196
|
+
temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;
|
|
62197
|
+
carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
|
|
62198
62198
|
x[i] = temp % base;
|
|
62199
62199
|
}
|
|
62200
62200
|
if (carry) x = [carry].concat(x);
|
|
62201
62201
|
return x;
|
|
62202
62202
|
}
|
|
62203
|
-
function
|
|
62203
|
+
function compare2(a, b, aL, bL) {
|
|
62204
62204
|
var i, cmp;
|
|
62205
62205
|
if (aL != bL) {
|
|
62206
62206
|
cmp = aL > bL ? 1 : -1;
|
|
@@ -62226,7 +62226,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62226
62226
|
return function(x, y, dp, rm, base) {
|
|
62227
62227
|
var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c;
|
|
62228
62228
|
if (!xc || !xc[0] || !yc || !yc[0]) {
|
|
62229
|
-
return new
|
|
62229
|
+
return new BigNumber3(
|
|
62230
62230
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
62231
62231
|
!x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
|
|
62232
62232
|
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
@@ -62234,14 +62234,14 @@ var require_bignumber2 = __commonJS({
|
|
|
62234
62234
|
)
|
|
62235
62235
|
);
|
|
62236
62236
|
}
|
|
62237
|
-
q = new
|
|
62237
|
+
q = new BigNumber3(s);
|
|
62238
62238
|
qc = q.c = [];
|
|
62239
62239
|
e = x.e - y.e;
|
|
62240
62240
|
s = dp + e + 1;
|
|
62241
62241
|
if (!base) {
|
|
62242
|
-
base =
|
|
62243
|
-
e =
|
|
62244
|
-
s = s /
|
|
62242
|
+
base = BASE;
|
|
62243
|
+
e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
|
|
62244
|
+
s = s / LOG_BASE | 0;
|
|
62245
62245
|
}
|
|
62246
62246
|
for (i = 0; yc[i] == (xc[i] || 0); i++) ;
|
|
62247
62247
|
if (yc[i] > (xc[i] || 0)) e--;
|
|
@@ -62253,7 +62253,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62253
62253
|
yL = yc.length;
|
|
62254
62254
|
i = 0;
|
|
62255
62255
|
s += 2;
|
|
62256
|
-
n =
|
|
62256
|
+
n = mathfloor(base / (yc[0] + 1));
|
|
62257
62257
|
if (n > 1) {
|
|
62258
62258
|
yc = multiply(yc, n, base);
|
|
62259
62259
|
xc = multiply(xc, n, base);
|
|
@@ -62270,17 +62270,17 @@ var require_bignumber2 = __commonJS({
|
|
|
62270
62270
|
if (yc[1] >= base / 2) yc0++;
|
|
62271
62271
|
do {
|
|
62272
62272
|
n = 0;
|
|
62273
|
-
cmp =
|
|
62273
|
+
cmp = compare2(yc, rem, yL, remL);
|
|
62274
62274
|
if (cmp < 0) {
|
|
62275
62275
|
rem0 = rem[0];
|
|
62276
62276
|
if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
|
|
62277
|
-
n =
|
|
62277
|
+
n = mathfloor(rem0 / yc0);
|
|
62278
62278
|
if (n > 1) {
|
|
62279
62279
|
if (n >= base) n = base - 1;
|
|
62280
62280
|
prod = multiply(yc, n, base);
|
|
62281
62281
|
prodL = prod.length;
|
|
62282
62282
|
remL = rem.length;
|
|
62283
|
-
while (
|
|
62283
|
+
while (compare2(prod, rem, prodL, remL) == 1) {
|
|
62284
62284
|
n--;
|
|
62285
62285
|
subtract(prod, yL < prodL ? yz : yc, prodL, base);
|
|
62286
62286
|
prodL = prod.length;
|
|
@@ -62297,7 +62297,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62297
62297
|
subtract(rem, prod, remL, base);
|
|
62298
62298
|
remL = rem.length;
|
|
62299
62299
|
if (cmp == -1) {
|
|
62300
|
-
while (
|
|
62300
|
+
while (compare2(yc, rem, yL, remL) < 1) {
|
|
62301
62301
|
n++;
|
|
62302
62302
|
subtract(rem, yL < remL ? yz : yc, remL, base);
|
|
62303
62303
|
remL = rem.length;
|
|
@@ -62318,9 +62318,9 @@ var require_bignumber2 = __commonJS({
|
|
|
62318
62318
|
more = rem[0] != null;
|
|
62319
62319
|
if (!qc[0]) qc.splice(0, 1);
|
|
62320
62320
|
}
|
|
62321
|
-
if (base ==
|
|
62321
|
+
if (base == BASE) {
|
|
62322
62322
|
for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) ;
|
|
62323
|
-
round(q, dp + (q.e = i + e *
|
|
62323
|
+
round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
|
|
62324
62324
|
} else {
|
|
62325
62325
|
q.e = e;
|
|
62326
62326
|
q.r = +more;
|
|
@@ -62331,24 +62331,24 @@ var require_bignumber2 = __commonJS({
|
|
|
62331
62331
|
function format(n, i, rm, id) {
|
|
62332
62332
|
var c0, e, ne, len, str;
|
|
62333
62333
|
if (rm == null) rm = ROUNDING_MODE;
|
|
62334
|
-
else
|
|
62334
|
+
else intCheck(rm, 0, 8);
|
|
62335
62335
|
if (!n.c) return n.toString();
|
|
62336
62336
|
c0 = n.c[0];
|
|
62337
62337
|
ne = n.e;
|
|
62338
62338
|
if (i == null) {
|
|
62339
|
-
str =
|
|
62340
|
-
str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ?
|
|
62339
|
+
str = coeffToString(n.c);
|
|
62340
|
+
str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
|
|
62341
62341
|
} else {
|
|
62342
|
-
n = round(new
|
|
62342
|
+
n = round(new BigNumber3(n), i, rm);
|
|
62343
62343
|
e = n.e;
|
|
62344
|
-
str =
|
|
62344
|
+
str = coeffToString(n.c);
|
|
62345
62345
|
len = str.length;
|
|
62346
62346
|
if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
|
|
62347
62347
|
for (; len < i; str += "0", len++) ;
|
|
62348
|
-
str =
|
|
62348
|
+
str = toExponential(str, e);
|
|
62349
62349
|
} else {
|
|
62350
62350
|
i -= ne;
|
|
62351
|
-
str =
|
|
62351
|
+
str = toFixedPoint(str, e, "0");
|
|
62352
62352
|
if (e + 1 > len) {
|
|
62353
62353
|
if (--i > 0) for (str += "."; i--; str += "0") ;
|
|
62354
62354
|
} else {
|
|
@@ -62363,9 +62363,9 @@ var require_bignumber2 = __commonJS({
|
|
|
62363
62363
|
return n.s < 0 && c0 ? "-" + str : str;
|
|
62364
62364
|
}
|
|
62365
62365
|
function maxOrMin(args, method) {
|
|
62366
|
-
var n, i = 1, m = new
|
|
62366
|
+
var n, i = 1, m = new BigNumber3(args[0]);
|
|
62367
62367
|
for (; i < args.length; i++) {
|
|
62368
|
-
n = new
|
|
62368
|
+
n = new BigNumber3(args[i]);
|
|
62369
62369
|
if (!n.s) {
|
|
62370
62370
|
m = n;
|
|
62371
62371
|
break;
|
|
@@ -62379,7 +62379,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62379
62379
|
var i = 1, j = c.length;
|
|
62380
62380
|
for (; !c[--j]; c.pop()) ;
|
|
62381
62381
|
for (j = c[0]; j >= 10; j /= 10, i++) ;
|
|
62382
|
-
if ((e = i + e *
|
|
62382
|
+
if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
|
|
62383
62383
|
n.c = n.e = null;
|
|
62384
62384
|
} else if (e < MIN_EXP) {
|
|
62385
62385
|
n.c = [n.e = 0];
|
|
@@ -62405,10 +62405,10 @@ var require_bignumber2 = __commonJS({
|
|
|
62405
62405
|
base = b;
|
|
62406
62406
|
s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
|
|
62407
62407
|
}
|
|
62408
|
-
if (str != s) return new
|
|
62408
|
+
if (str != s) return new BigNumber3(s, base);
|
|
62409
62409
|
}
|
|
62410
|
-
if (
|
|
62411
|
-
throw Error(
|
|
62410
|
+
if (BigNumber3.DEBUG) {
|
|
62411
|
+
throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str);
|
|
62412
62412
|
}
|
|
62413
62413
|
x.s = null;
|
|
62414
62414
|
}
|
|
@@ -62416,33 +62416,33 @@ var require_bignumber2 = __commonJS({
|
|
|
62416
62416
|
};
|
|
62417
62417
|
})();
|
|
62418
62418
|
function round(x, sd, rm, r) {
|
|
62419
|
-
var d, i, j, k, n, ni, rd, xc = x.c, pows10 =
|
|
62419
|
+
var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
|
|
62420
62420
|
if (xc) {
|
|
62421
62421
|
out: {
|
|
62422
62422
|
for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) ;
|
|
62423
62423
|
i = sd - d;
|
|
62424
62424
|
if (i < 0) {
|
|
62425
|
-
i +=
|
|
62425
|
+
i += LOG_BASE;
|
|
62426
62426
|
j = sd;
|
|
62427
62427
|
n = xc[ni = 0];
|
|
62428
62428
|
rd = n / pows10[d - j - 1] % 10 | 0;
|
|
62429
62429
|
} else {
|
|
62430
|
-
ni =
|
|
62430
|
+
ni = mathceil((i + 1) / LOG_BASE);
|
|
62431
62431
|
if (ni >= xc.length) {
|
|
62432
62432
|
if (r) {
|
|
62433
62433
|
for (; xc.length <= ni; xc.push(0)) ;
|
|
62434
62434
|
n = rd = 0;
|
|
62435
62435
|
d = 1;
|
|
62436
|
-
i %=
|
|
62437
|
-
j = i -
|
|
62436
|
+
i %= LOG_BASE;
|
|
62437
|
+
j = i - LOG_BASE + 1;
|
|
62438
62438
|
} else {
|
|
62439
62439
|
break out;
|
|
62440
62440
|
}
|
|
62441
62441
|
} else {
|
|
62442
62442
|
n = k = xc[ni];
|
|
62443
62443
|
for (d = 1; k >= 10; k /= 10, d++) ;
|
|
62444
|
-
i %=
|
|
62445
|
-
j = i -
|
|
62444
|
+
i %= LOG_BASE;
|
|
62445
|
+
j = i - LOG_BASE + d;
|
|
62446
62446
|
rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;
|
|
62447
62447
|
}
|
|
62448
62448
|
}
|
|
@@ -62456,7 +62456,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62456
62456
|
xc.length = 0;
|
|
62457
62457
|
if (r) {
|
|
62458
62458
|
sd -= x.e + 1;
|
|
62459
|
-
xc[0] = pows10[(
|
|
62459
|
+
xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
|
|
62460
62460
|
x.e = -sd || 0;
|
|
62461
62461
|
} else {
|
|
62462
62462
|
xc[0] = x.e = 0;
|
|
@@ -62469,8 +62469,8 @@ var require_bignumber2 = __commonJS({
|
|
|
62469
62469
|
ni--;
|
|
62470
62470
|
} else {
|
|
62471
62471
|
xc.length = ni + 1;
|
|
62472
|
-
k = pows10[
|
|
62473
|
-
xc[ni] = j > 0 ?
|
|
62472
|
+
k = pows10[LOG_BASE - i];
|
|
62473
|
+
xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
|
|
62474
62474
|
}
|
|
62475
62475
|
if (r) {
|
|
62476
62476
|
for (; ; ) {
|
|
@@ -62480,12 +62480,12 @@ var require_bignumber2 = __commonJS({
|
|
|
62480
62480
|
for (k = 1; j >= 10; j /= 10, k++) ;
|
|
62481
62481
|
if (i != k) {
|
|
62482
62482
|
x.e++;
|
|
62483
|
-
if (xc[0] ==
|
|
62483
|
+
if (xc[0] == BASE) xc[0] = 1;
|
|
62484
62484
|
}
|
|
62485
62485
|
break;
|
|
62486
62486
|
} else {
|
|
62487
62487
|
xc[ni] += k;
|
|
62488
|
-
if (xc[ni] !=
|
|
62488
|
+
if (xc[ni] != BASE) break;
|
|
62489
62489
|
xc[ni--] = 0;
|
|
62490
62490
|
k = 1;
|
|
62491
62491
|
}
|
|
@@ -62504,71 +62504,71 @@ var require_bignumber2 = __commonJS({
|
|
|
62504
62504
|
function valueOf(n) {
|
|
62505
62505
|
var str, e = n.e;
|
|
62506
62506
|
if (e === null) return n.toString();
|
|
62507
|
-
str =
|
|
62508
|
-
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ?
|
|
62507
|
+
str = coeffToString(n.c);
|
|
62508
|
+
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0");
|
|
62509
62509
|
return n.s < 0 ? "-" + str : str;
|
|
62510
62510
|
}
|
|
62511
62511
|
P.absoluteValue = P.abs = function() {
|
|
62512
|
-
var x = new
|
|
62512
|
+
var x = new BigNumber3(this);
|
|
62513
62513
|
if (x.s < 0) x.s = 1;
|
|
62514
62514
|
return x;
|
|
62515
62515
|
};
|
|
62516
62516
|
P.comparedTo = function(y, b) {
|
|
62517
|
-
return
|
|
62517
|
+
return compare(this, new BigNumber3(y, b));
|
|
62518
62518
|
};
|
|
62519
62519
|
P.decimalPlaces = P.dp = function(dp, rm) {
|
|
62520
62520
|
var c, n, v, x = this;
|
|
62521
62521
|
if (dp != null) {
|
|
62522
|
-
|
|
62522
|
+
intCheck(dp, 0, MAX);
|
|
62523
62523
|
if (rm == null) rm = ROUNDING_MODE;
|
|
62524
|
-
else
|
|
62525
|
-
return round(new
|
|
62524
|
+
else intCheck(rm, 0, 8);
|
|
62525
|
+
return round(new BigNumber3(x), dp + x.e + 1, rm);
|
|
62526
62526
|
}
|
|
62527
62527
|
if (!(c = x.c)) return null;
|
|
62528
|
-
n = ((v = c.length - 1) -
|
|
62528
|
+
n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
|
|
62529
62529
|
if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) ;
|
|
62530
62530
|
if (n < 0) n = 0;
|
|
62531
62531
|
return n;
|
|
62532
62532
|
};
|
|
62533
62533
|
P.dividedBy = P.div = function(y, b) {
|
|
62534
|
-
return div(this, new
|
|
62534
|
+
return div(this, new BigNumber3(y, b), DECIMAL_PLACES, ROUNDING_MODE);
|
|
62535
62535
|
};
|
|
62536
62536
|
P.dividedToIntegerBy = P.idiv = function(y, b) {
|
|
62537
|
-
return div(this, new
|
|
62537
|
+
return div(this, new BigNumber3(y, b), 0, 1);
|
|
62538
62538
|
};
|
|
62539
62539
|
P.exponentiatedBy = P.pow = function(n, m) {
|
|
62540
62540
|
var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this;
|
|
62541
|
-
n = new
|
|
62541
|
+
n = new BigNumber3(n);
|
|
62542
62542
|
if (n.c && !n.isInteger()) {
|
|
62543
|
-
throw Error(
|
|
62543
|
+
throw Error(bignumberError + "Exponent not an integer: " + valueOf(n));
|
|
62544
62544
|
}
|
|
62545
|
-
if (m != null) m = new
|
|
62545
|
+
if (m != null) m = new BigNumber3(m);
|
|
62546
62546
|
nIsBig = n.e > 14;
|
|
62547
62547
|
if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
|
|
62548
|
-
y = new
|
|
62548
|
+
y = new BigNumber3(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));
|
|
62549
62549
|
return m ? y.mod(m) : y;
|
|
62550
62550
|
}
|
|
62551
62551
|
nIsNeg = n.s < 0;
|
|
62552
62552
|
if (m) {
|
|
62553
|
-
if (m.c ? !m.c[0] : !m.s) return new
|
|
62553
|
+
if (m.c ? !m.c[0] : !m.s) return new BigNumber3(NaN);
|
|
62554
62554
|
isModExp = !nIsNeg && x.isInteger() && m.isInteger();
|
|
62555
62555
|
if (isModExp) x = x.mod(m);
|
|
62556
62556
|
} else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
|
|
62557
|
-
k = x.s < 0 &&
|
|
62557
|
+
k = x.s < 0 && isOdd(n) ? -0 : 0;
|
|
62558
62558
|
if (x.e > -1) k = 1 / k;
|
|
62559
|
-
return new
|
|
62559
|
+
return new BigNumber3(nIsNeg ? 1 / k : k);
|
|
62560
62560
|
} else if (POW_PRECISION) {
|
|
62561
|
-
k =
|
|
62561
|
+
k = mathceil(POW_PRECISION / LOG_BASE + 2);
|
|
62562
62562
|
}
|
|
62563
62563
|
if (nIsBig) {
|
|
62564
|
-
half = new
|
|
62564
|
+
half = new BigNumber3(0.5);
|
|
62565
62565
|
if (nIsNeg) n.s = 1;
|
|
62566
|
-
nIsOdd =
|
|
62566
|
+
nIsOdd = isOdd(n);
|
|
62567
62567
|
} else {
|
|
62568
62568
|
i = Math.abs(+valueOf(n));
|
|
62569
62569
|
nIsOdd = i % 2;
|
|
62570
62570
|
}
|
|
62571
|
-
y = new
|
|
62571
|
+
y = new BigNumber3(ONE);
|
|
62572
62572
|
for (; ; ) {
|
|
62573
62573
|
if (nIsOdd) {
|
|
62574
62574
|
y = y.times(x);
|
|
@@ -62580,14 +62580,14 @@ var require_bignumber2 = __commonJS({
|
|
|
62580
62580
|
}
|
|
62581
62581
|
}
|
|
62582
62582
|
if (i) {
|
|
62583
|
-
i =
|
|
62583
|
+
i = mathfloor(i / 2);
|
|
62584
62584
|
if (i === 0) break;
|
|
62585
62585
|
nIsOdd = i % 2;
|
|
62586
62586
|
} else {
|
|
62587
62587
|
n = n.times(half);
|
|
62588
62588
|
round(n, n.e + 1, 1);
|
|
62589
62589
|
if (n.e > 14) {
|
|
62590
|
-
nIsOdd =
|
|
62590
|
+
nIsOdd = isOdd(n);
|
|
62591
62591
|
} else {
|
|
62592
62592
|
i = +valueOf(n);
|
|
62593
62593
|
if (i === 0) break;
|
|
@@ -62606,31 +62606,31 @@ var require_bignumber2 = __commonJS({
|
|
|
62606
62606
|
return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
|
|
62607
62607
|
};
|
|
62608
62608
|
P.integerValue = function(rm) {
|
|
62609
|
-
var n = new
|
|
62609
|
+
var n = new BigNumber3(this);
|
|
62610
62610
|
if (rm == null) rm = ROUNDING_MODE;
|
|
62611
|
-
else
|
|
62611
|
+
else intCheck(rm, 0, 8);
|
|
62612
62612
|
return round(n, n.e + 1, rm);
|
|
62613
62613
|
};
|
|
62614
62614
|
P.isEqualTo = P.eq = function(y, b) {
|
|
62615
|
-
return
|
|
62615
|
+
return compare(this, new BigNumber3(y, b)) === 0;
|
|
62616
62616
|
};
|
|
62617
62617
|
P.isFinite = function() {
|
|
62618
62618
|
return !!this.c;
|
|
62619
62619
|
};
|
|
62620
62620
|
P.isGreaterThan = P.gt = function(y, b) {
|
|
62621
|
-
return
|
|
62621
|
+
return compare(this, new BigNumber3(y, b)) > 0;
|
|
62622
62622
|
};
|
|
62623
62623
|
P.isGreaterThanOrEqualTo = P.gte = function(y, b) {
|
|
62624
|
-
return (b =
|
|
62624
|
+
return (b = compare(this, new BigNumber3(y, b))) === 1 || b === 0;
|
|
62625
62625
|
};
|
|
62626
62626
|
P.isInteger = function() {
|
|
62627
|
-
return !!this.c &&
|
|
62627
|
+
return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
|
|
62628
62628
|
};
|
|
62629
62629
|
P.isLessThan = P.lt = function(y, b) {
|
|
62630
|
-
return
|
|
62630
|
+
return compare(this, new BigNumber3(y, b)) < 0;
|
|
62631
62631
|
};
|
|
62632
62632
|
P.isLessThanOrEqualTo = P.lte = function(y, b) {
|
|
62633
|
-
return (b =
|
|
62633
|
+
return (b = compare(this, new BigNumber3(y, b))) === -1 || b === 0;
|
|
62634
62634
|
};
|
|
62635
62635
|
P.isNaN = function() {
|
|
62636
62636
|
return !this.s;
|
|
@@ -62646,25 +62646,25 @@ var require_bignumber2 = __commonJS({
|
|
|
62646
62646
|
};
|
|
62647
62647
|
P.minus = function(y, b) {
|
|
62648
62648
|
var i, j, t, xLTy, x = this, a = x.s;
|
|
62649
|
-
y = new
|
|
62649
|
+
y = new BigNumber3(y, b);
|
|
62650
62650
|
b = y.s;
|
|
62651
|
-
if (!a || !b) return new
|
|
62651
|
+
if (!a || !b) return new BigNumber3(NaN);
|
|
62652
62652
|
if (a != b) {
|
|
62653
62653
|
y.s = -b;
|
|
62654
62654
|
return x.plus(y);
|
|
62655
62655
|
}
|
|
62656
|
-
var xe = x.e /
|
|
62656
|
+
var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
|
|
62657
62657
|
if (!xe || !ye) {
|
|
62658
|
-
if (!xc || !yc) return xc ? (y.s = -b, y) : new
|
|
62658
|
+
if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber3(yc ? x : NaN);
|
|
62659
62659
|
if (!xc[0] || !yc[0]) {
|
|
62660
|
-
return yc[0] ? (y.s = -b, y) : new
|
|
62660
|
+
return yc[0] ? (y.s = -b, y) : new BigNumber3(xc[0] ? x : (
|
|
62661
62661
|
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
62662
62662
|
ROUNDING_MODE == 3 ? -0 : 0
|
|
62663
62663
|
));
|
|
62664
62664
|
}
|
|
62665
62665
|
}
|
|
62666
|
-
xe =
|
|
62667
|
-
ye =
|
|
62666
|
+
xe = bitFloor(xe);
|
|
62667
|
+
ye = bitFloor(ye);
|
|
62668
62668
|
xc = xc.slice();
|
|
62669
62669
|
if (a = xe - ye) {
|
|
62670
62670
|
if (xLTy = a < 0) {
|
|
@@ -62689,12 +62689,12 @@ var require_bignumber2 = __commonJS({
|
|
|
62689
62689
|
if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;
|
|
62690
62690
|
b = (j = yc.length) - (i = xc.length);
|
|
62691
62691
|
if (b > 0) for (; b--; xc[i++] = 0) ;
|
|
62692
|
-
b =
|
|
62692
|
+
b = BASE - 1;
|
|
62693
62693
|
for (; j > a; ) {
|
|
62694
62694
|
if (xc[--j] < yc[j]) {
|
|
62695
62695
|
for (i = j; i && !xc[--i]; xc[i] = b) ;
|
|
62696
62696
|
--xc[i];
|
|
62697
|
-
xc[j] +=
|
|
62697
|
+
xc[j] += BASE;
|
|
62698
62698
|
}
|
|
62699
62699
|
xc[j] -= yc[j];
|
|
62700
62700
|
}
|
|
@@ -62708,11 +62708,11 @@ var require_bignumber2 = __commonJS({
|
|
|
62708
62708
|
};
|
|
62709
62709
|
P.modulo = P.mod = function(y, b) {
|
|
62710
62710
|
var q, s, x = this;
|
|
62711
|
-
y = new
|
|
62711
|
+
y = new BigNumber3(y, b);
|
|
62712
62712
|
if (!x.c || !y.s || y.c && !y.c[0]) {
|
|
62713
|
-
return new
|
|
62713
|
+
return new BigNumber3(NaN);
|
|
62714
62714
|
} else if (!y.c || x.c && !x.c[0]) {
|
|
62715
|
-
return new
|
|
62715
|
+
return new BigNumber3(x);
|
|
62716
62716
|
}
|
|
62717
62717
|
if (MODULO_MODE == 9) {
|
|
62718
62718
|
s = y.s;
|
|
@@ -62728,7 +62728,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62728
62728
|
return y;
|
|
62729
62729
|
};
|
|
62730
62730
|
P.multipliedBy = P.times = function(y, b) {
|
|
62731
|
-
var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new
|
|
62731
|
+
var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber3(y, b)).c;
|
|
62732
62732
|
if (!xc || !yc || !xc[0] || !yc[0]) {
|
|
62733
62733
|
if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
|
|
62734
62734
|
y.c = y.e = y.s = null;
|
|
@@ -62743,14 +62743,14 @@ var require_bignumber2 = __commonJS({
|
|
|
62743
62743
|
}
|
|
62744
62744
|
return y;
|
|
62745
62745
|
}
|
|
62746
|
-
e =
|
|
62746
|
+
e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
|
|
62747
62747
|
y.s *= x.s;
|
|
62748
62748
|
xcL = xc.length;
|
|
62749
62749
|
ycL = yc.length;
|
|
62750
62750
|
if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;
|
|
62751
62751
|
for (i = xcL + ycL, zc = []; i--; zc.push(0)) ;
|
|
62752
|
-
base =
|
|
62753
|
-
sqrtBase =
|
|
62752
|
+
base = BASE;
|
|
62753
|
+
sqrtBase = SQRT_BASE;
|
|
62754
62754
|
for (i = ycL; --i >= 0; ) {
|
|
62755
62755
|
c = 0;
|
|
62756
62756
|
ylo = yc[i] % sqrtBase;
|
|
@@ -62773,26 +62773,26 @@ var require_bignumber2 = __commonJS({
|
|
|
62773
62773
|
return normalise(y, zc, e);
|
|
62774
62774
|
};
|
|
62775
62775
|
P.negated = function() {
|
|
62776
|
-
var x = new
|
|
62776
|
+
var x = new BigNumber3(this);
|
|
62777
62777
|
x.s = -x.s || null;
|
|
62778
62778
|
return x;
|
|
62779
62779
|
};
|
|
62780
62780
|
P.plus = function(y, b) {
|
|
62781
62781
|
var t, x = this, a = x.s;
|
|
62782
|
-
y = new
|
|
62782
|
+
y = new BigNumber3(y, b);
|
|
62783
62783
|
b = y.s;
|
|
62784
|
-
if (!a || !b) return new
|
|
62784
|
+
if (!a || !b) return new BigNumber3(NaN);
|
|
62785
62785
|
if (a != b) {
|
|
62786
62786
|
y.s = -b;
|
|
62787
62787
|
return x.minus(y);
|
|
62788
62788
|
}
|
|
62789
|
-
var xe = x.e /
|
|
62789
|
+
var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
|
|
62790
62790
|
if (!xe || !ye) {
|
|
62791
|
-
if (!xc || !yc) return new
|
|
62792
|
-
if (!xc[0] || !yc[0]) return yc[0] ? y : new
|
|
62791
|
+
if (!xc || !yc) return new BigNumber3(a / 0);
|
|
62792
|
+
if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber3(xc[0] ? x : a * 0);
|
|
62793
62793
|
}
|
|
62794
|
-
xe =
|
|
62795
|
-
ye =
|
|
62794
|
+
xe = bitFloor(xe);
|
|
62795
|
+
ye = bitFloor(ye);
|
|
62796
62796
|
xc = xc.slice();
|
|
62797
62797
|
if (a = xe - ye) {
|
|
62798
62798
|
if (a > 0) {
|
|
@@ -62810,8 +62810,8 @@ var require_bignumber2 = __commonJS({
|
|
|
62810
62810
|
b = yc.length;
|
|
62811
62811
|
if (a - b < 0) t = yc, yc = xc, xc = t, b = a;
|
|
62812
62812
|
for (a = 0; b; ) {
|
|
62813
|
-
a = (xc[--b] = xc[b] + yc[b] + a) /
|
|
62814
|
-
xc[b] =
|
|
62813
|
+
a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
|
|
62814
|
+
xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
|
|
62815
62815
|
}
|
|
62816
62816
|
if (a) {
|
|
62817
62817
|
xc = [a].concat(xc);
|
|
@@ -62822,14 +62822,14 @@ var require_bignumber2 = __commonJS({
|
|
|
62822
62822
|
P.precision = P.sd = function(sd, rm) {
|
|
62823
62823
|
var c, n, v, x = this;
|
|
62824
62824
|
if (sd != null && sd !== !!sd) {
|
|
62825
|
-
|
|
62825
|
+
intCheck(sd, 1, MAX);
|
|
62826
62826
|
if (rm == null) rm = ROUNDING_MODE;
|
|
62827
|
-
else
|
|
62828
|
-
return round(new
|
|
62827
|
+
else intCheck(rm, 0, 8);
|
|
62828
|
+
return round(new BigNumber3(x), sd, rm);
|
|
62829
62829
|
}
|
|
62830
62830
|
if (!(c = x.c)) return null;
|
|
62831
62831
|
v = c.length - 1;
|
|
62832
|
-
n = v *
|
|
62832
|
+
n = v * LOG_BASE + 1;
|
|
62833
62833
|
if (v = c[v]) {
|
|
62834
62834
|
for (; v % 10 == 0; v /= 10, n--) ;
|
|
62835
62835
|
for (v = c[0]; v >= 10; v /= 10, n++) ;
|
|
@@ -62838,29 +62838,29 @@ var require_bignumber2 = __commonJS({
|
|
|
62838
62838
|
return n;
|
|
62839
62839
|
};
|
|
62840
62840
|
P.shiftedBy = function(k) {
|
|
62841
|
-
|
|
62841
|
+
intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
|
62842
62842
|
return this.times("1e" + k);
|
|
62843
62843
|
};
|
|
62844
62844
|
P.squareRoot = P.sqrt = function() {
|
|
62845
|
-
var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new
|
|
62845
|
+
var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber3("0.5");
|
|
62846
62846
|
if (s !== 1 || !c || !c[0]) {
|
|
62847
|
-
return new
|
|
62847
|
+
return new BigNumber3(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
|
|
62848
62848
|
}
|
|
62849
62849
|
s = Math.sqrt(+valueOf(x));
|
|
62850
62850
|
if (s == 0 || s == 1 / 0) {
|
|
62851
|
-
n =
|
|
62851
|
+
n = coeffToString(c);
|
|
62852
62852
|
if ((n.length + e) % 2 == 0) n += "0";
|
|
62853
62853
|
s = Math.sqrt(+n);
|
|
62854
|
-
e =
|
|
62854
|
+
e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
|
|
62855
62855
|
if (s == 1 / 0) {
|
|
62856
62856
|
n = "1e" + e;
|
|
62857
62857
|
} else {
|
|
62858
62858
|
n = s.toExponential();
|
|
62859
62859
|
n = n.slice(0, n.indexOf("e") + 1) + e;
|
|
62860
62860
|
}
|
|
62861
|
-
r = new
|
|
62861
|
+
r = new BigNumber3(n);
|
|
62862
62862
|
} else {
|
|
62863
|
-
r = new
|
|
62863
|
+
r = new BigNumber3(s + "");
|
|
62864
62864
|
}
|
|
62865
62865
|
if (r.c[0]) {
|
|
62866
62866
|
e = r.e;
|
|
@@ -62869,7 +62869,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62869
62869
|
for (; ; ) {
|
|
62870
62870
|
t = r;
|
|
62871
62871
|
r = half.times(t.plus(div(x, t, dp, 1)));
|
|
62872
|
-
if (
|
|
62872
|
+
if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
|
|
62873
62873
|
if (r.e < e) --s;
|
|
62874
62874
|
n = n.slice(s - 3, s + 1);
|
|
62875
62875
|
if (n == "9999" || !rep && n == "4999") {
|
|
@@ -62897,14 +62897,14 @@ var require_bignumber2 = __commonJS({
|
|
|
62897
62897
|
};
|
|
62898
62898
|
P.toExponential = function(dp, rm) {
|
|
62899
62899
|
if (dp != null) {
|
|
62900
|
-
|
|
62900
|
+
intCheck(dp, 0, MAX);
|
|
62901
62901
|
dp++;
|
|
62902
62902
|
}
|
|
62903
62903
|
return format(this, dp, rm, 1);
|
|
62904
62904
|
};
|
|
62905
62905
|
P.toFixed = function(dp, rm) {
|
|
62906
62906
|
if (dp != null) {
|
|
62907
|
-
|
|
62907
|
+
intCheck(dp, 0, MAX);
|
|
62908
62908
|
dp = dp + this.e + 1;
|
|
62909
62909
|
}
|
|
62910
62910
|
return format(this, dp, rm);
|
|
@@ -62922,7 +62922,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62922
62922
|
format2 = FORMAT;
|
|
62923
62923
|
}
|
|
62924
62924
|
} else if (typeof format2 != "object") {
|
|
62925
|
-
throw Error(
|
|
62925
|
+
throw Error(bignumberError + "Argument not an object: " + format2);
|
|
62926
62926
|
}
|
|
62927
62927
|
str = x.toFixed(dp, rm);
|
|
62928
62928
|
if (x.c) {
|
|
@@ -62945,22 +62945,22 @@ var require_bignumber2 = __commonJS({
|
|
|
62945
62945
|
P.toFraction = function(md) {
|
|
62946
62946
|
var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c;
|
|
62947
62947
|
if (md != null) {
|
|
62948
|
-
n = new
|
|
62948
|
+
n = new BigNumber3(md);
|
|
62949
62949
|
if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
|
|
62950
|
-
throw Error(
|
|
62950
|
+
throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n));
|
|
62951
62951
|
}
|
|
62952
62952
|
}
|
|
62953
|
-
if (!xc) return new
|
|
62954
|
-
d = new
|
|
62955
|
-
n1 = d0 = new
|
|
62956
|
-
d1 = n0 = new
|
|
62957
|
-
s =
|
|
62953
|
+
if (!xc) return new BigNumber3(x);
|
|
62954
|
+
d = new BigNumber3(ONE);
|
|
62955
|
+
n1 = d0 = new BigNumber3(ONE);
|
|
62956
|
+
d1 = n0 = new BigNumber3(ONE);
|
|
62957
|
+
s = coeffToString(xc);
|
|
62958
62958
|
e = d.e = s.length - x.e - 1;
|
|
62959
|
-
d.c[0] =
|
|
62959
|
+
d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
|
|
62960
62960
|
md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;
|
|
62961
62961
|
exp = MAX_EXP;
|
|
62962
62962
|
MAX_EXP = 1 / 0;
|
|
62963
|
-
n = new
|
|
62963
|
+
n = new BigNumber3(s);
|
|
62964
62964
|
n0.c[0] = 0;
|
|
62965
62965
|
for (; ; ) {
|
|
62966
62966
|
q = div(n, d, 0, 1);
|
|
@@ -62988,7 +62988,7 @@ var require_bignumber2 = __commonJS({
|
|
|
62988
62988
|
return +valueOf(this);
|
|
62989
62989
|
};
|
|
62990
62990
|
P.toPrecision = function(sd, rm) {
|
|
62991
|
-
if (sd != null)
|
|
62991
|
+
if (sd != null) intCheck(sd, 1, MAX);
|
|
62992
62992
|
return format(this, sd, rm, 2);
|
|
62993
62993
|
};
|
|
62994
62994
|
P.toString = function(b) {
|
|
@@ -63002,13 +63002,13 @@ var require_bignumber2 = __commonJS({
|
|
|
63002
63002
|
}
|
|
63003
63003
|
} else {
|
|
63004
63004
|
if (b == null) {
|
|
63005
|
-
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ?
|
|
63005
|
+
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0");
|
|
63006
63006
|
} else if (b === 10) {
|
|
63007
|
-
n = round(new
|
|
63008
|
-
str =
|
|
63007
|
+
n = round(new BigNumber3(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
|
|
63008
|
+
str = toFixedPoint(coeffToString(n.c), n.e, "0");
|
|
63009
63009
|
} else {
|
|
63010
|
-
|
|
63011
|
-
str = convertBase(
|
|
63010
|
+
intCheck(b, 2, ALPHABET.length, "Base");
|
|
63011
|
+
str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true);
|
|
63012
63012
|
}
|
|
63013
63013
|
if (s < 0 && n.c[0]) str = "-" + str;
|
|
63014
63014
|
}
|
|
@@ -63018,25 +63018,25 @@ var require_bignumber2 = __commonJS({
|
|
|
63018
63018
|
return valueOf(this);
|
|
63019
63019
|
};
|
|
63020
63020
|
P._isBigNumber = true;
|
|
63021
|
-
if (configObject != null)
|
|
63022
|
-
return
|
|
63021
|
+
if (configObject != null) BigNumber3.set(configObject);
|
|
63022
|
+
return BigNumber3;
|
|
63023
63023
|
}
|
|
63024
|
-
function
|
|
63024
|
+
function bitFloor(n) {
|
|
63025
63025
|
var i = n | 0;
|
|
63026
63026
|
return n > 0 || n === i ? i : i - 1;
|
|
63027
63027
|
}
|
|
63028
|
-
function
|
|
63028
|
+
function coeffToString(a) {
|
|
63029
63029
|
var s, z3, i = 1, j = a.length, r = a[0] + "";
|
|
63030
63030
|
for (; i < j; ) {
|
|
63031
63031
|
s = a[i++] + "";
|
|
63032
|
-
z3 =
|
|
63032
|
+
z3 = LOG_BASE - s.length;
|
|
63033
63033
|
for (; z3--; s = "0" + s) ;
|
|
63034
63034
|
r += s;
|
|
63035
63035
|
}
|
|
63036
63036
|
for (j = r.length; r.charCodeAt(--j) === 48; ) ;
|
|
63037
63037
|
return r.slice(0, j + 1 || 1);
|
|
63038
63038
|
}
|
|
63039
|
-
function
|
|
63039
|
+
function compare(x, y) {
|
|
63040
63040
|
var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e;
|
|
63041
63041
|
if (!i || !j) return null;
|
|
63042
63042
|
a = xc && !xc[0];
|
|
@@ -63051,19 +63051,19 @@ var require_bignumber2 = __commonJS({
|
|
|
63051
63051
|
for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
|
|
63052
63052
|
return k == l ? 0 : k > l ^ a ? 1 : -1;
|
|
63053
63053
|
}
|
|
63054
|
-
function
|
|
63055
|
-
if (n < min || n > max || n !==
|
|
63056
|
-
throw Error(
|
|
63054
|
+
function intCheck(n, min, max, name) {
|
|
63055
|
+
if (n < min || n > max || n !== mathfloor(n)) {
|
|
63056
|
+
throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
|
|
63057
63057
|
}
|
|
63058
63058
|
}
|
|
63059
|
-
function
|
|
63059
|
+
function isOdd(n) {
|
|
63060
63060
|
var k = n.c.length - 1;
|
|
63061
|
-
return
|
|
63061
|
+
return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
|
|
63062
63062
|
}
|
|
63063
|
-
function
|
|
63063
|
+
function toExponential(str, e) {
|
|
63064
63064
|
return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e;
|
|
63065
63065
|
}
|
|
63066
|
-
function
|
|
63066
|
+
function toFixedPoint(str, e, z3) {
|
|
63067
63067
|
var len, zs;
|
|
63068
63068
|
if (e < 0) {
|
|
63069
63069
|
for (zs = z3 + "."; ++e; zs += z3) ;
|
|
@@ -63079,19 +63079,19 @@ var require_bignumber2 = __commonJS({
|
|
|
63079
63079
|
}
|
|
63080
63080
|
return str;
|
|
63081
63081
|
}
|
|
63082
|
-
|
|
63083
|
-
|
|
63082
|
+
BigNumber2 = clone2();
|
|
63083
|
+
BigNumber2["default"] = BigNumber2.BigNumber = BigNumber2;
|
|
63084
63084
|
if (typeof define == "function" && define.amd) {
|
|
63085
63085
|
define(function() {
|
|
63086
|
-
return
|
|
63086
|
+
return BigNumber2;
|
|
63087
63087
|
});
|
|
63088
63088
|
} else if (typeof module != "undefined" && module.exports) {
|
|
63089
|
-
module.exports =
|
|
63089
|
+
module.exports = BigNumber2;
|
|
63090
63090
|
} else {
|
|
63091
63091
|
if (!globalObject) {
|
|
63092
63092
|
globalObject = typeof self != "undefined" && self ? self : window;
|
|
63093
63093
|
}
|
|
63094
|
-
globalObject.BigNumber =
|
|
63094
|
+
globalObject.BigNumber = BigNumber2;
|
|
63095
63095
|
}
|
|
63096
63096
|
})(exports);
|
|
63097
63097
|
}
|
|
@@ -70688,7 +70688,7 @@ var id_default = ID;
|
|
|
70688
70688
|
// lib/constants.ts
|
|
70689
70689
|
var SDK_TITLE = "Appwrite";
|
|
70690
70690
|
var SDK_TITLE_LOWER = "appwrite";
|
|
70691
|
-
var SDK_VERSION = "13.
|
|
70691
|
+
var SDK_VERSION = "13.4.0";
|
|
70692
70692
|
var SDK_LOGO = "\n _ _ _ ___ __ _____\n /_\\ _ __ _ ____ ___ __(_) |_ ___ / __\\ / / \\_ \\\n //_\\\\| '_ \\| '_ \\ \\ /\\ / / '__| | __/ _ \\ / / / / / /\\/\n / _ \\ |_) | |_) \\ V V /| | | | || __/ / /___/ /___/\\/ /_\n \\_/ \\_/ .__/| .__/ \\_/\\_/ |_| |_|\\__\\___| \\____/\\____/\\____/\n |_| |_|\n\n";
|
|
70693
70693
|
var EXECUTABLE_NAME = "appwrite";
|
|
70694
70694
|
var NPM_PACKAGE_NAME = "appwrite-cli";
|
|
@@ -84944,1357 +84944,15 @@ function filterBySchema(data, schema) {
|
|
|
84944
84944
|
|
|
84945
84945
|
// lib/json.ts
|
|
84946
84946
|
var import_json_bigint = __toESM(require_json_bigint(), 1);
|
|
84947
|
-
|
|
84948
|
-
// node_modules/bignumber.js/bignumber.mjs
|
|
84949
|
-
var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
84950
|
-
var mathceil = Math.ceil;
|
|
84951
|
-
var mathfloor = Math.floor;
|
|
84952
|
-
var bignumberError = "[BigNumber Error] ";
|
|
84953
|
-
var tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
|
|
84954
|
-
var BASE = 1e14;
|
|
84955
|
-
var LOG_BASE = 14;
|
|
84956
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
84957
|
-
var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
|
|
84958
|
-
var SQRT_BASE = 1e7;
|
|
84959
|
-
var MAX = 1e9;
|
|
84960
|
-
function clone2(configObject) {
|
|
84961
|
-
var div, convertBase, parseNumeric, P = BigNumber3.prototype = { constructor: BigNumber3, toString: null, valueOf: null }, ONE = new BigNumber3(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
|
|
84962
|
-
prefix: "",
|
|
84963
|
-
groupSize: 3,
|
|
84964
|
-
secondaryGroupSize: 0,
|
|
84965
|
-
groupSeparator: ",",
|
|
84966
|
-
decimalSeparator: ".",
|
|
84967
|
-
fractionGroupSize: 0,
|
|
84968
|
-
fractionGroupSeparator: "\xA0",
|
|
84969
|
-
// non-breaking space
|
|
84970
|
-
suffix: ""
|
|
84971
|
-
}, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
|
|
84972
|
-
function BigNumber3(v, b) {
|
|
84973
|
-
var alphabet, c, caseChanged, e, i, isNum, len, str, x = this;
|
|
84974
|
-
if (!(x instanceof BigNumber3)) return new BigNumber3(v, b);
|
|
84975
|
-
if (b == null) {
|
|
84976
|
-
if (v && v._isBigNumber === true) {
|
|
84977
|
-
x.s = v.s;
|
|
84978
|
-
if (!v.c || v.e > MAX_EXP) {
|
|
84979
|
-
x.c = x.e = null;
|
|
84980
|
-
} else if (v.e < MIN_EXP) {
|
|
84981
|
-
x.c = [x.e = 0];
|
|
84982
|
-
} else {
|
|
84983
|
-
x.e = v.e;
|
|
84984
|
-
x.c = v.c.slice();
|
|
84985
|
-
}
|
|
84986
|
-
return;
|
|
84987
|
-
}
|
|
84988
|
-
if ((isNum = typeof v == "number") && v * 0 == 0) {
|
|
84989
|
-
x.s = 1 / v < 0 ? (v = -v, -1) : 1;
|
|
84990
|
-
if (v === ~~v) {
|
|
84991
|
-
for (e = 0, i = v; i >= 10; i /= 10, e++) ;
|
|
84992
|
-
if (e > MAX_EXP) {
|
|
84993
|
-
x.c = x.e = null;
|
|
84994
|
-
} else {
|
|
84995
|
-
x.e = e;
|
|
84996
|
-
x.c = [v];
|
|
84997
|
-
}
|
|
84998
|
-
return;
|
|
84999
|
-
}
|
|
85000
|
-
str = String(v);
|
|
85001
|
-
} else {
|
|
85002
|
-
if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
|
|
85003
|
-
x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
|
|
85004
|
-
}
|
|
85005
|
-
if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
|
|
85006
|
-
if ((i = str.search(/e/i)) > 0) {
|
|
85007
|
-
if (e < 0) e = i;
|
|
85008
|
-
e += +str.slice(i + 1);
|
|
85009
|
-
str = str.substring(0, i);
|
|
85010
|
-
} else if (e < 0) {
|
|
85011
|
-
e = str.length;
|
|
85012
|
-
}
|
|
85013
|
-
} else {
|
|
85014
|
-
intCheck(b, 2, ALPHABET.length, "Base");
|
|
85015
|
-
if (b == 10 && alphabetHasNormalDecimalDigits) {
|
|
85016
|
-
x = new BigNumber3(v);
|
|
85017
|
-
return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
|
|
85018
|
-
}
|
|
85019
|
-
str = String(v);
|
|
85020
|
-
if (isNum = typeof v == "number") {
|
|
85021
|
-
if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
|
|
85022
|
-
x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
|
|
85023
|
-
if (BigNumber3.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
|
|
85024
|
-
throw Error(tooManyDigits + v);
|
|
85025
|
-
}
|
|
85026
|
-
} else {
|
|
85027
|
-
x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
|
|
85028
|
-
}
|
|
85029
|
-
alphabet = ALPHABET.slice(0, b);
|
|
85030
|
-
e = i = 0;
|
|
85031
|
-
for (len = str.length; i < len; i++) {
|
|
85032
|
-
if (alphabet.indexOf(c = str.charAt(i)) < 0) {
|
|
85033
|
-
if (c == ".") {
|
|
85034
|
-
if (i > e) {
|
|
85035
|
-
e = len;
|
|
85036
|
-
continue;
|
|
85037
|
-
}
|
|
85038
|
-
} else if (!caseChanged) {
|
|
85039
|
-
if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
|
|
85040
|
-
caseChanged = true;
|
|
85041
|
-
i = -1;
|
|
85042
|
-
e = 0;
|
|
85043
|
-
continue;
|
|
85044
|
-
}
|
|
85045
|
-
}
|
|
85046
|
-
return parseNumeric(x, String(v), isNum, b);
|
|
85047
|
-
}
|
|
85048
|
-
}
|
|
85049
|
-
isNum = false;
|
|
85050
|
-
str = convertBase(str, b, 10, x.s);
|
|
85051
|
-
if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
|
|
85052
|
-
else e = str.length;
|
|
85053
|
-
}
|
|
85054
|
-
for (i = 0; str.charCodeAt(i) === 48; i++) ;
|
|
85055
|
-
for (len = str.length; str.charCodeAt(--len) === 48; ) ;
|
|
85056
|
-
if (str = str.slice(i, ++len)) {
|
|
85057
|
-
len -= i;
|
|
85058
|
-
if (isNum && BigNumber3.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
|
|
85059
|
-
throw Error(tooManyDigits + x.s * v);
|
|
85060
|
-
}
|
|
85061
|
-
if ((e = e - i - 1) > MAX_EXP) {
|
|
85062
|
-
x.c = x.e = null;
|
|
85063
|
-
} else if (e < MIN_EXP) {
|
|
85064
|
-
x.c = [x.e = 0];
|
|
85065
|
-
} else {
|
|
85066
|
-
x.e = e;
|
|
85067
|
-
x.c = [];
|
|
85068
|
-
i = (e + 1) % LOG_BASE;
|
|
85069
|
-
if (e < 0) i += LOG_BASE;
|
|
85070
|
-
if (i < len) {
|
|
85071
|
-
if (i) x.c.push(+str.slice(0, i));
|
|
85072
|
-
for (len -= LOG_BASE; i < len; ) {
|
|
85073
|
-
x.c.push(+str.slice(i, i += LOG_BASE));
|
|
85074
|
-
}
|
|
85075
|
-
i = LOG_BASE - (str = str.slice(i)).length;
|
|
85076
|
-
} else {
|
|
85077
|
-
i -= len;
|
|
85078
|
-
}
|
|
85079
|
-
for (; i--; str += "0") ;
|
|
85080
|
-
x.c.push(+str);
|
|
85081
|
-
}
|
|
85082
|
-
} else {
|
|
85083
|
-
x.c = [x.e = 0];
|
|
85084
|
-
}
|
|
85085
|
-
}
|
|
85086
|
-
BigNumber3.clone = clone2;
|
|
85087
|
-
BigNumber3.ROUND_UP = 0;
|
|
85088
|
-
BigNumber3.ROUND_DOWN = 1;
|
|
85089
|
-
BigNumber3.ROUND_CEIL = 2;
|
|
85090
|
-
BigNumber3.ROUND_FLOOR = 3;
|
|
85091
|
-
BigNumber3.ROUND_HALF_UP = 4;
|
|
85092
|
-
BigNumber3.ROUND_HALF_DOWN = 5;
|
|
85093
|
-
BigNumber3.ROUND_HALF_EVEN = 6;
|
|
85094
|
-
BigNumber3.ROUND_HALF_CEIL = 7;
|
|
85095
|
-
BigNumber3.ROUND_HALF_FLOOR = 8;
|
|
85096
|
-
BigNumber3.EUCLID = 9;
|
|
85097
|
-
BigNumber3.config = BigNumber3.set = function(obj) {
|
|
85098
|
-
var p, v;
|
|
85099
|
-
if (obj != null) {
|
|
85100
|
-
if (typeof obj == "object") {
|
|
85101
|
-
if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) {
|
|
85102
|
-
v = obj[p];
|
|
85103
|
-
intCheck(v, 0, MAX, p);
|
|
85104
|
-
DECIMAL_PLACES = v;
|
|
85105
|
-
}
|
|
85106
|
-
if (obj.hasOwnProperty(p = "ROUNDING_MODE")) {
|
|
85107
|
-
v = obj[p];
|
|
85108
|
-
intCheck(v, 0, 8, p);
|
|
85109
|
-
ROUNDING_MODE = v;
|
|
85110
|
-
}
|
|
85111
|
-
if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) {
|
|
85112
|
-
v = obj[p];
|
|
85113
|
-
if (v && v.pop) {
|
|
85114
|
-
intCheck(v[0], -MAX, 0, p);
|
|
85115
|
-
intCheck(v[1], 0, MAX, p);
|
|
85116
|
-
TO_EXP_NEG = v[0];
|
|
85117
|
-
TO_EXP_POS = v[1];
|
|
85118
|
-
} else {
|
|
85119
|
-
intCheck(v, -MAX, MAX, p);
|
|
85120
|
-
TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
|
|
85121
|
-
}
|
|
85122
|
-
}
|
|
85123
|
-
if (obj.hasOwnProperty(p = "RANGE")) {
|
|
85124
|
-
v = obj[p];
|
|
85125
|
-
if (v && v.pop) {
|
|
85126
|
-
intCheck(v[0], -MAX, -1, p);
|
|
85127
|
-
intCheck(v[1], 1, MAX, p);
|
|
85128
|
-
MIN_EXP = v[0];
|
|
85129
|
-
MAX_EXP = v[1];
|
|
85130
|
-
} else {
|
|
85131
|
-
intCheck(v, -MAX, MAX, p);
|
|
85132
|
-
if (v) {
|
|
85133
|
-
MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
|
|
85134
|
-
} else {
|
|
85135
|
-
throw Error(bignumberError + p + " cannot be zero: " + v);
|
|
85136
|
-
}
|
|
85137
|
-
}
|
|
85138
|
-
}
|
|
85139
|
-
if (obj.hasOwnProperty(p = "CRYPTO")) {
|
|
85140
|
-
v = obj[p];
|
|
85141
|
-
if (v === !!v) {
|
|
85142
|
-
if (v) {
|
|
85143
|
-
if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
|
|
85144
|
-
CRYPTO = v;
|
|
85145
|
-
} else {
|
|
85146
|
-
CRYPTO = !v;
|
|
85147
|
-
throw Error(bignumberError + "crypto unavailable");
|
|
85148
|
-
}
|
|
85149
|
-
} else {
|
|
85150
|
-
CRYPTO = v;
|
|
85151
|
-
}
|
|
85152
|
-
} else {
|
|
85153
|
-
throw Error(bignumberError + p + " not true or false: " + v);
|
|
85154
|
-
}
|
|
85155
|
-
}
|
|
85156
|
-
if (obj.hasOwnProperty(p = "MODULO_MODE")) {
|
|
85157
|
-
v = obj[p];
|
|
85158
|
-
intCheck(v, 0, 9, p);
|
|
85159
|
-
MODULO_MODE = v;
|
|
85160
|
-
}
|
|
85161
|
-
if (obj.hasOwnProperty(p = "POW_PRECISION")) {
|
|
85162
|
-
v = obj[p];
|
|
85163
|
-
intCheck(v, 0, MAX, p);
|
|
85164
|
-
POW_PRECISION = v;
|
|
85165
|
-
}
|
|
85166
|
-
if (obj.hasOwnProperty(p = "FORMAT")) {
|
|
85167
|
-
v = obj[p];
|
|
85168
|
-
if (typeof v == "object") FORMAT = v;
|
|
85169
|
-
else throw Error(bignumberError + p + " not an object: " + v);
|
|
85170
|
-
}
|
|
85171
|
-
if (obj.hasOwnProperty(p = "ALPHABET")) {
|
|
85172
|
-
v = obj[p];
|
|
85173
|
-
if (typeof v == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) {
|
|
85174
|
-
alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789";
|
|
85175
|
-
ALPHABET = v;
|
|
85176
|
-
} else {
|
|
85177
|
-
throw Error(bignumberError + p + " invalid: " + v);
|
|
85178
|
-
}
|
|
85179
|
-
}
|
|
85180
|
-
} else {
|
|
85181
|
-
throw Error(bignumberError + "Object expected: " + obj);
|
|
85182
|
-
}
|
|
85183
|
-
}
|
|
85184
|
-
return {
|
|
85185
|
-
DECIMAL_PLACES,
|
|
85186
|
-
ROUNDING_MODE,
|
|
85187
|
-
EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
|
|
85188
|
-
RANGE: [MIN_EXP, MAX_EXP],
|
|
85189
|
-
CRYPTO,
|
|
85190
|
-
MODULO_MODE,
|
|
85191
|
-
POW_PRECISION,
|
|
85192
|
-
FORMAT,
|
|
85193
|
-
ALPHABET
|
|
85194
|
-
};
|
|
85195
|
-
};
|
|
85196
|
-
BigNumber3.isBigNumber = function(v) {
|
|
85197
|
-
if (!v || v._isBigNumber !== true) return false;
|
|
85198
|
-
if (!BigNumber3.DEBUG) return true;
|
|
85199
|
-
var i, n, c = v.c, e = v.e, s = v.s;
|
|
85200
|
-
out: if ({}.toString.call(c) == "[object Array]") {
|
|
85201
|
-
if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
|
|
85202
|
-
if (c[0] === 0) {
|
|
85203
|
-
if (e === 0 && c.length === 1) return true;
|
|
85204
|
-
break out;
|
|
85205
|
-
}
|
|
85206
|
-
i = (e + 1) % LOG_BASE;
|
|
85207
|
-
if (i < 1) i += LOG_BASE;
|
|
85208
|
-
if (String(c[0]).length == i) {
|
|
85209
|
-
for (i = 0; i < c.length; i++) {
|
|
85210
|
-
n = c[i];
|
|
85211
|
-
if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
|
|
85212
|
-
}
|
|
85213
|
-
if (n !== 0) return true;
|
|
85214
|
-
}
|
|
85215
|
-
}
|
|
85216
|
-
} else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
|
|
85217
|
-
return true;
|
|
85218
|
-
}
|
|
85219
|
-
throw Error(bignumberError + "Invalid BigNumber: " + v);
|
|
85220
|
-
};
|
|
85221
|
-
BigNumber3.maximum = BigNumber3.max = function() {
|
|
85222
|
-
return maxOrMin(arguments, -1);
|
|
85223
|
-
};
|
|
85224
|
-
BigNumber3.minimum = BigNumber3.min = function() {
|
|
85225
|
-
return maxOrMin(arguments, 1);
|
|
85226
|
-
};
|
|
85227
|
-
BigNumber3.random = (function() {
|
|
85228
|
-
var pow2_53 = 9007199254740992;
|
|
85229
|
-
var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
|
|
85230
|
-
return mathfloor(Math.random() * pow2_53);
|
|
85231
|
-
} : function() {
|
|
85232
|
-
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
85233
|
-
};
|
|
85234
|
-
return function(dp) {
|
|
85235
|
-
var a, b, e, k, v, i = 0, c = [], rand = new BigNumber3(ONE);
|
|
85236
|
-
if (dp == null) dp = DECIMAL_PLACES;
|
|
85237
|
-
else intCheck(dp, 0, MAX);
|
|
85238
|
-
k = mathceil(dp / LOG_BASE);
|
|
85239
|
-
if (CRYPTO) {
|
|
85240
|
-
if (crypto.getRandomValues) {
|
|
85241
|
-
a = crypto.getRandomValues(new Uint32Array(k *= 2));
|
|
85242
|
-
for (; i < k; ) {
|
|
85243
|
-
v = a[i] * 131072 + (a[i + 1] >>> 11);
|
|
85244
|
-
if (v >= 9e15) {
|
|
85245
|
-
b = crypto.getRandomValues(new Uint32Array(2));
|
|
85246
|
-
a[i] = b[0];
|
|
85247
|
-
a[i + 1] = b[1];
|
|
85248
|
-
} else {
|
|
85249
|
-
c.push(v % 1e14);
|
|
85250
|
-
i += 2;
|
|
85251
|
-
}
|
|
85252
|
-
}
|
|
85253
|
-
i = k / 2;
|
|
85254
|
-
} else if (crypto.randomBytes) {
|
|
85255
|
-
a = crypto.randomBytes(k *= 7);
|
|
85256
|
-
for (; i < k; ) {
|
|
85257
|
-
v = (a[i] & 31) * 281474976710656 + a[i + 1] * 1099511627776 + a[i + 2] * 4294967296 + a[i + 3] * 16777216 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];
|
|
85258
|
-
if (v >= 9e15) {
|
|
85259
|
-
crypto.randomBytes(7).copy(a, i);
|
|
85260
|
-
} else {
|
|
85261
|
-
c.push(v % 1e14);
|
|
85262
|
-
i += 7;
|
|
85263
|
-
}
|
|
85264
|
-
}
|
|
85265
|
-
i = k / 7;
|
|
85266
|
-
} else {
|
|
85267
|
-
CRYPTO = false;
|
|
85268
|
-
throw Error(bignumberError + "crypto unavailable");
|
|
85269
|
-
}
|
|
85270
|
-
}
|
|
85271
|
-
if (!CRYPTO) {
|
|
85272
|
-
for (; i < k; ) {
|
|
85273
|
-
v = random53bitInt();
|
|
85274
|
-
if (v < 9e15) c[i++] = v % 1e14;
|
|
85275
|
-
}
|
|
85276
|
-
}
|
|
85277
|
-
k = c[--i];
|
|
85278
|
-
dp %= LOG_BASE;
|
|
85279
|
-
if (k && dp) {
|
|
85280
|
-
v = POWS_TEN[LOG_BASE - dp];
|
|
85281
|
-
c[i] = mathfloor(k / v) * v;
|
|
85282
|
-
}
|
|
85283
|
-
for (; c[i] === 0; c.pop(), i--) ;
|
|
85284
|
-
if (i < 0) {
|
|
85285
|
-
c = [e = 0];
|
|
85286
|
-
} else {
|
|
85287
|
-
for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) ;
|
|
85288
|
-
for (i = 1, v = c[0]; v >= 10; v /= 10, i++) ;
|
|
85289
|
-
if (i < LOG_BASE) e -= LOG_BASE - i;
|
|
85290
|
-
}
|
|
85291
|
-
rand.e = e;
|
|
85292
|
-
rand.c = c;
|
|
85293
|
-
return rand;
|
|
85294
|
-
};
|
|
85295
|
-
})();
|
|
85296
|
-
BigNumber3.sum = function() {
|
|
85297
|
-
var i = 1, args = arguments, sum = new BigNumber3(args[0]);
|
|
85298
|
-
for (; i < args.length; ) sum = sum.plus(args[i++]);
|
|
85299
|
-
return sum;
|
|
85300
|
-
};
|
|
85301
|
-
convertBase = /* @__PURE__ */ (function() {
|
|
85302
|
-
var decimal = "0123456789";
|
|
85303
|
-
function toBaseOut(str, baseIn, baseOut, alphabet) {
|
|
85304
|
-
var j, arr = [0], arrL, i = 0, len = str.length;
|
|
85305
|
-
for (; i < len; ) {
|
|
85306
|
-
for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
|
|
85307
|
-
arr[0] += alphabet.indexOf(str.charAt(i++));
|
|
85308
|
-
for (j = 0; j < arr.length; j++) {
|
|
85309
|
-
if (arr[j] > baseOut - 1) {
|
|
85310
|
-
if (arr[j + 1] == null) arr[j + 1] = 0;
|
|
85311
|
-
arr[j + 1] += arr[j] / baseOut | 0;
|
|
85312
|
-
arr[j] %= baseOut;
|
|
85313
|
-
}
|
|
85314
|
-
}
|
|
85315
|
-
}
|
|
85316
|
-
return arr.reverse();
|
|
85317
|
-
}
|
|
85318
|
-
return function(str, baseIn, baseOut, sign, callerIsToString) {
|
|
85319
|
-
var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
|
|
85320
|
-
if (i >= 0) {
|
|
85321
|
-
k = POW_PRECISION;
|
|
85322
|
-
POW_PRECISION = 0;
|
|
85323
|
-
str = str.replace(".", "");
|
|
85324
|
-
y = new BigNumber3(baseIn);
|
|
85325
|
-
x = y.pow(str.length - i);
|
|
85326
|
-
POW_PRECISION = k;
|
|
85327
|
-
y.c = toBaseOut(
|
|
85328
|
-
toFixedPoint(coeffToString(x.c), x.e, "0"),
|
|
85329
|
-
10,
|
|
85330
|
-
baseOut,
|
|
85331
|
-
decimal
|
|
85332
|
-
);
|
|
85333
|
-
y.e = y.c.length;
|
|
85334
|
-
}
|
|
85335
|
-
xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
|
|
85336
|
-
e = k = xc.length;
|
|
85337
|
-
for (; xc[--k] == 0; xc.pop()) ;
|
|
85338
|
-
if (!xc[0]) return alphabet.charAt(0);
|
|
85339
|
-
if (i < 0) {
|
|
85340
|
-
--e;
|
|
85341
|
-
} else {
|
|
85342
|
-
x.c = xc;
|
|
85343
|
-
x.e = e;
|
|
85344
|
-
x.s = sign;
|
|
85345
|
-
x = div(x, y, dp, rm, baseOut);
|
|
85346
|
-
xc = x.c;
|
|
85347
|
-
r = x.r;
|
|
85348
|
-
e = x.e;
|
|
85349
|
-
}
|
|
85350
|
-
d = e + dp + 1;
|
|
85351
|
-
i = xc[d];
|
|
85352
|
-
k = baseOut / 2;
|
|
85353
|
-
r = r || d < 0 || xc[d + 1] != null;
|
|
85354
|
-
r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
|
|
85355
|
-
if (d < 1 || !xc[0]) {
|
|
85356
|
-
str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
|
|
85357
|
-
} else {
|
|
85358
|
-
xc.length = d;
|
|
85359
|
-
if (r) {
|
|
85360
|
-
for (--baseOut; ++xc[--d] > baseOut; ) {
|
|
85361
|
-
xc[d] = 0;
|
|
85362
|
-
if (!d) {
|
|
85363
|
-
++e;
|
|
85364
|
-
xc = [1].concat(xc);
|
|
85365
|
-
}
|
|
85366
|
-
}
|
|
85367
|
-
}
|
|
85368
|
-
for (k = xc.length; !xc[--k]; ) ;
|
|
85369
|
-
for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) ;
|
|
85370
|
-
str = toFixedPoint(str, e, alphabet.charAt(0));
|
|
85371
|
-
}
|
|
85372
|
-
return str;
|
|
85373
|
-
};
|
|
85374
|
-
})();
|
|
85375
|
-
div = /* @__PURE__ */ (function() {
|
|
85376
|
-
function multiply(x, k, base) {
|
|
85377
|
-
var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0;
|
|
85378
|
-
for (x = x.slice(); i--; ) {
|
|
85379
|
-
xlo = x[i] % SQRT_BASE;
|
|
85380
|
-
xhi = x[i] / SQRT_BASE | 0;
|
|
85381
|
-
m = khi * xlo + xhi * klo;
|
|
85382
|
-
temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;
|
|
85383
|
-
carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
|
|
85384
|
-
x[i] = temp % base;
|
|
85385
|
-
}
|
|
85386
|
-
if (carry) x = [carry].concat(x);
|
|
85387
|
-
return x;
|
|
85388
|
-
}
|
|
85389
|
-
function compare2(a, b, aL, bL) {
|
|
85390
|
-
var i, cmp;
|
|
85391
|
-
if (aL != bL) {
|
|
85392
|
-
cmp = aL > bL ? 1 : -1;
|
|
85393
|
-
} else {
|
|
85394
|
-
for (i = cmp = 0; i < aL; i++) {
|
|
85395
|
-
if (a[i] != b[i]) {
|
|
85396
|
-
cmp = a[i] > b[i] ? 1 : -1;
|
|
85397
|
-
break;
|
|
85398
|
-
}
|
|
85399
|
-
}
|
|
85400
|
-
}
|
|
85401
|
-
return cmp;
|
|
85402
|
-
}
|
|
85403
|
-
function subtract(a, b, aL, base) {
|
|
85404
|
-
var i = 0;
|
|
85405
|
-
for (; aL--; ) {
|
|
85406
|
-
a[aL] -= i;
|
|
85407
|
-
i = a[aL] < b[aL] ? 1 : 0;
|
|
85408
|
-
a[aL] = i * base + a[aL] - b[aL];
|
|
85409
|
-
}
|
|
85410
|
-
for (; !a[0] && a.length > 1; a.splice(0, 1)) ;
|
|
85411
|
-
}
|
|
85412
|
-
return function(x, y, dp, rm, base) {
|
|
85413
|
-
var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c;
|
|
85414
|
-
if (!xc || !xc[0] || !yc || !yc[0]) {
|
|
85415
|
-
return new BigNumber3(
|
|
85416
|
-
// Return NaN if either NaN, or both Infinity or 0.
|
|
85417
|
-
!x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
|
|
85418
|
-
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
85419
|
-
xc && xc[0] == 0 || !yc ? s * 0 : s / 0
|
|
85420
|
-
)
|
|
85421
|
-
);
|
|
85422
|
-
}
|
|
85423
|
-
q = new BigNumber3(s);
|
|
85424
|
-
qc = q.c = [];
|
|
85425
|
-
e = x.e - y.e;
|
|
85426
|
-
s = dp + e + 1;
|
|
85427
|
-
if (!base) {
|
|
85428
|
-
base = BASE;
|
|
85429
|
-
e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
|
|
85430
|
-
s = s / LOG_BASE | 0;
|
|
85431
|
-
}
|
|
85432
|
-
for (i = 0; yc[i] == (xc[i] || 0); i++) ;
|
|
85433
|
-
if (yc[i] > (xc[i] || 0)) e--;
|
|
85434
|
-
if (s < 0) {
|
|
85435
|
-
qc.push(1);
|
|
85436
|
-
more = true;
|
|
85437
|
-
} else {
|
|
85438
|
-
xL = xc.length;
|
|
85439
|
-
yL = yc.length;
|
|
85440
|
-
i = 0;
|
|
85441
|
-
s += 2;
|
|
85442
|
-
n = mathfloor(base / (yc[0] + 1));
|
|
85443
|
-
if (n > 1) {
|
|
85444
|
-
yc = multiply(yc, n, base);
|
|
85445
|
-
xc = multiply(xc, n, base);
|
|
85446
|
-
yL = yc.length;
|
|
85447
|
-
xL = xc.length;
|
|
85448
|
-
}
|
|
85449
|
-
xi = yL;
|
|
85450
|
-
rem = xc.slice(0, yL);
|
|
85451
|
-
remL = rem.length;
|
|
85452
|
-
for (; remL < yL; rem[remL++] = 0) ;
|
|
85453
|
-
yz = yc.slice();
|
|
85454
|
-
yz = [0].concat(yz);
|
|
85455
|
-
yc0 = yc[0];
|
|
85456
|
-
if (yc[1] >= base / 2) yc0++;
|
|
85457
|
-
do {
|
|
85458
|
-
n = 0;
|
|
85459
|
-
cmp = compare2(yc, rem, yL, remL);
|
|
85460
|
-
if (cmp < 0) {
|
|
85461
|
-
rem0 = rem[0];
|
|
85462
|
-
if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
|
|
85463
|
-
n = mathfloor(rem0 / yc0);
|
|
85464
|
-
if (n > 1) {
|
|
85465
|
-
if (n >= base) n = base - 1;
|
|
85466
|
-
prod = multiply(yc, n, base);
|
|
85467
|
-
prodL = prod.length;
|
|
85468
|
-
remL = rem.length;
|
|
85469
|
-
while (compare2(prod, rem, prodL, remL) == 1) {
|
|
85470
|
-
n--;
|
|
85471
|
-
subtract(prod, yL < prodL ? yz : yc, prodL, base);
|
|
85472
|
-
prodL = prod.length;
|
|
85473
|
-
cmp = 1;
|
|
85474
|
-
}
|
|
85475
|
-
} else {
|
|
85476
|
-
if (n == 0) {
|
|
85477
|
-
cmp = n = 1;
|
|
85478
|
-
}
|
|
85479
|
-
prod = yc.slice();
|
|
85480
|
-
prodL = prod.length;
|
|
85481
|
-
}
|
|
85482
|
-
if (prodL < remL) prod = [0].concat(prod);
|
|
85483
|
-
subtract(rem, prod, remL, base);
|
|
85484
|
-
remL = rem.length;
|
|
85485
|
-
if (cmp == -1) {
|
|
85486
|
-
while (compare2(yc, rem, yL, remL) < 1) {
|
|
85487
|
-
n++;
|
|
85488
|
-
subtract(rem, yL < remL ? yz : yc, remL, base);
|
|
85489
|
-
remL = rem.length;
|
|
85490
|
-
}
|
|
85491
|
-
}
|
|
85492
|
-
} else if (cmp === 0) {
|
|
85493
|
-
n++;
|
|
85494
|
-
rem = [0];
|
|
85495
|
-
}
|
|
85496
|
-
qc[i++] = n;
|
|
85497
|
-
if (rem[0]) {
|
|
85498
|
-
rem[remL++] = xc[xi] || 0;
|
|
85499
|
-
} else {
|
|
85500
|
-
rem = [xc[xi]];
|
|
85501
|
-
remL = 1;
|
|
85502
|
-
}
|
|
85503
|
-
} while ((xi++ < xL || rem[0] != null) && s--);
|
|
85504
|
-
more = rem[0] != null;
|
|
85505
|
-
if (!qc[0]) qc.splice(0, 1);
|
|
85506
|
-
}
|
|
85507
|
-
if (base == BASE) {
|
|
85508
|
-
for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) ;
|
|
85509
|
-
round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
|
|
85510
|
-
} else {
|
|
85511
|
-
q.e = e;
|
|
85512
|
-
q.r = +more;
|
|
85513
|
-
}
|
|
85514
|
-
return q;
|
|
85515
|
-
};
|
|
85516
|
-
})();
|
|
85517
|
-
function format(n, i, rm, id) {
|
|
85518
|
-
var c0, e, ne, len, str;
|
|
85519
|
-
if (rm == null) rm = ROUNDING_MODE;
|
|
85520
|
-
else intCheck(rm, 0, 8);
|
|
85521
|
-
if (!n.c) return n.toString();
|
|
85522
|
-
c0 = n.c[0];
|
|
85523
|
-
ne = n.e;
|
|
85524
|
-
if (i == null) {
|
|
85525
|
-
str = coeffToString(n.c);
|
|
85526
|
-
str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
|
|
85527
|
-
} else {
|
|
85528
|
-
n = round(new BigNumber3(n), i, rm);
|
|
85529
|
-
e = n.e;
|
|
85530
|
-
str = coeffToString(n.c);
|
|
85531
|
-
len = str.length;
|
|
85532
|
-
if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
|
|
85533
|
-
for (; len < i; str += "0", len++) ;
|
|
85534
|
-
str = toExponential(str, e);
|
|
85535
|
-
} else {
|
|
85536
|
-
i -= ne + (id === 2 && e > ne);
|
|
85537
|
-
str = toFixedPoint(str, e, "0");
|
|
85538
|
-
if (e + 1 > len) {
|
|
85539
|
-
if (--i > 0) for (str += "."; i--; str += "0") ;
|
|
85540
|
-
} else {
|
|
85541
|
-
i += e - len;
|
|
85542
|
-
if (i > 0) {
|
|
85543
|
-
if (e + 1 == len) str += ".";
|
|
85544
|
-
for (; i--; str += "0") ;
|
|
85545
|
-
}
|
|
85546
|
-
}
|
|
85547
|
-
}
|
|
85548
|
-
}
|
|
85549
|
-
return n.s < 0 && c0 ? "-" + str : str;
|
|
85550
|
-
}
|
|
85551
|
-
function maxOrMin(args, n) {
|
|
85552
|
-
var k, y, i = 1, x = new BigNumber3(args[0]);
|
|
85553
|
-
for (; i < args.length; i++) {
|
|
85554
|
-
y = new BigNumber3(args[i]);
|
|
85555
|
-
if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) {
|
|
85556
|
-
x = y;
|
|
85557
|
-
}
|
|
85558
|
-
}
|
|
85559
|
-
return x;
|
|
85560
|
-
}
|
|
85561
|
-
function normalise(n, c, e) {
|
|
85562
|
-
var i = 1, j = c.length;
|
|
85563
|
-
for (; !c[--j]; c.pop()) ;
|
|
85564
|
-
for (j = c[0]; j >= 10; j /= 10, i++) ;
|
|
85565
|
-
if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
|
|
85566
|
-
n.c = n.e = null;
|
|
85567
|
-
} else if (e < MIN_EXP) {
|
|
85568
|
-
n.c = [n.e = 0];
|
|
85569
|
-
} else {
|
|
85570
|
-
n.e = e;
|
|
85571
|
-
n.c = c;
|
|
85572
|
-
}
|
|
85573
|
-
return n;
|
|
85574
|
-
}
|
|
85575
|
-
parseNumeric = /* @__PURE__ */ (function() {
|
|
85576
|
-
var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
|
85577
|
-
return function(x, str, isNum, b) {
|
|
85578
|
-
var base, s = isNum ? str : str.replace(whitespaceOrPlus, "");
|
|
85579
|
-
if (isInfinityOrNaN.test(s)) {
|
|
85580
|
-
x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
|
|
85581
|
-
} else {
|
|
85582
|
-
if (!isNum) {
|
|
85583
|
-
s = s.replace(basePrefix, function(m, p1, p2) {
|
|
85584
|
-
base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
|
|
85585
|
-
return !b || b == base ? p1 : m;
|
|
85586
|
-
});
|
|
85587
|
-
if (b) {
|
|
85588
|
-
base = b;
|
|
85589
|
-
s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
|
|
85590
|
-
}
|
|
85591
|
-
if (str != s) return new BigNumber3(s, base);
|
|
85592
|
-
}
|
|
85593
|
-
if (BigNumber3.DEBUG) {
|
|
85594
|
-
throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str);
|
|
85595
|
-
}
|
|
85596
|
-
x.s = null;
|
|
85597
|
-
}
|
|
85598
|
-
x.c = x.e = null;
|
|
85599
|
-
};
|
|
85600
|
-
})();
|
|
85601
|
-
function round(x, sd, rm, r) {
|
|
85602
|
-
var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
|
|
85603
|
-
if (xc) {
|
|
85604
|
-
out: {
|
|
85605
|
-
for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) ;
|
|
85606
|
-
i = sd - d;
|
|
85607
|
-
if (i < 0) {
|
|
85608
|
-
i += LOG_BASE;
|
|
85609
|
-
j = sd;
|
|
85610
|
-
n = xc[ni = 0];
|
|
85611
|
-
rd = mathfloor(n / pows10[d - j - 1] % 10);
|
|
85612
|
-
} else {
|
|
85613
|
-
ni = mathceil((i + 1) / LOG_BASE);
|
|
85614
|
-
if (ni >= xc.length) {
|
|
85615
|
-
if (r) {
|
|
85616
|
-
for (; xc.length <= ni; xc.push(0)) ;
|
|
85617
|
-
n = rd = 0;
|
|
85618
|
-
d = 1;
|
|
85619
|
-
i %= LOG_BASE;
|
|
85620
|
-
j = i - LOG_BASE + 1;
|
|
85621
|
-
} else {
|
|
85622
|
-
break out;
|
|
85623
|
-
}
|
|
85624
|
-
} else {
|
|
85625
|
-
n = k = xc[ni];
|
|
85626
|
-
for (d = 1; k >= 10; k /= 10, d++) ;
|
|
85627
|
-
i %= LOG_BASE;
|
|
85628
|
-
j = i - LOG_BASE + d;
|
|
85629
|
-
rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10);
|
|
85630
|
-
}
|
|
85631
|
-
}
|
|
85632
|
-
r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?
|
|
85633
|
-
// The expression n % pows10[d - j - 1] returns all digits of n to the right
|
|
85634
|
-
// of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
|
|
85635
|
-
xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
|
|
85636
|
-
r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
85637
|
-
(i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
|
|
85638
|
-
if (sd < 1 || !xc[0]) {
|
|
85639
|
-
xc.length = 0;
|
|
85640
|
-
if (r) {
|
|
85641
|
-
sd -= x.e + 1;
|
|
85642
|
-
xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
|
|
85643
|
-
x.e = -sd || 0;
|
|
85644
|
-
} else {
|
|
85645
|
-
xc[0] = x.e = 0;
|
|
85646
|
-
}
|
|
85647
|
-
return x;
|
|
85648
|
-
}
|
|
85649
|
-
if (i == 0) {
|
|
85650
|
-
xc.length = ni;
|
|
85651
|
-
k = 1;
|
|
85652
|
-
ni--;
|
|
85653
|
-
} else {
|
|
85654
|
-
xc.length = ni + 1;
|
|
85655
|
-
k = pows10[LOG_BASE - i];
|
|
85656
|
-
xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
|
|
85657
|
-
}
|
|
85658
|
-
if (r) {
|
|
85659
|
-
for (; ; ) {
|
|
85660
|
-
if (ni == 0) {
|
|
85661
|
-
for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) ;
|
|
85662
|
-
j = xc[0] += k;
|
|
85663
|
-
for (k = 1; j >= 10; j /= 10, k++) ;
|
|
85664
|
-
if (i != k) {
|
|
85665
|
-
x.e++;
|
|
85666
|
-
if (xc[0] == BASE) xc[0] = 1;
|
|
85667
|
-
}
|
|
85668
|
-
break;
|
|
85669
|
-
} else {
|
|
85670
|
-
xc[ni] += k;
|
|
85671
|
-
if (xc[ni] != BASE) break;
|
|
85672
|
-
xc[ni--] = 0;
|
|
85673
|
-
k = 1;
|
|
85674
|
-
}
|
|
85675
|
-
}
|
|
85676
|
-
}
|
|
85677
|
-
for (i = xc.length; xc[--i] === 0; xc.pop()) ;
|
|
85678
|
-
}
|
|
85679
|
-
if (x.e > MAX_EXP) {
|
|
85680
|
-
x.c = x.e = null;
|
|
85681
|
-
} else if (x.e < MIN_EXP) {
|
|
85682
|
-
x.c = [x.e = 0];
|
|
85683
|
-
}
|
|
85684
|
-
}
|
|
85685
|
-
return x;
|
|
85686
|
-
}
|
|
85687
|
-
function valueOf(n) {
|
|
85688
|
-
var str, e = n.e;
|
|
85689
|
-
if (e === null) return n.toString();
|
|
85690
|
-
str = coeffToString(n.c);
|
|
85691
|
-
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0");
|
|
85692
|
-
return n.s < 0 ? "-" + str : str;
|
|
85693
|
-
}
|
|
85694
|
-
P.absoluteValue = P.abs = function() {
|
|
85695
|
-
var x = new BigNumber3(this);
|
|
85696
|
-
if (x.s < 0) x.s = 1;
|
|
85697
|
-
return x;
|
|
85698
|
-
};
|
|
85699
|
-
P.comparedTo = function(y, b) {
|
|
85700
|
-
return compare(this, new BigNumber3(y, b));
|
|
85701
|
-
};
|
|
85702
|
-
P.decimalPlaces = P.dp = function(dp, rm) {
|
|
85703
|
-
var c, n, v, x = this;
|
|
85704
|
-
if (dp != null) {
|
|
85705
|
-
intCheck(dp, 0, MAX);
|
|
85706
|
-
if (rm == null) rm = ROUNDING_MODE;
|
|
85707
|
-
else intCheck(rm, 0, 8);
|
|
85708
|
-
return round(new BigNumber3(x), dp + x.e + 1, rm);
|
|
85709
|
-
}
|
|
85710
|
-
if (!(c = x.c)) return null;
|
|
85711
|
-
n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
|
|
85712
|
-
if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) ;
|
|
85713
|
-
if (n < 0) n = 0;
|
|
85714
|
-
return n;
|
|
85715
|
-
};
|
|
85716
|
-
P.dividedBy = P.div = function(y, b) {
|
|
85717
|
-
return div(this, new BigNumber3(y, b), DECIMAL_PLACES, ROUNDING_MODE);
|
|
85718
|
-
};
|
|
85719
|
-
P.dividedToIntegerBy = P.idiv = function(y, b) {
|
|
85720
|
-
return div(this, new BigNumber3(y, b), 0, 1);
|
|
85721
|
-
};
|
|
85722
|
-
P.exponentiatedBy = P.pow = function(n, m) {
|
|
85723
|
-
var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this;
|
|
85724
|
-
n = new BigNumber3(n);
|
|
85725
|
-
if (n.c && !n.isInteger()) {
|
|
85726
|
-
throw Error(bignumberError + "Exponent not an integer: " + valueOf(n));
|
|
85727
|
-
}
|
|
85728
|
-
if (m != null) m = new BigNumber3(m);
|
|
85729
|
-
nIsBig = n.e > 14;
|
|
85730
|
-
if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
|
|
85731
|
-
y = new BigNumber3(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));
|
|
85732
|
-
return m ? y.mod(m) : y;
|
|
85733
|
-
}
|
|
85734
|
-
nIsNeg = n.s < 0;
|
|
85735
|
-
if (m) {
|
|
85736
|
-
if (m.c ? !m.c[0] : !m.s) return new BigNumber3(NaN);
|
|
85737
|
-
isModExp = !nIsNeg && x.isInteger() && m.isInteger();
|
|
85738
|
-
if (isModExp) x = x.mod(m);
|
|
85739
|
-
} else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
|
|
85740
|
-
k = x.s < 0 && isOdd(n) ? -0 : 0;
|
|
85741
|
-
if (x.e > -1) k = 1 / k;
|
|
85742
|
-
return new BigNumber3(nIsNeg ? 1 / k : k);
|
|
85743
|
-
} else if (POW_PRECISION) {
|
|
85744
|
-
k = mathceil(POW_PRECISION / LOG_BASE + 2);
|
|
85745
|
-
}
|
|
85746
|
-
if (nIsBig) {
|
|
85747
|
-
half = new BigNumber3(0.5);
|
|
85748
|
-
if (nIsNeg) n.s = 1;
|
|
85749
|
-
nIsOdd = isOdd(n);
|
|
85750
|
-
} else {
|
|
85751
|
-
i = Math.abs(+valueOf(n));
|
|
85752
|
-
nIsOdd = i % 2;
|
|
85753
|
-
}
|
|
85754
|
-
y = new BigNumber3(ONE);
|
|
85755
|
-
for (; ; ) {
|
|
85756
|
-
if (nIsOdd) {
|
|
85757
|
-
y = y.times(x);
|
|
85758
|
-
if (!y.c) break;
|
|
85759
|
-
if (k) {
|
|
85760
|
-
if (y.c.length > k) y.c.length = k;
|
|
85761
|
-
} else if (isModExp) {
|
|
85762
|
-
y = y.mod(m);
|
|
85763
|
-
}
|
|
85764
|
-
}
|
|
85765
|
-
if (i) {
|
|
85766
|
-
i = mathfloor(i / 2);
|
|
85767
|
-
if (i === 0) break;
|
|
85768
|
-
nIsOdd = i % 2;
|
|
85769
|
-
} else {
|
|
85770
|
-
n = n.times(half);
|
|
85771
|
-
round(n, n.e + 1, 1);
|
|
85772
|
-
if (n.e > 14) {
|
|
85773
|
-
nIsOdd = isOdd(n);
|
|
85774
|
-
} else {
|
|
85775
|
-
i = +valueOf(n);
|
|
85776
|
-
if (i === 0) break;
|
|
85777
|
-
nIsOdd = i % 2;
|
|
85778
|
-
}
|
|
85779
|
-
}
|
|
85780
|
-
x = x.times(x);
|
|
85781
|
-
if (k) {
|
|
85782
|
-
if (x.c && x.c.length > k) x.c.length = k;
|
|
85783
|
-
} else if (isModExp) {
|
|
85784
|
-
x = x.mod(m);
|
|
85785
|
-
}
|
|
85786
|
-
}
|
|
85787
|
-
if (isModExp) return y;
|
|
85788
|
-
if (nIsNeg) y = ONE.div(y);
|
|
85789
|
-
return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
|
|
85790
|
-
};
|
|
85791
|
-
P.integerValue = function(rm) {
|
|
85792
|
-
var n = new BigNumber3(this);
|
|
85793
|
-
if (rm == null) rm = ROUNDING_MODE;
|
|
85794
|
-
else intCheck(rm, 0, 8);
|
|
85795
|
-
return round(n, n.e + 1, rm);
|
|
85796
|
-
};
|
|
85797
|
-
P.isEqualTo = P.eq = function(y, b) {
|
|
85798
|
-
return compare(this, new BigNumber3(y, b)) === 0;
|
|
85799
|
-
};
|
|
85800
|
-
P.isFinite = function() {
|
|
85801
|
-
return !!this.c;
|
|
85802
|
-
};
|
|
85803
|
-
P.isGreaterThan = P.gt = function(y, b) {
|
|
85804
|
-
return compare(this, new BigNumber3(y, b)) > 0;
|
|
85805
|
-
};
|
|
85806
|
-
P.isGreaterThanOrEqualTo = P.gte = function(y, b) {
|
|
85807
|
-
return (b = compare(this, new BigNumber3(y, b))) === 1 || b === 0;
|
|
85808
|
-
};
|
|
85809
|
-
P.isInteger = function() {
|
|
85810
|
-
return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
|
|
85811
|
-
};
|
|
85812
|
-
P.isLessThan = P.lt = function(y, b) {
|
|
85813
|
-
return compare(this, new BigNumber3(y, b)) < 0;
|
|
85814
|
-
};
|
|
85815
|
-
P.isLessThanOrEqualTo = P.lte = function(y, b) {
|
|
85816
|
-
return (b = compare(this, new BigNumber3(y, b))) === -1 || b === 0;
|
|
85817
|
-
};
|
|
85818
|
-
P.isNaN = function() {
|
|
85819
|
-
return !this.s;
|
|
85820
|
-
};
|
|
85821
|
-
P.isNegative = function() {
|
|
85822
|
-
return this.s < 0;
|
|
85823
|
-
};
|
|
85824
|
-
P.isPositive = function() {
|
|
85825
|
-
return this.s > 0;
|
|
85826
|
-
};
|
|
85827
|
-
P.isZero = function() {
|
|
85828
|
-
return !!this.c && this.c[0] == 0;
|
|
85829
|
-
};
|
|
85830
|
-
P.minus = function(y, b) {
|
|
85831
|
-
var i, j, t, xLTy, x = this, a = x.s;
|
|
85832
|
-
y = new BigNumber3(y, b);
|
|
85833
|
-
b = y.s;
|
|
85834
|
-
if (!a || !b) return new BigNumber3(NaN);
|
|
85835
|
-
if (a != b) {
|
|
85836
|
-
y.s = -b;
|
|
85837
|
-
return x.plus(y);
|
|
85838
|
-
}
|
|
85839
|
-
var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
|
|
85840
|
-
if (!xe || !ye) {
|
|
85841
|
-
if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber3(yc ? x : NaN);
|
|
85842
|
-
if (!xc[0] || !yc[0]) {
|
|
85843
|
-
return yc[0] ? (y.s = -b, y) : new BigNumber3(xc[0] ? x : (
|
|
85844
|
-
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
85845
|
-
ROUNDING_MODE == 3 ? -0 : 0
|
|
85846
|
-
));
|
|
85847
|
-
}
|
|
85848
|
-
}
|
|
85849
|
-
xe = bitFloor(xe);
|
|
85850
|
-
ye = bitFloor(ye);
|
|
85851
|
-
xc = xc.slice();
|
|
85852
|
-
if (a = xe - ye) {
|
|
85853
|
-
if (xLTy = a < 0) {
|
|
85854
|
-
a = -a;
|
|
85855
|
-
t = xc;
|
|
85856
|
-
} else {
|
|
85857
|
-
ye = xe;
|
|
85858
|
-
t = yc;
|
|
85859
|
-
}
|
|
85860
|
-
t.reverse();
|
|
85861
|
-
for (b = a; b--; t.push(0)) ;
|
|
85862
|
-
t.reverse();
|
|
85863
|
-
} else {
|
|
85864
|
-
j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
|
|
85865
|
-
for (a = b = 0; b < j; b++) {
|
|
85866
|
-
if (xc[b] != yc[b]) {
|
|
85867
|
-
xLTy = xc[b] < yc[b];
|
|
85868
|
-
break;
|
|
85869
|
-
}
|
|
85870
|
-
}
|
|
85871
|
-
}
|
|
85872
|
-
if (xLTy) {
|
|
85873
|
-
t = xc;
|
|
85874
|
-
xc = yc;
|
|
85875
|
-
yc = t;
|
|
85876
|
-
y.s = -y.s;
|
|
85877
|
-
}
|
|
85878
|
-
b = (j = yc.length) - (i = xc.length);
|
|
85879
|
-
if (b > 0) for (; b--; xc[i++] = 0) ;
|
|
85880
|
-
b = BASE - 1;
|
|
85881
|
-
for (; j > a; ) {
|
|
85882
|
-
if (xc[--j] < yc[j]) {
|
|
85883
|
-
for (i = j; i && !xc[--i]; xc[i] = b) ;
|
|
85884
|
-
--xc[i];
|
|
85885
|
-
xc[j] += BASE;
|
|
85886
|
-
}
|
|
85887
|
-
xc[j] -= yc[j];
|
|
85888
|
-
}
|
|
85889
|
-
for (; xc[0] == 0; xc.splice(0, 1), --ye) ;
|
|
85890
|
-
if (!xc[0]) {
|
|
85891
|
-
y.s = ROUNDING_MODE == 3 ? -1 : 1;
|
|
85892
|
-
y.c = [y.e = 0];
|
|
85893
|
-
return y;
|
|
85894
|
-
}
|
|
85895
|
-
return normalise(y, xc, ye);
|
|
85896
|
-
};
|
|
85897
|
-
P.modulo = P.mod = function(y, b) {
|
|
85898
|
-
var q, s, x = this;
|
|
85899
|
-
y = new BigNumber3(y, b);
|
|
85900
|
-
if (!x.c || !y.s || y.c && !y.c[0]) {
|
|
85901
|
-
return new BigNumber3(NaN);
|
|
85902
|
-
} else if (!y.c || x.c && !x.c[0]) {
|
|
85903
|
-
return new BigNumber3(x);
|
|
85904
|
-
}
|
|
85905
|
-
if (MODULO_MODE == 9) {
|
|
85906
|
-
s = y.s;
|
|
85907
|
-
y.s = 1;
|
|
85908
|
-
q = div(x, y, 0, 3);
|
|
85909
|
-
y.s = s;
|
|
85910
|
-
q.s *= s;
|
|
85911
|
-
} else {
|
|
85912
|
-
q = div(x, y, 0, MODULO_MODE);
|
|
85913
|
-
}
|
|
85914
|
-
y = x.minus(q.times(y));
|
|
85915
|
-
if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
|
|
85916
|
-
return y;
|
|
85917
|
-
};
|
|
85918
|
-
P.multipliedBy = P.times = function(y, b) {
|
|
85919
|
-
var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber3(y, b)).c;
|
|
85920
|
-
if (!xc || !yc || !xc[0] || !yc[0]) {
|
|
85921
|
-
if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
|
|
85922
|
-
y.c = y.e = y.s = null;
|
|
85923
|
-
} else {
|
|
85924
|
-
y.s *= x.s;
|
|
85925
|
-
if (!xc || !yc) {
|
|
85926
|
-
y.c = y.e = null;
|
|
85927
|
-
} else {
|
|
85928
|
-
y.c = [0];
|
|
85929
|
-
y.e = 0;
|
|
85930
|
-
}
|
|
85931
|
-
}
|
|
85932
|
-
return y;
|
|
85933
|
-
}
|
|
85934
|
-
e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
|
|
85935
|
-
y.s *= x.s;
|
|
85936
|
-
xcL = xc.length;
|
|
85937
|
-
ycL = yc.length;
|
|
85938
|
-
if (xcL < ycL) {
|
|
85939
|
-
zc = xc;
|
|
85940
|
-
xc = yc;
|
|
85941
|
-
yc = zc;
|
|
85942
|
-
i = xcL;
|
|
85943
|
-
xcL = ycL;
|
|
85944
|
-
ycL = i;
|
|
85945
|
-
}
|
|
85946
|
-
for (i = xcL + ycL, zc = []; i--; zc.push(0)) ;
|
|
85947
|
-
base = BASE;
|
|
85948
|
-
sqrtBase = SQRT_BASE;
|
|
85949
|
-
for (i = ycL; --i >= 0; ) {
|
|
85950
|
-
c = 0;
|
|
85951
|
-
ylo = yc[i] % sqrtBase;
|
|
85952
|
-
yhi = yc[i] / sqrtBase | 0;
|
|
85953
|
-
for (k = xcL, j = i + k; j > i; ) {
|
|
85954
|
-
xlo = xc[--k] % sqrtBase;
|
|
85955
|
-
xhi = xc[k] / sqrtBase | 0;
|
|
85956
|
-
m = yhi * xlo + xhi * ylo;
|
|
85957
|
-
xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;
|
|
85958
|
-
c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
|
|
85959
|
-
zc[j--] = xlo % base;
|
|
85960
|
-
}
|
|
85961
|
-
zc[j] = c;
|
|
85962
|
-
}
|
|
85963
|
-
if (c) {
|
|
85964
|
-
++e;
|
|
85965
|
-
} else {
|
|
85966
|
-
zc.splice(0, 1);
|
|
85967
|
-
}
|
|
85968
|
-
return normalise(y, zc, e);
|
|
85969
|
-
};
|
|
85970
|
-
P.negated = function() {
|
|
85971
|
-
var x = new BigNumber3(this);
|
|
85972
|
-
x.s = -x.s || null;
|
|
85973
|
-
return x;
|
|
85974
|
-
};
|
|
85975
|
-
P.plus = function(y, b) {
|
|
85976
|
-
var t, x = this, a = x.s;
|
|
85977
|
-
y = new BigNumber3(y, b);
|
|
85978
|
-
b = y.s;
|
|
85979
|
-
if (!a || !b) return new BigNumber3(NaN);
|
|
85980
|
-
if (a != b) {
|
|
85981
|
-
y.s = -b;
|
|
85982
|
-
return x.minus(y);
|
|
85983
|
-
}
|
|
85984
|
-
var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
|
|
85985
|
-
if (!xe || !ye) {
|
|
85986
|
-
if (!xc || !yc) return new BigNumber3(a / 0);
|
|
85987
|
-
if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber3(xc[0] ? x : a * 0);
|
|
85988
|
-
}
|
|
85989
|
-
xe = bitFloor(xe);
|
|
85990
|
-
ye = bitFloor(ye);
|
|
85991
|
-
xc = xc.slice();
|
|
85992
|
-
if (a = xe - ye) {
|
|
85993
|
-
if (a > 0) {
|
|
85994
|
-
ye = xe;
|
|
85995
|
-
t = yc;
|
|
85996
|
-
} else {
|
|
85997
|
-
a = -a;
|
|
85998
|
-
t = xc;
|
|
85999
|
-
}
|
|
86000
|
-
t.reverse();
|
|
86001
|
-
for (; a--; t.push(0)) ;
|
|
86002
|
-
t.reverse();
|
|
86003
|
-
}
|
|
86004
|
-
a = xc.length;
|
|
86005
|
-
b = yc.length;
|
|
86006
|
-
if (a - b < 0) {
|
|
86007
|
-
t = yc;
|
|
86008
|
-
yc = xc;
|
|
86009
|
-
xc = t;
|
|
86010
|
-
b = a;
|
|
86011
|
-
}
|
|
86012
|
-
for (a = 0; b; ) {
|
|
86013
|
-
a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
|
|
86014
|
-
xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
|
|
86015
|
-
}
|
|
86016
|
-
if (a) {
|
|
86017
|
-
xc = [a].concat(xc);
|
|
86018
|
-
++ye;
|
|
86019
|
-
}
|
|
86020
|
-
return normalise(y, xc, ye);
|
|
86021
|
-
};
|
|
86022
|
-
P.precision = P.sd = function(sd, rm) {
|
|
86023
|
-
var c, n, v, x = this;
|
|
86024
|
-
if (sd != null && sd !== !!sd) {
|
|
86025
|
-
intCheck(sd, 1, MAX);
|
|
86026
|
-
if (rm == null) rm = ROUNDING_MODE;
|
|
86027
|
-
else intCheck(rm, 0, 8);
|
|
86028
|
-
return round(new BigNumber3(x), sd, rm);
|
|
86029
|
-
}
|
|
86030
|
-
if (!(c = x.c)) return null;
|
|
86031
|
-
v = c.length - 1;
|
|
86032
|
-
n = v * LOG_BASE + 1;
|
|
86033
|
-
if (v = c[v]) {
|
|
86034
|
-
for (; v % 10 == 0; v /= 10, n--) ;
|
|
86035
|
-
for (v = c[0]; v >= 10; v /= 10, n++) ;
|
|
86036
|
-
}
|
|
86037
|
-
if (sd && x.e + 1 > n) n = x.e + 1;
|
|
86038
|
-
return n;
|
|
86039
|
-
};
|
|
86040
|
-
P.shiftedBy = function(k) {
|
|
86041
|
-
intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
|
|
86042
|
-
return this.times("1e" + k);
|
|
86043
|
-
};
|
|
86044
|
-
P.squareRoot = P.sqrt = function() {
|
|
86045
|
-
var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber3("0.5");
|
|
86046
|
-
if (s !== 1 || !c || !c[0]) {
|
|
86047
|
-
return new BigNumber3(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
|
|
86048
|
-
}
|
|
86049
|
-
s = Math.sqrt(+valueOf(x));
|
|
86050
|
-
if (s == 0 || s == 1 / 0) {
|
|
86051
|
-
n = coeffToString(c);
|
|
86052
|
-
if ((n.length + e) % 2 == 0) n += "0";
|
|
86053
|
-
s = Math.sqrt(+n);
|
|
86054
|
-
e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
|
|
86055
|
-
if (s == 1 / 0) {
|
|
86056
|
-
n = "5e" + e;
|
|
86057
|
-
} else {
|
|
86058
|
-
n = s.toExponential();
|
|
86059
|
-
n = n.slice(0, n.indexOf("e") + 1) + e;
|
|
86060
|
-
}
|
|
86061
|
-
r = new BigNumber3(n);
|
|
86062
|
-
} else {
|
|
86063
|
-
r = new BigNumber3(s + "");
|
|
86064
|
-
}
|
|
86065
|
-
if (r.c[0]) {
|
|
86066
|
-
e = r.e;
|
|
86067
|
-
s = e + dp;
|
|
86068
|
-
if (s < 3) s = 0;
|
|
86069
|
-
for (; ; ) {
|
|
86070
|
-
t = r;
|
|
86071
|
-
r = half.times(t.plus(div(x, t, dp, 1)));
|
|
86072
|
-
if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
|
|
86073
|
-
if (r.e < e) --s;
|
|
86074
|
-
n = n.slice(s - 3, s + 1);
|
|
86075
|
-
if (n == "9999" || !rep && n == "4999") {
|
|
86076
|
-
if (!rep) {
|
|
86077
|
-
round(t, t.e + DECIMAL_PLACES + 2, 0);
|
|
86078
|
-
if (t.times(t).eq(x)) {
|
|
86079
|
-
r = t;
|
|
86080
|
-
break;
|
|
86081
|
-
}
|
|
86082
|
-
}
|
|
86083
|
-
dp += 4;
|
|
86084
|
-
s += 4;
|
|
86085
|
-
rep = 1;
|
|
86086
|
-
} else {
|
|
86087
|
-
if (!+n || !+n.slice(1) && n.charAt(0) == "5") {
|
|
86088
|
-
round(r, r.e + DECIMAL_PLACES + 2, 1);
|
|
86089
|
-
m = !r.times(r).eq(x);
|
|
86090
|
-
}
|
|
86091
|
-
break;
|
|
86092
|
-
}
|
|
86093
|
-
}
|
|
86094
|
-
}
|
|
86095
|
-
}
|
|
86096
|
-
return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
|
|
86097
|
-
};
|
|
86098
|
-
P.toExponential = function(dp, rm) {
|
|
86099
|
-
if (dp != null) {
|
|
86100
|
-
intCheck(dp, 0, MAX);
|
|
86101
|
-
dp++;
|
|
86102
|
-
}
|
|
86103
|
-
return format(this, dp, rm, 1);
|
|
86104
|
-
};
|
|
86105
|
-
P.toFixed = function(dp, rm) {
|
|
86106
|
-
if (dp != null) {
|
|
86107
|
-
intCheck(dp, 0, MAX);
|
|
86108
|
-
dp = dp + this.e + 1;
|
|
86109
|
-
}
|
|
86110
|
-
return format(this, dp, rm);
|
|
86111
|
-
};
|
|
86112
|
-
P.toFormat = function(dp, rm, format2) {
|
|
86113
|
-
var str, x = this;
|
|
86114
|
-
if (format2 == null) {
|
|
86115
|
-
if (dp != null && rm && typeof rm == "object") {
|
|
86116
|
-
format2 = rm;
|
|
86117
|
-
rm = null;
|
|
86118
|
-
} else if (dp && typeof dp == "object") {
|
|
86119
|
-
format2 = dp;
|
|
86120
|
-
dp = rm = null;
|
|
86121
|
-
} else {
|
|
86122
|
-
format2 = FORMAT;
|
|
86123
|
-
}
|
|
86124
|
-
} else if (typeof format2 != "object") {
|
|
86125
|
-
throw Error(bignumberError + "Argument not an object: " + format2);
|
|
86126
|
-
}
|
|
86127
|
-
str = x.toFixed(dp, rm);
|
|
86128
|
-
if (x.c) {
|
|
86129
|
-
var i, arr = str.split("."), g1 = +format2.groupSize, g2 = +format2.secondaryGroupSize, groupSeparator = format2.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
|
|
86130
|
-
if (g2) {
|
|
86131
|
-
i = g1;
|
|
86132
|
-
g1 = g2;
|
|
86133
|
-
g2 = i;
|
|
86134
|
-
len -= i;
|
|
86135
|
-
}
|
|
86136
|
-
if (g1 > 0 && len > 0) {
|
|
86137
|
-
i = len % g1 || g1;
|
|
86138
|
-
intPart = intDigits.substr(0, i);
|
|
86139
|
-
for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
|
|
86140
|
-
if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
|
|
86141
|
-
if (isNeg) intPart = "-" + intPart;
|
|
86142
|
-
}
|
|
86143
|
-
str = fractionPart ? intPart + (format2.decimalSeparator || "") + ((g2 = +format2.fractionGroupSize) ? fractionPart.replace(
|
|
86144
|
-
new RegExp("\\d{" + g2 + "}\\B", "g"),
|
|
86145
|
-
"$&" + (format2.fractionGroupSeparator || "")
|
|
86146
|
-
) : fractionPart) : intPart;
|
|
86147
|
-
}
|
|
86148
|
-
return (format2.prefix || "") + str + (format2.suffix || "");
|
|
86149
|
-
};
|
|
86150
|
-
P.toFraction = function(md) {
|
|
86151
|
-
var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c;
|
|
86152
|
-
if (md != null) {
|
|
86153
|
-
n = new BigNumber3(md);
|
|
86154
|
-
if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
|
|
86155
|
-
throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n));
|
|
86156
|
-
}
|
|
86157
|
-
}
|
|
86158
|
-
if (!xc) return new BigNumber3(x);
|
|
86159
|
-
d = new BigNumber3(ONE);
|
|
86160
|
-
n1 = d0 = new BigNumber3(ONE);
|
|
86161
|
-
d1 = n0 = new BigNumber3(ONE);
|
|
86162
|
-
s = coeffToString(xc);
|
|
86163
|
-
e = d.e = s.length - x.e - 1;
|
|
86164
|
-
d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
|
|
86165
|
-
md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;
|
|
86166
|
-
exp = MAX_EXP;
|
|
86167
|
-
MAX_EXP = 1 / 0;
|
|
86168
|
-
n = new BigNumber3(s);
|
|
86169
|
-
n0.c[0] = 0;
|
|
86170
|
-
for (; ; ) {
|
|
86171
|
-
q = div(n, d, 0, 1);
|
|
86172
|
-
d2 = d0.plus(q.times(d1));
|
|
86173
|
-
if (d2.comparedTo(md) == 1) break;
|
|
86174
|
-
d0 = d1;
|
|
86175
|
-
d1 = d2;
|
|
86176
|
-
n1 = n0.plus(q.times(d2 = n1));
|
|
86177
|
-
n0 = d2;
|
|
86178
|
-
d = n.minus(q.times(d2 = d));
|
|
86179
|
-
n = d2;
|
|
86180
|
-
}
|
|
86181
|
-
d2 = div(md.minus(d0), d1, 0, 1);
|
|
86182
|
-
n0 = n0.plus(d2.times(n1));
|
|
86183
|
-
d0 = d0.plus(d2.times(d1));
|
|
86184
|
-
n0.s = n1.s = x.s;
|
|
86185
|
-
e = e * 2;
|
|
86186
|
-
r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
|
|
86187
|
-
div(n0, d0, e, ROUNDING_MODE).minus(x).abs()
|
|
86188
|
-
) < 1 ? [n1, d1] : [n0, d0];
|
|
86189
|
-
MAX_EXP = exp;
|
|
86190
|
-
return r;
|
|
86191
|
-
};
|
|
86192
|
-
P.toNumber = function() {
|
|
86193
|
-
return +valueOf(this);
|
|
86194
|
-
};
|
|
86195
|
-
P.toPrecision = function(sd, rm) {
|
|
86196
|
-
if (sd != null) intCheck(sd, 1, MAX);
|
|
86197
|
-
return format(this, sd, rm, 2);
|
|
86198
|
-
};
|
|
86199
|
-
P.toString = function(b) {
|
|
86200
|
-
var str, n = this, s = n.s, e = n.e;
|
|
86201
|
-
if (e === null) {
|
|
86202
|
-
if (s) {
|
|
86203
|
-
str = "Infinity";
|
|
86204
|
-
if (s < 0) str = "-" + str;
|
|
86205
|
-
} else {
|
|
86206
|
-
str = "NaN";
|
|
86207
|
-
}
|
|
86208
|
-
} else {
|
|
86209
|
-
if (b == null) {
|
|
86210
|
-
str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0");
|
|
86211
|
-
} else if (b === 10 && alphabetHasNormalDecimalDigits) {
|
|
86212
|
-
n = round(new BigNumber3(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
|
|
86213
|
-
str = toFixedPoint(coeffToString(n.c), n.e, "0");
|
|
86214
|
-
} else {
|
|
86215
|
-
intCheck(b, 2, ALPHABET.length, "Base");
|
|
86216
|
-
str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true);
|
|
86217
|
-
}
|
|
86218
|
-
if (s < 0 && n.c[0]) str = "-" + str;
|
|
86219
|
-
}
|
|
86220
|
-
return str;
|
|
86221
|
-
};
|
|
86222
|
-
P.valueOf = P.toJSON = function() {
|
|
86223
|
-
return valueOf(this);
|
|
86224
|
-
};
|
|
86225
|
-
P._isBigNumber = true;
|
|
86226
|
-
P[Symbol.toStringTag] = "BigNumber";
|
|
86227
|
-
P[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")] = P.valueOf;
|
|
86228
|
-
if (configObject != null) BigNumber3.set(configObject);
|
|
86229
|
-
return BigNumber3;
|
|
86230
|
-
}
|
|
86231
|
-
function bitFloor(n) {
|
|
86232
|
-
var i = n | 0;
|
|
86233
|
-
return n > 0 || n === i ? i : i - 1;
|
|
86234
|
-
}
|
|
86235
|
-
function coeffToString(a) {
|
|
86236
|
-
var s, z3, i = 1, j = a.length, r = a[0] + "";
|
|
86237
|
-
for (; i < j; ) {
|
|
86238
|
-
s = a[i++] + "";
|
|
86239
|
-
z3 = LOG_BASE - s.length;
|
|
86240
|
-
for (; z3--; s = "0" + s) ;
|
|
86241
|
-
r += s;
|
|
86242
|
-
}
|
|
86243
|
-
for (j = r.length; r.charCodeAt(--j) === 48; ) ;
|
|
86244
|
-
return r.slice(0, j + 1 || 1);
|
|
86245
|
-
}
|
|
86246
|
-
function compare(x, y) {
|
|
86247
|
-
var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e;
|
|
86248
|
-
if (!i || !j) return null;
|
|
86249
|
-
a = xc && !xc[0];
|
|
86250
|
-
b = yc && !yc[0];
|
|
86251
|
-
if (a || b) return a ? b ? 0 : -j : i;
|
|
86252
|
-
if (i != j) return i;
|
|
86253
|
-
a = i < 0;
|
|
86254
|
-
b = k == l;
|
|
86255
|
-
if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
|
|
86256
|
-
if (!b) return k > l ^ a ? 1 : -1;
|
|
86257
|
-
j = (k = xc.length) < (l = yc.length) ? k : l;
|
|
86258
|
-
for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
|
|
86259
|
-
return k == l ? 0 : k > l ^ a ? 1 : -1;
|
|
86260
|
-
}
|
|
86261
|
-
function intCheck(n, min, max, name) {
|
|
86262
|
-
if (n < min || n > max || n !== mathfloor(n)) {
|
|
86263
|
-
throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
|
|
86264
|
-
}
|
|
86265
|
-
}
|
|
86266
|
-
function isOdd(n) {
|
|
86267
|
-
var k = n.c.length - 1;
|
|
86268
|
-
return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
|
|
86269
|
-
}
|
|
86270
|
-
function toExponential(str, e) {
|
|
86271
|
-
return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e;
|
|
86272
|
-
}
|
|
86273
|
-
function toFixedPoint(str, e, z3) {
|
|
86274
|
-
var len, zs;
|
|
86275
|
-
if (e < 0) {
|
|
86276
|
-
for (zs = z3 + "."; ++e; zs += z3) ;
|
|
86277
|
-
str = zs + str;
|
|
86278
|
-
} else {
|
|
86279
|
-
len = str.length;
|
|
86280
|
-
if (++e > len) {
|
|
86281
|
-
for (zs = z3, e -= len; --e; zs += z3) ;
|
|
86282
|
-
str += zs;
|
|
86283
|
-
} else if (e < len) {
|
|
86284
|
-
str = str.slice(0, e) + "." + str.slice(e);
|
|
86285
|
-
}
|
|
86286
|
-
}
|
|
86287
|
-
return str;
|
|
86288
|
-
}
|
|
86289
|
-
var BigNumber = clone2();
|
|
86290
|
-
|
|
86291
|
-
// lib/json.ts
|
|
86292
84947
|
var JSONbigParser = (0, import_json_bigint.default)({ storeAsString: false });
|
|
86293
84948
|
var JSONbigSerializer = (0, import_json_bigint.default)({ useNativeBigInt: true });
|
|
86294
84949
|
var MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
86295
84950
|
var MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER);
|
|
84951
|
+
function isBigNumber(value) {
|
|
84952
|
+
return value !== null && typeof value === "object" && value._isBigNumber === true && typeof value.isInteger === "function" && typeof value.toFixed === "function" && typeof value.toNumber === "function";
|
|
84953
|
+
}
|
|
86296
84954
|
function reviver(_key, value) {
|
|
86297
|
-
if (
|
|
84955
|
+
if (isBigNumber(value)) {
|
|
86298
84956
|
if (value.isInteger()) {
|
|
86299
84957
|
const str = value.toFixed();
|
|
86300
84958
|
const bi = BigInt(str);
|
|
@@ -87411,7 +86069,7 @@ import path from "path";
|
|
|
87411
86069
|
|
|
87412
86070
|
// node_modules/@appwrite.io/console/dist/esm/sdk.js
|
|
87413
86071
|
var import_json_bigint2 = __toESM(require_json_bigint(), 1);
|
|
87414
|
-
var
|
|
86072
|
+
var import_bignumber = __toESM(require_bignumber2(), 1);
|
|
87415
86073
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
87416
86074
|
function adopt(value) {
|
|
87417
86075
|
return value instanceof P ? value : new P(function(resolve3) {
|
|
@@ -87532,7 +86190,7 @@ var JSONbigSerializer2 = (0, import_json_bigint2.default)({ useNativeBigInt: tru
|
|
|
87532
86190
|
var MAX_SAFE2 = BigInt(Number.MAX_SAFE_INTEGER);
|
|
87533
86191
|
var MIN_SAFE2 = BigInt(Number.MIN_SAFE_INTEGER);
|
|
87534
86192
|
function reviver2(_key, value) {
|
|
87535
|
-
if (
|
|
86193
|
+
if (import_bignumber.default.isBigNumber(value)) {
|
|
87536
86194
|
if (value.isInteger()) {
|
|
87537
86195
|
const str = value.toFixed();
|
|
87538
86196
|
const bi = BigInt(str);
|
|
@@ -87586,7 +86244,7 @@ var Client = class _Client {
|
|
|
87586
86244
|
"x-sdk-name": "Console",
|
|
87587
86245
|
"x-sdk-platform": "console",
|
|
87588
86246
|
"x-sdk-language": "web",
|
|
87589
|
-
"x-sdk-version": "2.
|
|
86247
|
+
"x-sdk-version": "2.3.1",
|
|
87590
86248
|
"X-Appwrite-Response-Format": "1.8.0"
|
|
87591
86249
|
};
|
|
87592
86250
|
this.realtime = {
|
|
@@ -87595,7 +86253,10 @@ var Client = class _Client {
|
|
|
87595
86253
|
heartbeat: void 0,
|
|
87596
86254
|
url: "",
|
|
87597
86255
|
channels: /* @__PURE__ */ new Set(),
|
|
86256
|
+
queries: /* @__PURE__ */ new Set(),
|
|
87598
86257
|
subscriptions: /* @__PURE__ */ new Map(),
|
|
86258
|
+
slotToSubscriptionId: /* @__PURE__ */ new Map(),
|
|
86259
|
+
subscriptionIdToSlot: /* @__PURE__ */ new Map(),
|
|
87599
86260
|
subscriptionsCounter: 0,
|
|
87600
86261
|
reconnect: true,
|
|
87601
86262
|
reconnectAttempts: 0,
|
|
@@ -87630,24 +86291,31 @@ var Client = class _Client {
|
|
|
87630
86291
|
}, 2e4);
|
|
87631
86292
|
},
|
|
87632
86293
|
createSocket: () => {
|
|
87633
|
-
var _a3, _b, _c;
|
|
87634
|
-
if (this.realtime.
|
|
86294
|
+
var _a3, _b, _c, _d;
|
|
86295
|
+
if (this.realtime.subscriptions.size < 1) {
|
|
87635
86296
|
this.realtime.reconnect = false;
|
|
87636
86297
|
(_a3 = this.realtime.socket) === null || _a3 === void 0 ? void 0 : _a3.close();
|
|
87637
86298
|
return;
|
|
87638
86299
|
}
|
|
87639
|
-
const
|
|
87640
|
-
|
|
87641
|
-
channels.set("project", this.config.project);
|
|
87642
|
-
}
|
|
86300
|
+
const encodedProject = encodeURIComponent((_b = this.config.project) !== null && _b !== void 0 ? _b : "");
|
|
86301
|
+
let queryParams = "project=" + encodedProject;
|
|
87643
86302
|
this.realtime.channels.forEach((channel) => {
|
|
87644
|
-
|
|
86303
|
+
queryParams += "&channels[]=" + encodeURIComponent(channel);
|
|
87645
86304
|
});
|
|
87646
|
-
const
|
|
86305
|
+
const selectAllQuery = Query.select(["*"]).toString();
|
|
86306
|
+
this.realtime.subscriptions.forEach((sub, slot) => {
|
|
86307
|
+
const queries = sub.queries.length > 0 ? sub.queries : [selectAllQuery];
|
|
86308
|
+
sub.channels.forEach((channel) => {
|
|
86309
|
+
queries.forEach((query) => {
|
|
86310
|
+
queryParams += "&" + encodeURIComponent(channel) + "[" + slot + "][]=" + encodeURIComponent(query);
|
|
86311
|
+
});
|
|
86312
|
+
});
|
|
86313
|
+
});
|
|
86314
|
+
const url2 = this.config.endpointRealtime + "/realtime?" + queryParams;
|
|
87647
86315
|
if (url2 !== this.realtime.url || // Check if URL is present
|
|
87648
86316
|
!this.realtime.socket || // Check if WebSocket has not been created
|
|
87649
|
-
((
|
|
87650
|
-
if (this.realtime.socket && ((
|
|
86317
|
+
((_c = this.realtime.socket) === null || _c === void 0 ? void 0 : _c.readyState) > WebSocket.OPEN) {
|
|
86318
|
+
if (this.realtime.socket && ((_d = this.realtime.socket) === null || _d === void 0 ? void 0 : _d.readyState) < WebSocket.CLOSING) {
|
|
87651
86319
|
this.realtime.reconnect = false;
|
|
87652
86320
|
this.realtime.socket.close();
|
|
87653
86321
|
}
|
|
@@ -87680,14 +86348,25 @@ var Client = class _Client {
|
|
|
87680
86348
|
const message = JSONbig.parse(event.data);
|
|
87681
86349
|
this.realtime.lastMessage = message;
|
|
87682
86350
|
switch (message.type) {
|
|
87683
|
-
case "connected":
|
|
86351
|
+
case "connected": {
|
|
86352
|
+
const messageData = message.data;
|
|
86353
|
+
if (messageData === null || messageData === void 0 ? void 0 : messageData.subscriptions) {
|
|
86354
|
+
this.realtime.slotToSubscriptionId.clear();
|
|
86355
|
+
this.realtime.subscriptionIdToSlot.clear();
|
|
86356
|
+
for (const [slotStr, subscriptionId] of Object.entries(messageData.subscriptions)) {
|
|
86357
|
+
const slot = Number(slotStr);
|
|
86358
|
+
if (!isNaN(slot) && typeof subscriptionId === "string") {
|
|
86359
|
+
this.realtime.slotToSubscriptionId.set(slot, subscriptionId);
|
|
86360
|
+
this.realtime.subscriptionIdToSlot.set(subscriptionId, slot);
|
|
86361
|
+
}
|
|
86362
|
+
}
|
|
86363
|
+
}
|
|
87684
86364
|
let session = this.config.session;
|
|
87685
86365
|
if (!session) {
|
|
87686
86366
|
const cookie = JSONbig.parse((_a3 = window.localStorage.getItem("cookieFallback")) !== null && _a3 !== void 0 ? _a3 : "{}");
|
|
87687
86367
|
session = cookie === null || cookie === void 0 ? void 0 : cookie[`a_session_${this.config.project}`];
|
|
87688
86368
|
}
|
|
87689
|
-
|
|
87690
|
-
if (session && !messageData.user) {
|
|
86369
|
+
if (session && !(messageData === null || messageData === void 0 ? void 0 : messageData.user)) {
|
|
87691
86370
|
(_b = this.realtime.socket) === null || _b === void 0 ? void 0 : _b.send(JSONbig.stringify({
|
|
87692
86371
|
type: "authentication",
|
|
87693
86372
|
data: {
|
|
@@ -87696,12 +86375,26 @@ var Client = class _Client {
|
|
|
87696
86375
|
}));
|
|
87697
86376
|
}
|
|
87698
86377
|
break;
|
|
87699
|
-
|
|
87700
|
-
|
|
87701
|
-
|
|
86378
|
+
}
|
|
86379
|
+
case "event": {
|
|
86380
|
+
const data = message.data;
|
|
86381
|
+
if (!(data === null || data === void 0 ? void 0 : data.channels))
|
|
86382
|
+
break;
|
|
86383
|
+
const eventSubIds = data.subscriptions;
|
|
86384
|
+
if (eventSubIds && eventSubIds.length > 0) {
|
|
86385
|
+
for (const subscriptionId of eventSubIds) {
|
|
86386
|
+
const slot = this.realtime.subscriptionIdToSlot.get(subscriptionId);
|
|
86387
|
+
if (slot !== void 0) {
|
|
86388
|
+
const subscription = this.realtime.subscriptions.get(slot);
|
|
86389
|
+
if (subscription) {
|
|
86390
|
+
setTimeout(() => subscription.callback(data));
|
|
86391
|
+
}
|
|
86392
|
+
}
|
|
86393
|
+
}
|
|
86394
|
+
} else {
|
|
87702
86395
|
const isSubscribed = data.channels.some((channel) => this.realtime.channels.has(channel));
|
|
87703
86396
|
if (!isSubscribed)
|
|
87704
|
-
|
|
86397
|
+
break;
|
|
87705
86398
|
this.realtime.subscriptions.forEach((subscription) => {
|
|
87706
86399
|
if (data.channels.some((channel) => subscription.channels.includes(channel))) {
|
|
87707
86400
|
setTimeout(() => subscription.callback(data));
|
|
@@ -87709,6 +86402,7 @@ var Client = class _Client {
|
|
|
87709
86402
|
});
|
|
87710
86403
|
}
|
|
87711
86404
|
break;
|
|
86405
|
+
}
|
|
87712
86406
|
case "pong":
|
|
87713
86407
|
break;
|
|
87714
86408
|
// Handle pong response if needed
|
|
@@ -87721,7 +86415,7 @@ var Client = class _Client {
|
|
|
87721
86415
|
console.error(e);
|
|
87722
86416
|
}
|
|
87723
86417
|
},
|
|
87724
|
-
cleanUp: (channels) => {
|
|
86418
|
+
cleanUp: (channels, queries) => {
|
|
87725
86419
|
this.realtime.channels.forEach((channel) => {
|
|
87726
86420
|
if (channels.includes(channel)) {
|
|
87727
86421
|
let found = Array.from(this.realtime.subscriptions).some(([_key, subscription]) => {
|
|
@@ -87732,6 +86426,17 @@ var Client = class _Client {
|
|
|
87732
86426
|
}
|
|
87733
86427
|
}
|
|
87734
86428
|
});
|
|
86429
|
+
this.realtime.queries.forEach((query) => {
|
|
86430
|
+
if (queries.includes(query)) {
|
|
86431
|
+
let found = Array.from(this.realtime.subscriptions).some(([_key, subscription]) => {
|
|
86432
|
+
var _a3;
|
|
86433
|
+
return (_a3 = subscription.queries) === null || _a3 === void 0 ? void 0 : _a3.includes(query);
|
|
86434
|
+
});
|
|
86435
|
+
if (!found) {
|
|
86436
|
+
this.realtime.queries.delete(query);
|
|
86437
|
+
}
|
|
86438
|
+
}
|
|
86439
|
+
});
|
|
87735
86440
|
}
|
|
87736
86441
|
};
|
|
87737
86442
|
}
|
|
@@ -87912,7 +86617,7 @@ var Client = class _Client {
|
|
|
87912
86617
|
* @param {(payload: RealtimeMessage) => void} callback Is called on every realtime update.
|
|
87913
86618
|
* @returns {() => void} Unsubscribes from events.
|
|
87914
86619
|
*/
|
|
87915
|
-
subscribe(channels, callback) {
|
|
86620
|
+
subscribe(channels, callback, queries = []) {
|
|
87916
86621
|
const channelArray = Array.isArray(channels) ? channels : [channels];
|
|
87917
86622
|
const channelStrings = channelArray.map((ch) => {
|
|
87918
86623
|
if (typeof ch === "string") {
|
|
@@ -87924,15 +86629,18 @@ var Client = class _Client {
|
|
|
87924
86629
|
return String(ch);
|
|
87925
86630
|
});
|
|
87926
86631
|
channelStrings.forEach((channel) => this.realtime.channels.add(channel));
|
|
86632
|
+
const queryStrings = (queries !== null && queries !== void 0 ? queries : []).map((q) => typeof q === "string" ? q : q.toString());
|
|
86633
|
+
queryStrings.forEach((query) => this.realtime.queries.add(query));
|
|
87927
86634
|
const counter = this.realtime.subscriptionsCounter++;
|
|
87928
86635
|
this.realtime.subscriptions.set(counter, {
|
|
87929
86636
|
channels: channelStrings,
|
|
86637
|
+
queries: queryStrings,
|
|
87930
86638
|
callback
|
|
87931
86639
|
});
|
|
87932
86640
|
this.realtime.connect();
|
|
87933
86641
|
return () => {
|
|
87934
86642
|
this.realtime.subscriptions.delete(counter);
|
|
87935
|
-
this.realtime.cleanUp(channelStrings);
|
|
86643
|
+
this.realtime.cleanUp(channelStrings, queryStrings);
|
|
87936
86644
|
this.realtime.connect();
|
|
87937
86645
|
};
|
|
87938
86646
|
}
|
|
@@ -89813,7 +88521,8 @@ var Databases = class {
|
|
|
89813
88521
|
key: rest[1],
|
|
89814
88522
|
required: rest[2],
|
|
89815
88523
|
xdefault: rest[3],
|
|
89816
|
-
array: rest[4]
|
|
88524
|
+
array: rest[4],
|
|
88525
|
+
encrypt: rest[5]
|
|
89817
88526
|
};
|
|
89818
88527
|
}
|
|
89819
88528
|
const databaseId = params.databaseId;
|
|
@@ -89822,6 +88531,7 @@ var Databases = class {
|
|
|
89822
88531
|
const required2 = params.required;
|
|
89823
88532
|
const xdefault = params.xdefault;
|
|
89824
88533
|
const array2 = params.array;
|
|
88534
|
+
const encrypt = params.encrypt;
|
|
89825
88535
|
if (typeof databaseId === "undefined") {
|
|
89826
88536
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
89827
88537
|
}
|
|
@@ -89848,6 +88558,9 @@ var Databases = class {
|
|
|
89848
88558
|
if (typeof array2 !== "undefined") {
|
|
89849
88559
|
payload["array"] = array2;
|
|
89850
88560
|
}
|
|
88561
|
+
if (typeof encrypt !== "undefined") {
|
|
88562
|
+
payload["encrypt"] = encrypt;
|
|
88563
|
+
}
|
|
89851
88564
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
89852
88565
|
const apiHeaders = {
|
|
89853
88566
|
"content-type": "application/json"
|
|
@@ -89917,7 +88630,8 @@ var Databases = class {
|
|
|
89917
88630
|
key: rest[1],
|
|
89918
88631
|
required: rest[2],
|
|
89919
88632
|
xdefault: rest[3],
|
|
89920
|
-
array: rest[4]
|
|
88633
|
+
array: rest[4],
|
|
88634
|
+
encrypt: rest[5]
|
|
89921
88635
|
};
|
|
89922
88636
|
}
|
|
89923
88637
|
const databaseId = params.databaseId;
|
|
@@ -89926,6 +88640,7 @@ var Databases = class {
|
|
|
89926
88640
|
const required2 = params.required;
|
|
89927
88641
|
const xdefault = params.xdefault;
|
|
89928
88642
|
const array2 = params.array;
|
|
88643
|
+
const encrypt = params.encrypt;
|
|
89929
88644
|
if (typeof databaseId === "undefined") {
|
|
89930
88645
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
89931
88646
|
}
|
|
@@ -89952,6 +88667,9 @@ var Databases = class {
|
|
|
89952
88667
|
if (typeof array2 !== "undefined") {
|
|
89953
88668
|
payload["array"] = array2;
|
|
89954
88669
|
}
|
|
88670
|
+
if (typeof encrypt !== "undefined") {
|
|
88671
|
+
payload["encrypt"] = encrypt;
|
|
88672
|
+
}
|
|
89955
88673
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
89956
88674
|
const apiHeaders = {
|
|
89957
88675
|
"content-type": "application/json"
|
|
@@ -90397,7 +89115,8 @@ var Databases = class {
|
|
|
90397
89115
|
key: rest[1],
|
|
90398
89116
|
required: rest[2],
|
|
90399
89117
|
xdefault: rest[3],
|
|
90400
|
-
array: rest[4]
|
|
89118
|
+
array: rest[4],
|
|
89119
|
+
encrypt: rest[5]
|
|
90401
89120
|
};
|
|
90402
89121
|
}
|
|
90403
89122
|
const databaseId = params.databaseId;
|
|
@@ -90406,6 +89125,7 @@ var Databases = class {
|
|
|
90406
89125
|
const required2 = params.required;
|
|
90407
89126
|
const xdefault = params.xdefault;
|
|
90408
89127
|
const array2 = params.array;
|
|
89128
|
+
const encrypt = params.encrypt;
|
|
90409
89129
|
if (typeof databaseId === "undefined") {
|
|
90410
89130
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
90411
89131
|
}
|
|
@@ -90432,6 +89152,9 @@ var Databases = class {
|
|
|
90432
89152
|
if (typeof array2 !== "undefined") {
|
|
90433
89153
|
payload["array"] = array2;
|
|
90434
89154
|
}
|
|
89155
|
+
if (typeof encrypt !== "undefined") {
|
|
89156
|
+
payload["encrypt"] = encrypt;
|
|
89157
|
+
}
|
|
90435
89158
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
90436
89159
|
const apiHeaders = {
|
|
90437
89160
|
"content-type": "application/json"
|
|
@@ -90606,7 +89329,8 @@ var Databases = class {
|
|
|
90606
89329
|
size: rest[2],
|
|
90607
89330
|
required: rest[3],
|
|
90608
89331
|
xdefault: rest[4],
|
|
90609
|
-
array: rest[5]
|
|
89332
|
+
array: rest[5],
|
|
89333
|
+
encrypt: rest[6]
|
|
90610
89334
|
};
|
|
90611
89335
|
}
|
|
90612
89336
|
const databaseId = params.databaseId;
|
|
@@ -90616,6 +89340,7 @@ var Databases = class {
|
|
|
90616
89340
|
const required2 = params.required;
|
|
90617
89341
|
const xdefault = params.xdefault;
|
|
90618
89342
|
const array2 = params.array;
|
|
89343
|
+
const encrypt = params.encrypt;
|
|
90619
89344
|
if (typeof databaseId === "undefined") {
|
|
90620
89345
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
90621
89346
|
}
|
|
@@ -90648,6 +89373,9 @@ var Databases = class {
|
|
|
90648
89373
|
if (typeof array2 !== "undefined") {
|
|
90649
89374
|
payload["array"] = array2;
|
|
90650
89375
|
}
|
|
89376
|
+
if (typeof encrypt !== "undefined") {
|
|
89377
|
+
payload["encrypt"] = encrypt;
|
|
89378
|
+
}
|
|
90651
89379
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
90652
89380
|
const apiHeaders = {
|
|
90653
89381
|
"content-type": "application/json"
|
|
@@ -91798,7 +90526,7 @@ var Functions = class {
|
|
|
91798
90526
|
}
|
|
91799
90527
|
listTemplates(paramsOrFirst, ...rest) {
|
|
91800
90528
|
let params;
|
|
91801
|
-
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "runtimes" in paramsOrFirst) {
|
|
90529
|
+
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && ("runtimes" in paramsOrFirst || "useCases" in paramsOrFirst || "limit" in paramsOrFirst || "offset" in paramsOrFirst || "total" in paramsOrFirst)) {
|
|
91802
90530
|
params = paramsOrFirst || {};
|
|
91803
90531
|
} else {
|
|
91804
90532
|
params = {
|
|
@@ -96575,32 +95303,6 @@ var Organizations = class {
|
|
|
96575
95303
|
};
|
|
96576
95304
|
return this.client.call("patch", uri, apiHeaders, payload);
|
|
96577
95305
|
}
|
|
96578
|
-
updateProjects(paramsOrFirst, ...rest) {
|
|
96579
|
-
let params;
|
|
96580
|
-
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
96581
|
-
params = paramsOrFirst || {};
|
|
96582
|
-
} else {
|
|
96583
|
-
params = {
|
|
96584
|
-
organizationId: paramsOrFirst,
|
|
96585
|
-
projects: rest[0]
|
|
96586
|
-
};
|
|
96587
|
-
}
|
|
96588
|
-
const organizationId = params.organizationId;
|
|
96589
|
-
const projects = params.projects;
|
|
96590
|
-
if (typeof organizationId === "undefined") {
|
|
96591
|
-
throw new AppwriteException('Missing required parameter: "organizationId"');
|
|
96592
|
-
}
|
|
96593
|
-
const apiPath = "/organizations/{organizationId}/projects".replace("{organizationId}", organizationId);
|
|
96594
|
-
const payload = {};
|
|
96595
|
-
if (typeof projects !== "undefined") {
|
|
96596
|
-
payload["projects"] = projects;
|
|
96597
|
-
}
|
|
96598
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
96599
|
-
const apiHeaders = {
|
|
96600
|
-
"content-type": "application/json"
|
|
96601
|
-
};
|
|
96602
|
-
return this.client.call("patch", uri, apiHeaders, payload);
|
|
96603
|
-
}
|
|
96604
95306
|
listRegions(paramsOrFirst) {
|
|
96605
95307
|
let params;
|
|
96606
95308
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
@@ -97627,16 +96329,21 @@ var Projects = class {
|
|
|
97627
96329
|
} else {
|
|
97628
96330
|
params = {
|
|
97629
96331
|
projectId: paramsOrFirst,
|
|
97630
|
-
|
|
96332
|
+
queries: rest[0],
|
|
96333
|
+
total: rest[1]
|
|
97631
96334
|
};
|
|
97632
96335
|
}
|
|
97633
96336
|
const projectId = params.projectId;
|
|
96337
|
+
const queries = params.queries;
|
|
97634
96338
|
const total = params.total;
|
|
97635
96339
|
if (typeof projectId === "undefined") {
|
|
97636
96340
|
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
97637
96341
|
}
|
|
97638
96342
|
const apiPath = "/projects/{projectId}/keys".replace("{projectId}", projectId);
|
|
97639
96343
|
const payload = {};
|
|
96344
|
+
if (typeof queries !== "undefined") {
|
|
96345
|
+
payload["queries"] = queries;
|
|
96346
|
+
}
|
|
97640
96347
|
if (typeof total !== "undefined") {
|
|
97641
96348
|
payload["total"] = total;
|
|
97642
96349
|
}
|
|
@@ -97653,12 +96360,14 @@ var Projects = class {
|
|
|
97653
96360
|
projectId: paramsOrFirst,
|
|
97654
96361
|
name: rest[0],
|
|
97655
96362
|
scopes: rest[1],
|
|
97656
|
-
|
|
96363
|
+
keyId: rest[2],
|
|
96364
|
+
expire: rest[3]
|
|
97657
96365
|
};
|
|
97658
96366
|
}
|
|
97659
96367
|
const projectId = params.projectId;
|
|
97660
96368
|
const name = params.name;
|
|
97661
96369
|
const scopes = params.scopes;
|
|
96370
|
+
const keyId = params.keyId;
|
|
97662
96371
|
const expire = params.expire;
|
|
97663
96372
|
if (typeof projectId === "undefined") {
|
|
97664
96373
|
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
@@ -97671,6 +96380,9 @@ var Projects = class {
|
|
|
97671
96380
|
}
|
|
97672
96381
|
const apiPath = "/projects/{projectId}/keys".replace("{projectId}", projectId);
|
|
97673
96382
|
const payload = {};
|
|
96383
|
+
if (typeof keyId !== "undefined") {
|
|
96384
|
+
payload["keyId"] = keyId;
|
|
96385
|
+
}
|
|
97674
96386
|
if (typeof name !== "undefined") {
|
|
97675
96387
|
payload["name"] = name;
|
|
97676
96388
|
}
|
|
@@ -98391,35 +97103,6 @@ var Projects = class {
|
|
|
98391
97103
|
};
|
|
98392
97104
|
return this.client.call("post", uri, apiHeaders, payload);
|
|
98393
97105
|
}
|
|
98394
|
-
updateStatus(paramsOrFirst, ...rest) {
|
|
98395
|
-
let params;
|
|
98396
|
-
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
98397
|
-
params = paramsOrFirst || {};
|
|
98398
|
-
} else {
|
|
98399
|
-
params = {
|
|
98400
|
-
projectId: paramsOrFirst,
|
|
98401
|
-
status: rest[0]
|
|
98402
|
-
};
|
|
98403
|
-
}
|
|
98404
|
-
const projectId = params.projectId;
|
|
98405
|
-
const status = params.status;
|
|
98406
|
-
if (typeof projectId === "undefined") {
|
|
98407
|
-
throw new AppwriteException('Missing required parameter: "projectId"');
|
|
98408
|
-
}
|
|
98409
|
-
if (typeof status === "undefined") {
|
|
98410
|
-
throw new AppwriteException('Missing required parameter: "status"');
|
|
98411
|
-
}
|
|
98412
|
-
const apiPath = "/projects/{projectId}/status".replace("{projectId}", projectId);
|
|
98413
|
-
const payload = {};
|
|
98414
|
-
if (typeof status !== "undefined") {
|
|
98415
|
-
payload["status"] = status;
|
|
98416
|
-
}
|
|
98417
|
-
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
98418
|
-
const apiHeaders = {
|
|
98419
|
-
"content-type": "application/json"
|
|
98420
|
-
};
|
|
98421
|
-
return this.client.call("patch", uri, apiHeaders, payload);
|
|
98422
|
-
}
|
|
98423
97106
|
updateTeam(paramsOrFirst, ...rest) {
|
|
98424
97107
|
let params;
|
|
98425
97108
|
if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
|
|
@@ -99439,7 +98122,7 @@ var Sites = class {
|
|
|
99439
98122
|
}
|
|
99440
98123
|
listTemplates(paramsOrFirst, ...rest) {
|
|
99441
98124
|
let params;
|
|
99442
|
-
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "frameworks" in paramsOrFirst) {
|
|
98125
|
+
if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && ("frameworks" in paramsOrFirst || "useCases" in paramsOrFirst || "limit" in paramsOrFirst || "offset" in paramsOrFirst)) {
|
|
99443
98126
|
params = paramsOrFirst || {};
|
|
99444
98127
|
} else {
|
|
99445
98128
|
params = {
|
|
@@ -102281,7 +100964,8 @@ var TablesDB = class {
|
|
|
102281
100964
|
key: rest[1],
|
|
102282
100965
|
required: rest[2],
|
|
102283
100966
|
xdefault: rest[3],
|
|
102284
|
-
array: rest[4]
|
|
100967
|
+
array: rest[4],
|
|
100968
|
+
encrypt: rest[5]
|
|
102285
100969
|
};
|
|
102286
100970
|
}
|
|
102287
100971
|
const databaseId = params.databaseId;
|
|
@@ -102290,6 +100974,7 @@ var TablesDB = class {
|
|
|
102290
100974
|
const required2 = params.required;
|
|
102291
100975
|
const xdefault = params.xdefault;
|
|
102292
100976
|
const array2 = params.array;
|
|
100977
|
+
const encrypt = params.encrypt;
|
|
102293
100978
|
if (typeof databaseId === "undefined") {
|
|
102294
100979
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
102295
100980
|
}
|
|
@@ -102316,6 +101001,9 @@ var TablesDB = class {
|
|
|
102316
101001
|
if (typeof array2 !== "undefined") {
|
|
102317
101002
|
payload["array"] = array2;
|
|
102318
101003
|
}
|
|
101004
|
+
if (typeof encrypt !== "undefined") {
|
|
101005
|
+
payload["encrypt"] = encrypt;
|
|
101006
|
+
}
|
|
102319
101007
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
102320
101008
|
const apiHeaders = {
|
|
102321
101009
|
"content-type": "application/json"
|
|
@@ -102385,7 +101073,8 @@ var TablesDB = class {
|
|
|
102385
101073
|
key: rest[1],
|
|
102386
101074
|
required: rest[2],
|
|
102387
101075
|
xdefault: rest[3],
|
|
102388
|
-
array: rest[4]
|
|
101076
|
+
array: rest[4],
|
|
101077
|
+
encrypt: rest[5]
|
|
102389
101078
|
};
|
|
102390
101079
|
}
|
|
102391
101080
|
const databaseId = params.databaseId;
|
|
@@ -102394,6 +101083,7 @@ var TablesDB = class {
|
|
|
102394
101083
|
const required2 = params.required;
|
|
102395
101084
|
const xdefault = params.xdefault;
|
|
102396
101085
|
const array2 = params.array;
|
|
101086
|
+
const encrypt = params.encrypt;
|
|
102397
101087
|
if (typeof databaseId === "undefined") {
|
|
102398
101088
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
102399
101089
|
}
|
|
@@ -102420,6 +101110,9 @@ var TablesDB = class {
|
|
|
102420
101110
|
if (typeof array2 !== "undefined") {
|
|
102421
101111
|
payload["array"] = array2;
|
|
102422
101112
|
}
|
|
101113
|
+
if (typeof encrypt !== "undefined") {
|
|
101114
|
+
payload["encrypt"] = encrypt;
|
|
101115
|
+
}
|
|
102423
101116
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
102424
101117
|
const apiHeaders = {
|
|
102425
101118
|
"content-type": "application/json"
|
|
@@ -102865,7 +101558,8 @@ var TablesDB = class {
|
|
|
102865
101558
|
key: rest[1],
|
|
102866
101559
|
required: rest[2],
|
|
102867
101560
|
xdefault: rest[3],
|
|
102868
|
-
array: rest[4]
|
|
101561
|
+
array: rest[4],
|
|
101562
|
+
encrypt: rest[5]
|
|
102869
101563
|
};
|
|
102870
101564
|
}
|
|
102871
101565
|
const databaseId = params.databaseId;
|
|
@@ -102874,6 +101568,7 @@ var TablesDB = class {
|
|
|
102874
101568
|
const required2 = params.required;
|
|
102875
101569
|
const xdefault = params.xdefault;
|
|
102876
101570
|
const array2 = params.array;
|
|
101571
|
+
const encrypt = params.encrypt;
|
|
102877
101572
|
if (typeof databaseId === "undefined") {
|
|
102878
101573
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
102879
101574
|
}
|
|
@@ -102900,6 +101595,9 @@ var TablesDB = class {
|
|
|
102900
101595
|
if (typeof array2 !== "undefined") {
|
|
102901
101596
|
payload["array"] = array2;
|
|
102902
101597
|
}
|
|
101598
|
+
if (typeof encrypt !== "undefined") {
|
|
101599
|
+
payload["encrypt"] = encrypt;
|
|
101600
|
+
}
|
|
102903
101601
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
102904
101602
|
const apiHeaders = {
|
|
102905
101603
|
"content-type": "application/json"
|
|
@@ -103074,7 +101772,8 @@ var TablesDB = class {
|
|
|
103074
101772
|
size: rest[2],
|
|
103075
101773
|
required: rest[3],
|
|
103076
101774
|
xdefault: rest[4],
|
|
103077
|
-
array: rest[5]
|
|
101775
|
+
array: rest[5],
|
|
101776
|
+
encrypt: rest[6]
|
|
103078
101777
|
};
|
|
103079
101778
|
}
|
|
103080
101779
|
const databaseId = params.databaseId;
|
|
@@ -103084,6 +101783,7 @@ var TablesDB = class {
|
|
|
103084
101783
|
const required2 = params.required;
|
|
103085
101784
|
const xdefault = params.xdefault;
|
|
103086
101785
|
const array2 = params.array;
|
|
101786
|
+
const encrypt = params.encrypt;
|
|
103087
101787
|
if (typeof databaseId === "undefined") {
|
|
103088
101788
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
103089
101789
|
}
|
|
@@ -103116,6 +101816,9 @@ var TablesDB = class {
|
|
|
103116
101816
|
if (typeof array2 !== "undefined") {
|
|
103117
101817
|
payload["array"] = array2;
|
|
103118
101818
|
}
|
|
101819
|
+
if (typeof encrypt !== "undefined") {
|
|
101820
|
+
payload["encrypt"] = encrypt;
|
|
101821
|
+
}
|
|
103119
101822
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
103120
101823
|
const apiHeaders = {
|
|
103121
101824
|
"content-type": "application/json"
|
|
@@ -104755,6 +103458,7 @@ var Scopes;
|
|
|
104755
103458
|
Scopes2["RestorationsWrite"] = "restorations.write";
|
|
104756
103459
|
Scopes2["DomainsRead"] = "domains.read";
|
|
104757
103460
|
Scopes2["DomainsWrite"] = "domains.write";
|
|
103461
|
+
Scopes2["EventsRead"] = "events.read";
|
|
104758
103462
|
})(Scopes || (Scopes = {}));
|
|
104759
103463
|
var AuthenticatorType;
|
|
104760
103464
|
(function(AuthenticatorType2) {
|
|
@@ -105506,12 +104210,12 @@ var ImageFormat;
|
|
|
105506
104210
|
ImageFormat2["Avif"] = "avif";
|
|
105507
104211
|
ImageFormat2["Gif"] = "gif";
|
|
105508
104212
|
})(ImageFormat || (ImageFormat = {}));
|
|
105509
|
-
var
|
|
105510
|
-
(function(
|
|
105511
|
-
|
|
105512
|
-
|
|
105513
|
-
|
|
105514
|
-
})(
|
|
104213
|
+
var BackupServices;
|
|
104214
|
+
(function(BackupServices2) {
|
|
104215
|
+
BackupServices2["Databases"] = "databases";
|
|
104216
|
+
BackupServices2["Functions"] = "functions";
|
|
104217
|
+
BackupServices2["Storage"] = "storage";
|
|
104218
|
+
})(BackupServices || (BackupServices = {}));
|
|
105515
104219
|
var Platform;
|
|
105516
104220
|
(function(Platform2) {
|
|
105517
104221
|
Platform2["Appwrite"] = "appwrite";
|
|
@@ -105552,6 +104256,13 @@ var OrderBy;
|
|
|
105552
104256
|
OrderBy2["Asc"] = "asc";
|
|
105553
104257
|
OrderBy2["Desc"] = "desc";
|
|
105554
104258
|
})(OrderBy || (OrderBy = {}));
|
|
104259
|
+
var RegistrationType;
|
|
104260
|
+
(function(RegistrationType2) {
|
|
104261
|
+
RegistrationType2["New"] = "new";
|
|
104262
|
+
RegistrationType2["Transfer"] = "transfer";
|
|
104263
|
+
RegistrationType2["Renewal"] = "renewal";
|
|
104264
|
+
RegistrationType2["Trade"] = "trade";
|
|
104265
|
+
})(RegistrationType || (RegistrationType = {}));
|
|
105555
104266
|
var FilterType;
|
|
105556
104267
|
(function(FilterType2) {
|
|
105557
104268
|
FilterType2["Premium"] = "premium";
|
|
@@ -105595,6 +104306,7 @@ var Runtime;
|
|
|
105595
104306
|
Runtime2["Dart35"] = "dart-3.5";
|
|
105596
104307
|
Runtime2["Dart38"] = "dart-3.8";
|
|
105597
104308
|
Runtime2["Dart39"] = "dart-3.9";
|
|
104309
|
+
Runtime2["Dart310"] = "dart-3.10";
|
|
105598
104310
|
Runtime2["Dotnet60"] = "dotnet-6.0";
|
|
105599
104311
|
Runtime2["Dotnet70"] = "dotnet-7.0";
|
|
105600
104312
|
Runtime2["Dotnet80"] = "dotnet-8.0";
|
|
@@ -105623,6 +104335,7 @@ var Runtime;
|
|
|
105623
104335
|
Runtime2["Flutter329"] = "flutter-3.29";
|
|
105624
104336
|
Runtime2["Flutter332"] = "flutter-3.32";
|
|
105625
104337
|
Runtime2["Flutter335"] = "flutter-3.35";
|
|
104338
|
+
Runtime2["Flutter338"] = "flutter-3.38";
|
|
105626
104339
|
})(Runtime || (Runtime = {}));
|
|
105627
104340
|
var Runtimes;
|
|
105628
104341
|
(function(Runtimes2) {
|
|
@@ -105662,6 +104375,7 @@ var Runtimes;
|
|
|
105662
104375
|
Runtimes2["Dart35"] = "dart-3.5";
|
|
105663
104376
|
Runtimes2["Dart38"] = "dart-3.8";
|
|
105664
104377
|
Runtimes2["Dart39"] = "dart-3.9";
|
|
104378
|
+
Runtimes2["Dart310"] = "dart-3.10";
|
|
105665
104379
|
Runtimes2["Dotnet60"] = "dotnet-6.0";
|
|
105666
104380
|
Runtimes2["Dotnet70"] = "dotnet-7.0";
|
|
105667
104381
|
Runtimes2["Dotnet80"] = "dotnet-8.0";
|
|
@@ -105690,6 +104404,7 @@ var Runtimes;
|
|
|
105690
104404
|
Runtimes2["Flutter329"] = "flutter-3.29";
|
|
105691
104405
|
Runtimes2["Flutter332"] = "flutter-3.32";
|
|
105692
104406
|
Runtimes2["Flutter335"] = "flutter-3.35";
|
|
104407
|
+
Runtimes2["Flutter338"] = "flutter-3.38";
|
|
105693
104408
|
})(Runtimes || (Runtimes = {}));
|
|
105694
104409
|
var UseCases;
|
|
105695
104410
|
(function(UseCases2) {
|
|
@@ -105840,11 +104555,6 @@ var SMTPSecure;
|
|
|
105840
104555
|
SMTPSecure2["Tls"] = "tls";
|
|
105841
104556
|
SMTPSecure2["Ssl"] = "ssl";
|
|
105842
104557
|
})(SMTPSecure || (SMTPSecure = {}));
|
|
105843
|
-
var Status;
|
|
105844
|
-
(function(Status2) {
|
|
105845
|
-
Status2["Active"] = "active";
|
|
105846
|
-
Status2["Archived"] = "archived";
|
|
105847
|
-
})(Status || (Status = {}));
|
|
105848
104558
|
var EmailTemplateType;
|
|
105849
104559
|
(function(EmailTemplateType2) {
|
|
105850
104560
|
EmailTemplateType2["Verification"] = "verification";
|
|
@@ -106198,6 +104908,7 @@ var BuildRuntime;
|
|
|
106198
104908
|
BuildRuntime2["Dart35"] = "dart-3.5";
|
|
106199
104909
|
BuildRuntime2["Dart38"] = "dart-3.8";
|
|
106200
104910
|
BuildRuntime2["Dart39"] = "dart-3.9";
|
|
104911
|
+
BuildRuntime2["Dart310"] = "dart-3.10";
|
|
106201
104912
|
BuildRuntime2["Dotnet60"] = "dotnet-6.0";
|
|
106202
104913
|
BuildRuntime2["Dotnet70"] = "dotnet-7.0";
|
|
106203
104914
|
BuildRuntime2["Dotnet80"] = "dotnet-8.0";
|
|
@@ -106226,6 +104937,7 @@ var BuildRuntime;
|
|
|
106226
104937
|
BuildRuntime2["Flutter329"] = "flutter-3.29";
|
|
106227
104938
|
BuildRuntime2["Flutter332"] = "flutter-3.32";
|
|
106228
104939
|
BuildRuntime2["Flutter335"] = "flutter-3.35";
|
|
104940
|
+
BuildRuntime2["Flutter338"] = "flutter-3.38";
|
|
106229
104941
|
})(BuildRuntime || (BuildRuntime = {}));
|
|
106230
104942
|
var Adapter;
|
|
106231
104943
|
(function(Adapter2) {
|
|
@@ -106268,14 +104980,6 @@ var ImageGravity;
|
|
|
106268
104980
|
ImageGravity2["Bottom"] = "bottom";
|
|
106269
104981
|
ImageGravity2["Bottomright"] = "bottom-right";
|
|
106270
104982
|
})(ImageGravity || (ImageGravity = {}));
|
|
106271
|
-
var Roles;
|
|
106272
|
-
(function(Roles2) {
|
|
106273
|
-
Roles2["Developer"] = "developer";
|
|
106274
|
-
Roles2["Editor"] = "editor";
|
|
106275
|
-
Roles2["Analyst"] = "analyst";
|
|
106276
|
-
Roles2["Billing"] = "billing";
|
|
106277
|
-
Roles2["Owner"] = "owner";
|
|
106278
|
-
})(Roles || (Roles = {}));
|
|
106279
104983
|
var PasswordHash;
|
|
106280
104984
|
(function(PasswordHash2) {
|
|
106281
104985
|
PasswordHash2["Sha1"] = "sha1";
|
|
@@ -106401,7 +105105,7 @@ var package_default = {
|
|
|
106401
105105
|
type: "module",
|
|
106402
105106
|
homepage: "https://appwrite.io/support",
|
|
106403
105107
|
description: "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
|
|
106404
|
-
version: "13.
|
|
105108
|
+
version: "13.4.0",
|
|
106405
105109
|
license: "BSD-3-Clause",
|
|
106406
105110
|
main: "dist/index.js",
|
|
106407
105111
|
types: "dist/index.d.ts",
|
|
@@ -106430,8 +105134,7 @@ var package_default = {
|
|
|
106430
105134
|
"windows-arm64": "esbuild cli.ts --bundle --loader:.hbs=text --platform=node --target=node18 --format=esm --external:fsevents --outfile=dist/bundle-win-arm64.mjs && pkg dist/bundle-win-arm64.mjs -t node18-win-arm64 -o build/appwrite-cli-win-arm64.exe"
|
|
106431
105135
|
},
|
|
106432
105136
|
dependencies: {
|
|
106433
|
-
"@appwrite.io/console": "^2.
|
|
106434
|
-
"bignumber.js": "^9.0.0",
|
|
105137
|
+
"@appwrite.io/console": "^2.3.1",
|
|
106435
105138
|
chalk: "4.1.2",
|
|
106436
105139
|
chokidar: "^3.6.0",
|
|
106437
105140
|
"cli-progress": "^3.12.0",
|
|
@@ -106487,14 +105190,21 @@ var drawTable = (data) => {
|
|
|
106487
105190
|
console.log("[]");
|
|
106488
105191
|
return;
|
|
106489
105192
|
}
|
|
106490
|
-
const
|
|
105193
|
+
const rows = data.map(
|
|
105194
|
+
(item) => item && typeof item === "object" && !Array.isArray(item) ? item : {}
|
|
105195
|
+
);
|
|
105196
|
+
const obj = rows.reduce((res, item) => ({ ...res, ...item }), {});
|
|
106491
105197
|
const keys = Object.keys(obj);
|
|
105198
|
+
if (keys.length === 0) {
|
|
105199
|
+
drawJSON(data);
|
|
105200
|
+
return;
|
|
105201
|
+
}
|
|
106492
105202
|
const def = keys.reduce((result, key) => {
|
|
106493
105203
|
result[key] = "-";
|
|
106494
105204
|
return result;
|
|
106495
105205
|
}, {});
|
|
106496
|
-
|
|
106497
|
-
const columns = Object.keys(
|
|
105206
|
+
const normalizedData = rows.map((item) => ({ ...def, ...item }));
|
|
105207
|
+
const columns = Object.keys(normalizedData[0]);
|
|
106498
105208
|
const table = new import_cli_table3.default({
|
|
106499
105209
|
head: columns.map((c) => import_chalk2.default.cyan.italic.bold(c)),
|
|
106500
105210
|
chars: {
|
|
@@ -106515,10 +105225,10 @@ var drawTable = (data) => {
|
|
|
106515
105225
|
middle: import_chalk2.default.cyan("\u2502")
|
|
106516
105226
|
}
|
|
106517
105227
|
});
|
|
106518
|
-
|
|
105228
|
+
normalizedData.forEach((row) => {
|
|
106519
105229
|
const rowValues = [];
|
|
106520
|
-
for (const key
|
|
106521
|
-
if (row[key]
|
|
105230
|
+
for (const key of columns) {
|
|
105231
|
+
if (row[key] == null) {
|
|
106522
105232
|
rowValues.push("-");
|
|
106523
105233
|
} else if (Array.isArray(row[key])) {
|
|
106524
105234
|
rowValues.push(JSON.stringify(row[key]));
|
|
@@ -106532,6 +105242,9 @@ var drawTable = (data) => {
|
|
|
106532
105242
|
});
|
|
106533
105243
|
console.log(table.toString());
|
|
106534
105244
|
};
|
|
105245
|
+
var drawJSON = (data) => {
|
|
105246
|
+
console.log(JSON.stringify(data, null, 2));
|
|
105247
|
+
};
|
|
106535
105248
|
var parseError = (err) => {
|
|
106536
105249
|
if (cliConfig.report) {
|
|
106537
105250
|
(async () => {
|
|
@@ -109917,7 +108630,19 @@ var pushSite = async ({
|
|
|
109917
108630
|
} = result;
|
|
109918
108631
|
failedDeployments.forEach((failed) => {
|
|
109919
108632
|
const { name, deployment, $id } = failed;
|
|
109920
|
-
const
|
|
108633
|
+
const projectId = localConfig.getProject().projectId;
|
|
108634
|
+
const endpoint = localConfig.getEndpoint() || globalConfig2.getEndpoint();
|
|
108635
|
+
let region = "";
|
|
108636
|
+
try {
|
|
108637
|
+
const hostname3 = new URL(endpoint).hostname;
|
|
108638
|
+
const firstSubdomain = hostname3.split(".")[0];
|
|
108639
|
+
if (firstSubdomain.length === 3) {
|
|
108640
|
+
region = firstSubdomain;
|
|
108641
|
+
}
|
|
108642
|
+
} catch {
|
|
108643
|
+
}
|
|
108644
|
+
const projectSlug = region ? `project-${region}-${projectId}` : `project-${projectId}`;
|
|
108645
|
+
const failUrl = `${globalConfig2.getEndpoint().slice(0, -3)}/console/${projectSlug}/sites/site-${$id}/deployments/deployment-${deployment}`;
|
|
109921
108646
|
error48(
|
|
109922
108647
|
`Deployment of ${name} has failed. Check at ${failUrl} for more details
|
|
109923
108648
|
`
|
|
@@ -110025,7 +108750,19 @@ var pushFunction = async ({
|
|
|
110025
108750
|
} = result;
|
|
110026
108751
|
failedDeployments.forEach((failed) => {
|
|
110027
108752
|
const { name, deployment, $id } = failed;
|
|
110028
|
-
const
|
|
108753
|
+
const projectId = localConfig.getProject().projectId;
|
|
108754
|
+
const endpoint = localConfig.getEndpoint() || globalConfig2.getEndpoint();
|
|
108755
|
+
let region = "";
|
|
108756
|
+
try {
|
|
108757
|
+
const hostname3 = new URL(endpoint).hostname;
|
|
108758
|
+
const firstSubdomain = hostname3.split(".")[0];
|
|
108759
|
+
if (firstSubdomain.length === 3) {
|
|
108760
|
+
region = firstSubdomain;
|
|
108761
|
+
}
|
|
108762
|
+
} catch {
|
|
108763
|
+
}
|
|
108764
|
+
const projectSlug = region ? `project-${region}-${projectId}` : `project-${projectId}`;
|
|
108765
|
+
const failUrl = `${globalConfig2.getEndpoint().slice(0, -3)}/console/${projectSlug}/functions/function-${$id}/deployment-${deployment}`;
|
|
110029
108766
|
error48(
|
|
110030
108767
|
`Deployment of ${name} has failed. Check at ${failUrl} for more details
|
|
110031
108768
|
`
|
|
@@ -111906,9 +110643,24 @@ var Schema = class {
|
|
|
111906
110643
|
}
|
|
111907
110644
|
};
|
|
111908
110645
|
export {
|
|
110646
|
+
AttributeSchema,
|
|
110647
|
+
BucketSchema,
|
|
110648
|
+
CollectionSchema,
|
|
110649
|
+
ColumnSchema,
|
|
110650
|
+
ConfigSchema,
|
|
110651
|
+
DatabaseSchema,
|
|
110652
|
+
FunctionSchema,
|
|
110653
|
+
IndexSchema,
|
|
110654
|
+
IndexTableSchema,
|
|
110655
|
+
MessageSchema,
|
|
111909
110656
|
Pull,
|
|
111910
110657
|
Push,
|
|
111911
|
-
Schema
|
|
110658
|
+
Schema,
|
|
110659
|
+
SettingsSchema,
|
|
110660
|
+
SiteSchema,
|
|
110661
|
+
TableSchema,
|
|
110662
|
+
TeamSchema,
|
|
110663
|
+
TopicSchema
|
|
111912
110664
|
};
|
|
111913
110665
|
/*! Bundled license information:
|
|
111914
110666
|
|