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

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,338 @@
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]);
47
+ }
48
+ return takeFromExternrefTable0(ret[0]);
49
+ }
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]);
59
+ }
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]);
77
78
  }
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;
84
79
  }
85
-
86
- WASM_VECTOR_LEN = offset;
87
- return ptr;
88
80
  }
81
+ if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
89
82
 
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);
95
- }
96
- return cachedDataViewMemory0;
83
+ function __wbg_get_imports() {
84
+ const import0 = {
85
+ __proto__: null,
86
+ __wbg_Error_55538483de6e3abe: function(arg0, arg1) {
87
+ const ret = Error(getStringFromWasm0(arg0, arg1));
88
+ return ret;
89
+ },
90
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
91
+ const ret = String(arg1);
92
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
93
+ const len1 = WASM_VECTOR_LEN;
94
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
95
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
96
+ },
97
+ __wbg___wbindgen_boolean_get_fe2a24fdfdb4064f: function(arg0) {
98
+ const v = arg0;
99
+ const ret = typeof(v) === 'boolean' ? v : undefined;
100
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
101
+ },
102
+ __wbg___wbindgen_debug_string_d89627202d0155b7: function(arg0, arg1) {
103
+ const ret = debugString(arg1);
104
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
+ const len1 = WASM_VECTOR_LEN;
106
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
107
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
108
+ },
109
+ __wbg___wbindgen_in_fe3eb6a509f75744: function(arg0, arg1) {
110
+ const ret = arg0 in arg1;
111
+ return ret;
112
+ },
113
+ __wbg___wbindgen_is_function_2a95406423ea8626: function(arg0) {
114
+ const ret = typeof(arg0) === 'function';
115
+ return ret;
116
+ },
117
+ __wbg___wbindgen_is_object_59a002e76b059312: function(arg0) {
118
+ const val = arg0;
119
+ const ret = typeof(val) === 'object' && val !== null;
120
+ return ret;
121
+ },
122
+ __wbg___wbindgen_is_string_624d5244bb2bc87c: function(arg0) {
123
+ const ret = typeof(arg0) === 'string';
124
+ return ret;
125
+ },
126
+ __wbg___wbindgen_is_undefined_87a3a837f331fef5: function(arg0) {
127
+ const ret = arg0 === undefined;
128
+ return ret;
129
+ },
130
+ __wbg___wbindgen_jsval_loose_eq_cf851f110c48f9ba: function(arg0, arg1) {
131
+ const ret = arg0 == arg1;
132
+ return ret;
133
+ },
134
+ __wbg___wbindgen_number_get_769f3676dc20c1d7: function(arg0, arg1) {
135
+ const obj = arg1;
136
+ const ret = typeof(obj) === 'number' ? obj : undefined;
137
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
138
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
139
+ },
140
+ __wbg___wbindgen_string_get_f1161390414f9b59: function(arg0, arg1) {
141
+ const obj = arg1;
142
+ const ret = typeof(obj) === 'string' ? obj : undefined;
143
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
144
+ var len1 = WASM_VECTOR_LEN;
145
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
146
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
147
+ },
148
+ __wbg___wbindgen_throw_5549492daedad139: function(arg0, arg1) {
149
+ throw new Error(getStringFromWasm0(arg0, arg1));
150
+ },
151
+ __wbg_call_6ae20895a60069a2: function() { return handleError(function (arg0, arg1) {
152
+ const ret = arg0.call(arg1);
153
+ return ret;
154
+ }, arguments); },
155
+ __wbg_done_19f92cb1f8738aba: function(arg0) {
156
+ const ret = arg0.done;
157
+ return ret;
158
+ },
159
+ __wbg_entries_28ed7cb892e12eff: function(arg0) {
160
+ const ret = Object.entries(arg0);
161
+ return ret;
162
+ },
163
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
164
+ let deferred0_0;
165
+ let deferred0_1;
166
+ try {
167
+ deferred0_0 = arg0;
168
+ deferred0_1 = arg1;
169
+ console.error(getStringFromWasm0(arg0, arg1));
170
+ } finally {
171
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
172
+ }
173
+ },
174
+ __wbg_getTime_c3af35594e283356: function(arg0) {
175
+ const ret = arg0.getTime();
176
+ return ret;
177
+ },
178
+ __wbg_get_94f5fc088edd3138: function(arg0, arg1) {
179
+ const ret = arg0[arg1 >>> 0];
180
+ return ret;
181
+ },
182
+ __wbg_get_a50328e7325d7f9b: function() { return handleError(function (arg0, arg1) {
183
+ const ret = Reflect.get(arg0, arg1);
184
+ return ret;
185
+ }, arguments); },
186
+ __wbg_get_unchecked_7c6bbabf5b0b1fbf: function(arg0, arg1) {
187
+ const ret = arg0[arg1 >>> 0];
188
+ return ret;
189
+ },
190
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
191
+ const ret = arg0[arg1];
192
+ return ret;
193
+ },
194
+ __wbg_instanceof_ArrayBuffer_8d855993947fc3a2: function(arg0) {
195
+ let result;
196
+ try {
197
+ result = arg0 instanceof ArrayBuffer;
198
+ } catch (_) {
199
+ result = false;
200
+ }
201
+ const ret = result;
202
+ return ret;
203
+ },
204
+ __wbg_instanceof_Uint8Array_ce24d58a5f4bdcc3: function(arg0) {
205
+ let result;
206
+ try {
207
+ result = arg0 instanceof Uint8Array;
208
+ } catch (_) {
209
+ result = false;
210
+ }
211
+ const ret = result;
212
+ return ret;
213
+ },
214
+ __wbg_isArray_867202cf8f195ed8: function(arg0) {
215
+ const ret = Array.isArray(arg0);
216
+ return ret;
217
+ },
218
+ __wbg_iterator_54661826e186eb6a: function() {
219
+ const ret = Symbol.iterator;
220
+ return ret;
221
+ },
222
+ __wbg_length_e6e1633fbea6cfa9: function(arg0) {
223
+ const ret = arg0.length;
224
+ return ret;
225
+ },
226
+ __wbg_length_fae3e439140f48a4: function(arg0) {
227
+ const ret = arg0.length;
228
+ return ret;
229
+ },
230
+ __wbg_new_0_e649c99e7382313f: function() {
231
+ const ret = new Date();
232
+ return ret;
233
+ },
234
+ __wbg_new_1d96678aaacca32e: function(arg0) {
235
+ const ret = new Uint8Array(arg0);
236
+ return ret;
237
+ },
238
+ __wbg_new_227d7c05414eb861: function() {
239
+ const ret = new Error();
240
+ return ret;
241
+ },
242
+ __wbg_new_4370be21fa2b2f80: function() {
243
+ const ret = new Array();
244
+ return ret;
245
+ },
246
+ __wbg_new_48e1d86cfd30c8e7: function() {
247
+ const ret = new Object();
248
+ return ret;
249
+ },
250
+ __wbg_next_55d835fe0ab5b3e7: function(arg0) {
251
+ const ret = arg0.next;
252
+ return ret;
253
+ },
254
+ __wbg_next_e34cfb9df1518d7c: function() { return handleError(function (arg0) {
255
+ const ret = arg0.next();
256
+ return ret;
257
+ }, arguments); },
258
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
259
+ const ret = arg0.now();
260
+ return ret;
261
+ },
262
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
263
+ const ret = arg0.performance;
264
+ return ret;
265
+ },
266
+ __wbg_prototypesetcall_3875d54d12ef2eec: function(arg0, arg1, arg2) {
267
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
268
+ },
269
+ __wbg_set_4702dfa37c77f492: function(arg0, arg1, arg2) {
270
+ arg0[arg1 >>> 0] = arg2;
271
+ },
272
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
273
+ arg0[arg1] = arg2;
274
+ },
275
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
276
+ const ret = arg1.stack;
277
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
278
+ const len1 = WASM_VECTOR_LEN;
279
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
280
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
281
+ },
282
+ __wbg_static_accessor_GLOBAL_8dfb7f5e26ebe523: function() {
283
+ const ret = typeof global === 'undefined' ? null : global;
284
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
285
+ },
286
+ __wbg_static_accessor_GLOBAL_THIS_941154efc8395cdd: function() {
287
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
288
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
289
+ },
290
+ __wbg_static_accessor_SELF_58dac9af822f561f: function() {
291
+ const ret = typeof self === 'undefined' ? null : self;
292
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
293
+ },
294
+ __wbg_static_accessor_WINDOW_ee64f0b3d8354c0b: function() {
295
+ const ret = typeof window === 'undefined' ? null : window;
296
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
297
+ },
298
+ __wbg_value_d5b248ce8419bd1b: function(arg0) {
299
+ const ret = arg0.value;
300
+ return ret;
301
+ },
302
+ __wbindgen_cast_0000000000000001: function(arg0) {
303
+ // Cast intrinsic for `F64 -> Externref`.
304
+ const ret = arg0;
305
+ return ret;
306
+ },
307
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
308
+ // Cast intrinsic for `Ref(String) -> Externref`.
309
+ const ret = getStringFromWasm0(arg0, arg1);
310
+ return ret;
311
+ },
312
+ __wbindgen_init_externref_table: function() {
313
+ const table = wasm.__wbindgen_externrefs;
314
+ const offset = table.grow(4);
315
+ table.set(0, undefined);
316
+ table.set(offset + 0, undefined);
317
+ table.set(offset + 1, null);
318
+ table.set(offset + 2, true);
319
+ table.set(offset + 3, false);
320
+ },
321
+ };
322
+ return {
323
+ __proto__: null,
324
+ "./flipt_engine_wasm_js_bg.js": import0,
325
+ };
97
326
  }
98
327
 
99
- function isLikeNone(x) {
100
- return x === undefined || x === null;
328
+ const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
329
+ ? { register: () => {}, unregister: () => {} }
330
+ : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
331
+
332
+ function addToExternrefTable0(obj) {
333
+ const idx = wasm.__externref_table_alloc();
334
+ wasm.__wbindgen_externrefs.set(idx, obj);
335
+ return idx;
101
336
  }
102
337
 
103
338
  function debugString(val) {
@@ -165,10 +400,30 @@ function debugString(val) {
165
400
  return className;
166
401
  }
167
402
 
168
- function addToExternrefTable0(obj) {
169
- const idx = wasm.__externref_table_alloc();
170
- wasm.__wbindgen_externrefs.set(idx, obj);
171
- return idx;
403
+ function getArrayU8FromWasm0(ptr, len) {
404
+ ptr = ptr >>> 0;
405
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
406
+ }
407
+
408
+ let cachedDataViewMemory0 = null;
409
+ function getDataViewMemory0() {
410
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
411
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
412
+ }
413
+ return cachedDataViewMemory0;
414
+ }
415
+
416
+ function getStringFromWasm0(ptr, len) {
417
+ ptr = ptr >>> 0;
418
+ return decodeText(ptr, len);
419
+ }
420
+
421
+ let cachedUint8ArrayMemory0 = null;
422
+ function getUint8ArrayMemory0() {
423
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
424
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
425
+ }
426
+ return cachedUint8ArrayMemory0;
172
427
  }
173
428
 
174
429
  function handleError(f, args) {
@@ -180,393 +435,131 @@ function handleError(f, args) {
180
435
  }
181
436
  }
182
437
 
183
- function getArrayU8FromWasm0(ptr, len) {
184
- ptr = ptr >>> 0;
185
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
438
+ function isLikeNone(x) {
439
+ return x === undefined || x === null;
186
440
  }
187
441
 
188
- function takeFromExternrefTable0(idx) {
189
- const value = wasm.__wbindgen_externrefs.get(idx);
190
- wasm.__externref_table_dealloc(idx);
191
- return value;
192
- }
442
+ function passStringToWasm0(arg, malloc, realloc) {
443
+ if (realloc === undefined) {
444
+ const buf = cachedTextEncoder.encode(arg);
445
+ const ptr = malloc(buf.length, 1) >>> 0;
446
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
447
+ WASM_VECTOR_LEN = buf.length;
448
+ return ptr;
449
+ }
193
450
 
194
- const EngineFinalization = (typeof FinalizationRegistry === 'undefined')
195
- ? { register: () => {}, unregister: () => {} }
196
- : new FinalizationRegistry(ptr => wasm.__wbg_engine_free(ptr >>> 0, 1));
451
+ let len = arg.length;
452
+ let ptr = malloc(len, 1) >>> 0;
197
453
 
198
- class Engine {
454
+ const mem = getUint8ArrayMemory0();
199
455
 
200
- __destroy_into_raw() {
201
- const ptr = this.__wbg_ptr;
202
- this.__wbg_ptr = 0;
203
- EngineFinalization.unregister(this);
204
- return ptr;
205
- }
456
+ let offset = 0;
206
457
 
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]);
458
+ for (; offset < len; offset++) {
459
+ const code = arg.charCodeAt(offset);
460
+ if (code > 0x7F) break;
461
+ mem[ptr + offset] = code;
252
462
  }
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]);
463
+ if (offset !== len) {
464
+ if (offset !== 0) {
465
+ arg = arg.slice(offset);
261
466
  }
262
- return takeFromExternrefTable0(ret[0]);
467
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
468
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
469
+ const ret = cachedTextEncoder.encodeInto(arg, view);
470
+
471
+ offset += ret.written;
472
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
263
473
  }
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]);
474
+
475
+ WASM_VECTOR_LEN = offset;
476
+ return ptr;
477
+ }
478
+
479
+ function takeFromExternrefTable0(idx) {
480
+ const value = wasm.__wbindgen_externrefs.get(idx);
481
+ wasm.__externref_table_dealloc(idx);
482
+ return value;
483
+ }
484
+
485
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
486
+ cachedTextDecoder.decode();
487
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
488
+ let numBytesDecoded = 0;
489
+ function decodeText(ptr, len) {
490
+ numBytesDecoded += len;
491
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
492
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
493
+ cachedTextDecoder.decode();
494
+ numBytesDecoded = len;
273
495
  }
496
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
274
497
  }
275
- if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
276
498
 
277
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
499
+ const cachedTextEncoder = new TextEncoder();
500
+
501
+ if (!('encodeInto' in cachedTextEncoder)) {
502
+ cachedTextEncoder.encodeInto = function (arg, view) {
503
+ const buf = cachedTextEncoder.encode(arg);
504
+ view.set(buf);
505
+ return {
506
+ read: arg.length,
507
+ written: buf.length
508
+ };
509
+ };
510
+ }
511
+
512
+ let WASM_VECTOR_LEN = 0;
513
+
514
+ let wasm;
515
+ function __wbg_finalize_init(instance, module) {
516
+ wasm = instance.exports;
517
+ cachedDataViewMemory0 = null;
518
+ cachedUint8ArrayMemory0 = null;
519
+ wasm.__wbindgen_start();
520
+ return wasm;
521
+ }
278
522
 
279
523
  async function __wbg_load(module, imports) {
280
524
  if (typeof Response === 'function' && module instanceof Response) {
281
525
  if (typeof WebAssembly.instantiateStreaming === 'function') {
282
526
  try {
283
527
  return await WebAssembly.instantiateStreaming(module, imports);
284
-
285
528
  } catch (e) {
286
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
529
+ const validResponse = module.ok && expectedResponseType(module.type);
287
530
 
288
531
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
289
532
  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
533
 
291
- } else {
292
- throw e;
293
- }
534
+ } else { throw e; }
294
535
  }
295
536
  }
296
537
 
297
538
  const bytes = await module.arrayBuffer();
298
539
  return await WebAssembly.instantiate(bytes, imports);
299
-
300
540
  } else {
301
541
  const instance = await WebAssembly.instantiate(module, imports);
302
542
 
303
543
  if (instance instanceof WebAssembly.Instance) {
304
544
  return { instance, module };
305
-
306
545
  } else {
307
546
  return instance;
308
547
  }
309
548
  }
310
- }
311
549
 
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;
550
+ function expectedResponseType(type) {
551
+ switch (type) {
552
+ case 'basic': case 'cors': case 'default': return true;
435
553
  }
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;
554
+ return false;
555
+ }
563
556
  }
564
557
 
565
558
  async function __wbg_init(module_or_path) {
566
559
  if (wasm !== undefined) return wasm;
567
560
 
568
561
 
569
- if (typeof module_or_path !== 'undefined') {
562
+ if (module_or_path !== undefined) {
570
563
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
571
564
  ({module_or_path} = module_or_path);
572
565
  } else {
@@ -574,7 +567,7 @@ async function __wbg_init(module_or_path) {
574
567
  }
575
568
  }
576
569
 
577
- if (typeof module_or_path === 'undefined') {
570
+ if (module_or_path === undefined) {
578
571
  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
572
  }
580
573
  const imports = __wbg_get_imports();
@@ -585,7 +578,7 @@ async function __wbg_init(module_or_path) {
585
578
 
586
579
  const { instance, module } = await __wbg_load(await module_or_path, imports);
587
580
 
588
- return __wbg_finalize_init(instance, module);
581
+ return __wbg_finalize_init(instance);
589
582
  }
590
583
 
591
584
  /**