@loaders.gl/pointclouds 5.0.0-beta.4 → 5.0.0-beta.6

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.
Files changed (67) hide show
  1. package/LAS-README.md +1 -1
  2. package/PCD-README.md +1 -1
  3. package/PLY-README.md +1 -1
  4. package/README.md +1 -1
  5. package/dist/dist.dev.js +129 -90
  6. package/dist/dist.min.js +20 -20
  7. package/dist/las/las-loader-shared.cjs +1 -1
  8. package/dist/las/las-loader-shared.js +1 -1
  9. package/dist/las/las-loader-types.d.ts +2 -2
  10. package/dist/las/las-loader.cjs +4 -4
  11. package/dist/las/las-loader.cjs.map +2 -2
  12. package/dist/las/las-loader.d.ts +1 -1
  13. package/dist/las/las-loader.d.ts.map +1 -1
  14. package/dist/las/las-loader.js +1 -1
  15. package/dist/las/las-loader.js.map +1 -1
  16. package/dist/las/las-writer.cjs +1 -1
  17. package/dist/las/las-writer.js +1 -1
  18. package/dist/las-loader.cjs +4 -4
  19. package/dist/las-loader.cjs.map +2 -2
  20. package/dist/las-worker.js +303 -80
  21. package/dist/las-writer.cjs +1 -1
  22. package/dist/pcd/pcd-loader-types.cjs +3 -3
  23. package/dist/pcd/pcd-loader-types.cjs.map +2 -2
  24. package/dist/pcd/pcd-loader-types.d.ts +1 -1
  25. package/dist/pcd/pcd-loader-types.d.ts.map +1 -1
  26. package/dist/pcd/pcd-loader-types.js +2 -2
  27. package/dist/pcd/pcd-loader-types.js.map +1 -1
  28. package/dist/pcd/pcd-loader.cjs +4 -4
  29. package/dist/pcd/pcd-loader.cjs.map +2 -2
  30. package/dist/pcd/pcd-loader.d.ts +1 -1
  31. package/dist/pcd/pcd-loader.d.ts.map +1 -1
  32. package/dist/pcd/pcd-loader.js +1 -1
  33. package/dist/pcd/pcd-loader.js.map +1 -1
  34. package/dist/pcd/pcd-writer.cjs +1 -1
  35. package/dist/pcd/pcd-writer.js +1 -1
  36. package/dist/pcd-loader-types.cjs +3 -3
  37. package/dist/pcd-loader-types.cjs.map +2 -2
  38. package/dist/pcd-loader.cjs +4 -4
  39. package/dist/pcd-loader.cjs.map +2 -2
  40. package/dist/pcd-worker.js +568 -287
  41. package/dist/pcd-writer.cjs +1 -1
  42. package/dist/ply/ply-loader-types.cjs +3 -3
  43. package/dist/ply/ply-loader-types.cjs.map +2 -2
  44. package/dist/ply/ply-loader-types.d.ts +1 -1
  45. package/dist/ply/ply-loader-types.d.ts.map +1 -1
  46. package/dist/ply/ply-loader-types.js +2 -2
  47. package/dist/ply/ply-loader-types.js.map +1 -1
  48. package/dist/ply/ply-loader.cjs +4 -4
  49. package/dist/ply/ply-loader.cjs.map +2 -2
  50. package/dist/ply/ply-loader.d.ts +1 -1
  51. package/dist/ply/ply-loader.d.ts.map +1 -1
  52. package/dist/ply/ply-loader.js +1 -1
  53. package/dist/ply/ply-loader.js.map +1 -1
  54. package/dist/ply/ply-writer.cjs +1 -1
  55. package/dist/ply/ply-writer.js +1 -1
  56. package/dist/ply-loader-types.cjs +3 -3
  57. package/dist/ply-loader-types.cjs.map +2 -2
  58. package/dist/ply-loader.cjs +4 -4
  59. package/dist/ply-loader.cjs.map +2 -2
  60. package/dist/ply-worker.js +394 -113
  61. package/dist/ply-writer.cjs +1 -1
  62. package/package.json +3 -3
  63. package/src/las/las-loader.ts +1 -1
  64. package/src/pcd/pcd-loader-types.ts +1 -1
  65. package/src/pcd/pcd-loader.ts +1 -1
  66. package/src/ply/ply-loader-types.ts +1 -1
  67. package/src/ply/ply-loader.ts +1 -1
@@ -15,15 +15,15 @@
15
15
  __defProp(target, name, { get: all[name], enumerable: true });
16
16
  };
17
17
 
18
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js
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/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
21
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
22
22
  parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
23
23
  }
24
24
  });
25
25
 
26
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js
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();
@@ -74,11 +74,11 @@
74
74
  return false;
75
75
  }
76
76
  var init_get_transfer_list = __esm({
77
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
77
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
78
78
  }
79
79
  });
80
80
 
81
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js
81
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
82
82
  async function getParentPort() {
83
83
  return parentPort;
84
84
  }
@@ -91,7 +91,7 @@
91
91
  }
92
92
  var onMessageWrapperMap, WorkerBody;
93
93
  var init_worker_body = __esm({
94
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js"() {
94
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
95
95
  init_get_transfer_list();
96
96
  init_worker_threads_browser();
97
97
  onMessageWrapperMap = /* @__PURE__ */ new Map();
@@ -172,10 +172,10 @@
172
172
  }
173
173
  });
174
174
 
175
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js
175
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
176
176
  var AsyncQueue;
177
177
  var init_async_queue = __esm({
178
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js"() {
178
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
179
179
  AsyncQueue = class {
180
180
  constructor() {
181
181
  this._values = [];
@@ -244,10 +244,10 @@
244
244
  }
245
245
  });
246
246
 
247
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js
247
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
248
248
  var SharedWorkerState;
249
249
  var init_shared_state = __esm({
250
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js"() {
250
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
251
251
  SharedWorkerState = class {
252
252
  constructor(buffer) {
253
253
  if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
@@ -288,18 +288,18 @@
288
288
  }
289
289
  });
290
290
 
291
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js
291
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
292
292
  function validateOutputOwnership(ownership) {
293
293
  if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
294
294
  throw new Error("Invalid worker output ownership");
295
295
  }
296
296
  }
297
297
  var init_validate_output_ownership = __esm({
298
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
298
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
299
299
  }
300
300
  });
301
301
 
302
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
302
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
303
303
  async function createWorker(process2, processInBatches, preload2) {
304
304
  if (!await WorkerBody.inWorkerThread()) {
305
305
  return;
@@ -504,7 +504,7 @@
504
504
  }
505
505
  var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
506
506
  var init_create_worker = __esm({
507
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js"() {
507
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
508
508
  init_shared_state();
509
509
  init_async_queue();
510
510
  init_worker_body();
@@ -516,19 +516,20 @@
516
516
  }
517
517
  });
518
518
 
519
- // ../../node_modules/@math.gl/core/dist/worker-utils/index.js
519
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
520
520
  var import_meta, path, moduleUrl;
521
521
  var init_worker_utils = __esm({
522
- "../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
522
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
523
523
  init_worker_body();
524
524
  init_create_worker();
525
+ init_get_transfer_list();
525
526
  import_meta = {};
526
527
  path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
527
528
  moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
528
529
  }
529
530
  });
530
531
 
531
- // ../../node_modules/@math.gl/core/dist/tasks/task-preload.js
532
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
532
533
  function preloadTaskCode(task, signal) {
533
534
  if (!task.preload)
534
535
  return Promise.resolve();
@@ -564,23 +565,193 @@
564
565
  }
565
566
  var pending, loaded;
566
567
  var init_task_preload = __esm({
567
- "../../node_modules/@math.gl/core/dist/tasks/task-preload.js"() {
568
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
568
569
  pending = /* @__PURE__ */ new WeakMap();
569
570
  loaded = /* @__PURE__ */ new WeakSet();
570
571
  }
571
572
  });
572
573
 
573
- // ../../node_modules/@math.gl/core/dist/tasks/task-runtime.js
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
574
724
  function assertPayload(value) {
575
725
  if (!value || typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype) {
576
726
  throw new TypeError("Task payloads must be plain objects with named fields");
577
727
  }
578
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
+ }
579
740
  function taskContext(state, context = {}) {
580
741
  const signal = context.signal ?? new AbortController().signal;
581
742
  return {
582
743
  state,
583
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
+ },
584
755
  throwIfAborted: () => {
585
756
  signal.throwIfAborted();
586
757
  context.throwIfAborted?.();
@@ -599,6 +770,69 @@
599
770
  throw new Error("A task is already installed in this worker");
600
771
  installed = true;
601
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
+ });
602
836
  let streamOptions = {};
603
837
  return createWorker(async (request, _options, context) => {
604
838
  switch (request.operation) {
@@ -630,9 +864,10 @@
630
864
  }
631
865
  var TaskRuntime, installed;
632
866
  var init_task_runtime = __esm({
633
- "../../node_modules/@math.gl/core/dist/tasks/task-runtime.js"() {
867
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
634
868
  init_worker_utils();
635
869
  init_task_preload();
870
+ init_task_channel();
636
871
  TaskRuntime = class {
637
872
  constructor(task) {
638
873
  this.task = task;
@@ -683,13 +918,20 @@
683
918
  }
684
919
  });
685
920
 
686
- // ../../node_modules/@math.gl/core/dist/tasks/index.js
921
+ // ../../node_modules/@math.gl/tasks/dist/tasks/index.js
687
922
  var init_tasks = __esm({
688
- "../../node_modules/@math.gl/core/dist/tasks/index.js"() {
923
+ "../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
689
924
  init_task_runtime();
690
925
  }
691
926
  });
692
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
+
693
935
  // ../core/src/worker-utils/lib/node/worker_threads-browser.ts
694
936
  var worker_threads_browser_exports = {};
695
937
  __export(worker_threads_browser_exports, {
@@ -734,7 +976,7 @@
734
976
  var init_task_runtime2 = __esm({
735
977
  "../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
736
978
  "use strict";
737
- init_tasks();
979
+ init_dist();
738
980
  initializeTaskWorker2 = initializeTaskWorker;
739
981
  }
740
982
  });
@@ -1240,7 +1482,7 @@
1240
1482
  });
1241
1483
 
1242
1484
  // ../../node_modules/@math.gl/core/dist/index.js
1243
- var init_dist = __esm({
1485
+ var init_dist2 = __esm({
1244
1486
  "../../node_modules/@math.gl/core/dist/index.js"() {
1245
1487
  init_math_utils();
1246
1488
  init_types2();
@@ -16237,12 +16479,6 @@ return true;`);
16237
16479
  metadata: serializeArrowMetadata(arrowSchema.metadata)
16238
16480
  };
16239
16481
  }
16240
- function deserializeArrowSchema(schema, options) {
16241
- return new Schema2(
16242
- schema.fields.map((field) => deserializeArrowField(field, options)),
16243
- deserializeArrowMetadata(schema.metadata)
16244
- );
16245
- }
16246
16482
  function serializeArrowMetadata(arrowMetadata) {
16247
16483
  return Object.fromEntries(arrowMetadata);
16248
16484
  }
@@ -16776,7 +17012,7 @@ return true;`);
16776
17012
  var init_float162 = __esm({
16777
17013
  "../core/src/schema/float16.ts"() {
16778
17014
  "use strict";
16779
- init_dist();
17015
+ init_dist2();
16780
17016
  }
16781
17017
  });
16782
17018
 
@@ -17276,7 +17512,29 @@ return true;`);
17276
17512
  }
17277
17513
  });
17278
17514
 
17279
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
17515
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
17516
+ function getArrowVariadicBuffers(data) {
17517
+ return data.variadicBuffers ?? [];
17518
+ }
17519
+ function createArrowData(type, offset, length, nullCount, buffers, children, dictionary, variadicBuffers) {
17520
+ return Reflect.construct(Data, [
17521
+ type,
17522
+ offset,
17523
+ length,
17524
+ nullCount,
17525
+ buffers,
17526
+ children,
17527
+ dictionary,
17528
+ variadicBuffers
17529
+ ]);
17530
+ }
17531
+ var init_arrow_data = __esm({
17532
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
17533
+ init_Arrow_dom();
17534
+ }
17535
+ });
17536
+
17537
+ // ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
17280
17538
  function splitArrowBuffers(input, options = {}) {
17281
17539
  const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
17282
17540
  if (isArrowTable2(input)) {
@@ -17299,17 +17557,12 @@ return true;`);
17299
17557
  function isArrowVector2(input) {
17300
17558
  return "data" in input && Array.isArray(input.data);
17301
17559
  }
17302
- function splitArrowTableBuffersInternal(table, options) {
17303
- const recordBatches = table.batches.map(
17304
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
17305
- );
17306
- return new Table(table.schema, recordBatches);
17560
+ function splitArrowTableBuffersInternal(arrowTable, options) {
17561
+ const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
17562
+ return new Table(arrowTable.schema, recordBatches);
17307
17563
  }
17308
17564
  function splitArrowRecordBatchBuffers(recordBatch, options) {
17309
- return new RecordBatch3(
17310
- recordBatch.schema,
17311
- splitArrowDataBuffers(recordBatch.data, options)
17312
- );
17565
+ return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
17313
17566
  }
17314
17567
  function splitArrowDataBuffers(data, options) {
17315
17568
  const children = data.children.map((childData) => splitArrowDataBuffers(childData, options));
@@ -17320,7 +17573,7 @@ return true;`);
17320
17573
  [BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
17321
17574
  [BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
17322
17575
  };
17323
- return new Data(
17576
+ return createArrowData(
17324
17577
  data.type,
17325
17578
  data.offset,
17326
17579
  data.length,
@@ -17328,7 +17581,8 @@ return true;`);
17328
17581
  data._nullCount,
17329
17582
  buffers,
17330
17583
  children,
17331
- dictionary
17584
+ dictionary,
17585
+ getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
17332
17586
  );
17333
17587
  }
17334
17588
  function splitArrowVectorBuffers(vector, options) {
@@ -17346,7 +17600,7 @@ return true;`);
17346
17600
  }
17347
17601
  let copy = options.copies.get(array);
17348
17602
  if (!copy) {
17349
- copy = array.slice();
17603
+ copy = array instanceof Uint8Array ? new Uint8Array(array) : array.slice();
17350
17604
  options.copies.set(array, copy);
17351
17605
  }
17352
17606
  return copy;
@@ -17355,29 +17609,106 @@ return true;`);
17355
17609
  return ArrayBuffer.isView(value) && !(value instanceof DataView);
17356
17610
  }
17357
17611
  var init_split_arrow_buffers = __esm({
17358
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
17359
- "use strict";
17612
+ "../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
17360
17613
  init_Arrow_dom();
17614
+ init_arrow_data();
17615
+ }
17616
+ });
17617
+
17618
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
17619
+ var init_indexed_arrow_vector = __esm({
17620
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
17361
17621
  }
17362
17622
  });
17363
17623
 
17364
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
17365
- function dehydrateArrowTable(table, options) {
17366
- const splitTable = splitArrowBuffers(table, options);
17624
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
17625
+ var init_indexed_arrow_table = __esm({
17626
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
17627
+ }
17628
+ });
17629
+
17630
+ // ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
17631
+ var init_mapped_arrow_table = __esm({
17632
+ "../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
17633
+ }
17634
+ });
17635
+
17636
+ // ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
17637
+ var init_rename_arrow_columns = __esm({
17638
+ "../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
17639
+ }
17640
+ });
17641
+
17642
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
17643
+ function dehydrateArrowTable(arrowTable, options) {
17644
+ const splitTable = splitArrowBuffers(arrowTable, options);
17367
17645
  return {
17368
- shape: "arrow-table",
17369
17646
  transport: "arrow-js",
17370
- schema: serializeArrowSchema(splitTable.schema),
17371
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
17647
+ version: 1,
17648
+ schema: tableToIPC(new Table(splitTable.schema, [])),
17649
+ metadataVersion: splitTable.schema.metadataVersion,
17650
+ batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
17372
17651
  };
17373
17652
  }
17374
17653
  function hydrateArrowTable(table) {
17375
- const schema = deserializeArrowSchema(table.schema);
17376
- const recordBatches = table.batches.map(
17377
- (recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
17378
- );
17379
- return new Table(schema, recordBatches);
17654
+ if (table.transport !== "arrow-js" || table.version !== 1) {
17655
+ throw new Error("Unsupported Arrow column-buffer transport protocol.");
17656
+ }
17657
+ const decodedSchema = tableFromIPC(table.schema).schema;
17658
+ const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
17659
+ const type = new Struct(schema.fields);
17660
+ const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
17661
+ return new Table(schema, batches);
17662
+ }
17663
+ function dehydrateArrowData(data) {
17664
+ return {
17665
+ offset: data.offset,
17666
+ length: data.length,
17667
+ nullCount: data.nullCount,
17668
+ buffers: {
17669
+ [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
17670
+ [BufferType.DATA]: data.buffers[BufferType.DATA],
17671
+ [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
17672
+ [BufferType.TYPE]: data.buffers[BufferType.TYPE]
17673
+ },
17674
+ children: data.children.map((child) => dehydrateArrowData(child)),
17675
+ variadicBuffers: getArrowVariadicBuffers(data),
17676
+ dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
17677
+ };
17678
+ }
17679
+ function hydrateArrowData(data, type) {
17680
+ const children = data.children.map((child, index) => hydrateArrowData(child, type.children[index].type));
17681
+ const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
17682
+ return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children, dictionary, data.variadicBuffers);
17380
17683
  }
17684
+ var init_arrow_table_transport = __esm({
17685
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
17686
+ init_Arrow_dom();
17687
+ init_arrow_data();
17688
+ init_split_arrow_buffers();
17689
+ }
17690
+ });
17691
+
17692
+ // ../../node_modules/@math.gl/arrow/dist/arrow/index.js
17693
+ var init_arrow = __esm({
17694
+ "../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
17695
+ init_indexed_arrow_table();
17696
+ init_indexed_arrow_vector();
17697
+ init_mapped_arrow_table();
17698
+ init_rename_arrow_columns();
17699
+ init_split_arrow_buffers();
17700
+ init_arrow_table_transport();
17701
+ }
17702
+ });
17703
+
17704
+ // ../../node_modules/@math.gl/arrow/dist/index.js
17705
+ var init_dist3 = __esm({
17706
+ "../../node_modules/@math.gl/arrow/dist/index.js"() {
17707
+ init_arrow();
17708
+ }
17709
+ });
17710
+
17711
+ // ../core/src/arrow-worker-transport.ts
17381
17712
  function serializeArrowWorkerTable(result) {
17382
17713
  if (!isArrowTableWrapper(result)) {
17383
17714
  throw new Error("Workers require Arrow table output");
@@ -17406,60 +17737,10 @@ return true;`);
17406
17737
  table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
17407
17738
  );
17408
17739
  }
17409
- function dehydrateArrowRecordBatch(recordBatch) {
17410
- return { data: dehydrateArrowData(recordBatch.data) };
17411
- }
17412
- function dehydrateArrowData(data) {
17413
- return {
17414
- type: serializeArrowType(data.type),
17415
- offset: data.offset,
17416
- length: data.length,
17417
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
17418
- nullCount: data._nullCount,
17419
- buffers: {
17420
- [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
17421
- [BufferType.DATA]: data.buffers[BufferType.DATA],
17422
- [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
17423
- [BufferType.TYPE]: data.buffers[BufferType.TYPE]
17424
- },
17425
- children: data.children.map((childData) => dehydrateArrowData(childData)),
17426
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
17427
- };
17428
- }
17429
- function dehydrateArrowVector(vector) {
17430
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
17431
- }
17432
- function hydrateArrowData(data) {
17433
- const children = data.children.map((childData) => hydrateArrowData(childData));
17434
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
17435
- return new Data(
17436
- deserializeArrowType(data.type),
17437
- data.offset,
17438
- data.length,
17439
- data.nullCount,
17440
- data.buffers,
17441
- children,
17442
- dictionary
17443
- );
17444
- }
17445
- function hydrateArrowVector(vector) {
17446
- return new Vector(vector.data.map((data) => hydrateArrowData(data)));
17447
- }
17448
- var init_arrow_table_transport = __esm({
17449
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
17740
+ var init_arrow_worker_transport = __esm({
17741
+ "../core/src/arrow-worker-transport.ts"() {
17450
17742
  "use strict";
17451
- init_Arrow_dom();
17452
- init_convert_arrow_schema();
17453
- init_split_arrow_buffers();
17454
- }
17455
- });
17456
-
17457
- // ../core/src/schema-utils/arrow-transport.ts
17458
- var init_arrow_transport = __esm({
17459
- "../core/src/schema-utils/arrow-transport.ts"() {
17460
- "use strict";
17461
- init_arrow_table_transport();
17462
- init_split_arrow_buffers();
17743
+ init_dist3();
17463
17744
  }
17464
17745
  });
17465
17746
 
@@ -19474,8 +19755,8 @@ return true;`);
19474
19755
  "src/ply/ply-loader-types.ts"() {
19475
19756
  "use strict";
19476
19757
  init_ply_format();
19477
- init_arrow_transport();
19478
- VERSION = true ? "5.0.0-beta.4" : "latest";
19758
+ init_arrow_worker_transport();
19759
+ VERSION = true ? "5.0.0-beta.6" : "latest";
19479
19760
  PLYLoader = {
19480
19761
  dataType: null,
19481
19762
  batchType: null,
@@ -19580,7 +19861,7 @@ return true;`);
19580
19861
  "use strict";
19581
19862
  init_loader_utils();
19582
19863
  init_schema3();
19583
- init_arrow_transport();
19864
+ init_arrow_worker_transport();
19584
19865
  init_schema_utils();
19585
19866
  init_parse_ply();
19586
19867
  init_parse_ply_arrow();