@loaders.gl/scene 5.0.0-beta.2 → 5.0.0-beta.5
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/DRACO-README.md +1 -1
- package/GLTF-README.md +1 -1
- package/OBJ-README.md +1 -1
- package/README.md +6 -1
- package/THIRD-PARTY-NOTICES.md +6 -0
- package/dist/dist.dev.js +6557 -1363
- package/dist/dist.min.js +24 -16
- package/dist/draco/draco-javascript-loader-with-parser.d.ts +2 -2
- package/dist/draco/draco-loader-types.cjs +3 -3
- package/dist/draco/draco-loader-types.cjs.map +2 -2
- package/dist/draco/draco-loader-types.d.ts +1 -1
- package/dist/draco/draco-loader-types.d.ts.map +1 -1
- package/dist/draco/draco-loader-types.js +1 -1
- package/dist/draco/draco-loader-types.js.map +1 -1
- package/dist/draco/draco-loader.d.ts +2 -2
- package/dist/draco/draco-wasm-loader-with-parser.d.ts +2 -2
- package/dist/draco/draco3d-loader-with-parser.d.ts +2 -2
- package/dist/draco/lib/utils/version.cjs +1 -1
- package/dist/draco/lib/utils/version.js +1 -1
- package/dist/draco-worker-node.js +806 -158
- package/dist/draco-worker-node.js.map +4 -4
- package/dist/draco-worker.js +775 -158
- package/dist/draco-worker.js.map +4 -4
- package/dist/draco-writer-worker-node.cjs +2122 -219
- package/dist/draco-writer-worker-node.cjs.map +4 -4
- package/dist/draco-writer-worker.js +2053 -220
- package/dist/draco-writer-worker.js.map +4 -4
- package/dist/gltf/gltf-loader-types.cjs.map +2 -2
- package/dist/gltf/gltf-loader-types.d.ts +6 -0
- package/dist/gltf/gltf-loader-types.d.ts.map +1 -1
- package/dist/gltf/gltf-loader-types.js.map +1 -1
- package/dist/gltf/index.cjs +2 -0
- package/dist/gltf/index.cjs.map +2 -2
- package/dist/gltf/index.d.ts +2 -2
- package/dist/gltf/index.d.ts.map +1 -1
- package/dist/gltf/index.js +1 -1
- package/dist/gltf/index.js.map +1 -1
- package/dist/gltf/lib/api/gltf-extensions.cjs +7 -2
- package/dist/gltf/lib/api/gltf-extensions.cjs.map +2 -2
- package/dist/gltf/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/gltf/lib/api/gltf-extensions.js +7 -5
- package/dist/gltf/lib/api/gltf-extensions.js.map +1 -1
- package/dist/gltf/lib/extensions/EXT_texture_webp.cjs +1 -0
- package/dist/gltf/lib/extensions/EXT_texture_webp.cjs.map +2 -2
- package/dist/gltf/lib/extensions/EXT_texture_webp.d.ts.map +1 -1
- package/dist/gltf/lib/extensions/EXT_texture_webp.js +3 -0
- package/dist/gltf/lib/extensions/EXT_texture_webp.js.map +1 -1
- package/dist/gltf/lib/extensions/KHR_accessor_float64.cjs +45 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.cjs.map +7 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.d.ts +6 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.d.ts.map +1 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.js +20 -0
- package/dist/gltf/lib/extensions/KHR_accessor_float64.js.map +1 -0
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.cjs +23 -7
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.cjs.map +2 -2
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.d.ts +2 -1
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.d.ts.map +1 -1
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.js +21 -5
- package/dist/gltf/lib/extensions/KHR_gaussian_splatting.js.map +1 -1
- package/dist/gltf/lib/extensions/MSFT_texture_dds.cjs +64 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.cjs.map +7 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.d.ts +12 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.d.ts.map +1 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.js +39 -0
- package/dist/gltf/lib/extensions/MSFT_texture_dds.js.map +1 -0
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.cjs +1 -1
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.cjs.map +2 -2
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.d.ts.map +1 -1
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.js +3 -1
- package/dist/gltf/lib/extensions/utils/3d-tiles-utils.js.map +1 -1
- package/dist/gltf/lib/parsers/parse-gltf.cjs +25 -0
- package/dist/gltf/lib/parsers/parse-gltf.cjs.map +2 -2
- package/dist/gltf/lib/parsers/parse-gltf.d.ts +2 -0
- package/dist/gltf/lib/parsers/parse-gltf.d.ts.map +1 -1
- package/dist/gltf/lib/parsers/parse-gltf.js +18 -0
- package/dist/gltf/lib/parsers/parse-gltf.js.map +1 -1
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.cjs +22 -0
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.cjs.map +2 -2
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.d.ts +23 -0
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.js +22 -0
- package/dist/gltf/lib/types/gltf-additional-extension-schemas.js.map +1 -1
- package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.cjs.map +1 -1
- package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.d.ts +1 -1
- package/dist/gltf/lib/types/gltf-ext-gaussian-splatting-schema.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-extension-schemas.cjs +8 -0
- package/dist/gltf/lib/types/gltf-extension-schemas.cjs.map +2 -2
- package/dist/gltf/lib/types/gltf-extension-schemas.d.ts +27 -0
- package/dist/gltf/lib/types/gltf-extension-schemas.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-extension-schemas.js +8 -1
- package/dist/gltf/lib/types/gltf-extension-schemas.js.map +1 -1
- package/dist/gltf/lib/types/gltf-json-schema.cjs.map +1 -1
- package/dist/gltf/lib/types/gltf-json-schema.d.ts +2 -2
- package/dist/gltf/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-texture-procedurals.cjs +19 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.cjs.map +7 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.d.ts +45 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.d.ts.map +1 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.js +5 -0
- package/dist/gltf/lib/types/gltf-texture-procedurals.js.map +1 -0
- package/dist/gltf/lib/types/gltf-types.cjs.map +1 -1
- package/dist/gltf/lib/types/gltf-types.d.ts +7 -0
- package/dist/gltf/lib/types/gltf-types.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-version-zod-schemas.d.ts +34 -0
- package/dist/gltf/lib/types/gltf-version-zod-schemas.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-zod-schema.cjs +4 -1
- package/dist/gltf/lib/types/gltf-zod-schema.cjs.map +2 -2
- package/dist/gltf/lib/types/gltf-zod-schema.d.ts +56 -0
- package/dist/gltf/lib/types/gltf-zod-schema.d.ts.map +1 -1
- package/dist/gltf/lib/types/gltf-zod-schema.js +6 -2
- package/dist/gltf/lib/types/gltf-zod-schema.js.map +1 -1
- package/dist/gltf/lib/utils/version.cjs +1 -1
- package/dist/gltf/lib/utils/version.js +1 -1
- package/dist/gltf/schema.cjs +3 -0
- package/dist/gltf/schema.cjs.map +2 -2
- package/dist/gltf/schema.d.ts +1 -0
- package/dist/gltf/schema.d.ts.map +1 -1
- package/dist/gltf/schema.js +1 -0
- package/dist/gltf/schema.js.map +1 -1
- package/dist/gltf-loader-types.cjs.map +2 -2
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/materialx/parse-materialx.cjs +61 -0
- package/dist/materialx/parse-materialx.cjs.map +7 -0
- package/dist/materialx/parse-materialx.d.ts +23 -0
- package/dist/materialx/parse-materialx.d.ts.map +1 -0
- package/dist/materialx/parse-materialx.js +39 -0
- package/dist/materialx/parse-materialx.js.map +1 -0
- package/dist/materialx/procedural-graph.cjs +77 -0
- package/dist/materialx/procedural-graph.cjs.map +7 -0
- package/dist/materialx/procedural-graph.d.ts +40 -0
- package/dist/materialx/procedural-graph.d.ts.map +1 -0
- package/dist/materialx/procedural-graph.js +59 -0
- package/dist/materialx/procedural-graph.js.map +1 -0
- package/dist/materialx-loader-types.cjs +57 -0
- package/dist/materialx-loader-types.cjs.map +7 -0
- package/dist/materialx-loader-types.d.ts +34 -0
- package/dist/materialx-loader-types.d.ts.map +1 -0
- package/dist/materialx-loader-types.js +20 -0
- package/dist/materialx-loader-types.js.map +1 -0
- package/dist/materialx-loader.cjs +40 -0
- package/dist/materialx-loader.cjs.map +7 -0
- package/dist/materialx-loader.d.ts +19 -0
- package/dist/materialx-loader.d.ts.map +1 -0
- package/dist/materialx-loader.js +14 -0
- package/dist/materialx-loader.js.map +1 -0
- package/dist/mtl-loader-types.cjs +1 -1
- package/dist/obj/mtl-loader-types.cjs +1 -1
- package/dist/obj/mtl-loader-types.js +1 -1
- package/dist/obj/obj-loader-types.cjs +3 -3
- package/dist/obj/obj-loader-types.cjs.map +2 -2
- package/dist/obj/obj-loader-types.d.ts +1 -1
- package/dist/obj/obj-loader-types.d.ts.map +1 -1
- package/dist/obj/obj-loader-types.js +2 -2
- package/dist/obj/obj-loader-types.js.map +1 -1
- package/dist/obj/obj-loader.cjs +5 -5
- package/dist/obj/obj-loader.cjs.map +2 -2
- package/dist/obj/obj-loader.d.ts +1 -1
- package/dist/obj/obj-loader.d.ts.map +1 -1
- package/dist/obj/obj-loader.js +1 -1
- package/dist/obj/obj-loader.js.map +1 -1
- package/dist/obj/obj-writer.cjs +1 -1
- package/dist/obj/obj-writer.js +1 -1
- package/dist/obj-loader-types.cjs +3 -3
- package/dist/obj-loader-types.cjs.map +2 -2
- package/dist/obj-loader.cjs +5 -5
- package/dist/obj-loader.cjs.map +2 -2
- package/dist/obj-worker.js +985 -368
- package/dist/obj-writer.cjs +1 -1
- package/dist/stl/parse-stl.cjs +100 -0
- package/dist/stl/parse-stl.cjs.map +7 -0
- package/dist/stl/parse-stl.d.ts +4 -0
- package/dist/stl/parse-stl.d.ts.map +1 -0
- package/dist/stl/parse-stl.js +84 -0
- package/dist/stl/parse-stl.js.map +1 -0
- package/dist/stl-loader-types.cjs +58 -0
- package/dist/stl-loader-types.cjs.map +7 -0
- package/dist/stl-loader-types.d.ts +32 -0
- package/dist/stl-loader-types.d.ts.map +1 -0
- package/dist/stl-loader-types.js +25 -0
- package/dist/stl-loader-types.js.map +1 -0
- package/dist/stl-loader.cjs +38 -0
- package/dist/stl-loader.cjs.map +7 -0
- package/dist/stl-loader.d.ts +17 -0
- package/dist/stl-loader.d.ts.map +1 -0
- package/dist/stl-loader.js +13 -0
- package/dist/stl-loader.js.map +1 -0
- package/dist/usd/index.cjs.map +1 -1
- package/dist/usd/index.d.ts +1 -1
- package/dist/usd/index.d.ts.map +1 -1
- package/dist/usd/lib/parse-usd.cjs +42 -5
- package/dist/usd/lib/parse-usd.cjs.map +2 -2
- package/dist/usd/lib/parse-usd.d.ts.map +1 -1
- package/dist/usd/lib/parse-usd.js +53 -6
- package/dist/usd/lib/parse-usd.js.map +1 -1
- package/dist/usd/lib/parse-usdc.cjs +187 -0
- package/dist/usd/lib/parse-usdc.cjs.map +7 -0
- package/dist/usd/lib/parse-usdc.d.ts +4 -0
- package/dist/usd/lib/parse-usdc.d.ts.map +1 -0
- package/dist/usd/lib/parse-usdc.js +176 -0
- package/dist/usd/lib/parse-usdc.js.map +1 -0
- package/dist/usd/lib/parse-usdz.cjs +22 -0
- package/dist/usd/lib/parse-usdz.cjs.map +2 -2
- package/dist/usd/lib/parse-usdz.d.ts.map +1 -1
- package/dist/usd/lib/parse-usdz.js +26 -0
- package/dist/usd/lib/parse-usdz.js.map +1 -1
- package/dist/usd/lib/usd-types.cjs.map +1 -1
- package/dist/usd/lib/usd-types.d.ts +14 -1
- package/dist/usd/lib/usd-types.d.ts.map +1 -1
- package/dist/usd/lib/usd-types.js +1 -1
- package/dist/usd/lib/usd-types.js.map +1 -1
- package/dist/usd/libs/README.md +27 -0
- package/dist/usd/libs/THREE-LICENSE +21 -0
- package/dist/usd/libs/usdc-parser.d.ts +78 -0
- package/dist/usd/libs/usdc-parser.d.ts.map +1 -0
- package/dist/usd/libs/usdc-parser.js +1669 -0
- package/dist/usd/libs/usdc-parser.js.map +1 -0
- package/dist/usd/usd-loader-types.cjs +4 -4
- package/dist/usd/usd-loader-types.cjs.map +2 -2
- package/dist/usd/usd-loader-types.d.ts +7 -7
- package/dist/usd/usd-loader-types.d.ts.map +1 -1
- package/dist/usd/usd-loader-types.js +6 -6
- package/dist/usd/usd-loader-types.js.map +1 -1
- package/dist/usd/usd-loader.cjs.map +1 -1
- package/dist/usd/usd-loader.d.ts +4 -4
- package/dist/usd/usd-loader.d.ts.map +1 -1
- package/dist/usd/usd-loader.js +2 -2
- package/dist/usd/usd-loader.js.map +1 -1
- package/dist/usd-loader-types.cjs +4 -4
- package/dist/usd-loader-types.cjs.map +2 -2
- package/dist/usd-loader.cjs.map +1 -1
- package/package.json +19 -7
- package/src/draco/draco-loader-types.ts +1 -1
- package/src/gltf/gltf-loader-types.ts +6 -0
- package/src/gltf/index.ts +4 -1
- package/src/gltf/lib/api/gltf-extensions.ts +7 -2
- package/src/gltf/lib/extensions/EXT_texture_webp.ts +3 -0
- package/src/gltf/lib/extensions/KHR_accessor_float64.ts +22 -0
- package/src/gltf/lib/extensions/KHR_gaussian_splatting.ts +31 -7
- package/src/gltf/lib/extensions/MSFT_texture_dds.ts +52 -0
- package/src/gltf/lib/extensions/utils/3d-tiles-utils.ts +5 -1
- package/src/gltf/lib/parsers/parse-gltf.ts +31 -0
- package/src/gltf/lib/types/gltf-additional-extension-schemas.ts +32 -0
- package/src/gltf/lib/types/gltf-ext-gaussian-splatting-schema.ts +1 -1
- package/src/gltf/lib/types/gltf-extension-schemas.ts +12 -0
- package/src/gltf/lib/types/gltf-json-schema.ts +2 -1
- package/src/gltf/lib/types/gltf-texture-procedurals.ts +67 -0
- package/src/gltf/lib/types/gltf-types.ts +8 -0
- package/src/gltf/lib/types/gltf-zod-schema.ts +7 -1
- package/src/gltf/schema.ts +1 -0
- package/src/index.ts +6 -1
- package/src/materialx/README.md +5 -0
- package/src/materialx/parse-materialx.ts +70 -0
- package/src/materialx/procedural-graph.ts +94 -0
- package/src/materialx-loader-types.ts +24 -0
- package/src/materialx-loader.ts +15 -0
- package/src/obj/obj-loader-types.ts +1 -1
- package/src/obj/obj-loader.ts +1 -1
- package/src/stl/parse-stl.ts +90 -0
- package/src/stl-loader-types.ts +28 -0
- package/src/stl-loader.ts +12 -0
- package/src/usd/index.ts +1 -0
- package/src/usd/lib/parse-usd.ts +68 -7
- package/src/usd/lib/parse-usdc.ts +188 -0
- package/src/usd/lib/parse-usdz.ts +28 -0
- package/src/usd/lib/usd-types.ts +16 -2
- package/src/usd/libs/README.md +27 -0
- package/src/usd/libs/THREE-LICENSE +21 -0
- package/src/usd/libs/usdc-parser.d.ts +18 -0
- package/src/usd/libs/usdc-parser.js +1669 -0
- package/src/usd/usd-loader-types.ts +5 -5
- package/src/usd/usd-loader.ts +2 -2
package/dist/obj-worker.js
CHANGED
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
// ../../node_modules/@math.gl/
|
|
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
|
-
"../../node_modules/@math.gl/
|
|
22
|
-
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;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
// ../../node_modules/@math.gl/
|
|
26
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
|
|
27
27
|
function getTransferList(object, recursive = true, transfers) {
|
|
28
28
|
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
29
29
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
else if (ArrayBuffer.isView(value)) {
|
|
37
37
|
if (isTransferable(value.buffer))
|
|
38
38
|
transfersSet.add(value.buffer);
|
|
39
|
+
} else if (recursive && typeof MessageChannel !== "undefined" && value instanceof MessageChannel) {
|
|
40
|
+
visit(value.port1);
|
|
41
|
+
visit(value.port2);
|
|
39
42
|
} else if (recursive && value instanceof Map) {
|
|
40
43
|
for (const [key, item] of value) {
|
|
41
44
|
visit(key);
|
|
@@ -71,11 +74,11 @@
|
|
|
71
74
|
return false;
|
|
72
75
|
}
|
|
73
76
|
var init_get_transfer_list = __esm({
|
|
74
|
-
"../../node_modules/@math.gl/
|
|
77
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
75
78
|
}
|
|
76
79
|
});
|
|
77
80
|
|
|
78
|
-
// ../../node_modules/@math.gl/
|
|
81
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
|
|
79
82
|
async function getParentPort() {
|
|
80
83
|
return parentPort;
|
|
81
84
|
}
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
}
|
|
89
92
|
var onMessageWrapperMap, WorkerBody;
|
|
90
93
|
var init_worker_body = __esm({
|
|
91
|
-
"../../node_modules/@math.gl/
|
|
94
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
|
|
92
95
|
init_get_transfer_list();
|
|
93
96
|
init_worker_threads_browser();
|
|
94
97
|
onMessageWrapperMap = /* @__PURE__ */ new Map();
|
|
@@ -103,16 +106,16 @@
|
|
|
103
106
|
*/
|
|
104
107
|
static set onmessage(onMessage) {
|
|
105
108
|
async function handleMessage(message) {
|
|
106
|
-
const
|
|
107
|
-
const { type, payload } =
|
|
109
|
+
const parentPort3 = await getParentPort();
|
|
110
|
+
const { type, payload } = parentPort3 ? message : message.data;
|
|
108
111
|
onMessage(type, payload);
|
|
109
112
|
}
|
|
110
|
-
getParentPort().then((
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
+
getParentPort().then((parentPort3) => {
|
|
114
|
+
if (parentPort3) {
|
|
115
|
+
parentPort3.on("message", (message) => {
|
|
113
116
|
handleMessage(message);
|
|
114
117
|
});
|
|
115
|
-
|
|
118
|
+
parentPort3.on("exit", () => console.debug("Node worker closing"));
|
|
116
119
|
} else {
|
|
117
120
|
globalThis.onmessage = handleMessage;
|
|
118
121
|
}
|
|
@@ -130,9 +133,9 @@
|
|
|
130
133
|
};
|
|
131
134
|
onMessageWrapperMap.set(onMessage, onMessageWrapper);
|
|
132
135
|
}
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
+
const parentPort3 = await getParentPort();
|
|
137
|
+
if (parentPort3) {
|
|
138
|
+
parentPort3.on("message", onMessageWrapper);
|
|
136
139
|
} else {
|
|
137
140
|
globalThis.addEventListener("message", onMessageWrapper);
|
|
138
141
|
}
|
|
@@ -143,9 +146,9 @@
|
|
|
143
146
|
if (!onMessageWrapper) {
|
|
144
147
|
return;
|
|
145
148
|
}
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
+
const parentPort3 = await getParentPort();
|
|
150
|
+
if (parentPort3) {
|
|
151
|
+
parentPort3.off("message", onMessageWrapper);
|
|
149
152
|
} else {
|
|
150
153
|
globalThis.removeEventListener("message", onMessageWrapper);
|
|
151
154
|
}
|
|
@@ -155,12 +158,12 @@
|
|
|
155
158
|
* @param type
|
|
156
159
|
* @param payload
|
|
157
160
|
*/
|
|
158
|
-
static async postMessage(type, payload) {
|
|
161
|
+
static async postMessage(type, payload, copy = false) {
|
|
159
162
|
const data = { source: "loaders.gl", type, payload };
|
|
160
|
-
const transferList = getTransferList(payload);
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
|
|
163
|
+
const transferList = copy ? [] : getTransferList(payload);
|
|
164
|
+
const parentPort3 = await getParentPort();
|
|
165
|
+
if (parentPort3) {
|
|
166
|
+
parentPort3.postMessage(data, transferList);
|
|
164
167
|
} else {
|
|
165
168
|
globalThis.postMessage(data, transferList);
|
|
166
169
|
}
|
|
@@ -169,10 +172,10 @@
|
|
|
169
172
|
}
|
|
170
173
|
});
|
|
171
174
|
|
|
172
|
-
// ../../node_modules/@math.gl/
|
|
175
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
|
|
173
176
|
var AsyncQueue;
|
|
174
177
|
var init_async_queue = __esm({
|
|
175
|
-
"../../node_modules/@math.gl/
|
|
178
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
|
|
176
179
|
AsyncQueue = class {
|
|
177
180
|
constructor() {
|
|
178
181
|
this._values = [];
|
|
@@ -241,10 +244,10 @@
|
|
|
241
244
|
}
|
|
242
245
|
});
|
|
243
246
|
|
|
244
|
-
// ../../node_modules/@math.gl/
|
|
247
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
|
|
245
248
|
var SharedWorkerState;
|
|
246
249
|
var init_shared_state = __esm({
|
|
247
|
-
"../../node_modules/@math.gl/
|
|
250
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
|
|
248
251
|
SharedWorkerState = class {
|
|
249
252
|
constructor(buffer) {
|
|
250
253
|
if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
|
|
@@ -285,8 +288,19 @@
|
|
|
285
288
|
}
|
|
286
289
|
});
|
|
287
290
|
|
|
288
|
-
// ../../node_modules/@math.gl/
|
|
289
|
-
|
|
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) {
|
|
290
304
|
if (!await WorkerBody.inWorkerThread()) {
|
|
291
305
|
return;
|
|
292
306
|
}
|
|
@@ -327,23 +341,26 @@
|
|
|
327
341
|
}
|
|
328
342
|
switch (type) {
|
|
329
343
|
case "preload":
|
|
344
|
+
await preload2?.();
|
|
330
345
|
WorkerBody.postMessage("done", {});
|
|
331
346
|
break;
|
|
332
347
|
case "process":
|
|
333
348
|
throwIfAborted();
|
|
334
|
-
|
|
349
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
350
|
+
if (!process2) {
|
|
335
351
|
throw new Error("Worker does not support atomic processing");
|
|
336
352
|
}
|
|
337
|
-
const result = await
|
|
353
|
+
const result = await process2(payload.input, payload.options || {}, jobContext, payload.context || {});
|
|
338
354
|
throwIfAborted();
|
|
339
355
|
reporter?.finish();
|
|
340
356
|
await WorkerBody.postMessage("done", {
|
|
341
357
|
result,
|
|
342
358
|
executionMs: performance.now() - startedAt
|
|
343
|
-
});
|
|
359
|
+
}, payload.options?.["outputOwnership"] === "copy");
|
|
344
360
|
break;
|
|
345
361
|
case "process-in-batches":
|
|
346
362
|
throwIfAborted();
|
|
363
|
+
validateOutputOwnership(payload.options?.["outputOwnership"]);
|
|
347
364
|
if (!processInBatches) {
|
|
348
365
|
throw new Error("Worker does not support batched processing");
|
|
349
366
|
}
|
|
@@ -355,7 +372,7 @@
|
|
|
355
372
|
const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
|
|
356
373
|
for await (const batch of resultIterator) {
|
|
357
374
|
throwIfAborted();
|
|
358
|
-
await WorkerBody.postMessage("output-batch", { result: batch });
|
|
375
|
+
await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
|
|
359
376
|
await outputAcknowledgements.next();
|
|
360
377
|
}
|
|
361
378
|
throwIfAborted();
|
|
@@ -453,14 +470,14 @@
|
|
|
453
470
|
});
|
|
454
471
|
}
|
|
455
472
|
function createProgressReporter() {
|
|
456
|
-
let
|
|
473
|
+
let pending2;
|
|
457
474
|
let finished = false;
|
|
458
475
|
let scheduled = false;
|
|
459
476
|
const flush = () => {
|
|
460
477
|
scheduled = false;
|
|
461
|
-
if (
|
|
462
|
-
WorkerBody.postMessage("progress", { progress:
|
|
463
|
-
|
|
478
|
+
if (pending2) {
|
|
479
|
+
WorkerBody.postMessage("progress", { progress: pending2 });
|
|
480
|
+
pending2 = void 0;
|
|
464
481
|
}
|
|
465
482
|
};
|
|
466
483
|
return {
|
|
@@ -468,9 +485,9 @@
|
|
|
468
485
|
report(progress) {
|
|
469
486
|
if (finished)
|
|
470
487
|
return;
|
|
471
|
-
if (
|
|
488
|
+
if (pending2 && pending2.phase !== progress.phase)
|
|
472
489
|
flush();
|
|
473
|
-
|
|
490
|
+
pending2 = { ...progress };
|
|
474
491
|
if (!scheduled) {
|
|
475
492
|
scheduled = true;
|
|
476
493
|
setTimeout(flush, 0);
|
|
@@ -479,7 +496,7 @@
|
|
|
479
496
|
/** Flushes final progress and suppresses reports from stale callbacks. */
|
|
480
497
|
finish(discard = false) {
|
|
481
498
|
if (discard)
|
|
482
|
-
|
|
499
|
+
pending2 = void 0;
|
|
483
500
|
flush();
|
|
484
501
|
finished = true;
|
|
485
502
|
}
|
|
@@ -487,10 +504,11 @@
|
|
|
487
504
|
}
|
|
488
505
|
var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
|
|
489
506
|
var init_create_worker = __esm({
|
|
490
|
-
"../../node_modules/@math.gl/
|
|
507
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
|
|
491
508
|
init_shared_state();
|
|
492
509
|
init_async_queue();
|
|
493
510
|
init_worker_body();
|
|
511
|
+
init_validate_output_ownership();
|
|
494
512
|
requestId = 0;
|
|
495
513
|
activeController = null;
|
|
496
514
|
activeInputBatches = null;
|
|
@@ -498,29 +516,589 @@
|
|
|
498
516
|
}
|
|
499
517
|
});
|
|
500
518
|
|
|
501
|
-
// ../../node_modules/@math.gl/
|
|
519
|
+
// ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
|
|
502
520
|
var import_meta, path, moduleUrl;
|
|
503
521
|
var init_worker_utils = __esm({
|
|
504
|
-
"../../node_modules/@math.gl/
|
|
522
|
+
"../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
505
524
|
init_create_worker();
|
|
525
|
+
init_get_transfer_list();
|
|
506
526
|
import_meta = {};
|
|
507
527
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
508
528
|
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
509
529
|
}
|
|
510
530
|
});
|
|
511
531
|
|
|
512
|
-
// ../../node_modules/@math.gl/
|
|
513
|
-
|
|
514
|
-
|
|
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"() {
|
|
515
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";
|
|
516
1021
|
}
|
|
517
1022
|
});
|
|
518
1023
|
|
|
519
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
|
+
}
|
|
520
1097
|
var init_create_worker2 = __esm({
|
|
521
1098
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
522
1099
|
"use strict";
|
|
523
|
-
|
|
1100
|
+
init_task_runtime2();
|
|
1101
|
+
init_get_transfer_list2();
|
|
524
1102
|
}
|
|
525
1103
|
});
|
|
526
1104
|
|
|
@@ -534,7 +1112,7 @@
|
|
|
534
1112
|
|
|
535
1113
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
536
1114
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
537
|
-
await
|
|
1115
|
+
await createWorker2(
|
|
538
1116
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
539
1117
|
selectLoader(options || {}),
|
|
540
1118
|
input,
|
|
@@ -885,7 +1463,7 @@
|
|
|
885
1463
|
});
|
|
886
1464
|
|
|
887
1465
|
// ../../node_modules/@math.gl/core/dist/index.js
|
|
888
|
-
var
|
|
1466
|
+
var init_dist2 = __esm({
|
|
889
1467
|
"../../node_modules/@math.gl/core/dist/index.js"() {
|
|
890
1468
|
init_math_utils();
|
|
891
1469
|
init_types2();
|
|
@@ -8559,11 +9137,11 @@ return true;`);
|
|
|
8559
9137
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8560
9138
|
}
|
|
8561
9139
|
setValue(index, value) {
|
|
8562
|
-
const
|
|
8563
|
-
const current =
|
|
9140
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
9141
|
+
const current = pending2.get(index);
|
|
8564
9142
|
current && (this._pendingLength -= current.length);
|
|
8565
9143
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8566
|
-
|
|
9144
|
+
pending2.set(index, value);
|
|
8567
9145
|
}
|
|
8568
9146
|
setValid(index, isValid) {
|
|
8569
9147
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8586,12 +9164,12 @@ return true;`);
|
|
|
8586
9164
|
return super.finish();
|
|
8587
9165
|
}
|
|
8588
9166
|
_flush() {
|
|
8589
|
-
const
|
|
9167
|
+
const pending2 = this._pending;
|
|
8590
9168
|
const pendingLength = this._pendingLength;
|
|
8591
9169
|
this._pendingLength = 0;
|
|
8592
9170
|
this._pending = void 0;
|
|
8593
|
-
if (
|
|
8594
|
-
this._flushPending(
|
|
9171
|
+
if (pending2 && pending2.size > 0) {
|
|
9172
|
+
this._flushPending(pending2, pendingLength);
|
|
8595
9173
|
}
|
|
8596
9174
|
return this;
|
|
8597
9175
|
}
|
|
@@ -11177,11 +11755,11 @@ return true;`);
|
|
|
11177
11755
|
setValue(index, value) {
|
|
11178
11756
|
return super.setValue(index, toUint8Array(value));
|
|
11179
11757
|
}
|
|
11180
|
-
_flushPending(
|
|
11758
|
+
_flushPending(pending2, pendingLength) {
|
|
11181
11759
|
const offsets = this._offsets;
|
|
11182
11760
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11183
11761
|
let offset = 0;
|
|
11184
|
-
for (const [index, value] of
|
|
11762
|
+
for (const [index, value] of pending2) {
|
|
11185
11763
|
if (value === void 0) {
|
|
11186
11764
|
offsets.set(index, 0);
|
|
11187
11765
|
} else {
|
|
@@ -11218,11 +11796,11 @@ return true;`);
|
|
|
11218
11796
|
setValue(index, value) {
|
|
11219
11797
|
return super.setValue(index, toUint8Array(value));
|
|
11220
11798
|
}
|
|
11221
|
-
_flushPending(
|
|
11799
|
+
_flushPending(pending2, pendingLength) {
|
|
11222
11800
|
const offsets = this._offsets;
|
|
11223
11801
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11224
11802
|
let offset = 0;
|
|
11225
|
-
for (const [index, value] of
|
|
11803
|
+
for (const [index, value] of pending2) {
|
|
11226
11804
|
if (value === void 0) {
|
|
11227
11805
|
offsets.set(index, BigInt(0));
|
|
11228
11806
|
} else {
|
|
@@ -11533,10 +12111,10 @@ return true;`);
|
|
|
11533
12111
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11534
12112
|
return this.numChildren - 1;
|
|
11535
12113
|
}
|
|
11536
|
-
_flushPending(
|
|
12114
|
+
_flushPending(pending2) {
|
|
11537
12115
|
const offsets = this._offsets;
|
|
11538
12116
|
const [child] = this.children;
|
|
11539
|
-
for (const [index, value] of
|
|
12117
|
+
for (const [index, value] of pending2) {
|
|
11540
12118
|
if (typeof value === "undefined") {
|
|
11541
12119
|
offsets.set(index, 0);
|
|
11542
12120
|
} else {
|
|
@@ -11575,10 +12153,10 @@ return true;`);
|
|
|
11575
12153
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11576
12154
|
return this.numChildren - 1;
|
|
11577
12155
|
}
|
|
11578
|
-
_flushPending(
|
|
12156
|
+
_flushPending(pending2) {
|
|
11579
12157
|
const offsets = this._offsets;
|
|
11580
12158
|
const [child] = this.children;
|
|
11581
|
-
for (const [index, value] of
|
|
12159
|
+
for (const [index, value] of pending2) {
|
|
11582
12160
|
if (typeof value === "undefined") {
|
|
11583
12161
|
offsets.set(index, BigInt(0));
|
|
11584
12162
|
} else {
|
|
@@ -11608,11 +12186,11 @@ return true;`);
|
|
|
11608
12186
|
}
|
|
11609
12187
|
setValue(index, value) {
|
|
11610
12188
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11611
|
-
const
|
|
11612
|
-
const current =
|
|
12189
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12190
|
+
const current = pending2.get(index);
|
|
11613
12191
|
current && (this._pendingLength -= current.size);
|
|
11614
12192
|
this._pendingLength += row.size;
|
|
11615
|
-
|
|
12193
|
+
pending2.set(index, row);
|
|
11616
12194
|
}
|
|
11617
12195
|
addChild(child, name = `${this.numChildren}`) {
|
|
11618
12196
|
if (this.numChildren > 0) {
|
|
@@ -11622,10 +12200,10 @@ return true;`);
|
|
|
11622
12200
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11623
12201
|
return this.numChildren - 1;
|
|
11624
12202
|
}
|
|
11625
|
-
_flushPending(
|
|
12203
|
+
_flushPending(pending2) {
|
|
11626
12204
|
const offsets = this._offsets;
|
|
11627
12205
|
const [child] = this.children;
|
|
11628
|
-
for (const [index, value] of
|
|
12206
|
+
for (const [index, value] of pending2) {
|
|
11629
12207
|
if (value === void 0) {
|
|
11630
12208
|
offsets.set(index, 0);
|
|
11631
12209
|
} else {
|
|
@@ -11834,7 +12412,7 @@ return true;`);
|
|
|
11834
12412
|
return super.setValue(index, encodeUtf8(value));
|
|
11835
12413
|
}
|
|
11836
12414
|
// @ts-ignore
|
|
11837
|
-
_flushPending(
|
|
12415
|
+
_flushPending(pending2, pendingLength) {
|
|
11838
12416
|
}
|
|
11839
12417
|
};
|
|
11840
12418
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11865,7 +12443,7 @@ return true;`);
|
|
|
11865
12443
|
return super.setValue(index, encodeUtf8(value));
|
|
11866
12444
|
}
|
|
11867
12445
|
// @ts-ignore
|
|
11868
|
-
_flushPending(
|
|
12446
|
+
_flushPending(pending2, pendingLength) {
|
|
11869
12447
|
}
|
|
11870
12448
|
};
|
|
11871
12449
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -13577,8 +14155,8 @@ return true;`);
|
|
|
13577
14155
|
});
|
|
13578
14156
|
|
|
13579
14157
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
13580
|
-
function shouldAutoDestroy(
|
|
13581
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
14158
|
+
function shouldAutoDestroy(self2, options) {
|
|
14159
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
13582
14160
|
}
|
|
13583
14161
|
function* readAllSync(source) {
|
|
13584
14162
|
const reader = RecordBatchReader.from(source);
|
|
@@ -15809,53 +16387,345 @@ return true;`);
|
|
|
15809
16387
|
}
|
|
15810
16388
|
});
|
|
15811
16389
|
|
|
15812
|
-
//
|
|
15813
|
-
function
|
|
15814
|
-
return
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
|
|
16390
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
|
|
16391
|
+
function getArrowVariadicBuffers(data) {
|
|
16392
|
+
return data.variadicBuffers ?? [];
|
|
16393
|
+
}
|
|
16394
|
+
function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
|
|
16395
|
+
return Reflect.construct(Data, [
|
|
16396
|
+
type,
|
|
16397
|
+
offset,
|
|
16398
|
+
length,
|
|
16399
|
+
nullCount,
|
|
16400
|
+
buffers,
|
|
16401
|
+
children,
|
|
16402
|
+
dictionary,
|
|
16403
|
+
variadicBuffers
|
|
16404
|
+
]);
|
|
15818
16405
|
}
|
|
15819
|
-
|
|
15820
|
-
|
|
15821
|
-
|
|
15822
|
-
|
|
15823
|
-
|
|
16406
|
+
var init_arrow_data = __esm({
|
|
16407
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
|
|
16408
|
+
init_Arrow_dom();
|
|
16409
|
+
}
|
|
16410
|
+
});
|
|
16411
|
+
|
|
16412
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
|
|
16413
|
+
function splitArrowBuffers(input, options = {}) {
|
|
16414
|
+
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
16415
|
+
if (isArrowTable2(input)) {
|
|
16416
|
+
return splitArrowTableBuffersInternal(input, context);
|
|
16417
|
+
}
|
|
16418
|
+
if (isArrowRecordBatch2(input)) {
|
|
16419
|
+
return splitArrowRecordBatchBuffers(input, context);
|
|
16420
|
+
}
|
|
16421
|
+
if (isArrowVector2(input)) {
|
|
16422
|
+
return splitArrowVectorBuffers(input, context);
|
|
16423
|
+
}
|
|
16424
|
+
return splitArrowDataBuffers(input, context);
|
|
15824
16425
|
}
|
|
15825
|
-
function
|
|
15826
|
-
return
|
|
16426
|
+
function isArrowTable2(input) {
|
|
16427
|
+
return "batches" in input;
|
|
15827
16428
|
}
|
|
15828
|
-
function
|
|
15829
|
-
return
|
|
16429
|
+
function isArrowRecordBatch2(input) {
|
|
16430
|
+
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
15830
16431
|
}
|
|
15831
|
-
function
|
|
15832
|
-
return
|
|
15833
|
-
name: field.name,
|
|
15834
|
-
type: serializeArrowType(field.type),
|
|
15835
|
-
nullable: field.nullable,
|
|
15836
|
-
metadata: serializeArrowMetadata(field.metadata)
|
|
15837
|
-
};
|
|
16432
|
+
function isArrowVector2(input) {
|
|
16433
|
+
return "data" in input && Array.isArray(input.data);
|
|
15838
16434
|
}
|
|
15839
|
-
function
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
16435
|
+
function splitArrowTableBuffersInternal(arrowTable, options) {
|
|
16436
|
+
const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
|
|
16437
|
+
return new Table(arrowTable.schema, recordBatches);
|
|
16438
|
+
}
|
|
16439
|
+
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16440
|
+
return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
|
|
16441
|
+
}
|
|
16442
|
+
function splitArrowDataBuffers(data, options) {
|
|
16443
|
+
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
16444
|
+
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
16445
|
+
const buffers = {
|
|
16446
|
+
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
16447
|
+
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
16448
|
+
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16449
|
+
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16450
|
+
};
|
|
16451
|
+
return createArrowData(
|
|
16452
|
+
data.type,
|
|
16453
|
+
data.offset,
|
|
16454
|
+
data.length,
|
|
16455
|
+
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
16456
|
+
data._nullCount,
|
|
16457
|
+
buffers,
|
|
16458
|
+
children,
|
|
16459
|
+
dictionary,
|
|
16460
|
+
getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
|
|
15845
16461
|
);
|
|
15846
16462
|
}
|
|
15847
|
-
function
|
|
15848
|
-
|
|
15849
|
-
|
|
16463
|
+
function splitArrowVectorBuffers(vector, options) {
|
|
16464
|
+
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16465
|
+
}
|
|
16466
|
+
function splitArrowBuffer(array, options) {
|
|
16467
|
+
if (!isArrowTypedArray(array)) {
|
|
16468
|
+
return array;
|
|
15850
16469
|
}
|
|
15851
|
-
if (
|
|
15852
|
-
return
|
|
16470
|
+
if (options.copy === "none") {
|
|
16471
|
+
return array;
|
|
15853
16472
|
}
|
|
15854
|
-
if (
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
16473
|
+
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16474
|
+
return array;
|
|
16475
|
+
}
|
|
16476
|
+
let copy = options.copies.get(array);
|
|
16477
|
+
if (!copy) {
|
|
16478
|
+
copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
|
|
16479
|
+
options.copies.set(array, copy);
|
|
16480
|
+
}
|
|
16481
|
+
return copy;
|
|
16482
|
+
}
|
|
16483
|
+
function isArrowTypedArray(value) {
|
|
16484
|
+
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16485
|
+
}
|
|
16486
|
+
var init_split_arrow_buffers = __esm({
|
|
16487
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
|
|
16488
|
+
init_Arrow_dom();
|
|
16489
|
+
init_arrow_data();
|
|
16490
|
+
}
|
|
16491
|
+
});
|
|
16492
|
+
|
|
16493
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
|
|
16494
|
+
var init_indexed_arrow_vector = __esm({
|
|
16495
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
|
|
16496
|
+
}
|
|
16497
|
+
});
|
|
16498
|
+
|
|
16499
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
|
|
16500
|
+
var init_indexed_arrow_table = __esm({
|
|
16501
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
|
|
16502
|
+
}
|
|
16503
|
+
});
|
|
16504
|
+
|
|
16505
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
|
|
16506
|
+
var init_mapped_arrow_table = __esm({
|
|
16507
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
|
|
16508
|
+
}
|
|
16509
|
+
});
|
|
16510
|
+
|
|
16511
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
|
|
16512
|
+
var init_rename_arrow_columns = __esm({
|
|
16513
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
|
|
16514
|
+
}
|
|
16515
|
+
});
|
|
16516
|
+
|
|
16517
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
|
|
16518
|
+
function dehydrateArrowTable(arrowTable, options) {
|
|
16519
|
+
const splitTable = splitArrowBuffers(arrowTable, options);
|
|
16520
|
+
return {
|
|
16521
|
+
transport: "arrow-js",
|
|
16522
|
+
version: 1,
|
|
16523
|
+
schema: tableToIPC(new Table(splitTable.schema, [])),
|
|
16524
|
+
metadataVersion: splitTable.schema.metadataVersion,
|
|
16525
|
+
batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
|
|
16526
|
+
};
|
|
16527
|
+
}
|
|
16528
|
+
function hydrateArrowTable(table) {
|
|
16529
|
+
if (table.transport !== "arrow-js" || table.version !== 1) {
|
|
16530
|
+
throw new Error("Unsupported Arrow column-buffer transport protocol.");
|
|
16531
|
+
}
|
|
16532
|
+
const decodedSchema = tableFromIPC(table.schema).schema;
|
|
16533
|
+
const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
|
|
16534
|
+
const type = new Struct(schema.fields);
|
|
16535
|
+
const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
|
|
16536
|
+
return new Table(schema, batches);
|
|
16537
|
+
}
|
|
16538
|
+
function dehydrateArrowData(data) {
|
|
16539
|
+
return {
|
|
16540
|
+
offset: data.offset,
|
|
16541
|
+
length: data.length,
|
|
16542
|
+
nullCount: data.nullCount,
|
|
16543
|
+
buffers: {
|
|
16544
|
+
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
16545
|
+
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
16546
|
+
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
16547
|
+
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
16548
|
+
},
|
|
16549
|
+
children: data.children.map((child) => dehydrateArrowData(child)),
|
|
16550
|
+
variadicBuffers: getArrowVariadicBuffers(data),
|
|
16551
|
+
dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
|
|
16552
|
+
};
|
|
16553
|
+
}
|
|
16554
|
+
function hydrateArrowData(data, type) {
|
|
16555
|
+
const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
|
|
16556
|
+
const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
|
|
16557
|
+
return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
|
|
16558
|
+
}
|
|
16559
|
+
var init_arrow_table_transport = __esm({
|
|
16560
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
|
|
16561
|
+
init_Arrow_dom();
|
|
16562
|
+
init_arrow_data();
|
|
16563
|
+
init_split_arrow_buffers();
|
|
16564
|
+
}
|
|
16565
|
+
});
|
|
16566
|
+
|
|
16567
|
+
// ../../node_modules/@math.gl/arrow/dist/arrow/index.js
|
|
16568
|
+
var init_arrow = __esm({
|
|
16569
|
+
"../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
|
|
16570
|
+
init_indexed_arrow_table();
|
|
16571
|
+
init_indexed_arrow_vector();
|
|
16572
|
+
init_mapped_arrow_table();
|
|
16573
|
+
init_rename_arrow_columns();
|
|
16574
|
+
init_split_arrow_buffers();
|
|
16575
|
+
init_arrow_table_transport();
|
|
16576
|
+
}
|
|
16577
|
+
});
|
|
16578
|
+
|
|
16579
|
+
// ../../node_modules/@math.gl/arrow/dist/index.js
|
|
16580
|
+
var init_dist3 = __esm({
|
|
16581
|
+
"../../node_modules/@math.gl/arrow/dist/index.js"() {
|
|
16582
|
+
init_arrow();
|
|
16583
|
+
}
|
|
16584
|
+
});
|
|
16585
|
+
|
|
16586
|
+
// ../core/src/arrow-worker-transport.ts
|
|
16587
|
+
function serializeArrowWorkerTable(result) {
|
|
16588
|
+
if (!isArrowTableWrapper(result)) {
|
|
16589
|
+
throw new Error("Workers require Arrow table output");
|
|
16590
|
+
}
|
|
16591
|
+
const { data, ...metadata } = result;
|
|
16592
|
+
return {
|
|
16593
|
+
...structuredClone(metadata),
|
|
16594
|
+
data: dehydrateArrowTable(data, { copy: "all" })
|
|
16595
|
+
};
|
|
16596
|
+
}
|
|
16597
|
+
function deserializeArrowWorkerTable(result) {
|
|
16598
|
+
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16599
|
+
throw new Error("Workers require Arrow column transport");
|
|
16600
|
+
}
|
|
16601
|
+
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16602
|
+
}
|
|
16603
|
+
function isArrowTableWrapper(value) {
|
|
16604
|
+
const table = value;
|
|
16605
|
+
return Boolean(
|
|
16606
|
+
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16607
|
+
);
|
|
16608
|
+
}
|
|
16609
|
+
function isDehydratedArrowTableWrapper(value) {
|
|
16610
|
+
const table = value;
|
|
16611
|
+
return Boolean(
|
|
16612
|
+
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
16613
|
+
);
|
|
16614
|
+
}
|
|
16615
|
+
var init_arrow_worker_transport = __esm({
|
|
16616
|
+
"../core/src/arrow-worker-transport.ts"() {
|
|
16617
|
+
"use strict";
|
|
16618
|
+
init_dist3();
|
|
16619
|
+
}
|
|
16620
|
+
});
|
|
16621
|
+
|
|
16622
|
+
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
16623
|
+
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
16624
|
+
if (value instanceof Date) {
|
|
16625
|
+
return "date-millisecond";
|
|
16626
|
+
}
|
|
16627
|
+
if (typeof value === "number") {
|
|
16628
|
+
return defaultNumberType;
|
|
16629
|
+
}
|
|
16630
|
+
if (typeof value === "boolean") {
|
|
16631
|
+
return "bool";
|
|
16632
|
+
}
|
|
16633
|
+
if (typeof value === "string") {
|
|
16634
|
+
return "utf8";
|
|
16635
|
+
}
|
|
16636
|
+
if (value === null || value === "undefined") {
|
|
16637
|
+
return "null";
|
|
16638
|
+
}
|
|
16639
|
+
return "null";
|
|
16640
|
+
}
|
|
16641
|
+
function getDataTypeFromArray(array) {
|
|
16642
|
+
let type = getDataTypeFromTypedArray(array);
|
|
16643
|
+
if (type !== "null") {
|
|
16644
|
+
return { type, nullable: false };
|
|
16645
|
+
}
|
|
16646
|
+
if (array.length > 0) {
|
|
16647
|
+
type = getDataTypeFromValue(array[0]);
|
|
16648
|
+
return { type, nullable: true };
|
|
16649
|
+
}
|
|
16650
|
+
return { type: "null", nullable: true };
|
|
16651
|
+
}
|
|
16652
|
+
function getDataTypeFromTypedArray(array) {
|
|
16653
|
+
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
16654
|
+
return "float16";
|
|
16655
|
+
}
|
|
16656
|
+
switch (array.constructor) {
|
|
16657
|
+
case Int8Array:
|
|
16658
|
+
return "int8";
|
|
16659
|
+
case Uint8Array:
|
|
16660
|
+
case Uint8ClampedArray:
|
|
16661
|
+
return "uint8";
|
|
16662
|
+
case Int16Array:
|
|
16663
|
+
return "int16";
|
|
16664
|
+
case Uint16Array:
|
|
16665
|
+
return "uint16";
|
|
16666
|
+
case Int32Array:
|
|
16667
|
+
return "int32";
|
|
16668
|
+
case Uint32Array:
|
|
16669
|
+
return "uint32";
|
|
16670
|
+
case BigInt64Array:
|
|
16671
|
+
return "int64";
|
|
16672
|
+
case BigUint64Array:
|
|
16673
|
+
return "uint64";
|
|
16674
|
+
case Float32Array:
|
|
16675
|
+
return "float32";
|
|
16676
|
+
case Float64Array:
|
|
16677
|
+
return "float64";
|
|
16678
|
+
default:
|
|
16679
|
+
return "null";
|
|
16680
|
+
}
|
|
16681
|
+
}
|
|
16682
|
+
var init_data_type = __esm({
|
|
16683
|
+
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
16684
|
+
"use strict";
|
|
16685
|
+
}
|
|
16686
|
+
});
|
|
16687
|
+
|
|
16688
|
+
// ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
|
|
16689
|
+
function serializeArrowSchema(arrowSchema) {
|
|
16690
|
+
return {
|
|
16691
|
+
fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
|
|
16692
|
+
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
16693
|
+
};
|
|
16694
|
+
}
|
|
16695
|
+
function serializeArrowMetadata(arrowMetadata) {
|
|
16696
|
+
return Object.fromEntries(arrowMetadata);
|
|
16697
|
+
}
|
|
16698
|
+
function deserializeArrowMetadata(metadata) {
|
|
16699
|
+
return metadata ? new Map(Object.entries(metadata)) : /* @__PURE__ */ new Map();
|
|
16700
|
+
}
|
|
16701
|
+
function serializeArrowField(field) {
|
|
16702
|
+
return {
|
|
16703
|
+
name: field.name,
|
|
16704
|
+
type: serializeArrowType(field.type),
|
|
16705
|
+
nullable: field.nullable,
|
|
16706
|
+
metadata: serializeArrowMetadata(field.metadata)
|
|
16707
|
+
};
|
|
16708
|
+
}
|
|
16709
|
+
function deserializeArrowField(field, options) {
|
|
16710
|
+
return new Field2(
|
|
16711
|
+
field.name,
|
|
16712
|
+
deserializeArrowType(field.type, options),
|
|
16713
|
+
field.nullable,
|
|
16714
|
+
deserializeArrowMetadata(field.metadata)
|
|
16715
|
+
);
|
|
16716
|
+
}
|
|
16717
|
+
function serializeArrowType(arrowType) {
|
|
16718
|
+
if (isArrowViewType(arrowType, "BinaryView")) {
|
|
16719
|
+
return "binary-view";
|
|
16720
|
+
}
|
|
16721
|
+
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
16722
|
+
return "utf8-view";
|
|
16723
|
+
}
|
|
16724
|
+
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
16725
|
+
const largeListType = arrowType;
|
|
16726
|
+
return {
|
|
16727
|
+
type: "large-list",
|
|
16728
|
+
children: [serializeArrowField(largeListType.valueField)]
|
|
15859
16729
|
};
|
|
15860
16730
|
}
|
|
15861
16731
|
switch (arrowType.constructor) {
|
|
@@ -16244,259 +17114,6 @@ return true;`);
|
|
|
16244
17114
|
}
|
|
16245
17115
|
});
|
|
16246
17116
|
|
|
16247
|
-
// ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
|
|
16248
|
-
function splitArrowBuffers(input, options = {}) {
|
|
16249
|
-
const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
|
|
16250
|
-
if (isArrowTable2(input)) {
|
|
16251
|
-
return splitArrowTableBuffersInternal(input, context);
|
|
16252
|
-
}
|
|
16253
|
-
if (isArrowRecordBatch2(input)) {
|
|
16254
|
-
return splitArrowRecordBatchBuffers(input, context);
|
|
16255
|
-
}
|
|
16256
|
-
if (isArrowVector2(input)) {
|
|
16257
|
-
return splitArrowVectorBuffers(input, context);
|
|
16258
|
-
}
|
|
16259
|
-
return splitArrowDataBuffers(input, context);
|
|
16260
|
-
}
|
|
16261
|
-
function isArrowTable2(input) {
|
|
16262
|
-
return "batches" in input;
|
|
16263
|
-
}
|
|
16264
|
-
function isArrowRecordBatch2(input) {
|
|
16265
|
-
return "schema" in input && "data" in input && !Array.isArray(input.data);
|
|
16266
|
-
}
|
|
16267
|
-
function isArrowVector2(input) {
|
|
16268
|
-
return "data" in input && Array.isArray(input.data);
|
|
16269
|
-
}
|
|
16270
|
-
function splitArrowTableBuffersInternal(table, options) {
|
|
16271
|
-
const recordBatches = table.batches.map(
|
|
16272
|
-
(recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
|
|
16273
|
-
);
|
|
16274
|
-
return new Table(table.schema, recordBatches);
|
|
16275
|
-
}
|
|
16276
|
-
function splitArrowRecordBatchBuffers(recordBatch, options) {
|
|
16277
|
-
return new RecordBatch3(
|
|
16278
|
-
recordBatch.schema,
|
|
16279
|
-
splitArrowDataBuffers(recordBatch.data, options)
|
|
16280
|
-
);
|
|
16281
|
-
}
|
|
16282
|
-
function splitArrowDataBuffers(data, options) {
|
|
16283
|
-
const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
|
|
16284
|
-
const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
|
|
16285
|
-
const buffers = {
|
|
16286
|
-
[BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
|
|
16287
|
-
[BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
|
|
16288
|
-
[BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
|
|
16289
|
-
[BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
|
|
16290
|
-
};
|
|
16291
|
-
return new Data(
|
|
16292
|
-
data.type,
|
|
16293
|
-
data.offset,
|
|
16294
|
-
data.length,
|
|
16295
|
-
// @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
|
|
16296
|
-
data._nullCount,
|
|
16297
|
-
buffers,
|
|
16298
|
-
children,
|
|
16299
|
-
dictionary
|
|
16300
|
-
);
|
|
16301
|
-
}
|
|
16302
|
-
function splitArrowVectorBuffers(vector, options) {
|
|
16303
|
-
return new Vector(vector.data.map((data) => splitArrowDataBuffers(data, options)));
|
|
16304
|
-
}
|
|
16305
|
-
function splitArrowBuffer(array, options) {
|
|
16306
|
-
if (!isArrowTypedArray(array)) {
|
|
16307
|
-
return array;
|
|
16308
|
-
}
|
|
16309
|
-
if (options.copy === "none") {
|
|
16310
|
-
return array;
|
|
16311
|
-
}
|
|
16312
|
-
if (options.copy !== "all" && array.byteOffset === 0 && array.byteLength === array.buffer.byteLength) {
|
|
16313
|
-
return array;
|
|
16314
|
-
}
|
|
16315
|
-
let copy = options.copies.get(array);
|
|
16316
|
-
if (!copy) {
|
|
16317
|
-
copy = array.slice();
|
|
16318
|
-
options.copies.set(array, copy);
|
|
16319
|
-
}
|
|
16320
|
-
return copy;
|
|
16321
|
-
}
|
|
16322
|
-
function isArrowTypedArray(value) {
|
|
16323
|
-
return ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
16324
|
-
}
|
|
16325
|
-
var init_split_arrow_buffers = __esm({
|
|
16326
|
-
"../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
|
|
16327
|
-
"use strict";
|
|
16328
|
-
init_Arrow_dom();
|
|
16329
|
-
}
|
|
16330
|
-
});
|
|
16331
|
-
|
|
16332
|
-
// ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
|
|
16333
|
-
function dehydrateArrowTable(table, options) {
|
|
16334
|
-
const splitTable = splitArrowBuffers(table, options);
|
|
16335
|
-
return {
|
|
16336
|
-
shape: "arrow-table",
|
|
16337
|
-
transport: "arrow-js",
|
|
16338
|
-
schema: serializeArrowSchema(splitTable.schema),
|
|
16339
|
-
batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
|
|
16340
|
-
};
|
|
16341
|
-
}
|
|
16342
|
-
function hydrateArrowTable(table) {
|
|
16343
|
-
const schema = deserializeArrowSchema(table.schema);
|
|
16344
|
-
const recordBatches = table.batches.map(
|
|
16345
|
-
(recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
|
|
16346
|
-
);
|
|
16347
|
-
return new Table(schema, recordBatches);
|
|
16348
|
-
}
|
|
16349
|
-
function serializeArrowWorkerTable(result) {
|
|
16350
|
-
if (!isArrowTableWrapper(result)) {
|
|
16351
|
-
throw new Error("Workers require Arrow table output");
|
|
16352
|
-
}
|
|
16353
|
-
const { data, ...metadata } = result;
|
|
16354
|
-
return {
|
|
16355
|
-
...structuredClone(metadata),
|
|
16356
|
-
data: dehydrateArrowTable(data, { copy: "all" })
|
|
16357
|
-
};
|
|
16358
|
-
}
|
|
16359
|
-
function deserializeArrowWorkerTable(result) {
|
|
16360
|
-
if (!isDehydratedArrowTableWrapper(result)) {
|
|
16361
|
-
throw new Error("Workers require Arrow column transport");
|
|
16362
|
-
}
|
|
16363
|
-
return { ...result, data: hydrateArrowTable(result.data) };
|
|
16364
|
-
}
|
|
16365
|
-
function isArrowTableWrapper(value) {
|
|
16366
|
-
const table = value;
|
|
16367
|
-
return Boolean(
|
|
16368
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
16369
|
-
);
|
|
16370
|
-
}
|
|
16371
|
-
function isDehydratedArrowTableWrapper(value) {
|
|
16372
|
-
const table = value;
|
|
16373
|
-
return Boolean(
|
|
16374
|
-
table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
|
|
16375
|
-
);
|
|
16376
|
-
}
|
|
16377
|
-
function dehydrateArrowRecordBatch(recordBatch) {
|
|
16378
|
-
return { data: dehydrateArrowData(recordBatch.data) };
|
|
16379
|
-
}
|
|
16380
|
-
function dehydrateArrowData(data) {
|
|
16381
|
-
return {
|
|
16382
|
-
type: serializeArrowType(data.type),
|
|
16383
|
-
offset: data.offset,
|
|
16384
|
-
length: data.length,
|
|
16385
|
-
// @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
|
|
16386
|
-
nullCount: data._nullCount,
|
|
16387
|
-
buffers: {
|
|
16388
|
-
[BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
|
|
16389
|
-
[BufferType.DATA]: data.buffers[BufferType.DATA],
|
|
16390
|
-
[BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
|
|
16391
|
-
[BufferType.TYPE]: data.buffers[BufferType.TYPE]
|
|
16392
|
-
},
|
|
16393
|
-
children: data.children.map((childData) => dehydrateArrowData(childData)),
|
|
16394
|
-
dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
|
|
16395
|
-
};
|
|
16396
|
-
}
|
|
16397
|
-
function dehydrateArrowVector(vector) {
|
|
16398
|
-
return { data: vector.data.map((data) => dehydrateArrowData(data)) };
|
|
16399
|
-
}
|
|
16400
|
-
function hydrateArrowData(data) {
|
|
16401
|
-
const children = data.children.map((childData) => hydrateArrowData(childData));
|
|
16402
|
-
const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
|
|
16403
|
-
return new Data(
|
|
16404
|
-
deserializeArrowType(data.type),
|
|
16405
|
-
data.offset,
|
|
16406
|
-
data.length,
|
|
16407
|
-
data.nullCount,
|
|
16408
|
-
data.buffers,
|
|
16409
|
-
children,
|
|
16410
|
-
dictionary
|
|
16411
|
-
);
|
|
16412
|
-
}
|
|
16413
|
-
function hydrateArrowVector(vector) {
|
|
16414
|
-
return new Vector(vector.data.map((data) => hydrateArrowData(data)));
|
|
16415
|
-
}
|
|
16416
|
-
var init_arrow_table_transport = __esm({
|
|
16417
|
-
"../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
|
|
16418
|
-
"use strict";
|
|
16419
|
-
init_Arrow_dom();
|
|
16420
|
-
init_convert_arrow_schema();
|
|
16421
|
-
init_split_arrow_buffers();
|
|
16422
|
-
}
|
|
16423
|
-
});
|
|
16424
|
-
|
|
16425
|
-
// ../core/src/schema-utils/arrow-transport.ts
|
|
16426
|
-
var init_arrow_transport = __esm({
|
|
16427
|
-
"../core/src/schema-utils/arrow-transport.ts"() {
|
|
16428
|
-
"use strict";
|
|
16429
|
-
init_arrow_table_transport();
|
|
16430
|
-
init_split_arrow_buffers();
|
|
16431
|
-
}
|
|
16432
|
-
});
|
|
16433
|
-
|
|
16434
|
-
// ../core/src/schema-utils/lib/schema/data-type.ts
|
|
16435
|
-
function getDataTypeFromValue(value, defaultNumberType = "float32") {
|
|
16436
|
-
if (value instanceof Date) {
|
|
16437
|
-
return "date-millisecond";
|
|
16438
|
-
}
|
|
16439
|
-
if (typeof value === "number") {
|
|
16440
|
-
return defaultNumberType;
|
|
16441
|
-
}
|
|
16442
|
-
if (typeof value === "boolean") {
|
|
16443
|
-
return "bool";
|
|
16444
|
-
}
|
|
16445
|
-
if (typeof value === "string") {
|
|
16446
|
-
return "utf8";
|
|
16447
|
-
}
|
|
16448
|
-
if (value === null || value === "undefined") {
|
|
16449
|
-
return "null";
|
|
16450
|
-
}
|
|
16451
|
-
return "null";
|
|
16452
|
-
}
|
|
16453
|
-
function getDataTypeFromArray(array) {
|
|
16454
|
-
let type = getDataTypeFromTypedArray(array);
|
|
16455
|
-
if (type !== "null") {
|
|
16456
|
-
return { type, nullable: false };
|
|
16457
|
-
}
|
|
16458
|
-
if (array.length > 0) {
|
|
16459
|
-
type = getDataTypeFromValue(array[0]);
|
|
16460
|
-
return { type, nullable: true };
|
|
16461
|
-
}
|
|
16462
|
-
return { type: "null", nullable: true };
|
|
16463
|
-
}
|
|
16464
|
-
function getDataTypeFromTypedArray(array) {
|
|
16465
|
-
if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
|
|
16466
|
-
return "float16";
|
|
16467
|
-
}
|
|
16468
|
-
switch (array.constructor) {
|
|
16469
|
-
case Int8Array:
|
|
16470
|
-
return "int8";
|
|
16471
|
-
case Uint8Array:
|
|
16472
|
-
case Uint8ClampedArray:
|
|
16473
|
-
return "uint8";
|
|
16474
|
-
case Int16Array:
|
|
16475
|
-
return "int16";
|
|
16476
|
-
case Uint16Array:
|
|
16477
|
-
return "uint16";
|
|
16478
|
-
case Int32Array:
|
|
16479
|
-
return "int32";
|
|
16480
|
-
case Uint32Array:
|
|
16481
|
-
return "uint32";
|
|
16482
|
-
case BigInt64Array:
|
|
16483
|
-
return "int64";
|
|
16484
|
-
case BigUint64Array:
|
|
16485
|
-
return "uint64";
|
|
16486
|
-
case Float32Array:
|
|
16487
|
-
return "float32";
|
|
16488
|
-
case Float64Array:
|
|
16489
|
-
return "float64";
|
|
16490
|
-
default:
|
|
16491
|
-
return "null";
|
|
16492
|
-
}
|
|
16493
|
-
}
|
|
16494
|
-
var init_data_type = __esm({
|
|
16495
|
-
"../core/src/schema-utils/lib/schema/data-type.ts"() {
|
|
16496
|
-
"use strict";
|
|
16497
|
-
}
|
|
16498
|
-
});
|
|
16499
|
-
|
|
16500
17117
|
// ../core/src/schema-utils/lib/mesh/mesh-utils.ts
|
|
16501
17118
|
function getMeshBoundingBox(attributes) {
|
|
16502
17119
|
const positionAttribute = attributes?.POSITION;
|
|
@@ -16598,7 +17215,7 @@ return true;`);
|
|
|
16598
17215
|
var init_float162 = __esm({
|
|
16599
17216
|
"../core/src/schema/float16.ts"() {
|
|
16600
17217
|
"use strict";
|
|
16601
|
-
|
|
17218
|
+
init_dist2();
|
|
16602
17219
|
}
|
|
16603
17220
|
});
|
|
16604
17221
|
|
|
@@ -17555,8 +18172,8 @@ return true;`);
|
|
|
17555
18172
|
"src/obj/obj-loader-types.ts"() {
|
|
17556
18173
|
"use strict";
|
|
17557
18174
|
init_obj_format();
|
|
17558
|
-
|
|
17559
|
-
VERSION = true ? "5.0.0-beta.
|
|
18175
|
+
init_arrow_worker_transport();
|
|
18176
|
+
VERSION = true ? "5.0.0-beta.5" : "latest";
|
|
17560
18177
|
OBJLoader = {
|
|
17561
18178
|
...OBJFormat,
|
|
17562
18179
|
dataType: null,
|
|
@@ -17685,7 +18302,7 @@ return true;`);
|
|
|
17685
18302
|
"src/obj/obj-loader.ts"() {
|
|
17686
18303
|
"use strict";
|
|
17687
18304
|
init_loader_utils();
|
|
17688
|
-
|
|
18305
|
+
init_arrow_worker_transport();
|
|
17689
18306
|
init_schema_utils();
|
|
17690
18307
|
init_get_obj_schema();
|
|
17691
18308
|
init_parse_obj();
|