@corpus-core/colibri-tor 1.1.22

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.
Files changed (93) hide show
  1. package/README.md +90 -0
  2. package/dist/browser.d.ts +48 -0
  3. package/dist/browser.js +96 -0
  4. package/dist/index.d.ts +25 -0
  5. package/dist/index.js +24 -0
  6. package/dist/node.d.ts +34 -0
  7. package/dist/node.js +275 -0
  8. package/dist/types.d.ts +39 -0
  9. package/dist/types.js +23 -0
  10. package/node_modules/tor-js/README.md +166 -0
  11. package/node_modules/tor-js/dist/Log.d.ts +24 -0
  12. package/node_modules/tor-js/dist/Log.d.ts.map +1 -0
  13. package/node_modules/tor-js/dist/TorClient.d.ts +37 -0
  14. package/node_modules/tor-js/dist/TorClient.d.ts.map +1 -0
  15. package/node_modules/tor-js/dist/commonExports.d.ts +6 -0
  16. package/node_modules/tor-js/dist/commonExports.d.ts.map +1 -0
  17. package/node_modules/tor-js/dist/entryPoints/wasm-base64/index.d.ts +3 -0
  18. package/node_modules/tor-js/dist/entryPoints/wasm-base64/index.d.ts.map +1 -0
  19. package/node_modules/tor-js/dist/entryPoints/wasm-base64/index.js +2139 -0
  20. package/node_modules/tor-js/dist/entryPoints/wasm-base64/index.js.map +1 -0
  21. package/node_modules/tor-js/dist/entryPoints/wasm-base64/singleton.d.ts +4 -0
  22. package/node_modules/tor-js/dist/entryPoints/wasm-base64/singleton.d.ts.map +1 -0
  23. package/node_modules/tor-js/dist/entryPoints/wasm-base64/singleton.js +2187 -0
  24. package/node_modules/tor-js/dist/entryPoints/wasm-base64/singleton.js.map +1 -0
  25. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/index.d.ts +3 -0
  26. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/index.d.ts.map +1 -0
  27. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/index.js +2242 -0
  28. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/index.js.map +1 -0
  29. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/singleton.d.ts +4 -0
  30. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/singleton.d.ts.map +1 -0
  31. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/singleton.js +2290 -0
  32. package/node_modules/tor-js/dist/entryPoints/wasm-cdn/singleton.js.map +1 -0
  33. package/node_modules/tor-js/dist/entryPoints/wasm-file/index.d.ts +3 -0
  34. package/node_modules/tor-js/dist/entryPoints/wasm-file/index.d.ts.map +1 -0
  35. package/node_modules/tor-js/dist/entryPoints/wasm-file/index.js +2139 -0
  36. package/node_modules/tor-js/dist/entryPoints/wasm-file/index.js.map +1 -0
  37. package/node_modules/tor-js/dist/entryPoints/wasm-file/singleton.d.ts +4 -0
  38. package/node_modules/tor-js/dist/entryPoints/wasm-file/singleton.d.ts.map +1 -0
  39. package/node_modules/tor-js/dist/entryPoints/wasm-file/singleton.js +2187 -0
  40. package/node_modules/tor-js/dist/entryPoints/wasm-file/singleton.js.map +1 -0
  41. package/node_modules/tor-js/dist/helpers.d.ts +7 -0
  42. package/node_modules/tor-js/dist/helpers.d.ts.map +1 -0
  43. package/node_modules/tor-js/dist/polyfills.d.ts +1 -0
  44. package/node_modules/tor-js/dist/polyfills.d.ts.map +1 -0
  45. package/node_modules/tor-js/dist/singleton.d.ts +24 -0
  46. package/node_modules/tor-js/dist/singleton.d.ts.map +1 -0
  47. package/node_modules/tor-js/dist/socketProvider.d.ts +76 -0
  48. package/node_modules/tor-js/dist/socketProvider.d.ts.map +1 -0
  49. package/node_modules/tor-js/dist/storage/filesystem.d.ts +18 -0
  50. package/node_modules/tor-js/dist/storage/filesystem.d.ts.map +1 -0
  51. package/node_modules/tor-js/dist/storage/index.d.ts +7 -0
  52. package/node_modules/tor-js/dist/storage/index.d.ts.map +1 -0
  53. package/node_modules/tor-js/dist/storage/indexeddb.d.ts +14 -0
  54. package/node_modules/tor-js/dist/storage/indexeddb.d.ts.map +1 -0
  55. package/node_modules/tor-js/dist/storage/locking.d.ts +15 -0
  56. package/node_modules/tor-js/dist/storage/locking.d.ts.map +1 -0
  57. package/node_modules/tor-js/dist/storage/memory.d.ts +13 -0
  58. package/node_modules/tor-js/dist/storage/memory.d.ts.map +1 -0
  59. package/node_modules/tor-js/dist/storage/node-deps.d.ts +8 -0
  60. package/node_modules/tor-js/dist/storage/node-deps.d.ts.map +1 -0
  61. package/node_modules/tor-js/dist/tor_js_bg.wasm +0 -0
  62. package/node_modules/tor-js/dist/types.d.ts +41 -0
  63. package/node_modules/tor-js/dist/types.d.ts.map +1 -0
  64. package/node_modules/tor-js/dist/wasm-B6es-efC.d.ts +302 -0
  65. package/node_modules/tor-js/dist/wasm-pkg/tor_js.d.ts +311 -0
  66. package/node_modules/tor-js/dist/wasm-pkg/tor_js.js +1159 -0
  67. package/node_modules/tor-js/dist/wasm.d.ts +31 -0
  68. package/node_modules/tor-js/dist/wasm.d.ts.map +1 -0
  69. package/node_modules/tor-js/package.json +61 -0
  70. package/node_modules/tor-js/src/Log.ts +100 -0
  71. package/node_modules/tor-js/src/TorClient.ts +134 -0
  72. package/node_modules/tor-js/src/commonExports.ts +7 -0
  73. package/node_modules/tor-js/src/entryPoints/wasm-base64/index.ts +17 -0
  74. package/node_modules/tor-js/src/entryPoints/wasm-base64/singleton.ts +7 -0
  75. package/node_modules/tor-js/src/entryPoints/wasm-cdn/index.ts +155 -0
  76. package/node_modules/tor-js/src/entryPoints/wasm-cdn/singleton.ts +7 -0
  77. package/node_modules/tor-js/src/entryPoints/wasm-file/index.ts +19 -0
  78. package/node_modules/tor-js/src/entryPoints/wasm-file/singleton.ts +7 -0
  79. package/node_modules/tor-js/src/globals.d.ts +2 -0
  80. package/node_modules/tor-js/src/helpers.ts +20 -0
  81. package/node_modules/tor-js/src/polyfills.ts +4 -0
  82. package/node_modules/tor-js/src/singleton.ts +54 -0
  83. package/node_modules/tor-js/src/socketProvider.ts +405 -0
  84. package/node_modules/tor-js/src/storage/filesystem.ts +171 -0
  85. package/node_modules/tor-js/src/storage/index.ts +21 -0
  86. package/node_modules/tor-js/src/storage/indexeddb.ts +99 -0
  87. package/node_modules/tor-js/src/storage/locking.ts +195 -0
  88. package/node_modules/tor-js/src/storage/memory.ts +42 -0
  89. package/node_modules/tor-js/src/storage/node-deps.ts +23 -0
  90. package/node_modules/tor-js/src/types.ts +48 -0
  91. package/node_modules/tor-js/src/wasm-base64-data.d.ts +3 -0
  92. package/node_modules/tor-js/src/wasm.ts +135 -0
  93. package/package.json +67 -0
@@ -0,0 +1,1159 @@
1
+ /* @ts-self-types="./tor_js.d.ts" */
2
+
3
+ export class IntoUnderlyingByteSource {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ IntoUnderlyingByteSourceFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
13
+ }
14
+ /**
15
+ * @returns {number}
16
+ */
17
+ get autoAllocateChunkSize() {
18
+ const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
19
+ return ret >>> 0;
20
+ }
21
+ cancel() {
22
+ const ptr = this.__destroy_into_raw();
23
+ wasm.intounderlyingbytesource_cancel(ptr);
24
+ }
25
+ /**
26
+ * @param {ReadableByteStreamController} controller
27
+ * @returns {Promise<any>}
28
+ */
29
+ pull(controller) {
30
+ const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, controller);
31
+ return ret;
32
+ }
33
+ /**
34
+ * @param {ReadableByteStreamController} controller
35
+ */
36
+ start(controller) {
37
+ wasm.intounderlyingbytesource_start(this.__wbg_ptr, controller);
38
+ }
39
+ /**
40
+ * @returns {ReadableStreamType}
41
+ */
42
+ get type() {
43
+ const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
44
+ return __wbindgen_enum_ReadableStreamType[ret];
45
+ }
46
+ }
47
+ if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
48
+
49
+ export class IntoUnderlyingSink {
50
+ __destroy_into_raw() {
51
+ const ptr = this.__wbg_ptr;
52
+ this.__wbg_ptr = 0;
53
+ IntoUnderlyingSinkFinalization.unregister(this);
54
+ return ptr;
55
+ }
56
+ free() {
57
+ const ptr = this.__destroy_into_raw();
58
+ wasm.__wbg_intounderlyingsink_free(ptr, 0);
59
+ }
60
+ /**
61
+ * @param {any} reason
62
+ * @returns {Promise<any>}
63
+ */
64
+ abort(reason) {
65
+ const ptr = this.__destroy_into_raw();
66
+ const ret = wasm.intounderlyingsink_abort(ptr, reason);
67
+ return ret;
68
+ }
69
+ /**
70
+ * @returns {Promise<any>}
71
+ */
72
+ close() {
73
+ const ptr = this.__destroy_into_raw();
74
+ const ret = wasm.intounderlyingsink_close(ptr);
75
+ return ret;
76
+ }
77
+ /**
78
+ * @param {any} chunk
79
+ * @returns {Promise<any>}
80
+ */
81
+ write(chunk) {
82
+ const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, chunk);
83
+ return ret;
84
+ }
85
+ }
86
+ if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
87
+
88
+ export class IntoUnderlyingSource {
89
+ static __wrap(ptr) {
90
+ ptr = ptr >>> 0;
91
+ const obj = Object.create(IntoUnderlyingSource.prototype);
92
+ obj.__wbg_ptr = ptr;
93
+ IntoUnderlyingSourceFinalization.register(obj, obj.__wbg_ptr, obj);
94
+ return obj;
95
+ }
96
+ __destroy_into_raw() {
97
+ const ptr = this.__wbg_ptr;
98
+ this.__wbg_ptr = 0;
99
+ IntoUnderlyingSourceFinalization.unregister(this);
100
+ return ptr;
101
+ }
102
+ free() {
103
+ const ptr = this.__destroy_into_raw();
104
+ wasm.__wbg_intounderlyingsource_free(ptr, 0);
105
+ }
106
+ cancel() {
107
+ const ptr = this.__destroy_into_raw();
108
+ wasm.intounderlyingsource_cancel(ptr);
109
+ }
110
+ /**
111
+ * @param {ReadableStreamDefaultController} controller
112
+ * @returns {Promise<any>}
113
+ */
114
+ pull(controller) {
115
+ const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, controller);
116
+ return ret;
117
+ }
118
+ }
119
+ if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
120
+
121
+ /**
122
+ * Tor client for making HTTP requests through the Tor network
123
+ */
124
+ export class TorClient {
125
+ static __wrap(ptr) {
126
+ ptr = ptr >>> 0;
127
+ const obj = Object.create(TorClient.prototype);
128
+ obj.__wbg_ptr = ptr;
129
+ TorClientFinalization.register(obj, obj.__wbg_ptr, obj);
130
+ return obj;
131
+ }
132
+ __destroy_into_raw() {
133
+ const ptr = this.__wbg_ptr;
134
+ this.__wbg_ptr = 0;
135
+ TorClientFinalization.unregister(this);
136
+ return ptr;
137
+ }
138
+ free() {
139
+ const ptr = this.__destroy_into_raw();
140
+ wasm.__wbg_torclient_free(ptr, 0);
141
+ }
142
+ /**
143
+ * Close the TorClient and release resources
144
+ * @returns {Promise<any>}
145
+ */
146
+ close() {
147
+ const ret = wasm.torclient_close(this.__wbg_ptr);
148
+ return ret;
149
+ }
150
+ /**
151
+ * Create a new TorClient with the given options.
152
+ *
153
+ * This is an async operation that returns a Promise.
154
+ * The client will bootstrap and establish a connection to the Tor network.
155
+ *
156
+ * Usage from JS: `const client = await TorClient.create(options);`
157
+ * @param {TorClientOptions} options
158
+ * @returns {Promise<any>}
159
+ */
160
+ static create(options) {
161
+ _assertClass(options, TorClientOptions);
162
+ var ptr0 = options.__destroy_into_raw();
163
+ const ret = wasm.torclient_create(ptr0);
164
+ return ret;
165
+ }
166
+ /**
167
+ * Make an HTTP fetch request through Tor
168
+ *
169
+ * Returns a Promise that resolves to a standard browser `Response` object
170
+ * as soon as response headers are received. The body is a `ReadableStream`
171
+ * that reads from the Tor circuit on demand.
172
+ * @param {string} url
173
+ * @param {any} init
174
+ * @returns {Promise<any>}
175
+ */
176
+ fetch(url, init) {
177
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
178
+ const len0 = WASM_VECTOR_LEN;
179
+ const ret = wasm.torclient_fetch(this.__wbg_ptr, ptr0, len0, init);
180
+ return ret;
181
+ }
182
+ /**
183
+ * Wait until the client is ready for traffic (connection usable + valid directory).
184
+ * @returns {Promise<any>}
185
+ */
186
+ ready() {
187
+ const ret = wasm.torclient_ready(this.__wbg_ptr);
188
+ return ret;
189
+ }
190
+ }
191
+ if (Symbol.dispose) TorClient.prototype[Symbol.dispose] = TorClient.prototype.free;
192
+
193
+ /**
194
+ * Options for creating a TorClient
195
+ */
196
+ export class TorClientOptions {
197
+ static __wrap(ptr) {
198
+ ptr = ptr >>> 0;
199
+ const obj = Object.create(TorClientOptions.prototype);
200
+ obj.__wbg_ptr = ptr;
201
+ TorClientOptionsFinalization.register(obj, obj.__wbg_ptr, obj);
202
+ return obj;
203
+ }
204
+ __destroy_into_raw() {
205
+ const ptr = this.__wbg_ptr;
206
+ this.__wbg_ptr = 0;
207
+ TorClientOptionsFinalization.unregister(this);
208
+ return ptr;
209
+ }
210
+ free() {
211
+ const ptr = this.__destroy_into_raw();
212
+ wasm.__wbg_torclientoptions_free(ptr, 0);
213
+ }
214
+ /**
215
+ * Create options with a connect function.
216
+ *
217
+ * The connect function receives a target address string (e.g. "198.51.100.1:9001")
218
+ * and must return a Promise resolving to a socket object with:
219
+ * - `send(data: Uint8Array)` — send binary data
220
+ * - `onmessage: ((data: Uint8Array) => void) | null` — receive callback
221
+ * - `onclose: (() => void) | null` — close notification
222
+ * - `close()` — close the socket
223
+ *
224
+ * The TS wrapper provides this automatically via the Gateway class.
225
+ * @param {Function} connect
226
+ */
227
+ constructor(connect) {
228
+ const ret = wasm.torclientoptions_new(connect);
229
+ this.__wbg_ptr = ret >>> 0;
230
+ TorClientOptionsFinalization.register(this, this.__wbg_ptr, this);
231
+ return this;
232
+ }
233
+ /**
234
+ * Set a callback that provides bootstrap.zip bytes for fast directory pre-population.
235
+ *
236
+ * The callback should be `() => Promise<Uint8Array>` returning the uncompressed
237
+ * bootstrap.zip bytes (from a tor-js-gateway server).
238
+ *
239
+ * When set and storage has no cached consensus, the zip is parsed and the
240
+ * directory cache is pre-populated before bootstrap begins.
241
+ * @param {Function} callback
242
+ * @returns {TorClientOptions}
243
+ */
244
+ withFastBootstrap(callback) {
245
+ const ptr = this.__destroy_into_raw();
246
+ const ret = wasm.torclientoptions_withFastBootstrap(ptr, callback);
247
+ return TorClientOptions.__wrap(ret);
248
+ }
249
+ /**
250
+ * Set a custom storage implementation for persistent state.
251
+ *
252
+ * When set, the Tor client will persist guard selection and other state
253
+ * to this storage, allowing faster reconnection across page reloads.
254
+ *
255
+ * If not set, in-memory storage is used (state lost on page reload).
256
+ *
257
+ * # Arguments
258
+ * * `storage` - A JavaScript object implementing the TorStorage interface
259
+ * @param {TorStorage} storage
260
+ * @returns {TorClientOptions}
261
+ */
262
+ withStorage(storage) {
263
+ const ptr = this.__destroy_into_raw();
264
+ const ret = wasm.torclientoptions_withStorage(ptr, storage);
265
+ return TorClientOptions.__wrap(ret);
266
+ }
267
+ }
268
+ if (Symbol.dispose) TorClientOptions.prototype[Symbol.dispose] = TorClientOptions.prototype.free;
269
+
270
+ /**
271
+ * Initialize the tor-js WASM module
272
+ *
273
+ * This must be called before creating any TorClient instances.
274
+ * Sets up panic hooks and logging infrastructure.
275
+ *
276
+ * The optional `log_level` parameter sets the initial log level:
277
+ * "trace", "debug", "info", "warn", or "error". Defaults to "debug".
278
+ * The level can be changed later with `setLogLevel()`.
279
+ * @param {string | null} [log_level]
280
+ */
281
+ export function init(log_level) {
282
+ var ptr0 = isLikeNone(log_level) ? 0 : passStringToWasm0(log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
283
+ var len0 = WASM_VECTOR_LEN;
284
+ const ret = wasm.init(ptr0, len0);
285
+ if (ret[1]) {
286
+ throw takeFromExternrefTable0(ret[0]);
287
+ }
288
+ }
289
+
290
+ /**
291
+ * Set a callback function to receive log messages
292
+ *
293
+ * The callback receives three arguments: (level: string, target: string, message: string)
294
+ * @param {Function} callback
295
+ */
296
+ export function setLogCallback(callback) {
297
+ wasm.setLogCallback(callback);
298
+ }
299
+
300
+ /**
301
+ * Dynamically update the minimum log level.
302
+ *
303
+ * Called from JS when the broadest requested level across all clients changes.
304
+ * @param {string} level
305
+ */
306
+ export function setLogLevel(level) {
307
+ const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
308
+ const len0 = WASM_VECTOR_LEN;
309
+ const ret = wasm.setLogLevel(ptr0, len0);
310
+ if (ret[1]) {
311
+ throw takeFromExternrefTable0(ret[0]);
312
+ }
313
+ }
314
+
315
+ function __wbg_get_imports() {
316
+ const import0 = {
317
+ __proto__: null,
318
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
319
+ const ret = Error(getStringFromWasm0(arg0, arg1));
320
+ return ret;
321
+ },
322
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
323
+ const ret = String(arg1);
324
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
325
+ const len1 = WASM_VECTOR_LEN;
326
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
327
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
328
+ },
329
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
330
+ const v = arg0;
331
+ const ret = typeof(v) === 'boolean' ? v : undefined;
332
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
333
+ },
334
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
335
+ const ret = debugString(arg1);
336
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
337
+ const len1 = WASM_VECTOR_LEN;
338
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
339
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
340
+ },
341
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
342
+ const ret = arg0 in arg1;
343
+ return ret;
344
+ },
345
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
346
+ const ret = typeof(arg0) === 'function';
347
+ return ret;
348
+ },
349
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
350
+ const ret = arg0 === null;
351
+ return ret;
352
+ },
353
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
354
+ const val = arg0;
355
+ const ret = typeof(val) === 'object' && val !== null;
356
+ return ret;
357
+ },
358
+ __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
359
+ const ret = typeof(arg0) === 'string';
360
+ return ret;
361
+ },
362
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
363
+ const ret = arg0 === undefined;
364
+ return ret;
365
+ },
366
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
367
+ const ret = arg0 == arg1;
368
+ return ret;
369
+ },
370
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
371
+ const obj = arg1;
372
+ const ret = typeof(obj) === 'number' ? obj : undefined;
373
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
374
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
375
+ },
376
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
377
+ const obj = arg1;
378
+ const ret = typeof(obj) === 'string' ? obj : undefined;
379
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
380
+ var len1 = WASM_VECTOR_LEN;
381
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
382
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
383
+ },
384
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
385
+ throw new Error(getStringFromWasm0(arg0, arg1));
386
+ },
387
+ __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
388
+ arg0._wbg_cb_unref();
389
+ },
390
+ __wbg_aborted_4789bfb2963583fb: function(arg0) {
391
+ const ret = arg0.aborted;
392
+ return ret;
393
+ },
394
+ __wbg_all_91078ec14f01cdc8: function(arg0) {
395
+ const ret = Promise.all(arg0);
396
+ return ret;
397
+ },
398
+ __wbg_append_608dfb635ee8998f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
399
+ arg0.append(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
400
+ }, arguments); },
401
+ __wbg_buffer_60b8043cd926067d: function(arg0) {
402
+ const ret = arg0.buffer;
403
+ return ret;
404
+ },
405
+ __wbg_byobRequest_6342e5f2b232c0f9: function(arg0) {
406
+ const ret = arg0.byobRequest;
407
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
408
+ },
409
+ __wbg_byteLength_607b856aa6c5a508: function(arg0) {
410
+ const ret = arg0.byteLength;
411
+ return ret;
412
+ },
413
+ __wbg_byteOffset_b26b63681c83856c: function(arg0) {
414
+ const ret = arg0.byteOffset;
415
+ return ret;
416
+ },
417
+ __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
418
+ const ret = arg0.call(arg1, arg2);
419
+ return ret;
420
+ }, arguments); },
421
+ __wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
422
+ const ret = arg0.call(arg1);
423
+ return ret;
424
+ }, arguments); },
425
+ __wbg_call_f858478a02f9600f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
426
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
427
+ return ret;
428
+ }, arguments); },
429
+ __wbg_clearTimeout_113b1cde814ec762: function(arg0) {
430
+ const ret = clearTimeout(arg0);
431
+ return ret;
432
+ },
433
+ __wbg_close_690d36108c557337: function() { return handleError(function (arg0) {
434
+ arg0.close();
435
+ }, arguments); },
436
+ __wbg_close_737b4b1fbc658540: function() { return handleError(function (arg0) {
437
+ arg0.close();
438
+ }, arguments); },
439
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
440
+ const ret = arg0.crypto;
441
+ return ret;
442
+ },
443
+ __wbg_delete_bddb69df015ae01b: function() { return handleError(function (arg0, arg1, arg2) {
444
+ const ret = arg0.delete(getStringFromWasm0(arg1, arg2));
445
+ return ret;
446
+ }, arguments); },
447
+ __wbg_digest_cb8de04aa7e6b6f1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
448
+ const ret = arg0.digest(getStringFromWasm0(arg1, arg2), arg3);
449
+ return ret;
450
+ }, arguments); },
451
+ __wbg_done_08ce71ee07e3bd17: function(arg0) {
452
+ const ret = arg0.done;
453
+ return ret;
454
+ },
455
+ __wbg_enqueue_ec3552838b4b7fbf: function() { return handleError(function (arg0, arg1) {
456
+ arg0.enqueue(arg1);
457
+ }, arguments); },
458
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
459
+ const ret = Object.entries(arg0);
460
+ return ret;
461
+ },
462
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
463
+ let deferred0_0;
464
+ let deferred0_1;
465
+ try {
466
+ deferred0_0 = arg0;
467
+ deferred0_1 = arg1;
468
+ console.error(getStringFromWasm0(arg0, arg1));
469
+ } finally {
470
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
471
+ }
472
+ },
473
+ __wbg_from_4bdf88943703fd48: function(arg0) {
474
+ const ret = Array.from(arg0);
475
+ return ret;
476
+ },
477
+ __wbg_getAll_576fde6e76c7d925: function() { return handleError(function (arg0, arg1, arg2) {
478
+ const ret = arg0.getAll(getStringFromWasm0(arg1, arg2));
479
+ return ret;
480
+ }, arguments); },
481
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
482
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
483
+ }, arguments); },
484
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
485
+ arg0.getRandomValues(arg1);
486
+ }, arguments); },
487
+ __wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
488
+ const ret = Reflect.get(arg0, arg1);
489
+ return ret;
490
+ }, arguments); },
491
+ __wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
492
+ const ret = Reflect.get(arg0, arg1);
493
+ return ret;
494
+ }, arguments); },
495
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
496
+ const ret = arg0[arg1 >>> 0];
497
+ return ret;
498
+ },
499
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
500
+ const ret = arg0[arg1 >>> 0];
501
+ return ret;
502
+ },
503
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
504
+ const ret = arg0[arg1];
505
+ return ret;
506
+ },
507
+ __wbg_instanceof_AbortSignal_0173156d14d8c44d: function(arg0) {
508
+ let result;
509
+ try {
510
+ result = arg0 instanceof AbortSignal;
511
+ } catch (_) {
512
+ result = false;
513
+ }
514
+ const ret = result;
515
+ return ret;
516
+ },
517
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
518
+ let result;
519
+ try {
520
+ result = arg0 instanceof ArrayBuffer;
521
+ } catch (_) {
522
+ result = false;
523
+ }
524
+ const ret = result;
525
+ return ret;
526
+ },
527
+ __wbg_instanceof_Crypto_5c2a4c15287b0332: function(arg0) {
528
+ let result;
529
+ try {
530
+ result = arg0 instanceof Crypto;
531
+ } catch (_) {
532
+ result = false;
533
+ }
534
+ const ret = result;
535
+ return ret;
536
+ },
537
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
538
+ let result;
539
+ try {
540
+ result = arg0 instanceof Uint8Array;
541
+ } catch (_) {
542
+ result = false;
543
+ }
544
+ const ret = result;
545
+ return ret;
546
+ },
547
+ __wbg_iterator_d8f549ec8fb061b1: function() {
548
+ const ret = Symbol.iterator;
549
+ return ret;
550
+ },
551
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
552
+ const ret = arg0.length;
553
+ return ret;
554
+ },
555
+ __wbg_length_ea16607d7b61445b: function(arg0) {
556
+ const ret = arg0.length;
557
+ return ret;
558
+ },
559
+ __wbg_log_524eedafa26daa59: function(arg0) {
560
+ console.log(arg0);
561
+ },
562
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
563
+ const ret = arg0.msCrypto;
564
+ return ret;
565
+ },
566
+ __wbg_new_0837727332ac86ba: function() { return handleError(function () {
567
+ const ret = new Headers();
568
+ return ret;
569
+ }, arguments); },
570
+ __wbg_new_227d7c05414eb861: function() {
571
+ const ret = new Error();
572
+ return ret;
573
+ },
574
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
575
+ const ret = new Uint8Array(arg0);
576
+ return ret;
577
+ },
578
+ __wbg_new_ab79df5bd7c26067: function() {
579
+ const ret = new Object();
580
+ return ret;
581
+ },
582
+ __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
583
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
584
+ return ret;
585
+ },
586
+ __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
587
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
588
+ return ret;
589
+ },
590
+ __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
591
+ try {
592
+ var state0 = {a: arg0, b: arg1};
593
+ var cb0 = (arg0, arg1) => {
594
+ const a = state0.a;
595
+ state0.a = 0;
596
+ try {
597
+ return wasm_bindgen__convert__closures_____invoke__hb864778e5a95f086(a, state0.b, arg0, arg1);
598
+ } finally {
599
+ state0.a = a;
600
+ }
601
+ };
602
+ const ret = new Promise(cb0);
603
+ return ret;
604
+ } finally {
605
+ state0.a = state0.b = 0;
606
+ }
607
+ },
608
+ __wbg_new_with_byte_offset_and_length_b2ec5bf7b2f35743: function(arg0, arg1, arg2) {
609
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
610
+ return ret;
611
+ },
612
+ __wbg_new_with_into_underlying_source_b45133df5ff75afa: function(arg0, arg1) {
613
+ const ret = new ReadableStream(IntoUnderlyingSource.__wrap(arg0), arg1);
614
+ return ret;
615
+ },
616
+ __wbg_new_with_length_3259a525196bd8cc: function(arg0) {
617
+ const ret = new Array(arg0 >>> 0);
618
+ return ret;
619
+ },
620
+ __wbg_new_with_length_825018a1616e9e55: function(arg0) {
621
+ const ret = new Uint8Array(arg0 >>> 0);
622
+ return ret;
623
+ },
624
+ __wbg_new_with_opt_readable_stream_and_init_15b79ab5fa39d080: function() { return handleError(function (arg0, arg1) {
625
+ const ret = new Response(arg0, arg1);
626
+ return ret;
627
+ }, arguments); },
628
+ __wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
629
+ const ret = arg0.next();
630
+ return ret;
631
+ }, arguments); },
632
+ __wbg_next_e01a967809d1aa68: function(arg0) {
633
+ const ret = arg0.next;
634
+ return ret;
635
+ },
636
+ __wbg_node_84ea875411254db1: function(arg0) {
637
+ const ret = arg0.node;
638
+ return ret;
639
+ },
640
+ __wbg_now_16f0c993d5dd6c27: function() {
641
+ const ret = Date.now();
642
+ return ret;
643
+ },
644
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
645
+ const ret = arg0.now();
646
+ return ret;
647
+ },
648
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
649
+ const ret = arg0.performance;
650
+ return ret;
651
+ },
652
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
653
+ const ret = arg0.process;
654
+ return ret;
655
+ },
656
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
657
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
658
+ },
659
+ __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
660
+ const ret = arg0.queueMicrotask;
661
+ return ret;
662
+ },
663
+ __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
664
+ queueMicrotask(arg0);
665
+ },
666
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
667
+ arg0.randomFillSync(arg1);
668
+ }, arguments); },
669
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
670
+ const ret = module.require;
671
+ return ret;
672
+ }, arguments); },
673
+ __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
674
+ const ret = Promise.resolve(arg0);
675
+ return ret;
676
+ },
677
+ __wbg_respond_e286ee502e7cf7e4: function() { return handleError(function (arg0, arg1) {
678
+ arg0.respond(arg1 >>> 0);
679
+ }, arguments); },
680
+ __wbg_setTimeout_ef24d2fc3ad97385: function() { return handleError(function (arg0, arg1) {
681
+ const ret = setTimeout(arg0, arg1);
682
+ return ret;
683
+ }, arguments); },
684
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
685
+ arg0[arg1 >>> 0] = arg2;
686
+ },
687
+ __wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
688
+ const ret = Reflect.set(arg0, arg1, arg2);
689
+ return ret;
690
+ }, arguments); },
691
+ __wbg_set_8c0b3ffcf05d61c2: function(arg0, arg1, arg2) {
692
+ arg0.set(getArrayU8FromWasm0(arg1, arg2));
693
+ },
694
+ __wbg_set_9b44de9403b9716a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
695
+ const ret = arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
696
+ return ret;
697
+ }, arguments); },
698
+ __wbg_set_headers_bf56980ea1a65acb: function(arg0, arg1) {
699
+ arg0.headers = arg1;
700
+ },
701
+ __wbg_set_high_water_mark_1ac059fa0566c2fc: function(arg0, arg1) {
702
+ arg0.highWaterMark = arg1;
703
+ },
704
+ __wbg_set_status_b80d37d9d23276c4: function(arg0, arg1) {
705
+ arg0.status = arg1;
706
+ },
707
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
708
+ const ret = arg1.stack;
709
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
710
+ const len1 = WASM_VECTOR_LEN;
711
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
712
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
713
+ },
714
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
715
+ const ret = typeof global === 'undefined' ? null : global;
716
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
717
+ },
718
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
719
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
720
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
721
+ },
722
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
723
+ const ret = typeof self === 'undefined' ? null : self;
724
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
725
+ },
726
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
727
+ const ret = typeof window === 'undefined' ? null : window;
728
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
729
+ },
730
+ __wbg_subarray_a068d24e39478a8a: function(arg0, arg1, arg2) {
731
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
732
+ return ret;
733
+ },
734
+ __wbg_subtle_c060fa3eb5c6248d: function(arg0) {
735
+ const ret = arg0.subtle;
736
+ return ret;
737
+ },
738
+ __wbg_then_098abe61755d12f6: function(arg0, arg1) {
739
+ const ret = arg0.then(arg1);
740
+ return ret;
741
+ },
742
+ __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
743
+ const ret = arg0.then(arg1, arg2);
744
+ return ret;
745
+ },
746
+ __wbg_torclient_new: function(arg0) {
747
+ const ret = TorClient.__wrap(arg0);
748
+ return ret;
749
+ },
750
+ __wbg_tryLock_5d7357252b3473bd: function() { return handleError(function (arg0) {
751
+ const ret = arg0.tryLock();
752
+ return ret;
753
+ }, arguments); },
754
+ __wbg_unlock_2d843e9896897e90: function() { return handleError(function (arg0) {
755
+ const ret = arg0.unlock();
756
+ return ret;
757
+ }, arguments); },
758
+ __wbg_value_21fc78aab0322612: function(arg0) {
759
+ const ret = arg0.value;
760
+ return ret;
761
+ },
762
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
763
+ const ret = arg0.versions;
764
+ return ret;
765
+ },
766
+ __wbg_view_f68a712e7315f8b2: function(arg0) {
767
+ const ret = arg0.view;
768
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
769
+ },
770
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
771
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 4083, function: Function { arguments: [Externref], shim_idx: 4084, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
772
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h9b79478a56146cd2, wasm_bindgen__convert__closures_____invoke__h5c591e637e5094b1);
773
+ return ret;
774
+ },
775
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
776
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 4450, function: Function { arguments: [], shim_idx: 4451, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
777
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h4d8dd6cb42c8a695, wasm_bindgen__convert__closures_____invoke__h69c112f8841b438b);
778
+ return ret;
779
+ },
780
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
781
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 4457, function: Function { arguments: [Externref], shim_idx: 4458, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
782
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1e3ac41672e7b2ad, wasm_bindgen__convert__closures_____invoke__hc2bcdd2c6020290d);
783
+ return ret;
784
+ },
785
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
786
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
787
+ const ret = getArrayU8FromWasm0(arg0, arg1);
788
+ return ret;
789
+ },
790
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
791
+ // Cast intrinsic for `Ref(String) -> Externref`.
792
+ const ret = getStringFromWasm0(arg0, arg1);
793
+ return ret;
794
+ },
795
+ __wbindgen_init_externref_table: function() {
796
+ const table = wasm.__wbindgen_externrefs;
797
+ const offset = table.grow(4);
798
+ table.set(0, undefined);
799
+ table.set(offset + 0, undefined);
800
+ table.set(offset + 1, null);
801
+ table.set(offset + 2, true);
802
+ table.set(offset + 3, false);
803
+ },
804
+ };
805
+ return {
806
+ __proto__: null,
807
+ "./tor_js_bg.js": import0,
808
+ };
809
+ }
810
+
811
+ function wasm_bindgen__convert__closures_____invoke__h69c112f8841b438b(arg0, arg1) {
812
+ wasm.wasm_bindgen__convert__closures_____invoke__h69c112f8841b438b(arg0, arg1);
813
+ }
814
+
815
+ function wasm_bindgen__convert__closures_____invoke__h5c591e637e5094b1(arg0, arg1, arg2) {
816
+ wasm.wasm_bindgen__convert__closures_____invoke__h5c591e637e5094b1(arg0, arg1, arg2);
817
+ }
818
+
819
+ function wasm_bindgen__convert__closures_____invoke__hc2bcdd2c6020290d(arg0, arg1, arg2) {
820
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__hc2bcdd2c6020290d(arg0, arg1, arg2);
821
+ if (ret[1]) {
822
+ throw takeFromExternrefTable0(ret[0]);
823
+ }
824
+ }
825
+
826
+ function wasm_bindgen__convert__closures_____invoke__hb864778e5a95f086(arg0, arg1, arg2, arg3) {
827
+ wasm.wasm_bindgen__convert__closures_____invoke__hb864778e5a95f086(arg0, arg1, arg2, arg3);
828
+ }
829
+
830
+
831
+ const __wbindgen_enum_ReadableStreamType = ["bytes"];
832
+ const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
833
+ ? { register: () => {}, unregister: () => {} }
834
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
835
+ const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
836
+ ? { register: () => {}, unregister: () => {} }
837
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
838
+ const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
839
+ ? { register: () => {}, unregister: () => {} }
840
+ : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
841
+ const TorClientFinalization = (typeof FinalizationRegistry === 'undefined')
842
+ ? { register: () => {}, unregister: () => {} }
843
+ : new FinalizationRegistry(ptr => wasm.__wbg_torclient_free(ptr >>> 0, 1));
844
+ const TorClientOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
845
+ ? { register: () => {}, unregister: () => {} }
846
+ : new FinalizationRegistry(ptr => wasm.__wbg_torclientoptions_free(ptr >>> 0, 1));
847
+
848
+ function addToExternrefTable0(obj) {
849
+ const idx = wasm.__externref_table_alloc();
850
+ wasm.__wbindgen_externrefs.set(idx, obj);
851
+ return idx;
852
+ }
853
+
854
+ function _assertClass(instance, klass) {
855
+ if (!(instance instanceof klass)) {
856
+ throw new Error(`expected instance of ${klass.name}`);
857
+ }
858
+ }
859
+
860
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
861
+ ? { register: () => {}, unregister: () => {} }
862
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
863
+
864
+ function debugString(val) {
865
+ // primitive types
866
+ const type = typeof val;
867
+ if (type == 'number' || type == 'boolean' || val == null) {
868
+ return `${val}`;
869
+ }
870
+ if (type == 'string') {
871
+ return `"${val}"`;
872
+ }
873
+ if (type == 'symbol') {
874
+ const description = val.description;
875
+ if (description == null) {
876
+ return 'Symbol';
877
+ } else {
878
+ return `Symbol(${description})`;
879
+ }
880
+ }
881
+ if (type == 'function') {
882
+ const name = val.name;
883
+ if (typeof name == 'string' && name.length > 0) {
884
+ return `Function(${name})`;
885
+ } else {
886
+ return 'Function';
887
+ }
888
+ }
889
+ // objects
890
+ if (Array.isArray(val)) {
891
+ const length = val.length;
892
+ let debug = '[';
893
+ if (length > 0) {
894
+ debug += debugString(val[0]);
895
+ }
896
+ for(let i = 1; i < length; i++) {
897
+ debug += ', ' + debugString(val[i]);
898
+ }
899
+ debug += ']';
900
+ return debug;
901
+ }
902
+ // Test for built-in
903
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
904
+ let className;
905
+ if (builtInMatches && builtInMatches.length > 1) {
906
+ className = builtInMatches[1];
907
+ } else {
908
+ // Failed to match the standard '[object ClassName]'
909
+ return toString.call(val);
910
+ }
911
+ if (className == 'Object') {
912
+ // we're a user defined class or Object
913
+ // JSON.stringify avoids problems with cycles, and is generally much
914
+ // easier than looping through ownProperties of `val`.
915
+ try {
916
+ return 'Object(' + JSON.stringify(val) + ')';
917
+ } catch (_) {
918
+ return 'Object';
919
+ }
920
+ }
921
+ // errors
922
+ if (val instanceof Error) {
923
+ return `${val.name}: ${val.message}\n${val.stack}`;
924
+ }
925
+ // TODO we could test for more things here, like `Set`s and `Map`s.
926
+ return className;
927
+ }
928
+
929
+ function getArrayU8FromWasm0(ptr, len) {
930
+ ptr = ptr >>> 0;
931
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
932
+ }
933
+
934
+ let cachedDataViewMemory0 = null;
935
+ function getDataViewMemory0() {
936
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
937
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
938
+ }
939
+ return cachedDataViewMemory0;
940
+ }
941
+
942
+ function getStringFromWasm0(ptr, len) {
943
+ ptr = ptr >>> 0;
944
+ return decodeText(ptr, len);
945
+ }
946
+
947
+ let cachedUint8ArrayMemory0 = null;
948
+ function getUint8ArrayMemory0() {
949
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
950
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
951
+ }
952
+ return cachedUint8ArrayMemory0;
953
+ }
954
+
955
+ function handleError(f, args) {
956
+ try {
957
+ return f.apply(this, args);
958
+ } catch (e) {
959
+ const idx = addToExternrefTable0(e);
960
+ wasm.__wbindgen_exn_store(idx);
961
+ }
962
+ }
963
+
964
+ function isLikeNone(x) {
965
+ return x === undefined || x === null;
966
+ }
967
+
968
+ function makeMutClosure(arg0, arg1, dtor, f) {
969
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
970
+ const real = (...args) => {
971
+
972
+ // First up with a closure we increment the internal reference
973
+ // count. This ensures that the Rust closure environment won't
974
+ // be deallocated while we're invoking it.
975
+ state.cnt++;
976
+ const a = state.a;
977
+ state.a = 0;
978
+ try {
979
+ return f(a, state.b, ...args);
980
+ } finally {
981
+ state.a = a;
982
+ real._wbg_cb_unref();
983
+ }
984
+ };
985
+ real._wbg_cb_unref = () => {
986
+ if (--state.cnt === 0) {
987
+ state.dtor(state.a, state.b);
988
+ state.a = 0;
989
+ CLOSURE_DTORS.unregister(state);
990
+ }
991
+ };
992
+ CLOSURE_DTORS.register(real, state, state);
993
+ return real;
994
+ }
995
+
996
+ function passStringToWasm0(arg, malloc, realloc) {
997
+ if (realloc === undefined) {
998
+ const buf = cachedTextEncoder.encode(arg);
999
+ const ptr = malloc(buf.length, 1) >>> 0;
1000
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1001
+ WASM_VECTOR_LEN = buf.length;
1002
+ return ptr;
1003
+ }
1004
+
1005
+ let len = arg.length;
1006
+ let ptr = malloc(len, 1) >>> 0;
1007
+
1008
+ const mem = getUint8ArrayMemory0();
1009
+
1010
+ let offset = 0;
1011
+
1012
+ for (; offset < len; offset++) {
1013
+ const code = arg.charCodeAt(offset);
1014
+ if (code > 0x7F) break;
1015
+ mem[ptr + offset] = code;
1016
+ }
1017
+ if (offset !== len) {
1018
+ if (offset !== 0) {
1019
+ arg = arg.slice(offset);
1020
+ }
1021
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1022
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1023
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1024
+
1025
+ offset += ret.written;
1026
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1027
+ }
1028
+
1029
+ WASM_VECTOR_LEN = offset;
1030
+ return ptr;
1031
+ }
1032
+
1033
+ function takeFromExternrefTable0(idx) {
1034
+ const value = wasm.__wbindgen_externrefs.get(idx);
1035
+ wasm.__externref_table_dealloc(idx);
1036
+ return value;
1037
+ }
1038
+
1039
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1040
+ cachedTextDecoder.decode();
1041
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1042
+ let numBytesDecoded = 0;
1043
+ function decodeText(ptr, len) {
1044
+ numBytesDecoded += len;
1045
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1046
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1047
+ cachedTextDecoder.decode();
1048
+ numBytesDecoded = len;
1049
+ }
1050
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1051
+ }
1052
+
1053
+ const cachedTextEncoder = new TextEncoder();
1054
+
1055
+ if (!('encodeInto' in cachedTextEncoder)) {
1056
+ cachedTextEncoder.encodeInto = function (arg, view) {
1057
+ const buf = cachedTextEncoder.encode(arg);
1058
+ view.set(buf);
1059
+ return {
1060
+ read: arg.length,
1061
+ written: buf.length
1062
+ };
1063
+ };
1064
+ }
1065
+
1066
+ let WASM_VECTOR_LEN = 0;
1067
+
1068
+ let wasmModule, wasm;
1069
+ function __wbg_finalize_init(instance, module) {
1070
+ wasm = instance.exports;
1071
+ wasmModule = module;
1072
+ cachedDataViewMemory0 = null;
1073
+ cachedUint8ArrayMemory0 = null;
1074
+ wasm.__wbindgen_start();
1075
+ return wasm;
1076
+ }
1077
+
1078
+ async function __wbg_load(module, imports) {
1079
+ if (typeof Response === 'function' && module instanceof Response) {
1080
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1081
+ try {
1082
+ return await WebAssembly.instantiateStreaming(module, imports);
1083
+ } catch (e) {
1084
+ const validResponse = module.ok && expectedResponseType(module.type);
1085
+
1086
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1087
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1088
+
1089
+ } else { throw e; }
1090
+ }
1091
+ }
1092
+
1093
+ const bytes = await module.arrayBuffer();
1094
+ return await WebAssembly.instantiate(bytes, imports);
1095
+ } else {
1096
+ const instance = await WebAssembly.instantiate(module, imports);
1097
+
1098
+ if (instance instanceof WebAssembly.Instance) {
1099
+ return { instance, module };
1100
+ } else {
1101
+ return instance;
1102
+ }
1103
+ }
1104
+
1105
+ function expectedResponseType(type) {
1106
+ switch (type) {
1107
+ case 'basic': case 'cors': case 'default': return true;
1108
+ }
1109
+ return false;
1110
+ }
1111
+ }
1112
+
1113
+ function initSync(module) {
1114
+ if (wasm !== undefined) return wasm;
1115
+
1116
+
1117
+ if (module !== undefined) {
1118
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1119
+ ({module} = module)
1120
+ } else {
1121
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1122
+ }
1123
+ }
1124
+
1125
+ const imports = __wbg_get_imports();
1126
+ if (!(module instanceof WebAssembly.Module)) {
1127
+ module = new WebAssembly.Module(module);
1128
+ }
1129
+ const instance = new WebAssembly.Instance(module, imports);
1130
+ return __wbg_finalize_init(instance, module);
1131
+ }
1132
+
1133
+ async function __wbg_init(module_or_path) {
1134
+ if (wasm !== undefined) return wasm;
1135
+
1136
+
1137
+ if (module_or_path !== undefined) {
1138
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1139
+ ({module_or_path} = module_or_path)
1140
+ } else {
1141
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1142
+ }
1143
+ }
1144
+
1145
+ if (module_or_path === undefined) {
1146
+ module_or_path = new URL('tor_js_bg.wasm', import.meta.url);
1147
+ }
1148
+ const imports = __wbg_get_imports();
1149
+
1150
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1151
+ module_or_path = fetch(module_or_path);
1152
+ }
1153
+
1154
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1155
+
1156
+ return __wbg_finalize_init(instance, module);
1157
+ }
1158
+
1159
+ export { initSync, __wbg_init as default };