@kya-os/agentshield-nextjs 0.2.6 → 0.2.7

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.
@@ -1,136 +1,149 @@
1
1
  let wasm;
2
2
 
3
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
-
5
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
6
-
7
3
  let cachedUint8ArrayMemory0 = null;
8
4
 
9
5
  function getUint8ArrayMemory0() {
10
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
- }
13
- return cachedUint8ArrayMemory0;
6
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
+ }
9
+ return cachedUint8ArrayMemory0;
10
+ }
11
+
12
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
+
14
+ cachedTextDecoder.decode();
15
+
16
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
+ let numBytesDecoded = 0;
18
+ function decodeText(ptr, len) {
19
+ numBytesDecoded += len;
20
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
+ cachedTextDecoder.decode();
23
+ numBytesDecoded = len;
24
+ }
25
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
14
26
  }
15
27
 
16
28
  function getStringFromWasm0(ptr, len) {
17
- ptr = ptr >>> 0;
18
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
29
+ ptr = ptr >>> 0;
30
+ return decodeText(ptr, len);
19
31
  }
20
32
 
21
- function logError(f, args) {
22
- try {
23
- return f.apply(this, args);
24
- } catch (e) {
25
- let error = (function () {
26
- try {
27
- return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
28
- } catch(_) {
29
- return "<failed to stringify thrown value>";
30
- }
31
- }());
32
- console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
33
- throw e;
34
- }
33
+ let heap = new Array(128).fill(undefined);
34
+
35
+ heap.push(undefined, null, true, false);
36
+
37
+ function getObject(idx) {
38
+ return heap[idx];
35
39
  }
36
40
 
37
- let WASM_VECTOR_LEN = 0;
41
+ let heap_next = heap.length;
38
42
 
39
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
43
+ function addHeapObject(obj) {
44
+ if (heap_next === heap.length) heap.push(heap.length + 1);
45
+ const idx = heap_next;
46
+ heap_next = heap[idx];
40
47
 
41
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
42
- ? function (arg, view) {
43
- return cachedTextEncoder.encodeInto(arg, view);
48
+ heap[idx] = obj;
49
+ return idx;
44
50
  }
45
- : function (arg, view) {
51
+
52
+ let WASM_VECTOR_LEN = 0;
53
+
54
+ const cachedTextEncoder = new TextEncoder();
55
+
56
+ if (!('encodeInto' in cachedTextEncoder)) {
57
+ cachedTextEncoder.encodeInto = function (arg, view) {
46
58
  const buf = cachedTextEncoder.encode(arg);
47
59
  view.set(buf);
48
60
  return {
49
- read: arg.length,
50
- written: buf.length
61
+ read: arg.length,
62
+ written: buf.length,
51
63
  };
52
- });
64
+ };
65
+ }
53
66
 
54
67
  function passStringToWasm0(arg, malloc, realloc) {
68
+ if (realloc === undefined) {
69
+ const buf = cachedTextEncoder.encode(arg);
70
+ const ptr = malloc(buf.length, 1) >>> 0;
71
+ getUint8ArrayMemory0()
72
+ .subarray(ptr, ptr + buf.length)
73
+ .set(buf);
74
+ WASM_VECTOR_LEN = buf.length;
75
+ return ptr;
76
+ }
55
77
 
56
- if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`);
57
-
58
- if (realloc === undefined) {
59
- const buf = cachedTextEncoder.encode(arg);
60
- const ptr = malloc(buf.length, 1) >>> 0;
61
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
62
- WASM_VECTOR_LEN = buf.length;
63
- return ptr;
64
- }
78
+ let len = arg.length;
79
+ let ptr = malloc(len, 1) >>> 0;
65
80
 
66
- let len = arg.length;
67
- let ptr = malloc(len, 1) >>> 0;
81
+ const mem = getUint8ArrayMemory0();
68
82
 
69
- const mem = getUint8ArrayMemory0();
83
+ let offset = 0;
70
84
 
71
- let offset = 0;
85
+ for (; offset < len; offset++) {
86
+ const code = arg.charCodeAt(offset);
87
+ if (code > 0x7f) break;
88
+ mem[ptr + offset] = code;
89
+ }
72
90
 
73
- for (; offset < len; offset++) {
74
- const code = arg.charCodeAt(offset);
75
- if (code > 0x7F) break;
76
- mem[ptr + offset] = code;
91
+ if (offset !== len) {
92
+ if (offset !== 0) {
93
+ arg = arg.slice(offset);
77
94
  }
95
+ ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
96
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
97
+ const ret = cachedTextEncoder.encodeInto(arg, view);
78
98
 
79
- if (offset !== len) {
80
- if (offset !== 0) {
81
- arg = arg.slice(offset);
82
- }
83
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
84
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
85
- const ret = encodeString(arg, view);
86
- if (ret.read !== arg.length) throw new Error('failed to pass whole string');
87
- offset += ret.written;
88
- ptr = realloc(ptr, len, offset, 1) >>> 0;
89
- }
99
+ offset += ret.written;
100
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
101
+ }
90
102
 
91
- WASM_VECTOR_LEN = offset;
92
- return ptr;
103
+ WASM_VECTOR_LEN = offset;
104
+ return ptr;
93
105
  }
94
106
 
95
107
  let cachedDataViewMemory0 = null;
96
108
 
97
109
  function getDataViewMemory0() {
98
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
99
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
100
- }
101
- return cachedDataViewMemory0;
110
+ if (
111
+ cachedDataViewMemory0 === null ||
112
+ cachedDataViewMemory0.buffer.detached === true ||
113
+ (cachedDataViewMemory0.buffer.detached === undefined &&
114
+ cachedDataViewMemory0.buffer !== wasm.memory.buffer)
115
+ ) {
116
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
117
+ }
118
+ return cachedDataViewMemory0;
102
119
  }
103
120
 
104
- function _assertNum(n) {
105
- if (typeof(n) !== 'number') throw new Error(`expected a number argument, found ${typeof(n)}`);
121
+ function dropObject(idx) {
122
+ if (idx < 132) return;
123
+ heap[idx] = heap_next;
124
+ heap_next = idx;
106
125
  }
107
126
 
108
- function _assertBoolean(n) {
109
- if (typeof(n) !== 'boolean') {
110
- throw new Error(`expected a boolean argument, found ${typeof(n)}`);
111
- }
127
+ function takeObject(idx) {
128
+ const ret = getObject(idx);
129
+ dropObject(idx);
130
+ return ret;
112
131
  }
113
132
 
114
133
  function isLikeNone(x) {
115
- return x === undefined || x === null;
134
+ return x === undefined || x === null;
116
135
  }
117
136
  /**
118
137
  * Initialize the AgentShield WASM module
119
138
  */
120
139
  export function init() {
121
- wasm.init();
140
+ wasm.init();
122
141
  }
123
142
 
124
143
  function _assertClass(instance, klass) {
125
- if (!(instance instanceof klass)) {
126
- throw new Error(`expected instance of ${klass.name}`);
127
- }
128
- }
129
-
130
- function takeFromExternrefTable0(idx) {
131
- const value = wasm.__wbindgen_export_3.get(idx);
132
- wasm.__externref_table_dealloc(idx);
133
- return value;
144
+ if (!(instance instanceof klass)) {
145
+ throw new Error(`expected instance of ${klass.name}`);
146
+ }
134
147
  }
135
148
  /**
136
149
  * Analyze a request and detect if it's from an agent
@@ -138,15 +151,20 @@ function takeFromExternrefTable0(idx) {
138
151
  * @returns {JsDetectionResult}
139
152
  */
140
153
  export function detect_agent(metadata) {
154
+ try {
155
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
141
156
  _assertClass(metadata, JsRequestMetadata);
142
- if (metadata.__wbg_ptr === 0) {
143
- throw new Error('Attempt to use a moved value');
144
- }
145
- const ret = wasm.detect_agent(metadata.__wbg_ptr);
146
- if (ret[2]) {
147
- throw takeFromExternrefTable0(ret[1]);
148
- }
149
- return JsDetectionResult.__wrap(ret[0]);
157
+ wasm.detect_agent(retptr, metadata.__wbg_ptr);
158
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
159
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
160
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
161
+ if (r2) {
162
+ throw takeObject(r1);
163
+ }
164
+ return JsDetectionResult.__wrap(r0);
165
+ } finally {
166
+ wasm.__wbindgen_add_to_stack_pointer(16);
167
+ }
150
168
  }
151
169
 
152
170
  /**
@@ -154,479 +172,571 @@ export function detect_agent(metadata) {
154
172
  * @returns {string}
155
173
  */
156
174
  export function version() {
157
- let deferred1_0;
158
- let deferred1_1;
159
- try {
160
- const ret = wasm.version();
161
- deferred1_0 = ret[0];
162
- deferred1_1 = ret[1];
163
- return getStringFromWasm0(ret[0], ret[1]);
164
- } finally {
165
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
166
- }
175
+ let deferred1_0;
176
+ let deferred1_1;
177
+ try {
178
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
179
+ wasm.get_version(retptr);
180
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
181
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
182
+ deferred1_0 = r0;
183
+ deferred1_1 = r1;
184
+ return getStringFromWasm0(r0, r1);
185
+ } finally {
186
+ wasm.__wbindgen_add_to_stack_pointer(16);
187
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
188
+ }
189
+ }
190
+
191
+ /**
192
+ * Get the version of the AgentShield library
193
+ * @returns {string}
194
+ */
195
+ export function get_version() {
196
+ let deferred1_0;
197
+ let deferred1_1;
198
+ try {
199
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
200
+ wasm.get_version(retptr);
201
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
202
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
203
+ deferred1_0 = r0;
204
+ deferred1_1 = r1;
205
+ return getStringFromWasm0(r0, r1);
206
+ } finally {
207
+ wasm.__wbindgen_add_to_stack_pointer(16);
208
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Get build information
214
+ * @returns {string}
215
+ */
216
+ export function get_build_info() {
217
+ let deferred1_0;
218
+ let deferred1_1;
219
+ try {
220
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
221
+ wasm.get_build_info(retptr);
222
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
223
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
224
+ deferred1_0 = r0;
225
+ deferred1_1 = r1;
226
+ return getStringFromWasm0(r0, r1);
227
+ } finally {
228
+ wasm.__wbindgen_add_to_stack_pointer(16);
229
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
230
+ }
167
231
  }
168
232
 
169
- const JsDetectionResultFinalization = (typeof FinalizationRegistry === 'undefined')
233
+ const JsDetectionResultFinalization =
234
+ typeof FinalizationRegistry === 'undefined'
170
235
  ? { register: () => {}, unregister: () => {} }
171
- : new FinalizationRegistry(ptr => wasm.__wbg_jsdetectionresult_free(ptr >>> 0, 1));
236
+ : new FinalizationRegistry((ptr) => wasm.__wbg_jsdetectionresult_free(ptr >>> 0, 1));
172
237
  /**
173
238
  * JavaScript-compatible detection result
174
239
  */
175
240
  export class JsDetectionResult {
176
-
177
- constructor() {
178
- throw new Error('cannot invoke `new` directly');
179
- }
180
-
181
- static __wrap(ptr) {
182
- ptr = ptr >>> 0;
183
- const obj = Object.create(JsDetectionResult.prototype);
184
- obj.__wbg_ptr = ptr;
185
- JsDetectionResultFinalization.register(obj, obj.__wbg_ptr, obj);
186
- return obj;
187
- }
188
-
189
- __destroy_into_raw() {
190
- const ptr = this.__wbg_ptr;
191
- this.__wbg_ptr = 0;
192
- JsDetectionResultFinalization.unregister(this);
193
- return ptr;
194
- }
195
-
196
- free() {
197
- const ptr = this.__destroy_into_raw();
198
- wasm.__wbg_jsdetectionresult_free(ptr, 0);
199
- }
200
- /**
201
- * Whether the request was identified as coming from an agent
202
- * @returns {boolean}
203
- */
204
- get is_agent() {
205
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
206
- _assertNum(this.__wbg_ptr);
207
- const ret = wasm.__wbg_get_jsdetectionresult_is_agent(this.__wbg_ptr);
208
- return ret !== 0;
209
- }
210
- /**
211
- * Whether the request was identified as coming from an agent
212
- * @param {boolean} arg0
213
- */
214
- set is_agent(arg0) {
215
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
216
- _assertNum(this.__wbg_ptr);
217
- _assertBoolean(arg0);
218
- wasm.__wbg_set_jsdetectionresult_is_agent(this.__wbg_ptr, arg0);
219
- }
220
- /**
221
- * Confidence score (0.0 to 1.0)
222
- * @returns {number}
223
- */
224
- get confidence() {
225
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
226
- _assertNum(this.__wbg_ptr);
227
- const ret = wasm.__wbg_get_jsdetectionresult_confidence(this.__wbg_ptr);
228
- return ret;
229
- }
230
- /**
231
- * Confidence score (0.0 to 1.0)
232
- * @param {number} arg0
233
- */
234
- set confidence(arg0) {
235
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
236
- _assertNum(this.__wbg_ptr);
237
- wasm.__wbg_set_jsdetectionresult_confidence(this.__wbg_ptr, arg0);
238
- }
239
- /**
240
- * Get the detected agent name
241
- * @returns {string | undefined}
242
- */
243
- get agent() {
244
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
245
- _assertNum(this.__wbg_ptr);
246
- const ret = wasm.jsdetectionresult_agent(this.__wbg_ptr);
247
- let v1;
248
- if (ret[0] !== 0) {
249
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
250
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
251
- }
252
- return v1;
253
- }
254
- /**
255
- * Get the verification method as a string
256
- * @returns {string}
257
- */
258
- get verification_method() {
259
- let deferred1_0;
260
- let deferred1_1;
261
- try {
262
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
263
- _assertNum(this.__wbg_ptr);
264
- const ret = wasm.jsdetectionresult_verification_method(this.__wbg_ptr);
265
- deferred1_0 = ret[0];
266
- deferred1_1 = ret[1];
267
- return getStringFromWasm0(ret[0], ret[1]);
268
- } finally {
269
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
270
- }
271
- }
272
- /**
273
- * Get the risk level as a string
274
- * @returns {string}
275
- */
276
- get risk_level() {
277
- let deferred1_0;
278
- let deferred1_1;
279
- try {
280
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
281
- _assertNum(this.__wbg_ptr);
282
- const ret = wasm.jsdetectionresult_risk_level(this.__wbg_ptr);
283
- deferred1_0 = ret[0];
284
- deferred1_1 = ret[1];
285
- return getStringFromWasm0(ret[0], ret[1]);
286
- } finally {
287
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
288
- }
289
- }
290
- /**
291
- * Get the timestamp as a string
292
- * @returns {string}
293
- */
294
- get timestamp() {
295
- let deferred1_0;
296
- let deferred1_1;
297
- try {
298
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
299
- _assertNum(this.__wbg_ptr);
300
- const ret = wasm.jsdetectionresult_timestamp(this.__wbg_ptr);
301
- deferred1_0 = ret[0];
302
- deferred1_1 = ret[1];
303
- return getStringFromWasm0(ret[0], ret[1]);
304
- } finally {
305
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
306
- }
241
+ static __wrap(ptr) {
242
+ ptr = ptr >>> 0;
243
+ const obj = Object.create(JsDetectionResult.prototype);
244
+ obj.__wbg_ptr = ptr;
245
+ JsDetectionResultFinalization.register(obj, obj.__wbg_ptr, obj);
246
+ return obj;
247
+ }
248
+
249
+ __destroy_into_raw() {
250
+ const ptr = this.__wbg_ptr;
251
+ this.__wbg_ptr = 0;
252
+ JsDetectionResultFinalization.unregister(this);
253
+ return ptr;
254
+ }
255
+
256
+ free() {
257
+ const ptr = this.__destroy_into_raw();
258
+ wasm.__wbg_jsdetectionresult_free(ptr, 0);
259
+ }
260
+ /**
261
+ * Whether the request was identified as coming from an agent
262
+ * @returns {boolean}
263
+ */
264
+ get is_agent() {
265
+ const ret = wasm.__wbg_get_jsdetectionresult_is_agent(this.__wbg_ptr);
266
+ return ret !== 0;
267
+ }
268
+ /**
269
+ * Whether the request was identified as coming from an agent
270
+ * @param {boolean} arg0
271
+ */
272
+ set is_agent(arg0) {
273
+ wasm.__wbg_set_jsdetectionresult_is_agent(this.__wbg_ptr, arg0);
274
+ }
275
+ /**
276
+ * Confidence score (0-100 scale)
277
+ * @returns {number}
278
+ */
279
+ get confidence() {
280
+ const ret = wasm.__wbg_get_jsdetectionresult_confidence(this.__wbg_ptr);
281
+ return ret;
282
+ }
283
+ /**
284
+ * Confidence score (0-100 scale)
285
+ * @param {number} arg0
286
+ */
287
+ set confidence(arg0) {
288
+ wasm.__wbg_set_jsdetectionresult_confidence(this.__wbg_ptr, arg0);
289
+ }
290
+ /**
291
+ * Get the detected agent name
292
+ * @returns {string | undefined}
293
+ */
294
+ get agent() {
295
+ try {
296
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
297
+ wasm.jsdetectionresult_agent(retptr, this.__wbg_ptr);
298
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
299
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
300
+ let v1;
301
+ if (r0 !== 0) {
302
+ v1 = getStringFromWasm0(r0, r1).slice();
303
+ wasm.__wbindgen_export(r0, r1 * 1, 1);
304
+ }
305
+ return v1;
306
+ } finally {
307
+ wasm.__wbindgen_add_to_stack_pointer(16);
308
+ }
309
+ }
310
+ /**
311
+ * Get the verification method as a string
312
+ * @returns {string}
313
+ */
314
+ get verification_method() {
315
+ let deferred1_0;
316
+ let deferred1_1;
317
+ try {
318
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
319
+ wasm.jsdetectionresult_verification_method(retptr, this.__wbg_ptr);
320
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
321
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
322
+ deferred1_0 = r0;
323
+ deferred1_1 = r1;
324
+ return getStringFromWasm0(r0, r1);
325
+ } finally {
326
+ wasm.__wbindgen_add_to_stack_pointer(16);
327
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
328
+ }
329
+ }
330
+ /**
331
+ * Get the risk level as a string
332
+ * @returns {string}
333
+ */
334
+ get risk_level() {
335
+ let deferred1_0;
336
+ let deferred1_1;
337
+ try {
338
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
339
+ wasm.jsdetectionresult_risk_level(retptr, this.__wbg_ptr);
340
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
341
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
342
+ deferred1_0 = r0;
343
+ deferred1_1 = r1;
344
+ return getStringFromWasm0(r0, r1);
345
+ } finally {
346
+ wasm.__wbindgen_add_to_stack_pointer(16);
347
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
348
+ }
349
+ }
350
+ /**
351
+ * Get the timestamp as a string
352
+ * @returns {string}
353
+ */
354
+ get timestamp() {
355
+ let deferred1_0;
356
+ let deferred1_1;
357
+ try {
358
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
359
+ wasm.jsdetectionresult_timestamp(retptr, this.__wbg_ptr);
360
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
361
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
362
+ deferred1_0 = r0;
363
+ deferred1_1 = r1;
364
+ return getStringFromWasm0(r0, r1);
365
+ } finally {
366
+ wasm.__wbindgen_add_to_stack_pointer(16);
367
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
307
368
  }
369
+ }
308
370
  }
371
+ if (Symbol.dispose) JsDetectionResult.prototype[Symbol.dispose] = JsDetectionResult.prototype.free;
309
372
 
310
- const JsRequestMetadataFinalization = (typeof FinalizationRegistry === 'undefined')
373
+ const JsRequestMetadataFinalization =
374
+ typeof FinalizationRegistry === 'undefined'
311
375
  ? { register: () => {}, unregister: () => {} }
312
- : new FinalizationRegistry(ptr => wasm.__wbg_jsrequestmetadata_free(ptr >>> 0, 1));
376
+ : new FinalizationRegistry((ptr) => wasm.__wbg_jsrequestmetadata_free(ptr >>> 0, 1));
313
377
  /**
314
378
  * JavaScript-compatible request metadata
315
379
  */
316
380
  export class JsRequestMetadata {
317
-
318
- __destroy_into_raw() {
319
- const ptr = this.__wbg_ptr;
320
- this.__wbg_ptr = 0;
321
- JsRequestMetadataFinalization.unregister(this);
322
- return ptr;
323
- }
324
-
325
- free() {
326
- const ptr = this.__destroy_into_raw();
327
- wasm.__wbg_jsrequestmetadata_free(ptr, 0);
328
- }
329
- /**
330
- * Constructor for JsRequestMetadata
331
- * @param {string | null | undefined} user_agent
332
- * @param {string | null | undefined} ip_address
333
- * @param {string} headers
334
- * @param {string} timestamp
335
- * @param {string | null} [url]
336
- * @param {string | null} [method]
337
- * @param {string | null} [client_fingerprint]
338
- */
339
- constructor(user_agent, ip_address, headers, timestamp, url, method, client_fingerprint) {
340
- var ptr0 = isLikeNone(user_agent) ? 0 : passStringToWasm0(user_agent, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
341
- var len0 = WASM_VECTOR_LEN;
342
- var ptr1 = isLikeNone(ip_address) ? 0 : passStringToWasm0(ip_address, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
343
- var len1 = WASM_VECTOR_LEN;
344
- const ptr2 = passStringToWasm0(headers, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
345
- const len2 = WASM_VECTOR_LEN;
346
- const ptr3 = passStringToWasm0(timestamp, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
- const len3 = WASM_VECTOR_LEN;
348
- var ptr4 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
349
- var len4 = WASM_VECTOR_LEN;
350
- var ptr5 = isLikeNone(method) ? 0 : passStringToWasm0(method, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
351
- var len5 = WASM_VECTOR_LEN;
352
- var ptr6 = isLikeNone(client_fingerprint) ? 0 : passStringToWasm0(client_fingerprint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
353
- var len6 = WASM_VECTOR_LEN;
354
- const ret = wasm.jsrequestmetadata_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
355
- this.__wbg_ptr = ret >>> 0;
356
- JsRequestMetadataFinalization.register(this, this.__wbg_ptr, this);
357
- return this;
358
- }
359
- /**
360
- * Get the user agent
361
- * @returns {string | undefined}
362
- */
363
- get user_agent() {
364
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
365
- _assertNum(this.__wbg_ptr);
366
- const ret = wasm.jsrequestmetadata_user_agent(this.__wbg_ptr);
367
- let v1;
368
- if (ret[0] !== 0) {
369
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
370
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
371
- }
372
- return v1;
373
- }
374
- /**
375
- * Get the IP address
376
- * @returns {string | undefined}
377
- */
378
- get ip_address() {
379
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
380
- _assertNum(this.__wbg_ptr);
381
- const ret = wasm.jsrequestmetadata_ip_address(this.__wbg_ptr);
382
- let v1;
383
- if (ret[0] !== 0) {
384
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
385
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
386
- }
387
- return v1;
388
- }
389
- /**
390
- * Get the headers as JSON string
391
- * @returns {string}
392
- */
393
- get headers() {
394
- let deferred1_0;
395
- let deferred1_1;
396
- try {
397
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
398
- _assertNum(this.__wbg_ptr);
399
- const ret = wasm.jsrequestmetadata_headers(this.__wbg_ptr);
400
- deferred1_0 = ret[0];
401
- deferred1_1 = ret[1];
402
- return getStringFromWasm0(ret[0], ret[1]);
403
- } finally {
404
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
405
- }
406
- }
407
- /**
408
- * Get the timestamp
409
- * @returns {string}
410
- */
411
- get timestamp() {
412
- let deferred1_0;
413
- let deferred1_1;
414
- try {
415
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
416
- _assertNum(this.__wbg_ptr);
417
- const ret = wasm.jsrequestmetadata_timestamp(this.__wbg_ptr);
418
- deferred1_0 = ret[0];
419
- deferred1_1 = ret[1];
420
- return getStringFromWasm0(ret[0], ret[1]);
421
- } finally {
422
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
423
- }
424
- }
425
- /**
426
- * Get the URL
427
- * @returns {string | undefined}
428
- */
429
- get url() {
430
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
431
- _assertNum(this.__wbg_ptr);
432
- const ret = wasm.jsrequestmetadata_url(this.__wbg_ptr);
433
- let v1;
434
- if (ret[0] !== 0) {
435
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
436
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
437
- }
438
- return v1;
439
- }
440
- /**
441
- * Get the method
442
- * @returns {string | undefined}
443
- */
444
- get method() {
445
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
446
- _assertNum(this.__wbg_ptr);
447
- const ret = wasm.jsrequestmetadata_method(this.__wbg_ptr);
448
- let v1;
449
- if (ret[0] !== 0) {
450
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
451
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
452
- }
453
- return v1;
454
- }
455
- /**
456
- * Get the client fingerprint
457
- * @returns {string | undefined}
458
- */
459
- get client_fingerprint() {
460
- if (this.__wbg_ptr == 0) throw new Error('Attempt to use a moved value');
461
- _assertNum(this.__wbg_ptr);
462
- const ret = wasm.jsrequestmetadata_client_fingerprint(this.__wbg_ptr);
463
- let v1;
464
- if (ret[0] !== 0) {
465
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
466
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
467
- }
468
- return v1;
381
+ __destroy_into_raw() {
382
+ const ptr = this.__wbg_ptr;
383
+ this.__wbg_ptr = 0;
384
+ JsRequestMetadataFinalization.unregister(this);
385
+ return ptr;
386
+ }
387
+
388
+ free() {
389
+ const ptr = this.__destroy_into_raw();
390
+ wasm.__wbg_jsrequestmetadata_free(ptr, 0);
391
+ }
392
+ /**
393
+ * Constructor for JsRequestMetadata
394
+ * @param {string | null | undefined} user_agent
395
+ * @param {string | null | undefined} ip_address
396
+ * @param {string} headers
397
+ * @param {string} timestamp
398
+ * @param {string | null} [url]
399
+ * @param {string | null} [method]
400
+ * @param {string | null} [client_fingerprint]
401
+ */
402
+ constructor(user_agent, ip_address, headers, timestamp, url, method, client_fingerprint) {
403
+ var ptr0 = isLikeNone(user_agent)
404
+ ? 0
405
+ : passStringToWasm0(user_agent, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
406
+ var len0 = WASM_VECTOR_LEN;
407
+ var ptr1 = isLikeNone(ip_address)
408
+ ? 0
409
+ : passStringToWasm0(ip_address, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
410
+ var len1 = WASM_VECTOR_LEN;
411
+ const ptr2 = passStringToWasm0(headers, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
412
+ const len2 = WASM_VECTOR_LEN;
413
+ const ptr3 = passStringToWasm0(timestamp, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
414
+ const len3 = WASM_VECTOR_LEN;
415
+ var ptr4 = isLikeNone(url)
416
+ ? 0
417
+ : passStringToWasm0(url, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
418
+ var len4 = WASM_VECTOR_LEN;
419
+ var ptr5 = isLikeNone(method)
420
+ ? 0
421
+ : passStringToWasm0(method, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
422
+ var len5 = WASM_VECTOR_LEN;
423
+ var ptr6 = isLikeNone(client_fingerprint)
424
+ ? 0
425
+ : passStringToWasm0(client_fingerprint, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
426
+ var len6 = WASM_VECTOR_LEN;
427
+ const ret = wasm.jsrequestmetadata_new(
428
+ ptr0,
429
+ len0,
430
+ ptr1,
431
+ len1,
432
+ ptr2,
433
+ len2,
434
+ ptr3,
435
+ len3,
436
+ ptr4,
437
+ len4,
438
+ ptr5,
439
+ len5,
440
+ ptr6,
441
+ len6
442
+ );
443
+ this.__wbg_ptr = ret >>> 0;
444
+ JsRequestMetadataFinalization.register(this, this.__wbg_ptr, this);
445
+ return this;
446
+ }
447
+ /**
448
+ * Get the user agent
449
+ * @returns {string | undefined}
450
+ */
451
+ get user_agent() {
452
+ try {
453
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
454
+ wasm.jsrequestmetadata_user_agent(retptr, this.__wbg_ptr);
455
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
456
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
457
+ let v1;
458
+ if (r0 !== 0) {
459
+ v1 = getStringFromWasm0(r0, r1).slice();
460
+ wasm.__wbindgen_export(r0, r1 * 1, 1);
461
+ }
462
+ return v1;
463
+ } finally {
464
+ wasm.__wbindgen_add_to_stack_pointer(16);
465
+ }
466
+ }
467
+ /**
468
+ * Get the IP address
469
+ * @returns {string | undefined}
470
+ */
471
+ get ip_address() {
472
+ try {
473
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
474
+ wasm.jsrequestmetadata_ip_address(retptr, this.__wbg_ptr);
475
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
476
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
477
+ let v1;
478
+ if (r0 !== 0) {
479
+ v1 = getStringFromWasm0(r0, r1).slice();
480
+ wasm.__wbindgen_export(r0, r1 * 1, 1);
481
+ }
482
+ return v1;
483
+ } finally {
484
+ wasm.__wbindgen_add_to_stack_pointer(16);
485
+ }
486
+ }
487
+ /**
488
+ * Get the headers as JSON string
489
+ * @returns {string}
490
+ */
491
+ get headers() {
492
+ let deferred1_0;
493
+ let deferred1_1;
494
+ try {
495
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
496
+ wasm.jsrequestmetadata_headers(retptr, this.__wbg_ptr);
497
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
498
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
499
+ deferred1_0 = r0;
500
+ deferred1_1 = r1;
501
+ return getStringFromWasm0(r0, r1);
502
+ } finally {
503
+ wasm.__wbindgen_add_to_stack_pointer(16);
504
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
505
+ }
506
+ }
507
+ /**
508
+ * Get the timestamp
509
+ * @returns {string}
510
+ */
511
+ get timestamp() {
512
+ let deferred1_0;
513
+ let deferred1_1;
514
+ try {
515
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
516
+ wasm.jsrequestmetadata_timestamp(retptr, this.__wbg_ptr);
517
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
518
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
519
+ deferred1_0 = r0;
520
+ deferred1_1 = r1;
521
+ return getStringFromWasm0(r0, r1);
522
+ } finally {
523
+ wasm.__wbindgen_add_to_stack_pointer(16);
524
+ wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
525
+ }
526
+ }
527
+ /**
528
+ * Get the URL
529
+ * @returns {string | undefined}
530
+ */
531
+ get url() {
532
+ try {
533
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
534
+ wasm.jsrequestmetadata_url(retptr, this.__wbg_ptr);
535
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
536
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
537
+ let v1;
538
+ if (r0 !== 0) {
539
+ v1 = getStringFromWasm0(r0, r1).slice();
540
+ wasm.__wbindgen_export(r0, r1 * 1, 1);
541
+ }
542
+ return v1;
543
+ } finally {
544
+ wasm.__wbindgen_add_to_stack_pointer(16);
545
+ }
546
+ }
547
+ /**
548
+ * Get the method
549
+ * @returns {string | undefined}
550
+ */
551
+ get method() {
552
+ try {
553
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
554
+ wasm.jsrequestmetadata_method(retptr, this.__wbg_ptr);
555
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
556
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
557
+ let v1;
558
+ if (r0 !== 0) {
559
+ v1 = getStringFromWasm0(r0, r1).slice();
560
+ wasm.__wbindgen_export(r0, r1 * 1, 1);
561
+ }
562
+ return v1;
563
+ } finally {
564
+ wasm.__wbindgen_add_to_stack_pointer(16);
565
+ }
566
+ }
567
+ /**
568
+ * Get the client fingerprint
569
+ * @returns {string | undefined}
570
+ */
571
+ get client_fingerprint() {
572
+ try {
573
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
574
+ wasm.jsrequestmetadata_client_fingerprint(retptr, this.__wbg_ptr);
575
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
576
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
577
+ let v1;
578
+ if (r0 !== 0) {
579
+ v1 = getStringFromWasm0(r0, r1).slice();
580
+ wasm.__wbindgen_export(r0, r1 * 1, 1);
581
+ }
582
+ return v1;
583
+ } finally {
584
+ wasm.__wbindgen_add_to_stack_pointer(16);
469
585
  }
586
+ }
470
587
  }
588
+ if (Symbol.dispose) JsRequestMetadata.prototype[Symbol.dispose] = JsRequestMetadata.prototype.free;
589
+
590
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
471
591
 
472
592
  async function __wbg_load(module, imports) {
473
- if (typeof Response === 'function' && module instanceof Response) {
474
- if (typeof WebAssembly.instantiateStreaming === 'function') {
475
- try {
476
- return await WebAssembly.instantiateStreaming(module, imports);
477
-
478
- } catch (e) {
479
- if (module.headers.get('Content-Type') != 'application/wasm') {
480
- 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);
481
-
482
- } else {
483
- throw e;
484
- }
485
- }
593
+ if (typeof Response === 'function' && module instanceof Response) {
594
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
595
+ try {
596
+ return await WebAssembly.instantiateStreaming(module, imports);
597
+ } catch (e) {
598
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
599
+
600
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
601
+ console.warn(
602
+ '`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',
603
+ e
604
+ );
605
+ } else {
606
+ throw e;
486
607
  }
608
+ }
609
+ }
487
610
 
488
- const bytes = await module.arrayBuffer();
489
- return await WebAssembly.instantiate(bytes, imports);
611
+ const bytes = await module.arrayBuffer();
612
+ return await WebAssembly.instantiate(bytes, imports);
613
+ } else {
614
+ const instance = await WebAssembly.instantiate(module, imports);
490
615
 
616
+ if (instance instanceof WebAssembly.Instance) {
617
+ return { instance, module };
491
618
  } else {
492
- const instance = await WebAssembly.instantiate(module, imports);
493
-
494
- if (instance instanceof WebAssembly.Instance) {
495
- return { instance, module };
496
-
497
- } else {
498
- return instance;
499
- }
619
+ return instance;
500
620
  }
621
+ }
501
622
  }
502
623
 
503
624
  function __wbg_get_imports() {
504
- const imports = {};
505
- imports.wbg = {};
506
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function() { return logError(function (arg0, arg1) {
507
- let deferred0_0;
508
- let deferred0_1;
509
- try {
510
- deferred0_0 = arg0;
511
- deferred0_1 = arg1;
512
- console.error(getStringFromWasm0(arg0, arg1));
513
- } finally {
514
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
515
- }
516
- }, arguments) };
517
- imports.wbg.__wbg_getTime_46267b1c24877e30 = function() { return logError(function (arg0) {
518
- const ret = arg0.getTime();
519
- return ret;
520
- }, arguments) };
521
- imports.wbg.__wbg_log_c222819a41e063d3 = function() { return logError(function (arg0) {
522
- console.log(arg0);
523
- }, arguments) };
524
- imports.wbg.__wbg_new_31a97dac4f10fab7 = function() { return logError(function (arg0) {
525
- const ret = new Date(arg0);
526
- return ret;
527
- }, arguments) };
528
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() { return logError(function () {
529
- const ret = new Error();
530
- return ret;
531
- }, arguments) };
532
- imports.wbg.__wbg_now_807e54c39636c349 = function() { return logError(function () {
533
- const ret = Date.now();
534
- return ret;
535
- }, arguments) };
536
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function() { return logError(function (arg0, arg1) {
537
- const ret = arg1.stack;
538
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
539
- const len1 = WASM_VECTOR_LEN;
540
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
541
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
542
- }, arguments) };
543
- imports.wbg.__wbindgen_init_externref_table = function() {
544
- const table = wasm.__wbindgen_export_3;
545
- const offset = table.grow(4);
546
- table.set(0, undefined);
547
- table.set(offset + 0, undefined);
548
- table.set(offset + 1, null);
549
- table.set(offset + 2, true);
550
- table.set(offset + 3, false);
551
- ;
552
- };
553
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
554
- const ret = getStringFromWasm0(arg0, arg1);
555
- return ret;
556
- };
557
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
558
- throw new Error(getStringFromWasm0(arg0, arg1));
559
- };
560
-
561
- return imports;
562
- }
563
-
564
- function __wbg_init_memory(imports, memory) {
565
-
625
+ const imports = {};
626
+ imports.wbg = {};
627
+ imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function (arg0, arg1) {
628
+ throw new Error(getStringFromWasm0(arg0, arg1));
629
+ };
630
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function (arg0, arg1) {
631
+ let deferred0_0;
632
+ let deferred0_1;
633
+ try {
634
+ deferred0_0 = arg0;
635
+ deferred0_1 = arg1;
636
+ console.error(getStringFromWasm0(arg0, arg1));
637
+ } finally {
638
+ wasm.__wbindgen_export(deferred0_0, deferred0_1, 1);
639
+ }
640
+ };
641
+ imports.wbg.__wbg_getTime_14776bfb48a1bff9 = function (arg0) {
642
+ const ret = getObject(arg0).getTime();
643
+ return ret;
644
+ };
645
+ imports.wbg.__wbg_log_8cec76766b8c0e33 = function (arg0) {
646
+ console.log(getObject(arg0));
647
+ };
648
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function () {
649
+ const ret = new Error();
650
+ return addHeapObject(ret);
651
+ };
652
+ imports.wbg.__wbg_new_93d9417ed3fb115d = function (arg0) {
653
+ const ret = new Date(getObject(arg0));
654
+ return addHeapObject(ret);
655
+ };
656
+ imports.wbg.__wbg_now_793306c526e2e3b6 = function () {
657
+ const ret = Date.now();
658
+ return ret;
659
+ };
660
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function (arg0, arg1) {
661
+ const ret = getObject(arg1).stack;
662
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
663
+ const len1 = WASM_VECTOR_LEN;
664
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
665
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
666
+ };
667
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
668
+ // Cast intrinsic for `Ref(String) -> Externref`.
669
+ const ret = getStringFromWasm0(arg0, arg1);
670
+ return addHeapObject(ret);
671
+ };
672
+ imports.wbg.__wbindgen_object_drop_ref = function (arg0) {
673
+ takeObject(arg0);
674
+ };
675
+
676
+ return imports;
566
677
  }
567
678
 
568
679
  function __wbg_finalize_init(instance, module) {
569
- wasm = instance.exports;
570
- __wbg_init.__wbindgen_wasm_module = module;
571
- cachedDataViewMemory0 = null;
572
- cachedUint8ArrayMemory0 = null;
573
-
680
+ wasm = instance.exports;
681
+ __wbg_init.__wbindgen_wasm_module = module;
682
+ cachedDataViewMemory0 = null;
683
+ cachedUint8ArrayMemory0 = null;
574
684
 
575
- wasm.__wbindgen_start();
576
- return wasm;
685
+ wasm.__wbindgen_start();
686
+ return wasm;
577
687
  }
578
688
 
579
689
  function initSync(module) {
580
- if (wasm !== undefined) return wasm;
690
+ if (wasm !== undefined) return wasm;
581
691
 
582
-
583
- if (typeof module !== 'undefined') {
584
- if (Object.getPrototypeOf(module) === Object.prototype) {
585
- ({module} = module)
586
- } else {
587
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
588
- }
692
+ if (typeof module !== 'undefined') {
693
+ if (Object.getPrototypeOf(module) === Object.prototype) {
694
+ ({ module } = module);
695
+ } else {
696
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
589
697
  }
698
+ }
590
699
 
591
- const imports = __wbg_get_imports();
700
+ const imports = __wbg_get_imports();
592
701
 
593
- __wbg_init_memory(imports);
702
+ if (!(module instanceof WebAssembly.Module)) {
703
+ module = new WebAssembly.Module(module);
704
+ }
594
705
 
595
- if (!(module instanceof WebAssembly.Module)) {
596
- module = new WebAssembly.Module(module);
597
- }
598
-
599
- const instance = new WebAssembly.Instance(module, imports);
706
+ const instance = new WebAssembly.Instance(module, imports);
600
707
 
601
- return __wbg_finalize_init(instance, module);
708
+ return __wbg_finalize_init(instance, module);
602
709
  }
603
710
 
604
711
  async function __wbg_init(module_or_path) {
605
- if (wasm !== undefined) return wasm;
606
-
712
+ if (wasm !== undefined) return wasm;
607
713
 
608
- if (typeof module_or_path !== 'undefined') {
609
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
610
- ({module_or_path} = module_or_path)
611
- } else {
612
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
613
- }
614
- }
615
-
616
- if (typeof module_or_path === 'undefined') {
617
- module_or_path = new URL('agentshield_wasm_bg.wasm', import.meta.url);
714
+ if (typeof module_or_path !== 'undefined') {
715
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
716
+ ({ module_or_path } = module_or_path);
717
+ } else {
718
+ console.warn(
719
+ 'using deprecated parameters for the initialization function; pass a single object instead'
720
+ );
618
721
  }
619
- const imports = __wbg_get_imports();
722
+ }
620
723
 
621
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
622
- module_or_path = fetch(module_or_path);
623
- }
724
+ if (typeof module_or_path === 'undefined') {
725
+ module_or_path = new URL('agentshield_wasm_bg.wasm', import.meta.url);
726
+ }
727
+ const imports = __wbg_get_imports();
624
728
 
625
- __wbg_init_memory(imports);
729
+ if (
730
+ typeof module_or_path === 'string' ||
731
+ (typeof Request === 'function' && module_or_path instanceof Request) ||
732
+ (typeof URL === 'function' && module_or_path instanceof URL)
733
+ ) {
734
+ module_or_path = fetch(module_or_path);
735
+ }
626
736
 
627
- const { instance, module } = await __wbg_load(await module_or_path, imports);
737
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
628
738
 
629
- return __wbg_finalize_init(instance, module);
739
+ return __wbg_finalize_init(instance, module);
630
740
  }
631
741
 
632
742
  export { initSync };