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