@reearth/ezu 0.2.0
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.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +88 -0
- package/bundler/ezu.d.ts +129 -0
- package/bundler/ezu.js +9 -0
- package/bundler/ezu_bg.js +577 -0
- package/bundler/ezu_bg.wasm +0 -0
- package/bundler/ezu_bg.wasm.d.ts +36 -0
- package/nodejs/ezu.d.ts +129 -0
- package/nodejs/ezu.js +585 -0
- package/nodejs/ezu_bg.wasm +0 -0
- package/nodejs/ezu_bg.wasm.d.ts +36 -0
- package/nodejs/package.json +1 -0
- package/package.json +63 -0
- package/web/ezu.d.ts +190 -0
- package/web/ezu.js +677 -0
- package/web/ezu_bg.wasm +0 -0
- package/web/ezu_bg.wasm.d.ts +36 -0
package/web/ezu.js
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
/* @ts-self-types="./ezu.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Buffered log sink that captures `tracing` events from the renderer.
|
|
5
|
+
*
|
|
6
|
+
* Construct once near the top of your bootstrap, then either set a
|
|
7
|
+
* callback for live forwarding (`onEvent(e => console.log(e))`) or
|
|
8
|
+
* `drainLines()` periodically to flush into a UI panel.
|
|
9
|
+
*/
|
|
10
|
+
export class LogSink {
|
|
11
|
+
__destroy_into_raw() {
|
|
12
|
+
const ptr = this.__wbg_ptr;
|
|
13
|
+
this.__wbg_ptr = 0;
|
|
14
|
+
LogSinkFinalization.unregister(this);
|
|
15
|
+
return ptr;
|
|
16
|
+
}
|
|
17
|
+
free() {
|
|
18
|
+
const ptr = this.__destroy_into_raw();
|
|
19
|
+
wasm.__wbg_logsink_free(ptr, 0);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Drop all buffered records without returning them.
|
|
23
|
+
*/
|
|
24
|
+
clear() {
|
|
25
|
+
wasm.logsink_clear(this.__wbg_ptr);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Drain every buffered record. Returns a JS array of structured
|
|
29
|
+
* objects `{ level, target, message, fields, timestampMs }`.
|
|
30
|
+
* @returns {Array<any>}
|
|
31
|
+
*/
|
|
32
|
+
drain() {
|
|
33
|
+
const ret = wasm.logsink_drain(this.__wbg_ptr);
|
|
34
|
+
return ret;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Drain buffered records and return pre-formatted strings — the
|
|
38
|
+
* same shape the CLI prints. Convenient for `console.log(lines.join('\n'))`.
|
|
39
|
+
* @returns {string[]}
|
|
40
|
+
*/
|
|
41
|
+
drainLines() {
|
|
42
|
+
const ret = wasm.logsink_drainLines(this.__wbg_ptr);
|
|
43
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
44
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
|
|
45
|
+
return v1;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `true` if no records are buffered.
|
|
49
|
+
* @returns {boolean}
|
|
50
|
+
*/
|
|
51
|
+
isEmpty() {
|
|
52
|
+
const ret = wasm.logsink_isEmpty(this.__wbg_ptr);
|
|
53
|
+
return ret !== 0;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Number of records currently buffered.
|
|
57
|
+
* @returns {number}
|
|
58
|
+
*/
|
|
59
|
+
get len() {
|
|
60
|
+
const ret = wasm.logsink_len(this.__wbg_ptr);
|
|
61
|
+
return ret >>> 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Install (idempotently) the global tracing subscriber. `level` is
|
|
65
|
+
* an `EnvFilter` string — e.g. `"info"`, `"debug"`,
|
|
66
|
+
* `"info,ezu_graph::eval=debug"`. Honoured on first call only.
|
|
67
|
+
* @param {string} level
|
|
68
|
+
*/
|
|
69
|
+
constructor(level) {
|
|
70
|
+
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
71
|
+
const len0 = WASM_VECTOR_LEN;
|
|
72
|
+
const ret = wasm.logsink_new(ptr0, len0);
|
|
73
|
+
if (ret[2]) {
|
|
74
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
75
|
+
}
|
|
76
|
+
this.__wbg_ptr = ret[0];
|
|
77
|
+
LogSinkFinalization.register(this, this.__wbg_ptr, this);
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Set (or clear with `null` / `undefined`) the per-event JS
|
|
82
|
+
* callback. The callback receives a structured record object.
|
|
83
|
+
* @param {Function | null} [callback]
|
|
84
|
+
*/
|
|
85
|
+
onEvent(callback) {
|
|
86
|
+
wasm.logsink_onEvent(this.__wbg_ptr, isLikeNone(callback) ? 0 : addToExternrefTable0(callback));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Resize the ring-buffer cap. Older entries are evicted FIFO once
|
|
90
|
+
* the buffer reaches the new cap. Default is 4096.
|
|
91
|
+
* @param {number} cap
|
|
92
|
+
*/
|
|
93
|
+
setCapacity(cap) {
|
|
94
|
+
wasm.logsink_setCapacity(this.__wbg_ptr, cap);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (Symbol.dispose) LogSink.prototype[Symbol.dispose] = LogSink.prototype.free;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Stateful WASM renderer.
|
|
101
|
+
*/
|
|
102
|
+
export class Renderer {
|
|
103
|
+
__destroy_into_raw() {
|
|
104
|
+
const ptr = this.__wbg_ptr;
|
|
105
|
+
this.__wbg_ptr = 0;
|
|
106
|
+
RendererFinalization.unregister(this);
|
|
107
|
+
return ptr;
|
|
108
|
+
}
|
|
109
|
+
free() {
|
|
110
|
+
const ptr = this.__destroy_into_raw();
|
|
111
|
+
wasm.__wbg_renderer_free(ptr, 0);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Number of brushes currently registered.
|
|
115
|
+
* @returns {number}
|
|
116
|
+
*/
|
|
117
|
+
brushCount() {
|
|
118
|
+
const ret = wasm.renderer_brushCount(this.__wbg_ptr);
|
|
119
|
+
return ret >>> 0;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Drop every registered brush.
|
|
123
|
+
*/
|
|
124
|
+
clearBrushes() {
|
|
125
|
+
wasm.renderer_clearBrushes(this.__wbg_ptr);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Build a renderer from a style JSON document.
|
|
129
|
+
* @param {string} style_json
|
|
130
|
+
*/
|
|
131
|
+
constructor(style_json) {
|
|
132
|
+
const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
133
|
+
const len0 = WASM_VECTOR_LEN;
|
|
134
|
+
const ret = wasm.renderer_new(ptr0, len0);
|
|
135
|
+
if (ret[2]) {
|
|
136
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
137
|
+
}
|
|
138
|
+
this.__wbg_ptr = ret[0];
|
|
139
|
+
RendererFinalization.register(this, this.__wbg_ptr, this);
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Register a `.myb` brush under `name` so a `brush-file` node with
|
|
144
|
+
* `src: "@name"` (via the style's `assets` map) resolves to it.
|
|
145
|
+
* Re-registering the same name replaces the previous entry.
|
|
146
|
+
* @param {string} name
|
|
147
|
+
* @param {string} myb_json
|
|
148
|
+
*/
|
|
149
|
+
registerBrush(name, myb_json) {
|
|
150
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
151
|
+
const len0 = WASM_VECTOR_LEN;
|
|
152
|
+
const ptr1 = passStringToWasm0(myb_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
153
|
+
const len1 = WASM_VECTOR_LEN;
|
|
154
|
+
const ret = wasm.renderer_registerBrush(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
155
|
+
if (ret[1]) {
|
|
156
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Render a single tile to PNG bytes using the style's `tile-size` / `pad`.
|
|
161
|
+
* Pass `null` for `mvtBytes` to get a paper-only tile.
|
|
162
|
+
*
|
|
163
|
+
* Optional `options`: `{ png: { compression: 'fast' | 'default' | 'best' } }`.
|
|
164
|
+
* @param {Uint8Array | null | undefined} mvt_bytes
|
|
165
|
+
* @param {number} z
|
|
166
|
+
* @param {number} x
|
|
167
|
+
* @param {number} y
|
|
168
|
+
* @param {object | null} [options]
|
|
169
|
+
* @returns {Uint8Array}
|
|
170
|
+
*/
|
|
171
|
+
render(mvt_bytes, z, x, y, options) {
|
|
172
|
+
var ptr0 = isLikeNone(mvt_bytes) ? 0 : passArray8ToWasm0(mvt_bytes, wasm.__wbindgen_malloc_command_export);
|
|
173
|
+
var len0 = WASM_VECTOR_LEN;
|
|
174
|
+
const ret = wasm.renderer_render(this.__wbg_ptr, ptr0, len0, z, x, y, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
175
|
+
if (ret[3]) {
|
|
176
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
177
|
+
}
|
|
178
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
179
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
180
|
+
return v2;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Like `render` but with `tile_size` / `pad` overridden — useful for
|
|
184
|
+
* hi-DPI / preview rendering without mutating the style.
|
|
185
|
+
* @param {Uint8Array | null | undefined} mvt_bytes
|
|
186
|
+
* @param {number} z
|
|
187
|
+
* @param {number} x
|
|
188
|
+
* @param {number} y
|
|
189
|
+
* @param {number} tile_size
|
|
190
|
+
* @param {number} pad
|
|
191
|
+
* @param {object | null} [options]
|
|
192
|
+
* @returns {Uint8Array}
|
|
193
|
+
*/
|
|
194
|
+
renderAt(mvt_bytes, z, x, y, tile_size, pad, options) {
|
|
195
|
+
var ptr0 = isLikeNone(mvt_bytes) ? 0 : passArray8ToWasm0(mvt_bytes, wasm.__wbindgen_malloc_command_export);
|
|
196
|
+
var len0 = WASM_VECTOR_LEN;
|
|
197
|
+
const ret = wasm.renderer_renderAt(this.__wbg_ptr, ptr0, len0, z, x, y, tile_size, pad, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
198
|
+
if (ret[3]) {
|
|
199
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
200
|
+
}
|
|
201
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
202
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
203
|
+
return v2;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Render a single tile to straight RGBA8 bytes (`tile_w * tile_h * 4`).
|
|
207
|
+
* @param {Uint8Array | null | undefined} mvt_bytes
|
|
208
|
+
* @param {number} z
|
|
209
|
+
* @param {number} x
|
|
210
|
+
* @param {number} y
|
|
211
|
+
* @returns {Uint8Array}
|
|
212
|
+
*/
|
|
213
|
+
renderRgba(mvt_bytes, z, x, y) {
|
|
214
|
+
var ptr0 = isLikeNone(mvt_bytes) ? 0 : passArray8ToWasm0(mvt_bytes, wasm.__wbindgen_malloc_command_export);
|
|
215
|
+
var len0 = WASM_VECTOR_LEN;
|
|
216
|
+
const ret = wasm.renderer_renderRgba(this.__wbg_ptr, ptr0, len0, z, x, y);
|
|
217
|
+
if (ret[3]) {
|
|
218
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
219
|
+
}
|
|
220
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
221
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
222
|
+
return v2;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Like `renderRgba` but with `tile_size` / `pad` overridden.
|
|
226
|
+
* @param {Uint8Array | null | undefined} mvt_bytes
|
|
227
|
+
* @param {number} z
|
|
228
|
+
* @param {number} x
|
|
229
|
+
* @param {number} y
|
|
230
|
+
* @param {number} tile_size
|
|
231
|
+
* @param {number} pad
|
|
232
|
+
* @returns {Uint8Array}
|
|
233
|
+
*/
|
|
234
|
+
renderRgbaAt(mvt_bytes, z, x, y, tile_size, pad) {
|
|
235
|
+
var ptr0 = isLikeNone(mvt_bytes) ? 0 : passArray8ToWasm0(mvt_bytes, wasm.__wbindgen_malloc_command_export);
|
|
236
|
+
var len0 = WASM_VECTOR_LEN;
|
|
237
|
+
const ret = wasm.renderer_renderRgbaAt(this.__wbg_ptr, ptr0, len0, z, x, y, tile_size, pad);
|
|
238
|
+
if (ret[3]) {
|
|
239
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
240
|
+
}
|
|
241
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
242
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
243
|
+
return v2;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Render a single tile to lossless WebP bytes. Smaller than PNG
|
|
247
|
+
* for the same painterly content and decoded natively by every
|
|
248
|
+
* modern browser. WebP is lossless-only via the pure-Rust
|
|
249
|
+
* `image-webp` codec; for lossy WebP, see the
|
|
250
|
+
* `OffscreenCanvas.convertToBlob` recipe in the crate README.
|
|
251
|
+
* @param {Uint8Array | null | undefined} mvt_bytes
|
|
252
|
+
* @param {number} z
|
|
253
|
+
* @param {number} x
|
|
254
|
+
* @param {number} y
|
|
255
|
+
* @param {object | null} [options]
|
|
256
|
+
* @returns {Uint8Array}
|
|
257
|
+
*/
|
|
258
|
+
renderWebp(mvt_bytes, z, x, y, options) {
|
|
259
|
+
var ptr0 = isLikeNone(mvt_bytes) ? 0 : passArray8ToWasm0(mvt_bytes, wasm.__wbindgen_malloc_command_export);
|
|
260
|
+
var len0 = WASM_VECTOR_LEN;
|
|
261
|
+
const ret = wasm.renderer_renderWebp(this.__wbg_ptr, ptr0, len0, z, x, y, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
262
|
+
if (ret[3]) {
|
|
263
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
264
|
+
}
|
|
265
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
266
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
267
|
+
return v2;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Like `renderWebp` but with `tile_size` / `pad` overridden.
|
|
271
|
+
* @param {Uint8Array | null | undefined} mvt_bytes
|
|
272
|
+
* @param {number} z
|
|
273
|
+
* @param {number} x
|
|
274
|
+
* @param {number} y
|
|
275
|
+
* @param {number} tile_size
|
|
276
|
+
* @param {number} pad
|
|
277
|
+
* @param {object | null} [options]
|
|
278
|
+
* @returns {Uint8Array}
|
|
279
|
+
*/
|
|
280
|
+
renderWebpAt(mvt_bytes, z, x, y, tile_size, pad, options) {
|
|
281
|
+
var ptr0 = isLikeNone(mvt_bytes) ? 0 : passArray8ToWasm0(mvt_bytes, wasm.__wbindgen_malloc_command_export);
|
|
282
|
+
var len0 = WASM_VECTOR_LEN;
|
|
283
|
+
const ret = wasm.renderer_renderWebpAt(this.__wbg_ptr, ptr0, len0, z, x, y, tile_size, pad, isLikeNone(options) ? 0 : addToExternrefTable0(options));
|
|
284
|
+
if (ret[3]) {
|
|
285
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
286
|
+
}
|
|
287
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
288
|
+
wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
|
|
289
|
+
return v2;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Replace the active style. Returns the new node count. Invalidates
|
|
293
|
+
* the intermediate cache.
|
|
294
|
+
* @param {string} style_json
|
|
295
|
+
* @returns {number}
|
|
296
|
+
*/
|
|
297
|
+
setStyle(style_json) {
|
|
298
|
+
const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
299
|
+
const len0 = WASM_VECTOR_LEN;
|
|
300
|
+
const ret = wasm.renderer_setStyle(this.__wbg_ptr, ptr0, len0);
|
|
301
|
+
if (ret[2]) {
|
|
302
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
303
|
+
}
|
|
304
|
+
return ret[0] >>> 0;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* `tile-size` declared by the current style.
|
|
308
|
+
* @returns {number}
|
|
309
|
+
*/
|
|
310
|
+
get tileSize() {
|
|
311
|
+
const ret = wasm.renderer_tileSize(this.__wbg_ptr);
|
|
312
|
+
return ret >>> 0;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Remove a brush by name. Returns `true` if the brush existed.
|
|
316
|
+
* @param {string} name
|
|
317
|
+
* @returns {boolean}
|
|
318
|
+
*/
|
|
319
|
+
unregisterBrush(name) {
|
|
320
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
321
|
+
const len0 = WASM_VECTOR_LEN;
|
|
322
|
+
const ret = wasm.renderer_unregisterBrush(this.__wbg_ptr, ptr0, len0);
|
|
323
|
+
return ret !== 0;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Whether the wasm binary was compiled with `+simd128`. Lets the demo
|
|
330
|
+
* page label the renderer build accurately.
|
|
331
|
+
* @returns {boolean}
|
|
332
|
+
*/
|
|
333
|
+
export function simdEnabled() {
|
|
334
|
+
const ret = wasm.simdEnabled();
|
|
335
|
+
return ret !== 0;
|
|
336
|
+
}
|
|
337
|
+
function __wbg_get_imports() {
|
|
338
|
+
const import0 = {
|
|
339
|
+
__proto__: null,
|
|
340
|
+
__wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
|
|
341
|
+
const obj = arg1;
|
|
342
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
343
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
344
|
+
var len1 = WASM_VECTOR_LEN;
|
|
345
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
346
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
347
|
+
},
|
|
348
|
+
__wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
|
|
349
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
350
|
+
},
|
|
351
|
+
__wbg_call_dfde26266607c996: function() { return handleError(function (arg0, arg1, arg2) {
|
|
352
|
+
const ret = arg0.call(arg1, arg2);
|
|
353
|
+
return ret;
|
|
354
|
+
}, arguments); },
|
|
355
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
356
|
+
let deferred0_0;
|
|
357
|
+
let deferred0_1;
|
|
358
|
+
try {
|
|
359
|
+
deferred0_0 = arg0;
|
|
360
|
+
deferred0_1 = arg1;
|
|
361
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
362
|
+
} finally {
|
|
363
|
+
wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
__wbg_get_dcf82ab8aad1a593: function() { return handleError(function (arg0, arg1) {
|
|
367
|
+
const ret = Reflect.get(arg0, arg1);
|
|
368
|
+
return ret;
|
|
369
|
+
}, arguments); },
|
|
370
|
+
__wbg_instanceof_Object_03924e0dbda74bd8: function(arg0) {
|
|
371
|
+
let result;
|
|
372
|
+
try {
|
|
373
|
+
result = arg0 instanceof Object;
|
|
374
|
+
} catch (_) {
|
|
375
|
+
result = false;
|
|
376
|
+
}
|
|
377
|
+
const ret = result;
|
|
378
|
+
return ret;
|
|
379
|
+
},
|
|
380
|
+
__wbg_new_02d162bc6cf02f60: function() {
|
|
381
|
+
const ret = new Object();
|
|
382
|
+
return ret;
|
|
383
|
+
},
|
|
384
|
+
__wbg_new_1f236d63ba0c4784: function(arg0, arg1) {
|
|
385
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
386
|
+
return ret;
|
|
387
|
+
},
|
|
388
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
389
|
+
const ret = new Error();
|
|
390
|
+
return ret;
|
|
391
|
+
},
|
|
392
|
+
__wbg_new_310879b66b6e95e1: function() {
|
|
393
|
+
const ret = new Array();
|
|
394
|
+
return ret;
|
|
395
|
+
},
|
|
396
|
+
__wbg_now_81363d44c96dd239: function() {
|
|
397
|
+
const ret = Date.now();
|
|
398
|
+
return ret;
|
|
399
|
+
},
|
|
400
|
+
__wbg_push_b77c476b01548d0a: function(arg0, arg1) {
|
|
401
|
+
const ret = arg0.push(arg1);
|
|
402
|
+
return ret;
|
|
403
|
+
},
|
|
404
|
+
__wbg_set_a0e911be3da02782: function() { return handleError(function (arg0, arg1, arg2) {
|
|
405
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
406
|
+
return ret;
|
|
407
|
+
}, arguments); },
|
|
408
|
+
__wbg_set_name_e500733c75ec36b0: function(arg0, arg1, arg2) {
|
|
409
|
+
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
410
|
+
},
|
|
411
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
412
|
+
const ret = arg1.stack;
|
|
413
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
414
|
+
const len1 = WASM_VECTOR_LEN;
|
|
415
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
416
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
417
|
+
},
|
|
418
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
419
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
420
|
+
const ret = arg0;
|
|
421
|
+
return ret;
|
|
422
|
+
},
|
|
423
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
424
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
425
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
426
|
+
return ret;
|
|
427
|
+
},
|
|
428
|
+
__wbindgen_init_externref_table: function() {
|
|
429
|
+
const table = wasm.__wbindgen_externrefs;
|
|
430
|
+
const offset = table.grow(4);
|
|
431
|
+
table.set(0, undefined);
|
|
432
|
+
table.set(offset + 0, undefined);
|
|
433
|
+
table.set(offset + 1, null);
|
|
434
|
+
table.set(offset + 2, true);
|
|
435
|
+
table.set(offset + 3, false);
|
|
436
|
+
},
|
|
437
|
+
};
|
|
438
|
+
return {
|
|
439
|
+
__proto__: null,
|
|
440
|
+
"./ezu_bg.js": import0,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const LogSinkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
445
|
+
? { register: () => {}, unregister: () => {} }
|
|
446
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_logsink_free(ptr, 1));
|
|
447
|
+
const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
448
|
+
? { register: () => {}, unregister: () => {} }
|
|
449
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
|
|
450
|
+
|
|
451
|
+
function addToExternrefTable0(obj) {
|
|
452
|
+
const idx = wasm.__externref_table_alloc_command_export();
|
|
453
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
454
|
+
return idx;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
458
|
+
ptr = ptr >>> 0;
|
|
459
|
+
const mem = getDataViewMemory0();
|
|
460
|
+
const result = [];
|
|
461
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
462
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
463
|
+
}
|
|
464
|
+
wasm.__externref_drop_slice_command_export(ptr, len);
|
|
465
|
+
return result;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
469
|
+
ptr = ptr >>> 0;
|
|
470
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
let cachedDataViewMemory0 = null;
|
|
474
|
+
function getDataViewMemory0() {
|
|
475
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
476
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
477
|
+
}
|
|
478
|
+
return cachedDataViewMemory0;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function getStringFromWasm0(ptr, len) {
|
|
482
|
+
return decodeText(ptr >>> 0, len);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
let cachedUint8ArrayMemory0 = null;
|
|
486
|
+
function getUint8ArrayMemory0() {
|
|
487
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
488
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
489
|
+
}
|
|
490
|
+
return cachedUint8ArrayMemory0;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function handleError(f, args) {
|
|
494
|
+
try {
|
|
495
|
+
return f.apply(this, args);
|
|
496
|
+
} catch (e) {
|
|
497
|
+
const idx = addToExternrefTable0(e);
|
|
498
|
+
wasm.__wbindgen_exn_store_command_export(idx);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function isLikeNone(x) {
|
|
503
|
+
return x === undefined || x === null;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
507
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
508
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
509
|
+
WASM_VECTOR_LEN = arg.length;
|
|
510
|
+
return ptr;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
514
|
+
if (realloc === undefined) {
|
|
515
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
516
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
517
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
518
|
+
WASM_VECTOR_LEN = buf.length;
|
|
519
|
+
return ptr;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
let len = arg.length;
|
|
523
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
524
|
+
|
|
525
|
+
const mem = getUint8ArrayMemory0();
|
|
526
|
+
|
|
527
|
+
let offset = 0;
|
|
528
|
+
|
|
529
|
+
for (; offset < len; offset++) {
|
|
530
|
+
const code = arg.charCodeAt(offset);
|
|
531
|
+
if (code > 0x7F) break;
|
|
532
|
+
mem[ptr + offset] = code;
|
|
533
|
+
}
|
|
534
|
+
if (offset !== len) {
|
|
535
|
+
if (offset !== 0) {
|
|
536
|
+
arg = arg.slice(offset);
|
|
537
|
+
}
|
|
538
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
539
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
540
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
541
|
+
|
|
542
|
+
offset += ret.written;
|
|
543
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
WASM_VECTOR_LEN = offset;
|
|
547
|
+
return ptr;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function takeFromExternrefTable0(idx) {
|
|
551
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
552
|
+
wasm.__externref_table_dealloc_command_export(idx);
|
|
553
|
+
return value;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
557
|
+
cachedTextDecoder.decode();
|
|
558
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
559
|
+
let numBytesDecoded = 0;
|
|
560
|
+
function decodeText(ptr, len) {
|
|
561
|
+
numBytesDecoded += len;
|
|
562
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
563
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
564
|
+
cachedTextDecoder.decode();
|
|
565
|
+
numBytesDecoded = len;
|
|
566
|
+
}
|
|
567
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const cachedTextEncoder = new TextEncoder();
|
|
571
|
+
|
|
572
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
573
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
574
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
575
|
+
view.set(buf);
|
|
576
|
+
return {
|
|
577
|
+
read: arg.length,
|
|
578
|
+
written: buf.length
|
|
579
|
+
};
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
let WASM_VECTOR_LEN = 0;
|
|
584
|
+
|
|
585
|
+
let wasmModule, wasmInstance, wasm;
|
|
586
|
+
function __wbg_finalize_init(instance, module) {
|
|
587
|
+
wasmInstance = instance;
|
|
588
|
+
wasm = instance.exports;
|
|
589
|
+
wasmModule = module;
|
|
590
|
+
cachedDataViewMemory0 = null;
|
|
591
|
+
cachedUint8ArrayMemory0 = null;
|
|
592
|
+
wasm.__wbindgen_start();
|
|
593
|
+
return wasm;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
async function __wbg_load(module, imports) {
|
|
597
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
598
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
599
|
+
try {
|
|
600
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
601
|
+
} catch (e) {
|
|
602
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
603
|
+
|
|
604
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
605
|
+
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);
|
|
606
|
+
|
|
607
|
+
} else { throw e; }
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const bytes = await module.arrayBuffer();
|
|
612
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
613
|
+
} else {
|
|
614
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
615
|
+
|
|
616
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
617
|
+
return { instance, module };
|
|
618
|
+
} else {
|
|
619
|
+
return instance;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function expectedResponseType(type) {
|
|
624
|
+
switch (type) {
|
|
625
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
626
|
+
}
|
|
627
|
+
return false;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function initSync(module) {
|
|
632
|
+
if (wasm !== undefined) return wasm;
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
if (module !== undefined) {
|
|
636
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
637
|
+
({module} = module)
|
|
638
|
+
} else {
|
|
639
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
const imports = __wbg_get_imports();
|
|
644
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
645
|
+
module = new WebAssembly.Module(module);
|
|
646
|
+
}
|
|
647
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
648
|
+
return __wbg_finalize_init(instance, module);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
async function __wbg_init(module_or_path) {
|
|
652
|
+
if (wasm !== undefined) return wasm;
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
if (module_or_path !== undefined) {
|
|
656
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
657
|
+
({module_or_path} = module_or_path)
|
|
658
|
+
} else {
|
|
659
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
if (module_or_path === undefined) {
|
|
664
|
+
module_or_path = new URL('ezu_bg.wasm', import.meta.url);
|
|
665
|
+
}
|
|
666
|
+
const imports = __wbg_get_imports();
|
|
667
|
+
|
|
668
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
669
|
+
module_or_path = fetch(module_or_path);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
673
|
+
|
|
674
|
+
return __wbg_finalize_init(instance, module);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export { initSync, __wbg_init as default };
|
package/web/ezu_bg.wasm
ADDED
|
Binary file
|