@loaders.gl/tiles 4.0.0-alpha.5 → 4.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/constants.d.ts.map +1 -1
  3. package/dist/constants.js +30 -26
  4. package/dist/dist.min.js +1572 -855
  5. package/dist/es5/bundle.js +6 -0
  6. package/dist/es5/bundle.js.map +1 -0
  7. package/dist/es5/constants.js +44 -0
  8. package/dist/es5/constants.js.map +1 -0
  9. package/dist/es5/index.js +93 -0
  10. package/dist/es5/index.js.map +1 -0
  11. package/dist/es5/tileset/format-3d-tiles/tileset-3d-traverser.js +70 -0
  12. package/dist/es5/tileset/format-3d-tiles/tileset-3d-traverser.js.map +1 -0
  13. package/dist/es5/tileset/format-i3s/i3s-pending-tiles-register.js +45 -0
  14. package/dist/es5/tileset/format-i3s/i3s-pending-tiles-register.js.map +1 -0
  15. package/dist/es5/tileset/format-i3s/i3s-tile-manager.js +84 -0
  16. package/dist/es5/tileset/format-i3s/i3s-tile-manager.js.map +1 -0
  17. package/dist/es5/tileset/format-i3s/i3s-tileset-traverser.js +143 -0
  18. package/dist/es5/tileset/format-i3s/i3s-tileset-traverser.js.map +1 -0
  19. package/dist/es5/tileset/helpers/3d-tiles-options.js +12 -0
  20. package/dist/es5/tileset/helpers/3d-tiles-options.js.map +1 -0
  21. package/dist/es5/tileset/helpers/bounding-volume.js +176 -0
  22. package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -0
  23. package/dist/es5/tileset/helpers/frame-state.js +129 -0
  24. package/dist/es5/tileset/helpers/frame-state.js.map +1 -0
  25. package/dist/es5/tileset/helpers/i3s-lod.js +60 -0
  26. package/dist/es5/tileset/helpers/i3s-lod.js.map +1 -0
  27. package/dist/es5/tileset/helpers/tiles-3d-lod.js +103 -0
  28. package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +1 -0
  29. package/dist/es5/tileset/helpers/transform-utils.js +50 -0
  30. package/dist/es5/tileset/helpers/transform-utils.js.map +1 -0
  31. package/dist/es5/tileset/helpers/zoom.js +63 -0
  32. package/dist/es5/tileset/helpers/zoom.js.map +1 -0
  33. package/dist/es5/tileset/tile-3d.js +565 -0
  34. package/dist/es5/tileset/tile-3d.js.map +1 -0
  35. package/dist/es5/tileset/tileset-3d.js +890 -0
  36. package/dist/es5/tileset/tileset-3d.js.map +1 -0
  37. package/dist/es5/tileset/tileset-cache.js +85 -0
  38. package/dist/es5/tileset/tileset-cache.js.map +1 -0
  39. package/dist/es5/tileset/tileset-traverser.js +328 -0
  40. package/dist/es5/tileset/tileset-traverser.js.map +1 -0
  41. package/dist/es5/types.js +2 -0
  42. package/dist/es5/types.js.map +1 -0
  43. package/dist/es5/utils/doubly-linked-list-node.js +21 -0
  44. package/dist/es5/utils/doubly-linked-list-node.js.map +1 -0
  45. package/dist/es5/utils/doubly-linked-list.js +88 -0
  46. package/dist/es5/utils/doubly-linked-list.js.map +1 -0
  47. package/dist/es5/utils/managed-array.js +126 -0
  48. package/dist/es5/utils/managed-array.js.map +1 -0
  49. package/dist/esm/bundle.js +4 -0
  50. package/dist/esm/bundle.js.map +1 -0
  51. package/dist/esm/constants.js +32 -0
  52. package/dist/esm/constants.js.map +1 -0
  53. package/dist/esm/index.js +10 -0
  54. package/dist/esm/index.js.map +1 -0
  55. package/dist/{tileset/traversers → esm/tileset/format-3d-tiles}/tileset-3d-traverser.js +2 -13
  56. package/dist/esm/tileset/format-3d-tiles/tileset-3d-traverser.js.map +1 -0
  57. package/dist/esm/tileset/format-i3s/i3s-pending-tiles-register.js +26 -0
  58. package/dist/esm/tileset/format-i3s/i3s-pending-tiles-register.js.map +1 -0
  59. package/dist/esm/tileset/format-i3s/i3s-tile-manager.js +79 -0
  60. package/dist/esm/tileset/format-i3s/i3s-tile-manager.js.map +1 -0
  61. package/dist/{tileset/traversers → esm/tileset/format-i3s}/i3s-tileset-traverser.js +14 -26
  62. package/dist/esm/tileset/format-i3s/i3s-tileset-traverser.js.map +1 -0
  63. package/dist/esm/tileset/helpers/3d-tiles-options.js +6 -0
  64. package/dist/esm/tileset/helpers/3d-tiles-options.js.map +1 -0
  65. package/dist/esm/tileset/helpers/bounding-volume.js +155 -0
  66. package/dist/esm/tileset/helpers/bounding-volume.js.map +1 -0
  67. package/dist/esm/tileset/helpers/frame-state.js +109 -0
  68. package/dist/esm/tileset/helpers/frame-state.js.map +1 -0
  69. package/dist/esm/tileset/helpers/i3s-lod.js +53 -0
  70. package/dist/esm/tileset/helpers/i3s-lod.js.map +1 -0
  71. package/dist/esm/tileset/helpers/tiles-3d-lod.js +100 -0
  72. package/dist/{tileset → esm/tileset}/helpers/tiles-3d-lod.js.map +1 -1
  73. package/dist/esm/tileset/helpers/transform-utils.js +50 -0
  74. package/dist/esm/tileset/helpers/transform-utils.js.map +1 -0
  75. package/dist/esm/tileset/helpers/zoom.js +55 -0
  76. package/dist/esm/tileset/helpers/zoom.js.map +1 -0
  77. package/dist/esm/tileset/tile-3d.js +445 -0
  78. package/dist/esm/tileset/tile-3d.js.map +1 -0
  79. package/dist/esm/tileset/tileset-3d.js +637 -0
  80. package/dist/esm/tileset/tileset-3d.js.map +1 -0
  81. package/dist/esm/tileset/tileset-cache.js +60 -0
  82. package/dist/esm/tileset/tileset-cache.js.map +1 -0
  83. package/dist/{tileset/traversers → esm/tileset}/tileset-traverser.js +20 -72
  84. package/dist/esm/tileset/tileset-traverser.js.map +1 -0
  85. package/dist/esm/types.js +2 -0
  86. package/dist/esm/types.js.map +1 -0
  87. package/dist/esm/utils/doubly-linked-list-node.js +12 -0
  88. package/dist/esm/utils/doubly-linked-list-node.js.map +1 -0
  89. package/dist/esm/utils/doubly-linked-list.js +65 -0
  90. package/dist/esm/utils/doubly-linked-list.js.map +1 -0
  91. package/dist/esm/utils/managed-array.js +87 -0
  92. package/dist/esm/utils/managed-array.js.map +1 -0
  93. package/dist/index.d.ts +4 -4
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +26 -10
  96. package/dist/tileset/{traversers → format-3d-tiles}/tileset-3d-traverser.d.ts +2 -2
  97. package/dist/tileset/format-3d-tiles/tileset-3d-traverser.d.ts.map +1 -0
  98. package/dist/tileset/format-3d-tiles/tileset-3d-traverser.js +54 -0
  99. package/dist/tileset/format-i3s/i3s-pending-tiles-register.d.ts +27 -0
  100. package/dist/tileset/format-i3s/i3s-pending-tiles-register.d.ts.map +1 -0
  101. package/dist/tileset/format-i3s/i3s-pending-tiles-register.js +47 -0
  102. package/dist/tileset/format-i3s/i3s-tile-manager.d.ts +34 -0
  103. package/dist/tileset/format-i3s/i3s-tile-manager.d.ts.map +1 -0
  104. package/dist/tileset/format-i3s/i3s-tile-manager.js +80 -0
  105. package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts +25 -0
  106. package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts.map +1 -0
  107. package/dist/tileset/format-i3s/i3s-tileset-traverser.js +92 -0
  108. package/dist/tileset/helpers/3d-tiles-options.js +8 -5
  109. package/dist/tileset/helpers/bounding-volume.d.ts +10 -0
  110. package/dist/tileset/helpers/bounding-volume.d.ts.map +1 -1
  111. package/dist/tileset/helpers/bounding-volume.js +274 -69
  112. package/dist/tileset/helpers/frame-state.d.ts +16 -5
  113. package/dist/tileset/helpers/frame-state.d.ts.map +1 -1
  114. package/dist/tileset/helpers/frame-state.js +131 -49
  115. package/dist/tileset/helpers/i3s-lod.d.ts +1 -1
  116. package/dist/tileset/helpers/i3s-lod.d.ts.map +1 -1
  117. package/dist/tileset/helpers/i3s-lod.js +82 -64
  118. package/dist/tileset/helpers/tiles-3d-lod.d.ts.map +1 -1
  119. package/dist/tileset/helpers/tiles-3d-lod.js +112 -100
  120. package/dist/tileset/helpers/transform-utils.d.ts.map +1 -1
  121. package/dist/tileset/helpers/transform-utils.js +51 -56
  122. package/dist/tileset/helpers/zoom.d.ts +41 -2
  123. package/dist/tileset/helpers/zoom.d.ts.map +1 -1
  124. package/dist/tileset/helpers/zoom.js +83 -30
  125. package/dist/tileset/tile-3d.d.ts +45 -14
  126. package/dist/tileset/tile-3d.d.ts.map +1 -1
  127. package/dist/tileset/tile-3d.js +593 -534
  128. package/dist/tileset/tileset-3d.d.ts +54 -9
  129. package/dist/tileset/tileset-3d.d.ts.map +1 -1
  130. package/dist/tileset/tileset-3d.js +707 -648
  131. package/dist/tileset/tileset-cache.d.ts +1 -1
  132. package/dist/tileset/tileset-cache.d.ts.map +1 -1
  133. package/dist/tileset/tileset-cache.js +70 -71
  134. package/dist/tileset/{traversers/tileset-traverser.d.ts → tileset-traverser.d.ts} +11 -17
  135. package/dist/tileset/tileset-traverser.d.ts.map +1 -0
  136. package/dist/tileset/tileset-traverser.js +309 -0
  137. package/dist/types.d.ts +34 -0
  138. package/dist/types.d.ts.map +1 -0
  139. package/dist/types.js +2 -0
  140. package/dist/utils/doubly-linked-list-node.d.ts +1 -2
  141. package/dist/utils/doubly-linked-list-node.d.ts.map +1 -1
  142. package/dist/utils/doubly-linked-list-node.js +17 -15
  143. package/dist/utils/doubly-linked-list.d.ts +2 -3
  144. package/dist/utils/doubly-linked-list.d.ts.map +1 -1
  145. package/dist/utils/doubly-linked-list.js +91 -75
  146. package/dist/utils/managed-array.d.ts +1 -1
  147. package/dist/utils/managed-array.d.ts.map +1 -1
  148. package/dist/utils/managed-array.js +144 -109
  149. package/package.json +8 -8
  150. package/src/constants.ts +2 -0
  151. package/src/index.ts +6 -4
  152. package/src/tileset/{traversers → format-3d-tiles}/tileset-3d-traverser.ts +4 -2
  153. package/src/tileset/format-i3s/i3s-pending-tiles-register.ts +44 -0
  154. package/src/tileset/format-i3s/i3s-tile-manager.ts +101 -0
  155. package/src/tileset/{traversers → format-i3s}/i3s-tileset-traverser.ts +25 -12
  156. package/src/tileset/helpers/bounding-volume.ts +136 -0
  157. package/src/tileset/helpers/frame-state.ts +102 -18
  158. package/src/tileset/helpers/i3s-lod.ts +24 -21
  159. package/src/tileset/helpers/tiles-3d-lod.ts +2 -0
  160. package/src/tileset/helpers/transform-utils.ts +2 -0
  161. package/src/tileset/helpers/zoom.ts +84 -9
  162. package/src/tileset/tile-3d.ts +73 -18
  163. package/src/tileset/tileset-3d.ts +205 -43
  164. package/src/tileset/tileset-cache.ts +4 -2
  165. package/src/tileset/{traversers/tileset-traverser.ts → tileset-traverser.ts} +29 -17
  166. package/src/types.ts +36 -0
  167. package/src/utils/doubly-linked-list-node.ts +3 -2
  168. package/src/utils/doubly-linked-list.ts +2 -3
  169. package/src/utils/managed-array.ts +1 -1
  170. package/dist/bundle.js.map +0 -1
  171. package/dist/constants.js.map +0 -1
  172. package/dist/index.js.map +0 -1
  173. package/dist/tileset/helpers/3d-tiles-options.js.map +0 -1
  174. package/dist/tileset/helpers/bounding-volume.js.map +0 -1
  175. package/dist/tileset/helpers/frame-state.js.map +0 -1
  176. package/dist/tileset/helpers/i3s-lod.js.map +0 -1
  177. package/dist/tileset/helpers/transform-utils.js.map +0 -1
  178. package/dist/tileset/helpers/zoom.js.map +0 -1
  179. package/dist/tileset/tile-3d.js.map +0 -1
  180. package/dist/tileset/tileset-3d.js.map +0 -1
  181. package/dist/tileset/tileset-cache.js.map +0 -1
  182. package/dist/tileset/traversers/i3s-tile-manager.d.ts +0 -8
  183. package/dist/tileset/traversers/i3s-tile-manager.d.ts.map +0 -1
  184. package/dist/tileset/traversers/i3s-tile-manager.js +0 -45
  185. package/dist/tileset/traversers/i3s-tile-manager.js.map +0 -1
  186. package/dist/tileset/traversers/i3s-tileset-traverser.d.ts +0 -18
  187. package/dist/tileset/traversers/i3s-tileset-traverser.d.ts.map +0 -1
  188. package/dist/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
  189. package/dist/tileset/traversers/tileset-3d-traverser.d.ts.map +0 -1
  190. package/dist/tileset/traversers/tileset-3d-traverser.js.map +0 -1
  191. package/dist/tileset/traversers/tileset-traverser.d.ts.map +0 -1
  192. package/dist/tileset/traversers/tileset-traverser.js.map +0 -1
  193. package/dist/utils/doubly-linked-list-node.js.map +0 -1
  194. package/dist/utils/doubly-linked-list.js.map +0 -1
  195. package/dist/utils/managed-array.js.map +0 -1
  196. package/src/tileset/traversers/i3s-tile-manager.ts +0 -39
package/dist/dist.min.js CHANGED
@@ -25,11 +25,8 @@
25
25
  });
26
26
 
27
27
  // ../../node_modules/@math.gl/core/dist/esm/lib/common.js
28
- function round(value) {
29
- return Math.round(value / config.EPSILON) * config.EPSILON;
30
- }
31
28
  function formatValue(value, {
32
- precision = config.precision || 4
29
+ precision = config.precision
33
30
  } = {}) {
34
31
  value = round(value);
35
32
  return "".concat(parseFloat(value.toPrecision(precision)));
@@ -37,19 +34,6 @@
37
34
  function isArray(value) {
38
35
  return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
39
36
  }
40
- function duplicateArray(array) {
41
- return array.clone ? array.clone() : new Array(array.length);
42
- }
43
- function map(value, func, result) {
44
- if (isArray(value)) {
45
- result = result || duplicateArray(value);
46
- for (let i = 0; i < result.length && i < value.length; ++i) {
47
- result[i] = func(value[i], i, result);
48
- }
49
- return result;
50
- }
51
- return func(value);
52
- }
53
37
  function toRadians(degrees2) {
54
38
  return radians(degrees2);
55
39
  }
@@ -88,7 +72,7 @@
88
72
  if (b && b.equals) {
89
73
  return b.equals(a);
90
74
  }
91
- if (Number.isFinite(a) && Number.isFinite(b)) {
75
+ if (typeof a === "number" && typeof b === "number") {
92
76
  return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b));
93
77
  }
94
78
  return false;
@@ -96,18 +80,36 @@
96
80
  config.EPSILON = oldEpsilon;
97
81
  }
98
82
  }
83
+ function round(value) {
84
+ return Math.round(value / config.EPSILON) * config.EPSILON;
85
+ }
86
+ function duplicateArray(array) {
87
+ return array.clone ? array.clone() : new Array(array.length);
88
+ }
89
+ function map(value, func, result) {
90
+ if (isArray(value)) {
91
+ const array = value;
92
+ result = result || duplicateArray(array);
93
+ for (let i = 0; i < result.length && i < array.length; ++i) {
94
+ result[i] = func(value[i], i, result);
95
+ }
96
+ return result;
97
+ }
98
+ return func(value);
99
+ }
99
100
  var RADIANS_TO_DEGREES, DEGREES_TO_RADIANS, config;
100
101
  var init_common = __esm({
101
102
  "../../node_modules/@math.gl/core/dist/esm/lib/common.js"() {
102
103
  RADIANS_TO_DEGREES = 1 / Math.PI * 180;
103
104
  DEGREES_TO_RADIANS = 1 / 180 * Math.PI;
104
- config = {};
105
- config.EPSILON = 1e-12;
106
- config.debug = false;
107
- config.precision = 4;
108
- config.printTypes = false;
109
- config.printDegrees = false;
110
- config.printRowMajor = true;
105
+ config = {
106
+ EPSILON: 1e-12,
107
+ debug: false,
108
+ precision: 4,
109
+ printTypes: false,
110
+ printDegrees: false,
111
+ printRowMajor: true
112
+ };
111
113
  }
112
114
  });
113
115
 
@@ -137,24 +139,25 @@
137
139
  var init_math_array = __esm({
138
140
  "../../node_modules/@math.gl/core/dist/esm/classes/base/math-array.js"() {
139
141
  init_common();
140
- init_assert();
141
142
  MathArray = class extends _extendableBuiltin(Array) {
142
- get ELEMENTS() {
143
- assert(false);
144
- return 0;
145
- }
146
143
  clone() {
147
144
  return new this.constructor().copy(this);
148
145
  }
149
- from(arrayOrObject) {
150
- return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
151
- }
152
146
  fromArray(array, offset = 0) {
153
147
  for (let i = 0; i < this.ELEMENTS; ++i) {
154
148
  this[i] = array[i + offset];
155
149
  }
156
150
  return this.check();
157
151
  }
152
+ toArray(targetArray = [], offset = 0) {
153
+ for (let i = 0; i < this.ELEMENTS; ++i) {
154
+ targetArray[offset + i] = this[i];
155
+ }
156
+ return targetArray;
157
+ }
158
+ from(arrayOrObject) {
159
+ return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : this.fromObject(arrayOrObject);
160
+ }
158
161
  to(arrayOrObject) {
159
162
  if (arrayOrObject === this) {
160
163
  return this;
@@ -164,12 +167,6 @@
164
167
  toTarget(target) {
165
168
  return target ? this.to(target) : this;
166
169
  }
167
- toArray(array = [], offset = 0) {
168
- for (let i = 0; i < this.ELEMENTS; ++i) {
169
- array[offset + i] = this[i];
170
- }
171
- return array;
172
- }
173
170
  toFloat32Array() {
174
171
  return new Float32Array(this);
175
172
  }
@@ -213,9 +210,7 @@
213
210
  }
214
211
  lerp(a, b, t) {
215
212
  if (t === void 0) {
216
- t = b;
217
- b = a;
218
- a = this;
213
+ return this.lerp(this, a, b);
219
214
  }
220
215
  for (let i = 0; i < this.ELEMENTS; ++i) {
221
216
  const ai = a[i];
@@ -258,14 +253,36 @@
258
253
  return this.check();
259
254
  }
260
255
  scale(scale5) {
261
- if (Array.isArray(scale5)) {
262
- return this.multiply(scale5);
256
+ if (typeof scale5 === "number") {
257
+ for (let i = 0; i < this.ELEMENTS; ++i) {
258
+ this[i] *= scale5;
259
+ }
260
+ } else {
261
+ for (let i = 0; i < this.ELEMENTS && i < scale5.length; ++i) {
262
+ this[i] *= scale5[i];
263
+ }
263
264
  }
265
+ return this.check();
266
+ }
267
+ multiplyByScalar(scalar) {
264
268
  for (let i = 0; i < this.ELEMENTS; ++i) {
265
- this[i] *= scale5;
269
+ this[i] *= scalar;
266
270
  }
267
271
  return this.check();
268
272
  }
273
+ check() {
274
+ if (config.debug && !this.validate()) {
275
+ throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
276
+ }
277
+ return this;
278
+ }
279
+ validate() {
280
+ let valid = this.length === this.ELEMENTS;
281
+ for (let i = 0; i < this.ELEMENTS; ++i) {
282
+ valid = valid && Number.isFinite(this[i]);
283
+ }
284
+ return valid;
285
+ }
269
286
  sub(a) {
270
287
  return this.subtract(a);
271
288
  }
@@ -291,7 +308,7 @@
291
308
  return this.check();
292
309
  }
293
310
  divideScalar(a) {
294
- return this.scale(1 / a);
311
+ return this.multiplyByScalar(1 / a);
295
312
  }
296
313
  clampScalar(min, max) {
297
314
  for (let i = 0; i < this.ELEMENTS; ++i) {
@@ -299,25 +316,9 @@
299
316
  }
300
317
  return this.check();
301
318
  }
302
- multiplyByScalar(scalar) {
303
- return this.scale(scalar);
304
- }
305
319
  get elements() {
306
320
  return this;
307
321
  }
308
- check() {
309
- if (config.debug && !this.validate()) {
310
- throw new Error("math.gl: ".concat(this.constructor.name, " some fields set to invalid numbers'"));
311
- }
312
- return this;
313
- }
314
- validate() {
315
- let valid = this.length === this.ELEMENTS;
316
- for (let i = 0; i < this.ELEMENTS; ++i) {
317
- valid = valid && Number.isFinite(this[i]);
318
- }
319
- return valid;
320
- }
321
322
  };
322
323
  }
323
324
  });
@@ -346,17 +347,9 @@
346
347
  }
347
348
  return v;
348
349
  }
349
- function deprecated(method, version) {
350
- if (!map2[method]) {
351
- map2[method] = true;
352
- console.warn("".concat(method, " has been removed in version ").concat(version, ", see upgrade guide for more information"));
353
- }
354
- }
355
- var map2;
356
350
  var init_validators = __esm({
357
351
  "../../node_modules/@math.gl/core/dist/esm/lib/validators.js"() {
358
352
  init_common();
359
- map2 = {};
360
353
  }
361
354
  });
362
355
 
@@ -368,14 +361,6 @@
368
361
  init_validators();
369
362
  init_assert();
370
363
  Vector = class extends MathArray {
371
- get ELEMENTS() {
372
- assert(false);
373
- return 0;
374
- }
375
- copy(vector) {
376
- assert(false);
377
- return this;
378
- }
379
364
  get x() {
380
365
  return this[0];
381
366
  }
@@ -580,6 +565,15 @@
580
565
  out[2] = a[2];
581
566
  return out;
582
567
  }
568
+ function vec4_transformMat2(out, a, m) {
569
+ const x = a[0];
570
+ const y = a[1];
571
+ out[0] = m[0] * x + m[2] * y;
572
+ out[1] = m[1] * x + m[3] * y;
573
+ out[2] = a[2];
574
+ out[3] = a[3];
575
+ return out;
576
+ }
583
577
  function vec4_transformMat3(out, a, m) {
584
578
  const x = a[0];
585
579
  const y = a[1];
@@ -754,7 +748,7 @@
754
748
  });
755
749
 
756
750
  // ../../node_modules/@math.gl/core/dist/esm/classes/vector3.js
757
- var ORIGIN, constants, Vector3;
751
+ var ORIGIN, ZERO, Vector3;
758
752
  var init_vector3 = __esm({
759
753
  "../../node_modules/@math.gl/core/dist/esm/classes/vector3.js"() {
760
754
  init_vector();
@@ -763,10 +757,13 @@
763
757
  init_vec3();
764
758
  init_gl_matrix_extras();
765
759
  ORIGIN = [0, 0, 0];
766
- constants = {};
767
760
  Vector3 = class extends Vector {
768
761
  static get ZERO() {
769
- return constants.ZERO = constants.ZERO || Object.freeze(new Vector3(0, 0, 0, 0));
762
+ if (!ZERO) {
763
+ ZERO = new Vector3(0, 0, 0);
764
+ Object.freeze(ZERO);
765
+ }
766
+ return ZERO;
770
767
  }
771
768
  constructor(x = 0, y = 0, z = 0) {
772
769
  super(-0, -0, -0);
@@ -876,6 +873,113 @@
876
873
  }
877
874
  });
878
875
 
876
+ // ../../node_modules/@math.gl/core/dist/esm/classes/vector4.js
877
+ var ZERO2, Vector4;
878
+ var init_vector4 = __esm({
879
+ "../../node_modules/@math.gl/core/dist/esm/classes/vector4.js"() {
880
+ init_vector();
881
+ init_common();
882
+ init_validators();
883
+ init_vec3();
884
+ init_gl_matrix_extras();
885
+ Vector4 = class extends Vector {
886
+ static get ZERO() {
887
+ if (!ZERO2) {
888
+ ZERO2 = new Vector4(0, 0, 0, 0);
889
+ Object.freeze(ZERO2);
890
+ }
891
+ return ZERO2;
892
+ }
893
+ constructor(x = 0, y = 0, z = 0, w = 0) {
894
+ super(-0, -0, -0, -0);
895
+ if (isArray(x) && arguments.length === 1) {
896
+ this.copy(x);
897
+ } else {
898
+ if (config.debug) {
899
+ checkNumber(x);
900
+ checkNumber(y);
901
+ checkNumber(z);
902
+ checkNumber(w);
903
+ }
904
+ this[0] = x;
905
+ this[1] = y;
906
+ this[2] = z;
907
+ this[3] = w;
908
+ }
909
+ }
910
+ set(x, y, z, w) {
911
+ this[0] = x;
912
+ this[1] = y;
913
+ this[2] = z;
914
+ this[3] = w;
915
+ return this.check();
916
+ }
917
+ copy(array) {
918
+ this[0] = array[0];
919
+ this[1] = array[1];
920
+ this[2] = array[2];
921
+ this[3] = array[3];
922
+ return this.check();
923
+ }
924
+ fromObject(object) {
925
+ if (config.debug) {
926
+ checkNumber(object.x);
927
+ checkNumber(object.y);
928
+ checkNumber(object.z);
929
+ checkNumber(object.w);
930
+ }
931
+ this[0] = object.x;
932
+ this[1] = object.y;
933
+ this[2] = object.z;
934
+ this[3] = object.w;
935
+ return this;
936
+ }
937
+ toObject(object) {
938
+ object.x = this[0];
939
+ object.y = this[1];
940
+ object.z = this[2];
941
+ object.w = this[3];
942
+ return object;
943
+ }
944
+ get ELEMENTS() {
945
+ return 4;
946
+ }
947
+ get z() {
948
+ return this[2];
949
+ }
950
+ set z(value) {
951
+ this[2] = checkNumber(value);
952
+ }
953
+ get w() {
954
+ return this[3];
955
+ }
956
+ set w(value) {
957
+ this[3] = checkNumber(value);
958
+ }
959
+ transform(matrix4) {
960
+ transformMat42(this, this, matrix4);
961
+ return this.check();
962
+ }
963
+ transformByMatrix3(matrix3) {
964
+ vec4_transformMat3(this, this, matrix3);
965
+ return this.check();
966
+ }
967
+ transformByMatrix2(matrix2) {
968
+ vec4_transformMat2(this, this, matrix2);
969
+ return this.check();
970
+ }
971
+ transformByQuaternion(quaternion) {
972
+ transformQuat(this, this, quaternion);
973
+ return this.check();
974
+ }
975
+ applyMatrix4(m) {
976
+ m.transform(this, this);
977
+ return this;
978
+ }
979
+ };
980
+ }
981
+ });
982
+
879
983
  // ../../node_modules/@math.gl/core/dist/esm/classes/base/matrix.js
880
984
  var Matrix;
881
985
  var init_matrix = __esm({
@@ -883,16 +987,7 @@
883
987
  init_math_array();
884
988
  init_validators();
885
989
  init_common();
886
- init_assert();
887
990
  Matrix = class extends MathArray {
888
- get ELEMENTS() {
889
- assert(false);
890
- return 0;
891
- }
892
- get RANK() {
893
- assert(false);
894
- return 0;
895
- }
896
991
  toString() {
897
992
  let string = "[";
898
993
  if (config.printRowMajor) {
@@ -1095,7 +1190,21 @@
1095
1190
  });
1096
1191
 
1097
1192
  // ../../node_modules/@math.gl/core/dist/esm/classes/matrix3.js
1098
- var IDENTITY, ZERO, INDICES, constants2, Matrix3;
1193
+ function getZeroMatrix() {
1194
+ if (!ZERO_MATRIX3) {
1195
+ ZERO_MATRIX3 = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
1196
+ Object.freeze(ZERO_MATRIX3);
1197
+ }
1198
+ return ZERO_MATRIX3;
1199
+ }
1200
+ function getIdentityMatrix() {
1201
+ if (!IDENTITY_MATRIX3) {
1202
+ IDENTITY_MATRIX3 = new Matrix3();
1203
+ Object.freeze(IDENTITY_MATRIX3);
1204
+ }
1205
+ return IDENTITY_MATRIX3;
1206
+ }
1207
+ var INDICES, IDENTITY_MATRIX, Matrix3, ZERO_MATRIX3, IDENTITY_MATRIX3;
1099
1208
  var init_matrix3 = __esm({
1100
1209
  "../../node_modules/@math.gl/core/dist/esm/classes/matrix3.js"() {
1101
1210
  init_matrix();
@@ -1104,28 +1213,24 @@
1104
1213
  init_mat3();
1105
1214
  init_vec2();
1106
1215
  init_vec3();
1107
- IDENTITY = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
1108
- ZERO = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0]);
1109
- INDICES = Object.freeze({
1110
- COL0ROW0: 0,
1111
- COL0ROW1: 1,
1112
- COL0ROW2: 2,
1113
- COL1ROW0: 3,
1114
- COL1ROW1: 4,
1115
- COL1ROW2: 5,
1116
- COL2ROW0: 6,
1117
- COL2ROW1: 7,
1118
- COL2ROW2: 8
1119
- });
1120
- constants2 = {};
1216
+ (function(INDICES3) {
1217
+ INDICES3[INDICES3["COL0ROW0"] = 0] = "COL0ROW0";
1218
+ INDICES3[INDICES3["COL0ROW1"] = 1] = "COL0ROW1";
1219
+ INDICES3[INDICES3["COL0ROW2"] = 2] = "COL0ROW2";
1220
+ INDICES3[INDICES3["COL1ROW0"] = 3] = "COL1ROW0";
1221
+ INDICES3[INDICES3["COL1ROW1"] = 4] = "COL1ROW1";
1222
+ INDICES3[INDICES3["COL1ROW2"] = 5] = "COL1ROW2";
1223
+ INDICES3[INDICES3["COL2ROW0"] = 6] = "COL2ROW0";
1224
+ INDICES3[INDICES3["COL2ROW1"] = 7] = "COL2ROW1";
1225
+ INDICES3[INDICES3["COL2ROW2"] = 8] = "COL2ROW2";
1226
+ })(INDICES || (INDICES = {}));
1227
+ IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
1121
1228
  Matrix3 = class extends Matrix {
1122
1229
  static get IDENTITY() {
1123
- constants2.IDENTITY = constants2.IDENTITY || Object.freeze(new Matrix3(IDENTITY));
1124
- return constants2.IDENTITY;
1230
+ return getIdentityMatrix();
1125
1231
  }
1126
1232
  static get ZERO() {
1127
- constants2.ZERO = constants2.ZERO || Object.freeze(new Matrix3(ZERO));
1128
- return constants2.ZERO;
1233
+ return getZeroMatrix();
1129
1234
  }
1130
1235
  get ELEMENTS() {
1131
1236
  return 9;
@@ -1136,10 +1241,12 @@
1136
1241
  get INDICES() {
1137
1242
  return INDICES;
1138
1243
  }
1139
- constructor(array) {
1244
+ constructor(array, ...args) {
1140
1245
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0);
1141
1246
  if (arguments.length === 1 && Array.isArray(array)) {
1142
1247
  this.copy(array);
1248
+ } else if (args.length > 0) {
1249
+ this.copy([array, ...args]);
1143
1250
  } else {
1144
1251
  this.identity();
1145
1252
  }
@@ -1156,6 +1263,16 @@
1156
1263
  this[8] = array[8];
1157
1264
  return this.check();
1158
1265
  }
1266
+ identity() {
1267
+ return this.copy(IDENTITY_MATRIX);
1268
+ }
1269
+ fromObject(object) {
1270
+ return this.check();
1271
+ }
1272
+ fromQuaternion(q) {
1273
+ fromQuat(this, q);
1274
+ return this.check();
1275
+ }
1159
1276
  set(m00, m10, m20, m01, m11, m21, m02, m12, m22) {
1160
1277
  this[0] = m00;
1161
1278
  this[1] = m10;
@@ -1183,13 +1300,6 @@
1183
1300
  determinant() {
1184
1301
  return determinant(this);
1185
1302
  }
1186
- identity() {
1187
- return this.copy(IDENTITY);
1188
- }
1189
- fromQuaternion(q) {
1190
- fromQuat(this, q);
1191
- return this.check();
1192
- }
1193
1303
  transpose() {
1194
1304
  transpose(this, this);
1195
1305
  return this.check();
@@ -1214,7 +1324,7 @@
1214
1324
  if (Array.isArray(factor)) {
1215
1325
  scale(this, this, factor);
1216
1326
  } else {
1217
- scale(this, this, [factor, factor, factor]);
1327
+ scale(this, this, [factor, factor]);
1218
1328
  }
1219
1329
  return this.check();
1220
1330
  }
@@ -1223,32 +1333,30 @@
1223
1333
  return this.check();
1224
1334
  }
1225
1335
  transform(vector, result) {
1336
+ let out;
1226
1337
  switch (vector.length) {
1227
1338
  case 2:
1228
- result = transformMat3(result || [-0, -0], vector, this);
1339
+ out = transformMat3(result || [-0, -0], vector, this);
1229
1340
  break;
1230
1341
  case 3:
1231
- result = transformMat32(result || [-0, -0, -0], vector, this);
1342
+ out = transformMat32(result || [-0, -0, -0], vector, this);
1232
1343
  break;
1233
1344
  case 4:
1234
- result = vec4_transformMat3(result || [-0, -0, -0, -0], vector, this);
1345
+ out = vec4_transformMat3(result || [-0, -0, -0, -0], vector, this);
1235
1346
  break;
1236
1347
  default:
1237
1348
  throw new Error("Illegal vector");
1238
1349
  }
1239
- checkVector(result, vector.length);
1240
- return result;
1350
+ checkVector(out, vector.length);
1351
+ return out;
1241
1352
  }
1242
1353
  transformVector(vector, result) {
1243
- deprecated("Matrix3.transformVector");
1244
1354
  return this.transform(vector, result);
1245
1355
  }
1246
1356
  transformVector2(vector, result) {
1247
- deprecated("Matrix3.transformVector");
1248
1357
  return this.transform(vector, result);
1249
1358
  }
1250
1359
  transformVector3(vector, result) {
1251
- deprecated("Matrix3.transformVector");
1252
1360
  return this.transform(vector, result);
1253
1361
  }
1254
1362
  };
@@ -1692,7 +1800,7 @@
1692
1800
  out[15] = 0;
1693
1801
  return out;
1694
1802
  }
1695
- function perspective(out, fovy, aspect, near, far) {
1803
+ function perspectiveNO(out, fovy, aspect, near, far) {
1696
1804
  var f = 1 / Math.tan(fovy / 2), nf;
1697
1805
  out[0] = f / aspect;
1698
1806
  out[1] = 0;
@@ -1718,7 +1826,7 @@
1718
1826
  }
1719
1827
  return out;
1720
1828
  }
1721
- function ortho(out, left, right, bottom, top, near, far) {
1829
+ function orthoNO(out, left, right, bottom, top, near, far) {
1722
1830
  var lr = 1 / (left - right);
1723
1831
  var bt = 1 / (bottom - top);
1724
1832
  var nf = 1 / (near - far);
@@ -1807,9 +1915,12 @@
1807
1915
  out[15] = 1;
1808
1916
  return out;
1809
1917
  }
1918
+ var perspective, ortho;
1810
1919
  var init_mat4 = __esm({
1811
1920
  "../../node_modules/gl-matrix/esm/mat4.js"() {
1812
1921
  init_common2();
1922
+ perspective = perspectiveNO;
1923
+ ortho = orthoNO;
1813
1924
  }
1814
1925
  });
1815
1926
 
@@ -1939,48 +2050,90 @@
1939
2050
  });
1940
2051
 
1941
2052
  // ../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js
1942
- var IDENTITY2, ZERO2, INDICES2, constants3, Matrix4;
2053
+ function getZeroMatrix2() {
2054
+ if (!ZERO3) {
2055
+ ZERO3 = new Matrix4([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
2056
+ Object.freeze(ZERO3);
2057
+ }
2058
+ return ZERO3;
2059
+ }
2060
+ function getIdentityMatrix2() {
2061
+ if (!IDENTITY) {
2062
+ IDENTITY = new Matrix4();
2063
+ Object.freeze(IDENTITY);
2064
+ }
2065
+ return IDENTITY;
2066
+ }
2067
+ function checkRadians(possiblyDegrees) {
2068
+ if (possiblyDegrees > Math.PI * 2) {
2069
+ throw Error("expected radians");
2070
+ }
2071
+ }
2072
+ function computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
2073
+ const column0Row0 = 2 * near / (right - left);
2074
+ const column1Row1 = 2 * near / (top - bottom);
2075
+ const column2Row0 = (right + left) / (right - left);
2076
+ const column2Row1 = (top + bottom) / (top - bottom);
2077
+ const column2Row2 = -1;
2078
+ const column2Row3 = -1;
2079
+ const column3Row2 = -2 * near;
2080
+ result[0] = column0Row0;
2081
+ result[1] = 0;
2082
+ result[2] = 0;
2083
+ result[3] = 0;
2084
+ result[4] = 0;
2085
+ result[5] = column1Row1;
2086
+ result[6] = 0;
2087
+ result[7] = 0;
2088
+ result[8] = column2Row0;
2089
+ result[9] = column2Row1;
2090
+ result[10] = column2Row2;
2091
+ result[11] = column2Row3;
2092
+ result[12] = 0;
2093
+ result[13] = 0;
2094
+ result[14] = column3Row2;
2095
+ result[15] = 0;
2096
+ return result;
2097
+ }
2098
+ var INDICES2, DEFAULT_FOVY, DEFAULT_ASPECT, DEFAULT_NEAR, DEFAULT_FAR, IDENTITY_MATRIX2, Matrix4, ZERO3, IDENTITY;
1943
2099
  var init_matrix4 = __esm({
1944
2100
  "../../node_modules/@math.gl/core/dist/esm/classes/matrix4.js"() {
1945
- init_validators();
1946
2101
  init_matrix();
2102
+ init_validators();
1947
2103
  init_gl_matrix_extras();
1948
2104
  init_mat4();
1949
2105
  init_vec2();
1950
2106
  init_vec3();
1951
2107
  init_vec4();
1952
- IDENTITY2 = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
1953
- ZERO2 = Object.freeze([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
1954
- INDICES2 = Object.freeze({
1955
- COL0ROW0: 0,
1956
- COL0ROW1: 1,
1957
- COL0ROW2: 2,
1958
- COL0ROW3: 3,
1959
- COL1ROW0: 4,
1960
- COL1ROW1: 5,
1961
- COL1ROW2: 6,
1962
- COL1ROW3: 7,
1963
- COL2ROW0: 8,
1964
- COL2ROW1: 9,
1965
- COL2ROW2: 10,
1966
- COL2ROW3: 11,
1967
- COL3ROW0: 12,
1968
- COL3ROW1: 13,
1969
- COL3ROW2: 14,
1970
- COL3ROW3: 15
1971
- });
1972
- constants3 = {};
2108
+ (function(INDICES3) {
2109
+ INDICES3[INDICES3["COL0ROW0"] = 0] = "COL0ROW0";
2110
+ INDICES3[INDICES3["COL0ROW1"] = 1] = "COL0ROW1";
2111
+ INDICES3[INDICES3["COL0ROW2"] = 2] = "COL0ROW2";
2112
+ INDICES3[INDICES3["COL0ROW3"] = 3] = "COL0ROW3";
2113
+ INDICES3[INDICES3["COL1ROW0"] = 4] = "COL1ROW0";
2114
+ INDICES3[INDICES3["COL1ROW1"] = 5] = "COL1ROW1";
2115
+ INDICES3[INDICES3["COL1ROW2"] = 6] = "COL1ROW2";
2116
+ INDICES3[INDICES3["COL1ROW3"] = 7] = "COL1ROW3";
2117
+ INDICES3[INDICES3["COL2ROW0"] = 8] = "COL2ROW0";
2118
+ INDICES3[INDICES3["COL2ROW1"] = 9] = "COL2ROW1";
2119
+ INDICES3[INDICES3["COL2ROW2"] = 10] = "COL2ROW2";
2120
+ INDICES3[INDICES3["COL2ROW3"] = 11] = "COL2ROW3";
2121
+ INDICES3[INDICES3["COL3ROW0"] = 12] = "COL3ROW0";
2122
+ INDICES3[INDICES3["COL3ROW1"] = 13] = "COL3ROW1";
2123
+ INDICES3[INDICES3["COL3ROW2"] = 14] = "COL3ROW2";
2124
+ INDICES3[INDICES3["COL3ROW3"] = 15] = "COL3ROW3";
2125
+ })(INDICES2 || (INDICES2 = {}));
2126
+ DEFAULT_FOVY = 45 * Math.PI / 180;
2127
+ DEFAULT_ASPECT = 1;
2128
+ DEFAULT_NEAR = 0.1;
2129
+ DEFAULT_FAR = 500;
2130
+ IDENTITY_MATRIX2 = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
1973
2131
  Matrix4 = class extends Matrix {
1974
2132
  static get IDENTITY() {
1975
- constants3.IDENTITY = constants3.IDENTITY || Object.freeze(new Matrix4(IDENTITY2));
1976
- return constants3.IDENTITY;
2133
+ return getIdentityMatrix2();
1977
2134
  }
1978
2135
  static get ZERO() {
1979
- constants3.ZERO = constants3.ZERO || Object.freeze(new Matrix4(ZERO2));
1980
- return constants3.ZERO;
1981
- }
1982
- get INDICES() {
1983
- return INDICES2;
2136
+ return getZeroMatrix2();
1984
2137
  }
1985
2138
  get ELEMENTS() {
1986
2139
  return 16;
@@ -1988,6 +2141,9 @@
1988
2141
  get RANK() {
1989
2142
  return 4;
1990
2143
  }
2144
+ get INDICES() {
2145
+ return INDICES2;
2146
+ }
1991
2147
  constructor(array) {
1992
2148
  super(-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
1993
2149
  if (arguments.length === 1 && Array.isArray(array)) {
@@ -2073,91 +2229,65 @@
2073
2229
  return result;
2074
2230
  }
2075
2231
  identity() {
2076
- return this.copy(IDENTITY2);
2232
+ return this.copy(IDENTITY_MATRIX2);
2077
2233
  }
2078
- fromQuaternion(q) {
2079
- fromQuat2(this, q);
2234
+ fromObject(object) {
2080
2235
  return this.check();
2081
2236
  }
2082
- frustum({
2083
- left,
2084
- right,
2085
- bottom,
2086
- top,
2087
- near,
2088
- far
2089
- }) {
2237
+ fromQuaternion(quaternion) {
2238
+ fromQuat2(this, quaternion);
2239
+ return this.check();
2240
+ }
2241
+ frustum(view) {
2242
+ const {
2243
+ left,
2244
+ right,
2245
+ bottom,
2246
+ top,
2247
+ near = DEFAULT_NEAR,
2248
+ far = DEFAULT_FAR
2249
+ } = view;
2090
2250
  if (far === Infinity) {
2091
- Matrix4._computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
2251
+ computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
2092
2252
  } else {
2093
2253
  frustum(this, left, right, bottom, top, near, far);
2094
2254
  }
2095
2255
  return this.check();
2096
2256
  }
2097
- static _computeInfinitePerspectiveOffCenter(result, left, right, bottom, top, near) {
2098
- const column0Row0 = 2 * near / (right - left);
2099
- const column1Row1 = 2 * near / (top - bottom);
2100
- const column2Row0 = (right + left) / (right - left);
2101
- const column2Row1 = (top + bottom) / (top - bottom);
2102
- const column2Row2 = -1;
2103
- const column2Row3 = -1;
2104
- const column3Row2 = -2 * near;
2105
- result[0] = column0Row0;
2106
- result[1] = 0;
2107
- result[2] = 0;
2108
- result[3] = 0;
2109
- result[4] = 0;
2110
- result[5] = column1Row1;
2111
- result[6] = 0;
2112
- result[7] = 0;
2113
- result[8] = column2Row0;
2114
- result[9] = column2Row1;
2115
- result[10] = column2Row2;
2116
- result[11] = column2Row3;
2117
- result[12] = 0;
2118
- result[13] = 0;
2119
- result[14] = column3Row2;
2120
- result[15] = 0;
2121
- return result;
2122
- }
2123
- lookAt(eye, center, up) {
2124
- if (arguments.length === 1) {
2125
- ({
2126
- eye,
2127
- center,
2128
- up
2129
- } = eye);
2130
- }
2131
- center = center || [0, 0, 0];
2132
- up = up || [0, 1, 0];
2257
+ lookAt(view) {
2258
+ const {
2259
+ eye,
2260
+ center = [0, 0, 0],
2261
+ up = [0, 1, 0]
2262
+ } = view;
2133
2263
  lookAt(this, eye, center, up);
2134
2264
  return this.check();
2135
2265
  }
2136
- ortho({
2137
- left,
2138
- right,
2139
- bottom,
2140
- top,
2141
- near = 0.1,
2142
- far = 500
2143
- }) {
2266
+ ortho(view) {
2267
+ const {
2268
+ left,
2269
+ right,
2270
+ bottom,
2271
+ top,
2272
+ near = DEFAULT_NEAR,
2273
+ far = DEFAULT_FAR
2274
+ } = view;
2144
2275
  ortho(this, left, right, bottom, top, near, far);
2145
2276
  return this.check();
2146
2277
  }
2147
- orthographic({
2148
- fovy = 45 * Math.PI / 180,
2149
- aspect = 1,
2150
- focalDistance = 1,
2151
- near = 0.1,
2152
- far = 500
2153
- }) {
2154
- if (fovy > Math.PI * 2) {
2155
- throw Error("radians");
2156
- }
2278
+ orthographic(view) {
2279
+ const {
2280
+ fovy = DEFAULT_FOVY,
2281
+ aspect = DEFAULT_ASPECT,
2282
+ focalDistance = 1,
2283
+ near = DEFAULT_NEAR,
2284
+ far = DEFAULT_FAR
2285
+ } = view;
2286
+ checkRadians(fovy);
2157
2287
  const halfY = fovy / 2;
2158
2288
  const top = focalDistance * Math.tan(halfY);
2159
2289
  const right = top * aspect;
2160
- return new Matrix4().ortho({
2290
+ return this.ortho({
2161
2291
  left: -right,
2162
2292
  right,
2163
2293
  bottom: -top,
@@ -2166,17 +2296,14 @@
2166
2296
  far
2167
2297
  });
2168
2298
  }
2169
- perspective({
2170
- fovy = void 0,
2171
- fov = 45 * Math.PI / 180,
2172
- aspect = 1,
2173
- near = 0.1,
2174
- far = 500
2175
- } = {}) {
2176
- fovy = fovy || fov;
2177
- if (fovy > Math.PI * 2) {
2178
- throw Error("radians");
2179
- }
2299
+ perspective(view) {
2300
+ const {
2301
+ fovy = 45 * Math.PI / 180,
2302
+ aspect = 1,
2303
+ near = 0.1,
2304
+ far = 500
2305
+ } = view;
2306
+ checkRadians(fovy);
2180
2307
  perspective(this, fovy, aspect, near, far);
2181
2308
  return this.check();
2182
2309
  }
@@ -2195,8 +2322,10 @@
2195
2322
  result[2] = this[14];
2196
2323
  return result;
2197
2324
  }
2198
- getRotation(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
2199
- const scale5 = this.getScale(scaleResult || [-0, -0, -0]);
2325
+ getRotation(result, scaleResult) {
2326
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
2327
+ scaleResult = scaleResult || [-0, -0, -0];
2328
+ const scale5 = this.getScale(scaleResult);
2200
2329
  const inverseScale0 = 1 / scale5[0];
2201
2330
  const inverseScale1 = 1 / scale5[1];
2202
2331
  const inverseScale2 = 1 / scale5[2];
@@ -2218,8 +2347,10 @@
2218
2347
  result[15] = 1;
2219
2348
  return result;
2220
2349
  }
2221
- getRotationMatrix3(result = [-0, -0, -0, -0, -0, -0, -0, -0, -0], scaleResult = null) {
2222
- const scale5 = this.getScale(scaleResult || [-0, -0, -0]);
2350
+ getRotationMatrix3(result, scaleResult) {
2351
+ result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
2352
+ scaleResult = scaleResult || [-0, -0, -0];
2353
+ const scale5 = this.getScale(scaleResult);
2223
2354
  const inverseScale0 = 1 / scale5[0];
2224
2355
  const inverseScale1 = 1 / scale5[1];
2225
2356
  const inverseScale2 = 1 / scale5[2];
@@ -2262,23 +2393,19 @@
2262
2393
  rotateZ2(this, this, radians2);
2263
2394
  return this.check();
2264
2395
  }
2265
- rotateXYZ([rx, ry, rz]) {
2266
- return this.rotateX(rx).rotateY(ry).rotateZ(rz);
2396
+ rotateXYZ(angleXYZ) {
2397
+ return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
2267
2398
  }
2268
2399
  rotateAxis(radians2, axis) {
2269
2400
  rotate2(this, this, radians2, axis);
2270
2401
  return this.check();
2271
2402
  }
2272
2403
  scale(factor) {
2273
- if (Array.isArray(factor)) {
2274
- scale2(this, this, factor);
2275
- } else {
2276
- scale2(this, this, [factor, factor, factor]);
2277
- }
2404
+ scale2(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
2278
2405
  return this.check();
2279
2406
  }
2280
- translate(vec) {
2281
- translate2(this, this, vec);
2407
+ translate(vector) {
2408
+ translate2(this, this, vector);
2282
2409
  return this.check();
2283
2410
  }
2284
2411
  transform(vector, result) {
@@ -2293,51 +2420,50 @@
2293
2420
  const {
2294
2421
  length: length4
2295
2422
  } = vector;
2423
+ let out;
2296
2424
  switch (length4) {
2297
2425
  case 2:
2298
- result = transformMat4(result || [-0, -0], vector, this);
2426
+ out = transformMat4(result || [-0, -0], vector, this);
2299
2427
  break;
2300
2428
  case 3:
2301
- result = transformMat42(result || [-0, -0, -0], vector, this);
2429
+ out = transformMat42(result || [-0, -0, -0], vector, this);
2302
2430
  break;
2303
2431
  default:
2304
2432
  throw new Error("Illegal vector");
2305
2433
  }
2306
- checkVector(result, vector.length);
2307
- return result;
2434
+ checkVector(out, vector.length);
2435
+ return out;
2308
2436
  }
2309
2437
  transformAsVector(vector, result) {
2438
+ let out;
2310
2439
  switch (vector.length) {
2311
2440
  case 2:
2312
- result = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
2441
+ out = vec2_transformMat4AsVector(result || [-0, -0], vector, this);
2313
2442
  break;
2314
2443
  case 3:
2315
- result = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
2444
+ out = vec3_transformMat4AsVector(result || [-0, -0, -0], vector, this);
2316
2445
  break;
2317
2446
  default:
2318
2447
  throw new Error("Illegal vector");
2319
- }
2320
- checkVector(result, vector.length);
2321
- return result;
2322
- }
2323
- makeRotationX(radians2) {
2324
- return this.identity().rotateX(radians2);
2325
- }
2326
- makeTranslation(x, y, z) {
2327
- return this.identity().translate([x, y, z]);
2448
+ }
2449
+ checkVector(out, vector.length);
2450
+ return out;
2328
2451
  }
2329
2452
  transformPoint(vector, result) {
2330
- deprecated("Matrix4.transformPoint", "3.0");
2331
2453
  return this.transformAsPoint(vector, result);
2332
2454
  }
2333
2455
  transformVector(vector, result) {
2334
- deprecated("Matrix4.transformVector", "3.0");
2335
2456
  return this.transformAsPoint(vector, result);
2336
2457
  }
2337
2458
  transformDirection(vector, result) {
2338
- deprecated("Matrix4.transformDirection", "3.0");
2339
2459
  return this.transformAsVector(vector, result);
2340
2460
  }
2461
+ makeRotationX(radians2) {
2462
+ return this.identity().rotateX(radians2);
2463
+ }
2464
+ makeTranslation(x, y, z) {
2465
+ return this.identity().translate([x, y, z]);
2466
+ }
2341
2467
  };
2342
2468
  }
2343
2469
  });
@@ -2564,7 +2690,7 @@
2564
2690
  "../../node_modules/@math.gl/core/dist/esm/classes/quaternion.js"() {
2565
2691
  init_math_array();
2566
2692
  init_validators();
2567
- init_assert();
2693
+ init_vector4();
2568
2694
  init_quat();
2569
2695
  init_vec4();
2570
2696
  IDENTITY_QUATERNION = [0, 0, 0, 1];
@@ -2591,18 +2717,25 @@
2591
2717
  this[3] = w;
2592
2718
  return this.check();
2593
2719
  }
2594
- fromMatrix3(m) {
2595
- fromMat3(this, m);
2720
+ fromObject(object) {
2721
+ this[0] = object.x;
2722
+ this[1] = object.y;
2723
+ this[2] = object.z;
2724
+ this[3] = object.w;
2596
2725
  return this.check();
2597
2726
  }
2598
- identity() {
2599
- identity2(this);
2727
+ fromMatrix3(m) {
2728
+ fromMat3(this, m);
2600
2729
  return this.check();
2601
2730
  }
2602
2731
  fromAxisRotation(axis, rad) {
2603
2732
  setAxisAngle(this, axis, rad);
2604
2733
  return this.check();
2605
2734
  }
2735
+ identity() {
2736
+ identity2(this);
2737
+ return this.check();
2738
+ }
2606
2739
  setAxisAngle(axis, rad) {
2607
2740
  return this.fromAxisRotation(axis, rad);
2608
2741
  }
@@ -2639,20 +2772,14 @@
2639
2772
  lengthSquared() {
2640
2773
  return squaredLength2(this);
2641
2774
  }
2642
- dot(a, b) {
2643
- if (b !== void 0) {
2644
- throw new Error("Quaternion.dot only takes one argument");
2645
- }
2775
+ dot(a) {
2646
2776
  return dot3(this, a);
2647
2777
  }
2648
2778
  rotationTo(vectorA, vectorB) {
2649
2779
  rotationTo(this, vectorA, vectorB);
2650
2780
  return this.check();
2651
2781
  }
2652
- add(a, b) {
2653
- if (b !== void 0) {
2654
- throw new Error("Quaternion.add only takes one argument");
2655
- }
2782
+ add(a) {
2656
2783
  add2(this, this, a);
2657
2784
  return this.check();
2658
2785
  }
@@ -2669,16 +2796,17 @@
2669
2796
  return this.check();
2670
2797
  }
2671
2798
  lerp(a, b, t) {
2799
+ if (t === void 0) {
2800
+ return this.lerp(this, a, b);
2801
+ }
2672
2802
  lerp2(this, a, b, t);
2673
2803
  return this.check();
2674
2804
  }
2675
- multiplyRight(a, b) {
2676
- assert(!b);
2805
+ multiplyRight(a) {
2677
2806
  multiply3(this, this, a);
2678
2807
  return this.check();
2679
2808
  }
2680
- multiplyLeft(a, b) {
2681
- assert(!b);
2809
+ multiplyLeft(a) {
2682
2810
  multiply3(this, a, this);
2683
2811
  return this.check();
2684
2812
  }
@@ -2710,25 +2838,32 @@
2710
2838
  scale4(this, this, b);
2711
2839
  return this.check();
2712
2840
  }
2713
- slerp(start, target, ratio) {
2841
+ slerp(arg0, arg1, arg2) {
2842
+ let start;
2843
+ let target;
2844
+ let ratio;
2714
2845
  switch (arguments.length) {
2715
2846
  case 1:
2716
2847
  ({
2717
2848
  start = IDENTITY_QUATERNION,
2718
2849
  target,
2719
2850
  ratio
2720
- } = arguments[0]);
2851
+ } = arg0);
2721
2852
  break;
2722
2853
  case 2:
2723
- [target, ratio] = arguments;
2724
2854
  start = this;
2855
+ target = arg0;
2856
+ ratio = arg1;
2725
2857
  break;
2726
2858
  default:
2859
+ start = arg0;
2860
+ target = arg1;
2861
+ ratio = arg2;
2727
2862
  }
2728
2863
  slerp(this, start, target, ratio);
2729
2864
  return this.check();
2730
2865
  }
2731
- transformVector4(vector, result = vector) {
2866
+ transformVector4(vector, result = new Vector4()) {
2732
2867
  transformQuat2(result, vector, this);
2733
2868
  return checkVector(result, 4);
2734
2869
  }
@@ -2738,16 +2873,82 @@
2738
2873
  setFromAxisAngle(axis, rad) {
2739
2874
  return this.setAxisAngle(axis, rad);
2740
2875
  }
2741
- premultiply(a, b) {
2742
- return this.multiplyLeft(a, b);
2876
+ premultiply(a) {
2877
+ return this.multiplyLeft(a);
2743
2878
  }
2744
- multiply(a, b) {
2745
- return this.multiplyRight(a, b);
2879
+ multiply(a) {
2880
+ return this.multiplyRight(a);
2746
2881
  }
2747
2882
  };
2748
2883
  }
2749
2884
  });
2750
2885
 
2886
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
2887
+ function _typeof(obj) {
2888
+ "@babel/helpers - typeof";
2889
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
2890
+ return typeof obj2;
2891
+ } : function(obj2) {
2892
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
2893
+ }, _typeof(obj);
2894
+ }
2895
+ var init_typeof = __esm({
2896
+ "../../node_modules/@babel/runtime/helpers/esm/typeof.js"() {
2897
+ }
2898
+ });
2899
+
2900
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
2901
+ function _toPrimitive(input, hint) {
2902
+ if (_typeof(input) !== "object" || input === null)
2903
+ return input;
2904
+ var prim = input[Symbol.toPrimitive];
2905
+ if (prim !== void 0) {
2906
+ var res = prim.call(input, hint || "default");
2907
+ if (_typeof(res) !== "object")
2908
+ return res;
2909
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2910
+ }
2911
+ return (hint === "string" ? String : Number)(input);
2912
+ }
2913
+ var init_toPrimitive = __esm({
2914
+ "../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js"() {
2915
+ init_typeof();
2916
+ }
2917
+ });
2918
+
2919
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
2920
+ function _toPropertyKey(arg) {
2921
+ var key = _toPrimitive(arg, "string");
2922
+ return _typeof(key) === "symbol" ? key : String(key);
2923
+ }
2924
+ var init_toPropertyKey = __esm({
2925
+ "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"() {
2926
+ init_typeof();
2927
+ init_toPrimitive();
2928
+ }
2929
+ });
2930
+
2931
+ // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
2932
+ function _defineProperty(obj, key, value) {
2933
+ key = _toPropertyKey(key);
2934
+ if (key in obj) {
2935
+ Object.defineProperty(obj, key, {
2936
+ value,
2937
+ enumerable: true,
2938
+ configurable: true,
2939
+ writable: true
2940
+ });
2941
+ } else {
2942
+ obj[key] = value;
2943
+ }
2944
+ return obj;
2945
+ }
2946
+ var init_defineProperty = __esm({
2947
+ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
2948
+ init_toPropertyKey();
2949
+ }
2950
+ });
2951
+
2751
2952
  // ../../node_modules/@math.gl/core/dist/esm/lib/math-utils.js
2752
2953
  var math_utils_default;
2753
2954
  var init_math_utils = __esm({
@@ -2782,26 +2983,15 @@
2782
2983
  });
2783
2984
 
2784
2985
  // ../../node_modules/@math.gl/core/dist/esm/index.js
2785
- var globals, global_;
2786
2986
  var init_esm = __esm({
2787
2987
  "../../node_modules/@math.gl/core/dist/esm/index.js"() {
2788
- init_common();
2789
2988
  init_vector3();
2790
2989
  init_matrix3();
2791
2990
  init_matrix4();
2792
2991
  init_quaternion();
2793
- init_common();
2794
2992
  init_math_utils();
2795
2993
  init_assert();
2796
- globals = {
2797
- self: typeof self !== "undefined" && self,
2798
- window: typeof window !== "undefined" && window,
2799
- global: typeof global !== "undefined" && global
2800
- };
2801
- global_ = globals.global || globals.self || globals.window;
2802
- global_.mathgl = {
2803
- config
2804
- };
2994
+ init_common();
2805
2995
  }
2806
2996
  });
2807
2997
 
@@ -2824,65 +3014,67 @@
2824
3014
  });
2825
3015
 
2826
3016
  // ../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js
2827
- function fromCartographic(cartographic, result, map3 = noop) {
2828
- if (isArray(cartographic)) {
2829
- result[0] = map3(cartographic[0]);
2830
- result[1] = map3(cartographic[1]);
2831
- result[2] = cartographic[2];
2832
- } else if ("longitude" in cartographic) {
2833
- result[0] = map3(cartographic.longitude);
2834
- result[1] = map3(cartographic.latitude);
3017
+ function identity3(x) {
3018
+ return x;
3019
+ }
3020
+ function fromCartographic(cartographic, result = [], map2 = identity3) {
3021
+ if ("longitude" in cartographic) {
3022
+ result[0] = map2(cartographic.longitude);
3023
+ result[1] = map2(cartographic.latitude);
2835
3024
  result[2] = cartographic.height;
2836
- } else {
2837
- result[0] = map3(cartographic.x);
2838
- result[1] = map3(cartographic.y);
3025
+ } else if ("x" in cartographic) {
3026
+ result[0] = map2(cartographic.x);
3027
+ result[1] = map2(cartographic.y);
2839
3028
  result[2] = cartographic.z;
3029
+ } else {
3030
+ result[0] = map2(cartographic[0]);
3031
+ result[1] = map2(cartographic[1]);
3032
+ result[2] = cartographic[2];
2840
3033
  }
2841
3034
  return result;
2842
3035
  }
2843
- function fromCartographicToRadians(cartographic, vector = scratchVector) {
2844
- return fromCartographic(cartographic, vector, config._cartographicRadians ? noop : toRadians);
3036
+ function fromCartographicToRadians(cartographic, vector = []) {
3037
+ return fromCartographic(cartographic, vector, config._cartographicRadians ? identity3 : toRadians);
2845
3038
  }
2846
- function toCartographic(vector, cartographic, map3 = noop) {
2847
- if (isArray(cartographic)) {
2848
- cartographic[0] = map3(vector[0]);
2849
- cartographic[1] = map3(vector[1]);
2850
- cartographic[2] = vector[2];
2851
- } else if ("longitude" in cartographic) {
2852
- cartographic.longitude = map3(vector[0]);
2853
- cartographic.latitude = map3(vector[1]);
3039
+ function toCartographic(vector, cartographic, map2 = identity3) {
3040
+ if ("longitude" in cartographic) {
3041
+ cartographic.longitude = map2(vector[0]);
3042
+ cartographic.latitude = map2(vector[1]);
2854
3043
  cartographic.height = vector[2];
2855
- } else {
2856
- cartographic.x = map3(vector[0]);
2857
- cartographic.y = map3(vector[1]);
3044
+ } else if ("x" in cartographic) {
3045
+ cartographic.x = map2(vector[0]);
3046
+ cartographic.y = map2(vector[1]);
2858
3047
  cartographic.z = vector[2];
3048
+ } else {
3049
+ cartographic[0] = map2(vector[0]);
3050
+ cartographic[1] = map2(vector[1]);
3051
+ cartographic[2] = vector[2];
2859
3052
  }
2860
3053
  return cartographic;
2861
3054
  }
2862
3055
  function toCartographicFromRadians(vector, cartographic) {
2863
- return toCartographic(vector, cartographic, config._cartographicRadians ? noop : toDegrees);
3056
+ return toCartographic(vector, cartographic, config._cartographicRadians ? identity3 : toDegrees);
2864
3057
  }
2865
- var noop, scratchVector;
3058
+ var scratchVector;
2866
3059
  var init_type_utils = __esm({
2867
3060
  "../../node_modules/@math.gl/geospatial/dist/esm/type-utils.js"() {
2868
3061
  init_esm();
2869
3062
  init_constants();
2870
- noop = (x) => x;
2871
3063
  scratchVector = new Vector3();
2872
3064
  }
2873
3065
  });
2874
3066
 
2875
3067
  // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/helpers/scale-to-geodetic-surface.js
2876
- function scaleToGeodeticSurface(cartesian, ellipsoid, result = new Vector3()) {
3068
+ function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
2877
3069
  const {
2878
3070
  oneOverRadii,
2879
3071
  oneOverRadiiSquared,
2880
3072
  centerToleranceSquared
2881
3073
  } = ellipsoid;
2882
3074
  scratchVector2.from(cartesian);
2883
- const positionX = cartesian.x;
2884
- const positionY = cartesian.y;
2885
- const positionZ = cartesian.z;
3075
+ const positionX = scratchVector2.x;
3076
+ const positionY = scratchVector2.y;
3077
+ const positionZ = scratchVector2.z;
2886
3078
  const oneOverRadiiX = oneOverRadii.x;
2887
3079
  const oneOverRadiiY = oneOverRadii.y;
2888
3080
  const oneOverRadiiZ = oneOverRadii.z;
@@ -2904,7 +3096,7 @@
2904
3096
  const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
2905
3097
  const gradient = scaleToGeodeticSurfaceGradient;
2906
3098
  gradient.set(intersection.x * oneOverRadiiSquaredX * 2, intersection.y * oneOverRadiiSquaredY * 2, intersection.z * oneOverRadiiSquaredZ * 2);
2907
- let lambda = (1 - ratio) * cartesian.len() / (0.5 * gradient.len());
3099
+ let lambda = (1 - ratio) * scratchVector2.len() / (0.5 * gradient.len());
2908
3100
  let correction = 0;
2909
3101
  let xMultiplier;
2910
3102
  let yMultiplier;
@@ -3067,9 +3259,10 @@
3067
3259
  });
3068
3260
 
3069
3261
  // ../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/ellipsoid.js
3070
- var scratchVector4, scratchNormal, scratchK, scratchPosition, scratchHeight, scratchCartesian, wgs84, Ellipsoid;
3262
+ var scratchVector4, scratchNormal, scratchK, scratchPosition, scratchHeight, scratchCartesian, Ellipsoid;
3071
3263
  var init_ellipsoid = __esm({
3072
3264
  "../../node_modules/@math.gl/geospatial/dist/esm/ellipsoid/ellipsoid.js"() {
3265
+ init_defineProperty();
3073
3266
  init_esm();
3074
3267
  init_vec3();
3075
3268
  init_constants();
@@ -3083,11 +3276,16 @@
3083
3276
  scratchHeight = new Vector3();
3084
3277
  scratchCartesian = new Vector3();
3085
3278
  Ellipsoid = class {
3086
- static get WGS84() {
3087
- wgs84 = wgs84 || new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
3088
- return wgs84;
3089
- }
3090
3279
  constructor(x = 0, y = 0, z = 0) {
3280
+ _defineProperty(this, "radii", void 0);
3281
+ _defineProperty(this, "radiiSquared", void 0);
3282
+ _defineProperty(this, "radiiToTheFourth", void 0);
3283
+ _defineProperty(this, "oneOverRadii", void 0);
3284
+ _defineProperty(this, "oneOverRadiiSquared", void 0);
3285
+ _defineProperty(this, "minimumRadius", void 0);
3286
+ _defineProperty(this, "maximumRadius", void 0);
3287
+ _defineProperty(this, "centerToleranceSquared", math_utils_default.EPSILON1);
3288
+ _defineProperty(this, "squaredXOverSquaredZ", void 0);
3091
3289
  assert(x >= 0);
3092
3290
  assert(y >= 0);
3093
3291
  assert(z >= 0);
@@ -3098,7 +3296,6 @@
3098
3296
  this.oneOverRadiiSquared = new Vector3(x === 0 ? 0 : 1 / (x * x), y === 0 ? 0 : 1 / (y * y), z === 0 ? 0 : 1 / (z * z));
3099
3297
  this.minimumRadius = Math.min(x, y, z);
3100
3298
  this.maximumRadius = Math.max(x, y, z);
3101
- this.centerToleranceSquared = math_utils_default.EPSILON1;
3102
3299
  if (this.radiiSquared.z !== 0) {
3103
3300
  this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;
3104
3301
  }
@@ -3185,6 +3382,7 @@
3185
3382
  return scratchPosition.set(0, 0, z).to(result);
3186
3383
  }
3187
3384
  };
3385
+ _defineProperty(Ellipsoid, "WGS84", new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z));
3188
3386
  }
3189
3387
  });
3190
3388
 
@@ -3196,26 +3394,7 @@
3196
3394
  }
3197
3395
  });
3198
3396
 
3199
- // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
3200
- function _defineProperty(obj, key, value) {
3201
- if (key in obj) {
3202
- Object.defineProperty(obj, key, {
3203
- value,
3204
- enumerable: true,
3205
- configurable: true,
3206
- writable: true
3207
- });
3208
- } else {
3209
- obj[key] = value;
3210
- }
3211
- return obj;
3212
- }
3213
- var init_defineProperty = __esm({
3214
- "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
3215
- }
3216
- });
3217
-
3218
- // ../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
3397
+ // ../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js
3219
3398
  function getHiResTimestamp() {
3220
3399
  let timestamp;
3221
3400
  if (typeof window !== "undefined" && window.performance) {
@@ -3229,14 +3408,14 @@
3229
3408
  return timestamp;
3230
3409
  }
3231
3410
  var init_hi_res_timestamp = __esm({
3232
- "../../node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
3411
+ "../../node_modules/@probe.gl/stats/dist/utils/hi-res-timestamp.js"() {
3233
3412
  }
3234
3413
  });
3235
3414
 
3236
- // ../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js
3415
+ // ../../node_modules/@probe.gl/stats/dist/lib/stat.js
3237
3416
  var Stat;
3238
3417
  var init_stat = __esm({
3239
- "../../node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
3418
+ "../../node_modules/@probe.gl/stats/dist/lib/stat.js"() {
3240
3419
  init_defineProperty();
3241
3420
  init_hi_res_timestamp();
3242
3421
  Stat = class {
@@ -3244,12 +3423,12 @@
3244
3423
  _defineProperty(this, "name", void 0);
3245
3424
  _defineProperty(this, "type", void 0);
3246
3425
  _defineProperty(this, "sampleSize", 1);
3247
- _defineProperty(this, "time", void 0);
3248
- _defineProperty(this, "count", void 0);
3249
- _defineProperty(this, "samples", void 0);
3250
- _defineProperty(this, "lastTiming", void 0);
3251
- _defineProperty(this, "lastSampleTime", void 0);
3252
- _defineProperty(this, "lastSampleCount", void 0);
3426
+ _defineProperty(this, "time", 0);
3427
+ _defineProperty(this, "count", 0);
3428
+ _defineProperty(this, "samples", 0);
3429
+ _defineProperty(this, "lastTiming", 0);
3430
+ _defineProperty(this, "lastSampleTime", 0);
3431
+ _defineProperty(this, "lastSampleCount", 0);
3253
3432
  _defineProperty(this, "_count", 0);
3254
3433
  _defineProperty(this, "_time", 0);
3255
3434
  _defineProperty(this, "_samples", 0);
@@ -3259,6 +3438,20 @@
3259
3438
  this.type = type;
3260
3439
  this.reset();
3261
3440
  }
3441
+ reset() {
3442
+ this.time = 0;
3443
+ this.count = 0;
3444
+ this.samples = 0;
3445
+ this.lastTiming = 0;
3446
+ this.lastSampleTime = 0;
3447
+ this.lastSampleCount = 0;
3448
+ this._count = 0;
3449
+ this._time = 0;
3450
+ this._samples = 0;
3451
+ this._startTime = 0;
3452
+ this._timerPending = false;
3453
+ return this;
3454
+ }
3262
3455
  setSampleSize(samples) {
3263
3456
  this.sampleSize = samples;
3264
3457
  return this;
@@ -3322,20 +3515,6 @@
3322
3515
  getHz() {
3323
3516
  return this.time > 0 ? this.samples / (this.time / 1e3) : 0;
3324
3517
  }
3325
- reset() {
3326
- this.time = 0;
3327
- this.count = 0;
3328
- this.samples = 0;
3329
- this.lastTiming = 0;
3330
- this.lastSampleTime = 0;
3331
- this.lastSampleCount = 0;
3332
- this._count = 0;
3333
- this._time = 0;
3334
- this._samples = 0;
3335
- this._startTime = 0;
3336
- this._timerPending = false;
3337
- return this;
3338
- }
3339
3518
  _checkSampling() {
3340
3519
  if (this._samples === this.sampleSize) {
3341
3520
  this.lastSampleTime = this._time;
@@ -3352,10 +3531,10 @@
3352
3531
  }
3353
3532
  });
3354
3533
 
3355
- // ../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js
3534
+ // ../../node_modules/@probe.gl/stats/dist/lib/stats.js
3356
3535
  var Stats;
3357
3536
  var init_stats = __esm({
3358
- "../../node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
3537
+ "../../node_modules/@probe.gl/stats/dist/lib/stats.js"() {
3359
3538
  init_defineProperty();
3360
3539
  init_stat();
3361
3540
  Stats = class {
@@ -3378,14 +3557,14 @@
3378
3557
  return Object.keys(this.stats).length;
3379
3558
  }
3380
3559
  reset() {
3381
- for (const key in this.stats) {
3382
- this.stats[key].reset();
3560
+ for (const stat of Object.values(this.stats)) {
3561
+ stat.reset();
3383
3562
  }
3384
3563
  return this;
3385
3564
  }
3386
3565
  forEach(fn) {
3387
- for (const key in this.stats) {
3388
- fn(this.stats[key]);
3566
+ for (const stat of Object.values(this.stats)) {
3567
+ fn(stat);
3389
3568
  }
3390
3569
  }
3391
3570
  getTable() {
@@ -3405,29 +3584,28 @@
3405
3584
  stats.forEach((stat) => this._getOrCreate(stat));
3406
3585
  }
3407
3586
  _getOrCreate(stat) {
3408
- if (!stat || !stat.name) {
3409
- return null;
3410
- }
3411
3587
  const {
3412
3588
  name,
3413
3589
  type
3414
3590
  } = stat;
3415
- if (!this.stats[name]) {
3591
+ let result = this.stats[name];
3592
+ if (!result) {
3416
3593
  if (stat instanceof Stat) {
3417
- this.stats[name] = stat;
3594
+ result = stat;
3418
3595
  } else {
3419
- this.stats[name] = new Stat(name, type);
3596
+ result = new Stat(name, type);
3420
3597
  }
3598
+ this.stats[name] = result;
3421
3599
  }
3422
- return this.stats[name];
3600
+ return result;
3423
3601
  }
3424
3602
  };
3425
3603
  }
3426
3604
  });
3427
3605
 
3428
- // ../../node_modules/@probe.gl/stats/dist/esm/index.js
3429
- var init_esm3 = __esm({
3430
- "../../node_modules/@probe.gl/stats/dist/esm/index.js"() {
3606
+ // ../../node_modules/@probe.gl/stats/dist/index.js
3607
+ var init_dist = __esm({
3608
+ "../../node_modules/@probe.gl/stats/dist/index.js"() {
3431
3609
  init_stats();
3432
3610
  init_stat();
3433
3611
  init_hi_res_timestamp();
@@ -3446,19 +3624,19 @@
3446
3624
  });
3447
3625
 
3448
3626
  // ../loader-utils/src/lib/env-utils/globals.ts
3449
- var globals2, self_, window_, global_2, document_, isBrowser, matches, nodeVersion;
3627
+ var globals, self_, window_, global_, document_, isBrowser, matches, nodeVersion;
3450
3628
  var init_globals = __esm({
3451
3629
  "../loader-utils/src/lib/env-utils/globals.ts"() {
3452
- globals2 = {
3630
+ globals = {
3453
3631
  self: typeof self !== "undefined" && self,
3454
3632
  window: typeof window !== "undefined" && window,
3455
3633
  global: typeof global !== "undefined" && global,
3456
3634
  document: typeof document !== "undefined" && document
3457
3635
  };
3458
- self_ = globals2.self || globals2.window || globals2.global || {};
3459
- window_ = globals2.window || globals2.self || globals2.global || {};
3460
- global_2 = globals2.global || globals2.self || globals2.window || {};
3461
- document_ = globals2.document || {};
3636
+ self_ = globals.self || globals.window || globals.global || {};
3637
+ window_ = globals.window || globals.self || globals.global || {};
3638
+ global_ = globals.global || globals.self || globals.window || {};
3639
+ document_ = globals.document || {};
3462
3640
  isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
3463
3641
  matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
3464
3642
  nodeVersion = matches && parseFloat(matches[1]) || 0;
@@ -3489,19 +3667,19 @@
3489
3667
  });
3490
3668
 
3491
3669
  // ../worker-utils/src/lib/env-utils/globals.ts
3492
- var globals3, self_2, window_2, global_3, document_2, isBrowser2, isMobile, matches2, nodeVersion2;
3670
+ var globals2, self_2, window_2, global_2, document_2, isBrowser2, isMobile, matches2, nodeVersion2;
3493
3671
  var init_globals2 = __esm({
3494
3672
  "../worker-utils/src/lib/env-utils/globals.ts"() {
3495
- globals3 = {
3673
+ globals2 = {
3496
3674
  self: typeof self !== "undefined" && self,
3497
3675
  window: typeof window !== "undefined" && window,
3498
3676
  global: typeof global !== "undefined" && global,
3499
3677
  document: typeof document !== "undefined" && document
3500
3678
  };
3501
- self_2 = globals3.self || globals3.window || globals3.global || {};
3502
- window_2 = globals3.window || globals3.self || globals3.global || {};
3503
- global_3 = globals3.global || globals3.self || globals3.window || {};
3504
- document_2 = globals3.document || {};
3679
+ self_2 = globals2.self || globals2.window || globals2.global || {};
3680
+ window_2 = globals2.window || globals2.self || globals2.global || {};
3681
+ global_2 = globals2.global || globals2.self || globals2.window || {};
3682
+ document_2 = globals2.document || {};
3505
3683
  isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
3506
3684
  isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
3507
3685
  matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
@@ -3516,15 +3694,15 @@
3516
3694
  init_assert3();
3517
3695
  WorkerJob = class {
3518
3696
  constructor(jobName, workerThread) {
3519
- this.name = jobName;
3520
- this.workerThread = workerThread;
3521
3697
  this.isRunning = true;
3522
3698
  this._resolve = () => {
3523
3699
  };
3524
3700
  this._reject = () => {
3525
3701
  };
3526
- this.result = new Promise((resolve, reject) => {
3527
- this._resolve = resolve;
3702
+ this.name = jobName;
3703
+ this.workerThread = workerThread;
3704
+ this.result = new Promise((resolve2, reject) => {
3705
+ this._resolve = resolve2;
3528
3706
  this._reject = reject;
3529
3707
  });
3530
3708
  }
@@ -3549,6 +3727,17 @@
3549
3727
  }
3550
3728
  });
3551
3729
 
3730
+ // ../worker-utils/src/lib/node/worker_threads-browser.ts
3731
+ var Worker2;
3732
+ var init_worker_threads_browser = __esm({
3733
+ "../worker-utils/src/lib/node/worker_threads-browser.ts"() {
3734
+ Worker2 = class {
3735
+ terminate() {
3736
+ }
3737
+ };
3738
+ }
3739
+ });
3740
+
3552
3741
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
3553
3742
  function getLoadableWorkerURL(props) {
3554
3743
  assert3(props.source && !props.url || !props.source && props.url);
@@ -3636,6 +3825,8 @@
3636
3825
  var NOOP, WorkerThread;
3637
3826
  var init_worker_thread = __esm({
3638
3827
  "../worker-utils/src/lib/worker-farm/worker-thread.ts"() {
3828
+ init_worker_threads_browser();
3829
+ init_globals2();
3639
3830
  init_assert3();
3640
3831
  init_get_loadable_worker_url();
3641
3832
  init_get_transfer_list();
@@ -3652,10 +3843,10 @@
3652
3843
  this.url = url;
3653
3844
  this.onMessage = NOOP;
3654
3845
  this.onError = (error) => console.log(error);
3655
- this.worker = this._createBrowserWorker();
3846
+ this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
3656
3847
  }
3657
3848
  static isSupported() {
3658
- return typeof Worker !== "undefined";
3849
+ return typeof Worker !== "undefined" && isBrowser2 || typeof Worker2 !== "undefined" && !isBrowser2;
3659
3850
  }
3660
3851
  destroy() {
3661
3852
  this.onMessage = NOOP;
@@ -3698,6 +3889,27 @@
3698
3889
  worker.onmessageerror = (event) => console.error(event);
3699
3890
  return worker;
3700
3891
  }
3892
+ _createNodeWorker() {
3893
+ let worker;
3894
+ if (this.url) {
3895
+ const absolute = this.url.includes(":/") || this.url.startsWith("/");
3896
+ const url = absolute ? this.url : `./${this.url}`;
3897
+ worker = new Worker2(url, { eval: false });
3898
+ } else if (this.source) {
3899
+ worker = new Worker2(this.source, { eval: true });
3900
+ } else {
3901
+ throw new Error("no worker");
3902
+ }
3903
+ worker.on("message", (data) => {
3904
+ this.onMessage(data);
3905
+ });
3906
+ worker.on("error", (error) => {
3907
+ this.onError(error);
3908
+ });
3909
+ worker.on("exit", (code) => {
3910
+ });
3911
+ return worker;
3912
+ }
3701
3913
  };
3702
3914
  }
3703
3915
  });
@@ -3726,6 +3938,9 @@
3726
3938
  this.url = props.url;
3727
3939
  this.setProps(props);
3728
3940
  }
3941
+ static isSupported() {
3942
+ return WorkerThread.isSupported();
3943
+ }
3729
3944
  destroy() {
3730
3945
  this.idleQueue.forEach((worker) => worker.destroy());
3731
3946
  this.isDestroyed = true;
@@ -3822,9 +4037,9 @@
3822
4037
  DEFAULT_PROPS = {
3823
4038
  maxConcurrency: 3,
3824
4039
  maxMobileConcurrency: 1,
4040
+ reuseWorkers: true,
3825
4041
  onDebug: () => {
3826
- },
3827
- reuseWorkers: true
4042
+ }
3828
4043
  };
3829
4044
  WorkerFarm = class {
3830
4045
  constructor(props) {
@@ -3845,6 +4060,7 @@
3845
4060
  for (const workerPool of this.workerPools.values()) {
3846
4061
  workerPool.destroy();
3847
4062
  }
4063
+ this.workerPools = new Map();
3848
4064
  }
3849
4065
  setProps(props) {
3850
4066
  this.props = { ...this.props, ...props };
@@ -3928,6 +4144,7 @@
3928
4144
  var init_src = __esm({
3929
4145
  "../worker-utils/src/index.ts"() {
3930
4146
  init_assert3();
4147
+ init_globals2();
3931
4148
  init_worker_farm();
3932
4149
  init_get_worker_url();
3933
4150
  init_validate_worker_version();
@@ -3939,6 +4156,9 @@
3939
4156
  if (!WorkerFarm.isSupported()) {
3940
4157
  return false;
3941
4158
  }
4159
+ if (!isBrowser2 && !options?._nodeWorkers) {
4160
+ return false;
4161
+ }
3942
4162
  return loader.worker && options?.worker;
3943
4163
  }
3944
4164
  async function parseWithWorker(loader, data, options, context, parseOnMainThread) {
@@ -3947,10 +4167,12 @@
3947
4167
  const workerFarm = WorkerFarm.getWorkerFarm(options);
3948
4168
  const workerPool = workerFarm.getWorkerPool({ name, url });
3949
4169
  options = JSON.parse(JSON.stringify(options));
4170
+ context = JSON.parse(JSON.stringify(context || {}));
3950
4171
  const job = await workerPool.startJob("process-on-worker", onMessage.bind(null, parseOnMainThread));
3951
4172
  job.postMessage("process", {
3952
4173
  input: data,
3953
- options
4174
+ options,
4175
+ context
3954
4176
  });
3955
4177
  const result = await job.result;
3956
4178
  return await result.result;
@@ -3980,49 +4202,11 @@
3980
4202
  var init_parse_with_worker = __esm({
3981
4203
  "../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts"() {
3982
4204
  init_src();
3983
- }
3984
- });
3985
-
3986
- // ../loader-utils/src/lib/binary-utils/buffer-utils.ts
3987
- function isBuffer(value) {
3988
- return value && typeof value === "object" && value.isBuffer;
3989
- }
3990
- function bufferToArrayBuffer(buffer) {
3991
- if (isBuffer(buffer)) {
3992
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
3993
- return typedArray.slice().buffer;
3994
- }
3995
- return buffer;
3996
- }
3997
- var init_buffer_utils = __esm({
3998
- "../loader-utils/src/lib/binary-utils/buffer-utils.ts"() {
4205
+ init_src();
3999
4206
  }
4000
4207
  });
4001
4208
 
4002
4209
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
4003
- function toArrayBuffer(data) {
4004
- if (isBuffer(data)) {
4005
- return bufferToArrayBuffer(data);
4006
- }
4007
- if (data instanceof ArrayBuffer) {
4008
- return data;
4009
- }
4010
- if (ArrayBuffer.isView(data)) {
4011
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
4012
- return data.buffer;
4013
- }
4014
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
4015
- }
4016
- if (typeof data === "string") {
4017
- const text = data;
4018
- const uint8Array = new TextEncoder().encode(text);
4019
- return uint8Array.buffer;
4020
- }
4021
- if (data && typeof data === "object" && data._toArrayBuffer) {
4022
- return data._toArrayBuffer();
4023
- }
4024
- throw new Error("toArrayBuffer");
4025
- }
4026
4210
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
4027
4211
  byteLength = byteLength || arrayBuffer1.byteLength;
4028
4212
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -4050,7 +4234,6 @@
4050
4234
  }
4051
4235
  var init_array_buffer_utils = __esm({
4052
4236
  "../loader-utils/src/lib/binary-utils/array-buffer-utils.ts"() {
4053
- init_buffer_utils();
4054
4237
  }
4055
4238
  });
4056
4239
 
@@ -4072,7 +4255,7 @@
4072
4255
  var STAT_QUEUED_REQUESTS, STAT_ACTIVE_REQUESTS, STAT_CANCELLED_REQUESTS, STAT_QUEUED_REQUESTS_EVER, STAT_ACTIVE_REQUESTS_EVER, DEFAULT_PROPS2, RequestScheduler;
4073
4256
  var init_request_scheduler = __esm({
4074
4257
  "../loader-utils/src/lib/request-utils/request-scheduler.ts"() {
4075
- init_esm3();
4258
+ init_dist();
4076
4259
  STAT_QUEUED_REQUESTS = "Queued Requests";
4077
4260
  STAT_ACTIVE_REQUESTS = "Active Requests";
4078
4261
  STAT_CANCELLED_REQUESTS = "Cancelled Requests";
@@ -4106,8 +4289,8 @@
4106
4289
  return this.requestMap.get(handle);
4107
4290
  }
4108
4291
  const request = { handle, priority: 0, getPriority };
4109
- const promise = new Promise((resolve) => {
4110
- request.resolve = resolve;
4292
+ const promise = new Promise((resolve2) => {
4293
+ request.resolve = resolve2;
4111
4294
  return request;
4112
4295
  });
4113
4296
  this.requestQueue.push(request);
@@ -4116,7 +4299,7 @@
4116
4299
  return promise;
4117
4300
  }
4118
4301
  _issueRequest(request) {
4119
- const { handle, resolve } = request;
4302
+ const { handle, resolve: resolve2 } = request;
4120
4303
  let isDone = false;
4121
4304
  const done = () => {
4122
4305
  if (!isDone) {
@@ -4127,7 +4310,7 @@
4127
4310
  }
4128
4311
  };
4129
4312
  this.activeRequestCount++;
4130
- return resolve ? resolve({ done }) : Promise.resolve({ done });
4313
+ return resolve2 ? resolve2({ done }) : Promise.resolve({ done });
4131
4314
  }
4132
4315
  _issueNewRequests() {
4133
4316
  if (!this.deferredUpdate) {
@@ -4193,19 +4376,75 @@
4193
4376
  }
4194
4377
  });
4195
4378
 
4379
+ // ../loader-utils/src/lib/node/buffer.browser.ts
4380
+ function toArrayBuffer(buffer) {
4381
+ return buffer;
4382
+ }
4383
+ var init_buffer_browser = __esm({
4384
+ "../loader-utils/src/lib/node/buffer.browser.ts"() {
4385
+ }
4386
+ });
4387
+
4388
+ // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
4389
+ function isBuffer(value) {
4390
+ return value && typeof value === "object" && value.isBuffer;
4391
+ }
4392
+ function toArrayBuffer2(data) {
4393
+ if (isBuffer(data)) {
4394
+ return toArrayBuffer(data);
4395
+ }
4396
+ if (data instanceof ArrayBuffer) {
4397
+ return data;
4398
+ }
4399
+ if (ArrayBuffer.isView(data)) {
4400
+ if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
4401
+ return data.buffer;
4402
+ }
4403
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
4404
+ }
4405
+ if (typeof data === "string") {
4406
+ const text = data;
4407
+ const uint8Array = new TextEncoder().encode(text);
4408
+ return uint8Array.buffer;
4409
+ }
4410
+ if (data && typeof data === "object" && data._toArrayBuffer) {
4411
+ return data._toArrayBuffer();
4412
+ }
4413
+ throw new Error("toArrayBuffer");
4414
+ }
4415
+ var init_memory_conversion_utils = __esm({
4416
+ "../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
4417
+ init_buffer_browser();
4418
+ }
4419
+ });
4420
+
4421
+ // ../loader-utils/src/lib/path-utils/get-cwd.ts
4422
+ function getCWD() {
4423
+ if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
4424
+ return process.cwd();
4425
+ }
4426
+ const pathname = window.location?.pathname;
4427
+ return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
4428
+ }
4429
+ var init_get_cwd = __esm({
4430
+ "../loader-utils/src/lib/path-utils/get-cwd.ts"() {
4431
+ }
4432
+ });
4433
+
4196
4434
  // ../loader-utils/src/lib/path-utils/path.ts
4197
4435
  var path_exports = {};
4198
4436
  __export(path_exports, {
4199
4437
  dirname: () => dirname,
4200
4438
  filename: () => filename,
4201
- join: () => join
4439
+ join: () => join,
4440
+ resolve: () => resolve
4202
4441
  });
4203
4442
  function filename(url) {
4204
- const slashIndex = url && url.lastIndexOf("/");
4443
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
4205
4444
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
4206
4445
  }
4207
4446
  function dirname(url) {
4208
- const slashIndex = url && url.lastIndexOf("/");
4447
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
4209
4448
  return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
4210
4449
  }
4211
4450
  function join(...parts) {
@@ -4221,8 +4460,112 @@
4221
4460
  });
4222
4461
  return parts.join(separator);
4223
4462
  }
4463
+ function resolve(...components) {
4464
+ const paths = [];
4465
+ for (let _i = 0; _i < components.length; _i++) {
4466
+ paths[_i] = components[_i];
4467
+ }
4468
+ let resolvedPath = "";
4469
+ let resolvedAbsolute = false;
4470
+ let cwd;
4471
+ for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {
4472
+ let path;
4473
+ if (i >= 0) {
4474
+ path = paths[i];
4475
+ } else {
4476
+ if (cwd === void 0) {
4477
+ cwd = getCWD();
4478
+ }
4479
+ path = cwd;
4480
+ }
4481
+ if (path.length === 0) {
4482
+ continue;
4483
+ }
4484
+ resolvedPath = `${path}/${resolvedPath}`;
4485
+ resolvedAbsolute = path.charCodeAt(0) === SLASH;
4486
+ }
4487
+ resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
4488
+ if (resolvedAbsolute) {
4489
+ return `/${resolvedPath}`;
4490
+ } else if (resolvedPath.length > 0) {
4491
+ return resolvedPath;
4492
+ }
4493
+ return ".";
4494
+ }
4495
+ function normalizeStringPosix(path, allowAboveRoot) {
4496
+ let res = "";
4497
+ let lastSlash = -1;
4498
+ let dots = 0;
4499
+ let code;
4500
+ let isAboveRoot = false;
4501
+ for (let i = 0; i <= path.length; ++i) {
4502
+ if (i < path.length) {
4503
+ code = path.charCodeAt(i);
4504
+ } else if (code === SLASH) {
4505
+ break;
4506
+ } else {
4507
+ code = SLASH;
4508
+ }
4509
+ if (code === SLASH) {
4510
+ if (lastSlash === i - 1 || dots === 1) {
4511
+ } else if (lastSlash !== i - 1 && dots === 2) {
4512
+ if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
4513
+ if (res.length > 2) {
4514
+ const start = res.length - 1;
4515
+ let j = start;
4516
+ for (; j >= 0; --j) {
4517
+ if (res.charCodeAt(j) === SLASH) {
4518
+ break;
4519
+ }
4520
+ }
4521
+ if (j !== start) {
4522
+ res = j === -1 ? "" : res.slice(0, j);
4523
+ lastSlash = i;
4524
+ dots = 0;
4525
+ isAboveRoot = false;
4526
+ continue;
4527
+ }
4528
+ } else if (res.length === 2 || res.length === 1) {
4529
+ res = "";
4530
+ lastSlash = i;
4531
+ dots = 0;
4532
+ isAboveRoot = false;
4533
+ continue;
4534
+ }
4535
+ }
4536
+ if (allowAboveRoot) {
4537
+ if (res.length > 0) {
4538
+ res += "/..";
4539
+ } else {
4540
+ res = "..";
4541
+ }
4542
+ isAboveRoot = true;
4543
+ }
4544
+ } else {
4545
+ const slice = path.slice(lastSlash + 1, i);
4546
+ if (res.length > 0) {
4547
+ res += `/${slice}`;
4548
+ } else {
4549
+ res = slice;
4550
+ }
4551
+ isAboveRoot = false;
4552
+ }
4553
+ lastSlash = i;
4554
+ dots = 0;
4555
+ } else if (code === DOT && dots !== -1) {
4556
+ ++dots;
4557
+ } else {
4558
+ dots = -1;
4559
+ }
4560
+ }
4561
+ return res;
4562
+ }
4563
+ var SLASH, DOT;
4224
4564
  var init_path = __esm({
4225
4565
  "../loader-utils/src/lib/path-utils/path.ts"() {
4566
+ init_get_cwd();
4567
+ SLASH = 47;
4568
+ DOT = 46;
4226
4569
  }
4227
4570
  });
4228
4571
 
@@ -4236,6 +4579,7 @@
4236
4579
  init_async_iteration();
4237
4580
  init_request_scheduler();
4238
4581
  init_file_aliases();
4582
+ init_memory_conversion_utils();
4239
4583
  init_path();
4240
4584
  }
4241
4585
  });
@@ -4269,55 +4613,55 @@
4269
4613
  return this._length;
4270
4614
  }
4271
4615
  add(item) {
4272
- const node = new DoublyLinkedListNode(item, this.tail, null);
4616
+ const node2 = new DoublyLinkedListNode(item, this.tail, null);
4273
4617
  if (this.tail) {
4274
- this.tail.next = node;
4275
- this.tail = node;
4618
+ this.tail.next = node2;
4619
+ this.tail = node2;
4276
4620
  } else {
4277
- this.head = node;
4278
- this.tail = node;
4621
+ this.head = node2;
4622
+ this.tail = node2;
4279
4623
  }
4280
4624
  ++this._length;
4281
- return node;
4625
+ return node2;
4282
4626
  }
4283
- remove(node) {
4284
- if (!node) {
4627
+ remove(node2) {
4628
+ if (!node2) {
4285
4629
  return;
4286
4630
  }
4287
- if (node.previous && node.next) {
4288
- node.previous.next = node.next;
4289
- node.next.previous = node.previous;
4290
- } else if (node.previous) {
4291
- node.previous.next = null;
4292
- this.tail = node.previous;
4293
- } else if (node.next) {
4294
- node.next.previous = null;
4295
- this.head = node.next;
4631
+ if (node2.previous && node2.next) {
4632
+ node2.previous.next = node2.next;
4633
+ node2.next.previous = node2.previous;
4634
+ } else if (node2.previous) {
4635
+ node2.previous.next = null;
4636
+ this.tail = node2.previous;
4637
+ } else if (node2.next) {
4638
+ node2.next.previous = null;
4639
+ this.head = node2.next;
4296
4640
  } else {
4297
4641
  this.head = null;
4298
4642
  this.tail = null;
4299
4643
  }
4300
- node.next = null;
4301
- node.previous = null;
4644
+ node2.next = null;
4645
+ node2.previous = null;
4302
4646
  --this._length;
4303
4647
  }
4304
- splice(node, nextNode) {
4305
- if (node === nextNode) {
4648
+ splice(node2, nextNode) {
4649
+ if (node2 === nextNode) {
4306
4650
  return;
4307
4651
  }
4308
4652
  this.remove(nextNode);
4309
- this._insert(node, nextNode);
4653
+ this._insert(node2, nextNode);
4310
4654
  }
4311
- _insert(node, nextNode) {
4312
- const oldNodeNext = node.next;
4313
- node.next = nextNode;
4314
- if (this.tail === node) {
4655
+ _insert(node2, nextNode) {
4656
+ const oldNodeNext = node2.next;
4657
+ node2.next = nextNode;
4658
+ if (this.tail === node2) {
4315
4659
  this.tail = nextNode;
4316
4660
  } else {
4317
4661
  oldNodeNext.previous = nextNode;
4318
4662
  }
4319
4663
  nextNode.next = oldNodeNext;
4320
- nextNode.previous = node;
4664
+ nextNode.previous = node2;
4321
4665
  ++this._length;
4322
4666
  }
4323
4667
  };
@@ -4342,9 +4686,9 @@
4342
4686
  this._list.splice(this._list.tail, this._sentinel);
4343
4687
  }
4344
4688
  touch(tile) {
4345
- const node = tile._cacheNode;
4346
- if (defined(node)) {
4347
- this._list.splice(this._sentinel, node);
4689
+ const node2 = tile._cacheNode;
4690
+ if (defined(node2)) {
4691
+ this._list.splice(this._sentinel, node2);
4348
4692
  }
4349
4693
  }
4350
4694
  add(tileset, tile, addCallback) {
@@ -4356,11 +4700,11 @@
4356
4700
  }
4357
4701
  }
4358
4702
  unloadTile(tileset, tile, unloadCallback) {
4359
- const node = tile._cacheNode;
4360
- if (!defined(node)) {
4703
+ const node2 = tile._cacheNode;
4704
+ if (!defined(node2)) {
4361
4705
  return;
4362
4706
  }
4363
- this._list.remove(node);
4707
+ this._list.remove(node2);
4364
4708
  tile._cacheNode = void 0;
4365
4709
  if (unloadCallback) {
4366
4710
  unloadCallback(tileset, tile);
@@ -4372,10 +4716,10 @@
4372
4716
  const list = this._list;
4373
4717
  const maximumMemoryUsageInBytes = tileset.maximumMemoryUsage * 1024 * 1024;
4374
4718
  const sentinel = this._sentinel;
4375
- let node = list.head;
4376
- while (node !== sentinel && (tileset.gpuMemoryUsageInBytes > maximumMemoryUsageInBytes || trimTiles)) {
4377
- const tile = node.item;
4378
- node = node.next;
4719
+ let node2 = list.head;
4720
+ while (node2 !== sentinel && (tileset.gpuMemoryUsageInBytes > maximumMemoryUsageInBytes || trimTiles)) {
4721
+ const tile = node2.item;
4722
+ node2 = node2.next;
4379
4723
  this.unloadTile(tileset, tile, unloadCallback);
4380
4724
  }
4381
4725
  }
@@ -4440,11 +4784,11 @@
4440
4784
  var INTERSECTION;
4441
4785
  var init_constants2 = __esm({
4442
4786
  "../../node_modules/@math.gl/culling/dist/esm/constants.js"() {
4443
- INTERSECTION = Object.freeze({
4787
+ INTERSECTION = {
4444
4788
  OUTSIDE: -1,
4445
4789
  INTERSECTING: 0,
4446
4790
  INSIDE: 1
4447
- });
4791
+ };
4448
4792
  }
4449
4793
  });
4450
4794
 
@@ -4452,6 +4796,7 @@
4452
4796
  var scratchVector5, scratchNormal2;
4453
4797
  var init_axis_aligned_bounding_box = __esm({
4454
4798
  "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js"() {
4799
+ init_defineProperty();
4455
4800
  init_esm();
4456
4801
  init_constants2();
4457
4802
  scratchVector5 = new Vector3();
@@ -4463,6 +4808,7 @@
4463
4808
  var scratchVector6, scratchVector23, BoundingSphere;
4464
4809
  var init_bounding_sphere = __esm({
4465
4810
  "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js"() {
4811
+ init_defineProperty();
4466
4812
  init_esm();
4467
4813
  init_mat4();
4468
4814
  init_constants2();
@@ -4470,6 +4816,8 @@
4470
4816
  scratchVector23 = new Vector3();
4471
4817
  BoundingSphere = class {
4472
4818
  constructor(center = [0, 0, 0], radius = 0) {
4819
+ _defineProperty(this, "center", void 0);
4820
+ _defineProperty(this, "radius", void 0);
4473
4821
  this.radius = -0;
4474
4822
  this.center = new Vector3();
4475
4823
  this.fromCenterRadius(center, radius);
@@ -4511,8 +4859,8 @@
4511
4859
  return this;
4512
4860
  }
4513
4861
  expand(point) {
4514
- point = scratchVector6.from(point);
4515
- const radius = point.subtract(this.center).magnitude();
4862
+ const scratchPoint2 = scratchVector6.from(point);
4863
+ const radius = scratchPoint2.subtract(this.center).magnitude();
4516
4864
  if (radius > this.radius) {
4517
4865
  this.radius = radius;
4518
4866
  }
@@ -4525,12 +4873,13 @@
4525
4873
  return this;
4526
4874
  }
4527
4875
  distanceSquaredTo(point) {
4528
- point = scratchVector6.from(point);
4529
- const delta = point.subtract(this.center);
4530
- return delta.lengthSquared() - this.radius * this.radius;
4876
+ const d = this.distanceTo(point);
4877
+ return d * d;
4531
4878
  }
4532
4879
  distanceTo(point) {
4533
- return Math.sqrt(this.distanceSquaredTo(point));
4880
+ const scratchPoint2 = scratchVector6.from(point);
4881
+ const delta = scratchPoint2.subtract(this.center);
4882
+ return Math.max(0, delta.len() - this.radius);
4534
4883
  }
4535
4884
  intersectPlane(plane) {
4536
4885
  const center = this.center;
@@ -4553,6 +4902,7 @@
4553
4902
  var scratchVector32, scratchOffset, scratchVectorU, scratchVectorV, scratchVectorW, scratchCorner, scratchToCenter, MATRIX3, OrientedBoundingBox;
4554
4903
  var init_oriented_bounding_box = __esm({
4555
4904
  "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js"() {
4905
+ init_defineProperty();
4556
4906
  init_esm();
4557
4907
  init_bounding_sphere();
4558
4908
  init_constants2();
@@ -4576,6 +4926,8 @@
4576
4926
  };
4577
4927
  OrientedBoundingBox = class {
4578
4928
  constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
4929
+ _defineProperty(this, "center", void 0);
4930
+ _defineProperty(this, "halfAxes", void 0);
4579
4931
  this.center = new Vector3().from(center);
4580
4932
  this.halfAxes = new Matrix3(halfAxes);
4581
4933
  }
@@ -4747,11 +5099,14 @@
4747
5099
  var scratchPosition2, scratchNormal3, Plane;
4748
5100
  var init_plane = __esm({
4749
5101
  "../../node_modules/@math.gl/culling/dist/esm/lib/plane.js"() {
5102
+ init_defineProperty();
4750
5103
  init_esm();
4751
5104
  scratchPosition2 = new Vector3();
4752
5105
  scratchNormal3 = new Vector3();
4753
5106
  Plane = class {
4754
5107
  constructor(normal = [0, 0, 1], distance = 0) {
5108
+ _defineProperty(this, "normal", void 0);
5109
+ _defineProperty(this, "distance", void 0);
4755
5110
  this.normal = new Vector3();
4756
5111
  this.distance = -0;
4757
5112
  this.fromNormalDistance(normal, distance);
@@ -4775,7 +5130,7 @@
4775
5130
  this.distance = d;
4776
5131
  return this;
4777
5132
  }
4778
- clone(plane) {
5133
+ clone() {
4779
5134
  return new Plane(this.normal, this.distance);
4780
5135
  }
4781
5136
  equals(right) {
@@ -4803,6 +5158,7 @@
4803
5158
  var faces, scratchPlaneCenter, scratchPlaneNormal, scratchPlane, CullingVolume;
4804
5159
  var init_culling_volume = __esm({
4805
5160
  "../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js"() {
5161
+ init_defineProperty();
4806
5162
  init_esm();
4807
5163
  init_constants2();
4808
5164
  init_plane();
@@ -4811,18 +5167,9 @@
4811
5167
  scratchPlaneNormal = new Vector3();
4812
5168
  scratchPlane = new Plane(new Vector3(1, 0, 0), 0);
4813
5169
  CullingVolume = class {
4814
- static get MASK_OUTSIDE() {
4815
- return 4294967295;
4816
- }
4817
- static get MASK_INSIDE() {
4818
- return 0;
4819
- }
4820
- static get MASK_INDETERMINATE() {
4821
- return 2147483647;
4822
- }
4823
5170
  constructor(planes = []) {
5171
+ _defineProperty(this, "planes", void 0);
4824
5172
  this.planes = planes;
4825
- assert(this.planes.every((plane) => plane instanceof Plane));
4826
5173
  }
4827
5174
  fromBoundingSphere(boundingSphere) {
4828
5175
  this.planes.length = 2 * faces.length;
@@ -4850,7 +5197,6 @@
4850
5197
  return this;
4851
5198
  }
4852
5199
  computeVisibility(boundingVolume) {
4853
- assert(boundingVolume);
4854
5200
  let intersect = INTERSECTION.INSIDE;
4855
5201
  for (const plane of this.planes) {
4856
5202
  const result = boundingVolume.intersectPlane(plane);
@@ -4866,7 +5212,6 @@
4866
5212
  return intersect;
4867
5213
  }
4868
5214
  computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
4869
- assert(boundingVolume, "boundingVolume is required.");
4870
5215
  assert(Number.isFinite(parentPlaneMask), "parentPlaneMask is required.");
4871
5216
  if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
4872
5217
  return parentPlaneMask;
@@ -4889,6 +5234,9 @@
4889
5234
  return mask;
4890
5235
  }
4891
5236
  };
5237
+ _defineProperty(CullingVolume, "MASK_OUTSIDE", 4294967295);
5238
+ _defineProperty(CullingVolume, "MASK_INSIDE", 0);
5239
+ _defineProperty(CullingVolume, "MASK_INDETERMINATE", 2147483647);
4892
5240
  }
4893
5241
  });
4894
5242
 
@@ -4896,6 +5244,7 @@
4896
5244
  var scratchPlaneUpVector, scratchPlaneRightVector, scratchPlaneNearCenter, scratchPlaneFarCenter, scratchPlaneNormal2;
4897
5245
  var init_perspective_off_center_frustum = __esm({
4898
5246
  "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js"() {
5247
+ init_defineProperty();
4899
5248
  init_esm();
4900
5249
  init_culling_volume();
4901
5250
  init_plane();
@@ -4910,6 +5259,7 @@
4910
5259
  // ../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js
4911
5260
  var init_perspective_frustum = __esm({
4912
5261
  "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js"() {
5262
+ init_defineProperty();
4913
5263
  init_perspective_off_center_frustum();
4914
5264
  }
4915
5265
  });
@@ -4971,7 +5321,7 @@
4971
5321
  });
4972
5322
 
4973
5323
  // ../../node_modules/@math.gl/culling/dist/esm/index.js
4974
- var init_esm4 = __esm({
5324
+ var init_esm3 = __esm({
4975
5325
  "../../node_modules/@math.gl/culling/dist/esm/index.js"() {
4976
5326
  init_constants2();
4977
5327
  init_axis_aligned_bounding_box();
@@ -4984,8 +5334,6 @@
4984
5334
  init_bounding_sphere_from_points();
4985
5335
  init_bounding_box_from_points();
4986
5336
  init_compute_eigen_decomposition();
4987
- init_constants2();
4988
- init_constants2();
4989
5337
  }
4990
5338
  });
4991
5339
 
@@ -4993,44 +5341,93 @@
4993
5341
  function getFrameState(viewport, frameNumber) {
4994
5342
  const { cameraDirection, cameraUp, height } = viewport;
4995
5343
  const { metersPerUnit } = viewport.distanceScales;
4996
- const viewportCenterCartographic = viewport.unprojectPosition(viewport.center);
4997
- const viewportCenterCartesian = Ellipsoid.WGS84.cartographicToCartesian(viewportCenterCartographic, new Vector3());
5344
+ const viewportCenterCartesian = worldToCartesian(viewport, viewport.center);
4998
5345
  const enuToFixedTransform = Ellipsoid.WGS84.eastNorthUpToFixedFrame(viewportCenterCartesian);
4999
5346
  const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);
5000
- const cameraPositionCartesian = Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, new Vector3());
5347
+ const cameraPositionCartesian2 = Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, new Vector3());
5001
5348
  const cameraDirectionCartesian = new Vector3(enuToFixedTransform.transformAsVector(new Vector3(cameraDirection).scale(metersPerUnit))).normalize();
5002
5349
  const cameraUpCartesian = new Vector3(enuToFixedTransform.transformAsVector(new Vector3(cameraUp).scale(metersPerUnit))).normalize();
5003
- commonSpacePlanesToWGS84(viewport, viewportCenterCartesian);
5350
+ commonSpacePlanesToWGS84(viewport);
5351
+ const ViewportClass = viewport.constructor;
5352
+ const { longitude, latitude, width, bearing, zoom } = viewport;
5353
+ const topDownViewport = new ViewportClass({
5354
+ longitude,
5355
+ latitude,
5356
+ height,
5357
+ width,
5358
+ bearing,
5359
+ zoom,
5360
+ pitch: 0
5361
+ });
5004
5362
  return {
5005
5363
  camera: {
5006
- position: cameraPositionCartesian,
5364
+ position: cameraPositionCartesian2,
5007
5365
  direction: cameraDirectionCartesian,
5008
5366
  up: cameraUpCartesian
5009
5367
  },
5010
5368
  viewport,
5369
+ topDownViewport,
5011
5370
  height,
5012
5371
  cullingVolume,
5013
5372
  frameNumber,
5014
5373
  sseDenominator: 1.15
5015
5374
  };
5016
5375
  }
5017
- function commonSpacePlanesToWGS84(viewport, viewportCenterCartesian) {
5376
+ function limitSelectedTiles(tiles, frameState, maximumTilesSelected) {
5377
+ if (maximumTilesSelected === 0 || tiles.length <= maximumTilesSelected) {
5378
+ return [tiles, []];
5379
+ }
5380
+ const tuples = [];
5381
+ const { longitude: viewportLongitude, latitude: viewportLatitude } = frameState.viewport;
5382
+ for (const [index, tile] of tiles.entries()) {
5383
+ const [longitude, latitude] = tile.header.mbs;
5384
+ const deltaLon = Math.abs(viewportLongitude - longitude);
5385
+ const deltaLat = Math.abs(viewportLatitude - latitude);
5386
+ const distance = Math.sqrt(deltaLat * deltaLat + deltaLon * deltaLon);
5387
+ tuples.push([index, distance]);
5388
+ }
5389
+ const tuplesSorted = tuples.sort((a, b) => a[1] - b[1]);
5390
+ const selectedTiles = [];
5391
+ for (let i = 0; i < maximumTilesSelected; i++) {
5392
+ selectedTiles.push(tiles[tuplesSorted[i][0]]);
5393
+ }
5394
+ const unselectedTiles = [];
5395
+ for (let i = maximumTilesSelected; i < tuplesSorted.length; i++) {
5396
+ unselectedTiles.push(tiles[tuplesSorted[i][0]]);
5397
+ }
5398
+ return [selectedTiles, unselectedTiles];
5399
+ }
5400
+ function commonSpacePlanesToWGS84(viewport) {
5018
5401
  const frustumPlanes = viewport.getFrustumPlanes();
5402
+ const nearCenterCommon = closestPointOnPlane(frustumPlanes.near, viewport.cameraPosition);
5403
+ const nearCenterCartesian = worldToCartesian(viewport, nearCenterCommon);
5404
+ const cameraCartesian = worldToCartesian(viewport, viewport.cameraPosition, scratchPosition3);
5019
5405
  let i = 0;
5406
+ cullingVolume.planes[i++].fromPointNormal(nearCenterCartesian, scratchVector7.copy(nearCenterCartesian).subtract(cameraCartesian));
5020
5407
  for (const dir in frustumPlanes) {
5408
+ if (dir === "near") {
5409
+ continue;
5410
+ }
5021
5411
  const plane = frustumPlanes[dir];
5022
- const distanceToCenter = plane.normal.dot(viewport.center);
5023
- scratchPosition3.copy(plane.normal).scale(plane.distance - distanceToCenter).add(viewport.center);
5024
- const cartographicPos = viewport.unprojectPosition(scratchPosition3);
5025
- const cartesianPos = Ellipsoid.WGS84.cartographicToCartesian(cartographicPos, new Vector3());
5026
- cullingVolume.planes[i++].fromPointNormal(cartesianPos, scratchVector7.copy(viewportCenterCartesian).subtract(cartesianPos));
5412
+ const posCommon = closestPointOnPlane(plane, nearCenterCommon, scratchPosition3);
5413
+ const cartesianPos = worldToCartesian(viewport, posCommon, scratchPosition3);
5414
+ cullingVolume.planes[i++].fromPointNormal(cartesianPos, scratchVector7.copy(nearCenterCartesian).subtract(cartesianPos));
5027
5415
  }
5028
5416
  }
5417
+ function closestPointOnPlane(plane, refPoint, out = new Vector3()) {
5418
+ const distanceToRef = plane.normal.dot(refPoint);
5419
+ out.copy(plane.normal).scale(plane.distance - distanceToRef).add(refPoint);
5420
+ return out;
5421
+ }
5422
+ function worldToCartesian(viewport, point, out = new Vector3()) {
5423
+ const cartographicPos = viewport.unprojectPosition(point);
5424
+ return Ellipsoid.WGS84.cartographicToCartesian(cartographicPos, out);
5425
+ }
5029
5426
  var scratchVector7, scratchPosition3, cullingVolume;
5030
5427
  var init_frame_state = __esm({
5031
5428
  "src/tileset/helpers/frame-state.ts"() {
5032
5429
  init_esm();
5033
- init_esm4();
5430
+ init_esm3();
5034
5431
  init_esm2();
5035
5432
  scratchVector7 = new Vector3();
5036
5433
  scratchPosition3 = new Vector3();
@@ -5046,20 +5443,31 @@
5046
5443
  });
5047
5444
 
5048
5445
  // src/tileset/helpers/zoom.ts
5049
- function getZoomFromBoundingVolume(boundingVolume) {
5050
- const { halfAxes, radius, width, height } = boundingVolume;
5051
- if (halfAxes) {
5446
+ function getZoomFromBoundingVolume(boundingVolume, cartorgraphicCenter) {
5447
+ if (boundingVolume instanceof OrientedBoundingBox) {
5448
+ const { halfAxes } = boundingVolume;
5052
5449
  const obbSize = getObbSize(halfAxes);
5053
- return Math.log2(WGS84_RADIUS_Z2 / obbSize);
5054
- } else if (radius) {
5055
- return Math.log2(WGS84_RADIUS_Z2 / radius);
5056
- } else if (height && width) {
5450
+ return Math.log2(WGS84_RADIUS_Z2 / (obbSize + cartorgraphicCenter[2]));
5451
+ } else if (boundingVolume instanceof BoundingSphere) {
5452
+ const { radius } = boundingVolume;
5453
+ return Math.log2(WGS84_RADIUS_Z2 / (radius + cartorgraphicCenter[2]));
5454
+ } else if (boundingVolume.width && boundingVolume.height) {
5455
+ const { width, height } = boundingVolume;
5057
5456
  const zoomX = Math.log2(WGS84_RADIUS_X2 / width);
5058
5457
  const zoomY = Math.log2(WGS84_RADIUS_Y2 / height);
5059
5458
  return (zoomX + zoomY) / 2;
5060
5459
  }
5061
5460
  return 1;
5062
5461
  }
5462
+ function getZoomFromFullExtent(fullExtent, cartorgraphicCenter, cartesianCenter) {
5463
+ const extentVertex = Ellipsoid.WGS84.cartographicToCartesian([fullExtent.xmax, fullExtent.ymax, fullExtent.zmax], new Vector3());
5464
+ const extentSize = Math.sqrt(Math.pow(extentVertex[0] - cartesianCenter[0], 2) + Math.pow(extentVertex[1] - cartesianCenter[1], 2) + Math.pow(extentVertex[2] - cartesianCenter[2], 2));
5465
+ return Math.log2(WGS84_RADIUS_Z2 / (extentSize + cartorgraphicCenter[2]));
5466
+ }
5467
+ function getZoomFromExtent(extent, cartorgraphicCenter, cartesianCenter) {
5468
+ const [xmin, ymin, xmax, ymax] = extent;
5469
+ return getZoomFromFullExtent({ xmin, xmax, ymin, ymax, zmin: 0, zmax: 0 }, cartorgraphicCenter, cartesianCenter);
5470
+ }
5063
5471
  function getObbSize(halfAxes) {
5064
5472
  halfAxes.getColumn(0, scratchVector8);
5065
5473
  const axeY = halfAxes.getColumn(1);
@@ -5072,6 +5480,8 @@
5072
5480
  var init_zoom = __esm({
5073
5481
  "src/tileset/helpers/zoom.ts"() {
5074
5482
  init_esm();
5483
+ init_esm3();
5484
+ init_esm2();
5075
5485
  WGS84_RADIUS_X2 = 6378137;
5076
5486
  WGS84_RADIUS_Y2 = 6378137;
5077
5487
  WGS84_RADIUS_Z2 = 6356752314245179e-9;
@@ -5218,7 +5628,7 @@
5218
5628
  text += ` ${await response.text()}`;
5219
5629
  }
5220
5630
  message += text;
5221
- message = message.length > 60 ? `${message.slice(60)}...` : message;
5631
+ message = message.length > 60 ? `${message.slice(0, 60)}...` : message;
5222
5632
  } catch (error) {
5223
5633
  }
5224
5634
  return message;
@@ -5230,9 +5640,9 @@
5230
5640
  }
5231
5641
  if (resource instanceof Blob) {
5232
5642
  const blobSlice = resource.slice(0, 5);
5233
- return await new Promise((resolve) => {
5643
+ return await new Promise((resolve2) => {
5234
5644
  const reader = new FileReader();
5235
- reader.onload = (event) => resolve(event?.target?.result);
5645
+ reader.onload = (event) => resolve2(event?.target?.result);
5236
5646
  reader.readAsDataURL(blobSlice);
5237
5647
  });
5238
5648
  }
@@ -5277,12 +5687,12 @@
5277
5687
  }
5278
5688
  });
5279
5689
 
5280
- // ../../node_modules/probe.gl/dist/esm/env/is-electron.js
5690
+ // ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
5281
5691
  function isElectron(mockUserAgent) {
5282
5692
  if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
5283
5693
  return true;
5284
5694
  }
5285
- if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
5695
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
5286
5696
  return true;
5287
5697
  }
5288
5698
  const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
@@ -5293,52 +5703,54 @@
5293
5703
  return false;
5294
5704
  }
5295
5705
  var init_is_electron = __esm({
5296
- "../../node_modules/probe.gl/dist/esm/env/is-electron.js"() {
5706
+ "../../node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
5297
5707
  }
5298
5708
  });
5299
5709
 
5300
- // ../../node_modules/probe.gl/dist/esm/env/is-browser.js
5710
+ // ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
5301
5711
  function isBrowser3() {
5302
5712
  const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
5303
5713
  return !isNode || isElectron();
5304
5714
  }
5305
5715
  var init_is_browser = __esm({
5306
- "../../node_modules/probe.gl/dist/esm/env/is-browser.js"() {
5716
+ "../../node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
5307
5717
  init_is_electron();
5308
5718
  }
5309
5719
  });
5310
5720
 
5311
- // ../../node_modules/probe.gl/dist/esm/env/globals.js
5312
- var globals4, self_3, window_3, global_4, document_3, process_;
5721
+ // ../../node_modules/@probe.gl/env/dist/lib/globals.js
5722
+ var self_3, window_3, document_3, process_, console_, navigator_;
5313
5723
  var init_globals3 = __esm({
5314
- "../../node_modules/probe.gl/dist/esm/env/globals.js"() {
5315
- globals4 = {
5316
- self: typeof self !== "undefined" && self,
5317
- window: typeof window !== "undefined" && window,
5318
- global: typeof global !== "undefined" && global,
5319
- document: typeof document !== "undefined" && document,
5320
- process: typeof process === "object" && process
5321
- };
5322
- self_3 = globals4.self || globals4.window || globals4.global;
5323
- window_3 = globals4.window || globals4.self || globals4.global;
5324
- global_4 = globals4.global || globals4.self || globals4.window;
5325
- document_3 = globals4.document || {};
5326
- process_ = globals4.process || {};
5724
+ "../../node_modules/@probe.gl/env/dist/lib/globals.js"() {
5725
+ self_3 = globalThis.self || globalThis.window || globalThis.global;
5726
+ window_3 = globalThis.window || globalThis.self || globalThis.global;
5727
+ document_3 = globalThis.document || {};
5728
+ process_ = globalThis.process || {};
5729
+ console_ = globalThis.console;
5730
+ navigator_ = globalThis.navigator || {};
5327
5731
  }
5328
5732
  });
5329
5733
 
5330
- // ../../node_modules/probe.gl/dist/esm/utils/globals.js
5734
+ // ../../node_modules/@probe.gl/env/dist/utils/globals.js
5331
5735
  var VERSION2, isBrowser4;
5332
5736
  var init_globals4 = __esm({
5333
- "../../node_modules/probe.gl/dist/esm/utils/globals.js"() {
5737
+ "../../node_modules/@probe.gl/env/dist/utils/globals.js"() {
5334
5738
  init_is_browser();
5335
- init_globals3();
5336
5739
  VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
5337
5740
  isBrowser4 = isBrowser3();
5338
5741
  }
5339
5742
  });
5340
5743
 
5341
- // ../../node_modules/probe.gl/dist/esm/utils/local-storage.js
5744
+ // ../../node_modules/@probe.gl/env/dist/index.js
5745
+ var init_dist2 = __esm({
5746
+ "../../node_modules/@probe.gl/env/dist/index.js"() {
5747
+ init_globals4();
5748
+ init_globals3();
5749
+ init_is_browser();
5750
+ }
5751
+ });
5752
+
5753
+ // ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
5342
5754
  function getStorage(type) {
5343
5755
  try {
5344
5756
  const storage = window[type];
@@ -5352,29 +5764,28 @@
5352
5764
  }
5353
5765
  var LocalStorage;
5354
5766
  var init_local_storage = __esm({
5355
- "../../node_modules/probe.gl/dist/esm/utils/local-storage.js"() {
5767
+ "../../node_modules/@probe.gl/log/dist/utils/local-storage.js"() {
5768
+ init_defineProperty();
5356
5769
  LocalStorage = class {
5357
- constructor(id, defaultSettings, type = "sessionStorage") {
5770
+ constructor(id, defaultConfig) {
5771
+ let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
5772
+ _defineProperty(this, "storage", void 0);
5773
+ _defineProperty(this, "id", void 0);
5774
+ _defineProperty(this, "config", void 0);
5358
5775
  this.storage = getStorage(type);
5359
5776
  this.id = id;
5360
- this.config = {};
5361
- Object.assign(this.config, defaultSettings);
5777
+ this.config = defaultConfig;
5362
5778
  this._loadConfiguration();
5363
5779
  }
5364
5780
  getConfiguration() {
5365
5781
  return this.config;
5366
5782
  }
5367
5783
  setConfiguration(configuration) {
5368
- this.config = {};
5369
- return this.updateConfiguration(configuration);
5370
- }
5371
- updateConfiguration(configuration) {
5372
5784
  Object.assign(this.config, configuration);
5373
5785
  if (this.storage) {
5374
5786
  const serialized = JSON.stringify(this.config);
5375
5787
  this.storage.setItem(this.id, serialized);
5376
5788
  }
5377
- return this;
5378
5789
  }
5379
5790
  _loadConfiguration() {
5380
5791
  let configuration = {};
@@ -5389,7 +5800,7 @@
5389
5800
  }
5390
5801
  });
5391
5802
 
5392
- // ../../node_modules/probe.gl/dist/esm/utils/formatters.js
5803
+ // ../../node_modules/@probe.gl/log/dist/utils/formatters.js
5393
5804
  function formatTime(ms) {
5394
5805
  let formatted;
5395
5806
  if (ms < 10) {
@@ -5403,11 +5814,13 @@
5403
5814
  }
5404
5815
  return formatted;
5405
5816
  }
5406
- function leftPad(string, length4 = 8) {
5817
+ function leftPad(string) {
5818
+ let length4 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
5407
5819
  const padLength = Math.max(length4 - string.length, 0);
5408
5820
  return "".concat(" ".repeat(padLength)).concat(string);
5409
5821
  }
5410
- function formatImage(image, message, scale5, maxWidth = 600) {
5822
+ function formatImage(image, message, scale5) {
5823
+ let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
5411
5824
  const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
5412
5825
  if (image.width > maxWidth) {
5413
5826
  scale5 = Math.min(scale5, maxWidth / image.width);
@@ -5418,87 +5831,97 @@
5418
5831
  return ["".concat(message, " %c+"), style];
5419
5832
  }
5420
5833
  var init_formatters = __esm({
5421
- "../../node_modules/probe.gl/dist/esm/utils/formatters.js"() {
5834
+ "../../node_modules/@probe.gl/log/dist/utils/formatters.js"() {
5422
5835
  }
5423
5836
  });
5424
5837
 
5425
- // ../../node_modules/probe.gl/dist/esm/utils/color.js
5838
+ // ../../node_modules/@probe.gl/log/dist/utils/color.js
5426
5839
  function getColor(color) {
5427
- return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
5840
+ if (typeof color !== "string") {
5841
+ return color;
5842
+ }
5843
+ color = color.toUpperCase();
5844
+ return COLOR[color] || COLOR.WHITE;
5428
5845
  }
5429
5846
  function addColor(string, color, background) {
5430
- if (!isBrowser4 && typeof string === "string") {
5847
+ if (!isBrowser3 && typeof string === "string") {
5431
5848
  if (color) {
5432
- color = getColor(color);
5433
- string = "[".concat(color, "m").concat(string, "");
5849
+ const colorCode = getColor(color);
5850
+ string = "[".concat(colorCode, "m").concat(string, "");
5434
5851
  }
5435
5852
  if (background) {
5436
- color = getColor(background);
5437
- string = "[".concat(background + 10, "m").concat(string, "");
5853
+ const colorCode = getColor(background);
5854
+ string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "");
5438
5855
  }
5439
5856
  }
5440
5857
  return string;
5441
5858
  }
5442
- var COLOR;
5859
+ var COLOR, BACKGROUND_INCREMENT;
5443
5860
  var init_color = __esm({
5444
- "../../node_modules/probe.gl/dist/esm/utils/color.js"() {
5445
- init_globals4();
5446
- COLOR = {
5447
- BLACK: 30,
5448
- RED: 31,
5449
- GREEN: 32,
5450
- YELLOW: 33,
5451
- BLUE: 34,
5452
- MAGENTA: 35,
5453
- CYAN: 36,
5454
- WHITE: 37,
5455
- BRIGHT_BLACK: 90,
5456
- BRIGHT_RED: 91,
5457
- BRIGHT_GREEN: 92,
5458
- BRIGHT_YELLOW: 93,
5459
- BRIGHT_BLUE: 94,
5460
- BRIGHT_MAGENTA: 95,
5461
- BRIGHT_CYAN: 96,
5462
- BRIGHT_WHITE: 97
5463
- };
5861
+ "../../node_modules/@probe.gl/log/dist/utils/color.js"() {
5862
+ init_dist2();
5863
+ (function(COLOR2) {
5864
+ COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
5865
+ COLOR2[COLOR2["RED"] = 31] = "RED";
5866
+ COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
5867
+ COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
5868
+ COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
5869
+ COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
5870
+ COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
5871
+ COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
5872
+ COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
5873
+ COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
5874
+ COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
5875
+ COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
5876
+ COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
5877
+ COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
5878
+ COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
5879
+ COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
5880
+ })(COLOR || (COLOR = {}));
5881
+ BACKGROUND_INCREMENT = 10;
5464
5882
  }
5465
5883
  });
5466
5884
 
5467
- // ../../node_modules/probe.gl/dist/esm/utils/autobind.js
5468
- function autobind(obj, predefined = ["constructor"]) {
5885
+ // ../../node_modules/@probe.gl/log/dist/utils/autobind.js
5886
+ function autobind(obj) {
5887
+ let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
5469
5888
  const proto = Object.getPrototypeOf(obj);
5470
5889
  const propNames = Object.getOwnPropertyNames(proto);
5890
+ const object = obj;
5471
5891
  for (const key of propNames) {
5472
- if (typeof obj[key] === "function") {
5892
+ const value = object[key];
5893
+ if (typeof value === "function") {
5473
5894
  if (!predefined.find((name) => key === name)) {
5474
- obj[key] = obj[key].bind(obj);
5895
+ object[key] = value.bind(obj);
5475
5896
  }
5476
5897
  }
5477
5898
  }
5478
5899
  }
5479
5900
  var init_autobind = __esm({
5480
- "../../node_modules/probe.gl/dist/esm/utils/autobind.js"() {
5901
+ "../../node_modules/@probe.gl/log/dist/utils/autobind.js"() {
5481
5902
  }
5482
5903
  });
5483
5904
 
5484
- // ../../node_modules/probe.gl/dist/esm/utils/assert.js
5905
+ // ../../node_modules/@probe.gl/log/dist/utils/assert.js
5485
5906
  function assert4(condition, message) {
5486
5907
  if (!condition) {
5487
5908
  throw new Error(message || "Assertion failed");
5488
5909
  }
5489
5910
  }
5490
5911
  var init_assert4 = __esm({
5491
- "../../node_modules/probe.gl/dist/esm/utils/assert.js"() {
5912
+ "../../node_modules/@probe.gl/log/dist/utils/assert.js"() {
5492
5913
  }
5493
5914
  });
5494
5915
 
5495
- // ../../node_modules/probe.gl/dist/esm/utils/hi-res-timestamp.js
5916
+ // ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
5496
5917
  function getHiResTimestamp2() {
5497
5918
  let timestamp;
5498
- if (isBrowser4 && window_3.performance) {
5499
- timestamp = window_3.performance.now();
5500
- } else if (process_.hrtime) {
5501
- const timeParts = process_.hrtime();
5919
+ if (isBrowser3() && window_3.performance) {
5920
+ var _window$performance, _window$performance$n;
5921
+ timestamp = window_3 === null || window_3 === void 0 ? void 0 : (_window$performance = window_3.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
5922
+ } else if ("hrtime" in process_) {
5923
+ var _process$hrtime;
5924
+ const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
5502
5925
  timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
5503
5926
  } else {
5504
5927
  timestamp = Date.now();
@@ -5506,21 +5929,13 @@
5506
5929
  return timestamp;
5507
5930
  }
5508
5931
  var init_hi_res_timestamp2 = __esm({
5509
- "../../node_modules/probe.gl/dist/esm/utils/hi-res-timestamp.js"() {
5510
- init_globals4();
5932
+ "../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js"() {
5933
+ init_dist2();
5511
5934
  }
5512
5935
  });
5513
5936
 
5514
- // ../../node_modules/probe.gl/dist/esm/lib/log.js
5515
- function noop2() {
5516
- }
5517
- function getTableHeader(table) {
5518
- for (const key in table) {
5519
- for (const title in table[key]) {
5520
- return title || "untitled";
5521
- }
5522
- }
5523
- return "empty";
5937
+ // ../../node_modules/@probe.gl/log/dist/log.js
5938
+ function noop() {
5524
5939
  }
5525
5940
  function normalizeLogLevel(logLevel) {
5526
5941
  if (!logLevel) {
@@ -5549,7 +5964,6 @@
5549
5964
  const args = opts.args ? Array.from(opts.args) : [];
5550
5965
  while (args.length && args.shift() !== message) {
5551
5966
  }
5552
- opts.args = args;
5553
5967
  switch (typeof logLevel) {
5554
5968
  case "string":
5555
5969
  case "function":
@@ -5568,7 +5982,9 @@
5568
5982
  }
5569
5983
  const messageType = typeof opts.message;
5570
5984
  assert4(messageType === "string" || messageType === "object");
5571
- return Object.assign(opts, opts.opts);
5985
+ return Object.assign(opts, {
5986
+ args
5987
+ }, opts.opts);
5572
5988
  }
5573
5989
  function decorateMessage(id, message, opts) {
5574
5990
  if (typeof message === "string") {
@@ -5578,29 +5994,21 @@
5578
5994
  }
5579
5995
  return message;
5580
5996
  }
5581
- function logImageInNode({
5582
- image,
5583
- message = "",
5584
- scale: scale5 = 1
5585
- }) {
5586
- let asciify = null;
5587
- try {
5588
- asciify = module.require("asciify-image");
5589
- } catch (error) {
5590
- }
5591
- if (asciify) {
5592
- return () => asciify(image, {
5593
- fit: "box",
5594
- width: "".concat(Math.round(80 * scale5), "%")
5595
- }).then((data) => console.log(data));
5596
- }
5597
- return noop2;
5598
- }
5599
- function logImageInBrowser({
5600
- image,
5601
- message = "",
5602
- scale: scale5 = 1
5603
- }) {
5997
+ function logImageInNode(_ref2) {
5998
+ let {
5999
+ image,
6000
+ message = "",
6001
+ scale: scale5 = 1
6002
+ } = _ref2;
6003
+ console.warn("removed");
6004
+ return noop;
6005
+ }
6006
+ function logImageInBrowser(_ref3) {
6007
+ let {
6008
+ image,
6009
+ message = "",
6010
+ scale: scale5 = 1
6011
+ } = _ref3;
5604
6012
  if (typeof image === "string") {
5605
6013
  const img = new Image();
5606
6014
  img.onload = () => {
@@ -5608,25 +6016,34 @@
5608
6016
  console.log(...args);
5609
6017
  };
5610
6018
  img.src = image;
5611
- return noop2;
6019
+ return noop;
5612
6020
  }
5613
6021
  const element = image.nodeName || "";
5614
6022
  if (element.toLowerCase() === "img") {
5615
6023
  console.log(...formatImage(image, message, scale5));
5616
- return noop2;
6024
+ return noop;
5617
6025
  }
5618
6026
  if (element.toLowerCase() === "canvas") {
5619
6027
  const img = new Image();
5620
6028
  img.onload = () => console.log(...formatImage(img, message, scale5));
5621
6029
  img.src = image.toDataURL();
5622
- return noop2;
6030
+ return noop;
6031
+ }
6032
+ return noop;
6033
+ }
6034
+ function getTableHeader(table) {
6035
+ for (const key in table) {
6036
+ for (const title in table[key]) {
6037
+ return title || "untitled";
6038
+ }
5623
6039
  }
5624
- return noop2;
6040
+ return "empty";
5625
6041
  }
5626
- var originalConsole, DEFAULT_SETTINGS, cache, ONCE, Log;
6042
+ var originalConsole, DEFAULT_LOG_CONFIGURATION, cache, ONCE, Log;
5627
6043
  var init_log = __esm({
5628
- "../../node_modules/probe.gl/dist/esm/lib/log.js"() {
5629
- init_globals4();
6044
+ "../../node_modules/@probe.gl/log/dist/log.js"() {
6045
+ init_defineProperty();
6046
+ init_dist2();
5630
6047
  init_local_storage();
5631
6048
  init_formatters();
5632
6049
  init_color();
@@ -5634,13 +6051,13 @@
5634
6051
  init_assert4();
5635
6052
  init_hi_res_timestamp2();
5636
6053
  originalConsole = {
5637
- debug: isBrowser4 ? console.debug || console.log : console.log,
6054
+ debug: isBrowser3() ? console.debug || console.log : console.log,
5638
6055
  log: console.log,
5639
6056
  info: console.info,
5640
6057
  warn: console.warn,
5641
6058
  error: console.error
5642
6059
  };
5643
- DEFAULT_SETTINGS = {
6060
+ DEFAULT_LOG_CONFIGURATION = {
5644
6061
  enabled: true,
5645
6062
  level: 0
5646
6063
  };
@@ -5649,18 +6066,22 @@
5649
6066
  once: true
5650
6067
  };
5651
6068
  Log = class {
5652
- constructor({
5653
- id
5654
- } = {
5655
- id: ""
5656
- }) {
6069
+ constructor() {
6070
+ let {
6071
+ id
6072
+ } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
6073
+ id: ""
6074
+ };
6075
+ _defineProperty(this, "id", void 0);
6076
+ _defineProperty(this, "VERSION", VERSION2);
6077
+ _defineProperty(this, "_startTs", getHiResTimestamp2());
6078
+ _defineProperty(this, "_deltaTs", getHiResTimestamp2());
6079
+ _defineProperty(this, "_storage", void 0);
6080
+ _defineProperty(this, "userData", {});
6081
+ _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
5657
6082
  this.id = id;
5658
- this.VERSION = VERSION2;
5659
- this._startTs = getHiResTimestamp2();
5660
- this._deltaTs = getHiResTimestamp2();
5661
- this.LOG_THROTTLE_TIMEOUT = 0;
5662
- this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
5663
6083
  this.userData = {};
6084
+ this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
5664
6085
  this.timeStamp("".concat(this.id, " started"));
5665
6086
  autobind(this);
5666
6087
  Object.seal(this);
@@ -5692,18 +6113,34 @@
5692
6113
  getPriority() {
5693
6114
  return this.level;
5694
6115
  }
5695
- enable(enabled = true) {
5696
- this._storage.updateConfiguration({
6116
+ enable() {
6117
+ let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
6118
+ this._storage.setConfiguration({
5697
6119
  enabled
5698
6120
  });
5699
6121
  return this;
5700
6122
  }
5701
6123
  setLevel(level) {
5702
- this._storage.updateConfiguration({
6124
+ this._storage.setConfiguration({
5703
6125
  level
5704
6126
  });
5705
6127
  return this;
5706
6128
  }
6129
+ get(setting) {
6130
+ return this._storage.config[setting];
6131
+ }
6132
+ set(setting, value) {
6133
+ this._storage.setConfiguration({
6134
+ [setting]: value
6135
+ });
6136
+ }
6137
+ settings() {
6138
+ if (console.table) {
6139
+ console.table(this._storage.config);
6140
+ } else {
6141
+ console.log(this._storage.config);
6142
+ }
6143
+ }
5707
6144
  assert(condition, message) {
5708
6145
  assert4(condition, message);
5709
6146
  }
@@ -5736,23 +6173,24 @@
5736
6173
  }
5737
6174
  table(logLevel, table, columns) {
5738
6175
  if (table) {
5739
- return this._getLogFunction(logLevel, table, console.table || noop2, columns && [columns], {
6176
+ return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
5740
6177
  tag: getTableHeader(table)
5741
6178
  });
5742
6179
  }
5743
- return noop2;
6180
+ return noop;
5744
6181
  }
5745
- image({
5746
- logLevel,
5747
- priority,
5748
- image,
5749
- message = "",
5750
- scale: scale5 = 1
5751
- }) {
6182
+ image(_ref) {
6183
+ let {
6184
+ logLevel,
6185
+ priority,
6186
+ image,
6187
+ message = "",
6188
+ scale: scale5 = 1
6189
+ } = _ref;
5752
6190
  if (!this._shouldLog(logLevel || priority)) {
5753
- return noop2;
6191
+ return noop;
5754
6192
  }
5755
- return isBrowser4 ? logImageInBrowser({
6193
+ return isBrowser3() ? logImageInBrowser({
5756
6194
  image,
5757
6195
  message,
5758
6196
  scale: scale5
@@ -5762,21 +6200,6 @@
5762
6200
  scale: scale5
5763
6201
  });
5764
6202
  }
5765
- settings() {
5766
- if (console.table) {
5767
- console.table(this._storage.config);
5768
- } else {
5769
- console.log(this._storage.config);
5770
- }
5771
- }
5772
- get(setting) {
5773
- return this._storage.config[setting];
5774
- }
5775
- set(setting, value) {
5776
- this._storage.updateConfiguration({
5777
- [setting]: value
5778
- });
5779
- }
5780
6203
  time(logLevel, message) {
5781
6204
  return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
5782
6205
  }
@@ -5784,12 +6207,13 @@
5784
6207
  return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
5785
6208
  }
5786
6209
  timeStamp(logLevel, message) {
5787
- return this._getLogFunction(logLevel, message, console.timeStamp || noop2);
6210
+ return this._getLogFunction(logLevel, message, console.timeStamp || noop);
5788
6211
  }
5789
- group(logLevel, message, opts = {
5790
- collapsed: false
5791
- }) {
5792
- opts = normalizeArguments({
6212
+ group(logLevel, message) {
6213
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
6214
+ collapsed: false
6215
+ };
6216
+ const options = normalizeArguments({
5793
6217
  logLevel,
5794
6218
  message,
5795
6219
  opts
@@ -5797,16 +6221,17 @@
5797
6221
  const {
5798
6222
  collapsed
5799
6223
  } = opts;
5800
- opts.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
5801
- return this._getLogFunction(opts);
6224
+ options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
6225
+ return this._getLogFunction(options);
5802
6226
  }
5803
- groupCollapsed(logLevel, message, opts = {}) {
6227
+ groupCollapsed(logLevel, message) {
6228
+ let opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
5804
6229
  return this.group(logLevel, message, Object.assign({}, opts, {
5805
6230
  collapsed: true
5806
6231
  }));
5807
6232
  }
5808
6233
  groupEnd(logLevel) {
5809
- return this._getLogFunction(logLevel, "", console.groupEnd || noop2);
6234
+ return this._getLogFunction(logLevel, "", console.groupEnd || noop);
5810
6235
  }
5811
6236
  withGroup(logLevel, message, func) {
5812
6237
  this.group(logLevel, message)();
@@ -5824,7 +6249,7 @@
5824
6249
  _shouldLog(logLevel) {
5825
6250
  return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
5826
6251
  }
5827
- _getLogFunction(logLevel, message, method, args = [], opts) {
6252
+ _getLogFunction(logLevel, message, method, args, opts) {
5828
6253
  if (this._shouldLog(logLevel)) {
5829
6254
  opts = normalizeArguments({
5830
6255
  logLevel,
@@ -5838,61 +6263,31 @@
5838
6263
  opts.delta = this.getDelta();
5839
6264
  this._deltaTs = getHiResTimestamp2();
5840
6265
  const tag = opts.tag || opts.message;
5841
- if (opts.once) {
6266
+ if (opts.once && tag) {
5842
6267
  if (!cache[tag]) {
5843
6268
  cache[tag] = getHiResTimestamp2();
5844
6269
  } else {
5845
- return noop2;
6270
+ return noop;
5846
6271
  }
5847
6272
  }
5848
6273
  message = decorateMessage(this.id, opts.message, opts);
5849
6274
  return method.bind(console, message, ...opts.args);
5850
6275
  }
5851
- return noop2;
6276
+ return noop;
5852
6277
  }
5853
6278
  };
5854
- Log.VERSION = VERSION2;
5855
- }
5856
- });
5857
-
5858
- // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js
5859
- var init_hi_res_timestamp3 = __esm({
5860
- "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/utils/hi-res-timestamp.js"() {
5861
- }
5862
- });
5863
-
5864
- // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js
5865
- var init_stat2 = __esm({
5866
- "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stat.js"() {
5867
- init_hi_res_timestamp3();
5868
- }
5869
- });
5870
-
5871
- // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js
5872
- var init_stats2 = __esm({
5873
- "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/lib/stats.js"() {
5874
- init_stat2();
5875
- }
5876
- });
5877
-
5878
- // ../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js
5879
- var init_esm5 = __esm({
5880
- "../../node_modules/probe.gl/node_modules/@probe.gl/stats/dist/esm/index.js"() {
5881
- init_stats2();
5882
- init_stat2();
5883
- init_hi_res_timestamp3();
6279
+ _defineProperty(Log, "VERSION", VERSION2);
5884
6280
  }
5885
6281
  });
5886
6282
 
5887
- // ../../node_modules/probe.gl/dist/esm/index.js
5888
- var esm_default;
5889
- var init_esm6 = __esm({
5890
- "../../node_modules/probe.gl/dist/esm/index.js"() {
6283
+ // ../../node_modules/@probe.gl/log/dist/index.js
6284
+ var dist_default;
6285
+ var init_dist3 = __esm({
6286
+ "../../node_modules/@probe.gl/log/dist/index.js"() {
5891
6287
  init_log();
5892
6288
  init_log();
5893
- init_esm5();
5894
- esm_default = new Log({
5895
- id: "probe.gl"
6289
+ dist_default = new Log({
6290
+ id: "@probe.gl/log"
5896
6291
  });
5897
6292
  }
5898
6293
  });
@@ -5901,7 +6296,7 @@
5901
6296
  var probeLog, NullLog, ConsoleLog;
5902
6297
  var init_loggers = __esm({
5903
6298
  "../core/src/lib/loader-utils/loggers.ts"() {
5904
- init_esm6();
6299
+ init_dist3();
5905
6300
  probeLog = new Log({ id: "loaders.gl" });
5906
6301
  NullLog = class {
5907
6302
  log() {
@@ -5945,6 +6340,7 @@
5945
6340
  var DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS;
5946
6341
  var init_option_defaults = __esm({
5947
6342
  "../core/src/lib/loader-utils/option-defaults.ts"() {
6343
+ init_src2();
5948
6344
  init_loggers();
5949
6345
  DEFAULT_LOADER_OPTIONS = {
5950
6346
  fetch: null,
@@ -5955,7 +6351,8 @@
5955
6351
  worker: true,
5956
6352
  maxConcurrency: 3,
5957
6353
  maxMobileConcurrency: 1,
5958
- reuseWorkers: true,
6354
+ reuseWorkers: isBrowser,
6355
+ _nodeWorkers: false,
5959
6356
  _workerType: "",
5960
6357
  limit: 0,
5961
6358
  _limitMB: 0,
@@ -5997,20 +6394,6 @@
5997
6394
  validateOptions(options, loaders);
5998
6395
  return normalizeOptionsInternal(loader, options, url);
5999
6396
  }
6000
- function getFetchFunction(options, context) {
6001
- const globalOptions = getGlobalLoaderOptions();
6002
- const fetchOptions = options || globalOptions;
6003
- if (typeof fetchOptions.fetch === "function") {
6004
- return fetchOptions.fetch;
6005
- }
6006
- if (isObject(fetchOptions.fetch)) {
6007
- return (url) => fetchFile(url, fetchOptions);
6008
- }
6009
- if (context?.fetch) {
6010
- return context?.fetch;
6011
- }
6012
- return fetchFile;
6013
- }
6014
6397
  function validateOptions(options, loaders) {
6015
6398
  validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
6016
6399
  for (const loader of loaders) {
@@ -6089,7 +6472,6 @@
6089
6472
  var init_option_utils = __esm({
6090
6473
  "../core/src/lib/loader-utils/option-utils.ts"() {
6091
6474
  init_is_type();
6092
- init_fetch_file();
6093
6475
  init_loggers();
6094
6476
  init_option_defaults();
6095
6477
  getGlobalLoaderOptions = () => {
@@ -6153,6 +6535,15 @@
6153
6535
  }
6154
6536
  });
6155
6537
 
6538
+ // ../core/src/lib/utils/log.ts
6539
+ var log;
6540
+ var init_log2 = __esm({
6541
+ "../core/src/lib/utils/log.ts"() {
6542
+ init_dist3();
6543
+ log = new Log({ id: "loaders.gl" });
6544
+ }
6545
+ });
6546
+
6156
6547
  // ../core/src/lib/api/select-loader.ts
6157
6548
  async function selectLoader(data, loaders = [], options, context) {
6158
6549
  if (!validHTTPResponse(data)) {
@@ -6196,13 +6587,22 @@
6196
6587
  const { url, type } = getResourceUrlAndType(data);
6197
6588
  const testUrl = url || context?.url;
6198
6589
  let loader = null;
6590
+ let reason = "";
6199
6591
  if (options?.mimeType) {
6200
6592
  loader = findLoaderByMIMEType(loaders, options?.mimeType);
6593
+ reason = `match forced by supplied MIME type ${options?.mimeType}`;
6201
6594
  }
6202
6595
  loader = loader || findLoaderByUrl(loaders, testUrl);
6596
+ reason = reason || (loader ? `matched url ${testUrl}` : "");
6203
6597
  loader = loader || findLoaderByMIMEType(loaders, type);
6598
+ reason = reason || (loader ? `matched MIME type ${type}` : "");
6204
6599
  loader = loader || findLoaderByInitialBytes(loaders, data);
6600
+ reason = reason || (loader ? `matched initial data ${getFirstCharacters(data)}` : "");
6205
6601
  loader = loader || findLoaderByMIMEType(loaders, options?.fallbackMimeType);
6602
+ reason = reason || (loader ? `matched fallback MIME type ${type}` : "");
6603
+ if (reason) {
6604
+ log.log(1, `selectLoader selected ${loader?.name}: ${reason}.`);
6605
+ }
6206
6606
  return loader;
6207
6607
  }
6208
6608
  function validHTTPResponse(data) {
@@ -6329,6 +6729,7 @@
6329
6729
  "../core/src/lib/api/select-loader.ts"() {
6330
6730
  init_src2();
6331
6731
  init_normalize_loader();
6732
+ init_log2();
6332
6733
  init_resource_utils();
6333
6734
  init_register_loaders();
6334
6735
  init_is_type();
@@ -6411,7 +6812,7 @@
6411
6812
  if (done) {
6412
6813
  return;
6413
6814
  }
6414
- yield toArrayBuffer(value);
6815
+ yield toArrayBuffer2(value);
6415
6816
  }
6416
6817
  } catch (error) {
6417
6818
  reader.releaseLock();
@@ -6419,7 +6820,7 @@
6419
6820
  }
6420
6821
  async function* makeNodeStreamIterator(stream, options) {
6421
6822
  for await (const chunk of stream) {
6422
- yield toArrayBuffer(chunk);
6823
+ yield toArrayBuffer2(chunk);
6423
6824
  }
6424
6825
  }
6425
6826
  var init_make_stream_iterator = __esm({
@@ -6520,6 +6921,29 @@
6520
6921
  }
6521
6922
  });
6522
6923
 
6924
+ // ../core/src/lib/loader-utils/get-fetch-function.ts
6925
+ function getFetchFunction(options, context) {
6926
+ const globalOptions = getGlobalLoaderOptions();
6927
+ const fetchOptions = options || globalOptions;
6928
+ if (typeof fetchOptions.fetch === "function") {
6929
+ return fetchOptions.fetch;
6930
+ }
6931
+ if (isObject(fetchOptions.fetch)) {
6932
+ return (url) => fetchFile(url, fetchOptions);
6933
+ }
6934
+ if (context?.fetch) {
6935
+ return context?.fetch;
6936
+ }
6937
+ return fetchFile;
6938
+ }
6939
+ var init_get_fetch_function = __esm({
6940
+ "../core/src/lib/loader-utils/get-fetch-function.ts"() {
6941
+ init_is_type();
6942
+ init_fetch_file();
6943
+ init_option_utils();
6944
+ }
6945
+ });
6946
+
6523
6947
  // ../core/src/lib/loader-utils/loader-context.ts
6524
6948
  function getLoaderContext(context, options, previousContext = null) {
6525
6949
  if (previousContext) {
@@ -6550,7 +6974,7 @@
6550
6974
  }
6551
6975
  var init_loader_context = __esm({
6552
6976
  "../core/src/lib/loader-utils/loader-context.ts"() {
6553
- init_option_utils();
6977
+ init_get_fetch_function();
6554
6978
  }
6555
6979
  });
6556
6980
 
@@ -6577,6 +7001,12 @@
6577
7001
  }
6578
7002
  async function parseWithLoader(loader, data, options, context) {
6579
7003
  validateWorkerVersion(loader);
7004
+ if (isResponse(data)) {
7005
+ const response = data;
7006
+ const { ok, redirected, status, statusText, type, url } = response;
7007
+ const headers = Object.fromEntries(response.headers.entries());
7008
+ context.response = { headers, ok, redirected, status, statusText, type, url };
7009
+ }
6580
7010
  data = await getArrayBufferOrStringFromData(data, loader, options);
6581
7011
  if (loader.parseTextSync && typeof data === "string") {
6582
7012
  options.dataType = "text";
@@ -6599,6 +7029,7 @@
6599
7029
  init_src();
6600
7030
  init_src2();
6601
7031
  init_normalize_loader();
7032
+ init_is_type();
6602
7033
  init_option_utils();
6603
7034
  init_get_data();
6604
7035
  init_loader_context();
@@ -6609,12 +7040,17 @@
6609
7040
 
6610
7041
  // ../core/src/lib/api/load.ts
6611
7042
  async function load(url, loaders, options, context) {
7043
+ let resolvedLoaders;
7044
+ let resolvedOptions;
6612
7045
  if (!Array.isArray(loaders) && !isLoaderObject(loaders)) {
7046
+ resolvedLoaders = [];
7047
+ resolvedOptions = loaders;
6613
7048
  context = void 0;
6614
- options = loaders;
6615
- loaders = void 0;
7049
+ } else {
7050
+ resolvedLoaders = loaders;
7051
+ resolvedOptions = options;
6616
7052
  }
6617
- const fetch2 = getFetchFunction(options);
7053
+ const fetch2 = getFetchFunction(resolvedOptions);
6618
7054
  let data = url;
6619
7055
  if (typeof url === "string") {
6620
7056
  data = await fetch2(url);
@@ -6622,13 +7058,13 @@
6622
7058
  if (isBlob(url)) {
6623
7059
  data = await fetch2(url);
6624
7060
  }
6625
- return await parse(data, loaders, options);
7061
+ return Array.isArray(resolvedLoaders) ? await parse(data, resolvedLoaders, resolvedOptions) : await parse(data, resolvedLoaders, resolvedOptions);
6626
7062
  }
6627
7063
  var init_load = __esm({
6628
7064
  "../core/src/lib/api/load.ts"() {
6629
7065
  init_is_type();
6630
7066
  init_normalize_loader();
6631
- init_option_utils();
7067
+ init_get_fetch_function();
6632
7068
  init_parse();
6633
7069
  }
6634
7070
  });
@@ -6700,6 +7136,22 @@
6700
7136
  }
6701
7137
  throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box");
6702
7138
  }
7139
+ function getCartographicBounds(boundingVolumeHeader, boundingVolume) {
7140
+ if (boundingVolumeHeader.box) {
7141
+ return orientedBoundingBoxToCartographicBounds(boundingVolume);
7142
+ }
7143
+ if (boundingVolumeHeader.region) {
7144
+ const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
7145
+ return [
7146
+ [degrees(west), degrees(south), minHeight],
7147
+ [degrees(east), degrees(north), maxHeight]
7148
+ ];
7149
+ }
7150
+ if (boundingVolumeHeader.sphere) {
7151
+ return boundingSphereToCartographicBounds(boundingVolume);
7152
+ }
7153
+ throw new Error("Unkown boundingVolume type");
7154
+ }
6703
7155
  function createBox(box, transform, result) {
6704
7156
  const center = new Vector3(box[0], box[1], box[2]);
6705
7157
  transform.transform(center, center);
@@ -6755,13 +7207,79 @@
6755
7207
  }
6756
7208
  return new BoundingSphere(center, radius);
6757
7209
  }
6758
- var scratchScale, scratchNorthWest, scratchSouthEast;
7210
+ function orientedBoundingBoxToCartographicBounds(boundingVolume) {
7211
+ const result = emptyCartographicBounds();
7212
+ const { halfAxes } = boundingVolume;
7213
+ const xAxis = new Vector3(halfAxes.getColumn(0));
7214
+ const yAxis = new Vector3(halfAxes.getColumn(1));
7215
+ const zAxis = new Vector3(halfAxes.getColumn(2));
7216
+ for (let x = 0; x < 2; x++) {
7217
+ for (let y = 0; y < 2; y++) {
7218
+ for (let z = 0; z < 2; z++) {
7219
+ scratchPoint.copy(boundingVolume.center);
7220
+ scratchPoint.add(xAxis);
7221
+ scratchPoint.add(yAxis);
7222
+ scratchPoint.add(zAxis);
7223
+ addToCartographicBounds(result, scratchPoint);
7224
+ zAxis.negate();
7225
+ }
7226
+ yAxis.negate();
7227
+ }
7228
+ xAxis.negate();
7229
+ }
7230
+ return result;
7231
+ }
7232
+ function boundingSphereToCartographicBounds(boundingVolume) {
7233
+ const result = emptyCartographicBounds();
7234
+ const { center, radius } = boundingVolume;
7235
+ const point = Ellipsoid.WGS84.scaleToGeodeticSurface(center, scratchPoint);
7236
+ let zAxis;
7237
+ if (point) {
7238
+ zAxis = Ellipsoid.WGS84.geodeticSurfaceNormal(point);
7239
+ } else {
7240
+ zAxis = new Vector3(0, 0, 1);
7241
+ }
7242
+ let xAxis = new Vector3(zAxis[2], -zAxis[1], 0);
7243
+ if (xAxis.len() > 0) {
7244
+ xAxis.normalize();
7245
+ } else {
7246
+ xAxis = new Vector3(0, 1, 0);
7247
+ }
7248
+ const yAxis = xAxis.clone().cross(zAxis);
7249
+ for (const axis of [xAxis, yAxis, zAxis]) {
7250
+ scratchScale.copy(axis).scale(radius);
7251
+ for (let dir = 0; dir < 2; dir++) {
7252
+ scratchPoint.copy(center);
7253
+ scratchPoint.add(scratchScale);
7254
+ addToCartographicBounds(result, scratchPoint);
7255
+ scratchScale.negate();
7256
+ }
7257
+ }
7258
+ return result;
7259
+ }
7260
+ function emptyCartographicBounds() {
7261
+ return [
7262
+ [Infinity, Infinity, Infinity],
7263
+ [-Infinity, -Infinity, -Infinity]
7264
+ ];
7265
+ }
7266
+ function addToCartographicBounds(target, cartesian) {
7267
+ Ellipsoid.WGS84.cartesianToCartographic(cartesian, scratchPoint);
7268
+ target[0][0] = Math.min(target[0][0], scratchPoint[0]);
7269
+ target[0][1] = Math.min(target[0][1], scratchPoint[1]);
7270
+ target[0][2] = Math.min(target[0][2], scratchPoint[2]);
7271
+ target[1][0] = Math.max(target[1][0], scratchPoint[0]);
7272
+ target[1][1] = Math.max(target[1][1], scratchPoint[1]);
7273
+ target[1][2] = Math.max(target[1][2], scratchPoint[2]);
7274
+ }
7275
+ var scratchPoint, scratchScale, scratchNorthWest, scratchSouthEast;
6759
7276
  var init_bounding_volume = __esm({
6760
7277
  "src/tileset/helpers/bounding-volume.ts"() {
6761
7278
  init_esm();
6762
- init_esm4();
7279
+ init_esm3();
6763
7280
  init_esm2();
6764
7281
  init_src2();
7282
+ scratchPoint = new Vector3();
6765
7283
  scratchScale = new Vector3();
6766
7284
  scratchNorthWest = new Vector3();
6767
7285
  scratchSouthEast = new Vector3();
@@ -6826,39 +7344,43 @@
6826
7344
  return "OUT";
6827
7345
  }
6828
7346
  function getProjectedRadius(tile, frameState) {
6829
- const originalViewport = frameState.viewport;
6830
- const ViewportClass = originalViewport.constructor;
6831
- const { longitude, latitude, height, width, bearing, zoom } = originalViewport;
6832
- const viewport = new ViewportClass({ longitude, latitude, height, width, bearing, zoom, pitch: 0 });
7347
+ const { topDownViewport: viewport } = frameState;
6833
7348
  const mbsLat = tile.header.mbs[1];
6834
7349
  const mbsLon = tile.header.mbs[0];
6835
7350
  const mbsZ = tile.header.mbs[2];
6836
7351
  const mbsR = tile.header.mbs[3];
6837
7352
  const mbsCenterCartesian = [...tile.boundingVolume.center];
6838
7353
  const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);
6839
- const cameraPositionCartesian = Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, new Vector3());
6840
- const toEye = new Vector3(cameraPositionCartesian).subtract(mbsCenterCartesian).normalize();
6841
- const enuToCartesianMatrix = new Matrix4();
7354
+ Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, cameraPositionCartesian);
7355
+ toEye.copy(cameraPositionCartesian).subtract(mbsCenterCartesian).normalize();
6842
7356
  Ellipsoid.WGS84.eastNorthUpToFixedFrame(mbsCenterCartesian, enuToCartesianMatrix);
6843
- const cartesianToEnuMatrix = new Matrix4(enuToCartesianMatrix).invert();
6844
- const cameraPositionEnu = new Vector3(cameraPositionCartesian).transform(cartesianToEnuMatrix);
7357
+ cartesianToEnuMatrix.copy(enuToCartesianMatrix).invert();
7358
+ cameraPositionEnu.copy(cameraPositionCartesian).transform(cartesianToEnuMatrix);
6845
7359
  const projection = Math.sqrt(cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]);
6846
7360
  const extraZ = projection * projection / cameraPositionEnu[2];
6847
- const extraVertexEnu = new Vector3([cameraPositionEnu[0], cameraPositionEnu[1], extraZ]);
7361
+ extraVertexEnu.copy([cameraPositionEnu[0], cameraPositionEnu[1], extraZ]);
6848
7362
  const extraVertexCartesian = extraVertexEnu.transform(enuToCartesianMatrix);
6849
- const extraVectorCartesian = new Vector3(extraVertexCartesian).subtract(mbsCenterCartesian).normalize();
7363
+ const extraVectorCartesian = extraVertexCartesian.subtract(mbsCenterCartesian).normalize();
6850
7364
  const radiusVector = toEye.cross(extraVectorCartesian).normalize().scale(mbsR);
6851
- const sphereMbsBorderVertexCartesian = new Vector3(mbsCenterCartesian).add(radiusVector);
7365
+ const sphereMbsBorderVertexCartesian = radiusVector.add(mbsCenterCartesian);
6852
7366
  const sphereMbsBorderVertexCartographic = Ellipsoid.WGS84.cartesianToCartographic(sphereMbsBorderVertexCartesian);
6853
7367
  const projectedOrigin = viewport.project([mbsLon, mbsLat, mbsZ]);
6854
7368
  const projectedMbsBorderVertex = viewport.project(sphereMbsBorderVertexCartographic);
6855
- const projectedRadius = new Vector3(projectedOrigin).subtract(projectedMbsBorderVertex).magnitude();
7369
+ const projectedRadius = projectedOriginVector.copy(projectedOrigin).subtract(projectedMbsBorderVertex).magnitude();
6856
7370
  return projectedRadius;
6857
7371
  }
7372
+ var cameraPositionCartesian, toEye, cameraPositionEnu, extraVertexEnu, projectedOriginVector, enuToCartesianMatrix, cartesianToEnuMatrix;
6858
7373
  var init_i3s_lod = __esm({
6859
7374
  "src/tileset/helpers/i3s-lod.ts"() {
6860
7375
  init_esm();
6861
7376
  init_esm2();
7377
+ cameraPositionCartesian = new Vector3();
7378
+ toEye = new Vector3();
7379
+ cameraPositionEnu = new Vector3();
7380
+ extraVertexEnu = new Vector3();
7381
+ projectedOriginVector = new Vector3();
7382
+ enuToCartesianMatrix = new Matrix4();
7383
+ cartesianToEnuMatrix = new Matrix4();
6862
7384
  }
6863
7385
  });
6864
7386
 
@@ -6962,10 +7484,10 @@
6962
7484
  }
6963
7485
  });
6964
7486
 
6965
- // src/tileset/traversers/tileset-traverser.ts
7487
+ // src/tileset/tileset-traverser.ts
6966
7488
  var DEFAULT_PROPS3, TilesetTraverser;
6967
7489
  var init_tileset_traverser = __esm({
6968
- "src/tileset/traversers/tileset-traverser.ts"() {
7490
+ "src/tileset/tileset-traverser.ts"() {
6969
7491
  init_managed_array();
6970
7492
  init_constants3();
6971
7493
  DEFAULT_PROPS3 = {
@@ -6980,6 +7502,8 @@
6980
7502
  };
6981
7503
  TilesetTraverser = class {
6982
7504
  constructor(options) {
7505
+ this.lastUpdate = new Date().getTime();
7506
+ this.updateDebounceTime = 1e3;
6983
7507
  this.options = { ...DEFAULT_PROPS3, ...options };
6984
7508
  this._traversalStack = new ManagedArray();
6985
7509
  this._emptyTraversalStack = new ManagedArray();
@@ -6989,6 +7513,9 @@
6989
7513
  this.requestedTiles = {};
6990
7514
  this.emptyTiles = {};
6991
7515
  }
7516
+ traversalFinished(frameState) {
7517
+ return true;
7518
+ }
6992
7519
  traverse(root, frameState, options) {
6993
7520
  this.root = root;
6994
7521
  this.options = { ...this.options, ...options };
@@ -7036,7 +7563,11 @@
7036
7563
  this.touchTile(tile, frameState);
7037
7564
  tile._shouldRefine = shouldRefine && parentRefines;
7038
7565
  }
7039
- this.options.onTraversalEnd(frameState);
7566
+ const newTime = new Date().getTime();
7567
+ if (this.traversalFinished(frameState) || newTime - this.lastUpdate > this.updateDebounceTime) {
7568
+ this.lastUpdate = newTime;
7569
+ this.options.onTraversalEnd(frameState);
7570
+ }
7040
7571
  }
7041
7572
  updateChildTiles(tile, frameState) {
7042
7573
  const children = tile.children;
@@ -7188,11 +7719,11 @@
7188
7719
  function defined3(x) {
7189
7720
  return x !== void 0 && x !== null;
7190
7721
  }
7191
- var scratchVector9, TileHeader;
7722
+ var scratchVector9, Tile3D;
7192
7723
  var init_tile_3d = __esm({
7193
7724
  "src/tileset/tile-3d.ts"() {
7194
7725
  init_esm();
7195
- init_esm4();
7726
+ init_esm3();
7196
7727
  init_src3();
7197
7728
  init_constants3();
7198
7729
  init_bounding_volume();
@@ -7201,7 +7732,7 @@
7201
7732
  init_d_tiles_options();
7202
7733
  init_tileset_traverser();
7203
7734
  scratchVector9 = new Vector3();
7204
- TileHeader = class {
7735
+ Tile3D = class {
7205
7736
  constructor(tileset, header, parentHeader, extendedId = "") {
7206
7737
  this.header = header;
7207
7738
  this.tileset = tileset;
@@ -7251,6 +7782,7 @@
7251
7782
  this._lodJudge = null;
7252
7783
  this._expireDate = null;
7253
7784
  this._expiredContent = null;
7785
+ this.implicitTiling = null;
7254
7786
  Object.seal(this);
7255
7787
  }
7256
7788
  destroy() {
@@ -7292,6 +7824,18 @@
7292
7824
  get contentFailed() {
7293
7825
  return this.contentState === TILE_CONTENT_STATE.FAILED;
7294
7826
  }
7827
+ get distanceToCamera() {
7828
+ return this._distanceToCamera;
7829
+ }
7830
+ get screenSpaceError() {
7831
+ return this._screenSpaceError;
7832
+ }
7833
+ get boundingBox() {
7834
+ if (!this._boundingBox) {
7835
+ this._boundingBox = getCartographicBounds(this.header.boundingVolume, this.boundingVolume);
7836
+ }
7837
+ return this._boundingBox;
7838
+ }
7295
7839
  getScreenSpaceError(frameState, useParentLodMetric) {
7296
7840
  switch (this.tileset.type) {
7297
7841
  case TILESET_TYPE.I3S:
@@ -7302,6 +7846,9 @@
7302
7846
  throw new Error("Unsupported tileset type");
7303
7847
  }
7304
7848
  }
7849
+ unselect() {
7850
+ this._selectedFrame = 0;
7851
+ }
7305
7852
  _getPriority() {
7306
7853
  const traverser = this.tileset._traverser;
7307
7854
  const { skipLevelOfDetail } = traverser.options;
@@ -7530,8 +8077,20 @@
7530
8077
  case "i3s":
7531
8078
  return {
7532
8079
  ...this.tileset.options.i3s,
7533
- tile: this.header,
7534
- tileset: this.tileset.tileset,
8080
+ _tileOptions: {
8081
+ attributeUrls: this.header.attributeUrls,
8082
+ textureUrl: this.header.textureUrl,
8083
+ textureFormat: this.header.textureFormat,
8084
+ textureLoaderOptions: this.header.textureLoaderOptions,
8085
+ materialDefinition: this.header.materialDefinition,
8086
+ isDracoGeometry: this.header.isDracoGeometry,
8087
+ mbs: this.header.mbs
8088
+ },
8089
+ _tilesetOptions: {
8090
+ store: this.tileset.tileset.store,
8091
+ attributeStorageInfo: this.tileset.tileset.attributeStorageInfo,
8092
+ fields: this.tileset.tileset.fields
8093
+ },
7535
8094
  isTileHeader: false
7536
8095
  };
7537
8096
  case "3d-tiles":
@@ -7544,10 +8103,10 @@
7544
8103
  }
7545
8104
  });
7546
8105
 
7547
- // src/tileset/traversers/tileset-3d-traverser.ts
8106
+ // src/tileset/format-3d-tiles/tileset-3d-traverser.ts
7548
8107
  var Tileset3DTraverser;
7549
8108
  var init_tileset_3d_traverser = __esm({
7550
- "src/tileset/traversers/tileset-3d-traverser.ts"() {
8109
+ "src/tileset/format-3d-tiles/tileset-3d-traverser.ts"() {
7551
8110
  init_constants3();
7552
8111
  init_tileset_traverser();
7553
8112
  Tileset3DTraverser = class extends TilesetTraverser {
@@ -7590,10 +8149,41 @@
7590
8149
  }
7591
8150
  });
7592
8151
 
7593
- // src/tileset/traversers/i3s-tile-manager.ts
8152
+ // src/tileset/format-i3s/i3s-pending-tiles-register.ts
8153
+ var I3SPendingTilesRegister;
8154
+ var init_i3s_pending_tiles_register = __esm({
8155
+ "src/tileset/format-i3s/i3s-pending-tiles-register.ts"() {
8156
+ I3SPendingTilesRegister = class {
8157
+ constructor() {
8158
+ this.frameNumberMap = new Map();
8159
+ }
8160
+ register(viewportId, frameNumber) {
8161
+ const viewportMap = this.frameNumberMap.get(viewportId) || new Map();
8162
+ const oldCount = viewportMap.get(frameNumber) || 0;
8163
+ viewportMap.set(frameNumber, oldCount + 1);
8164
+ this.frameNumberMap.set(viewportId, viewportMap);
8165
+ }
8166
+ deregister(viewportId, frameNumber) {
8167
+ const viewportMap = this.frameNumberMap.get(viewportId);
8168
+ if (!viewportMap) {
8169
+ return;
8170
+ }
8171
+ const oldCount = viewportMap.get(frameNumber) || 1;
8172
+ viewportMap.set(frameNumber, oldCount - 1);
8173
+ }
8174
+ isZero(viewportId, frameNumber) {
8175
+ const count = this.frameNumberMap.get(viewportId)?.get(frameNumber) || 0;
8176
+ return count === 0;
8177
+ }
8178
+ };
8179
+ }
8180
+ });
8181
+
8182
+ // src/tileset/format-i3s/i3s-tile-manager.ts
7594
8183
  var STATUS, I3STileManager;
7595
8184
  var init_i3s_tile_manager = __esm({
7596
- "src/tileset/traversers/i3s-tile-manager.ts"() {
8185
+ "src/tileset/format-i3s/i3s-tile-manager.ts"() {
8186
+ init_i3s_pending_tiles_register();
7597
8187
  STATUS = {
7598
8188
  REQUESTED: "REQUESTED",
7599
8189
  COMPLETED: "COMPLETED",
@@ -7601,36 +8191,65 @@
7601
8191
  };
7602
8192
  I3STileManager = class {
7603
8193
  constructor() {
8194
+ this.pendingTilesRegister = new I3SPendingTilesRegister();
7604
8195
  this._statusMap = {};
7605
8196
  }
7606
8197
  add(request, key, callback, frameState) {
7607
8198
  if (!this._statusMap[key]) {
8199
+ const {
8200
+ frameNumber,
8201
+ viewport: { id }
8202
+ } = frameState;
7608
8203
  this._statusMap[key] = { request, callback, key, frameState, status: STATUS.REQUESTED };
8204
+ this.pendingTilesRegister.register(id, frameNumber);
7609
8205
  request().then((data) => {
7610
8206
  this._statusMap[key].status = STATUS.COMPLETED;
8207
+ const {
8208
+ frameNumber: actualFrameNumber,
8209
+ viewport: { id: id2 }
8210
+ } = this._statusMap[key].frameState;
8211
+ this.pendingTilesRegister.deregister(id2, actualFrameNumber);
7611
8212
  this._statusMap[key].callback(data, frameState);
7612
8213
  }).catch((error) => {
7613
8214
  this._statusMap[key].status = STATUS.ERROR;
8215
+ const {
8216
+ frameNumber: actualFrameNumber,
8217
+ viewport: { id: id2 }
8218
+ } = this._statusMap[key].frameState;
8219
+ this.pendingTilesRegister.deregister(id2, actualFrameNumber);
7614
8220
  callback(error);
7615
8221
  });
7616
8222
  }
7617
8223
  }
7618
8224
  update(key, frameState) {
7619
8225
  if (this._statusMap[key]) {
8226
+ const {
8227
+ frameNumber,
8228
+ viewport: { id }
8229
+ } = this._statusMap[key].frameState;
8230
+ this.pendingTilesRegister.deregister(id, frameNumber);
8231
+ const {
8232
+ frameNumber: newFrameNumber,
8233
+ viewport: { id: newViewportId }
8234
+ } = frameState;
8235
+ this.pendingTilesRegister.register(newViewportId, newFrameNumber);
7620
8236
  this._statusMap[key].frameState = frameState;
7621
8237
  }
7622
8238
  }
7623
8239
  find(key) {
7624
8240
  return this._statusMap[key];
7625
8241
  }
8242
+ hasPendingTiles(viewportId, frameNumber) {
8243
+ return !this.pendingTilesRegister.isZero(viewportId, frameNumber);
8244
+ }
7626
8245
  };
7627
8246
  }
7628
8247
  });
7629
8248
 
7630
- // src/tileset/traversers/i3s-tileset-traverser.ts
8249
+ // src/tileset/format-i3s/i3s-tileset-traverser.ts
7631
8250
  var I3STilesetTraverser;
7632
8251
  var init_i3s_tileset_traverser = __esm({
7633
- "src/tileset/traversers/i3s-tileset-traverser.ts"() {
8252
+ "src/tileset/format-i3s/i3s-tileset-traverser.ts"() {
7634
8253
  init_src3();
7635
8254
  init_tileset_traverser();
7636
8255
  init_i3s_lod();
@@ -7641,6 +8260,9 @@
7641
8260
  super(options);
7642
8261
  this._tileManager = new I3STileManager();
7643
8262
  }
8263
+ traversalFinished(frameState) {
8264
+ return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);
8265
+ }
7644
8266
  shouldRefine(tile, frameState) {
7645
8267
  tile._lodJudge = getLodStatus(tile, frameState);
7646
8268
  return tile._lodJudge === "DIG";
@@ -7676,18 +8298,17 @@
7676
8298
  ...tileset.loadOptions,
7677
8299
  i3s: {
7678
8300
  ...tileset.loadOptions.i3s,
7679
- isTileHeader: true,
7680
- loadContent: false
8301
+ isTileHeader: true
7681
8302
  }
7682
8303
  };
7683
8304
  return await load(nodeUrl, loader, options);
7684
8305
  }
7685
8306
  _onTileLoad(header, tile, extendedId) {
7686
- const childTile = new TileHeader(tile.tileset, header, tile, extendedId);
8307
+ const childTile = new Tile3D(tile.tileset, header, tile, extendedId);
7687
8308
  tile.children.push(childTile);
7688
8309
  const frameState = this._tileManager.find(childTile.id).frameState;
7689
8310
  this.updateTile(childTile, frameState);
7690
- if (this._frameNumber === frameState.frameNumber) {
8311
+ if (this._frameNumber === frameState.frameNumber && (this.traversalFinished(frameState) || new Date().getTime() - this.lastUpdate > this.updateDebounceTime)) {
7691
8312
  this.executeTraversal(childTile, frameState);
7692
8313
  }
7693
8314
  }
@@ -7715,17 +8336,17 @@
7715
8336
  "src/tileset/tileset-3d.ts"() {
7716
8337
  init_esm();
7717
8338
  init_esm2();
7718
- init_esm3();
8339
+ init_dist();
7719
8340
  init_src2();
7720
8341
  init_tileset_cache();
7721
8342
  init_transform_utils();
7722
8343
  init_frame_state();
7723
8344
  init_zoom();
7724
8345
  init_tile_3d();
7725
- init_tileset_3d_traverser();
8346
+ init_constants3();
7726
8347
  init_tileset_traverser();
8348
+ init_tileset_3d_traverser();
7727
8349
  init_i3s_tileset_traverser();
7728
- init_constants3();
7729
8350
  DEFAULT_PROPS4 = {
7730
8351
  description: "",
7731
8352
  ellipsoid: Ellipsoid.WGS84,
@@ -7733,6 +8354,8 @@
7733
8354
  throttleRequests: true,
7734
8355
  maxRequests: 64,
7735
8356
  maximumMemoryUsage: 32,
8357
+ maximumTilesSelected: 0,
8358
+ debounceTime: 0,
7736
8359
  onTileLoad: () => {
7737
8360
  },
7738
8361
  onTileUnload: () => {
@@ -7759,10 +8382,12 @@
7759
8382
  TILES_LOADING = "Tiles Loading";
7760
8383
  TILES_UNLOADED = "Tiles Unloaded";
7761
8384
  TILES_LOAD_FAILED = "Failed Tile Loads";
7762
- POINTS_COUNT = "Points";
8385
+ POINTS_COUNT = "Points/Vertices";
7763
8386
  TILES_GPU_MEMORY = "Tile Memory Use";
7764
8387
  Tileset3D = class {
7765
8388
  constructor(json, options) {
8389
+ this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
8390
+ this.updatePromise = null;
7766
8391
  assert2(json);
7767
8392
  this.options = { ...DEFAULT_PROPS4, ...options };
7768
8393
  this.tileset = json;
@@ -7810,13 +8435,13 @@
7810
8435
  this.asset = {};
7811
8436
  this.credits = {};
7812
8437
  this.description = this.options.description || "";
7813
- this._initializeTileSet(json);
8438
+ this.tilesetInitializationPromise = this._initializeTileSet(json);
7814
8439
  }
7815
8440
  destroy() {
7816
8441
  this._destroy();
7817
8442
  }
7818
8443
  isLoaded() {
7819
- return this._pendingCount === 0 && this._frameNumber !== 0;
8444
+ return this._pendingCount === 0 && this._frameNumber !== 0 && this._requestedTiles.length === 0;
7820
8445
  }
7821
8446
  get tiles() {
7822
8447
  return Object.values(this._tiles);
@@ -7846,26 +8471,49 @@
7846
8471
  hasExtension(extensionName) {
7847
8472
  return Boolean(this._extensionsUsed && this._extensionsUsed.indexOf(extensionName) > -1);
7848
8473
  }
7849
- update(viewports) {
8474
+ update(viewports = null) {
8475
+ this.tilesetInitializationPromise.then(() => {
8476
+ if (!viewports && this.lastUpdatedVieports) {
8477
+ viewports = this.lastUpdatedVieports;
8478
+ } else {
8479
+ this.lastUpdatedVieports = viewports;
8480
+ }
8481
+ if (viewports) {
8482
+ this.doUpdate(viewports);
8483
+ }
8484
+ });
8485
+ }
8486
+ async selectTiles(viewports = null) {
8487
+ await this.tilesetInitializationPromise;
8488
+ if (viewports) {
8489
+ this.lastUpdatedVieports = viewports;
8490
+ }
8491
+ if (!this.updatePromise) {
8492
+ this.updatePromise = new Promise((resolve2) => {
8493
+ setTimeout(() => {
8494
+ if (this.lastUpdatedVieports) {
8495
+ this.doUpdate(this.lastUpdatedVieports);
8496
+ }
8497
+ resolve2(this._frameNumber);
8498
+ this.updatePromise = null;
8499
+ }, this.options.debounceTime);
8500
+ });
8501
+ }
8502
+ return this.updatePromise;
8503
+ }
8504
+ doUpdate(viewports) {
7850
8505
  if ("loadTiles" in this.options && !this.options.loadTiles) {
7851
8506
  return;
7852
8507
  }
7853
8508
  if (this.traverseCounter > 0) {
7854
8509
  return;
7855
8510
  }
7856
- if (!viewports && this.lastUpdatedVieports) {
7857
- viewports = this.lastUpdatedVieports;
7858
- } else {
7859
- this.lastUpdatedVieports = viewports;
7860
- }
7861
- if (!(viewports instanceof Array)) {
7862
- viewports = [viewports];
7863
- }
8511
+ const preparedViewports = viewports instanceof Array ? viewports : [viewports];
7864
8512
  this._cache.reset();
7865
8513
  this._frameNumber++;
7866
- this.traverseCounter = viewports.length;
8514
+ this.traverseCounter = preparedViewports.length;
7867
8515
  const viewportsToTraverse = [];
7868
- for (const viewport of viewports) {
8516
+ for (const viewport of preparedViewports) {
7869
8517
  const id = viewport.id;
7870
8518
  if (this._needTraverse(id)) {
7871
8519
  viewportsToTraverse.push(id);
@@ -7873,7 +8521,7 @@
7873
8521
  this.traverseCounter--;
7874
8522
  }
7875
8523
  }
7876
- for (const viewport of viewports) {
8524
+ for (const viewport of preparedViewports) {
7877
8525
  const id = viewport.id;
7878
8526
  if (!this.roots[id]) {
7879
8527
  this.roots[id] = this._initializeTileHeaders(this.tileset, null);
@@ -7902,7 +8550,11 @@
7902
8550
  }
7903
8551
  const currentFrameStateData = this.frameStateData[id];
7904
8552
  const selectedTiles = Object.values(this._traverser.selectedTiles);
7905
- currentFrameStateData.selectedTiles = selectedTiles;
8553
+ const [filteredSelectedTiles, unselectedTiles] = limitSelectedTiles(selectedTiles, frameState, this.options.maximumTilesSelected);
8554
+ currentFrameStateData.selectedTiles = filteredSelectedTiles;
8555
+ for (const tile of unselectedTiles) {
8556
+ tile.unselect();
8557
+ }
7906
8558
  currentFrameStateData._requestedTiles = Object.values(this._traverser.requestedTiles);
7907
8559
  currentFrameStateData._emptyTiles = Object.values(this._traverser.emptyTiles);
7908
8560
  this.traverseCounter--;
@@ -7957,6 +8609,8 @@
7957
8609
  tilesRenderable++;
7958
8610
  if (tile.content.pointCount) {
7959
8611
  pointsRenderable += tile.content.pointCount;
8612
+ } else {
8613
+ pointsRenderable += tile.content.vertexCount;
7960
8614
  }
7961
8615
  }
7962
8616
  }
@@ -7964,17 +8618,43 @@
7964
8618
  this.stats.get(TILES_RENDERABLE).count = tilesRenderable;
7965
8619
  this.stats.get(POINTS_COUNT).count = pointsRenderable;
7966
8620
  }
7967
- _initializeTileSet(tilesetJson) {
8621
+ async _initializeTileSet(tilesetJson) {
8622
+ if (this.type === TILESET_TYPE.I3S) {
8623
+ this.calculateViewPropsI3S();
8624
+ tilesetJson.root = await tilesetJson.root;
8625
+ }
7968
8626
  this.root = this._initializeTileHeaders(tilesetJson, null);
7969
8627
  if (this.type === TILESET_TYPE.TILES3D) {
7970
- this._initializeCesiumTileset(tilesetJson);
8628
+ this._initializeTiles3DTileset(tilesetJson);
8629
+ this.calculateViewPropsTiles3D();
7971
8630
  }
7972
8631
  if (this.type === TILESET_TYPE.I3S) {
7973
8632
  this._initializeI3STileset();
7974
8633
  }
7975
- this._calculateViewProps();
7976
8634
  }
7977
- _calculateViewProps() {
8635
+ calculateViewPropsI3S() {
8636
+ const fullExtent = this.tileset.fullExtent;
8637
+ if (fullExtent) {
8638
+ const { xmin, xmax, ymin, ymax, zmin, zmax } = fullExtent;
8639
+ this.cartographicCenter = new Vector3(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, zmin + (zmax - zmin) / 2);
8640
+ this.cartesianCenter = Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter, new Vector3());
8641
+ this.zoom = getZoomFromFullExtent(fullExtent, this.cartographicCenter, this.cartesianCenter);
8642
+ return;
8643
+ }
8644
+ const extent = this.tileset.store?.extent;
8645
+ if (extent) {
8646
+ const [xmin, ymin, xmax, ymax] = extent;
8647
+ this.cartographicCenter = new Vector3(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, 0);
8648
+ this.cartesianCenter = Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter, new Vector3());
8649
+ this.zoom = getZoomFromExtent(extent, this.cartographicCenter, this.cartesianCenter);
8650
+ return;
8651
+ }
8652
+ console.warn("Extent is not defined in the tileset header");
8653
+ this.cartographicCenter = new Vector3();
8654
+ this.zoom = 1;
8655
+ return;
8656
+ }
8657
+ calculateViewPropsTiles3D() {
7978
8658
  const root = this.root;
7979
8659
  assert2(root);
7980
8660
  const { center } = root.boundingVolume;
@@ -7984,9 +8664,13 @@
7984
8664
  this.zoom = 1;
7985
8665
  return;
7986
8666
  }
7987
- this.cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(center, new Vector3());
8667
+ if (center[0] !== 0 || center[1] !== 0 || center[2] !== 0) {
8668
+ this.cartographicCenter = Ellipsoid.WGS84.cartesianToCartographic(center, new Vector3());
8669
+ } else {
8670
+ this.cartographicCenter = new Vector3(0, 0, -Ellipsoid.WGS84.radii[0]);
8671
+ }
7988
8672
  this.cartesianCenter = center;
7989
- this.zoom = getZoomFromBoundingVolume(root.boundingVolume);
8673
+ this.zoom = getZoomFromBoundingVolume(root.boundingVolume, this.cartographicCenter);
7990
8674
  }
7991
8675
  _initializeStats() {
7992
8676
  this.stats.get(TILES_TOTAL);
@@ -7997,11 +8681,11 @@
7997
8681
  this.stats.get(TILES_LOADED);
7998
8682
  this.stats.get(TILES_UNLOADED);
7999
8683
  this.stats.get(TILES_LOAD_FAILED);
8000
- this.stats.get(POINTS_COUNT, "memory");
8684
+ this.stats.get(POINTS_COUNT);
8001
8685
  this.stats.get(TILES_GPU_MEMORY, "memory");
8002
8686
  }
8003
8687
  _initializeTileHeaders(tilesetJson, parentTileHeader) {
8004
- const rootTile = new TileHeader(this, tilesetJson.root, parentTileHeader);
8688
+ const rootTile = new Tile3D(this, tilesetJson.root, parentTileHeader);
8005
8689
  if (parentTileHeader) {
8006
8690
  parentTileHeader.children.push(rootTile);
8007
8691
  rootTile.depth = parentTileHeader.depth + 1;
@@ -8014,7 +8698,7 @@
8014
8698
  this.stats.get(TILES_TOTAL).incrementCount();
8015
8699
  const children = tile.header.children || [];
8016
8700
  for (const childHeader of children) {
8017
- const childTile = new TileHeader(this, childHeader, tile);
8701
+ const childTile = new Tile3D(this, childHeader, tile);
8018
8702
  tile.children.push(childTile);
8019
8703
  childTile.depth = tile.depth + 1;
8020
8704
  stack.push(childTile);
@@ -8067,12 +8751,45 @@
8067
8751
  if (!loaded) {
8068
8752
  return;
8069
8753
  }
8754
+ if (this.type === TILESET_TYPE.I3S) {
8755
+ const nodesInNodePages = this.tileset?.nodePagesTile?.nodesInNodePages || 0;
8756
+ this.stats.get(TILES_TOTAL).reset();
8757
+ this.stats.get(TILES_TOTAL).addCount(nodesInNodePages);
8758
+ }
8070
8759
  if (tile && tile.content) {
8071
8760
  calculateTransformProps(tile, tile.content);
8072
8761
  }
8762
+ this.updateContentTypes(tile);
8073
8763
  this._addTileToCache(tile);
8074
8764
  this.options.onTileLoad(tile);
8075
8765
  }
8766
+ updateContentTypes(tile) {
8767
+ if (this.type === TILESET_TYPE.I3S) {
8768
+ if (tile.header.isDracoGeometry) {
8769
+ this.contentFormats.draco = true;
8770
+ }
8771
+ switch (tile.header.textureFormat) {
8772
+ case "dds":
8773
+ this.contentFormats.dds = true;
8774
+ break;
8775
+ case "ktx2":
8776
+ this.contentFormats.ktx2 = true;
8777
+ break;
8778
+ default:
8779
+ }
8780
+ } else if (this.type === TILESET_TYPE.TILES3D) {
8781
+ const { extensionsRemoved = [] } = tile.content?.gltf || {};
8782
+ if (extensionsRemoved.includes("KHR_draco_mesh_compression")) {
8783
+ this.contentFormats.draco = true;
8784
+ }
8785
+ if (extensionsRemoved.includes("EXT_meshopt_compression")) {
8786
+ this.contentFormats.meshopt = true;
8787
+ }
8788
+ if (extensionsRemoved.includes("KHR_texture_basisu")) {
8789
+ this.contentFormats.ktx2 = true;
8790
+ }
8791
+ }
8792
+ }
8076
8793
  _onStartTileLoading() {
8077
8794
  this._pendingCount++;
8078
8795
  this.stats.get(TILES_LOADING).incrementCount();
@@ -8132,7 +8849,7 @@
8132
8849
  this._unloadTile(tile);
8133
8850
  tile.destroy();
8134
8851
  }
8135
- _initializeCesiumTileset(tilesetJson) {
8852
+ _initializeTiles3DTileset(tilesetJson) {
8136
8853
  this.asset = tilesetJson.asset;
8137
8854
  if (!this.asset) {
8138
8855
  throw new Error("Tileset must have an asset property.");
@@ -8169,7 +8886,7 @@
8169
8886
  TILE_CONTENT_STATE: () => TILE_CONTENT_STATE,
8170
8887
  TILE_REFINEMENT: () => TILE_REFINEMENT,
8171
8888
  TILE_TYPE: () => TILE_TYPE,
8172
- Tile3D: () => TileHeader,
8889
+ Tile3D: () => Tile3D,
8173
8890
  Tileset3D: () => Tileset3D,
8174
8891
  TilesetCache: () => TilesetCache,
8175
8892
  TilesetTraverser: () => TilesetTraverser,
@@ -8194,10 +8911,10 @@
8194
8911
 
8195
8912
  // src/bundle.ts
8196
8913
  var require_bundle = __commonJS({
8197
- "src/bundle.ts"(exports, module2) {
8914
+ "src/bundle.ts"(exports, module) {
8198
8915
  var moduleExports = (init_src4(), src_exports);
8199
8916
  globalThis.loaders = globalThis.loaders || {};
8200
- module2.exports = Object.assign(globalThis.loaders, moduleExports);
8917
+ module.exports = Object.assign(globalThis.loaders, moduleExports);
8201
8918
  }
8202
8919
  });
8203
8920
  require_bundle();