@nktkas/hyperliquid 0.19.1 → 0.20.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/CONTRIBUTING.md +4 -2
- package/README.md +36 -35
- package/esm/_dnt.polyfills.d.ts +20 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +12 -0
- package/esm/mod.d.ts +3 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -0
- package/esm/src/base.d.ts +1 -47
- package/esm/src/base.d.ts.map +1 -1
- package/esm/src/base.js +1 -8
- package/esm/src/clients/event.d.ts +6 -4
- package/esm/src/clients/event.d.ts.map +1 -1
- package/esm/src/clients/event.js +58 -77
- package/esm/src/clients/public.d.ts +26 -5
- package/esm/src/clients/public.d.ts.map +1 -1
- package/esm/src/clients/public.js +29 -41
- package/esm/src/clients/wallet.d.ts +200 -26
- package/esm/src/clients/wallet.d.ts.map +1 -1
- package/esm/src/clients/wallet.js +306 -284
- package/esm/src/signing.d.ts +80 -5
- package/esm/src/signing.d.ts.map +1 -1
- package/esm/src/signing.js +96 -7
- package/esm/src/transports/base.d.ts +49 -0
- package/esm/src/transports/base.d.ts.map +1 -0
- package/esm/src/transports/base.js +8 -0
- package/esm/src/transports/http/http_transport.d.ts +8 -5
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +15 -62
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +36 -39
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +18 -25
- package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/esm/src/transports/websocket/_reconnecting_websocket.js +80 -179
- package/{script/src/transports/websocket/_websocket_request_dispatcher.d.ts → esm/src/transports/websocket/_websocket_async_request.d.ts} +14 -18
- package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -0
- package/esm/src/transports/websocket/{_websocket_request_dispatcher.js → _websocket_async_request.js} +42 -75
- package/esm/src/transports/websocket/websocket_transport.d.ts +38 -28
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +61 -76
- package/esm/src/types/exchange/requests.d.ts +278 -66
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/info/assets.d.ts +0 -48
- package/esm/src/types/info/assets.d.ts.map +1 -1
- package/esm/src/types/info/markets.d.ts +52 -0
- package/esm/src/types/info/markets.d.ts.map +1 -0
- package/esm/src/types/info/markets.js +1 -0
- package/esm/src/types/info/orders.d.ts +1 -1
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +14 -5
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +4 -0
- package/esm/src/types/mod.d.ts.map +1 -1
- package/esm/src/types/mod.js +3 -1
- package/esm/src/types/subscriptions/requests.d.ts +2 -0
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
- package/package.json +12 -9
- package/script/_dnt.polyfills.d.ts +20 -0
- package/script/_dnt.polyfills.d.ts.map +1 -0
- package/script/_dnt.polyfills.js +23 -0
- package/script/mod.d.ts +3 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +3 -1
- package/script/src/base.d.ts +1 -47
- package/script/src/base.d.ts.map +1 -1
- package/script/src/base.js +2 -10
- package/script/src/clients/event.d.ts +6 -4
- package/script/src/clients/event.d.ts.map +1 -1
- package/script/src/clients/event.js +58 -77
- package/script/src/clients/public.d.ts +26 -5
- package/script/src/clients/public.d.ts.map +1 -1
- package/script/src/clients/public.js +29 -41
- package/script/src/clients/wallet.d.ts +200 -26
- package/script/src/clients/wallet.d.ts.map +1 -1
- package/script/src/clients/wallet.js +305 -283
- package/script/src/signing.d.ts +80 -5
- package/script/src/signing.d.ts.map +1 -1
- package/script/src/signing.js +148 -58
- package/script/src/transports/base.d.ts +49 -0
- package/script/src/transports/base.d.ts.map +1 -0
- package/script/src/transports/base.js +22 -0
- package/script/src/transports/http/http_transport.d.ts +8 -5
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +16 -63
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +36 -39
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts +18 -25
- package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
- package/script/src/transports/websocket/_reconnecting_websocket.js +81 -180
- package/{esm/src/transports/websocket/_websocket_request_dispatcher.d.ts → script/src/transports/websocket/_websocket_async_request.d.ts} +14 -18
- package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -0
- package/script/src/transports/websocket/{_websocket_request_dispatcher.js → _websocket_async_request.js} +45 -78
- package/script/src/transports/websocket/websocket_transport.d.ts +38 -28
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +63 -78
- package/script/src/types/exchange/requests.d.ts +278 -66
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/info/assets.d.ts +0 -48
- package/script/src/types/info/assets.d.ts.map +1 -1
- package/script/src/types/info/markets.d.ts +52 -0
- package/script/src/types/info/markets.d.ts.map +1 -0
- package/script/{deps/jsr.io/@noble/hashes/1.8.0/src/crypto.js → src/types/info/markets.js} +0 -2
- package/script/src/types/info/orders.d.ts +1 -1
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +14 -5
- package/script/src/types/info/requests.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +4 -0
- package/script/src/types/mod.d.ts.map +1 -1
- package/script/src/types/mod.js +25 -22
- package/script/src/types/subscriptions/requests.d.ts +2 -0
- package/script/src/types/subscriptions/requests.d.ts.map +1 -1
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts +0 -55
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts.map +0 -1
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.js +0 -66
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts +0 -2
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts.map +0 -1
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.js +0 -1
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts +0 -53
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts.map +0 -1
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.js +0 -294
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts +0 -161
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts.map +0 -1
- package/esm/deps/jsr.io/@noble/hashes/1.8.0/src/utils.js +0 -280
- package/esm/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +0 -1
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts +0 -55
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.d.ts.map +0 -1
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.js +0 -99
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts +0 -2
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.d.ts.map +0 -1
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts +0 -53
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.d.ts.map +0 -1
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.js +0 -309
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts +0 -161
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/utils.d.ts.map +0 -1
- package/script/deps/jsr.io/@noble/hashes/1.8.0/src/utils.js +0 -322
- package/script/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +0 -1
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for hex, bytes, CSPRNG.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
-
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
7
|
-
// node.js versions earlier than v19 don't declare it in global scope.
|
|
8
|
-
// For node.js, package.json#exports field mapping rewrites import
|
|
9
|
-
// from `crypto` to `cryptoNode`, which imports native module.
|
|
10
|
-
// Makes the utils un-importable in browsers without a bundler.
|
|
11
|
-
// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.
|
|
12
|
-
import { crypto } from './crypto.js';
|
|
13
|
-
/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */
|
|
14
|
-
export function isBytes(a) {
|
|
15
|
-
return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');
|
|
16
|
-
}
|
|
17
|
-
/** Asserts something is positive integer. */
|
|
18
|
-
export function anumber(n) {
|
|
19
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
|
20
|
-
throw new Error('positive integer expected, got ' + n);
|
|
21
|
-
}
|
|
22
|
-
/** Asserts something is Uint8Array. */
|
|
23
|
-
export function abytes(b, ...lengths) {
|
|
24
|
-
if (!isBytes(b))
|
|
25
|
-
throw new Error('Uint8Array expected');
|
|
26
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
27
|
-
throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);
|
|
28
|
-
}
|
|
29
|
-
/** Asserts something is hash */
|
|
30
|
-
export function ahash(h) {
|
|
31
|
-
if (typeof h !== 'function' || typeof h.create !== 'function')
|
|
32
|
-
throw new Error('Hash should be wrapped by utils.createHasher');
|
|
33
|
-
anumber(h.outputLen);
|
|
34
|
-
anumber(h.blockLen);
|
|
35
|
-
}
|
|
36
|
-
/** Asserts a hash instance has not been destroyed / finished */
|
|
37
|
-
export function aexists(instance, checkFinished = true) {
|
|
38
|
-
if (instance.destroyed)
|
|
39
|
-
throw new Error('Hash instance has been destroyed');
|
|
40
|
-
if (checkFinished && instance.finished)
|
|
41
|
-
throw new Error('Hash#digest() has already been called');
|
|
42
|
-
}
|
|
43
|
-
/** Asserts output is properly-sized byte array */
|
|
44
|
-
export function aoutput(out, instance) {
|
|
45
|
-
abytes(out);
|
|
46
|
-
const min = instance.outputLen;
|
|
47
|
-
if (out.length < min) {
|
|
48
|
-
throw new Error('digestInto() expects output buffer of length at least ' + min);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/** Cast u8 / u16 / u32 to u8. */
|
|
52
|
-
export function u8(arr) {
|
|
53
|
-
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
54
|
-
}
|
|
55
|
-
/** Cast u8 / u16 / u32 to u32. */
|
|
56
|
-
export function u32(arr) {
|
|
57
|
-
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
58
|
-
}
|
|
59
|
-
/** Zeroize a byte array. Warning: JS provides no guarantees. */
|
|
60
|
-
export function clean(...arrays) {
|
|
61
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
62
|
-
arrays[i].fill(0);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/** Create DataView of an array for easy byte-level manipulation. */
|
|
66
|
-
export function createView(arr) {
|
|
67
|
-
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
68
|
-
}
|
|
69
|
-
/** The rotate right (circular right shift) operation for uint32 */
|
|
70
|
-
export function rotr(word, shift) {
|
|
71
|
-
return (word << (32 - shift)) | (word >>> shift);
|
|
72
|
-
}
|
|
73
|
-
/** The rotate left (circular left shift) operation for uint32 */
|
|
74
|
-
export function rotl(word, shift) {
|
|
75
|
-
return (word << shift) | ((word >>> (32 - shift)) >>> 0);
|
|
76
|
-
}
|
|
77
|
-
/** Is current platform little-endian? Most are. Big-Endian platform: IBM */
|
|
78
|
-
export const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();
|
|
79
|
-
/** The byte swap operation for uint32 */
|
|
80
|
-
export function byteSwap(word) {
|
|
81
|
-
return (((word << 24) & 0xff000000) |
|
|
82
|
-
((word << 8) & 0xff0000) |
|
|
83
|
-
((word >>> 8) & 0xff00) |
|
|
84
|
-
((word >>> 24) & 0xff));
|
|
85
|
-
}
|
|
86
|
-
/** Conditionally byte swap if on a big-endian platform */
|
|
87
|
-
export const swap8IfBE = isLE
|
|
88
|
-
? (n) => n
|
|
89
|
-
: (n) => byteSwap(n);
|
|
90
|
-
/** @deprecated */
|
|
91
|
-
export const byteSwapIfBE = swap8IfBE;
|
|
92
|
-
/** In place byte swap for Uint32Array */
|
|
93
|
-
export function byteSwap32(arr) {
|
|
94
|
-
for (let i = 0; i < arr.length; i++) {
|
|
95
|
-
arr[i] = byteSwap(arr[i]);
|
|
96
|
-
}
|
|
97
|
-
return arr;
|
|
98
|
-
}
|
|
99
|
-
export const swap32IfBE = isLE
|
|
100
|
-
? (u) => u
|
|
101
|
-
: byteSwap32;
|
|
102
|
-
// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex
|
|
103
|
-
const hasHexBuiltin = /* @__PURE__ */ (() =>
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();
|
|
106
|
-
// Array where index 0xf0 (240) is mapped to string 'f0'
|
|
107
|
-
const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
|
|
108
|
-
/**
|
|
109
|
-
* Convert byte array to hex string. Uses built-in function, when available.
|
|
110
|
-
* @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'
|
|
111
|
-
*/
|
|
112
|
-
export function bytesToHex(bytes) {
|
|
113
|
-
abytes(bytes);
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
if (hasHexBuiltin)
|
|
116
|
-
return bytes.toHex();
|
|
117
|
-
// pre-caching improves the speed 6x
|
|
118
|
-
let hex = '';
|
|
119
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
120
|
-
hex += hexes[bytes[i]];
|
|
121
|
-
}
|
|
122
|
-
return hex;
|
|
123
|
-
}
|
|
124
|
-
// We use optimized technique to convert hex string to byte array
|
|
125
|
-
const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
126
|
-
function asciiToBase16(ch) {
|
|
127
|
-
if (ch >= asciis._0 && ch <= asciis._9)
|
|
128
|
-
return ch - asciis._0; // '2' => 50-48
|
|
129
|
-
if (ch >= asciis.A && ch <= asciis.F)
|
|
130
|
-
return ch - (asciis.A - 10); // 'B' => 66-(65-10)
|
|
131
|
-
if (ch >= asciis.a && ch <= asciis.f)
|
|
132
|
-
return ch - (asciis.a - 10); // 'b' => 98-(97-10)
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Convert hex string to byte array. Uses built-in function, when available.
|
|
137
|
-
* @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])
|
|
138
|
-
*/
|
|
139
|
-
export function hexToBytes(hex) {
|
|
140
|
-
if (typeof hex !== 'string')
|
|
141
|
-
throw new Error('hex string expected, got ' + typeof hex);
|
|
142
|
-
// @ts-ignore
|
|
143
|
-
if (hasHexBuiltin)
|
|
144
|
-
return Uint8Array.fromHex(hex);
|
|
145
|
-
const hl = hex.length;
|
|
146
|
-
const al = hl / 2;
|
|
147
|
-
if (hl % 2)
|
|
148
|
-
throw new Error('hex string expected, got unpadded hex of length ' + hl);
|
|
149
|
-
const array = new Uint8Array(al);
|
|
150
|
-
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
|
151
|
-
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
|
152
|
-
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
|
153
|
-
if (n1 === undefined || n2 === undefined) {
|
|
154
|
-
const char = hex[hi] + hex[hi + 1];
|
|
155
|
-
throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
|
|
156
|
-
}
|
|
157
|
-
array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163
|
|
158
|
-
}
|
|
159
|
-
return array;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* There is no setImmediate in browser and setTimeout is slow.
|
|
163
|
-
* Call of async fn will return Promise, which will be fullfiled only on
|
|
164
|
-
* next scheduler queue processing step and this is exactly what we need.
|
|
165
|
-
*/
|
|
166
|
-
export const nextTick = async () => { };
|
|
167
|
-
/** Returns control to thread each 'tick' ms to avoid blocking. */
|
|
168
|
-
export async function asyncLoop(iters, tick, cb) {
|
|
169
|
-
let ts = Date.now();
|
|
170
|
-
for (let i = 0; i < iters; i++) {
|
|
171
|
-
cb(i);
|
|
172
|
-
// Date.now() is not monotonic, so in case if clock goes backwards we return return control too
|
|
173
|
-
const diff = Date.now() - ts;
|
|
174
|
-
if (diff >= 0 && diff < tick)
|
|
175
|
-
continue;
|
|
176
|
-
await nextTick();
|
|
177
|
-
ts += diff;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Converts string to bytes using UTF8 encoding.
|
|
182
|
-
* @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])
|
|
183
|
-
*/
|
|
184
|
-
export function utf8ToBytes(str) {
|
|
185
|
-
if (typeof str !== 'string')
|
|
186
|
-
throw new Error('string expected');
|
|
187
|
-
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Converts bytes to string using UTF8 encoding.
|
|
191
|
-
* @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'
|
|
192
|
-
*/
|
|
193
|
-
export function bytesToUtf8(bytes) {
|
|
194
|
-
return new TextDecoder().decode(bytes);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
198
|
-
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
199
|
-
* Keep in mind for future mutable operations.
|
|
200
|
-
*/
|
|
201
|
-
export function toBytes(data) {
|
|
202
|
-
if (typeof data === 'string')
|
|
203
|
-
data = utf8ToBytes(data);
|
|
204
|
-
abytes(data);
|
|
205
|
-
return data;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Helper for KDFs: consumes uint8array or string.
|
|
209
|
-
* When string is passed, does utf8 decoding, using TextDecoder.
|
|
210
|
-
*/
|
|
211
|
-
export function kdfInputToBytes(data) {
|
|
212
|
-
if (typeof data === 'string')
|
|
213
|
-
data = utf8ToBytes(data);
|
|
214
|
-
abytes(data);
|
|
215
|
-
return data;
|
|
216
|
-
}
|
|
217
|
-
/** Copies several Uint8Arrays into one. */
|
|
218
|
-
export function concatBytes(...arrays) {
|
|
219
|
-
let sum = 0;
|
|
220
|
-
for (let i = 0; i < arrays.length; i++) {
|
|
221
|
-
const a = arrays[i];
|
|
222
|
-
abytes(a);
|
|
223
|
-
sum += a.length;
|
|
224
|
-
}
|
|
225
|
-
const res = new Uint8Array(sum);
|
|
226
|
-
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
227
|
-
const a = arrays[i];
|
|
228
|
-
res.set(a, pad);
|
|
229
|
-
pad += a.length;
|
|
230
|
-
}
|
|
231
|
-
return res;
|
|
232
|
-
}
|
|
233
|
-
export function checkOpts(defaults, opts) {
|
|
234
|
-
if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')
|
|
235
|
-
throw new Error('options should be object or undefined');
|
|
236
|
-
const merged = Object.assign(defaults, opts);
|
|
237
|
-
return merged;
|
|
238
|
-
}
|
|
239
|
-
/** For runtime check if class implements interface */
|
|
240
|
-
export class Hash {
|
|
241
|
-
}
|
|
242
|
-
/** Wraps hash function, creating an interface on top of it */
|
|
243
|
-
export function createHasher(hashCons) {
|
|
244
|
-
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
245
|
-
const tmp = hashCons();
|
|
246
|
-
hashC.outputLen = tmp.outputLen;
|
|
247
|
-
hashC.blockLen = tmp.blockLen;
|
|
248
|
-
hashC.create = () => hashCons();
|
|
249
|
-
return hashC;
|
|
250
|
-
}
|
|
251
|
-
export function createOptHasher(hashCons) {
|
|
252
|
-
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
253
|
-
const tmp = hashCons({});
|
|
254
|
-
hashC.outputLen = tmp.outputLen;
|
|
255
|
-
hashC.blockLen = tmp.blockLen;
|
|
256
|
-
hashC.create = (opts) => hashCons(opts);
|
|
257
|
-
return hashC;
|
|
258
|
-
}
|
|
259
|
-
export function createXOFer(hashCons) {
|
|
260
|
-
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
261
|
-
const tmp = hashCons({});
|
|
262
|
-
hashC.outputLen = tmp.outputLen;
|
|
263
|
-
hashC.blockLen = tmp.blockLen;
|
|
264
|
-
hashC.create = (opts) => hashCons(opts);
|
|
265
|
-
return hashC;
|
|
266
|
-
}
|
|
267
|
-
export const wrapConstructor = createHasher;
|
|
268
|
-
export const wrapConstructorWithOpts = createOptHasher;
|
|
269
|
-
export const wrapXOFConstructorWithOpts = createXOFer;
|
|
270
|
-
/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */
|
|
271
|
-
export function randomBytes(bytesLength = 32) {
|
|
272
|
-
if (crypto && typeof crypto.getRandomValues === 'function') {
|
|
273
|
-
return crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
274
|
-
}
|
|
275
|
-
// Legacy Node.js compatibility
|
|
276
|
-
if (crypto && typeof crypto.randomBytes === 'function') {
|
|
277
|
-
return Uint8Array.from(crypto.randomBytes(bytesLength));
|
|
278
|
-
}
|
|
279
|
-
throw new Error('crypto.getRandomValues must be defined');
|
|
280
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_websocket_request_dispatcher.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/_websocket_request_dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAY7E;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;gBACzC,OAAO,EAAE,MAAM;CAI9B;AAED;;;GAGG;AACH,qBAAa,0BAA0B;IAkBvB,OAAO,CAAC,MAAM;IAjB1B,gCAAgC;IAChC,OAAO,CAAC,MAAM,CAAa;IAE3B,oDAAoD;IACpD,OAAO,CAAC,OAAO,CAMD;IAEd;;;;OAIG;gBACiB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,sBAAsB;IAwDvE;;;;;;OAMG;IACG,OAAO,CACT,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,aAAa,EAC5C,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,OAAO,CAAC;IAoCnB;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAK7C"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
declare function fromBig(n: bigint, le?: boolean): {
|
|
2
|
-
h: number;
|
|
3
|
-
l: number;
|
|
4
|
-
};
|
|
5
|
-
declare function split(lst: bigint[], le?: boolean): Uint32Array[];
|
|
6
|
-
declare const toBig: (h: number, l: number) => bigint;
|
|
7
|
-
declare const shrSH: (h: number, _l: number, s: number) => number;
|
|
8
|
-
declare const shrSL: (h: number, l: number, s: number) => number;
|
|
9
|
-
declare const rotrSH: (h: number, l: number, s: number) => number;
|
|
10
|
-
declare const rotrSL: (h: number, l: number, s: number) => number;
|
|
11
|
-
declare const rotrBH: (h: number, l: number, s: number) => number;
|
|
12
|
-
declare const rotrBL: (h: number, l: number, s: number) => number;
|
|
13
|
-
declare const rotr32H: (_h: number, l: number) => number;
|
|
14
|
-
declare const rotr32L: (h: number, _l: number) => number;
|
|
15
|
-
declare const rotlSH: (h: number, l: number, s: number) => number;
|
|
16
|
-
declare const rotlSL: (h: number, l: number, s: number) => number;
|
|
17
|
-
declare const rotlBH: (h: number, l: number, s: number) => number;
|
|
18
|
-
declare const rotlBL: (h: number, l: number, s: number) => number;
|
|
19
|
-
declare function add(Ah: number, Al: number, Bh: number, Bl: number): {
|
|
20
|
-
h: number;
|
|
21
|
-
l: number;
|
|
22
|
-
};
|
|
23
|
-
declare const add3L: (Al: number, Bl: number, Cl: number) => number;
|
|
24
|
-
declare const add3H: (low: number, Ah: number, Bh: number, Ch: number) => number;
|
|
25
|
-
declare const add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number;
|
|
26
|
-
declare const add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number;
|
|
27
|
-
declare const add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number;
|
|
28
|
-
declare const add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number;
|
|
29
|
-
export { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };
|
|
30
|
-
declare const u64: {
|
|
31
|
-
fromBig: typeof fromBig;
|
|
32
|
-
split: typeof split;
|
|
33
|
-
toBig: (h: number, l: number) => bigint;
|
|
34
|
-
shrSH: (h: number, _l: number, s: number) => number;
|
|
35
|
-
shrSL: (h: number, l: number, s: number) => number;
|
|
36
|
-
rotrSH: (h: number, l: number, s: number) => number;
|
|
37
|
-
rotrSL: (h: number, l: number, s: number) => number;
|
|
38
|
-
rotrBH: (h: number, l: number, s: number) => number;
|
|
39
|
-
rotrBL: (h: number, l: number, s: number) => number;
|
|
40
|
-
rotr32H: (_h: number, l: number) => number;
|
|
41
|
-
rotr32L: (h: number, _l: number) => number;
|
|
42
|
-
rotlSH: (h: number, l: number, s: number) => number;
|
|
43
|
-
rotlSL: (h: number, l: number, s: number) => number;
|
|
44
|
-
rotlBH: (h: number, l: number, s: number) => number;
|
|
45
|
-
rotlBL: (h: number, l: number, s: number) => number;
|
|
46
|
-
add: typeof add;
|
|
47
|
-
add3L: (Al: number, Bl: number, Cl: number) => number;
|
|
48
|
-
add3H: (low: number, Ah: number, Bh: number, Ch: number) => number;
|
|
49
|
-
add4L: (Al: number, Bl: number, Cl: number, Dl: number) => number;
|
|
50
|
-
add4H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number) => number;
|
|
51
|
-
add5H: (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) => number;
|
|
52
|
-
add5L: (Al: number, Bl: number, Cl: number, Dl: number, El: number) => number;
|
|
53
|
-
};
|
|
54
|
-
export default u64;
|
|
55
|
-
//# sourceMappingURL=_u64.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_u64.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@noble/hashes/1.8.0/src/_u64.ts"],"names":[],"mappings":"AAQA,iBAAS,OAAO,CACd,CAAC,EAAE,MAAM,EACT,EAAE,UAAQ,GACT;IACD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAGA;AAED,iBAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,UAAQ,GAAG,WAAW,EAAE,CASvD;AAED,QAAA,MAAM,KAAK,MAAO,MAAM,KAAK,MAAM,KAAG,MAAqD,CAAC;AAE5F,QAAA,MAAM,KAAK,MAAO,MAAM,MAAM,MAAM,KAAK,MAAM,KAAG,MAAiB,CAAC;AACpE,QAAA,MAAM,KA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AE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAOrpC,CAAC;AACF,eAAe,GAAG,CAAC"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
-
var v = factory(require, exports);
|
|
4
|
-
if (v !== undefined) module.exports = v;
|
|
5
|
-
}
|
|
6
|
-
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
|
|
13
|
-
exports.add = add;
|
|
14
|
-
exports.fromBig = fromBig;
|
|
15
|
-
exports.split = split;
|
|
16
|
-
/**
|
|
17
|
-
* Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
|
|
18
|
-
* @todo re-check https://issues.chromium.org/issues/42212588
|
|
19
|
-
* @module
|
|
20
|
-
*/
|
|
21
|
-
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
22
|
-
const _32n = /* @__PURE__ */ BigInt(32);
|
|
23
|
-
function fromBig(n, le = false) {
|
|
24
|
-
if (le)
|
|
25
|
-
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
26
|
-
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
27
|
-
}
|
|
28
|
-
function split(lst, le = false) {
|
|
29
|
-
const len = lst.length;
|
|
30
|
-
let Ah = new Uint32Array(len);
|
|
31
|
-
let Al = new Uint32Array(len);
|
|
32
|
-
for (let i = 0; i < len; i++) {
|
|
33
|
-
const { h, l } = fromBig(lst[i], le);
|
|
34
|
-
[Ah[i], Al[i]] = [h, l];
|
|
35
|
-
}
|
|
36
|
-
return [Ah, Al];
|
|
37
|
-
}
|
|
38
|
-
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
|
|
39
|
-
exports.toBig = toBig;
|
|
40
|
-
// for Shift in [0, 32)
|
|
41
|
-
const shrSH = (h, _l, s) => h >>> s;
|
|
42
|
-
exports.shrSH = shrSH;
|
|
43
|
-
const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
|
44
|
-
exports.shrSL = shrSL;
|
|
45
|
-
// Right rotate for Shift in [1, 32)
|
|
46
|
-
const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
|
|
47
|
-
exports.rotrSH = rotrSH;
|
|
48
|
-
const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
|
|
49
|
-
exports.rotrSL = rotrSL;
|
|
50
|
-
// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
51
|
-
const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
|
|
52
|
-
exports.rotrBH = rotrBH;
|
|
53
|
-
const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
|
|
54
|
-
exports.rotrBL = rotrBL;
|
|
55
|
-
// Right rotate for shift===32 (just swaps l&h)
|
|
56
|
-
const rotr32H = (_h, l) => l;
|
|
57
|
-
exports.rotr32H = rotr32H;
|
|
58
|
-
const rotr32L = (h, _l) => h;
|
|
59
|
-
exports.rotr32L = rotr32L;
|
|
60
|
-
// Left rotate for Shift in [1, 32)
|
|
61
|
-
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
62
|
-
exports.rotlSH = rotlSH;
|
|
63
|
-
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
64
|
-
exports.rotlSL = rotlSL;
|
|
65
|
-
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
66
|
-
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
67
|
-
exports.rotlBH = rotlBH;
|
|
68
|
-
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
69
|
-
exports.rotlBL = rotlBL;
|
|
70
|
-
// JS uses 32-bit signed integers for bitwise operations which means we cannot
|
|
71
|
-
// simple take carry out of low bit sum by shift, we need to use division.
|
|
72
|
-
function add(Ah, Al, Bh, Bl) {
|
|
73
|
-
const l = (Al >>> 0) + (Bl >>> 0);
|
|
74
|
-
return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
|
|
75
|
-
}
|
|
76
|
-
// Addition with more than 2 elements
|
|
77
|
-
const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
78
|
-
exports.add3L = add3L;
|
|
79
|
-
const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
|
|
80
|
-
exports.add3H = add3H;
|
|
81
|
-
const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
82
|
-
exports.add4L = add4L;
|
|
83
|
-
const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
|
|
84
|
-
exports.add4H = add4H;
|
|
85
|
-
const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
86
|
-
exports.add5L = add5L;
|
|
87
|
-
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
|
|
88
|
-
exports.add5H = add5H;
|
|
89
|
-
// prettier-ignore
|
|
90
|
-
const u64 = {
|
|
91
|
-
fromBig, split, toBig,
|
|
92
|
-
shrSH, shrSL,
|
|
93
|
-
rotrSH, rotrSL, rotrBH, rotrBL,
|
|
94
|
-
rotr32H, rotr32L,
|
|
95
|
-
rotlSH, rotlSL, rotlBH, rotlBL,
|
|
96
|
-
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
|
97
|
-
};
|
|
98
|
-
exports.default = u64;
|
|
99
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@noble/hashes/1.8.0/src/crypto.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM,EAAE,GACqE,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Hash, type CHash, type CHashXO, type HashXOF, type Input } from './utils.js';
|
|
2
|
-
/** `keccakf1600` internal function, additionally allows to adjust round count. */
|
|
3
|
-
export declare function keccakP(s: Uint32Array, rounds?: number): void;
|
|
4
|
-
/** Keccak sponge function. */
|
|
5
|
-
export declare class Keccak extends Hash<Keccak> implements HashXOF<Keccak> {
|
|
6
|
-
protected state: Uint8Array;
|
|
7
|
-
protected pos: number;
|
|
8
|
-
protected posOut: number;
|
|
9
|
-
protected finished: boolean;
|
|
10
|
-
protected state32: Uint32Array;
|
|
11
|
-
protected destroyed: boolean;
|
|
12
|
-
blockLen: number;
|
|
13
|
-
suffix: number;
|
|
14
|
-
outputLen: number;
|
|
15
|
-
protected enableXOF: boolean;
|
|
16
|
-
protected rounds: number;
|
|
17
|
-
constructor(blockLen: number, suffix: number, outputLen: number, enableXOF?: boolean, rounds?: number);
|
|
18
|
-
clone(): Keccak;
|
|
19
|
-
protected keccak(): void;
|
|
20
|
-
update(data: Input): this;
|
|
21
|
-
protected finish(): void;
|
|
22
|
-
protected writeInto(out: Uint8Array): Uint8Array;
|
|
23
|
-
xofInto(out: Uint8Array): Uint8Array;
|
|
24
|
-
xof(bytes: number): Uint8Array;
|
|
25
|
-
digestInto(out: Uint8Array): Uint8Array;
|
|
26
|
-
digest(): Uint8Array;
|
|
27
|
-
destroy(): void;
|
|
28
|
-
_cloneInto(to?: Keccak): Keccak;
|
|
29
|
-
}
|
|
30
|
-
/** SHA3-224 hash function. */
|
|
31
|
-
export declare const sha3_224: CHash;
|
|
32
|
-
/** SHA3-256 hash function. Different from keccak-256. */
|
|
33
|
-
export declare const sha3_256: CHash;
|
|
34
|
-
/** SHA3-384 hash function. */
|
|
35
|
-
export declare const sha3_384: CHash;
|
|
36
|
-
/** SHA3-512 hash function. */
|
|
37
|
-
export declare const sha3_512: CHash;
|
|
38
|
-
/** keccak-224 hash function. */
|
|
39
|
-
export declare const keccak_224: CHash;
|
|
40
|
-
/** keccak-256 hash function. Different from SHA3-256. */
|
|
41
|
-
export declare const keccak_256: CHash;
|
|
42
|
-
/** keccak-384 hash function. */
|
|
43
|
-
export declare const keccak_384: CHash;
|
|
44
|
-
/** keccak-512 hash function. */
|
|
45
|
-
export declare const keccak_512: CHash;
|
|
46
|
-
export type ShakeOpts = {
|
|
47
|
-
dkLen?: number;
|
|
48
|
-
};
|
|
49
|
-
/** SHAKE128 XOF with 128-bit security. */
|
|
50
|
-
export declare const shake128: CHashXO;
|
|
51
|
-
/** SHAKE256 XOF with 256-bit security. */
|
|
52
|
-
export declare const shake256: CHashXO;
|
|
53
|
-
//# sourceMappingURL=sha3.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sha3.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@noble/hashes/1.8.0/src/sha3.ts"],"names":[],"mappings":"AAaA,OAAO,EAE6B,IAAI,EAGtC,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EACnD,MAAM,YAAY,CAAC;AAoCpB,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CAyCjE;AAED,8BAA8B;AAC9B,qBAAa,MAAO,SAAQ,IAAI,CAAC,MAAM,CAAE,YAAW,OAAO,CAAC,MAAM,CAAC;IACjE,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC;IAC5B,SAAS,CAAC,GAAG,SAAK;IAClB,SAAS,CAAC,MAAM,SAAK;IACrB,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC;IAC/B,SAAS,CAAC,SAAS,UAAS;IAErB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,SAAS,UAAS;IAC5B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAIvB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,UAAQ,EACjB,MAAM,GAAE,MAAW;IAiBrB,KAAK,IAAI,MAAM;IAGf,SAAS,CAAC,MAAM,IAAI,IAAI;IAOxB,MAAM,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI;IAazB,SAAS,CAAC,MAAM,IAAI,IAAI;IAUxB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