geo-polygonize 0.23.0 → 0.32.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,216 +1,4 @@
1
- let wasm$1;
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
-
68
- function getArrayU8FromWasm0$1(ptr, len) {
69
- ptr = ptr >>> 0;
70
- return getUint8ArrayMemory0$1().subarray(ptr / 1, ptr / 1 + len);
71
- }
72
-
73
- let cachedDataViewMemory0$1 = null;
74
- function getDataViewMemory0$1() {
75
- if (cachedDataViewMemory0$1 === null || cachedDataViewMemory0$1.buffer.detached === true || (cachedDataViewMemory0$1.buffer.detached === undefined && cachedDataViewMemory0$1.buffer !== wasm$1.memory.buffer)) {
76
- cachedDataViewMemory0$1 = new DataView(wasm$1.memory.buffer);
77
- }
78
- return cachedDataViewMemory0$1;
79
- }
80
-
81
- let cachedFloat64ArrayMemory0$1 = null;
82
- function getFloat64ArrayMemory0$1() {
83
- if (cachedFloat64ArrayMemory0$1 === null || cachedFloat64ArrayMemory0$1.byteLength === 0) {
84
- cachedFloat64ArrayMemory0$1 = new Float64Array(wasm$1.memory.buffer);
85
- }
86
- return cachedFloat64ArrayMemory0$1;
87
- }
88
-
89
- function getStringFromWasm0$1(ptr, len) {
90
- ptr = ptr >>> 0;
91
- return decodeText$1(ptr, len);
92
- }
93
-
94
- let cachedUint32ArrayMemory0$1 = null;
95
- function getUint32ArrayMemory0$1() {
96
- if (cachedUint32ArrayMemory0$1 === null || cachedUint32ArrayMemory0$1.byteLength === 0) {
97
- cachedUint32ArrayMemory0$1 = new Uint32Array(wasm$1.memory.buffer);
98
- }
99
- return cachedUint32ArrayMemory0$1;
100
- }
101
-
102
- let cachedUint8ArrayMemory0$1 = null;
103
- function getUint8ArrayMemory0$1() {
104
- if (cachedUint8ArrayMemory0$1 === null || cachedUint8ArrayMemory0$1.byteLength === 0) {
105
- cachedUint8ArrayMemory0$1 = new Uint8Array(wasm$1.memory.buffer);
106
- }
107
- return cachedUint8ArrayMemory0$1;
108
- }
109
-
110
- function isLikeNone$1(x) {
111
- return x === undefined || x === null;
112
- }
113
-
114
- function passArray32ToWasm0$1(arg, malloc) {
115
- const ptr = malloc(arg.length * 4, 4) >>> 0;
116
- getUint32ArrayMemory0$1().set(arg, ptr / 4);
117
- WASM_VECTOR_LEN$1 = arg.length;
118
- return ptr;
119
- }
120
-
121
- function passArray8ToWasm0$1(arg, malloc) {
122
- const ptr = malloc(arg.length * 1, 1) >>> 0;
123
- getUint8ArrayMemory0$1().set(arg, ptr / 1);
124
- WASM_VECTOR_LEN$1 = arg.length;
125
- return ptr;
126
- }
127
-
128
- function passArrayF64ToWasm0$1(arg, malloc) {
129
- const ptr = malloc(arg.length * 8, 8) >>> 0;
130
- getFloat64ArrayMemory0$1().set(arg, ptr / 8);
131
- WASM_VECTOR_LEN$1 = arg.length;
132
- return ptr;
133
- }
134
-
135
- function passStringToWasm0$1(arg, malloc, realloc) {
136
- if (realloc === undefined) {
137
- const buf = cachedTextEncoder$1.encode(arg);
138
- const ptr = malloc(buf.length, 1) >>> 0;
139
- getUint8ArrayMemory0$1().subarray(ptr, ptr + buf.length).set(buf);
140
- WASM_VECTOR_LEN$1 = buf.length;
141
- return ptr;
142
- }
143
-
144
- let len = arg.length;
145
- let ptr = malloc(len, 1) >>> 0;
146
-
147
- const mem = getUint8ArrayMemory0$1();
148
-
149
- let offset = 0;
150
-
151
- for (; offset < len; offset++) {
152
- const code = arg.charCodeAt(offset);
153
- if (code > 0x7F) break;
154
- mem[ptr + offset] = code;
155
- }
156
- if (offset !== len) {
157
- if (offset !== 0) {
158
- arg = arg.slice(offset);
159
- }
160
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
161
- const view = getUint8ArrayMemory0$1().subarray(ptr + offset, ptr + len);
162
- const ret = cachedTextEncoder$1.encodeInto(arg, view);
163
-
164
- offset += ret.written;
165
- ptr = realloc(ptr, len, offset, 1) >>> 0;
166
- }
167
-
168
- WASM_VECTOR_LEN$1 = offset;
169
- return ptr;
170
- }
171
-
172
- function takeFromExternrefTable0$1(idx) {
173
- const value = wasm$1.__wbindgen_externrefs.get(idx);
174
- wasm$1.__externref_table_dealloc(idx);
175
- return value;
176
- }
177
-
178
- let cachedTextDecoder$1 = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
179
- cachedTextDecoder$1.decode();
180
- const MAX_SAFARI_DECODE_BYTES$1 = 2146435072;
181
- let numBytesDecoded$1 = 0;
182
- function decodeText$1(ptr, len) {
183
- numBytesDecoded$1 += len;
184
- if (numBytesDecoded$1 >= MAX_SAFARI_DECODE_BYTES$1) {
185
- cachedTextDecoder$1 = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
186
- cachedTextDecoder$1.decode();
187
- numBytesDecoded$1 = len;
188
- }
189
- return cachedTextDecoder$1.decode(getUint8ArrayMemory0$1().subarray(ptr, ptr + len));
190
- }
191
-
192
- const cachedTextEncoder$1 = new TextEncoder();
193
-
194
- if (!('encodeInto' in cachedTextEncoder$1)) {
195
- cachedTextEncoder$1.encodeInto = function (arg, view) {
196
- const buf = cachedTextEncoder$1.encode(arg);
197
- view.set(buf);
198
- return {
199
- read: arg.length,
200
- written: buf.length
201
- };
202
- };
203
- }
204
-
205
- let WASM_VECTOR_LEN$1 = 0;
206
-
207
- const PolygonizerWasmErrorFinalization$1 = (typeof FinalizationRegistry === 'undefined')
208
- ? { register: () => {}, unregister: () => {} }
209
- : new FinalizationRegistry(ptr => wasm$1.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
210
-
211
- const WasmPolygonResultFinalization$1 = (typeof FinalizationRegistry === 'undefined')
212
- ? { register: () => {}, unregister: () => {} }
213
- : new FinalizationRegistry(ptr => wasm$1.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
1
+ /* @ts-self-types="./geo_polygonize.d.ts" */
214
2
 
215
3
  let PolygonizerWasmError$1 = class PolygonizerWasmError {
216
4
  static __wrap(ptr) {
@@ -230,28 +18,14 @@ let PolygonizerWasmError$1 = class PolygonizerWasmError {
230
18
  const ptr = this.__destroy_into_raw();
231
19
  wasm$1.__wbg_polygonizerwasmerror_free(ptr, 0);
232
20
  }
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
21
  /**
248
22
  * @returns {string}
249
23
  */
250
- get name() {
24
+ get message() {
251
25
  let deferred1_0;
252
26
  let deferred1_1;
253
27
  try {
254
- const ret = wasm$1.polygonizerwasmerror_name(this.__wbg_ptr);
28
+ const ret = wasm$1.polygonizerwasmerror_message(this.__wbg_ptr);
255
29
  deferred1_0 = ret[0];
256
30
  deferred1_1 = ret[1];
257
31
  return getStringFromWasm0$1(ret[0], ret[1]);
@@ -262,11 +36,11 @@ let PolygonizerWasmError$1 = class PolygonizerWasmError {
262
36
  /**
263
37
  * @returns {string}
264
38
  */
265
- get message() {
39
+ get name() {
266
40
  let deferred1_0;
267
41
  let deferred1_1;
268
42
  try {
269
- const ret = wasm$1.polygonizerwasmerror_message(this.__wbg_ptr);
43
+ const ret = wasm$1.polygonizerwasmerror_name(this.__wbg_ptr);
270
44
  deferred1_0 = ret[0];
271
45
  deferred1_1 = ret[1];
272
46
  return getStringFromWasm0$1(ret[0], ret[1]);
@@ -274,6 +48,20 @@ let PolygonizerWasmError$1 = class PolygonizerWasmError {
274
48
  wasm$1.__wbindgen_free(deferred1_0, deferred1_1, 1);
275
49
  }
276
50
  }
51
+ /**
52
+ * @param {string} name
53
+ * @param {string} message
54
+ */
55
+ constructor(name, message) {
56
+ const ptr0 = passStringToWasm0$1(name, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
57
+ const len0 = WASM_VECTOR_LEN$1;
58
+ const ptr1 = passStringToWasm0$1(message, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
59
+ const len1 = WASM_VECTOR_LEN$1;
60
+ const ret = wasm$1.polygonizerwasmerror_new(ptr0, len0, ptr1, len1);
61
+ this.__wbg_ptr = ret >>> 0;
62
+ PolygonizerWasmErrorFinalization$1.register(this, this.__wbg_ptr, this);
63
+ return this;
64
+ }
277
65
  };
278
66
  if (Symbol.dispose) PolygonizerWasmError$1.prototype[Symbol.dispose] = PolygonizerWasmError$1.prototype.free;
279
67
 
@@ -309,13 +97,6 @@ let WasmPolygonResult$1 = class WasmPolygonResult {
309
97
  const ret = wasm$1.wasmpolygonresult_coords_ptr(this.__wbg_ptr);
310
98
  return ret >>> 0;
311
99
  }
312
- /**
313
- * @returns {any}
314
- */
315
- get provenance() {
316
- const ret = wasm$1.wasmpolygonresult_provenance(this.__wbg_ptr);
317
- return ret;
318
- }
319
100
  /**
320
101
  * @returns {any}
321
102
  */
@@ -326,43 +107,50 @@ let WasmPolygonResult$1 = class WasmPolygonResult {
326
107
  /**
327
108
  * @returns {number}
328
109
  */
329
- ring_offsets_len() {
330
- const ret = wasm$1.wasmpolygonresult_ring_offsets_len(this.__wbg_ptr);
110
+ flat_line_ids_len() {
111
+ const ret = wasm$1.wasmpolygonresult_flat_line_ids_len(this.__wbg_ptr);
331
112
  return ret >>> 0;
332
113
  }
333
114
  /**
334
115
  * @returns {number}
335
116
  */
336
- ring_offsets_ptr() {
337
- const ret = wasm$1.wasmpolygonresult_ring_offsets_ptr(this.__wbg_ptr);
117
+ flat_line_ids_ptr() {
118
+ const ret = wasm$1.wasmpolygonresult_flat_line_ids_ptr(this.__wbg_ptr);
338
119
  return ret >>> 0;
339
120
  }
340
121
  /**
341
122
  * @returns {number}
342
123
  */
343
- flat_line_ids_len() {
344
- const ret = wasm$1.wasmpolygonresult_flat_line_ids_len(this.__wbg_ptr);
124
+ polygon_offsets_len() {
125
+ const ret = wasm$1.wasmpolygonresult_polygon_offsets_len(this.__wbg_ptr);
345
126
  return ret >>> 0;
346
127
  }
347
128
  /**
348
129
  * @returns {number}
349
130
  */
350
- flat_line_ids_ptr() {
351
- const ret = wasm$1.wasmpolygonresult_flat_line_ids_ptr(this.__wbg_ptr);
131
+ polygon_offsets_ptr() {
132
+ const ret = wasm$1.wasmpolygonresult_polygon_offsets_ptr(this.__wbg_ptr);
352
133
  return ret >>> 0;
353
134
  }
135
+ /**
136
+ * @returns {any}
137
+ */
138
+ get provenance() {
139
+ const ret = wasm$1.wasmpolygonresult_provenance(this.__wbg_ptr);
140
+ return ret;
141
+ }
354
142
  /**
355
143
  * @returns {number}
356
144
  */
357
- polygon_offsets_len() {
358
- const ret = wasm$1.wasmpolygonresult_polygon_offsets_len(this.__wbg_ptr);
145
+ ring_offsets_len() {
146
+ const ret = wasm$1.wasmpolygonresult_ring_offsets_len(this.__wbg_ptr);
359
147
  return ret >>> 0;
360
148
  }
361
149
  /**
362
150
  * @returns {number}
363
151
  */
364
- polygon_offsets_ptr() {
365
- const ret = wasm$1.wasmpolygonresult_polygon_offsets_ptr(this.__wbg_ptr);
152
+ ring_offsets_ptr() {
153
+ const ret = wasm$1.wasmpolygonresult_ring_offsets_ptr(this.__wbg_ptr);
366
154
  return ret >>> 0;
367
155
  }
368
156
  /**
@@ -405,6 +193,11 @@ function polygonize$1(geojson_str, node_input, snap_grid_size, extract_only_poly
405
193
  }
406
194
 
407
195
  /**
196
+ * Polygonizes an Arrow IPC stream containing a GeoArrow LineString array.
197
+ *
198
+ * This zero-copy path avoids JSON serialization overhead and returns a binary
199
+ * Arrow IPC stream containing a GeoArrow Polygon array. Requires the options
200
+ * to be passed as a parsed JS object.
408
201
  * @param {Uint8Array} ipc_bytes
409
202
  * @param {any} options_val
410
203
  * @returns {Uint8Array}
@@ -422,6 +215,11 @@ function polygonizeGeoArrowWithOptions$1(ipc_bytes, options_val) {
422
215
  }
423
216
 
424
217
  /**
218
+ * Polygonizes a GeoJSON FeatureCollection using the canonical `PolygonizerOptions`.
219
+ *
220
+ * This is the primary entry point for JavaScript users. It accepts a JSON string
221
+ * of options and returns a JSON string representing the result, including faces,
222
+ * dangles, cut-lines, and (optionally) provenance/diagnostics.
425
223
  * @param {string} geojson_str
426
224
  * @param {any} options_val
427
225
  * @returns {string}
@@ -511,293 +309,196 @@ function polygonize_geoarrow$1(ipc_bytes, node_input, snap_grid_size, extract_on
511
309
  return v2;
512
310
  }
513
311
 
514
- const EXPECTED_RESPONSE_TYPES$1 = new Set(['basic', 'cors', 'default']);
515
-
516
- async function __wbg_load$1(module, imports) {
517
- if (typeof Response === 'function' && module instanceof Response) {
518
- if (typeof WebAssembly.instantiateStreaming === 'function') {
312
+ function __wbg_get_imports$1() {
313
+ const import0 = {
314
+ __proto__: null,
315
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
316
+ const ret = Error(getStringFromWasm0$1(arg0, arg1));
317
+ return ret;
318
+ },
319
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
320
+ const ret = String(arg1);
321
+ const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
322
+ const len1 = WASM_VECTOR_LEN$1;
323
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
324
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
325
+ },
326
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
327
+ const v = arg0;
328
+ const ret = typeof(v) === 'boolean' ? v : undefined;
329
+ return isLikeNone$1(ret) ? 0xFFFFFF : ret ? 1 : 0;
330
+ },
331
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
332
+ const ret = debugString$1(arg1);
333
+ const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
334
+ const len1 = WASM_VECTOR_LEN$1;
335
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
336
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
337
+ },
338
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
339
+ const ret = arg0 in arg1;
340
+ return ret;
341
+ },
342
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
343
+ const val = arg0;
344
+ const ret = typeof(val) === 'object' && val !== null;
345
+ return ret;
346
+ },
347
+ __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
348
+ const ret = typeof(arg0) === 'string';
349
+ return ret;
350
+ },
351
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
352
+ const ret = arg0 === undefined;
353
+ return ret;
354
+ },
355
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
356
+ const ret = arg0 == arg1;
357
+ return ret;
358
+ },
359
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
360
+ const obj = arg1;
361
+ const ret = typeof(obj) === 'number' ? obj : undefined;
362
+ getDataViewMemory0$1().setFloat64(arg0 + 8 * 1, isLikeNone$1(ret) ? 0 : ret, true);
363
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, !isLikeNone$1(ret), true);
364
+ },
365
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
366
+ const obj = arg1;
367
+ const ret = typeof(obj) === 'string' ? obj : undefined;
368
+ var ptr1 = isLikeNone$1(ret) ? 0 : passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
369
+ var len1 = WASM_VECTOR_LEN$1;
370
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
371
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
372
+ },
373
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
374
+ throw new Error(getStringFromWasm0$1(arg0, arg1));
375
+ },
376
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
377
+ const ret = Object.entries(arg0);
378
+ return ret;
379
+ },
380
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
381
+ let deferred0_0;
382
+ let deferred0_1;
519
383
  try {
520
- return await WebAssembly.instantiateStreaming(module, imports);
521
- } catch (e) {
522
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES$1.has(module.type);
523
-
524
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
525
- 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);
526
-
527
- } else {
528
- throw e;
529
- }
384
+ deferred0_0 = arg0;
385
+ deferred0_1 = arg1;
386
+ console.error(getStringFromWasm0$1(arg0, arg1));
387
+ } finally {
388
+ wasm$1.__wbindgen_free(deferred0_0, deferred0_1, 1);
530
389
  }
531
- }
532
-
533
- const bytes = await module.arrayBuffer();
534
- return await WebAssembly.instantiate(bytes, imports);
535
- } else {
536
- const instance = await WebAssembly.instantiate(module, imports);
537
-
538
- if (instance instanceof WebAssembly.Instance) {
539
- return { instance, module };
540
- } else {
541
- return instance;
542
- }
543
- }
544
- }
545
-
546
- function __wbg_get_imports$1() {
547
- const imports = {};
548
- imports.wbg = {};
549
- imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
550
- const ret = Error(getStringFromWasm0$1(arg0, arg1));
551
- return ret;
552
- };
553
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
554
- const ret = String(arg1);
555
- const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
556
- const len1 = WASM_VECTOR_LEN$1;
557
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
558
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
559
- };
560
- imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
561
- const v = arg0;
562
- const ret = typeof(v) === 'boolean' ? v : undefined;
563
- return isLikeNone$1(ret) ? 0xFFFFFF : ret ? 1 : 0;
564
- };
565
- imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
566
- const ret = debugString$1(arg1);
567
- const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
568
- const len1 = WASM_VECTOR_LEN$1;
569
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
570
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
571
- };
572
- imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
573
- const ret = arg0 in arg1;
574
- return ret;
575
- };
576
- imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
577
- const val = arg0;
578
- const ret = typeof(val) === 'object' && val !== null;
579
- return ret;
580
- };
581
- imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
582
- const ret = typeof(arg0) === 'string';
583
- return ret;
584
- };
585
- imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
586
- const ret = arg0 === undefined;
587
- return ret;
588
- };
589
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
590
- const ret = arg0 == arg1;
591
- return ret;
592
- };
593
- imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
594
- const obj = arg1;
595
- const ret = typeof(obj) === 'number' ? obj : undefined;
596
- getDataViewMemory0$1().setFloat64(arg0 + 8 * 1, isLikeNone$1(ret) ? 0 : ret, true);
597
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, !isLikeNone$1(ret), true);
598
- };
599
- imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
600
- const obj = arg1;
601
- const ret = typeof(obj) === 'string' ? obj : undefined;
602
- var ptr1 = isLikeNone$1(ret) ? 0 : passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
603
- var len1 = WASM_VECTOR_LEN$1;
604
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
605
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
606
- };
607
- imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
608
- throw new Error(getStringFromWasm0$1(arg0, arg1));
609
- };
610
- imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
611
- const ret = Object.entries(arg0);
612
- return ret;
613
- };
614
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
615
- let deferred0_0;
616
- let deferred0_1;
617
- try {
618
- deferred0_0 = arg0;
619
- deferred0_1 = arg1;
620
- console.error(getStringFromWasm0$1(arg0, arg1));
621
- } finally {
622
- wasm$1.__wbindgen_free(deferred0_0, deferred0_1, 1);
623
- }
624
- };
625
- imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
626
- const ret = arg0[arg1 >>> 0];
627
- return ret;
628
- };
629
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
630
- const ret = arg0[arg1];
631
- return ret;
632
- };
633
- imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
634
- let result;
635
- try {
636
- result = arg0 instanceof ArrayBuffer;
637
- } catch (_) {
638
- result = false;
639
- }
640
- const ret = result;
641
- return ret;
642
- };
643
- imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
644
- let result;
645
- try {
646
- result = arg0 instanceof Uint8Array;
647
- } catch (_) {
648
- result = false;
649
- }
650
- const ret = result;
651
- return ret;
652
- };
653
- imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
654
- const ret = arg0.length;
655
- return ret;
656
- };
657
- imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
658
- const ret = arg0.length;
659
- return ret;
660
- };
661
- imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
662
- const ret = new Object();
663
- return ret;
664
- };
665
- imports.wbg.__wbg_new_25f239778d6112b9 = function() {
666
- const ret = new Array();
667
- return ret;
668
- };
669
- imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
670
- const ret = new Uint8Array(arg0);
671
- return ret;
672
- };
673
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
674
- const ret = new Error();
675
- return ret;
676
- };
677
- imports.wbg.__wbg_polygonizerwasmerror_new = function(arg0) {
678
- const ret = PolygonizerWasmError$1.__wrap(arg0);
679
- return ret;
680
- };
681
- imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
682
- Uint8Array.prototype.set.call(getArrayU8FromWasm0$1(arg0, arg1), arg2);
683
- };
684
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
685
- arg0[arg1] = arg2;
686
- };
687
- imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
688
- arg0[arg1 >>> 0] = arg2;
689
- };
690
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
691
- const ret = arg1.stack;
692
- const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
693
- const len1 = WASM_VECTOR_LEN$1;
694
- getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
695
- getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
696
- };
697
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
698
- // Cast intrinsic for `Ref(String) -> Externref`.
699
- const ret = getStringFromWasm0$1(arg0, arg1);
700
- return ret;
701
- };
702
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
703
- // Cast intrinsic for `U64 -> Externref`.
704
- const ret = BigInt.asUintN(64, arg0);
705
- return ret;
706
- };
707
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
708
- // Cast intrinsic for `F64 -> Externref`.
709
- const ret = arg0;
710
- return ret;
711
- };
712
- imports.wbg.__wbindgen_init_externref_table = function() {
713
- const table = wasm$1.__wbindgen_externrefs;
714
- const offset = table.grow(4);
715
- table.set(0, undefined);
716
- table.set(offset + 0, undefined);
717
- table.set(offset + 1, null);
718
- table.set(offset + 2, true);
719
- table.set(offset + 3, false);
390
+ },
391
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
392
+ const ret = arg0[arg1 >>> 0];
393
+ return ret;
394
+ },
395
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
396
+ const ret = arg0[arg1];
397
+ return ret;
398
+ },
399
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
400
+ let result;
401
+ try {
402
+ result = arg0 instanceof ArrayBuffer;
403
+ } catch (_) {
404
+ result = false;
405
+ }
406
+ const ret = result;
407
+ return ret;
408
+ },
409
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
410
+ let result;
411
+ try {
412
+ result = arg0 instanceof Uint8Array;
413
+ } catch (_) {
414
+ result = false;
415
+ }
416
+ const ret = result;
417
+ return ret;
418
+ },
419
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
420
+ const ret = arg0.length;
421
+ return ret;
422
+ },
423
+ __wbg_length_ea16607d7b61445b: function(arg0) {
424
+ const ret = arg0.length;
425
+ return ret;
426
+ },
427
+ __wbg_new_227d7c05414eb861: function() {
428
+ const ret = new Error();
429
+ return ret;
430
+ },
431
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
432
+ const ret = new Uint8Array(arg0);
433
+ return ret;
434
+ },
435
+ __wbg_new_a70fbab9066b301f: function() {
436
+ const ret = new Array();
437
+ return ret;
438
+ },
439
+ __wbg_new_ab79df5bd7c26067: function() {
440
+ const ret = new Object();
441
+ return ret;
442
+ },
443
+ __wbg_polygonizerwasmerror_new: function(arg0) {
444
+ const ret = PolygonizerWasmError$1.__wrap(arg0);
445
+ return ret;
446
+ },
447
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
448
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0$1(arg0, arg1), arg2);
449
+ },
450
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
451
+ arg0[arg1 >>> 0] = arg2;
452
+ },
453
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
454
+ arg0[arg1] = arg2;
455
+ },
456
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
457
+ const ret = arg1.stack;
458
+ const ptr1 = passStringToWasm0$1(ret, wasm$1.__wbindgen_malloc, wasm$1.__wbindgen_realloc);
459
+ const len1 = WASM_VECTOR_LEN$1;
460
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 1, len1, true);
461
+ getDataViewMemory0$1().setInt32(arg0 + 4 * 0, ptr1, true);
462
+ },
463
+ __wbindgen_cast_0000000000000001: function(arg0) {
464
+ // Cast intrinsic for `F64 -> Externref`.
465
+ const ret = arg0;
466
+ return ret;
467
+ },
468
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
469
+ // Cast intrinsic for `Ref(String) -> Externref`.
470
+ const ret = getStringFromWasm0$1(arg0, arg1);
471
+ return ret;
472
+ },
473
+ __wbindgen_cast_0000000000000003: function(arg0) {
474
+ // Cast intrinsic for `U64 -> Externref`.
475
+ const ret = BigInt.asUintN(64, arg0);
476
+ return ret;
477
+ },
478
+ __wbindgen_init_externref_table: function() {
479
+ const table = wasm$1.__wbindgen_externrefs;
480
+ const offset = table.grow(4);
481
+ table.set(0, undefined);
482
+ table.set(offset + 0, undefined);
483
+ table.set(offset + 1, null);
484
+ table.set(offset + 2, true);
485
+ table.set(offset + 3, false);
486
+ },
487
+ };
488
+ return {
489
+ __proto__: null,
490
+ "./geo_polygonize_bg.js": import0,
720
491
  };
721
-
722
- return imports;
723
492
  }
724
493
 
725
- function __wbg_finalize_init$1(instance, module) {
726
- wasm$1 = instance.exports;
727
- __wbg_init$1.__wbindgen_wasm_module = module;
728
- cachedDataViewMemory0$1 = null;
729
- cachedFloat64ArrayMemory0$1 = null;
730
- cachedUint32ArrayMemory0$1 = null;
731
- cachedUint8ArrayMemory0$1 = null;
732
-
733
-
734
- wasm$1.__wbindgen_start();
735
- return wasm$1;
736
- }
737
-
738
- function initSync$1(module) {
739
- if (wasm$1 !== undefined) return wasm$1;
740
-
741
-
742
- if (typeof module !== 'undefined') {
743
- if (Object.getPrototypeOf(module) === Object.prototype) {
744
- ({module} = module);
745
- } else {
746
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
747
- }
748
- }
749
-
750
- const imports = __wbg_get_imports$1();
751
- if (!(module instanceof WebAssembly.Module)) {
752
- module = new WebAssembly.Module(module);
753
- }
754
- const instance = new WebAssembly.Instance(module, imports);
755
- return __wbg_finalize_init$1(instance, module);
756
- }
757
-
758
- async function __wbg_init$1(module_or_path) {
759
- if (wasm$1 !== undefined) return wasm$1;
760
-
761
-
762
- if (typeof module_or_path !== 'undefined') {
763
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
764
- ({module_or_path} = module_or_path);
765
- } else {
766
- console.warn('using deprecated parameters for the initialization function; pass a single object instead');
767
- }
768
- }
769
-
770
- if (typeof module_or_path === 'undefined') {
771
- module_or_path = new URL('geo_polygonize_bg.wasm', import.meta.url);
772
- }
773
- const imports = __wbg_get_imports$1();
774
-
775
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
776
- module_or_path = fetch(module_or_path);
777
- }
778
-
779
- const { instance, module } = await __wbg_load$1(await module_or_path, imports);
780
-
781
- return __wbg_finalize_init$1(instance, module);
782
- }
783
-
784
- var scalarExports = /*#__PURE__*/Object.freeze({
785
- __proto__: null,
786
- PolygonizerWasmError: PolygonizerWasmError$1,
787
- WasmPolygonResult: WasmPolygonResult$1,
788
- default: __wbg_init$1,
789
- initSync: initSync$1,
790
- polygonize: polygonize$1,
791
- polygonizeGeoArrowWithOptions: polygonizeGeoArrowWithOptions$1,
792
- polygonizeWithOptions: polygonizeWithOptions$1,
793
- polygonizeWithOptionsBuffer: polygonizeWithOptionsBuffer$1,
794
- polygonize_buffers: polygonize_buffers$1,
795
- polygonize_geoarrow: polygonize_geoarrow$1
796
- });
797
-
798
- let wasm;
494
+ const PolygonizerWasmErrorFinalization$1 = (typeof FinalizationRegistry === 'undefined')
495
+ ? { register: () => {}, unregister: () => {} }
496
+ : new FinalizationRegistry(ptr => wasm$1.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
497
+ const WasmPolygonResultFinalization$1 = (typeof FinalizationRegistry === 'undefined')
498
+ ? { register: () => {}, unregister: () => {} }
499
+ : new FinalizationRegistry(ptr => wasm$1.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
799
500
 
800
- function debugString(val) {
501
+ function debugString$1(val) {
801
502
  // primitive types
802
503
  const type = typeof val;
803
504
  if (type == 'number' || type == 'boolean' || val == null) {
@@ -827,10 +528,10 @@ function debugString(val) {
827
528
  const length = val.length;
828
529
  let debug = '[';
829
530
  if (length > 0) {
830
- debug += debugString(val[0]);
531
+ debug += debugString$1(val[0]);
831
532
  }
832
533
  for(let i = 1; i < length; i++) {
833
- debug += ', ' + debugString(val[i]);
534
+ debug += ', ' + debugString$1(val[i]);
834
535
  }
835
536
  debug += ']';
836
537
  return debug;
@@ -862,86 +563,86 @@ function debugString(val) {
862
563
  return className;
863
564
  }
864
565
 
865
- function getArrayU8FromWasm0(ptr, len) {
566
+ function getArrayU8FromWasm0$1(ptr, len) {
866
567
  ptr = ptr >>> 0;
867
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
568
+ return getUint8ArrayMemory0$1().subarray(ptr / 1, ptr / 1 + len);
868
569
  }
869
570
 
870
- let cachedDataViewMemory0 = null;
871
- function getDataViewMemory0() {
872
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
873
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
571
+ let cachedDataViewMemory0$1 = null;
572
+ function getDataViewMemory0$1() {
573
+ if (cachedDataViewMemory0$1 === null || cachedDataViewMemory0$1.buffer.detached === true || (cachedDataViewMemory0$1.buffer.detached === undefined && cachedDataViewMemory0$1.buffer !== wasm$1.memory.buffer)) {
574
+ cachedDataViewMemory0$1 = new DataView(wasm$1.memory.buffer);
874
575
  }
875
- return cachedDataViewMemory0;
576
+ return cachedDataViewMemory0$1;
876
577
  }
877
578
 
878
- let cachedFloat64ArrayMemory0 = null;
879
- function getFloat64ArrayMemory0() {
880
- if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
881
- cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
579
+ let cachedFloat64ArrayMemory0$1 = null;
580
+ function getFloat64ArrayMemory0$1() {
581
+ if (cachedFloat64ArrayMemory0$1 === null || cachedFloat64ArrayMemory0$1.byteLength === 0) {
582
+ cachedFloat64ArrayMemory0$1 = new Float64Array(wasm$1.memory.buffer);
882
583
  }
883
- return cachedFloat64ArrayMemory0;
584
+ return cachedFloat64ArrayMemory0$1;
884
585
  }
885
586
 
886
- function getStringFromWasm0(ptr, len) {
587
+ function getStringFromWasm0$1(ptr, len) {
887
588
  ptr = ptr >>> 0;
888
- return decodeText(ptr, len);
589
+ return decodeText$1(ptr, len);
889
590
  }
890
591
 
891
- let cachedUint32ArrayMemory0 = null;
892
- function getUint32ArrayMemory0() {
893
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
894
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
592
+ let cachedUint32ArrayMemory0$1 = null;
593
+ function getUint32ArrayMemory0$1() {
594
+ if (cachedUint32ArrayMemory0$1 === null || cachedUint32ArrayMemory0$1.byteLength === 0) {
595
+ cachedUint32ArrayMemory0$1 = new Uint32Array(wasm$1.memory.buffer);
895
596
  }
896
- return cachedUint32ArrayMemory0;
597
+ return cachedUint32ArrayMemory0$1;
897
598
  }
898
599
 
899
- let cachedUint8ArrayMemory0 = null;
900
- function getUint8ArrayMemory0() {
901
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
902
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
600
+ let cachedUint8ArrayMemory0$1 = null;
601
+ function getUint8ArrayMemory0$1() {
602
+ if (cachedUint8ArrayMemory0$1 === null || cachedUint8ArrayMemory0$1.byteLength === 0) {
603
+ cachedUint8ArrayMemory0$1 = new Uint8Array(wasm$1.memory.buffer);
903
604
  }
904
- return cachedUint8ArrayMemory0;
605
+ return cachedUint8ArrayMemory0$1;
905
606
  }
906
607
 
907
- function isLikeNone(x) {
608
+ function isLikeNone$1(x) {
908
609
  return x === undefined || x === null;
909
610
  }
910
611
 
911
- function passArray32ToWasm0(arg, malloc) {
612
+ function passArray32ToWasm0$1(arg, malloc) {
912
613
  const ptr = malloc(arg.length * 4, 4) >>> 0;
913
- getUint32ArrayMemory0().set(arg, ptr / 4);
914
- WASM_VECTOR_LEN = arg.length;
614
+ getUint32ArrayMemory0$1().set(arg, ptr / 4);
615
+ WASM_VECTOR_LEN$1 = arg.length;
915
616
  return ptr;
916
617
  }
917
618
 
918
- function passArray8ToWasm0(arg, malloc) {
619
+ function passArray8ToWasm0$1(arg, malloc) {
919
620
  const ptr = malloc(arg.length * 1, 1) >>> 0;
920
- getUint8ArrayMemory0().set(arg, ptr / 1);
921
- WASM_VECTOR_LEN = arg.length;
621
+ getUint8ArrayMemory0$1().set(arg, ptr / 1);
622
+ WASM_VECTOR_LEN$1 = arg.length;
922
623
  return ptr;
923
624
  }
924
625
 
925
- function passArrayF64ToWasm0(arg, malloc) {
626
+ function passArrayF64ToWasm0$1(arg, malloc) {
926
627
  const ptr = malloc(arg.length * 8, 8) >>> 0;
927
- getFloat64ArrayMemory0().set(arg, ptr / 8);
928
- WASM_VECTOR_LEN = arg.length;
628
+ getFloat64ArrayMemory0$1().set(arg, ptr / 8);
629
+ WASM_VECTOR_LEN$1 = arg.length;
929
630
  return ptr;
930
631
  }
931
632
 
932
- function passStringToWasm0(arg, malloc, realloc) {
633
+ function passStringToWasm0$1(arg, malloc, realloc) {
933
634
  if (realloc === undefined) {
934
- const buf = cachedTextEncoder.encode(arg);
635
+ const buf = cachedTextEncoder$1.encode(arg);
935
636
  const ptr = malloc(buf.length, 1) >>> 0;
936
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
937
- WASM_VECTOR_LEN = buf.length;
637
+ getUint8ArrayMemory0$1().subarray(ptr, ptr + buf.length).set(buf);
638
+ WASM_VECTOR_LEN$1 = buf.length;
938
639
  return ptr;
939
640
  }
940
641
 
941
642
  let len = arg.length;
942
643
  let ptr = malloc(len, 1) >>> 0;
943
644
 
944
- const mem = getUint8ArrayMemory0();
645
+ const mem = getUint8ArrayMemory0$1();
945
646
 
946
647
  let offset = 0;
947
648
 
@@ -955,42 +656,42 @@ function passStringToWasm0(arg, malloc, realloc) {
955
656
  arg = arg.slice(offset);
956
657
  }
957
658
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
958
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
959
- const ret = cachedTextEncoder.encodeInto(arg, view);
659
+ const view = getUint8ArrayMemory0$1().subarray(ptr + offset, ptr + len);
660
+ const ret = cachedTextEncoder$1.encodeInto(arg, view);
960
661
 
961
662
  offset += ret.written;
962
663
  ptr = realloc(ptr, len, offset, 1) >>> 0;
963
664
  }
964
665
 
965
- WASM_VECTOR_LEN = offset;
666
+ WASM_VECTOR_LEN$1 = offset;
966
667
  return ptr;
967
668
  }
968
669
 
969
- function takeFromExternrefTable0(idx) {
970
- const value = wasm.__wbindgen_externrefs.get(idx);
971
- wasm.__externref_table_dealloc(idx);
670
+ function takeFromExternrefTable0$1(idx) {
671
+ const value = wasm$1.__wbindgen_externrefs.get(idx);
672
+ wasm$1.__externref_table_dealloc(idx);
972
673
  return value;
973
674
  }
974
675
 
975
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
976
- cachedTextDecoder.decode();
977
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
978
- let numBytesDecoded = 0;
979
- function decodeText(ptr, len) {
980
- numBytesDecoded += len;
981
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
982
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
983
- cachedTextDecoder.decode();
984
- numBytesDecoded = len;
676
+ let cachedTextDecoder$1 = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
677
+ cachedTextDecoder$1.decode();
678
+ const MAX_SAFARI_DECODE_BYTES$1 = 2146435072;
679
+ let numBytesDecoded$1 = 0;
680
+ function decodeText$1(ptr, len) {
681
+ numBytesDecoded$1 += len;
682
+ if (numBytesDecoded$1 >= MAX_SAFARI_DECODE_BYTES$1) {
683
+ cachedTextDecoder$1 = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
684
+ cachedTextDecoder$1.decode();
685
+ numBytesDecoded$1 = len;
985
686
  }
986
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
687
+ return cachedTextDecoder$1.decode(getUint8ArrayMemory0$1().subarray(ptr, ptr + len));
987
688
  }
988
689
 
989
- const cachedTextEncoder = new TextEncoder();
690
+ const cachedTextEncoder$1 = new TextEncoder();
990
691
 
991
- if (!('encodeInto' in cachedTextEncoder)) {
992
- cachedTextEncoder.encodeInto = function (arg, view) {
993
- const buf = cachedTextEncoder.encode(arg);
692
+ if (!('encodeInto' in cachedTextEncoder$1)) {
693
+ cachedTextEncoder$1.encodeInto = function (arg, view) {
694
+ const buf = cachedTextEncoder$1.encode(arg);
994
695
  view.set(buf);
995
696
  return {
996
697
  read: arg.length,
@@ -999,15 +700,115 @@ if (!('encodeInto' in cachedTextEncoder)) {
999
700
  };
1000
701
  }
1001
702
 
1002
- let WASM_VECTOR_LEN = 0;
703
+ let WASM_VECTOR_LEN$1 = 0;
1003
704
 
1004
- const PolygonizerWasmErrorFinalization = (typeof FinalizationRegistry === 'undefined')
1005
- ? { register: () => {}, unregister: () => {} }
1006
- : new FinalizationRegistry(ptr => wasm.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
705
+ let wasm$1;
706
+ function __wbg_finalize_init$1(instance, module) {
707
+ wasm$1 = instance.exports;
708
+ cachedDataViewMemory0$1 = null;
709
+ cachedFloat64ArrayMemory0$1 = null;
710
+ cachedUint32ArrayMemory0$1 = null;
711
+ cachedUint8ArrayMemory0$1 = null;
712
+ wasm$1.__wbindgen_start();
713
+ return wasm$1;
714
+ }
1007
715
 
1008
- const WasmPolygonResultFinalization = (typeof FinalizationRegistry === 'undefined')
1009
- ? { register: () => {}, unregister: () => {} }
1010
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
716
+ async function __wbg_load$1(module, imports) {
717
+ if (typeof Response === 'function' && module instanceof Response) {
718
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
719
+ try {
720
+ return await WebAssembly.instantiateStreaming(module, imports);
721
+ } catch (e) {
722
+ const validResponse = module.ok && expectedResponseType(module.type);
723
+
724
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
725
+ 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);
726
+
727
+ } else { throw e; }
728
+ }
729
+ }
730
+
731
+ const bytes = await module.arrayBuffer();
732
+ return await WebAssembly.instantiate(bytes, imports);
733
+ } else {
734
+ const instance = await WebAssembly.instantiate(module, imports);
735
+
736
+ if (instance instanceof WebAssembly.Instance) {
737
+ return { instance, module };
738
+ } else {
739
+ return instance;
740
+ }
741
+ }
742
+
743
+ function expectedResponseType(type) {
744
+ switch (type) {
745
+ case 'basic': case 'cors': case 'default': return true;
746
+ }
747
+ return false;
748
+ }
749
+ }
750
+
751
+ function initSync$1(module) {
752
+ if (wasm$1 !== undefined) return wasm$1;
753
+
754
+
755
+ if (module !== undefined) {
756
+ if (Object.getPrototypeOf(module) === Object.prototype) {
757
+ ({module} = module);
758
+ } else {
759
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
760
+ }
761
+ }
762
+
763
+ const imports = __wbg_get_imports$1();
764
+ if (!(module instanceof WebAssembly.Module)) {
765
+ module = new WebAssembly.Module(module);
766
+ }
767
+ const instance = new WebAssembly.Instance(module, imports);
768
+ return __wbg_finalize_init$1(instance);
769
+ }
770
+
771
+ async function __wbg_init$1(module_or_path) {
772
+ if (wasm$1 !== undefined) return wasm$1;
773
+
774
+
775
+ if (module_or_path !== undefined) {
776
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
777
+ ({module_or_path} = module_or_path);
778
+ } else {
779
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead');
780
+ }
781
+ }
782
+
783
+ if (module_or_path === undefined) {
784
+ module_or_path = new URL('geo_polygonize_bg.wasm', import.meta.url);
785
+ }
786
+ const imports = __wbg_get_imports$1();
787
+
788
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
789
+ module_or_path = fetch(module_or_path);
790
+ }
791
+
792
+ const { instance, module } = await __wbg_load$1(await module_or_path, imports);
793
+
794
+ return __wbg_finalize_init$1(instance);
795
+ }
796
+
797
+ var scalarExports = /*#__PURE__*/Object.freeze({
798
+ __proto__: null,
799
+ PolygonizerWasmError: PolygonizerWasmError$1,
800
+ WasmPolygonResult: WasmPolygonResult$1,
801
+ default: __wbg_init$1,
802
+ initSync: initSync$1,
803
+ polygonize: polygonize$1,
804
+ polygonizeGeoArrowWithOptions: polygonizeGeoArrowWithOptions$1,
805
+ polygonizeWithOptions: polygonizeWithOptions$1,
806
+ polygonizeWithOptionsBuffer: polygonizeWithOptionsBuffer$1,
807
+ polygonize_buffers: polygonize_buffers$1,
808
+ polygonize_geoarrow: polygonize_geoarrow$1
809
+ });
810
+
811
+ /* @ts-self-types="./geo_polygonize.d.ts" */
1011
812
 
1012
813
  class PolygonizerWasmError {
1013
814
  static __wrap(ptr) {
@@ -1027,28 +828,14 @@ class PolygonizerWasmError {
1027
828
  const ptr = this.__destroy_into_raw();
1028
829
  wasm.__wbg_polygonizerwasmerror_free(ptr, 0);
1029
830
  }
1030
- /**
1031
- * @param {string} name
1032
- * @param {string} message
1033
- */
1034
- constructor(name, message) {
1035
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1036
- const len0 = WASM_VECTOR_LEN;
1037
- const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1038
- const len1 = WASM_VECTOR_LEN;
1039
- const ret = wasm.polygonizerwasmerror_new(ptr0, len0, ptr1, len1);
1040
- this.__wbg_ptr = ret >>> 0;
1041
- PolygonizerWasmErrorFinalization.register(this, this.__wbg_ptr, this);
1042
- return this;
1043
- }
1044
831
  /**
1045
832
  * @returns {string}
1046
833
  */
1047
- get name() {
834
+ get message() {
1048
835
  let deferred1_0;
1049
836
  let deferred1_1;
1050
837
  try {
1051
- const ret = wasm.polygonizerwasmerror_name(this.__wbg_ptr);
838
+ const ret = wasm.polygonizerwasmerror_message(this.__wbg_ptr);
1052
839
  deferred1_0 = ret[0];
1053
840
  deferred1_1 = ret[1];
1054
841
  return getStringFromWasm0(ret[0], ret[1]);
@@ -1059,11 +846,11 @@ class PolygonizerWasmError {
1059
846
  /**
1060
847
  * @returns {string}
1061
848
  */
1062
- get message() {
849
+ get name() {
1063
850
  let deferred1_0;
1064
851
  let deferred1_1;
1065
852
  try {
1066
- const ret = wasm.polygonizerwasmerror_message(this.__wbg_ptr);
853
+ const ret = wasm.polygonizerwasmerror_name(this.__wbg_ptr);
1067
854
  deferred1_0 = ret[0];
1068
855
  deferred1_1 = ret[1];
1069
856
  return getStringFromWasm0(ret[0], ret[1]);
@@ -1071,6 +858,20 @@ class PolygonizerWasmError {
1071
858
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1072
859
  }
1073
860
  }
861
+ /**
862
+ * @param {string} name
863
+ * @param {string} message
864
+ */
865
+ constructor(name, message) {
866
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
867
+ const len0 = WASM_VECTOR_LEN;
868
+ const ptr1 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
869
+ const len1 = WASM_VECTOR_LEN;
870
+ const ret = wasm.polygonizerwasmerror_new(ptr0, len0, ptr1, len1);
871
+ this.__wbg_ptr = ret >>> 0;
872
+ PolygonizerWasmErrorFinalization.register(this, this.__wbg_ptr, this);
873
+ return this;
874
+ }
1074
875
  }
1075
876
  if (Symbol.dispose) PolygonizerWasmError.prototype[Symbol.dispose] = PolygonizerWasmError.prototype.free;
1076
877
 
@@ -1106,13 +907,6 @@ class WasmPolygonResult {
1106
907
  const ret = wasm.wasmpolygonresult_coords_ptr(this.__wbg_ptr);
1107
908
  return ret >>> 0;
1108
909
  }
1109
- /**
1110
- * @returns {any}
1111
- */
1112
- get provenance() {
1113
- const ret = wasm.wasmpolygonresult_provenance(this.__wbg_ptr);
1114
- return ret;
1115
- }
1116
910
  /**
1117
911
  * @returns {any}
1118
912
  */
@@ -1123,43 +917,50 @@ class WasmPolygonResult {
1123
917
  /**
1124
918
  * @returns {number}
1125
919
  */
1126
- ring_offsets_len() {
1127
- const ret = wasm.wasmpolygonresult_ring_offsets_len(this.__wbg_ptr);
920
+ flat_line_ids_len() {
921
+ const ret = wasm.wasmpolygonresult_flat_line_ids_len(this.__wbg_ptr);
1128
922
  return ret >>> 0;
1129
923
  }
1130
924
  /**
1131
925
  * @returns {number}
1132
926
  */
1133
- ring_offsets_ptr() {
1134
- const ret = wasm.wasmpolygonresult_ring_offsets_ptr(this.__wbg_ptr);
927
+ flat_line_ids_ptr() {
928
+ const ret = wasm.wasmpolygonresult_flat_line_ids_ptr(this.__wbg_ptr);
1135
929
  return ret >>> 0;
1136
930
  }
1137
931
  /**
1138
932
  * @returns {number}
1139
933
  */
1140
- flat_line_ids_len() {
1141
- const ret = wasm.wasmpolygonresult_flat_line_ids_len(this.__wbg_ptr);
934
+ polygon_offsets_len() {
935
+ const ret = wasm.wasmpolygonresult_polygon_offsets_len(this.__wbg_ptr);
1142
936
  return ret >>> 0;
1143
937
  }
1144
938
  /**
1145
939
  * @returns {number}
1146
940
  */
1147
- flat_line_ids_ptr() {
1148
- const ret = wasm.wasmpolygonresult_flat_line_ids_ptr(this.__wbg_ptr);
941
+ polygon_offsets_ptr() {
942
+ const ret = wasm.wasmpolygonresult_polygon_offsets_ptr(this.__wbg_ptr);
1149
943
  return ret >>> 0;
1150
944
  }
945
+ /**
946
+ * @returns {any}
947
+ */
948
+ get provenance() {
949
+ const ret = wasm.wasmpolygonresult_provenance(this.__wbg_ptr);
950
+ return ret;
951
+ }
1151
952
  /**
1152
953
  * @returns {number}
1153
954
  */
1154
- polygon_offsets_len() {
1155
- const ret = wasm.wasmpolygonresult_polygon_offsets_len(this.__wbg_ptr);
955
+ ring_offsets_len() {
956
+ const ret = wasm.wasmpolygonresult_ring_offsets_len(this.__wbg_ptr);
1156
957
  return ret >>> 0;
1157
958
  }
1158
959
  /**
1159
960
  * @returns {number}
1160
961
  */
1161
- polygon_offsets_ptr() {
1162
- const ret = wasm.wasmpolygonresult_polygon_offsets_ptr(this.__wbg_ptr);
962
+ ring_offsets_ptr() {
963
+ const ret = wasm.wasmpolygonresult_ring_offsets_ptr(this.__wbg_ptr);
1163
964
  return ret >>> 0;
1164
965
  }
1165
966
  /**
@@ -1202,6 +1003,11 @@ function polygonize(geojson_str, node_input, snap_grid_size, extract_only_polygo
1202
1003
  }
1203
1004
 
1204
1005
  /**
1006
+ * Polygonizes an Arrow IPC stream containing a GeoArrow LineString array.
1007
+ *
1008
+ * This zero-copy path avoids JSON serialization overhead and returns a binary
1009
+ * Arrow IPC stream containing a GeoArrow Polygon array. Requires the options
1010
+ * to be passed as a parsed JS object.
1205
1011
  * @param {Uint8Array} ipc_bytes
1206
1012
  * @param {any} options_val
1207
1013
  * @returns {Uint8Array}
@@ -1219,6 +1025,11 @@ function polygonizeGeoArrowWithOptions(ipc_bytes, options_val) {
1219
1025
  }
1220
1026
 
1221
1027
  /**
1028
+ * Polygonizes a GeoJSON FeatureCollection using the canonical `PolygonizerOptions`.
1029
+ *
1030
+ * This is the primary entry point for JavaScript users. It accepts a JSON string
1031
+ * of options and returns a JSON string representing the result, including faces,
1032
+ * dangles, cut-lines, and (optionally) provenance/diagnostics.
1222
1033
  * @param {string} geojson_str
1223
1034
  * @param {any} options_val
1224
1035
  * @returns {string}
@@ -1308,235 +1119,450 @@ function polygonize_geoarrow(ipc_bytes, node_input, snap_grid_size, extract_only
1308
1119
  return v2;
1309
1120
  }
1310
1121
 
1311
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1312
-
1313
- async function __wbg_load(module, imports) {
1314
- if (typeof Response === 'function' && module instanceof Response) {
1315
- if (typeof WebAssembly.instantiateStreaming === 'function') {
1122
+ function __wbg_get_imports() {
1123
+ const import0 = {
1124
+ __proto__: null,
1125
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
1126
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1127
+ return ret;
1128
+ },
1129
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
1130
+ const ret = String(arg1);
1131
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1132
+ const len1 = WASM_VECTOR_LEN;
1133
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1134
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1135
+ },
1136
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
1137
+ const v = arg0;
1138
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1139
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1140
+ },
1141
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
1142
+ const ret = debugString(arg1);
1143
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1144
+ const len1 = WASM_VECTOR_LEN;
1145
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1146
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1147
+ },
1148
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
1149
+ const ret = arg0 in arg1;
1150
+ return ret;
1151
+ },
1152
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
1153
+ const val = arg0;
1154
+ const ret = typeof(val) === 'object' && val !== null;
1155
+ return ret;
1156
+ },
1157
+ __wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
1158
+ const ret = typeof(arg0) === 'string';
1159
+ return ret;
1160
+ },
1161
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
1162
+ const ret = arg0 === undefined;
1163
+ return ret;
1164
+ },
1165
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
1166
+ const ret = arg0 == arg1;
1167
+ return ret;
1168
+ },
1169
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
1170
+ const obj = arg1;
1171
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1172
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1173
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1174
+ },
1175
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
1176
+ const obj = arg1;
1177
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1178
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1179
+ var len1 = WASM_VECTOR_LEN;
1180
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1181
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1182
+ },
1183
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
1184
+ throw new Error(getStringFromWasm0(arg0, arg1));
1185
+ },
1186
+ __wbg_entries_e8a20ff8c9757101: function(arg0) {
1187
+ const ret = Object.entries(arg0);
1188
+ return ret;
1189
+ },
1190
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
1191
+ let deferred0_0;
1192
+ let deferred0_1;
1316
1193
  try {
1317
- return await WebAssembly.instantiateStreaming(module, imports);
1318
- } catch (e) {
1319
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1320
-
1321
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1322
- 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);
1323
-
1324
- } else {
1325
- throw e;
1326
- }
1194
+ deferred0_0 = arg0;
1195
+ deferred0_1 = arg1;
1196
+ console.error(getStringFromWasm0(arg0, arg1));
1197
+ } finally {
1198
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1327
1199
  }
1328
- }
1200
+ },
1201
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
1202
+ const ret = arg0[arg1 >>> 0];
1203
+ return ret;
1204
+ },
1205
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
1206
+ const ret = arg0[arg1];
1207
+ return ret;
1208
+ },
1209
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
1210
+ let result;
1211
+ try {
1212
+ result = arg0 instanceof ArrayBuffer;
1213
+ } catch (_) {
1214
+ result = false;
1215
+ }
1216
+ const ret = result;
1217
+ return ret;
1218
+ },
1219
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
1220
+ let result;
1221
+ try {
1222
+ result = arg0 instanceof Uint8Array;
1223
+ } catch (_) {
1224
+ result = false;
1225
+ }
1226
+ const ret = result;
1227
+ return ret;
1228
+ },
1229
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
1230
+ const ret = arg0.length;
1231
+ return ret;
1232
+ },
1233
+ __wbg_length_ea16607d7b61445b: function(arg0) {
1234
+ const ret = arg0.length;
1235
+ return ret;
1236
+ },
1237
+ __wbg_new_227d7c05414eb861: function() {
1238
+ const ret = new Error();
1239
+ return ret;
1240
+ },
1241
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
1242
+ const ret = new Uint8Array(arg0);
1243
+ return ret;
1244
+ },
1245
+ __wbg_new_a70fbab9066b301f: function() {
1246
+ const ret = new Array();
1247
+ return ret;
1248
+ },
1249
+ __wbg_new_ab79df5bd7c26067: function() {
1250
+ const ret = new Object();
1251
+ return ret;
1252
+ },
1253
+ __wbg_polygonizerwasmerror_new: function(arg0) {
1254
+ const ret = PolygonizerWasmError.__wrap(arg0);
1255
+ return ret;
1256
+ },
1257
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
1258
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1259
+ },
1260
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
1261
+ arg0[arg1 >>> 0] = arg2;
1262
+ },
1263
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1264
+ arg0[arg1] = arg2;
1265
+ },
1266
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
1267
+ const ret = arg1.stack;
1268
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1269
+ const len1 = WASM_VECTOR_LEN;
1270
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1271
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1272
+ },
1273
+ __wbindgen_cast_0000000000000001: function(arg0) {
1274
+ // Cast intrinsic for `F64 -> Externref`.
1275
+ const ret = arg0;
1276
+ return ret;
1277
+ },
1278
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1279
+ // Cast intrinsic for `Ref(String) -> Externref`.
1280
+ const ret = getStringFromWasm0(arg0, arg1);
1281
+ return ret;
1282
+ },
1283
+ __wbindgen_cast_0000000000000003: function(arg0) {
1284
+ // Cast intrinsic for `U64 -> Externref`.
1285
+ const ret = BigInt.asUintN(64, arg0);
1286
+ return ret;
1287
+ },
1288
+ __wbindgen_init_externref_table: function() {
1289
+ const table = wasm.__wbindgen_externrefs;
1290
+ const offset = table.grow(4);
1291
+ table.set(0, undefined);
1292
+ table.set(offset + 0, undefined);
1293
+ table.set(offset + 1, null);
1294
+ table.set(offset + 2, true);
1295
+ table.set(offset + 3, false);
1296
+ },
1297
+ };
1298
+ return {
1299
+ __proto__: null,
1300
+ "./geo_polygonize_bg.js": import0,
1301
+ };
1302
+ }
1329
1303
 
1330
- const bytes = await module.arrayBuffer();
1331
- return await WebAssembly.instantiate(bytes, imports);
1332
- } else {
1333
- const instance = await WebAssembly.instantiate(module, imports);
1304
+ const PolygonizerWasmErrorFinalization = (typeof FinalizationRegistry === 'undefined')
1305
+ ? { register: () => {}, unregister: () => {} }
1306
+ : new FinalizationRegistry(ptr => wasm.__wbg_polygonizerwasmerror_free(ptr >>> 0, 1));
1307
+ const WasmPolygonResultFinalization = (typeof FinalizationRegistry === 'undefined')
1308
+ ? { register: () => {}, unregister: () => {} }
1309
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
1334
1310
 
1335
- if (instance instanceof WebAssembly.Instance) {
1336
- return { instance, module };
1311
+ function debugString(val) {
1312
+ // primitive types
1313
+ const type = typeof val;
1314
+ if (type == 'number' || type == 'boolean' || val == null) {
1315
+ return `${val}`;
1316
+ }
1317
+ if (type == 'string') {
1318
+ return `"${val}"`;
1319
+ }
1320
+ if (type == 'symbol') {
1321
+ const description = val.description;
1322
+ if (description == null) {
1323
+ return 'Symbol';
1337
1324
  } else {
1338
- return instance;
1325
+ return `Symbol(${description})`;
1339
1326
  }
1340
1327
  }
1341
- }
1342
-
1343
- function __wbg_get_imports() {
1344
- const imports = {};
1345
- imports.wbg = {};
1346
- imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
1347
- const ret = Error(getStringFromWasm0(arg0, arg1));
1348
- return ret;
1349
- };
1350
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1351
- const ret = String(arg1);
1352
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1353
- const len1 = WASM_VECTOR_LEN;
1354
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1355
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1356
- };
1357
- imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
1358
- const v = arg0;
1359
- const ret = typeof(v) === 'boolean' ? v : undefined;
1360
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1361
- };
1362
- imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
1363
- const ret = debugString(arg1);
1364
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1365
- const len1 = WASM_VECTOR_LEN;
1366
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1367
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1368
- };
1369
- imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
1370
- const ret = arg0 in arg1;
1371
- return ret;
1372
- };
1373
- imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
1374
- const val = arg0;
1375
- const ret = typeof(val) === 'object' && val !== null;
1376
- return ret;
1377
- };
1378
- imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
1379
- const ret = typeof(arg0) === 'string';
1380
- return ret;
1381
- };
1382
- imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
1383
- const ret = arg0 === undefined;
1384
- return ret;
1385
- };
1386
- imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
1387
- const ret = arg0 == arg1;
1388
- return ret;
1389
- };
1390
- imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1391
- const obj = arg1;
1392
- const ret = typeof(obj) === 'number' ? obj : undefined;
1393
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1394
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1395
- };
1396
- imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
1397
- const obj = arg1;
1398
- const ret = typeof(obj) === 'string' ? obj : undefined;
1399
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1400
- var len1 = WASM_VECTOR_LEN;
1401
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1402
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1403
- };
1404
- imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1405
- throw new Error(getStringFromWasm0(arg0, arg1));
1406
- };
1407
- imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
1408
- const ret = Object.entries(arg0);
1409
- return ret;
1410
- };
1411
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1412
- let deferred0_0;
1413
- let deferred0_1;
1414
- try {
1415
- deferred0_0 = arg0;
1416
- deferred0_1 = arg1;
1417
- console.error(getStringFromWasm0(arg0, arg1));
1418
- } finally {
1419
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1328
+ if (type == 'function') {
1329
+ const name = val.name;
1330
+ if (typeof name == 'string' && name.length > 0) {
1331
+ return `Function(${name})`;
1332
+ } else {
1333
+ return 'Function';
1420
1334
  }
1421
- };
1422
- imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1423
- const ret = arg0[arg1 >>> 0];
1424
- return ret;
1425
- };
1426
- imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1427
- const ret = arg0[arg1];
1428
- return ret;
1429
- };
1430
- imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1431
- let result;
1432
- try {
1433
- result = arg0 instanceof ArrayBuffer;
1434
- } catch (_) {
1435
- result = false;
1335
+ }
1336
+ // objects
1337
+ if (Array.isArray(val)) {
1338
+ const length = val.length;
1339
+ let debug = '[';
1340
+ if (length > 0) {
1341
+ debug += debugString(val[0]);
1436
1342
  }
1437
- const ret = result;
1438
- return ret;
1439
- };
1440
- imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1441
- let result;
1343
+ for(let i = 1; i < length; i++) {
1344
+ debug += ', ' + debugString(val[i]);
1345
+ }
1346
+ debug += ']';
1347
+ return debug;
1348
+ }
1349
+ // Test for built-in
1350
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1351
+ let className;
1352
+ if (builtInMatches && builtInMatches.length > 1) {
1353
+ className = builtInMatches[1];
1354
+ } else {
1355
+ // Failed to match the standard '[object ClassName]'
1356
+ return toString.call(val);
1357
+ }
1358
+ if (className == 'Object') {
1359
+ // we're a user defined class or Object
1360
+ // JSON.stringify avoids problems with cycles, and is generally much
1361
+ // easier than looping through ownProperties of `val`.
1442
1362
  try {
1443
- result = arg0 instanceof Uint8Array;
1363
+ return 'Object(' + JSON.stringify(val) + ')';
1444
1364
  } catch (_) {
1445
- result = false;
1365
+ return 'Object';
1446
1366
  }
1447
- const ret = result;
1448
- return ret;
1449
- };
1450
- imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1451
- const ret = arg0.length;
1452
- return ret;
1453
- };
1454
- imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1455
- const ret = arg0.length;
1456
- return ret;
1457
- };
1458
- imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
1459
- const ret = new Object();
1460
- return ret;
1461
- };
1462
- imports.wbg.__wbg_new_25f239778d6112b9 = function() {
1463
- const ret = new Array();
1464
- return ret;
1465
- };
1466
- imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1467
- const ret = new Uint8Array(arg0);
1468
- return ret;
1469
- };
1470
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1471
- const ret = new Error();
1472
- return ret;
1473
- };
1474
- imports.wbg.__wbg_polygonizerwasmerror_new = function(arg0) {
1475
- const ret = PolygonizerWasmError.__wrap(arg0);
1476
- return ret;
1477
- };
1478
- imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1479
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1480
- };
1481
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1482
- arg0[arg1] = arg2;
1483
- };
1484
- imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1485
- arg0[arg1 >>> 0] = arg2;
1486
- };
1487
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1488
- const ret = arg1.stack;
1489
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1490
- const len1 = WASM_VECTOR_LEN;
1491
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1492
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1493
- };
1494
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1495
- // Cast intrinsic for `Ref(String) -> Externref`.
1496
- const ret = getStringFromWasm0(arg0, arg1);
1497
- return ret;
1498
- };
1499
- imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1500
- // Cast intrinsic for `U64 -> Externref`.
1501
- const ret = BigInt.asUintN(64, arg0);
1502
- return ret;
1503
- };
1504
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1505
- // Cast intrinsic for `F64 -> Externref`.
1506
- const ret = arg0;
1507
- return ret;
1508
- };
1509
- imports.wbg.__wbindgen_init_externref_table = function() {
1510
- const table = wasm.__wbindgen_externrefs;
1511
- const offset = table.grow(4);
1512
- table.set(0, undefined);
1513
- table.set(offset + 0, undefined);
1514
- table.set(offset + 1, null);
1515
- table.set(offset + 2, true);
1516
- table.set(offset + 3, false);
1517
- };
1367
+ }
1368
+ // errors
1369
+ if (val instanceof Error) {
1370
+ return `${val.name}: ${val.message}\n${val.stack}`;
1371
+ }
1372
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1373
+ return className;
1374
+ }
1375
+
1376
+ function getArrayU8FromWasm0(ptr, len) {
1377
+ ptr = ptr >>> 0;
1378
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1379
+ }
1380
+
1381
+ let cachedDataViewMemory0 = null;
1382
+ function getDataViewMemory0() {
1383
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1384
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1385
+ }
1386
+ return cachedDataViewMemory0;
1387
+ }
1518
1388
 
1519
- return imports;
1389
+ let cachedFloat64ArrayMemory0 = null;
1390
+ function getFloat64ArrayMemory0() {
1391
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1392
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1393
+ }
1394
+ return cachedFloat64ArrayMemory0;
1395
+ }
1396
+
1397
+ function getStringFromWasm0(ptr, len) {
1398
+ ptr = ptr >>> 0;
1399
+ return decodeText(ptr, len);
1400
+ }
1401
+
1402
+ let cachedUint32ArrayMemory0 = null;
1403
+ function getUint32ArrayMemory0() {
1404
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1405
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1406
+ }
1407
+ return cachedUint32ArrayMemory0;
1408
+ }
1409
+
1410
+ let cachedUint8ArrayMemory0 = null;
1411
+ function getUint8ArrayMemory0() {
1412
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1413
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1414
+ }
1415
+ return cachedUint8ArrayMemory0;
1416
+ }
1417
+
1418
+ function isLikeNone(x) {
1419
+ return x === undefined || x === null;
1420
+ }
1421
+
1422
+ function passArray32ToWasm0(arg, malloc) {
1423
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1424
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1425
+ WASM_VECTOR_LEN = arg.length;
1426
+ return ptr;
1427
+ }
1428
+
1429
+ function passArray8ToWasm0(arg, malloc) {
1430
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1431
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1432
+ WASM_VECTOR_LEN = arg.length;
1433
+ return ptr;
1434
+ }
1435
+
1436
+ function passArrayF64ToWasm0(arg, malloc) {
1437
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
1438
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
1439
+ WASM_VECTOR_LEN = arg.length;
1440
+ return ptr;
1441
+ }
1442
+
1443
+ function passStringToWasm0(arg, malloc, realloc) {
1444
+ if (realloc === undefined) {
1445
+ const buf = cachedTextEncoder.encode(arg);
1446
+ const ptr = malloc(buf.length, 1) >>> 0;
1447
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1448
+ WASM_VECTOR_LEN = buf.length;
1449
+ return ptr;
1450
+ }
1451
+
1452
+ let len = arg.length;
1453
+ let ptr = malloc(len, 1) >>> 0;
1454
+
1455
+ const mem = getUint8ArrayMemory0();
1456
+
1457
+ let offset = 0;
1458
+
1459
+ for (; offset < len; offset++) {
1460
+ const code = arg.charCodeAt(offset);
1461
+ if (code > 0x7F) break;
1462
+ mem[ptr + offset] = code;
1463
+ }
1464
+ if (offset !== len) {
1465
+ if (offset !== 0) {
1466
+ arg = arg.slice(offset);
1467
+ }
1468
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1469
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1470
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1471
+
1472
+ offset += ret.written;
1473
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1474
+ }
1475
+
1476
+ WASM_VECTOR_LEN = offset;
1477
+ return ptr;
1478
+ }
1479
+
1480
+ function takeFromExternrefTable0(idx) {
1481
+ const value = wasm.__wbindgen_externrefs.get(idx);
1482
+ wasm.__externref_table_dealloc(idx);
1483
+ return value;
1484
+ }
1485
+
1486
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1487
+ cachedTextDecoder.decode();
1488
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1489
+ let numBytesDecoded = 0;
1490
+ function decodeText(ptr, len) {
1491
+ numBytesDecoded += len;
1492
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1493
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1494
+ cachedTextDecoder.decode();
1495
+ numBytesDecoded = len;
1496
+ }
1497
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1498
+ }
1499
+
1500
+ const cachedTextEncoder = new TextEncoder();
1501
+
1502
+ if (!('encodeInto' in cachedTextEncoder)) {
1503
+ cachedTextEncoder.encodeInto = function (arg, view) {
1504
+ const buf = cachedTextEncoder.encode(arg);
1505
+ view.set(buf);
1506
+ return {
1507
+ read: arg.length,
1508
+ written: buf.length
1509
+ };
1510
+ };
1520
1511
  }
1521
1512
 
1513
+ let WASM_VECTOR_LEN = 0;
1514
+
1515
+ let wasm;
1522
1516
  function __wbg_finalize_init(instance, module) {
1523
1517
  wasm = instance.exports;
1524
- __wbg_init.__wbindgen_wasm_module = module;
1525
1518
  cachedDataViewMemory0 = null;
1526
1519
  cachedFloat64ArrayMemory0 = null;
1527
1520
  cachedUint32ArrayMemory0 = null;
1528
1521
  cachedUint8ArrayMemory0 = null;
1529
-
1530
-
1531
1522
  wasm.__wbindgen_start();
1532
1523
  return wasm;
1533
1524
  }
1534
1525
 
1526
+ async function __wbg_load(module, imports) {
1527
+ if (typeof Response === 'function' && module instanceof Response) {
1528
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1529
+ try {
1530
+ return await WebAssembly.instantiateStreaming(module, imports);
1531
+ } catch (e) {
1532
+ const validResponse = module.ok && expectedResponseType(module.type);
1533
+
1534
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1535
+ 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);
1536
+
1537
+ } else { throw e; }
1538
+ }
1539
+ }
1540
+
1541
+ const bytes = await module.arrayBuffer();
1542
+ return await WebAssembly.instantiate(bytes, imports);
1543
+ } else {
1544
+ const instance = await WebAssembly.instantiate(module, imports);
1545
+
1546
+ if (instance instanceof WebAssembly.Instance) {
1547
+ return { instance, module };
1548
+ } else {
1549
+ return instance;
1550
+ }
1551
+ }
1552
+
1553
+ function expectedResponseType(type) {
1554
+ switch (type) {
1555
+ case 'basic': case 'cors': case 'default': return true;
1556
+ }
1557
+ return false;
1558
+ }
1559
+ }
1560
+
1535
1561
  function initSync(module) {
1536
1562
  if (wasm !== undefined) return wasm;
1537
1563
 
1538
1564
 
1539
- if (typeof module !== 'undefined') {
1565
+ if (module !== undefined) {
1540
1566
  if (Object.getPrototypeOf(module) === Object.prototype) {
1541
1567
  ({module} = module);
1542
1568
  } else {
@@ -1549,14 +1575,14 @@ function initSync(module) {
1549
1575
  module = new WebAssembly.Module(module);
1550
1576
  }
1551
1577
  const instance = new WebAssembly.Instance(module, imports);
1552
- return __wbg_finalize_init(instance, module);
1578
+ return __wbg_finalize_init(instance);
1553
1579
  }
1554
1580
 
1555
1581
  async function __wbg_init(module_or_path) {
1556
1582
  if (wasm !== undefined) return wasm;
1557
1583
 
1558
1584
 
1559
- if (typeof module_or_path !== 'undefined') {
1585
+ if (module_or_path !== undefined) {
1560
1586
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1561
1587
  ({module_or_path} = module_or_path);
1562
1588
  } else {
@@ -1564,7 +1590,7 @@ async function __wbg_init(module_or_path) {
1564
1590
  }
1565
1591
  }
1566
1592
 
1567
- if (typeof module_or_path === 'undefined') {
1593
+ if (module_or_path === undefined) {
1568
1594
  module_or_path = new URL('geo_polygonize_bg.wasm', import.meta.url);
1569
1595
  }
1570
1596
  const imports = __wbg_get_imports();
@@ -1575,7 +1601,7 @@ async function __wbg_init(module_or_path) {
1575
1601
 
1576
1602
  const { instance, module } = await __wbg_load(await module_or_path, imports);
1577
1603
 
1578
- return __wbg_finalize_init(instance, module);
1604
+ return __wbg_finalize_init(instance);
1579
1605
  }
1580
1606
 
1581
1607
  var simdExports = /*#__PURE__*/Object.freeze({