@solid-labs/fab-one-widget 0.1.7 → 0.1.8

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,1686 @@
1
+ /* @ts-self-types="./geo_wasm.d.ts" */
2
+
3
+ /**
4
+ * Result of the align-to-origin transform.
5
+ */
6
+ export class AlignResult {
7
+ static __wrap(ptr) {
8
+ ptr = ptr >>> 0;
9
+ const obj = Object.create(AlignResult.prototype);
10
+ obj.__wbg_ptr = ptr;
11
+ AlignResultFinalization.register(obj, obj.__wbg_ptr, obj);
12
+ return obj;
13
+ }
14
+ __destroy_into_raw() {
15
+ const ptr = this.__wbg_ptr;
16
+ this.__wbg_ptr = 0;
17
+ AlignResultFinalization.unregister(this);
18
+ return ptr;
19
+ }
20
+ free() {
21
+ const ptr = this.__destroy_into_raw();
22
+ wasm.__wbg_alignresult_free(ptr, 0);
23
+ }
24
+ /**
25
+ * @returns {string}
26
+ */
27
+ details() {
28
+ let deferred1_0;
29
+ let deferred1_1;
30
+ try {
31
+ const ret = wasm.alignresult_details(this.__wbg_ptr);
32
+ deferred1_0 = ret[0];
33
+ deferred1_1 = ret[1];
34
+ return getStringFromWasm0(ret[0], ret[1]);
35
+ } finally {
36
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
37
+ }
38
+ }
39
+ /**
40
+ * @returns {Float32Array}
41
+ */
42
+ mpt() {
43
+ const ret = wasm.alignresult_mpt(this.__wbg_ptr);
44
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
45
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
46
+ return v1;
47
+ }
48
+ /**
49
+ * @returns {Float32Array}
50
+ */
51
+ origin() {
52
+ const ret = wasm.alignresult_origin(this.__wbg_ptr);
53
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
54
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
55
+ return v1;
56
+ }
57
+ /**
58
+ * @returns {Float32Array}
59
+ */
60
+ positions() {
61
+ const ret = wasm.alignresult_positions(this.__wbg_ptr);
62
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
63
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
64
+ return v1;
65
+ }
66
+ /**
67
+ * Returns [ox, oy, oz, r00, r01, r02, r10, r11, r12, r20, r21, r22]
68
+ * To transform a point p: rotated = R * (p - [ox,oy,oz])
69
+ * @returns {Float32Array}
70
+ */
71
+ transform() {
72
+ const ret = wasm.alignresult_transform(this.__wbg_ptr);
73
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
74
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
75
+ return v1;
76
+ }
77
+ }
78
+ if (Symbol.dispose) AlignResult.prototype[Symbol.dispose] = AlignResult.prototype.free;
79
+
80
+ /**
81
+ * Result of batch cross-sections along a line.
82
+ */
83
+ export class BatchCrossSectionResult {
84
+ static __wrap(ptr) {
85
+ ptr = ptr >>> 0;
86
+ const obj = Object.create(BatchCrossSectionResult.prototype);
87
+ obj.__wbg_ptr = ptr;
88
+ BatchCrossSectionResultFinalization.register(obj, obj.__wbg_ptr, obj);
89
+ return obj;
90
+ }
91
+ __destroy_into_raw() {
92
+ const ptr = this.__wbg_ptr;
93
+ this.__wbg_ptr = 0;
94
+ BatchCrossSectionResultFinalization.unregister(this);
95
+ return ptr;
96
+ }
97
+ free() {
98
+ const ptr = this.__destroy_into_raw();
99
+ wasm.__wbg_batchcrosssectionresult_free(ptr, 0);
100
+ }
101
+ /**
102
+ * @returns {Float32Array}
103
+ */
104
+ all_loop_points() {
105
+ const ret = wasm.batchcrosssectionresult_all_loop_points(this.__wbg_ptr);
106
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
107
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
108
+ return v1;
109
+ }
110
+ /**
111
+ * @returns {Float32Array}
112
+ */
113
+ circumferences() {
114
+ const ret = wasm.batchcrosssectionresult_circumferences(this.__wbg_ptr);
115
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
116
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
117
+ return v1;
118
+ }
119
+ /**
120
+ * @returns {number}
121
+ */
122
+ count() {
123
+ const ret = wasm.batchcrosssectionresult_count(this.__wbg_ptr);
124
+ return ret >>> 0;
125
+ }
126
+ /**
127
+ * @returns {string}
128
+ */
129
+ details() {
130
+ let deferred1_0;
131
+ let deferred1_1;
132
+ try {
133
+ const ret = wasm.batchcrosssectionresult_details(this.__wbg_ptr);
134
+ deferred1_0 = ret[0];
135
+ deferred1_1 = ret[1];
136
+ return getStringFromWasm0(ret[0], ret[1]);
137
+ } finally {
138
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
139
+ }
140
+ }
141
+ /**
142
+ * @returns {Uint32Array}
143
+ */
144
+ offsets() {
145
+ const ret = wasm.batchcrosssectionresult_offsets(this.__wbg_ptr);
146
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
147
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
148
+ return v1;
149
+ }
150
+ }
151
+ if (Symbol.dispose) BatchCrossSectionResult.prototype[Symbol.dispose] = BatchCrossSectionResult.prototype.free;
152
+
153
+ /**
154
+ * Result of cross-section detection.
155
+ */
156
+ export class CrossSectionResult {
157
+ static __wrap(ptr) {
158
+ ptr = ptr >>> 0;
159
+ const obj = Object.create(CrossSectionResult.prototype);
160
+ obj.__wbg_ptr = ptr;
161
+ CrossSectionResultFinalization.register(obj, obj.__wbg_ptr, obj);
162
+ return obj;
163
+ }
164
+ __destroy_into_raw() {
165
+ const ptr = this.__wbg_ptr;
166
+ this.__wbg_ptr = 0;
167
+ CrossSectionResultFinalization.unregister(this);
168
+ return ptr;
169
+ }
170
+ free() {
171
+ const ptr = this.__destroy_into_raw();
172
+ wasm.__wbg_crosssectionresult_free(ptr, 0);
173
+ }
174
+ /**
175
+ * @returns {number}
176
+ */
177
+ circumference() {
178
+ const ret = wasm.crosssectionresult_circumference(this.__wbg_ptr);
179
+ return ret;
180
+ }
181
+ /**
182
+ * @returns {string}
183
+ */
184
+ details() {
185
+ let deferred1_0;
186
+ let deferred1_1;
187
+ try {
188
+ const ret = wasm.crosssectionresult_details(this.__wbg_ptr);
189
+ deferred1_0 = ret[0];
190
+ deferred1_1 = ret[1];
191
+ return getStringFromWasm0(ret[0], ret[1]);
192
+ } finally {
193
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
194
+ }
195
+ }
196
+ /**
197
+ * @returns {boolean}
198
+ */
199
+ is_closed() {
200
+ const ret = wasm.crosssectionresult_is_closed(this.__wbg_ptr);
201
+ return ret !== 0;
202
+ }
203
+ /**
204
+ * @returns {Float32Array}
205
+ */
206
+ loop_points() {
207
+ const ret = wasm.crosssectionresult_loop_points(this.__wbg_ptr);
208
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
209
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
210
+ return v1;
211
+ }
212
+ /**
213
+ * @returns {Float32Array}
214
+ */
215
+ plane_normal() {
216
+ const ret = wasm.crosssectionresult_plane_normal(this.__wbg_ptr);
217
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
218
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
219
+ return v1;
220
+ }
221
+ }
222
+ if (Symbol.dispose) CrossSectionResult.prototype[Symbol.dispose] = CrossSectionResult.prototype.free;
223
+
224
+ /**
225
+ * Result of inner shell extraction via ray-casting from interior point.
226
+ */
227
+ export class ExtractInnerShellResult {
228
+ static __wrap(ptr) {
229
+ ptr = ptr >>> 0;
230
+ const obj = Object.create(ExtractInnerShellResult.prototype);
231
+ obj.__wbg_ptr = ptr;
232
+ ExtractInnerShellResultFinalization.register(obj, obj.__wbg_ptr, obj);
233
+ return obj;
234
+ }
235
+ __destroy_into_raw() {
236
+ const ptr = this.__wbg_ptr;
237
+ this.__wbg_ptr = 0;
238
+ ExtractInnerShellResultFinalization.unregister(this);
239
+ return ptr;
240
+ }
241
+ free() {
242
+ const ptr = this.__destroy_into_raw();
243
+ wasm.__wbg_extractinnershellresult_free(ptr, 0);
244
+ }
245
+ /**
246
+ * @returns {string}
247
+ */
248
+ details() {
249
+ let deferred1_0;
250
+ let deferred1_1;
251
+ try {
252
+ const ret = wasm.extractinnershellresult_details(this.__wbg_ptr);
253
+ deferred1_0 = ret[0];
254
+ deferred1_1 = ret[1];
255
+ return getStringFromWasm0(ret[0], ret[1]);
256
+ } finally {
257
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
258
+ }
259
+ }
260
+ /**
261
+ * @returns {Uint32Array}
262
+ */
263
+ indices() {
264
+ const ret = wasm.extractinnershellresult_indices(this.__wbg_ptr);
265
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
266
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
267
+ return v1;
268
+ }
269
+ /**
270
+ * @returns {number}
271
+ */
272
+ inner_count() {
273
+ const ret = wasm.extractinnershellresult_inner_count(this.__wbg_ptr);
274
+ return ret >>> 0;
275
+ }
276
+ /**
277
+ * @returns {Float32Array}
278
+ */
279
+ interior_point() {
280
+ const ret = wasm.extractinnershellresult_interior_point(this.__wbg_ptr);
281
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
282
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
283
+ return v1;
284
+ }
285
+ /**
286
+ * @returns {Float32Array}
287
+ */
288
+ positions() {
289
+ const ret = wasm.extractinnershellresult_positions(this.__wbg_ptr);
290
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
291
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
292
+ return v1;
293
+ }
294
+ /**
295
+ * @returns {number}
296
+ */
297
+ total_count() {
298
+ const ret = wasm.extractinnershellresult_total_count(this.__wbg_ptr);
299
+ return ret >>> 0;
300
+ }
301
+ }
302
+ if (Symbol.dispose) ExtractInnerShellResult.prototype[Symbol.dispose] = ExtractInnerShellResult.prototype.free;
303
+
304
+ /**
305
+ * Result of fill_small_holes.
306
+ */
307
+ export class FillHolesResult {
308
+ static __wrap(ptr) {
309
+ ptr = ptr >>> 0;
310
+ const obj = Object.create(FillHolesResult.prototype);
311
+ obj.__wbg_ptr = ptr;
312
+ FillHolesResultFinalization.register(obj, obj.__wbg_ptr, obj);
313
+ return obj;
314
+ }
315
+ __destroy_into_raw() {
316
+ const ptr = this.__wbg_ptr;
317
+ this.__wbg_ptr = 0;
318
+ FillHolesResultFinalization.unregister(this);
319
+ return ptr;
320
+ }
321
+ free() {
322
+ const ptr = this.__destroy_into_raw();
323
+ wasm.__wbg_fillholesresult_free(ptr, 0);
324
+ }
325
+ /**
326
+ * @returns {string}
327
+ */
328
+ details() {
329
+ let deferred1_0;
330
+ let deferred1_1;
331
+ try {
332
+ const ret = wasm.fillholesresult_details(this.__wbg_ptr);
333
+ deferred1_0 = ret[0];
334
+ deferred1_1 = ret[1];
335
+ return getStringFromWasm0(ret[0], ret[1]);
336
+ } finally {
337
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
338
+ }
339
+ }
340
+ /**
341
+ * @returns {number}
342
+ */
343
+ holes_filled() {
344
+ const ret = wasm.fillholesresult_holes_filled(this.__wbg_ptr);
345
+ return ret >>> 0;
346
+ }
347
+ /**
348
+ * @returns {Uint32Array}
349
+ */
350
+ indices() {
351
+ const ret = wasm.fillholesresult_indices(this.__wbg_ptr);
352
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
353
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
354
+ return v1;
355
+ }
356
+ /**
357
+ * @returns {Float32Array}
358
+ */
359
+ positions() {
360
+ const ret = wasm.fillholesresult_positions(this.__wbg_ptr);
361
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
362
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
363
+ return v1;
364
+ }
365
+ }
366
+ if (Symbol.dispose) FillHolesResult.prototype[Symbol.dispose] = FillHolesResult.prototype.free;
367
+
368
+ /**
369
+ * Result of weld_and_keep_largest: holds positions + indices.
370
+ * Access via getters since wasm_bindgen can't return tuples.
371
+ */
372
+ export class MeshResult {
373
+ static __wrap(ptr) {
374
+ ptr = ptr >>> 0;
375
+ const obj = Object.create(MeshResult.prototype);
376
+ obj.__wbg_ptr = ptr;
377
+ MeshResultFinalization.register(obj, obj.__wbg_ptr, obj);
378
+ return obj;
379
+ }
380
+ __destroy_into_raw() {
381
+ const ptr = this.__wbg_ptr;
382
+ this.__wbg_ptr = 0;
383
+ MeshResultFinalization.unregister(this);
384
+ return ptr;
385
+ }
386
+ free() {
387
+ const ptr = this.__destroy_into_raw();
388
+ wasm.__wbg_meshresult_free(ptr, 0);
389
+ }
390
+ /**
391
+ * @returns {Uint32Array}
392
+ */
393
+ indices() {
394
+ const ret = wasm.meshresult_indices(this.__wbg_ptr);
395
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
396
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
397
+ return v1;
398
+ }
399
+ /**
400
+ * @returns {Float32Array}
401
+ */
402
+ positions() {
403
+ const ret = wasm.meshresult_positions(this.__wbg_ptr);
404
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
405
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
406
+ return v1;
407
+ }
408
+ /**
409
+ * @returns {string}
410
+ */
411
+ stats() {
412
+ let deferred1_0;
413
+ let deferred1_1;
414
+ try {
415
+ const ret = wasm.meshresult_stats(this.__wbg_ptr);
416
+ deferred1_0 = ret[0];
417
+ deferred1_1 = ret[1];
418
+ return getStringFromWasm0(ret[0], ret[1]);
419
+ } finally {
420
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
421
+ }
422
+ }
423
+ }
424
+ if (Symbol.dispose) MeshResult.prototype[Symbol.dispose] = MeshResult.prototype.free;
425
+
426
+ /**
427
+ * Stage 1 result: fully preprocessed mesh ready for interactive steps.
428
+ *
429
+ * Chains four operations in a single WASM call (no JS round-trips):
430
+ * 1. Unit detection & conversion (m → mm)
431
+ * 2. AABB center → origin
432
+ * 3. Vertex welding + largest-component extraction
433
+ * 4. Small-hole filling
434
+ */
435
+ export class PreprocessResult {
436
+ static __wrap(ptr) {
437
+ ptr = ptr >>> 0;
438
+ const obj = Object.create(PreprocessResult.prototype);
439
+ obj.__wbg_ptr = ptr;
440
+ PreprocessResultFinalization.register(obj, obj.__wbg_ptr, obj);
441
+ return obj;
442
+ }
443
+ __destroy_into_raw() {
444
+ const ptr = this.__wbg_ptr;
445
+ this.__wbg_ptr = 0;
446
+ PreprocessResultFinalization.unregister(this);
447
+ return ptr;
448
+ }
449
+ free() {
450
+ const ptr = this.__destroy_into_raw();
451
+ wasm.__wbg_preprocessresult_free(ptr, 0);
452
+ }
453
+ /**
454
+ * @returns {Float32Array}
455
+ */
456
+ bbox_size() {
457
+ const ret = wasm.preprocessresult_bbox_size(this.__wbg_ptr);
458
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
459
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
460
+ return v1;
461
+ }
462
+ /**
463
+ * @returns {string}
464
+ */
465
+ detected_unit() {
466
+ let deferred1_0;
467
+ let deferred1_1;
468
+ try {
469
+ const ret = wasm.preprocessresult_detected_unit(this.__wbg_ptr);
470
+ deferred1_0 = ret[0];
471
+ deferred1_1 = ret[1];
472
+ return getStringFromWasm0(ret[0], ret[1]);
473
+ } finally {
474
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
475
+ }
476
+ }
477
+ /**
478
+ * @returns {number}
479
+ */
480
+ holes_filled() {
481
+ const ret = wasm.preprocessresult_holes_filled(this.__wbg_ptr);
482
+ return ret >>> 0;
483
+ }
484
+ /**
485
+ * @returns {Uint32Array}
486
+ */
487
+ indices() {
488
+ const ret = wasm.preprocessresult_indices(this.__wbg_ptr);
489
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
490
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
491
+ return v1;
492
+ }
493
+ /**
494
+ * @returns {string}
495
+ */
496
+ log() {
497
+ let deferred1_0;
498
+ let deferred1_1;
499
+ try {
500
+ const ret = wasm.preprocessresult_log(this.__wbg_ptr);
501
+ deferred1_0 = ret[0];
502
+ deferred1_1 = ret[1];
503
+ return getStringFromWasm0(ret[0], ret[1]);
504
+ } finally {
505
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
506
+ }
507
+ }
508
+ /**
509
+ * @returns {number}
510
+ */
511
+ max_dimension() {
512
+ const ret = wasm.preprocessresult_max_dimension(this.__wbg_ptr);
513
+ return ret;
514
+ }
515
+ /**
516
+ * @returns {Float32Array}
517
+ */
518
+ positions() {
519
+ const ret = wasm.preprocessresult_positions(this.__wbg_ptr);
520
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
521
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
522
+ return v1;
523
+ }
524
+ /**
525
+ * @returns {boolean}
526
+ */
527
+ unit_converted() {
528
+ const ret = wasm.preprocessresult_unit_converted(this.__wbg_ptr);
529
+ return ret !== 0;
530
+ }
531
+ /**
532
+ * @returns {string}
533
+ */
534
+ weld_stats() {
535
+ let deferred1_0;
536
+ let deferred1_1;
537
+ try {
538
+ const ret = wasm.preprocessresult_weld_stats(this.__wbg_ptr);
539
+ deferred1_0 = ret[0];
540
+ deferred1_1 = ret[1];
541
+ return getStringFromWasm0(ret[0], ret[1]);
542
+ } finally {
543
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
544
+ }
545
+ }
546
+ }
547
+ if (Symbol.dispose) PreprocessResult.prototype[Symbol.dispose] = PreprocessResult.prototype.free;
548
+
549
+ /**
550
+ * Result of centroid-based alignment refinement.
551
+ */
552
+ export class RefineAlignmentResult {
553
+ static __wrap(ptr) {
554
+ ptr = ptr >>> 0;
555
+ const obj = Object.create(RefineAlignmentResult.prototype);
556
+ obj.__wbg_ptr = ptr;
557
+ RefineAlignmentResultFinalization.register(obj, obj.__wbg_ptr, obj);
558
+ return obj;
559
+ }
560
+ __destroy_into_raw() {
561
+ const ptr = this.__wbg_ptr;
562
+ this.__wbg_ptr = 0;
563
+ RefineAlignmentResultFinalization.unregister(this);
564
+ return ptr;
565
+ }
566
+ free() {
567
+ const ptr = this.__destroy_into_raw();
568
+ wasm.__wbg_refinealignmentresult_free(ptr, 0);
569
+ }
570
+ /**
571
+ * @returns {Float32Array}
572
+ */
573
+ centroid_axis() {
574
+ const ret = wasm.refinealignmentresult_centroid_axis(this.__wbg_ptr);
575
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
576
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
577
+ return v1;
578
+ }
579
+ /**
580
+ * @returns {number}
581
+ */
582
+ correction_angle() {
583
+ const ret = wasm.refinealignmentresult_correction_angle(this.__wbg_ptr);
584
+ return ret;
585
+ }
586
+ /**
587
+ * @returns {string}
588
+ */
589
+ details() {
590
+ let deferred1_0;
591
+ let deferred1_1;
592
+ try {
593
+ const ret = wasm.refinealignmentresult_details(this.__wbg_ptr);
594
+ deferred1_0 = ret[0];
595
+ deferred1_1 = ret[1];
596
+ return getStringFromWasm0(ret[0], ret[1]);
597
+ } finally {
598
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
599
+ }
600
+ }
601
+ /**
602
+ * @returns {Float32Array}
603
+ */
604
+ mpt() {
605
+ const ret = wasm.refinealignmentresult_mpt(this.__wbg_ptr);
606
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
607
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
608
+ return v1;
609
+ }
610
+ /**
611
+ * @returns {Float32Array}
612
+ */
613
+ origin() {
614
+ const ret = wasm.refinealignmentresult_origin(this.__wbg_ptr);
615
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
616
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
617
+ return v1;
618
+ }
619
+ /**
620
+ * @returns {Float32Array}
621
+ */
622
+ positions() {
623
+ const ret = wasm.refinealignmentresult_positions(this.__wbg_ptr);
624
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
625
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
626
+ return v1;
627
+ }
628
+ /**
629
+ * @returns {Float32Array}
630
+ */
631
+ rotation() {
632
+ const ret = wasm.refinealignmentresult_rotation(this.__wbg_ptr);
633
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
634
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
635
+ return v1;
636
+ }
637
+ }
638
+ if (Symbol.dispose) RefineAlignmentResult.prototype[Symbol.dispose] = RefineAlignmentResult.prototype.free;
639
+
640
+ /**
641
+ * Result of secondary PCA alignment.
642
+ */
643
+ export class SecondaryPcaResult {
644
+ static __wrap(ptr) {
645
+ ptr = ptr >>> 0;
646
+ const obj = Object.create(SecondaryPcaResult.prototype);
647
+ obj.__wbg_ptr = ptr;
648
+ SecondaryPcaResultFinalization.register(obj, obj.__wbg_ptr, obj);
649
+ return obj;
650
+ }
651
+ __destroy_into_raw() {
652
+ const ptr = this.__wbg_ptr;
653
+ this.__wbg_ptr = 0;
654
+ SecondaryPcaResultFinalization.unregister(this);
655
+ return ptr;
656
+ }
657
+ free() {
658
+ const ptr = this.__destroy_into_raw();
659
+ wasm.__wbg_secondarypcaresult_free(ptr, 0);
660
+ }
661
+ /**
662
+ * @returns {string}
663
+ */
664
+ details() {
665
+ let deferred1_0;
666
+ let deferred1_1;
667
+ try {
668
+ const ret = wasm.secondarypcaresult_details(this.__wbg_ptr);
669
+ deferred1_0 = ret[0];
670
+ deferred1_1 = ret[1];
671
+ return getStringFromWasm0(ret[0], ret[1]);
672
+ } finally {
673
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
674
+ }
675
+ }
676
+ /**
677
+ * @returns {Float32Array}
678
+ */
679
+ mpt() {
680
+ const ret = wasm.secondarypcaresult_mpt(this.__wbg_ptr);
681
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
682
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
683
+ return v1;
684
+ }
685
+ /**
686
+ * @returns {Float32Array}
687
+ */
688
+ origin() {
689
+ const ret = wasm.secondarypcaresult_origin(this.__wbg_ptr);
690
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
691
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
692
+ return v1;
693
+ }
694
+ /**
695
+ * @returns {Float32Array}
696
+ */
697
+ positions() {
698
+ const ret = wasm.secondarypcaresult_positions(this.__wbg_ptr);
699
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
700
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
701
+ return v1;
702
+ }
703
+ /**
704
+ * @returns {Float32Array}
705
+ */
706
+ transform() {
707
+ const ret = wasm.secondarypcaresult_transform(this.__wbg_ptr);
708
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
709
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
710
+ return v1;
711
+ }
712
+ }
713
+ if (Symbol.dispose) SecondaryPcaResult.prototype[Symbol.dispose] = SecondaryPcaResult.prototype.free;
714
+
715
+ /**
716
+ * Result of shell detection at MPT.
717
+ */
718
+ export class ShellDetectResult {
719
+ static __wrap(ptr) {
720
+ ptr = ptr >>> 0;
721
+ const obj = Object.create(ShellDetectResult.prototype);
722
+ obj.__wbg_ptr = ptr;
723
+ ShellDetectResultFinalization.register(obj, obj.__wbg_ptr, obj);
724
+ return obj;
725
+ }
726
+ __destroy_into_raw() {
727
+ const ptr = this.__wbg_ptr;
728
+ this.__wbg_ptr = 0;
729
+ ShellDetectResultFinalization.unregister(this);
730
+ return ptr;
731
+ }
732
+ free() {
733
+ const ptr = this.__destroy_into_raw();
734
+ wasm.__wbg_shelldetectresult_free(ptr, 0);
735
+ }
736
+ /**
737
+ * @returns {number}
738
+ */
739
+ avg_thickness() {
740
+ const ret = wasm.shelldetectresult_avg_thickness(this.__wbg_ptr);
741
+ return ret;
742
+ }
743
+ /**
744
+ * @returns {string}
745
+ */
746
+ details() {
747
+ let deferred1_0;
748
+ let deferred1_1;
749
+ try {
750
+ const ret = wasm.shelldetectresult_details(this.__wbg_ptr);
751
+ deferred1_0 = ret[0];
752
+ deferred1_1 = ret[1];
753
+ return getStringFromWasm0(ret[0], ret[1]);
754
+ } finally {
755
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
756
+ }
757
+ }
758
+ /**
759
+ * @returns {number}
760
+ */
761
+ double_hit_count() {
762
+ const ret = wasm.shelldetectresult_double_hit_count(this.__wbg_ptr);
763
+ return ret >>> 0;
764
+ }
765
+ /**
766
+ * @returns {Float32Array}
767
+ */
768
+ hit_points() {
769
+ const ret = wasm.shelldetectresult_hit_points(this.__wbg_ptr);
770
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
771
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
772
+ return v1;
773
+ }
774
+ /**
775
+ * @returns {Float32Array}
776
+ */
777
+ hit_ray_lines() {
778
+ const ret = wasm.shelldetectresult_hit_ray_lines(this.__wbg_ptr);
779
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
780
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
781
+ return v1;
782
+ }
783
+ /**
784
+ * @returns {boolean}
785
+ */
786
+ is_double_shell() {
787
+ const ret = wasm.shelldetectresult_is_double_shell(this.__wbg_ptr);
788
+ return ret !== 0;
789
+ }
790
+ /**
791
+ * @returns {number}
792
+ */
793
+ max_thickness() {
794
+ const ret = wasm.shelldetectresult_max_thickness(this.__wbg_ptr);
795
+ return ret;
796
+ }
797
+ /**
798
+ * @returns {number}
799
+ */
800
+ min_thickness() {
801
+ const ret = wasm.shelldetectresult_min_thickness(this.__wbg_ptr);
802
+ return ret;
803
+ }
804
+ /**
805
+ * @returns {Float32Array}
806
+ */
807
+ miss_ray_lines() {
808
+ const ret = wasm.shelldetectresult_miss_ray_lines(this.__wbg_ptr);
809
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
810
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
811
+ return v1;
812
+ }
813
+ /**
814
+ * @returns {number}
815
+ */
816
+ ray_count() {
817
+ const ret = wasm.shelldetectresult_ray_count(this.__wbg_ptr);
818
+ return ret >>> 0;
819
+ }
820
+ /**
821
+ * @returns {Float32Array}
822
+ */
823
+ surface_normal() {
824
+ const ret = wasm.shelldetectresult_surface_normal(this.__wbg_ptr);
825
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
826
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
827
+ return v1;
828
+ }
829
+ /**
830
+ * @returns {number}
831
+ */
832
+ thickness() {
833
+ const ret = wasm.shelldetectresult_thickness(this.__wbg_ptr);
834
+ return ret;
835
+ }
836
+ }
837
+ if (Symbol.dispose) ShellDetectResult.prototype[Symbol.dispose] = ShellDetectResult.prototype.free;
838
+
839
+ /**
840
+ * Result of subdividing the origin→projection line into ~1" spaced points.
841
+ */
842
+ export class SubdivideLineResult {
843
+ static __wrap(ptr) {
844
+ ptr = ptr >>> 0;
845
+ const obj = Object.create(SubdivideLineResult.prototype);
846
+ obj.__wbg_ptr = ptr;
847
+ SubdivideLineResultFinalization.register(obj, obj.__wbg_ptr, obj);
848
+ return obj;
849
+ }
850
+ __destroy_into_raw() {
851
+ const ptr = this.__wbg_ptr;
852
+ this.__wbg_ptr = 0;
853
+ SubdivideLineResultFinalization.unregister(this);
854
+ return ptr;
855
+ }
856
+ free() {
857
+ const ptr = this.__destroy_into_raw();
858
+ wasm.__wbg_subdividelineresult_free(ptr, 0);
859
+ }
860
+ /**
861
+ * @returns {number}
862
+ */
863
+ count() {
864
+ const ret = wasm.subdividelineresult_count(this.__wbg_ptr);
865
+ return ret >>> 0;
866
+ }
867
+ /**
868
+ * @returns {Float32Array}
869
+ */
870
+ points() {
871
+ const ret = wasm.subdividelineresult_points(this.__wbg_ptr);
872
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
873
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
874
+ return v1;
875
+ }
876
+ /**
877
+ * @returns {number}
878
+ */
879
+ spacing() {
880
+ const ret = wasm.subdividelineresult_spacing(this.__wbg_ptr);
881
+ return ret;
882
+ }
883
+ /**
884
+ * @returns {number}
885
+ */
886
+ total_distance() {
887
+ const ret = wasm.subdividelineresult_total_distance(this.__wbg_ptr);
888
+ return ret;
889
+ }
890
+ }
891
+ if (Symbol.dispose) SubdivideLineResult.prototype[Symbol.dispose] = SubdivideLineResult.prototype.free;
892
+
893
+ /**
894
+ * Result of detect_and_convert_units: holds positions + detection info.
895
+ */
896
+ export class UnitConversionResult {
897
+ static __wrap(ptr) {
898
+ ptr = ptr >>> 0;
899
+ const obj = Object.create(UnitConversionResult.prototype);
900
+ obj.__wbg_ptr = ptr;
901
+ UnitConversionResultFinalization.register(obj, obj.__wbg_ptr, obj);
902
+ return obj;
903
+ }
904
+ __destroy_into_raw() {
905
+ const ptr = this.__wbg_ptr;
906
+ this.__wbg_ptr = 0;
907
+ UnitConversionResultFinalization.unregister(this);
908
+ return ptr;
909
+ }
910
+ free() {
911
+ const ptr = this.__destroy_into_raw();
912
+ wasm.__wbg_unitconversionresult_free(ptr, 0);
913
+ }
914
+ /**
915
+ * @returns {boolean}
916
+ */
917
+ converted() {
918
+ const ret = wasm.unitconversionresult_converted(this.__wbg_ptr);
919
+ return ret !== 0;
920
+ }
921
+ /**
922
+ * @returns {string}
923
+ */
924
+ detected_unit() {
925
+ let deferred1_0;
926
+ let deferred1_1;
927
+ try {
928
+ const ret = wasm.unitconversionresult_detected_unit(this.__wbg_ptr);
929
+ deferred1_0 = ret[0];
930
+ deferred1_1 = ret[1];
931
+ return getStringFromWasm0(ret[0], ret[1]);
932
+ } finally {
933
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
934
+ }
935
+ }
936
+ /**
937
+ * @returns {number}
938
+ */
939
+ max_dimension() {
940
+ const ret = wasm.unitconversionresult_max_dimension(this.__wbg_ptr);
941
+ return ret;
942
+ }
943
+ /**
944
+ * @returns {Float32Array}
945
+ */
946
+ positions() {
947
+ const ret = wasm.unitconversionresult_positions(this.__wbg_ptr);
948
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
949
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
950
+ return v1;
951
+ }
952
+ }
953
+ if (Symbol.dispose) UnitConversionResult.prototype[Symbol.dispose] = UnitConversionResult.prototype.free;
954
+
955
+ /**
956
+ * Translate geometry so `origin_pt` maps to (0,0,0), then rotate so the
957
+ * vector from `origin_pt` to its projection on the cross-section plane
958
+ * aligns with the +Y axis.
959
+ *
960
+ * `positions`: flat [x,y,z,...] vertex positions
961
+ * `origin_pt`: [x,y,z] the origin point (will become 0,0,0)
962
+ * `mpt`: [x,y,z] the MPT point on the surface
963
+ * `plane_normal`: [nx,ny,nz] the cross-section plane normal
964
+ * @param {Float32Array} positions
965
+ * @param {Float32Array} origin_pt
966
+ * @param {Float32Array} mpt
967
+ * @param {Float32Array} plane_normal
968
+ * @returns {AlignResult}
969
+ */
970
+ export function align_to_origin(positions, origin_pt, mpt, plane_normal) {
971
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
972
+ const len0 = WASM_VECTOR_LEN;
973
+ const ptr1 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);
974
+ const len1 = WASM_VECTOR_LEN;
975
+ const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);
976
+ const len2 = WASM_VECTOR_LEN;
977
+ const ptr3 = passArrayF32ToWasm0(plane_normal, wasm.__wbindgen_malloc);
978
+ const len3 = WASM_VECTOR_LEN;
979
+ const ret = wasm.align_to_origin(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
980
+ return AlignResult.__wrap(ret);
981
+ }
982
+
983
+ /**
984
+ * Slice the mesh at each Y height from the given points.
985
+ *
986
+ * After PCA alignment (step 7), the mesh is Y-aligned: origin at (0,0,0),
987
+ * MPT along +Y. Cross-sections are horizontal planes (normal = Y axis)
988
+ * at each subdivision point's Y coordinate.
989
+ *
990
+ * `positions`: flat [x,y,z,...] indexed mesh positions (PCA-aligned)
991
+ * `indices`: flat [i0,i1,i2,...] triangle indices
992
+ * `y_values`: Y coordinates to slice at
993
+ * `max_gap`: maximum gap to bridge when chaining segments (mm)
994
+ * @param {Float32Array} positions
995
+ * @param {Uint32Array} indices
996
+ * @param {Float32Array} y_values
997
+ * @param {number} max_gap
998
+ * @returns {BatchCrossSectionResult}
999
+ */
1000
+ export function batch_cross_sections_y(positions, indices, y_values, max_gap) {
1001
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1002
+ const len0 = WASM_VECTOR_LEN;
1003
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1004
+ const len1 = WASM_VECTOR_LEN;
1005
+ const ptr2 = passArrayF32ToWasm0(y_values, wasm.__wbindgen_malloc);
1006
+ const len2 = WASM_VECTOR_LEN;
1007
+ const ret = wasm.batch_cross_sections_y(ptr0, len0, ptr1, len1, ptr2, len2, max_gap);
1008
+ return BatchCrossSectionResult.__wrap(ret);
1009
+ }
1010
+
1011
+ /**
1012
+ * Same as `batch_cross_sections_y` but picks the **inner** (smallest substantial)
1013
+ * loop at each height. For double-shell meshes this selects the inner wall.
1014
+ *
1015
+ * Uses a tight chaining tolerance (no gap bridging) to prevent inner+outer
1016
+ * wall segments from merging into one figure-8 loop.
1017
+ *
1018
+ * "Substantial" = circumference >= 30% of the largest loop at that height.
1019
+ * Among substantial loops, picks the one with the smallest circumference.
1020
+ * @param {Float32Array} positions
1021
+ * @param {Uint32Array} indices
1022
+ * @param {Float32Array} y_values
1023
+ * @param {number} _max_gap
1024
+ * @returns {BatchCrossSectionResult}
1025
+ */
1026
+ export function batch_cross_sections_y_inner(positions, indices, y_values, _max_gap) {
1027
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1028
+ const len0 = WASM_VECTOR_LEN;
1029
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1030
+ const len1 = WASM_VECTOR_LEN;
1031
+ const ptr2 = passArrayF32ToWasm0(y_values, wasm.__wbindgen_malloc);
1032
+ const len2 = WASM_VECTOR_LEN;
1033
+ const ret = wasm.batch_cross_sections_y_inner(ptr0, len0, ptr1, len1, ptr2, len2, _max_gap);
1034
+ return BatchCrossSectionResult.__wrap(ret);
1035
+ }
1036
+
1037
+ /**
1038
+ * Compute bounding box from a flat f32 position array [x,y,z, x,y,z, ...]
1039
+ * Returns [min_x, min_y, min_z, max_x, max_y, max_z]
1040
+ * @param {Float32Array} positions
1041
+ * @returns {Float32Array}
1042
+ */
1043
+ export function bounding_box(positions) {
1044
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1045
+ const len0 = WASM_VECTOR_LEN;
1046
+ const ret = wasm.bounding_box(ptr0, len0);
1047
+ var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1048
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1049
+ return v2;
1050
+ }
1051
+
1052
+ /**
1053
+ * Translate positions so their AABB center is at origin.
1054
+ * Takes flat [x,y,z,...], returns new flat [x,y,z,...].
1055
+ * @param {Float32Array} positions
1056
+ * @returns {Float32Array}
1057
+ */
1058
+ export function center_to_origin(positions) {
1059
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1060
+ const len0 = WASM_VECTOR_LEN;
1061
+ const ret = wasm.center_to_origin(ptr0, len0);
1062
+ var v2 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
1063
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1064
+ return v2;
1065
+ }
1066
+
1067
+ /**
1068
+ * Detect if positions are in meters or millimeters based on bounding box size.
1069
+ * If max AABB dimension < `meter_threshold` (default: 10), assumes meters and scales to mm (*1000).
1070
+ * Otherwise assumes already in mm and passes through.
1071
+ * @param {Float32Array} positions
1072
+ * @param {number} meter_threshold
1073
+ * @returns {UnitConversionResult}
1074
+ */
1075
+ export function detect_and_convert_units(positions, meter_threshold) {
1076
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1077
+ const len0 = WASM_VECTOR_LEN;
1078
+ const ret = wasm.detect_and_convert_units(ptr0, len0, meter_threshold);
1079
+ return UnitConversionResult.__wrap(ret);
1080
+ }
1081
+
1082
+ /**
1083
+ * Detect if the surface at `mpt` is single or double shell.
1084
+ *
1085
+ * Strategy: compute the surface normal at `mpt` (from the closest triangle),
1086
+ * then cast rays in a cone of directions around that normal (both sides).
1087
+ * For each ray, count surface intersections. If we consistently find pairs
1088
+ * of hits with small gaps, it's a double shell.
1089
+ *
1090
+ * `positions`: flat [x,y,z,...] indexed geometry positions
1091
+ * `indices`: flat [i0,i1,i2,...] triangle indices
1092
+ * `mpt`: [x,y,z] the MPT point on the surface
1093
+ * `max_thickness`: maximum expected wall thickness — hits farther than this are ignored
1094
+ * @param {Float32Array} positions
1095
+ * @param {Uint32Array} indices
1096
+ * @param {Float32Array} mpt
1097
+ * @param {number} max_thickness
1098
+ * @returns {ShellDetectResult}
1099
+ */
1100
+ export function detect_shell(positions, indices, mpt, max_thickness) {
1101
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1102
+ const len0 = WASM_VECTOR_LEN;
1103
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1104
+ const len1 = WASM_VECTOR_LEN;
1105
+ const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);
1106
+ const len2 = WASM_VECTOR_LEN;
1107
+ const ret = wasm.detect_shell(ptr0, len0, ptr1, len1, ptr2, len2, max_thickness);
1108
+ return ShellDetectResult.__wrap(ret);
1109
+ }
1110
+
1111
+ /**
1112
+ * Step 5a: Extract the inner shell from a double-walled mesh.
1113
+ *
1114
+ * Strategy: multi-point face-visibility.
1115
+ * 1. Use `hit_points` (outer wall hits from detect_shell) to compute the cavity
1116
+ * direction: vector from mean-outer-hit toward MPT = inward = cavity direction.
1117
+ * 2. Generate a cluster of probe points at multiple depths inside the cavity,
1118
+ * spread laterally for concave-socket robustness.
1119
+ * 3. For every triangle, cast a ray from each probe toward the face centroid;
1120
+ * if the FIRST hit is that triangle from ANY probe → inner shell.
1121
+ *
1122
+ * `mpt`: user-placed point on the inner surface
1123
+ * `wall_thickness`: median wall thickness from detect_shell
1124
+ * `hit_points`: outer-wall hit points from detect_shell [x,y,z,...] (may be empty)
1125
+ * @param {Float32Array} positions
1126
+ * @param {Uint32Array} indices
1127
+ * @param {Float32Array} mpt
1128
+ * @param {number} wall_thickness
1129
+ * @param {Float32Array} hit_points
1130
+ * @returns {ExtractInnerShellResult}
1131
+ */
1132
+ export function extract_inner_shell(positions, indices, mpt, wall_thickness, hit_points) {
1133
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1134
+ const len0 = WASM_VECTOR_LEN;
1135
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1136
+ const len1 = WASM_VECTOR_LEN;
1137
+ const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);
1138
+ const len2 = WASM_VECTOR_LEN;
1139
+ const ptr3 = passArrayF32ToWasm0(hit_points, wasm.__wbindgen_malloc);
1140
+ const len3 = WASM_VECTOR_LEN;
1141
+ const ret = wasm.extract_inner_shell(ptr0, len0, ptr1, len1, ptr2, len2, wall_thickness, ptr3, len3);
1142
+ return ExtractInnerShellResult.__wrap(ret);
1143
+ }
1144
+
1145
+ /**
1146
+ * Find and fill small boundary holes in an indexed mesh.
1147
+ *
1148
+ * A "hole" is a closed boundary loop of edges that each appear in exactly one triangle.
1149
+ * Loops whose total perimeter is < `max_perimeter` are filled via fan triangulation
1150
+ * from the loop centroid.
1151
+ *
1152
+ * `positions`: flat [x,y,z,...] vertex positions
1153
+ * `indices`: flat [i0,i1,i2,...] triangle indices
1154
+ * `max_perimeter`: maximum hole perimeter in mm to close (e.g. 40.0)
1155
+ * @param {Float32Array} positions
1156
+ * @param {Uint32Array} indices
1157
+ * @param {number} max_perimeter
1158
+ * @returns {FillHolesResult}
1159
+ */
1160
+ export function fill_small_holes(positions, indices, max_perimeter) {
1161
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1162
+ const len0 = WASM_VECTOR_LEN;
1163
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1164
+ const len1 = WASM_VECTOR_LEN;
1165
+ const ret = wasm.fill_small_holes(ptr0, len0, ptr1, len1, max_perimeter);
1166
+ return FillHolesResult.__wrap(ret);
1167
+ }
1168
+
1169
+ /**
1170
+ * Find the cross-section plane through `mpt` that gives the smallest circumference.
1171
+ *
1172
+ * Strategy:
1173
+ * 1. Build rotation axes: the surface normal + 8 perturbed axes (±5° tilts)
1174
+ * 2. For each axis, coarse scan 90 plane orientations (2° steps)
1175
+ * 3. Refine: ±2° around best at 0.1° steps
1176
+ * 4. Score loops by circumference × closedness × proximity to MPT
1177
+ *
1178
+ * `positions`: flat [x,y,z,...] indexed geometry positions
1179
+ * `indices`: flat [i0,i1,i2,...] triangle indices
1180
+ * `mpt`: [x,y,z] the MPT point on the surface
1181
+ * `surface_normal`: [nx,ny,nz] surface normal at MPT
1182
+ * `max_gap`: maximum gap to bridge when chaining segments into loops (mm)
1183
+ * @param {Float32Array} positions
1184
+ * @param {Uint32Array} indices
1185
+ * @param {Float32Array} mpt
1186
+ * @param {Float32Array} surface_normal
1187
+ * @param {number} max_gap
1188
+ * @returns {CrossSectionResult}
1189
+ */
1190
+ export function find_min_cross_section(positions, indices, mpt, surface_normal, max_gap) {
1191
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1192
+ const len0 = WASM_VECTOR_LEN;
1193
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1194
+ const len1 = WASM_VECTOR_LEN;
1195
+ const ptr2 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);
1196
+ const len2 = WASM_VECTOR_LEN;
1197
+ const ptr3 = passArrayF32ToWasm0(surface_normal, wasm.__wbindgen_malloc);
1198
+ const len3 = WASM_VECTOR_LEN;
1199
+ const ret = wasm.find_min_cross_section(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, max_gap);
1200
+ return CrossSectionResult.__wrap(ret);
1201
+ }
1202
+
1203
+ /**
1204
+ * Initialize panic hook for better WASM error messages in the browser console.
1205
+ * Called automatically on WASM module init.
1206
+ */
1207
+ export function init() {
1208
+ wasm.init();
1209
+ }
1210
+
1211
+ /**
1212
+ * Stage 1: preprocess a raw mesh in one shot.
1213
+ *
1214
+ * Accepts raw geometry (positions + optional indices) and runs all four
1215
+ * automatic preprocessing steps without crossing the WASM boundary in between.
1216
+ *
1217
+ * **Parameters**
1218
+ * - `positions`: flat `[x,y,z, …]` vertex positions
1219
+ * - `indices`: flat `[i0,i1,i2, …]` triangle indices (pass empty array for non-indexed)
1220
+ * - `meter_threshold`: max AABB dimension (in model units) below which the
1221
+ * geometry is assumed to be in meters and scaled ×1000 to mm (default: `10.0`)
1222
+ * - `weld_tolerance`: distance within which vertices are merged (default: `1e-4`)
1223
+ * - `max_hole_perimeter`: boundary loops shorter than this (mm) are fan-filled (default: `300.0`)
1224
+ * @param {Float32Array} positions
1225
+ * @param {Uint32Array} indices
1226
+ * @param {number} meter_threshold
1227
+ * @param {number} weld_tolerance
1228
+ * @param {number} max_hole_perimeter
1229
+ * @returns {PreprocessResult}
1230
+ */
1231
+ export function preprocess_mesh(positions, indices, meter_threshold, weld_tolerance, max_hole_perimeter) {
1232
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1233
+ const len0 = WASM_VECTOR_LEN;
1234
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1235
+ const len1 = WASM_VECTOR_LEN;
1236
+ const ret = wasm.preprocess_mesh(ptr0, len0, ptr1, len1, meter_threshold, weld_tolerance, max_hole_perimeter);
1237
+ return PreprocessResult.__wrap(ret);
1238
+ }
1239
+
1240
+ /**
1241
+ * Build a BVH from flat triangle positions and ray-cast against it.
1242
+ * `positions`: flat [x,y,z, ...] with every 9 floats = 1 triangle
1243
+ * `ray_origin`: [ox, oy, oz]
1244
+ * `ray_dir`: [dx, dy, dz]
1245
+ * Returns indices of triangles whose AABBs the ray intersects.
1246
+ * @param {Float32Array} positions
1247
+ * @param {Float32Array} ray_origin
1248
+ * @param {Float32Array} ray_dir
1249
+ * @returns {Uint32Array}
1250
+ */
1251
+ export function ray_cast_bvh(positions, ray_origin, ray_dir) {
1252
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1253
+ const len0 = WASM_VECTOR_LEN;
1254
+ const ptr1 = passArrayF32ToWasm0(ray_origin, wasm.__wbindgen_malloc);
1255
+ const len1 = WASM_VECTOR_LEN;
1256
+ const ptr2 = passArrayF32ToWasm0(ray_dir, wasm.__wbindgen_malloc);
1257
+ const len2 = WASM_VECTOR_LEN;
1258
+ const ret = wasm.ray_cast_bvh(ptr0, len0, ptr1, len1, ptr2, len2);
1259
+ var v4 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1260
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1261
+ return v4;
1262
+ }
1263
+
1264
+ /**
1265
+ * Step 9: Refine alignment using cross-section centroids.
1266
+ *
1267
+ * Computes PCA on the centroids of cross-section loops to find the "true"
1268
+ * limb axis, then rotates the mesh so this axis aligns with +Y.
1269
+ *
1270
+ * `centroids`: flat [x,y,z,...] centroid of each cross-section loop
1271
+ * `all_positions`: flat [x,y,z,...] full mesh positions
1272
+ * `origin_pt`: [x,y,z]
1273
+ * `mpt`: [x,y,z]
1274
+ * @param {Float32Array} centroids
1275
+ * @param {Float32Array} all_positions
1276
+ * @param {Float32Array} origin_pt
1277
+ * @param {Float32Array} mpt
1278
+ * @returns {RefineAlignmentResult}
1279
+ */
1280
+ export function refine_alignment(centroids, all_positions, origin_pt, mpt) {
1281
+ const ptr0 = passArrayF32ToWasm0(centroids, wasm.__wbindgen_malloc);
1282
+ const len0 = WASM_VECTOR_LEN;
1283
+ const ptr1 = passArrayF32ToWasm0(all_positions, wasm.__wbindgen_malloc);
1284
+ const len1 = WASM_VECTOR_LEN;
1285
+ const ptr2 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);
1286
+ const len2 = WASM_VECTOR_LEN;
1287
+ const ptr3 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);
1288
+ const len3 = WASM_VECTOR_LEN;
1289
+ const ret = wasm.refine_alignment(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1290
+ return RefineAlignmentResult.__wrap(ret);
1291
+ }
1292
+
1293
+ /**
1294
+ * Compute PCA on `selected_positions` (the region of interest),
1295
+ * then apply the resulting rotation to `all_positions` (full mesh).
1296
+ *
1297
+ * The principal axis (longest variance) aligns with +Y.
1298
+ * Ensures `origin_pt.y < mpt.y` after rotation (origin below MPT).
1299
+ *
1300
+ * `selected_positions`: flat [x,y,z,...] of selected region vertices
1301
+ * `all_positions`: flat [x,y,z,...] of full mesh
1302
+ * `origin_pt`: [x,y,z]
1303
+ * `mpt`: [x,y,z]
1304
+ * @param {Float32Array} selected_positions
1305
+ * @param {Float32Array} all_positions
1306
+ * @param {Float32Array} origin_pt
1307
+ * @param {Float32Array} mpt
1308
+ * @returns {SecondaryPcaResult}
1309
+ */
1310
+ export function secondary_pca(selected_positions, all_positions, origin_pt, mpt) {
1311
+ const ptr0 = passArrayF32ToWasm0(selected_positions, wasm.__wbindgen_malloc);
1312
+ const len0 = WASM_VECTOR_LEN;
1313
+ const ptr1 = passArrayF32ToWasm0(all_positions, wasm.__wbindgen_malloc);
1314
+ const len1 = WASM_VECTOR_LEN;
1315
+ const ptr2 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);
1316
+ const len2 = WASM_VECTOR_LEN;
1317
+ const ptr3 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);
1318
+ const len3 = WASM_VECTOR_LEN;
1319
+ const ret = wasm.secondary_pca(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
1320
+ return SecondaryPcaResult.__wrap(ret);
1321
+ }
1322
+
1323
+ /**
1324
+ * Step 8: Subdivide the line from `origin_pt` to its projection onto the
1325
+ * cross-section plane into points spaced roughly 1 inch (25.4 mm) apart.
1326
+ *
1327
+ * `origin_pt`: [x,y,z] the origin point
1328
+ * `mpt`: [x,y,z] a point on the cross-section plane
1329
+ * `plane_normal`: [nx,ny,nz] the cross-section plane normal
1330
+ *
1331
+ * Returns the series of evenly-spaced points along the line (both endpoints included).
1332
+ * @param {Float32Array} origin_pt
1333
+ * @param {Float32Array} mpt
1334
+ * @param {Float32Array} plane_normal
1335
+ * @returns {SubdivideLineResult}
1336
+ */
1337
+ export function subdivide_origin_to_plane(origin_pt, mpt, plane_normal) {
1338
+ const ptr0 = passArrayF32ToWasm0(origin_pt, wasm.__wbindgen_malloc);
1339
+ const len0 = WASM_VECTOR_LEN;
1340
+ const ptr1 = passArrayF32ToWasm0(mpt, wasm.__wbindgen_malloc);
1341
+ const len1 = WASM_VECTOR_LEN;
1342
+ const ptr2 = passArrayF32ToWasm0(plane_normal, wasm.__wbindgen_malloc);
1343
+ const len2 = WASM_VECTOR_LEN;
1344
+ const ret = wasm.subdivide_origin_to_plane(ptr0, len0, ptr1, len1, ptr2, len2);
1345
+ return SubdivideLineResult.__wrap(ret);
1346
+ }
1347
+
1348
+ /**
1349
+ * Weld close vertices, find connected components, keep only the largest mesh.
1350
+ *
1351
+ * `positions`: flat [x,y,z,...] — non-indexed (every 9 floats = 1 triangle)
1352
+ * `tolerance`: distance within which vertices are merged
1353
+ *
1354
+ * For indexed input, use `weld_and_keep_largest_indexed`.
1355
+ * @param {Float32Array} positions
1356
+ * @param {number} tolerance
1357
+ * @returns {MeshResult}
1358
+ */
1359
+ export function weld_and_keep_largest(positions, tolerance) {
1360
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1361
+ const len0 = WASM_VECTOR_LEN;
1362
+ const ret = wasm.weld_and_keep_largest(ptr0, len0, tolerance);
1363
+ return MeshResult.__wrap(ret);
1364
+ }
1365
+
1366
+ /**
1367
+ * Same as above but for indexed geometry.
1368
+ * `positions`: flat [x,y,z,...]
1369
+ * `indices`: flat [i0,i1,i2, ...] triangle indices
1370
+ * `tolerance`: weld distance
1371
+ * @param {Float32Array} positions
1372
+ * @param {Uint32Array} indices
1373
+ * @param {number} tolerance
1374
+ * @returns {MeshResult}
1375
+ */
1376
+ export function weld_and_keep_largest_indexed(positions, indices, tolerance) {
1377
+ const ptr0 = passArrayF32ToWasm0(positions, wasm.__wbindgen_malloc);
1378
+ const len0 = WASM_VECTOR_LEN;
1379
+ const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
1380
+ const len1 = WASM_VECTOR_LEN;
1381
+ const ret = wasm.weld_and_keep_largest_indexed(ptr0, len0, ptr1, len1, tolerance);
1382
+ return MeshResult.__wrap(ret);
1383
+ }
1384
+
1385
+ function __wbg_get_imports() {
1386
+ const import0 = {
1387
+ __proto__: null,
1388
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
1389
+ throw new Error(getStringFromWasm0(arg0, arg1));
1390
+ },
1391
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
1392
+ let deferred0_0;
1393
+ let deferred0_1;
1394
+ try {
1395
+ deferred0_0 = arg0;
1396
+ deferred0_1 = arg1;
1397
+ console.error(getStringFromWasm0(arg0, arg1));
1398
+ } finally {
1399
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1400
+ }
1401
+ },
1402
+ __wbg_new_227d7c05414eb861: function() {
1403
+ const ret = new Error();
1404
+ return ret;
1405
+ },
1406
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1407
+ const ret = arg1.stack;
1408
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1409
+ const len1 = WASM_VECTOR_LEN;
1410
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1411
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1412
+ },
1413
+ __wbindgen_init_externref_table: function() {
1414
+ const table = wasm.__wbindgen_externrefs;
1415
+ const offset = table.grow(4);
1416
+ table.set(0, undefined);
1417
+ table.set(offset + 0, undefined);
1418
+ table.set(offset + 1, null);
1419
+ table.set(offset + 2, true);
1420
+ table.set(offset + 3, false);
1421
+ },
1422
+ };
1423
+ return {
1424
+ __proto__: null,
1425
+ "./geo_wasm_bg.js": import0,
1426
+ };
1427
+ }
1428
+
1429
+ const AlignResultFinalization = (typeof FinalizationRegistry === 'undefined')
1430
+ ? { register: () => {}, unregister: () => {} }
1431
+ : new FinalizationRegistry(ptr => wasm.__wbg_alignresult_free(ptr >>> 0, 1));
1432
+ const BatchCrossSectionResultFinalization = (typeof FinalizationRegistry === 'undefined')
1433
+ ? { register: () => {}, unregister: () => {} }
1434
+ : new FinalizationRegistry(ptr => wasm.__wbg_batchcrosssectionresult_free(ptr >>> 0, 1));
1435
+ const CrossSectionResultFinalization = (typeof FinalizationRegistry === 'undefined')
1436
+ ? { register: () => {}, unregister: () => {} }
1437
+ : new FinalizationRegistry(ptr => wasm.__wbg_crosssectionresult_free(ptr >>> 0, 1));
1438
+ const ExtractInnerShellResultFinalization = (typeof FinalizationRegistry === 'undefined')
1439
+ ? { register: () => {}, unregister: () => {} }
1440
+ : new FinalizationRegistry(ptr => wasm.__wbg_extractinnershellresult_free(ptr >>> 0, 1));
1441
+ const FillHolesResultFinalization = (typeof FinalizationRegistry === 'undefined')
1442
+ ? { register: () => {}, unregister: () => {} }
1443
+ : new FinalizationRegistry(ptr => wasm.__wbg_fillholesresult_free(ptr >>> 0, 1));
1444
+ const MeshResultFinalization = (typeof FinalizationRegistry === 'undefined')
1445
+ ? { register: () => {}, unregister: () => {} }
1446
+ : new FinalizationRegistry(ptr => wasm.__wbg_meshresult_free(ptr >>> 0, 1));
1447
+ const PreprocessResultFinalization = (typeof FinalizationRegistry === 'undefined')
1448
+ ? { register: () => {}, unregister: () => {} }
1449
+ : new FinalizationRegistry(ptr => wasm.__wbg_preprocessresult_free(ptr >>> 0, 1));
1450
+ const RefineAlignmentResultFinalization = (typeof FinalizationRegistry === 'undefined')
1451
+ ? { register: () => {}, unregister: () => {} }
1452
+ : new FinalizationRegistry(ptr => wasm.__wbg_refinealignmentresult_free(ptr >>> 0, 1));
1453
+ const SecondaryPcaResultFinalization = (typeof FinalizationRegistry === 'undefined')
1454
+ ? { register: () => {}, unregister: () => {} }
1455
+ : new FinalizationRegistry(ptr => wasm.__wbg_secondarypcaresult_free(ptr >>> 0, 1));
1456
+ const ShellDetectResultFinalization = (typeof FinalizationRegistry === 'undefined')
1457
+ ? { register: () => {}, unregister: () => {} }
1458
+ : new FinalizationRegistry(ptr => wasm.__wbg_shelldetectresult_free(ptr >>> 0, 1));
1459
+ const SubdivideLineResultFinalization = (typeof FinalizationRegistry === 'undefined')
1460
+ ? { register: () => {}, unregister: () => {} }
1461
+ : new FinalizationRegistry(ptr => wasm.__wbg_subdividelineresult_free(ptr >>> 0, 1));
1462
+ const UnitConversionResultFinalization = (typeof FinalizationRegistry === 'undefined')
1463
+ ? { register: () => {}, unregister: () => {} }
1464
+ : new FinalizationRegistry(ptr => wasm.__wbg_unitconversionresult_free(ptr >>> 0, 1));
1465
+
1466
+ function getArrayF32FromWasm0(ptr, len) {
1467
+ ptr = ptr >>> 0;
1468
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1469
+ }
1470
+
1471
+ function getArrayU32FromWasm0(ptr, len) {
1472
+ ptr = ptr >>> 0;
1473
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1474
+ }
1475
+
1476
+ let cachedDataViewMemory0 = null;
1477
+ function getDataViewMemory0() {
1478
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1479
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1480
+ }
1481
+ return cachedDataViewMemory0;
1482
+ }
1483
+
1484
+ let cachedFloat32ArrayMemory0 = null;
1485
+ function getFloat32ArrayMemory0() {
1486
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
1487
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
1488
+ }
1489
+ return cachedFloat32ArrayMemory0;
1490
+ }
1491
+
1492
+ function getStringFromWasm0(ptr, len) {
1493
+ ptr = ptr >>> 0;
1494
+ return decodeText(ptr, len);
1495
+ }
1496
+
1497
+ let cachedUint32ArrayMemory0 = null;
1498
+ function getUint32ArrayMemory0() {
1499
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1500
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1501
+ }
1502
+ return cachedUint32ArrayMemory0;
1503
+ }
1504
+
1505
+ let cachedUint8ArrayMemory0 = null;
1506
+ function getUint8ArrayMemory0() {
1507
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1508
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1509
+ }
1510
+ return cachedUint8ArrayMemory0;
1511
+ }
1512
+
1513
+ function passArray32ToWasm0(arg, malloc) {
1514
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1515
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1516
+ WASM_VECTOR_LEN = arg.length;
1517
+ return ptr;
1518
+ }
1519
+
1520
+ function passArrayF32ToWasm0(arg, malloc) {
1521
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1522
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
1523
+ WASM_VECTOR_LEN = arg.length;
1524
+ return ptr;
1525
+ }
1526
+
1527
+ function passStringToWasm0(arg, malloc, realloc) {
1528
+ if (realloc === undefined) {
1529
+ const buf = cachedTextEncoder.encode(arg);
1530
+ const ptr = malloc(buf.length, 1) >>> 0;
1531
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1532
+ WASM_VECTOR_LEN = buf.length;
1533
+ return ptr;
1534
+ }
1535
+
1536
+ let len = arg.length;
1537
+ let ptr = malloc(len, 1) >>> 0;
1538
+
1539
+ const mem = getUint8ArrayMemory0();
1540
+
1541
+ let offset = 0;
1542
+
1543
+ for (; offset < len; offset++) {
1544
+ const code = arg.charCodeAt(offset);
1545
+ if (code > 0x7F) break;
1546
+ mem[ptr + offset] = code;
1547
+ }
1548
+ if (offset !== len) {
1549
+ if (offset !== 0) {
1550
+ arg = arg.slice(offset);
1551
+ }
1552
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1553
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1554
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1555
+
1556
+ offset += ret.written;
1557
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1558
+ }
1559
+
1560
+ WASM_VECTOR_LEN = offset;
1561
+ return ptr;
1562
+ }
1563
+
1564
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1565
+ cachedTextDecoder.decode();
1566
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1567
+ let numBytesDecoded = 0;
1568
+ function decodeText(ptr, len) {
1569
+ numBytesDecoded += len;
1570
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1571
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1572
+ cachedTextDecoder.decode();
1573
+ numBytesDecoded = len;
1574
+ }
1575
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1576
+ }
1577
+
1578
+ const cachedTextEncoder = new TextEncoder();
1579
+
1580
+ if (!('encodeInto' in cachedTextEncoder)) {
1581
+ cachedTextEncoder.encodeInto = function (arg, view) {
1582
+ const buf = cachedTextEncoder.encode(arg);
1583
+ view.set(buf);
1584
+ return {
1585
+ read: arg.length,
1586
+ written: buf.length
1587
+ };
1588
+ };
1589
+ }
1590
+
1591
+ let WASM_VECTOR_LEN = 0;
1592
+
1593
+ let wasmModule, wasm;
1594
+ function __wbg_finalize_init(instance, module) {
1595
+ wasm = instance.exports;
1596
+ wasmModule = module;
1597
+ cachedDataViewMemory0 = null;
1598
+ cachedFloat32ArrayMemory0 = null;
1599
+ cachedUint32ArrayMemory0 = null;
1600
+ cachedUint8ArrayMemory0 = null;
1601
+ wasm.__wbindgen_start();
1602
+ return wasm;
1603
+ }
1604
+
1605
+ async function __wbg_load(module, imports) {
1606
+ if (typeof Response === 'function' && module instanceof Response) {
1607
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1608
+ try {
1609
+ return await WebAssembly.instantiateStreaming(module, imports);
1610
+ } catch (e) {
1611
+ const validResponse = module.ok && expectedResponseType(module.type);
1612
+
1613
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1614
+ 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);
1615
+
1616
+ } else { throw e; }
1617
+ }
1618
+ }
1619
+
1620
+ const bytes = await module.arrayBuffer();
1621
+ return await WebAssembly.instantiate(bytes, imports);
1622
+ } else {
1623
+ const instance = await WebAssembly.instantiate(module, imports);
1624
+
1625
+ if (instance instanceof WebAssembly.Instance) {
1626
+ return { instance, module };
1627
+ } else {
1628
+ return instance;
1629
+ }
1630
+ }
1631
+
1632
+ function expectedResponseType(type) {
1633
+ switch (type) {
1634
+ case 'basic': case 'cors': case 'default': return true;
1635
+ }
1636
+ return false;
1637
+ }
1638
+ }
1639
+
1640
+ function initSync(module) {
1641
+ if (wasm !== undefined) return wasm;
1642
+
1643
+
1644
+ if (module !== undefined) {
1645
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1646
+ ({module} = module)
1647
+ } else {
1648
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1649
+ }
1650
+ }
1651
+
1652
+ const imports = __wbg_get_imports();
1653
+ if (!(module instanceof WebAssembly.Module)) {
1654
+ module = new WebAssembly.Module(module);
1655
+ }
1656
+ const instance = new WebAssembly.Instance(module, imports);
1657
+ return __wbg_finalize_init(instance, module);
1658
+ }
1659
+
1660
+ async function __wbg_init(module_or_path) {
1661
+ if (wasm !== undefined) return wasm;
1662
+
1663
+
1664
+ if (module_or_path !== undefined) {
1665
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1666
+ ({module_or_path} = module_or_path)
1667
+ } else {
1668
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1669
+ }
1670
+ }
1671
+
1672
+ if (module_or_path === undefined) {
1673
+ module_or_path = new URL('geo_wasm_bg.wasm', import.meta.url);
1674
+ }
1675
+ const imports = __wbg_get_imports();
1676
+
1677
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1678
+ module_or_path = fetch(module_or_path);
1679
+ }
1680
+
1681
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1682
+
1683
+ return __wbg_finalize_init(instance, module);
1684
+ }
1685
+
1686
+ export { initSync, __wbg_init as default };