@loaders.gl/i3s 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 (39) hide show
  1. package/dist/dist.min.js +957 -244
  2. package/dist/es5/i3s-attribute-loader.js +1 -1
  3. package/dist/es5/i3s-attribute-loader.js.map +1 -1
  4. package/dist/es5/i3s-building-scene-layer-loader.js +1 -1
  5. package/dist/es5/i3s-building-scene-layer-loader.js.map +1 -1
  6. package/dist/es5/i3s-content-loader.js +1 -1
  7. package/dist/es5/i3s-content-loader.js.map +1 -1
  8. package/dist/es5/i3s-loader.js +1 -1
  9. package/dist/es5/i3s-loader.js.map +1 -1
  10. package/dist/es5/i3s-node-page-loader.js +1 -1
  11. package/dist/es5/i3s-node-page-loader.js.map +1 -1
  12. package/dist/es5/lib/parsers/parse-i3s-tile-content.js +46 -42
  13. package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  14. package/dist/es5/types.js.map +1 -1
  15. package/dist/esm/i3s-attribute-loader.js +1 -1
  16. package/dist/esm/i3s-attribute-loader.js.map +1 -1
  17. package/dist/esm/i3s-building-scene-layer-loader.js +1 -1
  18. package/dist/esm/i3s-building-scene-layer-loader.js.map +1 -1
  19. package/dist/esm/i3s-content-loader.js +1 -1
  20. package/dist/esm/i3s-content-loader.js.map +1 -1
  21. package/dist/esm/i3s-loader.js +1 -1
  22. package/dist/esm/i3s-loader.js.map +1 -1
  23. package/dist/esm/i3s-node-page-loader.js +1 -1
  24. package/dist/esm/i3s-node-page-loader.js.map +1 -1
  25. package/dist/esm/lib/parsers/parse-i3s-tile-content.js +33 -29
  26. package/dist/esm/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  27. package/dist/esm/types.js.map +1 -1
  28. package/dist/i3s-building-scene-layer-loader.js +1 -1
  29. package/dist/i3s-content-loader.js +1 -1
  30. package/dist/i3s-content-worker.js +749 -103
  31. package/dist/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  32. package/dist/lib/parsers/parse-i3s-tile-content.js +33 -29
  33. package/dist/types.d.ts +2 -3
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +9 -9
  36. package/src/i3s-building-scene-layer-loader.ts +1 -1
  37. package/src/i3s-content-loader.ts +1 -1
  38. package/src/lib/parsers/parse-i3s-tile-content.ts +37 -32
  39. package/src/types.ts +2 -3
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
  assert2(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
 
@@ -749,6 +796,25 @@
749
796
  }
750
797
  });
751
798
 
799
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
800
+ function _defineProperty(obj, key, value) {
801
+ if (key in obj) {
802
+ Object.defineProperty(obj, key, {
803
+ value,
804
+ enumerable: true,
805
+ configurable: true,
806
+ writable: true
807
+ });
808
+ } else {
809
+ obj[key] = value;
810
+ }
811
+ return obj;
812
+ }
813
+ var init_defineProperty = __esm({
814
+ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
815
+ }
816
+ });
817
+
752
818
  // ../loader-utils/src/lib/path-utils/file-aliases.ts
753
819
  function resolvePath(filename2) {
754
820
  for (const alias in fileAliases) {
@@ -1592,29 +1658,29 @@
1592
1658
  }
1593
1659
  });
1594
1660
 
1595
- // ../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
1661
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
1596
1662
  var init_hi_res_timestamp2 = __esm({
1597
- "../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
1663
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
1598
1664
  }
1599
1665
  });
1600
1666
 
1601
- // ../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js
1667
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js
1602
1668
  var init_stat = __esm({
1603
- "../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
1669
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
1604
1670
  init_hi_res_timestamp2();
1605
1671
  }
1606
1672
  });
1607
1673
 
1608
- // ../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js
1674
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js
1609
1675
  var init_stats = __esm({
1610
- "../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
1676
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
1611
1677
  init_stat();
1612
1678
  }
1613
1679
  });
1614
1680
 
1615
- // ../../node_modules/@probe.gl/stats/dist/esm/index.js
1681
+ // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js
1616
1682
  var init_esm = __esm({
1617
- "../../node_modules/@probe.gl/stats/dist/esm/index.js"() {
1683
+ "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js"() {
1618
1684
  init_stats();
1619
1685
  init_stat();
1620
1686
  init_hi_res_timestamp2();
@@ -1682,6 +1748,7 @@
1682
1748
  var DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS;
1683
1749
  var init_option_defaults = __esm({
1684
1750
  "../core/src/lib/loader-utils/option-defaults.ts"() {
1751
+ init_src2();
1685
1752
  init_loggers();
1686
1753
  DEFAULT_LOADER_OPTIONS = {
1687
1754
  fetch: null,
@@ -1692,7 +1759,8 @@
1692
1759
  worker: true,
1693
1760
  maxConcurrency: 3,
1694
1761
  maxMobileConcurrency: 1,
1695
- reuseWorkers: true,
1762
+ reuseWorkers: isBrowser,
1763
+ _nodeWorkers: false,
1696
1764
  _workerType: "",
1697
1765
  limit: 0,
1698
1766
  _limitMB: 0,
@@ -1782,111 +1850,743 @@
1782
1850
  if (optionKey === key) {
1783
1851
  return `Did you mean '${loader.id}.${key}'?`;
1784
1852
  }
1785
- const lowerCaseKey = key.toLowerCase();
1786
- const isPartialMatch = lowerCaseOptionKey.startsWith(lowerCaseKey) || lowerCaseKey.startsWith(lowerCaseOptionKey);
1787
- if (isPartialMatch) {
1788
- bestSuggestion = bestSuggestion || `Did you mean '${loader.id}.${key}'?`;
1853
+ const lowerCaseKey = key.toLowerCase();
1854
+ const isPartialMatch = lowerCaseOptionKey.startsWith(lowerCaseKey) || lowerCaseKey.startsWith(lowerCaseOptionKey);
1855
+ if (isPartialMatch) {
1856
+ bestSuggestion = bestSuggestion || `Did you mean '${loader.id}.${key}'?`;
1857
+ }
1858
+ }
1859
+ }
1860
+ return bestSuggestion;
1861
+ }
1862
+ function normalizeOptionsInternal(loader, options, url) {
1863
+ const loaderDefaultOptions = loader.options || {};
1864
+ const mergedOptions = { ...loaderDefaultOptions };
1865
+ addUrlOptions(mergedOptions, url);
1866
+ if (mergedOptions.log === null) {
1867
+ mergedOptions.log = new NullLog();
1868
+ }
1869
+ mergeNestedFields(mergedOptions, getGlobalLoaderOptions());
1870
+ mergeNestedFields(mergedOptions, options);
1871
+ return mergedOptions;
1872
+ }
1873
+ function mergeNestedFields(mergedOptions, options) {
1874
+ for (const key in options) {
1875
+ if (key in options) {
1876
+ const value = options[key];
1877
+ if (isPureObject(value) && isPureObject(mergedOptions[key])) {
1878
+ mergedOptions[key] = {
1879
+ ...mergedOptions[key],
1880
+ ...options[key]
1881
+ };
1882
+ } else {
1883
+ mergedOptions[key] = options[key];
1884
+ }
1885
+ }
1886
+ }
1887
+ }
1888
+ function addUrlOptions(options, url) {
1889
+ if (url && !("baseUri" in options)) {
1890
+ options.baseUri = url;
1891
+ }
1892
+ }
1893
+ var getGlobalLoaderOptions;
1894
+ var init_option_utils = __esm({
1895
+ "../core/src/lib/loader-utils/option-utils.ts"() {
1896
+ init_is_type();
1897
+ init_fetch_file();
1898
+ init_loggers();
1899
+ init_option_defaults();
1900
+ getGlobalLoaderOptions = () => {
1901
+ const state = getGlobalLoaderState();
1902
+ state.globalOptions = state.globalOptions || { ...DEFAULT_LOADER_OPTIONS };
1903
+ return state.globalOptions;
1904
+ };
1905
+ }
1906
+ });
1907
+
1908
+ // ../core/src/lib/loader-utils/normalize-loader.ts
1909
+ function isLoaderObject(loader) {
1910
+ if (!loader) {
1911
+ return false;
1912
+ }
1913
+ if (Array.isArray(loader)) {
1914
+ loader = loader[0];
1915
+ }
1916
+ const hasExtensions = Array.isArray(loader?.extensions);
1917
+ return hasExtensions;
1918
+ }
1919
+ function normalizeLoader(loader) {
1920
+ assert(loader, "null loader");
1921
+ assert(isLoaderObject(loader), "invalid loader");
1922
+ let options;
1923
+ if (Array.isArray(loader)) {
1924
+ options = loader[1];
1925
+ loader = loader[0];
1926
+ loader = {
1927
+ ...loader,
1928
+ options: { ...loader.options, ...options }
1929
+ };
1930
+ }
1931
+ if (loader?.parseTextSync || loader?.parseText) {
1932
+ loader.text = true;
1933
+ }
1934
+ if (!loader.text) {
1935
+ loader.binary = true;
1936
+ }
1937
+ return loader;
1938
+ }
1939
+ var init_normalize_loader = __esm({
1940
+ "../core/src/lib/loader-utils/normalize-loader.ts"() {
1941
+ init_src2();
1942
+ }
1943
+ });
1944
+
1945
+ // ../core/src/lib/api/register-loaders.ts
1946
+ function getRegisteredLoaders() {
1947
+ return getGlobalLoaderRegistry();
1948
+ }
1949
+ var getGlobalLoaderRegistry;
1950
+ var init_register_loaders = __esm({
1951
+ "../core/src/lib/api/register-loaders.ts"() {
1952
+ init_option_utils();
1953
+ getGlobalLoaderRegistry = () => {
1954
+ const state = getGlobalLoaderState();
1955
+ state.loaderRegistry = state.loaderRegistry || [];
1956
+ return state.loaderRegistry;
1957
+ };
1958
+ }
1959
+ });
1960
+
1961
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js
1962
+ function isElectron2(mockUserAgent) {
1963
+ if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
1964
+ return true;
1965
+ }
1966
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
1967
+ return true;
1968
+ }
1969
+ const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
1970
+ const userAgent = mockUserAgent || realUserAgent;
1971
+ if (userAgent && userAgent.indexOf("Electron") >= 0) {
1972
+ return true;
1973
+ }
1974
+ return false;
1975
+ }
1976
+ var init_is_electron2 = __esm({
1977
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js"() {
1978
+ }
1979
+ });
1980
+
1981
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js
1982
+ function isBrowser5() {
1983
+ const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
1984
+ return !isNode || isElectron2();
1985
+ }
1986
+ var init_is_browser2 = __esm({
1987
+ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js"() {
1988
+ init_is_electron2();
1989
+ }
1990
+ });
1991
+
1992
+ // ../../node_modules/@probe.gl/env/dist/esm/lib/globals.js
1993
+ var globals4, self_4, window_4, document_4, process_2;
1994
+ var init_globals5 = __esm({
1995
+ "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js"() {
1996
+ globals4 = {
1997
+ self: typeof self !== "undefined" && self,
1998
+ window: typeof window !== "undefined" && window,
1999
+ global: typeof global !== "undefined" && global,
2000
+ document: typeof document !== "undefined" && document,
2001
+ process: typeof process === "object" && process
2002
+ };
2003
+ self_4 = globals4.self || globals4.window || globals4.global;
2004
+ window_4 = globals4.window || globals4.self || globals4.global;
2005
+ document_4 = globals4.document || {};
2006
+ process_2 = globals4.process || {};
2007
+ }
2008
+ });
2009
+
2010
+ // ../../node_modules/@probe.gl/env/dist/esm/utils/globals.js
2011
+ var VERSION4, isBrowser6;
2012
+ var init_globals6 = __esm({
2013
+ "../../node_modules/@probe.gl/env/dist/esm/utils/globals.js"() {
2014
+ init_is_browser2();
2015
+ VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
2016
+ isBrowser6 = isBrowser5();
2017
+ }
2018
+ });
2019
+
2020
+ // ../../node_modules/@probe.gl/env/dist/esm/index.js
2021
+ var init_esm3 = __esm({
2022
+ "../../node_modules/@probe.gl/env/dist/esm/index.js"() {
2023
+ init_globals6();
2024
+ init_globals5();
2025
+ init_is_browser2();
2026
+ }
2027
+ });
2028
+
2029
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js
2030
+ function getStorage2(type) {
2031
+ try {
2032
+ const storage = window[type];
2033
+ const x = "__storage_test__";
2034
+ storage.setItem(x, x);
2035
+ storage.removeItem(x);
2036
+ return storage;
2037
+ } catch (e2) {
2038
+ return null;
2039
+ }
2040
+ }
2041
+ var LocalStorage2;
2042
+ var init_local_storage2 = __esm({
2043
+ "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js"() {
2044
+ init_defineProperty();
2045
+ LocalStorage2 = class {
2046
+ constructor(id) {
2047
+ let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2048
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
2049
+ _defineProperty(this, "storage", void 0);
2050
+ _defineProperty(this, "id", void 0);
2051
+ _defineProperty(this, "config", {});
2052
+ this.storage = getStorage2(type);
2053
+ this.id = id;
2054
+ this.config = {};
2055
+ Object.assign(this.config, defaultSettings);
2056
+ this._loadConfiguration();
2057
+ }
2058
+ getConfiguration() {
2059
+ return this.config;
2060
+ }
2061
+ setConfiguration(configuration) {
2062
+ this.config = {};
2063
+ return this.updateConfiguration(configuration);
2064
+ }
2065
+ updateConfiguration(configuration) {
2066
+ Object.assign(this.config, configuration);
2067
+ if (this.storage) {
2068
+ const serialized = JSON.stringify(this.config);
2069
+ this.storage.setItem(this.id, serialized);
2070
+ }
2071
+ return this;
2072
+ }
2073
+ _loadConfiguration() {
2074
+ let configuration = {};
2075
+ if (this.storage) {
2076
+ const serializedConfiguration = this.storage.getItem(this.id);
2077
+ configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
2078
+ }
2079
+ Object.assign(this.config, configuration);
2080
+ return this;
2081
+ }
2082
+ };
2083
+ }
2084
+ });
2085
+
2086
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js
2087
+ function formatTime2(ms) {
2088
+ let formatted;
2089
+ if (ms < 10) {
2090
+ formatted = "".concat(ms.toFixed(2), "ms");
2091
+ } else if (ms < 100) {
2092
+ formatted = "".concat(ms.toFixed(1), "ms");
2093
+ } else if (ms < 1e3) {
2094
+ formatted = "".concat(ms.toFixed(0), "ms");
2095
+ } else {
2096
+ formatted = "".concat((ms / 1e3).toFixed(2), "s");
2097
+ }
2098
+ return formatted;
2099
+ }
2100
+ function leftPad2(string) {
2101
+ let length4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
2102
+ const padLength = Math.max(length4 - string.length, 0);
2103
+ return "".concat(" ".repeat(padLength)).concat(string);
2104
+ }
2105
+ function formatImage2(image, message, scale5) {
2106
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
2107
+ const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
2108
+ if (image.width > maxWidth) {
2109
+ scale5 = Math.min(scale5, maxWidth / image.width);
2110
+ }
2111
+ const width = image.width * scale5;
2112
+ const height = image.height * scale5;
2113
+ 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("");
2114
+ return ["".concat(message, " %c+"), style];
2115
+ }
2116
+ var init_formatters2 = __esm({
2117
+ "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js"() {
2118
+ }
2119
+ });
2120
+
2121
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/color.js
2122
+ function getColor2(color) {
2123
+ return typeof color === "string" ? COLOR2[color.toUpperCase()] || COLOR2.WHITE : color;
2124
+ }
2125
+ function addColor2(string, color, background) {
2126
+ if (!isBrowser5 && typeof string === "string") {
2127
+ if (color) {
2128
+ color = getColor2(color);
2129
+ string = "[".concat(color, "m").concat(string, "");
2130
+ }
2131
+ if (background) {
2132
+ color = getColor2(background);
2133
+ string = "[".concat(background + 10, "m").concat(string, "");
2134
+ }
2135
+ }
2136
+ return string;
2137
+ }
2138
+ var COLOR2;
2139
+ var init_color2 = __esm({
2140
+ "../../node_modules/@probe.gl/log/dist/esm/utils/color.js"() {
2141
+ init_esm3();
2142
+ (function(COLOR3) {
2143
+ COLOR3[COLOR3["BLACK"] = 30] = "BLACK";
2144
+ COLOR3[COLOR3["RED"] = 31] = "RED";
2145
+ COLOR3[COLOR3["GREEN"] = 32] = "GREEN";
2146
+ COLOR3[COLOR3["YELLOW"] = 33] = "YELLOW";
2147
+ COLOR3[COLOR3["BLUE"] = 34] = "BLUE";
2148
+ COLOR3[COLOR3["MAGENTA"] = 35] = "MAGENTA";
2149
+ COLOR3[COLOR3["CYAN"] = 36] = "CYAN";
2150
+ COLOR3[COLOR3["WHITE"] = 37] = "WHITE";
2151
+ COLOR3[COLOR3["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
2152
+ COLOR3[COLOR3["BRIGHT_RED"] = 91] = "BRIGHT_RED";
2153
+ COLOR3[COLOR3["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
2154
+ COLOR3[COLOR3["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
2155
+ COLOR3[COLOR3["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
2156
+ COLOR3[COLOR3["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
2157
+ COLOR3[COLOR3["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
2158
+ COLOR3[COLOR3["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
2159
+ })(COLOR2 || (COLOR2 = {}));
2160
+ }
2161
+ });
2162
+
2163
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js
2164
+ function autobind2(obj) {
2165
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
2166
+ const proto = Object.getPrototypeOf(obj);
2167
+ const propNames = Object.getOwnPropertyNames(proto);
2168
+ for (const key of propNames) {
2169
+ if (typeof obj[key] === "function") {
2170
+ if (!predefined.find((name) => key === name)) {
2171
+ obj[key] = obj[key].bind(obj);
2172
+ }
2173
+ }
2174
+ }
2175
+ }
2176
+ var init_autobind2 = __esm({
2177
+ "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js"() {
2178
+ }
2179
+ });
2180
+
2181
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/assert.js
2182
+ function assert4(condition, message) {
2183
+ if (!condition) {
2184
+ throw new Error(message || "Assertion failed");
2185
+ }
2186
+ }
2187
+ var init_assert4 = __esm({
2188
+ "../../node_modules/@probe.gl/log/dist/esm/utils/assert.js"() {
2189
+ }
2190
+ });
2191
+
2192
+ // ../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js
2193
+ function getHiResTimestamp3() {
2194
+ let timestamp;
2195
+ if (isBrowser5 && "performance" in window_4) {
2196
+ var _window$performance, _window$performance$n;
2197
+ 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);
2198
+ } else if ("hrtime" in process_2) {
2199
+ var _process$hrtime;
2200
+ 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);
2201
+ timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
2202
+ } else {
2203
+ timestamp = Date.now();
2204
+ }
2205
+ return timestamp;
2206
+ }
2207
+ var init_hi_res_timestamp3 = __esm({
2208
+ "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js"() {
2209
+ init_esm3();
2210
+ }
2211
+ });
2212
+
2213
+ // ../../node_modules/@probe.gl/log/dist/esm/log.js
2214
+ function noop2() {
2215
+ }
2216
+ function normalizeLogLevel2(logLevel) {
2217
+ if (!logLevel) {
2218
+ return 0;
2219
+ }
2220
+ let resolvedLevel;
2221
+ switch (typeof logLevel) {
2222
+ case "number":
2223
+ resolvedLevel = logLevel;
2224
+ break;
2225
+ case "object":
2226
+ resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
2227
+ break;
2228
+ default:
2229
+ return 0;
2230
+ }
2231
+ assert4(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
2232
+ return resolvedLevel;
2233
+ }
2234
+ function normalizeArguments2(opts) {
2235
+ const {
2236
+ logLevel,
2237
+ message
2238
+ } = opts;
2239
+ opts.logLevel = normalizeLogLevel2(logLevel);
2240
+ const args = opts.args ? Array.from(opts.args) : [];
2241
+ while (args.length && args.shift() !== message) {
2242
+ }
2243
+ switch (typeof logLevel) {
2244
+ case "string":
2245
+ case "function":
2246
+ if (message !== void 0) {
2247
+ args.unshift(message);
2248
+ }
2249
+ opts.message = logLevel;
2250
+ break;
2251
+ case "object":
2252
+ Object.assign(opts, logLevel);
2253
+ break;
2254
+ default:
2255
+ }
2256
+ if (typeof opts.message === "function") {
2257
+ opts.message = opts.message();
2258
+ }
2259
+ const messageType = typeof opts.message;
2260
+ assert4(messageType === "string" || messageType === "object");
2261
+ return Object.assign(opts, {
2262
+ args
2263
+ }, opts.opts);
2264
+ }
2265
+ function decorateMessage2(id, message, opts) {
2266
+ if (typeof message === "string") {
2267
+ const time = opts.time ? leftPad2(formatTime2(opts.total)) : "";
2268
+ message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
2269
+ message = addColor2(message, opts.color, opts.background);
2270
+ }
2271
+ return message;
2272
+ }
2273
+ function logImageInNode2(_ref2) {
2274
+ let {
2275
+ image,
2276
+ message = "",
2277
+ scale: scale5 = 1
2278
+ } = _ref2;
2279
+ let asciify = null;
2280
+ try {
2281
+ asciify = module.require("asciify-image");
2282
+ } catch (error) {
2283
+ }
2284
+ if (asciify) {
2285
+ return () => asciify(image, {
2286
+ fit: "box",
2287
+ width: "".concat(Math.round(80 * scale5), "%")
2288
+ }).then((data) => console.log(data));
2289
+ }
2290
+ return noop2;
2291
+ }
2292
+ function logImageInBrowser2(_ref3) {
2293
+ let {
2294
+ image,
2295
+ message = "",
2296
+ scale: scale5 = 1
2297
+ } = _ref3;
2298
+ if (typeof image === "string") {
2299
+ const img = new Image();
2300
+ img.onload = () => {
2301
+ const args = formatImage2(img, message, scale5);
2302
+ console.log(...args);
2303
+ };
2304
+ img.src = image;
2305
+ return noop2;
2306
+ }
2307
+ const element = image.nodeName || "";
2308
+ if (element.toLowerCase() === "img") {
2309
+ console.log(...formatImage2(image, message, scale5));
2310
+ return noop2;
2311
+ }
2312
+ if (element.toLowerCase() === "canvas") {
2313
+ const img = new Image();
2314
+ img.onload = () => console.log(...formatImage2(img, message, scale5));
2315
+ img.src = image.toDataURL();
2316
+ return noop2;
2317
+ }
2318
+ return noop2;
2319
+ }
2320
+ function getTableHeader2(table) {
2321
+ for (const key in table) {
2322
+ for (const title in table[key]) {
2323
+ return title || "untitled";
2324
+ }
2325
+ }
2326
+ return "empty";
2327
+ }
2328
+ var originalConsole2, DEFAULT_SETTINGS2, cache2, ONCE2, Log2;
2329
+ var init_log2 = __esm({
2330
+ "../../node_modules/@probe.gl/log/dist/esm/log.js"() {
2331
+ init_defineProperty();
2332
+ init_esm3();
2333
+ init_local_storage2();
2334
+ init_formatters2();
2335
+ init_color2();
2336
+ init_autobind2();
2337
+ init_assert4();
2338
+ init_hi_res_timestamp3();
2339
+ originalConsole2 = {
2340
+ debug: isBrowser5 ? console.debug || console.log : console.log,
2341
+ log: console.log,
2342
+ info: console.info,
2343
+ warn: console.warn,
2344
+ error: console.error
2345
+ };
2346
+ DEFAULT_SETTINGS2 = {
2347
+ enabled: true,
2348
+ level: 0
2349
+ };
2350
+ cache2 = {};
2351
+ ONCE2 = {
2352
+ once: true
2353
+ };
2354
+ Log2 = class {
2355
+ constructor() {
2356
+ let {
2357
+ id
2358
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
2359
+ id: ""
2360
+ };
2361
+ _defineProperty(this, "id", void 0);
2362
+ _defineProperty(this, "VERSION", VERSION4);
2363
+ _defineProperty(this, "_startTs", getHiResTimestamp3());
2364
+ _defineProperty(this, "_deltaTs", getHiResTimestamp3());
2365
+ _defineProperty(this, "_storage", void 0);
2366
+ _defineProperty(this, "userData", {});
2367
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
2368
+ this.id = id;
2369
+ this._storage = new LocalStorage2("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS2);
2370
+ this.userData = {};
2371
+ this.timeStamp("".concat(this.id, " started"));
2372
+ autobind2(this);
2373
+ Object.seal(this);
2374
+ }
2375
+ set level(newLevel) {
2376
+ this.setLevel(newLevel);
2377
+ }
2378
+ get level() {
2379
+ return this.getLevel();
2380
+ }
2381
+ isEnabled() {
2382
+ return this._storage.config.enabled;
2383
+ }
2384
+ getLevel() {
2385
+ return this._storage.config.level;
2386
+ }
2387
+ getTotal() {
2388
+ return Number((getHiResTimestamp3() - this._startTs).toPrecision(10));
2389
+ }
2390
+ getDelta() {
2391
+ return Number((getHiResTimestamp3() - this._deltaTs).toPrecision(10));
2392
+ }
2393
+ set priority(newPriority) {
2394
+ this.level = newPriority;
2395
+ }
2396
+ get priority() {
2397
+ return this.level;
2398
+ }
2399
+ getPriority() {
2400
+ return this.level;
2401
+ }
2402
+ enable() {
2403
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
2404
+ this._storage.updateConfiguration({
2405
+ enabled
2406
+ });
2407
+ return this;
2408
+ }
2409
+ setLevel(level) {
2410
+ this._storage.updateConfiguration({
2411
+ level
2412
+ });
2413
+ return this;
2414
+ }
2415
+ get(setting) {
2416
+ return this._storage.config[setting];
2417
+ }
2418
+ set(setting, value) {
2419
+ this._storage.updateConfiguration({
2420
+ [setting]: value
2421
+ });
2422
+ }
2423
+ settings() {
2424
+ if (console.table) {
2425
+ console.table(this._storage.config);
2426
+ } else {
2427
+ console.log(this._storage.config);
2428
+ }
2429
+ }
2430
+ assert(condition, message) {
2431
+ assert4(condition, message);
2432
+ }
2433
+ warn(message) {
2434
+ return this._getLogFunction(0, message, originalConsole2.warn, arguments, ONCE2);
2435
+ }
2436
+ error(message) {
2437
+ return this._getLogFunction(0, message, originalConsole2.error, arguments);
2438
+ }
2439
+ deprecated(oldUsage, newUsage) {
2440
+ return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
2441
+ }
2442
+ removed(oldUsage, newUsage) {
2443
+ return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
2444
+ }
2445
+ probe(logLevel, message) {
2446
+ return this._getLogFunction(logLevel, message, originalConsole2.log, arguments, {
2447
+ time: true,
2448
+ once: true
2449
+ });
2450
+ }
2451
+ log(logLevel, message) {
2452
+ return this._getLogFunction(logLevel, message, originalConsole2.debug, arguments);
2453
+ }
2454
+ info(logLevel, message) {
2455
+ return this._getLogFunction(logLevel, message, console.info, arguments);
2456
+ }
2457
+ once(logLevel, message) {
2458
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2459
+ args[_key - 2] = arguments[_key];
2460
+ }
2461
+ return this._getLogFunction(logLevel, message, originalConsole2.debug || originalConsole2.info, arguments, ONCE2);
2462
+ }
2463
+ table(logLevel, table, columns) {
2464
+ if (table) {
2465
+ return this._getLogFunction(logLevel, table, console.table || noop2, columns && [columns], {
2466
+ tag: getTableHeader2(table)
2467
+ });
2468
+ }
2469
+ return noop2;
2470
+ }
2471
+ image(_ref) {
2472
+ let {
2473
+ logLevel,
2474
+ priority,
2475
+ image,
2476
+ message = "",
2477
+ scale: scale5 = 1
2478
+ } = _ref;
2479
+ if (!this._shouldLog(logLevel || priority)) {
2480
+ return noop2;
2481
+ }
2482
+ return isBrowser5 ? logImageInBrowser2({
2483
+ image,
2484
+ message,
2485
+ scale: scale5
2486
+ }) : logImageInNode2({
2487
+ image,
2488
+ message,
2489
+ scale: scale5
2490
+ });
2491
+ }
2492
+ time(logLevel, message) {
2493
+ return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
1789
2494
  }
1790
- }
1791
- }
1792
- return bestSuggestion;
1793
- }
1794
- function normalizeOptionsInternal(loader, options, url) {
1795
- const loaderDefaultOptions = loader.options || {};
1796
- const mergedOptions = { ...loaderDefaultOptions };
1797
- addUrlOptions(mergedOptions, url);
1798
- if (mergedOptions.log === null) {
1799
- mergedOptions.log = new NullLog();
1800
- }
1801
- mergeNestedFields(mergedOptions, getGlobalLoaderOptions());
1802
- mergeNestedFields(mergedOptions, options);
1803
- return mergedOptions;
1804
- }
1805
- function mergeNestedFields(mergedOptions, options) {
1806
- for (const key in options) {
1807
- if (key in options) {
1808
- const value = options[key];
1809
- if (isPureObject(value) && isPureObject(mergedOptions[key])) {
1810
- mergedOptions[key] = {
1811
- ...mergedOptions[key],
1812
- ...options[key]
2495
+ timeEnd(logLevel, message) {
2496
+ return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
2497
+ }
2498
+ timeStamp(logLevel, message) {
2499
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop2);
2500
+ }
2501
+ group(logLevel, message) {
2502
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
2503
+ collapsed: false
1813
2504
  };
1814
- } else {
1815
- mergedOptions[key] = options[key];
2505
+ const options = normalizeArguments2({
2506
+ logLevel,
2507
+ message,
2508
+ opts
2509
+ });
2510
+ const {
2511
+ collapsed
2512
+ } = opts;
2513
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
2514
+ return this._getLogFunction(options);
2515
+ }
2516
+ groupCollapsed(logLevel, message) {
2517
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2518
+ return this.group(logLevel, message, Object.assign({}, opts, {
2519
+ collapsed: true
2520
+ }));
2521
+ }
2522
+ groupEnd(logLevel) {
2523
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop2);
2524
+ }
2525
+ withGroup(logLevel, message, func) {
2526
+ this.group(logLevel, message)();
2527
+ try {
2528
+ func();
2529
+ } finally {
2530
+ this.groupEnd(logLevel)();
2531
+ }
2532
+ }
2533
+ trace() {
2534
+ if (console.trace) {
2535
+ console.trace();
2536
+ }
2537
+ }
2538
+ _shouldLog(logLevel) {
2539
+ return this.isEnabled() && this.getLevel() >= normalizeLogLevel2(logLevel);
2540
+ }
2541
+ _getLogFunction(logLevel, message, method, args, opts) {
2542
+ if (this._shouldLog(logLevel)) {
2543
+ opts = normalizeArguments2({
2544
+ logLevel,
2545
+ message,
2546
+ args,
2547
+ opts
2548
+ });
2549
+ method = method || opts.method;
2550
+ assert4(method);
2551
+ opts.total = this.getTotal();
2552
+ opts.delta = this.getDelta();
2553
+ this._deltaTs = getHiResTimestamp3();
2554
+ const tag = opts.tag || opts.message;
2555
+ if (opts.once) {
2556
+ if (!cache2[tag]) {
2557
+ cache2[tag] = getHiResTimestamp3();
2558
+ } else {
2559
+ return noop2;
2560
+ }
2561
+ }
2562
+ message = decorateMessage2(this.id, opts.message, opts);
2563
+ return method.bind(console, message, ...opts.args);
2564
+ }
2565
+ return noop2;
1816
2566
  }
1817
- }
1818
- }
1819
- }
1820
- function addUrlOptions(options, url) {
1821
- if (url && !("baseUri" in options)) {
1822
- options.baseUri = url;
1823
- }
1824
- }
1825
- var getGlobalLoaderOptions;
1826
- var init_option_utils = __esm({
1827
- "../core/src/lib/loader-utils/option-utils.ts"() {
1828
- init_is_type();
1829
- init_fetch_file();
1830
- init_loggers();
1831
- init_option_defaults();
1832
- getGlobalLoaderOptions = () => {
1833
- const state = getGlobalLoaderState();
1834
- state.globalOptions = state.globalOptions || { ...DEFAULT_LOADER_OPTIONS };
1835
- return state.globalOptions;
1836
2567
  };
2568
+ _defineProperty(Log2, "VERSION", VERSION4);
1837
2569
  }
1838
2570
  });
1839
2571
 
1840
- // ../core/src/lib/loader-utils/normalize-loader.ts
1841
- function isLoaderObject(loader) {
1842
- if (!loader) {
1843
- return false;
1844
- }
1845
- if (Array.isArray(loader)) {
1846
- loader = loader[0];
1847
- }
1848
- const hasExtensions = Array.isArray(loader?.extensions);
1849
- return hasExtensions;
1850
- }
1851
- function normalizeLoader(loader) {
1852
- assert(loader, "null loader");
1853
- assert(isLoaderObject(loader), "invalid loader");
1854
- let options;
1855
- if (Array.isArray(loader)) {
1856
- options = loader[1];
1857
- loader = loader[0];
1858
- loader = {
1859
- ...loader,
1860
- options: { ...loader.options, ...options }
1861
- };
1862
- }
1863
- if (loader?.parseTextSync || loader?.parseText) {
1864
- loader.text = true;
1865
- }
1866
- if (!loader.text) {
1867
- loader.binary = true;
1868
- }
1869
- return loader;
1870
- }
1871
- var init_normalize_loader = __esm({
1872
- "../core/src/lib/loader-utils/normalize-loader.ts"() {
1873
- init_src2();
2572
+ // ../../node_modules/@probe.gl/log/dist/esm/index.js
2573
+ var esm_default2;
2574
+ var init_esm4 = __esm({
2575
+ "../../node_modules/@probe.gl/log/dist/esm/index.js"() {
2576
+ init_log2();
2577
+ init_log2();
2578
+ esm_default2 = new Log2({
2579
+ id: "@probe.gl/log"
2580
+ });
1874
2581
  }
1875
2582
  });
1876
2583
 
1877
- // ../core/src/lib/api/register-loaders.ts
1878
- function getRegisteredLoaders() {
1879
- return getGlobalLoaderRegistry();
1880
- }
1881
- var getGlobalLoaderRegistry;
1882
- var init_register_loaders = __esm({
1883
- "../core/src/lib/api/register-loaders.ts"() {
1884
- init_option_utils();
1885
- getGlobalLoaderRegistry = () => {
1886
- const state = getGlobalLoaderState();
1887
- state.loaderRegistry = state.loaderRegistry || [];
1888
- return state.loaderRegistry;
1889
- };
2584
+ // ../core/src/lib/utils/log.ts
2585
+ var log;
2586
+ var init_log3 = __esm({
2587
+ "../core/src/lib/utils/log.ts"() {
2588
+ init_esm4();
2589
+ log = new Log2({ id: "loaders.gl" });
1890
2590
  }
1891
2591
  });
1892
2592
 
@@ -1933,13 +2633,22 @@
1933
2633
  const { url, type } = getResourceUrlAndType(data);
1934
2634
  const testUrl = url || context?.url;
1935
2635
  let loader = null;
2636
+ let reason = "";
1936
2637
  if (options?.mimeType) {
1937
2638
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
2639
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
1938
2640
  }
1939
2641
  loader = loader || findLoaderByUrl(loaders, testUrl);
2642
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
1940
2643
  loader = loader || findLoaderByMIMEType(loaders, type);
2644
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
1941
2645
  loader = loader || findLoaderByInitialBytes(loaders, data);
2646
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
1942
2647
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
2648
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
2649
+ if (reason) {
2650
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
2651
+ }
1943
2652
  return loader;
1944
2653
  }
1945
2654
  function validHTTPResponse(data) {
@@ -2066,6 +2775,7 @@
2066
2775
  "../core/src/lib/api/select-loader.ts"() {
2067
2776
  init_src2();
2068
2777
  init_normalize_loader();
2778
+ init_log3();
2069
2779
  init_resource_utils();
2070
2780
  init_register_loaders();
2071
2781
  init_is_type();
@@ -2379,12 +3089,12 @@
2379
3089
  });
2380
3090
 
2381
3091
  // ../../node_modules/@math.gl/core/dist/esm/lib/assert.js
2382
- function assert4(condition, message) {
3092
+ function assert5(condition, message) {
2383
3093
  if (!condition) {
2384
3094
  throw new Error("math.gl assertion ".concat(message));
2385
3095
  }
2386
3096
  }
2387
- var init_assert4 = __esm({
3097
+ var init_assert5 = __esm({
2388
3098
  "../../node_modules/@math.gl/core/dist/esm/lib/assert.js"() {
2389
3099
  }
2390
3100
  });
@@ -2502,10 +3212,10 @@
2502
3212
  var init_math_array = __esm({
2503
3213
  "../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js"() {
2504
3214
  init_common();
2505
- init_assert4();
3215
+ init_assert5();
2506
3216
  MathArray = class extends _extendableBuiltin(Array) {
2507
3217
  get ELEMENTS() {
2508
- assert4(false);
3218
+ assert5(false);
2509
3219
  return 0;
2510
3220
  }
2511
3221
  clone() {
@@ -2731,14 +3441,14 @@
2731
3441
  "../../node_modules/@math.gl/core/dist/esm/classes/base/vector.js"() {
2732
3442
  init_math_array();
2733
3443
  init_validators();
2734
- init_assert4();
3444
+ init_assert5();
2735
3445
  Vector = class extends MathArray {
2736
3446
  get ELEMENTS() {
2737
- assert4(false);
3447
+ assert5(false);
2738
3448
  return 0;
2739
3449
  }
2740
3450
  copy(vector) {
2741
- assert4(false);
3451
+ assert5(false);
2742
3452
  return this;
2743
3453
  }
2744
3454
  get x() {
@@ -2822,11 +3532,11 @@
2822
3532
  return this.distanceSquared(vector);
2823
3533
  }
2824
3534
  getComponent(i2) {
2825
- assert4(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
3535
+ assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
2826
3536
  return checkNumber(this[i2]);
2827
3537
  }
2828
3538
  setComponent(i2, value) {
2829
- assert4(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
3539
+ assert5(i2 >= 0 && i2 < this.ELEMENTS, "index is out of range");
2830
3540
  this[i2] = value;
2831
3541
  return this.check();
2832
3542
  }
@@ -3248,14 +3958,14 @@
3248
3958
  init_math_array();
3249
3959
  init_validators();
3250
3960
  init_common();
3251
- init_assert4();
3961
+ init_assert5();
3252
3962
  Matrix = class extends MathArray {
3253
3963
  get ELEMENTS() {
3254
- assert4(false);
3964
+ assert5(false);
3255
3965
  return 0;
3256
3966
  }
3257
3967
  get RANK() {
3258
- assert4(false);
3968
+ assert5(false);
3259
3969
  return 0;
3260
3970
  }
3261
3971
  toString() {
@@ -4929,7 +5639,7 @@
4929
5639
  "../../node_modules/@math.gl/core/dist/esm/classes/quaternion.js"() {
4930
5640
  init_math_array();
4931
5641
  init_validators();
4932
- init_assert4();
5642
+ init_assert5();
4933
5643
  init_quat();
4934
5644
  init_vec4();
4935
5645
  IDENTITY_QUATERNION = [0, 0, 0, 1];
@@ -5038,12 +5748,12 @@
5038
5748
  return this.check();
5039
5749
  }
5040
5750
  multiplyRight(a2, b) {
5041
- assert4(!b);
5751
+ assert5(!b);
5042
5752
  multiply3(this, this, a2);
5043
5753
  return this.check();
5044
5754
  }
5045
5755
  multiplyLeft(a2, b) {
5046
- assert4(!b);
5756
+ assert5(!b);
5047
5757
  multiply3(this, a2, this);
5048
5758
  return this.check();
5049
5759
  }
@@ -5147,8 +5857,8 @@
5147
5857
  });
5148
5858
 
5149
5859
  // ../../node_modules/@math.gl/core/dist/esm/index.js
5150
- var globals4, global_4;
5151
- var init_esm3 = __esm({
5860
+ var globals5, global_5;
5861
+ var init_esm5 = __esm({
5152
5862
  "../../node_modules/@math.gl/core/dist/esm/index.js"() {
5153
5863
  init_common();
5154
5864
  init_vector3();
@@ -5157,14 +5867,14 @@
5157
5867
  init_quaternion();
5158
5868
  init_common();
5159
5869
  init_math_utils();
5160
- init_assert4();
5161
- globals4 = {
5870
+ init_assert5();
5871
+ globals5 = {
5162
5872
  self: typeof self !== "undefined" && self,
5163
5873
  window: typeof window !== "undefined" && window,
5164
5874
  global: typeof global !== "undefined" && global
5165
5875
  };
5166
- global_4 = globals4.global || globals4.self || globals4.window;
5167
- global_4.mathgl = {
5876
+ global_5 = globals5.global || globals5.self || globals5.window;
5877
+ global_5.mathgl = {
5168
5878
  config
5169
5879
  };
5170
5880
  }
@@ -5189,7 +5899,7 @@
5189
5899
  });
5190
5900
 
5191
5901
  // ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
5192
- function fromCartographic(cartographic, result, map3 = noop2) {
5902
+ function fromCartographic(cartographic, result, map3 = noop3) {
5193
5903
  if (isArray(cartographic)) {
5194
5904
  result[0] = map3(cartographic[0]);
5195
5905
  result[1] = map3(cartographic[1]);
@@ -5206,9 +5916,9 @@
5206
5916
  return result;
5207
5917
  }
5208
5918
  function fromCartographicToRadians(cartographic, vector = scratchVector) {
5209
- return fromCartographic(cartographic, vector, config._cartographicRadians ? noop2 : toRadians);
5919
+ return fromCartographic(cartographic, vector, config._cartographicRadians ? noop3 : toRadians);
5210
5920
  }
5211
- function toCartographic(vector, cartographic, map3 = noop2) {
5921
+ function toCartographic(vector, cartographic, map3 = noop3) {
5212
5922
  if (isArray(cartographic)) {
5213
5923
  cartographic[0] = map3(vector[0]);
5214
5924
  cartographic[1] = map3(vector[1]);
@@ -5225,14 +5935,14 @@
5225
5935
  return cartographic;
5226
5936
  }
5227
5937
  function toCartographicFromRadians(vector, cartographic) {
5228
- return toCartographic(vector, cartographic, config._cartographicRadians ? noop2 : toDegrees);
5938
+ return toCartographic(vector, cartographic, config._cartographicRadians ? noop3 : toDegrees);
5229
5939
  }
5230
- var noop2, scratchVector;
5940
+ var noop3, scratchVector;
5231
5941
  var init_type_utils = __esm({
5232
5942
  "../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js"() {
5233
- init_esm3();
5943
+ init_esm5();
5234
5944
  init_constants();
5235
- noop2 = (x) => x;
5945
+ noop3 = (x) => x;
5236
5946
  scratchVector = new Vector3();
5237
5947
  }
5238
5948
  });
@@ -5296,7 +6006,7 @@
5296
6006
  var scratchVector2, scaleToGeodeticSurfaceIntersection, scaleToGeodeticSurfaceGradient;
5297
6007
  var init_scale_to_geodetic_surface = __esm({
5298
6008
  "../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js"() {
5299
- init_esm3();
6009
+ init_esm5();
5300
6010
  scratchVector2 = new Vector3();
5301
6011
  scaleToGeodeticSurfaceIntersection = new Vector3();
5302
6012
  scaleToGeodeticSurfaceGradient = new Vector3();
@@ -5306,7 +6016,7 @@
5306
6016
  // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/ellipsoid-transform.js
5307
6017
  function localFrameToFixedFrame(ellipsoid, firstAxis, secondAxis, thirdAxis, cartesianOrigin, result) {
5308
6018
  const thirdAxisInferred = VECTOR_PRODUCT_LOCAL_FRAME[firstAxis] && VECTOR_PRODUCT_LOCAL_FRAME[firstAxis][secondAxis];
5309
- assert4(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
6019
+ assert5(thirdAxisInferred && (!thirdAxis || thirdAxis === thirdAxisInferred));
5310
6020
  let firstAxisVector;
5311
6021
  let secondAxisVector;
5312
6022
  let thirdAxisVector;
@@ -5368,7 +6078,7 @@
5368
6078
  var EPSILON14, scratchOrigin, VECTOR_PRODUCT_LOCAL_FRAME, degeneratePositionLocalFrame, scratchAxisVectors, scratchVector1, scratchVector22, scratchVector3;
5369
6079
  var init_ellipsoid_transform = __esm({
5370
6080
  "../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/ellipsoid-transform.js"() {
5371
- init_esm3();
6081
+ init_esm5();
5372
6082
  EPSILON14 = 1e-14;
5373
6083
  scratchOrigin = new Vector3();
5374
6084
  VECTOR_PRODUCT_LOCAL_FRAME = {
@@ -5435,7 +6145,7 @@
5435
6145
  var scratchVector4, scratchNormal, scratchK, scratchPosition, scratchHeight, scratchCartesian, wgs84, Ellipsoid;
5436
6146
  var init_ellipsoid = __esm({
5437
6147
  "../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/ellipsoid.js"() {
5438
- init_esm3();
6148
+ init_esm5();
5439
6149
  init_vec3();
5440
6150
  init_constants();
5441
6151
  init_type_utils();
@@ -5453,9 +6163,9 @@
5453
6163
  return wgs84;
5454
6164
  }
5455
6165
  constructor(x = 0, y = 0, z = 0) {
5456
- assert4(x >= 0);
5457
- assert4(y >= 0);
5458
- assert4(z >= 0);
6166
+ assert5(x >= 0);
6167
+ assert5(y >= 0);
6168
+ assert5(z >= 0);
5459
6169
  this.radii = new Vector3(x, y, z);
5460
6170
  this.radiiSquared = new Vector3(x * x, y * y, z * z);
5461
6171
  this.radiiToTheFourth = new Vector3(x * x * x * x, y * y * y * y, z * z * z * z);
@@ -5540,8 +6250,8 @@
5540
6250
  return scratchPosition.from(position).scale(this.radii).to(result);
5541
6251
  }
5542
6252
  getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
5543
- assert4(equals(this.radii.x, this.radii.y, math_utils_default.EPSILON15));
5544
- assert4(this.radii.z > 0);
6253
+ assert5(equals(this.radii.x, this.radii.y, math_utils_default.EPSILON15));
6254
+ assert5(this.radii.z > 0);
5545
6255
  scratchPosition.from(position);
5546
6256
  const z = scratchPosition.z * (1 - this.squaredXOverSquaredZ);
5547
6257
  if (Math.abs(z) >= this.radii.z - buffer) {
@@ -5554,7 +6264,7 @@
5554
6264
  });
5555
6265
 
5556
6266
  // ../../node_modules/@math.gl/geospatial/dist/esm/index.js
5557
- var init_esm4 = __esm({
6267
+ var init_esm6 = __esm({
5558
6268
  "../../node_modules/@math.gl/geospatial/dist/esm/index.js"() {
5559
6269
  init_ellipsoid();
5560
6270
  init_type_utils();
@@ -5562,10 +6272,10 @@
5562
6272
  });
5563
6273
 
5564
6274
  // ../images/src/lib/utils/version.ts
5565
- var VERSION4;
6275
+ var VERSION5;
5566
6276
  var init_version2 = __esm({
5567
6277
  "../images/src/lib/utils/version.ts"() {
5568
- VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6278
+ VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
5569
6279
  }
5570
6280
  });
5571
6281
 
@@ -5960,7 +6670,7 @@
5960
6670
  id: "image",
5961
6671
  module: "images",
5962
6672
  name: "Images",
5963
- version: VERSION4,
6673
+ version: VERSION5,
5964
6674
  mimeTypes: MIME_TYPES,
5965
6675
  extensions: EXTENSIONS,
5966
6676
  parse: parseImage,
@@ -5978,10 +6688,10 @@
5978
6688
  });
5979
6689
 
5980
6690
  // ../draco/src/lib/utils/version.ts
5981
- var VERSION5;
6691
+ var VERSION6;
5982
6692
  var init_version3 = __esm({
5983
6693
  "../draco/src/lib/utils/version.ts"() {
5984
- VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
6694
+ VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
5985
6695
  }
5986
6696
  });
5987
6697
 
@@ -6003,7 +6713,7 @@
6003
6713
  id: "draco",
6004
6714
  module: "draco",
6005
6715
  shapes: ["mesh"],
6006
- version: VERSION5,
6716
+ version: VERSION6,
6007
6717
  worker: true,
6008
6718
  extensions: ["drc"],
6009
6719
  mimeTypes: ["application/octet-stream"],
@@ -6046,12 +6756,12 @@
6046
6756
  });
6047
6757
 
6048
6758
  // ../schema/src/lib/utils/assert.ts
6049
- function assert5(condition, message) {
6759
+ function assert6(condition, message) {
6050
6760
  if (!condition) {
6051
6761
  throw new Error(message || "loader assertion failed.");
6052
6762
  }
6053
6763
  }
6054
- var init_assert5 = __esm({
6764
+ var init_assert6 = __esm({
6055
6765
  "../schema/src/lib/utils/assert.ts"() {
6056
6766
  }
6057
6767
  });
@@ -6072,10 +6782,10 @@
6072
6782
  var Schema;
6073
6783
  var init_schema = __esm({
6074
6784
  "../schema/src/lib/schema/impl/schema.ts"() {
6075
- init_assert5();
6785
+ init_assert6();
6076
6786
  Schema = class {
6077
6787
  constructor(fields, metadata) {
6078
- assert5(Array.isArray(fields));
6788
+ assert6(Array.isArray(fields));
6079
6789
  checkNames(fields);
6080
6790
  this.fields = fields;
6081
6791
  this.metadata = metadata || new Map();
@@ -7057,10 +7767,10 @@
7057
7767
  });
7058
7768
 
7059
7769
  // ../textures/src/lib/utils/version.ts
7060
- var VERSION6;
7770
+ var VERSION7;
7061
7771
  var init_version4 = __esm({
7062
7772
  "../textures/src/lib/utils/version.ts"() {
7063
- VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
7773
+ VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
7064
7774
  }
7065
7775
  });
7066
7776
 
@@ -7127,13 +7837,13 @@
7127
7837
  });
7128
7838
  });
7129
7839
  }
7130
- var VERSION7, BASIS_CDN_ENCODER_WASM, BASIS_CDN_ENCODER_JS, loadBasisTranscoderPromise, loadBasisEncoderPromise;
7840
+ var VERSION8, BASIS_CDN_ENCODER_WASM, BASIS_CDN_ENCODER_JS, loadBasisTranscoderPromise, loadBasisEncoderPromise;
7131
7841
  var init_basis_module_loader = __esm({
7132
7842
  "../textures/src/lib/parsers/basis-module-loader.ts"() {
7133
7843
  init_src();
7134
- VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
7135
- BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.wasm`;
7136
- BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION7}/dist/libs/basis_encoder.js`;
7844
+ VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
7845
+ BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.wasm`;
7846
+ BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.js`;
7137
7847
  }
7138
7848
  });
7139
7849
 
@@ -7532,7 +8242,7 @@
7532
8242
  const basisFile = new BasisFile(new Uint8Array(data));
7533
8243
  try {
7534
8244
  if (!basisFile.startTranscoding()) {
7535
- return null;
8245
+ throw new Error("Failed to start basis transcoding");
7536
8246
  }
7537
8247
  const imageCount = basisFile.getNumImages();
7538
8248
  const images = [];
@@ -7558,22 +8268,22 @@
7558
8268
  const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
7559
8269
  const decodedData = new Uint8Array(decodedSize);
7560
8270
  if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
7561
- return null;
8271
+ throw new Error("failed to start Basis transcoding");
7562
8272
  }
7563
8273
  return {
7564
8274
  width,
7565
8275
  height,
7566
8276
  data: decodedData,
7567
8277
  compressed,
7568
- hasAlpha,
7569
- format
8278
+ format,
8279
+ hasAlpha
7570
8280
  };
7571
8281
  }
7572
8282
  function parseKTX2File(KTX2File, data, options) {
7573
8283
  const ktx2File = new KTX2File(new Uint8Array(data));
7574
8284
  try {
7575
8285
  if (!ktx2File.startTranscoding()) {
7576
- return null;
8286
+ throw new Error("failed to start KTX2 transcoding");
7577
8287
  }
7578
8288
  const levelsCount = ktx2File.getLevels();
7579
8289
  const levels = [];
@@ -7581,7 +8291,7 @@
7581
8291
  levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
7582
8292
  break;
7583
8293
  }
7584
- return levels;
8294
+ return [levels];
7585
8295
  } finally {
7586
8296
  ktx2File.close();
7587
8297
  ktx2File.delete();
@@ -7593,14 +8303,14 @@
7593
8303
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
7594
8304
  const decodedData = new Uint8Array(decodedSize);
7595
8305
  if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
7596
- return null;
8306
+ throw new Error("Failed to transcode KTX2 image");
7597
8307
  }
7598
8308
  return {
7599
8309
  width,
7600
8310
  height,
7601
8311
  data: decodedData,
7602
8312
  compressed,
7603
- alphaFlag,
8313
+ hasAlpha: alphaFlag,
7604
8314
  format
7605
8315
  };
7606
8316
  }
@@ -7699,7 +8409,7 @@
7699
8409
  name: "Basis",
7700
8410
  id: "basis",
7701
8411
  module: "textures",
7702
- version: VERSION6,
8412
+ version: VERSION7,
7703
8413
  worker: true,
7704
8414
  extensions: ["basis", "ktx2"],
7705
8415
  mimeTypes: ["application/octet-stream", "image/ktx2"],
@@ -8042,7 +8752,7 @@
8042
8752
  name: "Texture Containers",
8043
8753
  id: "compressed-texture",
8044
8754
  module: "textures",
8045
- version: VERSION6,
8755
+ version: VERSION7,
8046
8756
  worker: true,
8047
8757
  extensions: [
8048
8758
  "ktx",
@@ -8073,7 +8783,7 @@
8073
8783
  containerFormat: "ktx2",
8074
8784
  module: "encoder"
8075
8785
  };
8076
- return await parseBasis(arrayBuffer, options);
8786
+ return (await parseBasis(arrayBuffer, options))[0];
8077
8787
  }
8078
8788
  return parseCompressedTexture(arrayBuffer);
8079
8789
  }
@@ -8141,10 +8851,10 @@
8141
8851
  });
8142
8852
 
8143
8853
  // ../../node_modules/@luma.gl/constants/dist/esm/index.js
8144
- var esm_default2;
8145
- var init_esm5 = __esm({
8854
+ var esm_default3;
8855
+ var init_esm7 = __esm({
8146
8856
  "../../node_modules/@luma.gl/constants/dist/esm/index.js"() {
8147
- esm_default2 = {
8857
+ esm_default3 = {
8148
8858
  DEPTH_BUFFER_BIT: 256,
8149
8859
  STENCIL_BUFFER_BIT: 1024,
8150
8860
  COLOR_BUFFER_BIT: 16384,
@@ -8802,14 +9512,14 @@
8802
9512
  var GL_TYPE_MAP, STRING_ATTRIBUTE_TYPE, OBJECT_ID_ATTRIBUTE_TYPE, FLOAT_64_TYPE, INT_16_ATTRIBUTE_TYPE, COORDINATE_SYSTEM;
8803
9513
  var init_constants2 = __esm({
8804
9514
  "src/lib/parsers/constants.ts"() {
8805
- init_esm5();
9515
+ init_esm7();
8806
9516
  init_types();
8807
9517
  GL_TYPE_MAP = {
8808
- UInt8: esm_default2.UNSIGNED_BYTE,
8809
- UInt16: esm_default2.UNSIGNED_INT,
8810
- Float32: esm_default2.FLOAT,
8811
- UInt32: esm_default2.UNSIGNED_INT,
8812
- UInt64: esm_default2.DOUBLE
9518
+ UInt8: esm_default3.UNSIGNED_BYTE,
9519
+ UInt16: esm_default3.UNSIGNED_INT,
9520
+ Float32: esm_default3.FLOAT,
9521
+ UInt32: esm_default3.UNSIGNED_INT,
9522
+ UInt64: esm_default3.DOUBLE
8813
9523
  };
8814
9524
  STRING_ATTRIBUTE_TYPE = "String";
8815
9525
  OBJECT_ID_ATTRIBUTE_TYPE = "Oid32";
@@ -8857,7 +9567,10 @@
8857
9567
  tile.content.texture = await parse(arrayBuffer2, loader, options2);
8858
9568
  }
8859
9569
  } else if (loader === CompressedTextureLoader || loader === BasisLoader) {
8860
- const texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
9570
+ let texture = await load(arrayBuffer2, loader, tile.textureLoaderOptions);
9571
+ if (loader === BasisLoader) {
9572
+ texture = texture[0];
9573
+ }
8861
9574
  tile.content.texture = {
8862
9575
  compressed: true,
8863
9576
  mipmaps: false,
@@ -9009,38 +9722,38 @@
9009
9722
  byteOffset
9010
9723
  };
9011
9724
  }
9012
- function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCount, attributesOrder) {
9725
+ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, attributeCount, attributesOrder) {
9013
9726
  const attributes = {};
9014
9727
  for (const attribute of attributesOrder) {
9015
9728
  if (vertexAttributes[attribute]) {
9016
9729
  const { valueType, valuesPerElement } = vertexAttributes[attribute];
9017
- const count = vertexCount;
9018
- if (byteOffset + count * valuesPerElement > arrayBuffer.byteLength) {
9730
+ if (byteOffset + attributeCount * valuesPerElement * sizeOf(valueType) <= arrayBuffer.byteLength) {
9731
+ const buffer = arrayBuffer.slice(byteOffset);
9732
+ let value;
9733
+ if (valueType === "UInt64") {
9734
+ value = parseUint64Values(buffer, attributeCount * valuesPerElement, sizeOf(valueType));
9735
+ } else {
9736
+ const TypedArrayType = getConstructorForDataFormat(valueType);
9737
+ value = new TypedArrayType(buffer, 0, attributeCount * valuesPerElement);
9738
+ }
9739
+ attributes[attribute] = {
9740
+ value,
9741
+ type: GL_TYPE_MAP[valueType],
9742
+ size: valuesPerElement
9743
+ };
9744
+ switch (attribute) {
9745
+ case "color":
9746
+ attributes.color.normalized = true;
9747
+ break;
9748
+ case "position":
9749
+ case "region":
9750
+ case "normal":
9751
+ default:
9752
+ }
9753
+ byteOffset = byteOffset + attributeCount * valuesPerElement * sizeOf(valueType);
9754
+ } else if (attribute !== "uv0") {
9019
9755
  break;
9020
9756
  }
9021
- const buffer = arrayBuffer.slice(byteOffset);
9022
- let value;
9023
- if (valueType === "UInt64") {
9024
- value = parseUint64Values(buffer, count * valuesPerElement, sizeOf(valueType));
9025
- } else {
9026
- const TypedArrayType = getConstructorForDataFormat(valueType);
9027
- value = new TypedArrayType(buffer, 0, count * valuesPerElement);
9028
- }
9029
- attributes[attribute] = {
9030
- value,
9031
- type: GL_TYPE_MAP[valueType],
9032
- size: valuesPerElement
9033
- };
9034
- switch (attribute) {
9035
- case "color":
9036
- attributes.color.normalized = true;
9037
- break;
9038
- case "position":
9039
- case "region":
9040
- case "normal":
9041
- default:
9042
- }
9043
- byteOffset = byteOffset + count * valuesPerElement * sizeOf(valueType);
9044
9757
  }
9045
9758
  }
9046
9759
  return { attributes, byteOffset };
@@ -9193,8 +9906,8 @@
9193
9906
  var init_parse_i3s_tile_content = __esm({
9194
9907
  "src/lib/parsers/parse-i3s-tile-content.ts"() {
9195
9908
  init_src3();
9196
- init_esm3();
9197
- init_esm4();
9909
+ init_esm5();
9910
+ init_esm6();
9198
9911
  init_src4();
9199
9912
  init_src6();
9200
9913
  init_src7();
@@ -9212,17 +9925,17 @@
9212
9925
  await parseI3STileContent(data, tile, tileset, options, context);
9213
9926
  return tile.content;
9214
9927
  }
9215
- var VERSION8, I3SContentLoader;
9928
+ var VERSION9, I3SContentLoader;
9216
9929
  var init_i3s_content_loader = __esm({
9217
9930
  "src/i3s-content-loader.ts"() {
9218
9931
  init_parse_i3s_tile_content();
9219
- VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9932
+ VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
9220
9933
  I3SContentLoader = {
9221
9934
  name: "I3S Content (Indexed Scene Layers)",
9222
9935
  id: "i3s-content",
9223
9936
  module: "i3s",
9224
9937
  worker: true,
9225
- version: VERSION8,
9938
+ version: VERSION9,
9226
9939
  mimeTypes: ["application/octet-stream"],
9227
9940
  parse: parse3,
9228
9941
  extensions: ["bin"],
@@ -9249,7 +9962,7 @@
9249
9962
  var scratchVector6, scratchNormal2;
9250
9963
  var init_axis_aligned_bounding_box = __esm({
9251
9964
  "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js"() {
9252
- init_esm3();
9965
+ init_esm5();
9253
9966
  init_constants3();
9254
9967
  scratchVector6 = new Vector3();
9255
9968
  scratchNormal2 = new Vector3();
@@ -9260,7 +9973,7 @@
9260
9973
  var scratchVector7, scratchVector23, BoundingSphere;
9261
9974
  var init_bounding_sphere = __esm({
9262
9975
  "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js"() {
9263
- init_esm3();
9976
+ init_esm5();
9264
9977
  init_mat4();
9265
9978
  init_constants3();
9266
9979
  scratchVector7 = new Vector3();
@@ -9350,7 +10063,7 @@
9350
10063
  var scratchVector32, scratchOffset, scratchVectorU, scratchVectorV, scratchVectorW, scratchCorner, scratchToCenter, MATRIX3, OrientedBoundingBox;
9351
10064
  var init_oriented_bounding_box = __esm({
9352
10065
  "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js"() {
9353
- init_esm3();
10066
+ init_esm5();
9354
10067
  init_bounding_sphere();
9355
10068
  init_constants3();
9356
10069
  scratchVector32 = new Vector3();
@@ -9544,7 +10257,7 @@
9544
10257
  var scratchPosition2, scratchNormal3, Plane;
9545
10258
  var init_plane = __esm({
9546
10259
  "../../node_modules/@math.gl/culling/dist/esm/lib/plane.js"() {
9547
- init_esm3();
10260
+ init_esm5();
9548
10261
  scratchPosition2 = new Vector3();
9549
10262
  scratchNormal3 = new Vector3();
9550
10263
  Plane = class {
@@ -9554,7 +10267,7 @@
9554
10267
  this.fromNormalDistance(normal, distance);
9555
10268
  }
9556
10269
  fromNormalDistance(normal, distance) {
9557
- assert4(Number.isFinite(distance));
10270
+ assert5(Number.isFinite(distance));
9558
10271
  this.normal.from(normal).normalize();
9559
10272
  this.distance = distance;
9560
10273
  return this;
@@ -9568,7 +10281,7 @@
9568
10281
  }
9569
10282
  fromCoefficients(a2, b, c2, d) {
9570
10283
  this.normal.set(a2, b, c2);
9571
- assert4(equals(this.normal.len(), 1));
10284
+ assert5(equals(this.normal.len(), 1));
9572
10285
  this.distance = d;
9573
10286
  return this;
9574
10287
  }
@@ -9600,7 +10313,7 @@
9600
10313
  var faces, scratchPlaneCenter, scratchPlaneNormal, scratchPlane;
9601
10314
  var init_culling_volume = __esm({
9602
10315
  "../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js"() {
9603
- init_esm3();
10316
+ init_esm5();
9604
10317
  init_constants3();
9605
10318
  init_plane();
9606
10319
  faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];
@@ -9614,7 +10327,7 @@
9614
10327
  var scratchPlaneUpVector, scratchPlaneRightVector, scratchPlaneNearCenter, scratchPlaneFarCenter, scratchPlaneNormal2;
9615
10328
  var init_perspective_off_center_frustum = __esm({
9616
10329
  "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js"() {
9617
- init_esm3();
10330
+ init_esm5();
9618
10331
  init_culling_volume();
9619
10332
  init_plane();
9620
10333
  scratchPlaneUpVector = new Vector3();
@@ -9636,7 +10349,7 @@
9636
10349
  var fromPointsXMin, fromPointsYMin, fromPointsZMin, fromPointsXMax, fromPointsYMax, fromPointsZMax, fromPointsCurrentPos, fromPointsScratch, fromPointsRitterCenter, fromPointsMinBoxPt, fromPointsMaxBoxPt, fromPointsNaiveCenterScratch, volumeConstant;
9637
10350
  var init_bounding_sphere_from_points = __esm({
9638
10351
  "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js"() {
9639
- init_esm3();
10352
+ init_esm5();
9640
10353
  init_bounding_sphere();
9641
10354
  fromPointsXMin = new Vector3();
9642
10355
  fromPointsYMin = new Vector3();
@@ -9658,7 +10371,7 @@
9658
10371
  var scratchMatrix, scratchUnitary, scratchDiagonal, jMatrix, jMatrixTranspose;
9659
10372
  var init_compute_eigen_decomposition = __esm({
9660
10373
  "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js"() {
9661
- init_esm3();
10374
+ init_esm5();
9662
10375
  scratchMatrix = new Matrix3();
9663
10376
  scratchUnitary = new Matrix3();
9664
10377
  scratchDiagonal = new Matrix3();
@@ -9671,7 +10384,7 @@
9671
10384
  var scratchVector24, scratchVector33, scratchVector42, scratchVector52, scratchVector62, scratchCovarianceResult, scratchEigenResult;
9672
10385
  var init_bounding_box_from_points = __esm({
9673
10386
  "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js"() {
9674
- init_esm3();
10387
+ init_esm5();
9675
10388
  init_compute_eigen_decomposition();
9676
10389
  init_oriented_bounding_box();
9677
10390
  init_axis_aligned_bounding_box();
@@ -9689,7 +10402,7 @@
9689
10402
  });
9690
10403
 
9691
10404
  // ../../node_modules/@math.gl/culling/dist/esm/index.js
9692
- var init_esm6 = __esm({
10405
+ var init_esm8 = __esm({
9693
10406
  "../../node_modules/@math.gl/culling/dist/esm/index.js"() {
9694
10407
  init_constants3();
9695
10408
  init_axis_aligned_bounding_box();
@@ -9743,15 +10456,15 @@
9743
10456
  data = parseNodePage(data);
9744
10457
  return data;
9745
10458
  }
9746
- var VERSION9, I3SNodePageLoader;
10459
+ var VERSION10, I3SNodePageLoader;
9747
10460
  var init_i3s_node_page_loader = __esm({
9748
10461
  "src/i3s-node-page-loader.ts"() {
9749
- VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10462
+ VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
9750
10463
  I3SNodePageLoader = {
9751
10464
  name: "I3S Node Page",
9752
10465
  id: "i3s-node-page",
9753
10466
  module: "i3s",
9754
- version: VERSION9,
10467
+ version: VERSION10,
9755
10468
  mimeTypes: ["application/json"],
9756
10469
  parse: parse4,
9757
10470
  extensions: ["json"],
@@ -10009,8 +10722,8 @@
10009
10722
  }
10010
10723
  var init_parse_i3s = __esm({
10011
10724
  "src/lib/parsers/parse-i3s.ts"() {
10725
+ init_esm8();
10012
10726
  init_esm6();
10013
- init_esm4();
10014
10727
  init_src3();
10015
10728
  init_src8();
10016
10729
  init_i3s_nodepages_tiles();
@@ -10070,14 +10783,14 @@
10070
10783
  }
10071
10784
  return null;
10072
10785
  }
10073
- var VERSION10, TILESET_REGEX, TILE_HEADER_REGEX, SLPK_HEX, I3SLoader;
10786
+ var VERSION11, TILESET_REGEX, TILE_HEADER_REGEX, SLPK_HEX, I3SLoader;
10074
10787
  var init_i3s_loader = __esm({
10075
10788
  "src/i3s-loader.ts"() {
10076
10789
  init_src3();
10077
10790
  init_i3s_content_loader();
10078
10791
  init_parse_i3s();
10079
10792
  init_constants2();
10080
- VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10793
+ VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10081
10794
  TILESET_REGEX = /layers\/[0-9]+$/;
10082
10795
  TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
10083
10796
  SLPK_HEX = "504b0304";
@@ -10085,7 +10798,7 @@
10085
10798
  name: "I3S (Indexed Scene Layers)",
10086
10799
  id: "i3s",
10087
10800
  module: "i3s",
10088
- version: VERSION10,
10801
+ version: VERSION11,
10089
10802
  mimeTypes: ["application/octet-stream"],
10090
10803
  parse: parseI3S,
10091
10804
  extensions: ["bin"],
@@ -10260,20 +10973,20 @@
10260
10973
  }
10261
10974
  return value;
10262
10975
  }
10263
- var VERSION11, EMPTY_VALUE, REJECTED_STATUS, I3SAttributeLoader;
10976
+ var VERSION12, EMPTY_VALUE, REJECTED_STATUS, I3SAttributeLoader;
10264
10977
  var init_i3s_attribute_loader = __esm({
10265
10978
  "src/i3s-attribute-loader.ts"() {
10266
10979
  init_src3();
10267
10980
  init_parse_i3s_attribute();
10268
10981
  init_url_utils();
10269
- VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10982
+ VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
10270
10983
  EMPTY_VALUE = "";
10271
10984
  REJECTED_STATUS = "rejected";
10272
10985
  I3SAttributeLoader = {
10273
10986
  name: "I3S Attribute",
10274
10987
  id: "i3s-attribute",
10275
10988
  module: "i3s",
10276
- version: VERSION11,
10989
+ version: VERSION12,
10277
10990
  mimeTypes: ["application/binary"],
10278
10991
  parse: parse5,
10279
10992
  extensions: ["bin"],
@@ -10327,16 +11040,16 @@
10327
11040
  }
10328
11041
  return parseBuildingSceneLayer(data, context.url);
10329
11042
  }
10330
- var VERSION12, I3SBuildingSceneLayerLoader;
11043
+ var VERSION13, I3SBuildingSceneLayerLoader;
10331
11044
  var init_i3s_building_scene_layer_loader = __esm({
10332
11045
  "src/i3s-building-scene-layer-loader.ts"() {
10333
11046
  init_parse_i3s_building_scene_layer();
10334
- VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
11047
+ VERSION13 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
10335
11048
  I3SBuildingSceneLayerLoader = {
10336
11049
  name: "I3S Building Scene Layer",
10337
11050
  id: "i3s-building-scene-layer",
10338
11051
  module: "i3s",
10339
- version: VERSION12,
11052
+ version: VERSION13,
10340
11053
  mimeTypes: ["application/json"],
10341
11054
  parse: parse6,
10342
11055
  extensions: ["json"],