@loaders.gl/pointclouds 5.0.0-beta.1 → 5.0.0-beta.4
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/README.md +4 -0
- package/dist/dist.dev.js +45 -16
- package/dist/dist.min.js +19 -19
- 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.js +1 -1
- package/dist/las/las-copc-loader-types.js.map +1 -1
- package/dist/las/las-loader-shared.cjs +1 -1
- package/dist/las/las-loader-shared.js +1 -1
- package/dist/las/las-loader-types.cjs +1 -1
- package/dist/las/las-loader-types.cjs.map +2 -2
- package/dist/las/las-loader-types.js +1 -1
- package/dist/las/las-loader-types.js.map +1 -1
- package/dist/las/las-writer.cjs +1 -1
- package/dist/las/las-writer.js +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.js +1 -1
- package/dist/las/laz-rs-loader-types.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.js +1 -1
- package/dist/las/lazperf-loader-types.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-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 +59 -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 +56 -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 +82 -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 +565 -133
- 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 +274 -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 +62 -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/pcd-loader-types.cjs +2 -2
- package/dist/pcd/pcd-loader-types.cjs.map +2 -2
- package/dist/pcd/pcd-loader-types.js +2 -2
- package/dist/pcd/pcd-loader-types.js.map +1 -1
- package/dist/pcd/pcd-writer.cjs +1 -1
- package/dist/pcd/pcd-writer.js +1 -1
- package/dist/pcd-loader-types.cjs +66 -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 +146 -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 +586 -117
- 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/ply-loader-types.cjs +2 -2
- package/dist/ply/ply-loader-types.cjs.map +2 -2
- package/dist/ply/ply-loader-types.js +2 -2
- package/dist/ply/ply-loader-types.js.map +1 -1
- package/dist/ply/ply-writer.cjs +1 -1
- package/dist/ply/ply-writer.js +1 -1
- package/dist/ply-loader-types.cjs +67 -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 +136 -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 +586 -117
- 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/las/las-copc-loader-types.ts +1 -1
- package/src/las/las-loader-types.ts +1 -1
- package/src/las/laz-rs-loader-types.ts +1 -1
- package/src/las/lazperf-loader-types.ts +1 -1
- package/src/las/lib/las-extra-bytes.ts +6 -4
- 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-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/pcd-loader-types.ts +1 -1
- 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/ply-loader-types.ts +1 -1
- 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/core/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/core/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/core/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/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
|
|
64
78
|
}
|
|
65
79
|
});
|
|
66
80
|
|
|
67
|
-
//
|
|
81
|
+
// ../../node_modules/@math.gl/core/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/core/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/core/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/core/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/core/dist/worker-utils/lib/worker-api/shared-state.js
|
|
248
|
+
var SharedWorkerState;
|
|
249
|
+
var init_shared_state = __esm({
|
|
250
|
+
"../../node_modules/@math.gl/core/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/core/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/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
// ../../node_modules/@math.gl/core/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,449 @@
|
|
|
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/core/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/core/dist/worker-utils/index.js
|
|
520
|
+
var import_meta, path, moduleUrl;
|
|
395
521
|
var init_worker_utils = __esm({
|
|
522
|
+
"../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
524
|
+
init_create_worker();
|
|
525
|
+
import_meta = {};
|
|
526
|
+
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
527
|
+
moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-preload.js
|
|
532
|
+
function preloadTaskCode(task, signal) {
|
|
533
|
+
if (!task.preload)
|
|
534
|
+
return Promise.resolve();
|
|
535
|
+
let promise = pending.get(task);
|
|
536
|
+
if (!promise) {
|
|
537
|
+
promise = Promise.resolve().then(() => task.preload()).then(() => {
|
|
538
|
+
loaded.add(task);
|
|
539
|
+
});
|
|
540
|
+
pending.set(task, promise);
|
|
541
|
+
void promise.catch(() => pending.delete(task));
|
|
542
|
+
}
|
|
543
|
+
return withSignal(promise, signal);
|
|
544
|
+
}
|
|
545
|
+
function withSignal(operation, signal) {
|
|
546
|
+
if (!signal)
|
|
547
|
+
return operation;
|
|
548
|
+
return new Promise((resolve, reject) => {
|
|
549
|
+
const abort = () => {
|
|
550
|
+
signal.removeEventListener("abort", abort);
|
|
551
|
+
reject(signal.reason);
|
|
552
|
+
};
|
|
553
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
554
|
+
if (signal.aborted)
|
|
555
|
+
abort();
|
|
556
|
+
operation.then((value) => {
|
|
557
|
+
signal.removeEventListener("abort", abort);
|
|
558
|
+
resolve(value);
|
|
559
|
+
}, (error) => {
|
|
560
|
+
signal.removeEventListener("abort", abort);
|
|
561
|
+
reject(error);
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
var pending, loaded;
|
|
566
|
+
var init_task_preload = __esm({
|
|
567
|
+
"../../node_modules/@math.gl/core/dist/tasks/task-preload.js"() {
|
|
568
|
+
pending = /* @__PURE__ */ new WeakMap();
|
|
569
|
+
loaded = /* @__PURE__ */ new WeakSet();
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
// ../../node_modules/@math.gl/core/dist/tasks/task-runtime.js
|
|
574
|
+
function assertPayload(value) {
|
|
575
|
+
if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
|
|
576
|
+
throw new TypeError("Task payloads must be plain objects with named fields");
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function taskContext(state, context = {}) {
|
|
580
|
+
const signal = context.signal ?? new AbortController().signal;
|
|
581
|
+
return {
|
|
582
|
+
state,
|
|
583
|
+
signal,
|
|
584
|
+
throwIfAborted: () => {
|
|
585
|
+
signal.throwIfAborted();
|
|
586
|
+
context.throwIfAborted?.();
|
|
587
|
+
},
|
|
588
|
+
reportProgress: (progress) => context.reportProgress?.({
|
|
589
|
+
...progress,
|
|
590
|
+
phase: progress.phase ?? "process",
|
|
591
|
+
unit: progress.unit ?? "items"
|
|
592
|
+
})
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
async function initializeTaskWorker(task) {
|
|
596
|
+
if (!await WorkerBody.inWorkerThread())
|
|
597
|
+
throw new Error("initializeTaskWorker must run inside a worker");
|
|
598
|
+
if (installed)
|
|
599
|
+
throw new Error("A task is already installed in this worker");
|
|
600
|
+
installed = true;
|
|
601
|
+
const runtime = new TaskRuntime(task);
|
|
602
|
+
let streamOptions = {};
|
|
603
|
+
return createWorker(async (request, _options, context) => {
|
|
604
|
+
switch (request.operation) {
|
|
605
|
+
case "initialize":
|
|
606
|
+
return runtime.initialize(request.input, context);
|
|
607
|
+
case "destroy":
|
|
608
|
+
return runtime.destroy();
|
|
609
|
+
case "stream-options":
|
|
610
|
+
streamOptions = request.options;
|
|
611
|
+
return {};
|
|
612
|
+
case "process":
|
|
613
|
+
return runtime.process(request.input, request.options, context);
|
|
614
|
+
default:
|
|
615
|
+
throw new Error("Unknown task operation");
|
|
616
|
+
}
|
|
617
|
+
}, async function* (inputs, _options, context) {
|
|
618
|
+
async function* batches() {
|
|
619
|
+
for await (const input of inputs) {
|
|
620
|
+
assertPayload(input);
|
|
621
|
+
yield input;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
try {
|
|
625
|
+
yield* runtime.stream(batches(), streamOptions, context);
|
|
626
|
+
} finally {
|
|
627
|
+
streamOptions = {};
|
|
628
|
+
}
|
|
629
|
+
}, () => preloadTaskCode(task));
|
|
630
|
+
}
|
|
631
|
+
var TaskRuntime, installed;
|
|
632
|
+
var init_task_runtime = __esm({
|
|
633
|
+
"../../node_modules/@math.gl/core/dist/tasks/task-runtime.js"() {
|
|
634
|
+
init_worker_utils();
|
|
635
|
+
init_task_preload();
|
|
636
|
+
TaskRuntime = class {
|
|
637
|
+
constructor(task) {
|
|
638
|
+
this.task = task;
|
|
639
|
+
this.initialized = false;
|
|
640
|
+
}
|
|
641
|
+
async initialize(input, context = {}) {
|
|
642
|
+
if (this.initialized)
|
|
643
|
+
throw new Error("Task is already initialized");
|
|
644
|
+
assertPayload(input);
|
|
645
|
+
await preloadTaskCode(this.task, context.signal);
|
|
646
|
+
context.signal?.throwIfAborted();
|
|
647
|
+
this.state = await this.task.initialize?.(input, taskContext(void 0, context));
|
|
648
|
+
this.initialized = true;
|
|
649
|
+
return {};
|
|
650
|
+
}
|
|
651
|
+
async destroy() {
|
|
652
|
+
if (this.initialized) {
|
|
653
|
+
this.initialized = false;
|
|
654
|
+
const state = this.state;
|
|
655
|
+
this.state = void 0;
|
|
656
|
+
if (this.task.initialize)
|
|
657
|
+
await this.task.destroy?.(state);
|
|
658
|
+
}
|
|
659
|
+
return {};
|
|
660
|
+
}
|
|
661
|
+
async process(input, options, context = {}) {
|
|
662
|
+
if (!this.initialized)
|
|
663
|
+
throw new Error("Task is not initialized");
|
|
664
|
+
if (!this.task.process)
|
|
665
|
+
throw new Error("Task has no atomic processor");
|
|
666
|
+
assertPayload(input);
|
|
667
|
+
const result = await this.task.process(input, options, taskContext(this.state, context));
|
|
668
|
+
assertPayload(result);
|
|
669
|
+
return result;
|
|
670
|
+
}
|
|
671
|
+
async *stream(inputs, options, context = {}) {
|
|
672
|
+
if (!this.initialized)
|
|
673
|
+
throw new Error("Task is not initialized");
|
|
674
|
+
if (!this.task.processInBatches)
|
|
675
|
+
throw new Error("Task has no streaming processor");
|
|
676
|
+
for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
|
|
677
|
+
assertPayload(output);
|
|
678
|
+
yield output;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
installed = false;
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
// ../../node_modules/@math.gl/core/dist/tasks/index.js
|
|
687
|
+
var init_tasks = __esm({
|
|
688
|
+
"../../node_modules/@math.gl/core/dist/tasks/index.js"() {
|
|
689
|
+
init_task_runtime();
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
// ../core/src/worker-utils/lib/node/worker_threads-browser.ts
|
|
694
|
+
var worker_threads_browser_exports = {};
|
|
695
|
+
__export(worker_threads_browser_exports, {
|
|
696
|
+
NodeWorker: () => NodeWorker,
|
|
697
|
+
parentPort: () => parentPort2
|
|
698
|
+
});
|
|
699
|
+
var NodeWorker, parentPort2;
|
|
700
|
+
var init_worker_threads_browser2 = __esm({
|
|
701
|
+
"../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
|
|
702
|
+
"use strict";
|
|
703
|
+
NodeWorker = class {
|
|
704
|
+
/** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
|
|
705
|
+
constructor(...arguments_) {
|
|
706
|
+
const runtimeProcess = globalThis.process;
|
|
707
|
+
const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
|
|
708
|
+
if (WorkerConstructor) {
|
|
709
|
+
return new WorkerConstructor(...arguments_);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
/** No-op browser fallback matching the native Worker API. */
|
|
713
|
+
terminate() {
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
parentPort2 = null;
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
// ../core/src/worker-utils/lib/worker-api/task-runtime.ts
|
|
721
|
+
function normalizeTaskProgress(progress) {
|
|
722
|
+
return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
|
|
723
|
+
}
|
|
724
|
+
async function isWorkerThread() {
|
|
725
|
+
if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
|
|
726
|
+
return true;
|
|
727
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
728
|
+
const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
|
|
729
|
+
return !isMainThread;
|
|
730
|
+
}
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
var initializeTaskWorker2;
|
|
734
|
+
var init_task_runtime2 = __esm({
|
|
735
|
+
"../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
|
|
736
|
+
"use strict";
|
|
737
|
+
init_tasks();
|
|
738
|
+
initializeTaskWorker2 = initializeTaskWorker;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
|
|
743
|
+
function getTransferList2(object, recursive = true, transfers) {
|
|
744
|
+
const transfersSet = transfers || /* @__PURE__ */ new Set();
|
|
745
|
+
if (!object) {
|
|
746
|
+
} else if (isTransferable2(object)) {
|
|
747
|
+
transfersSet.add(object);
|
|
748
|
+
} else if (isTransferable2(object.buffer)) {
|
|
749
|
+
transfersSet.add(object.buffer);
|
|
750
|
+
} else if (ArrayBuffer.isView(object)) {
|
|
751
|
+
} else if (recursive && typeof object === "object") {
|
|
752
|
+
for (const key in object) {
|
|
753
|
+
getTransferList2(object[key], recursive, transfersSet);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return transfers === void 0 ? Array.from(transfersSet) : [];
|
|
757
|
+
}
|
|
758
|
+
function isTransferable2(object) {
|
|
759
|
+
if (!object) {
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
if (object instanceof ArrayBuffer) {
|
|
763
|
+
return true;
|
|
764
|
+
}
|
|
765
|
+
if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
|
|
769
|
+
return true;
|
|
770
|
+
}
|
|
771
|
+
if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
|
|
772
|
+
return true;
|
|
773
|
+
}
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
var init_get_transfer_list2 = __esm({
|
|
777
|
+
"../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
|
|
778
|
+
"use strict";
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
// ../core/src/worker-utils/lib/worker-api/create-worker.ts
|
|
783
|
+
async function createWorker2(process2, processInBatches) {
|
|
784
|
+
if (!await isWorkerThread()) return;
|
|
785
|
+
await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
|
|
786
|
+
}
|
|
787
|
+
function createWorkerTask(process2, processInBatches) {
|
|
788
|
+
return {
|
|
789
|
+
id: "loaders.gl",
|
|
790
|
+
initialize: (state) => state,
|
|
791
|
+
destroy: (state) => state.port?.close(),
|
|
792
|
+
process: async ({ value }, options, context) => {
|
|
793
|
+
if (!process2) throw new Error("Worker does not support atomic processing");
|
|
794
|
+
return { value: await process2(value, options, createContext(context), context.state.context) };
|
|
795
|
+
},
|
|
796
|
+
...processInBatches ? {
|
|
797
|
+
processInBatches: async function* (inputs, options, context) {
|
|
798
|
+
async function* values() {
|
|
799
|
+
for await (const input of inputs) yield input.value;
|
|
800
|
+
}
|
|
801
|
+
for await (const value of processInBatches(
|
|
802
|
+
values(),
|
|
803
|
+
options,
|
|
804
|
+
createContext(context),
|
|
805
|
+
context.state.context
|
|
806
|
+
)) {
|
|
807
|
+
yield { value };
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
} : {}
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function createContext(context) {
|
|
814
|
+
let requestIdentifier = 0;
|
|
815
|
+
const port = context.state.port;
|
|
816
|
+
return {
|
|
817
|
+
signal: context.signal,
|
|
818
|
+
throwIfAborted: () => context.throwIfAborted(),
|
|
819
|
+
reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
|
|
820
|
+
process: port ? (input, options = {}, jobContext = {}) => {
|
|
821
|
+
context.throwIfAborted();
|
|
822
|
+
const identifier = ++requestIdentifier;
|
|
823
|
+
return new Promise((resolve, reject) => {
|
|
824
|
+
const onMessage = (event) => {
|
|
825
|
+
if (event.data.identifier !== identifier) return;
|
|
826
|
+
cleanup();
|
|
827
|
+
if (event.data.error) {
|
|
828
|
+
const error = new Error(event.data.error.message);
|
|
829
|
+
error.name = event.data.error.name;
|
|
830
|
+
reject(error);
|
|
831
|
+
} else resolve(event.data.value);
|
|
832
|
+
};
|
|
833
|
+
const onAbort = () => {
|
|
834
|
+
cleanup();
|
|
835
|
+
reject(context.signal.reason);
|
|
836
|
+
};
|
|
837
|
+
const cleanup = () => {
|
|
838
|
+
port.removeEventListener("message", onMessage);
|
|
839
|
+
context.signal.removeEventListener("abort", onAbort);
|
|
840
|
+
};
|
|
841
|
+
port.addEventListener("message", onMessage);
|
|
842
|
+
context.signal.addEventListener("abort", onAbort, { once: true });
|
|
843
|
+
port.start();
|
|
844
|
+
try {
|
|
845
|
+
const request = { identifier, input, options, context: jobContext };
|
|
846
|
+
port.postMessage(request, getTransferList2(request));
|
|
847
|
+
} catch (error) {
|
|
848
|
+
cleanup();
|
|
849
|
+
reject(error);
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
} : void 0
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
var init_create_worker2 = __esm({
|
|
856
|
+
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
857
|
+
"use strict";
|
|
858
|
+
init_task_runtime2();
|
|
859
|
+
init_get_transfer_list2();
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
// ../core/src/worker-utils/index.ts
|
|
864
|
+
var init_worker_utils2 = __esm({
|
|
396
865
|
"../core/src/worker-utils/index.ts"() {
|
|
397
866
|
"use strict";
|
|
398
|
-
|
|
867
|
+
init_create_worker2();
|
|
399
868
|
}
|
|
400
869
|
});
|
|
401
870
|
|
|
402
871
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
403
872
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
404
|
-
await
|
|
873
|
+
await createWorker2(
|
|
405
874
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
406
875
|
selectLoader(options || {}),
|
|
407
876
|
input,
|
|
@@ -539,7 +1008,7 @@
|
|
|
539
1008
|
var init_create_loader_worker = __esm({
|
|
540
1009
|
"../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts"() {
|
|
541
1010
|
"use strict";
|
|
542
|
-
|
|
1011
|
+
init_worker_utils2();
|
|
543
1012
|
}
|
|
544
1013
|
});
|
|
545
1014
|
|
|
@@ -8395,11 +8864,11 @@ return true;`);
|
|
|
8395
8864
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8396
8865
|
}
|
|
8397
8866
|
setValue(index, value) {
|
|
8398
|
-
const
|
|
8399
|
-
const current =
|
|
8867
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
8868
|
+
const current = pending2.get(index);
|
|
8400
8869
|
current && (this._pendingLength -= current.length);
|
|
8401
8870
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8402
|
-
|
|
8871
|
+
pending2.set(index, value);
|
|
8403
8872
|
}
|
|
8404
8873
|
setValid(index, isValid) {
|
|
8405
8874
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8422,12 +8891,12 @@ return true;`);
|
|
|
8422
8891
|
return super.finish();
|
|
8423
8892
|
}
|
|
8424
8893
|
_flush() {
|
|
8425
|
-
const
|
|
8894
|
+
const pending2 = this._pending;
|
|
8426
8895
|
const pendingLength = this._pendingLength;
|
|
8427
8896
|
this._pendingLength = 0;
|
|
8428
8897
|
this._pending = void 0;
|
|
8429
|
-
if (
|
|
8430
|
-
this._flushPending(
|
|
8898
|
+
if (pending2 && pending2.size > 0) {
|
|
8899
|
+
this._flushPending(pending2, pendingLength);
|
|
8431
8900
|
}
|
|
8432
8901
|
return this;
|
|
8433
8902
|
}
|
|
@@ -11013,11 +11482,11 @@ return true;`);
|
|
|
11013
11482
|
setValue(index, value) {
|
|
11014
11483
|
return super.setValue(index, toUint8Array(value));
|
|
11015
11484
|
}
|
|
11016
|
-
_flushPending(
|
|
11485
|
+
_flushPending(pending2, pendingLength) {
|
|
11017
11486
|
const offsets = this._offsets;
|
|
11018
11487
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11019
11488
|
let offset = 0;
|
|
11020
|
-
for (const [index, value] of
|
|
11489
|
+
for (const [index, value] of pending2) {
|
|
11021
11490
|
if (value === void 0) {
|
|
11022
11491
|
offsets.set(index, 0);
|
|
11023
11492
|
} else {
|
|
@@ -11054,11 +11523,11 @@ return true;`);
|
|
|
11054
11523
|
setValue(index, value) {
|
|
11055
11524
|
return super.setValue(index, toUint8Array(value));
|
|
11056
11525
|
}
|
|
11057
|
-
_flushPending(
|
|
11526
|
+
_flushPending(pending2, pendingLength) {
|
|
11058
11527
|
const offsets = this._offsets;
|
|
11059
11528
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11060
11529
|
let offset = 0;
|
|
11061
|
-
for (const [index, value] of
|
|
11530
|
+
for (const [index, value] of pending2) {
|
|
11062
11531
|
if (value === void 0) {
|
|
11063
11532
|
offsets.set(index, BigInt(0));
|
|
11064
11533
|
} else {
|
|
@@ -11369,10 +11838,10 @@ return true;`);
|
|
|
11369
11838
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11370
11839
|
return this.numChildren - 1;
|
|
11371
11840
|
}
|
|
11372
|
-
_flushPending(
|
|
11841
|
+
_flushPending(pending2) {
|
|
11373
11842
|
const offsets = this._offsets;
|
|
11374
11843
|
const [child] = this.children;
|
|
11375
|
-
for (const [index, value] of
|
|
11844
|
+
for (const [index, value] of pending2) {
|
|
11376
11845
|
if (typeof value === "undefined") {
|
|
11377
11846
|
offsets.set(index, 0);
|
|
11378
11847
|
} else {
|
|
@@ -11411,10 +11880,10 @@ return true;`);
|
|
|
11411
11880
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11412
11881
|
return this.numChildren - 1;
|
|
11413
11882
|
}
|
|
11414
|
-
_flushPending(
|
|
11883
|
+
_flushPending(pending2) {
|
|
11415
11884
|
const offsets = this._offsets;
|
|
11416
11885
|
const [child] = this.children;
|
|
11417
|
-
for (const [index, value] of
|
|
11886
|
+
for (const [index, value] of pending2) {
|
|
11418
11887
|
if (typeof value === "undefined") {
|
|
11419
11888
|
offsets.set(index, BigInt(0));
|
|
11420
11889
|
} else {
|
|
@@ -11444,11 +11913,11 @@ return true;`);
|
|
|
11444
11913
|
}
|
|
11445
11914
|
setValue(index, value) {
|
|
11446
11915
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11447
|
-
const
|
|
11448
|
-
const current =
|
|
11916
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
11917
|
+
const current = pending2.get(index);
|
|
11449
11918
|
current && (this._pendingLength -= current.size);
|
|
11450
11919
|
this._pendingLength += row.size;
|
|
11451
|
-
|
|
11920
|
+
pending2.set(index, row);
|
|
11452
11921
|
}
|
|
11453
11922
|
addChild(child, name = `${this.numChildren}`) {
|
|
11454
11923
|
if (this.numChildren > 0) {
|
|
@@ -11458,10 +11927,10 @@ return true;`);
|
|
|
11458
11927
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11459
11928
|
return this.numChildren - 1;
|
|
11460
11929
|
}
|
|
11461
|
-
_flushPending(
|
|
11930
|
+
_flushPending(pending2) {
|
|
11462
11931
|
const offsets = this._offsets;
|
|
11463
11932
|
const [child] = this.children;
|
|
11464
|
-
for (const [index, value] of
|
|
11933
|
+
for (const [index, value] of pending2) {
|
|
11465
11934
|
if (value === void 0) {
|
|
11466
11935
|
offsets.set(index, 0);
|
|
11467
11936
|
} else {
|
|
@@ -11670,7 +12139,7 @@ return true;`);
|
|
|
11670
12139
|
return super.setValue(index, encodeUtf8(value));
|
|
11671
12140
|
}
|
|
11672
12141
|
// @ts-ignore
|
|
11673
|
-
_flushPending(
|
|
12142
|
+
_flushPending(pending2, pendingLength) {
|
|
11674
12143
|
}
|
|
11675
12144
|
};
|
|
11676
12145
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11701,7 +12170,7 @@ return true;`);
|
|
|
11701
12170
|
return super.setValue(index, encodeUtf8(value));
|
|
11702
12171
|
}
|
|
11703
12172
|
// @ts-ignore
|
|
11704
|
-
_flushPending(
|
|
12173
|
+
_flushPending(pending2, pendingLength) {
|
|
11705
12174
|
}
|
|
11706
12175
|
};
|
|
11707
12176
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -17348,7 +17817,7 @@ return true;`);
|
|
|
17348
17817
|
"use strict";
|
|
17349
17818
|
init_pcd_format();
|
|
17350
17819
|
init_arrow_transport();
|
|
17351
|
-
VERSION = true ? "5.0.0-beta.
|
|
17820
|
+
VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
17352
17821
|
PCDLoader = {
|
|
17353
17822
|
...PCDFormat,
|
|
17354
17823
|
dataType: null,
|