@loaders.gl/pointclouds 5.0.0-beta.1 → 5.0.0-beta.10
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.
- package/LAS-README.md +1 -1
- package/PCD-README.md +1 -1
- package/PLY-README.md +1 -1
- package/README.md +5 -1
- package/dist/dist.dev.js +3584 -2211
- package/dist/dist.min.js +20 -20
- package/dist/index.cjs +0 -6
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/las/bundled.cjs +0 -3
- package/dist/las/bundled.cjs.map +2 -2
- package/dist/las/bundled.d.ts +0 -1
- package/dist/las/bundled.d.ts.map +1 -1
- package/dist/las/bundled.js +0 -1
- package/dist/las/bundled.js.map +1 -1
- package/dist/las/index.cjs +0 -3
- package/dist/las/index.cjs.map +3 -3
- package/dist/las/index.d.ts +0 -2
- package/dist/las/index.d.ts.map +1 -1
- package/dist/las/index.js +0 -3
- package/dist/las/index.js.map +1 -1
- package/dist/las/las-copc-loader-types.cjs +1 -1
- package/dist/las/las-copc-loader-types.cjs.map +2 -2
- package/dist/las/las-copc-loader-types.d.ts +13 -9
- package/dist/las/las-copc-loader-types.d.ts.map +1 -1
- package/dist/las/las-copc-loader-types.js +1 -1
- package/dist/las/las-copc-loader-types.js.map +1 -1
- package/dist/las/las-copc-loader.cjs +8 -5
- package/dist/las/las-copc-loader.cjs.map +2 -2
- package/dist/las/las-copc-loader.d.ts +8 -6
- package/dist/las/las-copc-loader.d.ts.map +1 -1
- package/dist/las/las-copc-loader.js +11 -6
- package/dist/las/las-copc-loader.js.map +1 -1
- package/dist/las/las-loader-shared.cjs +4 -2
- package/dist/las/las-loader-shared.cjs.map +2 -2
- package/dist/las/las-loader-shared.d.ts +9 -7
- package/dist/las/las-loader-shared.d.ts.map +1 -1
- package/dist/las/las-loader-shared.js +4 -2
- package/dist/las/las-loader-shared.js.map +1 -1
- package/dist/las/las-loader-types.cjs +3 -6
- package/dist/las/las-loader-types.cjs.map +2 -2
- package/dist/las/las-loader-types.d.ts +18 -45
- package/dist/las/las-loader-types.d.ts.map +1 -1
- package/dist/las/las-loader-types.js +1 -3
- package/dist/las/las-loader-types.js.map +1 -1
- package/dist/las/las-loader.cjs +61 -13
- package/dist/las/las-loader.cjs.map +3 -3
- package/dist/las/las-loader.d.ts +51 -5
- package/dist/las/las-loader.d.ts.map +1 -1
- package/dist/las/las-loader.js +56 -6
- package/dist/las/las-loader.js.map +1 -1
- package/dist/las/las-writer.cjs +3 -3
- package/dist/las/las-writer.cjs.map +2 -2
- package/dist/las/las-writer.d.ts +4 -3
- package/dist/las/las-writer.d.ts.map +1 -1
- package/dist/las/las-writer.js +4 -6
- package/dist/las/las-writer.js.map +1 -1
- package/dist/las/laz-rs-loader-types.cjs +1 -1
- package/dist/las/laz-rs-loader-types.cjs.map +2 -2
- package/dist/las/laz-rs-loader-types.d.ts +13 -9
- package/dist/las/laz-rs-loader-types.d.ts.map +1 -1
- package/dist/las/laz-rs-loader-types.js +1 -1
- package/dist/las/laz-rs-loader-types.js.map +1 -1
- package/dist/las/laz-rs-loader.cjs +8 -5
- package/dist/las/laz-rs-loader.cjs.map +2 -2
- package/dist/las/laz-rs-loader.d.ts +8 -6
- package/dist/las/laz-rs-loader.d.ts.map +1 -1
- package/dist/las/laz-rs-loader.js +11 -6
- package/dist/las/laz-rs-loader.js.map +1 -1
- package/dist/las/lazperf-loader-types.cjs +1 -1
- package/dist/las/lazperf-loader-types.cjs.map +2 -2
- package/dist/las/lazperf-loader-types.d.ts +14 -10
- package/dist/las/lazperf-loader-types.d.ts.map +1 -1
- package/dist/las/lazperf-loader-types.js +1 -1
- package/dist/las/lazperf-loader-types.js.map +1 -1
- package/dist/las/lazperf-loader.cjs +9 -6
- package/dist/las/lazperf-loader.cjs.map +2 -2
- package/dist/las/lazperf-loader.d.ts +9 -7
- package/dist/las/lazperf-loader.d.ts.map +1 -1
- package/dist/las/lazperf-loader.js +12 -7
- package/dist/las/lazperf-loader.js.map +1 -1
- package/dist/las/lib/copc/parse-las.cjs +1 -1
- package/dist/las/lib/copc/parse-las.cjs.map +2 -2
- package/dist/las/lib/copc/parse-las.js +1 -1
- package/dist/las/lib/copc/parse-las.js.map +1 -1
- package/dist/las/lib/get-las-schema.cjs +5 -0
- package/dist/las/lib/get-las-schema.cjs.map +2 -2
- package/dist/las/lib/get-las-schema.d.ts.map +1 -1
- package/dist/las/lib/get-las-schema.js +6 -0
- package/dist/las/lib/get-las-schema.js.map +1 -1
- package/dist/las/lib/las-extra-bytes.cjs +6 -1
- package/dist/las/lib/las-extra-bytes.cjs.map +2 -2
- package/dist/las/lib/las-extra-bytes.d.ts.map +1 -1
- package/dist/las/lib/las-extra-bytes.js +6 -4
- package/dist/las/lib/las-extra-bytes.js.map +1 -1
- package/dist/las/lib/laz-perf/parse-las.cjs +9 -8
- package/dist/las/lib/laz-perf/parse-las.cjs.map +3 -3
- package/dist/las/lib/laz-perf/parse-las.js +9 -8
- package/dist/las/lib/laz-perf/parse-las.js.map +1 -1
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs +9 -8
- package/dist/las/lib/laz-rs-wasm/parse-las.cjs.map +3 -3
- package/dist/las/lib/laz-rs-wasm/parse-las.js +9 -8
- package/dist/las/lib/laz-rs-wasm/parse-las.js.map +1 -1
- package/dist/las/lib/typescript/parse-las.cjs +135 -13
- package/dist/las/lib/typescript/parse-las.cjs.map +3 -3
- package/dist/las/lib/typescript/parse-las.d.ts.map +1 -1
- package/dist/las/lib/typescript/parse-las.js +106 -10
- package/dist/las/lib/typescript/parse-las.js.map +1 -1
- package/dist/las/unbundled.cjs +0 -2
- package/dist/las/unbundled.cjs.map +2 -2
- package/dist/las/unbundled.d.ts +1 -1
- package/dist/las/unbundled.d.ts.map +1 -1
- package/dist/las/unbundled.js +1 -1
- package/dist/las/unbundled.js.map +1 -1
- package/dist/las/workers/las-worker.cjs +5 -5
- package/dist/las/workers/las-worker.cjs.map +2 -2
- package/dist/las/workers/las-worker.js +6 -6
- package/dist/las/workers/las-worker.js.map +1 -1
- package/dist/las-copc-loader-types.cjs +51 -0
- package/dist/las-copc-loader-types.cjs.map +7 -0
- package/dist/las-copc-loader-types.d.ts +2 -0
- package/dist/las-copc-loader-types.d.ts.map +1 -0
- package/dist/las-copc-loader-types.js +2 -0
- package/dist/las-copc-loader-types.js.map +1 -0
- package/dist/las-copc-loader.cjs +62 -0
- package/dist/las-copc-loader.cjs.map +7 -0
- package/dist/las-copc-loader.d.ts +2 -0
- package/dist/las-copc-loader.d.ts.map +1 -0
- package/dist/las-copc-loader.js +2 -0
- package/dist/las-copc-loader.js.map +1 -0
- package/dist/las-loader-types.cjs +53 -0
- package/dist/las-loader-types.cjs.map +7 -0
- package/dist/las-loader-types.d.ts +2 -0
- package/dist/las-loader-types.d.ts.map +1 -0
- package/dist/las-loader-types.js +2 -0
- package/dist/las-loader-types.js.map +1 -0
- package/dist/las-loader.cjs +130 -0
- package/dist/las-loader.cjs.map +7 -0
- package/dist/las-loader.d.ts +2 -0
- package/dist/las-loader.d.ts.map +1 -0
- package/dist/las-loader.js +2 -0
- package/dist/las-loader.js.map +1 -0
- package/dist/las-worker.js +1219 -253
- package/dist/las-writer.cjs +1056 -0
- package/dist/las-writer.cjs.map +7 -0
- package/dist/las-writer.d.ts +2 -0
- package/dist/las-writer.d.ts.map +1 -0
- package/dist/las-writer.js +2 -0
- package/dist/las-writer.js.map +1 -0
- package/dist/laz-rs-loader-types.cjs +51 -0
- package/dist/laz-rs-loader-types.cjs.map +7 -0
- package/dist/laz-rs-loader-types.d.ts +2 -0
- package/dist/laz-rs-loader-types.d.ts.map +1 -0
- package/dist/laz-rs-loader-types.js +2 -0
- package/dist/laz-rs-loader-types.js.map +1 -0
- package/dist/laz-rs-loader.cjs +277 -0
- package/dist/laz-rs-loader.cjs.map +7 -0
- package/dist/laz-rs-loader.d.ts +2 -0
- package/dist/laz-rs-loader.d.ts.map +1 -0
- package/dist/laz-rs-loader.js +2 -0
- package/dist/laz-rs-loader.js.map +1 -0
- package/dist/lazperf-loader-types.cjs +51 -0
- package/dist/lazperf-loader-types.cjs.map +7 -0
- package/dist/lazperf-loader-types.d.ts +2 -0
- package/dist/lazperf-loader-types.d.ts.map +1 -0
- package/dist/lazperf-loader-types.js +2 -0
- package/dist/lazperf-loader-types.js.map +1 -0
- package/dist/lazperf-loader.cjs +65 -0
- package/dist/lazperf-loader.cjs.map +7 -0
- package/dist/lazperf-loader.d.ts +2 -0
- package/dist/lazperf-loader.d.ts.map +1 -0
- package/dist/lazperf-loader.js +2 -0
- package/dist/lazperf-loader.js.map +1 -0
- package/dist/pcd/bundled.cjs +2 -4
- package/dist/pcd/bundled.cjs.map +2 -2
- package/dist/pcd/bundled.d.ts +1 -1
- package/dist/pcd/bundled.d.ts.map +1 -1
- package/dist/pcd/bundled.js +1 -1
- package/dist/pcd/bundled.js.map +1 -1
- package/dist/pcd/index.cjs +0 -3
- package/dist/pcd/index.cjs.map +3 -3
- package/dist/pcd/index.d.ts +0 -2
- package/dist/pcd/index.d.ts.map +1 -1
- package/dist/pcd/index.js +0 -3
- package/dist/pcd/index.js.map +1 -1
- package/dist/pcd/pcd-loader-types.cjs +9 -10
- package/dist/pcd/pcd-loader-types.cjs.map +2 -2
- package/dist/pcd/pcd-loader-types.d.ts +18 -41
- package/dist/pcd/pcd-loader-types.d.ts.map +1 -1
- package/dist/pcd/pcd-loader-types.js +6 -6
- package/dist/pcd/pcd-loader-types.js.map +1 -1
- package/dist/pcd/pcd-loader.cjs +82 -25
- package/dist/pcd/pcd-loader.cjs.map +3 -3
- package/dist/pcd/pcd-loader.d.ts +42 -6
- package/dist/pcd/pcd-loader.d.ts.map +1 -1
- package/dist/pcd/pcd-loader.js +72 -21
- package/dist/pcd/pcd-loader.js.map +1 -1
- package/dist/pcd/pcd-writer.cjs +3 -3
- package/dist/pcd/pcd-writer.cjs.map +2 -2
- package/dist/pcd/pcd-writer.d.ts +5 -4
- package/dist/pcd/pcd-writer.d.ts.map +1 -1
- package/dist/pcd/pcd-writer.js +4 -4
- package/dist/pcd/pcd-writer.js.map +1 -1
- package/dist/pcd/unbundled.cjs +2 -4
- package/dist/pcd/unbundled.cjs.map +2 -2
- package/dist/pcd/unbundled.d.ts +1 -1
- package/dist/pcd/unbundled.d.ts.map +1 -1
- package/dist/pcd/unbundled.js +1 -1
- package/dist/pcd/unbundled.js.map +1 -1
- package/dist/pcd/workers/pcd-worker.cjs +5 -5
- package/dist/pcd/workers/pcd-worker.cjs.map +2 -2
- package/dist/pcd/workers/pcd-worker.js +6 -6
- package/dist/pcd/workers/pcd-worker.js.map +1 -1
- package/dist/pcd-loader-types.cjs +65 -0
- package/dist/pcd-loader-types.cjs.map +7 -0
- package/dist/pcd-loader-types.d.ts +2 -0
- package/dist/pcd-loader-types.d.ts.map +1 -0
- package/dist/pcd-loader-types.js +2 -0
- package/dist/pcd-loader-types.js.map +1 -0
- package/dist/pcd-loader.cjs +203 -0
- package/dist/pcd-loader.cjs.map +7 -0
- package/dist/pcd-loader.d.ts +2 -0
- package/dist/pcd-loader.d.ts.map +1 -0
- package/dist/pcd-loader.js +2 -0
- package/dist/pcd-loader.js.map +1 -0
- package/dist/pcd-worker.js +1457 -418
- package/dist/pcd-writer.cjs +136 -0
- package/dist/pcd-writer.cjs.map +7 -0
- package/dist/pcd-writer.d.ts +2 -0
- package/dist/pcd-writer.d.ts.map +1 -0
- package/dist/pcd-writer.js +2 -0
- package/dist/pcd-writer.js.map +1 -0
- package/dist/ply/bundled.cjs +2 -4
- package/dist/ply/bundled.cjs.map +2 -2
- package/dist/ply/bundled.d.ts +1 -1
- package/dist/ply/bundled.d.ts.map +1 -1
- package/dist/ply/bundled.js +1 -1
- package/dist/ply/bundled.js.map +1 -1
- package/dist/ply/index.cjs +0 -3
- package/dist/ply/index.cjs.map +3 -3
- package/dist/ply/index.d.ts +0 -2
- package/dist/ply/index.d.ts.map +1 -1
- package/dist/ply/index.js +0 -3
- package/dist/ply/index.js.map +1 -1
- package/dist/ply/lib/get-ply-schema.cjs +4 -2
- package/dist/ply/lib/get-ply-schema.cjs.map +2 -2
- package/dist/ply/lib/get-ply-schema.d.ts +6 -0
- package/dist/ply/lib/get-ply-schema.d.ts.map +1 -1
- package/dist/ply/lib/get-ply-schema.js +1 -1
- package/dist/ply/lib/get-ply-schema.js.map +1 -1
- package/dist/ply/lib/parse-ply-arrow.cjs +1 -1
- package/dist/ply/lib/parse-ply-arrow.cjs.map +2 -2
- package/dist/ply/lib/parse-ply-arrow.js +2 -2
- package/dist/ply/lib/parse-ply-arrow.js.map +1 -1
- package/dist/ply/lib/parse-ply-in-batches.cjs +14 -8
- package/dist/ply/lib/parse-ply-in-batches.cjs.map +3 -3
- package/dist/ply/lib/parse-ply-in-batches.d.ts.map +1 -1
- package/dist/ply/lib/parse-ply-in-batches.js +9 -4
- package/dist/ply/lib/parse-ply-in-batches.js.map +1 -1
- package/dist/ply/lib/parse-ply.cjs +3 -0
- package/dist/ply/lib/parse-ply.cjs.map +2 -2
- package/dist/ply/lib/parse-ply.d.ts +1 -1
- package/dist/ply/lib/parse-ply.d.ts.map +1 -1
- package/dist/ply/lib/parse-ply.js +4 -0
- package/dist/ply/lib/parse-ply.js.map +1 -1
- package/dist/ply/ply-loader-types.cjs +9 -10
- package/dist/ply/ply-loader-types.cjs.map +2 -2
- package/dist/ply/ply-loader-types.d.ts +19 -42
- package/dist/ply/ply-loader-types.d.ts.map +1 -1
- package/dist/ply/ply-loader-types.js +6 -6
- package/dist/ply/ply-loader-types.js.map +1 -1
- package/dist/ply/ply-loader.cjs +82 -24
- package/dist/ply/ply-loader.cjs.map +3 -3
- package/dist/ply/ply-loader.d.ts +43 -6
- package/dist/ply/ply-loader.d.ts.map +1 -1
- package/dist/ply/ply-loader.js +71 -19
- package/dist/ply/ply-loader.js.map +1 -1
- package/dist/ply/ply-writer.cjs +3 -3
- package/dist/ply/ply-writer.cjs.map +2 -2
- package/dist/ply/ply-writer.d.ts +5 -4
- package/dist/ply/ply-writer.d.ts.map +1 -1
- package/dist/ply/ply-writer.js +4 -4
- package/dist/ply/ply-writer.js.map +1 -1
- package/dist/ply/unbundled.cjs +2 -4
- package/dist/ply/unbundled.cjs.map +2 -2
- package/dist/ply/unbundled.d.ts +1 -1
- package/dist/ply/unbundled.d.ts.map +1 -1
- package/dist/ply/unbundled.js +1 -1
- package/dist/ply/unbundled.js.map +1 -1
- package/dist/ply/workers/ply-worker.cjs +6 -6
- package/dist/ply/workers/ply-worker.cjs.map +2 -2
- package/dist/ply/workers/ply-worker.js +8 -8
- package/dist/ply/workers/ply-worker.js.map +1 -1
- package/dist/ply-loader-types.cjs +66 -0
- package/dist/ply-loader-types.cjs.map +7 -0
- package/dist/ply-loader-types.d.ts +2 -0
- package/dist/ply-loader-types.d.ts.map +1 -0
- package/dist/ply-loader-types.js +2 -0
- package/dist/ply-loader-types.js.map +1 -0
- package/dist/ply-loader.cjs +194 -0
- package/dist/ply-loader.cjs.map +7 -0
- package/dist/ply-loader.d.ts +2 -0
- package/dist/ply-loader.d.ts.map +1 -0
- package/dist/ply-loader.js +2 -0
- package/dist/ply-loader.js.map +1 -0
- package/dist/ply-worker.js +2099 -312
- package/dist/ply-writer.cjs +177 -0
- package/dist/ply-writer.cjs.map +7 -0
- package/dist/ply-writer.d.ts +2 -0
- package/dist/ply-writer.d.ts.map +1 -0
- package/dist/ply-writer.js +2 -0
- package/dist/ply-writer.js.map +1 -0
- package/package.json +75 -71
- package/src/index.ts +3 -3
- package/src/las/bundled.ts +0 -1
- package/src/las/index.ts +0 -4
- package/src/las/las-copc-loader-types.ts +3 -3
- package/src/las/las-copc-loader.ts +12 -12
- package/src/las/las-loader-shared.ts +9 -7
- package/src/las/las-loader-types.ts +3 -6
- package/src/las/las-loader.ts +63 -9
- package/src/las/las-writer.ts +17 -13
- package/src/las/laz-rs-loader-types.ts +3 -3
- package/src/las/laz-rs-loader.ts +11 -11
- package/src/las/lazperf-loader-types.ts +3 -3
- package/src/las/lazperf-loader.ts +13 -13
- package/src/las/lib/copc/parse-las.ts +1 -1
- package/src/las/lib/get-las-schema.ts +5 -0
- package/src/las/lib/las-extra-bytes.ts +6 -4
- package/src/las/lib/laz-perf/parse-las.ts +8 -9
- package/src/las/lib/laz-rs-wasm/parse-las.ts +8 -9
- package/src/las/lib/typescript/parse-las.ts +143 -11
- package/src/las/libs/laz-rs-wasm/README.md +5 -0
- package/src/las/libs/laz-rs-wasm/package.json +6 -0
- package/src/las/unbundled.ts +1 -1
- package/src/las/workers/las-worker.ts +6 -6
- package/src/las-copc-loader-types.ts +1 -0
- package/src/las-copc-loader.ts +1 -0
- package/src/las-loader-types.ts +1 -0
- package/src/las-loader.ts +1 -0
- package/src/las-writer.ts +1 -0
- package/src/laz-rs-loader-types.ts +1 -0
- package/src/laz-rs-loader.ts +1 -0
- package/src/lazperf-loader-types.ts +1 -0
- package/src/lazperf-loader.ts +1 -0
- package/src/pcd/bundled.ts +1 -4
- package/src/pcd/index.ts +0 -4
- package/src/pcd/pcd-loader-types.ts +10 -11
- package/src/pcd/pcd-loader.ts +97 -29
- package/src/pcd/pcd-writer.ts +12 -8
- package/src/pcd/unbundled.ts +1 -1
- package/src/pcd/workers/pcd-worker.ts +6 -6
- package/src/pcd-loader-types.ts +1 -0
- package/src/pcd-loader.ts +1 -0
- package/src/pcd-writer.ts +1 -0
- package/src/ply/bundled.ts +1 -4
- package/src/ply/index.ts +0 -4
- package/src/ply/lib/get-ply-schema.ts +1 -1
- package/src/ply/lib/parse-ply-arrow.ts +2 -2
- package/src/ply/lib/parse-ply-in-batches.ts +9 -4
- package/src/ply/lib/parse-ply.ts +4 -1
- package/src/ply/ply-loader-types.ts +10 -11
- package/src/ply/ply-loader.ts +94 -24
- package/src/ply/ply-writer.ts +12 -8
- package/src/ply/unbundled.ts +1 -1
- package/src/ply/workers/ply-worker.ts +8 -8
- package/src/ply-loader-types.ts +1 -0
- package/src/ply-loader.ts +1 -0
- package/src/ply-writer.ts +1 -0
package/dist/pcd-worker.js
CHANGED
|
@@ -15,29 +15,44 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
parentPort = null;
|
|
21
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
|
|
27
|
-
//
|
|
26
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
28
27
|
function getTransferList(object, recursive = true, transfers) {
|
|
29
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30
|
+
function visit(value) {
|
|
31
|
+
if (!value || typeof value !== "object" || seen.has(value))
|
|
32
|
+
return;
|
|
33
|
+
seen.add(value);
|
|
34
|
+
if (isTransferable(value))
|
|
35
|
+
transfersSet.add(value);
|
|
36
|
+
else if (ArrayBuffer.isView(value)) {
|
|
37
|
+
if (isTransferable(value.buffer))
|
|
38
|
+
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
40
|
+
visit(value.port1);
|
|
41
|
+
visit(value.port2);
|
|
42
|
+
} else if (recursive && value instanceof Map) {
|
|
43
|
+
for (const [key, item] of value) {
|
|
44
|
+
visit(key);
|
|
45
|
+
visit(item);
|
|
46
|
+
}
|
|
47
|
+
} else if (recursive && value instanceof Set) {
|
|
48
|
+
for (const item of value)
|
|
49
|
+
visit(item);
|
|
50
|
+
} else if (recursive) {
|
|
51
|
+
for (const key of Object.keys(value))
|
|
52
|
+
visit(value[key]);
|
|
39
53
|
}
|
|
40
54
|
}
|
|
55
|
+
visit(object);
|
|
41
56
|
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
42
57
|
}
|
|
43
58
|
function isTransferable(object) {
|
|
@@ -59,12 +74,11 @@
|
|
|
59
74
|
return false;
|
|
60
75
|
}
|
|
61
76
|
var init_get_transfer_list = __esm({
|
|
62
|
-
"
|
|
63
|
-
"use strict";
|
|
77
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
64
78
|
}
|
|
65
79
|
});
|
|
66
80
|
|
|
67
|
-
//
|
|
81
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
68
82
|
async function getParentPort() {
|
|
69
83
|
return parentPort;
|
|
70
84
|
}
|
|
@@ -77,31 +91,31 @@
|
|
|
77
91
|
}
|
|
78
92
|
var onMessageWrapperMap, WorkerBody;
|
|
79
93
|
var init_worker_body = __esm({
|
|
80
|
-
"
|
|
81
|
-
"use strict";
|
|
94
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
82
95
|
init_get_transfer_list();
|
|
83
96
|
init_worker_threads_browser();
|
|
84
97
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
85
98
|
WorkerBody = class {
|
|
86
99
|
/** Check that we are actually in a worker thread */
|
|
87
100
|
static async inWorkerThread() {
|
|
88
|
-
|
|
101
|
+
const workerGlobalScope = globalThis.WorkerGlobalScope;
|
|
102
|
+
return typeof workerGlobalScope === "function" && globalThis instanceof workerGlobalScope || Boolean(await getParentPort());
|
|
89
103
|
}
|
|
90
104
|
/*
|
|
91
105
|
* (type: WorkerMessageType, payload: WorkerMessagePayload) => any
|
|
92
106
|
*/
|
|
93
107
|
static set onmessage(onMessage) {
|
|
94
108
|
async function handleMessage(message) {
|
|
95
|
-
const
|
|
96
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
97
111
|
onMessage(type, payload);
|
|
98
112
|
}
|
|
99
|
-
getParentPort().then((
|
|
100
|
-
if (
|
|
101
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
102
116
|
handleMessage(message);
|
|
103
117
|
});
|
|
104
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
105
119
|
} else {
|
|
106
120
|
globalThis.onmessage = handleMessage;
|
|
107
121
|
}
|
|
@@ -119,9 +133,9 @@
|
|
|
119
133
|
};
|
|
120
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
121
135
|
}
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
125
139
|
} else {
|
|
126
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
127
141
|
}
|
|
@@ -132,9 +146,9 @@
|
|
|
132
146
|
if (!onMessageWrapper) {
|
|
133
147
|
return;
|
|
134
148
|
}
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
138
152
|
} else {
|
|
139
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
140
154
|
}
|
|
@@ -144,12 +158,12 @@
|
|
|
144
158
|
* @param type
|
|
145
159
|
* @param payload
|
|
146
160
|
*/
|
|
147
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
148
162
|
const data = { source: "loaders.gl", type, payload };
|
|
149
|
-
const transferList = getTransferList(payload);
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
153
167
|
} else {
|
|
154
168
|
globalThis.postMessage(data, transferList);
|
|
155
169
|
}
|
|
@@ -158,15 +172,11 @@
|
|
|
158
172
|
}
|
|
159
173
|
});
|
|
160
174
|
|
|
161
|
-
//
|
|
175
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
162
176
|
var AsyncQueue;
|
|
163
177
|
var init_async_queue = __esm({
|
|
164
|
-
"
|
|
165
|
-
"use strict";
|
|
178
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
166
179
|
AsyncQueue = class {
|
|
167
|
-
_values;
|
|
168
|
-
_settlers;
|
|
169
|
-
_closed;
|
|
170
180
|
constructor() {
|
|
171
181
|
this._values = [];
|
|
172
182
|
this._settlers = [];
|
|
@@ -234,8 +244,63 @@
|
|
|
234
244
|
}
|
|
235
245
|
});
|
|
236
246
|
|
|
237
|
-
//
|
|
238
|
-
|
|
247
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
248
|
+
var SharedWorkerState;
|
|
249
|
+
var init_shared_state = __esm({
|
|
250
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
251
|
+
SharedWorkerState = class {
|
|
252
|
+
constructor(buffer) {
|
|
253
|
+
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
254
|
+
throw new Error("Expected a 16-byte shared worker control buffer");
|
|
255
|
+
this.buffer = buffer;
|
|
256
|
+
this.values = new Int32Array(buffer);
|
|
257
|
+
}
|
|
258
|
+
get snapshot() {
|
|
259
|
+
return {
|
|
260
|
+
cancelled: Atomics.load(this.values, 0) !== 0,
|
|
261
|
+
completed: Atomics.load(this.values, 1),
|
|
262
|
+
total: Atomics.load(this.values, 2),
|
|
263
|
+
revision: Atomics.load(this.values, 3)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
cancel() {
|
|
267
|
+
Atomics.store(this.values, 0, 1);
|
|
268
|
+
Atomics.add(this.values, 3, 1);
|
|
269
|
+
Atomics.notify(this.values, 0);
|
|
270
|
+
}
|
|
271
|
+
throwIfCancelled() {
|
|
272
|
+
if (Atomics.load(this.values, 0) !== 0) {
|
|
273
|
+
const error = new Error("Shared worker task was cancelled");
|
|
274
|
+
error.name = "AbortError";
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/** Integer counters for application-defined work; messages still carry phase names and units. */
|
|
279
|
+
setProgress(completed, total = -1) {
|
|
280
|
+
if (!Number.isInteger(completed) || completed < 0 || completed > 2147483647 || !Number.isInteger(total) || total < -1 || total > 2147483647) {
|
|
281
|
+
throw new RangeError("Shared progress requires nonnegative int32 counts (or total -1)");
|
|
282
|
+
}
|
|
283
|
+
Atomics.store(this.values, 1, completed);
|
|
284
|
+
Atomics.store(this.values, 2, total);
|
|
285
|
+
Atomics.add(this.values, 3, 1);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
|
|
292
|
+
function validateOutputOwnership(ownership) {
|
|
293
|
+
if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
|
|
294
|
+
throw new Error("Invalid worker output ownership");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
var init_validate_output_ownership = __esm({
|
|
298
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
|
|
303
|
+
async function createWorker(process2, processInBatches, preload2) {
|
|
239
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
240
305
|
return;
|
|
241
306
|
}
|
|
@@ -243,27 +308,59 @@
|
|
|
243
308
|
process: processOnMainThread
|
|
244
309
|
};
|
|
245
310
|
WorkerBody.onmessage = async (type, payload) => {
|
|
311
|
+
if (type === "cancel") {
|
|
312
|
+
activeController?.abort();
|
|
313
|
+
activeInputBatches?.close();
|
|
314
|
+
activeOutputAcknowledgements?.close();
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const controller = type === "process" || type === "process-in-batches" ? new AbortController() : void 0;
|
|
318
|
+
if (controller)
|
|
319
|
+
activeController = controller;
|
|
320
|
+
const startedAt = performance.now();
|
|
246
321
|
const reporter = type === "process" || type === "process-in-batches" ? createProgressReporter() : void 0;
|
|
247
|
-
|
|
322
|
+
let sharedState;
|
|
323
|
+
const throwIfAborted = () => {
|
|
324
|
+
controller?.signal.throwIfAborted();
|
|
325
|
+
sharedState?.throwIfCancelled();
|
|
326
|
+
};
|
|
327
|
+
const jobContext = {
|
|
328
|
+
...context,
|
|
329
|
+
signal: controller?.signal,
|
|
330
|
+
sharedState,
|
|
331
|
+
throwIfAborted,
|
|
332
|
+
reportProgress: (progress) => {
|
|
333
|
+
if (!controller?.signal.aborted && !sharedState?.snapshot.cancelled)
|
|
334
|
+
reporter?.report(progress);
|
|
335
|
+
}
|
|
336
|
+
};
|
|
248
337
|
try {
|
|
338
|
+
if (controller && payload.options?.["sharedState"]) {
|
|
339
|
+
sharedState = new SharedWorkerState(payload.options["sharedState"]);
|
|
340
|
+
jobContext.sharedState = sharedState;
|
|
341
|
+
}
|
|
249
342
|
switch (type) {
|
|
250
343
|
case "preload":
|
|
344
|
+
await preload2?.();
|
|
251
345
|
WorkerBody.postMessage("done", {});
|
|
252
346
|
break;
|
|
253
347
|
case "process":
|
|
254
|
-
|
|
348
|
+
throwIfAborted();
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
255
351
|
throw new Error("Worker does not support atomic processing");
|
|
256
352
|
}
|
|
257
|
-
const result = await
|
|
258
|
-
|
|
259
|
-
payload.options || {},
|
|
260
|
-
jobContext,
|
|
261
|
-
payload.context || {}
|
|
262
|
-
);
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
354
|
+
throwIfAborted();
|
|
263
355
|
reporter?.finish();
|
|
264
|
-
WorkerBody.postMessage("done", {
|
|
356
|
+
await WorkerBody.postMessage("done", {
|
|
357
|
+
result,
|
|
358
|
+
executionMs: performance.now() - startedAt
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
265
360
|
break;
|
|
266
361
|
case "process-in-batches":
|
|
362
|
+
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
267
364
|
if (!processInBatches) {
|
|
268
365
|
throw new Error("Worker does not support batched processing");
|
|
269
366
|
}
|
|
@@ -272,18 +369,15 @@
|
|
|
272
369
|
activeInputBatches = inputBatches;
|
|
273
370
|
activeOutputAcknowledgements = outputAcknowledgements;
|
|
274
371
|
try {
|
|
275
|
-
const resultIterator = processInBatches(
|
|
276
|
-
createDemandDrivenIterator(inputBatches),
|
|
277
|
-
payload.options || {},
|
|
278
|
-
jobContext,
|
|
279
|
-
payload.context || {}
|
|
280
|
-
);
|
|
372
|
+
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
281
373
|
for await (const batch of resultIterator) {
|
|
282
|
-
|
|
374
|
+
throwIfAborted();
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
283
376
|
await outputAcknowledgements.next();
|
|
284
377
|
}
|
|
378
|
+
throwIfAborted();
|
|
285
379
|
reporter?.finish();
|
|
286
|
-
await WorkerBody.postMessage("done", {});
|
|
380
|
+
await WorkerBody.postMessage("done", { executionMs: performance.now() - startedAt });
|
|
287
381
|
} finally {
|
|
288
382
|
activeInputBatches = null;
|
|
289
383
|
activeOutputAcknowledgements = null;
|
|
@@ -310,11 +404,18 @@
|
|
|
310
404
|
default:
|
|
311
405
|
}
|
|
312
406
|
} catch (error) {
|
|
313
|
-
reporter?.finish();
|
|
407
|
+
reporter?.finish(controller?.signal.aborted || sharedState?.snapshot.cancelled);
|
|
314
408
|
const message = error instanceof Error ? error.message : "";
|
|
315
|
-
WorkerBody.postMessage("error", {
|
|
409
|
+
await WorkerBody.postMessage("error", {
|
|
410
|
+
error: message,
|
|
411
|
+
errorName: error instanceof Error ? error.name : "Error"
|
|
412
|
+
});
|
|
413
|
+
} finally {
|
|
414
|
+
if (controller && activeController === controller)
|
|
415
|
+
activeController = null;
|
|
316
416
|
}
|
|
317
417
|
};
|
|
418
|
+
await WorkerBody.postMessage("ready", {});
|
|
318
419
|
}
|
|
319
420
|
async function* createDemandDrivenIterator(inputBatches) {
|
|
320
421
|
while (true) {
|
|
@@ -327,81 +428,691 @@
|
|
|
327
428
|
}
|
|
328
429
|
}
|
|
329
430
|
function processOnMainThread(arrayBuffer, options = {}, jobContext = {}) {
|
|
431
|
+
const signal = activeController?.signal;
|
|
432
|
+
signal?.throwIfAborted();
|
|
330
433
|
return new Promise((resolve, reject) => {
|
|
331
434
|
const id = requestId++;
|
|
332
|
-
const
|
|
333
|
-
|
|
435
|
+
const cleanup = () => {
|
|
436
|
+
signal?.removeEventListener("abort", abort);
|
|
437
|
+
void WorkerBody.removeEventListener(onMessage);
|
|
438
|
+
};
|
|
439
|
+
const abort = () => {
|
|
440
|
+
cleanup();
|
|
441
|
+
reject(signal?.reason);
|
|
442
|
+
};
|
|
443
|
+
const onMessage = (type, payload) => {
|
|
444
|
+
if (payload.id !== id)
|
|
334
445
|
return;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
case "error":
|
|
342
|
-
WorkerBody.removeEventListener(onMessage);
|
|
343
|
-
reject(payload2.error);
|
|
344
|
-
break;
|
|
345
|
-
default:
|
|
446
|
+
if (type === "done") {
|
|
447
|
+
cleanup();
|
|
448
|
+
resolve(payload.result);
|
|
449
|
+
} else if (type === "error") {
|
|
450
|
+
cleanup();
|
|
451
|
+
reject(payload.error);
|
|
346
452
|
}
|
|
347
453
|
};
|
|
348
|
-
WorkerBody.addEventListener(onMessage)
|
|
349
|
-
|
|
350
|
-
|
|
454
|
+
void WorkerBody.addEventListener(onMessage).then(async () => {
|
|
455
|
+
if (signal?.aborted) {
|
|
456
|
+
abort();
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
460
|
+
await WorkerBody.postMessage("process", {
|
|
461
|
+
id,
|
|
462
|
+
input: arrayBuffer,
|
|
463
|
+
options,
|
|
464
|
+
context: jobContext
|
|
465
|
+
});
|
|
466
|
+
}).catch((error) => {
|
|
467
|
+
cleanup();
|
|
468
|
+
reject(error);
|
|
469
|
+
});
|
|
351
470
|
});
|
|
352
471
|
}
|
|
353
472
|
function createProgressReporter() {
|
|
354
|
-
let
|
|
473
|
+
let pending2;
|
|
355
474
|
let finished = false;
|
|
356
475
|
let scheduled = false;
|
|
357
476
|
const flush = () => {
|
|
358
477
|
scheduled = false;
|
|
359
|
-
if (
|
|
360
|
-
WorkerBody.postMessage("progress", { progress:
|
|
361
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
362
481
|
}
|
|
363
482
|
};
|
|
364
483
|
return {
|
|
365
484
|
/** Records progress while retaining phase transitions. */
|
|
366
485
|
report(progress) {
|
|
367
|
-
if (finished)
|
|
368
|
-
|
|
369
|
-
|
|
486
|
+
if (finished)
|
|
487
|
+
return;
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
489
|
+
flush();
|
|
490
|
+
pending2 = { ...progress };
|
|
370
491
|
if (!scheduled) {
|
|
371
492
|
scheduled = true;
|
|
372
493
|
setTimeout(flush, 0);
|
|
373
494
|
}
|
|
374
495
|
},
|
|
375
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
376
|
-
finish() {
|
|
497
|
+
finish(discard = false) {
|
|
498
|
+
if (discard)
|
|
499
|
+
pending2 = void 0;
|
|
377
500
|
flush();
|
|
378
501
|
finished = true;
|
|
379
502
|
}
|
|
380
503
|
};
|
|
381
504
|
}
|
|
382
|
-
var requestId, activeInputBatches, activeOutputAcknowledgements;
|
|
505
|
+
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
383
506
|
var init_create_worker = __esm({
|
|
384
|
-
"
|
|
385
|
-
|
|
507
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
508
|
+
init_shared_state();
|
|
386
509
|
init_async_queue();
|
|
387
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
388
512
|
requestId = 0;
|
|
513
|
+
activeController = null;
|
|
389
514
|
activeInputBatches = null;
|
|
390
515
|
activeOutputAcknowledgements = null;
|
|
391
516
|
}
|
|
392
517
|
});
|
|
393
518
|
|
|
394
|
-
//
|
|
519
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
520
|
+
var import_meta, path, moduleUrl;
|
|
395
521
|
var init_worker_utils = __esm({
|
|
522
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
524
|
+
init_create_worker();
|
|
525
|
+
init_get_transfer_list();
|
|
526
|
+
import_meta = {};
|
|
527
|
+
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
528
|
+
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
|
|
533
|
+
function preloadTaskCode(task, signal) {
|
|
534
|
+
if (!task.preload)
|
|
535
|
+
return Promise.resolve();
|
|
536
|
+
let promise = pending.get(task);
|
|
537
|
+
if (!promise) {
|
|
538
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
539
|
+
loaded.add(task);
|
|
540
|
+
});
|
|
541
|
+
pending.set(task, promise);
|
|
542
|
+
void promise.catch(() => pending.delete(task));
|
|
543
|
+
}
|
|
544
|
+
return withSignal(promise, signal);
|
|
545
|
+
}
|
|
546
|
+
function withSignal(operation, signal) {
|
|
547
|
+
if (!signal)
|
|
548
|
+
return operation;
|
|
549
|
+
return new Promise((resolve, reject) => {
|
|
550
|
+
const abort = () => {
|
|
551
|
+
signal.removeEventListener("abort", abort);
|
|
552
|
+
reject(signal.reason);
|
|
553
|
+
};
|
|
554
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
555
|
+
if (signal.aborted)
|
|
556
|
+
abort();
|
|
557
|
+
operation.then((value) => {
|
|
558
|
+
signal.removeEventListener("abort", abort);
|
|
559
|
+
resolve(value);
|
|
560
|
+
}, (error) => {
|
|
561
|
+
signal.removeEventListener("abort", abort);
|
|
562
|
+
reject(error);
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
var pending, loaded;
|
|
567
|
+
var init_task_preload = __esm({
|
|
568
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
|
|
569
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
570
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
|
|
575
|
+
var TaskRequestError, TaskChannel;
|
|
576
|
+
var init_task_channel = __esm({
|
|
577
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
|
|
578
|
+
TaskRequestError = class extends Error {
|
|
579
|
+
};
|
|
580
|
+
TaskChannel = class {
|
|
581
|
+
constructor(options) {
|
|
582
|
+
this.options = options;
|
|
583
|
+
this.nextId = 1;
|
|
584
|
+
this.pending = /* @__PURE__ */ new Map();
|
|
585
|
+
this.incoming = /* @__PURE__ */ new Map();
|
|
586
|
+
}
|
|
587
|
+
/** Send a request without serializing other in-flight requests. */
|
|
588
|
+
request(operation, value, signal, transfer = []) {
|
|
589
|
+
if (this.failure)
|
|
590
|
+
return Promise.reject(this.failure.reason);
|
|
591
|
+
if (signal?.aborted)
|
|
592
|
+
return Promise.reject(signal.reason);
|
|
593
|
+
const id = this.nextId++;
|
|
594
|
+
return new Promise((resolve, reject) => {
|
|
595
|
+
const abort = () => {
|
|
596
|
+
const pending2 = this.pending.get(id);
|
|
597
|
+
if (!pending2)
|
|
598
|
+
return;
|
|
599
|
+
this.pending.delete(id);
|
|
600
|
+
pending2.cleanup();
|
|
601
|
+
reject(signal?.reason);
|
|
602
|
+
this.send({ source: "math.gl/tasks", kind: "cancel", id });
|
|
603
|
+
};
|
|
604
|
+
this.pending.set(id, {
|
|
605
|
+
resolve,
|
|
606
|
+
reject,
|
|
607
|
+
cleanup: () => signal?.removeEventListener("abort", abort)
|
|
608
|
+
});
|
|
609
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
610
|
+
this.send({ source: "math.gl/tasks", kind: "request", id, operation, value }, transfer);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
/** Send a one-way notification. */
|
|
614
|
+
emit(operation, value, transfer = []) {
|
|
615
|
+
if (this.failure)
|
|
616
|
+
throw this.failure.reason;
|
|
617
|
+
this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation, value }, transfer);
|
|
618
|
+
}
|
|
619
|
+
/** Dispatch a transport message; unrelated protocols are ignored. */
|
|
620
|
+
receive(message) {
|
|
621
|
+
if (this.failure || message?.source !== "math.gl/tasks")
|
|
622
|
+
return;
|
|
623
|
+
if (message.kind === "failure") {
|
|
624
|
+
const reason = new Error(message.error?.message ?? "Task channel failed");
|
|
625
|
+
this.close(reason);
|
|
626
|
+
this.options.onFailure?.(reason);
|
|
627
|
+
} else if (message.kind === "result" || message.kind === "error") {
|
|
628
|
+
const pending2 = this.pending.get(message.id);
|
|
629
|
+
if (!pending2)
|
|
630
|
+
return;
|
|
631
|
+
this.pending.delete(message.id);
|
|
632
|
+
pending2.cleanup();
|
|
633
|
+
if (message.kind === "result")
|
|
634
|
+
pending2.resolve(message.value);
|
|
635
|
+
else {
|
|
636
|
+
const error = new TaskRequestError(message.error?.message ?? "Task request failed");
|
|
637
|
+
error.name = message.error?.name ?? "Error";
|
|
638
|
+
pending2.reject(error);
|
|
639
|
+
}
|
|
640
|
+
} else if (message.kind === "cancel") {
|
|
641
|
+
this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
|
|
642
|
+
} else if (message.kind === "event") {
|
|
643
|
+
try {
|
|
644
|
+
this.options.handleEvent?.(message.operation, message.value);
|
|
645
|
+
} catch (error) {
|
|
646
|
+
this.fail(error);
|
|
647
|
+
}
|
|
648
|
+
} else if (message.kind === "request") {
|
|
649
|
+
if (this.incoming.has(message.id)) {
|
|
650
|
+
this.fail(new Error("Duplicate task request identifier"));
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const controller = new AbortController();
|
|
654
|
+
this.incoming.set(message.id, controller);
|
|
655
|
+
void Promise.resolve().then(() => {
|
|
656
|
+
controller.signal.throwIfAborted();
|
|
657
|
+
return this.options.handleRequest(message.operation, message.value, controller.signal);
|
|
658
|
+
}).then((value) => {
|
|
659
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
660
|
+
this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value }, this.options.getResultTransferList?.(value, message.value));
|
|
661
|
+
}
|
|
662
|
+
}).catch((reason) => {
|
|
663
|
+
if (!controller.signal.aborted && !this.failure) {
|
|
664
|
+
this.send({
|
|
665
|
+
source: "math.gl/tasks",
|
|
666
|
+
kind: "error",
|
|
667
|
+
id: message.id,
|
|
668
|
+
error: {
|
|
669
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
670
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}).finally(() => this.incoming.delete(message.id));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/** Reject all outstanding calls with a common cause and abort incoming callbacks. */
|
|
678
|
+
close(reason = new Error("Task channel closed")) {
|
|
679
|
+
if (this.failure)
|
|
680
|
+
return;
|
|
681
|
+
this.failure = { reason };
|
|
682
|
+
for (const pending2 of this.pending.values()) {
|
|
683
|
+
pending2.cleanup();
|
|
684
|
+
pending2.reject(reason);
|
|
685
|
+
}
|
|
686
|
+
this.pending.clear();
|
|
687
|
+
for (const controller of this.incoming.values())
|
|
688
|
+
controller.abort(reason);
|
|
689
|
+
this.incoming.clear();
|
|
690
|
+
}
|
|
691
|
+
send(message, transfer = []) {
|
|
692
|
+
if (this.failure)
|
|
693
|
+
return;
|
|
694
|
+
try {
|
|
695
|
+
this.options.send(message, transfer);
|
|
696
|
+
} catch (error) {
|
|
697
|
+
this.fail(error);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
/** Invalidate the channel and notify the peer when the transport still works. */
|
|
701
|
+
fail(reason) {
|
|
702
|
+
if (this.failure)
|
|
703
|
+
return;
|
|
704
|
+
this.close(reason);
|
|
705
|
+
try {
|
|
706
|
+
this.options.send({
|
|
707
|
+
source: "math.gl/tasks",
|
|
708
|
+
kind: "failure",
|
|
709
|
+
id: 0,
|
|
710
|
+
error: {
|
|
711
|
+
name: reason instanceof Error ? reason.name : "Error",
|
|
712
|
+
message: reason instanceof Error ? reason.message : String(reason)
|
|
713
|
+
}
|
|
714
|
+
}, []);
|
|
715
|
+
} catch {
|
|
716
|
+
}
|
|
717
|
+
this.options.onFailure?.(reason);
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
|
|
724
|
+
function assertPayload(value) {
|
|
725
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
726
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function clonePayload(value, ownership = "copy") {
|
|
730
|
+
assertPayload(value);
|
|
731
|
+
if (!["copy", "transfer", "share"].includes(ownership))
|
|
732
|
+
throw new TypeError("Invalid input ownership");
|
|
733
|
+
const transfer = getTransferList(value);
|
|
734
|
+
if (ownership === "share" && transfer.length)
|
|
735
|
+
throw new TypeError("Share requires shared storage");
|
|
736
|
+
return structuredClone(value, {
|
|
737
|
+
transfer: ownership === "transfer" ? transfer : []
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
function taskContext(state, context = {}) {
|
|
741
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
742
|
+
return {
|
|
743
|
+
state,
|
|
744
|
+
signal,
|
|
745
|
+
requestHost: async (operation, payload, controls) => {
|
|
746
|
+
signal.throwIfAborted();
|
|
747
|
+
if (!context.requestHost)
|
|
748
|
+
throw new Error("No host request handler configured");
|
|
749
|
+
return context.requestHost(operation, payload, controls);
|
|
750
|
+
},
|
|
751
|
+
emitHost: (operation, payload) => {
|
|
752
|
+
signal.throwIfAborted();
|
|
753
|
+
context.emitHost?.(operation, payload);
|
|
754
|
+
},
|
|
755
|
+
throwIfAborted: () => {
|
|
756
|
+
signal.throwIfAborted();
|
|
757
|
+
context.throwIfAborted?.();
|
|
758
|
+
},
|
|
759
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
760
|
+
...progress,
|
|
761
|
+
phase: progress.phase ?? "process",
|
|
762
|
+
unit: progress.unit ?? "items"
|
|
763
|
+
})
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
async function initializeTaskWorker(task) {
|
|
767
|
+
if (!await WorkerBody.inWorkerThread())
|
|
768
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
769
|
+
if (installed)
|
|
770
|
+
throw new Error("A task is already installed in this worker");
|
|
771
|
+
installed = true;
|
|
772
|
+
const runtime = new TaskRuntime(task);
|
|
773
|
+
let channelStream;
|
|
774
|
+
const channel = new TaskChannel({
|
|
775
|
+
getResultTransferList: (value, request) => request.outputOwnership === "transfer" ? getTransferList(value) : [],
|
|
776
|
+
send: (message, transfer) => {
|
|
777
|
+
const snapshot = structuredClone(message, { transfer });
|
|
778
|
+
void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
|
|
779
|
+
},
|
|
780
|
+
handleRequest: async (operation, value, signal) => {
|
|
781
|
+
const request = value;
|
|
782
|
+
const context = {
|
|
783
|
+
signal,
|
|
784
|
+
reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
|
|
785
|
+
requestHost: (operation2, payload, controls = {}) => {
|
|
786
|
+
const request2 = {
|
|
787
|
+
operation: operation2,
|
|
788
|
+
payload: clonePayload(payload, controls.inputOwnership),
|
|
789
|
+
outputOwnership: controls.outputOwnership ?? "copy"
|
|
790
|
+
};
|
|
791
|
+
return channel.request("task:host-request", request2, signal, getTransferList(request2));
|
|
792
|
+
},
|
|
793
|
+
emitHost: (operation2, payload) => channel.emit("task:host-event", { operation: operation2, payload, id: request.progressId })
|
|
794
|
+
};
|
|
795
|
+
switch (operation) {
|
|
796
|
+
case "initialize":
|
|
797
|
+
return runtime.initialize(request.input, context);
|
|
798
|
+
case "process":
|
|
799
|
+
return runtime.process(request.input, request.options, context);
|
|
800
|
+
case "stream-open": {
|
|
801
|
+
if (channelStream)
|
|
802
|
+
throw new Error("A task stream is already open");
|
|
803
|
+
async function* inputs() {
|
|
804
|
+
while (true) {
|
|
805
|
+
const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
|
|
806
|
+
if (result.done)
|
|
807
|
+
return;
|
|
808
|
+
yield result.value;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
|
|
812
|
+
return {};
|
|
813
|
+
}
|
|
814
|
+
case "stream-next":
|
|
815
|
+
if (!channelStream)
|
|
816
|
+
throw new Error("No active task stream");
|
|
817
|
+
return channelStream.next();
|
|
818
|
+
case "stream-close":
|
|
819
|
+
try {
|
|
820
|
+
await channelStream?.return?.();
|
|
821
|
+
} finally {
|
|
822
|
+
channelStream = void 0;
|
|
823
|
+
}
|
|
824
|
+
return {};
|
|
825
|
+
case "destroy":
|
|
826
|
+
return runtime.destroy();
|
|
827
|
+
default:
|
|
828
|
+
throw new Error("Unknown task channel operation");
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
await WorkerBody.addEventListener((type, payload) => {
|
|
833
|
+
if (type === "task-channel")
|
|
834
|
+
channel.receive(payload);
|
|
835
|
+
});
|
|
836
|
+
let streamOptions = {};
|
|
837
|
+
return createWorker(async (request, _options, context) => {
|
|
838
|
+
switch (request.operation) {
|
|
839
|
+
case "initialize":
|
|
840
|
+
return runtime.initialize(request.input, context);
|
|
841
|
+
case "destroy":
|
|
842
|
+
return runtime.destroy();
|
|
843
|
+
case "stream-options":
|
|
844
|
+
streamOptions = request.options;
|
|
845
|
+
return {};
|
|
846
|
+
case "process":
|
|
847
|
+
return runtime.process(request.input, request.options, context);
|
|
848
|
+
default:
|
|
849
|
+
throw new Error("Unknown task operation");
|
|
850
|
+
}
|
|
851
|
+
}, async function* (inputs, _options, context) {
|
|
852
|
+
async function* batches() {
|
|
853
|
+
for await (const input of inputs) {
|
|
854
|
+
assertPayload(input);
|
|
855
|
+
yield input;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
try {
|
|
859
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
860
|
+
} finally {
|
|
861
|
+
streamOptions = {};
|
|
862
|
+
}
|
|
863
|
+
}, () => preloadTaskCode(task));
|
|
864
|
+
}
|
|
865
|
+
var TaskRuntime, installed;
|
|
866
|
+
var init_task_runtime = __esm({
|
|
867
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
|
|
868
|
+
init_worker_utils();
|
|
869
|
+
init_task_preload();
|
|
870
|
+
init_task_channel();
|
|
871
|
+
TaskRuntime = class {
|
|
872
|
+
constructor(task) {
|
|
873
|
+
this.task = task;
|
|
874
|
+
this.initialized = false;
|
|
875
|
+
}
|
|
876
|
+
async initialize(input, context = {}) {
|
|
877
|
+
if (this.initialized)
|
|
878
|
+
throw new Error("Task is already initialized");
|
|
879
|
+
assertPayload(input);
|
|
880
|
+
await preloadTaskCode(this.task, context.signal);
|
|
881
|
+
context.signal?.throwIfAborted();
|
|
882
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
883
|
+
this.initialized = true;
|
|
884
|
+
return {};
|
|
885
|
+
}
|
|
886
|
+
async destroy() {
|
|
887
|
+
if (this.initialized) {
|
|
888
|
+
this.initialized = false;
|
|
889
|
+
const state = this.state;
|
|
890
|
+
this.state = void 0;
|
|
891
|
+
if (this.task.initialize)
|
|
892
|
+
await this.task.destroy?.(state);
|
|
893
|
+
}
|
|
894
|
+
return {};
|
|
895
|
+
}
|
|
896
|
+
async process(input, options, context = {}) {
|
|
897
|
+
if (!this.initialized)
|
|
898
|
+
throw new Error("Task is not initialized");
|
|
899
|
+
if (!this.task.process)
|
|
900
|
+
throw new Error("Task has no atomic processor");
|
|
901
|
+
assertPayload(input);
|
|
902
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
903
|
+
assertPayload(result);
|
|
904
|
+
return result;
|
|
905
|
+
}
|
|
906
|
+
async *stream(inputs, options, context = {}) {
|
|
907
|
+
if (!this.initialized)
|
|
908
|
+
throw new Error("Task is not initialized");
|
|
909
|
+
if (!this.task.processInBatches)
|
|
910
|
+
throw new Error("Task has no streaming processor");
|
|
911
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
912
|
+
assertPayload(output);
|
|
913
|
+
yield output;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
installed = false;
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
// ../../node_modules/@math.gl/tasks/dist/tasks/index.js
|
|
922
|
+
var init_tasks = __esm({
|
|
923
|
+
"../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
|
|
924
|
+
init_task_runtime();
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
// ../../node_modules/@math.gl/tasks/dist/index.js
|
|
929
|
+
var init_dist = __esm({
|
|
930
|
+
"../../node_modules/@math.gl/tasks/dist/index.js"() {
|
|
931
|
+
init_tasks();
|
|
932
|
+
}
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
936
|
+
var worker_threads_browser_exports = {};
|
|
937
|
+
__export(worker_threads_browser_exports, {
|
|
938
|
+
NodeWorker: () => NodeWorker,
|
|
939
|
+
parentPort: () => parentPort2
|
|
940
|
+
});
|
|
941
|
+
var NodeWorker, parentPort2;
|
|
942
|
+
var init_worker_threads_browser2 = __esm({
|
|
943
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
944
|
+
"use strict";
|
|
945
|
+
NodeWorker = class {
|
|
946
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
947
|
+
constructor(...arguments_) {
|
|
948
|
+
const runtimeProcess = globalThis.process;
|
|
949
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
950
|
+
if (WorkerConstructor) {
|
|
951
|
+
return new WorkerConstructor(...arguments_);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
955
|
+
terminate() {
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
parentPort2 = null;
|
|
959
|
+
}
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
963
|
+
function normalizeTaskProgress(progress) {
|
|
964
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
965
|
+
}
|
|
966
|
+
async function isWorkerThread() {
|
|
967
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
968
|
+
return true;
|
|
969
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
970
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
971
|
+
return !isMainThread;
|
|
972
|
+
}
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
var initializeTaskWorker2;
|
|
976
|
+
var init_task_runtime2 = __esm({
|
|
977
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
978
|
+
"use strict";
|
|
979
|
+
init_dist();
|
|
980
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
985
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
986
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
987
|
+
if (!object) {
|
|
988
|
+
} else if (isTransferable2(object)) {
|
|
989
|
+
transfersSet.add(object);
|
|
990
|
+
} else if (isTransferable2(object.buffer)) {
|
|
991
|
+
transfersSet.add(object.buffer);
|
|
992
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
993
|
+
} else if (recursive && typeof object === "object") {
|
|
994
|
+
for (const key in object) {
|
|
995
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
999
|
+
}
|
|
1000
|
+
function isTransferable2(object) {
|
|
1001
|
+
if (!object) {
|
|
1002
|
+
return false;
|
|
1003
|
+
}
|
|
1004
|
+
if (object instanceof ArrayBuffer) {
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
1008
|
+
return true;
|
|
1009
|
+
}
|
|
1010
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
1011
|
+
return true;
|
|
1012
|
+
}
|
|
1013
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
return false;
|
|
1017
|
+
}
|
|
1018
|
+
var init_get_transfer_list2 = __esm({
|
|
1019
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
1020
|
+
"use strict";
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
1025
|
+
async function createWorker2(process2, processInBatches) {
|
|
1026
|
+
if (!await isWorkerThread()) return;
|
|
1027
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
1028
|
+
}
|
|
1029
|
+
function createWorkerTask(process2, processInBatches) {
|
|
1030
|
+
return {
|
|
1031
|
+
id: "loaders.gl",
|
|
1032
|
+
initialize: (state) => state,
|
|
1033
|
+
destroy: (state) => state.port?.close(),
|
|
1034
|
+
process: async ({ value }, options, context) => {
|
|
1035
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
1036
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
1037
|
+
},
|
|
1038
|
+
...processInBatches ? {
|
|
1039
|
+
processInBatches: async function* (inputs, options, context) {
|
|
1040
|
+
async function* values() {
|
|
1041
|
+
for await (const input of inputs) yield input.value;
|
|
1042
|
+
}
|
|
1043
|
+
for await (const value of processInBatches(
|
|
1044
|
+
values(),
|
|
1045
|
+
options,
|
|
1046
|
+
createContext(context),
|
|
1047
|
+
context.state.context
|
|
1048
|
+
)) {
|
|
1049
|
+
yield { value };
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
} : {}
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function createContext(context) {
|
|
1056
|
+
let requestIdentifier = 0;
|
|
1057
|
+
const port = context.state.port;
|
|
1058
|
+
return {
|
|
1059
|
+
signal: context.signal,
|
|
1060
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
1061
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
1062
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
1063
|
+
context.throwIfAborted();
|
|
1064
|
+
const identifier = ++requestIdentifier;
|
|
1065
|
+
return new Promise((resolve, reject) => {
|
|
1066
|
+
const onMessage = (event) => {
|
|
1067
|
+
if (event.data.identifier !== identifier) return;
|
|
1068
|
+
cleanup();
|
|
1069
|
+
if (event.data.error) {
|
|
1070
|
+
const error = new Error(event.data.error.message);
|
|
1071
|
+
error.name = event.data.error.name;
|
|
1072
|
+
reject(error);
|
|
1073
|
+
} else resolve(event.data.value);
|
|
1074
|
+
};
|
|
1075
|
+
const onAbort = () => {
|
|
1076
|
+
cleanup();
|
|
1077
|
+
reject(context.signal.reason);
|
|
1078
|
+
};
|
|
1079
|
+
const cleanup = () => {
|
|
1080
|
+
port.removeEventListener("message", onMessage);
|
|
1081
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
1082
|
+
};
|
|
1083
|
+
port.addEventListener("message", onMessage);
|
|
1084
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
1085
|
+
port.start();
|
|
1086
|
+
try {
|
|
1087
|
+
const request = { identifier, input, options, context: jobContext };
|
|
1088
|
+
port.postMessage(request, getTransferList2(request));
|
|
1089
|
+
} catch (error) {
|
|
1090
|
+
cleanup();
|
|
1091
|
+
reject(error);
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
} : void 0
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
var init_create_worker2 = __esm({
|
|
1098
|
+
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
1099
|
+
"use strict";
|
|
1100
|
+
init_task_runtime2();
|
|
1101
|
+
init_get_transfer_list2();
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
// ../core/src/worker-utils/index.ts
|
|
1106
|
+
var init_worker_utils2 = __esm({
|
|
396
1107
|
"../core/src/worker-utils/index.ts"() {
|
|
397
1108
|
"use strict";
|
|
398
|
-
|
|
1109
|
+
init_create_worker2();
|
|
399
1110
|
}
|
|
400
1111
|
});
|
|
401
1112
|
|
|
402
1113
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
403
1114
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
404
|
-
await
|
|
1115
|
+
await createWorker2(
|
|
405
1116
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
406
1117
|
selectLoader(options || {}),
|
|
407
1118
|
input,
|
|
@@ -539,7 +1250,7 @@
|
|
|
539
1250
|
var init_create_loader_worker = __esm({
|
|
540
1251
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
541
1252
|
"use strict";
|
|
542
|
-
|
|
1253
|
+
init_worker_utils2();
|
|
543
1254
|
}
|
|
544
1255
|
});
|
|
545
1256
|
|
|
@@ -722,7 +1433,7 @@
|
|
|
722
1433
|
});
|
|
723
1434
|
|
|
724
1435
|
// ../../node_modules/@math.gl/core/dist/index.js
|
|
725
|
-
var
|
|
1436
|
+
var init_dist2 = __esm({
|
|
726
1437
|
"../../node_modules/@math.gl/core/dist/index.js"() {
|
|
727
1438
|
init_math_utils();
|
|
728
1439
|
init_types2();
|
|
@@ -745,6 +1456,72 @@
|
|
|
745
1456
|
}
|
|
746
1457
|
});
|
|
747
1458
|
|
|
1459
|
+
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
1460
|
+
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
1461
|
+
if (value instanceof Date) {
|
|
1462
|
+
return "date-millisecond";
|
|
1463
|
+
}
|
|
1464
|
+
if (typeof value === "number") {
|
|
1465
|
+
return defaultNumberType;
|
|
1466
|
+
}
|
|
1467
|
+
if (typeof value === "boolean") {
|
|
1468
|
+
return "bool";
|
|
1469
|
+
}
|
|
1470
|
+
if (typeof value === "string") {
|
|
1471
|
+
return "utf8";
|
|
1472
|
+
}
|
|
1473
|
+
if (value === null || value === "undefined") {
|
|
1474
|
+
return "null";
|
|
1475
|
+
}
|
|
1476
|
+
return "null";
|
|
1477
|
+
}
|
|
1478
|
+
function getDataTypeFromArray(array) {
|
|
1479
|
+
let type = getDataTypeFromTypedArray(array);
|
|
1480
|
+
if (type !== "null") {
|
|
1481
|
+
return { type, nullable: false };
|
|
1482
|
+
}
|
|
1483
|
+
if (array.length > 0) {
|
|
1484
|
+
type = getDataTypeFromValue(array[0]);
|
|
1485
|
+
return { type, nullable: true };
|
|
1486
|
+
}
|
|
1487
|
+
return { type: "null", nullable: true };
|
|
1488
|
+
}
|
|
1489
|
+
function getDataTypeFromTypedArray(array) {
|
|
1490
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
1491
|
+
return "float16";
|
|
1492
|
+
}
|
|
1493
|
+
switch (array.constructor) {
|
|
1494
|
+
case Int8Array:
|
|
1495
|
+
return "int8";
|
|
1496
|
+
case Uint8Array:
|
|
1497
|
+
case Uint8ClampedArray:
|
|
1498
|
+
return "uint8";
|
|
1499
|
+
case Int16Array:
|
|
1500
|
+
return "int16";
|
|
1501
|
+
case Uint16Array:
|
|
1502
|
+
return "uint16";
|
|
1503
|
+
case Int32Array:
|
|
1504
|
+
return "int32";
|
|
1505
|
+
case Uint32Array:
|
|
1506
|
+
return "uint32";
|
|
1507
|
+
case BigInt64Array:
|
|
1508
|
+
return "int64";
|
|
1509
|
+
case BigUint64Array:
|
|
1510
|
+
return "uint64";
|
|
1511
|
+
case Float32Array:
|
|
1512
|
+
return "float32";
|
|
1513
|
+
case Float64Array:
|
|
1514
|
+
return "float64";
|
|
1515
|
+
default:
|
|
1516
|
+
return "null";
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
var init_data_type = __esm({
|
|
1520
|
+
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
1521
|
+
"use strict";
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
|
+
|
|
748
1525
|
// ../../node_modules/tslib/tslib.es6.mjs
|
|
749
1526
|
function __rest(s, e) {
|
|
750
1527
|
var t = {};
|
|
@@ -8395,11 +9172,11 @@ return true;`);
|
|
|
8395
9172
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8396
9173
|
}
|
|
8397
9174
|
setValue(index, value) {
|
|
8398
|
-
const
|
|
8399
|
-
const current =
|
|
9175
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9176
|
+
const current = pending2.get(index);
|
|
8400
9177
|
current && (this._pendingLength -= current.length);
|
|
8401
9178
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8402
|
-
|
|
9179
|
+
pending2.set(index, value);
|
|
8403
9180
|
}
|
|
8404
9181
|
setValid(index, isValid) {
|
|
8405
9182
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8422,12 +9199,12 @@ return true;`);
|
|
|
8422
9199
|
return super.finish();
|
|
8423
9200
|
}
|
|
8424
9201
|
_flush() {
|
|
8425
|
-
const
|
|
9202
|
+
const pending2 = this._pending;
|
|
8426
9203
|
const pendingLength = this._pendingLength;
|
|
8427
9204
|
this._pendingLength = 0;
|
|
8428
9205
|
this._pending = void 0;
|
|
8429
|
-
if (
|
|
8430
|
-
this._flushPending(
|
|
9206
|
+
if (pending2 && pending2.size > 0) {
|
|
9207
|
+
this._flushPending(pending2, pendingLength);
|
|
8431
9208
|
}
|
|
8432
9209
|
return this;
|
|
8433
9210
|
}
|
|
@@ -11013,11 +11790,11 @@ return true;`);
|
|
|
11013
11790
|
setValue(index, value) {
|
|
11014
11791
|
return super.setValue(index, toUint8Array(value));
|
|
11015
11792
|
}
|
|
11016
|
-
_flushPending(
|
|
11793
|
+
_flushPending(pending2, pendingLength) {
|
|
11017
11794
|
const offsets = this._offsets;
|
|
11018
11795
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11019
11796
|
let offset = 0;
|
|
11020
|
-
for (const [index, value] of
|
|
11797
|
+
for (const [index, value] of pending2) {
|
|
11021
11798
|
if (value === void 0) {
|
|
11022
11799
|
offsets.set(index, 0);
|
|
11023
11800
|
} else {
|
|
@@ -11054,11 +11831,11 @@ return true;`);
|
|
|
11054
11831
|
setValue(index, value) {
|
|
11055
11832
|
return super.setValue(index, toUint8Array(value));
|
|
11056
11833
|
}
|
|
11057
|
-
_flushPending(
|
|
11834
|
+
_flushPending(pending2, pendingLength) {
|
|
11058
11835
|
const offsets = this._offsets;
|
|
11059
11836
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11060
11837
|
let offset = 0;
|
|
11061
|
-
for (const [index, value] of
|
|
11838
|
+
for (const [index, value] of pending2) {
|
|
11062
11839
|
if (value === void 0) {
|
|
11063
11840
|
offsets.set(index, BigInt(0));
|
|
11064
11841
|
} else {
|
|
@@ -11369,10 +12146,10 @@ return true;`);
|
|
|
11369
12146
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11370
12147
|
return this.numChildren - 1;
|
|
11371
12148
|
}
|
|
11372
|
-
_flushPending(
|
|
12149
|
+
_flushPending(pending2) {
|
|
11373
12150
|
const offsets = this._offsets;
|
|
11374
12151
|
const [child] = this.children;
|
|
11375
|
-
for (const [index, value] of
|
|
12152
|
+
for (const [index, value] of pending2) {
|
|
11376
12153
|
if (typeof value === "undefined") {
|
|
11377
12154
|
offsets.set(index, 0);
|
|
11378
12155
|
} else {
|
|
@@ -11411,10 +12188,10 @@ return true;`);
|
|
|
11411
12188
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11412
12189
|
return this.numChildren - 1;
|
|
11413
12190
|
}
|
|
11414
|
-
_flushPending(
|
|
12191
|
+
_flushPending(pending2) {
|
|
11415
12192
|
const offsets = this._offsets;
|
|
11416
12193
|
const [child] = this.children;
|
|
11417
|
-
for (const [index, value] of
|
|
12194
|
+
for (const [index, value] of pending2) {
|
|
11418
12195
|
if (typeof value === "undefined") {
|
|
11419
12196
|
offsets.set(index, BigInt(0));
|
|
11420
12197
|
} else {
|
|
@@ -11444,11 +12221,11 @@ return true;`);
|
|
|
11444
12221
|
}
|
|
11445
12222
|
setValue(index, value) {
|
|
11446
12223
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11447
|
-
const
|
|
11448
|
-
const current =
|
|
12224
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12225
|
+
const current = pending2.get(index);
|
|
11449
12226
|
current && (this._pendingLength -= current.size);
|
|
11450
12227
|
this._pendingLength += row.size;
|
|
11451
|
-
|
|
12228
|
+
pending2.set(index, row);
|
|
11452
12229
|
}
|
|
11453
12230
|
addChild(child, name = `${this.numChildren}`) {
|
|
11454
12231
|
if (this.numChildren > 0) {
|
|
@@ -11458,10 +12235,10 @@ return true;`);
|
|
|
11458
12235
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11459
12236
|
return this.numChildren - 1;
|
|
11460
12237
|
}
|
|
11461
|
-
_flushPending(
|
|
12238
|
+
_flushPending(pending2) {
|
|
11462
12239
|
const offsets = this._offsets;
|
|
11463
12240
|
const [child] = this.children;
|
|
11464
|
-
for (const [index, value] of
|
|
12241
|
+
for (const [index, value] of pending2) {
|
|
11465
12242
|
if (value === void 0) {
|
|
11466
12243
|
offsets.set(index, 0);
|
|
11467
12244
|
} else {
|
|
@@ -11670,7 +12447,7 @@ return true;`);
|
|
|
11670
12447
|
return super.setValue(index, encodeUtf8(value));
|
|
11671
12448
|
}
|
|
11672
12449
|
// @ts-ignore
|
|
11673
|
-
_flushPending(
|
|
12450
|
+
_flushPending(pending2, pendingLength) {
|
|
11674
12451
|
}
|
|
11675
12452
|
};
|
|
11676
12453
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11701,7 +12478,7 @@ return true;`);
|
|
|
11701
12478
|
return super.setValue(index, encodeUtf8(value));
|
|
11702
12479
|
}
|
|
11703
12480
|
// @ts-ignore
|
|
11704
|
-
_flushPending(
|
|
12481
|
+
_flushPending(pending2, pendingLength) {
|
|
11705
12482
|
}
|
|
11706
12483
|
};
|
|
11707
12484
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -16080,260 +16857,105 @@ return true;`);
|
|
|
16080
16857
|
}
|
|
16081
16858
|
});
|
|
16082
16859
|
|
|
16083
|
-
// ../core/src/
|
|
16084
|
-
function
|
|
16085
|
-
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
16086
|
-
if (isArrowTable2(input)) {
|
|
16087
|
-
return splitArrowTableBuffersInternal(input, context);
|
|
16088
|
-
}
|
|
16089
|
-
if (isArrowRecordBatch2(input)) {
|
|
16090
|
-
return splitArrowRecordBatchBuffers(input, context);
|
|
16091
|
-
}
|
|
16092
|
-
if (isArrowVector2(input)) {
|
|
16093
|
-
return splitArrowVectorBuffers(input, context);
|
|
16094
|
-
}
|
|
16095
|
-
return splitArrowDataBuffers(input, context);
|
|
16096
|
-
}
|
|
16097
|
-
function isArrowTable2(input) {
|
|
16098
|
-
return "batches" in input;
|
|
16099
|
-
}
|
|
16100
|
-
function isArrowRecordBatch2(input) {
|
|
16101
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
16102
|
-
}
|
|
16103
|
-
function isArrowVector2(input) {
|
|
16104
|
-
return "data" in input && Array.isArray(input.data);
|
|
16105
|
-
}
|
|
16106
|
-
function splitArrowTableBuffersInternal(table, options) {
|
|
16107
|
-
const recordBatches = table.batches.map(
|
|
16108
|
-
(recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
|
|
16109
|
-
);
|
|
16110
|
-
return new Table(table.schema, recordBatches);
|
|
16111
|
-
}
|
|
16112
|
-
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16113
|
-
return new RecordBatch3(
|
|
16114
|
-
recordBatch.schema,
|
|
16115
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
16116
|
-
);
|
|
16117
|
-
}
|
|
16118
|
-
function splitArrowDataBuffers(data, options) {
|
|
16119
|
-
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
16120
|
-
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
16121
|
-
const buffers = {
|
|
16122
|
-
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
16123
|
-
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
16124
|
-
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16125
|
-
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16126
|
-
};
|
|
16127
|
-
return new Data(
|
|
16128
|
-
data.type,
|
|
16129
|
-
data.offset,
|
|
16130
|
-
data.length,
|
|
16131
|
-
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
16132
|
-
data._nullCount,
|
|
16133
|
-
buffers,
|
|
16134
|
-
children,
|
|
16135
|
-
dictionary
|
|
16136
|
-
);
|
|
16137
|
-
}
|
|
16138
|
-
function splitArrowVectorBuffers(vector, options) {
|
|
16139
|
-
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16140
|
-
}
|
|
16141
|
-
function splitArrowBuffer(array, options) {
|
|
16142
|
-
if (!isArrowTypedArray(array)) {
|
|
16143
|
-
return array;
|
|
16144
|
-
}
|
|
16145
|
-
if (options.copy === "none") {
|
|
16146
|
-
return array;
|
|
16147
|
-
}
|
|
16148
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16149
|
-
return array;
|
|
16150
|
-
}
|
|
16151
|
-
let copy = options.copies.get(array);
|
|
16152
|
-
if (!copy) {
|
|
16153
|
-
copy = array.slice();
|
|
16154
|
-
options.copies.set(array, copy);
|
|
16155
|
-
}
|
|
16156
|
-
return copy;
|
|
16157
|
-
}
|
|
16158
|
-
function isArrowTypedArray(value) {
|
|
16159
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16160
|
-
}
|
|
16161
|
-
var init_split_arrow_buffers = __esm({
|
|
16162
|
-
"../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
|
|
16163
|
-
"use strict";
|
|
16164
|
-
init_Arrow_dom();
|
|
16165
|
-
}
|
|
16166
|
-
});
|
|
16167
|
-
|
|
16168
|
-
// ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
|
|
16169
|
-
function dehydrateArrowTable(table, options) {
|
|
16170
|
-
const splitTable = splitArrowBuffers(table, options);
|
|
16171
|
-
return {
|
|
16172
|
-
shape: "arrow-table",
|
|
16173
|
-
transport: "arrow-js",
|
|
16174
|
-
schema: serializeArrowSchema(splitTable.schema),
|
|
16175
|
-
batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
|
|
16176
|
-
};
|
|
16177
|
-
}
|
|
16178
|
-
function hydrateArrowTable(table) {
|
|
16179
|
-
const schema = deserializeArrowSchema(table.schema);
|
|
16180
|
-
const recordBatches = table.batches.map(
|
|
16181
|
-
(recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
|
|
16182
|
-
);
|
|
16183
|
-
return new Table(schema, recordBatches);
|
|
16184
|
-
}
|
|
16185
|
-
function serializeArrowWorkerTable(result) {
|
|
16186
|
-
if (!isArrowTableWrapper(result)) {
|
|
16187
|
-
throw new Error("Workers require Arrow table output");
|
|
16188
|
-
}
|
|
16189
|
-
const { data, ...metadata } = result;
|
|
16190
|
-
return {
|
|
16191
|
-
...structuredClone(metadata),
|
|
16192
|
-
data: dehydrateArrowTable(data, { copy: "all" })
|
|
16193
|
-
};
|
|
16194
|
-
}
|
|
16195
|
-
function deserializeArrowWorkerTable(result) {
|
|
16196
|
-
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16197
|
-
throw new Error("Workers require Arrow column transport");
|
|
16198
|
-
}
|
|
16199
|
-
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16200
|
-
}
|
|
16201
|
-
function isArrowTableWrapper(value) {
|
|
16202
|
-
const table = value;
|
|
16860
|
+
// ../core/src/lib/loader-utils/native-arrow.ts
|
|
16861
|
+
function isNativeArrowTable(value) {
|
|
16203
16862
|
return Boolean(
|
|
16204
|
-
|
|
16863
|
+
value && typeof value === "object" && "schema" in value && "batches" in value && Array.isArray(value.batches) && "numRows" in value && typeof value.numRows === "number" && "getChildAt" in value && typeof value.getChildAt === "function"
|
|
16205
16864
|
);
|
|
16206
16865
|
}
|
|
16207
|
-
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
16211
|
-
);
|
|
16212
|
-
}
|
|
16213
|
-
function dehydrateArrowRecordBatch(recordBatch) {
|
|
16214
|
-
return { data: dehydrateArrowData(recordBatch.data) };
|
|
16215
|
-
}
|
|
16216
|
-
function dehydrateArrowData(data) {
|
|
16217
|
-
return {
|
|
16218
|
-
type: serializeArrowType(data.type),
|
|
16219
|
-
offset: data.offset,
|
|
16220
|
-
length: data.length,
|
|
16221
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
16222
|
-
nullCount: data._nullCount,
|
|
16223
|
-
buffers: {
|
|
16224
|
-
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
16225
|
-
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
16226
|
-
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
16227
|
-
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
16228
|
-
},
|
|
16229
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
16230
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
16231
|
-
};
|
|
16232
|
-
}
|
|
16233
|
-
function dehydrateArrowVector(vector) {
|
|
16234
|
-
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
16235
|
-
}
|
|
16236
|
-
function hydrateArrowData(data) {
|
|
16237
|
-
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
16238
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
16239
|
-
return new Data(
|
|
16240
|
-
deserializeArrowType(data.type),
|
|
16241
|
-
data.offset,
|
|
16242
|
-
data.length,
|
|
16243
|
-
data.nullCount,
|
|
16244
|
-
data.buffers,
|
|
16245
|
-
children,
|
|
16246
|
-
dictionary
|
|
16247
|
-
);
|
|
16248
|
-
}
|
|
16249
|
-
function hydrateArrowVector(vector) {
|
|
16250
|
-
return new Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
16251
|
-
}
|
|
16252
|
-
var init_arrow_table_transport = __esm({
|
|
16253
|
-
"../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
|
|
16254
|
-
"use strict";
|
|
16255
|
-
init_Arrow_dom();
|
|
16256
|
-
init_convert_arrow_schema();
|
|
16257
|
-
init_split_arrow_buffers();
|
|
16258
|
-
}
|
|
16259
|
-
});
|
|
16260
|
-
|
|
16261
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
16262
|
-
var init_arrow_transport = __esm({
|
|
16263
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
16264
|
-
"use strict";
|
|
16265
|
-
init_arrow_table_transport();
|
|
16266
|
-
init_split_arrow_buffers();
|
|
16267
|
-
}
|
|
16268
|
-
});
|
|
16269
|
-
|
|
16270
|
-
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
16271
|
-
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
16272
|
-
if (value instanceof Date) {
|
|
16273
|
-
return "date-millisecond";
|
|
16274
|
-
}
|
|
16275
|
-
if (typeof value === "number") {
|
|
16276
|
-
return defaultNumberType;
|
|
16277
|
-
}
|
|
16278
|
-
if (typeof value === "boolean") {
|
|
16279
|
-
return "bool";
|
|
16280
|
-
}
|
|
16281
|
-
if (typeof value === "string") {
|
|
16282
|
-
return "utf8";
|
|
16283
|
-
}
|
|
16284
|
-
if (value === null || value === "undefined") {
|
|
16285
|
-
return "null";
|
|
16286
|
-
}
|
|
16287
|
-
return "null";
|
|
16288
|
-
}
|
|
16289
|
-
function getDataTypeFromArray(array) {
|
|
16290
|
-
let type = getDataTypeFromTypedArray(array);
|
|
16291
|
-
if (type !== "null") {
|
|
16292
|
-
return { type, nullable: false };
|
|
16293
|
-
}
|
|
16294
|
-
if (array.length > 0) {
|
|
16295
|
-
type = getDataTypeFromValue(array[0]);
|
|
16296
|
-
return { type, nullable: true };
|
|
16297
|
-
}
|
|
16298
|
-
return { type: "null", nullable: true };
|
|
16299
|
-
}
|
|
16300
|
-
function getDataTypeFromTypedArray(array) {
|
|
16301
|
-
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
16302
|
-
return "float16";
|
|
16303
|
-
}
|
|
16304
|
-
switch (array.constructor) {
|
|
16305
|
-
case Int8Array:
|
|
16306
|
-
return "int8";
|
|
16307
|
-
case Uint8Array:
|
|
16308
|
-
case Uint8ClampedArray:
|
|
16309
|
-
return "uint8";
|
|
16310
|
-
case Int16Array:
|
|
16311
|
-
return "int16";
|
|
16312
|
-
case Uint16Array:
|
|
16313
|
-
return "uint16";
|
|
16314
|
-
case Int32Array:
|
|
16315
|
-
return "int32";
|
|
16316
|
-
case Uint32Array:
|
|
16317
|
-
return "uint32";
|
|
16318
|
-
case BigInt64Array:
|
|
16319
|
-
return "int64";
|
|
16320
|
-
case BigUint64Array:
|
|
16321
|
-
return "uint64";
|
|
16322
|
-
case Float32Array:
|
|
16323
|
-
return "float32";
|
|
16324
|
-
case Float64Array:
|
|
16325
|
-
return "float64";
|
|
16326
|
-
default:
|
|
16327
|
-
return "null";
|
|
16866
|
+
var init_native_arrow = __esm({
|
|
16867
|
+
"../core/src/lib/loader-utils/native-arrow.ts"() {
|
|
16868
|
+
"use strict";
|
|
16328
16869
|
}
|
|
16870
|
+
});
|
|
16871
|
+
|
|
16872
|
+
// ../core/src/schema-utils/lib/arrow/arrow-metadata.ts
|
|
16873
|
+
function snapshotArrowSchema(schema) {
|
|
16874
|
+
return deserializeArrowSchema(serializeArrowSchema(schema));
|
|
16875
|
+
}
|
|
16876
|
+
function mergeArrowSchemas(previous, next) {
|
|
16877
|
+
if (!previous) return snapshotArrowSchema(next);
|
|
16878
|
+
new Table(previous, [new RecordBatch3(next, void 0)]);
|
|
16879
|
+
const earlier = serializeArrowSchema(previous);
|
|
16880
|
+
const later = serializeArrowSchema(next);
|
|
16881
|
+
return deserializeArrowSchema({
|
|
16882
|
+
...later,
|
|
16883
|
+
fields: later.fields.map((field, index) => mergeFieldMetadata(earlier.fields[index], field)),
|
|
16884
|
+
metadata: { ...earlier.metadata, ...later.metadata }
|
|
16885
|
+
});
|
|
16329
16886
|
}
|
|
16330
|
-
|
|
16331
|
-
|
|
16887
|
+
function mergeFieldMetadata(previous, next) {
|
|
16888
|
+
return {
|
|
16889
|
+
...next,
|
|
16890
|
+
type: mergeTypeMetadata(previous.type, next.type),
|
|
16891
|
+
metadata: { ...previous.metadata, ...next.metadata }
|
|
16892
|
+
};
|
|
16893
|
+
}
|
|
16894
|
+
function mergeTypeMetadata(previous, next) {
|
|
16895
|
+
if (typeof previous !== "object" || typeof next !== "object") return next;
|
|
16896
|
+
if ("children" in previous && "children" in next) {
|
|
16897
|
+
const previousChildren = previous.children;
|
|
16898
|
+
return {
|
|
16899
|
+
...next,
|
|
16900
|
+
children: next.children.map(
|
|
16901
|
+
(field, index) => mergeFieldMetadata(previousChildren[index], field)
|
|
16902
|
+
)
|
|
16903
|
+
};
|
|
16904
|
+
}
|
|
16905
|
+
if (previous.type === "dictionary" && next.type === "dictionary") {
|
|
16906
|
+
return { ...next, dictionary: mergeTypeMetadata(previous.dictionary, next.dictionary) };
|
|
16907
|
+
}
|
|
16908
|
+
return next;
|
|
16909
|
+
}
|
|
16910
|
+
function updateArrowTableSchema(table, schema) {
|
|
16911
|
+
const snapshot = snapshotArrowSchema(schema);
|
|
16912
|
+
const batches = table.batches.map(
|
|
16913
|
+
(batch) => new RecordBatch3(snapshotArrowSchema(snapshot), batch.data, new Map(batch.metadata))
|
|
16914
|
+
);
|
|
16915
|
+
return new Table(
|
|
16916
|
+
snapshot,
|
|
16917
|
+
batches.length ? batches : [new RecordBatch3(snapshotArrowSchema(snapshot), void 0)]
|
|
16918
|
+
);
|
|
16919
|
+
}
|
|
16920
|
+
function makeArrowMetadataBatch(schema) {
|
|
16921
|
+
return new RecordBatch3(snapshotArrowSchema(schema), void 0);
|
|
16922
|
+
}
|
|
16923
|
+
async function* refineArrowTableBatches(batches) {
|
|
16924
|
+
let schema;
|
|
16925
|
+
let bounds;
|
|
16926
|
+
for await (const batch of batches) {
|
|
16927
|
+
const table = batch;
|
|
16928
|
+
if (table?.shape !== "arrow-table") {
|
|
16929
|
+
yield batch;
|
|
16930
|
+
continue;
|
|
16931
|
+
}
|
|
16932
|
+
const localBounds = table.data.schema.metadata.get("boundingBox");
|
|
16933
|
+
const nextSchema = snapshotArrowSchema(table.data.schema);
|
|
16934
|
+
if (localBounds) {
|
|
16935
|
+
const nextBounds = JSON.parse(localBounds);
|
|
16936
|
+
bounds = bounds ? [
|
|
16937
|
+
nextBounds[0].map((value, index) => Math.min(bounds[0][index], value)),
|
|
16938
|
+
nextBounds[1].map((value, index) => Math.max(bounds[1][index], value))
|
|
16939
|
+
] : nextBounds;
|
|
16940
|
+
nextSchema.metadata.set("boundingBox", JSON.stringify(bounds));
|
|
16941
|
+
}
|
|
16942
|
+
schema = mergeArrowSchemas(schema, nextSchema);
|
|
16943
|
+
const data = updateArrowTableSchema(table.data, schema);
|
|
16944
|
+
if (localBounds) {
|
|
16945
|
+
for (const recordBatch of data.batches) recordBatch.metadata.set("boundingBox", localBounds);
|
|
16946
|
+
}
|
|
16947
|
+
yield { ...table, data, schema: serializeArrowSchema(data.schema) };
|
|
16948
|
+
}
|
|
16949
|
+
}
|
|
16950
|
+
var init_arrow_metadata = __esm({
|
|
16951
|
+
"../core/src/schema-utils/lib/arrow/arrow-metadata.ts"() {
|
|
16332
16952
|
"use strict";
|
|
16953
|
+
init_Arrow_dom();
|
|
16954
|
+
init_convert_arrow_schema();
|
|
16333
16955
|
}
|
|
16334
16956
|
});
|
|
16335
16957
|
|
|
16336
|
-
// ../core/src/schema-utils/lib/mesh/mesh-
|
|
16958
|
+
// ../core/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts
|
|
16337
16959
|
function getMeshBoundingBox(attributes) {
|
|
16338
16960
|
const positionAttribute = attributes?.POSITION;
|
|
16339
16961
|
if (!positionAttribute || !("value" in positionAttribute) || !positionAttribute.value.length) {
|
|
@@ -16363,9 +16985,17 @@ return true;`);
|
|
|
16363
16985
|
[maxX, maxY, maxZ]
|
|
16364
16986
|
];
|
|
16365
16987
|
}
|
|
16988
|
+
var init_get_mesh_bounding_box = __esm({
|
|
16989
|
+
"../core/src/schema-utils/lib/mesh/get-mesh-bounding-box.ts"() {
|
|
16990
|
+
"use strict";
|
|
16991
|
+
}
|
|
16992
|
+
});
|
|
16993
|
+
|
|
16994
|
+
// ../core/src/schema-utils/lib/mesh/mesh-utils.ts
|
|
16366
16995
|
var init_mesh_utils = __esm({
|
|
16367
16996
|
"../core/src/schema-utils/lib/mesh/mesh-utils.ts"() {
|
|
16368
16997
|
"use strict";
|
|
16998
|
+
init_get_mesh_bounding_box();
|
|
16369
16999
|
}
|
|
16370
17000
|
});
|
|
16371
17001
|
|
|
@@ -16441,7 +17071,7 @@ return true;`);
|
|
|
16441
17071
|
var init_float162 = __esm({
|
|
16442
17072
|
"../core/src/schema/float16.ts"() {
|
|
16443
17073
|
"use strict";
|
|
16444
|
-
|
|
17074
|
+
init_dist2();
|
|
16445
17075
|
}
|
|
16446
17076
|
});
|
|
16447
17077
|
|
|
@@ -16525,31 +17155,7 @@ return true;`);
|
|
|
16525
17155
|
});
|
|
16526
17156
|
|
|
16527
17157
|
// ../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts
|
|
16528
|
-
function
|
|
16529
|
-
switch (shape) {
|
|
16530
|
-
case "columnar-table":
|
|
16531
|
-
return convertMeshToColumnarTable(mesh);
|
|
16532
|
-
case "arrow-table":
|
|
16533
|
-
return convertMeshToArrowTable(mesh);
|
|
16534
|
-
default:
|
|
16535
|
-
throw new Error(shape);
|
|
16536
|
-
}
|
|
16537
|
-
}
|
|
16538
|
-
function convertMeshToColumnarTable(mesh) {
|
|
16539
|
-
const columns = {};
|
|
16540
|
-
const hasIndices = hasMeshIndices(mesh);
|
|
16541
|
-
for (const [columnName, attribute] of Object.entries(mesh.attributes)) {
|
|
16542
|
-
columns[columnName] = attribute.value;
|
|
16543
|
-
}
|
|
16544
|
-
return {
|
|
16545
|
-
shape: "columnar-table",
|
|
16546
|
-
schema: mesh.schema,
|
|
16547
|
-
data: columns,
|
|
16548
|
-
topology: mesh.topology,
|
|
16549
|
-
indices: hasIndices ? mesh.indices : void 0
|
|
16550
|
-
};
|
|
16551
|
-
}
|
|
16552
|
-
function convertMeshToArrowTable(mesh, batchSize) {
|
|
17158
|
+
function convertMeshToArrowTableWrapper(mesh, batchSize) {
|
|
16553
17159
|
return makeMeshArrowTable(mesh.attributes, {
|
|
16554
17160
|
schema: mesh.schema,
|
|
16555
17161
|
topology: mesh.topology,
|
|
@@ -16710,6 +17316,7 @@ return true;`);
|
|
|
16710
17316
|
|
|
16711
17317
|
// ../core/src/schema-utils/lib/mesh/convert-table-to-mesh.ts
|
|
16712
17318
|
function convertTableToMesh(table) {
|
|
17319
|
+
if (isNativeArrowTable(table)) return convertArrowTableToMesh(table);
|
|
16713
17320
|
switch (table.shape) {
|
|
16714
17321
|
// case 'columnar-table':
|
|
16715
17322
|
// return convertColumnarTableToMesh(table);
|
|
@@ -16720,8 +17327,10 @@ return true;`);
|
|
|
16720
17327
|
}
|
|
16721
17328
|
}
|
|
16722
17329
|
function convertArrowTableToMesh(table) {
|
|
16723
|
-
const arrowTable = table.data;
|
|
17330
|
+
const arrowTable = isNativeArrowTable(table) ? table : table.data;
|
|
16724
17331
|
const schema = serializeArrowSchema(arrowTable.schema);
|
|
17332
|
+
const localBounds = arrowTable.batches.length === 1 ? arrowTable.batches[0].metadata.get("boundingBox") : void 0;
|
|
17333
|
+
if (localBounds) schema.metadata = { ...schema.metadata, boundingBox: localBounds };
|
|
16725
17334
|
const fields = schema.fields;
|
|
16726
17335
|
const attributes = {};
|
|
16727
17336
|
const columns = [];
|
|
@@ -16876,6 +17485,7 @@ return true;`);
|
|
|
16876
17485
|
init_Arrow_dom();
|
|
16877
17486
|
init_arrow_fixed_size_list_utils();
|
|
16878
17487
|
init_convert_arrow_schema();
|
|
17488
|
+
init_native_arrow();
|
|
16879
17489
|
init_mesh_utils();
|
|
16880
17490
|
}
|
|
16881
17491
|
});
|
|
@@ -16887,6 +17497,377 @@ return true;`);
|
|
|
16887
17497
|
init_mesh_utils();
|
|
16888
17498
|
init_convert_mesh_to_table();
|
|
16889
17499
|
init_convert_table_to_mesh();
|
|
17500
|
+
init_arrow_metadata();
|
|
17501
|
+
init_arrow_metadata();
|
|
17502
|
+
}
|
|
17503
|
+
});
|
|
17504
|
+
|
|
17505
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-helpers.js
|
|
17506
|
+
var init_indexed_arrow_helpers = __esm({
|
|
17507
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-helpers.js"() {
|
|
17508
|
+
}
|
|
17509
|
+
});
|
|
17510
|
+
|
|
17511
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-schema-utils.js
|
|
17512
|
+
var init_arrow_schema_utils = __esm({
|
|
17513
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-schema-utils.js"() {
|
|
17514
|
+
}
|
|
17515
|
+
});
|
|
17516
|
+
|
|
17517
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
17518
|
+
function getArrowVariadicBuffers(data) {
|
|
17519
|
+
return data.variadicBuffers ?? [];
|
|
17520
|
+
}
|
|
17521
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
17522
|
+
return Reflect.construct(Data, [
|
|
17523
|
+
type,
|
|
17524
|
+
offset,
|
|
17525
|
+
length,
|
|
17526
|
+
nullCount,
|
|
17527
|
+
buffers,
|
|
17528
|
+
children,
|
|
17529
|
+
dictionary,
|
|
17530
|
+
variadicBuffers
|
|
17531
|
+
]);
|
|
17532
|
+
}
|
|
17533
|
+
var init_arrow_data = __esm({
|
|
17534
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
17535
|
+
init_Arrow_dom();
|
|
17536
|
+
}
|
|
17537
|
+
});
|
|
17538
|
+
|
|
17539
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-record-batch.js
|
|
17540
|
+
function getRecordBatchMetadata(batch) {
|
|
17541
|
+
return batch.metadata;
|
|
17542
|
+
}
|
|
17543
|
+
function createRecordBatchWithMetadata(schema, data, metadata) {
|
|
17544
|
+
if ("metadata" in RecordBatch3.prototype) {
|
|
17545
|
+
const MetadataRecordBatch = RecordBatch3;
|
|
17546
|
+
return Object.assign(new MetadataRecordBatch(schema, data, metadata), { data });
|
|
17547
|
+
}
|
|
17548
|
+
const batch = Object.assign(new RecordBatch3(schema, data), { data });
|
|
17549
|
+
return metadata === void 0 ? batch : Object.assign(batch, { metadata });
|
|
17550
|
+
}
|
|
17551
|
+
var init_arrow_record_batch = __esm({
|
|
17552
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-record-batch.js"() {
|
|
17553
|
+
init_Arrow_dom();
|
|
17554
|
+
}
|
|
17555
|
+
});
|
|
17556
|
+
|
|
17557
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
17558
|
+
function splitArrowBuffers(input, options = {}) {
|
|
17559
|
+
const retainedBuffers = /* @__PURE__ */ new Set();
|
|
17560
|
+
const visited = /* @__PURE__ */ new Set();
|
|
17561
|
+
for (const retained of options.retain ?? []) {
|
|
17562
|
+
const chunks = isArrowTable2(retained) ? retained.batches.map((batch) => batch.data) : isArrowVector2(retained) ? retained.data : [isArrowRecordBatch2(retained) ? retained.data : retained];
|
|
17563
|
+
for (const data of chunks)
|
|
17564
|
+
collectArrowBuffers(data, retainedBuffers, visited);
|
|
17565
|
+
}
|
|
17566
|
+
const context = { ...options, copies: /* @__PURE__ */ new WeakMap(), retainedBuffers };
|
|
17567
|
+
if (isArrowTable2(input)) {
|
|
17568
|
+
return splitArrowTableBuffersInternal(input, context);
|
|
17569
|
+
}
|
|
17570
|
+
if (isArrowRecordBatch2(input)) {
|
|
17571
|
+
return splitArrowRecordBatchBuffers(input, context);
|
|
17572
|
+
}
|
|
17573
|
+
if (isArrowVector2(input)) {
|
|
17574
|
+
return splitArrowVectorBuffers(input, context);
|
|
17575
|
+
}
|
|
17576
|
+
return splitArrowDataBuffers(input, context);
|
|
17577
|
+
}
|
|
17578
|
+
function isArrowTable2(input) {
|
|
17579
|
+
return "batches" in input;
|
|
17580
|
+
}
|
|
17581
|
+
function isArrowRecordBatch2(input) {
|
|
17582
|
+
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
17583
|
+
}
|
|
17584
|
+
function isArrowVector2(input) {
|
|
17585
|
+
return "data" in input && Array.isArray(input.data);
|
|
17586
|
+
}
|
|
17587
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
17588
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
17589
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
17590
|
+
}
|
|
17591
|
+
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
17592
|
+
const data = splitArrowDataBuffers(recordBatch.data, options);
|
|
17593
|
+
return createRecordBatchWithMetadata(recordBatch.schema, data, getRecordBatchMetadata(recordBatch));
|
|
17594
|
+
}
|
|
17595
|
+
function splitArrowDataBuffers(data, options) {
|
|
17596
|
+
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
17597
|
+
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
17598
|
+
const buffers = {
|
|
17599
|
+
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
17600
|
+
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
17601
|
+
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
17602
|
+
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
17603
|
+
};
|
|
17604
|
+
return createArrowData(
|
|
17605
|
+
data.type,
|
|
17606
|
+
data.offset,
|
|
17607
|
+
data.length,
|
|
17608
|
+
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
17609
|
+
data._nullCount,
|
|
17610
|
+
buffers,
|
|
17611
|
+
children,
|
|
17612
|
+
dictionary,
|
|
17613
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
17614
|
+
);
|
|
17615
|
+
}
|
|
17616
|
+
function splitArrowVectorBuffers(vector, options) {
|
|
17617
|
+
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
17618
|
+
}
|
|
17619
|
+
function collectArrowBuffers(data, buffers, visited) {
|
|
17620
|
+
if (visited.has(data))
|
|
17621
|
+
return;
|
|
17622
|
+
visited.add(data);
|
|
17623
|
+
for (const view of [...Object.values(data.buffers), ...getArrowVariadicBuffers(data)]) {
|
|
17624
|
+
if (isArrowTypedArray(view))
|
|
17625
|
+
buffers.add(view.buffer);
|
|
17626
|
+
}
|
|
17627
|
+
for (const child of data.children)
|
|
17628
|
+
collectArrowBuffers(child, buffers, visited);
|
|
17629
|
+
for (const chunk of data.dictionary?.data ?? [])
|
|
17630
|
+
collectArrowBuffers(chunk, buffers, visited);
|
|
17631
|
+
}
|
|
17632
|
+
function splitArrowBuffer(array, options) {
|
|
17633
|
+
if (!isArrowTypedArray(array)) {
|
|
17634
|
+
return array;
|
|
17635
|
+
}
|
|
17636
|
+
const sliced = array.byteOffset !== 0 || array.byteLength !== array.buffer.byteLength;
|
|
17637
|
+
if (!options.retainedBuffers.has(array.buffer) && options.copy !== "all" && (options.copy === "none" || !sliced)) {
|
|
17638
|
+
return array;
|
|
17639
|
+
}
|
|
17640
|
+
let copy = options.copies.get(array);
|
|
17641
|
+
if (!copy) {
|
|
17642
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
17643
|
+
options.copies.set(array, copy);
|
|
17644
|
+
}
|
|
17645
|
+
return copy;
|
|
17646
|
+
}
|
|
17647
|
+
function isArrowTypedArray(value) {
|
|
17648
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
17649
|
+
}
|
|
17650
|
+
var init_split_arrow_buffers = __esm({
|
|
17651
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
17652
|
+
init_Arrow_dom();
|
|
17653
|
+
init_arrow_record_batch();
|
|
17654
|
+
init_arrow_data();
|
|
17655
|
+
}
|
|
17656
|
+
});
|
|
17657
|
+
|
|
17658
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js
|
|
17659
|
+
var init_take_arrow_rows = __esm({
|
|
17660
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/take-arrow-rows.js"() {
|
|
17661
|
+
init_arrow_data();
|
|
17662
|
+
init_split_arrow_buffers();
|
|
17663
|
+
}
|
|
17664
|
+
});
|
|
17665
|
+
|
|
17666
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
17667
|
+
var init_indexed_arrow_vector = __esm({
|
|
17668
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
17669
|
+
init_indexed_arrow_helpers();
|
|
17670
|
+
}
|
|
17671
|
+
});
|
|
17672
|
+
|
|
17673
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
17674
|
+
var init_indexed_arrow_table = __esm({
|
|
17675
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
17676
|
+
init_indexed_arrow_helpers();
|
|
17677
|
+
init_arrow_schema_utils();
|
|
17678
|
+
init_take_arrow_rows();
|
|
17679
|
+
init_indexed_arrow_vector();
|
|
17680
|
+
}
|
|
17681
|
+
});
|
|
17682
|
+
|
|
17683
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
17684
|
+
var init_mapped_arrow_table = __esm({
|
|
17685
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
17686
|
+
init_indexed_arrow_helpers();
|
|
17687
|
+
init_indexed_arrow_table();
|
|
17688
|
+
}
|
|
17689
|
+
});
|
|
17690
|
+
|
|
17691
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
17692
|
+
var init_rename_arrow_columns = __esm({
|
|
17693
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
17694
|
+
init_arrow_schema_utils();
|
|
17695
|
+
}
|
|
17696
|
+
});
|
|
17697
|
+
|
|
17698
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
17699
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
17700
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
17701
|
+
return {
|
|
17702
|
+
transport: "arrow-js",
|
|
17703
|
+
version: 1,
|
|
17704
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
17705
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
17706
|
+
batches: splitTable.batches.map((batch) => {
|
|
17707
|
+
const metadata = getRecordBatchMetadata(batch);
|
|
17708
|
+
return {
|
|
17709
|
+
...dehydrateArrowData(batch.data),
|
|
17710
|
+
...metadata !== void 0 ? { metadata: [...metadata] } : {}
|
|
17711
|
+
};
|
|
17712
|
+
})
|
|
17713
|
+
};
|
|
17714
|
+
}
|
|
17715
|
+
function hydrateArrowTable(table) {
|
|
17716
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
17717
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
17718
|
+
}
|
|
17719
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
17720
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
17721
|
+
const type = new Struct(schema.fields);
|
|
17722
|
+
const batches = table.batches.map((payload) => {
|
|
17723
|
+
const data = hydrateArrowData(payload, type);
|
|
17724
|
+
return createRecordBatchWithMetadata(schema, data, payload.metadata && new Map(payload.metadata));
|
|
17725
|
+
});
|
|
17726
|
+
return new Table(schema, batches);
|
|
17727
|
+
}
|
|
17728
|
+
function dehydrateArrowData(data) {
|
|
17729
|
+
return {
|
|
17730
|
+
offset: data.offset,
|
|
17731
|
+
length: data.length,
|
|
17732
|
+
nullCount: data.nullCount,
|
|
17733
|
+
buffers: {
|
|
17734
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
17735
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
17736
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
17737
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
17738
|
+
},
|
|
17739
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
17740
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
17741
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
17742
|
+
};
|
|
17743
|
+
}
|
|
17744
|
+
function hydrateArrowData(data, type) {
|
|
17745
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
17746
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
17747
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
17748
|
+
}
|
|
17749
|
+
var init_arrow_table_transport = __esm({
|
|
17750
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
17751
|
+
init_Arrow_dom();
|
|
17752
|
+
init_arrow_record_batch();
|
|
17753
|
+
init_arrow_data();
|
|
17754
|
+
init_split_arrow_buffers();
|
|
17755
|
+
}
|
|
17756
|
+
});
|
|
17757
|
+
|
|
17758
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js
|
|
17759
|
+
var init_arrow_column_utils = __esm({
|
|
17760
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-column-utils.js"() {
|
|
17761
|
+
}
|
|
17762
|
+
});
|
|
17763
|
+
|
|
17764
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
17765
|
+
var init_arrow = __esm({
|
|
17766
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
17767
|
+
init_indexed_arrow_table();
|
|
17768
|
+
init_indexed_arrow_vector();
|
|
17769
|
+
init_mapped_arrow_table();
|
|
17770
|
+
init_arrow_schema_utils();
|
|
17771
|
+
init_rename_arrow_columns();
|
|
17772
|
+
init_split_arrow_buffers();
|
|
17773
|
+
init_arrow_table_transport();
|
|
17774
|
+
init_arrow_column_utils();
|
|
17775
|
+
init_take_arrow_rows();
|
|
17776
|
+
init_arrow_record_batch();
|
|
17777
|
+
}
|
|
17778
|
+
});
|
|
17779
|
+
|
|
17780
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
17781
|
+
var init_dist3 = __esm({
|
|
17782
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
17783
|
+
init_arrow();
|
|
17784
|
+
}
|
|
17785
|
+
});
|
|
17786
|
+
|
|
17787
|
+
// ../core/src/arrow-worker-transport.ts
|
|
17788
|
+
function serializeArrowWorkerTable(result) {
|
|
17789
|
+
if (!isArrowTableWrapper(result)) {
|
|
17790
|
+
throw new Error("Workers require Arrow table output");
|
|
17791
|
+
}
|
|
17792
|
+
const { data, shape: _shape, ...metadata } = result;
|
|
17793
|
+
return {
|
|
17794
|
+
transport: "arrow-column-envelope",
|
|
17795
|
+
metadata: structuredClone(metadata),
|
|
17796
|
+
...serializeWorkerColumns(data, { copy: "all" })
|
|
17797
|
+
};
|
|
17798
|
+
}
|
|
17799
|
+
function deserializeArrowWorkerTable(result) {
|
|
17800
|
+
if (isArrowWorkerEnvelope(result)) {
|
|
17801
|
+
return { ...result.metadata, shape: "arrow-table", data: hydrateWorkerTable(result) };
|
|
17802
|
+
}
|
|
17803
|
+
if (isLegacyArrowWorkerEnvelope(result)) {
|
|
17804
|
+
const { arrowBatchMetadata: _snapshots, data: _columns, ...metadata } = result;
|
|
17805
|
+
return { ...metadata, data: hydrateWorkerTable(result) };
|
|
17806
|
+
}
|
|
17807
|
+
throw new Error("Workers require Arrow column transport");
|
|
17808
|
+
}
|
|
17809
|
+
function isArrowTableWrapper(value) {
|
|
17810
|
+
const table = value;
|
|
17811
|
+
return Boolean(
|
|
17812
|
+
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
17813
|
+
);
|
|
17814
|
+
}
|
|
17815
|
+
function hasArrowWorkerColumns(value) {
|
|
17816
|
+
const columns = value;
|
|
17817
|
+
return columns?.data?.transport === "arrow-js" && Array.isArray(columns.data.batches);
|
|
17818
|
+
}
|
|
17819
|
+
function isArrowWorkerEnvelope(value) {
|
|
17820
|
+
return value?.transport === "arrow-column-envelope" && hasArrowWorkerColumns(value);
|
|
17821
|
+
}
|
|
17822
|
+
function isLegacyArrowWorkerEnvelope(value) {
|
|
17823
|
+
return value?.shape === "arrow-table" && hasArrowWorkerColumns(value);
|
|
17824
|
+
}
|
|
17825
|
+
function serializeWorkerColumns(table, options) {
|
|
17826
|
+
return {
|
|
17827
|
+
arrowBatchMetadata: snapshotBatchMetadata(table),
|
|
17828
|
+
data: dehydrateWorkerTable(table, options)
|
|
17829
|
+
};
|
|
17830
|
+
}
|
|
17831
|
+
function dehydrateWorkerTable(table, options) {
|
|
17832
|
+
const payload = dehydrateArrowTable(table, options);
|
|
17833
|
+
if (table.numCols === 0) {
|
|
17834
|
+
for (const [index, batch] of table.batches.entries()) {
|
|
17835
|
+
payload.batches[index].length = batch.numRows;
|
|
17836
|
+
}
|
|
17837
|
+
}
|
|
17838
|
+
return payload;
|
|
17839
|
+
}
|
|
17840
|
+
function snapshotBatchMetadata(table) {
|
|
17841
|
+
return table.batches.map((batch) => ({
|
|
17842
|
+
schema: tableToIPC(new Table(batch.schema, [])),
|
|
17843
|
+
metadata: Array.from(batch.metadata)
|
|
17844
|
+
}));
|
|
17845
|
+
}
|
|
17846
|
+
function hydrateWorkerTable(result) {
|
|
17847
|
+
const { arrowBatchMetadata, data } = result;
|
|
17848
|
+
const table = hydrateArrowTable(data);
|
|
17849
|
+
const batches = table.batches.map((batch, index) => {
|
|
17850
|
+
const snapshot = arrowBatchMetadata?.[index];
|
|
17851
|
+
const restored = snapshot ? new RecordBatch3(
|
|
17852
|
+
tableFromIPC(snapshot.schema).schema,
|
|
17853
|
+
batch.data,
|
|
17854
|
+
new Map(snapshot.metadata)
|
|
17855
|
+
) : batch;
|
|
17856
|
+
const rowCount = data.batches[index].length;
|
|
17857
|
+
if (restored.numCols === 0 && restored.numRows !== rowCount) {
|
|
17858
|
+
Object.defineProperty(restored, "data", {
|
|
17859
|
+
value: new Data(new Struct([]), 0, rowCount, 0, void 0, [])
|
|
17860
|
+
});
|
|
17861
|
+
}
|
|
17862
|
+
return restored;
|
|
17863
|
+
});
|
|
17864
|
+
return new Table(table.schema, batches);
|
|
17865
|
+
}
|
|
17866
|
+
var init_arrow_worker_transport = __esm({
|
|
17867
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
17868
|
+
"use strict";
|
|
17869
|
+
init_Arrow_dom();
|
|
17870
|
+
init_dist3();
|
|
16890
17871
|
}
|
|
16891
17872
|
});
|
|
16892
17873
|
|
|
@@ -17347,9 +18328,11 @@ return true;`);
|
|
|
17347
18328
|
"src/pcd/pcd-loader-types.ts"() {
|
|
17348
18329
|
"use strict";
|
|
17349
18330
|
init_pcd_format();
|
|
17350
|
-
|
|
17351
|
-
VERSION = true ? "5.0.0-beta.
|
|
18331
|
+
init_arrow_worker_transport();
|
|
18332
|
+
VERSION = true ? "5.0.0-beta.10" : "latest";
|
|
17352
18333
|
PCDLoader = {
|
|
18334
|
+
defaultShape: "arrow",
|
|
18335
|
+
supportsNativeArrow: true,
|
|
17353
18336
|
...PCDFormat,
|
|
17354
18337
|
dataType: null,
|
|
17355
18338
|
batchType: null,
|
|
@@ -17359,7 +18342,7 @@ return true;`);
|
|
|
17359
18342
|
workerInBatches: true,
|
|
17360
18343
|
serializeWorkerResult: serializeArrowWorkerTable,
|
|
17361
18344
|
options: {
|
|
17362
|
-
pcd: { shape: "arrow
|
|
18345
|
+
pcd: { shape: "arrow", colorFormat: "uint8norm" }
|
|
17363
18346
|
},
|
|
17364
18347
|
preload
|
|
17365
18348
|
};
|
|
@@ -17369,14 +18352,15 @@ return true;`);
|
|
|
17369
18352
|
// src/pcd/pcd-loader.ts
|
|
17370
18353
|
var pcd_loader_exports = {};
|
|
17371
18354
|
__export(pcd_loader_exports, {
|
|
18355
|
+
PCDColumnLoader: () => PCDColumnLoader,
|
|
17372
18356
|
PCDLoaderWithParser: () => PCDLoaderWithParser
|
|
17373
18357
|
});
|
|
17374
18358
|
function convertPCDMesh(mesh, options) {
|
|
17375
|
-
const table =
|
|
18359
|
+
const table = convertMeshToArrowTableWrapper(mesh);
|
|
17376
18360
|
return options?.pcd?.shape === "mesh" ? convertPCDTableToMesh(table, mesh) : { ...table, loader: mesh.loader, loaderData: mesh.loaderData };
|
|
17377
18361
|
}
|
|
17378
18362
|
function getNumericBatchSize(options) {
|
|
17379
|
-
const batchSize = options?.
|
|
18363
|
+
const batchSize = options?.core?.batchSize;
|
|
17380
18364
|
return typeof batchSize === "number" ? batchSize : void 0;
|
|
17381
18365
|
}
|
|
17382
18366
|
function* parsePCDASCIIInBatches(data, options, batchSize) {
|
|
@@ -17411,7 +18395,7 @@ return true;`);
|
|
|
17411
18395
|
}
|
|
17412
18396
|
}
|
|
17413
18397
|
function makePCDBatch(mesh, options) {
|
|
17414
|
-
const table =
|
|
18398
|
+
const table = convertMeshToArrowTableWrapper(mesh);
|
|
17415
18399
|
if (options?.pcd?.shape === "mesh") {
|
|
17416
18400
|
return convertPCDTableToMesh(table, mesh);
|
|
17417
18401
|
}
|
|
@@ -17455,40 +18439,95 @@ return true;`);
|
|
|
17455
18439
|
function deserializePCDWorkerBatch(result, options) {
|
|
17456
18440
|
return deserializePCDWorkerResult(result, options);
|
|
17457
18441
|
}
|
|
17458
|
-
|
|
18442
|
+
async function* parsePCDWithMetadataInBatches(arrayBuffer, options) {
|
|
18443
|
+
const batchSize = getNumericBatchSize(options);
|
|
18444
|
+
const data = await concatenateArrayBuffersAsync(arrayBuffer);
|
|
18445
|
+
const textData = new TextDecoder().decode(data);
|
|
18446
|
+
const pcdHeader = parsePCDHeader(textData);
|
|
18447
|
+
if (pcdHeader.data === "ascii") {
|
|
18448
|
+
yield* parsePCDASCIIInBatches(data, options, batchSize);
|
|
18449
|
+
return;
|
|
18450
|
+
}
|
|
18451
|
+
if (pcdHeader.data === "binary") {
|
|
18452
|
+
yield* parsePCDBinaryInBatches(data, options, batchSize);
|
|
18453
|
+
return;
|
|
18454
|
+
}
|
|
18455
|
+
yield makePCDBatch(parsePCD(data, options), options);
|
|
18456
|
+
}
|
|
18457
|
+
function unwrapPCDTable(result) {
|
|
18458
|
+
if ("shape" in result && result.shape === "arrow-table") {
|
|
18459
|
+
result.data.schema.metadata.set(
|
|
18460
|
+
"loaders.gl.pcd.header",
|
|
18461
|
+
JSON.stringify(result.loaderData)
|
|
18462
|
+
);
|
|
18463
|
+
return result.data;
|
|
18464
|
+
}
|
|
18465
|
+
return result;
|
|
18466
|
+
}
|
|
18467
|
+
function isColumnBatch(batch) {
|
|
18468
|
+
return "shape" in batch && batch.shape === "arrow-table";
|
|
18469
|
+
}
|
|
18470
|
+
var _PCDLoaderPreload, PCDLoaderMetadataWithoutPreload, PCDColumnLoader, PCDLoaderWithParser;
|
|
17459
18471
|
var init_pcd_loader = __esm({
|
|
17460
18472
|
"src/pcd/pcd-loader.ts"() {
|
|
17461
18473
|
"use strict";
|
|
18474
|
+
init_schema_utils();
|
|
17462
18475
|
init_loader_utils();
|
|
17463
|
-
|
|
18476
|
+
init_arrow_worker_transport();
|
|
17464
18477
|
init_schema_utils();
|
|
17465
18478
|
init_parse_pcd();
|
|
17466
18479
|
init_pcd_loader_types();
|
|
17467
18480
|
({ preload: _PCDLoaderPreload, ...PCDLoaderMetadataWithoutPreload } = PCDLoader);
|
|
17468
|
-
|
|
18481
|
+
PCDColumnLoader = {
|
|
17469
18482
|
...PCDLoaderMetadataWithoutPreload,
|
|
18483
|
+
dataType: null,
|
|
18484
|
+
batchType: null,
|
|
17470
18485
|
parse: async (arrayBuffer, options) => convertPCDMesh(parsePCD(arrayBuffer, options), options),
|
|
17471
18486
|
parseSync: (arrayBuffer, options) => convertPCDMesh(parsePCD(arrayBuffer, options), options),
|
|
17472
|
-
parseInBatches:
|
|
17473
|
-
const batchSize = getNumericBatchSize(options);
|
|
17474
|
-
const data = await concatenateArrayBuffersAsync(arrayBuffer);
|
|
17475
|
-
const textData = new TextDecoder().decode(data);
|
|
17476
|
-
const pcdHeader = parsePCDHeader(textData);
|
|
17477
|
-
if (pcdHeader.data === "ascii") {
|
|
17478
|
-
yield* parsePCDASCIIInBatches(data, options, batchSize);
|
|
17479
|
-
return;
|
|
17480
|
-
}
|
|
17481
|
-
if (pcdHeader.data === "binary") {
|
|
17482
|
-
yield* parsePCDBinaryInBatches(data, options, batchSize);
|
|
17483
|
-
return;
|
|
17484
|
-
}
|
|
17485
|
-
yield makePCDBatch(parsePCD(data, options), options);
|
|
17486
|
-
},
|
|
18487
|
+
parseInBatches: (input, options) => refineArrowTableBatches(parsePCDWithMetadataInBatches(input, options)),
|
|
17487
18488
|
serializeWorkerResult: serializeArrowWorkerTable,
|
|
17488
18489
|
deserializeWorkerResult: deserializePCDWorkerResult,
|
|
17489
18490
|
serializeWorkerBatch: serializeArrowWorkerTable,
|
|
17490
18491
|
deserializeWorkerBatch: deserializePCDWorkerBatch
|
|
17491
18492
|
};
|
|
18493
|
+
PCDLoaderWithParser = {
|
|
18494
|
+
...PCDColumnLoader,
|
|
18495
|
+
dataType: PCDLoader.dataType,
|
|
18496
|
+
batchType: PCDLoader.batchType,
|
|
18497
|
+
parse: async (input, options) => unwrapPCDTable(await PCDColumnLoader.parse(input, options)),
|
|
18498
|
+
parseSync: (input, options) => unwrapPCDTable(PCDColumnLoader.parseSync(input, options)),
|
|
18499
|
+
async *parseInBatches(input, options) {
|
|
18500
|
+
for await (const batch of PCDColumnLoader.parseInBatches(input, options)) {
|
|
18501
|
+
if (isColumnBatch(batch)) {
|
|
18502
|
+
batch.data.schema.metadata.set(
|
|
18503
|
+
"loaders.gl.pcd.header",
|
|
18504
|
+
JSON.stringify(batch.loaderData)
|
|
18505
|
+
);
|
|
18506
|
+
for (const recordBatch of batch.data.batches) {
|
|
18507
|
+
recordBatch.schema.metadata.set(
|
|
18508
|
+
"loaders.gl.pcd.header",
|
|
18509
|
+
batch.data.schema.metadata.get("loaders.gl.pcd.header")
|
|
18510
|
+
);
|
|
18511
|
+
}
|
|
18512
|
+
if (batch.data.batches.length) yield* batch.data.batches;
|
|
18513
|
+
else yield makeArrowMetadataBatch(batch.data.schema);
|
|
18514
|
+
} else yield batch;
|
|
18515
|
+
}
|
|
18516
|
+
},
|
|
18517
|
+
deserializeWorkerResult: (result, options) => unwrapPCDTable(PCDColumnLoader.deserializeWorkerResult(result, options)),
|
|
18518
|
+
deserializeWorkerBatch(result, options) {
|
|
18519
|
+
const batch = PCDColumnLoader.deserializeWorkerBatch(result, options);
|
|
18520
|
+
if (isColumnBatch(batch)) {
|
|
18521
|
+
const recordBatch = batch.data.batches[0] ?? makeArrowMetadataBatch(batch.data.schema);
|
|
18522
|
+
recordBatch.schema.metadata.set(
|
|
18523
|
+
"loaders.gl.pcd.header",
|
|
18524
|
+
JSON.stringify(batch.loaderData)
|
|
18525
|
+
);
|
|
18526
|
+
return recordBatch;
|
|
18527
|
+
}
|
|
18528
|
+
return batch;
|
|
18529
|
+
}
|
|
18530
|
+
};
|
|
17492
18531
|
}
|
|
17493
18532
|
});
|
|
17494
18533
|
|
|
@@ -17496,19 +18535,19 @@ return true;`);
|
|
|
17496
18535
|
init_loader_utils();
|
|
17497
18536
|
init_pcd_loader();
|
|
17498
18537
|
createLoaderWorker({
|
|
17499
|
-
...
|
|
18538
|
+
...PCDColumnLoader,
|
|
17500
18539
|
/** Always returns columnar data; legacy mesh conversion runs on the caller. */
|
|
17501
18540
|
parse(input, options) {
|
|
17502
|
-
return
|
|
18541
|
+
return PCDColumnLoader.parse(input, {
|
|
17503
18542
|
...options,
|
|
17504
|
-
pcd: { ...options?.pcd, shape: "arrow
|
|
18543
|
+
pcd: { ...options?.pcd, shape: "arrow" }
|
|
17505
18544
|
});
|
|
17506
18545
|
},
|
|
17507
18546
|
/** Keeps one columnar parser alive for the entire worker input stream. */
|
|
17508
18547
|
parseInBatches(input, options) {
|
|
17509
|
-
return
|
|
18548
|
+
return PCDColumnLoader.parseInBatches(input, {
|
|
17510
18549
|
...options,
|
|
17511
|
-
pcd: { ...options?.pcd, shape: "arrow
|
|
18550
|
+
pcd: { ...options?.pcd, shape: "arrow" }
|
|
17512
18551
|
});
|
|
17513
18552
|
}
|
|
17514
18553
|
});
|