@latticexyz/cli 1.34.0 → 1.36.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/dist/commands/bulkupload.js +4 -24
- package/dist/commands/call-system.js +2274 -1843
- package/dist/commands/codegen-libdeploy.js +18 -39
- package/dist/commands/create.js +13 -35
- package/dist/commands/deploy-contracts.js +1240 -799
- package/dist/commands/deploy.js +769 -471
- package/dist/commands/devnode.js +12 -34
- package/dist/commands/diamond-abi.js +5 -25
- package/dist/commands/faucet.js +1063 -907
- package/dist/commands/gas-report.js +8065 -0
- package/dist/commands/sync-art.js +22 -44
- package/dist/commands/system-types.js +2275 -1844
- package/dist/commands/test.js +2222 -1795
- package/dist/commands/trace.js +2365 -1929
- package/dist/commands/types.js +2343 -1919
- package/package.json +10 -7
- package/src/commands/call-system.ts +5 -1
- package/src/commands/deploy-contracts.ts +37 -14
- package/src/commands/deploy.ts +1 -0
- package/src/commands/faucet.ts +2 -1
- package/src/commands/gas-report.ts +219 -0
- package/src/commands/system-types.ts +4 -10
- package/src/commands/test.ts +3 -3
- package/src/commands/trace.ts +9 -4
- package/src/contracts/BulkUpload.sol +7 -9
- package/src/contracts/Deploy.sol +4 -8
- package/src/contracts/LibDeploy.ejs +18 -1
- package/src/utils/build.ts +13 -5
- package/src/utils/codegen.ts +3 -0
- package/src/utils/constants.ts +2 -0
- package/src/utils/deploy.ts +2 -5
- package/src/utils/forgeConfig.ts +45 -0
- package/src/utils/types.ts +8 -5
- package/LICENSE +0 -21
- package/src/contracts/Cheats.sol +0 -320
package/dist/commands/faucet.js
CHANGED
|
@@ -25,874 +25,6 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
|
|
|
25
25
|
mod2
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// ../../node_modules/long/src/long.js
|
|
50
|
-
var require_long = __commonJS({
|
|
51
|
-
"../../node_modules/long/src/long.js"(exports2, module2) {
|
|
52
|
-
module2.exports = Long2;
|
|
53
|
-
var wasm = null;
|
|
54
|
-
try {
|
|
55
|
-
wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
|
|
56
|
-
0,
|
|
57
|
-
97,
|
|
58
|
-
115,
|
|
59
|
-
109,
|
|
60
|
-
1,
|
|
61
|
-
0,
|
|
62
|
-
0,
|
|
63
|
-
0,
|
|
64
|
-
1,
|
|
65
|
-
13,
|
|
66
|
-
2,
|
|
67
|
-
96,
|
|
68
|
-
0,
|
|
69
|
-
1,
|
|
70
|
-
127,
|
|
71
|
-
96,
|
|
72
|
-
4,
|
|
73
|
-
127,
|
|
74
|
-
127,
|
|
75
|
-
127,
|
|
76
|
-
127,
|
|
77
|
-
1,
|
|
78
|
-
127,
|
|
79
|
-
3,
|
|
80
|
-
7,
|
|
81
|
-
6,
|
|
82
|
-
0,
|
|
83
|
-
1,
|
|
84
|
-
1,
|
|
85
|
-
1,
|
|
86
|
-
1,
|
|
87
|
-
1,
|
|
88
|
-
6,
|
|
89
|
-
6,
|
|
90
|
-
1,
|
|
91
|
-
127,
|
|
92
|
-
1,
|
|
93
|
-
65,
|
|
94
|
-
0,
|
|
95
|
-
11,
|
|
96
|
-
7,
|
|
97
|
-
50,
|
|
98
|
-
6,
|
|
99
|
-
3,
|
|
100
|
-
109,
|
|
101
|
-
117,
|
|
102
|
-
108,
|
|
103
|
-
0,
|
|
104
|
-
1,
|
|
105
|
-
5,
|
|
106
|
-
100,
|
|
107
|
-
105,
|
|
108
|
-
118,
|
|
109
|
-
95,
|
|
110
|
-
115,
|
|
111
|
-
0,
|
|
112
|
-
2,
|
|
113
|
-
5,
|
|
114
|
-
100,
|
|
115
|
-
105,
|
|
116
|
-
118,
|
|
117
|
-
95,
|
|
118
|
-
117,
|
|
119
|
-
0,
|
|
120
|
-
3,
|
|
121
|
-
5,
|
|
122
|
-
114,
|
|
123
|
-
101,
|
|
124
|
-
109,
|
|
125
|
-
95,
|
|
126
|
-
115,
|
|
127
|
-
0,
|
|
128
|
-
4,
|
|
129
|
-
5,
|
|
130
|
-
114,
|
|
131
|
-
101,
|
|
132
|
-
109,
|
|
133
|
-
95,
|
|
134
|
-
117,
|
|
135
|
-
0,
|
|
136
|
-
5,
|
|
137
|
-
8,
|
|
138
|
-
103,
|
|
139
|
-
101,
|
|
140
|
-
116,
|
|
141
|
-
95,
|
|
142
|
-
104,
|
|
143
|
-
105,
|
|
144
|
-
103,
|
|
145
|
-
104,
|
|
146
|
-
0,
|
|
147
|
-
0,
|
|
148
|
-
10,
|
|
149
|
-
191,
|
|
150
|
-
1,
|
|
151
|
-
6,
|
|
152
|
-
4,
|
|
153
|
-
0,
|
|
154
|
-
35,
|
|
155
|
-
0,
|
|
156
|
-
11,
|
|
157
|
-
36,
|
|
158
|
-
1,
|
|
159
|
-
1,
|
|
160
|
-
126,
|
|
161
|
-
32,
|
|
162
|
-
0,
|
|
163
|
-
173,
|
|
164
|
-
32,
|
|
165
|
-
1,
|
|
166
|
-
173,
|
|
167
|
-
66,
|
|
168
|
-
32,
|
|
169
|
-
134,
|
|
170
|
-
132,
|
|
171
|
-
32,
|
|
172
|
-
2,
|
|
173
|
-
173,
|
|
174
|
-
32,
|
|
175
|
-
3,
|
|
176
|
-
173,
|
|
177
|
-
66,
|
|
178
|
-
32,
|
|
179
|
-
134,
|
|
180
|
-
132,
|
|
181
|
-
126,
|
|
182
|
-
34,
|
|
183
|
-
4,
|
|
184
|
-
66,
|
|
185
|
-
32,
|
|
186
|
-
135,
|
|
187
|
-
167,
|
|
188
|
-
36,
|
|
189
|
-
0,
|
|
190
|
-
32,
|
|
191
|
-
4,
|
|
192
|
-
167,
|
|
193
|
-
11,
|
|
194
|
-
36,
|
|
195
|
-
1,
|
|
196
|
-
1,
|
|
197
|
-
126,
|
|
198
|
-
32,
|
|
199
|
-
0,
|
|
200
|
-
173,
|
|
201
|
-
32,
|
|
202
|
-
1,
|
|
203
|
-
173,
|
|
204
|
-
66,
|
|
205
|
-
32,
|
|
206
|
-
134,
|
|
207
|
-
132,
|
|
208
|
-
32,
|
|
209
|
-
2,
|
|
210
|
-
173,
|
|
211
|
-
32,
|
|
212
|
-
3,
|
|
213
|
-
173,
|
|
214
|
-
66,
|
|
215
|
-
32,
|
|
216
|
-
134,
|
|
217
|
-
132,
|
|
218
|
-
127,
|
|
219
|
-
34,
|
|
220
|
-
4,
|
|
221
|
-
66,
|
|
222
|
-
32,
|
|
223
|
-
135,
|
|
224
|
-
167,
|
|
225
|
-
36,
|
|
226
|
-
0,
|
|
227
|
-
32,
|
|
228
|
-
4,
|
|
229
|
-
167,
|
|
230
|
-
11,
|
|
231
|
-
36,
|
|
232
|
-
1,
|
|
233
|
-
1,
|
|
234
|
-
126,
|
|
235
|
-
32,
|
|
236
|
-
0,
|
|
237
|
-
173,
|
|
238
|
-
32,
|
|
239
|
-
1,
|
|
240
|
-
173,
|
|
241
|
-
66,
|
|
242
|
-
32,
|
|
243
|
-
134,
|
|
244
|
-
132,
|
|
245
|
-
32,
|
|
246
|
-
2,
|
|
247
|
-
173,
|
|
248
|
-
32,
|
|
249
|
-
3,
|
|
250
|
-
173,
|
|
251
|
-
66,
|
|
252
|
-
32,
|
|
253
|
-
134,
|
|
254
|
-
132,
|
|
255
|
-
128,
|
|
256
|
-
34,
|
|
257
|
-
4,
|
|
258
|
-
66,
|
|
259
|
-
32,
|
|
260
|
-
135,
|
|
261
|
-
167,
|
|
262
|
-
36,
|
|
263
|
-
0,
|
|
264
|
-
32,
|
|
265
|
-
4,
|
|
266
|
-
167,
|
|
267
|
-
11,
|
|
268
|
-
36,
|
|
269
|
-
1,
|
|
270
|
-
1,
|
|
271
|
-
126,
|
|
272
|
-
32,
|
|
273
|
-
0,
|
|
274
|
-
173,
|
|
275
|
-
32,
|
|
276
|
-
1,
|
|
277
|
-
173,
|
|
278
|
-
66,
|
|
279
|
-
32,
|
|
280
|
-
134,
|
|
281
|
-
132,
|
|
282
|
-
32,
|
|
283
|
-
2,
|
|
284
|
-
173,
|
|
285
|
-
32,
|
|
286
|
-
3,
|
|
287
|
-
173,
|
|
288
|
-
66,
|
|
289
|
-
32,
|
|
290
|
-
134,
|
|
291
|
-
132,
|
|
292
|
-
129,
|
|
293
|
-
34,
|
|
294
|
-
4,
|
|
295
|
-
66,
|
|
296
|
-
32,
|
|
297
|
-
135,
|
|
298
|
-
167,
|
|
299
|
-
36,
|
|
300
|
-
0,
|
|
301
|
-
32,
|
|
302
|
-
4,
|
|
303
|
-
167,
|
|
304
|
-
11,
|
|
305
|
-
36,
|
|
306
|
-
1,
|
|
307
|
-
1,
|
|
308
|
-
126,
|
|
309
|
-
32,
|
|
310
|
-
0,
|
|
311
|
-
173,
|
|
312
|
-
32,
|
|
313
|
-
1,
|
|
314
|
-
173,
|
|
315
|
-
66,
|
|
316
|
-
32,
|
|
317
|
-
134,
|
|
318
|
-
132,
|
|
319
|
-
32,
|
|
320
|
-
2,
|
|
321
|
-
173,
|
|
322
|
-
32,
|
|
323
|
-
3,
|
|
324
|
-
173,
|
|
325
|
-
66,
|
|
326
|
-
32,
|
|
327
|
-
134,
|
|
328
|
-
132,
|
|
329
|
-
130,
|
|
330
|
-
34,
|
|
331
|
-
4,
|
|
332
|
-
66,
|
|
333
|
-
32,
|
|
334
|
-
135,
|
|
335
|
-
167,
|
|
336
|
-
36,
|
|
337
|
-
0,
|
|
338
|
-
32,
|
|
339
|
-
4,
|
|
340
|
-
167,
|
|
341
|
-
11
|
|
342
|
-
])), {}).exports;
|
|
343
|
-
} catch (e) {
|
|
344
|
-
}
|
|
345
|
-
function Long2(low, high, unsigned) {
|
|
346
|
-
this.low = low | 0;
|
|
347
|
-
this.high = high | 0;
|
|
348
|
-
this.unsigned = !!unsigned;
|
|
349
|
-
}
|
|
350
|
-
Long2.prototype.__isLong__;
|
|
351
|
-
Object.defineProperty(Long2.prototype, "__isLong__", { value: true });
|
|
352
|
-
function isLong(obj) {
|
|
353
|
-
return (obj && obj["__isLong__"]) === true;
|
|
354
|
-
}
|
|
355
|
-
Long2.isLong = isLong;
|
|
356
|
-
var INT_CACHE = {};
|
|
357
|
-
var UINT_CACHE = {};
|
|
358
|
-
function fromInt(value, unsigned) {
|
|
359
|
-
var obj, cachedObj, cache;
|
|
360
|
-
if (unsigned) {
|
|
361
|
-
value >>>= 0;
|
|
362
|
-
if (cache = 0 <= value && value < 256) {
|
|
363
|
-
cachedObj = UINT_CACHE[value];
|
|
364
|
-
if (cachedObj)
|
|
365
|
-
return cachedObj;
|
|
366
|
-
}
|
|
367
|
-
obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
|
|
368
|
-
if (cache)
|
|
369
|
-
UINT_CACHE[value] = obj;
|
|
370
|
-
return obj;
|
|
371
|
-
} else {
|
|
372
|
-
value |= 0;
|
|
373
|
-
if (cache = -128 <= value && value < 128) {
|
|
374
|
-
cachedObj = INT_CACHE[value];
|
|
375
|
-
if (cachedObj)
|
|
376
|
-
return cachedObj;
|
|
377
|
-
}
|
|
378
|
-
obj = fromBits(value, value < 0 ? -1 : 0, false);
|
|
379
|
-
if (cache)
|
|
380
|
-
INT_CACHE[value] = obj;
|
|
381
|
-
return obj;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
Long2.fromInt = fromInt;
|
|
385
|
-
function fromNumber(value, unsigned) {
|
|
386
|
-
if (isNaN(value))
|
|
387
|
-
return unsigned ? UZERO : ZERO;
|
|
388
|
-
if (unsigned) {
|
|
389
|
-
if (value < 0)
|
|
390
|
-
return UZERO;
|
|
391
|
-
if (value >= TWO_PWR_64_DBL)
|
|
392
|
-
return MAX_UNSIGNED_VALUE;
|
|
393
|
-
} else {
|
|
394
|
-
if (value <= -TWO_PWR_63_DBL)
|
|
395
|
-
return MIN_VALUE;
|
|
396
|
-
if (value + 1 >= TWO_PWR_63_DBL)
|
|
397
|
-
return MAX_VALUE;
|
|
398
|
-
}
|
|
399
|
-
if (value < 0)
|
|
400
|
-
return fromNumber(-value, unsigned).neg();
|
|
401
|
-
return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
|
|
402
|
-
}
|
|
403
|
-
Long2.fromNumber = fromNumber;
|
|
404
|
-
function fromBits(lowBits, highBits, unsigned) {
|
|
405
|
-
return new Long2(lowBits, highBits, unsigned);
|
|
406
|
-
}
|
|
407
|
-
Long2.fromBits = fromBits;
|
|
408
|
-
var pow_dbl = Math.pow;
|
|
409
|
-
function fromString(str, unsigned, radix) {
|
|
410
|
-
if (str.length === 0)
|
|
411
|
-
throw Error("empty string");
|
|
412
|
-
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
|
413
|
-
return ZERO;
|
|
414
|
-
if (typeof unsigned === "number") {
|
|
415
|
-
radix = unsigned, unsigned = false;
|
|
416
|
-
} else {
|
|
417
|
-
unsigned = !!unsigned;
|
|
418
|
-
}
|
|
419
|
-
radix = radix || 10;
|
|
420
|
-
if (radix < 2 || 36 < radix)
|
|
421
|
-
throw RangeError("radix");
|
|
422
|
-
var p;
|
|
423
|
-
if ((p = str.indexOf("-")) > 0)
|
|
424
|
-
throw Error("interior hyphen");
|
|
425
|
-
else if (p === 0) {
|
|
426
|
-
return fromString(str.substring(1), unsigned, radix).neg();
|
|
427
|
-
}
|
|
428
|
-
var radixToPower = fromNumber(pow_dbl(radix, 8));
|
|
429
|
-
var result = ZERO;
|
|
430
|
-
for (var i = 0; i < str.length; i += 8) {
|
|
431
|
-
var size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
|
|
432
|
-
if (size < 8) {
|
|
433
|
-
var power = fromNumber(pow_dbl(radix, size));
|
|
434
|
-
result = result.mul(power).add(fromNumber(value));
|
|
435
|
-
} else {
|
|
436
|
-
result = result.mul(radixToPower);
|
|
437
|
-
result = result.add(fromNumber(value));
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
result.unsigned = unsigned;
|
|
441
|
-
return result;
|
|
442
|
-
}
|
|
443
|
-
Long2.fromString = fromString;
|
|
444
|
-
function fromValue(val, unsigned) {
|
|
445
|
-
if (typeof val === "number")
|
|
446
|
-
return fromNumber(val, unsigned);
|
|
447
|
-
if (typeof val === "string")
|
|
448
|
-
return fromString(val, unsigned);
|
|
449
|
-
return fromBits(val.low, val.high, typeof unsigned === "boolean" ? unsigned : val.unsigned);
|
|
450
|
-
}
|
|
451
|
-
Long2.fromValue = fromValue;
|
|
452
|
-
var TWO_PWR_16_DBL = 1 << 16;
|
|
453
|
-
var TWO_PWR_24_DBL = 1 << 24;
|
|
454
|
-
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
|
|
455
|
-
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
|
|
456
|
-
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
|
|
457
|
-
var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
|
|
458
|
-
var ZERO = fromInt(0);
|
|
459
|
-
Long2.ZERO = ZERO;
|
|
460
|
-
var UZERO = fromInt(0, true);
|
|
461
|
-
Long2.UZERO = UZERO;
|
|
462
|
-
var ONE = fromInt(1);
|
|
463
|
-
Long2.ONE = ONE;
|
|
464
|
-
var UONE = fromInt(1, true);
|
|
465
|
-
Long2.UONE = UONE;
|
|
466
|
-
var NEG_ONE = fromInt(-1);
|
|
467
|
-
Long2.NEG_ONE = NEG_ONE;
|
|
468
|
-
var MAX_VALUE = fromBits(4294967295 | 0, 2147483647 | 0, false);
|
|
469
|
-
Long2.MAX_VALUE = MAX_VALUE;
|
|
470
|
-
var MAX_UNSIGNED_VALUE = fromBits(4294967295 | 0, 4294967295 | 0, true);
|
|
471
|
-
Long2.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
|
|
472
|
-
var MIN_VALUE = fromBits(0, 2147483648 | 0, false);
|
|
473
|
-
Long2.MIN_VALUE = MIN_VALUE;
|
|
474
|
-
var LongPrototype = Long2.prototype;
|
|
475
|
-
LongPrototype.toInt = function toInt() {
|
|
476
|
-
return this.unsigned ? this.low >>> 0 : this.low;
|
|
477
|
-
};
|
|
478
|
-
LongPrototype.toNumber = function toNumber() {
|
|
479
|
-
if (this.unsigned)
|
|
480
|
-
return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
481
|
-
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
482
|
-
};
|
|
483
|
-
LongPrototype.toString = function toString(radix) {
|
|
484
|
-
radix = radix || 10;
|
|
485
|
-
if (radix < 2 || 36 < radix)
|
|
486
|
-
throw RangeError("radix");
|
|
487
|
-
if (this.isZero())
|
|
488
|
-
return "0";
|
|
489
|
-
if (this.isNegative()) {
|
|
490
|
-
if (this.eq(MIN_VALUE)) {
|
|
491
|
-
var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
|
|
492
|
-
return div.toString(radix) + rem1.toInt().toString(radix);
|
|
493
|
-
} else
|
|
494
|
-
return "-" + this.neg().toString(radix);
|
|
495
|
-
}
|
|
496
|
-
var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this;
|
|
497
|
-
var result = "";
|
|
498
|
-
while (true) {
|
|
499
|
-
var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix);
|
|
500
|
-
rem = remDiv;
|
|
501
|
-
if (rem.isZero())
|
|
502
|
-
return digits + result;
|
|
503
|
-
else {
|
|
504
|
-
while (digits.length < 6)
|
|
505
|
-
digits = "0" + digits;
|
|
506
|
-
result = "" + digits + result;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
LongPrototype.getHighBits = function getHighBits() {
|
|
511
|
-
return this.high;
|
|
512
|
-
};
|
|
513
|
-
LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
|
|
514
|
-
return this.high >>> 0;
|
|
515
|
-
};
|
|
516
|
-
LongPrototype.getLowBits = function getLowBits() {
|
|
517
|
-
return this.low;
|
|
518
|
-
};
|
|
519
|
-
LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
|
|
520
|
-
return this.low >>> 0;
|
|
521
|
-
};
|
|
522
|
-
LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
|
|
523
|
-
if (this.isNegative())
|
|
524
|
-
return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
|
|
525
|
-
var val = this.high != 0 ? this.high : this.low;
|
|
526
|
-
for (var bit = 31; bit > 0; bit--)
|
|
527
|
-
if ((val & 1 << bit) != 0)
|
|
528
|
-
break;
|
|
529
|
-
return this.high != 0 ? bit + 33 : bit + 1;
|
|
530
|
-
};
|
|
531
|
-
LongPrototype.isZero = function isZero() {
|
|
532
|
-
return this.high === 0 && this.low === 0;
|
|
533
|
-
};
|
|
534
|
-
LongPrototype.eqz = LongPrototype.isZero;
|
|
535
|
-
LongPrototype.isNegative = function isNegative() {
|
|
536
|
-
return !this.unsigned && this.high < 0;
|
|
537
|
-
};
|
|
538
|
-
LongPrototype.isPositive = function isPositive() {
|
|
539
|
-
return this.unsigned || this.high >= 0;
|
|
540
|
-
};
|
|
541
|
-
LongPrototype.isOdd = function isOdd() {
|
|
542
|
-
return (this.low & 1) === 1;
|
|
543
|
-
};
|
|
544
|
-
LongPrototype.isEven = function isEven() {
|
|
545
|
-
return (this.low & 1) === 0;
|
|
546
|
-
};
|
|
547
|
-
LongPrototype.equals = function equals(other) {
|
|
548
|
-
if (!isLong(other))
|
|
549
|
-
other = fromValue(other);
|
|
550
|
-
if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
|
|
551
|
-
return false;
|
|
552
|
-
return this.high === other.high && this.low === other.low;
|
|
553
|
-
};
|
|
554
|
-
LongPrototype.eq = LongPrototype.equals;
|
|
555
|
-
LongPrototype.notEquals = function notEquals(other) {
|
|
556
|
-
return !this.eq(other);
|
|
557
|
-
};
|
|
558
|
-
LongPrototype.neq = LongPrototype.notEquals;
|
|
559
|
-
LongPrototype.ne = LongPrototype.notEquals;
|
|
560
|
-
LongPrototype.lessThan = function lessThan(other) {
|
|
561
|
-
return this.comp(other) < 0;
|
|
562
|
-
};
|
|
563
|
-
LongPrototype.lt = LongPrototype.lessThan;
|
|
564
|
-
LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
|
|
565
|
-
return this.comp(other) <= 0;
|
|
566
|
-
};
|
|
567
|
-
LongPrototype.lte = LongPrototype.lessThanOrEqual;
|
|
568
|
-
LongPrototype.le = LongPrototype.lessThanOrEqual;
|
|
569
|
-
LongPrototype.greaterThan = function greaterThan(other) {
|
|
570
|
-
return this.comp(other) > 0;
|
|
571
|
-
};
|
|
572
|
-
LongPrototype.gt = LongPrototype.greaterThan;
|
|
573
|
-
LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
|
|
574
|
-
return this.comp(other) >= 0;
|
|
575
|
-
};
|
|
576
|
-
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
|
|
577
|
-
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
|
|
578
|
-
LongPrototype.compare = function compare(other) {
|
|
579
|
-
if (!isLong(other))
|
|
580
|
-
other = fromValue(other);
|
|
581
|
-
if (this.eq(other))
|
|
582
|
-
return 0;
|
|
583
|
-
var thisNeg = this.isNegative(), otherNeg = other.isNegative();
|
|
584
|
-
if (thisNeg && !otherNeg)
|
|
585
|
-
return -1;
|
|
586
|
-
if (!thisNeg && otherNeg)
|
|
587
|
-
return 1;
|
|
588
|
-
if (!this.unsigned)
|
|
589
|
-
return this.sub(other).isNegative() ? -1 : 1;
|
|
590
|
-
return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
|
|
591
|
-
};
|
|
592
|
-
LongPrototype.comp = LongPrototype.compare;
|
|
593
|
-
LongPrototype.negate = function negate() {
|
|
594
|
-
if (!this.unsigned && this.eq(MIN_VALUE))
|
|
595
|
-
return MIN_VALUE;
|
|
596
|
-
return this.not().add(ONE);
|
|
597
|
-
};
|
|
598
|
-
LongPrototype.neg = LongPrototype.negate;
|
|
599
|
-
LongPrototype.add = function add(addend) {
|
|
600
|
-
if (!isLong(addend))
|
|
601
|
-
addend = fromValue(addend);
|
|
602
|
-
var a48 = this.high >>> 16;
|
|
603
|
-
var a32 = this.high & 65535;
|
|
604
|
-
var a16 = this.low >>> 16;
|
|
605
|
-
var a00 = this.low & 65535;
|
|
606
|
-
var b48 = addend.high >>> 16;
|
|
607
|
-
var b32 = addend.high & 65535;
|
|
608
|
-
var b16 = addend.low >>> 16;
|
|
609
|
-
var b00 = addend.low & 65535;
|
|
610
|
-
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
611
|
-
c00 += a00 + b00;
|
|
612
|
-
c16 += c00 >>> 16;
|
|
613
|
-
c00 &= 65535;
|
|
614
|
-
c16 += a16 + b16;
|
|
615
|
-
c32 += c16 >>> 16;
|
|
616
|
-
c16 &= 65535;
|
|
617
|
-
c32 += a32 + b32;
|
|
618
|
-
c48 += c32 >>> 16;
|
|
619
|
-
c32 &= 65535;
|
|
620
|
-
c48 += a48 + b48;
|
|
621
|
-
c48 &= 65535;
|
|
622
|
-
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
623
|
-
};
|
|
624
|
-
LongPrototype.subtract = function subtract(subtrahend) {
|
|
625
|
-
if (!isLong(subtrahend))
|
|
626
|
-
subtrahend = fromValue(subtrahend);
|
|
627
|
-
return this.add(subtrahend.neg());
|
|
628
|
-
};
|
|
629
|
-
LongPrototype.sub = LongPrototype.subtract;
|
|
630
|
-
LongPrototype.multiply = function multiply(multiplier) {
|
|
631
|
-
if (this.isZero())
|
|
632
|
-
return ZERO;
|
|
633
|
-
if (!isLong(multiplier))
|
|
634
|
-
multiplier = fromValue(multiplier);
|
|
635
|
-
if (wasm) {
|
|
636
|
-
var low = wasm.mul(
|
|
637
|
-
this.low,
|
|
638
|
-
this.high,
|
|
639
|
-
multiplier.low,
|
|
640
|
-
multiplier.high
|
|
641
|
-
);
|
|
642
|
-
return fromBits(low, wasm.get_high(), this.unsigned);
|
|
643
|
-
}
|
|
644
|
-
if (multiplier.isZero())
|
|
645
|
-
return ZERO;
|
|
646
|
-
if (this.eq(MIN_VALUE))
|
|
647
|
-
return multiplier.isOdd() ? MIN_VALUE : ZERO;
|
|
648
|
-
if (multiplier.eq(MIN_VALUE))
|
|
649
|
-
return this.isOdd() ? MIN_VALUE : ZERO;
|
|
650
|
-
if (this.isNegative()) {
|
|
651
|
-
if (multiplier.isNegative())
|
|
652
|
-
return this.neg().mul(multiplier.neg());
|
|
653
|
-
else
|
|
654
|
-
return this.neg().mul(multiplier).neg();
|
|
655
|
-
} else if (multiplier.isNegative())
|
|
656
|
-
return this.mul(multiplier.neg()).neg();
|
|
657
|
-
if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
|
|
658
|
-
return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
|
659
|
-
var a48 = this.high >>> 16;
|
|
660
|
-
var a32 = this.high & 65535;
|
|
661
|
-
var a16 = this.low >>> 16;
|
|
662
|
-
var a00 = this.low & 65535;
|
|
663
|
-
var b48 = multiplier.high >>> 16;
|
|
664
|
-
var b32 = multiplier.high & 65535;
|
|
665
|
-
var b16 = multiplier.low >>> 16;
|
|
666
|
-
var b00 = multiplier.low & 65535;
|
|
667
|
-
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
668
|
-
c00 += a00 * b00;
|
|
669
|
-
c16 += c00 >>> 16;
|
|
670
|
-
c00 &= 65535;
|
|
671
|
-
c16 += a16 * b00;
|
|
672
|
-
c32 += c16 >>> 16;
|
|
673
|
-
c16 &= 65535;
|
|
674
|
-
c16 += a00 * b16;
|
|
675
|
-
c32 += c16 >>> 16;
|
|
676
|
-
c16 &= 65535;
|
|
677
|
-
c32 += a32 * b00;
|
|
678
|
-
c48 += c32 >>> 16;
|
|
679
|
-
c32 &= 65535;
|
|
680
|
-
c32 += a16 * b16;
|
|
681
|
-
c48 += c32 >>> 16;
|
|
682
|
-
c32 &= 65535;
|
|
683
|
-
c32 += a00 * b32;
|
|
684
|
-
c48 += c32 >>> 16;
|
|
685
|
-
c32 &= 65535;
|
|
686
|
-
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
|
687
|
-
c48 &= 65535;
|
|
688
|
-
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
689
|
-
};
|
|
690
|
-
LongPrototype.mul = LongPrototype.multiply;
|
|
691
|
-
LongPrototype.divide = function divide(divisor) {
|
|
692
|
-
if (!isLong(divisor))
|
|
693
|
-
divisor = fromValue(divisor);
|
|
694
|
-
if (divisor.isZero())
|
|
695
|
-
throw Error("division by zero");
|
|
696
|
-
if (wasm) {
|
|
697
|
-
if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
|
|
698
|
-
return this;
|
|
699
|
-
}
|
|
700
|
-
var low = (this.unsigned ? wasm.div_u : wasm.div_s)(
|
|
701
|
-
this.low,
|
|
702
|
-
this.high,
|
|
703
|
-
divisor.low,
|
|
704
|
-
divisor.high
|
|
705
|
-
);
|
|
706
|
-
return fromBits(low, wasm.get_high(), this.unsigned);
|
|
707
|
-
}
|
|
708
|
-
if (this.isZero())
|
|
709
|
-
return this.unsigned ? UZERO : ZERO;
|
|
710
|
-
var approx, rem, res;
|
|
711
|
-
if (!this.unsigned) {
|
|
712
|
-
if (this.eq(MIN_VALUE)) {
|
|
713
|
-
if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
|
|
714
|
-
return MIN_VALUE;
|
|
715
|
-
else if (divisor.eq(MIN_VALUE))
|
|
716
|
-
return ONE;
|
|
717
|
-
else {
|
|
718
|
-
var halfThis = this.shr(1);
|
|
719
|
-
approx = halfThis.div(divisor).shl(1);
|
|
720
|
-
if (approx.eq(ZERO)) {
|
|
721
|
-
return divisor.isNegative() ? ONE : NEG_ONE;
|
|
722
|
-
} else {
|
|
723
|
-
rem = this.sub(divisor.mul(approx));
|
|
724
|
-
res = approx.add(rem.div(divisor));
|
|
725
|
-
return res;
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
} else if (divisor.eq(MIN_VALUE))
|
|
729
|
-
return this.unsigned ? UZERO : ZERO;
|
|
730
|
-
if (this.isNegative()) {
|
|
731
|
-
if (divisor.isNegative())
|
|
732
|
-
return this.neg().div(divisor.neg());
|
|
733
|
-
return this.neg().div(divisor).neg();
|
|
734
|
-
} else if (divisor.isNegative())
|
|
735
|
-
return this.div(divisor.neg()).neg();
|
|
736
|
-
res = ZERO;
|
|
737
|
-
} else {
|
|
738
|
-
if (!divisor.unsigned)
|
|
739
|
-
divisor = divisor.toUnsigned();
|
|
740
|
-
if (divisor.gt(this))
|
|
741
|
-
return UZERO;
|
|
742
|
-
if (divisor.gt(this.shru(1)))
|
|
743
|
-
return UONE;
|
|
744
|
-
res = UZERO;
|
|
745
|
-
}
|
|
746
|
-
rem = this;
|
|
747
|
-
while (rem.gte(divisor)) {
|
|
748
|
-
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
|
|
749
|
-
var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48), approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor);
|
|
750
|
-
while (approxRem.isNegative() || approxRem.gt(rem)) {
|
|
751
|
-
approx -= delta;
|
|
752
|
-
approxRes = fromNumber(approx, this.unsigned);
|
|
753
|
-
approxRem = approxRes.mul(divisor);
|
|
754
|
-
}
|
|
755
|
-
if (approxRes.isZero())
|
|
756
|
-
approxRes = ONE;
|
|
757
|
-
res = res.add(approxRes);
|
|
758
|
-
rem = rem.sub(approxRem);
|
|
759
|
-
}
|
|
760
|
-
return res;
|
|
761
|
-
};
|
|
762
|
-
LongPrototype.div = LongPrototype.divide;
|
|
763
|
-
LongPrototype.modulo = function modulo(divisor) {
|
|
764
|
-
if (!isLong(divisor))
|
|
765
|
-
divisor = fromValue(divisor);
|
|
766
|
-
if (wasm) {
|
|
767
|
-
var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(
|
|
768
|
-
this.low,
|
|
769
|
-
this.high,
|
|
770
|
-
divisor.low,
|
|
771
|
-
divisor.high
|
|
772
|
-
);
|
|
773
|
-
return fromBits(low, wasm.get_high(), this.unsigned);
|
|
774
|
-
}
|
|
775
|
-
return this.sub(this.div(divisor).mul(divisor));
|
|
776
|
-
};
|
|
777
|
-
LongPrototype.mod = LongPrototype.modulo;
|
|
778
|
-
LongPrototype.rem = LongPrototype.modulo;
|
|
779
|
-
LongPrototype.not = function not() {
|
|
780
|
-
return fromBits(~this.low, ~this.high, this.unsigned);
|
|
781
|
-
};
|
|
782
|
-
LongPrototype.and = function and(other) {
|
|
783
|
-
if (!isLong(other))
|
|
784
|
-
other = fromValue(other);
|
|
785
|
-
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
|
786
|
-
};
|
|
787
|
-
LongPrototype.or = function or(other) {
|
|
788
|
-
if (!isLong(other))
|
|
789
|
-
other = fromValue(other);
|
|
790
|
-
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
|
791
|
-
};
|
|
792
|
-
LongPrototype.xor = function xor(other) {
|
|
793
|
-
if (!isLong(other))
|
|
794
|
-
other = fromValue(other);
|
|
795
|
-
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
|
796
|
-
};
|
|
797
|
-
LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
798
|
-
if (isLong(numBits))
|
|
799
|
-
numBits = numBits.toInt();
|
|
800
|
-
if ((numBits &= 63) === 0)
|
|
801
|
-
return this;
|
|
802
|
-
else if (numBits < 32)
|
|
803
|
-
return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);
|
|
804
|
-
else
|
|
805
|
-
return fromBits(0, this.low << numBits - 32, this.unsigned);
|
|
806
|
-
};
|
|
807
|
-
LongPrototype.shl = LongPrototype.shiftLeft;
|
|
808
|
-
LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
809
|
-
if (isLong(numBits))
|
|
810
|
-
numBits = numBits.toInt();
|
|
811
|
-
if ((numBits &= 63) === 0)
|
|
812
|
-
return this;
|
|
813
|
-
else if (numBits < 32)
|
|
814
|
-
return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);
|
|
815
|
-
else
|
|
816
|
-
return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
|
|
817
|
-
};
|
|
818
|
-
LongPrototype.shr = LongPrototype.shiftRight;
|
|
819
|
-
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
820
|
-
if (isLong(numBits))
|
|
821
|
-
numBits = numBits.toInt();
|
|
822
|
-
numBits &= 63;
|
|
823
|
-
if (numBits === 0)
|
|
824
|
-
return this;
|
|
825
|
-
else {
|
|
826
|
-
var high = this.high;
|
|
827
|
-
if (numBits < 32) {
|
|
828
|
-
var low = this.low;
|
|
829
|
-
return fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits, this.unsigned);
|
|
830
|
-
} else if (numBits === 32)
|
|
831
|
-
return fromBits(high, 0, this.unsigned);
|
|
832
|
-
else
|
|
833
|
-
return fromBits(high >>> numBits - 32, 0, this.unsigned);
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
LongPrototype.shru = LongPrototype.shiftRightUnsigned;
|
|
837
|
-
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
|
|
838
|
-
LongPrototype.toSigned = function toSigned() {
|
|
839
|
-
if (!this.unsigned)
|
|
840
|
-
return this;
|
|
841
|
-
return fromBits(this.low, this.high, false);
|
|
842
|
-
};
|
|
843
|
-
LongPrototype.toUnsigned = function toUnsigned() {
|
|
844
|
-
if (this.unsigned)
|
|
845
|
-
return this;
|
|
846
|
-
return fromBits(this.low, this.high, true);
|
|
847
|
-
};
|
|
848
|
-
LongPrototype.toBytes = function toBytes(le) {
|
|
849
|
-
return le ? this.toBytesLE() : this.toBytesBE();
|
|
850
|
-
};
|
|
851
|
-
LongPrototype.toBytesLE = function toBytesLE() {
|
|
852
|
-
var hi = this.high, lo = this.low;
|
|
853
|
-
return [
|
|
854
|
-
lo & 255,
|
|
855
|
-
lo >>> 8 & 255,
|
|
856
|
-
lo >>> 16 & 255,
|
|
857
|
-
lo >>> 24,
|
|
858
|
-
hi & 255,
|
|
859
|
-
hi >>> 8 & 255,
|
|
860
|
-
hi >>> 16 & 255,
|
|
861
|
-
hi >>> 24
|
|
862
|
-
];
|
|
863
|
-
};
|
|
864
|
-
LongPrototype.toBytesBE = function toBytesBE() {
|
|
865
|
-
var hi = this.high, lo = this.low;
|
|
866
|
-
return [
|
|
867
|
-
hi >>> 24,
|
|
868
|
-
hi >>> 16 & 255,
|
|
869
|
-
hi >>> 8 & 255,
|
|
870
|
-
hi & 255,
|
|
871
|
-
lo >>> 24,
|
|
872
|
-
lo >>> 16 & 255,
|
|
873
|
-
lo >>> 8 & 255,
|
|
874
|
-
lo & 255
|
|
875
|
-
];
|
|
876
|
-
};
|
|
877
|
-
Long2.fromBytes = function fromBytes(bytes, unsigned, le) {
|
|
878
|
-
return le ? Long2.fromBytesLE(bytes, unsigned) : Long2.fromBytesBE(bytes, unsigned);
|
|
879
|
-
};
|
|
880
|
-
Long2.fromBytesLE = function fromBytesLE(bytes, unsigned) {
|
|
881
|
-
return new Long2(
|
|
882
|
-
bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24,
|
|
883
|
-
bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24,
|
|
884
|
-
unsigned
|
|
885
|
-
);
|
|
886
|
-
};
|
|
887
|
-
Long2.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
888
|
-
return new Long2(
|
|
889
|
-
bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7],
|
|
890
|
-
bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3],
|
|
891
|
-
unsigned
|
|
892
|
-
);
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
28
|
|
|
897
29
|
// ../../node_modules/@protobufjs/aspromise/index.js
|
|
898
30
|
var require_aspromise = __commonJS({
|
|
@@ -1382,9 +514,9 @@ var require_pool = __commonJS({
|
|
|
1382
514
|
}
|
|
1383
515
|
});
|
|
1384
516
|
|
|
1385
|
-
//
|
|
517
|
+
// ../services/node_modules/protobufjs/src/util/longbits.js
|
|
1386
518
|
var require_longbits = __commonJS({
|
|
1387
|
-
"
|
|
519
|
+
"../services/node_modules/protobufjs/src/util/longbits.js"(exports2, module2) {
|
|
1388
520
|
"use strict";
|
|
1389
521
|
module2.exports = LongBits;
|
|
1390
522
|
var util = require_minimal();
|
|
@@ -1403,7 +535,7 @@ var require_longbits = __commonJS({
|
|
|
1403
535
|
return 1;
|
|
1404
536
|
};
|
|
1405
537
|
var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
|
|
1406
|
-
LongBits.fromNumber = function
|
|
538
|
+
LongBits.fromNumber = function fromNumber2(value) {
|
|
1407
539
|
if (value === 0)
|
|
1408
540
|
return zero;
|
|
1409
541
|
var sign = value < 0;
|
|
@@ -1432,7 +564,7 @@ var require_longbits = __commonJS({
|
|
|
1432
564
|
}
|
|
1433
565
|
return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
|
|
1434
566
|
};
|
|
1435
|
-
LongBits.prototype.toNumber = function
|
|
567
|
+
LongBits.prototype.toNumber = function toNumber2(unsigned) {
|
|
1436
568
|
if (!unsigned && this.hi >>> 31) {
|
|
1437
569
|
var lo = ~this.lo + 1 >>> 0, hi = ~this.hi >>> 0;
|
|
1438
570
|
if (!lo)
|
|
@@ -1484,9 +616,9 @@ var require_longbits = __commonJS({
|
|
|
1484
616
|
}
|
|
1485
617
|
});
|
|
1486
618
|
|
|
1487
|
-
//
|
|
619
|
+
// ../services/node_modules/protobufjs/src/util/minimal.js
|
|
1488
620
|
var require_minimal = __commonJS({
|
|
1489
|
-
"
|
|
621
|
+
"../services/node_modules/protobufjs/src/util/minimal.js"(exports2) {
|
|
1490
622
|
"use strict";
|
|
1491
623
|
var util = exports2;
|
|
1492
624
|
util.asPromise = require_aspromise();
|
|
@@ -1567,13 +699,30 @@ var require_minimal = __commonJS({
|
|
|
1567
699
|
if (properties)
|
|
1568
700
|
merge(this, properties);
|
|
1569
701
|
}
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
702
|
+
CustomError.prototype = Object.create(Error.prototype, {
|
|
703
|
+
constructor: {
|
|
704
|
+
value: CustomError,
|
|
705
|
+
writable: true,
|
|
706
|
+
enumerable: false,
|
|
707
|
+
configurable: true
|
|
708
|
+
},
|
|
709
|
+
name: {
|
|
710
|
+
get() {
|
|
711
|
+
return name;
|
|
712
|
+
},
|
|
713
|
+
set: void 0,
|
|
714
|
+
enumerable: false,
|
|
715
|
+
configurable: true
|
|
716
|
+
},
|
|
717
|
+
toString: {
|
|
718
|
+
value() {
|
|
719
|
+
return this.name + ": " + this.message;
|
|
720
|
+
},
|
|
721
|
+
writable: true,
|
|
722
|
+
enumerable: false,
|
|
723
|
+
configurable: true
|
|
724
|
+
}
|
|
725
|
+
});
|
|
1577
726
|
return CustomError;
|
|
1578
727
|
}
|
|
1579
728
|
util.newError = newError;
|
|
@@ -1617,9 +766,9 @@ var require_minimal = __commonJS({
|
|
|
1617
766
|
}
|
|
1618
767
|
});
|
|
1619
768
|
|
|
1620
|
-
//
|
|
769
|
+
// ../services/node_modules/protobufjs/src/writer.js
|
|
1621
770
|
var require_writer = __commonJS({
|
|
1622
|
-
"
|
|
771
|
+
"../services/node_modules/protobufjs/src/writer.js"(exports2, module2) {
|
|
1623
772
|
"use strict";
|
|
1624
773
|
module2.exports = Writer;
|
|
1625
774
|
var util = require_minimal();
|
|
@@ -1808,9 +957,9 @@ var require_writer = __commonJS({
|
|
|
1808
957
|
}
|
|
1809
958
|
});
|
|
1810
959
|
|
|
1811
|
-
//
|
|
960
|
+
// ../services/node_modules/protobufjs/src/writer_buffer.js
|
|
1812
961
|
var require_writer_buffer = __commonJS({
|
|
1813
|
-
"
|
|
962
|
+
"../services/node_modules/protobufjs/src/writer_buffer.js"(exports2, module2) {
|
|
1814
963
|
"use strict";
|
|
1815
964
|
module2.exports = BufferWriter;
|
|
1816
965
|
var Writer = require_writer();
|
|
@@ -1859,9 +1008,9 @@ var require_writer_buffer = __commonJS({
|
|
|
1859
1008
|
}
|
|
1860
1009
|
});
|
|
1861
1010
|
|
|
1862
|
-
//
|
|
1011
|
+
// ../services/node_modules/protobufjs/src/reader.js
|
|
1863
1012
|
var require_reader = __commonJS({
|
|
1864
|
-
"
|
|
1013
|
+
"../services/node_modules/protobufjs/src/reader.js"(exports2, module2) {
|
|
1865
1014
|
"use strict";
|
|
1866
1015
|
module2.exports = Reader;
|
|
1867
1016
|
var util = require_minimal();
|
|
@@ -2079,9 +1228,9 @@ var require_reader = __commonJS({
|
|
|
2079
1228
|
}
|
|
2080
1229
|
});
|
|
2081
1230
|
|
|
2082
|
-
//
|
|
1231
|
+
// ../services/node_modules/protobufjs/src/reader_buffer.js
|
|
2083
1232
|
var require_reader_buffer = __commonJS({
|
|
2084
|
-
"
|
|
1233
|
+
"../services/node_modules/protobufjs/src/reader_buffer.js"(exports2, module2) {
|
|
2085
1234
|
"use strict";
|
|
2086
1235
|
module2.exports = BufferReader;
|
|
2087
1236
|
var Reader = require_reader();
|
|
@@ -2102,9 +1251,9 @@ var require_reader_buffer = __commonJS({
|
|
|
2102
1251
|
}
|
|
2103
1252
|
});
|
|
2104
1253
|
|
|
2105
|
-
//
|
|
1254
|
+
// ../services/node_modules/protobufjs/src/rpc/service.js
|
|
2106
1255
|
var require_service = __commonJS({
|
|
2107
|
-
"
|
|
1256
|
+
"../services/node_modules/protobufjs/src/rpc/service.js"(exports2, module2) {
|
|
2108
1257
|
"use strict";
|
|
2109
1258
|
module2.exports = Service;
|
|
2110
1259
|
var util = require_minimal();
|
|
@@ -2174,26 +1323,26 @@ var require_service = __commonJS({
|
|
|
2174
1323
|
}
|
|
2175
1324
|
});
|
|
2176
1325
|
|
|
2177
|
-
//
|
|
1326
|
+
// ../services/node_modules/protobufjs/src/rpc.js
|
|
2178
1327
|
var require_rpc = __commonJS({
|
|
2179
|
-
"
|
|
1328
|
+
"../services/node_modules/protobufjs/src/rpc.js"(exports2) {
|
|
2180
1329
|
"use strict";
|
|
2181
1330
|
var rpc = exports2;
|
|
2182
1331
|
rpc.Service = require_service();
|
|
2183
1332
|
}
|
|
2184
1333
|
});
|
|
2185
1334
|
|
|
2186
|
-
//
|
|
1335
|
+
// ../services/node_modules/protobufjs/src/roots.js
|
|
2187
1336
|
var require_roots = __commonJS({
|
|
2188
|
-
"
|
|
1337
|
+
"../services/node_modules/protobufjs/src/roots.js"(exports2, module2) {
|
|
2189
1338
|
"use strict";
|
|
2190
1339
|
module2.exports = {};
|
|
2191
1340
|
}
|
|
2192
1341
|
});
|
|
2193
1342
|
|
|
2194
|
-
//
|
|
1343
|
+
// ../services/node_modules/protobufjs/src/index-minimal.js
|
|
2195
1344
|
var require_index_minimal = __commonJS({
|
|
2196
|
-
"
|
|
1345
|
+
"../services/node_modules/protobufjs/src/index-minimal.js"(exports2) {
|
|
2197
1346
|
"use strict";
|
|
2198
1347
|
var protobuf = exports2;
|
|
2199
1348
|
protobuf.build = "minimal";
|
|
@@ -2214,9 +1363,9 @@ var require_index_minimal = __commonJS({
|
|
|
2214
1363
|
}
|
|
2215
1364
|
});
|
|
2216
1365
|
|
|
2217
|
-
//
|
|
1366
|
+
// ../services/node_modules/protobufjs/minimal.js
|
|
2218
1367
|
var require_minimal2 = __commonJS({
|
|
2219
|
-
"
|
|
1368
|
+
"../services/node_modules/protobufjs/minimal.js"(exports2, module2) {
|
|
2220
1369
|
"use strict";
|
|
2221
1370
|
module2.exports = require_index_minimal();
|
|
2222
1371
|
}
|
|
@@ -2519,7 +1668,7 @@ var require_cjs = __commonJS({
|
|
|
2519
1668
|
defineProperty(instance, "toString", {
|
|
2520
1669
|
configurable: true,
|
|
2521
1670
|
enumerable: false,
|
|
2522
|
-
value: function
|
|
1671
|
+
value: function toString2() {
|
|
2523
1672
|
return (this.name || "Error") + (typeof this.message === "undefined" ? "" : ": " + this.message);
|
|
2524
1673
|
},
|
|
2525
1674
|
writable: true
|
|
@@ -4989,6 +4138,109 @@ var require_lib3 = __commonJS({
|
|
|
4989
4138
|
}
|
|
4990
4139
|
});
|
|
4991
4140
|
|
|
4141
|
+
// ../../node_modules/@improbable-eng/grpc-web-node-http-transport/lib/index.js
|
|
4142
|
+
var require_lib4 = __commonJS({
|
|
4143
|
+
"../../node_modules/@improbable-eng/grpc-web-node-http-transport/lib/index.js"(exports2) {
|
|
4144
|
+
"use strict";
|
|
4145
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
4146
|
+
exports2.NodeHttpTransport = void 0;
|
|
4147
|
+
var http = require("http");
|
|
4148
|
+
var https = require("https");
|
|
4149
|
+
var url = require("url");
|
|
4150
|
+
var grpc_web_1 = require_grpc_web_client();
|
|
4151
|
+
function NodeHttpTransport2() {
|
|
4152
|
+
return function(opts) {
|
|
4153
|
+
return new NodeHttp(opts);
|
|
4154
|
+
};
|
|
4155
|
+
}
|
|
4156
|
+
exports2.NodeHttpTransport = NodeHttpTransport2;
|
|
4157
|
+
var NodeHttp = function() {
|
|
4158
|
+
function NodeHttp2(transportOptions) {
|
|
4159
|
+
this.options = transportOptions;
|
|
4160
|
+
}
|
|
4161
|
+
NodeHttp2.prototype.sendMessage = function(msgBytes) {
|
|
4162
|
+
if (!this.options.methodDefinition.requestStream && !this.options.methodDefinition.responseStream) {
|
|
4163
|
+
this.request.setHeader("Content-Length", msgBytes.byteLength);
|
|
4164
|
+
}
|
|
4165
|
+
this.request.write(toBuffer(msgBytes));
|
|
4166
|
+
this.request.end();
|
|
4167
|
+
};
|
|
4168
|
+
NodeHttp2.prototype.finishSend = function() {
|
|
4169
|
+
};
|
|
4170
|
+
NodeHttp2.prototype.responseCallback = function(response) {
|
|
4171
|
+
var _this = this;
|
|
4172
|
+
this.options.debug && console.log("NodeHttp.response", response.statusCode);
|
|
4173
|
+
var headers = filterHeadersForUndefined(response.headers);
|
|
4174
|
+
this.options.onHeaders(new grpc_web_1.grpc.Metadata(headers), response.statusCode);
|
|
4175
|
+
response.on("data", function(chunk) {
|
|
4176
|
+
_this.options.debug && console.log("NodeHttp.data", chunk);
|
|
4177
|
+
_this.options.onChunk(toArrayBuffer(chunk));
|
|
4178
|
+
});
|
|
4179
|
+
response.on("end", function() {
|
|
4180
|
+
_this.options.debug && console.log("NodeHttp.end");
|
|
4181
|
+
_this.options.onEnd();
|
|
4182
|
+
});
|
|
4183
|
+
};
|
|
4184
|
+
;
|
|
4185
|
+
NodeHttp2.prototype.start = function(metadata) {
|
|
4186
|
+
var _this = this;
|
|
4187
|
+
var headers = {};
|
|
4188
|
+
metadata.forEach(function(key, values) {
|
|
4189
|
+
headers[key] = values.join(", ");
|
|
4190
|
+
});
|
|
4191
|
+
var parsedUrl = url.parse(this.options.url);
|
|
4192
|
+
var httpOptions = {
|
|
4193
|
+
host: parsedUrl.hostname,
|
|
4194
|
+
port: parsedUrl.port ? parseInt(parsedUrl.port) : void 0,
|
|
4195
|
+
path: parsedUrl.path,
|
|
4196
|
+
headers,
|
|
4197
|
+
method: "POST"
|
|
4198
|
+
};
|
|
4199
|
+
if (parsedUrl.protocol === "https:") {
|
|
4200
|
+
this.request = https.request(httpOptions, this.responseCallback.bind(this));
|
|
4201
|
+
} else {
|
|
4202
|
+
this.request = http.request(httpOptions, this.responseCallback.bind(this));
|
|
4203
|
+
}
|
|
4204
|
+
this.request.on("error", function(err) {
|
|
4205
|
+
_this.options.debug && console.log("NodeHttp.error", err);
|
|
4206
|
+
_this.options.onEnd(err);
|
|
4207
|
+
});
|
|
4208
|
+
};
|
|
4209
|
+
NodeHttp2.prototype.cancel = function() {
|
|
4210
|
+
this.options.debug && console.log("NodeHttp.abort");
|
|
4211
|
+
this.request.abort();
|
|
4212
|
+
};
|
|
4213
|
+
return NodeHttp2;
|
|
4214
|
+
}();
|
|
4215
|
+
function filterHeadersForUndefined(headers) {
|
|
4216
|
+
var filteredHeaders = {};
|
|
4217
|
+
for (var key in headers) {
|
|
4218
|
+
var value = headers[key];
|
|
4219
|
+
if (headers.hasOwnProperty(key)) {
|
|
4220
|
+
if (value !== void 0) {
|
|
4221
|
+
filteredHeaders[key] = value;
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
return filteredHeaders;
|
|
4226
|
+
}
|
|
4227
|
+
function toArrayBuffer(buf) {
|
|
4228
|
+
var view = new Uint8Array(buf.length);
|
|
4229
|
+
for (var i = 0; i < buf.length; i++) {
|
|
4230
|
+
view[i] = buf[i];
|
|
4231
|
+
}
|
|
4232
|
+
return view;
|
|
4233
|
+
}
|
|
4234
|
+
function toBuffer(ab) {
|
|
4235
|
+
var buf = Buffer.alloc(ab.byteLength);
|
|
4236
|
+
for (var i = 0; i < buf.length; i++) {
|
|
4237
|
+
buf[i] = ab[i];
|
|
4238
|
+
}
|
|
4239
|
+
return buf;
|
|
4240
|
+
}
|
|
4241
|
+
}
|
|
4242
|
+
});
|
|
4243
|
+
|
|
4992
4244
|
// src/commands/faucet.ts
|
|
4993
4245
|
var faucet_exports = {};
|
|
4994
4246
|
__export(faucet_exports, {
|
|
@@ -5000,8 +4252,892 @@ __export(faucet_exports, {
|
|
|
5000
4252
|
});
|
|
5001
4253
|
module.exports = __toCommonJS(faucet_exports);
|
|
5002
4254
|
|
|
4255
|
+
// ../services/node_modules/long/index.js
|
|
4256
|
+
var wasm = null;
|
|
4257
|
+
try {
|
|
4258
|
+
wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
|
|
4259
|
+
0,
|
|
4260
|
+
97,
|
|
4261
|
+
115,
|
|
4262
|
+
109,
|
|
4263
|
+
1,
|
|
4264
|
+
0,
|
|
4265
|
+
0,
|
|
4266
|
+
0,
|
|
4267
|
+
1,
|
|
4268
|
+
13,
|
|
4269
|
+
2,
|
|
4270
|
+
96,
|
|
4271
|
+
0,
|
|
4272
|
+
1,
|
|
4273
|
+
127,
|
|
4274
|
+
96,
|
|
4275
|
+
4,
|
|
4276
|
+
127,
|
|
4277
|
+
127,
|
|
4278
|
+
127,
|
|
4279
|
+
127,
|
|
4280
|
+
1,
|
|
4281
|
+
127,
|
|
4282
|
+
3,
|
|
4283
|
+
7,
|
|
4284
|
+
6,
|
|
4285
|
+
0,
|
|
4286
|
+
1,
|
|
4287
|
+
1,
|
|
4288
|
+
1,
|
|
4289
|
+
1,
|
|
4290
|
+
1,
|
|
4291
|
+
6,
|
|
4292
|
+
6,
|
|
4293
|
+
1,
|
|
4294
|
+
127,
|
|
4295
|
+
1,
|
|
4296
|
+
65,
|
|
4297
|
+
0,
|
|
4298
|
+
11,
|
|
4299
|
+
7,
|
|
4300
|
+
50,
|
|
4301
|
+
6,
|
|
4302
|
+
3,
|
|
4303
|
+
109,
|
|
4304
|
+
117,
|
|
4305
|
+
108,
|
|
4306
|
+
0,
|
|
4307
|
+
1,
|
|
4308
|
+
5,
|
|
4309
|
+
100,
|
|
4310
|
+
105,
|
|
4311
|
+
118,
|
|
4312
|
+
95,
|
|
4313
|
+
115,
|
|
4314
|
+
0,
|
|
4315
|
+
2,
|
|
4316
|
+
5,
|
|
4317
|
+
100,
|
|
4318
|
+
105,
|
|
4319
|
+
118,
|
|
4320
|
+
95,
|
|
4321
|
+
117,
|
|
4322
|
+
0,
|
|
4323
|
+
3,
|
|
4324
|
+
5,
|
|
4325
|
+
114,
|
|
4326
|
+
101,
|
|
4327
|
+
109,
|
|
4328
|
+
95,
|
|
4329
|
+
115,
|
|
4330
|
+
0,
|
|
4331
|
+
4,
|
|
4332
|
+
5,
|
|
4333
|
+
114,
|
|
4334
|
+
101,
|
|
4335
|
+
109,
|
|
4336
|
+
95,
|
|
4337
|
+
117,
|
|
4338
|
+
0,
|
|
4339
|
+
5,
|
|
4340
|
+
8,
|
|
4341
|
+
103,
|
|
4342
|
+
101,
|
|
4343
|
+
116,
|
|
4344
|
+
95,
|
|
4345
|
+
104,
|
|
4346
|
+
105,
|
|
4347
|
+
103,
|
|
4348
|
+
104,
|
|
4349
|
+
0,
|
|
4350
|
+
0,
|
|
4351
|
+
10,
|
|
4352
|
+
191,
|
|
4353
|
+
1,
|
|
4354
|
+
6,
|
|
4355
|
+
4,
|
|
4356
|
+
0,
|
|
4357
|
+
35,
|
|
4358
|
+
0,
|
|
4359
|
+
11,
|
|
4360
|
+
36,
|
|
4361
|
+
1,
|
|
4362
|
+
1,
|
|
4363
|
+
126,
|
|
4364
|
+
32,
|
|
4365
|
+
0,
|
|
4366
|
+
173,
|
|
4367
|
+
32,
|
|
4368
|
+
1,
|
|
4369
|
+
173,
|
|
4370
|
+
66,
|
|
4371
|
+
32,
|
|
4372
|
+
134,
|
|
4373
|
+
132,
|
|
4374
|
+
32,
|
|
4375
|
+
2,
|
|
4376
|
+
173,
|
|
4377
|
+
32,
|
|
4378
|
+
3,
|
|
4379
|
+
173,
|
|
4380
|
+
66,
|
|
4381
|
+
32,
|
|
4382
|
+
134,
|
|
4383
|
+
132,
|
|
4384
|
+
126,
|
|
4385
|
+
34,
|
|
4386
|
+
4,
|
|
4387
|
+
66,
|
|
4388
|
+
32,
|
|
4389
|
+
135,
|
|
4390
|
+
167,
|
|
4391
|
+
36,
|
|
4392
|
+
0,
|
|
4393
|
+
32,
|
|
4394
|
+
4,
|
|
4395
|
+
167,
|
|
4396
|
+
11,
|
|
4397
|
+
36,
|
|
4398
|
+
1,
|
|
4399
|
+
1,
|
|
4400
|
+
126,
|
|
4401
|
+
32,
|
|
4402
|
+
0,
|
|
4403
|
+
173,
|
|
4404
|
+
32,
|
|
4405
|
+
1,
|
|
4406
|
+
173,
|
|
4407
|
+
66,
|
|
4408
|
+
32,
|
|
4409
|
+
134,
|
|
4410
|
+
132,
|
|
4411
|
+
32,
|
|
4412
|
+
2,
|
|
4413
|
+
173,
|
|
4414
|
+
32,
|
|
4415
|
+
3,
|
|
4416
|
+
173,
|
|
4417
|
+
66,
|
|
4418
|
+
32,
|
|
4419
|
+
134,
|
|
4420
|
+
132,
|
|
4421
|
+
127,
|
|
4422
|
+
34,
|
|
4423
|
+
4,
|
|
4424
|
+
66,
|
|
4425
|
+
32,
|
|
4426
|
+
135,
|
|
4427
|
+
167,
|
|
4428
|
+
36,
|
|
4429
|
+
0,
|
|
4430
|
+
32,
|
|
4431
|
+
4,
|
|
4432
|
+
167,
|
|
4433
|
+
11,
|
|
4434
|
+
36,
|
|
4435
|
+
1,
|
|
4436
|
+
1,
|
|
4437
|
+
126,
|
|
4438
|
+
32,
|
|
4439
|
+
0,
|
|
4440
|
+
173,
|
|
4441
|
+
32,
|
|
4442
|
+
1,
|
|
4443
|
+
173,
|
|
4444
|
+
66,
|
|
4445
|
+
32,
|
|
4446
|
+
134,
|
|
4447
|
+
132,
|
|
4448
|
+
32,
|
|
4449
|
+
2,
|
|
4450
|
+
173,
|
|
4451
|
+
32,
|
|
4452
|
+
3,
|
|
4453
|
+
173,
|
|
4454
|
+
66,
|
|
4455
|
+
32,
|
|
4456
|
+
134,
|
|
4457
|
+
132,
|
|
4458
|
+
128,
|
|
4459
|
+
34,
|
|
4460
|
+
4,
|
|
4461
|
+
66,
|
|
4462
|
+
32,
|
|
4463
|
+
135,
|
|
4464
|
+
167,
|
|
4465
|
+
36,
|
|
4466
|
+
0,
|
|
4467
|
+
32,
|
|
4468
|
+
4,
|
|
4469
|
+
167,
|
|
4470
|
+
11,
|
|
4471
|
+
36,
|
|
4472
|
+
1,
|
|
4473
|
+
1,
|
|
4474
|
+
126,
|
|
4475
|
+
32,
|
|
4476
|
+
0,
|
|
4477
|
+
173,
|
|
4478
|
+
32,
|
|
4479
|
+
1,
|
|
4480
|
+
173,
|
|
4481
|
+
66,
|
|
4482
|
+
32,
|
|
4483
|
+
134,
|
|
4484
|
+
132,
|
|
4485
|
+
32,
|
|
4486
|
+
2,
|
|
4487
|
+
173,
|
|
4488
|
+
32,
|
|
4489
|
+
3,
|
|
4490
|
+
173,
|
|
4491
|
+
66,
|
|
4492
|
+
32,
|
|
4493
|
+
134,
|
|
4494
|
+
132,
|
|
4495
|
+
129,
|
|
4496
|
+
34,
|
|
4497
|
+
4,
|
|
4498
|
+
66,
|
|
4499
|
+
32,
|
|
4500
|
+
135,
|
|
4501
|
+
167,
|
|
4502
|
+
36,
|
|
4503
|
+
0,
|
|
4504
|
+
32,
|
|
4505
|
+
4,
|
|
4506
|
+
167,
|
|
4507
|
+
11,
|
|
4508
|
+
36,
|
|
4509
|
+
1,
|
|
4510
|
+
1,
|
|
4511
|
+
126,
|
|
4512
|
+
32,
|
|
4513
|
+
0,
|
|
4514
|
+
173,
|
|
4515
|
+
32,
|
|
4516
|
+
1,
|
|
4517
|
+
173,
|
|
4518
|
+
66,
|
|
4519
|
+
32,
|
|
4520
|
+
134,
|
|
4521
|
+
132,
|
|
4522
|
+
32,
|
|
4523
|
+
2,
|
|
4524
|
+
173,
|
|
4525
|
+
32,
|
|
4526
|
+
3,
|
|
4527
|
+
173,
|
|
4528
|
+
66,
|
|
4529
|
+
32,
|
|
4530
|
+
134,
|
|
4531
|
+
132,
|
|
4532
|
+
130,
|
|
4533
|
+
34,
|
|
4534
|
+
4,
|
|
4535
|
+
66,
|
|
4536
|
+
32,
|
|
4537
|
+
135,
|
|
4538
|
+
167,
|
|
4539
|
+
36,
|
|
4540
|
+
0,
|
|
4541
|
+
32,
|
|
4542
|
+
4,
|
|
4543
|
+
167,
|
|
4544
|
+
11
|
|
4545
|
+
])), {}).exports;
|
|
4546
|
+
} catch (e) {
|
|
4547
|
+
}
|
|
4548
|
+
function Long(low, high, unsigned) {
|
|
4549
|
+
this.low = low | 0;
|
|
4550
|
+
this.high = high | 0;
|
|
4551
|
+
this.unsigned = !!unsigned;
|
|
4552
|
+
}
|
|
4553
|
+
Long.prototype.__isLong__;
|
|
4554
|
+
Object.defineProperty(Long.prototype, "__isLong__", { value: true });
|
|
4555
|
+
function isLong(obj) {
|
|
4556
|
+
return (obj && obj["__isLong__"]) === true;
|
|
4557
|
+
}
|
|
4558
|
+
function ctz32(value) {
|
|
4559
|
+
var c = Math.clz32(value & -value);
|
|
4560
|
+
return value ? 31 - c : c;
|
|
4561
|
+
}
|
|
4562
|
+
Long.isLong = isLong;
|
|
4563
|
+
var INT_CACHE = {};
|
|
4564
|
+
var UINT_CACHE = {};
|
|
4565
|
+
function fromInt(value, unsigned) {
|
|
4566
|
+
var obj, cachedObj, cache;
|
|
4567
|
+
if (unsigned) {
|
|
4568
|
+
value >>>= 0;
|
|
4569
|
+
if (cache = 0 <= value && value < 256) {
|
|
4570
|
+
cachedObj = UINT_CACHE[value];
|
|
4571
|
+
if (cachedObj)
|
|
4572
|
+
return cachedObj;
|
|
4573
|
+
}
|
|
4574
|
+
obj = fromBits(value, 0, true);
|
|
4575
|
+
if (cache)
|
|
4576
|
+
UINT_CACHE[value] = obj;
|
|
4577
|
+
return obj;
|
|
4578
|
+
} else {
|
|
4579
|
+
value |= 0;
|
|
4580
|
+
if (cache = -128 <= value && value < 128) {
|
|
4581
|
+
cachedObj = INT_CACHE[value];
|
|
4582
|
+
if (cachedObj)
|
|
4583
|
+
return cachedObj;
|
|
4584
|
+
}
|
|
4585
|
+
obj = fromBits(value, value < 0 ? -1 : 0, false);
|
|
4586
|
+
if (cache)
|
|
4587
|
+
INT_CACHE[value] = obj;
|
|
4588
|
+
return obj;
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
Long.fromInt = fromInt;
|
|
4592
|
+
function fromNumber(value, unsigned) {
|
|
4593
|
+
if (isNaN(value))
|
|
4594
|
+
return unsigned ? UZERO : ZERO;
|
|
4595
|
+
if (unsigned) {
|
|
4596
|
+
if (value < 0)
|
|
4597
|
+
return UZERO;
|
|
4598
|
+
if (value >= TWO_PWR_64_DBL)
|
|
4599
|
+
return MAX_UNSIGNED_VALUE;
|
|
4600
|
+
} else {
|
|
4601
|
+
if (value <= -TWO_PWR_63_DBL)
|
|
4602
|
+
return MIN_VALUE;
|
|
4603
|
+
if (value + 1 >= TWO_PWR_63_DBL)
|
|
4604
|
+
return MAX_VALUE;
|
|
4605
|
+
}
|
|
4606
|
+
if (value < 0)
|
|
4607
|
+
return fromNumber(-value, unsigned).neg();
|
|
4608
|
+
return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
|
|
4609
|
+
}
|
|
4610
|
+
Long.fromNumber = fromNumber;
|
|
4611
|
+
function fromBits(lowBits, highBits, unsigned) {
|
|
4612
|
+
return new Long(lowBits, highBits, unsigned);
|
|
4613
|
+
}
|
|
4614
|
+
Long.fromBits = fromBits;
|
|
4615
|
+
var pow_dbl = Math.pow;
|
|
4616
|
+
function fromString(str, unsigned, radix) {
|
|
4617
|
+
if (str.length === 0)
|
|
4618
|
+
throw Error("empty string");
|
|
4619
|
+
if (typeof unsigned === "number") {
|
|
4620
|
+
radix = unsigned;
|
|
4621
|
+
unsigned = false;
|
|
4622
|
+
} else {
|
|
4623
|
+
unsigned = !!unsigned;
|
|
4624
|
+
}
|
|
4625
|
+
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
|
4626
|
+
return unsigned ? UZERO : ZERO;
|
|
4627
|
+
radix = radix || 10;
|
|
4628
|
+
if (radix < 2 || 36 < radix)
|
|
4629
|
+
throw RangeError("radix");
|
|
4630
|
+
var p;
|
|
4631
|
+
if ((p = str.indexOf("-")) > 0)
|
|
4632
|
+
throw Error("interior hyphen");
|
|
4633
|
+
else if (p === 0) {
|
|
4634
|
+
return fromString(str.substring(1), unsigned, radix).neg();
|
|
4635
|
+
}
|
|
4636
|
+
var radixToPower = fromNumber(pow_dbl(radix, 8));
|
|
4637
|
+
var result = ZERO;
|
|
4638
|
+
for (var i = 0; i < str.length; i += 8) {
|
|
4639
|
+
var size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
|
|
4640
|
+
if (size < 8) {
|
|
4641
|
+
var power = fromNumber(pow_dbl(radix, size));
|
|
4642
|
+
result = result.mul(power).add(fromNumber(value));
|
|
4643
|
+
} else {
|
|
4644
|
+
result = result.mul(radixToPower);
|
|
4645
|
+
result = result.add(fromNumber(value));
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
result.unsigned = unsigned;
|
|
4649
|
+
return result;
|
|
4650
|
+
}
|
|
4651
|
+
Long.fromString = fromString;
|
|
4652
|
+
function fromValue(val, unsigned) {
|
|
4653
|
+
if (typeof val === "number")
|
|
4654
|
+
return fromNumber(val, unsigned);
|
|
4655
|
+
if (typeof val === "string")
|
|
4656
|
+
return fromString(val, unsigned);
|
|
4657
|
+
return fromBits(val.low, val.high, typeof unsigned === "boolean" ? unsigned : val.unsigned);
|
|
4658
|
+
}
|
|
4659
|
+
Long.fromValue = fromValue;
|
|
4660
|
+
var TWO_PWR_16_DBL = 1 << 16;
|
|
4661
|
+
var TWO_PWR_24_DBL = 1 << 24;
|
|
4662
|
+
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
|
|
4663
|
+
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
|
|
4664
|
+
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
|
|
4665
|
+
var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
|
|
4666
|
+
var ZERO = fromInt(0);
|
|
4667
|
+
Long.ZERO = ZERO;
|
|
4668
|
+
var UZERO = fromInt(0, true);
|
|
4669
|
+
Long.UZERO = UZERO;
|
|
4670
|
+
var ONE = fromInt(1);
|
|
4671
|
+
Long.ONE = ONE;
|
|
4672
|
+
var UONE = fromInt(1, true);
|
|
4673
|
+
Long.UONE = UONE;
|
|
4674
|
+
var NEG_ONE = fromInt(-1);
|
|
4675
|
+
Long.NEG_ONE = NEG_ONE;
|
|
4676
|
+
var MAX_VALUE = fromBits(4294967295 | 0, 2147483647 | 0, false);
|
|
4677
|
+
Long.MAX_VALUE = MAX_VALUE;
|
|
4678
|
+
var MAX_UNSIGNED_VALUE = fromBits(4294967295 | 0, 4294967295 | 0, true);
|
|
4679
|
+
Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
|
|
4680
|
+
var MIN_VALUE = fromBits(0, 2147483648 | 0, false);
|
|
4681
|
+
Long.MIN_VALUE = MIN_VALUE;
|
|
4682
|
+
var LongPrototype = Long.prototype;
|
|
4683
|
+
LongPrototype.toInt = function toInt() {
|
|
4684
|
+
return this.unsigned ? this.low >>> 0 : this.low;
|
|
4685
|
+
};
|
|
4686
|
+
LongPrototype.toNumber = function toNumber() {
|
|
4687
|
+
if (this.unsigned)
|
|
4688
|
+
return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
4689
|
+
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
4690
|
+
};
|
|
4691
|
+
LongPrototype.toString = function toString(radix) {
|
|
4692
|
+
radix = radix || 10;
|
|
4693
|
+
if (radix < 2 || 36 < radix)
|
|
4694
|
+
throw RangeError("radix");
|
|
4695
|
+
if (this.isZero())
|
|
4696
|
+
return "0";
|
|
4697
|
+
if (this.isNegative()) {
|
|
4698
|
+
if (this.eq(MIN_VALUE)) {
|
|
4699
|
+
var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
|
|
4700
|
+
return div.toString(radix) + rem1.toInt().toString(radix);
|
|
4701
|
+
} else
|
|
4702
|
+
return "-" + this.neg().toString(radix);
|
|
4703
|
+
}
|
|
4704
|
+
var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this;
|
|
4705
|
+
var result = "";
|
|
4706
|
+
while (true) {
|
|
4707
|
+
var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix);
|
|
4708
|
+
rem = remDiv;
|
|
4709
|
+
if (rem.isZero())
|
|
4710
|
+
return digits + result;
|
|
4711
|
+
else {
|
|
4712
|
+
while (digits.length < 6)
|
|
4713
|
+
digits = "0" + digits;
|
|
4714
|
+
result = "" + digits + result;
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
};
|
|
4718
|
+
LongPrototype.getHighBits = function getHighBits() {
|
|
4719
|
+
return this.high;
|
|
4720
|
+
};
|
|
4721
|
+
LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
|
|
4722
|
+
return this.high >>> 0;
|
|
4723
|
+
};
|
|
4724
|
+
LongPrototype.getLowBits = function getLowBits() {
|
|
4725
|
+
return this.low;
|
|
4726
|
+
};
|
|
4727
|
+
LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
|
|
4728
|
+
return this.low >>> 0;
|
|
4729
|
+
};
|
|
4730
|
+
LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
|
|
4731
|
+
if (this.isNegative())
|
|
4732
|
+
return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
|
|
4733
|
+
var val = this.high != 0 ? this.high : this.low;
|
|
4734
|
+
for (var bit = 31; bit > 0; bit--)
|
|
4735
|
+
if ((val & 1 << bit) != 0)
|
|
4736
|
+
break;
|
|
4737
|
+
return this.high != 0 ? bit + 33 : bit + 1;
|
|
4738
|
+
};
|
|
4739
|
+
LongPrototype.isZero = function isZero() {
|
|
4740
|
+
return this.high === 0 && this.low === 0;
|
|
4741
|
+
};
|
|
4742
|
+
LongPrototype.eqz = LongPrototype.isZero;
|
|
4743
|
+
LongPrototype.isNegative = function isNegative() {
|
|
4744
|
+
return !this.unsigned && this.high < 0;
|
|
4745
|
+
};
|
|
4746
|
+
LongPrototype.isPositive = function isPositive() {
|
|
4747
|
+
return this.unsigned || this.high >= 0;
|
|
4748
|
+
};
|
|
4749
|
+
LongPrototype.isOdd = function isOdd() {
|
|
4750
|
+
return (this.low & 1) === 1;
|
|
4751
|
+
};
|
|
4752
|
+
LongPrototype.isEven = function isEven() {
|
|
4753
|
+
return (this.low & 1) === 0;
|
|
4754
|
+
};
|
|
4755
|
+
LongPrototype.equals = function equals(other) {
|
|
4756
|
+
if (!isLong(other))
|
|
4757
|
+
other = fromValue(other);
|
|
4758
|
+
if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
|
|
4759
|
+
return false;
|
|
4760
|
+
return this.high === other.high && this.low === other.low;
|
|
4761
|
+
};
|
|
4762
|
+
LongPrototype.eq = LongPrototype.equals;
|
|
4763
|
+
LongPrototype.notEquals = function notEquals(other) {
|
|
4764
|
+
return !this.eq(other);
|
|
4765
|
+
};
|
|
4766
|
+
LongPrototype.neq = LongPrototype.notEquals;
|
|
4767
|
+
LongPrototype.ne = LongPrototype.notEquals;
|
|
4768
|
+
LongPrototype.lessThan = function lessThan(other) {
|
|
4769
|
+
return this.comp(other) < 0;
|
|
4770
|
+
};
|
|
4771
|
+
LongPrototype.lt = LongPrototype.lessThan;
|
|
4772
|
+
LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
|
|
4773
|
+
return this.comp(other) <= 0;
|
|
4774
|
+
};
|
|
4775
|
+
LongPrototype.lte = LongPrototype.lessThanOrEqual;
|
|
4776
|
+
LongPrototype.le = LongPrototype.lessThanOrEqual;
|
|
4777
|
+
LongPrototype.greaterThan = function greaterThan(other) {
|
|
4778
|
+
return this.comp(other) > 0;
|
|
4779
|
+
};
|
|
4780
|
+
LongPrototype.gt = LongPrototype.greaterThan;
|
|
4781
|
+
LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
|
|
4782
|
+
return this.comp(other) >= 0;
|
|
4783
|
+
};
|
|
4784
|
+
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
|
|
4785
|
+
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
|
|
4786
|
+
LongPrototype.compare = function compare(other) {
|
|
4787
|
+
if (!isLong(other))
|
|
4788
|
+
other = fromValue(other);
|
|
4789
|
+
if (this.eq(other))
|
|
4790
|
+
return 0;
|
|
4791
|
+
var thisNeg = this.isNegative(), otherNeg = other.isNegative();
|
|
4792
|
+
if (thisNeg && !otherNeg)
|
|
4793
|
+
return -1;
|
|
4794
|
+
if (!thisNeg && otherNeg)
|
|
4795
|
+
return 1;
|
|
4796
|
+
if (!this.unsigned)
|
|
4797
|
+
return this.sub(other).isNegative() ? -1 : 1;
|
|
4798
|
+
return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
|
|
4799
|
+
};
|
|
4800
|
+
LongPrototype.comp = LongPrototype.compare;
|
|
4801
|
+
LongPrototype.negate = function negate() {
|
|
4802
|
+
if (!this.unsigned && this.eq(MIN_VALUE))
|
|
4803
|
+
return MIN_VALUE;
|
|
4804
|
+
return this.not().add(ONE);
|
|
4805
|
+
};
|
|
4806
|
+
LongPrototype.neg = LongPrototype.negate;
|
|
4807
|
+
LongPrototype.add = function add(addend) {
|
|
4808
|
+
if (!isLong(addend))
|
|
4809
|
+
addend = fromValue(addend);
|
|
4810
|
+
var a48 = this.high >>> 16;
|
|
4811
|
+
var a32 = this.high & 65535;
|
|
4812
|
+
var a16 = this.low >>> 16;
|
|
4813
|
+
var a00 = this.low & 65535;
|
|
4814
|
+
var b48 = addend.high >>> 16;
|
|
4815
|
+
var b32 = addend.high & 65535;
|
|
4816
|
+
var b16 = addend.low >>> 16;
|
|
4817
|
+
var b00 = addend.low & 65535;
|
|
4818
|
+
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
4819
|
+
c00 += a00 + b00;
|
|
4820
|
+
c16 += c00 >>> 16;
|
|
4821
|
+
c00 &= 65535;
|
|
4822
|
+
c16 += a16 + b16;
|
|
4823
|
+
c32 += c16 >>> 16;
|
|
4824
|
+
c16 &= 65535;
|
|
4825
|
+
c32 += a32 + b32;
|
|
4826
|
+
c48 += c32 >>> 16;
|
|
4827
|
+
c32 &= 65535;
|
|
4828
|
+
c48 += a48 + b48;
|
|
4829
|
+
c48 &= 65535;
|
|
4830
|
+
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
4831
|
+
};
|
|
4832
|
+
LongPrototype.subtract = function subtract(subtrahend) {
|
|
4833
|
+
if (!isLong(subtrahend))
|
|
4834
|
+
subtrahend = fromValue(subtrahend);
|
|
4835
|
+
return this.add(subtrahend.neg());
|
|
4836
|
+
};
|
|
4837
|
+
LongPrototype.sub = LongPrototype.subtract;
|
|
4838
|
+
LongPrototype.multiply = function multiply(multiplier) {
|
|
4839
|
+
if (this.isZero())
|
|
4840
|
+
return this;
|
|
4841
|
+
if (!isLong(multiplier))
|
|
4842
|
+
multiplier = fromValue(multiplier);
|
|
4843
|
+
if (wasm) {
|
|
4844
|
+
var low = wasm["mul"](
|
|
4845
|
+
this.low,
|
|
4846
|
+
this.high,
|
|
4847
|
+
multiplier.low,
|
|
4848
|
+
multiplier.high
|
|
4849
|
+
);
|
|
4850
|
+
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
4851
|
+
}
|
|
4852
|
+
if (multiplier.isZero())
|
|
4853
|
+
return this.unsigned ? UZERO : ZERO;
|
|
4854
|
+
if (this.eq(MIN_VALUE))
|
|
4855
|
+
return multiplier.isOdd() ? MIN_VALUE : ZERO;
|
|
4856
|
+
if (multiplier.eq(MIN_VALUE))
|
|
4857
|
+
return this.isOdd() ? MIN_VALUE : ZERO;
|
|
4858
|
+
if (this.isNegative()) {
|
|
4859
|
+
if (multiplier.isNegative())
|
|
4860
|
+
return this.neg().mul(multiplier.neg());
|
|
4861
|
+
else
|
|
4862
|
+
return this.neg().mul(multiplier).neg();
|
|
4863
|
+
} else if (multiplier.isNegative())
|
|
4864
|
+
return this.mul(multiplier.neg()).neg();
|
|
4865
|
+
if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
|
|
4866
|
+
return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
|
4867
|
+
var a48 = this.high >>> 16;
|
|
4868
|
+
var a32 = this.high & 65535;
|
|
4869
|
+
var a16 = this.low >>> 16;
|
|
4870
|
+
var a00 = this.low & 65535;
|
|
4871
|
+
var b48 = multiplier.high >>> 16;
|
|
4872
|
+
var b32 = multiplier.high & 65535;
|
|
4873
|
+
var b16 = multiplier.low >>> 16;
|
|
4874
|
+
var b00 = multiplier.low & 65535;
|
|
4875
|
+
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
4876
|
+
c00 += a00 * b00;
|
|
4877
|
+
c16 += c00 >>> 16;
|
|
4878
|
+
c00 &= 65535;
|
|
4879
|
+
c16 += a16 * b00;
|
|
4880
|
+
c32 += c16 >>> 16;
|
|
4881
|
+
c16 &= 65535;
|
|
4882
|
+
c16 += a00 * b16;
|
|
4883
|
+
c32 += c16 >>> 16;
|
|
4884
|
+
c16 &= 65535;
|
|
4885
|
+
c32 += a32 * b00;
|
|
4886
|
+
c48 += c32 >>> 16;
|
|
4887
|
+
c32 &= 65535;
|
|
4888
|
+
c32 += a16 * b16;
|
|
4889
|
+
c48 += c32 >>> 16;
|
|
4890
|
+
c32 &= 65535;
|
|
4891
|
+
c32 += a00 * b32;
|
|
4892
|
+
c48 += c32 >>> 16;
|
|
4893
|
+
c32 &= 65535;
|
|
4894
|
+
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
|
4895
|
+
c48 &= 65535;
|
|
4896
|
+
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
4897
|
+
};
|
|
4898
|
+
LongPrototype.mul = LongPrototype.multiply;
|
|
4899
|
+
LongPrototype.divide = function divide(divisor) {
|
|
4900
|
+
if (!isLong(divisor))
|
|
4901
|
+
divisor = fromValue(divisor);
|
|
4902
|
+
if (divisor.isZero())
|
|
4903
|
+
throw Error("division by zero");
|
|
4904
|
+
if (wasm) {
|
|
4905
|
+
if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
|
|
4906
|
+
return this;
|
|
4907
|
+
}
|
|
4908
|
+
var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(
|
|
4909
|
+
this.low,
|
|
4910
|
+
this.high,
|
|
4911
|
+
divisor.low,
|
|
4912
|
+
divisor.high
|
|
4913
|
+
);
|
|
4914
|
+
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
4915
|
+
}
|
|
4916
|
+
if (this.isZero())
|
|
4917
|
+
return this.unsigned ? UZERO : ZERO;
|
|
4918
|
+
var approx, rem, res;
|
|
4919
|
+
if (!this.unsigned) {
|
|
4920
|
+
if (this.eq(MIN_VALUE)) {
|
|
4921
|
+
if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
|
|
4922
|
+
return MIN_VALUE;
|
|
4923
|
+
else if (divisor.eq(MIN_VALUE))
|
|
4924
|
+
return ONE;
|
|
4925
|
+
else {
|
|
4926
|
+
var halfThis = this.shr(1);
|
|
4927
|
+
approx = halfThis.div(divisor).shl(1);
|
|
4928
|
+
if (approx.eq(ZERO)) {
|
|
4929
|
+
return divisor.isNegative() ? ONE : NEG_ONE;
|
|
4930
|
+
} else {
|
|
4931
|
+
rem = this.sub(divisor.mul(approx));
|
|
4932
|
+
res = approx.add(rem.div(divisor));
|
|
4933
|
+
return res;
|
|
4934
|
+
}
|
|
4935
|
+
}
|
|
4936
|
+
} else if (divisor.eq(MIN_VALUE))
|
|
4937
|
+
return this.unsigned ? UZERO : ZERO;
|
|
4938
|
+
if (this.isNegative()) {
|
|
4939
|
+
if (divisor.isNegative())
|
|
4940
|
+
return this.neg().div(divisor.neg());
|
|
4941
|
+
return this.neg().div(divisor).neg();
|
|
4942
|
+
} else if (divisor.isNegative())
|
|
4943
|
+
return this.div(divisor.neg()).neg();
|
|
4944
|
+
res = ZERO;
|
|
4945
|
+
} else {
|
|
4946
|
+
if (!divisor.unsigned)
|
|
4947
|
+
divisor = divisor.toUnsigned();
|
|
4948
|
+
if (divisor.gt(this))
|
|
4949
|
+
return UZERO;
|
|
4950
|
+
if (divisor.gt(this.shru(1)))
|
|
4951
|
+
return UONE;
|
|
4952
|
+
res = UZERO;
|
|
4953
|
+
}
|
|
4954
|
+
rem = this;
|
|
4955
|
+
while (rem.gte(divisor)) {
|
|
4956
|
+
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
|
|
4957
|
+
var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48), approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor);
|
|
4958
|
+
while (approxRem.isNegative() || approxRem.gt(rem)) {
|
|
4959
|
+
approx -= delta;
|
|
4960
|
+
approxRes = fromNumber(approx, this.unsigned);
|
|
4961
|
+
approxRem = approxRes.mul(divisor);
|
|
4962
|
+
}
|
|
4963
|
+
if (approxRes.isZero())
|
|
4964
|
+
approxRes = ONE;
|
|
4965
|
+
res = res.add(approxRes);
|
|
4966
|
+
rem = rem.sub(approxRem);
|
|
4967
|
+
}
|
|
4968
|
+
return res;
|
|
4969
|
+
};
|
|
4970
|
+
LongPrototype.div = LongPrototype.divide;
|
|
4971
|
+
LongPrototype.modulo = function modulo(divisor) {
|
|
4972
|
+
if (!isLong(divisor))
|
|
4973
|
+
divisor = fromValue(divisor);
|
|
4974
|
+
if (wasm) {
|
|
4975
|
+
var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
|
|
4976
|
+
this.low,
|
|
4977
|
+
this.high,
|
|
4978
|
+
divisor.low,
|
|
4979
|
+
divisor.high
|
|
4980
|
+
);
|
|
4981
|
+
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
4982
|
+
}
|
|
4983
|
+
return this.sub(this.div(divisor).mul(divisor));
|
|
4984
|
+
};
|
|
4985
|
+
LongPrototype.mod = LongPrototype.modulo;
|
|
4986
|
+
LongPrototype.rem = LongPrototype.modulo;
|
|
4987
|
+
LongPrototype.not = function not() {
|
|
4988
|
+
return fromBits(~this.low, ~this.high, this.unsigned);
|
|
4989
|
+
};
|
|
4990
|
+
LongPrototype.countLeadingZeros = function countLeadingZeros() {
|
|
4991
|
+
return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
|
|
4992
|
+
};
|
|
4993
|
+
LongPrototype.clz = LongPrototype.countLeadingZeros;
|
|
4994
|
+
LongPrototype.countTrailingZeros = function countTrailingZeros() {
|
|
4995
|
+
return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
|
|
4996
|
+
};
|
|
4997
|
+
LongPrototype.ctz = LongPrototype.countTrailingZeros;
|
|
4998
|
+
LongPrototype.and = function and(other) {
|
|
4999
|
+
if (!isLong(other))
|
|
5000
|
+
other = fromValue(other);
|
|
5001
|
+
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
|
5002
|
+
};
|
|
5003
|
+
LongPrototype.or = function or(other) {
|
|
5004
|
+
if (!isLong(other))
|
|
5005
|
+
other = fromValue(other);
|
|
5006
|
+
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
|
5007
|
+
};
|
|
5008
|
+
LongPrototype.xor = function xor(other) {
|
|
5009
|
+
if (!isLong(other))
|
|
5010
|
+
other = fromValue(other);
|
|
5011
|
+
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
|
5012
|
+
};
|
|
5013
|
+
LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
5014
|
+
if (isLong(numBits))
|
|
5015
|
+
numBits = numBits.toInt();
|
|
5016
|
+
if ((numBits &= 63) === 0)
|
|
5017
|
+
return this;
|
|
5018
|
+
else if (numBits < 32)
|
|
5019
|
+
return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);
|
|
5020
|
+
else
|
|
5021
|
+
return fromBits(0, this.low << numBits - 32, this.unsigned);
|
|
5022
|
+
};
|
|
5023
|
+
LongPrototype.shl = LongPrototype.shiftLeft;
|
|
5024
|
+
LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
5025
|
+
if (isLong(numBits))
|
|
5026
|
+
numBits = numBits.toInt();
|
|
5027
|
+
if ((numBits &= 63) === 0)
|
|
5028
|
+
return this;
|
|
5029
|
+
else if (numBits < 32)
|
|
5030
|
+
return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);
|
|
5031
|
+
else
|
|
5032
|
+
return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
|
|
5033
|
+
};
|
|
5034
|
+
LongPrototype.shr = LongPrototype.shiftRight;
|
|
5035
|
+
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
5036
|
+
if (isLong(numBits))
|
|
5037
|
+
numBits = numBits.toInt();
|
|
5038
|
+
if ((numBits &= 63) === 0)
|
|
5039
|
+
return this;
|
|
5040
|
+
if (numBits < 32)
|
|
5041
|
+
return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
|
|
5042
|
+
if (numBits === 32)
|
|
5043
|
+
return fromBits(this.high, 0, this.unsigned);
|
|
5044
|
+
return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
|
|
5045
|
+
};
|
|
5046
|
+
LongPrototype.shru = LongPrototype.shiftRightUnsigned;
|
|
5047
|
+
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
|
|
5048
|
+
LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
5049
|
+
var b;
|
|
5050
|
+
if (isLong(numBits))
|
|
5051
|
+
numBits = numBits.toInt();
|
|
5052
|
+
if ((numBits &= 63) === 0)
|
|
5053
|
+
return this;
|
|
5054
|
+
if (numBits === 32)
|
|
5055
|
+
return fromBits(this.high, this.low, this.unsigned);
|
|
5056
|
+
if (numBits < 32) {
|
|
5057
|
+
b = 32 - numBits;
|
|
5058
|
+
return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
|
|
5059
|
+
}
|
|
5060
|
+
numBits -= 32;
|
|
5061
|
+
b = 32 - numBits;
|
|
5062
|
+
return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
|
|
5063
|
+
};
|
|
5064
|
+
LongPrototype.rotl = LongPrototype.rotateLeft;
|
|
5065
|
+
LongPrototype.rotateRight = function rotateRight(numBits) {
|
|
5066
|
+
var b;
|
|
5067
|
+
if (isLong(numBits))
|
|
5068
|
+
numBits = numBits.toInt();
|
|
5069
|
+
if ((numBits &= 63) === 0)
|
|
5070
|
+
return this;
|
|
5071
|
+
if (numBits === 32)
|
|
5072
|
+
return fromBits(this.high, this.low, this.unsigned);
|
|
5073
|
+
if (numBits < 32) {
|
|
5074
|
+
b = 32 - numBits;
|
|
5075
|
+
return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
|
|
5076
|
+
}
|
|
5077
|
+
numBits -= 32;
|
|
5078
|
+
b = 32 - numBits;
|
|
5079
|
+
return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
|
|
5080
|
+
};
|
|
5081
|
+
LongPrototype.rotr = LongPrototype.rotateRight;
|
|
5082
|
+
LongPrototype.toSigned = function toSigned() {
|
|
5083
|
+
if (!this.unsigned)
|
|
5084
|
+
return this;
|
|
5085
|
+
return fromBits(this.low, this.high, false);
|
|
5086
|
+
};
|
|
5087
|
+
LongPrototype.toUnsigned = function toUnsigned() {
|
|
5088
|
+
if (this.unsigned)
|
|
5089
|
+
return this;
|
|
5090
|
+
return fromBits(this.low, this.high, true);
|
|
5091
|
+
};
|
|
5092
|
+
LongPrototype.toBytes = function toBytes(le) {
|
|
5093
|
+
return le ? this.toBytesLE() : this.toBytesBE();
|
|
5094
|
+
};
|
|
5095
|
+
LongPrototype.toBytesLE = function toBytesLE() {
|
|
5096
|
+
var hi = this.high, lo = this.low;
|
|
5097
|
+
return [
|
|
5098
|
+
lo & 255,
|
|
5099
|
+
lo >>> 8 & 255,
|
|
5100
|
+
lo >>> 16 & 255,
|
|
5101
|
+
lo >>> 24,
|
|
5102
|
+
hi & 255,
|
|
5103
|
+
hi >>> 8 & 255,
|
|
5104
|
+
hi >>> 16 & 255,
|
|
5105
|
+
hi >>> 24
|
|
5106
|
+
];
|
|
5107
|
+
};
|
|
5108
|
+
LongPrototype.toBytesBE = function toBytesBE() {
|
|
5109
|
+
var hi = this.high, lo = this.low;
|
|
5110
|
+
return [
|
|
5111
|
+
hi >>> 24,
|
|
5112
|
+
hi >>> 16 & 255,
|
|
5113
|
+
hi >>> 8 & 255,
|
|
5114
|
+
hi & 255,
|
|
5115
|
+
lo >>> 24,
|
|
5116
|
+
lo >>> 16 & 255,
|
|
5117
|
+
lo >>> 8 & 255,
|
|
5118
|
+
lo & 255
|
|
5119
|
+
];
|
|
5120
|
+
};
|
|
5121
|
+
Long.fromBytes = function fromBytes(bytes, unsigned, le) {
|
|
5122
|
+
return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
|
|
5123
|
+
};
|
|
5124
|
+
Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
|
|
5125
|
+
return new Long(
|
|
5126
|
+
bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24,
|
|
5127
|
+
bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24,
|
|
5128
|
+
unsigned
|
|
5129
|
+
);
|
|
5130
|
+
};
|
|
5131
|
+
Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
5132
|
+
return new Long(
|
|
5133
|
+
bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7],
|
|
5134
|
+
bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3],
|
|
5135
|
+
unsigned
|
|
5136
|
+
);
|
|
5137
|
+
};
|
|
5138
|
+
var long_default = Long;
|
|
5139
|
+
|
|
5003
5140
|
// ../services/protobuf/ts/faucet/faucet.ts
|
|
5004
|
-
var import_long = __toESM(require_long());
|
|
5005
5141
|
var import_minimal = __toESM(require_minimal2());
|
|
5006
5142
|
function createBaseLinkedTwitterPair() {
|
|
5007
5143
|
return { username: "", address: "" };
|
|
@@ -5545,8 +5681,8 @@ var globalThis = (() => {
|
|
|
5545
5681
|
}
|
|
5546
5682
|
throw "Unable to locate global object";
|
|
5547
5683
|
})();
|
|
5548
|
-
if (import_minimal.default.util.Long !==
|
|
5549
|
-
import_minimal.default.util.Long =
|
|
5684
|
+
if (import_minimal.default.util.Long !== long_default) {
|
|
5685
|
+
import_minimal.default.util.Long = long_default;
|
|
5550
5686
|
import_minimal.default.configure();
|
|
5551
5687
|
}
|
|
5552
5688
|
|
|
@@ -6022,10 +6158,11 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
|
6022
6158
|
var source_default = chalk;
|
|
6023
6159
|
|
|
6024
6160
|
// src/commands/faucet.ts
|
|
6161
|
+
var import_grpc_web_node_http_transport = __toESM(require_lib4());
|
|
6025
6162
|
var command = "faucet";
|
|
6026
6163
|
var desc = "Interact with a MUD faucet";
|
|
6027
6164
|
function createFaucetService(url) {
|
|
6028
|
-
return (0, import_nice_grpc_web.createClient)(FaucetServiceDefinition, (0, import_nice_grpc_web.createChannel)(url));
|
|
6165
|
+
return (0, import_nice_grpc_web.createClient)(FaucetServiceDefinition, (0, import_nice_grpc_web.createChannel)(url, (0, import_grpc_web_node_http_transport.NodeHttpTransport)()));
|
|
6029
6166
|
}
|
|
6030
6167
|
var builder = (yargs) => yargs.options({
|
|
6031
6168
|
dripDev: {
|
|
@@ -6044,16 +6181,16 @@ var builder = (yargs) => yargs.options({
|
|
|
6044
6181
|
required: true
|
|
6045
6182
|
}
|
|
6046
6183
|
});
|
|
6047
|
-
var handler = (argv) =>
|
|
6184
|
+
var handler = async (argv) => {
|
|
6048
6185
|
const { dripDev, faucetUrl, address } = argv;
|
|
6049
6186
|
const faucet = createFaucetService(faucetUrl);
|
|
6050
6187
|
if (dripDev) {
|
|
6051
6188
|
console.log(source_default.yellow("Dripping to", address));
|
|
6052
|
-
|
|
6189
|
+
await faucet.dripDev({ address });
|
|
6053
6190
|
console.log(source_default.yellow("Success"));
|
|
6054
6191
|
}
|
|
6055
6192
|
process.exit(0);
|
|
6056
|
-
}
|
|
6193
|
+
};
|
|
6057
6194
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6058
6195
|
0 && (module.exports = {
|
|
6059
6196
|
builder,
|
|
@@ -6062,3 +6199,22 @@ var handler = (argv) => __async(void 0, null, function* () {
|
|
|
6062
6199
|
desc,
|
|
6063
6200
|
handler
|
|
6064
6201
|
});
|
|
6202
|
+
/**
|
|
6203
|
+
* @license
|
|
6204
|
+
* Copyright 2009 The Closure Library Authors
|
|
6205
|
+
* Copyright 2020 Daniel Wirtz / The long.js Authors.
|
|
6206
|
+
*
|
|
6207
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6208
|
+
* you may not use this file except in compliance with the License.
|
|
6209
|
+
* You may obtain a copy of the License at
|
|
6210
|
+
*
|
|
6211
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6212
|
+
*
|
|
6213
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6214
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6215
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6216
|
+
* See the License for the specific language governing permissions and
|
|
6217
|
+
* limitations under the License.
|
|
6218
|
+
*
|
|
6219
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6220
|
+
*/
|