@flipt-io/flipt-client-js 0.4.0 → 0.4.2

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,103 +1,337 @@
1
1
  'use strict';
2
2
 
3
3
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
4
- let wasm;
5
-
6
- let cachedUint8ArrayMemory0 = null;
4
+ /* @ts-self-types="./flipt_engine_wasm_js.d.ts" */
7
5
 
8
- function getUint8ArrayMemory0() {
9
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
10
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
6
+ class Engine {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ EngineFinalization.unregister(this);
11
+ return ptr;
11
12
  }
12
- return cachedUint8ArrayMemory0;
13
- }
14
-
15
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
16
-
17
- cachedTextDecoder.decode();
18
-
19
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
20
- let numBytesDecoded = 0;
21
- function decodeText(ptr, len) {
22
- numBytesDecoded += len;
23
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
24
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
25
- cachedTextDecoder.decode();
26
- numBytesDecoded = len;
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_engine_free(ptr, 0);
27
16
  }
28
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
29
- }
30
-
31
- function getStringFromWasm0(ptr, len) {
32
- ptr = ptr >>> 0;
33
- return decodeText(ptr, len);
34
- }
35
-
36
- let WASM_VECTOR_LEN = 0;
37
-
38
- const cachedTextEncoder = new TextEncoder();
39
-
40
- if (!('encodeInto' in cachedTextEncoder)) {
41
- cachedTextEncoder.encodeInto = function (arg, view) {
42
- const buf = cachedTextEncoder.encode(arg);
43
- view.set(buf);
44
- return {
45
- read: arg.length,
46
- written: buf.length
47
- };
48
- };
49
- }
50
-
51
- function passStringToWasm0(arg, malloc, realloc) {
52
-
53
- if (realloc === undefined) {
54
- const buf = cachedTextEncoder.encode(arg);
55
- const ptr = malloc(buf.length, 1) >>> 0;
56
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
57
- WASM_VECTOR_LEN = buf.length;
58
- return ptr;
17
+ /**
18
+ * @param {any} request
19
+ * @returns {any}
20
+ */
21
+ evaluate_batch(request) {
22
+ const ret = wasm.engine_evaluate_batch(this.__wbg_ptr, request);
23
+ if (ret[2]) {
24
+ throw takeFromExternrefTable0(ret[1]);
25
+ }
26
+ return takeFromExternrefTable0(ret[0]);
59
27
  }
60
-
61
- let len = arg.length;
62
- let ptr = malloc(len, 1) >>> 0;
63
-
64
- const mem = getUint8ArrayMemory0();
65
-
66
- let offset = 0;
67
-
68
- for (; offset < len; offset++) {
69
- const code = arg.charCodeAt(offset);
70
- if (code > 0x7F) break;
71
- mem[ptr + offset] = code;
28
+ /**
29
+ * @param {any} request
30
+ * @returns {any}
31
+ */
32
+ evaluate_boolean(request) {
33
+ const ret = wasm.engine_evaluate_boolean(this.__wbg_ptr, request);
34
+ if (ret[2]) {
35
+ throw takeFromExternrefTable0(ret[1]);
36
+ }
37
+ return takeFromExternrefTable0(ret[0]);
72
38
  }
73
-
74
- if (offset !== len) {
75
- if (offset !== 0) {
76
- arg = arg.slice(offset);
39
+ /**
40
+ * @param {any} request
41
+ * @returns {any}
42
+ */
43
+ evaluate_variant(request) {
44
+ const ret = wasm.engine_evaluate_variant(this.__wbg_ptr, request);
45
+ if (ret[2]) {
46
+ throw takeFromExternrefTable0(ret[1]);
77
47
  }
78
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
79
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
80
- const ret = cachedTextEncoder.encodeInto(arg, view);
81
-
82
- offset += ret.written;
83
- ptr = realloc(ptr, len, offset, 1) >>> 0;
48
+ return takeFromExternrefTable0(ret[0]);
84
49
  }
85
-
86
- WASM_VECTOR_LEN = offset;
87
- return ptr;
88
- }
89
-
90
- let cachedDataViewMemory0 = null;
91
-
92
- function getDataViewMemory0() {
93
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
94
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
50
+ /**
51
+ * @returns {any}
52
+ */
53
+ list_flags() {
54
+ const ret = wasm.engine_list_flags(this.__wbg_ptr);
55
+ if (ret[2]) {
56
+ throw takeFromExternrefTable0(ret[1]);
57
+ }
58
+ return takeFromExternrefTable0(ret[0]);
95
59
  }
96
- return cachedDataViewMemory0;
60
+ /**
61
+ * @param {string} namespace
62
+ */
63
+ constructor(namespace) {
64
+ const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
65
+ const len0 = WASM_VECTOR_LEN;
66
+ const ret = wasm.engine_new(ptr0, len0);
67
+ this.__wbg_ptr = ret >>> 0;
68
+ EngineFinalization.register(this, this.__wbg_ptr, this);
69
+ return this;
70
+ }
71
+ /**
72
+ * @param {any} data
73
+ */
74
+ snapshot(data) {
75
+ const ret = wasm.engine_snapshot(this.__wbg_ptr, data);
76
+ if (ret[1]) {
77
+ throw takeFromExternrefTable0(ret[0]);
78
+ }
79
+ }
80
+ }
81
+ if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
82
+ function __wbg_get_imports() {
83
+ const import0 = {
84
+ __proto__: null,
85
+ __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
86
+ const ret = Error(getStringFromWasm0(arg0, arg1));
87
+ return ret;
88
+ },
89
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
90
+ const ret = String(arg1);
91
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
92
+ const len1 = WASM_VECTOR_LEN;
93
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
94
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
95
+ },
96
+ __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
97
+ const v = arg0;
98
+ const ret = typeof(v) === 'boolean' ? v : undefined;
99
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
100
+ },
101
+ __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
102
+ const ret = debugString(arg1);
103
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
104
+ const len1 = WASM_VECTOR_LEN;
105
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
106
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
107
+ },
108
+ __wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
109
+ const ret = arg0 in arg1;
110
+ return ret;
111
+ },
112
+ __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
113
+ const ret = typeof(arg0) === 'function';
114
+ return ret;
115
+ },
116
+ __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
117
+ const val = arg0;
118
+ const ret = typeof(val) === 'object' && val !== null;
119
+ return ret;
120
+ },
121
+ __wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
122
+ const ret = typeof(arg0) === 'string';
123
+ return ret;
124
+ },
125
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
126
+ const ret = arg0 === undefined;
127
+ return ret;
128
+ },
129
+ __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
130
+ const ret = arg0 == arg1;
131
+ return ret;
132
+ },
133
+ __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
134
+ const obj = arg1;
135
+ const ret = typeof(obj) === 'number' ? obj : undefined;
136
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
137
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
138
+ },
139
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
140
+ const obj = arg1;
141
+ const ret = typeof(obj) === 'string' ? obj : undefined;
142
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
143
+ var len1 = WASM_VECTOR_LEN;
144
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
145
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
146
+ },
147
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
148
+ throw new Error(getStringFromWasm0(arg0, arg1));
149
+ },
150
+ __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
151
+ const ret = arg0.call(arg1);
152
+ return ret;
153
+ }, arguments); },
154
+ __wbg_done_9158f7cc8751ba32: function(arg0) {
155
+ const ret = arg0.done;
156
+ return ret;
157
+ },
158
+ __wbg_entries_e0b73aa8571ddb56: function(arg0) {
159
+ const ret = Object.entries(arg0);
160
+ return ret;
161
+ },
162
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
163
+ let deferred0_0;
164
+ let deferred0_1;
165
+ try {
166
+ deferred0_0 = arg0;
167
+ deferred0_1 = arg1;
168
+ console.error(getStringFromWasm0(arg0, arg1));
169
+ } finally {
170
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
171
+ }
172
+ },
173
+ __wbg_getTime_da7c55f52b71e8c6: function(arg0) {
174
+ const ret = arg0.getTime();
175
+ return ret;
176
+ },
177
+ __wbg_get_1affdbdd5573b16a: function() { return handleError(function (arg0, arg1) {
178
+ const ret = Reflect.get(arg0, arg1);
179
+ return ret;
180
+ }, arguments); },
181
+ __wbg_get_8360291721e2339f: function(arg0, arg1) {
182
+ const ret = arg0[arg1 >>> 0];
183
+ return ret;
184
+ },
185
+ __wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
186
+ const ret = arg0[arg1 >>> 0];
187
+ return ret;
188
+ },
189
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
190
+ const ret = arg0[arg1];
191
+ return ret;
192
+ },
193
+ __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
194
+ let result;
195
+ try {
196
+ result = arg0 instanceof ArrayBuffer;
197
+ } catch (_) {
198
+ result = false;
199
+ }
200
+ const ret = result;
201
+ return ret;
202
+ },
203
+ __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
204
+ let result;
205
+ try {
206
+ result = arg0 instanceof Uint8Array;
207
+ } catch (_) {
208
+ result = false;
209
+ }
210
+ const ret = result;
211
+ return ret;
212
+ },
213
+ __wbg_isArray_c3109d14ffc06469: function(arg0) {
214
+ const ret = Array.isArray(arg0);
215
+ return ret;
216
+ },
217
+ __wbg_iterator_013bc09ec998c2a7: function() {
218
+ const ret = Symbol.iterator;
219
+ return ret;
220
+ },
221
+ __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
222
+ const ret = arg0.length;
223
+ return ret;
224
+ },
225
+ __wbg_length_9f1775224cf1d815: function(arg0) {
226
+ const ret = arg0.length;
227
+ return ret;
228
+ },
229
+ __wbg_new_0_4d657201ced14de3: function() {
230
+ const ret = new Date();
231
+ return ret;
232
+ },
233
+ __wbg_new_0c7403db6e782f19: function(arg0) {
234
+ const ret = new Uint8Array(arg0);
235
+ return ret;
236
+ },
237
+ __wbg_new_227d7c05414eb861: function() {
238
+ const ret = new Error();
239
+ return ret;
240
+ },
241
+ __wbg_new_682678e2f47e32bc: function() {
242
+ const ret = new Array();
243
+ return ret;
244
+ },
245
+ __wbg_new_aa8d0fa9762c29bd: function() {
246
+ const ret = new Object();
247
+ return ret;
248
+ },
249
+ __wbg_next_0340c4ae324393c3: function() { return handleError(function (arg0) {
250
+ const ret = arg0.next();
251
+ return ret;
252
+ }, arguments); },
253
+ __wbg_next_7646edaa39458ef7: function(arg0) {
254
+ const ret = arg0.next;
255
+ return ret;
256
+ },
257
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
258
+ const ret = arg0.now();
259
+ return ret;
260
+ },
261
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
262
+ const ret = arg0.performance;
263
+ return ret;
264
+ },
265
+ __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
266
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
267
+ },
268
+ __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
269
+ arg0[arg1 >>> 0] = arg2;
270
+ },
271
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
272
+ arg0[arg1] = arg2;
273
+ },
274
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
275
+ const ret = arg1.stack;
276
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
277
+ const len1 = WASM_VECTOR_LEN;
278
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
279
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
280
+ },
281
+ __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
282
+ const ret = typeof global === 'undefined' ? null : global;
283
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
284
+ },
285
+ __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
286
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
287
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
288
+ },
289
+ __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
290
+ const ret = typeof self === 'undefined' ? null : self;
291
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
292
+ },
293
+ __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
294
+ const ret = typeof window === 'undefined' ? null : window;
295
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
296
+ },
297
+ __wbg_value_ee3a06f4579184fa: function(arg0) {
298
+ const ret = arg0.value;
299
+ return ret;
300
+ },
301
+ __wbindgen_cast_0000000000000001: function(arg0) {
302
+ // Cast intrinsic for `F64 -> Externref`.
303
+ const ret = arg0;
304
+ return ret;
305
+ },
306
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
307
+ // Cast intrinsic for `Ref(String) -> Externref`.
308
+ const ret = getStringFromWasm0(arg0, arg1);
309
+ return ret;
310
+ },
311
+ __wbindgen_init_externref_table: function() {
312
+ const table = wasm.__wbindgen_externrefs;
313
+ const offset = table.grow(4);
314
+ table.set(0, undefined);
315
+ table.set(offset + 0, undefined);
316
+ table.set(offset + 1, null);
317
+ table.set(offset + 2, true);
318
+ table.set(offset + 3, false);
319
+ },
320
+ };
321
+ return {
322
+ __proto__: null,
323
+ "./flipt_engine_wasm_js_bg.js": import0,
324
+ };
97
325
  }
98
326
 
99
- function isLikeNone(x) {
100
- return x === undefined || x === null;
327
+ const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
328
+ ? { register: () => {}, unregister: () => {} }
329
+ : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
330
+
331
+ function addToExternrefTable0(obj) {
332
+ const idx = wasm.__externref_table_alloc();
333
+ wasm.__wbindgen_externrefs.set(idx, obj);
334
+ return idx;
101
335
  }
102
336
 
103
337
  function debugString(val) {
@@ -165,10 +399,30 @@ function debugString(val) {
165
399
  return className;
166
400
  }
167
401
 
168
- function addToExternrefTable0(obj) {
169
- const idx = wasm.__externref_table_alloc();
170
- wasm.__wbindgen_externrefs.set(idx, obj);
171
- return idx;
402
+ function getArrayU8FromWasm0(ptr, len) {
403
+ ptr = ptr >>> 0;
404
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
405
+ }
406
+
407
+ let cachedDataViewMemory0 = null;
408
+ function getDataViewMemory0() {
409
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
410
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
411
+ }
412
+ return cachedDataViewMemory0;
413
+ }
414
+
415
+ function getStringFromWasm0(ptr, len) {
416
+ ptr = ptr >>> 0;
417
+ return decodeText(ptr, len);
418
+ }
419
+
420
+ let cachedUint8ArrayMemory0 = null;
421
+ function getUint8ArrayMemory0() {
422
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
423
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
424
+ }
425
+ return cachedUint8ArrayMemory0;
172
426
  }
173
427
 
174
428
  function handleError(f, args) {
@@ -180,393 +434,131 @@ function handleError(f, args) {
180
434
  }
181
435
  }
182
436
 
183
- function getArrayU8FromWasm0(ptr, len) {
184
- ptr = ptr >>> 0;
185
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
437
+ function isLikeNone(x) {
438
+ return x === undefined || x === null;
186
439
  }
187
440
 
188
- function takeFromExternrefTable0(idx) {
189
- const value = wasm.__wbindgen_externrefs.get(idx);
190
- wasm.__externref_table_dealloc(idx);
191
- return value;
192
- }
441
+ function passStringToWasm0(arg, malloc, realloc) {
442
+ if (realloc === undefined) {
443
+ const buf = cachedTextEncoder.encode(arg);
444
+ const ptr = malloc(buf.length, 1) >>> 0;
445
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
446
+ WASM_VECTOR_LEN = buf.length;
447
+ return ptr;
448
+ }
193
449
 
194
- const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
195
- ? { register: () => {}, unregister: () => {} }
196
- : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
450
+ let len = arg.length;
451
+ let ptr = malloc(len, 1) >>> 0;
197
452
 
198
- class Engine {
453
+ const mem = getUint8ArrayMemory0();
199
454
 
200
- __destroy_into_raw() {
201
- const ptr = this.__wbg_ptr;
202
- this.__wbg_ptr = 0;
203
- EngineFinalization.unregister(this);
204
- return ptr;
205
- }
455
+ let offset = 0;
206
456
 
207
- free() {
208
- const ptr = this.__destroy_into_raw();
209
- wasm.__wbg_engine_free(ptr, 0);
210
- }
211
- /**
212
- * @param {string} namespace
213
- */
214
- constructor(namespace) {
215
- const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
216
- const len0 = WASM_VECTOR_LEN;
217
- const ret = wasm.engine_new(ptr0, len0);
218
- this.__wbg_ptr = ret >>> 0;
219
- EngineFinalization.register(this, this.__wbg_ptr, this);
220
- return this;
221
- }
222
- /**
223
- * @param {any} data
224
- */
225
- snapshot(data) {
226
- const ret = wasm.engine_snapshot(this.__wbg_ptr, data);
227
- if (ret[1]) {
228
- throw takeFromExternrefTable0(ret[0]);
229
- }
230
- }
231
- /**
232
- * @param {any} request
233
- * @returns {any}
234
- */
235
- evaluate_boolean(request) {
236
- const ret = wasm.engine_evaluate_boolean(this.__wbg_ptr, request);
237
- if (ret[2]) {
238
- throw takeFromExternrefTable0(ret[1]);
239
- }
240
- return takeFromExternrefTable0(ret[0]);
241
- }
242
- /**
243
- * @param {any} request
244
- * @returns {any}
245
- */
246
- evaluate_variant(request) {
247
- const ret = wasm.engine_evaluate_variant(this.__wbg_ptr, request);
248
- if (ret[2]) {
249
- throw takeFromExternrefTable0(ret[1]);
250
- }
251
- return takeFromExternrefTable0(ret[0]);
457
+ for (; offset < len; offset++) {
458
+ const code = arg.charCodeAt(offset);
459
+ if (code > 0x7F) break;
460
+ mem[ptr + offset] = code;
252
461
  }
253
- /**
254
- * @param {any} request
255
- * @returns {any}
256
- */
257
- evaluate_batch(request) {
258
- const ret = wasm.engine_evaluate_batch(this.__wbg_ptr, request);
259
- if (ret[2]) {
260
- throw takeFromExternrefTable0(ret[1]);
462
+ if (offset !== len) {
463
+ if (offset !== 0) {
464
+ arg = arg.slice(offset);
261
465
  }
262
- return takeFromExternrefTable0(ret[0]);
466
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
467
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
468
+ const ret = cachedTextEncoder.encodeInto(arg, view);
469
+
470
+ offset += ret.written;
471
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
263
472
  }
264
- /**
265
- * @returns {any}
266
- */
267
- list_flags() {
268
- const ret = wasm.engine_list_flags(this.__wbg_ptr);
269
- if (ret[2]) {
270
- throw takeFromExternrefTable0(ret[1]);
271
- }
272
- return takeFromExternrefTable0(ret[0]);
473
+
474
+ WASM_VECTOR_LEN = offset;
475
+ return ptr;
476
+ }
477
+
478
+ function takeFromExternrefTable0(idx) {
479
+ const value = wasm.__wbindgen_externrefs.get(idx);
480
+ wasm.__externref_table_dealloc(idx);
481
+ return value;
482
+ }
483
+
484
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
485
+ cachedTextDecoder.decode();
486
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
487
+ let numBytesDecoded = 0;
488
+ function decodeText(ptr, len) {
489
+ numBytesDecoded += len;
490
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
491
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
492
+ cachedTextDecoder.decode();
493
+ numBytesDecoded = len;
273
494
  }
495
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
274
496
  }
275
- if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
276
497
 
277
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
498
+ const cachedTextEncoder = new TextEncoder();
499
+
500
+ if (!('encodeInto' in cachedTextEncoder)) {
501
+ cachedTextEncoder.encodeInto = function (arg, view) {
502
+ const buf = cachedTextEncoder.encode(arg);
503
+ view.set(buf);
504
+ return {
505
+ read: arg.length,
506
+ written: buf.length
507
+ };
508
+ };
509
+ }
510
+
511
+ let WASM_VECTOR_LEN = 0;
512
+
513
+ let wasm;
514
+ function __wbg_finalize_init(instance, module) {
515
+ wasm = instance.exports;
516
+ cachedDataViewMemory0 = null;
517
+ cachedUint8ArrayMemory0 = null;
518
+ wasm.__wbindgen_start();
519
+ return wasm;
520
+ }
278
521
 
279
522
  async function __wbg_load(module, imports) {
280
523
  if (typeof Response === 'function' && module instanceof Response) {
281
524
  if (typeof WebAssembly.instantiateStreaming === 'function') {
282
525
  try {
283
526
  return await WebAssembly.instantiateStreaming(module, imports);
284
-
285
527
  } catch (e) {
286
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
528
+ const validResponse = module.ok && expectedResponseType(module.type);
287
529
 
288
530
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
289
531
  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);
290
532
 
291
- } else {
292
- throw e;
293
- }
533
+ } else { throw e; }
294
534
  }
295
535
  }
296
536
 
297
537
  const bytes = await module.arrayBuffer();
298
538
  return await WebAssembly.instantiate(bytes, imports);
299
-
300
539
  } else {
301
540
  const instance = await WebAssembly.instantiate(module, imports);
302
541
 
303
542
  if (instance instanceof WebAssembly.Instance) {
304
543
  return { instance, module };
305
-
306
544
  } else {
307
545
  return instance;
308
546
  }
309
547
  }
310
- }
311
548
 
312
- function __wbg_get_imports() {
313
- const imports = {};
314
- imports.wbg = {};
315
- imports.wbg.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
316
- const ret = Error(getStringFromWasm0(arg0, arg1));
317
- return ret;
318
- };
319
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
320
- const ret = String(arg1);
321
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
- const len1 = WASM_VECTOR_LEN;
323
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
324
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
325
- };
326
- imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
327
- const v = arg0;
328
- const ret = typeof(v) === 'boolean' ? v : undefined;
329
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
330
- };
331
- imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
332
- const ret = debugString(arg1);
333
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
334
- const len1 = WASM_VECTOR_LEN;
335
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
336
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
337
- };
338
- imports.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
339
- const ret = arg0 in arg1;
340
- return ret;
341
- };
342
- imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
343
- const ret = typeof(arg0) === 'function';
344
- return ret;
345
- };
346
- imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
347
- const val = arg0;
348
- const ret = typeof(val) === 'object' && val !== null;
349
- return ret;
350
- };
351
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
352
- const ret = typeof(arg0) === 'string';
353
- return ret;
354
- };
355
- imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
356
- const ret = arg0 === undefined;
357
- return ret;
358
- };
359
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
360
- const ret = arg0 == arg1;
361
- return ret;
362
- };
363
- imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
364
- const obj = arg1;
365
- const ret = typeof(obj) === 'number' ? obj : undefined;
366
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
367
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
368
- };
369
- imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
370
- const obj = arg1;
371
- const ret = typeof(obj) === 'string' ? obj : undefined;
372
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
373
- var len1 = WASM_VECTOR_LEN;
374
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
375
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
376
- };
377
- imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
378
- throw new Error(getStringFromWasm0(arg0, arg1));
379
- };
380
- imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
381
- const ret = arg0.call(arg1);
382
- return ret;
383
- }, arguments) };
384
- imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
385
- const ret = arg0.done;
386
- return ret;
387
- };
388
- imports.wbg.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
389
- const ret = Object.entries(arg0);
390
- return ret;
391
- };
392
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
393
- let deferred0_0;
394
- let deferred0_1;
395
- try {
396
- deferred0_0 = arg0;
397
- deferred0_1 = arg1;
398
- console.error(getStringFromWasm0(arg0, arg1));
399
- } finally {
400
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
401
- }
402
- };
403
- imports.wbg.__wbg_getTime_14776bfb48a1bff9 = function(arg0) {
404
- const ret = arg0.getTime();
405
- return ret;
406
- };
407
- imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
408
- const ret = arg0[arg1 >>> 0];
409
- return ret;
410
- };
411
- imports.wbg.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
412
- const ret = Reflect.get(arg0, arg1);
413
- return ret;
414
- }, arguments) };
415
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
416
- const ret = arg0[arg1];
417
- return ret;
418
- };
419
- imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
420
- let result;
421
- try {
422
- result = arg0 instanceof ArrayBuffer;
423
- } catch (_) {
424
- result = false;
425
- }
426
- const ret = result;
427
- return ret;
428
- };
429
- imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
430
- let result;
431
- try {
432
- result = arg0 instanceof Uint8Array;
433
- } catch (_) {
434
- result = false;
549
+ function expectedResponseType(type) {
550
+ switch (type) {
551
+ case 'basic': case 'cors': case 'default': return true;
435
552
  }
436
- const ret = result;
437
- return ret;
438
- };
439
- imports.wbg.__wbg_isArray_96e0af9891d0945d = function(arg0) {
440
- const ret = Array.isArray(arg0);
441
- return ret;
442
- };
443
- imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
444
- const ret = Symbol.iterator;
445
- return ret;
446
- };
447
- imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
448
- const ret = arg0.length;
449
- return ret;
450
- };
451
- imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
452
- const ret = arg0.length;
453
- return ret;
454
- };
455
- imports.wbg.__wbg_new_0_f9740686d739025c = function() {
456
- const ret = new Date();
457
- return ret;
458
- };
459
- imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
460
- const ret = new Object();
461
- return ret;
462
- };
463
- imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
464
- const ret = new Uint8Array(arg0);
465
- return ret;
466
- };
467
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
468
- const ret = new Error();
469
- return ret;
470
- };
471
- imports.wbg.__wbg_new_e17d9f43105b08be = function() {
472
- const ret = new Array();
473
- return ret;
474
- };
475
- imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
476
- const ret = new Function(getStringFromWasm0(arg0, arg1));
477
- return ret;
478
- };
479
- imports.wbg.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
480
- const ret = arg0.next();
481
- return ret;
482
- }, arguments) };
483
- imports.wbg.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
484
- const ret = arg0.next;
485
- return ret;
486
- };
487
- imports.wbg.__wbg_now_2c95c9de01293173 = function(arg0) {
488
- const ret = arg0.now();
489
- return ret;
490
- };
491
- imports.wbg.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
492
- const ret = arg0.performance;
493
- return ret;
494
- };
495
- imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
496
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
497
- };
498
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
499
- arg0[arg1] = arg2;
500
- };
501
- imports.wbg.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
502
- arg0[arg1 >>> 0] = arg2;
503
- };
504
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
505
- const ret = arg1.stack;
506
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
507
- const len1 = WASM_VECTOR_LEN;
508
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
509
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
510
- };
511
- imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
512
- const ret = typeof global === 'undefined' ? null : global;
513
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
514
- };
515
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
516
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
517
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
518
- };
519
- imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
520
- const ret = typeof self === 'undefined' ? null : self;
521
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
522
- };
523
- imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
524
- const ret = typeof window === 'undefined' ? null : window;
525
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
526
- };
527
- imports.wbg.__wbg_value_692627309814bb8c = function(arg0) {
528
- const ret = arg0.value;
529
- return ret;
530
- };
531
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
532
- // Cast intrinsic for `Ref(String) -> Externref`.
533
- const ret = getStringFromWasm0(arg0, arg1);
534
- return ret;
535
- };
536
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
537
- // Cast intrinsic for `F64 -> Externref`.
538
- const ret = arg0;
539
- return ret;
540
- };
541
- imports.wbg.__wbindgen_init_externref_table = function() {
542
- const table = wasm.__wbindgen_externrefs;
543
- const offset = table.grow(4);
544
- table.set(0, undefined);
545
- table.set(offset + 0, undefined);
546
- table.set(offset + 1, null);
547
- table.set(offset + 2, true);
548
- table.set(offset + 3, false);
549
- };
550
-
551
- return imports;
552
- }
553
-
554
- function __wbg_finalize_init(instance, module) {
555
- wasm = instance.exports;
556
- __wbg_init.__wbindgen_wasm_module = module;
557
- cachedDataViewMemory0 = null;
558
- cachedUint8ArrayMemory0 = null;
559
-
560
-
561
- wasm.__wbindgen_start();
562
- return wasm;
553
+ return false;
554
+ }
563
555
  }
564
556
 
565
557
  async function __wbg_init(module_or_path) {
566
558
  if (wasm !== undefined) return wasm;
567
559
 
568
560
 
569
- if (typeof module_or_path !== 'undefined') {
561
+ if (module_or_path !== undefined) {
570
562
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
571
563
  ({module_or_path} = module_or_path);
572
564
  } else {
@@ -574,7 +566,7 @@ async function __wbg_init(module_or_path) {
574
566
  }
575
567
  }
576
568
 
577
- if (typeof module_or_path === 'undefined') {
569
+ if (module_or_path === undefined) {
578
570
  module_or_path = new URL('flipt_engine_wasm_js_bg.wasm', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
579
571
  }
580
572
  const imports = __wbg_get_imports();
@@ -585,7 +577,7 @@ async function __wbg_init(module_or_path) {
585
577
 
586
578
  const { instance, module } = await __wbg_load(await module_or_path, imports);
587
579
 
588
- return __wbg_finalize_init(instance, module);
580
+ return __wbg_finalize_init(instance);
589
581
  }
590
582
 
591
583
  /**