@vope/utils 1.4.32 → 1.5.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/cjs/index.js +261 -514
- package/lib/compare/version.js +2 -4
- package/lib/compare/weak-equal.js +4 -8
- package/lib/encoding.js +1 -2
- package/lib/is/class.js +6 -12
- package/lib/memory/basic.js +2 -4
- package/lib/memory/simple.js +1 -2
- package/lib/neo4j-anchors.js +6 -12
- package/lib/neo4j.js +3 -6
- package/lib/parse/num.js +4 -8
- package/lib/serialize/url-params.js +2 -4
- package/lib/storage/offline.js +9 -18
- package/lib/style/css.js +1 -2
- package/lib/subscriber.js +2 -4
- package/lib/table/flex.js +11 -16
- package/lib/url/join.js +1 -2
- package/package.json +79 -74
- package/types/compare/weak-equal.d.ts +1 -1
- package/types/is/empty.d.ts +1 -1
- package/types/is/null.d.ts +1 -1
package/cjs/index.js
CHANGED
|
@@ -58,10 +58,8 @@ var require_localforage = __commonJS({
|
|
|
58
58
|
if (!n[o2]) {
|
|
59
59
|
if (!t[o2]) {
|
|
60
60
|
var a = typeof require == "function" && require;
|
|
61
|
-
if (!u && a)
|
|
62
|
-
|
|
63
|
-
if (i)
|
|
64
|
-
return i(o2, true);
|
|
61
|
+
if (!u && a) return a(o2, true);
|
|
62
|
+
if (i) return i(o2, true);
|
|
65
63
|
var f = new Error("Cannot find module '" + o2 + "'");
|
|
66
64
|
throw f.code = "MODULE_NOT_FOUND", f;
|
|
67
65
|
}
|
|
@@ -74,8 +72,7 @@ var require_localforage = __commonJS({
|
|
|
74
72
|
return n[o2].exports;
|
|
75
73
|
}
|
|
76
74
|
var i = typeof require == "function" && require;
|
|
77
|
-
for (var o = 0; o < r.length; o++)
|
|
78
|
-
s(r[o]);
|
|
75
|
+
for (var o = 0; o < r.length; o++) s(r[o]);
|
|
79
76
|
return s;
|
|
80
77
|
}({ 1: [function(_dereq_, module4, exports3) {
|
|
81
78
|
(function(global2) {
|
|
@@ -2187,12 +2184,9 @@ var require_jsbn = __commonJS({
|
|
|
2187
2184
|
var j_lm = (canary & 16777215) == 15715070;
|
|
2188
2185
|
function BigInteger(a, b, c) {
|
|
2189
2186
|
if (a != null)
|
|
2190
|
-
if ("number" == typeof a)
|
|
2191
|
-
|
|
2192
|
-
else
|
|
2193
|
-
this.fromString(a, 256);
|
|
2194
|
-
else
|
|
2195
|
-
this.fromString(a, b);
|
|
2187
|
+
if ("number" == typeof a) this.fromNumber(a, b, c);
|
|
2188
|
+
else if (b == null && "string" != typeof a) this.fromString(a, 256);
|
|
2189
|
+
else this.fromString(a, b);
|
|
2196
2190
|
}
|
|
2197
2191
|
function nbi() {
|
|
2198
2192
|
return new BigInteger(null);
|
|
@@ -2251,14 +2245,11 @@ var require_jsbn = __commonJS({
|
|
|
2251
2245
|
var BI_RC = new Array();
|
|
2252
2246
|
var rr, vv;
|
|
2253
2247
|
rr = "0".charCodeAt(0);
|
|
2254
|
-
for (vv = 0; vv <= 9; ++vv)
|
|
2255
|
-
BI_RC[rr++] = vv;
|
|
2248
|
+
for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
|
|
2256
2249
|
rr = "a".charCodeAt(0);
|
|
2257
|
-
for (vv = 10; vv < 36; ++vv)
|
|
2258
|
-
BI_RC[rr++] = vv;
|
|
2250
|
+
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
|
2259
2251
|
rr = "A".charCodeAt(0);
|
|
2260
|
-
for (vv = 10; vv < 36; ++vv)
|
|
2261
|
-
BI_RC[rr++] = vv;
|
|
2252
|
+
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
|
2262
2253
|
function int2char(n) {
|
|
2263
2254
|
return BI_RM.charAt(n);
|
|
2264
2255
|
}
|
|
@@ -2267,20 +2258,16 @@ var require_jsbn = __commonJS({
|
|
|
2267
2258
|
return c == null ? -1 : c;
|
|
2268
2259
|
}
|
|
2269
2260
|
function bnpCopyTo(r) {
|
|
2270
|
-
for (var i = this.t - 1; i >= 0; --i)
|
|
2271
|
-
r[i] = this[i];
|
|
2261
|
+
for (var i = this.t - 1; i >= 0; --i) r[i] = this[i];
|
|
2272
2262
|
r.t = this.t;
|
|
2273
2263
|
r.s = this.s;
|
|
2274
2264
|
}
|
|
2275
2265
|
function bnpFromInt(x) {
|
|
2276
2266
|
this.t = 1;
|
|
2277
2267
|
this.s = x < 0 ? -1 : 0;
|
|
2278
|
-
if (x > 0)
|
|
2279
|
-
|
|
2280
|
-
else
|
|
2281
|
-
this[0] = x + this.DV;
|
|
2282
|
-
else
|
|
2283
|
-
this.t = 0;
|
|
2268
|
+
if (x > 0) this[0] = x;
|
|
2269
|
+
else if (x < -1) this[0] = x + this.DV;
|
|
2270
|
+
else this.t = 0;
|
|
2284
2271
|
}
|
|
2285
2272
|
function nbv(i) {
|
|
2286
2273
|
var r = nbi();
|
|
@@ -2289,18 +2276,12 @@ var require_jsbn = __commonJS({
|
|
|
2289
2276
|
}
|
|
2290
2277
|
function bnpFromString(s, b) {
|
|
2291
2278
|
var k;
|
|
2292
|
-
if (b == 16)
|
|
2293
|
-
|
|
2294
|
-
else if (b == 8
|
|
2295
|
-
|
|
2296
|
-
else if (b ==
|
|
2297
|
-
|
|
2298
|
-
else if (b == 2)
|
|
2299
|
-
k = 1;
|
|
2300
|
-
else if (b == 32)
|
|
2301
|
-
k = 5;
|
|
2302
|
-
else if (b == 4)
|
|
2303
|
-
k = 2;
|
|
2279
|
+
if (b == 16) k = 4;
|
|
2280
|
+
else if (b == 8) k = 3;
|
|
2281
|
+
else if (b == 256) k = 8;
|
|
2282
|
+
else if (b == 2) k = 1;
|
|
2283
|
+
else if (b == 32) k = 5;
|
|
2284
|
+
else if (b == 4) k = 2;
|
|
2304
2285
|
else {
|
|
2305
2286
|
this.fromRadix(s, b);
|
|
2306
2287
|
return;
|
|
@@ -2311,8 +2292,7 @@ var require_jsbn = __commonJS({
|
|
|
2311
2292
|
while (--i >= 0) {
|
|
2312
2293
|
var x = k == 8 ? s[i] & 255 : intAt(s, i);
|
|
2313
2294
|
if (x < 0) {
|
|
2314
|
-
if (s.charAt(i) == "-")
|
|
2315
|
-
mi = true;
|
|
2295
|
+
if (s.charAt(i) == "-") mi = true;
|
|
2316
2296
|
continue;
|
|
2317
2297
|
}
|
|
2318
2298
|
mi = false;
|
|
@@ -2324,39 +2304,28 @@ var require_jsbn = __commonJS({
|
|
|
2324
2304
|
} else
|
|
2325
2305
|
this[this.t - 1] |= x << sh;
|
|
2326
2306
|
sh += k;
|
|
2327
|
-
if (sh >= this.DB)
|
|
2328
|
-
sh -= this.DB;
|
|
2307
|
+
if (sh >= this.DB) sh -= this.DB;
|
|
2329
2308
|
}
|
|
2330
2309
|
if (k == 8 && (s[0] & 128) != 0) {
|
|
2331
2310
|
this.s = -1;
|
|
2332
|
-
if (sh > 0)
|
|
2333
|
-
this[this.t - 1] |= (1 << this.DB - sh) - 1 << sh;
|
|
2311
|
+
if (sh > 0) this[this.t - 1] |= (1 << this.DB - sh) - 1 << sh;
|
|
2334
2312
|
}
|
|
2335
2313
|
this.clamp();
|
|
2336
|
-
if (mi)
|
|
2337
|
-
BigInteger.ZERO.subTo(this, this);
|
|
2314
|
+
if (mi) BigInteger.ZERO.subTo(this, this);
|
|
2338
2315
|
}
|
|
2339
2316
|
function bnpClamp() {
|
|
2340
2317
|
var c = this.s & this.DM;
|
|
2341
|
-
while (this.t > 0 && this[this.t - 1] == c)
|
|
2342
|
-
--this.t;
|
|
2318
|
+
while (this.t > 0 && this[this.t - 1] == c) --this.t;
|
|
2343
2319
|
}
|
|
2344
2320
|
function bnToString(b) {
|
|
2345
|
-
if (this.s < 0)
|
|
2346
|
-
return "-" + this.negate().toString(b);
|
|
2321
|
+
if (this.s < 0) return "-" + this.negate().toString(b);
|
|
2347
2322
|
var k;
|
|
2348
|
-
if (b == 16)
|
|
2349
|
-
|
|
2350
|
-
else if (b ==
|
|
2351
|
-
|
|
2352
|
-
else if (b == 2
|
|
2353
|
-
|
|
2354
|
-
else if (b == 32)
|
|
2355
|
-
k = 5;
|
|
2356
|
-
else if (b == 4)
|
|
2357
|
-
k = 2;
|
|
2358
|
-
else
|
|
2359
|
-
return this.toRadix(b);
|
|
2323
|
+
if (b == 16) k = 4;
|
|
2324
|
+
else if (b == 8) k = 3;
|
|
2325
|
+
else if (b == 2) k = 1;
|
|
2326
|
+
else if (b == 32) k = 5;
|
|
2327
|
+
else if (b == 4) k = 2;
|
|
2328
|
+
else return this.toRadix(b);
|
|
2360
2329
|
var km = (1 << k) - 1, d, m = false, r = "", i = this.t;
|
|
2361
2330
|
var p = this.DB - i * this.DB % k;
|
|
2362
2331
|
if (i-- > 0) {
|
|
@@ -2375,10 +2344,8 @@ var require_jsbn = __commonJS({
|
|
|
2375
2344
|
--i;
|
|
2376
2345
|
}
|
|
2377
2346
|
}
|
|
2378
|
-
if (d > 0)
|
|
2379
|
-
|
|
2380
|
-
if (m)
|
|
2381
|
-
r += int2char(d);
|
|
2347
|
+
if (d > 0) m = true;
|
|
2348
|
+
if (m) r += int2char(d);
|
|
2382
2349
|
}
|
|
2383
2350
|
}
|
|
2384
2351
|
return m ? r : "0";
|
|
@@ -2393,15 +2360,11 @@ var require_jsbn = __commonJS({
|
|
|
2393
2360
|
}
|
|
2394
2361
|
function bnCompareTo(a) {
|
|
2395
2362
|
var r = this.s - a.s;
|
|
2396
|
-
if (r != 0)
|
|
2397
|
-
return r;
|
|
2363
|
+
if (r != 0) return r;
|
|
2398
2364
|
var i = this.t;
|
|
2399
2365
|
r = i - a.t;
|
|
2400
|
-
if (r != 0)
|
|
2401
|
-
|
|
2402
|
-
while (--i >= 0)
|
|
2403
|
-
if ((r = this[i] - a[i]) != 0)
|
|
2404
|
-
return r;
|
|
2366
|
+
if (r != 0) return this.s < 0 ? -r : r;
|
|
2367
|
+
while (--i >= 0) if ((r = this[i] - a[i]) != 0) return r;
|
|
2405
2368
|
return 0;
|
|
2406
2369
|
}
|
|
2407
2370
|
function nbits(x) {
|
|
@@ -2429,22 +2392,18 @@ var require_jsbn = __commonJS({
|
|
|
2429
2392
|
return r;
|
|
2430
2393
|
}
|
|
2431
2394
|
function bnBitLength() {
|
|
2432
|
-
if (this.t <= 0)
|
|
2433
|
-
return 0;
|
|
2395
|
+
if (this.t <= 0) return 0;
|
|
2434
2396
|
return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);
|
|
2435
2397
|
}
|
|
2436
2398
|
function bnpDLShiftTo(n, r) {
|
|
2437
2399
|
var i;
|
|
2438
|
-
for (i = this.t - 1; i >= 0; --i)
|
|
2439
|
-
|
|
2440
|
-
for (i = n - 1; i >= 0; --i)
|
|
2441
|
-
r[i] = 0;
|
|
2400
|
+
for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i];
|
|
2401
|
+
for (i = n - 1; i >= 0; --i) r[i] = 0;
|
|
2442
2402
|
r.t = this.t + n;
|
|
2443
2403
|
r.s = this.s;
|
|
2444
2404
|
}
|
|
2445
2405
|
function bnpDRShiftTo(n, r) {
|
|
2446
|
-
for (var i = n; i < this.t; ++i)
|
|
2447
|
-
r[i - n] = this[i];
|
|
2406
|
+
for (var i = n; i < this.t; ++i) r[i - n] = this[i];
|
|
2448
2407
|
r.t = Math.max(this.t - n, 0);
|
|
2449
2408
|
r.s = this.s;
|
|
2450
2409
|
}
|
|
@@ -2457,8 +2416,7 @@ var require_jsbn = __commonJS({
|
|
|
2457
2416
|
r[i + ds + 1] = this[i] >> cbs | c;
|
|
2458
2417
|
c = (this[i] & bm) << bs;
|
|
2459
2418
|
}
|
|
2460
|
-
for (i = ds - 1; i >= 0; --i)
|
|
2461
|
-
r[i] = 0;
|
|
2419
|
+
for (i = ds - 1; i >= 0; --i) r[i] = 0;
|
|
2462
2420
|
r[ds] = c;
|
|
2463
2421
|
r.t = this.t + ds + 1;
|
|
2464
2422
|
r.s = this.s;
|
|
@@ -2479,8 +2437,7 @@ var require_jsbn = __commonJS({
|
|
|
2479
2437
|
r[i - ds - 1] |= (this[i] & bm) << cbs;
|
|
2480
2438
|
r[i - ds] = this[i] >> bs;
|
|
2481
2439
|
}
|
|
2482
|
-
if (bs > 0)
|
|
2483
|
-
r[this.t - ds - 1] |= (this.s & bm) << cbs;
|
|
2440
|
+
if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;
|
|
2484
2441
|
r.t = this.t - ds;
|
|
2485
2442
|
r.clamp();
|
|
2486
2443
|
}
|
|
@@ -2509,10 +2466,8 @@ var require_jsbn = __commonJS({
|
|
|
2509
2466
|
c -= a.s;
|
|
2510
2467
|
}
|
|
2511
2468
|
r.s = c < 0 ? -1 : 0;
|
|
2512
|
-
if (c < -1)
|
|
2513
|
-
|
|
2514
|
-
else if (c > 0)
|
|
2515
|
-
r[i++] = c;
|
|
2469
|
+
if (c < -1) r[i++] = this.DV + c;
|
|
2470
|
+
else if (c > 0) r[i++] = c;
|
|
2516
2471
|
r.t = i;
|
|
2517
2472
|
r.clamp();
|
|
2518
2473
|
}
|
|
@@ -2520,20 +2475,16 @@ var require_jsbn = __commonJS({
|
|
|
2520
2475
|
var x = this.abs(), y = a.abs();
|
|
2521
2476
|
var i = x.t;
|
|
2522
2477
|
r.t = i + y.t;
|
|
2523
|
-
while (--i >= 0)
|
|
2524
|
-
|
|
2525
|
-
for (i = 0; i < y.t; ++i)
|
|
2526
|
-
r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);
|
|
2478
|
+
while (--i >= 0) r[i] = 0;
|
|
2479
|
+
for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);
|
|
2527
2480
|
r.s = 0;
|
|
2528
2481
|
r.clamp();
|
|
2529
|
-
if (this.s != a.s)
|
|
2530
|
-
BigInteger.ZERO.subTo(r, r);
|
|
2482
|
+
if (this.s != a.s) BigInteger.ZERO.subTo(r, r);
|
|
2531
2483
|
}
|
|
2532
2484
|
function bnpSquareTo(r) {
|
|
2533
2485
|
var x = this.abs();
|
|
2534
2486
|
var i = r.t = 2 * x.t;
|
|
2535
|
-
while (--i >= 0)
|
|
2536
|
-
r[i] = 0;
|
|
2487
|
+
while (--i >= 0) r[i] = 0;
|
|
2537
2488
|
for (i = 0; i < x.t - 1; ++i) {
|
|
2538
2489
|
var c = x.am(i, x[i], r, 2 * i, 0, 1);
|
|
2539
2490
|
if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
|
|
@@ -2541,25 +2492,20 @@ var require_jsbn = __commonJS({
|
|
|
2541
2492
|
r[i + x.t + 1] = 1;
|
|
2542
2493
|
}
|
|
2543
2494
|
}
|
|
2544
|
-
if (r.t > 0)
|
|
2545
|
-
r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);
|
|
2495
|
+
if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);
|
|
2546
2496
|
r.s = 0;
|
|
2547
2497
|
r.clamp();
|
|
2548
2498
|
}
|
|
2549
2499
|
function bnpDivRemTo(m, q, r) {
|
|
2550
2500
|
var pm = m.abs();
|
|
2551
|
-
if (pm.t <= 0)
|
|
2552
|
-
return;
|
|
2501
|
+
if (pm.t <= 0) return;
|
|
2553
2502
|
var pt = this.abs();
|
|
2554
2503
|
if (pt.t < pm.t) {
|
|
2555
|
-
if (q != null)
|
|
2556
|
-
|
|
2557
|
-
if (r != null)
|
|
2558
|
-
this.copyTo(r);
|
|
2504
|
+
if (q != null) q.fromInt(0);
|
|
2505
|
+
if (r != null) this.copyTo(r);
|
|
2559
2506
|
return;
|
|
2560
2507
|
}
|
|
2561
|
-
if (r == null)
|
|
2562
|
-
r = nbi();
|
|
2508
|
+
if (r == null) r = nbi();
|
|
2563
2509
|
var y = nbi(), ts = this.s, ms = m.s;
|
|
2564
2510
|
var nsh = this.DB - nbits(pm[pm.t - 1]);
|
|
2565
2511
|
if (nsh > 0) {
|
|
@@ -2571,8 +2517,7 @@ var require_jsbn = __commonJS({
|
|
|
2571
2517
|
}
|
|
2572
2518
|
var ys = y.t;
|
|
2573
2519
|
var y0 = y[ys - 1];
|
|
2574
|
-
if (y0 == 0)
|
|
2575
|
-
return;
|
|
2520
|
+
if (y0 == 0) return;
|
|
2576
2521
|
var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);
|
|
2577
2522
|
var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2;
|
|
2578
2523
|
var i = r.t, j = i - ys, t2 = q == null ? nbi() : q;
|
|
@@ -2583,44 +2528,36 @@ var require_jsbn = __commonJS({
|
|
|
2583
2528
|
}
|
|
2584
2529
|
BigInteger.ONE.dlShiftTo(ys, t2);
|
|
2585
2530
|
t2.subTo(y, y);
|
|
2586
|
-
while (y.t < ys)
|
|
2587
|
-
y[y.t++] = 0;
|
|
2531
|
+
while (y.t < ys) y[y.t++] = 0;
|
|
2588
2532
|
while (--j >= 0) {
|
|
2589
2533
|
var qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);
|
|
2590
2534
|
if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {
|
|
2591
2535
|
y.dlShiftTo(j, t2);
|
|
2592
2536
|
r.subTo(t2, r);
|
|
2593
|
-
while (r[i] < --qd)
|
|
2594
|
-
r.subTo(t2, r);
|
|
2537
|
+
while (r[i] < --qd) r.subTo(t2, r);
|
|
2595
2538
|
}
|
|
2596
2539
|
}
|
|
2597
2540
|
if (q != null) {
|
|
2598
2541
|
r.drShiftTo(ys, q);
|
|
2599
|
-
if (ts != ms)
|
|
2600
|
-
BigInteger.ZERO.subTo(q, q);
|
|
2542
|
+
if (ts != ms) BigInteger.ZERO.subTo(q, q);
|
|
2601
2543
|
}
|
|
2602
2544
|
r.t = ys;
|
|
2603
2545
|
r.clamp();
|
|
2604
|
-
if (nsh > 0)
|
|
2605
|
-
|
|
2606
|
-
if (ts < 0)
|
|
2607
|
-
BigInteger.ZERO.subTo(r, r);
|
|
2546
|
+
if (nsh > 0) r.rShiftTo(nsh, r);
|
|
2547
|
+
if (ts < 0) BigInteger.ZERO.subTo(r, r);
|
|
2608
2548
|
}
|
|
2609
2549
|
function bnMod(a) {
|
|
2610
2550
|
var r = nbi();
|
|
2611
2551
|
this.abs().divRemTo(a, null, r);
|
|
2612
|
-
if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0)
|
|
2613
|
-
a.subTo(r, r);
|
|
2552
|
+
if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);
|
|
2614
2553
|
return r;
|
|
2615
2554
|
}
|
|
2616
2555
|
function Classic(m) {
|
|
2617
2556
|
this.m = m;
|
|
2618
2557
|
}
|
|
2619
2558
|
function cConvert(x) {
|
|
2620
|
-
if (x.s < 0 || x.compareTo(this.m) >= 0)
|
|
2621
|
-
|
|
2622
|
-
else
|
|
2623
|
-
return x;
|
|
2559
|
+
if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
|
|
2560
|
+
else return x;
|
|
2624
2561
|
}
|
|
2625
2562
|
function cRevert(x) {
|
|
2626
2563
|
return x;
|
|
@@ -2642,11 +2579,9 @@ var require_jsbn = __commonJS({
|
|
|
2642
2579
|
Classic.prototype.mulTo = cMulTo;
|
|
2643
2580
|
Classic.prototype.sqrTo = cSqrTo;
|
|
2644
2581
|
function bnpInvDigit() {
|
|
2645
|
-
if (this.t < 1)
|
|
2646
|
-
return 0;
|
|
2582
|
+
if (this.t < 1) return 0;
|
|
2647
2583
|
var x = this[0];
|
|
2648
|
-
if ((x & 1) == 0)
|
|
2649
|
-
return 0;
|
|
2584
|
+
if ((x & 1) == 0) return 0;
|
|
2650
2585
|
var y = x & 3;
|
|
2651
2586
|
y = y * (2 - (x & 15) * y) & 15;
|
|
2652
2587
|
y = y * (2 - (x & 255) * y) & 255;
|
|
@@ -2666,8 +2601,7 @@ var require_jsbn = __commonJS({
|
|
|
2666
2601
|
var r = nbi();
|
|
2667
2602
|
x.abs().dlShiftTo(this.m.t, r);
|
|
2668
2603
|
r.divRemTo(this.m, null, r);
|
|
2669
|
-
if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0)
|
|
2670
|
-
this.m.subTo(r, r);
|
|
2604
|
+
if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);
|
|
2671
2605
|
return r;
|
|
2672
2606
|
}
|
|
2673
2607
|
function montRevert(x) {
|
|
@@ -2691,8 +2625,7 @@ var require_jsbn = __commonJS({
|
|
|
2691
2625
|
}
|
|
2692
2626
|
x.clamp();
|
|
2693
2627
|
x.drShiftTo(this.m.t, x);
|
|
2694
|
-
if (x.compareTo(this.m) >= 0)
|
|
2695
|
-
x.subTo(this.m, x);
|
|
2628
|
+
if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);
|
|
2696
2629
|
}
|
|
2697
2630
|
function montSqrTo(x, r) {
|
|
2698
2631
|
x.squareTo(r);
|
|
@@ -2711,14 +2644,12 @@ var require_jsbn = __commonJS({
|
|
|
2711
2644
|
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
|
|
2712
2645
|
}
|
|
2713
2646
|
function bnpExp(e, z2) {
|
|
2714
|
-
if (e > 4294967295 || e < 1)
|
|
2715
|
-
return BigInteger.ONE;
|
|
2647
|
+
if (e > 4294967295 || e < 1) return BigInteger.ONE;
|
|
2716
2648
|
var r = nbi(), r2 = nbi(), g = z2.convert(this), i = nbits(e) - 1;
|
|
2717
2649
|
g.copyTo(r);
|
|
2718
2650
|
while (--i >= 0) {
|
|
2719
2651
|
z2.sqrTo(r, r2);
|
|
2720
|
-
if ((e & 1 << i) > 0)
|
|
2721
|
-
z2.mulTo(r2, g, r);
|
|
2652
|
+
if ((e & 1 << i) > 0) z2.mulTo(r2, g, r);
|
|
2722
2653
|
else {
|
|
2723
2654
|
var t2 = r;
|
|
2724
2655
|
r = r2;
|
|
@@ -2729,10 +2660,8 @@ var require_jsbn = __commonJS({
|
|
|
2729
2660
|
}
|
|
2730
2661
|
function bnModPowInt(e, m) {
|
|
2731
2662
|
var z2;
|
|
2732
|
-
if (e < 256 || m.isEven())
|
|
2733
|
-
|
|
2734
|
-
else
|
|
2735
|
-
z2 = new Montgomery(m);
|
|
2663
|
+
if (e < 256 || m.isEven()) z2 = new Classic(m);
|
|
2664
|
+
else z2 = new Montgomery(m);
|
|
2736
2665
|
return this.exp(e, z2);
|
|
2737
2666
|
}
|
|
2738
2667
|
BigInteger.prototype.copyTo = bnpCopyTo;
|
|
@@ -2766,14 +2695,10 @@ var require_jsbn = __commonJS({
|
|
|
2766
2695
|
}
|
|
2767
2696
|
function bnIntValue() {
|
|
2768
2697
|
if (this.s < 0) {
|
|
2769
|
-
if (this.t == 1)
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
} else if (this.t == 1)
|
|
2774
|
-
return this[0];
|
|
2775
|
-
else if (this.t == 0)
|
|
2776
|
-
return 0;
|
|
2698
|
+
if (this.t == 1) return this[0] - this.DV;
|
|
2699
|
+
else if (this.t == 0) return -1;
|
|
2700
|
+
} else if (this.t == 1) return this[0];
|
|
2701
|
+
else if (this.t == 0) return 0;
|
|
2777
2702
|
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
2778
2703
|
}
|
|
2779
2704
|
function bnByteValue() {
|
|
@@ -2786,18 +2711,13 @@ var require_jsbn = __commonJS({
|
|
|
2786
2711
|
return Math.floor(Math.LN2 * this.DB / Math.log(r));
|
|
2787
2712
|
}
|
|
2788
2713
|
function bnSigNum() {
|
|
2789
|
-
if (this.s < 0)
|
|
2790
|
-
|
|
2791
|
-
else
|
|
2792
|
-
return 0;
|
|
2793
|
-
else
|
|
2794
|
-
return 1;
|
|
2714
|
+
if (this.s < 0) return -1;
|
|
2715
|
+
else if (this.t <= 0 || this.t == 1 && this[0] <= 0) return 0;
|
|
2716
|
+
else return 1;
|
|
2795
2717
|
}
|
|
2796
2718
|
function bnpToRadix(b) {
|
|
2797
|
-
if (b == null)
|
|
2798
|
-
|
|
2799
|
-
if (this.signum() == 0 || b < 2 || b > 36)
|
|
2800
|
-
return "0";
|
|
2719
|
+
if (b == null) b = 10;
|
|
2720
|
+
if (this.signum() == 0 || b < 2 || b > 36) return "0";
|
|
2801
2721
|
var cs = this.chunkSize(b);
|
|
2802
2722
|
var a = Math.pow(b, cs);
|
|
2803
2723
|
var d = nbv(a), y = nbi(), z2 = nbi(), r = "";
|
|
@@ -2810,15 +2730,13 @@ var require_jsbn = __commonJS({
|
|
|
2810
2730
|
}
|
|
2811
2731
|
function bnpFromRadix(s, b) {
|
|
2812
2732
|
this.fromInt(0);
|
|
2813
|
-
if (b == null)
|
|
2814
|
-
b = 10;
|
|
2733
|
+
if (b == null) b = 10;
|
|
2815
2734
|
var cs = this.chunkSize(b);
|
|
2816
2735
|
var d = Math.pow(b, cs), mi = false, j = 0, w = 0;
|
|
2817
2736
|
for (var i = 0; i < s.length; ++i) {
|
|
2818
2737
|
var x = intAt(s, i);
|
|
2819
2738
|
if (x < 0) {
|
|
2820
|
-
if (s.charAt(i) == "-" && this.signum() == 0)
|
|
2821
|
-
mi = true;
|
|
2739
|
+
if (s.charAt(i) == "-" && this.signum() == 0) mi = true;
|
|
2822
2740
|
continue;
|
|
2823
2741
|
}
|
|
2824
2742
|
w = b * w + x;
|
|
@@ -2833,33 +2751,27 @@ var require_jsbn = __commonJS({
|
|
|
2833
2751
|
this.dMultiply(Math.pow(b, j));
|
|
2834
2752
|
this.dAddOffset(w, 0);
|
|
2835
2753
|
}
|
|
2836
|
-
if (mi)
|
|
2837
|
-
BigInteger.ZERO.subTo(this, this);
|
|
2754
|
+
if (mi) BigInteger.ZERO.subTo(this, this);
|
|
2838
2755
|
}
|
|
2839
2756
|
function bnpFromNumber(a, b, c) {
|
|
2840
2757
|
if ("number" == typeof b) {
|
|
2841
|
-
if (a < 2)
|
|
2842
|
-
this.fromInt(1);
|
|
2758
|
+
if (a < 2) this.fromInt(1);
|
|
2843
2759
|
else {
|
|
2844
2760
|
this.fromNumber(a, c);
|
|
2845
2761
|
if (!this.testBit(a - 1))
|
|
2846
2762
|
this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);
|
|
2847
|
-
if (this.isEven())
|
|
2848
|
-
this.dAddOffset(1, 0);
|
|
2763
|
+
if (this.isEven()) this.dAddOffset(1, 0);
|
|
2849
2764
|
while (!this.isProbablePrime(b)) {
|
|
2850
2765
|
this.dAddOffset(2, 0);
|
|
2851
|
-
if (this.bitLength() > a)
|
|
2852
|
-
this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);
|
|
2766
|
+
if (this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);
|
|
2853
2767
|
}
|
|
2854
2768
|
}
|
|
2855
2769
|
} else {
|
|
2856
2770
|
var x = new Array(), t2 = a & 7;
|
|
2857
2771
|
x.length = (a >> 3) + 1;
|
|
2858
2772
|
b.nextBytes(x);
|
|
2859
|
-
if (t2 > 0)
|
|
2860
|
-
|
|
2861
|
-
else
|
|
2862
|
-
x[0] = 0;
|
|
2773
|
+
if (t2 > 0) x[0] &= (1 << t2) - 1;
|
|
2774
|
+
else x[0] = 0;
|
|
2863
2775
|
this.fromString(x, 256);
|
|
2864
2776
|
}
|
|
2865
2777
|
}
|
|
@@ -2881,12 +2793,9 @@ var require_jsbn = __commonJS({
|
|
|
2881
2793
|
--i;
|
|
2882
2794
|
}
|
|
2883
2795
|
}
|
|
2884
|
-
if ((d & 128) != 0)
|
|
2885
|
-
|
|
2886
|
-
if (k
|
|
2887
|
-
++k;
|
|
2888
|
-
if (k > 0 || d != this.s)
|
|
2889
|
-
r[k++] = d;
|
|
2796
|
+
if ((d & 128) != 0) d |= -256;
|
|
2797
|
+
if (k == 0 && (this.s & 128) != (d & 128)) ++k;
|
|
2798
|
+
if (k > 0 || d != this.s) r[k++] = d;
|
|
2890
2799
|
}
|
|
2891
2800
|
}
|
|
2892
2801
|
return r;
|
|
@@ -2902,17 +2811,14 @@ var require_jsbn = __commonJS({
|
|
|
2902
2811
|
}
|
|
2903
2812
|
function bnpBitwiseTo(a, op, r) {
|
|
2904
2813
|
var i, f, m = Math.min(a.t, this.t);
|
|
2905
|
-
for (i = 0; i < m; ++i)
|
|
2906
|
-
r[i] = op(this[i], a[i]);
|
|
2814
|
+
for (i = 0; i < m; ++i) r[i] = op(this[i], a[i]);
|
|
2907
2815
|
if (a.t < this.t) {
|
|
2908
2816
|
f = a.s & this.DM;
|
|
2909
|
-
for (i = m; i < this.t; ++i)
|
|
2910
|
-
r[i] = op(this[i], f);
|
|
2817
|
+
for (i = m; i < this.t; ++i) r[i] = op(this[i], f);
|
|
2911
2818
|
r.t = this.t;
|
|
2912
2819
|
} else {
|
|
2913
2820
|
f = this.s & this.DM;
|
|
2914
|
-
for (i = m; i < a.t; ++i)
|
|
2915
|
-
r[i] = op(f, a[i]);
|
|
2821
|
+
for (i = m; i < a.t; ++i) r[i] = op(f, a[i]);
|
|
2916
2822
|
r.t = a.t;
|
|
2917
2823
|
}
|
|
2918
2824
|
r.s = op(this.s, a.s);
|
|
@@ -2952,31 +2858,25 @@ var require_jsbn = __commonJS({
|
|
|
2952
2858
|
}
|
|
2953
2859
|
function bnNot() {
|
|
2954
2860
|
var r = nbi();
|
|
2955
|
-
for (var i = 0; i < this.t; ++i)
|
|
2956
|
-
r[i] = this.DM & ~this[i];
|
|
2861
|
+
for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i];
|
|
2957
2862
|
r.t = this.t;
|
|
2958
2863
|
r.s = ~this.s;
|
|
2959
2864
|
return r;
|
|
2960
2865
|
}
|
|
2961
2866
|
function bnShiftLeft(n) {
|
|
2962
2867
|
var r = nbi();
|
|
2963
|
-
if (n < 0)
|
|
2964
|
-
|
|
2965
|
-
else
|
|
2966
|
-
this.lShiftTo(n, r);
|
|
2868
|
+
if (n < 0) this.rShiftTo(-n, r);
|
|
2869
|
+
else this.lShiftTo(n, r);
|
|
2967
2870
|
return r;
|
|
2968
2871
|
}
|
|
2969
2872
|
function bnShiftRight(n) {
|
|
2970
2873
|
var r = nbi();
|
|
2971
|
-
if (n < 0)
|
|
2972
|
-
|
|
2973
|
-
else
|
|
2974
|
-
this.rShiftTo(n, r);
|
|
2874
|
+
if (n < 0) this.lShiftTo(-n, r);
|
|
2875
|
+
else this.rShiftTo(n, r);
|
|
2975
2876
|
return r;
|
|
2976
2877
|
}
|
|
2977
2878
|
function lbit(x) {
|
|
2978
|
-
if (x == 0)
|
|
2979
|
-
return -1;
|
|
2879
|
+
if (x == 0) return -1;
|
|
2980
2880
|
var r = 0;
|
|
2981
2881
|
if ((x & 65535) == 0) {
|
|
2982
2882
|
x >>= 16;
|
|
@@ -2994,16 +2894,13 @@ var require_jsbn = __commonJS({
|
|
|
2994
2894
|
x >>= 2;
|
|
2995
2895
|
r += 2;
|
|
2996
2896
|
}
|
|
2997
|
-
if ((x & 1) == 0)
|
|
2998
|
-
++r;
|
|
2897
|
+
if ((x & 1) == 0) ++r;
|
|
2999
2898
|
return r;
|
|
3000
2899
|
}
|
|
3001
2900
|
function bnGetLowestSetBit() {
|
|
3002
2901
|
for (var i = 0; i < this.t; ++i)
|
|
3003
|
-
if (this[i] != 0)
|
|
3004
|
-
|
|
3005
|
-
if (this.s < 0)
|
|
3006
|
-
return this.t * this.DB;
|
|
2902
|
+
if (this[i] != 0) return i * this.DB + lbit(this[i]);
|
|
2903
|
+
if (this.s < 0) return this.t * this.DB;
|
|
3007
2904
|
return -1;
|
|
3008
2905
|
}
|
|
3009
2906
|
function cbit(x) {
|
|
@@ -3016,14 +2913,12 @@ var require_jsbn = __commonJS({
|
|
|
3016
2913
|
}
|
|
3017
2914
|
function bnBitCount() {
|
|
3018
2915
|
var r = 0, x = this.s & this.DM;
|
|
3019
|
-
for (var i = 0; i < this.t; ++i)
|
|
3020
|
-
r += cbit(this[i] ^ x);
|
|
2916
|
+
for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x);
|
|
3021
2917
|
return r;
|
|
3022
2918
|
}
|
|
3023
2919
|
function bnTestBit(n) {
|
|
3024
2920
|
var j = Math.floor(n / this.DB);
|
|
3025
|
-
if (j >= this.t)
|
|
3026
|
-
return this.s != 0;
|
|
2921
|
+
if (j >= this.t) return this.s != 0;
|
|
3027
2922
|
return (this[j] & 1 << n % this.DB) != 0;
|
|
3028
2923
|
}
|
|
3029
2924
|
function bnpChangeBit(n, op) {
|
|
@@ -3065,10 +2960,8 @@ var require_jsbn = __commonJS({
|
|
|
3065
2960
|
c += a.s;
|
|
3066
2961
|
}
|
|
3067
2962
|
r.s = c < 0 ? -1 : 0;
|
|
3068
|
-
if (c > 0)
|
|
3069
|
-
|
|
3070
|
-
else if (c < -1)
|
|
3071
|
-
r[i++] = this.DV + c;
|
|
2963
|
+
if (c > 0) r[i++] = c;
|
|
2964
|
+
else if (c < -1) r[i++] = this.DV + c;
|
|
3072
2965
|
r.t = i;
|
|
3073
2966
|
r.clamp();
|
|
3074
2967
|
}
|
|
@@ -3113,15 +3006,12 @@ var require_jsbn = __commonJS({
|
|
|
3113
3006
|
this.clamp();
|
|
3114
3007
|
}
|
|
3115
3008
|
function bnpDAddOffset(n, w) {
|
|
3116
|
-
if (n == 0)
|
|
3117
|
-
|
|
3118
|
-
while (this.t <= w)
|
|
3119
|
-
this[this.t++] = 0;
|
|
3009
|
+
if (n == 0) return;
|
|
3010
|
+
while (this.t <= w) this[this.t++] = 0;
|
|
3120
3011
|
this[w] += n;
|
|
3121
3012
|
while (this[w] >= this.DV) {
|
|
3122
3013
|
this[w] -= this.DV;
|
|
3123
|
-
if (++w >= this.t)
|
|
3124
|
-
this[this.t++] = 0;
|
|
3014
|
+
if (++w >= this.t) this[this.t++] = 0;
|
|
3125
3015
|
++this[w];
|
|
3126
3016
|
}
|
|
3127
3017
|
}
|
|
@@ -3147,21 +3037,17 @@ var require_jsbn = __commonJS({
|
|
|
3147
3037
|
var i = Math.min(this.t + a.t, n);
|
|
3148
3038
|
r.s = 0;
|
|
3149
3039
|
r.t = i;
|
|
3150
|
-
while (i > 0)
|
|
3151
|
-
r[--i] = 0;
|
|
3040
|
+
while (i > 0) r[--i] = 0;
|
|
3152
3041
|
var j;
|
|
3153
|
-
for (j = r.t - this.t; i < j; ++i)
|
|
3154
|
-
|
|
3155
|
-
for (j = Math.min(a.t, n); i < j; ++i)
|
|
3156
|
-
this.am(0, a[i], r, i, 0, n - i);
|
|
3042
|
+
for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);
|
|
3043
|
+
for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i);
|
|
3157
3044
|
r.clamp();
|
|
3158
3045
|
}
|
|
3159
3046
|
function bnpMultiplyUpperTo(a, n, r) {
|
|
3160
3047
|
--n;
|
|
3161
3048
|
var i = r.t = this.t + a.t - n;
|
|
3162
3049
|
r.s = 0;
|
|
3163
|
-
while (--i >= 0)
|
|
3164
|
-
r[i] = 0;
|
|
3050
|
+
while (--i >= 0) r[i] = 0;
|
|
3165
3051
|
for (i = Math.max(n - this.t, 0); i < a.t; ++i)
|
|
3166
3052
|
r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);
|
|
3167
3053
|
r.clamp();
|
|
@@ -3175,10 +3061,8 @@ var require_jsbn = __commonJS({
|
|
|
3175
3061
|
this.m = m;
|
|
3176
3062
|
}
|
|
3177
3063
|
function barrettConvert(x) {
|
|
3178
|
-
if (x.s < 0 || x.t > 2 * this.m.t)
|
|
3179
|
-
|
|
3180
|
-
else if (x.compareTo(this.m) < 0)
|
|
3181
|
-
return x;
|
|
3064
|
+
if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m);
|
|
3065
|
+
else if (x.compareTo(this.m) < 0) return x;
|
|
3182
3066
|
else {
|
|
3183
3067
|
var r = nbi();
|
|
3184
3068
|
x.copyTo(r);
|
|
@@ -3197,11 +3081,9 @@ var require_jsbn = __commonJS({
|
|
|
3197
3081
|
}
|
|
3198
3082
|
this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);
|
|
3199
3083
|
this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);
|
|
3200
|
-
while (x.compareTo(this.r2) < 0)
|
|
3201
|
-
x.dAddOffset(1, this.m.t + 1);
|
|
3084
|
+
while (x.compareTo(this.r2) < 0) x.dAddOffset(1, this.m.t + 1);
|
|
3202
3085
|
x.subTo(this.r2, x);
|
|
3203
|
-
while (x.compareTo(this.m) >= 0)
|
|
3204
|
-
x.subTo(this.m, x);
|
|
3086
|
+
while (x.compareTo(this.m) >= 0) x.subTo(this.m, x);
|
|
3205
3087
|
}
|
|
3206
3088
|
function barrettSqrTo(x, r) {
|
|
3207
3089
|
x.squareTo(r);
|
|
@@ -3218,18 +3100,12 @@ var require_jsbn = __commonJS({
|
|
|
3218
3100
|
Barrett.prototype.sqrTo = barrettSqrTo;
|
|
3219
3101
|
function bnModPow(e, m) {
|
|
3220
3102
|
var i = e.bitLength(), k, r = nbv(1), z2;
|
|
3221
|
-
if (i <= 0)
|
|
3222
|
-
|
|
3223
|
-
else if (i <
|
|
3224
|
-
|
|
3225
|
-
else if (i <
|
|
3226
|
-
|
|
3227
|
-
else if (i < 144)
|
|
3228
|
-
k = 4;
|
|
3229
|
-
else if (i < 768)
|
|
3230
|
-
k = 5;
|
|
3231
|
-
else
|
|
3232
|
-
k = 6;
|
|
3103
|
+
if (i <= 0) return r;
|
|
3104
|
+
else if (i < 18) k = 1;
|
|
3105
|
+
else if (i < 48) k = 3;
|
|
3106
|
+
else if (i < 144) k = 4;
|
|
3107
|
+
else if (i < 768) k = 5;
|
|
3108
|
+
else k = 6;
|
|
3233
3109
|
if (i < 8)
|
|
3234
3110
|
z2 = new Classic(m);
|
|
3235
3111
|
else if (m.isEven())
|
|
@@ -3250,12 +3126,10 @@ var require_jsbn = __commonJS({
|
|
|
3250
3126
|
var j = e.t - 1, w, is1 = true, r2 = nbi(), t2;
|
|
3251
3127
|
i = nbits(e[j]) - 1;
|
|
3252
3128
|
while (j >= 0) {
|
|
3253
|
-
if (i >= k1)
|
|
3254
|
-
w = e[j] >> i - k1 & km;
|
|
3129
|
+
if (i >= k1) w = e[j] >> i - k1 & km;
|
|
3255
3130
|
else {
|
|
3256
3131
|
w = (e[j] & (1 << i + 1) - 1) << k1 - i;
|
|
3257
|
-
if (j > 0)
|
|
3258
|
-
w |= e[j - 1] >> this.DB + i - k1;
|
|
3132
|
+
if (j > 0) w |= e[j - 1] >> this.DB + i - k1;
|
|
3259
3133
|
}
|
|
3260
3134
|
n = k;
|
|
3261
3135
|
while ((w & 1) == 0) {
|
|
@@ -3275,8 +3149,7 @@ var require_jsbn = __commonJS({
|
|
|
3275
3149
|
z2.sqrTo(r2, r);
|
|
3276
3150
|
n -= 2;
|
|
3277
3151
|
}
|
|
3278
|
-
if (n > 0)
|
|
3279
|
-
z2.sqrTo(r, r2);
|
|
3152
|
+
if (n > 0) z2.sqrTo(r, r2);
|
|
3280
3153
|
else {
|
|
3281
3154
|
t2 = r;
|
|
3282
3155
|
r = r2;
|
|
@@ -3306,19 +3179,15 @@ var require_jsbn = __commonJS({
|
|
|
3306
3179
|
y = t2;
|
|
3307
3180
|
}
|
|
3308
3181
|
var i = x.getLowestSetBit(), g = y.getLowestSetBit();
|
|
3309
|
-
if (g < 0)
|
|
3310
|
-
|
|
3311
|
-
if (i < g)
|
|
3312
|
-
g = i;
|
|
3182
|
+
if (g < 0) return x;
|
|
3183
|
+
if (i < g) g = i;
|
|
3313
3184
|
if (g > 0) {
|
|
3314
3185
|
x.rShiftTo(g, x);
|
|
3315
3186
|
y.rShiftTo(g, y);
|
|
3316
3187
|
}
|
|
3317
3188
|
while (x.signum() > 0) {
|
|
3318
|
-
if ((i = x.getLowestSetBit()) > 0)
|
|
3319
|
-
|
|
3320
|
-
if ((i = y.getLowestSetBit()) > 0)
|
|
3321
|
-
y.rShiftTo(i, y);
|
|
3189
|
+
if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x);
|
|
3190
|
+
if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y);
|
|
3322
3191
|
if (x.compareTo(y) >= 0) {
|
|
3323
3192
|
x.subTo(y, x);
|
|
3324
3193
|
x.rShiftTo(1, x);
|
|
@@ -3327,26 +3196,20 @@ var require_jsbn = __commonJS({
|
|
|
3327
3196
|
y.rShiftTo(1, y);
|
|
3328
3197
|
}
|
|
3329
3198
|
}
|
|
3330
|
-
if (g > 0)
|
|
3331
|
-
y.lShiftTo(g, y);
|
|
3199
|
+
if (g > 0) y.lShiftTo(g, y);
|
|
3332
3200
|
return y;
|
|
3333
3201
|
}
|
|
3334
3202
|
function bnpModInt(n) {
|
|
3335
|
-
if (n <= 0)
|
|
3336
|
-
return 0;
|
|
3203
|
+
if (n <= 0) return 0;
|
|
3337
3204
|
var d = this.DV % n, r = this.s < 0 ? n - 1 : 0;
|
|
3338
3205
|
if (this.t > 0)
|
|
3339
|
-
if (d == 0)
|
|
3340
|
-
|
|
3341
|
-
else
|
|
3342
|
-
for (var i = this.t - 1; i >= 0; --i)
|
|
3343
|
-
r = (d * r + this[i]) % n;
|
|
3206
|
+
if (d == 0) r = this[0] % n;
|
|
3207
|
+
else for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n;
|
|
3344
3208
|
return r;
|
|
3345
3209
|
}
|
|
3346
3210
|
function bnModInverse(m) {
|
|
3347
3211
|
var ac = m.isEven();
|
|
3348
|
-
if (this.isEven() && ac || m.signum() == 0)
|
|
3349
|
-
return BigInteger.ZERO;
|
|
3212
|
+
if (this.isEven() && ac || m.signum() == 0) return BigInteger.ZERO;
|
|
3350
3213
|
var u = m.clone(), v = this.clone();
|
|
3351
3214
|
var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
|
|
3352
3215
|
while (u.signum() != 0) {
|
|
@@ -3358,8 +3221,7 @@ var require_jsbn = __commonJS({
|
|
|
3358
3221
|
b.subTo(m, b);
|
|
3359
3222
|
}
|
|
3360
3223
|
a.rShiftTo(1, a);
|
|
3361
|
-
} else if (!b.isEven())
|
|
3362
|
-
b.subTo(m, b);
|
|
3224
|
+
} else if (!b.isEven()) b.subTo(m, b);
|
|
3363
3225
|
b.rShiftTo(1, b);
|
|
3364
3226
|
}
|
|
3365
3227
|
while (v.isEven()) {
|
|
@@ -3370,34 +3232,25 @@ var require_jsbn = __commonJS({
|
|
|
3370
3232
|
d.subTo(m, d);
|
|
3371
3233
|
}
|
|
3372
3234
|
c.rShiftTo(1, c);
|
|
3373
|
-
} else if (!d.isEven())
|
|
3374
|
-
d.subTo(m, d);
|
|
3235
|
+
} else if (!d.isEven()) d.subTo(m, d);
|
|
3375
3236
|
d.rShiftTo(1, d);
|
|
3376
3237
|
}
|
|
3377
3238
|
if (u.compareTo(v) >= 0) {
|
|
3378
3239
|
u.subTo(v, u);
|
|
3379
|
-
if (ac)
|
|
3380
|
-
a.subTo(c, a);
|
|
3240
|
+
if (ac) a.subTo(c, a);
|
|
3381
3241
|
b.subTo(d, b);
|
|
3382
3242
|
} else {
|
|
3383
3243
|
v.subTo(u, v);
|
|
3384
|
-
if (ac)
|
|
3385
|
-
c.subTo(a, c);
|
|
3244
|
+
if (ac) c.subTo(a, c);
|
|
3386
3245
|
d.subTo(b, d);
|
|
3387
3246
|
}
|
|
3388
3247
|
}
|
|
3389
|
-
if (v.compareTo(BigInteger.ONE) != 0)
|
|
3390
|
-
|
|
3391
|
-
if (d.
|
|
3392
|
-
|
|
3393
|
-
if (d.signum() < 0)
|
|
3394
|
-
|
|
3395
|
-
else
|
|
3396
|
-
return d;
|
|
3397
|
-
if (d.signum() < 0)
|
|
3398
|
-
return d.add(m);
|
|
3399
|
-
else
|
|
3400
|
-
return d;
|
|
3248
|
+
if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
|
|
3249
|
+
if (d.compareTo(m) >= 0) return d.subtract(m);
|
|
3250
|
+
if (d.signum() < 0) d.addTo(m, d);
|
|
3251
|
+
else return d;
|
|
3252
|
+
if (d.signum() < 0) return d.add(m);
|
|
3253
|
+
else return d;
|
|
3401
3254
|
}
|
|
3402
3255
|
var lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];
|
|
3403
3256
|
var lplim = (1 << 26) / lowprimes[lowprimes.length - 1];
|
|
@@ -3405,33 +3258,26 @@ var require_jsbn = __commonJS({
|
|
|
3405
3258
|
var i, x = this.abs();
|
|
3406
3259
|
if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {
|
|
3407
3260
|
for (i = 0; i < lowprimes.length; ++i)
|
|
3408
|
-
if (x[0] == lowprimes[i])
|
|
3409
|
-
return true;
|
|
3261
|
+
if (x[0] == lowprimes[i]) return true;
|
|
3410
3262
|
return false;
|
|
3411
3263
|
}
|
|
3412
|
-
if (x.isEven())
|
|
3413
|
-
return false;
|
|
3264
|
+
if (x.isEven()) return false;
|
|
3414
3265
|
i = 1;
|
|
3415
3266
|
while (i < lowprimes.length) {
|
|
3416
3267
|
var m = lowprimes[i], j = i + 1;
|
|
3417
|
-
while (j < lowprimes.length && m < lplim)
|
|
3418
|
-
m *= lowprimes[j++];
|
|
3268
|
+
while (j < lowprimes.length && m < lplim) m *= lowprimes[j++];
|
|
3419
3269
|
m = x.modInt(m);
|
|
3420
|
-
while (i < j)
|
|
3421
|
-
if (m % lowprimes[i++] == 0)
|
|
3422
|
-
return false;
|
|
3270
|
+
while (i < j) if (m % lowprimes[i++] == 0) return false;
|
|
3423
3271
|
}
|
|
3424
3272
|
return x.millerRabin(t2);
|
|
3425
3273
|
}
|
|
3426
3274
|
function bnpMillerRabin(t2) {
|
|
3427
3275
|
var n1 = this.subtract(BigInteger.ONE);
|
|
3428
3276
|
var k = n1.getLowestSetBit();
|
|
3429
|
-
if (k <= 0)
|
|
3430
|
-
return false;
|
|
3277
|
+
if (k <= 0) return false;
|
|
3431
3278
|
var r = n1.shiftRight(k);
|
|
3432
3279
|
t2 = t2 + 1 >> 1;
|
|
3433
|
-
if (t2 > lowprimes.length)
|
|
3434
|
-
t2 = lowprimes.length;
|
|
3280
|
+
if (t2 > lowprimes.length) t2 = lowprimes.length;
|
|
3435
3281
|
var a = nbi();
|
|
3436
3282
|
for (var i = 0; i < t2; ++i) {
|
|
3437
3283
|
a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
|
|
@@ -3440,11 +3286,9 @@ var require_jsbn = __commonJS({
|
|
|
3440
3286
|
var j = 1;
|
|
3441
3287
|
while (j++ < k && y.compareTo(n1) != 0) {
|
|
3442
3288
|
y = y.modPowInt(2, this);
|
|
3443
|
-
if (y.compareTo(BigInteger.ONE) == 0)
|
|
3444
|
-
return false;
|
|
3289
|
+
if (y.compareTo(BigInteger.ONE) == 0) return false;
|
|
3445
3290
|
}
|
|
3446
|
-
if (y.compareTo(n1) != 0)
|
|
3447
|
-
return false;
|
|
3291
|
+
if (y.compareTo(n1) != 0) return false;
|
|
3448
3292
|
}
|
|
3449
3293
|
}
|
|
3450
3294
|
return true;
|
|
@@ -3505,8 +3349,7 @@ var require_jsbn = __commonJS({
|
|
|
3505
3349
|
rng_pool[rng_pptr++] ^= x >> 8 & 255;
|
|
3506
3350
|
rng_pool[rng_pptr++] ^= x >> 16 & 255;
|
|
3507
3351
|
rng_pool[rng_pptr++] ^= x >> 24 & 255;
|
|
3508
|
-
if (rng_pptr >= rng_psize)
|
|
3509
|
-
rng_pptr -= rng_psize;
|
|
3352
|
+
if (rng_pptr >= rng_psize) rng_pptr -= rng_psize;
|
|
3510
3353
|
}
|
|
3511
3354
|
function rng_seed_time() {
|
|
3512
3355
|
rng_seed_int((/* @__PURE__ */ new Date()).getTime());
|
|
@@ -3548,8 +3391,7 @@ var require_jsbn = __commonJS({
|
|
|
3548
3391
|
}
|
|
3549
3392
|
function rng_get_bytes(ba) {
|
|
3550
3393
|
var i;
|
|
3551
|
-
for (i = 0; i < ba.length; ++i)
|
|
3552
|
-
ba[i] = rng_get_byte();
|
|
3394
|
+
for (i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
|
|
3553
3395
|
}
|
|
3554
3396
|
function SecureRandom() {
|
|
3555
3397
|
}
|
|
@@ -3611,20 +3453,15 @@ var require_asn1 = __commonJS({
|
|
|
3611
3453
|
function bigintToValue(bigint) {
|
|
3612
3454
|
let h = bigint.toString(16);
|
|
3613
3455
|
if (h[0] !== "-") {
|
|
3614
|
-
if (h.length % 2 === 1)
|
|
3615
|
-
|
|
3616
|
-
else if (!h.match(/^[0-7]/))
|
|
3617
|
-
h = "00" + h;
|
|
3456
|
+
if (h.length % 2 === 1) h = "0" + h;
|
|
3457
|
+
else if (!h.match(/^[0-7]/)) h = "00" + h;
|
|
3618
3458
|
} else {
|
|
3619
3459
|
h = h.substr(1);
|
|
3620
3460
|
let len = h.length;
|
|
3621
|
-
if (len % 2 === 1)
|
|
3622
|
-
|
|
3623
|
-
else if (!h.match(/^[0-7]/))
|
|
3624
|
-
len += 2;
|
|
3461
|
+
if (len % 2 === 1) len += 1;
|
|
3462
|
+
else if (!h.match(/^[0-7]/)) len += 2;
|
|
3625
3463
|
let mask = "";
|
|
3626
|
-
for (let i = 0; i < len; i++)
|
|
3627
|
-
mask += "f";
|
|
3464
|
+
for (let i = 0; i < len; i++) mask += "f";
|
|
3628
3465
|
mask = new BigInteger(mask, 16);
|
|
3629
3466
|
h = mask.xor(bigint).add(BigInteger.ONE);
|
|
3630
3467
|
h = h.toString(16).replace(/^-/, "");
|
|
@@ -3652,8 +3489,7 @@ var require_asn1 = __commonJS({
|
|
|
3652
3489
|
getLength() {
|
|
3653
3490
|
const n = this.v.length / 2;
|
|
3654
3491
|
let nHex = n.toString(16);
|
|
3655
|
-
if (nHex.length % 2 === 1)
|
|
3656
|
-
nHex = "0" + nHex;
|
|
3492
|
+
if (nHex.length % 2 === 1) nHex = "0" + nHex;
|
|
3657
3493
|
if (n < 128) {
|
|
3658
3494
|
return nHex;
|
|
3659
3495
|
} else {
|
|
@@ -3669,8 +3505,7 @@ var require_asn1 = __commonJS({
|
|
|
3669
3505
|
constructor(bigint) {
|
|
3670
3506
|
super();
|
|
3671
3507
|
this.t = "02";
|
|
3672
|
-
if (bigint)
|
|
3673
|
-
this.v = bigintToValue(bigint);
|
|
3508
|
+
if (bigint) this.v = bigintToValue(bigint);
|
|
3674
3509
|
}
|
|
3675
3510
|
getValue() {
|
|
3676
3511
|
return this.v;
|
|
@@ -3688,15 +3523,13 @@ var require_asn1 = __commonJS({
|
|
|
3688
3523
|
}
|
|
3689
3524
|
};
|
|
3690
3525
|
function getLenOfL(str, start) {
|
|
3691
|
-
if (+str[start + 2] < 8)
|
|
3692
|
-
return 1;
|
|
3526
|
+
if (+str[start + 2] < 8) return 1;
|
|
3693
3527
|
return +str.substr(start + 2, 2) & 127 + 1;
|
|
3694
3528
|
}
|
|
3695
3529
|
function getL(str, start) {
|
|
3696
3530
|
const len = getLenOfL(str, start);
|
|
3697
3531
|
const l = str.substr(start + 2, len * 2);
|
|
3698
|
-
if (!l)
|
|
3699
|
-
return -1;
|
|
3532
|
+
if (!l) return -1;
|
|
3700
3533
|
const bigint = +l[0] < 8 ? new BigInteger(l, 16) : new BigInteger(l.substr(2), 16);
|
|
3701
3534
|
return bigint.intValue();
|
|
3702
3535
|
}
|
|
@@ -3749,8 +3582,7 @@ var require_ec = __commonJS({
|
|
|
3749
3582
|
* 判断相等
|
|
3750
3583
|
*/
|
|
3751
3584
|
equals(other) {
|
|
3752
|
-
if (other === this)
|
|
3753
|
-
return true;
|
|
3585
|
+
if (other === this) return true;
|
|
3754
3586
|
return this.q.equals(other.q) && this.x.equals(other.x);
|
|
3755
3587
|
}
|
|
3756
3588
|
/**
|
|
@@ -3805,28 +3637,22 @@ var require_ec = __commonJS({
|
|
|
3805
3637
|
this.zinv = null;
|
|
3806
3638
|
}
|
|
3807
3639
|
getX() {
|
|
3808
|
-
if (this.zinv === null)
|
|
3809
|
-
this.zinv = this.z.modInverse(this.curve.q);
|
|
3640
|
+
if (this.zinv === null) this.zinv = this.z.modInverse(this.curve.q);
|
|
3810
3641
|
return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q));
|
|
3811
3642
|
}
|
|
3812
3643
|
getY() {
|
|
3813
|
-
if (this.zinv === null)
|
|
3814
|
-
this.zinv = this.z.modInverse(this.curve.q);
|
|
3644
|
+
if (this.zinv === null) this.zinv = this.z.modInverse(this.curve.q);
|
|
3815
3645
|
return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q));
|
|
3816
3646
|
}
|
|
3817
3647
|
/**
|
|
3818
3648
|
* 判断相等
|
|
3819
3649
|
*/
|
|
3820
3650
|
equals(other) {
|
|
3821
|
-
if (other === this)
|
|
3822
|
-
|
|
3823
|
-
if (this.isInfinity()
|
|
3824
|
-
return other.isInfinity();
|
|
3825
|
-
if (other.isInfinity())
|
|
3826
|
-
return this.isInfinity();
|
|
3651
|
+
if (other === this) return true;
|
|
3652
|
+
if (this.isInfinity()) return other.isInfinity();
|
|
3653
|
+
if (other.isInfinity()) return this.isInfinity();
|
|
3827
3654
|
const u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q);
|
|
3828
|
-
if (!u.equals(BigInteger.ZERO))
|
|
3829
|
-
return false;
|
|
3655
|
+
if (!u.equals(BigInteger.ZERO)) return false;
|
|
3830
3656
|
const v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q);
|
|
3831
3657
|
return v.equals(BigInteger.ZERO);
|
|
3832
3658
|
}
|
|
@@ -3834,8 +3660,7 @@ var require_ec = __commonJS({
|
|
|
3834
3660
|
* 是否是无穷远点
|
|
3835
3661
|
*/
|
|
3836
3662
|
isInfinity() {
|
|
3837
|
-
if (this.x === null && this.y === null)
|
|
3838
|
-
return true;
|
|
3663
|
+
if (this.x === null && this.y === null) return true;
|
|
3839
3664
|
return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO);
|
|
3840
3665
|
}
|
|
3841
3666
|
/**
|
|
@@ -3865,10 +3690,8 @@ var require_ec = __commonJS({
|
|
|
3865
3690
|
* z3 = λ10 * λ8
|
|
3866
3691
|
*/
|
|
3867
3692
|
add(b) {
|
|
3868
|
-
if (this.isInfinity())
|
|
3869
|
-
|
|
3870
|
-
if (b.isInfinity())
|
|
3871
|
-
return this;
|
|
3693
|
+
if (this.isInfinity()) return b;
|
|
3694
|
+
if (b.isInfinity()) return this;
|
|
3872
3695
|
const x1 = this.x.toBigInteger();
|
|
3873
3696
|
const y1 = this.y.toBigInteger();
|
|
3874
3697
|
const z1 = this.z;
|
|
@@ -3914,10 +3737,8 @@ var require_ec = __commonJS({
|
|
|
3914
3737
|
* z3 = λ2 * λ5
|
|
3915
3738
|
*/
|
|
3916
3739
|
twice() {
|
|
3917
|
-
if (this.isInfinity())
|
|
3918
|
-
|
|
3919
|
-
if (!this.y.toBigInteger().signum())
|
|
3920
|
-
return this.curve.infinity;
|
|
3740
|
+
if (this.isInfinity()) return this;
|
|
3741
|
+
if (!this.y.toBigInteger().signum()) return this.curve.infinity;
|
|
3921
3742
|
const x1 = this.x.toBigInteger();
|
|
3922
3743
|
const y1 = this.y.toBigInteger();
|
|
3923
3744
|
const z1 = this.z;
|
|
@@ -3938,10 +3759,8 @@ var require_ec = __commonJS({
|
|
|
3938
3759
|
* 倍点计算
|
|
3939
3760
|
*/
|
|
3940
3761
|
multiply(k) {
|
|
3941
|
-
if (this.isInfinity())
|
|
3942
|
-
|
|
3943
|
-
if (!k.signum())
|
|
3944
|
-
return this.curve.infinity;
|
|
3762
|
+
if (this.isInfinity()) return this;
|
|
3763
|
+
if (!k.signum()) return this.curve.infinity;
|
|
3945
3764
|
const k3 = k.multiply(THREE);
|
|
3946
3765
|
const neg = this.negate();
|
|
3947
3766
|
let Q = this;
|
|
@@ -3967,8 +3786,7 @@ var require_ec = __commonJS({
|
|
|
3967
3786
|
* 判断两个椭圆曲线是否相等
|
|
3968
3787
|
*/
|
|
3969
3788
|
equals(other) {
|
|
3970
|
-
if (other === this)
|
|
3971
|
-
return true;
|
|
3789
|
+
if (other === this) return true;
|
|
3972
3790
|
return this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b);
|
|
3973
3791
|
}
|
|
3974
3792
|
/**
|
|
@@ -3982,6 +3800,7 @@ var require_ec = __commonJS({
|
|
|
3982
3800
|
*/
|
|
3983
3801
|
decodePointHex(s) {
|
|
3984
3802
|
switch (parseInt(s.substr(0, 2), 16)) {
|
|
3803
|
+
// 第一个字节
|
|
3985
3804
|
case 0:
|
|
3986
3805
|
return this.infinity;
|
|
3987
3806
|
case 2:
|
|
@@ -4048,14 +3867,12 @@ var require_utils = __commonJS({
|
|
|
4048
3867
|
return { privateKey, publicKey };
|
|
4049
3868
|
}
|
|
4050
3869
|
function compressPublicKeyHex(s) {
|
|
4051
|
-
if (s.length !== 130)
|
|
4052
|
-
throw new Error("Invalid public key to compress");
|
|
3870
|
+
if (s.length !== 130) throw new Error("Invalid public key to compress");
|
|
4053
3871
|
const len = (s.length - 2) / 2;
|
|
4054
3872
|
const xHex = s.substr(2, len);
|
|
4055
3873
|
const y = new BigInteger(s.substr(len + 2, len), 16);
|
|
4056
3874
|
let prefix = "03";
|
|
4057
|
-
if (y.mod(new BigInteger("2")).equals(BigInteger.ZERO))
|
|
4058
|
-
prefix = "02";
|
|
3875
|
+
if (y.mod(new BigInteger("2")).equals(BigInteger.ZERO)) prefix = "02";
|
|
4059
3876
|
return prefix + xHex;
|
|
4060
3877
|
}
|
|
4061
3878
|
function utf8ToHex(input) {
|
|
@@ -4074,8 +3891,7 @@ var require_utils = __commonJS({
|
|
|
4074
3891
|
return hexChars.join("");
|
|
4075
3892
|
}
|
|
4076
3893
|
function leftPad(input, num) {
|
|
4077
|
-
if (input.length >= num)
|
|
4078
|
-
return input;
|
|
3894
|
+
if (input.length >= num) return input;
|
|
4079
3895
|
return new Array(num - input.length + 1).join("0") + input;
|
|
4080
3896
|
}
|
|
4081
3897
|
function arrayToHex(arr) {
|
|
@@ -4116,19 +3932,16 @@ var require_utils = __commonJS({
|
|
|
4116
3932
|
}
|
|
4117
3933
|
function verifyPublicKey(publicKey) {
|
|
4118
3934
|
const point = curve.decodePointHex(publicKey);
|
|
4119
|
-
if (!point)
|
|
4120
|
-
return false;
|
|
3935
|
+
if (!point) return false;
|
|
4121
3936
|
const x = point.getX();
|
|
4122
3937
|
const y = point.getY();
|
|
4123
3938
|
return y.square().equals(x.multiply(x.square()).add(x.multiply(curve.a)).add(curve.b));
|
|
4124
3939
|
}
|
|
4125
3940
|
function comparePublicKeyHex(publicKey1, publicKey2) {
|
|
4126
3941
|
const point1 = curve.decodePointHex(publicKey1);
|
|
4127
|
-
if (!point1)
|
|
4128
|
-
return false;
|
|
3942
|
+
if (!point1) return false;
|
|
4129
3943
|
const point2 = curve.decodePointHex(publicKey2);
|
|
4130
|
-
if (!point2)
|
|
4131
|
-
return false;
|
|
3944
|
+
if (!point2) return false;
|
|
4132
3945
|
return point1.equals(point2);
|
|
4133
3946
|
}
|
|
4134
3947
|
module2.exports = {
|
|
@@ -4158,8 +3971,7 @@ var require_sm3 = __commonJS({
|
|
|
4158
3971
|
}
|
|
4159
3972
|
function xor(x, y) {
|
|
4160
3973
|
const result = [];
|
|
4161
|
-
for (let i = x.length - 1; i >= 0; i--)
|
|
4162
|
-
result[i] = (x[i] ^ y[i]) & 255;
|
|
3974
|
+
for (let i = x.length - 1; i >= 0; i--) result[i] = (x[i] ^ y[i]) & 255;
|
|
4163
3975
|
return result;
|
|
4164
3976
|
}
|
|
4165
3977
|
function P0(X) {
|
|
@@ -4174,10 +3986,8 @@ var require_sm3 = __commonJS({
|
|
|
4174
3986
|
k = k >= 448 ? 512 - k % 448 - 1 : 448 - k - 1;
|
|
4175
3987
|
const kArr = new Array((k - 7) / 8);
|
|
4176
3988
|
const lenArr = new Array(8);
|
|
4177
|
-
for (let i = 0, len2 = kArr.length; i < len2; i++)
|
|
4178
|
-
|
|
4179
|
-
for (let i = 0, len2 = lenArr.length; i < len2; i++)
|
|
4180
|
-
lenArr[i] = 0;
|
|
3989
|
+
for (let i = 0, len2 = kArr.length; i < len2; i++) kArr[i] = 0;
|
|
3990
|
+
for (let i = 0, len2 = lenArr.length; i < len2; i++) lenArr[i] = 0;
|
|
4181
3991
|
len = len.toString(2);
|
|
4182
3992
|
for (let i = 7; i >= 0; i--) {
|
|
4183
3993
|
if (len.length > 8) {
|
|
@@ -4260,10 +4070,8 @@ var require_sm3 = __commonJS({
|
|
|
4260
4070
|
oPad[i] = 92;
|
|
4261
4071
|
}
|
|
4262
4072
|
function hmac(input, key2) {
|
|
4263
|
-
if (key2.length > blockLen)
|
|
4264
|
-
|
|
4265
|
-
while (key2.length < blockLen)
|
|
4266
|
-
key2.push(0);
|
|
4073
|
+
if (key2.length > blockLen) key2 = sm3(key2);
|
|
4074
|
+
while (key2.length < blockLen) key2.push(0);
|
|
4267
4075
|
const iPadKey = xor(key2, iPad);
|
|
4268
4076
|
const oPadKey = xor(key2, oPad);
|
|
4269
4077
|
const hash = sm3([...iPadKey, ...input]);
|
|
@@ -4291,8 +4099,7 @@ var require_sm2 = __commonJS({
|
|
|
4291
4099
|
const keypair = _.generateKeyPairHex();
|
|
4292
4100
|
const k = new BigInteger(keypair.privateKey, 16);
|
|
4293
4101
|
let c1 = keypair.publicKey;
|
|
4294
|
-
if (c1.length > 128)
|
|
4295
|
-
c1 = c1.substr(c1.length - 128);
|
|
4102
|
+
if (c1.length > 128) c1 = c1.substr(c1.length - 128);
|
|
4296
4103
|
const p = publicKey.multiply(k);
|
|
4297
4104
|
const x2 = _.hexToArray(_.leftPad(p.getX().toBigInteger().toRadix(16), 64));
|
|
4298
4105
|
const y2 = _.hexToArray(_.leftPad(p.getY().toBigInteger().toRadix(16), 64));
|
|
@@ -4308,8 +4115,7 @@ var require_sm2 = __commonJS({
|
|
|
4308
4115
|
};
|
|
4309
4116
|
nextT();
|
|
4310
4117
|
for (let i = 0, len = msg.length; i < len; i++) {
|
|
4311
|
-
if (offset === t.length)
|
|
4312
|
-
nextT();
|
|
4118
|
+
if (offset === t.length) nextT();
|
|
4313
4119
|
msg[i] ^= t[offset++] & 255;
|
|
4314
4120
|
}
|
|
4315
4121
|
const c2 = _.arrayToHex(msg);
|
|
@@ -4341,8 +4147,7 @@ var require_sm2 = __commonJS({
|
|
|
4341
4147
|
};
|
|
4342
4148
|
nextT();
|
|
4343
4149
|
for (let i = 0, len = msg.length; i < len; i++) {
|
|
4344
|
-
if (offset === t.length)
|
|
4345
|
-
nextT();
|
|
4150
|
+
if (offset === t.length) nextT();
|
|
4346
4151
|
msg[i] ^= t[offset++] & 255;
|
|
4347
4152
|
}
|
|
4348
4153
|
const checkC3 = _.arrayToHex(sm3([].concat(x2, msg, y2)));
|
|
@@ -4382,8 +4187,7 @@ var require_sm2 = __commonJS({
|
|
|
4382
4187
|
} while (r.equals(BigInteger.ZERO) || r.add(k).equals(n));
|
|
4383
4188
|
s = dA.add(BigInteger.ONE).modInverse(n).multiply(k.subtract(r.multiply(dA))).mod(n);
|
|
4384
4189
|
} while (s.equals(BigInteger.ZERO));
|
|
4385
|
-
if (der)
|
|
4386
|
-
return encodeDer(r, s);
|
|
4190
|
+
if (der) return encodeDer(r, s);
|
|
4387
4191
|
return _.leftPad(r.toString(16), 64) + _.leftPad(s.toString(16), 64);
|
|
4388
4192
|
}
|
|
4389
4193
|
function doVerifySignature(msg, signHex, publicKey, { der, hash, userId } = {}) {
|
|
@@ -4404,8 +4208,7 @@ var require_sm2 = __commonJS({
|
|
|
4404
4208
|
const PA = curve.decodePointHex(publicKey);
|
|
4405
4209
|
const e = new BigInteger(hashHex, 16);
|
|
4406
4210
|
const t = r.add(s).mod(n);
|
|
4407
|
-
if (t.equals(BigInteger.ZERO))
|
|
4408
|
-
return false;
|
|
4211
|
+
if (t.equals(BigInteger.ZERO)) return false;
|
|
4409
4212
|
const x1y1 = G.multiply(s).add(PA.multiply(t));
|
|
4410
4213
|
const R = e.add(x1y1.getX().toBigInteger()).mod(n);
|
|
4411
4214
|
return r.equals(R);
|
|
@@ -4466,8 +4269,7 @@ var require_sm32 = __commonJS({
|
|
|
4466
4269
|
"node_modules/.pnpm/sm-crypto@0.3.13/node_modules/sm-crypto/src/sm3/index.js"(exports, module2) {
|
|
4467
4270
|
var { sm3, hmac } = require_sm3();
|
|
4468
4271
|
function leftPad(input, num) {
|
|
4469
|
-
if (input.length >= num)
|
|
4470
|
-
return input;
|
|
4272
|
+
if (input.length >= num) return input;
|
|
4471
4273
|
return new Array(num - input.length + 1).join("0") + input;
|
|
4472
4274
|
}
|
|
4473
4275
|
function ArrayToHex(arr) {
|
|
@@ -4518,11 +4320,9 @@ var require_sm32 = __commonJS({
|
|
|
4518
4320
|
input = typeof input === "string" ? utf8ToArray(input) : Array.prototype.slice.call(input);
|
|
4519
4321
|
if (options) {
|
|
4520
4322
|
const mode = options.mode || "hmac";
|
|
4521
|
-
if (mode !== "hmac")
|
|
4522
|
-
throw new Error("invalid mode");
|
|
4323
|
+
if (mode !== "hmac") throw new Error("invalid mode");
|
|
4523
4324
|
let key2 = options.key;
|
|
4524
|
-
if (!key2)
|
|
4525
|
-
throw new Error("invalid key");
|
|
4325
|
+
if (!key2) throw new Error("invalid key");
|
|
4526
4326
|
key2 = typeof key2 === "string" ? hexToArray(key2) : Array.prototype.slice.call(key2);
|
|
4527
4327
|
return ArrayToHex(hmac(input, key2));
|
|
4528
4328
|
}
|
|
@@ -4965,14 +4765,12 @@ var require_sm4 = __commonJS({
|
|
|
4965
4765
|
output = "string"
|
|
4966
4766
|
} = {}) {
|
|
4967
4767
|
if (mode === "cbc") {
|
|
4968
|
-
if (typeof iv2 === "string")
|
|
4969
|
-
iv2 = hexToArray(iv2);
|
|
4768
|
+
if (typeof iv2 === "string") iv2 = hexToArray(iv2);
|
|
4970
4769
|
if (iv2.length !== 128 / 8) {
|
|
4971
4770
|
throw new Error("iv is invalid");
|
|
4972
4771
|
}
|
|
4973
4772
|
}
|
|
4974
|
-
if (typeof key2 === "string")
|
|
4975
|
-
key2 = hexToArray(key2);
|
|
4773
|
+
if (typeof key2 === "string") key2 = hexToArray(key2);
|
|
4976
4774
|
if (key2.length !== 128 / 8) {
|
|
4977
4775
|
throw new Error("key is invalid");
|
|
4978
4776
|
}
|
|
@@ -4987,8 +4785,7 @@ var require_sm4 = __commonJS({
|
|
|
4987
4785
|
}
|
|
4988
4786
|
if ((padding === "pkcs#5" || padding === "pkcs#7") && cryptFlag !== DECRYPT) {
|
|
4989
4787
|
const paddingCount = BLOCK - inArray.length % BLOCK;
|
|
4990
|
-
for (let i = 0; i < paddingCount; i++)
|
|
4991
|
-
inArray.push(paddingCount);
|
|
4788
|
+
for (let i = 0; i < paddingCount; i++) inArray.push(paddingCount);
|
|
4992
4789
|
}
|
|
4993
4790
|
const roundKey = new Array(ROUND);
|
|
4994
4791
|
sms4KeyExt(key2, roundKey, cryptFlag);
|
|
@@ -5029,8 +4826,7 @@ var require_sm4 = __commonJS({
|
|
|
5029
4826
|
const len = outArray.length;
|
|
5030
4827
|
const paddingCount = outArray[len - 1];
|
|
5031
4828
|
for (let i = 1; i <= paddingCount; i++) {
|
|
5032
|
-
if (outArray[len - i] !== paddingCount)
|
|
5033
|
-
throw new Error("padding is invalid");
|
|
4829
|
+
if (outArray[len - i] !== paddingCount) throw new Error("padding is invalid");
|
|
5034
4830
|
}
|
|
5035
4831
|
outArray.splice(len - paddingCount, paddingCount);
|
|
5036
4832
|
}
|
|
@@ -5067,8 +4863,8 @@ var require_src = __commonJS({
|
|
|
5067
4863
|
});
|
|
5068
4864
|
|
|
5069
4865
|
// src/index.ts
|
|
5070
|
-
var
|
|
5071
|
-
__export(
|
|
4866
|
+
var index_exports = {};
|
|
4867
|
+
__export(index_exports, {
|
|
5072
4868
|
FlexTable: () => FlexTable,
|
|
5073
4869
|
MemoryBasic: () => MemoryBasic,
|
|
5074
4870
|
MemoryList: () => MemoryList,
|
|
@@ -5108,7 +4904,7 @@ __export(src_exports, {
|
|
|
5108
4904
|
rotateRad: () => rotateRad,
|
|
5109
4905
|
wait: () => wait
|
|
5110
4906
|
});
|
|
5111
|
-
module.exports = __toCommonJS(
|
|
4907
|
+
module.exports = __toCommonJS(index_exports);
|
|
5112
4908
|
|
|
5113
4909
|
// src/clamp.ts
|
|
5114
4910
|
var clamp = (value, min, max) => {
|
|
@@ -5231,10 +5027,8 @@ var compareVersion = (from, to) => {
|
|
|
5231
5027
|
for (let i = 0, max = Math.max(froms.length, tos.length); i < max; i++) {
|
|
5232
5028
|
const fromV = +froms[i] || 0;
|
|
5233
5029
|
const toV = +tos[i] || 0;
|
|
5234
|
-
if (fromV > toV)
|
|
5235
|
-
|
|
5236
|
-
if (fromV < toV)
|
|
5237
|
-
return 1;
|
|
5030
|
+
if (fromV > toV) return -1;
|
|
5031
|
+
if (fromV < toV) return 1;
|
|
5238
5032
|
}
|
|
5239
5033
|
return 0;
|
|
5240
5034
|
};
|
|
@@ -5247,11 +5041,9 @@ var hash8strings = (list) => list.reduce((caches, data, index) => {
|
|
|
5247
5041
|
|
|
5248
5042
|
// src/compare/weak-equal.ts
|
|
5249
5043
|
var deepWeakEqual = (from, to, exclude) => {
|
|
5250
|
-
if (typeof from !== "object" || from === null || typeof to !== "object" || to === null)
|
|
5251
|
-
return from === to;
|
|
5044
|
+
if (typeof from !== "object" || from === null || typeof to !== "object" || to === null) return from === to;
|
|
5252
5045
|
if (Array.isArray(from) && Array.isArray(to)) {
|
|
5253
|
-
if (from.length !== to.length)
|
|
5254
|
-
return false;
|
|
5046
|
+
if (from.length !== to.length) return false;
|
|
5255
5047
|
return !from.some((t1, index) => {
|
|
5256
5048
|
if (!deepWeakEqual(t1, to[index])) {
|
|
5257
5049
|
return true;
|
|
@@ -5261,8 +5053,7 @@ var deepWeakEqual = (from, to, exclude) => {
|
|
|
5261
5053
|
const caches = {};
|
|
5262
5054
|
const excludeCaches = exclude && hash8strings(exclude);
|
|
5263
5055
|
for (const key2 in from) {
|
|
5264
|
-
if (excludeCaches && key2 in excludeCaches)
|
|
5265
|
-
continue;
|
|
5056
|
+
if (excludeCaches && key2 in excludeCaches) continue;
|
|
5266
5057
|
if (!deepWeakEqual(from[key2], to[key2])) {
|
|
5267
5058
|
return false;
|
|
5268
5059
|
} else {
|
|
@@ -5270,8 +5061,7 @@ var deepWeakEqual = (from, to, exclude) => {
|
|
|
5270
5061
|
}
|
|
5271
5062
|
}
|
|
5272
5063
|
for (const key2 in to) {
|
|
5273
|
-
if (excludeCaches && key2 in excludeCaches || key2 in caches)
|
|
5274
|
-
continue;
|
|
5064
|
+
if (excludeCaches && key2 in excludeCaches || key2 in caches) continue;
|
|
5275
5065
|
if (!deepWeakEqual(from[key2], to[key2])) {
|
|
5276
5066
|
return false;
|
|
5277
5067
|
}
|
|
@@ -5372,8 +5162,7 @@ var getEncoding = (uint, limit = 1024) => {
|
|
|
5372
5162
|
top:
|
|
5373
5163
|
for (let i = 0, max = Math.min(uint.length, limit); i < max; i++) {
|
|
5374
5164
|
const data = uint[i];
|
|
5375
|
-
if (data < 128)
|
|
5376
|
-
continue;
|
|
5165
|
+
if (data < 128) continue;
|
|
5377
5166
|
const match = data.toString(2).match(utf8_first_prefix);
|
|
5378
5167
|
if (match) {
|
|
5379
5168
|
for (let m = 0; m < match[0].length - 1; m++) {
|
|
@@ -5409,21 +5198,15 @@ var re_this = /\b\(this\b|\bthis[\.\[]\b/;
|
|
|
5409
5198
|
var re_check = /classCallCheck\(this/;
|
|
5410
5199
|
var re_default = /^function\sdefault_\d+\s*\(/;
|
|
5411
5200
|
var isClass = (value, strict = true) => {
|
|
5412
|
-
if (typeof value !== "function")
|
|
5413
|
-
return false;
|
|
5201
|
+
if (typeof value !== "function") return false;
|
|
5414
5202
|
const proto = value.prototype;
|
|
5415
|
-
if (!proto || proto.constructor !== value)
|
|
5416
|
-
return false;
|
|
5203
|
+
if (!proto || proto.constructor !== value) return false;
|
|
5417
5204
|
const str = value.toString();
|
|
5418
|
-
if (str.slice(0, 5) === "class" || Object.getOwnPropertyNames(proto).length >= 2)
|
|
5419
|
-
|
|
5420
|
-
if (
|
|
5421
|
-
return false;
|
|
5422
|
-
if (strict && re_function.test(str))
|
|
5423
|
-
return true;
|
|
5205
|
+
if (str.slice(0, 5) === "class" || Object.getOwnPropertyNames(proto).length >= 2) return true;
|
|
5206
|
+
if (re_anonymous.test(str)) return false;
|
|
5207
|
+
if (strict && re_function.test(str)) return true;
|
|
5424
5208
|
if (re_this.test(str)) {
|
|
5425
|
-
if (!strict || re_check.test(str))
|
|
5426
|
-
return true;
|
|
5209
|
+
if (!strict || re_check.test(str)) return true;
|
|
5427
5210
|
return re_default.test(str);
|
|
5428
5211
|
}
|
|
5429
5212
|
return false;
|
|
@@ -5567,8 +5350,7 @@ var MemoryBasic = class {
|
|
|
5567
5350
|
}
|
|
5568
5351
|
return true;
|
|
5569
5352
|
}
|
|
5570
|
-
}))
|
|
5571
|
-
return this;
|
|
5353
|
+
})) return this;
|
|
5572
5354
|
for (const [type, target] of memorys) {
|
|
5573
5355
|
const memory = this.#reflex(target);
|
|
5574
5356
|
memory.forEach((value, i) => {
|
|
@@ -5591,8 +5373,7 @@ var MemoryBasic = class {
|
|
|
5591
5373
|
*/
|
|
5592
5374
|
deleteType(type) {
|
|
5593
5375
|
const { memorys, list } = this;
|
|
5594
|
-
if (!memorys.has(type))
|
|
5595
|
-
return this;
|
|
5376
|
+
if (!memorys.has(type)) return this;
|
|
5596
5377
|
const local = hash8strings(this.#reflex(memorys.get(type)));
|
|
5597
5378
|
const Memory = this.constructor;
|
|
5598
5379
|
const imitator = new Memory(this.key, {
|
|
@@ -5692,8 +5473,7 @@ var MemorySimple = class {
|
|
|
5692
5473
|
*/
|
|
5693
5474
|
get(type) {
|
|
5694
5475
|
const value = this.#memory.get(type);
|
|
5695
|
-
if (value === null)
|
|
5696
|
-
return value;
|
|
5476
|
+
if (value === null) return value;
|
|
5697
5477
|
return value.length ? value[0] : null;
|
|
5698
5478
|
}
|
|
5699
5479
|
/**
|
|
@@ -5794,8 +5574,7 @@ var Neo4jAhchors = class {
|
|
|
5794
5574
|
neo4j.sources.get(nodeId),
|
|
5795
5575
|
neo4j.targets.get(nodeId)
|
|
5796
5576
|
].forEach((list, i) => {
|
|
5797
|
-
if (!list)
|
|
5798
|
-
return;
|
|
5577
|
+
if (!list) return;
|
|
5799
5578
|
let diffCount = 0;
|
|
5800
5579
|
let sameCount = 0;
|
|
5801
5580
|
list.forEach((edge) => {
|
|
@@ -5844,8 +5623,7 @@ var Neo4jAhchors = class {
|
|
|
5844
5623
|
const target = edge[targetField];
|
|
5845
5624
|
const direct = this.getDir(source, target);
|
|
5846
5625
|
const invert = this.getDir(target, source);
|
|
5847
|
-
if (direct in caches)
|
|
5848
|
-
return;
|
|
5626
|
+
if (direct in caches) return;
|
|
5849
5627
|
const directs = dirs.get(direct) || [];
|
|
5850
5628
|
const inverts = dirs.get(invert) || [];
|
|
5851
5629
|
const directsLength = directs.length;
|
|
@@ -5861,8 +5639,7 @@ var Neo4jAhchors = class {
|
|
|
5861
5639
|
const target = edge[targetField];
|
|
5862
5640
|
const direct = this.getDir(source, target);
|
|
5863
5641
|
const invert = this.getDir(target, source);
|
|
5864
|
-
if (direct in caches)
|
|
5865
|
-
return;
|
|
5642
|
+
if (direct in caches) return;
|
|
5866
5643
|
const directs = neo4j.dirs.get(direct) || [];
|
|
5867
5644
|
const inverts = neo4j.dirs.get(invert) || [];
|
|
5868
5645
|
const directsLength = directs.length;
|
|
@@ -5880,8 +5657,7 @@ var Neo4jAhchors = class {
|
|
|
5880
5657
|
*/
|
|
5881
5658
|
findAnchor(id) {
|
|
5882
5659
|
const anchor = this.#anchors[id];
|
|
5883
|
-
if (!anchor)
|
|
5884
|
-
return null;
|
|
5660
|
+
if (!anchor) return null;
|
|
5885
5661
|
return {
|
|
5886
5662
|
source: anchor.source || 0,
|
|
5887
5663
|
target: anchor.target || 0
|
|
@@ -5894,8 +5670,7 @@ var Neo4jAhchors = class {
|
|
|
5894
5670
|
getOffset(id) {
|
|
5895
5671
|
const { neo4j } = this;
|
|
5896
5672
|
const edge = neo4j.edges.get(id);
|
|
5897
|
-
if (!edge)
|
|
5898
|
-
return -1;
|
|
5673
|
+
if (!edge) return -1;
|
|
5899
5674
|
const { dirs, edgeField, sourceField, targetField } = neo4j;
|
|
5900
5675
|
const source = edge[sourceField];
|
|
5901
5676
|
const target = edge[targetField];
|
|
@@ -5916,8 +5691,7 @@ var Neo4jAhchors = class {
|
|
|
5916
5691
|
const directsSize = directs.length;
|
|
5917
5692
|
const invertsSize = inverts.length;
|
|
5918
5693
|
const total = directsSize + invertsSize;
|
|
5919
|
-
if (total === 1)
|
|
5920
|
-
return -1;
|
|
5694
|
+
if (total === 1) return -1;
|
|
5921
5695
|
if (directsSize === 0 || invertsSize === 0) {
|
|
5922
5696
|
return total / 2 - index - 0.5;
|
|
5923
5697
|
} else {
|
|
@@ -6000,8 +5774,7 @@ var Neo4j = class {
|
|
|
6000
5774
|
nodes.push(value);
|
|
6001
5775
|
} else if (type === "delete") {
|
|
6002
5776
|
const node = nodes.get(value);
|
|
6003
|
-
if (!node)
|
|
6004
|
-
return [];
|
|
5777
|
+
if (!node) return [];
|
|
6005
5778
|
nodes.delete(node);
|
|
6006
5779
|
const id = node[this.#nPrimaryKey];
|
|
6007
5780
|
const sourceKey = this.#sourceKey;
|
|
@@ -6043,8 +5816,7 @@ var Neo4j = class {
|
|
|
6043
5816
|
edge[sourceKey] === edge[targetKey] || dirs.push(edge);
|
|
6044
5817
|
} else if (type === "delete") {
|
|
6045
5818
|
const edge = edges.get(value);
|
|
6046
|
-
if (!edge)
|
|
6047
|
-
return false;
|
|
5819
|
+
if (!edge) return false;
|
|
6048
5820
|
edges.delete(edge);
|
|
6049
5821
|
sources.delete(edge);
|
|
6050
5822
|
targets.delete(edge);
|
|
@@ -6072,8 +5844,7 @@ var shield_keys = hash8strings([
|
|
|
6072
5844
|
var shield = (obj, key2, origin) => {
|
|
6073
5845
|
const proxy = new Proxy({}, {
|
|
6074
5846
|
get(target, p) {
|
|
6075
|
-
if (p in shield_keys)
|
|
6076
|
-
return;
|
|
5847
|
+
if (p in shield_keys) return;
|
|
6077
5848
|
const value = origin[p];
|
|
6078
5849
|
if (typeof value === "function") {
|
|
6079
5850
|
return function(...args) {
|
|
@@ -6103,17 +5874,13 @@ var once = (func, thisArg) => {
|
|
|
6103
5874
|
var pow = Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));
|
|
6104
5875
|
var re_num = /^([-+]?)0*(\d+)(?:(n)|(?:\.(\d+))?(?:[Ee]([-+]?)(\d+))?)$/;
|
|
6105
5876
|
var parseNum = (num) => {
|
|
6106
|
-
if (isNumber_default(num) || typeof num === "bigint")
|
|
6107
|
-
return num;
|
|
5877
|
+
if (isNumber_default(num) || typeof num === "bigint") return num;
|
|
6108
5878
|
const match = num.match(re_num);
|
|
6109
|
-
if (!match)
|
|
6110
|
-
return Number.NaN;
|
|
5879
|
+
if (!match) return Number.NaN;
|
|
6111
5880
|
const [, valueSymbol, integer, bigint, decimal, powSymbol, powValue] = match;
|
|
6112
|
-
if (bigint === "n")
|
|
6113
|
-
return BigInt(valueSymbol + integer);
|
|
5881
|
+
if (bigint === "n") return BigInt(valueSymbol + integer);
|
|
6114
5882
|
const powSize = integer.length - 1 + (powValue ? powSymbol === "-" ? -powValue : +powValue : 0);
|
|
6115
|
-
if (powSize < pow || powSize === pow && +integer.slice(0, -1) < Number.MAX_SAFE_INTEGER / 10)
|
|
6116
|
-
return +num;
|
|
5883
|
+
if (powSize < pow || powSize === pow && +integer.slice(0, -1) < Number.MAX_SAFE_INTEGER / 10) return +num;
|
|
6117
5884
|
try {
|
|
6118
5885
|
const bigValue = BigInt(integer.slice(0, powSize + 1).padEnd(powSize + 1, "0"));
|
|
6119
5886
|
let smallValue;
|
|
@@ -6159,8 +5926,7 @@ var cubeURLParams = (text, serializes) => {
|
|
|
6159
5926
|
const result = {};
|
|
6160
5927
|
for (const [key2, value] of params) {
|
|
6161
5928
|
const serialize = serializes[key2];
|
|
6162
|
-
if (!serialize)
|
|
6163
|
-
continue;
|
|
5929
|
+
if (!serialize) continue;
|
|
6164
5930
|
if (isString_default(serialize) && isKey(serialize, cubes)) {
|
|
6165
5931
|
result[key2] = cubes[serialize](value);
|
|
6166
5932
|
} else {
|
|
@@ -6176,8 +5942,7 @@ var flatURLParams = (data, serializes) => {
|
|
|
6176
5942
|
for (const key2 in data) {
|
|
6177
5943
|
const value = data[key2];
|
|
6178
5944
|
const serialize = serializes[key2];
|
|
6179
|
-
if (!serialize)
|
|
6180
|
-
continue;
|
|
5945
|
+
if (!serialize) continue;
|
|
6181
5946
|
params.append(
|
|
6182
5947
|
key2,
|
|
6183
5948
|
isString_default(serialize) && isKey(serialize, flats) ? flats[serialize](value) : serialize.flat(value)
|
|
@@ -6203,8 +5968,7 @@ var encrypt = (data) => {
|
|
|
6203
5968
|
let text = "";
|
|
6204
5969
|
for (const key2 in data) {
|
|
6205
5970
|
const value = data[key2];
|
|
6206
|
-
if (value === void 0)
|
|
6207
|
-
continue;
|
|
5971
|
+
if (value === void 0) continue;
|
|
6208
5972
|
text && (text += "&");
|
|
6209
5973
|
text += key2 + ":" + value;
|
|
6210
5974
|
}
|
|
@@ -6324,8 +6088,7 @@ var OfflineStorage = class _OfflineStorage {
|
|
|
6324
6088
|
*/
|
|
6325
6089
|
async push(data) {
|
|
6326
6090
|
this.validate((e) => {
|
|
6327
|
-
if (e)
|
|
6328
|
-
throw e;
|
|
6091
|
+
if (e) throw e;
|
|
6329
6092
|
}, MESSAGES.push);
|
|
6330
6093
|
const size = this.#size;
|
|
6331
6094
|
const key2 = structKey(size);
|
|
@@ -6337,14 +6100,12 @@ var OfflineStorage = class _OfflineStorage {
|
|
|
6337
6100
|
*/
|
|
6338
6101
|
async update(index, data) {
|
|
6339
6102
|
this.validate((e) => {
|
|
6340
|
-
if (e)
|
|
6341
|
-
throw e;
|
|
6103
|
+
if (e) throw e;
|
|
6342
6104
|
}, MESSAGES.update);
|
|
6343
6105
|
const forage = this.#forage;
|
|
6344
6106
|
const key2 = structKey(index);
|
|
6345
6107
|
const value = await forage.getItem(key2);
|
|
6346
|
-
if (value === null)
|
|
6347
|
-
return false;
|
|
6108
|
+
if (value === null) return false;
|
|
6348
6109
|
await forage.setItem(key2, await this.#crypto.encrypt(data));
|
|
6349
6110
|
return true;
|
|
6350
6111
|
}
|
|
@@ -6353,8 +6114,7 @@ var OfflineStorage = class _OfflineStorage {
|
|
|
6353
6114
|
*/
|
|
6354
6115
|
async get(index) {
|
|
6355
6116
|
this.validate((e) => {
|
|
6356
|
-
if (e)
|
|
6357
|
-
throw e;
|
|
6117
|
+
if (e) throw e;
|
|
6358
6118
|
}, MESSAGES.get);
|
|
6359
6119
|
const key2 = structKey(index);
|
|
6360
6120
|
const value = await this.#forage.getItem(key2);
|
|
@@ -6365,8 +6125,7 @@ var OfflineStorage = class _OfflineStorage {
|
|
|
6365
6125
|
*/
|
|
6366
6126
|
async clear() {
|
|
6367
6127
|
this.validate((e) => {
|
|
6368
|
-
if (e)
|
|
6369
|
-
throw e;
|
|
6128
|
+
if (e) throw e;
|
|
6370
6129
|
});
|
|
6371
6130
|
this.#size = 0;
|
|
6372
6131
|
await import_localforage.default.dropInstance({
|
|
@@ -6392,20 +6151,17 @@ var OfflineStorage = class _OfflineStorage {
|
|
|
6392
6151
|
const databases = await indexedDB.databases();
|
|
6393
6152
|
const tasks = [];
|
|
6394
6153
|
for (const { name, version } of databases) {
|
|
6395
|
-
if (name === void 0)
|
|
6396
|
-
continue;
|
|
6154
|
+
if (name === void 0) continue;
|
|
6397
6155
|
let text;
|
|
6398
6156
|
try {
|
|
6399
6157
|
text = import_sm_crypto.sm4.decrypt(name, key, config);
|
|
6400
6158
|
} catch {
|
|
6401
6159
|
continue;
|
|
6402
6160
|
}
|
|
6403
|
-
if (text.slice(0, size) !== PREFIX)
|
|
6404
|
-
continue;
|
|
6161
|
+
if (text.slice(0, size) !== PREFIX) continue;
|
|
6405
6162
|
const forage = createInstance(name, version);
|
|
6406
6163
|
const value = await forage.getItem(HEADER);
|
|
6407
|
-
if (value === null || decrypt(value).token !== token || callback && callback(text.slice(size)))
|
|
6408
|
-
continue;
|
|
6164
|
+
if (value === null || decrypt(value).token !== token || callback && callback(text.slice(size))) continue;
|
|
6409
6165
|
const idb = indexedDB.deleteDatabase(text);
|
|
6410
6166
|
tasks.push(new Promise((resolve) => {
|
|
6411
6167
|
idb.onerror = () => resolve();
|
|
@@ -6422,8 +6178,7 @@ var css = (...args) => {
|
|
|
6422
6178
|
const list = [];
|
|
6423
6179
|
for (let i = 0; i < args.length; i++) {
|
|
6424
6180
|
const data = args[i];
|
|
6425
|
-
if (!data)
|
|
6426
|
-
continue;
|
|
6181
|
+
if (!data) continue;
|
|
6427
6182
|
if (isString_default(data)) {
|
|
6428
6183
|
list.push(data);
|
|
6429
6184
|
} else if (Array.isArray(data)) {
|
|
@@ -6465,8 +6220,7 @@ var Subscriber = class {
|
|
|
6465
6220
|
}
|
|
6466
6221
|
$emit(name, ...args) {
|
|
6467
6222
|
const listeners = this.#listeners[name];
|
|
6468
|
-
if (!listeners)
|
|
6469
|
-
return this;
|
|
6223
|
+
if (!listeners) return this;
|
|
6470
6224
|
const once2 = hash8strings(this.#once[name] || []);
|
|
6471
6225
|
this.#listeners[name] = listeners.reduce((list, listener, index) => {
|
|
6472
6226
|
listener(...args);
|
|
@@ -6479,8 +6233,7 @@ var Subscriber = class {
|
|
|
6479
6233
|
$off(name, listener) {
|
|
6480
6234
|
const listeners = this.#listeners;
|
|
6481
6235
|
const once2 = this.#once;
|
|
6482
|
-
if (name in listeners === false)
|
|
6483
|
-
return this;
|
|
6236
|
+
if (name in listeners === false) return this;
|
|
6484
6237
|
if (listener) {
|
|
6485
6238
|
let count;
|
|
6486
6239
|
listeners[name].some((value, index) => {
|
|
@@ -6555,8 +6308,7 @@ var FlexTable = class {
|
|
|
6555
6308
|
pop() {
|
|
6556
6309
|
const data = this.#data;
|
|
6557
6310
|
const rowspan = data.length;
|
|
6558
|
-
if (!rowspan)
|
|
6559
|
-
return null;
|
|
6311
|
+
if (!rowspan) return null;
|
|
6560
6312
|
const list = data[rowspan - 1];
|
|
6561
6313
|
if (list.length) {
|
|
6562
6314
|
return list.pop();
|
|
@@ -6570,28 +6322,24 @@ var FlexTable = class {
|
|
|
6570
6322
|
*/
|
|
6571
6323
|
each(callback) {
|
|
6572
6324
|
const data = this.#data;
|
|
6573
|
-
outloop:
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
if (callback(list[j], i, j) === false)
|
|
6578
|
-
break outloop;
|
|
6579
|
-
}
|
|
6325
|
+
outloop: for (let i = 0; i < data.length; i++) {
|
|
6326
|
+
const list = data[i];
|
|
6327
|
+
for (let j = 0; j < list.length; j++) {
|
|
6328
|
+
if (callback(list[j], i, j) === false) break outloop;
|
|
6580
6329
|
}
|
|
6330
|
+
}
|
|
6581
6331
|
}
|
|
6582
6332
|
/**
|
|
6583
6333
|
* 反序遍历数据
|
|
6584
6334
|
*/
|
|
6585
6335
|
reverseEach(callback) {
|
|
6586
6336
|
const data = this.#data;
|
|
6587
|
-
outloop:
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
if (callback(list[--j], i, j) === false)
|
|
6592
|
-
break outloop;
|
|
6593
|
-
}
|
|
6337
|
+
outloop: for (let i = data.length; i; ) {
|
|
6338
|
+
const list = data[--i];
|
|
6339
|
+
for (let j = list.length; j; ) {
|
|
6340
|
+
if (callback(list[--j], i, j) === false) break outloop;
|
|
6594
6341
|
}
|
|
6342
|
+
}
|
|
6595
6343
|
}
|
|
6596
6344
|
/**
|
|
6597
6345
|
* 清空数据
|
|
@@ -6653,8 +6401,7 @@ var Union = class {
|
|
|
6653
6401
|
var re = /([^:])\/{2,}/g;
|
|
6654
6402
|
var joinPaths = (...list) => {
|
|
6655
6403
|
const { length } = list;
|
|
6656
|
-
if (length === 0)
|
|
6657
|
-
return "";
|
|
6404
|
+
if (length === 0) return "";
|
|
6658
6405
|
return length === 1 ? list[0] : list.join("/").replace(re, ($0, $1) => `${$1}/`);
|
|
6659
6406
|
};
|
|
6660
6407
|
|