@loaders.gl/tiles-3d 5.0.0-beta.2 → 5.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  3. package/dist/3d-tiles/dist.dev.js +1393 -962
  4. package/dist/3d-tiles/dist.min.js +37 -37
  5. package/dist/3d-tiles/index.cjs +989 -987
  6. package/dist/3d-tiles/index.cjs.map +3 -3
  7. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts.map +1 -1
  8. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js +12 -8
  9. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.js.map +1 -1
  10. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +5 -1
  11. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  12. package/dist/3d-tiles/lib/utils/version.js +1 -1
  13. package/dist/3d-tiles-archive-writer.cjs +1 -1
  14. package/dist/cesium-ion-loader-with-parser.cjs +983 -981
  15. package/dist/cesium-ion-loader-with-parser.cjs.map +3 -3
  16. package/dist/copc/copc-source-loader.js +2 -2
  17. package/dist/copc/copc-source-loader.js.map +1 -1
  18. package/dist/copc/copc-writer.js +1 -1
  19. package/dist/copc/index.cjs +365 -170
  20. package/dist/copc/index.cjs.map +3 -3
  21. package/dist/dist.dev.js +231 -38
  22. package/dist/dist.min.js +10 -10
  23. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  24. package/dist/i3s/dist.dev.js +6591 -1184
  25. package/dist/i3s/dist.min.js +55 -47
  26. package/dist/i3s/i3s-attribute-loader.js +1 -1
  27. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  28. package/dist/i3s/i3s-content-loader.js +1 -1
  29. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  30. package/dist/i3s/i3s-loader.js +1 -1
  31. package/dist/i3s/i3s-node-page-loader.js +1 -1
  32. package/dist/i3s/i3s-slpk-loader.js +1 -1
  33. package/dist/i3s/i3s-slpk-writer.js +1 -1
  34. package/dist/i3s/index.cjs +4763 -1136
  35. package/dist/i3s/index.cjs.map +3 -3
  36. package/dist/i3s-content-worker-node.js +11 -11
  37. package/dist/i3s-content-worker-node.js.map +4 -4
  38. package/dist/i3s-content-worker.js +1148 -391
  39. package/dist/i3s-lepcc-worker-node.js +609 -44
  40. package/dist/i3s-lepcc-worker-node.js.map +4 -4
  41. package/dist/i3s-lepcc-worker.js +575 -40
  42. package/dist/i3s-mesh-writer.cjs +8880 -5253
  43. package/dist/i3s-mesh-writer.cjs.map +3 -3
  44. package/dist/i3s-slpk-writer.cjs +1 -1
  45. package/dist/index.cjs +1 -1
  46. package/dist/point-cloud-tile-source-loader-types.js +1 -1
  47. package/dist/point-cloud-tile-source-loader.cjs +1 -1
  48. package/dist/potree/dist.dev.js +310 -110
  49. package/dist/potree/dist.min.js +31 -31
  50. package/dist/potree/index.cjs +19 -166
  51. package/dist/potree/index.cjs.map +3 -3
  52. package/dist/potree/potree-bin-loader.js +1 -1
  53. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  54. package/dist/potree/potree-loader-types.js +1 -1
  55. package/dist/potree/potree-source-loader.js +1 -1
  56. package/dist/potree/potree-writer.js +1 -1
  57. package/dist/potree-loader.cjs +1 -1
  58. package/package.json +13 -13
  59. package/src/3d-tiles/lib/classes/tile-3d-batch-table.ts +12 -8
  60. package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +4 -1
  61. package/src/copc/copc-source-loader.ts +1 -1
@@ -112,7 +112,7 @@
112
112
 
113
113
  // ../core/src/worker-utils/lib/env-utils/version.ts
114
114
  function getVersion() {
115
- const version = false ? NPM_TAG : "5.0.0-beta.2";
115
+ const version = false ? NPM_TAG : "5.0.0-beta.5";
116
116
  globalThis._loadersgl_ = globalThis._loadersgl_ || {};
117
117
  globalThis._loadersgl_.version ||= version;
118
118
  return version;
@@ -161,15 +161,15 @@
161
161
  }
162
162
  });
163
163
 
164
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js
164
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js
165
165
  var parentPort;
166
166
  var init_worker_threads_browser = __esm({
167
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/node/worker_threads-browser.js"() {
168
- parentPort = null;
167
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/node/worker_threads-browser.js"() {
168
+ parentPort = globalThis.process?.getBuiltinModule?.("node:worker_threads")?.parentPort ?? null;
169
169
  }
170
170
  });
171
171
 
172
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js
172
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js
173
173
  function getTransferList(object2, recursive = true, transfers) {
174
174
  const transfersSet = transfers || /* @__PURE__ */ new Set();
175
175
  const seen = /* @__PURE__ */ new Set();
@@ -182,6 +182,9 @@
182
182
  else if (ArrayBuffer.isView(value2)) {
183
183
  if (isTransferable(value2.buffer))
184
184
  transfersSet.add(value2.buffer);
185
+ } else if (recursive && typeof MessageChannel !== "undefined" && value2 instanceof MessageChannel) {
186
+ visit(value2.port1);
187
+ visit(value2.port2);
185
188
  } else if (recursive && value2 instanceof Map) {
186
189
  for (const [key2, item] of value2) {
187
190
  visit(key2);
@@ -217,11 +220,11 @@
217
220
  return false;
218
221
  }
219
222
  var init_get_transfer_list = __esm({
220
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
223
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-utils/get-transfer-list.js"() {
221
224
  }
222
225
  });
223
226
 
224
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js
227
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js
225
228
  async function getParentPort() {
226
229
  return parentPort;
227
230
  }
@@ -234,7 +237,7 @@
234
237
  }
235
238
  var onMessageWrapperMap, WorkerBody;
236
239
  var init_worker_body = __esm({
237
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-farm/worker-body.js"() {
240
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-farm/worker-body.js"() {
238
241
  init_get_transfer_list();
239
242
  init_worker_threads_browser();
240
243
  onMessageWrapperMap = /* @__PURE__ */ new Map();
@@ -249,16 +252,16 @@
249
252
  */
250
253
  static set onmessage(onMessage) {
251
254
  async function handleMessage(message) {
252
- const parentPort2 = await getParentPort();
253
- const { type, payload } = parentPort2 ? message : message.data;
255
+ const parentPort3 = await getParentPort();
256
+ const { type, payload } = parentPort3 ? message : message.data;
254
257
  onMessage(type, payload);
255
258
  }
256
- getParentPort().then((parentPort2) => {
257
- if (parentPort2) {
258
- parentPort2.on("message", (message) => {
259
+ getParentPort().then((parentPort3) => {
260
+ if (parentPort3) {
261
+ parentPort3.on("message", (message) => {
259
262
  handleMessage(message);
260
263
  });
261
- parentPort2.on("exit", () => console.debug("Node worker closing"));
264
+ parentPort3.on("exit", () => console.debug("Node worker closing"));
262
265
  } else {
263
266
  globalThis.onmessage = handleMessage;
264
267
  }
@@ -276,9 +279,9 @@
276
279
  };
277
280
  onMessageWrapperMap.set(onMessage, onMessageWrapper);
278
281
  }
279
- const parentPort2 = await getParentPort();
280
- if (parentPort2) {
281
- parentPort2.on("message", onMessageWrapper);
282
+ const parentPort3 = await getParentPort();
283
+ if (parentPort3) {
284
+ parentPort3.on("message", onMessageWrapper);
282
285
  } else {
283
286
  globalThis.addEventListener("message", onMessageWrapper);
284
287
  }
@@ -289,9 +292,9 @@
289
292
  if (!onMessageWrapper) {
290
293
  return;
291
294
  }
292
- const parentPort2 = await getParentPort();
293
- if (parentPort2) {
294
- parentPort2.off("message", onMessageWrapper);
295
+ const parentPort3 = await getParentPort();
296
+ if (parentPort3) {
297
+ parentPort3.off("message", onMessageWrapper);
295
298
  } else {
296
299
  globalThis.removeEventListener("message", onMessageWrapper);
297
300
  }
@@ -301,12 +304,12 @@
301
304
  * @param type
302
305
  * @param payload
303
306
  */
304
- static async postMessage(type, payload) {
307
+ static async postMessage(type, payload, copy2 = false) {
305
308
  const data = { source: "loaders.gl", type, payload };
306
- const transferList = getTransferList(payload);
307
- const parentPort2 = await getParentPort();
308
- if (parentPort2) {
309
- parentPort2.postMessage(data, transferList);
309
+ const transferList = copy2 ? [] : getTransferList(payload);
310
+ const parentPort3 = await getParentPort();
311
+ if (parentPort3) {
312
+ parentPort3.postMessage(data, transferList);
310
313
  } else {
311
314
  globalThis.postMessage(data, transferList);
312
315
  }
@@ -315,10 +318,10 @@
315
318
  }
316
319
  });
317
320
 
318
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js
321
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js
319
322
  var AsyncQueue;
320
323
  var init_async_queue = __esm({
321
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/async-queue/async-queue.js"() {
324
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/async-queue/async-queue.js"() {
322
325
  AsyncQueue = class {
323
326
  constructor() {
324
327
  this._values = [];
@@ -387,10 +390,10 @@
387
390
  }
388
391
  });
389
392
 
390
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js
393
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js
391
394
  var SharedWorkerState;
392
395
  var init_shared_state = __esm({
393
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/shared-state.js"() {
396
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/shared-state.js"() {
394
397
  SharedWorkerState = class {
395
398
  constructor(buffer) {
396
399
  if (typeof SharedArrayBuffer === "undefined" || !(buffer instanceof SharedArrayBuffer) || buffer.byteLength !== 16)
@@ -431,8 +434,19 @@
431
434
  }
432
435
  });
433
436
 
434
- // ../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js
435
- async function createWorker(process2, processInBatches) {
437
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js
438
+ function validateOutputOwnership(ownership) {
439
+ if (ownership !== void 0 && ownership !== "copy" && ownership !== "transfer") {
440
+ throw new Error("Invalid worker output ownership");
441
+ }
442
+ }
443
+ var init_validate_output_ownership = __esm({
444
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/validate-output-ownership.js"() {
445
+ }
446
+ });
447
+
448
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js
449
+ async function createWorker(process2, processInBatches, preload5) {
436
450
  if (!await WorkerBody.inWorkerThread()) {
437
451
  return;
438
452
  }
@@ -473,10 +487,12 @@
473
487
  }
474
488
  switch (type) {
475
489
  case "preload":
490
+ await preload5?.();
476
491
  WorkerBody.postMessage("done", {});
477
492
  break;
478
493
  case "process":
479
494
  throwIfAborted();
495
+ validateOutputOwnership(payload.options?.["outputOwnership"]);
480
496
  if (!process2) {
481
497
  throw new Error("Worker does not support atomic processing");
482
498
  }
@@ -486,10 +502,11 @@
486
502
  await WorkerBody.postMessage("done", {
487
503
  result,
488
504
  executionMs: performance.now() - startedAt
489
- });
505
+ }, payload.options?.["outputOwnership"] === "copy");
490
506
  break;
491
507
  case "process-in-batches":
492
508
  throwIfAborted();
509
+ validateOutputOwnership(payload.options?.["outputOwnership"]);
493
510
  if (!processInBatches) {
494
511
  throw new Error("Worker does not support batched processing");
495
512
  }
@@ -501,7 +518,7 @@
501
518
  const resultIterator = processInBatches(createDemandDrivenIterator(inputBatches), payload.options || {}, jobContext, payload.context || {});
502
519
  for await (const batch of resultIterator) {
503
520
  throwIfAborted();
504
- await WorkerBody.postMessage("output-batch", { result: batch });
521
+ await WorkerBody.postMessage("output-batch", { result: batch }, payload.options?.["outputOwnership"] === "copy");
505
522
  await outputAcknowledgements.next();
506
523
  }
507
524
  throwIfAborted();
@@ -599,14 +616,14 @@
599
616
  });
600
617
  }
601
618
  function createProgressReporter() {
602
- let pending;
619
+ let pending2;
603
620
  let finished = false;
604
621
  let scheduled = false;
605
622
  const flush = () => {
606
623
  scheduled = false;
607
- if (pending) {
608
- WorkerBody.postMessage("progress", { progress: pending });
609
- pending = void 0;
624
+ if (pending2) {
625
+ WorkerBody.postMessage("progress", { progress: pending2 });
626
+ pending2 = void 0;
610
627
  }
611
628
  };
612
629
  return {
@@ -614,9 +631,9 @@
614
631
  report(progress) {
615
632
  if (finished)
616
633
  return;
617
- if (pending && pending.phase !== progress.phase)
634
+ if (pending2 && pending2.phase !== progress.phase)
618
635
  flush();
619
- pending = { ...progress };
636
+ pending2 = { ...progress };
620
637
  if (!scheduled) {
621
638
  scheduled = true;
622
639
  setTimeout(flush, 0);
@@ -625,7 +642,7 @@
625
642
  /** Flushes final progress and suppresses reports from stale callbacks. */
626
643
  finish(discard = false) {
627
644
  if (discard)
628
- pending = void 0;
645
+ pending2 = void 0;
629
646
  flush();
630
647
  finished = true;
631
648
  }
@@ -633,10 +650,11 @@
633
650
  }
634
651
  var requestId, activeController, activeInputBatches, activeOutputAcknowledgements;
635
652
  var init_create_worker = __esm({
636
- "../../node_modules/@math.gl/core/dist/worker-utils/lib/worker-api/create-worker.js"() {
653
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/lib/worker-api/create-worker.js"() {
637
654
  init_shared_state();
638
655
  init_async_queue();
639
656
  init_worker_body();
657
+ init_validate_output_ownership();
640
658
  requestId = 0;
641
659
  activeController = null;
642
660
  activeInputBatches = null;
@@ -644,29 +662,589 @@
644
662
  }
645
663
  });
646
664
 
647
- // ../../node_modules/@math.gl/core/dist/worker-utils/index.js
665
+ // ../../node_modules/@math.gl/tasks/dist/worker-utils/index.js
648
666
  var import_meta, path, moduleUrl;
649
667
  var init_worker_utils = __esm({
650
- "../../node_modules/@math.gl/core/dist/worker-utils/index.js"() {
668
+ "../../node_modules/@math.gl/tasks/dist/worker-utils/index.js"() {
669
+ init_worker_body();
651
670
  init_create_worker();
671
+ init_get_transfer_list();
652
672
  import_meta = {};
653
673
  path = typeof __filename === "string" ? __filename.replace(/\\/g, "/") : "";
654
674
  moduleUrl = path ? `file://${path.startsWith("/") ? "" : "/"}${encodeURI(path).replace(/#/g, "%23").replace(/\?/g, "%3F")}` : import_meta.url;
655
675
  }
656
676
  });
657
677
 
658
- // ../../node_modules/@math.gl/core/dist/tasks/index.js
659
- var init_tasks = __esm({
660
- "../../node_modules/@math.gl/core/dist/tasks/index.js"() {
678
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js
679
+ function preloadTaskCode(task, signal) {
680
+ if (!task.preload)
681
+ return Promise.resolve();
682
+ let promise = pending.get(task);
683
+ if (!promise) {
684
+ promise = Promise.resolve().then(() => task.preload()).then(() => {
685
+ loaded.add(task);
686
+ });
687
+ pending.set(task, promise);
688
+ void promise.catch(() => pending.delete(task));
689
+ }
690
+ return withSignal(promise, signal);
691
+ }
692
+ function withSignal(operation2, signal) {
693
+ if (!signal)
694
+ return operation2;
695
+ return new Promise((resolve, reject) => {
696
+ const abort = () => {
697
+ signal.removeEventListener("abort", abort);
698
+ reject(signal.reason);
699
+ };
700
+ signal.addEventListener("abort", abort, { once: true });
701
+ if (signal.aborted)
702
+ abort();
703
+ operation2.then((value2) => {
704
+ signal.removeEventListener("abort", abort);
705
+ resolve(value2);
706
+ }, (error) => {
707
+ signal.removeEventListener("abort", abort);
708
+ reject(error);
709
+ });
710
+ });
711
+ }
712
+ var pending, loaded;
713
+ var init_task_preload = __esm({
714
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-preload.js"() {
715
+ pending = /* @__PURE__ */ new WeakMap();
716
+ loaded = /* @__PURE__ */ new WeakSet();
717
+ }
718
+ });
719
+
720
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js
721
+ var TaskRequestError, TaskChannel;
722
+ var init_task_channel = __esm({
723
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-channel.js"() {
724
+ TaskRequestError = class extends Error {
725
+ };
726
+ TaskChannel = class {
727
+ constructor(options) {
728
+ this.options = options;
729
+ this.nextId = 1;
730
+ this.pending = /* @__PURE__ */ new Map();
731
+ this.incoming = /* @__PURE__ */ new Map();
732
+ }
733
+ /** Send a request without serializing other in-flight requests. */
734
+ request(operation2, value2, signal, transfer = []) {
735
+ if (this.failure)
736
+ return Promise.reject(this.failure.reason);
737
+ if (signal?.aborted)
738
+ return Promise.reject(signal.reason);
739
+ const id = this.nextId++;
740
+ return new Promise((resolve, reject) => {
741
+ const abort = () => {
742
+ const pending2 = this.pending.get(id);
743
+ if (!pending2)
744
+ return;
745
+ this.pending.delete(id);
746
+ pending2.cleanup();
747
+ reject(signal?.reason);
748
+ this.send({ source: "math.gl/tasks", kind: "cancel", id });
749
+ };
750
+ this.pending.set(id, {
751
+ resolve,
752
+ reject,
753
+ cleanup: () => signal?.removeEventListener("abort", abort)
754
+ });
755
+ signal?.addEventListener("abort", abort, { once: true });
756
+ this.send({ source: "math.gl/tasks", kind: "request", id, operation: operation2, value: value2 }, transfer);
757
+ });
758
+ }
759
+ /** Send a one-way notification. */
760
+ emit(operation2, value2, transfer = []) {
761
+ if (this.failure)
762
+ throw this.failure.reason;
763
+ this.send({ source: "math.gl/tasks", kind: "event", id: 0, operation: operation2, value: value2 }, transfer);
764
+ }
765
+ /** Dispatch a transport message; unrelated protocols are ignored. */
766
+ receive(message) {
767
+ if (this.failure || message?.source !== "math.gl/tasks")
768
+ return;
769
+ if (message.kind === "failure") {
770
+ const reason = new Error(message.error?.message ?? "Task channel failed");
771
+ this.close(reason);
772
+ this.options.onFailure?.(reason);
773
+ } else if (message.kind === "result" || message.kind === "error") {
774
+ const pending2 = this.pending.get(message.id);
775
+ if (!pending2)
776
+ return;
777
+ this.pending.delete(message.id);
778
+ pending2.cleanup();
779
+ if (message.kind === "result")
780
+ pending2.resolve(message.value);
781
+ else {
782
+ const error = new TaskRequestError(message.error?.message ?? "Task request failed");
783
+ error.name = message.error?.name ?? "Error";
784
+ pending2.reject(error);
785
+ }
786
+ } else if (message.kind === "cancel") {
787
+ this.incoming.get(message.id)?.abort(new DOMException("Task request cancelled", "AbortError"));
788
+ } else if (message.kind === "event") {
789
+ try {
790
+ this.options.handleEvent?.(message.operation, message.value);
791
+ } catch (error) {
792
+ this.fail(error);
793
+ }
794
+ } else if (message.kind === "request") {
795
+ if (this.incoming.has(message.id)) {
796
+ this.fail(new Error("Duplicate task request identifier"));
797
+ return;
798
+ }
799
+ const controller = new AbortController();
800
+ this.incoming.set(message.id, controller);
801
+ void Promise.resolve().then(() => {
802
+ controller.signal.throwIfAborted();
803
+ return this.options.handleRequest(message.operation, message.value, controller.signal);
804
+ }).then((value2) => {
805
+ if (!controller.signal.aborted && !this.failure) {
806
+ this.send({ source: "math.gl/tasks", kind: "result", id: message.id, value: value2 }, this.options.getResultTransferList?.(value2, message.value));
807
+ }
808
+ }).catch((reason) => {
809
+ if (!controller.signal.aborted && !this.failure) {
810
+ this.send({
811
+ source: "math.gl/tasks",
812
+ kind: "error",
813
+ id: message.id,
814
+ error: {
815
+ name: reason instanceof Error ? reason.name : "Error",
816
+ message: reason instanceof Error ? reason.message : String(reason)
817
+ }
818
+ });
819
+ }
820
+ }).finally(() => this.incoming.delete(message.id));
821
+ }
822
+ }
823
+ /** Reject all outstanding calls with a common cause and abort incoming callbacks. */
824
+ close(reason = new Error("Task channel closed")) {
825
+ if (this.failure)
826
+ return;
827
+ this.failure = { reason };
828
+ for (const pending2 of this.pending.values()) {
829
+ pending2.cleanup();
830
+ pending2.reject(reason);
831
+ }
832
+ this.pending.clear();
833
+ for (const controller of this.incoming.values())
834
+ controller.abort(reason);
835
+ this.incoming.clear();
836
+ }
837
+ send(message, transfer = []) {
838
+ if (this.failure)
839
+ return;
840
+ try {
841
+ this.options.send(message, transfer);
842
+ } catch (error) {
843
+ this.fail(error);
844
+ }
845
+ }
846
+ /** Invalidate the channel and notify the peer when the transport still works. */
847
+ fail(reason) {
848
+ if (this.failure)
849
+ return;
850
+ this.close(reason);
851
+ try {
852
+ this.options.send({
853
+ source: "math.gl/tasks",
854
+ kind: "failure",
855
+ id: 0,
856
+ error: {
857
+ name: reason instanceof Error ? reason.name : "Error",
858
+ message: reason instanceof Error ? reason.message : String(reason)
859
+ }
860
+ }, []);
861
+ } catch {
862
+ }
863
+ this.options.onFailure?.(reason);
864
+ }
865
+ };
866
+ }
867
+ });
868
+
869
+ // ../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js
870
+ function assertPayload(value2) {
871
+ if (!value2 || typeof value2 !== "object" || Object.getPrototypeOf(value2) !== Object.prototype) {
872
+ throw new TypeError("Task payloads must be plain objects with named fields");
873
+ }
874
+ }
875
+ function clonePayload(value2, ownership = "copy") {
876
+ assertPayload(value2);
877
+ if (!["copy", "transfer", "share"].includes(ownership))
878
+ throw new TypeError("Invalid input ownership");
879
+ const transfer = getTransferList(value2);
880
+ if (ownership === "share" && transfer.length)
881
+ throw new TypeError("Share requires shared storage");
882
+ return structuredClone(value2, {
883
+ transfer: ownership === "transfer" ? transfer : []
884
+ });
885
+ }
886
+ function taskContext(state, context = {}) {
887
+ const signal = context.signal ?? new AbortController().signal;
888
+ return {
889
+ state,
890
+ signal,
891
+ requestHost: async (operation2, payload, controls) => {
892
+ signal.throwIfAborted();
893
+ if (!context.requestHost)
894
+ throw new Error("No host request handler configured");
895
+ return context.requestHost(operation2, payload, controls);
896
+ },
897
+ emitHost: (operation2, payload) => {
898
+ signal.throwIfAborted();
899
+ context.emitHost?.(operation2, payload);
900
+ },
901
+ throwIfAborted: () => {
902
+ signal.throwIfAborted();
903
+ context.throwIfAborted?.();
904
+ },
905
+ reportProgress: (progress) => context.reportProgress?.({
906
+ ...progress,
907
+ phase: progress.phase ?? "process",
908
+ unit: progress.unit ?? "items"
909
+ })
910
+ };
911
+ }
912
+ async function initializeTaskWorker(task) {
913
+ if (!await WorkerBody.inWorkerThread())
914
+ throw new Error("initializeTaskWorker must run inside a worker");
915
+ if (installed)
916
+ throw new Error("A task is already installed in this worker");
917
+ installed = true;
918
+ const runtime = new TaskRuntime(task);
919
+ let channelStream;
920
+ const channel = new TaskChannel({
921
+ getResultTransferList: (value2, request) => request.outputOwnership === "transfer" ? getTransferList(value2) : [],
922
+ send: (message, transfer) => {
923
+ const snapshot = structuredClone(message, { transfer });
924
+ void WorkerBody.postMessage("task-channel", snapshot).catch((reason) => channel.fail(reason));
925
+ },
926
+ handleRequest: async (operation2, value2, signal) => {
927
+ const request = value2;
928
+ const context = {
929
+ signal,
930
+ reportProgress: (progress) => channel.emit("task:progress", { id: request.progressId, progress }),
931
+ requestHost: (operation3, payload, controls = {}) => {
932
+ const request2 = {
933
+ operation: operation3,
934
+ payload: clonePayload(payload, controls.inputOwnership),
935
+ outputOwnership: controls.outputOwnership ?? "copy"
936
+ };
937
+ return channel.request("task:host-request", request2, signal, getTransferList(request2));
938
+ },
939
+ emitHost: (operation3, payload) => channel.emit("task:host-event", { operation: operation3, payload, id: request.progressId })
940
+ };
941
+ switch (operation2) {
942
+ case "initialize":
943
+ return runtime.initialize(request.input, context);
944
+ case "process":
945
+ return runtime.process(request.input, request.options, context);
946
+ case "stream-open": {
947
+ if (channelStream)
948
+ throw new Error("A task stream is already open");
949
+ async function* inputs() {
950
+ while (true) {
951
+ const result = await channel.request("task:next-input", { outputOwnership: "transfer" }, signal);
952
+ if (result.done)
953
+ return;
954
+ yield result.value;
955
+ }
956
+ }
957
+ channelStream = runtime.stream(inputs(), request.options, context)[Symbol.asyncIterator]();
958
+ return {};
959
+ }
960
+ case "stream-next":
961
+ if (!channelStream)
962
+ throw new Error("No active task stream");
963
+ return channelStream.next();
964
+ case "stream-close":
965
+ try {
966
+ await channelStream?.return?.();
967
+ } finally {
968
+ channelStream = void 0;
969
+ }
970
+ return {};
971
+ case "destroy":
972
+ return runtime.destroy();
973
+ default:
974
+ throw new Error("Unknown task channel operation");
975
+ }
976
+ }
977
+ });
978
+ await WorkerBody.addEventListener((type, payload) => {
979
+ if (type === "task-channel")
980
+ channel.receive(payload);
981
+ });
982
+ let streamOptions = {};
983
+ return createWorker(async (request, _options, context) => {
984
+ switch (request.operation) {
985
+ case "initialize":
986
+ return runtime.initialize(request.input, context);
987
+ case "destroy":
988
+ return runtime.destroy();
989
+ case "stream-options":
990
+ streamOptions = request.options;
991
+ return {};
992
+ case "process":
993
+ return runtime.process(request.input, request.options, context);
994
+ default:
995
+ throw new Error("Unknown task operation");
996
+ }
997
+ }, async function* (inputs, _options, context) {
998
+ async function* batches() {
999
+ for await (const input of inputs) {
1000
+ assertPayload(input);
1001
+ yield input;
1002
+ }
1003
+ }
1004
+ try {
1005
+ yield* runtime.stream(batches(), streamOptions, context);
1006
+ } finally {
1007
+ streamOptions = {};
1008
+ }
1009
+ }, () => preloadTaskCode(task));
1010
+ }
1011
+ var TaskRuntime, installed;
1012
+ var init_task_runtime = __esm({
1013
+ "../../node_modules/@math.gl/tasks/dist/tasks/task-runtime.js"() {
661
1014
  init_worker_utils();
1015
+ init_task_preload();
1016
+ init_task_channel();
1017
+ TaskRuntime = class {
1018
+ constructor(task) {
1019
+ this.task = task;
1020
+ this.initialized = false;
1021
+ }
1022
+ async initialize(input, context = {}) {
1023
+ if (this.initialized)
1024
+ throw new Error("Task is already initialized");
1025
+ assertPayload(input);
1026
+ await preloadTaskCode(this.task, context.signal);
1027
+ context.signal?.throwIfAborted();
1028
+ this.state = await this.task.initialize?.(input, taskContext(void 0, context));
1029
+ this.initialized = true;
1030
+ return {};
1031
+ }
1032
+ async destroy() {
1033
+ if (this.initialized) {
1034
+ this.initialized = false;
1035
+ const state = this.state;
1036
+ this.state = void 0;
1037
+ if (this.task.initialize)
1038
+ await this.task.destroy?.(state);
1039
+ }
1040
+ return {};
1041
+ }
1042
+ async process(input, options, context = {}) {
1043
+ if (!this.initialized)
1044
+ throw new Error("Task is not initialized");
1045
+ if (!this.task.process)
1046
+ throw new Error("Task has no atomic processor");
1047
+ assertPayload(input);
1048
+ const result = await this.task.process(input, options, taskContext(this.state, context));
1049
+ assertPayload(result);
1050
+ return result;
1051
+ }
1052
+ async *stream(inputs, options, context = {}) {
1053
+ if (!this.initialized)
1054
+ throw new Error("Task is not initialized");
1055
+ if (!this.task.processInBatches)
1056
+ throw new Error("Task has no streaming processor");
1057
+ for await (const output of this.task.processInBatches(inputs, options, taskContext(this.state, context))) {
1058
+ assertPayload(output);
1059
+ yield output;
1060
+ }
1061
+ }
1062
+ };
1063
+ installed = false;
1064
+ }
1065
+ });
1066
+
1067
+ // ../../node_modules/@math.gl/tasks/dist/tasks/index.js
1068
+ var init_tasks = __esm({
1069
+ "../../node_modules/@math.gl/tasks/dist/tasks/index.js"() {
1070
+ init_task_runtime();
1071
+ }
1072
+ });
1073
+
1074
+ // ../../node_modules/@math.gl/tasks/dist/index.js
1075
+ var init_dist = __esm({
1076
+ "../../node_modules/@math.gl/tasks/dist/index.js"() {
1077
+ init_tasks();
1078
+ }
1079
+ });
1080
+
1081
+ // ../core/src/worker-utils/lib/node/worker_threads-browser.ts
1082
+ var worker_threads_browser_exports = {};
1083
+ __export(worker_threads_browser_exports, {
1084
+ NodeWorker: () => NodeWorker,
1085
+ parentPort: () => parentPort2
1086
+ });
1087
+ var NodeWorker, parentPort2;
1088
+ var init_worker_threads_browser2 = __esm({
1089
+ "../core/src/worker-utils/lib/node/worker_threads-browser.ts"() {
1090
+ "use strict";
1091
+ NodeWorker = class {
1092
+ /** Restores the native worker constructor when this browser shim is embedded in a Node bundle. */
1093
+ constructor(...arguments_) {
1094
+ const runtimeProcess = globalThis.process;
1095
+ const WorkerConstructor = runtimeProcess?.getBuiltinModule?.("node:worker_threads").Worker;
1096
+ if (WorkerConstructor) {
1097
+ return new WorkerConstructor(...arguments_);
1098
+ }
1099
+ }
1100
+ /** No-op browser fallback matching the native Worker API. */
1101
+ terminate() {
1102
+ }
1103
+ };
1104
+ parentPort2 = null;
1105
+ }
1106
+ });
1107
+
1108
+ // ../core/src/worker-utils/lib/worker-api/task-runtime.ts
1109
+ function normalizeTaskProgress(progress) {
1110
+ return { ...progress, phase: progress.phase ?? "process", unit: progress.unit ?? "items" };
1111
+ }
1112
+ async function isWorkerThread() {
1113
+ if (typeof self !== "undefined" && typeof document === "undefined" && typeof self.postMessage === "function")
1114
+ return true;
1115
+ if (typeof process !== "undefined" && process.versions?.node) {
1116
+ const { isMainThread } = await Promise.resolve().then(() => (init_worker_threads_browser2(), worker_threads_browser_exports));
1117
+ return !isMainThread;
1118
+ }
1119
+ return false;
1120
+ }
1121
+ var initializeTaskWorker2;
1122
+ var init_task_runtime2 = __esm({
1123
+ "../core/src/worker-utils/lib/worker-api/task-runtime.ts"() {
1124
+ "use strict";
1125
+ init_dist();
1126
+ initializeTaskWorker2 = initializeTaskWorker;
1127
+ }
1128
+ });
1129
+
1130
+ // ../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts
1131
+ function getTransferList2(object2, recursive = true, transfers) {
1132
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
1133
+ if (!object2) {
1134
+ } else if (isTransferable2(object2)) {
1135
+ transfersSet.add(object2);
1136
+ } else if (isTransferable2(object2.buffer)) {
1137
+ transfersSet.add(object2.buffer);
1138
+ } else if (ArrayBuffer.isView(object2)) {
1139
+ } else if (recursive && typeof object2 === "object") {
1140
+ for (const key2 in object2) {
1141
+ getTransferList2(object2[key2], recursive, transfersSet);
1142
+ }
1143
+ }
1144
+ return transfers === void 0 ? Array.from(transfersSet) : [];
1145
+ }
1146
+ function isTransferable2(object2) {
1147
+ if (!object2) {
1148
+ return false;
1149
+ }
1150
+ if (object2 instanceof ArrayBuffer) {
1151
+ return true;
1152
+ }
1153
+ if (typeof MessagePort !== "undefined" && object2 instanceof MessagePort) {
1154
+ return true;
1155
+ }
1156
+ if (typeof ImageBitmap !== "undefined" && object2 instanceof ImageBitmap) {
1157
+ return true;
1158
+ }
1159
+ if (typeof OffscreenCanvas !== "undefined" && object2 instanceof OffscreenCanvas) {
1160
+ return true;
1161
+ }
1162
+ return false;
1163
+ }
1164
+ var init_get_transfer_list2 = __esm({
1165
+ "../core/src/worker-utils/lib/worker-utils/get-transfer-list.ts"() {
1166
+ "use strict";
662
1167
  }
663
1168
  });
664
1169
 
665
1170
  // ../core/src/worker-utils/lib/worker-api/create-worker.ts
1171
+ async function createWorker2(process2, processInBatches) {
1172
+ if (!await isWorkerThread()) return;
1173
+ await initializeTaskWorker2(createWorkerTask(process2, processInBatches));
1174
+ }
1175
+ function createWorkerTask(process2, processInBatches) {
1176
+ return {
1177
+ id: "loaders.gl",
1178
+ initialize: (state) => state,
1179
+ destroy: (state) => state.port?.close(),
1180
+ process: async ({ value: value2 }, options, context) => {
1181
+ if (!process2) throw new Error("Worker does not support atomic processing");
1182
+ return { value: await process2(value2, options, createContext(context), context.state.context) };
1183
+ },
1184
+ ...processInBatches ? {
1185
+ processInBatches: async function* (inputs, options, context) {
1186
+ async function* values() {
1187
+ for await (const input of inputs) yield input.value;
1188
+ }
1189
+ for await (const value2 of processInBatches(
1190
+ values(),
1191
+ options,
1192
+ createContext(context),
1193
+ context.state.context
1194
+ )) {
1195
+ yield { value: value2 };
1196
+ }
1197
+ }
1198
+ } : {}
1199
+ };
1200
+ }
1201
+ function createContext(context) {
1202
+ let requestIdentifier = 0;
1203
+ const port = context.state.port;
1204
+ return {
1205
+ signal: context.signal,
1206
+ throwIfAborted: () => context.throwIfAborted(),
1207
+ reportProgress: (progress) => context.reportProgress(normalizeTaskProgress(progress)),
1208
+ process: port ? (input, options = {}, jobContext = {}) => {
1209
+ context.throwIfAborted();
1210
+ const identifier = ++requestIdentifier;
1211
+ return new Promise((resolve, reject) => {
1212
+ const onMessage = (event) => {
1213
+ if (event.data.identifier !== identifier) return;
1214
+ cleanup();
1215
+ if (event.data.error) {
1216
+ const error = new Error(event.data.error.message);
1217
+ error.name = event.data.error.name;
1218
+ reject(error);
1219
+ } else resolve(event.data.value);
1220
+ };
1221
+ const onAbort = () => {
1222
+ cleanup();
1223
+ reject(context.signal.reason);
1224
+ };
1225
+ const cleanup = () => {
1226
+ port.removeEventListener("message", onMessage);
1227
+ context.signal.removeEventListener("abort", onAbort);
1228
+ };
1229
+ port.addEventListener("message", onMessage);
1230
+ context.signal.addEventListener("abort", onAbort, { once: true });
1231
+ port.start();
1232
+ try {
1233
+ const request = { identifier, input, options, context: jobContext };
1234
+ port.postMessage(request, getTransferList2(request));
1235
+ } catch (error) {
1236
+ cleanup();
1237
+ reject(error);
1238
+ }
1239
+ });
1240
+ } : void 0
1241
+ };
1242
+ }
666
1243
  var init_create_worker2 = __esm({
667
1244
  "../core/src/worker-utils/lib/worker-api/create-worker.ts"() {
668
1245
  "use strict";
669
- init_tasks();
1246
+ init_task_runtime2();
1247
+ init_get_transfer_list2();
670
1248
  }
671
1249
  });
672
1250
 
@@ -843,7 +1421,7 @@
843
1421
 
844
1422
  // ../core/src/loader-utils/lib/worker-loader-utils/create-loader-worker.ts
845
1423
  async function createLoaderWorker(loader, selectLoader = () => loader) {
846
- await createWorker(
1424
+ await createWorker2(
847
1425
  (input, options, workerContext, loaderContext) => processLoaderWorkerData(
848
1426
  selectLoader(options || {}),
849
1427
  input,
@@ -3668,6 +4246,35 @@
3668
4246
  out[15] = 1;
3669
4247
  return out;
3670
4248
  }
4249
+ function affineComponents(matrix) {
4250
+ if (matrix.length !== 16 || Array.from(matrix).some((x) => !Number.isFinite(x)) || matrix[3] !== 0 || matrix[7] !== 0 || matrix[11] !== 0 || matrix[15] !== 1) {
4251
+ throw new RangeError("Expected a finite affine matrix");
4252
+ }
4253
+ const scale6 = [
4254
+ Math.hypot(matrix[0], matrix[1], matrix[2]),
4255
+ Math.hypot(matrix[4], matrix[5], matrix[6]),
4256
+ Math.hypot(matrix[8], matrix[9], matrix[10])
4257
+ ];
4258
+ if (scale6.some((x) => x === 0 || !Number.isFinite(x)))
4259
+ throw new RangeError("Singular transform");
4260
+ const rotation2 = Array.from({ length: 9 }, (_, i) => matrix[Math.floor(i / 3) * 4 + i % 3] / scale6[Math.floor(i / 3)]);
4261
+ for (const [a, b] of [
4262
+ [0, 3],
4263
+ [0, 6],
4264
+ [3, 6]
4265
+ ]) {
4266
+ if (Math.abs(rotation2[a] * rotation2[b] + rotation2[a + 1] * rotation2[b + 1] + rotation2[a + 2] * rotation2[b + 2]) > 1e-7) {
4267
+ throw new RangeError("Sheared transforms do not have a TRS decomposition");
4268
+ }
4269
+ }
4270
+ const determinant3 = rotation2[0] * (rotation2[4] * rotation2[8] - rotation2[5] * rotation2[7]) - rotation2[3] * (rotation2[1] * rotation2[8] - rotation2[2] * rotation2[7]) + rotation2[6] * (rotation2[1] * rotation2[5] - rotation2[2] * rotation2[4]);
4271
+ if (determinant3 < 0) {
4272
+ scale6[0] = -scale6[0];
4273
+ for (let i = 0; i < 3; i++)
4274
+ rotation2[i] = -rotation2[i];
4275
+ }
4276
+ return { rotation: rotation2, scale: scale6, translation: [matrix[12], matrix[13], matrix[14]] };
4277
+ }
3671
4278
  var perspective, ortho;
3672
4279
  var init_mat4 = __esm({
3673
4280
  "../../node_modules/@math.gl/core/dist/gl-matrix/mat4.js"() {
@@ -3801,6 +4408,7 @@
3801
4408
  var init_matrix4 = __esm({
3802
4409
  "../../node_modules/@math.gl/core/dist/classes/matrix4.js"() {
3803
4410
  init_matrix();
4411
+ init_mat4();
3804
4412
  init_validators();
3805
4413
  init_gl_matrix_extras();
3806
4414
  init_mat4();
@@ -4085,27 +4693,15 @@
4085
4693
  * @returns self
4086
4694
  */
4087
4695
  getRotation(result, scaleResult) {
4088
- result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
4089
- scaleResult = scaleResult || [-0, -0, -0];
4090
- const scale6 = this.getScale(scaleResult);
4091
- const inverseScale0 = 1 / scale6[0];
4092
- const inverseScale1 = 1 / scale6[1];
4093
- const inverseScale2 = 1 / scale6[2];
4094
- result[0] = this[0] * inverseScale0;
4095
- result[1] = this[1] * inverseScale1;
4096
- result[2] = this[2] * inverseScale2;
4097
- result[3] = 0;
4098
- result[4] = this[4] * inverseScale0;
4099
- result[5] = this[5] * inverseScale1;
4100
- result[6] = this[6] * inverseScale2;
4101
- result[7] = 0;
4102
- result[8] = this[8] * inverseScale0;
4103
- result[9] = this[9] * inverseScale1;
4104
- result[10] = this[10] * inverseScale2;
4105
- result[11] = 0;
4106
- result[12] = 0;
4107
- result[13] = 0;
4108
- result[14] = 0;
4696
+ const { rotation: rotation2, scale: scale6 } = affineComponents(this);
4697
+ result = result || new Array(16);
4698
+ if (scaleResult)
4699
+ for (let i = 0; i < 3; i++)
4700
+ scaleResult[i] = scale6[i];
4701
+ for (let i = 0; i < 16; i++)
4702
+ result[i] = 0;
4703
+ for (let i = 0; i < 9; i++)
4704
+ result[Math.floor(i / 3) * 4 + i % 3] = rotation2[i];
4109
4705
  result[15] = 1;
4110
4706
  return result;
4111
4707
  }
@@ -4116,21 +4712,13 @@
4116
4712
  * @returns self
4117
4713
  */
4118
4714
  getRotationMatrix3(result, scaleResult) {
4119
- result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
4120
- scaleResult = scaleResult || [-0, -0, -0];
4121
- const scale6 = this.getScale(scaleResult);
4122
- const inverseScale0 = 1 / scale6[0];
4123
- const inverseScale1 = 1 / scale6[1];
4124
- const inverseScale2 = 1 / scale6[2];
4125
- result[0] = this[0] * inverseScale0;
4126
- result[1] = this[1] * inverseScale1;
4127
- result[2] = this[2] * inverseScale2;
4128
- result[3] = this[4] * inverseScale0;
4129
- result[4] = this[5] * inverseScale1;
4130
- result[5] = this[6] * inverseScale2;
4131
- result[6] = this[8] * inverseScale0;
4132
- result[7] = this[9] * inverseScale1;
4133
- result[8] = this[10] * inverseScale2;
4715
+ const { rotation: rotation2, scale: scale6 } = affineComponents(this);
4716
+ result = result || new Array(9);
4717
+ if (scaleResult)
4718
+ for (let i = 0; i < 3; i++)
4719
+ scaleResult[i] = scale6[i];
4720
+ for (let i = 0; i < 9; i++)
4721
+ result[i] = rotation2[i];
4134
4722
  return result;
4135
4723
  }
4136
4724
  // Modifiers
@@ -4443,6 +5031,28 @@
4443
5031
  }
4444
5032
  return out;
4445
5033
  }
5034
+ function rotateTowards(out, a, b, step) {
5035
+ if (a.length !== 4 || b.length !== 4 || [...Array.from(a), ...Array.from(b), step].some((x) => !Number.isFinite(x))) {
5036
+ throw new RangeError("Expected finite quaternions and step");
5037
+ }
5038
+ if (a.length !== 4 || step < 0)
5039
+ throw new RangeError("Expected quaternions and a nonnegative step");
5040
+ const aScale = Math.max(...Array.from(a, Math.abs)), bScale = Math.max(...Array.from(b, Math.abs));
5041
+ if (!aScale || !bScale)
5042
+ throw new RangeError("Zero quaternion");
5043
+ const an = Array.from(a, (x) => x / aScale), bn = Array.from(b, (x) => x / bScale);
5044
+ const al = Math.hypot(...an), bl = Math.hypot(...bn);
5045
+ for (let i = 0; i < 4; i++) {
5046
+ an[i] /= al;
5047
+ bn[i] /= bl;
5048
+ }
5049
+ const dot5 = an.reduce((sum, x, i) => sum + x * bn[i], 0);
5050
+ const angle2 = 2 * Math.acos(Math.min(1, Math.abs(dot5)));
5051
+ if (out.length < 4)
5052
+ throw new RangeError("Result buffer is too short");
5053
+ slerp(out, an, bn, angle2 === 0 ? 0 : Math.min(1, step / angle2));
5054
+ return out;
5055
+ }
4446
5056
  var add2, scale4, dot3, lerp2, length3, squaredLength2, normalize3, rotationTo;
4447
5057
  var init_quat = __esm({
4448
5058
  "../../node_modules/@math.gl/core/dist/gl-matrix/quat.js"() {
@@ -4491,6 +5101,7 @@
4491
5101
  var Quaternion;
4492
5102
  var init_quaternion = __esm({
4493
5103
  "../../node_modules/@math.gl/core/dist/classes/quaternion.js"() {
5104
+ init_quat();
4494
5105
  init_math_array();
4495
5106
  init_validators();
4496
5107
  init_quat();
@@ -4564,6 +5175,9 @@
4564
5175
  return this.check();
4565
5176
  }
4566
5177
  /** Set a quat to the identity quaternion */
5178
+ rotateTowards(target, step) {
5179
+ return rotateTowards(this, this, target, step);
5180
+ }
4567
5181
  identity() {
4568
5182
  identity2(this);
4569
5183
  return this.check();
@@ -5040,7 +5654,7 @@
5040
5654
  });
5041
5655
 
5042
5656
  // ../../node_modules/@math.gl/core/dist/index.js
5043
- var init_dist = __esm({
5657
+ var init_dist2 = __esm({
5044
5658
  "../../node_modules/@math.gl/core/dist/index.js"() {
5045
5659
  init_vector3();
5046
5660
  init_matrix3();
@@ -5132,7 +5746,7 @@
5132
5746
  var scratchVector;
5133
5747
  var init_type_utils = __esm({
5134
5748
  "../../node_modules/@math.gl/geospatial/dist/type-utils.js"() {
5135
- init_dist();
5749
+ init_dist2();
5136
5750
  scratchVector = new Vector3();
5137
5751
  }
5138
5752
  });
@@ -5370,7 +5984,7 @@
5370
5984
  var surface;
5371
5985
  var init_scale_to_geodetic_surface = __esm({
5372
5986
  "../../node_modules/@math.gl/geospatial/dist/ellipsoid-helpers/scale-to-geodetic-surface.js"() {
5373
- init_dist();
5987
+ init_dist2();
5374
5988
  init_nearest_surface();
5375
5989
  surface = { x: 0, y: 0, z: 0 };
5376
5990
  }
@@ -5392,8 +6006,8 @@
5392
6006
  var spheroidScratch, scratchVector2, scratchNormal, scratchPosition, scratchCartesian, Ellipsoid;
5393
6007
  var init_ellipsoid = __esm({
5394
6008
  "../../node_modules/@math.gl/geospatial/dist/ellipsoid.js"() {
5395
- init_dist();
5396
- init_dist();
6009
+ init_dist2();
6010
+ init_dist2();
5397
6011
  init_constants();
5398
6012
  init_type_utils();
5399
6013
  init_scale_to_geodetic_surface();
@@ -7097,8 +7711,8 @@
7097
7711
  var EPSILON142, scratchOrigin, scratchBasis, VECTOR_PRODUCT_LOCAL_FRAME, degeneratePositionLocalFrame, scratchAxisVectors, scratchVector1, scratchVector22, scratchVector3;
7098
7712
  var init_ellipsoid_transform = __esm({
7099
7713
  "../../node_modules/@math.gl/geospatial/dist/ellipsoid-helpers/ellipsoid-transform.js"() {
7100
- init_dist();
7101
- init_dist();
7714
+ init_dist2();
7715
+ init_dist2();
7102
7716
  EPSILON142 = 1e-14;
7103
7717
  scratchOrigin = new Vector3();
7104
7718
  scratchBasis = createLocalFrameBasis();
@@ -7168,7 +7782,7 @@
7168
7782
  }
7169
7783
  var init_ellipsoid_transforms = __esm({
7170
7784
  "../../node_modules/@math.gl/geospatial/dist/ellipsoid-transforms.js"() {
7171
- init_dist();
7785
+ init_dist2();
7172
7786
  init_ellipsoid_transform();
7173
7787
  }
7174
7788
  });
@@ -7222,7 +7836,7 @@
7222
7836
  });
7223
7837
 
7224
7838
  // ../../node_modules/@math.gl/geometry/dist/index.js
7225
- var init_dist2 = __esm({
7839
+ var init_dist3 = __esm({
7226
7840
  "../../node_modules/@math.gl/geometry/dist/index.js"() {
7227
7841
  init_utils();
7228
7842
  }
@@ -8931,7 +9545,7 @@
8931
9545
  });
8932
9546
 
8933
9547
  // ../../node_modules/@math.gl/geospatial/dist/index.js
8934
- var init_dist3 = __esm({
9548
+ var init_dist4 = __esm({
8935
9549
  "../../node_modules/@math.gl/geospatial/dist/index.js"() {
8936
9550
  init_ellipsoid2();
8937
9551
  init_globe();
@@ -9161,7 +9775,7 @@
9161
9775
  var init_version2 = __esm({
9162
9776
  "../images/src/lib/utils/version.ts"() {
9163
9777
  "use strict";
9164
- VERSION2 = true ? "5.0.0-beta.2" : "latest";
9778
+ VERSION2 = true ? "5.0.0-beta.5" : "latest";
9165
9779
  }
9166
9780
  });
9167
9781
 
@@ -18837,11 +19451,11 @@ return true;`);
18837
19451
  this._offsets = new OffsetsBufferBuilder(opts.type);
18838
19452
  }
18839
19453
  setValue(index, value2) {
18840
- const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
18841
- const current = pending.get(index);
19454
+ const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
19455
+ const current = pending2.get(index);
18842
19456
  current && (this._pendingLength -= current.length);
18843
19457
  this._pendingLength += value2 instanceof MapRow ? value2[kKeys].length : value2.length;
18844
- pending.set(index, value2);
19458
+ pending2.set(index, value2);
18845
19459
  }
18846
19460
  setValid(index, isValid) {
18847
19461
  if (!super.setValid(index, isValid)) {
@@ -18864,12 +19478,12 @@ return true;`);
18864
19478
  return super.finish();
18865
19479
  }
18866
19480
  _flush() {
18867
- const pending = this._pending;
19481
+ const pending2 = this._pending;
18868
19482
  const pendingLength = this._pendingLength;
18869
19483
  this._pendingLength = 0;
18870
19484
  this._pending = void 0;
18871
- if (pending && pending.size > 0) {
18872
- this._flushPending(pending, pendingLength);
19485
+ if (pending2 && pending2.size > 0) {
19486
+ this._flushPending(pending2, pendingLength);
18873
19487
  }
18874
19488
  return this;
18875
19489
  }
@@ -21455,11 +22069,11 @@ return true;`);
21455
22069
  setValue(index, value2) {
21456
22070
  return super.setValue(index, toUint8Array(value2));
21457
22071
  }
21458
- _flushPending(pending, pendingLength) {
22072
+ _flushPending(pending2, pendingLength) {
21459
22073
  const offsets = this._offsets;
21460
22074
  const data = this._values.reserve(pendingLength).buffer;
21461
22075
  let offset2 = 0;
21462
- for (const [index, value2] of pending) {
22076
+ for (const [index, value2] of pending2) {
21463
22077
  if (value2 === void 0) {
21464
22078
  offsets.set(index, 0);
21465
22079
  } else {
@@ -21496,11 +22110,11 @@ return true;`);
21496
22110
  setValue(index, value2) {
21497
22111
  return super.setValue(index, toUint8Array(value2));
21498
22112
  }
21499
- _flushPending(pending, pendingLength) {
22113
+ _flushPending(pending2, pendingLength) {
21500
22114
  const offsets = this._offsets;
21501
22115
  const data = this._values.reserve(pendingLength).buffer;
21502
22116
  let offset2 = 0;
21503
- for (const [index, value2] of pending) {
22117
+ for (const [index, value2] of pending2) {
21504
22118
  if (value2 === void 0) {
21505
22119
  offsets.set(index, BigInt(0));
21506
22120
  } else {
@@ -21811,10 +22425,10 @@ return true;`);
21811
22425
  this.type = new List2(new Field2(name, child2.type, true));
21812
22426
  return this.numChildren - 1;
21813
22427
  }
21814
- _flushPending(pending) {
22428
+ _flushPending(pending2) {
21815
22429
  const offsets = this._offsets;
21816
22430
  const [child2] = this.children;
21817
- for (const [index, value2] of pending) {
22431
+ for (const [index, value2] of pending2) {
21818
22432
  if (typeof value2 === "undefined") {
21819
22433
  offsets.set(index, 0);
21820
22434
  } else {
@@ -21853,10 +22467,10 @@ return true;`);
21853
22467
  this.type = new LargeList2(new Field2(name, child2.type, true));
21854
22468
  return this.numChildren - 1;
21855
22469
  }
21856
- _flushPending(pending) {
22470
+ _flushPending(pending2) {
21857
22471
  const offsets = this._offsets;
21858
22472
  const [child2] = this.children;
21859
- for (const [index, value2] of pending) {
22473
+ for (const [index, value2] of pending2) {
21860
22474
  if (typeof value2 === "undefined") {
21861
22475
  offsets.set(index, BigInt(0));
21862
22476
  } else {
@@ -21886,11 +22500,11 @@ return true;`);
21886
22500
  }
21887
22501
  setValue(index, value2) {
21888
22502
  const row = value2 instanceof Map ? value2 : new Map(Object.entries(value2));
21889
- const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
21890
- const current = pending.get(index);
22503
+ const pending2 = this._pending || (this._pending = /* @__PURE__ */ new Map());
22504
+ const current = pending2.get(index);
21891
22505
  current && (this._pendingLength -= current.size);
21892
22506
  this._pendingLength += row.size;
21893
- pending.set(index, row);
22507
+ pending2.set(index, row);
21894
22508
  }
21895
22509
  addChild(child2, name = `${this.numChildren}`) {
21896
22510
  if (this.numChildren > 0) {
@@ -21900,10 +22514,10 @@ return true;`);
21900
22514
  this.type = new Map_(new Field2(name, child2.type, true), this.type.keysSorted);
21901
22515
  return this.numChildren - 1;
21902
22516
  }
21903
- _flushPending(pending) {
22517
+ _flushPending(pending2) {
21904
22518
  const offsets = this._offsets;
21905
22519
  const [child2] = this.children;
21906
- for (const [index, value2] of pending) {
22520
+ for (const [index, value2] of pending2) {
21907
22521
  if (value2 === void 0) {
21908
22522
  offsets.set(index, 0);
21909
22523
  } else {
@@ -22112,7 +22726,7 @@ return true;`);
22112
22726
  return super.setValue(index, encodeUtf8(value2));
22113
22727
  }
22114
22728
  // @ts-ignore
22115
- _flushPending(pending, pendingLength) {
22729
+ _flushPending(pending2, pendingLength) {
22116
22730
  }
22117
22731
  };
22118
22732
  Utf8Builder.prototype._flushPending = BinaryBuilder.prototype._flushPending;
@@ -22143,7 +22757,7 @@ return true;`);
22143
22757
  return super.setValue(index, encodeUtf8(value2));
22144
22758
  }
22145
22759
  // @ts-ignore
22146
- _flushPending(pending, pendingLength) {
22760
+ _flushPending(pending2, pendingLength) {
22147
22761
  }
22148
22762
  };
22149
22763
  LargeUtf8Builder.prototype._flushPending = LargeBinaryBuilder.prototype._flushPending;
@@ -26087,6 +26701,305 @@ return true;`);
26087
26701
  }
26088
26702
  });
26089
26703
 
26704
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js
26705
+ function getArrowVariadicBuffers(data) {
26706
+ return data.variadicBuffers ?? [];
26707
+ }
26708
+ function createArrowData(type, offset2, length4, nullCount, buffers, children2, dictionary, variadicBuffers) {
26709
+ return Reflect.construct(Data, [
26710
+ type,
26711
+ offset2,
26712
+ length4,
26713
+ nullCount,
26714
+ buffers,
26715
+ children2,
26716
+ dictionary,
26717
+ variadicBuffers
26718
+ ]);
26719
+ }
26720
+ var init_arrow_data = __esm({
26721
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-data.js"() {
26722
+ init_Arrow_dom();
26723
+ }
26724
+ });
26725
+
26726
+ // ../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js
26727
+ function splitArrowBuffers(input, options = {}) {
26728
+ const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
26729
+ if (isArrowTable2(input)) {
26730
+ return splitArrowTableBuffersInternal(input, context);
26731
+ }
26732
+ if (isArrowRecordBatch2(input)) {
26733
+ return splitArrowRecordBatchBuffers(input, context);
26734
+ }
26735
+ if (isArrowVector2(input)) {
26736
+ return splitArrowVectorBuffers(input, context);
26737
+ }
26738
+ return splitArrowDataBuffers(input, context);
26739
+ }
26740
+ function isArrowTable2(input) {
26741
+ return "batches" in input;
26742
+ }
26743
+ function isArrowRecordBatch2(input) {
26744
+ return "schema" in input && "data" in input && !Array.isArray(input.data);
26745
+ }
26746
+ function isArrowVector2(input) {
26747
+ return "data" in input && Array.isArray(input.data);
26748
+ }
26749
+ function splitArrowTableBuffersInternal(arrowTable, options) {
26750
+ const recordBatches = arrowTable.batches.map((recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options));
26751
+ return new Table(arrowTable.schema, recordBatches);
26752
+ }
26753
+ function splitArrowRecordBatchBuffers(recordBatch, options) {
26754
+ return new RecordBatch3(recordBatch.schema, splitArrowDataBuffers(recordBatch.data, options));
26755
+ }
26756
+ function splitArrowDataBuffers(data, options) {
26757
+ const children2 = data.children.map((childData) => splitArrowDataBuffers(childData, options));
26758
+ const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
26759
+ const buffers = {
26760
+ [BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
26761
+ [BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
26762
+ [BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
26763
+ [BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
26764
+ };
26765
+ return createArrowData(
26766
+ data.type,
26767
+ data.offset,
26768
+ data.length,
26769
+ // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
26770
+ data._nullCount,
26771
+ buffers,
26772
+ children2,
26773
+ dictionary,
26774
+ getArrowVariadicBuffers(data).map((buffer) => splitArrowBuffer(buffer, options))
26775
+ );
26776
+ }
26777
+ function splitArrowVectorBuffers(vector, options) {
26778
+ return new Vector2(vector.data.map((data) => splitArrowDataBuffers(data, options)));
26779
+ }
26780
+ function splitArrowBuffer(array2, options) {
26781
+ if (!isArrowTypedArray(array2)) {
26782
+ return array2;
26783
+ }
26784
+ if (options.copy === "none") {
26785
+ return array2;
26786
+ }
26787
+ if (options.copy !== "all" && array2.byteOffset === 0 && array2.byteLength === array2.buffer.byteLength) {
26788
+ return array2;
26789
+ }
26790
+ let copy2 = options.copies.get(array2);
26791
+ if (!copy2) {
26792
+ copy2 = array2 instanceof Uint8Array ? new Uint8Array(array2) : array2.slice();
26793
+ options.copies.set(array2, copy2);
26794
+ }
26795
+ return copy2;
26796
+ }
26797
+ function isArrowTypedArray(value2) {
26798
+ return ArrayBuffer.isView(value2) && !(value2 instanceof DataView);
26799
+ }
26800
+ var init_split_arrow_buffers = __esm({
26801
+ "../../node_modules/@math.gl/arrow/dist/arrow/split-arrow-buffers.js"() {
26802
+ init_Arrow_dom();
26803
+ init_arrow_data();
26804
+ }
26805
+ });
26806
+
26807
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js
26808
+ var init_indexed_arrow_vector = __esm({
26809
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-vector.js"() {
26810
+ }
26811
+ });
26812
+
26813
+ // ../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js
26814
+ var init_indexed_arrow_table = __esm({
26815
+ "../../node_modules/@math.gl/arrow/dist/arrow/indexed-arrow-table.js"() {
26816
+ }
26817
+ });
26818
+
26819
+ // ../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js
26820
+ var init_mapped_arrow_table = __esm({
26821
+ "../../node_modules/@math.gl/arrow/dist/arrow/mapped-arrow-table.js"() {
26822
+ }
26823
+ });
26824
+
26825
+ // ../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js
26826
+ var init_rename_arrow_columns = __esm({
26827
+ "../../node_modules/@math.gl/arrow/dist/arrow/rename-arrow-columns.js"() {
26828
+ }
26829
+ });
26830
+
26831
+ // ../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js
26832
+ function dehydrateArrowTable(arrowTable, options) {
26833
+ const splitTable = splitArrowBuffers(arrowTable, options);
26834
+ return {
26835
+ transport: "arrow-js",
26836
+ version: 1,
26837
+ schema: tableToIPC(new Table(splitTable.schema, [])),
26838
+ metadataVersion: splitTable.schema.metadataVersion,
26839
+ batches: splitTable.batches.map((batch) => dehydrateArrowData(batch.data))
26840
+ };
26841
+ }
26842
+ function hydrateArrowTable(table) {
26843
+ if (table.transport !== "arrow-js" || table.version !== 1) {
26844
+ throw new Error("Unsupported Arrow column-buffer transport protocol.");
26845
+ }
26846
+ const decodedSchema = tableFromIPC(table.schema).schema;
26847
+ const schema = new Schema2(decodedSchema.fields, decodedSchema.metadata, decodedSchema.dictionaries, table.metadataVersion);
26848
+ const type = new Struct(schema.fields);
26849
+ const batches = table.batches.map((data) => new RecordBatch3(schema, hydrateArrowData(data, type)));
26850
+ return new Table(schema, batches);
26851
+ }
26852
+ function dehydrateArrowData(data) {
26853
+ return {
26854
+ offset: data.offset,
26855
+ length: data.length,
26856
+ nullCount: data.nullCount,
26857
+ buffers: {
26858
+ [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
26859
+ [BufferType.DATA]: data.buffers[BufferType.DATA],
26860
+ [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
26861
+ [BufferType.TYPE]: data.buffers[BufferType.TYPE]
26862
+ },
26863
+ children: data.children.map((child2) => dehydrateArrowData(child2)),
26864
+ variadicBuffers: getArrowVariadicBuffers(data),
26865
+ dictionary: data.dictionary?.data.map((chunk) => dehydrateArrowData(chunk))
26866
+ };
26867
+ }
26868
+ function hydrateArrowData(data, type) {
26869
+ const children2 = data.children.map((child2, index) => hydrateArrowData(child2, type.children[index].type));
26870
+ const dictionary = data.dictionary && DataType.isDictionary(type) ? new Vector2(data.dictionary.map((chunk) => hydrateArrowData(chunk, type.dictionary))) : void 0;
26871
+ return createArrowData(type, data.offset, data.length, data.nullCount, data.buffers, children2, dictionary, data.variadicBuffers);
26872
+ }
26873
+ var init_arrow_table_transport = __esm({
26874
+ "../../node_modules/@math.gl/arrow/dist/arrow/arrow-table-transport.js"() {
26875
+ init_Arrow_dom();
26876
+ init_arrow_data();
26877
+ init_split_arrow_buffers();
26878
+ }
26879
+ });
26880
+
26881
+ // ../../node_modules/@math.gl/arrow/dist/arrow/index.js
26882
+ var init_arrow = __esm({
26883
+ "../../node_modules/@math.gl/arrow/dist/arrow/index.js"() {
26884
+ init_indexed_arrow_table();
26885
+ init_indexed_arrow_vector();
26886
+ init_mapped_arrow_table();
26887
+ init_rename_arrow_columns();
26888
+ init_split_arrow_buffers();
26889
+ init_arrow_table_transport();
26890
+ }
26891
+ });
26892
+
26893
+ // ../../node_modules/@math.gl/arrow/dist/index.js
26894
+ var init_dist5 = __esm({
26895
+ "../../node_modules/@math.gl/arrow/dist/index.js"() {
26896
+ init_arrow();
26897
+ }
26898
+ });
26899
+
26900
+ // ../core/src/arrow-worker-transport.ts
26901
+ function serializeArrowWorkerResult(result, options) {
26902
+ if (!isArrowTableWrapper(result)) {
26903
+ return result;
26904
+ }
26905
+ const workerOptions = options;
26906
+ const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
26907
+ return {
26908
+ ...result,
26909
+ data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
26910
+ };
26911
+ }
26912
+ function deserializeArrowWorkerResult(result) {
26913
+ if (!isDehydratedArrowTableWrapper(result)) {
26914
+ return result;
26915
+ }
26916
+ return { ...result, data: hydrateArrowTable(result.data) };
26917
+ }
26918
+ function isArrowTableWrapper(value2) {
26919
+ const table = value2;
26920
+ return Boolean(
26921
+ table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
26922
+ );
26923
+ }
26924
+ function isDehydratedArrowTableWrapper(value2) {
26925
+ const table = value2;
26926
+ return Boolean(
26927
+ table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
26928
+ );
26929
+ }
26930
+ var init_arrow_worker_transport = __esm({
26931
+ "../core/src/arrow-worker-transport.ts"() {
26932
+ "use strict";
26933
+ init_dist5();
26934
+ }
26935
+ });
26936
+
26937
+ // ../core/src/schema-utils/lib/schema/data-type.ts
26938
+ function getDataTypeFromValue(value2, defaultNumberType = "float32") {
26939
+ if (value2 instanceof Date) {
26940
+ return "date-millisecond";
26941
+ }
26942
+ if (typeof value2 === "number") {
26943
+ return defaultNumberType;
26944
+ }
26945
+ if (typeof value2 === "boolean") {
26946
+ return "bool";
26947
+ }
26948
+ if (typeof value2 === "string") {
26949
+ return "utf8";
26950
+ }
26951
+ if (value2 === null || value2 === "undefined") {
26952
+ return "null";
26953
+ }
26954
+ return "null";
26955
+ }
26956
+ function getDataTypeFromArray(array2) {
26957
+ let type = getDataTypeFromTypedArray(array2);
26958
+ if (type !== "null") {
26959
+ return { type, nullable: false };
26960
+ }
26961
+ if (array2.length > 0) {
26962
+ type = getDataTypeFromValue(array2[0]);
26963
+ return { type, nullable: true };
26964
+ }
26965
+ return { type: "null", nullable: true };
26966
+ }
26967
+ function getDataTypeFromTypedArray(array2) {
26968
+ if (typeof Float16Array !== "undefined" && array2 instanceof Float16Array) {
26969
+ return "float16";
26970
+ }
26971
+ switch (array2.constructor) {
26972
+ case Int8Array:
26973
+ return "int8";
26974
+ case Uint8Array:
26975
+ case Uint8ClampedArray:
26976
+ return "uint8";
26977
+ case Int16Array:
26978
+ return "int16";
26979
+ case Uint16Array:
26980
+ return "uint16";
26981
+ case Int32Array:
26982
+ return "int32";
26983
+ case Uint32Array:
26984
+ return "uint32";
26985
+ case BigInt64Array:
26986
+ return "int64";
26987
+ case BigUint64Array:
26988
+ return "uint64";
26989
+ case Float32Array:
26990
+ return "float32";
26991
+ case Float64Array:
26992
+ return "float64";
26993
+ default:
26994
+ return "null";
26995
+ }
26996
+ }
26997
+ var init_data_type = __esm({
26998
+ "../core/src/schema-utils/lib/schema/data-type.ts"() {
26999
+ "use strict";
27000
+ }
27001
+ });
27002
+
26090
27003
  // ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
26091
27004
  function serializeArrowSchema(arrowSchema) {
26092
27005
  return {
@@ -26094,12 +27007,6 @@ return true;`);
26094
27007
  metadata: serializeArrowMetadata(arrowSchema.metadata)
26095
27008
  };
26096
27009
  }
26097
- function deserializeArrowSchema(schema, options) {
26098
- return new Schema2(
26099
- schema.fields.map((field) => deserializeArrowField(field, options)),
26100
- deserializeArrowMetadata(schema.metadata)
26101
- );
26102
- }
26103
27010
  function serializeArrowMetadata(arrowMetadata) {
26104
27011
  return Object.fromEntries(arrowMetadata);
26105
27012
  }
@@ -26522,260 +27429,6 @@ return true;`);
26522
27429
  }
26523
27430
  });
26524
27431
 
26525
- // ../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts
26526
- function splitArrowBuffers(input, options = {}) {
26527
- const context = { ...options, copies: /* @__PURE__ */ new WeakMap() };
26528
- if (isArrowTable2(input)) {
26529
- return splitArrowTableBuffersInternal(input, context);
26530
- }
26531
- if (isArrowRecordBatch2(input)) {
26532
- return splitArrowRecordBatchBuffers(input, context);
26533
- }
26534
- if (isArrowVector2(input)) {
26535
- return splitArrowVectorBuffers(input, context);
26536
- }
26537
- return splitArrowDataBuffers(input, context);
26538
- }
26539
- function isArrowTable2(input) {
26540
- return "batches" in input;
26541
- }
26542
- function isArrowRecordBatch2(input) {
26543
- return "schema" in input && "data" in input && !Array.isArray(input.data);
26544
- }
26545
- function isArrowVector2(input) {
26546
- return "data" in input && Array.isArray(input.data);
26547
- }
26548
- function splitArrowTableBuffersInternal(table, options) {
26549
- const recordBatches = table.batches.map(
26550
- (recordBatch) => splitArrowRecordBatchBuffers(recordBatch, options)
26551
- );
26552
- return new Table(table.schema, recordBatches);
26553
- }
26554
- function splitArrowRecordBatchBuffers(recordBatch, options) {
26555
- return new RecordBatch3(
26556
- recordBatch.schema,
26557
- splitArrowDataBuffers(recordBatch.data, options)
26558
- );
26559
- }
26560
- function splitArrowDataBuffers(data, options) {
26561
- const children2 = data.children.map((childData) => splitArrowDataBuffers(childData, options));
26562
- const dictionary = data.dictionary ? splitArrowVectorBuffers(data.dictionary, options) : void 0;
26563
- const buffers = {
26564
- [BufferType.OFFSET]: splitArrowBuffer(data.buffers[BufferType.OFFSET], options),
26565
- [BufferType.DATA]: splitArrowBuffer(data.buffers[BufferType.DATA], options),
26566
- [BufferType.VALIDITY]: splitArrowBuffer(data.buffers[BufferType.VALIDITY], options),
26567
- [BufferType.TYPE]: splitArrowBuffer(data.buffers[BufferType.TYPE], options)
26568
- };
26569
- return new Data(
26570
- data.type,
26571
- data.offset,
26572
- data.length,
26573
- // @ts-expect-error _nullCount is protected. Reuse it to preserve lazy null-count state.
26574
- data._nullCount,
26575
- buffers,
26576
- children2,
26577
- dictionary
26578
- );
26579
- }
26580
- function splitArrowVectorBuffers(vector, options) {
26581
- return new Vector2(vector.data.map((data) => splitArrowDataBuffers(data, options)));
26582
- }
26583
- function splitArrowBuffer(array2, options) {
26584
- if (!isArrowTypedArray(array2)) {
26585
- return array2;
26586
- }
26587
- if (options.copy === "none") {
26588
- return array2;
26589
- }
26590
- if (options.copy !== "all" && array2.byteOffset === 0 && array2.byteLength === array2.buffer.byteLength) {
26591
- return array2;
26592
- }
26593
- let copy2 = options.copies.get(array2);
26594
- if (!copy2) {
26595
- copy2 = array2.slice();
26596
- options.copies.set(array2, copy2);
26597
- }
26598
- return copy2;
26599
- }
26600
- function isArrowTypedArray(value2) {
26601
- return ArrayBuffer.isView(value2) && !(value2 instanceof DataView);
26602
- }
26603
- var init_split_arrow_buffers = __esm({
26604
- "../core/src/schema-utils/lib/arrow/split-arrow-buffers.ts"() {
26605
- "use strict";
26606
- init_Arrow_dom();
26607
- }
26608
- });
26609
-
26610
- // ../core/src/schema-utils/lib/arrow/arrow-table-transport.ts
26611
- function dehydrateArrowTable(table, options) {
26612
- const splitTable = splitArrowBuffers(table, options);
26613
- return {
26614
- shape: "arrow-table",
26615
- transport: "arrow-js",
26616
- schema: serializeArrowSchema(splitTable.schema),
26617
- batches: splitTable.batches.map((recordBatch) => dehydrateArrowRecordBatch(recordBatch))
26618
- };
26619
- }
26620
- function hydrateArrowTable(table) {
26621
- const schema = deserializeArrowSchema(table.schema);
26622
- const recordBatches = table.batches.map(
26623
- (recordBatch) => new RecordBatch3(schema, hydrateArrowData(recordBatch.data))
26624
- );
26625
- return new Table(schema, recordBatches);
26626
- }
26627
- function serializeArrowWorkerResult(result, options) {
26628
- if (!isArrowTableWrapper(result)) {
26629
- return result;
26630
- }
26631
- const workerOptions = options;
26632
- const bufferCopyMode = workerOptions?.core?.workerTransferBufferCopy ?? workerOptions?.workerTransferBufferCopy;
26633
- return {
26634
- ...result,
26635
- data: dehydrateArrowTable(result.data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
26636
- };
26637
- }
26638
- function deserializeArrowWorkerResult(result) {
26639
- if (!isDehydratedArrowTableWrapper(result)) {
26640
- return result;
26641
- }
26642
- return { ...result, data: hydrateArrowTable(result.data) };
26643
- }
26644
- function isArrowTableWrapper(value2) {
26645
- const table = value2;
26646
- return Boolean(
26647
- table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
26648
- );
26649
- }
26650
- function isDehydratedArrowTableWrapper(value2) {
26651
- const table = value2;
26652
- return Boolean(
26653
- table && table.shape === "arrow-table" && table.data && table.data.transport === "arrow-js" && Array.isArray(table.data.batches)
26654
- );
26655
- }
26656
- function dehydrateArrowRecordBatch(recordBatch) {
26657
- return { data: dehydrateArrowData(recordBatch.data) };
26658
- }
26659
- function dehydrateArrowData(data) {
26660
- return {
26661
- type: serializeArrowType(data.type),
26662
- offset: data.offset,
26663
- length: data.length,
26664
- // @ts-expect-error _nullCount is protected. Preserve the Arrow lazy null-count state.
26665
- nullCount: data._nullCount,
26666
- buffers: {
26667
- [BufferType.OFFSET]: data.buffers[BufferType.OFFSET],
26668
- [BufferType.DATA]: data.buffers[BufferType.DATA],
26669
- [BufferType.VALIDITY]: data.buffers[BufferType.VALIDITY],
26670
- [BufferType.TYPE]: data.buffers[BufferType.TYPE]
26671
- },
26672
- children: data.children.map((childData) => dehydrateArrowData(childData)),
26673
- dictionary: data.dictionary ? dehydrateArrowVector(data.dictionary) : void 0
26674
- };
26675
- }
26676
- function dehydrateArrowVector(vector) {
26677
- return { data: vector.data.map((data) => dehydrateArrowData(data)) };
26678
- }
26679
- function hydrateArrowData(data) {
26680
- const children2 = data.children.map((childData) => hydrateArrowData(childData));
26681
- const dictionary = data.dictionary ? hydrateArrowVector(data.dictionary) : void 0;
26682
- return new Data(
26683
- deserializeArrowType(data.type),
26684
- data.offset,
26685
- data.length,
26686
- data.nullCount,
26687
- data.buffers,
26688
- children2,
26689
- dictionary
26690
- );
26691
- }
26692
- function hydrateArrowVector(vector) {
26693
- return new Vector2(vector.data.map((data) => hydrateArrowData(data)));
26694
- }
26695
- var init_arrow_table_transport = __esm({
26696
- "../core/src/schema-utils/lib/arrow/arrow-table-transport.ts"() {
26697
- "use strict";
26698
- init_Arrow_dom();
26699
- init_convert_arrow_schema();
26700
- init_split_arrow_buffers();
26701
- }
26702
- });
26703
-
26704
- // ../core/src/schema-utils/arrow-transport.ts
26705
- var init_arrow_transport = __esm({
26706
- "../core/src/schema-utils/arrow-transport.ts"() {
26707
- "use strict";
26708
- init_arrow_table_transport();
26709
- init_split_arrow_buffers();
26710
- }
26711
- });
26712
-
26713
- // ../core/src/schema-utils/lib/schema/data-type.ts
26714
- function getDataTypeFromValue(value2, defaultNumberType = "float32") {
26715
- if (value2 instanceof Date) {
26716
- return "date-millisecond";
26717
- }
26718
- if (typeof value2 === "number") {
26719
- return defaultNumberType;
26720
- }
26721
- if (typeof value2 === "boolean") {
26722
- return "bool";
26723
- }
26724
- if (typeof value2 === "string") {
26725
- return "utf8";
26726
- }
26727
- if (value2 === null || value2 === "undefined") {
26728
- return "null";
26729
- }
26730
- return "null";
26731
- }
26732
- function getDataTypeFromArray(array2) {
26733
- let type = getDataTypeFromTypedArray(array2);
26734
- if (type !== "null") {
26735
- return { type, nullable: false };
26736
- }
26737
- if (array2.length > 0) {
26738
- type = getDataTypeFromValue(array2[0]);
26739
- return { type, nullable: true };
26740
- }
26741
- return { type: "null", nullable: true };
26742
- }
26743
- function getDataTypeFromTypedArray(array2) {
26744
- if (typeof Float16Array !== "undefined" && array2 instanceof Float16Array) {
26745
- return "float16";
26746
- }
26747
- switch (array2.constructor) {
26748
- case Int8Array:
26749
- return "int8";
26750
- case Uint8Array:
26751
- case Uint8ClampedArray:
26752
- return "uint8";
26753
- case Int16Array:
26754
- return "int16";
26755
- case Uint16Array:
26756
- return "uint16";
26757
- case Int32Array:
26758
- return "int32";
26759
- case Uint32Array:
26760
- return "uint32";
26761
- case BigInt64Array:
26762
- return "int64";
26763
- case BigUint64Array:
26764
- return "uint64";
26765
- case Float32Array:
26766
- return "float32";
26767
- case Float64Array:
26768
- return "float64";
26769
- default:
26770
- return "null";
26771
- }
26772
- }
26773
- var init_data_type = __esm({
26774
- "../core/src/schema-utils/lib/schema/data-type.ts"() {
26775
- "use strict";
26776
- }
26777
- });
26778
-
26779
27432
  // ../core/src/schema-utils/lib/mesh/mesh-utils.ts
26780
27433
  function getMeshBoundingBox(attributes) {
26781
27434
  const positionAttribute = attributes?.POSITION;
@@ -26866,7 +27519,7 @@ return true;`);
26866
27519
  var init_float162 = __esm({
26867
27520
  "../core/src/schema/float16.ts"() {
26868
27521
  "use strict";
26869
- init_dist();
27522
+ init_dist2();
26870
27523
  }
26871
27524
  });
26872
27525
 
@@ -27183,7 +27836,7 @@ return true;`);
27183
27836
  var init_version3 = __esm({
27184
27837
  "../scene/src/draco/lib/utils/version.ts"() {
27185
27838
  "use strict";
27186
- VERSION3 = true ? "5.0.0-beta.2" : "latest";
27839
+ VERSION3 = true ? "5.0.0-beta.5" : "latest";
27187
27840
  }
27188
27841
  });
27189
27842
 
@@ -28262,7 +28915,7 @@ return true;`);
28262
28915
  var init_draco_loader_types = __esm({
28263
28916
  "../scene/src/draco/draco-loader-types.ts"() {
28264
28917
  "use strict";
28265
- init_arrow_transport();
28918
+ init_arrow_worker_transport();
28266
28919
  init_version3();
28267
28920
  init_draco_format();
28268
28921
  init_draco_loader_options();
@@ -29669,7 +30322,7 @@ return true;`);
29669
30322
  var ARC_SECOND, WGS84;
29670
30323
  var init_datum = __esm({
29671
30324
  "../../node_modules/@math.gl/geospatial/dist/projection/experimental/datum.js"() {
29672
- init_dist();
30325
+ init_dist2();
29673
30326
  ARC_SECOND = Math.PI / (180 * 3600);
29674
30327
  WGS84 = {
29675
30328
  ellipsoid: {
@@ -29743,6 +30396,59 @@ return true;`);
29743
30396
  }
29744
30397
  });
29745
30398
 
30399
+ // ../../node_modules/@math.gl/geospatial/dist/projection/experimental/transform-description.js
30400
+ function describeCRS(crs) {
30401
+ const ellipsoid = Object.freeze({ ...crs.ellipsoid });
30402
+ return Object.freeze({
30403
+ kind: crs.kind,
30404
+ projection: crs.projection,
30405
+ parameters: Object.freeze(Object.fromEntries(Object.entries(crs.parameters).map(([name, value2]) => [name, value2 ?? null]))),
30406
+ ellipsoid,
30407
+ datum: Object.freeze({
30408
+ ellipsoid: Object.freeze({ ...crs.datum.ellipsoid }),
30409
+ towgs84: crs.datum.towgs84 && Object.freeze([...crs.datum.towgs84]),
30410
+ grids: crs.datum.grids && Object.freeze(crs.datum.grids.map((reference) => Object.freeze({
30411
+ name: reference.name,
30412
+ optional: reference.optional,
30413
+ loaded: Boolean(reference.grid)
30414
+ })))
30415
+ }),
30416
+ angularUnit: crs.angularUnit,
30417
+ toMeter: crs.toMeter,
30418
+ verticalUnit: crs.verticalUnit,
30419
+ primeMeridian: crs.primeMeridian,
30420
+ axis: crs.axis,
30421
+ storedAxis: crs.storedAxis,
30422
+ longitudeWrap: crs.longitudeWrap,
30423
+ areaOfUse: crs.areaOfUse && Object.freeze([...crs.areaOfUse]),
30424
+ lossy: crs.lossy,
30425
+ algorithm: crs.algorithm && Object.freeze({ ...crs.algorithm })
30426
+ });
30427
+ }
30428
+ function describeTransform(source, target, forward33, inverse33) {
30429
+ const opaqueReasons = [];
30430
+ if (!source.algorithm)
30431
+ opaqueReasons.push("source-algorithm");
30432
+ if (!target.algorithm)
30433
+ opaqueReasons.push("target-algorithm");
30434
+ if (source.datum.grids || target.datum.grids || source.parameters["geoidgrids"] || target.parameters["geoidgrids"])
30435
+ opaqueReasons.push("grid-resource");
30436
+ return Object.freeze({
30437
+ version: 1,
30438
+ source,
30439
+ target,
30440
+ forward: forward33,
30441
+ inverse: inverse33,
30442
+ lossy: source.lossy || target.lossy,
30443
+ complete: opaqueReasons.length === 0,
30444
+ opaqueReasons: Object.freeze(opaqueReasons)
30445
+ });
30446
+ }
30447
+ var init_transform_description = __esm({
30448
+ "../../node_modules/@math.gl/geospatial/dist/projection/experimental/transform-description.js"() {
30449
+ }
30450
+ });
30451
+
29746
30452
  // ../../node_modules/@math.gl/geospatial/dist/projection/experimental/typescript-projection.js
29747
30453
  function requiredProjections(options) {
29748
30454
  const available = registry(options.projections || []);
@@ -29812,7 +30518,8 @@ return true;`);
29812
30518
  const verticalGrid = compileVerticalGrid(crs.parameters["geoidgrids"], options.verticalGrids);
29813
30519
  if (verticalGrid && (crs.kind === "geocentric" || crs.kind === "identity" || crs.lossy))
29814
30520
  unsupportedStage("Vertical grids require a non-lossy geographic or projected CRS");
29815
- return { ...crs, datum, implementation, verticalGrid };
30521
+ const algorithm = plugin ? plugin.semantics : { id: "@math.gl/geospatial/" + crs.kind, version: 1 };
30522
+ return { ...crs, datum, implementation, verticalGrid, algorithm };
29816
30523
  }
29817
30524
  function finite(point) {
29818
30525
  return Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z);
@@ -29855,9 +30562,51 @@ return true;`);
29855
30562
  if (from.kind === "projected" && to.kind === "geographic")
29856
30563
  flat = from.implementation?.createInverseFlat?.(context);
29857
30564
  }
30565
+ const requiresInputZ = Boolean(from.verticalGrid || to.verticalGrid) || from.kind === "geocentric" || /[ud]/.test(fromAxis.slice(0, 2)) || /[ud]/.test(toAxis.slice(0, 2));
30566
+ const stages = [];
30567
+ if (inputAxis)
30568
+ stages.push("input-axis");
30569
+ if (horizontalOnly)
30570
+ stages.push("discard-height");
30571
+ if (inputScale !== 1)
30572
+ stages.push("input-scale");
30573
+ if (source)
30574
+ stages.push("source-inverse");
30575
+ if (inputVerticalScale !== 1)
30576
+ stages.push("input-height-scale");
30577
+ stages.push("geographic-domain-check");
30578
+ if (fromPrime)
30579
+ stages.push("source-prime-meridian");
30580
+ if (from.verticalGrid)
30581
+ stages.push("source-vertical-grid");
30582
+ if (datum)
30583
+ stages.push("datum");
30584
+ if (to.verticalGrid)
30585
+ stages.push("target-vertical-grid");
30586
+ if (toPrime)
30587
+ stages.push("target-prime-meridian");
30588
+ if (longitudeWrap !== void 0)
30589
+ stages.push("longitude-wrap");
30590
+ if (target)
30591
+ stages.push("target-forward");
30592
+ if (outputScale !== 1)
30593
+ stages.push("output-scale");
30594
+ if (outputVerticalScale !== 1)
30595
+ stages.push("output-height-scale");
30596
+ if (horizontalOnly)
30597
+ stages.push("restore-height");
30598
+ if (outputAxis)
30599
+ stages.push("output-axis");
29858
30600
  return {
30601
+ description: Object.freeze({
30602
+ inputAxis: fromAxis,
30603
+ outputAxis: toAxis,
30604
+ requiresInputZ,
30605
+ geocentricOutput: to.kind === "geocentric",
30606
+ stages: Object.freeze(stages)
30607
+ }),
29859
30608
  flat,
29860
- requiresInputZ: Boolean(from.verticalGrid || to.verticalGrid) || from.kind === "geocentric" || /[ud]/.test(fromAxis.slice(0, 2)) || /[ud]/.test(toAxis.slice(0, 2)),
30609
+ requiresInputZ,
29861
30610
  geocentricOutput: to.kind === "geocentric",
29862
30611
  run(point) {
29863
30612
  if (!finite(point))
@@ -29971,6 +30720,7 @@ return true;`);
29971
30720
  init_parameters();
29972
30721
  init_geographic_rendering_profile();
29973
30722
  init_vertical_datum();
30723
+ init_transform_description();
29974
30724
  ProjectionTransform = class _ProjectionTransform {
29975
30725
  /** Resolve required descriptors once, then return an ordinary synchronous instance. */
29976
30726
  static async create(options = {}) {
@@ -29984,6 +30734,10 @@ return true;`);
29984
30734
  getTargetRenderingProfile(coverage) {
29985
30735
  return this.targetRenderingProfile && resolveRenderingProfile(this.targetRenderingProfile, coverage);
29986
30736
  }
30737
+ /** Deferred transforms expose metadata only once their implementations are prepared. */
30738
+ get description() {
30739
+ return this.deferred?.implementation?.description ?? this.resolvedDescription;
30740
+ }
29987
30741
  constructor(options = {}) {
29988
30742
  this.coordinateScratch = new ProjectionScratch();
29989
30743
  this.targetLongitudeOrigin = 0;
@@ -30009,6 +30763,7 @@ return true;`);
30009
30763
  unsupportedStage("Horizontal extraction cannot be combined with vertical grids");
30010
30764
  this.forwardTransform = compileTransform(from, to, Boolean(options.enforceAxis));
30011
30765
  this.inverseTransform = compileTransform(to, from, Boolean(options.enforceAxis));
30766
+ this.resolvedDescription = describeTransform(describeCRS(from), describeCRS(to), this.forwardTransform.description, this.inverseTransform.description);
30012
30767
  }
30013
30768
  this.project = this.project.bind(this);
30014
30769
  this.unproject = this.unproject.bind(this);
@@ -30520,6 +31275,7 @@ return true;`);
30520
31275
  init_rendering_bounds();
30521
31276
  mercator = {
30522
31277
  name: "merc",
31278
+ semantics: { id: "@math.gl/geospatial/merc", version: 1 },
30523
31279
  aliases: [
30524
31280
  "Mercator",
30525
31281
  "Popular Visualisation Pseudo Mercator",
@@ -30613,6 +31369,7 @@ return true;`);
30613
31369
  init_rendering_bounds();
30614
31370
  equidistantCylindrical = {
30615
31371
  name: "eqc",
31372
+ semantics: { id: "@math.gl/geospatial/eqc", version: 1 },
30616
31373
  aliases: ["Equirectangular", "Equidistant_Cylindrical", "Equidistant_Cylindrical_Spherical"],
30617
31374
  parameters: ["lon_0", "lat_0", "lat_ts", "x_0", "y_0"],
30618
31375
  create({ semiMajorAxis: a, parameters, primeMeridian: primeMeridian2 = 0 }) {
@@ -37897,8 +38654,8 @@ return true;`);
37897
38654
  var init_spatial_coordinate_transformer = __esm({
37898
38655
  "src/spatial/spatial-coordinate-transformer.ts"() {
37899
38656
  "use strict";
37900
- init_dist();
37901
- init_dist3();
38657
+ init_dist2();
38658
+ init_dist4();
37902
38659
  init_bulk();
37903
38660
  init_spatial_resource_registry();
37904
38661
  init_normalize_crs_identifier();
@@ -38292,8 +39049,8 @@ return true;`);
38292
39049
  var init_i3s_spatial_transformer = __esm({
38293
39050
  "src/spatial/i3s-spatial-transformer.ts"() {
38294
39051
  "use strict";
38295
- init_dist();
38296
- init_dist3();
39052
+ init_dist2();
39053
+ init_dist4();
38297
39054
  init_spatial_coordinate_transformer();
38298
39055
  init_spatial_types();
38299
39056
  init_i3s_elevation();
@@ -38932,7 +39689,7 @@ return true;`);
38932
39689
  var init_constants6 = __esm({
38933
39690
  "src/i3s/lib/parsers/constants.ts"() {
38934
39691
  "use strict";
38935
- init_dist2();
39692
+ init_dist3();
38936
39693
  GL_TYPE_MAP = {
38937
39694
  UInt8: GL.UNSIGNED_BYTE,
38938
39695
  UInt16: GL.UNSIGNED_SHORT,
@@ -39680,9 +40437,9 @@ return true;`);
39680
40437
  "src/i3s/lib/parsers/parse-i3s-tile-content.ts"() {
39681
40438
  "use strict";
39682
40439
  init_schema3();
39683
- init_dist();
39684
- init_dist3();
39685
- init_dist3();
40440
+ init_dist2();
40441
+ init_dist4();
40442
+ init_dist4();
39686
40443
  init_loader_utils();
39687
40444
  init_src();
39688
40445
  init_src2();
@@ -39772,7 +40529,7 @@ return true;`);
39772
40529
  "use strict";
39773
40530
  init_i3s_format();
39774
40531
  init_i3s_loader_options();
39775
- VERSION4 = true ? "5.0.0-beta.2" : "latest";
40532
+ VERSION4 = true ? "5.0.0-beta.5" : "latest";
39776
40533
  I3SContentLoader = {
39777
40534
  ...I3SContentFormat,
39778
40535
  dataType: null,