@reearth/ezu 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,606 @@
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
+ * Glyph ranges the currently bound features can require, as
186
+ * `{ [glyphsSourceName]: number[] }` where each number is a range
187
+ * start (`0`, `256`, `512`, …) — i.e. the `{range}` in a
188
+ * `…/{fontstack}/{range}.pbf` URL is `<start>-<start + 255>`.
189
+ *
190
+ * This host cannot fetch glyph ranges lazily, so every range a
191
+ * tile's labels touch must be bound before `renderTile`. Rather than
192
+ * scraping every string in the MVT, call this after binding the
193
+ * vector sources and bind exactly the listed ranges.
194
+ *
195
+ * It is an over-approximation, deliberately: a range is listed if
196
+ * *any* feature in a text layer carries the codepoint in a property
197
+ * the layer's `text` expression reads, without evaluating filters,
198
+ * zoom ranges, or the expression itself, and it is listed for every
199
+ * fontstack in that layer's fallback chain. So it never omits a
200
+ * range a label needs, and it may name a few that go unused. Text
201
+ * layers that build their string from something other than a `get`
202
+ * of a feature property (a literal, a `concat` of formatted values)
203
+ * contribute their literal text where it is a plain string.
204
+ * @returns {object}
205
+ */
206
+ neededGlyphRanges() {
207
+ const ret = wasm.renderer_neededGlyphRanges(this.__wbg_ptr);
208
+ if (ret[2]) {
209
+ throw takeFromExternrefTable0(ret[1]);
210
+ }
211
+ return takeFromExternrefTable0(ret[0]);
212
+ }
213
+ /**
214
+ * Build a renderer from a style JSON document.
215
+ * @param {string} style_json
216
+ */
217
+ constructor(style_json) {
218
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
219
+ const len0 = WASM_VECTOR_LEN;
220
+ const ret = wasm.renderer_new(ptr0, len0);
221
+ if (ret[2]) {
222
+ throw takeFromExternrefTable0(ret[1]);
223
+ }
224
+ this.__wbg_ptr = ret[0];
225
+ RendererFinalization.register(this, this.__wbg_ptr, this);
226
+ return this;
227
+ }
228
+ /**
229
+ * Render a single tile using whatever sources are currently bound.
230
+ *
231
+ * `opts` (JS object, all fields optional):
232
+ * - `format`: `"png"` (default) / `"webp"` / `"rgba"`
233
+ * - `tileSize`, `pad`: override the style's canvas size for this
234
+ * call (hi-DPI / preview)
235
+ * - `png`: `{ compression?: "fast" | "default" | "best" }`
236
+ * @param {number} z
237
+ * @param {number} x
238
+ * @param {number} y
239
+ * @param {object | null} [opts]
240
+ * @returns {Uint8Array}
241
+ */
242
+ renderTile(z, x, y, opts) {
243
+ const ret = wasm.renderer_renderTile(this.__wbg_ptr, z, x, y, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
244
+ if (ret[3]) {
245
+ throw takeFromExternrefTable0(ret[2]);
246
+ }
247
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
248
+ wasm.__wbindgen_free_command_export(ret[0], ret[1] * 1, 1);
249
+ return v1;
250
+ }
251
+ /**
252
+ * Neighbour tile offsets the active style actually asks for from
253
+ * `source`, as an array of `[dx, dy]` pairs (never including the
254
+ * centre `[0, 0]`).
255
+ *
256
+ * Cross-tile label collision and edge-continuous DEM shading are the
257
+ * only things that read neighbours, and only for the sources they
258
+ * name. A host that fetches the full 3×3 window unconditionally
259
+ * therefore pays for up to eight tiles it will not look at; passing
260
+ * each offset from this list to `bindSource(name, bytes, { coord })`
261
+ * fetches exactly what the recipe needs. An empty array means the
262
+ * centre tile is enough.
263
+ *
264
+ * Throws `UnknownSource` if `name` is not declared in the style.
265
+ * @param {string} name
266
+ * @returns {Array<any>}
267
+ */
268
+ requestedNeighborOffsets(name) {
269
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
270
+ const len0 = WASM_VECTOR_LEN;
271
+ const ret = wasm.renderer_requestedNeighborOffsets(this.__wbg_ptr, ptr0, len0);
272
+ if (ret[2]) {
273
+ throw takeFromExternrefTable0(ret[1]);
274
+ }
275
+ return takeFromExternrefTable0(ret[0]);
276
+ }
277
+ /**
278
+ * Replace the active style. Returns the new node count. Invalidates
279
+ * the intermediate cache and drops any pending source bindings.
280
+ * @param {string} style_json
281
+ * @returns {number}
282
+ */
283
+ setStyle(style_json) {
284
+ const ptr0 = passStringToWasm0(style_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
285
+ const len0 = WASM_VECTOR_LEN;
286
+ const ret = wasm.renderer_setStyle(this.__wbg_ptr, ptr0, len0);
287
+ if (ret[2]) {
288
+ throw takeFromExternrefTable0(ret[1]);
289
+ }
290
+ return ret[0] >>> 0;
291
+ }
292
+ /**
293
+ * `tile-size` declared by the current style.
294
+ * @returns {number}
295
+ */
296
+ get tileSize() {
297
+ const ret = wasm.renderer_tileSize(this.__wbg_ptr);
298
+ return ret >>> 0;
299
+ }
300
+ }
301
+ if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
302
+ exports.Renderer = Renderer;
303
+
304
+ /**
305
+ * Whether the wasm binary was compiled with `+simd128`. Lets the demo
306
+ * page label the renderer build accurately.
307
+ * @returns {boolean}
308
+ */
309
+ function simdEnabled() {
310
+ const ret = wasm.simdEnabled();
311
+ return ret !== 0;
312
+ }
313
+ exports.simdEnabled = simdEnabled;
314
+
315
+ /**
316
+ * Whether this build supports multithreaded rendering (compiled with
317
+ * the `threads` feature). When `false`, `initThreadPool` is absent and
318
+ * `renderTile`'s `parallel` option is a no-op. Mirrors `simdEnabled` so
319
+ * the host can label the build.
320
+ * @returns {boolean}
321
+ */
322
+ function threadsEnabled() {
323
+ const ret = wasm.threadsEnabled();
324
+ return ret !== 0;
325
+ }
326
+ exports.threadsEnabled = threadsEnabled;
327
+ function __wbg_get_imports() {
328
+ const import0 = {
329
+ __proto__: null,
330
+ __wbg___wbindgen_boolean_get_2304fb8c853028c8: function(arg0) {
331
+ const v = arg0;
332
+ const ret = typeof(v) === 'boolean' ? v : undefined;
333
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
334
+ },
335
+ __wbg___wbindgen_is_null_2042690d351e14f0: function(arg0) {
336
+ const ret = arg0 === null;
337
+ return ret;
338
+ },
339
+ __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
340
+ const ret = arg0 === undefined;
341
+ return ret;
342
+ },
343
+ __wbg___wbindgen_number_get_f73a1244370fcc2c: function(arg0, arg1) {
344
+ const obj = arg1;
345
+ const ret = typeof(obj) === 'number' ? obj : undefined;
346
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
347
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
348
+ },
349
+ __wbg___wbindgen_rethrow_2b7cc655458909c2: function(arg0) {
350
+ throw arg0;
351
+ },
352
+ __wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
353
+ const obj = arg1;
354
+ const ret = typeof(obj) === 'string' ? obj : undefined;
355
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
356
+ var len1 = WASM_VECTOR_LEN;
357
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
358
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
359
+ },
360
+ __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
361
+ throw new Error(getStringFromWasm0(arg0, arg1));
362
+ },
363
+ __wbg_call_dfde26266607c996: function() { return handleError(function (arg0, arg1, arg2) {
364
+ const ret = arg0.call(arg1, arg2);
365
+ return ret;
366
+ }, arguments); },
367
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
368
+ let deferred0_0;
369
+ let deferred0_1;
370
+ try {
371
+ deferred0_0 = arg0;
372
+ deferred0_1 = arg1;
373
+ console.error(getStringFromWasm0(arg0, arg1));
374
+ } finally {
375
+ wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
376
+ }
377
+ },
378
+ __wbg_get_98fdf51d029a75eb: function(arg0, arg1) {
379
+ const ret = arg0[arg1 >>> 0];
380
+ return ret;
381
+ },
382
+ __wbg_get_dcf82ab8aad1a593: function() { return handleError(function (arg0, arg1) {
383
+ const ret = Reflect.get(arg0, arg1);
384
+ return ret;
385
+ }, arguments); },
386
+ __wbg_instanceof_Object_03924e0dbda74bd8: function(arg0) {
387
+ let result;
388
+ try {
389
+ result = arg0 instanceof Object;
390
+ } catch (_) {
391
+ result = false;
392
+ }
393
+ const ret = result;
394
+ return ret;
395
+ },
396
+ __wbg_isArray_94898ed3aad6947b: function(arg0) {
397
+ const ret = Array.isArray(arg0);
398
+ return ret;
399
+ },
400
+ __wbg_length_2591a0f4f659a55c: function(arg0) {
401
+ const ret = arg0.length;
402
+ return ret;
403
+ },
404
+ __wbg_new_02d162bc6cf02f60: function() {
405
+ const ret = new Object();
406
+ return ret;
407
+ },
408
+ __wbg_new_1f236d63ba0c4784: function(arg0, arg1) {
409
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
410
+ return ret;
411
+ },
412
+ __wbg_new_227d7c05414eb861: function() {
413
+ const ret = new Error();
414
+ return ret;
415
+ },
416
+ __wbg_new_310879b66b6e95e1: function() {
417
+ const ret = new Array();
418
+ return ret;
419
+ },
420
+ __wbg_now_81363d44c96dd239: function() {
421
+ const ret = Date.now();
422
+ return ret;
423
+ },
424
+ __wbg_push_b77c476b01548d0a: function(arg0, arg1) {
425
+ const ret = arg0.push(arg1);
426
+ return ret;
427
+ },
428
+ __wbg_set_a0e911be3da02782: function() { return handleError(function (arg0, arg1, arg2) {
429
+ const ret = Reflect.set(arg0, arg1, arg2);
430
+ return ret;
431
+ }, arguments); },
432
+ __wbg_set_name_e500733c75ec36b0: function(arg0, arg1, arg2) {
433
+ arg0.name = getStringFromWasm0(arg1, arg2);
434
+ },
435
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
436
+ const ret = arg1.stack;
437
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
438
+ const len1 = WASM_VECTOR_LEN;
439
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
440
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
441
+ },
442
+ __wbindgen_cast_0000000000000001: function(arg0) {
443
+ // Cast intrinsic for `F64 -> Externref`.
444
+ const ret = arg0;
445
+ return ret;
446
+ },
447
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
448
+ // Cast intrinsic for `Ref(String) -> Externref`.
449
+ const ret = getStringFromWasm0(arg0, arg1);
450
+ return ret;
451
+ },
452
+ __wbindgen_init_externref_table: function() {
453
+ const table = wasm.__wbindgen_externrefs;
454
+ const offset = table.grow(4);
455
+ table.set(0, undefined);
456
+ table.set(offset + 0, undefined);
457
+ table.set(offset + 1, null);
458
+ table.set(offset + 2, true);
459
+ table.set(offset + 3, false);
460
+ },
461
+ };
462
+ return {
463
+ __proto__: null,
464
+ "./ezu_bg.js": import0,
465
+ };
466
+ }
467
+
468
+ const LogSinkFinalization = (typeof FinalizationRegistry === 'undefined')
469
+ ? { register: () => {}, unregister: () => {} }
470
+ : new FinalizationRegistry(ptr => wasm.__wbg_logsink_free(ptr, 1));
471
+ const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
472
+ ? { register: () => {}, unregister: () => {} }
473
+ : new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr, 1));
474
+
475
+ function addToExternrefTable0(obj) {
476
+ const idx = wasm.__externref_table_alloc_command_export();
477
+ wasm.__wbindgen_externrefs.set(idx, obj);
478
+ return idx;
479
+ }
480
+
481
+ function getArrayJsValueFromWasm0(ptr, len) {
482
+ ptr = ptr >>> 0;
483
+ const mem = getDataViewMemory0();
484
+ const result = [];
485
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
486
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
487
+ }
488
+ wasm.__externref_drop_slice_command_export(ptr, len);
489
+ return result;
490
+ }
491
+
492
+ function getArrayU8FromWasm0(ptr, len) {
493
+ ptr = ptr >>> 0;
494
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
495
+ }
496
+
497
+ let cachedDataViewMemory0 = null;
498
+ function getDataViewMemory0() {
499
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
500
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
501
+ }
502
+ return cachedDataViewMemory0;
503
+ }
504
+
505
+ function getStringFromWasm0(ptr, len) {
506
+ return decodeText(ptr >>> 0, len);
507
+ }
508
+
509
+ let cachedUint8ArrayMemory0 = null;
510
+ function getUint8ArrayMemory0() {
511
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
512
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
513
+ }
514
+ return cachedUint8ArrayMemory0;
515
+ }
516
+
517
+ function handleError(f, args) {
518
+ try {
519
+ return f.apply(this, args);
520
+ } catch (e) {
521
+ const idx = addToExternrefTable0(e);
522
+ wasm.__wbindgen_exn_store_command_export(idx);
523
+ }
524
+ }
525
+
526
+ function isLikeNone(x) {
527
+ return x === undefined || x === null;
528
+ }
529
+
530
+ function passArray8ToWasm0(arg, malloc) {
531
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
532
+ getUint8ArrayMemory0().set(arg, ptr / 1);
533
+ WASM_VECTOR_LEN = arg.length;
534
+ return ptr;
535
+ }
536
+
537
+ function passStringToWasm0(arg, malloc, realloc) {
538
+ if (realloc === undefined) {
539
+ const buf = cachedTextEncoder.encode(arg);
540
+ const ptr = malloc(buf.length, 1) >>> 0;
541
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
542
+ WASM_VECTOR_LEN = buf.length;
543
+ return ptr;
544
+ }
545
+
546
+ let len = arg.length;
547
+ let ptr = malloc(len, 1) >>> 0;
548
+
549
+ const mem = getUint8ArrayMemory0();
550
+
551
+ let offset = 0;
552
+
553
+ for (; offset < len; offset++) {
554
+ const code = arg.charCodeAt(offset);
555
+ if (code > 0x7F) break;
556
+ mem[ptr + offset] = code;
557
+ }
558
+ if (offset !== len) {
559
+ if (offset !== 0) {
560
+ arg = arg.slice(offset);
561
+ }
562
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
563
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
564
+ const ret = cachedTextEncoder.encodeInto(arg, view);
565
+
566
+ offset += ret.written;
567
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
568
+ }
569
+
570
+ WASM_VECTOR_LEN = offset;
571
+ return ptr;
572
+ }
573
+
574
+ function takeFromExternrefTable0(idx) {
575
+ const value = wasm.__wbindgen_externrefs.get(idx);
576
+ wasm.__externref_table_dealloc_command_export(idx);
577
+ return value;
578
+ }
579
+
580
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
581
+ cachedTextDecoder.decode();
582
+ function decodeText(ptr, len) {
583
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
584
+ }
585
+
586
+ const cachedTextEncoder = new TextEncoder();
587
+
588
+ if (!('encodeInto' in cachedTextEncoder)) {
589
+ cachedTextEncoder.encodeInto = function (arg, view) {
590
+ const buf = cachedTextEncoder.encode(arg);
591
+ view.set(buf);
592
+ return {
593
+ read: arg.length,
594
+ written: buf.length
595
+ };
596
+ };
597
+ }
598
+
599
+ let WASM_VECTOR_LEN = 0;
600
+
601
+ const wasmPath = `${__dirname}/ezu_bg.wasm`;
602
+ const wasmBytes = require('fs').readFileSync(wasmPath);
603
+ const wasmModule = new WebAssembly.Module(wasmBytes);
604
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
605
+ let wasm = wasmInstance.exports;
606
+ wasm.__wbindgen_start();
Binary file
@@ -0,0 +1,34 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_logsink_free: (a: number, b: number) => void;
5
+ export const __wbg_renderer_free: (a: number, b: number) => void;
6
+ export const logsink_clear: (a: number) => void;
7
+ export const logsink_drain: (a: number) => any;
8
+ export const logsink_drainLines: (a: number) => [number, number];
9
+ export const logsink_isEmpty: (a: number) => number;
10
+ export const logsink_len: (a: number) => number;
11
+ export const logsink_new: (a: number, b: number) => [number, number, number];
12
+ export const logsink_onEvent: (a: number, b: number) => void;
13
+ export const logsink_setCapacity: (a: number, b: number) => void;
14
+ export const renderer_attribution: (a: number) => [number, number];
15
+ export const renderer_bindSource: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
16
+ export const renderer_boundSources: (a: number) => [number, number];
17
+ export const renderer_clearSources: (a: number) => void;
18
+ export const renderer_neededGlyphRanges: (a: number) => [number, number, number];
19
+ export const renderer_new: (a: number, b: number) => [number, number, number];
20
+ export const renderer_renderTile: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
21
+ export const renderer_requestedNeighborOffsets: (a: number, b: number, c: number) => [number, number, number];
22
+ export const renderer_setStyle: (a: number, b: number, c: number) => [number, number, number];
23
+ export const renderer_tileSize: (a: number) => number;
24
+ export const simdEnabled: () => number;
25
+ export const threadsEnabled: () => number;
26
+ export const __wbindgen_malloc_command_export: (a: number, b: number) => number;
27
+ export const __wbindgen_realloc_command_export: (a: number, b: number, c: number, d: number) => number;
28
+ export const __wbindgen_exn_store_command_export: (a: number) => void;
29
+ export const __externref_table_alloc_command_export: () => number;
30
+ export const __wbindgen_externrefs: WebAssembly.Table;
31
+ export const __wbindgen_free_command_export: (a: number, b: number, c: number) => void;
32
+ export const __externref_drop_slice_command_export: (a: number, b: number) => void;
33
+ export const __externref_table_dealloc_command_export: (a: number) => void;
34
+ export const __wbindgen_start: () => void;
@@ -0,0 +1 @@
1
+ { "type": "commonjs" }