@takumi-rs/wasm 0.10.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/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@takumi-rs/wasm",
3
+ "type": "module",
4
+ "version": "0.10.0",
5
+ "files": [
6
+ "takumi_wasm_bg.wasm",
7
+ "takumi_wasm.js",
8
+ "takumi_wasm.d.ts"
9
+ ],
10
+ "main": "takumi_wasm.js",
11
+ "types": "takumi_wasm.d.ts",
12
+ "sideEffects": [
13
+ "./snippets/*"
14
+ ],
15
+ "repository": {
16
+ "url": "git+https://github.com/kane50613/takumi.git"
17
+ }
18
+ }
@@ -0,0 +1,131 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Chroma subsampling format
5
+ */
6
+ export enum ChromaSampling {
7
+ /**
8
+ * Both vertically and horizontally subsampled.
9
+ */
10
+ Cs420 = 0,
11
+ /**
12
+ * Horizontally subsampled.
13
+ */
14
+ Cs422 = 1,
15
+ /**
16
+ * Not subsampled.
17
+ */
18
+ Cs444 = 2,
19
+ /**
20
+ * Monochrome.
21
+ */
22
+ Cs400 = 3,
23
+ }
24
+ /**
25
+ * Output format for the rendered image.
26
+ */
27
+ export enum ImageOutputFormat {
28
+ /**
29
+ * WebP format, suitable for web images with good compression.
30
+ */
31
+ WebP = 0,
32
+ /**
33
+ * PNG format, lossless and supports transparency.
34
+ */
35
+ Png = 1,
36
+ /**
37
+ * JPEG format, lossy compression suitable for photographs.
38
+ */
39
+ Jpeg = 2,
40
+ }
41
+
42
+ export interface AnyNode {
43
+ type: string;
44
+ [key: string]: any;
45
+ }
46
+
47
+
48
+ export class Renderer {
49
+ free(): void;
50
+ constructor(debug?: boolean | null);
51
+ loadFont(font_data: Uint8Array): void;
52
+ putPersistentImage(src: string, data: Uint8Array): void;
53
+ clearImageStore(): void;
54
+ render(node: AnyNode, width: number, height: number, format?: ImageOutputFormat | null, quality?: number | null): Uint8Array;
55
+ }
56
+ /**
57
+ * The viewport for the image renderer.
58
+ */
59
+ export class Viewport {
60
+ private constructor();
61
+ free(): void;
62
+ /**
63
+ * Creates a new viewport with the default font size.
64
+ */
65
+ static new(width: number, height: number): Viewport;
66
+ /**
67
+ * Creates a new viewport with the specified font size.
68
+ */
69
+ static new_with_font_size(width: number, height: number, font_size: number): Viewport;
70
+ /**
71
+ * The width of the viewport in pixels.
72
+ */
73
+ width: number;
74
+ /**
75
+ * The height of the viewport in pixels.
76
+ */
77
+ height: number;
78
+ /**
79
+ * The font size in pixels, used for em and rem units.
80
+ */
81
+ font_size: number;
82
+ }
83
+
84
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
85
+
86
+ export interface InitOutput {
87
+ readonly memory: WebAssembly.Memory;
88
+ readonly __wbg_renderer_free: (a: number, b: number) => void;
89
+ readonly renderer_new: (a: number) => number;
90
+ readonly renderer_loadFont: (a: number, b: number, c: number) => void;
91
+ readonly renderer_putPersistentImage: (a: number, b: number, c: number, d: number, e: number) => void;
92
+ readonly renderer_clearImageStore: (a: number) => void;
93
+ readonly renderer_render: (a: number, b: any, c: number, d: number, e: number, f: number) => [number, number];
94
+ readonly __wbg_viewport_free: (a: number, b: number) => void;
95
+ readonly __wbg_get_viewport_width: (a: number) => number;
96
+ readonly __wbg_set_viewport_width: (a: number, b: number) => void;
97
+ readonly __wbg_get_viewport_height: (a: number) => number;
98
+ readonly __wbg_set_viewport_height: (a: number, b: number) => void;
99
+ readonly __wbg_get_viewport_font_size: (a: number) => number;
100
+ readonly __wbg_set_viewport_font_size: (a: number, b: number) => void;
101
+ readonly viewport_new: (a: number, b: number) => number;
102
+ readonly viewport_new_with_font_size: (a: number, b: number, c: number) => number;
103
+ readonly __wbindgen_exn_store: (a: number) => void;
104
+ readonly __externref_table_alloc: () => number;
105
+ readonly __wbindgen_export_2: WebAssembly.Table;
106
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
107
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
108
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
109
+ readonly __wbindgen_start: () => void;
110
+ }
111
+
112
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
113
+ /**
114
+ * Instantiates the given `module`, which can either be bytes or
115
+ * a precompiled `WebAssembly.Module`.
116
+ *
117
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
118
+ *
119
+ * @returns {InitOutput}
120
+ */
121
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
122
+
123
+ /**
124
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
125
+ * for everything else, calls `WebAssembly.instantiate` directly.
126
+ *
127
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
128
+ *
129
+ * @returns {Promise<InitOutput>}
130
+ */
131
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/takumi_wasm.js ADDED
@@ -0,0 +1,667 @@
1
+ let wasm;
2
+
3
+ function addToExternrefTable0(obj) {
4
+ const idx = wasm.__externref_table_alloc();
5
+ wasm.__wbindgen_export_2.set(idx, obj);
6
+ return idx;
7
+ }
8
+
9
+ function handleError(f, args) {
10
+ try {
11
+ return f.apply(this, args);
12
+ } catch (e) {
13
+ const idx = addToExternrefTable0(e);
14
+ wasm.__wbindgen_exn_store(idx);
15
+ }
16
+ }
17
+
18
+ function isLikeNone(x) {
19
+ return x === undefined || x === null;
20
+ }
21
+
22
+ let cachedDataViewMemory0 = null;
23
+
24
+ function getDataViewMemory0() {
25
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
26
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
27
+ }
28
+ return cachedDataViewMemory0;
29
+ }
30
+
31
+ function debugString(val) {
32
+ // primitive types
33
+ const type = typeof val;
34
+ if (type == 'number' || type == 'boolean' || val == null) {
35
+ return `${val}`;
36
+ }
37
+ if (type == 'string') {
38
+ return `"${val}"`;
39
+ }
40
+ if (type == 'symbol') {
41
+ const description = val.description;
42
+ if (description == null) {
43
+ return 'Symbol';
44
+ } else {
45
+ return `Symbol(${description})`;
46
+ }
47
+ }
48
+ if (type == 'function') {
49
+ const name = val.name;
50
+ if (typeof name == 'string' && name.length > 0) {
51
+ return `Function(${name})`;
52
+ } else {
53
+ return 'Function';
54
+ }
55
+ }
56
+ // objects
57
+ if (Array.isArray(val)) {
58
+ const length = val.length;
59
+ let debug = '[';
60
+ if (length > 0) {
61
+ debug += debugString(val[0]);
62
+ }
63
+ for(let i = 1; i < length; i++) {
64
+ debug += ', ' + debugString(val[i]);
65
+ }
66
+ debug += ']';
67
+ return debug;
68
+ }
69
+ // Test for built-in
70
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
71
+ let className;
72
+ if (builtInMatches && builtInMatches.length > 1) {
73
+ className = builtInMatches[1];
74
+ } else {
75
+ // Failed to match the standard '[object ClassName]'
76
+ return toString.call(val);
77
+ }
78
+ if (className == 'Object') {
79
+ // we're a user defined class or Object
80
+ // JSON.stringify avoids problems with cycles, and is generally much
81
+ // easier than looping through ownProperties of `val`.
82
+ try {
83
+ return 'Object(' + JSON.stringify(val) + ')';
84
+ } catch (_) {
85
+ return 'Object';
86
+ }
87
+ }
88
+ // errors
89
+ if (val instanceof Error) {
90
+ return `${val.name}: ${val.message}\n${val.stack}`;
91
+ }
92
+ // TODO we could test for more things here, like `Set`s and `Map`s.
93
+ return className;
94
+ }
95
+
96
+ let WASM_VECTOR_LEN = 0;
97
+
98
+ let cachedUint8ArrayMemory0 = null;
99
+
100
+ function getUint8ArrayMemory0() {
101
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
102
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
103
+ }
104
+ return cachedUint8ArrayMemory0;
105
+ }
106
+
107
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
108
+
109
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
110
+ ? function (arg, view) {
111
+ return cachedTextEncoder.encodeInto(arg, view);
112
+ }
113
+ : function (arg, view) {
114
+ const buf = cachedTextEncoder.encode(arg);
115
+ view.set(buf);
116
+ return {
117
+ read: arg.length,
118
+ written: buf.length
119
+ };
120
+ });
121
+
122
+ function passStringToWasm0(arg, malloc, realloc) {
123
+
124
+ if (realloc === undefined) {
125
+ const buf = cachedTextEncoder.encode(arg);
126
+ const ptr = malloc(buf.length, 1) >>> 0;
127
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
128
+ WASM_VECTOR_LEN = buf.length;
129
+ return ptr;
130
+ }
131
+
132
+ let len = arg.length;
133
+ let ptr = malloc(len, 1) >>> 0;
134
+
135
+ const mem = getUint8ArrayMemory0();
136
+
137
+ let offset = 0;
138
+
139
+ for (; offset < len; offset++) {
140
+ const code = arg.charCodeAt(offset);
141
+ if (code > 0x7F) break;
142
+ mem[ptr + offset] = code;
143
+ }
144
+
145
+ if (offset !== len) {
146
+ if (offset !== 0) {
147
+ arg = arg.slice(offset);
148
+ }
149
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
150
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
151
+ const ret = encodeString(arg, view);
152
+
153
+ offset += ret.written;
154
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
155
+ }
156
+
157
+ WASM_VECTOR_LEN = offset;
158
+ return ptr;
159
+ }
160
+
161
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
162
+
163
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
164
+
165
+ function getStringFromWasm0(ptr, len) {
166
+ ptr = ptr >>> 0;
167
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
168
+ }
169
+
170
+ function passArray8ToWasm0(arg, malloc) {
171
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
172
+ getUint8ArrayMemory0().set(arg, ptr / 1);
173
+ WASM_VECTOR_LEN = arg.length;
174
+ return ptr;
175
+ }
176
+
177
+ function getArrayU8FromWasm0(ptr, len) {
178
+ ptr = ptr >>> 0;
179
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
180
+ }
181
+ /**
182
+ * Chroma subsampling format
183
+ * @enum {0 | 1 | 2 | 3}
184
+ */
185
+ export const ChromaSampling = Object.freeze({
186
+ /**
187
+ * Both vertically and horizontally subsampled.
188
+ */
189
+ Cs420: 0, "0": "Cs420",
190
+ /**
191
+ * Horizontally subsampled.
192
+ */
193
+ Cs422: 1, "1": "Cs422",
194
+ /**
195
+ * Not subsampled.
196
+ */
197
+ Cs444: 2, "2": "Cs444",
198
+ /**
199
+ * Monochrome.
200
+ */
201
+ Cs400: 3, "3": "Cs400",
202
+ });
203
+ /**
204
+ * Output format for the rendered image.
205
+ * @enum {0 | 1 | 2}
206
+ */
207
+ export const ImageOutputFormat = Object.freeze({
208
+ /**
209
+ * WebP format, suitable for web images with good compression.
210
+ */
211
+ WebP: 0, "0": "WebP",
212
+ /**
213
+ * PNG format, lossless and supports transparency.
214
+ */
215
+ Png: 1, "1": "Png",
216
+ /**
217
+ * JPEG format, lossy compression suitable for photographs.
218
+ */
219
+ Jpeg: 2, "2": "Jpeg",
220
+ });
221
+
222
+ const RendererFinalization = (typeof FinalizationRegistry === 'undefined')
223
+ ? { register: () => {}, unregister: () => {} }
224
+ : new FinalizationRegistry(ptr => wasm.__wbg_renderer_free(ptr >>> 0, 1));
225
+
226
+ export class Renderer {
227
+
228
+ __destroy_into_raw() {
229
+ const ptr = this.__wbg_ptr;
230
+ this.__wbg_ptr = 0;
231
+ RendererFinalization.unregister(this);
232
+ return ptr;
233
+ }
234
+
235
+ free() {
236
+ const ptr = this.__destroy_into_raw();
237
+ wasm.__wbg_renderer_free(ptr, 0);
238
+ }
239
+ /**
240
+ * @param {boolean | null} [debug]
241
+ */
242
+ constructor(debug) {
243
+ const ret = wasm.renderer_new(isLikeNone(debug) ? 0xFFFFFF : debug ? 1 : 0);
244
+ this.__wbg_ptr = ret >>> 0;
245
+ RendererFinalization.register(this, this.__wbg_ptr, this);
246
+ return this;
247
+ }
248
+ /**
249
+ * @param {Uint8Array} font_data
250
+ */
251
+ loadFont(font_data) {
252
+ const ptr0 = passArray8ToWasm0(font_data, wasm.__wbindgen_malloc);
253
+ const len0 = WASM_VECTOR_LEN;
254
+ wasm.renderer_loadFont(this.__wbg_ptr, ptr0, len0);
255
+ }
256
+ /**
257
+ * @param {string} src
258
+ * @param {Uint8Array} data
259
+ */
260
+ putPersistentImage(src, data) {
261
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
262
+ const len0 = WASM_VECTOR_LEN;
263
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
264
+ const len1 = WASM_VECTOR_LEN;
265
+ wasm.renderer_putPersistentImage(this.__wbg_ptr, ptr0, len0, ptr1, len1);
266
+ }
267
+ clearImageStore() {
268
+ wasm.renderer_clearImageStore(this.__wbg_ptr);
269
+ }
270
+ /**
271
+ * @param {AnyNode} node
272
+ * @param {number} width
273
+ * @param {number} height
274
+ * @param {ImageOutputFormat | null} [format]
275
+ * @param {number | null} [quality]
276
+ * @returns {Uint8Array}
277
+ */
278
+ render(node, width, height, format, quality) {
279
+ const ret = wasm.renderer_render(this.__wbg_ptr, node, width, height, isLikeNone(format) ? 3 : format, isLikeNone(quality) ? 0xFFFFFF : quality);
280
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
281
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
282
+ return v1;
283
+ }
284
+ }
285
+
286
+ const ViewportFinalization = (typeof FinalizationRegistry === 'undefined')
287
+ ? { register: () => {}, unregister: () => {} }
288
+ : new FinalizationRegistry(ptr => wasm.__wbg_viewport_free(ptr >>> 0, 1));
289
+ /**
290
+ * The viewport for the image renderer.
291
+ */
292
+ export class Viewport {
293
+
294
+ static __wrap(ptr) {
295
+ ptr = ptr >>> 0;
296
+ const obj = Object.create(Viewport.prototype);
297
+ obj.__wbg_ptr = ptr;
298
+ ViewportFinalization.register(obj, obj.__wbg_ptr, obj);
299
+ return obj;
300
+ }
301
+
302
+ __destroy_into_raw() {
303
+ const ptr = this.__wbg_ptr;
304
+ this.__wbg_ptr = 0;
305
+ ViewportFinalization.unregister(this);
306
+ return ptr;
307
+ }
308
+
309
+ free() {
310
+ const ptr = this.__destroy_into_raw();
311
+ wasm.__wbg_viewport_free(ptr, 0);
312
+ }
313
+ /**
314
+ * The width of the viewport in pixels.
315
+ * @returns {number}
316
+ */
317
+ get width() {
318
+ const ret = wasm.__wbg_get_viewport_width(this.__wbg_ptr);
319
+ return ret >>> 0;
320
+ }
321
+ /**
322
+ * The width of the viewport in pixels.
323
+ * @param {number} arg0
324
+ */
325
+ set width(arg0) {
326
+ wasm.__wbg_set_viewport_width(this.__wbg_ptr, arg0);
327
+ }
328
+ /**
329
+ * The height of the viewport in pixels.
330
+ * @returns {number}
331
+ */
332
+ get height() {
333
+ const ret = wasm.__wbg_get_viewport_height(this.__wbg_ptr);
334
+ return ret >>> 0;
335
+ }
336
+ /**
337
+ * The height of the viewport in pixels.
338
+ * @param {number} arg0
339
+ */
340
+ set height(arg0) {
341
+ wasm.__wbg_set_viewport_height(this.__wbg_ptr, arg0);
342
+ }
343
+ /**
344
+ * The font size in pixels, used for em and rem units.
345
+ * @returns {number}
346
+ */
347
+ get font_size() {
348
+ const ret = wasm.__wbg_get_viewport_font_size(this.__wbg_ptr);
349
+ return ret;
350
+ }
351
+ /**
352
+ * The font size in pixels, used for em and rem units.
353
+ * @param {number} arg0
354
+ */
355
+ set font_size(arg0) {
356
+ wasm.__wbg_set_viewport_font_size(this.__wbg_ptr, arg0);
357
+ }
358
+ /**
359
+ * Creates a new viewport with the default font size.
360
+ * @param {number} width
361
+ * @param {number} height
362
+ * @returns {Viewport}
363
+ */
364
+ static new(width, height) {
365
+ const ret = wasm.viewport_new(width, height);
366
+ return Viewport.__wrap(ret);
367
+ }
368
+ /**
369
+ * Creates a new viewport with the specified font size.
370
+ * @param {number} width
371
+ * @param {number} height
372
+ * @param {number} font_size
373
+ * @returns {Viewport}
374
+ */
375
+ static new_with_font_size(width, height, font_size) {
376
+ const ret = wasm.viewport_new_with_font_size(width, height, font_size);
377
+ return Viewport.__wrap(ret);
378
+ }
379
+ }
380
+
381
+ async function __wbg_load(module, imports) {
382
+ if (typeof Response === 'function' && module instanceof Response) {
383
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
384
+ try {
385
+ return await WebAssembly.instantiateStreaming(module, imports);
386
+
387
+ } catch (e) {
388
+ if (module.headers.get('Content-Type') != 'application/wasm') {
389
+ 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);
390
+
391
+ } else {
392
+ throw e;
393
+ }
394
+ }
395
+ }
396
+
397
+ const bytes = await module.arrayBuffer();
398
+ return await WebAssembly.instantiate(bytes, imports);
399
+
400
+ } else {
401
+ const instance = await WebAssembly.instantiate(module, imports);
402
+
403
+ if (instance instanceof WebAssembly.Instance) {
404
+ return { instance, module };
405
+
406
+ } else {
407
+ return instance;
408
+ }
409
+ }
410
+ }
411
+
412
+ function __wbg_get_imports() {
413
+ const imports = {};
414
+ imports.wbg = {};
415
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
416
+ const ret = arg0.buffer;
417
+ return ret;
418
+ };
419
+ imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
420
+ const ret = arg0.call(arg1);
421
+ return ret;
422
+ }, arguments) };
423
+ imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
424
+ const ret = arg0.done;
425
+ return ret;
426
+ };
427
+ imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
428
+ const ret = Object.entries(arg0);
429
+ return ret;
430
+ };
431
+ imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
432
+ const ret = Reflect.get(arg0, arg1);
433
+ return ret;
434
+ }, arguments) };
435
+ imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
436
+ const ret = arg0[arg1 >>> 0];
437
+ return ret;
438
+ };
439
+ imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
440
+ let result;
441
+ try {
442
+ result = arg0 instanceof ArrayBuffer;
443
+ } catch (_) {
444
+ result = false;
445
+ }
446
+ const ret = result;
447
+ return ret;
448
+ };
449
+ imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
450
+ let result;
451
+ try {
452
+ result = arg0 instanceof Map;
453
+ } catch (_) {
454
+ result = false;
455
+ }
456
+ const ret = result;
457
+ return ret;
458
+ };
459
+ imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
460
+ let result;
461
+ try {
462
+ result = arg0 instanceof Uint8Array;
463
+ } catch (_) {
464
+ result = false;
465
+ }
466
+ const ret = result;
467
+ return ret;
468
+ };
469
+ imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
470
+ const ret = Array.isArray(arg0);
471
+ return ret;
472
+ };
473
+ imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
474
+ const ret = Number.isSafeInteger(arg0);
475
+ return ret;
476
+ };
477
+ imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
478
+ const ret = Symbol.iterator;
479
+ return ret;
480
+ };
481
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
482
+ const ret = arg0.length;
483
+ return ret;
484
+ };
485
+ imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
486
+ const ret = arg0.length;
487
+ return ret;
488
+ };
489
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
490
+ const ret = new Uint8Array(arg0);
491
+ return ret;
492
+ };
493
+ imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
494
+ const ret = arg0.next;
495
+ return ret;
496
+ };
497
+ imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
498
+ const ret = arg0.next();
499
+ return ret;
500
+ }, arguments) };
501
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
502
+ arg0.set(arg1, arg2 >>> 0);
503
+ };
504
+ imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
505
+ const ret = arg0.value;
506
+ return ret;
507
+ };
508
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
509
+ const ret = arg0;
510
+ return ret;
511
+ };
512
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
513
+ const ret = BigInt.asUintN(64, arg0);
514
+ return ret;
515
+ };
516
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
517
+ const v = arg1;
518
+ const ret = typeof(v) === 'bigint' ? v : undefined;
519
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
520
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
521
+ };
522
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
523
+ const v = arg0;
524
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
525
+ return ret;
526
+ };
527
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
528
+ const ret = debugString(arg1);
529
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
530
+ const len1 = WASM_VECTOR_LEN;
531
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
532
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
533
+ };
534
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
535
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
536
+ return ret;
537
+ };
538
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
539
+ const ret = arg0 in arg1;
540
+ return ret;
541
+ };
542
+ imports.wbg.__wbindgen_init_externref_table = function() {
543
+ const table = wasm.__wbindgen_export_2;
544
+ const offset = table.grow(4);
545
+ table.set(0, undefined);
546
+ table.set(offset + 0, undefined);
547
+ table.set(offset + 1, null);
548
+ table.set(offset + 2, true);
549
+ table.set(offset + 3, false);
550
+ ;
551
+ };
552
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
553
+ const ret = typeof(arg0) === 'bigint';
554
+ return ret;
555
+ };
556
+ imports.wbg.__wbindgen_is_function = function(arg0) {
557
+ const ret = typeof(arg0) === 'function';
558
+ return ret;
559
+ };
560
+ imports.wbg.__wbindgen_is_object = function(arg0) {
561
+ const val = arg0;
562
+ const ret = typeof(val) === 'object' && val !== null;
563
+ return ret;
564
+ };
565
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
566
+ const ret = arg0 === arg1;
567
+ return ret;
568
+ };
569
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
570
+ const ret = arg0 == arg1;
571
+ return ret;
572
+ };
573
+ imports.wbg.__wbindgen_memory = function() {
574
+ const ret = wasm.memory;
575
+ return ret;
576
+ };
577
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
578
+ const obj = arg1;
579
+ const ret = typeof(obj) === 'number' ? obj : undefined;
580
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
581
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
582
+ };
583
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
584
+ const obj = arg1;
585
+ const ret = typeof(obj) === 'string' ? obj : undefined;
586
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
587
+ var len1 = WASM_VECTOR_LEN;
588
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
589
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
590
+ };
591
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
592
+ throw new Error(getStringFromWasm0(arg0, arg1));
593
+ };
594
+
595
+ return imports;
596
+ }
597
+
598
+ function __wbg_init_memory(imports, memory) {
599
+
600
+ }
601
+
602
+ function __wbg_finalize_init(instance, module) {
603
+ wasm = instance.exports;
604
+ __wbg_init.__wbindgen_wasm_module = module;
605
+ cachedDataViewMemory0 = null;
606
+ cachedUint8ArrayMemory0 = null;
607
+
608
+
609
+ wasm.__wbindgen_start();
610
+ return wasm;
611
+ }
612
+
613
+ function initSync(module) {
614
+ if (wasm !== undefined) return wasm;
615
+
616
+
617
+ if (typeof module !== 'undefined') {
618
+ if (Object.getPrototypeOf(module) === Object.prototype) {
619
+ ({module} = module)
620
+ } else {
621
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
622
+ }
623
+ }
624
+
625
+ const imports = __wbg_get_imports();
626
+
627
+ __wbg_init_memory(imports);
628
+
629
+ if (!(module instanceof WebAssembly.Module)) {
630
+ module = new WebAssembly.Module(module);
631
+ }
632
+
633
+ const instance = new WebAssembly.Instance(module, imports);
634
+
635
+ return __wbg_finalize_init(instance, module);
636
+ }
637
+
638
+ async function __wbg_init(module_or_path) {
639
+ if (wasm !== undefined) return wasm;
640
+
641
+
642
+ if (typeof module_or_path !== 'undefined') {
643
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
644
+ ({module_or_path} = module_or_path)
645
+ } else {
646
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
647
+ }
648
+ }
649
+
650
+ if (typeof module_or_path === 'undefined') {
651
+ module_or_path = new URL('takumi_wasm_bg.wasm', import.meta.url);
652
+ }
653
+ const imports = __wbg_get_imports();
654
+
655
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
656
+ module_or_path = fetch(module_or_path);
657
+ }
658
+
659
+ __wbg_init_memory(imports);
660
+
661
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
662
+
663
+ return __wbg_finalize_init(instance, module);
664
+ }
665
+
666
+ export { initSync };
667
+ export default __wbg_init;
Binary file