OXYGENHUB
# 6907a989e82a oxygenhub / assets / backdrop / backdrop.js
26.1 KiB · JavaScript · last changed feat(web): Your sky closer and fuller: 40% larger, tighter knots, the margins filled (refs #157) 22 days ago source blame history raw
1
/**
2
 * Start the dashboard's sky on `canvas` with the page's `data`. `still`
3
 * is the viewer's choice of a still backdrop; reduced motion asks for
4
 * one too. Without WebGL2 there is no backdrop, and nothing breaks.
5
 * @param {HTMLCanvasElement} canvas
6
 * @param {any} data
7
 * @param {boolean} still
8
 */
9
export function start(canvas, data, still) {
10
    const ret = wasm.start(canvas, data, still);
11
    if (ret[1]) {
12
        throw takeFromExternrefTable0(ret[0]);
13
    }
14
}
15
function __wbg_get_imports() {
16
    const import0 = {
17
        __proto__: null,
18
        __wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
19
            const v = arg0;
20
            const ret = typeof(v) === 'boolean' ? v : undefined;
21
            return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
22
        },
23
        __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
24
            const ret = arg0 === undefined;
25
            return ret;
26
        },
27
        __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
28
            const obj = arg1;
29
            const ret = typeof(obj) === 'number' ? obj : undefined;
30
            getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
31
            getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
32
        },
33
        __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
34
            const obj = arg1;
35
            const ret = typeof(obj) === 'string' ? obj : undefined;
36
            var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
37
            var len1 = WASM_VECTOR_LEN;
38
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
39
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
40
        },
41
        __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
42
            throw new Error(getStringFromWasm0(arg0, arg1));
43
        },
44
        __wbg__wbg_cb_unref_dcc1a90847f04c41: function(arg0) {
45
            arg0._wbg_cb_unref();
46
        },
47
        __wbg_addEventListener_4d0db17c671ea324: function() { return handleError(function (arg0, arg1, arg2, arg3) {
48
            arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
49
        }, arguments); },
50
        __wbg_appendChild_fb8c52e7dd8484ea: function() { return handleError(function (arg0, arg1) {
51
            const ret = arg0.appendChild(arg1);
52
            return ret;
53
        }, arguments); },
54
        __wbg_attachShader_9567ae57af6746d5: function(arg0, arg1, arg2) {
55
            arg0.attachShader(arg1, arg2);
56
        },
57
        __wbg_bindBuffer_0324f62b876c4403: function(arg0, arg1, arg2) {
58
            arg0.bindBuffer(arg1 >>> 0, arg2);
59
        },
60
        __wbg_bindVertexArray_f58af0a346185ec5: function(arg0, arg1) {
61
            arg0.bindVertexArray(arg1);
62
        },
63
        __wbg_blendFunc_589e4252bb396484: function(arg0, arg1, arg2) {
64
            arg0.blendFunc(arg1 >>> 0, arg2 >>> 0);
65
        },
66
        __wbg_body_e549239eaff082e1: function(arg0) {
67
            const ret = arg0.body;
68
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
69
        },
70
        __wbg_bufferData_5fa44d94fe7a3878: function(arg0, arg1, arg2, arg3) {
71
            arg0.bufferData(arg1 >>> 0, arg2, arg3 >>> 0);
72
        },
73
        __wbg_clearColor_796427e8ac60fe14: function(arg0, arg1, arg2, arg3, arg4) {
74
            arg0.clearColor(arg1, arg2, arg3, arg4);
75
        },
76
        __wbg_clear_cb96796cc568b7c8: function(arg0, arg1) {
77
            arg0.clear(arg1 >>> 0);
78
        },
79
        __wbg_clientX_5075231ed45e8ef5: function(arg0) {
80
            const ret = arg0.clientX;
81
            return ret;
82
        },
83
        __wbg_clientY_846c39814ce02ab2: function(arg0) {
84
            const ret = arg0.clientY;
85
            return ret;
86
        },
87
        __wbg_compileShader_c2b53ff3a8851f60: function(arg0, arg1) {
88
            arg0.compileShader(arg1);
89
        },
90
        __wbg_createBuffer_ffe613371d42cfd3: function(arg0) {
91
            const ret = arg0.createBuffer();
92
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
93
        },
94
        __wbg_createElement_74049073a11f9c31: function() { return handleError(function (arg0, arg1, arg2) {
95
            const ret = arg0.createElement(getStringFromWasm0(arg1, arg2));
96
            return ret;
97
        }, arguments); },
98
        __wbg_createProgram_cbf448e6f18a9402: function(arg0) {
99
            const ret = arg0.createProgram();
100
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
101
        },
102
        __wbg_createShader_6c1a2295587878a5: function(arg0, arg1) {
103
            const ret = arg0.createShader(arg1 >>> 0);
104
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
105
        },
106
        __wbg_createVertexArray_b223ea69dd08fcab: function(arg0) {
107
            const ret = arg0.createVertexArray();
108
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
109
        },
110
        __wbg_devicePixelRatio_7d39e9af5448d3d4: function(arg0) {
111
            const ret = arg0.devicePixelRatio;
112
            return ret;
113
        },
114
        __wbg_document_9854e03c05fc8834: function(arg0) {
115
            const ret = arg0.document;
116
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
117
        },
118
        __wbg_drawArraysInstanced_9b44aa78a087154d: function(arg0, arg1, arg2, arg3, arg4) {
119
            arg0.drawArraysInstanced(arg1 >>> 0, arg2, arg3, arg4);
120
        },
121
        __wbg_drawArrays_08872e02fb57b847: function(arg0, arg1, arg2, arg3) {
122
            arg0.drawArrays(arg1 >>> 0, arg2, arg3);
123
        },
124
        __wbg_enableVertexAttribArray_d52693866bc8b8dd: function(arg0, arg1) {
125
            arg0.enableVertexAttribArray(arg1 >>> 0);
126
        },
127
        __wbg_enable_cb4fc19b51148c37: function(arg0, arg1) {
128
            arg0.enable(arg1 >>> 0);
129
        },
130
        __wbg_from_296ca31f8d0f1c52: function(arg0) {
131
            const ret = Array.from(arg0);
132
            return ret;
133
        },
134
        __wbg_getBoundingClientRect_57152b1a20f3de34: function(arg0) {
135
            const ret = arg0.getBoundingClientRect();
136
            return ret;
137
        },
138
        __wbg_getComputedStyle_dd0f456804795fd6: function() { return handleError(function (arg0, arg1) {
139
            const ret = arg0.getComputedStyle(arg1);
140
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
141
        }, arguments); },
142
        __wbg_getContext_051324720aa5b7e8: function() { return handleError(function (arg0, arg1, arg2, arg3) {
143
            const ret = arg0.getContext(getStringFromWasm0(arg1, arg2), arg3);
144
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
145
        }, arguments); },
146
        __wbg_getProgramInfoLog_3276b294d6d42fe2: function(arg0, arg1, arg2) {
147
            const ret = arg1.getProgramInfoLog(arg2);
148
            var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
149
            var len1 = WASM_VECTOR_LEN;
150
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
151
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
152
        },
153
        __wbg_getProgramParameter_fc7124bb9fb7c675: function(arg0, arg1, arg2) {
154
            const ret = arg0.getProgramParameter(arg1, arg2 >>> 0);
155
            return ret;
156
        },
157
        __wbg_getPropertyValue_e90a3628c2de4fb6: function() { return handleError(function (arg0, arg1, arg2, arg3) {
158
            const ret = arg1.getPropertyValue(getStringFromWasm0(arg2, arg3));
159
            const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
160
            const len1 = WASM_VECTOR_LEN;
161
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
162
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
163
        }, arguments); },
164
        __wbg_getShaderInfoLog_7e0cbba353ca95da: function(arg0, arg1, arg2) {
165
            const ret = arg1.getShaderInfoLog(arg2);
166
            var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
167
            var len1 = WASM_VECTOR_LEN;
168
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
169
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
170
        },
171
        __wbg_getShaderParameter_745acf10b8e45e31: function(arg0, arg1, arg2) {
172
            const ret = arg0.getShaderParameter(arg1, arg2 >>> 0);
173
            return ret;
174
        },
175
        __wbg_getUniformLocation_50ba45dade572703: function(arg0, arg1, arg2, arg3) {
176
            const ret = arg0.getUniformLocation(arg1, getStringFromWasm0(arg2, arg3));
177
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
178
        },
179
        __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
180
            const ret = Reflect.get(arg0, arg1);
181
            return ret;
182
        }, arguments); },
183
        __wbg_get_6c896e0571ddae51: function(arg0, arg1) {
184
            const ret = arg0[arg1 >>> 0];
185
            return ret;
186
        },
187
        __wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
188
            const ret = arg0[arg1 >>> 0];
189
            return ret;
190
        },
191
        __wbg_hidden_2ba371ecafe013fa: function(arg0) {
192
            const ret = arg0.hidden;
193
            return ret;
194
        },
195
        __wbg_innerHeight_7f20e0f1a7c5a573: function() { return handleError(function (arg0) {
196
            const ret = arg0.innerHeight;
197
            return ret;
198
        }, arguments); },
199
        __wbg_innerWidth_1bc526614080537c: function() { return handleError(function (arg0) {
200
            const ret = arg0.innerWidth;
201
            return ret;
202
        }, arguments); },
203
        __wbg_instanceof_HtmlElement_32fb153a5a0e2349: function(arg0) {
204
            let result;
205
            try {
206
                result = arg0 instanceof HTMLElement;
207
            } catch (_) {
208
                result = false;
209
            }
210
            const ret = result;
211
            return ret;
212
        },
213
        __wbg_instanceof_WebGl2RenderingContext_64c994c14c0790fb: function(arg0) {
214
            let result;
215
            try {
216
                result = arg0 instanceof WebGL2RenderingContext;
217
            } catch (_) {
218
                result = false;
219
            }
220
            const ret = result;
221
            return ret;
222
        },
223
        __wbg_instanceof_Window_82d71df4eddf88bc: function(arg0) {
224
            let result;
225
            try {
226
                result = arg0 instanceof Window;
227
            } catch (_) {
228
                result = false;
229
            }
230
            const ret = result;
231
            return ret;
232
        },
233
        __wbg_left_e0a244490fe2f293: function(arg0) {
234
            const ret = arg0.left;
235
            return ret;
236
        },
237
        __wbg_length_d4bdea10311bd9cf: function(arg0) {
238
            const ret = arg0.length;
239
            return ret;
240
        },
241
        __wbg_linkProgram_acdc299c43d734a0: function(arg0, arg1) {
242
            arg0.linkProgram(arg1);
243
        },
244
        __wbg_matchMedia_8a4857f947f11f82: function() { return handleError(function (arg0, arg1, arg2) {
245
            const ret = arg0.matchMedia(getStringFromWasm0(arg1, arg2));
246
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
247
        }, arguments); },
248
        __wbg_matches_778d0873b064b1bf: function(arg0) {
249
            const ret = arg0.matches;
250
            return ret;
251
        },
252
        __wbg_new_617a8cdb8bb1130e: function() {
253
            const ret = new Object();
254
            return ret;
255
        },
256
        __wbg_now_d0b7f4bea9f38490: function(arg0) {
257
            const ret = arg0.now();
258
            return ret;
259
        },
260
        __wbg_performance_d0d7b03fc649b694: function(arg0) {
261
            const ret = arg0.performance;
262
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
263
        },
264
        __wbg_querySelector_ecbc2550705b235f: function() { return handleError(function (arg0, arg1, arg2) {
265
            const ret = arg0.querySelector(getStringFromWasm0(arg1, arg2));
266
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
267
        }, arguments); },
268
        __wbg_relatedTarget_520fe88b1de28b43: function(arg0) {
269
            const ret = arg0.relatedTarget;
270
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
271
        },
272
        __wbg_requestAnimationFrame_7b526ab7aa550c74: function() { return handleError(function (arg0, arg1) {
273
            const ret = arg0.requestAnimationFrame(arg1);
274
            return ret;
275
        }, arguments); },
276
        __wbg_right_1dca6be6342de981: function(arg0) {
277
            const ret = arg0.right;
278
            return ret;
279
        },
280
        __wbg_setAttribute_9e7d603908f63705: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
281
            arg0.setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
282
        }, arguments); },
283
        __wbg_setProperty_097bc3d55ce44513: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
284
            arg0.setProperty(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
285
        }, arguments); },
286
        __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
287
            const ret = Reflect.set(arg0, arg1, arg2);
288
            return ret;
289
        }, arguments); },
290
        __wbg_set_className_541fce5cd31918aa: function(arg0, arg1, arg2) {
291
            arg0.className = getStringFromWasm0(arg1, arg2);
292
        },
293
        __wbg_set_height_c9789c1c77eaedff: function(arg0, arg1) {
294
            arg0.height = arg1 >>> 0;
295
        },
296
        __wbg_set_textContent_6d6fc559f198055f: function(arg0, arg1, arg2) {
297
            arg0.textContent = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
298
        },
299
        __wbg_set_width_b0e1267db4b196b5: function(arg0, arg1) {
300
            arg0.width = arg1 >>> 0;
301
        },
302
        __wbg_shaderSource_c8812639b47d87b9: function(arg0, arg1, arg2, arg3) {
303
            arg0.shaderSource(arg1, getStringFromWasm0(arg2, arg3));
304
        },
305
        __wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
306
            const ret = typeof global === 'undefined' ? null : global;
307
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
308
        },
309
        __wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
310
            const ret = typeof globalThis === 'undefined' ? null : globalThis;
311
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
312
        },
313
        __wbg_static_accessor_SELF_0b583911f537483a: function() {
314
            const ret = typeof self === 'undefined' ? null : self;
315
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
316
        },
317
        __wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
318
            const ret = typeof window === 'undefined' ? null : window;
319
            return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
320
        },
321
        __wbg_style_4bce24230e493a7c: function(arg0) {
322
            const ret = arg0.style;
323
            return ret;
324
        },
325
        __wbg_uniform2f_a92b5bb95dc5b4d9: function(arg0, arg1, arg2, arg3) {
326
            arg0.uniform2f(arg1, arg2, arg3);
327
        },
328
        __wbg_useProgram_e075c2902e420761: function(arg0, arg1) {
329
            arg0.useProgram(arg1);
330
        },
331
        __wbg_vertexAttribDivisor_7575d382215322f7: function(arg0, arg1, arg2) {
332
            arg0.vertexAttribDivisor(arg1 >>> 0, arg2 >>> 0);
333
        },
334
        __wbg_vertexAttribPointer_24b495e18df325dc: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
335
            arg0.vertexAttribPointer(arg1 >>> 0, arg2, arg3 >>> 0, arg4 !== 0, arg5, arg6);
336
        },
337
        __wbg_viewport_16936692526e2ce6: function(arg0, arg1, arg2, arg3, arg4) {
338
            arg0.viewport(arg1, arg2, arg3, arg4);
339
        },
340
        __wbindgen_generic_0000000000000001: function(arg0, arg1) {
341
            // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [F64], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
342
            const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___f64______true_);
343
            return ret;
344
        },
345
        __wbindgen_generic_0000000000000002: function(arg0, arg1) {
346
            // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MouseEvent")], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
347
            const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___web_sys_793942649ef82f98___features__gen_MouseEvent__MouseEvent______true_);
348
            return ret;
349
        },
350
        __wbindgen_generic_0000000000000003: function(arg0, arg1) {
351
            // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 4, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
352
            const ret = makeMutClosure(arg0, arg1, wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke_______true_);
353
            return ret;
354
        },
355
        __wbindgen_generic_0000000000000004: function(arg0, arg1) {
356
            // Cast intrinsic for `Ref(Slice(F32)) -> NamedExternref("Float32Array")`.
357
            const ret = getArrayF32FromWasm0(arg0, arg1);
358
            return ret;
359
        },
360
        __wbindgen_generic_0000000000000005: function(arg0, arg1) {
361
            // Cast intrinsic for `Ref(String) -> Externref`.
362
            const ret = getStringFromWasm0(arg0, arg1);
363
            return ret;
364
        },
365
        __wbindgen_init_externref_table: function() {
366
            const table = wasm.__wbindgen_externrefs;
367
            const offset = table.grow(4);
368
            table.set(0, undefined);
369
            table.set(offset + 0, undefined);
370
            table.set(offset + 1, null);
371
            table.set(offset + 2, true);
372
            table.set(offset + 3, false);
373
        },
374
    };
375
    return {
376
        __proto__: null,
377
        "./backdrop_bg.js": import0,
378
    };
379
}
380
381
function wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke_______true_(arg0, arg1) {
382
    wasm.wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke_______true_(arg0, arg1);
383
}
384
385
function wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___web_sys_793942649ef82f98___features__gen_MouseEvent__MouseEvent______true_(arg0, arg1, arg2) {
386
    wasm.wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___web_sys_793942649ef82f98___features__gen_MouseEvent__MouseEvent______true_(arg0, arg1, arg2);
387
}
388
389
function wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___f64______true_(arg0, arg1, arg2) {
390
    wasm.wasm_bindgen_ef67fbc5f0a8b406___convert__closures_____invoke___f64______true_(arg0, arg1, arg2);
391
}
392
393
function addToExternrefTable0(obj) {
394
    const idx = wasm.__externref_table_alloc();
395
    wasm.__wbindgen_externrefs.set(idx, obj);
396
    return idx;
397
}
398
399
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
400
    ? { register: () => {}, unregister: () => {} }
401
    : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
402
403
function getArrayF32FromWasm0(ptr, len) {
404
    ptr = ptr >>> 0;
405
    return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + 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
let cachedFloat32ArrayMemory0 = null;
417
function getFloat32ArrayMemory0() {
418
    if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
419
        cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
420
    }
421
    return cachedFloat32ArrayMemory0;
422
}
423
424
function getStringFromWasm0(ptr, len) {
425
    return decodeText(ptr >>> 0, len);
426
}
427
428
let cachedUint8ArrayMemory0 = null;
429
function getUint8ArrayMemory0() {
430
    if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
431
        cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
432
    }
433
    return cachedUint8ArrayMemory0;
434
}
435
436
function handleError(f, args) {
437
    try {
438
        return f.apply(this, args);
439
    } catch (e) {
440
        const idx = addToExternrefTable0(e);
441
        wasm.__wbindgen_exn_store(idx);
442
    }
443
}
444
445
function isLikeNone(x) {
446
    return x === undefined || x === null;
447
}
448
449
function makeMutClosure(arg0, arg1, f) {
450
    const state = { a: arg0, b: arg1, cnt: 1 };
451
    const real = (...args) => {
452
453
        // First up with a closure we increment the internal reference
454
        // count. This ensures that the Rust closure environment won't
455
        // be deallocated while we're invoking it.
456
        state.cnt++;
457
        const a = state.a;
458
        state.a = 0;
459
        try {
460
            return f(a, state.b, ...args);
461
        } finally {
462
            state.a = a;
463
            real._wbg_cb_unref();
464
        }
465
    };
466
    real._wbg_cb_unref = () => {
467
        if (--state.cnt === 0) {
468
            wasm.__wbindgen_destroy_closure(state.a, state.b);
469
            state.a = 0;
470
            CLOSURE_DTORS.unregister(state);
471
        }
472
    };
473
    CLOSURE_DTORS.register(real, state, state);
474
    return real;
475
}
476
477
function passStringToWasm0(arg, malloc, realloc) {
478
    if (realloc === undefined) {
479
        const buf = cachedTextEncoder.encode(arg);
480
        const ptr = malloc(buf.length, 1) >>> 0;
481
        getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
482
        WASM_VECTOR_LEN = buf.length;
483
        return ptr;
484
    }
485
486
    let len = arg.length;
487
    let ptr = malloc(len, 1) >>> 0;
488
489
    const mem = getUint8ArrayMemory0();
490
491
    let offset = 0;
492
493
    for (; offset < len; offset++) {
494
        const code = arg.charCodeAt(offset);
495
        if (code > 0x7F) break;
496
        mem[ptr + offset] = code;
497
    }
498
    if (offset !== len) {
499
        if (offset !== 0) {
500
            arg = arg.slice(offset);
501
        }
502
        ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
503
        const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
504
        const ret = cachedTextEncoder.encodeInto(arg, view);
505
506
        offset += ret.written;
507
        ptr = realloc(ptr, len, offset, 1) >>> 0;
508
    }
509
510
    WASM_VECTOR_LEN = offset;
511
    return ptr;
512
}
513
514
function takeFromExternrefTable0(idx) {
515
    const value = wasm.__wbindgen_externrefs.get(idx);
516
    wasm.__externref_table_dealloc(idx);
517
    return value;
518
}
519
520
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
521
cachedTextDecoder.decode();
522
const MAX_SAFARI_DECODE_BYTES = 2146435072;
523
let numBytesDecoded = 0;
524
function decodeText(ptr, len) {
525
    numBytesDecoded += len;
526
    if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
527
        cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
528
        cachedTextDecoder.decode();
529
        numBytesDecoded = len;
530
    }
531
    return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
532
}
533
534
const cachedTextEncoder = new TextEncoder();
535
536
if (!('encodeInto' in cachedTextEncoder)) {
537
    cachedTextEncoder.encodeInto = function (arg, view) {
538
        const buf = cachedTextEncoder.encode(arg);
539
        view.set(buf);
540
        return {
541
            read: arg.length,
542
            written: buf.length
543
        };
544
    };
545
}
546
547
let WASM_VECTOR_LEN = 0;
548
549
let wasmModule, wasmInstance, wasm;
550
function __wbg_finalize_init(instance, module) {
551
    wasmInstance = instance;
552
    wasm = instance.exports;
553
    wasmModule = module;
554
    cachedDataViewMemory0 = null;
555
    cachedFloat32ArrayMemory0 = null;
556
    cachedUint8ArrayMemory0 = null;
557
    wasm.__wbindgen_start();
558
    return wasm;
559
}
560
561
async function __wbg_load(module, imports) {
562
    if (typeof Response === 'function' && module instanceof Response) {
563
        if (!module.ok) {
564
            throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
565
        }
566
567
        if (typeof WebAssembly.instantiateStreaming === 'function') {
568
            try {
569
                return await WebAssembly.instantiateStreaming(module, imports);
570
            } catch (e) {
571
                const validResponse = expectedResponseType(module.type);
572
573
                if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
574
                    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);
575
576
                } else { throw e; }
577
            }
578
        }
579
580
        const bytes = await module.arrayBuffer();
581
        return await WebAssembly.instantiate(bytes, imports);
582
    } else {
583
        const instance = await WebAssembly.instantiate(module, imports);
584
585
        if (instance instanceof WebAssembly.Instance) {
586
            return { instance, module };
587
        } else {
588
            return instance;
589
        }
590
    }
591
592
    function expectedResponseType(type) {
593
        switch (type) {
594
            case 'basic': case 'cors': case 'default': return true;
595
        }
596
        return false;
597
    }
598
}
599
600
function initSync(module) {
601
    if (wasm !== undefined) return wasm;
602
603
604
    if (module !== undefined) {
605
        if (Object.getPrototypeOf(module) === Object.prototype) {
606
            ({module} = module)
607
        } else {
608
            console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
609
        }
610
    }
611
612
    const imports = __wbg_get_imports();
613
    if (!(module instanceof WebAssembly.Module)) {
614
        module = new WebAssembly.Module(module);
615
    }
616
    const instance = new WebAssembly.Instance(module, imports);
617
    return __wbg_finalize_init(instance, module);
618
}
619
620
async function __wbg_init(module_or_path) {
621
    if (wasm !== undefined) return wasm;
622
623
624
    if (module_or_path !== undefined) {
625
        if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
626
            ({module_or_path} = module_or_path)
627
        } else {
628
            console.warn('using deprecated parameters for the initialization function; pass a single object instead')
629
        }
630
    }
631
632
    if (module_or_path === undefined) {
633
        module_or_path = new URL('backdrop_bg.wasm', import.meta.url);
634
    }
635
    const imports = __wbg_get_imports();
636
637
    if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
638
        module_or_path = fetch(module_or_path);
639
    }
640
641
    const { instance, module } = await __wbg_load(await module_or_path, imports);
642
643
    return __wbg_finalize_init(instance, module);
644
}
645
646
export { initSync, __wbg_init as default };