@loaders.gl/i3s 4.0.0-alpha.5 → 4.0.0-alpha.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 (169) hide show
  1. package/dist/arcgis-webscene-loader.d.ts +7 -0
  2. package/dist/arcgis-webscene-loader.d.ts.map +1 -0
  3. package/dist/arcgis-webscene-loader.js +28 -0
  4. package/dist/bundle.js +2 -2
  5. package/dist/dist.min.js +8804 -8547
  6. package/dist/es5/arcgis-webscene-loader.js +40 -0
  7. package/dist/es5/arcgis-webscene-loader.js.map +1 -0
  8. package/dist/es5/bundle.js +6 -0
  9. package/dist/es5/bundle.js.map +1 -0
  10. package/dist/es5/i3s-attribute-loader.js +195 -0
  11. package/dist/es5/i3s-attribute-loader.js.map +1 -0
  12. package/dist/es5/i3s-building-scene-layer-loader.js +46 -0
  13. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -0
  14. package/dist/es5/i3s-content-loader.js +57 -0
  15. package/dist/es5/i3s-content-loader.js.map +1 -0
  16. package/dist/es5/i3s-loader.js +193 -0
  17. package/dist/es5/i3s-loader.js.map +1 -0
  18. package/dist/es5/i3s-node-page-loader.js +39 -0
  19. package/dist/es5/i3s-node-page-loader.js.map +1 -0
  20. package/dist/es5/index.js +61 -0
  21. package/dist/es5/index.js.map +1 -0
  22. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +312 -0
  23. package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  24. package/dist/es5/lib/parsers/constants.js +72 -0
  25. package/dist/es5/lib/parsers/constants.js.map +1 -0
  26. package/dist/es5/lib/parsers/parse-arcgis-webscene.js +158 -0
  27. package/dist/es5/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  28. package/dist/es5/lib/parsers/parse-i3s-attribute.js +76 -0
  29. package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -0
  30. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js +65 -0
  31. package/dist/es5/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  32. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +510 -0
  33. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  34. package/dist/es5/lib/parsers/parse-i3s.js +116 -0
  35. package/dist/es5/lib/parsers/parse-i3s.js.map +1 -0
  36. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +17 -0
  37. package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  38. package/dist/es5/lib/utils/customizeColors.js +159 -0
  39. package/dist/es5/lib/utils/customizeColors.js.map +1 -0
  40. package/dist/es5/lib/utils/url-utils.js +33 -0
  41. package/dist/es5/lib/utils/url-utils.js.map +1 -0
  42. package/dist/es5/types.js +26 -0
  43. package/dist/es5/types.js.map +1 -0
  44. package/dist/es5/workers/i3s-content-nodejs-worker.js +7 -0
  45. package/dist/es5/workers/i3s-content-nodejs-worker.js.map +1 -0
  46. package/dist/es5/workers/i3s-content-worker.js +6 -0
  47. package/dist/es5/workers/i3s-content-worker.js.map +1 -0
  48. package/dist/esm/arcgis-webscene-loader.js +16 -0
  49. package/dist/esm/arcgis-webscene-loader.js.map +1 -0
  50. package/dist/esm/bundle.js +4 -0
  51. package/dist/esm/bundle.js.map +1 -0
  52. package/dist/esm/i3s-attribute-loader.js +119 -0
  53. package/dist/esm/i3s-attribute-loader.js.map +1 -0
  54. package/dist/esm/i3s-building-scene-layer-loader.js +19 -0
  55. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -0
  56. package/dist/esm/i3s-content-loader.js +31 -0
  57. package/dist/esm/i3s-content-loader.js.map +1 -0
  58. package/dist/esm/i3s-loader.js +87 -0
  59. package/dist/esm/i3s-loader.js.map +1 -0
  60. package/dist/esm/i3s-node-page-loader.js +15 -0
  61. package/dist/esm/i3s-node-page-loader.js.map +1 -0
  62. package/dist/esm/index.js +8 -0
  63. package/dist/esm/index.js.map +1 -0
  64. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js +198 -0
  65. package/dist/esm/lib/helpers/i3s-nodepages-tiles.js.map +1 -0
  66. package/dist/esm/lib/parsers/constants.js +57 -0
  67. package/dist/esm/lib/parsers/constants.js.map +1 -0
  68. package/dist/esm/lib/parsers/parse-arcgis-webscene.js +70 -0
  69. package/dist/esm/lib/parsers/parse-arcgis-webscene.js.map +1 -0
  70. package/dist/esm/lib/parsers/parse-i3s-attribute.js +60 -0
  71. package/dist/esm/lib/parsers/parse-i3s-attribute.js.map +1 -0
  72. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js +39 -0
  73. package/dist/esm/lib/parsers/parse-i3s-building-scene-layer.js.map +1 -0
  74. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +435 -0
  75. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -0
  76. package/dist/esm/lib/parsers/parse-i3s.js +83 -0
  77. package/dist/esm/lib/parsers/parse-i3s.js.map +1 -0
  78. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js +9 -0
  79. package/dist/esm/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -0
  80. package/dist/esm/lib/utils/customizeColors.js +92 -0
  81. package/dist/esm/lib/utils/customizeColors.js.map +1 -0
  82. package/dist/esm/lib/utils/url-utils.js +28 -0
  83. package/dist/esm/lib/utils/url-utils.js.map +1 -0
  84. package/dist/esm/types.js +18 -0
  85. package/dist/esm/types.js.map +1 -0
  86. package/dist/esm/workers/i3s-content-nodejs-worker.js +5 -0
  87. package/dist/esm/workers/i3s-content-nodejs-worker.js.map +1 -0
  88. package/dist/esm/workers/i3s-content-worker.js +4 -0
  89. package/dist/esm/workers/i3s-content-worker.js.map +1 -0
  90. package/dist/i3s-attribute-loader.d.ts +9 -2
  91. package/dist/i3s-attribute-loader.d.ts.map +1 -1
  92. package/dist/i3s-attribute-loader.js +155 -132
  93. package/dist/i3s-building-scene-layer-loader.js +23 -18
  94. package/dist/i3s-content-loader.d.ts.map +1 -1
  95. package/dist/i3s-content-loader.js +30 -22
  96. package/dist/i3s-content-nodejs-worker.js +198 -0
  97. package/dist/i3s-content-nodejs-worker.js.map +7 -0
  98. package/dist/i3s-content-worker.js +1119 -1100
  99. package/dist/i3s-loader.d.ts +5 -0
  100. package/dist/i3s-loader.d.ts.map +1 -1
  101. package/dist/i3s-loader.js +88 -83
  102. package/dist/i3s-node-page-loader.d.ts +3 -2
  103. package/dist/i3s-node-page-loader.d.ts.map +1 -1
  104. package/dist/i3s-node-page-loader.js +20 -20
  105. package/dist/index.d.ts +4 -2
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +19 -6
  108. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts +1 -0
  109. package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
  110. package/dist/lib/helpers/i3s-nodepages-tiles.js +231 -228
  111. package/dist/lib/parsers/constants.js +85 -63
  112. package/dist/lib/parsers/parse-arcgis-webscene.d.ts +7 -0
  113. package/dist/lib/parsers/parse-arcgis-webscene.d.ts.map +1 -0
  114. package/dist/lib/parsers/parse-arcgis-webscene.js +88 -0
  115. package/dist/lib/parsers/parse-i3s-attribute.d.ts +6 -4
  116. package/dist/lib/parsers/parse-i3s-attribute.d.ts.map +1 -1
  117. package/dist/lib/parsers/parse-i3s-attribute.js +87 -62
  118. package/dist/lib/parsers/parse-i3s-building-scene-layer.js +41 -40
  119. package/dist/lib/parsers/parse-i3s-tile-content.d.ts +2 -2
  120. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  121. package/dist/lib/parsers/parse-i3s-tile-content.js +454 -454
  122. package/dist/lib/parsers/parse-i3s.d.ts +1 -1
  123. package/dist/lib/parsers/parse-i3s.d.ts.map +1 -1
  124. package/dist/lib/parsers/parse-i3s.js +92 -88
  125. package/dist/lib/utils/convert-i3s-obb-to-mbs.js +19 -8
  126. package/dist/lib/utils/customizeColors.d.ts +14 -0
  127. package/dist/lib/utils/customizeColors.d.ts.map +1 -0
  128. package/dist/lib/utils/customizeColors.js +94 -0
  129. package/dist/lib/utils/url-utils.js +41 -28
  130. package/dist/types.d.ts +518 -97
  131. package/dist/types.d.ts.map +1 -1
  132. package/dist/types.js +18 -19
  133. package/dist/workers/i3s-content-nodejs-worker.d.ts +2 -0
  134. package/dist/workers/i3s-content-nodejs-worker.d.ts.map +1 -0
  135. package/dist/workers/i3s-content-nodejs-worker.js +6 -0
  136. package/dist/workers/i3s-content-worker.js +5 -4
  137. package/package.json +15 -15
  138. package/src/arcgis-webscene-loader.ts +31 -0
  139. package/src/i3s-attribute-loader.ts +9 -9
  140. package/src/i3s-content-loader.ts +19 -6
  141. package/src/i3s-loader.ts +22 -13
  142. package/src/i3s-node-page-loader.ts +6 -10
  143. package/src/index.ts +22 -5
  144. package/src/lib/helpers/i3s-nodepages-tiles.ts +14 -3
  145. package/src/lib/parsers/constants.ts +1 -1
  146. package/src/lib/parsers/parse-arcgis-webscene.ts +102 -0
  147. package/src/lib/parsers/parse-i3s-attribute.ts +21 -14
  148. package/src/lib/parsers/parse-i3s-tile-content.ts +99 -76
  149. package/src/lib/parsers/parse-i3s.ts +8 -3
  150. package/src/lib/utils/customizeColors.ts +134 -0
  151. package/src/types.ts +482 -33
  152. package/src/workers/i3s-content-nodejs-worker.ts +5 -0
  153. package/dist/bundle.js.map +0 -1
  154. package/dist/i3s-attribute-loader.js.map +0 -1
  155. package/dist/i3s-building-scene-layer-loader.js.map +0 -1
  156. package/dist/i3s-content-loader.js.map +0 -1
  157. package/dist/i3s-loader.js.map +0 -1
  158. package/dist/i3s-node-page-loader.js.map +0 -1
  159. package/dist/index.js.map +0 -1
  160. package/dist/lib/helpers/i3s-nodepages-tiles.js.map +0 -1
  161. package/dist/lib/parsers/constants.js.map +0 -1
  162. package/dist/lib/parsers/parse-i3s-attribute.js.map +0 -1
  163. package/dist/lib/parsers/parse-i3s-building-scene-layer.js.map +0 -1
  164. package/dist/lib/parsers/parse-i3s-tile-content.js.map +0 -1
  165. package/dist/lib/parsers/parse-i3s.js.map +0 -1
  166. package/dist/lib/utils/convert-i3s-obb-to-mbs.js.map +0 -1
  167. package/dist/lib/utils/url-utils.js.map +0 -1
  168. package/dist/types.js.map +0 -1
  169. package/dist/workers/i3s-content-worker.js.map +0 -1
@@ -14,16 +14,16 @@
14
14
  for (var name in all)
15
15
  __defProp(target, name, { get: all[name], enumerable: true });
16
16
  };
17
- var __reExport = (target, module2, desc) => {
18
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
19
- for (let key of __getOwnPropNames(module2))
17
+ var __reExport = (target, module, desc) => {
18
+ if (module && typeof module === "object" || typeof module === "function") {
19
+ for (let key of __getOwnPropNames(module))
20
20
  if (!__hasOwnProp.call(target, key) && key !== "default")
21
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
21
+ __defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
22
22
  }
23
23
  return target;
24
24
  };
25
- var __toModule = (module2) => {
26
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
25
+ var __toModule = (module) => {
26
+ return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
27
27
  };
28
28
 
29
29
  // (disabled):../worker-utils/src/lib/node/require-utils.node
@@ -55,7 +55,7 @@
55
55
  var nodeVersion = matches && parseFloat(matches[1]) || 0;
56
56
 
57
57
  // ../worker-utils/src/lib/env-utils/version.ts
58
- var VERSION = true ? "4.0.0-alpha.5" : DEFAULT_VERSION;
58
+ var VERSION = true ? "4.0.0-alpha.6" : DEFAULT_VERSION;
59
59
  if (false) {
60
60
  console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
61
61
  }
@@ -87,15 +87,15 @@
87
87
  // ../worker-utils/src/lib/worker-farm/worker-job.ts
88
88
  var WorkerJob = class {
89
89
  constructor(jobName, workerThread) {
90
- this.name = jobName;
91
- this.workerThread = workerThread;
92
90
  this.isRunning = true;
93
91
  this._resolve = () => {
94
92
  };
95
93
  this._reject = () => {
96
94
  };
97
- this.result = new Promise((resolve, reject) => {
98
- this._resolve = resolve;
95
+ this.name = jobName;
96
+ this.workerThread = workerThread;
97
+ this.result = new Promise((resolve2, reject) => {
98
+ this._resolve = resolve2;
99
99
  this._reject = reject;
100
100
  });
101
101
  }
@@ -118,6 +118,12 @@
118
118
  }
119
119
  };
120
120
 
121
+ // ../worker-utils/src/lib/node/worker_threads-browser.ts
122
+ var Worker2 = class {
123
+ terminate() {
124
+ }
125
+ };
126
+
121
127
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
122
128
  var workerURLCache = new Map();
123
129
  function getLoadableWorkerURL(props) {
@@ -205,10 +211,10 @@
205
211
  this.url = url;
206
212
  this.onMessage = NOOP;
207
213
  this.onError = (error) => console.log(error);
208
- this.worker = this._createBrowserWorker();
214
+ this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
209
215
  }
210
216
  static isSupported() {
211
- return typeof Worker !== "undefined";
217
+ return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
212
218
  }
213
219
  destroy() {
214
220
  this.onMessage = NOOP;
@@ -251,6 +257,27 @@
251
257
  worker.onmessageerror = (event) => console.error(event);
252
258
  return worker;
253
259
  }
260
+ _createNodeWorker() {
261
+ let worker;
262
+ if (this.url) {
263
+ const absolute = this.url.includes(":/") || this.url.startsWith("/");
264
+ const url = absolute ? this.url : `./${this.url}`;
265
+ worker = new Worker2(url, { eval: false });
266
+ } else if (this.source) {
267
+ worker = new Worker2(this.source, { eval: true });
268
+ } else {
269
+ throw new Error("no worker");
270
+ }
271
+ worker.on("message", (data) => {
272
+ this.onMessage(data);
273
+ });
274
+ worker.on("error", (error) => {
275
+ this.onError(error);
276
+ });
277
+ worker.on("exit", (code) => {
278
+ });
279
+ return worker;
280
+ }
254
281
  };
255
282
 
256
283
  // ../worker-utils/src/lib/worker-farm/worker-pool.ts
@@ -271,6 +298,9 @@
271
298
  this.url = props.url;
272
299
  this.setProps(props);
273
300
  }
301
+ static isSupported() {
302
+ return WorkerThread.isSupported();
303
+ }
274
304
  destroy() {
275
305
  this.idleQueue.forEach((worker) => worker.destroy());
276
306
  this.isDestroyed = true;
@@ -360,9 +390,9 @@
360
390
  var DEFAULT_PROPS = {
361
391
  maxConcurrency: 3,
362
392
  maxMobileConcurrency: 1,
393
+ reuseWorkers: true,
363
394
  onDebug: () => {
364
- },
365
- reuseWorkers: true
395
+ }
366
396
  };
367
397
  var WorkerFarm = class {
368
398
  constructor(props) {
@@ -383,6 +413,7 @@
383
413
  for (const workerPool of this.workerPools.values()) {
384
414
  workerPool.destroy();
385
415
  }
416
+ this.workerPools = new Map();
386
417
  }
387
418
  setProps(props) {
388
419
  this.props = { ...this.props, ...props };
@@ -415,16 +446,33 @@
415
446
  };
416
447
 
417
448
  // ../worker-utils/src/lib/worker-farm/worker-body.ts
449
+ function getParentPort() {
450
+ let parentPort;
451
+ try {
452
+ eval("globalThis.parentPort = require('worker_threads').parentPort");
453
+ parentPort = globalThis.parentPort;
454
+ } catch {
455
+ }
456
+ return parentPort;
457
+ }
418
458
  var onMessageWrapperMap = new Map();
419
459
  var WorkerBody = class {
460
+ static inWorkerThread() {
461
+ return typeof self !== "undefined" || Boolean(getParentPort());
462
+ }
420
463
  static set onmessage(onMessage2) {
421
- self.onmessage = (message) => {
422
- if (!isKnownMessage(message)) {
423
- return;
424
- }
425
- const { type, payload } = message.data;
464
+ function handleMessage(message) {
465
+ const parentPort3 = getParentPort();
466
+ const { type, payload } = parentPort3 ? message : message.data;
426
467
  onMessage2(type, payload);
427
- };
468
+ }
469
+ const parentPort2 = getParentPort();
470
+ if (parentPort2) {
471
+ parentPort2.on("message", handleMessage);
472
+ parentPort2.on("exit", () => console.debug("Node worker closing"));
473
+ } else {
474
+ globalThis.onmessage = handleMessage;
475
+ }
428
476
  }
429
477
  static addEventListener(onMessage2) {
430
478
  let onMessageWrapper = onMessageWrapperMap.get(onMessage2);
@@ -433,22 +481,36 @@
433
481
  if (!isKnownMessage(message)) {
434
482
  return;
435
483
  }
436
- const { type, payload } = message.data;
484
+ const parentPort3 = getParentPort();
485
+ const { type, payload } = parentPort3 ? message : message.data;
437
486
  onMessage2(type, payload);
438
487
  };
439
488
  }
440
- self.addEventListener("message", onMessageWrapper);
489
+ const parentPort2 = getParentPort();
490
+ if (parentPort2) {
491
+ console.error("not implemented");
492
+ } else {
493
+ globalThis.addEventListener("message", onMessageWrapper);
494
+ }
441
495
  }
442
496
  static removeEventListener(onMessage2) {
443
497
  const onMessageWrapper = onMessageWrapperMap.get(onMessage2);
444
498
  onMessageWrapperMap.delete(onMessage2);
445
- self.removeEventListener("message", onMessageWrapper);
499
+ const parentPort2 = getParentPort();
500
+ if (parentPort2) {
501
+ console.error("not implemented");
502
+ } else {
503
+ globalThis.removeEventListener("message", onMessageWrapper);
504
+ }
446
505
  }
447
506
  static postMessage(type, payload) {
448
- if (self) {
449
- const data = { source: "loaders.gl", type, payload };
450
- const transferList = getTransferList(payload);
451
- self.postMessage(data, transferList);
507
+ const data = { source: "loaders.gl", type, payload };
508
+ const transferList = getTransferList(payload);
509
+ const parentPort2 = getParentPort();
510
+ if (parentPort2) {
511
+ parentPort2.postMessage(data, transferList);
512
+ } else {
513
+ globalThis.postMessage(data, transferList);
452
514
  }
453
515
  }
454
516
  };
@@ -564,19 +626,20 @@
564
626
  // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
565
627
  var requestId = 0;
566
628
  function createLoaderWorker(loader) {
567
- if (typeof self === "undefined") {
629
+ if (!WorkerBody.inWorkerThread()) {
568
630
  return;
569
631
  }
570
632
  WorkerBody.onmessage = async (type, payload) => {
571
633
  switch (type) {
572
634
  case "process":
573
635
  try {
574
- const { input, options = {} } = payload;
636
+ const { input, options = {}, context = {} } = payload;
575
637
  const result = await parseData({
576
638
  loader,
577
639
  arrayBuffer: input,
578
640
  options,
579
641
  context: {
642
+ ...context,
580
643
  parse: parseOnMainThread
581
644
  }
582
645
  });
@@ -591,7 +654,7 @@
591
654
  };
592
655
  }
593
656
  function parseOnMainThread(arrayBuffer, options) {
594
- return new Promise((resolve, reject) => {
657
+ return new Promise((resolve2, reject) => {
595
658
  const id = requestId++;
596
659
  const onMessage2 = (type, payload2) => {
597
660
  if (payload2.id !== id) {
@@ -600,7 +663,7 @@
600
663
  switch (type) {
601
664
  case "done":
602
665
  WorkerBody.removeEventListener(onMessage2);
603
- resolve(payload2.result);
666
+ resolve2(payload2.result);
604
667
  break;
605
668
  case "error":
606
669
  WorkerBody.removeEventListener(onMessage2);
@@ -640,6 +703,9 @@
640
703
  if (!WorkerFarm.isSupported()) {
641
704
  return false;
642
705
  }
706
+ if (!isBrowser2 && !options?._nodeWorkers) {
707
+ return false;
708
+ }
643
709
  return loader.worker && options?.worker;
644
710
  }
645
711
  async function parseWithWorker(loader, data, options, context, parseOnMainThread2) {
@@ -648,10 +714,12 @@
648
714
  const workerFarm = WorkerFarm.getWorkerFarm(options);
649
715
  const workerPool = workerFarm.getWorkerPool({ name, url });
650
716
  options = JSON.parse(JSON.stringify(options));
717
+ context = JSON.parse(JSON.stringify(context || {}));
651
718
  const job = await workerPool.startJob("process-on-worker", onMessage.bind(null, parseOnMainThread2));
652
719
  job.postMessage("process", {
653
720
  input: data,
654
- options
721
+ options,
722
+ context
655
723
  });
656
724
  const result = await job.result;
657
725
  return await result.result;
@@ -679,42 +747,7 @@
679
747
  }
680
748
  }
681
749
 
682
- // ../loader-utils/src/lib/binary-utils/buffer-utils.ts
683
- function isBuffer(value) {
684
- return value && typeof value === "object" && value.isBuffer;
685
- }
686
- function bufferToArrayBuffer(buffer) {
687
- if (isBuffer(buffer)) {
688
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
689
- return typedArray.slice().buffer;
690
- }
691
- return buffer;
692
- }
693
-
694
750
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
695
- function toArrayBuffer(data) {
696
- if (isBuffer(data)) {
697
- return bufferToArrayBuffer(data);
698
- }
699
- if (data instanceof ArrayBuffer) {
700
- return data;
701
- }
702
- if (ArrayBuffer.isView(data)) {
703
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
704
- return data.buffer;
705
- }
706
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
707
- }
708
- if (typeof data === "string") {
709
- const text = data;
710
- const uint8Array = new TextEncoder().encode(text);
711
- return uint8Array.buffer;
712
- }
713
- if (data && typeof data === "object" && data._toArrayBuffer) {
714
- return data._toArrayBuffer();
715
- }
716
- throw new Error("toArrayBuffer");
717
- }
718
751
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
719
752
  byteLength = byteLength || arrayBuffer1.byteLength;
720
753
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -750,6 +783,52 @@
750
783
  return concatenateArrayBuffers(...arrayBuffers);
751
784
  }
752
785
 
786
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
787
+ function _typeof(obj) {
788
+ "@babel/helpers - typeof";
789
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
790
+ return typeof obj2;
791
+ } : function(obj2) {
792
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
793
+ }, _typeof(obj);
794
+ }
795
+
796
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
797
+ function _toPrimitive(input, hint) {
798
+ if (_typeof(input) !== "object" || input === null)
799
+ return input;
800
+ var prim = input[Symbol.toPrimitive];
801
+ if (prim !== void 0) {
802
+ var res = prim.call(input, hint || "default");
803
+ if (_typeof(res) !== "object")
804
+ return res;
805
+ throw new TypeError("@@toPrimitive must return a primitive value.");
806
+ }
807
+ return (hint === "string" ? String : Number)(input);
808
+ }
809
+
810
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
811
+ function _toPropertyKey(arg) {
812
+ var key = _toPrimitive(arg, "string");
813
+ return _typeof(key) === "symbol" ? key : String(key);
814
+ }
815
+
816
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
817
+ function _defineProperty(obj, key, value) {
818
+ key = _toPropertyKey(key);
819
+ if (key in obj) {
820
+ Object.defineProperty(obj, key, {
821
+ value,
822
+ enumerable: true,
823
+ configurable: true,
824
+ writable: true
825
+ });
826
+ } else {
827
+ obj[key] = value;
828
+ }
829
+ return obj;
830
+ }
831
+
753
832
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
754
833
  var pathPrefix = "";
755
834
  var fileAliases = {};
@@ -766,19 +845,64 @@
766
845
  return filename2;
767
846
  }
768
847
 
848
+ // ../loader-utils/src/lib/node/buffer.browser.ts
849
+ function toArrayBuffer(buffer) {
850
+ return buffer;
851
+ }
852
+
853
+ // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
854
+ function isBuffer(value) {
855
+ return value && typeof value === "object" && value.isBuffer;
856
+ }
857
+ function toArrayBuffer2(data) {
858
+ if (isBuffer(data)) {
859
+ return toArrayBuffer(data);
860
+ }
861
+ if (data instanceof ArrayBuffer) {
862
+ return data;
863
+ }
864
+ if (ArrayBuffer.isView(data)) {
865
+ if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
866
+ return data.buffer;
867
+ }
868
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
869
+ }
870
+ if (typeof data === "string") {
871
+ const text = data;
872
+ const uint8Array = new TextEncoder().encode(text);
873
+ return uint8Array.buffer;
874
+ }
875
+ if (data && typeof data === "object" && data._toArrayBuffer) {
876
+ return data._toArrayBuffer();
877
+ }
878
+ throw new Error("toArrayBuffer");
879
+ }
880
+
769
881
  // ../loader-utils/src/lib/path-utils/path.ts
770
882
  var path_exports = {};
771
883
  __export(path_exports, {
772
884
  dirname: () => dirname,
773
885
  filename: () => filename,
774
- join: () => join
886
+ join: () => join,
887
+ resolve: () => resolve
775
888
  });
889
+
890
+ // ../loader-utils/src/lib/path-utils/get-cwd.ts
891
+ function getCWD() {
892
+ if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
893
+ return process.cwd();
894
+ }
895
+ const pathname = window.location?.pathname;
896
+ return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
897
+ }
898
+
899
+ // ../loader-utils/src/lib/path-utils/path.ts
776
900
  function filename(url) {
777
- const slashIndex = url && url.lastIndexOf("/");
901
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
778
902
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
779
903
  }
780
904
  function dirname(url) {
781
- const slashIndex = url && url.lastIndexOf("/");
905
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
782
906
  return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
783
907
  }
784
908
  function join(...parts) {
@@ -794,6 +918,108 @@
794
918
  });
795
919
  return parts.join(separator);
796
920
  }
921
+ function resolve(...components) {
922
+ const paths = [];
923
+ for (let _i = 0; _i < components.length; _i++) {
924
+ paths[_i] = components[_i];
925
+ }
926
+ let resolvedPath = "";
927
+ let resolvedAbsolute = false;
928
+ let cwd;
929
+ for (let i2 = paths.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
930
+ let path;
931
+ if (i2 >= 0) {
932
+ path = paths[i2];
933
+ } else {
934
+ if (cwd === void 0) {
935
+ cwd = getCWD();
936
+ }
937
+ path = cwd;
938
+ }
939
+ if (path.length === 0) {
940
+ continue;
941
+ }
942
+ resolvedPath = `${path}/${resolvedPath}`;
943
+ resolvedAbsolute = path.charCodeAt(0) === SLASH;
944
+ }
945
+ resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
946
+ if (resolvedAbsolute) {
947
+ return `/${resolvedPath}`;
948
+ } else if (resolvedPath.length > 0) {
949
+ return resolvedPath;
950
+ }
951
+ return ".";
952
+ }
953
+ var SLASH = 47;
954
+ var DOT = 46;
955
+ function normalizeStringPosix(path, allowAboveRoot) {
956
+ let res = "";
957
+ let lastSlash = -1;
958
+ let dots = 0;
959
+ let code;
960
+ let isAboveRoot = false;
961
+ for (let i2 = 0; i2 <= path.length; ++i2) {
962
+ if (i2 < path.length) {
963
+ code = path.charCodeAt(i2);
964
+ } else if (code === SLASH) {
965
+ break;
966
+ } else {
967
+ code = SLASH;
968
+ }
969
+ if (code === SLASH) {
970
+ if (lastSlash === i2 - 1 || dots === 1) {
971
+ } else if (lastSlash !== i2 - 1 && dots === 2) {
972
+ if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
973
+ if (res.length > 2) {
974
+ const start = res.length - 1;
975
+ let j = start;
976
+ for (; j >= 0; --j) {
977
+ if (res.charCodeAt(j) === SLASH) {
978
+ break;
979
+ }
980
+ }
981
+ if (j !== start) {
982
+ res = j === -1 ? "" : res.slice(0, j);
983
+ lastSlash = i2;
984
+ dots = 0;
985
+ isAboveRoot = false;
986
+ continue;
987
+ }
988
+ } else if (res.length === 2 || res.length === 1) {
989
+ res = "";
990
+ lastSlash = i2;
991
+ dots = 0;
992
+ isAboveRoot = false;
993
+ continue;
994
+ }
995
+ }
996
+ if (allowAboveRoot) {
997
+ if (res.length > 0) {
998
+ res += "/..";
999
+ } else {
1000
+ res = "..";
1001
+ }
1002
+ isAboveRoot = true;
1003
+ }
1004
+ } else {
1005
+ const slice = path.slice(lastSlash + 1, i2);
1006
+ if (res.length > 0) {
1007
+ res += `/${slice}`;
1008
+ } else {
1009
+ res = slice;
1010
+ }
1011
+ isAboveRoot = false;
1012
+ }
1013
+ lastSlash = i2;
1014
+ dots = 0;
1015
+ } else if (code === DOT && dots !== -1) {
1016
+ ++dots;
1017
+ } else {
1018
+ dots = -1;
1019
+ }
1020
+ }
1021
+ return res;
1022
+ }
797
1023
 
798
1024
  // ../core/src/javascript-utils/is-type.ts
799
1025
  var isBoolean = (x) => typeof x === "boolean";
@@ -917,7 +1143,7 @@
917
1143
  text += ` ${await response.text()}`;
918
1144
  }
919
1145
  message += text;
920
- message = message.length > 60 ? `${message.slice(60)}...` : message;
1146
+ message = message.length > 60 ? `${message.slice(0, 60)}...` : message;
921
1147
  } catch (error) {
922
1148
  }
923
1149
  return message;
@@ -929,9 +1155,9 @@
929
1155
  }
930
1156
  if (resource instanceof Blob) {
931
1157
  const blobSlice = resource.slice(0, 5);
932
- return await new Promise((resolve) => {
1158
+ return await new Promise((resolve2) => {
933
1159
  const reader = new FileReader();
934
- reader.onload = (event) => resolve(event?.target?.result);
1160
+ reader.onload = (event) => resolve2(event?.target?.result);
935
1161
  reader.readAsDataURL(blobSlice);
936
1162
  });
937
1163
  }
@@ -964,12 +1190,12 @@
964
1190
  return await makeResponse(url);
965
1191
  }
966
1192
 
967
- // ../../node_modules/probe.gl/dist/esm/env/is-electron.js
1193
+ // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
968
1194
  function isElectron(mockUserAgent) {
969
1195
  if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
970
1196
  return true;
971
1197
  }
972
- if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
1198
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
973
1199
  return true;
974
1200
  }
975
1201
  const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
@@ -980,31 +1206,25 @@
980
1206
  return false;
981
1207
  }
982
1208
 
983
- // ../../node_modules/probe.gl/dist/esm/env/is-browser.js
1209
+ // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
984
1210
  function isBrowser3() {
985
1211
  const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
986
1212
  return !isNode || isElectron();
987
1213
  }
988
1214
 
989
- // ../../node_modules/probe.gl/dist/esm/env/globals.js
990
- var globals3 = {
991
- self: typeof self !== "undefined" && self,
992
- window: typeof window !== "undefined" && window,
993
- global: typeof global !== "undefined" && global,
994
- document: typeof document !== "undefined" && document,
995
- process: typeof process === "object" && process
996
- };
997
- var self_3 = globals3.self || globals3.window || globals3.global;
998
- var window_3 = globals3.window || globals3.self || globals3.global;
999
- var global_3 = globals3.global || globals3.self || globals3.window;
1000
- var document_3 = globals3.document || {};
1001
- var process_ = globals3.process || {};
1002
-
1003
- // ../../node_modules/probe.gl/dist/esm/utils/globals.js
1004
- var VERSION3 = true ? "4.0.0-alpha.5" : "untranspiled source";
1215
+ // ../../node_modules/@probe.gl/env/dist/lib/globals.js
1216
+ var self_3 = globalThis.self || globalThis.window || globalThis.global;
1217
+ var window_3 = globalThis.window || globalThis.self || globalThis.global;
1218
+ var document_3 = globalThis.document || {};
1219
+ var process_ = globalThis.process || {};
1220
+ var console_ = globalThis.console;
1221
+ var navigator_ = globalThis.navigator || {};
1222
+
1223
+ // ../../node_modules/@probe.gl/env/dist/utils/globals.js
1224
+ var VERSION3 = true ? "4.0.0-alpha.6" : "untranspiled source";
1005
1225
  var isBrowser4 = isBrowser3();
1006
1226
 
1007
- // ../../node_modules/probe.gl/dist/esm/utils/local-storage.js
1227
+ // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
1008
1228
  function getStorage(type) {
1009
1229
  try {
1010
1230
  const storage = window[type];
@@ -1017,27 +1237,25 @@
1017
1237
  }
1018
1238
  }
1019
1239
  var LocalStorage = class {
1020
- constructor(id, defaultSettings, type = "sessionStorage") {
1240
+ constructor(id, defaultConfig) {
1241
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
1242
+ _defineProperty(this, "storage", void 0);
1243
+ _defineProperty(this, "id", void 0);
1244
+ _defineProperty(this, "config", void 0);
1021
1245
  this.storage = getStorage(type);
1022
1246
  this.id = id;
1023
- this.config = {};
1024
- Object.assign(this.config, defaultSettings);
1247
+ this.config = defaultConfig;
1025
1248
  this._loadConfiguration();
1026
1249
  }
1027
1250
  getConfiguration() {
1028
1251
  return this.config;
1029
1252
  }
1030
1253
  setConfiguration(configuration) {
1031
- this.config = {};
1032
- return this.updateConfiguration(configuration);
1033
- }
1034
- updateConfiguration(configuration) {
1035
1254
  Object.assign(this.config, configuration);
1036
1255
  if (this.storage) {
1037
1256
  const serialized = JSON.stringify(this.config);
1038
1257
  this.storage.setItem(this.id, serialized);
1039
1258
  }
1040
- return this;
1041
1259
  }
1042
1260
  _loadConfiguration() {
1043
1261
  let configuration = {};
@@ -1050,7 +1268,7 @@
1050
1268
  }
1051
1269
  };
1052
1270
 
1053
- // ../../node_modules/probe.gl/dist/esm/utils/formatters.js
1271
+ // ../../node_modules/@probe.gl/log/dist/utils/formatters.js
1054
1272
  function formatTime(ms) {
1055
1273
  let formatted;
1056
1274
  if (ms < 10) {
@@ -1064,11 +1282,13 @@
1064
1282
  }
1065
1283
  return formatted;
1066
1284
  }
1067
- function leftPad(string, length2 = 8) {
1285
+ function leftPad(string) {
1286
+ let length2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
1068
1287
  const padLength = Math.max(length2 - string.length, 0);
1069
1288
  return "".concat(" ".repeat(padLength)).concat(string);
1070
1289
  }
1071
- function formatImage(image, message, scale2, maxWidth = 600) {
1290
+ function formatImage(image, message, scale2) {
1291
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
1072
1292
  const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
1073
1293
  if (image.width > maxWidth) {
1074
1294
  scale2 = Math.min(scale2, maxWidth / image.width);
@@ -1079,69 +1299,80 @@
1079
1299
  return ["".concat(message, " %c+"), style];
1080
1300
  }
1081
1301
 
1082
- // ../../node_modules/probe.gl/dist/esm/utils/color.js
1083
- var COLOR = {
1084
- BLACK: 30,
1085
- RED: 31,
1086
- GREEN: 32,
1087
- YELLOW: 33,
1088
- BLUE: 34,
1089
- MAGENTA: 35,
1090
- CYAN: 36,
1091
- WHITE: 37,
1092
- BRIGHT_BLACK: 90,
1093
- BRIGHT_RED: 91,
1094
- BRIGHT_GREEN: 92,
1095
- BRIGHT_YELLOW: 93,
1096
- BRIGHT_BLUE: 94,
1097
- BRIGHT_MAGENTA: 95,
1098
- BRIGHT_CYAN: 96,
1099
- BRIGHT_WHITE: 97
1100
- };
1302
+ // ../../node_modules/@probe.gl/log/dist/utils/color.js
1303
+ var COLOR;
1304
+ (function(COLOR2) {
1305
+ COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
1306
+ COLOR2[COLOR2["RED"] = 31] = "RED";
1307
+ COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
1308
+ COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
1309
+ COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
1310
+ COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
1311
+ COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
1312
+ COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
1313
+ COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
1314
+ COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
1315
+ COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
1316
+ COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
1317
+ COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
1318
+ COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
1319
+ COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
1320
+ COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
1321
+ })(COLOR || (COLOR = {}));
1322
+ var BACKGROUND_INCREMENT = 10;
1101
1323
  function getColor(color) {
1102
- return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
1324
+ if (typeof color !== "string") {
1325
+ return color;
1326
+ }
1327
+ color = color.toUpperCase();
1328
+ return COLOR[color] || COLOR.WHITE;
1103
1329
  }
1104
1330
  function addColor(string, color, background) {
1105
- if (!isBrowser4 && typeof string === "string") {
1331
+ if (!isBrowser3 && typeof string === "string") {
1106
1332
  if (color) {
1107
- color = getColor(color);
1108
- string = "[".concat(color, "m").concat(string, "");
1333
+ const colorCode = getColor(color);
1334
+ string = "[".concat(colorCode, "m").concat(string, "");
1109
1335
  }
1110
1336
  if (background) {
1111
- color = getColor(background);
1112
- string = "[".concat(background + 10, "m").concat(string, "");
1337
+ const colorCode = getColor(background);
1338
+ string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "");
1113
1339
  }
1114
1340
  }
1115
1341
  return string;
1116
1342
  }
1117
1343
 
1118
- // ../../node_modules/probe.gl/dist/esm/utils/autobind.js
1119
- function autobind(obj, predefined = ["constructor"]) {
1344
+ // ../../node_modules/@probe.gl/log/dist/utils/autobind.js
1345
+ function autobind(obj) {
1346
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
1120
1347
  const proto = Object.getPrototypeOf(obj);
1121
1348
  const propNames = Object.getOwnPropertyNames(proto);
1349
+ const object = obj;
1122
1350
  for (const key of propNames) {
1123
- if (typeof obj[key] === "function") {
1351
+ const value = object[key];
1352
+ if (typeof value === "function") {
1124
1353
  if (!predefined.find((name) => key === name)) {
1125
- obj[key] = obj[key].bind(obj);
1354
+ object[key] = value.bind(obj);
1126
1355
  }
1127
1356
  }
1128
1357
  }
1129
1358
  }
1130
1359
 
1131
- // ../../node_modules/probe.gl/dist/esm/utils/assert.js
1360
+ // ../../node_modules/@probe.gl/log/dist/utils/assert.js
1132
1361
  function assert3(condition, message) {
1133
1362
  if (!condition) {
1134
1363
  throw new Error(message || "Assertion failed");
1135
1364
  }
1136
1365
  }
1137
1366
 
1138
- // ../../node_modules/probe.gl/dist/esm/utils/hi-res-timestamp.js
1367
+ // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
1139
1368
  function getHiResTimestamp() {
1140
1369
  let timestamp;
1141
- if (isBrowser4 && window_3.performance) {
1142
- timestamp = window_3.performance.now();
1143
- } else if (process_.hrtime) {
1144
- const timeParts = process_.hrtime();
1370
+ if (isBrowser3() && window_3.performance) {
1371
+ var _window$performance, _window$performance$n;
1372
+ timestamp = window_3 === null || window_3 === void 0 ? void 0 : (_window$performance = window_3.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
1373
+ } else if ("hrtime" in process_) {
1374
+ var _process$hrtime;
1375
+ const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
1145
1376
  timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
1146
1377
  } else {
1147
1378
  timestamp = Date.now();
@@ -1149,15 +1380,15 @@
1149
1380
  return timestamp;
1150
1381
  }
1151
1382
 
1152
- // ../../node_modules/probe.gl/dist/esm/lib/log.js
1383
+ // ../../node_modules/@probe.gl/log/dist/log.js
1153
1384
  var originalConsole = {
1154
- debug: isBrowser4 ? console.debug || console.log : console.log,
1385
+ debug: isBrowser3() ? console.debug || console.log : console.log,
1155
1386
  log: console.log,
1156
1387
  info: console.info,
1157
1388
  warn: console.warn,
1158
1389
  error: console.error
1159
1390
  };
1160
- var DEFAULT_SETTINGS = {
1391
+ var DEFAULT_LOG_CONFIGURATION = {
1161
1392
  enabled: true,
1162
1393
  level: 0
1163
1394
  };
@@ -1167,27 +1398,23 @@
1167
1398
  var ONCE = {
1168
1399
  once: true
1169
1400
  };
1170
- function getTableHeader(table) {
1171
- for (const key in table) {
1172
- for (const title in table[key]) {
1173
- return title || "untitled";
1174
- }
1175
- }
1176
- return "empty";
1177
- }
1178
1401
  var Log = class {
1179
- constructor({
1180
- id
1181
- } = {
1182
- id: ""
1183
- }) {
1402
+ constructor() {
1403
+ let {
1404
+ id
1405
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
1406
+ id: ""
1407
+ };
1408
+ _defineProperty(this, "id", void 0);
1409
+ _defineProperty(this, "VERSION", VERSION3);
1410
+ _defineProperty(this, "_startTs", getHiResTimestamp());
1411
+ _defineProperty(this, "_deltaTs", getHiResTimestamp());
1412
+ _defineProperty(this, "_storage", void 0);
1413
+ _defineProperty(this, "userData", {});
1414
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
1184
1415
  this.id = id;
1185
- this.VERSION = VERSION3;
1186
- this._startTs = getHiResTimestamp();
1187
- this._deltaTs = getHiResTimestamp();
1188
- this.LOG_THROTTLE_TIMEOUT = 0;
1189
- this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
1190
1416
  this.userData = {};
1417
+ this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
1191
1418
  this.timeStamp("".concat(this.id, " started"));
1192
1419
  autobind(this);
1193
1420
  Object.seal(this);
@@ -1219,18 +1446,34 @@
1219
1446
  getPriority() {
1220
1447
  return this.level;
1221
1448
  }
1222
- enable(enabled = true) {
1223
- this._storage.updateConfiguration({
1449
+ enable() {
1450
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
1451
+ this._storage.setConfiguration({
1224
1452
  enabled
1225
1453
  });
1226
1454
  return this;
1227
1455
  }
1228
1456
  setLevel(level) {
1229
- this._storage.updateConfiguration({
1457
+ this._storage.setConfiguration({
1230
1458
  level
1231
1459
  });
1232
1460
  return this;
1233
1461
  }
1462
+ get(setting) {
1463
+ return this._storage.config[setting];
1464
+ }
1465
+ set(setting, value) {
1466
+ this._storage.setConfiguration({
1467
+ [setting]: value
1468
+ });
1469
+ }
1470
+ settings() {
1471
+ if (console.table) {
1472
+ console.table(this._storage.config);
1473
+ } else {
1474
+ console.log(this._storage.config);
1475
+ }
1476
+ }
1234
1477
  assert(condition, message) {
1235
1478
  assert3(condition, message);
1236
1479
  }
@@ -1269,17 +1512,18 @@
1269
1512
  }
1270
1513
  return noop;
1271
1514
  }
1272
- image({
1273
- logLevel,
1274
- priority,
1275
- image,
1276
- message = "",
1277
- scale: scale2 = 1
1278
- }) {
1515
+ image(_ref) {
1516
+ let {
1517
+ logLevel,
1518
+ priority,
1519
+ image,
1520
+ message = "",
1521
+ scale: scale2 = 1
1522
+ } = _ref;
1279
1523
  if (!this._shouldLog(logLevel || priority)) {
1280
1524
  return noop;
1281
1525
  }
1282
- return isBrowser4 ? logImageInBrowser({
1526
+ return isBrowser3() ? logImageInBrowser({
1283
1527
  image,
1284
1528
  message,
1285
1529
  scale: scale2
@@ -1289,21 +1533,6 @@
1289
1533
  scale: scale2
1290
1534
  });
1291
1535
  }
1292
- settings() {
1293
- if (console.table) {
1294
- console.table(this._storage.config);
1295
- } else {
1296
- console.log(this._storage.config);
1297
- }
1298
- }
1299
- get(setting) {
1300
- return this._storage.config[setting];
1301
- }
1302
- set(setting, value) {
1303
- this._storage.updateConfiguration({
1304
- [setting]: value
1305
- });
1306
- }
1307
1536
  time(logLevel, message) {
1308
1537
  return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
1309
1538
  }
@@ -1313,10 +1542,11 @@
1313
1542
  timeStamp(logLevel, message) {
1314
1543
  return this._getLogFunction(logLevel, message, console.timeStamp || noop);
1315
1544
  }
1316
- group(logLevel, message, opts = {
1317
- collapsed: false
1318
- }) {
1319
- opts = normalizeArguments({
1545
+ group(logLevel, message) {
1546
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
1547
+ collapsed: false
1548
+ };
1549
+ const options = normalizeArguments({
1320
1550
  logLevel,
1321
1551
  message,
1322
1552
  opts
@@ -1324,10 +1554,11 @@
1324
1554
  const {
1325
1555
  collapsed
1326
1556
  } = opts;
1327
- opts.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1328
- return this._getLogFunction(opts);
1557
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
1558
+ return this._getLogFunction(options);
1329
1559
  }
1330
- groupCollapsed(logLevel, message, opts = {}) {
1560
+ groupCollapsed(logLevel, message) {
1561
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1331
1562
  return this.group(logLevel, message, Object.assign({}, opts, {
1332
1563
  collapsed: true
1333
1564
  }));
@@ -1351,7 +1582,7 @@
1351
1582
  _shouldLog(logLevel) {
1352
1583
  return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
1353
1584
  }
1354
- _getLogFunction(logLevel, message, method, args = [], opts) {
1585
+ _getLogFunction(logLevel, message, method, args, opts) {
1355
1586
  if (this._shouldLog(logLevel)) {
1356
1587
  opts = normalizeArguments({
1357
1588
  logLevel,
@@ -1365,7 +1596,7 @@
1365
1596
  opts.delta = this.getDelta();
1366
1597
  this._deltaTs = getHiResTimestamp();
1367
1598
  const tag = opts.tag || opts.message;
1368
- if (opts.once) {
1599
+ if (opts.once && tag) {
1369
1600
  if (!cache[tag]) {
1370
1601
  cache[tag] = getHiResTimestamp();
1371
1602
  } else {
@@ -1378,7 +1609,7 @@
1378
1609
  return noop;
1379
1610
  }
1380
1611
  };
1381
- Log.VERSION = VERSION3;
1612
+ _defineProperty(Log, "VERSION", VERSION3);
1382
1613
  function normalizeLogLevel(logLevel) {
1383
1614
  if (!logLevel) {
1384
1615
  return 0;
@@ -1406,7 +1637,6 @@
1406
1637
  const args = opts.args ? Array.from(opts.args) : [];
1407
1638
  while (args.length && args.shift() !== message) {
1408
1639
  }
1409
- opts.args = args;
1410
1640
  switch (typeof logLevel) {
1411
1641
  case "string":
1412
1642
  case "function":
@@ -1425,7 +1655,9 @@
1425
1655
  }
1426
1656
  const messageType = typeof opts.message;
1427
1657
  assert3(messageType === "string" || messageType === "object");
1428
- return Object.assign(opts, opts.opts);
1658
+ return Object.assign(opts, {
1659
+ args
1660
+ }, opts.opts);
1429
1661
  }
1430
1662
  function decorateMessage(id, message, opts) {
1431
1663
  if (typeof message === "string") {
@@ -1435,29 +1667,21 @@
1435
1667
  }
1436
1668
  return message;
1437
1669
  }
1438
- function logImageInNode({
1439
- image,
1440
- message = "",
1441
- scale: scale2 = 1
1442
- }) {
1443
- let asciify = null;
1444
- try {
1445
- asciify = module.require("asciify-image");
1446
- } catch (error) {
1447
- }
1448
- if (asciify) {
1449
- return () => asciify(image, {
1450
- fit: "box",
1451
- width: "".concat(Math.round(80 * scale2), "%")
1452
- }).then((data) => console.log(data));
1453
- }
1670
+ function logImageInNode(_ref2) {
1671
+ let {
1672
+ image,
1673
+ message = "",
1674
+ scale: scale2 = 1
1675
+ } = _ref2;
1676
+ console.warn("removed");
1454
1677
  return noop;
1455
1678
  }
1456
- function logImageInBrowser({
1457
- image,
1458
- message = "",
1459
- scale: scale2 = 1
1460
- }) {
1679
+ function logImageInBrowser(_ref3) {
1680
+ let {
1681
+ image,
1682
+ message = "",
1683
+ scale: scale2 = 1
1684
+ } = _ref3;
1461
1685
  if (typeof image === "string") {
1462
1686
  const img = new Image();
1463
1687
  img.onload = () => {
@@ -1480,10 +1704,18 @@
1480
1704
  }
1481
1705
  return noop;
1482
1706
  }
1707
+ function getTableHeader(table) {
1708
+ for (const key in table) {
1709
+ for (const title in table[key]) {
1710
+ return title || "untitled";
1711
+ }
1712
+ }
1713
+ return "empty";
1714
+ }
1483
1715
 
1484
- // ../../node_modules/probe.gl/dist/esm/index.js
1485
- var esm_default = new Log({
1486
- id: "probe.gl"
1716
+ // ../../node_modules/@probe.gl/log/dist/index.js
1717
+ var dist_default = new Log({
1718
+ id: "@probe.gl/log"
1487
1719
  });
1488
1720
 
1489
1721
  // ../core/src/lib/loader-utils/loggers.ts
@@ -1534,7 +1766,8 @@
1534
1766
  worker: true,
1535
1767
  maxConcurrency: 3,
1536
1768
  maxMobileConcurrency: 1,
1537
- reuseWorkers: true,
1769
+ reuseWorkers: isBrowser,
1770
+ _nodeWorkers: false,
1538
1771
  _workerType: "",
1539
1772
  limit: 0,
1540
1773
  _limitMB: 0,
@@ -1579,20 +1812,6 @@
1579
1812
  validateOptions(options, loaders);
1580
1813
  return normalizeOptionsInternal(loader, options, url);
1581
1814
  }
1582
- function getFetchFunction(options, context) {
1583
- const globalOptions = getGlobalLoaderOptions();
1584
- const fetchOptions = options || globalOptions;
1585
- if (typeof fetchOptions.fetch === "function") {
1586
- return fetchOptions.fetch;
1587
- }
1588
- if (isObject(fetchOptions.fetch)) {
1589
- return (url) => fetchFile(url, fetchOptions);
1590
- }
1591
- if (context?.fetch) {
1592
- return context?.fetch;
1593
- }
1594
- return fetchFile;
1595
- }
1596
1815
  function validateOptions(options, loaders) {
1597
1816
  validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
1598
1817
  for (const loader of loaders) {
@@ -1710,6 +1929,9 @@
1710
1929
  return getGlobalLoaderRegistry();
1711
1930
  }
1712
1931
 
1932
+ // ../core/src/lib/utils/log.ts
1933
+ var log = new Log({ id: "loaders.gl" });
1934
+
1713
1935
  // ../core/src/lib/api/select-loader.ts
1714
1936
  var EXT_PATTERN = /\.([^.]+)$/;
1715
1937
  async function selectLoader(data, loaders = [], options, context) {
@@ -1754,13 +1976,22 @@
1754
1976
  const { url, type } = getResourceUrlAndType(data);
1755
1977
  const testUrl = url || context?.url;
1756
1978
  let loader = null;
1979
+ let reason = "";
1757
1980
  if (options?.mimeType) {
1758
1981
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
1982
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
1759
1983
  }
1760
1984
  loader = loader || findLoaderByUrl(loaders, testUrl);
1985
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
1761
1986
  loader = loader || findLoaderByMIMEType(loaders, type);
1987
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
1762
1988
  loader = loader || findLoaderByInitialBytes(loaders, data);
1989
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
1763
1990
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
1991
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
1992
+ if (reason) {
1993
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
1994
+ }
1764
1995
  return loader;
1765
1996
  }
1766
1997
  function validHTTPResponse(data) {
@@ -1943,7 +2174,7 @@
1943
2174
  if (done) {
1944
2175
  return;
1945
2176
  }
1946
- yield toArrayBuffer(value);
2177
+ yield toArrayBuffer2(value);
1947
2178
  }
1948
2179
  } catch (error) {
1949
2180
  reader.releaseLock();
@@ -1951,7 +2182,7 @@
1951
2182
  }
1952
2183
  async function* makeNodeStreamIterator(stream, options) {
1953
2184
  for await (const chunk of stream) {
1954
- yield toArrayBuffer(chunk);
2185
+ yield toArrayBuffer2(chunk);
1955
2186
  }
1956
2187
  }
1957
2188
 
@@ -2029,6 +2260,22 @@
2029
2260
  throw new Error(ERR_DATA);
2030
2261
  }
2031
2262
 
2263
+ // ../core/src/lib/loader-utils/get-fetch-function.ts
2264
+ function getFetchFunction(options, context) {
2265
+ const globalOptions = getGlobalLoaderOptions();
2266
+ const fetchOptions = options || globalOptions;
2267
+ if (typeof fetchOptions.fetch === "function") {
2268
+ return fetchOptions.fetch;
2269
+ }
2270
+ if (isObject(fetchOptions.fetch)) {
2271
+ return (url) => fetchFile(url, fetchOptions);
2272
+ }
2273
+ if (context?.fetch) {
2274
+ return context?.fetch;
2275
+ }
2276
+ return fetchFile;
2277
+ }
2278
+
2032
2279
  // ../core/src/lib/loader-utils/loader-context.ts
2033
2280
  function getLoaderContext(context, options, previousContext = null) {
2034
2281
  if (previousContext) {
@@ -2081,6 +2328,12 @@
2081
2328
  }
2082
2329
  async function parseWithLoader(loader, data, options, context) {
2083
2330
  validateWorkerVersion(loader);
2331
+ if (isResponse(data)) {
2332
+ const response = data;
2333
+ const { ok, redirected, status, statusText, type, url } = response;
2334
+ const headers = Object.fromEntries(response.headers.entries());
2335
+ context.response = { headers, ok, redirected, status, statusText, type, url };
2336
+ }
2084
2337
  data = await getArrayBufferOrStringFromData(data, loader, options);
2085
2338
  if (loader.parseTextSync && typeof data === "string") {
2086
2339
  options.dataType = "text";
@@ -2101,12 +2354,17 @@
2101
2354
 
2102
2355
  // ../core/src/lib/api/load.ts
2103
2356
  async function load(url, loaders, options, context) {
2357
+ let resolvedLoaders;
2358
+ let resolvedOptions;
2104
2359
  if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
2360
+ resolvedLoaders = [];
2361
+ resolvedOptions = loaders;
2105
2362
  context = void 0;
2106
- options = loaders;
2107
- loaders = void 0;
2363
+ } else {
2364
+ resolvedLoaders = loaders;
2365
+ resolvedOptions = options;
2108
2366
  }
2109
- const fetch2 = getFetchFunction(options);
2367
+ const fetch2 = getFetchFunction(resolvedOptions);
2110
2368
  let data = url;
2111
2369
  if (typeof url === "string") {
2112
2370
  data = await fetch2(url);
@@ -2114,7 +2372,7 @@
2114
2372
  if (isBlob(url)) {
2115
2373
  data = await fetch2(url);
2116
2374
  }
2117
- return await parse(data, loaders, options);
2375
+ return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
2118
2376
  }
2119
2377
 
2120
2378
  // ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
@@ -2127,18 +2385,16 @@
2127
2385
  // ../../node_modules/@math.gl/core/dist/esm/lib/common.js
2128
2386
  var RADIANS_TO_DEGREES = 1 / Math.PI * 180;
2129
2387
  var DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
2130
- var config = {};
2131
- config.EPSILON = 1e-12;
2132
- config.debug = false;
2133
- config.precision = 4;
2134
- config.printTypes = false;
2135
- config.printDegrees = false;
2136
- config.printRowMajor = true;
2137
- function round(value) {
2138
- return Math.round(value / config.EPSILON) * config.EPSILON;
2139
- }
2388
+ var config = {
2389
+ EPSILON: 1e-12,
2390
+ debug: false,
2391
+ precision: 4,
2392
+ printTypes: false,
2393
+ printDegrees: false,
2394
+ printRowMajor: true
2395
+ };
2140
2396
  function formatValue(value, {
2141
- precision = config.precision || 4
2397
+ precision = config.precision
2142
2398
  } = {}) {
2143
2399
  value = round(value);
2144
2400
  return "".concat(parseFloat(value.toPrecision(precision)));
@@ -2146,19 +2402,6 @@
2146
2402
  function isArray(value) {
2147
2403
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
2148
2404
  }
2149
- function duplicateArray(array) {
2150
- return array.clone ? array.clone() : new Array(array.length);
2151
- }
2152
- function map(value, func, result) {
2153
- if (isArray(value)) {
2154
- result = result || duplicateArray(value);
2155
- for (let i2 = 0; i2 < result.length && i2 < value.length; ++i2) {
2156
- result[i2] = func(value[i2], i2, result);
2157
- }
2158
- return result;
2159
- }
2160
- return func(value);
2161
- }
2162
2405
  function toRadians(degrees2) {
2163
2406
  return radians(degrees2);
2164
2407
  }
@@ -2197,7 +2440,7 @@
2197
2440
  if (b && b.equals) {
2198
2441
  return b.equals(a2);
2199
2442
  }
2200
- if (Number.isFinite(a2) && Number.isFinite(b)) {
2443
+ if (typeof a2 === "number" && typeof b === "number") {
2201
2444
  return Math.abs(a2 - b) <= config.EPSILON * Math.max(1, Math.abs(a2), Math.abs(b));
2202
2445
  }
2203
2446
  return false;
@@ -2205,6 +2448,23 @@
2205
2448
  config.EPSILON = oldEpsilon;
2206
2449
  }
2207
2450
  }
2451
+ function round(value) {
2452
+ return Math.round(value / config.EPSILON) * config.EPSILON;
2453
+ }
2454
+ function duplicateArray(array) {
2455
+ return array.clone ? array.clone() : new Array(array.length);
2456
+ }
2457
+ function map(value, func, result) {
2458
+ if (isArray(value)) {
2459
+ const array = value;
2460
+ result = result || duplicateArray(array);
2461
+ for (let i2 = 0; i2 < result.length && i2 < array.length; ++i2) {
2462
+ result[i2] = func(value[i2], i2, result);
2463
+ }
2464
+ return result;
2465
+ }
2466
+ return func(value);
2467
+ }
2208
2468
 
2209
2469
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js
2210
2470
  function _extendableBuiltin(cls) {
@@ -2229,22 +2489,24 @@
2229
2489
  return ExtendableBuiltin;
2230
2490
  }
2231
2491
  var MathArray = class extends _extendableBuiltin(Array) {
2232
- get ELEMENTS() {
2233
- assert4(false);
2234
- return 0;
2235
- }
2236
2492
  clone() {
2237
2493
  return new this.constructor().copy(this);
2238
2494
  }
2239
- from(arrayOrObject) {
2240
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
2241
- }
2242
2495
  fromArray(array, offset = 0) {
2243
2496
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2244
2497
  this[i2] = array[i2 + offset];
2245
2498
  }
2246
2499
  return this.check();
2247
2500
  }
2501
+ toArray(targetArray = [], offset = 0) {
2502
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2503
+ targetArray[offset + i2] = this[i2];
2504
+ }
2505
+ return targetArray;
2506
+ }
2507
+ from(arrayOrObject) {
2508
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
2509
+ }
2248
2510
  to(arrayOrObject) {
2249
2511
  if (arrayOrObject === this) {
2250
2512
  return this;
@@ -2254,12 +2516,6 @@
2254
2516
  toTarget(target) {
2255
2517
  return target ? this.to(target) : this;
2256
2518
  }
2257
- toArray(array = [], offset = 0) {
2258
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2259
- array[offset + i2] = this[i2];
2260
- }
2261
- return array;
2262
- }
2263
2519
  toFloat32Array() {
2264
2520
  return new Float32Array(this);
2265
2521
  }
@@ -2303,9 +2559,7 @@
2303
2559
  }
2304
2560
  lerp(a2, b, t2) {
2305
2561
  if (t2 === void 0) {
2306
- t2 = b;
2307
- b = a2;
2308
- a2 = this;
2562
+ return this.lerp(this, a2, b);
2309
2563
  }
2310
2564
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2311
2565
  const ai = a2[i2];
@@ -2348,14 +2602,36 @@
2348
2602
  return this.check();
2349
2603
  }
2350
2604
  scale(scale2) {
2351
- if (Array.isArray(scale2)) {
2352
- return this.multiply(scale2);
2605
+ if (typeof scale2 === "number") {
2606
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2607
+ this[i2] *= scale2;
2608
+ }
2609
+ } else {
2610
+ for (let i2 = 0; i2 < this.ELEMENTS && i2 < scale2.length; ++i2) {
2611
+ this[i2] *= scale2[i2];
2612
+ }
2353
2613
  }
2614
+ return this.check();
2615
+ }
2616
+ multiplyByScalar(scalar) {
2354
2617
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2355
- this[i2] *= scale2;
2618
+ this[i2] *= scalar;
2356
2619
  }
2357
2620
  return this.check();
2358
2621
  }
2622
+ check() {
2623
+ if (config.debug && !this.validate()) {
2624
+ throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
2625
+ }
2626
+ return this;
2627
+ }
2628
+ validate() {
2629
+ let valid = this.length === this.ELEMENTS;
2630
+ for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2631
+ valid = valid && Number.isFinite(this[i2]);
2632
+ }
2633
+ return valid;
2634
+ }
2359
2635
  sub(a2) {
2360
2636
  return this.subtract(a2);
2361
2637
  }
@@ -2381,7 +2657,7 @@
2381
2657
  return this.check();
2382
2658
  }
2383
2659
  divideScalar(a2) {
2384
- return this.scale(1 / a2);
2660
+ return this.multiplyByScalar(1 / a2);
2385
2661
  }
2386
2662
  clampScalar(min, max) {
2387
2663
  for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
@@ -2389,25 +2665,9 @@
2389
2665
  }
2390
2666
  return this.check();
2391
2667
  }
2392
- multiplyByScalar(scalar) {
2393
- return this.scale(scalar);
2394
- }
2395
2668
  get elements() {
2396
2669
  return this;
2397
2670
  }
2398
- check() {
2399
- if (config.debug && !this.validate()) {
2400
- throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
2401
- }
2402
- return this;
2403
- }
2404
- validate() {
2405
- let valid = this.length === this.ELEMENTS;
2406
- for (let i2 = 0; i2 < this.ELEMENTS; ++i2) {
2407
- valid = valid && Number.isFinite(this[i2]);
2408
- }
2409
- return valid;
2410
- }
2411
2671
  };
2412
2672
 
2413
2673
  // ../../node_modules/@math.gl/core/dist/esm/lib/validators.js
@@ -2434,24 +2694,9 @@
2434
2694
  }
2435
2695
  return v;
2436
2696
  }
2437
- var map2 = {};
2438
- function deprecated(method, version) {
2439
- if (!map2[method]) {
2440
- map2[method] = true;
2441
- console.warn("".concat(method, " has been removed in version ").concat(version, ", see upgrade guide for more information"));
2442
- }
2443
- }
2444
2697
 
2445
2698
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js
2446
2699
  var Vector = class extends MathArray {
2447
- get ELEMENTS() {
2448
- assert4(false);
2449
- return 0;
2450
- }
2451
- copy(vector) {
2452
- assert4(false);
2453
- return this;
2454
- }
2455
2700
  get x() {
2456
2701
  return this[0];
2457
2702
  }
@@ -2771,10 +3016,14 @@
2771
3016
 
2772
3017
  // ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
2773
3018
  var ORIGIN = [0, 0, 0];
2774
- var constants = {};
3019
+ var ZERO;
2775
3020
  var Vector3 = class extends Vector {
2776
3021
  static get ZERO() {
2777
- return constants.ZERO = constants.ZERO || Object.freeze(new Vector3(0, 0, 0, 0));
3022
+ if (!ZERO) {
3023
+ ZERO = new Vector3(0, 0, 0);
3024
+ Object.freeze(ZERO);
3025
+ }
3026
+ return ZERO;
2778
3027
  }
2779
3028
  constructor(x = 0, y = 0, z = 0) {
2780
3029
  super(-0, -0, -0);
@@ -2884,14 +3133,6 @@
2884
3133
 
2885
3134
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
2886
3135
  var Matrix = class extends MathArray {
2887
- get ELEMENTS() {
2888
- assert4(false);
2889
- return 0;
2890
- }
2891
- get RANK() {
2892
- assert4(false);
2893
- return 0;
2894
- }
2895
3136
  toString() {
2896
3137
  let string = "[";
2897
3138
  if (config.printRowMajor) {
@@ -3358,7 +3599,7 @@
3358
3599
  out[15] = 0;
3359
3600
  return out;
3360
3601
  }
3361
- function perspective(out, fovy, aspect, near, far) {
3602
+ function perspectiveNO(out, fovy, aspect, near, far) {
3362
3603
  var f2 = 1 / Math.tan(fovy / 2), nf;
3363
3604
  out[0] = f2 / aspect;
3364
3605
  out[1] = 0;
@@ -3384,7 +3625,8 @@
3384
3625
  }
3385
3626
  return out;
3386
3627
  }
3387
- function ortho(out, left, right, bottom, top, near, far) {
3628
+ var perspective = perspectiveNO;
3629
+ function orthoNO(out, left, right, bottom, top, near, far) {
3388
3630
  var lr = 1 / (left - right);
3389
3631
  var bt = 1 / (bottom - top);
3390
3632
  var nf = 1 / (near - far);
@@ -3406,6 +3648,7 @@
3406
3648
  out[15] = 1;
3407
3649
  return out;
3408
3650
  }
3651
+ var ortho = orthoNO;
3409
3652
  function lookAt(out, eye, center, up) {
3410
3653
  var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;
3411
3654
  var eyex = eye[0];
@@ -3524,38 +3767,36 @@
3524
3767
  }();
3525
3768
 
3526
3769
  // ../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js
3527
- var IDENTITY = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3528
- var ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
3529
- var INDICES = Object.freeze({
3530
- COL0ROW0: 0,
3531
- COL0ROW1: 1,
3532
- COL0ROW2: 2,
3533
- COL0ROW3: 3,
3534
- COL1ROW0: 4,
3535
- COL1ROW1: 5,
3536
- COL1ROW2: 6,
3537
- COL1ROW3: 7,
3538
- COL2ROW0: 8,
3539
- COL2ROW1: 9,
3540
- COL2ROW2: 10,
3541
- COL2ROW3: 11,
3542
- COL3ROW0: 12,
3543
- COL3ROW1: 13,
3544
- COL3ROW2: 14,
3545
- COL3ROW3: 15
3546
- });
3547
- var constants2 = {};
3770
+ var INDICES;
3771
+ (function(INDICES2) {
3772
+ INDICES2[INDICES2["COL0ROW0"] = 0] = "COL0ROW0";
3773
+ INDICES2[INDICES2["COL0ROW1"] = 1] = "COL0ROW1";
3774
+ INDICES2[INDICES2["COL0ROW2"] = 2] = "COL0ROW2";
3775
+ INDICES2[INDICES2["COL0ROW3"] = 3] = "COL0ROW3";
3776
+ INDICES2[INDICES2["COL1ROW0"] = 4] = "COL1ROW0";
3777
+ INDICES2[INDICES2["COL1ROW1"] = 5] = "COL1ROW1";
3778
+ INDICES2[INDICES2["COL1ROW2"] = 6] = "COL1ROW2";
3779
+ INDICES2[INDICES2["COL1ROW3"] = 7] = "COL1ROW3";
3780
+ INDICES2[INDICES2["COL2ROW0"] = 8] = "COL2ROW0";
3781
+ INDICES2[INDICES2["COL2ROW1"] = 9] = "COL2ROW1";
3782
+ INDICES2[INDICES2["COL2ROW2"] = 10] = "COL2ROW2";
3783
+ INDICES2[INDICES2["COL2ROW3"] = 11] = "COL2ROW3";
3784
+ INDICES2[INDICES2["COL3ROW0"] = 12] = "COL3ROW0";
3785
+ INDICES2[INDICES2["COL3ROW1"] = 13] = "COL3ROW1";
3786
+ INDICES2[INDICES2["COL3ROW2"] = 14] = "COL3ROW2";
3787
+ INDICES2[INDICES2["COL3ROW3"] = 15] = "COL3ROW3";
3788
+ })(INDICES || (INDICES = {}));
3789
+ var DEFAULT_FOVY = 45 * Math.PI / 180;
3790
+ var DEFAULT_ASPECT = 1;
3791
+ var DEFAULT_NEAR = 0.1;
3792
+ var DEFAULT_FAR = 500;
3793
+ var IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3548
3794
  var Matrix4 = class extends Matrix {
3549
3795
  static get IDENTITY() {
3550
- constants2.IDENTITY = constants2.IDENTITY || Object.freeze(new Matrix4(IDENTITY));
3551
- return constants2.IDENTITY;
3796
+ return getIdentityMatrix();
3552
3797
  }
3553
3798
  static get ZERO() {
3554
- constants2.ZERO = constants2.ZERO || Object.freeze(new Matrix4(ZERO));
3555
- return constants2.ZERO;
3556
- }
3557
- get INDICES() {
3558
- return INDICES;
3799
+ return getZeroMatrix();
3559
3800
  }
3560
3801
  get ELEMENTS() {
3561
3802
  return 16;
@@ -3563,6 +3804,9 @@
3563
3804
  get RANK() {
3564
3805
  return 4;
3565
3806
  }
3807
+ get INDICES() {
3808
+ return INDICES;
3809
+ }
3566
3810
  constructor(array) {
3567
3811
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
3568
3812
  if (arguments.length === 1 && Array.isArray(array)) {
@@ -3648,91 +3892,65 @@
3648
3892
  return result;
3649
3893
  }
3650
3894
  identity() {
3651
- return this.copy(IDENTITY);
3895
+ return this.copy(IDENTITY_MATRIX);
3652
3896
  }
3653
- fromQuaternion(q) {
3654
- fromQuat(this, q);
3897
+ fromObject(object) {
3655
3898
  return this.check();
3656
3899
  }
3657
- frustum({
3658
- left,
3659
- right,
3660
- bottom,
3661
- top,
3662
- near,
3663
- far
3664
- }) {
3900
+ fromQuaternion(quaternion) {
3901
+ fromQuat(this, quaternion);
3902
+ return this.check();
3903
+ }
3904
+ frustum(view) {
3905
+ const {
3906
+ left,
3907
+ right,
3908
+ bottom,
3909
+ top,
3910
+ near = DEFAULT_NEAR,
3911
+ far = DEFAULT_FAR
3912
+ } = view;
3665
3913
  if (far === Infinity) {
3666
- Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
3914
+ computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
3667
3915
  } else {
3668
3916
  frustum(this, left, right, bottom, top, near, far);
3669
3917
  }
3670
3918
  return this.check();
3671
3919
  }
3672
- static _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
3673
- const column0Row0 = 2 * near / (right - left);
3674
- const column1Row1 = 2 * near / (top - bottom);
3675
- const column2Row0 = (right + left) / (right - left);
3676
- const column2Row1 = (top + bottom) / (top - bottom);
3677
- const column2Row2 = -1;
3678
- const column2Row3 = -1;
3679
- const column3Row2 = -2 * near;
3680
- result[0] = column0Row0;
3681
- result[1] = 0;
3682
- result[2] = 0;
3683
- result[3] = 0;
3684
- result[4] = 0;
3685
- result[5] = column1Row1;
3686
- result[6] = 0;
3687
- result[7] = 0;
3688
- result[8] = column2Row0;
3689
- result[9] = column2Row1;
3690
- result[10] = column2Row2;
3691
- result[11] = column2Row3;
3692
- result[12] = 0;
3693
- result[13] = 0;
3694
- result[14] = column3Row2;
3695
- result[15] = 0;
3696
- return result;
3697
- }
3698
- lookAt(eye, center, up) {
3699
- if (arguments.length === 1) {
3700
- ({
3701
- eye,
3702
- center,
3703
- up
3704
- } = eye);
3705
- }
3706
- center = center || [0, 0, 0];
3707
- up = up || [0, 1, 0];
3920
+ lookAt(view) {
3921
+ const {
3922
+ eye,
3923
+ center = [0, 0, 0],
3924
+ up = [0, 1, 0]
3925
+ } = view;
3708
3926
  lookAt(this, eye, center, up);
3709
3927
  return this.check();
3710
3928
  }
3711
- ortho({
3712
- left,
3713
- right,
3714
- bottom,
3715
- top,
3716
- near = 0.1,
3717
- far = 500
3718
- }) {
3929
+ ortho(view) {
3930
+ const {
3931
+ left,
3932
+ right,
3933
+ bottom,
3934
+ top,
3935
+ near = DEFAULT_NEAR,
3936
+ far = DEFAULT_FAR
3937
+ } = view;
3719
3938
  ortho(this, left, right, bottom, top, near, far);
3720
3939
  return this.check();
3721
3940
  }
3722
- orthographic({
3723
- fovy = 45 * Math.PI / 180,
3724
- aspect = 1,
3725
- focalDistance = 1,
3726
- near = 0.1,
3727
- far = 500
3728
- }) {
3729
- if (fovy > Math.PI * 2) {
3730
- throw Error("radians");
3731
- }
3941
+ orthographic(view) {
3942
+ const {
3943
+ fovy = DEFAULT_FOVY,
3944
+ aspect = DEFAULT_ASPECT,
3945
+ focalDistance = 1,
3946
+ near = DEFAULT_NEAR,
3947
+ far = DEFAULT_FAR
3948
+ } = view;
3949
+ checkRadians(fovy);
3732
3950
  const halfY = fovy / 2;
3733
3951
  const top = focalDistance * Math.tan(halfY);
3734
3952
  const right = top * aspect;
3735
- return new Matrix4().ortho({
3953
+ return this.ortho({
3736
3954
  left: -right,
3737
3955
  right,
3738
3956
  bottom: -top,
@@ -3741,17 +3959,14 @@
3741
3959
  far
3742
3960
  });
3743
3961
  }
3744
- perspective({
3745
- fovy = void 0,
3746
- fov = 45 * Math.PI / 180,
3747
- aspect = 1,
3748
- near = 0.1,
3749
- far = 500
3750
- } = {}) {
3751
- fovy = fovy || fov;
3752
- if (fovy > Math.PI * 2) {
3753
- throw Error("radians");
3754
- }
3962
+ perspective(view) {
3963
+ const {
3964
+ fovy = 45 * Math.PI / 180,
3965
+ aspect = 1,
3966
+ near = 0.1,
3967
+ far = 500
3968
+ } = view;
3969
+ checkRadians(fovy);
3755
3970
  perspective(this, fovy, aspect, near, far);
3756
3971
  return this.check();
3757
3972
  }
@@ -3770,8 +3985,10 @@
3770
3985
  result[2] = this[14];
3771
3986
  return result;
3772
3987
  }
3773
- getRotation(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
3774
- const scale2 = this.getScale(scaleResult || [-0, -0, -0]);
3988
+ getRotation(result, scaleResult) {
3989
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
3990
+ scaleResult = scaleResult || [-0, -0, -0];
3991
+ const scale2 = this.getScale(scaleResult);
3775
3992
  const inverseScale0 = 1 / scale2[0];
3776
3993
  const inverseScale1 = 1 / scale2[1];
3777
3994
  const inverseScale2 = 1 / scale2[2];
@@ -3793,8 +4010,10 @@
3793
4010
  result[15] = 1;
3794
4011
  return result;
3795
4012
  }
3796
- getRotationMatrix3(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
3797
- const scale2 = this.getScale(scaleResult || [-0, -0, -0]);
4013
+ getRotationMatrix3(result, scaleResult) {
4014
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
4015
+ scaleResult = scaleResult || [-0, -0, -0];
4016
+ const scale2 = this.getScale(scaleResult);
3798
4017
  const inverseScale0 = 1 / scale2[0];
3799
4018
  const inverseScale1 = 1 / scale2[1];
3800
4019
  const inverseScale2 = 1 / scale2[2];
@@ -3837,23 +4056,19 @@
3837
4056
  rotateZ2(this, this, radians2);
3838
4057
  return this.check();
3839
4058
  }
3840
- rotateXYZ([rx, ry, rz]) {
3841
- return this.rotateX(rx).rotateY(ry).rotateZ(rz);
4059
+ rotateXYZ(angleXYZ) {
4060
+ return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
3842
4061
  }
3843
4062
  rotateAxis(radians2, axis) {
3844
4063
  rotate(this, this, radians2, axis);
3845
4064
  return this.check();
3846
4065
  }
3847
4066
  scale(factor) {
3848
- if (Array.isArray(factor)) {
3849
- scale(this, this, factor);
3850
- } else {
3851
- scale(this, this, [factor, factor, factor]);
3852
- }
4067
+ scale(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
3853
4068
  return this.check();
3854
4069
  }
3855
- translate(vec) {
3856
- translate(this, this, vec);
4070
+ translate(vector) {
4071
+ translate(this, this, vector);
3857
4072
  return this.check();
3858
4073
  }
3859
4074
  transform(vector, result) {
@@ -3868,52 +4083,98 @@
3868
4083
  const {
3869
4084
  length: length2
3870
4085
  } = vector;
4086
+ let out;
3871
4087
  switch (length2) {
3872
4088
  case 2:
3873
- result = transformMat4(result || [-0, -0], vector, this);
4089
+ out = transformMat4(result || [-0, -0], vector, this);
3874
4090
  break;
3875
4091
  case 3:
3876
- result = transformMat42(result || [-0, -0, -0], vector, this);
4092
+ out = transformMat42(result || [-0, -0, -0], vector, this);
3877
4093
  break;
3878
4094
  default:
3879
4095
  throw new Error("Illegal vector");
3880
4096
  }
3881
- checkVector(result, vector.length);
3882
- return result;
4097
+ checkVector(out, vector.length);
4098
+ return out;
3883
4099
  }
3884
4100
  transformAsVector(vector, result) {
4101
+ let out;
3885
4102
  switch (vector.length) {
3886
4103
  case 2:
3887
- result = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
4104
+ out = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
3888
4105
  break;
3889
4106
  case 3:
3890
- result = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
4107
+ out = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
3891
4108
  break;
3892
4109
  default:
3893
4110
  throw new Error("Illegal vector");
3894
4111
  }
3895
- checkVector(result, vector.length);
3896
- return result;
3897
- }
3898
- makeRotationX(radians2) {
3899
- return this.identity().rotateX(radians2);
3900
- }
3901
- makeTranslation(x, y, z) {
3902
- return this.identity().translate([x, y, z]);
4112
+ checkVector(out, vector.length);
4113
+ return out;
3903
4114
  }
3904
4115
  transformPoint(vector, result) {
3905
- deprecated("Matrix4.transformPoint", "3.0");
3906
4116
  return this.transformAsPoint(vector, result);
3907
4117
  }
3908
4118
  transformVector(vector, result) {
3909
- deprecated("Matrix4.transformVector", "3.0");
3910
4119
  return this.transformAsPoint(vector, result);
3911
4120
  }
3912
4121
  transformDirection(vector, result) {
3913
- deprecated("Matrix4.transformDirection", "3.0");
3914
4122
  return this.transformAsVector(vector, result);
3915
4123
  }
4124
+ makeRotationX(radians2) {
4125
+ return this.identity().rotateX(radians2);
4126
+ }
4127
+ makeTranslation(x, y, z) {
4128
+ return this.identity().translate([x, y, z]);
4129
+ }
3916
4130
  };
4131
+ var ZERO2;
4132
+ var IDENTITY;
4133
+ function getZeroMatrix() {
4134
+ if (!ZERO2) {
4135
+ ZERO2 = new Matrix4([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
4136
+ Object.freeze(ZERO2);
4137
+ }
4138
+ return ZERO2;
4139
+ }
4140
+ function getIdentityMatrix() {
4141
+ if (!IDENTITY) {
4142
+ IDENTITY = new Matrix4();
4143
+ Object.freeze(IDENTITY);
4144
+ }
4145
+ return IDENTITY;
4146
+ }
4147
+ function checkRadians(possiblyDegrees) {
4148
+ if (possiblyDegrees > Math.PI * 2) {
4149
+ throw Error("expected radians");
4150
+ }
4151
+ }
4152
+ function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
4153
+ const column0Row0 = 2 * near / (right - left);
4154
+ const column1Row1 = 2 * near / (top - bottom);
4155
+ const column2Row0 = (right + left) / (right - left);
4156
+ const column2Row1 = (top + bottom) / (top - bottom);
4157
+ const column2Row2 = -1;
4158
+ const column2Row3 = -1;
4159
+ const column3Row2 = -2 * near;
4160
+ result[0] = column0Row0;
4161
+ result[1] = 0;
4162
+ result[2] = 0;
4163
+ result[3] = 0;
4164
+ result[4] = 0;
4165
+ result[5] = column1Row1;
4166
+ result[6] = 0;
4167
+ result[7] = 0;
4168
+ result[8] = column2Row0;
4169
+ result[9] = column2Row1;
4170
+ result[10] = column2Row2;
4171
+ result[11] = column2Row3;
4172
+ result[12] = 0;
4173
+ result[13] = 0;
4174
+ result[14] = column3Row2;
4175
+ result[15] = 0;
4176
+ return result;
4177
+ }
3917
4178
 
3918
4179
  // ../../node_modules/@math.gl/core/dist/esm/lib/math-utils.js
3919
4180
  var math_utils_default = {
@@ -3943,17 +4204,6 @@
3943
4204
  TWO_PI: Math.PI * 2
3944
4205
  };
3945
4206
 
3946
- // ../../node_modules/@math.gl/core/dist/esm/index.js
3947
- var globals4 = {
3948
- self: typeof self !== "undefined" && self,
3949
- window: typeof window !== "undefined" && window,
3950
- global: typeof global !== "undefined" && global
3951
- };
3952
- var global_4 = globals4.global || globals4.self || globals4.window;
3953
- global_4.mathgl = {
3954
- config
3955
- };
3956
-
3957
4207
  // ../../node_modules/@math.gl/geospatial/dist/esm/constants.js
3958
4208
  var WGS84_RADIUS_X = 6378137;
3959
4209
  var WGS84_RADIUS_Y = 6378137;
@@ -3968,61 +4218,63 @@
3968
4218
  };
3969
4219
 
3970
4220
  // ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
3971
- var noop2 = (x) => x;
4221
+ function identity2(x) {
4222
+ return x;
4223
+ }
3972
4224
  var scratchVector = new Vector3();
3973
- function fromCartographic(cartographic, result, map3 = noop2) {
3974
- if (isArray(cartographic)) {
3975
- result[0] = map3(cartographic[0]);
3976
- result[1] = map3(cartographic[1]);
3977
- result[2] = cartographic[2];
3978
- } else if ("longitude" in cartographic) {
3979
- result[0] = map3(cartographic.longitude);
3980
- result[1] = map3(cartographic.latitude);
4225
+ function fromCartographic(cartographic, result = [], map2 = identity2) {
4226
+ if ("longitude" in cartographic) {
4227
+ result[0] = map2(cartographic.longitude);
4228
+ result[1] = map2(cartographic.latitude);
3981
4229
  result[2] = cartographic.height;
3982
- } else {
3983
- result[0] = map3(cartographic.x);
3984
- result[1] = map3(cartographic.y);
4230
+ } else if ("x" in cartographic) {
4231
+ result[0] = map2(cartographic.x);
4232
+ result[1] = map2(cartographic.y);
3985
4233
  result[2] = cartographic.z;
4234
+ } else {
4235
+ result[0] = map2(cartographic[0]);
4236
+ result[1] = map2(cartographic[1]);
4237
+ result[2] = cartographic[2];
3986
4238
  }
3987
4239
  return result;
3988
4240
  }
3989
- function fromCartographicToRadians(cartographic, vector = scratchVector) {
3990
- return fromCartographic(cartographic, vector, config._cartographicRadians ? noop2 : toRadians);
4241
+ function fromCartographicToRadians(cartographic, vector = []) {
4242
+ return fromCartographic(cartographic, vector, config._cartographicRadians ? identity2 : toRadians);
3991
4243
  }
3992
- function toCartographic(vector, cartographic, map3 = noop2) {
3993
- if (isArray(cartographic)) {
3994
- cartographic[0] = map3(vector[0]);
3995
- cartographic[1] = map3(vector[1]);
3996
- cartographic[2] = vector[2];
3997
- } else if ("longitude" in cartographic) {
3998
- cartographic.longitude = map3(vector[0]);
3999
- cartographic.latitude = map3(vector[1]);
4244
+ function toCartographic(vector, cartographic, map2 = identity2) {
4245
+ if ("longitude" in cartographic) {
4246
+ cartographic.longitude = map2(vector[0]);
4247
+ cartographic.latitude = map2(vector[1]);
4000
4248
  cartographic.height = vector[2];
4001
- } else {
4002
- cartographic.x = map3(vector[0]);
4003
- cartographic.y = map3(vector[1]);
4249
+ } else if ("x" in cartographic) {
4250
+ cartographic.x = map2(vector[0]);
4251
+ cartographic.y = map2(vector[1]);
4004
4252
  cartographic.z = vector[2];
4253
+ } else {
4254
+ cartographic[0] = map2(vector[0]);
4255
+ cartographic[1] = map2(vector[1]);
4256
+ cartographic[2] = vector[2];
4005
4257
  }
4006
4258
  return cartographic;
4007
4259
  }
4008
4260
  function toCartographicFromRadians(vector, cartographic) {
4009
- return toCartographic(vector, cartographic, config._cartographicRadians ? noop2 : toDegrees);
4261
+ return toCartographic(vector, cartographic, config._cartographicRadians ? identity2 : toDegrees);
4010
4262
  }
4011
4263
 
4012
4264
  // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js
4013
4265
  var scratchVector2 = new Vector3();
4014
4266
  var scaleToGeodeticSurfaceIntersection = new Vector3();
4015
4267
  var scaleToGeodeticSurfaceGradient = new Vector3();
4016
- function scaleToGeodeticSurface(cartesian, ellipsoid, result = new Vector3()) {
4268
+ function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
4017
4269
  const {
4018
4270
  oneOverRadii,
4019
4271
  oneOverRadiiSquared,
4020
4272
  centerToleranceSquared
4021
4273
  } = ellipsoid;
4022
4274
  scratchVector2.from(cartesian);
4023
- const positionX = cartesian.x;
4024
- const positionY = cartesian.y;
4025
- const positionZ = cartesian.z;
4275
+ const positionX = scratchVector2.x;
4276
+ const positionY = scratchVector2.y;
4277
+ const positionZ = scratchVector2.z;
4026
4278
  const oneOverRadiiX = oneOverRadii.x;
4027
4279
  const oneOverRadiiY = oneOverRadii.y;
4028
4280
  const oneOverRadiiZ = oneOverRadii.z;
@@ -4044,7 +4296,7 @@
4044
4296
  const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
4045
4297
  const gradient = scaleToGeodeticSurfaceGradient;
4046
4298
  gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
4047
- let lambda = (1 - ratio) * cartesian.len() / (0.5 * gradient.len());
4299
+ let lambda = (1 - ratio) * scratchVector2.len() / (0.5 * gradient.len());
4048
4300
  let correction = 0;
4049
4301
  let xMultiplier;
4050
4302
  let yMultiplier;
@@ -4198,13 +4450,17 @@
4198
4450
  var scratchPosition = new Vector3();
4199
4451
  var scratchHeight = new Vector3();
4200
4452
  var scratchCartesian = new Vector3();
4201
- var wgs84;
4202
4453
  var Ellipsoid = class {
4203
- static get WGS84() {
4204
- wgs84 = wgs84 || new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
4205
- return wgs84;
4206
- }
4207
4454
  constructor(x = 0, y = 0, z = 0) {
4455
+ _defineProperty(this, "radii", void 0);
4456
+ _defineProperty(this, "radiiSquared", void 0);
4457
+ _defineProperty(this, "radiiToTheFourth", void 0);
4458
+ _defineProperty(this, "oneOverRadii", void 0);
4459
+ _defineProperty(this, "oneOverRadiiSquared", void 0);
4460
+ _defineProperty(this, "minimumRadius", void 0);
4461
+ _defineProperty(this, "maximumRadius", void 0);
4462
+ _defineProperty(this, "centerToleranceSquared", math_utils_default.EPSILON1);
4463
+ _defineProperty(this, "squaredXOverSquaredZ", void 0);
4208
4464
  assert4(x >= 0);
4209
4465
  assert4(y >= 0);
4210
4466
  assert4(z >= 0);
@@ -4215,7 +4471,6 @@
4215
4471
  this.oneOverRadiiSquared = new Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
4216
4472
  this.minimumRadius = Math.min(x, y, z);
4217
4473
  this.maximumRadius = Math.max(x, y, z);
4218
- this.centerToleranceSquared = math_utils_default.EPSILON1;
4219
4474
  if (this.radiiSquared.z !== 0) {
4220
4475
  this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;
4221
4476
  }
@@ -4302,9 +4557,10 @@
4302
4557
  return scratchPosition.set(0, 0, z).to(result);
4303
4558
  }
4304
4559
  };
4560
+ _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
4305
4561
 
4306
4562
  // ../images/src/lib/utils/version.ts
4307
- var VERSION4 = true ? "4.0.0-alpha.5" : "latest";
4563
+ var VERSION4 = true ? "4.0.0-alpha.6" : "latest";
4308
4564
 
4309
4565
  // ../images/src/lib/category-api/image-type.ts
4310
4566
  var { _parseImageNode } = globalThis;
@@ -4428,9 +4684,9 @@
4428
4684
  await image.decode();
4429
4685
  return image;
4430
4686
  }
4431
- return await new Promise((resolve, reject) => {
4687
+ return await new Promise((resolve2, reject) => {
4432
4688
  try {
4433
- image.onload = () => resolve(image);
4689
+ image.onload = () => resolve2(image);
4434
4690
  image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));
4435
4691
  } catch (error) {
4436
4692
  reject(error);
@@ -4473,12 +4729,60 @@
4473
4729
  return true;
4474
4730
  }
4475
4731
 
4732
+ // ../images/src/lib/category-api/parse-isobmff-binary.ts
4733
+ function getISOBMFFMediaType(buffer) {
4734
+ if (!checkString(buffer, "ftyp", 4)) {
4735
+ return null;
4736
+ }
4737
+ if ((buffer[8] & 96) === 0) {
4738
+ return null;
4739
+ }
4740
+ return decodeMajorBrand(buffer);
4741
+ }
4742
+ function decodeMajorBrand(buffer) {
4743
+ const brandMajor = getUTF8String(buffer, 8, 12).replace("\0", " ").trim();
4744
+ switch (brandMajor) {
4745
+ case "avif":
4746
+ case "avis":
4747
+ return { extension: "avif", mimeType: "image/avif" };
4748
+ default:
4749
+ return null;
4750
+ }
4751
+ }
4752
+ function getUTF8String(array, start, end) {
4753
+ return String.fromCharCode(...array.slice(start, end));
4754
+ }
4755
+ function stringToBytes(string) {
4756
+ return [...string].map((character) => character.charCodeAt(0));
4757
+ }
4758
+ function checkString(buffer, header, offset = 0) {
4759
+ const headerBytes = stringToBytes(header);
4760
+ for (let i2 = 0; i2 < headerBytes.length; ++i2) {
4761
+ if (headerBytes[i2] !== buffer[i2 + offset]) {
4762
+ return false;
4763
+ }
4764
+ }
4765
+ return true;
4766
+ }
4767
+
4476
4768
  // ../images/src/lib/category-api/binary-image-api.ts
4477
4769
  var BIG_ENDIAN = false;
4478
4770
  var LITTLE_ENDIAN = true;
4479
4771
  function getBinaryImageMetadata(binaryData) {
4480
4772
  const dataView = toDataView(binaryData);
4481
- return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView);
4773
+ return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView) || getISOBMFFMetadata(dataView);
4774
+ }
4775
+ function getISOBMFFMetadata(binaryData) {
4776
+ const buffer = new Uint8Array(binaryData instanceof DataView ? binaryData.buffer : binaryData);
4777
+ const mediaType = getISOBMFFMediaType(buffer);
4778
+ if (!mediaType) {
4779
+ return null;
4780
+ }
4781
+ return {
4782
+ mimeType: mediaType.mimeType,
4783
+ width: 0,
4784
+ height: 0
4785
+ };
4482
4786
  }
4483
4787
  function getPngMetadata(binaryData) {
4484
4788
  const dataView = toDataView(binaryData);
@@ -4623,12 +4927,13 @@
4623
4927
  }
4624
4928
 
4625
4929
  // ../images/src/image-loader.ts
4626
- var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg"];
4930
+ var EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
4627
4931
  var MIME_TYPES = [
4628
4932
  "image/png",
4629
4933
  "image/jpeg",
4630
4934
  "image/gif",
4631
4935
  "image/webp",
4936
+ "image/avif",
4632
4937
  "image/bmp",
4633
4938
  "image/vnd.microsoft.icon",
4634
4939
  "image/svg+xml"
@@ -4652,7 +4957,7 @@
4652
4957
  };
4653
4958
 
4654
4959
  // ../draco/src/lib/utils/version.ts
4655
- var VERSION5 = true ? "4.0.0-alpha.5" : "latest";
4960
+ var VERSION5 = true ? "4.0.0-alpha.6" : "latest";
4656
4961
 
4657
4962
  // ../draco/src/draco-loader.ts
4658
4963
  var DEFAULT_DRACO_OPTIONS = {
@@ -4665,9 +4970,8 @@
4665
4970
  };
4666
4971
  var DracoLoader = {
4667
4972
  name: "Draco",
4668
- id: "draco",
4973
+ id: isBrowser2 ? "draco" : "draco-nodejs",
4669
4974
  module: "draco",
4670
- shapes: ["mesh"],
4671
4975
  version: VERSION5,
4672
4976
  worker: true,
4673
4977
  extensions: ["drc"],
@@ -4677,7 +4981,32 @@
4677
4981
  options: DEFAULT_DRACO_OPTIONS
4678
4982
  };
4679
4983
 
4680
- // ../schema/src/category/mesh/mesh-utils.ts
4984
+ // ../schema/src/lib/table/simple-table/data-type.ts
4985
+ function getDataTypeFromTypedArray(array) {
4986
+ switch (array.constructor) {
4987
+ case Int8Array:
4988
+ return "int8";
4989
+ case Uint8Array:
4990
+ case Uint8ClampedArray:
4991
+ return "uint8";
4992
+ case Int16Array:
4993
+ return "int16";
4994
+ case Uint16Array:
4995
+ return "uint16";
4996
+ case Int32Array:
4997
+ return "int32";
4998
+ case Uint32Array:
4999
+ return "uint32";
5000
+ case Float32Array:
5001
+ return "float32";
5002
+ case Float64Array:
5003
+ return "float64";
5004
+ default:
5005
+ return "null";
5006
+ }
5007
+ }
5008
+
5009
+ // ../schema/src/lib/mesh/mesh-utils.ts
4681
5010
  function getMeshBoundingBox(attributes) {
4682
5011
  let minX = Infinity;
4683
5012
  let minY = Infinity;
@@ -4704,500 +5033,34 @@
4704
5033
  ];
4705
5034
  }
4706
5035
 
4707
- // ../schema/src/lib/utils/assert.ts
4708
- function assert5(condition, message) {
4709
- if (!condition) {
4710
- throw new Error(message || "loader assertion failed.");
4711
- }
4712
- }
4713
-
4714
- // ../schema/src/lib/schema/impl/schema.ts
4715
- var Schema = class {
4716
- constructor(fields, metadata) {
4717
- assert5(Array.isArray(fields));
4718
- checkNames(fields);
4719
- this.fields = fields;
4720
- this.metadata = metadata || new Map();
4721
- }
4722
- compareTo(other) {
4723
- if (this.metadata !== other.metadata) {
4724
- return false;
4725
- }
4726
- if (this.fields.length !== other.fields.length) {
4727
- return false;
4728
- }
4729
- for (let i2 = 0; i2 < this.fields.length; ++i2) {
4730
- if (!this.fields[i2].compareTo(other.fields[i2])) {
4731
- return false;
4732
- }
4733
- }
4734
- return true;
4735
- }
4736
- select(...columnNames) {
4737
- const nameMap = Object.create(null);
4738
- for (const name of columnNames) {
4739
- nameMap[name] = true;
4740
- }
4741
- const selectedFields = this.fields.filter((field) => nameMap[field.name]);
4742
- return new Schema(selectedFields, this.metadata);
4743
- }
4744
- selectAt(...columnIndices) {
4745
- const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
4746
- return new Schema(selectedFields, this.metadata);
4747
- }
4748
- assign(schemaOrFields) {
4749
- let fields;
4750
- let metadata = this.metadata;
4751
- if (schemaOrFields instanceof Schema) {
4752
- const otherSchema = schemaOrFields;
4753
- fields = otherSchema.fields;
4754
- metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherSchema.metadata);
4755
- } else {
4756
- fields = schemaOrFields;
4757
- }
4758
- const fieldMap = Object.create(null);
4759
- for (const field of this.fields) {
4760
- fieldMap[field.name] = field;
4761
- }
4762
- for (const field of fields) {
4763
- fieldMap[field.name] = field;
4764
- }
4765
- const mergedFields = Object.values(fieldMap);
4766
- return new Schema(mergedFields, metadata);
4767
- }
4768
- };
4769
- function checkNames(fields) {
4770
- const usedNames = {};
4771
- for (const field of fields) {
4772
- if (usedNames[field.name]) {
4773
- console.warn("Schema: duplicated field name", field.name, field);
4774
- }
4775
- usedNames[field.name] = true;
4776
- }
4777
- }
4778
- function mergeMaps(m1, m2) {
4779
- return new Map([...m1 || new Map(), ...m2 || new Map()]);
4780
- }
4781
-
4782
- // ../schema/src/lib/schema/impl/field.ts
4783
- var Field = class {
4784
- constructor(name, type, nullable = false, metadata = new Map()) {
4785
- this.name = name;
4786
- this.type = type;
4787
- this.nullable = nullable;
4788
- this.metadata = metadata;
4789
- }
4790
- get typeId() {
4791
- return this.type && this.type.typeId;
4792
- }
4793
- clone() {
4794
- return new Field(this.name, this.type, this.nullable, this.metadata);
4795
- }
4796
- compareTo(other) {
4797
- return this.name === other.name && this.type === other.type && this.nullable === other.nullable && this.metadata === other.metadata;
4798
- }
4799
- toString() {
4800
- return `${this.type}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${this.metadata}` : ""}`;
4801
- }
4802
- };
4803
-
4804
- // ../schema/src/lib/schema/impl/enum.ts
4805
- var Type;
4806
- (function(Type2) {
4807
- Type2[Type2["NONE"] = 0] = "NONE";
4808
- Type2[Type2["Null"] = 1] = "Null";
4809
- Type2[Type2["Int"] = 2] = "Int";
4810
- Type2[Type2["Float"] = 3] = "Float";
4811
- Type2[Type2["Binary"] = 4] = "Binary";
4812
- Type2[Type2["Utf8"] = 5] = "Utf8";
4813
- Type2[Type2["Bool"] = 6] = "Bool";
4814
- Type2[Type2["Decimal"] = 7] = "Decimal";
4815
- Type2[Type2["Date"] = 8] = "Date";
4816
- Type2[Type2["Time"] = 9] = "Time";
4817
- Type2[Type2["Timestamp"] = 10] = "Timestamp";
4818
- Type2[Type2["Interval"] = 11] = "Interval";
4819
- Type2[Type2["List"] = 12] = "List";
4820
- Type2[Type2["Struct"] = 13] = "Struct";
4821
- Type2[Type2["Union"] = 14] = "Union";
4822
- Type2[Type2["FixedSizeBinary"] = 15] = "FixedSizeBinary";
4823
- Type2[Type2["FixedSizeList"] = 16] = "FixedSizeList";
4824
- Type2[Type2["Map"] = 17] = "Map";
4825
- Type2[Type2["Dictionary"] = -1] = "Dictionary";
4826
- Type2[Type2["Int8"] = -2] = "Int8";
4827
- Type2[Type2["Int16"] = -3] = "Int16";
4828
- Type2[Type2["Int32"] = -4] = "Int32";
4829
- Type2[Type2["Int64"] = -5] = "Int64";
4830
- Type2[Type2["Uint8"] = -6] = "Uint8";
4831
- Type2[Type2["Uint16"] = -7] = "Uint16";
4832
- Type2[Type2["Uint32"] = -8] = "Uint32";
4833
- Type2[Type2["Uint64"] = -9] = "Uint64";
4834
- Type2[Type2["Float16"] = -10] = "Float16";
4835
- Type2[Type2["Float32"] = -11] = "Float32";
4836
- Type2[Type2["Float64"] = -12] = "Float64";
4837
- Type2[Type2["DateDay"] = -13] = "DateDay";
4838
- Type2[Type2["DateMillisecond"] = -14] = "DateMillisecond";
4839
- Type2[Type2["TimestampSecond"] = -15] = "TimestampSecond";
4840
- Type2[Type2["TimestampMillisecond"] = -16] = "TimestampMillisecond";
4841
- Type2[Type2["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
4842
- Type2[Type2["TimestampNanosecond"] = -18] = "TimestampNanosecond";
4843
- Type2[Type2["TimeSecond"] = -19] = "TimeSecond";
4844
- Type2[Type2["TimeMillisecond"] = -20] = "TimeMillisecond";
4845
- Type2[Type2["TimeMicrosecond"] = -21] = "TimeMicrosecond";
4846
- Type2[Type2["TimeNanosecond"] = -22] = "TimeNanosecond";
4847
- Type2[Type2["DenseUnion"] = -23] = "DenseUnion";
4848
- Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
4849
- Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
4850
- Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
4851
- })(Type || (Type = {}));
4852
-
4853
- // ../schema/src/lib/schema/impl/type.ts
4854
- var DataType = class {
4855
- static isNull(x) {
4856
- return x && x.typeId === Type.Null;
4857
- }
4858
- static isInt(x) {
4859
- return x && x.typeId === Type.Int;
4860
- }
4861
- static isFloat(x) {
4862
- return x && x.typeId === Type.Float;
4863
- }
4864
- static isBinary(x) {
4865
- return x && x.typeId === Type.Binary;
4866
- }
4867
- static isUtf8(x) {
4868
- return x && x.typeId === Type.Utf8;
4869
- }
4870
- static isBool(x) {
4871
- return x && x.typeId === Type.Bool;
4872
- }
4873
- static isDecimal(x) {
4874
- return x && x.typeId === Type.Decimal;
4875
- }
4876
- static isDate(x) {
4877
- return x && x.typeId === Type.Date;
4878
- }
4879
- static isTime(x) {
4880
- return x && x.typeId === Type.Time;
4881
- }
4882
- static isTimestamp(x) {
4883
- return x && x.typeId === Type.Timestamp;
4884
- }
4885
- static isInterval(x) {
4886
- return x && x.typeId === Type.Interval;
4887
- }
4888
- static isList(x) {
4889
- return x && x.typeId === Type.List;
4890
- }
4891
- static isStruct(x) {
4892
- return x && x.typeId === Type.Struct;
4893
- }
4894
- static isUnion(x) {
4895
- return x && x.typeId === Type.Union;
4896
- }
4897
- static isFixedSizeBinary(x) {
4898
- return x && x.typeId === Type.FixedSizeBinary;
4899
- }
4900
- static isFixedSizeList(x) {
4901
- return x && x.typeId === Type.FixedSizeList;
4902
- }
4903
- static isMap(x) {
4904
- return x && x.typeId === Type.Map;
4905
- }
4906
- static isDictionary(x) {
4907
- return x && x.typeId === Type.Dictionary;
4908
- }
4909
- get typeId() {
4910
- return Type.NONE;
4911
- }
4912
- compareTo(other) {
4913
- return this === other;
4914
- }
4915
- };
4916
- var Null = class extends DataType {
4917
- get typeId() {
4918
- return Type.Null;
4919
- }
4920
- get [Symbol.toStringTag]() {
4921
- return "Null";
4922
- }
4923
- toString() {
4924
- return "Null";
4925
- }
4926
- };
4927
- var Bool = class extends DataType {
4928
- get typeId() {
4929
- return Type.Bool;
4930
- }
4931
- get [Symbol.toStringTag]() {
4932
- return "Bool";
4933
- }
4934
- toString() {
4935
- return "Bool";
4936
- }
4937
- };
4938
- var Int = class extends DataType {
4939
- constructor(isSigned, bitWidth) {
4940
- super();
4941
- this.isSigned = isSigned;
4942
- this.bitWidth = bitWidth;
4943
- }
4944
- get typeId() {
4945
- return Type.Int;
4946
- }
4947
- get [Symbol.toStringTag]() {
4948
- return "Int";
4949
- }
4950
- toString() {
4951
- return `${this.isSigned ? "I" : "Ui"}nt${this.bitWidth}`;
4952
- }
4953
- };
4954
- var Int8 = class extends Int {
4955
- constructor() {
4956
- super(true, 8);
4957
- }
4958
- };
4959
- var Int16 = class extends Int {
4960
- constructor() {
4961
- super(true, 16);
4962
- }
4963
- };
4964
- var Int32 = class extends Int {
4965
- constructor() {
4966
- super(true, 32);
4967
- }
4968
- };
4969
- var Uint8 = class extends Int {
4970
- constructor() {
4971
- super(false, 8);
4972
- }
4973
- };
4974
- var Uint16 = class extends Int {
4975
- constructor() {
4976
- super(false, 16);
4977
- }
4978
- };
4979
- var Uint32 = class extends Int {
4980
- constructor() {
4981
- super(false, 32);
4982
- }
4983
- };
4984
- var Precision = {
4985
- HALF: 16,
4986
- SINGLE: 32,
4987
- DOUBLE: 64
4988
- };
4989
- var Float = class extends DataType {
4990
- constructor(precision) {
4991
- super();
4992
- this.precision = precision;
4993
- }
4994
- get typeId() {
4995
- return Type.Float;
4996
- }
4997
- get [Symbol.toStringTag]() {
4998
- return "Float";
4999
- }
5000
- toString() {
5001
- return `Float${this.precision}`;
5002
- }
5003
- };
5004
- var Float32 = class extends Float {
5005
- constructor() {
5006
- super(Precision.SINGLE);
5007
- }
5008
- };
5009
- var Float64 = class extends Float {
5010
- constructor() {
5011
- super(Precision.DOUBLE);
5012
- }
5013
- };
5014
- var Binary = class extends DataType {
5015
- constructor() {
5016
- super();
5017
- }
5018
- get typeId() {
5019
- return Type.Binary;
5020
- }
5021
- toString() {
5022
- return "Binary";
5023
- }
5024
- get [Symbol.toStringTag]() {
5025
- return "Binary";
5026
- }
5027
- };
5028
- var Utf8 = class extends DataType {
5029
- get typeId() {
5030
- return Type.Utf8;
5031
- }
5032
- get [Symbol.toStringTag]() {
5033
- return "Utf8";
5034
- }
5035
- toString() {
5036
- return "Utf8";
5037
- }
5038
- };
5039
- var DateUnit = {
5040
- DAY: 0,
5041
- MILLISECOND: 1
5042
- };
5043
- var Date2 = class extends DataType {
5044
- constructor(unit) {
5045
- super();
5046
- this.unit = unit;
5047
- }
5048
- get typeId() {
5049
- return Type.Date;
5050
- }
5051
- get [Symbol.toStringTag]() {
5052
- return "Date";
5053
- }
5054
- toString() {
5055
- return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
5056
- }
5057
- };
5058
- var TimeUnit = {
5059
- SECOND: 1,
5060
- MILLISECOND: 1e3,
5061
- MICROSECOND: 1e6,
5062
- NANOSECOND: 1e9
5063
- };
5064
- var Time = class extends DataType {
5065
- constructor(unit, bitWidth) {
5066
- super();
5067
- this.unit = unit;
5068
- this.bitWidth = bitWidth;
5069
- }
5070
- get typeId() {
5071
- return Type.Time;
5072
- }
5073
- toString() {
5074
- return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
5075
- }
5076
- get [Symbol.toStringTag]() {
5077
- return "Time";
5078
- }
5079
- };
5080
- var Timestamp = class extends DataType {
5081
- constructor(unit, timezone = null) {
5082
- super();
5083
- this.unit = unit;
5084
- this.timezone = timezone;
5085
- }
5086
- get typeId() {
5087
- return Type.Timestamp;
5088
- }
5089
- get [Symbol.toStringTag]() {
5090
- return "Timestamp";
5091
- }
5092
- toString() {
5093
- return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ""}>`;
5094
- }
5095
- };
5096
- var IntervalUnit = {
5097
- DAY_TIME: 0,
5098
- YEAR_MONTH: 1
5099
- };
5100
- var Interval = class extends DataType {
5101
- constructor(unit) {
5102
- super();
5103
- this.unit = unit;
5104
- }
5105
- get typeId() {
5106
- return Type.Interval;
5107
- }
5108
- get [Symbol.toStringTag]() {
5109
- return "Interval";
5110
- }
5111
- toString() {
5112
- return `Interval<${IntervalUnit[this.unit]}>`;
5113
- }
5114
- };
5115
- var FixedSizeList = class extends DataType {
5116
- constructor(listSize, child) {
5117
- super();
5118
- this.listSize = listSize;
5119
- this.children = [child];
5120
- }
5121
- get typeId() {
5122
- return Type.FixedSizeList;
5123
- }
5124
- get valueType() {
5125
- return this.children[0].type;
5126
- }
5127
- get valueField() {
5128
- return this.children[0];
5129
- }
5130
- get [Symbol.toStringTag]() {
5131
- return "FixedSizeList";
5132
- }
5133
- toString() {
5134
- return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
5135
- }
5136
- };
5137
- var Struct = class extends DataType {
5138
- constructor(children) {
5139
- super();
5140
- this.children = children;
5141
- }
5142
- get typeId() {
5143
- return Type.Struct;
5144
- }
5145
- toString() {
5146
- return `Struct<{${this.children.map((f2) => `${f2.name}:${f2.type}`).join(", ")}}>`;
5147
- }
5148
- get [Symbol.toStringTag]() {
5149
- return "Struct";
5150
- }
5151
- };
5152
-
5153
- // ../schema/src/lib/arrow/arrow-like-type-utils.ts
5154
- function getArrowTypeFromTypedArray(array) {
5155
- switch (array.constructor) {
5156
- case Int8Array:
5157
- return new Int8();
5158
- case Uint8Array:
5159
- return new Uint8();
5160
- case Int16Array:
5161
- return new Int16();
5162
- case Uint16Array:
5163
- return new Uint16();
5164
- case Int32Array:
5165
- return new Int32();
5166
- case Uint32Array:
5167
- return new Uint32();
5168
- case Float32Array:
5169
- return new Float32();
5170
- case Float64Array:
5171
- return new Float64();
5172
- default:
5173
- throw new Error("array type not supported");
5174
- }
5175
- }
5176
-
5177
- // ../schema/src/category/mesh/deduce-mesh-schema.ts
5178
- function deduceMeshField(attributeName, attribute, optionalMetadata) {
5179
- const type = getArrowTypeFromTypedArray(attribute.value);
5036
+ // ../schema/src/lib/mesh/deduce-mesh-schema.ts
5037
+ function deduceMeshField(name, attribute, optionalMetadata) {
5038
+ const type = getDataTypeFromTypedArray(attribute.value);
5180
5039
  const metadata = optionalMetadata ? optionalMetadata : makeMeshAttributeMetadata(attribute);
5181
- const field = new Field(attributeName, new FixedSizeList(attribute.size, new Field("value", type)), false, metadata);
5182
- return field;
5040
+ return {
5041
+ name,
5042
+ type: { type: "fixed-size-list", listSize: attribute.size, children: [{ name: "value", type }] },
5043
+ nullable: false,
5044
+ metadata
5045
+ };
5183
5046
  }
5184
5047
  function makeMeshAttributeMetadata(attribute) {
5185
- const result = new Map();
5048
+ const result = {};
5186
5049
  if ("byteOffset" in attribute) {
5187
- result.set("byteOffset", attribute.byteOffset.toString(10));
5050
+ result.byteOffset = attribute.byteOffset.toString(10);
5188
5051
  }
5189
5052
  if ("byteStride" in attribute) {
5190
- result.set("byteStride", attribute.byteStride.toString(10));
5053
+ result.byteStride = attribute.byteStride.toString(10);
5191
5054
  }
5192
5055
  if ("normalized" in attribute) {
5193
- result.set("normalized", attribute.normalized.toString());
5056
+ result.normalized = attribute.normalized.toString();
5194
5057
  }
5195
5058
  return result;
5196
5059
  }
5197
5060
 
5198
5061
  // ../draco/src/lib/utils/get-draco-schema.ts
5199
5062
  function getDracoSchema(attributes, loaderData, indices) {
5200
- const metadataMap = makeMetadata(loaderData.metadata);
5063
+ const metadata = makeMetadata(loaderData.metadata);
5201
5064
  const fields = [];
5202
5065
  const namedLoaderDataAttributes = transformAttributesLoaderData(loaderData.attributes);
5203
5066
  for (const attributeName in attributes) {
@@ -5209,7 +5072,7 @@
5209
5072
  const indicesField = getArrowFieldFromAttribute("indices", indices);
5210
5073
  fields.push(indicesField);
5211
5074
  }
5212
- return new Schema(fields, metadataMap);
5075
+ return { fields, metadata };
5213
5076
  }
5214
5077
  function transformAttributesLoaderData(loaderData) {
5215
5078
  const result = {};
@@ -5225,11 +5088,12 @@
5225
5088
  return field;
5226
5089
  }
5227
5090
  function makeMetadata(metadata) {
5228
- const metadataMap = new Map();
5091
+ Object.entries(metadata);
5092
+ const serializedMetadata = {};
5229
5093
  for (const key in metadata) {
5230
- metadataMap.set(`${key}.string`, JSON.stringify(metadata[key]));
5094
+ serializedMetadata[`${key}.string`] = JSON.stringify(metadata[key]);
5231
5095
  }
5232
- return metadataMap;
5096
+ return serializedMetadata;
5233
5097
  }
5234
5098
 
5235
5099
  // ../draco/src/lib/draco-parser.ts
@@ -5573,11 +5437,13 @@
5573
5437
  }
5574
5438
 
5575
5439
  // ../draco/src/lib/draco-module-loader.ts
5576
- var DRACO_VERSION = "1.4.1";
5577
- var DRACO_JS_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.js`;
5578
- var DRACO_WASM_WRAPPER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_wasm_wrapper.js`;
5579
- var DRACO_WASM_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.wasm`;
5580
- var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_VERSION}/javascript/draco_encoder.js`;
5440
+ var DRACO_DECODER_VERSION = "1.5.5";
5441
+ var DRACO_ENCODER_VERSION = "1.4.1";
5442
+ var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
5443
+ var DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
5444
+ var DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
5445
+ var DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
5446
+ var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
5581
5447
  var loadDecoderPromise;
5582
5448
  async function loadDracoDecoderModule(options) {
5583
5449
  const modules = options.modules || {};
@@ -5612,10 +5478,10 @@
5612
5478
  if (wasmBinary) {
5613
5479
  options.wasmBinary = wasmBinary;
5614
5480
  }
5615
- return new Promise((resolve) => {
5481
+ return new Promise((resolve2) => {
5616
5482
  DracoDecoderModule({
5617
5483
  ...options,
5618
- onModuleLoaded: (draco) => resolve({ draco })
5484
+ onModuleLoaded: (draco) => resolve2({ draco })
5619
5485
  });
5620
5486
  });
5621
5487
  }
@@ -5636,10 +5502,10 @@
5636
5502
  }
5637
5503
 
5638
5504
  // ../textures/src/lib/utils/version.ts
5639
- var VERSION6 = true ? "4.0.0-alpha.5" : "beta";
5505
+ var VERSION6 = true ? "4.0.0-alpha.6" : "beta";
5640
5506
 
5641
5507
  // ../textures/src/lib/parsers/basis-module-loader.ts
5642
- var VERSION7 = true ? "4.0.0-alpha.5" : "beta";
5508
+ var VERSION7 = true ? "4.0.0-alpha.6" : "beta";
5643
5509
  var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.wasm`;
5644
5510
  var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.js`;
5645
5511
  var loadBasisTranscoderPromise;
@@ -5666,11 +5532,11 @@
5666
5532
  if (wasmBinary) {
5667
5533
  options.wasmBinary = wasmBinary;
5668
5534
  }
5669
- return new Promise((resolve) => {
5670
- BasisModule(options).then((module2) => {
5671
- const { BasisFile, initializeBasis } = module2;
5535
+ return new Promise((resolve2) => {
5536
+ BasisModule(options).then((module) => {
5537
+ const { BasisFile, initializeBasis } = module;
5672
5538
  initializeBasis();
5673
- resolve({ BasisFile });
5539
+ resolve2({ BasisFile });
5674
5540
  });
5675
5541
  });
5676
5542
  }
@@ -5698,11 +5564,11 @@
5698
5564
  if (wasmBinary) {
5699
5565
  options.wasmBinary = wasmBinary;
5700
5566
  }
5701
- return new Promise((resolve) => {
5702
- BasisEncoderModule(options).then((module2) => {
5703
- const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module2;
5567
+ return new Promise((resolve2) => {
5568
+ BasisEncoderModule(options).then((module) => {
5569
+ const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;
5704
5570
  initializeBasis();
5705
- resolve({ BasisFile, KTX2File, BasisEncoder });
5571
+ resolve2({ BasisFile, KTX2File, BasisEncoder });
5706
5572
  });
5707
5573
  });
5708
5574
  }
@@ -6188,6 +6054,7 @@
6188
6054
  height,
6189
6055
  data: decodedData,
6190
6056
  compressed,
6057
+ levelSize: decodedSize,
6191
6058
  hasAlpha: alphaFlag,
6192
6059
  format
6193
6060
  };
@@ -6228,7 +6095,7 @@
6228
6095
  // ../textures/src/basis-loader.ts
6229
6096
  var BasisWorkerLoader = {
6230
6097
  name: "Basis",
6231
- id: "basis",
6098
+ id: isBrowser2 ? "basis" : "basis-nodejs",
6232
6099
  module: "textures",
6233
6100
  version: VERSION6,
6234
6101
  worker: true,
@@ -6605,7 +6472,7 @@
6605
6472
  }
6606
6473
 
6607
6474
  // ../../node_modules/@luma.gl/constants/dist/esm/index.js
6608
- var esm_default2 = {
6475
+ var esm_default = {
6609
6476
  DEPTH_BUFFER_BIT: 256,
6610
6477
  STENCIL_BUFFER_BIT: 1024,
6611
6478
  COLOR_BUFFER_BIT: 16384,
@@ -7240,11 +7107,11 @@
7240
7107
  }
7241
7108
  }
7242
7109
  var GL_TYPE_MAP = {
7243
- UInt8: esm_default2.UNSIGNED_BYTE,
7244
- UInt16: esm_default2.UNSIGNED_INT,
7245
- Float32: esm_default2.FLOAT,
7246
- UInt32: esm_default2.UNSIGNED_INT,
7247
- UInt64: esm_default2.DOUBLE
7110
+ UInt8: esm_default.UNSIGNED_BYTE,
7111
+ UInt16: esm_default.UNSIGNED_SHORT,
7112
+ Float32: esm_default.FLOAT,
7113
+ UInt32: esm_default.UNSIGNED_INT,
7114
+ UInt64: esm_default.DOUBLE
7248
7115
  };
7249
7116
  function sizeOf(dataType) {
7250
7117
  switch (dataType) {
@@ -7265,6 +7132,10 @@
7265
7132
  throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
7266
7133
  }
7267
7134
  }
7135
+ var STRING_ATTRIBUTE_TYPE = "String";
7136
+ var OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
7137
+ var FLOAT_64_TYPE = "Float64";
7138
+ var INT_16_ATTRIBUTE_TYPE = "Int16";
7268
7139
  var COORDINATE_SYSTEM;
7269
7140
  (function(COORDINATE_SYSTEM2) {
7270
7141
  COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["DEFAULT"] = -1] = "DEFAULT";
@@ -7274,6 +7145,145 @@
7274
7145
  COORDINATE_SYSTEM2[COORDINATE_SYSTEM2["CARTESIAN"] = 0] = "CARTESIAN";
7275
7146
  })(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
7276
7147
 
7148
+ // src/lib/parsers/parse-i3s-attribute.ts
7149
+ function parseI3STileAttribute(arrayBuffer, options) {
7150
+ const { attributeName, attributeType } = options;
7151
+ if (!attributeName) {
7152
+ return {};
7153
+ }
7154
+ return {
7155
+ [attributeName]: attributeType ? parseAttribute(attributeType, arrayBuffer) : null
7156
+ };
7157
+ }
7158
+ function parseAttribute(attributeType, arrayBuffer) {
7159
+ switch (attributeType) {
7160
+ case STRING_ATTRIBUTE_TYPE:
7161
+ return parseStringsAttribute(arrayBuffer);
7162
+ case OBJECT_ID_ATTRIBUTE_TYPE:
7163
+ return parseShortNumberAttribute(arrayBuffer);
7164
+ case FLOAT_64_TYPE:
7165
+ return parseFloatAttribute(arrayBuffer);
7166
+ case INT_16_ATTRIBUTE_TYPE:
7167
+ return parseInt16ShortNumberAttribute(arrayBuffer);
7168
+ default:
7169
+ return parseShortNumberAttribute(arrayBuffer);
7170
+ }
7171
+ }
7172
+ function parseShortNumberAttribute(arrayBuffer) {
7173
+ const countOffset = 4;
7174
+ return new Uint32Array(arrayBuffer, countOffset);
7175
+ }
7176
+ function parseInt16ShortNumberAttribute(arrayBuffer) {
7177
+ const countOffset = 4;
7178
+ return new Int16Array(arrayBuffer, countOffset);
7179
+ }
7180
+ function parseFloatAttribute(arrayBuffer) {
7181
+ const countOffset = 8;
7182
+ return new Float64Array(arrayBuffer, countOffset);
7183
+ }
7184
+ function parseStringsAttribute(arrayBuffer) {
7185
+ const stringsCountOffset = 0;
7186
+ const dataOffset = 8;
7187
+ const bytesPerStringSize = 4;
7188
+ const stringsArray = [];
7189
+ try {
7190
+ const stringsCount = new DataView(arrayBuffer, stringsCountOffset, bytesPerStringSize).getUint32(stringsCountOffset, true);
7191
+ const stringSizes = new Uint32Array(arrayBuffer, dataOffset, stringsCount);
7192
+ let stringOffset = dataOffset + stringsCount * bytesPerStringSize;
7193
+ for (const stringByteSize of stringSizes) {
7194
+ const textDecoder = new TextDecoder("utf-8");
7195
+ const stringAttribute = new Uint8Array(arrayBuffer, stringOffset, stringByteSize);
7196
+ stringsArray.push(textDecoder.decode(stringAttribute));
7197
+ stringOffset += stringByteSize;
7198
+ }
7199
+ } catch (error) {
7200
+ console.error("Parse string attribute error: ", error.message);
7201
+ }
7202
+ return stringsArray;
7203
+ }
7204
+
7205
+ // src/i3s-attribute-loader.ts
7206
+ var VERSION8 = true ? "4.0.0-alpha.6" : "latest";
7207
+ var I3SAttributeLoader = {
7208
+ name: "I3S Attribute",
7209
+ id: "i3s-attribute",
7210
+ module: "i3s",
7211
+ version: VERSION8,
7212
+ mimeTypes: ["application/binary"],
7213
+ parse: async (arrayBuffer, options) => parseI3STileAttribute(arrayBuffer, options),
7214
+ extensions: ["bin"],
7215
+ options: {},
7216
+ binary: true
7217
+ };
7218
+ function getAttributeValueType(attribute) {
7219
+ if (attribute.hasOwnProperty("objectIds")) {
7220
+ return "Oid32";
7221
+ } else if (attribute.hasOwnProperty("attributeValues")) {
7222
+ return attribute.attributeValues.valueType;
7223
+ }
7224
+ return "";
7225
+ }
7226
+
7227
+ // src/lib/utils/customizeColors.ts
7228
+ async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
7229
+ if (!options?.i3s?.colorsByAttribute) {
7230
+ return colors;
7231
+ }
7232
+ const colorizeAttributeField = tilesetOptions.fields.find(({ name }) => name === options?.i3s?.colorsByAttribute?.attributeName);
7233
+ if (!colorizeAttributeField || !["esriFieldTypeDouble", "esriFieldTypeInteger", "esriFieldTypeSmallInteger"].includes(colorizeAttributeField.type)) {
7234
+ return colors;
7235
+ }
7236
+ const colorizeAttributeData = await loadFeatureAttributeData(colorizeAttributeField.name, tileOptions, tilesetOptions, options);
7237
+ if (!colorizeAttributeData) {
7238
+ return colors;
7239
+ }
7240
+ const objectIdField = tilesetOptions.fields.find(({ type }) => type === "esriFieldTypeOID");
7241
+ if (!objectIdField) {
7242
+ return colors;
7243
+ }
7244
+ const objectIdAttributeData = await loadFeatureAttributeData(objectIdField.name, tileOptions, tilesetOptions, options);
7245
+ if (!objectIdAttributeData) {
7246
+ return colors;
7247
+ }
7248
+ const attributeValuesMap = {};
7249
+ for (let i2 = 0; i2 < objectIdAttributeData[objectIdField.name].length; i2++) {
7250
+ attributeValuesMap[objectIdAttributeData[objectIdField.name][i2]] = calculateColorForAttribute(colorizeAttributeData[colorizeAttributeField.name][i2], options);
7251
+ }
7252
+ for (let i2 = 0; i2 < featureIds.value.length; i2++) {
7253
+ const color = attributeValuesMap[featureIds.value[i2]];
7254
+ if (!color) {
7255
+ continue;
7256
+ }
7257
+ colors.value.set(color, i2 * 4);
7258
+ }
7259
+ return colors;
7260
+ }
7261
+ function calculateColorForAttribute(attributeValue, options) {
7262
+ if (!options?.i3s?.colorsByAttribute) {
7263
+ return [255, 255, 255, 255];
7264
+ }
7265
+ const { minValue, maxValue, minColor, maxColor } = options.i3s.colorsByAttribute;
7266
+ const rate = (attributeValue - minValue) / (maxValue - minValue);
7267
+ const color = [255, 255, 255, 255];
7268
+ for (let i2 = 0; i2 < minColor.length; i2++) {
7269
+ color[i2] = Math.round((maxColor[i2] - minColor[i2]) * rate + minColor[i2]);
7270
+ }
7271
+ return color;
7272
+ }
7273
+ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attributeStorageInfo }, options) {
7274
+ const attributeIndex = attributeStorageInfo.findIndex(({ name }) => attributeName === name);
7275
+ if (attributeIndex === -1) {
7276
+ return null;
7277
+ }
7278
+ const objectIdAttributeUrl = getUrlWithToken(attributeUrls[attributeIndex], options?.i3s?.token);
7279
+ const attributeType = getAttributeValueType(attributeStorageInfo[attributeIndex]);
7280
+ const objectIdAttributeData = await load(objectIdAttributeUrl, I3SAttributeLoader, {
7281
+ attributeName,
7282
+ attributeType
7283
+ });
7284
+ return objectIdAttributeData;
7285
+ }
7286
+
7277
7287
  // src/lib/parsers/parse-i3s-tile-content.ts
7278
7288
  var scratchVector5 = new Vector3([0, 0, 0]);
7279
7289
  function getLoaderForTextureFormat(textureFormat) {
@@ -7290,29 +7300,36 @@
7290
7300
  }
7291
7301
  }
7292
7302
  var I3S_ATTRIBUTE_TYPE = "i3s-attribute-type";
7293
- async function parseI3STileContent(arrayBuffer, tile, tileset, options, context) {
7294
- tile.content = tile.content || {};
7295
- tile.content.featureIds = tile.content.featureIds || null;
7296
- tile.content.attributes = {};
7297
- if (tile.textureUrl) {
7298
- const url = getUrlWithToken(tile.textureUrl, options?.i3s?.token);
7299
- const loader = getLoaderForTextureFormat(tile.textureFormat);
7300
- const response = await fetch(url);
7303
+ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, options, context) {
7304
+ const content = {
7305
+ attributes: {},
7306
+ indices: null,
7307
+ featureIds: [],
7308
+ vertexCount: 0,
7309
+ modelMatrix: new Matrix4(),
7310
+ coordinateSystem: 0,
7311
+ byteLength: 0,
7312
+ texture: null
7313
+ };
7314
+ if (tileOptions.textureUrl) {
7315
+ const url = getUrlWithToken(tileOptions.textureUrl, options?.i3s?.token);
7316
+ const loader = getLoaderForTextureFormat(tileOptions.textureFormat);
7317
+ const response = await fetch(url, options?.fetch);
7301
7318
  const arrayBuffer2 = await response.arrayBuffer();
7302
7319
  if (options?.i3s.decodeTextures) {
7303
7320
  if (loader === ImageLoader) {
7304
- const options2 = { ...tile.textureLoaderOptions, image: { type: "data" } };
7321
+ const options2 = { ...tileOptions.textureLoaderOptions, image: { type: "data" } };
7305
7322
  try {
7306
- tile.content.texture = await context.parse(arrayBuffer2, options2);
7323
+ content.texture = await context.parse(arrayBuffer2, options2);
7307
7324
  } catch (e2) {
7308
- tile.content.texture = await parse(arrayBuffer2, loader, options2);
7325
+ content.texture = await parse(arrayBuffer2, loader, options2);
7309
7326
  }
7310
7327
  } else if (loader === CompressedTextureLoader || loader === BasisLoader) {
7311
- let texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
7328
+ let texture = await load(arrayBuffer2, loader, tileOptions.textureLoaderOptions);
7312
7329
  if (loader === BasisLoader) {
7313
7330
  texture = texture[0];
7314
7331
  }
7315
- tile.content.texture = {
7332
+ content.texture = {
7316
7333
  compressed: true,
7317
7334
  mipmaps: false,
7318
7335
  width: texture[0].width,
@@ -7321,26 +7338,23 @@
7321
7338
  };
7322
7339
  }
7323
7340
  } else {
7324
- tile.content.texture = arrayBuffer2;
7341
+ content.texture = arrayBuffer2;
7325
7342
  }
7326
7343
  }
7327
- tile.content.material = makePbrMaterial(tile.materialDefinition, tile.content.texture);
7328
- if (tile.content.material) {
7329
- tile.content.texture = null;
7344
+ content.material = makePbrMaterial(tileOptions.materialDefinition, content.texture);
7345
+ if (content.material) {
7346
+ content.texture = null;
7330
7347
  }
7331
- return await parseI3SNodeGeometry(arrayBuffer, tile, tileset, options);
7348
+ return await parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options);
7332
7349
  }
7333
- async function parseI3SNodeGeometry(arrayBuffer, tile, tileset, options) {
7334
- if (!tile.content) {
7335
- return tile;
7336
- }
7337
- const content = tile.content;
7350
+ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOptions, options) {
7351
+ const contentByteLength = arrayBuffer.byteLength;
7338
7352
  let attributes;
7339
7353
  let vertexCount;
7340
7354
  let byteOffset = 0;
7341
7355
  let featureCount = 0;
7342
7356
  let indices;
7343
- if (tile.isDracoGeometry) {
7357
+ if (tileOptions.isDracoGeometry) {
7344
7358
  const decompressedGeometry = await parse(arrayBuffer, DracoLoader2, {
7345
7359
  draco: {
7346
7360
  attributeNameEntry: I3S_ATTRIBUTE_TYPE
@@ -7375,8 +7389,8 @@
7375
7389
  ordering: attributesOrder,
7376
7390
  featureAttributes,
7377
7391
  featureAttributeOrder
7378
- } = tileset.store.defaultGeometrySchema;
7379
- const headers = parseHeaders(tileset, arrayBuffer);
7392
+ } = tilesetOptions.store.defaultGeometrySchema;
7393
+ const headers = parseHeaders(arrayBuffer, tilesetOptions);
7380
7394
  byteOffset = headers.byteOffset;
7381
7395
  vertexCount = headers.vertexCount;
7382
7396
  featureCount = headers.featureCount;
@@ -7386,23 +7400,24 @@
7386
7400
  attributes = concatAttributes(normalizedVertexAttributes, normalizedFeatureAttributes);
7387
7401
  }
7388
7402
  if (!options?.i3s?.coordinateSystem || options.i3s.coordinateSystem === COORDINATE_SYSTEM.METER_OFFSETS) {
7389
- const enuMatrix = parsePositions(attributes.position, tile);
7403
+ const enuMatrix = parsePositions(attributes.position, tileOptions);
7390
7404
  content.modelMatrix = enuMatrix.invert();
7391
7405
  content.coordinateSystem = COORDINATE_SYSTEM.METER_OFFSETS;
7392
7406
  } else {
7393
7407
  content.modelMatrix = getModelMatrix(attributes.position);
7394
7408
  content.coordinateSystem = COORDINATE_SYSTEM.LNGLAT_OFFSETS;
7395
7409
  }
7410
+ attributes.color = await customizeColors(attributes.color, attributes.id, tileOptions, tilesetOptions, options);
7396
7411
  content.attributes = {
7397
7412
  positions: attributes.position,
7398
7413
  normals: attributes.normal,
7399
7414
  colors: normalizeAttribute(attributes.color),
7400
7415
  texCoords: attributes.uv0,
7401
- uvRegions: normalizeAttribute(attributes.uvRegion)
7416
+ uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
7402
7417
  };
7403
7418
  content.indices = indices || null;
7404
7419
  if (attributes.id && attributes.id.value) {
7405
- tile.content.featureIds = attributes.id.value;
7420
+ content.featureIds = attributes.id.value;
7406
7421
  }
7407
7422
  for (const attributeIndex in content.attributes) {
7408
7423
  if (!content.attributes[attributeIndex]) {
@@ -7410,8 +7425,8 @@
7410
7425
  }
7411
7426
  }
7412
7427
  content.vertexCount = vertexCount;
7413
- content.byteLength = arrayBuffer.byteLength;
7414
- return tile;
7428
+ content.byteLength = contentByteLength;
7429
+ return content;
7415
7430
  }
7416
7431
  function updateAttributesMetadata(attributes, decompressedGeometry) {
7417
7432
  for (const key in decompressedGeometry.loaderData.attributes) {
@@ -7438,11 +7453,11 @@
7438
7453
  attribute.normalized = true;
7439
7454
  return attribute;
7440
7455
  }
7441
- function parseHeaders(tileset, arrayBuffer) {
7456
+ function parseHeaders(arrayBuffer, options) {
7442
7457
  let byteOffset = 0;
7443
7458
  let vertexCount = 0;
7444
7459
  let featureCount = 0;
7445
- for (const { property, type } of tileset.store.defaultGeometrySchema.header) {
7460
+ for (const { property, type } of options.store.defaultGeometrySchema.header) {
7446
7461
  const TypedArrayTypeHeader = getConstructorForDataFormat(type);
7447
7462
  switch (property) {
7448
7463
  case HeaderAttributeProperty.vertexCount:
@@ -7463,38 +7478,38 @@
7463
7478
  byteOffset
7464
7479
  };
7465
7480
  }
7466
- function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder) {
7481
+ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
7467
7482
  const attributes = {};
7468
7483
  for (const attribute of attributesOrder) {
7469
7484
  if (vertexAttributes[attribute]) {
7470
7485
  const { valueType, valuesPerElement } = vertexAttributes[attribute];
7471
- const count = vertexCount;
7472
- if (byteOffset + count * valuesPerElement > arrayBuffer.byteLength) {
7486
+ if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <= arrayBuffer.byteLength) {
7487
+ const buffer = arrayBuffer.slice(byteOffset);
7488
+ let value;
7489
+ if (valueType === "UInt64") {
7490
+ value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
7491
+ } else {
7492
+ const TypedArrayType = getConstructorForDataFormat(valueType);
7493
+ value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
7494
+ }
7495
+ attributes[attribute] = {
7496
+ value,
7497
+ type: GL_TYPE_MAP[valueType],
7498
+ size: valuesPerElement
7499
+ };
7500
+ switch (attribute) {
7501
+ case "color":
7502
+ attributes.color.normalized = true;
7503
+ break;
7504
+ case "position":
7505
+ case "region":
7506
+ case "normal":
7507
+ default:
7508
+ }
7509
+ byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
7510
+ } else if (attribute !== "uv0") {
7473
7511
  break;
7474
7512
  }
7475
- const buffer = arrayBuffer.slice(byteOffset);
7476
- let value;
7477
- if (valueType === "UInt64") {
7478
- value = parseUint64Values(buffer, count * valuesPerElement, sizeOf(valueType));
7479
- } else {
7480
- const TypedArrayType = getConstructorForDataFormat(valueType);
7481
- value = new TypedArrayType(buffer, 0, count * valuesPerElement);
7482
- }
7483
- attributes[attribute] = {
7484
- value,
7485
- type: GL_TYPE_MAP[valueType],
7486
- size: valuesPerElement
7487
- };
7488
- switch (attribute) {
7489
- case "color":
7490
- attributes.color.normalized = true;
7491
- break;
7492
- case "position":
7493
- case "region":
7494
- case "normal":
7495
- default:
7496
- }
7497
- byteOffset = byteOffset + count * valuesPerElement * sizeOf(valueType);
7498
7513
  }
7499
7514
  }
7500
7515
  return { attributes, byteOffset };
@@ -7512,8 +7527,8 @@
7512
7527
  }
7513
7528
  return new Uint32Array(values);
7514
7529
  }
7515
- function parsePositions(attribute, tile) {
7516
- const mbs = tile.mbs;
7530
+ function parsePositions(attribute, options) {
7531
+ const mbs = options.mbs;
7517
7532
  const value = attribute.value;
7518
7533
  const metadata = attribute.metadata;
7519
7534
  const enuMatrix = new Matrix4();
@@ -7645,13 +7660,13 @@
7645
7660
  }
7646
7661
 
7647
7662
  // src/i3s-content-loader.ts
7648
- var VERSION8 = true ? "4.0.0-alpha.5" : "beta";
7663
+ var VERSION9 = true ? "4.0.0-alpha.6" : "beta";
7649
7664
  var I3SContentLoader = {
7650
7665
  name: "I3S Content (Indexed Scene Layers)",
7651
- id: "i3s-content",
7666
+ id: isBrowser2 ? "i3s-content" : "i3s-content-nodejs",
7652
7667
  module: "i3s",
7653
7668
  worker: true,
7654
- version: VERSION8,
7669
+ version: VERSION9,
7655
7670
  mimeTypes: ["application/octet-stream"],
7656
7671
  parse: parse3,
7657
7672
  extensions: ["bin"],
@@ -7660,9 +7675,13 @@
7660
7675
  }
7661
7676
  };
7662
7677
  async function parse3(data, options, context) {
7663
- const { tile, tileset } = options?.i3s || {};
7664
- await parseI3STileContent(data, tile, tileset, options, context);
7665
- return tile.content;
7678
+ const { tile, _tileOptions, tileset, _tilesetOptions } = options?.i3s || {};
7679
+ const tileOptions = _tileOptions || tile;
7680
+ const tilesetOptions = _tilesetOptions || tileset;
7681
+ if (!tileOptions || !tilesetOptions) {
7682
+ return null;
7683
+ }
7684
+ return await parseI3STileContent(data, tileOptions, tilesetOptions, options, context);
7666
7685
  }
7667
7686
 
7668
7687
  // src/workers/i3s-content-worker.ts