@wonfsy/wonfy-tools 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright 2025 Salah Al-din Mahmoud
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”),
4
+ to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
5
+ and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
10
+ AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
11
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # Wonfy Tools
2
+
3
+ Simple collection of tools, mostly for personal usage.\
4
+ You can checkout deployed version with UI on https://tools.won.fyi
5
+
6
+ #### You can install is as a cli
7
+
8
+ ```sh
9
+ cargo install wonfy-tools
10
+ ```
11
+
12
+ #### Or add it as a library
13
+
14
+ ```sh
15
+ cargo add wonfy-tools
16
+ ```
17
+
18
+ #### Or add it as an npm dependency
19
+
20
+ ```sh
21
+ npm install @wonfsy/wonfy-tools
22
+ ```
23
+
24
+ Then initiating the wasm before using any of the functionality.
25
+
26
+ ```ts
27
+ import initWasm, { stitch } from "@wonfsy/wonfy-tools";
28
+
29
+ function main() {
30
+ initWasm().then(() => stitch(/* params */))
31
+ }
32
+ ```
33
+
34
+ If you're using a bundler, you're gonna have to tell the bundler to include the wasm file and then get a link to it.
35
+
36
+ ##### Example for vite
37
+ ```ts
38
+ import initWasm, { stitch } from "@wonfsy/wonfy-tools";
39
+ import wasmUrl from "@wonfsy/wonfy-tools/wonfy_tools_bg.wasm?url"
40
+
41
+ function main() {
42
+ initWasm({ module_or_path: wasmUrl }).then(() => stitch(/* params */))
43
+ }
44
+ ```
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@wonfsy/wonfy-tools",
3
+ "type": "module",
4
+ "description": "Collection of tools for personal use, provides library and CLI.",
5
+ "version": "0.1.0",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/SalahaldinBilal/wonfy-tools"
10
+ },
11
+ "files": [
12
+ "wonfy_tools_bg.wasm",
13
+ "wonfy_tools.js",
14
+ "wonfy_tools.d.ts"
15
+ ],
16
+ "main": "wonfy_tools.js",
17
+ "types": "wonfy_tools.d.ts",
18
+ "sideEffects": [
19
+ "./snippets/*"
20
+ ],
21
+ "keywords": [
22
+ "tools",
23
+ "image",
24
+ "stitching"
25
+ ]
26
+ }
@@ -0,0 +1,72 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function stitch(images: Uint8Array[], direction: string, order: string, window_size?: number | null, match_mode?: string | null, crop_padding?: number | null, preview?: Preview | null): StitchReturn;
4
+ export function start(): void;
5
+ export enum PreviewType {
6
+ Resize = 0,
7
+ MaxWidth = 1,
8
+ MaxHeight = 2,
9
+ }
10
+ export class Preview {
11
+ free(): void;
12
+ constructor(type: PreviewType, value: number);
13
+ }
14
+ export class StitchReturn {
15
+ private constructor();
16
+ free(): void;
17
+ images(): [StitchedImage, StitchedImage?];
18
+ }
19
+ export class StitchedImage {
20
+ private constructor();
21
+ free(): void;
22
+ toJson(): { image: Uint8Array, stitchPositions: Array<{ x: number, y: number }>, width: number, height: number };
23
+ width: number;
24
+ height: number;
25
+ }
26
+
27
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
28
+
29
+ export interface InitOutput {
30
+ readonly memory: WebAssembly.Memory;
31
+ readonly __wbg_preview_free: (a: number, b: number) => void;
32
+ readonly preview_new: (a: number, b: number) => number;
33
+ readonly __wbg_stitchedimage_free: (a: number, b: number) => void;
34
+ readonly __wbg_get_stitchedimage_width: (a: number) => number;
35
+ readonly __wbg_set_stitchedimage_width: (a: number, b: number) => void;
36
+ readonly __wbg_get_stitchedimage_height: (a: number) => number;
37
+ readonly __wbg_set_stitchedimage_height: (a: number, b: number) => void;
38
+ readonly stitchedimage_toJson: (a: number) => any;
39
+ readonly __wbg_stitchreturn_free: (a: number, b: number) => void;
40
+ readonly stitchreturn_images: (a: number) => any;
41
+ readonly stitch: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
42
+ readonly start: () => void;
43
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
44
+ readonly __wbindgen_exn_store: (a: number) => void;
45
+ readonly __externref_table_alloc: () => number;
46
+ readonly __wbindgen_export_3: WebAssembly.Table;
47
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
48
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
49
+ readonly __externref_table_dealloc: (a: number) => void;
50
+ readonly __wbindgen_start: () => void;
51
+ }
52
+
53
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
54
+ /**
55
+ * Instantiates the given `module`, which can either be bytes or
56
+ * a precompiled `WebAssembly.Module`.
57
+ *
58
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
59
+ *
60
+ * @returns {InitOutput}
61
+ */
62
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
63
+
64
+ /**
65
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
66
+ * for everything else, calls `WebAssembly.instantiate` directly.
67
+ *
68
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
69
+ *
70
+ * @returns {Promise<InitOutput>}
71
+ */
72
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/wonfy_tools.js ADDED
@@ -0,0 +1,543 @@
1
+ let wasm;
2
+
3
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
+
5
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
6
+
7
+ let cachedUint8ArrayMemory0 = null;
8
+
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
15
+
16
+ function getStringFromWasm0(ptr, len) {
17
+ ptr = ptr >>> 0;
18
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
19
+ }
20
+
21
+ function addToExternrefTable0(obj) {
22
+ const idx = wasm.__externref_table_alloc();
23
+ wasm.__wbindgen_export_3.set(idx, obj);
24
+ return idx;
25
+ }
26
+
27
+ function handleError(f, args) {
28
+ try {
29
+ return f.apply(this, args);
30
+ } catch (e) {
31
+ const idx = addToExternrefTable0(e);
32
+ wasm.__wbindgen_exn_store(idx);
33
+ }
34
+ }
35
+
36
+ let WASM_VECTOR_LEN = 0;
37
+
38
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
39
+
40
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
41
+ ? function (arg, view) {
42
+ return cachedTextEncoder.encodeInto(arg, view);
43
+ }
44
+ : function (arg, view) {
45
+ const buf = cachedTextEncoder.encode(arg);
46
+ view.set(buf);
47
+ return {
48
+ read: arg.length,
49
+ written: buf.length
50
+ };
51
+ });
52
+
53
+ function passStringToWasm0(arg, malloc, realloc) {
54
+
55
+ if (realloc === undefined) {
56
+ const buf = cachedTextEncoder.encode(arg);
57
+ const ptr = malloc(buf.length, 1) >>> 0;
58
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
59
+ WASM_VECTOR_LEN = buf.length;
60
+ return ptr;
61
+ }
62
+
63
+ let len = arg.length;
64
+ let ptr = malloc(len, 1) >>> 0;
65
+
66
+ const mem = getUint8ArrayMemory0();
67
+
68
+ let offset = 0;
69
+
70
+ for (; offset < len; offset++) {
71
+ const code = arg.charCodeAt(offset);
72
+ if (code > 0x7F) break;
73
+ mem[ptr + offset] = code;
74
+ }
75
+
76
+ if (offset !== len) {
77
+ if (offset !== 0) {
78
+ arg = arg.slice(offset);
79
+ }
80
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
81
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
82
+ const ret = encodeString(arg, view);
83
+
84
+ offset += ret.written;
85
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
86
+ }
87
+
88
+ WASM_VECTOR_LEN = offset;
89
+ return ptr;
90
+ }
91
+
92
+ let cachedDataViewMemory0 = null;
93
+
94
+ function getDataViewMemory0() {
95
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
96
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
97
+ }
98
+ return cachedDataViewMemory0;
99
+ }
100
+
101
+ function getArrayU8FromWasm0(ptr, len) {
102
+ ptr = ptr >>> 0;
103
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
104
+ }
105
+
106
+ function passArrayJsValueToWasm0(array, malloc) {
107
+ const ptr = malloc(array.length * 4, 4) >>> 0;
108
+ for (let i = 0; i < array.length; i++) {
109
+ const add = addToExternrefTable0(array[i]);
110
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
111
+ }
112
+ WASM_VECTOR_LEN = array.length;
113
+ return ptr;
114
+ }
115
+
116
+ function isLikeNone(x) {
117
+ return x === undefined || x === null;
118
+ }
119
+
120
+ function _assertClass(instance, klass) {
121
+ if (!(instance instanceof klass)) {
122
+ throw new Error(`expected instance of ${klass.name}`);
123
+ }
124
+ }
125
+
126
+ function takeFromExternrefTable0(idx) {
127
+ const value = wasm.__wbindgen_export_3.get(idx);
128
+ wasm.__externref_table_dealloc(idx);
129
+ return value;
130
+ }
131
+ /**
132
+ * @param {Uint8Array[]} images
133
+ * @param {string} direction
134
+ * @param {string} order
135
+ * @param {number | null} [window_size]
136
+ * @param {string | null} [match_mode]
137
+ * @param {number | null} [crop_padding]
138
+ * @param {Preview | null} [preview]
139
+ * @returns {StitchReturn}
140
+ */
141
+ export function stitch(images, direction, order, window_size, match_mode, crop_padding, preview) {
142
+ const ptr0 = passArrayJsValueToWasm0(images, wasm.__wbindgen_malloc);
143
+ const len0 = WASM_VECTOR_LEN;
144
+ const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
145
+ const len1 = WASM_VECTOR_LEN;
146
+ const ptr2 = passStringToWasm0(order, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
147
+ const len2 = WASM_VECTOR_LEN;
148
+ var ptr3 = isLikeNone(match_mode) ? 0 : passStringToWasm0(match_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
149
+ var len3 = WASM_VECTOR_LEN;
150
+ let ptr4 = 0;
151
+ if (!isLikeNone(preview)) {
152
+ _assertClass(preview, Preview);
153
+ ptr4 = preview.__destroy_into_raw();
154
+ }
155
+ const ret = wasm.stitch(ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(window_size) ? 0x100000001 : (window_size) >>> 0, ptr3, len3, isLikeNone(crop_padding) ? 0x100000001 : (crop_padding) >>> 0, ptr4);
156
+ if (ret[2]) {
157
+ throw takeFromExternrefTable0(ret[1]);
158
+ }
159
+ return StitchReturn.__wrap(ret[0]);
160
+ }
161
+
162
+ export function start() {
163
+ wasm.start();
164
+ }
165
+
166
+ /**
167
+ * @enum {0 | 1 | 2}
168
+ */
169
+ export const PreviewType = Object.freeze({
170
+ Resize: 0, "0": "Resize",
171
+ MaxWidth: 1, "1": "MaxWidth",
172
+ MaxHeight: 2, "2": "MaxHeight",
173
+ });
174
+
175
+ const PreviewFinalization = (typeof FinalizationRegistry === 'undefined')
176
+ ? { register: () => {}, unregister: () => {} }
177
+ : new FinalizationRegistry(ptr => wasm.__wbg_preview_free(ptr >>> 0, 1));
178
+
179
+ export class Preview {
180
+
181
+ __destroy_into_raw() {
182
+ const ptr = this.__wbg_ptr;
183
+ this.__wbg_ptr = 0;
184
+ PreviewFinalization.unregister(this);
185
+ return ptr;
186
+ }
187
+
188
+ free() {
189
+ const ptr = this.__destroy_into_raw();
190
+ wasm.__wbg_preview_free(ptr, 0);
191
+ }
192
+ /**
193
+ * @param {PreviewType} type
194
+ * @param {number} value
195
+ */
196
+ constructor(type, value) {
197
+ const ret = wasm.preview_new(type, value);
198
+ this.__wbg_ptr = ret >>> 0;
199
+ PreviewFinalization.register(this, this.__wbg_ptr, this);
200
+ return this;
201
+ }
202
+ }
203
+
204
+ const StitchReturnFinalization = (typeof FinalizationRegistry === 'undefined')
205
+ ? { register: () => {}, unregister: () => {} }
206
+ : new FinalizationRegistry(ptr => wasm.__wbg_stitchreturn_free(ptr >>> 0, 1));
207
+
208
+ export class StitchReturn {
209
+
210
+ static __wrap(ptr) {
211
+ ptr = ptr >>> 0;
212
+ const obj = Object.create(StitchReturn.prototype);
213
+ obj.__wbg_ptr = ptr;
214
+ StitchReturnFinalization.register(obj, obj.__wbg_ptr, obj);
215
+ return obj;
216
+ }
217
+
218
+ __destroy_into_raw() {
219
+ const ptr = this.__wbg_ptr;
220
+ this.__wbg_ptr = 0;
221
+ StitchReturnFinalization.unregister(this);
222
+ return ptr;
223
+ }
224
+
225
+ free() {
226
+ const ptr = this.__destroy_into_raw();
227
+ wasm.__wbg_stitchreturn_free(ptr, 0);
228
+ }
229
+ /**
230
+ * @returns {[StitchedImage, StitchedImage?]}
231
+ */
232
+ images() {
233
+ const ptr = this.__destroy_into_raw();
234
+ const ret = wasm.stitchreturn_images(ptr);
235
+ return ret;
236
+ }
237
+ }
238
+
239
+ const StitchedImageFinalization = (typeof FinalizationRegistry === 'undefined')
240
+ ? { register: () => {}, unregister: () => {} }
241
+ : new FinalizationRegistry(ptr => wasm.__wbg_stitchedimage_free(ptr >>> 0, 1));
242
+
243
+ export class StitchedImage {
244
+
245
+ static __wrap(ptr) {
246
+ ptr = ptr >>> 0;
247
+ const obj = Object.create(StitchedImage.prototype);
248
+ obj.__wbg_ptr = ptr;
249
+ StitchedImageFinalization.register(obj, obj.__wbg_ptr, obj);
250
+ return obj;
251
+ }
252
+
253
+ __destroy_into_raw() {
254
+ const ptr = this.__wbg_ptr;
255
+ this.__wbg_ptr = 0;
256
+ StitchedImageFinalization.unregister(this);
257
+ return ptr;
258
+ }
259
+
260
+ free() {
261
+ const ptr = this.__destroy_into_raw();
262
+ wasm.__wbg_stitchedimage_free(ptr, 0);
263
+ }
264
+ /**
265
+ * @returns {number}
266
+ */
267
+ get width() {
268
+ const ret = wasm.__wbg_get_stitchedimage_width(this.__wbg_ptr);
269
+ return ret >>> 0;
270
+ }
271
+ /**
272
+ * @param {number} arg0
273
+ */
274
+ set width(arg0) {
275
+ wasm.__wbg_set_stitchedimage_width(this.__wbg_ptr, arg0);
276
+ }
277
+ /**
278
+ * @returns {number}
279
+ */
280
+ get height() {
281
+ const ret = wasm.__wbg_get_stitchedimage_height(this.__wbg_ptr);
282
+ return ret >>> 0;
283
+ }
284
+ /**
285
+ * @param {number} arg0
286
+ */
287
+ set height(arg0) {
288
+ wasm.__wbg_set_stitchedimage_height(this.__wbg_ptr, arg0);
289
+ }
290
+ /**
291
+ * @returns {{ image: Uint8Array, stitchPositions: Array<{ x: number, y: number }>, width: number, height: number }}
292
+ */
293
+ toJson() {
294
+ const ptr = this.__destroy_into_raw();
295
+ const ret = wasm.stitchedimage_toJson(ptr);
296
+ return ret;
297
+ }
298
+ }
299
+
300
+ async function __wbg_load(module, imports) {
301
+ if (typeof Response === 'function' && module instanceof Response) {
302
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
303
+ try {
304
+ return await WebAssembly.instantiateStreaming(module, imports);
305
+
306
+ } catch (e) {
307
+ if (module.headers.get('Content-Type') != 'application/wasm') {
308
+ 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);
309
+
310
+ } else {
311
+ throw e;
312
+ }
313
+ }
314
+ }
315
+
316
+ const bytes = await module.arrayBuffer();
317
+ return await WebAssembly.instantiate(bytes, imports);
318
+
319
+ } else {
320
+ const instance = await WebAssembly.instantiate(module, imports);
321
+
322
+ if (instance instanceof WebAssembly.Instance) {
323
+ return { instance, module };
324
+
325
+ } else {
326
+ return instance;
327
+ }
328
+ }
329
+ }
330
+
331
+ function __wbg_get_imports() {
332
+ const imports = {};
333
+ imports.wbg = {};
334
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
335
+ const ret = arg0.buffer;
336
+ return ret;
337
+ };
338
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
339
+ let deferred0_0;
340
+ let deferred0_1;
341
+ try {
342
+ deferred0_0 = arg0;
343
+ deferred0_1 = arg1;
344
+ console.error(getStringFromWasm0(arg0, arg1));
345
+ } finally {
346
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
347
+ }
348
+ };
349
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
350
+ const ret = arg0.length;
351
+ return ret;
352
+ };
353
+ imports.wbg.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
354
+ let deferred0_0;
355
+ let deferred0_1;
356
+ try {
357
+ deferred0_0 = arg0;
358
+ deferred0_1 = arg1;
359
+ console.log(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7));
360
+ } finally {
361
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
362
+ }
363
+ };
364
+ imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
365
+ let deferred0_0;
366
+ let deferred0_1;
367
+ try {
368
+ deferred0_0 = arg0;
369
+ deferred0_1 = arg1;
370
+ console.log(getStringFromWasm0(arg0, arg1));
371
+ } finally {
372
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
373
+ }
374
+ };
375
+ imports.wbg.__wbg_mark_7438147ce31e9d4b = function(arg0, arg1) {
376
+ performance.mark(getStringFromWasm0(arg0, arg1));
377
+ };
378
+ imports.wbg.__wbg_measure_fb7825c11612c823 = function() { return handleError(function (arg0, arg1, arg2, arg3) {
379
+ let deferred0_0;
380
+ let deferred0_1;
381
+ let deferred1_0;
382
+ let deferred1_1;
383
+ try {
384
+ deferred0_0 = arg0;
385
+ deferred0_1 = arg1;
386
+ deferred1_0 = arg2;
387
+ deferred1_1 = arg3;
388
+ performance.measure(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
389
+ } finally {
390
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
391
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
392
+ }
393
+ }, arguments) };
394
+ imports.wbg.__wbg_new_405e22f390576ce2 = function() {
395
+ const ret = new Object();
396
+ return ret;
397
+ };
398
+ imports.wbg.__wbg_new_78feb108b6472713 = function() {
399
+ const ret = new Array();
400
+ return ret;
401
+ };
402
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
403
+ const ret = new Error();
404
+ return ret;
405
+ };
406
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
407
+ const ret = new Uint8Array(arg0);
408
+ return ret;
409
+ };
410
+ imports.wbg.__wbg_newwithlength_c4c419ef0bc8a1f8 = function(arg0) {
411
+ const ret = new Array(arg0 >>> 0);
412
+ return ret;
413
+ };
414
+ imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
415
+ const ret = arg0.push(arg1);
416
+ return ret;
417
+ };
418
+ imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
419
+ arg0[arg1 >>> 0] = arg2;
420
+ };
421
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
422
+ arg0.set(arg1, arg2 >>> 0);
423
+ };
424
+ imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
425
+ const ret = Reflect.set(arg0, arg1, arg2);
426
+ return ret;
427
+ }, arguments) };
428
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
429
+ const ret = arg1.stack;
430
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
431
+ const len1 = WASM_VECTOR_LEN;
432
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
433
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
434
+ };
435
+ imports.wbg.__wbg_stitchedimage_new = function(arg0) {
436
+ const ret = StitchedImage.__wrap(arg0);
437
+ return ret;
438
+ };
439
+ imports.wbg.__wbindgen_init_externref_table = function() {
440
+ const table = wasm.__wbindgen_export_3;
441
+ const offset = table.grow(4);
442
+ table.set(0, undefined);
443
+ table.set(offset + 0, undefined);
444
+ table.set(offset + 1, null);
445
+ table.set(offset + 2, true);
446
+ table.set(offset + 3, false);
447
+ ;
448
+ };
449
+ imports.wbg.__wbindgen_memory = function() {
450
+ const ret = wasm.memory;
451
+ return ret;
452
+ };
453
+ imports.wbg.__wbindgen_number_new = function(arg0) {
454
+ const ret = arg0;
455
+ return ret;
456
+ };
457
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
458
+ const ret = getStringFromWasm0(arg0, arg1);
459
+ return ret;
460
+ };
461
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
462
+ throw new Error(getStringFromWasm0(arg0, arg1));
463
+ };
464
+ imports.wbg.__wbindgen_uint8_array_new = function(arg0, arg1) {
465
+ var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
466
+ wasm.__wbindgen_free(arg0, arg1 * 1, 1);
467
+ const ret = v0;
468
+ return ret;
469
+ };
470
+
471
+ return imports;
472
+ }
473
+
474
+ function __wbg_init_memory(imports, memory) {
475
+
476
+ }
477
+
478
+ function __wbg_finalize_init(instance, module) {
479
+ wasm = instance.exports;
480
+ __wbg_init.__wbindgen_wasm_module = module;
481
+ cachedDataViewMemory0 = null;
482
+ cachedUint8ArrayMemory0 = null;
483
+
484
+
485
+ wasm.__wbindgen_start();
486
+ return wasm;
487
+ }
488
+
489
+ function initSync(module) {
490
+ if (wasm !== undefined) return wasm;
491
+
492
+
493
+ if (typeof module !== 'undefined') {
494
+ if (Object.getPrototypeOf(module) === Object.prototype) {
495
+ ({module} = module)
496
+ } else {
497
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
498
+ }
499
+ }
500
+
501
+ const imports = __wbg_get_imports();
502
+
503
+ __wbg_init_memory(imports);
504
+
505
+ if (!(module instanceof WebAssembly.Module)) {
506
+ module = new WebAssembly.Module(module);
507
+ }
508
+
509
+ const instance = new WebAssembly.Instance(module, imports);
510
+
511
+ return __wbg_finalize_init(instance, module);
512
+ }
513
+
514
+ async function __wbg_init(module_or_path) {
515
+ if (wasm !== undefined) return wasm;
516
+
517
+
518
+ if (typeof module_or_path !== 'undefined') {
519
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
520
+ ({module_or_path} = module_or_path)
521
+ } else {
522
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
523
+ }
524
+ }
525
+
526
+ if (typeof module_or_path === 'undefined') {
527
+ module_or_path = new URL('wonfy_tools_bg.wasm', import.meta.url);
528
+ }
529
+ const imports = __wbg_get_imports();
530
+
531
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
532
+ module_or_path = fetch(module_or_path);
533
+ }
534
+
535
+ __wbg_init_memory(imports);
536
+
537
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
538
+
539
+ return __wbg_finalize_init(instance, module);
540
+ }
541
+
542
+ export { initSync };
543
+ export default __wbg_init;
Binary file