@loaders.gl/3d-tiles 3.1.6 → 3.2.0-alpha.1

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 (25) hide show
  1. package/dist/dist.min.js +817 -93
  2. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +31 -63
  3. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  4. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  5. package/dist/es5/lib/parsers/parse-3d-tile-header.js +4 -1
  6. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
  7. package/dist/es5/lib/utils/version.js +1 -1
  8. package/dist/es5/lib/utils/version.js.map +1 -1
  9. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +30 -13
  10. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  11. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  12. package/dist/esm/lib/parsers/parse-3d-tile-header.js +4 -1
  13. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
  14. package/dist/esm/lib/utils/version.js +1 -1
  15. package/dist/esm/lib/utils/version.js.map +1 -1
  16. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +18 -11
  17. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
  18. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +22 -14
  19. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +1 -1
  20. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
  21. package/dist/lib/parsers/parse-3d-tile-header.js +1 -1
  22. package/package.json +8 -8
  23. package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +31 -25
  24. package/src/lib/parsers/{parse-3d-tile-gltf.js → parse-3d-tile-gltf.ts} +0 -0
  25. package/src/lib/parsers/parse-3d-tile-header.ts +1 -1
package/dist/dist.min.js CHANGED
@@ -64,7 +64,7 @@
64
64
  var DEFAULT_VERSION, VERSION;
65
65
  var init_version = __esm({
66
66
  "../worker-utils/src/lib/env-utils/version.ts"() {
67
- DEFAULT_VERSION = "latest";
67
+ DEFAULT_VERSION = "beta";
68
68
  VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : DEFAULT_VERSION;
69
69
  if (typeof __VERSION__ === "undefined") {
70
70
  console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
@@ -112,13 +112,13 @@
112
112
  init_assert2();
113
113
  WorkerJob = class {
114
114
  constructor(jobName, workerThread) {
115
- this.name = jobName;
116
- this.workerThread = workerThread;
117
115
  this.isRunning = true;
118
116
  this._resolve = () => {
119
117
  };
120
118
  this._reject = () => {
121
119
  };
120
+ this.name = jobName;
121
+ this.workerThread = workerThread;
122
122
  this.result = new Promise((resolve, reject) => {
123
123
  this._resolve = resolve;
124
124
  this._reject = reject;
@@ -145,6 +145,21 @@
145
145
  }
146
146
  });
147
147
 
148
+ // ../worker-utils/src/lib/node/worker_threads-browser.js
149
+ var Worker2;
150
+ var init_worker_threads_browser = __esm({
151
+ "../worker-utils/src/lib/node/worker_threads-browser.js"() {
152
+ Worker2 = class {
153
+ on(message, cb) {
154
+ }
155
+ postMessage(...args) {
156
+ }
157
+ terminate() {
158
+ }
159
+ };
160
+ }
161
+ });
162
+
148
163
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
149
164
  function getLoadableWorkerURL(props) {
150
165
  assert3(props.source && !props.url || !props.source && props.url);
@@ -232,6 +247,8 @@
232
247
  var NOOP, WorkerThread;
233
248
  var init_worker_thread = __esm({
234
249
  "../worker-utils/src/lib/worker-farm/worker-thread.ts"() {
250
+ init_worker_threads_browser();
251
+ init_globals2();
235
252
  init_assert2();
236
253
  init_get_loadable_worker_url();
237
254
  init_get_transfer_list();
@@ -248,10 +265,10 @@
248
265
  this.url = url;
249
266
  this.onMessage = NOOP;
250
267
  this.onError = (error) => console.log(error);
251
- this.worker = this._createBrowserWorker();
268
+ this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
252
269
  }
253
270
  static isSupported() {
254
- return typeof Worker !== "undefined";
271
+ return typeof Worker !== "undefined" && isBrowser2;
255
272
  }
256
273
  destroy() {
257
274
  this.onMessage = NOOP;
@@ -294,6 +311,27 @@
294
311
  worker.onmessageerror = (event) => console.error(event);
295
312
  return worker;
296
313
  }
314
+ _createNodeWorker() {
315
+ let worker;
316
+ if (this.url) {
317
+ const absolute = this.url.includes(":/") || this.url.startsWith("/");
318
+ const url = absolute ? this.url : `./${this.url}`;
319
+ worker = new Worker2(url, { eval: false });
320
+ } else if (this.source) {
321
+ worker = new Worker2(this.source, { eval: true });
322
+ } else {
323
+ throw new Error("no worker");
324
+ }
325
+ worker.on("message", (data) => {
326
+ this.onMessage(data);
327
+ });
328
+ worker.on("error", (error) => {
329
+ this.onError(error);
330
+ });
331
+ worker.on("exit", (code) => {
332
+ });
333
+ return worker;
334
+ }
297
335
  };
298
336
  }
299
337
  });
@@ -322,6 +360,9 @@
322
360
  this.url = props.url;
323
361
  this.setProps(props);
324
362
  }
363
+ static isSupported() {
364
+ return WorkerThread.isSupported();
365
+ }
325
366
  destroy() {
326
367
  this.idleQueue.forEach((worker) => worker.destroy());
327
368
  this.isDestroyed = true;
@@ -418,9 +459,9 @@
418
459
  DEFAULT_PROPS = {
419
460
  maxConcurrency: 3,
420
461
  maxMobileConcurrency: 1,
462
+ reuseWorkers: true,
421
463
  onDebug: () => {
422
- },
423
- reuseWorkers: true
464
+ }
424
465
  };
425
466
  WorkerFarm = class {
426
467
  constructor(props) {
@@ -441,6 +482,7 @@
441
482
  for (const workerPool of this.workerPools.values()) {
442
483
  workerPool.destroy();
443
484
  }
485
+ this.workerPools = new Map();
444
486
  }
445
487
  setProps(props) {
446
488
  this.props = { ...this.props, ...props };
@@ -500,7 +542,7 @@
500
542
  var init_get_worker_url = __esm({
501
543
  "../worker-utils/src/lib/worker-api/get-worker-url.ts"() {
502
544
  init_assert2();
503
- NPM_TAG = "latest";
545
+ NPM_TAG = "beta";
504
546
  }
505
547
  });
506
548
 
@@ -598,7 +640,7 @@
598
640
  node = __toModule(require_require_utils());
599
641
  init_assert2();
600
642
  init_version();
601
- LATEST = "latest";
643
+ LATEST = "beta";
602
644
  VERSION2 = typeof VERSION !== "undefined" ? VERSION : LATEST;
603
645
  loadLibraryPromises = {};
604
646
  }
@@ -608,6 +650,7 @@
608
650
  var init_src = __esm({
609
651
  "../worker-utils/src/index.ts"() {
610
652
  init_assert2();
653
+ init_globals2();
611
654
  init_worker_farm();
612
655
  init_get_worker_url();
613
656
  init_validate_worker_version();
@@ -620,6 +663,9 @@
620
663
  if (!WorkerFarm.isSupported()) {
621
664
  return false;
622
665
  }
666
+ if (!isBrowser2 && !options?._nodeWorkers) {
667
+ return false;
668
+ }
623
669
  return loader.worker && options?.worker;
624
670
  }
625
671
  async function parseWithWorker(loader, data, options, context, parseOnMainThread) {
@@ -661,6 +707,7 @@
661
707
  var init_parse_with_worker = __esm({
662
708
  "../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts"() {
663
709
  init_src();
710
+ init_src();
664
711
  }
665
712
  });
666
713
 
@@ -879,6 +926,25 @@
879
926
  }
880
927
  });
881
928
 
929
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
930
+ function _defineProperty(obj, key, value) {
931
+ if (key in obj) {
932
+ Object.defineProperty(obj, key, {
933
+ value,
934
+ enumerable: true,
935
+ configurable: true,
936
+ writable: true
937
+ });
938
+ } else {
939
+ obj[key] = value;
940
+ }
941
+ return obj;
942
+ }
943
+ var init_defineProperty = __esm({
944
+ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
945
+ }
946
+ });
947
+
882
948
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
883
949
  function resolvePath(filename2) {
884
950
  for (const alias in fileAliases) {
@@ -4993,29 +5059,29 @@
4993
5059
  }
4994
5060
  });
4995
5061
 
4996
- // ../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
5062
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
4997
5063
  var init_hi_res_timestamp2 = __esm({
4998
- "../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
5064
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
4999
5065
  }
5000
5066
  });
5001
5067
 
5002
- // ../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js
5068
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js
5003
5069
  var init_stat = __esm({
5004
- "../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
5070
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
5005
5071
  init_hi_res_timestamp2();
5006
5072
  }
5007
5073
  });
5008
5074
 
5009
- // ../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js
5075
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js
5010
5076
  var init_stats = __esm({
5011
- "../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
5077
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
5012
5078
  init_stat();
5013
5079
  }
5014
5080
  });
5015
5081
 
5016
- // ../../node_modules/@probe.gl/stats/dist/esm/index.js
5082
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js
5017
5083
  var init_esm3 = __esm({
5018
- "../../node_modules/@probe.gl/stats/dist/esm/index.js"() {
5084
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js"() {
5019
5085
  init_stats();
5020
5086
  init_stat();
5021
5087
  init_hi_res_timestamp2();
@@ -5083,6 +5149,7 @@
5083
5149
  var DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS;
5084
5150
  var init_option_defaults = __esm({
5085
5151
  "../core/src/lib/loader-utils/option-defaults.ts"() {
5152
+ init_src2();
5086
5153
  init_loggers();
5087
5154
  DEFAULT_LOADER_OPTIONS = {
5088
5155
  fetch: null,
@@ -5093,7 +5160,8 @@
5093
5160
  worker: true,
5094
5161
  maxConcurrency: 3,
5095
5162
  maxMobileConcurrency: 1,
5096
- reuseWorkers: true,
5163
+ reuseWorkers: isBrowser,
5164
+ _nodeWorkers: false,
5097
5165
  _workerType: "",
5098
5166
  limit: 0,
5099
5167
  _limitMB: 0,
@@ -5291,6 +5359,638 @@
5291
5359
  }
5292
5360
  });
5293
5361
 
5362
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js
5363
+ function isElectron2(mockUserAgent) {
5364
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
5365
+ return true;
5366
+ }
5367
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
5368
+ return true;
5369
+ }
5370
+ const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
5371
+ const userAgent = mockUserAgent || realUserAgent;
5372
+ if (userAgent && userAgent.indexOf("Electron") >= 0) {
5373
+ return true;
5374
+ }
5375
+ return false;
5376
+ }
5377
+ var init_is_electron2 = __esm({
5378
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js"() {
5379
+ }
5380
+ });
5381
+
5382
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js
5383
+ function isBrowser5() {
5384
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
5385
+ return !isNode || isElectron2();
5386
+ }
5387
+ var init_is_browser2 = __esm({
5388
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js"() {
5389
+ init_is_electron2();
5390
+ }
5391
+ });
5392
+
5393
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/globals.js
5394
+ var globals5, self_4, window_4, document_4, process_2;
5395
+ var init_globals5 = __esm({
5396
+ "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js"() {
5397
+ globals5 = {
5398
+ self: typeof self !== "undefined" && self,
5399
+ window: typeof window !== "undefined" && window,
5400
+ global: typeof global !== "undefined" && global,
5401
+ document: typeof document !== "undefined" && document,
5402
+ process: typeof process === "object" && process
5403
+ };
5404
+ self_4 = globals5.self || globals5.window || globals5.global;
5405
+ window_4 = globals5.window || globals5.self || globals5.global;
5406
+ document_4 = globals5.document || {};
5407
+ process_2 = globals5.process || {};
5408
+ }
5409
+ });
5410
+
5411
+ // ../../node_modules/@probe.gl/env/dist/esm/utils/globals.js
5412
+ var VERSION4, isBrowser6;
5413
+ var init_globals6 = __esm({
5414
+ "../../node_modules/@probe.gl/env/dist/esm/utils/globals.js"() {
5415
+ init_is_browser2();
5416
+ VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
5417
+ isBrowser6 = isBrowser5();
5418
+ }
5419
+ });
5420
+
5421
+ // ../../node_modules/@probe.gl/env/dist/esm/index.js
5422
+ var init_esm5 = __esm({
5423
+ "../../node_modules/@probe.gl/env/dist/esm/index.js"() {
5424
+ init_globals6();
5425
+ init_globals5();
5426
+ init_is_browser2();
5427
+ }
5428
+ });
5429
+
5430
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js
5431
+ function getStorage2(type) {
5432
+ try {
5433
+ const storage = window[type];
5434
+ const x = "__storage_test__";
5435
+ storage.setItem(x, x);
5436
+ storage.removeItem(x);
5437
+ return storage;
5438
+ } catch (e) {
5439
+ return null;
5440
+ }
5441
+ }
5442
+ var LocalStorage2;
5443
+ var init_local_storage2 = __esm({
5444
+ "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js"() {
5445
+ init_defineProperty();
5446
+ LocalStorage2 = class {
5447
+ constructor(id) {
5448
+ let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
5449
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
5450
+ _defineProperty(this, "storage", void 0);
5451
+ _defineProperty(this, "id", void 0);
5452
+ _defineProperty(this, "config", {});
5453
+ this.storage = getStorage2(type);
5454
+ this.id = id;
5455
+ this.config = {};
5456
+ Object.assign(this.config, defaultSettings);
5457
+ this._loadConfiguration();
5458
+ }
5459
+ getConfiguration() {
5460
+ return this.config;
5461
+ }
5462
+ setConfiguration(configuration) {
5463
+ this.config = {};
5464
+ return this.updateConfiguration(configuration);
5465
+ }
5466
+ updateConfiguration(configuration) {
5467
+ Object.assign(this.config, configuration);
5468
+ if (this.storage) {
5469
+ const serialized = JSON.stringify(this.config);
5470
+ this.storage.setItem(this.id, serialized);
5471
+ }
5472
+ return this;
5473
+ }
5474
+ _loadConfiguration() {
5475
+ let configuration = {};
5476
+ if (this.storage) {
5477
+ const serializedConfiguration = this.storage.getItem(this.id);
5478
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
5479
+ }
5480
+ Object.assign(this.config, configuration);
5481
+ return this;
5482
+ }
5483
+ };
5484
+ }
5485
+ });
5486
+
5487
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js
5488
+ function formatTime2(ms) {
5489
+ let formatted;
5490
+ if (ms < 10) {
5491
+ formatted = "".concat(ms.toFixed(2), "ms");
5492
+ } else if (ms < 100) {
5493
+ formatted = "".concat(ms.toFixed(1), "ms");
5494
+ } else if (ms < 1e3) {
5495
+ formatted = "".concat(ms.toFixed(0), "ms");
5496
+ } else {
5497
+ formatted = "".concat((ms / 1e3).toFixed(2), "s");
5498
+ }
5499
+ return formatted;
5500
+ }
5501
+ function leftPad2(string) {
5502
+ let length4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
5503
+ const padLength = Math.max(length4 - string.length, 0);
5504
+ return "".concat(" ".repeat(padLength)).concat(string);
5505
+ }
5506
+ function formatImage2(image, message, scale5) {
5507
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
5508
+ const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
5509
+ if (image.width > maxWidth) {
5510
+ scale5 = Math.min(scale5, maxWidth / image.width);
5511
+ }
5512
+ const width = image.width * scale5;
5513
+ const height = image.height * scale5;
5514
+ const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
5515
+ return ["".concat(message, " %c+"), style];
5516
+ }
5517
+ var init_formatters2 = __esm({
5518
+ "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js"() {
5519
+ }
5520
+ });
5521
+
5522
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/color.js
5523
+ function getColor2(color) {
5524
+ return typeof color === "string" ? COLOR2[color.toUpperCase()] || COLOR2.WHITE : color;
5525
+ }
5526
+ function addColor2(string, color, background) {
5527
+ if (!isBrowser5 && typeof string === "string") {
5528
+ if (color) {
5529
+ color = getColor2(color);
5530
+ string = "[".concat(color, "m").concat(string, "");
5531
+ }
5532
+ if (background) {
5533
+ color = getColor2(background);
5534
+ string = "[".concat(background + 10, "m").concat(string, "");
5535
+ }
5536
+ }
5537
+ return string;
5538
+ }
5539
+ var COLOR2;
5540
+ var init_color2 = __esm({
5541
+ "../../node_modules/@probe.gl/log/dist/esm/utils/color.js"() {
5542
+ init_esm5();
5543
+ (function(COLOR3) {
5544
+ COLOR3[COLOR3["BLACK"] = 30] = "BLACK";
5545
+ COLOR3[COLOR3["RED"] = 31] = "RED";
5546
+ COLOR3[COLOR3["GREEN"] = 32] = "GREEN";
5547
+ COLOR3[COLOR3["YELLOW"] = 33] = "YELLOW";
5548
+ COLOR3[COLOR3["BLUE"] = 34] = "BLUE";
5549
+ COLOR3[COLOR3["MAGENTA"] = 35] = "MAGENTA";
5550
+ COLOR3[COLOR3["CYAN"] = 36] = "CYAN";
5551
+ COLOR3[COLOR3["WHITE"] = 37] = "WHITE";
5552
+ COLOR3[COLOR3["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
5553
+ COLOR3[COLOR3["BRIGHT_RED"] = 91] = "BRIGHT_RED";
5554
+ COLOR3[COLOR3["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
5555
+ COLOR3[COLOR3["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
5556
+ COLOR3[COLOR3["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
5557
+ COLOR3[COLOR3["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
5558
+ COLOR3[COLOR3["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
5559
+ COLOR3[COLOR3["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
5560
+ })(COLOR2 || (COLOR2 = {}));
5561
+ }
5562
+ });
5563
+
5564
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js
5565
+ function autobind2(obj) {
5566
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
5567
+ const proto = Object.getPrototypeOf(obj);
5568
+ const propNames = Object.getOwnPropertyNames(proto);
5569
+ for (const key of propNames) {
5570
+ if (typeof obj[key] === "function") {
5571
+ if (!predefined.find((name8) => key === name8)) {
5572
+ obj[key] = obj[key].bind(obj);
5573
+ }
5574
+ }
5575
+ }
5576
+ }
5577
+ var init_autobind2 = __esm({
5578
+ "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js"() {
5579
+ }
5580
+ });
5581
+
5582
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/assert.js
5583
+ function assert6(condition, message) {
5584
+ if (!condition) {
5585
+ throw new Error(message || "Assertion failed");
5586
+ }
5587
+ }
5588
+ var init_assert5 = __esm({
5589
+ "../../node_modules/@probe.gl/log/dist/esm/utils/assert.js"() {
5590
+ }
5591
+ });
5592
+
5593
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js
5594
+ function getHiResTimestamp3() {
5595
+ let timestamp;
5596
+ if (isBrowser5 && "performance" in window_4) {
5597
+ var _window$performance, _window$performance$n;
5598
+ timestamp = window_4 === null || window_4 === void 0 ? void 0 : (_window$performance = window_4.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);
5599
+ } else if ("hrtime" in process_2) {
5600
+ var _process$hrtime;
5601
+ const timeParts = process_2 === null || process_2 === void 0 ? void 0 : (_process$hrtime = process_2.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_2);
5602
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
5603
+ } else {
5604
+ timestamp = Date.now();
5605
+ }
5606
+ return timestamp;
5607
+ }
5608
+ var init_hi_res_timestamp3 = __esm({
5609
+ "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js"() {
5610
+ init_esm5();
5611
+ }
5612
+ });
5613
+
5614
+ // ../../node_modules/@probe.gl/log/dist/esm/log.js
5615
+ function noop3() {
5616
+ }
5617
+ function normalizeLogLevel2(logLevel) {
5618
+ if (!logLevel) {
5619
+ return 0;
5620
+ }
5621
+ let resolvedLevel;
5622
+ switch (typeof logLevel) {
5623
+ case "number":
5624
+ resolvedLevel = logLevel;
5625
+ break;
5626
+ case "object":
5627
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
5628
+ break;
5629
+ default:
5630
+ return 0;
5631
+ }
5632
+ assert6(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
5633
+ return resolvedLevel;
5634
+ }
5635
+ function normalizeArguments2(opts) {
5636
+ const {
5637
+ logLevel,
5638
+ message
5639
+ } = opts;
5640
+ opts.logLevel = normalizeLogLevel2(logLevel);
5641
+ const args = opts.args ? Array.from(opts.args) : [];
5642
+ while (args.length && args.shift() !== message) {
5643
+ }
5644
+ switch (typeof logLevel) {
5645
+ case "string":
5646
+ case "function":
5647
+ if (message !== void 0) {
5648
+ args.unshift(message);
5649
+ }
5650
+ opts.message = logLevel;
5651
+ break;
5652
+ case "object":
5653
+ Object.assign(opts, logLevel);
5654
+ break;
5655
+ default:
5656
+ }
5657
+ if (typeof opts.message === "function") {
5658
+ opts.message = opts.message();
5659
+ }
5660
+ const messageType = typeof opts.message;
5661
+ assert6(messageType === "string" || messageType === "object");
5662
+ return Object.assign(opts, {
5663
+ args
5664
+ }, opts.opts);
5665
+ }
5666
+ function decorateMessage2(id, message, opts) {
5667
+ if (typeof message === "string") {
5668
+ const time = opts.time ? leftPad2(formatTime2(opts.total)) : "";
5669
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
5670
+ message = addColor2(message, opts.color, opts.background);
5671
+ }
5672
+ return message;
5673
+ }
5674
+ function logImageInNode2(_ref2) {
5675
+ let {
5676
+ image,
5677
+ message = "",
5678
+ scale: scale5 = 1
5679
+ } = _ref2;
5680
+ let asciify = null;
5681
+ try {
5682
+ asciify = module.require("asciify-image");
5683
+ } catch (error) {
5684
+ }
5685
+ if (asciify) {
5686
+ return () => asciify(image, {
5687
+ fit: "box",
5688
+ width: "".concat(Math.round(80 * scale5), "%")
5689
+ }).then((data) => console.log(data));
5690
+ }
5691
+ return noop3;
5692
+ }
5693
+ function logImageInBrowser2(_ref3) {
5694
+ let {
5695
+ image,
5696
+ message = "",
5697
+ scale: scale5 = 1
5698
+ } = _ref3;
5699
+ if (typeof image === "string") {
5700
+ const img = new Image();
5701
+ img.onload = () => {
5702
+ const args = formatImage2(img, message, scale5);
5703
+ console.log(...args);
5704
+ };
5705
+ img.src = image;
5706
+ return noop3;
5707
+ }
5708
+ const element = image.nodeName || "";
5709
+ if (element.toLowerCase() === "img") {
5710
+ console.log(...formatImage2(image, message, scale5));
5711
+ return noop3;
5712
+ }
5713
+ if (element.toLowerCase() === "canvas") {
5714
+ const img = new Image();
5715
+ img.onload = () => console.log(...formatImage2(img, message, scale5));
5716
+ img.src = image.toDataURL();
5717
+ return noop3;
5718
+ }
5719
+ return noop3;
5720
+ }
5721
+ function getTableHeader2(table) {
5722
+ for (const key in table) {
5723
+ for (const title in table[key]) {
5724
+ return title || "untitled";
5725
+ }
5726
+ }
5727
+ return "empty";
5728
+ }
5729
+ var originalConsole2, DEFAULT_SETTINGS2, cache2, ONCE2, Log2;
5730
+ var init_log2 = __esm({
5731
+ "../../node_modules/@probe.gl/log/dist/esm/log.js"() {
5732
+ init_defineProperty();
5733
+ init_esm5();
5734
+ init_local_storage2();
5735
+ init_formatters2();
5736
+ init_color2();
5737
+ init_autobind2();
5738
+ init_assert5();
5739
+ init_hi_res_timestamp3();
5740
+ originalConsole2 = {
5741
+ debug: isBrowser5 ? console.debug || console.log : console.log,
5742
+ log: console.log,
5743
+ info: console.info,
5744
+ warn: console.warn,
5745
+ error: console.error
5746
+ };
5747
+ DEFAULT_SETTINGS2 = {
5748
+ enabled: true,
5749
+ level: 0
5750
+ };
5751
+ cache2 = {};
5752
+ ONCE2 = {
5753
+ once: true
5754
+ };
5755
+ Log2 = class {
5756
+ constructor() {
5757
+ let {
5758
+ id
5759
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
5760
+ id: ""
5761
+ };
5762
+ _defineProperty(this, "id", void 0);
5763
+ _defineProperty(this, "VERSION", VERSION4);
5764
+ _defineProperty(this, "_startTs", getHiResTimestamp3());
5765
+ _defineProperty(this, "_deltaTs", getHiResTimestamp3());
5766
+ _defineProperty(this, "_storage", void 0);
5767
+ _defineProperty(this, "userData", {});
5768
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
5769
+ this.id = id;
5770
+ this._storage = new LocalStorage2("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS2);
5771
+ this.userData = {};
5772
+ this.timeStamp("".concat(this.id, " started"));
5773
+ autobind2(this);
5774
+ Object.seal(this);
5775
+ }
5776
+ set level(newLevel) {
5777
+ this.setLevel(newLevel);
5778
+ }
5779
+ get level() {
5780
+ return this.getLevel();
5781
+ }
5782
+ isEnabled() {
5783
+ return this._storage.config.enabled;
5784
+ }
5785
+ getLevel() {
5786
+ return this._storage.config.level;
5787
+ }
5788
+ getTotal() {
5789
+ return Number((getHiResTimestamp3() - this._startTs).toPrecision(10));
5790
+ }
5791
+ getDelta() {
5792
+ return Number((getHiResTimestamp3() - this._deltaTs).toPrecision(10));
5793
+ }
5794
+ set priority(newPriority) {
5795
+ this.level = newPriority;
5796
+ }
5797
+ get priority() {
5798
+ return this.level;
5799
+ }
5800
+ getPriority() {
5801
+ return this.level;
5802
+ }
5803
+ enable() {
5804
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
5805
+ this._storage.updateConfiguration({
5806
+ enabled
5807
+ });
5808
+ return this;
5809
+ }
5810
+ setLevel(level) {
5811
+ this._storage.updateConfiguration({
5812
+ level
5813
+ });
5814
+ return this;
5815
+ }
5816
+ get(setting) {
5817
+ return this._storage.config[setting];
5818
+ }
5819
+ set(setting, value) {
5820
+ this._storage.updateConfiguration({
5821
+ [setting]: value
5822
+ });
5823
+ }
5824
+ settings() {
5825
+ if (console.table) {
5826
+ console.table(this._storage.config);
5827
+ } else {
5828
+ console.log(this._storage.config);
5829
+ }
5830
+ }
5831
+ assert(condition, message) {
5832
+ assert6(condition, message);
5833
+ }
5834
+ warn(message) {
5835
+ return this._getLogFunction(0, message, originalConsole2.warn, arguments, ONCE2);
5836
+ }
5837
+ error(message) {
5838
+ return this._getLogFunction(0, message, originalConsole2.error, arguments);
5839
+ }
5840
+ deprecated(oldUsage, newUsage) {
5841
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
5842
+ }
5843
+ removed(oldUsage, newUsage) {
5844
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
5845
+ }
5846
+ probe(logLevel, message) {
5847
+ return this._getLogFunction(logLevel, message, originalConsole2.log, arguments, {
5848
+ time: true,
5849
+ once: true
5850
+ });
5851
+ }
5852
+ log(logLevel, message) {
5853
+ return this._getLogFunction(logLevel, message, originalConsole2.debug, arguments);
5854
+ }
5855
+ info(logLevel, message) {
5856
+ return this._getLogFunction(logLevel, message, console.info, arguments);
5857
+ }
5858
+ once(logLevel, message) {
5859
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
5860
+ args[_key - 2] = arguments[_key];
5861
+ }
5862
+ return this._getLogFunction(logLevel, message, originalConsole2.debug || originalConsole2.info, arguments, ONCE2);
5863
+ }
5864
+ table(logLevel, table, columns) {
5865
+ if (table) {
5866
+ return this._getLogFunction(logLevel, table, console.table || noop3, columns && [columns], {
5867
+ tag: getTableHeader2(table)
5868
+ });
5869
+ }
5870
+ return noop3;
5871
+ }
5872
+ image(_ref) {
5873
+ let {
5874
+ logLevel,
5875
+ priority,
5876
+ image,
5877
+ message = "",
5878
+ scale: scale5 = 1
5879
+ } = _ref;
5880
+ if (!this._shouldLog(logLevel || priority)) {
5881
+ return noop3;
5882
+ }
5883
+ return isBrowser5 ? logImageInBrowser2({
5884
+ image,
5885
+ message,
5886
+ scale: scale5
5887
+ }) : logImageInNode2({
5888
+ image,
5889
+ message,
5890
+ scale: scale5
5891
+ });
5892
+ }
5893
+ time(logLevel, message) {
5894
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
5895
+ }
5896
+ timeEnd(logLevel, message) {
5897
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
5898
+ }
5899
+ timeStamp(logLevel, message) {
5900
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop3);
5901
+ }
5902
+ group(logLevel, message) {
5903
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
5904
+ collapsed: false
5905
+ };
5906
+ const options = normalizeArguments2({
5907
+ logLevel,
5908
+ message,
5909
+ opts
5910
+ });
5911
+ const {
5912
+ collapsed
5913
+ } = opts;
5914
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
5915
+ return this._getLogFunction(options);
5916
+ }
5917
+ groupCollapsed(logLevel, message) {
5918
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
5919
+ return this.group(logLevel, message, Object.assign({}, opts, {
5920
+ collapsed: true
5921
+ }));
5922
+ }
5923
+ groupEnd(logLevel) {
5924
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop3);
5925
+ }
5926
+ withGroup(logLevel, message, func) {
5927
+ this.group(logLevel, message)();
5928
+ try {
5929
+ func();
5930
+ } finally {
5931
+ this.groupEnd(logLevel)();
5932
+ }
5933
+ }
5934
+ trace() {
5935
+ if (console.trace) {
5936
+ console.trace();
5937
+ }
5938
+ }
5939
+ _shouldLog(logLevel) {
5940
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel2(logLevel);
5941
+ }
5942
+ _getLogFunction(logLevel, message, method, args, opts) {
5943
+ if (this._shouldLog(logLevel)) {
5944
+ opts = normalizeArguments2({
5945
+ logLevel,
5946
+ message,
5947
+ args,
5948
+ opts
5949
+ });
5950
+ method = method || opts.method;
5951
+ assert6(method);
5952
+ opts.total = this.getTotal();
5953
+ opts.delta = this.getDelta();
5954
+ this._deltaTs = getHiResTimestamp3();
5955
+ const tag = opts.tag || opts.message;
5956
+ if (opts.once) {
5957
+ if (!cache2[tag]) {
5958
+ cache2[tag] = getHiResTimestamp3();
5959
+ } else {
5960
+ return noop3;
5961
+ }
5962
+ }
5963
+ message = decorateMessage2(this.id, opts.message, opts);
5964
+ return method.bind(console, message, ...opts.args);
5965
+ }
5966
+ return noop3;
5967
+ }
5968
+ };
5969
+ _defineProperty(Log2, "VERSION", VERSION4);
5970
+ }
5971
+ });
5972
+
5973
+ // ../../node_modules/@probe.gl/log/dist/esm/index.js
5974
+ var esm_default2;
5975
+ var init_esm6 = __esm({
5976
+ "../../node_modules/@probe.gl/log/dist/esm/index.js"() {
5977
+ init_log2();
5978
+ init_log2();
5979
+ esm_default2 = new Log2({
5980
+ id: "@probe.gl/log"
5981
+ });
5982
+ }
5983
+ });
5984
+
5985
+ // ../core/src/lib/utils/log.ts
5986
+ var log;
5987
+ var init_log3 = __esm({
5988
+ "../core/src/lib/utils/log.ts"() {
5989
+ init_esm6();
5990
+ log = new Log2({ id: "loaders.gl" });
5991
+ }
5992
+ });
5993
+
5294
5994
  // ../core/src/lib/api/select-loader.ts
5295
5995
  async function selectLoader(data, loaders = [], options, context) {
5296
5996
  if (!validHTTPResponse(data)) {
@@ -5334,13 +6034,22 @@
5334
6034
  const { url, type } = getResourceUrlAndType(data);
5335
6035
  const testUrl = url || context?.url;
5336
6036
  let loader = null;
6037
+ let reason = "";
5337
6038
  if (options?.mimeType) {
5338
6039
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
6040
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
5339
6041
  }
5340
6042
  loader = loader || findLoaderByUrl(loaders, testUrl);
6043
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
5341
6044
  loader = loader || findLoaderByMIMEType(loaders, type);
6045
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
5342
6046
  loader = loader || findLoaderByInitialBytes(loaders, data);
6047
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters2(data)}` : "");
5343
6048
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
6049
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
6050
+ if (reason) {
6051
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
6052
+ }
5344
6053
  return loader;
5345
6054
  }
5346
6055
  function validHTTPResponse(data) {
@@ -5467,6 +6176,7 @@
5467
6176
  "../core/src/lib/api/select-loader.ts"() {
5468
6177
  init_src2();
5469
6178
  init_normalize_loader();
6179
+ init_log3();
5470
6180
  init_resource_utils();
5471
6181
  init_register_loaders();
5472
6182
  init_is_type();
@@ -5812,10 +6522,10 @@
5812
6522
  });
5813
6523
 
5814
6524
  // src/lib/utils/version.ts
5815
- var VERSION4;
6525
+ var VERSION5;
5816
6526
  var init_version2 = __esm({
5817
6527
  "src/lib/utils/version.ts"() {
5818
- VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6528
+ VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
5819
6529
  }
5820
6530
  });
5821
6531
 
@@ -5861,10 +6571,10 @@
5861
6571
  });
5862
6572
 
5863
6573
  // ../draco/src/lib/utils/version.ts
5864
- var VERSION5;
6574
+ var VERSION6;
5865
6575
  var init_version3 = __esm({
5866
6576
  "../draco/src/lib/utils/version.ts"() {
5867
- VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6577
+ VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
5868
6578
  }
5869
6579
  });
5870
6580
 
@@ -5886,7 +6596,7 @@
5886
6596
  id: "draco",
5887
6597
  module: "draco",
5888
6598
  shapes: ["mesh"],
5889
- version: VERSION5,
6599
+ version: VERSION6,
5890
6600
  worker: true,
5891
6601
  extensions: ["drc"],
5892
6602
  mimeTypes: ["application/octet-stream"],
@@ -5929,12 +6639,12 @@
5929
6639
  });
5930
6640
 
5931
6641
  // ../schema/src/lib/utils/assert.ts
5932
- function assert6(condition, message) {
6642
+ function assert7(condition, message) {
5933
6643
  if (!condition) {
5934
6644
  throw new Error(message || "loader assertion failed.");
5935
6645
  }
5936
6646
  }
5937
- var init_assert5 = __esm({
6647
+ var init_assert6 = __esm({
5938
6648
  "../schema/src/lib/utils/assert.ts"() {
5939
6649
  }
5940
6650
  });
@@ -5955,10 +6665,10 @@
5955
6665
  var Schema;
5956
6666
  var init_schema = __esm({
5957
6667
  "../schema/src/lib/schema/impl/schema.ts"() {
5958
- init_assert5();
6668
+ init_assert6();
5959
6669
  Schema = class {
5960
6670
  constructor(fields, metadata) {
5961
- assert6(Array.isArray(fields));
6671
+ assert7(Array.isArray(fields));
5962
6672
  checkNames(fields);
5963
6673
  this.fields = fields;
5964
6674
  this.metadata = metadata || new Map();
@@ -7046,12 +7756,12 @@
7046
7756
  });
7047
7757
 
7048
7758
  // ../math/src/geometry/utils/assert.ts
7049
- function assert7(condition, message) {
7759
+ function assert8(condition, message) {
7050
7760
  if (!condition) {
7051
7761
  throw new Error(`math.gl assertion failed. ${message}`);
7052
7762
  }
7053
7763
  }
7054
- var init_assert6 = __esm({
7764
+ var init_assert7 = __esm({
7055
7765
  "../math/src/geometry/utils/assert.ts"() {
7056
7766
  }
7057
7767
  });
@@ -7079,7 +7789,7 @@
7079
7789
  return value < 0 ? -1 : 1;
7080
7790
  }
7081
7791
  function octDecodeInRange(x, y, rangeMax, result) {
7082
- assert7(result);
7792
+ assert8(result);
7083
7793
  if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) {
7084
7794
  throw new Error(`x and y must be unsigned normalized integers between 0 and ${rangeMax}`);
7085
7795
  }
@@ -7100,7 +7810,7 @@
7100
7810
  var init_attribute_compression = __esm({
7101
7811
  "../math/src/geometry/compression/attribute-compression.ts"() {
7102
7812
  init_esm();
7103
- init_assert6();
7813
+ init_assert7();
7104
7814
  RIGHT_SHIFT = 1 / 256;
7105
7815
  scratchVector23 = new Vector2();
7106
7816
  scratchVector32 = new Vector3();
@@ -8152,18 +8862,18 @@
8152
8862
  });
8153
8863
 
8154
8864
  // ../gltf/src/lib/utils/version.ts
8155
- var VERSION6;
8865
+ var VERSION7;
8156
8866
  var init_version4 = __esm({
8157
8867
  "../gltf/src/lib/utils/version.ts"() {
8158
- VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8868
+ VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8159
8869
  }
8160
8870
  });
8161
8871
 
8162
8872
  // ../textures/src/lib/utils/version.ts
8163
- var VERSION7;
8873
+ var VERSION8;
8164
8874
  var init_version5 = __esm({
8165
8875
  "../textures/src/lib/utils/version.ts"() {
8166
- VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8876
+ VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
8167
8877
  }
8168
8878
  });
8169
8879
 
@@ -8230,13 +8940,13 @@
8230
8940
  });
8231
8941
  });
8232
8942
  }
8233
- var VERSION8, BASIS_CDN_ENCODER_WASM, BASIS_CDN_ENCODER_JS, loadBasisTranscoderPromise, loadBasisEncoderPromise;
8943
+ var VERSION9, BASIS_CDN_ENCODER_WASM, BASIS_CDN_ENCODER_JS, loadBasisTranscoderPromise, loadBasisEncoderPromise;
8234
8944
  var init_basis_module_loader = __esm({
8235
8945
  "../textures/src/lib/parsers/basis-module-loader.ts"() {
8236
8946
  init_src();
8237
- VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8238
- BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.wasm`;
8239
- BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.js`;
8947
+ VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
8948
+ BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.wasm`;
8949
+ BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.js`;
8240
8950
  }
8241
8951
  });
8242
8952
 
@@ -8431,7 +9141,7 @@
8431
9141
  const basisFile = new BasisFile(new Uint8Array(data));
8432
9142
  try {
8433
9143
  if (!basisFile.startTranscoding()) {
8434
- return null;
9144
+ throw new Error("Failed to start basis transcoding");
8435
9145
  }
8436
9146
  const imageCount = basisFile.getNumImages();
8437
9147
  const images = [];
@@ -8457,22 +9167,22 @@
8457
9167
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
8458
9168
  const decodedData = new Uint8Array(decodedSize);
8459
9169
  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
8460
- return null;
9170
+ throw new Error("failed to start Basis transcoding");
8461
9171
  }
8462
9172
  return {
8463
9173
  width,
8464
9174
  height,
8465
9175
  data: decodedData,
8466
9176
  compressed,
8467
- hasAlpha,
8468
- format
9177
+ format,
9178
+ hasAlpha
8469
9179
  };
8470
9180
  }
8471
9181
  function parseKTX2File(KTX2File, data, options) {
8472
9182
  const ktx2File = new KTX2File(new Uint8Array(data));
8473
9183
  try {
8474
9184
  if (!ktx2File.startTranscoding()) {
8475
- return null;
9185
+ throw new Error("failed to start KTX2 transcoding");
8476
9186
  }
8477
9187
  const levelsCount = ktx2File.getLevels();
8478
9188
  const levels = [];
@@ -8480,7 +9190,7 @@
8480
9190
  levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
8481
9191
  break;
8482
9192
  }
8483
- return levels;
9193
+ return [levels];
8484
9194
  } finally {
8485
9195
  ktx2File.close();
8486
9196
  ktx2File.delete();
@@ -8492,14 +9202,14 @@
8492
9202
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
8493
9203
  const decodedData = new Uint8Array(decodedSize);
8494
9204
  if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
8495
- return null;
9205
+ throw new Error("Failed to transcode KTX2 image");
8496
9206
  }
8497
9207
  return {
8498
9208
  width,
8499
9209
  height,
8500
9210
  data: decodedData,
8501
9211
  compressed,
8502
- alphaFlag,
9212
+ hasAlpha: alphaFlag,
8503
9213
  format
8504
9214
  };
8505
9215
  }
@@ -8598,7 +9308,7 @@
8598
9308
  name: "Basis",
8599
9309
  id: "basis",
8600
9310
  module: "textures",
8601
- version: VERSION7,
9311
+ version: VERSION8,
8602
9312
  worker: true,
8603
9313
  extensions: ["basis", "ktx2"],
8604
9314
  mimeTypes: ["application/octet-stream", "image/ktx2"],
@@ -8621,10 +9331,10 @@
8621
9331
  });
8622
9332
 
8623
9333
  // ../images/src/lib/utils/version.ts
8624
- var VERSION9;
9334
+ var VERSION10;
8625
9335
  var init_version6 = __esm({
8626
9336
  "../images/src/lib/utils/version.ts"() {
8627
- VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9337
+ VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
8628
9338
  }
8629
9339
  });
8630
9340
 
@@ -9019,7 +9729,7 @@
9019
9729
  id: "image",
9020
9730
  module: "images",
9021
9731
  name: "Images",
9022
- version: VERSION9,
9732
+ version: VERSION10,
9023
9733
  mimeTypes: MIME_TYPES,
9024
9734
  extensions: EXTENSIONS,
9025
9735
  parse: parseImage,
@@ -9088,12 +9798,12 @@
9088
9798
  });
9089
9799
 
9090
9800
  // ../gltf/src/lib/utils/assert.ts
9091
- function assert8(condition, message) {
9801
+ function assert9(condition, message) {
9092
9802
  if (!condition) {
9093
9803
  throw new Error(message || "assert failed: gltf");
9094
9804
  }
9095
9805
  }
9096
- var init_assert7 = __esm({
9806
+ var init_assert8 = __esm({
9097
9807
  "../gltf/src/lib/utils/assert.ts"() {
9098
9808
  }
9099
9809
  });
@@ -9118,16 +9828,16 @@
9118
9828
  // ../gltf/src/lib/gltf-utils/get-typed-array.ts
9119
9829
  function getTypedArrayForBufferView(json, buffers, bufferViewIndex) {
9120
9830
  const bufferView = json.bufferViews[bufferViewIndex];
9121
- assert8(bufferView);
9831
+ assert9(bufferView);
9122
9832
  const bufferIndex = bufferView.buffer;
9123
9833
  const binChunk = buffers[bufferIndex];
9124
- assert8(binChunk);
9834
+ assert9(binChunk);
9125
9835
  const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
9126
9836
  return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
9127
9837
  }
9128
9838
  var init_get_typed_array = __esm({
9129
9839
  "../gltf/src/lib/gltf-utils/get-typed-array.ts"() {
9130
- init_assert7();
9840
+ init_assert8();
9131
9841
  }
9132
9842
  });
9133
9843
 
@@ -9149,13 +9859,13 @@
9149
9859
  const bytesPerComponent = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];
9150
9860
  const length4 = accessor.count * components;
9151
9861
  const byteLength = accessor.count * components * bytesPerComponent;
9152
- assert8(byteLength >= 0 && byteLength <= bufferView.byteLength);
9862
+ assert9(byteLength >= 0 && byteLength <= bufferView.byteLength);
9153
9863
  return { ArrayType, length: length4, byteLength };
9154
9864
  }
9155
9865
  var TYPES, ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT, ARRAY_TO_COMPONENT_TYPE, ATTRIBUTE_TYPE_TO_COMPONENTS, ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE, ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY;
9156
9866
  var init_gltf_utils = __esm({
9157
9867
  "../gltf/src/lib/gltf-utils/gltf-utils.ts"() {
9158
- init_assert7();
9868
+ init_assert8();
9159
9869
  TYPES = ["SCALAR", "VEC2", "VEC3", "VEC4"];
9160
9870
  ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT = [
9161
9871
  [Int8Array, 5120],
@@ -9201,7 +9911,7 @@
9201
9911
  "../gltf/src/lib/api/gltf-scenegraph.ts"() {
9202
9912
  init_src8();
9203
9913
  init_src2();
9204
- init_assert7();
9914
+ init_assert8();
9205
9915
  init_gltf_utils();
9206
9916
  DEFAULT_GLTF_JSON = {
9207
9917
  asset: {
@@ -9300,7 +10010,7 @@
9300
10010
  bufferView = this.getBufferView(bufferView);
9301
10011
  const bufferIndex = bufferView.buffer;
9302
10012
  const binChunk = this.gltf.buffers[bufferIndex];
9303
- assert8(binChunk);
10013
+ assert9(binChunk);
9304
10014
  const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
9305
10015
  return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
9306
10016
  }
@@ -9347,14 +10057,14 @@
9347
10057
  return extension;
9348
10058
  }
9349
10059
  addExtension(extensionName, extensionData = {}) {
9350
- assert8(extensionData);
10060
+ assert9(extensionData);
9351
10061
  this.json.extensions = this.json.extensions || {};
9352
10062
  this.json.extensions[extensionName] = extensionData;
9353
10063
  this.registerUsedExtension(extensionName);
9354
10064
  return extensionData;
9355
10065
  }
9356
10066
  addRequiredExtension(extensionName, extensionData = {}) {
9357
- assert8(extensionData);
10067
+ assert9(extensionData);
9358
10068
  this.addExtension(extensionName, extensionData);
9359
10069
  this.registerRequiredExtension(extensionName);
9360
10070
  return extensionData;
@@ -9452,7 +10162,7 @@
9452
10162
  }
9453
10163
  addBufferView(buffer) {
9454
10164
  const byteLength = buffer.byteLength;
9455
- assert8(Number.isFinite(byteLength));
10165
+ assert9(Number.isFinite(byteLength));
9456
10166
  this.sourceBuffers = this.sourceBuffers || [];
9457
10167
  this.sourceBuffers.push(buffer);
9458
10168
  const glTFBufferView = {
@@ -10099,7 +10809,7 @@
10099
10809
  const { json } = gltfScenegraph;
10100
10810
  if (json.lights) {
10101
10811
  const extension = gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);
10102
- assert8(!extension.lights);
10812
+ assert9(!extension.lights);
10103
10813
  extension.lights = json.lights;
10104
10814
  delete json.lights;
10105
10815
  }
@@ -10114,7 +10824,7 @@
10114
10824
  var KHR_LIGHTS_PUNCTUAL, name5;
10115
10825
  var init_KHR_lights_punctual = __esm({
10116
10826
  "../gltf/src/lib/extensions/deprecated/KHR_lights_punctual.ts"() {
10117
- init_assert7();
10827
+ init_assert8();
10118
10828
  init_gltf_scenegraph();
10119
10829
  KHR_LIGHTS_PUNCTUAL = "KHR_lights_punctual";
10120
10830
  name5 = KHR_LIGHTS_PUNCTUAL;
@@ -10507,7 +11217,7 @@
10507
11217
  var COMPONENTS, BYTES, GL_SAMPLER, SAMPLER_PARAMETER_GLTF_TO_GL, DEFAULT_SAMPLER, GLTFPostProcessor;
10508
11218
  var init_post_process_gltf = __esm({
10509
11219
  "../gltf/src/lib/api/post-process-gltf.ts"() {
10510
- init_assert7();
11220
+ init_assert8();
10511
11221
  init_gltf_utils();
10512
11222
  COMPONENTS = {
10513
11223
  SCALAR: 1,
@@ -10556,7 +11266,7 @@
10556
11266
  }
10557
11267
  postProcess(gltf, options = {}) {
10558
11268
  const { json, buffers = [], images = [], baseUri = "" } = gltf;
10559
- assert8(json);
11269
+ assert9(json);
10560
11270
  this.baseUri = baseUri;
10561
11271
  this.json = json;
10562
11272
  this.buffers = buffers;
@@ -10960,11 +11670,11 @@
10960
11670
  } else if (data instanceof ArrayBuffer) {
10961
11671
  const glb = {};
10962
11672
  byteOffset = parseGLBSync(glb, data, byteOffset, options.glb);
10963
- assert8(glb.type === "glTF", `Invalid GLB magic string ${glb.type}`);
11673
+ assert9(glb.type === "glTF", `Invalid GLB magic string ${glb.type}`);
10964
11674
  gltf._glb = glb;
10965
11675
  gltf.json = glb.json;
10966
11676
  } else {
10967
- assert8(false, "GLTF: must be ArrayBuffer or string");
11677
+ assert9(false, "GLTF: must be ArrayBuffer or string");
10968
11678
  }
10969
11679
  const buffers = gltf.json.buffers || [];
10970
11680
  gltf.buffers = new Array(buffers.length).fill(null);
@@ -10985,7 +11695,7 @@
10985
11695
  const buffer = buffers[i2];
10986
11696
  if (buffer.uri) {
10987
11697
  const { fetch: fetch2 } = context;
10988
- assert8(fetch2);
11698
+ assert9(fetch2);
10989
11699
  const uri = resolveUrl(buffer.uri, options);
10990
11700
  const response = await context?.fetch?.(uri);
10991
11701
  const arrayBuffer = await response?.arrayBuffer?.();
@@ -11029,7 +11739,7 @@
11029
11739
  const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);
11030
11740
  arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);
11031
11741
  }
11032
- assert8(arrayBuffer, "glTF image has no data");
11742
+ assert9(arrayBuffer, "glTF image has no data");
11033
11743
  let parsedImage = await parse5(arrayBuffer, [ImageLoader, BasisLoader], { mimeType: image.mimeType, basis: options.basis || { format: selectSupportedBasisFormat() } }, context);
11034
11744
  if (parsedImage && parsedImage[0]) {
11035
11745
  parsedImage = {
@@ -11037,7 +11747,7 @@
11037
11747
  mipmaps: false,
11038
11748
  width: parsedImage[0].width,
11039
11749
  height: parsedImage[0].height,
11040
- data: parsedImage
11750
+ data: parsedImage[0]
11041
11751
  };
11042
11752
  }
11043
11753
  gltf.images = gltf.images || [];
@@ -11048,7 +11758,7 @@
11048
11758
  init_src9();
11049
11759
  init_src8();
11050
11760
  init_src2();
11051
- init_assert7();
11761
+ init_assert8();
11052
11762
  init_resolve_url();
11053
11763
  init_get_typed_array();
11054
11764
  init_gltf_extensions();
@@ -11075,7 +11785,7 @@
11075
11785
  name: "glTF",
11076
11786
  id: "gltf",
11077
11787
  module: "gltf",
11078
- version: VERSION6,
11788
+ version: VERSION7,
11079
11789
  extensions: ["gltf", "glb"],
11080
11790
  mimeTypes: ["model/gltf+json", "model/gltf-binary"],
11081
11791
  text: true,
@@ -11376,7 +12086,7 @@
11376
12086
  }
11377
12087
  });
11378
12088
 
11379
- // src/lib/parsers/parse-3d-tile-gltf.js
12089
+ // src/lib/parsers/parse-3d-tile-gltf.ts
11380
12090
  async function parseGltf3DTile(tile, arrayBuffer, options, context) {
11381
12091
  tile.rotateYtoZ = true;
11382
12092
  tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
@@ -11384,7 +12094,7 @@
11384
12094
  tile.gltf = await parse5(arrayBuffer, GLTFLoader, options, context);
11385
12095
  }
11386
12096
  var init_parse_3d_tile_gltf = __esm({
11387
- "src/lib/parsers/parse-3d-tile-gltf.js"() {
12097
+ "src/lib/parsers/parse-3d-tile-gltf.ts"() {
11388
12098
  init_src10();
11389
12099
  }
11390
12100
  });
@@ -11487,7 +12197,7 @@
11487
12197
  id: "3d-tiles-subtree",
11488
12198
  name: "3D Tiles Subtree",
11489
12199
  module: "3d-tiles",
11490
- version: VERSION4,
12200
+ version: VERSION5,
11491
12201
  extensions: ["subtree"],
11492
12202
  mimeTypes: ["application/octet-stream"],
11493
12203
  tests: ["subtree"],
@@ -11498,18 +12208,25 @@
11498
12208
  });
11499
12209
 
11500
12210
  // src/lib/parsers/helpers/parse-3d-implicit-tiles.ts
11501
- async function parseImplicitTiles(subtree, options, parentData = {
11502
- mortonIndex: 0,
11503
- x: 0,
11504
- y: 0,
11505
- z: 0
11506
- }, childIndex = 0, level = 0, globalData = {
11507
- level: 0,
11508
- mortonIndex: 0,
11509
- x: 0,
11510
- y: 0,
11511
- z: 0
11512
- }) {
12211
+ async function parseImplicitTiles(params) {
12212
+ const {
12213
+ options,
12214
+ parentData = {
12215
+ mortonIndex: 0,
12216
+ x: 0,
12217
+ y: 0,
12218
+ z: 0
12219
+ },
12220
+ childIndex = 0,
12221
+ globalData = {
12222
+ level: 0,
12223
+ mortonIndex: 0,
12224
+ x: 0,
12225
+ y: 0,
12226
+ z: 0
12227
+ }
12228
+ } = params;
12229
+ let { subtree, level = 0 } = params;
11513
12230
  const {
11514
12231
  subdivisionScheme,
11515
12232
  subtreeLevels,
@@ -11565,7 +12282,14 @@
11565
12282
  const childTileLevel = level + 1;
11566
12283
  const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
11567
12284
  for (let index = 0; index < childrenPerTile; index++) {
11568
- const currentTile = await parseImplicitTiles(subtree, options, pData, index, childTileLevel, globalData);
12285
+ const currentTile = await parseImplicitTiles({
12286
+ subtree,
12287
+ options,
12288
+ parentData: pData,
12289
+ childIndex: index,
12290
+ level: childTileLevel,
12291
+ globalData
12292
+ });
11569
12293
  if (currentTile.contentUrl || currentTile.children.length) {
11570
12294
  const globalLevel = lev + 1;
11571
12295
  const childCoordinates = { childTileX, childTileY, childTileZ };
@@ -11768,7 +12492,7 @@
11768
12492
  tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
11769
12493
  tile.lodMetricValue = tile.geometricError;
11770
12494
  tile.transformMatrix = tile.transform;
11771
- const { children, contentUrl } = await parseImplicitTiles(rootSubtree, options);
12495
+ const { children, contentUrl } = await parseImplicitTiles({ subtree: rootSubtree, options });
11772
12496
  if (contentUrl) {
11773
12497
  tile.contentUrl = contentUrl;
11774
12498
  tile.content = { uri: contentUrl.replace(`${options.basePath}/`, "") };
@@ -11844,7 +12568,7 @@
11844
12568
  id: "3d-tiles",
11845
12569
  name: "3D Tiles",
11846
12570
  module: "3d-tiles",
11847
- version: VERSION4,
12571
+ version: VERSION5,
11848
12572
  extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
11849
12573
  mimeTypes: ["application/octet-stream"],
11850
12574
  tests: ["cmpt", "pnts", "b3dm", "i3dm"],
@@ -12164,7 +12888,7 @@
12164
12888
  name: "3D Tile",
12165
12889
  id: "3d-tiles",
12166
12890
  module: "3d-tiles",
12167
- version: VERSION4,
12891
+ version: VERSION5,
12168
12892
  extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
12169
12893
  mimeTypes: ["application/octet-stream"],
12170
12894
  encodeSync,