geo-polygonize 0.8.1 → 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.
@@ -1,5 +1,70 @@
1
1
  let wasm$1;
2
2
 
3
+ function debugString$1(val) {
4
+ // primitive types
5
+ const type = typeof val;
6
+ if (type == 'number' || type == 'boolean' || val == null) {
7
+ return `${val}`;
8
+ }
9
+ if (type == 'string') {
10
+ return `"${val}"`;
11
+ }
12
+ if (type == 'symbol') {
13
+ const description = val.description;
14
+ if (description == null) {
15
+ return 'Symbol';
16
+ } else {
17
+ return `Symbol(${description})`;
18
+ }
19
+ }
20
+ if (type == 'function') {
21
+ const name = val.name;
22
+ if (typeof name == 'string' && name.length > 0) {
23
+ return `Function(${name})`;
24
+ } else {
25
+ return 'Function';
26
+ }
27
+ }
28
+ // objects
29
+ if (Array.isArray(val)) {
30
+ const length = val.length;
31
+ let debug = '[';
32
+ if (length > 0) {
33
+ debug += debugString$1(val[0]);
34
+ }
35
+ for(let i = 1; i < length; i++) {
36
+ debug += ', ' + debugString$1(val[i]);
37
+ }
38
+ debug += ']';
39
+ return debug;
40
+ }
41
+ // Test for built-in
42
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
43
+ let className;
44
+ if (builtInMatches && builtInMatches.length > 1) {
45
+ className = builtInMatches[1];
46
+ } else {
47
+ // Failed to match the standard '[object ClassName]'
48
+ return toString.call(val);
49
+ }
50
+ if (className == 'Object') {
51
+ // we're a user defined class or Object
52
+ // JSON.stringify avoids problems with cycles, and is generally much
53
+ // easier than looping through ownProperties of `val`.
54
+ try {
55
+ return 'Object(' + JSON.stringify(val) + ')';
56
+ } catch (_) {
57
+ return 'Object';
58
+ }
59
+ }
60
+ // errors
61
+ if (val instanceof Error) {
62
+ return `${val.name}: ${val.message}\n${val.stack}`;
63
+ }
64
+ // TODO we could test for more things here, like `Set`s and `Map`s.
65
+ return className;
66
+ }
67
+
3
68
  function getArrayU8FromWasm0$1(ptr, len) {
4
69
  ptr = ptr >>> 0;
5
70
  return getUint8ArrayMemory0$1().subarray(ptr / 1, ptr / 1 + len);
@@ -139,10 +204,79 @@ if (!('encodeInto' in cachedTextEncoder$1)) {
139
204
 
140
205
  let WASM_VECTOR_LEN$1 = 0;
141
206
 
207
+ const PolygonizerWasmErrorFinalization$1 = (typeof FinalizationRegistry === 'undefined')
208
+ ? { register: () => {}, unregister: () => {} }
209
+ : new FinalizationRegistry(ptr => wasm$1.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
210
+
142
211
  const WasmPolygonResultFinalization$1 = (typeof FinalizationRegistry === 'undefined')
143
212
  ? { register: () => {}, unregister: () => {} }
144
213
  : new FinalizationRegistry(ptr => wasm$1.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
145
214
 
215
+ let PolygonizerWasmError$1 = class PolygonizerWasmError {
216
+ static __wrap(ptr) {
217
+ ptr = ptr >>> 0;
218
+ const obj = Object.create(PolygonizerWasmError.prototype);
219
+ obj.__wbg_ptr = ptr;
220
+ PolygonizerWasmErrorFinalization$1.register(obj, obj.__wbg_ptr, obj);
221
+ return obj;
222
+ }
223
+ __destroy_into_raw() {
224
+ const ptr = this.__wbg_ptr;
225
+ this.__wbg_ptr = 0;
226
+ PolygonizerWasmErrorFinalization$1.unregister(this);
227
+ return ptr;
228
+ }
229
+ free() {
230
+ const ptr = this.__destroy_into_raw();
231
+ wasm$1.__wbg_polygonizerwasmerror_free(ptr, 0);
232
+ }
233
+ /**
234
+ * @param {string} name
235
+ * @param {string} message
236
+ */
237
+ constructor(name, message) {
238
+ const ptr0 = passStringToWasm0$1(name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
239
+ const len0 = WASM_VECTOR_LEN$1;
240
+ const ptr1 = passStringToWasm0$1(message, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
241
+ const len1 = WASM_VECTOR_LEN$1;
242
+ const ret = wasm$1.polygonizerwasmerror_new(ptr0, len0, ptr1, len1);
243
+ this.__wbg_ptr = ret >>> 0;
244
+ PolygonizerWasmErrorFinalization$1.register(this, this.__wbg_ptr, this);
245
+ return this;
246
+ }
247
+ /**
248
+ * @returns {string}
249
+ */
250
+ get name() {
251
+ let deferred1_0;
252
+ let deferred1_1;
253
+ try {
254
+ const ret = wasm$1.polygonizerwasmerror_name(this.__wbg_ptr);
255
+ deferred1_0 = ret[0];
256
+ deferred1_1 = ret[1];
257
+ return getStringFromWasm0$1(ret[0], ret[1]);
258
+ } finally {
259
+ wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
260
+ }
261
+ }
262
+ /**
263
+ * @returns {string}
264
+ */
265
+ get message() {
266
+ let deferred1_0;
267
+ let deferred1_1;
268
+ try {
269
+ const ret = wasm$1.polygonizerwasmerror_message(this.__wbg_ptr);
270
+ deferred1_0 = ret[0];
271
+ deferred1_1 = ret[1];
272
+ return getStringFromWasm0$1(ret[0], ret[1]);
273
+ } finally {
274
+ wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
275
+ }
276
+ }
277
+ };
278
+ if (Symbol.dispose) PolygonizerWasmError$1.prototype[Symbol.dispose] = PolygonizerWasmError$1.prototype.free;
279
+
146
280
  let WasmPolygonResult$1 = class WasmPolygonResult {
147
281
  static __wrap(ptr) {
148
282
  ptr = ptr >>> 0;
@@ -218,15 +352,42 @@ if (Symbol.dispose) WasmPolygonResult$1.prototype[Symbol.dispose] = WasmPolygonR
218
352
  * @param {boolean | null} [node_input]
219
353
  * @param {number | null} [snap_grid_size]
220
354
  * @param {boolean | null} [extract_only_polygonal]
355
+ * @param {boolean | null} [report_mode]
356
+ * @returns {string}
357
+ */
358
+ function polygonize$1(geojson_str, node_input, snap_grid_size, extract_only_polygonal, report_mode) {
359
+ let deferred3_0;
360
+ let deferred3_1;
361
+ try {
362
+ const ptr0 = passStringToWasm0$1(geojson_str, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
363
+ const len0 = WASM_VECTOR_LEN$1;
364
+ const ret = wasm$1.polygonize(ptr0, len0, isLikeNone$1(node_input) ? 0xFFFFFF : node_input ? 1 : 0, !isLikeNone$1(snap_grid_size), isLikeNone$1(snap_grid_size) ? 0 : snap_grid_size, isLikeNone$1(extract_only_polygonal) ? 0xFFFFFF : extract_only_polygonal ? 1 : 0, isLikeNone$1(report_mode) ? 0xFFFFFF : report_mode ? 1 : 0);
365
+ var ptr2 = ret[0];
366
+ var len2 = ret[1];
367
+ if (ret[3]) {
368
+ ptr2 = 0; len2 = 0;
369
+ throw takeFromExternrefTable0$1(ret[2]);
370
+ }
371
+ deferred3_0 = ptr2;
372
+ deferred3_1 = len2;
373
+ return getStringFromWasm0$1(ptr2, len2);
374
+ } finally {
375
+ wasm$1.__wbindgen_free(deferred3_0, deferred3_1, 1);
376
+ }
377
+ }
378
+
379
+ /**
380
+ * @param {string} geojson_str
381
+ * @param {any} options_val
221
382
  * @returns {string}
222
383
  */
223
- function polygonize$1(geojson_str, node_input, snap_grid_size, extract_only_polygonal) {
384
+ function polygonizeWithOptions$1(geojson_str, options_val) {
224
385
  let deferred3_0;
225
386
  let deferred3_1;
226
387
  try {
227
388
  const ptr0 = passStringToWasm0$1(geojson_str, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
228
389
  const len0 = WASM_VECTOR_LEN$1;
229
- const ret = wasm$1.polygonize(ptr0, len0, isLikeNone$1(node_input) ? 0xFFFFFF : node_input ? 1 : 0, !isLikeNone$1(snap_grid_size), isLikeNone$1(snap_grid_size) ? 0 : snap_grid_size, isLikeNone$1(extract_only_polygonal) ? 0xFFFFFF : extract_only_polygonal ? 1 : 0);
390
+ const ret = wasm$1.polygonizeWithOptions(ptr0, len0, options_val);
230
391
  var ptr2 = ret[0];
231
392
  var len2 = ret[1];
232
393
  if (ret[3]) {
@@ -241,6 +402,25 @@ function polygonize$1(geojson_str, node_input, snap_grid_size, extract_only_poly
241
402
  }
242
403
  }
243
404
 
405
+ /**
406
+ * @param {Float64Array} coords
407
+ * @param {Uint32Array} offsets
408
+ * @param {number} stride
409
+ * @param {any} options_val
410
+ * @returns {WasmPolygonResult}
411
+ */
412
+ function polygonizeWithOptionsBuffer$1(coords, offsets, stride, options_val) {
413
+ const ptr0 = passArrayF64ToWasm0$1(coords, wasm$1.__wbindgen_malloc);
414
+ const len0 = WASM_VECTOR_LEN$1;
415
+ const ptr1 = passArray32ToWasm0$1(offsets, wasm$1.__wbindgen_malloc);
416
+ const len1 = WASM_VECTOR_LEN$1;
417
+ const ret = wasm$1.polygonizeWithOptionsBuffer(ptr0, len0, ptr1, len1, stride, options_val);
418
+ if (ret[2]) {
419
+ throw takeFromExternrefTable0$1(ret[1]);
420
+ }
421
+ return WasmPolygonResult$1.__wrap(ret[0]);
422
+ }
423
+
244
424
  /**
245
425
  * @param {Float64Array} coords
246
426
  * @param {Uint32Array} offsets
@@ -315,9 +495,71 @@ async function __wbg_load$1(module, imports) {
315
495
  function __wbg_get_imports$1() {
316
496
  const imports = {};
317
497
  imports.wbg = {};
498
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
499
+ const ret = Error(getStringFromWasm0$1(arg0, arg1));
500
+ return ret;
501
+ };
502
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
503
+ const ret = String(arg1);
504
+ const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
505
+ const len1 = WASM_VECTOR_LEN$1;
506
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
507
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
508
+ };
509
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
510
+ const v = arg0;
511
+ const ret = typeof(v) === 'boolean' ? v : undefined;
512
+ return isLikeNone$1(ret) ? 0xFFFFFF : ret ? 1 : 0;
513
+ };
514
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
515
+ const ret = debugString$1(arg1);
516
+ const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
517
+ const len1 = WASM_VECTOR_LEN$1;
518
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
519
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
520
+ };
521
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
522
+ const ret = arg0 in arg1;
523
+ return ret;
524
+ };
525
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
526
+ const val = arg0;
527
+ const ret = typeof(val) === 'object' && val !== null;
528
+ return ret;
529
+ };
530
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
531
+ const ret = typeof(arg0) === 'string';
532
+ return ret;
533
+ };
534
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
535
+ const ret = arg0 === undefined;
536
+ return ret;
537
+ };
538
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
539
+ const ret = arg0 == arg1;
540
+ return ret;
541
+ };
542
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
543
+ const obj = arg1;
544
+ const ret = typeof(obj) === 'number' ? obj : undefined;
545
+ getDataViewMemory0$1().setFloat64(arg0 + 8 * 1, isLikeNone$1(ret) ? 0 : ret, true);
546
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, !isLikeNone$1(ret), true);
547
+ };
548
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
549
+ const obj = arg1;
550
+ const ret = typeof(obj) === 'string' ? obj : undefined;
551
+ var ptr1 = isLikeNone$1(ret) ? 0 : passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
552
+ var len1 = WASM_VECTOR_LEN$1;
553
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
554
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
555
+ };
318
556
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
319
557
  throw new Error(getStringFromWasm0$1(arg0, arg1));
320
558
  };
559
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
560
+ const ret = Object.entries(arg0);
561
+ return ret;
562
+ };
321
563
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
322
564
  let deferred0_0;
323
565
  let deferred0_1;
@@ -329,10 +571,57 @@ function __wbg_get_imports$1() {
329
571
  wasm$1.__wbindgen_free(deferred0_0, deferred0_1, 1);
330
572
  }
331
573
  };
574
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
575
+ const ret = arg0[arg1 >>> 0];
576
+ return ret;
577
+ };
578
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
579
+ const ret = arg0[arg1];
580
+ return ret;
581
+ };
582
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
583
+ let result;
584
+ try {
585
+ result = arg0 instanceof ArrayBuffer;
586
+ } catch (_) {
587
+ result = false;
588
+ }
589
+ const ret = result;
590
+ return ret;
591
+ };
592
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
593
+ let result;
594
+ try {
595
+ result = arg0 instanceof Uint8Array;
596
+ } catch (_) {
597
+ result = false;
598
+ }
599
+ const ret = result;
600
+ return ret;
601
+ };
602
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
603
+ const ret = arg0.length;
604
+ return ret;
605
+ };
606
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
607
+ const ret = arg0.length;
608
+ return ret;
609
+ };
610
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
611
+ const ret = new Uint8Array(arg0);
612
+ return ret;
613
+ };
332
614
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
333
615
  const ret = new Error();
334
616
  return ret;
335
617
  };
618
+ imports.wbg.__wbg_polygonizerwasmerror_new = function(arg0) {
619
+ const ret = PolygonizerWasmError$1.__wrap(arg0);
620
+ return ret;
621
+ };
622
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
623
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0$1(arg0, arg1), arg2);
624
+ };
336
625
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
337
626
  const ret = arg1.stack;
338
627
  const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
@@ -419,16 +708,84 @@ async function __wbg_init$1(module_or_path) {
419
708
 
420
709
  var scalarExports = /*#__PURE__*/Object.freeze({
421
710
  __proto__: null,
711
+ PolygonizerWasmError: PolygonizerWasmError$1,
422
712
  WasmPolygonResult: WasmPolygonResult$1,
423
713
  default: __wbg_init$1,
424
714
  initSync: initSync$1,
425
715
  polygonize: polygonize$1,
716
+ polygonizeWithOptions: polygonizeWithOptions$1,
717
+ polygonizeWithOptionsBuffer: polygonizeWithOptionsBuffer$1,
426
718
  polygonize_buffers: polygonize_buffers$1,
427
719
  polygonize_geoarrow: polygonize_geoarrow$1
428
720
  });
429
721
 
430
722
  let wasm;
431
723
 
724
+ function debugString(val) {
725
+ // primitive types
726
+ const type = typeof val;
727
+ if (type == 'number' || type == 'boolean' || val == null) {
728
+ return `${val}`;
729
+ }
730
+ if (type == 'string') {
731
+ return `"${val}"`;
732
+ }
733
+ if (type == 'symbol') {
734
+ const description = val.description;
735
+ if (description == null) {
736
+ return 'Symbol';
737
+ } else {
738
+ return `Symbol(${description})`;
739
+ }
740
+ }
741
+ if (type == 'function') {
742
+ const name = val.name;
743
+ if (typeof name == 'string' && name.length > 0) {
744
+ return `Function(${name})`;
745
+ } else {
746
+ return 'Function';
747
+ }
748
+ }
749
+ // objects
750
+ if (Array.isArray(val)) {
751
+ const length = val.length;
752
+ let debug = '[';
753
+ if (length > 0) {
754
+ debug += debugString(val[0]);
755
+ }
756
+ for(let i = 1; i < length; i++) {
757
+ debug += ', ' + debugString(val[i]);
758
+ }
759
+ debug += ']';
760
+ return debug;
761
+ }
762
+ // Test for built-in
763
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
764
+ let className;
765
+ if (builtInMatches && builtInMatches.length > 1) {
766
+ className = builtInMatches[1];
767
+ } else {
768
+ // Failed to match the standard '[object ClassName]'
769
+ return toString.call(val);
770
+ }
771
+ if (className == 'Object') {
772
+ // we're a user defined class or Object
773
+ // JSON.stringify avoids problems with cycles, and is generally much
774
+ // easier than looping through ownProperties of `val`.
775
+ try {
776
+ return 'Object(' + JSON.stringify(val) + ')';
777
+ } catch (_) {
778
+ return 'Object';
779
+ }
780
+ }
781
+ // errors
782
+ if (val instanceof Error) {
783
+ return `${val.name}: ${val.message}\n${val.stack}`;
784
+ }
785
+ // TODO we could test for more things here, like `Set`s and `Map`s.
786
+ return className;
787
+ }
788
+
432
789
  function getArrayU8FromWasm0(ptr, len) {
433
790
  ptr = ptr >>> 0;
434
791
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -568,10 +925,79 @@ if (!('encodeInto' in cachedTextEncoder)) {
568
925
 
569
926
  let WASM_VECTOR_LEN = 0;
570
927
 
928
+ const PolygonizerWasmErrorFinalization = (typeof FinalizationRegistry === 'undefined')
929
+ ? { register: () => {}, unregister: () => {} }
930
+ : new FinalizationRegistry(ptr => wasm.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
931
+
571
932
  const WasmPolygonResultFinalization = (typeof FinalizationRegistry === 'undefined')
572
933
  ? { register: () => {}, unregister: () => {} }
573
934
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
574
935
 
936
+ class PolygonizerWasmError {
937
+ static __wrap(ptr) {
938
+ ptr = ptr >>> 0;
939
+ const obj = Object.create(PolygonizerWasmError.prototype);
940
+ obj.__wbg_ptr = ptr;
941
+ PolygonizerWasmErrorFinalization.register(obj, obj.__wbg_ptr, obj);
942
+ return obj;
943
+ }
944
+ __destroy_into_raw() {
945
+ const ptr = this.__wbg_ptr;
946
+ this.__wbg_ptr = 0;
947
+ PolygonizerWasmErrorFinalization.unregister(this);
948
+ return ptr;
949
+ }
950
+ free() {
951
+ const ptr = this.__destroy_into_raw();
952
+ wasm.__wbg_polygonizerwasmerror_free(ptr, 0);
953
+ }
954
+ /**
955
+ * @param {string} name
956
+ * @param {string} message
957
+ */
958
+ constructor(name, message) {
959
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
960
+ const len0 = WASM_VECTOR_LEN;
961
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
962
+ const len1 = WASM_VECTOR_LEN;
963
+ const ret = wasm.polygonizerwasmerror_new(ptr0, len0, ptr1, len1);
964
+ this.__wbg_ptr = ret >>> 0;
965
+ PolygonizerWasmErrorFinalization.register(this, this.__wbg_ptr, this);
966
+ return this;
967
+ }
968
+ /**
969
+ * @returns {string}
970
+ */
971
+ get name() {
972
+ let deferred1_0;
973
+ let deferred1_1;
974
+ try {
975
+ const ret = wasm.polygonizerwasmerror_name(this.__wbg_ptr);
976
+ deferred1_0 = ret[0];
977
+ deferred1_1 = ret[1];
978
+ return getStringFromWasm0(ret[0], ret[1]);
979
+ } finally {
980
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
981
+ }
982
+ }
983
+ /**
984
+ * @returns {string}
985
+ */
986
+ get message() {
987
+ let deferred1_0;
988
+ let deferred1_1;
989
+ try {
990
+ const ret = wasm.polygonizerwasmerror_message(this.__wbg_ptr);
991
+ deferred1_0 = ret[0];
992
+ deferred1_1 = ret[1];
993
+ return getStringFromWasm0(ret[0], ret[1]);
994
+ } finally {
995
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
996
+ }
997
+ }
998
+ }
999
+ if (Symbol.dispose) PolygonizerWasmError.prototype[Symbol.dispose] = PolygonizerWasmError.prototype.free;
1000
+
575
1001
  class WasmPolygonResult {
576
1002
  static __wrap(ptr) {
577
1003
  ptr = ptr >>> 0;
@@ -647,15 +1073,42 @@ if (Symbol.dispose) WasmPolygonResult.prototype[Symbol.dispose] = WasmPolygonRes
647
1073
  * @param {boolean | null} [node_input]
648
1074
  * @param {number | null} [snap_grid_size]
649
1075
  * @param {boolean | null} [extract_only_polygonal]
1076
+ * @param {boolean | null} [report_mode]
1077
+ * @returns {string}
1078
+ */
1079
+ function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygonal, report_mode) {
1080
+ let deferred3_0;
1081
+ let deferred3_1;
1082
+ try {
1083
+ const ptr0 = passStringToWasm0(geojson_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1084
+ const len0 = WASM_VECTOR_LEN;
1085
+ const ret = wasm.polygonize(ptr0, len0, isLikeNone(node_input) ? 0xFFFFFF : node_input ? 1 : 0, !isLikeNone(snap_grid_size), isLikeNone(snap_grid_size) ? 0 : snap_grid_size, isLikeNone(extract_only_polygonal) ? 0xFFFFFF : extract_only_polygonal ? 1 : 0, isLikeNone(report_mode) ? 0xFFFFFF : report_mode ? 1 : 0);
1086
+ var ptr2 = ret[0];
1087
+ var len2 = ret[1];
1088
+ if (ret[3]) {
1089
+ ptr2 = 0; len2 = 0;
1090
+ throw takeFromExternrefTable0(ret[2]);
1091
+ }
1092
+ deferred3_0 = ptr2;
1093
+ deferred3_1 = len2;
1094
+ return getStringFromWasm0(ptr2, len2);
1095
+ } finally {
1096
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1097
+ }
1098
+ }
1099
+
1100
+ /**
1101
+ * @param {string} geojson_str
1102
+ * @param {any} options_val
650
1103
  * @returns {string}
651
1104
  */
652
- function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygonal) {
1105
+ function polygonizeWithOptions(geojson_str, options_val) {
653
1106
  let deferred3_0;
654
1107
  let deferred3_1;
655
1108
  try {
656
1109
  const ptr0 = passStringToWasm0(geojson_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
657
1110
  const len0 = WASM_VECTOR_LEN;
658
- const ret = wasm.polygonize(ptr0, len0, isLikeNone(node_input) ? 0xFFFFFF : node_input ? 1 : 0, !isLikeNone(snap_grid_size), isLikeNone(snap_grid_size) ? 0 : snap_grid_size, isLikeNone(extract_only_polygonal) ? 0xFFFFFF : extract_only_polygonal ? 1 : 0);
1111
+ const ret = wasm.polygonizeWithOptions(ptr0, len0, options_val);
659
1112
  var ptr2 = ret[0];
660
1113
  var len2 = ret[1];
661
1114
  if (ret[3]) {
@@ -670,6 +1123,25 @@ function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygo
670
1123
  }
671
1124
  }
672
1125
 
1126
+ /**
1127
+ * @param {Float64Array} coords
1128
+ * @param {Uint32Array} offsets
1129
+ * @param {number} stride
1130
+ * @param {any} options_val
1131
+ * @returns {WasmPolygonResult}
1132
+ */
1133
+ function polygonizeWithOptionsBuffer(coords, offsets, stride, options_val) {
1134
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1135
+ const len0 = WASM_VECTOR_LEN;
1136
+ const ptr1 = passArray32ToWasm0(offsets, wasm.__wbindgen_malloc);
1137
+ const len1 = WASM_VECTOR_LEN;
1138
+ const ret = wasm.polygonizeWithOptionsBuffer(ptr0, len0, ptr1, len1, stride, options_val);
1139
+ if (ret[2]) {
1140
+ throw takeFromExternrefTable0(ret[1]);
1141
+ }
1142
+ return WasmPolygonResult.__wrap(ret[0]);
1143
+ }
1144
+
673
1145
  /**
674
1146
  * @param {Float64Array} coords
675
1147
  * @param {Uint32Array} offsets
@@ -744,9 +1216,71 @@ async function __wbg_load(module, imports) {
744
1216
  function __wbg_get_imports() {
745
1217
  const imports = {};
746
1218
  imports.wbg = {};
1219
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
1220
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1221
+ return ret;
1222
+ };
1223
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1224
+ const ret = String(arg1);
1225
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1226
+ const len1 = WASM_VECTOR_LEN;
1227
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1228
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1229
+ };
1230
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
1231
+ const v = arg0;
1232
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1233
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1234
+ };
1235
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
1236
+ const ret = debugString(arg1);
1237
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1238
+ const len1 = WASM_VECTOR_LEN;
1239
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1240
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1241
+ };
1242
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
1243
+ const ret = arg0 in arg1;
1244
+ return ret;
1245
+ };
1246
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
1247
+ const val = arg0;
1248
+ const ret = typeof(val) === 'object' && val !== null;
1249
+ return ret;
1250
+ };
1251
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
1252
+ const ret = typeof(arg0) === 'string';
1253
+ return ret;
1254
+ };
1255
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
1256
+ const ret = arg0 === undefined;
1257
+ return ret;
1258
+ };
1259
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
1260
+ const ret = arg0 == arg1;
1261
+ return ret;
1262
+ };
1263
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1264
+ const obj = arg1;
1265
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1266
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1267
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1268
+ };
1269
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
1270
+ const obj = arg1;
1271
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1272
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1273
+ var len1 = WASM_VECTOR_LEN;
1274
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1275
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1276
+ };
747
1277
  imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
748
1278
  throw new Error(getStringFromWasm0(arg0, arg1));
749
1279
  };
1280
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
1281
+ const ret = Object.entries(arg0);
1282
+ return ret;
1283
+ };
750
1284
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
751
1285
  let deferred0_0;
752
1286
  let deferred0_1;
@@ -758,10 +1292,57 @@ function __wbg_get_imports() {
758
1292
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
759
1293
  }
760
1294
  };
1295
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1296
+ const ret = arg0[arg1 >>> 0];
1297
+ return ret;
1298
+ };
1299
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1300
+ const ret = arg0[arg1];
1301
+ return ret;
1302
+ };
1303
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1304
+ let result;
1305
+ try {
1306
+ result = arg0 instanceof ArrayBuffer;
1307
+ } catch (_) {
1308
+ result = false;
1309
+ }
1310
+ const ret = result;
1311
+ return ret;
1312
+ };
1313
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1314
+ let result;
1315
+ try {
1316
+ result = arg0 instanceof Uint8Array;
1317
+ } catch (_) {
1318
+ result = false;
1319
+ }
1320
+ const ret = result;
1321
+ return ret;
1322
+ };
1323
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1324
+ const ret = arg0.length;
1325
+ return ret;
1326
+ };
1327
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1328
+ const ret = arg0.length;
1329
+ return ret;
1330
+ };
1331
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1332
+ const ret = new Uint8Array(arg0);
1333
+ return ret;
1334
+ };
761
1335
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
762
1336
  const ret = new Error();
763
1337
  return ret;
764
1338
  };
1339
+ imports.wbg.__wbg_polygonizerwasmerror_new = function(arg0) {
1340
+ const ret = PolygonizerWasmError.__wrap(arg0);
1341
+ return ret;
1342
+ };
1343
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1344
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1345
+ };
765
1346
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
766
1347
  const ret = arg1.stack;
767
1348
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -848,10 +1429,13 @@ async function __wbg_init(module_or_path) {
848
1429
 
849
1430
  var simdExports = /*#__PURE__*/Object.freeze({
850
1431
  __proto__: null,
1432
+ PolygonizerWasmError: PolygonizerWasmError,
851
1433
  WasmPolygonResult: WasmPolygonResult,
852
1434
  default: __wbg_init,
853
1435
  initSync: initSync,
854
1436
  polygonize: polygonize,
1437
+ polygonizeWithOptions: polygonizeWithOptions,
1438
+ polygonizeWithOptionsBuffer: polygonizeWithOptionsBuffer,
855
1439
  polygonize_buffers: polygonize_buffers,
856
1440
  polygonize_geoarrow: polygonize_geoarrow
857
1441
  });
@@ -878,4 +1462,4 @@ async function initBest(scalarModule, simdModule) {
878
1462
  }
879
1463
  }
880
1464
 
881
- export { WasmPolygonResult$1 as WasmPolygonResult, initBest, initSync$1 as initSync, polygonize$1 as polygonize, polygonize_buffers$1 as polygonize_buffers, polygonize_geoarrow$1 as polygonize_geoarrow };
1465
+ export { PolygonizerWasmError$1 as PolygonizerWasmError, WasmPolygonResult$1 as WasmPolygonResult, initBest, initSync$1 as initSync, polygonize$1 as polygonize, polygonizeWithOptions$1 as polygonizeWithOptions, polygonizeWithOptionsBuffer$1 as polygonizeWithOptionsBuffer, polygonize_buffers$1 as polygonize_buffers, polygonize_geoarrow$1 as polygonize_geoarrow };