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