geo-polygonize 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import * as scalarExports from "../pkg-scalar/geo_polygonize.js";
2
+ export * from "../pkg-scalar/geo_polygonize.js";
3
+ export declare function initBest(scalarModule: any, simdModule: any): Promise<typeof scalarExports>;
@@ -0,0 +1,3 @@
1
+ export * from "../pkg-threads/geo_polygonize.js";
2
+ import init from "../pkg-threads/geo_polygonize.js";
3
+ export default init;
@@ -0,0 +1,3 @@
1
+ import * as exports from "../pkg-scalar/geo_polygonize.js";
2
+ export * from "../pkg-scalar/geo_polygonize.js";
3
+ export default function init(_input?: any): Promise<typeof exports>;
@@ -0,0 +1,652 @@
1
+ /*
2
+ * Copyright 2022 Google Inc. All Rights Reserved.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+
14
+ // Note: we use `wasm_bindgen_worker_`-prefixed message types to make sure
15
+ // we can handle bundling into other files, which might happen to have their
16
+ // own `postMessage`/`onmessage` communication channels.
17
+ //
18
+ // If we didn't take that into the account, we could send much simpler signals
19
+ // like just `0` or whatever, but the code would be less resilient.
20
+
21
+ function waitForMsgType(target, type) {
22
+ return new Promise(resolve => {
23
+ target.addEventListener('message', function onMsg({ data }) {
24
+ if (data?.type !== type) return;
25
+ target.removeEventListener('message', onMsg);
26
+ resolve(data);
27
+ });
28
+ });
29
+ }
30
+
31
+ waitForMsgType(self, 'wasm_bindgen_worker_init').then(async ({ init, receiver }) => {
32
+ // # Note 1
33
+ // Our JS should have been generated in
34
+ // `[out-dir]/snippets/wasm-bindgen-rayon-[hash]/workerHelpers.js`,
35
+ // resolve the main module via `../../..`.
36
+ //
37
+ // This might need updating if the generated structure changes on wasm-bindgen
38
+ // side ever in the future, but works well with bundlers today. The whole
39
+ // point of this crate, after all, is to abstract away unstable features
40
+ // and temporary bugs so that you don't need to deal with them in your code.
41
+ //
42
+ // # Note 2
43
+ // This could be a regular import, but then some bundlers complain about
44
+ // circular deps.
45
+ //
46
+ // Dynamic import could be cheap if this file was inlined into the parent,
47
+ // which would require us just using `../../..` in `new Worker` below,
48
+ // but that doesn't work because wasm-pack unconditionally adds
49
+ // "sideEffects":false (see below).
50
+ //
51
+ // OTOH, even though it can't be inlined, it should be still reasonably
52
+ // cheap since the requested file is already in cache (it was loaded by
53
+ // the main thread).
54
+ const pkg = await Promise.resolve().then(function () { return geo_polygonize; });
55
+ await pkg.default(init);
56
+ postMessage({ type: 'wasm_bindgen_worker_ready' });
57
+ pkg.wbg_rayon_start_worker(receiver);
58
+ });
59
+
60
+ async function startWorkers(module, memory, builder) {
61
+ if (builder.numThreads() === 0) {
62
+ throw new Error(`num_threads must be > 0.`);
63
+ }
64
+
65
+ const workerInit = {
66
+ type: 'wasm_bindgen_worker_init',
67
+ init: { module_or_path: module, memory },
68
+ receiver: builder.receiver()
69
+ };
70
+
71
+ await Promise.all(
72
+ Array.from({ length: builder.numThreads() }, async () => {
73
+ // Self-spawn into a new Worker.
74
+ //
75
+ // TODO: while `new URL('...', import.meta.url) becomes a semi-standard
76
+ // way to get asset URLs relative to the module across various bundlers
77
+ // and browser, ideally we should switch to `import.meta.resolve`
78
+ // once it becomes a standard.
79
+ //
80
+ // Note: we could use `../../..` as the URL here to inline workerHelpers.js
81
+ // into the parent entry instead of creating another split point -
82
+ // this would be preferable from optimization perspective -
83
+ // however, Webpack then eliminates all message handler code
84
+ // because wasm-pack produces "sideEffects":false in package.json
85
+ // unconditionally.
86
+ //
87
+ // The only way to work around that is to have side effect code
88
+ // in an entry point such as Worker file itself.
89
+ const worker = new Worker(new URL('./workerHelpers.js', import.meta.url), {
90
+ type: 'module'
91
+ });
92
+ worker.postMessage(workerInit);
93
+ await waitForMsgType(worker, 'wasm_bindgen_worker_ready');
94
+ return worker;
95
+ })
96
+ );
97
+ builder.build();
98
+ }
99
+
100
+ let wasm;
101
+
102
+ function addToExternrefTable0(obj) {
103
+ const idx = wasm.__externref_table_alloc();
104
+ wasm.__wbindgen_externrefs.set(idx, obj);
105
+ return idx;
106
+ }
107
+
108
+ function getArrayU8FromWasm0(ptr, len) {
109
+ ptr = ptr >>> 0;
110
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
111
+ }
112
+
113
+ let cachedDataViewMemory0 = null;
114
+ function getDataViewMemory0() {
115
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
116
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
117
+ }
118
+ return cachedDataViewMemory0;
119
+ }
120
+
121
+ let cachedFloat64ArrayMemory0 = null;
122
+ function getFloat64ArrayMemory0() {
123
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
124
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
125
+ }
126
+ return cachedFloat64ArrayMemory0;
127
+ }
128
+
129
+ function getStringFromWasm0(ptr, len) {
130
+ ptr = ptr >>> 0;
131
+ return decodeText(ptr, len);
132
+ }
133
+
134
+ let cachedUint32ArrayMemory0 = null;
135
+ function getUint32ArrayMemory0() {
136
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
137
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
138
+ }
139
+ return cachedUint32ArrayMemory0;
140
+ }
141
+
142
+ let cachedUint8ArrayMemory0 = null;
143
+ function getUint8ArrayMemory0() {
144
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
145
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
146
+ }
147
+ return cachedUint8ArrayMemory0;
148
+ }
149
+
150
+ function handleError(f, args) {
151
+ try {
152
+ return f.apply(this, args);
153
+ } catch (e) {
154
+ const idx = addToExternrefTable0(e);
155
+ wasm.__wbindgen_exn_store(idx);
156
+ }
157
+ }
158
+
159
+ function isLikeNone(x) {
160
+ return x === undefined || x === null;
161
+ }
162
+
163
+ function passArray32ToWasm0(arg, malloc) {
164
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
165
+ getUint32ArrayMemory0().set(arg, ptr / 4);
166
+ WASM_VECTOR_LEN = arg.length;
167
+ return ptr;
168
+ }
169
+
170
+ function passArray8ToWasm0(arg, malloc) {
171
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
172
+ getUint8ArrayMemory0().set(arg, ptr / 1);
173
+ WASM_VECTOR_LEN = arg.length;
174
+ return ptr;
175
+ }
176
+
177
+ function passArrayF64ToWasm0(arg, malloc) {
178
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
179
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
180
+ WASM_VECTOR_LEN = arg.length;
181
+ return ptr;
182
+ }
183
+
184
+ function passStringToWasm0(arg, malloc, realloc) {
185
+ if (realloc === undefined) {
186
+ const buf = cachedTextEncoder.encode(arg);
187
+ const ptr = malloc(buf.length, 1) >>> 0;
188
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
189
+ WASM_VECTOR_LEN = buf.length;
190
+ return ptr;
191
+ }
192
+
193
+ let len = arg.length;
194
+ let ptr = malloc(len, 1) >>> 0;
195
+
196
+ const mem = getUint8ArrayMemory0();
197
+
198
+ let offset = 0;
199
+
200
+ for (; offset < len; offset++) {
201
+ const code = arg.charCodeAt(offset);
202
+ if (code > 0x7F) break;
203
+ mem[ptr + offset] = code;
204
+ }
205
+ if (offset !== len) {
206
+ if (offset !== 0) {
207
+ arg = arg.slice(offset);
208
+ }
209
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
210
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
211
+ const ret = cachedTextEncoder.encodeInto(arg, view);
212
+
213
+ offset += ret.written;
214
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
215
+ }
216
+
217
+ WASM_VECTOR_LEN = offset;
218
+ return ptr;
219
+ }
220
+
221
+ function takeFromExternrefTable0(idx) {
222
+ const value = wasm.__wbindgen_externrefs.get(idx);
223
+ wasm.__externref_table_dealloc(idx);
224
+ return value;
225
+ }
226
+
227
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
228
+ cachedTextDecoder.decode();
229
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
230
+ let numBytesDecoded = 0;
231
+ function decodeText(ptr, len) {
232
+ numBytesDecoded += len;
233
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
234
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
235
+ cachedTextDecoder.decode();
236
+ numBytesDecoded = len;
237
+ }
238
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
239
+ }
240
+
241
+ const cachedTextEncoder = new TextEncoder();
242
+
243
+ if (!('encodeInto' in cachedTextEncoder)) {
244
+ cachedTextEncoder.encodeInto = function (arg, view) {
245
+ const buf = cachedTextEncoder.encode(arg);
246
+ view.set(buf);
247
+ return {
248
+ read: arg.length,
249
+ written: buf.length
250
+ };
251
+ };
252
+ }
253
+
254
+ let WASM_VECTOR_LEN = 0;
255
+
256
+ const WasmPolygonResultFinalization = (typeof FinalizationRegistry === 'undefined')
257
+ ? { register: () => {}, unregister: () => {} }
258
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpolygonresult_free(ptr >>> 0, 1));
259
+
260
+ const wbg_rayon_PoolBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
261
+ ? { register: () => {}, unregister: () => {} }
262
+ : new FinalizationRegistry(ptr => wasm.__wbg_wbg_rayon_poolbuilder_free(ptr >>> 0, 1));
263
+
264
+ class WasmPolygonResult {
265
+ static __wrap(ptr) {
266
+ ptr = ptr >>> 0;
267
+ const obj = Object.create(WasmPolygonResult.prototype);
268
+ obj.__wbg_ptr = ptr;
269
+ WasmPolygonResultFinalization.register(obj, obj.__wbg_ptr, obj);
270
+ return obj;
271
+ }
272
+ __destroy_into_raw() {
273
+ const ptr = this.__wbg_ptr;
274
+ this.__wbg_ptr = 0;
275
+ WasmPolygonResultFinalization.unregister(this);
276
+ return ptr;
277
+ }
278
+ free() {
279
+ const ptr = this.__destroy_into_raw();
280
+ wasm.__wbg_wasmpolygonresult_free(ptr, 0);
281
+ }
282
+ /**
283
+ * @returns {number}
284
+ */
285
+ coords_len() {
286
+ const ret = wasm.wasmpolygonresult_coords_len(this.__wbg_ptr);
287
+ return ret >>> 0;
288
+ }
289
+ /**
290
+ * @returns {number}
291
+ */
292
+ coords_ptr() {
293
+ const ret = wasm.wasmpolygonresult_coords_ptr(this.__wbg_ptr);
294
+ return ret >>> 0;
295
+ }
296
+ /**
297
+ * @returns {number}
298
+ */
299
+ ring_offsets_len() {
300
+ const ret = wasm.wasmpolygonresult_ring_offsets_len(this.__wbg_ptr);
301
+ return ret >>> 0;
302
+ }
303
+ /**
304
+ * @returns {number}
305
+ */
306
+ ring_offsets_ptr() {
307
+ const ret = wasm.wasmpolygonresult_ring_offsets_ptr(this.__wbg_ptr);
308
+ return ret >>> 0;
309
+ }
310
+ /**
311
+ * @returns {number}
312
+ */
313
+ polygon_offsets_len() {
314
+ const ret = wasm.wasmpolygonresult_polygon_offsets_len(this.__wbg_ptr);
315
+ return ret >>> 0;
316
+ }
317
+ /**
318
+ * @returns {number}
319
+ */
320
+ polygon_offsets_ptr() {
321
+ const ret = wasm.wasmpolygonresult_polygon_offsets_ptr(this.__wbg_ptr);
322
+ return ret >>> 0;
323
+ }
324
+ /**
325
+ * @returns {number}
326
+ */
327
+ stride() {
328
+ const ret = wasm.wasmpolygonresult_stride(this.__wbg_ptr);
329
+ return ret;
330
+ }
331
+ }
332
+ if (Symbol.dispose) WasmPolygonResult.prototype[Symbol.dispose] = WasmPolygonResult.prototype.free;
333
+
334
+ /**
335
+ * @param {number} num_threads
336
+ * @returns {Promise<any>}
337
+ */
338
+ function initThreadPool(num_threads) {
339
+ const ret = wasm.initThreadPool(num_threads);
340
+ return ret;
341
+ }
342
+
343
+ /**
344
+ * @param {string} geojson_str
345
+ * @returns {string}
346
+ */
347
+ function polygonize(geojson_str) {
348
+ let deferred3_0;
349
+ let deferred3_1;
350
+ try {
351
+ const ptr0 = passStringToWasm0(geojson_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
352
+ const len0 = WASM_VECTOR_LEN;
353
+ const ret = wasm.polygonize(ptr0, len0);
354
+ var ptr2 = ret[0];
355
+ var len2 = ret[1];
356
+ if (ret[3]) {
357
+ ptr2 = 0; len2 = 0;
358
+ throw takeFromExternrefTable0(ret[2]);
359
+ }
360
+ deferred3_0 = ptr2;
361
+ deferred3_1 = len2;
362
+ return getStringFromWasm0(ptr2, len2);
363
+ } finally {
364
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
365
+ }
366
+ }
367
+
368
+ /**
369
+ * @param {Float64Array} coords
370
+ * @param {Uint32Array} offsets
371
+ * @param {number} stride
372
+ * @param {boolean} node_input
373
+ * @param {number} snap_grid_size
374
+ * @returns {WasmPolygonResult}
375
+ */
376
+ function polygonize_buffers(coords, offsets, stride, node_input, snap_grid_size) {
377
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
378
+ const len0 = WASM_VECTOR_LEN;
379
+ const ptr1 = passArray32ToWasm0(offsets, wasm.__wbindgen_malloc);
380
+ const len1 = WASM_VECTOR_LEN;
381
+ const ret = wasm.polygonize_buffers(ptr0, len0, ptr1, len1, stride, node_input, snap_grid_size);
382
+ if (ret[2]) {
383
+ throw takeFromExternrefTable0(ret[1]);
384
+ }
385
+ return WasmPolygonResult.__wrap(ret[0]);
386
+ }
387
+
388
+ /**
389
+ * @param {Uint8Array} ipc_bytes
390
+ * @param {boolean} node_input
391
+ * @param {number} snap_grid_size
392
+ * @param {boolean} extract_only_polygonal
393
+ * @returns {Uint8Array}
394
+ */
395
+ function polygonize_geoarrow(ipc_bytes, node_input, snap_grid_size, extract_only_polygonal) {
396
+ const ptr0 = passArray8ToWasm0(ipc_bytes, wasm.__wbindgen_malloc);
397
+ const len0 = WASM_VECTOR_LEN;
398
+ const ret = wasm.polygonize_geoarrow(ptr0, len0, node_input, snap_grid_size, extract_only_polygonal);
399
+ if (ret[3]) {
400
+ throw takeFromExternrefTable0(ret[2]);
401
+ }
402
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
403
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
404
+ return v2;
405
+ }
406
+
407
+ class wbg_rayon_PoolBuilder {
408
+ static __wrap(ptr) {
409
+ ptr = ptr >>> 0;
410
+ const obj = Object.create(wbg_rayon_PoolBuilder.prototype);
411
+ obj.__wbg_ptr = ptr;
412
+ wbg_rayon_PoolBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
413
+ return obj;
414
+ }
415
+ __destroy_into_raw() {
416
+ const ptr = this.__wbg_ptr;
417
+ this.__wbg_ptr = 0;
418
+ wbg_rayon_PoolBuilderFinalization.unregister(this);
419
+ return ptr;
420
+ }
421
+ free() {
422
+ const ptr = this.__destroy_into_raw();
423
+ wasm.__wbg_wbg_rayon_poolbuilder_free(ptr, 0);
424
+ }
425
+ /**
426
+ * @returns {number}
427
+ */
428
+ numThreads() {
429
+ const ret = wasm.wbg_rayon_poolbuilder_numThreads(this.__wbg_ptr);
430
+ return ret >>> 0;
431
+ }
432
+ build() {
433
+ wasm.wbg_rayon_poolbuilder_build(this.__wbg_ptr);
434
+ }
435
+ /**
436
+ * @returns {number}
437
+ */
438
+ receiver() {
439
+ const ret = wasm.wbg_rayon_poolbuilder_receiver(this.__wbg_ptr);
440
+ return ret >>> 0;
441
+ }
442
+ }
443
+ if (Symbol.dispose) wbg_rayon_PoolBuilder.prototype[Symbol.dispose] = wbg_rayon_PoolBuilder.prototype.free;
444
+
445
+ /**
446
+ * @param {number} receiver
447
+ */
448
+ function wbg_rayon_start_worker(receiver) {
449
+ wasm.wbg_rayon_start_worker(receiver);
450
+ }
451
+
452
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
453
+
454
+ async function __wbg_load(module, imports) {
455
+ if (typeof Response === 'function' && module instanceof Response) {
456
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
457
+ try {
458
+ return await WebAssembly.instantiateStreaming(module, imports);
459
+ } catch (e) {
460
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
461
+
462
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
463
+ 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);
464
+
465
+ } else {
466
+ throw e;
467
+ }
468
+ }
469
+ }
470
+
471
+ const bytes = await module.arrayBuffer();
472
+ return await WebAssembly.instantiate(bytes, imports);
473
+ } else {
474
+ const instance = await WebAssembly.instantiate(module, imports);
475
+
476
+ if (instance instanceof WebAssembly.Instance) {
477
+ return { instance, module };
478
+ } else {
479
+ return instance;
480
+ }
481
+ }
482
+ }
483
+
484
+ function __wbg_get_imports() {
485
+ const imports = {};
486
+ imports.wbg = {};
487
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
488
+ const ret = arg0 === undefined;
489
+ return ret;
490
+ };
491
+ imports.wbg.__wbg___wbindgen_memory_a342e963fbcabd68 = function() {
492
+ const ret = wasm.memory;
493
+ return ret;
494
+ };
495
+ imports.wbg.__wbg___wbindgen_module_967adef62ea6cbf8 = function() {
496
+ const ret = __wbg_init.__wbindgen_wasm_module;
497
+ return ret;
498
+ };
499
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
500
+ throw new Error(getStringFromWasm0(arg0, arg1));
501
+ };
502
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
503
+ const ret = arg0.call(arg1);
504
+ return ret;
505
+ }, arguments) };
506
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
507
+ let deferred0_0;
508
+ let deferred0_1;
509
+ try {
510
+ deferred0_0 = arg0;
511
+ deferred0_1 = arg1;
512
+ console.error(getStringFromWasm0(arg0, arg1));
513
+ } finally {
514
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
515
+ }
516
+ };
517
+ imports.wbg.__wbg_instanceof_Window_b5cf7783caa68180 = function(arg0) {
518
+ let result;
519
+ try {
520
+ result = arg0 instanceof Window;
521
+ } catch (_) {
522
+ result = false;
523
+ }
524
+ const ret = result;
525
+ return ret;
526
+ };
527
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
528
+ const ret = new Error();
529
+ return ret;
530
+ };
531
+ imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
532
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
533
+ return ret;
534
+ };
535
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
536
+ const ret = arg1.stack;
537
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
538
+ const len1 = WASM_VECTOR_LEN;
539
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
540
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
541
+ };
542
+ imports.wbg.__wbg_startWorkers_2ca11761e08ff5d5 = function(arg0, arg1, arg2) {
543
+ const ret = startWorkers(arg0, arg1, wbg_rayon_PoolBuilder.__wrap(arg2));
544
+ return ret;
545
+ };
546
+ imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
547
+ const ret = typeof global === 'undefined' ? null : global;
548
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
549
+ };
550
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
551
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
552
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
553
+ };
554
+ imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
555
+ const ret = typeof self === 'undefined' ? null : self;
556
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
557
+ };
558
+ imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
559
+ const ret = typeof window === 'undefined' ? null : window;
560
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
561
+ };
562
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
563
+ // Cast intrinsic for `Ref(String) -> Externref`.
564
+ const ret = getStringFromWasm0(arg0, arg1);
565
+ return ret;
566
+ };
567
+ imports.wbg.__wbindgen_init_externref_table = function() {
568
+ const table = wasm.__wbindgen_externrefs;
569
+ const offset = table.grow(4);
570
+ table.set(0, undefined);
571
+ table.set(offset + 0, undefined);
572
+ table.set(offset + 1, null);
573
+ table.set(offset + 2, true);
574
+ table.set(offset + 3, false);
575
+ };
576
+
577
+ return imports;
578
+ }
579
+
580
+ function __wbg_finalize_init(instance, module) {
581
+ wasm = instance.exports;
582
+ __wbg_init.__wbindgen_wasm_module = module;
583
+ cachedDataViewMemory0 = null;
584
+ cachedFloat64ArrayMemory0 = null;
585
+ cachedUint32ArrayMemory0 = null;
586
+ cachedUint8ArrayMemory0 = null;
587
+
588
+
589
+ wasm.__wbindgen_start();
590
+ return wasm;
591
+ }
592
+
593
+ function initSync(module) {
594
+ if (wasm !== undefined) return wasm;
595
+
596
+
597
+ if (typeof module !== 'undefined') {
598
+ if (Object.getPrototypeOf(module) === Object.prototype) {
599
+ ({module} = module);
600
+ } else {
601
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
602
+ }
603
+ }
604
+
605
+ const imports = __wbg_get_imports();
606
+ if (!(module instanceof WebAssembly.Module)) {
607
+ module = new WebAssembly.Module(module);
608
+ }
609
+ const instance = new WebAssembly.Instance(module, imports);
610
+ return __wbg_finalize_init(instance, module);
611
+ }
612
+
613
+ async function __wbg_init(module_or_path) {
614
+ if (wasm !== undefined) return wasm;
615
+
616
+
617
+ if (typeof module_or_path !== 'undefined') {
618
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
619
+ ({module_or_path} = module_or_path);
620
+ } else {
621
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead');
622
+ }
623
+ }
624
+
625
+ if (typeof module_or_path === 'undefined') {
626
+ module_or_path = new URL('geo_polygonize_bg.wasm', import.meta.url);
627
+ }
628
+ const imports = __wbg_get_imports();
629
+
630
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
631
+ module_or_path = fetch(module_or_path);
632
+ }
633
+
634
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
635
+
636
+ return __wbg_finalize_init(instance, module);
637
+ }
638
+
639
+ var geo_polygonize = /*#__PURE__*/Object.freeze({
640
+ __proto__: null,
641
+ WasmPolygonResult: WasmPolygonResult,
642
+ default: __wbg_init,
643
+ initSync: initSync,
644
+ initThreadPool: initThreadPool,
645
+ polygonize: polygonize,
646
+ polygonize_buffers: polygonize_buffers,
647
+ polygonize_geoarrow: polygonize_geoarrow,
648
+ wbg_rayon_PoolBuilder: wbg_rayon_PoolBuilder,
649
+ wbg_rayon_start_worker: wbg_rayon_start_worker
650
+ });
651
+
652
+ export { WasmPolygonResult, __wbg_init as default, initSync, initThreadPool, polygonize, polygonize_buffers, polygonize_geoarrow, wbg_rayon_PoolBuilder, wbg_rayon_start_worker };
@@ -0,0 +1,3 @@
1
+ import * as scalarExports from "../pkg-scalar/geo_polygonize.js";
2
+ export * from "../pkg-scalar/geo_polygonize.js";
3
+ export declare function initBest(scalarModule: any, simdModule: any): Promise<typeof scalarExports>;
@@ -0,0 +1,3 @@
1
+ export * from "../pkg-threads/geo_polygonize.js";
2
+ import init from "../pkg-threads/geo_polygonize.js";
3
+ export default init;