@orderly.network/core 0.0.7 → 0.0.9

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/index.d.mts CHANGED
@@ -8,46 +8,50 @@ interface OrderlyKeyPair {
8
8
  }
9
9
  declare class BaseOrderlyKeyPair implements OrderlyKeyPair {
10
10
  secretKey: string;
11
+ private privateKey;
12
+ static generateKey(): OrderlyKeyPair;
11
13
  constructor(secretKey: string);
12
14
  sign(message: Uint8Array): Promise<Uint8Array>;
13
15
  getPublicKey(): Promise<string>;
14
16
  }
15
17
 
16
18
  interface OrderlyKeyStore {
17
- getOrderlyKey: () => OrderlyKeyPair;
18
- getAccountId: () => string | undefined;
19
- setAccountId: (accountId: string) => void;
20
- getAddress: () => string | undefined;
19
+ getOrderlyKey: (address?: string) => OrderlyKeyPair | null;
20
+ getAccountId: (address: string) => string | undefined | null;
21
+ setAccountId: (address: string, accountId: string) => void;
22
+ getAddress: () => string | undefined | null;
21
23
  setAddress: (address: string) => void;
22
24
  generateKey: () => OrderlyKeyPair;
23
- cleanKey: (key: string) => void;
24
- cleanAllKey: () => void;
25
- setKey: (orderlyKey: string, secretKey: string) => void;
25
+ cleanKey: (address: string, key: string) => void;
26
+ cleanAllKey: (address: string) => void;
27
+ setKey: (orderlyKey: string, secretKey: OrderlyKeyPair) => void;
26
28
  }
27
29
  declare abstract class BaseKeyStore implements OrderlyKeyStore {
28
30
  private readonly networkId;
29
- constructor(networkId: string);
30
- abstract getOrderlyKey(): OrderlyKeyPair;
31
- abstract getAccountId(): string | undefined;
32
- abstract setAccountId(accountId: string): void;
33
- abstract getAddress(): string | undefined;
31
+ constructor(networkId?: string);
32
+ abstract getOrderlyKey(address?: string): OrderlyKeyPair | null;
33
+ abstract getAccountId(address: string): string | undefined | null;
34
+ abstract setAccountId(address: string, accountId: string): void;
35
+ abstract getAddress(): string | undefined | null;
34
36
  abstract setAddress(address: string): void;
35
37
  abstract generateKey(): OrderlyKeyPair;
36
- abstract setKey(orderlyKey: string, secretKey: string): void;
37
- abstract cleanAllKey(): void;
38
- abstract cleanKey(key: string): void;
38
+ abstract setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
39
+ abstract cleanAllKey(address: string): void;
40
+ abstract cleanKey(address: string, key: string): void;
39
41
  protected get keyPrefix(): string;
40
42
  }
41
43
  declare class LocalStorageStore extends BaseKeyStore {
42
- getOrderlyKey(): OrderlyKeyPair;
43
- getAccountId(): string;
44
- setAccountId(accountId: string): void;
45
- getAddress(): string;
44
+ getOrderlyKey(address?: string): OrderlyKeyPair | null;
45
+ getAccountId(address: string): string | undefined | null;
46
+ setAccountId(address: string, accountId: string): void;
47
+ getAddress(): string | undefined | null;
46
48
  setAddress(address: string): void;
47
- generateKey(): BaseOrderlyKeyPair;
48
- setKey(orderlyKey: string, secretKey: string): void;
49
- cleanAllKey(): void;
50
- cleanKey(key: string): void;
49
+ generateKey(): OrderlyKeyPair;
50
+ setKey(address: string, orderlyKey: OrderlyKeyPair): void;
51
+ cleanAllKey(address: string): void;
52
+ cleanKey(address: string, key: string): void;
53
+ private setItem;
54
+ private getItem;
51
55
  }
52
56
  declare class MockKeyStore implements OrderlyKeyStore {
53
57
  private readonly secretKey;
@@ -58,7 +62,7 @@ declare class MockKeyStore implements OrderlyKeyStore {
58
62
  setAccountId(accountId: string): void;
59
63
  getAddress(): string;
60
64
  setAddress(address: string): void;
61
- setKey(orderlyKey: string, secretKey: string): void;
65
+ setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
62
66
  cleanAllKey(): void;
63
67
  cleanKey(key: string): void;
64
68
  }
@@ -72,6 +76,7 @@ type SignedMessagePayload = {
72
76
  "orderly-key": string;
73
77
  "orderly-timestamp": string;
74
78
  "orderly-signature": string;
79
+ "orderly-account-id"?: string;
75
80
  };
76
81
  /**
77
82
  * 签名
@@ -111,13 +116,21 @@ interface ConfigStore {
111
116
  clear(): void;
112
117
  }
113
118
  declare class MemoryConfigStore implements ConfigStore {
114
- private map;
119
+ protected map: Map<string, any>;
115
120
  constructor();
116
- private _restore;
121
+ protected _restore(): void;
117
122
  get<T>(key: string): T;
118
123
  set<T>(key: string, value: T): void;
119
124
  clear(): void;
120
125
  }
126
+ /**
127
+ *
128
+ */
129
+ declare class BaseConfigStore extends MemoryConfigStore {
130
+ private readonly configMap;
131
+ constructor(configMap: Record<string, any>);
132
+ protected _restore(): void;
133
+ }
121
134
 
122
135
  declare const getMockSigner: (secretKey?: string) => BaseSigner;
123
136
  declare const getDefaultSigner: () => BaseSigner;
@@ -137,6 +150,7 @@ declare class SimpleDI {
137
150
  interface WalletAdapter {
138
151
  getBalance: (address: string) => Promise<any>;
139
152
  deposit: (from: string, to: string, amount: string) => Promise<any>;
153
+ send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
140
154
  }
141
155
 
142
156
  interface AccountState {
@@ -160,10 +174,14 @@ interface AccountState {
160
174
  declare class Account {
161
175
  private readonly configStore;
162
176
  private readonly keyStore;
163
- private readonly walletClient;
177
+ private readonly walletAdapterClass;
178
+ static instanceName: string;
164
179
  private _singer?;
165
180
  private _state$;
166
- constructor(configStore: ConfigStore, keyStore: OrderlyKeyStore, walletClient: WalletAdapter);
181
+ private walletClient?;
182
+ constructor(configStore: ConfigStore, keyStore: OrderlyKeyStore, walletAdapterClass: {
183
+ new (options: any): WalletAdapter;
184
+ });
167
185
  /**
168
186
  * 登录
169
187
  * @param address 钱包地址
@@ -173,10 +191,13 @@ declare class Account {
173
191
  /**
174
192
  * 连接钱包先用第三方的React版本,不用自己实现
175
193
  */
176
- /**
177
- * 为账户设置钱包
178
- */
179
- set address(address: string);
194
+ setAddress(address: string, wallet?: {
195
+ provider: any;
196
+ chain: {
197
+ id: string;
198
+ };
199
+ [key: string]: any;
200
+ }): Promise<AccountStatusEnum>;
180
201
  get state$(): BehaviorSubject<AccountState>;
181
202
  get stateValue(): AccountState;
182
203
  get accountId(): string | undefined;
@@ -187,10 +208,15 @@ declare class Account {
187
208
  set orders(orders: string[]);
188
209
  private _checkAccount;
189
210
  private _checkAccountExist;
211
+ createAccount(): Promise<any>;
212
+ createOrderlyKey(expiration: number): Promise<any>;
213
+ disconnect(): Promise<void>;
214
+ private _checkOrderlyKeyState;
190
215
  get signer(): Signer;
191
216
  private getAccountInfo;
192
217
  private getBalance;
193
- private _fetch;
218
+ private _getRegisterationNonce;
219
+ private _simpleFetch;
194
220
  }
195
221
 
196
222
  declare namespace API {
@@ -321,11 +347,34 @@ declare namespace WSMessage {
321
347
  }
322
348
  }
323
349
 
324
- declare class Web3WalletAdapter implements Web3WalletAdapter {
350
+ declare class Web3WalletAdapter implements WalletAdapter {
325
351
  private readonly web3;
326
352
  constructor(web3: any);
327
353
  getBalance(address: string): Promise<any>;
328
354
  deposit(from: string, to: string, amount: string): Promise<any>;
355
+ send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
356
+ }
357
+
358
+ interface EtherAdapterOptions {
359
+ provider: any;
360
+ label?: string;
361
+ chain: {
362
+ id: string;
363
+ };
364
+ }
365
+ declare class EtherAdapter implements WalletAdapter {
366
+ private provider?;
367
+ private _chainId;
368
+ constructor(options: EtherAdapterOptions);
369
+ getBalance(address: string): Promise<any>;
370
+ deposit(from: string, to: string, amount: string): Promise<any>;
371
+ get chainId(): number;
372
+ send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
373
+ verify(data: {
374
+ domain: any;
375
+ message: any;
376
+ types: any;
377
+ }, signature: string): Promise<void>;
329
378
  }
330
379
 
331
- export { API, Account, AccountState, BaseKeyStore, BaseSigner, ConfigStore, LocalStorageStore, MemoryConfigStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, WSMessage, WalletAdapter, Web3WalletAdapter, getDefaultSigner, getMockSigner };
380
+ export { API, Account, AccountState, BaseConfigStore, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, ConfigStore, EtherAdapter, LocalStorageStore, MemoryConfigStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, WSMessage, WalletAdapter, Web3WalletAdapter, getDefaultSigner, getMockSigner };
package/dist/index.d.ts CHANGED
@@ -8,46 +8,50 @@ interface OrderlyKeyPair {
8
8
  }
9
9
  declare class BaseOrderlyKeyPair implements OrderlyKeyPair {
10
10
  secretKey: string;
11
+ private privateKey;
12
+ static generateKey(): OrderlyKeyPair;
11
13
  constructor(secretKey: string);
12
14
  sign(message: Uint8Array): Promise<Uint8Array>;
13
15
  getPublicKey(): Promise<string>;
14
16
  }
15
17
 
16
18
  interface OrderlyKeyStore {
17
- getOrderlyKey: () => OrderlyKeyPair;
18
- getAccountId: () => string | undefined;
19
- setAccountId: (accountId: string) => void;
20
- getAddress: () => string | undefined;
19
+ getOrderlyKey: (address?: string) => OrderlyKeyPair | null;
20
+ getAccountId: (address: string) => string | undefined | null;
21
+ setAccountId: (address: string, accountId: string) => void;
22
+ getAddress: () => string | undefined | null;
21
23
  setAddress: (address: string) => void;
22
24
  generateKey: () => OrderlyKeyPair;
23
- cleanKey: (key: string) => void;
24
- cleanAllKey: () => void;
25
- setKey: (orderlyKey: string, secretKey: string) => void;
25
+ cleanKey: (address: string, key: string) => void;
26
+ cleanAllKey: (address: string) => void;
27
+ setKey: (orderlyKey: string, secretKey: OrderlyKeyPair) => void;
26
28
  }
27
29
  declare abstract class BaseKeyStore implements OrderlyKeyStore {
28
30
  private readonly networkId;
29
- constructor(networkId: string);
30
- abstract getOrderlyKey(): OrderlyKeyPair;
31
- abstract getAccountId(): string | undefined;
32
- abstract setAccountId(accountId: string): void;
33
- abstract getAddress(): string | undefined;
31
+ constructor(networkId?: string);
32
+ abstract getOrderlyKey(address?: string): OrderlyKeyPair | null;
33
+ abstract getAccountId(address: string): string | undefined | null;
34
+ abstract setAccountId(address: string, accountId: string): void;
35
+ abstract getAddress(): string | undefined | null;
34
36
  abstract setAddress(address: string): void;
35
37
  abstract generateKey(): OrderlyKeyPair;
36
- abstract setKey(orderlyKey: string, secretKey: string): void;
37
- abstract cleanAllKey(): void;
38
- abstract cleanKey(key: string): void;
38
+ abstract setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
39
+ abstract cleanAllKey(address: string): void;
40
+ abstract cleanKey(address: string, key: string): void;
39
41
  protected get keyPrefix(): string;
40
42
  }
41
43
  declare class LocalStorageStore extends BaseKeyStore {
42
- getOrderlyKey(): OrderlyKeyPair;
43
- getAccountId(): string;
44
- setAccountId(accountId: string): void;
45
- getAddress(): string;
44
+ getOrderlyKey(address?: string): OrderlyKeyPair | null;
45
+ getAccountId(address: string): string | undefined | null;
46
+ setAccountId(address: string, accountId: string): void;
47
+ getAddress(): string | undefined | null;
46
48
  setAddress(address: string): void;
47
- generateKey(): BaseOrderlyKeyPair;
48
- setKey(orderlyKey: string, secretKey: string): void;
49
- cleanAllKey(): void;
50
- cleanKey(key: string): void;
49
+ generateKey(): OrderlyKeyPair;
50
+ setKey(address: string, orderlyKey: OrderlyKeyPair): void;
51
+ cleanAllKey(address: string): void;
52
+ cleanKey(address: string, key: string): void;
53
+ private setItem;
54
+ private getItem;
51
55
  }
52
56
  declare class MockKeyStore implements OrderlyKeyStore {
53
57
  private readonly secretKey;
@@ -58,7 +62,7 @@ declare class MockKeyStore implements OrderlyKeyStore {
58
62
  setAccountId(accountId: string): void;
59
63
  getAddress(): string;
60
64
  setAddress(address: string): void;
61
- setKey(orderlyKey: string, secretKey: string): void;
65
+ setKey(orderlyKey: string, secretKey: OrderlyKeyPair): void;
62
66
  cleanAllKey(): void;
63
67
  cleanKey(key: string): void;
64
68
  }
@@ -72,6 +76,7 @@ type SignedMessagePayload = {
72
76
  "orderly-key": string;
73
77
  "orderly-timestamp": string;
74
78
  "orderly-signature": string;
79
+ "orderly-account-id"?: string;
75
80
  };
76
81
  /**
77
82
  * 签名
@@ -111,13 +116,21 @@ interface ConfigStore {
111
116
  clear(): void;
112
117
  }
113
118
  declare class MemoryConfigStore implements ConfigStore {
114
- private map;
119
+ protected map: Map<string, any>;
115
120
  constructor();
116
- private _restore;
121
+ protected _restore(): void;
117
122
  get<T>(key: string): T;
118
123
  set<T>(key: string, value: T): void;
119
124
  clear(): void;
120
125
  }
126
+ /**
127
+ *
128
+ */
129
+ declare class BaseConfigStore extends MemoryConfigStore {
130
+ private readonly configMap;
131
+ constructor(configMap: Record<string, any>);
132
+ protected _restore(): void;
133
+ }
121
134
 
122
135
  declare const getMockSigner: (secretKey?: string) => BaseSigner;
123
136
  declare const getDefaultSigner: () => BaseSigner;
@@ -137,6 +150,7 @@ declare class SimpleDI {
137
150
  interface WalletAdapter {
138
151
  getBalance: (address: string) => Promise<any>;
139
152
  deposit: (from: string, to: string, amount: string) => Promise<any>;
153
+ send: (method: string, params: Array<any> | Record<string, any>) => Promise<any>;
140
154
  }
141
155
 
142
156
  interface AccountState {
@@ -160,10 +174,14 @@ interface AccountState {
160
174
  declare class Account {
161
175
  private readonly configStore;
162
176
  private readonly keyStore;
163
- private readonly walletClient;
177
+ private readonly walletAdapterClass;
178
+ static instanceName: string;
164
179
  private _singer?;
165
180
  private _state$;
166
- constructor(configStore: ConfigStore, keyStore: OrderlyKeyStore, walletClient: WalletAdapter);
181
+ private walletClient?;
182
+ constructor(configStore: ConfigStore, keyStore: OrderlyKeyStore, walletAdapterClass: {
183
+ new (options: any): WalletAdapter;
184
+ });
167
185
  /**
168
186
  * 登录
169
187
  * @param address 钱包地址
@@ -173,10 +191,13 @@ declare class Account {
173
191
  /**
174
192
  * 连接钱包先用第三方的React版本,不用自己实现
175
193
  */
176
- /**
177
- * 为账户设置钱包
178
- */
179
- set address(address: string);
194
+ setAddress(address: string, wallet?: {
195
+ provider: any;
196
+ chain: {
197
+ id: string;
198
+ };
199
+ [key: string]: any;
200
+ }): Promise<AccountStatusEnum>;
180
201
  get state$(): BehaviorSubject<AccountState>;
181
202
  get stateValue(): AccountState;
182
203
  get accountId(): string | undefined;
@@ -187,10 +208,15 @@ declare class Account {
187
208
  set orders(orders: string[]);
188
209
  private _checkAccount;
189
210
  private _checkAccountExist;
211
+ createAccount(): Promise<any>;
212
+ createOrderlyKey(expiration: number): Promise<any>;
213
+ disconnect(): Promise<void>;
214
+ private _checkOrderlyKeyState;
190
215
  get signer(): Signer;
191
216
  private getAccountInfo;
192
217
  private getBalance;
193
- private _fetch;
218
+ private _getRegisterationNonce;
219
+ private _simpleFetch;
194
220
  }
195
221
 
196
222
  declare namespace API {
@@ -321,11 +347,34 @@ declare namespace WSMessage {
321
347
  }
322
348
  }
323
349
 
324
- declare class Web3WalletAdapter implements Web3WalletAdapter {
350
+ declare class Web3WalletAdapter implements WalletAdapter {
325
351
  private readonly web3;
326
352
  constructor(web3: any);
327
353
  getBalance(address: string): Promise<any>;
328
354
  deposit(from: string, to: string, amount: string): Promise<any>;
355
+ send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
356
+ }
357
+
358
+ interface EtherAdapterOptions {
359
+ provider: any;
360
+ label?: string;
361
+ chain: {
362
+ id: string;
363
+ };
364
+ }
365
+ declare class EtherAdapter implements WalletAdapter {
366
+ private provider?;
367
+ private _chainId;
368
+ constructor(options: EtherAdapterOptions);
369
+ getBalance(address: string): Promise<any>;
370
+ deposit(from: string, to: string, amount: string): Promise<any>;
371
+ get chainId(): number;
372
+ send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
373
+ verify(data: {
374
+ domain: any;
375
+ message: any;
376
+ types: any;
377
+ }, signature: string): Promise<void>;
329
378
  }
330
379
 
331
- export { API, Account, AccountState, BaseKeyStore, BaseSigner, ConfigStore, LocalStorageStore, MemoryConfigStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, WSMessage, WalletAdapter, Web3WalletAdapter, getDefaultSigner, getMockSigner };
380
+ export { API, Account, AccountState, BaseConfigStore, BaseKeyStore, BaseOrderlyKeyPair, BaseSigner, ConfigStore, EtherAdapter, LocalStorageStore, MemoryConfigStore, MessageFactor, MockKeyStore, OrderlyKeyPair, OrderlyKeyStore, SignedMessagePayload, Signer, SimpleDI, WSMessage, WalletAdapter, Web3WalletAdapter, getDefaultSigner, getMockSigner };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var it=Object.create;var Q=Object.defineProperty,ot=Object.defineProperties,st=Object.getOwnPropertyDescriptor,ut=Object.getOwnPropertyDescriptors,at=Object.getOwnPropertyNames,Ur=Object.getOwnPropertySymbols,ct=Object.getPrototypeOf,kr=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var w=Math.pow,Tr=(h,s,c)=>s in h?Q(h,s,{enumerable:!0,configurable:!0,writable:!0,value:c}):h[s]=c,H=(h,s)=>{for(var c in s||(s={}))kr.call(s,c)&&Tr(h,c,s[c]);if(Ur)for(var c of Ur(s))ht.call(s,c)&&Tr(h,c,s[c]);return h},rr=(h,s)=>ot(h,ut(s));var pt=(h,s)=>{for(var c in s)Q(h,c,{get:s[c],enumerable:!0})},Pr=(h,s,c,p)=>{if(s&&typeof s=="object"||typeof s=="function")for(let y of at(s))!kr.call(h,y)&&y!==c&&Q(h,y,{get:()=>s[y],enumerable:!(p=st(s,y))||p.enumerable});return h};var lt=(h,s,c)=>(c=h!=null?it(ct(h)):{},Pr(s||!h||!h.__esModule?Q(c,"default",{value:h,enumerable:!0}):c,h)),yt=h=>Pr(Q({},"__esModule",{value:!0}),h);var R=(h,s,c)=>new Promise((p,y)=>{var g=_=>{try{S(c.next(_))}catch(P){y(P)}},o=_=>{try{S(c.throw(_))}catch(P){y(P)}},S=_=>_.done?p(_.value):Promise.resolve(_.value).then(g,o);S((c=c.apply(h,s)).next())});var mt={};pt(mt,{Account:()=>cr,BaseKeyStore:()=>er,BaseSigner:()=>Y,LocalStorageStore:()=>J,MemoryConfigStore:()=>ur,MockKeyStore:()=>z,SimpleDI:()=>Or,Web3WalletAdapter:()=>hr,getDefaultSigner:()=>$r,getMockSigner:()=>nr});module.exports=yt(mt);var tr={},Kr=!1;function ft(){if(Kr)return tr;Kr=!0,tr.byteLength=S,tr.toByteArray=P,tr.fromByteArray=D;for(var h=[],s=[],c=typeof Uint8Array!="undefined"?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y=0,g=p.length;y<g;++y)h[y]=p[y],s[p.charCodeAt(y)]=y;s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63;function o(l){var d=l.length;if(d%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var B=l.indexOf("=");B===-1&&(B=d);var U=B===d?0:4-B%4;return[B,U]}function S(l){var d=o(l),B=d[0],U=d[1];return(B+U)*3/4-U}function _(l,d,B){return(d+B)*3/4-B}function P(l){var d,B=o(l),U=B[0],M=B[1],x=new c(_(l,U,M)),N=0,L=M>0?U-4:U,K;for(K=0;K<L;K+=4)d=s[l.charCodeAt(K)]<<18|s[l.charCodeAt(K+1)]<<12|s[l.charCodeAt(K+2)]<<6|s[l.charCodeAt(K+3)],x[N++]=d>>16&255,x[N++]=d>>8&255,x[N++]=d&255;return M===2&&(d=s[l.charCodeAt(K)]<<2|s[l.charCodeAt(K+1)]>>4,x[N++]=d&255),M===1&&(d=s[l.charCodeAt(K)]<<10|s[l.charCodeAt(K+1)]<<4|s[l.charCodeAt(K+2)]>>2,x[N++]=d>>8&255,x[N++]=d&255),x}function A(l){return h[l>>18&63]+h[l>>12&63]+h[l>>6&63]+h[l&63]}function k(l,d,B){for(var U,M=[],x=d;x<B;x+=3)U=(l[x]<<16&16711680)+(l[x+1]<<8&65280)+(l[x+2]&255),M.push(A(U));return M.join("")}function D(l){for(var d,B=l.length,U=B%3,M=[],x=16383,N=0,L=B-U;N<L;N+=x)M.push(k(l,N,N+x>L?L:N+x));return U===1?(d=l[B-1],M.push(h[d>>2]+h[d<<4&63]+"==")):U===2&&(d=(l[B-2]<<8)+l[B-1],M.push(h[d>>10]+h[d>>4&63]+h[d<<2&63]+"=")),M.join("")}return tr}var or={},Rr=!1;function dt(){if(Rr)return or;Rr=!0;return or.read=function(h,s,c,p,y){var g,o,S=y*8-p-1,_=(1<<S)-1,P=_>>1,A=-7,k=c?y-1:0,D=c?-1:1,l=h[s+k];for(k+=D,g=l&(1<<-A)-1,l>>=-A,A+=S;A>0;g=g*256+h[s+k],k+=D,A-=8);for(o=g&(1<<-A)-1,g>>=-A,A+=p;A>0;o=o*256+h[s+k],k+=D,A-=8);if(g===0)g=1-P;else{if(g===_)return o?NaN:(l?-1:1)*(1/0);o=o+Math.pow(2,p),g=g-P}return(l?-1:1)*o*Math.pow(2,g-p)},or.write=function(h,s,c,p,y,g){var o,S,_,P=g*8-y-1,A=(1<<P)-1,k=A>>1,D=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,l=p?0:g-1,d=p?1:-1,B=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(S=isNaN(s)?1:0,o=A):(o=Math.floor(Math.log(s)/Math.LN2),s*(_=Math.pow(2,-o))<1&&(o--,_*=2),o+k>=1?s+=D/_:s+=D*Math.pow(2,1-k),s*_>=2&&(o++,_/=2),o+k>=A?(S=0,o=A):o+k>=1?(S=(s*_-1)*Math.pow(2,y),o=o+k):(S=s*Math.pow(2,k-1)*Math.pow(2,y),o=0));y>=8;h[c+l]=S&255,l+=d,S/=256,y-=8);for(o=o<<y|S,P+=y;P>0;h[c+l]=o&255,l+=d,o/=256,P-=8);h[c+l-d]|=B*128},or}var W={},Cr=!1;function gt(){if(Cr)return W;Cr=!0;let h=ft(),s=dt(),c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;W.Buffer=o,W.SlowBuffer=M,W.INSPECT_MAX_BYTES=50;let p=2147483647;W.kMaxLength=p,o.TYPED_ARRAY_SUPPORT=y(),!o.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function y(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch(e){return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function g(e){if(e>p)throw new RangeError('The value "'+e+'" is invalid for option "size"');let r=new Uint8Array(e);return Object.setPrototypeOf(r,o.prototype),r}function o(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return A(e)}return S(e,r,t)}o.poolSize=8192;function S(e,r,t){if(typeof e=="string")return k(e,r);if(ArrayBuffer.isView(e))return l(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return d(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return o.from(n,r,t);let i=B(e);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return o.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}o.from=function(e,r,t){return S(e,r,t)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function _(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function P(e,r,t){return _(e),e<=0?g(e):r!==void 0?typeof t=="string"?g(e).fill(r,t):g(e).fill(r):g(e)}o.alloc=function(e,r,t){return P(e,r,t)};function A(e){return _(e),g(e<0?0:U(e)|0)}o.allocUnsafe=function(e){return A(e)},o.allocUnsafeSlow=function(e){return A(e)};function k(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=x(e,r)|0,n=g(t),i=n.write(e,r);return i!==t&&(n=n.slice(0,i)),n}function D(e){let r=e.length<0?0:U(e.length)|0,t=g(r);for(let n=0;n<r;n+=1)t[n]=e[n]&255;return t}function l(e){if(j(e,Uint8Array)){let r=new Uint8Array(e);return d(r.buffer,r.byteOffset,r.byteLength)}return D(e)}function d(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return r===void 0&&t===void 0?n=new Uint8Array(e):t===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,t),Object.setPrototypeOf(n,o.prototype),n}function B(e){if(o.isBuffer(e)){let r=U(e.length)|0,t=g(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||yr(e.length)?g(0):D(e);if(e.type==="Buffer"&&Array.isArray(e.data))return D(e.data)}function U(e){if(e>=p)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+p.toString(16)+" bytes");return e|0}function M(e){return+e!=e&&(e=0),o.alloc(+e)}o.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==o.prototype},o.compare=function(r,t){if(j(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),j(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(r)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let n=r.length,i=t.length;for(let u=0,a=Math.min(n,i);u<a;++u)if(r[u]!==t[u]){n=r[u],i=t[u];break}return n<i?-1:i<n?1:0},o.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return o.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<r.length;++n)t+=r[n].length;let i=o.allocUnsafe(t),u=0;for(n=0;n<r.length;++n){let a=r[n];if(j(a,Uint8Array))u+a.length>i.length?(o.isBuffer(a)||(a=o.from(a)),a.copy(i,u)):Uint8Array.prototype.set.call(i,a,u);else if(o.isBuffer(a))a.copy(i,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=a.length}return i};function x(e,r){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let t=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return lr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Sr(e).length;default:if(i)return n?-1:lr(e).length;r=(""+r).toLowerCase(),i=!0}}o.byteLength=x;function N(e,r,t){let n=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return Hr(this,r,t);case"utf8":case"utf-8":return mr(this,r,t);case"ascii":return vr(this,r,t);case"latin1":case"binary":return Xr(this,r,t);case"base64":return Gr(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jr(this,r,t);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}o.prototype._isBuffer=!0;function L(e,r,t){let n=e[r];e[r]=e[t],e[t]=n}o.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)L(this,t,t+1);return this},o.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)L(this,t,t+3),L(this,t+1,t+2);return this},o.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)L(this,t,t+7),L(this,t+1,t+6),L(this,t+2,t+5),L(this,t+3,t+4);return this},o.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?mr(this,0,r):N.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(r){if(!o.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:o.compare(this,r)===0},o.prototype.inspect=function(){let r="",t=W.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"},c&&(o.prototype[c]=o.prototype.inspect),o.prototype.compare=function(r,t,n,i,u){if(j(r,Uint8Array)&&(r=o.from(r,r.offset,r.byteLength)),!o.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),n===void 0&&(n=r?r.length:0),i===void 0&&(i=0),u===void 0&&(u=this.length),t<0||n>r.length||i<0||u>this.length)throw new RangeError("out of range index");if(i>=u&&t>=n)return 0;if(i>=u)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,u>>>=0,this===r)return 0;let a=u-i,f=n-t,I=Math.min(a,f),E=this.slice(i,u),b=r.slice(t,n);for(let m=0;m<I;++m)if(E[m]!==b[m]){a=E[m],f=b[m];break}return a<f?-1:f<a?1:0};function K(e,r,t,n,i){if(e.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,yr(t)&&(t=i?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(i)return-1;t=e.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof r=="string"&&(r=o.from(r,n)),o.isBuffer(r))return r.length===0?-1:gr(e,r,t,n,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):gr(e,[r],t,n,i);throw new TypeError("val must be string, number or Buffer")}function gr(e,r,t,n,i){let u=1,a=e.length,f=r.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||r.length<2)return-1;u=2,a/=2,f/=2,t/=2}function I(b,m){return u===1?b[m]:b.readUInt16BE(m*u)}let E;if(i){let b=-1;for(E=t;E<a;E++)if(I(e,E)===I(r,b===-1?0:E-b)){if(b===-1&&(b=E),E-b+1===f)return b*u}else b!==-1&&(E-=E-b),b=-1}else for(t+f>a&&(t=a-f),E=t;E>=0;E--){let b=!0;for(let m=0;m<f;m++)if(I(e,E+m)!==I(r,m)){b=!1;break}if(b)return E}return-1}o.prototype.includes=function(r,t,n){return this.indexOf(r,t,n)!==-1},o.prototype.indexOf=function(r,t,n){return K(this,r,t,n,!0)},o.prototype.lastIndexOf=function(r,t,n){return K(this,r,t,n,!1)};function Dr(e,r,t,n){t=Number(t)||0;let i=e.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let u=r.length;n>u/2&&(n=u/2);let a;for(a=0;a<n;++a){let f=parseInt(r.substr(a*2,2),16);if(yr(f))return a;e[t+a]=f}return a}function jr(e,r,t,n){return ir(lr(r,e.length-t),e,t,n)}function qr(e,r,t,n){return ir(rt(r),e,t,n)}function Wr(e,r,t,n){return ir(Sr(r),e,t,n)}function Vr(e,r,t,n){return ir(tt(r,e.length-t),e,t,n)}o.prototype.write=function(r,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),r.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return Dr(this,r,t,n);case"utf8":case"utf-8":return jr(this,r,t,n);case"ascii":case"latin1":case"binary":return qr(this,r,t,n);case"base64":return Wr(this,r,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vr(this,r,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Gr(e,r,t){return r===0&&t===e.length?h.fromByteArray(e):h.fromByteArray(e.slice(r,t))}function mr(e,r,t){t=Math.min(e.length,t);let n=[],i=r;for(;i<t;){let u=e[i],a=null,f=u>239?4:u>223?3:u>191?2:1;if(i+f<=t){let I,E,b,m;switch(f){case 1:u<128&&(a=u);break;case 2:I=e[i+1],(I&192)===128&&(m=(u&31)<<6|I&63,m>127&&(a=m));break;case 3:I=e[i+1],E=e[i+2],(I&192)===128&&(E&192)===128&&(m=(u&15)<<12|(I&63)<<6|E&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:I=e[i+1],E=e[i+2],b=e[i+3],(I&192)===128&&(E&192)===128&&(b&192)===128&&(m=(u&15)<<18|(I&63)<<12|(E&63)<<6|b&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,f=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=f}return Yr(n)}let wr=4096;function Yr(e){let r=e.length;if(r<=wr)return String.fromCharCode.apply(String,e);let t="",n=0;for(;n<r;)t+=String.fromCharCode.apply(String,e.slice(n,n+=wr));return t}function vr(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]&127);return n}function Xr(e,r,t){let n="";t=Math.min(e.length,t);for(let i=r;i<t;++i)n+=String.fromCharCode(e[i]);return n}function Hr(e,r,t){let n=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>n)&&(t=n);let i="";for(let u=r;u<t;++u)i+=et[e[u]];return i}function Jr(e,r,t){let n=e.slice(r,t),i="";for(let u=0;u<n.length-1;u+=2)i+=String.fromCharCode(n[u]+n[u+1]*256);return i}o.prototype.slice=function(r,t){let n=this.length;r=~~r,t=t===void 0?n:~~t,r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<r&&(t=r);let i=this.subarray(r,t);return Object.setPrototypeOf(i,o.prototype),i};function T(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||T(r,t,this.length);let i=this[r],u=1,a=0;for(;++a<t&&(u*=256);)i+=this[r+a]*u;return i},o.prototype.readUintBE=o.prototype.readUIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||T(r,t,this.length);let i=this[r+--t],u=1;for(;t>0&&(u*=256);)i+=this[r+--t]*u;return i},o.prototype.readUint8=o.prototype.readUInt8=function(r,t){return r=r>>>0,t||T(r,1,this.length),this[r]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||T(r,2,this.length),this[r]|this[r+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||T(r,2,this.length),this[r]<<8|this[r+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||T(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||T(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},o.prototype.readBigUInt64LE=q(function(r){r=r>>>0,X(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&Z(r,this.length-8);let i=t+this[++r]*w(2,8)+this[++r]*w(2,16)+this[++r]*w(2,24),u=this[++r]+this[++r]*w(2,8)+this[++r]*w(2,16)+n*w(2,24);return BigInt(i)+(BigInt(u)<<BigInt(32))}),o.prototype.readBigUInt64BE=q(function(r){r=r>>>0,X(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&Z(r,this.length-8);let i=t*w(2,24)+this[++r]*w(2,16)+this[++r]*w(2,8)+this[++r],u=this[++r]*w(2,24)+this[++r]*w(2,16)+this[++r]*w(2,8)+n;return(BigInt(i)<<BigInt(32))+BigInt(u)}),o.prototype.readIntLE=function(r,t,n){r=r>>>0,t=t>>>0,n||T(r,t,this.length);let i=this[r],u=1,a=0;for(;++a<t&&(u*=256);)i+=this[r+a]*u;return u*=128,i>=u&&(i-=Math.pow(2,8*t)),i},o.prototype.readIntBE=function(r,t,n){r=r>>>0,t=t>>>0,n||T(r,t,this.length);let i=t,u=1,a=this[r+--i];for(;i>0&&(u*=256);)a+=this[r+--i]*u;return u*=128,a>=u&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(r,t){return r=r>>>0,t||T(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},o.prototype.readInt16LE=function(r,t){r=r>>>0,t||T(r,2,this.length);let n=this[r]|this[r+1]<<8;return n&32768?n|4294901760:n},o.prototype.readInt16BE=function(r,t){r=r>>>0,t||T(r,2,this.length);let n=this[r+1]|this[r]<<8;return n&32768?n|4294901760:n},o.prototype.readInt32LE=function(r,t){return r=r>>>0,t||T(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},o.prototype.readInt32BE=function(r,t){return r=r>>>0,t||T(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},o.prototype.readBigInt64LE=q(function(r){r=r>>>0,X(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&Z(r,this.length-8);let i=this[r+4]+this[r+5]*w(2,8)+this[r+6]*w(2,16)+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++r]*w(2,8)+this[++r]*w(2,16)+this[++r]*w(2,24))}),o.prototype.readBigInt64BE=q(function(r){r=r>>>0,X(r,"offset");let t=this[r],n=this[r+7];(t===void 0||n===void 0)&&Z(r,this.length-8);let i=(t<<24)+this[++r]*w(2,16)+this[++r]*w(2,8)+this[++r];return(BigInt(i)<<BigInt(32))+BigInt(this[++r]*w(2,24)+this[++r]*w(2,16)+this[++r]*w(2,8)+n)}),o.prototype.readFloatLE=function(r,t){return r=r>>>0,t||T(r,4,this.length),s.read(this,r,!0,23,4)},o.prototype.readFloatBE=function(r,t){return r=r>>>0,t||T(r,4,this.length),s.read(this,r,!1,23,4)},o.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||T(r,8,this.length),s.read(this,r,!0,52,8)},o.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||T(r,8,this.length),s.read(this,r,!1,52,8)};function $(e,r,t,n,i,u){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<u)throw new RangeError('"value" argument is out of bounds');if(t+n>e.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let f=Math.pow(2,8*n)-1;$(this,r,t,n,f,0)}let u=1,a=0;for(this[t]=r&255;++a<n&&(u*=256);)this[t+a]=r/u&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,n=n>>>0,!i){let f=Math.pow(2,8*n)-1;$(this,r,t,n,f,0)}let u=n-1,a=1;for(this[t+u]=r&255;--u>=0&&(a*=256);)this[t+u]=r/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,1,255,0),this[t]=r&255,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function Br(e,r,t,n,i){xr(r,n,i,e,t,7);let u=Number(r&BigInt(4294967295));e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,a=a>>8,e[t++]=a,t}function Er(e,r,t,n,i){xr(r,n,i,e,t,7);let u=Number(r&BigInt(4294967295));e[t+7]=u,u=u>>8,e[t+6]=u,u=u>>8,e[t+5]=u,u=u>>8,e[t+4]=u;let a=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=a,a=a>>8,e[t+2]=a,a=a>>8,e[t+1]=a,a=a>>8,e[t]=a,t+8}o.prototype.writeBigUInt64LE=q(function(r,t=0){return Br(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=q(function(r,t=0){return Er(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let I=Math.pow(2,8*n-1);$(this,r,t,n,I-1,-I)}let u=0,a=1,f=0;for(this[t]=r&255;++u<n&&(a*=256);)r<0&&f===0&&this[t+u-1]!==0&&(f=1),this[t+u]=(r/a>>0)-f&255;return t+n},o.prototype.writeIntBE=function(r,t,n,i){if(r=+r,t=t>>>0,!i){let I=Math.pow(2,8*n-1);$(this,r,t,n,I-1,-I)}let u=n-1,a=1,f=0;for(this[t+u]=r&255;--u>=0&&(a*=256);)r<0&&f===0&&this[t+u+1]!==0&&(f=1),this[t+u]=(r/a>>0)-f&255;return t+n},o.prototype.writeInt8=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1},o.prototype.writeInt16LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2},o.prototype.writeInt16BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2},o.prototype.writeInt32LE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4},o.prototype.writeInt32BE=function(r,t,n){return r=+r,t=t>>>0,n||$(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4},o.prototype.writeBigInt64LE=q(function(r,t=0){return Br(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=q(function(r,t=0){return Er(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function _r(e,r,t,n,i,u){if(t+n>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ir(e,r,t,n,i){return r=+r,t=t>>>0,i||_r(e,r,t,4),s.write(e,r,t,n,23,4),t+4}o.prototype.writeFloatLE=function(r,t,n){return Ir(this,r,t,!0,n)},o.prototype.writeFloatBE=function(r,t,n){return Ir(this,r,t,!1,n)};function br(e,r,t,n,i){return r=+r,t=t>>>0,i||_r(e,r,t,8),s.write(e,r,t,n,52,8),t+8}o.prototype.writeDoubleLE=function(r,t,n){return br(this,r,t,!0,n)},o.prototype.writeDoubleBE=function(r,t,n){return br(this,r,t,!1,n)},o.prototype.copy=function(r,t,n,i){if(!o.isBuffer(r))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=r.length&&(t=r.length),t||(t=0),i>0&&i<n&&(i=n),i===n||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-t<i-n&&(i=r.length-t+n);let u=i-n;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(r,this.subarray(n,i),t),u},o.prototype.fill=function(r,t,n,i){if(typeof r=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){let a=r.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(r=a)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,r||(r=0);let u;if(typeof r=="number")for(u=t;u<n;++u)this[u]=r;else{let a=o.isBuffer(r)?r:o.from(r,i),f=a.length;if(f===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=a[u%f]}return this};let v={};function pr(e,r,t){v[e]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}pr("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),pr("ERR_INVALID_ARG_TYPE",function(e,r){return`The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError),pr("ERR_OUT_OF_RANGE",function(e,r,t){let n=`The value of "${e}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>w(2,32)?i=Ar(String(t)):typeof t=="bigint"&&(i=String(t),(t>w(BigInt(2),BigInt(32))||t<-w(BigInt(2),BigInt(32)))&&(i=Ar(i)),i+="n"),n+=` It must be ${r}. Received ${i}`,n},RangeError);function Ar(e){let r="",t=e.length,n=e[0]==="-"?1:0;for(;t>=n+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function zr(e,r,t){X(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&Z(r,e.length-(t+1))}function xr(e,r,t,n,i,u){if(e>t||e<r){let a=typeof r=="bigint"?"n":"",f;throw u>3?r===0||r===BigInt(0)?f=`>= 0${a} and < 2${a} ** ${(u+1)*8}${a}`:f=`>= -(2${a} ** ${(u+1)*8-1}${a}) and < 2 ** ${(u+1)*8-1}${a}`:f=`>= ${r}${a} and <= ${t}${a}`,new v.ERR_OUT_OF_RANGE("value",f,e)}zr(n,i,u)}function X(e,r){if(typeof e!="number")throw new v.ERR_INVALID_ARG_TYPE(r,"number",e)}function Z(e,r,t){throw Math.floor(e)!==e?(X(e,t),new v.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new v.ERR_BUFFER_OUT_OF_BOUNDS:new v.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}let Zr=/[^+/0-9A-Za-z-_]/g;function Qr(e){if(e=e.split("=")[0],e=e.trim().replace(Zr,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function lr(e,r){r=r||1/0;let t,n=e.length,i=null,u=[];for(let a=0;a<n;++a){if(t=e.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(r-=3)>-1&&u.push(239,191,189);continue}else if(a+1===n){(r-=3)>-1&&u.push(239,191,189);continue}i=t;continue}if(t<56320){(r-=3)>-1&&u.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(r-=3)>-1&&u.push(239,191,189);if(i=null,t<128){if((r-=1)<0)break;u.push(t)}else if(t<2048){if((r-=2)<0)break;u.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;u.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;u.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return u}function rt(e){let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function tt(e,r){let t,n,i,u=[];for(let a=0;a<e.length&&!((r-=2)<0);++a)t=e.charCodeAt(a),n=t>>8,i=t%256,u.push(i),u.push(n);return u}function Sr(e){return h.toByteArray(Qr(e))}function ir(e,r,t,n){let i;for(i=0;i<n&&!(i+t>=r.length||i>=e.length);++i)r[i+t]=e[i];return i}function j(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function yr(e){return e!==e}let et=function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)r[n+i]=e[t]+e[i]}return r}();function q(e){return typeof BigInt=="undefined"?nt:e}function nt(){throw new Error("BigInt not supported")}return W}var V=gt();V.Buffer;V.SlowBuffer;V.INSPECT_MAX_BYTES;V.kMaxLength;var C=V.Buffer,Et=V.INSPECT_MAX_BYTES,_t=V.kMaxLength;var Mr=require("bs58"),sr=lt(require("@noble/ed25519"));var G=class{constructor(s){this.secretKey=s}sign(s){return R(this,null,function*(){return yield sr.signAsync(s,this.secretKey)})}getPublicKey(){return R(this,null,function*(){let s=yield sr.getPublicKeyAsync(this.secretKey);return`ed25519:${(0,Mr.encode)(s)}`})}};var er=class{constructor(s){this.networkId=s}get keyPrefix(){return`orderly_${this.networkId}_`}},J=class extends er{getOrderlyKey(){return new G("")}getAccountId(){return""}setAccountId(s){localStorage.setItem(`${this.keyPrefix}accountId`,s)}getAddress(){return""}setAddress(s){}generateKey(){return new G("")}setKey(s,c){localStorage.setItem(`${this.keyPrefix}orderlyKey`,s),localStorage.setItem(`${this.keyPrefix}secretKey`,c)}cleanAllKey(){}cleanKey(s){}},z=class{constructor(s){this.secretKey=s}generateKey(){return new G(this.secretKey)}getOrderlyKey(){return new G(this.secretKey)}getAccountId(){return""}setAccountId(s){}getAddress(){return""}setAddress(s){}setKey(s,c){}cleanAllKey(){}cleanKey(s){}};var Nr=function(h){return h.replace(/\+/g,"-").replace(/\//g,"_")};var Y=class{constructor(s){this.keyStore=s}sign(s){return R(this,null,function*(){let c=new URL(s.url),p=Date.now().toString(),y=[p,s.method.toUpperCase(),c.pathname+c.search].join("");s.data&&Object.keys(s.data).length&&(y+=JSON.stringify(s.data));let{signature:g,publicKey:o}=yield this.signText(y);return{"orderly-key":o,"orderly-timestamp":p,"orderly-signature":g}})}signText(s){return R(this,null,function*(){let c=this.keyStore.getOrderlyKey(),p=C.from(s),y=yield c.sign(p),g=C.from(y).toString("base64");return{signature:Nr(g),publicKey:yield c.getPublicKey()}})}};var ur=class{constructor(){this._restore()}_restore(){this.map=new Map([["apiBaseUrl","https://dev-api-v2.orderly.org/v1"]])}get(s){return this.map.get(s)}set(s,c){this.map.set(s,c)}clear(){}};var nr=h=>{let s=new z(h||"c24fe227663f5a73493cad3f4049514f70623177272d57fffa8cb895fa1f92de");return new Y(s)},$r=()=>{if(typeof window=="undefined")throw new Error("the default signer only supports browsers.");let h=new J("");return new Y(h)};var fr=class{constructor(s=[],c={}){this.providers=s;this.services=c;this.injectProperties={}}register(...s){this.providers.push(...s),s.forEach(c=>{let p=c;p instanceof Function&&(p=new c),this.add(p)})}registerByName(s,c){let p=c;p instanceof Function&&(p=new c),this.addByName(s,p)}get(s){return this.services[s]}getAll(){return Object.assign({},this.services)}add(s){return this.addByName(s.constructor.name,s)}addByName(s,c){return this.services[s]=c,this.services[s.toLowerCase()]=c,this.injectIntoProperties(c,s),this.get(s)}inject(s,c,p){s&&p&&(s[c]=p)}injectIntoProperties(s,c=s.constructor.name){this.getInjectProperty(c.toLowerCase()).forEach(p=>{this.inject(p.target,p.propertyKey,s)})}getInjectProperty(s){return this.injectProperties[s]||(this.injectProperties[s]=[]),this.injectProperties[s]}},Lr=fr;var dr=class h{static getContainer(){return h.container||(h.container=new Lr),h.container}static register(...s){this.getContainer().register(...s)}static registerByName(s,c){this.getContainer().registerByName(s,c)}static get(s){return this.getContainer().get(s)}static getAll(){return this.getContainer().getAll()}constructor(){}},Or=dr;var Fr=require("rxjs");var ar=require("@orderly.network/types");var cr=class{constructor(s,c,p){this.configStore=s;this.keyStore=c;this.walletClient=p;this._state$=new Fr.BehaviorSubject({status:ar.AccountStatusEnum.NotConnected,balance:"",leverage:Number.NaN});let y=this.keyStore.getAddress();console.log("address",y),typeof y!="undefined"&&(this.address=y)}login(s){if(!s)throw new Error("address is required")}logout(){}set address(s){if(!s)throw new Error("address is required");this._state$.next(rr(H({},this.stateValue),{status:ar.AccountStatusEnum.Connected,address:s})),this._checkAccount(s)}get state$(){return this._state$}get stateValue(){return this._state$.getValue()}get accountId(){return this.stateValue.accountId}set position(s){this._state$.next(rr(H({},this.stateValue),{positon:s}))}set orders(s){this._state$.next(rr(H({},this.stateValue),{orders:s}))}_checkAccount(s){return R(this,null,function*(){console.log("check account is esist");try{let c=yield this._checkAccountExist(s);console.log(c),c&&c.account_id&&c.account_id!==this.stateValue.accountId&&(console.log("account next function::"),this._state$.next(rr(H({},this.stateValue),{status:ar.AccountStatusEnum.SignedIn,accountId:c.account_id,userId:c.user_id})),this.keyStore.setAccountId(c.account_id),this.keyStore.setAddress(s))}catch(c){console.log("\u68C0\u67E5\u8D26\u6237\u72B6\u6001\u53D1\u73B0\u9519\u8BEF:",c)}})}_checkAccountExist(s){return R(this,null,function*(){let c=yield this._fetch(`/get_account?address=${s}&broker_id=woofi_dex`);if(c.success)return c.data;throw new Error(c.message)})}get signer(){return this._singer||(this._singer=nr()),this._singer}getAccountInfo(){return R(this,null,function*(){})}getBalance(){return R(this,null,function*(){})}_fetch(s){return R(this,null,function*(){let c=nr(),p=`${this.configStore.get("apiBaseUrl")}${s}`,y={method:"GET",url:p},g=yield c.sign(y);return console.log(p),fetch(p,{headers:H({},g)}).then(o=>o.json())})}};var hr=class{constructor(s){this.web3=s}getBalance(s){return R(this,null,function*(){return yield this.web3.eth.getBalance(s)})}deposit(s,c,p){return R(this,null,function*(){return yield this.web3.eth.sendTransaction({from:s,to:c,value:p})})}};0&&(module.exports={Account,BaseKeyStore,BaseSigner,LocalStorageStore,MemoryConfigStore,MockKeyStore,SimpleDI,Web3WalletAdapter,getDefaultSigner,getMockSigner});
1
+ "use strict";var pt=Object.create;var re=Object.defineProperty,ht=Object.defineProperties,yt=Object.getOwnPropertyDescriptor,dt=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,mt=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable;var _=Math.pow,Ce=(p,i,c)=>i in p?re(p,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):p[i]=c,F=(p,i)=>{for(var c in i||(i={}))Re.call(i,c)&&Ce(p,c,i[c]);if(ke)for(var c of ke(i))ft.call(i,c)&&Ce(p,c,i[c]);return p},q=(p,i)=>ht(p,dt(i));var wt=(p,i)=>{for(var c in i)re(p,c,{get:i[c],enumerable:!0})},Me=(p,i,c,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of gt(i))!Re.call(p,h)&&h!==c&&re(p,h,{get:()=>i[h],enumerable:!(l=yt(i,h))||l.enumerable});return p};var It=(p,i,c)=>(c=p!=null?pt(mt(p)):{},Me(i||!p||!p.__esModule?re(c,"default",{value:p,enumerable:!0}):c,p)),_t=p=>Me(re({},"__esModule",{value:!0}),p);var B=(p,i,c)=>new Promise((l,h)=>{var y=f=>{try{w(c.next(f))}catch(P){h(P)}},s=f=>{try{w(c.throw(f))}catch(P){h(P)}},w=f=>f.done?l(f.value):Promise.resolve(f.value).then(y,s);w((c=c.apply(p,i)).next())});var xt={};wt(xt,{Account:()=>ce,BaseConfigStore:()=>fe,BaseKeyStore:()=>oe,BaseOrderlyKeyPair:()=>W,BaseSigner:()=>G,EtherAdapter:()=>he,LocalStorageStore:()=>Z,MemoryConfigStore:()=>ae,MockKeyStore:()=>ee,SimpleDI:()=>We,Web3WalletAdapter:()=>pe,getDefaultSigner:()=>Ve,getMockSigner:()=>je});module.exports=_t(xt);var ne={},Ne=!1;function Et(){if(Ne)return ne;Ne=!0,ne.byteLength=w,ne.toByteArray=P,ne.fromByteArray=j;for(var p=[],i=[],c=typeof Uint8Array!="undefined"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=l.length;h<y;++h)p[h]=l[h],i[l.charCodeAt(h)]=h;i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63;function s(d){var m=d.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=d.indexOf("=");E===-1&&(E=m);var U=E===m?0:4-E%4;return[E,U]}function w(d){var m=s(d),E=m[0],U=m[1];return(E+U)*3/4-U}function f(d,m,E){return(m+E)*3/4-E}function P(d){var m,E=s(d),U=E[0],$=E[1],K=new c(f(d,U,$)),v=0,L=$>0?U-4:U,R;for(R=0;R<L;R+=4)m=i[d.charCodeAt(R)]<<18|i[d.charCodeAt(R+1)]<<12|i[d.charCodeAt(R+2)]<<6|i[d.charCodeAt(R+3)],K[v++]=m>>16&255,K[v++]=m>>8&255,K[v++]=m&255;return $===2&&(m=i[d.charCodeAt(R)]<<2|i[d.charCodeAt(R+1)]>>4,K[v++]=m&255),$===1&&(m=i[d.charCodeAt(R)]<<10|i[d.charCodeAt(R+1)]<<4|i[d.charCodeAt(R+2)]>>2,K[v++]=m>>8&255,K[v++]=m&255),K}function S(d){return p[d>>18&63]+p[d>>12&63]+p[d>>6&63]+p[d&63]}function C(d,m,E){for(var U,$=[],K=m;K<E;K+=3)U=(d[K]<<16&16711680)+(d[K+1]<<8&65280)+(d[K+2]&255),$.push(S(U));return $.join("")}function j(d){for(var m,E=d.length,U=E%3,$=[],K=16383,v=0,L=E-U;v<L;v+=K)$.push(C(d,v,v+K>L?L:v+K));return U===1?(m=d[E-1],$.push(p[m>>2]+p[m<<4&63]+"==")):U===2&&(m=(d[E-2]<<8)+d[E-1],$.push(p[m>>10]+p[m>>4&63]+p[m<<2&63]+"=")),$.join("")}return ne}var le={},Oe=!1;function Bt(){if(Oe)return le;Oe=!0;return le.read=function(p,i,c,l,h){var y,s,w=h*8-l-1,f=(1<<w)-1,P=f>>1,S=-7,C=c?h-1:0,j=c?-1:1,d=p[i+C];for(C+=j,y=d&(1<<-S)-1,d>>=-S,S+=w;S>0;y=y*256+p[i+C],C+=j,S-=8);for(s=y&(1<<-S)-1,y>>=-S,S+=l;S>0;s=s*256+p[i+C],C+=j,S-=8);if(y===0)y=1-P;else{if(y===f)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,l),y=y-P}return(d?-1:1)*s*Math.pow(2,y-l)},le.write=function(p,i,c,l,h,y){var s,w,f,P=y*8-h-1,S=(1<<P)-1,C=S>>1,j=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=l?0:y-1,m=l?1:-1,E=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(w=isNaN(i)?1:0,s=S):(s=Math.floor(Math.log(i)/Math.LN2),i*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+C>=1?i+=j/f:i+=j*Math.pow(2,1-C),i*f>=2&&(s++,f/=2),s+C>=S?(w=0,s=S):s+C>=1?(w=(i*f-1)*Math.pow(2,h),s=s+C):(w=i*Math.pow(2,C-1)*Math.pow(2,h),s=0));h>=8;p[c+d]=w&255,d+=m,w/=256,h-=8);for(s=s<<h|w,P+=h;P>0;p[c+d]=s&255,d+=m,s/=256,P-=8);p[c+d-m]|=E*128},le}var Y={},$e=!1;function bt(){if($e)return Y;$e=!0;let p=Et(),i=Bt(),c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Y.Buffer=s,Y.SlowBuffer=$,Y.INSPECT_MAX_BYTES=50;let l=2147483647;Y.kMaxLength=l,s.TYPED_ARRAY_SUPPORT=h(),!s.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function h(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch(r){return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function y(r){if(r>l)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,s.prototype),e}function s(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return S(r)}return w(r,e,t)}s.poolSize=8192;function w(r,e,t){if(typeof r=="string")return C(r,e);if(ArrayBuffer.isView(r))return d(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(V(r,ArrayBuffer)||r&&V(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(V(r,SharedArrayBuffer)||r&&V(r.buffer,SharedArrayBuffer)))return m(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return s.from(n,e,t);let o=E(r);if(o)return o;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return s.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}s.from=function(r,e,t){return w(r,e,t)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function f(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function P(r,e,t){return f(r),r<=0?y(r):e!==void 0?typeof t=="string"?y(r).fill(e,t):y(r).fill(e):y(r)}s.alloc=function(r,e,t){return P(r,e,t)};function S(r){return f(r),y(r<0?0:U(r)|0)}s.allocUnsafe=function(r){return S(r)},s.allocUnsafeSlow=function(r){return S(r)};function C(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=K(r,e)|0,n=y(t),o=n.write(r,e);return o!==t&&(n=n.slice(0,o)),n}function j(r){let e=r.length<0?0:U(r.length)|0,t=y(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function d(r){if(V(r,Uint8Array)){let e=new Uint8Array(r);return m(e.buffer,e.byteOffset,e.byteLength)}return j(r)}function m(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,s.prototype),n}function E(r){if(s.isBuffer(r)){let e=U(r.length)|0,t=y(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||me(r.length)?y(0):j(r);if(r.type==="Buffer"&&Array.isArray(r.data))return j(r.data)}function U(r){if(r>=l)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+l.toString(16)+" bytes");return r|0}function $(r){return+r!=r&&(r=0),s.alloc(+r)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(V(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let a=0,u=Math.min(n,o);a<u;++a)if(e[a]!==t[a]){n=e[a],o=t[a];break}return n<o?-1:o<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=s.allocUnsafe(t),a=0;for(n=0;n<e.length;++n){let u=e[n];if(V(u,Uint8Array))a+u.length>o.length?(s.isBuffer(u)||(u=s.from(u)),u.copy(o,a)):Uint8Array.prototype.set.call(o,u,a);else if(s.isBuffer(u))u.copy(o,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=u.length}return o};function K(r,e){if(s.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||V(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return ge(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Te(r).length;default:if(o)return n?-1:ge(r).length;e=(""+e).toLowerCase(),o=!0}}s.byteLength=K;function v(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return rt(this,e,t);case"utf8":case"utf-8":return Ee(this,e,t);case"ascii":return et(this,e,t);case"latin1":case"binary":return tt(this,e,t);case"base64":return Qe(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nt(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function L(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}s.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)L(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)L(this,t,t+3),L(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)L(this,t,t+7),L(this,t+1,t+6),L(this,t+2,t+5),L(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ee(this,0,e):v.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let e="",t=Y.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},c&&(s.prototype[c]=s.prototype.inspect),s.prototype.compare=function(e,t,n,o,a){if(V(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),a===void 0&&(a=this.length),t<0||n>e.length||o<0||a>this.length)throw new RangeError("out of range index");if(o>=a&&t>=n)return 0;if(o>=a)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,a>>>=0,this===e)return 0;let u=a-o,g=n-t,A=Math.min(u,g),b=this.slice(o,a),x=e.slice(t,n);for(let I=0;I<A;++I)if(b[I]!==x[I]){u=b[I],g=x[I];break}return u<g?-1:g<u?1:0};function R(r,e,t,n,o){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,me(t)&&(t=o?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(o)return-1;t=r.length-1}else if(t<0)if(o)t=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:_e(r,e,t,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):_e(r,[e],t,n,o);throw new TypeError("val must be string, number or Buffer")}function _e(r,e,t,n,o){let a=1,u=r.length,g=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;a=2,u/=2,g/=2,t/=2}function A(x,I){return a===1?x[I]:x.readUInt16BE(I*a)}let b;if(o){let x=-1;for(b=t;b<u;b++)if(A(r,b)===A(e,x===-1?0:b-x)){if(x===-1&&(x=b),b-x+1===g)return x*a}else x!==-1&&(b-=b-x),x=-1}else for(t+g>u&&(t=u-g),b=t;b>=0;b--){let x=!0;for(let I=0;I<g;I++)if(A(r,b+I)!==A(e,I)){x=!1;break}if(x)return b}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return R(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return R(this,e,t,n,!1)};function Je(r,e,t,n){t=Number(t)||0;let o=r.length-t;n?(n=Number(n),n>o&&(n=o)):n=o;let a=e.length;n>a/2&&(n=a/2);let u;for(u=0;u<n;++u){let g=parseInt(e.substr(u*2,2),16);if(me(g))return u;r[t+u]=g}return u}function Ye(r,e,t,n){return ue(ge(e,r.length-t),r,t,n)}function Xe(r,e,t,n){return ue(at(e),r,t,n)}function He(r,e,t,n){return ue(Te(e),r,t,n)}function ze(r,e,t,n){return ue(ct(e,r.length-t),r,t,n)}s.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-t;if((n===void 0||n>a)&&(n=a),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let u=!1;for(;;)switch(o){case"hex":return Je(this,e,t,n);case"utf8":case"utf-8":return Ye(this,e,t,n);case"ascii":case"latin1":case"binary":return Xe(this,e,t,n);case"base64":return He(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ze(this,e,t,n);default:if(u)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),u=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Qe(r,e,t){return e===0&&t===r.length?p.fromByteArray(r):p.fromByteArray(r.slice(e,t))}function Ee(r,e,t){t=Math.min(r.length,t);let n=[],o=e;for(;o<t;){let a=r[o],u=null,g=a>239?4:a>223?3:a>191?2:1;if(o+g<=t){let A,b,x,I;switch(g){case 1:a<128&&(u=a);break;case 2:A=r[o+1],(A&192)===128&&(I=(a&31)<<6|A&63,I>127&&(u=I));break;case 3:A=r[o+1],b=r[o+2],(A&192)===128&&(b&192)===128&&(I=(a&15)<<12|(A&63)<<6|b&63,I>2047&&(I<55296||I>57343)&&(u=I));break;case 4:A=r[o+1],b=r[o+2],x=r[o+3],(A&192)===128&&(b&192)===128&&(x&192)===128&&(I=(a&15)<<18|(A&63)<<12|(b&63)<<6|x&63,I>65535&&I<1114112&&(u=I))}}u===null?(u=65533,g=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u),o+=g}return Ze(n)}let Be=4096;function Ze(r){let e=r.length;if(e<=Be)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Be));return t}function et(r,e,t){let n="";t=Math.min(r.length,t);for(let o=e;o<t;++o)n+=String.fromCharCode(r[o]&127);return n}function tt(r,e,t){let n="";t=Math.min(r.length,t);for(let o=e;o<t;++o)n+=String.fromCharCode(r[o]);return n}function rt(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let o="";for(let a=e;a<t;++a)o+=ut[r[a]];return o}function nt(r,e,t){let n=r.slice(e,t),o="";for(let a=0;a<n.length-1;a+=2)o+=String.fromCharCode(n[a]+n[a+1]*256);return o}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,s.prototype),o};function k(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||k(e,t,this.length);let o=this[e],a=1,u=0;for(;++u<t&&(a*=256);)o+=this[e+u]*a;return o},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||k(e,t,this.length);let o=this[e+--t],a=1;for(;t>0&&(a*=256);)o+=this[e+--t]*a;return o},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e=e>>>0,t||k(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||k(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||k(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||k(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=J(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&te(e,this.length-8);let o=t+this[++e]*_(2,8)+this[++e]*_(2,16)+this[++e]*_(2,24),a=this[++e]+this[++e]*_(2,8)+this[++e]*_(2,16)+n*_(2,24);return BigInt(o)+(BigInt(a)<<BigInt(32))}),s.prototype.readBigUInt64BE=J(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&te(e,this.length-8);let o=t*_(2,24)+this[++e]*_(2,16)+this[++e]*_(2,8)+this[++e],a=this[++e]*_(2,24)+this[++e]*_(2,16)+this[++e]*_(2,8)+n;return(BigInt(o)<<BigInt(32))+BigInt(a)}),s.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||k(e,t,this.length);let o=this[e],a=1,u=0;for(;++u<t&&(a*=256);)o+=this[e+u]*a;return a*=128,o>=a&&(o-=Math.pow(2,8*t)),o},s.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||k(e,t,this.length);let o=t,a=1,u=this[e+--o];for(;o>0&&(a*=256);)u+=this[e+--o]*a;return a*=128,u>=a&&(u-=Math.pow(2,8*t)),u},s.prototype.readInt8=function(e,t){return e=e>>>0,t||k(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e=e>>>0,t||k(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e=e>>>0,t||k(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e=e>>>0,t||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e=e>>>0,t||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=J(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&te(e,this.length-8);let o=this[e+4]+this[e+5]*_(2,8)+this[e+6]*_(2,16)+(n<<24);return(BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*_(2,8)+this[++e]*_(2,16)+this[++e]*_(2,24))}),s.prototype.readBigInt64BE=J(function(e){e=e>>>0,z(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&te(e,this.length-8);let o=(t<<24)+this[++e]*_(2,16)+this[++e]*_(2,8)+this[++e];return(BigInt(o)<<BigInt(32))+BigInt(this[++e]*_(2,24)+this[++e]*_(2,16)+this[++e]*_(2,8)+n)}),s.prototype.readFloatLE=function(e,t){return e=e>>>0,t||k(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e=e>>>0,t||k(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||k(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||k(e,8,this.length),i.read(this,e,!1,52,8)};function D(r,e,t,n,o,a){if(!s.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<a)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let g=Math.pow(2,8*n)-1;D(this,e,t,n,g,0)}let a=1,u=0;for(this[t]=e&255;++u<n&&(a*=256);)this[t+u]=e/a&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let g=Math.pow(2,8*n)-1;D(this,e,t,n,g,0)}let a=n-1,u=1;for(this[t+a]=e&255;--a>=0&&(u*=256);)this[t+a]=e/u&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function be(r,e,t,n,o){Ue(e,n,o,r,t,7);let a=Number(e&BigInt(4294967295));r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]=a;let u=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=u,u=u>>8,r[t++]=u,u=u>>8,r[t++]=u,u=u>>8,r[t++]=u,t}function Ae(r,e,t,n,o){Ue(e,n,o,r,t,7);let a=Number(e&BigInt(4294967295));r[t+7]=a,a=a>>8,r[t+6]=a,a=a>>8,r[t+5]=a,a=a>>8,r[t+4]=a;let u=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=u,u=u>>8,r[t+2]=u,u=u>>8,r[t+1]=u,u=u>>8,r[t]=u,t+8}s.prototype.writeBigUInt64LE=J(function(e,t=0){return be(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=J(function(e,t=0){return Ae(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let A=Math.pow(2,8*n-1);D(this,e,t,n,A-1,-A)}let a=0,u=1,g=0;for(this[t]=e&255;++a<n&&(u*=256);)e<0&&g===0&&this[t+a-1]!==0&&(g=1),this[t+a]=(e/u>>0)-g&255;return t+n},s.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let A=Math.pow(2,8*n-1);D(this,e,t,n,A-1,-A)}let a=n-1,u=1,g=0;for(this[t+a]=e&255;--a>=0&&(u*=256);)e<0&&g===0&&this[t+a+1]!==0&&(g=1),this[t+a]=(e/u>>0)-g&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=J(function(e,t=0){return be(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=J(function(e,t=0){return Ae(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function xe(r,e,t,n,o,a){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Se(r,e,t,n,o){return e=+e,t=t>>>0,o||xe(r,e,t,4),i.write(r,e,t,n,23,4),t+4}s.prototype.writeFloatLE=function(e,t,n){return Se(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return Se(this,e,t,!1,n)};function Ke(r,e,t,n,o){return e=+e,t=t>>>0,o||xe(r,e,t,8),i.write(r,e,t,n,52,8),t+8}s.prototype.writeDoubleLE=function(e,t,n){return Ke(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return Ke(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,o){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let a=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),a},s.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let u=e.charCodeAt(0);(o==="utf8"&&u<128||o==="latin1")&&(e=u)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let a;if(typeof e=="number")for(a=t;a<n;++a)this[a]=e;else{let u=s.isBuffer(e)?e:s.from(e,o),g=u.length;if(g===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-t;++a)this[a+t]=u[a%g]}return this};let H={};function de(r,e,t){H[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}de("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),de("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError),de("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,o=t;return Number.isInteger(t)&&Math.abs(t)>_(2,32)?o=Pe(String(t)):typeof t=="bigint"&&(o=String(t),(t>_(BigInt(2),BigInt(32))||t<-_(BigInt(2),BigInt(32)))&&(o=Pe(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);function Pe(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function it(r,e,t){z(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&te(e,r.length-(t+1))}function Ue(r,e,t,n,o,a){if(r>t||r<e){let u=typeof e=="bigint"?"n":"",g;throw a>3?e===0||e===BigInt(0)?g=`>= 0${u} and < 2${u} ** ${(a+1)*8}${u}`:g=`>= -(2${u} ** ${(a+1)*8-1}${u}) and < 2 ** ${(a+1)*8-1}${u}`:g=`>= ${e}${u} and <= ${t}${u}`,new H.ERR_OUT_OF_RANGE("value",g,r)}it(n,o,a)}function z(r,e){if(typeof r!="number")throw new H.ERR_INVALID_ARG_TYPE(e,"number",r)}function te(r,e,t){throw Math.floor(r)!==r?(z(r,t),new H.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new H.ERR_BUFFER_OUT_OF_BOUNDS:new H.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}let ot=/[^+/0-9A-Za-z-_]/g;function st(r){if(r=r.split("=")[0],r=r.trim().replace(ot,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function ge(r,e){e=e||1/0;let t,n=r.length,o=null,a=[];for(let u=0;u<n;++u){if(t=r.charCodeAt(u),t>55295&&t<57344){if(!o){if(t>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(u+1===n){(e-=3)>-1&&a.push(239,191,189);continue}o=t;continue}if(t<56320){(e-=3)>-1&&a.push(239,191,189),o=t;continue}t=(o-55296<<10|t-56320)+65536}else o&&(e-=3)>-1&&a.push(239,191,189);if(o=null,t<128){if((e-=1)<0)break;a.push(t)}else if(t<2048){if((e-=2)<0)break;a.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;a.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;a.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return a}function at(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function ct(r,e){let t,n,o,a=[];for(let u=0;u<r.length&&!((e-=2)<0);++u)t=r.charCodeAt(u),n=t>>8,o=t%256,a.push(o),a.push(n);return a}function Te(r){return p.toByteArray(st(r))}function ue(r,e,t,n){let o;for(o=0;o<n&&!(o+t>=e.length||o>=r.length);++o)e[o+t]=r[o];return o}function V(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function me(r){return r!==r}let ut=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let o=0;o<16;++o)e[n+o]=r[t]+r[o]}return e}();function J(r){return typeof BigInt=="undefined"?lt:r}function lt(){throw new Error("BigInt not supported")}return Y}var X=bt();X.Buffer;X.SlowBuffer;X.INSPECT_MAX_BYTES;X.kMaxLength;var T=X.Buffer,Pt=X.INSPECT_MAX_BYTES,Ut=X.kMaxLength;var ie=require("bs58"),Q=It(require("@noble/ed25519"));var W=class p{static generateKey(){let i=Q.utils.randomPrivateKey(),c=(0,ie.encode)(i);return new p(c)}constructor(i){this.secretKey=i;let c=(0,ie.decode)(i);this.privateKey=T.from(c).toString("hex")}sign(i){return B(this,null,function*(){return yield Q.signAsync(i,this.privateKey)})}getPublicKey(){return B(this,null,function*(){let i=yield Q.getPublicKeyAsync(this.privateKey);return`ed25519:${(0,ie.encode)(i)}`})}};var oe=class{constructor(i="testnet"){this.networkId=i}get keyPrefix(){return`orderly_${this.networkId}_`}},Z=class extends oe{getOrderlyKey(i){let c;if(i)c=this.getItem(i,"orderlyKey");else{let l=this.getAddress();if(!l)return null;c=this.getItem(l,"orderlyKey")}return c?new W(c):null}getAccountId(i){return this.getItem(i,"accountId")}setAccountId(i,c){this.setItem(i,{accountId:c})}getAddress(){return localStorage.getItem(`${this.keyPrefix}address`)}setAddress(i){localStorage.setItem(`${this.keyPrefix}address`,i)}generateKey(){return W.generateKey()}setKey(i,c){this.setItem(i,{orderlyKey:c.secretKey})}cleanAllKey(i){localStorage.removeItem(`${this.keyPrefix}${i}`),localStorage.removeItem(`${this.keyPrefix}address`)}cleanKey(i,c){let l=this.getItem(i);delete l[c],localStorage.setItem(`${this.keyPrefix}${i}`,JSON.stringify(l))}setItem(i,c){let l=`${this.keyPrefix}${i}`,h=localStorage.getItem(l);h?h=JSON.parse(h):h={},localStorage.setItem(l,JSON.stringify(F(F({},h),c)))}getItem(i,c){let l=`${this.keyPrefix}${i}`,h=localStorage.getItem(l);return h?h=JSON.parse(h):h={},typeof c=="undefined"?h:h[c]}},ee=class{constructor(i){this.secretKey=i}generateKey(){return new W(this.secretKey)}getOrderlyKey(){return new W(this.secretKey)}getAccountId(){return""}setAccountId(i){}getAddress(){return""}setAddress(i){}setKey(i,c){}cleanAllKey(){}cleanKey(i){}};var se={EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],Registration:[{name:"brokerId",type:"string"},{name:"chainId",type:"uint256"},{name:"timestamp",type:"uint64"},{name:"registrationNonce",type:"uint256"}],Withdraw:[{name:"brokerId",type:"string"},{name:"chainId",type:"uint256"},{name:"receiver",type:"address"},{name:"token",type:"string"},{name:"amount",type:"uint256"},{name:"withdrawNonce",type:"uint64"},{name:"timestamp",type:"uint64"}],AddOrderlyKey:[{name:"brokerId",type:"string"},{name:"chainId",type:"uint256"},{name:"orderlyKey",type:"string"},{name:"scope",type:"string"},{name:"timestamp",type:"uint64"},{name:"expiration",type:"uint64"}],SettlePnl:[{name:"brokerId",type:"string"},{name:"chainId",type:"uint256"},{name:"settleNonce",type:"uint64"},{name:"timestamp",type:"uint64"}]};var ve=function(p){return p.replace(/\+/g,"-").replace(/\//g,"_")};function At(){return"0x8794E7260517B1766fc7b55cAfcd56e6bf08600e"}function De(p,i){return{name:"Orderly",version:"1",chainId:p,verifyingContract:i?At():"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"}}function Le(p){let{chainId:i,registrationNonce:c}=p,l=Date.now(),h="Registration",y={brokerId:"woofi_dex",chainId:i,timestamp:l,registrationNonce:c},s={EIP712Domain:se.EIP712Domain,[h]:se[h]};return[y,{domain:De(i),message:y,primaryType:h,types:s}]}function Fe(p){let{publicKey:i,chainId:c,primaryType:l,expiration:h=365}=p,y=Date.now(),s={brokerId:"woofi_dex",orderlyKey:i,scope:"read,trading",chainId:c,timestamp:y,expiration:y+1e3*60*60*24*h},w={EIP712Domain:se.EIP712Domain,[l]:se[l]},f={domain:De(c),message:s,primaryType:l,types:w};return[s,f]}var G=class{constructor(i){this.keyStore=i}sign(i){return B(this,null,function*(){let c=new URL(i.url),l=Date.now().toString(),h=[l,i.method.toUpperCase(),c.pathname+c.search].join("");i.data&&Object.keys(i.data).length&&(h+=JSON.stringify(i.data));let{signature:y,publicKey:s}=yield this.signText(h);return{"orderly-key":s,"orderly-timestamp":l,"orderly-signature":y}})}signText(i){return B(this,null,function*(){let c=this.keyStore.getOrderlyKey();if(!c)throw new Error("orderlyKeyPair is not defined");let l=T.from(i),h=yield c.sign(l),y=T.from(h).toString("base64");return{signature:ve(y),publicKey:yield c.getPublicKey()}})}};var ae=class{constructor(){this._restore()}_restore(){this.map=new Map([["apiBaseUrl","https://dev-api-v2.orderly.org/v1"],["klineDataUrl","https://dev-api-v2.orderly.org"]])}get(i){return this.map.get(i)}set(i,c){this.map.set(i,c)}clear(){}},fe=class extends ae{constructor(c){super();this.configMap=c}_restore(){let c=Object.entries(this.configMap);this.map=new Map(c)}};var je=p=>{let i=new ee(p||"AFmQSju4FhDwG93cMdKogcnKx7SWmViDtDv5PVzfvRDF");return new G(i)},Ve=()=>{if(typeof window=="undefined")throw new Error("the default signer only supports browsers.");let p=new Z("");return new G(p)};var we=class{constructor(i=[],c={}){this.providers=i;this.services=c;this.injectProperties={}}register(...i){this.providers.push(...i),i.forEach(c=>{let l=c;l instanceof Function&&(l=new c),this.add(l)})}registerByName(i,c){let l=c;l instanceof Function&&(l=new c),this.addByName(i,l)}get(i){return this.services[i]}getAll(){return Object.assign({},this.services)}add(i){return this.addByName(i.constructor.name,i)}addByName(i,c){return this.services[i]=c,this.services[i.toLowerCase()]=c,this.injectIntoProperties(c,i),this.get(i)}inject(i,c,l){i&&l&&(i[c]=l)}injectIntoProperties(i,c=i.constructor.name){this.getInjectProperty(c.toLowerCase()).forEach(l=>{this.inject(l.target,l.propertyKey,i)})}getInjectProperty(i){return this.injectProperties[i]||(this.injectProperties[i]=[]),this.injectProperties[i]}},qe=we;var Ie=class p{static getContainer(){return p.container||(p.container=new qe),p.container}static register(...i){this.getContainer().register(...i)}static registerByName(i,c){this.getContainer().registerByName(i,c)}static get(i){return this.getContainer().get(i)}static getAll(){return this.getContainer().getAll()}constructor(){}},We=Ie;var Ge=require("rxjs");var O=require("@orderly.network/types");var ce=class{constructor(i,c,l){this.configStore=i;this.keyStore=c;this.walletAdapterClass=l;this._state$=new Ge.BehaviorSubject({status:O.AccountStatusEnum.NotConnected,balance:"",leverage:Number.NaN})}login(i){if(!i)throw new Error("address is required")}logout(){}setAddress(i,c){return B(this,null,function*(){if(!i)throw new Error("address is required");return this.keyStore.setAddress(i),this._state$.next(q(F({},this.stateValue),{status:O.AccountStatusEnum.Connected,address:i})),c&&(this.walletClient=new this.walletAdapterClass(c)),yield this._checkAccount(i)})}get state$(){return this._state$}get stateValue(){return this._state$.getValue()}get accountId(){return this.stateValue.accountId}set position(i){this._state$.next(q(F({},this.stateValue),{positon:i}))}set orders(i){this._state$.next(q(F({},this.stateValue),{orders:i}))}_checkAccount(i){return B(this,null,function*(){console.log("check account is esist");try{let c=yield this._checkAccountExist(i);if(console.log("accountInfo:",c),c&&c.account_id)console.log("account is exist"),this.keyStore.setAccountId(i,c.account_id),this._state$.next(q(F({},this.stateValue),{status:O.AccountStatusEnum.SignedIn,accountId:c.account_id,userId:c.user_id}));else return O.AccountStatusEnum.NotSignedIn;let l=this.keyStore.getOrderlyKey(i);if(console.log("orderlyKey:",l),!l)return console.log("orderlyKey is null"),this._state$.next(q(F({},this.stateValue),{status:O.AccountStatusEnum.DisabledTrading})),O.AccountStatusEnum.DisabledTrading;let h=yield l.getPublicKey(),y=yield this._checkOrderlyKeyState(c.account_id,h);if(console.log("orderlyKeyStatus:",y),y&&y.orderly_key&&y.key_status==="ACTIVE"){let s=Date.now(),w=y.expiration;return s>w?(this.keyStore.cleanKey(i,"orderlyKey"),O.AccountStatusEnum.DisabledTrading):(this._state$.next(q(F({},this.stateValue),{status:O.AccountStatusEnum.EnableTrading})),O.AccountStatusEnum.EnableTrading)}return this.keyStore.cleanKey(i,"orderlyKey"),O.AccountStatusEnum.NotConnected}catch(c){console.log("\u68C0\u67E5\u8D26\u6237\u72B6\u6001\u9519\u8BEF:",c)}return O.AccountStatusEnum.NotSignedIn})}_checkAccountExist(i){return B(this,null,function*(){let c=yield this._simpleFetch(`/get_account?address=${i}&broker_id=woofi_dex`);if(c.success)return c.data;throw new Error(c.message)})}createAccount(){return B(this,null,function*(){let i=yield this._getRegisterationNonce();console.log("nonce:",i);let l=yield this.keyStore.generateKey().getPublicKey(),h=this.stateValue.address;if(!h)throw new Error("address is undefined");let[y,s]=Le({registrationNonce:i,chainId:this.walletClient.chainId}),w=yield this.walletClient.send("eth_signTypedData_v4",[h,JSON.stringify(s)]),f=yield this._simpleFetch("/register_account",{method:"POST",body:JSON.stringify({signature:w,message:y,userAddress:h}),headers:{"Content-Type":"application/json"}});if(console.log("createAccount:",f),f.success)return this.keyStore.setAccountId(h,f.data.account_id),this._state$.next(q(F({},this.stateValue),{status:O.AccountStatusEnum.SignedIn,accountId:f.data.account_id,userId:f.data.user_id})),f})}createOrderlyKey(i){return B(this,null,function*(){if(this.stateValue.accountId===void 0)throw new Error("account id is undefined");if(this.walletClient===void 0)throw new Error("walletClient is undefined");let c="AddOrderlyKey",l=this.keyStore.generateKey(),h=yield l.getPublicKey(),[y,s]=Fe({publicKey:h,chainId:this.walletClient.chainId,primaryType:c,expiration:i}),w=this.stateValue.address;if(!w)throw new Error("address is undefined");console.log("message:",y,s,w);let f=yield this.walletClient.send("eth_signTypedData_v4",[w,JSON.stringify(s)]),P=yield this._simpleFetch("/orderly_key",{method:"POST",body:JSON.stringify({signature:f,message:y,userAddress:w}),headers:{"X-Account-Id":this.stateValue.accountId,"Content-Type":"application/json"}});if(P.success)return this.keyStore.setKey(w,l),this._state$.next(q(F({},this.stateValue),{status:O.AccountStatusEnum.EnableTrading})),P;throw new Error(P.message)})}disconnect(){return B(this,null,function*(){this._state$.next(q(F({},this.stateValue),{status:O.AccountStatusEnum.NotConnected,accountId:void 0,userId:void 0,address:void 0}))})}_checkOrderlyKeyState(i,c){return B(this,null,function*(){let l=yield this._simpleFetch(`/get_orderly_key?account_id=${i}&orderly_key=${c}`);if(l.success)return l.data;throw new Error(l.message)})}get signer(){return this._singer||(this._singer=new G(this.keyStore)),this._singer}getAccountInfo(){return B(this,null,function*(){})}getBalance(){return B(this,null,function*(){})}_getRegisterationNonce(){return B(this,null,function*(){var c;let i=yield this._simpleFetch("/registration_nonce");if(console.log("getRegisterationNonce:",i),i.success)return(c=i.data)==null?void 0:c.registration_nonce;throw new Error(i.message)})}_simpleFetch(l){return B(this,arguments,function*(i,c={}){let h=`${this.configStore.get("apiBaseUrl")}${i}`;return fetch(h,c).then(y=>y.json())})}};ce.instanceName="account";var pe=class{constructor(i){this.web3=i}getBalance(i){return B(this,null,function*(){return yield this.web3.eth.getBalance(i)})}deposit(i,c,l){return B(this,null,function*(){return yield this.web3.eth.sendTransaction({from:i,to:c,value:l})})}send(i,c){return B(this,null,function*(){})}};var ye=require("ethers");var he=class{constructor(i){console.log("EtherAdapter constructor",i),this._chainId=parseInt(i.chain.id,16),this.provider=new ye.BrowserProvider(i.provider,"any")}getBalance(i){throw new Error("Method not implemented.")}deposit(i,c,l){throw new Error("Method not implemented.")}get chainId(){return this._chainId}send(i,c){return B(this,null,function*(){var l;return yield(l=this.provider)==null?void 0:l.send(i,c)})}verify(i,c){return B(this,null,function*(){let{domain:l,types:h,message:y}=i,s=ye.ethers.verifyTypedData(l,h,y,c);console.log("recovered",s)})}};0&&(module.exports={Account,BaseConfigStore,BaseKeyStore,BaseOrderlyKeyPair,BaseSigner,EtherAdapter,LocalStorageStore,MemoryConfigStore,MockKeyStore,SimpleDI,Web3WalletAdapter,getDefaultSigner,getMockSigner});
2
2
  /*! Bundled license information:
3
3
 
4
4
  @jspm/core/nodelibs/browser/buffer.js: