@loaders.gl/pointclouds 5.0.0-beta.2 → 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/dist/dist.dev.js +6 -1
- package/dist/dist.min.js +4 -4
- package/dist/las/las-loader-shared.cjs +1 -1
- package/dist/las/las-loader-shared.js +1 -1
- package/dist/las/las-writer.cjs +1 -1
- package/dist/las/las-writer.js +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-worker.js +405 -84
- package/dist/las-writer.cjs +1 -1
- package/dist/pcd/pcd-loader-types.cjs +1 -1
- package/dist/pcd/pcd-loader-types.js +1 -1
- package/dist/pcd/pcd-writer.cjs +1 -1
- package/dist/pcd/pcd-writer.js +1 -1
- package/dist/pcd-loader-types.cjs +1 -1
- package/dist/pcd-worker.js +393 -57
- package/dist/pcd-writer.cjs +1 -1
- package/dist/ply/ply-loader-types.cjs +1 -1
- package/dist/ply/ply-loader-types.js +1 -1
- package/dist/ply/ply-writer.cjs +1 -1
- package/dist/ply/ply-writer.js +1 -1
- package/dist/ply-loader-types.cjs +1 -1
- package/dist/ply-worker.js +393 -57
- package/dist/ply-writer.cjs +1 -1
- package/package.json +4 -3
- package/src/las/lib/las-extra-bytes.ts +6 -4
package/dist/ply-worker.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
var parentPort;
|
|
20
20
|
var init_worker_threads_browser = __esm({
|
|
21
21
|
"../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
|
|
22
|
-
parentPort = null;
|
|
22
|
+
parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -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);
|
|
@@ -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
|
}
|
|
@@ -285,8 +288,19 @@
|
|
|
285
288
|
}
|
|
286
289
|
});
|
|
287
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
|
+
|
|
288
302
|
// ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
|
|
289
|
-
async function createWorker(
|
|
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
|
}
|
|
@@ -491,6 +508,7 @@
|
|
|
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;
|
|
@@ -502,6 +520,7 @@
|
|
|
502
520
|
var import_meta, path, moduleUrl;
|
|
503
521
|
var init_worker_utils = __esm({
|
|
504
522
|
"../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
|
|
523
|
+
init_worker_body();
|
|
505
524
|
init_create_worker();
|
|
506
525
|
import_meta = {};
|
|
507
526
|
path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
|
|
@@ -509,18 +528,335 @@
|
|
|
509
528
|
}
|
|
510
529
|
});
|
|
511
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
|
+
|
|
512
686
|
// ../../node_modules/@math.gl/core/dist/tasks/index.js
|
|
513
687
|
var init_tasks = __esm({
|
|
514
688
|
"../../node_modules/@math.gl/core/dist/tasks/index.js"() {
|
|
515
|
-
|
|
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";
|
|
516
779
|
}
|
|
517
780
|
});
|
|
518
781
|
|
|
519
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
|
+
}
|
|
520
855
|
var init_create_worker2 = __esm({
|
|
521
856
|
"../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
|
|
522
857
|
"use strict";
|
|
523
|
-
|
|
858
|
+
init_task_runtime2();
|
|
859
|
+
init_get_transfer_list2();
|
|
524
860
|
}
|
|
525
861
|
});
|
|
526
862
|
|
|
@@ -534,7 +870,7 @@
|
|
|
534
870
|
|
|
535
871
|
// ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
|
|
536
872
|
async function createLoaderWorker(loader, selectLoader = () => loader) {
|
|
537
|
-
await
|
|
873
|
+
await createWorker2(
|
|
538
874
|
(input, options, workerContext, loaderContext) => processLoaderWorkerData(
|
|
539
875
|
selectLoader(options || {}),
|
|
540
876
|
input,
|
|
@@ -8644,11 +8980,11 @@ return true;`);
|
|
|
8644
8980
|
this._offsets = new OffsetsBufferBuilder(opts.type);
|
|
8645
8981
|
}
|
|
8646
8982
|
setValue(index, value) {
|
|
8647
|
-
const
|
|
8648
|
-
const current =
|
|
8983
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
8984
|
+
const current = pending2.get(index);
|
|
8649
8985
|
current && (this._pendingLength -= current.length);
|
|
8650
8986
|
this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
|
|
8651
|
-
|
|
8987
|
+
pending2.set(index, value);
|
|
8652
8988
|
}
|
|
8653
8989
|
setValid(index, isValid) {
|
|
8654
8990
|
if (!super.setValid(index, isValid)) {
|
|
@@ -8671,12 +9007,12 @@ return true;`);
|
|
|
8671
9007
|
return super.finish();
|
|
8672
9008
|
}
|
|
8673
9009
|
_flush() {
|
|
8674
|
-
const
|
|
9010
|
+
const pending2 = this._pending;
|
|
8675
9011
|
const pendingLength = this._pendingLength;
|
|
8676
9012
|
this._pendingLength = 0;
|
|
8677
9013
|
this._pending = void 0;
|
|
8678
|
-
if (
|
|
8679
|
-
this._flushPending(
|
|
9014
|
+
if (pending2 && pending2.size > 0) {
|
|
9015
|
+
this._flushPending(pending2, pendingLength);
|
|
8680
9016
|
}
|
|
8681
9017
|
return this;
|
|
8682
9018
|
}
|
|
@@ -11262,11 +11598,11 @@ return true;`);
|
|
|
11262
11598
|
setValue(index, value) {
|
|
11263
11599
|
return super.setValue(index, toUint8Array(value));
|
|
11264
11600
|
}
|
|
11265
|
-
_flushPending(
|
|
11601
|
+
_flushPending(pending2, pendingLength) {
|
|
11266
11602
|
const offsets = this._offsets;
|
|
11267
11603
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11268
11604
|
let offset = 0;
|
|
11269
|
-
for (const [index, value] of
|
|
11605
|
+
for (const [index, value] of pending2) {
|
|
11270
11606
|
if (value === void 0) {
|
|
11271
11607
|
offsets.set(index, 0);
|
|
11272
11608
|
} else {
|
|
@@ -11303,11 +11639,11 @@ return true;`);
|
|
|
11303
11639
|
setValue(index, value) {
|
|
11304
11640
|
return super.setValue(index, toUint8Array(value));
|
|
11305
11641
|
}
|
|
11306
|
-
_flushPending(
|
|
11642
|
+
_flushPending(pending2, pendingLength) {
|
|
11307
11643
|
const offsets = this._offsets;
|
|
11308
11644
|
const data = this._values.reserve(pendingLength).buffer;
|
|
11309
11645
|
let offset = 0;
|
|
11310
|
-
for (const [index, value] of
|
|
11646
|
+
for (const [index, value] of pending2) {
|
|
11311
11647
|
if (value === void 0) {
|
|
11312
11648
|
offsets.set(index, BigInt(0));
|
|
11313
11649
|
} else {
|
|
@@ -11618,10 +11954,10 @@ return true;`);
|
|
|
11618
11954
|
this.type = new List2(new Field2(name, child.type, true));
|
|
11619
11955
|
return this.numChildren - 1;
|
|
11620
11956
|
}
|
|
11621
|
-
_flushPending(
|
|
11957
|
+
_flushPending(pending2) {
|
|
11622
11958
|
const offsets = this._offsets;
|
|
11623
11959
|
const [child] = this.children;
|
|
11624
|
-
for (const [index, value] of
|
|
11960
|
+
for (const [index, value] of pending2) {
|
|
11625
11961
|
if (typeof value === "undefined") {
|
|
11626
11962
|
offsets.set(index, 0);
|
|
11627
11963
|
} else {
|
|
@@ -11660,10 +11996,10 @@ return true;`);
|
|
|
11660
11996
|
this.type = new LargeList2(new Field2(name, child.type, true));
|
|
11661
11997
|
return this.numChildren - 1;
|
|
11662
11998
|
}
|
|
11663
|
-
_flushPending(
|
|
11999
|
+
_flushPending(pending2) {
|
|
11664
12000
|
const offsets = this._offsets;
|
|
11665
12001
|
const [child] = this.children;
|
|
11666
|
-
for (const [index, value] of
|
|
12002
|
+
for (const [index, value] of pending2) {
|
|
11667
12003
|
if (typeof value === "undefined") {
|
|
11668
12004
|
offsets.set(index, BigInt(0));
|
|
11669
12005
|
} else {
|
|
@@ -11693,11 +12029,11 @@ return true;`);
|
|
|
11693
12029
|
}
|
|
11694
12030
|
setValue(index, value) {
|
|
11695
12031
|
const row = value instanceof Map ? value : new Map(Object.entries(value));
|
|
11696
|
-
const
|
|
11697
|
-
const current =
|
|
12032
|
+
const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
|
|
12033
|
+
const current = pending2.get(index);
|
|
11698
12034
|
current && (this._pendingLength -= current.size);
|
|
11699
12035
|
this._pendingLength += row.size;
|
|
11700
|
-
|
|
12036
|
+
pending2.set(index, row);
|
|
11701
12037
|
}
|
|
11702
12038
|
addChild(child, name = `${this.numChildren}`) {
|
|
11703
12039
|
if (this.numChildren > 0) {
|
|
@@ -11707,10 +12043,10 @@ return true;`);
|
|
|
11707
12043
|
this.type = new Map_(new Field2(name, child.type, true), this.type.keysSorted);
|
|
11708
12044
|
return this.numChildren - 1;
|
|
11709
12045
|
}
|
|
11710
|
-
_flushPending(
|
|
12046
|
+
_flushPending(pending2) {
|
|
11711
12047
|
const offsets = this._offsets;
|
|
11712
12048
|
const [child] = this.children;
|
|
11713
|
-
for (const [index, value] of
|
|
12049
|
+
for (const [index, value] of pending2) {
|
|
11714
12050
|
if (value === void 0) {
|
|
11715
12051
|
offsets.set(index, 0);
|
|
11716
12052
|
} else {
|
|
@@ -11919,7 +12255,7 @@ return true;`);
|
|
|
11919
12255
|
return super.setValue(index, encodeUtf8(value));
|
|
11920
12256
|
}
|
|
11921
12257
|
// @ts-ignore
|
|
11922
|
-
_flushPending(
|
|
12258
|
+
_flushPending(pending2, pendingLength) {
|
|
11923
12259
|
}
|
|
11924
12260
|
};
|
|
11925
12261
|
Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
|
|
@@ -11950,7 +12286,7 @@ return true;`);
|
|
|
11950
12286
|
return super.setValue(index, encodeUtf8(value));
|
|
11951
12287
|
}
|
|
11952
12288
|
// @ts-ignore
|
|
11953
|
-
_flushPending(
|
|
12289
|
+
_flushPending(pending2, pendingLength) {
|
|
11954
12290
|
}
|
|
11955
12291
|
};
|
|
11956
12292
|
LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
|
|
@@ -13662,8 +13998,8 @@ return true;`);
|
|
|
13662
13998
|
});
|
|
13663
13999
|
|
|
13664
14000
|
// ../../node_modules/apache-arrow/ipc/reader.mjs
|
|
13665
|
-
function shouldAutoDestroy(
|
|
13666
|
-
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] :
|
|
14001
|
+
function shouldAutoDestroy(self2, options) {
|
|
14002
|
+
return options && typeof options["autoDestroy"] === "boolean" ? options["autoDestroy"] : self2["autoDestroy"];
|
|
13667
14003
|
}
|
|
13668
14004
|
function* readAllSync(source) {
|
|
13669
14005
|
const reader = RecordBatchReader.from(source);
|
|
@@ -19139,7 +19475,7 @@ return true;`);
|
|
|
19139
19475
|
"use strict";
|
|
19140
19476
|
init_ply_format();
|
|
19141
19477
|
init_arrow_transport();
|
|
19142
|
-
VERSION = true ? "5.0.0-beta.
|
|
19478
|
+
VERSION = true ? "5.0.0-beta.4" : "latest";
|
|
19143
19479
|
PLYLoader = {
|
|
19144
19480
|
dataType: null,
|
|
19145
19481
|
batchType: null,
|