@deck.gl/geo-layers 9.0.0-alpha.7 → 9.0.0-beta.10

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 (263) hide show
  1. package/dist/dist.dev.js +2574 -5044
  2. package/dist/geo-cell-layer/GeoCellLayer.js +51 -0
  3. package/{typed → dist}/geohash-layer/geohash-layer.d.ts +1 -1
  4. package/dist/geohash-layer/geohash-layer.d.ts.map +1 -0
  5. package/dist/geohash-layer/geohash-layer.js +19 -0
  6. package/dist/geohash-layer/geohash-utils.js +50 -0
  7. package/dist/great-circle-layer/great-circle-layer.js +12 -0
  8. package/{typed → dist}/h3-layers/h3-cluster-layer.d.ts +1 -1
  9. package/dist/h3-layers/h3-cluster-layer.d.ts.map +1 -0
  10. package/dist/h3-layers/h3-cluster-layer.js +47 -0
  11. package/dist/h3-layers/h3-hexagon-layer.js +204 -0
  12. package/dist/h3-layers/h3-utils.js +56 -0
  13. package/dist/index.cjs +3160 -0
  14. package/dist/index.cjs.map +7 -0
  15. package/dist/index.d.ts +31 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +36 -0
  18. package/dist/mesh-layer/mesh-layer-fragment.glsl.d.ts +3 -0
  19. package/{typed → dist}/mesh-layer/mesh-layer-fragment.glsl.d.ts.map +1 -1
  20. package/dist/mesh-layer/mesh-layer-fragment.glsl.js +33 -0
  21. package/dist/mesh-layer/mesh-layer-vertex.glsl.js +63 -0
  22. package/{typed → dist}/mesh-layer/mesh-layer.d.ts.map +1 -1
  23. package/dist/mesh-layer/mesh-layer.js +128 -0
  24. package/{typed → dist}/mvt-layer/coordinate-transform.d.ts +1 -1
  25. package/{typed → dist}/mvt-layer/coordinate-transform.d.ts.map +1 -1
  26. package/dist/mvt-layer/coordinate-transform.js +41 -0
  27. package/dist/mvt-layer/find-index-binary.d.ts +11 -0
  28. package/dist/mvt-layer/find-index-binary.d.ts.map +1 -0
  29. package/dist/mvt-layer/find-index-binary.js +96 -0
  30. package/{typed → dist}/mvt-layer/mvt-layer.d.ts +13 -11
  31. package/dist/mvt-layer/mvt-layer.d.ts.map +1 -0
  32. package/dist/mvt-layer/mvt-layer.js +305 -0
  33. package/{typed → dist}/quadkey-layer/quadkey-layer.d.ts +1 -1
  34. package/dist/quadkey-layer/quadkey-layer.d.ts.map +1 -0
  35. package/dist/quadkey-layer/quadkey-layer.js +22 -0
  36. package/dist/quadkey-layer/quadkey-utils.js +26 -0
  37. package/dist/s2-layer/s2-geometry.js +123 -0
  38. package/{typed → dist}/s2-layer/s2-layer.d.ts +1 -1
  39. package/dist/s2-layer/s2-layer.d.ts.map +1 -0
  40. package/dist/s2-layer/s2-layer.js +38 -0
  41. package/dist/s2-layer/s2-utils.js +87 -0
  42. package/{typed → dist}/terrain-layer/terrain-layer.d.ts +4 -4
  43. package/dist/terrain-layer/terrain-layer.d.ts.map +1 -0
  44. package/dist/terrain-layer/terrain-layer.js +233 -0
  45. package/{typed → dist}/tile-3d-layer/tile-3d-layer.d.ts +15 -1
  46. package/{typed → dist}/tile-3d-layer/tile-3d-layer.d.ts.map +1 -1
  47. package/dist/tile-3d-layer/tile-3d-layer.js +302 -0
  48. package/{typed → dist}/tile-layer/tile-layer.d.ts +14 -5
  49. package/dist/tile-layer/tile-layer.d.ts.map +1 -0
  50. package/dist/tile-layer/tile-layer.js +207 -0
  51. package/dist/tileset-2d/index.d.ts +7 -0
  52. package/dist/tileset-2d/index.d.ts.map +1 -0
  53. package/dist/tileset-2d/index.js +4 -0
  54. package/dist/tileset-2d/memoize.js +41 -0
  55. package/{typed → dist}/tileset-2d/tile-2d-header.d.ts +3 -2
  56. package/dist/tileset-2d/tile-2d-header.d.ts.map +1 -0
  57. package/dist/tileset-2d/tile-2d-header.js +135 -0
  58. package/dist/tileset-2d/tile-2d-traversal.d.ts +4 -0
  59. package/dist/tileset-2d/tile-2d-traversal.d.ts.map +1 -0
  60. package/dist/tileset-2d/tile-2d-traversal.js +182 -0
  61. package/{typed → dist}/tileset-2d/tileset-2d.d.ts +9 -7
  62. package/dist/tileset-2d/tileset-2d.d.ts.map +1 -0
  63. package/dist/tileset-2d/tileset-2d.js +458 -0
  64. package/dist/tileset-2d/types.js +1 -0
  65. package/{typed → dist}/tileset-2d/utils.d.ts +3 -3
  66. package/dist/tileset-2d/utils.d.ts.map +1 -0
  67. package/dist/tileset-2d/utils.js +234 -0
  68. package/{typed → dist}/trips-layer/trips-layer.d.ts +1 -1
  69. package/{typed → dist}/trips-layer/trips-layer.d.ts.map +1 -1
  70. package/dist/trips-layer/trips-layer.js +93 -0
  71. package/dist/wms-layer/utils.js +13 -0
  72. package/dist/wms-layer/wms-layer.js +192 -0
  73. package/dist.min.js +243 -564
  74. package/package.json +30 -23
  75. package/src/index.ts +7 -7
  76. package/src/mesh-layer/mesh-layer-fragment.glsl.ts +1 -9
  77. package/src/mesh-layer/mesh-layer.ts +1 -2
  78. package/src/mvt-layer/coordinate-transform.ts +1 -1
  79. package/src/mvt-layer/find-index-binary.ts +5 -9
  80. package/src/mvt-layer/mvt-layer.ts +36 -25
  81. package/src/terrain-layer/terrain-layer.ts +13 -3
  82. package/src/tile-3d-layer/tile-3d-layer.ts +1 -2
  83. package/src/tile-layer/tile-layer.ts +30 -14
  84. package/src/tileset-2d/tile-2d-header.ts +2 -1
  85. package/src/tileset-2d/tile-2d-traversal.ts +1 -1
  86. package/src/tileset-2d/tileset-2d.ts +14 -7
  87. package/src/tileset-2d/utils.ts +2 -2
  88. package/src/trips-layer/trips-layer.ts +1 -1
  89. package/src/wms-layer/wms-layer.ts +1 -1
  90. package/dist/es5/geo-cell-layer/GeoCellLayer.js +0 -118
  91. package/dist/es5/geo-cell-layer/GeoCellLayer.js.map +0 -1
  92. package/dist/es5/geohash-layer/geohash-layer.js +0 -67
  93. package/dist/es5/geohash-layer/geohash-layer.js.map +0 -1
  94. package/dist/es5/geohash-layer/geohash-utils.js +0 -77
  95. package/dist/es5/geohash-layer/geohash-utils.js.map +0 -1
  96. package/dist/es5/great-circle-layer/great-circle-layer.js +0 -48
  97. package/dist/es5/great-circle-layer/great-circle-layer.js.map +0 -1
  98. package/dist/es5/h3-layers/h3-cluster-layer.js +0 -162
  99. package/dist/es5/h3-layers/h3-cluster-layer.js.map +0 -1
  100. package/dist/es5/h3-layers/h3-hexagon-layer.js +0 -351
  101. package/dist/es5/h3-layers/h3-hexagon-layer.js.map +0 -1
  102. package/dist/es5/h3-layers/h3-utils.js +0 -111
  103. package/dist/es5/h3-layers/h3-utils.js.map +0 -1
  104. package/dist/es5/index.js +0 -132
  105. package/dist/es5/index.js.map +0 -1
  106. package/dist/es5/mesh-layer/mesh-layer-fragment.glsl.js +0 -9
  107. package/dist/es5/mesh-layer/mesh-layer-fragment.glsl.js.map +0 -1
  108. package/dist/es5/mesh-layer/mesh-layer-vertex.glsl.js +0 -9
  109. package/dist/es5/mesh-layer/mesh-layer-vertex.glsl.js.map +0 -1
  110. package/dist/es5/mesh-layer/mesh-layer.js +0 -217
  111. package/dist/es5/mesh-layer/mesh-layer.js.map +0 -1
  112. package/dist/es5/mvt-layer/coordinate-transform.js +0 -83
  113. package/dist/es5/mvt-layer/coordinate-transform.js.map +0 -1
  114. package/dist/es5/mvt-layer/find-index-binary.js +0 -127
  115. package/dist/es5/mvt-layer/find-index-binary.js.map +0 -1
  116. package/dist/es5/mvt-layer/mvt-layer.js +0 -533
  117. package/dist/es5/mvt-layer/mvt-layer.js.map +0 -1
  118. package/dist/es5/quadkey-layer/quadkey-layer.js +0 -72
  119. package/dist/es5/quadkey-layer/quadkey-layer.js.map +0 -1
  120. package/dist/es5/quadkey-layer/quadkey-utils.js +0 -53
  121. package/dist/es5/quadkey-layer/quadkey-utils.js.map +0 -1
  122. package/dist/es5/s2-layer/s2-geometry.js +0 -158
  123. package/dist/es5/s2-layer/s2-geometry.js.map +0 -1
  124. package/dist/es5/s2-layer/s2-layer.js +0 -67
  125. package/dist/es5/s2-layer/s2-layer.js.map +0 -1
  126. package/dist/es5/s2-layer/s2-utils.js +0 -80
  127. package/dist/es5/s2-layer/s2-utils.js.map +0 -1
  128. package/dist/es5/terrain-layer/terrain-layer.js +0 -347
  129. package/dist/es5/terrain-layer/terrain-layer.js.map +0 -1
  130. package/dist/es5/tile-3d-layer/tile-3d-layer.js +0 -511
  131. package/dist/es5/tile-3d-layer/tile-3d-layer.js.map +0 -1
  132. package/dist/es5/tile-layer/tile-layer.js +0 -363
  133. package/dist/es5/tile-layer/tile-layer.js.map +0 -1
  134. package/dist/es5/tileset-2d/index.js +0 -66
  135. package/dist/es5/tileset-2d/index.js.map +0 -1
  136. package/dist/es5/tileset-2d/memoize.js +0 -47
  137. package/dist/es5/tileset-2d/memoize.js.map +0 -1
  138. package/dist/es5/tileset-2d/tile-2d-header.js +0 -250
  139. package/dist/es5/tileset-2d/tile-2d-header.js.map +0 -1
  140. package/dist/es5/tileset-2d/tile-2d-traversal.js +0 -256
  141. package/dist/es5/tileset-2d/tile-2d-traversal.js.map +0 -1
  142. package/dist/es5/tileset-2d/tileset-2d.js +0 -757
  143. package/dist/es5/tileset-2d/tileset-2d.js.map +0 -1
  144. package/dist/es5/tileset-2d/types.js +0 -2
  145. package/dist/es5/tileset-2d/types.js.map +0 -1
  146. package/dist/es5/tileset-2d/utils.js +0 -302
  147. package/dist/es5/tileset-2d/utils.js.map +0 -1
  148. package/dist/es5/trips-layer/trips-layer.js +0 -114
  149. package/dist/es5/trips-layer/trips-layer.js.map +0 -1
  150. package/dist/es5/wms-layer/utils.js +0 -18
  151. package/dist/es5/wms-layer/utils.js.map +0 -1
  152. package/dist/es5/wms-layer/wms-layer.js +0 -376
  153. package/dist/es5/wms-layer/wms-layer.js.map +0 -1
  154. package/dist/esm/geo-cell-layer/GeoCellLayer.js +0 -72
  155. package/dist/esm/geo-cell-layer/GeoCellLayer.js.map +0 -1
  156. package/dist/esm/geohash-layer/geohash-layer.js +0 -26
  157. package/dist/esm/geohash-layer/geohash-layer.js.map +0 -1
  158. package/dist/esm/geohash-layer/geohash-utils.js +0 -56
  159. package/dist/esm/geohash-layer/geohash-utils.js.map +0 -1
  160. package/dist/esm/great-circle-layer/great-circle-layer.js +0 -12
  161. package/dist/esm/great-circle-layer/great-circle-layer.js.map +0 -1
  162. package/dist/esm/h3-layers/h3-cluster-layer.js +0 -79
  163. package/dist/esm/h3-layers/h3-cluster-layer.js.map +0 -1
  164. package/dist/esm/h3-layers/h3-hexagon-layer.js +0 -280
  165. package/dist/esm/h3-layers/h3-hexagon-layer.js.map +0 -1
  166. package/dist/esm/h3-layers/h3-utils.js +0 -54
  167. package/dist/esm/h3-layers/h3-utils.js.map +0 -1
  168. package/dist/esm/index.js +0 -17
  169. package/dist/esm/index.js.map +0 -1
  170. package/dist/esm/mesh-layer/mesh-layer-fragment.glsl.js +0 -56
  171. package/dist/esm/mesh-layer/mesh-layer-fragment.glsl.js.map +0 -1
  172. package/dist/esm/mesh-layer/mesh-layer-vertex.glsl.js +0 -85
  173. package/dist/esm/mesh-layer/mesh-layer-vertex.glsl.js.map +0 -1
  174. package/dist/esm/mesh-layer/mesh-layer.js +0 -178
  175. package/dist/esm/mesh-layer/mesh-layer.js.map +0 -1
  176. package/dist/esm/mvt-layer/coordinate-transform.js +0 -49
  177. package/dist/esm/mvt-layer/coordinate-transform.js.map +0 -1
  178. package/dist/esm/mvt-layer/find-index-binary.js +0 -99
  179. package/dist/esm/mvt-layer/find-index-binary.js.map +0 -1
  180. package/dist/esm/mvt-layer/mvt-layer.js +0 -427
  181. package/dist/esm/mvt-layer/mvt-layer.js.map +0 -1
  182. package/dist/esm/quadkey-layer/quadkey-layer.js +0 -31
  183. package/dist/esm/quadkey-layer/quadkey-layer.js.map +0 -1
  184. package/dist/esm/quadkey-layer/quadkey-utils.js +0 -24
  185. package/dist/esm/quadkey-layer/quadkey-utils.js.map +0 -1
  186. package/dist/esm/s2-layer/s2-geometry.js +0 -126
  187. package/dist/esm/s2-layer/s2-geometry.js.map +0 -1
  188. package/dist/esm/s2-layer/s2-layer.js +0 -26
  189. package/dist/esm/s2-layer/s2-layer.js.map +0 -1
  190. package/dist/esm/s2-layer/s2-utils.js +0 -69
  191. package/dist/esm/s2-layer/s2-utils.js.map +0 -1
  192. package/dist/esm/terrain-layer/terrain-layer.js +0 -292
  193. package/dist/esm/terrain-layer/terrain-layer.js.map +0 -1
  194. package/dist/esm/tile-3d-layer/tile-3d-layer.js +0 -438
  195. package/dist/esm/tile-3d-layer/tile-3d-layer.js.map +0 -1
  196. package/dist/esm/tile-layer/tile-layer.js +0 -299
  197. package/dist/esm/tile-layer/tile-layer.js.map +0 -1
  198. package/dist/esm/tileset-2d/index.js +0 -4
  199. package/dist/esm/tileset-2d/index.js.map +0 -1
  200. package/dist/esm/tileset-2d/memoize.js +0 -40
  201. package/dist/esm/tileset-2d/memoize.js.map +0 -1
  202. package/dist/esm/tileset-2d/tile-2d-header.js +0 -179
  203. package/dist/esm/tileset-2d/tile-2d-header.js.map +0 -1
  204. package/dist/esm/tileset-2d/tile-2d-traversal.js +0 -184
  205. package/dist/esm/tileset-2d/tile-2d-traversal.js.map +0 -1
  206. package/dist/esm/tileset-2d/tileset-2d.js +0 -509
  207. package/dist/esm/tileset-2d/tileset-2d.js.map +0 -1
  208. package/dist/esm/tileset-2d/types.js +0 -2
  209. package/dist/esm/tileset-2d/types.js.map +0 -1
  210. package/dist/esm/tileset-2d/utils.js +0 -233
  211. package/dist/esm/tileset-2d/utils.js.map +0 -1
  212. package/dist/esm/trips-layer/trips-layer.js +0 -88
  213. package/dist/esm/trips-layer/trips-layer.js.map +0 -1
  214. package/dist/esm/wms-layer/utils.js +0 -9
  215. package/dist/esm/wms-layer/utils.js.map +0 -1
  216. package/dist/esm/wms-layer/wms-layer.js +0 -231
  217. package/dist/esm/wms-layer/wms-layer.js.map +0 -1
  218. package/typed/geohash-layer/geohash-layer.d.ts.map +0 -1
  219. package/typed/h3-layers/h3-cluster-layer.d.ts.map +0 -1
  220. package/typed/index.d.ts +0 -31
  221. package/typed/index.d.ts.map +0 -1
  222. package/typed/mesh-layer/mesh-layer-fragment.glsl.d.ts +0 -3
  223. package/typed/mvt-layer/find-index-binary.d.ts +0 -12
  224. package/typed/mvt-layer/find-index-binary.d.ts.map +0 -1
  225. package/typed/mvt-layer/mvt-layer.d.ts.map +0 -1
  226. package/typed/quadkey-layer/quadkey-layer.d.ts.map +0 -1
  227. package/typed/s2-layer/s2-layer.d.ts.map +0 -1
  228. package/typed/terrain-layer/terrain-layer.d.ts.map +0 -1
  229. package/typed/tile-layer/tile-layer.d.ts.map +0 -1
  230. package/typed/tileset-2d/index.d.ts +0 -7
  231. package/typed/tileset-2d/index.d.ts.map +0 -1
  232. package/typed/tileset-2d/tile-2d-header.d.ts.map +0 -1
  233. package/typed/tileset-2d/tile-2d-traversal.d.ts +0 -4
  234. package/typed/tileset-2d/tile-2d-traversal.d.ts.map +0 -1
  235. package/typed/tileset-2d/tileset-2d.d.ts.map +0 -1
  236. package/typed/tileset-2d/utils.d.ts.map +0 -1
  237. /package/{typed → dist}/geo-cell-layer/GeoCellLayer.d.ts +0 -0
  238. /package/{typed → dist}/geo-cell-layer/GeoCellLayer.d.ts.map +0 -0
  239. /package/{typed → dist}/geohash-layer/geohash-utils.d.ts +0 -0
  240. /package/{typed → dist}/geohash-layer/geohash-utils.d.ts.map +0 -0
  241. /package/{typed → dist}/great-circle-layer/great-circle-layer.d.ts +0 -0
  242. /package/{typed → dist}/great-circle-layer/great-circle-layer.d.ts.map +0 -0
  243. /package/{typed → dist}/h3-layers/h3-hexagon-layer.d.ts +0 -0
  244. /package/{typed → dist}/h3-layers/h3-hexagon-layer.d.ts.map +0 -0
  245. /package/{typed → dist}/h3-layers/h3-utils.d.ts +0 -0
  246. /package/{typed → dist}/h3-layers/h3-utils.d.ts.map +0 -0
  247. /package/{typed → dist}/mesh-layer/mesh-layer-vertex.glsl.d.ts +0 -0
  248. /package/{typed → dist}/mesh-layer/mesh-layer-vertex.glsl.d.ts.map +0 -0
  249. /package/{typed → dist}/mesh-layer/mesh-layer.d.ts +0 -0
  250. /package/{typed → dist}/quadkey-layer/quadkey-utils.d.ts +0 -0
  251. /package/{typed → dist}/quadkey-layer/quadkey-utils.d.ts.map +0 -0
  252. /package/{typed → dist}/s2-layer/s2-geometry.d.ts +0 -0
  253. /package/{typed → dist}/s2-layer/s2-geometry.d.ts.map +0 -0
  254. /package/{typed → dist}/s2-layer/s2-utils.d.ts +0 -0
  255. /package/{typed → dist}/s2-layer/s2-utils.d.ts.map +0 -0
  256. /package/{typed → dist}/tileset-2d/memoize.d.ts +0 -0
  257. /package/{typed → dist}/tileset-2d/memoize.d.ts.map +0 -0
  258. /package/{typed → dist}/tileset-2d/types.d.ts +0 -0
  259. /package/{typed → dist}/tileset-2d/types.d.ts.map +0 -0
  260. /package/{typed → dist}/wms-layer/utils.d.ts +0 -0
  261. /package/{typed → dist}/wms-layer/utils.d.ts.map +0 -0
  262. /package/{typed → dist}/wms-layer/wms-layer.d.ts +0 -0
  263. /package/{typed → dist}/wms-layer/wms-layer.d.ts.map +0 -0
package/dist.min.js CHANGED
@@ -4,23 +4,13 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['deck'] = factory();
6
6
  else root['deck'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var Qy=Object.create;var Bi=Object.defineProperty;var $y=Object.getOwnPropertyDescriptor;var eA=Object.getOwnPropertyNames;var tA=Object.getPrototypeOf,rA=Object.prototype.hasOwnProperty;var Wl=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var re=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),de=(t,e)=>{for(var r in e)Bi(t,r,{get:e[r],enumerable:!0})},Si=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eA(e))!rA.call(t,i)&&i!==r&&Bi(t,i,{get:()=>e[i],enumerable:!(n=$y(e,i))||n.enumerable});return t},St=(t,e,r)=>(Si(t,e,"default"),r&&Si(r,e,"default")),P=(t,e,r)=>(r=t!=null?Qy(tA(t)):{},Si(e||!t||!t.__esModule?Bi(r,"default",{value:t,enumerable:!0}):r,t)),nA=t=>Si(Bi({},"__esModule",{value:!0}),t);var Ve=re((DO,Xl)=>{Xl.exports=globalThis.deck});var ze=re((UO,Yl)=>{Yl.exports=globalThis.deck});var Mi=re(dt=>{"use strict";var Zl=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",oA=Zl+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ql="["+Zl+"]["+oA+"]*",sA=new RegExp("^"+Ql+"$"),aA=function(e,r){for(var n=[],i=r.exec(e);i;){var o=[];o.startIndex=r.lastIndex-i[0].length;for(var s=i.length,a=0;a<s;a++)o.push(i[a]);n.push(o),i=r.exec(e)}return n},cA=function(e){var r=sA.exec(e);return!(r===null||typeof r>"u")};dt.isExist=function(t){return typeof t<"u"};dt.isEmptyObject=function(t){return Object.keys(t).length===0};dt.merge=function(t,e,r){if(e)for(var n=Object.keys(e),i=n.length,o=0;o<i;o++)r==="strict"?t[n[o]]=[e[n[o]]]:t[n[o]]=e[n[o]]};dt.getValue=function(t){return dt.isExist(t)?t:""};dt.isName=cA;dt.getAllMatches=aA;dt.nameRegexp=Ql});var ua=re(nf=>{"use strict";var ca=Mi(),uA={allowBooleanAttributes:!1,unpairedTags:[]};nf.validate=function(t,e){e=Object.assign({},uA,e);var r=[],n=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(var o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=ef(t,o),o.err)return o}else if(t[o]==="<"){var s=o;if(o++,t[o]==="!"){o=tf(t,o);continue}else{var a=!1;t[o]==="/"&&(a=!0,o++);for(var c="";o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
8
- `&&t[o]!=="\r";o++)c+=t[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!yA(c)){var u=void 0;return c.trim().length===0?u="Invalid space after '<'.":u="Tag '"+c+"' is an invalid name.",se("InvalidTag",u,Te(t,o))}var l=hA(t,o);if(l===!1)return se("InvalidAttr","Attributes for '"+c+"' have open quote.",Te(t,o));var f=l.value;if(o=l.index,f[f.length-1]==="/"){var h=o-f.length;f=f.substring(0,f.length-1);var d=rf(f,e);if(d===!0)n=!0;else return se(d.err.code,d.err.msg,Te(t,h+d.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return se("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Te(t,s));var p=r.pop();if(c!==p.tagName){var g=Te(t,p.tagStartPos);return se("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+c+"'.",Te(t,s))}r.length==0&&(i=!0)}else return se("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Te(t,o));else{var m=rf(f,e);if(m!==!0)return se(m.err.code,m.err.msg,Te(t,o-f.length+m.err.line));if(i===!0)return se("InvalidXml","Multiple possible root nodes found.",Te(t,o));e.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:s}),n=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=tf(t,o);continue}else if(t[o+1]==="?"){if(o=ef(t,++o),o.err)return o}else break;else if(t[o]==="&"){var A=mA(t,o);if(A==-1)return se("InvalidChar","char '&' is not expected.",Te(t,o));o=A}else if(i===!0&&!$l(t[o]))return se("InvalidXml","Extra text at the end",Te(t,o));t[o]==="<"&&o--}}else{if($l(t[o]))continue;return se("InvalidChar","char '"+t[o]+"' is not expected.",Te(t,o))}if(n){if(r.length==1)return se("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Te(t,r[0].tagStartPos));if(r.length>0)return se("InvalidXml","Invalid '"+JSON.stringify(r.map(function(_){return _.tagName}),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return se("InvalidXml","Start tag expected.",1);return!0};function $l(t){return t===" "||t===" "||t===`
9
- `||t==="\r"}function ef(t,e){for(var r=e;e<t.length;e++)if(t[e]=="?"||t[e]==" "){var n=t.substr(r,e-r);if(e>5&&n==="xml")return se("InvalidXml","XML declaration allowed only at the start of the document.",Te(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function tf(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){var r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var lA='"',fA="'";function hA(t,e){for(var r="",n="",i=!1;e<t.length;e++){if(t[e]===lA||t[e]===fA)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){i=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:i}}var dA=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function rf(t,e){for(var r=ca.getAllMatches(t,dA),n={},i=0;i<r.length;i++){if(r[i][1].length===0)return se("InvalidAttr","Attribute '"+r[i][2]+"' has no space in starting.",mn(r[i]));if(r[i][3]!==void 0&&r[i][4]===void 0)return se("InvalidAttr","Attribute '"+r[i][2]+"' is without value.",mn(r[i]));if(r[i][3]===void 0&&!e.allowBooleanAttributes)return se("InvalidAttr","boolean attribute '"+r[i][2]+"' is not allowed.",mn(r[i]));var o=r[i][2];if(!gA(o))return se("InvalidAttr","Attribute '"+o+"' is an invalid name.",mn(r[i]));if(!n.hasOwnProperty(o))n[o]=1;else return se("InvalidAttr","Attribute '"+o+"' is repeated.",mn(r[i]))}return!0}function pA(t,e){var r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function mA(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,pA(t,e);for(var r=0;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function se(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function gA(t){return ca.isName(t)}function yA(t){return ca.isName(t)}function Te(t,e){var r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function mn(t){return t.startIndex+t[1].length}});var sf=re(la=>{var of={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,r){return r},attributeValueProcessor:function(e,r){return r},stopNodes:[],alwaysCreateTextNode:!1,isArray:function(){return!1},commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,r,n){return e}},AA=function(e){return Object.assign({},of,e)};la.buildOptions=AA;la.defaultOptions=of});var cf=re((jO,af)=>{"use strict";function wi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var vA=function(){function t(r){_A(this,t),this.tagname=r,this.child=[],this[":@"]={}}var e=t.prototype;return e.add=function(n,i){n==="__proto__"&&(n="#__proto__"),this.child.push(wi({},n,i))},e.addChild=function(n){if(n.tagname==="__proto__"&&(n.tagname="#__proto__"),n[":@"]&&Object.keys(n[":@"]).length>0){var i;this.child.push((i={},wi(i,n.tagname,n.child),wi(i,":@",n[":@"]),i))}else this.child.push(wi({},n.tagname,n.child))},t}();af.exports=vA});var ff=re((kO,lf)=>{function xA(t,e){return SA(t)||EA(t,e)||bA(t,e)||TA()}function TA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
10
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bA(t,e){if(t){if(typeof t=="string")return uf(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return uf(t,e)}}function uf(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function EA(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function SA(t){if(Array.isArray(t))return t}var BA=Mi();function CA(t,e){var r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;for(var n=1,i=!1,o=!1,s="";e<t.length;e++)if(t[e]==="<"&&!o){if(i&&IA(t,e)){e+=7;var a=MA(t,e+1),c=xA(a,3);entityName=c[0],val=c[1],e=c[2],val.indexOf("&")===-1&&(r[PA(entityName)]={regx:RegExp("&".concat(entityName,";"),"g"),val})}else if(i&&OA(t,e))e+=8;else if(i&&RA(t,e))e+=8;else if(i&&LA(t,e))e+=9;else if(wA)o=!0;else throw new Error("Invalid DOCTYPE");n++,s=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,n--):n--,n===0)break}else t[e]==="["?i=!0:s+=t[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}function MA(t,e){for(var r="";e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)r+=t[e];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");for(var n=t[e++],i="";e<t.length&&t[e]!==n;e++)i+=t[e];return[r,i,e]}function wA(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function IA(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function OA(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function RA(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function LA(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function PA(t){if(BA.isName(t))return t;throw new Error("Invalid entity name ".concat(t))}lf.exports=CA});var df=re((JO,hf)=>{var FA=/^[-+]?0x[a-fA-F0-9]+$/,DA=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var NA={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function UA(t,e={}){if(e=Object.assign({},NA,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&FA.test(r))return Number.parseInt(r,16);{let n=DA.exec(r);if(n){let i=n[1],o=n[2],s=GA(n[3]),a=n[4]||n[6];if(!e.leadingZeros&&o.length>0&&i&&r[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!i&&r[1]!==".")return t;{let c=Number(r),u=""+c;return u.search(/[eE]/)!==-1||a?e.eNotation?c:t:r.indexOf(".")!==-1?u==="0"&&s===""||u===s||i&&u==="-"+s?c:t:o?s===u||i+s===u?c:t:r===u||r===i+u?c:t}}else return t}}function GA(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}hf.exports=UA});var gf=re((WO,mf)=>{"use strict";function pf(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zt(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zt=function(r){return typeof r}:Zt=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Zt(t)}function HA(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var da=Mi(),gn=cf(),VA=ff(),zA=df(),qO="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,da.nameRegexp),jA=function t(e){HA(this,t),this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"}},this.addExternalEntities=kA,this.parseXml=KA,this.parseTextData=JA,this.resolveNameSpace=qA,this.buildAttributesMap=XA,this.isItStopNode=$A,this.replaceEntitiesValue=ZA,this.readStopNodeData=t1,this.saveTextToParentTag=QA,this.addChild=YA};function kA(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var n=e[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:t[n]}}}function JA(t,e,r,n,i,o,s){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){s||(t=this.replaceEntitiesValue(t));var a=this.options.tagValueProcessor(e,t,r,i,o);if(a==null)return t;if(Zt(a)!==Zt(t)||a!==t)return a;if(this.options.trimValues)return ha(t,this.options.parseTagValue,this.options.numberParseOptions);var c=t.trim();return c===t?ha(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function qA(t){if(this.options.removeNSPrefix){var e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var WA=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function XA(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){for(var n=da.getAllMatches(t,WA),i=n.length,o={},s=0;s<i;s++){var a=this.resolveNameSpace(n[s][1]),c=n[s][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);var l=this.options.attributeValueProcessor(a,c,e);l==null?o[u]=c:Zt(l)!==Zt(c)||l!==c?o[u]=l:o[u]=ha(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){var f={};return f[this.options.attributesGroupName]=o,f}return o}}var KA=function(e){e=e.replace(/\r\n?/g,`
11
- `);for(var r=new gn("!xml"),n=r,i="",o="",s=0;s<e.length;s++){var a=e[s];if(a==="<")if(e[s+1]==="/"){var c=Yt(e,">",s,"Closing Tag is not closed."),u=e.substring(s+2,c).trim();if(this.options.removeNSPrefix){var l=u.indexOf(":");l!==-1&&(u=u.substr(l+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(i=this.saveTextToParentTag(i,n,o));var f=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error("Unpaired tag can not be used as closing tag: </".concat(u,">"));var h=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(h=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):h=o.lastIndexOf("."),o=o.substring(0,h),n=this.tagsNodeStack.pop(),i="",s=c}else if(e[s+1]==="?"){var d=fa(e,s,!1,"?>");if(!d)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,n,o),!(this.options.ignoreDeclaration&&d.tagName==="?xml"||this.options.ignorePiTags)){var p=new gn(d.tagName);p.add(this.options.textNodeName,""),d.tagName!==d.tagExp&&d.attrExpPresent&&(p[":@"]=this.buildAttributesMap(d.tagExp,o,d.tagName)),this.addChild(n,p,o)}s=d.closeIndex+1}else if(e.substr(s+1,3)==="!--"){var g=Yt(e,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){var m=e.substring(s+4,g-2);i=this.saveTextToParentTag(i,n,o),n.add(this.options.commentPropName,[pf({},this.options.textNodeName,m)])}s=g}else if(e.substr(s+1,2)==="!D"){var A=VA(e,s);this.docTypeEntities=A.entities,s=A.i}else if(e.substr(s+1,2)==="!["){var _=Yt(e,"]]>",s,"CDATA is not closed.")-2,v=e.substring(s+9,_);if(i=this.saveTextToParentTag(i,n,o),this.options.cdataPropName)n.add(this.options.cdataPropName,[pf({},this.options.textNodeName,v)]);else{var x=this.parseTextData(v,n.tagname,o,!0,!1,!0);x==null&&(x=""),n.add(this.options.textNodeName,x)}s=_+2}else{var B=fa(e,s,this.options.removeNSPrefix),S=B.tagName,C=B.tagExp,E=B.attrExpPresent,b=B.closeIndex;this.options.transformTagName&&(S=this.options.transformTagName(S)),n&&i&&n.tagname!=="!xml"&&(i=this.saveTextToParentTag(i,n,o,!1));var y=n;if(y&&this.options.unpairedTags.indexOf(y.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),S!==r.tagname&&(o+=o?"."+S:S),this.isItStopNode(this.options.stopNodes,o,S)){var M="";if(C.length>0&&C.lastIndexOf("/")===C.length-1)s=B.closeIndex;else if(this.options.unpairedTags.indexOf(S)!==-1)s=B.closeIndex;else{var I=this.readStopNodeData(e,S,b+1);if(!I)throw new Error("Unexpected end of ".concat(S));s=I.i,M=I.tagContent}var O=new gn(S);S!==C&&E&&(O[":@"]=this.buildAttributesMap(C,o,S)),M&&(M=this.parseTextData(M,S,o,!0,E,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),O.add(this.options.textNodeName,M),this.addChild(n,O,o)}else{if(C.length>0&&C.lastIndexOf("/")===C.length-1){S[S.length-1]==="/"?(S=S.substr(0,S.length-1),o=o.substr(0,o.length-1),C=S):C=C.substr(0,C.length-1),this.options.transformTagName&&(S=this.options.transformTagName(S));var R=new gn(S);S!==C&&E&&(R[":@"]=this.buildAttributesMap(C,o,S)),this.addChild(n,R,o),o=o.substr(0,o.lastIndexOf("."))}else{var F=new gn(S);this.tagsNodeStack.push(n),S!==C&&E&&(F[":@"]=this.buildAttributesMap(C,o,S)),this.addChild(n,F,o),n=F}i="",s=b}}else i+=e[s]}return r.child};function YA(t,e,r){var n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}var ZA=function(e){if(this.options.processEntities){for(var r in this.docTypeEntities){var n=this.docTypeEntities[r];e=e.replace(n.regx,n.val)}for(var i in this.lastEntities){var o=this.lastEntities[i];e=e.replace(o.regex,o.val)}if(this.options.htmlEntities)for(var s in this.htmlEntities){var a=this.htmlEntities[s];e=e.replace(a.regex,a.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function QA(t,e,r,n){return t&&(n===void 0&&(n=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function $A(t,e,r){var n="*."+r;for(var i in t){var o=t[i];if(n===o||e===o)return!0}return!1}function e1(t,e){for(var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:">",n,i="",o=e;o<t.length;o++){var s=t[o];if(n)s===n&&(n="");else if(s==='"'||s==="'")n=s;else if(s===r[0])if(r[1]){if(t[o+1]===r[1])return{data:i,index:o}}else return{data:i,index:o};else s===" "&&(s=" ");i+=s}}function Yt(t,e,r,n){var i=t.indexOf(e,r);if(i===-1)throw new Error(n);return i+e.length-1}function fa(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:">",i=e1(t,e+1,n);if(i){var o=i.data,s=i.index,a=o.search(/\s/),c=o,u=!0;if(a!==-1&&(c=o.substr(0,a).replace(/\s\s*$/,""),o=o.substr(a+1)),r){var l=c.indexOf(":");l!==-1&&(c=c.substr(l+1),u=c!==i.data.substr(l+1))}return{tagName:c,tagExp:o,closeIndex:s,attrExpPresent:u}}}function t1(t,e,r){for(var n=r,i=1;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){var o=Yt(t,">",r,"".concat(e," is not closed")),s=t.substring(r+2,o).trim();if(s===e&&(i--,i===0))return{tagContent:t.substring(n,r),i:o};r=o}else if(t[r+1]==="?"){var a=Yt(t,"?>",r+1,"StopNode is not closed.");r=a}else if(t.substr(r+1,3)==="!--"){var c=Yt(t,"-->",r+3,"StopNode is not closed.");r=c}else if(t.substr(r+1,2)==="!["){var u=Yt(t,"]]>",r,"StopNode is not closed.")-2;r=u}else{var l=fa(t,r,">");if(l){var f=l&&l.tagName;f===e&&l.tagExp[l.tagExp.length-1]!=="/"&&i++,r=l.closeIndex}}}function ha(t,e,r){if(e&&typeof t=="string"){var n=t.trim();return n==="true"?!0:n==="false"?!1:zA(t,r)}else return da.isExist(t)?t:""}mf.exports=jA});var _f=re(Af=>{"use strict";function r1(t,e){return yf(t,e)}function yf(t,e,r){for(var n,i={},o=0;o<t.length;o++){var s=t[o],a=n1(s),c="";if(r===void 0?c=a:c=r+"."+a,a===e.textNodeName)n===void 0?n=s[a]:n+=""+s[a];else{if(a===void 0)continue;if(s[a]){var u=yf(s[a],e,c),l=o1(u,e);s[":@"]?i1(u,s[":@"],c,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),i[a]!==void 0&&i.hasOwnProperty(a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(u)):e.isArray(a,c,l)?i[a]=[u]:i[a]=u}}}return typeof n=="string"?n.length>0&&(i[e.textNodeName]=n):n!==void 0&&(i[e.textNodeName]=n),i}function n1(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var n=e[r];if(n!==":@")return n}}function i1(t,e,r,n){if(e)for(var i=Object.keys(e),o=i.length,s=0;s<o;s++){var a=i[s];n.isArray(a,r+"."+a,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}function o1(t,e){var r=e.textNodeName,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}Af.prettify=r1});var xf=re((KO,vf)=>{function s1(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a1=sf(),c1=a1.buildOptions,u1=gf(),l1=_f(),f1=l1.prettify,h1=ua(),d1=function(){function t(r){s1(this,t),this.externalEntities={},this.options=c1(r)}var e=t.prototype;return e.parse=function(n,i){if(typeof n!="string")if(n.toString)n=n.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(i){i===!0&&(i={});var o=h1.validate(n,i);if(o!==!0)throw Error("".concat(o.err.msg,":").concat(o.err.line,":").concat(o.err.col))}var s=new u1(this.options);s.addExternalEntities(this.externalEntities);var a=s.parseXml(n);return this.options.preserveOrder||a===void 0?a:f1(a,this.options)},e.addEntity=function(n,i){if(i.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(n.indexOf("&")!==-1||n.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(i==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[n]=i},t}();vf.exports=d1});var Bf=re((YO,Sf)=>{var p1=`
12
- `;function m1(t,e){var r="";return e.format&&e.indentBy.length>0&&(r=p1),bf(t,e,"",r)}function bf(t,e,r,n){for(var i="",o=!1,s=0;s<t.length;s++){var a=t[s],c=g1(a),u="";if(r.length===0?u=c:u="".concat(r,".").concat(c),c===e.textNodeName){var l=a[c];y1(u,e)||(l=e.tagValueProcessor(c,l),l=Ef(l,e)),o&&(i+=n),i+=l,o=!1;continue}else if(c===e.cdataPropName){o&&(i+=n),i+="<![CDATA[".concat(a[c][0][e.textNodeName],"]]>"),o=!1;continue}else if(c===e.commentPropName){i+=n+"<!--".concat(a[c][0][e.textNodeName],"-->"),o=!0;continue}else if(c[0]==="?"){var f=Tf(a[":@"],e),h=c==="?xml"?"":n,d=a[c][0][e.textNodeName];d=d.length!==0?" "+d:"",i+=h+"<".concat(c).concat(d).concat(f,"?>"),o=!0;continue}var p=n;p!==""&&(p+=e.indentBy);var g=Tf(a[":@"],e),m=n+"<".concat(c).concat(g),A=bf(a[c],e,u,p);e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?i+=m+">":i+=m+"/>":(!A||A.length===0)&&e.suppressEmptyNode?i+=m+"/>":A&&A.endsWith(">")?i+=m+">".concat(A).concat(n,"</").concat(c,">"):(i+=m+">",A&&n!==""&&(A.includes("/>")||A.includes("</"))?i+=n+e.indentBy+A+n:i+=A,i+="</".concat(c,">")),o=!0}return i}function g1(t){for(var e=Object.keys(t),r=0;r<e.length;r++){var n=e[r];if(n!==":@")return n}}function Tf(t,e){var r="";if(t&&!e.ignoreAttributes)for(var n in t){var i=e.attributeValueProcessor(n,t[n]);i=Ef(i,e),i===!0&&e.suppressBooleanAttributes?r+=" ".concat(n.substr(e.attributeNamePrefix.length)):r+=" ".concat(n.substr(e.attributeNamePrefix.length),'="').concat(i,'"')}return r}function y1(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);var r=t.substr(t.lastIndexOf(".")+1);for(var n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function Ef(t,e){if(t&&t.length>0&&e.processEntities)for(var r=0;r<e.entities.length;r++){var n=e.entities[r];t=t.replace(n.regex,n.val)}return t}Sf.exports=m1});var Mf=re((ZO,Cf)=>{"use strict";function yn(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?yn=function(r){return typeof r}:yn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},yn(t)}function A1(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var _1=Bf(),v1={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,r){return r},attributeValueProcessor:function(e,r){return r},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Bt(t){this.options=Object.assign({},v1,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=b1),this.processTextOrObjNode=x1,this.options.format?(this.indentate=T1,this.tagEndChar=`>
7
+ "use strict";var __exports__=(()=>{var ig=Object.create;var es=Object.defineProperty;var og=Object.getOwnPropertyDescriptor;var ag=Object.getOwnPropertyNames;var cg=Object.getPrototypeOf,lg=Object.prototype.hasOwnProperty;var El=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var et=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ut=(e,t)=>{for(var n in t)es(e,n,{get:t[n],enumerable:!0})},ts=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ag(t))!lg.call(e,s)&&s!==n&&es(e,s,{get:()=>t[s],enumerable:!(r=og(t,s))||r.enumerable});return e},fe=(e,t,n)=>(ts(e,t,"default"),n&&ts(n,t,"default")),N=(e,t,n)=>(n=e!=null?ig(cg(e)):{},ts(t||!e||!e.__esModule?es(n,"default",{value:e,enumerable:!0}):n,e)),ug=e=>ts(es({},"__esModule",{value:!0}),e);var Nt=et((eS,Bl)=>{Bl.exports=globalThis.deck});var Dt=et((rS,bl)=>{bl.exports=globalThis.deck});var rs=et(re=>{"use strict";var Sl=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",fg=Sl+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ml="["+Sl+"]["+fg+"]*",dg=new RegExp("^"+Ml+"$"),pg=function(e,t){let n=[],r=t.exec(e);for(;r;){let s=[];s.startIndex=t.lastIndex-r[0].length;let i=r.length;for(let o=0;o<i;o++)s.push(r[o]);n.push(s),r=t.exec(e)}return n},mg=function(e){let t=dg.exec(e);return!(t===null||typeof t>"u")};re.isExist=function(e){return typeof e<"u"};re.isEmptyObject=function(e){return Object.keys(e).length===0};re.merge=function(e,t,n){if(t){let r=Object.keys(t),s=r.length;for(let i=0;i<s;i++)n==="strict"?e[r[i]]=[t[r[i]]]:e[r[i]]=t[r[i]]}};re.getValue=function(e){return re.isExist(e)?e:""};re.isName=mg;re.getAllMatches=pg;re.nameRegexp=Ml});var oo=et(Rl=>{"use strict";var io=rs(),gg={allowBooleanAttributes:!1,unpairedTags:[]};Rl.validate=function(e,t){t=Object.assign({},gg,t);let n=[],r=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=wl(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=vl(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
8
+ `&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!Cg(c)){let h;return c.trim().length===0?h="Invalid space after '<'.":h="Tag '"+c+"' is an invalid name.",it("InvalidTag",h,yt(e,i))}let l=yg(e,i);if(l===!1)return it("InvalidAttr","Attributes for '"+c+"' have open quote.",yt(e,i));let u=l.value;if(i=l.index,u[u.length-1]==="/"){let h=i-u.length;u=u.substring(0,u.length-1);let f=Fl(u,t);if(f===!0)r=!0;else return it(f.err.code,f.err.msg,yt(e,h+f.err.line))}else if(a)if(l.tagClosed){if(u.trim().length>0)return it("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",yt(e,o));{let h=n.pop();if(c!==h.tagName){let f=yt(e,h.tagStartPos);return it("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+c+"'.",yt(e,o))}n.length==0&&(s=!0)}}else return it("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",yt(e,i));else{let h=Fl(u,t);if(h!==!0)return it(h.err.code,h.err.msg,yt(e,i-u.length+h.err.line));if(s===!0)return it("InvalidXml","Multiple possible root nodes found.",yt(e,i));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=vl(e,i);continue}else if(e[i+1]==="?"){if(i=wl(e,++i),i.err)return i}else break;else if(e[i]==="&"){let h=Eg(e,i);if(h==-1)return it("InvalidChar","char '&' is not expected.",yt(e,i));i=h}else if(s===!0&&!Il(e[i]))return it("InvalidXml","Extra text at the end",yt(e,i));e[i]==="<"&&i--}}else{if(Il(e[i]))continue;return it("InvalidChar","char '"+e[i]+"' is not expected.",yt(e,i))}if(r){if(n.length==1)return it("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",yt(e,n[0].tagStartPos));if(n.length>0)return it("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return it("InvalidXml","Start tag expected.",1);return!0};function Il(e){return e===" "||e===" "||e===`
9
+ `||e==="\r"}function wl(e,t){let n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let r=e.substr(n,t-n);if(t>5&&r==="xml")return it("InvalidXml","XML declaration allowed only at the start of the document.",yt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function vl(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var Ag='"',xg="'";function yg(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===Ag||e[t]===xg)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){s=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:s}}var Tg=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Fl(e,t){let n=io.getAllMatches(e,Tg),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return it("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",Jn(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return it("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",Jn(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return it("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",Jn(n[s]));let i=n[s][2];if(!Bg(i))return it("InvalidAttr","Attribute '"+i+"' is an invalid name.",Jn(n[s]));if(!r.hasOwnProperty(i))r[i]=1;else return it("InvalidAttr","Attribute '"+i+"' is repeated.",Jn(n[s]))}return!0}function _g(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function Eg(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,_g(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function it(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Bg(e){return io.isName(e)}function Cg(e){return io.isName(e)}function yt(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Jn(e){return e.startIndex+e[1].length}});var Pl=et(ao=>{var Ll={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}},bg=function(e){return Object.assign({},Ll,e)};ao.buildOptions=bg;ao.defaultOptions=Ll});var Nl=et((cS,Ol)=>{"use strict";var co=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,[":@"]:t[":@"]}):this.child.push({[t.tagname]:t.child})}};Ol.exports=co});var Ul=et((lS,Dl)=>{var Sg=rs();function Mg(e,t){let n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let r=1,s=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(s&&vg(e,t))t+=7,[entityName,val,t]=Ig(e,t+1),val.indexOf("&")===-1&&(n[Pg(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&Fg(e,t))t+=8;else if(s&&Rg(e,t))t+=8;else if(s&&Lg(e,t))t+=9;else if(wg)i=!0;else throw new Error("Invalid DOCTYPE");r++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,r--):r--,r===0)break}else e[t]==="["?s=!0:o+=e[t];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function Ig(e,t){let n="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)n+=e[t];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");let r=e[t++],s="";for(;t<e.length&&e[t]!==r;t++)s+=e[t];return[n,s,t]}function wg(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function vg(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function Fg(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function Rg(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Lg(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function Pg(e){if(Sg.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}Dl.exports=Mg});var Vl=et((uS,Gl)=>{var Og=/^[-+]?0x[a-fA-F0-9]+$/,Ng=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var Dg={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Ug(e,t={}){if(t=Object.assign({},Dg,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(t.hex&&Og.test(n))return Number.parseInt(n,16);{let r=Ng.exec(n);if(r){let s=r[1],i=r[2],o=Gg(r[3]),a=r[4]||r[6];if(!t.leadingZeros&&i.length>0&&s&&n[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&n[1]!==".")return e;{let c=Number(n),l=""+c;return l.search(/[eE]/)!==-1||a?t.eNotation?c:e:n.indexOf(".")!==-1?l==="0"&&o===""||l===o||s&&l==="-"+o?c:e:i?o===l||s+o===l?c:e:n===l||n===s+l?c:e}}else return e}}function Gg(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}Gl.exports=Ug});var zl=et((fS,Hl)=>{"use strict";var fo=rs(),qn=Nl(),Vg=Ul(),Hg=Vl(),hS="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,fo.nameRegexp),lo=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"}},this.addExternalEntities=zg,this.parseXml=Xg,this.parseTextData=kg,this.resolveNameSpace=Jg,this.buildAttributesMap=jg,this.isItStopNode=Qg,this.replaceEntitiesValue=Yg,this.readStopNodeData=$g,this.saveTextToParentTag=Kg,this.addChild=Wg}};function zg(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function kg(e,t,n,r,s,i,o){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,n,s,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?ho(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?ho(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Jg(e){if(this.options.removeNSPrefix){let t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}var qg=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function jg(e,t,n){if(!this.options.ignoreAttributes&&typeof e=="string"){let r=fo.getAllMatches(e,qg),s=r.length,i={};for(let o=0;o<s;o++){let a=this.resolveNameSpace(r[o][1]),c=r[o][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);let u=this.options.attributeValueProcessor(a,c,t);u==null?i[l]=c:typeof u!=typeof c||u!==c?i[l]=u:i[l]=ho(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var Xg=function(e){e=e.replace(/\r\n?/g,`
10
+ `);let t=new qn("!xml"),n=t,r="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let a=Fe(e,">",i,"Closing Tag is not closed."),c=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){let h=c.indexOf(":");h!==-1&&(c=c.substr(h+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,s));let l=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let u=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(u=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=s.lastIndexOf("."),s=s.substring(0,u),n=this.tagsNodeStack.pop(),r="",i=a}else if(e[i+1]==="?"){let a=uo(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let c=new qn(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(n,c,s)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let a=Fe(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let c=e.substring(i+4,a-2);r=this.saveTextToParentTag(r,n,s),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=a}else if(e.substr(i+1,2)==="!D"){let a=Vg(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){let a=Fe(e,"]]>",i,"CDATA is not closed.")-2,c=e.substring(i+9,a);if(r=this.saveTextToParentTag(r,n,s),this.options.cdataPropName)n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]);else{let l=this.parseTextData(c,n.tagname,s,!0,!1,!0);l==null&&(l=""),n.add(this.options.textNodeName,l)}i=a+2}else{let a=uo(e,i,this.options.removeNSPrefix),c=a.tagName,l=a.tagExp,u=a.attrExpPresent,h=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,s,!1));let f=n;if(f&&this.options.unpairedTags.indexOf(f.tagname)!==-1&&(n=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==t.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let d="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)i=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=a.closeIndex;else{let A=this.readStopNodeData(e,c,h+1);if(!A)throw new Error(`Unexpected end of ${c}`);i=A.i,d=A.tagContent}let p=new qn(c);c!==l&&u&&(p[":@"]=this.buildAttributesMap(l,s,c)),d&&(d=this.parseTextData(d,c,s,!0,u,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),p.add(this.options.textNodeName,d),this.addChild(n,p,s)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let d=new qn(c);c!==l&&u&&(d[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(n,d,s),s=s.substr(0,s.lastIndexOf("."))}else{let d=new qn(c);this.tagsNodeStack.push(n),c!==l&&u&&(d[":@"]=this.buildAttributesMap(l,s,c)),this.addChild(n,d,s),n=d}r="",i=h}}else r+=e[i];return t.child};function Wg(e,t,n){let r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t))}var Yg=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){let n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Kg(e,t,n,r){return e&&(r===void 0&&(r=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Qg(e,t,n){let r="*."+n;for(let s in e){let i=e[s];if(r===i||t===i)return!0}return!1}function Zg(e,t,n=">"){let r,s="";for(let i=t;i<e.length;i++){let o=e[i];if(r)o===r&&(r="");else if(o==='"'||o==="'")r=o;else if(o===n[0])if(n[1]){if(e[i+1]===n[1])return{data:s,index:i}}else return{data:s,index:i};else o===" "&&(o=" ");s+=o}}function Fe(e,t,n,r){let s=e.indexOf(t,n);if(s===-1)throw new Error(r);return s+t.length-1}function uo(e,t,n,r=">"){let s=Zg(e,t+1,r);if(!s)return;let i=s.data,o=s.index,a=i.search(/\s/),c=i,l=!0;if(a!==-1&&(c=i.substr(0,a).replace(/\s\s*$/,""),i=i.substr(a+1)),n){let u=c.indexOf(":");u!==-1&&(c=c.substr(u+1),l=c!==s.data.substr(u+1))}return{tagName:c,tagExp:i,closeIndex:o,attrExpPresent:l}}function $g(e,t,n){let r=n,s=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){let i=Fe(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(s--,s===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=Fe(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Fe(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Fe(e,"]]>",n,"StopNode is not closed.")-2;else{let i=uo(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,n=i.closeIndex)}}function ho(e,t,n){if(t&&typeof e=="string"){let r=e.trim();return r==="true"?!0:r==="false"?!1:Hg(e,n)}else return fo.isExist(e)?e:""}Hl.exports=lo});var ql=et(Jl=>{"use strict";function t0(e,t){return kl(e,t)}function kl(e,t,n){let r,s={};for(let i=0;i<e.length;i++){let o=e[i],a=e0(o),c="";if(n===void 0?c=a:c=n+"."+a,a===t.textNodeName)r===void 0?r=o[a]:r+=""+o[a];else{if(a===void 0)continue;if(o[a]){let l=kl(o[a],t,c),u=r0(l,t);o[":@"]?n0(l,o[":@"],c,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(l)):t.isArray(a,c,u)?s[a]=[l]:s[a]=l}}}return typeof r=="string"?r.length>0&&(s[t.textNodeName]=r):r!==void 0&&(s[t.textNodeName]=r),s}function e0(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function n0(e,t,n,r){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let a=s[o];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function r0(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}Jl.prettify=t0});var Xl=et((pS,jl)=>{var{buildOptions:s0}=Pl(),i0=zl(),{prettify:o0}=ql(),a0=oo(),po=class{constructor(t){this.externalEntities={},this.options=s0(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});let i=a0.validate(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let r=new i0(this.options);r.addExternalEntities(this.externalEntities);let s=r.parseXml(t);return this.options.preserveOrder||s===void 0?s:o0(s,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}};jl.exports=po});var Zl=et((mS,Ql)=>{var c0=`
11
+ `;function l0(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=c0),Yl(e,t,"",n)}function Yl(e,t,n,r){let s="",i=!1;for(let o=0;o<e.length;o++){let a=e[o],c=u0(a),l="";if(n.length===0?l=c:l=`${n}.${c}`,c===t.textNodeName){let p=a[c];h0(l,t)||(p=t.tagValueProcessor(c,p),p=Kl(p,t)),i&&(s+=r),s+=p,i=!1;continue}else if(c===t.cdataPropName){i&&(s+=r),s+=`<![CDATA[${a[c][0][t.textNodeName]}]]>`,i=!1;continue}else if(c===t.commentPropName){s+=r+`<!--${a[c][0][t.textNodeName]}-->`,i=!0;continue}else if(c[0]==="?"){let p=Wl(a[":@"],t),A=c==="?xml"?"":r,g=a[c][0][t.textNodeName];g=g.length!==0?" "+g:"",s+=A+`<${c}${g}${p}?>`,i=!0;continue}let u=r;u!==""&&(u+=t.indentBy);let h=Wl(a[":@"],t),f=r+`<${c}${h}`,d=Yl(a[c],t,l,u);t.unpairedTags.indexOf(c)!==-1?t.suppressUnpairedNode?s+=f+">":s+=f+"/>":(!d||d.length===0)&&t.suppressEmptyNode?s+=f+"/>":d&&d.endsWith(">")?s+=f+`>${d}${r}</${c}>`:(s+=f+">",d&&r!==""&&(d.includes("/>")||d.includes("</"))?s+=r+t.indentBy+d+r:s+=d,s+=`</${c}>`),i=!0}return s}function u0(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(r!==":@")return r}}function Wl(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){let s=t.attributeValueProcessor(r,e[r]);s=Kl(s,t),s===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${s}"`}return n}function h0(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Kl(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}Ql.exports=l0});var tu=et((gS,$l)=>{"use strict";var f0=Zl(),d0={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function de(e){this.options=Object.assign({},d0,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=g0),this.processTextOrObjNode=p0,this.options.format?(this.indentate=m0,this.tagEndChar=`>
13
12
  `,this.newLine=`
14
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Bt.prototype.build=function(t){return this.options.preserveOrder?_1(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t=A1({},this.options.arrayNodeName,t)),this.j2x(t,0).val)};Bt.prototype.j2x=function(t,e){var r="",n="";for(var i in t)if(typeof t[i]>"u")this.isAttribute(i)&&(n+="");else if(t[i]===null)this.isAttribute(i)?n+="":i[0]==="?"?n+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)n+=this.buildTextValNode(t[i],i,"",e);else if(yn(t[i])!=="object"){var o=this.isAttribute(i);if(o)r+=this.buildAttrPairStr(o,""+t[i]);else if(i===this.options.textNodeName){var s=this.options.tagValueProcessor(i,""+t[i]);n+=this.replaceEntitiesValue(s)}else n+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){for(var a=t[i].length,c="",u=0;u<a;u++){var l=t[i][u];typeof l>"u"||(l===null?i[0]==="?"?n+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+i+"/"+this.tagEndChar:yn(l)==="object"?this.options.oneListGroup?c+=this.j2x(l,e+1).val:c+=this.processTextOrObjNode(l,i,e):c+=this.buildTextValNode(l,i,"",e))}this.options.oneListGroup&&(c=this.buildObjectNode(c,i,"",e)),n+=c}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName)for(var f=Object.keys(t[i]),h=f.length,d=0;d<h;d++)r+=this.buildAttrPairStr(f[d],""+t[i][f[d]]);else n+=this.processTextOrObjNode(t[i],i,e);return{attrStr:r,val:n}};Bt.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function x1(t,e,r){var n=this.j2x(t,r+1);return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,n.attrStr,r):this.buildObjectNode(n.val,e,n.attrStr,r)}Bt.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;var i="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",i=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+o+">"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(n)+"<!--".concat(t,"-->")+this.newLine:this.indentate(n)+"<"+e+r+o+this.tagEndChar+t+this.indentate(n)+i};Bt.prototype.closeTag=function(t){var e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e="></".concat(t),e};Bt.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+"<![CDATA[".concat(t,"]]>")+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+"<!--".concat(t,"-->")+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;var i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+i+"</"+e+this.tagEndChar};Bt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(var e=0;e<this.options.entities.length;e++){var r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function T1(t){return this.options.indentBy.repeat(t)}function b1(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}Cf.exports=Bt});var If=re((QO,wf)=>{"use strict";var E1=ua(),S1=xf(),B1=Mf();wf.exports={XMLParser:S1,XMLValidator:E1,XMLBuilder:B1}});var xc=re((md,Ln)=>{(function(t,e){typeof define=="function"&&define.amd?define([],e):typeof Wl=="function"&&typeof Ln=="object"&&Ln&&Ln.exports?Ln.exports=e():(t.dcodeIO=t.dcodeIO||{}).Long=e()})(md,function(){"use strict";function t(b,y,M){this.low=b|0,this.high=y|0,this.unsigned=!!M}t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function e(b){return(b&&b.__isLong__)===!0}t.isLong=e;var r={},n={};function i(b,y){var M,I,O;return y?(b>>>=0,(O=0<=b&&b<256)&&(I=n[b],I)?I:(M=s(b,(b|0)<0?-1:0,!0),O&&(n[b]=M),M)):(b|=0,(O=-128<=b&&b<128)&&(I=r[b],I)?I:(M=s(b,b<0?-1:0,!1),O&&(r[b]=M),M))}t.fromInt=i;function o(b,y){if(isNaN(b)||!isFinite(b))return y?A:m;if(y){if(b<0)return A;if(b>=d)return S}else{if(b<=-p)return C;if(b+1>=p)return B}return b<0?o(-b,y).neg():s(b%h|0,b/h|0,y)}t.fromNumber=o;function s(b,y,M){return new t(b,y,M)}t.fromBits=s;var a=Math.pow;function c(b,y,M){if(b.length===0)throw Error("empty string");if(b==="NaN"||b==="Infinity"||b==="+Infinity"||b==="-Infinity")return m;if(typeof y=="number"?(M=y,y=!1):y=!!y,M=M||10,M<2||36<M)throw RangeError("radix");var I;if((I=b.indexOf("-"))>0)throw Error("interior hyphen");if(I===0)return c(b.substring(1),y,M).neg();for(var O=o(a(M,8)),R=m,F=0;F<b.length;F+=8){var X=Math.min(8,b.length-F),z=parseInt(b.substring(F,F+X),M);if(X<8){var Q=o(a(M,X));R=R.mul(Q).add(o(z))}else R=R.mul(O),R=R.add(o(z))}return R.unsigned=y,R}t.fromString=c;function u(b){return b instanceof t?b:typeof b=="number"?o(b):typeof b=="string"?c(b):s(b.low,b.high,b.unsigned)}t.fromValue=u;var l=1<<16,f=1<<24,h=l*l,d=h*h,p=d/2,g=i(f),m=i(0);t.ZERO=m;var A=i(0,!0);t.UZERO=A;var _=i(1);t.ONE=_;var v=i(1,!0);t.UONE=v;var x=i(-1);t.NEG_ONE=x;var B=s(-1,2147483647,!1);t.MAX_VALUE=B;var S=s(-1,-1,!0);t.MAX_UNSIGNED_VALUE=S;var C=s(0,-2147483648,!1);t.MIN_VALUE=C;var E=t.prototype;return E.toInt=function(){return this.unsigned?this.low>>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},E.toString=function(y){if(y=y||10,y<2||36<y)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(C)){var M=o(y),I=this.div(M),O=I.mul(M).sub(this);return I.toString(y)+O.toInt().toString(y)}else return"-"+this.neg().toString(y);for(var R=o(a(y,6),this.unsigned),F=this,X="";;){var z=F.div(R),Q=F.sub(z.mul(R)).toInt()>>>0,W=Q.toString(y);if(F=z,F.isZero())return W+X;for(;W.length<6;)W="0"+W;X=""+W+X}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){if(this.isNegative())return this.eq(C)?64:this.neg().getNumBitsAbs();for(var y=this.high!=0?this.high:this.low,M=31;M>0&&!(y&1<<M);M--);return this.high!=0?M+33:M+1},E.isZero=function(){return this.high===0&&this.low===0},E.isNegative=function(){return!this.unsigned&&this.high<0},E.isPositive=function(){return this.unsigned||this.high>=0},E.isOdd=function(){return(this.low&1)===1},E.isEven=function(){return(this.low&1)===0},E.equals=function(y){return e(y)||(y=u(y)),this.unsigned!==y.unsigned&&this.high>>>31===1&&y.high>>>31===1?!1:this.high===y.high&&this.low===y.low},E.eq=E.equals,E.notEquals=function(y){return!this.eq(y)},E.neq=E.notEquals,E.lessThan=function(y){return this.comp(y)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(y){return this.comp(y)<=0},E.lte=E.lessThanOrEqual,E.greaterThan=function(y){return this.comp(y)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(y){return this.comp(y)>=0},E.gte=E.greaterThanOrEqual,E.compare=function(y){if(e(y)||(y=u(y)),this.eq(y))return 0;var M=this.isNegative(),I=y.isNegative();return M&&!I?-1:!M&&I?1:this.unsigned?y.high>>>0>this.high>>>0||y.high===this.high&&y.low>>>0>this.low>>>0?-1:1:this.sub(y).isNegative()?-1:1},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(C)?C:this.not().add(_)},E.neg=E.negate,E.add=function(y){e(y)||(y=u(y));var M=this.high>>>16,I=this.high&65535,O=this.low>>>16,R=this.low&65535,F=y.high>>>16,X=y.high&65535,z=y.low>>>16,Q=y.low&65535,W=0,K=0,ee=0,xe=0;return xe+=R+Q,ee+=xe>>>16,xe&=65535,ee+=O+z,K+=ee>>>16,ee&=65535,K+=I+X,W+=K>>>16,K&=65535,W+=M+F,W&=65535,s(ee<<16|xe,W<<16|K,this.unsigned)},E.subtract=function(y){return e(y)||(y=u(y)),this.add(y.neg())},E.sub=E.subtract,E.multiply=function(y){if(this.isZero()||(e(y)||(y=u(y)),y.isZero()))return m;if(this.eq(C))return y.isOdd()?C:m;if(y.eq(C))return this.isOdd()?C:m;if(this.isNegative())return y.isNegative()?this.neg().mul(y.neg()):this.neg().mul(y).neg();if(y.isNegative())return this.mul(y.neg()).neg();if(this.lt(g)&&y.lt(g))return o(this.toNumber()*y.toNumber(),this.unsigned);var M=this.high>>>16,I=this.high&65535,O=this.low>>>16,R=this.low&65535,F=y.high>>>16,X=y.high&65535,z=y.low>>>16,Q=y.low&65535,W=0,K=0,ee=0,xe=0;return xe+=R*Q,ee+=xe>>>16,xe&=65535,ee+=O*Q,K+=ee>>>16,ee&=65535,ee+=R*z,K+=ee>>>16,ee&=65535,K+=I*Q,W+=K>>>16,K&=65535,K+=O*z,W+=K>>>16,K&=65535,K+=R*X,W+=K>>>16,K&=65535,W+=M*Q+I*z+O*X+R*F,W&=65535,s(ee<<16|xe,W<<16|K,this.unsigned)},E.mul=E.multiply,E.divide=function(y){if(e(y)||(y=u(y)),y.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?A:m;var M,I,O;if(this.unsigned){if(y.unsigned||(y=y.toUnsigned()),y.gt(this))return A;if(y.gt(this.shru(1)))return v;O=A}else{if(this.eq(C)){if(y.eq(_)||y.eq(x))return C;if(y.eq(C))return _;var R=this.shr(1);return M=R.div(y).shl(1),M.eq(m)?y.isNegative()?_:x:(I=this.sub(y.mul(M)),O=M.add(I.div(y)),O)}else if(y.eq(C))return this.unsigned?A:m;if(this.isNegative())return y.isNegative()?this.neg().div(y.neg()):this.neg().div(y).neg();if(y.isNegative())return this.div(y.neg()).neg();O=m}for(I=this;I.gte(y);){M=Math.max(1,Math.floor(I.toNumber()/y.toNumber()));for(var F=Math.ceil(Math.log(M)/Math.LN2),X=F<=48?1:a(2,F-48),z=o(M),Q=z.mul(y);Q.isNegative()||Q.gt(I);)M-=X,z=o(M,this.unsigned),Q=z.mul(y);z.isZero()&&(z=_),O=O.add(z),I=I.sub(Q)}return O},E.div=E.divide,E.modulo=function(y){return e(y)||(y=u(y)),this.sub(this.div(y).mul(y))},E.mod=E.modulo,E.not=function(){return s(~this.low,~this.high,this.unsigned)},E.and=function(y){return e(y)||(y=u(y)),s(this.low&y.low,this.high&y.high,this.unsigned)},E.or=function(y){return e(y)||(y=u(y)),s(this.low|y.low,this.high|y.high,this.unsigned)},E.xor=function(y){return e(y)||(y=u(y)),s(this.low^y.low,this.high^y.high,this.unsigned)},E.shiftLeft=function(y){return e(y)&&(y=y.toInt()),(y&=63)===0?this:y<32?s(this.low<<y,this.high<<y|this.low>>>32-y,this.unsigned):s(0,this.low<<y-32,this.unsigned)},E.shl=E.shiftLeft,E.shiftRight=function(y){return e(y)&&(y=y.toInt()),(y&=63)===0?this:y<32?s(this.low>>>y|this.high<<32-y,this.high>>y,this.unsigned):s(this.high>>y-32,this.high>=0?0:-1,this.unsigned)},E.shr=E.shiftRight,E.shiftRightUnsigned=function(y){if(e(y)&&(y=y.toInt()),y&=63,y===0)return this;var M=this.high;if(y<32){var I=this.low;return s(I>>>y|M<<32-y,M>>>y,this.unsigned)}else return y===32?s(M,0,this.unsigned):s(M>>>y-32,0,this.unsigned)},E.shru=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?s(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:s(this.low,this.high,!0)},E.toBytes=function(b){return b?this.toBytesLE():this.toBytesBE()},E.toBytesLE=function(){var b=this.high,y=this.low;return[y&255,y>>>8&255,y>>>16&255,y>>>24&255,b&255,b>>>8&255,b>>>16&255,b>>>24&255]},E.toBytesBE=function(){var b=this.high,y=this.low;return[b>>>24&255,b>>>16&255,b>>>8&255,b&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255]},t})});var wo=re((nU,dp)=>{dp.exports=globalThis.h3||{}});var _t=re((hU,Cp)=>{Cp.exports=globalThis.luma});var Vo=re((bG,am)=>{am.exports=globalThis.deck});var jr=re((g4,Mm)=>{Mm.exports=globalThis.loaders});var iy=re((Nj,ny)=>{ny.exports=globalThis.deck});var py=re(Rl=>{Rl.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,c=(1<<a)-1,u=c>>1,l=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,o=d&(1<<-l)-1,d>>=-l,l+=a;l>0;o=o*256+t[e+f],f+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=s*256+t[e+f],f+=h,l-=8);if(o===0)o=1-u;else{if(o===c)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-u}return(d?-1:1)*s*Math.pow(2,o-n)};Rl.write=function(t,e,r,n,i,o){var s,a,c,u=o*8-i-1,l=(1<<u)-1,f=l>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+f>=1?e+=h/c:e+=h*Math.pow(2,1-f),e*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(e*c-1)*Math.pow(2,i),s=s+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=a&255,d+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+d]=s&255,d+=p,s/=256,u-=8);t[r+d-p]|=g*128}});var vy=re((Bk,_y)=>{"use strict";_y.exports=k;var Zs=py();function k(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}k.Varint=0;k.Fixed64=1;k.Bytes=2;k.Fixed32=5;var Ll=(1<<16)*(1<<16),my=1/Ll,s2=12,Ay=typeof TextDecoder>"u"?null:new TextDecoder("utf8");k.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Qs(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=yy(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Qs(this.buf,this.pos)+Qs(this.buf,this.pos+4)*Ll;return this.pos+=8,t},readSFixed64:function(){var t=Qs(this.buf,this.pos)+yy(this.buf,this.pos+4)*Ll;return this.pos+=8,t},readFloat:function(){var t=Zs.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Zs.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,a2(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=s2&&Ay?x2(this.buf,e,t):v2(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==k.Bytes)return t.push(this.readVarint(e));var r=Et(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==k.Bytes)return t.push(this.readSVarint());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==k.Bytes)return t.push(this.readBoolean());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==k.Bytes)return t.push(this.readFloat());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==k.Bytes)return t.push(this.readDouble());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==k.Bytes)return t.push(this.readFixed32());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==k.Bytes)return t.push(this.readSFixed32());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==k.Bytes)return t.push(this.readFixed64());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==k.Bytes)return t.push(this.readSFixed64());var e=Et(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===k.Varint)for(;this.buf[this.pos++]>127;);else if(e===k.Bytes)this.pos=this.readVarint()+this.pos;else if(e===k.Fixed32)this.pos+=4;else if(e===k.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),pn(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),pn(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),pn(this.buf,t&-1,this.pos),pn(this.buf,Math.floor(t*my),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),pn(this.buf,t&-1,this.pos),pn(this.buf,Math.floor(t*my),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){c2(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=T2(this.buf,t,this.pos);var r=this.pos-e;r>=128&&gy(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Zs.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Zs.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&gy(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,k.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,f2,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,h2,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,m2,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,d2,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,p2,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,g2,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,y2,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,A2,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,_2,e)},writeBytesField:function(t,e){this.writeTag(t,k.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,k.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,k.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,k.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,k.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,k.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,k.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,k.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,k.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,k.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function a2(t,e,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return dn(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function Et(t){return t.type===k.Bytes?t.readVarint()+t.pos:t.pos+1}function dn(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function c2(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),u2(r,n,e),l2(n,e)}function u2(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function l2(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function gy(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function f2(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function h2(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function d2(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function p2(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function m2(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function g2(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function y2(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function A2(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function _2(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Qs(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function pn(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function yy(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function v2(t,e,r){for(var n="",i=e;i<r;){var o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>r)break;var c,u,l;a===1?o<128&&(s=o):a===2?(c=t[i+1],(c&192)===128&&(s=(o&31)<<6|c&63,s<=127&&(s=null))):a===3?(c=t[i+1],u=t[i+2],(c&192)===128&&(u&192)===128&&(s=(o&15)<<12|(c&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(c=t[i+1],u=t[i+2],l=t[i+3],(c&192)===128&&(u&192)===128&&(l&192)===128&&(s=(o&15)<<18|(c&63)<<12|(u&63)<<6|l&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),i+=a}return n}function x2(t,e,r){return Ay.decode(t.subarray(e,r))}function T2(t,e,r){for(var n=0,i,o;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):o=i;continue}else o&&(t[r++]=239,t[r++]=191,t[r++]=189,o=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var Ei={};de(Ei,{GeohashLayer:()=>aa,GreatCircleLayer:()=>io,H3ClusterLayer:()=>Do,H3HexagonLayer:()=>cr,MVTLayer:()=>ia,QuadkeyLayer:()=>po,S2Layer:()=>lo,TerrainLayer:()=>ks,Tile3DLayer:()=>Ds,TileLayer:()=>At,TripsLayer:()=>Mo,_GeoCellLayer:()=>Le,_Tile2DHeader:()=>Pn,_Tileset2D:()=>Hn,_WMSLayer:()=>to,_getURLFromTemplate:()=>ot});var Qe={},Kl=P(Ve());St(Qe,P(Ve()));if(!Kl.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");St(Ei,Qe);var ar=P(ze()),fd=P(Ve());function iA(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function Ci(t){if(Array.isArray(t))return t.map(e=>Ci(e));if(t&&typeof t=="object"){let e={};for(let[r,n]of Object.entries(t))e[iA(r)]=Ci(n);return e}return t}var Of=P(If(),1);function pa(t,e){if(e!=null&&e._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(i,o,s,a)=>{var c;return Boolean(e==null||(c=e.arrayPaths)===null||c===void 0?void 0:c.some(l=>o===l))},...e?._fastXML},n=C1(t,r);return e!=null&&e.uncapitalizeKeys?Ci(n):n}function C1(t,e){return new Of.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var M1="4.1.0-alpha.9",Ae={name:"XML",id:"xml",module:"xml",version:M1,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:w1,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>pa(new TextDecoder().decode(t),{...Ae.options.xml,...e?.xml}),parseTextSync:(t,e)=>pa(t,{...Ae.options.xml,...e?.xml})};function w1(t){return t.startsWith("<?xml")}async function Ce(t,e,r,n){return n._parse(t,e,r,n)}function H(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var $e={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},I1=$e.self||$e.window||$e.global||{},O1=$e.window||$e.self||$e.global||{},R1=$e.global||$e.self||$e.window||{},L1=$e.document||{};var An=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Rf=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),P1=Rf&&parseFloat(Rf[1])||0;function ma(t,e){return Lf(t||{},e)}function Lf(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(r>3)return e;let n={...t};for(let[i,o]of Object.entries(e))o&&typeof o=="object"&&!Array.isArray(o)?n[i]=Lf(n[i]||{},e[i],r+1):n[i]=e[i];return n}function F1(){var t;return(t=globalThis._loadersgl_)!==null&&t!==void 0&&t.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.0-alpha.9"),globalThis._loadersgl_.version}var Pf=F1();function Ff(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var et={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},uR=et.self||et.window||et.global||{},lR=et.window||et.self||et.global||{},fR=et.global||et.self||et.window||{},hR=et.document||{};var Mr=typeof process!="object"||String(process)!=="[object process]"||process.browser,Ii=typeof importScripts=="function",dR=typeof window<"u"&&typeof window.orientation<"u",Df=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),pR=Df&&parseFloat(Df[1])||0;var ga={};async function tt(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return e&&(t=Nf(t,e,r,n)),ga[t]=ga[t]||D1(t),await ga[t]}function Nf(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!r.useLocalLibraries&&t.startsWith("http"))return t;n=n||t;let i=r.modules||{};return i[n]?i[n]:Mr?r.CDN?(Ff(r.CDN.startsWith("http")),`${r.CDN}/${e}@${Pf}/dist/libs/${n}`):Ii?`../src/libs/${n}`:`modules/${e}/src/libs/${n}`:`modules/${e}/dist/libs/${n}`}async function D1(t){if(t.endsWith("wasm"))return await U1(t);if(!Mr)try{return Me&&Me.requireFromFile&&await Me.requireFromFile(t)}catch(r){return console.error(r),null}if(Ii)return importScripts(t);let e=await G1(t);return N1(e,t)}function N1(t,e){if(!Mr)return Me.requireFromString&&Me.requireFromString(t,e);if(Ii)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function U1(t){return Mr||!Me.readFileAsArrayBuffer||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await Me.readFileAsArrayBuffer(t)}async function G1(t){return Mr||!Me.readFileAsText||t.startsWith("http")?await(await fetch(t)).text():await Me.readFileAsText(t)}function Gf(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?Uf(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?Uf(t,0,e):""}function Uf(t,e,r){if(t.byteLength<=e+r)return"";let n=new DataView(t),i="";for(let o=0;o<r;o++)i+=String.fromCharCode(n.getUint8(e+o));return i}function ya(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${Gf(t)}"`)}}function _n(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let n=e,i=n&&n.length>1&&n[0].constructor||null;if(!i)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let o=n.reduce((c,u)=>c+u.length,0),s=new i(o),a=0;for(let c of n)s.set(c,a),a+=c.length;return s}function Qt(t,e,r){let n=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}function Ct(t,e){return H(t>=0),H(e>0),t+(e-1)&~(e-1)}function Aa(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{let i=t.byteOffset,o=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,i,o)}return e.set(n,r),r+Ct(n.byteLength,4)}function vn(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var $t=class{constructor(e,r){this.name=void 0,this.type=void 0,this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=vn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(vn()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var Mt=class{constructor(e){this.id=void 0,this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,i=this.stats[r];return i||(e instanceof $t?i=e:i=new $t(r,n),this.stats[r]=i),i}};var H1="Queued Requests",V1="Active Requests",z1="Cancelled Requests",j1="Queued Requests Ever",k1="Active Requests Ever",J1={id:"request-scheduler",throttleRequests:!0,maxRequests:6},wt=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.deferredUpdate=null,this.props={...J1,...e},this.stats=new Mt({id:this.props.id}),this.stats.get(H1),this.stats.get(V1),this.stats.get(z1),this.stats.get(j1),this.stats.get(k1)}scheduleRequest(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let n={handle:e,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(e,i),this._issueNewRequests(),i}_issueRequest(e){let{handle:r,resolve:n}=e,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let n=e[r];this._updateRequest(n)||(e.splice(r,1),this.requestMap.delete(n.handle),r--)}e.sort((r,n)=>r.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var It={};de(It,{dirname:()=>W1,filename:()=>q1,join:()=>X1,resolve:()=>K1});function Hf(){var t;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=(t=window.location)===null||t===void 0?void 0:t.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function q1(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function W1(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function X1(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let n="/";return e=e.map((i,o)=>(o&&(i=i.replace(new RegExp(`^${n}`),"")),o!==e.length-1&&(i=i.replace(new RegExp(`${n}$`),"")),i)),e.join(n)}function K1(){let t=[];for(let i=0;i<arguments.length;i++)t[i]=i<0||arguments.length<=i?void 0:arguments[i];let e="",r=!1,n;for(let i=t.length-1;i>=-1&&!r;i--){let o;i>=0?o=t[i]:(n===void 0&&(n=Hf()),o=n),o.length!==0&&(e=`${o}/${e}`,r=o.charCodeAt(0)===xn)}return e=Y1(e,!r),r?`/${e}`:e.length>0?e:"."}var xn=47,_a=46;function Y1(t,e){let r="",n=-1,i=0,o,s=!1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(o===xn)break;o=xn}if(o===xn){if(!(n===a-1||i===1))if(n!==a-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==_a||r.charCodeAt(r.length-2)!==_a){if(r.length>2){let c=r.length-1,u=c;for(;u>=0&&r.charCodeAt(u)!==xn;--u);if(u!==c){r=u===-1?"":r.slice(0,u),n=a,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,i=0,s=!1;continue}}e&&(r.length>0?r+="/..":r="..",s=!0)}else{let c=t.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,s=!1}n=a,i=0}else o===_a&&i!==-1?++i:i=-1}return r}var Oi=class{constructor(e){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Z1(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function Z1(t){let e=t?.fetch;if(e&&typeof e=="function")return(n,i)=>e(n,i);let r=t?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Re=class extends Oi{};Re.type="template";Re.testURL=t=>!1;function Vf(t,e){var r,n,i;let o=(r=Ae.parseTextSync)===null||r===void 0?void 0:r.call(Ae,t,e),s=(o==null||(n=o.ServiceExceptionReport)===null||n===void 0?void 0:n.ServiceException)||(o==null||(i=o["ogc:ServiceExceptionReport"])===null||i===void 0?void 0:i["ogc:ServiceException"]);return typeof s=="string"?s:s.value||s.code||"Unknown error"}var Q1="4.1.0-alpha.9",er={id:"wms-error",name:"WMS Error",module:"wms",version:Q1,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:$1,options:{wms:{throwOnError:!1}},parse:async(t,e)=>va(new TextDecoder().decode(t),e),parseSync:(t,e)=>va(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>va(t,e)};function $1(t){return t.startsWith("<?xml")}function va(t,e){let r={...er.options.wms,...e?.wms},n=Vf(t,r),i=r.minimalErrors?n:`WMS Service error: ${n}`;if(r.throwOnError)throw new Error(i);return i}function tr(t){return Array.isArray(t)?t:t?[t]:[]}function Tn(t){let e=tr(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function bn(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function Ri(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function rr(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function xa(t,e){var r;let n=(r=Ae.parseTextSync)===null||r===void 0?void 0:r.call(Ae,t,e),i=n.WMT_MS_Capabilities||n.WMS_Capabilities||n,o=e_(i);if(e!=null&&e.inheritedLayerProps)for(let s of o.layers)jf(s,null);return e!=null&&e.includeRawJSON&&(o.json=i),e!=null&&e.includeXMLText&&(o.xml=t),o}function e_(t){var e,r,n,i,o,s,a,c,u,l,f,h,d,p,g,m;let A={version:String(t.version||""),name:String(((e=t.Service)===null||e===void 0?void 0:e.Name)||"unnamed"),title:(r=t.Service)!==null&&r!==void 0&&r.Title?String((n=t.Service)===null||n===void 0?void 0:n.Title):void 0,abstract:(i=t.Service)!==null&&i!==void 0&&i.Abstract?String((o=t.Service)===null||o===void 0?void 0:o.Abstract):void 0,keywords:Tn((s=t.Service)===null||s===void 0||(a=s.KeywordList)===null||a===void 0?void 0:a.Keyword),fees:(c=t.Service)!==null&&c!==void 0&&c.Fees?JSON.stringify((u=t.Service)===null||u===void 0?void 0:u.Fees):void 0,accessConstraints:(l=t.Service)!==null&&l!==void 0&&l.AccessConstraints?JSON.stringify((f=t.Service)===null||f===void 0?void 0:f.AccessConstraints):void 0,layerLimit:Ri((h=t.Service)===null||h===void 0?void 0:h.LayerLimit),maxWidth:Ri((d=t.Service)===null||d===void 0?void 0:d.maxWidth),maxHeight:Ri((p=t.Service)===null||p===void 0?void 0:p.maxHeight),layers:[],requests:t_((g=t.Capability)===null||g===void 0?void 0:g.Request),exceptions:r_(t.Exception)},_=tr((m=t.Capability)===null||m===void 0?void 0:m.Layer);for(let v of _)A.layers.push(zf(v));for(let[v,x]of Object.entries(A))x===void 0&&delete A[v];return A}function t_(t){let e={};for(let[r,n]of Object.entries(t||{})){let i=Tn(n?.Format);e[r]={mimeTypes:i}}return e}function r_(t){if(tr(t?.Format).length>0)return{mimeTypes:Tn(t)}}function zf(t){var e;let r={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:Tn((e=t.KeywordList)===null||e===void 0?void 0:e.Keyword)},n=t?.CRS||t?.SRS;n&&Array.isArray(n)&&n.every(l=>typeof l=="string")&&(r.crs=n);let i=t?.EX_GeographicBoundingBox&&n_(t?.EX_GeographicBoundingBox);i&&(r.geographicBoundingBox=i),i=t?.LatLonBoundingBox&&i_(t?.LatLonBoundingBox),i&&(r.geographicBoundingBox=i);let o=t?.BoundingBox&&o_(t?.BoundingBox);o&&o.length>0&&(r.boundingBoxes=o);let a=tr(t?.Dimension).map(l=>a_(l));a.length&&(r.dimensions=a),t!=null&&t.opaque&&(r.opaque=rr(t?.opaque)),t!=null&&t.cascaded&&(r.cascaded=rr(t?.cascaded)),t!=null&&t.queryable&&(r.queryable=rr(t?.queryable));let c=tr(t?.Layer),u=[];for(let l of c)u.push(zf(l));u.length>0&&(r.layers=u);for(let[l,f]of Object.entries(r))f===void 0&&delete r[l];return r}function n_(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:n,southBoundLatitude:i}=t;return[[e,i],[n,r]]}function i_(t){let{minx:e,miny:r,maxx:n,maxy:i}=t;return[[e,r],[n,i]]}function o_(t){return tr(t).map(r=>s_(r))}function s_(t){let{CRS:e,SRS:r,minx:n,miny:i,maxx:o,maxy:s,resx:a,resy:c}=t,u={crs:e||r,boundingBox:[[bn(n),bn(i)],[bn(o),bn(s)]]};return a&&(u.xResolution=a),c&&(u.yResolution=c),u}function a_(t){let{name:e,units:r,value:n}=t,i={name:e,units:r,extent:n};return t.unitSymbol&&(i.unitSymbol=t.unitSymbol),t.default&&(i.defaultValue=t.default),t.multipleValues&&(i.multipleValues=rr(t.multipleValues)),t.nearestValue&&(i.nearestValue=rr(t.nearestValue)),t.current&&(i.current=rr(t.current)),i}function jf(t,e){e!=null&&e.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e!=null&&e.crs&&!t.crs&&(t.crs=[...e.crs]),e!=null&&e.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e!=null&&e.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])jf(r,t)}var c_="4.1.0-alpha.9",wr={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:c_,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:u_,options:{wms:{}},parse:async(t,e)=>xa(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>xa(t,e?.wms)};function u_(t){return t.startsWith("<?xml")}function Ta(t,e){var r,n;let o=((n=((r=Ae.parseTextSync)===null||r===void 0?void 0:r.call(Ae,t,e)).FeatureInfoResponse)===null||n===void 0?void 0:n.FIELDS)||[];return{features:(Array.isArray(o)?o:[o]).map(a=>l_(a))}}function l_(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var kf={...wr,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>Ta(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>Ta(t,e)};function ba(t,e){var r;return(r=Ae.parseTextSync)===null||r===void 0?void 0:r.call(Ae,t,e)}var Jf={...wr,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>ba(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>ba(t,e)};function qf(t,e){let{type:r="auto"}=t,n=r==="auto"?h_(t.url,e):f_(r,e);if(!n)throw new Error("Not a valid image source type");return n.create(t)}function f_(t,e){for(let r of e)if(r.type===t)return r;return null}function h_(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var Wf="4.1.0-alpha.9";var Ea,d_=(Ea=globalThis.loaders)===null||Ea===void 0?void 0:Ea.parseImageNode,Sa=typeof Image<"u",Ba=typeof ImageBitmap<"u",p_=Boolean(d_),Ca=An?!0:p_;function Xf(t){switch(t){case"auto":return Ba||Sa||Ca;case"imagebitmap":return Ba;case"image":return Sa;case"data":return Ca;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function Kf(){if(Ba)return"imagebitmap";if(Sa)return"image";if(Ca)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Yf(t){let e=m_(t);if(!e)throw new Error("Not an image");return e}function En(t){switch(Yf(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function m_(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var g_=/^data:image\/svg\+xml/,y_=/\.svg((\?|#).*)?$/;function Li(t){return t&&(g_.test(t)||y_.test(t))}function Zf(t,e){if(Li(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Ma(t,e)}function Ma(t,e){if(Li(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function Pi(t,e,r){let n=Zf(t,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await A_(o||n,e)}finally{o&&i.revokeObjectURL(o)}}async function A_(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var __={},Qf=!0;async function $f(t,e,r){let n;Li(r)?n=await Pi(t,e,r):n=Ma(t,r);let i=e&&e.imagebitmap;return await v_(n,i)}async function v_(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((x_(e)||!Qf)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),Qf=!1}return await createImageBitmap(t)}function x_(t){for(let e in t||__)return!1;return!0}function eh(t){return!S_(t,"ftyp",4)||!(t[8]&96)?null:T_(t)}function T_(t){switch(b_(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function b_(t,e,r){return String.fromCharCode(...t.slice(e,r))}function E_(t){return[...t].map(e=>e.charCodeAt(0))}function S_(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=E_(e);for(let i=0;i<n.length;++i)if(n[i]!==t[i+r])return!1;return!0}var rt=!1,Sn=!0;function nr(t){let e=Bn(t);return C_(e)||I_(e)||M_(e)||w_(e)||B_(e)}function B_(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=eh(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function C_(t){let e=Bn(t);return e.byteLength>=24&&e.getUint32(0,rt)===2303741511?{mimeType:"image/png",width:e.getUint32(16,rt),height:e.getUint32(20,rt)}:null}function M_(t){let e=Bn(t);return e.byteLength>=10&&e.getUint32(0,rt)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Sn),height:e.getUint16(8,Sn)}:null}function w_(t){let e=Bn(t);return e.byteLength>=14&&e.getUint16(0,rt)===16973&&e.getUint32(2,Sn)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Sn),height:e.getUint32(22,Sn)}:null}function I_(t){let e=Bn(t);if(!(e.byteLength>=3&&e.getUint16(0,rt)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=O_(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,rt);if(i.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,rt),width:e.getUint16(o+7,rt)};if(!n.has(s))return null;o+=2,o+=e.getUint16(o,rt)}return null}function O_(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Bn(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function th(t,e){var r;let{mimeType:n}=nr(t)||{},i=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return H(i),await i(t,n)}async function rh(t,e,r){e=e||{};let i=(e.image||{}).type||"auto",{url:o}=r||{},s=R_(i),a;switch(s){case"imagebitmap":a=await $f(t,e,o);break;case"image":a=await Pi(t,e,o);break;case"data":a=await th(t,e);break;default:H(!1)}return i==="data"&&(a=En(a)),a}function R_(t){switch(t){case"auto":case"data":return Kf();default:return Xf(t),t}}var L_=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],P_=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],F_={image:{type:"auto",decode:!0}},Ot={id:"image",module:"images",name:"Images",version:Wf,mimeTypes:P_,extensions:L_,parse:rh,tests:[t=>Boolean(nr(new DataView(t)))],options:F_};var wa={};function Ia(t){if(wa[t]===void 0){let e=An?N_(t):D_(t);wa[t]=e}return wa[t]}function D_(t){var e,r;let n=["image/png","image/jpeg","image/gif"],i=((e=globalThis.loaders)===null||e===void 0?void 0:e.imageFormatsNode)||n,o=(r=globalThis.loaders)===null||r===void 0?void 0:r.parseImageNode;return Boolean(o)&&i.includes(t)}function N_(t){switch(t){case"image/avif":case"image/webp":return U_(t);default:return!0}}function U_(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var nh={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new Oa(t)},Oa=class extends Re{constructor(e){var r;super(e),this.url=void 0,this.data=void 0,this.substituteCRS84=void 0,this.flipCRS=void 0,this.wmsParameters=void 0,this.vendorParameters=void 0,this.capabilities=null,this.url=e.url,this.data=e.url,this.substituteCRS84=(r=e.substituteCRS84)!==null&&r!==void 0?r:!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:n,...i}=e,o={bbox:r?[...r[0],...r[1]]:n,...i};return await this.getMap(o)}normalizeMetadata(e){return e}async getCapabilities(e,r){let n=this.getCapabilitiesURL(e,r),i=await this.fetch(n),o=await i.arrayBuffer();this._checkResponse(i,o);let s=await wr.parse(o,this.loadOptions);return this.capabilities=s,s}async getMap(e,r){let n=this.getMapURL(e,r),i=await this.fetch(n),o=await i.arrayBuffer();this._checkResponse(i,o);try{return await Ot.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(e,r){let n=this.getFeatureInfoURL(e,r),i=await this.fetch(n),o=await i.arrayBuffer();return this._checkResponse(i,o),await kf.parse(o,this.loadOptions)}async getFeatureInfoText(e,r){let n=this.getFeatureInfoURL(e,r),i=await this.fetch(n),o=await i.arrayBuffer();return this._checkResponse(i,o),new TextDecoder().decode(o)}async describeLayer(e,r){let n=this.describeLayerURL(e,r),i=await this.fetch(n),o=await i.arrayBuffer();return this._checkResponse(i,o),await Jf.parse(o,this.loadOptions)}async getLegendGraphic(e,r){let n=this.getLegendGraphicURL(e,r),i=await this.fetch(n),o=await i.arrayBuffer();this._checkResponse(i,o);try{return await Ot.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",n,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let n={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",n,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let n={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetFeatureInfo",n,r)}describeLayerURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",n,r)}getLegendGraphicURL(e,r){let n={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",n,r)}_parseWMSUrl(e){let[r,n]=e.split("?"),i=n.split("&"),o={};for(let s of i){let[a,c]=s.split("=");o[a]=c}return{url:r,parameters:o}}_getWMSUrl(e,r,n){let i=this.url,o=!0,s={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...n},a=["transparent","time","elevation"];for(let[c,u]of Object.entries(s))(!a.includes(c)||u)&&(i+=o?"?":"&",o=!1,i+=this._getURLParameter(c,u,r));return encodeURI(i)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,n){switch(e){case"crs":n.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":n.version==="1.3.0"&&(e="crs");break;case"bbox":let i=this._flipBoundingBox(r,n);i&&(r=i);break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let n=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),i=e;return n?[i[1],i[0],i[3],i[2]]:i}async _fetchArrayBuffer(e){let r=await this.fetch(e),n=await r.arrayBuffer();return this._checkResponse(r,n),n}_checkResponse(e,r){let n=e.headers["content-type"];if(!e.ok||er.mimeTypes.includes(n)){var i;let o=ma(this.loadOptions,{wms:{throwOnError:!0}}),s=(i=er.parseSync)===null||i===void 0?void 0:i.call(er,r,o);throw new Error(s)}}_parseError(e){var r;let n=(r=er.parseSync)===null||r===void 0?void 0:r.call(er,e,this.loadOptions);return new Error(n)}};var Ir=class extends Re{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),n=this.getURLFromTemplate(r),o=await(await this.fetch(n)).arrayBuffer();return await Ot.parse(o)}getGranularParameters(e){let[[r,n],[i,o]]=e.boundingBox;return{...e,east:r,north:n,south:o,west:i}}getURLFromTemplate(e){let r=this.props.url;for(let[n,i]of Object.entries(e))r=r.replace(`\${${n}}`,String(i)),r=r.replace(`{${n}}`,String(i));return r}};Ir.type="template";Ir.testURL=t=>t.toLowerCase().includes("{");var Ra=class extends Ir{constructor(e){super(e),this.data=void 0,this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,n=`size=${e.width},${e.height}`,i={...e,bbox:r,size:n};return delete i.width,delete i.height,this.getUrl("exportImage",i)}getUrl(e,r,n){let i=`${this.props.url}/${e}`,o=!0;for(let[s,a]of Object.entries(r))i+=o?"?":"&",o=!1,Array.isArray(a)?i+=`${s.toUpperCase()}=${a.join(",")}`:i+=`${s.toUpperCase()}=${a?String(a):""}`;return i}async checkResponse(e){if(!e.ok)throw new Error("error")}},ih={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new Ra(t)};var G_=[nh,ih];function La(t){return qf(t,G_)}function L(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var H_=1/Math.PI*180,V_=1/180*Math.PI,z_={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...z_}};var Y=globalThis.mathgl.config;function Pa(t,{precision:e=Y.precision}={}){return t=j_(t),"".concat(parseFloat(t.toPrecision(e)))}function we(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Fa(t){return oh(t)}function Da(t){return Ie(t)}function oh(t,e){return Na(t,r=>r*V_,e)}function Ie(t,e){return Na(t,r=>r*H_,e)}function Fi(t,e,r){return Na(t,n=>Math.max(e,Math.min(r,n)))}function Rt(t,e,r){return we(t)?t.map((n,i)=>Rt(n,e[i],r)):r*e+(1-r)*t}function _e(t,e,r){let n=Y.EPSILON;r&&(Y.EPSILON=r);try{if(t===e)return!0;if(we(t)&&we(e)){if(t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(!_e(t[i],e[i]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=Y.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{Y.EPSILON=n}}function j_(t){return Math.round(t/Y.EPSILON)*Y.EPSILON}function k_(t){return t.clone?t.clone():new Array(t.length)}function Na(t,e,r){if(we(t)){let n=t;r=r||k_(n);for(let i=0;i<r.length&&i<n.length;++i){let o=typeof t=="number"?t:t[i];r[i]=e(o,i,r)}return r}return e(t)}function J_(t){function e(){var r=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(r,Object.getPrototypeOf(this)),r}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}var Lt=class extends J_(Array){clone(){return new this.constructor().copy(this)}fromArray(e,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+r];return this.check()}toArray(e=[],r=0){for(let n=0;n<this.ELEMENTS;++n)e[r+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:we(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Y)}formatString(e){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+Pa(this[n],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(r,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!_e(this[r],e[r]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==e[r])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,r,n){if(n===void 0)return this.lerp(this,e,r);for(let i=0;i<this.ELEMENTS;++i){let o=e[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(e[r],this[r]);return this.check()}max(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(e[r],this[r]);return this.check()}clamp(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),r[n]);return this.check()}add(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(e){if(typeof e=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;else for(let r=0;r<this.ELEMENTS&&r<e.length;++r)this[r]*=e[r];return this.check()}multiplyByScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}check(){if(Y.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)e=e&&Number.isFinite(this[r]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]=e;return this.check()}addScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let r=0;r<this.ELEMENTS;++r)this[r]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),r);return this.check()}get elements(){return this}};function q_(t,e){if(t.length!==e)return!1;for(let r=0;r<t.length;++r)if(!Number.isFinite(t[r]))return!1;return!0}function G(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(JSON.stringify(t)));return t}function Pt(t,e,r=""){if(Y.debug&&!q_(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}function le(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}var Ft=class extends Lt{get x(){return this[0]}set x(e){this[0]=G(e)}get y(){return this[1]}set y(e){this[1]=G(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*this[r];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-e[n];r+=i*i}return G(r)}dot(e){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*e[n];return G(r)}normalize(){let e=this.magnitude();if(e!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=e;return this.check()}multiply(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...e){for(let r of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return le(e>=0&&e<this.ELEMENTS,"index is out of range"),G(this[e])}setComponent(e,r){return le(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=r,this.check()}addVectors(e,r){return this.copy(e).add(r)}subVectors(e,r){return this.copy(e).subtract(r)}multiplyVectors(e,r){return this.copy(e).multiply(r)}addScaledVector(e,r){return this.add(new this.constructor(e).multiplyScalar(r))}};var $=typeof Float32Array<"u"?Float32Array:Array,Cn=Math.random;function Or(t){return t>=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}var jP=Math.PI/180;function W_(){let t=new $(2);return $!=Float32Array&&(t[0]=0,t[1]=0),t}function sh(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t}function ah(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t}function Di(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function Ni(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}var kP=function(){let t=W_();return function(e,r,n,i,o,s){let a,c;for(r||(r=2),n||(n=0),i?c=Math.min(i*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],o(t,t,s),e[a]=t[0],e[a+1]=t[1];return e}}();function Ui(t,e,r){let n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}function Gi(t,e,r){let n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/s,t[1]=(r[1]*n+r[5]*i+r[9]*o)/s,t[2]=(r[2]*n+r[6]*i+r[10]*o)/s,t}function ch(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2],t}function uh(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2],t[3]=e[3],t}function Hi(t,e,r){let n=e[0],i=e[1],o=e[2];return t[0]=r[0]*n+r[3]*i+r[6]*o,t[1]=r[1]*n+r[4]*i+r[7]*o,t[2]=r[2]*n+r[5]*i+r[8]*o,t[3]=e[3],t}var ir=class extends Ft{constructor(e=0,r=0){super(2),we(e)&&arguments.length===1?this.copy(e):(Y.debug&&(G(e),G(r)),this[0]=e,this[1]=r)}set(e,r){return this[0]=e,this[1]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this.check()}fromObject(e){return Y.debug&&(G(e.x),G(e.y)),this[0]=e.x,this[1]=e.y,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return Ni(this,this,e),this.check()}transformAsVector(e){return Ui(this,this,e),this.check()}transformByMatrix3(e){return Di(this,this,e),this.check()}transformByMatrix2x3(e){return ah(this,this,e),this.check()}transformByMatrix2(e){return sh(this,this,e),this.check()}};var Lr={};de(Lr,{add:()=>Z_,angle:()=>za,bezier:()=>lv,ceil:()=>Q_,clone:()=>X_,copy:()=>K_,create:()=>Vi,cross:()=>or,dist:()=>_v,distance:()=>ph,div:()=>Av,divide:()=>dh,dot:()=>Mn,equals:()=>mv,exactEquals:()=>pv,floor:()=>$_,forEach:()=>Tv,fromValues:()=>zi,hermite:()=>uv,inverse:()=>sv,len:()=>ja,length:()=>lh,lerp:()=>av,max:()=>tv,min:()=>ev,mul:()=>yv,multiply:()=>hh,negate:()=>ov,normalize:()=>Ua,random:()=>fv,rotateX:()=>Ga,rotateY:()=>Ha,rotateZ:()=>Va,round:()=>rv,scale:()=>nv,scaleAndAdd:()=>iv,set:()=>Y_,slerp:()=>cv,sqrDist:()=>vv,sqrLen:()=>xv,squaredDistance:()=>mh,squaredLength:()=>gh,str:()=>dv,sub:()=>gv,subtract:()=>fh,transformMat3:()=>wn,transformMat4:()=>sr,transformQuat:()=>In,zero:()=>hv});function Vi(){let t=new $(3);return $!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function X_(t){let e=new $(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function lh(t){let e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function zi(t,e,r){let n=new $(3);return n[0]=t,n[1]=e,n[2]=r,n}function K_(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Y_(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function Z_(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function fh(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function hh(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function dh(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function Q_(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function $_(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function ev(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function tv(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function rv(t,e){return t[0]=Or(e[0]),t[1]=Or(e[1]),t[2]=Or(e[2]),t}function nv(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function iv(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function ph(t,e){let r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)}function mh(t,e){let r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}function gh(t){let e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function ov(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function sv(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function Ua(t,e){let r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function Mn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function or(t,e,r){let n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2];return t[0]=i*c-o*a,t[1]=o*s-n*c,t[2]=n*a-i*s,t}function av(t,e,r,n){let i=e[0],o=e[1],s=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=s+n*(r[2]-s),t}function cv(t,e,r,n){let i=Math.acos(Math.min(Math.max(Mn(e,r),-1),1)),o=Math.sin(i),s=Math.sin((1-n)*i)/o,a=Math.sin(n*i)/o;return t[0]=s*e[0]+a*r[0],t[1]=s*e[1]+a*r[1],t[2]=s*e[2]+a*r[2],t}function uv(t,e,r,n,i,o){let s=o*o,a=s*(2*o-3)+1,c=s*(o-2)+o,u=s*(o-1),l=s*(3-2*o);return t[0]=e[0]*a+r[0]*c+n[0]*u+i[0]*l,t[1]=e[1]*a+r[1]*c+n[1]*u+i[1]*l,t[2]=e[2]*a+r[2]*c+n[2]*u+i[2]*l,t}function lv(t,e,r,n,i,o){let s=1-o,a=s*s,c=o*o,u=a*s,l=3*o*a,f=3*c*s,h=c*o;return t[0]=e[0]*u+r[0]*l+n[0]*f+i[0]*h,t[1]=e[1]*u+r[1]*l+n[1]*f+i[1]*h,t[2]=e[2]*u+r[2]*l+n[2]*f+i[2]*h,t}function fv(t,e){e=e===void 0?1:e;let r=Cn()*2*Math.PI,n=Cn()*2-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t}function sr(t,e,r){let n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,t}function wn(t,e,r){let n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}function In(t,e,r){let n=r[0],i=r[1],o=r[2],s=r[3],a=e[0],c=e[1],u=e[2],l=i*u-o*c,f=o*a-n*u,h=n*c-i*a,d=i*h-o*f,p=o*l-n*h,g=n*f-i*l,m=s*2;return l*=m,f*=m,h*=m,d*=2,p*=2,g*=2,t[0]=a+l+d,t[1]=c+f+p,t[2]=u+h+g,t}function Ga(t,e,r,n){let i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function Ha(t,e,r,n){let i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function Va(t,e,r,n){let i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function za(t,e){let r=t[0],n=t[1],i=t[2],o=e[0],s=e[1],a=e[2],c=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+a*a)),u=c&&Mn(t,e)/c;return Math.acos(Math.min(Math.max(u,-1),1))}function hv(t){return t[0]=0,t[1]=0,t[2]=0,t}function dv(t){return"vec3(".concat(t[0],", ").concat(t[1],", ").concat(t[2],")")}function pv(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function mv(t,e){let r=t[0],n=t[1],i=t[2],o=e[0],s=e[1],a=e[2];return Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=1e-6*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))}var gv=fh,yv=hh,Av=dh,_v=ph,vv=mh,ja=lh,xv=gh,Tv=function(){let t=Vi();return function(e,r,n,i,o,s){let a,c;for(r||(r=3),n||(n=0),i?c=Math.min(i*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],o(t,t,s),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2];return e}}();var ka=[0,0,0],ji,T=class extends Ft{static get ZERO(){return ji||(ji=new T(0,0,0),Object.freeze(ji)),ji}constructor(e=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&we(e)?this.copy(e):(Y.debug&&(G(e),G(r),G(n)),this[0]=e,this[1]=r,this[2]=n)}set(e,r,n){return this[0]=e,this[1]=r,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return Y.debug&&(G(e.x),G(e.y),G(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=G(e)}angle(e){return za(this,e)}cross(e){return or(this,this,e),this.check()}rotateX({radians:e,origin:r=ka}){return Ga(this,this,r,e),this.check()}rotateY({radians:e,origin:r=ka}){return Ha(this,this,r,e),this.check()}rotateZ({radians:e,origin:r=ka}){return Va(this,this,r,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return sr(this,this,e),this.check()}transformAsVector(e){return Gi(this,this,e),this.check()}transformByMatrix3(e){return wn(this,this,e),this.check()}transformByMatrix2(e){return ch(this,this,e),this.check()}transformByQuaternion(e){return In(this,this,e),this.check()}};var ki,Pr=class extends Ft{static get ZERO(){return ki||(ki=new Pr(0,0,0,0),Object.freeze(ki)),ki}constructor(e=0,r=0,n=0,i=0){super(-0,-0,-0,-0),we(e)&&arguments.length===1?this.copy(e):(Y.debug&&(G(e),G(r),G(n),G(i)),this[0]=e,this[1]=r,this[2]=n,this[3]=i)}set(e,r,n,i){return this[0]=e,this[1]=r,this[2]=n,this[3]=i,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}fromObject(e){return Y.debug&&(G(e.x),G(e.y),G(e.z),G(e.w)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e.w=this[3],e}get ELEMENTS(){return 4}get z(){return this[2]}set z(e){this[2]=G(e)}get w(){return this[3]}set w(e){this[3]=G(e)}transform(e){return sr(this,this,e),this.check()}transformByMatrix3(e){return Hi(this,this,e),this.check()}transformByMatrix2(e){return uh(this,this,e),this.check()}transformByQuaternion(e){return In(this,this,e),this.check()}applyMatrix4(e){return e.transform(this,this),this}};var Fr=class extends Lt{toString(){let e="[";if(Y.printRowMajor){e+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)e+=" ".concat(this[n*this.RANK+r])}else{e+="column-major:";for(let r=0;r<this.ELEMENTS;++r)e+=" ".concat(this[r])}return e+="]",e}getElementIndex(e,r){return r*this.RANK+e}getElement(e,r){return this[r*this.RANK+e]}setElement(e,r,n){return this[r*this.RANK+e]=G(n),this}getColumn(e,r=new Array(this.RANK).fill(-0)){let n=e*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(e,r){let n=e*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}};function yh(){let t=new $(9);return $!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Ah(t,e){if(t===e){let r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function _h(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=l*s-a*u,h=-l*o+a*c,d=u*o-s*c,p=r*f+n*h+i*d;return p?(p=1/p,t[0]=f*p,t[1]=(-l*n+i*u)*p,t[2]=(a*n-i*s)*p,t[3]=h*p,t[4]=(l*r-i*c)*p,t[5]=(-a*r+i*o)*p,t[6]=d*p,t[7]=(-u*r+n*c)*p,t[8]=(s*r-n*o)*p,t):null}function vh(t){let e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],c=t[7],u=t[8];return e*(u*o-s*c)+r*(-u*i+s*a)+n*(c*i-o*a)}function Ja(t,e,r){let n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=r[0],d=r[1],p=r[2],g=r[3],m=r[4],A=r[5],_=r[6],v=r[7],x=r[8];return t[0]=h*n+d*s+p*u,t[1]=h*i+d*a+p*l,t[2]=h*o+d*c+p*f,t[3]=g*n+m*s+A*u,t[4]=g*i+m*a+A*l,t[5]=g*o+m*c+A*f,t[6]=_*n+v*s+x*u,t[7]=_*i+v*a+x*l,t[8]=_*o+v*c+x*f,t}function xh(t,e,r){let n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=c,t[6]=h*n+d*s+u,t[7]=h*i+d*a+l,t[8]=h*o+d*c+f,t}function Th(t,e,r){let n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=Math.sin(r),d=Math.cos(r);return t[0]=d*n+h*s,t[1]=d*i+h*a,t[2]=d*o+h*c,t[3]=d*s-h*n,t[4]=d*a-h*i,t[5]=d*c-h*o,t[6]=u,t[7]=l,t[8]=f,t}function qa(t,e,r){let n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function bh(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,c=i+i,u=r*s,l=n*s,f=n*a,h=i*s,d=i*a,p=i*c,g=o*s,m=o*a,A=o*c;return t[0]=1-f-p,t[3]=l-A,t[6]=h+m,t[1]=l+A,t[4]=1-u-p,t[7]=d-g,t[2]=h-m,t[5]=d+g,t[8]=1-u-f,t}var Wa;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL1ROW0=3]="COL1ROW0",t[t.COL1ROW1=4]="COL1ROW1",t[t.COL1ROW2=5]="COL1ROW2",t[t.COL2ROW0=6]="COL2ROW0",t[t.COL2ROW1=7]="COL2ROW1",t[t.COL2ROW2=8]="COL2ROW2"})(Wa||(Wa={}));var Ev=Object.freeze([1,0,0,0,1,0,0,0,1]),j=class extends Fr{static get IDENTITY(){return Bv()}static get ZERO(){return Sv()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Wa}constructor(e,...r){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):r.length>0?this.copy([e,...r]):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this.check()}identity(){return this.copy(Ev)}fromObject(e){return this.check()}fromQuaternion(e){return bh(this,e),this.check()}set(e,r,n,i,o,s,a,c,u){return this[0]=e,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=u,this.check()}setRowMajor(e,r,n,i,o,s,a,c,u){return this[0]=e,this[1]=i,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=s,this[8]=u,this.check()}determinant(){return vh(this)}transpose(){return Ah(this,this),this.check()}invert(){return _h(this,this),this.check()}multiplyLeft(e){return Ja(this,e,this),this.check()}multiplyRight(e){return Ja(this,this,e),this.check()}rotate(e){return Th(this,this,e),this.check()}scale(e){return Array.isArray(e)?qa(this,this,e):qa(this,this,[e,e]),this.check()}translate(e){return xh(this,this,e),this.check()}transform(e,r){let n;switch(e.length){case 2:n=Di(r||[-0,-0],e,this);break;case 3:n=wn(r||[-0,-0,-0],e,this);break;case 4:n=Hi(r||[-0,-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Pt(n,e.length),n}transformVector(e,r){return this.transform(e,r)}transformVector2(e,r){return this.transform(e,r)}transformVector3(e,r){return this.transform(e,r)}},Ji,qi=null;function Sv(){return Ji||(Ji=new j([0,0,0,0,0,0,0,0,0]),Object.freeze(Ji)),Ji}function Bv(){return qi||(qi=new j,Object.freeze(qi)),qi}var Wi={};de(Wi,{add:()=>Zv,adjoint:()=>Rv,clone:()=>Mv,copy:()=>wv,create:()=>Cv,decompose:()=>zv,determinant:()=>Ya,equals:()=>tx,exactEquals:()=>ex,frob:()=>Yv,fromQuat:()=>nc,fromQuat2:()=>Gv,fromRotation:()=>Fv,fromRotationTranslation:()=>Sh,fromRotationTranslationScale:()=>jv,fromRotationTranslationScaleOrigin:()=>kv,fromScaling:()=>Pv,fromTranslation:()=>Lv,fromValues:()=>Iv,fromXRotation:()=>Dv,fromYRotation:()=>Nv,fromZRotation:()=>Uv,frustum:()=>ic,getRotation:()=>Vv,getScaling:()=>Bh,getTranslation:()=>Hv,identity:()=>Eh,invert:()=>Ka,lookAt:()=>ac,mul:()=>rx,multiply:()=>On,multiplyScalar:()=>Qv,multiplyScalarAndAdd:()=>$v,ortho:()=>sc,orthoNO:()=>Mh,orthoZO:()=>Wv,perspective:()=>oc,perspectiveFromFieldOfView:()=>qv,perspectiveNO:()=>Ch,perspectiveZO:()=>Jv,rotate:()=>$a,rotateX:()=>ec,rotateY:()=>tc,rotateZ:()=>rc,scale:()=>Qa,set:()=>Ov,str:()=>Kv,sub:()=>nx,subtract:()=>wh,targetTo:()=>Xv,translate:()=>Za,transpose:()=>Xa});function Cv(){let t=new $(16);return $!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function Mv(t){let e=new $(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function wv(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Iv(t,e,r,n,i,o,s,a,c,u,l,f,h,d,p,g){let m=new $(16);return m[0]=t,m[1]=e,m[2]=r,m[3]=n,m[4]=i,m[5]=o,m[6]=s,m[7]=a,m[8]=c,m[9]=u,m[10]=l,m[11]=f,m[12]=h,m[13]=d,m[14]=p,m[15]=g,m}function Ov(t,e,r,n,i,o,s,a,c,u,l,f,h,d,p,g,m){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=s,t[6]=a,t[7]=c,t[8]=u,t[9]=l,t[10]=f,t[11]=h,t[12]=d,t[13]=p,t[14]=g,t[15]=m,t}function Eh(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Xa(t,e){if(t===e){let r=e[1],n=e[2],i=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Ka(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],p=e[12],g=e[13],m=e[14],A=e[15],_=r*a-n*s,v=r*c-i*s,x=r*u-o*s,B=n*c-i*a,S=n*u-o*a,C=i*u-o*c,E=l*g-f*p,b=l*m-h*p,y=l*A-d*p,M=f*m-h*g,I=f*A-d*g,O=h*A-d*m,R=_*O-v*I+x*M+B*y-S*b+C*E;return R?(R=1/R,t[0]=(a*O-c*I+u*M)*R,t[1]=(i*I-n*O-o*M)*R,t[2]=(g*C-m*S+A*B)*R,t[3]=(h*S-f*C-d*B)*R,t[4]=(c*y-s*O-u*b)*R,t[5]=(r*O-i*y+o*b)*R,t[6]=(m*x-p*C-A*v)*R,t[7]=(l*C-h*x+d*v)*R,t[8]=(s*I-a*y+u*E)*R,t[9]=(n*y-r*I-o*E)*R,t[10]=(p*S-g*x+A*_)*R,t[11]=(f*x-l*S-d*_)*R,t[12]=(a*b-s*M-c*E)*R,t[13]=(r*M-n*b+i*E)*R,t[14]=(g*v-p*B-m*_)*R,t[15]=(l*B-f*v+h*_)*R,t):null}function Rv(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],l=e[8],f=e[9],h=e[10],d=e[11],p=e[12],g=e[13],m=e[14],A=e[15],_=r*a-n*s,v=r*c-i*s,x=r*u-o*s,B=n*c-i*a,S=n*u-o*a,C=i*u-o*c,E=l*g-f*p,b=l*m-h*p,y=l*A-d*p,M=f*m-h*g,I=f*A-d*g,O=h*A-d*m;return t[0]=a*O-c*I+u*M,t[1]=i*I-n*O-o*M,t[2]=g*C-m*S+A*B,t[3]=h*S-f*C-d*B,t[4]=c*y-s*O-u*b,t[5]=r*O-i*y+o*b,t[6]=m*x-p*C-A*v,t[7]=l*C-h*x+d*v,t[8]=s*I-a*y+u*E,t[9]=n*y-r*I-o*E,t[10]=p*S-g*x+A*_,t[11]=f*x-l*S-d*_,t[12]=a*b-s*M-c*E,t[13]=r*M-n*b+i*E,t[14]=g*v-p*B-m*_,t[15]=l*B-f*v+h*_,t}function Ya(t){let e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],c=t[7],u=t[8],l=t[9],f=t[10],h=t[11],d=t[12],p=t[13],g=t[14],m=t[15],A=e*s-r*o,_=e*a-n*o,v=r*a-n*s,x=u*p-l*d,B=u*g-f*d,S=l*g-f*p,C=e*S-r*B+n*x,E=o*S-s*B+a*x,b=u*v-l*_+f*A,y=d*v-p*_+g*A;return c*C-i*E+m*b-h*y}function On(t,e,r){let n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=e[8],h=e[9],d=e[10],p=e[11],g=e[12],m=e[13],A=e[14],_=e[15],v=r[0],x=r[1],B=r[2],S=r[3];return t[0]=v*n+x*a+B*f+S*g,t[1]=v*i+x*c+B*h+S*m,t[2]=v*o+x*u+B*d+S*A,t[3]=v*s+x*l+B*p+S*_,v=r[4],x=r[5],B=r[6],S=r[7],t[4]=v*n+x*a+B*f+S*g,t[5]=v*i+x*c+B*h+S*m,t[6]=v*o+x*u+B*d+S*A,t[7]=v*s+x*l+B*p+S*_,v=r[8],x=r[9],B=r[10],S=r[11],t[8]=v*n+x*a+B*f+S*g,t[9]=v*i+x*c+B*h+S*m,t[10]=v*o+x*u+B*d+S*A,t[11]=v*s+x*l+B*p+S*_,v=r[12],x=r[13],B=r[14],S=r[15],t[12]=v*n+x*a+B*f+S*g,t[13]=v*i+x*c+B*h+S*m,t[14]=v*o+x*u+B*d+S*A,t[15]=v*s+x*l+B*p+S*_,t}function Za(t,e,r){let n=r[0],i=r[1],o=r[2],s,a,c,u,l,f,h,d,p,g,m,A;return e===t?(t[12]=e[0]*n+e[4]*i+e[8]*o+e[12],t[13]=e[1]*n+e[5]*i+e[9]*o+e[13],t[14]=e[2]*n+e[6]*i+e[10]*o+e[14],t[15]=e[3]*n+e[7]*i+e[11]*o+e[15]):(s=e[0],a=e[1],c=e[2],u=e[3],l=e[4],f=e[5],h=e[6],d=e[7],p=e[8],g=e[9],m=e[10],A=e[11],t[0]=s,t[1]=a,t[2]=c,t[3]=u,t[4]=l,t[5]=f,t[6]=h,t[7]=d,t[8]=p,t[9]=g,t[10]=m,t[11]=A,t[12]=s*n+l*i+p*o+e[12],t[13]=a*n+f*i+g*o+e[13],t[14]=c*n+h*i+m*o+e[14],t[15]=u*n+d*i+A*o+e[15]),t}function Qa(t,e,r){let n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function $a(t,e,r,n){let i=n[0],o=n[1],s=n[2],a=Math.sqrt(i*i+o*o+s*s),c,u,l,f,h,d,p,g,m,A,_,v,x,B,S,C,E,b,y,M,I,O,R,F;return a<1e-6?null:(a=1/a,i*=a,o*=a,s*=a,u=Math.sin(r),c=Math.cos(r),l=1-c,f=e[0],h=e[1],d=e[2],p=e[3],g=e[4],m=e[5],A=e[6],_=e[7],v=e[8],x=e[9],B=e[10],S=e[11],C=i*i*l+c,E=o*i*l+s*u,b=s*i*l-o*u,y=i*o*l-s*u,M=o*o*l+c,I=s*o*l+i*u,O=i*s*l+o*u,R=o*s*l-i*u,F=s*s*l+c,t[0]=f*C+g*E+v*b,t[1]=h*C+m*E+x*b,t[2]=d*C+A*E+B*b,t[3]=p*C+_*E+S*b,t[4]=f*y+g*M+v*I,t[5]=h*y+m*M+x*I,t[6]=d*y+A*M+B*I,t[7]=p*y+_*M+S*I,t[8]=f*O+g*R+v*F,t[9]=h*O+m*R+x*F,t[10]=d*O+A*R+B*F,t[11]=p*O+_*R+S*F,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function ec(t,e,r){let n=Math.sin(r),i=Math.cos(r),o=e[4],s=e[5],a=e[6],c=e[7],u=e[8],l=e[9],f=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=s*i+l*n,t[6]=a*i+f*n,t[7]=c*i+h*n,t[8]=u*i-o*n,t[9]=l*i-s*n,t[10]=f*i-a*n,t[11]=h*i-c*n,t}function tc(t,e,r){let n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],c=e[3],u=e[8],l=e[9],f=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=s*i-l*n,t[2]=a*i-f*n,t[3]=c*i-h*n,t[8]=o*n+u*i,t[9]=s*n+l*i,t[10]=a*n+f*i,t[11]=c*n+h*i,t}function rc(t,e,r){let n=Math.sin(r),i=Math.cos(r),o=e[0],s=e[1],a=e[2],c=e[3],u=e[4],l=e[5],f=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=s*i+l*n,t[2]=a*i+f*n,t[3]=c*i+h*n,t[4]=u*i-o*n,t[5]=l*i-s*n,t[6]=f*i-a*n,t[7]=h*i-c*n,t}function Lv(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function Pv(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Fv(t,e,r){let n=r[0],i=r[1],o=r[2],s=Math.sqrt(n*n+i*i+o*o),a,c,u;return s<1e-6?null:(s=1/s,n*=s,i*=s,o*=s,c=Math.sin(e),a=Math.cos(e),u=1-a,t[0]=n*n*u+a,t[1]=i*n*u+o*c,t[2]=o*n*u-i*c,t[3]=0,t[4]=n*i*u-o*c,t[5]=i*i*u+a,t[6]=o*i*u+n*c,t[7]=0,t[8]=n*o*u+i*c,t[9]=i*o*u-n*c,t[10]=o*o*u+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function Dv(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Nv(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Uv(t,e){let r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Sh(t,e,r){let n=e[0],i=e[1],o=e[2],s=e[3],a=n+n,c=i+i,u=o+o,l=n*a,f=n*c,h=n*u,d=i*c,p=i*u,g=o*u,m=s*a,A=s*c,_=s*u;return t[0]=1-(d+g),t[1]=f+_,t[2]=h-A,t[3]=0,t[4]=f-_,t[5]=1-(l+g),t[6]=p+m,t[7]=0,t[8]=h+A,t[9]=p-m,t[10]=1-(l+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Gv(t,e){let r=new $(3),n=-e[0],i=-e[1],o=-e[2],s=e[3],a=e[4],c=e[5],u=e[6],l=e[7],f=n*n+i*i+o*o+s*s;return f>0?(r[0]=(a*s+l*n+c*o-u*i)*2/f,r[1]=(c*s+l*i+u*n-a*o)*2/f,r[2]=(u*s+l*o+a*i-c*n)*2/f):(r[0]=(a*s+l*n+c*o-u*i)*2,r[1]=(c*s+l*i+u*n-a*o)*2,r[2]=(u*s+l*o+a*i-c*n)*2),Sh(t,e,r),t}function Hv(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Bh(t,e){let r=e[0],n=e[1],i=e[2],o=e[4],s=e[5],a=e[6],c=e[8],u=e[9],l=e[10];return t[0]=Math.sqrt(r*r+n*n+i*i),t[1]=Math.sqrt(o*o+s*s+a*a),t[2]=Math.sqrt(c*c+u*u+l*l),t}function Vv(t,e){let r=new $(3);Bh(r,e);let n=1/r[0],i=1/r[1],o=1/r[2],s=e[0]*n,a=e[1]*i,c=e[2]*o,u=e[4]*n,l=e[5]*i,f=e[6]*o,h=e[8]*n,d=e[9]*i,p=e[10]*o,g=s+l+p,m=0;return g>0?(m=Math.sqrt(g+1)*2,t[3]=.25*m,t[0]=(f-d)/m,t[1]=(h-c)/m,t[2]=(a-u)/m):s>l&&s>p?(m=Math.sqrt(1+s-l-p)*2,t[3]=(f-d)/m,t[0]=.25*m,t[1]=(a+u)/m,t[2]=(h+c)/m):l>p?(m=Math.sqrt(1+l-s-p)*2,t[3]=(h-c)/m,t[0]=(a+u)/m,t[1]=.25*m,t[2]=(f+d)/m):(m=Math.sqrt(1+p-s-l)*2,t[3]=(a-u)/m,t[0]=(h+c)/m,t[1]=(f+d)/m,t[2]=.25*m),t}function zv(t,e,r,n){e[0]=n[12],e[1]=n[13],e[2]=n[14];let i=n[0],o=n[1],s=n[2],a=n[4],c=n[5],u=n[6],l=n[8],f=n[9],h=n[10];r[0]=Math.sqrt(i*i+o*o+s*s),r[1]=Math.sqrt(a*a+c*c+u*u),r[2]=Math.sqrt(l*l+f*f+h*h);let d=1/r[0],p=1/r[1],g=1/r[2],m=i*d,A=o*p,_=s*g,v=a*d,x=c*p,B=u*g,S=l*d,C=f*p,E=h*g,b=m+x+E,y=0;return b>0?(y=Math.sqrt(b+1)*2,t[3]=.25*y,t[0]=(B-C)/y,t[1]=(S-_)/y,t[2]=(A-v)/y):m>x&&m>E?(y=Math.sqrt(1+m-x-E)*2,t[3]=(B-C)/y,t[0]=.25*y,t[1]=(A+v)/y,t[2]=(S+_)/y):x>E?(y=Math.sqrt(1+x-m-E)*2,t[3]=(S-_)/y,t[0]=(A+v)/y,t[1]=.25*y,t[2]=(B+C)/y):(y=Math.sqrt(1+E-m-x)*2,t[3]=(A-v)/y,t[0]=(S+_)/y,t[1]=(B+C)/y,t[2]=.25*y),t}function jv(t,e,r,n){let i=e[0],o=e[1],s=e[2],a=e[3],c=i+i,u=o+o,l=s+s,f=i*c,h=i*u,d=i*l,p=o*u,g=o*l,m=s*l,A=a*c,_=a*u,v=a*l,x=n[0],B=n[1],S=n[2];return t[0]=(1-(p+m))*x,t[1]=(h+v)*x,t[2]=(d-_)*x,t[3]=0,t[4]=(h-v)*B,t[5]=(1-(f+m))*B,t[6]=(g+A)*B,t[7]=0,t[8]=(d+_)*S,t[9]=(g-A)*S,t[10]=(1-(f+p))*S,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function kv(t,e,r,n,i){let o=e[0],s=e[1],a=e[2],c=e[3],u=o+o,l=s+s,f=a+a,h=o*u,d=o*l,p=o*f,g=s*l,m=s*f,A=a*f,_=c*u,v=c*l,x=c*f,B=n[0],S=n[1],C=n[2],E=i[0],b=i[1],y=i[2],M=(1-(g+A))*B,I=(d+x)*B,O=(p-v)*B,R=(d-x)*S,F=(1-(h+A))*S,X=(m+_)*S,z=(p+v)*C,Q=(m-_)*C,W=(1-(h+g))*C;return t[0]=M,t[1]=I,t[2]=O,t[3]=0,t[4]=R,t[5]=F,t[6]=X,t[7]=0,t[8]=z,t[9]=Q,t[10]=W,t[11]=0,t[12]=r[0]+E-(M*E+R*b+z*y),t[13]=r[1]+b-(I*E+F*b+Q*y),t[14]=r[2]+y-(O*E+X*b+W*y),t[15]=1,t}function nc(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,c=i+i,u=r*s,l=n*s,f=n*a,h=i*s,d=i*a,p=i*c,g=o*s,m=o*a,A=o*c;return t[0]=1-f-p,t[1]=l+A,t[2]=h-m,t[3]=0,t[4]=l-A,t[5]=1-u-p,t[6]=d+g,t[7]=0,t[8]=h+m,t[9]=d-g,t[10]=1-u-f,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ic(t,e,r,n,i,o,s){let a=1/(r-e),c=1/(i-n),u=1/(o-s);return t[0]=o*2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*c,t[10]=(s+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*u,t[15]=0,t}function Ch(t,e,r,n,i){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0){let s=1/(n-i);t[10]=(i+n)*s,t[14]=2*i*n*s}else t[10]=-1,t[14]=-2*n;return t}var oc=Ch;function Jv(t,e,r,n,i){let o=1/Math.tan(e/2);if(t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0){let s=1/(n-i);t[10]=i*s,t[14]=i*n*s}else t[10]=-1,t[14]=-n;return t}function qv(t,e,r,n){let i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),s=Math.tan(e.leftDegrees*Math.PI/180),a=Math.tan(e.rightDegrees*Math.PI/180),c=2/(s+a),u=2/(i+o);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((s-a)*c*.5),t[9]=(i-o)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function Mh(t,e,r,n,i,o,s){let a=1/(e-r),c=1/(n-i),u=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*a,t[13]=(i+n)*c,t[14]=(s+o)*u,t[15]=1,t}var sc=Mh;function Wv(t,e,r,n,i,o,s){let a=1/(e-r),c=1/(n-i),u=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+r)*a,t[13]=(i+n)*c,t[14]=o*u,t[15]=1,t}function ac(t,e,r,n){let i,o,s,a,c,u,l,f,h,d,p=e[0],g=e[1],m=e[2],A=n[0],_=n[1],v=n[2],x=r[0],B=r[1],S=r[2];return Math.abs(p-x)<1e-6&&Math.abs(g-B)<1e-6&&Math.abs(m-S)<1e-6?Eh(t):(f=p-x,h=g-B,d=m-S,i=1/Math.sqrt(f*f+h*h+d*d),f*=i,h*=i,d*=i,o=_*d-v*h,s=v*f-A*d,a=A*h-_*f,i=Math.sqrt(o*o+s*s+a*a),i?(i=1/i,o*=i,s*=i,a*=i):(o=0,s=0,a=0),c=h*a-d*s,u=d*o-f*a,l=f*s-h*o,i=Math.sqrt(c*c+u*u+l*l),i?(i=1/i,c*=i,u*=i,l*=i):(c=0,u=0,l=0),t[0]=o,t[1]=c,t[2]=f,t[3]=0,t[4]=s,t[5]=u,t[6]=h,t[7]=0,t[8]=a,t[9]=l,t[10]=d,t[11]=0,t[12]=-(o*p+s*g+a*m),t[13]=-(c*p+u*g+l*m),t[14]=-(f*p+h*g+d*m),t[15]=1,t)}function Xv(t,e,r,n){let i=e[0],o=e[1],s=e[2],a=n[0],c=n[1],u=n[2],l=i-r[0],f=o-r[1],h=s-r[2],d=l*l+f*f+h*h;d>0&&(d=1/Math.sqrt(d),l*=d,f*=d,h*=d);let p=c*h-u*f,g=u*l-a*h,m=a*f-c*l;return d=p*p+g*g+m*m,d>0&&(d=1/Math.sqrt(d),p*=d,g*=d,m*=d),t[0]=p,t[1]=g,t[2]=m,t[3]=0,t[4]=f*m-h*g,t[5]=h*p-l*m,t[6]=l*g-f*p,t[7]=0,t[8]=l,t[9]=f,t[10]=h,t[11]=0,t[12]=i,t[13]=o,t[14]=s,t[15]=1,t}function Kv(t){return"mat4(".concat(t[0],", ").concat(t[1],", ").concat(t[2],", ").concat(t[3],", ").concat(t[4],", ").concat(t[5],", ").concat(t[6],", ").concat(t[7],", ").concat(t[8],", ").concat(t[9],", ").concat(t[10],", ").concat(t[11],", ").concat(t[12],", ").concat(t[13],", ").concat(t[14],", ").concat(t[15],")")}function Yv(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function Zv(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function wh(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function Qv(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function $v(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function ex(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function tx(t,e){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],u=t[7],l=t[8],f=t[9],h=t[10],d=t[11],p=t[12],g=t[13],m=t[14],A=t[15],_=e[0],v=e[1],x=e[2],B=e[3],S=e[4],C=e[5],E=e[6],b=e[7],y=e[8],M=e[9],I=e[10],O=e[11],R=e[12],F=e[13],X=e[14],z=e[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(n-v)<=1e-6*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(i-x)<=1e-6*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-B)<=1e-6*Math.max(1,Math.abs(o),Math.abs(B))&&Math.abs(s-S)<=1e-6*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(a-C)<=1e-6*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(c-E)<=1e-6*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(u-b)<=1e-6*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(l-y)<=1e-6*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(h-I)<=1e-6*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(d-O)<=1e-6*Math.max(1,Math.abs(d),Math.abs(O))&&Math.abs(p-R)<=1e-6*Math.max(1,Math.abs(p),Math.abs(R))&&Math.abs(g-F)<=1e-6*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(m-X)<=1e-6*Math.max(1,Math.abs(m),Math.abs(X))&&Math.abs(A-z)<=1e-6*Math.max(1,Math.abs(A),Math.abs(z))}var rx=On,nx=wh;function ix(){let t=new $(4);return $!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Ih(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function Oh(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function Rh(t){let e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)}function Lh(t){let e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function Ph(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=n*s,t[2]=i*s,t[3]=o*s,t}function Fh(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Dh(t,e,r,n){let i=e[0],o=e[1],s=e[2],a=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=s+n*(r[2]-s),t[3]=a+n*(r[3]-a),t}function Nh(t,e,r){let n=e[0],i=e[1],o=e[2],s=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,t}function Uh(t,e,r){let n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2],u=r[3],l=u*n+a*o-c*i,f=u*i+c*n-s*o,h=u*o+s*i-a*n,d=-s*n-a*i-c*o;return t[0]=l*u+d*-s+f*-c-h*-a,t[1]=f*u+d*-a+h*-s-l*-c,t[2]=h*u+d*-c+l*-a-f*-s,t[3]=e[3],t}var TF=function(){let t=ix();return function(e,r,n,i,o,s){let a,c;for(r||(r=4),n||(n=0),i?c=Math.min(i*r+n,e.length):c=e.length,a=n;a<c;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],o(t,t,s),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e}}();var lc;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(lc||(lc={}));var sx=45*Math.PI/180,ax=1,cc=.1,uc=500,cx=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),D=class extends Fr{static get IDENTITY(){return lx()}static get ZERO(){return ux()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return lc}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,r,n,i,o,s,a,c,u,l,f,h,d,p,g,m){return this[0]=e,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=u,this[9]=l,this[10]=f,this[11]=h,this[12]=d,this[13]=p,this[14]=g,this[15]=m,this.check()}setRowMajor(e,r,n,i,o,s,a,c,u,l,f,h,d,p,g,m){return this[0]=e,this[1]=o,this[2]=u,this[3]=d,this[4]=r,this[5]=s,this[6]=l,this[7]=p,this[8]=n,this[9]=a,this[10]=f,this[11]=g,this[12]=i,this[13]=c,this[14]=h,this[15]=m,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(cx)}fromObject(e){return this.check()}fromQuaternion(e){return nc(this,e),this.check()}frustum(e){let{left:r,right:n,bottom:i,top:o,near:s=cc,far:a=uc}=e;return a===1/0?fx(this,r,n,i,o,s):ic(this,r,n,i,o,s,a),this.check()}lookAt(e){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=e;return ac(this,r,n,i),this.check()}ortho(e){let{left:r,right:n,bottom:i,top:o,near:s=cc,far:a=uc}=e;return sc(this,r,n,i,o,s,a),this.check()}orthographic(e){let{fovy:r=sx,aspect:n=ax,focalDistance:i=1,near:o=cc,far:s=uc}=e;Gh(r);let a=r/2,c=i*Math.tan(a),u=c*n;return this.ortho({left:-u,right:u,bottom:-c,top:c,near:o,far:s})}perspective(e){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=e;return Gh(r),oc(this,r,n,i,o),this.check()}determinant(){return Ya(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*s,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*o,e[6]=this[6]*s,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*o,e[10]=this[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,r){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return e[0]=this[0]*i,e[1]=this[1]*o,e[2]=this[2]*s,e[3]=this[4]*i,e[4]=this[5]*o,e[5]=this[6]*s,e[6]=this[8]*i,e[7]=this[9]*o,e[8]=this[10]*s,e}transpose(){return Xa(this,this),this.check()}invert(){return Ka(this,this),this.check()}multiplyLeft(e){return On(this,e,this),this.check()}multiplyRight(e){return On(this,this,e),this.check()}rotateX(e){return ec(this,this,e),this.check()}rotateY(e){return tc(this,this,e),this.check()}rotateZ(e){return rc(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,r){return $a(this,this,e,r),this.check()}scale(e){return Qa(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return Za(this,this,e),this.check()}transform(e,r){return e.length===4?(r=Nh(r||[-0,-0,-0,-0],e,this),Pt(r,4),r):this.transformAsPoint(e,r)}transformAsPoint(e,r){let{length:n}=e,i;switch(n){case 2:i=Ni(r||[-0,-0],e,this);break;case 3:i=sr(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Pt(i,e.length),i}transformAsVector(e,r){let n;switch(e.length){case 2:n=Ui(r||[-0,-0],e,this);break;case 3:n=Gi(r||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return Pt(n,e.length),n}transformPoint(e,r){return this.transformAsPoint(e,r)}transformVector(e,r){return this.transformAsPoint(e,r)}transformDirection(e,r){return this.transformAsVector(e,r)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,r,n){return this.identity().translate([e,r,n])}},Xi,Ki;function ux(){return Xi||(Xi=new D([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Xi)),Xi}function lx(){return Ki||(Ki=new D,Object.freeze(Ki)),Ki}function Gh(t){if(t>Math.PI*2)throw Error("expected radians")}function fx(t,e,r,n,i,o){let s=2*o/(r-e),a=2*o/(i-n),c=(r+e)/(r-e),u=(i+n)/(i-n),l=-1,f=-1,h=-2*o;return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=u,t[10]=l,t[11]=f,t[12]=0,t[13]=0,t[14]=h,t[15]=0,t}function Hh(){let t=new $(4);return $!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Vh(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function fc(t,e,r){r=r*.5;let n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function hc(t,e,r){let n=e[0],i=e[1],o=e[2],s=e[3],a=r[0],c=r[1],u=r[2],l=r[3];return t[0]=n*l+s*a+i*u-o*c,t[1]=i*l+s*c+o*a-n*u,t[2]=o*l+s*u+n*c-i*a,t[3]=s*l-n*a-i*c-o*u,t}function zh(t,e,r){r*=.5;let n=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+s*a,t[1]=i*c+o*a,t[2]=o*c-i*a,t[3]=s*c-n*a,t}function jh(t,e,r){r*=.5;let n=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c-o*a,t[1]=i*c+s*a,t[2]=o*c+n*a,t[3]=s*c-i*a,t}function kh(t,e,r){r*=.5;let n=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);return t[0]=n*c+i*a,t[1]=i*c-n*a,t[2]=o*c+s*a,t[3]=s*c-o*a,t}function Jh(t,e){let r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t}function Rn(t,e,r,n){let i=e[0],o=e[1],s=e[2],a=e[3],c=r[0],u=r[1],l=r[2],f=r[3],h,d,p,g,m;return h=i*c+o*u+s*l+a*f,h<0&&(h=-h,c=-c,u=-u,l=-l,f=-f),1-h>1e-6?(d=Math.acos(h),m=Math.sin(d),p=Math.sin((1-n)*d)/m,g=Math.sin(n*d)/m):(p=1-n,g=n),t[0]=p*i+g*c,t[1]=p*o+g*u,t[2]=p*s+g*l,t[3]=p*a+g*f,t}function qh(t,e){let r=e[0],n=e[1],i=e[2],o=e[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;return t[0]=-r*a,t[1]=-n*a,t[2]=-i*a,t[3]=o*a,t}function Wh(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function dc(t,e){let r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{let i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);let o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[o*3+o]-e[s*3+s]+1),t[i]=.5*n,n=.5/n,t[3]=(e[o*3+s]-e[s*3+o])*n,t[o]=(e[o*3+i]+e[i*3+o])*n,t[s]=(e[s*3+i]+e[i*3+s])*n}return t}var Xh=Ih;var Kh=Oh,Yh=Fh,Zh=Dh,Qh=Rh;var $h=Lh;var ed=Ph;var td=function(){let t=Vi(),e=zi(1,0,0),r=zi(0,1,0);return function(n,i,o){let s=Mn(i,o);return s<-.999999?(or(t,e,i),ja(t)<1e-6&&or(t,r,i),Ua(t,t),fc(n,t,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(or(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+s,ed(n,n))}}(),DF=function(){let t=Hh(),e=Hh();return function(r,n,i,o,s,a){return Rn(t,n,s,a),Rn(e,i,o,a),Rn(r,t,e,2*a*(1-a)),r}}(),NF=function(){let t=yh();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],ed(e,dc(e,t))}}();var hx=[0,0,0,1],nt=class extends Lt{constructor(e=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(e)&&arguments.length===1?this.copy(e):this.set(e,r,n,i)}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this.check()}set(e,r,n,i){return this[0]=e,this[1]=r,this[2]=n,this[3]=i,this.check()}fromObject(e){return this[0]=e.x,this[1]=e.y,this[2]=e.z,this[3]=e.w,this.check()}fromMatrix3(e){return dc(this,e),this.check()}fromAxisRotation(e,r){return fc(this,e,r),this.check()}identity(){return Vh(this),this.check()}setAxisAngle(e,r){return this.fromAxisRotation(e,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(e){this[0]=G(e)}get y(){return this[1]}set y(e){this[1]=G(e)}get z(){return this[2]}set z(e){this[2]=G(e)}get w(){return this[3]}set w(e){this[3]=G(e)}len(){return Qh(this)}lengthSquared(){return $h(this)}dot(e){return Yh(this,e)}rotationTo(e,r){return td(this,e,r),this.check()}add(e){return Xh(this,this,e),this.check()}calculateW(){return Jh(this,this),this.check()}conjugate(){return Wh(this,this),this.check()}invert(){return qh(this,this),this.check()}lerp(e,r,n){return n===void 0?this.lerp(this,e,r):(Zh(this,e,r,n),this.check())}multiplyRight(e){return hc(this,this,e),this.check()}multiplyLeft(e){return hc(this,e,this),this.check()}normalize(){let e=this.len(),r=e>0?1/e:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,e===0&&(this[3]=1),this.check()}rotateX(e){return zh(this,this,e),this.check()}rotateY(e){return jh(this,this,e),this.check()}rotateZ(e){return kh(this,this,e),this.check()}scale(e){return Kh(this,this,e),this.check()}slerp(e,r,n){let i,o,s;switch(arguments.length){case 1:({start:i=hx,target:o,ratio:s}=e);break;case 2:i=this,o=e,s=r;break;default:i=e,o=r,s=n}return Rn(this,i,o,s),this.check()}transformVector4(e,r=new Pr){return Uh(r,e,this),Pt(r,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(e,r){return this.setAxisAngle(e,r)}premultiply(e){return this.multiplyLeft(e)}multiply(e){return this.multiplyRight(e)}};var je={};de(je,{EPSILON1:()=>dx,EPSILON10:()=>Tx,EPSILON11:()=>bx,EPSILON12:()=>Ex,EPSILON13:()=>Sx,EPSILON14:()=>Bx,EPSILON15:()=>Cx,EPSILON16:()=>Mx,EPSILON17:()=>wx,EPSILON18:()=>Ix,EPSILON19:()=>Ox,EPSILON2:()=>px,EPSILON20:()=>Rx,EPSILON3:()=>mx,EPSILON4:()=>gx,EPSILON5:()=>yx,EPSILON6:()=>Ax,EPSILON7:()=>_x,EPSILON8:()=>vx,EPSILON9:()=>xx,PI_OVER_FOUR:()=>Px,PI_OVER_SIX:()=>Fx,PI_OVER_TWO:()=>Lx,TWO_PI:()=>Dx});var dx=.1,px=.01,mx=.001,gx=1e-4,yx=1e-5,Ax=1e-6,_x=1e-7,vx=1e-8,xx=1e-9,Tx=1e-10,bx=1e-11,Ex=1e-12,Sx=1e-13,Bx=1e-14,Cx=1e-15,Mx=1e-16,wx=1e-17,Ix=1e-18,Ox=1e-19,Rx=1e-20,Lx=Math.PI/2,Px=Math.PI/4,Fx=Math.PI/6,Dx=Math.PI*2;function Yi(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}var ke=Math.PI,od=ke/4,rd=ke/180,nd=180/ke,Zi=512;function pt(t){let[e,r]=t;Yi(Number.isFinite(e)),Yi(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=e*rd,i=r*rd,o=Zi*(n+ke)/(2*ke),s=Zi*(ke+Math.log(Math.tan(od+i*.5)))/(2*ke);return[o,s]}function mt(t){let[e,r]=t,n=e/Zi*(2*ke)-ke,i=2*(Math.atan(Math.exp(r/Zi*(2*ke)-ke))-od);return[n*nd,i*nd]}var v3=Math.PI/180;var ad=6378137*Math.PI;function pc(t){var e=pt(t);return e[0]=(e[0]/256-1)*ad,e[1]=(e[1]/256-1)*ad,e}function $i(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$i=function(r){return typeof r}:$i=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$i(t)}function cd(t,e,r,n,i,o,s){try{var a=t[o](s),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,i)}function mc(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function s(c){cd(o,n,i,s,a,"next",c)}function a(c){cd(o,n,i,s,a,"throw",c)}s(void 0)})}}function ud(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Qi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ud(Object(r),!0).forEach(function(n){Qx(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ud(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Qx(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $x(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ld(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function eT(t,e,r){return e&&ld(t.prototype,e),r&&ld(t,r),t}function eo(t,e,r){return typeof Reflect<"u"&&Reflect.get?eo=Reflect.get:eo=function(i,o,s){var a=tT(i,o);if(a){var c=Object.getOwnPropertyDescriptor(a,o);return c.get?c.get.call(s):c.value}},eo(t,e,r||t)}function tT(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=Dr(t),t!==null););return t}function rT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&gc(t,e)}function gc(t,e){return gc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},gc(t,e)}function nT(t){var e=sT();return function(){var n=Dr(t),i;if(e){var o=Dr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return iT(this,i)}}function iT(t,e){if(e&&($i(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oT(t)}function oT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function sT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Dr(t){return Dr=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Dr(t)}var aT={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:function(){}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:function(){}},onImageLoad:{type:"function",value:function(){}},onImageLoadError:{type:"function",compare:!1,value:function(e,r){return console.error(r,e)}}},to=function(t){rT(r,t);var e=nT(r);function r(){var i;$x(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=e.call.apply(e,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.shouldUpdateState=function(){return!0},n.initializeState=function(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0},n.updateState=function(o){var s=this,a=o.changeFlags,c=o.props,u=o.oldProps,l=this.context.viewport;a.dataChanged||c.serviceType!==u.serviceType?(this.state.imageSource=this._createImageSource(c),this._loadMetadata(),this.debounce(function(){return s.loadImage(l,"image source changed")},0)):(0,ar._deepEqual)(c.layers,u.layers,1)?a.viewportChanged&&this.debounce(function(){return s.loadImage(l,"viewport changed")}):this.debounce(function(){return s.loadImage(l,"layers changed")},0)},n.finalizeState=function(){},n.renderLayers=function(){var o=this.state,s=o.bounds,a=o.image,c=o.lastRequestParameters;return a&&new fd.BitmapLayer(Qi(Qi({},this.getSubLayerProps({id:"bitmap"})),{},{_imageCoordinateSystem:c.srs==="EPSG:4326"?ar.COORDINATE_SYSTEM.LNGLAT:ar.COORDINATE_SYSTEM.CARTESIAN,bounds:s,image:a}))},n.getFeatureInfoText=function(){var i=mc(regeneratorRuntime.mark(function s(a,c){var u,l,f,h;return regeneratorRuntime.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(u=this.state.lastRequestParameters,!u){p.next=6;break}return p.next=4,(l=(f=this.state.imageSource).getFeatureInfoText)===null||l===void 0?void 0:l.call(f,Qi(Qi({},u),{},{query_layers:u.layers,x:a,y:c,info_format:"application/vnd.ogc.gml"}));case 4:return h=p.sent,p.abrupt("return",h);case 6:return p.abrupt("return","");case 7:case"end":return p.stop()}},s,this)}));function o(s,a){return i.apply(this,arguments)}return o}(),n._createImageSource=function(o){if(o.data instanceof Re)return o.data;if(typeof o.data=="string")return La({url:o.data,loadOptions:o.loadOptions,type:o.serviceType});throw new Error("invalid image source in props.data")},n._loadMetadata=function(){var i=mc(regeneratorRuntime.mark(function s(){var a,c,u,l;return regeneratorRuntime.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return a=this.state.imageSource,h.prev=1,this.state.loadCounter++,h.next=5,a.getMetadata();case 5:c=h.sent,this.state.imageSource===a&&((u=this.getCurrentLayer())===null||u===void 0||u.props.onMetadataLoad(c)),h.next=12;break;case 9:h.prev=9,h.t0=h.catch(1),(l=this.getCurrentLayer())===null||l===void 0||l.props.onMetadataLoadError(h.t0);case 12:return h.prev=12,this.state.loadCounter--,h.finish(12);case 15:case"end":return h.stop()}},s,this,[[1,9,12,15]])}));function o(){return i.apply(this,arguments)}return o}(),n.loadImage=function(){var i=mc(regeneratorRuntime.mark(function s(a,c){var u,l,f,h,d,p,g,m,A,_,v,x,B,S;return regeneratorRuntime.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(u=this.props,l=u.layers,f=u.serviceType,!(f==="wms"&&l.length===0)){E.next=3;break}return E.abrupt("return");case 3:return h=a.getBounds(),d=a.width,p=a.height,g=this.getRequestId(),m=this.props.srs,m==="auto"&&(m=a.resolution?"EPSG:4326":"EPSG:3857"),A={width:d,height:p,boundingBox:[[h[0],h[1]],[h[2],h[3]]],layers:l,crs:m},m==="EPSG:3857"&&(_=pc([h[0],h[1]]),v=pc([h[2],h[3]]),A.boundingBox=[_,v]),E.prev=10,this.state.loadCounter++,this.props.onImageLoadStart(g),E.next=15,this.state.imageSource.getImage(A);case 15:x=E.sent,this.state.lastRequestId<g&&((B=this.getCurrentLayer())===null||B===void 0||B.props.onImageLoad(g),this.setState({image:x,bounds:h,lastRequestParameters:A,lastRequestId:g})),E.next=23;break;case 19:E.prev=19,E.t0=E.catch(10),this.raiseError(E.t0,"Load image"),(S=this.getCurrentLayer())===null||S===void 0||S.props.onImageLoadError(g,E.t0);case 23:return E.prev=23,this.state.loadCounter--,E.finish(23);case 26:case"end":return E.stop()}},s,this,[[10,19,23,26]])}));function o(s,a){return i.apply(this,arguments)}return o}(),n.getRequestId=function(){return this.state._nextRequestId++},n.debounce=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:500;clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(function(){return o()},s)},eT(r,[{key:"isLoaded",get:function(){return Boolean(this.state)&&this.state.loadCounter===0&&eo(Dr(r.prototype),"isLoaded",this)}}]),r}(ar.CompositeLayer);to.layerName="WMSLayer";to.defaultProps=aT;var hd=P(Ve());function ro(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ro=function(r){return typeof r}:ro=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ro(t)}function cT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&yc(t,e)}function yc(t,e){return yc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},yc(t,e)}function lT(t){var e=dT();return function(){var n=no(t),i;if(e){var o=no(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return fT(this,i)}}function fT(t,e){if(e&&(ro(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hT(t)}function hT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function dT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function no(t){return no=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},no(t)}var pT={getHeight:{type:"accessor",value:0},greatCircle:!0},io=function(t){uT(r,t);var e=lT(r);function r(){return cT(this,r),e.apply(this,arguments)}return r}(hd.ArcLayer);io.layerName="GreatCircleLayer";io.defaultProps=pT;var pd=P(ze()),vc=P(Ve());function oo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?oo=function(r){return typeof r}:oo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},oo(t)}var mT=["updateTriggers"];function gT(t,e){if(t==null)return{};var r=yT(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function yT(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o<n.length;o++)i=n[o],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function AT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _T(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ac(t,e)}function Ac(t,e){return Ac=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ac(t,e)}function vT(t){var e=bT();return function(){var n=so(t),i;if(e){var o=so(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return xT(this,i)}}function xT(t,e){if(e&&(oo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TT(t)}function TT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function so(t){return so=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},so(t)}function dd(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function _c(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?dd(Object(r),!0).forEach(function(n){ET(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):dd(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ET(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var ST=_c({},vc.PolygonLayer.defaultProps),Le=function(t){_T(r,t);var e=vT(r);function r(){return AT(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){return null},n.renderLayers=function(){var o=this.props,s=o.elevationScale,a=o.extruded,c=o.wireframe,u=o.filled,l=o.stroked,f=o.lineWidthUnits,h=o.lineWidthScale,d=o.lineWidthMinPixels,p=o.lineWidthMaxPixels,g=o.lineJointRounded,m=o.lineMiterLimit,A=o.lineDashJustified,_=o.getElevation,v=o.getFillColor,x=o.getLineColor,B=o.getLineWidth,S=this.props,C=S.updateTriggers,E=S.material,b=S.transitions,y=this.getSubLayerClass("cell",vc.PolygonLayer),M=this.indexToBounds()||{},I=M.updateTriggers,O=gT(M,mT);return new y({filled:u,wireframe:c,extruded:a,elevationScale:s,stroked:l,lineWidthUnits:f,lineWidthScale:h,lineWidthMinPixels:d,lineWidthMaxPixels:p,lineJointRounded:g,lineMiterLimit:m,lineDashJustified:A,material:E,transitions:b,getElevation:_,getFillColor:v,getLineColor:x,getLineWidth:B},this.getSubLayerProps({id:"cell",updateTriggers:C&&_c(_c({},I),{},{getElevation:C.getElevation,getFillColor:C.getFillColor,getLineColor:C.getLineColor,getLineWidth:C.getLineWidth})}),O)},r}(pd.CompositeLayer);Le.layerName="GeoCellLayer";Le.defaultProps=ST;var ao=P(xc());function _d(t,e){return wT(t)||MT(t,e)||CT(t,e)||BT()}function BT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
15
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CT(t,e){if(t){if(typeof t=="string")return gd(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return gd(t,e)}}function gd(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function MT(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function wT(t){if(Array.isArray(t))return t}var IT=3,OT=30,RT=2*OT+1,yd=180/Math.PI;function vd(t,e,r){var n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function Ad(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function xd(t){return[Ad(t[0]),Ad(t[1])]}function Td(t,e){var r=_d(e,2),n=r[0],i=r[1];switch(t){case 0:return[1,n,i];case 1:return[-n,1,i];case 2:return[-n,-i,1];case 3:return[-1,-i,-n];case 4:return[i,-1,-n];case 5:return[i,n,-1];default:throw new Error("Invalid face")}}function bd(t){var e=_d(t,3),r=e[0],n=e[1],i=e[2],o=Math.atan2(i,Math.sqrt(r*r+n*n)),s=Math.atan2(n,r);return[s*yd,o*yd]}function Ed(t){for(var e=ao.default.fromString(t,!0,10).toString(2);e.length<IT+RT;)e="0"+e;for(var r=e.lastIndexOf("1"),n=e.substring(0,3),i=e.substring(3,r),o=i.length/2,s=ao.default.fromString(n,!0,2).toString(10),a=ao.default.fromString(i,!0,2).toString(4);a.length<o;)a="0"+a;return"".concat(s,"/").concat(a)}function LT(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);var i=e[0];e[0]=e[1],e[1]=i}}function Sd(t){for(var e=t.split("/"),r=parseInt(e[0],10),n=e[1],i=n.length,o=[0,0],s,a=i-1;a>=0;a--){s=i-a;var c=n[a],u=0,l=0;c==="1"?l=1:c==="2"?(u=1,l=1):c==="3"&&(u=1);var f=Math.pow(2,s-1);LT(f,o,u,l),o[0]+=f*u,o[1]+=f*l}if(r%2===1){var h=o[0];o[0]=o[1],o[1]=h}return{face:r,ij:o,level:s}}var Bd=P(xc());function PT(t){var e=t.padEnd(16,"0");return Bd.default.fromString(e,16)}var FT=100;function DT(t){for(var e=t.face,r=t.ij,n=t.level,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],o=Math.max(1,Math.ceil(FT*Math.pow(2,-n))),s=new Float64Array(4*o*2+2),a=0,c=0,u=0;u<4;u++)for(var l=i[u].slice(0),f=i[u+1],h=(f[0]-l[0])/o,d=(f[1]-l[1])/o,p=0;p<o;p++){l[0]+=h,l[1]+=d;var g=vd(r,n,l),m=xd(g),A=Td(e,m),_=bd(A);Math.abs(_[1])>89.999&&(_[0]=c);var v=_[0]-c;_[0]+=v>180?-360:v<-180?360:0,s[a++]=_[0],s[a++]=_[1],c=_[0]}return s[a++]=s[0],s[a++]=s[1],s}function NT(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=PT(t)}return Ed(t.toString())}function Cd(t){var e=NT(t),r=Sd(e);return DT(r)}function co(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?co=function(r){return typeof r}:co=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},co(t)}function UT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function GT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Tc(t,e)}function Tc(t,e){return Tc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Tc(t,e)}function HT(t){var e=jT();return function(){var n=uo(t),i;if(e){var o=uo(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return VT(this,i)}}function VT(t,e){if(e&&(co(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zT(t)}function zT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function uo(t){return uo=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},uo(t)}var kT={getS2Token:{type:"accessor",value:function(e){return e.token}}},lo=function(t){GT(r,t);var e=HT(r);function r(){return UT(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){var o=this.props,s=o.data,a=o.getS2Token;return{data:s,_normalize:!1,positionFormat:"XY",getPolygon:function(u,l){return Cd(a(u,l))}}},r}(Le);lo.layerName="S2Layer";lo.defaultProps=kT;function bc(t,e){return XT(t)||WT(t,e)||qT(t,e)||JT()}function JT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
16
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qT(t,e){if(t){if(typeof t=="string")return Md(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Md(t,e)}}function Md(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function WT(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function XT(t){if(Array.isArray(t))return t}var Ec=512;function KT(t,e){for(var r=0,n=0,i=1<<t.length,o=i/Ec,s=0;s<t.length;s++){i>>=1;var a=parseInt(t[s]);a%2&&(r|=i),a>1&&(n|=i)}return[[r/o,Ec-n/o],[(r+e)/o,Ec-(n+e)/o]]}function wd(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,r=KT(t,e),n=bc(r,2),i=n[0],o=n[1],s=mt(i),a=bc(s,2),c=a[0],u=a[1],l=mt(o),f=bc(l,2),h=f[0],d=f[1];return[h,u,h,d,c,d,c,u,h,u]}function fo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fo=function(r){return typeof r}:fo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fo(t)}function YT(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ZT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Sc(t,e)}function Sc(t,e){return Sc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Sc(t,e)}function QT(t){var e=tb();return function(){var n=ho(t),i;if(e){var o=ho(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return $T(this,i)}}function $T(t,e){if(e&&(fo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return eb(t)}function eb(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function tb(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ho(t){return ho=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ho(t)}var rb={getQuadkey:{type:"accessor",value:function(e){return e.quadkey}}},po=function(t){ZT(r,t);var e=QT(r);function r(){return YT(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){var o=this.props,s=o.data,a=o.extruded,c=o.getQuadkey,u=a?.99:1;return{data:s,_normalize:!1,positionFormat:"XY",getPolygon:function(f,h){return wd(c(f,h),u)},updateTriggers:{getPolygon:u}}},r}(Le);po.layerName="QuadkeyLayer";po.defaultProps=rb;var Bo=P(ze()),up=P(Ve());function Id(t,e,r,n,i,o,s){try{var a=t[o](s),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,i)}function nb(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function s(c){Id(o,n,i,s,a,"next",c)}function a(c){Id(o,n,i,s,a,"throw",c)}s(void 0)})}}function ib(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Od(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ob(t,e,r){return e&&Od(t.prototype,e),r&&Od(t,r),t}var Pn=function(){function t(r){ib(this,t),this.index=void 0,this.isVisible=void 0,this.isSelected=void 0,this.parent=void 0,this.children=void 0,this.content=void 0,this.state=void 0,this.layers=void 0,this.id=void 0,this.zoom=void 0,this.userData=void 0,this.boundingBox=void 0,this._abortController=void 0,this._loader=void 0,this._loaderId=void 0,this._isLoaded=void 0,this._isCancelled=void 0,this._needsReload=void 0,this._bbox=void 0,this.index=r,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}var e=t.prototype;return e._loadData=function(){var r=nb(regeneratorRuntime.mark(function i(o){var s,a,c,u,l,f,h,d,p,g,m,A,_,v;return regeneratorRuntime.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:return s=o.getData,a=o.requestScheduler,c=o.onLoad,u=o.onError,l=this.index,f=this.id,h=this.bbox,d=this.userData,p=this.zoom,g=this._loaderId,this._abortController=new AbortController,m=this._abortController.signal,B.next=7,a.scheduleRequest(this,function(S){return S.isSelected?1:-1});case 7:if(A=B.sent,A){B.next=11;break}return this._isCancelled=!0,B.abrupt("return");case 11:if(!this._isCancelled){B.next=14;break}return A.done(),B.abrupt("return");case 14:return _=null,B.prev=15,B.next=18,s({index:l,id:f,bbox:h,userData:d,zoom:p,signal:m});case 18:_=B.sent,B.next=24;break;case 21:B.prev=21,B.t0=B.catch(15),v=B.t0||!0;case 24:return B.prev=24,A.done(),B.finish(24);case 27:if(g===this._loaderId){B.next=29;break}return B.abrupt("return");case 29:if(this._loader=void 0,this.content=_,!(this._isCancelled&&!_)){B.next=34;break}return this._isLoaded=!1,B.abrupt("return");case 34:this._isLoaded=!0,this._isCancelled=!1,v?u(v,this):c(this);case 37:case"end":return B.stop()}},i,this,[[15,21,24,27]])}));function n(i){return r.apply(this,arguments)}return n}(),e.loadData=function(n){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(n),this._loader},e.setNeedsReload=function(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0},e.abort=function(){var n;this.isLoaded||(this._isCancelled=!0,(n=this._abortController)===null||n===void 0||n.abort())},ob(t,[{key:"bbox",get:function(){return this._bbox},set:function(n){this._bbox||(this._bbox=n,"west"in n?this.boundingBox=[[n.west,n.south],[n.east,n.north]]:this.boundingBox=[[n.left,n.top],[n.right,n.bottom]])}},{key:"data",get:function(){var n=this;return this.isLoading&&this._loader?this._loader.then(function(){return n.data}):this.content}},{key:"isLoaded",get:function(){return this._isLoaded&&!this._needsReload}},{key:"isLoading",get:function(){return Boolean(this._loader)&&!this._isCancelled}},{key:"needsReload",get:function(){return this._needsReload||this._isCancelled}},{key:"byteLength",get:function(){var n=this.content?this.content.byteLength:0;return Number.isFinite(n)||console.error("byteLength not defined in tile data"),n}}]),t}();var Nn=P(ze());var ie={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Rd=new T,sb=new T,Dt=class{constructor(e=[0,0,0],r=[0,0,0],n){L(this,"center",void 0),L(this,"halfDiagonal",void 0),L(this,"minimum",void 0),L(this,"maximum",void 0),n=n||Rd.copy(e).add(r).scale(.5),this.center=new T(n),this.halfDiagonal=new T(r).subtract(this.center),this.minimum=new T(e),this.maximum=new T(r)}clone(){return new Dt(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,n=sb.from(e.normal),i=r.x*Math.abs(n.x)+r.y*Math.abs(n.y)+r.z*Math.abs(n.z),o=this.center.dot(n)+e.distance;return o-i>0?ie.INSIDE:o+i<0?ie.OUTSIDE:ie.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=Rd.from(e).subtract(this.center),{halfDiagonal:n}=this,i=0,o;return o=Math.abs(r.x)-n.x,o>0&&(i+=o*o),o=Math.abs(r.y)-n.y,o>0&&(i+=o*o),o=Math.abs(r.z)-n.z,o>0&&(i+=o*o),i}};var Fn=new T,Ld=new T,Pe=class{constructor(e=[0,0,0],r=0){L(this,"center",void 0),L(this,"radius",void 0),this.radius=-0,this.center=new T,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=Fn.from(r),this.center=new T().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Pe(this.center,this.radius)}union(e){let r=this.center,n=this.radius,i=e.center,o=e.radius,s=Fn.copy(i).subtract(r),a=s.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return e.clone();let c=(n+a+o)*.5;return Ld.copy(s).scale((-n+c)/a).add(r),this.center.copy(Ld),this.radius=c,this}expand(e){let n=Fn.from(e).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(e){this.center.transform(e);let r=Wi.getScaling(Fn,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let n=Fn.from(e).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(e){let r=this.center,n=this.radius,o=e.normal.dot(r)+e.distance;return o<-n?ie.OUTSIDE:o<n?ie.INTERSECTING:ie.INSIDE}};var ab=new T,cb=new T,mo=new T,go=new T,yo=new T,ub=new T,lb=new T,gt={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Je=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){L(this,"center",void 0),L(this,"halfAxes",void 0),this.center=new T().from(e),this.halfAxes=new j(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new T(e).len(),new T(r).len(),new T(n).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),i=new T(e).normalize(),o=new T(r).normalize(),s=new T(n).normalize();return new nt().fromMatrix3(new j([...i,...o,...s]))}fromCenterHalfSizeQuaternion(e,r,n){let i=new nt(n),o=new j().fromQuaternion(i);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new T().from(e),this.halfAxes=o,this}clone(){return new Je(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Pe){let r=this.halfAxes,n=r.getColumn(0,mo),i=r.getColumn(1,go),o=r.getColumn(2,yo),s=ab.copy(n).add(i).add(o);return e.center.copy(this.center),e.radius=s.magnitude(),e}intersectPlane(e){let r=this.center,n=e.normal,i=this.halfAxes,o=n.x,s=n.y,a=n.z,c=Math.abs(o*i[gt.COLUMN0ROW0]+s*i[gt.COLUMN0ROW1]+a*i[gt.COLUMN0ROW2])+Math.abs(o*i[gt.COLUMN1ROW0]+s*i[gt.COLUMN1ROW1]+a*i[gt.COLUMN1ROW2])+Math.abs(o*i[gt.COLUMN2ROW0]+s*i[gt.COLUMN2ROW1]+a*i[gt.COLUMN2ROW2]),u=n.dot(r)+e.distance;return u<=-c?ie.OUTSIDE:u>=c?ie.INSIDE:ie.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=cb.from(e).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,mo),o=n.getColumn(1,go),s=n.getColumn(2,yo),a=i.magnitude(),c=o.magnitude(),u=s.magnitude();i.normalize(),o.normalize(),s.normalize();let l=0,f;return f=Math.abs(r.dot(i))-a,f>0&&(l+=f*f),f=Math.abs(r.dot(o))-c,f>0&&(l+=f*f),f=Math.abs(r.dot(s))-u,f>0&&(l+=f*f),l}computePlaneDistances(e,r,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,a=this.halfAxes,c=a.getColumn(0,mo),u=a.getColumn(1,go),l=a.getColumn(2,yo),f=ub.copy(c).add(u).add(l).add(s),h=lb.copy(f).subtract(e),d=r.dot(h);return i=Math.min(d,i),o=Math.max(d,o),f.copy(s).add(c).add(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),i=Math.min(d,i),o=Math.max(d,o),f.copy(s).add(c).subtract(u).add(l),h.copy(f).subtract(e),d=r.dot(h),i=Math.min(d,i),o=Math.max(d,o),f.copy(s).add(c).subtract(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),i=Math.min(d,i),o=Math.max(d,o),s.copy(f).subtract(c).add(u).add(l),h.copy(f).subtract(e),d=r.dot(h),i=Math.min(d,i),o=Math.max(d,o),s.copy(f).subtract(c).add(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),i=Math.min(d,i),o=Math.max(d,o),s.copy(f).subtract(c).subtract(u).add(l),h.copy(f).subtract(e),d=r.dot(h),i=Math.min(d,i),o=Math.max(d,o),s.copy(f).subtract(c).subtract(u).subtract(l),h.copy(f).subtract(e),d=r.dot(h),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,mo);r.transformAsPoint(e);let n=this.halfAxes.getColumn(1,go);n.transformAsPoint(e);let i=this.halfAxes.getColumn(2,yo);return i.transformAsPoint(e),this.halfAxes=new j([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}};var Pd=new T,Fd=new T,fe=class{constructor(e=[0,0,1],r=0){L(this,"normal",void 0),L(this,"distance",void 0),this.normal=new T,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return le(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=Pd.from(e),this.normal.from(r).normalize();let n=-this.normal.dot(e);return this.distance=n,this}fromCoefficients(e,r,n,i){return this.normal.set(e,r,n),le(_e(this.normal.len(),1)),this.distance=i,this}clone(){return new fe(this.normal,this.distance)}equals(e){return _e(this.distance,e.distance)&&_e(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=Fd.copy(this.normal).transformAsVector(e).normalize(),n=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(n,r)}projectPointOntoPlane(e,r=[0,0,0]){let n=Pd.from(e),i=this.getPointDistance(n),o=Fd.copy(this.normal).scale(i);return n.subtract(o).to(r)}};var Dd=[new T([1,0,0]),new T([0,1,0]),new T([0,0,1])],Nd=new T,fb=new T,ae=class{constructor(e=[]){L(this,"planes",void 0),this.planes=e}fromBoundingSphere(e){this.planes.length=2*Dd.length;let r=e.center,n=e.radius,i=0;for(let o of Dd){let s=this.planes[i],a=this.planes[i+1];s||(s=this.planes[i]=new fe),a||(a=this.planes[i+1]=new fe);let c=Nd.copy(o).scale(-n).add(r);s.fromPointNormal(c,o);let u=Nd.copy(o).scale(n).add(r),l=fb.copy(o).negate();a.fromPointNormal(u,l),i+=2}return this}computeVisibility(e){let r=ie.INSIDE;for(let n of this.planes)switch(e.intersectPlane(n)){case ie.OUTSIDE:return ie.OUTSIDE;case ie.INTERSECTING:r=ie.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(le(Number.isFinite(r),"parentPlaneMask is required."),r===ae.MASK_OUTSIDE||r===ae.MASK_INSIDE)return r;let n=ae.MASK_INSIDE,i=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&!(r&s))continue;let a=i[o],c=e.intersectPlane(a);if(c===ie.OUTSIDE)return ae.MASK_OUTSIDE;c===ie.INTERSECTING&&(n|=s)}return n}};L(ae,"MASK_OUTSIDE",4294967295);L(ae,"MASK_INSIDE",0);L(ae,"MASK_INDETERMINATE",2147483647);var kD=new T,JD=new T,qD=new T,WD=new T,XD=new T;var tN=new T,rN=new T,nN=new T,iN=new T,oN=new T,sN=new T,aN=new T,cN=new T,uN=new T,lN=new T,fN=new T,hN=new T;var it=new j,db=new j,pb=new j,Ao=new j,Ud=new j;function Mc(t,e={}){let r=je.EPSILON20,n=10,i=0,o=0,s=db,a=pb;s.identity(),a.copy(t);let c=r*mb(a);for(;o<n&&gb(a)>c;)yb(a,Ao),Ud.copy(Ao).transpose(),a.multiplyRight(Ao),a.multiplyLeft(Ud),s.multiplyRight(Ao),++i>2&&(++o,i=0);return e.unitary=s.toTarget(e.unitary),e.diagonal=a.toTarget(e.diagonal),e}function mb(t){let e=0;for(let r=0;r<9;++r){let n=t[r];e+=n*n}return Math.sqrt(e)}var Bc=[1,0,0],Cc=[2,2,1];function gb(t){let e=0;for(let r=0;r<3;++r){let n=t[it.getElementIndex(Cc[r],Bc[r])];e+=2*n*n}return Math.sqrt(e)}function yb(t,e){let r=je.EPSILON15,n=0,i=1;for(let u=0;u<3;++u){let l=Math.abs(t[it.getElementIndex(Cc[u],Bc[u])]);l>n&&(i=u,n=l)}let o=Bc[i],s=Cc[i],a=1,c=0;if(Math.abs(t[it.getElementIndex(s,o)])>r){let u=t[it.getElementIndex(s,s)],l=t[it.getElementIndex(o,o)],f=t[it.getElementIndex(s,o)],h=(u-l)/2/f,d;h<0?d=-1/(-h+Math.sqrt(1+h*h)):d=1/(h+Math.sqrt(1+h*h)),a=1/Math.sqrt(1+d*d),c=d*a}return j.IDENTITY.to(e),e[it.getElementIndex(o,o)]=e[it.getElementIndex(s,s)]=a,e[it.getElementIndex(s,o)]=c,e[it.getElementIndex(o,s)]=-c,e}var Nt=new T,Ab=new T,_b=new T,vb=new T,xb=new T,Tb=new j,bb={diagonal:new j,unitary:new j};function Dn(t,e=new Je){if(!t||t.length===0)return e.halfAxes=new j([0,0,0,0,0,0,0,0,0]),e.center=new T,e;let r=t.length,n=new T(0,0,0);for(let b of t)n.add(b);let i=1/r;n.multiplyByScalar(i);let o=0,s=0,a=0,c=0,u=0,l=0;for(let b of t){let y=Nt.copy(b).subtract(n);o+=y.x*y.x,s+=y.x*y.y,a+=y.x*y.z,c+=y.y*y.y,u+=y.y*y.z,l+=y.z*y.z}o*=i,s*=i,a*=i,c*=i,u*=i,l*=i;let f=Tb;f[0]=o,f[1]=s,f[2]=a,f[3]=s,f[4]=c,f[5]=u,f[6]=a,f[7]=u,f[8]=l;let{unitary:h}=Mc(f,bb),d=e.halfAxes.copy(h),p=d.getColumn(0,_b),g=d.getColumn(1,vb),m=d.getColumn(2,xb),A=-Number.MAX_VALUE,_=-Number.MAX_VALUE,v=-Number.MAX_VALUE,x=Number.MAX_VALUE,B=Number.MAX_VALUE,S=Number.MAX_VALUE;for(let b of t)Nt.copy(b),A=Math.max(Nt.dot(p),A),_=Math.max(Nt.dot(g),_),v=Math.max(Nt.dot(m),v),x=Math.min(Nt.dot(p),x),B=Math.min(Nt.dot(g),B),S=Math.min(Nt.dot(m),S);p=p.multiplyByScalar(.5*(x+A)),g=g.multiplyByScalar(.5*(B+_)),m=m.multiplyByScalar(.5*(S+v)),e.center.copy(p).add(g).add(m);let C=Ab.set(A-x,_-B,v-S).multiplyByScalar(.5),E=new j([C[0],0,0,0,C[1],0,0,0,C[2]]);return e.halfAxes.multiplyRight(E),e}function zd(t,e){return Bb(t)||Sb(t,e)||jd(t,e)||Eb()}function Eb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
17
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sb(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function Bb(t){if(Array.isArray(t))return t}function wc(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=jd(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
18
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function jd(t,e){if(t){if(typeof t=="string")return Gd(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gd(t,e)}}function Gd(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Cb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hd(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Mb(t,e,r){return e&&Hd(t.prototype,e),r&&Hd(t,r),t}var Nr=512,Vd=3,kd=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],Jd=kd.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),wb=Jd.concat([[.25,.5],[.75,.5]]),Ib=function(){function t(r,n,i){Cb(this,t),this.x=void 0,this.y=void 0,this.z=void 0,this.childVisible=void 0,this.selected=void 0,this._children=void 0,this.x=r,this.y=n,this.z=i}var e=t.prototype;return e.update=function(n){var i=n.viewport,o=n.cullingVolume,s=n.elevationBounds,a=n.minZ,c=n.maxZ,u=n.bounds,l=n.offset,f=n.project,h=this.getBoundingVolume(s,l,f);if(u&&!this.insideBounds(u))return!1;var d=o.computeVisibility(h);if(d<0)return!1;if(!this.childVisible){var p=this.z;if(p<c&&p>=a){var g=h.distanceTo(i.cameraPosition)*i.scale/i.height;p+=Math.floor(Math.log2(g))}if(p>=c)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;var m=wc(this.children),A;try{for(m.s();!(A=m.n()).done;){var _=A.value;_.update(n)}}catch(v){m.e(v)}finally{m.f()}return!0},e.getSelected=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];if(this.selected&&n.push(this),this._children){var i=wc(this._children),o;try{for(i.s();!(o=i.n()).done;){var s=o.value;s.getSelected(n)}}catch(a){i.e(a)}finally{i.f()}}return n},e.insideBounds=function(n){var i=zd(n,4),o=i[0],s=i[1],a=i[2],c=i[3],u=Math.pow(2,this.z),l=Nr/u;return this.x*l<a&&this.y*l<c&&(this.x+1)*l>o&&(this.y+1)*l>s},e.getBoundingVolume=function(n,i,o){if(o){var s=this.z<1?wb:this.z<2?Jd:kd,a=[],c=wc(s),u;try{for(c.s();!(u=c.n()).done;){var l=u.value,f=_o(this.x+l[0],this.y+l[1],this.z);f[2]=n[0],a.push(o(f)),n[0]!==n[1]&&(f[2]=n[1],a.push(o(f)))}}catch(m){c.e(m)}finally{c.f()}return Dn(a)}var h=Math.pow(2,this.z),d=Nr/h,p=this.x*d+i*Nr,g=Nr-(this.y+1)*d;return new Dt([p,g,n[0]],[p+d,g+d,n[1]])},Mb(t,[{key:"children",get:function(){if(!this._children){var n=this.x*2,i=this.y*2,o=this.z+1;this._children=[new t(n,i,o),new t(n,i+1,o),new t(n+1,i,o),new t(n+1,i+1,o)]}return this._children}}]),t}();function qd(t,e,r,n){var i=t instanceof Nn._GlobeViewport&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map(function(B){var S=B.normal,C=B.distance;return new fe(S.clone().negate(),C)}),s=new ae(o),a=t.distanceScales.unitsPerMeter[2],c=r&&r[0]*a||0,u=r&&r[1]*a||0,l=t instanceof Nn.WebMercatorViewport&&t.pitch<=60?e:0;if(n){var f=n,h=zd(f,4),d=h[0],p=h[1],g=h[2],m=h[3],A=pt([d,m]),_=pt([g,p]);n=[A[0],Nr-A[1],_[0],Nr-_[1]]}var v=new Ib(0,0,0),x={viewport:t,project:i,cullingVolume:s,elevationBounds:[c,u],minZ:l,maxZ:e,bounds:n,offset:0};if(v.update(x),t instanceof Nn.WebMercatorViewport&&t.subViewports&&t.subViewports.length>1){for(x.offset=-1;v.update(x)&&!(--x.offset<-Vd););for(x.offset=1;v.update(x)&&!(++x.offset>Vd););}return v.getSelected()}function Ur(t,e){return Lb(t)||Rb(t,e)||Xd(t,e)||Ob()}function Ob(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
19
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rb(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function Lb(t){if(Array.isArray(t))return t}function vo(t){return Db(t)||Fb(t)||Xd(t)||Pb()}function Pb(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
20
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xd(t,e){if(t){if(typeof t=="string")return Ic(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ic(t,e)}}function Fb(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Db(t){if(Array.isArray(t))return Ic(t)}function Ic(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var yt=512,Nb=[-1/0,-1/0,1/0,1/0],Ut={type:"object",value:null,validate:function(e,r){return r.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(function(n){return typeof n=="string"})},equal:function(e,r){if(e===r)return!0;if(!Array.isArray(e)||!Array.isArray(r))return!1;var n=e.length;if(n!==r.length)return!1;for(var i=0;i<n;i++)if(e[i]!==r[i])return!1;return!0}};function Kd(t,e){var r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])],n=[Math.min.apply(Math,vo(r.map(function(i){return i[0]}))),Math.min.apply(Math,vo(r.map(function(i){return i[1]}))),Math.max.apply(Math,vo(r.map(function(i){return i[0]}))),Math.max.apply(Math,vo(r.map(function(i){return i[1]})))];return n}function Ub(t){return Math.abs(t.split("").reduce(function(e,r){return(e<<5)-e+r.charCodeAt(0)|0},0))}function ot(t,e){if(!t||!t.length)return null;var r=e.index,n=e.id;if(Array.isArray(t)){var i=Ub(n)%t.length;t=t[i]}for(var o=t,s=0,a=Object.keys(r);s<a.length;s++){var c=a[s],u=new RegExp("{".concat(c,"}"),"g");o=o.replace(u,String(r[c]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(o=o.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),o}function Gb(t,e,r){var n;if(e&&e.length===2){var i=Ur(e,2),o=i[0],s=i[1],a=t.getBounds({z:o}),c=t.getBounds({z:s});n=[Math.min(a[0],c[0]),Math.min(a[1],c[1]),Math.max(a[2],c[2]),Math.max(a[3],c[3])]}else n=t.getBounds();return t.isGeospatial?[Math.max(n[0],r[0]),Math.max(n[1],r[1]),Math.min(n[2],r[2]),Math.min(n[3],r[3])]:[Math.max(Math.min(n[0],r[2]),r[0]),Math.max(Math.min(n[1],r[3]),r[1]),Math.min(Math.max(n[2],r[0]),r[2]),Math.min(Math.max(n[3],r[1]),r[3])]}function Yd(t){var e=t.viewport,r=t.z,n=t.cullRect,i=e.subViewports||[e];return i.map(function(o){return Oc(o,r||0,n)})}function Oc(t,e,r){if(!Array.isArray(e)){var n=r.x-t.x,i=r.y-t.y,o=r.width,s=r.height,a={targetZ:e},c=t.unproject([n,i],a),u=t.unproject([n+o,i],a),l=t.unproject([n,i+s],a),f=t.unproject([n+o,i+s],a);return[Math.min(c[0],u[0],l[0],f[0]),Math.min(c[1],u[1],l[1],f[1]),Math.max(c[0],u[0],l[0],f[0]),Math.max(c[1],u[1],l[1],f[1])]}var h=Oc(t,e[0],r),d=Oc(t,e[1],r);return[Math.min(h[0],d[0]),Math.min(h[1],d[1]),Math.max(h[2],d[2]),Math.max(h[3],d[3])]}function Hb(t,e,r){if(r){var n=Kd(t,r).map(function(i){return i*e/yt});return n}return t.map(function(i){return i*e/yt})}function Rc(t,e){return Math.pow(2,t)*yt/e}function _o(t,e,r){var n=Rc(r,yt),i=t/n*360-180,o=Math.PI-2*Math.PI*e/n,s=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[i,s]}function Wd(t,e,r,n){var i=Rc(r,n);return[t/i*yt,e/i*yt]}function Lc(t,e,r,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:yt;if(t.isGeospatial){var o=_o(e,r,n),s=Ur(o,2),a=s[0],c=s[1],u=_o(e+1,r+1,n),l=Ur(u,2),f=l[0],h=l[1];return{west:a,north:c,east:f,south:h}}var d=Wd(e,r,n,i),p=Ur(d,2),g=p[0],m=p[1],A=Wd(e+1,r+1,n,i),_=Ur(A,2),v=_[0],x=_[1];return{left:g,top:m,right:v,bottom:x}}function Vb(t,e,r,n,i){for(var o=Gb(t,null,n),s=Rc(e,r),a=Hb(o,s,i),c=Ur(a,4),u=c[0],l=c[1],f=c[2],h=c[3],d=[],p=Math.floor(u);p<f;p++)for(var g=Math.floor(l);g<h;g++)d.push({x:p,y:g,z:e});return d}function Pc(t){var e=t.viewport,r=t.maxZoom,n=t.minZoom,i=t.zRange,o=t.extent,s=t.tileSize,a=s===void 0?yt:s,c=t.modelMatrix,u=t.modelMatrixInverse,l=t.zoomOffset,f=l===void 0?0:l,h=e.isGeospatial?Math.round(e.zoom+Math.log2(yt/a))+f:Math.ceil(e.zoom)+f;if(typeof n=="number"&&Number.isFinite(n)&&h<n){if(!o)return[];h=n}typeof r=="number"&&Number.isFinite(r)&&h>r&&(h=r);var d=o;return c&&u&&o&&!e.isGeospatial&&(d=Kd(o,c)),e.isGeospatial?qd(e,h,i,o):Vb(e,h,a,d||Nb,u)}function Fc(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function Dc(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function Zd(t){var e={},r;return function(n){for(var i in n)if(!zb(n[i],e[i])){r=t(n),e=n;break}return r}}function zb(t,e){if(t===e)return!0;if(Array.isArray(t)){var r=t.length;if(!e||e.length!==r)return!1;for(var n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}return!1}var Un;function Qd(t,e){return Jb(t)||kb(t,e)||ip(t,e)||jb()}function jb(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
21
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kb(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function Jb(t){if(Array.isArray(t))return t}function he(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ip(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
22
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function ip(t,e){if(t){if(typeof t=="string")return $d(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $d(t,e)}}function $d(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ep(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function tp(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ep(Object(r),!0).forEach(function(n){xo(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ep(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qb(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wb(t,e,r){return e&&rp(t.prototype,e),r&&rp(t,r),t}function xo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var np=1,To=2,Xb="never",Kb="no-overlap",Gn="best-available",Yb=5,Zb=(Un={},xo(Un,Gn,$b),xo(Un,Kb,eE),xo(Un,Xb,function(){}),Un),Qb={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:function(){},onTileUnload:function(){},onTileError:function(){}},Hn=function(){function t(r){var n=this;qb(this,t),this.opts=void 0,this._requestScheduler=void 0,this._cache=void 0,this._dirty=void 0,this._tiles=void 0,this._cacheByteSize=void 0,this._viewport=void 0,this._zRange=void 0,this._selectedTiles=void 0,this._frameNumber=void 0,this._modelMatrix=void 0,this._modelMatrixInverse=void 0,this._maxZoom=void 0,this._minZoom=void 0,this.onTileLoad=void 0,this._getCullBounds=Zd(Yd),this.opts=tp(tp({},Qb),r),this.onTileLoad=function(i){var o,s;(o=(s=n.opts).onTileLoad)===null||o===void 0||o.call(s,i),n.opts.maxCacheByteSize&&(n._cacheByteSize+=i.byteLength,n._resizeCache())},this._requestScheduler=new wt({maxRequests:r.maxRequests,throttleRequests:Boolean(r.maxRequests&&r.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new D,this._modelMatrixInverse=new D,this.setOptions(r)}var e=t.prototype;return e.setOptions=function(n){Object.assign(this.opts,n),Number.isFinite(n.maxZoom)&&(this._maxZoom=Math.floor(n.maxZoom)),Number.isFinite(n.minZoom)&&(this._minZoom=Math.ceil(n.minZoom))},e.finalize=function(){var n=he(this._cache.values()),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;o.isLoading&&o.abort()}}catch(s){n.e(s)}finally{n.f()}this._cache.clear(),this._tiles=[],this._selectedTiles=null},e.reloadAll=function(){var n=he(this._cache.keys()),i;try{for(n.s();!(i=n.n()).done;){var o=i.value,s=this._cache.get(o);!this._selectedTiles||!this._selectedTiles.includes(s)?this._cache.delete(o):s.setNeedsReload()}}catch(a){n.e(a)}finally{n.f()}},e.update=function(n){var i=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.zRange,a=o.modelMatrix,c=a?new D(a):new D,u=!c.equals(this._modelMatrix);if(!this._viewport||!n.equals(this._viewport)||!_e(this._zRange,s)||u){u&&(this._modelMatrixInverse=c.clone().invert(),this._modelMatrix=c),this._viewport=n,this._zRange=s;var l=this.getTileIndices({viewport:n,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:s,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(function(h){return i._getTile(h,!0)}),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(function(h){return i._getTile(h.index,!0)}));var f=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),f&&this._frameNumber++,this._frameNumber},e.isTileVisible=function(n,i){if(!n.isVisible)return!1;if(i&&this._viewport){var o=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:i}),s=n.bbox,a=he(o),c;try{for(a.s();!(c=a.n()).done;){var u=Qd(c.value,4),l=u[0],f=u[1],h=u[2],d=u[3],p=void 0;if("west"in s)p=s.west<h&&s.east>l&&s.south<d&&s.north>f;else{var g=Math.min(s.top,s.bottom),m=Math.max(s.top,s.bottom);p=s.left<h&&s.right>l&&g<d&&m>f}if(p)return!0}}catch(A){a.e(A)}finally{a.f()}return!1}return!0},e.getTileIndices=function(n){var i=n.viewport,o=n.maxZoom,s=n.minZoom,a=n.zRange,c=n.modelMatrix,u=n.modelMatrixInverse,l=this.opts,f=l.tileSize,h=l.extent,d=l.zoomOffset;return Pc({viewport:i,maxZoom:o,minZoom:s,zRange:a,tileSize:f,extent:h,modelMatrix:c,modelMatrixInverse:u,zoomOffset:d})},e.getTileId=function(n){return"".concat(n.x,"-").concat(n.y,"-").concat(n.z)},e.getTileZoom=function(n){return n.z},e.getTileMetadata=function(n){var i=this.opts.tileSize;return{bbox:Lc(this._viewport,n.x,n.y,n.z,i)}},e.getParentIndex=function(n){var i=Math.floor(n.x/2),o=Math.floor(n.y/2),s=n.z-1;return{x:i,y:o,z:s}},e.updateTileStates=function(){var n=this.opts.refinementStrategy||Gn,i=new Array(this._cache.size),o=0,s=he(this._cache.values()),a;try{for(s.s();!(a=s.n()).done;){var c=a.value;i[o++]=c.isVisible,c.isSelected=!1,c.isVisible=!1}}catch(g){s.e(g)}finally{s.f()}var u=he(this._selectedTiles),l;try{for(u.s();!(l=u.n()).done;){var f=l.value;f.isSelected=!0,f.isVisible=!0}}catch(g){u.e(g)}finally{u.f()}(typeof n=="function"?n:Zb[n])(Array.from(this._cache.values())),o=0;var h=he(this._cache.values()),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;if(i[o++]!==p.isVisible)return!0}}catch(g){h.e(g)}finally{h.f()}return!1},e._pruneRequests=function(){var n=this.opts.maxRequests,i=n===void 0?0:n,o=[],s=0,a=he(this._cache.values()),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;u.isLoading&&(s++,!u.isSelected&&!u.isVisible&&o.push(u))}}catch(f){a.e(f)}finally{a.f()}for(;i>0&&s>i&&o.length>0;){var l=o.shift();l.abort(),s--}},e._rebuildTree=function(){var n=this._cache,i=he(n.values()),o;try{for(i.s();!(o=i.n()).done;){var s=o.value;s.parent=null,s.children&&(s.children.length=0)}}catch(f){i.e(f)}finally{i.f()}var a=he(n.values()),c;try{for(a.s();!(c=a.n()).done;){var u=c.value,l=this._getNearestAncestor(u);u.parent=l,l!=null&&l.children&&l.children.push(u)}}catch(f){a.e(f)}finally{a.f()}},e._resizeCache=function(){var n=this._cache,i=this.opts,o=i.maxCacheSize||(i.maxCacheByteSize?1/0:Yb*this.selectedTiles.length),s=i.maxCacheByteSize||1/0,a=n.size>o||this._cacheByteSize>s;if(a){var c=he(n),u;try{for(c.s();!(u=c.n()).done;){var l=Qd(u.value,2),f=l[0],h=l[1];if(!h.isVisible&&!h.isSelected){var d,p;this._cacheByteSize-=i.maxCacheByteSize?h.byteLength:0,n.delete(f),(d=(p=this.opts).onTileUnload)===null||d===void 0||d.call(p,h)}if(n.size<=o&&this._cacheByteSize<=s)break}}catch(g){c.e(g)}finally{c.f()}this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort(function(g,m){return g.zoom-m.zoom}),this._dirty=!1)},e._getTile=function(n,i){var o=this.getTileId(n),s=this._cache.get(o),a=!1;return!s&&i?(s=new Pn(n),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:o,zoom:this.getTileZoom(s.index)}),a=!0,this._cache.set(o,s),this._dirty=!0):s&&s.needsReload&&(a=!0),s&&a&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s},e._getNearestAncestor=function(n){for(var i=this._minZoom,o=i===void 0?0:i,s=n.index;this.getTileZoom(s)>o;){s=this.getParentIndex(s);var a=this._getTile(s);if(a)return a}return null},Wb(t,[{key:"tiles",get:function(){return this._tiles}},{key:"selectedTiles",get:function(){return this._selectedTiles}},{key:"isLoaded",get:function(){return this._selectedTiles!==null&&this._selectedTiles.every(function(n){return n.isLoaded})}},{key:"needsReload",get:function(){return this._selectedTiles!==null&&this._selectedTiles.some(function(n){return n.needsReload})}}]),t}();function $b(t){var e=he(t),r;try{for(e.s();!(r=e.n()).done;){var n=r.value;n.state=0}}catch(l){e.e(l)}finally{e.f()}var i=he(t),o;try{for(i.s();!(o=i.n()).done;){var s=o.value;s.isSelected&&!op(s)&&Nc(s)}}catch(l){i.e(l)}finally{i.f()}var a=he(t),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;u.isVisible=Boolean(u.state&To)}}catch(l){a.e(l)}finally{a.f()}}function eE(t){var e=he(t),r;try{for(e.s();!(r=e.n()).done;){var n=r.value;n.state=0}}catch(p){e.e(p)}finally{e.f()}var i=he(t),o;try{for(i.s();!(o=i.n()).done;){var s=o.value;s.isSelected&&op(s)}}catch(p){i.e(p)}finally{i.f()}var a=Array.from(t).sort(function(p,g){return p.zoom-g.zoom}),c=he(a),u;try{for(c.s();!(u=c.n()).done;){var l=u.value;if(l.isVisible=Boolean(l.state&To),l.children&&(l.isVisible||l.state&np)){var f=he(l.children),h;try{for(f.s();!(h=f.n()).done;){var d=h.value;d.state=np}}catch(p){f.e(p)}finally{f.f()}}else l.isSelected&&Nc(l)}}catch(p){c.e(p)}finally{c.f()}}function op(t){for(var e=t;e;){if(e.isLoaded||e.content)return e.state|=To,!0;e=e.parent}return!1}function Nc(t){var e=he(t.children),r;try{for(e.s();!(r=e.n()).done;){var n=r.value;n.isLoaded||n.content?n.state|=To:Nc(n)}}catch(i){e.e(i)}finally{e.f()}}function Eo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Eo=function(r){return typeof r}:Eo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Eo(t)}function sp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function bo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sp(Object(r),!0).forEach(function(n){tE(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function tE(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rE(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=nE(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
23
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function nE(t,e){if(t){if(typeof t=="string")return ap(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ap(t,e)}}function ap(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function iE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function oE(t,e,r){return e&&cp(t.prototype,e),r&&cp(t,r),t}function sE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Uc(t,e)}function Uc(t,e){return Uc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Uc(t,e)}function aE(t){var e=lE();return function(){var n=So(t),i;if(e){var o=So(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cE(this,i)}}function cE(t,e){if(e&&(Eo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return uE(t)}function uE(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function So(t){return So=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},So(t)}var fE={TilesetClass:Hn,data:{type:"data",value:[]},dataComparator:Ut.equal,renderSubLayers:{type:"function",value:function(e){return new up.GeoJsonLayer(e)}},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:function(e){}},onTileUnload:{type:"function",value:function(e){}},onTileError:{type:"function",value:function(e){return console.error(e)}},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Gn,zRange:null,maxRequests:6,zoomOffset:0},At=function(t){sE(r,t);var e=aE(r);function r(){var i;iE(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=e.call.apply(e,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){this.state={tileset:null,isLoaded:!1}},n.finalizeState=function(){var o,s;(o=this.state)===null||o===void 0||(s=o.tileset)===null||s===void 0||s.finalize()},n.shouldUpdateState=function(o){var s=o.changeFlags;return s.somethingChanged},n.updateState=function(o){var s=o.changeFlags,a=this.state.tileset,c=s.propsOrDataChanged||s.updateTriggersChanged,u=s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged.getTileData);a?c&&(a.setOptions(this._getTilesetOptions()),u?a.reloadAll():a.tiles.forEach(function(l){l.layers=null})):(a=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:a})),this._updateTileset()},n._getTilesetOptions=function(){var o=this.props,s=o.tileSize,a=o.maxCacheSize,c=o.maxCacheByteSize,u=o.refinementStrategy,l=o.extent,f=o.maxZoom,h=o.minZoom,d=o.maxRequests,p=o.zoomOffset;return{maxCacheSize:a,maxCacheByteSize:c,maxZoom:f,minZoom:h,tileSize:s,refinementStrategy:u,extent:l,maxRequests:d,zoomOffset:p,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}},n._updateTileset=function(){var o=this.state.tileset,s=this.props,a=s.zRange,c=s.modelMatrix,u=o.update(this.context.viewport,{zRange:a,modelMatrix:c}),l=o.isLoaded,f=this.state.isLoaded!==l,h=this.state.frameNumber!==u;l&&(f||h)&&this._onViewportLoad(),h&&this.setState({frameNumber:u}),this.state.isLoaded=l},n._onViewportLoad=function(){var o=this.state.tileset,s=this.props.onViewportLoad;s&&s(o.selectedTiles)},n._onTileLoad=function(o){this.props.onTileLoad(o),o.layers=null,this.setNeedsUpdate()},n._onTileError=function(o,s){this.props.onTileError(o),s.layers=null,this.setNeedsUpdate()},n._onTileUnload=function(o){this.props.onTileUnload(o)},n.getTileData=function(o){var s=this.props,a=s.data,c=s.getTileData,u=s.fetch,l=o.signal;return o.url=typeof a=="string"||Array.isArray(a)?ot(a,o):null,c?c(o):u&&o.url?u(o.url,{propName:"data",layer:this,signal:l}):null},n.renderSubLayers=function(o){return this.props.renderSubLayers(o)},n.getSubLayerPropsByTile=function(o){return null},n.getPickingInfo=function(o){var s=o.info,a=o.sourceLayer,c=a.props.tile;return s.picked&&(s.tile=c),s.sourceTile=c,s},n._updateAutoHighlight=function(o){var s=o.sourceTile;if(s&&s.layers){var a=rE(s.layers),c;try{for(a.s();!(c=a.n()).done;){var u=c.value;u.updateAutoHighlight(o)}}catch(l){a.e(l)}finally{a.f()}}},n.renderLayers=function(){var o=this;return this.state.tileset.tiles.map(function(s){var a=o.getSubLayerPropsByTile(s);if(!(!s.isLoaded&&!s.content))if(s.layers)a&&s.layers[0]&&Object.keys(a).some(function(u){return s.layers[0].props[u]!==a[u]})&&(s.layers=s.layers.map(function(u){return u.clone(a)}));else{var c=o.renderSubLayers(bo(bo(bo({},o.props),o.getSubLayerProps({id:s.id,updateTriggers:o.props.updateTriggers})),{},{data:s.content,_offset:0,tile:s}));s.layers=(0,Bo._flatten)(c,Boolean).map(function(u){return u.clone(bo({tile:s},a))})}return s.layers})},n.filterSubLayer=function(o){var s=o.layer,a=o.cullRect,c=s.props.tile;return this.state.tileset.isTileVisible(c,a)},oE(r,[{key:"isLoaded",get:function(){var o,s,a=(o=this.state)===null||o===void 0||(s=o.tileset)===null||s===void 0?void 0:s.selectedTiles;return a?a.every(function(c){return c.isLoaded&&c.layers&&c.layers.every(function(u){return u.isLoaded})}):!1}}]),r}(Bo.CompositeLayer);At.defaultProps=fE;At.layerName="TileLayer";var hp=P(Ve());function Co(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Co=function(r){return typeof r}:Co=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Co(t)}function lp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fp(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lp(Object(r),!0).forEach(function(n){hE(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function hE(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gr(t,e,r){return typeof Reflect<"u"&&Reflect.get?Gr=Reflect.get:Gr=function(i,o,s){var a=pE(i,o);if(a){var c=Object.getOwnPropertyDescriptor(a,o);return c.get?c.get.call(s):c.value}},Gr(t,e,r||t)}function pE(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=Gt(t),t!==null););return t}function mE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Gc(t,e)}function Gc(t,e){return Gc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Gc(t,e)}function gE(t){var e=_E();return function(){var n=Gt(t),i;if(e){var o=Gt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return yE(this,i)}}function yE(t,e){if(e&&(Co(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return AE(t)}function AE(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _E(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Gt(t){return Gt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Gt(t)}var vE={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:function(e){return e.timestamps}}},Mo=function(t){mE(r,t);var e=gE(r);function r(){return dE(this,r),e.apply(this,arguments)}var n=r.prototype;return n.getShaders=function(){var o=Gr(Gt(r.prototype),"getShaders",this).call(this);return o.inject={"vs:#decl":`uniform float trailLength;
13
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}de.prototype.build=function(e){return this.options.preserveOrder?f0(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)};de.prototype.j2x=function(e,t){let n="",r="";for(let s in e)if(typeof e[s]>"u")this.isAttribute(s)&&(r+="");else if(e[s]===null)this.isAttribute(s)?r+="":s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)r+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){let i=this.isAttribute(s);if(i)n+=this.buildAttrPairStr(i,""+e[s]);else if(s===this.options.textNodeName){let o=this.options.tagValueProcessor(s,""+e[s]);r+=this.replaceEntitiesValue(o)}else r+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){let i=e[s].length,o="";for(let a=0;a<i;a++){let c=e[s][a];typeof c>"u"||(c===null?s[0]==="?"?r+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+s+"/"+this.tagEndChar:typeof c=="object"?this.options.oneListGroup?o+=this.j2x(c,t+1).val:o+=this.processTextOrObjNode(c,s,t):o+=this.buildTextValNode(c,s,"",t))}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,"",t)),r+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){let i=Object.keys(e[s]),o=i.length;for(let a=0;a<o;a++)n+=this.buildAttrPairStr(i[a],""+e[s][i[a]])}else r+=this.processTextOrObjNode(e[s],s,t);return{attrStr:n,val:r}};de.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function p0(e,t,n){let r=this.j2x(e,n+1);return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}de.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let s="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",s=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+s}};de.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};de.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+s+"</"+t+this.tagEndChar}};de.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function m0(e){return this.options.indentBy.repeat(e)}function g0(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}$l.exports=de});var nu=et((AS,eu)=>{"use strict";var A0=oo(),x0=Xl(),y0=tu();eu.exports={XMLParser:x0,XMLValidator:A0,XMLBuilder:y0}});var Aa=et((Dh,cr)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof El=="function"&&typeof cr=="object"&&cr&&cr.exports?cr.exports=t():(e.dcodeIO=e.dcodeIO||{}).Long=t()})(Dh,function(){"use strict";function e(T,m,M){this.low=T|0,this.high=m|0,this.unsigned=!!M}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1});function t(T){return(T&&T.__isLong__)===!0}e.isLong=t;var n={},r={};function s(T,m){var M,F,R;return m?(T>>>=0,(R=0<=T&&T<256)&&(F=r[T],F)?F:(M=o(T,(T|0)<0?-1:0,!0),R&&(r[T]=M),M)):(T|=0,(R=-128<=T&&T<128)&&(F=n[T],F)?F:(M=o(T,T<0?-1:0,!1),R&&(n[T]=M),M))}e.fromInt=s;function i(T,m){if(isNaN(T)||!isFinite(T))return m?y:g;if(m){if(T<0)return y;if(T>=d)return S}else{if(T<=-p)return w;if(T+1>=p)return b}return T<0?i(-T,m).neg():o(T%f|0,T/f|0,m)}e.fromNumber=i;function o(T,m,M){return new e(T,m,M)}e.fromBits=o;var a=Math.pow;function c(T,m,M){if(T.length===0)throw Error("empty string");if(T==="NaN"||T==="Infinity"||T==="+Infinity"||T==="-Infinity")return g;if(typeof m=="number"?(M=m,m=!1):m=!!m,M=M||10,M<2||36<M)throw RangeError("radix");var F;if((F=T.indexOf("-"))>0)throw Error("interior hyphen");if(F===0)return c(T.substring(1),m,M).neg();for(var R=i(a(M,8)),v=g,D=0;D<T.length;D+=8){var W=Math.min(8,T.length-D),z=parseInt(T.substring(D,D+W),M);if(W<8){var Z=i(a(M,W));v=v.mul(Z).add(i(z))}else v=v.mul(R),v=v.add(i(z))}return v.unsigned=m,v}e.fromString=c;function l(T){return T instanceof e?T:typeof T=="number"?i(T):typeof T=="string"?c(T):o(T.low,T.high,T.unsigned)}e.fromValue=l;var u=1<<16,h=1<<24,f=u*u,d=f*f,p=d/2,A=s(h),g=s(0);e.ZERO=g;var y=s(0,!0);e.UZERO=y;var E=s(1);e.ONE=E;var _=s(1,!0);e.UONE=_;var B=s(-1);e.NEG_ONE=B;var b=o(-1,2147483647,!1);e.MAX_VALUE=b;var S=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=S;var w=o(0,-2147483648,!1);e.MIN_VALUE=w;var C=e.prototype;return C.toInt=function(){return this.unsigned?this.low>>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},C.toString=function(m){if(m=m||10,m<2||36<m)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(w)){var M=i(m),F=this.div(M),R=F.mul(M).sub(this);return F.toString(m)+R.toInt().toString(m)}else return"-"+this.neg().toString(m);for(var v=i(a(m,6),this.unsigned),D=this,W="";;){var z=D.div(v),Z=D.sub(z.mul(v)).toInt()>>>0,X=Z.toString(m);if(D=z,D.isZero())return X+W;for(;X.length<6;)X="0"+X;W=""+X+W}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var m=this.high!=0?this.high:this.low,M=31;M>0&&!(m&1<<M);M--);return this.high!=0?M+33:M+1},C.isZero=function(){return this.high===0&&this.low===0},C.isNegative=function(){return!this.unsigned&&this.high<0},C.isPositive=function(){return this.unsigned||this.high>=0},C.isOdd=function(){return(this.low&1)===1},C.isEven=function(){return(this.low&1)===0},C.equals=function(m){return t(m)||(m=l(m)),this.unsigned!==m.unsigned&&this.high>>>31===1&&m.high>>>31===1?!1:this.high===m.high&&this.low===m.low},C.eq=C.equals,C.notEquals=function(m){return!this.eq(m)},C.neq=C.notEquals,C.lessThan=function(m){return this.comp(m)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(m){return this.comp(m)<=0},C.lte=C.lessThanOrEqual,C.greaterThan=function(m){return this.comp(m)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(m){return this.comp(m)>=0},C.gte=C.greaterThanOrEqual,C.compare=function(m){if(t(m)||(m=l(m)),this.eq(m))return 0;var M=this.isNegative(),F=m.isNegative();return M&&!F?-1:!M&&F?1:this.unsigned?m.high>>>0>this.high>>>0||m.high===this.high&&m.low>>>0>this.low>>>0?-1:1:this.sub(m).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(E)},C.neg=C.negate,C.add=function(m){t(m)||(m=l(m));var M=this.high>>>16,F=this.high&65535,R=this.low>>>16,v=this.low&65535,D=m.high>>>16,W=m.high&65535,z=m.low>>>16,Z=m.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=v+Z,tt+=xt>>>16,xt&=65535,tt+=R+z,Y+=tt>>>16,tt&=65535,Y+=F+W,X+=Y>>>16,Y&=65535,X+=M+D,X&=65535,o(tt<<16|xt,X<<16|Y,this.unsigned)},C.subtract=function(m){return t(m)||(m=l(m)),this.add(m.neg())},C.sub=C.subtract,C.multiply=function(m){if(this.isZero()||(t(m)||(m=l(m)),m.isZero()))return g;if(this.eq(w))return m.isOdd()?w:g;if(m.eq(w))return this.isOdd()?w:g;if(this.isNegative())return m.isNegative()?this.neg().mul(m.neg()):this.neg().mul(m).neg();if(m.isNegative())return this.mul(m.neg()).neg();if(this.lt(A)&&m.lt(A))return i(this.toNumber()*m.toNumber(),this.unsigned);var M=this.high>>>16,F=this.high&65535,R=this.low>>>16,v=this.low&65535,D=m.high>>>16,W=m.high&65535,z=m.low>>>16,Z=m.low&65535,X=0,Y=0,tt=0,xt=0;return xt+=v*Z,tt+=xt>>>16,xt&=65535,tt+=R*Z,Y+=tt>>>16,tt&=65535,tt+=v*z,Y+=tt>>>16,tt&=65535,Y+=F*Z,X+=Y>>>16,Y&=65535,Y+=R*z,X+=Y>>>16,Y&=65535,Y+=v*W,X+=Y>>>16,Y&=65535,X+=M*Z+F*z+R*W+v*D,X&=65535,o(tt<<16|xt,X<<16|Y,this.unsigned)},C.mul=C.multiply,C.divide=function(m){if(t(m)||(m=l(m)),m.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:g;var M,F,R;if(this.unsigned){if(m.unsigned||(m=m.toUnsigned()),m.gt(this))return y;if(m.gt(this.shru(1)))return _;R=y}else{if(this.eq(w)){if(m.eq(E)||m.eq(B))return w;if(m.eq(w))return E;var v=this.shr(1);return M=v.div(m).shl(1),M.eq(g)?m.isNegative()?E:B:(F=this.sub(m.mul(M)),R=M.add(F.div(m)),R)}else if(m.eq(w))return this.unsigned?y:g;if(this.isNegative())return m.isNegative()?this.neg().div(m.neg()):this.neg().div(m).neg();if(m.isNegative())return this.div(m.neg()).neg();R=g}for(F=this;F.gte(m);){M=Math.max(1,Math.floor(F.toNumber()/m.toNumber()));for(var D=Math.ceil(Math.log(M)/Math.LN2),W=D<=48?1:a(2,D-48),z=i(M),Z=z.mul(m);Z.isNegative()||Z.gt(F);)M-=W,z=i(M,this.unsigned),Z=z.mul(m);z.isZero()&&(z=E),R=R.add(z),F=F.sub(Z)}return R},C.div=C.divide,C.modulo=function(m){return t(m)||(m=l(m)),this.sub(this.div(m).mul(m))},C.mod=C.modulo,C.not=function(){return o(~this.low,~this.high,this.unsigned)},C.and=function(m){return t(m)||(m=l(m)),o(this.low&m.low,this.high&m.high,this.unsigned)},C.or=function(m){return t(m)||(m=l(m)),o(this.low|m.low,this.high|m.high,this.unsigned)},C.xor=function(m){return t(m)||(m=l(m)),o(this.low^m.low,this.high^m.high,this.unsigned)},C.shiftLeft=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?o(this.low<<m,this.high<<m|this.low>>>32-m,this.unsigned):o(0,this.low<<m-32,this.unsigned)},C.shl=C.shiftLeft,C.shiftRight=function(m){return t(m)&&(m=m.toInt()),(m&=63)===0?this:m<32?o(this.low>>>m|this.high<<32-m,this.high>>m,this.unsigned):o(this.high>>m-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(m){if(t(m)&&(m=m.toInt()),m&=63,m===0)return this;var M=this.high;if(m<32){var F=this.low;return o(F>>>m|M<<32-m,M>>>m,this.unsigned)}else return m===32?o(M,0,this.unsigned):o(M>>>m-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},C.toBytes=function(T){return T?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var T=this.high,m=this.low;return[m&255,m>>>8&255,m>>>16&255,m>>>24&255,T&255,T>>>8&255,T>>>16&255,T>>>24&255]},C.toBytesBE=function(){var T=this.high,m=this.low;return[T>>>24&255,T>>>16&255,T>>>8&255,T&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255]},e})});var zs=et((ER,mf)=>{mf.exports=globalThis.h3||{}});var va=et((FR,Tf)=>{Tf.exports=globalThis.luma});var js=et((RR,_f)=>{_f.exports=globalThis.deck});var Bf=et((LR,Ef)=>{Ef.exports=globalThis.luma});var _n=et((rL,Hf)=>{Hf.exports=globalThis.loaders});var _m=et((ZG,Tm)=>{Tm.exports=globalThis.deck});var Fm=et(ul=>{ul.read=function(e,t,n,r,s){var i,o,a=s*8-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?s-1:0,f=n?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-u)-1,d>>=-u,u+=a;u>0;i=i*256+e[t+h],h+=f,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=r;u>0;o=o*256+e[t+h],h+=f,u-=8);if(i===0)i=1-l;else{if(i===c)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-l}return(d?-1:1)*o*Math.pow(2,i-r)};ul.write=function(e,t,n,r,s,i){var o,a,c,l=i*8-s-1,u=(1<<l)-1,h=u>>1,f=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+h>=1?t+=f/c:t+=f*Math.pow(2,1-h),t*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(t*c-1)*Math.pow(2,s),o=o+h):(a=t*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;e[n+d]=a&255,d+=p,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;e[n+d]=o&255,d+=p,o/=256,l-=8);e[n+d-p]|=A*128}});var Dm=et((H4,Nm)=>{"use strict";Nm.exports=J;var Qi=Fm();function J(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var hl=(1<<16)*(1<<16),Rm=1/hl,sb=12,Om=typeof TextDecoder>"u"?null:new TextDecoder("utf8");J.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),s=r>>3,i=this.pos;this.type=r&7,e(s,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Zi(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Pm(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Zi(this.buf,this.pos)+Zi(this.buf,this.pos+4)*hl;return this.pos+=8,e},readSFixed64:function(){var e=Zi(this.buf,this.pos)+Pm(this.buf,this.pos+4)*hl;return this.pos+=8,e},readFloat:function(){var e=Qi.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Qi.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,ib(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=sb&&Om?yb(this.buf,t,e):xb(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==J.Bytes)return e.push(this.readVarint(t));var n=he(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==J.Bytes)return e.push(this.readSVarint());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==J.Bytes)return e.push(this.readBoolean());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==J.Bytes)return e.push(this.readFloat());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==J.Bytes)return e.push(this.readDouble());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed32());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed32());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed64());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed64());var t=he(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===J.Varint)for(;this.buf[this.pos++]>127;);else if(t===J.Bytes)this.pos=this.readVarint()+this.pos;else if(t===J.Fixed32)this.pos+=4;else if(t===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),kn(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),kn(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),kn(this.buf,e&-1,this.pos),kn(this.buf,Math.floor(e*Rm),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),kn(this.buf,e&-1,this.pos),kn(this.buf,Math.floor(e*Rm),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){ob(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=Tb(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Lm(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Qi.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Qi.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&Lm(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,J.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,lb,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,ub,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,db,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,hb,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,fb,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,pb,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,mb,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,gb,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Ab,t)},writeBytesField:function(e,t){this.writeTag(e,J.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,J.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,J.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,J.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function ib(e,t,n){var r=n.buf,s,i;if(i=r[n.pos++],s=(i&112)>>4,i<128||(i=r[n.pos++],s|=(i&127)<<3,i<128)||(i=r[n.pos++],s|=(i&127)<<10,i<128)||(i=r[n.pos++],s|=(i&127)<<17,i<128)||(i=r[n.pos++],s|=(i&127)<<24,i<128)||(i=r[n.pos++],s|=(i&1)<<31,i<128))return zn(e,s,t);throw new Error("Expected varint not more than 10 bytes")}function he(e){return e.type===J.Bytes?e.readVarint()+e.pos:e.pos+1}function zn(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function ob(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),ab(n,r,t),cb(r,t)}function ab(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function cb(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Lm(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var s=n.pos-1;s>=e;s--)n.buf[s+r]=n.buf[s]}function lb(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function ub(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function hb(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function fb(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function db(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function pb(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function mb(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function gb(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function Ab(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Zi(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function kn(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Pm(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function xb(e,t,n){for(var r="",s=t;s<n;){var i=e[s],o=null,a=i>239?4:i>223?3:i>191?2:1;if(s+a>n)break;var c,l,u;a===1?i<128&&(o=i):a===2?(c=e[s+1],(c&192)===128&&(o=(i&31)<<6|c&63,o<=127&&(o=null))):a===3?(c=e[s+1],l=e[s+2],(c&192)===128&&(l&192)===128&&(o=(i&15)<<12|(c&63)<<6|l&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(c=e[s+1],l=e[s+2],u=e[s+3],(c&192)===128&&(l&192)===128&&(u&192)===128&&(o=(i&15)<<18|(c&63)<<12|(l&63)<<6|u&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),s+=a}return r}function yb(e,t,n){return Om.decode(e.subarray(t,n))}function Tb(e,t,n){for(var r=0,s,i;r<t.length;r++){if(s=t.charCodeAt(r),s>55295&&s<57344)if(i)if(s<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=s;continue}else s=i-55296<<10|s-56320|65536,i=null;else{s>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=s;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);s<128?e[n++]=s:(s<2048?e[n++]=s>>6|192:(s<65536?e[n++]=s>>12|224:(e[n++]=s>>18|240,e[n++]=s>>12&63|128),e[n++]=s>>6&63|128),e[n++]=s&63|128)}return n}});var $r={};ut($r,{GeohashLayer:()=>Zr,GreatCircleLayer:()=>ar,H3ClusterLayer:()=>xr,H3HexagonLayer:()=>Je,MVTLayer:()=>Qr,QuadkeyLayer:()=>ur,S2Layer:()=>lr,TerrainLayer:()=>Gr,Tile3DLayer:()=>Or,TileLayer:()=>$t,TripsLayer:()=>mr,_GeoCellLayer:()=>It,_Tile2DHeader:()=>ze,_Tileset2D:()=>ke,_WMSLayer:()=>Ss,_getURLFromTemplate:()=>Zt});var qt={},Cl=N(Nt(),1);fe(qt,N(Nt(),1));if(!Cl.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");fe($r,qt);var He=N(Dt(),1),Ph=N(Nt(),1);function hg(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function ns(e){if(Array.isArray(e))return e.map(t=>ns(t));if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e))t[hg(n)]=ns(r);return t}return e}var ru=N(nu(),1);function mo(e,t){if(t!=null&&t._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let n={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(s,i,o,a)=>{var c;return Boolean(t==null||(c=t.arrayPaths)===null||c===void 0?void 0:c.some(u=>i===u))},...t?._fastXML},r=T0(e,n);return t!=null&&t.uncapitalizeKeys?ns(r):r}function T0(e,t){return new ru.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var _0="4.1.4",mt={name:"XML",id:"xml",module:"xml",version:_0,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:E0,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>mo(new TextDecoder().decode(e),{...mt.options.xml,...t?.xml}),parseTextSync:(e,t)=>mo(e,{...mt.options.xml,...t?.xml})};function E0(e){return e.startsWith("<?xml")}async function Ct(e,t,n,r){return r._parse(e,t,n,r)}function V(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var jt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},B0=jt.self||jt.window||jt.global||{},C0=jt.window||jt.self||jt.global||{},b0=jt.global||jt.self||jt.window||{},S0=jt.document||{};var jn=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var su=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),M0=su&&parseFloat(su[1])||0;function go(e,t){return iu(e||{},t)}function iu(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(n>3)return t;let r={...e};for(let[s,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?r[s]=iu(r[s]||{},t[s],n+1):r[s]=t[s];return r}function I0(){var e;return(e=globalThis._loadersgl_)!==null&&e!==void 0&&e.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.1.4"),globalThis._loadersgl_.version}var ou=I0();function au(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var Xt={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},IS=Xt.self||Xt.window||Xt.global||{},wS=Xt.window||Xt.self||Xt.global||{},vS=Xt.global||Xt.self||Xt.window||{},FS=Xt.document||{};var hn=typeof process!="object"||String(process)!=="[object process]"||process.browser,ss=typeof importScripts=="function",RS=typeof window<"u"&&typeof window.orientation<"u",cu=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),LS=cu&&parseFloat(cu[1])||0;var Ao={};async function Wt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return t&&(e=lu(e,t,n,r)),Ao[e]=Ao[e]||w0(e),await Ao[e]}function lu(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(!n.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=n.modules||{};return s[r]?s[r]:hn?n.CDN?(au(n.CDN.startsWith("http")),`${n.CDN}/${t}@${ou}/dist/libs/${r}`):ss?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function w0(e){if(e.endsWith("wasm"))return await F0(e);if(!hn)try{return bt&&bt.requireFromFile&&await bt.requireFromFile(e)}catch(n){return console.error(n),null}if(ss)return importScripts(e);let t=await R0(e);return v0(t,e)}function v0(e,t){if(!hn)return bt.requireFromString&&bt.requireFromString(e,t);if(ss)return eval.call(globalThis,e),null;let n=document.createElement("script");n.id=t;try{n.appendChild(document.createTextNode(e))}catch{n.text=e}return document.body.appendChild(n),null}async function F0(e){return hn||!bt.readFileAsArrayBuffer||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await bt.readFileAsArrayBuffer(e)}async function R0(e){return hn||!bt.readFileAsText||e.startsWith("http")?await(await fetch(e)).text():await bt.readFileAsText(e)}function hu(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?uu(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?uu(e,0,t):""}function uu(e,t,n){if(e.byteLength<=t+n)return"";let r=new DataView(e),s="";for(let i=0;i<n;i++)s+=String.fromCharCode(r.getUint8(t+i));return s}function xo(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${hu(e)}"`)}}function Xn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r=t,s=r&&r.length>1&&r[0].constructor||null;if(!s)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=r.reduce((c,l)=>c+l.length,0),o=new s(i),a=0;for(let c of r)o.set(c,a),a+=c.length;return o}function Re(e,t,n){let r=n!==void 0?new Uint8Array(e).subarray(t,t+n):new Uint8Array(e).subarray(t);return new Uint8Array(r).buffer}function pe(e,t){return V(e>=0),V(t>0),e+(t-1)&~(t-1)}function yo(e,t,n){let r;if(e instanceof ArrayBuffer)r=new Uint8Array(e);else{let s=e.byteOffset,i=e.byteLength;r=new Uint8Array(e.buffer||e.arrayBuffer,s,i)}return t.set(r,n),n+pe(r.byteLength,4)}function Wn(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Le=class{constructor(t,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Wn(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Wn()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var me=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,s=this.stats[n];return s||(t instanceof Le?s=t:s=new Le(n,r),this.stats[n]=s),s}};var L0="Queued Requests",P0="Active Requests",O0="Cancelled Requests",N0="Queued Requests Ever",D0="Active Requests Ever",U0={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},ge=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.props=void 0,this.stats=void 0,this.activeRequestCount=0,this.requestQueue=[],this.requestMap=new Map,this.updateTimer=null,this.props={...U0,...t},this.stats=new me({id:this.props.id}),this.stats.get(L0),this.stats.get(P0),this.stats.get(O0),this.stats.get(N0),this.stats.get(D0)}scheduleRequest(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let r={handle:t,priority:0,getPriority:n},s=new Promise(i=>(r.resolve=i,r));return this.requestQueue.push(r),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:n,resolve:r}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(n),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let n=0;n<t;++n){let r=this.requestQueue.shift();r&&this._issueRequest(r)}}}_updateAllRequests(){let t=this.requestQueue;for(let n=0;n<t.length;++n){let r=t[n];this._updateRequest(r)||(t.splice(n,1),this.requestMap.delete(r.handle),n--)}t.sort((n,r)=>n.priority-r.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Ae={};ut(Ae,{dirname:()=>V0,filename:()=>G0,join:()=>H0,resolve:()=>z0});function fu(){var e;if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=(e=window.location)===null||e===void 0?void 0:e.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function G0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function V0(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function H0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];let r="/";return t=t.map((s,i)=>(i&&(s=s.replace(new RegExp(`^${r}`),"")),i!==t.length-1&&(s=s.replace(new RegExp(`${r}$`),"")),s)),t.join(r)}function z0(){let e=[];for(let s=0;s<arguments.length;s++)e[s]=s<0||arguments.length<=s?void 0:arguments[s];let t="",n=!1,r;for(let s=e.length-1;s>=-1&&!n;s--){let i;s>=0?i=e[s]:(r===void 0&&(r=fu()),i=r),i.length!==0&&(t=`${i}/${t}`,n=i.charCodeAt(0)===Yn)}return t=k0(t,!n),n?`/${t}`:t.length>0?t:"."}var Yn=47,To=46;function k0(e,t){let n="",r=-1,s=0,i,o=!1;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(i===Yn)break;i=Yn}if(i===Yn){if(!(r===a-1||s===1))if(r!==a-1&&s===2){if(n.length<2||!o||n.charCodeAt(n.length-1)!==To||n.charCodeAt(n.length-2)!==To){if(n.length>2){let c=n.length-1,l=c;for(;l>=0&&n.charCodeAt(l)!==Yn;--l);if(l!==c){n=l===-1?"":n.slice(0,l),r=a,s=0,o=!1;continue}}else if(n.length===2||n.length===1){n="",r=a,s=0,o=!1;continue}}t&&(n.length>0?n+="/..":n="..",o=!0)}else{let c=e.slice(r+1,a);n.length>0?n+=`/${c}`:n=c,o=!1}r=a,s=0}else i===To&&s!==-1?++s:s=-1}return n}var is=class{constructor(t){this.data=void 0,this.fetch=void 0,this.loadOptions=void 0,this._needsRefresh=!0,this.props=void 0,this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=J0(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function J0(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,s)=>t(r,s);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var vt=class extends is{};vt.type="template";vt.testURL=e=>!1;function du(e,t){var n,r,s;let i=(n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t),o=(i==null||(r=i.ServiceExceptionReport)===null||r===void 0?void 0:r.ServiceException)||(i==null||(s=i["ogc:ServiceExceptionReport"])===null||s===void 0?void 0:s["ogc:ServiceException"]);return typeof o=="string"?o:o.value||o.code||"Unknown error"}var q0="4.1.4",Pe={id:"wms-error",name:"WMS Error",module:"wms",version:q0,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:j0,options:{wms:{throwOnError:!1}},parse:async(e,t)=>_o(new TextDecoder().decode(e),t),parseSync:(e,t)=>_o(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>_o(e,t)};function j0(e){return e.startsWith("<?xml")}function _o(e,t){let n={...Pe.options.wms,...t?.wms},r=du(e,n),s=n.minimalErrors?r:`WMS Service error: ${r}`;if(n.throwOnError)throw new Error(s);return s}function Oe(e){return Array.isArray(e)?e:e?[e]:[]}function Kn(e){let t=Oe(e);return t.length>0&&t.every(n=>typeof n=="string")?t:[]}function Qn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseFloat(e);default:return}}function os(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;switch(typeof e){case"number":return e;case"string":return parseInt(e,10);default:return}}function Ne(e){switch(e){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function Eo(e,t){var n;let r=(n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t),s=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,i=X0(s);if(t!=null&&t.inheritedLayerProps)for(let o of i.layers)mu(o,null);return t!=null&&t.includeRawJSON&&(i.json=s),t!=null&&t.includeXMLText&&(i.xml=e),i}function X0(e){var t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g;let y={version:String(e.version||""),name:String(((t=e.Service)===null||t===void 0?void 0:t.Name)||"unnamed"),title:(n=e.Service)!==null&&n!==void 0&&n.Title?String((r=e.Service)===null||r===void 0?void 0:r.Title):void 0,abstract:(s=e.Service)!==null&&s!==void 0&&s.Abstract?String((i=e.Service)===null||i===void 0?void 0:i.Abstract):void 0,keywords:Kn((o=e.Service)===null||o===void 0||(a=o.KeywordList)===null||a===void 0?void 0:a.Keyword),fees:(c=e.Service)!==null&&c!==void 0&&c.Fees?JSON.stringify((l=e.Service)===null||l===void 0?void 0:l.Fees):void 0,accessConstraints:(u=e.Service)!==null&&u!==void 0&&u.AccessConstraints?JSON.stringify((h=e.Service)===null||h===void 0?void 0:h.AccessConstraints):void 0,layerLimit:os((f=e.Service)===null||f===void 0?void 0:f.LayerLimit),maxWidth:os((d=e.Service)===null||d===void 0?void 0:d.maxWidth),maxHeight:os((p=e.Service)===null||p===void 0?void 0:p.maxHeight),layers:[],requests:W0((A=e.Capability)===null||A===void 0?void 0:A.Request),exceptions:Y0(e.Exception)},E=Oe((g=e.Capability)===null||g===void 0?void 0:g.Layer);for(let _ of E)y.layers.push(pu(_));for(let[_,B]of Object.entries(y))B===void 0&&delete y[_];return y}function W0(e){let t={};for(let[n,r]of Object.entries(e||{})){let s=Kn(r?.Format);t[n]={mimeTypes:s}}return t}function Y0(e){if(Oe(e?.Format).length>0)return{mimeTypes:Kn(e)}}function pu(e){var t;let n={title:String(e?.Title||""),name:e?.Name&&String(e?.Name),abstract:e?.Name&&String(e?.Abstract),keywords:Kn((t=e.KeywordList)===null||t===void 0?void 0:t.Keyword)},r=e?.CRS||e?.SRS;r&&Array.isArray(r)&&r.every(u=>typeof u=="string")&&(n.crs=r);let s=e?.EX_GeographicBoundingBox&&K0(e?.EX_GeographicBoundingBox);s&&(n.geographicBoundingBox=s),s=e?.LatLonBoundingBox&&Q0(e?.LatLonBoundingBox),s&&(n.geographicBoundingBox=s);let i=e?.BoundingBox&&Z0(e?.BoundingBox);i&&i.length>0&&(n.boundingBoxes=i);let a=Oe(e?.Dimension).map(u=>tA(u));a.length&&(n.dimensions=a),e!=null&&e.opaque&&(n.opaque=Ne(e?.opaque)),e!=null&&e.cascaded&&(n.cascaded=Ne(e?.cascaded)),e!=null&&e.queryable&&(n.queryable=Ne(e?.queryable));let c=Oe(e?.Layer),l=[];for(let u of c)l.push(pu(u));l.length>0&&(n.layers=l);for(let[u,h]of Object.entries(n))h===void 0&&delete n[u];return n}function K0(e){let{westBoundLongitude:t,northBoundLatitude:n,eastBoundLongitude:r,southBoundLatitude:s}=e;return[[t,s],[r,n]]}function Q0(e){let{minx:t,miny:n,maxx:r,maxy:s}=e;return[[t,n],[r,s]]}function Z0(e){return Oe(e).map(n=>$0(n))}function $0(e){let{CRS:t,SRS:n,minx:r,miny:s,maxx:i,maxy:o,resx:a,resy:c}=e,l={crs:t||n,boundingBox:[[Qn(r),Qn(s)],[Qn(i),Qn(o)]]};return a&&(l.xResolution=a),c&&(l.yResolution=c),l}function tA(e){let{name:t,units:n,value:r}=e,s={name:t,units:n,extent:r};return e.unitSymbol&&(s.unitSymbol=e.unitSymbol),e.default&&(s.defaultValue=e.default),e.multipleValues&&(s.multipleValues=Ne(e.multipleValues)),e.nearestValue&&(s.nearestValue=Ne(e.nearestValue)),e.current&&(s.current=Ne(e.current)),s}function mu(e,t){t!=null&&t.geographicBoundingBox&&!e.geographicBoundingBox&&(e.geographicBoundingBox=[...t.geographicBoundingBox]),t!=null&&t.crs&&!e.crs&&(e.crs=[...t.crs]),t!=null&&t.boundingBoxes&&!e.boundingBoxes&&(e.boundingBoxes=[...t.boundingBoxes]),t!=null&&t.dimensions&&!e.dimensions&&(e.dimensions=[...t.dimensions]);for(let n of e.layers||[])mu(n,e)}var eA="4.1.4",fn={id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:eA,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:nA,options:{wms:{}},parse:async(e,t)=>Eo(new TextDecoder().decode(e),t?.wms),parseTextSync:(e,t)=>Eo(e,t?.wms)};function nA(e){return e.startsWith("<?xml")}function Bo(e,t){var n,r;let i=((r=((n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t)).FeatureInfoResponse)===null||r===void 0?void 0:r.FIELDS)||[];return{features:(Array.isArray(i)?i:[i]).map(a=>rA(a))}}function rA(e){return{attributes:e||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var gu={...fn,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(e,t)=>Bo(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Bo(e,t)};function Co(e,t){var n;return(n=mt.parseTextSync)===null||n===void 0?void 0:n.call(mt,e,t)}var Au={...fn,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(e,t)=>Co(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Co(e,t)};function xu(e,t){let{type:n="auto"}=e,r=n==="auto"?iA(e.url,t):sA(n,t);if(!r)throw new Error("Not a valid image source type");return r.create(e)}function sA(e,t){for(let n of t)if(n.type===e)return n;return null}function iA(e,t){for(let n of t)if(n.testURL&&n.testURL(e))return n;return null}var yu="4.1.4";var bo,oA=(bo=globalThis.loaders)===null||bo===void 0?void 0:bo.parseImageNode,So=typeof Image<"u",Mo=typeof ImageBitmap<"u",aA=Boolean(oA),Io=jn?!0:aA;function Tu(e){switch(e){case"auto":return Mo||So||Io;case"imagebitmap":return Mo;case"image":return So;case"data":return Io;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function _u(){if(Mo)return"imagebitmap";if(So)return"image";if(Io)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Eu(e){let t=cA(e);if(!t)throw new Error("Not an image");return t}function Zn(e){switch(Eu(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function cA(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var lA=/^data:image\/svg\+xml/,uA=/\.svg((\?|#).*)?$/;function as(e){return e&&(lA.test(e)||uA.test(e))}function Bu(e,t){if(as(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return wo(e,t)}function wo(e,t){if(as(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function cs(e,t,n){let r=Bu(e,n),s=self.URL||self.webkitURL,i=typeof r!="string"&&s.createObjectURL(r);try{return await hA(i||r,t)}finally{i&&s.revokeObjectURL(i)}}async function hA(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,s)=>{try{n.onload=()=>r(n),n.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var fA={},Cu=!0;async function bu(e,t,n){let r;as(n)?r=await cs(e,t,n):r=wo(e,n);let s=t&&t.imagebitmap;return await dA(r,s)}async function dA(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((pA(t)||!Cu)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),Cu=!1}return await createImageBitmap(e)}function pA(e){for(let t in e||fA)return!1;return!0}function Su(e){return!xA(e,"ftyp",4)||!(e[8]&96)?null:mA(e)}function mA(e){switch(gA(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function gA(e,t,n){return String.fromCharCode(...e.slice(t,n))}function AA(e){return[...e].map(t=>t.charCodeAt(0))}function xA(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=AA(t);for(let s=0;s<r.length;++s)if(r[s]!==e[s+n])return!1;return!0}var Yt=!1,$n=!0;function De(e){let t=tr(e);return TA(t)||BA(t)||_A(t)||EA(t)||yA(t)}function yA(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=Su(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function TA(e){let t=tr(e);return t.byteLength>=24&&t.getUint32(0,Yt)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Yt),height:t.getUint32(20,Yt)}:null}function _A(e){let t=tr(e);return t.byteLength>=10&&t.getUint32(0,Yt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,$n),height:t.getUint16(8,$n)}:null}function EA(e){let t=tr(e);return t.byteLength>=14&&t.getUint16(0,Yt)===16973&&t.getUint32(2,$n)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,$n),height:t.getUint32(22,$n)}:null}function BA(e){let t=tr(e);if(!(t.byteLength>=3&&t.getUint16(0,Yt)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=CA(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,Yt);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,Yt),width:t.getUint16(i+7,Yt)};if(!r.has(o))return null;i+=2,i+=t.getUint16(i,Yt)}return null}function CA(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function tr(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function Mu(e,t){var n;let{mimeType:r}=De(e)||{},s=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return V(s),await s(e,r)}async function Iu(e,t,n){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=n||{},o=bA(s),a;switch(o){case"imagebitmap":a=await bu(e,t,i);break;case"image":a=await cs(e,t,i);break;case"data":a=await Mu(e,t);break;default:V(!1)}return s==="data"&&(a=Zn(a)),a}function bA(e){switch(e){case"auto":case"data":return _u();default:return Tu(e),e}}var SA=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],MA=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],IA={image:{type:"auto",decode:!0}},xe={id:"image",module:"images",name:"Images",version:yu,mimeTypes:MA,extensions:SA,parse:Iu,tests:[e=>Boolean(De(new DataView(e)))],options:IA};var vo={};function Fo(e){if(vo[e]===void 0){let t=jn?vA(e):wA(e);vo[e]=t}return vo[e]}function wA(e){var t,n;let r=["image/png","image/jpeg","image/gif"],s=((t=globalThis.loaders)===null||t===void 0?void 0:t.imageFormatsNode)||r,i=(n=globalThis.loaders)===null||n===void 0?void 0:n.parseImageNode;return Boolean(i)&&s.includes(e)}function vA(e){switch(e){case"image/avif":case"image/webp":return FA(e);default:return!0}}function FA(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}var wu={type:"wms",testURL:e=>e.toLowerCase().includes("wms"),create:e=>new Ro(e)},Ro=class extends vt{constructor(t){var n;super(t),this.url=void 0,this.data=void 0,this.substituteCRS84=void 0,this.flipCRS=void 0,this.wmsParameters=void 0,this.vendorParameters=void 0,this.capabilities=null,this.url=t.url,this.data=t.url,this.substituteCRS84=(n=t.substituteCRS84)!==null&&n!==void 0?n:!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...t.wmsParameters},this.vendorParameters=t.vendorParameters||{}}async getMetadata(){let t=await this.getCapabilities();return this.normalizeMetadata(t)}async getImage(t){let{boundingBox:n,bbox:r,...s}=t,i={bbox:n?[...n[0],...n[1]]:r,...s};return await this.getMap(i)}normalizeMetadata(t){return t}async getCapabilities(t,n){let r=this.getCapabilitiesURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);let o=await fn.parse(i,this.loadOptions);return this.capabilities=o,o}async getMap(t,n){let r=this.getMapURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await xe.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}async getFeatureInfo(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await gu.parse(i,this.loadOptions)}async getFeatureInfoText(t,n){let r=this.getFeatureInfoURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),new TextDecoder().decode(i)}async describeLayer(t,n){let r=this.describeLayerURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();return this._checkResponse(s,i),await Au.parse(i,this.loadOptions)}async getLegendGraphic(t,n){let r=this.getLegendGraphicURL(t,n),s=await this.fetch(r),i=await s.arrayBuffer();this._checkResponse(s,i);try{return await xe.parse(i,this.loadOptions)}catch{throw this._parseError(i)}}getCapabilitiesURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetCapabilities",r,n)}getMapURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetMap",r,n)}getFeatureInfoURL(t,n){t=this._getWMS130Parameters(t);let r={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...t};return this._getWMSUrl("GetFeatureInfo",r,n)}describeLayerURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("DescribeLayer",r,n)}getLegendGraphicURL(t,n){let r={version:this.wmsParameters.version,...t};return this._getWMSUrl("GetLegendGraphic",r,n)}_parseWMSUrl(t){let[n,r]=t.split("?"),s=r.split("&"),i={};for(let o of s){let[a,c]=o.split("=");i[a]=c}return{url:n,parameters:i}}_getWMSUrl(t,n,r){let s=this.url,i=!0,o={service:"WMS",version:n.version,request:t,...n,...this.vendorParameters,...r},a=["transparent","time","elevation"];for(let[c,l]of Object.entries(o))(!a.includes(c)||l)&&(s+=i?"?":"&",i=!1,s+=this._getURLParameter(c,l,n));return encodeURI(s)}_getWMS130Parameters(t){let n={...t};return n.srs&&(n.crs=n.crs||n.srs,delete n.srs),n}_getURLParameter(t,n,r){switch(t){case"crs":r.version!=="1.3.0"?t="srs":this.substituteCRS84&&n==="EPSG:4326"&&(n="CRS:84");break;case"srs":r.version==="1.3.0"&&(t="crs");break;case"bbox":let s=this._flipBoundingBox(n,r);s&&(n=s);break;default:}return t=t.toUpperCase(),Array.isArray(n)?`${t}=${n.join(",")}`:`${t}=${n?String(n):""}`}_flipBoundingBox(t,n){if(!Array.isArray(t)||t.length!==4)return null;let r=n.version==="1.3.0"&&this.flipCRS.includes(n.crs||"")&&!(this.substituteCRS84&&n.crs==="EPSG:4326"),s=t;return r?[s[1],s[0],s[3],s[2]]:s}async _fetchArrayBuffer(t){let n=await this.fetch(t),r=await n.arrayBuffer();return this._checkResponse(n,r),r}_checkResponse(t,n){let r=t.headers["content-type"];if(!t.ok||Pe.mimeTypes.includes(r)){var s;let i=go(this.loadOptions,{wms:{throwOnError:!0}}),o=(s=Pe.parseSync)===null||s===void 0?void 0:s.call(Pe,n,i);throw new Error(o)}}_parseError(t){var n;let r=(n=Pe.parseSync)===null||n===void 0?void 0:n.call(Pe,t,this.loadOptions);return new Error(r)}};var dn=class extends vt{constructor(t){super(t)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(t){let n=this.getGranularParameters(t),r=this.getURLFromTemplate(n),i=await(await this.fetch(r)).arrayBuffer();return await xe.parse(i)}getGranularParameters(t){let[[n,r],[s,i]]=t.boundingBox;return{...t,east:n,north:r,south:i,west:s}}getURLFromTemplate(t){let n=this.props.url;for(let[r,s]of Object.entries(t))n=n.replace(`\${${r}}`,String(s)),n=n.replace(`{${r}}`,String(s));return n}};dn.type="template";dn.testURL=e=>e.toLowerCase().includes("{");var Lo=class extends dn{constructor(t){super(t),this.data=void 0,this.data=t.url}async getMetadata(){return await this.metadata()}async getImage(t){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(t){throw new Error("not implemented")}metadataURL(t){return`${this.props.url}?f=pjson`}exportImageURL(t){let n=`bbox=${t.bbox[0]},${t.bbox[1]},${t.bbox[2]},${t.bbox[3]}`,r=`size=${t.width},${t.height}`,s={...t,bbox:n,size:r};return delete s.width,delete s.height,this.getUrl("exportImage",s)}getUrl(t,n,r){let s=`${this.props.url}/${t}`,i=!0;for(let[o,a]of Object.entries(n))s+=i?"?":"&",i=!1,Array.isArray(a)?s+=`${o.toUpperCase()}=${a.join(",")}`:s+=`${o.toUpperCase()}=${a?String(a):""}`;return s}async checkResponse(t){if(!t.ok)throw new Error("error")}},vu={type:"arcgis-image-server",testURL:e=>e.toLowerCase().includes("ImageServer"),create:e=>new Lo(e)};var RA=[wu,vu];function Po(e){return xu(e,RA)}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var LA=1/Math.PI*180,PA=1/180*Math.PI,OA={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...OA}};var K=globalThis.mathgl.config;function Oo(e,{precision:t=K.precision}={}){return e=NA(e),"".concat(parseFloat(e.toPrecision(t)))}function St(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function No(e){return Fu(e)}function Do(e){return Mt(e)}function Fu(e,t){return Uo(e,n=>n*PA,t)}function Mt(e,t){return Uo(e,n=>n*LA,t)}function ls(e,t,n){return Uo(e,r=>Math.max(t,Math.min(n,r)))}function ye(e,t,n){return St(e)?e.map((r,s)=>ye(r,t[s],n)):n*t+(1-n)*e}function gt(e,t,n){let r=K.EPSILON;n&&(K.EPSILON=n);try{if(e===t)return!0;if(St(e)&&St(t)){if(e.length!==t.length)return!1;for(let s=0;s<e.length;++s)if(!gt(e[s],t[s]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=K.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{K.EPSILON=r}}function NA(e){return Math.round(e/K.EPSILON)*K.EPSILON}function DA(e){return e.clone?e.clone():new Array(e.length)}function Uo(e,t,n){if(St(e)){let r=e;n=n||DA(r);for(let s=0;s<n.length&&s<r.length;++s){let i=typeof e=="number"?e:e[s];n[s]=t(i,s,n)}return n}return t(e)}function UA(e){function t(){var n=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(n,Object.getPrototypeOf(this)),n}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}var Te=class extends UA(Array){clone(){return new this.constructor().copy(this)}fromArray(t,n=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+n];return this.check()}toArray(t=[],n=0){for(let r=0;r<this.ELEMENTS;++r)t[n+r]=this[r];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:St(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(K)}formatString(t){let n="";for(let r=0;r<this.ELEMENTS;++r)n+=(r>0?", ":"")+Oo(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(n,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(!gt(this[n],t[n]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let n=0;n<this.ELEMENTS;++n)if(this[n]!==t[n])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,n,r){if(r===void 0)return this.lerp(this,t,n);for(let s=0;s<this.ELEMENTS;++s){let i=t[s],o=typeof n=="number"?n:n[s];this[s]=i+r*(o-i)}return this.check()}min(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(t[n],this[n]);return this.check()}max(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.max(t[n],this[n]);return this.check()}clamp(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),n[r]);return this.check()}add(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]+=n[r];return this.check()}subtract(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]-=n[r];return this.check()}scale(t){if(typeof t=="number")for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;else for(let n=0;n<this.ELEMENTS&&n<t.length;++n)this[n]*=t[n];return this.check()}multiplyByScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}check(){if(K.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let n=0;n<this.ELEMENTS;++n)t=t&&Number.isFinite(this[n]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]=t;return this.check()}addScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let n=0;n<this.ELEMENTS;++n)this[n]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,n){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),n);return this.check()}get elements(){return this}};function GA(e,t){if(e.length!==t)return!1;for(let n=0;n<e.length;++n)if(!Number.isFinite(e[n]))return!1;return!0}function G(e){if(!Number.isFinite(e))throw new Error("Invalid number ".concat(JSON.stringify(e)));return e}function _e(e,t,n=""){if(K.debug&&!GA(e,t))throw new Error("math.gl: ".concat(n," some fields set to invalid numbers'"));return e}function ct(e,t){if(!e)throw new Error("math.gl assertion ".concat(t))}var Ee=class extends Te{get x(){return this[0]}set x(t){this[0]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let n=0;n<this.ELEMENTS;++n)t+=this[n]*this[n];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let n=0;for(let r=0;r<this.ELEMENTS;++r){let s=this[r]-t[r];n+=s*s}return G(n)}dot(t){let n=0;for(let r=0;r<this.ELEMENTS;++r)n+=this[r]*t[r];return G(n)}normalize(){let t=this.magnitude();if(t!==0)for(let n=0;n<this.ELEMENTS;++n)this[n]/=t;return this.check()}multiply(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]*=n[r];return this.check()}divide(...t){for(let n of t)for(let r=0;r<this.ELEMENTS;++r)this[r]/=n[r];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return ct(t>=0&&t<this.ELEMENTS,"index is out of range"),G(this[t])}setComponent(t,n){return ct(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=n,this.check()}addVectors(t,n){return this.copy(t).add(n)}subVectors(t,n){return this.copy(t).subtract(n)}multiplyVectors(t,n){return this.copy(t).multiply(n)}addScaledVector(t,n){return this.add(new this.constructor(t).multiplyScalar(n))}};var $=typeof Float32Array<"u"?Float32Array:Array,er=Math.random;function pn(e){return e>=0?Math.round(e):e%.5===0?Math.floor(e):Math.round(e)}var c2=Math.PI/180;function VA(){let e=new $(2);return $!=Float32Array&&(e[0]=0,e[1]=0),e}function Ru(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e}function Lu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s+n[4],e[1]=n[1]*r+n[3]*s+n[5],e}function us(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[3]*s+n[6],e[1]=n[1]*r+n[4]*s+n[7],e}function hs(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[4]*s+n[12],e[1]=n[1]*r+n[5]*s+n[13],e}var l2=function(){let e=VA();return function(t,n,r,s,i,o){let a,c;for(n||(n=2),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],i(e,e,o),t[a]=e[0],t[a+1]=e[1];return t}}();function fs(e,t,n){let r=t[0],s=t[1],i=n[3]*r+n[7]*s||1;return e[0]=(n[0]*r+n[4]*s)/i,e[1]=(n[1]*r+n[5]*s)/i,e}function ds(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i||1;return e[0]=(n[0]*r+n[4]*s+n[8]*i)/o,e[1]=(n[1]*r+n[5]*s+n[9]*i)/o,e[2]=(n[2]*r+n[6]*s+n[10]*i)/o,e}function Pu(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e}function Ou(e,t,n){let r=t[0],s=t[1];return e[0]=n[0]*r+n[2]*s,e[1]=n[1]*r+n[3]*s,e[2]=t[2],e[3]=t[3],e}function ps(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=n[0]*r+n[3]*s+n[6]*i,e[1]=n[1]*r+n[4]*s+n[7]*i,e[2]=n[2]*r+n[5]*s+n[8]*i,e[3]=t[3],e}var Ue=class extends Ee{constructor(t=0,n=0){super(2),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(n)),this[0]=t,this[1]=n)}set(t,n){return this[0]=t,this[1]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return K.debug&&(G(t.x),G(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return hs(this,this,t),this.check()}transformAsVector(t){return fs(this,this,t),this.check()}transformByMatrix3(t){return us(this,this,t),this.check()}transformByMatrix2x3(t){return Lu(this,this,t),this.check()}transformByMatrix2(t){return Ru(this,this,t),this.check()}};var gn={};ut(gn,{add:()=>JA,angle:()=>ko,bezier:()=>r1,ceil:()=>qA,clone:()=>HA,copy:()=>zA,create:()=>ms,cross:()=>Ge,dist:()=>f1,distance:()=>Vu,div:()=>h1,divide:()=>Gu,dot:()=>nr,equals:()=>c1,exactEquals:()=>a1,floor:()=>jA,forEach:()=>m1,fromValues:()=>gs,hermite:()=>n1,inverse:()=>$A,len:()=>Jo,length:()=>Nu,lerp:()=>t1,max:()=>WA,min:()=>XA,mul:()=>u1,multiply:()=>Uu,negate:()=>ZA,normalize:()=>Go,random:()=>s1,rotateX:()=>Vo,rotateY:()=>Ho,rotateZ:()=>zo,round:()=>YA,scale:()=>KA,scaleAndAdd:()=>QA,set:()=>kA,slerp:()=>e1,sqrDist:()=>d1,sqrLen:()=>p1,squaredDistance:()=>Hu,squaredLength:()=>zu,str:()=>o1,sub:()=>l1,subtract:()=>Du,transformMat3:()=>rr,transformMat4:()=>Ve,transformQuat:()=>sr,zero:()=>i1});function ms(){let e=new $(3);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function HA(e){let t=new $(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Nu(e){let t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function gs(e,t,n){let r=new $(3);return r[0]=e,r[1]=t,r[2]=n,r}function zA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function kA(e,t,n,r){return e[0]=t,e[1]=n,e[2]=r,e}function JA(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function Du(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function Uu(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e}function Gu(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e[2]=t[2]/n[2],e}function qA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function jA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function XA(e,t,n){return e[0]=Math.min(t[0],n[0]),e[1]=Math.min(t[1],n[1]),e[2]=Math.min(t[2],n[2]),e}function WA(e,t,n){return e[0]=Math.max(t[0],n[0]),e[1]=Math.max(t[1],n[1]),e[2]=Math.max(t[2],n[2]),e}function YA(e,t){return e[0]=pn(t[0]),e[1]=pn(t[1]),e[2]=pn(t[2]),e}function KA(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function QA(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e}function Vu(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return Math.sqrt(n*n+r*r+s*s)}function Hu(e,t){let n=t[0]-e[0],r=t[1]-e[1],s=t[2]-e[2];return n*n+r*r+s*s}function zu(e){let t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r}function ZA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function $A(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function Go(e,t){let n=t[0],r=t[1],s=t[2],i=n*n+r*r+s*s;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function nr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ge(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2];return e[0]=s*c-i*a,e[1]=i*o-r*c,e[2]=r*a-s*o,e}function t1(e,t,n,r){let s=t[0],i=t[1],o=t[2];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e}function e1(e,t,n,r){let s=Math.acos(Math.min(Math.max(nr(t,n),-1),1)),i=Math.sin(s),o=Math.sin((1-r)*s)/i,a=Math.sin(r*s)/i;return e[0]=o*t[0]+a*n[0],e[1]=o*t[1]+a*n[1],e[2]=o*t[2]+a*n[2],e}function n1(e,t,n,r,s,i){let o=i*i,a=o*(2*i-3)+1,c=o*(i-2)+i,l=o*(i-1),u=o*(3-2*i);return e[0]=t[0]*a+n[0]*c+r[0]*l+s[0]*u,e[1]=t[1]*a+n[1]*c+r[1]*l+s[1]*u,e[2]=t[2]*a+n[2]*c+r[2]*l+s[2]*u,e}function r1(e,t,n,r,s,i){let o=1-i,a=o*o,c=i*i,l=a*o,u=3*i*a,h=3*c*o,f=c*i;return e[0]=t[0]*l+n[0]*u+r[0]*h+s[0]*f,e[1]=t[1]*l+n[1]*u+r[1]*h+s[1]*f,e[2]=t[2]*l+n[2]*u+r[2]*h+s[2]*f,e}function s1(e,t){t=t===void 0?1:t;let n=er()*2*Math.PI,r=er()*2-1,s=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(n)*s,e[1]=Math.sin(n)*s,e[2]=r*t,e}function Ve(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[3]*r+n[7]*s+n[11]*i+n[15];return o=o||1,e[0]=(n[0]*r+n[4]*s+n[8]*i+n[12])/o,e[1]=(n[1]*r+n[5]*s+n[9]*i+n[13])/o,e[2]=(n[2]*r+n[6]*s+n[10]*i+n[14])/o,e}function rr(e,t,n){let r=t[0],s=t[1],i=t[2];return e[0]=r*n[0]+s*n[3]+i*n[6],e[1]=r*n[1]+s*n[4]+i*n[7],e[2]=r*n[2]+s*n[5]+i*n[8],e}function sr(e,t,n){let r=n[0],s=n[1],i=n[2],o=n[3],a=t[0],c=t[1],l=t[2],u=s*l-i*c,h=i*a-r*l,f=r*c-s*a,d=s*f-i*h,p=i*u-r*f,A=r*h-s*u,g=o*2;return u*=g,h*=g,f*=g,d*=2,p*=2,A*=2,e[0]=a+u+d,e[1]=c+h+p,e[2]=l+f+A,e}function Vo(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0],i[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),i[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function Ho(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),i[1]=s[1],i[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function zo(e,t,n,r){let s=[],i=[];return s[0]=t[0]-n[0],s[1]=t[1]-n[1],s[2]=t[2]-n[2],i[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),i[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),i[2]=s[2],e[0]=i[0]+n[0],e[1]=i[1]+n[1],e[2]=i[2]+n[2],e}function ko(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2],c=Math.sqrt((n*n+r*r+s*s)*(i*i+o*o+a*a)),l=c&&nr(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}function i1(e){return e[0]=0,e[1]=0,e[2]=0,e}function o1(e){return"vec3(".concat(e[0],", ").concat(e[1],", ").concat(e[2],")")}function a1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function c1(e,t){let n=e[0],r=e[1],s=e[2],i=t[0],o=t[1],a=t[2];return Math.abs(n-i)<=1e-6*Math.max(1,Math.abs(n),Math.abs(i))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-a)<=1e-6*Math.max(1,Math.abs(s),Math.abs(a))}var l1=Du,u1=Uu,h1=Gu,f1=Vu,d1=Hu,Jo=Nu,p1=zu,m1=function(){let e=ms();return function(t,n,r,s,i,o){let a,c;for(n||(n=3),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2];return t}}();var qo=[0,0,0],As,x=class extends Ee{static get ZERO(){return As||(As=new x(0,0,0),Object.freeze(As)),As}constructor(t=0,n=0,r=0){super(-0,-0,-0),arguments.length===1&&St(t)?this.copy(t):(K.debug&&(G(t),G(n),G(r)),this[0]=t,this[1]=n,this[2]=r)}set(t,n,r){return this[0]=t,this[1]=n,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return K.debug&&(G(t.x),G(t.y),G(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=G(t)}angle(t){return ko(this,t)}cross(t){return Ge(this,this,t),this.check()}rotateX({radians:t,origin:n=qo}){return Vo(this,this,n,t),this.check()}rotateY({radians:t,origin:n=qo}){return Ho(this,this,n,t),this.check()}rotateZ({radians:t,origin:n=qo}){return zo(this,this,n,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ve(this,this,t),this.check()}transformAsVector(t){return ds(this,this,t),this.check()}transformByMatrix3(t){return rr(this,this,t),this.check()}transformByMatrix2(t){return Pu(this,this,t),this.check()}transformByQuaternion(t){return sr(this,this,t),this.check()}};var xs,An=class extends Ee{static get ZERO(){return xs||(xs=new An(0,0,0,0),Object.freeze(xs)),xs}constructor(t=0,n=0,r=0,s=0){super(-0,-0,-0,-0),St(t)&&arguments.length===1?this.copy(t):(K.debug&&(G(t),G(n),G(r),G(s)),this[0]=t,this[1]=n,this[2]=r,this[3]=s)}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return K.debug&&(G(t.x),G(t.y),G(t.z),G(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}transform(t){return Ve(this,this,t),this.check()}transformByMatrix3(t){return ps(this,this,t),this.check()}transformByMatrix2(t){return Ou(this,this,t),this.check()}transformByQuaternion(t){return sr(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}};var xn=class extends Te{toString(){let t="[";if(K.printRowMajor){t+="row-major:";for(let n=0;n<this.RANK;++n)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+n])}else{t+="column-major:";for(let n=0;n<this.ELEMENTS;++n)t+=" ".concat(this[n])}return t+="]",t}getElementIndex(t,n){return n*this.RANK+t}getElement(t,n){return this[n*this.RANK+t]}setElement(t,n,r){return this[n*this.RANK+t]=G(r),this}getColumn(t,n=new Array(this.RANK).fill(-0)){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)n[s]=this[r+s];return n}setColumn(t,n){let r=t*this.RANK;for(let s=0;s<this.RANK;++s)this[r+s]=n[s];return this}};function ku(){let e=new $(9);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Ju(e,t){if(e===t){let n=t[1],r=t[2],s=t[5];e[1]=t[3],e[2]=t[6],e[3]=n,e[5]=t[7],e[6]=r,e[7]=s}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function qu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=u*o-a*l,f=-u*i+a*c,d=l*i-o*c,p=n*h+r*f+s*d;return p?(p=1/p,e[0]=h*p,e[1]=(-u*r+s*l)*p,e[2]=(a*r-s*o)*p,e[3]=f*p,e[4]=(u*n-s*c)*p,e[5]=(-a*n+s*i)*p,e[6]=d*p,e[7]=(-l*n+r*c)*p,e[8]=(o*n-r*i)*p,e):null}function ju(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8];return t*(l*i-o*c)+n*(-l*s+o*a)+r*(c*s-i*a)}function jo(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1],p=n[2],A=n[3],g=n[4],y=n[5],E=n[6],_=n[7],B=n[8];return e[0]=f*r+d*o+p*l,e[1]=f*s+d*a+p*u,e[2]=f*i+d*c+p*h,e[3]=A*r+g*o+y*l,e[4]=A*s+g*a+y*u,e[5]=A*i+g*c+y*h,e[6]=E*r+_*o+B*l,e[7]=E*s+_*a+B*u,e[8]=E*i+_*c+B*h,e}function Xu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=n[0],d=n[1];return e[0]=r,e[1]=s,e[2]=i,e[3]=o,e[4]=a,e[5]=c,e[6]=f*r+d*o+l,e[7]=f*s+d*a+u,e[8]=f*i+d*c+h,e}function Wu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=Math.sin(n),d=Math.cos(n);return e[0]=d*r+f*o,e[1]=d*s+f*a,e[2]=d*i+f*c,e[3]=d*o-f*r,e[4]=d*a-f*s,e[5]=d*c-f*i,e[6]=l,e[7]=u,e[8]=h,e}function Xo(e,t,n){let r=n[0],s=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=s*t[3],e[4]=s*t[4],e[5]=s*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function Yu(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,p=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-p,e[3]=u-y,e[6]=f+g,e[1]=u+y,e[4]=1-l-p,e[7]=d-A,e[2]=f-g,e[5]=d+A,e[8]=1-l-h,e}var Wo;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(Wo||(Wo={}));var A1=Object.freeze([1,0,0,0,1,0,0,0,1]),k=class extends xn{static get IDENTITY(){return y1()}static get ZERO(){return x1()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Wo}constructor(t,...n){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):n.length>0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(A1)}fromObject(t){return this.check()}fromQuaternion(t){return Yu(this,t),this.check()}set(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l){return this[0]=t,this[1]=s,this[2]=a,this[3]=n,this[4]=i,this[5]=c,this[6]=r,this[7]=o,this[8]=l,this.check()}determinant(){return ju(this)}transpose(){return Ju(this,this),this.check()}invert(){return qu(this,this),this.check()}multiplyLeft(t){return jo(this,t,this),this.check()}multiplyRight(t){return jo(this,this,t),this.check()}rotate(t){return Wu(this,this,t),this.check()}scale(t){return Array.isArray(t)?Xo(this,this,t):Xo(this,this,[t,t]),this.check()}translate(t){return Xu(this,this,t),this.check()}transform(t,n){let r;switch(t.length){case 2:r=us(n||[-0,-0],t,this);break;case 3:r=rr(n||[-0,-0,-0],t,this);break;case 4:r=ps(n||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(r,t.length),r}transformVector(t,n){return this.transform(t,n)}transformVector2(t,n){return this.transform(t,n)}transformVector3(t,n){return this.transform(t,n)}},ys,Ts=null;function x1(){return ys||(ys=new k([0,0,0,0,0,0,0,0,0]),Object.freeze(ys)),ys}function y1(){return Ts||(Ts=new k,Object.freeze(Ts)),Ts}var _s={};ut(_s,{add:()=>J1,adjoint:()=>b1,clone:()=>_1,copy:()=>E1,create:()=>T1,decompose:()=>O1,determinant:()=>Qo,equals:()=>W1,exactEquals:()=>X1,frob:()=>k1,fromQuat:()=>sa,fromQuat2:()=>R1,fromRotation:()=>I1,fromRotationTranslation:()=>Qu,fromRotationTranslationScale:()=>N1,fromRotationTranslationScaleOrigin:()=>D1,fromScaling:()=>M1,fromTranslation:()=>S1,fromValues:()=>B1,fromXRotation:()=>w1,fromYRotation:()=>v1,fromZRotation:()=>F1,frustum:()=>ia,getRotation:()=>P1,getScaling:()=>Zu,getTranslation:()=>L1,identity:()=>Ku,invert:()=>Ko,lookAt:()=>ca,mul:()=>Y1,multiply:()=>ir,multiplyScalar:()=>q1,multiplyScalarAndAdd:()=>j1,ortho:()=>aa,orthoNO:()=>th,orthoZO:()=>V1,perspective:()=>oa,perspectiveFromFieldOfView:()=>G1,perspectiveNO:()=>$u,perspectiveZO:()=>U1,rotate:()=>ta,rotateX:()=>ea,rotateY:()=>na,rotateZ:()=>ra,scale:()=>$o,set:()=>C1,str:()=>z1,sub:()=>K1,subtract:()=>eh,targetTo:()=>H1,translate:()=>Zo,transpose:()=>Yo});function T1(){let e=new $(16);return $!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function _1(e){let t=new $(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function E1(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function B1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,p,A){let g=new $(16);return g[0]=e,g[1]=t,g[2]=n,g[3]=r,g[4]=s,g[5]=i,g[6]=o,g[7]=a,g[8]=c,g[9]=l,g[10]=u,g[11]=h,g[12]=f,g[13]=d,g[14]=p,g[15]=A,g}function C1(e,t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return e[0]=t,e[1]=n,e[2]=r,e[3]=s,e[4]=i,e[5]=o,e[6]=a,e[7]=c,e[8]=l,e[9]=u,e[10]=h,e[11]=f,e[12]=d,e[13]=p,e[14]=A,e[15]=g,e}function Ku(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Yo(e,t){if(e===t){let n=t[1],r=t[2],s=t[3],i=t[6],o=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=n,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=i,e[11]=t[14],e[12]=s,e[13]=o,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function Ko(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,b=r*c-s*a,S=r*l-i*a,w=s*l-i*c,C=u*A-h*p,T=u*g-f*p,m=u*y-d*p,M=h*g-f*A,F=h*y-d*A,R=f*y-d*g,v=E*R-_*F+B*M+b*m-S*T+w*C;return v?(v=1/v,e[0]=(a*R-c*F+l*M)*v,e[1]=(s*F-r*R-i*M)*v,e[2]=(A*w-g*S+y*b)*v,e[3]=(f*S-h*w-d*b)*v,e[4]=(c*m-o*R-l*T)*v,e[5]=(n*R-s*m+i*T)*v,e[6]=(g*B-p*w-y*_)*v,e[7]=(u*w-f*B+d*_)*v,e[8]=(o*F-a*m+l*C)*v,e[9]=(r*m-n*F-i*C)*v,e[10]=(p*S-A*B+y*E)*v,e[11]=(h*B-u*S-d*E)*v,e[12]=(a*T-o*M-c*C)*v,e[13]=(n*M-r*T+s*C)*v,e[14]=(A*_-p*b-g*E)*v,e[15]=(u*b-h*_+f*E)*v,e):null}function b1(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],h=t[9],f=t[10],d=t[11],p=t[12],A=t[13],g=t[14],y=t[15],E=n*a-r*o,_=n*c-s*o,B=n*l-i*o,b=r*c-s*a,S=r*l-i*a,w=s*l-i*c,C=u*A-h*p,T=u*g-f*p,m=u*y-d*p,M=h*g-f*A,F=h*y-d*A,R=f*y-d*g;return e[0]=a*R-c*F+l*M,e[1]=s*F-r*R-i*M,e[2]=A*w-g*S+y*b,e[3]=f*S-h*w-d*b,e[4]=c*m-o*R-l*T,e[5]=n*R-s*m+i*T,e[6]=g*B-p*w-y*_,e[7]=u*w-f*B+d*_,e[8]=o*F-a*m+l*C,e[9]=r*m-n*F-i*C,e[10]=p*S-A*B+y*E,e[11]=h*B-u*S-d*E,e[12]=a*T-o*M-c*C,e[13]=n*M-r*T+s*C,e[14]=A*_-p*b-g*E,e[15]=u*b-h*_+f*E,e}function Qo(e){let t=e[0],n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],f=e[11],d=e[12],p=e[13],A=e[14],g=e[15],y=t*o-n*i,E=t*a-r*i,_=n*a-r*o,B=l*p-u*d,b=l*A-h*d,S=u*A-h*p,w=t*S-n*b+r*B,C=i*S-o*b+a*B,T=l*_-u*E+h*y,m=d*_-p*E+A*y;return c*w-s*C+g*T-f*m}function ir(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=t[8],f=t[9],d=t[10],p=t[11],A=t[12],g=t[13],y=t[14],E=t[15],_=n[0],B=n[1],b=n[2],S=n[3];return e[0]=_*r+B*a+b*h+S*A,e[1]=_*s+B*c+b*f+S*g,e[2]=_*i+B*l+b*d+S*y,e[3]=_*o+B*u+b*p+S*E,_=n[4],B=n[5],b=n[6],S=n[7],e[4]=_*r+B*a+b*h+S*A,e[5]=_*s+B*c+b*f+S*g,e[6]=_*i+B*l+b*d+S*y,e[7]=_*o+B*u+b*p+S*E,_=n[8],B=n[9],b=n[10],S=n[11],e[8]=_*r+B*a+b*h+S*A,e[9]=_*s+B*c+b*f+S*g,e[10]=_*i+B*l+b*d+S*y,e[11]=_*o+B*u+b*p+S*E,_=n[12],B=n[13],b=n[14],S=n[15],e[12]=_*r+B*a+b*h+S*A,e[13]=_*s+B*c+b*f+S*g,e[14]=_*i+B*l+b*d+S*y,e[15]=_*o+B*u+b*p+S*E,e}function Zo(e,t,n){let r=n[0],s=n[1],i=n[2],o,a,c,l,u,h,f,d,p,A,g,y;return t===e?(e[12]=t[0]*r+t[4]*s+t[8]*i+t[12],e[13]=t[1]*r+t[5]*s+t[9]*i+t[13],e[14]=t[2]*r+t[6]*s+t[10]*i+t[14],e[15]=t[3]*r+t[7]*s+t[11]*i+t[15]):(o=t[0],a=t[1],c=t[2],l=t[3],u=t[4],h=t[5],f=t[6],d=t[7],p=t[8],A=t[9],g=t[10],y=t[11],e[0]=o,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=h,e[6]=f,e[7]=d,e[8]=p,e[9]=A,e[10]=g,e[11]=y,e[12]=o*r+u*s+p*i+t[12],e[13]=a*r+h*s+A*i+t[13],e[14]=c*r+f*s+g*i+t[14],e[15]=l*r+d*s+y*i+t[15]),e}function $o(e,t,n){let r=n[0],s=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*s,e[5]=t[5]*s,e[6]=t[6]*s,e[7]=t[7]*s,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function ta(e,t,n,r){let s=r[0],i=r[1],o=r[2],a=Math.sqrt(s*s+i*i+o*o),c,l,u,h,f,d,p,A,g,y,E,_,B,b,S,w,C,T,m,M,F,R,v,D;return a<1e-6?null:(a=1/a,s*=a,i*=a,o*=a,l=Math.sin(n),c=Math.cos(n),u=1-c,h=t[0],f=t[1],d=t[2],p=t[3],A=t[4],g=t[5],y=t[6],E=t[7],_=t[8],B=t[9],b=t[10],S=t[11],w=s*s*u+c,C=i*s*u+o*l,T=o*s*u-i*l,m=s*i*u-o*l,M=i*i*u+c,F=o*i*u+s*l,R=s*o*u+i*l,v=i*o*u-s*l,D=o*o*u+c,e[0]=h*w+A*C+_*T,e[1]=f*w+g*C+B*T,e[2]=d*w+y*C+b*T,e[3]=p*w+E*C+S*T,e[4]=h*m+A*M+_*F,e[5]=f*m+g*M+B*F,e[6]=d*m+y*M+b*F,e[7]=p*m+E*M+S*F,e[8]=h*R+A*v+_*D,e[9]=f*R+g*v+B*D,e[10]=d*R+y*v+b*D,e[11]=p*R+E*v+S*D,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function ea(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[4],o=t[5],a=t[6],c=t[7],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=i*s+l*r,e[5]=o*s+u*r,e[6]=a*s+h*r,e[7]=c*s+f*r,e[8]=l*s-i*r,e[9]=u*s-o*r,e[10]=h*s-a*r,e[11]=f*s-c*r,e}function na(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s-l*r,e[1]=o*s-u*r,e[2]=a*s-h*r,e[3]=c*s-f*r,e[8]=i*r+l*s,e[9]=o*r+u*s,e[10]=a*r+h*s,e[11]=c*r+f*s,e}function ra(e,t,n){let r=Math.sin(n),s=Math.cos(n),i=t[0],o=t[1],a=t[2],c=t[3],l=t[4],u=t[5],h=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=i*s+l*r,e[1]=o*s+u*r,e[2]=a*s+h*r,e[3]=c*s+f*r,e[4]=l*s-i*r,e[5]=u*s-o*r,e[6]=h*s-a*r,e[7]=f*s-c*r,e}function S1(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function M1(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function I1(e,t,n){let r=n[0],s=n[1],i=n[2],o=Math.sqrt(r*r+s*s+i*i),a,c,l;return o<1e-6?null:(o=1/o,r*=o,s*=o,i*=o,c=Math.sin(t),a=Math.cos(t),l=1-a,e[0]=r*r*l+a,e[1]=s*r*l+i*c,e[2]=i*r*l-s*c,e[3]=0,e[4]=r*s*l-i*c,e[5]=s*s*l+a,e[6]=i*s*l+r*c,e[7]=0,e[8]=r*i*l+s*c,e[9]=s*i*l-r*c,e[10]=i*i*l+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function w1(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function v1(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function F1(e,t){let n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Qu(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=r+r,c=s+s,l=i+i,u=r*a,h=r*c,f=r*l,d=s*c,p=s*l,A=i*l,g=o*a,y=o*c,E=o*l;return e[0]=1-(d+A),e[1]=h+E,e[2]=f-y,e[3]=0,e[4]=h-E,e[5]=1-(u+A),e[6]=p+g,e[7]=0,e[8]=f+y,e[9]=p-g,e[10]=1-(u+d),e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function R1(e,t){let n=new $(3),r=-t[0],s=-t[1],i=-t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],h=r*r+s*s+i*i+o*o;return h>0?(n[0]=(a*o+u*r+c*i-l*s)*2/h,n[1]=(c*o+u*s+l*r-a*i)*2/h,n[2]=(l*o+u*i+a*s-c*r)*2/h):(n[0]=(a*o+u*r+c*i-l*s)*2,n[1]=(c*o+u*s+l*r-a*i)*2,n[2]=(l*o+u*i+a*s-c*r)*2),Qu(e,t,n),e}function L1(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function Zu(e,t){let n=t[0],r=t[1],s=t[2],i=t[4],o=t[5],a=t[6],c=t[8],l=t[9],u=t[10];return e[0]=Math.sqrt(n*n+r*r+s*s),e[1]=Math.sqrt(i*i+o*o+a*a),e[2]=Math.sqrt(c*c+l*l+u*u),e}function P1(e,t){let n=new $(3);Zu(n,t);let r=1/n[0],s=1/n[1],i=1/n[2],o=t[0]*r,a=t[1]*s,c=t[2]*i,l=t[4]*r,u=t[5]*s,h=t[6]*i,f=t[8]*r,d=t[9]*s,p=t[10]*i,A=o+u+p,g=0;return A>0?(g=Math.sqrt(A+1)*2,e[3]=.25*g,e[0]=(h-d)/g,e[1]=(f-c)/g,e[2]=(a-l)/g):o>u&&o>p?(g=Math.sqrt(1+o-u-p)*2,e[3]=(h-d)/g,e[0]=.25*g,e[1]=(a+l)/g,e[2]=(f+c)/g):u>p?(g=Math.sqrt(1+u-o-p)*2,e[3]=(f-c)/g,e[0]=(a+l)/g,e[1]=.25*g,e[2]=(h+d)/g):(g=Math.sqrt(1+p-o-u)*2,e[3]=(a-l)/g,e[0]=(f+c)/g,e[1]=(h+d)/g,e[2]=.25*g),e}function O1(e,t,n,r){t[0]=r[12],t[1]=r[13],t[2]=r[14];let s=r[0],i=r[1],o=r[2],a=r[4],c=r[5],l=r[6],u=r[8],h=r[9],f=r[10];n[0]=Math.sqrt(s*s+i*i+o*o),n[1]=Math.sqrt(a*a+c*c+l*l),n[2]=Math.sqrt(u*u+h*h+f*f);let d=1/n[0],p=1/n[1],A=1/n[2],g=s*d,y=i*p,E=o*A,_=a*d,B=c*p,b=l*A,S=u*d,w=h*p,C=f*A,T=g+B+C,m=0;return T>0?(m=Math.sqrt(T+1)*2,e[3]=.25*m,e[0]=(b-w)/m,e[1]=(S-E)/m,e[2]=(y-_)/m):g>B&&g>C?(m=Math.sqrt(1+g-B-C)*2,e[3]=(b-w)/m,e[0]=.25*m,e[1]=(y+_)/m,e[2]=(S+E)/m):B>C?(m=Math.sqrt(1+B-g-C)*2,e[3]=(S-E)/m,e[0]=(y+_)/m,e[1]=.25*m,e[2]=(b+w)/m):(m=Math.sqrt(1+C-g-B)*2,e[3]=(y-_)/m,e[0]=(S+E)/m,e[1]=(b+w)/m,e[2]=.25*m),e}function N1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=s+s,l=i+i,u=o+o,h=s*c,f=s*l,d=s*u,p=i*l,A=i*u,g=o*u,y=a*c,E=a*l,_=a*u,B=r[0],b=r[1],S=r[2];return e[0]=(1-(p+g))*B,e[1]=(f+_)*B,e[2]=(d-E)*B,e[3]=0,e[4]=(f-_)*b,e[5]=(1-(h+g))*b,e[6]=(A+y)*b,e[7]=0,e[8]=(d+E)*S,e[9]=(A-y)*S,e[10]=(1-(h+p))*S,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function D1(e,t,n,r,s){let i=t[0],o=t[1],a=t[2],c=t[3],l=i+i,u=o+o,h=a+a,f=i*l,d=i*u,p=i*h,A=o*u,g=o*h,y=a*h,E=c*l,_=c*u,B=c*h,b=r[0],S=r[1],w=r[2],C=s[0],T=s[1],m=s[2],M=(1-(A+y))*b,F=(d+B)*b,R=(p-_)*b,v=(d-B)*S,D=(1-(f+y))*S,W=(g+E)*S,z=(p+_)*w,Z=(g-E)*w,X=(1-(f+A))*w;return e[0]=M,e[1]=F,e[2]=R,e[3]=0,e[4]=v,e[5]=D,e[6]=W,e[7]=0,e[8]=z,e[9]=Z,e[10]=X,e[11]=0,e[12]=n[0]+C-(M*C+v*T+z*m),e[13]=n[1]+T-(F*C+D*T+Z*m),e[14]=n[2]+m-(R*C+W*T+X*m),e[15]=1,e}function sa(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n+n,a=r+r,c=s+s,l=n*o,u=r*o,h=r*a,f=s*o,d=s*a,p=s*c,A=i*o,g=i*a,y=i*c;return e[0]=1-h-p,e[1]=u+y,e[2]=f-g,e[3]=0,e[4]=u-y,e[5]=1-l-p,e[6]=d+A,e[7]=0,e[8]=f+g,e[9]=d-A,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ia(e,t,n,r,s,i,o){let a=1/(n-t),c=1/(s-r),l=1/(i-o);return e[0]=i*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i*2*c,e[6]=0,e[7]=0,e[8]=(n+t)*a,e[9]=(s+r)*c,e[10]=(o+i)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*i*2*l,e[15]=0,e}function $u(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=(s+r)*o,e[14]=2*s*r*o}else e[10]=-1,e[14]=-2*r;return e}var oa=$u;function U1(e,t,n,r,s){let i=1/Math.tan(t/2);if(e[0]=i/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,s!=null&&s!==1/0){let o=1/(r-s);e[10]=s*o,e[14]=s*r*o}else e[10]=-1,e[14]=-r;return e}function G1(e,t,n,r){let s=Math.tan(t.upDegrees*Math.PI/180),i=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),c=2/(o+a),l=2/(s+i);return e[0]=c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=l,e[6]=0,e[7]=0,e[8]=-((o-a)*c*.5),e[9]=(s-i)*l*.5,e[10]=r/(n-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*n/(n-r),e[15]=0,e}function th(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=(o+i)*l,e[15]=1,e}var aa=th;function V1(e,t,n,r,s,i,o){let a=1/(t-n),c=1/(r-s),l=1/(i-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=l,e[11]=0,e[12]=(t+n)*a,e[13]=(s+r)*c,e[14]=i*l,e[15]=1,e}function ca(e,t,n,r){let s,i,o,a,c,l,u,h,f,d,p=t[0],A=t[1],g=t[2],y=r[0],E=r[1],_=r[2],B=n[0],b=n[1],S=n[2];return Math.abs(p-B)<1e-6&&Math.abs(A-b)<1e-6&&Math.abs(g-S)<1e-6?Ku(e):(h=p-B,f=A-b,d=g-S,s=1/Math.sqrt(h*h+f*f+d*d),h*=s,f*=s,d*=s,i=E*d-_*f,o=_*h-y*d,a=y*f-E*h,s=Math.sqrt(i*i+o*o+a*a),s?(s=1/s,i*=s,o*=s,a*=s):(i=0,o=0,a=0),c=f*a-d*o,l=d*i-h*a,u=h*o-f*i,s=Math.sqrt(c*c+l*l+u*u),s?(s=1/s,c*=s,l*=s,u*=s):(c=0,l=0,u=0),e[0]=i,e[1]=c,e[2]=h,e[3]=0,e[4]=o,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=u,e[10]=d,e[11]=0,e[12]=-(i*p+o*A+a*g),e[13]=-(c*p+l*A+u*g),e[14]=-(h*p+f*A+d*g),e[15]=1,e)}function H1(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=r[0],c=r[1],l=r[2],u=s-n[0],h=i-n[1],f=o-n[2],d=u*u+h*h+f*f;d>0&&(d=1/Math.sqrt(d),u*=d,h*=d,f*=d);let p=c*f-l*h,A=l*u-a*f,g=a*h-c*u;return d=p*p+A*A+g*g,d>0&&(d=1/Math.sqrt(d),p*=d,A*=d,g*=d),e[0]=p,e[1]=A,e[2]=g,e[3]=0,e[4]=h*g-f*A,e[5]=f*p-u*g,e[6]=u*A-h*p,e[7]=0,e[8]=u,e[9]=h,e[10]=f,e[11]=0,e[12]=s,e[13]=i,e[14]=o,e[15]=1,e}function z1(e){return"mat4(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(e[3],", ").concat(e[4],", ").concat(e[5],", ").concat(e[6],", ").concat(e[7],", ").concat(e[8],", ").concat(e[9],", ").concat(e[10],", ").concat(e[11],", ").concat(e[12],", ").concat(e[13],", ").concat(e[14],", ").concat(e[15],")")}function k1(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function J1(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e[4]=t[4]+n[4],e[5]=t[5]+n[5],e[6]=t[6]+n[6],e[7]=t[7]+n[7],e[8]=t[8]+n[8],e[9]=t[9]+n[9],e[10]=t[10]+n[10],e[11]=t[11]+n[11],e[12]=t[12]+n[12],e[13]=t[13]+n[13],e[14]=t[14]+n[14],e[15]=t[15]+n[15],e}function eh(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e[3]=t[3]-n[3],e[4]=t[4]-n[4],e[5]=t[5]-n[5],e[6]=t[6]-n[6],e[7]=t[7]-n[7],e[8]=t[8]-n[8],e[9]=t[9]-n[9],e[10]=t[10]-n[10],e[11]=t[11]-n[11],e[12]=t[12]-n[12],e[13]=t[13]-n[13],e[14]=t[14]-n[14],e[15]=t[15]-n[15],e}function q1(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12]*n,e[13]=t[13]*n,e[14]=t[14]*n,e[15]=t[15]*n,e}function j1(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e[3]=t[3]+n[3]*r,e[4]=t[4]+n[4]*r,e[5]=t[5]+n[5]*r,e[6]=t[6]+n[6]*r,e[7]=t[7]+n[7]*r,e[8]=t[8]+n[8]*r,e[9]=t[9]+n[9]*r,e[10]=t[10]+n[10]*r,e[11]=t[11]+n[11]*r,e[12]=t[12]+n[12]*r,e[13]=t[13]+n[13]*r,e[14]=t[14]+n[14]*r,e[15]=t[15]+n[15]*r,e}function X1(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function W1(e,t){let n=e[0],r=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],A=e[13],g=e[14],y=e[15],E=t[0],_=t[1],B=t[2],b=t[3],S=t[4],w=t[5],C=t[6],T=t[7],m=t[8],M=t[9],F=t[10],R=t[11],v=t[12],D=t[13],W=t[14],z=t[15];return Math.abs(n-E)<=1e-6*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(s-B)<=1e-6*Math.max(1,Math.abs(s),Math.abs(B))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(o-S)<=1e-6*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(c-C)<=1e-6*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-m)<=1e-6*Math.max(1,Math.abs(u),Math.abs(m))&&Math.abs(h-M)<=1e-6*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(f-F)<=1e-6*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-v)<=1e-6*Math.max(1,Math.abs(p),Math.abs(v))&&Math.abs(A-D)<=1e-6*Math.max(1,Math.abs(A),Math.abs(D))&&Math.abs(g-W)<=1e-6*Math.max(1,Math.abs(g),Math.abs(W))&&Math.abs(y-z)<=1e-6*Math.max(1,Math.abs(y),Math.abs(z))}var Y1=ir,K1=eh;function Q1(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function nh(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e}function rh(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e}function sh(e){let t=e[0],n=e[1],r=e[2],s=e[3];return Math.sqrt(t*t+n*n+r*r+s*s)}function ih(e){let t=e[0],n=e[1],r=e[2],s=e[3];return t*t+n*n+r*r+s*s}function oh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=n*o,e[1]=r*o,e[2]=s*o,e[3]=i*o,e}function ah(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function ch(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3];return e[0]=s+r*(n[0]-s),e[1]=i+r*(n[1]-i),e[2]=o+r*(n[2]-o),e[3]=a+r*(n[3]-a),e}function lh(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*s+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*s+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*s+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*s+n[11]*i+n[15]*o,e}function uh(e,t,n){let r=t[0],s=t[1],i=t[2],o=n[0],a=n[1],c=n[2],l=n[3],u=l*r+a*i-c*s,h=l*s+c*r-o*i,f=l*i+o*s-a*r,d=-o*r-a*s-c*i;return e[0]=u*l+d*-o+h*-c-f*-a,e[1]=h*l+d*-a+f*-o-u*-c,e[2]=f*l+d*-c+u*-a-h*-o,e[3]=t[3],e}var H2=function(){let e=Q1();return function(t,n,r,s,i,o){let a,c;for(n||(n=4),r||(r=0),s?c=Math.min(s*n+r,t.length):c=t.length,a=r;a<c;a+=n)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],i(e,e,o),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();var ha;(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(ha||(ha={}));var $1=45*Math.PI/180,tx=1,la=.1,ua=500,ex=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),P=class extends xn{static get IDENTITY(){return rx()}static get ZERO(){return nx()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ha}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this[4]=i,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=u,this[10]=h,this[11]=f,this[12]=d,this[13]=p,this[14]=A,this[15]=g,this.check()}setRowMajor(t,n,r,s,i,o,a,c,l,u,h,f,d,p,A,g){return this[0]=t,this[1]=i,this[2]=l,this[3]=d,this[4]=n,this[5]=o,this[6]=u,this[7]=p,this[8]=r,this[9]=a,this[10]=h,this[11]=A,this[12]=s,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(ex)}fromObject(t){return this.check()}fromQuaternion(t){return sa(this,t),this.check()}frustum(t){let{left:n,right:r,bottom:s,top:i,near:o=la,far:a=ua}=t;return a===1/0?sx(this,n,r,s,i,o):ia(this,n,r,s,i,o,a),this.check()}lookAt(t){let{eye:n,center:r=[0,0,0],up:s=[0,1,0]}=t;return ca(this,n,r,s),this.check()}ortho(t){let{left:n,right:r,bottom:s,top:i,near:o=la,far:a=ua}=t;return aa(this,n,r,s,i,o,a),this.check()}orthographic(t){let{fovy:n=$1,aspect:r=tx,focalDistance:s=1,near:i=la,far:o=ua}=t;hh(n);let a=n/2,c=s*Math.tan(a),l=c*r;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:i,far:o})}perspective(t){let{fovy:n=45*Math.PI/180,aspect:r=1,near:s=.1,far:i=500}=t;return hh(n),oa(this,n,r,s,i),this.check()}determinant(){return Qo(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*s,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*s,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,n){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],n=n||[-0,-0,-0];let r=this.getScale(n),s=1/r[0],i=1/r[1],o=1/r[2];return t[0]=this[0]*s,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*s,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*s,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return Yo(this,this),this.check()}invert(){return Ko(this,this),this.check()}multiplyLeft(t){return ir(this,t,this),this.check()}multiplyRight(t){return ir(this,this,t),this.check()}rotateX(t){return ea(this,this,t),this.check()}rotateY(t){return na(this,this,t),this.check()}rotateZ(t){return ra(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,n){return ta(this,this,t,n),this.check()}scale(t){return $o(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return Zo(this,this,t),this.check()}transform(t,n){return t.length===4?(n=lh(n||[-0,-0,-0,-0],t,this),_e(n,4),n):this.transformAsPoint(t,n)}transformAsPoint(t,n){let{length:r}=t,s;switch(r){case 2:s=hs(n||[-0,-0],t,this);break;case 3:s=Ve(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(s,t.length),s}transformAsVector(t,n){let r;switch(t.length){case 2:r=fs(n||[-0,-0],t,this);break;case 3:r=ds(n||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return _e(r,t.length),r}transformPoint(t,n){return this.transformAsPoint(t,n)}transformVector(t,n){return this.transformAsPoint(t,n)}transformDirection(t,n){return this.transformAsVector(t,n)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,n,r){return this.identity().translate([t,n,r])}},Es,Bs;function nx(){return Es||(Es=new P([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Es)),Es}function rx(){return Bs||(Bs=new P,Object.freeze(Bs)),Bs}function hh(e){if(e>Math.PI*2)throw Error("expected radians")}function sx(e,t,n,r,s,i){let o=2*i/(n-t),a=2*i/(s-r),c=(n+t)/(n-t),l=(s+r)/(s-r),u=-1,h=-1,f=-2*i;return e[0]=o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=u,e[11]=h,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}function fh(){let e=new $(4);return $!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function dh(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function fa(e,t,n){n=n*.5;let r=Math.sin(n);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(n),e}function da(e,t,n){let r=t[0],s=t[1],i=t[2],o=t[3],a=n[0],c=n[1],l=n[2],u=n[3];return e[0]=r*u+o*a+s*l-i*c,e[1]=s*u+o*c+i*a-r*l,e[2]=i*u+o*l+r*c-s*a,e[3]=o*u-r*a-s*c-i*l,e}function ph(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+o*a,e[1]=s*c+i*a,e[2]=i*c-s*a,e[3]=o*c-r*a,e}function mh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c-i*a,e[1]=s*c+o*a,e[2]=i*c+r*a,e[3]=o*c-s*a,e}function gh(e,t,n){n*=.5;let r=t[0],s=t[1],i=t[2],o=t[3],a=Math.sin(n),c=Math.cos(n);return e[0]=r*c+s*a,e[1]=s*c-r*a,e[2]=i*c+o*a,e[3]=o*c-i*a,e}function Ah(e,t){let n=t[0],r=t[1],s=t[2];return e[0]=n,e[1]=r,e[2]=s,e[3]=Math.sqrt(Math.abs(1-n*n-r*r-s*s)),e}function or(e,t,n,r){let s=t[0],i=t[1],o=t[2],a=t[3],c=n[0],l=n[1],u=n[2],h=n[3],f,d,p,A,g;return f=s*c+i*l+o*u+a*h,f<0&&(f=-f,c=-c,l=-l,u=-u,h=-h),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),p=Math.sin((1-r)*d)/g,A=Math.sin(r*d)/g):(p=1-r,A=r),e[0]=p*s+A*c,e[1]=p*i+A*l,e[2]=p*o+A*u,e[3]=p*a+A*h,e}function xh(e,t){let n=t[0],r=t[1],s=t[2],i=t[3],o=n*n+r*r+s*s+i*i,a=o?1/o:0;return e[0]=-n*a,e[1]=-r*a,e[2]=-s*a,e[3]=i*a,e}function yh(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function pa(e,t){let n=t[0]+t[4]+t[8],r;if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{let s=0;t[4]>t[0]&&(s=1),t[8]>t[s*3+s]&&(s=2);let i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(t[s*3+s]-t[i*3+i]-t[o*3+o]+1),e[s]=.5*r,r=.5/r,e[3]=(t[i*3+o]-t[o*3+i])*r,e[i]=(t[i*3+s]+t[s*3+i])*r,e[o]=(t[o*3+s]+t[s*3+o])*r}return e}var Th=nh;var _h=rh,Eh=ah,Bh=ch,Ch=sh;var bh=ih;var Sh=oh;var Mh=function(){let e=ms(),t=gs(1,0,0),n=gs(0,1,0);return function(r,s,i){let o=nr(s,i);return o<-.999999?(Ge(e,t,s),Jo(e)<1e-6&&Ge(e,n,s),Go(e,e),fa(r,e,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ge(e,s,i),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+o,Sh(r,r))}}(),ew=function(){let e=fh(),t=fh();return function(n,r,s,i,o,a){return or(e,r,o,a),or(t,s,i,a),or(n,e,t,2*a*(1-a)),n}}(),nw=function(){let e=ku();return function(t,n,r,s){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=s[0],e[4]=s[1],e[7]=s[2],e[2]=-n[0],e[5]=-n[1],e[8]=-n[2],Sh(t,pa(t,e))}}();var ix=[0,0,0,1],Kt=class extends Te{constructor(t=0,n=0,r=0,s=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,n,r,s)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,n,r,s){return this[0]=t,this[1]=n,this[2]=r,this[3]=s,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return pa(this,t),this.check()}fromAxisRotation(t,n){return fa(this,t,n),this.check()}identity(){return dh(this),this.check()}setAxisAngle(t,n){return this.fromAxisRotation(t,n)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=G(t)}get y(){return this[1]}set y(t){this[1]=G(t)}get z(){return this[2]}set z(t){this[2]=G(t)}get w(){return this[3]}set w(t){this[3]=G(t)}len(){return Ch(this)}lengthSquared(){return bh(this)}dot(t){return Eh(this,t)}rotationTo(t,n){return Mh(this,t,n),this.check()}add(t){return Th(this,this,t),this.check()}calculateW(){return Ah(this,this),this.check()}conjugate(){return yh(this,this),this.check()}invert(){return xh(this,this),this.check()}lerp(t,n,r){return r===void 0?this.lerp(this,t,n):(Bh(this,t,n,r),this.check())}multiplyRight(t){return da(this,this,t),this.check()}multiplyLeft(t){return da(this,t,this),this.check()}normalize(){let t=this.len(),n=t>0?1/t:0;return this[0]=this[0]*n,this[1]=this[1]*n,this[2]=this[2]*n,this[3]=this[3]*n,t===0&&(this[3]=1),this.check()}rotateX(t){return ph(this,this,t),this.check()}rotateY(t){return mh(this,this,t),this.check()}rotateZ(t){return gh(this,this,t),this.check()}scale(t){return _h(this,this,t),this.check()}slerp(t,n,r){let s,i,o;switch(arguments.length){case 1:({start:s=ix,target:i,ratio:o}=t);break;case 2:s=this,i=t,o=n;break;default:s=t,i=n,o=r}return or(this,s,i,o),this.check()}transformVector4(t,n=new An){return uh(n,t,this),_e(n,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,n){return this.setAxisAngle(t,n)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}};var Ut={};ut(Ut,{EPSILON1:()=>ox,EPSILON10:()=>mx,EPSILON11:()=>gx,EPSILON12:()=>Ax,EPSILON13:()=>xx,EPSILON14:()=>yx,EPSILON15:()=>Tx,EPSILON16:()=>_x,EPSILON17:()=>Ex,EPSILON18:()=>Bx,EPSILON19:()=>Cx,EPSILON2:()=>ax,EPSILON20:()=>bx,EPSILON3:()=>cx,EPSILON4:()=>lx,EPSILON5:()=>ux,EPSILON6:()=>hx,EPSILON7:()=>fx,EPSILON8:()=>dx,EPSILON9:()=>px,PI_OVER_FOUR:()=>Mx,PI_OVER_SIX:()=>Ix,PI_OVER_TWO:()=>Sx,TWO_PI:()=>wx});var ox=.1,ax=.01,cx=.001,lx=1e-4,ux=1e-5,hx=1e-6,fx=1e-7,dx=1e-8,px=1e-9,mx=1e-10,gx=1e-11,Ax=1e-12,xx=1e-13,yx=1e-14,Tx=1e-15,_x=1e-16,Ex=1e-17,Bx=1e-18,Cx=1e-19,bx=1e-20,Sx=Math.PI/2,Mx=Math.PI/4,Ix=Math.PI/6,wx=Math.PI*2;function Cs(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var Gt=Math.PI,Fh=Gt/4,Ih=Gt/180,wh=180/Gt,bs=512;function se(e){let[t,n]=e;Cs(Number.isFinite(t)),Cs(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");let r=t*Ih,s=n*Ih,i=bs*(r+Gt)/(2*Gt),o=bs*(Gt+Math.log(Math.tan(Fh+s*.5)))/(2*Gt);return[i,o]}function ie(e){let[t,n]=e,r=t/bs*(2*Gt)-Gt,s=2*(Math.atan(Math.exp(n/bs*(2*Gt)-Gt))-Fh);return[r*wh,s*wh]}var Gw=Math.PI/180;var Lh=6378137*Math.PI;function ma(e){let t=se(e);return t[0]=(t[0]/256-1)*Lh,t[1]=(t[1]/256-1)*Lh,t}var qx={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(e,t)=>console.error(t,e)}},Ms=class extends He.CompositeLayer{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:t,props:n,oldProps:r}){let{viewport:s}=this.context;t.dataChanged||n.serviceType!==r.serviceType?(this.state.imageSource=this._createImageSource(n),this._loadMetadata(),this.debounce(()=>this.loadImage(s,"image source changed"),0)):(0,He._deepEqual)(n.layers,r.layers,1)?t.viewportChanged&&this.debounce(()=>this.loadImage(s,"viewport changed")):this.debounce(()=>this.loadImage(s,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:t,image:n,lastRequestParameters:r}=this.state;return n&&new Ph.BitmapLayer({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:r.srs==="EPSG:4326"?He.COORDINATE_SYSTEM.LNGLAT:He.COORDINATE_SYSTEM.CARTESIAN,bounds:t,image:n})}async getFeatureInfoText(t,n){let{lastRequestParameters:r}=this.state;return r?await this.state.imageSource.getFeatureInfoText?.({...r,query_layers:r.layers,x:t,y:n,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(t){if(t.data instanceof vt)return t.data;if(typeof t.data=="string")return Po({url:t.data,loadOptions:t.loadOptions,type:t.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:t}=this.state;try{this.state.loadCounter++;let n=await t.getMetadata();this.state.imageSource===t&&this.getCurrentLayer()?.props.onMetadataLoad(n)}catch(n){this.getCurrentLayer()?.props.onMetadataLoadError(n)}finally{this.state.loadCounter--}}async loadImage(t,n){let{layers:r,serviceType:s}=this.props;if(s==="wms"&&r.length===0)return;let i=t.getBounds(),{width:o,height:a}=t,c=this.getRequestId(),{srs:l}=this.props;l==="auto"&&(l=t.resolution?"EPSG:4326":"EPSG:3857");let u={width:o,height:a,boundingBox:[[i[0],i[1]],[i[2],i[3]]],layers:r,crs:l};if(l==="EPSG:3857"){let h=ma([i[0],i[1]]),f=ma([i[2],i[3]]);u.boundingBox=[h,f]}try{this.state.loadCounter++,this.props.onImageLoadStart(c);let h=await this.state.imageSource.getImage(u);this.state.lastRequestId<c&&(this.getCurrentLayer()?.props.onImageLoad(c),this.setState({image:h,bounds:i,lastRequestParameters:u,lastRequestId:c}))}catch(h){this.raiseError(h,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(c,h)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(t,n=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>t(),n)}},Ss=Ms;(()=>{Ms.layerName="WMSLayer"})(),(()=>{Ms.defaultProps=qx})();var Oh=N(Nt(),1),jx={getHeight:{type:"accessor",value:0},greatCircle:!0},Is=class extends Oh.ArcLayer{},ar=Is;(()=>{Is.layerName="GreatCircleLayer"})(),(()=>{Is.defaultProps=jx})();var Nh=N(Dt(),1),ga=N(Nt(),1),Xx={...ga.PolygonLayer.defaultProps},ws=class extends Nh.CompositeLayer{indexToBounds(){return null}renderLayers(){let{elevationScale:t,extruded:n,wireframe:r,filled:s,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g}=this.props,{updateTriggers:y,material:E,transitions:_}=this.props,B=this.getSubLayerClass("cell",ga.PolygonLayer),{updateTriggers:b,...S}=this.indexToBounds()||{};return new B({filled:s,wireframe:r,extruded:n,elevationScale:t,stroked:i,lineWidthUnits:o,lineWidthScale:a,lineWidthMinPixels:c,lineWidthMaxPixels:l,lineJointRounded:u,lineMiterLimit:h,lineDashJustified:f,material:E,transitions:_,getElevation:d,getFillColor:p,getLineColor:A,getLineWidth:g},this.getSubLayerProps({id:"cell",updateTriggers:y&&{...b,getElevation:y.getElevation,getFillColor:y.getFillColor,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}),S)}},It=ws;(()=>{ws.layerName="GeoCellLayer"})(),(()=>{ws.defaultProps=Xx})();var vs=N(Aa(),1),Wx=3,Yx=30,Kx=2*Yx+1,Uh=180/Math.PI;function Vh(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Gh(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Hh(e){return[Gh(e[0]),Gh(e[1])]}function zh(e,[t,n]){switch(e){case 0:return[1,t,n];case 1:return[-t,1,n];case 2:return[-t,-n,1];case 3:return[-1,-n,-t];case 4:return[n,-1,-t];case 5:return[n,t,-1];default:throw new Error("Invalid face")}}function kh([e,t,n]){let r=Math.atan2(n,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*Uh,r*Uh]}function Jh(e){let t=vs.default.fromString(e,!0,10).toString(2);for(;t.length<Wx+Kx;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=vs.default.fromString(r,!0,2).toString(10),a=vs.default.fromString(s,!0,2).toString(4);for(;a.length<i;)a="0"+a;return`${o}/${a}`}function Qx(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function qh(e){let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=[0,0],o;for(let a=s-1;a>=0;a--){o=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,o-1);Qx(h,i,l,u),i[0]+=h*l,i[1]+=h*u}if(n%2===1){let a=i[0];i[0]=i[1],i[1]=a}return{face:n,ij:i,level:o}}var jh=N(Aa(),1);function Zx(e){let t=e.padEnd(16,"0");return jh.default.fromString(t,16)}var $x=100;function ty({face:e,ij:t,level:n}){let r=[[0,0],[0,1],[1,1],[1,0],[0,0]],s=Math.max(1,Math.ceil($x*Math.pow(2,-n))),i=new Float64Array(4*s*2+2),o=0,a=0;for(let c=0;c<4;c++){let l=r[c].slice(0),u=r[c+1],h=(u[0]-l[0])/s,f=(u[1]-l[1])/s;for(let d=0;d<s;d++){l[0]+=h,l[1]+=f;let p=Vh(t,n,l),A=Hh(p),g=zh(e,A),y=kh(g);Math.abs(y[1])>89.999&&(y[0]=a);let E=y[0]-a;y[0]+=E>180?-360:E<-180?360:0,i[o++]=y[0],i[o++]=y[1],a=y[0]}}return i[o++]=i[0],i[o++]=i[1],i}function ey(e){if(typeof e=="string"){if(e.indexOf("/")>0)return e;e=Zx(e)}return Jh(e.toString())}function Xh(e){let t=ey(e),n=qh(t);return ty(n)}var ny={getS2Token:{type:"accessor",value:e=>e.token}},Fs=class extends It{indexToBounds(){let{data:t,getS2Token:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>Xh(n(r,s))}}},lr=Fs;(()=>{Fs.layerName="S2Layer"})(),(()=>{Fs.defaultProps=ny})();var xa=512;function ry(e,t){let n=0,r=0,s=1<<e.length,i=s/xa;for(let o=0;o<e.length;o++){s>>=1;let a=parseInt(e[o]);a%2&&(n|=s),a>1&&(r|=s)}return[[n/i,xa-r/i],[(n+t)/i,xa-(r+t)/i]]}function Wh(e,t=1){let[n,r]=ry(e,t),[s,i]=ie(n),[o,a]=ie(r);return[o,i,o,a,s,a,s,i,o,i]}var sy={getQuadkey:{type:"accessor",value:e=>e.quadkey}},Rs=class extends It{indexToBounds(){let{data:t,extruded:n,getQuadkey:r}=this.props,s=n?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(i,o)=>Wh(r(i,o),s),updateTriggers:{getPolygon:s}}}},ur=Rs;(()=>{Rs.layerName="QuadkeyLayer"})(),(()=>{Rs.defaultProps=sy})();var Vs=N(Dt(),1),df=N(Nt(),1);var ze=class{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:n,onLoad:r,onError:s}){let{index:i,id:o,bbox:a,userData:c,zoom:l}=this,u=this._loaderId;this._abortController=new AbortController;let{signal:h}=this._abortController,f=await n.scheduleRequest(this,A=>A.isSelected?1:-1);if(!f){this._isCancelled=!0;return}if(this._isCancelled){f.done();return}let d=null,p;try{d=await t({index:i,id:o,bbox:a,userData:c,zoom:l,signal:h})}catch(A){p=A||!0}finally{f.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=d,this._isCancelled&&!d){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?s(p,this):r(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var dr=N(Dt(),1);var rt={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var Yh=new x,iy=new x,Be=class{constructor(t=[0,0,0],n=[0,0,0],r){L(this,"center",void 0),L(this,"halfDiagonal",void 0),L(this,"minimum",void 0),L(this,"maximum",void 0),r=r||Yh.copy(t).add(n).scale(.5),this.center=new x(r),this.halfDiagonal=new x(n).subtract(this.center),this.minimum=new x(t),this.maximum=new x(n)}clone(){return new Be(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){let{halfDiagonal:n}=this,r=iy.from(t.normal),s=n.x*Math.abs(r.x)+n.y*Math.abs(r.y)+n.z*Math.abs(r.z),i=this.center.dot(r)+t.distance;return i-s>0?rt.INSIDE:i+s<0?rt.OUTSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=Yh.from(t).subtract(this.center),{halfDiagonal:r}=this,s=0,i;return i=Math.abs(n.x)-r.x,i>0&&(s+=i*i),i=Math.abs(n.y)-r.y,i>0&&(s+=i*i),i=Math.abs(n.z)-r.z,i>0&&(s+=i*i),s}};var hr=new x,Kh=new x,Ft=class{constructor(t=[0,0,0],n=0){L(this,"center",void 0),L(this,"radius",void 0),this.radius=-0,this.center=new x,this.fromCenterRadius(t,n)}fromCenterRadius(t,n){return this.center.from(t),this.radius=n,this}fromCornerPoints(t,n){return n=hr.from(n),this.center=new x().from(t).add(n).scale(.5),this.radius=this.center.distance(n),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new Ft(this.center,this.radius)}union(t){let n=this.center,r=this.radius,s=t.center,i=t.radius,o=hr.copy(s).subtract(n),a=o.magnitude();if(r>=a+i)return this.clone();if(i>=a+r)return t.clone();let c=(r+a+i)*.5;return Kh.copy(o).scale((-r+c)/a).add(n),this.center.copy(Kh),this.radius=c,this}expand(t){let r=hr.from(t).subtract(this.center).magnitude();return r>this.radius&&(this.radius=r),this}transform(t){this.center.transform(t);let n=_s.getScaling(hr,t);return this.radius=Math.max(n[0],Math.max(n[1],n[2]))*this.radius,this}distanceSquaredTo(t){let n=this.distanceTo(t);return n*n}distanceTo(t){let r=hr.from(t).subtract(this.center);return Math.max(0,r.len()-this.radius)}intersectPlane(t){let n=this.center,r=this.radius,i=t.normal.dot(n)+t.distance;return i<-r?rt.OUTSIDE:i<r?rt.INTERSECTING:rt.INSIDE}};var oy=new x,ay=new x,Ls=new x,Ps=new x,Os=new x,cy=new x,ly=new x,oe={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Vt=class{constructor(t=[0,0,0],n=[0,0,0,0,0,0,0,0,0]){L(this,"center",void 0),L(this,"halfAxes",void 0),this.center=new x().from(t),this.halfAxes=new k(n)}get halfSize(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new x(t).len(),new x(n).len(),new x(r).len()]}get quaternion(){let t=this.halfAxes.getColumn(0),n=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),s=new x(t).normalize(),i=new x(n).normalize(),o=new x(r).normalize();return new Kt().fromMatrix3(new k([...s,...i,...o]))}fromCenterHalfSizeQuaternion(t,n,r){let s=new Kt(r),i=new k().fromQuaternion(s);return i[0]=i[0]*n[0],i[1]=i[1]*n[0],i[2]=i[2]*n[0],i[3]=i[3]*n[1],i[4]=i[4]*n[1],i[5]=i[5]*n[1],i[6]=i[6]*n[2],i[7]=i[7]*n[2],i[8]=i[8]*n[2],this.center=new x().from(t),this.halfAxes=i,this}clone(){return new Vt(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new Ft){let n=this.halfAxes,r=n.getColumn(0,Ls),s=n.getColumn(1,Ps),i=n.getColumn(2,Os),o=oy.copy(r).add(s).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){let n=this.center,r=t.normal,s=this.halfAxes,i=r.x,o=r.y,a=r.z,c=Math.abs(i*s[oe.COLUMN0ROW0]+o*s[oe.COLUMN0ROW1]+a*s[oe.COLUMN0ROW2])+Math.abs(i*s[oe.COLUMN1ROW0]+o*s[oe.COLUMN1ROW1]+a*s[oe.COLUMN1ROW2])+Math.abs(i*s[oe.COLUMN2ROW0]+o*s[oe.COLUMN2ROW1]+a*s[oe.COLUMN2ROW2]),l=r.dot(n)+t.distance;return l<=-c?rt.OUTSIDE:l>=c?rt.INSIDE:rt.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let n=ay.from(t).subtract(this.center),r=this.halfAxes,s=r.getColumn(0,Ls),i=r.getColumn(1,Ps),o=r.getColumn(2,Os),a=s.magnitude(),c=i.magnitude(),l=o.magnitude();s.normalize(),i.normalize(),o.normalize();let u=0,h;return h=Math.abs(n.dot(s))-a,h>0&&(u+=h*h),h=Math.abs(n.dot(i))-c,h>0&&(u+=h*h),h=Math.abs(n.dot(o))-l,h>0&&(u+=h*h),u}computePlaneDistances(t,n,r=[-0,-0]){let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,o=this.center,a=this.halfAxes,c=a.getColumn(0,Ls),l=a.getColumn(1,Ps),u=a.getColumn(2,Os),h=cy.copy(c).add(l).add(u).add(o),f=ly.copy(h).subtract(t),d=n.dot(f);return s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),h.copy(o).add(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).add(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).add(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),o.copy(h).subtract(c).subtract(l).subtract(u),f.copy(h).subtract(t),d=n.dot(f),s=Math.min(d,s),i=Math.max(d,i),r[0]=s,r[1]=i,r}transform(t){this.center.transformAsPoint(t);let n=this.halfAxes.getColumn(0,Ls);n.transformAsPoint(t);let r=this.halfAxes.getColumn(1,Ps);r.transformAsPoint(t);let s=this.halfAxes.getColumn(2,Os);return s.transformAsPoint(t),this.halfAxes=new k([...n,...r,...s]),this}getTransform(){throw new Error("not implemented")}};var Qh=new x,Zh=new x,lt=class{constructor(t=[0,0,1],n=0){L(this,"normal",void 0),L(this,"distance",void 0),this.normal=new x,this.distance=-0,this.fromNormalDistance(t,n)}fromNormalDistance(t,n){return ct(Number.isFinite(n)),this.normal.from(t).normalize(),this.distance=n,this}fromPointNormal(t,n){t=Qh.from(t),this.normal.from(n).normalize();let r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,n,r,s){return this.normal.set(t,n,r),ct(gt(this.normal.len(),1)),this.distance=s,this}clone(){return new lt(this.normal,this.distance)}equals(t){return gt(this.distance,t.distance)&&gt(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let n=Zh.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,n)}projectPointOntoPlane(t,n=[0,0,0]){let r=Qh.from(t),s=this.getPointDistance(r),i=Zh.copy(this.normal).scale(s);return r.subtract(i).to(n)}};var $h=[new x([1,0,0]),new x([0,1,0]),new x([0,0,1])],tf=new x,uy=new x,ot=class{constructor(t=[]){L(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*$h.length;let n=t.center,r=t.radius,s=0;for(let i of $h){let o=this.planes[s],a=this.planes[s+1];o||(o=this.planes[s]=new lt),a||(a=this.planes[s+1]=new lt);let c=tf.copy(i).scale(-r).add(n);o.fromPointNormal(c,i);let l=tf.copy(i).scale(r).add(n),u=uy.copy(i).negate();a.fromPointNormal(l,u),s+=2}return this}computeVisibility(t){let n=rt.INSIDE;for(let r of this.planes)switch(t.intersectPlane(r)){case rt.OUTSIDE:return rt.OUTSIDE;case rt.INTERSECTING:n=rt.INTERSECTING;break;default:}return n}computeVisibilityWithPlaneMask(t,n){if(ct(Number.isFinite(n),"parentPlaneMask is required."),n===ot.MASK_OUTSIDE||n===ot.MASK_INSIDE)return n;let r=ot.MASK_INSIDE,s=this.planes;for(let i=0;i<this.planes.length;++i){let o=i<31?1<<i:0;if(i<31&&!(n&o))continue;let a=s[i],c=t.intersectPlane(a);if(c===rt.OUTSIDE)return ot.MASK_OUTSIDE;c===rt.INTERSECTING&&(r|=o)}return r}};L(ot,"MASK_OUTSIDE",4294967295);L(ot,"MASK_INSIDE",0);L(ot,"MASK_INDETERMINATE",2147483647);var lF=new x,uF=new x,hF=new x,fF=new x,dF=new x;var TF=new x,_F=new x,EF=new x,BF=new x,CF=new x,bF=new x,SF=new x,MF=new x,IF=new x,wF=new x,vF=new x,FF=new x;var Qt=new k,fy=new k,dy=new k,Ns=new k,ef=new k;function _a(e,t={}){let n=Ut.EPSILON20,r=10,s=0,i=0,o=fy,a=dy;o.identity(),a.copy(e);let c=n*py(a);for(;i<r&&my(a)>c;)gy(a,Ns),ef.copy(Ns).transpose(),a.multiplyRight(Ns),a.multiplyLeft(ef),o.multiplyRight(Ns),++s>2&&(++i,s=0);return t.unitary=o.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function py(e){let t=0;for(let n=0;n<9;++n){let r=e[n];t+=r*r}return Math.sqrt(t)}var ya=[1,0,0],Ta=[2,2,1];function my(e){let t=0;for(let n=0;n<3;++n){let r=e[Qt.getElementIndex(Ta[n],ya[n])];t+=2*r*r}return Math.sqrt(t)}function gy(e,t){let n=Ut.EPSILON15,r=0,s=1;for(let l=0;l<3;++l){let u=Math.abs(e[Qt.getElementIndex(Ta[l],ya[l])]);u>r&&(s=l,r=u)}let i=ya[s],o=Ta[s],a=1,c=0;if(Math.abs(e[Qt.getElementIndex(o,i)])>n){let l=e[Qt.getElementIndex(o,o)],u=e[Qt.getElementIndex(i,i)],h=e[Qt.getElementIndex(o,i)],f=(l-u)/2/h,d;f<0?d=-1/(-f+Math.sqrt(1+f*f)):d=1/(f+Math.sqrt(1+f*f)),a=1/Math.sqrt(1+d*d),c=d*a}return k.IDENTITY.to(t),t[Qt.getElementIndex(i,i)]=t[Qt.getElementIndex(o,o)]=a,t[Qt.getElementIndex(o,i)]=c,t[Qt.getElementIndex(i,o)]=-c,t}var Ce=new x,Ay=new x,xy=new x,yy=new x,Ty=new x,_y=new k,Ey={diagonal:new k,unitary:new k};function fr(e,t=new Vt){if(!e||e.length===0)return t.halfAxes=new k([0,0,0,0,0,0,0,0,0]),t.center=new x,t;let n=e.length,r=new x(0,0,0);for(let T of e)r.add(T);let s=1/n;r.multiplyByScalar(s);let i=0,o=0,a=0,c=0,l=0,u=0;for(let T of e){let m=Ce.copy(T).subtract(r);i+=m.x*m.x,o+=m.x*m.y,a+=m.x*m.z,c+=m.y*m.y,l+=m.y*m.z,u+=m.z*m.z}i*=s,o*=s,a*=s,c*=s,l*=s,u*=s;let h=_y;h[0]=i,h[1]=o,h[2]=a,h[3]=o,h[4]=c,h[5]=l,h[6]=a,h[7]=l,h[8]=u;let{unitary:f}=_a(h,Ey),d=t.halfAxes.copy(f),p=d.getColumn(0,xy),A=d.getColumn(1,yy),g=d.getColumn(2,Ty),y=-Number.MAX_VALUE,E=-Number.MAX_VALUE,_=-Number.MAX_VALUE,B=Number.MAX_VALUE,b=Number.MAX_VALUE,S=Number.MAX_VALUE;for(let T of e)Ce.copy(T),y=Math.max(Ce.dot(p),y),E=Math.max(Ce.dot(A),E),_=Math.max(Ce.dot(g),_),B=Math.min(Ce.dot(p),B),b=Math.min(Ce.dot(A),b),S=Math.min(Ce.dot(g),S);p=p.multiplyByScalar(.5*(B+y)),A=A.multiplyByScalar(.5*(b+E)),g=g.multiplyByScalar(.5*(S+_)),t.center.copy(p).add(A).add(g);let w=Ay.set(y-B,E-b,_-S).multiplyByScalar(.5),C=new k([w[0],0,0,0,w[1],0,0,0,w[2]]);return t.halfAxes.multiplyRight(C),t}var yn=512,nf=3,rf=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],sf=rf.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),By=sf.concat([[.25,.5],[.75,.5]]),be=class{constructor(t,n,r){this.x=t,this.y=n,this.z=r}get children(){if(!this._children){let t=this.x*2,n=this.y*2,r=this.z+1;this._children=[new be(t,n,r),new be(t,n+1,r),new be(t+1,n,r),new be(t+1,n+1,r)]}return this._children}update(t){let{viewport:n,cullingVolume:r,elevationBounds:s,minZ:i,maxZ:o,bounds:a,offset:c,project:l}=t,u=this.getBoundingVolume(s,c,l);if(a&&!this.insideBounds(a)||r.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:f}=this;if(f<o&&f>=i){let d=u.distanceTo(n.cameraPosition)*n.scale/n.height;f+=Math.floor(Math.log2(d))}if(f>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let f of this.children)f.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(let n of this._children)n.getSelected(t);return t}insideBounds([t,n,r,s]){let i=Math.pow(2,this.z),o=yn/i;return this.x*o<r&&this.y*o<s&&(this.x+1)*o>t&&(this.y+1)*o>n}getBoundingVolume(t,n,r){if(r){let c=this.z<1?By:this.z<2?sf:rf,l=[];for(let u of c){let h=Ds(this.x+u[0],this.y+u[1],this.z);h[2]=t[0],l.push(r(h)),t[0]!==t[1]&&(h[2]=t[1],l.push(r(h)))}return fr(l)}let s=Math.pow(2,this.z),i=yn/s,o=this.x*i+n*yn,a=yn-(this.y+1)*i;return new Be([o,a,t[0]],[o+i,a+i,t[1]])}};function of(e,t,n,r){let s=e instanceof dr._GlobeViewport&&e.resolution?e.projectPosition:null,i=Object.values(e.getFrustumPlanes()).map(({normal:d,distance:p})=>new lt(d.clone().negate(),p)),o=new ot(i),a=e.distanceScales.unitsPerMeter[2],c=n&&n[0]*a||0,l=n&&n[1]*a||0,u=e instanceof dr.WebMercatorViewport&&e.pitch<=60?t:0;if(r){let[d,p,A,g]=r,y=se([d,g]),E=se([A,p]);r=[y[0],yn-y[1],E[0],yn-E[1]]}let h=new be(0,0,0),f={viewport:e,project:s,cullingVolume:o,elevationBounds:[c,l],minZ:u,maxZ:t,bounds:r,offset:0};if(h.update(f),e instanceof dr.WebMercatorViewport&&e.subViewports&&e.subViewports.length>1){for(f.offset=-1;h.update(f)&&!(--f.offset<-nf););for(f.offset=1;h.update(f)&&!(++f.offset>nf););}return h.getSelected()}var ae=512,Cy=[-1/0,-1/0,1/0,1/0],Se={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="string"||Array.isArray(e)&&e.every(n=>typeof n=="string"),equal:(e,t)=>{if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}};function cf(e,t){let n=[t.transformAsPoint([e[0],e[1]]),t.transformAsPoint([e[2],e[1]]),t.transformAsPoint([e[0],e[3]]),t.transformAsPoint([e[2],e[3]])];return[Math.min(...n.map(s=>s[0])),Math.min(...n.map(s=>s[1])),Math.max(...n.map(s=>s[0])),Math.max(...n.map(s=>s[1]))]}function by(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function Zt(e,t){if(!e||!e.length)return null;let{index:n,id:r}=t;if(Array.isArray(e)){let i=by(r)%e.length;e=e[i]}let s=e;for(let i of Object.keys(n)){let o=new RegExp(`{${i}}`,"g");s=s.replace(o,String(n[i]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(s=s.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),s}function Sy(e,t,n){let r;if(t&&t.length===2){let[s,i]=t,o=e.getBounds({z:s}),a=e.getBounds({z:i});r=[Math.min(o[0],a[0]),Math.min(o[1],a[1]),Math.max(o[2],a[2]),Math.max(o[3],a[3])]}else r=e.getBounds();return e.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}function lf({viewport:e,z:t,cullRect:n}){return(e.subViewports||[e]).map(s=>Ea(s,t||0,n))}function Ea(e,t,n){if(!Array.isArray(t)){let i=n.x-e.x,o=n.y-e.y,{width:a,height:c}=n,l={targetZ:t},u=e.unproject([i,o],l),h=e.unproject([i+a,o],l),f=e.unproject([i,o+c],l),d=e.unproject([i+a,o+c],l);return[Math.min(u[0],h[0],f[0],d[0]),Math.min(u[1],h[1],f[1],d[1]),Math.max(u[0],h[0],f[0],d[0]),Math.max(u[1],h[1],f[1],d[1])]}let r=Ea(e,t[0],n),s=Ea(e,t[1],n);return[Math.min(r[0],s[0]),Math.min(r[1],s[1]),Math.max(r[2],s[2]),Math.max(r[3],s[3])]}function My(e,t,n){return n?cf(e,n).map(s=>s*t/ae):e.map(r=>r*t/ae)}function Ba(e,t){return Math.pow(2,e)*ae/t}function Ds(e,t,n){let r=Ba(n,ae),s=e/r*360-180,i=Math.PI-2*Math.PI*t/r,o=180/Math.PI*Math.atan(.5*(Math.exp(i)-Math.exp(-i)));return[s,o]}function af(e,t,n,r){let s=Ba(n,r);return[e/s*ae,t/s*ae]}function Ca(e,t,n,r,s=ae){if(e.isGeospatial){let[l,u]=Ds(t,n,r),[h,f]=Ds(t+1,n+1,r);return{west:l,north:u,east:h,south:f}}let[i,o]=af(t,n,r,s),[a,c]=af(t+1,n+1,r,s);return{left:i,top:o,right:a,bottom:c}}function Iy(e,t,n,r,s){let i=Sy(e,null,r),o=Ba(t,n),[a,c,l,u]=My(i,o,s),h=[];for(let f=Math.floor(a);f<l;f++)for(let d=Math.floor(c);d<u;d++)h.push({x:f,y:d,z:t});return h}function ba({viewport:e,maxZoom:t,minZoom:n,zRange:r,extent:s,tileSize:i=ae,modelMatrix:o,modelMatrixInverse:a,zoomOffset:c=0}){let l=e.isGeospatial?Math.round(e.zoom+Math.log2(ae/i))+c:Math.ceil(e.zoom)+c;if(typeof n=="number"&&Number.isFinite(n)&&l<n){if(!s)return[];l=n}typeof t=="number"&&Number.isFinite(t)&&l>t&&(l=t);let u=s;return o&&a&&s&&!e.isGeospatial&&(u=cf(s,o)),e.isGeospatial?of(e,l,r,s):Iy(e,l,i,u||Cy,a)}function Sa(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(e)}function Ma(e){return Number.isFinite(e.west)&&Number.isFinite(e.north)&&Number.isFinite(e.east)&&Number.isFinite(e.south)}function uf(e){let t={},n;return r=>{for(let s in r)if(!wy(r[s],t[s])){n=e(r),t=r;break}return n}}function wy(e,t){if(e===t)return!0;if(Array.isArray(e)){let n=e.length;if(!t||t.length!==n)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}return!1}var hf=1,Us=2,vy="never",Fy="no-overlap",pr="best-available",Ry=5,Ly={[pr]:Oy,[Fy]:Ny,[vy]:()=>{}},Py={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},ke=class{constructor(t){this._getCullBounds=uf(lf),this.opts={...Py,...t},this.setOptions(this.opts),this.onTileLoad=n=>{this.opts.onTileLoad?.(n),this.opts.maxCacheByteSize&&(this._cacheByteSize+=n.byteLength,this._resizeCache())},this._requestScheduler=new ge({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new P,this._modelMatrixInverse=new P}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(let t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let t of this._cache.keys()){let n=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(n)?this._cache.delete(t):n.setNeedsReload()}}update(t,{zRange:n,modelMatrix:r}={zRange:null,modelMatrix:null}){let s=r?new P(r):new P,i=!s.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!gt(this._zRange,n)||i){i&&(this._modelMatrixInverse=s.clone().invert(),this._modelMatrix=s),this._viewport=t,this._zRange=n;let a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:n,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));let o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,n){if(!t.isVisible)return!1;if(n&&this._viewport){let r=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:n}),{bbox:s}=t;for(let[i,o,a,c]of r){let l;if("west"in s)l=s.west<a&&s.east>i&&s.south<c&&s.north>o;else{let u=Math.min(s.top,s.bottom),h=Math.max(s.top,s.bottom);l=s.left<a&&s.right>i&&u<c&&h>o}if(l)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:n,minZoom:r,zRange:s,modelMatrix:i,modelMatrixInverse:o}){let{tileSize:a,extent:c,zoomOffset:l}=this.opts;return ba({viewport:t,maxZoom:n,minZoom:r,zRange:s,tileSize:a,extent:c,modelMatrix:i,modelMatrixInverse:o,zoomOffset:l})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){let{tileSize:n}=this.opts;return{bbox:Ca(this._viewport,t.x,t.y,t.z,n)}}getParentIndex(t){let n=Math.floor(t.x/2),r=Math.floor(t.y/2),s=t.z-1;return{x:n,y:r,z:s}}updateTileStates(){let t=this.opts.refinementStrategy||pr,n=new Array(this._cache.size),r=0;for(let s of this._cache.values())n[r++]=s.isVisible,s.isSelected=!1,s.isVisible=!1;for(let s of this._selectedTiles)s.isSelected=!0,s.isVisible=!0;(typeof t=="function"?t:Ly[t])(Array.from(this._cache.values())),r=0;for(let s of this._cache.values())if(n[r++]!==s.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:t=0}=this.opts,n=[],r=0;for(let s of this._cache.values())s.isLoading&&(r++,!s.isSelected&&!s.isVisible&&n.push(s));for(;t>0&&r>t&&n.length>0;)n.shift().abort(),r--}_rebuildTree(){let{_cache:t}=this;for(let n of t.values())n.parent=null,n.children&&(n.children.length=0);for(let n of t.values()){let r=this._getNearestAncestor(n);n.parent=r,r?.children&&r.children.push(n)}}_resizeCache(){let{_cache:t,opts:n}=this,r=n.maxCacheSize||(n.maxCacheByteSize?1/0:Ry*this.selectedTiles.length),s=n.maxCacheByteSize||1/0;if(t.size>r||this._cacheByteSize>s){for(let[o,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=n.maxCacheByteSize?a.byteLength:0,t.delete(o),this.opts.onTileUnload?.(a)),t.size<=r&&this._cacheByteSize<=s)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((o,a)=>o.zoom-a.zoom),this._dirty=!1)}_getTile(t,n){let r=this.getTileId(t),s=this._cache.get(r),i=!1;return!s&&n?(s=new ze(t),Object.assign(s,this.getTileMetadata(s.index)),Object.assign(s,{id:r,zoom:this.getTileZoom(s.index)}),i=!0,this._cache.set(r,s),this._dirty=!0):s&&s.needsReload&&(i=!0),s&&i&&s.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),s}_getNearestAncestor(t){let{_minZoom:n=0}=this,r=t.index;for(;this.getTileZoom(r)>n;){r=this.getParentIndex(r);let s=this._getTile(r);if(s)return s}return null}};function Oy(e){for(let t of e)t.state=0;for(let t of e)t.isSelected&&!ff(t)&&Ia(t);for(let t of e)t.isVisible=Boolean(t.state&Us)}function Ny(e){for(let n of e)n.state=0;for(let n of e)n.isSelected&&ff(n);let t=Array.from(e).sort((n,r)=>n.zoom-r.zoom);for(let n of t)if(n.isVisible=Boolean(n.state&Us),n.children&&(n.isVisible||n.state&hf))for(let r of n.children)r.state=hf;else n.isSelected&&Ia(n)}function ff(e){let t=e;for(;t;){if(t.isLoaded||t.content)return t.state|=Us,!0;t=t.parent}return!1}function Ia(e){for(let t of e.children)t.isLoaded||t.content?t.state|=Us:Ia(t)}var Dy={TilesetClass:ke,data:{type:"data",value:[]},dataComparator:Se.equal,renderSubLayers:{type:"function",value:e=>new df.GeoJsonLayer(e)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:e=>console.error(e)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:pr,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},Gs=class extends Vs.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(n=>n.isLoaded)))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:n}=this.state,r=t.propsOrDataChanged||t.updateTriggersChanged,s=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),s?n.reloadAll():n.tiles.forEach(i=>{i.layers=null})):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){let{tileSize:t,maxCacheSize:n,maxCacheByteSize:r,refinementStrategy:s,extent:i,maxZoom:o,minZoom:a,maxRequests:c,debounceTime:l,zoomOffset:u}=this.props;return{maxCacheSize:n,maxCacheByteSize:r,maxZoom:o,minZoom:a,tileSize:t,refinementStrategy:s,extent:i,maxRequests:c,debounceTime:l,zoomOffset:u,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let t=this.state.tileset,{zRange:n,modelMatrix:r}=this.props,s=t.update(this.context.viewport,{zRange:n,modelMatrix:r}),{isLoaded:i}=t,o=this.state.isLoaded!==i,a=this.state.frameNumber!==s;i&&(o||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:s}),this.state.isLoaded=i}_onViewportLoad(){let{tileset:t}=this.state,{onViewportLoad:n}=this.props;n&&n(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,n){this.props.onTileError(t),n.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){let{data:n,getTileData:r,fetch:s}=this.props,{signal:i}=t;return t.url=typeof n=="string"||Array.isArray(n)?Zt(n,t):null,r?r(t):s&&t.url?s(t.url,{propName:"data",layer:this,signal:i}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let n=t.sourceLayer.props.tile,r=t.info;return r.picked&&(r.tile=n),r.sourceTile=n,r}_updateAutoHighlight(t){let n=t.sourceTile;if(n&&n.layers)for(let r of n.layers)r.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{let n=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)n&&t.layers[0]&&Object.keys(n).some(r=>t.layers[0].props[r]!==n[r])&&(t.layers=t.layers.map(r=>r.clone(n)));else{let r=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=(0,Vs._flatten)(r,Boolean).map(s=>s.clone({tile:t,...n}))}return t.layers})}filterSubLayer({layer:t,cullRect:n}){let{tile:r}=t.props;return this.state.tileset.isTileVisible(r,n)}},$t=Gs;(()=>{Gs.defaultProps=Dy})(),(()=>{Gs.layerName="TileLayer"})();var pf=N(Nt(),1),Uy={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:e=>e.timestamps}},Hs=class extends pf.PathLayer{getShaders(){let t=super.getShaders();return t.inject={"vs:#decl":`uniform float trailLength;
24
14
  in float instanceTimestamps;
25
15
  in float instanceNextTimestamps;
26
16
  out float vTime;
@@ -35,179 +25,36 @@ in float vTime;
35
25
  `,"fs:DECKGL_FILTER_COLOR":`if(fadeTrail) {
36
26
  color.a *= 1.0 - (currentTime - vTime) / trailLength;
37
27
  }
38
- `},o},n.initializeState=function(){Gr(Gt(r.prototype),"initializeState",this).call(this);var o=this.getAttributeManager();o.addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})},n.draw=function(o){var s=this.props,a=s.fadeTrail,c=s.trailLength,u=s.currentTime;o.uniforms=fp(fp({},o.uniforms),{},{fadeTrail:a,trailLength:c,currentTime:u}),Gr(Gt(r.prototype),"draw",this).call(this,o)},r}(hp.PathLayer);Mo.layerName="TripsLayer";Mo.defaultProps=vE;var Sp=P(wo()),Bp=P(ze());var Fe=P(wo()),Lo=P(ze()),jn=P(Ve());var Vn=P(wo());function mp(t,e){return bE(t)||TE(t,e)||yp(t,e)||xE()}function xE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
39
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TE(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function bE(t){if(Array.isArray(t))return t}function gp(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=yp(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
40
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function yp(t,e){if(t){if(typeof t=="string")return pp(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pp(t,e)}}function pp(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Io(t,e){e=e===void 0?t[0][0]:e;var r=gp(t),n;try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i[0]-e;o>180?i[0]-=360:o<-180&&(i[0]+=360)}}catch(s){r.e(s)}finally{r.f()}}function EE(t,e,r){var n=(0,Vn.cellToLatLng)(t),i=mp(n,2),o=i[0],s=i[1],a=e.length;Io(e,s);for(var c=e[0]===e[a-1]?a-1:a,u=0;u<c;u++)e[u][0]=Rt(s,e[u][0],r),e[u][1]=Rt(o,e[u][1],r)}function Ap(t,e,r){var n=t(e,r),i=(0,Vn.cellToLatLng)(n),o=mp(i,2),s=o[0],a=o[1];return[a,s]}function Hc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,r=(0,Vn.cellToBoundary)(t,!0);return e!==1?EE(t,r,e):Io(r),r}function _p(t){var e=new Float64Array(t.length*2),r=0,n=gp(t),i;try{for(n.s();!(i=n.n()).done;){var o=i.value;e[r++]=o[0],e[r++]=o[1]}}catch(s){n.e(s)}finally{n.f()}return e}function vp(t,e){return CE(t)||BE(t,e)||bp(t,e)||SE()}function SE(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
41
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BE(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function CE(t){if(Array.isArray(t))return t}function ME(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=bp(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
42
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function bp(t,e){if(t){if(typeof t=="string")return xp(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xp(t,e)}}function xp(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function wE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function IE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Vc(t,e)}function Vc(t,e){return Vc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Vc(t,e)}function OE(t){var e=PE();return function(){var n=Oo(t),i;if(e){var o=Oo(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return RE(this,i)}}function RE(t,e){if(e&&(zn(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return LE(t)}function LE(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Oo(t){return Oo=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Oo(t)}function Tp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Ro(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tp(Object(r),!0).forEach(function(n){FE(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function FE(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zn(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?zn=function(r){return typeof r}:zn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},zn(t)}var DE=10;function NE(t,e){var r;return t==null?r=e:zn(t)==="object"?r=Ro(Ro({},t),{},{coverage:e}):r={getHexagon:t,coverage:e},r}var UE=Ro(Ro({},jn.PolygonLayer.defaultProps),{},{highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:function(e){return e.hexagon}},extruded:!0}),cr=function(t){IE(r,t);var e=OE(r);function r(){var i;wE(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=e.call.apply(e,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){r._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}},n.shouldUpdateState=function(o){var s=o.changeFlags;return this._shouldUseHighPrecision()?s.propsOrDataChanged:s.somethingChanged},n.updateState=function(o){var s=o.props,a=o.changeFlags;if(s.highPrecision!==!0&&(a.dataChanged||a.updateTriggersChanged&&a.updateTriggersChanged.getHexagon)){var c=this._calculateH3DataProps();this.setState(c)}this._updateVertices(this.context.viewport)},n._calculateH3DataProps=function(){var o=-1,s=!1,a=!1,c=(0,Lo.createIterable)(this.props.data),u=c.iterable,l=c.objectInfo,f=ME(u),h;try{for(f.s();!(h=f.n()).done;){var d=h.value;l.index++;var p=this.props.getHexagon(d,l),g=(0,Fe.getResolution)(p);if(o<0){if(o=g,!this.props.highPrecision)break}else if(o!==g){a=!0;break}if((0,Fe.isPentagon)(p)){s=!0;break}}}catch(m){f.e(m)}finally{f.f()}return{resolution:o,edgeLengthKM:o>=0?(0,Fe.getHexagonEdgeLengthAvg)(o,"km"):0,hasMultipleRes:a,hasPentagon:s}},n._shouldUseHighPrecision=function(){if(this.props.highPrecision==="auto"){var o=this.state,s=o.resolution,a=o.hasPentagon,c=o.hasMultipleRes,u=this.context.viewport;return Boolean(u?.resolution)||c||a||s>=0&&s<=5}return this.props.highPrecision},n._updateVertices=function(o){if(!this._shouldUseHighPrecision()){var s=this.state,a=s.resolution,c=s.edgeLengthKM,u=s.centerHex;if(!(a<0)){var l=this.props.centerHexagon||(0,Fe.latLngToCell)(o.latitude,o.longitude,a);if(u!==l){if(u)try{var f=(0,Fe.gridDistance)(u,l);if(f*c<DE)return}catch{}var h=o.distanceScales.unitsPerMeter,d=Hc(l),p=(0,Fe.cellToLatLng)(l),g=vp(p,2),m=g[0],A=g[1],_=o.projectFlat([A,m]),v=vp(_,2),x=v[0],B=v[1];d=d.map(function(S){var C=o.projectFlat(S);return[(C[0]-x)/h[0],(C[1]-B)/h[1]]}),this.setState({centerHex:l,vertices:d})}}}},n.renderLayers=function(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()},n._getForwardProps=function(){var o=this.props,s=o.elevationScale,a=o.material,c=o.coverage,u=o.extruded,l=o.wireframe,f=o.stroked,h=o.filled,d=o.lineWidthUnits,p=o.lineWidthScale,g=o.lineWidthMinPixels,m=o.lineWidthMaxPixels,A=o.getFillColor,_=o.getElevation,v=o.getLineColor,x=o.getLineWidth,B=o.transitions,S=o.updateTriggers;return{elevationScale:s,extruded:u,coverage:c,wireframe:l,stroked:f,filled:h,lineWidthUnits:d,lineWidthScale:p,lineWidthMinPixels:g,lineWidthMaxPixels:m,material:a,getElevation:_,getFillColor:A,getLineColor:v,getLineWidth:x,transitions:B,updateTriggers:{getFillColor:S.getFillColor,getElevation:S.getElevation,getLineColor:S.getLineColor,getLineWidth:S.getLineWidth}}},n._renderPolygonLayer=function(){var o=this.props,s=o.data,a=o.getHexagon,c=o.updateTriggers,u=o.coverage,l=this.getSubLayerClass("hexagon-cell-hifi",jn.PolygonLayer),f=this._getForwardProps();return f.updateTriggers.getPolygon=NE(c.getHexagon,u),new l(f,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:f.updateTriggers}),{data:s,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:function(d,p){var g=a(d,p);return _p(Hc(g,u))}})},n._renderColumnLayer=function(){var o=this.props,s=o.data,a=o.getHexagon,c=o.updateTriggers,u=this.getSubLayerClass("hexagon-cell",jn.ColumnLayer),l=this._getForwardProps();return l.updateTriggers.getPosition=c.getHexagon,new u(l,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:l.updateTriggers}),{data:s,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:Ap.bind(null,a)})},r}(Lo.CompositeLayer);cr.defaultProps=UE;cr.layerName="H3HexagonLayer";cr._checkH3Lib=function(){};function Po(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Po=function(r){return typeof r}:Po=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Po(t)}function zc(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=GE(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
43
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function GE(t,e){if(t){if(typeof t=="string")return Ep(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ep(t,e)}}function Ep(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function HE(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function VE(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jc(t,e)}function jc(t,e){return jc=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},jc(t,e)}function zE(t){var e=JE();return function(){var n=Fo(t),i;if(e){var o=Fo(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return jE(this,i)}}function jE(t,e){if(e&&(Po(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kE(t)}function kE(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function JE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Fo(t){return Fo=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Fo(t)}var qE={getHexagons:{type:"accessor",value:function(e){return e.hexagons}}},Do=function(t){VE(r,t);var e=zE(r);function r(){var i;HE(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=e.call.apply(e,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){cr._checkH3Lib()},n.updateState=function(o){var s=o.props,a=o.changeFlags;if(a.dataChanged||a.updateTriggersChanged&&a.updateTriggersChanged.getHexagons){var c=s.data,u=s.getHexagons,l=[],f=(0,Bp.createIterable)(c),h=f.iterable,d=f.objectInfo,p=zc(h),g;try{for(p.s();!(g=p.n()).done;){var m=g.value;d.index++;var A=u(m,d),_=(0,Sp.cellsToMultiPolygon)(A,!0),v=zc(_),x;try{for(v.s();!(x=v.n()).done;){var B=x.value,S=zc(B),C;try{for(S.s();!(C=S.n()).done;){var E=C.value;Io(E)}}catch(b){S.e(b)}finally{S.f()}l.push(this.getSubLayerRow({polygon:B},m,d.index))}}catch(b){v.e(b)}finally{v.f()}}}catch(b){p.e(b)}finally{p.f()}this.setState({polygons:l})}},n.indexToBounds=function(){var o=this.props,s=o.getElevation,a=o.getFillColor,c=o.getLineColor,u=o.getLineWidth;return{data:this.state.polygons,getPolygon:function(f){return f.polygon},getElevation:this.getSubLayerAccessor(s),getFillColor:this.getSubLayerAccessor(a),getLineColor:this.getSubLayerAccessor(c),getLineWidth:this.getSubLayerAccessor(u)}},r}(Le);Do.layerName="H3ClusterLayer";Do.defaultProps=qE;var Ho=P(_t(),1),ce=P(_t(),1),sm=P(_t(),1);var ne=t=>`${t}`;function st(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var kc={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function wp(t){let e={};for(let[r,n]of Object.entries(t))e[r]=WE(n);return e}function Ip(t,e,r){let n={};for(let[i,o]of Object.entries(e))t&&i in t&&!o.private?(o.validate&&st(o.validate(t[i],o),`${r}: invalid ${i}`),n[i]=t[i]):n[i]=o.value;return n}function WE(t){let e=Mp(t);if(e!=="object")return{value:t,...kc[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...kc[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=Mp(t.value),{...t,...kc[e],type:e}):{type:"object",value:null};throw new Error("props")}function Mp(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var Op=ne`\
44
- #ifdef MODULE_LOGDEPTH
45
- logdepth_adjustPosition(gl_Position);
46
- #endif
47
- `,Rp=ne`\
48
- #ifdef MODULE_MATERIAL
49
- gl_FragColor = material_filterColor(gl_FragColor);
50
- #endif
51
-
52
- #ifdef MODULE_LIGHTING
53
- gl_FragColor = lighting_filterColor(gl_FragColor);
54
- #endif
55
-
56
- #ifdef MODULE_FOG
57
- gl_FragColor = fog_filterColor(gl_FragColor);
58
- #endif
59
-
60
- #ifdef MODULE_PICKING
61
- gl_FragColor = picking_filterHighlightColor(gl_FragColor);
62
- gl_FragColor = picking_filterPickingColor(gl_FragColor);
63
- #endif
64
-
65
- #ifdef MODULE_LOGDEPTH
66
- logdepth_setFragDepth();
67
- #endif
68
- `;var XE={vertex:Op,fragment:Rp},Lp=/void\s+main\s*\([^)]*\)\s*\{\n?/,Pp=/}\n?[^{}]*$/,Jc=[],kn="__LUMA_INJECT_DECLARATIONS__";function Fp(t){let e={vertex:{},fragment:{}};for(let r in t){let n=t[r],i=KE(r);typeof n=="string"&&(n={order:0,injection:n}),e[i][r]=n}return e}function KE(t){let e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function Jn(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=e==="vertex";for(let o in r){let s=r[o];s.sort((c,u)=>c.order-u.order),Jc.length=s.length;for(let c=0,u=s.length;c<u;++c)Jc[c]=s[c].injection;let a=`${Jc.join(`
69
- `)}
70
- `;switch(o){case"vs:#decl":i&&(t=t.replace(kn,a));break;case"vs:#main-start":i&&(t=t.replace(Lp,c=>c+a));break;case"vs:#main-end":i&&(t=t.replace(Pp,c=>a+c));break;case"fs:#decl":i||(t=t.replace(kn,a));break;case"fs:#main-start":i||(t=t.replace(Lp,c=>c+a));break;case"fs:#main-end":i||(t=t.replace(Pp,c=>a+c));break;default:t=t.replace(o,c=>c+a)}}return t=t.replace(kn,""),n&&(t=t.replace(/\}\s*$/,o=>o+XE[e])),t}var YE=1,qe=class{static instantiateModules(e){return e.map(r=>{if(r instanceof qe)return r;st(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${YE++}`);let n=new qe(r);return n.dependencies=qe.instantiateModules(r.dependencies||[]),n})}constructor(e){this.name=void 0,this.vs=void 0,this.fs=void 0,this.getModuleUniforms=void 0,this.dependencies=void 0,this.deprecations=void 0,this.defines=void 0,this.injections=void 0,this.uniforms={},this.uniformTypes={};let{name:r,vs:n,fs:i,dependencies:o=[],uniformPropTypes:s={},getUniforms:a,deprecations:c=[],defines:u={},inject:l={}}=e;st(typeof r=="string"),this.name=r,this.vs=n,this.fs=i,this.getModuleUniforms=a,this.dependencies=qe.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(c),this.defines=u,this.injections=Fp(l),s&&(this.uniforms=wp(s))}getModuleSource(e){let r;switch(e){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:st(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
71
-
72
- #define MODULE_${n}
73
- ${r}
74
-
75
- `}getUniforms(e,r){return this.getModuleUniforms?this.getModuleUniforms(e,r):Ip(e,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(e,r){this.deprecations.forEach(n=>{var i;(i=n.regex)!==null&&i!==void 0&&i.test(e)&&(n.deprecated?r.deprecated(n.old,n.new)():r.removed(n.old,n.new)())})}_parseDeprecationDefinitions(e){return e.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),e}_defaultGetUniforms(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},n=this.uniforms;for(let i in n){let o=n[i];i in e&&!o.private?(o.validate&&st(o.validate(e[i],o),`${this.name}: invalid ${i}`),r[i]=e[i]):r[i]=o.value}return r}};function qn(t){let e=qe.instantiateModules(t);return ZE(e)}function ZE(t){let e={},r={};return Dp({modules:t,level:0,moduleMap:e,moduleDepth:r}),Object.keys(r).sort((n,i)=>r[i]-r[n]).map(n=>e[n])}function Dp(t){let{modules:e,level:r,moduleMap:n,moduleDepth:i}=t;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let o of e)n[o.name]=o,(i[o.name]===void 0||i[o.name]<r)&&(i[o.name]=r);for(let o of e)o.dependencies&&Dp({modules:o.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}function Np(t){switch(t?.gpu.toLowerCase()){case"apple":return ne`\
76
- #define APPLE_GPU
77
- // Apple optimizes away the calculation necessary for emulated fp64
78
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
79
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
80
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
81
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
82
- `;case"nvidia":return ne`\
83
- #define NVIDIA_GPU
84
- // Nvidia optimizes away the calculation necessary for emulated fp64
85
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
86
- `;case"intel":return ne`\
87
- #define INTEL_GPU
88
- // Intel optimizes away the calculation necessary for emulated fp64
89
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
90
- // Intel's built-in 'tan' function doesn't have acceptable precision
91
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
92
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
93
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
94
- `;case"amd":return ne`\
95
- #define AMD_GPU
96
- `;default:return ne`\
97
- #define DEFAULT_GPU
98
- // Prevent driver from optimizing away the calculation necessary for emulated fp64
99
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
100
- // Headless Chrome's software shader 'tan' function doesn't have acceptable precision
101
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
102
- // If the GPU doesn't have full 32 bits precision, will causes overflow
103
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
104
- `}}function Up(t){let e="";return t.features.has("webgl2")&&(e+=ne`\
105
- # define FEATURE_GLSL_DERIVATIVES
106
- # define FEATURE_GLSL_DRAW_BUFFERS
107
- # define FEATURE_GLSL_FRAG_DEPTH
108
- # define FEATURE_GLSL_TEXTURE_LOD
109
- `),t.features.has("webgl2")||(t.features.has("glsl-frag-depth")&&(e+=ne`\
110
-
111
- // FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
112
- #ifdef GL_EXT_frag_depth
113
- # extension GL_EXT_frag_depth : enable
114
- # define FEATURE_GLSL_FRAG_DEPTH
115
- # define FRAG_DEPTH
116
- # define gl_FragDepth gl_FragDepthEXT
117
- #endif
118
- `),t!=null&&t.features.has("glsl-derivatives")&&(e+=ne`\
119
-
120
- // FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available
121
- #if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
122
- # extension GL_OES_standard_derivatives : enable
123
- # define FEATURE_GLSL_DERIVATIVES
124
- #endif
125
- `),t!=null&&t.features.has("glsl-frag-data")&&(e+=ne`\
126
-
127
- // FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available
128
- #ifdef GL_EXT_draw_buffers
129
- # extension GL_EXT_draw_buffers : require
130
- # define FEATURE_GLSL_DRAW_BUFFERS
131
- #endif
132
- `),t!=null&&t.features.has("glsl-texture-lod")&&(e+=ne`\
133
- // TEXTURE_LOD => texture2DLod etc are available
134
- #ifdef GL_EXT_shader_texture_lod
135
- # extension GL_EXT_shader_texture_lod : enable
136
- # define FEATURE_GLSL_TEXTURE_LOD
137
- # define TEXTURE_LOD
138
- #endif
139
- `)),e}function Hp(t,e,r){var n;if(Number(((n=t.match(/^#version[ \t]+(\d+)/m))===null||n===void 0?void 0:n[1])||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(e){case 300:switch(r){case"vertex":return t=Wn(t,QE),t;case"fragment":return t=Wn(t,$E),t;default:throw new Error(r)}case 100:switch(r){case"vertex":return t=Wn(t,eS),t;case"fragment":return t=Wn(t,jp),t=rS(t),t;default:throw new Error(r)}default:throw new Error(String(e))}}var Vp=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
140
- `],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],QE=[...Vp,[Hr("attribute"),"in $1"],[Hr("varying"),"out $1"]],$E=[...Vp,[Hr("varying"),"in $1"]],zp=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],eS=[...zp,[Hr("in"),"attribute $1"],[Hr("out"),"varying $1"]],jp=[...zp,[Hr("in"),"varying $1"]],tS="gl_FragColor",Gp=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function Wn(t,e){for(let[r,n]of e)t=t.replace(r,n);return t}function rS(t){t=Wn(t,jp);let e=Gp.exec(t);if(e){let r=e[1];t=t.replace(Gp,"").replace(new RegExp(`\\b${r}\\b`,"g"),tS)}return t}function Hr(t){return new RegExp(`\\b${t}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function qc(t,e){let r="";for(let n in t){let i=t[n];if(r+=`void ${i.signature} {
141
- `,i.header&&(r+=` ${i.header}`),e[n]){let o=e[n];o.sort((s,a)=>s.order-a.order);for(let s of o)r+=` ${s.injection}
142
- `}i.footer&&(r+=` ${i.footer}`),r+=`}
143
- `}return r}function Wc(t){let e={vertex:{},fragment:{}};for(let r of t){let n,i;typeof r!="string"?(n=r,i=n.hook):(n={},i=r),i=i.trim();let[o,s]=i.split(":"),a=i.replace(/\(.+/,""),c=Object.assign(n,{signature:s});switch(o){case"vs":e.vertex[a]=c;break;case"fs":e.fragment[a]=c;break;default:throw new Error(o)}}return e}function kp(t,e){return{name:nS(t,e),language:"glsl",version:iS(t)}}function nS(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return n?n[1]:e}function iS(t){let e=100,r=t.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let n=parseInt(r[1],10);Number.isFinite(n)&&(e=n)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}var Xp=`
144
-
145
- ${kn}
146
- `,oS=ne`\
147
- precision highp float;
148
- `;function Kp(t){let{vs:e,fs:r}=t,n=qn(t.modules||[]);switch(t.platformInfo.shaderLanguage){case"glsl":return{vs:qp(t.platformInfo,{...t,source:e,stage:"vertex",modules:n}),fs:qp(t.platformInfo,{...t,source:r,stage:"fragment",modules:n}),getUniforms:Wp(n)};case"wgsl":return{vs:Jp(t.platformInfo,{...t,source:e,stage:"vertex",modules:n}),fs:Jp(t.platformInfo,{...t,source:r,stage:"fragment",modules:n}),getUniforms:Wp(n)}}}function Jp(t,e){let{source:r,stage:n,modules:i,defines:o={},hookFunctions:s=[],inject:a={},log:c}=e;st(typeof r=="string","shader source must be a string");let u=r,l={};i.forEach(m=>{Object.assign(l,m.getDefines())}),Object.assign(l,o);let f="",h=Wc(s),d={},p={},g={};for(let m in a){let A=typeof a[m]=="string"?{injection:a[m],order:0}:a[m],_=/^(v|f)s:(#)?([\w-]+)$/.exec(m);if(_){let v=_[2],x=_[3];v?x==="decl"?p[m]=[A]:g[m]=[A]:d[m]=[A]}else g[m]=[A]}for(let m of i){c&&m.checkDeprecations(u,c);let A=m.getModuleSource(n,"wgsl");f+=A;let _=m.injections[n];for(let v in _){let x=/^(v|f)s:#([\w-]+)$/.exec(v);if(x){let S=x[2]==="decl"?p:g;S[v]=S[v]||[],S[v].push(_[v])}else d[v]=d[v]||[],d[v].push(_[v])}}return f+=Xp,f=Jn(f,n,p),f+=qc(h[n],d),f+=u,f=Jn(f,n,g),f}function qp(t,e){let{id:r,source:n,stage:i,language:o="glsl",modules:s,defines:a={},hookFunctions:c=[],inject:u={},prologue:l=!0,log:f}=e;st(typeof n=="string","shader source must be a string");let h=o==="glsl"?kp(n).version:-1,d=t.shaderLanguageVersion,p=h===100?"#version 100":"#version 300 es",m=n.split(`
149
- `).slice(1).join(`
150
- `),A={};s.forEach(C=>{Object.assign(A,C.getDefines())}),Object.assign(A,a);let _="";switch(o){case"wgsl":break;case"glsl":_=l?`${p}
151
-
152
- // ----- PROLOGUE -------------------------
153
- ${sS({id:r,source:n,stage:i})}
154
- ${`#define SHADER_TYPE_${i.toUpperCase()}`}
155
- ${Np(t)}
156
- ${Up(t)}
157
- ${i==="fragment"?oS:""}
158
-
159
- // ----- APPLICATION DEFINES -------------------------
160
-
161
- ${aS(A)}
162
-
163
- `:`${p}
164
- `;break}let v=Wc(c),x={},B={},S={};for(let C in u){let E=typeof u[C]=="string"?{injection:u[C],order:0}:u[C],b=/^(v|f)s:(#)?([\w-]+)$/.exec(C);if(b){let y=b[2],M=b[3];y?M==="decl"?B[C]=[E]:S[C]=[E]:x[C]=[E]}else S[C]=[E]}for(let C of s){f&&C.checkDeprecations(m,f);let E=C.getModuleSource(i);_+=E;let b=C.injections[i];for(let y in b){let M=/^(v|f)s:#([\w-]+)$/.exec(y);if(M){let O=M[2]==="decl"?B:S;O[y]=O[y]||[],O[y].push(b[y])}else x[y]=x[y]||[],x[y].push(b[y])}}return _+="// ----- MAIN SHADER SOURCE -------------------------",_+=Xp,_=Jn(_,i,B),_+=qc(v[i],x),_+=m,_=Jn(_,i,S),o==="glsl"&&h!==d&&(_=Hp(_,d,i)),_.trim()}function Wp(t){return function(r){let n={};for(let i of t){let o=i.getUniforms(r,n);Object.assign(n,o)}return n}}function sS(t){let{id:e,source:r,stage:n}=t;return e&&r.indexOf("SHADER_NAME")===-1?`
165
- #define SHADER_NAME ${e}_${n}
166
-
167
- `:""}function aS(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e="";for(let r in t){let n=t[r];(n||Number.isFinite(n))&&(e+=`#define ${r.toUpperCase()} ${t[r]}
168
- `)}return e}function Zp(t){if(!t.vs)throw new Error("no vertex shader");let e=Yp(t.platformInfo,t.vs),r;return t.fs&&(r=Yp(t.platformInfo,t.fs)),{...t,vs:e,fs:r}}function Yp(t,e){if(typeof e=="string")return e;switch(t.type){case"webgpu":if(e!=null&&e.wgsl)return e.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(e!=null&&e.glsl)return e.glsl;throw new Error("WebGL does not support WGSL shaders")}}var We=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return We.defaultShaderAssembler=We.defaultShaderAssembler||new We,We.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(r=>r.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){let r=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==r)}addShaderHook(e,r){r&&(e=Object.assign(r,{hook:e})),this._hookFunctions.push(e)}assembleShaders(e){let r=this._getModuleList(e.modules),n=this._hookFunctions,i=Zp(e);return{...Kp({platformInfo:e.platformInfo,...i,modules:r,hookFunctions:n}),modules:r}}_getModuleList(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+e.length),n={},i=0;for(let o=0,s=this._defaultModules.length;o<s;++o){let a=this._defaultModules[o],c=a.name;r[i++]=a,n[c]=!0}for(let o=0,s=e.length;o<s;++o){let a=e[o],c=a.name;n[c]||(r[i++]=a,n[c]=!0)}return r.length=i,qe.instantiateModules(r)}};We.defaultShaderAssembler=void 0;var Xc=ne`\
169
- #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
170
-
28
+ `},t}initializeState(){super.initializeState(),this.getAttributeManager().addInstanced({timestamps:{size:1,accessor:"getTimestamps",shaderAttributes:{instanceTimestamps:{vertexOffset:0},instanceNextTimestamps:{vertexOffset:1}}}})}draw(t){let{fadeTrail:n,trailLength:r,currentTime:s}=this.props;t.uniforms={...t.uniforms,fadeTrail:n,trailLength:r,currentTime:s},super.draw(t)}},mr=Hs;(()=>{Hs.layerName="TripsLayer"})(),(()=>{Hs.defaultProps=Uy})();var xf=N(zs(),1),yf=N(Dt(),1);var Rt=N(zs(),1),Js=N(Dt(),1),Ar=N(Nt(),1);var gr=N(zs(),1);function ks(e,t){t=t===void 0?e[0][0]:t;for(let n of e){let r=n[0]-t;r>180?n[0]-=360:r<-180&&(n[0]+=360)}}function Gy(e,t,n){let[r,s]=(0,gr.cellToLatLng)(e),i=t.length;ks(t,s);let o=t[0]===t[i-1]?i-1:i;for(let a=0;a<o;a++)t[a][0]=ye(s,t[a][0],n),t[a][1]=ye(r,t[a][1],n)}function gf(e,t,n){let r=e(t,n),[s,i]=(0,gr.cellToLatLng)(r);return[i,s]}function wa(e,t=1){let n=(0,gr.cellToBoundary)(e,!0);return t!==1?Gy(e,n,t):ks(n),n}function Af(e){let t=new Float64Array(e.length*2),n=0;for(let r of e)t[n++]=r[0],t[n++]=r[1];return t}var Vy=10;function Hy(e,t){let n;return e==null?n=t:typeof e=="object"?n={...e,coverage:t}:n={getHexagon:e,coverage:t},n}var zy={...Ar.PolygonLayer.defaultProps,highPrecision:"auto",coverage:{type:"number",min:0,max:1,value:1},centerHexagon:null,getHexagon:{type:"accessor",value:e=>e.hexagon},extruded:!0},Tn=class extends Js.CompositeLayer{initializeState(){Tn._checkH3Lib(),this.state={edgeLengthKM:0,resolution:-1}}shouldUpdateState({changeFlags:t}){return this._shouldUseHighPrecision()?t.propsOrDataChanged:t.somethingChanged}updateState({props:t,changeFlags:n}){if(t.highPrecision!==!0&&(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagon)){let r=this._calculateH3DataProps();this.setState(r)}this._updateVertices(this.context.viewport)}_calculateH3DataProps(){let t=-1,n=!1,r=!1,{iterable:s,objectInfo:i}=(0,Js.createIterable)(this.props.data);for(let o of s){i.index++;let a=this.props.getHexagon(o,i),c=(0,Rt.getResolution)(a);if(t<0){if(t=c,!this.props.highPrecision)break}else if(t!==c){r=!0;break}if((0,Rt.isPentagon)(a)){n=!0;break}}return{resolution:t,edgeLengthKM:t>=0?(0,Rt.getHexagonEdgeLengthAvg)(t,"km"):0,hasMultipleRes:r,hasPentagon:n}}_shouldUseHighPrecision(){if(this.props.highPrecision==="auto"){let{resolution:t,hasPentagon:n,hasMultipleRes:r}=this.state,{viewport:s}=this.context;return Boolean(s?.resolution)||r||n||t>=0&&t<=5}return this.props.highPrecision}_updateVertices(t){if(this._shouldUseHighPrecision())return;let{resolution:n,edgeLengthKM:r,centerHex:s}=this.state;if(n<0)return;let i=this.props.centerHexagon||(0,Rt.latLngToCell)(t.latitude,t.longitude,n);if(s===i)return;if(s)try{if((0,Rt.gridDistance)(s,i)*r<Vy)return}catch{}let{unitsPerMeter:o}=t.distanceScales,a=wa(i),[c,l]=(0,Rt.cellToLatLng)(i),[u,h]=t.projectFlat([l,c]);a=a.map(f=>{let d=t.projectFlat(f);return[(d[0]-u)/o[0],(d[1]-h)/o[1]]}),this.setState({centerHex:i,vertices:a})}renderLayers(){return this._shouldUseHighPrecision()?this._renderPolygonLayer():this._renderColumnLayer()}_getForwardProps(){let{elevationScale:t,material:n,coverage:r,extruded:s,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,getFillColor:f,getElevation:d,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:y}=this.props;return{elevationScale:t,extruded:s,coverage:r,wireframe:i,stroked:o,filled:a,lineWidthUnits:c,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,material:n,getElevation:d,getFillColor:f,getLineColor:p,getLineWidth:A,transitions:g,updateTriggers:{getFillColor:y.getFillColor,getElevation:y.getElevation,getLineColor:y.getLineColor,getLineWidth:y.getLineWidth}}}_renderPolygonLayer(){let{data:t,getHexagon:n,updateTriggers:r,coverage:s}=this.props,i=this.getSubLayerClass("hexagon-cell-hifi",Ar.PolygonLayer),o=this._getForwardProps();return o.updateTriggers.getPolygon=Hy(r.getHexagon,s),new i(o,this.getSubLayerProps({id:"hexagon-cell-hifi",updateTriggers:o.updateTriggers}),{data:t,_normalize:!1,_windingOrder:"CCW",positionFormat:"XY",getPolygon:(a,c)=>{let l=n(a,c);return Af(wa(l,s))}})}_renderColumnLayer(){let{data:t,getHexagon:n,updateTriggers:r}=this.props,s=this.getSubLayerClass("hexagon-cell",Ar.ColumnLayer),i=this._getForwardProps();return i.updateTriggers.getPosition=r.getHexagon,new s(i,this.getSubLayerProps({id:"hexagon-cell",flatShading:!0,updateTriggers:i.updateTriggers}),{data:t,diskResolution:6,radius:1,vertices:this.state.vertices,getPosition:gf.bind(null,n)})}},Je=Tn;(()=>{Tn.defaultProps=zy})(),(()=>{Tn.layerName="H3HexagonLayer"})(),(()=>{Tn._checkH3Lib=()=>{}})();var ky={getHexagons:{type:"accessor",value:e=>e.hexagons}},qs=class extends It{initializeState(){Je._checkH3Lib()}updateState({props:t,changeFlags:n}){if(n.dataChanged||n.updateTriggersChanged&&n.updateTriggersChanged.getHexagons){let{data:r,getHexagons:s}=t,i=[],{iterable:o,objectInfo:a}=(0,yf.createIterable)(r);for(let c of o){a.index++;let l=s(c,a),u=(0,xf.cellsToMultiPolygon)(l,!0);for(let h of u){for(let f of h)ks(f);i.push(this.getSubLayerRow({polygon:h},c,a.index))}}this.setState({polygons:i})}}indexToBounds(){let{getElevation:t,getFillColor:n,getLineColor:r,getLineWidth:s}=this.props;return{data:this.state.polygons,getPolygon:i=>i.polygon,getElevation:this.getSubLayerAccessor(t),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(r),getLineWidth:this.getSubLayerAccessor(s)}}},xr=qs;(()=>{qs.layerName="H3ClusterLayer"})(),(()=>{qs.defaultProps=ky})();var lm=N(va(),1),ve=N(Dt(),1),um=N(Nt(),1),hm=N(js(),1);var Cf=N(Bf(),1),Ht;(function(e){e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.LINEAR=9729]="LINEAR",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL"})(Ht||(Ht={}));function Fa(e,t,n,r){let s={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};s.defines.USE_TEX_LOD=1;let{imageBasedLightingEnvironment:i}=r;return i&&(s.bindings.u_DiffuseEnvSampler=i.diffuseEnvSampler,s.bindings.u_SpecularEnvSampler=i.specularEnvSampler,s.bindings.u_brdfLUT=i.brdfLutTexture,s.uniforms.u_ScaleIBLAmbient=[1,1]),r?.pbrDebug&&(s.defines.PBR_DEBUG=1,s.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],s.uniforms.u_ScaleFGDSpec=[0,0,0,0]),n.NORMAL&&(s.defines.HAS_NORMALS=1),n.TANGENT&&r?.useTangents&&(s.defines.HAS_TANGENTS=1),n.TEXCOORD_0&&(s.defines.HAS_UV=1),r?.imageBasedLightingEnvironment&&(s.defines.USE_IBL=1),r?.lights&&(s.defines.USE_LIGHTS=1),t&&Jy(e,t,s),s}function Jy(e,t,n){if(n.uniforms.pbr_uUnlit=Boolean(t.unlit),t.pbrMetallicRoughness&&qy(e,t.pbrMetallicRoughness,n),t.normalTexture){yr(e,t.normalTexture,"u_NormalSampler","HAS_NORMALMAP",n);let{scale:r=1}=t.normalTexture;n.uniforms.u_NormalScale=r}if(t.occlusionTexture){yr(e,t.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",n);let{strength:r=1}=t.occlusionTexture;n.uniforms.u_OcclusionStrength=r}switch(t.emissiveTexture&&(yr(e,t.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",n),n.uniforms.u_EmissiveFactor=t.emissiveFactor||[0,0,0]),t.alphaMode){case"MASK":let{alphaCutoff:r=.5}=t;n.defines.ALPHA_CUTOFF=1,n.uniforms.u_AlphaCutoff=r;break;case"BLEND":Cf.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),n.parameters.blendColorOperation="add",n.parameters.blendColorSrcFactor="src-alpha",n.parameters.blendColorDstFactor="one-minus-src-alpha",n.parameters.blendAlphaOperation="add",n.parameters.blendAlphaSrcFactor="one",n.parameters.blendAlphaDstFactor="one-minus-src-alpha",n.glParameters.blend=!0,n.glParameters.blendEquation=Ht.FUNC_ADD,n.glParameters.blendFunc=[Ht.SRC_ALPHA,Ht.ONE_MINUS_SRC_ALPHA,Ht.ONE,Ht.ONE_MINUS_SRC_ALPHA];break}}function qy(e,t,n){t.baseColorTexture&&yr(e,t.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",n),n.uniforms.u_BaseColorFactor=t.baseColorFactor||[1,1,1,1],t.metallicRoughnessTexture&&yr(e,t.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",n);let{metallicFactor:r=1,roughnessFactor:s=1}=t;n.uniforms.u_MetallicRoughnessValues=[r,s]}function yr(e,t,n,r=null,s){let i=t?.texture?.sampler?.parameters||{},o=t.texture.source.image,a,c={};o.compressed?(a=o,c={[Ht.TEXTURE_MIN_FILTER]:o.data.length>1?Ht.LINEAR_MIPMAP_NEAREST:Ht.LINEAR}):a={data:o};let l=e.createTexture({id:t.uniformName||t.id,parameters:{...i,...c},pixelStore:{[Ht.UNPACK_FLIP_Y_WEBGL]:!1},...a});s.bindings[n]=l,r&&(s.defines[r]=1),s.generatedTextures.push(l)}var OR=new Uint8Array([0]);var bf,Sf,Mf,If,wf,vf,Ff,Rf;(function(e){e[e.NONE=0]="NONE",e[e.BASISLZ=1]="BASISLZ",e[e.ZSTD=2]="ZSTD",e[e.ZLIB=3]="ZLIB"})(bf||(bf={})),function(e){e[e.BASICFORMAT=0]="BASICFORMAT"}(Sf||(Sf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.ETC1S=163]="ETC1S",e[e.UASTC=166]="UASTC"}(Mf||(Mf={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SRGB=1]="SRGB"}(If||(If={})),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LINEAR=1]="LINEAR",e[e.SRGB=2]="SRGB",e[e.ITU=3]="ITU",e[e.NTSC=4]="NTSC",e[e.SLOG=5]="SLOG",e[e.SLOG2=6]="SLOG2"}(wf||(wf={})),function(e){e[e.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",e[e.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(vf||(vf={})),function(e){e[e.RGB=0]="RGB",e[e.RRR=3]="RRR",e[e.GGG=4]="GGG",e[e.AAA=15]="AAA"}(Ff||(Ff={})),function(e){e[e.RGB=0]="RGB",e[e.RGBA=3]="RGBA",e[e.RRR=4]="RRR",e[e.RRRG=5]="RRRG"}(Rf||(Rf={}));var Ra=`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
171
29
  struct AmbientLight {
172
- vec3 color;
30
+ vec3 color;
173
31
  };
174
-
175
32
  struct PointLight {
176
- vec3 color;
177
- vec3 position;
178
-
179
- // Constant-Linear-Exponential
180
- vec3 attenuation;
33
+ vec3 color;
34
+ vec3 position;
35
+ vec3 attenuation;
181
36
  };
182
-
183
37
  struct DirectionalLight {
184
- vec3 color;
185
- vec3 direction;
38
+ vec3 color;
39
+ vec3 direction;
186
40
  };
187
-
188
41
  uniform AmbientLight lighting_uAmbientLight;
189
42
  uniform PointLight lighting_uPointLight[MAX_LIGHTS];
190
43
  uniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];
191
44
  uniform int lighting_uPointLightCount;
192
45
  uniform int lighting_uDirectionalLightCount;
193
-
194
46
  uniform bool lighting_uEnabled;
195
-
196
47
  float getPointLightAttenuation(PointLight pointLight, float distance) {
197
- return pointLight.attenuation.x
198
- + pointLight.attenuation.y * distance
199
- + pointLight.attenuation.z * distance * distance;
48
+ return pointLight.attenuation.x
49
+ + pointLight.attenuation.y * distance
50
+ + pointLight.attenuation.z * distance * distance;
200
51
  }
201
-
202
52
  #endif
203
- `;var cS={lightSources:{}};function Kc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{color:e=[0,0,0],intensity:r=1}=t;return e.map(n=>n*r/255)}function uS(t){let{ambientLight:e,pointLights:r=[],directionalLights:n=[]}=t,i={};return e?i["lighting_uAmbientLight.color"]=Kc(e):i["lighting_uAmbientLight.color"]=[0,0,0],r.forEach((o,s)=>{i[`lighting_uPointLight[${s}].color`]=Kc(o),i[`lighting_uPointLight[${s}].position`]=o.position,i[`lighting_uPointLight[${s}].attenuation`]=o.attenuation||[1,0,0]}),i.lighting_uPointLightCount=r.length,n.forEach((o,s)=>{i[`lighting_uDirectionalLight[${s}].color`]=Kc(o),i[`lighting_uDirectionalLight[${s}].direction`]=o.direction}),i.lighting_uDirectionalLightCount=n.length,i}function Qp(){var t,e;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:cS;if("lightSources"in r){let{ambientLight:n,pointLights:i,directionalLights:o}=r.lightSources||{};return n||i&&i.length>0||o&&o.length>0?Object.assign({},uS({ambientLight:n,pointLights:i,directionalLights:o}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in r){let n={pointLights:[],directionalLights:[]};for(let i of r.lights||[])switch(i.type){case"ambient":n.ambientLight=i;break;case"directional":(t=n.directionalLights)===null||t===void 0||t.push(i);break;case"point":(e=n.pointLights)===null||e===void 0||e.push(i);break;default:}return Qp({lightSources:n})}return{}}var $p={name:"lights",vs:Xc,fs:Xc,getUniforms:Qp,defines:{MAX_LIGHTS:3}};var em=ne`\
204
- uniform mat4 u_MVPMatrix;
53
+ `;var jy={lightSources:{}};function La(e={}){let{color:t=[0,0,0],intensity:n=1}=e;return t.map(r=>r*n/255)}function Xy({ambientLight:e,pointLights:t=[],directionalLights:n=[]}){let r={};return e?r["lighting_uAmbientLight.color"]=La(e):r["lighting_uAmbientLight.color"]=[0,0,0],t.forEach((s,i)=>{r[`lighting_uPointLight[${i}].color`]=La(s),r[`lighting_uPointLight[${i}].position`]=s.position,r[`lighting_uPointLight[${i}].attenuation`]=s.attenuation||[1,0,0]}),r.lighting_uPointLightCount=t.length,n.forEach((s,i)=>{r[`lighting_uDirectionalLight[${i}].color`]=La(s),r[`lighting_uDirectionalLight[${i}].direction`]=s.direction}),r.lighting_uDirectionalLightCount=n.length,r}function Lf(e=jy){if("lightSources"in e){let{ambientLight:t,pointLights:n,directionalLights:r}=e.lightSources||{};return t||n&&n.length>0||r&&r.length>0?Object.assign({},Xy({ambientLight:t,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){let t={pointLights:[],directionalLights:[]};for(let n of e.lights||[])switch(n.type){case"ambient":t.ambientLight=n;break;case"directional":t.directionalLights?.push(n);break;case"point":t.pointLights?.push(n);break;default:}return Lf({lightSources:t})}return{}}var Pf={name:"lights",vs:Ra,fs:Ra,getUniforms:Lf,defines:{MAX_LIGHTS:3}};var Of=`uniform mat4 u_MVPMatrix;
205
54
  uniform mat4 u_ModelMatrix;
206
55
  uniform mat4 u_NormalMatrix;
207
-
208
56
  out vec3 pbr_vPosition;
209
57
  out vec2 pbr_vUV;
210
-
211
58
  #ifdef HAS_NORMALS
212
59
  # ifdef HAS_TANGENTS
213
60
  out mat3 pbr_vTBN;
@@ -215,58 +62,34 @@ out mat3 pbr_vTBN;
215
62
  out vec3 pbr_vNormal;
216
63
  # endif
217
64
  #endif
218
-
219
65
  void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)
220
66
  {
221
- vec4 pos = u_ModelMatrix * position;
222
- pbr_vPosition = vec3(pos.xyz) / pos.w;
223
-
67
+ vec4 pos = u_ModelMatrix * position;
68
+ pbr_vPosition = vec3(pos.xyz) / pos.w;
224
69
  #ifdef HAS_NORMALS
225
70
  #ifdef HAS_TANGENTS
226
- vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));
227
- vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));
228
- vec3 bitangentW = cross(normalW, tangentW) * tangent.w;
229
- pbr_vTBN = mat3(tangentW, bitangentW, normalW);
230
- #else // HAS_TANGENTS != 1
231
- pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));
71
+ vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));
72
+ vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));
73
+ vec3 bitangentW = cross(normalW, tangentW) * tangent.w;
74
+ pbr_vTBN = mat3(tangentW, bitangentW, normalW);
75
+ #else
76
+ pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));
232
77
  #endif
233
78
  #endif
234
-
235
79
  #ifdef HAS_UV
236
- pbr_vUV = uv;
80
+ pbr_vUV = uv;
237
81
  #else
238
- pbr_vUV = vec2(0.,0.);
82
+ pbr_vUV = vec2(0.,0.);
239
83
  #endif
240
84
  }
241
- `;var tm=ne`\
242
- #if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)
243
- # error PBR fragment shader: Texture LOD is not available
244
- #endif
245
-
246
- #if !defined(HAS_TANGENTS) && !defined(FEATURE_GLSL_DERIVATIVES)
247
- # error PBR fragment shader: Derivatives are not available
248
- #endif
249
-
250
- // WebGL 1.0 does not support non-constant in for loops
251
- // This provides an easy way to handle these cases
252
- // and still take advantage of WebGL 2.0
253
- #if (__VERSION__ < 300)
254
- #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL1COND; INCR)
255
- #else
256
- #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL2COND; INCR)
257
- #endif
258
-
259
- precision highp float;
260
-
85
+ `;var Nf=`precision highp float;
261
86
  uniform bool pbr_uUnlit;
262
-
263
87
  #ifdef USE_IBL
264
88
  uniform samplerCube u_DiffuseEnvSampler;
265
89
  uniform samplerCube u_SpecularEnvSampler;
266
90
  uniform sampler2D u_brdfLUT;
267
91
  uniform vec2 u_ScaleIBLAmbient;
268
92
  #endif
269
-
270
93
  #ifdef HAS_BASECOLORMAP
271
94
  uniform sampler2D u_BaseColorSampler;
272
95
  #endif
@@ -285,26 +108,18 @@ uniform sampler2D u_MetallicRoughnessSampler;
285
108
  uniform sampler2D u_OcclusionSampler;
286
109
  uniform float u_OcclusionStrength;
287
110
  #endif
288
-
289
111
  #ifdef ALPHA_CUTOFF
290
112
  uniform float u_AlphaCutoff;
291
113
  #endif
292
-
293
114
  uniform vec2 u_MetallicRoughnessValues;
294
115
  uniform vec4 u_BaseColorFactor;
295
-
296
116
  uniform vec3 u_Camera;
297
-
298
- // debugging flags used for shader output of intermediate PBR variables
299
117
  #ifdef PBR_DEBUG
300
118
  uniform vec4 u_ScaleDiffBaseMR;
301
119
  uniform vec4 u_ScaleFGDSpec;
302
120
  #endif
303
-
304
121
  in vec3 pbr_vPosition;
305
-
306
122
  in vec2 pbr_vUV;
307
-
308
123
  #ifdef HAS_NORMALS
309
124
  #ifdef HAS_TANGENTS
310
125
  in mat3 pbr_vTBN;
@@ -312,332 +127,231 @@ in mat3 pbr_vTBN;
312
127
  in vec3 pbr_vNormal;
313
128
  #endif
314
129
  #endif
315
-
316
- // Encapsulate the various inputs used by the various functions in the shading equation
317
- // We store values in this struct to simplify the integration of alternative implementations
318
- // of the shading terms, outlined in the Readme.MD Appendix.
319
130
  struct PBRInfo
320
131
  {
321
- float NdotL; // cos angle between normal and light direction
322
- float NdotV; // cos angle between normal and view direction
323
- float NdotH; // cos angle between normal and half vector
324
- float LdotH; // cos angle between light direction and half vector
325
- float VdotH; // cos angle between view direction and half vector
326
- float perceptualRoughness; // roughness value, as authored by the model creator (input to shader)
327
- float metalness; // metallic value at the surface
328
- vec3 reflectance0; // full reflectance color (normal incidence angle)
329
- vec3 reflectance90; // reflectance color at grazing angle
330
- float alphaRoughness; // roughness mapped to a more linear change in the roughness (proposed by [2])
331
- vec3 diffuseColor; // color contribution from diffuse lighting
332
- vec3 specularColor; // color contribution from specular lighting
333
- vec3 n; // normal at surface point
334
- vec3 v; // vector from surface point to camera
132
+ float NdotL;
133
+ float NdotV;
134
+ float NdotH;
135
+ float LdotH;
136
+ float VdotH;
137
+ float perceptualRoughness;
138
+ float metalness;
139
+ vec3 reflectance0;
140
+ vec3 reflectance90;
141
+ float alphaRoughness;
142
+ vec3 diffuseColor;
143
+ vec3 specularColor;
144
+ vec3 n;
145
+ vec3 v;
335
146
  };
336
-
337
147
  const float M_PI = 3.141592653589793;
338
148
  const float c_MinRoughness = 0.04;
339
-
340
149
  vec4 SRGBtoLINEAR(vec4 srgbIn)
341
150
  {
342
151
  #ifdef MANUAL_SRGB
343
152
  #ifdef SRGB_FAST_APPROXIMATION
344
- vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
345
- #else //SRGB_FAST_APPROXIMATION
346
- vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
347
- vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
348
- #endif //SRGB_FAST_APPROXIMATION
349
- return vec4(linOut,srgbIn.w);;
350
- #else //MANUAL_SRGB
351
- return srgbIn;
352
- #endif //MANUAL_SRGB
153
+ vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
154
+ #else
155
+ vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
156
+ vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
157
+ #endif
158
+ return vec4(linOut,srgbIn.w);;
159
+ #else
160
+ return srgbIn;
161
+ #endif
353
162
  }
354
-
355
- // Find the normal for this fragment, pulling either from a predefined normal map
356
- // or from the interpolated mesh normal and tangent attributes.
357
163
  vec3 getNormal()
358
164
  {
359
- // Retrieve the tangent space matrix
360
165
  #ifndef HAS_TANGENTS
361
- vec3 pos_dx = dFdx(pbr_vPosition);
362
- vec3 pos_dy = dFdy(pbr_vPosition);
363
- vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));
364
- vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));
365
- vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
366
-
166
+ vec3 pos_dx = dFdx(pbr_vPosition);
167
+ vec3 pos_dy = dFdy(pbr_vPosition);
168
+ vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));
169
+ vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));
170
+ vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
367
171
  #ifdef HAS_NORMALS
368
- vec3 ng = normalize(pbr_vNormal);
172
+ vec3 ng = normalize(pbr_vNormal);
369
173
  #else
370
- vec3 ng = cross(pos_dx, pos_dy);
174
+ vec3 ng = cross(pos_dx, pos_dy);
371
175
  #endif
372
-
373
- t = normalize(t - ng * dot(ng, t));
374
- vec3 b = normalize(cross(ng, t));
375
- mat3 tbn = mat3(t, b, ng);
376
- #else // HAS_TANGENTS
377
- mat3 tbn = pbr_vTBN;
176
+ t = normalize(t - ng * dot(ng, t));
177
+ vec3 b = normalize(cross(ng, t));
178
+ mat3 tbn = mat3(t, b, ng);
179
+ #else
180
+ mat3 tbn = pbr_vTBN;
378
181
  #endif
379
-
380
182
  #ifdef HAS_NORMALMAP
381
- vec3 n = texture(u_NormalSampler, pbr_vUV).rgb;
382
- n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));
183
+ vec3 n = texture(u_NormalSampler, pbr_vUV).rgb;
184
+ n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));
383
185
  #else
384
- // The tbn matrix is linearly interpolated, so we need to re-normalize
385
- vec3 n = normalize(tbn[2].xyz);
186
+ vec3 n = normalize(tbn[2].xyz);
386
187
  #endif
387
-
388
- return n;
188
+ return n;
389
189
  }
390
-
391
- // Calculation of the lighting contribution from an optional Image Based Light source.
392
- // Precomputed Environment Maps are required uniform inputs and are computed as outlined in [1].
393
- // See our README.md on Environment Maps [3] for additional discussion.
394
190
  #ifdef USE_IBL
395
191
  vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
396
192
  {
397
- float mipCount = 9.0; // resolution of 512x512
398
- float lod = (pbrInputs.perceptualRoughness * mipCount);
399
- // retrieve a scale and bias to F0. See [1], Figure 3
400
- vec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT,
401
- vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
402
- vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
403
-
193
+ float mipCount = 9.0;
194
+ float lod = (pbrInputs.perceptualRoughness * mipCount);
195
+ vec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT,
196
+ vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
197
+ vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
404
198
  #ifdef USE_TEX_LOD
405
- vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;
199
+ vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;
406
200
  #else
407
- vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;
408
- #endif
409
-
410
- vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
411
- vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
412
-
413
- // For presentation, this allows us to disable IBL terms
414
- diffuse *= u_ScaleIBLAmbient.x;
415
- specular *= u_ScaleIBLAmbient.y;
416
-
417
- return diffuse + specular;
201
+ vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;
202
+ #endif
203
+ vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
204
+ vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
205
+ diffuse *= u_ScaleIBLAmbient.x;
206
+ specular *= u_ScaleIBLAmbient.y;
207
+ return diffuse + specular;
418
208
  }
419
209
  #endif
420
-
421
- // Basic Lambertian diffuse
422
- // Implementation from Lambert's Photometria https://archive.org/details/lambertsphotome00lambgoog
423
- // See also [1], Equation 1
424
210
  vec3 diffuse(PBRInfo pbrInputs)
425
211
  {
426
- return pbrInputs.diffuseColor / M_PI;
212
+ return pbrInputs.diffuseColor / M_PI;
427
213
  }
428
-
429
- // The following equation models the Fresnel reflectance term of the spec equation (aka F())
430
- // Implementation of fresnel from [4], Equation 15
431
214
  vec3 specularReflection(PBRInfo pbrInputs)
432
215
  {
433
- return pbrInputs.reflectance0 +
434
- (pbrInputs.reflectance90 - pbrInputs.reflectance0) *
435
- pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
216
+ return pbrInputs.reflectance0 +
217
+ (pbrInputs.reflectance90 - pbrInputs.reflectance0) *
218
+ pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
436
219
  }
437
-
438
- // This calculates the specular geometric attenuation (aka G()),
439
- // where rougher material will reflect less light back to the viewer.
440
- // This implementation is based on [1] Equation 4, and we adopt their modifications to
441
- // alphaRoughness as input as originally proposed in [2].
442
220
  float geometricOcclusion(PBRInfo pbrInputs)
443
221
  {
444
- float NdotL = pbrInputs.NdotL;
445
- float NdotV = pbrInputs.NdotV;
446
- float r = pbrInputs.alphaRoughness;
447
-
448
- float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
449
- float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
450
- return attenuationL * attenuationV;
222
+ float NdotL = pbrInputs.NdotL;
223
+ float NdotV = pbrInputs.NdotV;
224
+ float r = pbrInputs.alphaRoughness;
225
+ float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
226
+ float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
227
+ return attenuationL * attenuationV;
451
228
  }
452
-
453
- // The following equation(s) model the distribution of microfacet normals across
454
- // the area being drawn (aka D())
455
- // Implementation from "Average Irregularity Representation of a Roughened Surface
456
- // for Ray Reflection" by T. S. Trowbridge, and K. P. Reitz
457
- // Follows the distribution function recommended in the SIGGRAPH 2013 course notes
458
- // from EPIC Games [1], Equation 3.
459
229
  float microfacetDistribution(PBRInfo pbrInputs)
460
230
  {
461
- float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
462
- float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
463
- return roughnessSq / (M_PI * f * f);
231
+ float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
232
+ float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
233
+ return roughnessSq / (M_PI * f * f);
464
234
  }
465
-
466
235
  void PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {
467
- pbrInputs.NdotL = 1.0;
468
- pbrInputs.NdotH = 0.0;
469
- pbrInputs.LdotH = 0.0;
470
- pbrInputs.VdotH = 1.0;
236
+ pbrInputs.NdotL = 1.0;
237
+ pbrInputs.NdotH = 0.0;
238
+ pbrInputs.LdotH = 0.0;
239
+ pbrInputs.VdotH = 1.0;
471
240
  }
472
-
473
241
  void PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {
474
- vec3 n = pbrInputs.n;
475
- vec3 v = pbrInputs.v;
476
- vec3 l = normalize(lightDirection); // Vector from surface point to light
477
- vec3 h = normalize(l+v); // Half vector between both l and v
478
-
479
- pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);
480
- pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);
481
- pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);
482
- pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);
242
+ vec3 n = pbrInputs.n;
243
+ vec3 v = pbrInputs.v;
244
+ vec3 l = normalize(lightDirection);
245
+ vec3 h = normalize(l+v);
246
+ pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);
247
+ pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);
248
+ pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);
249
+ pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);
483
250
  }
484
-
485
251
  void PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {
486
- vec3 light_direction = normalize(pointLight.position - pbr_vPosition);
487
- PBRInfo_setDirectionalLight(pbrInputs, light_direction);
252
+ vec3 light_direction = normalize(pointLight.position - pbr_vPosition);
253
+ PBRInfo_setDirectionalLight(pbrInputs, light_direction);
488
254
  }
489
-
490
255
  vec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {
491
- // Calculate the shading terms for the microfacet specular shading model
492
- vec3 F = specularReflection(pbrInputs);
493
- float G = geometricOcclusion(pbrInputs);
494
- float D = microfacetDistribution(pbrInputs);
495
-
496
- // Calculation of analytical lighting contribution
497
- vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
498
- vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);
499
- // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law)
500
- return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);
256
+ vec3 F = specularReflection(pbrInputs);
257
+ float G = geometricOcclusion(pbrInputs);
258
+ float D = microfacetDistribution(pbrInputs);
259
+ vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
260
+ vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);
261
+ return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);
501
262
  }
502
-
503
263
  vec4 pbr_filterColor(vec4 colorUnused)
504
264
  {
505
- // The albedo may be defined from a base texture or a flat color
506
265
  #ifdef HAS_BASECOLORMAP
507
- vec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;
266
+ vec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;
508
267
  #else
509
- vec4 baseColor = u_BaseColorFactor;
268
+ vec4 baseColor = u_BaseColorFactor;
510
269
  #endif
511
-
512
270
  #ifdef ALPHA_CUTOFF
513
- if (baseColor.a < u_AlphaCutoff) {
514
- discard;
515
- }
516
- #endif
517
-
518
- vec3 color = vec3(0, 0, 0);
519
-
520
- if(pbr_uUnlit){
521
- color.rgb = baseColor.rgb;
522
- }
523
- else{
524
- // Metallic and Roughness material properties are packed together
525
- // In glTF, these factors can be specified by fixed scalar values
526
- // or from a metallic-roughness map
527
- float perceptualRoughness = u_MetallicRoughnessValues.y;
528
- float metallic = u_MetallicRoughnessValues.x;
271
+ if (baseColor.a < u_AlphaCutoff) {
272
+ discard;
273
+ }
274
+ #endif
275
+ vec3 color = vec3(0, 0, 0);
276
+ if(pbr_uUnlit){
277
+ color.rgb = baseColor.rgb;
278
+ }
279
+ else{
280
+ float perceptualRoughness = u_MetallicRoughnessValues.y;
281
+ float metallic = u_MetallicRoughnessValues.x;
529
282
  #ifdef HAS_METALROUGHNESSMAP
530
- // Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
531
- // This layout intentionally reserves the 'r' channel for (optional) occlusion map data
532
- vec4 mrSample = texture(u_MetallicRoughnessSampler, pbr_vUV);
533
- perceptualRoughness = mrSample.g * perceptualRoughness;
534
- metallic = mrSample.b * metallic;
535
- #endif
536
- perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
537
- metallic = clamp(metallic, 0.0, 1.0);
538
- // Roughness is authored as perceptual roughness; as is convention,
539
- // convert to material roughness by squaring the perceptual roughness [2].
540
- float alphaRoughness = perceptualRoughness * perceptualRoughness;
541
-
542
- vec3 f0 = vec3(0.04);
543
- vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
544
- diffuseColor *= 1.0 - metallic;
545
- vec3 specularColor = mix(f0, baseColor.rgb, metallic);
546
-
547
- // Compute reflectance.
548
- float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
549
-
550
- // For typical incident reflectance range (between 4% to 100%) set the grazing
551
- // reflectance to 100% for typical fresnel effect.
552
- // For very low reflectance range on highly diffuse objects (below 4%),
553
- // incrementally reduce grazing reflecance to 0%.
554
- float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
555
- vec3 specularEnvironmentR0 = specularColor.rgb;
556
- vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
557
-
558
- vec3 n = getNormal(); // normal at surface point
559
- vec3 v = normalize(u_Camera - pbr_vPosition); // Vector from surface point to camera
560
-
561
- float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
562
- vec3 reflection = -normalize(reflect(v, n));
563
-
564
- PBRInfo pbrInputs = PBRInfo(
565
- 0.0, // NdotL
566
- NdotV,
567
- 0.0, // NdotH
568
- 0.0, // LdotH
569
- 0.0, // VdotH
570
- perceptualRoughness,
571
- metallic,
572
- specularEnvironmentR0,
573
- specularEnvironmentR90,
574
- alphaRoughness,
575
- diffuseColor,
576
- specularColor,
577
- n,
578
- v
579
- );
580
-
283
+ vec4 mrSample = texture(u_MetallicRoughnessSampler, pbr_vUV);
284
+ perceptualRoughness = mrSample.g * perceptualRoughness;
285
+ metallic = mrSample.b * metallic;
286
+ #endif
287
+ perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
288
+ metallic = clamp(metallic, 0.0, 1.0);
289
+ float alphaRoughness = perceptualRoughness * perceptualRoughness;
290
+ vec3 f0 = vec3(0.04);
291
+ vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
292
+ diffuseColor *= 1.0 - metallic;
293
+ vec3 specularColor = mix(f0, baseColor.rgb, metallic);
294
+ float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
295
+ float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
296
+ vec3 specularEnvironmentR0 = specularColor.rgb;
297
+ vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
298
+ vec3 n = getNormal();
299
+ vec3 v = normalize(u_Camera - pbr_vPosition);
300
+ float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
301
+ vec3 reflection = -normalize(reflect(v, n));
302
+ PBRInfo pbrInputs = PBRInfo(
303
+ 0.0,
304
+ NdotV,
305
+ 0.0,
306
+ 0.0,
307
+ 0.0,
308
+ perceptualRoughness,
309
+ metallic,
310
+ specularEnvironmentR0,
311
+ specularEnvironmentR90,
312
+ alphaRoughness,
313
+ diffuseColor,
314
+ specularColor,
315
+ n,
316
+ v
317
+ );
581
318
  #ifdef USE_LIGHTS
582
- // Apply ambient light
583
- PBRInfo_setAmbientLight(pbrInputs);
584
- color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);
585
-
586
- // Apply directional light
587
- SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uDirectionalLightCount, i++) {
588
- if (i < lighting_uDirectionalLightCount) {
589
- PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);
590
- color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);
591
- }
592
- }
593
-
594
- // Apply point light
595
- SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uPointLightCount, i++) {
596
- if (i < lighting_uPointLightCount) {
597
- PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);
598
- float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));
599
- color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);
600
- }
601
- }
602
- #endif
603
-
604
- // Calculate lighting contribution from image based lighting source (IBL)
319
+ PBRInfo_setAmbientLight(pbrInputs);
320
+ color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);
321
+ for(int i = 0; i < lighting_uDirectionalLightCount; i++) {
322
+ if (i < lighting_uDirectionalLightCount) {
323
+ PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);
324
+ color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);
325
+ }
326
+ }
327
+ for(int i = 0; i < lighting_uPointLightCount; i++) {
328
+ if (i < lighting_uPointLightCount) {
329
+ PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);
330
+ float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));
331
+ color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);
332
+ }
333
+ }
334
+ #endif
605
335
  #ifdef USE_IBL
606
- color += getIBLContribution(pbrInputs, n, reflection);
336
+ color += getIBLContribution(pbrInputs, n, reflection);
607
337
  #endif
608
-
609
- // Apply optional PBR terms for additional (optional) shading
610
338
  #ifdef HAS_OCCLUSIONMAP
611
- float ao = texture(u_OcclusionSampler, pbr_vUV).r;
612
- color = mix(color, color * ao, u_OcclusionStrength);
339
+ float ao = texture(u_OcclusionSampler, pbr_vUV).r;
340
+ color = mix(color, color * ao, u_OcclusionStrength);
613
341
  #endif
614
-
615
342
  #ifdef HAS_EMISSIVEMAP
616
- vec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;
617
- color += emissive;
343
+ vec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;
344
+ color += emissive;
618
345
  #endif
619
-
620
- // This section uses mix to override final color for reference app visualization
621
- // of various parameters in the lighting equation.
622
346
  #ifdef PBR_DEBUG
623
- // TODO: Figure out how to debug multiple lights
624
-
625
- // color = mix(color, F, u_ScaleFGDSpec.x);
626
- // color = mix(color, vec3(G), u_ScaleFGDSpec.y);
627
- // color = mix(color, vec3(D), u_ScaleFGDSpec.z);
628
- // color = mix(color, specContrib, u_ScaleFGDSpec.w);
629
-
630
- // color = mix(color, diffuseContrib, u_ScaleDiffBaseMR.x);
631
- color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);
632
- color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);
633
- color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
634
- #endif
635
-
636
- }
637
-
638
- return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
347
+ color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);
348
+ color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);
349
+ color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
350
+ #endif
639
351
  }
640
- `;var Yc={name:"pbr",vs:em,fs:tm,defines:{LIGHTING_FRAGMENT:1},dependencies:[$p]};var Zc=P(_t(),1);var No=class{constructor(e){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=qn(Object.values(e));Zc.log.log(1,"Creating ShaderInputs with modules",r.map(n=>n.name))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(let[n,i]of Object.entries(e)){let o=n;this.moduleUniforms[o]=i.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(e){for(let n of Object.keys(e)){var r;let i=n,o=e[i],s=this.modules[i];if(!s){Zc.log.warn(`Module ${n} not found`)();continue}let a=this.moduleUniforms[i],c=((r=s.getUniforms)===null||r===void 0?void 0:r.call(s,o,this.moduleUniforms[i]))||o;this.moduleUniforms[i]={...a,...c}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let e={};for(let r of Object.values(this.moduleBindings))Object.assign(e,r);return e}getDebugTable(){let e={};for(let[n,i]of Object.entries(this.moduleUniforms))for(let[o,s]of Object.entries(i)){var r;e[`${n}.${o}`]={type:(r=this.modules[n].uniformTypes)===null||r===void 0?void 0:r[o],value:String(s)}}return e}};var vt=P(_t(),1),Uo=class{constructor(e){this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=e.id||(0,vt.uid)("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&(0,vt.assert)(this.indices.usage===vt.Buffer.INDEX)}destroy(){var e;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(e=this.attributes.colors)===null||e===void 0||e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(e){return e.byteLength/12}};function rm(t,e){if(e instanceof Uo)return e;let r=lS(t,e),{attributes:n,bufferLayout:i}=fS(t,e);return new Uo({topology:e.topology||"triangle-list",bufferLayout:i,vertexCount:e.vertexCount,indices:r,attributes:n})}function lS(t,e){if(!e.indices)return;let r=e.indices.value;return t.createBuffer({usage:vt.Buffer.INDEX,data:r})}function fS(t,e){let r=[],n={};for(let[o,s]of Object.entries(e.attributes)){let a=o;switch(o){case"POSITION":a="positions";break;case"NORMAL":a="normals";break;case"TEXCOORD_0":a="texCoords";break;case"COLOR_0":a="colors";break}n[a]=t.createBuffer({data:s.value,id:`${o}-buffer`});let{value:c,size:u,normalized:l}=s;r.push({name:a,format:(0,vt.getVertexFormatFromAttribute)(c,u,l)})}let i=e._calculateVertexCount(e.attributes,e.indices);return{attributes:n,bufferLayout:r,vertexCount:i}}var nm=P(_t(),1),Ht=class{static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new Ht(e),e._lumaData.defaultPipelineFactory}constructor(e){this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=e}createRenderPipeline(e){let r={...Ht.defaultProps,...e},n=this._hashRenderPipeline({...r});if(!this._pipelineCache[n]){let i=this.device.createRenderPipeline({...r,vs:this.device.createShader({stage:"vertex",source:r.vs}),fs:r.fs?this.device.createShader({stage:"fragment",source:r.fs}):null});i.hash=n,this._pipelineCache[n]=i,this._useCounts[n]=0}return this._useCounts[n]++,this._pipelineCache[n]}release(e){let r=e.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._pipelineCache[r].destroy(),delete this._pipelineCache[r],delete this._useCounts[r])}_createRenderPipeline(e){if(!e.fs)throw new Error("fs");return this.device.createRenderPipeline({...e,vs:this.device.createShader({stage:"vertex",source:e.vs}),fs:e.fs?this.device.createShader({stage:"fragment",source:e.fs}):null})}_hashRenderPipeline(e){let r=this._getHash(e.vs),n=e.fs?this._getHash(e.fs):0,i="-";switch(this.device.info.type){case"webgpu":let o=this._getHash(JSON.stringify(e.parameters)),s=this._getHash(JSON.stringify(e.bufferLayout));return`${r}/${n}V${i}T${e.topology}P${o}BL${s}}`;default:return`${r}/${n}V${i}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}};Ht.defaultProps={...nm.RenderPipeline.defaultProps,vs:void 0,fs:void 0};function im(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={},n=`Shader Layout for ${e}`;for(let i of t.attributes)if(i){let o=`${i.location} ${i.name}: ${i.type}`;r[`in ${o}`]={[n]:i.stepMode||"vertex"}}for(let i of t.varyings||[]){let o=`${i.location} ${i.name}`;r[`out ${o}`]={[n]:JSON.stringify(i.accessor)}}return r}var Go=2,hS=1e4,Vt=class{constructor(e,r){var n,i,o;this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.vertexArray=void 0,this.transformFeedback=null,this.pipeline=void 0,this.shaderInputs=void 0,this._uniformStore=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this._lastLogTime=0,this._logOpen=!1,this.props={...Vt.defaultProps,...r},r=this.props,this.id=r.id||(0,ce.uid)("model"),this.device=e,Object.assign(this.userData,r.userData);let s=Object.fromEntries(((n=this.props.modules)===null||n===void 0?void 0:n.map(h=>[h.name,h]))||[]);this.setShaderInputs(r.shaderInputs||new No(s));let a=dS(e),c=(((i=this.props.modules)===null||i===void 0?void 0:i.length)>0?this.props.modules:(o=this.shaderInputs)===null||o===void 0?void 0:o.getModules())||[],{vs:u,fs:l,getUniforms:f}=this.props.shaderAssembler.assembleShaders({platformInfo:a,...this.props,modules:c});if(this.vs=u,this.fs=l,this._getModuleUniforms=f,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&(this._gpuGeometry=this.setGeometry(r.geometry)),this.pipelineFactory=r.pipelineFactory||Ht.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&(ce.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")(),this.updateModuleSettings(r.moduleSettings)),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this.pipelineFactory.release(this.pipeline),this._uniformStore.destroy()}predraw(){this.updateShaderInputs()}draw(e){this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,transformFeedback:this.transformFeedback})}finally{this._logDrawCallEnd()}}setGeometry(e){let r=e&&rm(this.device,e);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=om(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(e){this.vertexCount=e.vertexCount,this.setAttributes(e.attributes,"ignore-unknown"),this.setIndexBuffer(e.indices)}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){this.bufferLayout=this._gpuGeometry?om(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){(0,ce.deepEqual)(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(e){this.vertexCount=e}setInstanceCount(e){this.instanceCount=e}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new Ho.UniformStore(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let n=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=n}}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues())}updateModuleSettings(e){ce.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();let{bindings:r,uniforms:n}=(0,ce.splitUniformsAndBindings)(this._getModuleUniforms(e));Object.assign(this.bindings,r),Object.assign(this.uniforms,n)}setBindings(e){Object.assign(this.bindings,e)}setUniforms(e){this.pipeline.setUniforms(e),Object.assign(this.uniforms,e)}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e)}setTransformFeedback(e){this.transformFeedback=e}setAttributes(e,r){e.indices&&ce.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[i,o]of Object.entries(e)){var n;let s=this.bufferLayout.find(u=>u.name===i);if(!s){ce.log.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}let a=s.attributes?(n=s.attributes)===null||n===void 0?void 0:n.map(u=>u.attribute):[s.name],c=!1;for(let u of a){let l=this._attributeInfos[u];l&&(this.vertexArray.setBuffer(l.location,o),c=!0)}!c&&r!=="ignore-unknown"&&ce.log.warn(`Model(${this.id}): Ignoring buffer "${o.id}" for unknown attribute "${i}"`)()}}setConstantAttributes(e){for(let[r,n]of Object.entries(e)){let i=this._attributeInfos[r];i?this.vertexArray.setConstant(i.location,n):ce.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||e}_updatePipeline(){return this._pipelineNeedsUpdate&&(this.pipeline&&ce.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null}),this._attributeInfos=(0,sm.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline}_logDrawCallStart(){let e=ce.log.level>3?0:hS;Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,ce.log.group(Go,`>>> DRAWING MODEL ${this.id}`,{collapsed:ce.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=im(this.pipeline.shaderLayout);ce.log.table(Go,e)();let r=this.shaderInputs.getDebugTable();for(let[n,i]of Object.entries(this.uniforms))r[n]={value:i};ce.log.table(Go,r)(),ce.log.groupEnd(Go)(),this._logOpen=!1}}};Vt.defaultProps={...Ho.RenderPipeline.defaultProps,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:We.getDefaultShaderAssembler()};function om(t,e){let r=[...t];for(let n of e){let i=r.findIndex(o=>o.name===n.name);i<0?r.push(n):r[i]=n}return r}function dS(t){return{type:t.info.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}var Vr=P(_t(),1),Xn=class{constructor(e){this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};let{attributes:r={},indices:n=null,vertexCount:i=null}=e;this.id=e.id||(0,Vr.uid)("geometry"),this.topology=e.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[o,s]of Object.entries(r)){let a=ArrayBuffer.isView(s)?{value:s}:s;(0,Vr.assert)(ArrayBuffer.isView(a.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!a.size&&(a.size=3),o==="indices"?((0,Vr.assert)(!this.indices),this.indices=a):this.attributes[o]=a}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,r){return this}_calculateVertexCount(e,r){if(r)return r.value.length;let n=1/0;for(let i of Object.values(e)){let{value:o,size:s,constant:a}=i;!a&&o&&s>=1&&(n=Math.min(n,o.length/s))}return(0,Vr.assert)(Number.isFinite(n)),n}};var Wt=P(ze()),k0=P(Ve()),J0=P(Vo());var cm=P(_t(),1),at=function(t){return t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.ONE=1]="ONE",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.LINEAR=9729]="LINEAR",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t}(at||{});function Qc(t,e,r,n){let i={defines:{MANUAL_SRGB:1,SRGB_FAST_APPROXIMATION:1},bindings:{},uniforms:{u_Camera:[0,0,0],u_MetallicRoughnessValues:[1,1]},parameters:{},glParameters:{},generatedTextures:[]};t.features.has("glsl-texture-lod")&&(i.defines.USE_TEX_LOD=1);let{imageBasedLightingEnvironment:o}=n;return o&&(i.bindings.u_DiffuseEnvSampler=o.diffuseEnvSampler,i.bindings.u_SpecularEnvSampler=o.specularEnvSampler,i.bindings.u_brdfLUT=o.brdfLutTexture,i.uniforms.u_ScaleIBLAmbient=[1,1]),n!=null&&n.pbrDebug&&(i.defines.PBR_DEBUG=1,i.uniforms.u_ScaleDiffBaseMR=[0,0,0,0],i.uniforms.u_ScaleFGDSpec=[0,0,0,0]),r.NORMAL&&(i.defines.HAS_NORMALS=1),r.TANGENT&&n!==null&&n!==void 0&&n.useTangents&&(i.defines.HAS_TANGENTS=1),r.TEXCOORD_0&&(i.defines.HAS_UV=1),n!=null&&n.imageBasedLightingEnvironment&&(i.defines.USE_IBL=1),n!=null&&n.lights&&(i.defines.USE_LIGHTS=1),e&&pS(t,e,i),i}function pS(t,e,r){if(r.uniforms.pbr_uUnlit=Boolean(e.unlit),e.pbrMetallicRoughness&&mS(t,e.pbrMetallicRoughness,r),e.normalTexture){Kn(t,e.normalTexture,"u_NormalSampler","HAS_NORMALMAP",r);let{scale:n=1}=e.normalTexture;r.uniforms.u_NormalScale=n}if(e.occlusionTexture){Kn(t,e.occlusionTexture,"u_OcclusionSampler","HAS_OCCLUSIONMAP",r);let{strength:n=1}=e.occlusionTexture;r.uniforms.u_OcclusionStrength=n}switch(e.emissiveTexture&&(Kn(t,e.emissiveTexture,"u_EmissiveSampler","HAS_EMISSIVEMAP",r),r.uniforms.u_EmissiveFactor=e.emissiveFactor||[0,0,0]),e.alphaMode){case"MASK":let{alphaCutoff:n=.5}=e;r.defines.ALPHA_CUTOFF=1,r.uniforms.u_AlphaCutoff=n;break;case"BLEND":cm.log.warn("glTF BLEND alphaMode might not work well because it requires mesh sorting")(),r.parameters.blendColorOperation="add",r.parameters.blendColorSrcFactor="src-alpha",r.parameters.blendColorDstFactor="one-minus-src-alpha",r.parameters.blendAlphaOperation="add",r.parameters.blendAlphaSrcFactor="one",r.parameters.blendAlphaDstFactor="one-minus-src-alpha",r.glParameters.blend=!0,r.glParameters.blendEquation=at.FUNC_ADD,r.glParameters.blendFunc=[at.SRC_ALPHA,at.ONE_MINUS_SRC_ALPHA,at.ONE,at.ONE_MINUS_SRC_ALPHA];break}}function mS(t,e,r){e.baseColorTexture&&Kn(t,e.baseColorTexture,"u_BaseColorSampler","HAS_BASECOLORMAP",r),r.uniforms.u_BaseColorFactor=e.baseColorFactor||[1,1,1,1],e.metallicRoughnessTexture&&Kn(t,e.metallicRoughnessTexture,"u_MetallicRoughnessSampler","HAS_METALROUGHNESSMAP",r);let{metallicFactor:n=1,roughnessFactor:i=1}=e;r.uniforms.u_MetallicRoughnessValues=[n,i]}function Kn(t,e,r){var n;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,o=arguments.length>4?arguments[4]:void 0,s=(e==null||(n=e.texture)===null||n===void 0||(n=n.sampler)===null||n===void 0?void 0:n.parameters)||{},a=e.texture.source.image,c,u={};a.compressed?(c=a,u={[at.TEXTURE_MIN_FILTER]:a.data.length>1?at.LINEAR_MIPMAP_NEAREST:at.LINEAR}):c={data:a};let l=t.createTexture({id:e.uniformName||e.id,parameters:{...s,...u},pixelStore:{[at.UNPACK_FLIP_Y_WEBGL]:!1},...c});o.bindings[r]=l,i&&(o.defines[i]=1),o.generatedTextures.push(l)}var um="4.1.0-alpha.9";var zo={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},$c;async function tu(t){let e=t.modules||{};return e.basis?e.basis:($c=$c||gS(t),await $c)}async function gS(t){let e=null,r=null;return[e,r]=await Promise.all([await tt(zo.TRANSCODER,"textures",t),await tt(zo.TRANSCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await yS(e,r)}function yS(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(i=>{let{BasisFile:o,initializeBasis:s}=i;s(),n({BasisFile:o})})})}var eu;async function ru(t){let e=t.modules||{};return e.basisEncoder?e.basisEncoder:(eu=eu||AS(t),await eu)}async function AS(t){let e=null,r=null;return[e,r]=await Promise.all([await tt(zo.ENCODER,"textures",t),await tt(zo.ENCODER_WASM,"textures",t)]),e=e||globalThis.BASIS,await _S(e,r)}function _S(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t(r).then(i=>{let{BasisFile:o,KTX2File:s,initializeBasis:a,BasisEncoder:c}=i;a(),n({BasisFile:o,KTX2File:s,BasisEncoder:c})})})}var ur={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var vS=["","WEBKIT_","MOZ_"],lm={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},jo=null;function fm(t){if(!jo){t=t||xS()||void 0,jo=new Set;for(let e of vS)for(let r in lm)if(t&&t.getExtension(`${e}${r}`)){let n=lm[r];jo.add(n)}}return jo}function xS(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var IG=new Uint8Array([0]);var hm,dm,pm,mm,gm,ym,Am,_m;(function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB"})(hm||(hm={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(dm||(dm={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(pm||(pm={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(mm||(mm={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}(gm||(gm={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(ym||(ym={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(Am||(Am={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(_m||(_m={}));var Oe=[171,75,84,88,32,50,48,187,13,10,26,10];function vm(t){let e=new Uint8Array(t);return!(e.byteLength<Oe.length||e[0]!==Oe[0]||e[1]!==Oe[1]||e[2]!==Oe[2]||e[3]!==Oe[3]||e[4]!==Oe[4]||e[5]!==Oe[5]||e[6]!==Oe[6]||e[7]!==Oe[7]||e[8]!==Oe[8]||e[9]!==Oe[9]||e[10]!==Oe[10]||e[11]!==Oe[11])}var TS={etc1:{basisFormat:0,compressed:!0,format:ur.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:ur.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:ur.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:ur.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:ur.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:ur.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function iu(t,e){if(e.basis.containerFormat==="auto"){if(vm(t)){let n=await ru(e);return xm(n.KTX2File,t,e)}let{BasisFile:r}=await tu(e);return nu(r,t,e)}switch(e.basis.module){case"encoder":let r=await ru(e);switch(e.basis.containerFormat){case"ktx2":return xm(r.KTX2File,t,e);case"basis":default:return nu(r.BasisFile,t,e)}case"transcoder":default:let{BasisFile:n}=await tu(e);return nu(n,t,e)}}function nu(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("Failed to start basis transcoding");let i=n.getNumImages(),o=[];for(let s=0;s<i;s++){let a=n.getNumLevels(s),c=[];for(let u=0;u<a;u++)c.push(bS(n,s,u,r));o.push(c)}return o}finally{n.close(),n.delete()}}function bS(t,e,r,n){let i=t.getImageWidth(e,r),o=t.getImageHeight(e,r),s=t.getHasAlpha(),{compressed:a,format:c,basisFormat:u}=Tm(n,s),l=t.getImageTranscodedSizeInBytes(e,r,u),f=new Uint8Array(l);if(!t.transcodeImage(f,e,r,u,0,0))throw new Error("failed to start Basis transcoding");return{width:i,height:o,data:f,compressed:a,format:c,hasAlpha:s}}function xm(t,e,r){let n=new t(new Uint8Array(e));try{if(!n.startTranscoding())throw new Error("failed to start KTX2 transcoding");let i=n.getLevels(),o=[];for(let s=0;s<i;s++){o.push(ES(n,s,r));break}return[o]}finally{n.close(),n.delete()}}function ES(t,e,r){let{alphaFlag:n,height:i,width:o}=t.getImageLevelInfo(e,0,0),{compressed:s,format:a,basisFormat:c}=Tm(r,n),u=t.getImageTranscodedSizeInBytes(e,0,0,c),l=new Uint8Array(u);if(!t.transcodeImage(l,e,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:o,height:i,data:l,compressed:s,levelSize:u,hasAlpha:n,format:a}}function Tm(t,e){let r=t&&t.basis&&t.basis.format;return r==="auto"&&(r=ko()),typeof r=="object"&&(r=e?r.alpha:r.noAlpha),r=r.toLowerCase(),TS[r]}function ko(){let t=fm();return t.has("astc")?"astc-4x4":t.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:t.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:t.has("etc1")?"etc1":t.has("etc2")?"etc2":"rgb565"}var bm={name:"Basis",id:"basis",module:"textures",version:um,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},ou={...bm,parse:iu};function su(t){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}function Xe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||su()}var SS=globalThis.self||globalThis.window||globalThis.global,zr=globalThis.window||globalThis.self||globalThis.global,BS=globalThis.document||{},lr=globalThis.process||{},CS=globalThis.console,KG=globalThis.navigator||{};var Jo=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",QG=Xe();var Cm=P(Vo());var Em=`#version 300 es
352
+ return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
353
+ }
354
+ `;var Pa={name:"pbr",vs:Of,fs:Nf,defines:{LIGHTING_FRAGMENT:1},dependencies:[Pf]};var Gf=N(va(),1),Vf=N(js(),1);var Df=`#version 300 es
641
355
  #define SHADER_NAME simple-mesh-layer-vs
642
356
  uniform float sizeScale;
643
357
  uniform bool composeModelMatrix;
@@ -658,114 +372,79 @@ out vec3 cameraPosition;
658
372
  out vec3 normals_commonspace;
659
373
  out vec4 position_commonspace;
660
374
  out vec4 vColor;
661
-
662
375
  vec2 applyUVRegion(vec2 uv) {
663
- #ifdef HAS_UV_REGIONS
664
- return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
665
- #else
666
- return uv;
667
- #endif
376
+ #ifdef HAS_UV_REGIONS
377
+ return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
378
+ #else
379
+ return uv;
380
+ #endif
668
381
  }
669
-
670
382
  void main(void) {
671
- vec2 uv = applyUVRegion(texCoords);
672
- geometry.uv = uv;
673
-
674
- if (pickFeatureIds) {
675
- geometry.pickingColor = featureIdsPickingColors;
676
- } else {
677
- geometry.pickingColor = instancePickingColors;
678
- }
679
-
680
- mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
681
-
682
- vTexCoord = uv;
683
- cameraPosition = project_uCameraPosition;
684
- vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
685
-
686
- vec3 pos = (instanceModelMatrix * positions) * sizeScale;
687
- vec3 projectedPosition = project_position(positions);
688
- position_commonspace = vec4(projectedPosition, 1.0);
689
- gl_Position = project_common_position_to_clipspace(position_commonspace);
690
-
691
- geometry.position = position_commonspace;
692
- normals_commonspace = project_normal(instanceModelMatrix * normals);
693
- geometry.normal = normals_commonspace;
694
-
695
- DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
696
-
697
- #ifdef MODULE_PBR
698
- pbr_vPosition = geometry.position.xyz;
699
- #ifdef HAS_NORMALS
700
- pbr_vNormal = geometry.normal;
701
- #endif
702
-
703
- #ifdef HAS_UV
704
- pbr_vUV = uv;
705
- #else
706
- pbr_vUV = vec2(0., 0.);
707
- #endif
708
- geometry.uv = pbr_vUV;
709
- #endif
710
-
711
- DECKGL_FILTER_COLOR(vColor, geometry);
383
+ vec2 uv = applyUVRegion(texCoords);
384
+ geometry.uv = uv;
385
+ if (pickFeatureIds) {
386
+ geometry.pickingColor = featureIdsPickingColors;
387
+ } else {
388
+ geometry.pickingColor = instancePickingColors;
712
389
  }
713
- `;var Sm=`#version 300 es
390
+ mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
391
+ vTexCoord = uv;
392
+ cameraPosition = project_uCameraPosition;
393
+ vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
394
+ vec3 pos = (instanceModelMatrix * positions) * sizeScale;
395
+ vec3 projectedPosition = project_position(positions);
396
+ position_commonspace = vec4(projectedPosition, 1.0);
397
+ gl_Position = project_common_position_to_clipspace(position_commonspace);
398
+ geometry.position = position_commonspace;
399
+ normals_commonspace = project_normal(instanceModelMatrix * normals);
400
+ geometry.normal = normals_commonspace;
401
+ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
402
+ #ifdef MODULE_PBR
403
+ pbr_vPosition = geometry.position.xyz;
404
+ #ifdef HAS_NORMALS
405
+ pbr_vNormal = geometry.normal;
406
+ #endif
407
+ #ifdef HAS_UV
408
+ pbr_vUV = uv;
409
+ #else
410
+ pbr_vUV = vec2(0., 0.);
411
+ #endif
412
+ geometry.uv = pbr_vUV;
413
+ #endif
414
+ DECKGL_FILTER_COLOR(vColor, geometry);
415
+ }
416
+ `;var Uf=`#version 300 es
714
417
  #define SHADER_NAME simple-mesh-layer-fs
715
-
716
418
  precision highp float;
717
-
718
419
  uniform bool hasTexture;
719
420
  uniform sampler2D sampler;
720
421
  uniform bool flatShading;
721
422
  uniform float opacity;
722
-
723
423
  in vec2 vTexCoord;
724
424
  in vec3 cameraPosition;
725
425
  in vec3 normals_commonspace;
726
426
  in vec4 position_commonspace;
727
427
  in vec4 vColor;
728
-
729
428
  out vec4 fragColor;
730
-
731
429
  void main(void) {
732
-
733
430
  #ifdef MODULE_PBR
734
-
735
- fragColor = vColor * pbr_filterColor(vec4(0));
736
- geometry.uv = pbr_vUV;
737
- fragColor.a *= opacity;
738
-
739
- #else
740
-
741
- geometry.uv = vTexCoord;
742
-
743
- vec3 normal;
744
- if (flatShading) {
745
- #ifdef DERIVATIVES_AVAILABLE
746
- normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
431
+ fragColor = vColor * pbr_filterColor(vec4(0));
432
+ geometry.uv = pbr_vUV;
433
+ fragColor.a *= opacity;
747
434
  #else
748
- normal = vec3(0.0, 0.0, 1.0);
749
- #endif
750
- } else {
751
- normal = normals_commonspace;
752
- }
753
-
754
- vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
755
- vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
756
- fragColor = vec4(lightColor, color.a * opacity);
757
-
758
- #endif
759
-
760
- DECKGL_FILTER_COLOR(fragColor, geometry);
435
+ geometry.uv = vTexCoord;
436
+ vec3 normal;
437
+ if (flatShading) {
438
+ normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
439
+ } else {
440
+ normal = normals_commonspace;
441
+ }
442
+ vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
443
+ vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
444
+ fragColor = vec4(lightColor, color.a * opacity);
445
+ #endif
446
+ DECKGL_FILTER_COLOR(fragColor, geometry);
761
447
  }
762
- `;function qo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qo=function(r){return typeof r}:qo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qo(t)}function Bm(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function zt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Bm(Object(r),!0).forEach(function(n){MS(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bm(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function MS(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wS(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jt(t,e,r){return typeof Reflect<"u"&&Reflect.get?jt=Reflect.get:jt=function(i,o,s){var a=IS(i,o);if(a){var c=Object.getOwnPropertyDescriptor(a,o);return c.get?c.get.call(s):c.value}},jt(t,e,r||t)}function IS(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=ct(t),t!==null););return t}function OS(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&au(t,e)}function au(t,e){return au=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},au(t,e)}function RS(t){var e=FS();return function(){var n=ct(t),i;if(e){var o=ct(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return LS(this,i)}}function LS(t,e){if(e&&(qo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return PS(t)}function PS(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function FS(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ct(t){return ct=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ct(t)}function DS(t){var e=t.positions||t.POSITION,r=e.value.length/e.size,n=t.COLOR_0||t.colors;n||(t.colors={size:4,value:new Uint8Array(r*4).fill(255),normalized:!0})}var NS={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Wo=function(t){OS(r,t);var e=RS(r);function r(){return wS(this,r),e.apply(this,arguments)}var n=r.prototype;return n.getShaders=function(){var o=jt(ct(r.prototype),"getShaders",this).call(this),s=o.modules;return s.push(Yc),zt(zt({},o),{},{vs:Em,fs:Sm})},n.initializeState=function(){var o=this.props.featureIds;jt(ct(r.prototype),"initializeState",this).call(this);var s=this.getAttributeManager();o&&s.add({featureIdsPickingColors:{type:5121,size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})},n.updateState=function(o){jt(ct(r.prototype),"updateState",this).call(this,o);var s=o.props,a=o.oldProps;s.pbrMaterial!==a.pbrMaterial&&this.updatePbrMaterialUniforms(s.pbrMaterial)},n.draw=function(o){var s=this.props.featureIds;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(s)}),jt(ct(r.prototype),"draw",this).call(this,o))},n.getModel=function(o){var s=this.props,a=s.id,c=s.pbrMaterial,u=this.parseMaterial(c,o);this.setState({parsedPBRMaterial:u});var l=this.getShaders();DS(o.attributes);var f=new Vt(this.context.device,zt(zt({},this.getShaders()),{},{id:a,geometry:o,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:zt(zt(zt({},l.defines),u?.defines),{},{HAS_UV_REGIONS:o.attributes.uvRegions?1:0}),parameters:u?.parameters,isInstanced:!0}));return f},n.updatePbrMaterialUniforms=function(o){var s=this.state.model;if(s){var a=this.props.mesh,c=this.parseMaterial(o,a);this.setState({parsedPBRMaterial:c}),s.setBindings(c.bindings),s.setUniforms(c.uniforms)}},n.parseMaterial=function(o,s){var a=Boolean(o.pbrMetallicRoughness&&o.pbrMetallicRoughness.baseColorTexture);return Qc(this.context.device,zt({unlit:a},o),{NORMAL:s.attributes.normals,TEXCOORD_0:s.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})},n.calculateFeatureIdsPickingColors=function(o){for(var s=this.props.featureIds,a=new Uint8ClampedArray(s.length*o.size),c=[],u=0;u<s.length;u++)this.encodePickingColor(s[u],c),a[u*3]=c[0],a[u*3+1]=c[1],a[u*3+2]=c[2];o.value=a},n.finalizeState=function(o){var s;jt(ct(r.prototype),"finalizeState",this).call(this,o),(s=this.state.parsedPBRMaterial)===null||s===void 0||s.generatedTextures.forEach(function(a){return a.destroy()}),this.setState({parsedPBRMaterial:null})},r}(Cm.SimpleMeshLayer);Wo.layerName="MeshLayer";Wo.defaultProps=NS;var q0=P(jr());var xt=6356752314245179e-9,US={radii:[6378137,6378137,xt],radiiSquared:[6378137*6378137,6378137*6378137,xt*xt],oneOverRadii:[1/6378137,1/6378137,1/xt],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(xt*xt)],maximumRadius:Math.max(6378137,6378137,xt),centerToleranceSquared:.1};function Xo(t){return t}var v4=new T;function GS(t,e=[],r=Xo){return"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):"x"in t?(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function wm(t,e=[]){return GS(t,e,Y._cartographicRadians?Xo:Fa)}function HS(t,e,r=Xo){return"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):"x"in e?(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]):(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]),e}function Im(t,e){return HS(t,e,Y._cartographicRadians?Xo:Da)}var Om=1e-14,VS=new T,Rm={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},cu={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Yn={east:new T,north:new T,up:new T,west:new T,south:new T,down:new T},zS=new T,jS=new T,kS=new T;function uu(t,e,r,n,i,o){let s=Rm[e]&&Rm[e][r];le(s&&(!n||n===s));let a,c,u,l=VS.copy(i);if(_e(l.x,0,Om)&&_e(l.y,0,Om)){let h=Math.sign(l.z);a=zS.fromArray(cu[e]),e!=="east"&&e!=="west"&&a.scale(h),c=jS.fromArray(cu[r]),r!=="east"&&r!=="west"&&c.scale(h),u=kS.fromArray(cu[n]),n!=="east"&&n!=="west"&&u.scale(h)}else{let{up:h,east:d,north:p}=Yn;d.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,h),p.copy(h).cross(d);let{down:g,west:m,south:A}=Yn;g.copy(h).scale(-1),m.copy(d).scale(-1),A.copy(p).scale(-1),a=Yn[e],c=Yn[r],u=Yn[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=u.x,o[9]=u.y,o[10]=u.z,o[11]=0,o[12]=l.x,o[13]=l.y,o[14]=l.z,o[15]=1,o}var kr=new T,JS=new T,qS=new T;function Lm(t,e,r=[]){let{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;kr.from(t);let s=kr.x,a=kr.y,c=kr.z,u=n.x,l=n.y,f=n.z,h=s*s*u*u,d=a*a*l*l,p=c*c*f*f,g=h+d+p,m=Math.sqrt(1/g);if(!Number.isFinite(m))return;let A=JS;if(A.copy(t).scale(m),g<o)return A.to(r);let _=i.x,v=i.y,x=i.z,B=qS;B.set(A.x*_*2,A.y*v*2,A.z*x*2);let S=(1-m)*kr.len()/(.5*B.len()),C=0,E,b,y,M;do{S-=C,E=1/(1+S*_),b=1/(1+S*v),y=1/(1+S*x);let I=E*E,O=b*b,R=y*y,F=I*E,X=O*b,z=R*y;M=h*I+d*O+p*R-1;let W=-2*(h*F*_+d*X*v+p*z*x);C=M/W}while(Math.abs(M)>je.EPSILON12);return kr.scale([E,b,y]).to(r)}var Ko=new T,Pm=new T,KS=new T,Ke=new T,YS=new T,Yo=new T,U=class{constructor(e=0,r=0,n=0){L(this,"radii",void 0),L(this,"radiiSquared",void 0),L(this,"radiiToTheFourth",void 0),L(this,"oneOverRadii",void 0),L(this,"oneOverRadiiSquared",void 0),L(this,"minimumRadius",void 0),L(this,"maximumRadius",void 0),L(this,"centerToleranceSquared",je.EPSILON1),L(this,"squaredXOverSquaredZ",void 0),le(e>=0),le(r>=0),le(n>=0),this.radii=new T(e,r,n),this.radiiSquared=new T(e*e,r*r,n*n),this.radiiToTheFourth=new T(e*e*e*e,r*r*r*r,n*n*n*n),this.oneOverRadii=new T(e===0?0:1/e,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new T(e===0?0:1/(e*e),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(e,r,n),this.maximumRadius=Math.max(e,r,n),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(e){return this===e||Boolean(e&&this.radii.equals(e.radii))}toString(){return this.radii.toString()}cartographicToCartesian(e,r=[0,0,0]){let n=Pm,i=KS,[,,o]=e;this.geodeticSurfaceNormalCartographic(e,n),i.copy(this.radiiSquared).scale(n);let s=Math.sqrt(n.dot(i));return i.scale(1/s),n.scale(o),i.add(n),i.to(r)}cartesianToCartographic(e,r=[0,0,0]){Yo.from(e);let n=this.scaleToGeodeticSurface(Yo,Ke);if(!n)return;let i=this.geodeticSurfaceNormal(n,Pm),o=YS;o.copy(Yo).subtract(n);let s=Math.atan2(i.y,i.x),a=Math.asin(i.z),c=Math.sign(Lr.dot(o,Yo))*Lr.length(o);return Im([s,a,c],r)}eastNorthUpToFixedFrame(e,r=new D){return uu(this,"east","north","up",e,r)}localFrameToFixedFrame(e,r,n,i,o=new D){return uu(this,e,r,n,i,o)}geocentricSurfaceNormal(e,r=[0,0,0]){return Ko.from(e).normalize().to(r)}geodeticSurfaceNormalCartographic(e,r=[0,0,0]){let n=wm(e),i=n[0],o=n[1],s=Math.cos(o);return Ko.set(s*Math.cos(i),s*Math.sin(i),Math.sin(o)).normalize(),Ko.to(r)}geodeticSurfaceNormal(e,r=[0,0,0]){return Ko.from(e).scale(this.oneOverRadiiSquared).normalize().to(r)}scaleToGeodeticSurface(e,r){return Lm(e,this,r)}scaleToGeocentricSurface(e,r=[0,0,0]){Ke.from(e);let n=Ke.x,i=Ke.y,o=Ke.z,s=this.oneOverRadiiSquared,a=1/Math.sqrt(n*n*s.x+i*i*s.y+o*o*s.z);return Ke.multiplyScalar(a).to(r)}transformPositionToScaledSpace(e,r=[0,0,0]){return Ke.from(e).scale(this.oneOverRadii).to(r)}transformPositionFromScaledSpace(e,r=[0,0,0]){return Ke.from(e).scale(this.radii).to(r)}getSurfaceNormalIntersectionWithZAxis(e,r=0,n=[0,0,0]){le(_e(this.radii.x,this.radii.y,je.EPSILON15)),le(this.radii.z>0),Ke.from(e);let i=Ke.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(i)>=this.radii.z-r))return Ke.set(0,0,i).to(n)}};L(U,"WGS84",new U(6378137,6378137,xt));var Zo=class{constructor(e,r,n){this.item=void 0,this.previous=void 0,this.next=void 0,this.item=e,this.previous=r,this.next=n}};var Qo=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(e){let r=new Zo(e,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}splice(e,r){e!==r&&(this.remove(r),this._insert(e,r))}_insert(e,r){let n=e.next;e.next=r,this.tail===e?this.tail=r:n.previous=r,r.next=n,r.previous=e,++this._length}};var $o=class{constructor(){this._list=void 0,this._sentinel=void 0,this._trimTiles=void 0,this._list=new Qo,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(e){let r=e._cacheNode;r&&this._list.splice(this._sentinel,r)}add(e,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(e,r))}unloadTile(e,r,n){let i=r._cacheNode;i&&(this._list.remove(i),r._cacheNode=null,n&&n(e,r))}unloadTiles(e,r){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=e.maximumMemoryUsage*1024*1024,s=this._sentinel,a=i.head;for(;a!==s&&(e.gpuMemoryUsageInBytes>o||n);){let c=a.item;a=a.next,this.unloadTile(e,c,r)}}trim(){this._trimTiles=!0}};function Fm(t,e){H(t),H(e);let{rtcCenter:r,gltfUpAxis:n}=e,{computedTransform:i,boundingVolume:{center:o}}=t,s=new D(i);switch(r&&s.translate(r),n){case"Z":break;case"Y":let f=new D().rotateX(Math.PI/2);s=s.multiplyRight(f);break;case"X":let h=new D().rotateY(-Math.PI/2);s=s.multiplyRight(h);break;default:break}e.isQuantized&&s.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);let a=new T(o);e.cartesianModelMatrix=s,e.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new T),l=U.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=l.multiplyRight(s),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}var Dm=new T,lu=new T,fu=new ae([new fe,new fe,new fe,new fe,new fe,new fe]);function Um(t,e){let{cameraDirection:r,cameraUp:n,height:i}=t,{metersPerUnit:o}=t.distanceScales,s=es(t,t.center),a=U.WGS84.eastNorthUpToFixedFrame(s),c=t.unprojectPosition(t.cameraPosition),u=U.WGS84.cartographicToCartesian(c,new T),l=new T(a.transformAsVector(new T(r).scale(o))).normalize(),f=new T(a.transformAsVector(new T(n).scale(o))).normalize();ZS(t);let h=t.constructor,{longitude:d,latitude:p,width:g,bearing:m,zoom:A}=t,_=new h({longitude:d,latitude:p,height:i,width:g,bearing:m,zoom:A,pitch:0});return{camera:{position:u,direction:l,up:f},viewport:t,topDownViewport:_,height:i,cullingVolume:fu,frameNumber:e,sseDenominator:1.15}}function Gm(t,e,r){if(r===0||t.length<=r)return[t,[]];let n=[],{longitude:i,latitude:o}=e.viewport;for(let[u,l]of t.entries()){let[f,h]=l.header.mbs,d=Math.abs(i-f),p=Math.abs(o-h),g=Math.sqrt(p*p+d*d);n.push([u,g])}let s=n.sort((u,l)=>u[1]-l[1]),a=[];for(let u=0;u<r;u++)a.push(t[s[u][0]]);let c=[];for(let u=r;u<s.length;u++)c.push(t[s[u][0]]);return[a,c]}function ZS(t){let e=t.getFrustumPlanes(),r=Nm(e.near,t.cameraPosition),n=es(t,r),i=es(t,t.cameraPosition,lu),o=0;fu.planes[o++].fromPointNormal(n,Dm.copy(n).subtract(i));for(let s in e){if(s==="near")continue;let a=e[s],c=Nm(a,r,lu),u=es(t,c,lu);fu.planes[o++].fromPointNormal(u,Dm.copy(n).subtract(u))}}function Nm(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new T,n=t.normal.dot(e);return r.copy(t.normal).scale(t.distance-n).add(e),r}function es(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new T,n=t.unprojectPosition(e);return U.WGS84.cartographicToCartesian(n,r)}var QS=6378137,$S=6378137,hu=6356752314245179e-9,Jr=new T;function Hm(t,e){if(t instanceof Je){let{halfAxes:r}=t,n=eB(r);return Math.log2(hu/(n+e[2]))}else if(t instanceof Pe){let{radius:r}=t;return Math.log2(hu/(r+e[2]))}else if(t.width&&t.height){let{width:r,height:n}=t,i=Math.log2(QS/r),o=Math.log2($S/n);return(i+o)/2}return 1}function du(t,e,r){U.WGS84.cartographicToCartesian([t.xmax,t.ymax,t.zmax],Jr);let n=Math.sqrt(Math.pow(Jr[0]-r[0],2)+Math.pow(Jr[1]-r[1],2)+Math.pow(Jr[2]-r[2],2));return Math.log2(hu/(n+e[2]))}function Vm(t,e,r){let[n,i,o,s]=t;return du({xmin:n,xmax:o,ymin:i,ymax:s,zmin:0,zmax:0},e,r)}function eB(t){t.getColumn(0,Jr);let e=t.getColumn(1),r=t.getColumn(2);return Jr.add(e).add(r).len()}var ig=P(jr(),1);var ve={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},be=function(t){return t[t.ADD=1]="ADD",t[t.REPLACE=2]="REPLACE",t}({}),ut=function(t){return t.EMPTY="empty",t.SCENEGRAPH="scenegraph",t.POINTCLOUD="pointcloud",t.MESH="mesh",t}({}),pe=function(t){return t.I3S="I3S",t.TILES3D="TILES3D",t}({}),fr=function(t){return t.GEOMETRIC_ERROR="geometricError",t.MAX_SCREEN_THRESHOLD="maxScreenThreshold",t}({}),zm={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function qm(t){return t!=null}var me=new T,ts=new T,tB=new T,rB=new T,hr=new T,jm=new T,km=new T,Jm=new T;function rs(t,e,r){if(H(t,"3D Tile: boundingVolume must be defined"),t.box)return Xm(t.box,e,r);if(t.region)return iB(t.region);if(t.sphere)return nB(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Wm(t,e){if(t.box)return oB(e);if(t.region){let[r,n,i,o,s,a]=t.region;return[[Ie(r),Ie(n),s],[Ie(i),Ie(o),a]]}if(t.sphere)return sB(e);throw new Error("Unkown boundingVolume type")}function Xm(t,e,r){let n=new T(t[0],t[1],t[2]);e.transform(n,n);let i=[];if(t.length===10){let u=t.slice(3,6),l=new nt;l.fromArray(t,6);let f=new T([1,0,0]),h=new T([0,1,0]),d=new T([0,0,1]);f.transformByQuaternion(l),f.scale(u[0]),h.transformByQuaternion(l),h.scale(u[1]),d.transformByQuaternion(l),d.scale(u[2]),i=[...f.toArray(),...h.toArray(),...d.toArray()]}else i=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];let o=e.transformAsVector(i.slice(0,3)),s=e.transformAsVector(i.slice(3,6)),a=e.transformAsVector(i.slice(6,9)),c=new j([o[0],o[1],o[2],s[0],s[1],s[2],a[0],a[1],a[2]]);return qm(r)?(r.center=n,r.halfAxes=c,r):new Je(n,c)}function nB(t,e,r){let n=new T(t[0],t[1],t[2]);e.transform(n,n);let i=e.getScale(ts),o=Math.max(Math.max(i[0],i[1]),i[2]),s=t[3]*o;return qm(r)?(r.center=n,r.radius=s,r):new Pe(n,s)}function iB(t){let[e,r,n,i,o,s]=t,a=U.WGS84.cartographicToCartesian([Ie(e),Ie(i),o],tB),c=U.WGS84.cartographicToCartesian([Ie(n),Ie(r),s],rB),u=new T().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(u,hr),U.WGS84.cartographicToCartesian([Ie(n),hr[1],hr[2]],jm),U.WGS84.cartographicToCartesian([hr[0],Ie(i),hr[2]],km),U.WGS84.cartographicToCartesian([hr[0],hr[1],s],Jm),Xm([...u,...jm.subtract(u),...km.subtract(u),...Jm.subtract(u)],new D)}function oB(t){let e=Km(),{halfAxes:r}=t,n=new T(r.getColumn(0)),i=new T(r.getColumn(1)),o=new T(r.getColumn(2));for(let s=0;s<2;s++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)me.copy(t.center),me.add(n),me.add(i),me.add(o),Ym(e,me),o.negate();i.negate()}n.negate()}return e}function sB(t){let e=Km(),{center:r,radius:n}=t,i=U.WGS84.scaleToGeodeticSurface(r,me),o;i?o=U.WGS84.geodeticSurfaceNormal(i):o=new T(0,0,1);let s=new T(o[2],-o[1],0);s.len()>0?s.normalize():s=new T(0,1,0);let a=s.clone().cross(o);for(let c of[s,a,o]){ts.copy(c).scale(n);for(let u=0;u<2;u++)me.copy(r),me.add(ts),Ym(e,me),ts.negate()}return e}function Km(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function Ym(t,e){U.WGS84.cartesianToCartographic(e,me),t[0][0]=Math.min(t[0][0],me[0]),t[0][1]=Math.min(t[0][1],me[1]),t[0][2]=Math.min(t[0][2],me[2]),t[1][0]=Math.max(t[1][0],me[0]),t[1][1]=Math.max(t[1][1],me[1]),t[1][2]=Math.max(t[1][2],me[2])}var a8=new T,c8=new T,u8=new D,l8=new T,f8=new T,h8=new T;function aB(t,e){let r=t*e;return 1-Math.exp(-(r*r))}function cB(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){let r=t.dynamicScreenSpaceErrorComputedDensity,n=t.dynamicScreenSpaceErrorFactor;return aB(e,r)*n}return 0}function Zm(t,e,r){let n=t.tileset,i=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,o=r?i:t.lodMetricValue;if(o===0)return 0;let s=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:u}=n.options,l=o*a*(u||1)/(s*c);return l-=cB(n,s),l}var pu=new T,Qm=new T,kt=new T,$m=new T,uB=new T,mu=new D,eg=new D;function tg(t,e){if(t.lodMetricValue===0||isNaN(t.lodMetricValue))return"DIG";let r=2*gu(t,e);return r<2?"OUT":!t.header.children||r<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}function gu(t,e){let{topDownViewport:r}=e,n=t.header.mbs[1],i=t.header.mbs[0],o=t.header.mbs[2],s=t.header.mbs[3],a=[...t.boundingVolume.center],c=r.unprojectPosition(r.cameraPosition);U.WGS84.cartographicToCartesian(c,pu),Qm.copy(pu).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,mu),eg.copy(mu).invert(),kt.copy(pu).transform(eg);let u=Math.sqrt(kt[0]*kt[0]+kt[1]*kt[1]),l=u*u/kt[2];$m.copy([kt[0],kt[1],l]);let h=$m.transform(mu).subtract(a).normalize(),p=Qm.cross(h).normalize().scale(s).add(a),g=U.WGS84.cartesianToCartographic(p),m=r.project([i,n,o]),A=r.project(g);return uB.copy(m).subtract(A).magnitude()}function rg(t){return{assetGltfUpAxis:t.asset&&t.asset.gltfUpAxis||"Y"}}var Zn=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this._map=new Map,this._array=void 0,this._length=void 0,this._array=new Array(e),this._length=e}get length(){return this._length}set length(e){this._length=e,e>this._array.length&&(this._array.length=e)}get values(){return this._array}get(e){return H(e<this._array.length),this._array[e]}set(e,r){H(e>=0),e>=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=r,this._map.set(r,e)}delete(e){let r=this._map.get(e);r>=0&&(this._array.splice(r,1),this._map.delete(e),this.length--)}peek(){return this._array[this._length-1]}push(e){if(!this._map.has(e)){let r=this.length++;this._array[r]=e,this._map.set(e,r)}}pop(){let e=this._array[--this.length];return this._map.delete(e),e}reserve(e){H(e>=0),e>this._array.length&&(this._array.length=e)}resize(e){H(e>=0),this.length=e}trim(e){e==null&&(e=this.length),this._array.length=e}reset(){this._array=[],this._map=new Map,this._length=0}find(e){return this._map.has(e)}};var lB={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},lt=class{traversalFinished(e){return!0}constructor(e){this.options=void 0,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new Zn,this._emptyTraversalStack=new Zn,this._frameNumber=null,this.options={...lB,...e}}traverse(e,r,n){this.root=e,this.options={...this.options,...n},this.reset(),this.updateTile(e,r),this._frameNumber=r.frameNumber,this.executeTraversal(e,r)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(e,r){let n=this._traversalStack;for(e._selectionDepth=1,n.push(e);n.length>0;){let o=n.pop(),s=!1;this.canTraverse(o,r)&&(this.updateChildTiles(o,r),s=this.updateAndPushChildren(o,r,n,o.hasRenderContent?o._selectionDepth+1:o._selectionDepth));let a=o.parent,c=Boolean(!a||a._shouldRefine),u=!s;o.hasRenderContent?o.refine===be.ADD?(this.loadTile(o,r),this.selectTile(o,r)):o.refine===be.REPLACE&&(this.loadTile(o,r),u&&this.selectTile(o,r)):(this.emptyTiles[o.id]=o,this.loadTile(o,r),u&&this.selectTile(o,r)),this.touchTile(o,r),o._shouldRefine=s&&c}let i=new Date().getTime();(this.traversalFinished(r)||i-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=i,this.options.onTraversalEnd(r))}updateChildTiles(e,r){let n=e.children;for(let i of n)this.updateTile(i,r)}updateAndPushChildren(e,r,n,i){let{loadSiblings:o,skipLevelOfDetail:s}=this.options,a=e.children;a.sort(this.compareDistanceToCamera.bind(this));let c=e.refine===be.REPLACE&&e.hasRenderContent&&!s,u=!1,l=!0;for(let f of a)if(f._selectionDepth=i,f.isVisibleAndInRequestVolume?(n.find(f)&&n.delete(f),n.push(f),u=!0):(c||o)&&(this.loadTile(f,r),this.touchTile(f,r)),c){let h;if(f._inRequestVolume?f.hasRenderContent?h=f.contentAvailable:h=this.executeEmptyTraversal(f,r):h=!1,l=l&&h,!l)return!1}return u||(l=!1),l}updateTile(e,r){this.updateTileVisibility(e,r)}selectTile(e,r){this.shouldSelectTile(e)&&(e._selectedFrame=r.frameNumber,this.selectedTiles[e.id]=e)}loadTile(e,r){this.shouldLoadTile(e)&&(e._requestedFrame=r.frameNumber,e._priority=e._getPriority(),this.requestedTiles[e.id]=e)}touchTile(e,r){e.tileset._cache.touch(e),e._touchedFrame=r.frameNumber}canTraverse(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return e.hasChildren?e.hasTilesetContent?!e.contentExpired:!i&&!e.isVisibleAndInRequestVolume?!1:this.shouldRefine(e,r,n):!1}shouldLoadTile(e){return e.hasUnloadedContent||e.contentExpired}shouldSelectTile(e){return e.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=e._screenSpaceError;return n&&(i=e.getScreenSpaceError(r,!0)),i>this.options.maximumScreenSpaceError}updateTileVisibility(e,r){let n=[];if(this.options.viewportTraversersMap)for(let i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===r.viewport.id&&n.push(i);else n.push(r.viewport.id);e.updateVisibility(r,n)}compareDistanceToCamera(e,r){return e._distanceToCamera-r._distanceToCamera}anyChildrenVisible(e,r){let n=!1;for(let i of e.children)i.updateVisibility(r),n=n||i.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(e,r){let n=!0,i=this._emptyTraversalStack;for(i.push(e);i.length>0;){let o=i.pop(),s=!o.hasRenderContent&&this.canTraverse(o,r,!1,!1),a=!o.hasRenderContent&&o.children.length===0;if(!s&&!o.contentAvailable&&!a&&(n=!1),this.updateTile(o,r),o.isVisibleAndInRequestVolume||(this.loadTile(o,r),this.touchTile(o,r)),s){let c=o.children;for(let u of c)i.push(u)}}return n}};var ng=new T;function fB(t){return t!=null}var dr=class{constructor(e,r,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";this.tileset=void 0,this.header=void 0,this.id=void 0,this.url=void 0,this.parent=void 0,this.refine=void 0,this.type=void 0,this.contentUrl=void 0,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=ve.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new D,this.extensions=null,this.implicitTiling=null,this.userData={},this.computedTransform=void 0,this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new lt({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visibilityPlaneMask=void 0,this._visible=void 0,this._contentBoundingVolume=void 0,this._viewerRequestVolume=void 0,this._initialTransform=new D,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=r,this.tileset=e,this.id=i||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this._initializeLodMetric(r),this._initializeTransforms(r),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===ve.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===ve.UNLOADED}get contentExpired(){return this.contentState===ve.EXPIRED}get contentFailed(){return this.contentState===ve.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=Wm(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(e,r){switch(this.tileset.type){case pe.I3S:return gu(this,e);case pe.TILES3D:return Zm(this,e,r);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let e=this.tileset._traverser,{skipLevelOfDetail:r}=e.options,n=this.refine===be.ADD||r;if(n&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===ve.UNLOADED)return-1;let i=this.parent,s=i&&(!n||this._screenSpaceError===0||i.hasTilesetContent)?i._screenSpaceError:this._screenSpaceError,a=e.root?e.root._screenSpaceError:0;return Math.max(a-s,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=ve.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=ve.UNLOADED,!1;try{let n=this.tileset.getTileUrl(this.contentUrl),i=this.tileset.loader,o={...this.tileset.loadOptions,[i.id]:{...this.tileset.loadOptions[i.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(i.id)}};return this.content=await(0,ig.load)(n,i,o),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=ve.READY,this._onContentLoaded(),!0}catch(n){throw this.contentState=ve.FAILED,n}finally{r.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=ve.UNLOADED,!0}updateVisibility(e,r){if(this._frameNumber===e.frameNumber)return;let n=this.parent,i=n?n._visibilityPlaneMask:ae.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(e),this._screenSpaceError=this.getScreenSpaceError(e,!1),this._visibilityPlaneMask=this.visibility(e,i),this._visible=this._visibilityPlaneMask!==ae.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._frameNumber=e.frameNumber,this.viewportIds=r}visibility(e,r){let{cullingVolume:n}=e,{boundingVolume:i}=this;return n.computeVisibilityWithPlaneMask(i,r)}contentVisibility(){return!0}distanceToTile(e){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(e.camera.position),0))}cameraSpaceZDepth(e){let{camera:r}=e,n=this.boundingVolume;return ng.subVectors(n.center,r.position),r.direction.dot(ng)}insideViewerRequestVolume(e){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(e.camera.position)<=0}updateExpiration(){if(fB(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let e=Date.now();Date.lessThan(this._expireDate,e)&&(this.contentState=ve.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(e){"lodMetricType"in e?this.lodMetricType=e.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in e?this.lodMetricValue=e.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(e){this.transform=e.transform?new D(e.transform):new D;let r=this.parent,n=this.tileset,i=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new D(i).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new D;this._initialTransform=new D(o).multiplyRight(this.transform)}_initializeBoundingVolumes(e){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(e)}_initializeContent(e){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=ve.UNLOADED,this.hasTilesetContent=!1,e.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(e){this.depth=e.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ae.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(e){return e||this.parent&&this.parent.refine||be.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(e){this.boundingVolume=rs(e.boundingVolume,this.computedTransform,this.boundingVolume);let r=e.content;r&&(r.boundingVolume&&(this._contentBoundingVolume=rs(r.boundingVolume,this.computedTransform,this._contentBoundingVolume)),e.viewerRequestVolume&&(this._viewerRequestVolume=rs(e.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(){let r=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:new D).clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(e){switch(e){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return rg(this.tileset.tileset)}}};var ns=class extends lt{compareDistanceToCamera(e,r){return r._distanceToCamera===0&&e._distanceToCamera===0?r._centerZDepth-e._centerZDepth:r._distanceToCamera-e._distanceToCamera}updateTileVisibility(e,r){if(super.updateTileVisibility(e,r),!e.isVisibleAndInRequestVolume)return;let n=e.children.length>0;if(e.hasTilesetContent&&n){let s=e.children[0];this.updateTileVisibility(s,r),e._visible=s._visible;return}if(this.meetsScreenSpaceErrorEarly(e,r)){e._visible=!1;return}let i=e.refine===be.REPLACE,o=e._optimChildrenWithinParent===zm.USE_OPTIMIZATION;if(i&&o&&n&&!this.anyChildrenVisible(e,r)){e._visible=!1;return}}meetsScreenSpaceErrorEarly(e,r){let{parent:n}=e;return!n||n.hasTilesetContent||n.refine!==be.ADD?!1:!this.shouldRefine(e,r,!0)}};var og=P(jr(),1);var is=class{constructor(){this.frameNumberMap=new Map}register(e,r){let n=this.frameNumberMap.get(e)||new Map,i=n.get(r)||0;n.set(r,i+1),this.frameNumberMap.set(e,n)}deregister(e,r){let n=this.frameNumberMap.get(e);if(!n)return;let i=n.get(r)||1;n.set(r,i-1)}isZero(e,r){var n;return(((n=this.frameNumberMap.get(e))===null||n===void 0?void 0:n.get(r))||0)===0}};var yu={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},os=class{constructor(){this._statusMap=void 0,this.pendingTilesRegister=new is,this._statusMap={}}add(e,r,n,i){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:s}}=i;this._statusMap[r]={request:e,callback:n,key:r,frameState:i,status:yu.REQUESTED},this.pendingTilesRegister.register(s,o),e().then(a=>{this._statusMap[r].status=yu.COMPLETED;let{frameNumber:c,viewport:{id:u}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(u,c),this._statusMap[r].callback(a,i)}).catch(a=>{this._statusMap[r].status=yu.ERROR;let{frameNumber:c,viewport:{id:u}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(u,c),n(a)})}}update(e,r){if(this._statusMap[e]){let{frameNumber:n,viewport:{id:i}}=this._statusMap[e].frameState;this.pendingTilesRegister.deregister(i,n);let{frameNumber:o,viewport:{id:s}}=r;this.pendingTilesRegister.register(s,o),this._statusMap[e].frameState=r}}find(e){return this._statusMap[e]}hasPendingTiles(e,r){return!this.pendingTilesRegister.isZero(e,r)}};var ss=class extends lt{constructor(e){super(e),this._tileManager=void 0,this._tileManager=new os}traversalFinished(e){return!this._tileManager.hasPendingTiles(e.viewport.id,this._frameNumber||0)}shouldRefine(e,r){return e._lodJudge=tg(e,r),e._lodJudge==="DIG"}updateChildTiles(e,r){let n=e.header.children||[],i=e.children,o=e.tileset;for(let s of n){let a=`${s.id}-${r.viewport.id}`,c=i&&i.find(u=>u.id===a);if(c)c&&this.updateTile(c,r);else{let u=()=>this._loadTile(s.id,o);this._tileManager.find(a)?this._tileManager.update(a,r):(o.tileset.nodePages&&(u=()=>o.tileset.nodePagesTile.formTileFromNodePages(s.id)),this._tileManager.add(u,a,f=>this._onTileLoad(f,e,a),r))}}return!1}async _loadTile(e,r){let{loader:n}=r,i=r.getTileUrl(`${r.url}/nodes/${e}`),o={...r.loadOptions,i3s:{...r.loadOptions.i3s,isTileHeader:!0}};return await(0,og.load)(i,n,o)}_onTileLoad(e,r,n){let i=new dr(r.tileset,e,r,n);r.children.push(i);let o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(i,o)}};var hB={description:"",ellipsoid:U.WGS84,modelMatrix:new D,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},as="Tiles In Tileset(s)",Au="Tiles In Memory",sg="Tiles In View",ag="Tiles To Render",cg="Tiles Loaded",_u="Tiles Loading",ug="Tiles Unloaded",lg="Failed Tile Loads",fg="Points/Vertices",vu="Tile Memory Use",Qn=class{constructor(e,r){this.options=void 0,this.loadOptions=void 0,this.type=void 0,this.tileset=void 0,this.loader=void 0,this.url=void 0,this.basePath=void 0,this.modelMatrix=void 0,this.ellipsoid=void 0,this.lodMetricType=void 0,this.lodMetricValue=void 0,this.refine=void 0,this.root=null,this.roots={},this.asset={},this.description="",this.properties=void 0,this.extras=null,this.attributions={},this.credits={},this.stats=void 0,this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._traverser=void 0,this._cache=new $o,this._requestScheduler=void 0,this.updatePromise=null,this.tilesetInitializationPromise=void 0,this.options={...hB,...r},this.tileset=e,this.loader=e.loader,this.type=e.type,this.url=e.url,this.basePath=e.basePath||It.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=e.lodMetricType,this.lodMetricValue=e.lodMetricValue,this.refine=e.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new wt({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.stats=new Mt({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(e)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(e){this.options={...this.options,...e}}getTileUrl(e){if(e.startsWith("data:"))return e;let n=e;return this.queryParams.length&&(n=`${e}${e.includes("?")?"&":"?"}${this.queryParams}`),n}hasExtension(e){return Boolean(this._extensionsUsed.indexOf(e)>-1)}update(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this.tilesetInitializationPromise.then(()=>{!e&&this.lastUpdatedVieports?e=this.lastUpdatedVieports:this.lastUpdatedVieports=e,e&&this.doUpdate(e)})}async selectTiles(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return await this.tilesetInitializationPromise,e&&(this.lastUpdatedVieports=e),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}doUpdate(e){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=e instanceof Array?e:[e];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let n=[];for(let i of r){let o=i.id;this._needTraverse(o)?n.push(o):this.traverseCounter--}for(let i of r){let o=i.id;if(this.roots[o]||(this.roots[o]=this._initializeTileHeaders(this.tileset,null)),!n.includes(o))continue;let s=Um(i,this._frameNumber);this._traverser.traverse(this.roots[o],s,this.options)}}_needTraverse(e){let r=e;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[e]),r===e}_onTraversalEnd(e){let r=e.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],i=Object.values(this._traverser.selectedTiles),[o,s]=Gm(i,e,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of s)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let e in this.frameStateData){let r=this.frameStateData[e];this.selectedTiles=this.selectedTiles.concat(r.selectedTiles),this._requestedTiles=this._requestedTiles.concat(r._requestedTiles),this._emptyTiles=this._emptyTiles.concat(r._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let e of this.selectedTiles)this._tiles[e.id]=e;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(e,r){if(e.length!==r.length)return!0;let n=new Set(e.map(s=>s.id)),i=new Set(r.map(s=>s.id)),o=e.filter(s=>!i.has(s.id)).length>0;return o=o||r.filter(s=>!n.has(s.id)).length>0,o}_loadTiles(){for(let e of this._requestedTiles)e.contentUnloaded&&this._loadTile(e)}_unloadTiles(){this._cache.unloadTiles(this,(e,r)=>e._unloadTile(r))}_updateStats(){let e=0,r=0;for(let n of this.selectedTiles)n.contentAvailable&&n.content&&(e++,n.content.pointCount?r+=n.content.pointCount:r+=n.content.vertexCount);this.stats.get(sg).count=this.selectedTiles.length,this.stats.get(ag).count=e,this.stats.get(fg).count=r}async _initializeTileSet(e){this.type===pe.I3S&&(this.calculateViewPropsI3S(),e.root=await e.root),this.root=this._initializeTileHeaders(e,null),this.type===pe.TILES3D&&(this._initializeTiles3DTileset(e),this.calculateViewPropsTiles3D()),this.type===pe.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var e;let r=this.tileset.fullExtent;if(r){let{xmin:i,xmax:o,ymin:s,ymax:a,zmin:c,zmax:u}=r;this.cartographicCenter=new T(i+(o-i)/2,s+(a-s)/2,c+(u-c)/2),this.cartesianCenter=new T,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=du(r,this.cartographicCenter,this.cartesianCenter);return}let n=(e=this.tileset.store)===null||e===void 0?void 0:e.extent;if(n){let[i,o,s,a]=n;this.cartographicCenter=new T(i+(s-i)/2,o+(a-o)/2,0),this.cartesianCenter=new T,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Vm(n,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new T,this.zoom=1}calculateViewPropsTiles3D(){let e=this.root,{center:r}=e.boundingVolume;if(!r){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new T,this.zoom=1;return}r[0]!==0||r[1]!==0||r[2]!==0?(this.cartographicCenter=new T,U.WGS84.cartesianToCartographic(r,this.cartographicCenter)):this.cartographicCenter=new T(0,0,-U.WGS84.radii[0]),this.cartesianCenter=r,this.zoom=Hm(e.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(as),this.stats.get(_u),this.stats.get(Au),this.stats.get(sg),this.stats.get(ag),this.stats.get(cg),this.stats.get(ug),this.stats.get(lg),this.stats.get(fg),this.stats.get(vu,"memory")}_initializeTileHeaders(e,r){let n=new dr(this,e.root,r);if(r&&(r.children.push(n),n.depth=r.depth+1),this.type===pe.TILES3D){let o=[];for(o.push(n);o.length>0;){let s=o.pop();this.stats.get(as).incrementCount();let a=s.header.children||[];for(let c of a){var i;let u=new dr(this,c,s);if((i=u.contentUrl)!==null&&i!==void 0&&i.includes("?session=")){let f=new URL(u.contentUrl).searchParams.get("session");f&&(this._queryParams.session=f)}s.children.push(u),u.depth=s.depth+1,o.push(u)}}}return n}_initializeTraverser(){let e;switch(this.type){case pe.TILES3D:e=ns;break;case pe.I3S:e=ss;break;default:e=lt}return new e({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(e){this._destroySubtree(e)}async _loadTile(e){let r;try{this._onStartTileLoading(),r=await e.loadContent()}catch(n){this._onTileLoadError(e,n instanceof Error?n:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(e,r)}}_onTileLoadError(e,r){this.stats.get(lg).incrementCount();let n=r.message||r.toString(),i=e.url;console.error(`A 3D tile failed to load: ${e.url} ${n}`),this.options.onTileError(e,n,i)}_onTileLoad(e,r){if(r){if(this.type===pe.I3S){var n,i;let o=((n=this.tileset)===null||n===void 0||(i=n.nodePagesTile)===null||i===void 0?void 0:i.nodesInNodePages)||0;this.stats.get(as).reset(),this.stats.get(as).addCount(o)}e&&e.content&&Fm(e,e.content),this.updateContentTypes(e),this._addTileToCache(e),this.options.onTileLoad(e)}}updateContentTypes(e){if(this.type===pe.I3S)switch(e.header.isDracoGeometry&&(this.contentFormats.draco=!0),e.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===pe.TILES3D){var r;let{extensionsRemoved:n=[]}=((r=e.content)===null||r===void 0?void 0:r.gltf)||{};n.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),n.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),n.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(_u).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(_u).decrementCount()}_addTileToCache(e){this._cache.add(this,e,r=>r._updateCacheStats(e))}_updateCacheStats(e){this.stats.get(cg).incrementCount(),this.stats.get(Au).incrementCount(),this.gpuMemoryUsageInBytes+=e.gpuMemoryUsageInBytes||0,this.stats.get(vu).count=this.gpuMemoryUsageInBytes}_unloadTile(e){this.gpuMemoryUsageInBytes-=e.gpuMemoryUsageInBytes||0,this.stats.get(Au).decrementCount(),this.stats.get(ug).incrementCount(),this.stats.get(vu).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(e),e.unloadContent()}_destroy(){let e=[];for(this.root&&e.push(this.root);e.length>0;){let r=e.pop();for(let n of r.children)e.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(e){let r=e,n=[];for(n.push(r);n.length>0;){e=n.pop();for(let i of e.children)n.push(i);e!==r&&this._destroyTile(e)}r.children=[]}_destroyTile(e){this._cache.unloadTile(this,e),this._unloadTile(e),e.destroy()}_initializeTiles3DTileset(e){if(e.queryString){let r=new URLSearchParams(e.queryString),n=Object.fromEntries(r.entries());this._queryParams={...this._queryParams,...n}}if(this.asset=e.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=e.properties,this.geometricError=e.geometricError,this._extensionsUsed=e.extensionsUsed||[],this.extras=e.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var cs="4.1.0-alpha.9";var pr={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},a9=Object.keys(pr);function xu(t,e,r){H(t instanceof ArrayBuffer);let n=new TextDecoder("utf8"),i=new Uint8Array(t,e,r);return n.decode(i)}function hg(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=new DataView(t);return`${String.fromCharCode(r.getUint8(e+0))}${String.fromCharCode(r.getUint8(e+1))}${String.fromCharCode(r.getUint8(e+2))}${String.fromCharCode(r.getUint8(e+3))}`}var dg="4.1.0-alpha.9";var pg={name:"Draco",id:"draco",module:"draco",version:dg,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function mg(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function mr(t){let e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-1/0,a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let u=0;u<c;u+=3){let l=a[u],f=a[u+1],h=a[u+2];e=l<e?l:e,r=f<r?f:r,n=h<n?h:n,i=l>i?l:i,o=f>o?f:o,s=h>s?h:s}return[[e,r,n],[i,o,s]]}function Tu(t,e,r){let n=mg(e.value),i=r||gg(e);return{name:t,type:{type:"fixed-size-list",listSize:e.size,children:[{name:"value",type:n}]},nullable:!1,metadata:i}}function gg(t){let e={};return"byteOffset"in t&&(e.byteOffset=t.byteOffset.toString(10)),"byteStride"in t&&(e.byteStride=t.byteStride.toString(10)),"normalized"in t&&(e.normalized=t.normalized.toString()),e}function Ag(t,e,r){let n=_g(e.metadata),i=[],o=dB(e.attributes);for(let s in t){let a=t[s],c=yg(s,a,o[s]);i.push(c)}if(r){let s=yg("indices",r);i.push(s)}return{fields:i,metadata:n}}function dB(t){let e={};for(let r in t){let n=t[r];e[n.name||"undefined"]=n}return e}function yg(t,e,r){let n=r?_g(r.metadata):void 0;return Tu(t,e,n)}function _g(t){Object.entries(t);let e={};for(let r in t)e[`${r}.string`]=JSON.stringify(t[r]);return e}var vg={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},pB={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},mB=4,$n=class{constructor(e){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new this.draco.DecoderBuffer;n.Init(new Int8Array(e),e.byteLength),this._disableAttributeTransforms(r);let i=this.decoder.GetEncodedGeometryType(n),o=i===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let s;switch(i){case this.draco.TRIANGULAR_MESH:s=this.decoder.DecodeBufferToMesh(n,o);break;case this.draco.POINT_CLOUD:s=this.decoder.DecodeBufferToPointCloud(n,o);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!s.ok()||!o.ptr){let h=`DRACO decompression failed: ${s.error_msg()}`;throw new Error(h)}let a=this._getDracoLoaderData(o,i,r),c=this._getMeshData(o,a,r),u=mr(c.attributes),l=Ag(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:o.num_points(),boundingBox:u},...c,schema:l}}finally{this.draco.destroy(n),o&&this.draco.destroy(o)}}_getDracoLoaderData(e,r,n){let i=this._getTopLevelMetadata(e),o=this._getDracoAttributes(e,n);return{geometry_type:r,num_attributes:e.num_attributes(),num_points:e.num_points(),num_faces:e instanceof this.draco.Mesh?e.num_faces():0,metadata:i,attributes:o}}_getDracoAttributes(e,r){let n={};for(let i=0;i<e.num_attributes();i++){let o=this.decoder.GetAttribute(e,i),s=this._getAttributeMetadata(e,i);n[o.unique_id()]={unique_id:o.unique_id(),attribute_type:o.attribute_type(),data_type:o.data_type(),num_components:o.num_components(),byte_offset:o.byte_offset(),byte_stride:o.byte_stride(),normalized:o.normalized(),attribute_index:i,metadata:s};let a=this._getQuantizationTransform(o,r);a&&(n[o.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(o,r);c&&(n[o.unique_id()].octahedron_transform=c)}return n}_getMeshData(e,r,n){let i=this._getMeshAttributes(r,e,n);if(!i.POSITION)throw new Error("DRACO: No position attribute found.");if(e instanceof this.draco.Mesh)switch(n.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:i,indices:{value:this._getTriangleStripIndices(e),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:i,indices:{value:this._getTriangleListIndices(e),size:1}}}return{topology:"point-list",mode:0,attributes:i}}_getMeshAttributes(e,r,n){let i={};for(let o of Object.values(e.attributes)){let s=this._deduceAttributeName(o,n);o.name=s;let{value:a,size:c}=this._getAttributeValues(r,o);i[s]={value:a,size:c,byteOffset:o.byte_offset,byteStride:o.byte_stride,normalized:o.normalized}}return i}_getTriangleListIndices(e){let n=e.num_faces()*3,i=n*mB,o=this.draco._malloc(i);try{return this.decoder.GetTrianglesUInt32Array(e,i,o),new Uint32Array(this.draco.HEAPF32.buffer,o,n).slice()}finally{this.draco._free(o)}}_getTriangleStripIndices(e){let r=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(e,r),AB(r)}finally{this.draco.destroy(r)}}_getAttributeValues(e,r){let n=pB[r.data_type],i=r.num_components,s=e.num_points()*i,a=s*n.BYTES_PER_ELEMENT,c=gB(this.draco,n),u,l=this.draco._malloc(a);try{let f=this.decoder.GetAttribute(e,r.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(e,f,c,a,l),u=new n(this.draco.HEAPF32.buffer,l,s).slice()}finally{this.draco._free(l)}return{value:u,size:i}}_deduceAttributeName(e,r){let n=e.unique_id;for(let[s,a]of Object.entries(r.extraAttributes||{}))if(a===n)return s;let i=e.attribute_type;for(let s in vg)if(this.draco[s]===i)return vg[s];let o=r.attributeNameEntry||"name";return e.metadata[o]?e.metadata[o].string:`CUSTOM_ATTRIBUTE_${n}`}_getTopLevelMetadata(e){let r=this.decoder.GetMetadata(e);return this._getDracoMetadata(r)}_getAttributeMetadata(e,r){let n=this.decoder.GetAttributeMetadata(e,r);return this._getDracoMetadata(n)}_getDracoMetadata(e){if(!e||!e.ptr)return{};let r={},n=this.metadataQuerier.NumEntries(e);for(let i=0;i<n;i++){let o=this.metadataQuerier.GetEntryName(e,i);r[o]=this._getDracoMetadataField(e,o)}return r}_getDracoMetadataField(e,r){let n=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(e,r,n);let i=yB(n);return{int:this.metadataQuerier.GetIntEntry(e,r),string:this.metadataQuerier.GetStringEntry(e,r),double:this.metadataQuerier.GetDoubleEntry(e,r),intArray:i}}finally{this.draco.destroy(n)}}_disableAttributeTransforms(e){let{quantizedAttributes:r=[],octahedronAttributes:n=[]}=e,i=[...r,...n];for(let o of i)this.decoder.SkipAttributeTransform(this.draco[o])}_getQuantizationTransform(e,r){let{quantizedAttributes:n=[]}=r,i=e.attribute_type();if(n.map(s=>this.decoder[s]).includes(i)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits(),range:s.range(),min_values:new Float32Array([1,2,3]).map(a=>s.min_value(a))}}finally{this.draco.destroy(s)}}return null}_getOctahedronTransform(e,r){let{octahedronAttributes:n=[]}=r,i=e.attribute_type();if(n.map(s=>this.decoder[s]).includes(i)){let s=new this.draco.AttributeQuantizationTransform;try{if(s.InitFromAttribute(e))return{quantization_bits:s.quantization_bits()}}finally{this.draco.destroy(s)}}return null}};function gB(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}function yB(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}function AB(t){let e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}var _B="1.5.6",vB="1.4.1",bu=`https://www.gstatic.com/draco/versioned/decoders/${_B}`,Ee={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Eu={[Ee.DECODER]:`${bu}/${Ee.DECODER}`,[Ee.DECODER_WASM]:`${bu}/${Ee.DECODER_WASM}`,[Ee.FALLBACK_DECODER]:`${bu}/${Ee.FALLBACK_DECODER}`,[Ee.ENCODER]:`https://raw.githubusercontent.com/google/draco/${vB}/javascript/${Ee.ENCODER}`},ei;async function xg(t){let e=t.modules||{};return e.draco3d?ei=ei||e.draco3d.createDecoderModule({}).then(r=>({draco:r})):ei=ei||xB(t),await ei}async function xB(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await tt(Eu[Ee.FALLBACK_DECODER],"draco",t,Ee.FALLBACK_DECODER);break;case"wasm":default:[e,r]=await Promise.all([await tt(Eu[Ee.DECODER],"draco",t,Ee.DECODER),await tt(Eu[Ee.DECODER_WASM],"draco",t,Ee.DECODER_WASM)])}return e=e||globalThis.DracoDecoderModule,await TB(e,r)}function TB(t,e){let r={};return e&&(r.wasmBinary=e),new Promise(n=>{t({...r,onModuleLoaded:i=>n({draco:i})})})}var us={...pg,parse:bB};async function bB(t,e){let{draco:r}=await xg(e),n=new $n(r);try{return n.parseSync(t,e?.draco)}finally{n.destroy()}}var EB={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},oe={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},N={...EB,...oe};var Su={[oe.DOUBLE]:Float64Array,[oe.FLOAT]:Float32Array,[oe.UNSIGNED_SHORT]:Uint16Array,[oe.UNSIGNED_INT]:Uint32Array,[oe.UNSIGNED_BYTE]:Uint8Array,[oe.BYTE]:Int8Array,[oe.SHORT]:Int16Array,[oe.INT]:Int32Array},SB={DOUBLE:oe.DOUBLE,FLOAT:oe.FLOAT,UNSIGNED_SHORT:oe.UNSIGNED_SHORT,UNSIGNED_INT:oe.UNSIGNED_INT,UNSIGNED_BYTE:oe.UNSIGNED_BYTE,BYTE:oe.BYTE,SHORT:oe.SHORT,INT:oe.INT},Bu="Failed to convert GL type",ge=class{static fromTypedArray(e){e=ArrayBuffer.isView(e)?e.constructor:e;for(let r in Su)if(Su[r]===e)return r;throw new Error(Bu)}static fromName(e){let r=SB[e];if(!r)throw new Error(Bu);return r}static getArrayType(e){switch(e){case oe.UNSIGNED_SHORT_5_6_5:case oe.UNSIGNED_SHORT_4_4_4_4:case oe.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let r=Su[e];if(!r)throw new Error(Bu);return r}}static getByteSize(e){return ge.getArrayType(e).BYTES_PER_ELEMENT}static validate(e){return Boolean(ge.getArrayType(e))}static createTypedArray(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;i===void 0&&(i=(r.byteLength-n)/ge.getByteSize(e));let o=ge.getArrayType(e);return new o(r,n,i)}};function Tg(t,e){if(!t)throw new Error(`math.gl assertion failed. ${e}`)}function Cu(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],r=t>>11&31,n=t>>5&63,i=t&31;return e[0]=r<<3,e[1]=n<<2,e[2]=i<<3,e}var V9=1/256;var z9=new ir,j9=new T,k9=new ir,J9=new ir,q9=new Uint8Array(1);function bg(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:255;return Fi(t,0,e)/e*2-1}function Eg(t){return t<0?-1:1}function Sg(t,e,r,n){if(Tg(n),t<0||t>r||e<0||e>r)throw new Error(`x and y must be unsigned normalized integers between 0 and ${r}`);if(n.x=bg(t,r),n.y=bg(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){let i=n.x;n.x=(1-Math.abs(n.y))*Eg(i),n.y=(1-Math.abs(i))*Eg(n.y)}return n.normalize()}function Mu(t,e,r){return Sg(t,e,255,r)}var Tt=class{constructor(e,r){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=e,this.buffer=r}getExtension(e){return this.json.extensions&&this.json.extensions[e]}hasProperty(e){return Boolean(this.json[e])}getGlobalProperty(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:N.UNSIGNED_INT,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,i=this.json[e];return i&&Number.isFinite(i.byteOffset)?this._getTypedArrayFromBinary(e,r,n,1,i.byteOffset):i}getPropertyArray(e,r,n){let i=this.json[e];return i&&Number.isFinite(i.byteOffset)?("componentType"in i&&(r=ge.fromName(i.componentType)),this._getTypedArrayFromBinary(e,r,n,this.featuresLength,i.byteOffset)):this._getTypedArrayFromArray(e,r,i)}getProperty(e,r,n,i,o){let s=this.json[e];if(!s)return s;let a=this.getPropertyArray(e,r,n);if(n===1)return a[i];for(let c=0;c<n;++c)o[c]=a[n*i+c];return o}_getTypedArrayFromBinary(e,r,n,i,o){let s=this._cachedTypedArrays,a=s[e];return a||(a=ge.createTypedArray(r,this.buffer.buffer,this.buffer.byteOffset+o,i*n),s[e]=a),a}_getTypedArrayFromArray(e,r,n){let i=this._cachedTypedArrays,o=i[e];return o||(o=ge.createTypedArray(r,n),i[e]=o),o}};var BB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},CB={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},MB={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};function Bg(t,e,r,n){let{componentType:i}=t;H(t.componentType);let o=typeof i=="string"?ge.fromName(i):i,s=BB[t.type],a=CB[t.type],c=MB[t.type];return r+=t.byteOffset,{values:ge.createTypedArray(o,e,r,s*n),type:o,size:s,unpacker:a,packer:c}}var ft=t=>t!==void 0;function Cg(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy"),i=e.HIERARCHY;return i&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=i,n=i),n?wB(n,r):null}function wB(t,e){let r,n,i,o=t.instancesLength,s=t.classes,a=t.classIds,c=t.parentCounts,u=t.parentIds,l=o;ft(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,i=getBinaryAccessor(a),a=i.createArrayBufferView(e.buffer,e.byteOffset+a.byteOffset,o));let f;if(ft(c))for(ft(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,i=getBinaryAccessor(c),c=i.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,o)),f=new Uint16Array(o),l=0,r=0;r<o;++r)f[r]=l,l+=c[r];ft(u)&&ft(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,i=getBinaryAccessor(u),u=i.createArrayBufferView(e.buffer,e.byteOffset+u.byteOffset,l));let h=s.length;for(r=0;r<h;++r){let m=s[r].length,A=s[r].instances,_=getBinaryProperties(m,A,e);s[r].instances=combine(_,A)}let d=new Array(h).fill(0),p=new Uint16Array(o);for(r=0;r<o;++r)n=a[r],p[r]=d[n],++d[n];let g={classes:s,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:f,parentIds:u};return RB(g),g}function qr(t,e,r){if(!t)return;let n=t.parentCounts;return t.parentIds?r(t,e):n>0?IB(t,e,r):OB(t,e,r)}function IB(t,e,r){let n=t.classIds,i=t.parentCounts,o=t.parentIds,s=t.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);let u=++marker,l=scratchStack;for(l.length=0,l.push(e);l.length>0;){if(e=l.pop(),c[e]===u)continue;c[e]=u;let f=r(t,e);if(ft(f))return f;let h=i[e],d=s[e];for(let p=0;p<h;++p){let g=o[d+p];g!==e&&l.push(g)}}return null}function OB(t,e,r){let n=!0;for(;n;){let i=r(t,e);if(ft(i))return i;let o=t.parentIds[e];n=o!==e,e=o}throw new Error("traverseHierarchySingleParent")}function RB(t){let e=[],n=t.classIds.length;for(let i=0;i<n;++i)Mg(t,i,stack)}function Mg(t,e,r){let n=t.parentCounts,i=t.parentIds,o=t.parentIndexes,a=t.classIds.length;if(!ft(i))return;assert(e<a,`Parent index ${e} exceeds the total number of instances: ${a}`),assert(r.indexOf(e)===-1,"Circular dependency detected in the batch table hierarchy."),r.push(e);let c=ft(n)?n[e]:1,u=ft(n)?o[e]:e;for(let l=0;l<c;++l){let f=i[u+l];f!==e&&Mg(t,f,r)}r.pop(e)}function Se(t){return t!=null}var ls=(t,e)=>t,LB={HIERARCHY:!0,extensions:!0,extras:!0},gr=class{constructor(e,r,n){var i;let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,H(n>=0),this.json=e||{},this.binary=r,this.featureCount=n,this._extensions=((i=this.json)===null||i===void 0?void 0:i.extensions)||{},this._properties={};for(let s in this.json)LB[s]||(this._properties[s]=this.json[s]);this._binaryProperties=this._initializeBinaryProperties(),o["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Cg(this,this.json,this.binary))}getExtension(e){return this.json&&this.json.extensions&&this.json.extensions[e]}memorySizeInBytes(){return 0}isClass(e,r){if(this._checkBatchId(e),H(typeof r=="string",r),this._hierarchy){let n=qr(this._hierarchy,e,(i,o)=>{let s=i.classIds[o];return i.classes[s].name===r});return Se(n)}return!1}isExactClass(e,r){return H(typeof r=="string",r),this.getExactClassName(e)===r}getExactClassName(e){if(this._checkBatchId(e),this._hierarchy){let r=this._hierarchy.classIds[e];return this._hierarchy.classes[r].name}}hasProperty(e,r){return this._checkBatchId(e),H(typeof r=="string",r),Se(this._properties[r])||this._hasPropertyInHierarchy(e,r)}getPropertyNames(e,r){this._checkBatchId(e),r=Se(r)?r:[],r.length=0;let n=Object.keys(this._properties);return r.push(...n),this._hierarchy&&this._getPropertyNamesInHierarchy(e,r),r}getProperty(e,r){if(this._checkBatchId(e),H(typeof r=="string",r),this._binaryProperties){let i=this._binaryProperties[r];if(Se(i))return this._getBinaryProperty(i,e)}let n=this._properties[r];if(Se(n))return ls(n[e],!0);if(this._hierarchy){let i=this._getHierarchyProperty(e,r);if(Se(i))return i}}setProperty(e,r,n){let i=this.featureCount;if(this._checkBatchId(e),H(typeof r=="string",r),this._binaryProperties){let s=this._binaryProperties[r];if(s){this._setBinaryProperty(s,e,n);return}}if(this._hierarchy&&this._setHierarchyProperty(this,e,r,n))return;let o=this._properties[r];Se(o)||(this._properties[r]=new Array(i),o=this._properties[r]),o[e]=ls(n,!0)}_checkBatchId(e){if(!(e>=0&&e<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(e,r){return e.unpack(e.typedArray,r)}_setBinaryProperty(e,r,n){e.pack(n,e.typedArray,r)}_initializeBinaryProperties(){let e=null;for(let r in this._properties){let n=this._properties[r],i=this._initializeBinaryProperty(r,n);i&&(e=e||{},e[r]=i)}return e}_initializeBinaryProperty(e,r){if("byteOffset"in r){let n=r;H(this.binary,`Property ${e} requires a batch table binary.`),H(n.type,`Property ${e} requires a type.`);let i=Bg(n,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:i.values,componentCount:i.size,unpack:i.unpacker,pack:i.packer}}return null}_hasPropertyInHierarchy(e,r){if(!this._hierarchy)return!1;let n=qr(this._hierarchy,e,(i,o)=>{let s=i.classIds[o],a=i.classes[s].instances;return Se(a[r])});return Se(n)}_getPropertyNamesInHierarchy(e,r){qr(this._hierarchy,e,(n,i)=>{let o=n.classIds[i],s=n.classes[o].instances;for(let a in s)s.hasOwnProperty(a)&&r.indexOf(a)===-1&&r.push(a)})}_getHierarchyProperty(e,r){return qr(this._hierarchy,e,(n,i)=>{let o=n.classIds[i],s=n.classes[o],a=n.classIndexes[i],c=s.instances[r];return Se(c)?Se(c.typedArray)?this._getBinaryProperty(c,a):ls(c[a],!0):null})}_setHierarchyProperty(e,r,n,i){let o=qr(this._hierarchy,r,(s,a)=>{let c=s.classIds[a],u=s.classes[c],l=s.classIndexes[a],f=u.instances[n];return Se(f)?(H(a===r,`Inherited property "${n}" is read-only.`),Se(f.typedArray)?this._setBinaryProperty(f,l,i):f[l]=ls(i,!0),!0):!1});return Se(o)}};function Jt(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,t.version!==1)throw new Error(`3D Tile Version ${t.version} not supported`);return r}var Wr=4,wg="b3dm tile in legacy format.";function Xr(t,e,r){let n=new DataView(e),i;t.header=t.header||{};let o=n.getUint32(r,!0);r+=Wr;let s=n.getUint32(r,!0);r+=Wr;let a=n.getUint32(r,!0);r+=Wr;let c=n.getUint32(r,!0);return r+=Wr,a>=570425344?(r-=Wr*2,i=o,a=s,c=0,o=0,s=0,console.warn(wg)):c>=570425344&&(r-=Wr,i=a,a=o,c=s,o=0,s=0,console.warn(wg)),t.header.featureTableJsonByteLength=o,t.header.featureTableBinaryByteLength=s,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=i,r}function Kr(t,e,r,n){return r=PB(t,e,r,n),r=FB(t,e,r,n),r}function PB(t,e,r,n){let{featureTableJsonByteLength:i,featureTableBinaryByteLength:o,batchLength:s}=t.header||{};if(t.featureTableJson={BATCH_LENGTH:s||0},i&&i>0){let a=xu(e,r,i);t.featureTableJson=JSON.parse(a)}return r+=i||0,t.featureTableBinary=new Uint8Array(e,r,o),r+=o||0,r}function FB(t,e,r,n){let{batchTableJsonByteLength:i,batchTableBinaryByteLength:o}=t.header||{};if(i&&i>0){let s=xu(e,r,i);t.batchTableJson=JSON.parse(s),r+=i,o&&o>0&&(t.batchTableBinary=new Uint8Array(e,r,o),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=o)}return r}function wu(t,e,r){if(!e&&(!t||!t.batchIds||!r))return null;let{batchIds:n,isRGB565:i,pointCount:o=0}=t;if(n&&r){let s=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=n[a],l=r.getProperty(c,"dimensions").map(f=>f*255);s[a*3]=l[0],s[a*3+1]=l[1],s[a*3+2]=l[2]}return{type:N.UNSIGNED_BYTE,value:s,size:3,normalized:!0}}if(e&&i){let s=new Uint8ClampedArray(o*3);for(let a=0;a<o;a++){let c=Cu(e[a]);s[a*3]=c[0],s[a*3+1]=c[1],s[a*3+2]=c[2]}return{type:N.UNSIGNED_BYTE,value:s,size:3,normalized:!0}}return e&&e.length===o*3?{type:N.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:N.UNSIGNED_BYTE,value:e||new Uint8ClampedArray,size:4,normalized:!0}}var Ig=new T;function Og(t,e){if(!e)return null;if(t.isOctEncoded16P){let r=new Float32Array((t.pointsLength||0)*3);for(let n=0;n<(t.pointsLength||0);n++)Mu(e[n*2],e[n*2+1],Ig),Ig.toArray(r,n*3);return{type:N.FLOAT,size:2,value:r}}return{type:N.FLOAT,size:2,value:e}}function Rg(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,DB(t,e)):{type:N.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}function DB(t,e){let r=new T,n=new Float32Array(t.pointCount*3);for(let i=0;i<t.pointCount;i++)r.set(e[i*3],e[i*3+1],e[i*3+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(n,i*3);return n}async function Lg(t,e,r,n,i){r=Jt(t,e,r),r=Xr(t,e,r),r=Kr(t,e,r,n),NB(t);let{featureTable:o,batchTable:s}=UB(t);return await jB(t,o,s,n,i),GB(t,o,n),HB(t,o,s),VB(t,o),r}function NB(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}function UB(t){let e=new Tt(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let n=zB(t,e);return{featureTable:e,batchTable:n}}function GB(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.positions){if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",N.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){let n=e.getPropertyArray("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=(1<<16)-1,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=Rg(t,n,r)}}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function HB(t,e,r){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",N.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",N.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",N.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=wu(t,n,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",N.UNSIGNED_BYTE,4))}function VB(t,e){if(t.attributes=t.attributes||{positions:null,colors:null,normals:null,batchIds:null},!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",N.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",N.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=Og(t,r)}}function zB(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",N.UNSIGNED_SHORT,1),t.batchIds)){let n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:i,batchTableBinary:o}=t;r=new gr(i,o,n)}return r}async function jB(t,e,r,n,i){let o,s,a,c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let u=e.getExtension("3DTILES_draco_point_compression");if(u){s=u.properties;let f=u.byteOffset,h=u.byteLength;if(!s||!Number.isFinite(f)||!h)throw new Error("Draco properties, byteOffset, and byteLength must be defined");o=(t.featureTableBinary||[]).slice(f,f+h),t.hasPositions=Number.isFinite(s.POSITION),t.hasColors=Number.isFinite(s.RGB)||Number.isFinite(s.RGBA),t.hasNormals=Number.isFinite(s.NORMAL),t.hasBatchIds=Number.isFinite(s.BATCH_ID),t.isTranslucent=Number.isFinite(s.RGBA)}if(!o)return!0;let l={buffer:o,properties:{...s,...a},featureTableProperties:s,batchTableProperties:a,dequantizeInShader:!1};return await kB(t,l,n,i)}async function kB(t,e,r,n){if(!n)return;let i={...r,draco:{...r?.draco,extraAttributes:e.batchTableProperties||{}}};delete i["3d-tiles"];let o=await Ce(e.buffer,us,i,n),s=o.attributes.POSITION&&o.attributes.POSITION.value,a=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,c=o.attributes.NORMAL&&o.attributes.NORMAL.value,u=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,l=s&&o.attributes.POSITION.value.quantization,f=c&&o.attributes.NORMAL.value.quantization;if(l){let d=o.POSITION.data.quantization,p=d.range;t.quantizedVolumeScale=new T(p,p,p),t.quantizedVolumeOffset=new T(d.minValues),t.quantizedRange=(1<<d.quantizationBits)-1,t.isQuantizedDraco=!0}f&&(t.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);let h={};if(e.batchTableProperties)for(let d of Object.keys(e.batchTableProperties))o.attributes[d]&&o.attributes[d].value&&(h[d.toLowerCase()]=o.attributes[d].value);t.attributes={positions:s,colors:wu(t,a,void 0),normals:c,batchIds:u,...h}}var Iu={};de(Iu,{decode:()=>rC,name:()=>tC});function ue(t,e){if(!t)throw new Error(e||"assert failed: gltf")}var fs={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},hs={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var JB=1.33,Pg=["SCALAR","VEC2","VEC3","VEC4"],qB=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],WB=new Map(qB),XB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},KB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},YB={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function ds(t){return Pg[t-1]||Pg[0]}function Yr(t){let e=WB.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function Zr(t,e){let r=YB[t.componentType],n=XB[t.type],i=KB[t.componentType],o=t.count*n,s=t.count*n*i;ue(s>=0&&s<=e.byteLength);let a=hs[t.componentType],c=fs[t.type];return{ArrayType:r,length:o,byteLength:s,componentByteSize:a,numberOfComponentsInElement:c}}function ti(t){let{images:e,bufferViews:r}=t;e=e||[],r=r||[];let n=e.map(s=>s.bufferView);r=r.filter(s=>!n.includes(s));let i=r.reduce((s,a)=>s+a.byteLength,0),o=e.reduce((s,a)=>{let{width:c,height:u}=a.image;return s+c*u},0);return i+Math.ceil(4*o*JB)}function Fg(t,e,r){let n=t.bufferViews[r];ue(n);let i=n.buffer,o=e[i];ue(o);let s=(n.byteOffset||0)+o.byteOffset;return new Uint8Array(o.arrayBuffer,s,n.byteLength)}function Dg(t,e,r){var n,i;let o=typeof r=="number"?(n=t.accessors)===null||n===void 0?void 0:n[r]:r;if(!o)throw new Error(`No gltf accessor ${JSON.stringify(r)}`);let s=(i=t.bufferViews)===null||i===void 0?void 0:i[o.bufferView||0];if(!s)throw new Error(`No gltf buffer view for accessor ${s}`);let{arrayBuffer:a,byteOffset:c}=e[s.buffer],u=(c||0)+(o.byteOffset||0)+(s.byteOffset||0),{ArrayType:l,length:f,componentByteSize:h,numberOfComponentsInElement:d}=Zr(o,s),p=h*d,g=s.byteStride||p;if(typeof s.byteStride>"u"||s.byteStride===p)return new l(a,u,f);let m=new l(f);for(let A=0;A<o.count;A++){let _=new l(a,u+A*g,d);m.set(_,A*d)}return m}function ZB(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var q=class{constructor(e){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:e?.json||ZB(),buffers:e?.buffers||[],images:e?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}hasExtension(e){let r=this.getUsedExtensions().find(i=>i===e),n=this.getRequiredExtensions().find(i=>i===e);return typeof r=="string"||typeof n=="string"}getExtension(e){let r=this.getUsedExtensions().find(i=>i===e),n=this.json.extensions||{};return r?n[e]:null}getRequiredExtension(e){return this.getRequiredExtensions().find(n=>n===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(e,r){return(e.extensions||{})[r]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,r){if(typeof r=="object")return r;let n=this.json[e]&&this.json[e][r];if(!n)throw new Error(`glTF file error: Could not find ${e}[${r}]`);return n}getTypedArrayForBufferView(e){e=this.getBufferView(e);let r=e.buffer,n=this.gltf.buffers[r];ue(n);let i=(e.byteOffset||0)+n.byteOffset;return new Uint8Array(n.arrayBuffer,i,e.byteLength)}getTypedArrayForAccessor(e){let r=this.getAccessor(e);return Dg(this.gltf.json,this.gltf.buffers,r)}getTypedArrayForImageData(e){e=this.getAccessor(e);let r=this.getBufferView(e.bufferView),i=this.getBuffer(r.buffer).data,o=r.byteOffset||0;return new Uint8Array(i,o,r.byteLength)}addApplicationData(e,r){return this.json[e]=r,this}addExtraData(e,r){return this.json.extras=this.json.extras||{},this.json.extras[e]=r,this}addObjectExtension(e,r,n){return e.extensions=e.extensions||{},e.extensions[r]=n,this.registerUsedExtension(r),this}setObjectExtension(e,r,n){let i=e.extensions||{};i[r]=n}removeObjectExtension(e,r){let n=e?.extensions||{};if(n[r]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let i=this.json.extensionsRemoved;i.includes(r)||i.push(r)}delete n[r]}addExtension(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ue(r),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=r,this.registerUsedExtension(e),r}addRequiredExtension(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return ue(r),this.addExtension(e,r),this.registerRequiredExtension(e),r}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(r=>r===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(r=>r===e)||this.json.extensionsRequired.push(e)}removeExtension(e){var r;if((r=this.json.extensions)!==null&&r!==void 0&&r[e]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let n=this.json.extensionsRemoved;n.includes(e)||n.push(e)}this.json.extensions&&delete this.json.extensions[e],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e)}setDefaultScene(e){this.json.scene=e}addScene(e){let{nodeIndices:r}=e;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:r}),this.json.scenes.length-1}addNode(e){let{meshIndex:r,matrix:n}=e;this.json.nodes=this.json.nodes||[];let i={mesh:r};return n&&(i.matrix=n),this.json.nodes.push(i),this.json.nodes.length-1}addMesh(e){let{attributes:r,indices:n,material:i,mode:o=4}=e,a={primitives:[{attributes:this._addAttributes(r),mode:o}]};if(n){let c=this._addIndices(n);a.primitives[0].indices=c}return Number.isFinite(i)&&(a.primitives[0].material=i),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(e){let n={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(n),this.json.meshes.length-1}addImage(e,r){let n=nr(e),i=r||n?.mimeType,s={bufferView:this.addBufferView(e),mimeType:i};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.byteLength,i=e.byteLength;ue(Number.isFinite(i)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);let o={buffer:r,byteOffset:n,byteLength:i};return this.byteLength+=Ct(i,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(o),this.json.bufferViews.length-1}addAccessor(e,r){let n={bufferView:e,type:ds(r.size),componentType:r.componentType,count:r.count,max:r.max,min:r.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(n),this.json.accessors.length-1}addBinaryBuffer(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{size:3},n=this.addBufferView(e),i={min:r.min,max:r.max};(!i.min||!i.max)&&(i=this._getAccessorMinMax(e,r.size));let o={size:r.size,componentType:Yr(e),count:Math.round(e.length/r.size),min:i.min,max:i.max};return this.addAccessor(n,Object.assign(o,r))}addTexture(e){let{imageIndex:r}=e,n={source:r};return this.json.textures=this.json.textures||[],this.json.textures.push(n),this.json.textures.length-1}addMaterial(e){return this.json.materials=this.json.materials||[],this.json.materials.push(e),this.json.materials.length-1}createBinaryChunk(){var e,r;this.gltf.buffers=[];let n=this.byteLength,i=new ArrayBuffer(n),o=new Uint8Array(i),s=0;for(let a of this.sourceBuffers||[])s=Aa(a,o,s);(e=this.json)!==null&&e!==void 0&&(r=e.buffers)!==null&&r!==void 0&&r[0]?this.json.buffers[0].byteLength=n:this.json.buffers=[{byteLength:n}],this.gltf.binary=i,this.sourceBuffers=[i]}_removeStringFromArray(e,r){let n=!0;for(;n;){let i=e.indexOf(r);i>-1?e.splice(i,1):n=!1}}_addAttributes(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};for(let n in e){let i=e[n],o=this._getGltfAttributeName(n),s=this.addBinaryBuffer(i.value,i);r[o]=s}return r}_addIndices(e){return this.addBinaryBuffer(e,{size:1})}_getGltfAttributeName(e){switch(e.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return e}}_getAccessorMinMax(e,r){let n={min:null,max:null};if(e.length<r)return n;n.min=[],n.max=[];let i=e.subarray(0,r);for(let o of i)n.min.push(o),n.max.push(o);for(let o=r;o<e.length;o+=r)for(let s=0;s<r;s++)n.min[0+s]=Math.min(n.min[0+s],e[o+s]),n.max[0+s]=Math.max(n.max[0+s],e[o+s]);return n}};function Ng(t){return(t%1+1)%1}var Ug={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},QB={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},Gg={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function ri(t,e){return Gg[e]*Ug[t]}function Qr(t,e,r,n){if(r!=="UINT8"&&r!=="UINT16"&&r!=="UINT32"&&r!=="UINT64")return null;let i=t.getTypedArrayForBufferView(e),o=$r(i,"SCALAR",r,n+1);return o instanceof BigInt64Array||o instanceof BigUint64Array?null:o}function $r(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,i=Ug[e],o=QB[r],s=Gg[r],a=n*i,c=a*s,u=t.buffer,l=t.byteOffset;return l%s!==0&&(u=new Uint8Array(u).slice(l,l+c).buffer,l=0),new o(u,l,a)}function en(t,e,r){var n,i;let o=`TEXCOORD_${e.texCoord||0}`,s=r.attributes[o],a=t.getTypedArrayForAccessor(s),c=t.gltf.json,u=e.index,l=(n=c.textures)===null||n===void 0||(i=n[u])===null||i===void 0?void 0:i.source;if(typeof l<"u"){var f,h,d;let p=(f=c.images)===null||f===void 0||(h=f[l])===null||h===void 0?void 0:h.mimeType,g=(d=t.gltf.images)===null||d===void 0?void 0:d[l];if(g&&typeof g.width<"u"){let m=[];for(let A=0;A<a.length;A+=2){let _=$B(g,p,a,A,e.channels);m.push(_)}return m}}return[]}function ps(t,e,r,n,i){if(!(r!=null&&r.length))return;let o=[];for(let l of r){let f=n.findIndex(h=>h===l);f===-1&&(f=n.push(l)-1),o.push(f)}let s=new Uint32Array(o),a=t.gltf.buffers.push({arrayBuffer:s.buffer,byteOffset:s.byteOffset,byteLength:s.byteLength})-1,c=t.addBufferView(s,a,0),u=t.addAccessor(c,{size:1,componentType:Yr(s),count:s.length});i.attributes[e]=u}function $B(t,e,r,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[0],o={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},s=r[n],a=r[n+1],c=1;e&&(e.indexOf("image/jpeg")!==-1||e.indexOf("image/png")!==-1)&&(c=4);let u=eC(s,a,t,c),l=0;for(let f of i){let h=typeof f=="number"?Object.values(o)[f]:o[f],d=u+h.offset,p=En(t);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let g=p.data[d];l|=g<<h.shift}return l}function eC(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,i=r.width,o=Ng(t)*(i-1),s=Math.round(o),a=r.height,c=Ng(e)*(a-1),u=Math.round(c),l=r.components?r.components:n;return(u*i+s)*l}function ms(t,e,r,n,i){let o=[];for(let s=0;s<e;s++){let a=r[s],c=r[s+1]-r[s];if(c+a>n)break;let u=a/i,l=c/i;o.push(t.slice(u,u+l))}return o}function gs(t,e,r){let n=[];for(let i=0;i<e;i++){let o=i*r;n.push(t.slice(o,o+r))}return n}function ys(t,e,r,n){if(r)throw new Error("Not implemented - arrayOffsets for strings is specified");if(n){let i=[],o=new TextDecoder("utf8"),s=0;for(let a=0;a<t;a++){let c=n[a+1]-n[a];if(c+s<=e.length){let u=e.subarray(s,c+s),l=o.decode(u);i.push(l),s+=c}}return i}return[]}var Hg="EXT_mesh_features",tC=Hg;async function rC(t,e){let r=new q(t);nC(r,e)}function nC(t,e){let r=t.gltf.json;if(r.meshes)for(let n of r.meshes)for(let i of n.primitives)iC(t,i,e)}function iC(t,e,r){var n,i;if(!(r!=null&&(n=r.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let o=(i=e.extensions)===null||i===void 0?void 0:i[Hg],s=o?.featureIds;if(s)for(let c of s){var a;let u;if(typeof c.attribute<"u"){let l=`_FEATURE_ID_${c.attribute}`,f=e.attributes[l];u=t.getTypedArrayForAccessor(f)}else typeof c.texture<"u"&&r!==null&&r!==void 0&&(a=r.gltf)!==null&&a!==void 0&&a.loadImages?u=en(t,c.texture,e):u=[];c.data=u}}var Lu={};de(Lu,{decode:()=>sC,name:()=>oC});var Ou="EXT_structural_metadata",oC=Ou;async function sC(t,e){let r=new q(t);aC(r,e)}function aC(t,e){var r,n;if(!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=t.getExtension(Ou);i&&((n=e.gltf)!==null&&n!==void 0&&n.loadImages&&cC(t,i),uC(t,i))}function cC(t,e){let r=e.propertyTextures,n=t.gltf.json;if(r&&n.meshes)for(let i of n.meshes)for(let o of i.primitives)fC(t,r,o,e)}function uC(t,e){let r=e.schema;if(!r)return;let n=r.classes,i=e.propertyTables;if(n&&i)for(let o in n){let s=lC(i,o);s&&dC(t,r,s)}}function lC(t,e){for(let r of t)if(r.class===e)return r;return null}function fC(t,e,r,n){var i;if(!e)return;let o=(i=r.extensions)===null||i===void 0?void 0:i[Ou],s=o?.propertyTextures;if(s)for(let a of s){let c=e[a];hC(t,c,r,n)}}function hC(t,e,r,n){if(!e.properties)return;n.dataAttributeNames||(n.dataAttributeNames=[]);let i=e.class;for(let s in e.properties){var o;let a=`${i}_${s}`,c=(o=e.properties)===null||o===void 0?void 0:o[s];if(!c)continue;c.data||(c.data=[]);let u=c.data,l=en(t,c,r);l!==null&&(ps(t,a,l,u,r),c.data=u,n.dataAttributeNames.push(a))}}function dC(t,e,r){var n;let i=(n=e.classes)===null||n===void 0?void 0:n[r.class];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let o=r.count;for(let a in i.properties){var s;let c=i.properties[a],u=(s=r.properties)===null||s===void 0?void 0:s[a];if(u){let l=pC(t,e,c,o,u);u.data=l}}}function pC(t,e,r,n,i){let o=[],s=i.values,a=t.getTypedArrayForBufferView(s),c=mC(t,r,i,n),u=gC(t,i,n);switch(r.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{o=yC(r,n,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${r.type}`);case"STRING":{o=ys(n,a,c,u);break}case"ENUM":{o=AC(e,r,n,a,c);break}default:throw new Error(`Unknown classProperty type ${r.type}`)}return o}function mC(t,e,r,n){return e.array&&typeof e.count>"u"&&typeof r.arrayOffsets<"u"?Qr(t,r.arrayOffsets,r.arrayOffsetType||"UINT32",n):null}function gC(t,e,r){return typeof e.stringOffsets<"u"?Qr(t,e.stringOffsets,e.stringOffsetType||"UINT32",r):null}function yC(t,e,r,n){let i=t.array,o=t.count,s=ri(t.type,t.componentType),a=r.byteLength/s,c;return t.componentType?c=$r(r,t.type,t.componentType,a):c=r,i?n?ms(c,e,n,r.length,s):o?gs(c,e,o):[]:c}function AC(t,e,r,n,i){var o;let s=e.enumType;if(!s)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let a=(o=t.enums)===null||o===void 0?void 0:o[s];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${s}`);let c=a.valueType||"UINT16",u=ri(e.type,c),l=n.byteLength/u,f=$r(n,e.type,c,l);if(f||(f=n),e.array){if(i)return _C({valuesData:f,numberOfElements:r,arrayOffsets:i,valuesDataBytesLength:n.length,elementSize:u,enumEntry:a});let h=e.count;return h?vC(f,r,h,a):[]}return Ru(f,0,r,a)}function _C(t){let{valuesData:e,numberOfElements:r,arrayOffsets:n,valuesDataBytesLength:i,elementSize:o,enumEntry:s}=t,a=[];for(let c=0;c<r;c++){let u=n[c],l=n[c+1]-n[c];if(l+u>i)break;let f=u/o,h=l/o,d=Ru(e,f,h,s);a.push(d)}return a}function vC(t,e,r,n){let i=[];for(let o=0;o<e;o++){let s=r*o,a=Ru(t,s,r,n);i.push(a)}return i}function Ru(t,e,r,n){let i=[];for(let o=0;o<r;o++)if(t instanceof BigInt64Array||t instanceof BigUint64Array)i.push("");else{let s=t[e+o],a=xC(n,s);a?i.push(a.name):i.push("")}return i}function xC(t,e){for(let r of t.values)if(r.value===e)return r;return null}var Pu={};de(Pu,{decode:()=>bC,name:()=>TC});var Vg="EXT_feature_metadata",TC=Vg;async function bC(t,e){let r=new q(t);EC(r,e)}function EC(t,e){var r,n;if(!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=t.getExtension(Vg);i&&((n=e.gltf)!==null&&n!==void 0&&n.loadImages&&SC(t,i),BC(t,i))}function SC(t,e){let r=e.schema;if(!r)return;let n=r.classes,{featureTextures:i}=e;if(n&&i)for(let o in n){let s=n[o],a=MC(i,o);a&&IC(t,a,s)}}function BC(t,e){let r=e.schema;if(!r)return;let n=r.classes,i=e.featureTables;if(n&&i)for(let o in n){let s=CC(i,o);s&&wC(t,r,s)}}function CC(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function MC(t,e){for(let r in t){let n=t[r];if(n.class===e)return n}return null}function wC(t,e,r){var n;if(!r.class)return;let i=(n=e.classes)===null||n===void 0?void 0:n[r.class];if(!i)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${r.class}`);let o=r.count;for(let a in i.properties){var s;let c=i.properties[a],u=(s=r.properties)===null||s===void 0?void 0:s[a];if(u){let l=OC(t,e,c,o,u);u.data=l}}}function IC(t,e,r){let n=e.class;for(let o in r.properties){var i;let s=e==null||(i=e.properties)===null||i===void 0?void 0:i[o];if(s){let a=DC(t,s,n);s.data=a}}}function OC(t,e,r,n,i){let o=[],s=i.bufferView,a=t.getTypedArrayForBufferView(s),c=RC(t,r,i,n),u=LC(t,r,i,n);return r.type==="STRING"||r.componentType==="STRING"?o=ys(n,a,c,u):PC(r)&&(o=FC(r,n,a,c)),o}function RC(t,e,r,n){return e.type==="ARRAY"&&typeof e.componentCount>"u"&&typeof r.arrayOffsetBufferView<"u"?Qr(t,r.arrayOffsetBufferView,r.offsetType||"UINT32",n):null}function LC(t,e,r,n){return typeof r.stringOffsetBufferView<"u"?Qr(t,r.stringOffsetBufferView,r.offsetType||"UINT32",n):null}function PC(t){let e=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return e.includes(t.type)||typeof t.componentType<"u"&&e.includes(t.componentType)}function FC(t,e,r,n){let i=t.type==="ARRAY",o=t.componentCount,s="SCALAR",a=t.componentType||t.type,c=ri(s,a),u=r.byteLength/c,l=$r(r,s,a,u);return i?n?ms(l,e,n,r.length,c):o?gs(l,e,o):[]:l}function DC(t,e,r){let n=t.gltf.json;if(!n.meshes)return[];let i=[];for(let o of n.meshes)for(let s of o.primitives)NC(t,r,e,i,s);return i}function NC(t,e,r,n,i){let o={channels:r.channels,...r.texture},s=en(t,o,i);s&&ps(t,e,s,n,i)}var zg="4.1.0-alpha.9";var tn=!0,jg=1735152710,Nu=12,As=8,UC=1313821514,GC=5130562,HC=0,VC=0,zC=1;function jC(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return`${String.fromCharCode(t.getUint8(e+0))}${String.fromCharCode(t.getUint8(e+1))}${String.fromCharCode(t.getUint8(e+2))}${String.fromCharCode(t.getUint8(e+3))}`}function kg(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=new DataView(t),{magic:i=jg}=r,o=n.getUint32(e,!1);return o===i||o===jg}function Jg(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},i=new DataView(e),o=jC(i,r+0),s=i.getUint32(r+4,tn),a=i.getUint32(r+8,tn);switch(Object.assign(t,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:o,version:s,json:{},binChunks:[]}),r+=Nu,t.version){case 1:return kC(t,i,r);case 2:return JC(t,i,r,n={});default:throw new Error(`Invalid GLB version ${t.version}. Only supports version 1 and 2.`)}}function kC(t,e,r){H(t.header.byteLength>Nu+As);let n=e.getUint32(r+0,tn),i=e.getUint32(r+4,tn);return r+=As,H(i===HC),Fu(t,e,r,n),r+=n,r+=Du(t,e,r,t.header.byteLength),r}function JC(t,e,r,n){return H(t.header.byteLength>Nu+As),qC(t,e,r,n),r+t.header.byteLength}function qC(t,e,r,n){for(;r+8<=t.header.byteLength;){let i=e.getUint32(r+0,tn),o=e.getUint32(r+4,tn);switch(r+=As,o){case UC:Fu(t,e,r,i);break;case GC:Du(t,e,r,i);break;case VC:n.strict||Fu(t,e,r,i);break;case zC:n.strict||Du(t,e,r,i);break;default:break}r+=Ct(i,4)}return r}function Fu(t,e,r,n){let i=new Uint8Array(e.buffer,r,n),s=new TextDecoder("utf8").decode(i);return t.json=JSON.parse(s),Ct(n,4)}function Du(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),Ct(n,4)}function Uu(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;let n=e.baseUri||e.uri;if(!n)throw new Error(`'baseUri' must be provided to resolve relative url ${t}`);return n.substr(0,n.lastIndexOf("/")+1)+t}var Hu={};de(Hu,{decode:()=>iM,name:()=>nM});var WC="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",XC="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",KC=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),YC=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),ZC={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},QC={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function qg(t,e,r,n,i){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"NONE",s=await $C();rM(s,s.exports[QC[i]],t,e,r,n,s.exports[ZC[o||"NONE"]])}var Gu;async function $C(){return Gu||(Gu=eM()),Gu}async function eM(){let t=WC;WebAssembly.validate(KC)&&(t=XC,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let e=await WebAssembly.instantiate(tM(t),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}function tM(t){let e=new Uint8Array(t.length);for(let n=0;n<t.length;++n){let i=t.charCodeAt(n);e[n]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let r=0;for(let n=0;n<t.length;++n)e[r++]=e[n]<60?YC[e[n]]:(e[n]-60)*64+e[++n];return e.buffer.slice(0,r)}function rM(t,e,r,n,i,o,s){let a=t.exports.sbrk,c=n+3&-4,u=a(c*i),l=a(o.length),f=new Uint8Array(t.exports.memory.buffer);f.set(o,l);let h=e(u,n,i,l,o.length);if(h===0&&s&&s(u,c,i),r.set(f.subarray(u,u+n*i)),a(u-a(0)),h!==0)throw new Error(`Malformed buffer data: ${h}`)}var _s="EXT_meshopt_compression",nM=_s;async function iM(t,e){var r,n;let i=new q(t);if(!(e!=null&&(r=e.gltf)!==null&&r!==void 0&&r.decompressMeshes)||!((n=e.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let o=[];for(let s of t.json.bufferViews||[])o.push(oM(i,s));await Promise.all(o),i.removeExtension(_s)}async function oM(t,e){let r=t.getObjectExtension(e,_s);if(r){let{byteOffset:n=0,byteLength:i=0,byteStride:o,count:s,mode:a,filter:c="NONE",buffer:u}=r,l=t.gltf.buffers[u],f=new Uint8Array(l.arrayBuffer,l.byteOffset+n,i),h=new Uint8Array(t.gltf.buffers[e.buffer].arrayBuffer,e.byteOffset,e.byteLength);await qg(h,s,o,f,a,c),t.removeObjectExtension(e,_s)}}var Vu={};de(Vu,{name:()=>sM,preprocess:()=>aM});var rn="EXT_texture_webp",sM=rn;function aM(t,e){let r=new q(t);if(!Ia("image/webp")){if(r.getRequiredExtensions().includes(rn))throw new Error(`gltf: Required extension ${rn} not supported by browser`);return}let{json:n}=r;for(let i of n.textures||[]){let o=r.getObjectExtension(i,rn);o&&(i.source=o.source),r.removeObjectExtension(i,rn)}r.removeExtension(rn)}var zu={};de(zu,{name:()=>cM,preprocess:()=>uM});var vs="KHR_texture_basisu",cM=vs;function uM(t,e){let r=new q(t),{json:n}=r;for(let i of n.textures||[]){let o=r.getObjectExtension(i,vs);o&&(i.source=o.source,r.removeObjectExtension(i,vs))}r.removeExtension(vs)}var ku={};de(ku,{decode:()=>pM,encode:()=>mM,name:()=>hM,preprocess:()=>dM});function Wg(t){let e={};for(let r in t){let n=t[r];if(r!=="indices"){let i=ju(n);e[r]=i}}return e}function ju(t){let{buffer:e,size:r,count:n}=lM(t);return{value:e,size:r,byteOffset:0,count:n,type:ds(r),componentType:Yr(e)}}function lM(t){let e=t,r=1,n=0;return t&&t.value&&(e=t.value,r=t.size||1),e&&(ArrayBuffer.isView(e)||(e=fM(e,Float32Array)),n=e.length/r),{buffer:e,size:r,count:n}}function fM(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?Array.isArray(t)?new e(t):r&&!(t instanceof e)?new e(t):t:null}var qt="KHR_draco_mesh_compression",hM=qt;function dM(t,e,r){let n=new q(t);for(let i of Xg(n))n.getObjectExtension(i,qt)}async function pM(t,e,r){var n;if(!(e!=null&&(n=e.gltf)!==null&&n!==void 0&&n.decompressMeshes))return;let i=new q(t),o=[];for(let s of Xg(i))i.getObjectExtension(s,qt)&&o.push(gM(i,s,e,r));await Promise.all(o),i.removeExtension(qt)}function mM(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=new q(t);for(let n of r.json.meshes||[])yM(n,e),r.addRequiredExtension(qt)}async function gM(t,e,r,n){let i=t.getObjectExtension(e,qt);if(!i)return;let o=t.getTypedArrayForBufferView(i.bufferView),s=Qt(o.buffer,o.byteOffset),a={...r};delete a["3d-tiles"];let c=await Ce(s,us,a,n),u=Wg(c.attributes);for(let[l,f]of Object.entries(u))if(l in e.attributes){let h=e.attributes[l],d=t.getAccessor(h);d!=null&&d.min&&d!==null&&d!==void 0&&d.max&&(f.min=d.min,f.max=d.max)}e.attributes=u,c.indices&&(e.indices=ju(c.indices)),t.removeObjectExtension(e,qt),AM(e)}function yM(t,e){var r;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:4,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if(!i.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let s=i.DracoWriter.encodeSync({attributes:t}),a=o==null||(r=o.parseSync)===null||r===void 0?void 0:r.call(o,{attributes:t}),c=i._addFauxAttributes(a.attributes),u=i.addBufferView(s);return{primitives:[{attributes:c,mode:n,extensions:{[qt]:{bufferView:u,attributes:c}}}]}}function AM(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*Xg(t){for(let e of t.json.meshes||[])for(let r of e.primitives)yield r}var qu={};de(qu,{decode:()=>TM,name:()=>_M});var Ju="KHR_texture_transform",_M=Ju,xs=new T,vM=new j,xM=new j;async function TM(t,e){var r;if(!new q(t).hasExtension(Ju)||!((r=e.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let o=t.json.materials||[];for(let s=0;s<o.length;s++)bM(s,t)}function bM(t,e){var r,n,i;let o=[],s=(r=e.json.materials)===null||r===void 0?void 0:r[t],a=s==null||(n=s.pbrMetallicRoughness)===null||n===void 0?void 0:n.baseColorTexture;a&&ni(e,t,a,o);let c=s?.emissiveTexture;c&&ni(e,t,c,o);let u=s?.normalTexture;u&&ni(e,t,u,o);let l=s?.occlusionTexture;l&&ni(e,t,l,o);let f=s==null||(i=s.pbrMetallicRoughness)===null||i===void 0?void 0:i.metallicRoughnessTexture;f&&ni(e,t,f,o)}function ni(t,e,r,n){let i=EM(r,n);if(!i)return;let o=t.json.meshes||[];for(let s of o)for(let a of s.primitives){let c=a.material;Number.isFinite(c)&&e===c&&SM(t,a,i)}}function EM(t,e){var r;let n=(r=t.extensions)===null||r===void 0?void 0:r[Ju],{texCoord:i=0}=t,{texCoord:o=i}=n;if(!(e.findIndex(a=>{let[c,u]=a;return c===i&&u===o})!==-1)){let a=MM(n);return i!==o&&(t.texCoord=o),e.push([i,o]),{originalTexCoord:i,texCoord:o,matrix:a}}return null}function SM(t,e,r){let{originalTexCoord:n,texCoord:i,matrix:o}=r,s=e.attributes[`TEXCOORD_${n}`];if(Number.isFinite(s)){var a;let u=(a=t.json.accessors)===null||a===void 0?void 0:a[s];if(u&&u.bufferView){var c;let l=(c=t.json.bufferViews)===null||c===void 0?void 0:c[u.bufferView];if(l){let{arrayBuffer:f,byteOffset:h}=t.buffers[l.buffer],d=(h||0)+(u.byteOffset||0)+(l.byteOffset||0),{ArrayType:p,length:g}=Zr(u,l),m=hs[u.componentType],A=fs[u.type],_=l.byteStride||m*A,v=new Float32Array(g);for(let x=0;x<u.count;x++){let B=new p(f,d+x*_,2);xs.set(B[0],B[1],1),xs.transformByMatrix3(o),v.set([xs[0],xs[1]],x*A)}n===i?BM(u,l,t.buffers,v):CM(i,u,e,t,v)}}}}function BM(t,e,r,n){t.componentType=5126,r.push({arrayBuffer:n.buffer,byteOffset:0,byteLength:n.buffer.byteLength}),e.buffer=r.length-1,e.byteLength=n.buffer.byteLength,e.byteOffset=0,delete e.byteStride}function CM(t,e,r,n,i){n.buffers.push({arrayBuffer:i.buffer,byteOffset:0,byteLength:i.buffer.byteLength});let o=n.json.bufferViews;if(!o)return;o.push({buffer:n.buffers.length-1,byteLength:i.buffer.byteLength,byteOffset:0});let s=n.json.accessors;s&&(s.push({bufferView:o?.length-1,byteOffset:0,componentType:5126,count:e.count,type:"VEC2"}),r.attributes[`TEXCOORD_${t}`]=s.length-1)}function MM(t){let{offset:e=[0,0],rotation:r=0,scale:n=[1,1]}=t,i=new j().set(1,0,0,0,1,0,e[0],e[1],1),o=vM.set(Math.cos(r),Math.sin(r),0,-Math.sin(r),Math.cos(r),0,0,0,1),s=xM.set(n[0],0,0,0,n[1],0,0,0,1);return i.multiplyRight(o).multiplyRight(s)}var Wu={};de(Wu,{decode:()=>IM,encode:()=>OM,name:()=>wM});var yr="KHR_lights_punctual",wM=yr;async function IM(t){let e=new q(t),{json:r}=e,n=e.getExtension(yr);n&&(e.json.lights=n.lights,e.removeExtension(yr));for(let i of r.nodes||[]){let o=e.getObjectExtension(i,yr);o&&(i.light=o.light),e.removeObjectExtension(i,yr)}}async function OM(t){let e=new q(t),{json:r}=e;if(r.lights){let n=e.addExtension(yr);ue(!n.lights),n.lights=r.lights,delete r.lights}if(e.json.lights){for(let n of e.json.lights){let i=n.node;e.addObjectExtension(i,yr,n)}delete e.json.lights}}var Xu={};de(Xu,{decode:()=>LM,encode:()=>PM,name:()=>RM});var ii="KHR_materials_unlit",RM=ii;async function LM(t){let e=new q(t),{json:r}=e;for(let n of r.materials||[])n.extensions&&n.extensions.KHR_materials_unlit&&(n.unlit=!0),e.removeObjectExtension(n,ii);e.removeExtension(ii)}function PM(t){let e=new q(t),{json:r}=e;if(e.materials)for(let n of r.materials||[])n.unlit&&(delete n.unlit,e.addObjectExtension(n,ii,{}),e.addExtension(ii))}var Ku={};de(Ku,{decode:()=>DM,encode:()=>NM,name:()=>FM});var oi="KHR_techniques_webgl",FM=oi;async function DM(t){let e=new q(t),{json:r}=e,n=e.getExtension(oi);if(n){let i=UM(n,e);for(let o of r.materials||[]){let s=e.getObjectExtension(o,oi);s&&(o.technique=Object.assign({},s,i[s.technique]),o.technique.values=GM(o.technique,e)),e.removeObjectExtension(o,oi)}e.removeExtension(oi)}}async function NM(t,e){}function UM(t,e){let{programs:r=[],shaders:n=[],techniques:i=[]}=t,o=new TextDecoder;return n.forEach(s=>{if(Number.isFinite(s.bufferView))s.code=o.decode(e.getTypedArrayForBufferView(s.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),r.forEach(s=>{s.fragmentShader=n[s.fragmentShader],s.vertexShader=n[s.vertexShader]}),i.forEach(s=>{s.program=r[s.program]}),i}function GM(t,e){let r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach(n=>{t.uniforms[n].value&&!(n in r)&&(r[n]=t.uniforms[n].value)}),Object.keys(r).forEach(n=>{typeof r[n]=="object"&&r[n].index!==void 0&&(r[n].texture=e.getTexture(r[n].index))}),r}var Kg=[Lu,Iu,Hu,Vu,zu,ku,Wu,Xu,Ku,qu,Pu];function Yg(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=Kg.filter(o=>Qg(o.name,e));for(let o of n){var i;(i=o.preprocess)===null||i===void 0||i.call(o,t,e,r)}}async function Zg(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=Kg.filter(o=>Qg(o.name,e));for(let o of n){var i;await((i=o.decode)===null||i===void 0?void 0:i.call(o,t,e,r))}}function Qg(t,e){var r;let n=(e==null||(r=e.gltf)===null||r===void 0?void 0:r.excludeExtensions)||{};return!(t in n&&!n[t])}var Yu="KHR_binary_glTF";function $g(t){let e=new q(t),{json:r}=e;for(let n of r.images||[]){let i=e.getObjectExtension(n,Yu);i&&Object.assign(n,i),e.removeObjectExtension(n,Yu)}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension(Yu)}var e0={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},VM={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Zu=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(e,r){this.json=e.json;let n=e.json;switch(n.asset&&n.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${n.asset.version}`);return}if(!r.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(n),this._convertTopLevelObjectsToArrays(n),$g(e),this._convertObjectIdsToArrayIndices(n),this._updateObjects(n),this._updateMaterial(n)}_addAsset(e){e.asset=e.asset||{},e.asset.version="2.0",e.asset.generator=e.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(e){for(let r in e0)this._convertTopLevelObjectToArray(e,r)}_convertTopLevelObjectToArray(e,r){let n=e[r];if(!(!n||Array.isArray(n))){e[r]=[];for(let i in n){let o=n[i];o.id=o.id||i;let s=e[r].length;e[r].push(o),this.idToIndexMap[r][i]=s}}}_convertObjectIdsToArrayIndices(e){for(let r in e0)this._convertIdsToIndices(e,r);"scene"in e&&(e.scene=this._convertIdToIndex(e.scene,"scene"));for(let r of e.textures)this._convertTextureIds(r);for(let r of e.meshes)this._convertMeshIds(r);for(let r of e.nodes)this._convertNodeIds(r);for(let r of e.scenes)this._convertSceneIds(r)}_convertTextureIds(e){e.source&&(e.source=this._convertIdToIndex(e.source,"image"))}_convertMeshIds(e){for(let r of e.primitives){let{attributes:n,indices:i,material:o}=r;for(let s in n)n[s]=this._convertIdToIndex(n[s],"accessor");i&&(r.indices=this._convertIdToIndex(i,"accessor")),o&&(r.material=this._convertIdToIndex(o,"material"))}}_convertNodeIds(e){e.children&&(e.children=e.children.map(r=>this._convertIdToIndex(r,"node"))),e.meshes&&(e.meshes=e.meshes.map(r=>this._convertIdToIndex(r,"mesh")))}_convertSceneIds(e){e.nodes&&(e.nodes=e.nodes.map(r=>this._convertIdToIndex(r,"node")))}_convertIdsToIndices(e,r){e[r]||(console.warn(`gltf v1: json doesn't contain attribute ${r}`),e[r]=[]);for(let n of e[r])for(let i in n){let o=n[i],s=this._convertIdToIndex(o,i);n[i]=s}}_convertIdToIndex(e,r){let n=VM[r];if(n in this.idToIndexMap){let i=this.idToIndexMap[n][e];if(!Number.isFinite(i))throw new Error(`gltf v1: failed to resolve ${r} with id ${e}`);return i}return e}_updateObjects(e){for(let r of this.json.buffers)delete r.type}_updateMaterial(e){for(let o of e.materials){var r,n,i;o.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let s=((r=o.values)===null||r===void 0?void 0:r.tex)||((n=o.values)===null||n===void 0?void 0:n.texture2d_0)||((i=o.values)===null||i===void 0?void 0:i.diffuseTex),a=e.textures.findIndex(c=>c.id===s);a!==-1&&(o.pbrMetallicRoughness.baseColorTexture={index:a})}}};function t0(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Zu().normalize(t,e)}async function r0(t,e){var r,n,i;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return zM(t,e,o,s),t0(t,{normalize:s==null||(r=s.gltf)===null||r===void 0?void 0:r.normalize}),Yg(t,s,a),s!=null&&(n=s.gltf)!==null&&n!==void 0&&n.loadBuffers&&t.json.buffers&&await jM(t,s,a),s!=null&&(i=s.gltf)!==null&&i!==void 0&&i.loadImages&&await kM(t,s,a),await Zg(t,s,a),t}function zM(t,e,r,n){if(n.uri&&(t.baseUri=n.uri),e instanceof ArrayBuffer&&!kg(e,r,n)&&(e=new TextDecoder().decode(e)),typeof e=="string")t.json=ya(e);else if(e instanceof ArrayBuffer){let s={};r=Jg(s,e,r,n.glb),ue(s.type==="glTF",`Invalid GLB magic string ${s.type}`),t._glb=s,t.json=s.json}else ue(!1,"GLTF: must be ArrayBuffer or string");let i=t.json.buffers||[];if(t.buffers=new Array(i.length).fill(null),t._glb&&t._glb.header.hasBinChunk){let{binChunks:s}=t._glb;t.buffers[0]={arrayBuffer:s[0].arrayBuffer,byteOffset:s[0].byteOffset,byteLength:s[0].byteLength}}let o=t.json.images||[];t.images=new Array(o.length).fill({})}async function jM(t,e,r){let n=t.json.buffers||[];for(let s=0;s<n.length;++s){let a=n[s];if(a.uri){var i,o;let{fetch:c}=r;ue(c);let u=Uu(a.uri,e),l=await(r==null||(i=r.fetch)===null||i===void 0?void 0:i.call(r,u)),f=await(l==null||(o=l.arrayBuffer)===null||o===void 0?void 0:o.call(l));t.buffers[s]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete a.uri}else t.buffers[s]===null&&(t.buffers[s]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function kM(t,e,r){let n=JM(t),i=t.json.images||[],o=[];for(let s of n)o.push(qM(t,i[s],s,e,r));return await Promise.all(o)}function JM(t){let e=new Set,r=t.json.textures||[];for(let n of r)n.source!==void 0&&e.add(n.source);return Array.from(e).sort()}async function qM(t,e,r,n,i){let o;if(e.uri&&!e.hasOwnProperty("bufferView")){let a=Uu(e.uri,n),{fetch:c}=i;o=await(await c(a)).arrayBuffer(),e.bufferView={data:o}}if(Number.isFinite(e.bufferView)){let a=Fg(t.json,t.buffers,e.bufferView);o=Qt(a.buffer,a.byteOffset,a.byteLength)}ue(o,"glTF image has no data");let s=await Ce(o,[Ot,ou],{...n,mimeType:e.mimeType,basis:n.basis||{format:ko()}},i);s&&s[0]&&(s={compressed:!0,mipmaps:!1,width:s[0].width,height:s[0].height,data:s[0]}),t.images=t.images||[],t.images[r]=s}var Ar={name:"glTF",id:"gltf",module:"gltf",version:zg,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:WM,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function WM(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;e={...Ar.options,...e},e.gltf={...Ar.options.gltf,...e.gltf};let{byteOffset:n=0}=e;return await r0({},t,n,e,r)}var XM={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},KM={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},De={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},YM={magFilter:De.TEXTURE_MAG_FILTER,minFilter:De.TEXTURE_MIN_FILTER,wrapS:De.TEXTURE_WRAP_S,wrapT:De.TEXTURE_WRAP_T},ZM={[De.TEXTURE_MAG_FILTER]:De.LINEAR,[De.TEXTURE_MIN_FILTER]:De.NEAREST_MIPMAP_LINEAR,[De.TEXTURE_WRAP_S]:De.REPEAT,[De.TEXTURE_WRAP_T]:De.REPEAT};function QM(){return{id:"default-sampler",parameters:ZM}}function $M(t){return KM[t]}function ew(t){return XM[t]}var Qu=class{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{json:n,buffers:i=[],images:o=[]}=e,{baseUri:s=""}=e;return ue(n),this.baseUri=s,this.buffers=i,this.images=o,this.jsonUnprocessed=n,this.json=this._resolveTree(e.json,r),this.json}_resolveTree(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={...e};return this.json=n,e.bufferViews&&(n.bufferViews=e.bufferViews.map((i,o)=>this._resolveBufferView(i,o))),e.images&&(n.images=e.images.map((i,o)=>this._resolveImage(i,o))),e.samplers&&(n.samplers=e.samplers.map((i,o)=>this._resolveSampler(i,o))),e.textures&&(n.textures=e.textures.map((i,o)=>this._resolveTexture(i,o))),e.accessors&&(n.accessors=e.accessors.map((i,o)=>this._resolveAccessor(i,o))),e.materials&&(n.materials=e.materials.map((i,o)=>this._resolveMaterial(i,o))),e.meshes&&(n.meshes=e.meshes.map((i,o)=>this._resolveMesh(i,o))),e.nodes&&(n.nodes=e.nodes.map((i,o)=>this._resolveNode(i,o)),n.nodes=n.nodes.map((i,o)=>this._resolveNodeChildren(i))),e.skins&&(n.skins=e.skins.map((i,o)=>this._resolveSkin(i,o))),e.scenes&&(n.scenes=e.scenes.map((i,o)=>this._resolveScene(i,o))),typeof this.json.scene=="number"&&n.scenes&&(n.scene=n.scenes[this.json.scene]),n}getScene(e){return this._get(this.json.scenes,e)}getNode(e){return this._get(this.json.nodes,e)}getSkin(e){return this._get(this.json.skins,e)}getMesh(e){return this._get(this.json.meshes,e)}getMaterial(e){return this._get(this.json.materials,e)}getAccessor(e){return this._get(this.json.accessors,e)}getCamera(e){return this._get(this.json.cameras,e)}getTexture(e){return this._get(this.json.textures,e)}getSampler(e){return this._get(this.json.samplers,e)}getImage(e){return this._get(this.json.images,e)}getBufferView(e){return this._get(this.json.bufferViews,e)}getBuffer(e){return this._get(this.json.buffers,e)}_get(e,r){if(typeof r=="object")return r;let n=e&&e[r];return n||console.warn(`glTF file error: Could not find ${e}[${r}]`),n}_resolveScene(e,r){return{...e,id:e.id||`scene-${r}`,nodes:(e.nodes||[]).map(n=>this.getNode(n))}}_resolveNode(e,r){let n={...e,id:e?.id||`node-${r}`};return e.mesh!==void 0&&(n.mesh=this.getMesh(e.mesh)),e.camera!==void 0&&(n.camera=this.getCamera(e.camera)),e.skin!==void 0&&(n.skin=this.getSkin(e.skin)),e.meshes!==void 0&&e.meshes.length&&(n.mesh=e.meshes.reduce((i,o)=>{let s=this.getMesh(o);return i.id=s.id,i.primitives=i.primitives.concat(s.primitives),i},{primitives:[]})),n}_resolveNodeChildren(e){return e.children&&(e.children=e.children.map(r=>this.getNode(r))),e}_resolveSkin(e,r){let n=typeof e.inverseBindMatrices=="number"?this.getAccessor(e.inverseBindMatrices):void 0;return{...e,id:e.id||`skin-${r}`,inverseBindMatrices:n}}_resolveMesh(e,r){let n={...e,id:e.id||`mesh-${r}`,primitives:[]};return e.primitives&&(n.primitives=e.primitives.map(i=>{let o={...i,attributes:{},indices:void 0,material:void 0},s=i.attributes;for(let a in s)o.attributes[a]=this.getAccessor(s[a]);return i.indices!==void 0&&(o.indices=this.getAccessor(i.indices)),i.material!==void 0&&(o.material=this.getMaterial(i.material)),o})),n}_resolveMaterial(e,r){let n={...e,id:e.id||`material-${r}`};if(n.normalTexture&&(n.normalTexture={...n.normalTexture},n.normalTexture.texture=this.getTexture(n.normalTexture.index)),n.occlusionTexture&&(n.occlusionTexture={...n.occlusionTexture},n.occlusionTexture.texture=this.getTexture(n.occlusionTexture.index)),n.emissiveTexture&&(n.emissiveTexture={...n.emissiveTexture},n.emissiveTexture.texture=this.getTexture(n.emissiveTexture.index)),n.emissiveFactor||(n.emissiveFactor=n.emissiveTexture?[1,1,1]:[0,0,0]),n.pbrMetallicRoughness){n.pbrMetallicRoughness={...n.pbrMetallicRoughness};let i=n.pbrMetallicRoughness;i.baseColorTexture&&(i.baseColorTexture={...i.baseColorTexture},i.baseColorTexture.texture=this.getTexture(i.baseColorTexture.index)),i.metallicRoughnessTexture&&(i.metallicRoughnessTexture={...i.metallicRoughnessTexture},i.metallicRoughnessTexture.texture=this.getTexture(i.metallicRoughnessTexture.index))}return n}_resolveAccessor(e,r){let n=$M(e.componentType),i=ew(e.type),o=n*i,s={...e,id:e.id||`accessor-${r}`,bytesPerComponent:n,components:i,bytesPerElement:o,value:void 0,bufferView:void 0,sparse:void 0};if(e.bufferView!==void 0&&(s.bufferView=this.getBufferView(e.bufferView)),s.bufferView){let a=s.bufferView.buffer,{ArrayType:c,byteLength:u}=Zr(s,s.bufferView),l=(s.bufferView.byteOffset||0)+(s.byteOffset||0)+a.byteOffset,f=a.arrayBuffer.slice(l,l+u);s.bufferView.byteStride&&(f=this._getValueFromInterleavedBuffer(a,l,s.bufferView.byteStride,s.bytesPerElement,s.count)),s.value=new c(f)}return s}_getValueFromInterleavedBuffer(e,r,n,i,o){let s=new Uint8Array(o*i);for(let a=0;a<o;a++){let c=r+a*n;s.set(new Uint8Array(e.arrayBuffer.slice(c,c+i)),a*i)}return s.buffer}_resolveTexture(e,r){return{...e,id:e.id||`texture-${r}`,sampler:typeof e.sampler=="number"?this.getSampler(e.sampler):QM(),source:typeof e.source=="number"?this.getImage(e.source):void 0}}_resolveSampler(e,r){let n={id:e.id||`sampler-${r}`,...e,parameters:{}};for(let i in n){let o=this._enumSamplerParameter(i);o!==void 0&&(n.parameters[o]=n[i])}return n}_enumSamplerParameter(e){return YM[e]}_resolveImage(e,r){let n={...e,id:e.id||`image-${r}`,image:null,bufferView:e.bufferView!==void 0?this.getBufferView(e.bufferView):void 0},i=this.images[r];return i&&(n.image=i),n}_resolveBufferView(e,r){let n=e.buffer,i=this.buffers[n].arrayBuffer,o=this.buffers[n].byteOffset||0;return e.byteOffset&&(o+=e.byteOffset),{id:`bufferView-${r}`,...e,buffer:this.buffers[n],data:new Uint8Array(i,o,e.byteLength)}}_resolveCamera(e,r){let n={...e,id:e.id||`camera-${r}`};return n.perspective,n.orthographic,n}};function si(t,e){return new Qu().postProcess(t,e)}var Ts={URI:0,EMBEDDED:1};function bs(t,e,r,n){t.rotateYtoZ=!0;let i=(t.byteOffset||0)+(t.byteLength||0)-r;if(i===0)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n!=null&&n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=Qt(e,r,i),t.gltfByteOffset=0,t.gltfByteLength=i,r%4===0||console.warn(`${t.type}: embedded glb is not aligned to a 4-byte boundary.`),(t.byteOffset||0)+(t.byteLength||0)}async function Es(t,e,r,n){let i=r?.["3d-tiles"]||{};if(tw(t,e,r),i.loadGLTF){if(!n)return;if(t.gltfUrl){let{fetch:o}=n,s=await o(t.gltfUrl,r);t.gltfArrayBuffer=await s.arrayBuffer(),t.gltfByteOffset=0}if(t.gltfArrayBuffer){let o=await Ce(t.gltfArrayBuffer,Ar,r,n);t.gltf=si(o),t.gpuMemoryUsageInBytes=ti(t.gltf),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength}}}function tw(t,e,r){switch(e){case Ts.URI:if(t.gltfArrayBuffer){let n=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),o=new TextDecoder().decode(n);t.gltfUrl=o.replace(/[\s\0]+$/,"")}delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case Ts.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function n0(t,e,r,n,i){var o;r=rw(t,e,r,n,i),await Es(t,Ts.EMBEDDED,n,i);let s=t==null||(o=t.gltf)===null||o===void 0?void 0:o.extensions;return s&&s.CESIUM_RTC&&(t.rtcCenter=s.CESIUM_RTC.center),r}function rw(t,e,r,n,i){r=Jt(t,e,r),r=Xr(t,e,r),r=Kr(t,e,r,n),r=bs(t,e,r,n);let o=new Tt(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=o.getGlobalProperty("RTC_CENTER",N.FLOAT,3),r}async function i0(t,e,r,n,i){return r=nw(t,e,r,n,i),await Es(t,t.gltfFormat||0,n,i),r}function nw(t,e,r,n,i){var o;if(r=Jt(t,e,r),t.version!==1)throw new Error(`Instanced 3D Model version ${t.version} is not supported`);r=Xr(t,e,r);let s=new DataView(e);if(t.gltfFormat=s.getUint32(r,!0),r+=4,r=Kr(t,e,r,n),r=bs(t,e,r,n),!(t!=null&&(o=t.header)!==null&&o!==void 0&&o.featureTableJsonByteLength)||t.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let a=new Tt(t.featureTableJson,t.featureTableBinary),c=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=a.getGlobalProperty("RTC_CENTER",N.FLOAT,3);let u=new gr(t.batchTableJson,t.batchTableBinary,c);return iw(t,a,u,c),r}function iw(t,e,r,n){let i=new Array(n),o=new T,s=new T,a=new T,c=new T,u=new j,l=new nt,f=new T,h={},d=new D,p=[],g=[],m=[],A=[];for(let _=0;_<n;_++){let v;if(e.hasProperty("POSITION"))v=e.getProperty("POSITION",N.FLOAT,3,_,o);else if(e.hasProperty("POSITION_QUANTIZED")){v=e.getProperty("POSITION_QUANTIZED",N.UNSIGNED_SHORT,3,_,o);let y=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",N.FLOAT,3);if(!y)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let M=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",N.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let I=65535;for(let O=0;O<3;O++)v[O]=v[O]/I*M[O]+y[O]}if(!v)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");o.copy(v),h.translation=o,t.normalUp=e.getProperty("NORMAL_UP",N.FLOAT,3,_,p),t.normalRight=e.getProperty("NORMAL_RIGHT",N.FLOAT,3,_,g);let x=!1;if(t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",N.UNSIGNED_SHORT,2,_,p),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",N.UNSIGNED_SHORT,2,_,g),t.octNormalUp)throw t.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");t.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(o,d),d.getRotationMatrix3(u)):u.identity()}x&&(c.copy(s).cross(a).normalize(),u.setColumn(0,s),u.setColumn(1,a),u.setColumn(2,c)),l.fromMatrix3(u),h.rotation=l,f.set(1,1,1);let B=e.getProperty("SCALE",N.FLOAT,1,_,m);Number.isFinite(B)&&f.multiplyByScalar(B);let S=e.getProperty("SCALE_NON_UNIFORM",N.FLOAT,3,_,p);S&&f.scale(S),h.scale=f;let C=e.getProperty("BATCH_ID",N.UNSIGNED_SHORT,1,_,A);C===void 0&&(C=_);let E=new D().fromQuaternion(h.rotation);d.identity(),d.translate(h.translation),d.multiplyRight(E),d.scale(h.scale);let b=d.clone();i[_]={modelMatrix:b,batchId:C}}t.instances=i}async function o0(t,e,r,n,i,o){r=Jt(t,e,r);let s=new DataView(e);for(t.tilesLength=s.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&(t.byteLength||0)-r>12;){let a={shape:"tile3d"};t.tiles.push(a),r=await o(e,r,n,i,a)}return r}async function s0(t,e,r,n){var i,o;if(t.rotateYtoZ=!0,t.gltfUpAxis=r!=null&&(i=r["3d-tiles"])!==null&&i!==void 0&&i.assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",r!=null&&(o=r["3d-tiles"])!==null&&o!==void 0&&o.loadGLTF){if(!n)return e.byteLength;let s=await Ce(e,Ar,r,n);t.gltf=si(s),t.gpuMemoryUsageInBytes=ti(t.gltf)}else t.gltfArrayBuffer=e;return e.byteLength}async function $u(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{shape:"tile3d"};switch(i.byteOffset=e,i.type=hg(t,e),i.type){case pr.COMPOSITE:return await o0(i,t,e,r,n,$u);case pr.BATCHED_3D_MODEL:return await n0(i,t,e,r,n);case pr.GLTF:return await s0(i,t,r,n);case pr.INSTANCED_3D_MODEL:return await i0(i,t,e,r,n);case pr.POINT_CLOUD:return await Lg(i,t,e,r,n);default:throw new Error(`3DTileLoader: unknown type ${i.type}`)}}async function el(t,e,r){if(new Uint32Array(t.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(t.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let o=a0(t.slice(8,16)),s=new Uint8Array(t,24,o),c=new TextDecoder("utf8").decode(s),u=JSON.parse(c),l=a0(t.slice(16,24)),f=new ArrayBuffer(0);if(l&&(f=t.slice(24+o)),await Ss(u,u.tileAvailability,f,r),Array.isArray(u.contentAvailability))for(let h of u.contentAvailability)await Ss(u,h,f,r);else await Ss(u,u.contentAvailability,f,r);return await Ss(u,u.childSubtreeAvailability,f,r),u}async function Ss(t,e,r,n){let i=Number.isFinite(e.bitstream)?e.bitstream:e.bufferView;if(typeof i!="number")return;let o=t.bufferViews[i],s=t.buffers[o.buffer];if(!(n!=null&&n.baseUrl))throw new Error("Url is not provided");if(!n.fetch)throw new Error("fetch is not provided");if(s.uri){let c=`${n?.baseUrl||""}/${s.uri}`,l=await(await n.fetch(c)).arrayBuffer();e.explicitBitstream=new Uint8Array(l,o.byteOffset,o.byteLength);return}let a=t.buffers.slice(0,o.buffer).reduce((c,u)=>c+u.byteLength,0);e.explicitBitstream=new Uint8Array(r.slice(a,a+s.byteLength),o.byteOffset,o.byteLength)}function a0(t){let e=new DataView(t),r=e.getUint32(0,!0),n=e.getUint32(4,!0);return r+2**32*n}var Bs={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:cs,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:el,options:{}};var U0=P(jr(),1);var P0=P(jr(),1);function ow(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var Cs=class{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";this.storage=void 0,this.id=void 0,this.config=void 0,this.storage=ow(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function c0(t){let e;return t<10?e="".concat(t.toFixed(2),"ms"):t<100?e="".concat(t.toFixed(1),"ms"):t<1e3?e="".concat(t.toFixed(0),"ms"):e="".concat((t/1e3).toFixed(2),"s"),e}function u0(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}function Ms(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));let o=t.width*r,s=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}var ws;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(ws||(ws={}));var sw=10;function l0(t){return typeof t!="string"?t:(t=t.toUpperCase(),ws[t]||ws.WHITE)}function f0(t,e,r){if(!Xe&&typeof t=="string"){if(e){let n=l0(e);t="\x1B[".concat(n,"m").concat(t,"\x1B[39m")}if(r){let n=l0(r);t="\x1B[".concat(n+sw,"m").concat(t,"\x1B[49m")}}return t}function h0(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),i=t;for(let o of n){let s=i[o];typeof s=="function"&&(e.find(a=>o===a)||(i[o]=s.bind(t)))}}function nn(t,e){if(!t)throw new Error(e||"Assertion failed")}function _r(){let t;if(Xe()&&zr.performance){var e,r;t=zr===null||zr===void 0||(e=zr.performance)===null||e===void 0||(r=e.now)===null||r===void 0?void 0:r.call(e)}else if("hrtime"in lr){var n;let i=lr===null||lr===void 0||(n=lr.hrtime)===null||n===void 0?void 0:n.call(lr);t=i[0]*1e3+i[1]/1e6}else t=Date.now();return t}var on={debug:Xe()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},aw={enabled:!0,level:0};function Ne(){}var d0={},p0={once:!0},ai=class{constructor(){let{id:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};this.id=void 0,this.VERSION=Jo,this._startTs=_r(),this._deltaTs=_r(),this._storage=void 0,this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Cs("__probe-".concat(this.id,"__"),aw),this.timeStamp("".concat(this.id," started")),h0(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((_r()-this._startTs).toPrecision(10))}getDelta(){return Number((_r()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,r){this._storage.setConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){nn(e,r)}warn(e){return this._getLogFunction(0,e,on.warn,arguments,p0)}error(e){return this._getLogFunction(0,e,on.error,arguments)}deprecated(e,r){return this.warn("`".concat(e,"` is deprecated and will be removed in a later version. Use `").concat(r,"` instead"))}removed(e,r){return this.error("`".concat(e,"` has been removed. Use `").concat(r,"` instead"))}probe(e,r){return this._getLogFunction(e,r,on.log,arguments,{time:!0,once:!0})}log(e,r){return this._getLogFunction(e,r,on.debug,arguments)}info(e,r){return this._getLogFunction(e,r,console.info,arguments)}once(e,r){return this._getLogFunction(e,r,on.debug||on.info,arguments,p0)}table(e,r,n){return r?this._getLogFunction(e,r,console.table||Ne,n&&[n],{tag:fw(r)}):Ne}image(e){let{logLevel:r,priority:n,image:i,message:o="",scale:s=1}=e;return this._shouldLog(r||n)?Xe()?lw({image:i,message:o,scale:s}):uw({image:i,message:o,scale:s}):Ne}time(e,r){return this._getLogFunction(e,r,console.time?console.time:console.info)}timeEnd(e,r){return this._getLogFunction(e,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,r){return this._getLogFunction(e,r,console.timeStamp||Ne)}group(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},i=m0({logLevel:e,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||Ne)}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=g0(e)}_getLogFunction(e,r,n,i,o){if(this._shouldLog(e)){o=m0({logLevel:e,message:r,args:i,opts:o}),n=n||o.method,nn(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=_r();let s=o.tag||o.message;if(o.once&&s)if(!d0[s])d0[s]=_r();else return Ne;return r=cw(this.id,o.message,o),n.bind(console,r,...o.args)}return Ne}};ai.VERSION=Jo;function g0(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return nn(Number.isFinite(e)&&e>=0),e}function m0(t){let{logLevel:e,message:r}=t;t.logLevel=g0(e);let n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let i=typeof t.message;return nn(i==="string"||i==="object"),Object.assign(t,{args:n},t.opts)}function cw(t,e,r){if(typeof e=="string"){let n=r.time?u0(c0(r.total)):"";e=r.time?"".concat(t,": ").concat(n," ").concat(e):"".concat(t,": ").concat(e),e=f0(e,r.color,r.background)}return e}function uw(t){let{image:e,message:r="",scale:n=1}=t;return console.warn("removed"),Ne}function lw(t){let{image:e,message:r="",scale:n=1}=t;if(typeof e=="string"){let o=new Image;return o.onload=()=>{let s=Ms(o,r,n);console.log(...s)},o.src=e,Ne}let i=e.nodeName||"";if(i.toLowerCase()==="img")return console.log(...Ms(e,r,n)),Ne;if(i.toLowerCase()==="canvas"){let o=new Image;return o.onload=()=>console.log(...Ms(o,r,n)),o.src=e.toDataURL(),Ne}return Ne}function fw(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}var tl=new ai({id:"@probe.gl/log"});var Ue=null;try{Ue=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Z(t,e,r){this.low=t|0,this.high=e|0,this.unsigned=!!r}Z.prototype.__isLong__;Object.defineProperty(Z.prototype,"__isLong__",{value:!0});function ye(t){return(t&&t.__isLong__)===!0}function y0(t){var e=Math.clz32(t&-t);return t?31-e:e}Z.isLong=ye;var A0={},_0={};function vr(t,e){var r,n,i;return e?(t>>>=0,(i=0<=t&&t<256)&&(n=_0[t],n)?n:(r=V(t,0,!0),i&&(_0[t]=r),r)):(t|=0,(i=-128<=t&&t<128)&&(n=A0[t],n)?n:(r=V(t,t<0?-1:0,!1),i&&(A0[t]=r),r))}Z.fromInt=vr;function Ge(t,e){if(isNaN(t))return e?bt:Ye;if(e){if(t<0)return bt;if(t>=b0)return B0}else{if(t<=-x0)return Be;if(t+1>=x0)return S0}return t<0?Ge(-t,e).neg():V(t%an|0,t/an|0,e)}Z.fromNumber=Ge;function V(t,e,r){return new Z(t,e,r)}Z.fromBits=V;var Is=Math.pow;function nl(t,e,r){if(t.length===0)throw Error("empty string");if(typeof e=="number"?(r=e,e=!1):e=!!e,t==="NaN"||t==="Infinity"||t==="+Infinity"||t==="-Infinity")return e?bt:Ye;if(r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=t.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return nl(t.substring(1),e,r).neg();for(var i=Ge(Is(r,8)),o=Ye,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),c=parseInt(t.substring(s,s+a),r);if(a<8){var u=Ge(Is(r,a));o=o.mul(u).add(Ge(c))}else o=o.mul(i),o=o.add(Ge(c))}return o.unsigned=e,o}Z.fromString=nl;function Ze(t,e){return typeof t=="number"?Ge(t,e):typeof t=="string"?nl(t,e):V(t.low,t.high,typeof e=="boolean"?e:t.unsigned)}Z.fromValue=Ze;var v0=1<<16,hw=1<<24,an=v0*v0,b0=an*an,x0=b0/2,T0=vr(hw),Ye=vr(0);Z.ZERO=Ye;var bt=vr(0,!0);Z.UZERO=bt;var sn=vr(1);Z.ONE=sn;var E0=vr(1,!0);Z.UONE=E0;var rl=vr(-1);Z.NEG_ONE=rl;var S0=V(-1,2147483647,!1);Z.MAX_VALUE=S0;var B0=V(-1,-1,!0);Z.MAX_UNSIGNED_VALUE=B0;var Be=V(0,-2147483648,!1);Z.MIN_VALUE=Be;var w=Z.prototype;w.toInt=function(){return this.unsigned?this.low>>>0:this.low};w.toNumber=function(){return this.unsigned?(this.high>>>0)*an+(this.low>>>0):this.high*an+(this.low>>>0)};w.toString=function(e){if(e=e||10,e<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Be)){var r=Ge(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}else return"-"+this.neg().toString(e);for(var o=Ge(Is(e,6),this.unsigned),s=this,a="";;){var c=s.div(o),u=s.sub(c.mul(o)).toInt()>>>0,l=u.toString(e);if(s=c,s.isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}};w.getHighBits=function(){return this.high};w.getHighBitsUnsigned=function(){return this.high>>>0};w.getLowBits=function(){return this.low};w.getLowBitsUnsigned=function(){return this.low>>>0};w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Be)?64:this.neg().getNumBitsAbs();for(var e=this.high!=0?this.high:this.low,r=31;r>0&&!(e&1<<r);r--);return this.high!=0?r+33:r+1};w.isZero=function(){return this.high===0&&this.low===0};w.eqz=w.isZero;w.isNegative=function(){return!this.unsigned&&this.high<0};w.isPositive=function(){return this.unsigned||this.high>=0};w.isOdd=function(){return(this.low&1)===1};w.isEven=function(){return(this.low&1)===0};w.equals=function(e){return ye(e)||(e=Ze(e)),this.unsigned!==e.unsigned&&this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low};w.eq=w.equals;w.notEquals=function(e){return!this.eq(e)};w.neq=w.notEquals;w.ne=w.notEquals;w.lessThan=function(e){return this.comp(e)<0};w.lt=w.lessThan;w.lessThanOrEqual=function(e){return this.comp(e)<=0};w.lte=w.lessThanOrEqual;w.le=w.lessThanOrEqual;w.greaterThan=function(e){return this.comp(e)>0};w.gt=w.greaterThan;w.greaterThanOrEqual=function(e){return this.comp(e)>=0};w.gte=w.greaterThanOrEqual;w.ge=w.greaterThanOrEqual;w.compare=function(e){if(ye(e)||(e=Ze(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1};w.comp=w.compare;w.negate=function(){return!this.unsigned&&this.eq(Be)?Be:this.not().add(sn)};w.neg=w.negate;w.add=function(e){ye(e)||(e=Ze(e));var r=this.high>>>16,n=this.high&65535,i=this.low>>>16,o=this.low&65535,s=e.high>>>16,a=e.high&65535,c=e.low>>>16,u=e.low&65535,l=0,f=0,h=0,d=0;return d+=o+u,h+=d>>>16,d&=65535,h+=i+c,f+=h>>>16,h&=65535,f+=n+a,l+=f>>>16,f&=65535,l+=r+s,l&=65535,V(h<<16|d,l<<16|f,this.unsigned)};w.subtract=function(e){return ye(e)||(e=Ze(e)),this.add(e.neg())};w.sub=w.subtract;w.multiply=function(e){if(this.isZero())return this;if(ye(e)||(e=Ze(e)),Ue){var r=Ue.mul(this.low,this.high,e.low,e.high);return V(r,Ue.get_high(),this.unsigned)}if(e.isZero())return this.unsigned?bt:Ye;if(this.eq(Be))return e.isOdd()?Be:Ye;if(e.eq(Be))return this.isOdd()?Be:Ye;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(T0)&&e.lt(T0))return Ge(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=this.high&65535,o=this.low>>>16,s=this.low&65535,a=e.high>>>16,c=e.high&65535,u=e.low>>>16,l=e.low&65535,f=0,h=0,d=0,p=0;return p+=s*l,d+=p>>>16,p&=65535,d+=o*l,h+=d>>>16,d&=65535,d+=s*u,h+=d>>>16,d&=65535,h+=i*l,f+=h>>>16,h&=65535,h+=o*u,f+=h>>>16,h&=65535,h+=s*c,f+=h>>>16,h&=65535,f+=n*l+i*u+o*c+s*a,f&=65535,V(d<<16|p,f<<16|h,this.unsigned)};w.mul=w.multiply;w.divide=function(e){if(ye(e)||(e=Ze(e)),e.isZero())throw Error("division by zero");if(Ue){if(!this.unsigned&&this.high===-2147483648&&e.low===-1&&e.high===-1)return this;var r=(this.unsigned?Ue.div_u:Ue.div_s)(this.low,this.high,e.low,e.high);return V(r,Ue.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?bt:Ye;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return bt;if(e.gt(this.shru(1)))return E0;o=bt}else{if(this.eq(Be)){if(e.eq(sn)||e.eq(rl))return Be;if(e.eq(Be))return sn;var s=this.shr(1);return n=s.div(e).shl(1),n.eq(Ye)?e.isNegative()?sn:rl:(i=this.sub(e.mul(n)),o=n.add(i.div(e)),o)}else if(e.eq(Be))return this.unsigned?bt:Ye;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=Ye}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(n)/Math.LN2),c=a<=48?1:Is(2,a-48),u=Ge(n),l=u.mul(e);l.isNegative()||l.gt(i);)n-=c,u=Ge(n,this.unsigned),l=u.mul(e);u.isZero()&&(u=sn),o=o.add(u),i=i.sub(l)}return o};w.div=w.divide;w.modulo=function(e){if(ye(e)||(e=Ze(e)),Ue){var r=(this.unsigned?Ue.rem_u:Ue.rem_s)(this.low,this.high,e.low,e.high);return V(r,Ue.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))};w.mod=w.modulo;w.rem=w.modulo;w.not=function(){return V(~this.low,~this.high,this.unsigned)};w.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};w.clz=w.countLeadingZeros;w.countTrailingZeros=function(){return this.low?y0(this.low):y0(this.high)+32};w.ctz=w.countTrailingZeros;w.and=function(e){return ye(e)||(e=Ze(e)),V(this.low&e.low,this.high&e.high,this.unsigned)};w.or=function(e){return ye(e)||(e=Ze(e)),V(this.low|e.low,this.high|e.high,this.unsigned)};w.xor=function(e){return ye(e)||(e=Ze(e)),V(this.low^e.low,this.high^e.high,this.unsigned)};w.shiftLeft=function(e){return ye(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?V(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):V(0,this.low<<e-32,this.unsigned)};w.shl=w.shiftLeft;w.shiftRight=function(e){return ye(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?V(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):V(this.high>>e-32,this.high>=0?0:-1,this.unsigned)};w.shr=w.shiftRight;w.shiftRightUnsigned=function(e){return ye(e)&&(e=e.toInt()),(e&=63)===0?this:e<32?V(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):e===32?V(this.high,0,this.unsigned):V(this.high>>>e-32,0,this.unsigned)};w.shru=w.shiftRightUnsigned;w.shr_u=w.shiftRightUnsigned;w.rotateLeft=function(e){var r;return ye(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?V(this.high,this.low,this.unsigned):e<32?(r=32-e,V(this.low<<e|this.high>>>r,this.high<<e|this.low>>>r,this.unsigned)):(e-=32,r=32-e,V(this.high<<e|this.low>>>r,this.low<<e|this.high>>>r,this.unsigned))};w.rotl=w.rotateLeft;w.rotateRight=function(e){var r;return ye(e)&&(e=e.toInt()),(e&=63)===0?this:e===32?V(this.high,this.low,this.unsigned):e<32?(r=32-e,V(this.high<<r|this.low>>>e,this.low<<r|this.high>>>e,this.unsigned)):(e-=32,r=32-e,V(this.low<<r|this.high>>>e,this.high<<r|this.low>>>e,this.unsigned))};w.rotr=w.rotateRight;w.toSigned=function(){return this.unsigned?V(this.low,this.high,!1):this};w.toUnsigned=function(){return this.unsigned?this:V(this.low,this.high,!0)};w.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()};w.toBytesLE=function(){var e=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]};w.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,e&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Z.fromBytes=function(e,r,n){return n?Z.fromBytesLE(e,r):Z.fromBytesBE(e,r)};Z.fromBytesLE=function(e,r){return new Z(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)};Z.fromBytesBE=function(e,r){return new Z(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)};var cn=Z;var dw=16;function ci(t){t==="X"&&(t="");let e=t.padEnd(dw,"0");return cn.fromString(e,!0,16)}function il(t){if(t.isZero())return"X";let e=t.countTrailingZeros(),r=e%4;e=(e-r)/4;let n=e;e*=4;let o=t.shiftRightUnsigned(e).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function ol(t,e){let r=pw(t).shiftRightUnsigned(2);return t.add(cn.fromNumber(2*e+1-4).multiply(r))}function pw(t){return t.and(t.not().add(1))}var mw=3,gw=30,yw=2*gw+1,C0=180/Math.PI;function w0(t){if(t.length===0)throw new Error(`Invalid Hilbert quad key ${t}`);let e=t.split("/"),r=parseInt(e[0],10),n=e[1],i=n.length,o=0,s=[0,0];for(let a=i-1;a>=0;a--){o=i-a;let c=n[a],u=0,l=0;c==="1"?l=1:c==="2"?(u=1,l=1):c==="3"&&(u=1);let f=Math.pow(2,o-1);Aw(f,s,u,l),s[0]+=f*u,s[1]+=f*l}if(r%2===1){let a=s[0];s[0]=s[1],s[1]=a}return{face:r,ij:s,level:o}}function I0(t){if(t.isZero())return"";let e=t.toString(2);for(;e.length<mw+yw;)e="0"+e;let r=e.lastIndexOf("1"),n=e.substring(0,3),i=e.substring(3,r),o=i.length/2,s=cn.fromString(n,!0,2).toString(10),a="";if(o!==0)for(a=cn.fromString(i,!0,2).toString(4);a.length<o;)a="0"+a;return`${s}/${a}`}function sl(t,e,r){let n=1<<e;return[(t[0]+r[0])/n,(t[1]+r[1])/n]}function M0(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function al(t){return[M0(t[0]),M0(t[1])]}function cl(t,e){let[r,n]=e;switch(t){case 0:return[1,r,n];case 1:return[-r,1,n];case 2:return[-r,-n,1];case 3:return[-1,-n,-r];case 4:return[n,-1,-r];case 5:return[n,r,-1];default:throw new Error("Invalid face")}}function ul(t){let[e,r,n]=t,i=Math.atan2(n,Math.sqrt(e*e+r*r));return[Math.atan2(r,e)*C0,i*C0]}function Aw(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let i=e[0];e[0]=e[1],e[1]=i}}function O0(t){let e=sl(t.ij,t.level,[.5,.5]),r=al(e),n=cl(t.face,r);return ul(n)}var _w=100;function ll(t){let{face:e,ij:r,level:n}=t,i=[[0,0],[0,1],[1,1],[1,0],[0,0]],o=Math.max(1,Math.ceil(_w*Math.pow(2,-n))),s=new Float64Array(4*o*2+2),a=0,c=0;for(let u=0;u<4;u++){let l=i[u].slice(0),f=i[u+1],h=(f[0]-l[0])/o,d=(f[1]-l[1])/o;for(let p=0;p<o;p++){l[0]+=h,l[1]+=d;let g=sl(r,n,l),m=al(g),A=cl(e,m),_=ul(A);Math.abs(_[1])>89.999&&(_[0]=c);let v=_[0]-c;_[0]+=v>180?-360:v<-180?360:0,s[a++]=_[0],s[a++]=_[1],c=_[0]}}return s[a++]=s[0],s[a++]=s[1],s}function un(t){let e=vw(t);return w0(e)}function vw(t){if(t.indexOf("/")>0)return t;let e=ci(t);return I0(e)}function fl(t){let e=un(t);return O0(e)}function L0(t){let e;if(t.face===2||t.face===5){let r=null,n=0;for(let i=0;i<4;i++){let o=`${t.face}/${i}`,s=un(o),a=ll(s);(typeof r>"u"||r===null)&&(r=new Float64Array(4*a.length)),r.set(a,n),n+=a.length}e=R0(r)}else{let r=ll(t);e=R0(r)}return e}function R0(t){if(t.length%2!==0)throw new Error("Invalid corners");let e=[],r=[];for(let n=0;n<t.length;n+=2)e.push(t[n]),r.push(t[n+1]);return e.sort((n,i)=>n-i),r.sort((n,i)=>n-i),{west:e[0],east:e[e.length-1],north:r[r.length-1],south:r[0]}}function hl(t,e){let r=e?.minimumHeight||0,n=e?.maximumHeight||0,i=un(t),o=L0(i),s=o.west,a=o.south,c=o.east,u=o.north,l=[];return l.push(new T(s,u,r)),l.push(new T(c,u,r)),l.push(new T(c,a,r)),l.push(new T(s,a,r)),l.push(new T(s,u,n)),l.push(new T(c,u,n)),l.push(new T(c,a,n)),l.push(new T(s,a,n)),l}function Os(t){let e=t.token,r={minimumHeight:t.minimumHeight,maximumHeight:t.maximumHeight},n=hl(e,r),i=fl(e),o=i[0],s=i[1],a=U.WGS84.cartographicToCartesian([o,s,r.maximumHeight]),c=new T(a[0],a[1],a[2]);n.push(c);let u=Dn(n);return[...u.center,...u.halfAxes]}var xw=4,Tw=8,bw={QUADTREE:xw,OCTREE:Tw};function Ew(t,e,r){if(t!=null&&t.box){let n=ci(t.s2VolumeInfo.token),i=ol(n,e),o=il(i),s={...t.s2VolumeInfo};switch(s.token=o,r){case"OCTREE":let u=t.s2VolumeInfo,l=u.maximumHeight-u.minimumHeight,f=l/2,h=u.minimumHeight+l/2;u.minimumHeight=h-f,u.maximumHeight=h+f;break;default:break}return{box:Os(s),s2VolumeInfo:s}}}async function pl(t){let{implicitOptions:e,parentData:r={mortonIndex:0,x:0,y:0,z:0},childIndex:n=0,s2VolumeBox:i,loaderOptions:o}=t,{subtree:s,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=t,{subdivisionScheme:u,subtreeLevels:l,maximumLevel:f,contentUrlTemplate:h,subtreesUriTemplate:d,basePath:p}=e,g={children:[],lodMetricValue:0,contentUrl:""};if(!f)return tl.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${h} won't be loaded...`),g;let m=a+c.level;if(m>f)return g;let A=bw[u],_=Math.log2(A),v=n&1,x=n>>1&1,B=n>>2&1,S=(A**a-1)/(A-1),C=xr(r.mortonIndex,n,_),E=S+C,b=xr(r.x,v,1),y=xr(r.y,x,1),M=xr(r.z,B,1),I=!1;a>=l&&(I=dl(s.childSubtreeAvailability,C));let O=xr(c.x,b,a),R=xr(c.y,y,a),F=xr(c.z,M,a);if(I){let K=`${p}/${d}`,ee=Rs(K,m,O,R,F);s=await(0,P0.load)(ee,Bs,o),c={mortonIndex:C,x:b,y,z:M,level:a},C=0,E=0,b=0,y=0,M=0,a=0}if(!dl(s.tileAvailability,E))return g;dl(s.contentAvailability,E)&&(g.contentUrl=Rs(h,m,O,R,F));let Q=a+1,W={mortonIndex:C,x:b,y,z:M};for(let K=0;K<A;K++){let ee=Ew(i,K,u),xe=await pl({subtree:s,implicitOptions:e,loaderOptions:o,parentData:W,childIndex:K,level:Q,globalData:{...c},s2VolumeBox:ee});if(xe.contentUrl||xe.children.length){let Yy=m+1,Zy=Sw(xe,Yy,{childTileX:b,childTileY:y,childTileZ:M},e,i);g.children.push(Zy)}}return g}function dl(t,e){let r;return Array.isArray(t)?(r=t[0],t.length>1&&tl.once('Not supported extension "3DTILES_multiple_contents" has been detected')):r=t,"constant"in r?Boolean(r.constant):r.explicitBitstream?Mw(e,r.explicitBitstream):!1}function Sw(t,e,r,n,i){let{basePath:o,refine:s,getRefine:a,lodMetricType:c,getTileType:u,rootLodMetricValue:l,rootBoundingVolume:f}=n,h=t.contentUrl&&t.contentUrl.replace(`${o}/`,""),d=l/2**e,p=i!=null&&i.box?{box:i.box}:f,g=Bw(e,p,r);return{children:t.children,contentUrl:t.contentUrl,content:{uri:h},id:t.contentUrl,refine:a(s),type:u(t),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:t.transform,boundingVolume:g}}function Bw(t,e,r){if(e.region){let{childTileX:n,childTileY:i,childTileZ:o}=r,[s,a,c,u,l,f]=e.region,h=2**t,d=(c-s)/h,p=(u-a)/h,g=(f-l)/h,[m,A]=[s+d*n,s+d*(n+1)],[_,v]=[a+p*i,a+p*(i+1)],[x,B]=[l+g*o,l+g*(o+1)];return{region:[m,_,A,v,x,B]}}if(e.box)return e;throw new Error(`Unsupported bounding volume type ${e}`)}function xr(t,e,r){return(t<<r)+e}function Rs(t,e,r,n,i){let o=Cw({level:e,x:r,y:n,z:i});return t.replace(/{level}|{x}|{y}|{z}/gi,s=>o[s])}function Cw(t){let e={};for(let r in t)e[`{${r}}`]=t[r];return e}function Mw(t,e){let r=Math.floor(t/8),n=t%8;return(e[r]>>n&1)===1}function gl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(!e)return ut.EMPTY;let n=e.split("?")[0].split(".").pop();switch(n){case"pnts":return ut.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return ut.SCENEGRAPH;default:return n||ut.EMPTY}}function yl(t){switch(t){case"REPLACE":case"replace":return be.REPLACE;case"ADD":case"add":return be.ADD;default:return t}}function ml(t,e){if(/^[a-z][0-9a-z+.-]*:/i.test(e)){let n=new URL(t,`${e}/`);return decodeURI(n.toString())}else if(t.startsWith("/"))return t;return It.resolve(e,t)}function F0(t,e){if(!t)return null;let r;if(t.content){var n;let o=t.content.uri||((n=t.content)===null||n===void 0?void 0:n.url);typeof o<"u"&&(r=ml(o,e))}return{...t,id:r,contentUrl:r,lodMetricType:fr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:gl(t,r),refine:yl(t.refine)}}async function G0(t,e,r){let n=null,i=N0(t.root);i&&t.root?n=await D0(t.root,t,e,i,r):n=F0(t.root,e);let o=[];for(o.push(n);o.length>0;){let s=o.pop()||{},a=s.children||[],c=[];for(let u of a){let l=N0(u),f;l?f=await D0(u,t,e,l,r):f=F0(u,e),f&&(c.push(f),o.push(f))}s.children=c}return n}async function D0(t,e,r,n,i){var o,s,a;let{subdivisionScheme:c,maximumLevel:u,availableLevels:l,subtreeLevels:f,subtrees:{uri:h}}=n,d=Rs(h,0,0,0,0),p=ml(d,r),g=await(0,U0.load)(p,Bs,i),m=(o=t.content)===null||o===void 0?void 0:o.uri,A=m?ml(m,r):"",_=e==null||(s=e.root)===null||s===void 0?void 0:s.refine,v=t.geometricError,x=(a=t.boundingVolume.extensions)===null||a===void 0?void 0:a["3DTILES_bounding_volume_S2"];if(x){let E={box:Os(x),s2VolumeInfo:x};t.boundingVolume=E}let B=t.boundingVolume,S={contentUrlTemplate:A,subtreesUriTemplate:h,subdivisionScheme:c,subtreeLevels:f,maximumLevel:Number.isFinite(l)?l-1:u,refine:_,basePath:r,lodMetricType:fr.GEOMETRIC_ERROR,rootLodMetricValue:v,rootBoundingVolume:B,getTileType:gl,getRefine:yl};return await ww(t,r,g,S,i)}async function ww(t,e,r,n,i){if(!t)return null;let{children:o,contentUrl:s}=await pl({subtree:r,implicitOptions:n,loaderOptions:i}),a,c=null;return s&&(a=s,c={uri:s.replace(`${e}/`,"")}),{...t,id:a,contentUrl:a,lodMetricType:fr.GEOMETRIC_ERROR,lodMetricValue:t.geometricError,transformMatrix:t.transform,type:gl(t,a),refine:yl(t.refine),content:c||t.content,children:o}}function N0(t){var e;return(t==null||(e=t.extensions)===null||e===void 0?void 0:e["3DTILES_implicit_tiling"])||t?.implicitTiling}var Ls={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:cs,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:Iw,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function Iw(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=e["3d-tiles"]||{},i;return n.isTileset==="auto"?i=r?.url&&r.url.indexOf(".json")!==-1:i=n.isTileset,i?Ow(t,e,r):Rw(t,e,r)}async function Ow(t,e,r){var n;let i=JSON.parse(new TextDecoder().decode(t)),o=r?.url||"",s=Lw(o),a=await G0(i,s,e||{});return{...i,shape:"tileset3d",loader:Ls,url:o,queryString:r?.queryString||"",basePath:s,root:a||i.root,type:pe.TILES3D,lodMetricType:fr.GEOMETRIC_ERROR,lodMetricValue:((n=i.root)===null||n===void 0?void 0:n.geometricError)||0}}async function Rw(t,e,r){let n={content:{shape:"tile3d",featureIds:null}};return await $u(t,0,e,r,n.content),n.content}function Lw(t){return It.dirname(t)}function Ps(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ps=function(r){return typeof r}:Ps=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ps(t)}function H0(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ln(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?H0(Object(r),!0).forEach(function(n){Pw(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):H0(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Pw(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function V0(t,e,r,n,i,o,s){try{var a=t[o](s),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,i)}function Fw(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function s(c){V0(o,n,i,s,a,"next",c)}function a(c){V0(o,n,i,s,a,"throw",c)}s(void 0)})}}function Dw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z0(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Nw(t,e,r){return e&&z0(t.prototype,e),r&&z0(t,r),t}function Fs(t,e,r){return typeof Reflect<"u"&&Reflect.get?Fs=Reflect.get:Fs=function(i,o,s){var a=Uw(i,o);if(a){var c=Object.getOwnPropertyDescriptor(a,o);return c.get?c.get.call(s):c.value}},Fs(t,e,r||t)}function Uw(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=fn(t),t!==null););return t}function Gw(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Al(t,e)}function Al(t,e){return Al=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Al(t,e)}function Hw(t){var e=jw();return function(){var n=fn(t),i;if(e){var o=fn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Vw(this,i)}}function Vw(t,e){if(e&&(Ps(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zw(t)}function zw(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jw(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function fn(t){return fn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},fn(t)}var j0=[0],kw={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Ls,onTilesetLoad:{type:"function",value:function(e){}},onTileLoad:{type:"function",value:function(e){}},onTileUnload:{type:"function",value:function(e){}},onTileError:{type:"function",value:function(e,r,n){}},_getMeshColor:{type:"function",value:function(e){return[255,255,255]}}},Ds=function(t){Gw(r,t);var e=Hw(r);function r(){var i;Dw(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=e.call.apply(e,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){"onTileLoadFail"in this.props&&Wt.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}},n.shouldUpdateState=function(o){var s=o.changeFlags;return s.somethingChanged},n.updateState=function(o){var s=o.props,a=o.oldProps,c=o.changeFlags;if(s.data&&s.data!==a.data&&this._loadTileset(s.data),c.viewportChanged){var u=this.state.activeViewports,l=Object.keys(u).length;l&&(this._updateTileset(u),this.state.lastUpdatedViewports=u,this.state.activeViewports={})}if(c.propsChanged){var f=this.state.layerMap;for(var h in f)f[h].needsUpdate=!0}},n.activateViewport=function(o){var s=this.state,a=s.activeViewports,c=s.lastUpdatedViewports;this.internalState.viewport=o,a[o.id]=o;var u=c?.[o.id];(!u||!o.equals(u))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())},n.getPickingInfo=function(o){var s=o.info,a=o.sourceLayer,c=a&&a.props.tile;return s.picked&&(s.object=c),s.sourceTile=c,s},n.filterSubLayer=function(o){var s=o.layer,a=o.viewport,c=s.props,u=c.tile,l=a.id;return u.selected&&u.viewportIds.includes(l)},n._updateAutoHighlight=function(o){var s=o.sourceTile,a=this.state.layerMap[s?.id];a&&a.layer&&a.layer.updateAutoHighlight(o)},n._loadTileset=function(){var i=Fw(regeneratorRuntime.mark(function s(a){var c,u,l,f,h,d,p,g,m;return regeneratorRuntime.wrap(function(_){for(;;)switch(_.prev=_.next){case 0:if(c=this.props.loadOptions,u=c===void 0?{}:c,l=this.props.loader||this.props.loaders,f=Array.isArray(l)?l[0]:l,h={loadOptions:ln({},u)},d=a,!f.preload){_.next=12;break}return _.next=8,f.preload(a,u);case 8:p=_.sent,p.url&&(d=p.url),p.headers&&(h.loadOptions.fetch=ln(ln({},h.loadOptions.fetch),{},{headers:p.headers})),Object.assign(h,p);case 12:return _.next=14,(0,q0.load)(d,f,h.loadOptions);case 14:g=_.sent,m=new Qn(g,ln({onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError},h)),this.setState({tileset3d:m,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(m);case 19:case"end":return _.stop()}},s,this)}));function o(s){return i.apply(this,arguments)}return o}(),n._onTileLoad=function(o){var s=this.state.lastUpdatedViewports;this.props.onTileLoad(o),this._updateTileset(s),this.setNeedsUpdate()},n._onTileUnload=function(o){delete this.state.layerMap[o.id],this.props.onTileUnload(o)},n._updateTileset=function(o){var s=this;if(o){var a=this.state.tileset3d,c=this.context.timeline,u=Object.keys(o).length;!c||!u||!a||a.selectTiles(Object.values(o)).then(function(l){var f=s.state.frameNumber!==l;f&&s.setState({frameNumber:l})})}},n._getSubLayer=function(o,s){if(!o.content)return null;switch(o.type){case ut.POINTCLOUD:return this._makePointCloudLayer(o,s);case ut.SCENEGRAPH:return this._make3DModelLayer(o);case ut.MESH:return this._makeSimpleMeshLayer(o,s);default:throw new Error("Tile3DLayer: Failed to render layer of type ".concat(o.content.type))}},n._makePointCloudLayer=function(o,s){var a=o.content,c=a.attributes,u=a.pointCount,l=a.constantRGBA,f=a.cartographicOrigin,h=a.modelMatrix,d=c.positions,p=c.normals,g=c.colors;if(!d)return null;var m=s&&s.props.data||{header:{vertexCount:u},attributes:{POSITION:d,NORMAL:p,COLOR_0:g}},A=this.props,_=A.pointSize,v=A.getPointColor,x=this.getSubLayerClass("pointcloud",k0.PointCloudLayer);return new x({pointSize:_},this.getSubLayerProps({id:"pointcloud"}),{id:"".concat(this.id,"-pointcloud-").concat(o.id),tile:o,data:m,coordinateSystem:Wt.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:f,modelMatrix:h,getColor:l||v,_offset:0})},n._make3DModelLayer=function(o){var s=o.content,a=s.gltf,c=s.instances,u=s.cartographicOrigin,l=s.modelMatrix,f=this.getSubLayerClass("scenegraph",J0.ScenegraphLayer);return new f({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:"".concat(this.id,"-scenegraph-").concat(o.id),tile:o,data:c||j0,scenegraph:a,coordinateSystem:Wt.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:u,modelMatrix:l,getTransformMatrix:function(d){return d.modelMatrix},getPosition:[0,0,0],_offset:0})},n._makeSimpleMeshLayer=function(o,s){var a=o.content,c=a.attributes,u=a.indices,l=a.modelMatrix,f=a.cartographicOrigin,h=a.coordinateSystem,d=h===void 0?Wt.COORDINATE_SYSTEM.METER_OFFSETS:h,p=a.material,g=a.featureIds,m=this.props._getMeshColor,A=s&&s.props.mesh||new Xn({topology:"triangle-list",attributes:Jw(c),indices:u}),_=this.getSubLayerClass("mesh",Wo);return new _(this.getSubLayerProps({id:"mesh"}),{id:"".concat(this.id,"-mesh-").concat(o.id),tile:o,mesh:A,data:j0,getColor:m(o),pbrMaterial:p,modelMatrix:l,coordinateOrigin:f,coordinateSystem:d,featureIds:g,_offset:0})},n.renderLayers=function(){var o=this,s=this.state,a=s.tileset3d,c=s.layerMap;return a?a.tiles.map(function(u){var l=c[u.id]=c[u.id]||{tile:u},f=l.layer;return u.selected&&(f?l.needsUpdate&&(f=o._getSubLayer(u,f),l.needsUpdate=!1):f=o._getSubLayer(u)),l.layer=f,f}).filter(Boolean):null},Nw(r,[{key:"isLoaded",get:function(){var o,s;return Boolean(((o=this.state)===null||o===void 0||(s=o.tileset3d)===null||s===void 0?void 0:s.isLoaded())&&Fs(fn(r.prototype),"isLoaded",this))}}]),r}(Wt.CompositeLayer);Ds.defaultProps=kw;Ds.layerName="Tile3DLayer";function Jw(t){var e={};return e.positions=ln(ln({},t.positions),{},{value:new Float32Array(t.positions.value)}),t.normals&&(e.normals=t.normals),t.texCoords&&(e.texCoords=t.texCoords),t.colors&&(e.colors=t.colors),t.uvRegions&&(e.uvRegions=t.uvRegions),e}var js=P(ze()),Sl=P(Vo()),ry=P(ze());var qw=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function _l(t){return t>>1^-(t&1)}function Ww(t){let e=0,r={};for(let[n,i]of qw){let o=i===8?t.getFloat64:t.getFloat32;r[n]=o.call(t,e,!0),e+=i}return{header:r,headerEndPosition:e}}function Xw(t,e){let r=e,n=3,i=t.getUint32(r,!0),o=new Uint16Array(i*n);r+=Uint32Array.BYTES_PER_ELEMENT;let s=Uint16Array.BYTES_PER_ELEMENT,a=i*s,c=r,u=c+a,l=u+a,f=0,h=0,d=0;for(let p=0;p<i;p++)f+=_l(t.getUint16(c+s*p,!0)),h+=_l(t.getUint16(u+s*p,!0)),d+=_l(t.getUint16(l+s*p,!0)),o[p]=f,o[p+i]=h,o[p+i*2]=d;return r+=a*3,{vertexData:o,vertexDataEndPosition:r}}function ui(t,e,r,n){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o;if(n===2?o=new Uint16Array(t,e,r):o=new Uint32Array(t,e,r),!i)return o;let s=0;for(let a=0;a<o.length;++a){let c=o[a];o[a]=s-c,c===0&&++s}return o}function Kw(t,e,r){let n=r,i=3,s=e.length/i>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;n%s!==0&&(n+=s-n%s);let a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,u=ui(t.buffer,n,c,s);return n+=c*s,{triangleIndicesEndPosition:n,triangleIndices:u}}function Yw(t,e,r){let n=r,i=3,s=e.length/i>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let c=ui(t.buffer,n,a,s,!1);n+=a*s;let u=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let l=ui(t.buffer,n,u,s,!1);n+=u*s;let f=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let h=ui(t.buffer,n,f,s,!1);n+=f*s;let d=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let p=ui(t.buffer,n,d,s,!1);return n+=d*s,{edgeIndicesEndPosition:n,westIndices:c,southIndices:l,eastIndices:h,northIndices:p}}function Zw(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function Qw(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function $w(t,e){let r={};if(t.byteLength<=e)return{extensions:r,extensionsEndPosition:e};let n=e;for(;n<t.byteLength;){let i=t.getUint8(n,!0);n+=Uint8Array.BYTES_PER_ELEMENT;let o=t.getUint32(n,!0);n+=Uint32Array.BYTES_PER_ELEMENT;let s=new DataView(t.buffer,n,o);switch(i){case 1:{r.vertexNormals=Zw(s);break}case 2:{r.waterMask=Qw(s);break}default:}n+=o}return{extensions:r,extensionsEndPosition:n}}var Tr={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},eI={maxDecodingStep:Tr.extensions};function vl(t,e){let r=Object.assign({},eI,e),n=new DataView(t),{header:i,headerEndPosition:o}=Ww(n);if(r.maxDecodingStep<Tr.vertices)return{header:i};let{vertexData:s,vertexDataEndPosition:a}=Xw(n,o);if(r.maxDecodingStep<Tr.triangleIndices)return{header:i,vertexData:s};let{triangleIndices:c,triangleIndicesEndPosition:u}=Kw(n,s,a);if(r.maxDecodingStep<Tr.edgeIndices)return{header:i,vertexData:s,triangleIndices:c};let{westIndices:l,southIndices:f,eastIndices:h,northIndices:d,edgeIndicesEndPosition:p}=Yw(n,s,u);if(r.maxDecodingStep<Tr.extensions)return{header:i,vertexData:s,triangleIndices:c,westIndices:l,northIndices:d,eastIndices:h,southIndices:f};let{extensions:g}=$w(n,p);return{header:i,vertexData:s,triangleIndices:c,westIndices:l,northIndices:d,eastIndices:h,southIndices:f,extensions:g}}function Ns(t,e,r,n){let i=n?rI(n,t.POSITION.value):tI(e),o=new t.POSITION.value.constructor(i.length*6),s=new t.TEXCOORD_0.value.constructor(i.length*4),a=new e.constructor(i.length*6);for(let u=0;u<i.length;u++){let l=i[u];nI({edge:l,edgeIndex:u,attributes:t,skirtHeight:r,newPosition:o,newTexcoord0:s,newTriangles:a})}t.POSITION.value=_n(t.POSITION.value,o),t.TEXCOORD_0.value=_n(t.TEXCOORD_0.value,s);let c=e instanceof Array?e.concat(a):_n(e,a);return{attributes:t,triangles:c}}function tI(t){let e=[];for(let s=0;s<t.length;s+=3)e.push([t[s],t[s+1]]),e.push([t[s+1],t[s+2]]),e.push([t[s+2],t[s]]);e.sort((s,a)=>Math.min(...s)-Math.min(...a)||Math.max(...s)-Math.max(...a));let r=[],n=0;for(;n<e.length;){var i,o;e[n][0]===((i=e[n+1])===null||i===void 0?void 0:i[1])&&e[n][1]===((o=e[n+1])===null||o===void 0?void 0:o[0])?n+=2:(r.push(e[n]),n++)}return r}function rI(t,e){t.westIndices.sort((n,i)=>e[3*n+1]-e[3*i+1]),t.eastIndices.sort((n,i)=>e[3*i+1]-e[3*n+1]),t.southIndices.sort((n,i)=>e[3*i]-e[3*n]),t.northIndices.sort((n,i)=>e[3*n]-e[3*i]);let r=[];for(let n in t){let i=t[n];for(let o=0;o<i.length-1;o++)r.push([i[o],i[o+1]])}return r}function nI(t){let{edge:e,edgeIndex:r,attributes:n,skirtHeight:i,newPosition:o,newTexcoord0:s,newTriangles:a}=t,c=n.POSITION.value.length,u=r*2,l=r*2+1;o.set(n.POSITION.value.subarray(e[0]*3,e[0]*3+3),u*3),o[u*3+2]=o[u*3+2]-i,o.set(n.POSITION.value.subarray(e[1]*3,e[1]*3+3),l*3),o[l*3+2]=o[l*3+2]-i,s.set(n.TEXCOORD_0.value.subarray(e[0]*2,e[0]*2+2),u*2),s.set(n.TEXCOORD_0.value.subarray(e[1]*2,e[1]*2+2),l*2);let f=r*2*3;a[f]=e[0],a[f+1]=c/3+l,a[f+2]=e[1],a[f+3]=c/3+l,a[f+4]=e[0],a[f+5]=c/3+u}function xl(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{bounds:r}=e,{header:n,vertexData:i,triangleIndices:o,westIndices:s,northIndices:a,eastIndices:c,southIndices:u}=vl(t,Tr.triangleIndices),l=o,f=iI(i,n,r),h=mr(f);if(e!=null&&e.skirtHeight){let{attributes:d,triangles:p}=Ns(f,l,e.skirtHeight,{westIndices:s,northIndices:a,eastIndices:c,southIndices:u});f=d,l=p}return{loaderData:{header:{}},header:{vertexCount:l.length,boundingBox:h},schema:void 0,topology:"triangle-list",mode:4,indices:{value:l,size:1},attributes:f}}function iI(t,e,r){let{minHeight:n,maxHeight:i}=e,[o,s,a,c]=r||[0,0,1,1],u=a-o,l=c-s,f=i-n,h=t.length/3,d=new Float32Array(h*3),p=new Float32Array(h*2);for(let g=0;g<h;g++){let m=t[g]/32767,A=t[g+h]/32767,_=t[g+h*2]/32767;d[3*g+0]=m*u+o,d[3*g+1]=A*l+s,d[3*g+2]=_*f+n,p[2*g+0]=m,p[2*g+1]=A}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var li=class{constructor(e=257){this.gridSize=e;let r=e-1;if(r&r-1)throw new Error(`Expected grid size to be 2^n+1, got ${e}.`);this.numTriangles=r*r*2-2,this.numParentTriangles=this.numTriangles-r*r,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let n=0;n<this.numTriangles;n++){let i=n+2,o=0,s=0,a=0,c=0,u=0,l=0;for(i&1?a=c=u=r:o=s=l=r;(i>>=1)>1;){let h=o+a>>1,d=s+c>>1;i&1?(a=o,c=s,o=u,s=l):(o=a,s=c,a=u,c=l),u=h,l=d}let f=n*4;this.coords[f+0]=o,this.coords[f+1]=s,this.coords[f+2]=a,this.coords[f+3]=c}}createTile(e){return new Tl(e,this)}},Tl=class{constructor(e,r){let n=r.gridSize;if(e.length!==n*n)throw new Error(`Expected terrain data of length ${n*n} (${n} x ${n}), got ${e.length}.`);this.terrain=e,this.martini=r,this.errors=new Float32Array(e.length),this.update()}update(){let{numTriangles:e,numParentTriangles:r,coords:n,gridSize:i}=this.martini,{terrain:o,errors:s}=this;for(let a=e-1;a>=0;a--){let c=a*4,u=n[c+0],l=n[c+1],f=n[c+2],h=n[c+3],d=u+f>>1,p=l+h>>1,g=d+p-l,m=p+u-d,A=(o[l*i+u]+o[h*i+f])/2,_=p*i+d,v=Math.abs(A-o[_]);if(s[_]=Math.max(s[_],v),a<r){let x=(l+m>>1)*i+(u+g>>1),B=(h+m>>1)*i+(f+g>>1);s[_]=Math.max(s[_],s[x],s[B])}}}getMesh(e=0){let{gridSize:r,indices:n}=this.martini,{errors:i}=this,o=0,s=0,a=r-1;n.fill(0);function c(d,p,g,m,A,_){let v=d+g>>1,x=p+m>>1;Math.abs(d-A)+Math.abs(p-_)>1&&i[x*r+v]>e?(c(A,_,d,p,v,x),c(g,m,A,_,v,x)):(n[p*r+d]=n[p*r+d]||++o,n[m*r+g]=n[m*r+g]||++o,n[_*r+A]=n[_*r+A]||++o,s++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let u=new Uint16Array(o*2),l=new Uint32Array(s*3),f=0;function h(d,p,g,m,A,_){let v=d+g>>1,x=p+m>>1;if(Math.abs(d-A)+Math.abs(p-_)>1&&i[x*r+v]>e)h(A,_,d,p,v,x),h(g,m,A,_,v,x);else{let B=n[p*r+d]-1,S=n[m*r+g]-1,C=n[_*r+A]-1;u[2*B]=d,u[2*B+1]=p,u[2*S]=g,u[2*S+1]=m,u[2*C]=A,u[2*C+1]=_,l[f++]=B,l[f++]=S,l[f++]=C}}return h(0,0,a,a,a,0),h(a,a,0,0,0,a),{vertices:u,triangles:l}}};var fi=class{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:r;this.data=e,this.width=r,this.height=n,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let i=r-1,o=n-1,s=this._addPoint(0,0),a=this._addPoint(i,0),c=this._addPoint(0,o),u=this._addPoint(i,o),l=this._addTriangle(u,s,c,-1,-1,-1);this._addTriangle(s,u,a,l,-1,-1),this._flush()}run(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;for(;this.getMaxError()>e;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(e,r){return this.data[this.width*r+e]}_flush(){let e=this.coords;for(let r=0;r<this._pendingLen;r++){let n=this._pending[r],i=2*this.triangles[n*3+0],o=2*this.triangles[n*3+1],s=2*this.triangles[n*3+2];this._findCandidate(e[i],e[i+1],e[o],e[o+1],e[s],e[s+1],n)}this._pendingLen=0}_findCandidate(e,r,n,i,o,s,a){let c=Math.min(e,n,o),u=Math.min(r,i,s),l=Math.max(e,n,o),f=Math.max(r,i,s),h=br(n,i,o,s,c,u),d=br(o,s,e,r,c,u),p=br(e,r,n,i,c,u),g=i-r,m=e-n,A=s-i,_=n-o,v=r-s,x=o-e,B=br(e,r,n,i,o,s),S=this.heightAt(e,r)/B,C=this.heightAt(n,i)/B,E=this.heightAt(o,s)/B,b=0,y=0,M=0,I=0;for(let O=u;O<=f;O++){let R=0;h<0&&A!==0&&(R=Math.max(R,Math.floor(-h/A))),d<0&&v!==0&&(R=Math.max(R,Math.floor(-d/v))),p<0&&g!==0&&(R=Math.max(R,Math.floor(-p/g)));let F=h+A*R,X=d+v*R,z=p+g*R,Q=!1;for(let W=c+R;W<=l;W++){if(F>=0&&X>=0&&z>=0){Q=!0;let K=S*F+C*X+E*z,ee=Math.abs(K-this.heightAt(W,O));I+=ee*ee,ee>b&&(b=ee,y=W,M=O)}else if(Q)break;F+=A,X+=v,z+=g}h+=_,d+=x,p+=m}(y===e&&M===r||y===n&&M===i||y===o&&M===s)&&(b=0),this._candidates[2*a]=y,this._candidates[2*a+1]=M,this._rms[a]=I,this._queuePush(a,b,I)}_step(){let e=this._queuePop(),r=e*3+0,n=e*3+1,i=e*3+2,o=this.triangles[r],s=this.triangles[n],a=this.triangles[i],c=this.coords[2*o],u=this.coords[2*o+1],l=this.coords[2*s],f=this.coords[2*s+1],h=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*e],g=this._candidates[2*e+1],m=this._addPoint(p,g);if(br(c,u,l,f,p,g)===0)this._handleCollinear(m,r);else if(br(l,f,h,d,p,g)===0)this._handleCollinear(m,n);else if(br(h,d,c,u,p,g)===0)this._handleCollinear(m,i);else{let A=this._halfedges[r],_=this._halfedges[n],v=this._halfedges[i],x=this._addTriangle(o,s,m,A,-1,-1,r),B=this._addTriangle(s,a,m,_,-1,x+1),S=this._addTriangle(a,o,m,v,x+2,B+1);this._legalize(x),this._legalize(B),this._legalize(S)}}_addPoint(e,r){let n=this.coords.length>>1;return this.coords.push(e,r),n}_addTriangle(e,r,n,i,o,s){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this.triangles.length,c=a/3;return this.triangles[a+0]=e,this.triangles[a+1]=r,this.triangles[a+2]=n,this._halfedges[a+0]=i,this._halfedges[a+1]=o,this._halfedges[a+2]=s,i>=0&&(this._halfedges[i]=a+0),o>=0&&(this._halfedges[o]=a+1),s>=0&&(this._halfedges[s]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(e){let r=this._halfedges[e];if(r<0)return;let n=e-e%3,i=r-r%3,o=n+(e+1)%3,s=n+(e+2)%3,a=i+(r+2)%3,c=i+(r+1)%3,u=this.triangles[s],l=this.triangles[e],f=this.triangles[o],h=this.triangles[a],d=this.coords;if(!oI(d[2*u],d[2*u+1],d[2*l],d[2*l+1],d[2*f],d[2*f+1],d[2*h],d[2*h+1]))return;let p=this._halfedges[o],g=this._halfedges[s],m=this._halfedges[a],A=this._halfedges[c];this._queueRemove(n/3),this._queueRemove(i/3);let _=this._addTriangle(u,h,f,-1,m,p,n),v=this._addTriangle(h,u,l,_,g,A,i);this._legalize(_+1),this._legalize(v+2)}_handleCollinear(e,r){let n=r-r%3,i=n+(r+1)%3,o=n+(r+2)%3,s=this.triangles[o],a=this.triangles[r],c=this.triangles[i],u=this._halfedges[i],l=this._halfedges[o],f=this._halfedges[r];if(f<0){let S=this._addTriangle(e,s,a,-1,l,-1,n),C=this._addTriangle(s,e,c,S,-1,u);this._legalize(S+1),this._legalize(C+2);return}let h=f-f%3,d=h+(f+2)%3,p=h+(f+1)%3,g=this.triangles[d],m=this._halfedges[d],A=this._halfedges[p];this._queueRemove(h/3);let _=this._addTriangle(s,a,e,l,-1,-1,n),v=this._addTriangle(a,g,e,A,-1,_+1,h),x=this._addTriangle(g,c,e,m,-1,v+1),B=this._addTriangle(c,s,e,u,_+2,x+1);this._legalize(_),this._legalize(v),this._legalize(x),this._legalize(B)}_queuePush(e,r,n){let i=this._queue.length;this._queueIndices[e]=i,this._queue.push(e),this._errors.push(r),this._rmsSum+=n,this._queueUp(i)}_queuePop(){let e=this._queue.length-1;return this._queueSwap(0,e),this._queueDown(0,e),this._queuePopBack()}_queuePopBack(){let e=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[e],this._queueIndices[e]=-1,e}_queueRemove(e){let r=this._queueIndices[e];if(r<0){let i=this._pending.indexOf(e);if(i!==-1)this._pending[i]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let n=this._queue.length-1;n!==r&&(this._queueSwap(r,n),this._queueDown(r,n)||this._queueUp(r)),this._queuePopBack()}_queueLess(e,r){return this._errors[e]>this._errors[r]}_queueSwap(e,r){let n=this._queue[e],i=this._queue[r];this._queue[e]=i,this._queue[r]=n,this._queueIndices[n]=r,this._queueIndices[i]=e;let o=this._errors[e];this._errors[e]=this._errors[r],this._errors[r]=o}_queueUp(e){let r=e;for(;;){let n=r-1>>1;if(n===r||!this._queueLess(r,n))break;this._queueSwap(n,r),r=n}}_queueDown(e,r){let n=e;for(;;){let i=2*n+1;if(i>=r||i<0)break;let o=i+1,s=i;if(o<r&&this._queueLess(o,i)&&(s=o),!this._queueLess(s,n))break;this._queueSwap(n,s),n=s}return n>e}};function br(t,e,r,n,i,o){return(r-i)*(e-o)-(n-o)*(t-i)}function oI(t,e,r,n,i,o,s,a){let c=t-s,u=e-a,l=r-s,f=n-a,h=i-s,d=o-a,p=c*c+u*u,g=l*l+f*f,m=h*h+d*d;return c*(f*m-g*d)-u*(l*m-g*h)+p*(l*d-f*h)<0}function K0(t,e){let{meshMaxError:r,bounds:n,elevationDecoder:i}=e,{data:o,width:s,height:a}=t,c,u;switch(e.tesselator){case"martini":c=Us(o,s,a,i,e.tesselator),u=W0(r,s,c);break;case"delatin":c=Us(o,s,a,i,e.tesselator),u=X0(r,s,a,c);break;default:s===a&&!(a&s-1)?(c=Us(o,s,a,i,"martini"),u=W0(r,s,c)):(c=Us(o,s,a,i,"delatin"),u=X0(r,s,a,c));break}let{vertices:l}=u,{triangles:f}=u,h=sI(l,c,s,a,n),d=mr(h);if(e.skirtHeight){let{attributes:p,triangles:g}=Ns(h,f,e.skirtHeight);h=p,f=g}return{loaderData:{header:{}},header:{vertexCount:f.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(f),size:1},attributes:h}}function W0(t,e,r){let n=e+1,o=new li(n).createTile(r),{vertices:s,triangles:a}=o.getMesh(t);return{vertices:s,triangles:a}}function X0(t,e,r,n){let i=new fi(n,e+1,r+1);i.run(t);let{coords:o,triangles:s}=i;return{vertices:o,triangles:s}}function Us(t,e,r,n,i){let{rScaler:o,bScaler:s,gScaler:a,offset:c}=n,u=new Float32Array((e+1)*(r+1));for(let l=0,f=0;f<r;f++)for(let h=0;h<e;h++,l++){let d=l*4,p=t[d+0],g=t[d+1],m=t[d+2];u[l+f]=p*o+g*a+m*s+c}if(i==="martini"){for(let l=(e+1)*e,f=0;f<e;f++,l++)u[l]=u[l-e-1];for(let l=r,f=0;f<r+1;f++,l+=r+1)u[l]=u[l-1]}return u}function sI(t,e,r,n,i){let o=r+1,s=t.length/2,a=new Float32Array(s*3),c=new Float32Array(s*2),[u,l,f,h]=i||[0,0,r,n],d=(f-u)/r,p=(h-l)/n;for(let g=0;g<s;g++){let m=t[g*2],A=t[g*2+1],_=A*o+m;a[3*g+0]=m*d+u,a[3*g+1]=-A*p+h,a[3*g+2]=e[_],c[2*g+0]=m/r,c[2*g+1]=A/n}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var Gs="4.1.0-alpha.9";var Hs={name:"Terrain",id:"terrain",module:"terrain",version:Gs,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var Y0={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Gs,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var aI={...Hs,parse:cI};async function cI(t,e,r){let n={...e,mimeType:"application/x.image",image:{...e?.image,type:"data"}},i=await Ce(t,[],n,r),o={...aI.options.terrain,...e?.terrain};return K0(i,o)}var Oj={...Y0,parseSync:(t,e)=>xl(t,e?.["quantized-mesh"]),parse:async(t,e)=>xl(t,e?.["quantized-mesh"])};function Vs(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vs=function(r){return typeof r}:Vs=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Vs(t)}function Z0(t){return fI(t)||lI(t)||ty(t)||uI()}function uI(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
763
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lI(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fI(t){if(Array.isArray(t))return bl(t)}function hI(t,e){return mI(t)||pI(t,e)||ty(t,e)||dI()}function dI(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
764
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ty(t,e){if(t){if(typeof t=="string")return bl(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bl(t,e)}}function bl(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function pI(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function mI(t){if(Array.isArray(t))return t}function gI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yI(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&El(t,e)}function El(t,e){return El=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},El(t,e)}function AI(t){var e=xI();return function(){var n=zs(t),i;if(e){var o=zs(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return _I(this,i)}}function _I(t,e){if(e&&(Vs(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vI(t)}function vI(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xI(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function zs(t){return zs=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},zs(t)}function Q0(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Xt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Q0(Object(r),!0).forEach(function(n){TI(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Q0(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function TI(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var $0=[1],bI=Xt(Xt({},At.defaultProps),{},{elevationData:Ut,texture:Xt(Xt({},Ut),{},{optional:!0}),meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[Hs]});function ey(t){return Array.isArray(t)?t.join(";"):t||""}var ks=function(t){yI(r,t);var e=AI(r);function r(){var i;gI(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=e.call.apply(e,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.updateState=function(o){var s=o.props,a=o.oldProps,c=s.elevationData!==a.elevationData;if(c){var u=s.elevationData,l=u&&(Array.isArray(u)||u.includes("{x}")&&u.includes("{y}"));this.setState({isTiled:l})}var f=c||s.meshMaxError!==a.meshMaxError||s.elevationDecoder!==a.elevationDecoder||s.bounds!==a.bounds;if(!this.state.isTiled&&f){var h=this.loadTerrain(s);this.setState({terrain:h})}s.workerUrl&&js.log.removed("workerUrl","loadOptions.terrain.workerUrl")()},n.loadTerrain=function(o){var s,a=o.elevationData,c=o.bounds,u=o.elevationDecoder,l=o.meshMaxError,f=o.signal;if(!a)return null;var h=this.getLoadOptions();h=Xt(Xt({},h),{},{terrain:Xt(Xt({skirtHeight:this.state.isTiled?l*2:0},(s=h)===null||s===void 0?void 0:s.terrain),{},{bounds:c,meshMaxError:l,elevationDecoder:u})});var d=this.props.fetch;return d(a,{propName:"elevationData",layer:this,loadOptions:h,signal:f})},n.getTiledTerrainData=function(o){var s=this.props,a=s.elevationData,c=s.fetch,u=s.texture,l=s.elevationDecoder,f=s.meshMaxError,h=this.context.viewport,d=ot(a,o),p=u&&ot(u,o),g=o.signal,m=[0,0],A=[0,0];if(h.isGeospatial){var _=o.bbox;m=h.projectFlat([_.west,_.south]),A=h.projectFlat([_.east,_.north])}else{var v=o.bbox;m=[v.left,v.bottom],A=[v.right,v.top]}var x=[m[0],m[1],A[0],A[1]],B=this.loadTerrain({elevationData:d,bounds:x,elevationDecoder:l,meshMaxError:f,signal:g}),S=p?c(p,{propName:"texture",layer:this,loaders:[],signal:g}).catch(function(C){return null}):Promise.resolve(null);return Promise.all([B,S])},n.renderSubLayers=function(o){var s=this.getSubLayerClass("mesh",Sl.SimpleMeshLayer),a=this.props,c=a.color,u=a.wireframe,l=a.material,f=o.data;if(!f)return null;var h=hI(f,2),d=h[0],p=h[1];return new s(o,{data:$0,mesh:d,texture:p,_instanced:!1,coordinateSystem:ry.COORDINATE_SYSTEM.CARTESIAN,getPosition:function(m){return[0,0,0]},getColor:c,wireframe:u,material:l})},n.onViewportLoad=function(o){if(o){var s=this.state.zRange,a=o.map(function(l){return l.content}).filter(Boolean).map(function(l){var f=l[0].header.boundingBox;return f.map(function(h){return h[2]})});if(a.length!==0){var c=Math.min.apply(Math,Z0(a.map(function(l){return l[0]}))),u=Math.max.apply(Math,Z0(a.map(function(l){return l[1]})));(!s||c<s[0]||u>s[1])&&this.setState({zRange:[c,u]})}}},n.renderLayers=function(){var o=this.props,s=o.color,a=o.material,c=o.elevationData,u=o.texture,l=o.wireframe,f=o.meshMaxError,h=o.elevationDecoder,d=o.tileSize,p=o.maxZoom,g=o.minZoom,m=o.extent,A=o.maxRequests,_=o.onTileLoad,v=o.onTileUnload,x=o.onTileError,B=o.maxCacheSize,S=o.maxCacheByteSize,C=o.refinementStrategy;if(this.state.isTiled)return new At(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:ey(c),texture:ey(u),meshMaxError:f,elevationDecoder:h}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:d,maxZoom:p,minZoom:g,extent:m,maxRequests:A,onTileLoad:_,onTileUnload:v,onTileError:x,maxCacheSize:B,maxCacheByteSize:S,refinementStrategy:C});var E=this.getSubLayerClass("mesh",Sl.SimpleMeshLayer);return new E(this.getSubLayerProps({id:"mesh"}),{data:$0,mesh:this.state.terrain,texture:u,_instanced:!1,getPosition:function(y){return[0,0,0]},getColor:s,material:a,wireframe:l})},r}(js.CompositeLayer);ks.defaultProps=bI;ks.layerName="TerrainLayer";var na=P(ze()),Jl=P(Ve()),Jy=P(iy());var hi={x:0,y:1,z:2};function Er(t,e={}){let{start:r=0,end:n=t.length,plane:i="xy"}=e,o=e.size||2,s=0,a=hi[i[0]],c=hi[i[1]];for(let u=r,l=n-o;u<n;u+=o)s+=(t[u+a]-t[l+a])*(t[u+c]+t[l+c]),l=u;return s/2}function Cl(t,e,r=2,n,i="xy"){let o=e&&e.length,s=o?e[0]*r:t.length,a=sy(t,0,s,r,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let u,l,f,h,d,p,g;if(o&&(a=II(t,e,a,r,n,i)),t.length>80*r){h=l=t[0],d=f=t[1];for(let m=r;m<s;m+=r)p=t[m],g=t[m+1],p<h&&(h=p),g<d&&(d=g),p>l&&(l=p),g>f&&(f=g);u=Math.max(l-h,f-d),u=u!==0?32767/u:0}return di(a,c,r,h,d,u,0),c}function sy(t,e,r,n,i,o,s){let a,c;o===void 0&&(o=Er(t,{start:e,end:r,size:n,plane:s}));let u=hi[s[0]],l=hi[s[1]];if(i===o<0)for(a=e;a<r;a+=n)c=oy(a,t[a+u],t[a+l],c);else for(a=r-n;a>=e;a-=n)c=oy(a,t[a+u],t[a+l],c);return c&&Ws(c,c.next)&&(mi(c),c=c.next),c}function Sr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Ws(r,r.next)||te(r.prev,r,r.next)===0)){if(mi(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function di(t,e,r,n,i,o,s){if(!t)return;!s&&o&&FI(t,n,i,o);let a=t,c,u;for(;t.prev!==t.next;){if(c=t.prev,u=t.next,o?CI(t,n,i,o):BI(t)){e.push(c.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),mi(t),t=u.next,a=u.next;continue}if(t=u,t===a){s?s===1?(t=MI(Sr(t),e,r),di(t,e,r,n,i,o,2)):s===2&&wI(t,e,r,n,i,o):di(Sr(t),e,r,n,i,o,1);break}}}function BI(t){let e=t.prev,r=t,n=t.next;if(te(e,r,n)>=0)return!1;let i=e.x,o=r.x,s=n.x,a=e.y,c=r.y,u=n.y,l=i<o?i<s?i:s:o<s?o:s,f=a<c?a<u?a:u:c<u?c:u,h=i>o?i>s?i:s:o>s?o:s,d=a>c?a>u?a:u:c>u?c:u,p=n.next;for(;p!==e;){if(p.x>=l&&p.x<=h&&p.y>=f&&p.y<=d&&hn(i,a,o,c,s,u,p.x,p.y)&&te(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function CI(t,e,r,n){let i=t.prev,o=t,s=t.next;if(te(i,o,s)>=0)return!1;let a=i.x,c=o.x,u=s.x,l=i.y,f=o.y,h=s.y,d=a<c?a<u?a:u:c<u?c:u,p=l<f?l<h?l:h:f<h?f:h,g=a>c?a>u?a:u:c>u?c:u,m=l>f?l>h?l:h:f>h?f:h,A=Bl(d,p,e,r,n),_=Bl(g,m,e,r,n),v=t.prevZ,x=t.nextZ;for(;v&&v.z>=A&&x&&x.z<=_;){if(v.x>=d&&v.x<=g&&v.y>=p&&v.y<=m&&v!==i&&v!==s&&hn(a,l,c,f,u,h,v.x,v.y)&&te(v.prev,v,v.next)>=0||(v=v.prevZ,x.x>=d&&x.x<=g&&x.y>=p&&x.y<=m&&x!==i&&x!==s&&hn(a,l,c,f,u,h,x.x,x.y)&&te(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;v&&v.z>=A;){if(v.x>=d&&v.x<=g&&v.y>=p&&v.y<=m&&v!==i&&v!==s&&hn(a,l,c,f,u,h,v.x,v.y)&&te(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=g&&x.y>=p&&x.y<=m&&x!==i&&x!==s&&hn(a,l,c,f,u,h,x.x,x.y)&&te(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function MI(t,e,r){let n=t;do{let i=n.prev,o=n.next.next;!Ws(i,o)&&ay(i,n,n.next,o)&&pi(i,o)&&pi(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),mi(n),mi(n.next),n=t=o),n=n.next}while(n!==t);return Sr(n)}function wI(t,e,r,n,i,o){let s=t;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&UI(s,a)){let c=cy(s,a);s=Sr(s,s.next),c=Sr(c,c.next),di(s,e,r,n,i,o,0),di(c,e,r,n,i,o,0);return}a=a.next}s=s.next}while(s!==t)}function II(t,e,r,n,i,o){let s=[],a,c,u,l,f;for(a=0,c=e.length;a<c;a++)u=e[a]*n,l=a<c-1?e[a+1]*n:t.length,f=sy(t,u,l,n,!1,i&&i[a+1],o),f===f.next&&(f.steiner=!0),s.push(NI(f));for(s.sort(OI),a=0;a<s.length;a++)r=RI(s[a],r);return r}function OI(t,e){return t.x-e.x}function RI(t,e){let r=LI(t,e);if(!r)return e;let n=cy(r,t);return Sr(n,n.next),Sr(r,r.next)}function LI(t,e){let r=e,n=t.x,i=t.y,o=-1/0,s;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let h=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=h,s=r.x<r.next.x?r:r.next,h===n))return s}r=r.next}while(r!==e);if(!s)return null;let a=s,c=s.x,u=s.y,l=1/0,f;r=s;do n>=r.x&&r.x>=c&&n!==r.x&&hn(i<u?n:o,i,c,u,i<u?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),pi(r,t)&&(f<l||f===l&&(r.x>s.x||r.x===s.x&&PI(s,r)))&&(s=r,l=f)),r=r.next;while(r!==a);return s}function PI(t,e){return te(t.prev,t,e.prev)<0&&te(e.next,t,t.next)<0}function FI(t,e,r,n){let i=t;do i.z===0&&(i.z=Bl(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,DI(i)}function DI(t){let e,r,n=1,i,o,s,a,c,u;do{for(o=t,t=null,u=null,i=0;o;){for(i++,a=o,s=0,r=0;r<n&&(s++,a=a.nextZ,!!a);r++);for(c=n;s>0||c>0&&a;)s!==0&&(c===0||!a||o.z<=a.z)?(e=o,o=o.nextZ,s--):(e=a,a=a.nextZ,c--),u?u.nextZ=e:t=e,e.prevZ=u,u=e;o=a}u.nextZ=null,n*=2}while(i>1);return t}function Bl(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function NI(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function hn(t,e,r,n,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function UI(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!GI(t,e)&&(pi(t,e)&&pi(e,t)&&HI(t,e)&&(te(t.prev,t,e.prev)||te(t,e.prev,e))||Ws(t,e)&&te(t.prev,t,t.next)>0&&te(e.prev,e,e.next)>0)}function te(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Ws(t,e){return t.x===e.x&&t.y===e.y}function ay(t,e,r,n){let i=qs(te(t,e,r)),o=qs(te(t,e,n)),s=qs(te(r,n,t)),a=qs(te(r,n,e));return!!(i!==o&&s!==a||i===0&&Js(t,r,e)||o===0&&Js(t,n,e)||s===0&&Js(r,t,n)||a===0&&Js(r,e,n))}function Js(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function qs(t){return t>0?1:t<0?-1:0}function GI(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ay(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function pi(t,e){return te(t.prev,t,t.next)<0?te(t,e,t.next)>=0&&te(t,t.prev,e)>=0:te(t,e,t.prev)<0||te(t,t.next,e)<0}function HI(t,e){let r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==t);return n}function cy(t,e){let r=new gi(t.i,t.x,t.y),n=new gi(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function oy(t,e,r,n){let i=new gi(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function mi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var gi=class{constructor(e,r,n){L(this,"i",void 0),L(this,"x",void 0),L(this,"y",void 0),L(this,"prev",null),L(this,"next",null),L(this,"z",0),L(this,"prevZ",null),L(this,"nextZ",null),L(this,"steiner",!1),this.i=e,this.x=r,this.y=n}};function Il(t,e,r){let n=JI(t),i=Object.keys(n).filter(o=>n[o]!==Array);return qI(t,{propArrayTypes:n,...e},{numericPropKeys:r&&r.numericPropKeys||i,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function JI(t){let e={};for(let r of t)if(r.properties)for(let n in r.properties){let i=r.properties[n];e[n]=QI(i,e[n])}return e}function qI(t,e,r){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:u,polygonRingsCount:l,polygonFeaturesCount:f,propArrayTypes:h,coordLength:d}=e,{numericPropKeys:p=[],PositionDataType:g=Float32Array,triangulate:m=!0}=r,A=t[0]&&"id"in t[0],_=t.length>65535?Uint32Array:Uint16Array,v={type:"Point",positions:new g(n*d),globalFeatureIds:new _(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},x={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new g(o*d),globalFeatureIds:new _(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},B={type:"Polygon",polygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),primitivePolygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),positions:new g(c*d),globalFeatureIds:new _(c),featureIds:f>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};m&&(B.triangles=[]);for(let C of[v,x,B])for(let E of p){let b=h[E];C.numericProps[E]=new b(C.positions.length/d)}x.pathIndices[s]=o,B.polygonIndices[u]=c,B.primitivePolygonIndices[l]=c;let S={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let C of t){let E=C.geometry,b=C.properties||{};switch(E.type){case"Point":WI(E,v,S,d,b),v.properties.push(wl(b,p)),A&&v.fields.push({id:C.id}),S.pointFeature++;break;case"LineString":XI(E,x,S,d,b),x.properties.push(wl(b,p)),A&&x.fields.push({id:C.id}),S.lineFeature++;break;case"Polygon":KI(E,B,S,d,b),B.properties.push(wl(b,p)),A&&B.fields.push({id:C.id}),S.polygonFeature++;break;default:throw new Error("Invalid geometry type")}S.feature++}return ZI(v,x,B,d)}function WI(t,e,r,n,i){e.positions.set(t.data,r.pointPosition*n);let o=t.data.length/n;Ol(e,i,r.pointPosition,o),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function XI(t,e,r,n,i){e.positions.set(t.data,r.linePosition*n);let o=t.data.length/n;Ol(e,i,r.linePosition,o),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let s=0,a=t.indices.length;s<a;++s){let c=t.indices[s],u=s===a-1?t.data.length:t.indices[s+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(u-c)/n}}function KI(t,e,r,n,i){e.positions.set(t.data,r.polygonPosition*n);let o=t.data.length/n;Ol(e,i,r.polygonPosition,o),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);for(let s=0,a=t.indices.length;s<a;++s){let c=r.polygonPosition;e.polygonIndices[r.polygonObject++]=c;let u=t.areas[s],l=t.indices[s],f=t.indices[s+1];for(let d=0,p=l.length;d<p;++d){let g=l[d],m=d===p-1?f===void 0?t.data.length:f[0]:l[d+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(m-g)/n}let h=r.polygonPosition;YI(e,u,l,{startPosition:c,endPosition:h,coordLength:n})}}function YI(t,e,r,n){let{startPosition:i,endPosition:o,coordLength:s}=n;if(!t.triangles)return;let a=i*s,c=o*s,u=t.positions.subarray(a,c),l=r[0],f=r.slice(1).map(d=>(d-l)/s),h=Cl(u,f,s,e);for(let d=0,p=h.length;d<p;++d)t.triangles.push(i+h[d])}function Ml(t,e){let r={};for(let n in t)r[n]={value:t[n],size:e};return r}function ZI(t,e,r,n){let i={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:n},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Ml(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:n},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Ml(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Ml(r.numericProps,1)}};return i.polygons&&r.triangles&&(i.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),i}function Ol(t,e,r,n){for(let i in t.numericProps)if(i in e){let o=e[i];t.numericProps[i].fill(o,r,r+n)}}function wl(t,e){let r={};for(let n in t)e.includes(n)||(r[n]=t[n]);return r}function QI(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function Ys(t,e){let r=e?.globalFeatureId;return r!==void 0?$I(t,r):e2(t,e?.type)}function $I(t,e){let r=hy(t);for(let n of r){let i=0,o=n.featureIds.value[0];for(let s=0;s<n.featureIds.value.length;s++){let a=n.featureIds.value[s];if(a!==o){if(e===n.globalFeatureIds.value[i])return Xs(n,i,s);i=s,o=a}}if(e===n.globalFeatureIds.value[i])return Xs(n,i,n.featureIds.value.length)}throw new Error(`featureId:${e} not found`)}function e2(t,e){let r=hy(t,e);return t2(r)}function fy(t,e,r){switch(t.type){case"Point":return o2(t,e,r);case"LineString":return i2(t,e,r);case"Polygon":return dy(t,e,r);default:let n=t;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function hy(t,e){let r=[];return t.points&&(t.points.type="Point",r.push(t.points)),t.lines&&(t.lines.type="LineString",r.push(t.lines)),t.polygons&&(t.polygons.type="Polygon",r.push(t.polygons)),r}function t2(t){let e=[];for(let r of t){if(r.featureIds.value.length===0)continue;let n=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let s=r.featureIds.value[o];s!==i&&(e.push(Xs(r,n,o)),n=o,i=s)}e.push(Xs(r,n,r.featureIds.value.length))}return e}function Xs(t,e,r){let n=fy(t,e,r),i=n2(t,e,r),o=r2(t,e,r);return{type:"Feature",geometry:n,properties:i,...o}}function r2(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0;return t.fields&&t.fields[t.featureIds.value[e]]}function n2(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2?arguments[2]:void 0,n=Object.assign({},t.properties[t.featureIds.value[e]]);for(let i in t.numericProps)n[i]=t.numericProps[i].value[e];return n}function dy(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:n}=t,i=t.polygonIndices.value.filter(c=>c>=e&&c<=r),o=t.primitivePolygonIndices.value.filter(c=>c>=e&&c<=r);if(!(i.length>2)){let c=[];for(let u=0;u<o.length-1;u++){let l=o[u],f=o[u+1],h=Ks(n,l,f);c.push(h)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let u=i[c],l=i[c+1],f=dy(t,u,l).coordinates;a.push(f)}return{type:"MultiPolygon",coordinates:a}}function i2(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:n}=t,i=t.pathIndices.value.filter(a=>a>=e&&a<=r);if(!(i.length>2))return{type:"LineString",coordinates:Ks(n,i[0],i[1])};let s=[];for(let a=0;a<i.length-1;a++){let c=Ks(n,i[a],i[a+1]);s.push(c)}return{type:"MultiLineString",coordinates:s}}function o2(t,e,r){let{positions:n}=t,i=Ks(n,e,r);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Ks(t,e,r){e=e||0,r=r||t.value.length/t.size;let n=[];for(let i=e;i<r;i++){let o=Array();for(let s=i*t.size;s<(i+1)*t.size;s++)o.push(Number(t.value[s]));n.push(o)}return n}var Ul=P(vy(),1);function xy(t){let e=t.length;if(e<=1)return[t];let r=[],n,i;for(let o=0;o<e;o++){let s=b2(t[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(n&&r.push(n),n=[t[o]]):n&&n.push(t[o]))}return n&&r.push(n),r}function b2(t){let e=0;for(let r=0,n=t.length-1,i,o;r<t.length;n=r++)i=t[r],o=t[n],e+=(o[0]-i[0])*(i[1]+o[1]);return e}function Ty(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?E2(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function E2(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}var Br=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(e,r,n,i,o){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,e.readFields(Ty,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,i=0,o=0,s=0,a=[],c;for(;e.pos<r;){if(i<=0){let u=e.readVarint();n=u&7,i=u>>3}if(i--,n===1||n===2)o+=e.readSVarint(),s+=e.readSVarint(),n===1&&(c&&a.push(c),c=[]),c&&c.push([o,s]);else if(n===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${n}`)}return c&&a.push(c),a}bbox(){let e=this._pbf;e.pos=this._geometry;let r=e.readVarint()+e.pos,n=1,i=0,o=0,s=0,a=1/0,c=-1/0,u=1/0,l=-1/0;for(;e.pos<r;){if(i<=0){let f=e.readVarint();n=f&7,i=f>>3}if(i--,n===1||n===2)o+=e.readSVarint(),s+=e.readSVarint(),o<a&&(a=o),o>c&&(c=o),s<u&&(u=s),s>l&&(l=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,u,c,l]}_toGeoJSON(e){let r=this.loadGeometry(),n=Br.types[this.type],i,o;switch(this.type){case 1:let a=[];for(i=0;i<r.length;i++)a[i]=r[i][0];r=a,e(r,this);break;case 2:for(i=0;i<r.length;i++)e(r[i],this);break;case 3:for(r=xy(r),i=0;i<r.length;i++)for(o=0;o<r[i].length;o++)e(r[i][o],this);break}r.length===1?r=r[0]:n=`Multi${n}`;let s={type:"Feature",geometry:{type:n,coordinates:r},properties:this.properties};return this.id!==null&&(s.id=this.id),s}toGeoJSON(e){if(typeof e=="function")return this._toGeoJSON(e);let{x:r,y:n,z:i}=e,o=this.extent*Math.pow(2,i),s=this.extent*r,a=this.extent*n;function c(u){for(let l=0;l<u.length;l++){let f=u[l];f[0]=(f[0]+s)*360/o-180;let h=180-(f[1]+a)*360/o;f[1]=360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90}}return this._toGeoJSON(c)}};var yi=class{constructor(e,r){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(S2,this,r),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let r=this._pbf.readVarint()+this._pbf.pos;return new Br(this._pbf,r,this.extent,this._keys,this._values)}};function S2(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(B2(r)))}function B2(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}var Ai=class{constructor(e,r){this.layers=void 0,this.layers=e.readFields(C2,{},r)}};function C2(t,e,r){if(t===3&&r){let n=new yi(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function by(t){let e=t.indices.length,r="Polygon";if(e<=1)return{type:r,data:t.data,areas:[[Er(t.data)]],indices:[t.indices]};let n=[],i=[],o=[],s=[],a,c=0;for(let u,l=0,f;l<e;l++){f=t.indices[l]-c,u=t.indices[l+1]-c||t.data.length;let h=t.data.slice(f,u),d=Er(h);if(d===0){let p=t.data.slice(0,f),g=t.data.slice(u);t.data=p.concat(g),c+=u-f;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(n.push(o),i.push(s)),s=[f],o=[d]):(o.push(d),s.push(f))}return o&&n.push(o),s.length&&i.push(s),{type:r,areas:n,indices:i,data:t.data}}function Ey(t,e,r,n){for(let i=0,o=t.length;i<o;i+=2){t[i]=(t[i]+e)*360/n-180;let s=180-(t[i+1]+r)*360/n;t[i+1]=360/Math.PI*Math.atan(Math.exp(s*Math.PI/180))-90}}function Sy(t,e,r){e&&r&&(t===1?e.id=r.readVarint():t===2?M2(r,e):t===3?e.type=r.readVarint():t===4&&(e._geometry=r.pos))}function M2(t,e){let r=t.readVarint()+t.pos;for(;t.pos<r;){let n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}var By,Cr,Pl,$s,Fl,Dl,_i;var vi=class{constructor(e,r,n,i,o,s){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this._geometryInfo=void 0,this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=e,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,e.readFields(Sy,this,r)}loadGeometry(){let e=this._pbf;e.pos=this._geometry,By=e.readVarint()+e.pos,Cr=1,$s=0,Fl=0,Dl=0,_i=0;let r=[],n=[];for(;e.pos<By;)if($s<=0&&(Pl=e.readVarint(),Cr=Pl&7,$s=Pl>>3),$s--,Cr===1||Cr===2)Fl+=e.readSVarint(),Dl+=e.readSVarint(),Cr===1&&r.push(_i),n.push(Fl,Dl),_i+=2;else if(Cr===7){if(_i>0){let i=r[r.length-1];n.push(n[i],n[i+1]),_i+=2}}else throw new Error(`unknown command ${Cr}`);return{data:n,indices:r}}_toBinaryCoordinates(e){let r=this.loadGeometry(),n;e(r.data,this);let i=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=r.indices.length,n={type:"Point",...r};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=r.indices.length,this._geometryInfo.linePositionsCount+=r.data.length/i,n={type:"LineString",...r};break;case 3:n=by(r),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let s of n.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=n.data.length/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}toBinaryCoordinates(e){if(typeof e=="function")return this._toBinaryCoordinates(e);let{x:r,y:n,z:i}=e,o=this.extent*Math.pow(2,i),s=this.extent*r,a=this.extent*n;return this._toBinaryCoordinates(c=>Ey(c,s,a,o))}};var xi=class{constructor(e,r){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(w2,this,r),this.length=this._features.length}feature(e,r){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];let n=this._pbf.readVarint()+this._pbf.pos;return new vi(this._pbf,n,this.extent,this._keys,this._values,r)}};function w2(t,e,r){e&&r&&(t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(I2(r)))}function I2(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}var Ti=class{constructor(e,r){this.layers=void 0,this.layers=e.readFields(O2,{},r)}};function O2(t,e,r){if(t===3&&r){let n=new xi(r,r.readVarint()+r.pos);n.length&&e&&(e[n.name]=n)}}function ea(t,e){var r,n;let i=L2(e),o=(e==null||(r=e.gis)===null||r===void 0?void 0:r.format)||(e==null||(n=e.mvt)===null||n===void 0?void 0:n.shape)||e?.shape;switch(o){case"columnar-table":return{shape:"columnar-table",data:Nl(t,i)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Cy(t,i)};case"geojson":return Cy(t,i);case"binary-geometry":return Nl(t,i);case"binary":return Nl(t,i);default:throw new Error(o||"undefined shape")}}function Nl(t,e){let[r,n]=R2(t,e),i=Il(r,n);return i.byteLength=t.byteLength,i}function R2(t,e){let r=[],n={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(t.byteLength<=0)return[r,n];let i=new Ti(new Ul.default(t));return(e&&Array.isArray(e.layers)?e.layers:Object.keys(i.layers)).forEach(s=>{let a=i.layers[s];if(a)for(let c=0;c<a.length;c++){let u=a.feature(c,n),l=F2(u,e,s);r.push(l)}}),[r,n]}function Cy(t,e){if(t.byteLength<=0)return[];let r=[],n=new Ai(new Ul.default(t));return(Array.isArray(e.layers)?e.layers:Object.keys(n.layers)).forEach(o=>{let s=n.layers[o];if(s)for(let a=0;a<s.length;a++){let c=s.feature(a),u=P2(c,e,o);r.push(u)}}),r}function L2(t){var e;if(!(t!=null&&t.mvt))throw new Error("mvt options required");let r=((e=t.mvt)===null||e===void 0?void 0:e.coordinates)==="wgs84",{tileIndex:n}=t.mvt,i=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(r&&!i)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return t.mvt}function P2(t,e,r){let n=t.toGeoJSON(e.coordinates==="wgs84"?e.tileIndex:D2);return e.layerProperty&&(n.properties[e.layerProperty]=r),n}function F2(t,e,r){let n=t.toBinaryCoordinates(e.coordinates==="wgs84"?e.tileIndex:N2);return e.layerProperty&&n.properties&&(n.properties[e.layerProperty]=r),n}function D2(t,e){let{extent:r}=e;for(let n=0;n<t.length;n++){let i=t[n];i[0]/=r,i[1]/=r}}function N2(t,e){let{extent:r}=e;for(let n=0,i=t.length;n<i;++n)t[n]/=r}var U2="4.1.0-alpha.9",ta={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:U2,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},G2={...ta,parse:async(t,e)=>ea(t,e),parseSync:ea,binary:!0};function My(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wy(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?My(Object(r),!0).forEach(function(n){H2(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):My(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function H2(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Iy(t,e){return k2(t)||j2(t,e)||z2(t,e)||V2()}function V2(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
765
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function z2(t,e){if(t){if(typeof t=="string")return Oy(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Oy(t,e)}}function Oy(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function j2(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function k2(t){if(Array.isArray(t))return t}var J2={Point:Ry,MultiPoint:q2,LineString:Ly,MultiLineString:W2,Polygon:Py,MultiPolygon:X2};function Ry(t,e,r){var n=Iy(t,2),i=n[0],o=n[1],s=Iy(e,2),a=s[0],c=s[1],u=Rt(a[0],c[0],i),l=Rt(a[1],c[1],o);return r.unprojectFlat([u,l])}function Gl(t,e,r){return t.map(function(n){return Ry(n,e,r)})}function q2(t,e,r){return Gl(t,e,r)}function Ly(t,e,r){return Gl(t,e,r)}function W2(t,e,r){return t.map(function(n){return Ly(n,e,r)})}function Py(t,e,r){return t.map(function(n){return Gl(n,e,r)})}function X2(t,e,r){return t.map(function(n){return Py(n,e,r)})}function Fy(t,e,r){var n=r.projectFlat([e.west,e.north]),i=r.projectFlat([e.east,e.south]),o=[n,i];return wy(wy({},t),{},{coordinates:J2[t.type](t.coordinates,o,r)})}function K2(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Y2(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
766
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Y2(t,e){if(t){if(typeof t=="string")return Dy(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dy(t,e)}}function Dy(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Z2=["points","lines","polygons"];function Hl(t,e,r,n){var i=K2(Z2),o;try{for(i.s();!(o=i.n()).done;){var s=o.value,a=t[s]&&Q2(t[s],e,r,n);if(a>=0)return a}}catch(c){i.e(c)}finally{i.f()}return-1}function Q2(t,e,r,n){var i=t.featureIds.value;if(!i.length)return-1;var o=0,s=i[i.length-1]+1;if(n){var a=$2(t,n);if(a)o=a[0],s=a[1]+1;else return-1}var c=-1;if(e in t.numericProps){var u=t.numericProps[e].value.findIndex(function(l,f){return l===r&&i[f]>=o&&i[f]<s});return u>=0?t.globalFeatureIds.value[u]:-1}else e?c=Ny(t.properties,function(l){return l[e]===r},o,s):t.fields&&(c=Ny(t.fields,function(l){return l.id===r},o,s));return c>=0?eO(t,c):-1}function $2(t,e){if(!t.__layers){for(var r={},n=t.properties,i=0;i<n.length;i++){var o=n[i],s=o.layerName;s&&(r[s]?r[s][1]=i:r[s]=[i,i])}t.__layers=r}return t.__layers[e]}function eO(t,e){if(!t.__ids){for(var r=[],n=t.featureIds.value,i=t.globalFeatureIds.value,o=0;o<n.length;o++)r[n[o]]=i[o];t.__ids=r}return t.__ids[e]}function Ny(t,e,r,n){for(var i=r;i<n;i++)if(e(t[i],i))return i;return-1}function ra(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ra=function(r){return typeof r}:ra=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ra(t)}function tO(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ky(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
767
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function rO(t){return oO(t)||iO(t)||ky(t)||nO()}function nO(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
768
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ky(t,e){if(t){if(typeof t=="string")return jl(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return jl(t,e)}}function iO(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function oO(t){if(Array.isArray(t))return jl(t)}function jl(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Uy(t,e,r,n,i,o,s){try{var a=t[o](s),c=a.value}catch(u){r(u);return}a.done?e(c):Promise.resolve(c).then(n,i)}function sO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function s(c){Uy(o,n,i,s,a,"next",c)}function a(c){Uy(o,n,i,s,a,"throw",c)}s(void 0)})}}function aO(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gy(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function cO(t,e,r){return e&&Gy(t.prototype,e),r&&Gy(t,r),t}function ht(t,e,r){return typeof Reflect<"u"&&Reflect.get?ht=Reflect.get:ht=function(i,o,s){var a=uO(i,o);if(a){var c=Object.getOwnPropertyDescriptor(a,o);return c.get?c.get.call(s):c.value}},ht(t,e,r||t)}function uO(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=He(t),t!==null););return t}function lO(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&kl(t,e)}function kl(t,e){return kl=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},kl(t,e)}function fO(t){var e=pO();return function(){var n=He(t),i;if(e){var o=He(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return hO(this,i)}}function hO(t,e){if(e&&(ra(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dO(t)}function dO(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pO(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function He(t){return He=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},He(t)}function Hy(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Kt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Hy(Object(r),!0).forEach(function(n){mO(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Hy(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function mO(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Vl=512,gO=Kt(Kt({},Jl.GeoJsonLayer.defaultProps),{},{data:Ut,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[ta],binary:!0}),ia=function(t){lO(r,t);var e=fO(r);function r(){var i;aO(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=e.call.apply(e,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){ht(He(r.prototype),"initializeState",this).call(this);var o=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:o,data:null,tileJSON:null})},n.updateState=function(o){var s,a=o.props,c=o.oldProps,u=o.context,l=o.changeFlags;l.dataChanged&&this._updateTileData(),(s=this.state)!==null&&s!==void 0&&s.data&&(ht(He(r.prototype),"updateState",this).call(this,{props:a,oldProps:c,context:u,changeFlags:l}),this._setWGS84PropertyForTiles());var f=a.highlightColor;f!==c.highlightColor&&Array.isArray(f)&&this.setState({highlightColor:f})},n._updateTileData=function(){var i=sO(regeneratorRuntime.mark(function s(){var a,c,u,l,f;return regeneratorRuntime.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(a=this.props.data,c=null,!(typeof a=="string"&&!Fc(a))){d.next=18;break}return u=this.props,l=u.onDataLoad,f=u.fetch,this.setState({data:null,tileJSON:null}),d.prev=5,d.next=8,f(a,{propName:"data",layer:this,loaders:[]});case 8:c=d.sent,d.next=15;break;case 11:d.prev=11,d.t0=d.catch(5),this.raiseError(d.t0,"loading TileJSON"),a=null;case 15:l&&l(c,{propName:"data",layer:this}),d.next=19;break;case 18:a.tilejson&&(c=a);case 19:c&&(a=c.tiles),this.setState({data:a,tileJSON:c});case 21:case"end":return d.stop()}},s,this,[[5,11]])}));function o(){return i.apply(this,arguments)}return o}(),n._getTilesetOptions=function(){var o=ht(He(r.prototype),"_getTilesetOptions",this).call(this),s=this.state.tileJSON,a=this.props,c=a.minZoom,u=a.maxZoom;return s&&(Number.isFinite(s.minzoom)&&s.minzoom>c&&(o.minZoom=s.minzoom),Number.isFinite(s.maxzoom)&&(!Number.isFinite(u)||s.maxzoom<u)&&(o.maxZoom=s.maxzoom)),o},n.renderLayers=function(){var o;return(o=this.state)!==null&&o!==void 0&&o.data?ht(He(r.prototype),"renderLayers",this).call(this):null},n.getTileData=function(o){var s,a=this.state,c=a.data,u=a.binary,l=o.index,f=o.signal,h=ot(c,o);if(!h)return Promise.reject("Invalid URL");var d=this.getLoadOptions(),p=this.props.fetch;return d=Kt(Kt({},d),{},{mimeType:"application/x-protobuf",mvt:Kt(Kt({},(s=d)===null||s===void 0?void 0:s.mvt),{},{coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:l}),gis:u?{format:"binary"}:{}}),p(h,{propName:"data",layer:this,loadOptions:d,signal:f})},n.renderSubLayers=function(o){var s=o.tile.index,a=s.x,c=s.y,u=s.z,l=Math.pow(2,u),f=Vl/l,h=-f,d=Vl*a/l,p=Vl*(1-c/l),g=new D().scale([f,h,1]);o.autoHighlight=!1,this.context.viewport.resolution||(o.modelMatrix=g,o.coordinateOrigin=[d,p,0],o.coordinateSystem=na.COORDINATE_SYSTEM.CARTESIAN,o.extensions=[].concat(rO(o.extensions||[]),[new Jy.ClipExtension]));var m=ht(He(r.prototype),"renderSubLayers",this).call(this,o);return this.state.binary&&!(m instanceof Jl.GeoJsonLayer)&&na.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),m},n._updateAutoHighlight=function(o){var s=this.props.uniqueIdProperty,a=this.state,c=a.hoveredFeatureId,u=a.hoveredFeatureLayerName,l=o.object,f,h;l&&(f=zl(l,s),h=Vy(l));var d=this.props.highlightColor;typeof d=="function"&&(d=d(o)),(c!==f||u!==h)&&this.setState({highlightColor:d,hoveredFeatureId:f,hoveredFeatureLayerName:h})},n.getPickingInfo=function(o){var s=ht(He(r.prototype),"getPickingInfo",this).call(this,o),a=Boolean(this.context.viewport.resolution);if(this.state.binary&&s.index!==-1){var c=o.sourceLayer.props.data;s.object=Ys(c,{globalFeatureId:s.index})}return s.object&&!a&&(s.object=jy(s.object,s.tile.bbox,this.context.viewport)),s},n.getSubLayerPropsByTile=function(o){return{highlightedObjectIndex:this.getHighlightedObjectIndex(o),highlightColor:this.state.highlightColor}},n.getHighlightedObjectIndex=function(o){var s=this.state,a=s.hoveredFeatureId,c=s.hoveredFeatureLayerName,u=s.binary,l=this.props,f=l.uniqueIdProperty,h=l.highlightedFeatureId,d=o.content,p=zy(h),g=zy(a)||p;if(!g)return-1;var m=p?h:a;return Array.isArray(d)?d.findIndex(function(A){var _=zl(A,f)===m,v=p||Vy(A)===c;return _&&v}):d&&u?Hl(d,f,m,p?"":c):-1},n._pickObjects=function(o){var s=this.context,a=s.deck,c=s.viewport,u=c.width,l=c.height,f=c.x,h=c.y,d=[this.id];return a.pickObjects({x:f,y:h,width:u,height:l,layerIds:d,maxObjects:o})},n.getRenderedFeatures=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,s=this._pickObjects(o),a=new Set,c=[],u=tO(s),l;try{for(u.s();!(l=u.n()).done;){var f=l.value,h=zl(f.object,this.props.uniqueIdProperty);h===void 0?c.push(f.object):a.has(h)||(a.add(h),c.push(f.object))}}catch(d){u.e(d)}finally{u.f()}return c},n._setWGS84PropertyForTiles=function(){var o=this,s="dataInWGS84",a=this.state.tileset;a.selectedTiles.forEach(function(c){c.hasOwnProperty(s)||Object.defineProperty(c,s,{get:function(){if(!c.content)return null;if(o.state.binary&&Array.isArray(c.content)&&!c.content.length)return[];var l=c.bbox;if(c._contentWGS84===void 0&&Dc(l)){var f=o.state.binary?Ys(c.content):c.content;c._contentWGS84=f.map(function(h){return jy(h,l,o.context.viewport)})}return c._contentWGS84}})})},cO(r,[{key:"isLoaded",get:function(){return Boolean(this.state&&this.state.data&&this.state.tileset&&ht(He(r.prototype),"isLoaded",this))}}]),r}(At);ia.layerName="MVTLayer";ia.defaultProps=gO;function zl(t,e){if(t.properties&&e)return t.properties[e];if("id"in t)return t.id}function Vy(t){var e;return((e=t.properties)===null||e===void 0?void 0:e.layerName)||null}function zy(t){return t!=null&&t!==""}function jy(t,e,r){var n=Kt(Kt({},t),{},{geometry:{type:t.geometry.type}});return Object.defineProperty(n.geometry,"coordinates",{get:function(){var o=Fy(t.geometry,e,r);return o.coordinates}}),n}function yO(t,e){return xO(t)||vO(t,e)||_O(t,e)||AO()}function AO(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
769
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _O(t,e){if(t){if(typeof t=="string")return qy(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qy(t,e)}}function qy(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function vO(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(t);!(i=(s=r.next()).done)&&(n.push(s.value),!(e&&n.length===e));i=!0);}catch(c){o=!0,a=c}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function xO(t){if(Array.isArray(t))return t}var Wy="0123456789bcdefghjkmnpqrstuvwxyz",Xy={};for(bi=0;bi<Wy.length;bi++)Xy[Wy.charAt(bi)]=bi;var bi,TO=-90,bO=90,EO=-180,SO=180;function BO(t){for(var e=!0,r=bO,n=TO,i=SO,o=EO,s,a=0,c=0,u=t.length;c<u;c++){var l=t[c].toLowerCase();a=Xy[l];for(var f=4;f>=0;f--){var h=a>>f&1;e?(s=(i+o)/2,h===1?o=s:i=s):(s=(r+n)/2,h===1?n=s:r=s),e=!e}}return[n,o,r,i]}function Ky(t){var e=BO(t),r=yO(e,4),n=r[0],i=r[1],o=r[2],s=r[3];return[s,o,s,n,i,n,i,o,s,o]}function oa(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?oa=function(r){return typeof r}:oa=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},oa(t)}function CO(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MO(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ql(t,e)}function ql(t,e){return ql=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ql(t,e)}function wO(t){var e=RO();return function(){var n=sa(t),i;if(e){var o=sa(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return IO(this,i)}}function IO(t,e){if(e&&(oa(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return OO(t)}function OO(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function RO(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function sa(t){return sa=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},sa(t)}var LO={getGeohash:{type:"accessor",value:function(e){return e.geohash}}},aa=function(t){MO(r,t);var e=wO(r);function r(){return CO(this,r),e.apply(this,arguments)}var n=r.prototype;return n.indexToBounds=function(){var o=this.props,s=o.data,a=o.getGeohash;return{data:s,_normalize:!1,positionFormat:"XY",getPolygon:function(u,l){return Ky(a(u,l))}}},r}(Le);aa.layerName="GeohashLayer";aa.defaultProps=LO;return nA(Ei);})();
448
+ `;function Wy(e){let t=e.positions||e.POSITION,n=t.value.length/t.size;e.COLOR_0||e.colors||(e.colors={size:4,value:new Uint8Array(n*4).fill(255),normalized:!0})}var Yy={pbrMaterial:{type:"object",value:null},featureIds:{type:"array",value:null,optional:!0}},Xs=class extends Vf.SimpleMeshLayer{getShaders(){let t=super.getShaders();return t.modules.push(Pa),{...t,vs:Df,fs:Uf}}initializeState(){let{featureIds:t}=this.props;super.initializeState();let n=this.getAttributeManager();t&&n.add({featureIdsPickingColors:{type:"uint8",size:3,noAlloc:!0,update:this.calculateFeatureIdsPickingColors}})}updateState(t){super.updateState(t);let{props:n,oldProps:r}=t;n.pbrMaterial!==r.pbrMaterial&&this.updatePbrMaterialUniforms(n.pbrMaterial)}draw(t){let{featureIds:n}=this.props;this.state.model&&(this.state.model.setUniforms({u_Camera:this.state.model.uniforms.project_uCameraPosition,pickFeatureIds:Boolean(n)}),super.draw(t))}getModel(t){let{id:n,pbrMaterial:r}=this.props,s=this.parseMaterial(r,t);this.setState({parsedPBRMaterial:s});let i=this.getShaders();return Wy(t.attributes),new Gf.Model(this.context.device,{...this.getShaders(),id:n,geometry:t,bufferLayout:this.getAttributeManager().getBufferLayouts(),defines:{...i.defines,...s?.defines,HAS_UV_REGIONS:t.attributes.uvRegions?1:0},parameters:s?.parameters,isInstanced:!0})}updatePbrMaterialUniforms(t){let{model:n}=this.state;if(n){let{mesh:r}=this.props,s=this.parseMaterial(t,r);this.setState({parsedPBRMaterial:s}),n.setBindings(s.bindings),n.setUniforms(s.uniforms)}}parseMaterial(t,n){let r=Boolean(t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture);return Fa(this.context.device,{unlit:r,...t},{NORMAL:n.attributes.normals,TEXCOORD_0:n.attributes.texCoords},{pbrDebug:!1,lights:!0,useTangents:!1})}calculateFeatureIdsPickingColors(t){let n=this.props.featureIds,r=new Uint8ClampedArray(n.length*t.size),s=[];for(let i=0;i<n.length;i++)this.encodePickingColor(n[i],s),r[i*3]=s[0],r[i*3+1]=s[1],r[i*3+2]=s[2];t.value=r}finalizeState(t){super.finalizeState(t),this.state.parsedPBRMaterial?.generatedTextures.forEach(n=>n.destroy()),this.setState({parsedPBRMaterial:null})}},Tr=Xs;(()=>{Xs.layerName="MeshLayer"})(),(()=>{Xs.defaultProps=Yy})();var fm=N(_n(),1);var ce=6356752314245179e-9,Ky={radii:[6378137,6378137,ce],radiiSquared:[6378137*6378137,6378137*6378137,ce*ce],oneOverRadii:[1/6378137,1/6378137,1/ce],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(ce*ce)],maximumRadius:Math.max(6378137,6378137,ce),centerToleranceSquared:.1};function Ws(e){return e}var aL=new x;function Qy(e,t=[],n=Ws){return"longitude"in e?(t[0]=n(e.longitude),t[1]=n(e.latitude),t[2]=e.height):"x"in e?(t[0]=n(e.x),t[1]=n(e.y),t[2]=e.z):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function zf(e,t=[]){return Qy(e,t,K._cartographicRadians?Ws:No)}function Zy(e,t,n=Ws){return"longitude"in t?(t.longitude=n(e[0]),t.latitude=n(e[1]),t.height=e[2]):"x"in t?(t.x=n(e[0]),t.y=n(e[1]),t.z=e[2]):(t[0]=n(e[0]),t[1]=n(e[1]),t[2]=e[2]),t}function kf(e,t){return Zy(e,t,K._cartographicRadians?Ws:Do)}var Jf=1e-14,$y=new x,qf={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Oa={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},_r={east:new x,north:new x,up:new x,west:new x,south:new x,down:new x},tT=new x,eT=new x,nT=new x;function Na(e,t,n,r,s,i){let o=qf[t]&&qf[t][n];ct(o&&(!r||r===o));let a,c,l,u=$y.copy(s);if(gt(u.x,0,Jf)&&gt(u.y,0,Jf)){let f=Math.sign(u.z);a=tT.fromArray(Oa[t]),t!=="east"&&t!=="west"&&a.scale(f),c=eT.fromArray(Oa[n]),n!=="east"&&n!=="west"&&c.scale(f),l=nT.fromArray(Oa[r]),r!=="east"&&r!=="west"&&l.scale(f)}else{let{up:f,east:d,north:p}=_r;d.set(-u.y,u.x,0).normalize(),e.geodeticSurfaceNormal(u,f),p.copy(f).cross(d);let{down:A,west:g,south:y}=_r;A.copy(f).scale(-1),g.copy(d).scale(-1),y.copy(p).scale(-1),a=_r[t],c=_r[n],l=_r[r]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=l.x,i[9]=l.y,i[10]=l.z,i[11]=0,i[12]=u.x,i[13]=u.y,i[14]=u.z,i[15]=1,i}var En=new x,rT=new x,sT=new x;function jf(e,t,n=[]){let{oneOverRadii:r,oneOverRadiiSquared:s,centerToleranceSquared:i}=t;En.from(e);let o=En.x,a=En.y,c=En.z,l=r.x,u=r.y,h=r.z,f=o*o*l*l,d=a*a*u*u,p=c*c*h*h,A=f+d+p,g=Math.sqrt(1/A);if(!Number.isFinite(g))return;let y=rT;if(y.copy(e).scale(g),A<i)return y.to(n);let E=s.x,_=s.y,B=s.z,b=sT;b.set(y.x*E*2,y.y*_*2,y.z*B*2);let S=(1-g)*En.len()/(.5*b.len()),w=0,C,T,m,M;do{S-=w,C=1/(1+S*E),T=1/(1+S*_),m=1/(1+S*B);let F=C*C,R=T*T,v=m*m,D=F*C,W=R*T,z=v*m;M=f*F+d*R+p*v-1;let X=-2*(f*D*E+d*W*_+p*z*B);w=M/X}while(Math.abs(M)>Ut.EPSILON12);return En.scale([C,T,m]).to(n)}var Ys=new x,Xf=new x,aT=new x,zt=new x,cT=new x,Ks=new x,U=class{constructor(t=0,n=0,r=0){L(this,"radii",void 0),L(this,"radiiSquared",void 0),L(this,"radiiToTheFourth",void 0),L(this,"oneOverRadii",void 0),L(this,"oneOverRadiiSquared",void 0),L(this,"minimumRadius",void 0),L(this,"maximumRadius",void 0),L(this,"centerToleranceSquared",Ut.EPSILON1),L(this,"squaredXOverSquaredZ",void 0),ct(t>=0),ct(n>=0),ct(r>=0),this.radii=new x(t,n,r),this.radiiSquared=new x(t*t,n*n,r*r),this.radiiToTheFourth=new x(t*t*t*t,n*n*n*n,r*r*r*r),this.oneOverRadii=new x(t===0?0:1/t,n===0?0:1/n,r===0?0:1/r),this.oneOverRadiiSquared=new x(t===0?0:1/(t*t),n===0?0:1/(n*n),r===0?0:1/(r*r)),this.minimumRadius=Math.min(t,n,r),this.maximumRadius=Math.max(t,n,r),this.radiiSquared.z!==0&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,n=[0,0,0]){let r=Xf,s=aT,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),s.copy(this.radiiSquared).scale(r);let o=Math.sqrt(r.dot(s));return s.scale(1/o),r.scale(i),s.add(r),s.to(n)}cartesianToCartographic(t,n=[0,0,0]){Ks.from(t);let r=this.scaleToGeodeticSurface(Ks,zt);if(!r)return;let s=this.geodeticSurfaceNormal(r,Xf),i=cT;i.copy(Ks).subtract(r);let o=Math.atan2(s.y,s.x),a=Math.asin(s.z),c=Math.sign(gn.dot(i,Ks))*gn.length(i);return kf([o,a,c],n)}eastNorthUpToFixedFrame(t,n=new P){return Na(this,"east","north","up",t,n)}localFrameToFixedFrame(t,n,r,s,i=new P){return Na(this,t,n,r,s,i)}geocentricSurfaceNormal(t,n=[0,0,0]){return Ys.from(t).normalize().to(n)}geodeticSurfaceNormalCartographic(t,n=[0,0,0]){let r=zf(t),s=r[0],i=r[1],o=Math.cos(i);return Ys.set(o*Math.cos(s),o*Math.sin(s),Math.sin(i)).normalize(),Ys.to(n)}geodeticSurfaceNormal(t,n=[0,0,0]){return Ys.from(t).scale(this.oneOverRadiiSquared).normalize().to(n)}scaleToGeodeticSurface(t,n){return jf(t,this,n)}scaleToGeocentricSurface(t,n=[0,0,0]){zt.from(t);let r=zt.x,s=zt.y,i=zt.z,o=this.oneOverRadiiSquared,a=1/Math.sqrt(r*r*o.x+s*s*o.y+i*i*o.z);return zt.multiplyScalar(a).to(n)}transformPositionToScaledSpace(t,n=[0,0,0]){return zt.from(t).scale(this.oneOverRadii).to(n)}transformPositionFromScaledSpace(t,n=[0,0,0]){return zt.from(t).scale(this.radii).to(n)}getSurfaceNormalIntersectionWithZAxis(t,n=0,r=[0,0,0]){ct(gt(this.radii.x,this.radii.y,Ut.EPSILON15)),ct(this.radii.z>0),zt.from(t);let s=zt.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(s)>=this.radii.z-n))return zt.set(0,0,s).to(r)}};L(U,"WGS84",new U(6378137,6378137,ce));var Qs=class{constructor(t,n,r){this.item=void 0,this.previous=void 0,this.next=void 0,this.item=t,this.previous=n,this.next=r}};var Zs=class{constructor(){this.head=null,this.tail=null,this._length=0}get length(){return this._length}add(t){let n=new Qs(t,this.tail,null);return this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n),++this._length,n}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,n){t!==n&&(this.remove(n),this._insert(t,n))}_insert(t,n){let r=t.next;t.next=n,this.tail===t?this.tail=n:r.previous=n,n.next=r,n.previous=t,++this._length}};var $s=class{constructor(){this._list=void 0,this._sentinel=void 0,this._trimTiles=void 0,this._list=new Zs,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let n=t._cacheNode;n&&this._list.splice(this._sentinel,n)}add(t,n,r){n._cacheNode||(n._cacheNode=this._list.add(n),r&&r(t,n))}unloadTile(t,n,r){let s=n._cacheNode;s&&(this._list.remove(s),n._cacheNode=null,r&&r(t,n))}unloadTiles(t,n){let r=this._trimTiles;this._trimTiles=!1;let s=this._list,i=t.maximumMemoryUsage*1024*1024,o=this._sentinel,a=s.head;for(;a!==o&&(t.gpuMemoryUsageInBytes>i||r);){let c=a.item;a=a.next,this.unloadTile(t,c,n)}}trim(){this._trimTiles=!0}};function Wf(e,t){V(e),V(t);let{rtcCenter:n,gltfUpAxis:r}=t,{computedTransform:s,boundingVolume:{center:i}}=e,o=new P(s);switch(n&&o.translate(n),r){case"Z":break;case"Y":let h=new P().rotateX(Math.PI/2);o=o.multiplyRight(h);break;case"X":let f=new P().rotateY(-Math.PI/2);o=o.multiplyRight(f);break;default:break}t.isQuantized&&o.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new x(i);t.cartesianModelMatrix=o,t.cartesianOrigin=a;let c=U.WGS84.cartesianToCartographic(a,new x),u=U.WGS84.eastNorthUpToFixedFrame(a).invert();t.cartographicModelMatrix=u.multiplyRight(o),t.cartographicOrigin=c,t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var Yf=new x,Da=new x,Ua=new ot([new lt,new lt,new lt,new lt,new lt,new lt]);function Qf(e,t){let{cameraDirection:n,cameraUp:r,height:s}=e,{metersPerUnit:i}=e.distanceScales,o=ti(e,e.center),a=U.WGS84.eastNorthUpToFixedFrame(o),c=e.unprojectPosition(e.cameraPosition),l=U.WGS84.cartographicToCartesian(c,new x),u=new x(a.transformAsVector(new x(n).scale(i))).normalize(),h=new x(a.transformAsVector(new x(r).scale(i))).normalize();lT(e);let f=e.constructor,{longitude:d,latitude:p,width:A,bearing:g,zoom:y}=e,E=new f({longitude:d,latitude:p,height:s,width:A,bearing:g,zoom:y,pitch:0});return{camera:{position:l,direction:u,up:h},viewport:e,topDownViewport:E,height:s,cullingVolume:Ua,frameNumber:t,sseDenominator:1.15}}function Zf(e,t,n){if(n===0||e.length<=n)return[e,[]];let r=[],{longitude:s,latitude:i}=t.viewport;for(let[l,u]of e.entries()){let[h,f]=u.header.mbs,d=Math.abs(s-h),p=Math.abs(i-f),A=Math.sqrt(p*p+d*d);r.push([l,A])}let o=r.sort((l,u)=>l[1]-u[1]),a=[];for(let l=0;l<n;l++)a.push(e[o[l][0]]);let c=[];for(let l=n;l<o.length;l++)c.push(e[o[l][0]]);return[a,c]}function lT(e){let t=e.getFrustumPlanes(),n=Kf(t.near,e.cameraPosition),r=ti(e,n),s=ti(e,e.cameraPosition,Da),i=0;Ua.planes[i++].fromPointNormal(r,Yf.copy(r).subtract(s));for(let o in t){if(o==="near")continue;let a=t[o],c=Kf(a,n,Da),l=ti(e,c,Da);Ua.planes[i++].fromPointNormal(l,Yf.copy(r).subtract(l))}}function Kf(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.normal.dot(t);return n.copy(e.normal).scale(e.distance-r).add(t),n}function ti(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new x,r=e.unprojectPosition(t);return U.WGS84.cartographicToCartesian(r,n)}var uT=6378137,hT=6378137,Ga=6356752314245179e-9,Bn=new x;function $f(e,t){if(e instanceof Vt){let{halfAxes:n}=e,r=fT(n);return Math.log2(Ga/(r+t[2]))}else if(e instanceof Ft){let{radius:n}=e;return Math.log2(Ga/(n+t[2]))}else if(e.width&&e.height){let{width:n,height:r}=e,s=Math.log2(uT/n),i=Math.log2(hT/r);return(s+i)/2}return 1}function Va(e,t,n){U.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Bn);let r=Math.sqrt(Math.pow(Bn[0]-n[0],2)+Math.pow(Bn[1]-n[1],2)+Math.pow(Bn[2]-n[2],2));return Math.log2(Ga/(r+t[2]))}function td(e,t,n){let[r,s,i,o]=e;return Va({xmin:r,xmax:i,ymin:s,ymax:o,zmin:0,zmax:0},t,n)}function fT(e){e.getColumn(0,Bn);let t=e.getColumn(1),n=e.getColumn(2);return Bn.add(t).add(n).len()}var Ad=N(_n(),1);var At={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Tt=function(e){return e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE",e}({}),te=function(e){return e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh",e}({}),ht=function(e){return e.I3S="I3S",e.TILES3D="TILES3D",e}({}),qe=function(e){return e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold",e}({}),ed={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};function id(e){return e!=null}var ft=new x,ei=new x,dT=new x,pT=new x,je=new x,nd=new x,rd=new x,sd=new x;function ni(e,t,n){if(V(e,"3D Tile: boundingVolume must be defined"),e.box)return ad(e.box,t,n);if(e.region)return gT(e.region);if(e.sphere)return mT(e.sphere,t,n);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function od(e,t){if(e.box)return AT(t);if(e.region){let[n,r,s,i,o,a]=e.region;return[[Mt(n),Mt(r),o],[Mt(s),Mt(i),a]]}if(e.sphere)return xT(t);throw new Error("Unkown boundingVolume type")}function ad(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=[];if(e.length===10){let l=e.slice(3,6),u=new Kt;u.fromArray(e,6);let h=new x([1,0,0]),f=new x([0,1,0]),d=new x([0,0,1]);h.transformByQuaternion(u),h.scale(l[0]),f.transformByQuaternion(u),f.scale(l[1]),d.transformByQuaternion(u),d.scale(l[2]),s=[...h.toArray(),...f.toArray(),...d.toArray()]}else s=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let i=t.transformAsVector(s.slice(0,3)),o=t.transformAsVector(s.slice(3,6)),a=t.transformAsVector(s.slice(6,9)),c=new k([i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2]]);return id(n)?(n.center=r,n.halfAxes=c,n):new Vt(r,c)}function mT(e,t,n){let r=new x(e[0],e[1],e[2]);t.transform(r,r);let s=t.getScale(ei),i=Math.max(Math.max(s[0],s[1]),s[2]),o=e[3]*i;return id(n)?(n.center=r,n.radius=o,n):new Ft(r,o)}function gT(e){let[t,n,r,s,i,o]=e,a=U.WGS84.cartographicToCartesian([Mt(t),Mt(s),i],dT),c=U.WGS84.cartographicToCartesian([Mt(r),Mt(n),o],pT),l=new x().addVectors(a,c).multiplyByScalar(.5);return U.WGS84.cartesianToCartographic(l,je),U.WGS84.cartographicToCartesian([Mt(r),je[1],je[2]],nd),U.WGS84.cartographicToCartesian([je[0],Mt(s),je[2]],rd),U.WGS84.cartographicToCartesian([je[0],je[1],o],sd),ad([...l,...nd.subtract(l),...rd.subtract(l),...sd.subtract(l)],new P)}function AT(e){let t=cd(),{halfAxes:n}=e,r=new x(n.getColumn(0)),s=new x(n.getColumn(1)),i=new x(n.getColumn(2));for(let o=0;o<2;o++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)ft.copy(e.center),ft.add(r),ft.add(s),ft.add(i),ld(t,ft),i.negate();s.negate()}r.negate()}return t}function xT(e){let t=cd(),{center:n,radius:r}=e,s=U.WGS84.scaleToGeodeticSurface(n,ft),i;s?i=U.WGS84.geodeticSurfaceNormal(s):i=new x(0,0,1);let o=new x(i[2],-i[1],0);o.len()>0?o.normalize():o=new x(0,1,0);let a=o.clone().cross(i);for(let c of[o,a,i]){ei.copy(c).scale(r);for(let l=0;l<2;l++)ft.copy(n),ft.add(ei),ld(t,ft),ei.negate()}return t}function cd(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function ld(e,t){U.WGS84.cartesianToCartographic(t,ft),e[0][0]=Math.min(e[0][0],ft[0]),e[0][1]=Math.min(e[0][1],ft[1]),e[0][2]=Math.min(e[0][2],ft[2]),e[1][0]=Math.max(e[1][0],ft[0]),e[1][1]=Math.max(e[1][1],ft[1]),e[1][2]=Math.max(e[1][2],ft[2])}var YL=new x,KL=new x,QL=new P,ZL=new x,$L=new x,t3=new x;function yT(e,t){let n=e*t;return 1-Math.exp(-(n*n))}function TT(e,t){if(e.dynamicScreenSpaceError&&e.dynamicScreenSpaceErrorComputedDensity){let n=e.dynamicScreenSpaceErrorComputedDensity,r=e.dynamicScreenSpaceErrorFactor;return yT(t,n)*r}return 0}function ud(e,t,n){let r=e.tileset,s=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,i=n?s:e.lodMetricValue;if(i===0)return 0;let o=Math.max(e._distanceToCamera,1e-7),{height:a,sseDenominator:c}=t,{viewDistanceScale:l}=r.options,u=i*a*(l||1)/(o*c);return u-=TT(r,o),u}var Ha=new x,hd=new x,Me=new x,fd=new x,_T=new x,za=new P,dd=new P;function pd(e,t){if(e.lodMetricValue===0||isNaN(e.lodMetricValue))return"DIG";let n=2*ka(e,t);return n<2?"OUT":!e.header.children||n<=e.lodMetricValue?"DRAW":e.header.children?"DIG":"OUT"}function ka(e,t){let{topDownViewport:n}=t,r=e.header.mbs[1],s=e.header.mbs[0],i=e.header.mbs[2],o=e.header.mbs[3],a=[...e.boundingVolume.center],c=n.unprojectPosition(n.cameraPosition);U.WGS84.cartographicToCartesian(c,Ha),hd.copy(Ha).subtract(a).normalize(),U.WGS84.eastNorthUpToFixedFrame(a,za),dd.copy(za).invert(),Me.copy(Ha).transform(dd);let l=Math.sqrt(Me[0]*Me[0]+Me[1]*Me[1]),u=l*l/Me[2];fd.copy([Me[0],Me[1],u]);let f=fd.transform(za).subtract(a).normalize(),p=hd.cross(f).normalize().scale(o).add(a),A=U.WGS84.cartesianToCartographic(p),g=n.project([s,r,i]),y=n.project(A);return _T.copy(g).subtract(y).magnitude()}function md(e){return{assetGltfUpAxis:e.asset&&e.asset.gltfUpAxis||"Y"}}var Er=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;this._map=new Map,this._array=void 0,this._length=void 0,this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return V(t<this._array.length),this._array[t]}set(t,n){V(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=n,this._map.set(n,t)}delete(t){let n=this._map.get(t);n>=0&&(this._array.splice(n,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let n=this.length++;this._array[n]=t,this._map.set(t,n)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){V(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){V(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var ET={loadSiblings:!1,skipLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},ee=class{traversalFinished(t){return!0}constructor(t){this.options=void 0,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={},this.lastUpdate=new Date().getTime(),this.updateDebounceTime=1e3,this._traversalStack=new Er,this._emptyTraversalStack=new Er,this._frameNumber=null,this.options={...ET,...t}}traverse(t,n,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,n),this._frameNumber=n.frameNumber,this.executeTraversal(t,n)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,n){let r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){let i=r.pop(),o=!1;this.canTraverse(i,n)&&(this.updateChildTiles(i,n),o=this.updateAndPushChildren(i,n,r,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let a=i.parent,c=Boolean(!a||a._shouldRefine),l=!o;i.hasRenderContent?i.refine===Tt.ADD?(this.loadTile(i,n),this.selectTile(i,n)):i.refine===Tt.REPLACE&&(this.loadTile(i,n),l&&this.selectTile(i,n)):(this.emptyTiles[i.id]=i,this.loadTile(i,n),l&&this.selectTile(i,n)),this.touchTile(i,n),i._shouldRefine=o&&c}let s=new Date().getTime();(this.traversalFinished(n)||s-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=s,this.options.onTraversalEnd(n))}updateChildTiles(t,n){let r=t.children;for(let s of r)this.updateTile(s,n)}updateAndPushChildren(t,n,r,s){let{loadSiblings:i,skipLevelOfDetail:o}=this.options,a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===Tt.REPLACE&&t.hasRenderContent&&!o,l=!1,u=!0;for(let h of a)if(h._selectionDepth=s,h.isVisibleAndInRequestVolume?(r.find(h)&&r.delete(h),r.push(h),l=!0):(c||i)&&(this.loadTile(h,n),this.touchTile(h,n)),c){let f;if(h._inRequestVolume?h.hasRenderContent?f=h.contentAvailable:f=this.executeEmptyTraversal(h,n):f=!1,u=u&&f,!u)return!1}return l||(u=!1),u}updateTile(t,n){this.updateTileVisibility(t,n)}selectTile(t,n){this.shouldSelectTile(t)&&(t._selectedFrame=n.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,n){this.shouldLoadTile(t)&&(t._requestedFrame=n.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,n){t.tileset._cache.touch(t),t._touchedFrame=n.frameNumber}canTraverse(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return t.hasChildren?t.hasTilesetContent?!t.contentExpired:!s&&!t.isVisibleAndInRequestVolume?!1:this.shouldRefine(t,n,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=t._screenSpaceError;return r&&(s=t.getScreenSpaceError(n,!0)),s>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,n){let r=[];if(this.options.viewportTraversersMap)for(let s in this.options.viewportTraversersMap)this.options.viewportTraversersMap[s]===n.viewport.id&&r.push(s);else r.push(n.viewport.id);t.updateVisibility(n,r)}compareDistanceToCamera(t,n){return t._distanceToCamera-n._distanceToCamera}anyChildrenVisible(t,n){let r=!1;for(let s of t.children)s.updateVisibility(n),r=r||s.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,n){let r=!0,s=this._emptyTraversalStack;for(s.push(t);s.length>0;){let i=s.pop(),o=!i.hasRenderContent&&this.canTraverse(i,n,!1,!1),a=!i.hasRenderContent&&i.children.length===0;if(!o&&!i.contentAvailable&&!a&&(r=!1),this.updateTile(i,n),i.isVisibleAndInRequestVolume||(this.loadTile(i,n),this.touchTile(i,n)),o){let c=i.children;for(let l of c)s.push(l)}}return r}};var gd=new x;function BT(e){return e!=null}var Xe=class{constructor(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"";this.tileset=void 0,this.header=void 0,this.id=void 0,this.url=void 0,this.parent=void 0,this.refine=void 0,this.type=void 0,this.contentUrl=void 0,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=At.UNLOADED,this.gpuMemoryUsageInBytes=0,this.children=[],this.depth=0,this.viewportIds=[],this.transform=new P,this.extensions=null,this.implicitTiling=null,this.userData={},this.computedTransform=void 0,this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.traverser=new ee({}),this._cacheNode=null,this._frameNumber=null,this._expireDate=null,this._expiredContent=null,this._boundingBox=void 0,this._distanceToCamera=0,this._screenSpaceError=0,this._visibilityPlaneMask=void 0,this._visible=void 0,this._contentBoundingVolume=void 0,this._viewerRequestVolume=void 0,this._initialTransform=new P,this._priority=0,this._selectedFrame=0,this._requestedFrame=0,this._selectionDepth=0,this._touchedFrame=0,this._centerZDepth=0,this._shouldRefine=!1,this._stackLength=0,this._visitedFrame=0,this._inRequestVolume=!1,this._lodJudge=null,this.header=n,this.tileset=t,this.id=s||n.id,this.url=n.url,this.parent=r,this.refine=this._getRefine(n.refine),this.type=n.type,this.contentUrl=n.contentUrl,this._initializeLodMetric(n),this._initializeTransforms(n),this._initializeBoundingVolumes(n),this._initializeContent(n),this._initializeRenderingState(n),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===At.READY||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===At.UNLOADED}get contentExpired(){return this.contentState===At.EXPIRED}get contentFailed(){return this.contentState===At.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=od(this.header.boundingVolume,this.boundingVolume)),this._boundingBox}getScreenSpaceError(t,n){switch(this.tileset.type){case ht.I3S:return ka(this,t);case ht.TILES3D:return ud(this,t,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return this.content.gpuMemoryUsageInBytes||this.content.byteLength||0}_getPriority(){let t=this.tileset._traverser,{skipLevelOfDetail:n}=t.options,r=this.refine===Tt.ADD||n;if(r&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.contentState===At.UNLOADED)return-1;let s=this.parent,o=s&&(!r||this._screenSpaceError===0||s.hasTilesetContent)?s._screenSpaceError:this._screenSpaceError,a=t.root?t.root._screenSpaceError:0;return Math.max(a-o,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=At.LOADING;let n=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!n)return this.contentState=At.UNLOADED,!1;try{let r=this.tileset.getTileUrl(this.contentUrl),s=this.tileset.loader,i={...this.tileset.loadOptions,[s.id]:{...this.tileset.loadOptions[s.id],isTileset:this.type==="json",...this._getLoaderSpecificOptions(s.id)}};return this.content=await(0,Ad.load)(r,s,i),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=At.READY,this._onContentLoaded(),!0}catch(r){throw this.contentState=At.FAILED,r}finally{n.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=At.UNLOADED,!0}updateVisibility(t,n){if(this._frameNumber===t.frameNumber)return;let r=this.parent,s=r?r._visibilityPlaneMask:ot.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let i=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(i)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,s),this._visible=this._visibilityPlaneMask!==ot.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=n}visibility(t,n){let{cullingVolume:r}=t,{boundingVolume:s}=this;return r.computeVisibilityWithPlaneMask(s,n)}contentVisibility(){return!0}distanceToTile(t){let n=this.boundingVolume;return Math.sqrt(Math.max(n.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth(t){let{camera:n}=t,r=this.boundingVolume;return gd.subVectors(r.center,n.position),n.direction.dot(gd)}insideViewerRequestVolume(t){let n=this._viewerRequestVolume;return!n||n.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(BT(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=At.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new P(t.transform):new P;let n=this.parent,r=this.tileset,s=n&&n.computedTransform?n.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new P(s).multiplyRight(this.transform);let i=n&&n._initialTransform?n._initialTransform.clone():new P;this._initialTransform=new P(i).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=At.UNLOADED,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=ot.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||Tt.REPLACE}_isTileset(){return this.contentUrl.indexOf(".json")!==-1}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this.boundingVolume=ni(t.boundingVolume,this.computedTransform,this.boundingVolume);let n=t.content;n&&(n.boundingVolume&&(this._contentBoundingVolume=ni(n.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=ni(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(){let n=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:new P).clone().multiplyRight(this.transform);n.equals(this.computedTransform)||(this.computedTransform=n,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){switch(t){case"i3s":return{...this.tileset.options.i3s,_tileOptions:{attributeUrls:this.header.attributeUrls,textureUrl:this.header.textureUrl,textureFormat:this.header.textureFormat,textureLoaderOptions:this.header.textureLoaderOptions,materialDefinition:this.header.materialDefinition,isDracoGeometry:this.header.isDracoGeometry,mbs:this.header.mbs},_tilesetOptions:{store:this.tileset.tileset.store,attributeStorageInfo:this.tileset.tileset.attributeStorageInfo,fields:this.tileset.tileset.fields},isTileHeader:!1};case"3d-tiles":case"cesium-ion":default:return md(this.tileset.tileset)}}};var ri=class extends ee{compareDistanceToCamera(t,n){return n._distanceToCamera===0&&t._distanceToCamera===0?n._centerZDepth-t._centerZDepth:n._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,n){if(super.updateTileVisibility(t,n),!t.isVisibleAndInRequestVolume)return;let r=t.children.length>0;if(t.hasTilesetContent&&r){let o=t.children[0];this.updateTileVisibility(o,n),t._visible=o._visible;return}if(this.meetsScreenSpaceErrorEarly(t,n)){t._visible=!1;return}let s=t.refine===Tt.REPLACE,i=t._optimChildrenWithinParent===ed.USE_OPTIMIZATION;if(s&&i&&r&&!this.anyChildrenVisible(t,n)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,n){let{parent:r}=t;return!r||r.hasTilesetContent||r.refine!==Tt.ADD?!1:!this.shouldRefine(t,n,!0)}};var xd=N(_n(),1);var si=class{constructor(){this.frameNumberMap=new Map}register(t,n){let r=this.frameNumberMap.get(t)||new Map,s=r.get(n)||0;r.set(n,s+1),this.frameNumberMap.set(t,r)}deregister(t,n){let r=this.frameNumberMap.get(t);if(!r)return;let s=r.get(n)||1;r.set(n,s-1)}isZero(t,n){var r;return(((r=this.frameNumberMap.get(t))===null||r===void 0?void 0:r.get(n))||0)===0}};var Ja={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},ii=class{constructor(){this._statusMap=void 0,this.pendingTilesRegister=new si,this._statusMap={}}add(t,n,r,s){if(!this._statusMap[n]){let{frameNumber:i,viewport:{id:o}}=s;this._statusMap[n]={request:t,callback:r,key:n,frameState:s,status:Ja.REQUESTED},this.pendingTilesRegister.register(o,i),t().then(a=>{this._statusMap[n].status=Ja.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[n].callback(a,s)}).catch(a=>{this._statusMap[n].status=Ja.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[n].frameState;this.pendingTilesRegister.deregister(l,c),r(a)})}}update(t,n){if(this._statusMap[t]){let{frameNumber:r,viewport:{id:s}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(s,r);let{frameNumber:i,viewport:{id:o}}=n;this.pendingTilesRegister.register(o,i),this._statusMap[t].frameState=n}}find(t){return this._statusMap[t]}hasPendingTiles(t,n){return!this.pendingTilesRegister.isZero(t,n)}};var oi=class extends ee{constructor(t){super(t),this._tileManager=void 0,this._tileManager=new ii}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,n){return t._lodJudge=pd(t,n),t._lodJudge==="DIG"}updateChildTiles(t,n){let r=t.header.children||[],s=t.children,i=t.tileset;for(let o of r){let a=`${o.id}-${n.viewport.id}`,c=s&&s.find(l=>l.id===a);if(c)c&&this.updateTile(c,n);else{let l=()=>this._loadTile(o.id,i);this._tileManager.find(a)?this._tileManager.update(a,n):(i.tileset.nodePages&&(l=()=>i.tileset.nodePagesTile.formTileFromNodePages(o.id)),this._tileManager.add(l,a,h=>this._onTileLoad(h,t,a),n))}}return!1}async _loadTile(t,n){let{loader:r}=n,s=n.getTileUrl(`${n.url}/nodes/${t}`),i={...n.loadOptions,i3s:{...n.loadOptions.i3s,isTileHeader:!0}};return await(0,xd.load)(s,r,i)}_onTileLoad(t,n,r){let s=new Xe(n.tileset,t,n,r);n.children.push(s);let i=this._tileManager.find(s.id).frameState;this.updateTile(s,i),this._frameNumber===i.frameNumber&&(this.traversalFinished(i)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(s,i)}};var CT={description:"",ellipsoid:U.WGS84,modelMatrix:new P,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,memoryCacheOverflow:1,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,memoryAdjustedScreenSpaceError:!1,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}},ai="Tiles In Tileset(s)",qa="Tiles In Memory",yd="Tiles In View",Td="Tiles To Render",_d="Tiles Loaded",ja="Tiles Loading",Ed="Tiles Unloaded",Bd="Failed Tile Loads",Cd="Points/Vertices",Xa="Tile Memory Use",bd="Maximum Screen Space Error",Br=class{constructor(t,n){this.options=void 0,this.loadOptions=void 0,this.type=void 0,this.tileset=void 0,this.loader=void 0,this.url=void 0,this.basePath=void 0,this.modelMatrix=void 0,this.ellipsoid=void 0,this.lodMetricType=void 0,this.lodMetricValue=void 0,this.refine=void 0,this.root=null,this.roots={},this.asset={},this.description="",this.properties=void 0,this.extras=null,this.attributions={},this.credits={},this.stats=void 0,this.contentFormats={draco:!1,meshopt:!1,dds:!1,ktx2:!1},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.dynamicScreenSpaceErrorComputedDensity=0,this.maximumMemoryUsage=32,this.gpuMemoryUsageInBytes=0,this.memoryAdjustedScreenSpaceError=0,this._cacheBytes=0,this._cacheOverflowBytes=0,this._frameNumber=0,this._queryParams={},this._extensionsUsed=[],this._tiles={},this._pendingCount=0,this.selectedTiles=[],this.traverseCounter=0,this.geometricError=0,this.lastUpdatedVieports=null,this._requestedTiles=[],this._emptyTiles=[],this.frameStateData={},this._traverser=void 0,this._cache=new $s,this._requestScheduler=void 0,this.updatePromise=null,this.tilesetInitializationPromise=void 0,this.options={...CT,...n},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||Ae.dirname(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this._traverser=this._initializeTraverser(),this._requestScheduler=new ge({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=this.options.maximumMemoryUsage*1024*1024,this._cacheOverflowBytes=this.options.memoryCacheOverflow*1024*1024,this.stats=new me({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return new URLSearchParams(this._queryParams).toString()}setProps(t){this.options={...this.options,...t}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=t;return this.queryParams.length&&(r=`${t}${t.includes("?")?"&":"?"}${this.queryParams}`),r}hasExtension(t){return Boolean(this._extensionsUsed.indexOf(t)>-1)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(n=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),n(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this._cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this._cacheBytes+this._cacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let n=t instanceof Array?t:[t];this._cache.reset(),this._frameNumber++,this.traverseCounter=n.length;let r=[];for(let s of n){let i=s.id;this._needTraverse(i)?r.push(i):this.traverseCounter--}for(let s of n){let i=s.id;if(this.roots[i]||(this.roots[i]=this._initializeTileHeaders(this.tileset,null)),!r.includes(i))continue;let o=Qf(s,this._frameNumber);this._traverser.traverse(this.roots[i],o,this.options)}}_needTraverse(t){let n=t;return this.options.viewportTraversersMap&&(n=this.options.viewportTraversersMap[t]),n===t}_onTraversalEnd(t){let n=t.viewport.id;this.frameStateData[n]||(this.frameStateData[n]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let r=this.frameStateData[n],s=Object.values(this._traverser.selectedTiles),[i,o]=Zf(s,t,this.options.maximumTilesSelected);r.selectedTiles=i;for(let a of o)a.unselect();r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let t in this.frameStateData){let n=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(n.selectedTiles),this._requestedTiles=this._requestedTiles.concat(n._requestedTiles),this._emptyTiles=this._emptyTiles.concat(n._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(let t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,n){if(t.length!==n.length)return!0;let r=new Set(t.map(o=>o.id)),s=new Set(n.map(o=>o.id)),i=t.filter(o=>!s.has(o.id)).length>0;return i=i||n.filter(o=>!r.has(o.id)).length>0,i}_loadTiles(){for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,n)=>t._unloadTile(n))}_updateStats(){let t=0,n=0;for(let r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount?n+=r.content.pointCount:n+=r.content.vertexCount);this.stats.get(yd).count=this.selectedTiles.length,this.stats.get(Td).count=t,this.stats.get(Cd).count=n,this.stats.get(bd).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(t){this.type===ht.I3S&&(this.calculateViewPropsI3S(),t.root=await t.root),this.root=this._initializeTileHeaders(t,null),this.type===ht.TILES3D&&(this._initializeTiles3DTileset(t),this.calculateViewPropsTiles3D()),this.type===ht.I3S&&this._initializeI3STileset()}calculateViewPropsI3S(){var t;let n=this.tileset.fullExtent;if(n){let{xmin:s,xmax:i,ymin:o,ymax:a,zmin:c,zmax:l}=n;this.cartographicCenter=new x(s+(i-s)/2,o+(a-o)/2,c+(l-c)/2),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=Va(n,this.cartographicCenter,this.cartesianCenter);return}let r=(t=this.tileset.store)===null||t===void 0?void 0:t.extent;if(r){let[s,i,o,a]=r;this.cartographicCenter=new x(s+(o-s)/2,i+(a-i)/2,0),this.cartesianCenter=new x,U.WGS84.cartographicToCartesian(this.cartographicCenter,this.cartesianCenter),this.zoom=td(r,this.cartographicCenter,this.cartesianCenter);return}console.warn("Extent is not defined in the tileset header"),this.cartographicCenter=new x,this.zoom=1}calculateViewPropsTiles3D(){let t=this.root,{center:n}=t.boundingVolume;if(!n){console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new x,this.zoom=1;return}n[0]!==0||n[1]!==0||n[2]!==0?(this.cartographicCenter=new x,U.WGS84.cartesianToCartographic(n,this.cartographicCenter)):this.cartographicCenter=new x(0,0,-U.WGS84.radii[0]),this.cartesianCenter=n,this.zoom=$f(t.boundingVolume,this.cartographicCenter)}_initializeStats(){this.stats.get(ai),this.stats.get(ja),this.stats.get(qa),this.stats.get(yd),this.stats.get(Td),this.stats.get(_d),this.stats.get(Ed),this.stats.get(Bd),this.stats.get(Cd),this.stats.get(Xa,"memory"),this.stats.get(bd)}_initializeTileHeaders(t,n){let r=new Xe(this,t.root,n);if(n&&(n.children.push(r),r.depth=n.depth+1),this.type===ht.TILES3D){let i=[];for(i.push(r);i.length>0;){let o=i.pop();this.stats.get(ai).incrementCount();let a=o.header.children||[];for(let c of a){var s;let l=new Xe(this,c,o);if((s=l.contentUrl)!==null&&s!==void 0&&s.includes("?session=")){let h=new URL(l.contentUrl).searchParams.get("session");h&&(this._queryParams.session=h)}o.children.push(l),l.depth=o.depth+1,i.push(l)}}}return r}_initializeTraverser(){let t;switch(this.type){case ht.TILES3D:t=ri;break;case ht.I3S:t=oi;break;default:t=ee}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let n;try{this._onStartTileLoading(),n=await t.loadContent()}catch(r){this._onTileLoadError(t,r instanceof Error?r:new Error("load failed"))}finally{this._onEndTileLoading(),this._onTileLoad(t,n)}}_onTileLoadError(t,n){this.stats.get(Bd).incrementCount();let r=n.message||n.toString(),s=t.url;console.error(`A 3D tile failed to load: ${t.url} ${r}`),this.options.onTileError(t,r,s)}_onTileLoad(t,n){if(n){if(this.type===ht.I3S){var r,s;let i=((r=this.tileset)===null||r===void 0||(s=r.nodePagesTile)===null||s===void 0?void 0:s.nodesInNodePages)||0;this.stats.get(ai).reset(),this.stats.get(ai).addCount(i)}t&&t.content&&Wf(t,t.content),this.updateContentTypes(t),this._addTileToCache(t),this.options.onTileLoad(t)}}updateContentTypes(t){if(this.type===ht.I3S)switch(t.header.isDracoGeometry&&(this.contentFormats.draco=!0),t.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}else if(this.type===ht.TILES3D){var n;let{extensionsRemoved:r=[]}=((n=t.content)===null||n===void 0?void 0:n.gltf)||{};r.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),r.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),r.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0)}}_onStartTileLoading(){this._pendingCount++,this.stats.get(ja).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(ja).decrementCount()}_addTileToCache(t){this._cache.add(this,t,n=>n._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(_d).incrementCount(),this.stats.get(qa).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(Xa).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(qa).decrementCount(),this.stats.get(Ed).incrementCount(),this.stats.get(Xa).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let n=t.pop();for(let r of n.children)t.push(r);this._destroyTile(n)}this.root=null}_destroySubtree(t){let n=t,r=[];for(r.push(n);r.length>0;){t=r.pop();for(let s of t.children)r.push(s);t!==n&&this._destroyTile(t)}n.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeTiles3DTileset(t){if(t.queryString){let n=new URLSearchParams(t.queryString),r=Object.fromEntries(n.entries());this._queryParams={...this._queryParams,...r}}if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed||[],this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}};var ci="4.1.4";var We={COMPOSITE:"cmpt",POINT_CLOUD:"pnts",BATCHED_3D_MODEL:"b3dm",INSTANCED_3D_MODEL:"i3dm",GEOMETRY:"geom",VECTOR:"vect",GLTF:"glTF"},Y3=Object.keys(We);function Wa(e,t,n){V(e instanceof ArrayBuffer);let r=new TextDecoder("utf8"),s=new Uint8Array(e,t,n);return r.decode(s)}function Sd(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=new DataView(e);return`${String.fromCharCode(n.getUint8(t+0))}${String.fromCharCode(n.getUint8(t+1))}${String.fromCharCode(n.getUint8(t+2))}${String.fromCharCode(n.getUint8(t+3))}`}var Md="4.1.4";var Id={name:"Draco",id:"draco",module:"draco",version:Md,worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:typeof WebAssembly=="object"?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};function wd(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Ye(e){let t=1/0,n=1/0,r=1/0,s=-1/0,i=-1/0,o=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let u=a[l],h=a[l+1],f=a[l+2];t=u<t?u:t,n=h<n?h:n,r=f<r?f:r,s=u>s?u:s,i=h>i?h:i,o=f>o?f:o}return[[t,n,r],[s,i,o]]}function Ya(e,t,n){let r=wd(t.value),s=n||vd(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:r}]},nullable:!1,metadata:s}}function vd(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}function Rd(e,t,n){let r=Ld(t.metadata),s=[],i=bT(t.attributes);for(let o in e){let a=e[o],c=Fd(o,a,i[o]);s.push(c)}if(n){let o=Fd("indices",n);s.push(o)}return{fields:s,metadata:r}}function bT(e){let t={};for(let n in e){let r=e[n];t[r.name||"undefined"]=r}return t}function Fd(e,t,n){let r=n?Ld(n.metadata):void 0;return Ya(e,t,r)}function Ld(e){Object.entries(e);let t={};for(let n in e)t[`${n}.string`]=JSON.stringify(e[n]);return t}var Pd={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},ST={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},MT=4,Cr=class{constructor(t){this.draco=void 0,this.decoder=void 0,this.metadataQuerier=void 0,this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(n);let s=this.decoder.GetEncodedGeometryType(r),i=s===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let o;switch(s){case this.draco.TRIANGULAR_MESH:o=this.decoder.DecodeBufferToMesh(r,i);break;case this.draco.POINT_CLOUD:o=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!o.ok()||!i.ptr){let f=`DRACO decompression failed: ${o.error_msg()}`;throw new Error(f)}let a=this._getDracoLoaderData(i,s,n),c=this._getMeshData(i,a,n),l=Ye(c.attributes),u=Rd(c.attributes,a,c.indices);return{loader:"draco",loaderData:a,header:{vertexCount:i.num_points(),boundingBox:l},...c,schema:u}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,n,r){let s=this._getTopLevelMetadata(t),i=this._getDracoAttributes(t,r);return{geometry_type:n,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:s,attributes:i}}_getDracoAttributes(t,n){let r={};for(let s=0;s<t.num_attributes();s++){let i=this.decoder.GetAttribute(t,s),o=this._getAttributeMetadata(t,s);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:s,metadata:o};let a=this._getQuantizationTransform(i,n);a&&(r[i.unique_id()].quantization_transform=a);let c=this._getOctahedronTransform(i,n);c&&(r[i.unique_id()].octahedron_transform=c)}return r}_getMeshData(t,n,r){let s=this._getMeshAttributes(n,t,r);if(!s.POSITION)throw new Error("DRACO: No position attribute found.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:s,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:s,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:s}}_getMeshAttributes(t,n,r){let s={};for(let i of Object.values(t.attributes)){let o=this._deduceAttributeName(i,r);i.name=o;let{value:a,size:c}=this._getAttributeValues(n,i);s[o]={value:a,size:c,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.normalized}}return s}_getTriangleListIndices(t){let r=t.num_faces()*3,s=r*MT,i=this.draco._malloc(s);try{return this.decoder.GetTrianglesUInt32Array(t,s,i),new Uint32Array(this.draco.HEAPF32.buffer,i,r).slice()}finally{this.draco._free(i)}}_getTriangleStripIndices(t){let n=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,n),vT(n)}finally{this.draco.destroy(n)}}_getAttributeValues(t,n){let r=ST[n.data_type],s=n.num_components,o=t.num_points()*s,a=o*r.BYTES_PER_ELEMENT,c=IT(this.draco,r),l,u=this.draco._malloc(a);try{let h=this.decoder.GetAttribute(t,n.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,h,c,a,u),l=new r(this.draco.HEAPF32.buffer,u,o).slice()}finally{this.draco._free(u)}return{value:l,size:s}}_deduceAttributeName(t,n){let r=t.unique_id;for(let[o,a]of Object.entries(n.extraAttributes||{}))if(a===r)return o;let s=t.attribute_type;for(let o in Pd)if(this.draco[o]===s)return Pd[o];let i=n.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:`CUSTOM_ATTRIBUTE_${r}`}_getTopLevelMetadata(t){let n=this.decoder.GetMetadata(t);return this._getDracoMetadata(n)}_getAttributeMetadata(t,n){let r=this.decoder.GetAttributeMetadata(t,n);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};let n={},r=this.metadataQuerier.NumEntries(t);for(let s=0;s<r;s++){let i=this.metadataQuerier.GetEntryName(t,s);n[i]=this._getDracoMetadataField(t,i)}return n}_getDracoMetadataField(t,n){let r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,n,r);let s=wT(r);return{int:this.metadataQuerier.GetIntEntry(t,n),string:this.metadataQuerier.GetStringEntry(t,n),double:this.metadataQuerier.GetDoubleEntry(t,n),intArray:s}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){let{quantizedAttributes:n=[],octahedronAttributes:r=[]}=t,s=[...n,...r];for(let i of s)this.decoder.SkipAttributeTransform(this.draco[i])}_getQuantizationTransform(t,n){let{quantizedAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits(),range:o.range(),min_values:new Float32Array([1,2,3]).map(a=>o.min_value(a))}}finally{this.draco.destroy(o)}}return null}_getOctahedronTransform(t,n){let{octahedronAttributes:r=[]}=n,s=t.attribute_type();if(r.map(o=>this.decoder[o]).includes(s)){let o=new this.draco.AttributeQuantizationTransform;try{if(o.InitFromAttribute(t))return{quantization_bits:o.quantization_bits()}}finally{this.draco.destroy(o)}}return null}};function IT(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32;default:return e.DT_INVALID}}function wT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}function vT(e){let t=e.size(),n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=e.GetValue(r);return n}var FT="1.5.6",RT="1.4.1",Ka=`https://www.gstatic.com/draco/versioned/decoders/${FT}`,_t={DECODER:"draco_wasm_wrapper.js",DECODER_WASM:"draco_decoder.wasm",FALLBACK_DECODER:"draco_decoder.js",ENCODER:"draco_encoder.js"},Qa={[_t.DECODER]:`${Ka}/${_t.DECODER}`,[_t.DECODER_WASM]:`${Ka}/${_t.DECODER_WASM}`,[_t.FALLBACK_DECODER]:`${Ka}/${_t.FALLBACK_DECODER}`,[_t.ENCODER]:`https://raw.githubusercontent.com/google/draco/${RT}/javascript/${_t.ENCODER}`},br;async function Od(e){let t=e.modules||{};return t.draco3d?br=br||t.draco3d.createDecoderModule({}).then(n=>({draco:n})):br=br||LT(e),await br}async function LT(e){let t,n;switch(e.draco&&e.draco.decoderType){case"js":t=await Wt(Qa[_t.FALLBACK_DECODER],"draco",e,_t.FALLBACK_DECODER);break;case"wasm":default:[t,n]=await Promise.all([await Wt(Qa[_t.DECODER],"draco",e,_t.DECODER),await Wt(Qa[_t.DECODER_WASM],"draco",e,_t.DECODER_WASM)])}return t=t||globalThis.DracoDecoderModule,await PT(t,n)}function PT(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e({...n,onModuleLoaded:s=>r({draco:s})})})}var li={...Id,parse:OT};async function OT(e,t){let{draco:n}=await Od(t),r=new Cr(n);try{return r.parseSync(e,t?.draco)}finally{r.destroy()}}var NT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},st={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},O={...NT,...st};var Za={[st.DOUBLE]:Float64Array,[st.FLOAT]:Float32Array,[st.UNSIGNED_SHORT]:Uint16Array,[st.UNSIGNED_INT]:Uint32Array,[st.UNSIGNED_BYTE]:Uint8Array,[st.BYTE]:Int8Array,[st.SHORT]:Int16Array,[st.INT]:Int32Array},DT={DOUBLE:st.DOUBLE,FLOAT:st.FLOAT,UNSIGNED_SHORT:st.UNSIGNED_SHORT,UNSIGNED_INT:st.UNSIGNED_INT,UNSIGNED_BYTE:st.UNSIGNED_BYTE,BYTE:st.BYTE,SHORT:st.SHORT,INT:st.INT},$a="Failed to convert GL type",dt=class{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(let n in Za)if(Za[n]===t)return n;throw new Error($a)}static fromName(t){let n=DT[t];if(!n)throw new Error($a);return n}static getArrayType(t){switch(t){case st.UNSIGNED_SHORT_5_6_5:case st.UNSIGNED_SHORT_4_4_4_4:case st.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:let n=Za[t];if(!n)throw new Error($a);return n}}static getByteSize(t){return dt.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(dt.getArrayType(t))}static createTypedArray(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;s===void 0&&(s=(n.byteLength-r)/dt.getByteSize(t));let i=dt.getArrayType(t);return new i(n,r,s)}};function Nd(e,t){if(!e)throw new Error(`math.gl assertion failed. ${t}`)}function tc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0],n=e>>11&31,r=e>>5&63,s=e&31;return t[0]=n<<3,t[1]=r<<2,t[2]=s<<3,t}var wP=1/256;var vP=new Ue,FP=new x,RP=new Ue,LP=new Ue,PP=new Uint8Array(1);function Dd(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:255;return ls(e,0,t)/t*2-1}function Ud(e){return e<0?-1:1}function Gd(e,t,n,r){if(Nd(r),e<0||e>n||t<0||t>n)throw new Error(`x and y must be unsigned normalized integers between 0 and ${n}`);if(r.x=Dd(e,n),r.y=Dd(t,n),r.z=1-(Math.abs(r.x)+Math.abs(r.y)),r.z<0){let s=r.x;r.x=(1-Math.abs(r.y))*Ud(s),r.y=(1-Math.abs(s))*Ud(r.y)}return r.normalize()}function ec(e,t,n){return Gd(e,t,255,n)}var le=class{constructor(t,n){this.json=void 0,this.buffer=void 0,this.featuresLength=0,this._cachedTypedArrays={},this.json=t,this.buffer=n}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:O.UNSIGNED_INT,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,s=this.json[t];return s&&Number.isFinite(s.byteOffset)?this._getTypedArrayFromBinary(t,n,r,1,s.byteOffset):s}getPropertyArray(t,n,r){let s=this.json[t];return s&&Number.isFinite(s.byteOffset)?("componentType"in s&&(n=dt.fromName(s.componentType)),this._getTypedArrayFromBinary(t,n,r,this.featuresLength,s.byteOffset)):this._getTypedArrayFromArray(t,n,s)}getProperty(t,n,r,s,i){let o=this.json[t];if(!o)return o;let a=this.getPropertyArray(t,n,r);if(r===1)return a[s];for(let c=0;c<r;++c)i[c]=a[r*s+c];return i}_getTypedArrayFromBinary(t,n,r,s,i){let o=this._cachedTypedArrays,a=o[t];return a||(a=dt.createTypedArray(n,this.buffer.buffer,this.buffer.byteOffset+i,s*r),o[t]=a),a}_getTypedArrayFromArray(t,n,r){let s=this._cachedTypedArrays,i=s[t];return i||(i=dt.createTypedArray(n,r),s[t]=i),i}};var UT={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},GT={SCALAR:(e,t)=>e[t],VEC2:(e,t)=>[e[2*t+0],e[2*t+1]],VEC3:(e,t)=>[e[3*t+0],e[3*t+1],e[3*t+2]],VEC4:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT2:(e,t)=>[e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]],MAT3:(e,t)=>[e[9*t+0],e[9*t+1],e[9*t+2],e[9*t+3],e[9*t+4],e[9*t+5],e[9*t+6],e[9*t+7],e[9*t+8]],MAT4:(e,t)=>[e[16*t+0],e[16*t+1],e[16*t+2],e[16*t+3],e[16*t+4],e[16*t+5],e[16*t+6],e[16*t+7],e[16*t+8],e[16*t+9],e[16*t+10],e[16*t+11],e[16*t+12],e[16*t+13],e[16*t+14],e[16*t+15]]},VT={SCALAR:(e,t,n)=>{t[n]=e},VEC2:(e,t,n)=>{t[2*n+0]=e[0],t[2*n+1]=e[1]},VEC3:(e,t,n)=>{t[3*n+0]=e[0],t[3*n+1]=e[1],t[3*n+2]=e[2]},VEC4:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT2:(e,t,n)=>{t[4*n+0]=e[0],t[4*n+1]=e[1],t[4*n+2]=e[2],t[4*n+3]=e[3]},MAT3:(e,t,n)=>{t[9*n+0]=e[0],t[9*n+1]=e[1],t[9*n+2]=e[2],t[9*n+3]=e[3],t[9*n+4]=e[4],t[9*n+5]=e[5],t[9*n+6]=e[6],t[9*n+7]=e[7],t[9*n+8]=e[8],t[9*n+9]=e[9]},MAT4:(e,t,n)=>{t[16*n+0]=e[0],t[16*n+1]=e[1],t[16*n+2]=e[2],t[16*n+3]=e[3],t[16*n+4]=e[4],t[16*n+5]=e[5],t[16*n+6]=e[6],t[16*n+7]=e[7],t[16*n+8]=e[8],t[16*n+9]=e[9],t[16*n+10]=e[10],t[16*n+11]=e[11],t[16*n+12]=e[12],t[16*n+13]=e[13],t[16*n+14]=e[14],t[16*n+15]=e[15]}};function Vd(e,t,n,r){let{componentType:s}=e;V(e.componentType);let i=typeof s=="string"?dt.fromName(s):s,o=UT[e.type],a=GT[e.type],c=VT[e.type];return n+=e.byteOffset,{values:dt.createTypedArray(i,t,n,o*r),type:i,size:o,unpacker:a,packer:c}}var ne=e=>e!==void 0;function Hd(e,t,n){if(!t)return null;let r=e.getExtension("3DTILES_batch_table_hierarchy"),s=t.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),t.extensions=t.extensions||{},t.extensions["3DTILES_batch_table_hierarchy"]=s,r=s),r?HT(r,n):null}function HT(e,t){let n,r,s,i=e.instancesLength,o=e.classes,a=e.classIds,c=e.parentCounts,l=e.parentIds,u=i;ne(a.byteOffset)&&(a.componentType=defaultValue(a.componentType,GL.UNSIGNED_SHORT),a.type=AttributeType.SCALAR,s=getBinaryAccessor(a),a=s.createArrayBufferView(t.buffer,t.byteOffset+a.byteOffset,i));let h;if(ne(c))for(ne(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(t.buffer,t.byteOffset+c.byteOffset,i)),h=new Uint16Array(i),u=0,n=0;n<i;++n)h[n]=u,u+=c[n];ne(l)&&ne(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(t.buffer,t.byteOffset+l.byteOffset,u));let f=o.length;for(n=0;n<f;++n){let g=o[n].length,y=o[n].instances,E=getBinaryProperties(g,y,t);o[n].instances=combine(E,y)}let d=new Array(f).fill(0),p=new Uint16Array(i);for(n=0;n<i;++n)r=a[n],p[n]=d[r],++d[r];let A={classes:o,classIds:a,classIndexes:p,parentCounts:c,parentIndexes:h,parentIds:l};return JT(A),A}function Cn(e,t,n){if(!e)return;let r=e.parentCounts;return e.parentIds?n(e,t):r>0?zT(e,t,n):kT(e,t,n)}function zT(e,t,n){let r=e.classIds,s=e.parentCounts,i=e.parentIds,o=e.parentIndexes,a=r.length,c=scratchVisited;c.length=Math.max(c.length,a);let l=++marker,u=scratchStack;for(u.length=0,u.push(t);u.length>0;){if(t=u.pop(),c[t]===l)continue;c[t]=l;let h=n(e,t);if(ne(h))return h;let f=s[t],d=o[t];for(let p=0;p<f;++p){let A=i[d+p];A!==t&&u.push(A)}}return null}function kT(e,t,n){let r=!0;for(;r;){let s=n(e,t);if(ne(s))return s;let i=e.parentIds[t];r=i!==t,t=i}throw new Error("traverseHierarchySingleParent")}function JT(e){let t=[],r=e.classIds.length;for(let s=0;s<r;++s)zd(e,s,stack)}function zd(e,t,n){let r=e.parentCounts,s=e.parentIds,i=e.parentIndexes,a=e.classIds.length;if(!ne(s))return;assert(t<a,`Parent index ${t} exceeds the total number of instances: ${a}`),assert(n.indexOf(t)===-1,"Circular dependency detected in the batch table hierarchy."),n.push(t);let c=ne(r)?r[t]:1,l=ne(r)?i[t]:t;for(let u=0;u<c;++u){let h=s[l+u];h!==t&&zd(e,h,n)}n.pop(t)}function Et(e){return e!=null}var ui=(e,t)=>e,qT={HIERARCHY:!0,extensions:!0,extras:!0},Ke=class{constructor(t,n,r){var s;let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};this.json=void 0,this.binary=void 0,this.featureCount=void 0,this._extensions=void 0,this._properties=void 0,this._binaryProperties=void 0,this._hierarchy=void 0,V(r>=0),this.json=t||{},this.binary=n,this.featureCount=r,this._extensions=((s=this.json)===null||s===void 0?void 0:s.extensions)||{},this._properties={};for(let o in this.json)qT[o]||(this._properties[o]=this.json[o]);this._binaryProperties=this._initializeBinaryProperties(),i["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Hd(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,n){if(this._checkBatchId(t),V(typeof n=="string",n),this._hierarchy){let r=Cn(this._hierarchy,t,(s,i)=>{let o=s.classIds[i];return s.classes[o].name===n});return Et(r)}return!1}isExactClass(t,n){return V(typeof n=="string",n),this.getExactClassName(t)===n}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){let n=this._hierarchy.classIds[t];return this._hierarchy.classes[n].name}}hasProperty(t,n){return this._checkBatchId(t),V(typeof n=="string",n),Et(this._properties[n])||this._hasPropertyInHierarchy(t,n)}getPropertyNames(t,n){this._checkBatchId(t),n=Et(n)?n:[],n.length=0;let r=Object.keys(this._properties);return n.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,n),n}getProperty(t,n){if(this._checkBatchId(t),V(typeof n=="string",n),this._binaryProperties){let s=this._binaryProperties[n];if(Et(s))return this._getBinaryProperty(s,t)}let r=this._properties[n];if(Et(r))return ui(r[t],!0);if(this._hierarchy){let s=this._getHierarchyProperty(t,n);if(Et(s))return s}}setProperty(t,n,r){let s=this.featureCount;if(this._checkBatchId(t),V(typeof n=="string",n),this._binaryProperties){let o=this._binaryProperties[n];if(o){this._setBinaryProperty(o,t,r);return}}if(this._hierarchy&&this._setHierarchyProperty(this,t,n,r))return;let i=this._properties[n];Et(i)||(this._properties[n]=new Array(s),i=this._properties[n]),i[t]=ui(r,!0)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,n){return t.unpack(t.typedArray,n)}_setBinaryProperty(t,n,r){t.pack(r,t.typedArray,n)}_initializeBinaryProperties(){let t=null;for(let n in this._properties){let r=this._properties[n],s=this._initializeBinaryProperty(n,r);s&&(t=t||{},t[n]=s)}return t}_initializeBinaryProperty(t,n){if("byteOffset"in n){let r=n;V(this.binary,`Property ${t} requires a batch table binary.`),V(r.type,`Property ${t} requires a type.`);let s=Vd(r,this.binary.buffer,this.binary.byteOffset|0,this.featureCount);return{typedArray:s.values,componentCount:s.size,unpack:s.unpacker,pack:s.packer}}return null}_hasPropertyInHierarchy(t,n){if(!this._hierarchy)return!1;let r=Cn(this._hierarchy,t,(s,i)=>{let o=s.classIds[i],a=s.classes[o].instances;return Et(a[n])});return Et(r)}_getPropertyNamesInHierarchy(t,n){Cn(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i].instances;for(let a in o)o.hasOwnProperty(a)&&n.indexOf(a)===-1&&n.push(a)})}_getHierarchyProperty(t,n){return Cn(this._hierarchy,t,(r,s)=>{let i=r.classIds[s],o=r.classes[i],a=r.classIndexes[s],c=o.instances[n];return Et(c)?Et(c.typedArray)?this._getBinaryProperty(c,a):ui(c[a],!0):null})}_setHierarchyProperty(t,n,r,s){let i=Cn(this._hierarchy,n,(o,a)=>{let c=o.classIds[a],l=o.classes[c],u=o.classIndexes[a],h=l.instances[r];return Et(h)?(V(a===n,`Inherited property "${r}" is read-only.`),Et(h.typedArray)?this._setBinaryProperty(h,u,s):h[u]=ui(s,!0),!0):!1});return Et(i)}};function Ie(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=new DataView(t);if(e.magic=r.getUint32(n,!0),n+=4,e.version=r.getUint32(n,!0),n+=4,e.byteLength=r.getUint32(n,!0),n+=4,e.version!==1)throw new Error(`3D Tile Version ${e.version} not supported`);return n}var bn=4,kd="b3dm tile in legacy format.";function Sn(e,t,n){let r=new DataView(t),s;e.header=e.header||{};let i=r.getUint32(n,!0);n+=bn;let o=r.getUint32(n,!0);n+=bn;let a=r.getUint32(n,!0);n+=bn;let c=r.getUint32(n,!0);return n+=bn,a>=570425344?(n-=bn*2,s=i,a=o,c=0,i=0,o=0,console.warn(kd)):c>=570425344&&(n-=bn,s=a,a=i,c=o,i=0,o=0,console.warn(kd)),e.header.featureTableJsonByteLength=i,e.header.featureTableBinaryByteLength=o,e.header.batchTableJsonByteLength=a,e.header.batchTableBinaryByteLength=c,e.header.batchLength=s,n}function Mn(e,t,n,r){return n=jT(e,t,n,r),n=XT(e,t,n,r),n}function jT(e,t,n,r){let{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=e.header||{};if(e.featureTableJson={BATCH_LENGTH:o||0},s&&s>0){let a=Wa(t,n,s);e.featureTableJson=JSON.parse(a)}return n+=s||0,e.featureTableBinary=new Uint8Array(t,n,i),n+=i||0,n}function XT(e,t,n,r){let{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=e.header||{};if(s&&s>0){let o=Wa(t,n,s);e.batchTableJson=JSON.parse(o),n+=s,i&&i>0&&(e.batchTableBinary=new Uint8Array(t,n,i),e.batchTableBinary=new Uint8Array(e.batchTableBinary),n+=i)}return n}function nc(e,t,n){if(!t&&(!e||!e.batchIds||!n))return null;let{batchIds:r,isRGB565:s,pointCount:i=0}=e;if(r&&n){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=r[a],u=n.getProperty(c,"dimensions").map(h=>h*255);o[a*3]=u[0],o[a*3+1]=u[1],o[a*3+2]=u[2]}return{type:O.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}if(t&&s){let o=new Uint8ClampedArray(i*3);for(let a=0;a<i;a++){let c=tc(t[a]);o[a*3]=c[0],o[a*3+1]=c[1],o[a*3+2]=c[2]}return{type:O.UNSIGNED_BYTE,value:o,size:3,normalized:!0}}return t&&t.length===i*3?{type:O.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:O.UNSIGNED_BYTE,value:t||new Uint8ClampedArray,size:4,normalized:!0}}var Jd=new x;function qd(e,t){if(!t)return null;if(e.isOctEncoded16P){let n=new Float32Array((e.pointsLength||0)*3);for(let r=0;r<(e.pointsLength||0);r++)ec(t[r*2],t[r*2+1],Jd),Jd.toArray(n,r*3);return{type:O.FLOAT,size:2,value:n}}return{type:O.FLOAT,size:2,value:t}}function jd(e,t,n){return e.isQuantized?n["3d-tiles"]&&n["3d-tiles"].decodeQuantizedPositions?(e.isQuantized=!1,WT(e,t)):{type:O.UNSIGNED_SHORT,value:t,size:3,normalized:!0}:t}function WT(e,t){let n=new x,r=new Float32Array(e.pointCount*3);for(let s=0;s<e.pointCount;s++)n.set(t[s*3],t[s*3+1],t[s*3+2]).scale(1/e.quantizedRange).multiply(e.quantizedVolumeScale).add(e.quantizedVolumeOffset).toArray(r,s*3);return r}async function Xd(e,t,n,r,s){n=Ie(e,t,n),n=Sn(e,t,n),n=Mn(e,t,n,r),YT(e);let{featureTable:i,batchTable:o}=KT(e);return await e_(e,i,o,r,s),QT(e,i,r),ZT(e,i,o),$T(e,i),n}function YT(e){e.attributes={positions:null,colors:null,normals:null,batchIds:null},e.isQuantized=!1,e.isTranslucent=!1,e.isRGB565=!1,e.isOctEncoded16P=!1}function KT(e){let t=new le(e.featureTableJson,e.featureTableBinary),n=t.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(n))throw new Error("POINTS_LENGTH must be defined");t.featuresLength=n,e.featuresLength=n,e.pointsLength=n,e.pointCount=n,e.rtcCenter=t.getGlobalProperty("RTC_CENTER",O.FLOAT,3);let r=t_(e,t);return{featureTable:t,batchTable:r}}function QT(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.positions){if(t.hasProperty("POSITION"))e.attributes.positions=t.getPropertyArray("POSITION",O.FLOAT,3);else if(t.hasProperty("POSITION_QUANTIZED")){let r=t.getPropertyArray("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3);if(e.isQuantized=!0,e.quantizedRange=(1<<16)-1,e.quantizedVolumeScale=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3),!e.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(e.quantizedVolumeOffset=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3),!e.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");e.attributes.positions=jd(e,r,n)}}if(!e.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}function ZT(e,t,n){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.colors){let r=null;t.hasProperty("RGBA")?(r=t.getPropertyArray("RGBA",O.UNSIGNED_BYTE,4),e.isTranslucent=!0):t.hasProperty("RGB")?r=t.getPropertyArray("RGB",O.UNSIGNED_BYTE,3):t.hasProperty("RGB565")&&(r=t.getPropertyArray("RGB565",O.UNSIGNED_SHORT,1),e.isRGB565=!0),e.attributes.colors=nc(e,r,n)}t.hasProperty("CONSTANT_RGBA")&&(e.constantRGBA=t.getGlobalProperty("CONSTANT_RGBA",O.UNSIGNED_BYTE,4))}function $T(e,t){if(e.attributes=e.attributes||{positions:null,colors:null,normals:null,batchIds:null},!e.attributes.normals){let n=null;t.hasProperty("NORMAL")?n=t.getPropertyArray("NORMAL",O.FLOAT,3):t.hasProperty("NORMAL_OCT16P")&&(n=t.getPropertyArray("NORMAL_OCT16P",O.UNSIGNED_BYTE,2),e.isOctEncoded16P=!0),e.attributes.normals=qd(e,n)}}function t_(e,t){let n=null;if(!e.batchIds&&t.hasProperty("BATCH_ID")&&(e.batchIds=t.getPropertyArray("BATCH_ID",O.UNSIGNED_SHORT,1),e.batchIds)){let r=t.getGlobalProperty("BATCH_LENGTH");if(!r)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");let{batchTableJson:s,batchTableBinary:i}=e;n=new Ke(s,i,r)}return n}async function e_(e,t,n,r,s){let i,o,a,c=e.batchTableJson&&e.batchTableJson.extensions&&e.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);let l=t.getExtension("3DTILES_draco_point_compression");if(l){o=l.properties;let h=l.byteOffset,f=l.byteLength;if(!o||!Number.isFinite(h)||!f)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=(e.featureTableBinary||[]).slice(h,h+f),e.hasPositions=Number.isFinite(o.POSITION),e.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),e.hasNormals=Number.isFinite(o.NORMAL),e.hasBatchIds=Number.isFinite(o.BATCH_ID),e.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;let u={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await n_(e,u,r,s)}async function n_(e,t,n,r){if(!r)return;let s={...n,draco:{...n?.draco,extraAttributes:t.batchTableProperties||{}}};delete s["3d-tiles"];let i=await Ct(t.buffer,li,s,r),o=i.attributes.POSITION&&i.attributes.POSITION.value,a=i.attributes.COLOR_0&&i.attributes.COLOR_0.value,c=i.attributes.NORMAL&&i.attributes.NORMAL.value,l=i.attributes.BATCH_ID&&i.attributes.BATCH_ID.value,u=o&&i.attributes.POSITION.value.quantization,h=c&&i.attributes.NORMAL.value.quantization;if(u){let d=i.POSITION.data.quantization,p=d.range;e.quantizedVolumeScale=new x(p,p,p),e.quantizedVolumeOffset=new x(d.minValues),e.quantizedRange=(1<<d.quantizationBits)-1,e.isQuantizedDraco=!0}h&&(e.octEncodedRange=(1<<i.NORMAL.data.quantization.quantizationBits)-1,e.isOctEncodedDraco=!0);let f={};if(t.batchTableProperties)for(let d of Object.keys(t.batchTableProperties))i.attributes[d]&&i.attributes[d].value&&(f[d.toLowerCase()]=i.attributes[d].value);e.attributes={positions:o,colors:nc(e,a,void 0),normals:c,batchIds:l,...f}}var rc={};ut(rc,{decode:()=>p_,name:()=>d_});function at(e,t){if(!e)throw new Error(t||"assert failed: gltf")}var hi={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fi={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var r_=1.33,Wd=["SCALAR","VEC2","VEC3","VEC4"],s_=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],i_=new Map(s_),o_={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},a_={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},c_={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function di(e){return Wd[e-1]||Wd[0]}function In(e){let t=i_.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function wn(e,t){let n=c_[e.componentType],r=o_[e.type],s=a_[e.componentType],i=e.count*r,o=e.count*r*s;at(o>=0&&o<=t.byteLength);let a=fi[e.componentType],c=hi[e.type];return{ArrayType:n,length:i,byteLength:o,componentByteSize:a,numberOfComponentsInElement:c}}function Sr(e){let{images:t,bufferViews:n}=e;t=t||[],n=n||[];let r=t.map(o=>o.bufferView);n=n.filter(o=>!r.includes(o));let s=n.reduce((o,a)=>o+a.byteLength,0),i=t.reduce((o,a)=>{let{width:c,height:l}=a.image;return o+c*l},0);return s+Math.ceil(4*i*r_)}function Yd(e,t,n){let r=e.bufferViews[n];at(r);let s=r.buffer,i=t[s];at(i);let o=(r.byteOffset||0)+i.byteOffset;return new Uint8Array(i.arrayBuffer,o,r.byteLength)}function Kd(e,t,n){var r,s;let i=typeof n=="number"?(r=e.accessors)===null||r===void 0?void 0:r[n]:n;if(!i)throw new Error(`No gltf accessor ${JSON.stringify(n)}`);let o=(s=e.bufferViews)===null||s===void 0?void 0:s[i.bufferView||0];if(!o)throw new Error(`No gltf buffer view for accessor ${o}`);let{arrayBuffer:a,byteOffset:c}=t[o.buffer],l=(c||0)+(i.byteOffset||0)+(o.byteOffset||0),{ArrayType:u,length:h,componentByteSize:f,numberOfComponentsInElement:d}=wn(i,o),p=f*d,A=o.byteStride||p;if(typeof o.byteStride>"u"||o.byteStride===p)return new u(a,l,h);let g=new u(h);for(let y=0;y<i.count;y++){let E=new u(a,l+y*A,d);g.set(E,y*d)}return g}function l_(){return{asset:{version:"2.0",generator:"loaders.gl"},buffers:[],extensions:{},extensionsRequired:[],extensionsUsed:[]}}var j=class{constructor(t){this.gltf=void 0,this.sourceBuffers=void 0,this.byteLength=void 0,this.gltf={json:t?.json||l_(),buffers:t?.buffers||[],images:t?.images||[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}hasExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.getRequiredExtensions().find(s=>s===t);return typeof n=="string"||typeof r=="string"}getExtension(t){let n=this.getUsedExtensions().find(s=>s===t),r=this.json.extensions||{};return n?r[t]:null}getRequiredExtension(t){return this.getRequiredExtensions().find(r=>r===t)?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getRemovedExtensions(){return this.json.extensionsRemoved||[]}getObjectExtension(t,n){return(t.extensions||{})[n]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,n){if(typeof n=="object")return n;let r=this.json[t]&&this.json[t][n];if(!r)throw new Error(`glTF file error: Could not find ${t}[${n}]`);return r}getTypedArrayForBufferView(t){t=this.getBufferView(t);let n=t.buffer,r=this.gltf.buffers[n];at(r);let s=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,t.byteLength)}getTypedArrayForAccessor(t){let n=this.getAccessor(t);return Kd(this.gltf.json,this.gltf.buffers,n)}getTypedArrayForImageData(t){t=this.getAccessor(t);let n=this.getBufferView(t.bufferView),s=this.getBuffer(n.buffer).data,i=n.byteOffset||0;return new Uint8Array(s,i,n.byteLength)}addApplicationData(t,n){return this.json[t]=n,this}addExtraData(t,n){return this.json.extras=this.json.extras||{},this.json.extras[t]=n,this}addObjectExtension(t,n,r){return t.extensions=t.extensions||{},t.extensions[n]=r,this.registerUsedExtension(n),this}setObjectExtension(t,n,r){let s=t.extensions||{};s[n]=r}removeObjectExtension(t,n){let r=t?.extensions||{};if(r[n]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let s=this.json.extensionsRemoved;s.includes(n)||s.push(n)}delete r[n]}addExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(n),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=n,this.registerUsedExtension(t),n}addRequiredExtension(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return at(n),this.addExtension(t,n),this.registerRequiredExtension(t),n}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(n=>n===t)||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(n=>n===t)||this.json.extensionsRequired.push(t)}removeExtension(t){var n;if((n=this.json.extensions)!==null&&n!==void 0&&n[t]){this.json.extensionsRemoved=this.json.extensionsRemoved||[];let r=this.json.extensionsRemoved;r.includes(t)||r.push(t)}this.json.extensions&&delete this.json.extensions[t],this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t)}setDefaultScene(t){this.json.scene=t}addScene(t){let{nodeIndices:n}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:n}),this.json.scenes.length-1}addNode(t){let{meshIndex:n,matrix:r}=t;this.json.nodes=this.json.nodes||[];let s={mesh:n};return r&&(s.matrix=r),this.json.nodes.push(s),this.json.nodes.length-1}addMesh(t){let{attributes:n,indices:r,material:s,mode:i=4}=t,a={primitives:[{attributes:this._addAttributes(n),mode:i}]};if(r){let c=this._addIndices(r);a.primitives[0].indices=c}return Number.isFinite(s)&&(a.primitives[0].material=s),this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addPointCloud(t){let r={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(r),this.json.meshes.length-1}addImage(t,n){let r=De(t),s=n||r?.mimeType,o={bufferView:this.addBufferView(t),mimeType:s};return this.json.images=this.json.images||[],this.json.images.push(o),this.json.images.length-1}addBufferView(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.byteLength,s=t.byteLength;at(Number.isFinite(s)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);let i={buffer:n,byteOffset:r,byteLength:s};return this.byteLength+=pe(s,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(i),this.json.bufferViews.length-1}addAccessor(t,n){let r={bufferView:t,type:di(n.size),componentType:n.componentType,count:n.count,max:n.max,min:n.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{size:3},r=this.addBufferView(t),s={min:n.min,max:n.max};(!s.min||!s.max)&&(s=this._getAccessorMinMax(t,n.size));let i={size:n.size,componentType:In(t),count:Math.round(t.length/n.size),min:s.min,max:s.max};return this.addAccessor(r,Object.assign(i,n))}addTexture(t){let{imageIndex:n}=t,r={source:n};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,n;this.gltf.buffers=[];let r=this.byteLength,s=new ArrayBuffer(r),i=new Uint8Array(s),o=0;for(let a of this.sourceBuffers||[])o=yo(a,i,o);(t=this.json)!==null&&t!==void 0&&(n=t.buffers)!==null&&n!==void 0&&n[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=s,this.sourceBuffers=[s]}_removeStringFromArray(t,n){let r=!0;for(;r;){let s=t.indexOf(n);s>-1?t.splice(s,1):r=!1}}_addAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n={};for(let r in t){let s=t[r],i=this._getGltfAttributeName(r),o=this.addBinaryBuffer(s.value,s);n[i]=o}return n}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,n){let r={min:null,max:null};if(t.length<n)return r;r.min=[],r.max=[];let s=t.subarray(0,n);for(let i of s)r.min.push(i),r.max.push(i);for(let i=n;i<t.length;i+=n)for(let o=0;o<n;o++)r.min[0+o]=Math.min(r.min[0+o],t[i+o]),r.max[0+o]=Math.max(r.max[0+o],t[i+o]);return r}};function Qd(e){return(e%1+1)%1}var Zd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16,BOOLEAN:1,STRING:1,ENUM:1},u_={INT8:Int8Array,UINT8:Uint8Array,INT16:Int16Array,UINT16:Uint16Array,INT32:Int32Array,UINT32:Uint32Array,INT64:BigInt64Array,UINT64:BigUint64Array,FLOAT32:Float32Array,FLOAT64:Float64Array},$d={INT8:1,UINT8:1,INT16:2,UINT16:2,INT32:4,UINT32:4,INT64:8,UINT64:8,FLOAT32:4,FLOAT64:8};function Mr(e,t){return $d[t]*Zd[e]}function vn(e,t,n,r){if(n!=="UINT8"&&n!=="UINT16"&&n!=="UINT32"&&n!=="UINT64")return null;let s=e.getTypedArrayForBufferView(t),i=Fn(s,"SCALAR",n,r+1);return i instanceof BigInt64Array||i instanceof BigUint64Array?null:i}function Fn(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=Zd[t],i=u_[n],o=$d[n],a=r*s,c=a*o,l=e.buffer,u=e.byteOffset;return u%o!==0&&(l=new Uint8Array(l).slice(u,u+c).buffer,u=0),new i(l,u,a)}function Rn(e,t,n){var r,s;let i=`TEXCOORD_${t.texCoord||0}`,o=n.attributes[i],a=e.getTypedArrayForAccessor(o),c=e.gltf.json,l=t.index,u=(r=c.textures)===null||r===void 0||(s=r[l])===null||s===void 0?void 0:s.source;if(typeof u<"u"){var h,f,d;let p=(h=c.images)===null||h===void 0||(f=h[u])===null||f===void 0?void 0:f.mimeType,A=(d=e.gltf.images)===null||d===void 0?void 0:d[u];if(A&&typeof A.width<"u"){let g=[];for(let y=0;y<a.length;y+=2){let E=h_(A,p,a,y,t.channels);g.push(E)}return g}}return[]}function pi(e,t,n,r,s){if(!(n!=null&&n.length))return;let i=[];for(let u of n){let h=r.findIndex(f=>f===u);h===-1&&(h=r.push(u)-1),i.push(h)}let o=new Uint32Array(i),a=e.gltf.buffers.push({arrayBuffer:o.buffer,byteOffset:o.byteOffset,byteLength:o.byteLength})-1,c=e.addBufferView(o,a,0),l=e.addAccessor(c,{size:1,componentType:In(o),count:o.length});s.attributes[t]=l}function h_(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[0],i={r:{offset:0,shift:0},g:{offset:1,shift:8},b:{offset:2,shift:16},a:{offset:3,shift:24}},o=n[r],a=n[r+1],c=1;t&&(t.indexOf("image/jpeg")!==-1||t.indexOf("image/png")!==-1)&&(c=4);let l=f_(o,a,e,c),u=0;for(let h of s){let f=typeof h=="number"?Object.values(i)[h]:i[h],d=l+f.offset,p=Zn(e);if(p.data.length<=d)throw new Error(`${p.data.length} <= ${d}`);let A=p.data[d];u|=A<<f.shift}return u}function f_(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,s=n.width,i=Qd(e)*(s-1),o=Math.round(i),a=n.height,c=Qd(t)*(a-1),l=Math.round(c),u=n.components?n.components:r;return(l*s+o)*u}function mi(e,t,n,r,s){let i=[];for(let o=0;o<t;o++){let a=n[o],c=n[o+1]-n[o];if(c+a>r)break;let l=a/s,u=c/s;i.push(e.slice(l,l+u))}return i}function gi(e,t,n){let r=[];for(let s=0;s<t;s++){let i=s*n;r.push(e.slice(i,i+n))}return r}function Ai(e,t,n,r){if(n)throw new Error("Not implemented - arrayOffsets for strings is specified");if(r){let s=[],i=new TextDecoder("utf8"),o=0;for(let a=0;a<e;a++){let c=r[a+1]-r[a];if(c+o<=t.length){let l=t.subarray(o,c+o),u=i.decode(l);s.push(u),o+=c}}return s}return[]}var tp="EXT_mesh_features",d_=tp;async function p_(e,t){let n=new j(e);m_(n,t)}function m_(e,t){let n=e.gltf.json;if(n.meshes)for(let r of n.meshes)for(let s of r.primitives)g_(e,s,t)}function g_(e,t,n){var r,s;if(!(n!=null&&(r=n.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=(s=t.extensions)===null||s===void 0?void 0:s[tp],o=i?.featureIds;if(o)for(let c of o){var a;let l;if(typeof c.attribute<"u"){let u=`_FEATURE_ID_${c.attribute}`,h=t.attributes[u];l=e.getTypedArrayForAccessor(h)}else typeof c.texture<"u"&&n!==null&&n!==void 0&&(a=n.gltf)!==null&&a!==void 0&&a.loadImages?l=Rn(e,c.texture,t):l=[];c.data=l}}var oc={};ut(oc,{decode:()=>x_,name:()=>A_});var sc="EXT_structural_metadata",A_=sc;async function x_(e,t){let n=new j(e);y_(n,t)}function y_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(sc);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&T_(e,s),__(e,s))}function T_(e,t){let n=t.propertyTextures,r=e.gltf.json;if(n&&r.meshes)for(let s of r.meshes)for(let i of s.primitives)B_(e,n,i,t)}function __(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.propertyTables;if(r&&s)for(let i in r){let o=E_(s,i);o&&b_(e,n,o)}}function E_(e,t){for(let n of e)if(n.class===t)return n;return null}function B_(e,t,n,r){var s;if(!t)return;let i=(s=n.extensions)===null||s===void 0?void 0:s[sc],o=i?.propertyTextures;if(o)for(let a of o){let c=t[a];C_(e,c,n,r)}}function C_(e,t,n,r){if(!t.properties)return;r.dataAttributeNames||(r.dataAttributeNames=[]);let s=t.class;for(let o in t.properties){var i;let a=`${s}_${o}`,c=(i=t.properties)===null||i===void 0?void 0:i[o];if(!c)continue;c.data||(c.data=[]);let l=c.data,u=Rn(e,c,n);u!==null&&(pi(e,a,u,l,n),c.data=l,r.dataAttributeNames.push(a))}}function b_(e,t,n){var r;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=S_(e,t,c,i,l);l.data=u}}}function S_(e,t,n,r,s){let i=[],o=s.values,a=e.getTypedArrayForBufferView(o),c=M_(e,n,s,r),l=I_(e,s,r);switch(n.type){case"SCALAR":case"VEC2":case"VEC3":case"VEC4":case"MAT2":case"MAT3":case"MAT4":{i=w_(n,r,a,c);break}case"BOOLEAN":throw new Error(`Not implemented - classProperty.type=${n.type}`);case"STRING":{i=Ai(r,a,c,l);break}case"ENUM":{i=v_(t,n,r,a,c);break}default:throw new Error(`Unknown classProperty type ${n.type}`)}return i}function M_(e,t,n,r){return t.array&&typeof t.count>"u"&&typeof n.arrayOffsets<"u"?vn(e,n.arrayOffsets,n.arrayOffsetType||"UINT32",r):null}function I_(e,t,n){return typeof t.stringOffsets<"u"?vn(e,t.stringOffsets,t.stringOffsetType||"UINT32",n):null}function w_(e,t,n,r){let s=e.array,i=e.count,o=Mr(e.type,e.componentType),a=n.byteLength/o,c;return e.componentType?c=Fn(n,e.type,e.componentType,a):c=n,s?r?mi(c,t,r,n.length,o):i?gi(c,t,i):[]:c}function v_(e,t,n,r,s){var i;let o=t.enumType;if(!o)throw new Error("Incorrect data in the EXT_structural_metadata extension: classProperty.enumType is not set for type ENUM");let a=(i=e.enums)===null||i===void 0?void 0:i[o];if(!a)throw new Error(`Incorrect data in the EXT_structural_metadata extension: schema.enums does't contain ${o}`);let c=a.valueType||"UINT16",l=Mr(t.type,c),u=r.byteLength/l,h=Fn(r,t.type,c,u);if(h||(h=r),t.array){if(s)return F_({valuesData:h,numberOfElements:n,arrayOffsets:s,valuesDataBytesLength:r.length,elementSize:l,enumEntry:a});let f=t.count;return f?R_(h,n,f,a):[]}return ic(h,0,n,a)}function F_(e){let{valuesData:t,numberOfElements:n,arrayOffsets:r,valuesDataBytesLength:s,elementSize:i,enumEntry:o}=e,a=[];for(let c=0;c<n;c++){let l=r[c],u=r[c+1]-r[c];if(u+l>s)break;let h=l/i,f=u/i,d=ic(t,h,f,o);a.push(d)}return a}function R_(e,t,n,r){let s=[];for(let i=0;i<t;i++){let o=n*i,a=ic(e,o,n,r);s.push(a)}return s}function ic(e,t,n,r){let s=[];for(let i=0;i<n;i++)if(e instanceof BigInt64Array||e instanceof BigUint64Array)s.push("");else{let o=e[t+i],a=L_(r,o);a?s.push(a.name):s.push("")}return s}function L_(e,t){for(let n of e.values)if(n.value===t)return n;return null}var ac={};ut(ac,{decode:()=>O_,name:()=>P_});var ep="EXT_feature_metadata",P_=ep;async function O_(e,t){let n=new j(e);N_(n,t)}function N_(e,t){var n,r;if(!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let s=e.getExtension(ep);s&&((r=t.gltf)!==null&&r!==void 0&&r.loadImages&&D_(e,s),U_(e,s))}function D_(e,t){let n=t.schema;if(!n)return;let r=n.classes,{featureTextures:s}=t;if(r&&s)for(let i in r){let o=r[i],a=V_(s,i);a&&z_(e,a,o)}}function U_(e,t){let n=t.schema;if(!n)return;let r=n.classes,s=t.featureTables;if(r&&s)for(let i in r){let o=G_(s,i);o&&H_(e,n,o)}}function G_(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function V_(e,t){for(let n in e){let r=e[n];if(r.class===t)return r}return null}function H_(e,t,n){var r;if(!n.class)return;let s=(r=t.classes)===null||r===void 0?void 0:r[n.class];if(!s)throw new Error(`Incorrect data in the EXT_structural_metadata extension: no schema class with name ${n.class}`);let i=n.count;for(let a in s.properties){var o;let c=s.properties[a],l=(o=n.properties)===null||o===void 0?void 0:o[a];if(l){let u=k_(e,t,c,i,l);l.data=u}}}function z_(e,t,n){let r=t.class;for(let i in n.properties){var s;let o=t==null||(s=t.properties)===null||s===void 0?void 0:s[i];if(o){let a=W_(e,o,r);o.data=a}}}function k_(e,t,n,r,s){let i=[],o=s.bufferView,a=e.getTypedArrayForBufferView(o),c=J_(e,n,s,r),l=q_(e,n,s,r);return n.type==="STRING"||n.componentType==="STRING"?i=Ai(r,a,c,l):j_(n)&&(i=X_(n,r,a,c)),i}function J_(e,t,n,r){return t.type==="ARRAY"&&typeof t.componentCount>"u"&&typeof n.arrayOffsetBufferView<"u"?vn(e,n.arrayOffsetBufferView,n.offsetType||"UINT32",r):null}function q_(e,t,n,r){return typeof n.stringOffsetBufferView<"u"?vn(e,n.stringOffsetBufferView,n.offsetType||"UINT32",r):null}function j_(e){let t=["UINT8","INT16","UINT16","INT32","UINT32","INT64","UINT64","FLOAT32","FLOAT64"];return t.includes(e.type)||typeof e.componentType<"u"&&t.includes(e.componentType)}function X_(e,t,n,r){let s=e.type==="ARRAY",i=e.componentCount,o="SCALAR",a=e.componentType||e.type,c=Mr(o,a),l=n.byteLength/c,u=Fn(n,o,a,l);return s?r?mi(u,t,r,n.length,c):i?gi(u,t,i):[]:u}function W_(e,t,n){let r=e.gltf.json;if(!r.meshes)return[];let s=[];for(let i of r.meshes)for(let o of i.primitives)Y_(e,n,t,s,o);return s}function Y_(e,t,n,r,s){let i={channels:n.channels,...n.texture},o=Rn(e,i,s);o&&pi(e,t,o,r,s)}var np="4.1.4";var rp="4.1.4";var xi={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},cc;async function uc(e){let t=e.modules||{};return t.basis?t.basis:(cc=cc||K_(e),await cc)}async function K_(e){let t=null,n=null;return[t,n]=await Promise.all([await Wt(xi.TRANSCODER,"textures",e),await Wt(xi.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await Q_(t,n)}function Q_(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,initializeBasis:o}=s;o(),r({BasisFile:i})})})}var lc;async function hc(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(lc=lc||Z_(e),await lc)}async function Z_(e){let t=null,n=null;return[t,n]=await Promise.all([await Wt(xi.ENCODER,"textures",e),await Wt(xi.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await $_(t,n)}function $_(e,t){let n={};return t&&(n.wasmBinary=t),new Promise(r=>{e(n).then(s=>{let{BasisFile:i,KTX2File:o,initializeBasis:a,BasisEncoder:c}=s;a(),r({BasisFile:i,KTX2File:o,BasisEncoder:c})})})}var Qe={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var tE=["","WEBKIT_","MOZ_"],sp={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},yi=null;function ip(e){if(!yi){e=e||eE()||void 0,yi=new Set;for(let t of tE)for(let n in sp)if(e&&e.getExtension(`${t}${n}`)){let r=sp[n];yi.add(r)}}return yi}function eE(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var wt=[171,75,84,88,32,50,48,187,13,10,26,10];function op(e){let t=new Uint8Array(e);return!(t.byteLength<wt.length||t[0]!==wt[0]||t[1]!==wt[1]||t[2]!==wt[2]||t[3]!==wt[3]||t[4]!==wt[4]||t[5]!==wt[5]||t[6]!==wt[6]||t[7]!==wt[7]||t[8]!==wt[8]||t[9]!==wt[9]||t[10]!==wt[10]||t[11]!==wt[11])}var nE={etc1:{basisFormat:0,compressed:!0,format:Qe.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:Qe.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:Qe.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:Qe.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Qe.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:Qe.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function dc(e,t){if(t.basis.containerFormat==="auto"){if(op(e)){let r=await hc(t);return ap(r.KTX2File,e,t)}let{BasisFile:n}=await uc(t);return fc(n,e,t)}switch(t.basis.module){case"encoder":let n=await hc(t);switch(t.basis.containerFormat){case"ktx2":return ap(n.KTX2File,e,t);case"basis":default:return fc(n.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await uc(t);return fc(r,e,t)}}function fc(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),i=[];for(let o=0;o<s;o++){let a=r.getNumLevels(o),c=[];for(let l=0;l<a;l++)c.push(rE(r,o,l,n));i.push(c)}return i}finally{r.close(),r.delete()}}function rE(e,t,n,r){let s=e.getImageWidth(t,n),i=e.getImageHeight(t,n),o=e.getHasAlpha(),{compressed:a,format:c,basisFormat:l}=cp(r,o),u=e.getImageTranscodedSizeInBytes(t,n,l),h=new Uint8Array(u);if(!e.transcodeImage(h,t,n,l,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:i,data:h,compressed:a,format:c,hasAlpha:o}}function ap(e,t,n){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),i=[];for(let o=0;o<s;o++){i.push(sE(r,o,n));break}return[i]}finally{r.close(),r.delete()}}function sE(e,t,n){let{alphaFlag:r,height:s,width:i}=e.getImageLevelInfo(t,0,0),{compressed:o,format:a,basisFormat:c}=cp(n,r),l=e.getImageTranscodedSizeInBytes(t,0,0,c),u=new Uint8Array(l);if(!e.transcodeImage(u,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:i,height:s,data:u,compressed:o,levelSize:l,hasAlpha:r,format:a}}function cp(e,t){let n=e&&e.basis&&e.basis.format;return n==="auto"&&(n=Ti()),typeof n=="object"&&(n=t?n.alpha:n.noAlpha),n=n.toLowerCase(),nE[n]}function Ti(){let e=ip();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var lp={name:"Basis",id:"basis",module:"textures",version:rp,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},pc={...lp,parse:dc};var Ln=!0,up=1735152710,Ac=12,_i=8,iE=1313821514,oE=5130562,aE=0,cE=0,lE=1;function uE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}function hp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=new DataView(e),{magic:s=up}=n,i=r.getUint32(t,!1);return i===s||i===up}function fp(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},s=new DataView(t),i=uE(s,n+0),o=s.getUint32(n+4,Ln),a=s.getUint32(n+8,Ln);switch(Object.assign(e,{header:{byteOffset:n,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),n+=Ac,e.version){case 1:return hE(e,s,n);case 2:return fE(e,s,n,r={});default:throw new Error(`Invalid GLB version ${e.version}. Only supports version 1 and 2.`)}}function hE(e,t,n){V(e.header.byteLength>Ac+_i);let r=t.getUint32(n+0,Ln),s=t.getUint32(n+4,Ln);return n+=_i,V(s===aE),mc(e,t,n,r),n+=r,n+=gc(e,t,n,e.header.byteLength),n}function fE(e,t,n,r){return V(e.header.byteLength>Ac+_i),dE(e,t,n,r),n+e.header.byteLength}function dE(e,t,n,r){for(;n+8<=e.header.byteLength;){let s=t.getUint32(n+0,Ln),i=t.getUint32(n+4,Ln);switch(n+=_i,i){case iE:mc(e,t,n,s);break;case oE:gc(e,t,n,s);break;case cE:r.strict||mc(e,t,n,s);break;case lE:r.strict||gc(e,t,n,s);break;default:break}n+=pe(s,4)}return n}function mc(e,t,n,r){let s=new Uint8Array(t.buffer,n,r),o=new TextDecoder("utf8").decode(s);return e.json=JSON.parse(o),pe(r,4)}function gc(e,t,n,r){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:r,arrayBuffer:t.buffer}),pe(r,4)}function xc(e,t){if(e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:"))return e;let r=t.baseUri||t.uri;if(!r)throw new Error(`'baseUri' must be provided to resolve relative url ${e}`);return r.substr(0,r.lastIndexOf("/")+1)+e}var Tc={};ut(Tc,{decode:()=>bE,name:()=>CE});var pE="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",mE="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",gE=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),AE=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),xE={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},yE={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function dp(e,t,n,r,s){let i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:"NONE",o=await TE();BE(o,o.exports[yE[s]],e,t,n,r,o.exports[xE[i||"NONE"]])}var yc;async function TE(){return yc||(yc=_E()),yc}async function _E(){let e=pE;WebAssembly.validate(gE)&&(e=mE,console.log("Warning: meshopt_decoder is using experimental SIMD support"));let t=await WebAssembly.instantiate(EE(e),{});return await t.instance.exports.__wasm_call_ctors(),t.instance}function EE(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let s=e.charCodeAt(r);t[r]=s>96?s-71:s>64?s-65:s>47?s+4:s>46?63:62}let n=0;for(let r=0;r<e.length;++r)t[n++]=t[r]<60?AE[t[r]]:(t[r]-60)*64+t[++r];return t.buffer.slice(0,n)}function BE(e,t,n,r,s,i,o){let a=e.exports.sbrk,c=r+3&-4,l=a(c*s),u=a(i.length),h=new Uint8Array(e.exports.memory.buffer);h.set(i,u);let f=t(l,r,s,u,i.length);if(f===0&&o&&o(l,c,s),n.set(h.subarray(l,l+r*s)),a(l-a(0)),f!==0)throw new Error(`Malformed buffer data: ${f}`)}var Ei="EXT_meshopt_compression",CE=Ei;async function bE(e,t){var n,r;let s=new j(e);if(!(t!=null&&(n=t.gltf)!==null&&n!==void 0&&n.decompressMeshes)||!((r=t.gltf)!==null&&r!==void 0&&r.loadBuffers))return;let i=[];for(let o of e.json.bufferViews||[])i.push(SE(s,o));await Promise.all(i),s.removeExtension(Ei)}async function SE(e,t){let n=e.getObjectExtension(t,Ei);if(n){let{byteOffset:r=0,byteLength:s=0,byteStride:i,count:o,mode:a,filter:c="NONE",buffer:l}=n,u=e.gltf.buffers[l],h=new Uint8Array(u.arrayBuffer,u.byteOffset+r,s),f=new Uint8Array(e.gltf.buffers[t.buffer].arrayBuffer,t.byteOffset,t.byteLength);await dp(f,o,i,h,a,c),e.removeObjectExtension(t,Ei)}}var _c={};ut(_c,{name:()=>ME,preprocess:()=>IE});var Pn="EXT_texture_webp",ME=Pn;function IE(e,t){let n=new j(e);if(!Fo("image/webp")){if(n.getRequiredExtensions().includes(Pn))throw new Error(`gltf: Required extension ${Pn} not supported by browser`);return}let{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Pn);i&&(s.source=i.source),n.removeObjectExtension(s,Pn)}n.removeExtension(Pn)}var Ec={};ut(Ec,{name:()=>wE,preprocess:()=>vE});var Bi="KHR_texture_basisu",wE=Bi;function vE(e,t){let n=new j(e),{json:r}=n;for(let s of r.textures||[]){let i=n.getObjectExtension(s,Bi);i&&(s.source=i.source,n.removeObjectExtension(s,Bi))}n.removeExtension(Bi)}var Cc={};ut(Cc,{decode:()=>OE,encode:()=>NE,name:()=>LE,preprocess:()=>PE});function pp(e){let t={};for(let n in e){let r=e[n];if(n!=="indices"){let s=Bc(r);t[n]=s}}return t}function Bc(e){let{buffer:t,size:n,count:r}=FE(e);return{value:t,size:n,byteOffset:0,count:r,type:di(n),componentType:In(t)}}function FE(e){let t=e,n=1,r=0;return e&&e.value&&(t=e.value,n=e.size||1),t&&(ArrayBuffer.isView(t)||(t=RE(t,Float32Array)),r=t.length/n),{buffer:t,size:n,count:r}}function RE(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return e?Array.isArray(e)?new t(e):n&&!(e instanceof t)?new t(e):e:null}var we="KHR_draco_mesh_compression",LE=we;function PE(e,t,n){let r=new j(e);for(let s of mp(r))r.getObjectExtension(s,we)}async function OE(e,t,n){var r;if(!(t!=null&&(r=t.gltf)!==null&&r!==void 0&&r.decompressMeshes))return;let s=new j(e),i=[];for(let o of mp(s))s.getObjectExtension(o,we)&&i.push(DE(s,o,t,n));await Promise.all(i),s.removeExtension(we)}function NE(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new j(e);for(let r of n.json.meshes||[])UE(r,t),n.addRequiredExtension(we)}async function DE(e,t,n,r){let s=e.getObjectExtension(t,we);if(!s)return;let i=e.getTypedArrayForBufferView(s.bufferView),o=Re(i.buffer,i.byteOffset),a={...n};delete a["3d-tiles"];let c=await Ct(o,li,a,r),l=pp(c.attributes);for(let[u,h]of Object.entries(l))if(u in t.attributes){let f=t.attributes[u],d=e.getAccessor(f);d!=null&&d.min&&d!==null&&d!==void 0&&d.max&&(h.min=d.min,h.max=d.max)}t.attributes=l,c.indices&&(t.indices=Bc(c.indices)),e.removeObjectExtension(t,we),GE(t)}function UE(e,t){var n;let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:4,s=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!s.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");let o=s.DracoWriter.encodeSync({attributes:e}),a=i==null||(n=i.parseSync)===null||n===void 0?void 0:n.call(i,{attributes:e}),c=s._addFauxAttributes(a.attributes),l=s.addBufferView(o);return{primitives:[{attributes:c,mode:r,extensions:{[we]:{bufferView:l,attributes:c}}}]}}function GE(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}function*mp(e){for(let t of e.json.meshes||[])for(let n of t.primitives)yield n}var Sc={};ut(Sc,{decode:()=>kE,name:()=>VE});var bc="KHR_texture_transform",VE=bc,Ci=new x,HE=new k,zE=new k;async function kE(e,t){var n;if(!new j(e).hasExtension(bc)||!((n=t.gltf)!==null&&n!==void 0&&n.loadBuffers))return;let i=e.json.materials||[];for(let o=0;o<i.length;o++)JE(o,e)}function JE(e,t){var n,r,s;let i=[],o=(n=t.json.materials)===null||n===void 0?void 0:n[e],a=o==null||(r=o.pbrMetallicRoughness)===null||r===void 0?void 0:r.baseColorTexture;a&&Ir(t,e,a,i);let c=o?.emissiveTexture;c&&Ir(t,e,c,i);let l=o?.normalTexture;l&&Ir(t,e,l,i);let u=o?.occlusionTexture;u&&Ir(t,e,u,i);let h=o==null||(s=o.pbrMetallicRoughness)===null||s===void 0?void 0:s.metallicRoughnessTexture;h&&Ir(t,e,h,i)}function Ir(e,t,n,r){let s=qE(n,r);if(!s)return;let i=e.json.meshes||[];for(let o of i)for(let a of o.primitives){let c=a.material;Number.isFinite(c)&&t===c&&jE(e,a,s)}}function qE(e,t){var n;let r=(n=e.extensions)===null||n===void 0?void 0:n[bc],{texCoord:s=0}=e,{texCoord:i=s}=r;if(!(t.findIndex(a=>{let[c,l]=a;return c===s&&l===i})!==-1)){let a=YE(r);return s!==i&&(e.texCoord=i),t.push([s,i]),{originalTexCoord:s,texCoord:i,matrix:a}}return null}function jE(e,t,n){let{originalTexCoord:r,texCoord:s,matrix:i}=n,o=t.attributes[`TEXCOORD_${r}`];if(Number.isFinite(o)){var a;let l=(a=e.json.accessors)===null||a===void 0?void 0:a[o];if(l&&l.bufferView){var c;let u=(c=e.json.bufferViews)===null||c===void 0?void 0:c[l.bufferView];if(u){let{arrayBuffer:h,byteOffset:f}=e.buffers[u.buffer],d=(f||0)+(l.byteOffset||0)+(u.byteOffset||0),{ArrayType:p,length:A}=wn(l,u),g=fi[l.componentType],y=hi[l.type],E=u.byteStride||g*y,_=new Float32Array(A);for(let B=0;B<l.count;B++){let b=new p(h,d+B*E,2);Ci.set(b[0],b[1],1),Ci.transformByMatrix3(i),_.set([Ci[0],Ci[1]],B*y)}r===s?XE(l,u,e.buffers,_):WE(s,l,t,e,_)}}}}function XE(e,t,n,r){e.componentType=5126,n.push({arrayBuffer:r.buffer,byteOffset:0,byteLength:r.buffer.byteLength}),t.buffer=n.length-1,t.byteLength=r.buffer.byteLength,t.byteOffset=0,delete t.byteStride}function WE(e,t,n,r,s){r.buffers.push({arrayBuffer:s.buffer,byteOffset:0,byteLength:s.buffer.byteLength});let i=r.json.bufferViews;if(!i)return;i.push({buffer:r.buffers.length-1,byteLength:s.buffer.byteLength,byteOffset:0});let o=r.json.accessors;o&&(o.push({bufferView:i?.length-1,byteOffset:0,componentType:5126,count:t.count,type:"VEC2"}),n.attributes[`TEXCOORD_${e}`]=o.length-1)}function YE(e){let{offset:t=[0,0],rotation:n=0,scale:r=[1,1]}=e,s=new k().set(1,0,0,0,1,0,t[0],t[1],1),i=HE.set(Math.cos(n),Math.sin(n),0,-Math.sin(n),Math.cos(n),0,0,0,1),o=zE.set(r[0],0,0,0,r[1],0,0,0,1);return s.multiplyRight(i).multiplyRight(o)}var Mc={};ut(Mc,{decode:()=>QE,encode:()=>ZE,name:()=>KE});var Ze="KHR_lights_punctual",KE=Ze;async function QE(e){let t=new j(e),{json:n}=t,r=t.getExtension(Ze);r&&(t.json.lights=r.lights,t.removeExtension(Ze));for(let s of n.nodes||[]){let i=t.getObjectExtension(s,Ze);i&&(s.light=i.light),t.removeObjectExtension(s,Ze)}}async function ZE(e){let t=new j(e),{json:n}=t;if(n.lights){let r=t.addExtension(Ze);at(!r.lights),r.lights=n.lights,delete n.lights}if(t.json.lights){for(let r of t.json.lights){let s=r.node;t.addObjectExtension(s,Ze,r)}delete t.json.lights}}var Ic={};ut(Ic,{decode:()=>tB,encode:()=>eB,name:()=>$E});var wr="KHR_materials_unlit",$E=wr;async function tB(e){let t=new j(e),{json:n}=t;for(let r of n.materials||[])r.extensions&&r.extensions.KHR_materials_unlit&&(r.unlit=!0),t.removeObjectExtension(r,wr);t.removeExtension(wr)}function eB(e){let t=new j(e),{json:n}=t;if(t.materials)for(let r of n.materials||[])r.unlit&&(delete r.unlit,t.addObjectExtension(r,wr,{}),t.addExtension(wr))}var wc={};ut(wc,{decode:()=>rB,encode:()=>sB,name:()=>nB});var vr="KHR_techniques_webgl",nB=vr;async function rB(e){let t=new j(e),{json:n}=t,r=t.getExtension(vr);if(r){let s=iB(r,t);for(let i of n.materials||[]){let o=t.getObjectExtension(i,vr);o&&(i.technique=Object.assign({},o,s[o.technique]),i.technique.values=oB(i.technique,t)),t.removeObjectExtension(i,vr)}t.removeExtension(vr)}}async function sB(e,t){}function iB(e,t){let{programs:n=[],shaders:r=[],techniques:s=[]}=e,i=new TextDecoder;return r.forEach(o=>{if(Number.isFinite(o.bufferView))o.code=i.decode(t.getTypedArrayForBufferView(o.bufferView));else throw new Error("KHR_techniques_webgl: no shader code")}),n.forEach(o=>{o.fragmentShader=r[o.fragmentShader],o.vertexShader=r[o.vertexShader]}),s.forEach(o=>{o.program=n[o.program]}),s}function oB(e,t){let n=Object.assign({},e.values);return Object.keys(e.uniforms||{}).forEach(r=>{e.uniforms[r].value&&!(r in n)&&(n[r]=e.uniforms[r].value)}),Object.keys(n).forEach(r=>{typeof n[r]=="object"&&n[r].index!==void 0&&(n[r].texture=t.getTexture(n[r].index))}),n}var gp=[oc,rc,Tc,_c,Ec,Cc,Mc,Ic,wc,Sc,ac];function Ap(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=gp.filter(i=>yp(i.name,t));for(let i of r){var s;(s=i.preprocess)===null||s===void 0||s.call(i,e,t,n)}}async function xp(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=gp.filter(i=>yp(i.name,t));for(let i of r){var s;await((s=i.decode)===null||s===void 0?void 0:s.call(i,e,t,n))}}function yp(e,t){var n;let r=(t==null||(n=t.gltf)===null||n===void 0?void 0:n.excludeExtensions)||{};return!(e in r&&!r[e])}var vc="KHR_binary_glTF";function Tp(e){let t=new j(e),{json:n}=t;for(let r of n.images||[]){let s=t.getObjectExtension(r,vc);s&&Object.assign(r,s),t.removeObjectExtension(r,vc)}n.buffers&&n.buffers[0]&&delete n.buffers[0].uri,t.removeExtension(vc)}var _p={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},cB={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"},Fc=class{constructor(){this.idToIndexMap={animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}},this.json=void 0}normalize(t,n){this.json=t.json;let r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:console.warn(`glTF: Unknown version ${r.asset.version}`);return}if(!n.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),Tp(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(let n in _p)this._convertTopLevelObjectToArray(t,n)}_convertTopLevelObjectToArray(t,n){let r=t[n];if(!(!r||Array.isArray(r))){t[n]=[];for(let s in r){let i=r[s];i.id=i.id||s;let o=t[n].length;t[n].push(i),this.idToIndexMap[n][s]=o}}}_convertObjectIdsToArrayIndices(t){for(let n in _p)this._convertIdsToIndices(t,n);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(let n of t.textures)this._convertTextureIds(n);for(let n of t.meshes)this._convertMeshIds(n);for(let n of t.nodes)this._convertNodeIds(n);for(let n of t.scenes)this._convertSceneIds(n)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(let n of t.primitives){let{attributes:r,indices:s,material:i}=n;for(let o in r)r[o]=this._convertIdToIndex(r[o],"accessor");s&&(n.indices=this._convertIdToIndex(s,"accessor")),i&&(n.material=this._convertIdToIndex(i,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map(n=>this._convertIdToIndex(n,"node"))),t.meshes&&(t.meshes=t.meshes.map(n=>this._convertIdToIndex(n,"mesh")))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map(n=>this._convertIdToIndex(n,"node")))}_convertIdsToIndices(t,n){t[n]||(console.warn(`gltf v1: json doesn't contain attribute ${n}`),t[n]=[]);for(let r of t[n])for(let s in r){let i=r[s],o=this._convertIdToIndex(i,s);r[s]=o}}_convertIdToIndex(t,n){let r=cB[n];if(r in this.idToIndexMap){let s=this.idToIndexMap[r][t];if(!Number.isFinite(s))throw new Error(`gltf v1: failed to resolve ${n} with id ${t}`);return s}return t}_updateObjects(t){for(let n of this.json.buffers)delete n.type}_updateMaterial(t){for(let i of t.materials){var n,r,s;i.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};let o=((n=i.values)===null||n===void 0?void 0:n.tex)||((r=i.values)===null||r===void 0?void 0:r.texture2d_0)||((s=i.values)===null||s===void 0?void 0:s.diffuseTex),a=t.textures.findIndex(c=>c.id===o);a!==-1&&(i.pbrMetallicRoughness.baseColorTexture={index:a})}}};function Ep(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Fc().normalize(e,t)}async function Bp(e,t){var n,r,s;let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return lB(e,t,i,o),Ep(e,{normalize:o==null||(n=o.gltf)===null||n===void 0?void 0:n.normalize}),Ap(e,o,a),o!=null&&(r=o.gltf)!==null&&r!==void 0&&r.loadBuffers&&e.json.buffers&&await uB(e,o,a),o!=null&&(s=o.gltf)!==null&&s!==void 0&&s.loadImages&&await hB(e,o,a),await xp(e,o,a),e}function lB(e,t,n,r){if(r.uri&&(e.baseUri=r.uri),t instanceof ArrayBuffer&&!hp(t,n,r)&&(t=new TextDecoder().decode(t)),typeof t=="string")e.json=xo(t);else if(t instanceof ArrayBuffer){let o={};n=fp(o,t,n,r.glb),at(o.type==="glTF",`Invalid GLB magic string ${o.type}`),e._glb=o,e.json=o.json}else at(!1,"GLTF: must be ArrayBuffer or string");let s=e.json.buffers||[];if(e.buffers=new Array(s.length).fill(null),e._glb&&e._glb.header.hasBinChunk){let{binChunks:o}=e._glb;e.buffers[0]={arrayBuffer:o[0].arrayBuffer,byteOffset:o[0].byteOffset,byteLength:o[0].byteLength}}let i=e.json.images||[];e.images=new Array(i.length).fill({})}async function uB(e,t,n){let r=e.json.buffers||[];for(let o=0;o<r.length;++o){let a=r[o];if(a.uri){var s,i;let{fetch:c}=n;at(c);let l=xc(a.uri,t),u=await(n==null||(s=n.fetch)===null||s===void 0?void 0:s.call(n,l)),h=await(u==null||(i=u.arrayBuffer)===null||i===void 0?void 0:i.call(u));e.buffers[o]={arrayBuffer:h,byteOffset:0,byteLength:h.byteLength},delete a.uri}else e.buffers[o]===null&&(e.buffers[o]={arrayBuffer:new ArrayBuffer(a.byteLength),byteOffset:0,byteLength:a.byteLength})}}async function hB(e,t,n){let r=fB(e),s=e.json.images||[],i=[];for(let o of r)i.push(dB(e,s[o],o,t,n));return await Promise.all(i)}function fB(e){let t=new Set,n=e.json.textures||[];for(let r of n)r.source!==void 0&&t.add(r.source);return Array.from(t).sort()}async function dB(e,t,n,r,s){let i;if(t.uri&&!t.hasOwnProperty("bufferView")){let a=xc(t.uri,r),{fetch:c}=s;i=await(await c(a)).arrayBuffer(),t.bufferView={data:i}}if(Number.isFinite(t.bufferView)){let a=Yd(e.json,e.buffers,t.bufferView);i=Re(a.buffer,a.byteOffset,a.byteLength)}at(i,"glTF image has no data");let o=await Ct(i,[xe,pc],{...r,mimeType:t.mimeType,basis:r.basis||{format:Ti()}},s);o&&o[0]&&(o={compressed:!0,mipmaps:!1,width:o[0].width,height:o[0].height,data:o[0]}),e.images=e.images||[],e.images[n]=o}var $e={name:"glTF",id:"gltf",module:"gltf",version:np,extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:pB,options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0},log:console}};async function pB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;t={...$e.options,...t},t.gltf={...$e.options.gltf,...t.gltf};let{byteOffset:r=0}=t;return await Bp({},e,r,t,n)}var mB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},gB={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Lt={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},AB={magFilter:Lt.TEXTURE_MAG_FILTER,minFilter:Lt.TEXTURE_MIN_FILTER,wrapS:Lt.TEXTURE_WRAP_S,wrapT:Lt.TEXTURE_WRAP_T},xB={[Lt.TEXTURE_MAG_FILTER]:Lt.LINEAR,[Lt.TEXTURE_MIN_FILTER]:Lt.NEAREST_MIPMAP_LINEAR,[Lt.TEXTURE_WRAP_S]:Lt.REPEAT,[Lt.TEXTURE_WRAP_T]:Lt.REPEAT};function yB(){return{id:"default-sampler",parameters:xB}}function TB(e){return gB[e]}function _B(e){return mB[e]}var Rc=class{constructor(){this.baseUri="",this.jsonUnprocessed=void 0,this.json=void 0,this.buffers=[],this.images=[]}postProcess(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{json:r,buffers:s=[],images:i=[]}=t,{baseUri:o=""}=t;return at(r),this.baseUri=o,this.buffers=s,this.images=i,this.jsonUnprocessed=r,this.json=this._resolveTree(t.json,n),this.json}_resolveTree(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r={...t};return this.json=r,t.bufferViews&&(r.bufferViews=t.bufferViews.map((s,i)=>this._resolveBufferView(s,i))),t.images&&(r.images=t.images.map((s,i)=>this._resolveImage(s,i))),t.samplers&&(r.samplers=t.samplers.map((s,i)=>this._resolveSampler(s,i))),t.textures&&(r.textures=t.textures.map((s,i)=>this._resolveTexture(s,i))),t.accessors&&(r.accessors=t.accessors.map((s,i)=>this._resolveAccessor(s,i))),t.materials&&(r.materials=t.materials.map((s,i)=>this._resolveMaterial(s,i))),t.meshes&&(r.meshes=t.meshes.map((s,i)=>this._resolveMesh(s,i))),t.nodes&&(r.nodes=t.nodes.map((s,i)=>this._resolveNode(s,i)),r.nodes=r.nodes.map((s,i)=>this._resolveNodeChildren(s))),t.skins&&(r.skins=t.skins.map((s,i)=>this._resolveSkin(s,i))),t.scenes&&(r.scenes=t.scenes.map((s,i)=>this._resolveScene(s,i))),typeof this.json.scene=="number"&&r.scenes&&(r.scene=r.scenes[this.json.scene]),r}getScene(t){return this._get(this.json.scenes,t)}getNode(t){return this._get(this.json.nodes,t)}getSkin(t){return this._get(this.json.skins,t)}getMesh(t){return this._get(this.json.meshes,t)}getMaterial(t){return this._get(this.json.materials,t)}getAccessor(t){return this._get(this.json.accessors,t)}getCamera(t){return this._get(this.json.cameras,t)}getTexture(t){return this._get(this.json.textures,t)}getSampler(t){return this._get(this.json.samplers,t)}getImage(t){return this._get(this.json.images,t)}getBufferView(t){return this._get(this.json.bufferViews,t)}getBuffer(t){return this._get(this.json.buffers,t)}_get(t,n){if(typeof n=="object")return n;let r=t&&t[n];return r||console.warn(`glTF file error: Could not find ${t}[${n}]`),r}_resolveScene(t,n){return{...t,id:t.id||`scene-${n}`,nodes:(t.nodes||[]).map(r=>this.getNode(r))}}_resolveNode(t,n){let r={...t,id:t?.id||`node-${n}`};return t.mesh!==void 0&&(r.mesh=this.getMesh(t.mesh)),t.camera!==void 0&&(r.camera=this.getCamera(t.camera)),t.skin!==void 0&&(r.skin=this.getSkin(t.skin)),t.meshes!==void 0&&t.meshes.length&&(r.mesh=t.meshes.reduce((s,i)=>{let o=this.getMesh(i);return s.id=o.id,s.primitives=s.primitives.concat(o.primitives),s},{primitives:[]})),r}_resolveNodeChildren(t){return t.children&&(t.children=t.children.map(n=>this.getNode(n))),t}_resolveSkin(t,n){let r=typeof t.inverseBindMatrices=="number"?this.getAccessor(t.inverseBindMatrices):void 0;return{...t,id:t.id||`skin-${n}`,inverseBindMatrices:r}}_resolveMesh(t,n){let r={...t,id:t.id||`mesh-${n}`,primitives:[]};return t.primitives&&(r.primitives=t.primitives.map(s=>{let i={...s,attributes:{},indices:void 0,material:void 0},o=s.attributes;for(let a in o)i.attributes[a]=this.getAccessor(o[a]);return s.indices!==void 0&&(i.indices=this.getAccessor(s.indices)),s.material!==void 0&&(i.material=this.getMaterial(s.material)),i})),r}_resolveMaterial(t,n){let r={...t,id:t.id||`material-${n}`};if(r.normalTexture&&(r.normalTexture={...r.normalTexture},r.normalTexture.texture=this.getTexture(r.normalTexture.index)),r.occlusionTexture&&(r.occlusionTexture={...r.occlusionTexture},r.occlusionTexture.texture=this.getTexture(r.occlusionTexture.index)),r.emissiveTexture&&(r.emissiveTexture={...r.emissiveTexture},r.emissiveTexture.texture=this.getTexture(r.emissiveTexture.index)),r.emissiveFactor||(r.emissiveFactor=r.emissiveTexture?[1,1,1]:[0,0,0]),r.pbrMetallicRoughness){r.pbrMetallicRoughness={...r.pbrMetallicRoughness};let s=r.pbrMetallicRoughness;s.baseColorTexture&&(s.baseColorTexture={...s.baseColorTexture},s.baseColorTexture.texture=this.getTexture(s.baseColorTexture.index)),s.metallicRoughnessTexture&&(s.metallicRoughnessTexture={...s.metallicRoughnessTexture},s.metallicRoughnessTexture.texture=this.getTexture(s.metallicRoughnessTexture.index))}return r}_resolveAccessor(t,n){let r=TB(t.componentType),s=_B(t.type),i=r*s,o={...t,id:t.id||`accessor-${n}`,bytesPerComponent:r,components:s,bytesPerElement:i,value:void 0,bufferView:void 0,sparse:void 0};if(t.bufferView!==void 0&&(o.bufferView=this.getBufferView(t.bufferView)),o.bufferView){let a=o.bufferView.buffer,{ArrayType:c,byteLength:l}=wn(o,o.bufferView),u=(o.bufferView.byteOffset||0)+(o.byteOffset||0)+a.byteOffset,h=a.arrayBuffer.slice(u,u+l);o.bufferView.byteStride&&(h=this._getValueFromInterleavedBuffer(a,u,o.bufferView.byteStride,o.bytesPerElement,o.count)),o.value=new c(h)}return o}_getValueFromInterleavedBuffer(t,n,r,s,i){let o=new Uint8Array(i*s);for(let a=0;a<i;a++){let c=n+a*r;o.set(new Uint8Array(t.arrayBuffer.slice(c,c+s)),a*s)}return o.buffer}_resolveTexture(t,n){return{...t,id:t.id||`texture-${n}`,sampler:typeof t.sampler=="number"?this.getSampler(t.sampler):yB(),source:typeof t.source=="number"?this.getImage(t.source):void 0}}_resolveSampler(t,n){let r={id:t.id||`sampler-${n}`,...t,parameters:{}};for(let s in r){let i=this._enumSamplerParameter(s);i!==void 0&&(r.parameters[i]=r[s])}return r}_enumSamplerParameter(t){return AB[t]}_resolveImage(t,n){let r={...t,id:t.id||`image-${n}`,image:null,bufferView:t.bufferView!==void 0?this.getBufferView(t.bufferView):void 0},s=this.images[n];return s&&(r.image=s),r}_resolveBufferView(t,n){let r=t.buffer,s=this.buffers[r].arrayBuffer,i=this.buffers[r].byteOffset||0;return t.byteOffset&&(i+=t.byteOffset),{id:`bufferView-${n}`,...t,buffer:this.buffers[r],data:new Uint8Array(s,i,t.byteLength)}}_resolveCamera(t,n){let r={...t,id:t.id||`camera-${n}`};return r.perspective,r.orthographic,r}};function Fr(e,t){return new Rc().postProcess(e,t)}var bi={URI:0,EMBEDDED:1};function Si(e,t,n,r){e.rotateYtoZ=!0;let s=(e.byteOffset||0)+(e.byteLength||0)-n;if(s===0)throw new Error("glTF byte length must be greater than 0.");return e.gltfUpAxis=r!=null&&r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y",e.gltfArrayBuffer=Re(t,n,s),e.gltfByteOffset=0,e.gltfByteLength=s,n%4===0||console.warn(`${e.type}: embedded glb is not aligned to a 4-byte boundary.`),(e.byteOffset||0)+(e.byteLength||0)}async function Mi(e,t,n,r){let s=n?.["3d-tiles"]||{};if(EB(e,t,n),s.loadGLTF){if(!r)return;if(e.gltfUrl){let{fetch:i}=r,o=await i(e.gltfUrl,n);e.gltfArrayBuffer=await o.arrayBuffer(),e.gltfByteOffset=0}if(e.gltfArrayBuffer){let i=await Ct(e.gltfArrayBuffer,$e,n,r);e.gltf=Fr(i),e.gpuMemoryUsageInBytes=Sr(e.gltf),delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength}}}function EB(e,t,n){switch(t){case bi.URI:if(e.gltfArrayBuffer){let r=new Uint8Array(e.gltfArrayBuffer,e.gltfByteOffset),i=new TextDecoder().decode(r);e.gltfUrl=i.replace(/[\s\0]+$/,"")}delete e.gltfArrayBuffer,delete e.gltfByteOffset,delete e.gltfByteLength;break;case bi.EMBEDDED:break;default:throw new Error("b3dm: Illegal glTF format field")}}async function Cp(e,t,n,r,s){var i;n=BB(e,t,n,r,s),await Mi(e,bi.EMBEDDED,r,s);let o=e==null||(i=e.gltf)===null||i===void 0?void 0:i.extensions;return o&&o.CESIUM_RTC&&(e.rtcCenter=o.CESIUM_RTC.center),n}function BB(e,t,n,r,s){n=Ie(e,t,n),n=Sn(e,t,n),n=Mn(e,t,n,r),n=Si(e,t,n,r);let i=new le(e.featureTableJson,e.featureTableBinary);return e.rtcCenter=i.getGlobalProperty("RTC_CENTER",O.FLOAT,3),n}async function bp(e,t,n,r,s){return n=CB(e,t,n,r,s),await Mi(e,e.gltfFormat||0,r,s),n}function CB(e,t,n,r,s){var i;if(n=Ie(e,t,n),e.version!==1)throw new Error(`Instanced 3D Model version ${e.version} is not supported`);n=Sn(e,t,n);let o=new DataView(t);if(e.gltfFormat=o.getUint32(n,!0),n+=4,n=Mn(e,t,n,r),n=Si(e,t,n,r),!(e!=null&&(i=e.header)!==null&&i!==void 0&&i.featureTableJsonByteLength)||e.header.featureTableJsonByteLength===0)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");let a=new le(e.featureTableJson,e.featureTableBinary),c=a.getGlobalProperty("INSTANCES_LENGTH");if(a.featuresLength=c,!Number.isFinite(c))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");e.eastNorthUp=a.getGlobalProperty("EAST_NORTH_UP"),e.rtcCenter=a.getGlobalProperty("RTC_CENTER",O.FLOAT,3);let l=new Ke(e.batchTableJson,e.batchTableBinary,c);return bB(e,a,l,c),n}function bB(e,t,n,r){let s=new Array(r),i=new x,o=new x,a=new x,c=new x,l=new k,u=new Kt,h=new x,f={},d=new P,p=[],A=[],g=[],y=[];for(let E=0;E<r;E++){let _;if(t.hasProperty("POSITION"))_=t.getProperty("POSITION",O.FLOAT,3,E,i);else if(t.hasProperty("POSITION_QUANTIZED")){_=t.getProperty("POSITION_QUANTIZED",O.UNSIGNED_SHORT,3,E,i);let m=t.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",O.FLOAT,3);if(!m)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");let M=t.getGlobalProperty("QUANTIZED_VOLUME_SCALE",O.FLOAT,3);if(!M)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");let F=65535;for(let R=0;R<3;R++)_[R]=_[R]/F*M[R]+m[R]}if(!_)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");i.copy(_),f.translation=i,e.normalUp=t.getProperty("NORMAL_UP",O.FLOAT,3,E,p),e.normalRight=t.getProperty("NORMAL_RIGHT",O.FLOAT,3,E,A);let B=!1;if(e.normalUp){if(!e.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");e.hasCustomOrientation=!0}else{if(e.octNormalUp=t.getProperty("NORMAL_UP_OCT32P",O.UNSIGNED_SHORT,2,E,p),e.octNormalRight=t.getProperty("NORMAL_RIGHT_OCT32P",O.UNSIGNED_SHORT,2,E,A),e.octNormalUp)throw e.octNormalRight?new Error("i3dm: oct-encoded orientation not implemented"):new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");e.eastNorthUp?(U.WGS84.eastNorthUpToFixedFrame(i,d),d.getRotationMatrix3(l)):l.identity()}B&&(c.copy(o).cross(a).normalize(),l.setColumn(0,o),l.setColumn(1,a),l.setColumn(2,c)),u.fromMatrix3(l),f.rotation=u,h.set(1,1,1);let b=t.getProperty("SCALE",O.FLOAT,1,E,g);Number.isFinite(b)&&h.multiplyByScalar(b);let S=t.getProperty("SCALE_NON_UNIFORM",O.FLOAT,3,E,p);S&&h.scale(S),f.scale=h;let w=t.getProperty("BATCH_ID",O.UNSIGNED_SHORT,1,E,y);w===void 0&&(w=E);let C=new P().fromQuaternion(f.rotation);d.identity(),d.translate(f.translation),d.multiplyRight(C),d.scale(f.scale);let T=d.clone();s[E]={modelMatrix:T,batchId:w}}e.instances=s}async function Sp(e,t,n,r,s,i){n=Ie(e,t,n);let o=new DataView(t);for(e.tilesLength=o.getUint32(n,!0),n+=4,e.tiles=[];e.tiles.length<e.tilesLength&&(e.byteLength||0)-n>12;){let a={shape:"tile3d"};e.tiles.push(a),n=await i(t,n,r,s,a)}return n}async function Mp(e,t,n,r){var s,i;if(e.rotateYtoZ=!0,e.gltfUpAxis=n!=null&&(s=n["3d-tiles"])!==null&&s!==void 0&&s.assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",n!=null&&(i=n["3d-tiles"])!==null&&i!==void 0&&i.loadGLTF){if(!r)return t.byteLength;let o=await Ct(t,$e,n,r);e.gltf=Fr(o),e.gpuMemoryUsageInBytes=Sr(e.gltf)}else e.gltfArrayBuffer=t;return t.byteLength}async function Lc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{shape:"tile3d"};switch(s.byteOffset=t,s.type=Sd(e,t),s.type){case We.COMPOSITE:return await Sp(s,e,t,n,r,Lc);case We.BATCHED_3D_MODEL:return await Cp(s,e,t,n,r);case We.GLTF:return await Mp(s,e,n,r);case We.INSTANCED_3D_MODEL:return await bp(s,e,t,n,r);case We.POINT_CLOUD:return await Xd(s,e,t,n,r);default:throw new Error(`3DTileLoader: unknown type ${s.type}`)}}async function Pc(e,t,n){if(new Uint32Array(e.slice(0,4))[0]!==1952609651)throw new Error("Wrong subtree file magic number");if(new Uint32Array(e.slice(4,8))[0]!==1)throw new Error("Wrong subtree file verson, must be 1");let i=Ip(e.slice(8,16)),o=new Uint8Array(e,24,i),c=new TextDecoder("utf8").decode(o),l=JSON.parse(c),u=Ip(e.slice(16,24)),h=new ArrayBuffer(0);if(u&&(h=e.slice(24+i)),await Ii(l,l.tileAvailability,h,n),Array.isArray(l.contentAvailability))for(let f of l.contentAvailability)await Ii(l,f,h,n);else await Ii(l,l.contentAvailability,h,n);return await Ii(l,l.childSubtreeAvailability,h,n),l}async function Ii(e,t,n,r){let s=Number.isFinite(t.bitstream)?t.bitstream:t.bufferView;if(typeof s!="number")return;let i=e.bufferViews[s],o=e.buffers[i.buffer];if(!(r!=null&&r.baseUrl))throw new Error("Url is not provided");if(!r.fetch)throw new Error("fetch is not provided");if(o.uri){let c=`${r?.baseUrl||""}/${o.uri}`,u=await(await r.fetch(c)).arrayBuffer();t.explicitBitstream=new Uint8Array(u,i.byteOffset,i.byteLength);return}let a=e.buffers.slice(0,i.buffer).reduce((c,l)=>c+l.byteLength,0);t.explicitBitstream=new Uint8Array(n.slice(a,a+o.byteLength),i.byteOffset,i.byteLength)}function Ip(e){let t=new DataView(e),n=t.getUint32(0,!0),r=t.getUint32(4,!0);return n+2**32*r}var wi={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:ci,extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:Pc,options:{}};var om=N(_n(),1);var nm=N(_n(),1);var vi=globalThis,SB=globalThis.document||{},Fi=globalThis.process||{},MB=globalThis.console,YD=globalThis.navigator||{};function wp(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function tn(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||wp()}var Oc="4.0.7";function wB(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Ri=class{constructor(t,n,r="sessionStorage"){this.storage=wB(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function vp(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Fp(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}var Li;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Li||(Li={}));var vB=10;function Rp(e){return typeof e!="string"?e:(e=e.toUpperCase(),Li[e]||Li.WHITE)}function Lp(e,t,n){return!tn&&typeof e=="string"&&(t&&(e=`\x1B[${Rp(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${Rp(n)+vB}m${e}\x1B[49m`)),e}function Pp(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),s=e;for(let i of r){let o=s[i];typeof o=="function"&&(t.find(a=>i===a)||(s[i]=o.bind(e)))}}function Rr(e,t){if(!e)throw new Error(t||"Assertion failed")}function en(){let e;if(tn()&&vi.performance)e=vi?.performance?.now?.();else if("hrtime"in Fi){let t=Fi?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var On={debug:tn()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},FB={enabled:!0,level:0};function Nn(){}var Op={},Np={once:!0},Lr=class{constructor({id:t}={id:""}){this.VERSION=Oc,this._startTs=en(),this._deltaTs=en(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Ri(`__probe-${this.id}__`,FB),this.timeStamp(`${this.id} started`),Pp(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((en()-this._startTs).toPrecision(10))}getDelta(){return Number((en()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,On.warn,arguments,Np)}error(t){return this._getLogFunction(0,t,On.error,arguments)}deprecated(t,n){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(t,n){return this.error(`\`${t}\` has been removed. Use \`${n}\` instead`)}probe(t,n){return this._getLogFunction(t,n,On.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,On.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,On.debug||On.info,arguments,Np)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||Nn,r&&[r],{tag:LB(n)}):Nn}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||Nn)}group(t,n,r={collapsed:!1}){let s=Dp({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Nn)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Up(t)}_getLogFunction(t,n,r,s,i){if(this._shouldLog(t)){i=Dp({logLevel:t,message:n,args:s,opts:i}),r=r||i.method,Rr(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=en();let o=i.tag||i.message;if(i.once&&o)if(!Op[o])Op[o]=en();else return Nn;return n=RB(this.id,i.message,i),r.bind(console,n,...i.args)}return Nn}};Lr.VERSION=Oc;function Up(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Rr(Number.isFinite(t)&&t>=0),t}function Dp(e){let{logLevel:t,message:n}=e;e.logLevel=Up(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let s=typeof e.message;return Rr(s==="string"||s==="object"),Object.assign(e,{args:r},e.opts)}function RB(e,t,n){if(typeof t=="string"){let r=n.time?Fp(vp(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Lp(t,n.color,n.background)}return t}function LB(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var Nc=new Lr({id:"@probe.gl/log"});var Pt=null;try{Pt=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Q(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}Q.prototype.__isLong__;Object.defineProperty(Q.prototype,"__isLong__",{value:!0});function pt(e){return(e&&e.__isLong__)===!0}function Gp(e){var t=Math.clz32(e&-e);return e?31-t:t}Q.isLong=pt;var Vp={},Hp={};function nn(e,t){var n,r,s;return t?(e>>>=0,(s=0<=e&&e<256)&&(r=Hp[e],r)?r:(n=H(e,0,!0),s&&(Hp[e]=n),n)):(e|=0,(s=-128<=e&&e<128)&&(r=Vp[e],r)?r:(n=H(e,e<0?-1:0,!1),s&&(Vp[e]=n),n))}Q.fromInt=nn;function Ot(e,t){if(isNaN(e))return t?ue:kt;if(t){if(e<0)return ue;if(e>=qp)return Wp}else{if(e<=-kp)return Bt;if(e+1>=kp)return Xp}return e<0?Ot(-e,t).neg():H(e%Un|0,e/Un|0,t)}Q.fromNumber=Ot;function H(e,t,n){return new Q(e,t,n)}Q.fromBits=H;var Pi=Math.pow;function Uc(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?ue:kt;if(n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return Uc(e.substring(1),t,n).neg();for(var s=Ot(Pi(n,8)),i=kt,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+a),n);if(a<8){var l=Ot(Pi(n,a));i=i.mul(l).add(Ot(c))}else i=i.mul(s),i=i.add(Ot(c))}return i.unsigned=t,i}Q.fromString=Uc;function Jt(e,t){return typeof e=="number"?Ot(e,t):typeof e=="string"?Uc(e,t):H(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Q.fromValue=Jt;var zp=1<<16,PB=1<<24,Un=zp*zp,qp=Un*Un,kp=qp/2,Jp=nn(PB),kt=nn(0);Q.ZERO=kt;var ue=nn(0,!0);Q.UZERO=ue;var Dn=nn(1);Q.ONE=Dn;var jp=nn(1,!0);Q.UONE=jp;var Dc=nn(-1);Q.NEG_ONE=Dc;var Xp=H(-1,2147483647,!1);Q.MAX_VALUE=Xp;var Wp=H(-1,-1,!0);Q.MAX_UNSIGNED_VALUE=Wp;var Bt=H(0,-2147483648,!1);Q.MIN_VALUE=Bt;var I=Q.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low};I.toNumber=function(){return this.unsigned?(this.high>>>0)*Un+(this.low>>>0):this.high*Un+(this.low>>>0)};I.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(Bt)){var n=Ot(t),r=this.div(n),s=r.mul(n).sub(this);return r.toString(t)+s.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var i=Ot(Pi(t,6),this.unsigned),o=this,a="";;){var c=o.div(i),l=o.sub(c.mul(i)).toInt()>>>0,u=l.toString(t);if(o=c,o.isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}};I.getHighBits=function(){return this.high};I.getHighBitsUnsigned=function(){return this.high>>>0};I.getLowBits=function(){return this.low};I.getLowBitsUnsigned=function(){return this.low>>>0};I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Bt)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);n--);return this.high!=0?n+33:n+1};I.isZero=function(){return this.high===0&&this.low===0};I.eqz=I.isZero;I.isNegative=function(){return!this.unsigned&&this.high<0};I.isPositive=function(){return this.unsigned||this.high>=0};I.isOdd=function(){return(this.low&1)===1};I.isEven=function(){return(this.low&1)===0};I.equals=function(t){return pt(t)||(t=Jt(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};I.eq=I.equals;I.notEquals=function(t){return!this.eq(t)};I.neq=I.notEquals;I.ne=I.notEquals;I.lessThan=function(t){return this.comp(t)<0};I.lt=I.lessThan;I.lessThanOrEqual=function(t){return this.comp(t)<=0};I.lte=I.lessThanOrEqual;I.le=I.lessThanOrEqual;I.greaterThan=function(t){return this.comp(t)>0};I.gt=I.greaterThan;I.greaterThanOrEqual=function(t){return this.comp(t)>=0};I.gte=I.greaterThanOrEqual;I.ge=I.greaterThanOrEqual;I.compare=function(t){if(pt(t)||(t=Jt(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};I.comp=I.compare;I.negate=function(){return!this.unsigned&&this.eq(Bt)?Bt:this.not().add(Dn)};I.neg=I.negate;I.add=function(t){pt(t)||(t=Jt(t));var n=this.high>>>16,r=this.high&65535,s=this.low>>>16,i=this.low&65535,o=t.high>>>16,a=t.high&65535,c=t.low>>>16,l=t.low&65535,u=0,h=0,f=0,d=0;return d+=i+l,f+=d>>>16,d&=65535,f+=s+c,h+=f>>>16,f&=65535,h+=r+a,u+=h>>>16,h&=65535,u+=n+o,u&=65535,H(f<<16|d,u<<16|h,this.unsigned)};I.subtract=function(t){return pt(t)||(t=Jt(t)),this.add(t.neg())};I.sub=I.subtract;I.multiply=function(t){if(this.isZero())return this;if(pt(t)||(t=Jt(t)),Pt){var n=Pt.mul(this.low,this.high,t.low,t.high);return H(n,Pt.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?ue:kt;if(this.eq(Bt))return t.isOdd()?Bt:kt;if(t.eq(Bt))return this.isOdd()?Bt:kt;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(Jp)&&t.lt(Jp))return Ot(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,s=this.high&65535,i=this.low>>>16,o=this.low&65535,a=t.high>>>16,c=t.high&65535,l=t.low>>>16,u=t.low&65535,h=0,f=0,d=0,p=0;return p+=o*u,d+=p>>>16,p&=65535,d+=i*u,f+=d>>>16,d&=65535,d+=o*l,f+=d>>>16,d&=65535,f+=s*u,h+=f>>>16,f&=65535,f+=i*l,h+=f>>>16,f&=65535,f+=o*c,h+=f>>>16,f&=65535,h+=r*u+s*l+i*c+o*a,h&=65535,H(d<<16|p,h<<16|f,this.unsigned)};I.mul=I.multiply;I.divide=function(t){if(pt(t)||(t=Jt(t)),t.isZero())throw Error("division by zero");if(Pt){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?Pt.div_u:Pt.div_s)(this.low,this.high,t.low,t.high);return H(n,Pt.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?ue:kt;var r,s,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return ue;if(t.gt(this.shru(1)))return jp;i=ue}else{if(this.eq(Bt)){if(t.eq(Dn)||t.eq(Dc))return Bt;if(t.eq(Bt))return Dn;var o=this.shr(1);return r=o.div(t).shl(1),r.eq(kt)?t.isNegative()?Dn:Dc:(s=this.sub(t.mul(r)),i=r.add(s.div(t)),i)}else if(t.eq(Bt))return this.unsigned?ue:kt;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=kt}for(s=this;s.gte(t);){r=Math.max(1,Math.floor(s.toNumber()/t.toNumber()));for(var a=Math.ceil(Math.log(r)/Math.LN2),c=a<=48?1:Pi(2,a-48),l=Ot(r),u=l.mul(t);u.isNegative()||u.gt(s);)r-=c,l=Ot(r,this.unsigned),u=l.mul(t);l.isZero()&&(l=Dn),i=i.add(l),s=s.sub(u)}return i};I.div=I.divide;I.modulo=function(t){if(pt(t)||(t=Jt(t)),Pt){var n=(this.unsigned?Pt.rem_u:Pt.rem_s)(this.low,this.high,t.low,t.high);return H(n,Pt.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};I.mod=I.modulo;I.rem=I.modulo;I.not=function(){return H(~this.low,~this.high,this.unsigned)};I.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};I.clz=I.countLeadingZeros;I.countTrailingZeros=function(){return this.low?Gp(this.low):Gp(this.high)+32};I.ctz=I.countTrailingZeros;I.and=function(t){return pt(t)||(t=Jt(t)),H(this.low&t.low,this.high&t.high,this.unsigned)};I.or=function(t){return pt(t)||(t=Jt(t)),H(this.low|t.low,this.high|t.high,this.unsigned)};I.xor=function(t){return pt(t)||(t=Jt(t)),H(this.low^t.low,this.high^t.high,this.unsigned)};I.shiftLeft=function(t){return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):H(0,this.low<<t-32,this.unsigned)};I.shl=I.shiftLeft;I.shiftRight=function(t){return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):H(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};I.shr=I.shiftRight;I.shiftRightUnsigned=function(t){return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?H(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?H(this.high,0,this.unsigned):H(this.high>>>t-32,0,this.unsigned)};I.shru=I.shiftRightUnsigned;I.shr_u=I.shiftRightUnsigned;I.rotateLeft=function(t){var n;return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(n=32-t,H(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,H(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};I.rotl=I.rotateLeft;I.rotateRight=function(t){var n;return pt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?H(this.high,this.low,this.unsigned):t<32?(n=32-t,H(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,H(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};I.rotr=I.rotateRight;I.toSigned=function(){return this.unsigned?H(this.low,this.high,!1):this};I.toUnsigned=function(){return this.unsigned?this:H(this.low,this.high,!0)};I.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};I.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};I.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};Q.fromBytes=function(t,n,r){return r?Q.fromBytesLE(t,n):Q.fromBytesBE(t,n)};Q.fromBytesLE=function(t,n){return new Q(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};Q.fromBytesBE=function(t,n){return new Q(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var Gn=Q;var OB=16;function Pr(e){e==="X"&&(e="");let t=e.padEnd(OB,"0");return Gn.fromString(t,!0,16)}function Gc(e){if(e.isZero())return"X";let t=e.countTrailingZeros(),n=t%4;t=(t-n)/4;let r=t;t*=4;let i=e.shiftRightUnsigned(t).toString(16).replace(/0+$/,"");return Array(17-r-i.length).join("0")+i}function Vc(e,t){let n=NB(e).shiftRightUnsigned(2);return e.add(Gn.fromNumber(2*t+1-4).multiply(n))}function NB(e){return e.and(e.not().add(1))}var DB=3,UB=30,GB=2*UB+1,Yp=180/Math.PI;function Qp(e){if(e.length===0)throw new Error(`Invalid Hilbert quad key ${e}`);let t=e.split("/"),n=parseInt(t[0],10),r=t[1],s=r.length,i=0,o=[0,0];for(let a=s-1;a>=0;a--){i=s-a;let c=r[a],l=0,u=0;c==="1"?u=1:c==="2"?(l=1,u=1):c==="3"&&(l=1);let h=Math.pow(2,i-1);VB(h,o,l,u),o[0]+=h*l,o[1]+=h*u}if(n%2===1){let a=o[0];o[0]=o[1],o[1]=a}return{face:n,ij:o,level:i}}function Zp(e){if(e.isZero())return"";let t=e.toString(2);for(;t.length<DB+GB;)t="0"+t;let n=t.lastIndexOf("1"),r=t.substring(0,3),s=t.substring(3,n),i=s.length/2,o=Gn.fromString(r,!0,2).toString(10),a="";if(i!==0)for(a=Gn.fromString(s,!0,2).toString(4);a.length<i;)a="0"+a;return`${o}/${a}`}function Hc(e,t,n){let r=1<<t;return[(e[0]+n[0])/r,(e[1]+n[1])/r]}function Kp(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function zc(e){return[Kp(e[0]),Kp(e[1])]}function kc(e,t){let[n,r]=t;switch(e){case 0:return[1,n,r];case 1:return[-n,1,r];case 2:return[-n,-r,1];case 3:return[-1,-r,-n];case 4:return[r,-1,-n];case 5:return[r,n,-1];default:throw new Error("Invalid face")}}function Jc(e){let[t,n,r]=e,s=Math.atan2(r,Math.sqrt(t*t+n*n));return[Math.atan2(n,t)*Yp,s*Yp]}function VB(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let s=t[0];t[0]=t[1],t[1]=s}}function $p(e){let t=Hc(e.ij,e.level,[.5,.5]),n=zc(t),r=kc(e.face,n);return Jc(r)}var HB=100;function qc(e){let{face:t,ij:n,level:r}=e,s=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(HB*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),a=0,c=0;for(let l=0;l<4;l++){let u=s[l].slice(0),h=s[l+1],f=(h[0]-u[0])/i,d=(h[1]-u[1])/i;for(let p=0;p<i;p++){u[0]+=f,u[1]+=d;let A=Hc(n,r,u),g=zc(A),y=kc(t,g),E=Jc(y);Math.abs(E[1])>89.999&&(E[0]=c);let _=E[0]-c;E[0]+=_>180?-360:_<-180?360:0,o[a++]=E[0],o[a++]=E[1],c=E[0]}}return o[a++]=o[0],o[a++]=o[1],o}function Vn(e){let t=zB(e);return Qp(t)}function zB(e){if(e.indexOf("/")>0)return e;let t=Pr(e);return Zp(t)}function jc(e){let t=Vn(e);return $p(t)}function em(e){let t;if(e.face===2||e.face===5){let n=null,r=0;for(let s=0;s<4;s++){let i=`${e.face}/${s}`,o=Vn(i),a=qc(o);(typeof n>"u"||n===null)&&(n=new Float64Array(4*a.length)),n.set(a,r),r+=a.length}t=tm(n)}else{let n=qc(e);t=tm(n)}return t}function tm(e){if(e.length%2!==0)throw new Error("Invalid corners");let t=[],n=[];for(let r=0;r<e.length;r+=2)t.push(e[r]),n.push(e[r+1]);return t.sort((r,s)=>r-s),n.sort((r,s)=>r-s),{west:t[0],east:t[t.length-1],north:n[n.length-1],south:n[0]}}function Xc(e,t){let n=t?.minimumHeight||0,r=t?.maximumHeight||0,s=Vn(e),i=em(s),o=i.west,a=i.south,c=i.east,l=i.north,u=[];return u.push(new x(o,l,n)),u.push(new x(c,l,n)),u.push(new x(c,a,n)),u.push(new x(o,a,n)),u.push(new x(o,l,r)),u.push(new x(c,l,r)),u.push(new x(c,a,r)),u.push(new x(o,a,r)),u}function Oi(e){let t=e.token,n={minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight},r=Xc(t,n),s=jc(t),i=s[0],o=s[1],a=U.WGS84.cartographicToCartesian([i,o,n.maximumHeight]),c=new x(a[0],a[1],a[2]);r.push(c);let l=fr(r);return[...l.center,...l.halfAxes]}var kB=4,JB=8,qB={QUADTREE:kB,OCTREE:JB};function jB(e,t,n){if(e!=null&&e.box){let r=Pr(e.s2VolumeInfo.token),s=Vc(r,t),i=Gc(s),o={...e.s2VolumeInfo};switch(o.token=i,n){case"OCTREE":let l=e.s2VolumeInfo,u=l.maximumHeight-l.minimumHeight,h=u/2,f=l.minimumHeight+u/2;l.minimumHeight=f-h,l.maximumHeight=f+h;break;default:break}return{box:Oi(o),s2VolumeInfo:o}}}async function Yc(e){let{implicitOptions:t,parentData:n={mortonIndex:0,x:0,y:0,z:0},childIndex:r=0,s2VolumeBox:s,loaderOptions:i}=e,{subtree:o,level:a=0,globalData:c={level:0,mortonIndex:0,x:0,y:0,z:0}}=e,{subdivisionScheme:l,subtreeLevels:u,maximumLevel:h,contentUrlTemplate:f,subtreesUriTemplate:d,basePath:p}=t,A={children:[],lodMetricValue:0,contentUrl:""};if(!h)return Nc.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${f} won't be loaded...`),A;let g=a+c.level;if(g>h)return A;let y=qB[l],E=Math.log2(y),_=r&1,B=r>>1&1,b=r>>2&1,S=(y**a-1)/(y-1),w=rn(n.mortonIndex,r,E),C=S+w,T=rn(n.x,_,1),m=rn(n.y,B,1),M=rn(n.z,b,1),F=!1;a>=u&&(F=Wc(o.childSubtreeAvailability,w));let R=rn(c.x,T,a),v=rn(c.y,m,a),D=rn(c.z,M,a);if(F){let Y=`${p}/${d}`,tt=Ni(Y,g,R,v,D);o=await(0,nm.load)(tt,wi,i),c={mortonIndex:w,x:T,y:m,z:M,level:a},w=0,C=0,T=0,m=0,M=0,a=0}if(!Wc(o.tileAvailability,C))return A;Wc(o.contentAvailability,C)&&(A.contentUrl=Ni(f,g,R,v,D));let Z=a+1,X={mortonIndex:w,x:T,y:m,z:M};for(let Y=0;Y<y;Y++){let tt=jB(s,Y,l),xt=await Yc({subtree:o,implicitOptions:t,loaderOptions:i,parentData:X,childIndex:Y,level:Z,globalData:{...c},s2VolumeBox:tt});if(xt.contentUrl||xt.children.length){let rg=g+1,sg=XB(xt,rg,{childTileX:T,childTileY:m,childTileZ:M},t,s);A.children.push(sg)}}return A}function Wc(e,t){let n;return Array.isArray(e)?(n=e[0],e.length>1&&Nc.once('Not supported extension "3DTILES_multiple_contents" has been detected')):n=e,"constant"in n?Boolean(n.constant):n.explicitBitstream?KB(t,n.explicitBitstream):!1}function XB(e,t,n,r,s){let{basePath:i,refine:o,getRefine:a,lodMetricType:c,getTileType:l,rootLodMetricValue:u,rootBoundingVolume:h}=r,f=e.contentUrl&&e.contentUrl.replace(`${i}/`,""),d=u/2**t,p=s!=null&&s.box?{box:s.box}:h,A=WB(t,p,n);return{children:e.children,contentUrl:e.contentUrl,content:{uri:f},id:e.contentUrl,refine:a(o),type:l(e),lodMetricType:c,lodMetricValue:d,geometricError:d,transform:e.transform,boundingVolume:A}}function WB(e,t,n){if(t.region){let{childTileX:r,childTileY:s,childTileZ:i}=n,[o,a,c,l,u,h]=t.region,f=2**e,d=(c-o)/f,p=(l-a)/f,A=(h-u)/f,[g,y]=[o+d*r,o+d*(r+1)],[E,_]=[a+p*s,a+p*(s+1)],[B,b]=[u+A*i,u+A*(i+1)];return{region:[g,E,y,_,B,b]}}if(t.box)return t;throw new Error(`Unsupported bounding volume type ${t}`)}function rn(e,t,n){return(e<<n)+t}function Ni(e,t,n,r,s){let i=YB({level:t,x:n,y:r,z:s});return e.replace(/{level}|{x}|{y}|{z}/gi,o=>i[o])}function YB(e){let t={};for(let n in e)t[`{${n}}`]=e[n];return t}function KB(e,t){let n=Math.floor(e/8),r=e%8;return(t[n]>>r&1)===1}function Qc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(!t)return te.EMPTY;let r=t.split("?")[0].split(".").pop();switch(r){case"pnts":return te.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return te.SCENEGRAPH;default:return r||te.EMPTY}}function Zc(e){switch(e){case"REPLACE":case"replace":return Tt.REPLACE;case"ADD":case"add":return Tt.ADD;default:return e}}function Kc(e,t){if(/^[a-z][0-9a-z+.-]*:/i.test(t)){let r=new URL(e,`${t}/`);return decodeURI(r.toString())}else if(e.startsWith("/"))return e;return Ae.resolve(t,e)}function rm(e,t){if(!e)return null;let n;if(e.content){var r;let i=e.content.uri||((r=e.content)===null||r===void 0?void 0:r.url);typeof i<"u"&&(n=Kc(i,t))}return{...e,id:n,contentUrl:n,lodMetricType:qe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Qc(e,n),refine:Zc(e.refine)}}async function am(e,t,n){let r=null,s=im(e.root);s&&e.root?r=await sm(e.root,e,t,s,n):r=rm(e.root,t);let i=[];for(i.push(r);i.length>0;){let o=i.pop()||{},a=o.children||[],c=[];for(let l of a){let u=im(l),h;u?h=await sm(l,e,t,u,n):h=rm(l,t),h&&(c.push(h),i.push(h))}o.children=c}return r}async function sm(e,t,n,r,s){var i,o,a;let{subdivisionScheme:c,maximumLevel:l,availableLevels:u,subtreeLevels:h,subtrees:{uri:f}}=r,d=Ni(f,0,0,0,0),p=Kc(d,n),A=await(0,om.load)(p,wi,s),g=(i=e.content)===null||i===void 0?void 0:i.uri,y=g?Kc(g,n):"",E=t==null||(o=t.root)===null||o===void 0?void 0:o.refine,_=e.geometricError,B=(a=e.boundingVolume.extensions)===null||a===void 0?void 0:a["3DTILES_bounding_volume_S2"];if(B){let C={box:Oi(B),s2VolumeInfo:B};e.boundingVolume=C}let b=e.boundingVolume,S={contentUrlTemplate:y,subtreesUriTemplate:f,subdivisionScheme:c,subtreeLevels:h,maximumLevel:Number.isFinite(u)?u-1:l,refine:E,basePath:n,lodMetricType:qe.GEOMETRIC_ERROR,rootLodMetricValue:_,rootBoundingVolume:b,getTileType:Qc,getRefine:Zc};return await QB(e,n,A,S,s)}async function QB(e,t,n,r,s){if(!e)return null;let{children:i,contentUrl:o}=await Yc({subtree:n,implicitOptions:r,loaderOptions:s}),a,c=null;return o&&(a=o,c={uri:o.replace(`${t}/`,"")}),{...e,id:a,contentUrl:a,lodMetricType:qe.GEOMETRIC_ERROR,lodMetricValue:e.geometricError,transformMatrix:e.transform,type:Qc(e,a),refine:Zc(e.refine),content:c||e.content,children:i}}function im(e){var t;return(e==null||(t=e.extensions)===null||t===void 0?void 0:t["3DTILES_implicit_tiling"])||e?.implicitTiling}var Di={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:ci,extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:ZB,options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};async function ZB(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=t["3d-tiles"]||{},s;return r.isTileset==="auto"?s=n?.url&&n.url.indexOf(".json")!==-1:s=r.isTileset,s?$B(e,t,n):tC(e,t,n)}async function $B(e,t,n){var r;let s=JSON.parse(new TextDecoder().decode(e)),i=n?.url||"",o=eC(i),a=await am(s,o,t||{});return{...s,shape:"tileset3d",loader:Di,url:i,queryString:n?.queryString||"",basePath:o,root:a||s.root,type:ht.TILES3D,lodMetricType:qe.GEOMETRIC_ERROR,lodMetricValue:((r=s.root)===null||r===void 0?void 0:r.geometricError)||0}}async function tC(e,t,n){let r={content:{shape:"tile3d",featureIds:null}};return await Lc(e,0,t,n,r.content),r.content}function eC(e){return Ae.dirname(e)}var cm=[0],nC={getPointColor:{type:"accessor",value:[0,0,0,255]},pointSize:1,data:"",loader:Di,onTilesetLoad:{type:"function",value:e=>{}},onTileLoad:{type:"function",value:e=>{}},onTileUnload:{type:"function",value:e=>{}},onTileError:{type:"function",value:(e,t,n)=>{}},_getMeshColor:{type:"function",value:e=>[255,255,255]}},Ui=class extends ve.CompositeLayer{initializeState(){"onTileLoadFail"in this.props&&ve.log.removed("onTileLoadFail","onTileError")(),this.state={layerMap:{},tileset3d:null,activeViewports:{},lastUpdatedViewports:null}}get isLoaded(){return Boolean(this.state?.tileset3d?.isLoaded()&&super.isLoaded)}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({props:t,oldProps:n,changeFlags:r}){if(t.data&&t.data!==n.data&&this._loadTileset(t.data),r.viewportChanged){let{activeViewports:s}=this.state;Object.keys(s).length&&(this._updateTileset(s),this.state.lastUpdatedViewports=s,this.state.activeViewports={})}if(r.propsChanged){let{layerMap:s}=this.state;for(let i in s)s[i].needsUpdate=!0}}activateViewport(t){let{activeViewports:n,lastUpdatedViewports:r}=this.state;this.internalState.viewport=t,n[t.id]=t;let s=r?.[t.id];(!s||!t.equals(s))&&(this.setChangeFlags({viewportChanged:!0}),this.setNeedsUpdate())}getPickingInfo({info:t,sourceLayer:n}){let r=n&&n.props.tile;return t.picked&&(t.object=r),t.sourceTile=r,t}filterSubLayer({layer:t,viewport:n}){let{tile:r}=t.props,{id:s}=n;return r.selected&&r.viewportIds.includes(s)}_updateAutoHighlight(t){let n=t.sourceTile,r=this.state.layerMap[n?.id];r&&r.layer&&r.layer.updateAutoHighlight(t)}async _loadTileset(t){let{loadOptions:n={}}=this.props,r=this.props.loader||this.props.loaders,s=Array.isArray(r)?r[0]:r,i={loadOptions:{...n}},o=t;if(s.preload){let l=await s.preload(t,n);l.url&&(o=l.url),l.headers&&(i.loadOptions.fetch={...i.loadOptions.fetch,headers:l.headers}),Object.assign(i,l)}let a=await(0,fm.load)(o,s,i.loadOptions),c=new Br(a,{onTileLoad:this._onTileLoad.bind(this),onTileUnload:this._onTileUnload.bind(this),onTileError:this.props.onTileError,...i});this.setState({tileset3d:c,layerMap:{}}),this._updateTileset(this.state.activeViewports),this.props.onTilesetLoad(c)}_onTileLoad(t){let{lastUpdatedViewports:n}=this.state;this.props.onTileLoad(t),this._updateTileset(n),this.setNeedsUpdate()}_onTileUnload(t){delete this.state.layerMap[t.id],this.props.onTileUnload(t)}_updateTileset(t){if(!t)return;let{tileset3d:n}=this.state,{timeline:r}=this.context,s=Object.keys(t).length;!r||!s||!n||n.selectTiles(Object.values(t)).then(i=>{this.state.frameNumber!==i&&this.setState({frameNumber:i})})}_getSubLayer(t,n){if(!t.content)return null;switch(t.type){case te.POINTCLOUD:return this._makePointCloudLayer(t,n);case te.SCENEGRAPH:return this._make3DModelLayer(t);case te.MESH:return this._makeSimpleMeshLayer(t,n);default:throw new Error(`Tile3DLayer: Failed to render layer of type ${t.content.type}`)}}_makePointCloudLayer(t,n){let{attributes:r,pointCount:s,constantRGBA:i,cartographicOrigin:o,modelMatrix:a}=t.content,{positions:c,normals:l,colors:u}=r;if(!c)return null;let h=n&&n.props.data||{header:{vertexCount:s},attributes:{POSITION:c,NORMAL:l,COLOR_0:u}},{pointSize:f,getPointColor:d}=this.props,p=this.getSubLayerClass("pointcloud",um.PointCloudLayer);return new p({pointSize:f},this.getSubLayerProps({id:"pointcloud"}),{id:`${this.id}-pointcloud-${t.id}`,tile:t,data:h,coordinateSystem:ve.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:o,modelMatrix:a,getColor:i||d,_offset:0})}_make3DModelLayer(t){let{gltf:n,instances:r,cartographicOrigin:s,modelMatrix:i}=t.content,o=this.getSubLayerClass("scenegraph",hm.ScenegraphLayer);return new o({_lighting:"pbr"},this.getSubLayerProps({id:"scenegraph"}),{id:`${this.id}-scenegraph-${t.id}`,tile:t,data:r||cm,scenegraph:n,coordinateSystem:ve.COORDINATE_SYSTEM.METER_OFFSETS,coordinateOrigin:s,modelMatrix:i,getTransformMatrix:a=>a.modelMatrix,getPosition:[0,0,0],_offset:0})}_makeSimpleMeshLayer(t,n){let r=t.content,{attributes:s,indices:i,modelMatrix:o,cartographicOrigin:a,coordinateSystem:c=ve.COORDINATE_SYSTEM.METER_OFFSETS,material:l,featureIds:u}=r,{_getMeshColor:h}=this.props,f=n&&n.props.mesh||new lm.Geometry({topology:"triangle-list",attributes:rC(s),indices:i}),d=this.getSubLayerClass("mesh",Tr);return new d(this.getSubLayerProps({id:"mesh"}),{id:`${this.id}-mesh-${t.id}`,tile:t,mesh:f,data:cm,getColor:h(t),pbrMaterial:l,modelMatrix:o,coordinateOrigin:a,coordinateSystem:c,featureIds:u,_offset:0})}renderLayers(){let{tileset3d:t,layerMap:n}=this.state;return t?t.tiles.map(r=>{let s=n[r.id]=n[r.id]||{tile:r},{layer:i}=s;return r.selected&&(i?s.needsUpdate&&(i=this._getSubLayer(r,i),s.needsUpdate=!1):i=this._getSubLayer(r)),s.layer=i,i}).filter(Boolean):null}},Or=Ui;(()=>{Ui.defaultProps=nC})(),(()=>{Ui.layerName="Tile3DLayer"})();function rC(e){let t={};return t.positions={...e.positions,value:new Float32Array(e.positions.value)},e.normals&&(t.normals=e.normals),e.texCoords&&(t.texCoords=e.texCoords),e.colors&&(t.colors=e.colors),e.uvRegions&&(t.uvRegions=e.uvRegions),t}var Ji=N(Dt(),1),rl=N(js(),1),ym=N(Dt(),1);var sC=new Map([["centerX",Float64Array.BYTES_PER_ELEMENT],["centerY",Float64Array.BYTES_PER_ELEMENT],["centerZ",Float64Array.BYTES_PER_ELEMENT],["minHeight",Float32Array.BYTES_PER_ELEMENT],["maxHeight",Float32Array.BYTES_PER_ELEMENT],["boundingSphereCenterX",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterY",Float64Array.BYTES_PER_ELEMENT],["boundingSphereCenterZ",Float64Array.BYTES_PER_ELEMENT],["boundingSphereRadius",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointX",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointY",Float64Array.BYTES_PER_ELEMENT],["horizonOcclusionPointZ",Float64Array.BYTES_PER_ELEMENT]]);function $c(e){return e>>1^-(e&1)}function iC(e){let t=0,n={};for(let[r,s]of sC){let i=s===8?e.getFloat64:e.getFloat32;n[r]=i.call(e,t,!0),t+=s}return{header:n,headerEndPosition:t}}function oC(e,t){let n=t,r=3,s=e.getUint32(n,!0),i=new Uint16Array(s*r);n+=Uint32Array.BYTES_PER_ELEMENT;let o=Uint16Array.BYTES_PER_ELEMENT,a=s*o,c=n,l=c+a,u=l+a,h=0,f=0,d=0;for(let p=0;p<s;p++)h+=$c(e.getUint16(c+o*p,!0)),f+=$c(e.getUint16(l+o*p,!0)),d+=$c(e.getUint16(u+o*p,!0)),i[p]=h,i[p+s]=f,i[p+s*2]=d;return n+=a*3,{vertexData:i,vertexDataEndPosition:n}}function Nr(e,t,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i;if(r===2?i=new Uint16Array(e,t,n):i=new Uint32Array(e,t,n),!s)return i;let o=0;for(let a=0;a<i.length;++a){let c=i[a];i[a]=o-c,c===0&&++o}return i}function aC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT;r%o!==0&&(r+=o-r%o);let a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=a*3,l=Nr(e.buffer,r,c,o);return r+=c*o,{triangleIndicesEndPosition:r,triangleIndices:l}}function cC(e,t,n){let r=n,s=3,o=t.length/s>65536?Uint32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,a=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let c=Nr(e.buffer,r,a,o,!1);r+=a*o;let l=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let u=Nr(e.buffer,r,l,o,!1);r+=l*o;let h=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let f=Nr(e.buffer,r,h,o,!1);r+=h*o;let d=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let p=Nr(e.buffer,r,d,o,!1);return r+=d*o,{edgeIndicesEndPosition:r,westIndices:c,southIndices:u,eastIndices:f,northIndices:p}}function lC(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function uC(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}function hC(e,t){let n={};if(e.byteLength<=t)return{extensions:n,extensionsEndPosition:t};let r=t;for(;r<e.byteLength;){let s=e.getUint8(r,!0);r+=Uint8Array.BYTES_PER_ELEMENT;let i=e.getUint32(r,!0);r+=Uint32Array.BYTES_PER_ELEMENT;let o=new DataView(e.buffer,r,i);switch(s){case 1:{n.vertexNormals=lC(o);break}case 2:{n.waterMask=uC(o);break}default:}r+=i}return{extensions:n,extensionsEndPosition:r}}var sn={header:0,vertices:1,triangleIndices:2,edgeIndices:3,extensions:4},fC={maxDecodingStep:sn.extensions};function tl(e,t){let n=Object.assign({},fC,t),r=new DataView(e),{header:s,headerEndPosition:i}=iC(r);if(n.maxDecodingStep<sn.vertices)return{header:s};let{vertexData:o,vertexDataEndPosition:a}=oC(r,i);if(n.maxDecodingStep<sn.triangleIndices)return{header:s,vertexData:o};let{triangleIndices:c,triangleIndicesEndPosition:l}=aC(r,o,a);if(n.maxDecodingStep<sn.edgeIndices)return{header:s,vertexData:o,triangleIndices:c};let{westIndices:u,southIndices:h,eastIndices:f,northIndices:d,edgeIndicesEndPosition:p}=cC(r,o,l);if(n.maxDecodingStep<sn.extensions)return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h};let{extensions:A}=hC(r,p);return{header:s,vertexData:o,triangleIndices:c,westIndices:u,northIndices:d,eastIndices:f,southIndices:h,extensions:A}}function Gi(e,t,n,r){let s=r?pC(r,e.POSITION.value):dC(t),i=new e.POSITION.value.constructor(s.length*6),o=new e.TEXCOORD_0.value.constructor(s.length*4),a=new t.constructor(s.length*6);for(let l=0;l<s.length;l++){let u=s[l];mC({edge:u,edgeIndex:l,attributes:e,skirtHeight:n,newPosition:i,newTexcoord0:o,newTriangles:a})}e.POSITION.value=Xn(e.POSITION.value,i),e.TEXCOORD_0.value=Xn(e.TEXCOORD_0.value,o);let c=t instanceof Array?t.concat(a):Xn(t,a);return{attributes:e,triangles:c}}function dC(e){let t=[];for(let o=0;o<e.length;o+=3)t.push([e[o],e[o+1]]),t.push([e[o+1],e[o+2]]),t.push([e[o+2],e[o]]);t.sort((o,a)=>Math.min(...o)-Math.min(...a)||Math.max(...o)-Math.max(...a));let n=[],r=0;for(;r<t.length;){var s,i;t[r][0]===((s=t[r+1])===null||s===void 0?void 0:s[1])&&t[r][1]===((i=t[r+1])===null||i===void 0?void 0:i[0])?r+=2:(n.push(t[r]),r++)}return n}function pC(e,t){e.westIndices.sort((r,s)=>t[3*r+1]-t[3*s+1]),e.eastIndices.sort((r,s)=>t[3*s+1]-t[3*r+1]),e.southIndices.sort((r,s)=>t[3*s]-t[3*r]),e.northIndices.sort((r,s)=>t[3*r]-t[3*s]);let n=[];for(let r in e){let s=e[r];for(let i=0;i<s.length-1;i++)n.push([s[i],s[i+1]])}return n}function mC(e){let{edge:t,edgeIndex:n,attributes:r,skirtHeight:s,newPosition:i,newTexcoord0:o,newTriangles:a}=e,c=r.POSITION.value.length,l=n*2,u=n*2+1;i.set(r.POSITION.value.subarray(t[0]*3,t[0]*3+3),l*3),i[l*3+2]=i[l*3+2]-s,i.set(r.POSITION.value.subarray(t[1]*3,t[1]*3+3),u*3),i[u*3+2]=i[u*3+2]-s,o.set(r.TEXCOORD_0.value.subarray(t[0]*2,t[0]*2+2),l*2),o.set(r.TEXCOORD_0.value.subarray(t[1]*2,t[1]*2+2),u*2);let h=n*2*3;a[h]=t[0],a[h+1]=c/3+u,a[h+2]=t[1],a[h+3]=c/3+u,a[h+4]=t[0],a[h+5]=c/3+l}function el(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{bounds:n}=t,{header:r,vertexData:s,triangleIndices:i,westIndices:o,northIndices:a,eastIndices:c,southIndices:l}=tl(e,sn.triangleIndices),u=i,h=gC(s,r,n),f=Ye(h);if(t!=null&&t.skirtHeight){let{attributes:d,triangles:p}=Gi(h,u,t.skirtHeight,{westIndices:o,northIndices:a,eastIndices:c,southIndices:l});h=d,u=p}return{loaderData:{header:{}},header:{vertexCount:u.length,boundingBox:f},schema:void 0,topology:"triangle-list",mode:4,indices:{value:u,size:1},attributes:h}}function gC(e,t,n){let{minHeight:r,maxHeight:s}=t,[i,o,a,c]=n||[0,0,1,1],l=a-i,u=c-o,h=s-r,f=e.length/3,d=new Float32Array(f*3),p=new Float32Array(f*2);for(let A=0;A<f;A++){let g=e[A]/32767,y=e[A+f]/32767,E=e[A+f*2]/32767;d[3*A+0]=g*l+i,d[3*A+1]=y*u+o,d[3*A+2]=E*h+r,p[2*A+0]=g,p[2*A+1]=y}return{POSITION:{value:d,size:3},TEXCOORD_0:{value:p,size:2}}}var Dr=class{constructor(t=257){this.gridSize=t;let n=t-1;if(n&n-1)throw new Error(`Expected grid size to be 2^n+1, got ${t}.`);this.numTriangles=n*n*2-2,this.numParentTriangles=this.numTriangles-n*n,this.indices=new Uint32Array(this.gridSize*this.gridSize),this.coords=new Uint16Array(this.numTriangles*4);for(let r=0;r<this.numTriangles;r++){let s=r+2,i=0,o=0,a=0,c=0,l=0,u=0;for(s&1?a=c=l=n:i=o=u=n;(s>>=1)>1;){let f=i+a>>1,d=o+c>>1;s&1?(a=i,c=o,i=l,o=u):(i=a,o=c,a=l,c=u),l=f,u=d}let h=r*4;this.coords[h+0]=i,this.coords[h+1]=o,this.coords[h+2]=a,this.coords[h+3]=c}}createTile(t){return new nl(t,this)}},nl=class{constructor(t,n){let r=n.gridSize;if(t.length!==r*r)throw new Error(`Expected terrain data of length ${r*r} (${r} x ${r}), got ${t.length}.`);this.terrain=t,this.martini=n,this.errors=new Float32Array(t.length),this.update()}update(){let{numTriangles:t,numParentTriangles:n,coords:r,gridSize:s}=this.martini,{terrain:i,errors:o}=this;for(let a=t-1;a>=0;a--){let c=a*4,l=r[c+0],u=r[c+1],h=r[c+2],f=r[c+3],d=l+h>>1,p=u+f>>1,A=d+p-u,g=p+l-d,y=(i[u*s+l]+i[f*s+h])/2,E=p*s+d,_=Math.abs(y-i[E]);if(o[E]=Math.max(o[E],_),a<n){let B=(u+g>>1)*s+(l+A>>1),b=(f+g>>1)*s+(h+A>>1);o[E]=Math.max(o[E],o[B],o[b])}}}getMesh(t=0){let{gridSize:n,indices:r}=this.martini,{errors:s}=this,i=0,o=0,a=n-1;r.fill(0);function c(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;Math.abs(d-y)+Math.abs(p-E)>1&&s[B*n+_]>t?(c(y,E,d,p,_,B),c(A,g,y,E,_,B)):(r[p*n+d]=r[p*n+d]||++i,r[g*n+A]=r[g*n+A]||++i,r[E*n+y]=r[E*n+y]||++i,o++)}c(0,0,a,a,a,0),c(a,a,0,0,0,a);let l=new Uint16Array(i*2),u=new Uint32Array(o*3),h=0;function f(d,p,A,g,y,E){let _=d+A>>1,B=p+g>>1;if(Math.abs(d-y)+Math.abs(p-E)>1&&s[B*n+_]>t)f(y,E,d,p,_,B),f(A,g,y,E,_,B);else{let b=r[p*n+d]-1,S=r[g*n+A]-1,w=r[E*n+y]-1;l[2*b]=d,l[2*b+1]=p,l[2*S]=A,l[2*S+1]=g,l[2*w]=y,l[2*w+1]=E,u[h++]=b,u[h++]=S,u[h++]=w}}return f(0,0,a,a,a,0),f(a,a,0,0,0,a),{vertices:l,triangles:u}}};var Ur=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:n;this.data=t,this.width=n,this.height=r,this.coords=[],this.triangles=[],this._halfedges=[],this._candidates=[],this._queueIndices=[],this._queue=[],this._errors=[],this._rms=[],this._pending=[],this._pendingLen=0,this._rmsSum=0;let s=n-1,i=r-1,o=this._addPoint(0,0),a=this._addPoint(s,0),c=this._addPoint(0,i),l=this._addPoint(s,i),u=this._addTriangle(l,o,c,-1,-1,-1);this._addTriangle(o,l,a,u,-1,-1),this._flush()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;for(;this.getMaxError()>t;)this.refine()}refine(){this._step(),this._flush()}getMaxError(){return this._errors[0]}getRMSD(){return this._rmsSum>0?Math.sqrt(this._rmsSum/(this.width*this.height)):0}heightAt(t,n){return this.data[this.width*n+t]}_flush(){let t=this.coords;for(let n=0;n<this._pendingLen;n++){let r=this._pending[n],s=2*this.triangles[r*3+0],i=2*this.triangles[r*3+1],o=2*this.triangles[r*3+2];this._findCandidate(t[s],t[s+1],t[i],t[i+1],t[o],t[o+1],r)}this._pendingLen=0}_findCandidate(t,n,r,s,i,o,a){let c=Math.min(t,r,i),l=Math.min(n,s,o),u=Math.max(t,r,i),h=Math.max(n,s,o),f=on(r,s,i,o,c,l),d=on(i,o,t,n,c,l),p=on(t,n,r,s,c,l),A=s-n,g=t-r,y=o-s,E=r-i,_=n-o,B=i-t,b=on(t,n,r,s,i,o),S=this.heightAt(t,n)/b,w=this.heightAt(r,s)/b,C=this.heightAt(i,o)/b,T=0,m=0,M=0,F=0;for(let R=l;R<=h;R++){let v=0;f<0&&y!==0&&(v=Math.max(v,Math.floor(-f/y))),d<0&&_!==0&&(v=Math.max(v,Math.floor(-d/_))),p<0&&A!==0&&(v=Math.max(v,Math.floor(-p/A)));let D=f+y*v,W=d+_*v,z=p+A*v,Z=!1;for(let X=c+v;X<=u;X++){if(D>=0&&W>=0&&z>=0){Z=!0;let Y=S*D+w*W+C*z,tt=Math.abs(Y-this.heightAt(X,R));F+=tt*tt,tt>T&&(T=tt,m=X,M=R)}else if(Z)break;D+=y,W+=_,z+=A}f+=E,d+=B,p+=g}(m===t&&M===n||m===r&&M===s||m===i&&M===o)&&(T=0),this._candidates[2*a]=m,this._candidates[2*a+1]=M,this._rms[a]=F,this._queuePush(a,T,F)}_step(){let t=this._queuePop(),n=t*3+0,r=t*3+1,s=t*3+2,i=this.triangles[n],o=this.triangles[r],a=this.triangles[s],c=this.coords[2*i],l=this.coords[2*i+1],u=this.coords[2*o],h=this.coords[2*o+1],f=this.coords[2*a],d=this.coords[2*a+1],p=this._candidates[2*t],A=this._candidates[2*t+1],g=this._addPoint(p,A);if(on(c,l,u,h,p,A)===0)this._handleCollinear(g,n);else if(on(u,h,f,d,p,A)===0)this._handleCollinear(g,r);else if(on(f,d,c,l,p,A)===0)this._handleCollinear(g,s);else{let y=this._halfedges[n],E=this._halfedges[r],_=this._halfedges[s],B=this._addTriangle(i,o,g,y,-1,-1,n),b=this._addTriangle(o,a,g,E,-1,B+1),S=this._addTriangle(a,i,g,_,B+2,b+1);this._legalize(B),this._legalize(b),this._legalize(S)}}_addPoint(t,n){let r=this.coords.length>>1;return this.coords.push(t,n),r}_addTriangle(t,n,r,s,i,o){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:this.triangles.length,c=a/3;return this.triangles[a+0]=t,this.triangles[a+1]=n,this.triangles[a+2]=r,this._halfedges[a+0]=s,this._halfedges[a+1]=i,this._halfedges[a+2]=o,s>=0&&(this._halfedges[s]=a+0),i>=0&&(this._halfedges[i]=a+1),o>=0&&(this._halfedges[o]=a+2),this._candidates[2*c+0]=0,this._candidates[2*c+1]=0,this._queueIndices[c]=-1,this._rms[c]=0,this._pending[this._pendingLen++]=c,a}_legalize(t){let n=this._halfedges[t];if(n<0)return;let r=t-t%3,s=n-n%3,i=r+(t+1)%3,o=r+(t+2)%3,a=s+(n+2)%3,c=s+(n+1)%3,l=this.triangles[o],u=this.triangles[t],h=this.triangles[i],f=this.triangles[a],d=this.coords;if(!AC(d[2*l],d[2*l+1],d[2*u],d[2*u+1],d[2*h],d[2*h+1],d[2*f],d[2*f+1]))return;let p=this._halfedges[i],A=this._halfedges[o],g=this._halfedges[a],y=this._halfedges[c];this._queueRemove(r/3),this._queueRemove(s/3);let E=this._addTriangle(l,f,h,-1,g,p,r),_=this._addTriangle(f,l,u,E,A,y,s);this._legalize(E+1),this._legalize(_+2)}_handleCollinear(t,n){let r=n-n%3,s=r+(n+1)%3,i=r+(n+2)%3,o=this.triangles[i],a=this.triangles[n],c=this.triangles[s],l=this._halfedges[s],u=this._halfedges[i],h=this._halfedges[n];if(h<0){let S=this._addTriangle(t,o,a,-1,u,-1,r),w=this._addTriangle(o,t,c,S,-1,l);this._legalize(S+1),this._legalize(w+2);return}let f=h-h%3,d=f+(h+2)%3,p=f+(h+1)%3,A=this.triangles[d],g=this._halfedges[d],y=this._halfedges[p];this._queueRemove(f/3);let E=this._addTriangle(o,a,t,u,-1,-1,r),_=this._addTriangle(a,A,t,y,-1,E+1,f),B=this._addTriangle(A,c,t,g,-1,_+1),b=this._addTriangle(c,o,t,l,E+2,B+1);this._legalize(E),this._legalize(_),this._legalize(B),this._legalize(b)}_queuePush(t,n,r){let s=this._queue.length;this._queueIndices[t]=s,this._queue.push(t),this._errors.push(n),this._rmsSum+=r,this._queueUp(s)}_queuePop(){let t=this._queue.length-1;return this._queueSwap(0,t),this._queueDown(0,t),this._queuePopBack()}_queuePopBack(){let t=this._queue.pop();return this._errors.pop(),this._rmsSum-=this._rms[t],this._queueIndices[t]=-1,t}_queueRemove(t){let n=this._queueIndices[t];if(n<0){let s=this._pending.indexOf(t);if(s!==-1)this._pending[s]=this._pending[--this._pendingLen];else throw new Error("Broken triangulation (something went wrong).");return}let r=this._queue.length-1;r!==n&&(this._queueSwap(n,r),this._queueDown(n,r)||this._queueUp(n)),this._queuePopBack()}_queueLess(t,n){return this._errors[t]>this._errors[n]}_queueSwap(t,n){let r=this._queue[t],s=this._queue[n];this._queue[t]=s,this._queue[n]=r,this._queueIndices[r]=n,this._queueIndices[s]=t;let i=this._errors[t];this._errors[t]=this._errors[n],this._errors[n]=i}_queueUp(t){let n=t;for(;;){let r=n-1>>1;if(r===n||!this._queueLess(n,r))break;this._queueSwap(r,n),n=r}}_queueDown(t,n){let r=t;for(;;){let s=2*r+1;if(s>=n||s<0)break;let i=s+1,o=s;if(i<n&&this._queueLess(i,s)&&(o=i),!this._queueLess(o,r))break;this._queueSwap(r,o),r=o}return r>t}};function on(e,t,n,r,s,i){return(n-s)*(t-i)-(r-i)*(e-s)}function AC(e,t,n,r,s,i,o,a){let c=e-o,l=t-a,u=n-o,h=r-a,f=s-o,d=i-a,p=c*c+l*l,A=u*u+h*h,g=f*f+d*d;return c*(h*g-A*d)-l*(u*g-A*f)+p*(u*d-h*f)<0}function mm(e,t){let{meshMaxError:n,bounds:r,elevationDecoder:s}=t,{data:i,width:o,height:a}=e,c,l;switch(t.tesselator){case"martini":c=Vi(i,o,a,s,t.tesselator),l=dm(n,o,c);break;case"delatin":c=Vi(i,o,a,s,t.tesselator),l=pm(n,o,a,c);break;default:o===a&&!(a&o-1)?(c=Vi(i,o,a,s,"martini"),l=dm(n,o,c)):(c=Vi(i,o,a,s,"delatin"),l=pm(n,o,a,c));break}let{vertices:u}=l,{triangles:h}=l,f=xC(u,c,o,a,r),d=Ye(f);if(t.skirtHeight){let{attributes:p,triangles:A}=Gi(f,h,t.skirtHeight);f=p,h=A}return{loaderData:{header:{}},header:{vertexCount:h.length,boundingBox:d},mode:4,indices:{value:Uint32Array.from(h),size:1},attributes:f}}function dm(e,t,n){let r=t+1,i=new Dr(r).createTile(n),{vertices:o,triangles:a}=i.getMesh(e);return{vertices:o,triangles:a}}function pm(e,t,n,r){let s=new Ur(r,t+1,n+1);s.run(e);let{coords:i,triangles:o}=s;return{vertices:i,triangles:o}}function Vi(e,t,n,r,s){let{rScaler:i,bScaler:o,gScaler:a,offset:c}=r,l=new Float32Array((t+1)*(n+1));for(let u=0,h=0;h<n;h++)for(let f=0;f<t;f++,u++){let d=u*4,p=e[d+0],A=e[d+1],g=e[d+2];l[u+h]=p*i+A*a+g*o+c}if(s==="martini"){for(let u=(t+1)*t,h=0;h<t;h++,u++)l[u]=l[u-t-1];for(let u=n,h=0;h<n+1;h++,u+=n+1)l[u]=l[u-1]}return l}function xC(e,t,n,r,s){let i=n+1,o=e.length/2,a=new Float32Array(o*3),c=new Float32Array(o*2),[l,u,h,f]=s||[0,0,n,r],d=(h-l)/n,p=(f-u)/r;for(let A=0;A<o;A++){let g=e[A*2],y=e[A*2+1],E=y*i+g;a[3*A+0]=g*d+l,a[3*A+1]=-y*p+f,a[3*A+2]=t[E],c[2*A+0]=g/n,c[2*A+1]=y/r}return{POSITION:{value:a,size:3},TEXCOORD_0:{value:c,size:2}}}var Hi="4.1.4";var zi={name:"Terrain",id:"terrain",module:"terrain",version:Hi,worker:!0,extensions:["png","pngraw","jpg","jpeg","gif","webp","bmp"],mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp"],options:{terrain:{tesselator:"auto",bounds:void 0,meshMaxError:10,elevationDecoder:{rScaler:1,gScaler:0,bScaler:0,offset:0},skirtHeight:void 0}}};var gm={name:"Quantized Mesh",id:"quantized-mesh",module:"terrain",version:Hi,worker:!0,extensions:["terrain"],mimeTypes:["application/vnd.quantized-mesh"],options:{"quantized-mesh":{bounds:[0,0,1,1],skirtHeight:null}}};var yC={...zi,parse:TC};async function TC(e,t,n){let r={...t,mimeType:"application/x.image",image:{...t?.image,type:"data"}},s=await Ct(e,[],r,n),i={...yC.options.terrain,...t?.terrain};return mm(s,i)}var jG={...gm,parseSync:(e,t)=>el(e,t?.["quantized-mesh"]),parse:async(e,t)=>el(e,t?.["quantized-mesh"])};var Am=[1],_C={...$t.defaultProps,elevationData:Se,texture:{...Se,optional:!0},meshMaxError:{type:"number",value:4},bounds:{type:"array",value:null,optional:!0,compare:!0},color:{type:"color",value:[255,255,255]},elevationDecoder:{type:"object",value:{rScaler:1,gScaler:0,bScaler:0,offset:0}},workerUrl:"",wireframe:!1,material:!0,loaders:[zi]};function xm(e){return Array.isArray(e)?e.join(";"):e||""}var ki=class extends Ji.CompositeLayer{updateState({props:t,oldProps:n}){let r=t.elevationData!==n.elevationData;if(r){let{elevationData:i}=t,o=i&&(Array.isArray(i)||i.includes("{x}")&&i.includes("{y}"));this.setState({isTiled:o})}let s=r||t.meshMaxError!==n.meshMaxError||t.elevationDecoder!==n.elevationDecoder||t.bounds!==n.bounds;if(!this.state.isTiled&&s){let i=this.loadTerrain(t);this.setState({terrain:i})}t.workerUrl&&Ji.log.removed("workerUrl","loadOptions.terrain.workerUrl")()}loadTerrain({elevationData:t,bounds:n,elevationDecoder:r,meshMaxError:s,signal:i}){if(!t)return null;let o=this.getLoadOptions();o={...o,terrain:{skirtHeight:this.state.isTiled?s*2:0,...o?.terrain,bounds:n,meshMaxError:s,elevationDecoder:r}};let{fetch:a}=this.props;return a(t,{propName:"elevationData",layer:this,loadOptions:o,signal:i})}getTiledTerrainData(t){let{elevationData:n,fetch:r,texture:s,elevationDecoder:i,meshMaxError:o}=this.props,{viewport:a}=this.context,c=Zt(n,t),l=s&&Zt(s,t),{signal:u}=t,h=[0,0],f=[0,0];if(a.isGeospatial){let g=t.bbox;h=a.projectFlat([g.west,g.south]),f=a.projectFlat([g.east,g.north])}else{let g=t.bbox;h=[g.left,g.bottom],f=[g.right,g.top]}let d=[h[0],h[1],f[0],f[1]],p=this.loadTerrain({elevationData:c,bounds:d,elevationDecoder:i,meshMaxError:o,signal:u}),A=l?r(l,{propName:"texture",layer:this,loaders:[],signal:u}).catch(g=>null):Promise.resolve(null);return Promise.all([p,A])}renderSubLayers(t){let n=this.getSubLayerClass("mesh",rl.SimpleMeshLayer),{color:r,wireframe:s,material:i}=this.props,{data:o}=t;if(!o)return null;let[a,c]=o;return new n(t,{data:Am,mesh:a,texture:c,_instanced:!1,coordinateSystem:ym.COORDINATE_SYSTEM.CARTESIAN,getPosition:l=>[0,0,0],getColor:r,wireframe:s,material:i})}onViewportLoad(t){if(!t)return;let{zRange:n}=this.state,r=t.map(o=>o.content).filter(Boolean).map(o=>o[0].header.boundingBox.map(c=>c[2]));if(r.length===0)return;let s=Math.min(...r.map(o=>o[0])),i=Math.max(...r.map(o=>o[1]));(!n||s<n[0]||i>n[1])&&this.setState({zRange:[s,i]})}renderLayers(){let{color:t,material:n,elevationData:r,texture:s,wireframe:i,meshMaxError:o,elevationDecoder:a,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E}=this.props;if(this.state.isTiled)return new $t(this.getSubLayerProps({id:"tiles"}),{getTileData:this.getTiledTerrainData.bind(this),renderSubLayers:this.renderSubLayers.bind(this),updateTriggers:{getTileData:{elevationData:xm(r),texture:xm(s),meshMaxError:o,elevationDecoder:a}},onViewportLoad:this.onViewportLoad.bind(this),zRange:this.state.zRange||null,tileSize:c,maxZoom:l,minZoom:u,extent:h,maxRequests:f,onTileLoad:d,onTileUnload:p,onTileError:A,maxCacheSize:g,maxCacheByteSize:y,refinementStrategy:E});if(!r)return null;let _=this.getSubLayerClass("mesh",rl.SimpleMeshLayer);return new _(this.getSubLayerProps({id:"mesh"}),{data:Am,mesh:this.state.terrain,texture:s,_instanced:!1,getPosition:B=>[0,0,0],getColor:t,material:n,wireframe:i})}},Gr=ki;(()=>{ki.defaultProps=_C})(),(()=>{ki.layerName="TerrainLayer"})();var ro=N(Dt(),1),_l=N(Nt(),1),$m=N(_m(),1);var Vr={x:0,y:1,z:2};function an(e,t={}){let{start:n=0,end:r=e.length,plane:s="xy"}=t,i=t.size||2,o=0,a=Vr[s[0]],c=Vr[s[1]];for(let l=n,u=r-i;l<r;l+=i)o+=(e[l+a]-e[u+a])*(e[l+c]+e[u+c]),u=l;return o/2}function il(e,t,n=2,r,s="xy"){let i=t&&t.length,o=i?t[0]*n:e.length,a=Bm(e,0,o,n,!0,r&&r[0],s),c=[];if(!a||a.next===a.prev)return c;let l,u,h,f,d,p,A;if(i&&(a=IC(e,t,a,n,r,s)),e.length>80*n){f=u=e[0],d=h=e[1];for(let g=n;g<o;g+=n)p=e[g],A=e[g+1],p<f&&(f=p),A<d&&(d=A),p>u&&(u=p),A>h&&(h=A);l=Math.max(u-f,h-d),l=l!==0?32767/l:0}return Hr(a,c,n,f,d,l,0),c}function Bm(e,t,n,r,s,i,o){let a,c;i===void 0&&(i=an(e,{start:t,end:n,size:r,plane:o}));let l=Vr[o[0]],u=Vr[o[1]];if(s===i<0)for(a=t;a<n;a+=r)c=Em(a,e[a+l],e[a+u],c);else for(a=n-r;a>=t;a-=r)c=Em(a,e[a+l],e[a+u],c);return c&&Xi(c,c.next)&&(kr(c),c=c.next),c}function cn(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Xi(n,n.next)||nt(n.prev,n,n.next)===0)){if(kr(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Hr(e,t,n,r,s,i,o){if(!e)return;!o&&i&&LC(e,r,s,i);let a=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,i?bC(e,r,s,i):CC(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),kr(e),e=l.next,a=l.next;continue}if(e=l,e===a){o?o===1?(e=SC(cn(e),t,n),Hr(e,t,n,r,s,i,2)):o===2&&MC(e,t,n,r,s,i):Hr(cn(e),t,n,r,s,i,1);break}}}function CC(e){let t=e.prev,n=e,r=e.next;if(nt(t,n,r)>=0)return!1;let s=t.x,i=n.x,o=r.x,a=t.y,c=n.y,l=r.y,u=s<i?s<o?s:o:i<o?i:o,h=a<c?a<l?a:l:c<l?c:l,f=s>i?s>o?s:o:i>o?i:o,d=a>c?a>l?a:l:c>l?c:l,p=r.next;for(;p!==t;){if(p.x>=u&&p.x<=f&&p.y>=h&&p.y<=d&&Hn(s,a,i,c,o,l,p.x,p.y)&&nt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function bC(e,t,n,r){let s=e.prev,i=e,o=e.next;if(nt(s,i,o)>=0)return!1;let a=s.x,c=i.x,l=o.x,u=s.y,h=i.y,f=o.y,d=a<c?a<l?a:l:c<l?c:l,p=u<h?u<f?u:f:h<f?h:f,A=a>c?a>l?a:l:c>l?c:l,g=u>h?u>f?u:f:h>f?h:f,y=sl(d,p,t,n,r),E=sl(A,g,t,n,r),_=e.prevZ,B=e.nextZ;for(;_&&_.z>=y&&B&&B.z<=E;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Hn(a,u,c,h,l,f,_.x,_.y)&&nt(_.prev,_,_.next)>=0||(_=_.prevZ,B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==o&&Hn(a,u,c,h,l,f,B.x,B.y)&&nt(B.prev,B,B.next)>=0))return!1;B=B.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=A&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Hn(a,u,c,h,l,f,_.x,_.y)&&nt(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;B&&B.z<=E;){if(B.x>=d&&B.x<=A&&B.y>=p&&B.y<=g&&B!==s&&B!==o&&Hn(a,u,c,h,l,f,B.x,B.y)&&nt(B.prev,B,B.next)>=0)return!1;B=B.nextZ}return!0}function SC(e,t,n){let r=e;do{let s=r.prev,i=r.next.next;!Xi(s,i)&&Cm(s,r,r.next,i)&&zr(s,i)&&zr(i,s)&&(t.push(s.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),kr(r),kr(r.next),r=e=i),r=r.next}while(r!==e);return cn(r)}function MC(e,t,n,r,s,i){let o=e;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&NC(o,a)){let c=bm(o,a);o=cn(o,o.next),c=cn(c,c.next),Hr(o,t,n,r,s,i,0),Hr(c,t,n,r,s,i,0);return}a=a.next}o=o.next}while(o!==e)}function IC(e,t,n,r,s,i){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*r,u=a<c-1?t[a+1]*r:e.length,h=Bm(e,l,u,r,!1,s&&s[a+1],i),h===h.next&&(h.steiner=!0),o.push(OC(h));for(o.sort(wC),a=0;a<o.length;a++)n=vC(o[a],n);return n}function wC(e,t){return e.x-t.x}function vC(e,t){let n=FC(e,t);if(!n)return t;let r=bm(n,e);return cn(r,r.next),cn(n,n.next)}function FC(e,t){let n=t,r=e.x,s=e.y,i=-1/0,o;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){let f=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(f<=r&&f>i&&(i=f,o=n.x<n.next.x?n:n.next,f===r))return o}n=n.next}while(n!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;n=o;do r>=n.x&&n.x>=c&&r!==n.x&&Hn(s<l?r:i,s,c,l,s<l?i:r,s,n.x,n.y)&&(h=Math.abs(s-n.y)/(r-n.x),zr(n,e)&&(h<u||h===u&&(n.x>o.x||n.x===o.x&&RC(o,n)))&&(o=n,u=h)),n=n.next;while(n!==a);return o}function RC(e,t){return nt(e.prev,e,t.prev)<0&&nt(t.next,e,e.next)<0}function LC(e,t,n,r){let s=e;do s.z===0&&(s.z=sl(s.x,s.y,t,n,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,PC(s)}function PC(e){let t,n,r=1,s,i,o,a,c,l;do{for(i=e,e=null,l=null,s=0;i;){for(s++,a=i,o=0,n=0;n<r&&(o++,a=a.nextZ,!!a);n++);for(c=r;o>0||c>0&&a;)o!==0&&(c===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;i=a}l.nextZ=null,r*=2}while(s>1);return e}function sl(e,t,n,r,s){return e=(e-n)*s|0,t=(t-r)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function OC(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Hn(e,t,n,r,s,i,o,a){return(s-o)*(t-a)>=(e-o)*(i-a)&&(e-o)*(r-a)>=(n-o)*(t-a)&&(n-o)*(i-a)>=(s-o)*(r-a)}function NC(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!DC(e,t)&&(zr(e,t)&&zr(t,e)&&UC(e,t)&&(nt(e.prev,e,t.prev)||nt(e,t.prev,t))||Xi(e,t)&&nt(e.prev,e,e.next)>0&&nt(t.prev,t,t.next)>0)}function nt(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Xi(e,t){return e.x===t.x&&e.y===t.y}function Cm(e,t,n,r){let s=ji(nt(e,t,n)),i=ji(nt(e,t,r)),o=ji(nt(n,r,e)),a=ji(nt(n,r,t));return!!(s!==i&&o!==a||s===0&&qi(e,n,t)||i===0&&qi(e,r,t)||o===0&&qi(n,e,r)||a===0&&qi(n,t,r))}function qi(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ji(e){return e>0?1:e<0?-1:0}function DC(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Cm(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function zr(e,t){return nt(e.prev,e,e.next)<0?nt(e,t,e.next)>=0&&nt(e,e.prev,t)>=0:nt(e,t,e.prev)<0||nt(e,e.next,t)<0}function UC(e,t){let n=e,r=!1,s=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&s<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function bm(e,t){let n=new Jr(e.i,e.x,e.y),r=new Jr(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=s,s.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Em(e,t,n,r){let s=new Jr(e,t,n);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function kr(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var Jr=class{constructor(t,n,r){L(this,"i",void 0),L(this,"x",void 0),L(this,"y",void 0),L(this,"prev",null),L(this,"next",null),L(this,"z",0),L(this,"prevZ",null),L(this,"nextZ",null),L(this,"steiner",!1),this.i=t,this.x=n,this.y=r}};function cl(e,t,n){let r=kC(e),s=Object.keys(r).filter(i=>r[i]!==Array);return JC(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||s,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function kC(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let s=n.properties[r];t[r]=KC(s,t[r])}return t}function JC(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:s,linePositionsCount:i,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:f,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:A=Float32Array,triangulate:g=!0}=n,y=e[0]&&"id"in e[0],E=e.length>65535?Uint32Array:Uint16Array,_={type:"Point",positions:new A(r*d),globalFeatureIds:new E(r),featureIds:s>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},B={type:"LineString",pathIndices:i>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new A(i*d),globalFeatureIds:new E(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},b={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new A(c*d),globalFeatureIds:new E(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};g&&(b.triangles=[]);for(let w of[_,B,b])for(let C of p){let T=f[C];w.numericProps[C]=new T(w.positions.length/d)}B.pathIndices[o]=i,b.polygonIndices[l]=c,b.primitivePolygonIndices[u]=c;let S={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let w of e){let C=w.geometry,T=w.properties||{};switch(C.type){case"Point":qC(C,_,S,d,T),_.properties.push(al(T,p)),y&&_.fields.push({id:w.id}),S.pointFeature++;break;case"LineString":jC(C,B,S,d,T),B.properties.push(al(T,p)),y&&B.fields.push({id:w.id}),S.lineFeature++;break;case"Polygon":XC(C,b,S,d,T),b.properties.push(al(T,p)),y&&b.fields.push({id:w.id}),S.polygonFeature++;break;default:throw new Error("Invalid geometry type")}S.feature++}return YC(_,B,b,d)}function qC(e,t,n,r,s){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;ll(t,s,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function jC(e,t,n,r,s){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;ll(t,s,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=e.indices[o],l=o===a-1?e.data.length:e.indices[o+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(l-c)/r}}function XC(e,t,n,r,s){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;ll(t,s,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let o=0,a=e.indices.length;o<a;++o){let c=n.polygonPosition;t.polygonIndices[n.polygonObject++]=c;let l=e.areas[o],u=e.indices[o],h=e.indices[o+1];for(let d=0,p=u.length;d<p;++d){let A=u[d],g=d===p-1?h===void 0?e.data.length:h[0]:u[d+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(g-A)/r}let f=n.polygonPosition;WC(t,l,u,{startPosition:c,endPosition:f,coordLength:r})}}function WC(e,t,n,r){let{startPosition:s,endPosition:i,coordLength:o}=r;if(!e.triangles)return;let a=s*o,c=i*o,l=e.positions.subarray(a,c),u=n[0],h=n.slice(1).map(d=>(d-u)/o),f=il(l,h,o,t);for(let d=0,p=f.length;d<p;++d)e.triangles.push(s+f[d])}function ol(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function YC(e,t,n,r){let s={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:ol(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:ol(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:ol(n.numericProps,1)}};return s.polygons&&n.triangles&&(s.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),s}function ll(e,t,n,r){for(let s in e.numericProps)if(s in t){let i=t[s];e.numericProps[s].fill(i,n,n+r)}}function al(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function KC(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function Ki(e,t){let n=t?.globalFeatureId;return n!==void 0?QC(e,n):ZC(e,t?.type)}function QC(e,t){let n=wm(e);for(let r of n){let s=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];if(a!==i){if(t===r.globalFeatureIds.value[s])return Wi(r,s,o);s=o,i=a}}if(t===r.globalFeatureIds.value[s])return Wi(r,s,r.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function ZC(e,t){let n=wm(e,t);return $C(n)}function Im(e,t,n){switch(e.type){case"Point":return rb(e,t,n);case"LineString":return nb(e,t,n);case"Polygon":return vm(e,t,n);default:let r=e;throw new Error(`Unsupported geometry type: ${r?.type}`)}}function wm(e,t){let n=[];return e.points&&(e.points.type="Point",n.push(e.points)),e.lines&&(e.lines.type="LineString",n.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",n.push(e.polygons)),n}function $C(e){let t=[];for(let n of e){if(n.featureIds.value.length===0)continue;let r=0,s=n.featureIds.value[0];for(let i=0;i<n.featureIds.value.length;i++){let o=n.featureIds.value[i];o!==s&&(t.push(Wi(n,r,i)),r=i,s=o)}t.push(Wi(n,r,n.featureIds.value.length))}return t}function Wi(e,t,n){let r=Im(e,t,n),s=eb(e,t,n),i=tb(e,t,n);return{type:"Feature",geometry:r,properties:s,...i}}function tb(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0;return e.fields&&e.fields[e.featureIds.value[t]]}function eb(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,r=Object.assign({},e.properties[e.featureIds.value[t]]);for(let s in e.numericProps)r[s]=e.numericProps[s].value[t];return r}function vm(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.polygonIndices.value.filter(c=>c>=t&&c<=n),i=e.primitivePolygonIndices.value.filter(c=>c>=t&&c<=n);if(!(s.length>2)){let c=[];for(let l=0;l<i.length-1;l++){let u=i[l],h=i[l+1],f=Yi(r,u,h);c.push(f)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1],h=vm(e,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function nb(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:-1/0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1/0,{positions:r}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=n);if(!(s.length>2))return{type:"LineString",coordinates:Yi(r,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let c=Yi(r,s[a],s[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function rb(e,t,n){let{positions:r}=e,s=Yi(r,t,n);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function Yi(e,t,n){t=t||0,n=n||e.value.length/e.size;let r=[];for(let s=t;s<n;s++){let i=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)i.push(Number(e.value[o]));r.push(i)}return r}var gl=N(Dm(),1);function Um(e){let t=e.length;if(t<=1)return[e];let n=[],r,s;for(let i=0;i<t;i++){let o=_b(e[i]);o!==0&&(s===void 0&&(s=o<0),s===o<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function _b(e){let t=0;for(let n=0,r=e.length-1,s,i;n<e.length;r=n++)s=e[n],i=e[r],t+=(i[0]-s[0])*(s[1]+i[1]);return t}function Gm(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?Eb(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function Eb(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var ln=class{static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,r,s,i){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,t.readFields(Gm,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=[],c;for(;t.pos<n;){if(s<=0){let l=t.readVarint();r=l&7,s=l>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),r===1&&(c&&a.push(c),c=[]),c&&c.push([i,o]);else if(r===7)c&&c.push(c[0].slice());else throw new Error(`unknown command ${r}`)}return c&&a.push(c),a}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,s=0,i=0,o=0,a=1/0,c=-1/0,l=1/0,u=-1/0;for(;t.pos<n;){if(s<=0){let h=t.readVarint();r=h&7,s=h>>3}if(s--,r===1||r===2)i+=t.readSVarint(),o+=t.readSVarint(),i<a&&(a=i),i>c&&(c=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,l,c,u]}_toGeoJSON(t){let n=this.loadGeometry(),r=ln.types[this.type],s,i;switch(this.type){case 1:let a=[];for(s=0;s<n.length;s++)a[s]=n[s][0];n=a,t(n,this);break;case 2:for(s=0;s<n.length;s++)t(n[s],this);break;case 3:for(n=Um(n),s=0;s<n.length;s++)for(i=0;i<n[s].length;i++)t(n[s][i],this);break}n.length===1?n=n[0]:r=`Multi${r}`;let o={type:"Feature",geometry:{type:r,coordinates:n},properties:this.properties};return this.id!==null&&(o.id=this.id),o}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;function c(l){for(let u=0;u<l.length;u++){let h=l[u];h[0]=(h[0]+o)*360/i-180;let f=180-(h[1]+a)*360/i;h[1]=360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90}}return this._toGeoJSON(c)}};var qr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Bb,this,n),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new ln(this._pbf,n,this.extent,this._keys,this._values)}};function Bb(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(Cb(n)))}function Cb(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var jr=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(bb,{},n)}};function bb(e,t,n){if(e===3&&n){let r=new qr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Vm(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[an(e.data)]],indices:[e.indices]};let r=[],s=[],i=[],o=[],a,c=0;for(let l,u=0,h;u<t;u++){h=e.indices[u]-c,l=e.indices[u+1]-c||e.data.length;let f=e.data.slice(h,l),d=an(f);if(d===0){let p=e.data.slice(0,h),A=e.data.slice(l);e.data=p.concat(A),c+=l-h;continue}a===void 0&&(a=d<0),a===d<0?(o.length&&(r.push(i),s.push(o)),o=[h],i=[d]):(i.push(d),o.push(h))}return i&&r.push(i),o.length&&s.push(o),{type:n,areas:r,indices:s,data:e.data}}function Hm(e,t,n,r){for(let s=0,i=e.length;s<i;s+=2){e[s]=(e[s]+t)*360/r-180;let o=180-(e[s+1]+n)*360/r;e[s+1]=360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90}}function zm(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?Sb(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function Sb(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],s=t._values[e.readVarint()];t.properties[r]=s}}var km,un,fl,$i,dl,pl,Xr;var Wr=class{constructor(t,n,r,s,i,o){this.properties=void 0,this.extent=void 0,this.type=void 0,this.id=void 0,this._pbf=void 0,this._geometry=void 0,this._keys=void 0,this._values=void 0,this._geometryInfo=void 0,this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=s,this._values=i,this._geometryInfo=o,t.readFields(zm,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,km=t.readVarint()+t.pos,un=1,$i=0,dl=0,pl=0,Xr=0;let n=[],r=[];for(;t.pos<km;)if($i<=0&&(fl=t.readVarint(),un=fl&7,$i=fl>>3),$i--,un===1||un===2)dl+=t.readSVarint(),pl+=t.readSVarint(),un===1&&n.push(Xr),r.push(dl,pl),Xr+=2;else if(un===7){if(Xr>0){let s=n[n.length-1];r.push(r[s],r[s+1]),Xr+=2}}else throw new Error(`unknown command ${un}`);return{data:r,indices:n}}_toBinaryCoordinates(t){let n=this.loadGeometry(),r;t(n.data,this);let s=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/s,r={type:"LineString",...n};break;case 3:r=Vm(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let o of r.indices)this._geometryInfo.polygonRingsCount+=o.length;this._geometryInfo.polygonPositionsCount+=r.data.length/s;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:r,z:s}=t,i=this.extent*Math.pow(2,s),o=this.extent*n,a=this.extent*r;return this._toBinaryCoordinates(c=>Hm(c,o,a,i))}};var Yr=class{constructor(t,n){this.version=void 0,this.name=void 0,this.extent=void 0,this.length=void 0,this._pbf=void 0,this._keys=void 0,this._values=void 0,this._features=void 0,this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Mb,this,n),this.length=this._features.length}feature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Wr(this._pbf,r,this.extent,this._keys,this._values,n)}};function Mb(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(Ib(n)))}function Ib(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var Kr=class{constructor(t,n){this.layers=void 0,this.layers=t.readFields(wb,{},n)}};function wb(e,t,n){if(e===3&&n){let r=new Yr(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function to(e,t){var n,r;let s=Fb(t),i=(t==null||(n=t.gis)===null||n===void 0?void 0:n.format)||(t==null||(r=t.mvt)===null||r===void 0?void 0:r.shape)||t?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:ml(e,s)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Jm(e,s)};case"geojson":return Jm(e,s);case"binary-geometry":return ml(e,s);case"binary":return ml(e,s);default:throw new Error(i||"undefined shape")}}function ml(e,t){let[n,r]=vb(e,t),s=cl(n,r);return s.byteLength=e.byteLength,s}function vb(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let s=new Kr(new gl.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(s.layers)).forEach(o=>{let a=s.layers[o];if(a)for(let c=0;c<a.length;c++){let l=a.feature(c,r),u=Lb(l,t,o);n.push(u)}}),[n,r]}function Jm(e,t){if(e.byteLength<=0)return[];let n=[],r=new jr(new gl.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let o=r.layers[i];if(o)for(let a=0;a<o.length;a++){let c=o.feature(a),l=Rb(c,t,i);n.push(l)}}),n}function Fb(e){var t;if(!(e!=null&&e.mvt))throw new Error("mvt options required");let n=((t=e.mvt)===null||t===void 0?void 0:t.coordinates)==="wgs84",{tileIndex:r}=e.mvt,s=r&&Number.isFinite(r.x)&&Number.isFinite(r.y)&&Number.isFinite(r.z);if(n&&!s)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function Rb(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:Pb);return t.layerProperty&&(r.properties[t.layerProperty]=n),r}function Lb(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:Ob);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function Pb(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let s=e[r];s[0]/=n,s[1]/=n}}function Ob(e,t){let{extent:n}=t;for(let r=0,s=e.length;r<s;++r)e[r]/=n}var Nb="4.1.4",eo={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:Nb,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},Db={...eo,parse:async(e,t)=>to(e,t),parseSync:to,binary:!0};var Ub={Point:qm,MultiPoint:Gb,LineString:jm,MultiLineString:Vb,Polygon:Xm,MultiPolygon:Hb};function qm([e,t],[n,r],s){let i=ye(n[0],r[0],e),o=ye(n[1],r[1],t);return s.unprojectFlat([i,o])}function Al(e,t,n){return e.map(r=>qm(r,t,n))}function Gb(e,t,n){return Al(e,t,n)}function jm(e,t,n){return Al(e,t,n)}function Vb(e,t,n){return e.map(r=>jm(r,t,n))}function Xm(e,t,n){return e.map(r=>Al(r,t,n))}function Hb(e,t,n){return e.map(r=>Xm(r,t,n))}function Wm(e,t,n){let r=n.projectFlat([t.west,t.north]),s=n.projectFlat([t.east,t.south]),i=[r,s];return{...e,coordinates:Ub[e.type](e.coordinates,i,n)}}var zb=["points","lines","polygons"];function xl(e,t,n,r){for(let s of zb){let i=e[s]&&kb(e[s],t,n,r);if(i>=0)return i}return-1}function kb(e,t,n,r){let s=e.featureIds.value;if(!s.length)return-1;let i=0,o=s[s.length-1]+1;if(r){let c=Jb(e,r);if(c)i=c[0],o=c[1]+1;else return-1}let a=-1;if(t in e.numericProps){let c=e.numericProps[t].value.findIndex((l,u)=>l===n&&s[u]>=i&&s[u]<o);return c>=0?e.globalFeatureIds.value[c]:-1}else t?a=Ym(e.properties,c=>c[t]===n,i,o):e.fields&&(a=Ym(e.fields,c=>c.id===n,i,o));return a>=0?qb(e,a):-1}function Jb(e,t){if(!e.__layers){let n={},{properties:r}=e;for(let s=0;s<r.length;s++){let{layerName:i}=r[s];i&&(n[i]?n[i][1]=s:n[i]=[s,s])}e.__layers=n}return e.__layers[t]}function qb(e,t){if(!e.__ids){let n=[],r=e.featureIds.value,s=e.globalFeatureIds.value;for(let i=0;i<r.length;i++)n[r[i]]=s[i];e.__ids=n}return e.__ids[t]}function Ym(e,t,n,r){for(let s=n;s<r;s++)if(t(e[s],s))return s;return-1}var yl=512,jb={..._l.GeoJsonLayer.defaultProps,data:Se,onDataLoad:{type:"function",value:null,optional:!0,compare:!1},uniqueIdProperty:"",highlightedFeatureId:null,loaders:[eo],binary:!0},no=class extends $t{initializeState(){super.initializeState();let t=this.context.viewport.resolution!==void 0?!1:this.props.binary;this.setState({binary:t,data:null,tileJSON:null,hoveredFeatureId:null,hoveredFeatureLayerName:null})}get isLoaded(){return Boolean(this.state?.data&&super.isLoaded)}updateState({props:t,oldProps:n,context:r,changeFlags:s}){s.dataChanged&&this._updateTileData(),this.state?.data&&(super.updateState({props:t,oldProps:n,context:r,changeFlags:s}),this._setWGS84PropertyForTiles());let{highlightColor:i}=t;i!==n.highlightColor&&Array.isArray(i)&&this.setState({highlightColor:i})}async _updateTileData(){let t=this.props.data,n=null;if(typeof t=="string"&&!Sa(t)){let{onDataLoad:r,fetch:s}=this.props;this.setState({data:null,tileJSON:null});try{n=await s(t,{propName:"data",layer:this,loaders:[]})}catch(i){this.raiseError(i,"loading TileJSON"),t=null}r&&r(n,{propName:"data",layer:this})}else t&&typeof t=="object"&&"tilejson"in t&&(n=t);n&&(t=n.tiles),this.setState({data:t,tileJSON:n})}_getTilesetOptions(){let t=super._getTilesetOptions(),n=this.state.tileJSON,{minZoom:r,maxZoom:s}=this.props;return n&&(Number.isFinite(n.minzoom)&&n.minzoom>r&&(t.minZoom=n.minzoom),Number.isFinite(n.maxzoom)&&(!Number.isFinite(s)||n.maxzoom<s)&&(t.maxZoom=n.maxzoom)),t}renderLayers(){return this.state?.data?super.renderLayers():null}getTileData(t){let{data:n,binary:r}=this.state,{index:s,signal:i}=t,o=Zt(n,t);if(!o)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:c}=this.props;return a={...a,mimeType:"application/x-protobuf",mvt:{...a?.mvt,coordinates:this.context.viewport.resolution?"wgs84":"local",tileIndex:s},gis:r?{format:"binary"}:{}},c(o,{propName:"data",layer:this,loadOptions:a,signal:i})}renderSubLayers(t){let{x:n,y:r,z:s}=t.tile.index,i=Math.pow(2,s),o=yl/i,a=-o,c=yl*n/i,l=yl*(1-r/i),u=new P().scale([o,a,1]);t.autoHighlight=!1,this.context.viewport.resolution||(t.modelMatrix=u,t.coordinateOrigin=[c,l,0],t.coordinateSystem=ro.COORDINATE_SYSTEM.CARTESIAN,t.extensions=[...t.extensions||[],new $m.ClipExtension]);let h=super.renderSubLayers(t);return this.state.binary&&!(h instanceof _l.GeoJsonLayer)&&ro.log.warn("renderSubLayers() must return GeoJsonLayer when using binary:true")(),h}_updateAutoHighlight(t){let{uniqueIdProperty:n}=this.props,{hoveredFeatureId:r,hoveredFeatureLayerName:s}=this.state,i=t.object,o=null,a=null;i&&(o=Tl(i,n),a=Km(i));let{highlightColor:c}=this.props;typeof c=="function"&&(c=c(t)),(r!==o||s!==a)&&this.setState({highlightColor:c,hoveredFeatureId:o,hoveredFeatureLayerName:a})}getPickingInfo(t){let n=super.getPickingInfo(t),r=Boolean(this.context.viewport.resolution);if(this.state.binary&&n.index!==-1){let{data:s}=t.sourceLayer.props;n.object=Ki(s,{globalFeatureId:n.index})}return n.object&&!r&&(n.object=Zm(n.object,n.tile.bbox,this.context.viewport)),n}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:n,hoveredFeatureLayerName:r,binary:s}=this.state,{uniqueIdProperty:i,highlightedFeatureId:o}=this.props,a=t.content,c=Qm(o);if(!(Qm(n)||c))return-1;let u=c?o:n;return Array.isArray(a)?a.findIndex(h=>{let f=Tl(h,i)===u,d=c||Km(h)===r;return f&&d}):a&&s?xl(a,i,u,c?"":r):-1}_pickObjects(t){let{deck:n,viewport:r}=this.context,s=r.width,i=r.height,o=r.x,a=r.y,c=[this.id];return n.pickObjects({x:o,y:a,width:s,height:i,layerIds:c,maxObjects:t})}getRenderedFeatures(t=null){let n=this._pickObjects(t),r=new Set,s=[];for(let i of n){let o=Tl(i.object,this.props.uniqueIdProperty);o===void 0?s.push(i.object):r.has(o)||(r.add(o),s.push(i.object))}return s}_setWGS84PropertyForTiles(){let t="dataInWGS84";this.state.tileset.selectedTiles.forEach(r=>{r.hasOwnProperty(t)||Object.defineProperty(r,t,{get:()=>{if(!r.content)return null;if(this.state.binary&&Array.isArray(r.content)&&!r.content.length)return[];let{bbox:s}=r;if(r._contentWGS84===void 0&&Ma(s)){let i=this.state.binary?Ki(r.content):r.content;r._contentWGS84=i.map(o=>Zm(o,s,this.context.viewport))}return r._contentWGS84}})})}},Qr=no;(()=>{no.layerName="MVTLayer"})(),(()=>{no.defaultProps=jb})();function Tl(e,t){if(e.properties&&t)return e.properties[t];if("id"in e)return e.id}function Km(e){return e.properties?.layerName||null}function Qm(e){return e!=null&&e!==""}function Zm(e,t,n){let r={...e,geometry:{type:e.geometry.type}};return Object.defineProperty(r.geometry,"coordinates",{get:()=>Wm(e.geometry,t,n).coordinates}),r}var tg="0123456789bcdefghjkmnpqrstuvwxyz",eg={};for(let e=0;e<tg.length;e++)eg[tg.charAt(e)]=e;var Xb=-90,Wb=90,Yb=-180,Kb=180;function Qb(e){let t=!0,n=Wb,r=Xb,s=Kb,i=Yb,o,a=0;for(let c=0,l=e.length;c<l;c++){let u=e[c].toLowerCase();a=eg[u];for(let h=4;h>=0;h--){let f=a>>h&1;t?(o=(s+i)/2,f===1?i=o:s=o):(o=(n+r)/2,f===1?r=o:n=o),t=!t}}return[r,i,n,s]}function ng(e){let[t,n,r,s]=Qb(e);return[s,r,s,t,n,t,n,r,s,r]}var Zb={getGeohash:{type:"accessor",value:e=>e.geohash}},so=class extends It{indexToBounds(){let{data:t,getGeohash:n}=this.props;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(r,s)=>ng(n(r,s))}}},Zr=so;(()=>{so.layerName="GeohashLayer"})(),(()=>{so.defaultProps=Zb})();return ug($r);})();
770
449
  return __exports__;
771
450
  });