@reearth/ezu 0.4.1 → 0.5.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.
@@ -0,0 +1,725 @@
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
+ 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
+ *
84
+ * No-op in multithreaded (`threads`) builds — events can originate
85
+ * on rayon worker threads, so live forwarding to a main-thread JS
86
+ * callback isn't available. Use `drain` / `drainLines` instead.
87
+ * @param {Function | null} [callback]
88
+ */
89
+ onEvent(callback) {
90
+ wasm.logsink_onEvent(this.__wbg_ptr, isLikeNone(callback) ? 0 : addToExternrefTable0(callback));
91
+ }
92
+ /**
93
+ * Resize the ring-buffer cap. Older entries are evicted FIFO once
94
+ * the buffer reaches the new cap. Default is 4096.
95
+ * @param {number} cap
96
+ */
97
+ setCapacity(cap) {
98
+ wasm.logsink_setCapacity(this.__wbg_ptr, cap);
99
+ }
100
+ }
101
+ if (Symbol.dispose) LogSink.prototype[Symbol.dispose] = LogSink.prototype.free;
102
+ exports.LogSink = LogSink;
103
+
104
+ /**
105
+ * Stateful WASM renderer.
106
+ */
107
+ class Renderer {
108
+ __destroy_into_raw() {
109
+ const ptr = this.__wbg_ptr;
110
+ this.__wbg_ptr = 0;
111
+ RendererFinalization.unregister(this);
112
+ return ptr;
113
+ }
114
+ free() {
115
+ const ptr = this.__destroy_into_raw();
116
+ wasm.__wbg_renderer_free(ptr, 0);
117
+ }
118
+ /**
119
+ * Effective attribution declared by the style (document +
120
+ * sources), joined with ` | `. Upstream TileJSON / PMTiles
121
+ * metadata is the JS host's concern — merge it on that side.
122
+ * @returns {string | undefined}
123
+ */
124
+ get attribution() {
125
+ const ret = wasm.renderer_attribution(this.__wbg_ptr);
126
+ let v1;
127
+ if (ret[0] !== 0) {
128
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
129
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
130
+ }
131
+ return v1;
132
+ }
133
+ /**
134
+ * Bind raw tile bytes under a `sources.<name>` entry from the style.
135
+ * The renderer dispatches on the source's declared `type`:
136
+ *
137
+ * - `mvt` / `pmtiles` → store raw MVT bytes per `(dx, dy)` neighbour
138
+ * offset (centre `coord: [0, 0]`, the default). Layers are bound as
139
+ * `<source>.<layer>` (centre) or `<source>.<layer>@dx,dy`
140
+ * (neighbours) when [`render_tile`] runs. Binding only the centre
141
+ * degrades cross-tile label collision to centre-only at borders.
142
+ * - `dem` / `raster` → store the raw bytes per `(dx, dy)` neighbour
143
+ * offset. The centre tile is `coord: [0, 0]` (default). Decoding
144
+ * and 3×3 stitching happen at render time once the tile id is known.
145
+ * - `geojson` (remote) → store raw bytes per `(dx, dy)` offset;
146
+ * projected per tile (and neighbour) at render time.
147
+ *
148
+ * `opts` is a JS object: `{ coord?: [dx, dy] }`. Throws
149
+ * `UnknownSource` if `name` doesn't match any entry in the style's
150
+ * `sources` block, `MvtDecode` if MVT bytes don't parse, and
151
+ * `DemDecode` for non-image DEM bytes (the decode itself runs at
152
+ * render time, but obvious cases are caught here).
153
+ * @param {string} name
154
+ * @param {Uint8Array} bytes
155
+ * @param {object | null} [opts]
156
+ */
157
+ bindSource(name, bytes, opts) {
158
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
159
+ const len0 = WASM_VECTOR_LEN;
160
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc_command_export);
161
+ const len1 = WASM_VECTOR_LEN;
162
+ const ret = wasm.renderer_bindSource(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
163
+ if (ret[1]) {
164
+ throw takeFromExternrefTable0(ret[0]);
165
+ }
166
+ }
167
+ /**
168
+ * Names of every source with at least one pending binding.
169
+ * Order matches the style's `sources` declaration order.
170
+ * @returns {string[]}
171
+ */
172
+ boundSources() {
173
+ const ret = wasm.renderer_boundSources(this.__wbg_ptr);
174
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
175
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 4, 4);
176
+ return v1;
177
+ }
178
+ /**
179
+ * Drop every pending source binding. Call between tile renders.
180
+ */
181
+ clearSources() {
182
+ wasm.renderer_clearSources(this.__wbg_ptr);
183
+ }
184
+ /**
185
+ * What this renderer is holding, in bytes, so a host can shed load
186
+ * *before* an allocation fails rather than after.
187
+ *
188
+ * Returns a JS object:
189
+ * - `heapBytes` — wasm linear memory committed to the **module**,
190
+ * shared by every `Renderer` in this instance. This is the number
191
+ * that meets an isolate's memory cap. It is a high-water mark:
192
+ * freeing Rust values returns them to the allocator, never to the
193
+ * host, so it only ever grows.
194
+ * - `glyphBytes` / `glyphRanges` — SDF bitmaps resident in the
195
+ * glyph bank, and how many 256-codepoint blocks they span. Glyphs
196
+ * accumulate for the life of the renderer and survive
197
+ * `clearSources`, so on a long-lived instance this is usually
198
+ * what grew. `glyphBudget` is the per-fontstack ceiling
199
+ * `setGlyphBudget` put on them, or `Infinity` if none — note
200
+ * `glyphBytes` totals *every* fontstack, so it can exceed the
201
+ * budget legitimately.
202
+ * - `fontBytes` — outline font files held in the font bank.
203
+ * - `imageBytes` — decoded pixels of bound images and sprite
204
+ * atlases.
205
+ * - `cacheBytes` / `cacheBudget` — the render cache's pixel
206
+ * payload against its own eviction budget; it bounds itself, so
207
+ * `cacheBytes` near `cacheBudget` is steady state, not a leak.
208
+ *
209
+ * These are payload sizes, not an accounting of the heap: they omit
210
+ * allocator overhead, decoded features, per-font glyph-path caches,
211
+ * and the buffers a render is using right now. Expect the parts to
212
+ * sum to less than `heapBytes`.
213
+ * @returns {object}
214
+ */
215
+ memoryUsage() {
216
+ const ret = wasm.renderer_memoryUsage(this.__wbg_ptr);
217
+ if (ret[2]) {
218
+ throw takeFromExternrefTable0(ret[1]);
219
+ }
220
+ return takeFromExternrefTable0(ret[0]);
221
+ }
222
+ /**
223
+ * Codepoints the currently bound features can require, as
224
+ * `{ [glyphsSourceName]: number[] }` sorted ascending.
225
+ *
226
+ * This is the precise form of
227
+ * [`neededGlyphRanges`](Self::needed_glyph_ranges): a host that
228
+ * can build its own glyph PBF — one message holding just these
229
+ * codepoints — transfers only the glyphs the tile draws instead
230
+ * of the whole 256-codepoint block around each of them. On CJK
231
+ * labels that is the difference between a few thousand glyphs and
232
+ * a few tens of megabytes. `bindSource` files each glyph by its
233
+ * own id, so such a subset may span any number of blocks and
234
+ * needs no particular `range` string.
235
+ *
236
+ * Hosts that can only fetch whole `{range}.pbf` files off a
237
+ * MapLibre glyphs endpoint want `neededGlyphRanges` instead. Both
238
+ * calls see the same set of codepoints and carry the same
239
+ * over-approximation caveat.
240
+ * @returns {object}
241
+ */
242
+ neededCodepoints() {
243
+ const ret = wasm.renderer_neededCodepoints(this.__wbg_ptr);
244
+ if (ret[2]) {
245
+ throw takeFromExternrefTable0(ret[1]);
246
+ }
247
+ return takeFromExternrefTable0(ret[0]);
248
+ }
249
+ /**
250
+ * Glyph ranges the currently bound features can require, as
251
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
252
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
253
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
254
+ *
255
+ * This host cannot fetch glyph ranges lazily, so every range a
256
+ * tile's labels touch must be bound before `renderTile`. Rather than
257
+ * scraping every string in the MVT, call this after binding the
258
+ * vector sources and bind exactly the listed ranges.
259
+ *
260
+ * A range holds 256 codepoints and a tile typically draws a
261
+ * handful of them, so this is a coarse unit to fetch in. Hosts
262
+ * that can assemble their own subset PBF should call
263
+ * [`neededCodepoints`](Self::needed_codepoints) instead.
264
+ *
265
+ * It is an over-approximation, deliberately: a range is listed if
266
+ * *any* feature in a text layer carries the codepoint in a property
267
+ * the layer's `text` expression reads, without evaluating filters,
268
+ * zoom ranges, or the expression itself, and it is listed for every
269
+ * fontstack in that layer's fallback chain. So it never omits a
270
+ * range a label needs, and it may name a few that go unused. Text
271
+ * layers that build their string from something other than a `get`
272
+ * of a feature property (a literal, a `concat` of formatted values)
273
+ * contribute their literal text where it is a plain string.
274
+ * @returns {object}
275
+ */
276
+ neededGlyphRanges() {
277
+ const ret = wasm.renderer_neededGlyphRanges(this.__wbg_ptr);
278
+ if (ret[2]) {
279
+ throw takeFromExternrefTable0(ret[1]);
280
+ }
281
+ return takeFromExternrefTable0(ret[0]);
282
+ }
283
+ /**
284
+ * Build a renderer from a style JSON document.
285
+ * @param {string} style_json
286
+ */
287
+ constructor(style_json) {
288
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
289
+ const len0 = WASM_VECTOR_LEN;
290
+ const ret = wasm.renderer_new(ptr0, len0);
291
+ if (ret[2]) {
292
+ throw takeFromExternrefTable0(ret[1]);
293
+ }
294
+ this.__wbg_ptr = ret[0];
295
+ RendererFinalization.register(this, this.__wbg_ptr, this);
296
+ return this;
297
+ }
298
+ /**
299
+ * Render a single tile using whatever sources are currently bound.
300
+ *
301
+ * `opts` (JS object, all fields optional):
302
+ * - `format`: `"png"` (default) / `"webp"` / `"rgba"`
303
+ * - `tileSize`, `pad`: override the style's canvas size for this
304
+ * call (hi-DPI / preview)
305
+ * - `png`: `{ compression?: "fast" | "default" | "best" }`
306
+ * @param {number} z
307
+ * @param {number} x
308
+ * @param {number} y
309
+ * @param {object | null} [opts]
310
+ * @returns {Uint8Array}
311
+ */
312
+ renderTile(z, x, y, opts) {
313
+ const ret = wasm.renderer_renderTile(this.__wbg_ptr, z, x, y, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
314
+ if (ret[3]) {
315
+ throw takeFromExternrefTable0(ret[2]);
316
+ }
317
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
318
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
319
+ return v1;
320
+ }
321
+ /**
322
+ * Neighbour tile offsets the active style actually asks for from
323
+ * `source`, as an array of `[dx, dy]` pairs (never including the
324
+ * centre `[0, 0]`).
325
+ *
326
+ * Cross-tile label collision and edge-continuous DEM shading are the
327
+ * only things that read neighbours, and only for the sources they
328
+ * name. A host that fetches the full 3×3 window unconditionally
329
+ * therefore pays for up to eight tiles it will not look at; passing
330
+ * each offset from this list to `bindSource(name, bytes, { coord })`
331
+ * fetches exactly what the recipe needs. An empty array means the
332
+ * centre tile is enough.
333
+ *
334
+ * Throws `UnknownSource` if `name` is not declared in the style.
335
+ * @param {string} name
336
+ * @returns {Array<any>}
337
+ */
338
+ requestedNeighborOffsets(name) {
339
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
340
+ const len0 = WASM_VECTOR_LEN;
341
+ const ret = wasm.renderer_requestedNeighborOffsets(this.__wbg_ptr, ptr0, len0);
342
+ if (ret[2]) {
343
+ throw takeFromExternrefTable0(ret[1]);
344
+ }
345
+ return takeFromExternrefTable0(ret[0]);
346
+ }
347
+ /**
348
+ * Cap the glyph bytes each bound fontstack keeps resident, in
349
+ * bytes. Unset, a fontstack keeps every range ever bound to it for
350
+ * the life of the renderer — `clearSources` does not touch glyphs,
351
+ * and on a long-lived instance rendering across a basemap that is
352
+ * usually what grew.
353
+ *
354
+ * Trimming happens **after** each `renderTile`, not while binding,
355
+ * so a render never loses glyphs that were bound for it. The tile
356
+ * that just drew is therefore the most recently used, and a budget
357
+ * large enough for one tile's glyphs always keeps that tile's; what
358
+ * goes is what earlier tiles needed and this one did not. Set it
359
+ * below one tile's worth and the ceiling still holds — the stack
360
+ * empties after every render and nothing carries over, which
361
+ * renders correctly but buys no reuse.
362
+ *
363
+ * It is a per-fontstack ceiling: a style with a regular, a medium
364
+ * and an italic stack can hold three times what is set here.
365
+ *
366
+ * This host cannot refetch, so anything trimmed must be bound again
367
+ * before the next tile that needs it. `neededCodepoints()` already
368
+ * names exactly what to bind, and a host that re-binds every tile
369
+ * (rather than tracking what it sent) needs no other change.
370
+ * @param {number} bytes
371
+ */
372
+ setGlyphBudget(bytes) {
373
+ wasm.renderer_setGlyphBudget(this.__wbg_ptr, bytes);
374
+ }
375
+ /**
376
+ * Replace the active style. Returns the new node count. Invalidates
377
+ * the intermediate cache and drops any pending source bindings.
378
+ * @param {string} style_json
379
+ * @returns {number}
380
+ */
381
+ setStyle(style_json) {
382
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
383
+ const len0 = WASM_VECTOR_LEN;
384
+ const ret = wasm.renderer_setStyle(this.__wbg_ptr, ptr0, len0);
385
+ if (ret[2]) {
386
+ throw takeFromExternrefTable0(ret[1]);
387
+ }
388
+ return ret[0] >>> 0;
389
+ }
390
+ /**
391
+ * `tile-size` declared by the current style.
392
+ * @returns {number}
393
+ */
394
+ get tileSize() {
395
+ const ret = wasm.renderer_tileSize(this.__wbg_ptr);
396
+ return ret >>> 0;
397
+ }
398
+ }
399
+ if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
400
+ exports.Renderer = Renderer;
401
+
402
+ /**
403
+ * Wasm linear memory currently committed to this module, in bytes.
404
+ *
405
+ * This is the figure an isolate's memory cap applies to, and the one
406
+ * to watch to shed load before an allocation fails — a refused
407
+ * `memory.grow` throws [`OutOfMemory`](oom) and ends the instance.
408
+ * It never falls: freed Rust values return to the allocator for reuse,
409
+ * but wasm cannot hand pages back to the host. So a drop in demand
410
+ * leaves the number where its peak left it, and only a fresh instance
411
+ * resets it.
412
+ *
413
+ * Module-wide, not per-`Renderer`. For what a given renderer is
414
+ * holding, and which bank to evict, call `memoryUsage()`.
415
+ * @returns {number}
416
+ */
417
+ function heapBytes() {
418
+ const ret = wasm.heapBytes();
419
+ return ret >>> 0;
420
+ }
421
+ exports.heapBytes = heapBytes;
422
+
423
+ /**
424
+ * Whether the wasm binary was compiled with `+simd128`. Lets the demo
425
+ * page label the renderer build accurately.
426
+ * @returns {boolean}
427
+ */
428
+ function simdEnabled() {
429
+ const ret = wasm.simdEnabled();
430
+ return ret !== 0;
431
+ }
432
+ exports.simdEnabled = simdEnabled;
433
+
434
+ /**
435
+ * Whether this build supports multithreaded rendering (compiled with
436
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
437
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
438
+ * the host can label the build.
439
+ * @returns {boolean}
440
+ */
441
+ function threadsEnabled() {
442
+ const ret = wasm.threadsEnabled();
443
+ return ret !== 0;
444
+ }
445
+ exports.threadsEnabled = threadsEnabled;
446
+ function __wbg_get_imports() {
447
+ const import0 = {
448
+ __proto__: null,
449
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
450
+ const v = arg0;
451
+ const ret = typeof(v) === 'boolean' ? v : undefined;
452
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
453
+ },
454
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
455
+ const ret = arg0 === null;
456
+ return ret;
457
+ },
458
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
459
+ const ret = arg0 === undefined;
460
+ return ret;
461
+ },
462
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
463
+ const obj = arg1;
464
+ const ret = typeof(obj) === 'number' ? obj : undefined;
465
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
466
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
467
+ },
468
+ __wbg___wbindgen_rethrow_4915403b40f010b4: function(arg0) {
469
+ throw arg0;
470
+ },
471
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
472
+ const obj = arg1;
473
+ const ret = typeof(obj) === 'string' ? obj : undefined;
474
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
475
+ var len1 = WASM_VECTOR_LEN;
476
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
477
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
478
+ },
479
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
480
+ throw new Error(getStringFromWasm0(arg0, arg1));
481
+ },
482
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
483
+ const ret = arg0.call(arg1, arg2);
484
+ return ret;
485
+ }, arguments); },
486
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
487
+ let deferred0_0;
488
+ let deferred0_1;
489
+ try {
490
+ deferred0_0 = arg0;
491
+ deferred0_1 = arg1;
492
+ console.error(getStringFromWasm0(arg0, arg1));
493
+ } finally {
494
+ wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
495
+ }
496
+ },
497
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
498
+ const ret = arg0[arg1 >>> 0];
499
+ return ret;
500
+ },
501
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
502
+ const ret = Reflect.get(arg0, arg1);
503
+ return ret;
504
+ }, arguments); },
505
+ __wbg_instanceof_Object_33f20e6f12439f3e: function(arg0) {
506
+ let result;
507
+ try {
508
+ result = arg0 instanceof Object;
509
+ } catch (_) {
510
+ result = false;
511
+ }
512
+ const ret = result;
513
+ return ret;
514
+ },
515
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
516
+ const ret = Array.isArray(arg0);
517
+ return ret;
518
+ },
519
+ __wbg_length_370319915dc99107: function(arg0) {
520
+ const ret = arg0.length;
521
+ return ret;
522
+ },
523
+ __wbg_new_227d7c05414eb861: function() {
524
+ const ret = new Error();
525
+ return ret;
526
+ },
527
+ __wbg_new_32b398fb48b6d94a: function() {
528
+ const ret = new Array();
529
+ return ret;
530
+ },
531
+ __wbg_new_b667d279fd5aa943: function(arg0, arg1) {
532
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
533
+ return ret;
534
+ },
535
+ __wbg_new_da52cf8fe3429cb2: function() {
536
+ const ret = new Object();
537
+ return ret;
538
+ },
539
+ __wbg_now_86c0d4ba3fa605b8: function() {
540
+ const ret = Date.now();
541
+ return ret;
542
+ },
543
+ __wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
544
+ const ret = arg0.push(arg1);
545
+ return ret;
546
+ },
547
+ __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
548
+ const ret = Reflect.set(arg0, arg1, arg2);
549
+ return ret;
550
+ }, arguments); },
551
+ __wbg_set_name_3bbc583faefa4193: function(arg0, arg1, arg2) {
552
+ arg0.name = getStringFromWasm0(arg1, arg2);
553
+ },
554
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
555
+ const ret = arg1.stack;
556
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
557
+ const len1 = WASM_VECTOR_LEN;
558
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
559
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
560
+ },
561
+ __wbindgen_cast_0000000000000001: function(arg0) {
562
+ // Cast intrinsic for `F64 -> Externref`.
563
+ const ret = arg0;
564
+ return ret;
565
+ },
566
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
567
+ // Cast intrinsic for `Ref(String) -> Externref`.
568
+ const ret = getStringFromWasm0(arg0, arg1);
569
+ return ret;
570
+ },
571
+ __wbindgen_init_externref_table: function() {
572
+ const table = wasm.__wbindgen_externrefs;
573
+ const offset = table.grow(4);
574
+ table.set(0, undefined);
575
+ table.set(offset + 0, undefined);
576
+ table.set(offset + 1, null);
577
+ table.set(offset + 2, true);
578
+ table.set(offset + 3, false);
579
+ },
580
+ };
581
+ return {
582
+ __proto__: null,
583
+ "./ezu_bg.js": import0,
584
+ };
585
+ }
586
+
587
+ const LogSinkFinalization = (typeof FinalizationRegistry === 'undefined')
588
+ ? { register: () => {}, unregister: () => {} }
589
+ : new FinalizationRegistry(ptr => wasm.__wbg_logsink_free(ptr, 1));
590
+ const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
591
+ ? { register: () => {}, unregister: () => {} }
592
+ : new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
593
+
594
+ function addToExternrefTable0(obj) {
595
+ const idx = wasm.__externref_table_alloc_command_export();
596
+ wasm.__wbindgen_externrefs.set(idx, obj);
597
+ return idx;
598
+ }
599
+
600
+ function getArrayJsValueFromWasm0(ptr, len) {
601
+ ptr = ptr >>> 0;
602
+ const mem = getDataViewMemory0();
603
+ const result = [];
604
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
605
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
606
+ }
607
+ wasm.__externref_drop_slice_command_export(ptr, len);
608
+ return result;
609
+ }
610
+
611
+ function getArrayU8FromWasm0(ptr, len) {
612
+ ptr = ptr >>> 0;
613
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
614
+ }
615
+
616
+ let cachedDataViewMemory0 = null;
617
+ function getDataViewMemory0() {
618
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
619
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
620
+ }
621
+ return cachedDataViewMemory0;
622
+ }
623
+
624
+ function getStringFromWasm0(ptr, len) {
625
+ return decodeText(ptr >>> 0, len);
626
+ }
627
+
628
+ let cachedUint8ArrayMemory0 = null;
629
+ function getUint8ArrayMemory0() {
630
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
631
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
632
+ }
633
+ return cachedUint8ArrayMemory0;
634
+ }
635
+
636
+ function handleError(f, args) {
637
+ try {
638
+ return f.apply(this, args);
639
+ } catch (e) {
640
+ const idx = addToExternrefTable0(e);
641
+ wasm.__wbindgen_exn_store_command_export(idx);
642
+ }
643
+ }
644
+
645
+ function isLikeNone(x) {
646
+ return x === undefined || x === null;
647
+ }
648
+
649
+ function passArray8ToWasm0(arg, malloc) {
650
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
651
+ getUint8ArrayMemory0().set(arg, ptr / 1);
652
+ WASM_VECTOR_LEN = arg.length;
653
+ return ptr;
654
+ }
655
+
656
+ function passStringToWasm0(arg, malloc, realloc) {
657
+ if (realloc === undefined) {
658
+ const buf = cachedTextEncoder.encode(arg);
659
+ const ptr = malloc(buf.length, 1) >>> 0;
660
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
661
+ WASM_VECTOR_LEN = buf.length;
662
+ return ptr;
663
+ }
664
+
665
+ let len = arg.length;
666
+ let ptr = malloc(len, 1) >>> 0;
667
+
668
+ const mem = getUint8ArrayMemory0();
669
+
670
+ let offset = 0;
671
+
672
+ for (; offset < len; offset++) {
673
+ const code = arg.charCodeAt(offset);
674
+ if (code > 0x7F) break;
675
+ mem[ptr + offset] = code;
676
+ }
677
+ if (offset !== len) {
678
+ if (offset !== 0) {
679
+ arg = arg.slice(offset);
680
+ }
681
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
682
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
683
+ const ret = cachedTextEncoder.encodeInto(arg, view);
684
+
685
+ offset += ret.written;
686
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
687
+ }
688
+
689
+ WASM_VECTOR_LEN = offset;
690
+ return ptr;
691
+ }
692
+
693
+ function takeFromExternrefTable0(idx) {
694
+ const value = wasm.__wbindgen_externrefs.get(idx);
695
+ wasm.__externref_table_dealloc_command_export(idx);
696
+ return value;
697
+ }
698
+
699
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
700
+ cachedTextDecoder.decode();
701
+ function decodeText(ptr, len) {
702
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
703
+ }
704
+
705
+ const cachedTextEncoder = new TextEncoder();
706
+
707
+ if (!('encodeInto' in cachedTextEncoder)) {
708
+ cachedTextEncoder.encodeInto = function (arg, view) {
709
+ const buf = cachedTextEncoder.encode(arg);
710
+ view.set(buf);
711
+ return {
712
+ read: arg.length,
713
+ written: buf.length
714
+ };
715
+ };
716
+ }
717
+
718
+ let WASM_VECTOR_LEN = 0;
719
+
720
+ const wasmPath = `${__dirname}/ezu_bg.wasm`;
721
+ const wasmBytes = require('fs').readFileSync(wasmPath);
722
+ const wasmModule = new WebAssembly.Module(wasmBytes);
723
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
724
+ let wasm = wasmInstance.exports;
725
+ wasm.__wbindgen_start();