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

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 (217) hide show
  1. package/dist/cesium-ion-loader.d.ts.map +1 -1
  2. package/dist/cesium-ion-loader.js +1 -0
  3. package/dist/dist.min.js +2517 -299
  4. package/dist/es5/cesium-ion-loader.js +23 -27
  5. package/dist/es5/cesium-ion-loader.js.map +1 -1
  6. package/dist/es5/index.js.map +1 -1
  7. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +0 -2
  8. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  9. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +0 -6
  10. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  11. package/dist/es5/lib/classes/tile-3d-batch-table.js +2 -19
  12. package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -1
  13. package/dist/es5/lib/classes/tile-3d-feature-table.js +1 -4
  14. package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -1
  15. package/dist/es5/lib/constants.js +0 -2
  16. package/dist/es5/lib/constants.js.map +1 -1
  17. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +0 -5
  18. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -1
  19. package/dist/es5/lib/encoders/encode-3d-tile-composite.js +0 -2
  20. package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -1
  21. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +0 -3
  22. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -1
  23. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +0 -3
  24. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -1
  25. package/dist/es5/lib/encoders/encode-3d-tile.js +0 -1
  26. package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -1
  27. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +0 -3
  28. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -1
  29. package/dist/es5/lib/ion/ion.js +109 -117
  30. package/dist/es5/lib/ion/ion.js.map +1 -1
  31. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +0 -3
  32. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  33. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  34. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -3
  35. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  36. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +161 -131
  37. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  38. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +34 -42
  39. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
  40. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +0 -3
  41. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -1
  42. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +93 -100
  43. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
  44. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +0 -5
  45. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -1
  46. package/dist/es5/lib/parsers/helpers/parse-utils.js +0 -2
  47. package/dist/es5/lib/parsers/helpers/parse-utils.js.map +1 -1
  48. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +14 -16
  49. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  50. package/dist/es5/lib/parsers/parse-3d-tile-composite.js +24 -27
  51. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -1
  52. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +12 -14
  53. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  54. package/dist/es5/lib/parsers/parse-3d-tile-header.js +152 -148
  55. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -1
  56. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +10 -22
  57. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  58. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +111 -119
  59. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  60. package/dist/es5/lib/parsers/parse-3d-tile.js +41 -44
  61. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -1
  62. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +30 -0
  63. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  64. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +44 -0
  65. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  66. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +30 -0
  67. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  68. package/dist/es5/lib/utils/s2/converters/s2-to-region.js +52 -0
  69. package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  70. package/dist/es5/lib/utils/s2/index.js +90 -0
  71. package/dist/es5/lib/utils/s2/index.js.map +1 -0
  72. package/dist/es5/lib/utils/s2/s2-geometry-functions.js +19 -0
  73. package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  74. package/dist/es5/lib/utils/s2/s2-token-functions.js +41 -0
  75. package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -0
  76. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +22 -0
  77. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  78. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +207 -0
  79. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  80. package/dist/es5/lib/utils/version.js +1 -1
  81. package/dist/es5/lib/utils/version.js.map +1 -1
  82. package/dist/es5/tile-3d-subtree-loader.js.map +1 -1
  83. package/dist/es5/tile-3d-writer.js.map +1 -1
  84. package/dist/es5/tiles-3d-loader.js +59 -65
  85. package/dist/es5/tiles-3d-loader.js.map +1 -1
  86. package/dist/esm/bundle.js +0 -1
  87. package/dist/esm/bundle.js.map +1 -1
  88. package/dist/esm/cesium-ion-loader.js +0 -2
  89. package/dist/esm/cesium-ion-loader.js.map +1 -1
  90. package/dist/esm/index.js +0 -4
  91. package/dist/esm/index.js.map +1 -1
  92. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +0 -1
  93. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  94. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +0 -7
  95. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  96. package/dist/esm/lib/classes/tile-3d-batch-table.js +0 -13
  97. package/dist/esm/lib/classes/tile-3d-batch-table.js.map +1 -1
  98. package/dist/esm/lib/classes/tile-3d-feature-table.js +0 -3
  99. package/dist/esm/lib/classes/tile-3d-feature-table.js.map +1 -1
  100. package/dist/esm/lib/constants.js +0 -3
  101. package/dist/esm/lib/constants.js.map +1 -1
  102. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +0 -8
  103. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +1 -1
  104. package/dist/esm/lib/encoders/encode-3d-tile-composite.js +0 -4
  105. package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +1 -1
  106. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +0 -6
  107. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -1
  108. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +0 -5
  109. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -1
  110. package/dist/esm/lib/encoders/encode-3d-tile.js +0 -2
  111. package/dist/esm/lib/encoders/encode-3d-tile.js.map +1 -1
  112. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +0 -3
  113. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -1
  114. package/dist/esm/lib/ion/ion.js +0 -9
  115. package/dist/esm/lib/ion/ion.js.map +1 -1
  116. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +0 -4
  117. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  118. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  119. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -4
  120. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  121. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +50 -19
  122. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -1
  123. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +1 -8
  124. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -1
  125. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +0 -4
  126. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -1
  127. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +0 -6
  128. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -1
  129. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +0 -6
  130. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -1
  131. package/dist/esm/lib/parsers/helpers/parse-utils.js +0 -4
  132. package/dist/esm/lib/parsers/helpers/parse-utils.js.map +1 -1
  133. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +0 -3
  134. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  135. package/dist/esm/lib/parsers/parse-3d-tile-composite.js +0 -6
  136. package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -1
  137. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -1
  138. package/dist/esm/lib/parsers/parse-3d-tile-header.js +13 -6
  139. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -1
  140. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +0 -12
  141. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  142. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +0 -6
  143. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  144. package/dist/esm/lib/parsers/parse-3d-tile.js +0 -4
  145. package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -1
  146. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js +23 -0
  147. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  148. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js +40 -0
  149. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  150. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js +24 -0
  151. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  152. package/dist/esm/lib/utils/s2/converters/s2-to-region.js +42 -0
  153. package/dist/esm/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  154. package/dist/esm/lib/utils/s2/index.js +7 -0
  155. package/dist/esm/lib/utils/s2/index.js.map +1 -0
  156. package/dist/esm/lib/utils/s2/s2-geometry-functions.js +12 -0
  157. package/dist/esm/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  158. package/dist/esm/lib/utils/s2/s2-token-functions.js +32 -0
  159. package/dist/esm/lib/utils/s2/s2-token-functions.js.map +1 -0
  160. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js +15 -0
  161. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  162. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js +186 -0
  163. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  164. package/dist/esm/lib/utils/version.js +1 -2
  165. package/dist/esm/lib/utils/version.js.map +1 -1
  166. package/dist/esm/tile-3d-subtree-loader.js +0 -1
  167. package/dist/esm/tile-3d-subtree-loader.js.map +1 -1
  168. package/dist/esm/tile-3d-writer.js +0 -1
  169. package/dist/esm/tile-3d-writer.js.map +1 -1
  170. package/dist/esm/tiles-3d-loader.js +0 -1
  171. package/dist/esm/tiles-3d-loader.js.map +1 -1
  172. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +11 -0
  173. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
  174. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +60 -11
  175. package/dist/lib/parsers/parse-3d-tile-batched-model.js +1 -1
  176. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
  177. package/dist/lib/parsers/parse-3d-tile-header.js +13 -1
  178. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts +15 -0
  179. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts.map +1 -0
  180. package/dist/lib/utils/obb/s2-corners-to-obb.js +37 -0
  181. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +9 -0
  182. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -0
  183. package/dist/lib/utils/s2/converters/s2-to-boundary.js +61 -0
  184. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts +15 -0
  185. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts.map +1 -0
  186. package/dist/lib/utils/s2/converters/s2-to-obb-points.js +36 -0
  187. package/dist/lib/utils/s2/converters/s2-to-region.d.ts +13 -0
  188. package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -0
  189. package/dist/lib/utils/s2/converters/s2-to-region.js +59 -0
  190. package/dist/lib/utils/s2/index.d.ts +8 -0
  191. package/dist/lib/utils/s2/index.d.ts.map +1 -0
  192. package/dist/lib/utils/s2/index.js +23 -0
  193. package/dist/lib/utils/s2/s2-geometry-functions.d.ts +14 -0
  194. package/dist/lib/utils/s2/s2-geometry-functions.d.ts.map +1 -0
  195. package/dist/lib/utils/s2/s2-geometry-functions.js +29 -0
  196. package/dist/lib/utils/s2/s2-token-functions.d.ts +23 -0
  197. package/dist/lib/utils/s2/s2-token-functions.d.ts.map +1 -0
  198. package/dist/lib/utils/s2/s2-token-functions.js +68 -0
  199. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +14 -0
  200. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -0
  201. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +32 -0
  202. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts +52 -0
  203. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts.map +1 -0
  204. package/dist/lib/utils/s2/s2geometry/s2-geometry.js +260 -0
  205. package/package.json +9 -8
  206. package/src/cesium-ion-loader.ts +1 -0
  207. package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +102 -13
  208. package/src/lib/parsers/parse-3d-tile-header.ts +17 -1
  209. package/src/lib/utils/obb/s2-corners-to-obb.ts +51 -0
  210. package/src/lib/utils/s2/converters/s2-to-boundary.ts +67 -0
  211. package/src/lib/utils/s2/converters/s2-to-obb-points.ts +46 -0
  212. package/src/lib/utils/s2/converters/s2-to-region.ts +69 -0
  213. package/src/lib/utils/s2/index.ts +17 -0
  214. package/src/lib/utils/s2/s2-geometry-functions.ts +28 -0
  215. package/src/lib/utils/s2/s2-token-functions.ts +67 -0
  216. package/src/lib/utils/s2/s2geometry/s2-cell-utils.ts +33 -0
  217. package/src/lib/utils/s2/s2geometry/s2-geometry.ts +296 -0
package/dist/dist.min.js CHANGED
@@ -119,8 +119,8 @@
119
119
  };
120
120
  this.name = jobName;
121
121
  this.workerThread = workerThread;
122
- this.result = new Promise((resolve, reject) => {
123
- this._resolve = resolve;
122
+ this.result = new Promise((resolve2, reject) => {
123
+ this._resolve = resolve2;
124
124
  this._reject = reject;
125
125
  });
126
126
  }
@@ -751,46 +751,7 @@
751
751
  }
752
752
  });
753
753
 
754
- // ../loader-utils/src/lib/binary-utils/buffer-utils.ts
755
- function isBuffer(value) {
756
- return value && typeof value === "object" && value.isBuffer;
757
- }
758
- function bufferToArrayBuffer(buffer) {
759
- if (isBuffer(buffer)) {
760
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
761
- return typedArray.slice().buffer;
762
- }
763
- return buffer;
764
- }
765
- var init_buffer_utils = __esm({
766
- "../loader-utils/src/lib/binary-utils/buffer-utils.ts"() {
767
- }
768
- });
769
-
770
754
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
771
- function toArrayBuffer(data) {
772
- if (isBuffer(data)) {
773
- return bufferToArrayBuffer(data);
774
- }
775
- if (data instanceof ArrayBuffer) {
776
- return data;
777
- }
778
- if (ArrayBuffer.isView(data)) {
779
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
780
- return data.buffer;
781
- }
782
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
783
- }
784
- if (typeof data === "string") {
785
- const text = data;
786
- const uint8Array = new TextEncoder().encode(text);
787
- return uint8Array.buffer;
788
- }
789
- if (data && typeof data === "object" && data._toArrayBuffer) {
790
- return data._toArrayBuffer();
791
- }
792
- throw new Error("toArrayBuffer");
793
- }
794
755
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
795
756
  byteLength = byteLength || arrayBuffer1.byteLength;
796
757
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -823,7 +784,6 @@
823
784
  }
824
785
  var init_array_buffer_utils = __esm({
825
786
  "../loader-utils/src/lib/binary-utils/array-buffer-utils.ts"() {
826
- init_buffer_utils();
827
787
  }
828
788
  });
829
789
 
@@ -851,34 +811,7 @@
851
811
  }
852
812
  });
853
813
 
854
- // ../loader-utils/src/lib/binary-utils/binary-copy-utils.ts
855
- function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
856
- const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
857
- const padLength = paddedLength - sourceBuffer.byteLength;
858
- if (dataView) {
859
- const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
860
- const sourceArray = new Uint8Array(sourceBuffer);
861
- targetArray.set(sourceArray);
862
- for (let i2 = 0; i2 < padLength; ++i2) {
863
- dataView.setUint8(byteOffset + sourceBuffer.byteLength + i2, 32);
864
- }
865
- }
866
- byteOffset += paddedLength;
867
- return byteOffset;
868
- }
869
- function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
870
- const textEncoder = new TextEncoder();
871
- const stringBuffer = textEncoder.encode(string);
872
- byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
873
- return byteOffset;
874
- }
875
- var init_binary_copy_utils = __esm({
876
- "../loader-utils/src/lib/binary-utils/binary-copy-utils.ts"() {
877
- init_memory_copy_utils();
878
- }
879
- });
880
-
881
- // ../loader-utils/src/lib/binary-utils/encode-utils.ts
814
+ // ../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts
882
815
  function padStringToByteAlignment(string, byteAlignment) {
883
816
  const length4 = string.length;
884
817
  const paddedLength = Math.ceil(length4 / byteAlignment) * byteAlignment;
@@ -905,8 +838,29 @@
905
838
  }
906
839
  return byteOffset + byteLength;
907
840
  }
908
- var init_encode_utils = __esm({
909
- "../loader-utils/src/lib/binary-utils/encode-utils.ts"() {
841
+ function copyPaddedArrayBufferToDataView(dataView, byteOffset, sourceBuffer, padding) {
842
+ const paddedLength = padToNBytes(sourceBuffer.byteLength, padding);
843
+ const padLength = paddedLength - sourceBuffer.byteLength;
844
+ if (dataView) {
845
+ const targetArray = new Uint8Array(dataView.buffer, dataView.byteOffset + byteOffset, sourceBuffer.byteLength);
846
+ const sourceArray = new Uint8Array(sourceBuffer);
847
+ targetArray.set(sourceArray);
848
+ for (let i2 = 0; i2 < padLength; ++i2) {
849
+ dataView.setUint8(byteOffset + sourceBuffer.byteLength + i2, 32);
850
+ }
851
+ }
852
+ byteOffset += paddedLength;
853
+ return byteOffset;
854
+ }
855
+ function copyPaddedStringToDataView(dataView, byteOffset, string, padding) {
856
+ const textEncoder = new TextEncoder();
857
+ const stringBuffer = textEncoder.encode(string);
858
+ byteOffset = copyPaddedArrayBufferToDataView(dataView, byteOffset, stringBuffer, padding);
859
+ return byteOffset;
860
+ }
861
+ var init_dataview_copy_utils = __esm({
862
+ "../loader-utils/src/lib/binary-utils/dataview-copy-utils.ts"() {
863
+ init_memory_copy_utils();
910
864
  }
911
865
  });
912
866
 
@@ -924,8 +878,54 @@
924
878
  }
925
879
  });
926
880
 
881
+ // ../../node_modules/@babel/runtime/helpers/esm/typeof.js
882
+ function _typeof(obj) {
883
+ "@babel/helpers - typeof";
884
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
885
+ return typeof obj2;
886
+ } : function(obj2) {
887
+ return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
888
+ }, _typeof(obj);
889
+ }
890
+ var init_typeof = __esm({
891
+ "../../node_modules/@babel/runtime/helpers/esm/typeof.js"() {
892
+ }
893
+ });
894
+
895
+ // ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
896
+ function _toPrimitive(input, hint) {
897
+ if (_typeof(input) !== "object" || input === null)
898
+ return input;
899
+ var prim = input[Symbol.toPrimitive];
900
+ if (prim !== void 0) {
901
+ var res = prim.call(input, hint || "default");
902
+ if (_typeof(res) !== "object")
903
+ return res;
904
+ throw new TypeError("@@toPrimitive must return a primitive value.");
905
+ }
906
+ return (hint === "string" ? String : Number)(input);
907
+ }
908
+ var init_toPrimitive = __esm({
909
+ "../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js"() {
910
+ init_typeof();
911
+ }
912
+ });
913
+
914
+ // ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
915
+ function _toPropertyKey(arg) {
916
+ var key = _toPrimitive(arg, "string");
917
+ return _typeof(key) === "symbol" ? key : String(key);
918
+ }
919
+ var init_toPropertyKey = __esm({
920
+ "../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"() {
921
+ init_typeof();
922
+ init_toPrimitive();
923
+ }
924
+ });
925
+
927
926
  // ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
928
927
  function _defineProperty(obj, key, value) {
928
+ key = _toPropertyKey(key);
929
929
  if (key in obj) {
930
930
  Object.defineProperty(obj, key, {
931
931
  value,
@@ -940,6 +940,7 @@
940
940
  }
941
941
  var init_defineProperty = __esm({
942
942
  "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"() {
943
+ init_toPropertyKey();
943
944
  }
944
945
  });
945
946
 
@@ -964,19 +965,75 @@
964
965
  }
965
966
  });
966
967
 
968
+ // ../loader-utils/src/lib/node/buffer.browser.ts
969
+ function toArrayBuffer(buffer) {
970
+ return buffer;
971
+ }
972
+ var init_buffer_browser = __esm({
973
+ "../loader-utils/src/lib/node/buffer.browser.ts"() {
974
+ }
975
+ });
976
+
977
+ // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
978
+ function isBuffer(value) {
979
+ return value && typeof value === "object" && value.isBuffer;
980
+ }
981
+ function toArrayBuffer2(data) {
982
+ if (isBuffer(data)) {
983
+ return toArrayBuffer(data);
984
+ }
985
+ if (data instanceof ArrayBuffer) {
986
+ return data;
987
+ }
988
+ if (ArrayBuffer.isView(data)) {
989
+ if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
990
+ return data.buffer;
991
+ }
992
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
993
+ }
994
+ if (typeof data === "string") {
995
+ const text = data;
996
+ const uint8Array = new TextEncoder().encode(text);
997
+ return uint8Array.buffer;
998
+ }
999
+ if (data && typeof data === "object" && data._toArrayBuffer) {
1000
+ return data._toArrayBuffer();
1001
+ }
1002
+ throw new Error("toArrayBuffer");
1003
+ }
1004
+ var init_memory_conversion_utils = __esm({
1005
+ "../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts"() {
1006
+ init_buffer_browser();
1007
+ }
1008
+ });
1009
+
1010
+ // ../loader-utils/src/lib/path-utils/get-cwd.ts
1011
+ function getCWD() {
1012
+ if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
1013
+ return process.cwd();
1014
+ }
1015
+ const pathname = window.location?.pathname;
1016
+ return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
1017
+ }
1018
+ var init_get_cwd = __esm({
1019
+ "../loader-utils/src/lib/path-utils/get-cwd.ts"() {
1020
+ }
1021
+ });
1022
+
967
1023
  // ../loader-utils/src/lib/path-utils/path.ts
968
1024
  var path_exports = {};
969
1025
  __export(path_exports, {
970
1026
  dirname: () => dirname,
971
1027
  filename: () => filename,
972
- join: () => join
1028
+ join: () => join,
1029
+ resolve: () => resolve
973
1030
  });
974
1031
  function filename(url) {
975
- const slashIndex = url && url.lastIndexOf("/");
1032
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
976
1033
  return slashIndex >= 0 ? url.substr(slashIndex + 1) : "";
977
1034
  }
978
1035
  function dirname(url) {
979
- const slashIndex = url && url.lastIndexOf("/");
1036
+ const slashIndex = url ? url.lastIndexOf("/") : -1;
980
1037
  return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
981
1038
  }
982
1039
  function join(...parts) {
@@ -992,8 +1049,112 @@
992
1049
  });
993
1050
  return parts.join(separator);
994
1051
  }
1052
+ function resolve(...components) {
1053
+ const paths = [];
1054
+ for (let _i = 0; _i < components.length; _i++) {
1055
+ paths[_i] = components[_i];
1056
+ }
1057
+ let resolvedPath = "";
1058
+ let resolvedAbsolute = false;
1059
+ let cwd;
1060
+ for (let i2 = paths.length - 1; i2 >= -1 && !resolvedAbsolute; i2--) {
1061
+ let path;
1062
+ if (i2 >= 0) {
1063
+ path = paths[i2];
1064
+ } else {
1065
+ if (cwd === void 0) {
1066
+ cwd = getCWD();
1067
+ }
1068
+ path = cwd;
1069
+ }
1070
+ if (path.length === 0) {
1071
+ continue;
1072
+ }
1073
+ resolvedPath = `${path}/${resolvedPath}`;
1074
+ resolvedAbsolute = path.charCodeAt(0) === SLASH;
1075
+ }
1076
+ resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
1077
+ if (resolvedAbsolute) {
1078
+ return `/${resolvedPath}`;
1079
+ } else if (resolvedPath.length > 0) {
1080
+ return resolvedPath;
1081
+ }
1082
+ return ".";
1083
+ }
1084
+ function normalizeStringPosix(path, allowAboveRoot) {
1085
+ let res = "";
1086
+ let lastSlash = -1;
1087
+ let dots = 0;
1088
+ let code;
1089
+ let isAboveRoot = false;
1090
+ for (let i2 = 0; i2 <= path.length; ++i2) {
1091
+ if (i2 < path.length) {
1092
+ code = path.charCodeAt(i2);
1093
+ } else if (code === SLASH) {
1094
+ break;
1095
+ } else {
1096
+ code = SLASH;
1097
+ }
1098
+ if (code === SLASH) {
1099
+ if (lastSlash === i2 - 1 || dots === 1) {
1100
+ } else if (lastSlash !== i2 - 1 && dots === 2) {
1101
+ if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
1102
+ if (res.length > 2) {
1103
+ const start = res.length - 1;
1104
+ let j = start;
1105
+ for (; j >= 0; --j) {
1106
+ if (res.charCodeAt(j) === SLASH) {
1107
+ break;
1108
+ }
1109
+ }
1110
+ if (j !== start) {
1111
+ res = j === -1 ? "" : res.slice(0, j);
1112
+ lastSlash = i2;
1113
+ dots = 0;
1114
+ isAboveRoot = false;
1115
+ continue;
1116
+ }
1117
+ } else if (res.length === 2 || res.length === 1) {
1118
+ res = "";
1119
+ lastSlash = i2;
1120
+ dots = 0;
1121
+ isAboveRoot = false;
1122
+ continue;
1123
+ }
1124
+ }
1125
+ if (allowAboveRoot) {
1126
+ if (res.length > 0) {
1127
+ res += "/..";
1128
+ } else {
1129
+ res = "..";
1130
+ }
1131
+ isAboveRoot = true;
1132
+ }
1133
+ } else {
1134
+ const slice = path.slice(lastSlash + 1, i2);
1135
+ if (res.length > 0) {
1136
+ res += `/${slice}`;
1137
+ } else {
1138
+ res = slice;
1139
+ }
1140
+ isAboveRoot = false;
1141
+ }
1142
+ lastSlash = i2;
1143
+ dots = 0;
1144
+ } else if (code === DOT && dots !== -1) {
1145
+ ++dots;
1146
+ } else {
1147
+ dots = -1;
1148
+ }
1149
+ }
1150
+ return res;
1151
+ }
1152
+ var SLASH, DOT;
995
1153
  var init_path = __esm({
996
1154
  "../loader-utils/src/lib/path-utils/path.ts"() {
1155
+ init_get_cwd();
1156
+ SLASH = 47;
1157
+ DOT = 46;
997
1158
  }
998
1159
  });
999
1160
 
@@ -1006,10 +1167,10 @@
1006
1167
  init_parse_json();
1007
1168
  init_array_buffer_utils();
1008
1169
  init_memory_copy_utils();
1009
- init_binary_copy_utils();
1010
- init_encode_utils();
1170
+ init_dataview_copy_utils();
1011
1171
  init_async_iteration();
1012
1172
  init_file_aliases();
1173
+ init_memory_conversion_utils();
1013
1174
  init_path();
1014
1175
  }
1015
1176
  });
@@ -2830,6 +2991,21 @@
2830
2991
  out[7] = a13 * c - a03 * s2;
2831
2992
  return out;
2832
2993
  }
2994
+ function getScaling(out, mat) {
2995
+ var m11 = mat[0];
2996
+ var m12 = mat[1];
2997
+ var m13 = mat[2];
2998
+ var m21 = mat[4];
2999
+ var m22 = mat[5];
3000
+ var m23 = mat[6];
3001
+ var m31 = mat[8];
3002
+ var m32 = mat[9];
3003
+ var m33 = mat[10];
3004
+ out[0] = Math.hypot(m11, m12, m13);
3005
+ out[1] = Math.hypot(m21, m22, m23);
3006
+ out[2] = Math.hypot(m31, m32, m33);
3007
+ return out;
3008
+ }
2833
3009
  function fromQuat2(out, q) {
2834
3010
  var x = q[0], y = q[1], z = q[2], w = q[3];
2835
3011
  var x2 = x + x;
@@ -4413,6 +4589,716 @@
4413
4589
  }
4414
4590
  });
4415
4591
 
4592
+ // ../../node_modules/@math.gl/culling/dist/esm/constants.js
4593
+ var INTERSECTION;
4594
+ var init_constants2 = __esm({
4595
+ "../../node_modules/@math.gl/culling/dist/esm/constants.js"() {
4596
+ INTERSECTION = {
4597
+ OUTSIDE: -1,
4598
+ INTERSECTING: 0,
4599
+ INSIDE: 1
4600
+ };
4601
+ }
4602
+ });
4603
+
4604
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js
4605
+ var scratchVector5, scratchNormal2;
4606
+ var init_axis_aligned_bounding_box = __esm({
4607
+ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/axis-aligned-bounding-box.js"() {
4608
+ init_defineProperty();
4609
+ init_esm();
4610
+ init_constants2();
4611
+ scratchVector5 = new Vector3();
4612
+ scratchNormal2 = new Vector3();
4613
+ }
4614
+ });
4615
+
4616
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js
4617
+ var scratchVector6, scratchVector23, BoundingSphere;
4618
+ var init_bounding_sphere = __esm({
4619
+ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/bounding-sphere.js"() {
4620
+ init_defineProperty();
4621
+ init_esm();
4622
+ init_mat4();
4623
+ init_constants2();
4624
+ scratchVector6 = new Vector3();
4625
+ scratchVector23 = new Vector3();
4626
+ BoundingSphere = class {
4627
+ constructor(center = [0, 0, 0], radius = 0) {
4628
+ _defineProperty(this, "center", void 0);
4629
+ _defineProperty(this, "radius", void 0);
4630
+ this.radius = -0;
4631
+ this.center = new Vector3();
4632
+ this.fromCenterRadius(center, radius);
4633
+ }
4634
+ fromCenterRadius(center, radius) {
4635
+ this.center.from(center);
4636
+ this.radius = radius;
4637
+ return this;
4638
+ }
4639
+ fromCornerPoints(corner, oppositeCorner) {
4640
+ oppositeCorner = scratchVector6.from(oppositeCorner);
4641
+ this.center = new Vector3().from(corner).add(oppositeCorner).scale(0.5);
4642
+ this.radius = this.center.distance(oppositeCorner);
4643
+ return this;
4644
+ }
4645
+ equals(right) {
4646
+ return this === right || Boolean(right) && this.center.equals(right.center) && this.radius === right.radius;
4647
+ }
4648
+ clone() {
4649
+ return new BoundingSphere(this.center, this.radius);
4650
+ }
4651
+ union(boundingSphere) {
4652
+ const leftCenter = this.center;
4653
+ const leftRadius = this.radius;
4654
+ const rightCenter = boundingSphere.center;
4655
+ const rightRadius = boundingSphere.radius;
4656
+ const toRightCenter = scratchVector6.copy(rightCenter).subtract(leftCenter);
4657
+ const centerSeparation = toRightCenter.magnitude();
4658
+ if (leftRadius >= centerSeparation + rightRadius) {
4659
+ return this.clone();
4660
+ }
4661
+ if (rightRadius >= centerSeparation + leftRadius) {
4662
+ return boundingSphere.clone();
4663
+ }
4664
+ const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
4665
+ scratchVector23.copy(toRightCenter).scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation).add(leftCenter);
4666
+ this.center.copy(scratchVector23);
4667
+ this.radius = halfDistanceBetweenTangentPoints;
4668
+ return this;
4669
+ }
4670
+ expand(point) {
4671
+ const scratchPoint = scratchVector6.from(point);
4672
+ const radius = scratchPoint.subtract(this.center).magnitude();
4673
+ if (radius > this.radius) {
4674
+ this.radius = radius;
4675
+ }
4676
+ return this;
4677
+ }
4678
+ transform(transform) {
4679
+ this.center.transform(transform);
4680
+ const scale5 = getScaling(scratchVector6, transform);
4681
+ this.radius = Math.max(scale5[0], Math.max(scale5[1], scale5[2])) * this.radius;
4682
+ return this;
4683
+ }
4684
+ distanceSquaredTo(point) {
4685
+ const d = this.distanceTo(point);
4686
+ return d * d;
4687
+ }
4688
+ distanceTo(point) {
4689
+ const scratchPoint = scratchVector6.from(point);
4690
+ const delta = scratchPoint.subtract(this.center);
4691
+ return Math.max(0, delta.len() - this.radius);
4692
+ }
4693
+ intersectPlane(plane) {
4694
+ const center = this.center;
4695
+ const radius = this.radius;
4696
+ const normal = plane.normal;
4697
+ const distanceToPlane = normal.dot(center) + plane.distance;
4698
+ if (distanceToPlane < -radius) {
4699
+ return INTERSECTION.OUTSIDE;
4700
+ }
4701
+ if (distanceToPlane < radius) {
4702
+ return INTERSECTION.INTERSECTING;
4703
+ }
4704
+ return INTERSECTION.INSIDE;
4705
+ }
4706
+ };
4707
+ }
4708
+ });
4709
+
4710
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js
4711
+ var scratchVector32, scratchOffset, scratchVectorU, scratchVectorV, scratchVectorW, scratchCorner, scratchToCenter, MATRIX3, OrientedBoundingBox;
4712
+ var init_oriented_bounding_box = __esm({
4713
+ "../../node_modules/@math.gl/culling/dist/esm/lib/bounding-volumes/oriented-bounding-box.js"() {
4714
+ init_defineProperty();
4715
+ init_esm();
4716
+ init_bounding_sphere();
4717
+ init_constants2();
4718
+ scratchVector32 = new Vector3();
4719
+ scratchOffset = new Vector3();
4720
+ scratchVectorU = new Vector3();
4721
+ scratchVectorV = new Vector3();
4722
+ scratchVectorW = new Vector3();
4723
+ scratchCorner = new Vector3();
4724
+ scratchToCenter = new Vector3();
4725
+ MATRIX3 = {
4726
+ COLUMN0ROW0: 0,
4727
+ COLUMN0ROW1: 1,
4728
+ COLUMN0ROW2: 2,
4729
+ COLUMN1ROW0: 3,
4730
+ COLUMN1ROW1: 4,
4731
+ COLUMN1ROW2: 5,
4732
+ COLUMN2ROW0: 6,
4733
+ COLUMN2ROW1: 7,
4734
+ COLUMN2ROW2: 8
4735
+ };
4736
+ OrientedBoundingBox = class {
4737
+ constructor(center = [0, 0, 0], halfAxes = [0, 0, 0, 0, 0, 0, 0, 0, 0]) {
4738
+ _defineProperty(this, "center", void 0);
4739
+ _defineProperty(this, "halfAxes", void 0);
4740
+ this.center = new Vector3().from(center);
4741
+ this.halfAxes = new Matrix3(halfAxes);
4742
+ }
4743
+ get halfSize() {
4744
+ const xAxis = this.halfAxes.getColumn(0);
4745
+ const yAxis = this.halfAxes.getColumn(1);
4746
+ const zAxis = this.halfAxes.getColumn(2);
4747
+ return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new Vector3(zAxis).len()];
4748
+ }
4749
+ get quaternion() {
4750
+ const xAxis = this.halfAxes.getColumn(0);
4751
+ const yAxis = this.halfAxes.getColumn(1);
4752
+ const zAxis = this.halfAxes.getColumn(2);
4753
+ const normXAxis = new Vector3(xAxis).normalize();
4754
+ const normYAxis = new Vector3(yAxis).normalize();
4755
+ const normZAxis = new Vector3(zAxis).normalize();
4756
+ return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));
4757
+ }
4758
+ fromCenterHalfSizeQuaternion(center, halfSize, quaternion) {
4759
+ const quaternionObject = new Quaternion(quaternion);
4760
+ const directionsMatrix = new Matrix3().fromQuaternion(quaternionObject);
4761
+ directionsMatrix[0] = directionsMatrix[0] * halfSize[0];
4762
+ directionsMatrix[1] = directionsMatrix[1] * halfSize[0];
4763
+ directionsMatrix[2] = directionsMatrix[2] * halfSize[0];
4764
+ directionsMatrix[3] = directionsMatrix[3] * halfSize[1];
4765
+ directionsMatrix[4] = directionsMatrix[4] * halfSize[1];
4766
+ directionsMatrix[5] = directionsMatrix[5] * halfSize[1];
4767
+ directionsMatrix[6] = directionsMatrix[6] * halfSize[2];
4768
+ directionsMatrix[7] = directionsMatrix[7] * halfSize[2];
4769
+ directionsMatrix[8] = directionsMatrix[8] * halfSize[2];
4770
+ this.center = new Vector3().from(center);
4771
+ this.halfAxes = directionsMatrix;
4772
+ return this;
4773
+ }
4774
+ clone() {
4775
+ return new OrientedBoundingBox(this.center, this.halfAxes);
4776
+ }
4777
+ equals(right) {
4778
+ return this === right || Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes);
4779
+ }
4780
+ getBoundingSphere(result = new BoundingSphere()) {
4781
+ const halfAxes = this.halfAxes;
4782
+ const u = halfAxes.getColumn(0, scratchVectorU);
4783
+ const v = halfAxes.getColumn(1, scratchVectorV);
4784
+ const w = halfAxes.getColumn(2, scratchVectorW);
4785
+ const cornerVector = scratchVector32.copy(u).add(v).add(w);
4786
+ result.center.copy(this.center);
4787
+ result.radius = cornerVector.magnitude();
4788
+ return result;
4789
+ }
4790
+ intersectPlane(plane) {
4791
+ const center = this.center;
4792
+ const normal = plane.normal;
4793
+ const halfAxes = this.halfAxes;
4794
+ const normalX = normal.x;
4795
+ const normalY = normal.y;
4796
+ const normalZ = normal.z;
4797
+ const radEffective = Math.abs(normalX * halfAxes[MATRIX3.COLUMN0ROW0] + normalY * halfAxes[MATRIX3.COLUMN0ROW1] + normalZ * halfAxes[MATRIX3.COLUMN0ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN1ROW0] + normalY * halfAxes[MATRIX3.COLUMN1ROW1] + normalZ * halfAxes[MATRIX3.COLUMN1ROW2]) + Math.abs(normalX * halfAxes[MATRIX3.COLUMN2ROW0] + normalY * halfAxes[MATRIX3.COLUMN2ROW1] + normalZ * halfAxes[MATRIX3.COLUMN2ROW2]);
4798
+ const distanceToPlane = normal.dot(center) + plane.distance;
4799
+ if (distanceToPlane <= -radEffective) {
4800
+ return INTERSECTION.OUTSIDE;
4801
+ } else if (distanceToPlane >= radEffective) {
4802
+ return INTERSECTION.INSIDE;
4803
+ }
4804
+ return INTERSECTION.INTERSECTING;
4805
+ }
4806
+ distanceTo(point) {
4807
+ return Math.sqrt(this.distanceSquaredTo(point));
4808
+ }
4809
+ distanceSquaredTo(point) {
4810
+ const offset = scratchOffset.from(point).subtract(this.center);
4811
+ const halfAxes = this.halfAxes;
4812
+ const u = halfAxes.getColumn(0, scratchVectorU);
4813
+ const v = halfAxes.getColumn(1, scratchVectorV);
4814
+ const w = halfAxes.getColumn(2, scratchVectorW);
4815
+ const uHalf = u.magnitude();
4816
+ const vHalf = v.magnitude();
4817
+ const wHalf = w.magnitude();
4818
+ u.normalize();
4819
+ v.normalize();
4820
+ w.normalize();
4821
+ let distanceSquared = 0;
4822
+ let d;
4823
+ d = Math.abs(offset.dot(u)) - uHalf;
4824
+ if (d > 0) {
4825
+ distanceSquared += d * d;
4826
+ }
4827
+ d = Math.abs(offset.dot(v)) - vHalf;
4828
+ if (d > 0) {
4829
+ distanceSquared += d * d;
4830
+ }
4831
+ d = Math.abs(offset.dot(w)) - wHalf;
4832
+ if (d > 0) {
4833
+ distanceSquared += d * d;
4834
+ }
4835
+ return distanceSquared;
4836
+ }
4837
+ computePlaneDistances(position, direction, result = [-0, -0]) {
4838
+ let minDist = Number.POSITIVE_INFINITY;
4839
+ let maxDist = Number.NEGATIVE_INFINITY;
4840
+ const center = this.center;
4841
+ const halfAxes = this.halfAxes;
4842
+ const u = halfAxes.getColumn(0, scratchVectorU);
4843
+ const v = halfAxes.getColumn(1, scratchVectorV);
4844
+ const w = halfAxes.getColumn(2, scratchVectorW);
4845
+ const corner = scratchCorner.copy(u).add(v).add(w).add(center);
4846
+ const toCenter = scratchToCenter.copy(corner).subtract(position);
4847
+ let mag = direction.dot(toCenter);
4848
+ minDist = Math.min(mag, minDist);
4849
+ maxDist = Math.max(mag, maxDist);
4850
+ corner.copy(center).add(u).add(v).subtract(w);
4851
+ toCenter.copy(corner).subtract(position);
4852
+ mag = direction.dot(toCenter);
4853
+ minDist = Math.min(mag, minDist);
4854
+ maxDist = Math.max(mag, maxDist);
4855
+ corner.copy(center).add(u).subtract(v).add(w);
4856
+ toCenter.copy(corner).subtract(position);
4857
+ mag = direction.dot(toCenter);
4858
+ minDist = Math.min(mag, minDist);
4859
+ maxDist = Math.max(mag, maxDist);
4860
+ corner.copy(center).add(u).subtract(v).subtract(w);
4861
+ toCenter.copy(corner).subtract(position);
4862
+ mag = direction.dot(toCenter);
4863
+ minDist = Math.min(mag, minDist);
4864
+ maxDist = Math.max(mag, maxDist);
4865
+ center.copy(corner).subtract(u).add(v).add(w);
4866
+ toCenter.copy(corner).subtract(position);
4867
+ mag = direction.dot(toCenter);
4868
+ minDist = Math.min(mag, minDist);
4869
+ maxDist = Math.max(mag, maxDist);
4870
+ center.copy(corner).subtract(u).add(v).subtract(w);
4871
+ toCenter.copy(corner).subtract(position);
4872
+ mag = direction.dot(toCenter);
4873
+ minDist = Math.min(mag, minDist);
4874
+ maxDist = Math.max(mag, maxDist);
4875
+ center.copy(corner).subtract(u).subtract(v).add(w);
4876
+ toCenter.copy(corner).subtract(position);
4877
+ mag = direction.dot(toCenter);
4878
+ minDist = Math.min(mag, minDist);
4879
+ maxDist = Math.max(mag, maxDist);
4880
+ center.copy(corner).subtract(u).subtract(v).subtract(w);
4881
+ toCenter.copy(corner).subtract(position);
4882
+ mag = direction.dot(toCenter);
4883
+ minDist = Math.min(mag, minDist);
4884
+ maxDist = Math.max(mag, maxDist);
4885
+ result[0] = minDist;
4886
+ result[1] = maxDist;
4887
+ return result;
4888
+ }
4889
+ transform(transformation) {
4890
+ this.center.transformAsPoint(transformation);
4891
+ const xAxis = this.halfAxes.getColumn(0, scratchVectorU);
4892
+ xAxis.transformAsPoint(transformation);
4893
+ const yAxis = this.halfAxes.getColumn(1, scratchVectorV);
4894
+ yAxis.transformAsPoint(transformation);
4895
+ const zAxis = this.halfAxes.getColumn(2, scratchVectorW);
4896
+ zAxis.transformAsPoint(transformation);
4897
+ this.halfAxes = new Matrix3([...xAxis, ...yAxis, ...zAxis]);
4898
+ return this;
4899
+ }
4900
+ getTransform() {
4901
+ throw new Error("not implemented");
4902
+ }
4903
+ };
4904
+ }
4905
+ });
4906
+
4907
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/plane.js
4908
+ var scratchPosition2, scratchNormal3, Plane;
4909
+ var init_plane = __esm({
4910
+ "../../node_modules/@math.gl/culling/dist/esm/lib/plane.js"() {
4911
+ init_defineProperty();
4912
+ init_esm();
4913
+ scratchPosition2 = new Vector3();
4914
+ scratchNormal3 = new Vector3();
4915
+ Plane = class {
4916
+ constructor(normal = [0, 0, 1], distance = 0) {
4917
+ _defineProperty(this, "normal", void 0);
4918
+ _defineProperty(this, "distance", void 0);
4919
+ this.normal = new Vector3();
4920
+ this.distance = -0;
4921
+ this.fromNormalDistance(normal, distance);
4922
+ }
4923
+ fromNormalDistance(normal, distance) {
4924
+ assert4(Number.isFinite(distance));
4925
+ this.normal.from(normal).normalize();
4926
+ this.distance = distance;
4927
+ return this;
4928
+ }
4929
+ fromPointNormal(point, normal) {
4930
+ point = scratchPosition2.from(point);
4931
+ this.normal.from(normal).normalize();
4932
+ const distance = -this.normal.dot(point);
4933
+ this.distance = distance;
4934
+ return this;
4935
+ }
4936
+ fromCoefficients(a2, b, c, d) {
4937
+ this.normal.set(a2, b, c);
4938
+ assert4(equals(this.normal.len(), 1));
4939
+ this.distance = d;
4940
+ return this;
4941
+ }
4942
+ clone() {
4943
+ return new Plane(this.normal, this.distance);
4944
+ }
4945
+ equals(right) {
4946
+ return equals(this.distance, right.distance) && equals(this.normal, right.normal);
4947
+ }
4948
+ getPointDistance(point) {
4949
+ return this.normal.dot(point) + this.distance;
4950
+ }
4951
+ transform(matrix4) {
4952
+ const normal = scratchNormal3.copy(this.normal).transformAsVector(matrix4).normalize();
4953
+ const point = this.normal.scale(-this.distance).transform(matrix4);
4954
+ return this.fromPointNormal(point, normal);
4955
+ }
4956
+ projectPointOntoPlane(point, result = [0, 0, 0]) {
4957
+ point = scratchPosition2.from(point);
4958
+ const pointDistance = this.getPointDistance(point);
4959
+ const scaledNormal = scratchNormal3.copy(this.normal).scale(pointDistance);
4960
+ return point.subtract(scaledNormal).to(result);
4961
+ }
4962
+ };
4963
+ }
4964
+ });
4965
+
4966
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js
4967
+ var faces, scratchPlaneCenter, scratchPlaneNormal, scratchPlane, CullingVolume;
4968
+ var init_culling_volume = __esm({
4969
+ "../../node_modules/@math.gl/culling/dist/esm/lib/culling-volume.js"() {
4970
+ init_defineProperty();
4971
+ init_esm();
4972
+ init_constants2();
4973
+ init_plane();
4974
+ faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];
4975
+ scratchPlaneCenter = new Vector3();
4976
+ scratchPlaneNormal = new Vector3();
4977
+ scratchPlane = new Plane(new Vector3(1, 0, 0), 0);
4978
+ CullingVolume = class {
4979
+ constructor(planes = []) {
4980
+ _defineProperty(this, "planes", void 0);
4981
+ this.planes = planes;
4982
+ }
4983
+ fromBoundingSphere(boundingSphere) {
4984
+ this.planes.length = 2 * faces.length;
4985
+ const center = boundingSphere.center;
4986
+ const radius = boundingSphere.radius;
4987
+ let planeIndex = 0;
4988
+ for (const faceNormal of faces) {
4989
+ let plane0 = this.planes[planeIndex];
4990
+ let plane1 = this.planes[planeIndex + 1];
4991
+ if (!plane0) {
4992
+ plane0 = this.planes[planeIndex] = new Plane();
4993
+ }
4994
+ if (!plane1) {
4995
+ plane1 = this.planes[planeIndex + 1] = new Plane();
4996
+ }
4997
+ const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);
4998
+ const plane0Distance = -faceNormal.dot(plane0Center);
4999
+ plane0.fromPointNormal(plane0Center, faceNormal);
5000
+ const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);
5001
+ const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();
5002
+ const plane1Distance = -negatedFaceNormal.dot(plane1Center);
5003
+ plane1.fromPointNormal(plane1Center, negatedFaceNormal);
5004
+ planeIndex += 2;
5005
+ }
5006
+ return this;
5007
+ }
5008
+ computeVisibility(boundingVolume) {
5009
+ let intersect = INTERSECTION.INSIDE;
5010
+ for (const plane of this.planes) {
5011
+ const result = boundingVolume.intersectPlane(plane);
5012
+ switch (result) {
5013
+ case INTERSECTION.OUTSIDE:
5014
+ return INTERSECTION.OUTSIDE;
5015
+ case INTERSECTION.INTERSECTING:
5016
+ intersect = INTERSECTION.INTERSECTING;
5017
+ break;
5018
+ default:
5019
+ }
5020
+ }
5021
+ return intersect;
5022
+ }
5023
+ computeVisibilityWithPlaneMask(boundingVolume, parentPlaneMask) {
5024
+ assert4(Number.isFinite(parentPlaneMask), "parentPlaneMask is required.");
5025
+ if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
5026
+ return parentPlaneMask;
5027
+ }
5028
+ let mask = CullingVolume.MASK_INSIDE;
5029
+ const planes = this.planes;
5030
+ for (let k = 0; k < this.planes.length; ++k) {
5031
+ const flag = k < 31 ? 1 << k : 0;
5032
+ if (k < 31 && (parentPlaneMask & flag) === 0) {
5033
+ continue;
5034
+ }
5035
+ const plane = planes[k];
5036
+ const result = boundingVolume.intersectPlane(plane);
5037
+ if (result === INTERSECTION.OUTSIDE) {
5038
+ return CullingVolume.MASK_OUTSIDE;
5039
+ } else if (result === INTERSECTION.INTERSECTING) {
5040
+ mask |= flag;
5041
+ }
5042
+ }
5043
+ return mask;
5044
+ }
5045
+ };
5046
+ _defineProperty(CullingVolume, "MASK_OUTSIDE", 4294967295);
5047
+ _defineProperty(CullingVolume, "MASK_INSIDE", 0);
5048
+ _defineProperty(CullingVolume, "MASK_INDETERMINATE", 2147483647);
5049
+ }
5050
+ });
5051
+
5052
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js
5053
+ var scratchPlaneUpVector, scratchPlaneRightVector, scratchPlaneNearCenter, scratchPlaneFarCenter, scratchPlaneNormal2;
5054
+ var init_perspective_off_center_frustum = __esm({
5055
+ "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-off-center-frustum.js"() {
5056
+ init_defineProperty();
5057
+ init_esm();
5058
+ init_culling_volume();
5059
+ init_plane();
5060
+ scratchPlaneUpVector = new Vector3();
5061
+ scratchPlaneRightVector = new Vector3();
5062
+ scratchPlaneNearCenter = new Vector3();
5063
+ scratchPlaneFarCenter = new Vector3();
5064
+ scratchPlaneNormal2 = new Vector3();
5065
+ }
5066
+ });
5067
+
5068
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js
5069
+ var init_perspective_frustum = __esm({
5070
+ "../../node_modules/@math.gl/culling/dist/esm/lib/perspective-frustum.js"() {
5071
+ init_defineProperty();
5072
+ init_perspective_off_center_frustum();
5073
+ }
5074
+ });
5075
+
5076
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js
5077
+ var fromPointsXMin, fromPointsYMin, fromPointsZMin, fromPointsXMax, fromPointsYMax, fromPointsZMax, fromPointsCurrentPos, fromPointsScratch, fromPointsRitterCenter, fromPointsMinBoxPt, fromPointsMaxBoxPt, fromPointsNaiveCenterScratch, volumeConstant;
5078
+ var init_bounding_sphere_from_points = __esm({
5079
+ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-sphere-from-points.js"() {
5080
+ init_esm();
5081
+ init_bounding_sphere();
5082
+ fromPointsXMin = new Vector3();
5083
+ fromPointsYMin = new Vector3();
5084
+ fromPointsZMin = new Vector3();
5085
+ fromPointsXMax = new Vector3();
5086
+ fromPointsYMax = new Vector3();
5087
+ fromPointsZMax = new Vector3();
5088
+ fromPointsCurrentPos = new Vector3();
5089
+ fromPointsScratch = new Vector3();
5090
+ fromPointsRitterCenter = new Vector3();
5091
+ fromPointsMinBoxPt = new Vector3();
5092
+ fromPointsMaxBoxPt = new Vector3();
5093
+ fromPointsNaiveCenterScratch = new Vector3();
5094
+ volumeConstant = 4 / 3 * Math.PI;
5095
+ }
5096
+ });
5097
+
5098
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js
5099
+ function computeEigenDecomposition(matrix, result = {}) {
5100
+ const EIGEN_TOLERANCE = math_utils_default.EPSILON20;
5101
+ const EIGEN_MAX_SWEEPS = 10;
5102
+ let count = 0;
5103
+ let sweep = 0;
5104
+ const unitaryMatrix = scratchUnitary;
5105
+ const diagonalMatrix = scratchDiagonal;
5106
+ unitaryMatrix.identity();
5107
+ diagonalMatrix.copy(matrix);
5108
+ const epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);
5109
+ while (sweep < EIGEN_MAX_SWEEPS && offDiagonalFrobeniusNorm(diagonalMatrix) > epsilon) {
5110
+ shurDecomposition(diagonalMatrix, jMatrix);
5111
+ jMatrixTranspose.copy(jMatrix).transpose();
5112
+ diagonalMatrix.multiplyRight(jMatrix);
5113
+ diagonalMatrix.multiplyLeft(jMatrixTranspose);
5114
+ unitaryMatrix.multiplyRight(jMatrix);
5115
+ if (++count > 2) {
5116
+ ++sweep;
5117
+ count = 0;
5118
+ }
5119
+ }
5120
+ result.unitary = unitaryMatrix.toTarget(result.unitary);
5121
+ result.diagonal = diagonalMatrix.toTarget(result.diagonal);
5122
+ return result;
5123
+ }
5124
+ function computeFrobeniusNorm(matrix) {
5125
+ let norm = 0;
5126
+ for (let i2 = 0; i2 < 9; ++i2) {
5127
+ const temp = matrix[i2];
5128
+ norm += temp * temp;
5129
+ }
5130
+ return Math.sqrt(norm);
5131
+ }
5132
+ function offDiagonalFrobeniusNorm(matrix) {
5133
+ let norm = 0;
5134
+ for (let i2 = 0; i2 < 3; ++i2) {
5135
+ const temp = matrix[scratchMatrix.getElementIndex(colVal[i2], rowVal[i2])];
5136
+ norm += 2 * temp * temp;
5137
+ }
5138
+ return Math.sqrt(norm);
5139
+ }
5140
+ function shurDecomposition(matrix, result) {
5141
+ const tolerance = math_utils_default.EPSILON15;
5142
+ let maxDiagonal = 0;
5143
+ let rotAxis = 1;
5144
+ for (let i2 = 0; i2 < 3; ++i2) {
5145
+ const temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i2], rowVal[i2])]);
5146
+ if (temp > maxDiagonal) {
5147
+ rotAxis = i2;
5148
+ maxDiagonal = temp;
5149
+ }
5150
+ }
5151
+ const p2 = rowVal[rotAxis];
5152
+ const q = colVal[rotAxis];
5153
+ let c = 1;
5154
+ let s2 = 0;
5155
+ if (Math.abs(matrix[scratchMatrix.getElementIndex(q, p2)]) > tolerance) {
5156
+ const qq = matrix[scratchMatrix.getElementIndex(q, q)];
5157
+ const pp = matrix[scratchMatrix.getElementIndex(p2, p2)];
5158
+ const qp = matrix[scratchMatrix.getElementIndex(q, p2)];
5159
+ const tau = (qq - pp) / 2 / qp;
5160
+ let t2;
5161
+ if (tau < 0) {
5162
+ t2 = -1 / (-tau + Math.sqrt(1 + tau * tau));
5163
+ } else {
5164
+ t2 = 1 / (tau + Math.sqrt(1 + tau * tau));
5165
+ }
5166
+ c = 1 / Math.sqrt(1 + t2 * t2);
5167
+ s2 = t2 * c;
5168
+ }
5169
+ Matrix3.IDENTITY.to(result);
5170
+ result[scratchMatrix.getElementIndex(p2, p2)] = result[scratchMatrix.getElementIndex(q, q)] = c;
5171
+ result[scratchMatrix.getElementIndex(q, p2)] = s2;
5172
+ result[scratchMatrix.getElementIndex(p2, q)] = -s2;
5173
+ return result;
5174
+ }
5175
+ var scratchMatrix, scratchUnitary, scratchDiagonal, jMatrix, jMatrixTranspose, rowVal, colVal;
5176
+ var init_compute_eigen_decomposition = __esm({
5177
+ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/compute-eigen-decomposition.js"() {
5178
+ init_esm();
5179
+ scratchMatrix = new Matrix3();
5180
+ scratchUnitary = new Matrix3();
5181
+ scratchDiagonal = new Matrix3();
5182
+ jMatrix = new Matrix3();
5183
+ jMatrixTranspose = new Matrix3();
5184
+ rowVal = [1, 0, 0];
5185
+ colVal = [2, 2, 1];
5186
+ }
5187
+ });
5188
+
5189
+ // ../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js
5190
+ function makeOrientedBoundingBoxFromPoints(positions, result = new OrientedBoundingBox()) {
5191
+ if (!positions || positions.length === 0) {
5192
+ result.halfAxes = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
5193
+ result.center = new Vector3();
5194
+ return result;
5195
+ }
5196
+ const length4 = positions.length;
5197
+ const meanPoint = new Vector3(0, 0, 0);
5198
+ for (const position of positions) {
5199
+ meanPoint.add(position);
5200
+ }
5201
+ const invLength = 1 / length4;
5202
+ meanPoint.multiplyByScalar(invLength);
5203
+ let exx = 0;
5204
+ let exy = 0;
5205
+ let exz = 0;
5206
+ let eyy = 0;
5207
+ let eyz = 0;
5208
+ let ezz = 0;
5209
+ for (const position of positions) {
5210
+ const p2 = scratchVector24.copy(position).subtract(meanPoint);
5211
+ exx += p2.x * p2.x;
5212
+ exy += p2.x * p2.y;
5213
+ exz += p2.x * p2.z;
5214
+ eyy += p2.y * p2.y;
5215
+ eyz += p2.y * p2.z;
5216
+ ezz += p2.z * p2.z;
5217
+ }
5218
+ exx *= invLength;
5219
+ exy *= invLength;
5220
+ exz *= invLength;
5221
+ eyy *= invLength;
5222
+ eyz *= invLength;
5223
+ ezz *= invLength;
5224
+ const covarianceMatrix = scratchCovarianceResult;
5225
+ covarianceMatrix[0] = exx;
5226
+ covarianceMatrix[1] = exy;
5227
+ covarianceMatrix[2] = exz;
5228
+ covarianceMatrix[3] = exy;
5229
+ covarianceMatrix[4] = eyy;
5230
+ covarianceMatrix[5] = eyz;
5231
+ covarianceMatrix[6] = exz;
5232
+ covarianceMatrix[7] = eyz;
5233
+ covarianceMatrix[8] = ezz;
5234
+ const {
5235
+ unitary
5236
+ } = computeEigenDecomposition(covarianceMatrix, scratchEigenResult);
5237
+ const rotation = result.halfAxes.copy(unitary);
5238
+ let v1 = rotation.getColumn(0, scratchVector42);
5239
+ let v2 = rotation.getColumn(1, scratchVector52);
5240
+ let v3 = rotation.getColumn(2, scratchVector62);
5241
+ let u1 = -Number.MAX_VALUE;
5242
+ let u2 = -Number.MAX_VALUE;
5243
+ let u3 = -Number.MAX_VALUE;
5244
+ let l1 = Number.MAX_VALUE;
5245
+ let l2 = Number.MAX_VALUE;
5246
+ let l3 = Number.MAX_VALUE;
5247
+ for (const position of positions) {
5248
+ scratchVector24.copy(position);
5249
+ u1 = Math.max(scratchVector24.dot(v1), u1);
5250
+ u2 = Math.max(scratchVector24.dot(v2), u2);
5251
+ u3 = Math.max(scratchVector24.dot(v3), u3);
5252
+ l1 = Math.min(scratchVector24.dot(v1), l1);
5253
+ l2 = Math.min(scratchVector24.dot(v2), l2);
5254
+ l3 = Math.min(scratchVector24.dot(v3), l3);
5255
+ }
5256
+ v1 = v1.multiplyByScalar(0.5 * (l1 + u1));
5257
+ v2 = v2.multiplyByScalar(0.5 * (l2 + u2));
5258
+ v3 = v3.multiplyByScalar(0.5 * (l3 + u3));
5259
+ result.center.copy(v1).add(v2).add(v3);
5260
+ const scale5 = scratchVector33.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);
5261
+ const scaleMatrix = new Matrix3([scale5[0], 0, 0, 0, scale5[1], 0, 0, 0, scale5[2]]);
5262
+ result.halfAxes.multiplyRight(scaleMatrix);
5263
+ return result;
5264
+ }
5265
+ var scratchVector24, scratchVector33, scratchVector42, scratchVector52, scratchVector62, scratchCovarianceResult, scratchEigenResult;
5266
+ var init_bounding_box_from_points = __esm({
5267
+ "../../node_modules/@math.gl/culling/dist/esm/lib/algorithms/bounding-box-from-points.js"() {
5268
+ init_esm();
5269
+ init_compute_eigen_decomposition();
5270
+ init_oriented_bounding_box();
5271
+ init_axis_aligned_bounding_box();
5272
+ scratchVector24 = new Vector3();
5273
+ scratchVector33 = new Vector3();
5274
+ scratchVector42 = new Vector3();
5275
+ scratchVector52 = new Vector3();
5276
+ scratchVector62 = new Vector3();
5277
+ scratchCovarianceResult = new Matrix3();
5278
+ scratchEigenResult = {
5279
+ diagonal: new Matrix3(),
5280
+ unitary: new Matrix3()
5281
+ };
5282
+ }
5283
+ });
5284
+
5285
+ // ../../node_modules/@math.gl/culling/dist/esm/index.js
5286
+ var init_esm3 = __esm({
5287
+ "../../node_modules/@math.gl/culling/dist/esm/index.js"() {
5288
+ init_constants2();
5289
+ init_axis_aligned_bounding_box();
5290
+ init_bounding_sphere();
5291
+ init_oriented_bounding_box();
5292
+ init_culling_volume();
5293
+ init_plane();
5294
+ init_perspective_off_center_frustum();
5295
+ init_perspective_frustum();
5296
+ init_bounding_sphere_from_points();
5297
+ init_bounding_box_from_points();
5298
+ init_compute_eigen_decomposition();
5299
+ }
5300
+ });
5301
+
4416
5302
  // ../core/src/javascript-utils/is-type.ts
4417
5303
  var isBoolean, isFunction, isObject, isPureObject, isIterable, isAsyncIterable, isResponse, isBlob, isBuffer2, isReadableDOMStream, isReadableNodeStream, isReadableStream;
4418
5304
  var init_is_type = __esm({
@@ -4564,9 +5450,9 @@
4564
5450
  }
4565
5451
  if (resource instanceof Blob) {
4566
5452
  const blobSlice = resource.slice(0, 5);
4567
- return await new Promise((resolve) => {
5453
+ return await new Promise((resolve2) => {
4568
5454
  const reader = new FileReader();
4569
- reader.onload = (event) => resolve(event?.target?.result);
5455
+ reader.onload = (event) => resolve2(event?.target?.result);
4570
5456
  reader.readAsDataURL(blobSlice);
4571
5457
  });
4572
5458
  }
@@ -4611,12 +5497,12 @@
4611
5497
  }
4612
5498
  });
4613
5499
 
4614
- // ../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js
5500
+ // ../core/node_modules/@probe.gl/env/dist/lib/is-electron.js
4615
5501
  function isElectron(mockUserAgent) {
4616
5502
  if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") {
4617
5503
  return true;
4618
5504
  }
4619
- if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions.electron)) {
5505
+ if (typeof process !== "undefined" && typeof process.versions === "object" && Boolean(process.versions["electron"])) {
4620
5506
  return true;
4621
5507
  }
4622
5508
  const realUserAgent = typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent;
@@ -4627,59 +5513,54 @@
4627
5513
  return false;
4628
5514
  }
4629
5515
  var init_is_electron = __esm({
4630
- "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js"() {
5516
+ "../core/node_modules/@probe.gl/env/dist/lib/is-electron.js"() {
4631
5517
  }
4632
5518
  });
4633
5519
 
4634
- // ../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js
5520
+ // ../core/node_modules/@probe.gl/env/dist/lib/is-browser.js
4635
5521
  function isBrowser3() {
4636
5522
  const isNode = typeof process === "object" && String(process) === "[object process]" && !process.browser;
4637
5523
  return !isNode || isElectron();
4638
5524
  }
4639
5525
  var init_is_browser = __esm({
4640
- "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js"() {
5526
+ "../core/node_modules/@probe.gl/env/dist/lib/is-browser.js"() {
4641
5527
  init_is_electron();
4642
5528
  }
4643
5529
  });
4644
5530
 
4645
- // ../../node_modules/@probe.gl/env/dist/esm/lib/globals.js
4646
- var globals3, self_3, window_3, document_3, process_;
5531
+ // ../core/node_modules/@probe.gl/env/dist/lib/globals.js
5532
+ var self2, window2, document2, process2, console2, navigator2;
4647
5533
  var init_globals3 = __esm({
4648
- "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js"() {
4649
- globals3 = {
4650
- self: typeof self !== "undefined" && self,
4651
- window: typeof window !== "undefined" && window,
4652
- global: typeof global !== "undefined" && global,
4653
- document: typeof document !== "undefined" && document,
4654
- process: typeof process === "object" && process
4655
- };
4656
- self_3 = globals3.self || globals3.window || globals3.global;
4657
- window_3 = globals3.window || globals3.self || globals3.global;
4658
- document_3 = globals3.document || {};
4659
- process_ = globals3.process || {};
5534
+ "../core/node_modules/@probe.gl/env/dist/lib/globals.js"() {
5535
+ self2 = globalThis.self || globalThis.window || globalThis.global;
5536
+ window2 = globalThis.window || globalThis.self || globalThis.global;
5537
+ document2 = globalThis.document || {};
5538
+ process2 = globalThis.process || {};
5539
+ console2 = globalThis.console;
5540
+ navigator2 = globalThis.navigator || {};
4660
5541
  }
4661
5542
  });
4662
5543
 
4663
- // ../../node_modules/@probe.gl/env/dist/esm/utils/globals.js
5544
+ // ../core/node_modules/@probe.gl/env/dist/utils/globals.js
4664
5545
  var VERSION3, isBrowser4;
4665
5546
  var init_globals4 = __esm({
4666
- "../../node_modules/@probe.gl/env/dist/esm/utils/globals.js"() {
5547
+ "../core/node_modules/@probe.gl/env/dist/utils/globals.js"() {
4667
5548
  init_is_browser();
4668
5549
  VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
4669
5550
  isBrowser4 = isBrowser3();
4670
5551
  }
4671
5552
  });
4672
5553
 
4673
- // ../../node_modules/@probe.gl/env/dist/esm/index.js
4674
- var init_esm3 = __esm({
4675
- "../../node_modules/@probe.gl/env/dist/esm/index.js"() {
5554
+ // ../core/node_modules/@probe.gl/env/dist/index.js
5555
+ var init_dist = __esm({
5556
+ "../core/node_modules/@probe.gl/env/dist/index.js"() {
4676
5557
  init_globals4();
4677
5558
  init_globals3();
4678
5559
  init_is_browser();
4679
5560
  }
4680
5561
  });
4681
5562
 
4682
- // ../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js
5563
+ // ../core/node_modules/@probe.gl/log/dist/utils/local-storage.js
4683
5564
  function getStorage(type) {
4684
5565
  try {
4685
5566
  const storage = window[type];
@@ -4693,35 +5574,28 @@
4693
5574
  }
4694
5575
  var LocalStorage;
4695
5576
  var init_local_storage = __esm({
4696
- "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js"() {
5577
+ "../core/node_modules/@probe.gl/log/dist/utils/local-storage.js"() {
4697
5578
  init_defineProperty();
4698
5579
  LocalStorage = class {
4699
- constructor(id) {
4700
- let defaultSettings = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
5580
+ constructor(id, defaultConfig) {
4701
5581
  let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
4702
5582
  _defineProperty(this, "storage", void 0);
4703
5583
  _defineProperty(this, "id", void 0);
4704
- _defineProperty(this, "config", {});
5584
+ _defineProperty(this, "config", void 0);
4705
5585
  this.storage = getStorage(type);
4706
5586
  this.id = id;
4707
- this.config = {};
4708
- Object.assign(this.config, defaultSettings);
5587
+ this.config = defaultConfig;
4709
5588
  this._loadConfiguration();
4710
5589
  }
4711
5590
  getConfiguration() {
4712
5591
  return this.config;
4713
5592
  }
4714
5593
  setConfiguration(configuration) {
4715
- this.config = {};
4716
- return this.updateConfiguration(configuration);
4717
- }
4718
- updateConfiguration(configuration) {
4719
5594
  Object.assign(this.config, configuration);
4720
5595
  if (this.storage) {
4721
5596
  const serialized = JSON.stringify(this.config);
4722
5597
  this.storage.setItem(this.id, serialized);
4723
5598
  }
4724
- return this;
4725
5599
  }
4726
5600
  _loadConfiguration() {
4727
5601
  let configuration = {};
@@ -4736,7 +5610,7 @@
4736
5610
  }
4737
5611
  });
4738
5612
 
4739
- // ../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js
5613
+ // ../core/node_modules/@probe.gl/log/dist/utils/formatters.js
4740
5614
  function formatTime(ms) {
4741
5615
  let formatted;
4742
5616
  if (ms < 10) {
@@ -4767,31 +5641,35 @@
4767
5641
  return ["".concat(message, " %c+"), style];
4768
5642
  }
4769
5643
  var init_formatters = __esm({
4770
- "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js"() {
5644
+ "../core/node_modules/@probe.gl/log/dist/utils/formatters.js"() {
4771
5645
  }
4772
5646
  });
4773
5647
 
4774
- // ../../node_modules/@probe.gl/log/dist/esm/utils/color.js
5648
+ // ../core/node_modules/@probe.gl/log/dist/utils/color.js
4775
5649
  function getColor(color) {
4776
- return typeof color === "string" ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
5650
+ if (typeof color !== "string") {
5651
+ return color;
5652
+ }
5653
+ color = color.toUpperCase();
5654
+ return COLOR[color] || COLOR.WHITE;
4777
5655
  }
4778
5656
  function addColor(string, color, background) {
4779
5657
  if (!isBrowser3 && typeof string === "string") {
4780
5658
  if (color) {
4781
- color = getColor(color);
4782
- string = "[".concat(color, "m").concat(string, "");
5659
+ const colorCode = getColor(color);
5660
+ string = "[".concat(colorCode, "m").concat(string, "");
4783
5661
  }
4784
5662
  if (background) {
4785
- color = getColor(background);
4786
- string = "[".concat(background + 10, "m").concat(string, "");
5663
+ const colorCode = getColor(background);
5664
+ string = "[".concat(colorCode + BACKGROUND_INCREMENT, "m").concat(string, "");
4787
5665
  }
4788
5666
  }
4789
5667
  return string;
4790
5668
  }
4791
- var COLOR;
5669
+ var COLOR, BACKGROUND_INCREMENT;
4792
5670
  var init_color = __esm({
4793
- "../../node_modules/@probe.gl/log/dist/esm/utils/color.js"() {
4794
- init_esm3();
5671
+ "../core/node_modules/@probe.gl/log/dist/utils/color.js"() {
5672
+ init_dist();
4795
5673
  (function(COLOR2) {
4796
5674
  COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
4797
5675
  COLOR2[COLOR2["RED"] = 31] = "RED";
@@ -4810,47 +5688,50 @@
4810
5688
  COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
4811
5689
  COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
4812
5690
  })(COLOR || (COLOR = {}));
5691
+ BACKGROUND_INCREMENT = 10;
4813
5692
  }
4814
5693
  });
4815
5694
 
4816
- // ../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js
5695
+ // ../core/node_modules/@probe.gl/log/dist/utils/autobind.js
4817
5696
  function autobind(obj) {
4818
5697
  let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
4819
5698
  const proto = Object.getPrototypeOf(obj);
4820
5699
  const propNames = Object.getOwnPropertyNames(proto);
5700
+ const object = obj;
4821
5701
  for (const key of propNames) {
4822
- if (typeof obj[key] === "function") {
5702
+ const value = object[key];
5703
+ if (typeof value === "function") {
4823
5704
  if (!predefined.find((name10) => key === name10)) {
4824
- obj[key] = obj[key].bind(obj);
5705
+ object[key] = value.bind(obj);
4825
5706
  }
4826
5707
  }
4827
5708
  }
4828
5709
  }
4829
5710
  var init_autobind = __esm({
4830
- "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js"() {
5711
+ "../core/node_modules/@probe.gl/log/dist/utils/autobind.js"() {
4831
5712
  }
4832
5713
  });
4833
5714
 
4834
- // ../../node_modules/@probe.gl/log/dist/esm/utils/assert.js
5715
+ // ../core/node_modules/@probe.gl/log/dist/utils/assert.js
4835
5716
  function assert5(condition, message) {
4836
5717
  if (!condition) {
4837
5718
  throw new Error(message || "Assertion failed");
4838
5719
  }
4839
5720
  }
4840
5721
  var init_assert4 = __esm({
4841
- "../../node_modules/@probe.gl/log/dist/esm/utils/assert.js"() {
5722
+ "../core/node_modules/@probe.gl/log/dist/utils/assert.js"() {
4842
5723
  }
4843
5724
  });
4844
5725
 
4845
- // ../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js
5726
+ // ../core/node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
4846
5727
  function getHiResTimestamp() {
4847
5728
  let timestamp;
4848
- if (isBrowser3 && "performance" in window_3) {
5729
+ if (isBrowser3() && window2.performance) {
4849
5730
  var _window$performance, _window$performance$n;
4850
- 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);
4851
- } else if ("hrtime" in process_) {
5731
+ timestamp = window2 === null || window2 === void 0 ? void 0 : (_window$performance = window2.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);
5732
+ } else if ("hrtime" in process2) {
4852
5733
  var _process$hrtime;
4853
- const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
5734
+ const timeParts = process2 === null || process2 === void 0 ? void 0 : (_process$hrtime = process2.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process2);
4854
5735
  timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
4855
5736
  } else {
4856
5737
  timestamp = Date.now();
@@ -4858,18 +5739,12 @@
4858
5739
  return timestamp;
4859
5740
  }
4860
5741
  var init_hi_res_timestamp = __esm({
4861
- "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js"() {
4862
- init_esm3();
4863
- }
4864
- });
4865
-
4866
- // (disabled):../../node_modules/@probe.gl/log/dist/esm/node/node-asciify-image
4867
- var init_node_asciify_image = __esm({
4868
- "(disabled):../../node_modules/@probe.gl/log/dist/esm/node/node-asciify-image"() {
5742
+ "../core/node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js"() {
5743
+ init_dist();
4869
5744
  }
4870
5745
  });
4871
5746
 
4872
- // ../../node_modules/@probe.gl/log/dist/esm/log.js
5747
+ // ../core/node_modules/@probe.gl/log/dist/log.js
4873
5748
  function noop() {
4874
5749
  }
4875
5750
  function normalizeLogLevel(logLevel) {
@@ -4935,11 +5810,7 @@
4935
5810
  message = "",
4936
5811
  scale: scale5 = 1
4937
5812
  } = _ref2;
4938
- asciify.nodeAsciifyImage({
4939
- image,
4940
- message,
4941
- scale: scale5
4942
- });
5813
+ console.warn("removed");
4943
5814
  return noop;
4944
5815
  }
4945
5816
  function logImageInBrowser(_ref3) {
@@ -4978,26 +5849,25 @@
4978
5849
  }
4979
5850
  return "empty";
4980
5851
  }
4981
- var originalConsole, DEFAULT_SETTINGS, cache, ONCE, Log;
5852
+ var originalConsole, DEFAULT_LOG_CONFIGURATION, cache, ONCE, Log;
4982
5853
  var init_log = __esm({
4983
- "../../node_modules/@probe.gl/log/dist/esm/log.js"() {
5854
+ "../core/node_modules/@probe.gl/log/dist/log.js"() {
4984
5855
  init_defineProperty();
4985
- init_esm3();
5856
+ init_dist();
4986
5857
  init_local_storage();
4987
5858
  init_formatters();
4988
5859
  init_color();
4989
5860
  init_autobind();
4990
5861
  init_assert4();
4991
5862
  init_hi_res_timestamp();
4992
- init_node_asciify_image();
4993
5863
  originalConsole = {
4994
- debug: isBrowser3 ? console.debug || console.log : console.log,
5864
+ debug: isBrowser3() ? console.debug || console.log : console.log,
4995
5865
  log: console.log,
4996
5866
  info: console.info,
4997
5867
  warn: console.warn,
4998
5868
  error: console.error
4999
5869
  };
5000
- DEFAULT_SETTINGS = {
5870
+ DEFAULT_LOG_CONFIGURATION = {
5001
5871
  enabled: true,
5002
5872
  level: 0
5003
5873
  };
@@ -5020,8 +5890,8 @@
5020
5890
  _defineProperty(this, "userData", {});
5021
5891
  _defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
5022
5892
  this.id = id;
5023
- this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
5024
5893
  this.userData = {};
5894
+ this._storage = new LocalStorage("__probe-".concat(this.id, "__"), DEFAULT_LOG_CONFIGURATION);
5025
5895
  this.timeStamp("".concat(this.id, " started"));
5026
5896
  autobind(this);
5027
5897
  Object.seal(this);
@@ -5055,13 +5925,13 @@
5055
5925
  }
5056
5926
  enable() {
5057
5927
  let enabled = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
5058
- this._storage.updateConfiguration({
5928
+ this._storage.setConfiguration({
5059
5929
  enabled
5060
5930
  });
5061
5931
  return this;
5062
5932
  }
5063
5933
  setLevel(level) {
5064
- this._storage.updateConfiguration({
5934
+ this._storage.setConfiguration({
5065
5935
  level
5066
5936
  });
5067
5937
  return this;
@@ -5070,7 +5940,7 @@
5070
5940
  return this._storage.config[setting];
5071
5941
  }
5072
5942
  set(setting, value) {
5073
- this._storage.updateConfiguration({
5943
+ this._storage.setConfiguration({
5074
5944
  [setting]: value
5075
5945
  });
5076
5946
  }
@@ -5109,9 +5979,6 @@
5109
5979
  return this._getLogFunction(logLevel, message, console.info, arguments);
5110
5980
  }
5111
5981
  once(logLevel, message) {
5112
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
5113
- args[_key - 2] = arguments[_key];
5114
- }
5115
5982
  return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
5116
5983
  }
5117
5984
  table(logLevel, table, columns) {
@@ -5133,7 +6000,7 @@
5133
6000
  if (!this._shouldLog(logLevel || priority)) {
5134
6001
  return noop;
5135
6002
  }
5136
- return isBrowser3 ? logImageInBrowser({
6003
+ return isBrowser3() ? logImageInBrowser({
5137
6004
  image,
5138
6005
  message,
5139
6006
  scale: scale5
@@ -5206,7 +6073,7 @@
5206
6073
  opts.delta = this.getDelta();
5207
6074
  this._deltaTs = getHiResTimestamp();
5208
6075
  const tag = opts.tag || opts.message;
5209
- if (opts.once) {
6076
+ if (opts.once && tag) {
5210
6077
  if (!cache[tag]) {
5211
6078
  cache[tag] = getHiResTimestamp();
5212
6079
  } else {
@@ -5223,13 +6090,13 @@
5223
6090
  }
5224
6091
  });
5225
6092
 
5226
- // ../../node_modules/@probe.gl/log/dist/esm/index.js
5227
- var esm_default;
5228
- var init_esm4 = __esm({
5229
- "../../node_modules/@probe.gl/log/dist/esm/index.js"() {
6093
+ // ../core/node_modules/@probe.gl/log/dist/index.js
6094
+ var dist_default;
6095
+ var init_dist2 = __esm({
6096
+ "../core/node_modules/@probe.gl/log/dist/index.js"() {
5230
6097
  init_log();
5231
6098
  init_log();
5232
- esm_default = new Log({
6099
+ dist_default = new Log({
5233
6100
  id: "@probe.gl/log"
5234
6101
  });
5235
6102
  }
@@ -5239,7 +6106,7 @@
5239
6106
  var probeLog, NullLog, ConsoleLog;
5240
6107
  var init_loggers = __esm({
5241
6108
  "../core/src/lib/loader-utils/loggers.ts"() {
5242
- init_esm4();
6109
+ init_dist2();
5243
6110
  probeLog = new Log({ id: "loaders.gl" });
5244
6111
  NullLog = class {
5245
6112
  log() {
@@ -5337,20 +6204,6 @@
5337
6204
  validateOptions(options, loaders);
5338
6205
  return normalizeOptionsInternal(loader, options, url);
5339
6206
  }
5340
- function getFetchFunction(options, context) {
5341
- const globalOptions = getGlobalLoaderOptions();
5342
- const fetchOptions = options || globalOptions;
5343
- if (typeof fetchOptions.fetch === "function") {
5344
- return fetchOptions.fetch;
5345
- }
5346
- if (isObject(fetchOptions.fetch)) {
5347
- return (url) => fetchFile(url, fetchOptions);
5348
- }
5349
- if (context?.fetch) {
5350
- return context?.fetch;
5351
- }
5352
- return fetchFile;
5353
- }
5354
6207
  function validateOptions(options, loaders) {
5355
6208
  validateOptionsObject(options, null, DEFAULT_LOADER_OPTIONS, REMOVED_LOADER_OPTIONS, loaders);
5356
6209
  for (const loader of loaders) {
@@ -5429,7 +6282,6 @@
5429
6282
  var init_option_utils = __esm({
5430
6283
  "../core/src/lib/loader-utils/option-utils.ts"() {
5431
6284
  init_is_type();
5432
- init_fetch_file();
5433
6285
  init_loggers();
5434
6286
  init_option_defaults();
5435
6287
  getGlobalLoaderOptions = () => {
@@ -5497,7 +6349,7 @@
5497
6349
  var log;
5498
6350
  var init_log2 = __esm({
5499
6351
  "../core/src/lib/utils/log.ts"() {
5500
- init_esm4();
6352
+ init_dist2();
5501
6353
  log = new Log({ id: "loaders.gl" });
5502
6354
  }
5503
6355
  });
@@ -5770,7 +6622,7 @@
5770
6622
  if (done) {
5771
6623
  return;
5772
6624
  }
5773
- yield toArrayBuffer(value);
6625
+ yield toArrayBuffer2(value);
5774
6626
  }
5775
6627
  } catch (error) {
5776
6628
  reader.releaseLock();
@@ -5778,7 +6630,7 @@
5778
6630
  }
5779
6631
  async function* makeNodeStreamIterator(stream, options) {
5780
6632
  for await (const chunk of stream) {
5781
- yield toArrayBuffer(chunk);
6633
+ yield toArrayBuffer2(chunk);
5782
6634
  }
5783
6635
  }
5784
6636
  var init_make_stream_iterator = __esm({
@@ -5879,6 +6731,29 @@
5879
6731
  }
5880
6732
  });
5881
6733
 
6734
+ // ../core/src/lib/loader-utils/get-fetch-function.ts
6735
+ function getFetchFunction(options, context) {
6736
+ const globalOptions = getGlobalLoaderOptions();
6737
+ const fetchOptions = options || globalOptions;
6738
+ if (typeof fetchOptions.fetch === "function") {
6739
+ return fetchOptions.fetch;
6740
+ }
6741
+ if (isObject(fetchOptions.fetch)) {
6742
+ return (url) => fetchFile(url, fetchOptions);
6743
+ }
6744
+ if (context?.fetch) {
6745
+ return context?.fetch;
6746
+ }
6747
+ return fetchFile;
6748
+ }
6749
+ var init_get_fetch_function = __esm({
6750
+ "../core/src/lib/loader-utils/get-fetch-function.ts"() {
6751
+ init_is_type();
6752
+ init_fetch_file();
6753
+ init_option_utils();
6754
+ }
6755
+ });
6756
+
5882
6757
  // ../core/src/lib/loader-utils/loader-context.ts
5883
6758
  function getLoaderContext(context, options, previousContext = null) {
5884
6759
  if (previousContext) {
@@ -5909,7 +6784,7 @@
5909
6784
  }
5910
6785
  var init_loader_context = __esm({
5911
6786
  "../core/src/lib/loader-utils/loader-context.ts"() {
5912
- init_option_utils();
6787
+ init_get_fetch_function();
5913
6788
  }
5914
6789
  });
5915
6790
 
@@ -5994,7 +6869,7 @@
5994
6869
  "../core/src/lib/api/load.ts"() {
5995
6870
  init_is_type();
5996
6871
  init_normalize_loader();
5997
- init_option_utils();
6872
+ init_get_fetch_function();
5998
6873
  init_parse();
5999
6874
  }
6000
6875
  });
@@ -6009,7 +6884,7 @@
6009
6884
 
6010
6885
  // ../tiles/src/constants.ts
6011
6886
  var TILE_REFINEMENT, TILE_TYPE, TILESET_TYPE, LOD_METRIC_TYPE;
6012
- var init_constants2 = __esm({
6887
+ var init_constants3 = __esm({
6013
6888
  "../tiles/src/constants.ts"() {
6014
6889
  TILE_REFINEMENT = {
6015
6890
  ADD: 1,
@@ -6035,7 +6910,7 @@
6035
6910
  // ../tiles/src/index.ts
6036
6911
  var init_src4 = __esm({
6037
6912
  "../tiles/src/index.ts"() {
6038
- init_constants2();
6913
+ init_constants3();
6039
6914
  }
6040
6915
  });
6041
6916
 
@@ -6049,7 +6924,7 @@
6049
6924
 
6050
6925
  // src/lib/constants.ts
6051
6926
  var TILE3D_TYPE, TILE3D_TYPES, MAGIC_ARRAY;
6052
- var init_constants3 = __esm({
6927
+ var init_constants4 = __esm({
6053
6928
  "src/lib/constants.ts"() {
6054
6929
  TILE3D_TYPE = {
6055
6930
  COMPOSITE: "cmpt",
@@ -7126,10 +8001,10 @@
7126
8001
  if (wasmBinary) {
7127
8002
  options.wasmBinary = wasmBinary;
7128
8003
  }
7129
- return new Promise((resolve) => {
8004
+ return new Promise((resolve2) => {
7130
8005
  DracoDecoderModule({
7131
8006
  ...options,
7132
- onModuleLoaded: (draco) => resolve({ draco })
8007
+ onModuleLoaded: (draco) => resolve2({ draco })
7133
8008
  });
7134
8009
  });
7135
8010
  }
@@ -7172,7 +8047,7 @@
7172
8047
 
7173
8048
  // ../math/src/geometry/constants.ts
7174
8049
  var GL_PRIMITIVE_MODE, GL_TYPE, GL2;
7175
- var init_constants4 = __esm({
8050
+ var init_constants5 = __esm({
7176
8051
  "../math/src/geometry/constants.ts"() {
7177
8052
  GL_PRIMITIVE_MODE = {
7178
8053
  POINTS: 0,
@@ -7204,7 +8079,7 @@
7204
8079
  var GL_TYPE_TO_ARRAY_TYPE, NAME_TO_GL_TYPE, ERR_TYPE_CONVERSION, GLType;
7205
8080
  var init_gl_type = __esm({
7206
8081
  "../math/src/geometry/gl/gl-type.ts"() {
7207
- init_constants4();
8082
+ init_constants5();
7208
8083
  GL_TYPE_TO_ARRAY_TYPE = {
7209
8084
  [GL_TYPE.DOUBLE]: Float64Array,
7210
8085
  [GL_TYPE.FLOAT]: Float32Array,
@@ -7327,14 +8202,14 @@
7327
8202
  function octDecode(x, y, result) {
7328
8203
  return octDecodeInRange(x, y, 255, result);
7329
8204
  }
7330
- var RIGHT_SHIFT, scratchVector23, scratchVector32, scratchEncodeVector2, octEncodeScratch, uint8ForceArray;
8205
+ var RIGHT_SHIFT, scratchVector25, scratchVector34, scratchEncodeVector2, octEncodeScratch, uint8ForceArray;
7331
8206
  var init_attribute_compression = __esm({
7332
8207
  "../math/src/geometry/compression/attribute-compression.ts"() {
7333
8208
  init_esm();
7334
8209
  init_assert6();
7335
8210
  RIGHT_SHIFT = 1 / 256;
7336
- scratchVector23 = new Vector2();
7337
- scratchVector32 = new Vector3();
8211
+ scratchVector25 = new Vector2();
8212
+ scratchVector34 = new Vector3();
7338
8213
  scratchEncodeVector2 = new Vector2();
7339
8214
  octEncodeScratch = new Vector2();
7340
8215
  uint8ForceArray = new Uint8Array(1);
@@ -7344,7 +8219,7 @@
7344
8219
  // ../math/src/index.ts
7345
8220
  var init_src7 = __esm({
7346
8221
  "../math/src/index.ts"() {
7347
- init_constants4();
8222
+ init_constants5();
7348
8223
  init_gl_type();
7349
8224
  init_rgb565();
7350
8225
  init_attribute_compression();
@@ -8125,8 +9000,8 @@
8125
9000
  if (tile.isOctEncoded16P) {
8126
9001
  const decodedArray = new Float32Array(tile.pointsLength * 3);
8127
9002
  for (let i2 = 0; i2 < tile.pointsLength; i2++) {
8128
- octDecode(normals[i2 * 2], normals[i2 * 2 + 1], scratchNormal2);
8129
- scratchNormal2.toArray(decodedArray, i2 * 3);
9003
+ octDecode(normals[i2 * 2], normals[i2 * 2 + 1], scratchNormal4);
9004
+ scratchNormal4.toArray(decodedArray, i2 * 3);
8130
9005
  }
8131
9006
  return {
8132
9007
  type: GL2.FLOAT,
@@ -8140,12 +9015,12 @@
8140
9015
  value: normals
8141
9016
  };
8142
9017
  }
8143
- var scratchNormal2;
9018
+ var scratchNormal4;
8144
9019
  var init_normalize_3d_tile_normals = __esm({
8145
9020
  "src/lib/parsers/helpers/normalize-3d-tile-normals.ts"() {
8146
9021
  init_esm();
8147
9022
  init_src7();
8148
- scratchNormal2 = new Vector3();
9023
+ scratchNormal4 = new Vector3();
8149
9024
  }
8150
9025
  });
8151
9026
 
@@ -8166,10 +9041,10 @@
8166
9041
  };
8167
9042
  }
8168
9043
  function decodeQuantizedPositions(tile, positions) {
8169
- const scratchPosition2 = new Vector3();
9044
+ const scratchPosition3 = new Vector3();
8170
9045
  const decodedArray = new Float32Array(tile.pointCount * 3);
8171
9046
  for (let i2 = 0; i2 < tile.pointCount; i2++) {
8172
- scratchPosition2.set(positions[i2 * 3], positions[i2 * 3 + 1], positions[i2 * 3 + 2]).scale(1 / tile.quantizedRange).multiply(tile.quantizedVolumeScale).add(tile.quantizedVolumeOffset).toArray(decodedArray, i2 * 3);
9047
+ scratchPosition3.set(positions[i2 * 3], positions[i2 * 3 + 1], positions[i2 * 3 + 2]).scale(1 / tile.quantizedRange).multiply(tile.quantizedVolumeScale).add(tile.quantizedVolumeOffset).toArray(decodedArray, i2 * 3);
8173
9048
  }
8174
9049
  return decodedArray;
8175
9050
  }
@@ -8422,11 +9297,11 @@
8422
9297
  if (wasmBinary) {
8423
9298
  options.wasmBinary = wasmBinary;
8424
9299
  }
8425
- return new Promise((resolve) => {
9300
+ return new Promise((resolve2) => {
8426
9301
  BasisModule(options).then((module) => {
8427
9302
  const { BasisFile, initializeBasis } = module;
8428
9303
  initializeBasis();
8429
- resolve({ BasisFile });
9304
+ resolve2({ BasisFile });
8430
9305
  });
8431
9306
  });
8432
9307
  }
@@ -8453,11 +9328,11 @@
8453
9328
  if (wasmBinary) {
8454
9329
  options.wasmBinary = wasmBinary;
8455
9330
  }
8456
- return new Promise((resolve) => {
9331
+ return new Promise((resolve2) => {
8457
9332
  BasisEncoderModule(options).then((module) => {
8458
9333
  const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;
8459
9334
  initializeBasis();
8460
- resolve({ BasisFile, KTX2File, BasisEncoder });
9335
+ resolve2({ BasisFile, KTX2File, BasisEncoder });
8461
9336
  });
8462
9337
  });
8463
9338
  }
@@ -8998,9 +9873,9 @@
8998
9873
  await image.decode();
8999
9874
  return image;
9000
9875
  }
9001
- return await new Promise((resolve, reject) => {
9876
+ return await new Promise((resolve2, reject) => {
9002
9877
  try {
9003
- image.onload = () => resolve(image);
9878
+ image.onload = () => resolve2(image);
9004
9879
  image.onerror = (err) => reject(new Error(`Could not load image ${url}: ${err}`));
9005
9880
  } catch (error) {
9006
9881
  reject(error);
@@ -9055,10 +9930,62 @@
9055
9930
  }
9056
9931
  });
9057
9932
 
9933
+ // ../images/src/lib/category-api/parse-isobmff-binary.ts
9934
+ function getISOBMFFMediaType(buffer) {
9935
+ if (!checkString(buffer, "ftyp", 4)) {
9936
+ return null;
9937
+ }
9938
+ if ((buffer[8] & 96) === 0) {
9939
+ return null;
9940
+ }
9941
+ return decodeMajorBrand(buffer);
9942
+ }
9943
+ function decodeMajorBrand(buffer) {
9944
+ const brandMajor = getUTF8String(buffer, 8, 12).replace("\0", " ").trim();
9945
+ switch (brandMajor) {
9946
+ case "avif":
9947
+ case "avis":
9948
+ return { extension: "avif", mimeType: "image/avif" };
9949
+ default:
9950
+ return null;
9951
+ }
9952
+ }
9953
+ function getUTF8String(array, start, end) {
9954
+ return String.fromCharCode(...array.slice(start, end));
9955
+ }
9956
+ function stringToBytes(string) {
9957
+ return [...string].map((character) => character.charCodeAt(0));
9958
+ }
9959
+ function checkString(buffer, header, offset = 0) {
9960
+ const headerBytes = stringToBytes(header);
9961
+ for (let i2 = 0; i2 < headerBytes.length; ++i2) {
9962
+ if (headerBytes[i2] !== buffer[i2 + offset]) {
9963
+ return false;
9964
+ }
9965
+ }
9966
+ return true;
9967
+ }
9968
+ var init_parse_isobmff_binary = __esm({
9969
+ "../images/src/lib/category-api/parse-isobmff-binary.ts"() {
9970
+ }
9971
+ });
9972
+
9058
9973
  // ../images/src/lib/category-api/binary-image-api.ts
9059
9974
  function getBinaryImageMetadata(binaryData) {
9060
9975
  const dataView = toDataView(binaryData);
9061
- return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView);
9976
+ return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView) || getISOBMFFMetadata(dataView);
9977
+ }
9978
+ function getISOBMFFMetadata(binaryData) {
9979
+ const buffer = new Uint8Array(binaryData instanceof DataView ? binaryData.buffer : binaryData);
9980
+ const mediaType = getISOBMFFMediaType(buffer);
9981
+ if (!mediaType) {
9982
+ return null;
9983
+ }
9984
+ return {
9985
+ mimeType: mediaType.mimeType,
9986
+ width: 0,
9987
+ height: 0
9988
+ };
9062
9989
  }
9063
9990
  function getPngMetadata(binaryData) {
9064
9991
  const dataView = toDataView(binaryData);
@@ -9159,6 +10086,7 @@
9159
10086
  var BIG_ENDIAN, LITTLE_ENDIAN;
9160
10087
  var init_binary_image_api = __esm({
9161
10088
  "../images/src/lib/category-api/binary-image-api.ts"() {
10089
+ init_parse_isobmff_binary();
9162
10090
  BIG_ENDIAN = false;
9163
10091
  LITTLE_ENDIAN = true;
9164
10092
  }
@@ -9232,12 +10160,13 @@
9232
10160
  init_version6();
9233
10161
  init_parse_image();
9234
10162
  init_binary_image_api();
9235
- EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg"];
10163
+ EXTENSIONS = ["png", "jpg", "jpeg", "gif", "webp", "bmp", "ico", "svg", "avif"];
9236
10164
  MIME_TYPES = [
9237
10165
  "image/png",
9238
10166
  "image/jpeg",
9239
10167
  "image/gif",
9240
10168
  "image/webp",
10169
+ "image/avif",
9241
10170
  "image/bmp",
9242
10171
  "image/vnd.microsoft.icon",
9243
10172
  "image/svg+xml"
@@ -9263,43 +10192,41 @@
9263
10192
  });
9264
10193
 
9265
10194
  // ../images/src/lib/category-api/image-format.ts
9266
- function _isImageFormatSupported(mimeType) {
9267
- if (mimeTypeSupported[mimeType] === void 0) {
9268
- mimeTypeSupported[mimeType] = checkFormatSupport(mimeType);
10195
+ function isImageFormatSupported(mimeType) {
10196
+ if (mimeTypeSupportedSync[mimeType] === void 0) {
10197
+ const supported = isBrowser ? checkBrowserImageFormatSupport(mimeType) : checkNodeImageFormatSupport(mimeType);
10198
+ mimeTypeSupportedSync[mimeType] = supported;
9269
10199
  }
9270
- return mimeTypeSupported[mimeType];
10200
+ return mimeTypeSupportedSync[mimeType];
9271
10201
  }
9272
- function checkFormatSupport(mimeType) {
10202
+ function checkNodeImageFormatSupport(mimeType) {
10203
+ const NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
10204
+ const { _parseImageNode: _parseImageNode2, _imageFormatsNode = NODE_FORMAT_SUPPORT } = globalThis;
10205
+ return Boolean(_parseImageNode2) && _imageFormatsNode.includes(mimeType);
10206
+ }
10207
+ function checkBrowserImageFormatSupport(mimeType) {
9273
10208
  switch (mimeType) {
10209
+ case "image/avif":
9274
10210
  case "image/webp":
9275
- return checkWebPSupport();
9276
- case "image/svg":
9277
- return isBrowser;
10211
+ return testBrowserImageFormatSupport(mimeType);
9278
10212
  default:
9279
- if (!isBrowser) {
9280
- const { _parseImageNode: _parseImageNode2 } = globalThis;
9281
- return Boolean(_parseImageNode2) && NODE_FORMAT_SUPPORT.includes(mimeType);
9282
- }
9283
10213
  return true;
9284
10214
  }
9285
10215
  }
9286
- function checkWebPSupport() {
9287
- if (!isBrowser) {
9288
- return false;
9289
- }
10216
+ function testBrowserImageFormatSupport(mimeType) {
9290
10217
  try {
9291
10218
  const element = document.createElement("canvas");
9292
- return element.toDataURL("image/webp").indexOf("data:image/webp") === 0;
10219
+ const dataURL = element.toDataURL(mimeType);
10220
+ return dataURL.indexOf(`data:${mimeType}`) === 0;
9293
10221
  } catch {
9294
10222
  return false;
9295
10223
  }
9296
10224
  }
9297
- var NODE_FORMAT_SUPPORT, mimeTypeSupported;
10225
+ var mimeTypeSupportedSync;
9298
10226
  var init_image_format = __esm({
9299
10227
  "../images/src/lib/category-api/image-format.ts"() {
9300
10228
  init_src2();
9301
- NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
9302
- mimeTypeSupported = {};
10229
+ mimeTypeSupportedSync = {};
9303
10230
  }
9304
10231
  });
9305
10232
 
@@ -9638,8 +10565,8 @@
9638
10565
  this.json.scenes.push({ nodes: nodeIndices });
9639
10566
  return this.json.scenes.length - 1;
9640
10567
  }
9641
- addNode(node2) {
9642
- const { meshIndex, matrix } = node2;
10568
+ addNode(node3) {
10569
+ const { meshIndex, matrix } = node3;
9643
10570
  this.json.nodes = this.json.nodes || [];
9644
10571
  const nodeData = { mesh: meshIndex };
9645
10572
  if (matrix) {
@@ -9849,12 +10776,12 @@
9849
10776
  return wasmPromise;
9850
10777
  }
9851
10778
  async function loadWasmModule() {
9852
- let wasm = wasm_base;
10779
+ let wasm2 = wasm_base;
9853
10780
  if (WebAssembly.validate(detector)) {
9854
- wasm = wasm_simd;
10781
+ wasm2 = wasm_simd;
9855
10782
  console.log("Warning: meshopt_decoder is using experimental SIMD support");
9856
10783
  }
9857
- const result = await WebAssembly.instantiate(unpack(wasm), {});
10784
+ const result = await WebAssembly.instantiate(unpack(wasm2), {});
9858
10785
  await result.instance.exports.__wasm_call_ctors();
9859
10786
  return result.instance;
9860
10787
  }
@@ -10084,7 +11011,7 @@
10084
11011
  });
10085
11012
  function preprocess(gltfData, options) {
10086
11013
  const scenegraph = new GLTFScenegraph(gltfData);
10087
- if (!_isImageFormatSupported("image/webp")) {
11014
+ if (!isImageFormatSupported("image/webp")) {
10088
11015
  if (scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)) {
10089
11016
  throw new Error(`gltf: Required extension ${EXT_TEXTURE_WEBP} not supported by browser`);
10090
11017
  }
@@ -10419,9 +11346,9 @@
10419
11346
  const result = new Float32Array(length4);
10420
11347
  for (let i2 = 0; i2 < accessor.count; i2++) {
10421
11348
  const uv = new ArrayType(arrayBuffer, byteOffset + i2 * elementAddressScale, 2);
10422
- scratchVector5.set(uv[0], uv[1], 1);
10423
- scratchVector5.transformByMatrix3(matrix);
10424
- result.set([scratchVector5[0], scratchVector5[1]], i2 * components);
11349
+ scratchVector7.set(uv[0], uv[1], 1);
11350
+ scratchVector7.transformByMatrix3(matrix);
11351
+ result.set([scratchVector7[0], scratchVector7[1]], i2 * components);
10425
11352
  }
10426
11353
  if (originalTexCoord === texCoord) {
10427
11354
  updateGltf(accessor, bufferView, gltfData.buffers, result);
@@ -10479,7 +11406,7 @@
10479
11406
  const scaleMatrix = scratchScaleMatrix.set(scale5[0], 0, 0, 0, scale5[1], 0, 0, 0, 1);
10480
11407
  return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);
10481
11408
  }
10482
- var EXT_MESHOPT_TRANSFORM, name5, scratchVector5, scratchRotationMatrix, scratchScaleMatrix;
11409
+ var EXT_MESHOPT_TRANSFORM, name5, scratchVector7, scratchRotationMatrix, scratchScaleMatrix;
10483
11410
  var init_KHR_texture_transform = __esm({
10484
11411
  "../gltf/src/lib/extensions/KHR_texture_transform.ts"() {
10485
11412
  init_esm();
@@ -10488,7 +11415,7 @@
10488
11415
  init_gltf_scenegraph();
10489
11416
  EXT_MESHOPT_TRANSFORM = "KHR_texture_transform";
10490
11417
  name5 = EXT_MESHOPT_TRANSFORM;
10491
- scratchVector5 = new Vector3();
11418
+ scratchVector7 = new Vector3();
10492
11419
  scratchRotationMatrix = new Matrix3();
10493
11420
  scratchScaleMatrix = new Matrix3();
10494
11421
  }
@@ -10509,12 +11436,12 @@
10509
11436
  gltfScenegraph.json.lights = extension.lights;
10510
11437
  gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);
10511
11438
  }
10512
- for (const node2 of json.nodes || []) {
10513
- const nodeExtension = gltfScenegraph.getObjectExtension(node2, KHR_LIGHTS_PUNCTUAL);
11439
+ for (const node3 of json.nodes || []) {
11440
+ const nodeExtension = gltfScenegraph.getObjectExtension(node3, KHR_LIGHTS_PUNCTUAL);
10514
11441
  if (nodeExtension) {
10515
- node2.light = nodeExtension.light;
11442
+ node3.light = nodeExtension.light;
10516
11443
  }
10517
- gltfScenegraph.removeObjectExtension(node2, KHR_LIGHTS_PUNCTUAL);
11444
+ gltfScenegraph.removeObjectExtension(node3, KHR_LIGHTS_PUNCTUAL);
10518
11445
  }
10519
11446
  }
10520
11447
  async function encode2(gltfData) {
@@ -10528,8 +11455,8 @@
10528
11455
  }
10529
11456
  if (gltfScenegraph.json.lights) {
10530
11457
  for (const light of gltfScenegraph.json.lights) {
10531
- const node2 = light.node;
10532
- gltfScenegraph.addObjectExtension(node2, KHR_LIGHTS_PUNCTUAL, light);
11458
+ const node3 = light.node;
11459
+ gltfScenegraph.addObjectExtension(node3, KHR_LIGHTS_PUNCTUAL, light);
10533
11460
  }
10534
11461
  delete gltfScenegraph.json.lights;
10535
11462
  }
@@ -10920,11 +11847,11 @@
10920
11847
  for (const mesh of json.meshes) {
10921
11848
  this._convertMeshIds(mesh);
10922
11849
  }
10923
- for (const node2 of json.nodes) {
10924
- this._convertNodeIds(node2);
11850
+ for (const node3 of json.nodes) {
11851
+ this._convertNodeIds(node3);
10925
11852
  }
10926
- for (const node2 of json.scenes) {
10927
- this._convertSceneIds(node2);
11853
+ for (const node3 of json.scenes) {
11854
+ this._convertSceneIds(node3);
10928
11855
  }
10929
11856
  }
10930
11857
  _convertTextureIds(texture) {
@@ -10946,17 +11873,17 @@
10946
11873
  }
10947
11874
  }
10948
11875
  }
10949
- _convertNodeIds(node2) {
10950
- if (node2.children) {
10951
- node2.children = node2.children.map((child) => this._convertIdToIndex(child, "node"));
11876
+ _convertNodeIds(node3) {
11877
+ if (node3.children) {
11878
+ node3.children = node3.children.map((child) => this._convertIdToIndex(child, "node"));
10952
11879
  }
10953
- if (node2.meshes) {
10954
- node2.meshes = node2.meshes.map((mesh) => this._convertIdToIndex(mesh, "mesh"));
11880
+ if (node3.meshes) {
11881
+ node3.meshes = node3.meshes.map((mesh) => this._convertIdToIndex(mesh, "mesh"));
10955
11882
  }
10956
11883
  }
10957
11884
  _convertSceneIds(scene) {
10958
11885
  if (scene.nodes) {
10959
- scene.nodes = scene.nodes.map((node2) => this._convertIdToIndex(node2, "node"));
11886
+ scene.nodes = scene.nodes.map((node3) => this._convertIdToIndex(node3, "node"));
10960
11887
  }
10961
11888
  }
10962
11889
  _convertIdsToIndices(json, topLevelArrayName) {
@@ -11099,7 +12026,7 @@
11099
12026
  json.meshes = json.meshes.map((mesh, i2) => this._resolveMesh(mesh, i2));
11100
12027
  }
11101
12028
  if (json.nodes) {
11102
- json.nodes = json.nodes.map((node2, i2) => this._resolveNode(node2, i2));
12029
+ json.nodes = json.nodes.map((node3, i2) => this._resolveNode(node3, i2));
11103
12030
  }
11104
12031
  if (json.skins) {
11105
12032
  json.skins = json.skins.map((skin, i2) => this._resolveSkin(skin, i2));
@@ -11159,31 +12086,31 @@
11159
12086
  }
11160
12087
  _resolveScene(scene, index) {
11161
12088
  scene.id = scene.id || `scene-${index}`;
11162
- scene.nodes = (scene.nodes || []).map((node2) => this.getNode(node2));
12089
+ scene.nodes = (scene.nodes || []).map((node3) => this.getNode(node3));
11163
12090
  return scene;
11164
12091
  }
11165
- _resolveNode(node2, index) {
11166
- node2.id = node2.id || `node-${index}`;
11167
- if (node2.children) {
11168
- node2.children = node2.children.map((child) => this.getNode(child));
12092
+ _resolveNode(node3, index) {
12093
+ node3.id = node3.id || `node-${index}`;
12094
+ if (node3.children) {
12095
+ node3.children = node3.children.map((child) => this.getNode(child));
11169
12096
  }
11170
- if (node2.mesh !== void 0) {
11171
- node2.mesh = this.getMesh(node2.mesh);
11172
- } else if (node2.meshes !== void 0 && node2.meshes.length) {
11173
- node2.mesh = node2.meshes.reduce((accum, meshIndex) => {
12097
+ if (node3.mesh !== void 0) {
12098
+ node3.mesh = this.getMesh(node3.mesh);
12099
+ } else if (node3.meshes !== void 0 && node3.meshes.length) {
12100
+ node3.mesh = node3.meshes.reduce((accum, meshIndex) => {
11174
12101
  const mesh = this.getMesh(meshIndex);
11175
12102
  accum.id = mesh.id;
11176
12103
  accum.primitives = accum.primitives.concat(mesh.primitives);
11177
12104
  return accum;
11178
12105
  }, { primitives: [] });
11179
12106
  }
11180
- if (node2.camera !== void 0) {
11181
- node2.camera = this.getCamera(node2.camera);
12107
+ if (node3.camera !== void 0) {
12108
+ node3.camera = this.getCamera(node3.camera);
11182
12109
  }
11183
- if (node2.skin !== void 0) {
11184
- node2.skin = this.getSkin(node2.skin);
12110
+ if (node3.skin !== void 0) {
12111
+ node3.skin = this.getSkin(node3.skin);
11185
12112
  }
11186
- return node2;
12113
+ return node3;
11187
12114
  }
11188
12115
  _resolveSkin(skin, index) {
11189
12116
  skin.id = skin.id || `skin-${index}`;
@@ -11781,7 +12708,7 @@
11781
12708
  const scratch1 = [];
11782
12709
  const scratch2 = [];
11783
12710
  const scratchVector12 = new Vector3();
11784
- const scratchVector24 = new Vector3();
12711
+ const scratchVector26 = new Vector3();
11785
12712
  for (let i2 = 0; i2 < instancesLength; i2++) {
11786
12713
  let position;
11787
12714
  if (featureTable.hasProperty("POSITION")) {
@@ -11792,7 +12719,7 @@
11792
12719
  if (!quantizedVolumeOffset) {
11793
12720
  throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
11794
12721
  }
11795
- const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3, scratchVector24);
12722
+ const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3, scratchVector26);
11796
12723
  if (!quantizedVolumeScale) {
11797
12724
  throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
11798
12725
  }
@@ -11931,7 +12858,7 @@
11931
12858
  }
11932
12859
  var init_parse_3d_tile = __esm({
11933
12860
  "src/lib/parsers/parse-3d-tile.ts"() {
11934
- init_constants3();
12861
+ init_constants4();
11935
12862
  init_parse_utils();
11936
12863
  init_parse_3d_tile_point_cloud();
11937
12864
  init_parse_3d_tile_batched_model();
@@ -12034,7 +12961,1260 @@
12034
12961
  }
12035
12962
  });
12036
12963
 
12964
+ // ../../node_modules/long/index.js
12965
+ function Long(low, high, unsigned) {
12966
+ this.low = low | 0;
12967
+ this.high = high | 0;
12968
+ this.unsigned = !!unsigned;
12969
+ }
12970
+ function isLong(obj) {
12971
+ return (obj && obj["__isLong__"]) === true;
12972
+ }
12973
+ function ctz32(value) {
12974
+ var c = Math.clz32(value & -value);
12975
+ return value ? 31 - c : c;
12976
+ }
12977
+ function fromInt(value, unsigned) {
12978
+ var obj, cachedObj, cache2;
12979
+ if (unsigned) {
12980
+ value >>>= 0;
12981
+ if (cache2 = 0 <= value && value < 256) {
12982
+ cachedObj = UINT_CACHE[value];
12983
+ if (cachedObj)
12984
+ return cachedObj;
12985
+ }
12986
+ obj = fromBits(value, 0, true);
12987
+ if (cache2)
12988
+ UINT_CACHE[value] = obj;
12989
+ return obj;
12990
+ } else {
12991
+ value |= 0;
12992
+ if (cache2 = -128 <= value && value < 128) {
12993
+ cachedObj = INT_CACHE[value];
12994
+ if (cachedObj)
12995
+ return cachedObj;
12996
+ }
12997
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
12998
+ if (cache2)
12999
+ INT_CACHE[value] = obj;
13000
+ return obj;
13001
+ }
13002
+ }
13003
+ function fromNumber(value, unsigned) {
13004
+ if (isNaN(value))
13005
+ return unsigned ? UZERO : ZERO4;
13006
+ if (unsigned) {
13007
+ if (value < 0)
13008
+ return UZERO;
13009
+ if (value >= TWO_PWR_64_DBL)
13010
+ return MAX_UNSIGNED_VALUE;
13011
+ } else {
13012
+ if (value <= -TWO_PWR_63_DBL)
13013
+ return MIN_VALUE;
13014
+ if (value + 1 >= TWO_PWR_63_DBL)
13015
+ return MAX_VALUE;
13016
+ }
13017
+ if (value < 0)
13018
+ return fromNumber(-value, unsigned).neg();
13019
+ return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
13020
+ }
13021
+ function fromBits(lowBits, highBits, unsigned) {
13022
+ return new Long(lowBits, highBits, unsigned);
13023
+ }
13024
+ function fromString(str, unsigned, radix) {
13025
+ if (str.length === 0)
13026
+ throw Error("empty string");
13027
+ if (typeof unsigned === "number") {
13028
+ radix = unsigned;
13029
+ unsigned = false;
13030
+ } else {
13031
+ unsigned = !!unsigned;
13032
+ }
13033
+ if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
13034
+ return unsigned ? UZERO : ZERO4;
13035
+ radix = radix || 10;
13036
+ if (radix < 2 || 36 < radix)
13037
+ throw RangeError("radix");
13038
+ var p2;
13039
+ if ((p2 = str.indexOf("-")) > 0)
13040
+ throw Error("interior hyphen");
13041
+ else if (p2 === 0) {
13042
+ return fromString(str.substring(1), unsigned, radix).neg();
13043
+ }
13044
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
13045
+ var result = ZERO4;
13046
+ for (var i2 = 0; i2 < str.length; i2 += 8) {
13047
+ var size = Math.min(8, str.length - i2), value = parseInt(str.substring(i2, i2 + size), radix);
13048
+ if (size < 8) {
13049
+ var power = fromNumber(pow_dbl(radix, size));
13050
+ result = result.mul(power).add(fromNumber(value));
13051
+ } else {
13052
+ result = result.mul(radixToPower);
13053
+ result = result.add(fromNumber(value));
13054
+ }
13055
+ }
13056
+ result.unsigned = unsigned;
13057
+ return result;
13058
+ }
13059
+ function fromValue(val, unsigned) {
13060
+ if (typeof val === "number")
13061
+ return fromNumber(val, unsigned);
13062
+ if (typeof val === "string")
13063
+ return fromString(val, unsigned);
13064
+ return fromBits(val.low, val.high, typeof unsigned === "boolean" ? unsigned : val.unsigned);
13065
+ }
13066
+ var wasm, INT_CACHE, UINT_CACHE, pow_dbl, TWO_PWR_16_DBL, TWO_PWR_24_DBL, TWO_PWR_32_DBL, TWO_PWR_64_DBL, TWO_PWR_63_DBL, TWO_PWR_24, ZERO4, UZERO, ONE, UONE, NEG_ONE, MAX_VALUE, MAX_UNSIGNED_VALUE, MIN_VALUE, LongPrototype, long_default;
13067
+ var init_long = __esm({
13068
+ "../../node_modules/long/index.js"() {
13069
+ wasm = null;
13070
+ try {
13071
+ wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([
13072
+ 0,
13073
+ 97,
13074
+ 115,
13075
+ 109,
13076
+ 1,
13077
+ 0,
13078
+ 0,
13079
+ 0,
13080
+ 1,
13081
+ 13,
13082
+ 2,
13083
+ 96,
13084
+ 0,
13085
+ 1,
13086
+ 127,
13087
+ 96,
13088
+ 4,
13089
+ 127,
13090
+ 127,
13091
+ 127,
13092
+ 127,
13093
+ 1,
13094
+ 127,
13095
+ 3,
13096
+ 7,
13097
+ 6,
13098
+ 0,
13099
+ 1,
13100
+ 1,
13101
+ 1,
13102
+ 1,
13103
+ 1,
13104
+ 6,
13105
+ 6,
13106
+ 1,
13107
+ 127,
13108
+ 1,
13109
+ 65,
13110
+ 0,
13111
+ 11,
13112
+ 7,
13113
+ 50,
13114
+ 6,
13115
+ 3,
13116
+ 109,
13117
+ 117,
13118
+ 108,
13119
+ 0,
13120
+ 1,
13121
+ 5,
13122
+ 100,
13123
+ 105,
13124
+ 118,
13125
+ 95,
13126
+ 115,
13127
+ 0,
13128
+ 2,
13129
+ 5,
13130
+ 100,
13131
+ 105,
13132
+ 118,
13133
+ 95,
13134
+ 117,
13135
+ 0,
13136
+ 3,
13137
+ 5,
13138
+ 114,
13139
+ 101,
13140
+ 109,
13141
+ 95,
13142
+ 115,
13143
+ 0,
13144
+ 4,
13145
+ 5,
13146
+ 114,
13147
+ 101,
13148
+ 109,
13149
+ 95,
13150
+ 117,
13151
+ 0,
13152
+ 5,
13153
+ 8,
13154
+ 103,
13155
+ 101,
13156
+ 116,
13157
+ 95,
13158
+ 104,
13159
+ 105,
13160
+ 103,
13161
+ 104,
13162
+ 0,
13163
+ 0,
13164
+ 10,
13165
+ 191,
13166
+ 1,
13167
+ 6,
13168
+ 4,
13169
+ 0,
13170
+ 35,
13171
+ 0,
13172
+ 11,
13173
+ 36,
13174
+ 1,
13175
+ 1,
13176
+ 126,
13177
+ 32,
13178
+ 0,
13179
+ 173,
13180
+ 32,
13181
+ 1,
13182
+ 173,
13183
+ 66,
13184
+ 32,
13185
+ 134,
13186
+ 132,
13187
+ 32,
13188
+ 2,
13189
+ 173,
13190
+ 32,
13191
+ 3,
13192
+ 173,
13193
+ 66,
13194
+ 32,
13195
+ 134,
13196
+ 132,
13197
+ 126,
13198
+ 34,
13199
+ 4,
13200
+ 66,
13201
+ 32,
13202
+ 135,
13203
+ 167,
13204
+ 36,
13205
+ 0,
13206
+ 32,
13207
+ 4,
13208
+ 167,
13209
+ 11,
13210
+ 36,
13211
+ 1,
13212
+ 1,
13213
+ 126,
13214
+ 32,
13215
+ 0,
13216
+ 173,
13217
+ 32,
13218
+ 1,
13219
+ 173,
13220
+ 66,
13221
+ 32,
13222
+ 134,
13223
+ 132,
13224
+ 32,
13225
+ 2,
13226
+ 173,
13227
+ 32,
13228
+ 3,
13229
+ 173,
13230
+ 66,
13231
+ 32,
13232
+ 134,
13233
+ 132,
13234
+ 127,
13235
+ 34,
13236
+ 4,
13237
+ 66,
13238
+ 32,
13239
+ 135,
13240
+ 167,
13241
+ 36,
13242
+ 0,
13243
+ 32,
13244
+ 4,
13245
+ 167,
13246
+ 11,
13247
+ 36,
13248
+ 1,
13249
+ 1,
13250
+ 126,
13251
+ 32,
13252
+ 0,
13253
+ 173,
13254
+ 32,
13255
+ 1,
13256
+ 173,
13257
+ 66,
13258
+ 32,
13259
+ 134,
13260
+ 132,
13261
+ 32,
13262
+ 2,
13263
+ 173,
13264
+ 32,
13265
+ 3,
13266
+ 173,
13267
+ 66,
13268
+ 32,
13269
+ 134,
13270
+ 132,
13271
+ 128,
13272
+ 34,
13273
+ 4,
13274
+ 66,
13275
+ 32,
13276
+ 135,
13277
+ 167,
13278
+ 36,
13279
+ 0,
13280
+ 32,
13281
+ 4,
13282
+ 167,
13283
+ 11,
13284
+ 36,
13285
+ 1,
13286
+ 1,
13287
+ 126,
13288
+ 32,
13289
+ 0,
13290
+ 173,
13291
+ 32,
13292
+ 1,
13293
+ 173,
13294
+ 66,
13295
+ 32,
13296
+ 134,
13297
+ 132,
13298
+ 32,
13299
+ 2,
13300
+ 173,
13301
+ 32,
13302
+ 3,
13303
+ 173,
13304
+ 66,
13305
+ 32,
13306
+ 134,
13307
+ 132,
13308
+ 129,
13309
+ 34,
13310
+ 4,
13311
+ 66,
13312
+ 32,
13313
+ 135,
13314
+ 167,
13315
+ 36,
13316
+ 0,
13317
+ 32,
13318
+ 4,
13319
+ 167,
13320
+ 11,
13321
+ 36,
13322
+ 1,
13323
+ 1,
13324
+ 126,
13325
+ 32,
13326
+ 0,
13327
+ 173,
13328
+ 32,
13329
+ 1,
13330
+ 173,
13331
+ 66,
13332
+ 32,
13333
+ 134,
13334
+ 132,
13335
+ 32,
13336
+ 2,
13337
+ 173,
13338
+ 32,
13339
+ 3,
13340
+ 173,
13341
+ 66,
13342
+ 32,
13343
+ 134,
13344
+ 132,
13345
+ 130,
13346
+ 34,
13347
+ 4,
13348
+ 66,
13349
+ 32,
13350
+ 135,
13351
+ 167,
13352
+ 36,
13353
+ 0,
13354
+ 32,
13355
+ 4,
13356
+ 167,
13357
+ 11
13358
+ ])), {}).exports;
13359
+ } catch (e) {
13360
+ }
13361
+ Long.prototype.__isLong__;
13362
+ Object.defineProperty(Long.prototype, "__isLong__", { value: true });
13363
+ Long.isLong = isLong;
13364
+ INT_CACHE = {};
13365
+ UINT_CACHE = {};
13366
+ Long.fromInt = fromInt;
13367
+ Long.fromNumber = fromNumber;
13368
+ Long.fromBits = fromBits;
13369
+ pow_dbl = Math.pow;
13370
+ Long.fromString = fromString;
13371
+ Long.fromValue = fromValue;
13372
+ TWO_PWR_16_DBL = 1 << 16;
13373
+ TWO_PWR_24_DBL = 1 << 24;
13374
+ TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
13375
+ TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
13376
+ TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
13377
+ TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
13378
+ ZERO4 = fromInt(0);
13379
+ Long.ZERO = ZERO4;
13380
+ UZERO = fromInt(0, true);
13381
+ Long.UZERO = UZERO;
13382
+ ONE = fromInt(1);
13383
+ Long.ONE = ONE;
13384
+ UONE = fromInt(1, true);
13385
+ Long.UONE = UONE;
13386
+ NEG_ONE = fromInt(-1);
13387
+ Long.NEG_ONE = NEG_ONE;
13388
+ MAX_VALUE = fromBits(4294967295 | 0, 2147483647 | 0, false);
13389
+ Long.MAX_VALUE = MAX_VALUE;
13390
+ MAX_UNSIGNED_VALUE = fromBits(4294967295 | 0, 4294967295 | 0, true);
13391
+ Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
13392
+ MIN_VALUE = fromBits(0, 2147483648 | 0, false);
13393
+ Long.MIN_VALUE = MIN_VALUE;
13394
+ LongPrototype = Long.prototype;
13395
+ LongPrototype.toInt = function toInt() {
13396
+ return this.unsigned ? this.low >>> 0 : this.low;
13397
+ };
13398
+ LongPrototype.toNumber = function toNumber() {
13399
+ if (this.unsigned)
13400
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
13401
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
13402
+ };
13403
+ LongPrototype.toString = function toString(radix) {
13404
+ radix = radix || 10;
13405
+ if (radix < 2 || 36 < radix)
13406
+ throw RangeError("radix");
13407
+ if (this.isZero())
13408
+ return "0";
13409
+ if (this.isNegative()) {
13410
+ if (this.eq(MIN_VALUE)) {
13411
+ var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
13412
+ return div.toString(radix) + rem1.toInt().toString(radix);
13413
+ } else
13414
+ return "-" + this.neg().toString(radix);
13415
+ }
13416
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this;
13417
+ var result = "";
13418
+ while (true) {
13419
+ var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix);
13420
+ rem = remDiv;
13421
+ if (rem.isZero())
13422
+ return digits + result;
13423
+ else {
13424
+ while (digits.length < 6)
13425
+ digits = "0" + digits;
13426
+ result = "" + digits + result;
13427
+ }
13428
+ }
13429
+ };
13430
+ LongPrototype.getHighBits = function getHighBits() {
13431
+ return this.high;
13432
+ };
13433
+ LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
13434
+ return this.high >>> 0;
13435
+ };
13436
+ LongPrototype.getLowBits = function getLowBits() {
13437
+ return this.low;
13438
+ };
13439
+ LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
13440
+ return this.low >>> 0;
13441
+ };
13442
+ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
13443
+ if (this.isNegative())
13444
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
13445
+ var val = this.high != 0 ? this.high : this.low;
13446
+ for (var bit = 31; bit > 0; bit--)
13447
+ if ((val & 1 << bit) != 0)
13448
+ break;
13449
+ return this.high != 0 ? bit + 33 : bit + 1;
13450
+ };
13451
+ LongPrototype.isZero = function isZero() {
13452
+ return this.high === 0 && this.low === 0;
13453
+ };
13454
+ LongPrototype.eqz = LongPrototype.isZero;
13455
+ LongPrototype.isNegative = function isNegative() {
13456
+ return !this.unsigned && this.high < 0;
13457
+ };
13458
+ LongPrototype.isPositive = function isPositive() {
13459
+ return this.unsigned || this.high >= 0;
13460
+ };
13461
+ LongPrototype.isOdd = function isOdd() {
13462
+ return (this.low & 1) === 1;
13463
+ };
13464
+ LongPrototype.isEven = function isEven() {
13465
+ return (this.low & 1) === 0;
13466
+ };
13467
+ LongPrototype.equals = function equals3(other) {
13468
+ if (!isLong(other))
13469
+ other = fromValue(other);
13470
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
13471
+ return false;
13472
+ return this.high === other.high && this.low === other.low;
13473
+ };
13474
+ LongPrototype.eq = LongPrototype.equals;
13475
+ LongPrototype.notEquals = function notEquals(other) {
13476
+ return !this.eq(other);
13477
+ };
13478
+ LongPrototype.neq = LongPrototype.notEquals;
13479
+ LongPrototype.ne = LongPrototype.notEquals;
13480
+ LongPrototype.lessThan = function lessThan(other) {
13481
+ return this.comp(other) < 0;
13482
+ };
13483
+ LongPrototype.lt = LongPrototype.lessThan;
13484
+ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
13485
+ return this.comp(other) <= 0;
13486
+ };
13487
+ LongPrototype.lte = LongPrototype.lessThanOrEqual;
13488
+ LongPrototype.le = LongPrototype.lessThanOrEqual;
13489
+ LongPrototype.greaterThan = function greaterThan(other) {
13490
+ return this.comp(other) > 0;
13491
+ };
13492
+ LongPrototype.gt = LongPrototype.greaterThan;
13493
+ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
13494
+ return this.comp(other) >= 0;
13495
+ };
13496
+ LongPrototype.gte = LongPrototype.greaterThanOrEqual;
13497
+ LongPrototype.ge = LongPrototype.greaterThanOrEqual;
13498
+ LongPrototype.compare = function compare(other) {
13499
+ if (!isLong(other))
13500
+ other = fromValue(other);
13501
+ if (this.eq(other))
13502
+ return 0;
13503
+ var thisNeg = this.isNegative(), otherNeg = other.isNegative();
13504
+ if (thisNeg && !otherNeg)
13505
+ return -1;
13506
+ if (!thisNeg && otherNeg)
13507
+ return 1;
13508
+ if (!this.unsigned)
13509
+ return this.sub(other).isNegative() ? -1 : 1;
13510
+ return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
13511
+ };
13512
+ LongPrototype.comp = LongPrototype.compare;
13513
+ LongPrototype.negate = function negate() {
13514
+ if (!this.unsigned && this.eq(MIN_VALUE))
13515
+ return MIN_VALUE;
13516
+ return this.not().add(ONE);
13517
+ };
13518
+ LongPrototype.neg = LongPrototype.negate;
13519
+ LongPrototype.add = function add3(addend) {
13520
+ if (!isLong(addend))
13521
+ addend = fromValue(addend);
13522
+ var a48 = this.high >>> 16;
13523
+ var a32 = this.high & 65535;
13524
+ var a16 = this.low >>> 16;
13525
+ var a00 = this.low & 65535;
13526
+ var b48 = addend.high >>> 16;
13527
+ var b32 = addend.high & 65535;
13528
+ var b16 = addend.low >>> 16;
13529
+ var b00 = addend.low & 65535;
13530
+ var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
13531
+ c00 += a00 + b00;
13532
+ c16 += c00 >>> 16;
13533
+ c00 &= 65535;
13534
+ c16 += a16 + b16;
13535
+ c32 += c16 >>> 16;
13536
+ c16 &= 65535;
13537
+ c32 += a32 + b32;
13538
+ c48 += c32 >>> 16;
13539
+ c32 &= 65535;
13540
+ c48 += a48 + b48;
13541
+ c48 &= 65535;
13542
+ return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
13543
+ };
13544
+ LongPrototype.subtract = function subtract(subtrahend) {
13545
+ if (!isLong(subtrahend))
13546
+ subtrahend = fromValue(subtrahend);
13547
+ return this.add(subtrahend.neg());
13548
+ };
13549
+ LongPrototype.sub = LongPrototype.subtract;
13550
+ LongPrototype.multiply = function multiply4(multiplier) {
13551
+ if (this.isZero())
13552
+ return this;
13553
+ if (!isLong(multiplier))
13554
+ multiplier = fromValue(multiplier);
13555
+ if (wasm) {
13556
+ var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
13557
+ return fromBits(low, wasm["get_high"](), this.unsigned);
13558
+ }
13559
+ if (multiplier.isZero())
13560
+ return this.unsigned ? UZERO : ZERO4;
13561
+ if (this.eq(MIN_VALUE))
13562
+ return multiplier.isOdd() ? MIN_VALUE : ZERO4;
13563
+ if (multiplier.eq(MIN_VALUE))
13564
+ return this.isOdd() ? MIN_VALUE : ZERO4;
13565
+ if (this.isNegative()) {
13566
+ if (multiplier.isNegative())
13567
+ return this.neg().mul(multiplier.neg());
13568
+ else
13569
+ return this.neg().mul(multiplier).neg();
13570
+ } else if (multiplier.isNegative())
13571
+ return this.mul(multiplier.neg()).neg();
13572
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
13573
+ return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
13574
+ var a48 = this.high >>> 16;
13575
+ var a32 = this.high & 65535;
13576
+ var a16 = this.low >>> 16;
13577
+ var a00 = this.low & 65535;
13578
+ var b48 = multiplier.high >>> 16;
13579
+ var b32 = multiplier.high & 65535;
13580
+ var b16 = multiplier.low >>> 16;
13581
+ var b00 = multiplier.low & 65535;
13582
+ var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
13583
+ c00 += a00 * b00;
13584
+ c16 += c00 >>> 16;
13585
+ c00 &= 65535;
13586
+ c16 += a16 * b00;
13587
+ c32 += c16 >>> 16;
13588
+ c16 &= 65535;
13589
+ c16 += a00 * b16;
13590
+ c32 += c16 >>> 16;
13591
+ c16 &= 65535;
13592
+ c32 += a32 * b00;
13593
+ c48 += c32 >>> 16;
13594
+ c32 &= 65535;
13595
+ c32 += a16 * b16;
13596
+ c48 += c32 >>> 16;
13597
+ c32 &= 65535;
13598
+ c32 += a00 * b32;
13599
+ c48 += c32 >>> 16;
13600
+ c32 &= 65535;
13601
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
13602
+ c48 &= 65535;
13603
+ return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
13604
+ };
13605
+ LongPrototype.mul = LongPrototype.multiply;
13606
+ LongPrototype.divide = function divide(divisor) {
13607
+ if (!isLong(divisor))
13608
+ divisor = fromValue(divisor);
13609
+ if (divisor.isZero())
13610
+ throw Error("division by zero");
13611
+ if (wasm) {
13612
+ if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
13613
+ return this;
13614
+ }
13615
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(this.low, this.high, divisor.low, divisor.high);
13616
+ return fromBits(low, wasm["get_high"](), this.unsigned);
13617
+ }
13618
+ if (this.isZero())
13619
+ return this.unsigned ? UZERO : ZERO4;
13620
+ var approx, rem, res;
13621
+ if (!this.unsigned) {
13622
+ if (this.eq(MIN_VALUE)) {
13623
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
13624
+ return MIN_VALUE;
13625
+ else if (divisor.eq(MIN_VALUE))
13626
+ return ONE;
13627
+ else {
13628
+ var halfThis = this.shr(1);
13629
+ approx = halfThis.div(divisor).shl(1);
13630
+ if (approx.eq(ZERO4)) {
13631
+ return divisor.isNegative() ? ONE : NEG_ONE;
13632
+ } else {
13633
+ rem = this.sub(divisor.mul(approx));
13634
+ res = approx.add(rem.div(divisor));
13635
+ return res;
13636
+ }
13637
+ }
13638
+ } else if (divisor.eq(MIN_VALUE))
13639
+ return this.unsigned ? UZERO : ZERO4;
13640
+ if (this.isNegative()) {
13641
+ if (divisor.isNegative())
13642
+ return this.neg().div(divisor.neg());
13643
+ return this.neg().div(divisor).neg();
13644
+ } else if (divisor.isNegative())
13645
+ return this.div(divisor.neg()).neg();
13646
+ res = ZERO4;
13647
+ } else {
13648
+ if (!divisor.unsigned)
13649
+ divisor = divisor.toUnsigned();
13650
+ if (divisor.gt(this))
13651
+ return UZERO;
13652
+ if (divisor.gt(this.shru(1)))
13653
+ return UONE;
13654
+ res = UZERO;
13655
+ }
13656
+ rem = this;
13657
+ while (rem.gte(divisor)) {
13658
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
13659
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48), approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor);
13660
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
13661
+ approx -= delta;
13662
+ approxRes = fromNumber(approx, this.unsigned);
13663
+ approxRem = approxRes.mul(divisor);
13664
+ }
13665
+ if (approxRes.isZero())
13666
+ approxRes = ONE;
13667
+ res = res.add(approxRes);
13668
+ rem = rem.sub(approxRem);
13669
+ }
13670
+ return res;
13671
+ };
13672
+ LongPrototype.div = LongPrototype.divide;
13673
+ LongPrototype.modulo = function modulo(divisor) {
13674
+ if (!isLong(divisor))
13675
+ divisor = fromValue(divisor);
13676
+ if (wasm) {
13677
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(this.low, this.high, divisor.low, divisor.high);
13678
+ return fromBits(low, wasm["get_high"](), this.unsigned);
13679
+ }
13680
+ return this.sub(this.div(divisor).mul(divisor));
13681
+ };
13682
+ LongPrototype.mod = LongPrototype.modulo;
13683
+ LongPrototype.rem = LongPrototype.modulo;
13684
+ LongPrototype.not = function not() {
13685
+ return fromBits(~this.low, ~this.high, this.unsigned);
13686
+ };
13687
+ LongPrototype.countLeadingZeros = function countLeadingZeros() {
13688
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
13689
+ };
13690
+ LongPrototype.clz = LongPrototype.countLeadingZeros;
13691
+ LongPrototype.countTrailingZeros = function countTrailingZeros() {
13692
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
13693
+ };
13694
+ LongPrototype.ctz = LongPrototype.countTrailingZeros;
13695
+ LongPrototype.and = function and(other) {
13696
+ if (!isLong(other))
13697
+ other = fromValue(other);
13698
+ return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
13699
+ };
13700
+ LongPrototype.or = function or(other) {
13701
+ if (!isLong(other))
13702
+ other = fromValue(other);
13703
+ return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
13704
+ };
13705
+ LongPrototype.xor = function xor(other) {
13706
+ if (!isLong(other))
13707
+ other = fromValue(other);
13708
+ return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
13709
+ };
13710
+ LongPrototype.shiftLeft = function shiftLeft(numBits) {
13711
+ if (isLong(numBits))
13712
+ numBits = numBits.toInt();
13713
+ if ((numBits &= 63) === 0)
13714
+ return this;
13715
+ else if (numBits < 32)
13716
+ return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);
13717
+ else
13718
+ return fromBits(0, this.low << numBits - 32, this.unsigned);
13719
+ };
13720
+ LongPrototype.shl = LongPrototype.shiftLeft;
13721
+ LongPrototype.shiftRight = function shiftRight(numBits) {
13722
+ if (isLong(numBits))
13723
+ numBits = numBits.toInt();
13724
+ if ((numBits &= 63) === 0)
13725
+ return this;
13726
+ else if (numBits < 32)
13727
+ return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);
13728
+ else
13729
+ return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
13730
+ };
13731
+ LongPrototype.shr = LongPrototype.shiftRight;
13732
+ LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
13733
+ if (isLong(numBits))
13734
+ numBits = numBits.toInt();
13735
+ if ((numBits &= 63) === 0)
13736
+ return this;
13737
+ if (numBits < 32)
13738
+ return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
13739
+ if (numBits === 32)
13740
+ return fromBits(this.high, 0, this.unsigned);
13741
+ return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
13742
+ };
13743
+ LongPrototype.shru = LongPrototype.shiftRightUnsigned;
13744
+ LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
13745
+ LongPrototype.rotateLeft = function rotateLeft(numBits) {
13746
+ var b;
13747
+ if (isLong(numBits))
13748
+ numBits = numBits.toInt();
13749
+ if ((numBits &= 63) === 0)
13750
+ return this;
13751
+ if (numBits === 32)
13752
+ return fromBits(this.high, this.low, this.unsigned);
13753
+ if (numBits < 32) {
13754
+ b = 32 - numBits;
13755
+ return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
13756
+ }
13757
+ numBits -= 32;
13758
+ b = 32 - numBits;
13759
+ return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
13760
+ };
13761
+ LongPrototype.rotl = LongPrototype.rotateLeft;
13762
+ LongPrototype.rotateRight = function rotateRight(numBits) {
13763
+ var b;
13764
+ if (isLong(numBits))
13765
+ numBits = numBits.toInt();
13766
+ if ((numBits &= 63) === 0)
13767
+ return this;
13768
+ if (numBits === 32)
13769
+ return fromBits(this.high, this.low, this.unsigned);
13770
+ if (numBits < 32) {
13771
+ b = 32 - numBits;
13772
+ return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
13773
+ }
13774
+ numBits -= 32;
13775
+ b = 32 - numBits;
13776
+ return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
13777
+ };
13778
+ LongPrototype.rotr = LongPrototype.rotateRight;
13779
+ LongPrototype.toSigned = function toSigned() {
13780
+ if (!this.unsigned)
13781
+ return this;
13782
+ return fromBits(this.low, this.high, false);
13783
+ };
13784
+ LongPrototype.toUnsigned = function toUnsigned() {
13785
+ if (this.unsigned)
13786
+ return this;
13787
+ return fromBits(this.low, this.high, true);
13788
+ };
13789
+ LongPrototype.toBytes = function toBytes(le) {
13790
+ return le ? this.toBytesLE() : this.toBytesBE();
13791
+ };
13792
+ LongPrototype.toBytesLE = function toBytesLE() {
13793
+ var hi = this.high, lo = this.low;
13794
+ return [
13795
+ lo & 255,
13796
+ lo >>> 8 & 255,
13797
+ lo >>> 16 & 255,
13798
+ lo >>> 24,
13799
+ hi & 255,
13800
+ hi >>> 8 & 255,
13801
+ hi >>> 16 & 255,
13802
+ hi >>> 24
13803
+ ];
13804
+ };
13805
+ LongPrototype.toBytesBE = function toBytesBE() {
13806
+ var hi = this.high, lo = this.low;
13807
+ return [
13808
+ hi >>> 24,
13809
+ hi >>> 16 & 255,
13810
+ hi >>> 8 & 255,
13811
+ hi & 255,
13812
+ lo >>> 24,
13813
+ lo >>> 16 & 255,
13814
+ lo >>> 8 & 255,
13815
+ lo & 255
13816
+ ];
13817
+ };
13818
+ Long.fromBytes = function fromBytes(bytes, unsigned, le) {
13819
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
13820
+ };
13821
+ Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
13822
+ return new Long(bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24, bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24, unsigned);
13823
+ };
13824
+ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
13825
+ return new Long(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned);
13826
+ };
13827
+ long_default = Long;
13828
+ }
13829
+ });
13830
+
13831
+ // src/lib/utils/s2/s2-token-functions.ts
13832
+ function getS2CellIdFromToken(token) {
13833
+ if (token === "X") {
13834
+ token = "";
13835
+ }
13836
+ const paddedToken = token.padEnd(MAXIMUM_TOKEN_LENGTH, "0");
13837
+ return long_default.fromString(paddedToken, true, 16);
13838
+ }
13839
+ function getS2TokenFromCellId(cellId) {
13840
+ if (cellId.isZero()) {
13841
+ return "X";
13842
+ }
13843
+ let numZeroDigits = cellId.countTrailingZeros();
13844
+ const remainder = numZeroDigits % 4;
13845
+ numZeroDigits = (numZeroDigits - remainder) / 4;
13846
+ const trailingZeroHexChars = numZeroDigits;
13847
+ numZeroDigits *= 4;
13848
+ const x = cellId.shiftRightUnsigned(numZeroDigits);
13849
+ const hexString = x.toString(16).replace(/0+$/, "");
13850
+ const zeroString = Array(17 - trailingZeroHexChars - hexString.length).join("0");
13851
+ return zeroString + hexString;
13852
+ }
13853
+ function getS2ChildCellId(cellId, index) {
13854
+ const newLsb = lsb(cellId).shiftRightUnsigned(2);
13855
+ const childCellId = cellId.add(long_default.fromNumber(2 * index + 1 - 4).multiply(newLsb));
13856
+ return childCellId;
13857
+ }
13858
+ function lsb(cellId) {
13859
+ return cellId.and(cellId.not().add(1));
13860
+ }
13861
+ var MAXIMUM_TOKEN_LENGTH;
13862
+ var init_s2_token_functions = __esm({
13863
+ "src/lib/utils/s2/s2-token-functions.ts"() {
13864
+ init_long();
13865
+ MAXIMUM_TOKEN_LENGTH = 16;
13866
+ }
13867
+ });
13868
+
13869
+ // src/lib/utils/s2/s2geometry/s2-geometry.ts
13870
+ function getS2CellFromQuadKey(hilbertQuadkey) {
13871
+ if (hilbertQuadkey.length === 0) {
13872
+ throw new Error(`Invalid Hilbert quad key ${hilbertQuadkey}`);
13873
+ }
13874
+ const parts = hilbertQuadkey.split("/");
13875
+ const face = parseInt(parts[0], 10);
13876
+ const position = parts[1];
13877
+ const maxLevel = position.length;
13878
+ let level = 0;
13879
+ const point = [0, 0];
13880
+ for (let i2 = maxLevel - 1; i2 >= 0; i2--) {
13881
+ level = maxLevel - i2;
13882
+ const bit = position[i2];
13883
+ let rx = 0;
13884
+ let ry = 0;
13885
+ if (bit === "1") {
13886
+ ry = 1;
13887
+ } else if (bit === "2") {
13888
+ rx = 1;
13889
+ ry = 1;
13890
+ } else if (bit === "3") {
13891
+ rx = 1;
13892
+ }
13893
+ const val = Math.pow(2, level - 1);
13894
+ rotateAndFlipQuadrant(val, point, rx, ry);
13895
+ point[0] += val * rx;
13896
+ point[1] += val * ry;
13897
+ }
13898
+ if (face % 2 === 1) {
13899
+ const t2 = point[0];
13900
+ point[0] = point[1];
13901
+ point[1] = t2;
13902
+ }
13903
+ return { face, ij: point, level };
13904
+ }
13905
+ function getS2QuadkeyFromCellId(cellId) {
13906
+ if (cellId.isZero()) {
13907
+ return "";
13908
+ }
13909
+ let bin = cellId.toString(2);
13910
+ while (bin.length < FACE_BITS + POS_BITS) {
13911
+ bin = "0" + bin;
13912
+ }
13913
+ const lsbIndex = bin.lastIndexOf("1");
13914
+ const faceB = bin.substring(0, 3);
13915
+ const posB = bin.substring(3, lsbIndex);
13916
+ const levelN = posB.length / 2;
13917
+ const faceS = long_default.fromString(faceB, true, 2).toString(10);
13918
+ let posS = "";
13919
+ if (levelN !== 0) {
13920
+ posS = long_default.fromString(posB, true, 2).toString(4);
13921
+ while (posS.length < levelN) {
13922
+ posS = "0" + posS;
13923
+ }
13924
+ }
13925
+ return `${faceS}/${posS}`;
13926
+ }
13927
+ function IJToST(ij, level, offsets) {
13928
+ const maxSize = 1 << level;
13929
+ return [(ij[0] + offsets[0]) / maxSize, (ij[1] + offsets[1]) / maxSize];
13930
+ }
13931
+ function singleSTtoUV(st) {
13932
+ if (st >= 0.5) {
13933
+ return 1 / 3 * (4 * st * st - 1);
13934
+ }
13935
+ return 1 / 3 * (1 - 4 * (1 - st) * (1 - st));
13936
+ }
13937
+ function STToUV(st) {
13938
+ return [singleSTtoUV(st[0]), singleSTtoUV(st[1])];
13939
+ }
13940
+ function FaceUVToXYZ(face, [u, v]) {
13941
+ switch (face) {
13942
+ case 0:
13943
+ return [1, u, v];
13944
+ case 1:
13945
+ return [-u, 1, v];
13946
+ case 2:
13947
+ return [-u, -v, 1];
13948
+ case 3:
13949
+ return [-1, -v, -u];
13950
+ case 4:
13951
+ return [v, -1, -u];
13952
+ case 5:
13953
+ return [v, u, -1];
13954
+ default:
13955
+ throw new Error("Invalid face");
13956
+ }
13957
+ }
13958
+ function XYZToLngLat([x, y, z]) {
13959
+ const lat = Math.atan2(z, Math.sqrt(x * x + y * y));
13960
+ const lng = Math.atan2(y, x);
13961
+ return [lng * RADIAN_TO_DEGREE, lat * RADIAN_TO_DEGREE];
13962
+ }
13963
+ function rotateAndFlipQuadrant(n2, point, rx, ry) {
13964
+ if (ry === 0) {
13965
+ if (rx === 1) {
13966
+ point[0] = n2 - 1 - point[0];
13967
+ point[1] = n2 - 1 - point[1];
13968
+ }
13969
+ const x = point[0];
13970
+ point[0] = point[1];
13971
+ point[1] = x;
13972
+ }
13973
+ }
13974
+ function getS2LngLatFromS2Cell(s2Cell) {
13975
+ const st = IJToST(s2Cell.ij, s2Cell.level, [0.5, 0.5]);
13976
+ const uv = STToUV(st);
13977
+ const xyz = FaceUVToXYZ(s2Cell.face, uv);
13978
+ return XYZToLngLat(xyz);
13979
+ }
13980
+ var FACE_BITS, MAX_LEVEL, POS_BITS, RADIAN_TO_DEGREE;
13981
+ var init_s2_geometry = __esm({
13982
+ "src/lib/utils/s2/s2geometry/s2-geometry.ts"() {
13983
+ init_long();
13984
+ FACE_BITS = 3;
13985
+ MAX_LEVEL = 30;
13986
+ POS_BITS = 2 * MAX_LEVEL + 1;
13987
+ RADIAN_TO_DEGREE = 180 / Math.PI;
13988
+ }
13989
+ });
13990
+
13991
+ // src/lib/utils/s2/converters/s2-to-boundary.ts
13992
+ function getS2BoundaryFlatFromS2Cell(s2cell) {
13993
+ const { face, ij, level } = s2cell;
13994
+ const offsets = [
13995
+ [0, 0],
13996
+ [0, 1],
13997
+ [1, 1],
13998
+ [1, 0],
13999
+ [0, 0]
14000
+ ];
14001
+ const resolution = Math.max(1, Math.ceil(MAX_RESOLUTION * Math.pow(2, -level)));
14002
+ const result = new Float64Array(4 * resolution * 2 + 2);
14003
+ let ptIndex = 0;
14004
+ let prevLng = 0;
14005
+ for (let i2 = 0; i2 < 4; i2++) {
14006
+ const offset = offsets[i2].slice(0);
14007
+ const nextOffset = offsets[i2 + 1];
14008
+ const stepI = (nextOffset[0] - offset[0]) / resolution;
14009
+ const stepJ = (nextOffset[1] - offset[1]) / resolution;
14010
+ for (let j = 0; j < resolution; j++) {
14011
+ offset[0] += stepI;
14012
+ offset[1] += stepJ;
14013
+ const st = IJToST(ij, level, offset);
14014
+ const uv = STToUV(st);
14015
+ const xyz = FaceUVToXYZ(face, uv);
14016
+ const lngLat = XYZToLngLat(xyz);
14017
+ if (Math.abs(lngLat[1]) > 89.999) {
14018
+ lngLat[0] = prevLng;
14019
+ }
14020
+ const deltaLng = lngLat[0] - prevLng;
14021
+ lngLat[0] += deltaLng > 180 ? -360 : deltaLng < -180 ? 360 : 0;
14022
+ result[ptIndex++] = lngLat[0];
14023
+ result[ptIndex++] = lngLat[1];
14024
+ prevLng = lngLat[0];
14025
+ }
14026
+ }
14027
+ result[ptIndex++] = result[0];
14028
+ result[ptIndex++] = result[1];
14029
+ return result;
14030
+ }
14031
+ var MAX_RESOLUTION;
14032
+ var init_s2_to_boundary = __esm({
14033
+ "src/lib/utils/s2/converters/s2-to-boundary.ts"() {
14034
+ init_s2_geometry();
14035
+ MAX_RESOLUTION = 100;
14036
+ }
14037
+ });
14038
+
14039
+ // src/lib/utils/s2/s2geometry/s2-cell-utils.ts
14040
+ function getS2Cell(tokenOrKey) {
14041
+ const key = getS2QuadKey(tokenOrKey);
14042
+ const s2cell = getS2CellFromQuadKey(key);
14043
+ return s2cell;
14044
+ }
14045
+ function getS2QuadKey(tokenOrKey) {
14046
+ if (tokenOrKey.indexOf("/") > 0) {
14047
+ return tokenOrKey;
14048
+ }
14049
+ const id = getS2CellIdFromToken(tokenOrKey);
14050
+ return getS2QuadkeyFromCellId(id);
14051
+ }
14052
+ var init_s2_cell_utils = __esm({
14053
+ "src/lib/utils/s2/s2geometry/s2-cell-utils.ts"() {
14054
+ init_s2_geometry();
14055
+ init_s2_token_functions();
14056
+ }
14057
+ });
14058
+
14059
+ // src/lib/utils/s2/s2-geometry-functions.ts
14060
+ function getS2LngLat(s2Token) {
14061
+ const s2cell = getS2Cell(s2Token);
14062
+ return getS2LngLatFromS2Cell(s2cell);
14063
+ }
14064
+ var init_s2_geometry_functions = __esm({
14065
+ "src/lib/utils/s2/s2-geometry-functions.ts"() {
14066
+ init_s2_geometry();
14067
+ init_s2_cell_utils();
14068
+ }
14069
+ });
14070
+
14071
+ // src/lib/utils/s2/converters/s2-to-region.ts
14072
+ function getS2Region(s2cell) {
14073
+ let region;
14074
+ if (s2cell.face === 2 || s2cell.face === 5) {
14075
+ let corners = null;
14076
+ let len2 = 0;
14077
+ for (let i2 = 0; i2 < 4; i2++) {
14078
+ const key = `${s2cell.face}/${i2}`;
14079
+ const cell = getS2Cell(key);
14080
+ const corns = getS2BoundaryFlatFromS2Cell(cell);
14081
+ if (typeof corners === "undefined" || corners === null)
14082
+ corners = new Float64Array(4 * corns.length);
14083
+ corners.set(corns, len2);
14084
+ len2 += corns.length;
14085
+ }
14086
+ region = get2DRegionFromS2Corners(corners);
14087
+ } else {
14088
+ const corners = getS2BoundaryFlatFromS2Cell(s2cell);
14089
+ region = get2DRegionFromS2Corners(corners);
14090
+ }
14091
+ return region;
14092
+ }
14093
+ function get2DRegionFromS2Corners(corners) {
14094
+ if (corners.length % 2 !== 0) {
14095
+ throw new Error("Invalid corners");
14096
+ }
14097
+ const longitudes = [];
14098
+ const latitudes = [];
14099
+ for (let i2 = 0; i2 < corners.length; i2 += 2) {
14100
+ longitudes.push(corners[i2]);
14101
+ latitudes.push(corners[i2 + 1]);
14102
+ }
14103
+ longitudes.sort((a2, b) => a2 - b);
14104
+ latitudes.sort((a2, b) => a2 - b);
14105
+ return {
14106
+ west: longitudes[0],
14107
+ east: longitudes[longitudes.length - 1],
14108
+ north: latitudes[latitudes.length - 1],
14109
+ south: latitudes[0]
14110
+ };
14111
+ }
14112
+ var init_s2_to_region = __esm({
14113
+ "src/lib/utils/s2/converters/s2-to-region.ts"() {
14114
+ init_s2_to_boundary();
14115
+ init_s2_cell_utils();
14116
+ }
14117
+ });
14118
+
14119
+ // src/lib/utils/s2/converters/s2-to-obb-points.ts
14120
+ function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, heightInfo) {
14121
+ const min = heightInfo?.minimumHeight || 0;
14122
+ const max = heightInfo?.maximumHeight || 0;
14123
+ const s2cell = getS2Cell(tokenOrKey);
14124
+ const region = getS2Region(s2cell);
14125
+ const W = region.west;
14126
+ const S = region.south;
14127
+ const E = region.east;
14128
+ const N = region.north;
14129
+ const points = [];
14130
+ points.push(new Vector3(W, N, min));
14131
+ points.push(new Vector3(E, N, min));
14132
+ points.push(new Vector3(E, S, min));
14133
+ points.push(new Vector3(W, S, min));
14134
+ points.push(new Vector3(W, N, max));
14135
+ points.push(new Vector3(E, N, max));
14136
+ points.push(new Vector3(E, S, max));
14137
+ points.push(new Vector3(W, S, max));
14138
+ return points;
14139
+ }
14140
+ var init_s2_to_obb_points = __esm({
14141
+ "src/lib/utils/s2/converters/s2-to-obb-points.ts"() {
14142
+ init_s2_cell_utils();
14143
+ init_s2_to_region();
14144
+ init_esm();
14145
+ }
14146
+ });
14147
+
14148
+ // src/lib/utils/s2/index.ts
14149
+ var init_s2 = __esm({
14150
+ "src/lib/utils/s2/index.ts"() {
14151
+ init_s2_token_functions();
14152
+ init_s2_geometry_functions();
14153
+ init_s2_to_obb_points();
14154
+ }
14155
+ });
14156
+
14157
+ // src/lib/utils/obb/s2-corners-to-obb.ts
14158
+ function convertS2BoundingVolumetoOBB(s2VolumeInfo) {
14159
+ const token = s2VolumeInfo.token;
14160
+ const heightInfo = {
14161
+ minimumHeight: s2VolumeInfo.minimumHeight,
14162
+ maximumHeight: s2VolumeInfo.maximumHeight
14163
+ };
14164
+ const corners = getS2OrientedBoundingBoxCornerPoints(token, heightInfo);
14165
+ const center = getS2LngLat(token);
14166
+ const centerLng = center[0];
14167
+ const centerLat = center[1];
14168
+ const point = Ellipsoid.WGS84.cartographicToCartesian([
14169
+ centerLng,
14170
+ centerLat,
14171
+ heightInfo.maximumHeight
14172
+ ]);
14173
+ const centerPointAdditional = new Vector3(point[0], point[1], point[2]);
14174
+ corners.push(centerPointAdditional);
14175
+ const obb = makeOrientedBoundingBoxFromPoints(corners);
14176
+ const box = [...obb.center, ...obb.halfAxes];
14177
+ return box;
14178
+ }
14179
+ var init_s2_corners_to_obb = __esm({
14180
+ "src/lib/utils/obb/s2-corners-to-obb.ts"() {
14181
+ init_esm();
14182
+ init_esm3();
14183
+ init_s2();
14184
+ init_s2();
14185
+ init_esm2();
14186
+ }
14187
+ });
14188
+
12037
14189
  // src/lib/parsers/helpers/parse-3d-implicit-tiles.ts
14190
+ function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
14191
+ if (s2VolumeBox?.box) {
14192
+ const cellId = getS2CellIdFromToken(s2VolumeBox.s2VolumeInfo.token);
14193
+ const childCellId = getS2ChildCellId(cellId, index);
14194
+ const childToken = getS2TokenFromCellId(childCellId);
14195
+ const s2ChildVolumeInfo = { ...s2VolumeBox.s2VolumeInfo };
14196
+ s2ChildVolumeInfo.token = childToken;
14197
+ switch (subdivisionScheme) {
14198
+ case "OCTREE":
14199
+ const s2VolumeInfo = s2VolumeBox.s2VolumeInfo;
14200
+ const delta = s2VolumeInfo.maximumHeight - s2VolumeInfo.minimumHeight;
14201
+ const sizeZ = delta / 2;
14202
+ const midZ = s2VolumeInfo.minimumHeight + delta / 2;
14203
+ s2VolumeInfo.minimumHeight = midZ - sizeZ;
14204
+ s2VolumeInfo.maximumHeight = midZ + sizeZ;
14205
+ break;
14206
+ default:
14207
+ break;
14208
+ }
14209
+ const box = convertS2BoundingVolumetoOBB(s2ChildVolumeInfo);
14210
+ const childS2VolumeBox = {
14211
+ box,
14212
+ s2VolumeInfo: s2ChildVolumeInfo
14213
+ };
14214
+ return childS2VolumeBox;
14215
+ }
14216
+ return void 0;
14217
+ }
12038
14218
  async function parseImplicitTiles(params) {
12039
14219
  const {
12040
14220
  options,
@@ -12051,7 +14231,8 @@
12051
14231
  x: 0,
12052
14232
  y: 0,
12053
14233
  z: 0
12054
- }
14234
+ },
14235
+ s2VolumeBox
12055
14236
  } = params;
12056
14237
  let { subtree, level = 0 } = params;
12057
14238
  const {
@@ -12109,18 +14290,20 @@
12109
14290
  const childTileLevel = level + 1;
12110
14291
  const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
12111
14292
  for (let index = 0; index < childrenPerTile; index++) {
12112
- const currentTile = await parseImplicitTiles({
14293
+ const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
14294
+ const childTileParsed = await parseImplicitTiles({
12113
14295
  subtree,
12114
14296
  options,
12115
14297
  parentData: pData,
12116
14298
  childIndex: index,
12117
14299
  level: childTileLevel,
12118
- globalData
14300
+ globalData,
14301
+ s2VolumeBox: childS2VolumeBox
12119
14302
  });
12120
- if (currentTile.contentUrl || currentTile.children.length) {
14303
+ if (childTileParsed.contentUrl || childTileParsed.children.length) {
12121
14304
  const globalLevel = lev + 1;
12122
14305
  const childCoordinates = { childTileX, childTileY, childTileZ };
12123
- const formattedTile = formatTileData(currentTile, globalLevel, childCoordinates, options);
14306
+ const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, options, s2VolumeBox);
12124
14307
  tile.children.push(formattedTile);
12125
14308
  }
12126
14309
  }
@@ -12135,7 +14318,7 @@
12135
14318
  }
12136
14319
  return false;
12137
14320
  }
12138
- function formatTileData(tile, level, childCoordinates, options) {
14321
+ function formatTileData(tile, level, childCoordinates, options, s2VolumeBox) {
12139
14322
  const {
12140
14323
  basePath,
12141
14324
  refine,
@@ -12147,7 +14330,8 @@
12147
14330
  } = options;
12148
14331
  const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
12149
14332
  const lodMetricValue = rootLodMetricValue / 2 ** level;
12150
- const boundingVolume = calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoordinates);
14333
+ const boundingVolume = s2VolumeBox?.box ? { box: s2VolumeBox.box } : rootBoundingVolume;
14334
+ const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(level, boundingVolume, childCoordinates);
12151
14335
  return {
12152
14336
  children: tile.children,
12153
14337
  contentUrl: tile.contentUrl,
@@ -12159,7 +14343,7 @@
12159
14343
  lodMetricValue,
12160
14344
  geometricError: lodMetricValue,
12161
14345
  transform: tile.transform,
12162
- boundingVolume
14346
+ boundingVolume: boundingVolumeForChildTile
12163
14347
  };
12164
14348
  }
12165
14349
  function calculateBoundingVolumeForChildTile(level, rootBoundingVolume, childCoordinates) {
@@ -12180,8 +14364,10 @@
12180
14364
  region: [childWest, childSouth, childEast, childNorth, childMinimumHeight, childMaximumHeight]
12181
14365
  };
12182
14366
  }
12183
- console.warn("Unsupported bounding volume type: ", rootBoundingVolume);
12184
- return null;
14367
+ if (rootBoundingVolume.box) {
14368
+ return rootBoundingVolume;
14369
+ }
14370
+ throw new Error(`Unsupported bounding volume type ${rootBoundingVolume}`);
12185
14371
  }
12186
14372
  function concatBits(first, second) {
12187
14373
  return parseInt(first.toString(2) + second.toString(2), 2);
@@ -12208,6 +14394,8 @@
12208
14394
  "src/lib/parsers/helpers/parse-3d-implicit-tiles.ts"() {
12209
14395
  init_tile_3d_subtree_loader();
12210
14396
  init_src3();
14397
+ init_s2();
14398
+ init_s2_corners_to_obb();
12211
14399
  QUADTREE_DEVISION_COUNT = 4;
12212
14400
  OCTREE_DEVISION_COUNT = 8;
12213
14401
  SUBDIVISION_COUNT_MAP = {
@@ -12314,6 +14502,12 @@
12314
14502
  const contentUrlTemplate = resolveUri(tile.content.uri, basePath);
12315
14503
  const refine = tileset?.root?.refine;
12316
14504
  const rootLodMetricValue = tile.geometricError;
14505
+ const s2VolumeInfo = tile.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];
14506
+ if (s2VolumeInfo) {
14507
+ const box = convertS2BoundingVolumetoOBB(s2VolumeInfo);
14508
+ const s2VolumeBox = { box, s2VolumeInfo };
14509
+ tile.boundingVolume = s2VolumeBox;
14510
+ }
12317
14511
  const rootBoundingVolume = tile.boundingVolume;
12318
14512
  const implicitOptions = {
12319
14513
  contentUrlTemplate,
@@ -12338,7 +14532,11 @@
12338
14532
  tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
12339
14533
  tile.lodMetricValue = tile.geometricError;
12340
14534
  tile.transformMatrix = tile.transform;
12341
- const { children, contentUrl } = await parseImplicitTiles({ subtree: rootSubtree, options });
14535
+ const { children, contentUrl } = await parseImplicitTiles({
14536
+ subtree: rootSubtree,
14537
+ options,
14538
+ s2VolumeBox: tile
14539
+ });
12342
14540
  if (contentUrl) {
12343
14541
  tile.contentUrl = contentUrl;
12344
14542
  tile.content = { uri: contentUrl.replace(`${options.basePath}/`, "") };
@@ -12358,6 +14556,7 @@
12358
14556
  init_src3();
12359
14557
  init_src4();
12360
14558
  init_parse_3d_implicit_tiles();
14559
+ init_s2_corners_to_obb();
12361
14560
  }
12362
14561
  });
12363
14562
 
@@ -12570,7 +14769,7 @@
12570
14769
  }
12571
14770
  var init_encode_3d_tile_composite = __esm({
12572
14771
  "src/lib/encoders/encode-3d-tile-composite.ts"() {
12573
- init_constants3();
14772
+ init_constants4();
12574
14773
  init_encode_3d_tile_header();
12575
14774
  }
12576
14775
  });
@@ -12609,7 +14808,7 @@
12609
14808
  var init_encode_3d_tile_batched_model = __esm({
12610
14809
  "src/lib/encoders/encode-3d-tile-batched-model.ts"() {
12611
14810
  init_src2();
12612
- init_constants3();
14811
+ init_constants4();
12613
14812
  init_encode_3d_tile_header();
12614
14813
  }
12615
14814
  });
@@ -12643,7 +14842,7 @@
12643
14842
  var init_encode_3d_tile_instanced_model = __esm({
12644
14843
  "src/lib/encoders/encode-3d-tile-instanced-model.ts"() {
12645
14844
  init_src2();
12646
- init_constants3();
14845
+ init_constants4();
12647
14846
  init_encode_3d_tile_header();
12648
14847
  }
12649
14848
  });
@@ -12674,7 +14873,7 @@
12674
14873
  var DEFAULT_FEATURE_TABLE_JSON;
12675
14874
  var init_encode_3d_tile_point_cloud = __esm({
12676
14875
  "src/lib/encoders/encode-3d-tile-point-cloud.ts"() {
12677
- init_constants3();
14876
+ init_constants4();
12678
14877
  init_encode_3d_tile_header();
12679
14878
  init_src2();
12680
14879
  DEFAULT_FEATURE_TABLE_JSON = {
@@ -12711,7 +14910,7 @@
12711
14910
  }
12712
14911
  var init_encode_3d_tile = __esm({
12713
14912
  "src/lib/encoders/encode-3d-tile.ts"() {
12714
- init_constants3();
14913
+ init_constants4();
12715
14914
  init_src2();
12716
14915
  init_encode_3d_tile_composite();
12717
14916
  init_encode_3d_tile_batched_model();
@@ -12765,7 +14964,7 @@
12765
14964
  init_tile_3d_writer();
12766
14965
  init_tile_3d_feature_table();
12767
14966
  init_tile_3d_batch_table();
12768
- init_constants3();
14967
+ init_constants4();
12769
14968
  init_ion();
12770
14969
  }
12771
14970
  });
@@ -12780,3 +14979,22 @@
12780
14979
  });
12781
14980
  require_bundle();
12782
14981
  })();
14982
+ /**
14983
+ * @license
14984
+ * Copyright 2009 The Closure Library Authors
14985
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
14986
+ *
14987
+ * Licensed under the Apache License, Version 2.0 (the "License");
14988
+ * you may not use this file except in compliance with the License.
14989
+ * You may obtain a copy of the License at
14990
+ *
14991
+ * http://www.apache.org/licenses/LICENSE-2.0
14992
+ *
14993
+ * Unless required by applicable law or agreed to in writing, software
14994
+ * distributed under the License is distributed on an "AS IS" BASIS,
14995
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14996
+ * See the License for the specific language governing permissions and
14997
+ * limitations under the License.
14998
+ *
14999
+ * SPDX-License-Identifier: Apache-2.0
15000
+ */